Compare commits

..

No commits in common. "v0.1.0-develop.1" and "v0.0.1" have entirely different histories.

8 changed files with 2 additions and 19691 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,6 +0,0 @@
# [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
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:

View File

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

19584
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.1",
"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.20"
},
"devDependencies": {
"@lumeweb/presetter-kernel-module-preset": "^0.1.0-develop.43"
}
}

View File

@ -1,57 +0,0 @@
import { ActiveQuery, addHandler } from "@lumeweb/libkernel/module";
const types: Set<string> = new Set<string>();
const networks: Map<string, Set<string>> = new Map<string, Set<string>>();
addHandler("registerType", handleRegisterType);
addHandler("getTypes", handleGetTypes);
addHandler("getNetworkTypes", handleGetNetworkType);
addHandler("registerNetwork", handleRegisterNetwork);
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]));
}
aq.respond();
}
function handleGetNetworkType(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(),
]);
}