@xyo-network/chain-orchestration 1.16.9 → 1.16.10
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/neutral/index.mjs
CHANGED
|
@@ -133,8 +133,8 @@ var initBridgedModule = /* @__PURE__ */ __name(async ({ bridge, moduleName }) =>
|
|
|
133
133
|
return await initMutex2.runExclusive(async () => {
|
|
134
134
|
const existing = bridgedModuleDictionary?.[bridge.address]?.[moduleName];
|
|
135
135
|
if (existing) return existing;
|
|
136
|
-
const mod = assertEx(await bridge.resolve(moduleName), () => `
|
|
137
|
-
const moduleInstance = assertEx(asAttachableModuleInstance(mod), () => `
|
|
136
|
+
const mod = assertEx(await bridge.resolve(moduleName), () => `Could not resolve ${moduleName}`);
|
|
137
|
+
const moduleInstance = assertEx(asAttachableModuleInstance(mod), () => `Could not convert ${moduleName} to attachable module instance`);
|
|
138
138
|
let moduleMap = bridgedModuleDictionary[bridge.address];
|
|
139
139
|
if (moduleMap === void 0) {
|
|
140
140
|
moduleMap = {};
|
|
@@ -148,7 +148,7 @@ var initBridgedArchivistModule = /* @__PURE__ */ __name(async ({ bridge, moduleN
|
|
|
148
148
|
return assertEx(asAttachableArchivistInstance(await initBridgedModule({
|
|
149
149
|
bridge,
|
|
150
150
|
moduleName
|
|
151
|
-
})), () => `
|
|
151
|
+
})), () => `Could not convert ${moduleName} to attachable archivist instance`);
|
|
152
152
|
}, "initBridgedArchivistModule");
|
|
153
153
|
export {
|
|
154
154
|
DefaultReadCachingArchivistConfig,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/archivist/initArchivistSync.ts","../../src/archivist/wrapWithReadCachingArchivist.ts","../../src/bridge.ts","../../src/initBridgedModule.ts"],"sourcesContent":["import type { TracerProvider } from '@opentelemetry/api'\nimport type { ArchivistInstance } from '@xyo-network/archivist-model'\nimport { ArchivistSyncDiviner } from '@xyo-network/chain-modules'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\nimport { MemoryNode } from '@xyo-network/node-memory'\nimport { MemorySentinel } from '@xyo-network/sentinel-memory'\nimport { SentinelConfigSchema } from '@xyo-network/sentinel-model'\n\nexport const initArchivistSync = async (\n name: ModuleIdentifier,\n inArchivist: ArchivistInstance,\n outArchivist: ArchivistInstance,\n frequency = 1000,\n max = 1000,\n traceProvider?: TracerProvider,\n) => {\n const node = await MemoryNode.create({ account: 'random' })\n const finalizedArchivistSyncDiviner = await ArchivistSyncDiviner.create({\n account: 'random',\n inArchivist,\n outArchivist,\n traceProvider,\n config: {\n schema: DivinerConfigSchema, name, max,\n },\n })\n\n await node.register(finalizedArchivistSyncDiviner)\n await node.attach(finalizedArchivistSyncDiviner.address)\n\n const sentinel = await MemorySentinel.create({\n account: 'random',\n config: {\n name,\n synchronous: true,\n schema: SentinelConfigSchema,\n tasks: [\n {\n required: true,\n mod: finalizedArchivistSyncDiviner.address,\n endPoint: 'divine',\n },\n ],\n automations: [\n {\n frequency,\n frequencyUnits: 'millis',\n schema: 'network.xyo.automation.interval',\n start: Date.now(),\n type: 'interval',\n },\n ],\n },\n })\n\n await node.register(sentinel)\n await node.attach(sentinel.address)\n\n return node\n}\n","import type { MemoryArchivistConfig } from '@xyo-network/archivist-memory'\nimport { MemoryArchivist, MemoryArchivistConfigSchema } from '@xyo-network/archivist-memory'\nimport type { AttachableArchivistInstance } from '@xyo-network/archivist-model'\n\nimport { initArchivistSync } from './initArchivistSync.ts'\n\nexport const DefaultReadCachingArchivistConfig: MemoryArchivistConfig = {\n max: 100_000,\n // requireAllParents: true,\n schema: MemoryArchivistConfigSchema,\n}\n\nconst getDynamicDefaultReadCachingArchivistConfig = (archivist: AttachableArchivistInstance): Partial<MemoryArchivistConfig> => {\n const { id } = archivist\n const name = `${id}-CachingArchivist`\n const dynamicDefaults: Partial<MemoryArchivistConfig> = { name }\n return dynamicDefaults\n}\n\nconst getDynamicReadCachingArchivistConfig = (_archivist: AttachableArchivistInstance): Partial<MemoryArchivistConfig> => {\n // const parents = {\n // read: [archivist.address], write: [], commit: [],\n // }\n // const dynamicConfig: Partial<MemoryArchivistConfig> = { parents }\n const dynamicConfig: Partial<MemoryArchivistConfig> = {}\n return dynamicConfig\n}\n\nexport const wrapWithReadCachingArchivist = async (\n archivist: AttachableArchivistInstance,\n config: Partial<MemoryArchivistConfig> = DefaultReadCachingArchivistConfig,\n): Promise<AttachableArchivistInstance> => {\n const dynamicDefaultReadCachingArchivistConfig = getDynamicDefaultReadCachingArchivistConfig(archivist)\n const dynamicReadCachingArchivistConfig = getDynamicReadCachingArchivistConfig(archivist)\n\n // Create a materialized config with precedence\n const materializedConfig: MemoryArchivistConfig = {\n // Use the static defaults\n ...DefaultReadCachingArchivistConfig,\n // Use the dynamic defaults\n ...dynamicDefaultReadCachingArchivistConfig,\n // Use the supplied config\n ...config,\n // Use they dynamic config\n ...dynamicReadCachingArchivistConfig,\n }\n const cachingArchivist = await MemoryArchivist.create({ account: 'random', config: materializedConfig })\n await initArchivistSync(\n `${cachingArchivist.id}-Sync`,\n archivist,\n cachingArchivist,\n 1000,\n )\n\n return cachingArchivist\n}\n","import { HttpBridge, HttpBridgeConfigSchema } from '@xyo-network/bridge-http'\nimport type { AttachableBridgeInstance } from '@xyo-network/bridge-model'\nimport { Mutex } from 'async-mutex'\n\nconst initMutex = new Mutex()\nconst bridgeSingletonMap = new Map<string, AttachableBridgeInstance>()\n\nexport const initBridge = async (nodeUrl: string): Promise<AttachableBridgeInstance> => {\n return await initMutex.runExclusive(async () => {\n const existing = bridgeSingletonMap.get(nodeUrl)\n if (existing) return existing\n const bridge = await HttpBridge.create({\n account: 'random',\n config: {\n name: 'HttpBridge',\n client: { url: nodeUrl, discoverRoots: 'start' },\n schema: HttpBridgeConfigSchema,\n security: { allowAnonymous: true },\n },\n })\n await bridge.start()\n bridgeSingletonMap.set(nodeUrl, bridge)\n return bridge\n })\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Address } from '@xylabs/hex'\nimport type { Logger } from '@xylabs/logger'\nimport type { AttachableArchivistInstance } from '@xyo-network/archivist-model'\nimport { asAttachableArchivistInstance } from '@xyo-network/archivist-model'\nimport type { BridgeInstance } from '@xyo-network/bridge-model'\nimport type { AttachableModuleInstance, ModuleIdentifier } from '@xyo-network/module-model'\nimport { asAttachableModuleInstance } from '@xyo-network/module-model'\nimport type { Initializable } from '@xyo-network/xl1-protocol'\nimport { Mutex } from 'async-mutex'\n\nconst initMutex = new Mutex()\ntype ModuleDictionary = Record<ModuleIdentifier, AttachableModuleInstance | undefined>\ntype BridgedModuleDictionary = Record<Address, ModuleDictionary | undefined>\nconst bridgedModuleDictionary: BridgedModuleDictionary = {}\n\nexport const initBridgedModule: Initializable<\n { bridge: BridgeInstance; moduleName: ModuleIdentifier }, AttachableModuleInstance\n> = async ({ bridge, moduleName }): Promise<AttachableModuleInstance> => {\n return await initMutex.runExclusive(async () => {\n const existing = bridgedModuleDictionary?.[bridge.address]?.[moduleName]\n if (existing) return existing\n const mod = assertEx(await bridge.resolve(moduleName), () => `Error: Could not resolve ${moduleName}`)\n const moduleInstance = assertEx(asAttachableModuleInstance(mod), () => `Error: Could not convert ${moduleName} to attachable module instance`)\n // Initialize the nested dictionary if needed\n let moduleMap = bridgedModuleDictionary[bridge.address]\n if (moduleMap === undefined) {\n moduleMap = {}\n bridgedModuleDictionary[bridge.address] = moduleMap\n }\n // Store and return the module instance\n moduleMap[moduleName] = moduleInstance\n return moduleInstance\n })\n}\n\nexport const initBridgedArchivistModule: Initializable<\n { bridge: BridgeInstance; logger?: Logger; moduleName: ModuleIdentifier }, AttachableArchivistInstance\n> = async ({ bridge, moduleName }): Promise<AttachableArchivistInstance> => {\n return assertEx(\n asAttachableArchivistInstance(await initBridgedModule({ bridge, moduleName })),\n () => `Error: Could not convert ${moduleName} to attachable archivist instance`,\n )\n}\n"],"mappings":";;;;AAEA,SAASA,4BAA4B;AACrC,SAASC,2BAA2B;AAEpC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B,UAAME,MAAMC,SAAS,MAAMN,OAAOO,QAAQN,UAAAA,GAAa,MAAM,4BAA4BA,UAAAA,EAAY;AACrG,UAAMO,iBAAiBF,SAASG,2BAA2BJ,GAAAA,GAAM,MAAM,4BAA4BJ,UAAAA,gCAA0C;AAE7I,QAAIS,YAAYZ,wBAAwBE,OAAOI,OAAO;AACtD,QAAIM,cAAcC,QAAW;AAC3BD,kBAAY,CAAC;AACbZ,8BAAwBE,OAAOI,OAAO,IAAIM;IAC5C;AAEAA,cAAUT,UAAAA,IAAcO;AACxB,WAAOA;EACT,CAAA;AACF,GAhBI;AAkBG,IAAMI,6BAET,8BAAO,EAAEZ,QAAQC,WAAU,MAAE;AAC/B,SAAOK,SACLO,8BAA8B,MAAMd,kBAAkB;IAAEC;IAAQC;EAAW,CAAA,CAAA,GAC3E,MAAM,4BAA4BA,UAAAA,mCAA6C;AAEnF,GALI;","names":["ArchivistSyncDiviner","DivinerConfigSchema","MemoryNode","MemorySentinel","SentinelConfigSchema","initArchivistSync","name","inArchivist","outArchivist","frequency","max","traceProvider","node","MemoryNode","create","account","finalizedArchivistSyncDiviner","ArchivistSyncDiviner","config","schema","DivinerConfigSchema","register","attach","address","sentinel","MemorySentinel","synchronous","SentinelConfigSchema","tasks","required","mod","endPoint","automations","frequencyUnits","start","Date","now","type","MemoryArchivist","MemoryArchivistConfigSchema","DefaultReadCachingArchivistConfig","max","schema","MemoryArchivistConfigSchema","getDynamicDefaultReadCachingArchivistConfig","archivist","id","name","dynamicDefaults","getDynamicReadCachingArchivistConfig","_archivist","dynamicConfig","wrapWithReadCachingArchivist","config","dynamicDefaultReadCachingArchivistConfig","dynamicReadCachingArchivistConfig","materializedConfig","cachingArchivist","MemoryArchivist","create","account","initArchivistSync","HttpBridge","HttpBridgeConfigSchema","Mutex","initMutex","Mutex","bridgeSingletonMap","Map","initBridge","nodeUrl","runExclusive","existing","get","bridge","HttpBridge","create","account","config","name","client","url","discoverRoots","schema","HttpBridgeConfigSchema","security","allowAnonymous","start","set","assertEx","asAttachableArchivistInstance","asAttachableModuleInstance","Mutex","initMutex","Mutex","bridgedModuleDictionary","initBridgedModule","bridge","moduleName","runExclusive","existing","address","mod","assertEx","resolve","moduleInstance","asAttachableModuleInstance","moduleMap","undefined","initBridgedArchivistModule","asAttachableArchivistInstance"]}
|
|
1
|
+
{"version":3,"sources":["../../src/archivist/initArchivistSync.ts","../../src/archivist/wrapWithReadCachingArchivist.ts","../../src/bridge.ts","../../src/initBridgedModule.ts"],"sourcesContent":["import type { TracerProvider } from '@opentelemetry/api'\nimport type { ArchivistInstance } from '@xyo-network/archivist-model'\nimport { ArchivistSyncDiviner } from '@xyo-network/chain-modules'\nimport { DivinerConfigSchema } from '@xyo-network/diviner-model'\nimport type { ModuleIdentifier } from '@xyo-network/module-model'\nimport { MemoryNode } from '@xyo-network/node-memory'\nimport { MemorySentinel } from '@xyo-network/sentinel-memory'\nimport { SentinelConfigSchema } from '@xyo-network/sentinel-model'\n\nexport const initArchivistSync = async (\n name: ModuleIdentifier,\n inArchivist: ArchivistInstance,\n outArchivist: ArchivistInstance,\n frequency = 1000,\n max = 1000,\n traceProvider?: TracerProvider,\n) => {\n const node = await MemoryNode.create({ account: 'random' })\n const finalizedArchivistSyncDiviner = await ArchivistSyncDiviner.create({\n account: 'random',\n inArchivist,\n outArchivist,\n traceProvider,\n config: {\n schema: DivinerConfigSchema, name, max,\n },\n })\n\n await node.register(finalizedArchivistSyncDiviner)\n await node.attach(finalizedArchivistSyncDiviner.address)\n\n const sentinel = await MemorySentinel.create({\n account: 'random',\n config: {\n name,\n synchronous: true,\n schema: SentinelConfigSchema,\n tasks: [\n {\n required: true,\n mod: finalizedArchivistSyncDiviner.address,\n endPoint: 'divine',\n },\n ],\n automations: [\n {\n frequency,\n frequencyUnits: 'millis',\n schema: 'network.xyo.automation.interval',\n start: Date.now(),\n type: 'interval',\n },\n ],\n },\n })\n\n await node.register(sentinel)\n await node.attach(sentinel.address)\n\n return node\n}\n","import type { MemoryArchivistConfig } from '@xyo-network/archivist-memory'\nimport { MemoryArchivist, MemoryArchivistConfigSchema } from '@xyo-network/archivist-memory'\nimport type { AttachableArchivistInstance } from '@xyo-network/archivist-model'\n\nimport { initArchivistSync } from './initArchivistSync.ts'\n\nexport const DefaultReadCachingArchivistConfig: MemoryArchivistConfig = {\n max: 100_000,\n // requireAllParents: true,\n schema: MemoryArchivistConfigSchema,\n}\n\nconst getDynamicDefaultReadCachingArchivistConfig = (archivist: AttachableArchivistInstance): Partial<MemoryArchivistConfig> => {\n const { id } = archivist\n const name = `${id}-CachingArchivist`\n const dynamicDefaults: Partial<MemoryArchivistConfig> = { name }\n return dynamicDefaults\n}\n\nconst getDynamicReadCachingArchivistConfig = (_archivist: AttachableArchivistInstance): Partial<MemoryArchivistConfig> => {\n // const parents = {\n // read: [archivist.address], write: [], commit: [],\n // }\n // const dynamicConfig: Partial<MemoryArchivistConfig> = { parents }\n const dynamicConfig: Partial<MemoryArchivistConfig> = {}\n return dynamicConfig\n}\n\nexport const wrapWithReadCachingArchivist = async (\n archivist: AttachableArchivistInstance,\n config: Partial<MemoryArchivistConfig> = DefaultReadCachingArchivistConfig,\n): Promise<AttachableArchivistInstance> => {\n const dynamicDefaultReadCachingArchivistConfig = getDynamicDefaultReadCachingArchivistConfig(archivist)\n const dynamicReadCachingArchivistConfig = getDynamicReadCachingArchivistConfig(archivist)\n\n // Create a materialized config with precedence\n const materializedConfig: MemoryArchivistConfig = {\n // Use the static defaults\n ...DefaultReadCachingArchivistConfig,\n // Use the dynamic defaults\n ...dynamicDefaultReadCachingArchivistConfig,\n // Use the supplied config\n ...config,\n // Use they dynamic config\n ...dynamicReadCachingArchivistConfig,\n }\n const cachingArchivist = await MemoryArchivist.create({ account: 'random', config: materializedConfig })\n await initArchivistSync(\n `${cachingArchivist.id}-Sync`,\n archivist,\n cachingArchivist,\n 1000,\n )\n\n return cachingArchivist\n}\n","import { HttpBridge, HttpBridgeConfigSchema } from '@xyo-network/bridge-http'\nimport type { AttachableBridgeInstance } from '@xyo-network/bridge-model'\nimport { Mutex } from 'async-mutex'\n\nconst initMutex = new Mutex()\nconst bridgeSingletonMap = new Map<string, AttachableBridgeInstance>()\n\nexport const initBridge = async (nodeUrl: string): Promise<AttachableBridgeInstance> => {\n return await initMutex.runExclusive(async () => {\n const existing = bridgeSingletonMap.get(nodeUrl)\n if (existing) return existing\n const bridge = await HttpBridge.create({\n account: 'random',\n config: {\n name: 'HttpBridge',\n client: { url: nodeUrl, discoverRoots: 'start' },\n schema: HttpBridgeConfigSchema,\n security: { allowAnonymous: true },\n },\n })\n await bridge.start()\n bridgeSingletonMap.set(nodeUrl, bridge)\n return bridge\n })\n}\n","import { assertEx } from '@xylabs/assert'\nimport type { Address } from '@xylabs/hex'\nimport type { Logger } from '@xylabs/logger'\nimport type { AttachableArchivistInstance } from '@xyo-network/archivist-model'\nimport { asAttachableArchivistInstance } from '@xyo-network/archivist-model'\nimport type { BridgeInstance } from '@xyo-network/bridge-model'\nimport type { AttachableModuleInstance, ModuleIdentifier } from '@xyo-network/module-model'\nimport { asAttachableModuleInstance } from '@xyo-network/module-model'\nimport type { Initializable } from '@xyo-network/xl1-protocol'\nimport { Mutex } from 'async-mutex'\n\nconst initMutex = new Mutex()\ntype ModuleDictionary = Record<ModuleIdentifier, AttachableModuleInstance | undefined>\ntype BridgedModuleDictionary = Record<Address, ModuleDictionary | undefined>\nconst bridgedModuleDictionary: BridgedModuleDictionary = {}\n\nexport const initBridgedModule: Initializable<\n { bridge: BridgeInstance; moduleName: ModuleIdentifier }, AttachableModuleInstance\n> = async ({ bridge, moduleName }): Promise<AttachableModuleInstance> => {\n return await initMutex.runExclusive(async () => {\n const existing = bridgedModuleDictionary?.[bridge.address]?.[moduleName]\n if (existing) return existing\n const mod = assertEx(await bridge.resolve(moduleName), () => `Could not resolve ${moduleName}`)\n const moduleInstance = assertEx(asAttachableModuleInstance(mod), () => `Could not convert ${moduleName} to attachable module instance`)\n // Initialize the nested dictionary if needed\n let moduleMap = bridgedModuleDictionary[bridge.address]\n if (moduleMap === undefined) {\n moduleMap = {}\n bridgedModuleDictionary[bridge.address] = moduleMap\n }\n // Store and return the module instance\n moduleMap[moduleName] = moduleInstance\n return moduleInstance\n })\n}\n\nexport const initBridgedArchivistModule: Initializable<\n { bridge: BridgeInstance; logger?: Logger; moduleName: ModuleIdentifier }, AttachableArchivistInstance\n> = async ({ bridge, moduleName }): Promise<AttachableArchivistInstance> => {\n return assertEx(\n asAttachableArchivistInstance(await initBridgedModule({ bridge, moduleName })),\n () => `Could not convert ${moduleName} to attachable archivist instance`,\n )\n}\n"],"mappings":";;;;AAEA,SAASA,4BAA4B;AACrC,SAASC,2BAA2B;AAEpC,SAASC,kBAAkB;AAC3B,SAASC,sBAAsB;AAC/B,SAASC,4BAA4B;AAE9B,IAAMC,oBAAoB,8BAC/BC,MACAC,aACAC,cACAC,YAAY,KACZC,MAAM,KACNC,kBAAAA;AAEA,QAAMC,OAAO,MAAMC,WAAWC,OAAO;IAAEC,SAAS;EAAS,CAAA;AACzD,QAAMC,gCAAgC,MAAMC,qBAAqBH,OAAO;IACtEC,SAAS;IACTR;IACAC;IACAG;IACAO,QAAQ;MACNC,QAAQC;MAAqBd;MAAMI;IACrC;EACF,CAAA;AAEA,QAAME,KAAKS,SAASL,6BAAAA;AACpB,QAAMJ,KAAKU,OAAON,8BAA8BO,OAAO;AAEvD,QAAMC,WAAW,MAAMC,eAAeX,OAAO;IAC3CC,SAAS;IACTG,QAAQ;MACNZ;MACAoB,aAAa;MACbP,QAAQQ;MACRC,OAAO;QACL;UACEC,UAAU;UACVC,KAAKd,8BAA8BO;UACnCQ,UAAU;QACZ;;MAEFC,aAAa;QACX;UACEvB;UACAwB,gBAAgB;UAChBd,QAAQ;UACRe,OAAOC,KAAKC,IAAG;UACfC,MAAM;QACR;;IAEJ;EACF,CAAA;AAEA,QAAMzB,KAAKS,SAASG,QAAAA;AACpB,QAAMZ,KAAKU,OAAOE,SAASD,OAAO;AAEl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UAAMZ,OAAOa,MAAK;AAClBpB,uBAAmBqB,IAAIlB,SAASI,MAAAA;AAChC,WAAOA;EACT,CAAA;AACF,GAjB0B;;;ACP1B,SAASe,gBAAgB;AAIzB,SAASC,qCAAqC;AAG9C,SAASC,kCAAkC;AAE3C,SAASC,SAAAA,cAAa;AAEtB,IAAMC,aAAY,IAAIC,OAAAA;AAGtB,IAAMC,0BAAmD,CAAC;AAEnD,IAAMC,oBAET,8BAAO,EAAEC,QAAQC,WAAU,MAAE;AAC/B,SAAO,MAAML,WAAUM,aAAa,YAAA;AAClC,UAAMC,WAAWL,0BAA0BE,OAAOI,OAAO,IAAIH,UAAAA;AAC7D,QAAIE,SAAU,QAAOA;AACrB,UAAME,MAAMC,SAAS,MAAMN,OAAOO,QAAQN,UAAAA,GAAa,MAAM,qBAAqBA,UAAAA,EAAY;AAC9F,UAAMO,iBAAiBF,SAASG,2BAA2BJ,GAAAA,GAAM,MAAM,qBAAqBJ,UAAAA,gCAA0C;AAEtI,QAAIS,YAAYZ,wBAAwBE,OAAOI,OAAO;AACtD,QAAIM,cAAcC,QAAW;AAC3BD,kBAAY,CAAC;AACbZ,8BAAwBE,OAAOI,OAAO,IAAIM;IAC5C;AAEAA,cAAUT,UAAAA,IAAcO;AACxB,WAAOA;EACT,CAAA;AACF,GAhBI;AAkBG,IAAMI,6BAET,8BAAO,EAAEZ,QAAQC,WAAU,MAAE;AAC/B,SAAOK,SACLO,8BAA8B,MAAMd,kBAAkB;IAAEC;IAAQC;EAAW,CAAA,CAAA,GAC3E,MAAM,qBAAqBA,UAAAA,mCAA6C;AAE5E,GALI;","names":["ArchivistSyncDiviner","DivinerConfigSchema","MemoryNode","MemorySentinel","SentinelConfigSchema","initArchivistSync","name","inArchivist","outArchivist","frequency","max","traceProvider","node","MemoryNode","create","account","finalizedArchivistSyncDiviner","ArchivistSyncDiviner","config","schema","DivinerConfigSchema","register","attach","address","sentinel","MemorySentinel","synchronous","SentinelConfigSchema","tasks","required","mod","endPoint","automations","frequencyUnits","start","Date","now","type","MemoryArchivist","MemoryArchivistConfigSchema","DefaultReadCachingArchivistConfig","max","schema","MemoryArchivistConfigSchema","getDynamicDefaultReadCachingArchivistConfig","archivist","id","name","dynamicDefaults","getDynamicReadCachingArchivistConfig","_archivist","dynamicConfig","wrapWithReadCachingArchivist","config","dynamicDefaultReadCachingArchivistConfig","dynamicReadCachingArchivistConfig","materializedConfig","cachingArchivist","MemoryArchivist","create","account","initArchivistSync","HttpBridge","HttpBridgeConfigSchema","Mutex","initMutex","Mutex","bridgeSingletonMap","Map","initBridge","nodeUrl","runExclusive","existing","get","bridge","HttpBridge","create","account","config","name","client","url","discoverRoots","schema","HttpBridgeConfigSchema","security","allowAnonymous","start","set","assertEx","asAttachableArchivistInstance","asAttachableModuleInstance","Mutex","initMutex","Mutex","bridgedModuleDictionary","initBridgedModule","bridge","moduleName","runExclusive","existing","address","mod","assertEx","resolve","moduleInstance","asAttachableModuleInstance","moduleMap","undefined","initBridgedArchivistModule","asAttachableArchivistInstance"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@xyo-network/chain-orchestration",
|
|
4
|
-
"version": "1.16.
|
|
4
|
+
"version": "1.16.10",
|
|
5
5
|
"description": "XYO Layer One SDK Orchestration",
|
|
6
6
|
"homepage": "https://xylabs.com",
|
|
7
7
|
"bugs": {
|
|
@@ -37,24 +37,24 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@opentelemetry/api": "~1.9.0",
|
|
40
|
-
"@xylabs/assert": "~5.0.
|
|
41
|
-
"@xylabs/logger": "~5.0.
|
|
40
|
+
"@xylabs/assert": "~5.0.25",
|
|
41
|
+
"@xylabs/logger": "~5.0.25",
|
|
42
42
|
"@xyo-network/archivist-memory": "~5.1.21",
|
|
43
43
|
"@xyo-network/archivist-model": "~5.1.21",
|
|
44
44
|
"@xyo-network/bridge-http": "~5.1.21",
|
|
45
45
|
"@xyo-network/bridge-model": "~5.1.21",
|
|
46
|
-
"@xyo-network/chain-modules": "~1.16.
|
|
46
|
+
"@xyo-network/chain-modules": "~1.16.10",
|
|
47
47
|
"@xyo-network/diviner-model": "~5.1.21",
|
|
48
48
|
"@xyo-network/module-model": "~5.1.21",
|
|
49
49
|
"@xyo-network/node-memory": "~5.1.21",
|
|
50
50
|
"@xyo-network/sentinel-memory": "~5.1.21",
|
|
51
51
|
"@xyo-network/sentinel-model": "~5.1.21",
|
|
52
|
-
"@xyo-network/xl1-protocol": "~1.13.
|
|
52
|
+
"@xyo-network/xl1-protocol": "~1.13.11",
|
|
53
53
|
"async-mutex": "~0.5.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/node": "~24.10.1",
|
|
57
|
-
"@xylabs/hex": "~5.0.
|
|
57
|
+
"@xylabs/hex": "~5.0.25",
|
|
58
58
|
"@xylabs/ts-scripts-yarn3": "~7.2.8",
|
|
59
59
|
"@xylabs/tsconfig": "~7.2.8",
|
|
60
60
|
"eslint": "^9.39.1",
|
package/src/initBridgedModule.ts
CHANGED
|
@@ -20,8 +20,8 @@ export const initBridgedModule: Initializable<
|
|
|
20
20
|
return await initMutex.runExclusive(async () => {
|
|
21
21
|
const existing = bridgedModuleDictionary?.[bridge.address]?.[moduleName]
|
|
22
22
|
if (existing) return existing
|
|
23
|
-
const mod = assertEx(await bridge.resolve(moduleName), () => `
|
|
24
|
-
const moduleInstance = assertEx(asAttachableModuleInstance(mod), () => `
|
|
23
|
+
const mod = assertEx(await bridge.resolve(moduleName), () => `Could not resolve ${moduleName}`)
|
|
24
|
+
const moduleInstance = assertEx(asAttachableModuleInstance(mod), () => `Could not convert ${moduleName} to attachable module instance`)
|
|
25
25
|
// Initialize the nested dictionary if needed
|
|
26
26
|
let moduleMap = bridgedModuleDictionary[bridge.address]
|
|
27
27
|
if (moduleMap === undefined) {
|
|
@@ -39,6 +39,6 @@ export const initBridgedArchivistModule: Initializable<
|
|
|
39
39
|
> = async ({ bridge, moduleName }): Promise<AttachableArchivistInstance> => {
|
|
40
40
|
return assertEx(
|
|
41
41
|
asAttachableArchivistInstance(await initBridgedModule({ bridge, moduleName })),
|
|
42
|
-
() => `
|
|
42
|
+
() => `Could not convert ${moduleName} to attachable archivist instance`,
|
|
43
43
|
)
|
|
44
44
|
}
|