@decaf-ts/integrations 0.10.5 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -5
- package/dist/integrations.cjs +1 -1
- package/dist/integrations.cjs.map +1 -1
- package/dist/integrations.js +1 -1
- package/dist/integrations.js.map +1 -1
- package/docker/dragonfly-compose.yml +19 -0
- package/lib/cjs/blob/core/BlobStoreFactory.cjs +0 -4
- package/lib/cjs/blob/core/BlobStoreFactory.cjs.map +1 -1
- package/lib/cjs/feature-flags/EngineCapabilityFeatureFlag.service.cjs +214 -0
- package/lib/cjs/feature-flags/EngineCapabilityFeatureFlag.service.cjs.map +1 -0
- package/lib/cjs/feature-flags/index.cjs +1 -0
- package/lib/cjs/feature-flags/index.cjs.map +1 -1
- package/lib/cjs/index.cjs +3 -3
- package/lib/cjs/loader/ObjectLoader.cjs +95 -11
- package/lib/cjs/loader/ObjectLoader.cjs.map +1 -1
- package/lib/cjs/loader/assets.cjs +160 -0
- package/lib/cjs/loader/assets.cjs.map +1 -0
- package/lib/cjs/loader/config.cjs +241 -0
- package/lib/cjs/loader/config.cjs.map +1 -0
- package/lib/cjs/loader/families.cjs +27 -12
- package/lib/cjs/loader/families.cjs.map +1 -1
- package/lib/cjs/loader/index.cjs +3 -0
- package/lib/cjs/loader/index.cjs.map +1 -1
- package/lib/cjs/loader/nest.cjs +331 -0
- package/lib/cjs/loader/nest.cjs.map +1 -0
- package/lib/cjs/redis/RedisContextLock.cjs +185 -0
- package/lib/cjs/redis/RedisContextLock.cjs.map +1 -0
- package/lib/cjs/redis/RedisDispatch.cjs +132 -0
- package/lib/cjs/redis/RedisDispatch.cjs.map +1 -0
- package/lib/cjs/redis/RedisPaginator.cjs +95 -0
- package/lib/cjs/redis/RedisPaginator.cjs.map +1 -0
- package/lib/cjs/redis/RedisStatement.cjs +433 -0
- package/lib/cjs/redis/RedisStatement.cjs.map +1 -0
- package/lib/cjs/redis/adapter.cjs +709 -0
- package/lib/cjs/redis/adapter.cjs.map +1 -0
- package/lib/cjs/redis/constants.cjs +31 -0
- package/lib/cjs/redis/constants.cjs.map +1 -0
- package/lib/cjs/redis/handlers.cjs +27 -0
- package/lib/cjs/redis/handlers.cjs.map +1 -0
- package/lib/cjs/redis/index.cjs +36 -0
- package/lib/cjs/redis/index.cjs.map +1 -0
- package/lib/cjs/redis/serialization.cjs +63 -0
- package/lib/cjs/redis/serialization.cjs.map +1 -0
- package/lib/cjs/redis/types.cjs.map +1 -0
- package/lib/esm/blob/core/BlobStoreFactory.js +0 -4
- package/lib/esm/blob/core/BlobStoreFactory.js.map +1 -1
- package/lib/esm/feature-flags/EngineCapabilityFeatureFlag.service.js +203 -0
- package/lib/esm/feature-flags/EngineCapabilityFeatureFlag.service.js.map +1 -0
- package/lib/esm/feature-flags/index.js +1 -0
- package/lib/esm/feature-flags/index.js.map +1 -1
- package/lib/esm/index.js +3 -3
- package/lib/esm/loader/ObjectLoader.js +94 -11
- package/lib/esm/loader/ObjectLoader.js.map +1 -1
- package/lib/esm/loader/assets.js +155 -0
- package/lib/esm/loader/assets.js.map +1 -0
- package/lib/esm/loader/config.js +202 -0
- package/lib/esm/loader/config.js.map +1 -0
- package/lib/esm/loader/families.js +25 -10
- package/lib/esm/loader/families.js.map +1 -1
- package/lib/esm/loader/index.js +3 -0
- package/lib/esm/loader/index.js.map +1 -1
- package/lib/esm/loader/nest.js +292 -0
- package/lib/esm/loader/nest.js.map +1 -0
- package/lib/esm/redis/RedisContextLock.js +180 -0
- package/lib/esm/redis/RedisContextLock.js.map +1 -0
- package/lib/esm/redis/RedisDispatch.js +127 -0
- package/lib/esm/redis/RedisDispatch.js.map +1 -0
- package/lib/esm/redis/RedisPaginator.js +90 -0
- package/lib/esm/redis/RedisPaginator.js.map +1 -0
- package/lib/esm/redis/RedisStatement.js +428 -0
- package/lib/esm/redis/RedisStatement.js.map +1 -0
- package/lib/esm/redis/adapter.js +704 -0
- package/lib/esm/redis/adapter.js.map +1 -0
- package/lib/esm/redis/constants.js +27 -0
- package/lib/esm/redis/constants.js.map +1 -0
- package/lib/esm/redis/handlers.js +23 -0
- package/lib/esm/redis/handlers.js.map +1 -0
- package/lib/esm/redis/index.js +19 -0
- package/lib/esm/redis/index.js.map +1 -0
- package/lib/esm/redis/serialization.js +57 -0
- package/lib/esm/redis/serialization.js.map +1 -0
- package/lib/esm/{graph/engine → redis}/types.js.map +1 -1
- package/lib/types/blob/core/BlobTypes.d.cts +1 -14
- package/lib/types/blob/core/BlobTypes.d.mts +1 -14
- package/lib/types/feature-flags/EngineCapabilityFeatureFlag.service.d.cts +116 -0
- package/lib/types/feature-flags/EngineCapabilityFeatureFlag.service.d.mts +116 -0
- package/lib/types/feature-flags/index.d.cts +1 -0
- package/lib/types/feature-flags/index.d.mts +1 -0
- package/lib/types/index.d.cts +2 -2
- package/lib/types/index.d.mts +2 -2
- package/lib/types/loader/ObjectLoader.d.cts +46 -2
- package/lib/types/loader/ObjectLoader.d.mts +46 -2
- package/lib/types/loader/assets.d.cts +43 -0
- package/lib/types/loader/assets.d.mts +43 -0
- package/lib/types/loader/config.d.cts +84 -0
- package/lib/types/loader/config.d.mts +84 -0
- package/lib/types/loader/families.d.cts +19 -7
- package/lib/types/loader/families.d.mts +19 -7
- package/lib/types/loader/index.d.cts +3 -0
- package/lib/types/loader/index.d.mts +3 -0
- package/lib/types/loader/nest.d.cts +102 -0
- package/lib/types/loader/nest.d.mts +102 -0
- package/lib/types/loader/types.d.cts +27 -1
- package/lib/types/loader/types.d.mts +27 -1
- package/lib/types/redis/RedisContextLock.d.cts +106 -0
- package/lib/types/redis/RedisContextLock.d.mts +106 -0
- package/lib/types/redis/RedisDispatch.d.cts +56 -0
- package/lib/types/redis/RedisDispatch.d.mts +56 -0
- package/lib/types/redis/RedisPaginator.d.cts +58 -0
- package/lib/types/redis/RedisPaginator.d.mts +58 -0
- package/lib/types/redis/RedisStatement.d.cts +175 -0
- package/lib/types/redis/RedisStatement.d.mts +175 -0
- package/lib/types/redis/adapter.d.cts +288 -0
- package/lib/types/redis/adapter.d.mts +288 -0
- package/lib/types/redis/constants.d.cts +26 -0
- package/lib/types/redis/constants.d.mts +26 -0
- package/lib/types/redis/handlers.d.cts +20 -0
- package/lib/types/redis/handlers.d.mts +20 -0
- package/lib/types/redis/index.d.cts +17 -0
- package/lib/types/redis/index.d.mts +17 -0
- package/lib/types/redis/serialization.d.cts +35 -0
- package/lib/types/redis/serialization.d.mts +35 -0
- package/lib/types/redis/types.d.cts +72 -0
- package/lib/types/redis/types.d.mts +72 -0
- package/package.json +17 -33
- package/lib/cjs/blob/ipfs/IpfsBlobEnvironment.cjs +0 -30
- package/lib/cjs/blob/ipfs/IpfsBlobEnvironment.cjs.map +0 -1
- package/lib/cjs/blob/ipfs/IpfsBlobStoreService.cjs +0 -248
- package/lib/cjs/blob/ipfs/IpfsBlobStoreService.cjs.map +0 -1
- package/lib/cjs/blob/ipfs/IpfsKeyIndex.cjs +0 -27
- package/lib/cjs/blob/ipfs/IpfsKeyIndex.cjs.map +0 -1
- package/lib/cjs/blob/ipfs/LocalJsonIpfsKeyIndex.cjs +0 -35
- package/lib/cjs/blob/ipfs/LocalJsonIpfsKeyIndex.cjs.map +0 -1
- package/lib/cjs/blob/ipfs/MemoryIpfsKeyIndex.cjs +0 -45
- package/lib/cjs/blob/ipfs/MemoryIpfsKeyIndex.cjs.map +0 -1
- package/lib/cjs/blob/ipfs/PostgresIpfsKeyIndex.cjs +0 -35
- package/lib/cjs/blob/ipfs/PostgresIpfsKeyIndex.cjs.map +0 -1
- package/lib/cjs/blob/ipfs/index.cjs +0 -29
- package/lib/cjs/blob/ipfs/index.cjs.map +0 -1
- package/lib/cjs/graph/engine/catalog/GraphBuiltInRegistrations.cjs +0 -100
- package/lib/cjs/graph/engine/catalog/GraphBuiltInRegistrations.cjs.map +0 -1
- package/lib/cjs/graph/engine/catalog/GraphCatalogueErrors.cjs +0 -29
- package/lib/cjs/graph/engine/catalog/GraphCatalogueErrors.cjs.map +0 -1
- package/lib/cjs/graph/engine/catalog/GraphNodeCatalogue.cjs +0 -270
- package/lib/cjs/graph/engine/catalog/GraphNodeCatalogue.cjs.map +0 -1
- package/lib/cjs/graph/engine/catalog/GraphNodeManifestResolver.cjs +0 -169
- package/lib/cjs/graph/engine/catalog/GraphNodeManifestResolver.cjs.map +0 -1
- package/lib/cjs/graph/engine/catalog/GraphNodeMethodRegistry.cjs +0 -64
- package/lib/cjs/graph/engine/catalog/GraphNodeMethodRegistry.cjs.map +0 -1
- package/lib/cjs/graph/engine/catalog/GraphNodeRegistration.cjs +0 -17
- package/lib/cjs/graph/engine/catalog/GraphNodeRegistration.cjs.map +0 -1
- package/lib/cjs/graph/engine/catalog/index.cjs +0 -24
- package/lib/cjs/graph/engine/catalog/index.cjs.map +0 -1
- package/lib/cjs/graph/engine/constants.cjs +0 -58
- package/lib/cjs/graph/engine/constants.cjs.map +0 -1
- package/lib/cjs/graph/engine/decorators.cjs +0 -4
- package/lib/cjs/graph/engine/decorators.cjs.map +0 -1
- package/lib/cjs/graph/engine/errors/GraphBreakSignal.cjs +0 -37
- package/lib/cjs/graph/engine/errors/GraphBreakSignal.cjs.map +0 -1
- package/lib/cjs/graph/engine/errors/GraphCycleError.cjs +0 -20
- package/lib/cjs/graph/engine/errors/GraphCycleError.cjs.map +0 -1
- package/lib/cjs/graph/engine/errors/GraphExecutionError.cjs +0 -28
- package/lib/cjs/graph/engine/errors/GraphExecutionError.cjs.map +0 -1
- package/lib/cjs/graph/engine/errors/GraphInputError.cjs +0 -20
- package/lib/cjs/graph/engine/errors/GraphInputError.cjs.map +0 -1
- package/lib/cjs/graph/engine/errors/GraphLoopLimitError.cjs +0 -20
- package/lib/cjs/graph/engine/errors/GraphLoopLimitError.cjs.map +0 -1
- package/lib/cjs/graph/engine/errors/GraphPinningError.cjs +0 -20
- package/lib/cjs/graph/engine/errors/GraphPinningError.cjs.map +0 -1
- package/lib/cjs/graph/engine/errors/GraphPortError.cjs +0 -20
- package/lib/cjs/graph/engine/errors/GraphPortError.cjs.map +0 -1
- package/lib/cjs/graph/engine/errors/GraphRunCancelledError.cjs +0 -18
- package/lib/cjs/graph/engine/errors/GraphRunCancelledError.cjs.map +0 -1
- package/lib/cjs/graph/engine/errors/GraphStoreError.cjs +0 -20
- package/lib/cjs/graph/engine/errors/GraphStoreError.cjs.map +0 -1
- package/lib/cjs/graph/engine/errors/GraphTopologyError.cjs +0 -20
- package/lib/cjs/graph/engine/errors/GraphTopologyError.cjs.map +0 -1
- package/lib/cjs/graph/engine/errors/index.cjs +0 -33
- package/lib/cjs/graph/engine/errors/index.cjs.map +0 -1
- package/lib/cjs/graph/engine/events/GraphExecutionEventEmitter.cjs +0 -40
- package/lib/cjs/graph/engine/events/GraphExecutionEventEmitter.cjs.map +0 -1
- package/lib/cjs/graph/engine/events/GraphExecutionEventFactory.cjs +0 -37
- package/lib/cjs/graph/engine/events/GraphExecutionEventFactory.cjs.map +0 -1
- package/lib/cjs/graph/engine/events/GraphExecutionObserver.cjs +0 -4
- package/lib/cjs/graph/engine/events/GraphExecutionObserver.cjs.map +0 -1
- package/lib/cjs/graph/engine/events/index.cjs +0 -26
- package/lib/cjs/graph/engine/events/index.cjs.map +0 -1
- package/lib/cjs/graph/engine/execution/BreakGraphNodeExecutor.cjs +0 -24
- package/lib/cjs/graph/engine/execution/BreakGraphNodeExecutor.cjs.map +0 -1
- package/lib/cjs/graph/engine/execution/CodeGraphNodeExecutor.cjs +0 -103
- package/lib/cjs/graph/engine/execution/CodeGraphNodeExecutor.cjs.map +0 -1
- package/lib/cjs/graph/engine/execution/CodeSandboxEvaluator.cjs +0 -4
- package/lib/cjs/graph/engine/execution/CodeSandboxEvaluator.cjs.map +0 -1
- package/lib/cjs/graph/engine/execution/GraphExecutionContext.cjs +0 -112
- package/lib/cjs/graph/engine/execution/GraphExecutionContext.cjs.map +0 -1
- package/lib/cjs/graph/engine/execution/GraphExecutionEngine.cjs +0 -789
- package/lib/cjs/graph/engine/execution/GraphExecutionEngine.cjs.map +0 -1
- package/lib/cjs/graph/engine/execution/GraphExecutionFrame.cjs +0 -32
- package/lib/cjs/graph/engine/execution/GraphExecutionFrame.cjs.map +0 -1
- package/lib/cjs/graph/engine/execution/GraphExecutionResult.cjs +0 -30
- package/lib/cjs/graph/engine/execution/GraphExecutionResult.cjs.map +0 -1
- package/lib/cjs/graph/engine/execution/GraphNodeExecutor.cjs +0 -4
- package/lib/cjs/graph/engine/execution/GraphNodeExecutor.cjs.map +0 -1
- package/lib/cjs/graph/engine/execution/IsolatedVmCodeSandboxEvaluator.cjs +0 -481
- package/lib/cjs/graph/engine/execution/IsolatedVmCodeSandboxEvaluator.cjs.map +0 -1
- package/lib/cjs/graph/engine/execution/LogGraphNodeExecutor.cjs +0 -47
- package/lib/cjs/graph/engine/execution/LogGraphNodeExecutor.cjs.map +0 -1
- package/lib/cjs/graph/engine/execution/SwitchGraphNodeExecutor.cjs +0 -121
- package/lib/cjs/graph/engine/execution/SwitchGraphNodeExecutor.cjs.map +0 -1
- package/lib/cjs/graph/engine/execution/index.cjs +0 -34
- package/lib/cjs/graph/engine/execution/index.cjs.map +0 -1
- package/lib/cjs/graph/engine/index.cjs +0 -86
- package/lib/cjs/graph/engine/index.cjs.map +0 -1
- package/lib/cjs/graph/engine/loops/ConditionExpressionEvaluator.cjs +0 -87
- package/lib/cjs/graph/engine/loops/ConditionExpressionEvaluator.cjs.map +0 -1
- package/lib/cjs/graph/engine/loops/ForeachGraphNodeExecutor.cjs +0 -146
- package/lib/cjs/graph/engine/loops/ForeachGraphNodeExecutor.cjs.map +0 -1
- package/lib/cjs/graph/engine/loops/GraphConditionEvaluator.cjs +0 -85
- package/lib/cjs/graph/engine/loops/GraphConditionEvaluator.cjs.map +0 -1
- package/lib/cjs/graph/engine/loops/GraphLoopExecutionContext.cjs +0 -16
- package/lib/cjs/graph/engine/loops/GraphLoopExecutionContext.cjs.map +0 -1
- package/lib/cjs/graph/engine/loops/UntilGraphNodeExecutor.cjs +0 -102
- package/lib/cjs/graph/engine/loops/UntilGraphNodeExecutor.cjs.map +0 -1
- package/lib/cjs/graph/engine/loops/WhileGraphNodeExecutor.cjs +0 -103
- package/lib/cjs/graph/engine/loops/WhileGraphNodeExecutor.cjs.map +0 -1
- package/lib/cjs/graph/engine/loops/index.cjs +0 -29
- package/lib/cjs/graph/engine/loops/index.cjs.map +0 -1
- package/lib/cjs/graph/engine/pinning/GraphPinningDependencyResolver.cjs +0 -28
- package/lib/cjs/graph/engine/pinning/GraphPinningDependencyResolver.cjs.map +0 -1
- package/lib/cjs/graph/engine/pinning/GraphPinningMetadata.cjs +0 -20
- package/lib/cjs/graph/engine/pinning/GraphPinningMetadata.cjs.map +0 -1
- package/lib/cjs/graph/engine/pinning/GraphPinningPolicy.cjs +0 -34
- package/lib/cjs/graph/engine/pinning/GraphPinningPolicy.cjs.map +0 -1
- package/lib/cjs/graph/engine/pinning/GraphPinningService.cjs +0 -220
- package/lib/cjs/graph/engine/pinning/GraphPinningService.cjs.map +0 -1
- package/lib/cjs/graph/engine/pinning/index.cjs +0 -27
- package/lib/cjs/graph/engine/pinning/index.cjs.map +0 -1
- package/lib/cjs/graph/engine/planning/GraphExecutionPlan.cjs +0 -4
- package/lib/cjs/graph/engine/planning/GraphExecutionPlan.cjs.map +0 -1
- package/lib/cjs/graph/engine/planning/GraphExecutionPlanEdge.cjs +0 -4
- package/lib/cjs/graph/engine/planning/GraphExecutionPlanEdge.cjs.map +0 -1
- package/lib/cjs/graph/engine/planning/GraphExecutionPlanLayer.cjs +0 -4
- package/lib/cjs/graph/engine/planning/GraphExecutionPlanLayer.cjs.map +0 -1
- package/lib/cjs/graph/engine/planning/GraphExecutionPlanNode.cjs +0 -4
- package/lib/cjs/graph/engine/planning/GraphExecutionPlanNode.cjs.map +0 -1
- package/lib/cjs/graph/engine/planning/GraphExecutionPlanner.cjs +0 -188
- package/lib/cjs/graph/engine/planning/GraphExecutionPlanner.cjs.map +0 -1
- package/lib/cjs/graph/engine/planning/GraphTopology.cjs +0 -57
- package/lib/cjs/graph/engine/planning/GraphTopology.cjs.map +0 -1
- package/lib/cjs/graph/engine/planning/index.cjs +0 -29
- package/lib/cjs/graph/engine/planning/index.cjs.map +0 -1
- package/lib/cjs/graph/engine/registry/GraphNodeExecutorRegistry.cjs +0 -57
- package/lib/cjs/graph/engine/registry/GraphNodeExecutorRegistry.cjs.map +0 -1
- package/lib/cjs/graph/engine/registry/GraphNodeExecutorResolver.cjs +0 -27
- package/lib/cjs/graph/engine/registry/GraphNodeExecutorResolver.cjs.map +0 -1
- package/lib/cjs/graph/engine/registry/index.cjs +0 -25
- package/lib/cjs/graph/engine/registry/index.cjs.map +0 -1
- package/lib/cjs/graph/engine/runs/GraphRunEventPublisher.cjs +0 -69
- package/lib/cjs/graph/engine/runs/GraphRunEventPublisher.cjs.map +0 -1
- package/lib/cjs/graph/engine/runs/GraphRunExecutor.cjs +0 -291
- package/lib/cjs/graph/engine/runs/GraphRunExecutor.cjs.map +0 -1
- package/lib/cjs/graph/engine/runs/GraphRunFingerprint.cjs +0 -29
- package/lib/cjs/graph/engine/runs/GraphRunFingerprint.cjs.map +0 -1
- package/lib/cjs/graph/engine/runs/GraphRunService.cjs +0 -259
- package/lib/cjs/graph/engine/runs/GraphRunService.cjs.map +0 -1
- package/lib/cjs/graph/engine/runs/InMemoryGraphRunEventStore.cjs +0 -69
- package/lib/cjs/graph/engine/runs/InMemoryGraphRunEventStore.cjs.map +0 -1
- package/lib/cjs/graph/engine/runs/InMemoryGraphRunStore.cjs +0 -26
- package/lib/cjs/graph/engine/runs/InMemoryGraphRunStore.cjs.map +0 -1
- package/lib/cjs/graph/engine/runs/index.cjs +0 -26
- package/lib/cjs/graph/engine/runs/index.cjs.map +0 -1
- package/lib/cjs/graph/engine/runs/ownership.cjs +0 -34
- package/lib/cjs/graph/engine/runs/ownership.cjs.map +0 -1
- package/lib/cjs/graph/engine/runs/types.cjs.map +0 -1
- package/lib/cjs/graph/engine/snapshots/GraphExecutionSnapshotMapper.cjs +0 -53
- package/lib/cjs/graph/engine/snapshots/GraphExecutionSnapshotMapper.cjs.map +0 -1
- package/lib/cjs/graph/engine/snapshots/index.cjs +0 -24
- package/lib/cjs/graph/engine/snapshots/index.cjs.map +0 -1
- package/lib/cjs/graph/engine/store/GraphCachedValue.cjs +0 -4
- package/lib/cjs/graph/engine/store/GraphCachedValue.cjs.map +0 -1
- package/lib/cjs/graph/engine/store/GraphValueKey.cjs +0 -4
- package/lib/cjs/graph/engine/store/GraphValueKey.cjs.map +0 -1
- package/lib/cjs/graph/engine/store/GraphValueStore.cjs +0 -76
- package/lib/cjs/graph/engine/store/GraphValueStore.cjs.map +0 -1
- package/lib/cjs/graph/engine/store/GraphValueStoreAdapter.cjs +0 -4
- package/lib/cjs/graph/engine/store/GraphValueStoreAdapter.cjs.map +0 -1
- package/lib/cjs/graph/engine/store/InMemoryGraphValueStoreAdapter.cjs +0 -69
- package/lib/cjs/graph/engine/store/InMemoryGraphValueStoreAdapter.cjs.map +0 -1
- package/lib/cjs/graph/engine/store/index.cjs +0 -28
- package/lib/cjs/graph/engine/store/index.cjs.map +0 -1
- package/lib/cjs/graph/engine/types.cjs +0 -4
- package/lib/cjs/graph/engine/types.cjs.map +0 -1
- package/lib/cjs/graph/engine/validation/GraphConnectionPolicyValidator.cjs +0 -142
- package/lib/cjs/graph/engine/validation/GraphConnectionPolicyValidator.cjs.map +0 -1
- package/lib/cjs/graph/engine/validation/GraphCredentialReferenceValidator.cjs +0 -160
- package/lib/cjs/graph/engine/validation/GraphCredentialReferenceValidator.cjs.map +0 -1
- package/lib/cjs/graph/engine/validation/GraphDefinitionValidator.cjs +0 -29
- package/lib/cjs/graph/engine/validation/GraphDefinitionValidator.cjs.map +0 -1
- package/lib/cjs/graph/engine/validation/GraphEdgeInstanceValidator.cjs +0 -166
- package/lib/cjs/graph/engine/validation/GraphEdgeInstanceValidator.cjs.map +0 -1
- package/lib/cjs/graph/engine/validation/GraphNodeInstanceValidator.cjs +0 -86
- package/lib/cjs/graph/engine/validation/GraphNodeInstanceValidator.cjs.map +0 -1
- package/lib/cjs/graph/engine/validation/GraphParameterValidator.cjs +0 -423
- package/lib/cjs/graph/engine/validation/GraphParameterValidator.cjs.map +0 -1
- package/lib/cjs/graph/engine/validation/GraphPortSchemaResolver.cjs +0 -58
- package/lib/cjs/graph/engine/validation/GraphPortSchemaResolver.cjs.map +0 -1
- package/lib/cjs/graph/engine/validation/GraphResolvedWorkflow.cjs +0 -4
- package/lib/cjs/graph/engine/validation/GraphResolvedWorkflow.cjs.map +0 -1
- package/lib/cjs/graph/engine/validation/GraphValidationErrors.cjs +0 -50
- package/lib/cjs/graph/engine/validation/GraphValidationErrors.cjs.map +0 -1
- package/lib/cjs/graph/engine/validation/GraphValidationIssue.cjs +0 -4
- package/lib/cjs/graph/engine/validation/GraphValidationIssue.cjs.map +0 -1
- package/lib/cjs/graph/engine/validation/GraphValueValidator.cjs +0 -52
- package/lib/cjs/graph/engine/validation/GraphValueValidator.cjs.map +0 -1
- package/lib/cjs/graph/engine/validation/GraphWorkflowDocumentValidator.cjs +0 -478
- package/lib/cjs/graph/engine/validation/GraphWorkflowDocumentValidator.cjs.map +0 -1
- package/lib/cjs/graph/engine/validation/index.cjs +0 -37
- package/lib/cjs/graph/engine/validation/index.cjs.map +0 -1
- package/lib/cjs/graph/index.cjs +0 -30
- package/lib/cjs/graph/index.cjs.map +0 -1
- package/lib/cjs/graph/log/GraphRunLogger.cjs +0 -145
- package/lib/cjs/graph/log/GraphRunLogger.cjs.map +0 -1
- package/lib/cjs/graph/log/LogParameters.cjs +0 -73
- package/lib/cjs/graph/log/LogParameters.cjs.map +0 -1
- package/lib/cjs/nest/graph/GraphExecutionController.cjs +0 -266
- package/lib/cjs/nest/graph/GraphExecutionController.cjs.map +0 -1
- package/lib/cjs/nest/graph/GraphExecutionModule.cjs +0 -178
- package/lib/cjs/nest/graph/GraphExecutionModule.cjs.map +0 -1
- package/lib/cjs/nest/graph/GraphExecutionResultModel.cjs +0 -75
- package/lib/cjs/nest/graph/GraphExecutionResultModel.cjs.map +0 -1
- package/lib/cjs/nest/graph/GraphExecutorRegistryFactory.cjs +0 -102
- package/lib/cjs/nest/graph/GraphExecutorRegistryFactory.cjs.map +0 -1
- package/lib/cjs/nest/graph/GraphNodeCatalogueController.cjs +0 -270
- package/lib/cjs/nest/graph/GraphNodeCatalogueController.cjs.map +0 -1
- package/lib/cjs/nest/graph/GraphResultService.cjs +0 -69
- package/lib/cjs/nest/graph/GraphResultService.cjs.map +0 -1
- package/lib/cjs/nest/graph/GraphRunController.cjs +0 -279
- package/lib/cjs/nest/graph/GraphRunController.cjs.map +0 -1
- package/lib/cjs/nest/graph/GraphRunModel.cjs +0 -83
- package/lib/cjs/nest/graph/GraphRunModel.cjs.map +0 -1
- package/lib/cjs/nest/graph/GraphRunModelService.cjs +0 -121
- package/lib/cjs/nest/graph/GraphRunModelService.cjs.map +0 -1
- package/lib/cjs/nest/graph/GraphWorkflowBoundaryValidation.cjs +0 -169
- package/lib/cjs/nest/graph/GraphWorkflowBoundaryValidation.cjs.map +0 -1
- package/lib/cjs/nest/graph/GraphWorkflowController.cjs +0 -162
- package/lib/cjs/nest/graph/GraphWorkflowController.cjs.map +0 -1
- package/lib/cjs/nest/graph/GraphWorkflowDocumentLimits.cjs +0 -12
- package/lib/cjs/nest/graph/GraphWorkflowDocumentLimits.cjs.map +0 -1
- package/lib/cjs/nest/graph/GraphWorkflowErrors.cjs +0 -23
- package/lib/cjs/nest/graph/GraphWorkflowErrors.cjs.map +0 -1
- package/lib/cjs/nest/graph/GraphWorkflowModel.cjs +0 -66
- package/lib/cjs/nest/graph/GraphWorkflowModel.cjs.map +0 -1
- package/lib/cjs/nest/graph/GraphWorkflowService.cjs +0 -265
- package/lib/cjs/nest/graph/GraphWorkflowService.cjs.map +0 -1
- package/lib/cjs/nest/graph/index.cjs +0 -33
- package/lib/cjs/nest/graph/index.cjs.map +0 -1
- package/lib/cjs/nest/graph/main.cjs +0 -47
- package/lib/cjs/nest/graph/main.cjs.map +0 -1
- package/lib/esm/blob/ipfs/IpfsBlobEnvironment.js +0 -26
- package/lib/esm/blob/ipfs/IpfsBlobEnvironment.js.map +0 -1
- package/lib/esm/blob/ipfs/IpfsBlobStoreService.js +0 -240
- package/lib/esm/blob/ipfs/IpfsBlobStoreService.js.map +0 -1
- package/lib/esm/blob/ipfs/IpfsKeyIndex.js +0 -23
- package/lib/esm/blob/ipfs/IpfsKeyIndex.js.map +0 -1
- package/lib/esm/blob/ipfs/LocalJsonIpfsKeyIndex.js +0 -30
- package/lib/esm/blob/ipfs/LocalJsonIpfsKeyIndex.js.map +0 -1
- package/lib/esm/blob/ipfs/MemoryIpfsKeyIndex.js +0 -40
- package/lib/esm/blob/ipfs/MemoryIpfsKeyIndex.js.map +0 -1
- package/lib/esm/blob/ipfs/PostgresIpfsKeyIndex.js +0 -30
- package/lib/esm/blob/ipfs/PostgresIpfsKeyIndex.js.map +0 -1
- package/lib/esm/blob/ipfs/index.js +0 -12
- package/lib/esm/blob/ipfs/index.js.map +0 -1
- package/lib/esm/graph/engine/catalog/GraphBuiltInRegistrations.js +0 -95
- package/lib/esm/graph/engine/catalog/GraphBuiltInRegistrations.js.map +0 -1
- package/lib/esm/graph/engine/catalog/GraphCatalogueErrors.js +0 -22
- package/lib/esm/graph/engine/catalog/GraphCatalogueErrors.js.map +0 -1
- package/lib/esm/graph/engine/catalog/GraphNodeCatalogue.js +0 -265
- package/lib/esm/graph/engine/catalog/GraphNodeCatalogue.js.map +0 -1
- package/lib/esm/graph/engine/catalog/GraphNodeManifestResolver.js +0 -162
- package/lib/esm/graph/engine/catalog/GraphNodeManifestResolver.js.map +0 -1
- package/lib/esm/graph/engine/catalog/GraphNodeMethodRegistry.js +0 -59
- package/lib/esm/graph/engine/catalog/GraphNodeMethodRegistry.js.map +0 -1
- package/lib/esm/graph/engine/catalog/GraphNodeRegistration.js +0 -12
- package/lib/esm/graph/engine/catalog/GraphNodeRegistration.js.map +0 -1
- package/lib/esm/graph/engine/catalog/index.js +0 -7
- package/lib/esm/graph/engine/catalog/index.js.map +0 -1
- package/lib/esm/graph/engine/constants.js +0 -62
- package/lib/esm/graph/engine/constants.js.map +0 -1
- package/lib/esm/graph/engine/decorators.js +0 -2
- package/lib/esm/graph/engine/decorators.js.map +0 -1
- package/lib/esm/graph/engine/errors/GraphBreakSignal.js +0 -32
- package/lib/esm/graph/engine/errors/GraphBreakSignal.js.map +0 -1
- package/lib/esm/graph/engine/errors/GraphCycleError.js +0 -15
- package/lib/esm/graph/engine/errors/GraphCycleError.js.map +0 -1
- package/lib/esm/graph/engine/errors/GraphExecutionError.js +0 -23
- package/lib/esm/graph/engine/errors/GraphExecutionError.js.map +0 -1
- package/lib/esm/graph/engine/errors/GraphInputError.js +0 -15
- package/lib/esm/graph/engine/errors/GraphInputError.js.map +0 -1
- package/lib/esm/graph/engine/errors/GraphLoopLimitError.js +0 -15
- package/lib/esm/graph/engine/errors/GraphLoopLimitError.js.map +0 -1
- package/lib/esm/graph/engine/errors/GraphPinningError.js +0 -15
- package/lib/esm/graph/engine/errors/GraphPinningError.js.map +0 -1
- package/lib/esm/graph/engine/errors/GraphPortError.js +0 -15
- package/lib/esm/graph/engine/errors/GraphPortError.js.map +0 -1
- package/lib/esm/graph/engine/errors/GraphRunCancelledError.js +0 -13
- package/lib/esm/graph/engine/errors/GraphRunCancelledError.js.map +0 -1
- package/lib/esm/graph/engine/errors/GraphStoreError.js +0 -15
- package/lib/esm/graph/engine/errors/GraphStoreError.js.map +0 -1
- package/lib/esm/graph/engine/errors/GraphTopologyError.js +0 -15
- package/lib/esm/graph/engine/errors/GraphTopologyError.js.map +0 -1
- package/lib/esm/graph/engine/errors/index.js +0 -16
- package/lib/esm/graph/engine/errors/index.js.map +0 -1
- package/lib/esm/graph/engine/events/GraphExecutionEventEmitter.js +0 -35
- package/lib/esm/graph/engine/events/GraphExecutionEventEmitter.js.map +0 -1
- package/lib/esm/graph/engine/events/GraphExecutionEventFactory.js +0 -32
- package/lib/esm/graph/engine/events/GraphExecutionEventFactory.js.map +0 -1
- package/lib/esm/graph/engine/events/GraphExecutionObserver.js +0 -2
- package/lib/esm/graph/engine/events/GraphExecutionObserver.js.map +0 -1
- package/lib/esm/graph/engine/events/index.js +0 -9
- package/lib/esm/graph/engine/events/index.js.map +0 -1
- package/lib/esm/graph/engine/execution/BreakGraphNodeExecutor.js +0 -19
- package/lib/esm/graph/engine/execution/BreakGraphNodeExecutor.js.map +0 -1
- package/lib/esm/graph/engine/execution/CodeGraphNodeExecutor.js +0 -98
- package/lib/esm/graph/engine/execution/CodeGraphNodeExecutor.js.map +0 -1
- package/lib/esm/graph/engine/execution/CodeSandboxEvaluator.js +0 -18
- package/lib/esm/graph/engine/execution/CodeSandboxEvaluator.js.map +0 -1
- package/lib/esm/graph/engine/execution/GraphExecutionContext.js +0 -107
- package/lib/esm/graph/engine/execution/GraphExecutionContext.js.map +0 -1
- package/lib/esm/graph/engine/execution/GraphExecutionEngine.js +0 -784
- package/lib/esm/graph/engine/execution/GraphExecutionEngine.js.map +0 -1
- package/lib/esm/graph/engine/execution/GraphExecutionFrame.js +0 -27
- package/lib/esm/graph/engine/execution/GraphExecutionFrame.js.map +0 -1
- package/lib/esm/graph/engine/execution/GraphExecutionResult.js +0 -26
- package/lib/esm/graph/engine/execution/GraphExecutionResult.js.map +0 -1
- package/lib/esm/graph/engine/execution/GraphNodeExecutor.js +0 -2
- package/lib/esm/graph/engine/execution/GraphNodeExecutor.js.map +0 -1
- package/lib/esm/graph/engine/execution/IsolatedVmCodeSandboxEvaluator.js +0 -440
- package/lib/esm/graph/engine/execution/IsolatedVmCodeSandboxEvaluator.js.map +0 -1
- package/lib/esm/graph/engine/execution/LogGraphNodeExecutor.js +0 -42
- package/lib/esm/graph/engine/execution/LogGraphNodeExecutor.js.map +0 -1
- package/lib/esm/graph/engine/execution/SwitchGraphNodeExecutor.js +0 -116
- package/lib/esm/graph/engine/execution/SwitchGraphNodeExecutor.js.map +0 -1
- package/lib/esm/graph/engine/execution/index.js +0 -17
- package/lib/esm/graph/engine/execution/index.js.map +0 -1
- package/lib/esm/graph/engine/index.js +0 -69
- package/lib/esm/graph/engine/index.js.map +0 -1
- package/lib/esm/graph/engine/loops/ConditionExpressionEvaluator.js +0 -82
- package/lib/esm/graph/engine/loops/ConditionExpressionEvaluator.js.map +0 -1
- package/lib/esm/graph/engine/loops/ForeachGraphNodeExecutor.js +0 -141
- package/lib/esm/graph/engine/loops/ForeachGraphNodeExecutor.js.map +0 -1
- package/lib/esm/graph/engine/loops/GraphConditionEvaluator.js +0 -80
- package/lib/esm/graph/engine/loops/GraphConditionEvaluator.js.map +0 -1
- package/lib/esm/graph/engine/loops/GraphLoopExecutionContext.js +0 -11
- package/lib/esm/graph/engine/loops/GraphLoopExecutionContext.js.map +0 -1
- package/lib/esm/graph/engine/loops/UntilGraphNodeExecutor.js +0 -97
- package/lib/esm/graph/engine/loops/UntilGraphNodeExecutor.js.map +0 -1
- package/lib/esm/graph/engine/loops/WhileGraphNodeExecutor.js +0 -98
- package/lib/esm/graph/engine/loops/WhileGraphNodeExecutor.js.map +0 -1
- package/lib/esm/graph/engine/loops/index.js +0 -12
- package/lib/esm/graph/engine/loops/index.js.map +0 -1
- package/lib/esm/graph/engine/pinning/GraphPinningDependencyResolver.js +0 -23
- package/lib/esm/graph/engine/pinning/GraphPinningDependencyResolver.js.map +0 -1
- package/lib/esm/graph/engine/pinning/GraphPinningMetadata.js +0 -15
- package/lib/esm/graph/engine/pinning/GraphPinningMetadata.js.map +0 -1
- package/lib/esm/graph/engine/pinning/GraphPinningPolicy.js +0 -29
- package/lib/esm/graph/engine/pinning/GraphPinningPolicy.js.map +0 -1
- package/lib/esm/graph/engine/pinning/GraphPinningService.js +0 -215
- package/lib/esm/graph/engine/pinning/GraphPinningService.js.map +0 -1
- package/lib/esm/graph/engine/pinning/index.js +0 -10
- package/lib/esm/graph/engine/pinning/index.js.map +0 -1
- package/lib/esm/graph/engine/planning/GraphExecutionPlan.js +0 -2
- package/lib/esm/graph/engine/planning/GraphExecutionPlan.js.map +0 -1
- package/lib/esm/graph/engine/planning/GraphExecutionPlanEdge.js +0 -9
- package/lib/esm/graph/engine/planning/GraphExecutionPlanEdge.js.map +0 -1
- package/lib/esm/graph/engine/planning/GraphExecutionPlanLayer.js +0 -2
- package/lib/esm/graph/engine/planning/GraphExecutionPlanLayer.js.map +0 -1
- package/lib/esm/graph/engine/planning/GraphExecutionPlanNode.js +0 -2
- package/lib/esm/graph/engine/planning/GraphExecutionPlanNode.js.map +0 -1
- package/lib/esm/graph/engine/planning/GraphExecutionPlanner.js +0 -183
- package/lib/esm/graph/engine/planning/GraphExecutionPlanner.js.map +0 -1
- package/lib/esm/graph/engine/planning/GraphTopology.js +0 -52
- package/lib/esm/graph/engine/planning/GraphTopology.js.map +0 -1
- package/lib/esm/graph/engine/planning/index.js +0 -12
- package/lib/esm/graph/engine/planning/index.js.map +0 -1
- package/lib/esm/graph/engine/registry/GraphNodeExecutorRegistry.js +0 -52
- package/lib/esm/graph/engine/registry/GraphNodeExecutorRegistry.js.map +0 -1
- package/lib/esm/graph/engine/registry/GraphNodeExecutorResolver.js +0 -22
- package/lib/esm/graph/engine/registry/GraphNodeExecutorResolver.js.map +0 -1
- package/lib/esm/graph/engine/registry/index.js +0 -8
- package/lib/esm/graph/engine/registry/index.js.map +0 -1
- package/lib/esm/graph/engine/runs/GraphRunEventPublisher.js +0 -64
- package/lib/esm/graph/engine/runs/GraphRunEventPublisher.js.map +0 -1
- package/lib/esm/graph/engine/runs/GraphRunExecutor.js +0 -286
- package/lib/esm/graph/engine/runs/GraphRunExecutor.js.map +0 -1
- package/lib/esm/graph/engine/runs/GraphRunFingerprint.js +0 -25
- package/lib/esm/graph/engine/runs/GraphRunFingerprint.js.map +0 -1
- package/lib/esm/graph/engine/runs/GraphRunService.js +0 -254
- package/lib/esm/graph/engine/runs/GraphRunService.js.map +0 -1
- package/lib/esm/graph/engine/runs/InMemoryGraphRunEventStore.js +0 -64
- package/lib/esm/graph/engine/runs/InMemoryGraphRunEventStore.js.map +0 -1
- package/lib/esm/graph/engine/runs/InMemoryGraphRunStore.js +0 -21
- package/lib/esm/graph/engine/runs/InMemoryGraphRunStore.js.map +0 -1
- package/lib/esm/graph/engine/runs/index.js +0 -9
- package/lib/esm/graph/engine/runs/index.js.map +0 -1
- package/lib/esm/graph/engine/runs/ownership.js +0 -30
- package/lib/esm/graph/engine/runs/ownership.js.map +0 -1
- package/lib/esm/graph/engine/runs/types.js.map +0 -1
- package/lib/esm/graph/engine/snapshots/GraphExecutionSnapshotMapper.js +0 -48
- package/lib/esm/graph/engine/snapshots/GraphExecutionSnapshotMapper.js.map +0 -1
- package/lib/esm/graph/engine/snapshots/index.js +0 -7
- package/lib/esm/graph/engine/snapshots/index.js.map +0 -1
- package/lib/esm/graph/engine/store/GraphCachedValue.js +0 -2
- package/lib/esm/graph/engine/store/GraphCachedValue.js.map +0 -1
- package/lib/esm/graph/engine/store/GraphValueKey.js +0 -7
- package/lib/esm/graph/engine/store/GraphValueKey.js.map +0 -1
- package/lib/esm/graph/engine/store/GraphValueStore.js +0 -71
- package/lib/esm/graph/engine/store/GraphValueStore.js.map +0 -1
- package/lib/esm/graph/engine/store/GraphValueStoreAdapter.js +0 -2
- package/lib/esm/graph/engine/store/GraphValueStoreAdapter.js.map +0 -1
- package/lib/esm/graph/engine/store/InMemoryGraphValueStoreAdapter.js +0 -64
- package/lib/esm/graph/engine/store/InMemoryGraphValueStoreAdapter.js.map +0 -1
- package/lib/esm/graph/engine/store/index.js +0 -11
- package/lib/esm/graph/engine/store/index.js.map +0 -1
- package/lib/esm/graph/engine/types.js +0 -2
- package/lib/esm/graph/engine/validation/GraphConnectionPolicyValidator.js +0 -137
- package/lib/esm/graph/engine/validation/GraphConnectionPolicyValidator.js.map +0 -1
- package/lib/esm/graph/engine/validation/GraphCredentialReferenceValidator.js +0 -155
- package/lib/esm/graph/engine/validation/GraphCredentialReferenceValidator.js.map +0 -1
- package/lib/esm/graph/engine/validation/GraphDefinitionValidator.js +0 -24
- package/lib/esm/graph/engine/validation/GraphDefinitionValidator.js.map +0 -1
- package/lib/esm/graph/engine/validation/GraphEdgeInstanceValidator.js +0 -161
- package/lib/esm/graph/engine/validation/GraphEdgeInstanceValidator.js.map +0 -1
- package/lib/esm/graph/engine/validation/GraphNodeInstanceValidator.js +0 -81
- package/lib/esm/graph/engine/validation/GraphNodeInstanceValidator.js.map +0 -1
- package/lib/esm/graph/engine/validation/GraphParameterValidator.js +0 -416
- package/lib/esm/graph/engine/validation/GraphParameterValidator.js.map +0 -1
- package/lib/esm/graph/engine/validation/GraphPortSchemaResolver.js +0 -53
- package/lib/esm/graph/engine/validation/GraphPortSchemaResolver.js.map +0 -1
- package/lib/esm/graph/engine/validation/GraphResolvedWorkflow.js +0 -2
- package/lib/esm/graph/engine/validation/GraphResolvedWorkflow.js.map +0 -1
- package/lib/esm/graph/engine/validation/GraphValidationErrors.js +0 -43
- package/lib/esm/graph/engine/validation/GraphValidationErrors.js.map +0 -1
- package/lib/esm/graph/engine/validation/GraphValidationIssue.js +0 -2
- package/lib/esm/graph/engine/validation/GraphValidationIssue.js.map +0 -1
- package/lib/esm/graph/engine/validation/GraphValueValidator.js +0 -47
- package/lib/esm/graph/engine/validation/GraphValueValidator.js.map +0 -1
- package/lib/esm/graph/engine/validation/GraphWorkflowDocumentValidator.js +0 -472
- package/lib/esm/graph/engine/validation/GraphWorkflowDocumentValidator.js.map +0 -1
- package/lib/esm/graph/engine/validation/index.js +0 -20
- package/lib/esm/graph/engine/validation/index.js.map +0 -1
- package/lib/esm/graph/index.js +0 -13
- package/lib/esm/graph/index.js.map +0 -1
- package/lib/esm/graph/log/GraphRunLogger.js +0 -140
- package/lib/esm/graph/log/GraphRunLogger.js.map +0 -1
- package/lib/esm/graph/log/LogParameters.js +0 -69
- package/lib/esm/graph/log/LogParameters.js.map +0 -1
- package/lib/esm/nest/graph/GraphExecutionController.js +0 -257
- package/lib/esm/nest/graph/GraphExecutionController.js.map +0 -1
- package/lib/esm/nest/graph/GraphExecutionModule.js +0 -137
- package/lib/esm/nest/graph/GraphExecutionModule.js.map +0 -1
- package/lib/esm/nest/graph/GraphExecutionResultModel.js +0 -66
- package/lib/esm/nest/graph/GraphExecutionResultModel.js.map +0 -1
- package/lib/esm/nest/graph/GraphExecutorRegistryFactory.js +0 -95
- package/lib/esm/nest/graph/GraphExecutorRegistryFactory.js.map +0 -1
- package/lib/esm/nest/graph/GraphNodeCatalogueController.js +0 -261
- package/lib/esm/nest/graph/GraphNodeCatalogueController.js.map +0 -1
- package/lib/esm/nest/graph/GraphResultService.js +0 -60
- package/lib/esm/nest/graph/GraphResultService.js.map +0 -1
- package/lib/esm/nest/graph/GraphRunController.js +0 -270
- package/lib/esm/nest/graph/GraphRunController.js.map +0 -1
- package/lib/esm/nest/graph/GraphRunModel.js +0 -74
- package/lib/esm/nest/graph/GraphRunModel.js.map +0 -1
- package/lib/esm/nest/graph/GraphRunModelService.js +0 -112
- package/lib/esm/nest/graph/GraphRunModelService.js.map +0 -1
- package/lib/esm/nest/graph/GraphWorkflowBoundaryValidation.js +0 -164
- package/lib/esm/nest/graph/GraphWorkflowBoundaryValidation.js.map +0 -1
- package/lib/esm/nest/graph/GraphWorkflowController.js +0 -153
- package/lib/esm/nest/graph/GraphWorkflowController.js.map +0 -1
- package/lib/esm/nest/graph/GraphWorkflowDocumentLimits.js +0 -8
- package/lib/esm/nest/graph/GraphWorkflowDocumentLimits.js.map +0 -1
- package/lib/esm/nest/graph/GraphWorkflowErrors.js +0 -18
- package/lib/esm/nest/graph/GraphWorkflowErrors.js.map +0 -1
- package/lib/esm/nest/graph/GraphWorkflowModel.js +0 -57
- package/lib/esm/nest/graph/GraphWorkflowModel.js.map +0 -1
- package/lib/esm/nest/graph/GraphWorkflowService.js +0 -255
- package/lib/esm/nest/graph/GraphWorkflowService.js.map +0 -1
- package/lib/esm/nest/graph/index.js +0 -16
- package/lib/esm/nest/graph/index.js.map +0 -1
- package/lib/esm/nest/graph/main.js +0 -44
- package/lib/esm/nest/graph/main.js.map +0 -1
- package/lib/types/blob/ipfs/IpfsBlobEnvironment.d.cts +0 -24
- package/lib/types/blob/ipfs/IpfsBlobEnvironment.d.mts +0 -24
- package/lib/types/blob/ipfs/IpfsBlobStoreService.d.cts +0 -61
- package/lib/types/blob/ipfs/IpfsBlobStoreService.d.mts +0 -61
- package/lib/types/blob/ipfs/IpfsKeyIndex.d.cts +0 -9
- package/lib/types/blob/ipfs/IpfsKeyIndex.d.mts +0 -9
- package/lib/types/blob/ipfs/LocalJsonIpfsKeyIndex.d.cts +0 -11
- package/lib/types/blob/ipfs/LocalJsonIpfsKeyIndex.d.mts +0 -11
- package/lib/types/blob/ipfs/MemoryIpfsKeyIndex.d.cts +0 -15
- package/lib/types/blob/ipfs/MemoryIpfsKeyIndex.d.mts +0 -15
- package/lib/types/blob/ipfs/PostgresIpfsKeyIndex.d.cts +0 -11
- package/lib/types/blob/ipfs/PostgresIpfsKeyIndex.d.mts +0 -11
- package/lib/types/blob/ipfs/index.d.cts +0 -11
- package/lib/types/blob/ipfs/index.d.mts +0 -11
- package/lib/types/graph/engine/catalog/GraphBuiltInRegistrations.d.cts +0 -17
- package/lib/types/graph/engine/catalog/GraphBuiltInRegistrations.d.mts +0 -17
- package/lib/types/graph/engine/catalog/GraphCatalogueErrors.d.cts +0 -13
- package/lib/types/graph/engine/catalog/GraphCatalogueErrors.d.mts +0 -13
- package/lib/types/graph/engine/catalog/GraphNodeCatalogue.d.cts +0 -71
- package/lib/types/graph/engine/catalog/GraphNodeCatalogue.d.mts +0 -71
- package/lib/types/graph/engine/catalog/GraphNodeManifestResolver.d.cts +0 -42
- package/lib/types/graph/engine/catalog/GraphNodeManifestResolver.d.mts +0 -42
- package/lib/types/graph/engine/catalog/GraphNodeMethodRegistry.d.cts +0 -22
- package/lib/types/graph/engine/catalog/GraphNodeMethodRegistry.d.mts +0 -22
- package/lib/types/graph/engine/catalog/GraphNodeRegistration.d.cts +0 -68
- package/lib/types/graph/engine/catalog/GraphNodeRegistration.d.mts +0 -68
- package/lib/types/graph/engine/catalog/index.d.cts +0 -6
- package/lib/types/graph/engine/catalog/index.d.mts +0 -6
- package/lib/types/graph/engine/constants.d.cts +0 -59
- package/lib/types/graph/engine/constants.d.mts +0 -59
- package/lib/types/graph/engine/decorators.d.cts +0 -6
- package/lib/types/graph/engine/decorators.d.mts +0 -6
- package/lib/types/graph/engine/errors/GraphBreakSignal.d.cts +0 -28
- package/lib/types/graph/engine/errors/GraphBreakSignal.d.mts +0 -28
- package/lib/types/graph/engine/errors/GraphCycleError.d.cts +0 -12
- package/lib/types/graph/engine/errors/GraphCycleError.d.mts +0 -12
- package/lib/types/graph/engine/errors/GraphExecutionError.d.cts +0 -19
- package/lib/types/graph/engine/errors/GraphExecutionError.d.mts +0 -19
- package/lib/types/graph/engine/errors/GraphInputError.d.cts +0 -12
- package/lib/types/graph/engine/errors/GraphInputError.d.mts +0 -12
- package/lib/types/graph/engine/errors/GraphLoopLimitError.d.cts +0 -12
- package/lib/types/graph/engine/errors/GraphLoopLimitError.d.mts +0 -12
- package/lib/types/graph/engine/errors/GraphPinningError.d.cts +0 -12
- package/lib/types/graph/engine/errors/GraphPinningError.d.mts +0 -12
- package/lib/types/graph/engine/errors/GraphPortError.d.cts +0 -12
- package/lib/types/graph/engine/errors/GraphPortError.d.mts +0 -12
- package/lib/types/graph/engine/errors/GraphRunCancelledError.d.cts +0 -9
- package/lib/types/graph/engine/errors/GraphRunCancelledError.d.mts +0 -9
- package/lib/types/graph/engine/errors/GraphStoreError.d.cts +0 -12
- package/lib/types/graph/engine/errors/GraphStoreError.d.mts +0 -12
- package/lib/types/graph/engine/errors/GraphTopologyError.d.cts +0 -12
- package/lib/types/graph/engine/errors/GraphTopologyError.d.mts +0 -12
- package/lib/types/graph/engine/errors/index.d.cts +0 -15
- package/lib/types/graph/engine/errors/index.d.mts +0 -15
- package/lib/types/graph/engine/events/GraphExecutionEventEmitter.d.cts +0 -26
- package/lib/types/graph/engine/events/GraphExecutionEventEmitter.d.mts +0 -26
- package/lib/types/graph/engine/events/GraphExecutionEventFactory.d.cts +0 -25
- package/lib/types/graph/engine/events/GraphExecutionEventFactory.d.mts +0 -25
- package/lib/types/graph/engine/events/GraphExecutionObserver.d.cts +0 -17
- package/lib/types/graph/engine/events/GraphExecutionObserver.d.mts +0 -17
- package/lib/types/graph/engine/events/index.d.cts +0 -8
- package/lib/types/graph/engine/events/index.d.mts +0 -8
- package/lib/types/graph/engine/execution/BreakGraphNodeExecutor.d.cts +0 -22
- package/lib/types/graph/engine/execution/BreakGraphNodeExecutor.d.mts +0 -22
- package/lib/types/graph/engine/execution/CodeGraphNodeExecutor.d.cts +0 -65
- package/lib/types/graph/engine/execution/CodeGraphNodeExecutor.d.mts +0 -65
- package/lib/types/graph/engine/execution/CodeSandboxEvaluator.d.cts +0 -76
- package/lib/types/graph/engine/execution/CodeSandboxEvaluator.d.mts +0 -76
- package/lib/types/graph/engine/execution/GraphExecutionContext.d.cts +0 -74
- package/lib/types/graph/engine/execution/GraphExecutionContext.d.mts +0 -74
- package/lib/types/graph/engine/execution/GraphExecutionEngine.d.cts +0 -251
- package/lib/types/graph/engine/execution/GraphExecutionEngine.d.mts +0 -251
- package/lib/types/graph/engine/execution/GraphExecutionFrame.d.cts +0 -30
- package/lib/types/graph/engine/execution/GraphExecutionFrame.d.mts +0 -30
- package/lib/types/graph/engine/execution/GraphExecutionResult.d.cts +0 -13
- package/lib/types/graph/engine/execution/GraphExecutionResult.d.mts +0 -13
- package/lib/types/graph/engine/execution/GraphNodeExecutor.d.cts +0 -31
- package/lib/types/graph/engine/execution/GraphNodeExecutor.d.mts +0 -31
- package/lib/types/graph/engine/execution/IsolatedVmCodeSandboxEvaluator.d.cts +0 -63
- package/lib/types/graph/engine/execution/IsolatedVmCodeSandboxEvaluator.d.mts +0 -63
- package/lib/types/graph/engine/execution/LogGraphNodeExecutor.d.cts +0 -25
- package/lib/types/graph/engine/execution/LogGraphNodeExecutor.d.mts +0 -25
- package/lib/types/graph/engine/execution/SwitchGraphNodeExecutor.d.cts +0 -43
- package/lib/types/graph/engine/execution/SwitchGraphNodeExecutor.d.mts +0 -43
- package/lib/types/graph/engine/execution/index.d.cts +0 -16
- package/lib/types/graph/engine/execution/index.d.mts +0 -16
- package/lib/types/graph/engine/index.d.cts +0 -63
- package/lib/types/graph/engine/index.d.mts +0 -63
- package/lib/types/graph/engine/loops/ConditionExpressionEvaluator.d.cts +0 -36
- package/lib/types/graph/engine/loops/ConditionExpressionEvaluator.d.mts +0 -36
- package/lib/types/graph/engine/loops/ForeachGraphNodeExecutor.d.cts +0 -35
- package/lib/types/graph/engine/loops/ForeachGraphNodeExecutor.d.mts +0 -35
- package/lib/types/graph/engine/loops/GraphConditionEvaluator.d.cts +0 -40
- package/lib/types/graph/engine/loops/GraphConditionEvaluator.d.mts +0 -40
- package/lib/types/graph/engine/loops/GraphLoopExecutionContext.d.cts +0 -15
- package/lib/types/graph/engine/loops/GraphLoopExecutionContext.d.mts +0 -15
- package/lib/types/graph/engine/loops/UntilGraphNodeExecutor.d.cts +0 -22
- package/lib/types/graph/engine/loops/UntilGraphNodeExecutor.d.mts +0 -22
- package/lib/types/graph/engine/loops/WhileGraphNodeExecutor.d.cts +0 -26
- package/lib/types/graph/engine/loops/WhileGraphNodeExecutor.d.mts +0 -26
- package/lib/types/graph/engine/loops/index.d.cts +0 -11
- package/lib/types/graph/engine/loops/index.d.mts +0 -11
- package/lib/types/graph/engine/pinning/GraphPinningDependencyResolver.d.cts +0 -21
- package/lib/types/graph/engine/pinning/GraphPinningDependencyResolver.d.mts +0 -21
- package/lib/types/graph/engine/pinning/GraphPinningMetadata.d.cts +0 -14
- package/lib/types/graph/engine/pinning/GraphPinningMetadata.d.mts +0 -14
- package/lib/types/graph/engine/pinning/GraphPinningPolicy.d.cts +0 -20
- package/lib/types/graph/engine/pinning/GraphPinningPolicy.d.mts +0 -20
- package/lib/types/graph/engine/pinning/GraphPinningService.d.cts +0 -70
- package/lib/types/graph/engine/pinning/GraphPinningService.d.mts +0 -70
- package/lib/types/graph/engine/pinning/index.d.cts +0 -9
- package/lib/types/graph/engine/pinning/index.d.mts +0 -9
- package/lib/types/graph/engine/planning/GraphExecutionPlan.d.cts +0 -25
- package/lib/types/graph/engine/planning/GraphExecutionPlan.d.mts +0 -25
- package/lib/types/graph/engine/planning/GraphExecutionPlanEdge.d.cts +0 -26
- package/lib/types/graph/engine/planning/GraphExecutionPlanEdge.d.mts +0 -26
- package/lib/types/graph/engine/planning/GraphExecutionPlanLayer.d.cts +0 -13
- package/lib/types/graph/engine/planning/GraphExecutionPlanLayer.d.mts +0 -13
- package/lib/types/graph/engine/planning/GraphExecutionPlanNode.d.cts +0 -28
- package/lib/types/graph/engine/planning/GraphExecutionPlanNode.d.mts +0 -28
- package/lib/types/graph/engine/planning/GraphExecutionPlanner.d.cts +0 -48
- package/lib/types/graph/engine/planning/GraphExecutionPlanner.d.mts +0 -48
- package/lib/types/graph/engine/planning/GraphTopology.d.cts +0 -23
- package/lib/types/graph/engine/planning/GraphTopology.d.mts +0 -23
- package/lib/types/graph/engine/planning/index.d.cts +0 -11
- package/lib/types/graph/engine/planning/index.d.mts +0 -11
- package/lib/types/graph/engine/registry/GraphNodeExecutorRegistry.d.cts +0 -39
- package/lib/types/graph/engine/registry/GraphNodeExecutorRegistry.d.mts +0 -39
- package/lib/types/graph/engine/registry/GraphNodeExecutorResolver.d.cts +0 -21
- package/lib/types/graph/engine/registry/GraphNodeExecutorResolver.d.mts +0 -21
- package/lib/types/graph/engine/registry/index.d.cts +0 -7
- package/lib/types/graph/engine/registry/index.d.mts +0 -7
- package/lib/types/graph/engine/runs/GraphRunEventPublisher.d.cts +0 -26
- package/lib/types/graph/engine/runs/GraphRunEventPublisher.d.mts +0 -26
- package/lib/types/graph/engine/runs/GraphRunExecutor.d.cts +0 -75
- package/lib/types/graph/engine/runs/GraphRunExecutor.d.mts +0 -75
- package/lib/types/graph/engine/runs/GraphRunFingerprint.d.cts +0 -8
- package/lib/types/graph/engine/runs/GraphRunFingerprint.d.mts +0 -8
- package/lib/types/graph/engine/runs/GraphRunService.d.cts +0 -93
- package/lib/types/graph/engine/runs/GraphRunService.d.mts +0 -93
- package/lib/types/graph/engine/runs/InMemoryGraphRunEventStore.d.cts +0 -28
- package/lib/types/graph/engine/runs/InMemoryGraphRunEventStore.d.mts +0 -28
- package/lib/types/graph/engine/runs/InMemoryGraphRunStore.d.cts +0 -12
- package/lib/types/graph/engine/runs/InMemoryGraphRunStore.d.mts +0 -12
- package/lib/types/graph/engine/runs/index.d.cts +0 -8
- package/lib/types/graph/engine/runs/index.d.mts +0 -8
- package/lib/types/graph/engine/runs/ownership.d.cts +0 -25
- package/lib/types/graph/engine/runs/ownership.d.mts +0 -25
- package/lib/types/graph/engine/runs/types.d.cts +0 -83
- package/lib/types/graph/engine/runs/types.d.mts +0 -83
- package/lib/types/graph/engine/snapshots/GraphExecutionSnapshotMapper.d.cts +0 -10
- package/lib/types/graph/engine/snapshots/GraphExecutionSnapshotMapper.d.mts +0 -10
- package/lib/types/graph/engine/snapshots/index.d.cts +0 -6
- package/lib/types/graph/engine/snapshots/index.d.mts +0 -6
- package/lib/types/graph/engine/store/GraphCachedValue.d.cts +0 -20
- package/lib/types/graph/engine/store/GraphCachedValue.d.mts +0 -20
- package/lib/types/graph/engine/store/GraphValueKey.d.cts +0 -18
- package/lib/types/graph/engine/store/GraphValueKey.d.mts +0 -18
- package/lib/types/graph/engine/store/GraphValueStore.d.cts +0 -41
- package/lib/types/graph/engine/store/GraphValueStore.d.mts +0 -41
- package/lib/types/graph/engine/store/GraphValueStoreAdapter.d.cts +0 -32
- package/lib/types/graph/engine/store/GraphValueStoreAdapter.d.mts +0 -32
- package/lib/types/graph/engine/store/InMemoryGraphValueStoreAdapter.d.cts +0 -33
- package/lib/types/graph/engine/store/InMemoryGraphValueStoreAdapter.d.mts +0 -33
- package/lib/types/graph/engine/store/index.d.cts +0 -10
- package/lib/types/graph/engine/store/index.d.mts +0 -10
- package/lib/types/graph/engine/types.d.cts +0 -208
- package/lib/types/graph/engine/types.d.mts +0 -208
- package/lib/types/graph/engine/validation/GraphConnectionPolicyValidator.d.cts +0 -32
- package/lib/types/graph/engine/validation/GraphConnectionPolicyValidator.d.mts +0 -32
- package/lib/types/graph/engine/validation/GraphCredentialReferenceValidator.d.cts +0 -62
- package/lib/types/graph/engine/validation/GraphCredentialReferenceValidator.d.mts +0 -62
- package/lib/types/graph/engine/validation/GraphDefinitionValidator.d.cts +0 -23
- package/lib/types/graph/engine/validation/GraphDefinitionValidator.d.mts +0 -23
- package/lib/types/graph/engine/validation/GraphEdgeInstanceValidator.d.cts +0 -32
- package/lib/types/graph/engine/validation/GraphEdgeInstanceValidator.d.mts +0 -32
- package/lib/types/graph/engine/validation/GraphNodeInstanceValidator.d.cts +0 -37
- package/lib/types/graph/engine/validation/GraphNodeInstanceValidator.d.mts +0 -37
- package/lib/types/graph/engine/validation/GraphParameterValidator.d.cts +0 -92
- package/lib/types/graph/engine/validation/GraphParameterValidator.d.mts +0 -92
- package/lib/types/graph/engine/validation/GraphPortSchemaResolver.d.cts +0 -39
- package/lib/types/graph/engine/validation/GraphPortSchemaResolver.d.mts +0 -39
- package/lib/types/graph/engine/validation/GraphResolvedWorkflow.d.cts +0 -66
- package/lib/types/graph/engine/validation/GraphResolvedWorkflow.d.mts +0 -66
- package/lib/types/graph/engine/validation/GraphValidationErrors.d.cts +0 -34
- package/lib/types/graph/engine/validation/GraphValidationErrors.d.mts +0 -34
- package/lib/types/graph/engine/validation/GraphValidationIssue.d.cts +0 -39
- package/lib/types/graph/engine/validation/GraphValidationIssue.d.mts +0 -39
- package/lib/types/graph/engine/validation/GraphValueValidator.d.cts +0 -27
- package/lib/types/graph/engine/validation/GraphValueValidator.d.mts +0 -27
- package/lib/types/graph/engine/validation/GraphWorkflowDocumentValidator.d.cts +0 -162
- package/lib/types/graph/engine/validation/GraphWorkflowDocumentValidator.d.mts +0 -162
- package/lib/types/graph/engine/validation/index.d.cts +0 -19
- package/lib/types/graph/engine/validation/index.d.mts +0 -19
- package/lib/types/graph/index.d.cts +0 -12
- package/lib/types/graph/index.d.mts +0 -12
- package/lib/types/graph/log/GraphRunLogger.d.cts +0 -76
- package/lib/types/graph/log/GraphRunLogger.d.mts +0 -76
- package/lib/types/graph/log/LogParameters.d.cts +0 -7
- package/lib/types/graph/log/LogParameters.d.mts +0 -7
- package/lib/types/nest/graph/GraphExecutionController.d.cts +0 -110
- package/lib/types/nest/graph/GraphExecutionController.d.mts +0 -110
- package/lib/types/nest/graph/GraphExecutionModule.d.cts +0 -83
- package/lib/types/nest/graph/GraphExecutionModule.d.mts +0 -83
- package/lib/types/nest/graph/GraphExecutionResultModel.d.cts +0 -24
- package/lib/types/nest/graph/GraphExecutionResultModel.d.mts +0 -24
- package/lib/types/nest/graph/GraphExecutorRegistryFactory.d.cts +0 -66
- package/lib/types/nest/graph/GraphExecutorRegistryFactory.d.mts +0 -66
- package/lib/types/nest/graph/GraphNodeCatalogueController.d.cts +0 -70
- package/lib/types/nest/graph/GraphNodeCatalogueController.d.mts +0 -70
- package/lib/types/nest/graph/GraphResultService.d.cts +0 -20
- package/lib/types/nest/graph/GraphResultService.d.mts +0 -20
- package/lib/types/nest/graph/GraphRunController.d.cts +0 -87
- package/lib/types/nest/graph/GraphRunController.d.mts +0 -87
- package/lib/types/nest/graph/GraphRunModel.d.cts +0 -22
- package/lib/types/nest/graph/GraphRunModel.d.mts +0 -22
- package/lib/types/nest/graph/GraphRunModelService.d.cts +0 -21
- package/lib/types/nest/graph/GraphRunModelService.d.mts +0 -21
- package/lib/types/nest/graph/GraphWorkflowBoundaryValidation.d.cts +0 -28
- package/lib/types/nest/graph/GraphWorkflowBoundaryValidation.d.mts +0 -28
- package/lib/types/nest/graph/GraphWorkflowController.d.cts +0 -62
- package/lib/types/nest/graph/GraphWorkflowController.d.mts +0 -62
- package/lib/types/nest/graph/GraphWorkflowDocumentLimits.d.cts +0 -33
- package/lib/types/nest/graph/GraphWorkflowDocumentLimits.d.mts +0 -33
- package/lib/types/nest/graph/GraphWorkflowErrors.d.cts +0 -13
- package/lib/types/nest/graph/GraphWorkflowErrors.d.mts +0 -13
- package/lib/types/nest/graph/GraphWorkflowModel.d.cts +0 -24
- package/lib/types/nest/graph/GraphWorkflowModel.d.mts +0 -24
- package/lib/types/nest/graph/GraphWorkflowService.d.cts +0 -54
- package/lib/types/nest/graph/GraphWorkflowService.d.mts +0 -54
- package/lib/types/nest/graph/index.d.cts +0 -15
- package/lib/types/nest/graph/index.d.mts +0 -15
- package/lib/types/nest/graph/main.d.cts +0 -1
- package/lib/types/nest/graph/main.d.mts +0 -1
- /package/lib/cjs/{graph/engine/runs → redis}/types.cjs +0 -0
- /package/lib/esm/{graph/engine/runs → redis}/types.js +0 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import { UnsupportedError } from "@decaf-ts/core";
|
|
2
|
+
import { ValidationError } from "@decaf-ts/db-decorators";
|
|
3
|
+
import { ObjectLoader } from "./ObjectLoader.js";
|
|
4
|
+
/**
|
|
5
|
+
* @module integrations/loader/nest
|
|
6
|
+
* @summary Lazy NestJS loaders.
|
|
7
|
+
* @description Resolves NestJS controller classes and their route definitions
|
|
8
|
+
* from dynamically loaded modules. `@nestjs/common` and `reflect-metadata` are
|
|
9
|
+
* optional at runtime: both are dynamically imported/checked and the loaders
|
|
10
|
+
* degrade with a decaf {@link UnsupportedError} when they are unavailable.
|
|
11
|
+
*
|
|
12
|
+
* ## Tree-shaking
|
|
13
|
+
* The NestJS runtime is imported through a non-literal specifier so bundlers keep
|
|
14
|
+
* it as a runtime import and never inline it into the loader chunk. Nest
|
|
15
|
+
* applications already keep `@nestjs/common` in their entry graph, so the loader
|
|
16
|
+
* does not need a static reference of its own.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Stable NestJS metadata keys. Declared as literals so this module never
|
|
20
|
+
* hard-depends on `@nestjs/common/constants` (a CommonJS-only subpath).
|
|
21
|
+
*/
|
|
22
|
+
export const NEST_PATH_METADATA = "path";
|
|
23
|
+
export const NEST_METHOD_METADATA = "method";
|
|
24
|
+
export const NEST_CONTROLLER_WATERMARK = "__controller__";
|
|
25
|
+
export const NEST_MODULE_CONTROLLERS = "controllers";
|
|
26
|
+
export const NEST_MODULE_IMPORTS = "imports";
|
|
27
|
+
const NEST_COMMON_SPECIFIER = "@nestjs/common";
|
|
28
|
+
const HTTP_METHOD_NAMES = {
|
|
29
|
+
0: "GET",
|
|
30
|
+
1: "POST",
|
|
31
|
+
2: "PUT",
|
|
32
|
+
3: "DELETE",
|
|
33
|
+
4: "PATCH",
|
|
34
|
+
5: "ALL",
|
|
35
|
+
6: "OPTIONS",
|
|
36
|
+
7: "HEAD",
|
|
37
|
+
8: "SEARCH",
|
|
38
|
+
9: "PROPFIND",
|
|
39
|
+
10: "PROPPATCH",
|
|
40
|
+
11: "MKCOL",
|
|
41
|
+
12: "COPY",
|
|
42
|
+
13: "MOVE",
|
|
43
|
+
14: "LOCK",
|
|
44
|
+
15: "UNLOCK",
|
|
45
|
+
16: "QUERY",
|
|
46
|
+
};
|
|
47
|
+
let nestCommonPromise;
|
|
48
|
+
/**
|
|
49
|
+
* @summary Lazily resolve the NestJS runtime.
|
|
50
|
+
* @description Uses a non-literal dynamic import so bundlers do not inline or
|
|
51
|
+
* drop `@nestjs/common`. Throws a decaf {@link UnsupportedError} when the
|
|
52
|
+
* package cannot be resolved.
|
|
53
|
+
*/
|
|
54
|
+
export async function loadNestCommon() {
|
|
55
|
+
if (!nestCommonPromise) {
|
|
56
|
+
nestCommonPromise = import(/* @vite-ignore */ NEST_COMMON_SPECIFIER)
|
|
57
|
+
.then((module) => {
|
|
58
|
+
const resolved = module;
|
|
59
|
+
if (typeof resolved.Controller !== "function") {
|
|
60
|
+
throw new UnsupportedError(`NestJS integration is not available: "${NEST_COMMON_SPECIFIER}" does not expose the expected exports.`);
|
|
61
|
+
}
|
|
62
|
+
return resolved;
|
|
63
|
+
})
|
|
64
|
+
.catch((error) => {
|
|
65
|
+
nestCommonPromise = undefined;
|
|
66
|
+
if (error instanceof UnsupportedError)
|
|
67
|
+
throw error;
|
|
68
|
+
throw new UnsupportedError(`NestJS integration is not available: "${NEST_COMMON_SPECIFIER}" could not be resolved. ` +
|
|
69
|
+
`Install @nestjs/common and reflect-metadata to use the Nest loaders. ` +
|
|
70
|
+
`Cause: ${error?.message ?? String(error)}`);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return nestCommonPromise;
|
|
74
|
+
}
|
|
75
|
+
function metadataReader() {
|
|
76
|
+
const reflect = Reflect;
|
|
77
|
+
if (typeof reflect.getMetadata !== "function") {
|
|
78
|
+
throw new UnsupportedError("NestJS metadata is not available: reflect-metadata must be loaded before using the Nest loaders.");
|
|
79
|
+
}
|
|
80
|
+
return reflect;
|
|
81
|
+
}
|
|
82
|
+
function methodNameFor(method) {
|
|
83
|
+
return HTTP_METHOD_NAMES[method] ?? `METHOD_${method}`;
|
|
84
|
+
}
|
|
85
|
+
function normalizeSegment(segment) {
|
|
86
|
+
return segment.replace(/^\/+|\/+$/g, "");
|
|
87
|
+
}
|
|
88
|
+
function joinRoutePaths(controllerPath, routePath) {
|
|
89
|
+
const segments = [controllerPath, routePath]
|
|
90
|
+
.filter((value) => typeof value === "string")
|
|
91
|
+
.map(normalizeSegment)
|
|
92
|
+
.filter(Boolean);
|
|
93
|
+
return `/${segments.join("/")}`;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* @summary Resolve NestJS controller classes from dynamically loaded modules.
|
|
97
|
+
* @description Extends the generic controller family with NestJS metadata
|
|
98
|
+
* awareness. Requires `@nestjs/common` and `reflect-metadata` at runtime.
|
|
99
|
+
*/
|
|
100
|
+
export class NestControllerObjectLoader extends ObjectLoader {
|
|
101
|
+
constructor(options = {}) {
|
|
102
|
+
super({ ...options, family: "controller" });
|
|
103
|
+
}
|
|
104
|
+
async loadController(source, exportName = this.defaultExportName, options = {}) {
|
|
105
|
+
await loadNestCommon();
|
|
106
|
+
const value = await this.loadExport(source, exportName, options);
|
|
107
|
+
return this.assertController(value, this.normalizeSource(source), exportName);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @summary Load every controller exported by a module.
|
|
111
|
+
*/
|
|
112
|
+
async loadControllers(source, options = {}) {
|
|
113
|
+
await loadNestCommon();
|
|
114
|
+
const module = await this.loadModule(source);
|
|
115
|
+
const controllers = this.collectControllers(module, options.recursive);
|
|
116
|
+
const context = this.createContext(this.normalizeSource(source), "*", module, "afterResolve", {
|
|
117
|
+
...this.metadata,
|
|
118
|
+
...(options.metadata ?? {}),
|
|
119
|
+
controllerCount: controllers.length,
|
|
120
|
+
});
|
|
121
|
+
return this.runHooks(controllers, context, options);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* @summary Scan a NestJS module (or namespace) for controller classes.
|
|
125
|
+
* @description Synchronous metadata scan. Requires `reflect-metadata` but not
|
|
126
|
+
* `@nestjs/common`; call {@link loadNestCommon} first when the module must be
|
|
127
|
+
* imported.
|
|
128
|
+
*/
|
|
129
|
+
collectControllers(value, recursive = true) {
|
|
130
|
+
const result = [];
|
|
131
|
+
const seen = new Set();
|
|
132
|
+
this.scanControllers(value, result, seen, recursive);
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
isController(value) {
|
|
136
|
+
if (typeof value !== "function")
|
|
137
|
+
return false;
|
|
138
|
+
const reader = metadataReader();
|
|
139
|
+
return (reader.getMetadata(NEST_CONTROLLER_WATERMARK, value) === true ||
|
|
140
|
+
typeof reader.getMetadata(NEST_PATH_METADATA, value) !== "undefined");
|
|
141
|
+
}
|
|
142
|
+
getControllerPath(controller) {
|
|
143
|
+
const value = metadataReader().getMetadata(NEST_PATH_METADATA, controller);
|
|
144
|
+
return typeof value === "string" ? value : undefined;
|
|
145
|
+
}
|
|
146
|
+
assertController(value, source, exportName) {
|
|
147
|
+
if (!this.isController(value)) {
|
|
148
|
+
throw new ValidationError(`Loaded controller export "${exportName}" from "${source}" is not a NestJS controller.`);
|
|
149
|
+
}
|
|
150
|
+
return value;
|
|
151
|
+
}
|
|
152
|
+
scanControllers(value, result, seen, recursive) {
|
|
153
|
+
if (value === null || typeof value !== "object") {
|
|
154
|
+
if (this.isController(value) && !result.includes(value)) {
|
|
155
|
+
result.push(value);
|
|
156
|
+
}
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (seen.has(value))
|
|
160
|
+
return;
|
|
161
|
+
seen.add(value);
|
|
162
|
+
const record = value;
|
|
163
|
+
const controllers = record[NEST_MODULE_CONTROLLERS];
|
|
164
|
+
if (Array.isArray(controllers)) {
|
|
165
|
+
for (const controller of controllers) {
|
|
166
|
+
if (this.isController(controller) &&
|
|
167
|
+
!result.includes(controller)) {
|
|
168
|
+
result.push(controller);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (recursive) {
|
|
173
|
+
const imports = record[NEST_MODULE_IMPORTS];
|
|
174
|
+
if (Array.isArray(imports)) {
|
|
175
|
+
for (const imported of imports) {
|
|
176
|
+
if (imported &&
|
|
177
|
+
typeof imported.then === "function") {
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
this.scanControllers(imported, result, seen, recursive);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
for (const key of Object.keys(record)) {
|
|
185
|
+
const candidate = record[key];
|
|
186
|
+
if (this.isController(candidate) && !result.includes(candidate)) {
|
|
187
|
+
result.push(candidate);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* @summary Resolve route definitions from dynamically loaded NestJS modules.
|
|
194
|
+
*/
|
|
195
|
+
export class NestRouteObjectLoader extends ObjectLoader {
|
|
196
|
+
constructor(options = {}) {
|
|
197
|
+
super({ ...options, family: "route" });
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* @summary Load every route declared by a controller exported from a module.
|
|
201
|
+
*/
|
|
202
|
+
async loadControllerRoutes(source, exportName = this.defaultExportName, options = {}) {
|
|
203
|
+
await loadNestCommon();
|
|
204
|
+
const value = await this.loadExport(source, exportName, options);
|
|
205
|
+
const controller = this.assertController(value, this.normalizeSource(source), exportName);
|
|
206
|
+
const routes = this.getRoutes(controller);
|
|
207
|
+
const context = this.createContext(this.normalizeSource(source), exportName, {}, "afterResolve", {
|
|
208
|
+
...this.metadata,
|
|
209
|
+
...(options.metadata ?? {}),
|
|
210
|
+
routeCount: routes.length,
|
|
211
|
+
});
|
|
212
|
+
return this.runHooks(routes, context, options);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* @summary Load every route declared by every controller in a module.
|
|
216
|
+
*/
|
|
217
|
+
async loadRoutes(source, options = {}) {
|
|
218
|
+
await loadNestCommon();
|
|
219
|
+
const module = await this.loadModule(source);
|
|
220
|
+
const controllerLoader = new NestControllerObjectLoader({
|
|
221
|
+
hooks: this.hooks,
|
|
222
|
+
beforeResolveHooks: this.beforeResolveHooks,
|
|
223
|
+
});
|
|
224
|
+
const controllers = controllerLoader.collectControllers(module);
|
|
225
|
+
const routes = [];
|
|
226
|
+
for (const controller of controllers) {
|
|
227
|
+
routes.push(...this.getRoutes(controller));
|
|
228
|
+
}
|
|
229
|
+
const context = this.createContext(this.normalizeSource(source), "*", module, "afterResolve", {
|
|
230
|
+
...this.metadata,
|
|
231
|
+
...(options.metadata ?? {}),
|
|
232
|
+
routeCount: routes.length,
|
|
233
|
+
});
|
|
234
|
+
return this.runHooks(routes, context, options);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* @summary Extract route definitions from a controller class.
|
|
238
|
+
* @description Synchronous metadata scan. Requires `reflect-metadata`.
|
|
239
|
+
*/
|
|
240
|
+
getRoutes(controller, controllerPath) {
|
|
241
|
+
const reader = metadataReader();
|
|
242
|
+
const resolvedControllerPath = controllerPath ?? this.getControllerPath(controller);
|
|
243
|
+
const prototype = controller.prototype;
|
|
244
|
+
const keys = [
|
|
245
|
+
...Object.getOwnPropertyNames(prototype),
|
|
246
|
+
...Object.getOwnPropertySymbols(prototype),
|
|
247
|
+
];
|
|
248
|
+
const routes = [];
|
|
249
|
+
for (const propertyKey of keys) {
|
|
250
|
+
if (propertyKey === "constructor")
|
|
251
|
+
continue;
|
|
252
|
+
const handler = prototype[propertyKey];
|
|
253
|
+
if (typeof handler !== "function")
|
|
254
|
+
continue;
|
|
255
|
+
const method = reader.getMetadata(NEST_METHOD_METADATA, handler);
|
|
256
|
+
if (typeof method !== "number")
|
|
257
|
+
continue;
|
|
258
|
+
const routePath = reader.getMetadata(NEST_PATH_METADATA, handler);
|
|
259
|
+
const path = typeof routePath === "string" ? routePath : "";
|
|
260
|
+
routes.push({
|
|
261
|
+
controller,
|
|
262
|
+
controllerName: controller.name,
|
|
263
|
+
controllerPath: resolvedControllerPath || undefined,
|
|
264
|
+
propertyKey,
|
|
265
|
+
handler: handler,
|
|
266
|
+
method,
|
|
267
|
+
methodName: methodNameFor(method),
|
|
268
|
+
path,
|
|
269
|
+
fullPath: joinRoutePaths(resolvedControllerPath, path),
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
return routes;
|
|
273
|
+
}
|
|
274
|
+
isController(value) {
|
|
275
|
+
if (typeof value !== "function")
|
|
276
|
+
return false;
|
|
277
|
+
const reader = metadataReader();
|
|
278
|
+
return (reader.getMetadata(NEST_CONTROLLER_WATERMARK, value) === true ||
|
|
279
|
+
typeof reader.getMetadata(NEST_PATH_METADATA, value) !== "undefined");
|
|
280
|
+
}
|
|
281
|
+
getControllerPath(controller) {
|
|
282
|
+
const value = metadataReader().getMetadata(NEST_PATH_METADATA, controller);
|
|
283
|
+
return typeof value === "string" ? value : undefined;
|
|
284
|
+
}
|
|
285
|
+
assertController(value, source, exportName) {
|
|
286
|
+
if (!this.isController(value)) {
|
|
287
|
+
throw new ValidationError(`Loaded controller export "${exportName}" from "${source}" is not a NestJS controller.`);
|
|
288
|
+
}
|
|
289
|
+
return value;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
//# sourceMappingURL=nest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nest.js","sourceRoot":"","sources":["../../../src/loader/nest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,0BAAuB;AAO9C;;;;;;;;;;;;;GAaG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AACzC,MAAM,CAAC,MAAM,oBAAoB,GAAG,QAAQ,CAAC;AAC7C,MAAM,CAAC,MAAM,yBAAyB,GAAG,gBAAgB,CAAC;AAC1D,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAC;AACrD,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC;AAE7C,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AAE/C,MAAM,iBAAiB,GAA2B;IAChD,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,OAAO;IACV,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,SAAS;IACZ,CAAC,EAAE,MAAM;IACT,CAAC,EAAE,QAAQ;IACX,CAAC,EAAE,UAAU;IACb,EAAE,EAAE,WAAW;IACf,EAAE,EAAE,OAAO;IACX,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,MAAM;IACV,EAAE,EAAE,QAAQ;IACZ,EAAE,EAAE,OAAO;CACZ,CAAC;AAMF,IAAI,iBAAyE,CAAC;AAE9E;;;;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AC,KAAK,IAAI;YAC7D,OAAO,MAAM,CAAC,WAAW,CAAC,kBAAkB,EAAE,KAAK,CAAC,KAAK,WAAW,CACrE,CAAC;IACJ,CAAC;IAEM,iBAAiB,CAAC,UAAuB;QAC9C,MAAM,KAAK,GAAG,cAAc,EAAE,CAAC,WAAW,CAAC,kBAAkB,EAAE,UAAU,CAAC,CAAC;QAC3E,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACvD,CAAC;IAES,gBAAgB,CACxB,KAAc,EACd,MAAc,EACd,UAAkB;QAElB,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,eAAe,CACvB,6BAA6B,UAAU,WAAW,MAAM,+BAA+B,CACxF,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { ContextLock } from "@decaf-ts/core";
|
|
2
|
+
import { ConflictError } from "@decaf-ts/db-decorators";
|
|
3
|
+
import { WatchError } from "redis";
|
|
4
|
+
/**
|
|
5
|
+
* @description Redis-native transaction lock for the Redis adapter
|
|
6
|
+
* @summary Backs `@transactional()` with a dedicated Redis connection carrying a
|
|
7
|
+
* native `MULTI` command queue plus an in-memory read cache. Every CRUD write
|
|
8
|
+
* performed under an active transaction is queued on the native `MULTI` object and
|
|
9
|
+
* mirrored into the read cache, so the transaction observes its own writes
|
|
10
|
+
* (read-your-writes) while remaining invisible to every other connection until
|
|
11
|
+
* {@link RedisContextLock.commit} issues `WATCH` and `EXEC`. If a watched table
|
|
12
|
+
* changed concurrently, `EXEC` aborts and the transaction raises a
|
|
13
|
+
* `ConflictError` instead of silently overwriting the concurrent write.
|
|
14
|
+
*
|
|
15
|
+
* A dedicated connection is required: `WATCH` is per-connection state on the
|
|
16
|
+
* node-redis client, so a `WATCH` issued on the shared, multiplexed adapter
|
|
17
|
+
* client would be cleared or replaced by any concurrent adapter operation (and a
|
|
18
|
+
* concurrent write to a watched key would abort an unrelated transaction).
|
|
19
|
+
* @class RedisContextLock
|
|
20
|
+
* @category Redis
|
|
21
|
+
*/
|
|
22
|
+
export class RedisContextLock extends ContextLock {
|
|
23
|
+
constructor() {
|
|
24
|
+
super(...arguments);
|
|
25
|
+
this.readCache = new Map();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @description Whether a Redis transaction is currently open
|
|
29
|
+
* @return {boolean} True while a transaction is active
|
|
30
|
+
*/
|
|
31
|
+
get active() {
|
|
32
|
+
return !!this.txClient;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @description Returns the buffered entry for a record, when present
|
|
36
|
+
* @param {string} table - The table (model) name
|
|
37
|
+
* @param {string} id - The record id
|
|
38
|
+
* @return {{found: boolean, value?: RedisBufferedValue}} The buffered entry state
|
|
39
|
+
*/
|
|
40
|
+
getRecord(table, id) {
|
|
41
|
+
const entries = this.readCache.get(table);
|
|
42
|
+
if (!entries || !entries.has(id))
|
|
43
|
+
return { found: false };
|
|
44
|
+
return { found: true, value: entries.get(id) };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @description Queues a serialized record on the native transaction and buffers it for reads
|
|
48
|
+
* @param {string} table - The table (model) name
|
|
49
|
+
* @param {string} id - The record id
|
|
50
|
+
* @param {string} value - The serialized record
|
|
51
|
+
* @return {void}
|
|
52
|
+
*/
|
|
53
|
+
setRecord(table, id, value) {
|
|
54
|
+
let entries = this.readCache.get(table);
|
|
55
|
+
if (!entries) {
|
|
56
|
+
entries = new Map();
|
|
57
|
+
this.readCache.set(table, entries);
|
|
58
|
+
}
|
|
59
|
+
entries.set(id, value);
|
|
60
|
+
if (!this.multi)
|
|
61
|
+
return;
|
|
62
|
+
const key = this.adapter.recordKey(table);
|
|
63
|
+
if (value === null)
|
|
64
|
+
this.multi.hDel(key, id);
|
|
65
|
+
else
|
|
66
|
+
this.multi.hSet(key, id, value);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @description Queues a record deletion on the native transaction and buffers it
|
|
70
|
+
* @param {string} table - The table (model) name
|
|
71
|
+
* @param {string} id - The record id
|
|
72
|
+
* @return {void}
|
|
73
|
+
*/
|
|
74
|
+
deleteRecord(table, id) {
|
|
75
|
+
this.setRecord(table, id, null);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @description Returns the buffered writes for a table, when any exist
|
|
79
|
+
* @param {string} table - The table (model) name
|
|
80
|
+
* @return {Map<string, RedisBufferedValue> | undefined} The buffered entries
|
|
81
|
+
*/
|
|
82
|
+
tableEntries(table) {
|
|
83
|
+
return this.readCache.get(table);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* @description Starts the transaction, opening a dedicated connection and native queue
|
|
87
|
+
* @summary Delegates to the base implementation so `maxConcurrentTransactions`
|
|
88
|
+
* continues to gate concurrency, then opens a dedicated connection and its native
|
|
89
|
+
* `MULTI` command queue.
|
|
90
|
+
* @param {Context<any>} context - The context the transaction is starting under
|
|
91
|
+
* @return {Promise<void>} A promise that resolves once the transaction is open
|
|
92
|
+
*/
|
|
93
|
+
async begin(context) {
|
|
94
|
+
await super.begin(context);
|
|
95
|
+
try {
|
|
96
|
+
const client = this.adapter.client.duplicate();
|
|
97
|
+
await client.connect();
|
|
98
|
+
this.txClient = client;
|
|
99
|
+
this.multi = this.txClient.multi();
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
await super.rollback(e, context);
|
|
103
|
+
throw e;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* @description Flushes the queued writes atomically and ends the transaction
|
|
108
|
+
* @summary `WATCH`es every touched table on the dedicated connection, then runs
|
|
109
|
+
* the native `MULTI` queue with `EXEC`. If a watched table changed concurrently,
|
|
110
|
+
* `EXEC` aborts with a `WatchError` and the transaction raises a
|
|
111
|
+
* `ConflictError`. On success (or conflict) the dedicated connection is released
|
|
112
|
+
* and the concurrency permit returned.
|
|
113
|
+
* @param {Context<any>} context - The context the transaction ran under
|
|
114
|
+
* @return {Promise<void>} A promise that resolves once the transaction ends
|
|
115
|
+
*/
|
|
116
|
+
async commit(context) {
|
|
117
|
+
if (!this.txClient || !this.multi) {
|
|
118
|
+
await super.commit(context);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const watched = [...this.readCache.keys()].map((table) => this.adapter.recordKey(table));
|
|
122
|
+
try {
|
|
123
|
+
if (watched.length)
|
|
124
|
+
await this.txClient.watch(watched);
|
|
125
|
+
await this.multi.exec();
|
|
126
|
+
}
|
|
127
|
+
catch (e) {
|
|
128
|
+
if (e instanceof WatchError)
|
|
129
|
+
throw new ConflictError("Redis transaction aborted: a watched record changed concurrently");
|
|
130
|
+
throw e;
|
|
131
|
+
}
|
|
132
|
+
finally {
|
|
133
|
+
await this.releaseTx();
|
|
134
|
+
await super.commit(context);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* @description Discards the queued writes and ends the transaction
|
|
139
|
+
* @param {Error} err - The error that triggered the rollback
|
|
140
|
+
* @param {Context<any>} context - The context the transaction ran under
|
|
141
|
+
* @return {Promise<void>} A promise that resolves once the transaction ends
|
|
142
|
+
*/
|
|
143
|
+
async rollback(err, context) {
|
|
144
|
+
await this.releaseTx();
|
|
145
|
+
await super.rollback(err, context);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* @description Releases the dedicated transaction connection and clears state
|
|
149
|
+
* @summary Unwatches and closes the dedicated connection, then clears the native
|
|
150
|
+
* queue and read cache so queued writes are never applied after rollback or after
|
|
151
|
+
* an already flushed commit.
|
|
152
|
+
* @return {Promise<void>} A promise that resolves once the connection is released
|
|
153
|
+
*/
|
|
154
|
+
async releaseTx() {
|
|
155
|
+
const client = this.txClient;
|
|
156
|
+
this.txClient = undefined;
|
|
157
|
+
this.multi = undefined;
|
|
158
|
+
this.readCache.clear();
|
|
159
|
+
if (!client)
|
|
160
|
+
return;
|
|
161
|
+
try {
|
|
162
|
+
await client.unwatch();
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
// the connection may already be gone; nothing left to unwatch
|
|
166
|
+
}
|
|
167
|
+
try {
|
|
168
|
+
await client.quit();
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
try {
|
|
172
|
+
client.destroy();
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
// connection already closed
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=RedisContextLock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedisContextLock.js","sourceRoot":"","sources":["../../../src/redis/RedisContextLock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAwB,MAAM,OAAO,CAAC;AAYzD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,gBAEX,SAAQ,WAAc;IAFxB;;QAKU,cAAS,GAAG,IAAI,GAAG,EAA2C,CAAC;IAkKzE,CAAC;IAhKC;;;OAGG;IACH,IAAI,MAAM;QACR,OAAO,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACH,SAAS,CACP,KAAa,EACb,EAAU;QAEV,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;QAC1D,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,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C,SAAS,EAAE,CAAC;QACvB,MAAM,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC;IAED;;;;;;OAMG;IACK,KAAK,CAAC,SAAS;QACrB,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QACzB,CAAC;QAAC,MAAM,CAAC;YACP,8DAA8D;QAChE,CAAC;QACD,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;QAAC,MAAM,CAAC;YACP,IAAI,CAAC;gBACH,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,CAAC;YAAC,MAAM,CAAC;gBACP,4BAA4B;YAC9B,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Dispatch } from "@decaf-ts/core";
|
|
2
|
+
import { OperationKeys } from "@decaf-ts/db-decorators";
|
|
3
|
+
import { Model } from "@decaf-ts/decorator-validation";
|
|
4
|
+
import { randomUUID } from "crypto";
|
|
5
|
+
import { RedisEventsChannel } from "./constants.js";
|
|
6
|
+
/**
|
|
7
|
+
* @description Dispatcher for Redis change events
|
|
8
|
+
* @summary Extends the core `Dispatch` to broadcast record changes over Redis
|
|
9
|
+
* pub/sub so that every process sharing the same database refreshes its observers.
|
|
10
|
+
* Local observer updates are still performed synchronously through the base class;
|
|
11
|
+
* the published message carries an `origin` id so a process ignores the echo of its
|
|
12
|
+
* own events and never notifies its observers twice.
|
|
13
|
+
* @class RedisDispatch
|
|
14
|
+
* @category Redis
|
|
15
|
+
*/
|
|
16
|
+
export class RedisDispatch extends Dispatch {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.origin = randomUUID();
|
|
20
|
+
/**
|
|
21
|
+
* @description Whether the pub/sub subscription is currently active
|
|
22
|
+
*/
|
|
23
|
+
this.active = false;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @description Initializes the dispatcher and opens the pub/sub subscription
|
|
27
|
+
* @summary Proxies the adapter's CRUD methods through the base implementation,
|
|
28
|
+
* then opens a dedicated subscriber connection listening for change events.
|
|
29
|
+
* @param {...ContextualArgs} args - Contextual arguments
|
|
30
|
+
* @return {Promise<void>} A promise that resolves once initialization is complete
|
|
31
|
+
*/
|
|
32
|
+
async initialize(...args) {
|
|
33
|
+
await super.initialize(...args);
|
|
34
|
+
if (!this.adapter)
|
|
35
|
+
return;
|
|
36
|
+
try {
|
|
37
|
+
const subscriber = this.adapter.client.duplicate();
|
|
38
|
+
await subscriber.connect();
|
|
39
|
+
await subscriber.subscribe(RedisEventsChannel, (message) => void this.changeHandler(message));
|
|
40
|
+
this.subscriber = subscriber;
|
|
41
|
+
this.active = true;
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
this.log
|
|
45
|
+
.for(this.initialize)
|
|
46
|
+
.error(`Failed to subscribe to Redis change events: ${e}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @description Closes the dispatcher and releases the pub/sub subscription
|
|
51
|
+
* @param {...ContextualArgs} args - Contextual arguments
|
|
52
|
+
* @return {Promise<void>} A promise that resolves once the dispatcher is closed
|
|
53
|
+
*/
|
|
54
|
+
async close(...args) {
|
|
55
|
+
this.active = false;
|
|
56
|
+
const subscriber = this.subscriber;
|
|
57
|
+
this.subscriber = undefined;
|
|
58
|
+
if (subscriber) {
|
|
59
|
+
try {
|
|
60
|
+
await subscriber.unsubscribe(RedisEventsChannel);
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
this.log
|
|
64
|
+
.for(this.close)
|
|
65
|
+
.error(`Failed to unsubscribe from Redis change events: ${e}`);
|
|
66
|
+
}
|
|
67
|
+
try {
|
|
68
|
+
await subscriber.quit();
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
this.log
|
|
72
|
+
.for(this.close)
|
|
73
|
+
.error(`Failed to close Redis change subscriber: ${e}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return super.close(...args);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @description Notifies local observers and broadcasts the event to other processes
|
|
80
|
+
* @summary Performs the base local refresh, then publishes the change to the
|
|
81
|
+
* Redis pub/sub channel. Remote processes receive the event and refresh their own
|
|
82
|
+
* observers; the originating process ignores its own message.
|
|
83
|
+
* @param {Constructor<any> | string} model - The model (or table name) that changed
|
|
84
|
+
* @param {OperationKeys | BulkCrudOperationKeys | string} event - The operation that occurred
|
|
85
|
+
* @param {any} id - The identifier(s) of the affected record(s)
|
|
86
|
+
* @param {...ContextualArgs} args - Contextual arguments
|
|
87
|
+
* @return {Promise<void>} A promise that resolves once observers are notified
|
|
88
|
+
*/
|
|
89
|
+
async updateObservers(model, event, id, ...args) {
|
|
90
|
+
await super.updateObservers(model, event, id, ...args);
|
|
91
|
+
if (!this.adapter)
|
|
92
|
+
return;
|
|
93
|
+
const table = model && typeof model === "string" ? model : Model.tableName(model);
|
|
94
|
+
try {
|
|
95
|
+
await this.adapter.client.publish(RedisEventsChannel, JSON.stringify({ origin: this.origin, table, event: String(event), id }));
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
this.log
|
|
99
|
+
.for(this.updateObservers)
|
|
100
|
+
.error(`Failed to publish Redis change event: ${e}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* @description Handles an incoming Redis change event
|
|
105
|
+
* @summary Ignores the echo of locally published events and refreshes the
|
|
106
|
+
* observers of this process for events published elsewhere.
|
|
107
|
+
* @param {string} message - The raw JSON pub/sub payload
|
|
108
|
+
* @return {Promise<void>} A promise that resolves once observers are notified
|
|
109
|
+
*/
|
|
110
|
+
async changeHandler(message) {
|
|
111
|
+
try {
|
|
112
|
+
const parsed = JSON.parse(message);
|
|
113
|
+
if (parsed.origin === this.origin)
|
|
114
|
+
return;
|
|
115
|
+
if (!this.adapter)
|
|
116
|
+
return;
|
|
117
|
+
const ctx = await this.adapter.context(OperationKeys.UPDATE, {}, Model);
|
|
118
|
+
await super.updateObservers(parsed.table, parsed.event, parsed.id, ctx);
|
|
119
|
+
}
|
|
120
|
+
catch (e) {
|
|
121
|
+
this.log
|
|
122
|
+
.for(this.changeHandler)
|
|
123
|
+
.error(`Failed to process Redis change event: ${e}`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=RedisDispatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RedisDispatch.js","sourceRoot":"","sources":["../../../src/redis/RedisDispatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAyB,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,uBAAoB;AAIjD;;;;;;;;;GASG;AACH,MAAM,OAAO,aAAc,SAAQ,QAAsB;IAAzD;;QAEmB,WAAM,GAAG,UAAU,EAAE,CAAC;QAEvC;;WAEG;QACI,WAAM,GAAG,KAAK,CAAC;IAyHxB,CAAC;IAvHC;;;;;;OAMG;IACgB,KAAK,CAAC,UAAU,CACjC,GAAG,IAAkC;QAErC,MAAM,KAAK,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,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