holosphere 2.0.0-alpha19 → 2.0.0-alpha20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{2019-Cc18leNN.js → 2019-BzVkRcax.js} +2 -2
- package/dist/{2019-Cc18leNN.js.map → 2019-BzVkRcax.js.map} +1 -1
- package/dist/{2019-CAYA1q1p.cjs → 2019-C1hPR_Os.cjs} +2 -2
- package/dist/{2019-CAYA1q1p.cjs.map → 2019-C1hPR_Os.cjs.map} +1 -1
- package/dist/{browser-yWnjyL8K.js → browser-BcmACE3G.js} +2 -2
- package/dist/{browser-yWnjyL8K.js.map → browser-BcmACE3G.js.map} +1 -1
- package/dist/{browser-DAFvFs8I.cjs → browser-DaqYUTcG.cjs} +2 -2
- package/dist/{browser-DAFvFs8I.cjs.map → browser-DaqYUTcG.cjs.map} +1 -1
- package/dist/cjs/holosphere.cjs +1 -1
- package/dist/esm/holosphere.js +1 -1
- package/dist/{index-CPvYlZtl.cjs → index--QsHG_gD.cjs} +2 -2
- package/dist/{index-CPvYlZtl.cjs.map → index--QsHG_gD.cjs.map} +1 -1
- package/dist/{index-Bgi_csBR.js → index-B6-8KAQm.js} +2 -2
- package/dist/{index-Bgi_csBR.js.map → index-B6-8KAQm.js.map} +1 -1
- package/dist/{index-CHfVBEUH.js → index-BHptWysv.js} +40 -70
- package/dist/{index-CHfVBEUH.js.map → index-BHptWysv.js.map} +1 -1
- package/dist/{index-Dgx5DQG_.cjs → index-CDlhzxT2.cjs} +4 -4
- package/dist/index-CDlhzxT2.cjs.map +1 -0
- package/dist/{index-bnw0PiyT.cjs → index-COpLk9gL.cjs} +2 -2
- package/dist/{index-bnw0PiyT.cjs.map → index-COpLk9gL.cjs.map} +1 -1
- package/dist/{index-CReYsOty.js → index-D2WstuZJ.js} +2 -2
- package/dist/{index-CReYsOty.js.map → index-D2WstuZJ.js.map} +1 -1
- package/dist/{indexeddb-storage-Ko4sjZtM.js → indexeddb-storage-kQ53UHEE.js} +2 -2
- package/dist/{indexeddb-storage-Ko4sjZtM.js.map → indexeddb-storage-kQ53UHEE.js.map} +1 -1
- package/dist/{indexeddb-storage-CyOZAiHV.cjs → indexeddb-storage-wKG4mICM.cjs} +2 -2
- package/dist/{indexeddb-storage-CyOZAiHV.cjs.map → indexeddb-storage-wKG4mICM.cjs.map} +1 -1
- package/dist/{memory-storage-C6YV3dsT.cjs → memory-storage-CGC8xM2G.cjs} +2 -2
- package/dist/{memory-storage-C6YV3dsT.cjs.map → memory-storage-CGC8xM2G.cjs.map} +1 -1
- package/dist/{memory-storage-BTfQQ9Ig.js → memory-storage-DnXCSbBl.js} +2 -2
- package/dist/{memory-storage-BTfQQ9Ig.js.map → memory-storage-DnXCSbBl.js.map} +1 -1
- package/package.json +1 -1
- package/src/index.js +15 -55
- package/src/storage/nostr-async.js +33 -17
- package/dist/index-Dgx5DQG_.cjs.map +0 -1
|
@@ -18011,12 +18011,12 @@ async function createPersistentStorage(namespace, options = {}) {
|
|
|
18011
18011
|
const isBrowser = typeof window !== "undefined" && typeof window.indexedDB !== "undefined";
|
|
18012
18012
|
typeof process !== "undefined" && process.versions && void 0;
|
|
18013
18013
|
if (isBrowser) {
|
|
18014
|
-
const { IndexedDBStorage } = await import("./indexeddb-storage-
|
|
18014
|
+
const { IndexedDBStorage } = await import("./indexeddb-storage-kQ53UHEE.js");
|
|
18015
18015
|
const storage = new IndexedDBStorage();
|
|
18016
18016
|
await storage.init(namespace);
|
|
18017
18017
|
return storage;
|
|
18018
18018
|
} else {
|
|
18019
|
-
const { MemoryStorage } = await import("./memory-storage-
|
|
18019
|
+
const { MemoryStorage } = await import("./memory-storage-DnXCSbBl.js");
|
|
18020
18020
|
const storage = new MemoryStorage();
|
|
18021
18021
|
await storage.init(namespace);
|
|
18022
18022
|
return storage;
|
|
@@ -18029,7 +18029,7 @@ async function loadNDKCacheAdapter() {
|
|
|
18029
18029
|
ndkCacheAdapterLoaded = true;
|
|
18030
18030
|
if (typeof window !== "undefined" && typeof indexedDB !== "undefined") {
|
|
18031
18031
|
try {
|
|
18032
|
-
const module2 = await import("./index-
|
|
18032
|
+
const module2 = await import("./index-D2WstuZJ.js");
|
|
18033
18033
|
NDKCacheAdapterDexie = module2.default || module2.NDKCacheAdapterDexie;
|
|
18034
18034
|
} catch (e) {
|
|
18035
18035
|
console.debug("[nostr] NDK cache adapter not available, using LRU cache");
|
|
@@ -21017,7 +21017,7 @@ class GunSchemaValidator {
|
|
|
21017
21017
|
return true;
|
|
21018
21018
|
}
|
|
21019
21019
|
try {
|
|
21020
|
-
const AjvModule = await import("./2019-
|
|
21020
|
+
const AjvModule = await import("./2019-BzVkRcax.js").then((n2) => n2._);
|
|
21021
21021
|
this.Ajv = AjvModule.default || AjvModule;
|
|
21022
21022
|
this.validator = new this.Ajv({
|
|
21023
21023
|
allErrors: true,
|
|
@@ -21238,7 +21238,7 @@ class GunDBBackend extends StorageBackend {
|
|
|
21238
21238
|
let Gun;
|
|
21239
21239
|
try {
|
|
21240
21240
|
console.log("[gundb-backend] Importing Gun...");
|
|
21241
|
-
const gunModule = await import("./browser-
|
|
21241
|
+
const gunModule = await import("./browser-BcmACE3G.js").then((n2) => n2.b);
|
|
21242
21242
|
Gun = gunModule.default || gunModule;
|
|
21243
21243
|
console.log("[gundb-backend] Gun imported:", typeof Gun);
|
|
21244
21244
|
} catch (error) {
|
|
@@ -23400,12 +23400,13 @@ async function nostrPut(client, path, data, kindOrOptions = 3e4) {
|
|
|
23400
23400
|
}
|
|
23401
23401
|
async function nostrGet(client, path, kind2 = 3e4, options = {}) {
|
|
23402
23402
|
const timeout = options.timeout !== void 0 ? options.timeout : 3e4;
|
|
23403
|
-
const
|
|
23403
|
+
const skipAuthors = options.skipAuthorFilter === true;
|
|
23404
|
+
const authors = skipAuthors ? null : options.authors || [client.publicKey];
|
|
23404
23405
|
const { lensKey } = options;
|
|
23405
23406
|
if (!options.skipCache && client.getCachedByPath) {
|
|
23406
23407
|
const cachedEvent = client.getCachedByPath(path, kind2);
|
|
23407
23408
|
if (cachedEvent && cachedEvent.content) {
|
|
23408
|
-
if (authors.includes(cachedEvent.pubkey)) {
|
|
23409
|
+
if (skipAuthors || authors.includes(cachedEvent.pubkey)) {
|
|
23409
23410
|
const data = _parseEventContent(cachedEvent, lensKey);
|
|
23410
23411
|
if (!data || data._deleted) {
|
|
23411
23412
|
return null;
|
|
@@ -23420,7 +23421,7 @@ async function nostrGet(client, path, kind2 = 3e4, options = {}) {
|
|
|
23420
23421
|
if (!options.skipPersistent && client.persistentGet) {
|
|
23421
23422
|
const persistedEvent = await client.persistentGet(path);
|
|
23422
23423
|
if (persistedEvent && persistedEvent.content) {
|
|
23423
|
-
if (!authors.includes(persistedEvent.pubkey)) ;
|
|
23424
|
+
if (!skipAuthors && !authors.includes(persistedEvent.pubkey)) ;
|
|
23424
23425
|
else {
|
|
23425
23426
|
const data = _parseEventContent(persistedEvent, lensKey);
|
|
23426
23427
|
if (!data || data._deleted) {
|
|
@@ -23439,7 +23440,8 @@ async function nostrGet(client, path, kind2 = 3e4, options = {}) {
|
|
|
23439
23440
|
}
|
|
23440
23441
|
}
|
|
23441
23442
|
}
|
|
23442
|
-
const
|
|
23443
|
+
const authorKey = skipAuthors ? "_all_" : authors ? authors.join(",") : client.publicKey;
|
|
23444
|
+
const queryKey = `get:${client.publicKey}:${kind2}:${path}:${authorKey}`;
|
|
23443
23445
|
const pending = pendingQueries.get(queryKey);
|
|
23444
23446
|
if (pending && Date.now() - pending.timestamp < QUERY_DEDUP_WINDOW) {
|
|
23445
23447
|
return pending.promise;
|
|
@@ -23463,14 +23465,16 @@ async function _executeNostrGet(client, path, kind2, authors, timeout, options)
|
|
|
23463
23465
|
const { lensKey } = options;
|
|
23464
23466
|
const filter = {
|
|
23465
23467
|
kinds: [kind2],
|
|
23466
|
-
|
|
23467
|
-
// Support multiple authors for cross-holosphere queries
|
|
23468
|
-
"#d": [path],
|
|
23469
|
-
limit: authors.length
|
|
23470
|
-
// Increase limit to get events from all authors
|
|
23468
|
+
"#d": [path]
|
|
23471
23469
|
};
|
|
23470
|
+
if (authors && authors.length > 0) {
|
|
23471
|
+
filter.authors = authors;
|
|
23472
|
+
filter.limit = authors.length;
|
|
23473
|
+
} else {
|
|
23474
|
+
filter.limit = 10;
|
|
23475
|
+
}
|
|
23472
23476
|
const events = await client.query(filter, { timeout, forceRelay: options.forceRelay });
|
|
23473
|
-
const authoredEvents = events.filter((event2) => authors.includes(event2.pubkey));
|
|
23477
|
+
const authoredEvents = authors ? events.filter((event2) => authors.includes(event2.pubkey)) : events;
|
|
23474
23478
|
if (authoredEvents.length === 0) {
|
|
23475
23479
|
return null;
|
|
23476
23480
|
}
|
|
@@ -23487,7 +23491,8 @@ async function _executeNostrGet(client, path, kind2, authors, timeout, options)
|
|
|
23487
23491
|
async function nostrGetAll(client, pathPrefix, kind2 = 3e4, options = {}) {
|
|
23488
23492
|
const timeout = options.timeout !== void 0 ? options.timeout : 3e4;
|
|
23489
23493
|
const limit2 = options.limit || 1e3;
|
|
23490
|
-
const
|
|
23494
|
+
const skipAuthors = options.skipAuthorFilter === true;
|
|
23495
|
+
const authors = skipAuthors ? null : options.authors || [client.publicKey];
|
|
23491
23496
|
const { lensKey } = options;
|
|
23492
23497
|
if (!options.skipPersistent && client.persistentGetAll) {
|
|
23493
23498
|
const persistedEvents = await client.persistentGetAll(pathPrefix);
|
|
@@ -23495,7 +23500,7 @@ async function nostrGetAll(client, pathPrefix, kind2 = 3e4, options = {}) {
|
|
|
23495
23500
|
const byPath = /* @__PURE__ */ new Map();
|
|
23496
23501
|
for (const event of persistedEvents) {
|
|
23497
23502
|
if (!event || !event.tags) continue;
|
|
23498
|
-
if (!authors.includes(event.pubkey)) continue;
|
|
23503
|
+
if (authors && !authors.includes(event.pubkey)) continue;
|
|
23499
23504
|
const dTag = event.tags.find((t) => t[0] === "d");
|
|
23500
23505
|
if (!dTag || !dTag[1] || !dTag[1].startsWith(pathPrefix)) continue;
|
|
23501
23506
|
const path = dTag[1];
|
|
@@ -23518,7 +23523,8 @@ async function nostrGetAll(client, pathPrefix, kind2 = 3e4, options = {}) {
|
|
|
23518
23523
|
return Array.from(byPath.values()).map((item) => item.data);
|
|
23519
23524
|
}
|
|
23520
23525
|
}
|
|
23521
|
-
const
|
|
23526
|
+
const getAllAuthorKey = skipAuthors ? "_all_" : authors ? authors.join(",") : client.publicKey;
|
|
23527
|
+
const queryKey = `getAll:${client.publicKey}:${kind2}:${pathPrefix}:${getAllAuthorKey}`;
|
|
23522
23528
|
const pending = pendingQueries.get(queryKey);
|
|
23523
23529
|
if (pending && Date.now() - pending.timestamp < QUERY_DEDUP_WINDOW) {
|
|
23524
23530
|
return pending.promise;
|
|
@@ -23542,14 +23548,16 @@ async function _executeNostrGetAll(client, pathPrefix, kind2, authors, timeout,
|
|
|
23542
23548
|
const { lensKey } = options;
|
|
23543
23549
|
const filter = {
|
|
23544
23550
|
kinds: [kind2],
|
|
23545
|
-
authors,
|
|
23546
23551
|
limit: limit2
|
|
23547
23552
|
};
|
|
23553
|
+
if (authors && authors.length > 0) {
|
|
23554
|
+
filter.authors = authors;
|
|
23555
|
+
}
|
|
23548
23556
|
const events = await client.query(filter, { timeout });
|
|
23549
23557
|
const matching = events.filter((event) => {
|
|
23550
23558
|
const dTag = event.tags.find((t) => t[0] === "d");
|
|
23551
23559
|
const pathMatches = dTag && dTag[1] && dTag[1].startsWith(pathPrefix);
|
|
23552
|
-
const authorAllowed = authors.includes(event.pubkey);
|
|
23560
|
+
const authorAllowed = authors ? authors.includes(event.pubkey) : true;
|
|
23553
23561
|
return pathMatches && authorAllowed;
|
|
23554
23562
|
});
|
|
23555
23563
|
const byPath = /* @__PURE__ */ new Map();
|
|
@@ -38396,7 +38404,7 @@ class ChainManager {
|
|
|
38396
38404
|
*/
|
|
38397
38405
|
async _loadEthers() {
|
|
38398
38406
|
if (!this.ethers) {
|
|
38399
|
-
const ethersModule = await import("./index-
|
|
38407
|
+
const ethersModule = await import("./index-B6-8KAQm.js");
|
|
38400
38408
|
this.ethers = ethersModule;
|
|
38401
38409
|
}
|
|
38402
38410
|
return this.ethers;
|
|
@@ -47187,7 +47195,7 @@ class ContractDeployer {
|
|
|
47187
47195
|
*/
|
|
47188
47196
|
async _loadEthers() {
|
|
47189
47197
|
if (!this.ethers) {
|
|
47190
|
-
this.ethers = await import("./index-
|
|
47198
|
+
this.ethers = await import("./index-B6-8KAQm.js");
|
|
47191
47199
|
}
|
|
47192
47200
|
return this.ethers;
|
|
47193
47201
|
}
|
|
@@ -47573,7 +47581,7 @@ class ContractOperations {
|
|
|
47573
47581
|
*/
|
|
47574
47582
|
async _loadEthers() {
|
|
47575
47583
|
if (!this.ethers) {
|
|
47576
|
-
this.ethers = await import("./index-
|
|
47584
|
+
this.ethers = await import("./index-B6-8KAQm.js");
|
|
47577
47585
|
}
|
|
47578
47586
|
return this.ethers;
|
|
47579
47587
|
}
|
|
@@ -59815,18 +59823,10 @@ class HoloSphereBase extends HoloSphere$1 {
|
|
|
59815
59823
|
const capToken = options.capabilityToken || options.capability;
|
|
59816
59824
|
const actingAsHolon = options.actingAs || options.actingAsHolon;
|
|
59817
59825
|
if (options.externalWriter) {
|
|
59818
|
-
|
|
59819
|
-
|
|
59820
|
-
|
|
59821
|
-
|
|
59822
|
-
this._log("DEBUG", "✅ Registered capability writer", {
|
|
59823
|
-
writerPubKey: writerPubKey.slice(0, 12) + "...",
|
|
59824
|
-
holonId: holonId.slice(0, 12) + "..."
|
|
59825
|
-
});
|
|
59826
|
-
} catch (err) {
|
|
59827
|
-
this._log("WARN", "⚠️ Failed to register capability writer", { error: err.message });
|
|
59828
|
-
}
|
|
59829
|
-
}
|
|
59826
|
+
this._log("DEBUG", "✅ External writer — skipping auth", {
|
|
59827
|
+
writerPubKey: effectiveWriterPubKey?.slice(0, 12) + "...",
|
|
59828
|
+
holonId: holonId?.slice(0, 12) + "..."
|
|
59829
|
+
});
|
|
59830
59830
|
} else if (!isOwnHolon) {
|
|
59831
59831
|
if (capToken) {
|
|
59832
59832
|
const authorized = await this.verifyCapability(capToken, "write", { holonId, lensName });
|
|
@@ -60350,41 +60350,11 @@ class HoloSphereBase extends HoloSphere$1 {
|
|
|
60350
60350
|
});
|
|
60351
60351
|
readOptions.authors = [targetPubkey];
|
|
60352
60352
|
}
|
|
60353
|
-
this._log("DEBUG", "🔍 Checking for federated authors", { isOtherAuthor, holonId: holonId?.slice(0, 12) });
|
|
60354
60353
|
if (!isOtherAuthor) {
|
|
60355
|
-
|
|
60356
|
-
|
|
60357
|
-
|
|
60358
|
-
|
|
60359
|
-
this.config.appName
|
|
60360
|
-
);
|
|
60361
|
-
const fedAuthorsTimeout = new Promise(
|
|
60362
|
-
(resolve) => setTimeout(() => resolve([]), 1e3)
|
|
60363
|
-
// 1 second timeout, resolve with empty array
|
|
60364
|
-
);
|
|
60365
|
-
const federatedAuthors = await Promise.race([fedAuthorsPromise, fedAuthorsTimeout]);
|
|
60366
|
-
this._log("DEBUG", "✅ Got federated authors", { count: federatedAuthors?.length || 0 });
|
|
60367
|
-
if (federatedAuthors.length > 0) {
|
|
60368
|
-
readOptions.authors = [this.client.publicKey, ...federatedAuthors];
|
|
60369
|
-
this._log("DEBUG", "Including federated authors", { count: federatedAuthors.length });
|
|
60370
|
-
}
|
|
60371
|
-
} catch (err) {
|
|
60372
|
-
this._log("WARN", "Failed to get federated authors", { error: err.message });
|
|
60373
|
-
}
|
|
60374
|
-
try {
|
|
60375
|
-
const capWritersPromise = getCapabilityWriters(this.client, this.config.appName);
|
|
60376
|
-
const capWritersTimeout = new Promise(
|
|
60377
|
-
(resolve) => setTimeout(() => resolve([]), 1e3)
|
|
60378
|
-
);
|
|
60379
|
-
const capabilityWriters = await Promise.race([capWritersPromise, capWritersTimeout]);
|
|
60380
|
-
if (capabilityWriters.length > 0) {
|
|
60381
|
-
const existing = readOptions.authors || [this.client.publicKey];
|
|
60382
|
-
readOptions.authors = [.../* @__PURE__ */ new Set([...existing, ...capabilityWriters])];
|
|
60383
|
-
this._log("DEBUG", "Including capability writers", { count: capabilityWriters.length });
|
|
60384
|
-
}
|
|
60385
|
-
} catch (err) {
|
|
60386
|
-
this._log("WARN", "Failed to get capability writers", { error: err.message });
|
|
60387
|
-
}
|
|
60354
|
+
readOptions.skipAuthorFilter = true;
|
|
60355
|
+
this._log("DEBUG", "🔍 Own holon read — skipping author filter for inclusive query", {
|
|
60356
|
+
holonId: holonId?.slice(0, 12)
|
|
60357
|
+
});
|
|
60388
60358
|
}
|
|
60389
60359
|
const startTime = Date.now();
|
|
60390
60360
|
let result;
|
|
@@ -62032,4 +62002,4 @@ export {
|
|
|
62032
62002
|
concatBytes as y,
|
|
62033
62003
|
dataLength as z
|
|
62034
62004
|
};
|
|
62035
|
-
//# sourceMappingURL=index-
|
|
62005
|
+
//# sourceMappingURL=index-BHptWysv.js.map
|