holosphere 2.0.0-alpha2 → 2.0.0-alpha5
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-D2OG2idw.js +6680 -0
- package/dist/2019-D2OG2idw.js.map +1 -0
- package/dist/2019-EION3wKo.cjs +8 -0
- package/dist/2019-EION3wKo.cjs.map +1 -0
- package/dist/_commonjsHelpers-C37NGDzP.cjs +2 -0
- package/dist/_commonjsHelpers-C37NGDzP.cjs.map +1 -0
- package/dist/_commonjsHelpers-CUmg6egw.js +7 -0
- package/dist/_commonjsHelpers-CUmg6egw.js.map +1 -0
- package/dist/browser-BSniCNqO.js +3058 -0
- package/dist/browser-BSniCNqO.js.map +1 -0
- package/dist/browser-Cq59Ij19.cjs +2 -0
- package/dist/browser-Cq59Ij19.cjs.map +1 -0
- package/dist/cjs/holosphere.cjs +1 -1
- package/dist/esm/holosphere.js +50 -53
- package/dist/index-BG8FStkt.cjs +12 -0
- package/dist/index-BG8FStkt.cjs.map +1 -0
- package/dist/index-Bbey4GkP.js +37869 -0
- package/dist/index-Bbey4GkP.js.map +1 -0
- package/dist/index-Cp3xctq8.js +15104 -0
- package/dist/index-Cp3xctq8.js.map +1 -0
- package/dist/index-hfVGRwSr.cjs +5 -0
- package/dist/index-hfVGRwSr.cjs.map +1 -0
- package/dist/indexeddb-storage-BD70pN7q.cjs +2 -0
- package/dist/indexeddb-storage-BD70pN7q.cjs.map +1 -0
- package/dist/{indexeddb-storage-CMW4qRQS.js → indexeddb-storage-Bjg84U5R.js} +49 -13
- package/dist/indexeddb-storage-Bjg84U5R.js.map +1 -0
- package/dist/{memory-storage-DQzcAZlf.js → memory-storage-CD0XFayE.js} +6 -2
- package/dist/memory-storage-CD0XFayE.js.map +1 -0
- package/dist/{memory-storage-DmePEP2q.cjs → memory-storage-DmMyJtOo.cjs} +2 -2
- package/dist/memory-storage-DmMyJtOo.cjs.map +1 -0
- package/dist/{secp256k1-vOXp40Fx.js → secp256k1-69sS9O-P.js} +2 -393
- package/dist/secp256k1-69sS9O-P.js.map +1 -0
- package/dist/secp256k1-TcN6vWGh.cjs +12 -0
- package/dist/secp256k1-TcN6vWGh.cjs.map +1 -0
- package/docs/CONTRACTS.md +797 -0
- package/examples/demo.html +47 -0
- package/package.json +10 -5
- package/src/contracts/abis/Appreciative.json +1280 -0
- package/src/contracts/abis/AppreciativeFactory.json +101 -0
- package/src/contracts/abis/Bundle.json +1435 -0
- package/src/contracts/abis/BundleFactory.json +106 -0
- package/src/contracts/abis/Holon.json +881 -0
- package/src/contracts/abis/Holons.json +330 -0
- package/src/contracts/abis/Managed.json +1262 -0
- package/src/contracts/abis/ManagedFactory.json +149 -0
- package/src/contracts/abis/Membrane.json +261 -0
- package/src/contracts/abis/Splitter.json +1624 -0
- package/src/contracts/abis/SplitterFactory.json +220 -0
- package/src/contracts/abis/TestToken.json +321 -0
- package/src/contracts/abis/Zoned.json +1461 -0
- package/src/contracts/abis/ZonedFactory.json +154 -0
- package/src/contracts/chain-manager.js +375 -0
- package/src/contracts/deployer.js +443 -0
- package/src/contracts/event-listener.js +507 -0
- package/src/contracts/holon-contracts.js +344 -0
- package/src/contracts/index.js +83 -0
- package/src/contracts/networks.js +224 -0
- package/src/contracts/operations.js +670 -0
- package/src/contracts/queries.js +589 -0
- package/src/core/holosphere.js +453 -1
- package/src/crypto/nostr-utils.js +263 -0
- package/src/federation/handshake.js +455 -0
- package/src/federation/hologram.js +1 -1
- package/src/hierarchical/upcast.js +6 -5
- package/src/index.js +463 -1939
- package/src/lib/ai-methods.js +308 -0
- package/src/lib/contract-methods.js +293 -0
- package/src/lib/errors.js +23 -0
- package/src/lib/federation-methods.js +238 -0
- package/src/lib/index.js +26 -0
- package/src/spatial/h3-operations.js +2 -2
- package/src/storage/backends/gundb-backend.js +377 -46
- package/src/storage/global-tables.js +28 -1
- package/src/storage/gun-auth.js +303 -0
- package/src/storage/gun-federation.js +776 -0
- package/src/storage/gun-references.js +198 -0
- package/src/storage/gun-schema.js +291 -0
- package/src/storage/gun-wrapper.js +347 -31
- package/src/storage/indexeddb-storage.js +49 -11
- package/src/storage/memory-storage.js +5 -0
- package/src/storage/nostr-async.js +194 -37
- package/src/storage/nostr-client.js +580 -51
- package/src/storage/persistent-storage.js +6 -1
- package/src/storage/unified-storage.js +119 -0
- package/src/subscriptions/manager.js +1 -1
- package/types/index.d.ts +133 -0
- package/dist/index-CDfIuXew.js +0 -15974
- package/dist/index-CDfIuXew.js.map +0 -1
- package/dist/index-ifOgtDvd.cjs +0 -3
- package/dist/index-ifOgtDvd.cjs.map +0 -1
- package/dist/indexeddb-storage-CMW4qRQS.js.map +0 -1
- package/dist/indexeddb-storage-DLZOgetM.cjs +0 -2
- package/dist/indexeddb-storage-DLZOgetM.cjs.map +0 -1
- package/dist/memory-storage-DQzcAZlf.js.map +0 -1
- package/dist/memory-storage-DmePEP2q.cjs.map +0 -1
- package/dist/secp256k1-CP0ZkpAx.cjs +0 -13
- package/dist/secp256k1-CP0ZkpAx.cjs.map +0 -1
- package/dist/secp256k1-vOXp40Fx.js.map +0 -1
|
@@ -10,6 +10,7 @@ class PersistentStorage {
|
|
|
10
10
|
/**
|
|
11
11
|
* Initialize storage
|
|
12
12
|
* @param {string} namespace - Storage namespace (appName)
|
|
13
|
+
* @returns {Promise<void>}
|
|
13
14
|
*/
|
|
14
15
|
async init(namespace) {
|
|
15
16
|
throw new Error('init() must be implemented by subclass');
|
|
@@ -19,6 +20,7 @@ class PersistentStorage {
|
|
|
19
20
|
* Store event
|
|
20
21
|
* @param {string} key - Event ID or d-tag
|
|
21
22
|
* @param {Object} event - Nostr event
|
|
23
|
+
* @returns {Promise<void>}
|
|
22
24
|
*/
|
|
23
25
|
async put(key, event) {
|
|
24
26
|
throw new Error('put() must be implemented by subclass');
|
|
@@ -36,7 +38,7 @@ class PersistentStorage {
|
|
|
36
38
|
/**
|
|
37
39
|
* Get all events matching prefix
|
|
38
40
|
* @param {string} prefix - Key prefix
|
|
39
|
-
* @returns {Promise<
|
|
41
|
+
* @returns {Promise<any[]>} Array of events
|
|
40
42
|
*/
|
|
41
43
|
async getAll(prefix) {
|
|
42
44
|
throw new Error('getAll() must be implemented by subclass');
|
|
@@ -45,6 +47,7 @@ class PersistentStorage {
|
|
|
45
47
|
/**
|
|
46
48
|
* Delete event
|
|
47
49
|
* @param {string} key - Event ID or d-tag
|
|
50
|
+
* @returns {Promise<void>}
|
|
48
51
|
*/
|
|
49
52
|
async delete(key) {
|
|
50
53
|
throw new Error('delete() must be implemented by subclass');
|
|
@@ -52,6 +55,7 @@ class PersistentStorage {
|
|
|
52
55
|
|
|
53
56
|
/**
|
|
54
57
|
* Clear all data in namespace
|
|
58
|
+
* @returns {Promise<void>}
|
|
55
59
|
*/
|
|
56
60
|
async clear() {
|
|
57
61
|
throw new Error('clear() must be implemented by subclass');
|
|
@@ -59,6 +63,7 @@ class PersistentStorage {
|
|
|
59
63
|
|
|
60
64
|
/**
|
|
61
65
|
* Close storage
|
|
66
|
+
* @returns {Promise<void>}
|
|
62
67
|
*/
|
|
63
68
|
async close() {
|
|
64
69
|
throw new Error('close() must be implemented by subclass');
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified Storage Adapter
|
|
3
|
+
* Routes storage operations to the correct backend (nostr or gundb)
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as nostrWrapper from './nostr-wrapper.js';
|
|
7
|
+
import * as gunWrapper from './gun-wrapper.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Build path from components
|
|
11
|
+
* @param {string} appName - Application namespace
|
|
12
|
+
* @param {string} holonId - Holon identifier
|
|
13
|
+
* @param {string} lensName - Lens name
|
|
14
|
+
* @param {string} [key] - Optional data key
|
|
15
|
+
* @returns {string} Constructed path
|
|
16
|
+
*/
|
|
17
|
+
export function buildPath(appName, holonId, lensName, key = null) {
|
|
18
|
+
// Both backends use the same path format
|
|
19
|
+
return nostrWrapper.buildPath(appName, holonId, lensName, key);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Write data to storage
|
|
24
|
+
* @param {Object} client - Client instance (nostr client or gun-compatible client)
|
|
25
|
+
* @param {string} path - Storage path
|
|
26
|
+
* @param {Object} data - Data to write
|
|
27
|
+
* @returns {Promise<boolean>} Success indicator
|
|
28
|
+
*/
|
|
29
|
+
export async function write(client, path, data) {
|
|
30
|
+
// Check if this is a GunDB client
|
|
31
|
+
if (client.gun) {
|
|
32
|
+
return gunWrapper.write(client.gun, path, data);
|
|
33
|
+
}
|
|
34
|
+
// Default to Nostr
|
|
35
|
+
return nostrWrapper.write(client, path, data);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Read data from storage
|
|
40
|
+
* @param {Object} client - Client instance
|
|
41
|
+
* @param {string} path - Storage path
|
|
42
|
+
* @param {Object} [options] - Read options
|
|
43
|
+
* @returns {Promise<Object|null>} Data or null
|
|
44
|
+
*/
|
|
45
|
+
export async function read(client, path, options = {}) {
|
|
46
|
+
if (client.gun) {
|
|
47
|
+
return gunWrapper.read(client.gun, path);
|
|
48
|
+
}
|
|
49
|
+
return nostrWrapper.read(client, path, options);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Read all data under a path prefix
|
|
54
|
+
* @param {Object} client - Client instance
|
|
55
|
+
* @param {string} path - Path prefix
|
|
56
|
+
* @param {Object} [options] - Query options
|
|
57
|
+
* @returns {Promise<Object[]>} Array of data objects
|
|
58
|
+
*/
|
|
59
|
+
export async function readAll(client, path, options = {}) {
|
|
60
|
+
if (client.gun) {
|
|
61
|
+
return gunWrapper.readAll(client.gun, path);
|
|
62
|
+
}
|
|
63
|
+
return nostrWrapper.readAll(client, path, options);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Update data (merge fields)
|
|
68
|
+
* @param {Object} client - Client instance
|
|
69
|
+
* @param {string} path - Storage path
|
|
70
|
+
* @param {Object} updates - Fields to update
|
|
71
|
+
* @returns {Promise<boolean>} Success indicator
|
|
72
|
+
*/
|
|
73
|
+
export async function update(client, path, updates) {
|
|
74
|
+
if (client.gun) {
|
|
75
|
+
return gunWrapper.update(client.gun, path, updates);
|
|
76
|
+
}
|
|
77
|
+
return nostrWrapper.update(client, path, updates);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Delete data at path
|
|
82
|
+
* @param {Object} client - Client instance
|
|
83
|
+
* @param {string} path - Storage path
|
|
84
|
+
* @returns {Promise<boolean>} Success indicator
|
|
85
|
+
*/
|
|
86
|
+
export async function deleteData(client, path) {
|
|
87
|
+
if (client.gun) {
|
|
88
|
+
return gunWrapper.deleteData(client.gun, path);
|
|
89
|
+
}
|
|
90
|
+
return nostrWrapper.deleteData(client, path);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Delete all data under path prefix
|
|
95
|
+
* @param {Object} client - Client instance
|
|
96
|
+
* @param {string} path - Path prefix
|
|
97
|
+
* @returns {Promise<Object>} Deletion results
|
|
98
|
+
*/
|
|
99
|
+
export async function deleteAll(client, path) {
|
|
100
|
+
if (client.gun) {
|
|
101
|
+
return gunWrapper.deleteAll(client.gun, path);
|
|
102
|
+
}
|
|
103
|
+
return nostrWrapper.deleteAll(client, path);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Subscribe to data changes
|
|
108
|
+
* @param {Object} client - Client instance
|
|
109
|
+
* @param {string} path - Path or path prefix
|
|
110
|
+
* @param {Function} callback - Called on changes
|
|
111
|
+
* @param {Object} [options] - Subscription options
|
|
112
|
+
* @returns {Object} Subscription with unsubscribe method
|
|
113
|
+
*/
|
|
114
|
+
export function subscribe(client, path, callback, options = {}) {
|
|
115
|
+
if (client.gun) {
|
|
116
|
+
return gunWrapper.subscribe(client.gun, path, callback, options);
|
|
117
|
+
}
|
|
118
|
+
return nostrWrapper.subscribe(client, path, callback, options);
|
|
119
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// Type declarations for holosphere
|
|
2
|
+
// This file tells TypeScript to skip type checking the bundled JS files
|
|
3
|
+
|
|
4
|
+
declare module 'holosphere' {
|
|
5
|
+
export class HoloSphere {
|
|
6
|
+
constructor(config?: any);
|
|
7
|
+
init(): Promise<void>;
|
|
8
|
+
|
|
9
|
+
// Core CRUD operations
|
|
10
|
+
get(holonId: string, lens: string, key?: string): Promise<any>;
|
|
11
|
+
getAll(holonId: string, lens: string): Promise<Record<string, any>>;
|
|
12
|
+
put(holonId: string, lens: string, value: any): Promise<void>;
|
|
13
|
+
put(holonId: string, lens: string, key: string, value: any): Promise<void>;
|
|
14
|
+
delete(holonId: string, lens: string, key?: string): Promise<void>;
|
|
15
|
+
read(holonId: string, lens: string, key?: string): Promise<any>;
|
|
16
|
+
|
|
17
|
+
// Subscription
|
|
18
|
+
subscribe(holonId: string, lens: string, callback: (data: any, key: string) => void): Promise<{ unsubscribe: () => void }>;
|
|
19
|
+
|
|
20
|
+
// Profile operations
|
|
21
|
+
getHolonProfile(holonId: string): Promise<any>;
|
|
22
|
+
setHolonProfile(holonId: string, profile: any): Promise<void>;
|
|
23
|
+
|
|
24
|
+
// Federation operations
|
|
25
|
+
federate(sourceHolonId: string, targetHolonId: string, sourceKey?: string | null, targetKey?: string | null, bidirectional?: boolean, permissions?: any): Promise<void>;
|
|
26
|
+
federateHolon(holonId: string, targetHolonId: string, options?: any): Promise<void>;
|
|
27
|
+
getFederation(holonId: string): Promise<any>;
|
|
28
|
+
propagate(holonId: string, lens: string, key: string, value: any): Promise<void>;
|
|
29
|
+
propagateData(holonId: string, lens: string, data: any): Promise<void>;
|
|
30
|
+
|
|
31
|
+
// Global operations
|
|
32
|
+
getGlobal(lens: string, key?: string): Promise<any>;
|
|
33
|
+
getAllGlobal(lens: string): Promise<Record<string, any>>;
|
|
34
|
+
writeGlobal(lens: string, key: string, value: any): Promise<void>;
|
|
35
|
+
|
|
36
|
+
// Internal properties (exposed for advanced use)
|
|
37
|
+
gun?: any;
|
|
38
|
+
client?: any;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export class PersistentStorage {
|
|
42
|
+
init(namespace: string): Promise<void>;
|
|
43
|
+
put(key: string, event: any): Promise<void>;
|
|
44
|
+
get(key: string): Promise<any | null>;
|
|
45
|
+
getAll(prefix: string): Promise<any[]>;
|
|
46
|
+
delete(key: string): Promise<void>;
|
|
47
|
+
clear(): Promise<void>;
|
|
48
|
+
close(): Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export class IndexedDBStorage extends PersistentStorage {}
|
|
52
|
+
export class MemoryStorage extends PersistentStorage {}
|
|
53
|
+
export class FileSystemStorage extends PersistentStorage {}
|
|
54
|
+
|
|
55
|
+
export class ChainManager {
|
|
56
|
+
constructor(config?: any);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export class ContractDeployer {
|
|
60
|
+
constructor(chainManager: ChainManager);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export class ContractOperations {
|
|
64
|
+
constructor(chainManager: ChainManager);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export class ContractQueries {
|
|
68
|
+
constructor(chainManager: ChainManager);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export class EventListener {
|
|
72
|
+
constructor(chainManager: ChainManager);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export class HolonContracts {
|
|
76
|
+
constructor(config?: any);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const ContractABIs: any;
|
|
80
|
+
export const NETWORKS: any;
|
|
81
|
+
|
|
82
|
+
export class AuthorizationError extends Error {}
|
|
83
|
+
export class ValidationError extends Error {}
|
|
84
|
+
|
|
85
|
+
export const crypto: any;
|
|
86
|
+
export const federation: any;
|
|
87
|
+
export const handshake: {
|
|
88
|
+
initiateFederationHandshake(holosphere: HoloSphere, privateKey: string, params: any): Promise<any>;
|
|
89
|
+
acceptFederationRequest(holosphere: HoloSphere, privateKey: string, params: any): Promise<any>;
|
|
90
|
+
rejectFederationRequest(holosphere: HoloSphere, privateKey: string, params: any): Promise<any>;
|
|
91
|
+
subscribeToFederationDMs(client: any, privateKey: string, publicKey: string, handlers: any): () => void;
|
|
92
|
+
};
|
|
93
|
+
export const hierarchical: any;
|
|
94
|
+
export const nostrUtils: any;
|
|
95
|
+
export const schema: any;
|
|
96
|
+
export const social: any;
|
|
97
|
+
export const spatial: any;
|
|
98
|
+
export const storage: any;
|
|
99
|
+
export const subscriptions: any;
|
|
100
|
+
export const networks: any;
|
|
101
|
+
|
|
102
|
+
export function createHologram(config?: any): any;
|
|
103
|
+
export function createAIServices(config?: any): any;
|
|
104
|
+
export function getNetwork(name: string): any;
|
|
105
|
+
export function getNetworksByType(type: string): any[];
|
|
106
|
+
export function listNetworks(): string[];
|
|
107
|
+
export function isNetworkSupported(name: string): boolean;
|
|
108
|
+
export function getAddressUrl(network: string, address: string): string;
|
|
109
|
+
export function getTxUrl(network: string, txHash: string): string;
|
|
110
|
+
export function matchScope(scope: string, pattern: string): boolean;
|
|
111
|
+
|
|
112
|
+
// AI-related exports
|
|
113
|
+
export class Classifier {}
|
|
114
|
+
export class Council {}
|
|
115
|
+
export class Embeddings {}
|
|
116
|
+
export class FederationAdvisor {}
|
|
117
|
+
export class H3AI {}
|
|
118
|
+
export class JSONOps {}
|
|
119
|
+
export class LLMService {}
|
|
120
|
+
export class NLQuery {}
|
|
121
|
+
export class RelationshipDiscovery {}
|
|
122
|
+
export class SchemaExtractor {}
|
|
123
|
+
export class SmartAggregation {}
|
|
124
|
+
export class SpatialAnalysis {}
|
|
125
|
+
export class TaskBreakdown {}
|
|
126
|
+
export class TTS {}
|
|
127
|
+
|
|
128
|
+
export const MODELS: any;
|
|
129
|
+
export const VOICES: any;
|
|
130
|
+
export const SANKEY_EVENTS: any;
|
|
131
|
+
|
|
132
|
+
export default HoloSphere;
|
|
133
|
+
}
|