@xyo-network/bridge-pub-sub 2.111.3 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/neutral/index.d.ts +401 -8
- package/package.json +35 -54
- package/xy.config.ts +12 -0
- package/dist/browser/AbstractModuleHost/AbstractModuleHost.d.cts +0 -11
- package/dist/browser/AbstractModuleHost/AbstractModuleHost.d.cts.map +0 -1
- package/dist/browser/AbstractModuleHost/AbstractModuleHost.d.mts +0 -11
- package/dist/browser/AbstractModuleHost/AbstractModuleHost.d.mts.map +0 -1
- package/dist/browser/AbstractModuleHost/AbstractModuleHost.d.ts +0 -11
- package/dist/browser/AbstractModuleHost/AbstractModuleHost.d.ts.map +0 -1
- package/dist/browser/AbstractModuleHost/index.d.cts +0 -2
- package/dist/browser/AbstractModuleHost/index.d.cts.map +0 -1
- package/dist/browser/AbstractModuleHost/index.d.mts +0 -2
- package/dist/browser/AbstractModuleHost/index.d.mts.map +0 -1
- package/dist/browser/AbstractModuleHost/index.d.ts +0 -2
- package/dist/browser/AbstractModuleHost/index.d.ts.map +0 -1
- package/dist/browser/AsyncQueryBus/AsyncQueryBusBase.d.cts +0 -137
- package/dist/browser/AsyncQueryBus/AsyncQueryBusBase.d.cts.map +0 -1
- package/dist/browser/AsyncQueryBus/AsyncQueryBusBase.d.mts +0 -137
- package/dist/browser/AsyncQueryBus/AsyncQueryBusBase.d.mts.map +0 -1
- package/dist/browser/AsyncQueryBus/AsyncQueryBusBase.d.ts +0 -137
- package/dist/browser/AsyncQueryBus/AsyncQueryBusBase.d.ts.map +0 -1
- package/dist/browser/AsyncQueryBus/AsyncQueryBusClient.d.cts +0 -23
- package/dist/browser/AsyncQueryBus/AsyncQueryBusClient.d.cts.map +0 -1
- package/dist/browser/AsyncQueryBus/AsyncQueryBusClient.d.mts +0 -23
- package/dist/browser/AsyncQueryBus/AsyncQueryBusClient.d.mts.map +0 -1
- package/dist/browser/AsyncQueryBus/AsyncQueryBusClient.d.ts +0 -23
- package/dist/browser/AsyncQueryBus/AsyncQueryBusClient.d.ts.map +0 -1
- package/dist/browser/AsyncQueryBus/AsyncQueryBusHost.d.cts +0 -64
- package/dist/browser/AsyncQueryBus/AsyncQueryBusHost.d.cts.map +0 -1
- package/dist/browser/AsyncQueryBus/AsyncQueryBusHost.d.mts +0 -64
- package/dist/browser/AsyncQueryBus/AsyncQueryBusHost.d.mts.map +0 -1
- package/dist/browser/AsyncQueryBus/AsyncQueryBusHost.d.ts +0 -64
- package/dist/browser/AsyncQueryBus/AsyncQueryBusHost.d.ts.map +0 -1
- package/dist/browser/AsyncQueryBus/ModuleHost/ModuleHost.d.cts +0 -12
- package/dist/browser/AsyncQueryBus/ModuleHost/ModuleHost.d.cts.map +0 -1
- package/dist/browser/AsyncQueryBus/ModuleHost/ModuleHost.d.mts +0 -12
- package/dist/browser/AsyncQueryBus/ModuleHost/ModuleHost.d.mts.map +0 -1
- package/dist/browser/AsyncQueryBus/ModuleHost/ModuleHost.d.ts +0 -12
- package/dist/browser/AsyncQueryBus/ModuleHost/ModuleHost.d.ts.map +0 -1
- package/dist/browser/AsyncQueryBus/ModuleHost/index.d.cts +0 -2
- package/dist/browser/AsyncQueryBus/ModuleHost/index.d.cts.map +0 -1
- package/dist/browser/AsyncQueryBus/ModuleHost/index.d.mts +0 -2
- package/dist/browser/AsyncQueryBus/ModuleHost/index.d.mts.map +0 -1
- package/dist/browser/AsyncQueryBus/ModuleHost/index.d.ts +0 -2
- package/dist/browser/AsyncQueryBus/ModuleHost/index.d.ts.map +0 -1
- package/dist/browser/AsyncQueryBus/ModuleProxy/ModuleProxy.d.cts +0 -27
- package/dist/browser/AsyncQueryBus/ModuleProxy/ModuleProxy.d.cts.map +0 -1
- package/dist/browser/AsyncQueryBus/ModuleProxy/ModuleProxy.d.mts +0 -27
- package/dist/browser/AsyncQueryBus/ModuleProxy/ModuleProxy.d.mts.map +0 -1
- package/dist/browser/AsyncQueryBus/ModuleProxy/ModuleProxy.d.ts +0 -27
- package/dist/browser/AsyncQueryBus/ModuleProxy/ModuleProxy.d.ts.map +0 -1
- package/dist/browser/AsyncQueryBus/ModuleProxy/index.d.cts +0 -2
- package/dist/browser/AsyncQueryBus/ModuleProxy/index.d.cts.map +0 -1
- package/dist/browser/AsyncQueryBus/ModuleProxy/index.d.mts +0 -2
- package/dist/browser/AsyncQueryBus/ModuleProxy/index.d.mts.map +0 -1
- package/dist/browser/AsyncQueryBus/ModuleProxy/index.d.ts +0 -2
- package/dist/browser/AsyncQueryBus/ModuleProxy/index.d.ts.map +0 -1
- package/dist/browser/AsyncQueryBus/index.d.cts +0 -6
- package/dist/browser/AsyncQueryBus/index.d.cts.map +0 -1
- package/dist/browser/AsyncQueryBus/index.d.mts +0 -6
- package/dist/browser/AsyncQueryBus/index.d.mts.map +0 -1
- package/dist/browser/AsyncQueryBus/index.d.ts +0 -6
- package/dist/browser/AsyncQueryBus/index.d.ts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/BaseConfig.d.cts +0 -8
- package/dist/browser/AsyncQueryBus/model/BaseConfig.d.cts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/BaseConfig.d.mts +0 -8
- package/dist/browser/AsyncQueryBus/model/BaseConfig.d.mts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/BaseConfig.d.ts +0 -8
- package/dist/browser/AsyncQueryBus/model/BaseConfig.d.ts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/ClientConfig.d.cts +0 -7
- package/dist/browser/AsyncQueryBus/model/ClientConfig.d.cts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/ClientConfig.d.mts +0 -7
- package/dist/browser/AsyncQueryBus/model/ClientConfig.d.mts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/ClientConfig.d.ts +0 -7
- package/dist/browser/AsyncQueryBus/model/ClientConfig.d.ts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/HostConfig.d.cts +0 -9
- package/dist/browser/AsyncQueryBus/model/HostConfig.d.cts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/HostConfig.d.mts +0 -9
- package/dist/browser/AsyncQueryBus/model/HostConfig.d.mts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/HostConfig.d.ts +0 -9
- package/dist/browser/AsyncQueryBus/model/HostConfig.d.ts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/IntersectConfig.d.cts +0 -6
- package/dist/browser/AsyncQueryBus/model/IntersectConfig.d.cts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/IntersectConfig.d.mts +0 -6
- package/dist/browser/AsyncQueryBus/model/IntersectConfig.d.mts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/IntersectConfig.d.ts +0 -6
- package/dist/browser/AsyncQueryBus/model/IntersectConfig.d.ts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/Params.d.cts +0 -16
- package/dist/browser/AsyncQueryBus/model/Params.d.cts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/Params.d.mts +0 -16
- package/dist/browser/AsyncQueryBus/model/Params.d.mts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/Params.d.ts +0 -16
- package/dist/browser/AsyncQueryBus/model/Params.d.ts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/QueryStatus.d.cts +0 -3
- package/dist/browser/AsyncQueryBus/model/QueryStatus.d.cts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/QueryStatus.d.mts +0 -3
- package/dist/browser/AsyncQueryBus/model/QueryStatus.d.mts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/QueryStatus.d.ts +0 -3
- package/dist/browser/AsyncQueryBus/model/QueryStatus.d.ts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/index.d.cts +0 -7
- package/dist/browser/AsyncQueryBus/model/index.d.cts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/index.d.mts +0 -7
- package/dist/browser/AsyncQueryBus/model/index.d.mts.map +0 -1
- package/dist/browser/AsyncQueryBus/model/index.d.ts +0 -7
- package/dist/browser/AsyncQueryBus/model/index.d.ts.map +0 -1
- package/dist/browser/Config.d.cts +0 -12
- package/dist/browser/Config.d.cts.map +0 -1
- package/dist/browser/Config.d.mts +0 -12
- package/dist/browser/Config.d.mts.map +0 -1
- package/dist/browser/Config.d.ts +0 -12
- package/dist/browser/Config.d.ts.map +0 -1
- package/dist/browser/Params.d.cts +0 -5
- package/dist/browser/Params.d.cts.map +0 -1
- package/dist/browser/Params.d.mts +0 -5
- package/dist/browser/Params.d.mts.map +0 -1
- package/dist/browser/Params.d.ts +0 -5
- package/dist/browser/Params.d.ts.map +0 -1
- package/dist/browser/PubSubBridge.d.cts +0 -42
- package/dist/browser/PubSubBridge.d.cts.map +0 -1
- package/dist/browser/PubSubBridge.d.mts +0 -42
- package/dist/browser/PubSubBridge.d.mts.map +0 -1
- package/dist/browser/PubSubBridge.d.ts +0 -42
- package/dist/browser/PubSubBridge.d.ts.map +0 -1
- package/dist/browser/PubSubBridgeModuleResolver.d.cts +0 -26
- package/dist/browser/PubSubBridgeModuleResolver.d.cts.map +0 -1
- package/dist/browser/PubSubBridgeModuleResolver.d.mts +0 -26
- package/dist/browser/PubSubBridgeModuleResolver.d.mts.map +0 -1
- package/dist/browser/PubSubBridgeModuleResolver.d.ts +0 -26
- package/dist/browser/PubSubBridgeModuleResolver.d.ts.map +0 -1
- package/dist/browser/Schema.d.cts +0 -3
- package/dist/browser/Schema.d.cts.map +0 -1
- package/dist/browser/Schema.d.mts +0 -3
- package/dist/browser/Schema.d.mts.map +0 -1
- package/dist/browser/Schema.d.ts +0 -3
- package/dist/browser/Schema.d.ts.map +0 -1
- package/dist/browser/index.cjs +0 -1047
- package/dist/browser/index.cjs.map +0 -1
- package/dist/browser/index.d.cts +0 -8
- package/dist/browser/index.d.cts.map +0 -1
- package/dist/browser/index.d.mts +0 -8
- package/dist/browser/index.d.mts.map +0 -1
- package/dist/browser/index.d.ts +0 -8
- package/dist/browser/index.d.ts.map +0 -1
- package/dist/browser/index.mjs +0 -1026
- package/dist/browser/index.mjs.map +0 -1
- package/dist/neutral/AbstractModuleHost/AbstractModuleHost.d.cts +0 -11
- package/dist/neutral/AbstractModuleHost/AbstractModuleHost.d.cts.map +0 -1
- package/dist/neutral/AbstractModuleHost/AbstractModuleHost.d.mts +0 -11
- package/dist/neutral/AbstractModuleHost/AbstractModuleHost.d.mts.map +0 -1
- package/dist/neutral/AbstractModuleHost/AbstractModuleHost.d.ts +0 -11
- package/dist/neutral/AbstractModuleHost/AbstractModuleHost.d.ts.map +0 -1
- package/dist/neutral/AbstractModuleHost/index.d.cts +0 -2
- package/dist/neutral/AbstractModuleHost/index.d.cts.map +0 -1
- package/dist/neutral/AbstractModuleHost/index.d.mts +0 -2
- package/dist/neutral/AbstractModuleHost/index.d.mts.map +0 -1
- package/dist/neutral/AbstractModuleHost/index.d.ts +0 -2
- package/dist/neutral/AbstractModuleHost/index.d.ts.map +0 -1
- package/dist/neutral/AsyncQueryBus/AsyncQueryBusBase.d.cts +0 -137
- package/dist/neutral/AsyncQueryBus/AsyncQueryBusBase.d.cts.map +0 -1
- package/dist/neutral/AsyncQueryBus/AsyncQueryBusBase.d.mts +0 -137
- package/dist/neutral/AsyncQueryBus/AsyncQueryBusBase.d.mts.map +0 -1
- package/dist/neutral/AsyncQueryBus/AsyncQueryBusBase.d.ts +0 -137
- package/dist/neutral/AsyncQueryBus/AsyncQueryBusBase.d.ts.map +0 -1
- package/dist/neutral/AsyncQueryBus/AsyncQueryBusClient.d.cts +0 -23
- package/dist/neutral/AsyncQueryBus/AsyncQueryBusClient.d.cts.map +0 -1
- package/dist/neutral/AsyncQueryBus/AsyncQueryBusClient.d.mts +0 -23
- package/dist/neutral/AsyncQueryBus/AsyncQueryBusClient.d.mts.map +0 -1
- package/dist/neutral/AsyncQueryBus/AsyncQueryBusClient.d.ts +0 -23
- package/dist/neutral/AsyncQueryBus/AsyncQueryBusClient.d.ts.map +0 -1
- package/dist/neutral/AsyncQueryBus/AsyncQueryBusHost.d.cts +0 -64
- package/dist/neutral/AsyncQueryBus/AsyncQueryBusHost.d.cts.map +0 -1
- package/dist/neutral/AsyncQueryBus/AsyncQueryBusHost.d.mts +0 -64
- package/dist/neutral/AsyncQueryBus/AsyncQueryBusHost.d.mts.map +0 -1
- package/dist/neutral/AsyncQueryBus/AsyncQueryBusHost.d.ts +0 -64
- package/dist/neutral/AsyncQueryBus/AsyncQueryBusHost.d.ts.map +0 -1
- package/dist/neutral/AsyncQueryBus/ModuleHost/ModuleHost.d.cts +0 -12
- package/dist/neutral/AsyncQueryBus/ModuleHost/ModuleHost.d.cts.map +0 -1
- package/dist/neutral/AsyncQueryBus/ModuleHost/ModuleHost.d.mts +0 -12
- package/dist/neutral/AsyncQueryBus/ModuleHost/ModuleHost.d.mts.map +0 -1
- package/dist/neutral/AsyncQueryBus/ModuleHost/ModuleHost.d.ts +0 -12
- package/dist/neutral/AsyncQueryBus/ModuleHost/ModuleHost.d.ts.map +0 -1
- package/dist/neutral/AsyncQueryBus/ModuleHost/index.d.cts +0 -2
- package/dist/neutral/AsyncQueryBus/ModuleHost/index.d.cts.map +0 -1
- package/dist/neutral/AsyncQueryBus/ModuleHost/index.d.mts +0 -2
- package/dist/neutral/AsyncQueryBus/ModuleHost/index.d.mts.map +0 -1
- package/dist/neutral/AsyncQueryBus/ModuleHost/index.d.ts +0 -2
- package/dist/neutral/AsyncQueryBus/ModuleHost/index.d.ts.map +0 -1
- package/dist/neutral/AsyncQueryBus/ModuleProxy/ModuleProxy.d.cts +0 -27
- package/dist/neutral/AsyncQueryBus/ModuleProxy/ModuleProxy.d.cts.map +0 -1
- package/dist/neutral/AsyncQueryBus/ModuleProxy/ModuleProxy.d.mts +0 -27
- package/dist/neutral/AsyncQueryBus/ModuleProxy/ModuleProxy.d.mts.map +0 -1
- package/dist/neutral/AsyncQueryBus/ModuleProxy/ModuleProxy.d.ts +0 -27
- package/dist/neutral/AsyncQueryBus/ModuleProxy/ModuleProxy.d.ts.map +0 -1
- package/dist/neutral/AsyncQueryBus/ModuleProxy/index.d.cts +0 -2
- package/dist/neutral/AsyncQueryBus/ModuleProxy/index.d.cts.map +0 -1
- package/dist/neutral/AsyncQueryBus/ModuleProxy/index.d.mts +0 -2
- package/dist/neutral/AsyncQueryBus/ModuleProxy/index.d.mts.map +0 -1
- package/dist/neutral/AsyncQueryBus/ModuleProxy/index.d.ts +0 -2
- package/dist/neutral/AsyncQueryBus/ModuleProxy/index.d.ts.map +0 -1
- package/dist/neutral/AsyncQueryBus/index.d.cts +0 -6
- package/dist/neutral/AsyncQueryBus/index.d.cts.map +0 -1
- package/dist/neutral/AsyncQueryBus/index.d.mts +0 -6
- package/dist/neutral/AsyncQueryBus/index.d.mts.map +0 -1
- package/dist/neutral/AsyncQueryBus/index.d.ts +0 -6
- package/dist/neutral/AsyncQueryBus/index.d.ts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/BaseConfig.d.cts +0 -8
- package/dist/neutral/AsyncQueryBus/model/BaseConfig.d.cts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/BaseConfig.d.mts +0 -8
- package/dist/neutral/AsyncQueryBus/model/BaseConfig.d.mts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/BaseConfig.d.ts +0 -8
- package/dist/neutral/AsyncQueryBus/model/BaseConfig.d.ts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/ClientConfig.d.cts +0 -7
- package/dist/neutral/AsyncQueryBus/model/ClientConfig.d.cts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/ClientConfig.d.mts +0 -7
- package/dist/neutral/AsyncQueryBus/model/ClientConfig.d.mts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/ClientConfig.d.ts +0 -7
- package/dist/neutral/AsyncQueryBus/model/ClientConfig.d.ts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/HostConfig.d.cts +0 -9
- package/dist/neutral/AsyncQueryBus/model/HostConfig.d.cts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/HostConfig.d.mts +0 -9
- package/dist/neutral/AsyncQueryBus/model/HostConfig.d.mts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/HostConfig.d.ts +0 -9
- package/dist/neutral/AsyncQueryBus/model/HostConfig.d.ts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/IntersectConfig.d.cts +0 -6
- package/dist/neutral/AsyncQueryBus/model/IntersectConfig.d.cts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/IntersectConfig.d.mts +0 -6
- package/dist/neutral/AsyncQueryBus/model/IntersectConfig.d.mts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/IntersectConfig.d.ts +0 -6
- package/dist/neutral/AsyncQueryBus/model/IntersectConfig.d.ts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/Params.d.cts +0 -16
- package/dist/neutral/AsyncQueryBus/model/Params.d.cts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/Params.d.mts +0 -16
- package/dist/neutral/AsyncQueryBus/model/Params.d.mts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/Params.d.ts +0 -16
- package/dist/neutral/AsyncQueryBus/model/Params.d.ts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/QueryStatus.d.cts +0 -3
- package/dist/neutral/AsyncQueryBus/model/QueryStatus.d.cts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/QueryStatus.d.mts +0 -3
- package/dist/neutral/AsyncQueryBus/model/QueryStatus.d.mts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/QueryStatus.d.ts +0 -3
- package/dist/neutral/AsyncQueryBus/model/QueryStatus.d.ts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/index.d.cts +0 -7
- package/dist/neutral/AsyncQueryBus/model/index.d.cts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/index.d.mts +0 -7
- package/dist/neutral/AsyncQueryBus/model/index.d.mts.map +0 -1
- package/dist/neutral/AsyncQueryBus/model/index.d.ts +0 -7
- package/dist/neutral/AsyncQueryBus/model/index.d.ts.map +0 -1
- package/dist/neutral/Config.d.cts +0 -12
- package/dist/neutral/Config.d.cts.map +0 -1
- package/dist/neutral/Config.d.mts +0 -12
- package/dist/neutral/Config.d.mts.map +0 -1
- package/dist/neutral/Config.d.ts +0 -12
- package/dist/neutral/Config.d.ts.map +0 -1
- package/dist/neutral/Params.d.cts +0 -5
- package/dist/neutral/Params.d.cts.map +0 -1
- package/dist/neutral/Params.d.mts +0 -5
- package/dist/neutral/Params.d.mts.map +0 -1
- package/dist/neutral/Params.d.ts +0 -5
- package/dist/neutral/Params.d.ts.map +0 -1
- package/dist/neutral/PubSubBridge.d.cts +0 -42
- package/dist/neutral/PubSubBridge.d.cts.map +0 -1
- package/dist/neutral/PubSubBridge.d.mts +0 -42
- package/dist/neutral/PubSubBridge.d.mts.map +0 -1
- package/dist/neutral/PubSubBridge.d.ts +0 -42
- package/dist/neutral/PubSubBridge.d.ts.map +0 -1
- package/dist/neutral/PubSubBridgeModuleResolver.d.cts +0 -26
- package/dist/neutral/PubSubBridgeModuleResolver.d.cts.map +0 -1
- package/dist/neutral/PubSubBridgeModuleResolver.d.mts +0 -26
- package/dist/neutral/PubSubBridgeModuleResolver.d.mts.map +0 -1
- package/dist/neutral/PubSubBridgeModuleResolver.d.ts +0 -26
- package/dist/neutral/PubSubBridgeModuleResolver.d.ts.map +0 -1
- package/dist/neutral/Schema.d.cts +0 -3
- package/dist/neutral/Schema.d.cts.map +0 -1
- package/dist/neutral/Schema.d.mts +0 -3
- package/dist/neutral/Schema.d.mts.map +0 -1
- package/dist/neutral/Schema.d.ts +0 -3
- package/dist/neutral/Schema.d.ts.map +0 -1
- package/dist/neutral/index.cjs +0 -1047
- package/dist/neutral/index.cjs.map +0 -1
- package/dist/neutral/index.d.cts +0 -8
- package/dist/neutral/index.d.cts.map +0 -1
- package/dist/neutral/index.d.mts +0 -8
- package/dist/neutral/index.d.mts.map +0 -1
- package/dist/neutral/index.d.ts.map +0 -1
- package/dist/node/AbstractModuleHost/AbstractModuleHost.d.cts +0 -11
- package/dist/node/AbstractModuleHost/AbstractModuleHost.d.cts.map +0 -1
- package/dist/node/AbstractModuleHost/AbstractModuleHost.d.mts +0 -11
- package/dist/node/AbstractModuleHost/AbstractModuleHost.d.mts.map +0 -1
- package/dist/node/AbstractModuleHost/AbstractModuleHost.d.ts +0 -11
- package/dist/node/AbstractModuleHost/AbstractModuleHost.d.ts.map +0 -1
- package/dist/node/AbstractModuleHost/index.d.cts +0 -2
- package/dist/node/AbstractModuleHost/index.d.cts.map +0 -1
- package/dist/node/AbstractModuleHost/index.d.mts +0 -2
- package/dist/node/AbstractModuleHost/index.d.mts.map +0 -1
- package/dist/node/AbstractModuleHost/index.d.ts +0 -2
- package/dist/node/AbstractModuleHost/index.d.ts.map +0 -1
- package/dist/node/AsyncQueryBus/AsyncQueryBusBase.d.cts +0 -137
- package/dist/node/AsyncQueryBus/AsyncQueryBusBase.d.cts.map +0 -1
- package/dist/node/AsyncQueryBus/AsyncQueryBusBase.d.mts +0 -137
- package/dist/node/AsyncQueryBus/AsyncQueryBusBase.d.mts.map +0 -1
- package/dist/node/AsyncQueryBus/AsyncQueryBusBase.d.ts +0 -137
- package/dist/node/AsyncQueryBus/AsyncQueryBusBase.d.ts.map +0 -1
- package/dist/node/AsyncQueryBus/AsyncQueryBusClient.d.cts +0 -23
- package/dist/node/AsyncQueryBus/AsyncQueryBusClient.d.cts.map +0 -1
- package/dist/node/AsyncQueryBus/AsyncQueryBusClient.d.mts +0 -23
- package/dist/node/AsyncQueryBus/AsyncQueryBusClient.d.mts.map +0 -1
- package/dist/node/AsyncQueryBus/AsyncQueryBusClient.d.ts +0 -23
- package/dist/node/AsyncQueryBus/AsyncQueryBusClient.d.ts.map +0 -1
- package/dist/node/AsyncQueryBus/AsyncQueryBusHost.d.cts +0 -64
- package/dist/node/AsyncQueryBus/AsyncQueryBusHost.d.cts.map +0 -1
- package/dist/node/AsyncQueryBus/AsyncQueryBusHost.d.mts +0 -64
- package/dist/node/AsyncQueryBus/AsyncQueryBusHost.d.mts.map +0 -1
- package/dist/node/AsyncQueryBus/AsyncQueryBusHost.d.ts +0 -64
- package/dist/node/AsyncQueryBus/AsyncQueryBusHost.d.ts.map +0 -1
- package/dist/node/AsyncQueryBus/ModuleHost/ModuleHost.d.cts +0 -12
- package/dist/node/AsyncQueryBus/ModuleHost/ModuleHost.d.cts.map +0 -1
- package/dist/node/AsyncQueryBus/ModuleHost/ModuleHost.d.mts +0 -12
- package/dist/node/AsyncQueryBus/ModuleHost/ModuleHost.d.mts.map +0 -1
- package/dist/node/AsyncQueryBus/ModuleHost/ModuleHost.d.ts +0 -12
- package/dist/node/AsyncQueryBus/ModuleHost/ModuleHost.d.ts.map +0 -1
- package/dist/node/AsyncQueryBus/ModuleHost/index.d.cts +0 -2
- package/dist/node/AsyncQueryBus/ModuleHost/index.d.cts.map +0 -1
- package/dist/node/AsyncQueryBus/ModuleHost/index.d.mts +0 -2
- package/dist/node/AsyncQueryBus/ModuleHost/index.d.mts.map +0 -1
- package/dist/node/AsyncQueryBus/ModuleHost/index.d.ts +0 -2
- package/dist/node/AsyncQueryBus/ModuleHost/index.d.ts.map +0 -1
- package/dist/node/AsyncQueryBus/ModuleProxy/ModuleProxy.d.cts +0 -27
- package/dist/node/AsyncQueryBus/ModuleProxy/ModuleProxy.d.cts.map +0 -1
- package/dist/node/AsyncQueryBus/ModuleProxy/ModuleProxy.d.mts +0 -27
- package/dist/node/AsyncQueryBus/ModuleProxy/ModuleProxy.d.mts.map +0 -1
- package/dist/node/AsyncQueryBus/ModuleProxy/ModuleProxy.d.ts +0 -27
- package/dist/node/AsyncQueryBus/ModuleProxy/ModuleProxy.d.ts.map +0 -1
- package/dist/node/AsyncQueryBus/ModuleProxy/index.d.cts +0 -2
- package/dist/node/AsyncQueryBus/ModuleProxy/index.d.cts.map +0 -1
- package/dist/node/AsyncQueryBus/ModuleProxy/index.d.mts +0 -2
- package/dist/node/AsyncQueryBus/ModuleProxy/index.d.mts.map +0 -1
- package/dist/node/AsyncQueryBus/ModuleProxy/index.d.ts +0 -2
- package/dist/node/AsyncQueryBus/ModuleProxy/index.d.ts.map +0 -1
- package/dist/node/AsyncQueryBus/index.d.cts +0 -6
- package/dist/node/AsyncQueryBus/index.d.cts.map +0 -1
- package/dist/node/AsyncQueryBus/index.d.mts +0 -6
- package/dist/node/AsyncQueryBus/index.d.mts.map +0 -1
- package/dist/node/AsyncQueryBus/index.d.ts +0 -6
- package/dist/node/AsyncQueryBus/index.d.ts.map +0 -1
- package/dist/node/AsyncQueryBus/model/BaseConfig.d.cts +0 -8
- package/dist/node/AsyncQueryBus/model/BaseConfig.d.cts.map +0 -1
- package/dist/node/AsyncQueryBus/model/BaseConfig.d.mts +0 -8
- package/dist/node/AsyncQueryBus/model/BaseConfig.d.mts.map +0 -1
- package/dist/node/AsyncQueryBus/model/BaseConfig.d.ts +0 -8
- package/dist/node/AsyncQueryBus/model/BaseConfig.d.ts.map +0 -1
- package/dist/node/AsyncQueryBus/model/ClientConfig.d.cts +0 -7
- package/dist/node/AsyncQueryBus/model/ClientConfig.d.cts.map +0 -1
- package/dist/node/AsyncQueryBus/model/ClientConfig.d.mts +0 -7
- package/dist/node/AsyncQueryBus/model/ClientConfig.d.mts.map +0 -1
- package/dist/node/AsyncQueryBus/model/ClientConfig.d.ts +0 -7
- package/dist/node/AsyncQueryBus/model/ClientConfig.d.ts.map +0 -1
- package/dist/node/AsyncQueryBus/model/HostConfig.d.cts +0 -9
- package/dist/node/AsyncQueryBus/model/HostConfig.d.cts.map +0 -1
- package/dist/node/AsyncQueryBus/model/HostConfig.d.mts +0 -9
- package/dist/node/AsyncQueryBus/model/HostConfig.d.mts.map +0 -1
- package/dist/node/AsyncQueryBus/model/HostConfig.d.ts +0 -9
- package/dist/node/AsyncQueryBus/model/HostConfig.d.ts.map +0 -1
- package/dist/node/AsyncQueryBus/model/IntersectConfig.d.cts +0 -6
- package/dist/node/AsyncQueryBus/model/IntersectConfig.d.cts.map +0 -1
- package/dist/node/AsyncQueryBus/model/IntersectConfig.d.mts +0 -6
- package/dist/node/AsyncQueryBus/model/IntersectConfig.d.mts.map +0 -1
- package/dist/node/AsyncQueryBus/model/IntersectConfig.d.ts +0 -6
- package/dist/node/AsyncQueryBus/model/IntersectConfig.d.ts.map +0 -1
- package/dist/node/AsyncQueryBus/model/Params.d.cts +0 -16
- package/dist/node/AsyncQueryBus/model/Params.d.cts.map +0 -1
- package/dist/node/AsyncQueryBus/model/Params.d.mts +0 -16
- package/dist/node/AsyncQueryBus/model/Params.d.mts.map +0 -1
- package/dist/node/AsyncQueryBus/model/Params.d.ts +0 -16
- package/dist/node/AsyncQueryBus/model/Params.d.ts.map +0 -1
- package/dist/node/AsyncQueryBus/model/QueryStatus.d.cts +0 -3
- package/dist/node/AsyncQueryBus/model/QueryStatus.d.cts.map +0 -1
- package/dist/node/AsyncQueryBus/model/QueryStatus.d.mts +0 -3
- package/dist/node/AsyncQueryBus/model/QueryStatus.d.mts.map +0 -1
- package/dist/node/AsyncQueryBus/model/QueryStatus.d.ts +0 -3
- package/dist/node/AsyncQueryBus/model/QueryStatus.d.ts.map +0 -1
- package/dist/node/AsyncQueryBus/model/index.d.cts +0 -7
- package/dist/node/AsyncQueryBus/model/index.d.cts.map +0 -1
- package/dist/node/AsyncQueryBus/model/index.d.mts +0 -7
- package/dist/node/AsyncQueryBus/model/index.d.mts.map +0 -1
- package/dist/node/AsyncQueryBus/model/index.d.ts +0 -7
- package/dist/node/AsyncQueryBus/model/index.d.ts.map +0 -1
- package/dist/node/Config.d.cts +0 -12
- package/dist/node/Config.d.cts.map +0 -1
- package/dist/node/Config.d.mts +0 -12
- package/dist/node/Config.d.mts.map +0 -1
- package/dist/node/Config.d.ts +0 -12
- package/dist/node/Config.d.ts.map +0 -1
- package/dist/node/Params.d.cts +0 -5
- package/dist/node/Params.d.cts.map +0 -1
- package/dist/node/Params.d.mts +0 -5
- package/dist/node/Params.d.mts.map +0 -1
- package/dist/node/Params.d.ts +0 -5
- package/dist/node/Params.d.ts.map +0 -1
- package/dist/node/PubSubBridge.d.cts +0 -42
- package/dist/node/PubSubBridge.d.cts.map +0 -1
- package/dist/node/PubSubBridge.d.mts +0 -42
- package/dist/node/PubSubBridge.d.mts.map +0 -1
- package/dist/node/PubSubBridge.d.ts +0 -42
- package/dist/node/PubSubBridge.d.ts.map +0 -1
- package/dist/node/PubSubBridgeModuleResolver.d.cts +0 -26
- package/dist/node/PubSubBridgeModuleResolver.d.cts.map +0 -1
- package/dist/node/PubSubBridgeModuleResolver.d.mts +0 -26
- package/dist/node/PubSubBridgeModuleResolver.d.mts.map +0 -1
- package/dist/node/PubSubBridgeModuleResolver.d.ts +0 -26
- package/dist/node/PubSubBridgeModuleResolver.d.ts.map +0 -1
- package/dist/node/Schema.d.cts +0 -3
- package/dist/node/Schema.d.cts.map +0 -1
- package/dist/node/Schema.d.mts +0 -3
- package/dist/node/Schema.d.mts.map +0 -1
- package/dist/node/Schema.d.ts +0 -3
- package/dist/node/Schema.d.ts.map +0 -1
- package/dist/node/index.cjs +0 -1103
- package/dist/node/index.cjs.map +0 -1
- package/dist/node/index.d.cts +0 -8
- package/dist/node/index.d.cts.map +0 -1
- package/dist/node/index.d.mts +0 -8
- package/dist/node/index.d.mts.map +0 -1
- package/dist/node/index.d.ts +0 -8
- package/dist/node/index.d.ts.map +0 -1
- package/dist/node/index.mjs +0 -1069
- package/dist/node/index.mjs.map +0 -1
package/dist/node/index.cjs
DELETED
|
@@ -1,1103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __reflectGet = Reflect.get;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
10
|
-
var __export = (target, all) => {
|
|
11
|
-
for (var name in all)
|
|
12
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
-
};
|
|
14
|
-
var __copyProps = (to, from, except, desc) => {
|
|
15
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
-
for (let key of __getOwnPropNames(from))
|
|
17
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
|
-
var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
|
|
25
|
-
|
|
26
|
-
// src/index.ts
|
|
27
|
-
var src_exports = {};
|
|
28
|
-
__export(src_exports, {
|
|
29
|
-
AbstractModuleHost: () => AbstractModuleHost,
|
|
30
|
-
AsyncQueryBusClient: () => AsyncQueryBusClient,
|
|
31
|
-
AsyncQueryBusHost: () => AsyncQueryBusHost,
|
|
32
|
-
AsyncQueryBusModuleHost: () => AsyncQueryBusModuleHost,
|
|
33
|
-
AsyncQueryBusModuleProxy: () => AsyncQueryBusModuleProxy,
|
|
34
|
-
Pending: () => Pending,
|
|
35
|
-
PubSubBridge: () => PubSubBridge,
|
|
36
|
-
PubSubBridgeConfigSchema: () => PubSubBridgeConfigSchema,
|
|
37
|
-
PubSubBridgeModuleResolver: () => PubSubBridgeModuleResolver,
|
|
38
|
-
PubSubBridgeSchema: () => PubSubBridgeSchema
|
|
39
|
-
});
|
|
40
|
-
module.exports = __toCommonJS(src_exports);
|
|
41
|
-
|
|
42
|
-
// src/AbstractModuleHost/AbstractModuleHost.ts
|
|
43
|
-
var import_object = require("@xylabs/object");
|
|
44
|
-
var _AbstractModuleHost = class _AbstractModuleHost extends import_object.Base {
|
|
45
|
-
};
|
|
46
|
-
__name(_AbstractModuleHost, "AbstractModuleHost");
|
|
47
|
-
var AbstractModuleHost = _AbstractModuleHost;
|
|
48
|
-
|
|
49
|
-
// src/AsyncQueryBus/AsyncQueryBusClient.ts
|
|
50
|
-
var import_assert2 = require("@xylabs/assert");
|
|
51
|
-
var import_delay = require("@xylabs/delay");
|
|
52
|
-
var import_forget = require("@xylabs/forget");
|
|
53
|
-
var import_timer = require("@xylabs/timer");
|
|
54
|
-
var import_boundwitness_model = require("@xyo-network/boundwitness-model");
|
|
55
|
-
var import_diviner_boundwitness_model = require("@xyo-network/diviner-boundwitness-model");
|
|
56
|
-
var import_payload_builder = require("@xyo-network/payload-builder");
|
|
57
|
-
var import_lru_cache2 = require("lru-cache");
|
|
58
|
-
|
|
59
|
-
// src/AsyncQueryBus/AsyncQueryBusBase.ts
|
|
60
|
-
var import_assert = require("@xylabs/assert");
|
|
61
|
-
var import_object2 = require("@xylabs/object");
|
|
62
|
-
var import_archivist_model = require("@xyo-network/archivist-model");
|
|
63
|
-
var import_diviner_model = require("@xyo-network/diviner-model");
|
|
64
|
-
var import_module_model = require("@xyo-network/module-model");
|
|
65
|
-
var import_async_mutex = require("async-mutex");
|
|
66
|
-
var import_lru_cache = require("lru-cache");
|
|
67
|
-
var POLLING_FREQUENCY_MIN = 100;
|
|
68
|
-
var POLLING_FREQUENCY_MAX = 6e4;
|
|
69
|
-
var POLLING_FREQUENCY_DEFAULT = 1e3;
|
|
70
|
-
var _AsyncQueryBusBase = class _AsyncQueryBusBase extends import_object2.Base {
|
|
71
|
-
_lastState;
|
|
72
|
-
_targetConfigs = {};
|
|
73
|
-
_targetQueries = {};
|
|
74
|
-
_lastResolveFailure = {};
|
|
75
|
-
_queriesArchivist;
|
|
76
|
-
_queriesDiviner;
|
|
77
|
-
_reResolveDelay = 1e3 * 5;
|
|
78
|
-
_resolveMutex = new import_async_mutex.Mutex();
|
|
79
|
-
_responsesArchivist;
|
|
80
|
-
_responsesDiviner;
|
|
81
|
-
constructor(params) {
|
|
82
|
-
super(params);
|
|
83
|
-
}
|
|
84
|
-
get config() {
|
|
85
|
-
return this.params.config;
|
|
86
|
-
}
|
|
87
|
-
get pollFrequency() {
|
|
88
|
-
var _a;
|
|
89
|
-
const frequency = ((_a = this.config) == null ? void 0 : _a.pollFrequency) ?? POLLING_FREQUENCY_DEFAULT;
|
|
90
|
-
if (frequency < POLLING_FREQUENCY_MIN || frequency > POLLING_FREQUENCY_MAX) {
|
|
91
|
-
return POLLING_FREQUENCY_DEFAULT;
|
|
92
|
-
}
|
|
93
|
-
return frequency;
|
|
94
|
-
}
|
|
95
|
-
get rootModule() {
|
|
96
|
-
return this.params.rootModule;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* A cache of the last offset of the Diviner process per address
|
|
100
|
-
*/
|
|
101
|
-
get lastState() {
|
|
102
|
-
const requiredConfig = {
|
|
103
|
-
max: 1e3,
|
|
104
|
-
ttl: 0
|
|
105
|
-
};
|
|
106
|
-
this._lastState = this._lastState ?? new import_lru_cache.LRUCache(requiredConfig);
|
|
107
|
-
return this._lastState;
|
|
108
|
-
}
|
|
109
|
-
async queriesArchivist() {
|
|
110
|
-
return await this._resolveMutex.runExclusive(async () => {
|
|
111
|
-
var _a, _b, _c;
|
|
112
|
-
this._queriesArchivist = this._queriesArchivist ?? await this.resolve((0, import_assert.assertEx)((_c = (_b = (_a = this.config) == null ? void 0 : _a.intersect) == null ? void 0 : _b.queries) == null ? void 0 : _c.archivist, () => "No queries Archivist defined"), import_archivist_model.isArchivistInstance);
|
|
113
|
-
return this._queriesArchivist;
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
async queriesDiviner() {
|
|
117
|
-
return await this._resolveMutex.runExclusive(async () => {
|
|
118
|
-
var _a, _b, _c;
|
|
119
|
-
this._queriesDiviner = this._queriesDiviner ?? await this.resolve((0, import_assert.assertEx)((_c = (_b = (_a = this.config) == null ? void 0 : _a.intersect) == null ? void 0 : _b.queries) == null ? void 0 : _c.boundWitnessDiviner, () => "No queries Diviner defined"), import_diviner_model.isDivinerInstance);
|
|
120
|
-
return this._queriesDiviner;
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
async responsesArchivist() {
|
|
124
|
-
return await this._resolveMutex.runExclusive(async () => {
|
|
125
|
-
var _a, _b, _c;
|
|
126
|
-
this._responsesArchivist = this._responsesArchivist ?? await this.resolve((0, import_assert.assertEx)((_c = (_b = (_a = this.config) == null ? void 0 : _a.intersect) == null ? void 0 : _b.responses) == null ? void 0 : _c.archivist, () => "No responses Archivist defined"), import_archivist_model.isArchivistInstance);
|
|
127
|
-
return this._responsesArchivist;
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
async responsesDiviner() {
|
|
131
|
-
return await this._resolveMutex.runExclusive(async () => {
|
|
132
|
-
var _a, _b, _c;
|
|
133
|
-
this._responsesDiviner = this._responsesDiviner ?? await this.resolve((0, import_assert.assertEx)((_c = (_b = (_a = this.config) == null ? void 0 : _a.intersect) == null ? void 0 : _b.responses) == null ? void 0 : _c.boundWitnessDiviner, () => "No responses Diviner defined"), import_diviner_model.isDivinerInstance);
|
|
134
|
-
return this._responsesDiviner;
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Commit the internal state of the process. This is similar
|
|
139
|
-
* to a transaction completion in a database and should only be called
|
|
140
|
-
* when results have been successfully persisted to the appropriate
|
|
141
|
-
* external stores.
|
|
142
|
-
* @param address The module address to commit the state for
|
|
143
|
-
* @param nextState The state to commit
|
|
144
|
-
*/
|
|
145
|
-
async commitState(address, nextState) {
|
|
146
|
-
await Promise.resolve();
|
|
147
|
-
const lastState = this.lastState.get(address);
|
|
148
|
-
if (lastState && lastState >= nextState) return;
|
|
149
|
-
this.lastState.set(address, nextState);
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Retrieves the last state of the process. Used to recover state after
|
|
153
|
-
* preemptions, reboots, etc.
|
|
154
|
-
*/
|
|
155
|
-
async retrieveState(address) {
|
|
156
|
-
await Promise.resolve();
|
|
157
|
-
const state = this.lastState.get(address);
|
|
158
|
-
if (state === void 0) {
|
|
159
|
-
const newState = Date.now() - 1e3;
|
|
160
|
-
this.lastState.set(address, newState);
|
|
161
|
-
return newState;
|
|
162
|
-
} else {
|
|
163
|
-
return state;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
async resolve(id, typeCheck) {
|
|
167
|
-
var _a, _b, _c;
|
|
168
|
-
if (Date.now() - (this._lastResolveFailure[id] ?? 0) < this._reResolveDelay) {
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
this._lastResolveFailure[id] = Date.now();
|
|
172
|
-
const resolved = await import_module_model.ResolveHelper.resolveModuleIdentifier(this.rootModule, id);
|
|
173
|
-
if (resolved) {
|
|
174
|
-
if (typeCheck(resolved)) {
|
|
175
|
-
delete this._lastResolveFailure[id];
|
|
176
|
-
return resolved;
|
|
177
|
-
} else {
|
|
178
|
-
(_b = this.logger) == null ? void 0 : _b.warn(`Unable to resolve responsesDiviner as correct type [${id}][${(_a = resolved == null ? void 0 : resolved.constructor) == null ? void 0 : _a.name}]: ${resolved.id}`);
|
|
179
|
-
}
|
|
180
|
-
} else {
|
|
181
|
-
(_c = this.logger) == null ? void 0 : _c.debug(`Unable to resolve queriesArchivist [${id}] [${await import_module_model.ResolveHelper.traceModuleIdentifier(this.rootModule, id)}]`);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
__name(_AsyncQueryBusBase, "AsyncQueryBusBase");
|
|
186
|
-
var AsyncQueryBusBase = _AsyncQueryBusBase;
|
|
187
|
-
|
|
188
|
-
// src/AsyncQueryBus/model/QueryStatus.ts
|
|
189
|
-
var Pending = "pending";
|
|
190
|
-
|
|
191
|
-
// src/AsyncQueryBus/AsyncQueryBusClient.ts
|
|
192
|
-
var _AsyncQueryBusClient = class _AsyncQueryBusClient extends AsyncQueryBusBase {
|
|
193
|
-
_queryCache;
|
|
194
|
-
_pollCount = 0;
|
|
195
|
-
_pollId;
|
|
196
|
-
constructor(params) {
|
|
197
|
-
super(params);
|
|
198
|
-
}
|
|
199
|
-
get queryCacheConfig() {
|
|
200
|
-
var _a, _b;
|
|
201
|
-
const queryCacheConfig = ((_a = this.config) == null ? void 0 : _a.queryCache) === true ? {} : (_b = this.config) == null ? void 0 : _b.queryCache;
|
|
202
|
-
return {
|
|
203
|
-
max: 100,
|
|
204
|
-
ttl: 1e3 * 60,
|
|
205
|
-
...queryCacheConfig
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
get started() {
|
|
209
|
-
return !!this._pollId;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* A cache of queries that have been issued
|
|
213
|
-
*/
|
|
214
|
-
get queryCache() {
|
|
215
|
-
const config = this.queryCacheConfig;
|
|
216
|
-
const requiredConfig = {
|
|
217
|
-
noUpdateTTL: false,
|
|
218
|
-
ttlAutopurge: true
|
|
219
|
-
};
|
|
220
|
-
this._queryCache = this._queryCache ?? new import_lru_cache2.LRUCache({
|
|
221
|
-
...config,
|
|
222
|
-
...requiredConfig
|
|
223
|
-
});
|
|
224
|
-
return this._queryCache;
|
|
225
|
-
}
|
|
226
|
-
listeningAddresses() {
|
|
227
|
-
var _a;
|
|
228
|
-
return (_a = this._queryCache) == null ? void 0 : _a.keys();
|
|
229
|
-
}
|
|
230
|
-
async send(address, query, payloads) {
|
|
231
|
-
var _a, _b, _c, _d;
|
|
232
|
-
(_a = this.logger) == null ? void 0 : _a.debug(`Begin issuing query to: ${address}`);
|
|
233
|
-
const $meta = {
|
|
234
|
-
...query == null ? void 0 : query.$meta,
|
|
235
|
-
destination: [
|
|
236
|
-
address
|
|
237
|
-
]
|
|
238
|
-
};
|
|
239
|
-
const routedQuery = await import_payload_builder.PayloadBuilder.build({
|
|
240
|
-
...query,
|
|
241
|
-
$meta
|
|
242
|
-
});
|
|
243
|
-
const queryArchivist = (0, import_assert2.assertEx)(await this.queriesArchivist(), () => {
|
|
244
|
-
var _a2, _b2, _c2;
|
|
245
|
-
return `Unable to contact queriesArchivist [${(_c2 = (_b2 = (_a2 = this.config) == null ? void 0 : _a2.intersect) == null ? void 0 : _b2.queries) == null ? void 0 : _c2.archivist}]`;
|
|
246
|
-
});
|
|
247
|
-
const routedQueryHash = (routedQuery == null ? void 0 : routedQuery.$hash) ?? Object.keys(await import_payload_builder.PayloadBuilder.dataHash(routedQuery));
|
|
248
|
-
(_b = this.logger) == null ? void 0 : _b.debug(`Issuing query: ${routedQueryHash} to: ${address}`);
|
|
249
|
-
const data = payloads ? [
|
|
250
|
-
routedQuery,
|
|
251
|
-
...payloads
|
|
252
|
-
] : [
|
|
253
|
-
routedQuery
|
|
254
|
-
];
|
|
255
|
-
const insertResult = await ((_c = queryArchivist.insert) == null ? void 0 : _c.call(queryArchivist, data));
|
|
256
|
-
(_d = this.logger) == null ? void 0 : _d.debug(`Issued query: ${routedQueryHash} to: ${address}`);
|
|
257
|
-
this.queryCache.set(routedQueryHash, Pending);
|
|
258
|
-
if (!insertResult) throw new Error("Unable to issue query to queryArchivist");
|
|
259
|
-
return new Promise((resolve, reject) => {
|
|
260
|
-
var _a2;
|
|
261
|
-
(_a2 = this.logger) == null ? void 0 : _a2.debug(`Polling for response to query: ${routedQueryHash}`);
|
|
262
|
-
let nextDelay = 100;
|
|
263
|
-
const pollForResponse = /* @__PURE__ */ __name(async () => {
|
|
264
|
-
var _a3, _b2;
|
|
265
|
-
try {
|
|
266
|
-
this.start();
|
|
267
|
-
let response = this.queryCache.get(routedQueryHash);
|
|
268
|
-
while (response !== void 0) {
|
|
269
|
-
await (0, import_delay.delay)(nextDelay);
|
|
270
|
-
response = this.queryCache.get(routedQueryHash);
|
|
271
|
-
if (response && response !== Pending) {
|
|
272
|
-
(_a3 = this.logger) == null ? void 0 : _a3.log(`Returning response to query: ${routedQueryHash}`);
|
|
273
|
-
resolve(response);
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
nextDelay = Math.floor(nextDelay * 1.2);
|
|
277
|
-
if (nextDelay > 1e3) nextDelay = 1e3;
|
|
278
|
-
}
|
|
279
|
-
(_b2 = this.logger) == null ? void 0 : _b2.error("Timeout waiting for query response");
|
|
280
|
-
const error = {
|
|
281
|
-
message: "Timeout waiting for query response",
|
|
282
|
-
query: "network.xyo.boundwitness",
|
|
283
|
-
schema: "network.xyo.error.module",
|
|
284
|
-
sources: [
|
|
285
|
-
routedQueryHash
|
|
286
|
-
]
|
|
287
|
-
};
|
|
288
|
-
reject(error);
|
|
289
|
-
return;
|
|
290
|
-
} finally {
|
|
291
|
-
this.stop();
|
|
292
|
-
}
|
|
293
|
-
}, "pollForResponse");
|
|
294
|
-
(0, import_forget.forget)(pollForResponse());
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Runs the background divine process on a loop with a delay
|
|
299
|
-
* specified by the `config.pollFrequency`
|
|
300
|
-
*/
|
|
301
|
-
poll() {
|
|
302
|
-
this._pollId = (0, import_timer.setTimeoutEx)(async () => {
|
|
303
|
-
var _a, _b;
|
|
304
|
-
try {
|
|
305
|
-
await this.processIncomingResponses();
|
|
306
|
-
} catch (e) {
|
|
307
|
-
(_b = (_a = this.logger) == null ? void 0 : _a.error) == null ? void 0 : _b.call(_a, `Error in main loop: ${e}`);
|
|
308
|
-
} finally {
|
|
309
|
-
if (this._pollId) (0, import_timer.clearTimeoutEx)(this._pollId);
|
|
310
|
-
this._pollId = void 0;
|
|
311
|
-
this.poll();
|
|
312
|
-
}
|
|
313
|
-
}, this.pollFrequency);
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* Background process for processing incoming responses to previously issued queries
|
|
317
|
-
*/
|
|
318
|
-
processIncomingResponses = /* @__PURE__ */ __name(async () => {
|
|
319
|
-
const responseArchivist = await this.responsesArchivist();
|
|
320
|
-
if (responseArchivist) {
|
|
321
|
-
const responseBoundWitnessDiviner = await this.responsesDiviner();
|
|
322
|
-
if (responseBoundWitnessDiviner) {
|
|
323
|
-
const pendingCommands = [
|
|
324
|
-
...this.queryCache.entries()
|
|
325
|
-
].filter(([_, status]) => status === Pending);
|
|
326
|
-
await Promise.allSettled(pendingCommands.map(async ([sourceQuery, status]) => {
|
|
327
|
-
var _a, _b, _c;
|
|
328
|
-
if (status === Pending) {
|
|
329
|
-
const divinerQuery = {
|
|
330
|
-
limit: 1,
|
|
331
|
-
order: "desc",
|
|
332
|
-
schema: import_diviner_boundwitness_model.BoundWitnessDivinerQuerySchema,
|
|
333
|
-
sourceQuery
|
|
334
|
-
};
|
|
335
|
-
const result = await responseBoundWitnessDiviner.divine([
|
|
336
|
-
divinerQuery
|
|
337
|
-
]);
|
|
338
|
-
if (result && result.length > 0) {
|
|
339
|
-
const response = result.find(import_boundwitness_model.isBoundWitnessWithMeta);
|
|
340
|
-
if (response && ((_a = response == null ? void 0 : response.$meta) == null ? void 0 : _a.sourceQuery) === sourceQuery) {
|
|
341
|
-
(_b = this.logger) == null ? void 0 : _b.debug(`Found response to query: ${sourceQuery}`);
|
|
342
|
-
const payloads = ((_c = response.payload_hashes) == null ? void 0 : _c.length) > 0 ? await responseArchivist.get(response.payload_hashes) : [];
|
|
343
|
-
this.queryCache.set(sourceQuery, [
|
|
344
|
-
response,
|
|
345
|
-
payloads,
|
|
346
|
-
[]
|
|
347
|
-
]);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
}));
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}, "processIncomingResponses");
|
|
355
|
-
start() {
|
|
356
|
-
if (this._pollCount === 0) {
|
|
357
|
-
this.poll();
|
|
358
|
-
}
|
|
359
|
-
this._pollCount++;
|
|
360
|
-
}
|
|
361
|
-
stop() {
|
|
362
|
-
this._pollCount--;
|
|
363
|
-
if (this._pollCount <= 0) {
|
|
364
|
-
if (this._pollId) (0, import_timer.clearTimeoutEx)(this._pollId);
|
|
365
|
-
this._pollId = void 0;
|
|
366
|
-
this._pollCount = 0;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
};
|
|
370
|
-
__name(_AsyncQueryBusClient, "AsyncQueryBusClient");
|
|
371
|
-
var AsyncQueryBusClient = _AsyncQueryBusClient;
|
|
372
|
-
|
|
373
|
-
// src/AsyncQueryBus/AsyncQueryBusHost.ts
|
|
374
|
-
var import_array = require("@xylabs/array");
|
|
375
|
-
var import_assert3 = require("@xylabs/assert");
|
|
376
|
-
var import_timer2 = require("@xylabs/timer");
|
|
377
|
-
var import_boundwitness_model2 = require("@xyo-network/boundwitness-model");
|
|
378
|
-
var import_bridge_model = require("@xyo-network/bridge-model");
|
|
379
|
-
var import_diviner_boundwitness_model2 = require("@xyo-network/diviner-boundwitness-model");
|
|
380
|
-
var import_module_model2 = require("@xyo-network/module-model");
|
|
381
|
-
var import_payload_builder2 = require("@xyo-network/payload-builder");
|
|
382
|
-
var IDLE_POLLING_FREQUENCY_RATIO_MIN = 4;
|
|
383
|
-
var IDLE_POLLING_FREQUENCY_RATIO_MAX = 64;
|
|
384
|
-
var IDLE_POLLING_FREQUENCY_RATIO_DEFAULT = 16;
|
|
385
|
-
var IDLE_THRESHOLD_RATIO_MIN = 4;
|
|
386
|
-
var IDLE_THRESHOLD_RATIO_MAX = 64;
|
|
387
|
-
var IDLE_THRESHOLD_RATIO_DEFAULT = 16;
|
|
388
|
-
var _AsyncQueryBusHost = class _AsyncQueryBusHost extends AsyncQueryBusBase {
|
|
389
|
-
_exposedAddresses = /* @__PURE__ */ new Set();
|
|
390
|
-
_exposeOptions = {};
|
|
391
|
-
_idle = false;
|
|
392
|
-
_lastQueryTime;
|
|
393
|
-
_pollId;
|
|
394
|
-
constructor(params) {
|
|
395
|
-
super(params);
|
|
396
|
-
}
|
|
397
|
-
get exposedAddresses() {
|
|
398
|
-
return this._exposedAddresses;
|
|
399
|
-
}
|
|
400
|
-
get idlePollFrequency() {
|
|
401
|
-
var _a;
|
|
402
|
-
const frequency = ((_a = this.config) == null ? void 0 : _a.idlePollFrequency) ?? IDLE_POLLING_FREQUENCY_RATIO_DEFAULT * this.pollFrequency;
|
|
403
|
-
if (frequency < this.pollFrequency * IDLE_POLLING_FREQUENCY_RATIO_MIN) {
|
|
404
|
-
return IDLE_POLLING_FREQUENCY_RATIO_MIN * this.pollFrequency;
|
|
405
|
-
}
|
|
406
|
-
if (frequency > this.pollFrequency * IDLE_POLLING_FREQUENCY_RATIO_MAX) {
|
|
407
|
-
return IDLE_POLLING_FREQUENCY_RATIO_MAX * this.pollFrequency;
|
|
408
|
-
}
|
|
409
|
-
return frequency;
|
|
410
|
-
}
|
|
411
|
-
get idleThreshold() {
|
|
412
|
-
var _a;
|
|
413
|
-
const threshold = ((_a = this.config) == null ? void 0 : _a.idleThreshold) ?? IDLE_THRESHOLD_RATIO_DEFAULT * this.idlePollFrequency;
|
|
414
|
-
if (threshold < this.idlePollFrequency * IDLE_THRESHOLD_RATIO_MIN) {
|
|
415
|
-
return IDLE_POLLING_FREQUENCY_RATIO_MIN * this.pollFrequency;
|
|
416
|
-
}
|
|
417
|
-
if (threshold > this.idlePollFrequency * IDLE_THRESHOLD_RATIO_MAX) {
|
|
418
|
-
return IDLE_POLLING_FREQUENCY_RATIO_MAX * this.pollFrequency;
|
|
419
|
-
}
|
|
420
|
-
return threshold;
|
|
421
|
-
}
|
|
422
|
-
get perAddressBatchQueryLimit() {
|
|
423
|
-
var _a;
|
|
424
|
-
return ((_a = this.config) == null ? void 0 : _a.perAddressBatchQueryLimit) ?? 10;
|
|
425
|
-
}
|
|
426
|
-
get started() {
|
|
427
|
-
return !!this._pollId;
|
|
428
|
-
}
|
|
429
|
-
expose(mod, options) {
|
|
430
|
-
var _a, _b;
|
|
431
|
-
const { failOnAlreadyExposed } = options ?? {};
|
|
432
|
-
if ((0, import_bridge_model.isBridgeInstance)(mod)) {
|
|
433
|
-
(_a = this.logger) == null ? void 0 : _a.warn(`Attempted to expose a BridgeModule [${mod.id}] - Not exposing`);
|
|
434
|
-
} else {
|
|
435
|
-
(0, import_assert3.assertEx)(!failOnAlreadyExposed || !this._exposedAddresses.has(mod.address), () => `Address already exposed: ${mod.id} [${mod.address}]`);
|
|
436
|
-
this._exposedAddresses.add(mod.address);
|
|
437
|
-
this._exposeOptions[mod.address] = {
|
|
438
|
-
...options
|
|
439
|
-
};
|
|
440
|
-
(_b = this.logger) == null ? void 0 : _b.debug(`${mod.id} exposed [${mod.address}]`);
|
|
441
|
-
return mod;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
async listeningModules() {
|
|
445
|
-
var _a;
|
|
446
|
-
const exposedModules = [
|
|
447
|
-
...((_a = this.config) == null ? void 0 : _a.listeningModules) ?? [],
|
|
448
|
-
...this.exposedAddresses.values()
|
|
449
|
-
];
|
|
450
|
-
return await Promise.all(exposedModules.map(async (exposedModule) => (0, import_assert3.assertEx)((0, import_module_model2.asModuleInstance)(await (0, import_module_model2.resolveAddressToInstance)(this.rootModule, exposedModule)), () => `Unable to resolve listeningModule [${exposedModule}]`)));
|
|
451
|
-
}
|
|
452
|
-
start() {
|
|
453
|
-
if (this.started) {
|
|
454
|
-
console.warn("AsyncQueryBus starting when already started");
|
|
455
|
-
}
|
|
456
|
-
this.poll();
|
|
457
|
-
}
|
|
458
|
-
stop() {
|
|
459
|
-
if (!this.started) {
|
|
460
|
-
console.warn("AsyncQueryBus stopping when already stopped");
|
|
461
|
-
}
|
|
462
|
-
if (this._pollId) (0, import_timer2.clearTimeoutEx)(this._pollId);
|
|
463
|
-
this._pollId = void 0;
|
|
464
|
-
}
|
|
465
|
-
async unexpose(id, validate = true) {
|
|
466
|
-
var _a;
|
|
467
|
-
const mod = (0, import_module_model2.asModuleInstance)(await this.rootModule.resolve(id, {
|
|
468
|
-
maxDepth: 10
|
|
469
|
-
}));
|
|
470
|
-
if (mod) {
|
|
471
|
-
(0, import_assert3.assertEx)(!validate || this._exposedAddresses.has(mod.address), () => `Address not exposed [${mod.address}][${mod.id}]`);
|
|
472
|
-
this._exposedAddresses.delete(mod.address);
|
|
473
|
-
delete this._exposeOptions[mod.address];
|
|
474
|
-
(_a = this.logger) == null ? void 0 : _a.debug(`${mod.address} [${mod.id}] unexposed`);
|
|
475
|
-
}
|
|
476
|
-
return mod;
|
|
477
|
-
}
|
|
478
|
-
// eslint-disable-next-line complexity
|
|
479
|
-
callLocalModule = /* @__PURE__ */ __name(async (localModule, query) => {
|
|
480
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
481
|
-
this._idle = false;
|
|
482
|
-
this._lastQueryTime = Date.now();
|
|
483
|
-
const localModuleName = localModule.id;
|
|
484
|
-
const queryArchivist = (0, import_assert3.assertEx)(await this.queriesArchivist(), () => {
|
|
485
|
-
var _a2, _b2, _c2;
|
|
486
|
-
return `Unable to contact queriesArchivist [${(_c2 = (_b2 = (_a2 = this.config) == null ? void 0 : _a2.intersect) == null ? void 0 : _b2.queries) == null ? void 0 : _c2.archivist}]`;
|
|
487
|
-
});
|
|
488
|
-
const responsesArchivist = (0, import_assert3.assertEx)(await this.responsesArchivist(), () => {
|
|
489
|
-
var _a2, _b2, _c2;
|
|
490
|
-
return `Unable to contact responsesArchivist [${(_c2 = (_b2 = (_a2 = this.config) == null ? void 0 : _a2.intersect) == null ? void 0 : _b2.queries) == null ? void 0 : _c2.archivist}]`;
|
|
491
|
-
});
|
|
492
|
-
const queryDestination = (_a = query.$meta) == null ? void 0 : _a.destination;
|
|
493
|
-
if (queryDestination && (queryDestination == null ? void 0 : queryDestination.includes(localModule.address))) {
|
|
494
|
-
const queryIndex = query.payload_hashes.indexOf(query.query);
|
|
495
|
-
if (queryIndex !== -1) {
|
|
496
|
-
const querySchema = query.payload_schemas[queryIndex];
|
|
497
|
-
if (localModule.queries.includes(querySchema)) {
|
|
498
|
-
const queryPayloads = await queryArchivist.get(query.payload_hashes);
|
|
499
|
-
(_c = (_b = this.params).onQueryFulfillStarted) == null ? void 0 : _c.call(_b, {
|
|
500
|
-
payloads: queryPayloads,
|
|
501
|
-
query
|
|
502
|
-
});
|
|
503
|
-
const queryPayloadsDict = await import_payload_builder2.PayloadBuilder.toAllHashMap(queryPayloads);
|
|
504
|
-
const queryHash = (await import_payload_builder2.PayloadBuilder.build(query)).$hash;
|
|
505
|
-
if (!(0, import_array.containsAll)(Object.keys(queryPayloadsDict), query.payload_hashes)) {
|
|
506
|
-
(_d = this.logger) == null ? void 0 : _d.error(`Error processing command ${queryHash} for module ${localModuleName}, missing payloads`);
|
|
507
|
-
return;
|
|
508
|
-
}
|
|
509
|
-
try {
|
|
510
|
-
const querySchema2 = queryPayloadsDict[query.query].schema;
|
|
511
|
-
(_e = this.logger) == null ? void 0 : _e.debug(`Issuing query ${querySchema2} (${queryHash}) addressed to module: ${localModuleName}`);
|
|
512
|
-
const result = await localModule.query(query, queryPayloads, {
|
|
513
|
-
allowedQueries: (_f = this._exposeOptions[localModule.address]) == null ? void 0 : _f.allowedQueries,
|
|
514
|
-
schema: import_module_model2.ModuleConfigSchema
|
|
515
|
-
});
|
|
516
|
-
const [bw, payloads, errors] = result;
|
|
517
|
-
(_g = this.logger) == null ? void 0 : _g.debug(`Replying to query ${queryHash} addressed to module: ${localModuleName}`);
|
|
518
|
-
const insertResult = await responsesArchivist.insert([
|
|
519
|
-
bw,
|
|
520
|
-
...payloads,
|
|
521
|
-
...errors
|
|
522
|
-
]);
|
|
523
|
-
if (insertResult.length === 0) {
|
|
524
|
-
(_h = this.logger) == null ? void 0 : _h.error(`Error replying to query ${queryHash} addressed to module: ${localModuleName}`);
|
|
525
|
-
}
|
|
526
|
-
if (query == null ? void 0 : query.timestamp) {
|
|
527
|
-
await this.commitState(localModule.address, query.timestamp);
|
|
528
|
-
}
|
|
529
|
-
(_j = (_i = this.params).onQueryFulfillFinished) == null ? void 0 : _j.call(_i, {
|
|
530
|
-
payloads: queryPayloads,
|
|
531
|
-
query,
|
|
532
|
-
result,
|
|
533
|
-
status: "success"
|
|
534
|
-
});
|
|
535
|
-
} catch (error) {
|
|
536
|
-
(_l = (_k = this.params).onQueryFulfillFinished) == null ? void 0 : _l.call(_k, {
|
|
537
|
-
payloads: queryPayloads,
|
|
538
|
-
query,
|
|
539
|
-
status: "failure"
|
|
540
|
-
});
|
|
541
|
-
(_m = this.logger) == null ? void 0 : _m.error(`Error processing query ${queryHash} for module ${localModuleName}: ${error}`);
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
}, "callLocalModule");
|
|
547
|
-
/**
|
|
548
|
-
* Finds unprocessed commands addressed to the supplied address
|
|
549
|
-
* @param address The address to find commands for
|
|
550
|
-
*/
|
|
551
|
-
findQueriesToAddress = /* @__PURE__ */ __name(async (address) => {
|
|
552
|
-
var _a, _b, _c, _d, _e;
|
|
553
|
-
const queriesDivinerId = (0, import_assert3.assertEx)((_c = (_b = (_a = this.config) == null ? void 0 : _a.intersect) == null ? void 0 : _b.queries) == null ? void 0 : _c.boundWitnessDiviner, () => "No queries Diviner defined");
|
|
554
|
-
const queriesBoundWitnessDiviner = await this.queriesDiviner();
|
|
555
|
-
if (queriesBoundWitnessDiviner) {
|
|
556
|
-
const prevState = await this.retrieveState(address);
|
|
557
|
-
const destination = [
|
|
558
|
-
address
|
|
559
|
-
];
|
|
560
|
-
const limit = this.perAddressBatchQueryLimit;
|
|
561
|
-
const divinerQuery = {
|
|
562
|
-
destination,
|
|
563
|
-
limit,
|
|
564
|
-
order: "asc",
|
|
565
|
-
schema: import_diviner_boundwitness_model2.BoundWitnessDivinerQuerySchema,
|
|
566
|
-
timestamp: prevState + 1
|
|
567
|
-
};
|
|
568
|
-
const result = await queriesBoundWitnessDiviner.divine([
|
|
569
|
-
divinerQuery
|
|
570
|
-
]);
|
|
571
|
-
const queries = result.filter(import_boundwitness_model2.isQueryBoundWitnessWithMeta);
|
|
572
|
-
const nextState = queries.length > 0 ? Math.max(...queries.map((c) => c.timestamp ?? prevState)) + 1 : Date.now();
|
|
573
|
-
await this.commitState(address, nextState);
|
|
574
|
-
(_d = this.logger) == null ? void 0 : _d.debug("findQueriesToAddress", address, prevState, nextState);
|
|
575
|
-
return queries;
|
|
576
|
-
} else {
|
|
577
|
-
(_e = this.logger) == null ? void 0 : _e.warn(`Unable to resolve queriesBoundWitnessDiviner [${queriesDivinerId}] [${await import_module_model2.ResolveHelper.traceModuleIdentifier(this.rootModule, queriesDivinerId)}]`);
|
|
578
|
-
}
|
|
579
|
-
}, "findQueriesToAddress");
|
|
580
|
-
/**
|
|
581
|
-
* Runs the background divine process on a loop with a delay
|
|
582
|
-
* specified by the `config.pollFrequency`
|
|
583
|
-
*/
|
|
584
|
-
poll() {
|
|
585
|
-
this._pollId = (0, import_timer2.setTimeoutEx)(async () => {
|
|
586
|
-
var _a, _b;
|
|
587
|
-
try {
|
|
588
|
-
await this.processIncomingQueries();
|
|
589
|
-
} catch (e) {
|
|
590
|
-
(_b = (_a = this.logger) == null ? void 0 : _a.error) == null ? void 0 : _b.call(_a, `Error in main loop: ${e}`);
|
|
591
|
-
} finally {
|
|
592
|
-
if (this._pollId) (0, import_timer2.clearTimeoutEx)(this._pollId);
|
|
593
|
-
this._pollId = void 0;
|
|
594
|
-
this.poll();
|
|
595
|
-
}
|
|
596
|
-
const now = Date.now();
|
|
597
|
-
if (this.idleThreshold < now - (this._lastQueryTime ?? now)) {
|
|
598
|
-
this._idle = true;
|
|
599
|
-
}
|
|
600
|
-
}, this._idle ? this.idlePollFrequency : this.pollFrequency);
|
|
601
|
-
}
|
|
602
|
-
/**
|
|
603
|
-
* Background process for checking for inbound queries
|
|
604
|
-
*/
|
|
605
|
-
processIncomingQueries = /* @__PURE__ */ __name(async () => {
|
|
606
|
-
var _a;
|
|
607
|
-
(_a = this.logger) == null ? void 0 : _a.debug("Checking for inbound queries");
|
|
608
|
-
const localModules = await this.listeningModules();
|
|
609
|
-
await Promise.allSettled(localModules.map(async (localModule) => {
|
|
610
|
-
var _a2, _b, _c;
|
|
611
|
-
try {
|
|
612
|
-
const localModuleName = localModule.id;
|
|
613
|
-
(_a2 = this.logger) == null ? void 0 : _a2.debug(`Checking for inbound queries to ${localModuleName} [${localModule.address}]`);
|
|
614
|
-
const queries = await this.findQueriesToAddress(localModule.address) ?? [];
|
|
615
|
-
if (queries.length === 0) return;
|
|
616
|
-
(_b = this.logger) == null ? void 0 : _b.debug(`Found queries addressed to local module: ${localModuleName}`);
|
|
617
|
-
for (const query of queries) {
|
|
618
|
-
await this.callLocalModule(localModule, query);
|
|
619
|
-
}
|
|
620
|
-
} catch (error) {
|
|
621
|
-
(_c = this.logger) == null ? void 0 : _c.error(`Error processing queries for address ${localModule.address}: ${error}`);
|
|
622
|
-
}
|
|
623
|
-
}));
|
|
624
|
-
}, "processIncomingQueries");
|
|
625
|
-
};
|
|
626
|
-
__name(_AsyncQueryBusHost, "AsyncQueryBusHost");
|
|
627
|
-
var AsyncQueryBusHost = _AsyncQueryBusHost;
|
|
628
|
-
|
|
629
|
-
// src/AsyncQueryBus/ModuleHost/ModuleHost.ts
|
|
630
|
-
var _AsyncQueryBusModuleHost = class _AsyncQueryBusModuleHost extends AbstractModuleHost {
|
|
631
|
-
_busHost;
|
|
632
|
-
constructor(params) {
|
|
633
|
-
super(params);
|
|
634
|
-
}
|
|
635
|
-
async start() {
|
|
636
|
-
var _a;
|
|
637
|
-
const listeningModules = this.params.config.listeningModules ?? (await this.params.mod.resolve("*", {
|
|
638
|
-
direction: "down"
|
|
639
|
-
})).map((m) => m.address);
|
|
640
|
-
this._busHost = new AsyncQueryBusHost({
|
|
641
|
-
config: {
|
|
642
|
-
...this.params.config,
|
|
643
|
-
listeningModules
|
|
644
|
-
},
|
|
645
|
-
logger: this.params.logger,
|
|
646
|
-
rootModule: this.params.mod
|
|
647
|
-
});
|
|
648
|
-
(_a = this._busHost) == null ? void 0 : _a.start();
|
|
649
|
-
}
|
|
650
|
-
stop() {
|
|
651
|
-
var _a;
|
|
652
|
-
(_a = this._busHost) == null ? void 0 : _a.stop();
|
|
653
|
-
}
|
|
654
|
-
};
|
|
655
|
-
__name(_AsyncQueryBusModuleHost, "AsyncQueryBusModuleHost");
|
|
656
|
-
var AsyncQueryBusModuleHost = _AsyncQueryBusModuleHost;
|
|
657
|
-
|
|
658
|
-
// src/AsyncQueryBus/ModuleProxy/ModuleProxy.ts
|
|
659
|
-
var import_assert4 = require("@xylabs/assert");
|
|
660
|
-
var import_exists = require("@xylabs/exists");
|
|
661
|
-
var import_forget2 = require("@xylabs/forget");
|
|
662
|
-
var import_hex = require("@xylabs/hex");
|
|
663
|
-
var import_bridge_abstract = require("@xyo-network/bridge-abstract");
|
|
664
|
-
var import_module_model3 = require("@xyo-network/module-model");
|
|
665
|
-
var _AsyncQueryBusModuleProxy = class _AsyncQueryBusModuleProxy extends import_bridge_abstract.AbstractModuleProxy {
|
|
666
|
-
constructor(params) {
|
|
667
|
-
_AsyncQueryBusModuleProxy.createCount = _AsyncQueryBusModuleProxy.createCount + 1;
|
|
668
|
-
if (Math.floor(_AsyncQueryBusModuleProxy.createCount / 10) === _AsyncQueryBusModuleProxy.createCount / 10) {
|
|
669
|
-
console.log(`AsyncQueryBusModuleProxy.createCount: ${_AsyncQueryBusModuleProxy.createCount}`);
|
|
670
|
-
}
|
|
671
|
-
super(params);
|
|
672
|
-
}
|
|
673
|
-
get id() {
|
|
674
|
-
return this.address;
|
|
675
|
-
}
|
|
676
|
-
get modName() {
|
|
677
|
-
return void 0;
|
|
678
|
-
}
|
|
679
|
-
async proxyQueryHandler(query, payloads) {
|
|
680
|
-
if (this.archiving && this.isAllowedArchivingQuery(query.schema)) {
|
|
681
|
-
(0, import_forget2.forget)(this.storeToArchivists([
|
|
682
|
-
query,
|
|
683
|
-
...payloads ?? []
|
|
684
|
-
]));
|
|
685
|
-
}
|
|
686
|
-
const result = await this.params.busClient.send(this.address, query, payloads);
|
|
687
|
-
if (this.archiving && this.isAllowedArchivingQuery(query.schema)) {
|
|
688
|
-
(0, import_forget2.forget)(this.storeToArchivists(result.flat()));
|
|
689
|
-
}
|
|
690
|
-
return result;
|
|
691
|
-
}
|
|
692
|
-
async publicChildren() {
|
|
693
|
-
return (await Promise.all(Object.keys(await this.childAddressMap()).filter(import_exists.exists).map((address) => this.resolve(address)))).filter(import_exists.exists);
|
|
694
|
-
}
|
|
695
|
-
async resolve(idOrFilter = "*", options = {}) {
|
|
696
|
-
const config = {
|
|
697
|
-
address: this.address,
|
|
698
|
-
dead: this.dead,
|
|
699
|
-
downResolver: this.downResolver,
|
|
700
|
-
logger: this.logger,
|
|
701
|
-
mod: this,
|
|
702
|
-
transformers: this.moduleIdentifierTransformers,
|
|
703
|
-
upResolver: this.upResolver
|
|
704
|
-
};
|
|
705
|
-
if (idOrFilter === "*") {
|
|
706
|
-
return await this.publicChildren();
|
|
707
|
-
}
|
|
708
|
-
switch (typeof idOrFilter) {
|
|
709
|
-
case "string": {
|
|
710
|
-
const parts = idOrFilter.split(":");
|
|
711
|
-
const first = (0, import_assert4.assertEx)(parts.shift(), () => "Missing first");
|
|
712
|
-
const remainingPath = parts.join(":");
|
|
713
|
-
const address = (0, import_hex.isAddress)(first) ? first : this.childAddressByName(first);
|
|
714
|
-
if (!address) return void 0;
|
|
715
|
-
const firstInstance = await this.params.host.resolve(address);
|
|
716
|
-
return remainingPath ? await (firstInstance == null ? void 0 : firstInstance.resolve(remainingPath)) : firstInstance;
|
|
717
|
-
}
|
|
718
|
-
case "object": {
|
|
719
|
-
return (await import_module_model3.ResolveHelper.resolve(config, idOrFilter, options)).filter((mod) => mod.address !== this.address);
|
|
720
|
-
}
|
|
721
|
-
default: {
|
|
722
|
-
return (await import_module_model3.ResolveHelper.resolve(config, idOrFilter, options)).filter((mod) => mod.address !== this.address);
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
async startHandler() {
|
|
727
|
-
return await super.startHandler();
|
|
728
|
-
}
|
|
729
|
-
};
|
|
730
|
-
__name(_AsyncQueryBusModuleProxy, "AsyncQueryBusModuleProxy");
|
|
731
|
-
__publicField(_AsyncQueryBusModuleProxy, "createCount", 0);
|
|
732
|
-
var AsyncQueryBusModuleProxy = _AsyncQueryBusModuleProxy;
|
|
733
|
-
|
|
734
|
-
// src/Schema.ts
|
|
735
|
-
var PubSubBridgeSchema = "network.xyo.bridge.pubsub";
|
|
736
|
-
|
|
737
|
-
// src/Config.ts
|
|
738
|
-
var PubSubBridgeConfigSchema = `${PubSubBridgeSchema}.config`;
|
|
739
|
-
|
|
740
|
-
// src/PubSubBridge.ts
|
|
741
|
-
var import_assert6 = require("@xylabs/assert");
|
|
742
|
-
var import_exists2 = require("@xylabs/exists");
|
|
743
|
-
var import_forget3 = require("@xylabs/forget");
|
|
744
|
-
var import_hex3 = require("@xylabs/hex");
|
|
745
|
-
var import_object3 = require("@xylabs/object");
|
|
746
|
-
var import_bridge_abstract3 = require("@xyo-network/bridge-abstract");
|
|
747
|
-
var import_module_model5 = require("@xyo-network/module-model");
|
|
748
|
-
var import_node_model = require("@xyo-network/node-model");
|
|
749
|
-
var import_payload_model = require("@xyo-network/payload-model");
|
|
750
|
-
var import_async_mutex3 = require("async-mutex");
|
|
751
|
-
|
|
752
|
-
// src/PubSubBridgeModuleResolver.ts
|
|
753
|
-
var import_assert5 = require("@xylabs/assert");
|
|
754
|
-
var import_hex2 = require("@xylabs/hex");
|
|
755
|
-
var import_account = require("@xyo-network/account");
|
|
756
|
-
var import_bridge_abstract2 = require("@xyo-network/bridge-abstract");
|
|
757
|
-
var import_config_payload_plugin = require("@xyo-network/config-payload-plugin");
|
|
758
|
-
var import_module_model4 = require("@xyo-network/module-model");
|
|
759
|
-
var import_async_mutex2 = require("async-mutex");
|
|
760
|
-
var import_lru_cache3 = require("lru-cache");
|
|
761
|
-
var _PubSubBridgeModuleResolver = class _PubSubBridgeModuleResolver extends import_bridge_abstract2.AbstractBridgeModuleResolver {
|
|
762
|
-
_resolvedCache = new import_lru_cache3.LRUCache({
|
|
763
|
-
max: 1e3
|
|
764
|
-
});
|
|
765
|
-
_resolvedCacheMutex = new import_async_mutex2.Mutex();
|
|
766
|
-
async resolveHandler(id, options) {
|
|
767
|
-
const parentResult = await super.resolveHandler(id, options);
|
|
768
|
-
if (parentResult.length > 0) {
|
|
769
|
-
return parentResult;
|
|
770
|
-
}
|
|
771
|
-
const idParts = id.split(":");
|
|
772
|
-
const untransformedFirstPart = (0, import_assert5.assertEx)(idParts.shift(), () => "Missing module identifier");
|
|
773
|
-
const firstPart = await import_module_model4.ResolveHelper.transformModuleIdentifier(untransformedFirstPart);
|
|
774
|
-
(0, import_assert5.assertEx)((0, import_hex2.isAddress)(firstPart), () => `Invalid module address: ${firstPart}`);
|
|
775
|
-
const remainderParts = idParts.join(":");
|
|
776
|
-
const instance = await this._resolvedCacheMutex.runExclusive(async () => {
|
|
777
|
-
var _a, _b;
|
|
778
|
-
const cachedMod = this._resolvedCache.get(firstPart);
|
|
779
|
-
if (cachedMod) {
|
|
780
|
-
const result2 = idParts.length <= 0 ? cachedMod : cachedMod.resolve(remainderParts, {
|
|
781
|
-
...options,
|
|
782
|
-
maxDepth: ((options == null ? void 0 : options.maxDepth) ?? 5) - 1
|
|
783
|
-
});
|
|
784
|
-
return result2;
|
|
785
|
-
}
|
|
786
|
-
const account = await import_account.Account.random();
|
|
787
|
-
const finalParams = {
|
|
788
|
-
account,
|
|
789
|
-
archiving: this.params.archiving,
|
|
790
|
-
busClient: this.params.busClient,
|
|
791
|
-
config: {
|
|
792
|
-
schema: import_module_model4.ModuleConfigSchema
|
|
793
|
-
},
|
|
794
|
-
host: this,
|
|
795
|
-
moduleAddress: firstPart,
|
|
796
|
-
onQuerySendFinished: this.params.onQuerySendFinished,
|
|
797
|
-
onQuerySendStarted: this.params.onQuerySendStarted
|
|
798
|
-
};
|
|
799
|
-
const proxy = new AsyncQueryBusModuleProxy(finalParams);
|
|
800
|
-
const state = await proxy.state();
|
|
801
|
-
if (state) {
|
|
802
|
-
const configSchema = (_a = state.find((payload) => payload.schema === import_config_payload_plugin.ConfigSchema)) == null ? void 0 : _a.config;
|
|
803
|
-
const config = (0, import_assert5.assertEx)(state.find((payload) => payload.schema === configSchema), () => "Unable to locate config");
|
|
804
|
-
proxy.setConfig(config);
|
|
805
|
-
}
|
|
806
|
-
await ((_b = proxy.start) == null ? void 0 : _b.call(proxy));
|
|
807
|
-
const wrapped = (0, import_bridge_abstract2.wrapModuleWithType)(proxy, account);
|
|
808
|
-
(0, import_assert5.assertEx)((0, import_module_model4.asModuleInstance)(wrapped, {}), () => `Failed to asModuleInstance [${id}]`);
|
|
809
|
-
this._resolvedCache.set(wrapped.address, wrapped);
|
|
810
|
-
return wrapped;
|
|
811
|
-
});
|
|
812
|
-
const result = remainderParts.length > 0 ? await instance.resolve(remainderParts, options) : instance;
|
|
813
|
-
return result ? [
|
|
814
|
-
result
|
|
815
|
-
] : [];
|
|
816
|
-
}
|
|
817
|
-
};
|
|
818
|
-
__name(_PubSubBridgeModuleResolver, "PubSubBridgeModuleResolver");
|
|
819
|
-
var PubSubBridgeModuleResolver = _PubSubBridgeModuleResolver;
|
|
820
|
-
|
|
821
|
-
// src/PubSubBridge.ts
|
|
822
|
-
function _ts_decorate(decorators, target, key, desc) {
|
|
823
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
824
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
825
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
826
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
827
|
-
}
|
|
828
|
-
__name(_ts_decorate, "_ts_decorate");
|
|
829
|
-
var moduleName = "PubSubBridge";
|
|
830
|
-
var _PubSubBridge = class _PubSubBridge extends import_bridge_abstract3.AbstractBridge {
|
|
831
|
-
_configRootAddress = "";
|
|
832
|
-
_configStateStoreArchivist = "";
|
|
833
|
-
_configStateStoreBoundWitnessDiviner = "";
|
|
834
|
-
_exposedAddresses = [];
|
|
835
|
-
_lastState;
|
|
836
|
-
_busClient;
|
|
837
|
-
_busHost;
|
|
838
|
-
_discoverRootsMutex = new import_async_mutex3.Mutex();
|
|
839
|
-
_resolver;
|
|
840
|
-
get resolver() {
|
|
841
|
-
this._resolver = this._resolver ?? new PubSubBridgeModuleResolver({
|
|
842
|
-
additionalSigners: this.additionalSigners,
|
|
843
|
-
archiving: {
|
|
844
|
-
...this.archiving,
|
|
845
|
-
resolveArchivists: this.resolveArchivingArchivists.bind(this)
|
|
846
|
-
},
|
|
847
|
-
bridge: this,
|
|
848
|
-
busClient: (0, import_assert6.assertEx)(this.busClient(), () => "busClient not configured"),
|
|
849
|
-
onQuerySendFinished: /* @__PURE__ */ __name((args) => {
|
|
850
|
-
(0, import_forget3.forget)(this.emit("querySendFinished", {
|
|
851
|
-
mod: this,
|
|
852
|
-
...args
|
|
853
|
-
}));
|
|
854
|
-
}, "onQuerySendFinished"),
|
|
855
|
-
onQuerySendStarted: /* @__PURE__ */ __name((args) => {
|
|
856
|
-
(0, import_forget3.forget)(this.emit("querySendStarted", {
|
|
857
|
-
mod: this,
|
|
858
|
-
...args
|
|
859
|
-
}));
|
|
860
|
-
}, "onQuerySendStarted"),
|
|
861
|
-
root: this,
|
|
862
|
-
wrapperAccount: this.account
|
|
863
|
-
});
|
|
864
|
-
return this._resolver;
|
|
865
|
-
}
|
|
866
|
-
get moduleName() {
|
|
867
|
-
return this.modName ?? moduleName;
|
|
868
|
-
}
|
|
869
|
-
async connect(id, maxDepth = 5) {
|
|
870
|
-
const transformedId = (0, import_assert6.assertEx)(await import_module_model5.ResolveHelper.transformModuleIdentifier(id), () => `Unable to transform module identifier: ${id}`);
|
|
871
|
-
const existingInstance = await this.resolve(transformedId);
|
|
872
|
-
if (existingInstance) {
|
|
873
|
-
return existingInstance.address;
|
|
874
|
-
}
|
|
875
|
-
const [instance] = await this.resolver.resolveHandler(id);
|
|
876
|
-
return await this.connectInstance(instance, maxDepth);
|
|
877
|
-
}
|
|
878
|
-
async disconnect(id) {
|
|
879
|
-
const transformedId = (0, import_assert6.assertEx)(await import_module_model5.ResolveHelper.transformModuleIdentifier(id), () => `Unable to transform module identifier: ${id}`);
|
|
880
|
-
const instance = await this.resolve(transformedId);
|
|
881
|
-
if (instance) {
|
|
882
|
-
this.downResolver.remove(instance.address);
|
|
883
|
-
return instance.address;
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
async exposeChild(mod, options) {
|
|
887
|
-
var _a, _b;
|
|
888
|
-
const { maxDepth = 5 } = options ?? {};
|
|
889
|
-
console.log(`exposeChild: ${mod.address} ${mod == null ? void 0 : mod.id} ${maxDepth}`);
|
|
890
|
-
const host = (0, import_assert6.assertEx)(this.busHost(), () => "Not configured as a host");
|
|
891
|
-
host.expose(mod);
|
|
892
|
-
const children = maxDepth > 0 ? await ((_a = mod.publicChildren) == null ? void 0 : _a.call(mod)) ?? [] : [];
|
|
893
|
-
this.logger.log(`childrenToExpose [${mod.id}][${mod.address}]: ${(0, import_object3.toJsonString)(children.map((child) => child.id))}`);
|
|
894
|
-
const exposedChildren = (await Promise.all(children.map((child) => this.exposeChild(child, {
|
|
895
|
-
maxDepth: maxDepth - 1,
|
|
896
|
-
required: false
|
|
897
|
-
})))).flat().filter(import_exists2.exists);
|
|
898
|
-
const allExposed = [
|
|
899
|
-
mod,
|
|
900
|
-
...exposedChildren
|
|
901
|
-
];
|
|
902
|
-
for (const exposedMod of allExposed) (_b = this.logger) == null ? void 0 : _b.log(`exposed: ${exposedMod.address} [${mod.id}]`);
|
|
903
|
-
return allExposed;
|
|
904
|
-
}
|
|
905
|
-
async exposeHandler(address, options) {
|
|
906
|
-
const { required = true } = options ?? {};
|
|
907
|
-
const mod = await (0, import_module_model5.resolveAddressToInstanceUp)(this, address);
|
|
908
|
-
console.log(`exposeHandler: ${address} ${mod == null ? void 0 : mod.id}`);
|
|
909
|
-
if (required && !mod) {
|
|
910
|
-
throw new Error(`Unable to find required module: ${address}`);
|
|
911
|
-
}
|
|
912
|
-
if (mod) {
|
|
913
|
-
return this.exposeChild(mod, options);
|
|
914
|
-
}
|
|
915
|
-
return [];
|
|
916
|
-
}
|
|
917
|
-
exposedHandler() {
|
|
918
|
-
var _a;
|
|
919
|
-
const exposedSet = (_a = this.busHost()) == null ? void 0 : _a.exposedAddresses;
|
|
920
|
-
return exposedSet ? [
|
|
921
|
-
...exposedSet
|
|
922
|
-
] : [];
|
|
923
|
-
}
|
|
924
|
-
async getRoots(force) {
|
|
925
|
-
return await this._discoverRootsMutex.runExclusive(async () => {
|
|
926
|
-
if (this._roots === void 0 || force) {
|
|
927
|
-
const rootAddresses = (await Promise.all((this.config.roots ?? []).map((id) => {
|
|
928
|
-
var _a;
|
|
929
|
-
try {
|
|
930
|
-
return import_module_model5.ResolveHelper.transformModuleIdentifier(id);
|
|
931
|
-
} catch (ex) {
|
|
932
|
-
(_a = this.logger) == null ? void 0 : _a.warn("Unable to transform module identifier:", id, ex);
|
|
933
|
-
return;
|
|
934
|
-
}
|
|
935
|
-
}))).filter(import_exists2.exists);
|
|
936
|
-
const rootInstances = (await Promise.all(rootAddresses.map(async (root) => {
|
|
937
|
-
var _a;
|
|
938
|
-
try {
|
|
939
|
-
return await this.resolver.resolveHandler(root);
|
|
940
|
-
} catch (ex) {
|
|
941
|
-
(_a = this.logger) == null ? void 0 : _a.warn("Unable to resolve root:", root, ex);
|
|
942
|
-
return;
|
|
943
|
-
}
|
|
944
|
-
}))).flat().filter(import_exists2.exists);
|
|
945
|
-
for (const instance of rootInstances) {
|
|
946
|
-
this.downResolver.add(instance);
|
|
947
|
-
}
|
|
948
|
-
this._roots = rootInstances;
|
|
949
|
-
}
|
|
950
|
-
return this._roots;
|
|
951
|
-
});
|
|
952
|
-
}
|
|
953
|
-
async resolve(idOrFilter = "*", options = {}) {
|
|
954
|
-
var _a;
|
|
955
|
-
const roots = this._roots ?? [];
|
|
956
|
-
const workingSet = options.direction === "up" ? [
|
|
957
|
-
this
|
|
958
|
-
] : [
|
|
959
|
-
...roots,
|
|
960
|
-
this
|
|
961
|
-
];
|
|
962
|
-
if (idOrFilter === "*") {
|
|
963
|
-
const remainingDepth = (options.maxDepth ?? 1) - 1;
|
|
964
|
-
return remainingDepth <= 0 ? workingSet : [
|
|
965
|
-
...workingSet,
|
|
966
|
-
...(await Promise.all(roots.map((mod) => mod.resolve("*", {
|
|
967
|
-
...options,
|
|
968
|
-
maxDepth: remainingDepth
|
|
969
|
-
})))).flat()
|
|
970
|
-
];
|
|
971
|
-
}
|
|
972
|
-
switch (typeof idOrFilter) {
|
|
973
|
-
case "string": {
|
|
974
|
-
const parts = idOrFilter.split(":");
|
|
975
|
-
const first = (0, import_assert6.assertEx)(parts.shift(), () => "Missing first part");
|
|
976
|
-
const firstInstance = (0, import_hex3.isAddress)(first) ? await (0, import_module_model5.resolveAddressToInstance)(this, first, void 0, [], options.direction) : (_a = this._roots) == null ? void 0 : _a.find((mod) => mod.id === first);
|
|
977
|
-
return parts.length === 0 ? firstInstance : firstInstance == null ? void 0 : firstInstance.resolve(parts.join(":"), options);
|
|
978
|
-
}
|
|
979
|
-
case "object": {
|
|
980
|
-
const results = [];
|
|
981
|
-
if ((0, import_module_model5.isAddressModuleFilter)(idOrFilter)) {
|
|
982
|
-
for (const mod of workingSet) {
|
|
983
|
-
if (mod.modName && idOrFilter.address.includes(mod.address)) results.push(mod);
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
return results;
|
|
987
|
-
}
|
|
988
|
-
default: {
|
|
989
|
-
return;
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
async startHandler() {
|
|
994
|
-
var _a;
|
|
995
|
-
(_a = this.busHost()) == null ? void 0 : _a.start();
|
|
996
|
-
return await super.startHandler();
|
|
997
|
-
}
|
|
998
|
-
async unexposeHandler(id, options) {
|
|
999
|
-
var _a;
|
|
1000
|
-
const { maxDepth = 2, required = true } = options ?? {};
|
|
1001
|
-
const host = (0, import_assert6.assertEx)(this.busHost(), () => "Not configured as a host");
|
|
1002
|
-
const mod = await host.unexpose(id, required);
|
|
1003
|
-
if (mod) {
|
|
1004
|
-
const children = maxDepth > 0 ? await ((_a = mod.publicChildren) == null ? void 0 : _a.call(mod)) ?? [] : [];
|
|
1005
|
-
const exposedChildren = (await Promise.all(children.map((child) => this.unexposeHandler(child.address, {
|
|
1006
|
-
maxDepth: maxDepth - 1,
|
|
1007
|
-
required: false
|
|
1008
|
-
})))).flat().filter(import_exists2.exists);
|
|
1009
|
-
return [
|
|
1010
|
-
mod,
|
|
1011
|
-
...exposedChildren
|
|
1012
|
-
];
|
|
1013
|
-
}
|
|
1014
|
-
return [];
|
|
1015
|
-
}
|
|
1016
|
-
busClient() {
|
|
1017
|
-
if (!this._busClient && this.config.client) {
|
|
1018
|
-
this._busClient = new AsyncQueryBusClient({
|
|
1019
|
-
config: this.config.client,
|
|
1020
|
-
logger: this.logger,
|
|
1021
|
-
rootModule: this
|
|
1022
|
-
});
|
|
1023
|
-
}
|
|
1024
|
-
return this._busClient;
|
|
1025
|
-
}
|
|
1026
|
-
busHost() {
|
|
1027
|
-
if (!this._busHost && this.config.host) {
|
|
1028
|
-
this._busHost = new AsyncQueryBusHost({
|
|
1029
|
-
config: this.config.host,
|
|
1030
|
-
logger: this.logger,
|
|
1031
|
-
onQueryFulfillFinished: /* @__PURE__ */ __name((args) => {
|
|
1032
|
-
var _a;
|
|
1033
|
-
if (this.archiving && this.isAllowedArchivingQuery(args.query.schema)) {
|
|
1034
|
-
(0, import_forget3.forget)(this.storeToArchivists(((_a = args.result) == null ? void 0 : _a.flat()) ?? []));
|
|
1035
|
-
}
|
|
1036
|
-
(0, import_forget3.forget)(this.emit("queryFulfillFinished", {
|
|
1037
|
-
mod: this,
|
|
1038
|
-
...args
|
|
1039
|
-
}));
|
|
1040
|
-
}, "onQueryFulfillFinished"),
|
|
1041
|
-
onQueryFulfillStarted: /* @__PURE__ */ __name((args) => {
|
|
1042
|
-
if (this.archiving && this.isAllowedArchivingQuery(args.query.schema)) {
|
|
1043
|
-
(0, import_forget3.forget)(this.storeToArchivists([
|
|
1044
|
-
args.query,
|
|
1045
|
-
...args.payloads ?? []
|
|
1046
|
-
]));
|
|
1047
|
-
}
|
|
1048
|
-
(0, import_forget3.forget)(this.emit("queryFulfillStarted", {
|
|
1049
|
-
mod: this,
|
|
1050
|
-
...args
|
|
1051
|
-
}));
|
|
1052
|
-
}, "onQueryFulfillStarted"),
|
|
1053
|
-
rootModule: this
|
|
1054
|
-
});
|
|
1055
|
-
}
|
|
1056
|
-
return this._busHost;
|
|
1057
|
-
}
|
|
1058
|
-
async connectInstance(instance, maxDepth = 5) {
|
|
1059
|
-
var _a;
|
|
1060
|
-
if (instance) {
|
|
1061
|
-
this.downResolver.add(instance);
|
|
1062
|
-
if (maxDepth > 0) {
|
|
1063
|
-
const node = (0, import_node_model.asNodeInstance)(instance);
|
|
1064
|
-
if (node) {
|
|
1065
|
-
const state = await node.state();
|
|
1066
|
-
const children = ((state == null ? void 0 : state.filter((0, import_payload_model.isPayloadOfSchemaType)(import_module_model5.AddressSchema)).map((s) => s.address)) ?? []).filter((a) => a !== instance.address);
|
|
1067
|
-
await Promise.all(children.map((child) => this.connect(child, maxDepth - 1)));
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
(_a = this.logger) == null ? void 0 : _a.log(`Connect: ${instance.id}`);
|
|
1071
|
-
return instance.address;
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
stopHandler(_timeout) {
|
|
1075
|
-
var _a;
|
|
1076
|
-
(_a = this.busHost()) == null ? void 0 : _a.stop();
|
|
1077
|
-
return true;
|
|
1078
|
-
}
|
|
1079
|
-
};
|
|
1080
|
-
__name(_PubSubBridge, "PubSubBridge");
|
|
1081
|
-
__publicField(_PubSubBridge, "configSchemas", [
|
|
1082
|
-
...__superGet(_PubSubBridge, _PubSubBridge, "configSchemas"),
|
|
1083
|
-
PubSubBridgeConfigSchema
|
|
1084
|
-
]);
|
|
1085
|
-
__publicField(_PubSubBridge, "defaultConfigSchema", PubSubBridgeConfigSchema);
|
|
1086
|
-
var PubSubBridge = _PubSubBridge;
|
|
1087
|
-
PubSubBridge = _ts_decorate([
|
|
1088
|
-
(0, import_module_model5.creatableModule)()
|
|
1089
|
-
], PubSubBridge);
|
|
1090
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
1091
|
-
0 && (module.exports = {
|
|
1092
|
-
AbstractModuleHost,
|
|
1093
|
-
AsyncQueryBusClient,
|
|
1094
|
-
AsyncQueryBusHost,
|
|
1095
|
-
AsyncQueryBusModuleHost,
|
|
1096
|
-
AsyncQueryBusModuleProxy,
|
|
1097
|
-
Pending,
|
|
1098
|
-
PubSubBridge,
|
|
1099
|
-
PubSubBridgeConfigSchema,
|
|
1100
|
-
PubSubBridgeModuleResolver,
|
|
1101
|
-
PubSubBridgeSchema
|
|
1102
|
-
});
|
|
1103
|
-
//# sourceMappingURL=index.cjs.map
|