@xyo-network/sdk 7.4.0 → 7.4.2
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.map +2 -2
- package/dist/neutral/archivist-abstract.mjs +196 -110
- package/dist/neutral/archivist-abstract.mjs.map +4 -4
- package/dist/neutral/archivist-generic.mjs +1 -1
- package/dist/neutral/archivist-generic.mjs.map +2 -2
- package/dist/neutral/archivist-memory.mjs +3 -1
- package/dist/neutral/archivist-memory.mjs.map +2 -2
- package/dist/neutral/archivist-model.mjs +4 -2
- package/dist/neutral/archivist-model.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 +2 -1
- package/dist/neutral/boundwitness-loader.mjs.map +2 -2
- package/dist/neutral/bridge-abstract.mjs +4 -3
- package/dist/neutral/bridge-abstract.mjs.map +2 -2
- package/dist/neutral/bridge-http.mjs +4 -5
- 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 +18 -3
- package/dist/neutral/bridge-wrapper.mjs.map +2 -2
- package/dist/neutral/bridge.mjs.map +2 -2
- package/dist/neutral/diviner-abstract.mjs +2 -1
- package/dist/neutral/diviner-abstract.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 +1 -2
- 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/module-abstract.mjs +57 -60
- package/dist/neutral/module-abstract.mjs.map +2 -2
- package/dist/neutral/module-factory-locator.mjs +4 -2
- package/dist/neutral/module-factory-locator.mjs.map +2 -2
- package/dist/neutral/module-resolver.mjs +30 -31
- package/dist/neutral/module-resolver.mjs.map +2 -2
- package/dist/neutral/module-wrapper.mjs +7 -4
- 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 +20 -1
- package/dist/neutral/modules/archivist-abstract/AbstractArchivist.d.ts.map +1 -1
- package/dist/neutral/modules/archivist-abstract/index.d.ts +1 -0
- package/dist/neutral/modules/archivist-abstract/index.d.ts.map +1 -1
- package/dist/neutral/modules/archivist-abstract/payloadAdmission.d.ts +13 -0
- package/dist/neutral/modules/archivist-abstract/payloadAdmission.d.ts.map +1 -0
- package/dist/neutral/modules/archivist-memory/MemoryDriver.d.ts.map +1 -1
- package/dist/neutral/modules/archivist-model/typeChecks.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-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/module-abstract/AbstractModule.d.ts +1 -3
- 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-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-resolver/ResolveHelper/ResolveHelper.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/NodeHelper/attachToExistingNode.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/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-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 +14 -6
- package/dist/neutral/node-abstract.mjs.map +2 -2
- package/dist/neutral/node-memory.mjs +8 -9
- 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 +11 -10
- package/dist/neutral/node-view.mjs.map +2 -2
- package/dist/neutral/node-wrapper.mjs +19 -4
- package/dist/neutral/node-wrapper.mjs.map +2 -2
- package/dist/neutral/sentinel-abstract.mjs +4 -4
- package/dist/neutral/sentinel-abstract.mjs.map +2 -2
- package/dist/neutral/sentinel-memory.mjs +17 -16
- 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-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 +20 -1
- package/dist/node/modules/archivist-abstract/AbstractArchivist.d.ts.map +1 -1
- package/dist/node/modules/archivist-abstract/index.d.ts +1 -0
- package/dist/node/modules/archivist-abstract/index.d.ts.map +1 -1
- package/dist/node/modules/archivist-abstract/payloadAdmission.d.ts +13 -0
- package/dist/node/modules/archivist-abstract/payloadAdmission.d.ts.map +1 -0
- package/dist/node/modules/archivist-memory/MemoryDriver.d.ts.map +1 -1
- package/dist/node/modules/archivist-model/typeChecks.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-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/module-abstract/AbstractModule.d.ts +1 -3
- 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-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-resolver/ResolveHelper/ResolveHelper.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/NodeHelper/attachToExistingNode.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/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-model/typeChecks.d.ts.map +1 -1
- package/dist/node/modules/witness-wrapper/WitnessWrapper.d.ts.map +1 -1
- package/package.json +11 -12
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/modules/node-memory/MemoryNode.ts", "../../src/modules/node-memory/NodeHelper/index.ts", "../../src/modules/node-memory/NodeHelper/attachToExistingNode.ts", "../../src/modules/node-memory/NodeHelper/flatAttachToExistingNode.ts", "../../src/modules/node-memory/NodeHelper/attachToNewNode.ts", "../../src/modules/node-memory/NodeHelper/flatAttachToNewNode.ts"],
|
|
4
|
-
"sourcesContent": ["import type { EventListener, Promisable } from '@ariestools/sdk'\nimport {\n assertEx,\n exists, isAddress, isDefined,\n} from '@ariestools/sdk'\nimport type { XyoAddress, XyoQuantAddress } from '@xyo-network/sdk-protocol'\nimport { Mutex } from 'async-mutex'\n\nimport {\n type AnyConfigSchema,\n type AttachableModuleInstance,\n creatableModule,\n type ModuleIdentifier,\n type ModuleInstance,\n type QueryableModule,\n} from '#module-model'\nimport { AbstractNode } from '#node-abstract'\nimport type {\n ChildCertificationFields,\n NodeConfig, NodeInstanceParams,\n NodeModuleEventData,\n} from '#node-model'\nimport { isNodeModule } from '#node-model'\n\nexport type MemoryNodeParams = NodeInstanceParams<AnyConfigSchema<NodeConfig>>\n\n@creatableModule()\nexport class MemoryNode<TParams extends MemoryNodeParams = MemoryNodeParams, TEventData extends NodeModuleEventData = NodeModuleEventData>\n extends AbstractNode<TParams, TEventData> {\n protected registeredModuleMap: Partial<Record<XyoAddress, AttachableModuleInstance>> = {}\n\n private _attachMutex = new Mutex()\n\n private _attachedPrivateModules = new Set<XyoAddress>()\n private _attachedPublicModules = new Set<XyoAddress>()\n\n async attachHandler(id: ModuleIdentifier, external?: boolean): Promise<(Lowercase<string> & {\n readonly __hex: true\n } & {\n readonly __address: true\n }) | XyoQuantAddress> {\n await this.startedAsync('warn', true)\n return assertEx(\n isAddress(id) ? await this.attachUsingAddress(id, external) : await this.attachUsingName(id, external),\n () => `Unable to locate module [${id}]`,\n )\n }\n\n async certifyHandler(id: ModuleIdentifier): Promise<ChildCertificationFields> {\n const child = (await this.publicChildren()).find(child => child.modName === id || child.address === id)\n if (child) {\n return { address: child.address, expiration: Date.now() + 1000 * 60 * 10 /* 10 minutes */ }\n }\n throw new Error(`Unable to certify child module [${id}]`)\n }\n\n async detachHandler(id: ModuleIdentifier): Promise<(Lowercase<string> & {\n readonly __hex: true\n } & {\n readonly __address: true\n }) | XyoQuantAddress | undefined> {\n return isAddress(id) ? await this.detachUsingAddress(id) : await this.detachUsingName(id)\n }\n\n override async privateChildren(): Promise<ModuleInstance[]> {\n return [...(await this.attachedPrivateModules()), ...this.params.privateChildren ?? []]\n }\n\n override async publicChildren(): Promise<ModuleInstance[]> {\n return [...(await this.attachedPublicModules()), ...this.params.publicChildren ?? []]\n }\n\n async register(mod: AttachableModuleInstance): Promise<void> {\n this.started('warn')\n if (this.registeredModuleMap[mod.address]) {\n if (this.registeredModuleMap[mod.address] === mod) {\n this.logger?.warn(`Module already registered at that address[${mod.address}]|${mod.id}|[${mod.config.schema}]`)\n } else {\n throw new Error(`Other module already registered at that address[${mod.address}]|${mod.id}|[${mod.config.schema}]`)\n }\n }\n this.registeredModuleMap[mod.address] = mod\n const args = { mod, name: mod.modName }\n await this.emit('moduleRegistered', args)\n }\n\n registeredHandler(): Promisable<XyoAddress[]> {\n return Promise.resolve(\n (Object.keys(this.registeredModuleMap) as XyoAddress[]).map((key) => {\n return key\n }),\n )\n }\n\n registeredModules(): AttachableModuleInstance[] {\n return Object.values(this.registeredModuleMap).map((value) => {\n return value\n }).filter(exists)\n }\n\n async unregister(mod: ModuleInstance): Promise<ModuleInstance> {\n // try to detach if it is attached\n try {\n await this.detach(mod.address)\n } catch {\n // Detach is best-effort during unregister.\n }\n delete this.registeredModuleMap[mod.address]\n const args = { mod, name: mod.modName }\n await this.emit('moduleUnregistered', args)\n return this\n }\n\n protected async attachUsingAddress(address: XyoAddress, external?: boolean): Promise<(Lowercase<string> & {\n readonly __hex: true\n } & {\n readonly __address: true\n }) | XyoQuantAddress> {\n return await this._attachMutex.runExclusive(async () => {\n const existingModule = await this.resolve(address)\n if (existingModule) {\n this.logger?.warn(`MemoryNode: Module [${existingModule?.modName ?? existingModule?.address}] already attached at address [${address}]`)\n }\n const mod = assertEx(this.registeredModuleMap[address], () => `No Module Registered at address [${address}]`)\n\n if (this._attachedPublicModules.has(mod.address)) {\n this.logger?.warn(`Module [${mod.modName}] already attached at [${address}] (public)`)\n }\n if (this._attachedPrivateModules.has(mod.address)) {\n this.logger?.warn(`Module [${mod.modName}] already attached at [${address}] (private)`)\n }\n\n const notificationList = await this.getModulesToNotifyAbout(mod)\n\n // give it private access\n mod.upResolver.addResolver?.(this.privateResolver)\n\n // give it public access\n mod.upResolver.addResolver?.(this.downResolver)\n\n // give it outside access\n mod.upResolver.addResolver?.(this.upResolver)\n\n if (external) {\n // expose it externally\n this._attachedPublicModules.add(mod.address)\n this.downResolver.addResolver(mod.downResolver)\n } else {\n this._attachedPrivateModules.add(mod.address)\n this.privateResolver.addResolver(mod.downResolver)\n }\n\n mod.addParent(this)\n\n const args = { mod, name: mod.modName }\n await this.emit('moduleAttached', args)\n\n if (isNodeModule(mod) && external) {\n const attachedListener: EventListener<TEventData['moduleAttached']> = async (args: TEventData['moduleAttached']) =>\n await this.emit('moduleAttached', args)\n\n const detachedListener: EventListener<TEventData['moduleDetached']> = async (args: TEventData['moduleDetached']) =>\n await this.emit('moduleDetached', args)\n\n mod.on('moduleAttached', attachedListener as EventListener)\n mod.on('moduleDetached', detachedListener as EventListener)\n }\n\n await this.notifyOfExistingModulesAttached(notificationList)\n\n return address\n })\n }\n\n protected async detachUsingAddress(address: XyoAddress): Promise<(Lowercase<string> & {\n readonly __hex: true\n } & {\n readonly __address: true\n }) | XyoQuantAddress> {\n const mod = assertEx(this.registeredModuleMap[address], () => `No Module Registered at address [${address}]`)\n\n const isAttachedPublic = this._attachedPublicModules.has(mod.address)\n const isAttachedPrivate = this._attachedPrivateModules.has(mod.address)\n\n assertEx(isAttachedPublic || isAttachedPrivate, () => `Module [${mod.modName}] not attached at [${address}]`)\n\n // remove inside access\n mod.upResolver?.removeResolver?.(this.privateResolver)\n\n // remove outside access\n mod.upResolver?.removeResolver?.(this.upResolver)\n\n // remove external exposure\n this.downResolver.removeResolver(mod.downResolver)\n\n mod.removeParent(this.address)\n\n if (isAttachedPublic) {\n this._attachedPublicModules.delete(mod.address)\n }\n\n if (isAttachedPrivate) {\n this._attachedPrivateModules.delete(mod.address)\n }\n\n const args = { mod, name: mod.modName }\n await this.emit('moduleDetached', args)\n\n // notify of all sub node children detach\n if (isNodeModule(mod)) {\n const notificationList = await this.getModulesToNotifyAbout(mod)\n await this.notifyOfExistingModulesDetached(notificationList)\n }\n return address\n }\n\n protected override startHandler(): Promise<void> {\n return super.startHandler()\n }\n\n private async attachUsingName(name: string, external?: boolean) {\n const address = this.registeredModuleAddressFromName(name)\n if (isDefined(address)) {\n return await this.attachUsingAddress(address, external)\n }\n }\n\n private async detachUsingName(name: string) {\n const address = this.registeredModuleAddressFromName(name)\n if (isDefined(address)) {\n return await this.detachUsingAddress(address)\n }\n }\n\n private async getModulesToNotifyAbout(node: ModuleInstance) {\n const notifiedAddresses: string[] = []\n // send attach events for all existing attached modules\n const childModules = await node.resolve('*', { direction: 'down' })\n return (\n childModules.map((child) => {\n // don't report self\n if (node.address === child.address) {\n return\n }\n\n // prevent loop\n if (notifiedAddresses.includes(child.address)) {\n return\n }\n\n notifiedAddresses.push(child.address)\n\n return child\n })\n ).filter(exists)\n }\n\n private async notifyOfExistingModulesAttached(childModules: QueryableModule[]) {\n await Promise.all(\n childModules.map(async (child) => {\n const args = { mod: child, name: child.modName }\n await this.emit('moduleAttached', args)\n }),\n )\n }\n\n private async notifyOfExistingModulesDetached(childModules: QueryableModule[]) {\n await Promise.all(\n childModules.map(async (child) => {\n const args = { mod: child, name: child.modName }\n await this.emit('moduleDetached', args)\n }),\n )\n }\n\n private registeredModuleAddressFromName(name: string) {\n return Object.values(this.registeredModuleMap).find((value) => {\n return value?.modName === name\n })?.address\n }\n}\n", "import type { ModuleIdentifier, ModuleInstance } from '#module-model'\nimport { NodeHelper } from '#node-abstract'\nimport type { NodeInstance } from '#node-model'\n\nimport type { MemoryNodeParams } from '../MemoryNode.ts'\nimport { attachToExistingNode } from './attachToExistingNode.ts'\nimport { attachToNewNode } from './attachToNewNode.ts'\nimport {\n flatAttachAllToExistingNode, flatAttachChildToExistingNode, flatAttachToExistingNode,\n} from './flatAttachToExistingNode.ts'\nimport { flatAttachToNewNode } from './flatAttachToNewNode.ts'\n\nexport const MemoryNodeHelper: {\n attachToExistingNode: (source: NodeInstance, id: ModuleIdentifier, destination: NodeInstance) => Promise<NodeInstance>\n attachToNewNode: (source: NodeInstance, id: ModuleIdentifier, destinationParams?: MemoryNodeParams) => Promise<NodeInstance>\n attachedPrivateModules: (node: NodeInstance, maxDepth?: number) => Promise<ModuleInstance[]>\n attachedPublicModules: (node: NodeInstance, maxDepth?: number) => Promise<ModuleInstance[]>\n flatAttachAllToExistingNode: (source: NodeInstance, destination: NodeInstance) => Promise<NodeInstance>\n flatAttachChildToExistingNode: (source: NodeInstance, id: ModuleIdentifier, destination: NodeInstance) => Promise<NodeInstance>\n flatAttachToExistingNode: (source: NodeInstance, id: ModuleIdentifier, destination: NodeInstance) => Promise<NodeInstance>\n flatAttachToNewNode: (source: NodeInstance, id: ModuleIdentifier, destinationParams: MemoryNodeParams) => Promise<NodeInstance>\n} = {\n ...NodeHelper,\n attachToExistingNode,\n attachToNewNode,\n flatAttachAllToExistingNode,\n flatAttachChildToExistingNode,\n flatAttachToExistingNode,\n flatAttachToNewNode,\n}\n", "import { assertEx } from '@ariestools/sdk'\n\nimport type { ModuleIdentifier } from '#module-model'\nimport type { NodeInstance } from '#node-model'\nimport { asNodeInstance } from '#node-model'\n\nimport { MemoryNode } from '../MemoryNode.ts'\nimport { flatAttachToExistingNode } from './flatAttachToExistingNode.ts'\n\nexport const attachToExistingNode = async (source: NodeInstance, id: ModuleIdentifier, destination: NodeInstance): Promise<NodeInstance> => {\n const parts = id.split(':')\n const first = assertEx(parts.shift(), () => 'missing first part')\n if (parts.length === 0) {\n // this is an immediate child/children\n return await flatAttachToExistingNode(source, first, destination)\n } else {\n // all parts that are not the last should be nodes, build them and nest\n const firstModule = await source.resolve(first)\n const firstNode = asNodeInstance(firstModule, () => 'first part is not a node', { required: true })\n const newNode = await MemoryNode.create({ config: firstNode.config })\n await destination.register?.(newNode)\n await destination.attach(newNode.address, true)\n await attachToExistingNode(firstNode, parts.join(':'), newNode)\n return destination\n }\n}\n", "import { assertEx, exists } from '@ariestools/sdk'\n\nimport type { ModuleIdentifier } from '#module-model'\nimport { asAttachableModuleInstance } from '#module-model'\nimport type { NodeInstance } from '#node-model'\n\nexport const flatAttachAllToExistingNode = async (source: NodeInstance, destination: NodeInstance): Promise<NodeInstance> => {\n const children = (await source.publicChildren()).map(child => asAttachableModuleInstance(child)).filter(exists)\n await Promise.all(\n children.map(async (child) => {\n await destination.register?.(child)\n await destination.attach(child.address, true)\n }),\n )\n return destination\n}\n\nexport const flatAttachChildToExistingNode = async (source: NodeInstance, id: ModuleIdentifier, destination: NodeInstance): Promise<NodeInstance> => {\n assertEx(id !== '*', () => '* is not a single child')\n const child = assertEx(await source.resolve(id), () => `Module ${id} not found`)\n const attachableChild = asAttachableModuleInstance(child, () => `Module ${id} is not attachable`, { required: true })\n await destination.register?.(attachableChild)\n await destination.attach(child.address, true)\n return destination\n}\n\nexport const flatAttachToExistingNode = async (source: NodeInstance, id: ModuleIdentifier, destination: NodeInstance): Promise<NodeInstance> => {\n return id === '*' ? await flatAttachAllToExistingNode(source, destination) : flatAttachChildToExistingNode(source, id, destination)\n}\n", "import type { CreatableName } from '@ariestools/sdk'\n\nimport type { ModuleIdentifier } from '#module-model'\nimport type { NodeInstance } from '#node-model'\nimport { NodeConfigSchema } from '#node-model'\n\nimport type { MemoryNodeParams } from '../MemoryNode.ts'\nimport { MemoryNode } from '../MemoryNode.ts'\nimport { attachToExistingNode } from './attachToExistingNode.ts'\n\nconst DEFAULT_NODE_PARAMS = { config: { schema: NodeConfigSchema }, name: 'MemoryNode' as CreatableName }\n\nexport const attachToNewNode = async (\n source: NodeInstance,\n id: ModuleIdentifier,\n destinationParams: MemoryNodeParams = DEFAULT_NODE_PARAMS,\n): Promise<NodeInstance> => {\n const destination = await MemoryNode.create(destinationParams)\n return await attachToExistingNode(source, id, destination)\n}\n", "import type { ModuleIdentifier } from '#module-model'\nimport type { NodeInstance } from '#node-model'\n\nimport type { MemoryNodeParams } from '../MemoryNode.ts'\nimport { MemoryNode } from '../MemoryNode.ts'\nimport { flatAttachToExistingNode } from './flatAttachToExistingNode.ts'\n\nexport const flatAttachToNewNode = async (\n source: NodeInstance,\n id: ModuleIdentifier,\n destinationParams: MemoryNodeParams,\n): Promise<NodeInstance> => {\n const destination = await MemoryNode.create(destinationParams)\n return await flatAttachToExistingNode(source, id, destination)\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EAAQ;AAAA,EAAW;AAAA,OACd;AAEP,SAAS,aAAa;AAEtB;AAAA,EAGE;AAAA,OAIK;AACP,SAAS,oBAAoB;AAM7B,SAAS,oBAAoB;AAKtB,IAAM,aAAN,cACG,aAAkC;AAAA,EAChC,sBAA6E,CAAC;AAAA,EAEhF,eAAe,IAAI,MAAM;AAAA,EAEzB,0BAA0B,oBAAI,IAAgB;AAAA,EAC9C,yBAAyB,oBAAI,IAAgB;AAAA,EAErD,MAAM,cAAc,IAAsB,UAIpB;AACpB,UAAM,KAAK,aAAa,QAAQ,IAAI;AACpC,WAAO;AAAA,MACL,UAAU,EAAE,IAAI,MAAM,KAAK,mBAAmB,IAAI,QAAQ,IAAI,MAAM,KAAK,gBAAgB,IAAI,QAAQ;AAAA,MACrG,MAAM,4BAA4B,EAAE;AAAA,IACtC;AAAA,EACF;AAAA,EAEA,MAAM,eAAe,IAAyD;AAC5E,UAAM,SAAS,MAAM,KAAK,eAAe,GAAG,KAAK,CAAAA,WAASA,OAAM,YAAY,MAAMA,OAAM,YAAY,EAAE;AACtG,QAAI,OAAO;AACT,aAAO;AAAA,QAAE,SAAS,MAAM;AAAA,QAAS,YAAY,KAAK,IAAI,IAAI,MAAO,KAAK;AAAA;AAAA,MAAoB;AAAA,IAC5F;AACA,UAAM,IAAI,MAAM,mCAAmC,EAAE,GAAG;AAAA,EAC1D;AAAA,EAEA,MAAM,cAAc,IAIc;AAChC,WAAO,UAAU,EAAE,IAAI,MAAM,KAAK,mBAAmB,EAAE,IAAI,MAAM,KAAK,gBAAgB,EAAE;AAAA,EAC1F;AAAA,EAEA,MAAe,kBAA6C;AAC1D,WAAO,CAAC,GAAI,MAAM,KAAK,uBAAuB,GAAI,GAAG,KAAK,OAAO,mBAAmB,CAAC,CAAC;AAAA,EACxF;AAAA,EAEA,MAAe,iBAA4C;AACzD,WAAO,CAAC,GAAI,MAAM,KAAK,sBAAsB,GAAI,GAAG,KAAK,OAAO,kBAAkB,CAAC,CAAC;AAAA,EACtF;AAAA,EAEA,MAAM,SAAS,KAA8C;AAC3D,SAAK,QAAQ,MAAM;AACnB,QAAI,KAAK,
|
|
4
|
+
"sourcesContent": ["import type { EventListener, Promisable } from '@ariestools/sdk'\nimport {\n assertEx,\n exists, isAddress, isDefined,\n} from '@ariestools/sdk'\nimport type { XyoAddress, XyoQuantAddress } from '@xyo-network/sdk-protocol'\nimport { Mutex } from 'async-mutex'\n\nimport {\n type AnyConfigSchema,\n type AttachableModuleInstance,\n creatableModule,\n type ModuleIdentifier,\n type ModuleInstance,\n type QueryableModule,\n} from '#module-model'\nimport { AbstractNode } from '#node-abstract'\nimport type {\n ChildCertificationFields,\n NodeConfig, NodeInstanceParams,\n NodeModuleEventData,\n} from '#node-model'\nimport { isNodeModule } from '#node-model'\n\nexport type MemoryNodeParams = NodeInstanceParams<AnyConfigSchema<NodeConfig>>\n\n@creatableModule()\nexport class MemoryNode<TParams extends MemoryNodeParams = MemoryNodeParams, TEventData extends NodeModuleEventData = NodeModuleEventData>\n extends AbstractNode<TParams, TEventData> {\n protected registeredModuleMap: Partial<Record<XyoAddress, AttachableModuleInstance>> = {}\n\n private _attachMutex = new Mutex()\n\n private _attachedPrivateModules = new Set<XyoAddress>()\n private _attachedPublicModules = new Set<XyoAddress>()\n\n async attachHandler(id: ModuleIdentifier, external?: boolean): Promise<(Lowercase<string> & {\n readonly __hex: true\n } & {\n readonly __address: true\n }) | XyoQuantAddress> {\n await this.startedAsync('warn', true)\n return assertEx(\n isAddress(id) ? await this.attachUsingAddress(id, external) : await this.attachUsingName(id, external),\n () => `Unable to locate module [${id}]`,\n )\n }\n\n async certifyHandler(id: ModuleIdentifier): Promise<ChildCertificationFields> {\n const child = (await this.publicChildren()).find(child => child.modName === id || child.address === id)\n if (child) {\n return { address: child.address, expiration: Date.now() + 1000 * 60 * 10 /* 10 minutes */ }\n }\n throw new Error(`Unable to certify child module [${id}]`)\n }\n\n async detachHandler(id: ModuleIdentifier): Promise<(Lowercase<string> & {\n readonly __hex: true\n } & {\n readonly __address: true\n }) | XyoQuantAddress | undefined> {\n return isAddress(id) ? await this.detachUsingAddress(id) : await this.detachUsingName(id)\n }\n\n override async privateChildren(): Promise<ModuleInstance[]> {\n return [...(await this.attachedPrivateModules()), ...this.params.privateChildren ?? []]\n }\n\n override async publicChildren(): Promise<ModuleInstance[]> {\n return [...(await this.attachedPublicModules()), ...this.params.publicChildren ?? []]\n }\n\n async register(mod: AttachableModuleInstance): Promise<void> {\n this.started('warn')\n if (Object.hasOwn(this.registeredModuleMap, mod.address)) {\n if (this.registeredModuleMap[mod.address] === mod) {\n this.logger?.warn(`Module already registered at that address[${mod.address}]|${mod.id}|[${mod.config.schema}]`)\n } else {\n throw new Error(`Other module already registered at that address[${mod.address}]|${mod.id}|[${mod.config.schema}]`)\n }\n }\n this.registeredModuleMap[mod.address] = mod\n const args = { mod, name: mod.modName }\n await this.emit('moduleRegistered', args)\n }\n\n registeredHandler(): Promisable<XyoAddress[]> {\n return Promise.resolve(\n (Object.keys(this.registeredModuleMap) as XyoAddress[]).map((key) => {\n return key\n }),\n )\n }\n\n registeredModules(): AttachableModuleInstance[] {\n return Object.values(this.registeredModuleMap).map((value) => {\n return value\n }).filter(exists)\n }\n\n async unregister(mod: ModuleInstance): Promise<ModuleInstance> {\n // try to detach if it is attached\n try {\n await this.detach(mod.address)\n } catch {\n // Detach is best-effort during unregister.\n }\n delete this.registeredModuleMap[mod.address]\n const args = { mod, name: mod.modName }\n await this.emit('moduleUnregistered', args)\n return this\n }\n\n protected async attachUsingAddress(address: XyoAddress, external?: boolean): Promise<(Lowercase<string> & {\n readonly __hex: true\n } & {\n readonly __address: true\n }) | XyoQuantAddress> {\n return await this._attachMutex.runExclusive(async () => {\n const existingModule = await this.resolve(address)\n if (existingModule) {\n this.logger?.warn(`MemoryNode: Module [${existingModule?.modName ?? existingModule?.address}] already attached at address [${address}]`)\n }\n const mod = assertEx(this.registeredModuleMap[address], () => `No Module Registered at address [${address}]`)\n\n if (this._attachedPublicModules.has(mod.address)) {\n this.logger?.warn(`Module [${mod.modName}] already attached at [${address}] (public)`)\n }\n if (this._attachedPrivateModules.has(mod.address)) {\n this.logger?.warn(`Module [${mod.modName}] already attached at [${address}] (private)`)\n }\n\n const notificationList = await this.getModulesToNotifyAbout(mod)\n\n // give it private access\n mod.upResolver.addResolver?.(this.privateResolver)\n\n // give it public access\n mod.upResolver.addResolver?.(this.downResolver)\n\n // give it outside access\n mod.upResolver.addResolver?.(this.upResolver)\n\n if (external) {\n // expose it externally\n this._attachedPublicModules.add(mod.address)\n this.downResolver.addResolver(mod.downResolver)\n } else {\n this._attachedPrivateModules.add(mod.address)\n this.privateResolver.addResolver(mod.downResolver)\n }\n\n mod.addParent(this)\n\n const args = { mod, name: mod.modName }\n await this.emit('moduleAttached', args)\n\n if (isNodeModule(mod) && external) {\n const attachedListener: EventListener<TEventData['moduleAttached']> = async (args: TEventData['moduleAttached']) =>\n await this.emit('moduleAttached', args)\n\n const detachedListener: EventListener<TEventData['moduleDetached']> = async (args: TEventData['moduleDetached']) =>\n await this.emit('moduleDetached', args)\n\n mod.on('moduleAttached', attachedListener as EventListener)\n mod.on('moduleDetached', detachedListener as EventListener)\n }\n\n await this.notifyOfExistingModulesAttached(notificationList)\n\n return address\n })\n }\n\n protected async detachUsingAddress(address: XyoAddress): Promise<(Lowercase<string> & {\n readonly __hex: true\n } & {\n readonly __address: true\n }) | XyoQuantAddress> {\n const mod = assertEx(this.registeredModuleMap[address], () => `No Module Registered at address [${address}]`)\n\n const isAttachedPublic = this._attachedPublicModules.has(mod.address)\n const isAttachedPrivate = this._attachedPrivateModules.has(mod.address)\n\n assertEx(isAttachedPublic || isAttachedPrivate, () => `Module [${mod.modName}] not attached at [${address}]`)\n\n // remove inside access\n mod.upResolver?.removeResolver?.(this.privateResolver)\n\n // remove outside access\n mod.upResolver?.removeResolver?.(this.upResolver)\n\n // remove external exposure\n this.downResolver.removeResolver(mod.downResolver)\n\n mod.removeParent(this.address)\n\n if (isAttachedPublic) {\n this._attachedPublicModules.delete(mod.address)\n }\n\n if (isAttachedPrivate) {\n this._attachedPrivateModules.delete(mod.address)\n }\n\n const args = { mod, name: mod.modName }\n await this.emit('moduleDetached', args)\n\n // notify of all sub node children detach\n if (isNodeModule(mod)) {\n const notificationList = await this.getModulesToNotifyAbout(mod)\n await this.notifyOfExistingModulesDetached(notificationList)\n }\n return address\n }\n\n protected override startHandler(): Promise<void> {\n return super.startHandler()\n }\n\n private async attachUsingName(name: string, external?: boolean) {\n const address = this.registeredModuleAddressFromName(name)\n if (isDefined(address)) {\n return await this.attachUsingAddress(address, external)\n }\n }\n\n private async detachUsingName(name: string) {\n const address = this.registeredModuleAddressFromName(name)\n if (isDefined(address)) {\n return await this.detachUsingAddress(address)\n }\n }\n\n private async getModulesToNotifyAbout(node: ModuleInstance) {\n const notifiedAddresses: string[] = []\n // send attach events for all existing attached modules\n const childModules = await node.resolve('*', { direction: 'down' })\n return (\n childModules.map((child) => {\n // don't report self\n if (node.address === child.address) {\n return\n }\n\n // prevent loop\n if (notifiedAddresses.includes(child.address)) {\n return\n }\n\n notifiedAddresses.push(child.address)\n\n return child\n })\n ).filter(exists)\n }\n\n private async notifyOfExistingModulesAttached(childModules: QueryableModule[]) {\n await Promise.all(\n childModules.map(async (child) => {\n const args = { mod: child, name: child.modName }\n await this.emit('moduleAttached', args)\n }),\n )\n }\n\n private async notifyOfExistingModulesDetached(childModules: QueryableModule[]) {\n await Promise.all(\n childModules.map(async (child) => {\n const args = { mod: child, name: child.modName }\n await this.emit('moduleDetached', args)\n }),\n )\n }\n\n private registeredModuleAddressFromName(name: string) {\n return Object.values(this.registeredModuleMap).find((value) => {\n return value?.modName === name\n })?.address\n }\n}\n", "import type { ModuleIdentifier, ModuleInstance } from '#module-model'\nimport { NodeHelper } from '#node-abstract'\nimport type { NodeInstance } from '#node-model'\n\nimport type { MemoryNodeParams } from '../MemoryNode.ts'\nimport { attachToExistingNode } from './attachToExistingNode.ts'\nimport { attachToNewNode } from './attachToNewNode.ts'\nimport {\n flatAttachAllToExistingNode, flatAttachChildToExistingNode, flatAttachToExistingNode,\n} from './flatAttachToExistingNode.ts'\nimport { flatAttachToNewNode } from './flatAttachToNewNode.ts'\n\nexport const MemoryNodeHelper: {\n attachToExistingNode: (source: NodeInstance, id: ModuleIdentifier, destination: NodeInstance) => Promise<NodeInstance>\n attachToNewNode: (source: NodeInstance, id: ModuleIdentifier, destinationParams?: MemoryNodeParams) => Promise<NodeInstance>\n attachedPrivateModules: (node: NodeInstance, maxDepth?: number) => Promise<ModuleInstance[]>\n attachedPublicModules: (node: NodeInstance, maxDepth?: number) => Promise<ModuleInstance[]>\n flatAttachAllToExistingNode: (source: NodeInstance, destination: NodeInstance) => Promise<NodeInstance>\n flatAttachChildToExistingNode: (source: NodeInstance, id: ModuleIdentifier, destination: NodeInstance) => Promise<NodeInstance>\n flatAttachToExistingNode: (source: NodeInstance, id: ModuleIdentifier, destination: NodeInstance) => Promise<NodeInstance>\n flatAttachToNewNode: (source: NodeInstance, id: ModuleIdentifier, destinationParams: MemoryNodeParams) => Promise<NodeInstance>\n} = {\n ...NodeHelper,\n attachToExistingNode,\n attachToNewNode,\n flatAttachAllToExistingNode,\n flatAttachChildToExistingNode,\n flatAttachToExistingNode,\n flatAttachToNewNode,\n}\n", "import { assertEx } from '@ariestools/sdk'\n\nimport type { ModuleIdentifier } from '#module-model'\nimport type { NodeInstance } from '#node-model'\nimport { asNodeInstance } from '#node-model'\n\nimport { MemoryNode } from '../MemoryNode.ts'\nimport { flatAttachToExistingNode } from './flatAttachToExistingNode.ts'\n\nexport const attachToExistingNode = async (source: NodeInstance, id: ModuleIdentifier, destination: NodeInstance): Promise<NodeInstance> => {\n const parts = id.split(':')\n const first = assertEx(parts.shift(), () => 'missing first part')\n if (parts.length === 0) {\n // this is an immediate child/children\n return await flatAttachToExistingNode(source, first, destination)\n }\n // all parts that are not the last should be nodes, build them and nest\n const firstModule = await source.resolve(first)\n const firstNode = asNodeInstance(firstModule, () => 'first part is not a node', { required: true })\n const newNode = await MemoryNode.create({ config: firstNode.config })\n await destination.register?.(newNode)\n await destination.attach(newNode.address, true)\n await attachToExistingNode(firstNode, parts.join(':'), newNode)\n return destination\n}\n", "import { assertEx, exists } from '@ariestools/sdk'\n\nimport type { ModuleIdentifier } from '#module-model'\nimport { asAttachableModuleInstance } from '#module-model'\nimport type { NodeInstance } from '#node-model'\n\nexport const flatAttachAllToExistingNode = async (source: NodeInstance, destination: NodeInstance): Promise<NodeInstance> => {\n const children = (await source.publicChildren()).map(child => asAttachableModuleInstance(child)).filter(exists)\n await Promise.all(\n children.map(async (child) => {\n await destination.register?.(child)\n await destination.attach(child.address, true)\n }),\n )\n return destination\n}\n\nexport const flatAttachChildToExistingNode = async (source: NodeInstance, id: ModuleIdentifier, destination: NodeInstance): Promise<NodeInstance> => {\n assertEx(id !== '*', () => '* is not a single child')\n const child = assertEx(await source.resolve(id), () => `Module ${id} not found`)\n const attachableChild = asAttachableModuleInstance(child, () => `Module ${id} is not attachable`, { required: true })\n await destination.register?.(attachableChild)\n await destination.attach(child.address, true)\n return destination\n}\n\nexport const flatAttachToExistingNode = async (source: NodeInstance, id: ModuleIdentifier, destination: NodeInstance): Promise<NodeInstance> => {\n return id === '*' ? await flatAttachAllToExistingNode(source, destination) : flatAttachChildToExistingNode(source, id, destination)\n}\n", "import type { CreatableName } from '@ariestools/sdk'\n\nimport type { ModuleIdentifier } from '#module-model'\nimport type { NodeInstance } from '#node-model'\nimport { NodeConfigSchema } from '#node-model'\n\nimport type { MemoryNodeParams } from '../MemoryNode.ts'\nimport { MemoryNode } from '../MemoryNode.ts'\nimport { attachToExistingNode } from './attachToExistingNode.ts'\n\nconst DEFAULT_NODE_PARAMS = { config: { schema: NodeConfigSchema }, name: 'MemoryNode' as CreatableName }\n\nexport const attachToNewNode = async (\n source: NodeInstance,\n id: ModuleIdentifier,\n destinationParams: MemoryNodeParams = DEFAULT_NODE_PARAMS,\n): Promise<NodeInstance> => {\n const destination = await MemoryNode.create(destinationParams)\n return await attachToExistingNode(source, id, destination)\n}\n", "import type { ModuleIdentifier } from '#module-model'\nimport type { NodeInstance } from '#node-model'\n\nimport type { MemoryNodeParams } from '../MemoryNode.ts'\nimport { MemoryNode } from '../MemoryNode.ts'\nimport { flatAttachToExistingNode } from './flatAttachToExistingNode.ts'\n\nexport const flatAttachToNewNode = async (\n source: NodeInstance,\n id: ModuleIdentifier,\n destinationParams: MemoryNodeParams,\n): Promise<NodeInstance> => {\n const destination = await MemoryNode.create(destinationParams)\n return await flatAttachToExistingNode(source, id, destination)\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EAAQ;AAAA,EAAW;AAAA,OACd;AAEP,SAAS,aAAa;AAEtB;AAAA,EAGE;AA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AAC9D,SAAO;AACT;;;AEpBA,SAAS,wBAAwB;AAMjC,IAAM,sBAAsB,EAAE,QAAQ,EAAE,QAAQ,iBAAiB,GAAG,MAAM,aAA8B;AAEjG,IAAM,kBAAkB,OAC7B,QACA,IACA,oBAAsC,wBACZ;AAC1B,QAAM,cAAc,MAAM,WAAW,OAAO,iBAAiB;AAC7D,SAAO,MAAM,qBAAqB,QAAQ,IAAI,WAAW;AAC3D;;;ACZO,IAAM,sBAAsB,OACjC,QACA,IACA,sBAC0B;AAC1B,QAAM,cAAc,MAAM,WAAW,OAAO,iBAAiB;AAC7D,SAAO,MAAM,yBAAyB,QAAQ,IAAI,WAAW;AAC/D;;;AJFO,IAAM,mBAST;AAAA,EACF,GAAG;AAAA,EACH;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
6
|
"names": ["child", "args", "assertEx", "assertEx", "exists", "assertEx"]
|
|
7
7
|
}
|
|
@@ -126,7 +126,8 @@ var isNodeInstance = instanceFactory.create(
|
|
|
126
126
|
},
|
|
127
127
|
[isModuleInstance]
|
|
128
128
|
);
|
|
129
|
-
var
|
|
129
|
+
var isQueryableModuleFactory = new IsQueryableModuleFactory();
|
|
130
|
+
var isNodeModule = isQueryableModuleFactory.create([NodeAttachedQuerySchema]);
|
|
130
131
|
var asNodeModule = AsObjectFactory.create(isNodeModule);
|
|
131
132
|
var asNodeInstance = AsObjectFactory.create(isNodeInstance);
|
|
132
133
|
var withNodeModule = WithFactory.create(isNodeModule);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/modules/node-model/attachable/asAttachableInstance.ts", "../../src/modules/node-model/attachable/isAttachableInstance.ts", "../../src/modules/node-model/typeChecks.ts", "../../src/modules/node-model/Queries/Attach.ts", "../../src/modules/node-model/Queries/Attached.ts", "../../src/modules/node-model/Queries/Certify.ts", "../../src/modules/node-model/Queries/Detach.ts", "../../src/modules/node-model/Queries/Registered.ts", "../../src/modules/node-model/attachable/AttachableInstance.ts", "../../src/modules/node-model/ChildCertification.ts", "../../src/modules/node-model/Config.ts"],
|
|
4
|
-
"sourcesContent": ["import { AsObjectFactory } from '@ariestools/sdk'\n\nimport { isAttachableNodeInstance } from './isAttachableInstance.ts'\n\nexport const asAttachableNodeInstance = AsObjectFactory.create(isAttachableNodeInstance)\n", "import type { ObjectTypeShape, TypeCheck } from '@ariestools/sdk'\nimport { IsObjectFactory } from '@ariestools/sdk'\n\nimport { isAttachableModuleInstance } from '#module-model'\n\nimport { isNodeInstance } from '../typeChecks.ts'\nimport type { AttachableNodeInstance } from './AttachableInstance.ts'\n\nexport const requiredAttachableNodeInstanceFunctions: ObjectTypeShape = {}\n\n// we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableNodeInstance>()\n\nexport const isAttachableNodeInstance: TypeCheck<AttachableNodeInstance> = factory.create(requiredAttachableNodeInstanceFunctions, [\n isNodeInstance,\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 { NodeInstance } from './instance.ts'\nimport type { NodeModule } from './Node.ts'\nimport { NodeAttachedQuerySchema } from './Queries/index.ts'\n\nconst instanceFactory = new IsInstanceFactory<NodeInstance>()\n\nexport const isNodeInstance: TypeCheck<NodeInstance> = instanceFactory.create(\n {\n attach: 'function',\n attached: 'function',\n certify: 'function',\n detach: 'function',\n registered: 'function',\n },\n [isModuleInstance],\n)\n\nexport const isNodeModule: TypeCheck<NodeModule> = new IsQueryableModuleFactory<NodeModule>().create([NodeAttachedQuerySchema])\n\nexport const asNodeModule = AsObjectFactory.create(isNodeModule)\nexport const asNodeInstance = AsObjectFactory.create(isNodeInstance)\n\n/** @deprecated use narrowing instead [ if(is) ] */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport const withNodeModule = WithFactory.create(isNodeModule)\n/** @deprecated use narrowing instead [ if(is) ] */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport const withNodeInstance = WithFactory.create(isNodeInstance)\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 { ModuleIdentifier } from '#module-model'\n\nexport const NodeAttachQuerySchema: 'network.xyo.query.node.attach' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.node.attach', true)\nexport type NodeAttachQuerySchema = typeof NodeAttachQuerySchema\n\nexport const NodeAttachQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<NodeAttachQuerySchema> }\n & (typeof QueryFieldsZod)['shape']\n & {\n external: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>\n id: z.ZodMiniCustom<ModuleIdentifier, ModuleIdentifier>\n },\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(NodeAttachQuerySchema), {\n ...QueryFieldsZod.shape,\n external: z.optional(z.boolean()),\n id: z.custom<ModuleIdentifier>(),\n})\n\nexport type NodeAttachQuery = z.infer<typeof NodeAttachQueryZod>\n\nexport const isNodeAttachQuery: ReturnType<typeof zodIsFactory<NodeAttachQuery>> = zodIsFactory(NodeAttachQueryZod)\nexport const asNodeAttachQuery: ReturnType<typeof zodAsFactory<NodeAttachQuery>> = zodAsFactory(NodeAttachQueryZod, 'asNodeAttachQuery')\nexport const toNodeAttachQuery: ReturnType<typeof zodToFactory<NodeAttachQuery>> = zodToFactory(NodeAttachQueryZod, 'toNodeAttachQuery')\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 NodeAttachedQuerySchema: 'network.xyo.query.node.attached' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.node.attached', true)\nexport type NodeAttachedQuerySchema = typeof NodeAttachedQuerySchema\n\nexport const NodeAttachedQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<NodeAttachedQuerySchema> }\n & (typeof QueryFieldsZod)['shape'],\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(NodeAttachedQuerySchema), { ...QueryFieldsZod.shape })\n\nexport type NodeAttachedQuery = z.infer<typeof NodeAttachedQueryZod>\n\nexport const isNodeAttachedQuery: ReturnType<typeof zodIsFactory<NodeAttachedQuery>> = zodIsFactory(NodeAttachedQueryZod)\nexport const asNodeAttachedQuery: ReturnType<typeof zodAsFactory<NodeAttachedQuery>> = zodAsFactory(NodeAttachedQueryZod, 'asNodeAttachedQuery')\nexport const toNodeAttachedQuery: ReturnType<typeof zodToFactory<NodeAttachedQuery>> = zodToFactory(NodeAttachedQueryZod, 'toNodeAttachedQuery')\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 { ModuleIdentifier } from '#module-model'\n\nexport const NodeCertifyQuerySchema: 'network.xyo.query.node.certify' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.node.certify', true)\nexport type NodeCertifyQuerySchema = typeof NodeCertifyQuerySchema\n\nexport const NodeCertifyQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<NodeCertifyQuerySchema> }\n & (typeof QueryFieldsZod)['shape']\n & { id: z.ZodMiniCustom<ModuleIdentifier, ModuleIdentifier> },\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(NodeCertifyQuerySchema), {\n ...QueryFieldsZod.shape,\n id: z.custom<ModuleIdentifier>(),\n})\n\nexport type NodeCertifyQuery = z.infer<typeof NodeCertifyQueryZod>\n\nexport const isNodeCertifyQuery: ReturnType<typeof zodIsFactory<NodeCertifyQuery>> = zodIsFactory(NodeCertifyQueryZod)\nexport const asNodeCertifyQuery: ReturnType<typeof zodAsFactory<NodeCertifyQuery>> = zodAsFactory(NodeCertifyQueryZod, 'asNodeCertifyQuery')\nexport const toNodeCertifyQuery: ReturnType<typeof zodToFactory<NodeCertifyQuery>> = zodToFactory(NodeCertifyQueryZod, 'toNodeCertifyQuery')\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 { ModuleIdentifier } from '#module-model'\n\nexport const NodeDetachQuerySchema: 'network.xyo.query.node.detach' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.node.detach', true)\nexport type NodeDetachQuerySchema = typeof NodeDetachQuerySchema\n\nexport const NodeDetachQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<NodeDetachQuerySchema> }\n & (typeof QueryFieldsZod)['shape']\n & { id: z.ZodMiniCustom<ModuleIdentifier, ModuleIdentifier> },\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(NodeDetachQuerySchema), {\n ...QueryFieldsZod.shape,\n id: z.custom<ModuleIdentifier>(),\n})\n\nexport type NodeDetachQuery = z.infer<typeof NodeDetachQueryZod>\n\nexport const isNodeDetachQuery: ReturnType<typeof zodIsFactory<NodeDetachQuery>> = zodIsFactory(NodeDetachQueryZod)\nexport const asNodeDetachQuery: ReturnType<typeof zodAsFactory<NodeDetachQuery>> = zodAsFactory(NodeDetachQueryZod, 'asNodeDetachQuery')\nexport const toNodeDetachQuery: ReturnType<typeof zodToFactory<NodeDetachQuery>> = zodToFactory(NodeDetachQueryZod, 'toNodeDetachQuery')\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 NodeRegisteredQuerySchema: 'network.xyo.query.node.registered' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.node.registered', true)\nexport type NodeRegisteredQuerySchema = typeof NodeRegisteredQuerySchema\n\nexport const NodeRegisteredQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<NodeRegisteredQuerySchema> }\n & (typeof QueryFieldsZod)['shape'],\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(NodeRegisteredQuerySchema), { ...QueryFieldsZod.shape })\n\nexport type NodeRegisteredQuery = z.infer<typeof NodeRegisteredQueryZod>\n\nexport const isNodeRegisteredQuery: ReturnType<typeof zodIsFactory<NodeRegisteredQuery>> = zodIsFactory(NodeRegisteredQueryZod)\nexport const asNodeRegisteredQuery: ReturnType<typeof zodAsFactory<NodeRegisteredQuery>> = zodAsFactory(NodeRegisteredQueryZod, 'asNodeRegisteredQuery')\nexport const toNodeRegisteredQuery: ReturnType<typeof zodToFactory<NodeRegisteredQuery>> = zodToFactory(NodeRegisteredQueryZod, 'toNodeRegisteredQuery')\n", "import type { TypeCheck } from '@ariestools/sdk'\nimport { IsObjectFactory } from '@ariestools/sdk'\n\nimport type { AttachableModuleInstance } from '#module-model'\n\nimport type { NodeInstance } from '../instance.ts'\nimport type { NodeModule, NodeModuleEventData } from '../Node.ts'\nimport type { NodeParams } from '../Params.ts'\n\nexport interface AttachableNodeInstance<TParams extends NodeParams = NodeParams, TEventData extends NodeModuleEventData = NodeModuleEventData>\n extends NodeModule<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n NodeInstance<TParams, TEventData> {}\n\nexport type AttachableNodeInstanceTypeCheck<T extends AttachableNodeInstance = AttachableNodeInstance> = TypeCheck<T>\n\nexport class IsAttachableNodeInstanceFactory<T extends AttachableNodeInstance = AttachableNodeInstance> extends IsObjectFactory<T> {}\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, PayloadZodOfSchema, type XyoAddress,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nexport const ChildCertificationSchema: 'network.xyo.child.certification' & {\n readonly __schema: true\n} = asSchema('network.xyo.child.certification', true)\nexport type ChildCertificationSchema = typeof ChildCertificationSchema\n\nexport interface ChildCertificationFields {\n address: XyoAddress\n expiration: number\n}\n\nexport const ChildCertificationZod: z.ZodMiniIntersection<\n z.ZodMiniObject<{ schema: z.ZodMiniLiteral<ChildCertificationSchema> }, z.core.$strip>,\n z.ZodMiniCustom<ChildCertificationFields, ChildCertificationFields>\n> = z.intersection(PayloadZodOfSchema(ChildCertificationSchema), z.custom<ChildCertificationFields>())\n\nexport type ChildCertification = z.infer<typeof ChildCertificationZod>\n\nexport const isChildCertification: ReturnType<typeof zodIsFactory<ChildCertification>> = zodIsFactory(ChildCertificationZod)\nexport const asChildCertification: ReturnType<typeof zodAsFactory<ChildCertification>> = zodAsFactory(ChildCertificationZod, 'asChildCertification')\nexport const toChildCertification: ReturnType<typeof zodToFactory<ChildCertification>> = zodToFactory(ChildCertificationZod, 'toChildCertification')\n", "import type { EmptyObject, WithAdditional } from '@ariestools/sdk'\nimport {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport type {\n Payload,\n Schema,\n} from '@xyo-network/sdk-protocol'\nimport { asSchema } from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { ModuleConfig } from '#module-model'\nimport { ModuleConfigZod } from '#module-model'\n\nexport const NodeConfigSchema: 'network.xyo.node.config' & {\n readonly __schema: true\n} = asSchema('network.xyo.node.config', true)\nexport type NodeConfigSchema = typeof NodeConfigSchema\n\nexport const NodeConfigZod: z.ZodMiniObject<\n Omit<(typeof ModuleConfigZod)['shape'], 'schema'> & {\n schema: z.ZodMiniLiteral<NodeConfigSchema>\n },\n z.core.$strip\n> = z.extend(ModuleConfigZod, { schema: z.literal(NodeConfigSchema) })\n\nexport type NodeConfigBase = z.infer<typeof NodeConfigZod>\n\nexport const isNodeConfig: ReturnType<typeof zodIsFactory<NodeConfigBase>> = zodIsFactory(NodeConfigZod)\nexport const asNodeConfig: ReturnType<typeof zodAsFactory<NodeConfigBase>> = zodAsFactory(NodeConfigZod, 'asNodeConfig')\nexport const toNodeConfig: ReturnType<typeof zodToFactory<NodeConfigBase>> = zodToFactory(NodeConfigZod, 'toNodeConfig')\n\nexport type NodeConfig<TConfig extends EmptyObject | Payload | void = void, TSchema extends Schema | void = void> = ModuleConfig<\n WithAdditional<\n {\n archivist?: string\n },\n TConfig\n >,\n TSchema extends void\n ? TConfig extends Payload\n ? TConfig['schema']\n : NodeConfigSchema\n : TSchema\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;AAIZ,IAAM,wBAET,SAAS,iCAAiC,IAAI;AAG3C,IAAM,qBAQP,SAAO,mBAAmB,qBAAqB,GAAG;AAAA,EACtD,GAAG,eAAe;AAAA,EAClB,UAAY,WAAW,UAAQ,CAAC;AAAA,EAChC,IAAM,SAAyB;AACjC,CAAC;AAIM,IAAM,oBAAsE,aAAa,kBAAkB;AAC3G,IAAM,oBAAsE,aAAa,oBAAoB,mBAAmB;AAChI,IAAM,oBAAsE,aAAa,oBAAoB,mBAAmB;;;ACjCvI;AAAA,EACE,gBAAAC;AAAA,EAAc,gBAAAC;AAAA,EAAc,gBAAAC;AAAA,OACvB;AACP;AAAA,EACE,YAAAC;AAAA,EAAU,sBAAAC;AAAA,EAAoB,kBAAAC;AAAA,OACzB;AACP,YAAYC,QA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AAc,gBAAAC;AAAA,OACvB;AACP;AAAA,EACE,YAAAC;AAAA,EAAU,sBAAAC;AAAA,EAAoB,kBAAAC;AAAA,OACzB;AACP,YAAYC,QAAO;AAEZ,IAAM,4BAETH,UAAS,qCAAqC,IAAI;AAG/C,IAAM,yBAIP,UAAOC,oBAAmB,yBAAyB,GAAG,EAAE,GAAGC,gBAAe,MAAM,CAAC;AAIhF,IAAM,wBAA8EJ,cAAa,sBAAsB;AACvH,IAAM,wBAA8ED,cAAa,wBAAwB,uBAAuB;AAChJ,IAAM,wBAA8EE,cAAa,wBAAwB,uBAAuB;;;ALZvJ,IAAM,kBAAkB,IAAI,kBAAgC;AAErD,IAAM,iBAA0C,gBAAgB;AAAA,EACrE;AAAA,IACE,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,YAAY;AAAA,EACd;AAAA,EACA,CAAC,gBAAgB;AACnB;
|
|
4
|
+
"sourcesContent": ["import { AsObjectFactory } from '@ariestools/sdk'\n\nimport { isAttachableNodeInstance } from './isAttachableInstance.ts'\n\nexport const asAttachableNodeInstance = AsObjectFactory.create(isAttachableNodeInstance)\n", "import type { ObjectTypeShape, TypeCheck } from '@ariestools/sdk'\nimport { IsObjectFactory } from '@ariestools/sdk'\n\nimport { isAttachableModuleInstance } from '#module-model'\n\nimport { isNodeInstance } from '../typeChecks.ts'\nimport type { AttachableNodeInstance } from './AttachableInstance.ts'\n\nexport const requiredAttachableNodeInstanceFunctions: ObjectTypeShape = {}\n\n// we do not use IsInstanceFactory here to prevent a cycle\nconst factory = new IsObjectFactory<AttachableNodeInstance>()\n\nexport const isAttachableNodeInstance: TypeCheck<AttachableNodeInstance> = factory.create(requiredAttachableNodeInstanceFunctions, [\n isNodeInstance,\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 { NodeInstance } from './instance.ts'\nimport type { NodeModule } from './Node.ts'\nimport { NodeAttachedQuerySchema } from './Queries/index.ts'\n\nconst instanceFactory = new IsInstanceFactory<NodeInstance>()\n\nexport const isNodeInstance: TypeCheck<NodeInstance> = instanceFactory.create(\n {\n attach: 'function',\n attached: 'function',\n certify: 'function',\n detach: 'function',\n registered: 'function',\n },\n [isModuleInstance],\n)\n\nconst isQueryableModuleFactory = new IsQueryableModuleFactory<NodeModule>()\nexport const isNodeModule: TypeCheck<NodeModule> = isQueryableModuleFactory.create([NodeAttachedQuerySchema])\n\nexport const asNodeModule = AsObjectFactory.create(isNodeModule)\nexport const asNodeInstance = AsObjectFactory.create(isNodeInstance)\n\n/** @deprecated use narrowing instead [ if(is) ] */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport const withNodeModule = WithFactory.create(isNodeModule)\n/** @deprecated use narrowing instead [ if(is) ] */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport const withNodeInstance = WithFactory.create(isNodeInstance)\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 { ModuleIdentifier } from '#module-model'\n\nexport const NodeAttachQuerySchema: 'network.xyo.query.node.attach' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.node.attach', true)\nexport type NodeAttachQuerySchema = typeof NodeAttachQuerySchema\n\nexport const NodeAttachQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<NodeAttachQuerySchema> }\n & (typeof QueryFieldsZod)['shape']\n & {\n external: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>\n id: z.ZodMiniCustom<ModuleIdentifier, ModuleIdentifier>\n },\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(NodeAttachQuerySchema), {\n ...QueryFieldsZod.shape,\n external: z.optional(z.boolean()),\n id: z.custom<ModuleIdentifier>(),\n})\n\nexport type NodeAttachQuery = z.infer<typeof NodeAttachQueryZod>\n\nexport const isNodeAttachQuery: ReturnType<typeof zodIsFactory<NodeAttachQuery>> = zodIsFactory(NodeAttachQueryZod)\nexport const asNodeAttachQuery: ReturnType<typeof zodAsFactory<NodeAttachQuery>> = zodAsFactory(NodeAttachQueryZod, 'asNodeAttachQuery')\nexport const toNodeAttachQuery: ReturnType<typeof zodToFactory<NodeAttachQuery>> = zodToFactory(NodeAttachQueryZod, 'toNodeAttachQuery')\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 NodeAttachedQuerySchema: 'network.xyo.query.node.attached' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.node.attached', true)\nexport type NodeAttachedQuerySchema = typeof NodeAttachedQuerySchema\n\nexport const NodeAttachedQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<NodeAttachedQuerySchema> }\n & (typeof QueryFieldsZod)['shape'],\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(NodeAttachedQuerySchema), { ...QueryFieldsZod.shape })\n\nexport type NodeAttachedQuery = z.infer<typeof NodeAttachedQueryZod>\n\nexport const isNodeAttachedQuery: ReturnType<typeof zodIsFactory<NodeAttachedQuery>> = zodIsFactory(NodeAttachedQueryZod)\nexport const asNodeAttachedQuery: ReturnType<typeof zodAsFactory<NodeAttachedQuery>> = zodAsFactory(NodeAttachedQueryZod, 'asNodeAttachedQuery')\nexport const toNodeAttachedQuery: ReturnType<typeof zodToFactory<NodeAttachedQuery>> = zodToFactory(NodeAttachedQueryZod, 'toNodeAttachedQuery')\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 { ModuleIdentifier } from '#module-model'\n\nexport const NodeCertifyQuerySchema: 'network.xyo.query.node.certify' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.node.certify', true)\nexport type NodeCertifyQuerySchema = typeof NodeCertifyQuerySchema\n\nexport const NodeCertifyQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<NodeCertifyQuerySchema> }\n & (typeof QueryFieldsZod)['shape']\n & { id: z.ZodMiniCustom<ModuleIdentifier, ModuleIdentifier> },\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(NodeCertifyQuerySchema), {\n ...QueryFieldsZod.shape,\n id: z.custom<ModuleIdentifier>(),\n})\n\nexport type NodeCertifyQuery = z.infer<typeof NodeCertifyQueryZod>\n\nexport const isNodeCertifyQuery: ReturnType<typeof zodIsFactory<NodeCertifyQuery>> = zodIsFactory(NodeCertifyQueryZod)\nexport const asNodeCertifyQuery: ReturnType<typeof zodAsFactory<NodeCertifyQuery>> = zodAsFactory(NodeCertifyQueryZod, 'asNodeCertifyQuery')\nexport const toNodeCertifyQuery: ReturnType<typeof zodToFactory<NodeCertifyQuery>> = zodToFactory(NodeCertifyQueryZod, 'toNodeCertifyQuery')\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 { ModuleIdentifier } from '#module-model'\n\nexport const NodeDetachQuerySchema: 'network.xyo.query.node.detach' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.node.detach', true)\nexport type NodeDetachQuerySchema = typeof NodeDetachQuerySchema\n\nexport const NodeDetachQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<NodeDetachQuerySchema> }\n & (typeof QueryFieldsZod)['shape']\n & { id: z.ZodMiniCustom<ModuleIdentifier, ModuleIdentifier> },\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(NodeDetachQuerySchema), {\n ...QueryFieldsZod.shape,\n id: z.custom<ModuleIdentifier>(),\n})\n\nexport type NodeDetachQuery = z.infer<typeof NodeDetachQueryZod>\n\nexport const isNodeDetachQuery: ReturnType<typeof zodIsFactory<NodeDetachQuery>> = zodIsFactory(NodeDetachQueryZod)\nexport const asNodeDetachQuery: ReturnType<typeof zodAsFactory<NodeDetachQuery>> = zodAsFactory(NodeDetachQueryZod, 'asNodeDetachQuery')\nexport const toNodeDetachQuery: ReturnType<typeof zodToFactory<NodeDetachQuery>> = zodToFactory(NodeDetachQueryZod, 'toNodeDetachQuery')\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 NodeRegisteredQuerySchema: 'network.xyo.query.node.registered' & {\n readonly __schema: true\n} = asSchema('network.xyo.query.node.registered', true)\nexport type NodeRegisteredQuerySchema = typeof NodeRegisteredQuerySchema\n\nexport const NodeRegisteredQueryZod: z.ZodMiniObject<\n & { schema: z.ZodMiniLiteral<NodeRegisteredQuerySchema> }\n & (typeof QueryFieldsZod)['shape'],\n z.core.$strip\n> = z.extend(PayloadZodOfSchema(NodeRegisteredQuerySchema), { ...QueryFieldsZod.shape })\n\nexport type NodeRegisteredQuery = z.infer<typeof NodeRegisteredQueryZod>\n\nexport const isNodeRegisteredQuery: ReturnType<typeof zodIsFactory<NodeRegisteredQuery>> = zodIsFactory(NodeRegisteredQueryZod)\nexport const asNodeRegisteredQuery: ReturnType<typeof zodAsFactory<NodeRegisteredQuery>> = zodAsFactory(NodeRegisteredQueryZod, 'asNodeRegisteredQuery')\nexport const toNodeRegisteredQuery: ReturnType<typeof zodToFactory<NodeRegisteredQuery>> = zodToFactory(NodeRegisteredQueryZod, 'toNodeRegisteredQuery')\n", "import type { TypeCheck } from '@ariestools/sdk'\nimport { IsObjectFactory } from '@ariestools/sdk'\n\nimport type { AttachableModuleInstance } from '#module-model'\n\nimport type { NodeInstance } from '../instance.ts'\nimport type { NodeModule, NodeModuleEventData } from '../Node.ts'\nimport type { NodeParams } from '../Params.ts'\n\nexport interface AttachableNodeInstance<TParams extends NodeParams = NodeParams, TEventData extends NodeModuleEventData = NodeModuleEventData>\n extends NodeModule<TParams, TEventData>,\n AttachableModuleInstance<TParams, TEventData>,\n NodeInstance<TParams, TEventData> {}\n\nexport type AttachableNodeInstanceTypeCheck<T extends AttachableNodeInstance = AttachableNodeInstance> = TypeCheck<T>\n\nexport class IsAttachableNodeInstanceFactory<T extends AttachableNodeInstance = AttachableNodeInstance> extends IsObjectFactory<T> {}\n", "import {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, PayloadZodOfSchema, type XyoAddress,\n} from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nexport const ChildCertificationSchema: 'network.xyo.child.certification' & {\n readonly __schema: true\n} = asSchema('network.xyo.child.certification', true)\nexport type ChildCertificationSchema = typeof ChildCertificationSchema\n\nexport interface ChildCertificationFields {\n address: XyoAddress\n expiration: number\n}\n\nexport const ChildCertificationZod: z.ZodMiniIntersection<\n z.ZodMiniObject<{ schema: z.ZodMiniLiteral<ChildCertificationSchema> }, z.core.$strip>,\n z.ZodMiniCustom<ChildCertificationFields, ChildCertificationFields>\n> = z.intersection(PayloadZodOfSchema(ChildCertificationSchema), z.custom<ChildCertificationFields>())\n\nexport type ChildCertification = z.infer<typeof ChildCertificationZod>\n\nexport const isChildCertification: ReturnType<typeof zodIsFactory<ChildCertification>> = zodIsFactory(ChildCertificationZod)\nexport const asChildCertification: ReturnType<typeof zodAsFactory<ChildCertification>> = zodAsFactory(ChildCertificationZod, 'asChildCertification')\nexport const toChildCertification: ReturnType<typeof zodToFactory<ChildCertification>> = zodToFactory(ChildCertificationZod, 'toChildCertification')\n", "import type { EmptyObject, WithAdditional } from '@ariestools/sdk'\nimport {\n zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport type {\n Payload,\n Schema,\n} from '@xyo-network/sdk-protocol'\nimport { asSchema } from '@xyo-network/sdk-protocol'\nimport * as z from 'zod/mini'\n\nimport type { ModuleConfig } from '#module-model'\nimport { ModuleConfigZod } from '#module-model'\n\nexport const NodeConfigSchema: 'network.xyo.node.config' & {\n readonly __schema: true\n} = asSchema('network.xyo.node.config', true)\nexport type NodeConfigSchema = typeof NodeConfigSchema\n\nexport const NodeConfigZod: z.ZodMiniObject<\n Omit<(typeof ModuleConfigZod)['shape'], 'schema'> & {\n schema: z.ZodMiniLiteral<NodeConfigSchema>\n },\n z.core.$strip\n> = z.extend(ModuleConfigZod, { schema: z.literal(NodeConfigSchema) })\n\nexport type NodeConfigBase = z.infer<typeof NodeConfigZod>\n\nexport const isNodeConfig: ReturnType<typeof zodIsFactory<NodeConfigBase>> = zodIsFactory(NodeConfigZod)\nexport const asNodeConfig: ReturnType<typeof zodAsFactory<NodeConfigBase>> = zodAsFactory(NodeConfigZod, 'asNodeConfig')\nexport const toNodeConfig: ReturnType<typeof zodToFactory<NodeConfigBase>> = zodToFactory(NodeConfigZod, 'toNodeConfig')\n\nexport type NodeConfig<TConfig extends EmptyObject | Payload | void = void, TSchema extends Schema | void = void> = ModuleConfig<\n WithAdditional<\n {\n archivist?: string\n },\n TConfig\n >,\n TSchema extends void\n ? TConfig extends Payload\n ? TConfig['schema']\n : NodeConfigSchema\n : TSchema\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,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", "z", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "PayloadZodOfSchema", "QueryFieldsZod", "z", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "PayloadZodOfSchema", "QueryFieldsZod", "z", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "PayloadZodOfSchema", "QueryFieldsZod", "z", "AsObjectFactory", "IsObjectFactory", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "PayloadZodOfSchema", "z", "zodAsFactory", "zodIsFactory", "zodToFactory", "asSchema", "z"]
|
|
7
7
|
}
|
|
@@ -113,16 +113,17 @@ var ViewNode = class extends MemoryNode {
|
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
115
|
return await this._buildMutex.runExclusive(async () => {
|
|
116
|
-
if (
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
116
|
+
if (this._built) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const source = this.source === void 0 ? void 0 : asNodeInstance(await super.resolve(this.source));
|
|
120
|
+
if (source) {
|
|
121
|
+
await Promise.all(
|
|
122
|
+
this.ids?.map(async (id) => {
|
|
123
|
+
await MemoryNodeHelper.attachToExistingNode(source, id, this);
|
|
124
|
+
}) ?? []
|
|
125
|
+
);
|
|
126
|
+
this._built = true;
|
|
126
127
|
}
|
|
127
128
|
});
|
|
128
129
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/modules/node-view/ViewNode.ts"],
|
|
4
|
-
"sourcesContent": ["import type { EventListener } from '@ariestools/sdk'\nimport {\n assertEx, zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, type Schema, type XyoAddress, type XyoQuantAddress,\n} from '@xyo-network/sdk-protocol'\nimport { Mutex } from 'async-mutex'\nimport * as z from 'zod/mini'\n\nimport type {\n AnyConfigSchema,\n ModuleFilterOptions,\n ModuleIdentifier,\n ModuleInstance,\n} from '#module-model'\nimport { creatableModule, ModuleLimitationViewLabel } from '#module-model'\nimport { SimpleModuleResolver } from '#module-resolver'\nimport { MemoryNode, MemoryNodeHelper } from '#node-memory'\nimport type {\n AttachableNodeInstance,\n NodeConfig,\n NodeModuleEventData,\n NodeParams,\n} from '#node-model'\nimport {\n asNodeInstance,\n isNodeModule,\n NodeAttachQuerySchema,\n NodeConfigZod,\n NodeDetachQuerySchema,\n NodeRegisteredQuerySchema,\n} from '#node-model'\n\nexport const ViewNodeConfigSchema: 'network.xyo.node.view.config' & {\n readonly __schema: true\n} = asSchema('network.xyo.node.view.config', true)\nexport type ViewNodeConfigSchema = typeof ViewNodeConfigSchema\n\nexport const ViewNodeConfigZod: z.ZodMiniObject<\n Omit<(typeof NodeConfigZod)['shape'], 'schema'> & {\n ids: z.ZodMiniArray<z.ZodMiniCustom<ModuleIdentifier, ModuleIdentifier>>\n schema: z.ZodMiniLiteral<ViewNodeConfigSchema>\n source: z.ZodMiniCustom<ModuleIdentifier, ModuleIdentifier>\n },\n z.core.$strip\n> = z.extend(NodeConfigZod, {\n ids: z.array(z.custom<ModuleIdentifier>()),\n schema: z.literal(ViewNodeConfigSchema),\n source: z.custom<ModuleIdentifier>(),\n})\n\nexport type ViewNodeConfigBase = z.infer<typeof ViewNodeConfigZod>\n\nexport const isViewNodeConfig: ReturnType<typeof zodIsFactory<ViewNodeConfigBase>> = zodIsFactory(ViewNodeConfigZod)\nexport const asViewNodeConfig: ReturnType<typeof zodAsFactory<ViewNodeConfigBase>> = zodAsFactory(ViewNodeConfigZod, 'asViewNodeConfig')\nexport const toViewNodeConfig: ReturnType<typeof zodToFactory<ViewNodeConfigBase>> = zodToFactory(ViewNodeConfigZod, 'toViewNodeConfig')\n\nexport type ViewNodeConfig = NodeConfig<\n {\n ids: ModuleIdentifier[]\n source: ModuleIdentifier\n },\n ViewNodeConfigSchema\n>\n\nexport type ViewNodeParams = NodeParams<AnyConfigSchema<ViewNodeConfig>>\n\n@creatableModule()\nexport class ViewNode<TParams extends ViewNodeParams = ViewNodeParams, TEventData extends NodeModuleEventData = NodeModuleEventData>\n extends MemoryNode<TParams, TEventData>\n implements AttachableNodeInstance<TParams, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, ViewNodeConfigSchema]\n static override readonly defaultConfigSchema: Schema = ViewNodeConfigSchema\n static override readonly labels: {\n ModuleLimitationLabelName: string\n } = { ...ModuleLimitationViewLabel }\n\n private _buildMutex = new Mutex()\n private _built = false\n private _limitedResolver = new SimpleModuleResolver({ root: this })\n\n get ids(): ModuleIdentifier[] | undefined {\n return this.config.ids\n }\n\n override get queries(): Schema[] {\n const disallowedQueries = new Set<Schema>([NodeAttachQuerySchema, NodeDetachQuerySchema, NodeRegisteredQuerySchema])\n const queries: Schema[] = [...super.queries]\n return queries.filter(query => !disallowedQueries.has(query))\n }\n\n get source(): ModuleIdentifier | undefined {\n return this.config.source\n }\n\n /** @deprecated do not pass undefined. If trying to get all, pass '*' */\n override async resolve(): Promise<ModuleInstance[]>\n override async resolve<T extends ModuleInstance = ModuleInstance>(all: '*', options?: ModuleFilterOptions<T>): Promise<T[]>\n override async resolve<T extends ModuleInstance = ModuleInstance>(id: ModuleIdentifier, options?: ModuleFilterOptions<T>): Promise<T | undefined>\n override async resolve<T extends ModuleInstance = ModuleInstance>(\n idOrFilter: ModuleIdentifier = '*',\n _options: ModuleFilterOptions<T> = {},\n ): Promise<T | T[] | undefined> {\n if (!this._built) {\n await this.build()\n }\n const mods = await this._limitedResolver.resolve('*')\n if (idOrFilter === '*') {\n return mods as unknown as T[]\n }\n switch (typeof idOrFilter) {\n case 'string': {\n const mod = mods.find(mod => mod.modName === idOrFilter || mod.address === idOrFilter)\n return mod as unknown as T\n }\n }\n }\n\n protected override async attachUsingAddress(address: XyoAddress): Promise<(Lowercase<string> & {\n readonly __hex: true\n } & {\n readonly __address: true\n }) | XyoQuantAddress> {\n const attached = await this.attached()\n const mods = this.registeredModules().filter(mod => attached.includes(mod.address))\n const existingModule = mods.find(mod => mod.address === address)\n if (existingModule) {\n this.logger?.warn(`ViewNode: Module [${existingModule?.modName ?? existingModule?.address}] already attached at address [${address}]`)\n }\n const mod = assertEx(this.registeredModuleMap[address], () => `Module [${address}] not found in registered mods`)\n\n mod.addParent(this)\n\n const args = { mod, name: mod.modName }\n await this.emit('moduleAttached', args)\n\n this._limitedResolver.add(mod)\n\n if (isNodeModule(mod)) {\n const attachedListener: EventListener<TEventData['moduleAttached']> = async (args: TEventData['moduleAttached']) =>\n await this.emit('moduleAttached', args)\n\n const detachedListener: EventListener<TEventData['moduleDetached']> = async (args: TEventData['moduleDetached']) =>\n await this.emit('moduleDetached', args)\n\n mod.on('moduleAttached', attachedListener)\n mod.on('moduleDetached', detachedListener)\n }\n\n return address\n }\n\n protected override async attachedPublicModules(): Promise<ModuleInstance[]> {\n return (await this._limitedResolver.resolve('*')).filter(mod => mod.address !== this.address)\n }\n\n protected override async detachUsingAddress(address: XyoAddress): Promise<(Lowercase<string> & {\n readonly __hex: true\n } & {\n readonly __address: true\n }) | XyoQuantAddress> {\n const mod = assertEx(await this.downResolver.resolve(address), () => `Module [${address}] not found in down resolver`)\n this._limitedResolver.remove(mod.address)\n return address\n }\n\n protected override async startHandler(): Promise<void> {\n await super.startHandler()\n await this.build()\n }\n\n private async build() {\n if (this._buildMutex.isLocked()) {\n // throw new Error('ViewNode is already building, please wait for it to finish before calling build again')\n return\n }\n return await this._buildMutex.runExclusive(async () => {\n if (
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AACA;AAAA,EACE;AAAA,EAAU;AAAA,EAAc;AAAA,EAAc;AAAA,OACjC;AACP;AAAA,EACE;AAAA,OACK;AACP,SAAS,aAAa;AACtB,YAAY,OAAO;AAQnB,SAAS,iBAAiB,iCAAiC;AAC3D,SAAS,4BAA4B;AACrC,SAAS,YAAY,wB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Aa;AACzB,UAAM,KAAK,MAAM;AAAA,EACnB;AAAA,EAEA,MAAc,QAAQ;AACpB,QAAI,KAAK,YAAY,SAAS,GAAG;AAE/B;AAAA,IACF;AACA,WAAO,MAAM,KAAK,YAAY,aAAa,YAAY;AACrD,UAAI,
|
|
4
|
+
"sourcesContent": ["import type { EventListener } from '@ariestools/sdk'\nimport {\n assertEx, zodAsFactory, zodIsFactory, zodToFactory,\n} from '@ariestools/sdk'\nimport {\n asSchema, type Schema, type XyoAddress, type XyoQuantAddress,\n} from '@xyo-network/sdk-protocol'\nimport { Mutex } from 'async-mutex'\nimport * as z from 'zod/mini'\n\nimport type {\n AnyConfigSchema,\n ModuleFilterOptions,\n ModuleIdentifier,\n ModuleInstance,\n} from '#module-model'\nimport { creatableModule, ModuleLimitationViewLabel } from '#module-model'\nimport { SimpleModuleResolver } from '#module-resolver'\nimport { MemoryNode, MemoryNodeHelper } from '#node-memory'\nimport type {\n AttachableNodeInstance,\n NodeConfig,\n NodeModuleEventData,\n NodeParams,\n} from '#node-model'\nimport {\n asNodeInstance,\n isNodeModule,\n NodeAttachQuerySchema,\n NodeConfigZod,\n NodeDetachQuerySchema,\n NodeRegisteredQuerySchema,\n} from '#node-model'\n\nexport const ViewNodeConfigSchema: 'network.xyo.node.view.config' & {\n readonly __schema: true\n} = asSchema('network.xyo.node.view.config', true)\nexport type ViewNodeConfigSchema = typeof ViewNodeConfigSchema\n\nexport const ViewNodeConfigZod: z.ZodMiniObject<\n Omit<(typeof NodeConfigZod)['shape'], 'schema'> & {\n ids: z.ZodMiniArray<z.ZodMiniCustom<ModuleIdentifier, ModuleIdentifier>>\n schema: z.ZodMiniLiteral<ViewNodeConfigSchema>\n source: z.ZodMiniCustom<ModuleIdentifier, ModuleIdentifier>\n },\n z.core.$strip\n> = z.extend(NodeConfigZod, {\n ids: z.array(z.custom<ModuleIdentifier>()),\n schema: z.literal(ViewNodeConfigSchema),\n source: z.custom<ModuleIdentifier>(),\n})\n\nexport type ViewNodeConfigBase = z.infer<typeof ViewNodeConfigZod>\n\nexport const isViewNodeConfig: ReturnType<typeof zodIsFactory<ViewNodeConfigBase>> = zodIsFactory(ViewNodeConfigZod)\nexport const asViewNodeConfig: ReturnType<typeof zodAsFactory<ViewNodeConfigBase>> = zodAsFactory(ViewNodeConfigZod, 'asViewNodeConfig')\nexport const toViewNodeConfig: ReturnType<typeof zodToFactory<ViewNodeConfigBase>> = zodToFactory(ViewNodeConfigZod, 'toViewNodeConfig')\n\nexport type ViewNodeConfig = NodeConfig<\n {\n ids: ModuleIdentifier[]\n source: ModuleIdentifier\n },\n ViewNodeConfigSchema\n>\n\nexport type ViewNodeParams = NodeParams<AnyConfigSchema<ViewNodeConfig>>\n\n@creatableModule()\nexport class ViewNode<TParams extends ViewNodeParams = ViewNodeParams, TEventData extends NodeModuleEventData = NodeModuleEventData>\n extends MemoryNode<TParams, TEventData>\n implements AttachableNodeInstance<TParams, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, ViewNodeConfigSchema]\n static override readonly defaultConfigSchema: Schema = ViewNodeConfigSchema\n static override readonly labels: {\n ModuleLimitationLabelName: string\n } = { ...ModuleLimitationViewLabel }\n\n private _buildMutex = new Mutex()\n private _built = false\n private _limitedResolver = new SimpleModuleResolver({ root: this })\n\n get ids(): ModuleIdentifier[] | undefined {\n return this.config.ids\n }\n\n override get queries(): Schema[] {\n const disallowedQueries = new Set<Schema>([NodeAttachQuerySchema, NodeDetachQuerySchema, NodeRegisteredQuerySchema])\n const queries: Schema[] = [...super.queries]\n return queries.filter(query => !disallowedQueries.has(query))\n }\n\n get source(): ModuleIdentifier | undefined {\n return this.config.source\n }\n\n /** @deprecated do not pass undefined. If trying to get all, pass '*' */\n override async resolve(): Promise<ModuleInstance[]>\n override async resolve<T extends ModuleInstance = ModuleInstance>(all: '*', options?: ModuleFilterOptions<T>): Promise<T[]>\n override async resolve<T extends ModuleInstance = ModuleInstance>(id: ModuleIdentifier, options?: ModuleFilterOptions<T>): Promise<T | undefined>\n override async resolve<T extends ModuleInstance = ModuleInstance>(\n idOrFilter: ModuleIdentifier = '*',\n _options: ModuleFilterOptions<T> = {},\n ): Promise<T | T[] | undefined> {\n if (!this._built) {\n await this.build()\n }\n const mods = await this._limitedResolver.resolve('*')\n if (idOrFilter === '*') {\n return mods as unknown as T[]\n }\n switch (typeof idOrFilter) {\n case 'string': {\n const mod = mods.find(mod => mod.modName === idOrFilter || mod.address === idOrFilter)\n return mod as unknown as T\n }\n }\n }\n\n protected override async attachUsingAddress(address: XyoAddress): Promise<(Lowercase<string> & {\n readonly __hex: true\n } & {\n readonly __address: true\n }) | XyoQuantAddress> {\n const attached = await this.attached()\n const mods = this.registeredModules().filter(mod => attached.includes(mod.address))\n const existingModule = mods.find(mod => mod.address === address)\n if (existingModule) {\n this.logger?.warn(`ViewNode: Module [${existingModule?.modName ?? existingModule?.address}] already attached at address [${address}]`)\n }\n const mod = assertEx(this.registeredModuleMap[address], () => `Module [${address}] not found in registered mods`)\n\n mod.addParent(this)\n\n const args = { mod, name: mod.modName }\n await this.emit('moduleAttached', args)\n\n this._limitedResolver.add(mod)\n\n if (isNodeModule(mod)) {\n const attachedListener: EventListener<TEventData['moduleAttached']> = async (args: TEventData['moduleAttached']) =>\n await this.emit('moduleAttached', args)\n\n const detachedListener: EventListener<TEventData['moduleDetached']> = async (args: TEventData['moduleDetached']) =>\n await this.emit('moduleDetached', args)\n\n mod.on('moduleAttached', attachedListener)\n mod.on('moduleDetached', detachedListener)\n }\n\n return address\n }\n\n protected override async attachedPublicModules(): Promise<ModuleInstance[]> {\n return (await this._limitedResolver.resolve('*')).filter(mod => mod.address !== this.address)\n }\n\n protected override async detachUsingAddress(address: XyoAddress): Promise<(Lowercase<string> & {\n readonly __hex: true\n } & {\n readonly __address: true\n }) | XyoQuantAddress> {\n const mod = assertEx(await this.downResolver.resolve(address), () => `Module [${address}] not found in down resolver`)\n this._limitedResolver.remove(mod.address)\n return address\n }\n\n protected override async startHandler(): Promise<void> {\n await super.startHandler()\n await this.build()\n }\n\n private async build() {\n if (this._buildMutex.isLocked()) {\n // throw new Error('ViewNode is already building, please wait for it to finish before calling build again')\n return\n }\n return await this._buildMutex.runExclusive(async () => {\n if (this._built) {\n return\n }\n\n const source = this.source === undefined ? undefined : asNodeInstance(await super.resolve(this.source))\n if (source) {\n await Promise.all(\n this.ids?.map(async (id) => {\n await MemoryNodeHelper.attachToExistingNode(source, id, this)\n }) ?? [],\n )\n this._built = true\n }\n })\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AACA;AAAA,EACE;AAAA,EAAU;AAAA,EAAc;AAAA,EAAc;AAAA,OACjC;AACP;AAAA,EACE;AAAA,OACK;AACP,SAAS,aAAa;AACtB,YAAY,OAAO;AAQnB,SAAS,iBAAiB,iCAAiC;AAC3D,SAAS,4BAA4B;AACrC,SAAS,YAAY,wBAAwB;AAO7C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,IAAM,uBAET,SAAS,gCAAgC,IAAI;AAG1C,IAAM,oBAOP,SAAO,eAAe;AAAA,EAC1B,KAAO,QAAQ,SAAyB,CAAC;AAAA,EACzC,QAAU,UAAQ,oBAAoB;AAAA,EACtC,QAAU,SAAyB;AACrC,CAAC;AAIM,IAAM,mBAAwE,aAAa,iBAAiB;AAC5G,IAAM,mBAAwE,aAAa,mBAAmB,kBAAkB;AAChI,IAAM,mBAAwE,aAAa,mBAAmB,kBAAkB;AAahI,IAAM,WAAN,cACG,WAC+C;AAAA,EAO/C,cAAc,IAAI,MAAM;AAAA,EACxB,SAAS;AAAA,EACT,mBAAmB,IAAI,qBAAqB,EAAE,MAAM,KAAK,CAAC;AAAA,EAElE,IAAI,MAAsC;AACxC,WAAO,KAAK,OAAO;AAAA,EACrB;AAAA,EAEA,IAAa,UAAoB;AAC/B,UAAM,oBAAoB,oBAAI,IAAY,CAAC,uBAAuB,uBAAuB,yBAAy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gB;AAAA,GACJ;",
|
|
6
6
|
"names": ["mod", "args"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
5
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
6
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
7
|
+
if (decorator = decorators[i])
|
|
8
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
9
|
+
if (kind && result) __defProp(target, key, result);
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
13
|
+
|
|
1
14
|
// src/modules/node-wrapper/NodeWrapper.ts
|
|
2
15
|
import { isPayloadOfSchemaType, NodeManifestPayloadSchema } from "@xyo-network/sdk-protocol";
|
|
3
16
|
import { Mutex } from "async-mutex";
|
|
@@ -16,11 +29,7 @@ import {
|
|
|
16
29
|
NodeDetachQuerySchema,
|
|
17
30
|
NodeRegisteredQuerySchema
|
|
18
31
|
} from "#node-model";
|
|
19
|
-
constructableModuleWrapper();
|
|
20
32
|
var NodeWrapper = class extends ModuleWrapper {
|
|
21
|
-
static instanceIdentityCheck = isNodeInstance;
|
|
22
|
-
static moduleIdentityCheck = isNodeModule;
|
|
23
|
-
static requiredQueries = [NodeAttachQuerySchema, ...ModuleWrapper.requiredQueries];
|
|
24
33
|
_attached;
|
|
25
34
|
_attachedMutex = new Mutex();
|
|
26
35
|
async attach(id, external) {
|
|
@@ -87,6 +96,12 @@ var NodeWrapper = class extends ModuleWrapper {
|
|
|
87
96
|
return await this.sendQueryRaw(queryPayload, [], account);
|
|
88
97
|
}
|
|
89
98
|
};
|
|
99
|
+
__publicField(NodeWrapper, "instanceIdentityCheck", isNodeInstance);
|
|
100
|
+
__publicField(NodeWrapper, "moduleIdentityCheck", isNodeModule);
|
|
101
|
+
__publicField(NodeWrapper, "requiredQueries", [NodeAttachQuerySchema, ...ModuleWrapper.requiredQueries]);
|
|
102
|
+
NodeWrapper = __decorateClass([
|
|
103
|
+
constructableModuleWrapper()
|
|
104
|
+
], NodeWrapper);
|
|
90
105
|
export {
|
|
91
106
|
NodeWrapper
|
|
92
107
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/modules/node-wrapper/NodeWrapper.ts"],
|
|
4
|
-
"sourcesContent": ["import type { TypeCheck } from '@ariestools/sdk'\nimport type {\n AccountInstance, NodeManifestPayload, XyoAddress,\n} from '@xyo-network/sdk-protocol'\nimport { isPayloadOfSchemaType, NodeManifestPayloadSchema } from '@xyo-network/sdk-protocol'\nimport { Mutex } from 'async-mutex'\n\nimport type {\n AddressPayload,\n AnyConfigSchema,\n InstanceTypeCheck,\n ModuleIdentifier,\n ModuleManifestQuery,\n ModuleQueryResult,\n} from '#module-model'\nimport {\n AddressSchema,\n ModuleManifestQuerySchema,\n} from '#module-model'\nimport { constructableModuleWrapper, ModuleWrapper } from '#module-wrapper'\nimport type {\n ChildCertification,\n ChildCertificationFields,\n NodeAttachedQuery,\n NodeAttachQuery,\n NodeCertifyQuery,\n NodeConfig,\n NodeDetachQuery,\n NodeInstance,\n NodeModule,\n NodeModuleEventData,\n NodeParams,\n NodeRegisteredQuery,\n} from '#node-model'\nimport {\n ChildCertificationSchema,\n isNodeInstance,\n isNodeModule,\n NodeAttachedQuerySchema,\n NodeAttachQuerySchema,\n NodeCertifyQuerySchema,\n NodeDetachQuerySchema,\n NodeRegisteredQuerySchema,\n} from '#node-model'\n\
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { TypeCheck } from '@ariestools/sdk'\nimport type {\n AccountInstance, NodeManifestPayload, XyoAddress,\n} from '@xyo-network/sdk-protocol'\nimport { isPayloadOfSchemaType, NodeManifestPayloadSchema } from '@xyo-network/sdk-protocol'\nimport { Mutex } from 'async-mutex'\n\nimport type {\n AddressPayload,\n AnyConfigSchema,\n InstanceTypeCheck,\n ModuleIdentifier,\n ModuleManifestQuery,\n ModuleQueryResult,\n} from '#module-model'\nimport {\n AddressSchema,\n ModuleManifestQuerySchema,\n} from '#module-model'\nimport { constructableModuleWrapper, ModuleWrapper } from '#module-wrapper'\nimport type {\n ChildCertification,\n ChildCertificationFields,\n NodeAttachedQuery,\n NodeAttachQuery,\n NodeCertifyQuery,\n NodeConfig,\n NodeDetachQuery,\n NodeInstance,\n NodeModule,\n NodeModuleEventData,\n NodeParams,\n NodeRegisteredQuery,\n} from '#node-model'\nimport {\n ChildCertificationSchema,\n isNodeInstance,\n isNodeModule,\n NodeAttachedQuerySchema,\n NodeAttachQuerySchema,\n NodeCertifyQuerySchema,\n NodeDetachQuerySchema,\n NodeRegisteredQuerySchema,\n} from '#node-model'\n\n@constructableModuleWrapper()\nexport class NodeWrapper<TWrappedModule extends NodeModule = NodeModule>\n extends ModuleWrapper<TWrappedModule>\n implements NodeInstance<TWrappedModule['params']> {\n static override readonly instanceIdentityCheck: InstanceTypeCheck<NodeInstance> = isNodeInstance\n static override readonly moduleIdentityCheck: TypeCheck<NodeModule<NodeParams<AnyConfigSchema<NodeConfig>>, NodeModuleEventData>> = isNodeModule\n static override readonly requiredQueries: string[] = [NodeAttachQuerySchema, ...ModuleWrapper.requiredQueries]\n\n protected _attached?: XyoAddress[]\n protected _attachedMutex: Mutex = new Mutex()\n\n async attach(id: ModuleIdentifier, external?: boolean): Promise<XyoAddress | undefined> {\n const queryPayload: NodeAttachQuery = {\n external, id, schema: NodeAttachQuerySchema,\n }\n const payloads = (await this.sendQuery(queryPayload)).filter(isPayloadOfSchemaType<AddressPayload>(AddressSchema))\n return payloads.pop()?.address\n }\n\n async attachQuery(id: ModuleIdentifier, external?: boolean, account?: AccountInstance): Promise<ModuleQueryResult<AddressPayload>> {\n const queryPayload: NodeAttachQuery = {\n external, id, schema: NodeAttachQuerySchema,\n }\n return await this.sendQueryRaw(queryPayload, [], account)\n }\n\n async attached(): Promise<XyoAddress[]> {\n return await this._attachedMutex.runExclusive(async () => {\n if (this._attached === undefined) {\n const queryPayload: NodeAttachedQuery = { schema: NodeAttachedQuerySchema }\n const payloads = (await this.sendQuery(queryPayload)).filter(isPayloadOfSchemaType<AddressPayload>(AddressSchema))\n this._attached = payloads.map(p => p.address)\n }\n return this._attached\n })\n }\n\n async attachedQuery(account?: AccountInstance): Promise<ModuleQueryResult<AddressPayload>> {\n const queryPayload: NodeAttachedQuery = { schema: NodeAttachedQuerySchema }\n return await this.sendQueryRaw(queryPayload, [], account)\n }\n\n async certify(id: ModuleIdentifier): Promise<ChildCertificationFields | undefined> {\n const queryPayload: NodeCertifyQuery = { id, schema: NodeCertifyQuerySchema }\n const payloads = (await this.sendQuery(queryPayload)).filter(isPayloadOfSchemaType<ChildCertification>(ChildCertificationSchema))\n return payloads.pop()\n }\n\n async certifyQuery(id: ModuleIdentifier, account?: AccountInstance): Promise<ModuleQueryResult<ChildCertification>> {\n const queryPayload: NodeCertifyQuery = { id, schema: NodeCertifyQuerySchema }\n return await this.sendQueryRaw(queryPayload, [], account)\n }\n\n async detach(id: ModuleIdentifier): Promise<XyoAddress | undefined> {\n const queryPayload: NodeDetachQuery = { id, schema: NodeDetachQuerySchema }\n const payloads = (await this.sendQuery(queryPayload)).filter(isPayloadOfSchemaType<AddressPayload>(AddressSchema))\n return payloads.pop()?.address\n }\n\n async detachQuery(id: ModuleIdentifier, account?: AccountInstance): Promise<ModuleQueryResult<AddressPayload>> {\n const queryPayload: NodeDetachQuery = { id, schema: NodeDetachQuerySchema }\n return await this.sendQueryRaw(queryPayload, [], account)\n }\n\n override async manifest(maxDepth?: number): Promise<NodeManifestPayload> {\n const queryPayload: ModuleManifestQuery = { schema: ModuleManifestQuerySchema, ...(maxDepth ? { maxDepth } : {}) }\n const payloads = (await this.sendQuery(queryPayload)).filter(isPayloadOfSchemaType<NodeManifestPayload>(NodeManifestPayloadSchema))\n return payloads.pop()!\n }\n\n async registered(): Promise<XyoAddress[]> {\n const queryPayload: NodeRegisteredQuery = { schema: NodeRegisteredQuerySchema }\n const payloads = (await this.sendQuery(queryPayload)).filter(isPayloadOfSchemaType<AddressPayload>(AddressSchema))\n return payloads.map(p => p.address)\n }\n\n async registeredQuery(account?: AccountInstance): Promise<ModuleQueryResult<AddressPayload>> {\n const queryPayload: NodeRegisteredQuery = { schema: NodeRegisteredQuerySchema }\n return await this.sendQueryRaw(queryPayload, [], account)\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAIA,SAAS,uBAAuB,iCAAiC;AACjE,SAAS,aAAa;AAUtB;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,4BAA4B,qBAAqB;AAe1D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,IAAM,cAAN,cACG,cAC0C;AAAA,EAKxC;AAAA,EACA,iBAAwB,IAAI,MAAM;AAAA,EAE5C,MAAM,OAAO,IAAsB,UAAqD;AACtF,UAAM,eAAgC;AAAA,MACpC;AAAA,MAAU;AAAA,MAAI,QAAQ;AAAA,IACxB;AACA,UAAM,YAAY,MAAM,KAAK,UAAU,YAAY,GAAG,OAAO,sBAAsC,aAAa,CAAC;AACjH,WAAO,SAAS,IAAI,GAAG;AAAA,EACzB;AAAA,EAEA,MAAM,YAAY,IAAsB,UAAoB,SAAuE;AACjI,UAAM,eAAgC;AAAA,MACpC;AAAA,MAAU;AAAA,MAAI,QAAQ;AAAA,IACxB;AACA,WAAO,MAAM,KAAK,aAAa,cAAc,CAAC,GAAG,OAAO;AAAA,E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AA2B,GAAI,WAAW,EAAE,SAAS,IAAI,CAAC,EAAG;AACjH,UAAM,YAAY,MAAM,KAAK,UAAU,YAAY,GAAG,OAAO,sBAA2C,yBAAyB,CAAC;AAClI,WAAO,SAAS,IAAI;AAAA,EACtB;AAAA,EAEA,MAAM,aAAoC;AACxC,UAAM,eAAoC,EAAE,QAAQ,0BAA0B;AAC9E,UAAM,YAAY,MAAM,KAAK,UAAU,YAAY,GAAG,OAAO,sBAAsC,aAAa,CAAC;AACjH,WAAO,SAAS,IAAI,OAAK,EAAE,OAAO;AAAA,EACpC;AAAA,EAEA,MAAM,gBAAgB,SAAuE;AAC3F,UAAM,eAAoC,EAAE,QAAQ,0BAA0B;AAC9E,WAAO,MAAM,KAAK,aAAa,cAAc,CAAC,GAAG,OAAO;AAAA,EAC1D;AACF;AA5EE,cAHW,aAGc,yBAAyD;AAClF,cAJW,aAIc,uBAA2G;AACpI,cALW,aAKc,mBAA4B,CAAC,uBAAuB,GAAG,cAAc,eAAe;AALlG,cAAN;AAAA,EADN,2BAA2B;AAAA,GACf;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -42,7 +42,8 @@ var AbstractSentinel = class extends AbstractModuleInstance {
|
|
|
42
42
|
await this.globalReentrancyMutex?.acquire();
|
|
43
43
|
await this.emit("reportStart", { inPayloads, mod: this });
|
|
44
44
|
const payloads = await this.reportHandler(inPayloads);
|
|
45
|
-
const
|
|
45
|
+
const boundWitnessBuilder = new BoundWitnessBuilder();
|
|
46
|
+
const result = (await boundWitnessBuilder.payloads(payloads).signer(this.account).build()).flat();
|
|
46
47
|
if (this.config.archiving) {
|
|
47
48
|
forget(this.storeToArchivists(result), { name: `AbstractSentinel.report.storeArchivist [${this.id}]` });
|
|
48
49
|
}
|
|
@@ -54,10 +55,9 @@ var AbstractSentinel = class extends AbstractModuleInstance {
|
|
|
54
55
|
})();
|
|
55
56
|
if (this.synchronous) {
|
|
56
57
|
return await reportPromise;
|
|
57
|
-
} else {
|
|
58
|
-
forget(reportPromise, { name: `AbstractSentinel.report [${this.id}]` });
|
|
59
|
-
return [];
|
|
60
58
|
}
|
|
59
|
+
forget(reportPromise, { name: `AbstractSentinel.report [${this.id}]` });
|
|
60
|
+
return [];
|
|
61
61
|
}, { timeBudgetLimit: 200 });
|
|
62
62
|
}
|
|
63
63
|
async reportQuery(payloads, account) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/modules/sentinel-abstract/AbstractSentinel.ts"],
|
|
4
|
-
"sourcesContent": ["import { assertEx, forget } from '@ariestools/sdk'\nimport type {\n AccountInstance, BoundWitness, Payload, QueryBoundWitness, Schema,\n} from '@xyo-network/sdk-protocol'\nimport {\n BoundWitnessBuilder, isBoundWitness, PayloadBuilder, QueryBoundWitnessWrapper,\n} from '@xyo-network/sdk-protocol'\n\nimport { AbstractModuleInstance } from '#module-abstract'\nimport type {\n ModuleConfig, ModuleQueryHandlerResult, ModuleQueryResult,\n} from '#module-model'\nimport type {\n AttachableSentinelInstance,\n CustomSentinelInstance,\n ResolvedTask,\n SentinelInstance,\n SentinelJob,\n SentinelModuleEventData,\n SentinelParams,\n SentinelQueries,\n SentinelReportQuery,\n} from '#sentinel-model'\nimport {\n SentinelConfigSchema,\n SentinelReportQuerySchema,\n} from '#sentinel-model'\n\nexport abstract class AbstractSentinel<\n TParams extends SentinelParams = SentinelParams,\n TEventData extends SentinelModuleEventData<SentinelInstance<TParams>> = SentinelModuleEventData<SentinelInstance<TParams>>,\n>\n extends AbstractModuleInstance<TParams, TEventData>\n implements CustomSentinelInstance<TParams, TEventData>, AttachableSentinelInstance<TParams, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, SentinelConfigSchema]\n static override readonly defaultConfigSchema: Schema = SentinelConfigSchema\n history: BoundWitness[] = []\n private _jobPromise?: Promise<SentinelJob>\n\n get jobPromise(): Promise<SentinelJob> {\n this._jobPromise = this._jobPromise ?? this.generateJob()\n return this._jobPromise\n }\n\n override get queries(): Schema[] {\n return [SentinelReportQuerySchema, ...super.queries]\n }\n\n get synchronous(): boolean {\n return this.config.synchronous ?? true\n }\n\n get throwErrors(): boolean {\n return this.config.throwErrors ?? true\n }\n\n async report(inPayloads?: Payload[]): Promise<Payload[]> {\n this._noOverride('report')\n this.isSupportedQuery(SentinelReportQuerySchema, 'report')\n return await this.spanAsync('report', async () => {\n const reportPromise = (async () => {\n if (this.reentrancy?.scope === 'global' && this.reentrancy?.action === 'skip' && this.globalReentrancyMutex?.isLocked()) {\n console.warn(`Skipping report for ${this.id} due to global reentrancy lock`)\n return []\n }\n try {\n await this.globalReentrancyMutex?.acquire()\n await this.emit('reportStart', { inPayloads, mod: this })\n const payloads = await this.reportHandler(inPayloads)\n\n // create boundwitness\n const
|
|
5
|
-
"mappings": ";AAAA,SAAS,UAAU,cAAc;AAIjC;AAAA,EACE;AAAA,EAAqB;AAAA,EAAgB;AAAA,EAAgB;AAAA,OAChD;AAEP,SAAS,8BAA8B;AAevC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEA,IAAe,mBAAf,cAIG,uBACgG;AAAA,EACxG,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,oBAAoB;AAAA,EAChG,OAAyB,sBAA8B;AAAA,EACvD,UAA0B,CAAC;AAAA,EACnB;AAAA,EAER,IAAI,aAAmC;AACrC,SAAK,cAAc,KAAK,eAAe,KAAK,YAAY;AACxD,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAa,UAAoB;AAC/B,WAAO,CAAC,2BAA2B,GAAG,MAAM,OAAO;AAAA,EACrD;AAAA,EAEA,IAAI,cAAuB;AACzB,WAAO,KAAK,OAAO,eAAe;AAAA,EACpC;AAAA,EAEA,IAAI,cAAuB;AACzB,WAAO,KAAK,OAAO,eAAe;AAAA,EACpC;AAAA,EAEA,MAAM,OAAO,YAA4C;AACvD,SAAK,YAAY,QAAQ;AACzB,SAAK,iBAAiB,2BAA2B,QAAQ;AACzD,WAAO,MAAM,KAAK,UAAU,UAAU,YAAY;AAChD,YAAM,iBAAiB,YAAY;AACjC,YAAI,KAAK,YAAY,UAAU,YAAY,KAAK,YAAY,WAAW,UAAU,KAAK,uBAAuB,SAAS,GAAG;AACvH,kBAAQ,KAAK,uBAAuB,KAAK,EAAE,gCAAgC;AAC3E,iBAAO,CAAC;AAAA,QACV;AACA,YAAI;AACF,gBAAM,KAAK,uBAAuB,QAAQ;AAC1C,gBAAM,KAAK,KAAK,eAAe,EAAE,YAAY,KAAK,KAAK,CAAC;AACxD,gBAAM,WAAW,MAAM,KAAK,cAAc,UAAU;AAGpD,gBAAM,UAAU,MAAM,
|
|
4
|
+
"sourcesContent": ["import { assertEx, forget } from '@ariestools/sdk'\nimport type {\n AccountInstance, BoundWitness, Payload, QueryBoundWitness, Schema,\n} from '@xyo-network/sdk-protocol'\nimport {\n BoundWitnessBuilder, isBoundWitness, PayloadBuilder, QueryBoundWitnessWrapper,\n} from '@xyo-network/sdk-protocol'\n\nimport { AbstractModuleInstance } from '#module-abstract'\nimport type {\n ModuleConfig, ModuleQueryHandlerResult, ModuleQueryResult,\n} from '#module-model'\nimport type {\n AttachableSentinelInstance,\n CustomSentinelInstance,\n ResolvedTask,\n SentinelInstance,\n SentinelJob,\n SentinelModuleEventData,\n SentinelParams,\n SentinelQueries,\n SentinelReportQuery,\n} from '#sentinel-model'\nimport {\n SentinelConfigSchema,\n SentinelReportQuerySchema,\n} from '#sentinel-model'\n\nexport abstract class AbstractSentinel<\n TParams extends SentinelParams = SentinelParams,\n TEventData extends SentinelModuleEventData<SentinelInstance<TParams>> = SentinelModuleEventData<SentinelInstance<TParams>>,\n>\n extends AbstractModuleInstance<TParams, TEventData>\n implements CustomSentinelInstance<TParams, TEventData>, AttachableSentinelInstance<TParams, TEventData> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, SentinelConfigSchema]\n static override readonly defaultConfigSchema: Schema = SentinelConfigSchema\n history: BoundWitness[] = []\n private _jobPromise?: Promise<SentinelJob>\n\n get jobPromise(): Promise<SentinelJob> {\n this._jobPromise = this._jobPromise ?? this.generateJob()\n return this._jobPromise\n }\n\n override get queries(): Schema[] {\n return [SentinelReportQuerySchema, ...super.queries]\n }\n\n get synchronous(): boolean {\n return this.config.synchronous ?? true\n }\n\n get throwErrors(): boolean {\n return this.config.throwErrors ?? true\n }\n\n async report(inPayloads?: Payload[]): Promise<Payload[]> {\n this._noOverride('report')\n this.isSupportedQuery(SentinelReportQuerySchema, 'report')\n return await this.spanAsync('report', async () => {\n const reportPromise = (async () => {\n if (this.reentrancy?.scope === 'global' && this.reentrancy?.action === 'skip' && this.globalReentrancyMutex?.isLocked()) {\n console.warn(`Skipping report for ${this.id} due to global reentrancy lock`)\n return []\n }\n try {\n await this.globalReentrancyMutex?.acquire()\n await this.emit('reportStart', { inPayloads, mod: this })\n const payloads = await this.reportHandler(inPayloads)\n\n // create boundwitness\n const boundWitnessBuilder = new BoundWitnessBuilder()\n const result = (await boundWitnessBuilder.payloads(payloads).signer(this.account).build()).flat()\n\n if (this.config.archiving) {\n forget(this.storeToArchivists(result), { name: `AbstractSentinel.report.storeArchivist [${this.id}]` })\n }\n\n await this.emitReportEnd(inPayloads, result)\n return result\n } finally {\n this.globalReentrancyMutex?.release()\n }\n }\n )()\n if (this.synchronous) {\n return await reportPromise\n }\n forget(reportPromise, { name: `AbstractSentinel.report [${this.id}]` })\n return []\n }, { timeBudgetLimit: 200 })\n }\n\n async reportQuery(payloads?: Payload[], account?: AccountInstance): Promise<ModuleQueryResult> {\n this._noOverride('reportQuery')\n const queryPayload: SentinelReportQuery = { schema: SentinelReportQuerySchema }\n return await this.sendQueryRaw(queryPayload, payloads, account)\n }\n\n protected async emitReportEnd(inPayloads?: Payload[], payloads?: Payload[]): Promise<void> {\n const boundwitnesses = payloads?.filter(isBoundWitness) ?? []\n const outPayloads = payloads?.filter(payload => !isBoundWitness(payload)) ?? []\n const boundwitness = boundwitnesses.find(bw => bw.addresses.includes(this.address))\n await this.emit('reportEnd', {\n boundwitness, inPayloads, mod: this, outPayloads,\n })\n }\n\n protected async generateJob(): Promise<SentinelJob> {\n const job: SentinelJob = { tasks: [] }\n let tasks: ResolvedTask[] = await Promise.all(\n (this.config.tasks ?? []).map(async task => ({\n input: task.input ?? false,\n mod: assertEx(await this.resolve(task.mod), () => `Unable to resolve task module [${task.mod}]`),\n })),\n )\n while (tasks.length > 0) {\n const previousTasks = job.tasks.at(-1) ?? []\n const newListCandidates\n // add all tasks that either require no previous input or have the previous input module already added\n = tasks.filter((task) => {\n const input = task.input\n if (input === undefined) {\n return true\n }\n if (typeof input === 'boolean') {\n return true\n }\n if (typeof input === 'string') {\n return previousTasks.some(prevTask => prevTask.mod.address === input || prevTask.mod.modName === input)\n }\n if (Array.isArray(input)) {\n return previousTasks.some(\n prevTask => input.includes(prevTask.mod.address) || input.includes(prevTask.mod.modName ?? prevTask.mod.address),\n )\n }\n return false\n })\n // remove any tasks that have inputs that are in the current list or the remaining tasks\n const newList = newListCandidates.filter((taskCandidate) => {\n const input = taskCandidate.input\n return !(\n Array.isArray(input)\n && tasks.some(\n remainingTask => input.includes(remainingTask.mod.address) || input.includes(remainingTask.mod.modName ?? remainingTask.mod.address),\n )\n )\n })\n assertEx(newList.length > 0, () => `Unable to generateJob [${tasks.length}]`)\n job.tasks.push(newList)\n // remove the tasks we just added\n tasks = tasks.filter(task => !newList.includes(task))\n }\n return job\n }\n\n protected override async queryHandler<T extends QueryBoundWitness = QueryBoundWitness, TConfig extends ModuleConfig = ModuleConfig>(\n query: T,\n payloads?: Payload[],\n queryConfig?: TConfig,\n ): Promise<ModuleQueryHandlerResult> {\n const wrapper = QueryBoundWitnessWrapper.parseQuery<SentinelQueries>(query, payloads)\n const queryPayload = await wrapper.getQuery()\n assertEx(await this.queryable(query, payloads, queryConfig))\n const resultPayloads: Payload[] = []\n switch (queryPayload.schema) {\n case SentinelReportQuerySchema: {\n resultPayloads.push(...(await this.report(payloads)))\n break\n }\n default: {\n return super.queryHandler(query, payloads)\n }\n }\n return PayloadBuilder.omitPrivateStorageMeta(resultPayloads)\n }\n\n abstract reportHandler(payloads?: Payload[]): Promise<Payload[]>\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,UAAU,cAAc;AAIjC;AAAA,EACE;AAAA,EAAqB;AAAA,EAAgB;AAAA,EAAgB;AAAA,OAChD;AAEP,SAAS,8BAA8B;AAevC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEA,IAAe,mBAAf,cAIG,uBACgG;AAAA,EACxG,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,oBAAoB;AAAA,EAChG,OAAyB,sBAA8B;AAAA,EACvD,UAA0B,CAAC;AAAA,EACnB;AAAA,EAER,IAAI,aAAmC;AACrC,SAAK,cAAc,KAAK,eAAe,KAAK,YAAY;AACxD,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,IAAa,UAAoB;AAC/B,WAAO,CAAC,2BAA2B,GAAG,MAAM,OAAO;AAAA,EACrD;AAAA,EAEA,IAAI,cAAuB;AACzB,WAAO,KAAK,OAAO,eAAe;AAAA,EACpC;AAAA,EAEA,IAAI,cAAuB;AACzB,WAAO,KAAK,OAAO,eAAe;AAAA,EACpC;AAAA,EAEA,MAAM,OAAO,YAA4C;AACvD,SAAK,YAAY,QAAQ;AACzB,SAAK,iBAAiB,2BAA2B,QAAQ;AACzD,WAAO,MAAM,KAAK,UAAU,UAAU,YAAY;AAChD,YAAM,iBAAiB,YAAY;AACjC,YAAI,KAAK,YAAY,UAAU,YAAY,KAAK,YAAY,WAAW,UAAU,KAAK,uBAAuB,SAAS,GAAG;AACvH,kBAAQ,KAAK,uBAAuB,KAAK,EAAE,gCAAgC;AAC3E,iBAAO,CAAC;AAAA,QACV;AACA,YAAI;AACF,gBAAM,KAAK,uBAAuB,QAAQ;AAC1C,gBAAM,KAAK,KAAK,eAAe,EAAE,YAAY,KAAK,KAAK,CAAC;AACxD,gBAAM,WAAW,MAAM,K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A,EAEA,MAAyB,aACvB,OACA,UACA,aACmC;AACnC,UAAM,UAAU,yBAAyB,WAA4B,OAAO,QAAQ;AACpF,UAAM,eAAe,MAAM,QAAQ,SAAS;AAC5C,aAAS,MAAM,KAAK,UAAU,OAAO,UAAU,WAAW,CAAC;AAC3D,UAAM,iBAA4B,CAAC;AACnC,YAAQ,aAAa,QAAQ;AAAA,MAC3B,KAAK,2BAA2B;AAC9B,uBAAe,KAAK,GAAI,MAAM,KAAK,OAAO,QAAQ,CAAE;AACpD;AAAA,MACF;AAAA,MACA,SAAS;AACP,eAAO,MAAM,aAAa,OAAO,QAAQ;AAAA,MAC3C;AAAA,IACF;AACA,WAAO,eAAe,uBAAuB,cAAc;AAAA,EAC7D;AAGF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -27,7 +27,7 @@ var SentinelIntervalAutomationWrapper = class extends PayloadWrapper {
|
|
|
27
27
|
}
|
|
28
28
|
get frequencyMillis() {
|
|
29
29
|
const frequency = this.payload.frequency;
|
|
30
|
-
if (frequency === void 0) return
|
|
30
|
+
if (frequency === void 0) return Infinity;
|
|
31
31
|
const frequencyUnits = this.payload.frequencyUnits;
|
|
32
32
|
switch (frequencyUnits ?? "hour") {
|
|
33
33
|
case "millis": {
|
|
@@ -46,12 +46,12 @@ var SentinelIntervalAutomationWrapper = class extends PayloadWrapper {
|
|
|
46
46
|
return frequency * 24 * 60 * 60 * 1e3;
|
|
47
47
|
}
|
|
48
48
|
default: {
|
|
49
|
-
return
|
|
49
|
+
return Infinity;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
get remaining() {
|
|
54
|
-
return this.payload.remaining ??
|
|
54
|
+
return this.payload.remaining ?? Infinity;
|
|
55
55
|
}
|
|
56
56
|
next() {
|
|
57
57
|
const now = Date.now();
|
|
@@ -64,15 +64,15 @@ var SentinelIntervalAutomationWrapper = class extends PayloadWrapper {
|
|
|
64
64
|
return this;
|
|
65
65
|
}
|
|
66
66
|
checkEnd() {
|
|
67
|
-
if ((this.payload.start ?? 0) > (this.payload.end ??
|
|
68
|
-
this.setStart(
|
|
67
|
+
if ((this.payload.start ?? 0) > (this.payload.end ?? Infinity)) {
|
|
68
|
+
this.setStart(Infinity);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
consumeRemaining(count = 1) {
|
|
72
72
|
if (this.payload.remaining === void 0) return;
|
|
73
73
|
const remaining = Math.max(this.remaining - count, 0);
|
|
74
74
|
this.setRemaining(remaining);
|
|
75
|
-
if (remaining <= 0) this.setStart(
|
|
75
|
+
if (remaining <= 0) this.setStart(Infinity);
|
|
76
76
|
}
|
|
77
77
|
/**
|
|
78
78
|
* Sets the remaining of the wrapped automation
|
|
@@ -108,7 +108,7 @@ var SentinelRunner = class extends Base {
|
|
|
108
108
|
get next() {
|
|
109
109
|
return Object.values(this._automations).reduce((previous, current) => {
|
|
110
110
|
if (isSentinelIntervalAutomation(current) && isSentinelIntervalAutomation(previous)) {
|
|
111
|
-
return (current.start ??
|
|
111
|
+
return (current.start ?? Infinity) < (previous?.start ?? Infinity) ? current : previous;
|
|
112
112
|
}
|
|
113
113
|
return current;
|
|
114
114
|
}, void 0);
|
|
@@ -144,7 +144,7 @@ var SentinelRunner = class extends Base {
|
|
|
144
144
|
const now = Date.now();
|
|
145
145
|
const start = Math.max(automation.start ?? now, now);
|
|
146
146
|
const delay = Math.max(start - now, 0);
|
|
147
|
-
if (delay <
|
|
147
|
+
if (delay < Infinity) {
|
|
148
148
|
this.timeoutId = setTimeout(async () => {
|
|
149
149
|
this.timeoutId = void 0;
|
|
150
150
|
return await spanRootAsync("start.setTimeout", async () => {
|
|
@@ -160,15 +160,16 @@ var SentinelRunner = class extends Base {
|
|
|
160
160
|
}, { tracer: this.tracer });
|
|
161
161
|
}, delay);
|
|
162
162
|
}
|
|
163
|
-
} else if (isDefined(automation) && automation.type === "interval" && automation.start !==
|
|
163
|
+
} else if (isDefined(automation) && automation.type === "interval" && automation.start !== Infinity) {
|
|
164
164
|
this.logger?.warn(`Unschedulable interval automation; runner stopped [${JSON.stringify(automation)}]`);
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
stop() {
|
|
168
|
-
if (isDefined(this.timeoutId)) {
|
|
169
|
-
|
|
170
|
-
this.timeoutId = void 0;
|
|
168
|
+
if (!isDefined(this.timeoutId)) {
|
|
169
|
+
return;
|
|
171
170
|
}
|
|
171
|
+
clearTimeout(this.timeoutId);
|
|
172
|
+
this.timeoutId = void 0;
|
|
172
173
|
}
|
|
173
174
|
async update(hash, automation, restart = true) {
|
|
174
175
|
this.remove(hash, false);
|
|
@@ -228,10 +229,9 @@ var MemorySentinel = class extends AbstractSentinel {
|
|
|
228
229
|
async inputAddresses(input) {
|
|
229
230
|
if (Array.isArray(input)) {
|
|
230
231
|
return (await Promise.all(input.map(async (inputItem) => await this.inputAddresses(inputItem)))).flat();
|
|
231
|
-
} else {
|
|
232
|
-
const resolved = await this.resolve(input);
|
|
233
|
-
return resolved ? [resolved.address] : [];
|
|
234
232
|
}
|
|
233
|
+
const resolved = await this.resolve(input);
|
|
234
|
+
return resolved ? [resolved.address] : [];
|
|
235
235
|
}
|
|
236
236
|
processPreviousResults(payloads, inputs) {
|
|
237
237
|
return inputs.flatMap((input) => payloads[input] ?? []);
|
|
@@ -300,7 +300,8 @@ var MemorySentinel = class extends AbstractSentinel {
|
|
|
300
300
|
})
|
|
301
301
|
);
|
|
302
302
|
const finalResult = {};
|
|
303
|
-
|
|
303
|
+
const fulfilledResults = results.filter(fulfilled);
|
|
304
|
+
for (const result of fulfilledResults) {
|
|
304
305
|
const [address, payloads] = result.value;
|
|
305
306
|
finalResult[address] = finalResult[address] ?? [];
|
|
306
307
|
finalResult[address].push(...payloads);
|