Compare commits

..

No commits in common. "develop" and "master" have entirely different histories.

8 changed files with 2 additions and 19984 deletions

View File

@ -1,13 +0,0 @@
name: Build/Publish
on:
push:
branches:
- master
- develop
- develop-*
jobs:
main:
uses: lumeweb/github-node-deploy-workflow/.github/workflows/main.yml@master
secrets: inherit

View File

@ -1,8 +0,0 @@
{
"preset": [
"@lumeweb/presetter-kernel-module-preset"
],
"config": {
"official": true
}
}

View File

@ -1,47 +0,0 @@
# [0.1.0-develop.9](https://git.lumeweb.com/LumeWeb/kernel-network-registry/compare/v0.1.0-develop.8...v0.1.0-develop.9) (2023-10-09)
### Features
* add subscribeToUpdates method to listen for updates ([f11297d](https://git.lumeweb.com/LumeWeb/kernel-network-registry/commit/f11297d5cd0dc06d0f7ed5b43cf1b5d939596b7a))
# [0.1.0-develop.8](https://git.lumeweb.com/LumeWeb/kernel-network-registry/compare/v0.1.0-develop.7...v0.1.0-develop.8) (2023-09-03)
# [0.1.0-develop.7](https://git.lumeweb.com/LumeWeb/kernel-network-registry/compare/v0.1.0-develop.6...v0.1.0-develop.7) (2023-09-02)
# [0.1.0-develop.6](https://git.lumeweb.com/LumeWeb/kernel-network-registry/compare/v0.1.0-develop.5...v0.1.0-develop.6) (2023-07-23)
### Bug Fixes
* array handling ([dc50c7a](https://git.lumeweb.com/LumeWeb/kernel-network-registry/commit/dc50c7a068b03b6c48a72884693e1989e9ba9dec))
# [0.1.0-develop.5](https://git.lumeweb.com/LumeWeb/kernel-network-registry/compare/v0.1.0-develop.4...v0.1.0-develop.5) (2023-07-21)
# [0.1.0-develop.4](https://git.lumeweb.com/LumeWeb/kernel-network-registry/compare/v0.1.0-develop.3...v0.1.0-develop.4) (2023-07-19)
### Bug Fixes
* inconsistent input use on handleGetNetworksByType ([c5dd605](https://git.lumeweb.com/LumeWeb/kernel-network-registry/commit/c5dd60557129586fc0c0afb1a0f2c93e28deebcf))
# [0.1.0-develop.3](https://git.lumeweb.com/LumeWeb/kernel-network-registry/compare/v0.1.0-develop.2...v0.1.0-develop.3) (2023-07-19)
### Features
* add getNetworksByType api call ([75c25d7](https://git.lumeweb.com/LumeWeb/kernel-network-registry/commit/75c25d7cab1240d6f2b194af9f262f76f98c6b48))
# [0.1.0-develop.2](https://git.lumeweb.com/LumeWeb/kernel-network-registry/compare/v0.1.0-develop.1...v0.1.0-develop.2) (2023-07-19)
### Bug Fixes
* rename handleGetNetworkType ([d9163a4](https://git.lumeweb.com/LumeWeb/kernel-network-registry/commit/d9163a4e530745d36a26ea8cbad5fb8ef35c3b93))
# [0.1.0-develop.1](https://git.lumeweb.com/LumeWeb/kernel-network-registry/compare/v0.0.1...v0.1.0-develop.1) (2023-07-19)
### Features
* initial version ([60be134](https://git.lumeweb.com/LumeWeb/kernel-network-registry/commit/60be1346596c3413134d97dd195567ba2a2e5314))

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2023 Hammer Technologies LLC Copyright (c) 2023 LumeWeb
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

View File

@ -1,2 +1,2 @@
# kernel-network-registry # kernel-module-network-registry

19794
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +0,0 @@
{
"name": "@lumeweb/kernel-network-registry",
"version": "0.1.0-develop.9",
"type": "module",
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "gitea@git.lumeweb.com:LumeWeb/kernel-network-registry.git"
},
"scripts": {
"prepare": "presetter bootstrap",
"build": "run build",
"semantic-release": "semantic-release"
},
"dependencies": {
"@lumeweb/libkernel": "^0.1.0-develop.39"
},
"devDependencies": {
"@lumeweb/presetter-kernel-module-preset": "^0.1.0-develop.43"
}
}

View File

@ -1,99 +0,0 @@
import { ActiveQuery, addHandler } from "@lumeweb/libkernel/module";
import { EventEmitter } from "events";
const types: Set<string> = new Set<string>();
const networks: Map<string, Set<string>> = new Map<string, Set<string>>();
const events = new EventEmitter();
addHandler("registerType", handleRegisterType);
addHandler("getTypes", handleGetTypes);
addHandler("getNetworkTypes", handleGetNetworkTypes);
addHandler("getNetworksByType", handleGetNetworksByType);
addHandler("registerNetwork", handleRegisterNetwork);
addHandler("subscribeToUpdates", handleSubscribeToUpdates, {
receiveUpdates: true,
});
function handleRegisterType(aq: ActiveQuery) {
types.add(aq.callerInput);
aq.respond();
}
function handleGetTypes(aq: ActiveQuery) {
aq.respond([...types.values()]);
}
function handleRegisterNetwork(aq: ActiveQuery) {
if (!("types" in aq.callerInput)) {
aq.reject("types missing");
return;
}
if (!Array.isArray(aq.callerInput.types)) {
aq.reject("types must be an array");
return;
}
let network = networks.get(aq.domain);
if (network) {
[...aq.callerInput.type].forEach((item) => network?.add(item));
} else {
networks.set(aq.domain, new Set([...aq.callerInput.types]));
}
events.emit("update");
aq.respond();
}
function handleGetNetworkTypes(aq: ActiveQuery) {
if (!("module" in aq.callerInput)) {
aq.reject("module missing");
return;
}
if (!networks.has(aq.callerInput.module)) {
aq.reject("module is not registered");
return;
}
aq.respond([
...(networks.get(aq.callerInput.module) as Set<string>).values(),
]);
}
function handleGetNetworksByType(aq: ActiveQuery) {
if (!("type" in aq.callerInput)) {
aq.reject("type missing");
return;
}
if (!types.has(aq.callerInput.type)) {
aq.reject("type not registered");
return;
}
aq.respond(
[...networks.entries()]
.filter((item) => {
return item[1].has(aq.callerInput.type);
})
.map((item) => item[0]),
);
}
function handleSubscribeToUpdates(aq: ActiveQuery) {
const cb = () => {
aq.sendUpdate();
};
events.on("update", cb);
aq.setReceiveUpdate?.(() => {
events.off("update", cb);
aq.respond();
});
}