Compare commits

..

No commits in common. "v0.1.0-develop.22" and "v0.1.0-develop.21" have entirely different histories.

6 changed files with 18 additions and 31 deletions

View File

@ -1,10 +1,3 @@
# [0.1.0-develop.22](https://git.lumeweb.com/LumeWeb/kernel/compare/v0.1.0-develop.21...v0.1.0-develop.22) (2023-10-15)
### Bug Fixes
* add resolvedDomain to Module type and use it instead in createModule so that the domain id stays consistent to the potential resolver version, when used as a callerDomain ([68642cc](https://git.lumeweb.com/LumeWeb/kernel/commit/68642ccb03fafb27662f51905ad628e70198b826))
# [0.1.0-develop.21](https://git.lumeweb.com/LumeWeb/kernel/compare/v0.1.0-develop.20...v0.1.0-develop.21) (2023-10-13) # [0.1.0-develop.21](https://git.lumeweb.com/LumeWeb/kernel/compare/v0.1.0-develop.20...v0.1.0-develop.21) (2023-10-13)
# [0.1.0-develop.20](https://git.lumeweb.com/LumeWeb/kernel/compare/v0.1.0-develop.19...v0.1.0-develop.20) (2023-10-11) # [0.1.0-develop.20](https://git.lumeweb.com/LumeWeb/kernel/compare/v0.1.0-develop.19...v0.1.0-develop.20) (2023-10-11)

4
npm-shrinkwrap.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@lumeweb/kernel", "name": "@lumeweb/kernel",
"version": "0.1.0-develop.22", "version": "0.1.0-develop.21",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@lumeweb/kernel", "name": "@lumeweb/kernel",
"version": "0.1.0-develop.22", "version": "0.1.0-develop.21",
"dependencies": { "dependencies": {
"@lumeweb/libkernel": "0.1.0-develop.53" "@lumeweb/libkernel": "0.1.0-develop.53"
}, },

View File

@ -1,6 +1,6 @@
{ {
"name": "@lumeweb/kernel", "name": "@lumeweb/kernel",
"version": "0.1.0-develop.22", "version": "0.1.0-develop.21",
"type": "module", "type": "module",
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -5,10 +5,11 @@ import { Level } from "level";
let moduleStore: Level<string, Uint8Array>; let moduleStore: Level<string, Uint8Array>;
const CORE_MODULES = { const CORE_MODULES = {
swarm: "zrjTDyEX8Mh2PdDdRj5YL2byFGrYe1ksczRwPaTRFaCGSMG", swarm: "zdiLmwHCC15afFNLYzzT2DVV7m27SrBde7oXHdSzAe95GpFZXzdpatUN6b",
peerDiscoveryRegistry: "zrjD6CEchDtSex5VHjzMNSAdkJpMNfCtbxSnftgtfvtnsdY", peerDiscoveryRegistry:
ircPeerDiscovery: "zrjHTx8tSQFWnmZ9JzK7XmJirqJQi2WRBLYp3fASaL2AfBQ", "zdiLW9MtAAMssP5vLBgd1FitouiVXzNUYZszFYG44uVKqCPDqUQox9aq1y",
s5: "zrjLjKVByzt233rfcjWvTQXrMfGFa11oBLydPaUk7gwnC2d", ircPeerDiscovery: "zrjPHvVJ3j7Jfn834PV4n7KcWbSW7ZHkxvcPCKWjwAcjPX5",
s5: "zdiT6quMF8gh8BhQdXE7CZYhp8S1BxSgsucSS48WuTGdars1noejvak6Qo",
networkRegistry: "zrjTCwTcK5Vco1h7cdUQKzs6yzeqm7vC5u5Lo9y1uhTyxnv", networkRegistry: "zrjTCwTcK5Vco1h7cdUQKzs6yzeqm7vC5u5Lo9y1uhTyxnv",
}; };

View File

@ -37,7 +37,6 @@ type WorkerLaunchFn = () => Promise<[Worker, Err]>;
// a new worker gets launched for every query. // a new worker gets launched for every query.
interface Module { interface Module {
domain: string; domain: string;
resolvedDomain: string;
code: Uint8Array; code: Uint8Array;
launchWorker: WorkerLaunchFn; launchWorker: WorkerLaunchFn;
worker?: Worker; worker?: Worker;
@ -224,12 +223,10 @@ function handleWorkerMessage(event: MessageEvent, mod: Module, worker: Worker) {
async function createModule( async function createModule(
workerCode: Uint8Array, workerCode: Uint8Array,
domain: string, domain: string,
resolvedDomain: string,
): Promise<[Module | null, Err]> { ): Promise<[Module | null, Err]> {
// Create the module object. // Create the module object.
const mod: Module = { const mod: Module = {
domain, domain,
resolvedDomain,
code: workerCode, code: workerCode,
launchWorker: function (): Promise<[Worker, Err]> { launchWorker: function (): Promise<[Worker, Err]> {
return launchWorker(mod); return launchWorker(mod);
@ -251,7 +248,7 @@ async function launchWorker(mod: Module): Promise<[Worker, Err]> {
// Create and launch the worker. // Create and launch the worker.
let worker: Worker; let worker: Worker;
try { try {
worker = new Worker(mod.code, CID.decode(mod.resolvedDomain)); worker = new Worker(mod.code, CID.decode(mod.domain));
await worker.ready; await worker.ready;
} catch (err: any) { } catch (err: any) {
logErr("worker", mod.domain, "unable to create worker", mod.domain, err); logErr("worker", mod.domain, "unable to create worker", mod.domain, err);
@ -596,11 +593,7 @@ async function handleModuleCall(
} }
// Create a new module. // Create a new module.
const [mod, errCM] = await createModule( const [mod, errCM] = await createModule(moduleData, finalModule);
moduleData,
moduleDomain,
finalModule,
);
if (errCM !== null) { if (errCM !== null) {
const err = addContextToErr(errCM, "unable to create module"); const err = addContextToErr(errCM, "unable to create module");
respondErr(event, messagePortal, isWorker, isInternal, err); respondErr(event, messagePortal, isWorker, isInternal, err);

View File

@ -1,17 +1,17 @@
const DEFAULT_MODULE_REGISTRY = new Map<string, string>( const DEFAULT_MODULE_REGISTRY = new Map<string, string>(
Object.entries({ Object.entries({
// swarm // swarm
zrjTDyEX8Mh2PdDdRj5YL2byFGrYe1ksczRwPaTRFaCGSMG: zdiLmwHCC15afFNLYzzT2DVV7m27SrBde7oXHdSzAe95GpFZXzdpatUN6b:
"z2H78pADGKWPz2zWEgGKDc7jYYtSv6qBfDtKzU4Tq5zgFoejmiQD", "zduLvD6fRRmCy97T6RweYaPTxHdwFJmvmoygB4hCu3sJnZjHiYCKke4cG7",
// peerDiscoveryRegistry // peerDiscoveryRegistry
zrjD6CEchDtSex5VHjzMNSAdkJpMNfCtbxSnftgtfvtnsdY: zdiLW9MtAAMssP5vLBgd1FitouiVXzNUYZszFYG44uVKqCPDqUQox9aq1y:
"z2H7AhnortTD6wL53XUdTotJZLADa7PbZCcHuSFJ6WgZ6td2bvaC", "zduTMSXg16HNi4ggDz8uko7ZxX7q9yosGBT8MX2ng43epttTEQ3Xi7pr2B",
// ircPeerDiscovery // ircPeerDiscovery
zrjHTx8tSQFWnmZ9JzK7XmJirqJQi2WRBLYp3fASaL2AfBQ: zrjPHvVJ3j7Jfn834PV4n7KcWbSW7ZHkxvcPCKWjwAcjPX5:
"z2H7D35inXTkjuxevunyq7ojv1iomXJD1svDYgkLnknk2bXc14HC", "zHnoaikfFJ9T5hEhV53bj8h5U5qgZrocCbfmTkogqGdaMkjLiE",
// s5 // s5
zrjLjKVByzt233rfcjWvTQXrMfGFa11oBLydPaUk7gwnC2d: zdiT6quMF8gh8BhQdXE7CZYhp8S1BxSgsucSS48WuTGdars1noejvak6Qo:
"z2H6yA5VLuVUukioBiSNYTBEMGBXHgV2uxcfppUnsSidZTwZHiWE", "z2H734ocqpAoorkhUk3nymFuwS6uU6YcBUppCU7YvBiasRvsbJ6E",
// networkRegistry // networkRegistry
zrjTCwTcK5Vco1h7cdUQKzs6yzeqm7vC5u5Lo9y1uhTyxnv: zrjTCwTcK5Vco1h7cdUQKzs6yzeqm7vC5u5Lo9y1uhTyxnv:
"z2H7J3strfaEAc1kyHqMNmEPzynRipVerfCeqEhfkkcrGNNhnJUo", "z2H7J3strfaEAc1kyHqMNmEPzynRipVerfCeqEhfkkcrGNNhnJUo",