holosphere 2.0.0-alpha15 → 2.0.0-alpha16
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-ATLjawsU.cjs → 2019-C9IgM3mu.cjs} +2 -2
- package/dist/{2019-ATLjawsU.cjs.map → 2019-C9IgM3mu.cjs.map} +1 -1
- package/dist/{2019-BfjzDRje.js → 2019-CyFQLuqg.js} +2 -2
- package/dist/{2019-BfjzDRje.js.map → 2019-CyFQLuqg.js.map} +1 -1
- package/dist/{browser-CKTczilW.js → browser-BIvmkBi9.js} +2 -2
- package/dist/{browser-CKTczilW.js.map → browser-BIvmkBi9.js.map} +1 -1
- package/dist/{browser-GOg6KKOV.cjs → browser-CZ1l8nhY.cjs} +2 -2
- package/dist/{browser-GOg6KKOV.cjs.map → browser-CZ1l8nhY.cjs.map} +1 -1
- package/dist/cjs/holosphere.cjs +1 -1
- package/dist/esm/holosphere.js +1 -1
- package/dist/{index-C3Cag0SV.js → index-B7ERi4ng.js} +137 -59
- package/dist/index-B7ERi4ng.js.map +1 -0
- package/dist/{index-D_QecZNu.cjs → index-Cc-_uNpt.cjs} +2 -2
- package/dist/{index-D_QecZNu.cjs.map → index-Cc-_uNpt.cjs.map} +1 -1
- package/dist/{index-ChpSfdYS.cjs → index-DXFsE8r6.cjs} +7 -7
- package/dist/index-DXFsE8r6.cjs.map +1 -0
- package/dist/{index-nMC3dWZ5.js → index-DusXavIT.js} +2 -2
- package/dist/{index-nMC3dWZ5.js.map → index-DusXavIT.js.map} +1 -1
- package/dist/{index-BdnrGafX.js → index-HW9kbrzC.js} +2 -2
- package/dist/{index-BdnrGafX.js.map → index-HW9kbrzC.js.map} +1 -1
- package/dist/{index-z5HWfWMu.cjs → index-VrRkpshF.cjs} +2 -2
- package/dist/{index-z5HWfWMu.cjs.map → index-VrRkpshF.cjs.map} +1 -1
- package/dist/{indexeddb-storage-DWSeL-YF.cjs → indexeddb-storage-CVz4Q3lo.cjs} +2 -2
- package/dist/{indexeddb-storage-DWSeL-YF.cjs.map → indexeddb-storage-CVz4Q3lo.cjs.map} +1 -1
- package/dist/{indexeddb-storage-dx01N0ET.js → indexeddb-storage-yEswGGMG.js} +2 -2
- package/dist/{indexeddb-storage-dx01N0ET.js.map → indexeddb-storage-yEswGGMG.js.map} +1 -1
- package/dist/{memory-storage-BPIfkpcf.js → memory-storage-CSB5_IfU.js} +2 -2
- package/dist/{memory-storage-BPIfkpcf.js.map → memory-storage-CSB5_IfU.js.map} +1 -1
- package/dist/{memory-storage-CKUGDq2d.cjs → memory-storage-Q8mEQ6Ix.cjs} +2 -2
- package/dist/{memory-storage-CKUGDq2d.cjs.map → memory-storage-Q8mEQ6Ix.cjs.map} +1 -1
- package/package.json +1 -1
- package/src/crypto/secp256k1.js +3 -3
- package/src/federation/hologram.js +2 -2
- package/src/index.js +83 -12
- package/src/storage/nostr-async.js +47 -31
- package/src/storage/nostr-wrapper.js +18 -4
- package/src/storage/unified-storage.js +10 -4
- package/dist/index-C3Cag0SV.js.map +0 -1
- package/dist/index-ChpSfdYS.cjs.map +0 -1
package/dist/cjs/holosphere.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("../index-DXFsE8r6.cjs");exports.AuthorizationError=e.AuthorizationError,exports.ChainManager=e.ChainManager,exports.Classifier=e.Classifier,exports.ContractABIs=e.ABIs,exports.ContractDeployer=e.ContractDeployer,exports.ContractOperations=e.ContractOperations,exports.ContractQueries=e.ContractQueries,exports.Council=e.Council,exports.Embeddings=e.Embeddings,exports.EventListener=e.EventListener,exports.FederationAdvisor=e.FederationAdvisor,exports.H3AI=e.H3AI,exports.HoloSphere=e.HoloSphere,exports.HolonContracts=e.HolonContracts,exports.JSONOps=e.JSONOps,exports.LLMService=e.LLMService,exports.LensKeyStore=e.LensKeyStore,exports.MODELS=e.MODELS,exports.NETWORKS=e.NETWORKS,exports.NLQuery=e.NLQuery,exports.RelationshipDiscovery=e.RelationshipDiscovery,exports.SANKEY_EVENTS=e.SANKEY_EVENTS,exports.SchemaExtractor=e.SchemaExtractor,exports.SmartAggregation=e.SmartAggregation,exports.SpatialAnalysis=e.SpatialAnalysis,exports.TTS=e.TTS,exports.TaskBreakdown=e.TaskBreakdown,exports.VOICES=e.VOICES,exports.ValidationError=e.ValidationError,exports.buildLensPath=e.buildLensPath,exports.capabilities=e.capabilities,exports.cardStorage=e.cardStorage,exports.createAIServices=e.createAIServices,exports.createFederationCard=e.createFederationCard,exports.createHologram=e.createHologram,exports.crypto=e.secp256k1,exports.default=e.HoloSphere,exports.dismissCard=e.dismissCard,exports.dismissRequest=e.dismissRequest,exports.federation=e.hologram,exports.getAddressUrl=e.getAddressUrl,exports.getCard=e.getCard,exports.getDisplayableCards=e.getDisplayableCards,exports.getLensConfigForHandshake=e.getLensConfigForHandshake,exports.getNetwork=e.getNetwork,exports.getNetworksByType=e.getNetworksByType,exports.getTxUrl=e.getTxUrl,exports.getVisibleLenses=e.getVisibleLenses,exports.handshake=e.handshake,exports.hierarchical=e.upcast,exports.holonRegistry=e.holonRegistry,exports.isNetworkSupported=e.isNetworkSupported,exports.isResponseProcessed=e.isResponseProcessed,exports.lensKeys=e.lensKeys,exports.listNetworks=e.listNetworks,exports.markResponseProcessed=e.markResponseProcessed,exports.matchScope=e.matchScope,exports.networks=e.networks,exports.nostrUtils=e.nostrUtils,exports.parseLensPath=e.parseLensPath,exports.registry=e.registry,exports.requestCard=e.requestCard,exports.saveCard=e.saveCard,exports.schema=e.validator,exports.social=e.socialProtocols,exports.spatial=e.h3Operations,exports.storage=e.unifiedStorage,exports.subscriptions=e.manager,exports.toggleCardExpansion=e.toggleCardExpansion,exports.toggleLens=e.toggleLens;
|
|
2
2
|
//# sourceMappingURL=holosphere.cjs.map
|
package/dist/esm/holosphere.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { aX, bs, b6, bw, bt, bv, by, b1, b0, bx, b9, bc, aW, bu, a$, aZ, bD, b4, bU, b5, ba, bz, a_, b8, b7, b2, bb, b3, aY, bE, bn, bp, bT, bH, bC, bi, aW as aW2, bM, bQ, bg, b_, bO, bP, bJ, bV, bW, bZ, bI, bh, bm, bq, bY, bS, bG, bX, bR, bB, bA, bj, bF, br, bo, bN, bf, bk, bd, be, bl, bL, bK } from "../index-
|
|
1
|
+
import { aX, bs, b6, bw, bt, bv, by, b1, b0, bx, b9, bc, aW, bu, a$, aZ, bD, b4, bU, b5, ba, bz, a_, b8, b7, b2, bb, b3, aY, bE, bn, bp, bT, bH, bC, bi, aW as aW2, bM, bQ, bg, b_, bO, bP, bJ, bV, bW, bZ, bI, bh, bm, bq, bY, bS, bG, bX, bR, bB, bA, bj, bF, br, bo, bN, bf, bk, bd, be, bl, bL, bK } from "../index-B7ERi4ng.js";
|
|
2
2
|
export {
|
|
3
3
|
aX as AuthorizationError,
|
|
4
4
|
bs as ChainManager,
|
|
@@ -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-yEswGGMG.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-CSB5_IfU.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-DusXavIT.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");
|
|
@@ -21015,7 +21015,7 @@ class GunSchemaValidator {
|
|
|
21015
21015
|
return true;
|
|
21016
21016
|
}
|
|
21017
21017
|
try {
|
|
21018
|
-
const AjvModule = await import("./2019-
|
|
21018
|
+
const AjvModule = await import("./2019-CyFQLuqg.js").then((n2) => n2._);
|
|
21019
21019
|
this.Ajv = AjvModule.default || AjvModule;
|
|
21020
21020
|
this.validator = new this.Ajv({
|
|
21021
21021
|
allErrors: true,
|
|
@@ -21236,7 +21236,7 @@ class GunDBBackend extends StorageBackend {
|
|
|
21236
21236
|
let Gun;
|
|
21237
21237
|
try {
|
|
21238
21238
|
console.log("[gundb-backend] Importing Gun...");
|
|
21239
|
-
const gunModule = await import("./browser-
|
|
21239
|
+
const gunModule = await import("./browser-BIvmkBi9.js").then((n2) => n2.b);
|
|
21240
21240
|
Gun = gunModule.default || gunModule;
|
|
21241
21241
|
console.log("[gundb-backend] Gun imported:", typeof Gun);
|
|
21242
21242
|
} catch (error) {
|
|
@@ -21867,7 +21867,7 @@ class GunDBBackend extends StorageBackend {
|
|
|
21867
21867
|
}
|
|
21868
21868
|
}
|
|
21869
21869
|
const name = "holosphere";
|
|
21870
|
-
const version$1 = "2.0.0-
|
|
21870
|
+
const version$1 = "2.0.0-alpha16";
|
|
21871
21871
|
const description = "Holonic geospatial communication infrastructure combining H3 hexagonal indexing with distributed P2P storage";
|
|
21872
21872
|
const type = "module";
|
|
21873
21873
|
const bin = {
|
|
@@ -23609,8 +23609,13 @@ async function nostrGetAllHybrid(client, pathPrefix, kind2 = 3e4, options = {})
|
|
|
23609
23609
|
}
|
|
23610
23610
|
return Array.from(byPath.values()).map((item) => item.data);
|
|
23611
23611
|
}
|
|
23612
|
-
async function nostrDelete(client, path,
|
|
23613
|
-
const
|
|
23612
|
+
async function nostrDelete(client, path, kindOrOptions = 3e4) {
|
|
23613
|
+
const options = typeof kindOrOptions === "number" ? { kind: kindOrOptions } : kindOrOptions;
|
|
23614
|
+
const kind2 = options.kind || 3e4;
|
|
23615
|
+
const { signingKey } = options;
|
|
23616
|
+
const authorPubkey = options.authorPubkey || client.publicKey;
|
|
23617
|
+
const readOptions = authorPubkey !== client.publicKey ? { authors: [authorPubkey] } : {};
|
|
23618
|
+
const existing = await nostrGet(client, path, kind2, readOptions);
|
|
23614
23619
|
if (!existing) {
|
|
23615
23620
|
return { reason: "not_found", results: [] };
|
|
23616
23621
|
}
|
|
@@ -23618,14 +23623,10 @@ async function nostrDelete(client, path, kind2 = 3e4) {
|
|
|
23618
23623
|
_deleted: true,
|
|
23619
23624
|
_deletedAt: Date.now()
|
|
23620
23625
|
};
|
|
23621
|
-
const
|
|
23622
|
-
if (
|
|
23623
|
-
|
|
23624
|
-
|
|
23625
|
-
} catch (e) {
|
|
23626
|
-
}
|
|
23627
|
-
}
|
|
23628
|
-
const coordinate = `${kind2}:${client.publicKey}:${path}`;
|
|
23626
|
+
const putOptions = { kind: kind2 };
|
|
23627
|
+
if (signingKey) putOptions.signingKey = signingKey;
|
|
23628
|
+
const result = await nostrPut(client, path, tombstone, putOptions);
|
|
23629
|
+
const coordinate = `${kind2}:${authorPubkey}:${path}`;
|
|
23629
23630
|
const deletionEvent = {
|
|
23630
23631
|
kind: 5,
|
|
23631
23632
|
// NIP-09 deletion event
|
|
@@ -23637,17 +23638,22 @@ async function nostrDelete(client, path, kind2 = 3e4) {
|
|
|
23637
23638
|
content: ""
|
|
23638
23639
|
// Optional deletion reason/note
|
|
23639
23640
|
};
|
|
23641
|
+
const publishOptions = signingKey ? { signingKey } : {};
|
|
23640
23642
|
try {
|
|
23641
|
-
await client.publish(deletionEvent);
|
|
23643
|
+
await client.publish(deletionEvent, publishOptions);
|
|
23642
23644
|
} catch (error) {
|
|
23643
23645
|
}
|
|
23644
23646
|
return result;
|
|
23645
23647
|
}
|
|
23646
23648
|
const DELETE_RATE_LIMIT_MS = 100;
|
|
23647
|
-
async function nostrDeleteAll(client, pathPrefix,
|
|
23649
|
+
async function nostrDeleteAll(client, pathPrefix, kindOrOptions = 3e4) {
|
|
23650
|
+
const options = typeof kindOrOptions === "number" ? { kind: kindOrOptions } : kindOrOptions;
|
|
23651
|
+
const kind2 = options.kind || 3e4;
|
|
23652
|
+
const { signingKey } = options;
|
|
23653
|
+
const authorPubkey = options.authorPubkey || client.publicKey;
|
|
23648
23654
|
const filter = {
|
|
23649
23655
|
kinds: [kind2],
|
|
23650
|
-
authors: [
|
|
23656
|
+
authors: [authorPubkey],
|
|
23651
23657
|
limit: 1e3
|
|
23652
23658
|
};
|
|
23653
23659
|
const relayEvents = await client.query(filter, { timeout: 3e4 });
|
|
@@ -23678,6 +23684,8 @@ async function nostrDeleteAll(client, pathPrefix, kind2 = 3e4) {
|
|
|
23678
23684
|
if (matching.length === 0) {
|
|
23679
23685
|
return { success: true, count: 0, results: [] };
|
|
23680
23686
|
}
|
|
23687
|
+
const putOptions = { kind: kind2 };
|
|
23688
|
+
if (signingKey) putOptions.signingKey = signingKey;
|
|
23681
23689
|
const tombstoneResults = [];
|
|
23682
23690
|
for (let i = 0; i < matching.length; i++) {
|
|
23683
23691
|
const event = matching[i];
|
|
@@ -23687,14 +23695,8 @@ async function nostrDeleteAll(client, pathPrefix, kind2 = 3e4) {
|
|
|
23687
23695
|
_deleted: true,
|
|
23688
23696
|
_deletedAt: Date.now()
|
|
23689
23697
|
};
|
|
23690
|
-
const result = await nostrPut(client, dTag, tombstone,
|
|
23698
|
+
const result = await nostrPut(client, dTag, tombstone, putOptions);
|
|
23691
23699
|
tombstoneResults.push(result);
|
|
23692
|
-
if (client.persistentStorage) {
|
|
23693
|
-
try {
|
|
23694
|
-
await client.persistentStorage.delete(dTag);
|
|
23695
|
-
} catch (e) {
|
|
23696
|
-
}
|
|
23697
|
-
}
|
|
23698
23700
|
if (i < matching.length - 1 && DELETE_RATE_LIMIT_MS > 0) {
|
|
23699
23701
|
await new Promise((resolve) => setTimeout(resolve, DELETE_RATE_LIMIT_MS));
|
|
23700
23702
|
}
|
|
@@ -23704,8 +23706,9 @@ async function nostrDeleteAll(client, pathPrefix, kind2 = 3e4) {
|
|
|
23704
23706
|
}
|
|
23705
23707
|
const coordinates2 = matching.map((event) => {
|
|
23706
23708
|
const dTag = event.tags.find((t) => t[0] === "d")[1];
|
|
23707
|
-
return `${kind2}:${
|
|
23709
|
+
return `${kind2}:${authorPubkey}:${dTag}`;
|
|
23708
23710
|
});
|
|
23711
|
+
const publishOptions = signingKey ? { signingKey } : {};
|
|
23709
23712
|
try {
|
|
23710
23713
|
const deletionEvent = {
|
|
23711
23714
|
kind: 5,
|
|
@@ -23715,7 +23718,7 @@ async function nostrDeleteAll(client, pathPrefix, kind2 = 3e4) {
|
|
|
23715
23718
|
content: ""
|
|
23716
23719
|
// Optional deletion reason/note
|
|
23717
23720
|
};
|
|
23718
|
-
await client.publish(deletionEvent);
|
|
23721
|
+
await client.publish(deletionEvent, publishOptions);
|
|
23719
23722
|
} catch (error) {
|
|
23720
23723
|
}
|
|
23721
23724
|
return {
|
|
@@ -23976,9 +23979,12 @@ async function update$1(client, path, updates) {
|
|
|
23976
23979
|
throw error;
|
|
23977
23980
|
}
|
|
23978
23981
|
}
|
|
23979
|
-
async function deleteData$1(client, path) {
|
|
23982
|
+
async function deleteData$1(client, path, options = {}) {
|
|
23980
23983
|
try {
|
|
23981
|
-
const
|
|
23984
|
+
const deleteOptions = { kind: 3e4 };
|
|
23985
|
+
if (options.signingKey) deleteOptions.signingKey = options.signingKey;
|
|
23986
|
+
if (options.authorPubkey) deleteOptions.authorPubkey = options.authorPubkey;
|
|
23987
|
+
const result = await nostrDelete(client, path, deleteOptions);
|
|
23982
23988
|
if (result.reason === "not_found") {
|
|
23983
23989
|
return false;
|
|
23984
23990
|
}
|
|
@@ -23989,9 +23995,12 @@ async function deleteData$1(client, path) {
|
|
|
23989
23995
|
throw error;
|
|
23990
23996
|
}
|
|
23991
23997
|
}
|
|
23992
|
-
async function deleteAll$1(client, path) {
|
|
23998
|
+
async function deleteAll$1(client, path, options = {}) {
|
|
23993
23999
|
try {
|
|
23994
|
-
const
|
|
24000
|
+
const deleteOptions = { kind: 3e4 };
|
|
24001
|
+
if (options.signingKey) deleteOptions.signingKey = options.signingKey;
|
|
24002
|
+
if (options.authorPubkey) deleteOptions.authorPubkey = options.authorPubkey;
|
|
24003
|
+
const result = await nostrDeleteAll(client, path, deleteOptions);
|
|
23995
24004
|
return result;
|
|
23996
24005
|
} catch (error) {
|
|
23997
24006
|
console.error("Nostr deleteAll error:", error);
|
|
@@ -24051,20 +24060,20 @@ async function update(client, path, updates) {
|
|
|
24051
24060
|
}
|
|
24052
24061
|
return update$1(client, path, updates);
|
|
24053
24062
|
}
|
|
24054
|
-
async function deleteData(client, path) {
|
|
24063
|
+
async function deleteData(client, path, options = {}) {
|
|
24055
24064
|
if (client.delete && client.gun) {
|
|
24056
24065
|
return client.delete(path);
|
|
24057
24066
|
}
|
|
24058
24067
|
if (client.gun) {
|
|
24059
24068
|
return deleteData$2(client.gun, path);
|
|
24060
24069
|
}
|
|
24061
|
-
return deleteData$1(client, path);
|
|
24070
|
+
return deleteData$1(client, path, options);
|
|
24062
24071
|
}
|
|
24063
|
-
async function deleteAll(client, path) {
|
|
24072
|
+
async function deleteAll(client, path, options = {}) {
|
|
24064
24073
|
if (client.gun) {
|
|
24065
24074
|
return deleteAll$2(client.gun, path);
|
|
24066
24075
|
}
|
|
24067
|
-
return deleteAll$1(client, path);
|
|
24076
|
+
return deleteAll$1(client, path, options);
|
|
24068
24077
|
}
|
|
24069
24078
|
function subscribe(client, path, callback, options = {}) {
|
|
24070
24079
|
if (client.subscribe && client.gun) {
|
|
@@ -24564,7 +24573,7 @@ async function issueCapability$1(permissions, scope, recipient, options = {}) {
|
|
|
24564
24573
|
// Mark self-capabilities for clarity
|
|
24565
24574
|
nonce: generateNonce(),
|
|
24566
24575
|
issued: Date.now(),
|
|
24567
|
-
expires: Date.now() + expiresIn
|
|
24576
|
+
expires: expiresIn != null ? Date.now() + expiresIn : null
|
|
24568
24577
|
};
|
|
24569
24578
|
const payload = JSON.stringify(token);
|
|
24570
24579
|
const encoded = typeof btoa === "function" ? btoa(payload) : Buffer.from(payload).toString("base64");
|
|
@@ -24643,7 +24652,7 @@ async function verifyCapability$1(token, requiredPermission, scope) {
|
|
|
24643
24652
|
console.log("[verifyCapability] ❌ Invalid token type:", { type: tokenObj?.type, tokenObj });
|
|
24644
24653
|
return false;
|
|
24645
24654
|
}
|
|
24646
|
-
if (Date.now() > tokenObj.expires) {
|
|
24655
|
+
if (tokenObj.expires != null && Date.now() > tokenObj.expires) {
|
|
24647
24656
|
console.log("[verifyCapability] ❌ Token expired:", {
|
|
24648
24657
|
expires: tokenObj.expires,
|
|
24649
24658
|
now: Date.now(),
|
|
@@ -25585,8 +25594,8 @@ async function createHologramWithCapability(client, sourceHolon, targetHolon, le
|
|
|
25585
25594
|
{ holonId: sourceHolon, lensName, dataId },
|
|
25586
25595
|
targetAuthorPubKey,
|
|
25587
25596
|
{
|
|
25588
|
-
expiresIn: expiresIn !==
|
|
25589
|
-
//
|
|
25597
|
+
expiresIn: expiresIn !== void 0 ? expiresIn : null,
|
|
25598
|
+
// Hologram capabilities don't expire — they live as long as the hologram
|
|
25590
25599
|
issuer: sourceAuthorPubKey,
|
|
25591
25600
|
issuerKey: sourceAuthorPrivKey
|
|
25592
25601
|
// Use passed private key (holon's key when federated via holonsbot)
|
|
@@ -38344,7 +38353,7 @@ class ChainManager {
|
|
|
38344
38353
|
*/
|
|
38345
38354
|
async _loadEthers() {
|
|
38346
38355
|
if (!this.ethers) {
|
|
38347
|
-
const ethersModule = await import("./index-
|
|
38356
|
+
const ethersModule = await import("./index-HW9kbrzC.js");
|
|
38348
38357
|
this.ethers = ethersModule;
|
|
38349
38358
|
}
|
|
38350
38359
|
return this.ethers;
|
|
@@ -47135,7 +47144,7 @@ class ContractDeployer {
|
|
|
47135
47144
|
*/
|
|
47136
47145
|
async _loadEthers() {
|
|
47137
47146
|
if (!this.ethers) {
|
|
47138
|
-
this.ethers = await import("./index-
|
|
47147
|
+
this.ethers = await import("./index-HW9kbrzC.js");
|
|
47139
47148
|
}
|
|
47140
47149
|
return this.ethers;
|
|
47141
47150
|
}
|
|
@@ -47521,7 +47530,7 @@ class ContractOperations {
|
|
|
47521
47530
|
*/
|
|
47522
47531
|
async _loadEthers() {
|
|
47523
47532
|
if (!this.ethers) {
|
|
47524
|
-
this.ethers = await import("./index-
|
|
47533
|
+
this.ethers = await import("./index-HW9kbrzC.js");
|
|
47525
47534
|
}
|
|
47526
47535
|
return this.ethers;
|
|
47527
47536
|
}
|
|
@@ -60613,7 +60622,15 @@ class HoloSphereBase extends HoloSphere$1 {
|
|
|
60613
60622
|
throw new ValidationError$1("ValidationError: dataId must be a non-empty string");
|
|
60614
60623
|
}
|
|
60615
60624
|
const isPubkeyHolon = typeof holonId === "string" && /^[0-9a-f]{64}$/i.test(holonId);
|
|
60616
|
-
|
|
60625
|
+
let effectiveDeleterPubKey = this.client?.publicKey;
|
|
60626
|
+
if (options.signingKey) {
|
|
60627
|
+
try {
|
|
60628
|
+
effectiveDeleterPubKey = getPublicKey(options.signingKey);
|
|
60629
|
+
} catch (err) {
|
|
60630
|
+
this._log("WARN", "⚠️ Invalid signingKey in delete, using client key", { error: err.message });
|
|
60631
|
+
}
|
|
60632
|
+
}
|
|
60633
|
+
const isOwnHolon = effectiveDeleterPubKey && (holonId === effectiveDeleterPubKey || !isPubkeyHolon);
|
|
60617
60634
|
const capToken = options.capabilityToken || options.capability;
|
|
60618
60635
|
if (!isOwnHolon && !capToken) {
|
|
60619
60636
|
this._log("WARN", "🚫 Delete denied: No capability token for federated holon", { holonId, lensName, dataId });
|
|
@@ -60627,7 +60644,11 @@ class HoloSphereBase extends HoloSphere$1 {
|
|
|
60627
60644
|
let existingData = cached ? cached.data : null;
|
|
60628
60645
|
let dataSource = cached ? "write-cache" : null;
|
|
60629
60646
|
if (!existingData) {
|
|
60630
|
-
|
|
60647
|
+
const readOptions = {};
|
|
60648
|
+
if (effectiveDeleterPubKey && effectiveDeleterPubKey !== this.client?.publicKey) {
|
|
60649
|
+
readOptions.authors = [effectiveDeleterPubKey];
|
|
60650
|
+
}
|
|
60651
|
+
existingData = await read(this.client, path, readOptions);
|
|
60631
60652
|
dataSource = existingData ? "storage" : null;
|
|
60632
60653
|
}
|
|
60633
60654
|
if (!existingData) {
|
|
@@ -60636,7 +60657,7 @@ class HoloSphereBase extends HoloSphere$1 {
|
|
|
60636
60657
|
}
|
|
60637
60658
|
this._log("DEBUG", "🗑️ DELETE: Found data", { path, source: dataSource });
|
|
60638
60659
|
const dataOwner = existingData.owner || existingData._creator;
|
|
60639
|
-
const isDataOwner = !dataOwner || dataOwner === this.client.publicKey;
|
|
60660
|
+
const isDataOwner = !dataOwner || dataOwner === this.client.publicKey || dataOwner === effectiveDeleterPubKey;
|
|
60640
60661
|
if (!isDataOwner) {
|
|
60641
60662
|
if (!capToken) {
|
|
60642
60663
|
throw new AuthorizationError("AuthorizationError: Capability token required for delete operation", "delete");
|
|
@@ -60666,7 +60687,16 @@ class HoloSphereBase extends HoloSphere$1 {
|
|
|
60666
60687
|
}
|
|
60667
60688
|
const startTime = Date.now();
|
|
60668
60689
|
this._log("DEBUG", "🔄 DELETE SYNC START", { path, dataId });
|
|
60669
|
-
const
|
|
60690
|
+
const storageOptions = {};
|
|
60691
|
+
if (options.signingKey) {
|
|
60692
|
+
storageOptions.signingKey = options.signingKey;
|
|
60693
|
+
try {
|
|
60694
|
+
storageOptions.authorPubkey = getPublicKey(options.signingKey);
|
|
60695
|
+
} catch (err) {
|
|
60696
|
+
this._log("WARN", "⚠️ Invalid signingKey in delete, using client key", { error: err.message });
|
|
60697
|
+
}
|
|
60698
|
+
}
|
|
60699
|
+
const deletePromise = deleteData(this.client, path, storageOptions).then(() => {
|
|
60670
60700
|
const duration = Date.now() - startTime;
|
|
60671
60701
|
this._metrics.deletes++;
|
|
60672
60702
|
this._deleteCache.delete(path);
|
|
@@ -60782,13 +60812,25 @@ class HoloSphereBase extends HoloSphere$1 {
|
|
|
60782
60812
|
*
|
|
60783
60813
|
* @param {string} holonId - H3 cell ID for the holon
|
|
60784
60814
|
* @param {string} lensName - Name of the lens (data category)
|
|
60815
|
+
* @param {Object} [options] - Delete options
|
|
60816
|
+
* @param {string} [options.signingKey] - Private key for signing tombstones (hex format).
|
|
60817
|
+
* Required when deleting data written by a different keypair (e.g., per-holon keys).
|
|
60785
60818
|
* @returns {Promise<boolean>} True if deletion succeeded
|
|
60786
60819
|
*/
|
|
60787
|
-
async deleteAll(holonId, lensName) {
|
|
60820
|
+
async deleteAll(holonId, lensName, options = {}) {
|
|
60788
60821
|
if (holonId != null) holonId = String(holonId);
|
|
60789
60822
|
if (lensName != null) lensName = String(lensName);
|
|
60790
60823
|
const path = buildPath(this.config.appName, holonId, lensName);
|
|
60791
|
-
|
|
60824
|
+
const storageOptions = {};
|
|
60825
|
+
if (options.signingKey) {
|
|
60826
|
+
storageOptions.signingKey = options.signingKey;
|
|
60827
|
+
try {
|
|
60828
|
+
storageOptions.authorPubkey = getPublicKey(options.signingKey);
|
|
60829
|
+
} catch (err) {
|
|
60830
|
+
this._log("WARN", "⚠️ Invalid signingKey in deleteAll, using client key", { error: err.message });
|
|
60831
|
+
}
|
|
60832
|
+
}
|
|
60833
|
+
return deleteAll(this.client, path, storageOptions);
|
|
60792
60834
|
}
|
|
60793
60835
|
// === Schema Operations ===
|
|
60794
60836
|
/**
|
|
@@ -61335,16 +61377,52 @@ class HoloSphereBase extends HoloSphere$1 {
|
|
|
61335
61377
|
const subscriptionId = `${holonId}-${lensName}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
61336
61378
|
let innerSubscription = null;
|
|
61337
61379
|
let unsubscribeCalled = false;
|
|
61338
|
-
|
|
61339
|
-
|
|
61340
|
-
|
|
61341
|
-
|
|
61342
|
-
|
|
61343
|
-
|
|
61380
|
+
(async () => {
|
|
61381
|
+
try {
|
|
61382
|
+
const targetPubkey = await this._resolveHolonToPubkey(holonId);
|
|
61383
|
+
const isOtherAuthor = targetPubkey && targetPubkey !== this.client.publicKey;
|
|
61384
|
+
if (isOtherAuthor) {
|
|
61385
|
+
const capToken = options.capabilityToken || options.capability;
|
|
61386
|
+
if (capToken) {
|
|
61387
|
+
const authorized = await this.verifyCapability(capToken, "read", { holonId, lensName });
|
|
61388
|
+
if (!authorized) {
|
|
61389
|
+
this._log("WARN", "❌ Subscribe: invalid capability token - skipping", { holonId, lensName });
|
|
61390
|
+
return;
|
|
61391
|
+
}
|
|
61392
|
+
} else {
|
|
61393
|
+
const capability = await this._getCapabilityForAuthor(targetPubkey, { holonId, lensName });
|
|
61394
|
+
if (!capability) {
|
|
61395
|
+
this._log("WARN", "❌ Subscribe: no capability for federated author - skipping", {
|
|
61396
|
+
holonId,
|
|
61397
|
+
lensName,
|
|
61398
|
+
targetPubkey: targetPubkey?.slice(0, 12) + "..."
|
|
61399
|
+
});
|
|
61400
|
+
return;
|
|
61401
|
+
}
|
|
61402
|
+
this._log("DEBUG", "✅ Subscribe: capability found for federated author", {
|
|
61403
|
+
holonId,
|
|
61404
|
+
lensName,
|
|
61405
|
+
targetPubkey: targetPubkey?.slice(0, 12) + "..."
|
|
61406
|
+
});
|
|
61407
|
+
}
|
|
61408
|
+
}
|
|
61409
|
+
if (unsubscribeCalled) return;
|
|
61410
|
+
const subscription = await createSubscription(
|
|
61411
|
+
this.client,
|
|
61412
|
+
path,
|
|
61413
|
+
callback,
|
|
61414
|
+
subscriptionOptions
|
|
61415
|
+
);
|
|
61416
|
+
innerSubscription = subscription;
|
|
61417
|
+
if (unsubscribeCalled) {
|
|
61418
|
+
subscription.unsubscribe();
|
|
61419
|
+
} else {
|
|
61420
|
+
this.subscriptionRegistry.register(subscriptionId, subscription);
|
|
61421
|
+
}
|
|
61422
|
+
} catch (err) {
|
|
61423
|
+
this._log("ERROR", "Subscription setup failed", { path, error: err.message });
|
|
61344
61424
|
}
|
|
61345
|
-
})
|
|
61346
|
-
this._log("ERROR", "Subscription setup failed", { path, error: err.message });
|
|
61347
|
-
});
|
|
61425
|
+
})();
|
|
61348
61426
|
this._metrics.subscriptions = (this._metrics.subscriptions || 0) + 1;
|
|
61349
61427
|
return {
|
|
61350
61428
|
unsubscribe: () => {
|
|
@@ -61923,4 +62001,4 @@ export {
|
|
|
61923
62001
|
concatBytes as y,
|
|
61924
62002
|
dataLength as z
|
|
61925
62003
|
};
|
|
61926
|
-
//# sourceMappingURL=index-
|
|
62004
|
+
//# sourceMappingURL=index-B7ERi4ng.js.map
|