@xyo-network/sdk 7.4.1 → 8.0.0
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/api-location-diviner.mjs +1 -1
- package/dist/neutral/api-location-diviner.mjs.map +2 -2
- package/dist/neutral/archivist-abstract.mjs +34 -28
- package/dist/neutral/archivist-abstract.mjs.map +2 -2
- package/dist/neutral/archivist-generic.mjs +5 -3
- package/dist/neutral/archivist-generic.mjs.map +2 -2
- package/dist/neutral/archivist-memory.mjs +6 -5
- package/dist/neutral/archivist-memory.mjs.map +2 -2
- package/dist/neutral/archivist-model.mjs +14 -7
- package/dist/neutral/archivist-model.mjs.map +2 -2
- package/dist/neutral/archivist-view.mjs +5 -3
- package/dist/neutral/archivist-view.mjs.map +2 -2
- package/dist/neutral/archivist-wrapper.mjs +22 -4
- package/dist/neutral/archivist-wrapper.mjs.map +2 -2
- package/dist/neutral/boundwitness-loader.mjs +13 -7
- package/dist/neutral/boundwitness-loader.mjs.map +2 -2
- package/dist/neutral/bridge-abstract.mjs +43 -29
- package/dist/neutral/bridge-abstract.mjs.map +2 -2
- package/dist/neutral/bridge-http.mjs +23 -20
- package/dist/neutral/bridge-http.mjs.map +2 -2
- package/dist/neutral/bridge-model.mjs +4 -2
- package/dist/neutral/bridge-model.mjs.map +2 -2
- package/dist/neutral/bridge-wrapper.mjs +22 -5
- package/dist/neutral/bridge-wrapper.mjs.map +2 -2
- package/dist/neutral/bridge.mjs.map +2 -2
- package/dist/neutral/diviner-abstract.mjs +4 -3
- package/dist/neutral/diviner-abstract.mjs.map +2 -2
- package/dist/neutral/diviner-boundwitness.memory.mjs +4 -5
- package/dist/neutral/diviner-boundwitness.memory.mjs.map +2 -2
- package/dist/neutral/diviner-boundwitness.mjs +4 -5
- package/dist/neutral/diviner-boundwitness.mjs.map +2 -2
- package/dist/neutral/diviner-model.mjs +4 -2
- package/dist/neutral/diviner-model.mjs.map +2 -2
- package/dist/neutral/diviner-payload-generic.mjs +13 -16
- package/dist/neutral/diviner-payload-generic.mjs.map +2 -2
- package/dist/neutral/diviner-wrapper.mjs +22 -4
- package/dist/neutral/diviner-wrapper.mjs.map +2 -2
- package/dist/neutral/manifest-wrapper.mjs +4 -2
- package/dist/neutral/manifest-wrapper.mjs.map +2 -2
- package/dist/neutral/module-abstract.mjs +100 -106
- package/dist/neutral/module-abstract.mjs.map +3 -3
- package/dist/neutral/module-factory-locator.mjs +4 -2
- package/dist/neutral/module-factory-locator.mjs.map +2 -2
- package/dist/neutral/module-model.mjs +18 -1
- package/dist/neutral/module-model.mjs.map +2 -2
- package/dist/neutral/module-resolver.mjs +88 -81
- package/dist/neutral/module-resolver.mjs.map +3 -3
- package/dist/neutral/module-wrapper.mjs +18 -10
- package/dist/neutral/module-wrapper.mjs.map +2 -2
- package/dist/neutral/modules/api-location-diviner/LocationDiviner/LocationDivinerApi.d.ts +5 -3
- package/dist/neutral/modules/api-location-diviner/LocationDiviner/LocationDivinerApi.d.ts.map +1 -1
- package/dist/neutral/modules/api-location-diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts +7 -3
- package/dist/neutral/modules/api-location-diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts.map +1 -1
- package/dist/neutral/modules/api-location-diviner/RemoteDivinerConfig.d.ts +1 -2
- package/dist/neutral/modules/api-location-diviner/RemoteDivinerConfig.d.ts.map +1 -1
- package/dist/neutral/modules/archivist-abstract/AbstractArchivist.d.ts.map +1 -1
- package/dist/neutral/modules/archivist-abstract/payloadAdmission.d.ts.map +1 -1
- package/dist/neutral/modules/archivist-generic/Archivist.d.ts.map +1 -1
- package/dist/neutral/modules/archivist-memory/MemoryDriver.d.ts.map +1 -1
- package/dist/neutral/modules/archivist-model/lib/getBoundWitness.d.ts.map +1 -1
- package/dist/neutral/modules/archivist-model/lib/hydrateBoundWitness.d.ts.map +1 -1
- package/dist/neutral/modules/archivist-model/typeChecks.d.ts.map +1 -1
- package/dist/neutral/modules/archivist-view/ViewArchivist.d.ts.map +1 -1
- package/dist/neutral/modules/archivist-wrapper/ArchivistWrapper.d.ts.map +1 -1
- package/dist/neutral/modules/boundwitness-loader/Loader.d.ts.map +1 -1
- package/dist/neutral/modules/bridge/index.d.ts +3 -0
- package/dist/neutral/modules/bridge/index.d.ts.map +1 -1
- package/dist/neutral/modules/bridge/model.d.ts +1 -0
- package/dist/neutral/modules/bridge/model.d.ts.map +1 -1
- package/dist/neutral/modules/bridge/wrapper.d.ts +1 -0
- package/dist/neutral/modules/bridge/wrapper.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-abstract/AbstractBridge.d.ts +1 -0
- package/dist/neutral/modules/bridge-abstract/AbstractBridge.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-abstract/AbstractBridgeModuleResolver.d.ts +2 -0
- package/dist/neutral/modules/bridge-abstract/AbstractBridgeModuleResolver.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-abstract/AbstractModuleProxy/AbstractModuleProxy.d.ts +2 -0
- package/dist/neutral/modules/bridge-abstract/AbstractModuleProxy/AbstractModuleProxy.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-abstract/AbstractModuleProxy/ModuleProxyResolver.d.ts +2 -0
- package/dist/neutral/modules/bridge-abstract/AbstractModuleProxy/ModuleProxyResolver.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-abstract/index.d.ts +4 -0
- package/dist/neutral/modules/bridge-abstract/index.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-abstract/wrapModuleWithType.d.ts +1 -0
- package/dist/neutral/modules/bridge-abstract/wrapModuleWithType.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-http/HttpBridge.d.ts +2 -0
- package/dist/neutral/modules/bridge-http/HttpBridge.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-http/HttpBridgeConfig.d.ts +8 -0
- package/dist/neutral/modules/bridge-http/HttpBridgeConfig.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-http/HttpBridgeModuleResolver.d.ts +4 -2
- package/dist/neutral/modules/bridge-http/HttpBridgeModuleResolver.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-http/ModuleProxy/ModuleProxy.d.ts +3 -0
- package/dist/neutral/modules/bridge-http/ModuleProxy/ModuleProxy.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-http/ModuleProxy/index.d.ts +1 -0
- package/dist/neutral/modules/bridge-http/ModuleProxy/index.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-http/index.d.ts +2 -0
- package/dist/neutral/modules/bridge-http/index.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/Config.d.ts +10 -0
- package/dist/neutral/modules/bridge-model/Config.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/EventData.d.ts +1 -0
- package/dist/neutral/modules/bridge-model/EventData.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/Events/Exposed.d.ts +2 -0
- package/dist/neutral/modules/bridge-model/Events/Exposed.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/Events/QueryFulfillFinished.d.ts +2 -0
- package/dist/neutral/modules/bridge-model/Events/QueryFulfillFinished.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/Events/QueryFulfillStarted.d.ts +2 -0
- package/dist/neutral/modules/bridge-model/Events/QueryFulfillStarted.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/Events/QuerySendFinished.d.ts +2 -0
- package/dist/neutral/modules/bridge-model/Events/QuerySendFinished.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/Events/QuerySendStarted.d.ts +2 -0
- package/dist/neutral/modules/bridge-model/Events/QuerySendStarted.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/Events/Unexposed.d.ts +2 -0
- package/dist/neutral/modules/bridge-model/Events/Unexposed.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/Instance.d.ts +1 -0
- package/dist/neutral/modules/bridge-model/Instance.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/Module.d.ts +1 -0
- package/dist/neutral/modules/bridge-model/Module.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/Params.d.ts +1 -0
- package/dist/neutral/modules/bridge-model/Params.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/Queries/Connect.d.ts +7 -0
- package/dist/neutral/modules/bridge-model/Queries/Connect.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/Queries/Disconnect.d.ts +7 -0
- package/dist/neutral/modules/bridge-model/Queries/Disconnect.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/Queries/Expose.d.ts +15 -0
- package/dist/neutral/modules/bridge-model/Queries/Expose.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/Queries/Unexpose.d.ts +8 -0
- package/dist/neutral/modules/bridge-model/Queries/Unexpose.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/Queries/index.d.ts +2 -0
- package/dist/neutral/modules/bridge-model/Queries/index.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/QueryFunctions.d.ts +1 -0
- package/dist/neutral/modules/bridge-model/QueryFunctions.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/RawQueryFunctions.d.ts +1 -0
- package/dist/neutral/modules/bridge-model/RawQueryFunctions.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/attachable/AttachableInstance.d.ts +3 -0
- package/dist/neutral/modules/bridge-model/attachable/AttachableInstance.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/attachable/asAttachableInstance.d.ts +1 -0
- package/dist/neutral/modules/bridge-model/attachable/asAttachableInstance.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/attachable/isAttachableInstance.d.ts +2 -0
- package/dist/neutral/modules/bridge-model/attachable/isAttachableInstance.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/index.d.ts +1 -0
- package/dist/neutral/modules/bridge-model/index.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-model/typeChecks.d.ts +12 -2
- package/dist/neutral/modules/bridge-model/typeChecks.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-wrapper/BridgeWrapper.d.ts +1 -0
- package/dist/neutral/modules/bridge-wrapper/BridgeWrapper.d.ts.map +1 -1
- package/dist/neutral/modules/bridge-wrapper/index.d.ts +1 -0
- package/dist/neutral/modules/bridge-wrapper/index.d.ts.map +1 -1
- package/dist/neutral/modules/diviner-abstract/AbstractDiviner.d.ts.map +1 -1
- package/dist/neutral/modules/diviner-boundwitness/MemoryBoundWitnessDiviner.d.ts.map +1 -1
- package/dist/neutral/modules/diviner-model/typeChecks.d.ts.map +1 -1
- package/dist/neutral/modules/diviner-payload-generic/Diviner.d.ts.map +1 -1
- package/dist/neutral/modules/diviner-wrapper/DivinerWrapper.d.ts.map +1 -1
- package/dist/neutral/modules/manifest-wrapper/Wrapper.d.ts.map +1 -1
- package/dist/neutral/modules/manifest-wrapper/WrapperEx.d.ts.map +1 -1
- package/dist/neutral/modules/module-abstract/AbstractModule.d.ts +1 -4
- package/dist/neutral/modules/module-abstract/AbstractModule.d.ts.map +1 -1
- package/dist/neutral/modules/module-abstract/AbstractModuleInstance.d.ts.map +1 -1
- package/dist/neutral/modules/module-abstract/Error.d.ts +1 -4
- package/dist/neutral/modules/module-abstract/Error.d.ts.map +1 -1
- package/dist/neutral/modules/module-abstract/QueryValidator/ModuleConfigQueryValidator.d.ts.map +1 -1
- package/dist/neutral/modules/module-factory-locator/ModuleFactoryLocator.d.ts.map +1 -1
- package/dist/neutral/modules/module-factory-locator/standardCreatableFactories.d.ts.map +1 -1
- package/dist/neutral/modules/module-model/QueryableModule/IsQueryableModuleFactory.d.ts.map +1 -1
- package/dist/neutral/modules/module-resolver/CompositeModuleResolver.d.ts.map +1 -1
- package/dist/neutral/modules/module-resolver/ResolveHelper/ResolveHelper.d.ts.map +1 -1
- package/dist/neutral/modules/module-resolver/ResolveHelper/resolveAll.d.ts.map +1 -1
- package/dist/neutral/modules/module-resolver/ResolveHelper/resolveLocalNameToAddress.d.ts.map +1 -1
- package/dist/neutral/modules/module-resolver/ResolveHelper/resolvePathToAddress.d.ts.map +1 -1
- package/dist/neutral/modules/module-resolver/SimpleModuleResolver.d.ts.map +1 -1
- package/dist/neutral/modules/module-wrapper/ModuleWrapper.d.ts +7 -1
- package/dist/neutral/modules/module-wrapper/ModuleWrapper.d.ts.map +1 -1
- package/dist/neutral/modules/modules/index.d.ts +1 -0
- package/dist/neutral/modules/modules/index.d.ts.map +1 -1
- package/dist/neutral/modules/node-abstract/AbstractNode.d.ts.map +1 -1
- package/dist/neutral/modules/node-memory/MemoryNode.d.ts.map +1 -1
- package/dist/neutral/modules/node-memory/NodeHelper/attachToExistingNode.d.ts.map +1 -1
- package/dist/neutral/modules/node-memory/NodeHelper/flatAttachToExistingNode.d.ts.map +1 -1
- package/dist/neutral/modules/node-model/typeChecks.d.ts.map +1 -1
- package/dist/neutral/modules/node-view/ViewNode.d.ts.map +1 -1
- package/dist/neutral/modules/node-wrapper/NodeWrapper.d.ts.map +1 -1
- package/dist/neutral/modules/payloadset-plugin/Resolver.d.ts.map +1 -1
- package/dist/neutral/modules/sentinel-abstract/AbstractSentinel.d.ts.map +1 -1
- package/dist/neutral/modules/sentinel-memory/MemorySentinel.d.ts.map +1 -1
- package/dist/neutral/modules/sentinel-memory/SentinelRunner.d.ts.map +1 -1
- package/dist/neutral/modules/sentinel-model/typeChecks.d.ts.map +1 -1
- package/dist/neutral/modules/sentinel-wrapper/Wrapper.d.ts.map +1 -1
- package/dist/neutral/modules/witness-abstract/AbstractWitness.d.ts.map +1 -1
- package/dist/neutral/modules/witness-model/typeChecks.d.ts.map +1 -1
- package/dist/neutral/modules/witness-wrapper/WitnessWrapper.d.ts.map +1 -1
- package/dist/neutral/modules.mjs.map +2 -2
- package/dist/neutral/node-abstract.mjs +22 -10
- package/dist/neutral/node-abstract.mjs.map +2 -2
- package/dist/neutral/node-memory.mjs +14 -13
- package/dist/neutral/node-memory.mjs.map +2 -2
- package/dist/neutral/node-model.mjs +2 -1
- package/dist/neutral/node-model.mjs.map +2 -2
- package/dist/neutral/node-view.mjs +13 -11
- package/dist/neutral/node-view.mjs.map +2 -2
- package/dist/neutral/node-wrapper.mjs +35 -11
- package/dist/neutral/node-wrapper.mjs.map +2 -2
- package/dist/neutral/payloadset-plugin.mjs +11 -10
- package/dist/neutral/payloadset-plugin.mjs.map +2 -2
- package/dist/neutral/sentinel-abstract.mjs +7 -6
- package/dist/neutral/sentinel-abstract.mjs.map +2 -2
- package/dist/neutral/sentinel-memory.mjs +28 -22
- package/dist/neutral/sentinel-memory.mjs.map +2 -2
- package/dist/neutral/sentinel-model.mjs +4 -2
- package/dist/neutral/sentinel-model.mjs.map +2 -2
- package/dist/neutral/sentinel-wrapper.mjs +22 -4
- package/dist/neutral/sentinel-wrapper.mjs.map +2 -2
- package/dist/neutral/witness-abstract.mjs +4 -3
- package/dist/neutral/witness-abstract.mjs.map +2 -2
- package/dist/neutral/witness-model.mjs +4 -2
- package/dist/neutral/witness-model.mjs.map +2 -2
- package/dist/neutral/witness-wrapper.mjs +22 -4
- package/dist/neutral/witness-wrapper.mjs.map +2 -2
- package/dist/node/modules/api-location-diviner/LocationDiviner/LocationDivinerApi.d.ts +5 -3
- package/dist/node/modules/api-location-diviner/LocationDiviner/LocationDivinerApi.d.ts.map +1 -1
- package/dist/node/modules/api-location-diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts +7 -3
- package/dist/node/modules/api-location-diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts.map +1 -1
- package/dist/node/modules/api-location-diviner/RemoteDivinerConfig.d.ts +1 -2
- package/dist/node/modules/api-location-diviner/RemoteDivinerConfig.d.ts.map +1 -1
- package/dist/node/modules/archivist-abstract/AbstractArchivist.d.ts.map +1 -1
- package/dist/node/modules/archivist-abstract/payloadAdmission.d.ts.map +1 -1
- package/dist/node/modules/archivist-generic/Archivist.d.ts.map +1 -1
- package/dist/node/modules/archivist-memory/MemoryDriver.d.ts.map +1 -1
- package/dist/node/modules/archivist-model/lib/getBoundWitness.d.ts.map +1 -1
- package/dist/node/modules/archivist-model/lib/hydrateBoundWitness.d.ts.map +1 -1
- package/dist/node/modules/archivist-model/typeChecks.d.ts.map +1 -1
- package/dist/node/modules/archivist-view/ViewArchivist.d.ts.map +1 -1
- package/dist/node/modules/archivist-wrapper/ArchivistWrapper.d.ts.map +1 -1
- package/dist/node/modules/boundwitness-loader/Loader.d.ts.map +1 -1
- package/dist/node/modules/bridge/index.d.ts +3 -0
- package/dist/node/modules/bridge/index.d.ts.map +1 -1
- package/dist/node/modules/bridge/model.d.ts +1 -0
- package/dist/node/modules/bridge/model.d.ts.map +1 -1
- package/dist/node/modules/bridge/wrapper.d.ts +1 -0
- package/dist/node/modules/bridge/wrapper.d.ts.map +1 -1
- package/dist/node/modules/bridge-abstract/AbstractBridge.d.ts +1 -0
- package/dist/node/modules/bridge-abstract/AbstractBridge.d.ts.map +1 -1
- package/dist/node/modules/bridge-abstract/AbstractBridgeModuleResolver.d.ts +2 -0
- package/dist/node/modules/bridge-abstract/AbstractBridgeModuleResolver.d.ts.map +1 -1
- package/dist/node/modules/bridge-abstract/AbstractModuleProxy/AbstractModuleProxy.d.ts +2 -0
- package/dist/node/modules/bridge-abstract/AbstractModuleProxy/AbstractModuleProxy.d.ts.map +1 -1
- package/dist/node/modules/bridge-abstract/AbstractModuleProxy/ModuleProxyResolver.d.ts +2 -0
- package/dist/node/modules/bridge-abstract/AbstractModuleProxy/ModuleProxyResolver.d.ts.map +1 -1
- package/dist/node/modules/bridge-abstract/index.d.ts +4 -0
- package/dist/node/modules/bridge-abstract/index.d.ts.map +1 -1
- package/dist/node/modules/bridge-abstract/wrapModuleWithType.d.ts +1 -0
- package/dist/node/modules/bridge-abstract/wrapModuleWithType.d.ts.map +1 -1
- package/dist/node/modules/bridge-http/HttpBridge.d.ts +2 -0
- package/dist/node/modules/bridge-http/HttpBridge.d.ts.map +1 -1
- package/dist/node/modules/bridge-http/HttpBridgeConfig.d.ts +8 -0
- package/dist/node/modules/bridge-http/HttpBridgeConfig.d.ts.map +1 -1
- package/dist/node/modules/bridge-http/HttpBridgeModuleResolver.d.ts +4 -2
- package/dist/node/modules/bridge-http/HttpBridgeModuleResolver.d.ts.map +1 -1
- package/dist/node/modules/bridge-http/ModuleProxy/ModuleProxy.d.ts +3 -0
- package/dist/node/modules/bridge-http/ModuleProxy/ModuleProxy.d.ts.map +1 -1
- package/dist/node/modules/bridge-http/ModuleProxy/index.d.ts +1 -0
- package/dist/node/modules/bridge-http/ModuleProxy/index.d.ts.map +1 -1
- package/dist/node/modules/bridge-http/index.d.ts +2 -0
- package/dist/node/modules/bridge-http/index.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/Config.d.ts +10 -0
- package/dist/node/modules/bridge-model/Config.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/EventData.d.ts +1 -0
- package/dist/node/modules/bridge-model/EventData.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/Events/Exposed.d.ts +2 -0
- package/dist/node/modules/bridge-model/Events/Exposed.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/Events/QueryFulfillFinished.d.ts +2 -0
- package/dist/node/modules/bridge-model/Events/QueryFulfillFinished.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/Events/QueryFulfillStarted.d.ts +2 -0
- package/dist/node/modules/bridge-model/Events/QueryFulfillStarted.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/Events/QuerySendFinished.d.ts +2 -0
- package/dist/node/modules/bridge-model/Events/QuerySendFinished.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/Events/QuerySendStarted.d.ts +2 -0
- package/dist/node/modules/bridge-model/Events/QuerySendStarted.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/Events/Unexposed.d.ts +2 -0
- package/dist/node/modules/bridge-model/Events/Unexposed.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/Instance.d.ts +1 -0
- package/dist/node/modules/bridge-model/Instance.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/Module.d.ts +1 -0
- package/dist/node/modules/bridge-model/Module.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/Params.d.ts +1 -0
- package/dist/node/modules/bridge-model/Params.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/Queries/Connect.d.ts +7 -0
- package/dist/node/modules/bridge-model/Queries/Connect.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/Queries/Disconnect.d.ts +7 -0
- package/dist/node/modules/bridge-model/Queries/Disconnect.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/Queries/Expose.d.ts +15 -0
- package/dist/node/modules/bridge-model/Queries/Expose.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/Queries/Unexpose.d.ts +8 -0
- package/dist/node/modules/bridge-model/Queries/Unexpose.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/Queries/index.d.ts +2 -0
- package/dist/node/modules/bridge-model/Queries/index.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/QueryFunctions.d.ts +1 -0
- package/dist/node/modules/bridge-model/QueryFunctions.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/RawQueryFunctions.d.ts +1 -0
- package/dist/node/modules/bridge-model/RawQueryFunctions.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/attachable/AttachableInstance.d.ts +3 -0
- package/dist/node/modules/bridge-model/attachable/AttachableInstance.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/attachable/asAttachableInstance.d.ts +1 -0
- package/dist/node/modules/bridge-model/attachable/asAttachableInstance.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/attachable/isAttachableInstance.d.ts +2 -0
- package/dist/node/modules/bridge-model/attachable/isAttachableInstance.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/index.d.ts +1 -0
- package/dist/node/modules/bridge-model/index.d.ts.map +1 -1
- package/dist/node/modules/bridge-model/typeChecks.d.ts +12 -2
- package/dist/node/modules/bridge-model/typeChecks.d.ts.map +1 -1
- package/dist/node/modules/bridge-wrapper/BridgeWrapper.d.ts +1 -0
- package/dist/node/modules/bridge-wrapper/BridgeWrapper.d.ts.map +1 -1
- package/dist/node/modules/bridge-wrapper/index.d.ts +1 -0
- package/dist/node/modules/bridge-wrapper/index.d.ts.map +1 -1
- package/dist/node/modules/diviner-abstract/AbstractDiviner.d.ts.map +1 -1
- package/dist/node/modules/diviner-boundwitness/MemoryBoundWitnessDiviner.d.ts.map +1 -1
- package/dist/node/modules/diviner-model/typeChecks.d.ts.map +1 -1
- package/dist/node/modules/diviner-payload-generic/Diviner.d.ts.map +1 -1
- package/dist/node/modules/diviner-wrapper/DivinerWrapper.d.ts.map +1 -1
- package/dist/node/modules/manifest-wrapper/Wrapper.d.ts.map +1 -1
- package/dist/node/modules/manifest-wrapper/WrapperEx.d.ts.map +1 -1
- package/dist/node/modules/module-abstract/AbstractModule.d.ts +1 -4
- package/dist/node/modules/module-abstract/AbstractModule.d.ts.map +1 -1
- package/dist/node/modules/module-abstract/AbstractModuleInstance.d.ts.map +1 -1
- package/dist/node/modules/module-abstract/Error.d.ts +1 -4
- package/dist/node/modules/module-abstract/Error.d.ts.map +1 -1
- package/dist/node/modules/module-abstract/QueryValidator/ModuleConfigQueryValidator.d.ts.map +1 -1
- package/dist/node/modules/module-factory-locator/ModuleFactoryLocator.d.ts.map +1 -1
- package/dist/node/modules/module-factory-locator/standardCreatableFactories.d.ts.map +1 -1
- package/dist/node/modules/module-model/QueryableModule/IsQueryableModuleFactory.d.ts.map +1 -1
- package/dist/node/modules/module-resolver/CompositeModuleResolver.d.ts.map +1 -1
- package/dist/node/modules/module-resolver/ResolveHelper/ResolveHelper.d.ts.map +1 -1
- package/dist/node/modules/module-resolver/ResolveHelper/resolveAll.d.ts.map +1 -1
- package/dist/node/modules/module-resolver/ResolveHelper/resolveLocalNameToAddress.d.ts.map +1 -1
- package/dist/node/modules/module-resolver/ResolveHelper/resolvePathToAddress.d.ts.map +1 -1
- package/dist/node/modules/module-resolver/SimpleModuleResolver.d.ts.map +1 -1
- package/dist/node/modules/module-wrapper/ModuleWrapper.d.ts +7 -1
- package/dist/node/modules/module-wrapper/ModuleWrapper.d.ts.map +1 -1
- package/dist/node/modules/modules/index.d.ts +1 -0
- package/dist/node/modules/modules/index.d.ts.map +1 -1
- package/dist/node/modules/node-abstract/AbstractNode.d.ts.map +1 -1
- package/dist/node/modules/node-memory/MemoryNode.d.ts.map +1 -1
- package/dist/node/modules/node-memory/NodeHelper/attachToExistingNode.d.ts.map +1 -1
- package/dist/node/modules/node-memory/NodeHelper/flatAttachToExistingNode.d.ts.map +1 -1
- package/dist/node/modules/node-model/typeChecks.d.ts.map +1 -1
- package/dist/node/modules/node-view/ViewNode.d.ts.map +1 -1
- package/dist/node/modules/node-wrapper/NodeWrapper.d.ts.map +1 -1
- package/dist/node/modules/payloadset-plugin/Resolver.d.ts.map +1 -1
- package/dist/node/modules/sentinel-abstract/AbstractSentinel.d.ts.map +1 -1
- package/dist/node/modules/sentinel-memory/MemorySentinel.d.ts.map +1 -1
- package/dist/node/modules/sentinel-memory/SentinelRunner.d.ts.map +1 -1
- package/dist/node/modules/sentinel-model/typeChecks.d.ts.map +1 -1
- package/dist/node/modules/sentinel-wrapper/Wrapper.d.ts.map +1 -1
- package/dist/node/modules/witness-abstract/AbstractWitness.d.ts.map +1 -1
- package/dist/node/modules/witness-model/typeChecks.d.ts.map +1 -1
- package/dist/node/modules/witness-wrapper/WitnessWrapper.d.ts.map +1 -1
- package/package.json +13 -13
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/modules/diviner-boundwitness/BoundWitnessDiviner.ts", "../../src/modules/diviner-boundwitness/Config.ts", "../../src/modules/diviner-boundwitness/Schema.ts", "../../src/modules/diviner-boundwitness/applyBoundWitnessDivinerQueryPayload.ts", "../../src/modules/diviner-boundwitness/MemoryBoundWitnessDiviner.ts", "../../src/modules/diviner-boundwitness/Query.ts"],
|
|
4
|
-
"sourcesContent": ["import type { BoundWitness, Schema } from '@xyo-network/sdk-protocol'\n\nimport { AbstractDiviner } from '#diviner-abstract'\nimport type { DivinerInstance, DivinerModuleEventData } from '#diviner-model'\n\nimport { BoundWitnessDivinerConfigSchema } from './Config.ts'\nimport type { BoundWitnessDivinerParams } from './Params.ts'\nimport type { BoundWitnessDivinerQueryPayload } from './Query.ts'\n\nexport abstract class BoundWitnessDiviner<\n TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams,\n TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload,\n TOut extends BoundWitness = BoundWitness,\n TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n> extends AbstractDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, BoundWitnessDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = BoundWitnessDivinerConfigSchema\n}\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport { asSchema, type Payload } from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { DivinerConfig } from '#diviner-model'\nimport { DivinerConfigZod } from '#diviner-model'\n\nimport { BoundWitnessDivinerSchema } from './Schema.ts'\n\nexport const BoundWitnessDivinerConfigSchema: string & {\n readonly __schema: true\n} = asSchema(`${BoundWitnessDivinerSchema}.config`, true)\nexport type BoundWitnessDivinerConfigSchema = typeof BoundWitnessDivinerConfigSchema\n\nexport const BoundWitnessDivinerConfigZod: z.ZodMiniObject<\n Omit<(typeof DivinerConfigZod)['shape'], 'schema'> & {\n schema: z.ZodMiniLiteral<BoundWitnessDivinerConfigSchema>\n },\n z.core.$strip\n> = z.extend(DivinerConfigZod, { schema: z.literal(BoundWitnessDivinerConfigSchema) })\n\nexport type BoundWitnessDivinerConfigBase = z.infer<typeof BoundWitnessDivinerConfigZod>\n\nexport const isBoundWitnessDivinerConfig: ReturnType<typeof zodIsFactory<BoundWitnessDivinerConfigBase>> = zodIsFactory(BoundWitnessDivinerConfigZod)\nexport const asBoundWitnessDivinerConfig: ReturnType<typeof zodAsFactory<BoundWitnessDivinerConfigBase>> = zodAsFactory(BoundWitnessDivinerConfigZod, 'asBoundWitnessDivinerConfig')\nexport const toBoundWitnessDivinerConfig: ReturnType<typeof zodToFactory<BoundWitnessDivinerConfigBase>> = zodToFactory(BoundWitnessDivinerConfigZod, 'toBoundWitnessDivinerConfig')\n\nexport type BoundWitnessDivinerConfig<T extends Payload = Payload> = DivinerConfig<\n T & {\n schema: BoundWitnessDivinerConfigSchema\n }\n>\n", "import { asSchema } from '@xyo-network/sdk-protocol'\n\nexport const BoundWitnessDivinerSchema: 'network.xyo.diviner.boundwitness' & {\n readonly __schema: true\n} = asSchema('network.xyo.diviner.boundwitness', true)\nexport type BoundWitnessDivinerSchema = typeof BoundWitnessDivinerSchema\n", "import {\n assertEx, containsAll,\n exists, hexFromHexString,\n} from '@ariestools/sdk'\nimport type {\n BoundWitness, Payload, WithStorageMeta,\n} from '@xyo-network/sdk-protocol'\nimport {\n isBoundWitness, PayloadBuilder, SequenceConstants,\n} from '@xyo-network/sdk-protocol'\n\nimport type { BoundWitnessDivinerQueryPayload } from './Query.ts'\n\n// eslint-disable-next-line complexity\nexport const applyBoundWitnessDivinerQueryPayload = (filter?: BoundWitnessDivinerQueryPayload, payloads: WithStorageMeta<Payload>[] = []): BoundWitness[] => {\n if (!filter) return []\n const {\n addresses, cursor, destination, limit, order = 'desc', payload_hashes, payload_schemas, sourceQuery,\n } = filter\n\n const sortedPayloads = PayloadBuilder.sortByStorageMeta(payloads, order === 'desc' ? -1 : 1)\n const parsedCursor = cursor ?? ((order === 'desc') ? SequenceConstants.maxLocalSequence : SequenceConstants.minLocalSequence)\n const parsedOffset = (order === 'desc')\n ? sortedPayloads.findIndex(bw => bw._sequence < parsedCursor)\n : sortedPayloads.findIndex(bw => bw._sequence > parsedCursor)\n if (parsedOffset === -1) return []\n const payloadSubset = sortedPayloads.slice(parsedOffset)\n\n let bws = payloadSubset.filter(isBoundWitness)\n const allAddresses = addresses?.map(address => hexFromHexString(address)).filter(exists)\n if (allAddresses?.length) bws = bws.filter(bw => containsAll<string>(bw.addresses, allAddresses))\n if (payload_hashes?.length) bws = bws.filter(bw => containsAll(bw.payload_hashes, payload_hashes))\n if (payload_schemas?.length) bws = bws.filter(bw => containsAll(bw.payload_schemas, payload_schemas))\n if (sourceQuery) bws = bws.filter(bw => bw?.$sourceQuery === sourceQuery)\n // If there's a destination filter of the right kind\n if (destination && Array.isArray(destination) && destination?.length > 0) {\n const targetFilter = assertEx(destination, () => 'Missing destination')\n // Find all BWs that satisfy the destination constraint\n bws = bws.filter((bw) => {\n const targetDestinationField = (bw as { $destination?: string | string[] })?.$destination\n // If the destination field is an array and contains at least one element\n return targetDestinationField !== undefined && Array.isArray(targetDestinationField) && targetDestinationField.length > 0\n // Check that the targetDestinationField contains all the elements in the targetFilter\n ? containsAll(targetFilter, targetDestinationField ?? [])\n // Otherwise, filter it out\n : false\n })\n }\n const parsedLimit = limit ?? bws.length\n return bws.slice(0, parsedLimit)\n}\n", "import { assertEx } from '@ariestools/sdk'\nimport { type BoundWitness, isBoundWitness } from '@xyo-network/sdk-protocol'\nimport { isStorageMeta } from '@xyo-network/sdk-protocol'\n\nimport { applyBoundWitnessDivinerQueryPayload } from './applyBoundWitnessDivinerQueryPayload.ts'\nimport { BoundWitnessDiviner } from './BoundWitnessDiviner.ts'\nimport type { BoundWitnessDivinerParams } from './Params.ts'\nimport { type BoundWitnessDivinerQueryPayload, isBoundWitnessDivinerQueryPayload } from './Query.ts'\n\nexport interface EqualityComparisonOperators {\n /**\n * 'Not Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value does not match the provided string.\n * Example: field != 'value'\n */\n '!=': string\n\n /**\n * 'Less Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than the provided string.\n * Example: field < 'value'\n */\n '<': string\n\n /**\n * 'Less Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than or equal to the provided string.\n * Example: field <= 'value'\n */\n '<=': string\n\n /**\n * 'Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value matches the provided string exactly.\n * Example: field = 'value'\n */\n '=': string\n\n /**\n * 'Greater Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than the provided string.\n * Example: field > 'value'\n */\n '>': string\n\n /**\n * 'Greater Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than or equal to the provided string.\n * Example: field >= 'value'\n */\n '>=': string\n}\n\nexport class MemoryBoundWitnessDiviner<\n TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams,\n TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload,\n TOut extends BoundWitness = BoundWitness,\n> extends BoundWitnessDiviner<TParams, TIn, TOut> {\n protected override async divineHandler(payloads?: TIn[]): Promise<TOut[]> {\n const filter = assertEx(payloads?.filter(isBoundWitnessDivinerQueryPayload)?.pop(), () => 'Missing query payload')\n if (!filter) return []\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n const bws = ((await archivist?.next({ limit: 10_000 })) ?? []).filter(x => isBoundWitness(x) && isStorageMeta(x))\n return applyBoundWitnessDivinerQueryPayload(filter, bws) as TOut[]\n }\n}\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { BoundWitnessDivinerPredicate } from './Predicate.ts'\nimport { BoundWitnessDivinerSchema } from './Schema.ts'\n\nexport const BoundWitnessDivinerQuerySchema: string & {\n readonly __schema: true\n} = asSchema(`${BoundWitnessDivinerSchema}.query`, true)\nexport type BoundWitnessDivinerQuerySchema = typeof BoundWitnessDivinerQuerySchema\n\nexport const BoundWitnessDivinerQueryPayloadZod: z.ZodMiniIntersection<\n z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<BoundWitnessDivinerQuerySchema> }\n & (typeof QueryFieldsZod)['shape'],\n z.core.$strip\n >,\n z.ZodMiniCustom<BoundWitnessDivinerPredicate, BoundWitnessDivinerPredicate>\n> = z.intersection(\n z.extend(PayloadZodOfSchema(BoundWitnessDivinerQuerySchema), { ...QueryFieldsZod.shape }),\n z.custom<BoundWitnessDivinerPredicate>(),\n)\n\nexport type BoundWitnessDivinerQueryPayload = z.infer<typeof BoundWitnessDivinerQueryPayloadZod>\n\nexport const isBoundWitnessDivinerQueryPayload: ReturnType<typeof zodIsFactory<BoundWitnessDivinerQueryPayload>> = zodIsFactory(BoundWitnessDivinerQueryPayloadZod)\nexport const asBoundWitnessDivinerQueryPayload: ReturnType<typeof zodAsFactory<BoundWitnessDivinerQueryPayload>> = zodAsFactory(BoundWitnessDivinerQueryPayloadZod, 'asBoundWitnessDivinerQueryPayload')\nexport const toBoundWitnessDivinerQueryPayload: ReturnType<typeof zodToFactory<BoundWitnessDivinerQueryPayload>> = zodToFactory(BoundWitnessDivinerQueryPayloadZod, 'toBoundWitnessDivinerQueryPayload')\n"],
|
|
5
|
-
"mappings": ";AAEA,SAAS,uBAAuB;;;ACFhC;AAAA,EACE;AAAA,EAAc;AAAA,EAAc;AAAA,OACvB;AACP,SAAS,YAAAA,iBAA8B;AACvC,YAAY,OAAO;AAGnB,SAAS,wBAAwB;;;ACPjC,SAAS,gBAAgB;AAElB,IAAM,4BAET,SAAS,oCAAoC,IAAI;;;ADO9C,IAAM,kCAETC,UAAS,GAAG,yBAAyB,WAAW,IAAI;AAGjD,IAAM,+BAKP,SAAO,kBAAkB,EAAE,QAAU,UAAQ,+BAA+B,EAAE,CAAC;AAI9E,IAAM,8BAA8F,aAAa,4BAA4B;AAC7I,IAAM,8BAA8F,aAAa,8BAA8B,6BAA6B;AAC5K,IAAM,8BAA8F,aAAa,8BAA8B,6BAA6B;;;ADlB5K,IAAe,sBAAf,cASG,gBAAgD;AAAA,EACxD,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,+BAA+B;AAAA,EAC3G,OAAyB,sBAA8B;AACzD;;;AGrBA;AAAA,EACE;AAAA,EAAU;AAAA,EACV;AAAA,EAAQ;AAAA,OACH;AAIP;AAAA,EACE;AAAA,EAAgB;AAAA,EAAgB;AAAA,OAC3B;AAKA,IAAM,uCAAuC,CAAC,QAA0C,WAAuC,CAAC,MAAsB;AAC3J,MAAI,CAAC,OAAQ,QAAO,CAAC;AACrB,QAAM;AAAA,IACJ;AAAA,IAAW;AAAA,IAAQ;AAAA,IAAa;AAAA,IAAO,QAAQ;AAAA,IAAQ;AAAA,IAAgB;AAAA,IAAiB;AAAA,EAC1F,IAAI;AAEJ,QAAM,iBAAiB,eAAe,kBAAkB,UAAU,UAAU,SAAS,KAAK,CAAC;AAC3F,QAAM,eAAe,WAAY,UAAU,SAAU,kBAAkB,mBAAmB,kBAAkB;AAC5G,QAAM,eAAgB,UAAU,SAC5B,eAAe,UAAU,QAAM,GAAG,YAAY,YAAY,IAC1D,eAAe,UAAU,QAAM,GAAG,YAAY,YAAY;AAC9D,MAAI,iBAAiB,GAAI,QAAO,CAAC;AACjC,QAAM,gBAAgB,eAAe,MAAM,YAAY;AAEvD,MAAI,MAAM,cAAc,OAAO,cAAc;AAC7C,QAAM,eAAe,WAAW,IAAI,aAAW,iBAAiB,OAAO,CAAC,EAAE,OAAO,MAAM;AACvF,MAAI,
|
|
4
|
+
"sourcesContent": ["import type { BoundWitness, Schema } from '@xyo-network/sdk-protocol'\n\nimport { AbstractDiviner } from '#diviner-abstract'\nimport type { DivinerInstance, DivinerModuleEventData } from '#diviner-model'\n\nimport { BoundWitnessDivinerConfigSchema } from './Config.ts'\nimport type { BoundWitnessDivinerParams } from './Params.ts'\nimport type { BoundWitnessDivinerQueryPayload } from './Query.ts'\n\nexport abstract class BoundWitnessDiviner<\n TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams,\n TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload,\n TOut extends BoundWitness = BoundWitness,\n TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n> extends AbstractDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, BoundWitnessDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = BoundWitnessDivinerConfigSchema\n}\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport { asSchema, type Payload } from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { DivinerConfig } from '#diviner-model'\nimport { DivinerConfigZod } from '#diviner-model'\n\nimport { BoundWitnessDivinerSchema } from './Schema.ts'\n\nexport const BoundWitnessDivinerConfigSchema: string & {\n readonly __schema: true\n} = asSchema(`${BoundWitnessDivinerSchema}.config`, true)\nexport type BoundWitnessDivinerConfigSchema = typeof BoundWitnessDivinerConfigSchema\n\nexport const BoundWitnessDivinerConfigZod: z.ZodMiniObject<\n Omit<(typeof DivinerConfigZod)['shape'], 'schema'> & {\n schema: z.ZodMiniLiteral<BoundWitnessDivinerConfigSchema>\n },\n z.core.$strip\n> = z.extend(DivinerConfigZod, { schema: z.literal(BoundWitnessDivinerConfigSchema) })\n\nexport type BoundWitnessDivinerConfigBase = z.infer<typeof BoundWitnessDivinerConfigZod>\n\nexport const isBoundWitnessDivinerConfig: ReturnType<typeof zodIsFactory<BoundWitnessDivinerConfigBase>> = zodIsFactory(BoundWitnessDivinerConfigZod)\nexport const asBoundWitnessDivinerConfig: ReturnType<typeof zodAsFactory<BoundWitnessDivinerConfigBase>> = zodAsFactory(BoundWitnessDivinerConfigZod, 'asBoundWitnessDivinerConfig')\nexport const toBoundWitnessDivinerConfig: ReturnType<typeof zodToFactory<BoundWitnessDivinerConfigBase>> = zodToFactory(BoundWitnessDivinerConfigZod, 'toBoundWitnessDivinerConfig')\n\nexport type BoundWitnessDivinerConfig<T extends Payload = Payload> = DivinerConfig<\n T & {\n schema: BoundWitnessDivinerConfigSchema\n }\n>\n", "import { asSchema } from '@xyo-network/sdk-protocol'\n\nexport const BoundWitnessDivinerSchema: 'network.xyo.diviner.boundwitness' & {\n readonly __schema: true\n} = asSchema('network.xyo.diviner.boundwitness', true)\nexport type BoundWitnessDivinerSchema = typeof BoundWitnessDivinerSchema\n", "import {\n assertEx, containsAll,\n exists, hexFromHexString,\n} from '@ariestools/sdk'\nimport type {\n BoundWitness, Payload, WithStorageMeta,\n} from '@xyo-network/sdk-protocol'\nimport {\n isBoundWitness, PayloadBuilder, SequenceConstants,\n} from '@xyo-network/sdk-protocol'\n\nimport type { BoundWitnessDivinerQueryPayload } from './Query.ts'\n\n// eslint-disable-next-line complexity\nexport const applyBoundWitnessDivinerQueryPayload = (filter?: BoundWitnessDivinerQueryPayload, payloads: WithStorageMeta<Payload>[] = []): BoundWitness[] => {\n if (!filter) return []\n const {\n addresses, cursor, destination, limit, order = 'desc', payload_hashes, payload_schemas, sourceQuery,\n } = filter\n\n const sortedPayloads = PayloadBuilder.sortByStorageMeta(payloads, order === 'desc' ? -1 : 1)\n const parsedCursor = cursor ?? ((order === 'desc') ? SequenceConstants.maxLocalSequence : SequenceConstants.minLocalSequence)\n const parsedOffset = (order === 'desc')\n ? sortedPayloads.findIndex(bw => bw._sequence < parsedCursor)\n : sortedPayloads.findIndex(bw => bw._sequence > parsedCursor)\n if (parsedOffset === -1) return []\n const payloadSubset = sortedPayloads.slice(parsedOffset)\n\n let bws = payloadSubset.filter(isBoundWitness)\n const allAddresses = addresses?.map(address => hexFromHexString(address)).filter(exists)\n if (allAddresses !== undefined && allAddresses.length > 0) bws = bws.filter(bw => containsAll<string>(bw.addresses, allAddresses))\n if (payload_hashes !== undefined && payload_hashes.length > 0) bws = bws.filter(bw => containsAll(bw.payload_hashes, payload_hashes))\n if (payload_schemas !== undefined && payload_schemas.length > 0) bws = bws.filter(bw => containsAll(bw.payload_schemas, payload_schemas))\n if (sourceQuery !== undefined && sourceQuery !== '') bws = bws.filter(bw => bw?.$sourceQuery === sourceQuery)\n // If there's a destination filter of the right kind\n if (destination && Array.isArray(destination) && destination?.length > 0) {\n const targetFilter = assertEx(destination, () => 'Missing destination')\n // Find all BWs that satisfy the destination constraint\n bws = bws.filter((bw) => {\n const targetDestinationField = (bw as { $destination?: string | string[] })?.$destination\n // If the destination field is an array and contains at least one element\n return targetDestinationField !== undefined && Array.isArray(targetDestinationField) && targetDestinationField.length > 0\n // Check that the targetDestinationField contains all the elements in the targetFilter\n ? containsAll(targetFilter, targetDestinationField ?? [])\n // Otherwise, filter it out\n : false\n })\n }\n const parsedLimit = limit ?? bws.length\n return bws.slice(0, parsedLimit)\n}\n", "import { assertEx } from '@ariestools/sdk'\nimport { type BoundWitness, isBoundWitness } from '@xyo-network/sdk-protocol'\nimport { isStorageMeta } from '@xyo-network/sdk-protocol'\n\nimport { applyBoundWitnessDivinerQueryPayload } from './applyBoundWitnessDivinerQueryPayload.ts'\nimport { BoundWitnessDiviner } from './BoundWitnessDiviner.ts'\nimport type { BoundWitnessDivinerParams } from './Params.ts'\nimport { type BoundWitnessDivinerQueryPayload, isBoundWitnessDivinerQueryPayload } from './Query.ts'\n\nexport interface EqualityComparisonOperators {\n /**\n * 'Not Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value does not match the provided string.\n * Example: field != 'value'\n */\n '!=': string\n\n /**\n * 'Less Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than the provided string.\n * Example: field < 'value'\n */\n '<': string\n\n /**\n * 'Less Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically less than or equal to the provided string.\n * Example: field <= 'value'\n */\n '<=': string\n\n /**\n * 'Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value matches the provided string exactly.\n * Example: field = 'value'\n */\n '=': string\n\n /**\n * 'Greater Than' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than the provided string.\n * Example: field > 'value'\n */\n '>': string\n\n /**\n * 'Greater Than or Equal To' comparison operator.\n * Compares the field with the specified string value,\n * selecting records where the field value is lexicographically greater than or equal to the provided string.\n * Example: field >= 'value'\n */\n '>=': string\n}\n\nexport class MemoryBoundWitnessDiviner<\n TParams extends BoundWitnessDivinerParams = BoundWitnessDivinerParams,\n TIn extends BoundWitnessDivinerQueryPayload = BoundWitnessDivinerQueryPayload,\n TOut extends BoundWitness = BoundWitness,\n> extends BoundWitnessDiviner<TParams, TIn, TOut> {\n protected override async divineHandler(payloads?: TIn[]): Promise<TOut[]> {\n const filter = assertEx(payloads?.filter(isBoundWitnessDivinerQueryPayload)?.pop(), () => 'Missing query payload')\n const archivist = assertEx(await this.archivistInstance(), () => 'Unable to resolve archivist')\n const bws = ((await archivist?.next({ limit: 10_000 })) ?? []).filter(x => isBoundWitness(x) && isStorageMeta(x))\n return applyBoundWitnessDivinerQueryPayload(filter, bws) as TOut[]\n }\n}\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { BoundWitnessDivinerPredicate } from './Predicate.ts'\nimport { BoundWitnessDivinerSchema } from './Schema.ts'\n\nexport const BoundWitnessDivinerQuerySchema: string & {\n readonly __schema: true\n} = asSchema(`${BoundWitnessDivinerSchema}.query`, true)\nexport type BoundWitnessDivinerQuerySchema = typeof BoundWitnessDivinerQuerySchema\n\nexport const BoundWitnessDivinerQueryPayloadZod: z.ZodMiniIntersection<\n z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<BoundWitnessDivinerQuerySchema> }\n & (typeof QueryFieldsZod)['shape'],\n z.core.$strip\n >,\n z.ZodMiniCustom<BoundWitnessDivinerPredicate, BoundWitnessDivinerPredicate>\n> = z.intersection(\n z.extend(PayloadZodOfSchema(BoundWitnessDivinerQuerySchema), { ...QueryFieldsZod.shape }),\n z.custom<BoundWitnessDivinerPredicate>(),\n)\n\nexport type BoundWitnessDivinerQueryPayload = z.infer<typeof BoundWitnessDivinerQueryPayloadZod>\n\nexport const isBoundWitnessDivinerQueryPayload: ReturnType<typeof zodIsFactory<BoundWitnessDivinerQueryPayload>> = zodIsFactory(BoundWitnessDivinerQueryPayloadZod)\nexport const asBoundWitnessDivinerQueryPayload: ReturnType<typeof zodAsFactory<BoundWitnessDivinerQueryPayload>> = zodAsFactory(BoundWitnessDivinerQueryPayloadZod, 'asBoundWitnessDivinerQueryPayload')\nexport const toBoundWitnessDivinerQueryPayload: ReturnType<typeof zodToFactory<BoundWitnessDivinerQueryPayload>> = zodToFactory(BoundWitnessDivinerQueryPayloadZod, 'toBoundWitnessDivinerQueryPayload')\n"],
|
|
5
|
+
"mappings": ";AAEA,SAAS,uBAAuB;;;ACFhC;AAAA,EACE;AAAA,EAAc;AAAA,EAAc;AAAA,OACvB;AACP,SAAS,YAAAA,iBAA8B;AACvC,YAAY,OAAO;AAGnB,SAAS,wBAAwB;;;ACPjC,SAAS,gBAAgB;AAElB,IAAM,4BAET,SAAS,oCAAoC,IAAI;;;ADO9C,IAAM,kCAETC,UAAS,GAAG,yBAAyB,WAAW,IAAI;AAGjD,IAAM,+BAKP,SAAO,kBAAkB,EAAE,QAAU,UAAQ,+BAA+B,EAAE,CAAC;AAI9E,IAAM,8BAA8F,aAAa,4BAA4B;AAC7I,IAAM,8BAA8F,aAAa,8BAA8B,6BAA6B;AAC5K,IAAM,8BAA8F,aAAa,8BAA8B,6BAA6B;;;ADlB5K,IAAe,sBAAf,cASG,gBAAgD;AAAA,EACxD,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,+BAA+B;AAAA,EAC3G,OA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C;AAChH,WAAO,qCAAqC,QAAQ,GAAG;AAAA,EACzD;AACF;",
|
|
6
6
|
"names": ["asSchema", "asSchema", "assertEx", "isBoundWitness", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "z", "asSchema", "zodIsFactory", "zodAsFactory", "zodToFactory", "assertEx", "isBoundWitness"]
|
|
7
7
|
}
|
|
@@ -33,8 +33,10 @@ var asDivinerDivineQuery = zodAsFactory(DivinerDivineQueryZod, "asDivinerDivineQ
|
|
|
33
33
|
var toDivinerDivineQuery = zodToFactory(DivinerDivineQueryZod, "toDivinerDivineQuery");
|
|
34
34
|
|
|
35
35
|
// src/modules/diviner-model/typeChecks.ts
|
|
36
|
-
var
|
|
37
|
-
var
|
|
36
|
+
var isInstanceFactory = new IsInstanceFactory();
|
|
37
|
+
var isDivinerInstance = isInstanceFactory.create({ divine: "function" }, [isModuleInstance]);
|
|
38
|
+
var isQueryableModuleFactory = new IsQueryableModuleFactory();
|
|
39
|
+
var isDivinerModule = isQueryableModuleFactory.create([DivinerDivineQuerySchema]);
|
|
38
40
|
var asDivinerModule = AsObjectFactory.create(isDivinerModule);
|
|
39
41
|
var asDivinerInstance = AsObjectFactory.create(isDivinerInstance);
|
|
40
42
|
var withDivinerModule = WithFactory.create(isDivinerModule);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/modules/diviner-model/attachable/asAttachableInstance.ts", "../../src/modules/diviner-model/attachable/isAttachableInstance.ts", "../../src/modules/diviner-model/typeChecks.ts", "../../src/modules/diviner-model/Queries/Divine.ts", "../../src/modules/diviner-model/attachable/AttachableInstance.ts", "../../src/modules/diviner-model/Config.ts"],
|
|
4
|
-
"sourcesContent": ["import { AsObjectFactory } from '@ariestools/sdk'\n\nimport { isAttachableDivinerInstance } from './isAttachableInstance.ts'\n\nexport const asAttachableDivinerInstance = AsObjectFactory.create(isAttachableDivinerInstance)\n", "import type { ObjectTypeShape, TypeCheck } from '@ariestools/sdk'\nimport { IsObjectFactory } from '@ariestools/sdk'\n\nimport { isAttachableModuleInstance } from '#module-model'\n\nimport { isDivinerInstance } from '../typeChecks.ts'\nimport type { AttachableDivinerInstance } from './AttachableInstance.ts'\n\nexport const requiredAttachableDivinerInstanceFunctions: ObjectTypeShape = {}\n\n// we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableDivinerInstance>()\n\nexport const isAttachableDivinerInstance: TypeCheck<AttachableDivinerInstance> = factory.create(requiredAttachableDivinerInstanceFunctions, [\n isDivinerInstance,\n isAttachableModuleInstance,\n])\n", "import type { TypeCheck } from '@ariestools/sdk'\nimport { AsObjectFactory } from '@ariestools/sdk'\n\nimport {\n IsInstanceFactory, isModuleInstance, IsQueryableModuleFactory, WithFactory,\n} from '#module-model'\n\nimport type { DivinerInstance } from './Instance.ts'\nimport type { DivinerModule } from './Module.ts'\nimport { DivinerDivineQuerySchema } from './Queries/index.ts'\n\nexport const isDivinerInstance: TypeCheck<DivinerInstance> =
|
|
5
|
-
"mappings": ";AAAA,SAAS,mBAAAA,wBAAuB;;;ACChC,SAAS,uBAAuB;AAEhC,SAAS,kCAAkC;;;ACF3C,SAAS,uBAAuB;AAEhC;AAAA,EACE;AAAA,EAAmB;AAAA,EAAkB;AAAA,EAA0B;AAAA,OAC1D;;;ACLP;AAAA,EACE;AAAA,EAAc;AAAA,EAAc;AAAA,OACvB;AACP;AAAA,EACE;AAAA,EAAU;AAAA,EAAoB;AAAA,OACzB;AACP,YAAY,OAAO;AAEZ,IAAM,2BAET,SAAS,oCAAoC,IAAI;AAG9C,IAAM,wBAIP,SAAO,mBAAmB,wBAAwB,GAAG,EAAE,GAAG,eAAe,MAAM,CAAC;AAI/E,IAAM,uBAA4E,aAAa,qBAAqB;AACpH,IAAM,uBAA4E,aAAa,uBAAuB,sBAAsB;AAC5I,IAAM,uBAA4E,aAAa,uBAAuB,sBAAsB;;;
|
|
4
|
+
"sourcesContent": ["import { AsObjectFactory } from '@ariestools/sdk'\n\nimport { isAttachableDivinerInstance } from './isAttachableInstance.ts'\n\nexport const asAttachableDivinerInstance = AsObjectFactory.create(isAttachableDivinerInstance)\n", "import type { ObjectTypeShape, TypeCheck } from '@ariestools/sdk'\nimport { IsObjectFactory } from '@ariestools/sdk'\n\nimport { isAttachableModuleInstance } from '#module-model'\n\nimport { isDivinerInstance } from '../typeChecks.ts'\nimport type { AttachableDivinerInstance } from './AttachableInstance.ts'\n\nexport const requiredAttachableDivinerInstanceFunctions: ObjectTypeShape = {}\n\n// we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableDivinerInstance>()\n\nexport const isAttachableDivinerInstance: TypeCheck<AttachableDivinerInstance> = factory.create(requiredAttachableDivinerInstanceFunctions, [\n isDivinerInstance,\n isAttachableModuleInstance,\n])\n", "import type { TypeCheck } from '@ariestools/sdk'\nimport { AsObjectFactory } from '@ariestools/sdk'\n\nimport {\n IsInstanceFactory, isModuleInstance, IsQueryableModuleFactory, WithFactory,\n} from '#module-model'\n\nimport type { DivinerInstance } from './Instance.ts'\nimport type { DivinerModule } from './Module.ts'\nimport { DivinerDivineQuerySchema } from './Queries/index.ts'\n\nconst isInstanceFactory = new IsInstanceFactory<DivinerInstance>()\nexport const isDivinerInstance: TypeCheck<DivinerInstance> = isInstanceFactory.create({ divine: 'function' }, [isModuleInstance])\nconst isQueryableModuleFactory = new IsQueryableModuleFactory<DivinerModule>()\nexport const isDivinerModule: TypeCheck<DivinerModule> = isQueryableModuleFactory.create([DivinerDivineQuerySchema])\n\nexport const asDivinerModule = AsObjectFactory.create(isDivinerModule)\nexport const asDivinerInstance = AsObjectFactory.create(isDivinerInstance)\n\n/** @deprecated use narrowing instead [ if(is) ] */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport const withDivinerModule = WithFactory.create(isDivinerModule)\n/** @deprecated use narrowing instead [ if(is) ] */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport const withDivinerInstance = WithFactory.create(isDivinerInstance)\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, PayloadZodOfSchema, QueryFieldsZod,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nexport const DivinerDivineQuerySchema: 'network.xyo.query.diviner.divine' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.diviner.divine', true)\nexport type DivinerDivineQuerySchema = typeof DivinerDivineQuerySchema\n\nexport const DivinerDivineQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<DivinerDivineQuerySchema> }\n & (typeof QueryFieldsZod)['shape'],\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(DivinerDivineQuerySchema), { ...QueryFieldsZod.shape })\n\nexport type DivinerDivineQuery = z.infer<typeof DivinerDivineQueryZod>\n\nexport const isDivinerDivineQuery: ReturnType<typeof zodIsFactory<DivinerDivineQuery>> = zodIsFactory(DivinerDivineQueryZod)\nexport const asDivinerDivineQuery: ReturnType<typeof zodAsFactory<DivinerDivineQuery>> = zodAsFactory(DivinerDivineQueryZod, 'asDivinerDivineQuery')\nexport const toDivinerDivineQuery: ReturnType<typeof zodToFactory<DivinerDivineQuery>> = zodToFactory(DivinerDivineQueryZod, 'toDivinerDivineQuery')\n", "import type { TypeCheck } from '@ariestools/sdk'\nimport { IsObjectFactory } from '@ariestools/sdk'\nimport type { Payload } from '@xyo-network/sdk-protocol'\n\nimport type { AttachableModuleInstance } from '#module-model'\n\nimport type { DivinerModuleEventData } from '../EventData.ts'\nimport type { DivinerInstance } from '../Instance.ts'\nimport type { DivinerParams } from '../Params.ts'\n\nexport interface AttachableDivinerInstance<\n TParams extends DivinerParams = DivinerParams,\n TIn extends Payload = Payload,\n TOut extends Payload = Payload,\n TEventData extends DivinerModuleEventData = DivinerModuleEventData,\n> extends DivinerInstance<TParams, TIn, TOut, TEventData>,\n AttachableModuleInstance<TParams, TEventData> {}\n\nexport type AttachableDivinerInstanceTypeCheck<T extends AttachableDivinerInstance = AttachableDivinerInstance> = TypeCheck<T>\n\nexport class IsAttachableDivinerInstanceFactory<T extends AttachableDivinerInstance = AttachableDivinerInstance> extends IsObjectFactory<T> {}\n", "import type { EmptyObject, WithAdditional } from '@ariestools/sdk'\nimport {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, type Payload, type Schema,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { ModuleConfig, ModuleIdentifier } from '#module-model'\nimport { ModuleConfigZod } from '#module-model'\n\nexport const DivinerConfigSchema: 'network.xyo.diviner.config' & {\n readonly __schema: true\n} = asSchema('network.xyo.diviner.config', true)\nexport type DivinerConfigSchema = typeof DivinerConfigSchema\n\nexport interface ModuleEventSubscription {\n sourceEvent: string\n sourceModule: ModuleIdentifier\n targetModuleFunction?: string\n}\n\nexport const DivinerConfigZod: z.ZodMiniObject<\n Omit<(typeof ModuleConfigZod)['shape'], 'schema'> & {\n eventSubscriptions: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniCustom<ModuleEventSubscription, ModuleEventSubscription>>>\n schema: z.ZodMiniLiteral<DivinerConfigSchema>\n },\n z.core.$strip\n> = z.extend(ModuleConfigZod, {\n eventSubscriptions: z.optional(z.array(z.custom<ModuleEventSubscription>())),\n schema: z.literal(DivinerConfigSchema),\n})\n\nexport type DivinerConfigBase = z.infer<typeof DivinerConfigZod>\n\nexport const isDivinerConfig: ReturnType<typeof zodIsFactory<DivinerConfigBase>> = zodIsFactory(DivinerConfigZod)\nexport const asDivinerConfig: ReturnType<typeof zodAsFactory<DivinerConfigBase>> = zodAsFactory(DivinerConfigZod, 'asDivinerConfig')\nexport const toDivinerConfig: ReturnType<typeof zodToFactory<DivinerConfigBase>> = zodToFactory(DivinerConfigZod, 'toDivinerConfig')\n\nexport type DivinerConfig<TConfig extends Payload | EmptyObject | void = void, TSchema extends Schema | void = void> = ModuleConfig<\n WithAdditional<\n {\n eventSubscriptions?: ModuleEventSubscription[]\n },\n Omit<TConfig, 'schema'>\n >,\n TSchema extends Schema ? TSchema : TConfig extends Payload ? TConfig['schema'] : DivinerConfigSchema\n>\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,mBAAAA,wBAAuB;;;ACChC,SAAS,uBAAuB;AAEhC,SAAS,kCAAkC;;;ACF3C,SAAS,uBAAuB;AAEhC;AAAA,EACE;AAAA,EAAmB;AAAA,EAAkB;AAAA,EAA0B;AAAA,OAC1D;;;ACLP;AAAA,EACE;AAAA,EAAc;AAAA,EAAc;AAAA,OACvB;AACP;AAAA,EACE;AAAA,EAAU;AAAA,EAAoB;AAAA,OACzB;AACP,YAAY,OAAO;AAEZ,IAAM,2BAET,SAAS,oCAAoC,IAAI;AAG9C,IAAM,wBAIP,SAAO,mBAAmB,wBAAwB,GAAG,EAAE,GAAG,eAAe,MAAM,CAAC;AAI/E,IAAM,uBAA4E,aAAa,qBAAqB;AACpH,IAAM,uBAA4E,aAAa,uBAAuB,sBAAsB;AAC5I,IAAM,uBAA4E,aAAa,uBAAuB,sBAAsB;;;ADZnJ,IAAM,oBAAoB,IAAI,kBAAmC;AAC1D,IAAM,oBAAgD,kBAAkB,OAAO,EAAE,QAAQ,WAAW,GAAG,CAAC,gBAAgB,CAAC;AAChI,IAAM,2BAA2B,IAAI,yBAAwC;AACtE,IAAM,kBAA4C,yBAAyB,OAAO,CAAC,wBAAwB,CAAC;AAE5G,IAAM,kBAAkB,gBAAgB,OAAO,eAAe;AAC9D,IAAM,oBAAoB,gBAAgB,OAAO,iBAAiB;AAIlE,IAAM,oBAAoB,YAAY,OAAO,eAAe;AAG5D,IAAM,sBAAsB,YAAY,OAAO,iBAAiB;;;ADhBhE,IAAM,6CAA8D,CAAC;AAG5E,IAAM,UAAU,IAAI,gBAA2C;AAExD,IAAM,8BAAoE,QAAQ,OAAO,4CAA4C;AAAA,EAC1I;AAAA,EACA;AACF,CAAC;;;ADZM,IAAM,8BAA8BC,iBAAgB,OAAO,2BAA2B;;;AIH7F,SAAS,mBAAAC,wBAAuB;AAmBzB,IAAM,qCAAN,cAAkHA,iBAAmB;AAAC;;;ACnB7I;AAAA,EACE,gBAAAC;AAAA,EAAc,gBAAAC;AAAA,EAAc,gBAAAC;AAAA,OACvB;AACP;AAAA,EACE,YAAAC;AAAA,OACK;AACP,YAAYC,QAAO;AAGnB,SAAS,uBAAuB;AAEzB,IAAM,sBAETD,UAAS,8BAA8B,IAAI;AASxC,IAAM,mBAMP,UAAO,iBAAiB;AAAA,EAC5B,oBAAsB,YAAW,SAAQ,UAAgC,CAAC,CAAC;AAAA,EAC3E,QAAU,WAAQ,mBAAmB;AACvC,CAAC;AAIM,IAAM,kBAAsEF,cAAa,gBAAgB;AACzG,IAAM,kBAAsED,cAAa,kBAAkB,iBAAiB;AAC5H,IAAM,kBAAsEE,cAAa,kBAAkB,iBAAiB;",
|
|
6
6
|
"names": ["AsObjectFactory", "AsObjectFactory", "IsObjectFactory", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "z"]
|
|
7
7
|
}
|
|
@@ -97,22 +97,18 @@ var GenericPayloadDiviner = class extends PayloadDiviner {
|
|
|
97
97
|
...props
|
|
98
98
|
} = filter;
|
|
99
99
|
let all = this.all(order, cursor);
|
|
100
|
-
if (all)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
})) : all.filter((payload) => payload?.[property] === filter2);
|
|
110
|
-
}
|
|
100
|
+
if (schemas !== void 0 && schemas.length > 0) all = all.filter((payload) => schemas.includes(payload.schema));
|
|
101
|
+
if (Object.keys(props).length > 0) {
|
|
102
|
+
const additionalFilterCriteria = Object.entries(props);
|
|
103
|
+
for (const [prop, filter2] of additionalFilterCriteria) {
|
|
104
|
+
const property = prop;
|
|
105
|
+
all = Array.isArray(filter2) ? all.filter((payload) => filter2.every((value) => {
|
|
106
|
+
const prop2 = payload?.[property];
|
|
107
|
+
return Array.isArray(prop2) && prop2.includes?.(value);
|
|
108
|
+
})) : all.filter((payload) => payload?.[property] === filter2);
|
|
111
109
|
}
|
|
112
|
-
return limit ? all.slice(0, limit) : all;
|
|
113
|
-
} else {
|
|
114
|
-
throw new Error('Archivist does not support "all"');
|
|
115
110
|
}
|
|
111
|
+
return limit !== void 0 && limit !== 0 ? all.slice(0, limit) : all;
|
|
116
112
|
}
|
|
117
113
|
onArchivistCleared = () => {
|
|
118
114
|
forget(
|
|
@@ -156,8 +152,9 @@ var GenericPayloadDiviner = class extends PayloadDiviner {
|
|
|
156
152
|
}
|
|
157
153
|
indexPayloads(payloads) {
|
|
158
154
|
this.payloadsWithMeta.push(...payloads);
|
|
159
|
-
|
|
160
|
-
|
|
155
|
+
const indexes = this.indexes ?? [];
|
|
156
|
+
for (const index of indexes) {
|
|
157
|
+
this.indexMaps[index] ??= [];
|
|
161
158
|
for (const payload of payloads) {
|
|
162
159
|
this.indexMaps[index].push(payload);
|
|
163
160
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/modules/diviner-payload-generic/Diviner.ts"],
|
|
4
|
-
"sourcesContent": ["import type { EventListener, Hex } from '@ariestools/sdk'\nimport {\n assertEx, filterAs, forget,\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport { PayloadBuilder } from '@xyo-network/sdk-protocol'\nimport {\n asSchema,\n type Payload, type Schema,\n type Sequence,\n type WithStorageMeta,\n} from '@xyo-network/sdk-protocol'\nimport { Mutex } from 'async-mutex'\nimport * as z from 'zod/mini'\n\nimport type { ArchivistInstance, ArchivistModuleEventData } from '#archivist-model'\nimport type { DivinerInstance, DivinerModuleEventData } from '#diviner-model'\nimport { PayloadDiviner } from '#diviner-payload-abstract'\nimport type {\n Order,\n PayloadDivinerConfig,\n PayloadDivinerParams,\n PayloadDivinerQueryPayload,\n} from '#diviner-payload-model'\nimport { asPayloadDivinerQueryPayload, PayloadDivinerConfigZod } from '#diviner-payload-model'\nimport { creatableModule } from '#module-model'\n\nconst DEFAULT_INDEX_BATCH_SIZE = 100 as const\nconst DEFAULT_MAX_INDEX_SIZE = 8000 as const\n\nexport const GenericPayloadDivinerConfigSchema: 'network.xyo.diviner.payload.generic.config' & {\n readonly __schema: true\n} = asSchema('network.xyo.diviner.payload.generic.config', true)\nexport type GenericPayloadDivinerConfigSchema = typeof GenericPayloadDivinerConfigSchema\n\nexport const GenericPayloadDivinerConfigZod: z.ZodMiniObject<\n Omit<(typeof PayloadDivinerConfigZod)['shape'], 'schema'> & {\n indexes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>\n schema: z.ZodMiniLiteral<GenericPayloadDivinerConfigSchema>\n },\n z.core.$strip\n> = z.extend(PayloadDivinerConfigZod, {\n indexes: z.optional(z.array(z.string())),\n schema: z.literal(GenericPayloadDivinerConfigSchema),\n})\n\nexport type GenericPayloadDivinerConfigBase = z.infer<typeof GenericPayloadDivinerConfigZod>\n\nexport const isGenericPayloadDivinerConfig: ReturnType<typeof zodIsFactory<GenericPayloadDivinerConfigBase>> = zodIsFactory(GenericPayloadDivinerConfigZod)\nexport const asGenericPayloadDivinerConfig: ReturnType<typeof zodAsFactory<GenericPayloadDivinerConfigBase>> = zodAsFactory(GenericPayloadDivinerConfigZod, 'asGenericPayloadDivinerConfig')\nexport const toGenericPayloadDivinerConfig: ReturnType<typeof zodToFactory<GenericPayloadDivinerConfigBase>> = zodToFactory(GenericPayloadDivinerConfigZod, 'toGenericPayloadDivinerConfig')\n\nexport type GenericPayloadDivinerConfig = PayloadDivinerConfig<\n {\n indexes?: string[]\n },\n GenericPayloadDivinerConfigSchema\n>\n\n@creatableModule()\nexport class GenericPayloadDiviner<\n TParams extends PayloadDivinerParams<GenericPayloadDivinerConfig> = PayloadDivinerParams<GenericPayloadDivinerConfig>,\n TIn extends PayloadDivinerQueryPayload = PayloadDivinerQueryPayload,\n TOut extends WithStorageMeta<Payload> = WithStorageMeta<Payload>,\n TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n> extends PayloadDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, GenericPayloadDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = GenericPayloadDivinerConfigSchema\n\n protected indexMaps: Record<string, WithStorageMeta<TOut>[]> = {}\n protected payloadsWithMeta: WithStorageMeta<TOut>[] = []\n\n private _archivistInstance?: ArchivistInstance\n private _cursor?: Sequence\n private _updatePayloadPairsMutex = new Mutex()\n\n protected get indexBatchSize(): number {\n return this.config.indexBatchSize ?? DEFAULT_INDEX_BATCH_SIZE\n }\n\n protected get indexes(): string[] {\n return ['schema', ...(this.config.indexes ?? [])]\n }\n\n protected get maxIndexSize(): number {\n return this.config.maxIndexSize ?? DEFAULT_MAX_INDEX_SIZE\n }\n\n protected all(order: Order = 'desc', cursor?: Hex): WithStorageMeta<TOut>[] {\n const payloads = this.payloadsWithMeta.toSorted(PayloadBuilder.compareStorageMeta)\n if (order === 'desc') payloads.reverse()\n const startIndex = (cursor ? (payloads.findIndex(payload => payload._sequence === cursor) ?? -1) : -1) + 1\n return payloads.slice(startIndex)\n }\n\n protected override async archivistInstance(): Promise<ArchivistInstance | undefined>\n protected override async archivistInstance(required: true): Promise<ArchivistInstance>\n protected override async archivistInstance(required = false): Promise<ArchivistInstance | undefined> {\n if (!this._archivistInstance) {\n const archivist = await super.archivistInstance()\n if (required && !archivist) {\n throw new Error('Failed to find archivist')\n }\n archivist?.on('inserted', this.onArchivistInserted)\n archivist?.on('cleared', this.onArchivistCleared)\n archivist?.on('deleted', this.onArchivistDeleted)\n this._archivistInstance = archivist\n }\n return this._archivistInstance\n }\n\n protected async clearIndex(): Promise<void> {\n await this._updatePayloadPairsMutex.runExclusive(() => {\n this._cursor = undefined\n this.payloadsWithMeta = []\n this.indexMaps = {}\n })\n }\n\n protected override async divineHandler(payloads?: TIn[]): Promise<TOut[]> {\n const filters = filterAs(payloads ?? [], asPayloadDivinerQueryPayload)\n assertEx(filters.length < 2, () => 'Multiple PayloadDivinerQuery payloads may not be specified')\n const filter = assertEx(filters.shift(), () => 'No PayloadDivinerQuery specified')\n await this.updateIndex()\n\n const {\n\n schema, schemas, order, limit, cursor, ...props\n } = filter\n let all: TOut[] = this.all(order, cursor)\n if (
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AACA;AAAA,EACE;AAAA,EAAU;AAAA,EAAU;AAAA,EACpB;AAAA,EAAc;AAAA,EAAc;AAAA,OACvB;AACP,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,OAIK;AACP,SAAS,aAAa;AACtB,YAAY,OAAO;AAInB,SAAS,sBAAsB;AAO/B,SAAS,8BAA8B,+BAA+B;AACtE,SAAS,uBAAuB;AAEhC,IAAM,2BAA2B;AACjC,IAAM,yBAAyB;AAExB,IAAM,oCAET,SAAS,8CAA8C,IAAI;AAGxD,IAAM,iCAMP,SAAO,yBAAyB;AAAA,EACpC,SAAW,WAAW,QAAQ,SAAO,CAAC,CAAC;AAAA,EACvC,QAAU,UAAQ,iCAAiC;AACrD,CAAC;AAIM,IAAM,gCAAkG,aAAa,8BAA8B;AACnJ,IAAM,gCAAkG,aAAa,gCAAgC,+BAA+B;AACpL,IAAM,gCAAkG,aAAa,gCAAgC,+BAA+B;AAUpL,IAAM,wBAAN,cASG,eAA+C;AAAA,EAI7C,YAAqD,CAAC;AAAA,EACtD,mBAA4C,CAAC;AAAA,EAE/C;AAAA,EACA;AAAA,EACA,2BAA2B,IAAI,MAAM;AAAA,EAE7C,IAAc,iBAAyB;AACrC,WAAO,KAAK,OAAO,kBAAkB;AAAA,EACvC;AAAA,EAEA,IAAc,UAAoB;AAChC,WAAO,CAAC,UAAU,GAAI,KAAK,OAAO,WAAW,CAA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AAO,MAAM;AACxC,QAAI,
|
|
4
|
+
"sourcesContent": ["import type { EventListener, Hex } from '@ariestools/sdk'\nimport {\n assertEx, filterAs, forget,\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport { PayloadBuilder } from '@xyo-network/sdk-protocol'\nimport {\n asSchema,\n type Payload, type Schema,\n type Sequence,\n type WithStorageMeta,\n} from '@xyo-network/sdk-protocol'\nimport { Mutex } from 'async-mutex'\nimport * as z from 'zod/mini'\n\nimport type { ArchivistInstance, ArchivistModuleEventData } from '#archivist-model'\nimport type { DivinerInstance, DivinerModuleEventData } from '#diviner-model'\nimport { PayloadDiviner } from '#diviner-payload-abstract'\nimport type {\n Order,\n PayloadDivinerConfig,\n PayloadDivinerParams,\n PayloadDivinerQueryPayload,\n} from '#diviner-payload-model'\nimport { asPayloadDivinerQueryPayload, PayloadDivinerConfigZod } from '#diviner-payload-model'\nimport { creatableModule } from '#module-model'\n\nconst DEFAULT_INDEX_BATCH_SIZE = 100 as const\nconst DEFAULT_MAX_INDEX_SIZE = 8000 as const\n\nexport const GenericPayloadDivinerConfigSchema: 'network.xyo.diviner.payload.generic.config' & {\n readonly __schema: true\n} = asSchema('network.xyo.diviner.payload.generic.config', true)\nexport type GenericPayloadDivinerConfigSchema = typeof GenericPayloadDivinerConfigSchema\n\nexport const GenericPayloadDivinerConfigZod: z.ZodMiniObject<\n Omit<(typeof PayloadDivinerConfigZod)['shape'], 'schema'> & {\n indexes: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniString<string>>>\n schema: z.ZodMiniLiteral<GenericPayloadDivinerConfigSchema>\n },\n z.core.$strip\n> = z.extend(PayloadDivinerConfigZod, {\n indexes: z.optional(z.array(z.string())),\n schema: z.literal(GenericPayloadDivinerConfigSchema),\n})\n\nexport type GenericPayloadDivinerConfigBase = z.infer<typeof GenericPayloadDivinerConfigZod>\n\nexport const isGenericPayloadDivinerConfig: ReturnType<typeof zodIsFactory<GenericPayloadDivinerConfigBase>> = zodIsFactory(GenericPayloadDivinerConfigZod)\nexport const asGenericPayloadDivinerConfig: ReturnType<typeof zodAsFactory<GenericPayloadDivinerConfigBase>> = zodAsFactory(GenericPayloadDivinerConfigZod, 'asGenericPayloadDivinerConfig')\nexport const toGenericPayloadDivinerConfig: ReturnType<typeof zodToFactory<GenericPayloadDivinerConfigBase>> = zodToFactory(GenericPayloadDivinerConfigZod, 'toGenericPayloadDivinerConfig')\n\nexport type GenericPayloadDivinerConfig = PayloadDivinerConfig<\n {\n indexes?: string[]\n },\n GenericPayloadDivinerConfigSchema\n>\n\n@creatableModule()\nexport class GenericPayloadDiviner<\n TParams extends PayloadDivinerParams<GenericPayloadDivinerConfig> = PayloadDivinerParams<GenericPayloadDivinerConfig>,\n TIn extends PayloadDivinerQueryPayload = PayloadDivinerQueryPayload,\n TOut extends WithStorageMeta<Payload> = WithStorageMeta<Payload>,\n TEventData extends DivinerModuleEventData<DivinerInstance<TParams, TIn, TOut>, TIn, TOut> = DivinerModuleEventData<\n DivinerInstance<TParams, TIn, TOut>,\n TIn,\n TOut\n >,\n> extends PayloadDiviner<TParams, TIn, TOut, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, GenericPayloadDivinerConfigSchema]\n static override readonly defaultConfigSchema: Schema = GenericPayloadDivinerConfigSchema\n\n protected indexMaps: Record<string, WithStorageMeta<TOut>[]> = {}\n protected payloadsWithMeta: WithStorageMeta<TOut>[] = []\n\n private _archivistInstance?: ArchivistInstance\n private _cursor?: Sequence\n private _updatePayloadPairsMutex = new Mutex()\n\n protected get indexBatchSize(): number {\n return this.config.indexBatchSize ?? DEFAULT_INDEX_BATCH_SIZE\n }\n\n protected get indexes(): string[] {\n return ['schema', ...(this.config.indexes ?? [])]\n }\n\n protected get maxIndexSize(): number {\n return this.config.maxIndexSize ?? DEFAULT_MAX_INDEX_SIZE\n }\n\n protected all(order: Order = 'desc', cursor?: Hex): WithStorageMeta<TOut>[] {\n const payloads = this.payloadsWithMeta.toSorted(PayloadBuilder.compareStorageMeta)\n if (order === 'desc') payloads.reverse()\n const startIndex = (cursor ? (payloads.findIndex(payload => payload._sequence === cursor) ?? -1) : -1) + 1\n return payloads.slice(startIndex)\n }\n\n protected override async archivistInstance(): Promise<ArchivistInstance | undefined>\n protected override async archivistInstance(required: true): Promise<ArchivistInstance>\n protected override async archivistInstance(required = false): Promise<ArchivistInstance | undefined> {\n if (!this._archivistInstance) {\n const archivist = await super.archivistInstance()\n if (required && !archivist) {\n throw new Error('Failed to find archivist')\n }\n archivist?.on('inserted', this.onArchivistInserted)\n archivist?.on('cleared', this.onArchivistCleared)\n archivist?.on('deleted', this.onArchivistDeleted)\n this._archivistInstance = archivist\n }\n return this._archivistInstance\n }\n\n protected async clearIndex(): Promise<void> {\n await this._updatePayloadPairsMutex.runExclusive(() => {\n this._cursor = undefined\n this.payloadsWithMeta = []\n this.indexMaps = {}\n })\n }\n\n protected override async divineHandler(payloads?: TIn[]): Promise<TOut[]> {\n const filters = filterAs(payloads ?? [], asPayloadDivinerQueryPayload)\n assertEx(filters.length < 2, () => 'Multiple PayloadDivinerQuery payloads may not be specified')\n const filter = assertEx(filters.shift(), () => 'No PayloadDivinerQuery specified')\n await this.updateIndex()\n\n const {\n\n schema, schemas, order, limit, cursor, ...props\n } = filter\n let all: TOut[] = this.all(order, cursor)\n if (schemas !== undefined && schemas.length > 0) all = all.filter(payload => schemas.includes(payload.schema))\n if (Object.keys(props).length > 0) {\n const additionalFilterCriteria = Object.entries(props)\n for (const [prop, filter] of additionalFilterCriteria) {\n const property = prop as keyof TOut\n all\n = Array.isArray(filter)\n ? all.filter(payload =>\n filter.every((value) => {\n const prop = payload?.[property]\n // TODO: This seems to be written just to check arrays, and now that $meta is there, need to check type?\n return Array.isArray(prop) && prop.includes?.(value)\n }))\n : all.filter(payload => payload?.[property] === filter)\n }\n }\n return limit !== undefined && limit !== 0 ? all.slice(0, limit) : all\n }\n\n protected onArchivistCleared: EventListener<ArchivistModuleEventData['cleared']> = () => {\n forget(\n (async () => {\n await this.clearIndex()\n await this.updateIndex()\n })(),\n )\n }\n\n // we are just rebuilding the entire index at this point on delete since large archivists do not support delete\n protected onArchivistDeleted: EventListener<ArchivistModuleEventData['deleted']> = () => {\n forget(\n (async () => {\n await this.clearIndex()\n await this.updateIndex()\n })(),\n )\n }\n\n protected onArchivistInserted: EventListener<ArchivistModuleEventData['inserted']> = () => {\n forget(this.updateIndex())\n }\n\n protected override async stopHandler(_timeout?: number): Promise<void> {\n await super.stopHandler()\n const archivist = await this.archivistInstance(true)\n archivist.off('inserted', this.onArchivistInserted)\n archivist.off('deleted', this.onArchivistDeleted)\n archivist.off('cleared', this.onArchivistCleared)\n }\n\n // index any new payloads\n protected async updateIndex(): Promise<void> {\n await this._updatePayloadPairsMutex.runExclusive(async () => {\n const archivist = await this.archivistInstance(true)\n let newPayloads = await archivist.next({ limit: 100, cursor: this._cursor }) as TOut[]\n while (newPayloads.length > 0) {\n this._cursor = newPayloads.at(-1)?._sequence\n assertEx(this.payloadsWithMeta.length + newPayloads.length <= this.maxIndexSize, () => 'maxIndexSize exceeded')\n this.indexPayloads(newPayloads)\n newPayloads = await archivist.next({ limit: 100, cursor: this._cursor }) as TOut[]\n }\n })\n }\n\n private indexPayloads(payloads: WithStorageMeta<TOut>[]): Hex {\n this.payloadsWithMeta.push(...payloads)\n\n // update the custom indexes\n const indexes = this.indexes ?? []\n for (const index of indexes) {\n this.indexMaps[index] ??= []\n for (const payload of payloads) {\n this.indexMaps[index].push(payload)\n }\n }\n return assertEx(payloads.at(-1), () => 'No payloads to index')._sequence\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AACA;AAAA,EACE;AAAA,EAAU;AAAA,EAAU;AAAA,EACpB;AAAA,EAAc;AAAA,EAAc;AAAA,OACvB;AACP,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,OAIK;AACP,SAAS,aAAa;AACtB,YAAY,OAAO;AAInB,SAAS,sBAAsB;AAO/B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,SAAS;AAC3B,WAAK,UAAU,KAAK,MAAM,CAAC;AAC3B,iBAAW,WAAW,UAAU;AAC9B,aAAK,UAAU,KAAK,EAAE,KAAK,OAAO;AAAA,MACpC;AAAA,IACF;AACA,WAAO,SAAS,SAAS,GAAG,EAAE,GAAG,MAAM,sBAAsB,EAAE;AAAA,EACjE;AACF;AA7IE,cAVW,uBAUc,iBAA0B,CAAC,GAAG,yDAAM,kBAAe,iCAAiC;AAC7G,cAXW,uBAWc,uBAA8B;AAX5C,wBAAN;AAAA,EADN,gBAAgB;AAAA,GACJ;",
|
|
6
6
|
"names": ["filter", "prop"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
4
|
+
var __reflectGet = Reflect.get;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
7
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
8
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9
|
+
if (decorator = decorators[i])
|
|
10
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
11
|
+
if (kind && result) __defProp(target, key, result);
|
|
12
|
+
return result;
|
|
13
|
+
};
|
|
14
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15
|
+
var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
|
|
16
|
+
|
|
1
17
|
// src/modules/diviner-wrapper/DivinerWrapper.ts
|
|
2
18
|
import {
|
|
3
19
|
DivinerDivineQuerySchema,
|
|
@@ -5,11 +21,7 @@ import {
|
|
|
5
21
|
isDivinerModule
|
|
6
22
|
} from "#diviner-model";
|
|
7
23
|
import { constructableModuleWrapper, ModuleWrapper } from "#module-wrapper";
|
|
8
|
-
constructableModuleWrapper();
|
|
9
24
|
var DivinerWrapper = class extends ModuleWrapper {
|
|
10
|
-
static instanceIdentityCheck = isDivinerInstance;
|
|
11
|
-
static moduleIdentityCheck = isDivinerModule;
|
|
12
|
-
static requiredQueries = [DivinerDivineQuerySchema, ...super.requiredQueries];
|
|
13
25
|
async divine(payloads, _retryConfig) {
|
|
14
26
|
const queryPayload = { schema: DivinerDivineQuerySchema };
|
|
15
27
|
return await this.sendQuery(queryPayload, payloads);
|
|
@@ -19,6 +31,12 @@ var DivinerWrapper = class extends ModuleWrapper {
|
|
|
19
31
|
return await this.sendQueryRaw(queryPayload, payloads, account);
|
|
20
32
|
}
|
|
21
33
|
};
|
|
34
|
+
__publicField(DivinerWrapper, "instanceIdentityCheck", isDivinerInstance);
|
|
35
|
+
__publicField(DivinerWrapper, "moduleIdentityCheck", isDivinerModule);
|
|
36
|
+
__publicField(DivinerWrapper, "requiredQueries", [DivinerDivineQuerySchema, ...__superGet(DivinerWrapper, DivinerWrapper, "requiredQueries")]);
|
|
37
|
+
DivinerWrapper = __decorateClass([
|
|
38
|
+
constructableModuleWrapper()
|
|
39
|
+
], DivinerWrapper);
|
|
22
40
|
export {
|
|
23
41
|
DivinerWrapper
|
|
24
42
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/modules/diviner-wrapper/DivinerWrapper.ts"],
|
|
4
|
-
"sourcesContent": ["import type { RetryConfig, TypeCheck } from '@ariestools/sdk'\nimport type {\n AccountInstance,\n Payload, WithoutPrivateStorageMeta, WithSources,\n} from '@xyo-network/sdk-protocol'\n\nimport type {\n DivinerConfig,\n DivinerDivineQuery,\n DivinerInstance,\n DivinerModule,\n DivinerModuleEventData,\n DivinerParams,\n} from '#diviner-model'\nimport {\n DivinerDivineQuerySchema,\n isDivinerInstance,\n isDivinerModule,\n} from '#diviner-model'\nimport type { AnyConfigSchema, ModuleQueryResult } from '#module-model'\nimport { constructableModuleWrapper, ModuleWrapper } from '#module-wrapper'\n\
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { RetryConfig, TypeCheck } from '@ariestools/sdk'\nimport type {\n AccountInstance,\n Payload, WithoutPrivateStorageMeta, WithSources,\n} from '@xyo-network/sdk-protocol'\n\nimport type {\n DivinerConfig,\n DivinerDivineQuery,\n DivinerInstance,\n DivinerModule,\n DivinerModuleEventData,\n DivinerParams,\n} from '#diviner-model'\nimport {\n DivinerDivineQuerySchema,\n isDivinerInstance,\n isDivinerModule,\n} from '#diviner-model'\nimport type { AnyConfigSchema, ModuleQueryResult } from '#module-model'\nimport { constructableModuleWrapper, ModuleWrapper } from '#module-wrapper'\n\n@constructableModuleWrapper()\nexport class DivinerWrapper<TWrappedModule extends DivinerModule<DivinerParams>, TIn extends Payload = Payload, TOut extends Payload = Payload>\n extends ModuleWrapper<TWrappedModule>\n implements DivinerInstance<TWrappedModule['params'], TIn, TOut> {\n static override readonly instanceIdentityCheck: TypeCheck<DivinerInstance<DivinerParams<AnyConfigSchema<DivinerConfig>>, Payload, Payload, DivinerModuleEventData>> = isDivinerInstance\n static override readonly moduleIdentityCheck: TypeCheck<DivinerModule<DivinerParams<AnyConfigSchema<DivinerConfig>>, DivinerModuleEventData>> = isDivinerModule\n static override readonly requiredQueries: string[] = [DivinerDivineQuerySchema, ...super.requiredQueries]\n\n async divine(payloads?: TIn[], _retryConfig?: RetryConfig): Promise<WithoutPrivateStorageMeta<WithSources<TOut>>[]> {\n const queryPayload: DivinerDivineQuery = { schema: DivinerDivineQuerySchema }\n return await this.sendQuery(queryPayload, payloads)\n }\n\n async divineQuery(payloads?: TIn[], account?: AccountInstance, _retryConfig?: RetryConfig): Promise<ModuleQueryResult<TOut>> {\n const queryPayload: DivinerDivineQuery = { schema: DivinerDivineQuerySchema }\n return await this.sendQueryRaw(queryPayload, payloads, account)\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAcA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,SAAS,4BAA4B,qBAAqB;AAGnD,IAAM,iBAAN,cACG,cACwD;AAAA,EAKhE,MAAM,OAAO,UAAkB,cAAqF;AAClH,UAAM,eAAmC,EAAE,QAAQ,yBAAyB;AAC5E,WAAO,MAAM,KAAK,UAAU,cAAc,QAAQ;AAAA,EACpD;AAAA,EAEA,MAAM,YAAY,UAAkB,SAA2B,cAA8D;AAC3H,UAAM,eAAmC,EAAE,QAAQ,yBAAyB;AAC5E,WAAO,MAAM,KAAK,aAAa,cAAc,UAAU,OAAO;AAAA,EAChE;AACF;AAbE,cAHW,gBAGc,yBAA6I;AACtK,cAJW,gBAIc,uBAAuH;AAChJ,cALW,gBAKc,mBAA4B,CAAC,0BAA0B,GAAG,2CAAM,kBAAe;AAL7F,iBAAN;AAAA,EADN,2BAA2B;AAAA,GACf;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -40,8 +40,9 @@ var ManifestWrapper = class extends PayloadWrapper {
|
|
|
40
40
|
await node.register(childNode);
|
|
41
41
|
await node.attach(childNode.address, external);
|
|
42
42
|
} else {
|
|
43
|
+
const registeredModule = await this.registerModule(wallet, node, manifest);
|
|
43
44
|
assertEx(
|
|
44
|
-
await node.attach(
|
|
45
|
+
await node.attach(registeredModule.address, external),
|
|
45
46
|
() => `No module with config schema [${manifest.config.name}] registered`
|
|
46
47
|
);
|
|
47
48
|
}
|
|
@@ -165,8 +166,9 @@ var ManifestWrapperEx = class extends PayloadWrapper2 {
|
|
|
165
166
|
if (node.registeredModules().some((mod) => isString2(mod.config.name) && mod.config.name === manifest.config.name)) {
|
|
166
167
|
assertEx2(await node.attach(manifest.config.name, external), () => `Failed to attach module [${manifest.config.name}]`);
|
|
167
168
|
} else {
|
|
169
|
+
const registeredModule = await this.registerModule(wallet, node, manifest);
|
|
168
170
|
assertEx2(
|
|
169
|
-
await node.attach(
|
|
171
|
+
await node.attach(registeredModule.address, external),
|
|
170
172
|
() => `No module with config schema [${manifest.config.name}] registered`
|
|
171
173
|
);
|
|
172
174
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/modules/manifest-wrapper/Wrapper.ts", "../../src/modules/manifest-wrapper/WrapperEx.ts"],
|
|
4
|
-
"sourcesContent": ["import type { CreatableName, Logger } from '@ariestools/sdk'\nimport {\n assertEx, isDefined, isString,\n} from '@ariestools/sdk'\nimport type {\n ModuleManifest, NodeManifest, PackageManifestPayload, WalletInstance,\n WithAnySchema,\n} from '@xyo-network/sdk-protocol'\nimport { HDWallet, PayloadWrapper } from '@xyo-network/sdk-protocol'\n\nimport type {\n ModuleFactoryLocatorInstance,\n ModuleIdentifierTransformer, ModuleInstance, QueryableModuleParams,\n} from '#module-model'\nimport { isModuleName } from '#module-model'\nimport { MemoryNode } from '#node-memory'\nimport type { NodeInstance } from '#node-model'\n\n/** Provides functionality that can be performed on a PackageManifest */\nexport class ManifestWrapper<TManifest extends WithAnySchema<PackageManifestPayload> | void = void> extends PayloadWrapper<\n TManifest extends WithAnySchema<PackageManifestPayload> ? TManifest : WithAnySchema<PackageManifestPayload>\n> {\n protected readonly locator: ModuleFactoryLocatorInstance\n protected readonly logger: Logger | undefined\n protected readonly moduleIdentifierTransformers: ModuleIdentifierTransformer[] | undefined\n protected readonly privateChildren: ModuleManifest[]\n protected readonly publicChildren: ModuleManifest[]\n protected readonly wallet: WalletInstance\n\n constructor(\n payload: TManifest extends WithAnySchema<PackageManifestPayload> ? TManifest : WithAnySchema<PackageManifestPayload>,\n wallet: WalletInstance,\n locator: ModuleFactoryLocatorInstance,\n publicChildren: ModuleManifest[] = [],\n privateChildren: ModuleManifest[] = [],\n moduleIdentifierTransformers?: ModuleIdentifierTransformer[],\n logger?: Logger,\n ) {\n super(payload)\n this.wallet = wallet\n this.locator = locator\n this.publicChildren = publicChildren\n this.privateChildren = privateChildren\n this.moduleIdentifierTransformers = moduleIdentifierTransformers\n this.logger = logger\n }\n\n async loadModule(wallet: WalletInstance, node: MemoryNode, manifest: ModuleManifest, external = true): Promise<void> {\n this.logger?.log('loadModule', manifest.config.name)\n const collision = async (node: NodeInstance, name: string, external: boolean) => {\n const externalConflict = external ? (await node.resolve(name, { direction: external ? 'all' : 'down' })) !== undefined : false\n return externalConflict || (await node.resolve(name, { direction: 'down' })) !== undefined\n }\n\n assertEx(isModuleName(manifest.config.name), () => `Invalid Module Name: ${manifest.config.name}`)\n assertEx(!(await collision(node, manifest.config.name, external)), () => `Node name collision [${manifest.config.name}]`)\n\n if (!(await collision(node, manifest.config.name, external))) {\n // is it already registered?\n if (node.registeredModules().some(mod => isDefined(mod.config.name) && mod.config.name === manifest.config.name)) {\n assertEx(await node.attach(manifest.config.name, external), () => `Failed to attach module [${manifest.config.name}]`)\n } else {\n if ((manifest as NodeManifest).modules) {\n const childNode = await this.loadNodeFromManifest(wallet, manifest, manifest.config.accountPath, false)\n await node.register(childNode)\n await node.attach(childNode.address, external)\n } else {\n assertEx(\n await node.attach((await this.registerModule(wallet, node, manifest)).address, external),\n () => `No module with config schema [${manifest.config.name}] registered`,\n )\n }\n }\n }\n }\n\n // These are top level, so they can use this.wallet as their\n async loadNodeFromIndex(index: number): Promise<MemoryNode> {\n const manifest = assertEx(this.nodeManifest(index), () => 'Failed to find Node Manifest')\n return await this.loadNodeFromManifest(this.wallet, manifest, manifest.config.accountPath ?? `${index}'`)\n }\n\n async loadNodeFromManifest(wallet: WalletInstance, manifest: NodeManifest, path?: string, loadConfigChildren = false): Promise<MemoryNode> {\n this.logger?.log('loadNodeFromManifest', manifest.config.name)\n const derivedWallet = isString(path) ? await wallet.derivePath(path) : await HDWallet.random()\n const node = await MemoryNode.create({\n account: derivedWallet, config: manifest.config, name: manifest.config.name as CreatableName,\n })\n // Load Private Modules\n const privateModules\n = manifest.modules?.private?.map(async (moduleManifest) => {\n if (typeof moduleManifest === 'object') {\n await this.loadModule(derivedWallet, node, moduleManifest, false)\n }\n }) ?? []\n // Load Public Modules\n const publicModules\n = manifest.modules?.public?.map(async (moduleManifest) => {\n if (typeof moduleManifest === 'object') {\n await this.loadModule(derivedWallet, node, moduleManifest, true)\n }\n }) ?? []\n await Promise.all([...privateModules, ...publicModules])\n\n if (loadConfigChildren) {\n await Promise.all(\n this.privateChildren.map(async (moduleManifest) => {\n if (typeof moduleManifest === 'object') {\n await this.loadModule(derivedWallet, node, moduleManifest, false)\n }\n }),\n )\n\n await Promise.all(\n this.publicChildren.map(async (moduleManifest) => {\n if (typeof moduleManifest === 'object') {\n await this.loadModule(derivedWallet, node, moduleManifest, true)\n }\n }),\n )\n }\n\n return node\n }\n\n /**\n * Load the nodes that are defined in the wrapped manifest and optionally attach them to a node\n */\n async loadNodes(node?: MemoryNode): Promise<MemoryNode[]> {\n return await Promise.all(\n this.payload.nodes?.map(async (nodeManifest, index) => {\n const subNode = await this.loadNodeFromManifest(this.wallet, nodeManifest as NodeManifest, nodeManifest.config.accountPath ?? `${index}'`, index === 0)\n await node?.register(subNode)\n return subNode\n }),\n )\n }\n\n nodeManifest(index: number): NodeManifest | undefined {\n return this.payload.nodes?.[index] as NodeManifest | undefined\n }\n\n /** Register a module on a node based on a manifest */\n private async registerModule(wallet: WalletInstance, node: MemoryNode, manifest: ModuleManifest): Promise<ModuleInstance> {\n const creatableModule = this.locator.locate(manifest.config.schema, manifest.config.labels)\n const path = manifest.config.accountPath\n const account = isString(path) ? await wallet.derivePath(path) : 'random'\n const params: QueryableModuleParams = {\n name: manifest.config.name as CreatableName,\n account,\n config: assertEx(manifest.config, () => 'Missing config'),\n }\n if (this.moduleIdentifierTransformers) {\n params.moduleIdentifierTransformers = this.moduleIdentifierTransformers\n }\n const mod = await creatableModule.create(params)\n await node.register(mod)\n return mod\n }\n}\n", "import type { CreatableName } from '@ariestools/sdk'\nimport {\n assertEx, isArray, isString,\n} from '@ariestools/sdk'\nimport type {\n ModuleManifest, NodeManifest, PackageManifestPayload, WalletInstance,\n WithAnySchema,\n} from '@xyo-network/sdk-protocol'\nimport { HDWallet, PayloadWrapper } from '@xyo-network/sdk-protocol'\n\nimport type {\n ModuleFactoryLocatorInstance,\n ModuleIdentifierTransformer, ModuleInstance, QueryableModuleParams,\n} from '#module-model'\nimport { isModuleName } from '#module-model'\nimport { MemoryNode } from '#node-memory'\nimport type { NodeInstance } from '#node-model'\n\nexport interface ManifestWrapperExParams {\n locator: ModuleFactoryLocatorInstance\n moduleIdentifierTransformers?: ModuleIdentifierTransformer[]\n privateChildren?: ModuleManifest[]\n publicChildren?: ModuleManifest[]\n wallet: WalletInstance\n}\n\n/** Provides functionality that can be performed on a PackageManifest */\nexport class ManifestWrapperEx<\n TManifest extends WithAnySchema<PackageManifestPayload> | void,\n TParams extends ManifestWrapperExParams = ManifestWrapperExParams,\n> extends PayloadWrapper<TManifest extends WithAnySchema<PackageManifestPayload> ? TManifest : WithAnySchema<PackageManifestPayload>> {\n protected params: TParams\n constructor(\n payload: TManifest extends WithAnySchema<PackageManifestPayload> ? TManifest : WithAnySchema<PackageManifestPayload>,\n params: TParams,\n ) {\n super(payload)\n this.params = params\n }\n\n get locator(): ModuleFactoryLocatorInstance {\n return this.params.locator\n }\n\n get moduleIdentifierTransformers(): ModuleIdentifierTransformer[] {\n return this.params.moduleIdentifierTransformers ?? []\n }\n\n get privateChildren(): ModuleManifest[] {\n return this.params.privateChildren ?? []\n }\n\n get publicChildren(): ModuleManifest[] {\n return this.params.publicChildren ?? []\n }\n\n get wallet(): WalletInstance {\n return this.params.wallet\n }\n\n async loadModule(wallet: WalletInstance, node: MemoryNode, manifest: ModuleManifest, external = true): Promise<void> {\n const collision = async (node: NodeInstance, name: string, external: boolean) => {\n const externalConflict = external ? (await node.resolve(name, { direction: external ? 'all' : 'down' })) !== undefined : false\n return externalConflict || (await node.resolve(name, { direction: 'down' })) !== undefined\n }\n\n assertEx(isModuleName(manifest.config.name), () => `Invalid Module Name: ${manifest.config.name}`)\n assertEx(!(await collision(node, manifest.config.name, external)), () => `Node name collision [${manifest.config.name}]`)\n\n if (!(await collision(node, manifest.config.name, external))) {\n // is it already registered?\n if (node.registeredModules().some(mod => isString(mod.config.name) && mod.config.name === manifest.config.name)) {\n assertEx(await node.attach(manifest.config.name, external), () => `Failed to attach module [${manifest.config.name}]`)\n } else {\n assertEx(\n await node.attach((await this.registerModule(wallet, node, manifest)).address, external),\n () => `No module with config schema [${manifest.config.name}] registered`,\n )\n }\n }\n }\n\n // These are top level, so they can use this.wallet as their\n async loadNodeFromIndex(index: number): Promise<MemoryNode> {\n const manifest = assertEx(this.nodeManifest(index), () => 'Failed to find Node Manifest')\n return await this.loadNodeFromManifest(this.wallet, manifest, manifest.config.accountPath ?? `${index}'`)\n }\n\n async loadNodeFromManifest(wallet: WalletInstance, manifest: NodeManifest, path?: string): Promise<MemoryNode> {\n const derivedWallet = isString(path) ? await wallet.derivePath(path) : await HDWallet.random()\n const node = await MemoryNode.create({ account: derivedWallet, config: manifest.config })\n // Load Private Modules\n const privateModules\n = manifest.modules?.private?.map(async (moduleManifest) => {\n if (typeof moduleManifest === 'object') {\n await this.loadModule(derivedWallet, node, moduleManifest, false)\n }\n }) ?? []\n // Load Public Modules\n const publicModules\n = manifest.modules?.public?.map(async (moduleManifest) => {\n if (typeof moduleManifest === 'object') {\n await this.loadModule(derivedWallet, node, moduleManifest, true)\n }\n }) ?? []\n await Promise.all([...privateModules, ...publicModules])\n\n await Promise.all(\n this.privateChildren.map(async (moduleManifest) => {\n if (typeof moduleManifest === 'object') {\n await this.loadModule(derivedWallet, node, moduleManifest, false)\n }\n }),\n )\n\n await Promise.all(\n this.publicChildren.map(async (moduleManifest) => {\n if (typeof moduleManifest === 'object') {\n await this.loadModule(derivedWallet, node, moduleManifest, true)\n }\n }),\n )\n\n return node\n }\n\n /**\n * Load the nodes that are defined in the wrapped manifest and optionally attach them to a node\n */\n async loadNodes(node?: MemoryNode): Promise<MemoryNode[]> {\n return await Promise.all(\n this.payload.nodes?.map(async (nodeManifest, index) => {\n const subNode = await this.loadNodeFromManifest(this.wallet, nodeManifest as NodeManifest, nodeManifest.config.accountPath ?? `${index}'`)\n await node?.register(subNode)\n return subNode\n }),\n )\n }\n\n nodeManifest(index: number): NodeManifest | undefined {\n return this.payload.nodes?.[index] as NodeManifest | undefined\n }\n\n /** Register a module on a node based on a manifest */\n private async registerModule(wallet: WalletInstance, node: MemoryNode, manifest: ModuleManifest): Promise<ModuleInstance> {\n const creatableModule = this.locator.locate(manifest.config.schema, manifest.config.labels)\n const path = manifest.config.accountPath\n const account = isString(path) ? await wallet.derivePath(path) : 'random'\n const params: QueryableModuleParams = {\n name: manifest.config.name as CreatableName,\n account,\n config: assertEx(manifest.config, () => 'Missing config'),\n }\n if (isArray(this.moduleIdentifierTransformers)) {\n params.moduleIdentifierTransformers = this.moduleIdentifierTransformers\n }\n const mod = await creatableModule.create(params)\n await node.register(mod)\n return mod\n }\n}\n"],
|
|
5
|
-
"mappings": ";AACA;AAAA,EACE;AAAA,EAAU;AAAA,EAAW;AAAA,OAChB;AAKP,SAAS,UAAU,sBAAsB;AAMzC,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAIpB,IAAM,kBAAN,cAAqG,eAE1G;AAAA,EACmB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEnB,YACE,SACA,QACA,SACA,iBAAmC,CAAC,GACpC,kBAAoC,CAAC,GACrC,8BACA,QACA;AACA,UAAM,OAAO;AACb,SAAK,SAAS;AACd,SAAK,UAAU;AACf,SAAK,iBAAiB;AACtB,SAAK,kBAAkB;AACvB,SAAK,+BAA+B;AACpC,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,MAAM,WAAW,QAAwB,MAAkB,UAA0B,WAAW,MAAqB;AACnH,SAAK,QAAQ,IAAI,cAAc,SAAS,OAAO,IAAI;AACnD,UAAM,YAAY,OAAOA,OAAoB,MAAcC,cAAsB;AAC/E,YAAM,mBAAmBA,YAAY,MAAMD,MAAK,QAAQ,MAAM,EAAE,WAAWC,YAAW,QAAQ,OAAO,CAAC,MAAO,SAAY;AACzH,aAAO,oBAAqB,MAAMD,MAAK,QAAQ,MAAM,EAAE,WAAW,OAAO,CAAC,MAAO;AAAA,IACnF;AAEA,aAAS,aAAa,SAAS,OAAO,IAAI,GAAG,MAAM,wBAAwB,SAAS,OAAO,IAAI,EAAE;AACjG,aAAS,CAAE,MAAM,UAAU,MAAM,SAAS,OAAO,MAAM,QAAQ,GAAI,MAAM,wBAAwB,SAAS,OAAO,IAAI,GAAG;AAExH,QAAI,CAAE,MAAM,UAAU,MAAM,SAAS,OAAO,MAAM,QAAQ,GAAI;AAE5D,UAAI,KAAK,kBAAkB,EAAE,KAAK,SAAO,UAAU,IAAI,OAAO,IAAI,KAAK,IAAI,OAAO,SAAS,SAAS,OAAO,IAAI,GAAG;AAChH,iBAAS,MAAM,KAAK,OAAO,SAAS,OAAO,MAAM,QAAQ,GAAG,MAAM,4BAA4B,SAAS,OAAO,IAAI,GAAG;AAAA,MACvH,OAAO;AACL,YAAK,SAA0B,SAAS;AACtC,gBAAM,YAAY,MAAM,KAAK,qBAAqB,QAAQ,UAAU,SAAS,OAAO,aAAa,KAAK;AACtG,gBAAM,KAAK,SAAS,SAAS;AAC7B,gBAAM,KAAK,OAAO,UAAU,SAAS,QAAQ;AAAA,QAC/C,OAAO;AACL
|
|
4
|
+
"sourcesContent": ["import type { CreatableName, Logger } from '@ariestools/sdk'\nimport {\n assertEx, isDefined, isString,\n} from '@ariestools/sdk'\nimport type {\n ModuleManifest, NodeManifest, PackageManifestPayload, WalletInstance,\n WithAnySchema,\n} from '@xyo-network/sdk-protocol'\nimport { HDWallet, PayloadWrapper } from '@xyo-network/sdk-protocol'\n\nimport type {\n ModuleFactoryLocatorInstance,\n ModuleIdentifierTransformer, ModuleInstance, QueryableModuleParams,\n} from '#module-model'\nimport { isModuleName } from '#module-model'\nimport { MemoryNode } from '#node-memory'\nimport type { NodeInstance } from '#node-model'\n\n/** Provides functionality that can be performed on a PackageManifest */\nexport class ManifestWrapper<TManifest extends WithAnySchema<PackageManifestPayload> | void = void> extends PayloadWrapper<\n TManifest extends WithAnySchema<PackageManifestPayload> ? TManifest : WithAnySchema<PackageManifestPayload>\n> {\n protected readonly locator: ModuleFactoryLocatorInstance\n protected readonly logger: Logger | undefined\n protected readonly moduleIdentifierTransformers: ModuleIdentifierTransformer[] | undefined\n protected readonly privateChildren: ModuleManifest[]\n protected readonly publicChildren: ModuleManifest[]\n protected readonly wallet: WalletInstance\n\n constructor(\n payload: TManifest extends WithAnySchema<PackageManifestPayload> ? TManifest : WithAnySchema<PackageManifestPayload>,\n wallet: WalletInstance,\n locator: ModuleFactoryLocatorInstance,\n publicChildren: ModuleManifest[] = [],\n privateChildren: ModuleManifest[] = [],\n moduleIdentifierTransformers?: ModuleIdentifierTransformer[],\n logger?: Logger,\n ) {\n super(payload)\n this.wallet = wallet\n this.locator = locator\n this.publicChildren = publicChildren\n this.privateChildren = privateChildren\n this.moduleIdentifierTransformers = moduleIdentifierTransformers\n this.logger = logger\n }\n\n async loadModule(wallet: WalletInstance, node: MemoryNode, manifest: ModuleManifest, external = true): Promise<void> {\n this.logger?.log('loadModule', manifest.config.name)\n const collision = async (node: NodeInstance, name: string, external: boolean) => {\n const externalConflict = external ? (await node.resolve(name, { direction: external ? 'all' : 'down' })) !== undefined : false\n return externalConflict || (await node.resolve(name, { direction: 'down' })) !== undefined\n }\n\n assertEx(isModuleName(manifest.config.name), () => `Invalid Module Name: ${manifest.config.name}`)\n assertEx(!(await collision(node, manifest.config.name, external)), () => `Node name collision [${manifest.config.name}]`)\n\n if (!(await collision(node, manifest.config.name, external))) {\n // is it already registered?\n if (node.registeredModules().some(mod => isDefined(mod.config.name) && mod.config.name === manifest.config.name)) {\n assertEx(await node.attach(manifest.config.name, external), () => `Failed to attach module [${manifest.config.name}]`)\n } else {\n if ((manifest as NodeManifest).modules) {\n const childNode = await this.loadNodeFromManifest(wallet, manifest, manifest.config.accountPath, false)\n await node.register(childNode)\n await node.attach(childNode.address, external)\n } else {\n const registeredModule = await this.registerModule(wallet, node, manifest)\n assertEx(\n await node.attach(registeredModule.address, external),\n () => `No module with config schema [${manifest.config.name}] registered`,\n )\n }\n }\n }\n }\n\n // These are top level, so they can use this.wallet as their\n async loadNodeFromIndex(index: number): Promise<MemoryNode> {\n const manifest = assertEx(this.nodeManifest(index), () => 'Failed to find Node Manifest')\n return await this.loadNodeFromManifest(this.wallet, manifest, manifest.config.accountPath ?? `${index}'`)\n }\n\n async loadNodeFromManifest(wallet: WalletInstance, manifest: NodeManifest, path?: string, loadConfigChildren = false): Promise<MemoryNode> {\n this.logger?.log('loadNodeFromManifest', manifest.config.name)\n const derivedWallet = isString(path) ? await wallet.derivePath(path) : await HDWallet.random()\n const node = await MemoryNode.create({\n account: derivedWallet, config: manifest.config, name: manifest.config.name as CreatableName,\n })\n // Load Private Modules\n const privateModules\n = manifest.modules?.private?.map(async (moduleManifest) => {\n if (typeof moduleManifest === 'object') {\n await this.loadModule(derivedWallet, node, moduleManifest, false)\n }\n }) ?? []\n // Load Public Modules\n const publicModules\n = manifest.modules?.public?.map(async (moduleManifest) => {\n if (typeof moduleManifest === 'object') {\n await this.loadModule(derivedWallet, node, moduleManifest, true)\n }\n }) ?? []\n await Promise.all([...privateModules, ...publicModules])\n\n if (loadConfigChildren) {\n await Promise.all(\n this.privateChildren.map(async (moduleManifest) => {\n if (typeof moduleManifest === 'object') {\n await this.loadModule(derivedWallet, node, moduleManifest, false)\n }\n }),\n )\n\n await Promise.all(\n this.publicChildren.map(async (moduleManifest) => {\n if (typeof moduleManifest === 'object') {\n await this.loadModule(derivedWallet, node, moduleManifest, true)\n }\n }),\n )\n }\n\n return node\n }\n\n /**\n * Load the nodes that are defined in the wrapped manifest and optionally attach them to a node\n */\n async loadNodes(node?: MemoryNode): Promise<MemoryNode[]> {\n return await Promise.all(\n this.payload.nodes?.map(async (nodeManifest, index) => {\n const subNode = await this.loadNodeFromManifest(this.wallet, nodeManifest as NodeManifest, nodeManifest.config.accountPath ?? `${index}'`, index === 0)\n await node?.register(subNode)\n return subNode\n }),\n )\n }\n\n nodeManifest(index: number): NodeManifest | undefined {\n return this.payload.nodes?.[index] as NodeManifest | undefined\n }\n\n /** Register a module on a node based on a manifest */\n private async registerModule(wallet: WalletInstance, node: MemoryNode, manifest: ModuleManifest): Promise<ModuleInstance> {\n const creatableModule = this.locator.locate(manifest.config.schema, manifest.config.labels)\n const path = manifest.config.accountPath\n const account = isString(path) ? await wallet.derivePath(path) : 'random'\n const params: QueryableModuleParams = {\n name: manifest.config.name as CreatableName,\n account,\n config: assertEx(manifest.config, () => 'Missing config'),\n }\n if (this.moduleIdentifierTransformers) {\n params.moduleIdentifierTransformers = this.moduleIdentifierTransformers\n }\n const mod = await creatableModule.create(params)\n await node.register(mod)\n return mod\n }\n}\n", "import type { CreatableName } from '@ariestools/sdk'\nimport {\n assertEx, isArray, isString,\n} from '@ariestools/sdk'\nimport type {\n ModuleManifest, NodeManifest, PackageManifestPayload, WalletInstance,\n WithAnySchema,\n} from '@xyo-network/sdk-protocol'\nimport { HDWallet, PayloadWrapper } from '@xyo-network/sdk-protocol'\n\nimport type {\n ModuleFactoryLocatorInstance,\n ModuleIdentifierTransformer, ModuleInstance, QueryableModuleParams,\n} from '#module-model'\nimport { isModuleName } from '#module-model'\nimport { MemoryNode } from '#node-memory'\nimport type { NodeInstance } from '#node-model'\n\nexport interface ManifestWrapperExParams {\n locator: ModuleFactoryLocatorInstance\n moduleIdentifierTransformers?: ModuleIdentifierTransformer[]\n privateChildren?: ModuleManifest[]\n publicChildren?: ModuleManifest[]\n wallet: WalletInstance\n}\n\n/** Provides functionality that can be performed on a PackageManifest */\nexport class ManifestWrapperEx<\n TManifest extends WithAnySchema<PackageManifestPayload> | void,\n TParams extends ManifestWrapperExParams = ManifestWrapperExParams,\n> extends PayloadWrapper<TManifest extends WithAnySchema<PackageManifestPayload> ? TManifest : WithAnySchema<PackageManifestPayload>> {\n protected params: TParams\n constructor(\n payload: TManifest extends WithAnySchema<PackageManifestPayload> ? TManifest : WithAnySchema<PackageManifestPayload>,\n params: TParams,\n ) {\n super(payload)\n this.params = params\n }\n\n get locator(): ModuleFactoryLocatorInstance {\n return this.params.locator\n }\n\n get moduleIdentifierTransformers(): ModuleIdentifierTransformer[] {\n return this.params.moduleIdentifierTransformers ?? []\n }\n\n get privateChildren(): ModuleManifest[] {\n return this.params.privateChildren ?? []\n }\n\n get publicChildren(): ModuleManifest[] {\n return this.params.publicChildren ?? []\n }\n\n get wallet(): WalletInstance {\n return this.params.wallet\n }\n\n async loadModule(wallet: WalletInstance, node: MemoryNode, manifest: ModuleManifest, external = true): Promise<void> {\n const collision = async (node: NodeInstance, name: string, external: boolean) => {\n const externalConflict = external ? (await node.resolve(name, { direction: external ? 'all' : 'down' })) !== undefined : false\n return externalConflict || (await node.resolve(name, { direction: 'down' })) !== undefined\n }\n\n assertEx(isModuleName(manifest.config.name), () => `Invalid Module Name: ${manifest.config.name}`)\n assertEx(!(await collision(node, manifest.config.name, external)), () => `Node name collision [${manifest.config.name}]`)\n\n if (!(await collision(node, manifest.config.name, external))) {\n // is it already registered?\n if (node.registeredModules().some(mod => isString(mod.config.name) && mod.config.name === manifest.config.name)) {\n assertEx(await node.attach(manifest.config.name, external), () => `Failed to attach module [${manifest.config.name}]`)\n } else {\n const registeredModule = await this.registerModule(wallet, node, manifest)\n assertEx(\n await node.attach(registeredModule.address, external),\n () => `No module with config schema [${manifest.config.name}] registered`,\n )\n }\n }\n }\n\n // These are top level, so they can use this.wallet as their\n async loadNodeFromIndex(index: number): Promise<MemoryNode> {\n const manifest = assertEx(this.nodeManifest(index), () => 'Failed to find Node Manifest')\n return await this.loadNodeFromManifest(this.wallet, manifest, manifest.config.accountPath ?? `${index}'`)\n }\n\n async loadNodeFromManifest(wallet: WalletInstance, manifest: NodeManifest, path?: string): Promise<MemoryNode> {\n const derivedWallet = isString(path) ? await wallet.derivePath(path) : await HDWallet.random()\n const node = await MemoryNode.create({ account: derivedWallet, config: manifest.config })\n // Load Private Modules\n const privateModules\n = manifest.modules?.private?.map(async (moduleManifest) => {\n if (typeof moduleManifest === 'object') {\n await this.loadModule(derivedWallet, node, moduleManifest, false)\n }\n }) ?? []\n // Load Public Modules\n const publicModules\n = manifest.modules?.public?.map(async (moduleManifest) => {\n if (typeof moduleManifest === 'object') {\n await this.loadModule(derivedWallet, node, moduleManifest, true)\n }\n }) ?? []\n await Promise.all([...privateModules, ...publicModules])\n\n await Promise.all(\n this.privateChildren.map(async (moduleManifest) => {\n if (typeof moduleManifest === 'object') {\n await this.loadModule(derivedWallet, node, moduleManifest, false)\n }\n }),\n )\n\n await Promise.all(\n this.publicChildren.map(async (moduleManifest) => {\n if (typeof moduleManifest === 'object') {\n await this.loadModule(derivedWallet, node, moduleManifest, true)\n }\n }),\n )\n\n return node\n }\n\n /**\n * Load the nodes that are defined in the wrapped manifest and optionally attach them to a node\n */\n async loadNodes(node?: MemoryNode): Promise<MemoryNode[]> {\n return await Promise.all(\n this.payload.nodes?.map(async (nodeManifest, index) => {\n const subNode = await this.loadNodeFromManifest(this.wallet, nodeManifest as NodeManifest, nodeManifest.config.accountPath ?? `${index}'`)\n await node?.register(subNode)\n return subNode\n }),\n )\n }\n\n nodeManifest(index: number): NodeManifest | undefined {\n return this.payload.nodes?.[index] as NodeManifest | undefined\n }\n\n /** Register a module on a node based on a manifest */\n private async registerModule(wallet: WalletInstance, node: MemoryNode, manifest: ModuleManifest): Promise<ModuleInstance> {\n const creatableModule = this.locator.locate(manifest.config.schema, manifest.config.labels)\n const path = manifest.config.accountPath\n const account = isString(path) ? await wallet.derivePath(path) : 'random'\n const params: QueryableModuleParams = {\n name: manifest.config.name as CreatableName,\n account,\n config: assertEx(manifest.config, () => 'Missing config'),\n }\n if (isArray(this.moduleIdentifierTransformers)) {\n params.moduleIdentifierTransformers = this.moduleIdentifierTransformers\n }\n const mod = await creatableModule.create(params)\n await node.register(mod)\n return mod\n }\n}\n"],
|
|
5
|
+
"mappings": ";AACA;AAAA,EACE;AAAA,EAAU;AAAA,EAAW;AAAA,OAChB;AAKP,SAAS,UAAU,sBAAsB;AAMzC,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAIpB,IAAM,kBAAN,cAAqG,eAE1G;AAAA,EACmB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEnB,YACE,SACA,QACA,SACA,iBAAmC,CAAC,GACpC,kBAAoC,CAAC,GACrC,8BACA,QACA;AACA,UAAM,OAAO;AACb,SAAK,SAAS;AACd,SAAK,UAAU;AACf,SAAK,iBAAiB;AACtB,SAAK,kBAAkB;AACvB,SAAK,+BAA+B;AACpC,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,MAAM,WAAW,QAAwB,MAAkB,UAA0B,WAAW,MAAqB;AACnH,SAAK,QAAQ,IAAI,cAAc,SAAS,OAAO,IAAI;AACnD,UAAM,YAAY,OAAOA,OAAoB,MAAcC,cAAsB;AAC/E,YAAM,mBAAmBA,YAAY,MAAMD,MAAK,QAAQ,MAAM,EAAE,WAAWC,YAAW,QAAQ,OAAO,CAAC,MAAO,SAAY;AACzH,aAAO,oBAAqB,MAAMD,MAAK,QAAQ,MAAM,EAAE,WAAW,OAAO,CAAC,MAAO;AAAA,IACnF;AAEA,aAAS,aAAa,SAAS,OAAO,IAAI,GAAG,MAAM,wBAAwB,SAAS,OAAO,IAAI,EAAE;AACjG,aAAS,CAAE,MAAM,UAAU,MAAM,SAAS,OAAO,MAAM,QAAQ,GAAI,MAAM,wBAAwB,SAAS,OAAO,IAAI,GAAG;AAExH,QAAI,CAAE,MAAM,UAAU,MAAM,SAAS,OAAO,MAAM,QAAQ,GAAI;AAE5D,UAAI,KAAK,kBAAkB,EAAE,KAAK,SAAO,UAAU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