@ductape/sdk 0.0.4-v51 → 0.0.4-v53
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 +1 -1
- package/dist/agents/agent-context.d.ts +98 -0
- package/dist/agents/agent-context.js +588 -0
- package/dist/agents/agent-context.js.map +1 -0
- package/dist/agents/agent-executor.d.ts +180 -0
- package/dist/agents/agent-executor.js +715 -0
- package/dist/agents/agent-executor.js.map +1 -0
- package/dist/agents/agents.service.d.ts +304 -0
- package/dist/agents/agents.service.js +1244 -0
- package/dist/agents/agents.service.js.map +1 -0
- package/dist/agents/index.d.ts +55 -0
- package/dist/agents/index.js +110 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/memory-manager.d.ts +182 -0
- package/dist/agents/memory-manager.js +383 -0
- package/dist/agents/memory-manager.js.map +1 -0
- package/dist/agents/tool-registry.d.ts +141 -0
- package/dist/agents/tool-registry.js +355 -0
- package/dist/agents/tool-registry.js.map +1 -0
- package/dist/agents/types/agents.types.d.ts +1225 -0
- package/dist/agents/types/agents.types.js +12 -0
- package/dist/agents/types/agents.types.js.map +1 -0
- package/dist/agents/types/index.d.ts +6 -0
- package/dist/agents/types/index.js +23 -0
- package/dist/agents/types/index.js.map +1 -0
- package/dist/agents/vector-store-adapter.d.ts +108 -0
- package/dist/agents/vector-store-adapter.js +213 -0
- package/dist/agents/vector-store-adapter.js.map +1 -0
- package/dist/api/services/appApi.service.js +4 -5
- package/dist/api/services/appApi.service.js.map +1 -1
- package/dist/api/services/processorApi.service.d.ts +322 -0
- package/dist/api/services/processorApi.service.js +252 -0
- package/dist/api/services/processorApi.service.js.map +1 -1
- package/dist/api/services/productsApi.service.d.ts +69 -1
- package/dist/api/services/productsApi.service.js +67 -31
- package/dist/api/services/productsApi.service.js.map +1 -1
- package/dist/api/services/resilienceApi.service.d.ts +106 -0
- package/dist/api/services/resilienceApi.service.js +224 -0
- package/dist/api/services/resilienceApi.service.js.map +1 -0
- package/dist/api/services/secretsApi.service.d.ts +38 -0
- package/dist/api/services/secretsApi.service.js +96 -0
- package/dist/api/services/secretsApi.service.js.map +1 -0
- package/dist/api/services/userApi.service.js +0 -1
- package/dist/api/services/userApi.service.js.map +1 -1
- package/dist/api/services/workflowApi.service.d.ts +199 -0
- package/dist/api/services/workflowApi.service.js +183 -0
- package/dist/api/services/workflowApi.service.js.map +1 -0
- package/dist/api/services/workspaceApi.service.js +0 -1
- package/dist/api/services/workspaceApi.service.js.map +1 -1
- package/dist/api/urls.d.ts +57 -0
- package/dist/api/urls.js +68 -1
- package/dist/api/urls.js.map +1 -1
- package/dist/api/utils/cache.utils.js +4 -10
- package/dist/api/utils/cache.utils.js.map +1 -1
- package/dist/apps/services/app.service.d.ts +0 -10
- package/dist/apps/services/app.service.js +74 -30
- package/dist/apps/services/app.service.js.map +1 -1
- package/dist/apps/utils/auth-context-manager.d.ts +137 -0
- package/dist/apps/utils/auth-context-manager.js +248 -0
- package/dist/apps/utils/auth-context-manager.js.map +1 -0
- package/dist/apps/utils/credential-manager.d.ts +128 -0
- package/dist/apps/utils/credential-manager.js +199 -0
- package/dist/apps/utils/credential-manager.js.map +1 -0
- package/dist/apps/utils/index.d.ts +10 -0
- package/dist/apps/utils/index.js +54 -0
- package/dist/apps/utils/index.js.map +1 -0
- package/dist/apps/utils/input-helpers.d.ts +67 -0
- package/dist/apps/utils/input-helpers.js +185 -0
- package/dist/apps/utils/input-helpers.js.map +1 -0
- package/dist/apps/utils/input-resolver.d.ts +165 -0
- package/dist/apps/utils/input-resolver.js +477 -0
- package/dist/apps/utils/input-resolver.js.map +1 -0
- package/dist/apps/utils/oauth-manager.d.ts +196 -0
- package/dist/apps/utils/oauth-manager.js +405 -0
- package/dist/apps/utils/oauth-manager.js.map +1 -0
- package/dist/apps/validators/joi-validators/create.appWebhook.validator.d.ts +2 -1
- package/dist/apps/validators/joi-validators/create.appWebhook.validator.js +15 -2
- package/dist/apps/validators/joi-validators/create.appWebhook.validator.js.map +1 -1
- package/dist/apps/validators/joi-validators/update.appWebhook.validator.d.ts +2 -1
- package/dist/apps/validators/joi-validators/update.appWebhook.validator.js +14 -2
- package/dist/apps/validators/joi-validators/update.appWebhook.validator.js.map +1 -1
- package/dist/bin.d.ts +26 -0
- package/dist/bin.js +28 -0
- package/dist/bin.js.map +1 -0
- package/dist/brokers/brokers.service.d.ts +257 -0
- package/dist/brokers/brokers.service.js +604 -0
- package/dist/brokers/brokers.service.js.map +1 -0
- package/dist/brokers/index.d.ts +46 -0
- package/dist/brokers/index.js +83 -0
- package/dist/brokers/index.js.map +1 -0
- package/dist/brokers/types/index.d.ts +288 -0
- package/dist/brokers/types/index.js +8 -0
- package/dist/brokers/types/index.js.map +1 -0
- package/dist/brokers/utils/broker.util.d.ts +33 -0
- package/dist/brokers/utils/broker.util.js +125 -0
- package/dist/brokers/utils/broker.util.js.map +1 -0
- package/dist/brokers/utils/providers/aws-sqs.service.d.ts +16 -0
- package/dist/brokers/utils/providers/aws-sqs.service.js +71 -0
- package/dist/brokers/utils/providers/aws-sqs.service.js.map +1 -0
- package/dist/brokers/utils/providers/google-pubsub.service.d.ts +16 -0
- package/dist/brokers/utils/providers/google-pubsub.service.js +43 -0
- package/dist/brokers/utils/providers/google-pubsub.service.js.map +1 -0
- package/dist/brokers/utils/providers/index.d.ts +6 -0
- package/dist/brokers/utils/providers/index.js +16 -0
- package/dist/brokers/utils/providers/index.js.map +1 -0
- package/dist/brokers/utils/providers/kafka.service.d.ts +16 -0
- package/dist/brokers/utils/providers/kafka.service.js +52 -0
- package/dist/brokers/utils/providers/kafka.service.js.map +1 -0
- package/dist/brokers/utils/providers/nats.service.d.ts +18 -0
- package/dist/brokers/utils/providers/nats.service.js +63 -0
- package/dist/brokers/utils/providers/nats.service.js.map +1 -0
- package/dist/brokers/utils/providers/rabbitmq.service.d.ts +14 -0
- package/dist/brokers/utils/providers/rabbitmq.service.js +67 -0
- package/dist/brokers/utils/providers/rabbitmq.service.js.map +1 -0
- package/dist/brokers/utils/providers/redis.service.d.ts +18 -0
- package/dist/brokers/utils/providers/redis.service.js +93 -0
- package/dist/brokers/utils/providers/redis.service.js.map +1 -0
- package/dist/cache/cache.manager.d.ts +159 -0
- package/dist/cache/cache.manager.js +265 -0
- package/dist/cache/cache.manager.js.map +1 -0
- package/dist/cache/cache.service.d.ts +186 -0
- package/dist/cache/cache.service.js +437 -0
- package/dist/cache/cache.service.js.map +1 -0
- package/dist/cache/index.d.ts +52 -0
- package/dist/cache/index.js +79 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/types/index.d.ts +106 -0
- package/dist/cache/types/index.js +6 -0
- package/dist/cache/types/index.js.map +1 -0
- package/dist/database/actions/action-manager.d.ts +170 -0
- package/dist/database/actions/action-manager.js +465 -0
- package/dist/database/actions/action-manager.js.map +1 -0
- package/dist/database/actions/index.d.ts +6 -0
- package/dist/database/actions/index.js +13 -0
- package/dist/database/actions/index.js.map +1 -0
- package/dist/database/adapters/adapter.factory.d.ts +62 -0
- package/dist/database/adapters/adapter.factory.js +97 -0
- package/dist/database/adapters/adapter.factory.js.map +1 -0
- package/dist/database/adapters/base.adapter.d.ts +307 -90
- package/dist/database/adapters/base.adapter.js +139 -20
- package/dist/database/adapters/base.adapter.js.map +1 -1
- package/dist/database/adapters/cassandra.adapter.d.ts +90 -0
- package/dist/database/adapters/cassandra.adapter.js +1019 -0
- package/dist/database/adapters/cassandra.adapter.js.map +1 -0
- package/dist/database/adapters/dynamodb.adapter.d.ts +94 -77
- package/dist/database/adapters/dynamodb.adapter.js +1162 -1305
- package/dist/database/adapters/dynamodb.adapter.js.map +1 -1
- package/dist/database/adapters/index.d.ts +11 -0
- package/dist/database/adapters/index.js +27 -0
- package/dist/database/adapters/index.js.map +1 -0
- package/dist/database/adapters/mariadb.adapter.d.ts +100 -0
- package/dist/database/adapters/mariadb.adapter.js +247 -0
- package/dist/database/adapters/mariadb.adapter.js.map +1 -0
- package/dist/database/adapters/mongodb.adapter.d.ts +105 -57
- package/dist/database/adapters/mongodb.adapter.js +941 -838
- package/dist/database/adapters/mongodb.adapter.js.map +1 -1
- package/dist/database/adapters/mysql.adapter.d.ts +76 -138
- package/dist/database/adapters/mysql.adapter.js +990 -1246
- package/dist/database/adapters/mysql.adapter.js.map +1 -1
- package/dist/database/adapters/postgresql.adapter.d.ts +75 -139
- package/dist/database/adapters/postgresql.adapter.js +1076 -1346
- package/dist/database/adapters/postgresql.adapter.js.map +1 -1
- package/dist/database/databases.service.d.ts +1374 -0
- package/dist/database/databases.service.js +2680 -0
- package/dist/database/databases.service.js.map +1 -0
- package/dist/database/index.d.ts +41 -13
- package/dist/database/index.js +97 -86
- package/dist/database/index.js.map +1 -1
- package/dist/database/migrations/index.d.ts +6 -0
- package/dist/database/migrations/index.js +12 -0
- package/dist/database/migrations/index.js.map +1 -0
- package/dist/database/migrations/migration-engine.d.ts +132 -0
- package/dist/database/migrations/migration-engine.js +1356 -0
- package/dist/database/migrations/migration-engine.js.map +1 -0
- package/dist/database/operators/aggregation-builder.d.ts +64 -0
- package/dist/database/operators/aggregation-builder.js +746 -0
- package/dist/database/operators/aggregation-builder.js.map +1 -0
- package/dist/database/operators/index.d.ts +7 -0
- package/dist/database/operators/index.js +15 -0
- package/dist/database/operators/index.js.map +1 -0
- package/dist/database/operators/query-builder.d.ts +55 -0
- package/dist/database/operators/query-builder.js +365 -0
- package/dist/database/operators/query-builder.js.map +1 -0
- package/dist/database/presave/decrypt.d.ts +25 -0
- package/dist/database/presave/decrypt.js +146 -0
- package/dist/database/presave/decrypt.js.map +1 -0
- package/dist/database/presave/index.d.ts +9 -0
- package/dist/database/presave/index.js +18 -0
- package/dist/database/presave/index.js.map +1 -0
- package/dist/database/presave/presave-processor.d.ts +148 -0
- package/dist/database/presave/presave-processor.js +702 -0
- package/dist/database/presave/presave-processor.js.map +1 -0
- package/dist/database/schema/index.d.ts +7 -0
- package/dist/database/schema/index.js +13 -0
- package/dist/database/schema/index.js.map +1 -0
- package/dist/database/schema/schema-manager.d.ts +258 -0
- package/dist/database/schema/schema-manager.js +637 -0
- package/dist/database/schema/schema-manager.js.map +1 -0
- package/dist/database/transactions/index.d.ts +6 -0
- package/dist/database/transactions/index.js +13 -0
- package/dist/database/transactions/index.js.map +1 -0
- package/dist/database/transactions/transaction-manager.d.ts +113 -0
- package/dist/database/transactions/transaction-manager.js +344 -0
- package/dist/database/transactions/transaction-manager.js.map +1 -0
- package/dist/database/triggers/index.d.ts +7 -0
- package/dist/database/triggers/index.js +14 -0
- package/dist/database/triggers/index.js.map +1 -0
- package/dist/database/triggers/trigger-processor.d.ts +239 -0
- package/dist/database/triggers/trigger-processor.js +1034 -0
- package/dist/database/triggers/trigger-processor.js.map +1 -0
- package/dist/database/types/action.interface.d.ts +148 -0
- package/dist/database/types/action.interface.js +6 -0
- package/dist/database/types/action.interface.js.map +1 -0
- package/dist/database/types/aggregation.interface.d.ts +179 -0
- package/dist/database/types/aggregation.interface.js +6 -0
- package/dist/database/types/aggregation.interface.js.map +1 -0
- package/dist/database/types/connection.interface.d.ts +137 -0
- package/dist/database/types/connection.interface.js +6 -0
- package/dist/database/types/connection.interface.js.map +1 -0
- package/dist/database/types/enums.d.ts +195 -0
- package/dist/database/types/enums.js +244 -0
- package/dist/database/types/enums.js.map +1 -0
- package/dist/database/types/index.d.ts +12 -10
- package/dist/database/types/index.js +26 -32
- package/dist/database/types/index.js.map +1 -1
- package/dist/database/types/migration.interface.d.ts +686 -0
- package/dist/database/types/migration.interface.js +9 -0
- package/dist/database/types/migration.interface.js.map +1 -0
- package/dist/database/types/presave.interface.d.ts +292 -0
- package/dist/database/types/presave.interface.js +60 -0
- package/dist/database/types/presave.interface.js.map +1 -0
- package/dist/database/types/query.interface.d.ts +199 -0
- package/dist/database/types/query.interface.js +6 -0
- package/dist/database/types/query.interface.js.map +1 -0
- package/dist/database/types/schema.interface.d.ts +398 -0
- package/dist/database/types/schema.interface.js +6 -0
- package/dist/database/types/schema.interface.js.map +1 -0
- package/dist/database/types/transaction.interface.d.ts +84 -0
- package/dist/database/types/transaction.interface.js +6 -0
- package/dist/database/types/transaction.interface.js.map +1 -0
- package/dist/database/types/trigger.interface.d.ts +612 -0
- package/dist/database/types/trigger.interface.js +121 -0
- package/dist/database/types/trigger.interface.js.map +1 -0
- package/dist/database/types/write.interface.d.ts +208 -0
- package/dist/database/types/write.interface.js +6 -0
- package/dist/database/types/write.interface.js.map +1 -0
- package/dist/database/utils/database-error.d.ts +96 -0
- package/dist/database/utils/database-error.js +221 -0
- package/dist/database/utils/database-error.js.map +1 -0
- package/dist/database/utils/index.d.ts +6 -0
- package/dist/database/utils/index.js +11 -0
- package/dist/database/utils/index.js.map +1 -0
- package/dist/graph/adapters/adapter.factory.d.ts +47 -0
- package/dist/graph/adapters/adapter.factory.js +77 -0
- package/dist/graph/adapters/adapter.factory.js.map +1 -0
- package/dist/graph/adapters/arangodb.adapter.d.ts +78 -72
- package/dist/graph/adapters/arangodb.adapter.js +1310 -1220
- package/dist/graph/adapters/arangodb.adapter.js.map +1 -1
- package/dist/graph/adapters/base.adapter.d.ts +135 -118
- package/dist/graph/adapters/base.adapter.js +46 -20
- package/dist/graph/adapters/base.adapter.js.map +1 -1
- package/dist/graph/adapters/index.d.ts +5 -4
- package/dist/graph/adapters/index.js +6 -8
- package/dist/graph/adapters/index.js.map +1 -1
- package/dist/graph/adapters/memgraph.adapter.d.ts +98 -73
- package/dist/graph/adapters/memgraph.adapter.js +1050 -1202
- package/dist/graph/adapters/memgraph.adapter.js.map +1 -1
- package/dist/graph/adapters/neo4j.adapter.d.ts +71 -78
- package/dist/graph/adapters/neo4j.adapter.js +912 -1605
- package/dist/graph/adapters/neo4j.adapter.js.map +1 -1
- package/dist/graph/adapters/neptune.adapter.d.ts +76 -81
- package/dist/graph/adapters/neptune.adapter.js +1095 -1228
- package/dist/graph/adapters/neptune.adapter.js.map +1 -1
- package/dist/graph/graphs.service.d.ts +524 -0
- package/dist/graph/graphs.service.js +1683 -0
- package/dist/graph/graphs.service.js.map +1 -0
- package/dist/graph/index.d.ts +54 -8
- package/dist/graph/index.js +67 -32
- package/dist/graph/index.js.map +1 -1
- package/dist/graph/transactions/index.d.ts +4 -0
- package/dist/graph/transactions/index.js +9 -0
- package/dist/graph/transactions/index.js.map +1 -0
- package/dist/graph/transactions/transaction-manager.d.ts +61 -0
- package/dist/graph/transactions/transaction-manager.js +126 -0
- package/dist/graph/transactions/transaction-manager.js.map +1 -0
- package/dist/graph/types/connection.interface.d.ts +141 -0
- package/dist/graph/types/connection.interface.js +9 -0
- package/dist/graph/types/connection.interface.js.map +1 -0
- package/dist/graph/types/enums.d.ts +101 -0
- package/dist/graph/types/enums.js +114 -0
- package/dist/graph/types/enums.js.map +1 -0
- package/dist/graph/types/index.d.ts +11 -9
- package/dist/graph/types/index.js +15 -30
- package/dist/graph/types/index.js.map +1 -1
- package/dist/graph/types/node.interface.d.ts +248 -0
- package/dist/graph/types/node.interface.js +9 -0
- package/dist/graph/types/node.interface.js.map +1 -0
- package/dist/graph/types/query.interface.d.ts +168 -0
- package/dist/graph/types/query.interface.js +9 -0
- package/dist/graph/types/query.interface.js.map +1 -0
- package/dist/graph/types/relationship.interface.d.ts +207 -0
- package/dist/graph/types/relationship.interface.js +9 -0
- package/dist/graph/types/relationship.interface.js.map +1 -0
- package/dist/graph/types/schema.interface.d.ts +295 -0
- package/dist/graph/types/schema.interface.js +9 -0
- package/dist/graph/types/schema.interface.js.map +1 -0
- package/dist/graph/types/transaction.interface.d.ts +55 -0
- package/dist/graph/types/transaction.interface.js +9 -0
- package/dist/graph/types/transaction.interface.js.map +1 -0
- package/dist/graph/types/traversal.interface.d.ts +181 -0
- package/dist/graph/types/traversal.interface.js +9 -0
- package/dist/graph/types/traversal.interface.js.map +1 -0
- package/dist/graph/utils/graph-error.d.ts +71 -0
- package/dist/graph/utils/graph-error.js +142 -0
- package/dist/graph/utils/graph-error.js.map +1 -0
- package/dist/graph/utils/index.d.ts +4 -0
- package/dist/graph/utils/index.js +9 -0
- package/dist/graph/utils/index.js.map +1 -0
- package/dist/index.d.ts +1905 -875
- package/dist/index.js +3063 -1282
- package/dist/index.js.map +1 -1
- package/dist/init.interface.d.ts +407 -0
- package/dist/init.interface.js +3 -0
- package/dist/init.interface.js.map +1 -0
- package/dist/jobs/index.d.ts +38 -0
- package/dist/jobs/index.js +50 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/jobs.service.d.ts +154 -0
- package/dist/jobs/jobs.service.js +491 -0
- package/dist/jobs/jobs.service.js.map +1 -0
- package/dist/jobs/jobs.state.d.ts +113 -0
- package/dist/jobs/jobs.state.js +447 -0
- package/dist/jobs/jobs.state.js.map +1 -0
- package/dist/jobs/types.d.ts +449 -0
- package/dist/jobs/types.js +74 -0
- package/dist/jobs/types.js.map +1 -0
- package/dist/logs/logs.types.d.ts +12 -2
- package/dist/logs/logs.types.js +5 -1
- package/dist/logs/logs.types.js.map +1 -1
- package/dist/models/index.d.ts +6 -0
- package/dist/models/index.js +11 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/models.service.d.ts +137 -0
- package/dist/models/models.service.js +195 -0
- package/dist/models/models.service.js.map +1 -0
- package/dist/notifications/index.d.ts +13 -0
- package/dist/notifications/index.js +26 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/notifications/notifications.service.d.ts +252 -0
- package/dist/notifications/notifications.service.js +654 -0
- package/dist/notifications/notifications.service.js.map +1 -0
- package/dist/notifications/types/index.d.ts +4 -0
- package/dist/notifications/types/index.js +21 -0
- package/dist/notifications/types/index.js.map +1 -0
- package/dist/notifications/types/notifications.types.d.ts +400 -0
- package/dist/notifications/types/notifications.types.js +49 -0
- package/dist/notifications/types/notifications.types.js.map +1 -0
- package/dist/processor/services/messagebrokers/kafka.service.js +2 -0
- package/dist/processor/services/messagebrokers/kafka.service.js.map +1 -1
- package/dist/processor/services/messagebrokers/rabbitmq.service.d.ts +1 -9
- package/dist/processor/services/messagebrokers/rabbitmq.service.js +11 -40
- package/dist/processor/services/messagebrokers/rabbitmq.service.js.map +1 -1
- package/dist/processor/services/processor.service.d.ts +86 -70
- package/dist/processor/services/processor.service.js +1353 -1259
- package/dist/processor/services/processor.service.js.map +1 -1
- package/dist/processor/utils/processor.utils.js +5 -1
- package/dist/processor/utils/processor.utils.js.map +1 -1
- package/dist/products/services/products.service.d.ts +167 -25
- package/dist/products/services/products.service.js +1248 -412
- package/dist/products/services/products.service.js.map +1 -1
- package/dist/products/validators/index.d.ts +6 -3
- package/dist/products/validators/index.js +14 -5
- package/dist/products/validators/index.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productAgent.validator.d.ts +3 -0
- package/dist/products/validators/joi-validators/create.productAgent.validator.js +218 -0
- package/dist/products/validators/joi-validators/create.productAgent.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/create.productDatabase.validator.js +5 -0
- package/dist/products/validators/joi-validators/create.productDatabase.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productDatabaseAction.validator.d.ts +4 -15
- package/dist/products/validators/joi-validators/create.productDatabaseAction.validator.js +109 -501
- package/dist/products/validators/joi-validators/create.productDatabaseAction.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productGraph.validator.js +14 -9
- package/dist/products/validators/joi-validators/create.productGraph.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productMessageBrokerTopic.validator.js +0 -1
- package/dist/products/validators/joi-validators/create.productMessageBrokerTopic.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js +87 -30
- package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productModel.validator.d.ts +3 -0
- package/dist/products/validators/joi-validators/create.productModel.validator.js +132 -0
- package/dist/products/validators/joi-validators/create.productModel.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/create.productNotification.validator.js +135 -50
- package/dist/products/validators/joi-validators/create.productNotification.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productStorage.validator.js +77 -18
- package/dist/products/validators/joi-validators/create.productStorage.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productVector.validator.d.ts +3 -0
- package/dist/products/validators/joi-validators/create.productVector.validator.js +135 -0
- package/dist/products/validators/joi-validators/create.productVector.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/update.productDatabase.validator.js +5 -0
- package/dist/products/validators/joi-validators/update.productDatabase.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/update.productDatabaseAction.validator.d.ts +0 -6
- package/dist/products/validators/joi-validators/update.productDatabaseAction.validator.js +26 -28
- package/dist/products/validators/joi-validators/update.productDatabaseAction.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/update.productGraph.validator.js +11 -12
- package/dist/products/validators/joi-validators/update.productGraph.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/update.productMessageBrokerTopic.validator.js +0 -1
- package/dist/products/validators/joi-validators/update.productMessageBrokerTopic.validator.js.map +1 -1
- package/dist/resilience/fallback.service.d.ts +88 -0
- package/dist/resilience/fallback.service.js +511 -0
- package/dist/resilience/fallback.service.js.map +1 -0
- package/dist/resilience/healthcheck.service.d.ts +106 -0
- package/dist/resilience/healthcheck.service.js +379 -0
- package/dist/resilience/healthcheck.service.js.map +1 -0
- package/dist/resilience/index.d.ts +104 -0
- package/dist/resilience/index.js +140 -0
- package/dist/resilience/index.js.map +1 -0
- package/dist/resilience/quota.service.d.ts +90 -0
- package/dist/resilience/quota.service.js +519 -0
- package/dist/resilience/quota.service.js.map +1 -0
- package/dist/resilience/resilience.service.d.ts +95 -0
- package/dist/resilience/resilience.service.js +525 -0
- package/dist/resilience/resilience.service.js.map +1 -0
- package/dist/resilience/types/index.d.ts +479 -0
- package/dist/resilience/types/index.js +26 -0
- package/dist/resilience/types/index.js.map +1 -0
- package/dist/secrets/index.d.ts +10 -0
- package/dist/secrets/index.js +33 -0
- package/dist/secrets/index.js.map +1 -0
- package/dist/secrets/secrets.resolver.d.ts +52 -0
- package/dist/secrets/secrets.resolver.js +233 -0
- package/dist/secrets/secrets.resolver.js.map +1 -0
- package/dist/secrets/secrets.service.d.ts +83 -0
- package/dist/secrets/secrets.service.js +159 -0
- package/dist/secrets/secrets.service.js.map +1 -0
- package/dist/secrets/secrets.types.d.ts +188 -0
- package/dist/secrets/secrets.types.js +87 -0
- package/dist/secrets/secrets.types.js.map +1 -0
- package/dist/sessions/index.d.ts +50 -0
- package/dist/sessions/index.js +93 -0
- package/dist/sessions/index.js.map +1 -0
- package/dist/sessions/sessions.helper.d.ts +68 -0
- package/dist/sessions/sessions.helper.js +116 -0
- package/dist/sessions/sessions.helper.js.map +1 -0
- package/dist/sessions/sessions.resolver.d.ts +150 -0
- package/dist/sessions/sessions.resolver.js +356 -0
- package/dist/sessions/sessions.resolver.js.map +1 -0
- package/dist/sessions/sessions.service.d.ts +170 -0
- package/dist/sessions/sessions.service.js +736 -0
- package/dist/sessions/sessions.service.js.map +1 -0
- package/dist/sessions/types/index.d.ts +290 -0
- package/dist/sessions/types/index.js +6 -0
- package/dist/sessions/types/index.js.map +1 -0
- package/dist/storage/index.d.ts +66 -0
- package/dist/storage/index.js +98 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/storage.service.d.ts +123 -0
- package/dist/storage/storage.service.js +478 -0
- package/dist/storage/storage.service.js.map +1 -0
- package/dist/storage/types/index.d.ts +207 -0
- package/dist/storage/types/index.js +6 -0
- package/dist/storage/types/index.js.map +1 -0
- package/dist/storage/utils/storage.util.d.ts +51 -0
- package/dist/storage/utils/storage.util.js +402 -0
- package/dist/storage/utils/storage.util.js.map +1 -0
- package/dist/test/index.d.ts +3 -0
- package/dist/test/index.js +13 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/test.appBuilder.d.ts +0 -1
- package/dist/test/test.appBuilder.js +0 -15
- package/dist/test/test.appBuilder.js.map +1 -1
- package/dist/test/test.database.js +140 -0
- package/dist/test/test.database.js.map +1 -0
- package/dist/test/test.health.d.ts +0 -1
- package/dist/test/test.health.js +0 -48
- package/dist/test/test.health.js.map +1 -1
- package/dist/test/test.import.d.ts +0 -1
- package/dist/test/test.import.js +0 -1506
- package/dist/test/test.import.js.map +1 -1
- package/dist/test/test.import.openapi.d.ts +0 -1
- package/dist/test/test.import.openapi.js +0 -75
- package/dist/test/test.import.openapi.js.map +1 -1
- package/dist/test/test.imports.d.ts +0 -1
- package/dist/test/test.imports.js +0 -76
- package/dist/test/test.imports.js.map +1 -1
- package/dist/test/test.logs.d.ts +0 -1
- package/dist/test/test.logs.js +0 -17
- package/dist/test/test.logs.js.map +1 -1
- package/dist/test/test.notifiers.d.ts +0 -1
- package/dist/test/test.notifiers.js +0 -84
- package/dist/test/test.notifiers.js.map +1 -1
- package/dist/test/test.processor.d.ts +0 -1
- package/dist/test/test.processor.js +0 -37
- package/dist/test/test.processor.js.map +1 -1
- package/dist/test/test.productBuilder.d.ts +0 -1
- package/dist/test/test.productBuilder.js +0 -660
- package/dist/test/test.productBuilder.js.map +1 -1
- package/dist/test/test.products.d.ts +0 -1
- package/dist/test/test.products.js +0 -48
- package/dist/test/test.products.js.map +1 -1
- package/dist/test/test.storage.js +332 -0
- package/dist/test/test.storage.js.map +1 -0
- package/dist/test/test.triggers.js +314 -0
- package/dist/test/test.triggers.js.map +1 -0
- package/dist/types/appBuilder.types.d.ts +1 -1
- package/dist/types/enums.d.ts +6 -1
- package/dist/types/enums.js +5 -0
- package/dist/types/enums.js.map +1 -1
- package/dist/types/processor.types.d.ts +197 -35
- package/dist/types/processor.types.js +9 -1
- package/dist/types/processor.types.js.map +1 -1
- package/dist/types/productsBuilder.types.d.ts +837 -75
- package/dist/types/productsBuilder.types.js +168 -62
- package/dist/types/productsBuilder.types.js.map +1 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +2 -49
- package/dist/utils/index.js.map +1 -1
- package/dist/vector/adapters/base.adapter.d.ts +152 -0
- package/dist/vector/adapters/base.adapter.js +137 -0
- package/dist/vector/adapters/base.adapter.js.map +1 -0
- package/dist/vector/adapters/index.d.ts +10 -0
- package/dist/vector/adapters/index.js +19 -0
- package/dist/vector/adapters/index.js.map +1 -0
- package/dist/vector/adapters/memory.adapter.d.ts +85 -0
- package/dist/vector/adapters/memory.adapter.js +505 -0
- package/dist/vector/adapters/memory.adapter.js.map +1 -0
- package/dist/vector/adapters/pinecone.adapter.d.ts +52 -0
- package/dist/vector/adapters/pinecone.adapter.js +400 -0
- package/dist/vector/adapters/pinecone.adapter.js.map +1 -0
- package/dist/vector/adapters/qdrant.adapter.d.ts +56 -0
- package/dist/vector/adapters/qdrant.adapter.js +392 -0
- package/dist/vector/adapters/qdrant.adapter.js.map +1 -0
- package/dist/vector/adapters/weaviate.adapter.d.ts +64 -0
- package/dist/vector/adapters/weaviate.adapter.js +478 -0
- package/dist/vector/adapters/weaviate.adapter.js.map +1 -0
- package/dist/vector/index.d.ts +47 -0
- package/dist/vector/index.js +72 -0
- package/dist/vector/index.js.map +1 -0
- package/dist/vector/types/connection.interface.d.ts +151 -0
- package/dist/vector/types/connection.interface.js +8 -0
- package/dist/vector/types/connection.interface.js.map +1 -0
- package/dist/vector/types/embedding.interface.d.ts +144 -0
- package/dist/vector/types/embedding.interface.js +8 -0
- package/dist/vector/types/embedding.interface.js.map +1 -0
- package/dist/vector/types/enums.d.ts +104 -0
- package/dist/vector/types/enums.js +113 -0
- package/dist/vector/types/enums.js.map +1 -0
- package/dist/vector/types/index.d.ts +9 -0
- package/dist/vector/types/index.js +16 -0
- package/dist/vector/types/index.js.map +1 -0
- package/dist/vector/types/vector.interface.d.ts +315 -0
- package/dist/vector/types/vector.interface.js +8 -0
- package/dist/vector/types/vector.interface.js.map +1 -0
- package/dist/vector/utils/index.d.ts +6 -0
- package/dist/vector/utils/index.js +11 -0
- package/dist/vector/utils/index.js.map +1 -0
- package/dist/vector/utils/vector-error.d.ts +69 -0
- package/dist/vector/utils/vector-error.js +117 -0
- package/dist/vector/utils/vector-error.js.map +1 -0
- package/dist/vector/vector-database.service.d.ts +405 -0
- package/dist/vector/vector-database.service.js +544 -0
- package/dist/vector/vector-database.service.js.map +1 -0
- package/dist/vector/vector.service.d.ts +245 -0
- package/dist/vector/vector.service.js +381 -0
- package/dist/vector/vector.service.js.map +1 -0
- package/dist/workflows/index.d.ts +30 -0
- package/dist/workflows/index.js +64 -0
- package/dist/workflows/index.js.map +1 -0
- package/dist/workflows/types/index.d.ts +6 -0
- package/dist/workflows/types/index.js +23 -0
- package/dist/workflows/types/index.js.map +1 -0
- package/dist/workflows/types/workflows.types.d.ts +1035 -0
- package/dist/workflows/types/workflows.types.js +13 -0
- package/dist/workflows/types/workflows.types.js.map +1 -0
- package/dist/workflows/workflow-builder.d.ts +70 -0
- package/dist/workflows/workflow-builder.js +338 -0
- package/dist/workflows/workflow-builder.js.map +1 -0
- package/dist/workflows/workflow-executor.d.ts +205 -0
- package/dist/workflows/workflow-executor.js +1186 -0
- package/dist/workflows/workflow-executor.js.map +1 -0
- package/dist/workflows/workflows.service.d.ts +398 -0
- package/dist/workflows/workflows.service.js +1595 -0
- package/dist/workflows/workflows.service.js.map +1 -0
- package/package.json +16 -13
- package/dist/actions/actions.repo.d.ts +0 -0
- package/dist/actions/actions.repo.js +0 -13
- package/dist/actions/actions.repo.js.map +0 -1
- package/dist/actions/actions.service.d.ts +0 -0
- package/dist/actions/actions.service.js +0 -24
- package/dist/actions/actions.service.js.map +0 -1
- package/dist/actions/utils/actions.util.read.d.ts +0 -0
- package/dist/actions/utils/actions.util.read.js +0 -427
- package/dist/actions/utils/actions.util.read.js.map +0 -1
- package/dist/api/services/integrationsApi.service.d.ts +0 -18
- package/dist/api/services/integrationsApi.service.js +0 -80
- package/dist/api/services/integrationsApi.service.js.map +0 -1
- package/dist/api/services/workspaceSecretsApi.service.d.ts +0 -75
- package/dist/api/services/workspaceSecretsApi.service.js +0 -62
- package/dist/api/services/workspaceSecretsApi.service.js.map +0 -1
- package/dist/appBuilder/services/app.service.d.ts +0 -111
- package/dist/appBuilder/services/app.service.js +0 -737
- package/dist/appBuilder/services/app.service.js.map +0 -1
- package/dist/appBuilder/services/appBuilder.service.d.ts +0 -111
- package/dist/appBuilder/services/appBuilder.service.js +0 -662
- package/dist/appBuilder/services/appBuilder.service.js.map +0 -1
- package/dist/appBuilder/utils/objects.utils.d.ts +0 -3
- package/dist/appBuilder/utils/objects.utils.js +0 -9
- package/dist/appBuilder/utils/objects.utils.js.map +0 -1
- package/dist/appBuilder/utils/string.utils.d.ts +0 -2
- package/dist/appBuilder/utils/string.utils.js +0 -57
- package/dist/appBuilder/utils/string.utils.js.map +0 -1
- package/dist/appBuilder/validators/index.d.ts +0 -19
- package/dist/appBuilder/validators/index.js +0 -40
- package/dist/appBuilder/validators/index.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.app.validator.d.ts +0 -3
- package/dist/appBuilder/validators/joi-validators/create.app.validator.js +0 -10
- package/dist/appBuilder/validators/joi-validators/create.app.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appAction.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appAction.validator.js +0 -20
- package/dist/appBuilder/validators/joi-validators/create.appAction.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appActionResponse.validator.d.ts +0 -7
- package/dist/appBuilder/validators/joi-validators/create.appActionResponse.validator.js +0 -44
- package/dist/appBuilder/validators/joi-validators/create.appActionResponse.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appAuth.validator.d.ts +0 -3
- package/dist/appBuilder/validators/joi-validators/create.appAuth.validator.js +0 -31
- package/dist/appBuilder/validators/joi-validators/create.appAuth.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appBody.validators.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appBody.validators.js +0 -11
- package/dist/appBuilder/validators/joi-validators/create.appBody.validators.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appConstants.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appConstants.validator.js +0 -12
- package/dist/appBuilder/validators/joi-validators/create.appConstants.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appEnv.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appEnv.validator.js +0 -17
- package/dist/appBuilder/validators/joi-validators/create.appEnv.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appEvent.validator.d.ts +0 -5
- package/dist/appBuilder/validators/joi-validators/create.appEvent.validator.js +0 -30
- package/dist/appBuilder/validators/joi-validators/create.appEvent.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appVariable.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appVariable.validator.js +0 -14
- package/dist/appBuilder/validators/joi-validators/create.appVariable.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/sample.validator.d.ts +0 -5
- package/dist/appBuilder/validators/joi-validators/sample.validator.js +0 -26
- package/dist/appBuilder/validators/joi-validators/sample.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.app.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.app.validator.js +0 -34
- package/dist/appBuilder/validators/joi-validators/update.app.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appAction.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appAction.validator.js +0 -23
- package/dist/appBuilder/validators/joi-validators/update.appAction.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appActionResponse.validator.d.ts +0 -3
- package/dist/appBuilder/validators/joi-validators/update.appActionResponse.validator.js +0 -21
- package/dist/appBuilder/validators/joi-validators/update.appActionResponse.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appAuth.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appAuth.validator.js +0 -19
- package/dist/appBuilder/validators/joi-validators/update.appAuth.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appConstants.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appConstants.validator.js +0 -12
- package/dist/appBuilder/validators/joi-validators/update.appConstants.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appEnv.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appEnv.validator.js +0 -17
- package/dist/appBuilder/validators/joi-validators/update.appEnv.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appEvent.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appEvent.validator.js +0 -16
- package/dist/appBuilder/validators/joi-validators/update.appEvent.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appVariables.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appVariables.validator.js +0 -14
- package/dist/appBuilder/validators/joi-validators/update.appVariables.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.validation.entityData.validator.d.ts +0 -3
- package/dist/appBuilder/validators/joi-validators/update.validation.entityData.validator.js +0 -27
- package/dist/appBuilder/validators/joi-validators/update.validation.entityData.validator.js.map +0 -1
- package/dist/apps/validators/joi-validators/create.appEvent.validator.d.ts +0 -5
- package/dist/apps/validators/joi-validators/create.appEvent.validator.js +0 -30
- package/dist/apps/validators/joi-validators/create.appEvent.validator.js.map +0 -1
- package/dist/apps/validators/joi-validators/update.appEvent.validator.d.ts +0 -4
- package/dist/apps/validators/joi-validators/update.appEvent.validator.js +0 -16
- package/dist/apps/validators/joi-validators/update.appEvent.validator.js.map +0 -1
- package/dist/clients/integrations.client.d.ts +0 -2
- package/dist/clients/integrations.client.js +0 -26
- package/dist/clients/integrations.client.js.map +0 -1
- package/dist/database/database.service.d.ts +0 -232
- package/dist/database/database.service.js +0 -802
- package/dist/database/database.service.js.map +0 -1
- package/dist/database/types/aggregation.types.d.ts +0 -261
- package/dist/database/types/aggregation.types.js +0 -21
- package/dist/database/types/aggregation.types.js.map +0 -1
- package/dist/database/types/connection.types.d.ts +0 -132
- package/dist/database/types/connection.types.js +0 -6
- package/dist/database/types/connection.types.js.map +0 -1
- package/dist/database/types/database.types.d.ts +0 -175
- package/dist/database/types/database.types.js +0 -75
- package/dist/database/types/database.types.js.map +0 -1
- package/dist/database/types/index.types.d.ts +0 -220
- package/dist/database/types/index.types.js +0 -27
- package/dist/database/types/index.types.js.map +0 -1
- package/dist/database/types/migration.types.d.ts +0 -205
- package/dist/database/types/migration.types.js +0 -44
- package/dist/database/types/migration.types.js.map +0 -1
- package/dist/database/types/query.types.d.ts +0 -305
- package/dist/database/types/query.types.js +0 -57
- package/dist/database/types/query.types.js.map +0 -1
- package/dist/database/types/result.types.d.ts +0 -220
- package/dist/database/types/result.types.js +0 -6
- package/dist/database/types/result.types.js.map +0 -1
- package/dist/database/types/schema.types.d.ts +0 -190
- package/dist/database/types/schema.types.js +0 -69
- package/dist/database/types/schema.types.js.map +0 -1
- package/dist/database/utils/helpers.d.ts +0 -66
- package/dist/database/utils/helpers.js +0 -501
- package/dist/database/utils/helpers.js.map +0 -1
- package/dist/database/utils/migration.utils.d.ts +0 -151
- package/dist/database/utils/migration.utils.js +0 -476
- package/dist/database/utils/migration.utils.js.map +0 -1
- package/dist/database/utils/transaction.d.ts +0 -64
- package/dist/database/utils/transaction.js +0 -130
- package/dist/database/utils/transaction.js.map +0 -1
- package/dist/database/validators/connection.validator.d.ts +0 -20
- package/dist/database/validators/connection.validator.js +0 -267
- package/dist/database/validators/connection.validator.js.map +0 -1
- package/dist/database/validators/query.validator.d.ts +0 -31
- package/dist/database/validators/query.validator.js +0 -305
- package/dist/database/validators/query.validator.js.map +0 -1
- package/dist/database/validators/schema.validator.d.ts +0 -31
- package/dist/database/validators/schema.validator.js +0 -334
- package/dist/database/validators/schema.validator.js.map +0 -1
- package/dist/graph/graph.service.d.ts +0 -278
- package/dist/graph/graph.service.js +0 -687
- package/dist/graph/graph.service.js.map +0 -1
- package/dist/graph/types/connection.types.d.ts +0 -158
- package/dist/graph/types/connection.types.js +0 -43
- package/dist/graph/types/connection.types.js.map +0 -1
- package/dist/graph/types/graph.types.d.ts +0 -144
- package/dist/graph/types/graph.types.js +0 -84
- package/dist/graph/types/graph.types.js.map +0 -1
- package/dist/graph/types/node.types.d.ts +0 -193
- package/dist/graph/types/node.types.js +0 -49
- package/dist/graph/types/node.types.js.map +0 -1
- package/dist/graph/types/path.types.d.ts +0 -224
- package/dist/graph/types/path.types.js +0 -38
- package/dist/graph/types/path.types.js.map +0 -1
- package/dist/graph/types/query.types.d.ts +0 -247
- package/dist/graph/types/query.types.js +0 -23
- package/dist/graph/types/query.types.js.map +0 -1
- package/dist/graph/types/relationship.types.d.ts +0 -224
- package/dist/graph/types/relationship.types.js +0 -35
- package/dist/graph/types/relationship.types.js.map +0 -1
- package/dist/graph/types/result.types.d.ts +0 -237
- package/dist/graph/types/result.types.js +0 -7
- package/dist/graph/types/result.types.js.map +0 -1
- package/dist/graph/validators/index.d.ts +0 -81
- package/dist/graph/validators/index.js +0 -243
- package/dist/graph/validators/index.js.map +0 -1
- package/dist/integrationsBuilder/services/integration.service.d.ts +0 -138
- package/dist/integrationsBuilder/services/integration.service.js +0 -1148
- package/dist/integrationsBuilder/services/integration.service.js.map +0 -1
- package/dist/integrationsBuilder/services/integrationBuilder.service.d.ts +0 -130
- package/dist/integrationsBuilder/services/integrationBuilder.service.js +0 -1017
- package/dist/integrationsBuilder/services/integrationBuilder.service.js.map +0 -1
- package/dist/integrationsBuilder/utils/objects.utils.d.ts +0 -2
- package/dist/integrationsBuilder/utils/objects.utils.js +0 -48
- package/dist/integrationsBuilder/utils/objects.utils.js.map +0 -1
- package/dist/integrationsBuilder/utils/string.utils.d.ts +0 -1
- package/dist/integrationsBuilder/utils/string.utils.js +0 -9
- package/dist/integrationsBuilder/utils/string.utils.js.map +0 -1
- package/dist/integrationsBuilder/validators/index.d.ts +0 -18
- package/dist/integrationsBuilder/validators/index.js +0 -38
- package/dist/integrationsBuilder/validators/index.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integration.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integration.validator.js +0 -10
- package/dist/integrationsBuilder/validators/joi-validators/create.integration.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationApp.validator.d.ts +0 -4
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationApp.validator.js +0 -26
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationApp.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationCache.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationCache.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationCache.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationDatabase.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationDatabase.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationDatabase.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationEnv.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationEnv.validator.js +0 -10
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationEnv.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFeature.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFeature.validator.js +0 -60
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFeature.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFunction.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFunction.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFunction.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationJob.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationJob.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationJob.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationNotification.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationNotification.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationNotification.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationApp.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationApp.validator.js +0 -9
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationApp.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationCache.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationCache.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationCache.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationDatabase.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationDatabase.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationDatabase.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationEnv.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationEnv.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationEnv.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFeature.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFeature.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFeature.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFunction.validator copy.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFunction.validator copy.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFunction.validator copy.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationJob.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationJob.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationJob.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationNotification.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationNotification.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationNotification.validator.js.map +0 -1
- package/dist/postman.d.ts +0 -1
- package/dist/postman.js +0 -21674
- package/dist/postman.js.map +0 -1
- package/dist/processor/utils/mongo.util.d.ts +0 -0
- package/dist/processor/utils/mongo.util.js +0 -152
- package/dist/processor/utils/mongo.util.js.map +0 -1
- package/dist/processor/utils/postgres.util.d.ts +0 -14
- package/dist/processor/utils/postgres.util.js +0 -83
- package/dist/processor/utils/postgres.util.js.map +0 -1
- package/dist/products/services/utils/crypt.utils.d.ts +0 -1
- package/dist/products/services/utils/crypt.utils.js +0 -17
- package/dist/products/services/utils/crypt.utils.js.map +0 -1
- package/dist/products/services/utils/functions.utils.d.ts +0 -13
- package/dist/products/services/utils/functions.utils.js +0 -289
- package/dist/products/services/utils/functions.utils.js.map +0 -1
- package/dist/products/services/utils/objects.utils.d.ts +0 -13
- package/dist/products/services/utils/objects.utils.js +0 -89
- package/dist/products/services/utils/objects.utils.js.map +0 -1
- package/dist/products/services/utils/string.utils.d.ts +0 -12
- package/dist/products/services/utils/string.utils.js +0 -168
- package/dist/products/services/utils/string.utils.js.map +0 -1
- package/dist/products/validators/joi-validators/create.product.validator.d.ts +0 -3
- package/dist/products/validators/joi-validators/create.product.validator.js +0 -10
- package/dist/products/validators/joi-validators/create.product.validator.js.map +0 -1
- package/dist/products/validators/joi-validators/create.productGraphAction.validator.d.ts +0 -14
- package/dist/products/validators/joi-validators/create.productGraphAction.validator.js +0 -696
- package/dist/products/validators/joi-validators/create.productGraphAction.validator.js.map +0 -1
- package/dist/products/validators/joi-validators/update.productGraphAction.validator.d.ts +0 -7
- package/dist/products/validators/joi-validators/update.productGraphAction.validator.js +0 -72
- package/dist/products/validators/joi-validators/update.productGraphAction.validator.js.map +0 -1
- package/dist/test.appBuilder.js +0 -14
- package/dist/test.appBuilder.js.map +0 -1
- package/dist/test.import.d.ts +0 -0
- package/dist/test.import.js +0 -24
- package/dist/test.import.js.map +0 -1
- package/dist/test.imports.js +0 -28
- package/dist/test.imports.js.map +0 -1
- package/dist/test.integrationBuilder.js +0 -276
- package/dist/test.integrationBuilder.js.map +0 -1
- package/dist/test.processor.d.ts +0 -1
- package/dist/test.processor.js +0 -23
- package/dist/test.processor.js.map +0 -1
- package/dist/test.utils.d.ts +0 -1
- package/dist/test.utils.js +0 -25
- package/dist/test.utils.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types/integrationsBuilder.types.d.ts +0 -276
- package/dist/types/integrationsBuilder.types.js +0 -51
- package/dist/types/integrationsBuilder.types.js.map +0 -1
- /package/dist/{test.appBuilder.d.ts → test/test.database.d.ts} +0 -0
- /package/dist/{test.imports.d.ts → test/test.storage.d.ts} +0 -0
- /package/dist/{test.integrationBuilder.d.ts → test/test.triggers.d.ts} +0 -0
|
@@ -0,0 +1,1683 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Graph Service
|
|
4
|
+
*
|
|
5
|
+
* Main service class for graph database operations.
|
|
6
|
+
* Provides a unified API for working with different graph databases
|
|
7
|
+
* (Neo4j, Neptune, ArangoDB, Memgraph).
|
|
8
|
+
*
|
|
9
|
+
* Based on Ductape Graph API documentation.
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.GraphService = void 0;
|
|
49
|
+
const adapter_factory_1 = require("./adapters/adapter.factory");
|
|
50
|
+
const transaction_manager_1 = require("./transactions/transaction-manager");
|
|
51
|
+
const graph_error_1 = require("./utils/graph-error");
|
|
52
|
+
const products_service_1 = __importDefault(require("../products/services/products.service"));
|
|
53
|
+
const productsBuilder_types_1 = require("../types/productsBuilder.types");
|
|
54
|
+
const cache_manager_1 = require("../cache/cache.manager");
|
|
55
|
+
const processor_service_1 = __importDefault(require("../processor/services/processor.service"));
|
|
56
|
+
const crypto_1 = require("crypto");
|
|
57
|
+
const logs_service_1 = __importDefault(require("../logs/logs.service"));
|
|
58
|
+
const logs_types_1 = require("../logs/logs.types");
|
|
59
|
+
const processor_utils_1 = require("../processor/utils/processor.utils");
|
|
60
|
+
const secrets_1 = require("../secrets");
|
|
61
|
+
/**
|
|
62
|
+
* Main graph database service
|
|
63
|
+
*/
|
|
64
|
+
class GraphService {
|
|
65
|
+
constructor(config) {
|
|
66
|
+
/** Cache of adapters by connection key */
|
|
67
|
+
this.adapters = new Map();
|
|
68
|
+
/** Connection contexts */
|
|
69
|
+
this.connectionContexts = new Map();
|
|
70
|
+
/** Currently active connection context */
|
|
71
|
+
this.currentContext = null;
|
|
72
|
+
/** Transaction manager */
|
|
73
|
+
this.transactionManager = null;
|
|
74
|
+
/** Service configuration */
|
|
75
|
+
this.config = null;
|
|
76
|
+
/** Product builders cache */
|
|
77
|
+
this.productBuilders = new Map();
|
|
78
|
+
/** Local graph configurations */
|
|
79
|
+
this.localConfigs = new Map();
|
|
80
|
+
/** LogService instance for logging operations */
|
|
81
|
+
this.logService = null;
|
|
82
|
+
/** Current product ID for logging */
|
|
83
|
+
this.productId = '';
|
|
84
|
+
/** CacheManager for two-tier caching (Redis + remote) */
|
|
85
|
+
this.cacheManager = null;
|
|
86
|
+
/** Private keys cache for products (keyed by product tag) */
|
|
87
|
+
this.privateKeys = new Map();
|
|
88
|
+
// ==================== GRAPH ACTIONS ====================
|
|
89
|
+
/** Local cache of graph actions */
|
|
90
|
+
this.actions = new Map();
|
|
91
|
+
this.adapterFactory = new adapter_factory_1.GraphAdapterFactory();
|
|
92
|
+
if (config) {
|
|
93
|
+
this.config = config;
|
|
94
|
+
// Initialize CacheManager if Redis client is provided
|
|
95
|
+
if (config.redis_client) {
|
|
96
|
+
this.cacheManager = new cache_manager_1.CacheManager({
|
|
97
|
+
workspace_id: config.workspace_id,
|
|
98
|
+
public_key: config.public_key,
|
|
99
|
+
user_id: config.user_id,
|
|
100
|
+
token: config.token,
|
|
101
|
+
env_type: config.env_type,
|
|
102
|
+
redis_client: config.redis_client,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// ==================== CONFIGURATION ====================
|
|
108
|
+
/**
|
|
109
|
+
* Update service configuration
|
|
110
|
+
*/
|
|
111
|
+
updateConfig(config) {
|
|
112
|
+
this.config = config;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Get service configuration
|
|
116
|
+
*/
|
|
117
|
+
getConfig() {
|
|
118
|
+
return this.config;
|
|
119
|
+
}
|
|
120
|
+
// ==================== PRODUCT BUILDER MANAGEMENT ====================
|
|
121
|
+
/**
|
|
122
|
+
* Create a new ProductBuilder instance
|
|
123
|
+
*/
|
|
124
|
+
createNewProductBuilder() {
|
|
125
|
+
if (!this.config) {
|
|
126
|
+
throw graph_error_1.GraphError.configurationError('GraphService not configured. Please provide config when initializing.');
|
|
127
|
+
}
|
|
128
|
+
return new products_service_1.default({
|
|
129
|
+
workspace_id: this.config.workspace_id,
|
|
130
|
+
public_key: this.config.public_key,
|
|
131
|
+
user_id: this.config.user_id,
|
|
132
|
+
token: this.config.token,
|
|
133
|
+
env_type: this.config.env_type,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Get or create a ProductBuilder instance for the given product tag
|
|
138
|
+
*/
|
|
139
|
+
async getProductBuilder(productTag) {
|
|
140
|
+
let builder = this.productBuilders.get(productTag);
|
|
141
|
+
if (!builder) {
|
|
142
|
+
builder = this.createNewProductBuilder();
|
|
143
|
+
await builder.initializeProductByTag(productTag);
|
|
144
|
+
this.productBuilders.set(productTag, builder);
|
|
145
|
+
// Update productId for logging
|
|
146
|
+
this.productId = builder.fetchProductId() || '';
|
|
147
|
+
// Cache private key for caching operations
|
|
148
|
+
const privateKey = builder.fetchPrivateKey();
|
|
149
|
+
if (privateKey) {
|
|
150
|
+
this.privateKeys.set(productTag, privateKey);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return builder;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Initialize logging service
|
|
157
|
+
*/
|
|
158
|
+
initializeLogService() {
|
|
159
|
+
if (!this.logService && this.config) {
|
|
160
|
+
this.logService = new logs_service_1.default({
|
|
161
|
+
product_id: this.productId,
|
|
162
|
+
workspace_id: this.config.workspace_id,
|
|
163
|
+
public_key: this.config.public_key,
|
|
164
|
+
user_id: this.config.user_id,
|
|
165
|
+
token: this.config.token,
|
|
166
|
+
env_type: this.config.env_type,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Create a new ProcessorService instance for job scheduling
|
|
172
|
+
*/
|
|
173
|
+
createNewProcessor() {
|
|
174
|
+
if (!this.config) {
|
|
175
|
+
throw graph_error_1.GraphError.configurationError('GraphService not configured. Please provide config when initializing.');
|
|
176
|
+
}
|
|
177
|
+
return new processor_service_1.default({
|
|
178
|
+
workspace_id: this.config.workspace_id,
|
|
179
|
+
public_key: this.config.public_key,
|
|
180
|
+
user_id: this.config.user_id,
|
|
181
|
+
token: this.config.token,
|
|
182
|
+
env_type: this.config.env_type,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
// ==================== GRAPH REGISTRATION ====================
|
|
186
|
+
/**
|
|
187
|
+
* Register a new graph database
|
|
188
|
+
* As documented in getting-started.md
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```ts
|
|
192
|
+
* await ductape.graph.create({
|
|
193
|
+
* name: 'Social Graph',
|
|
194
|
+
* tag: 'social-graph',
|
|
195
|
+
* type: 'neo4j',
|
|
196
|
+
* description: 'Stores user relationships',
|
|
197
|
+
* envs: [
|
|
198
|
+
* { slug: 'dev', connection_url: 'bolt://localhost:7687' },
|
|
199
|
+
* { slug: 'prd', connection_url: 'bolt://neo4j-prod:7687' },
|
|
200
|
+
* ],
|
|
201
|
+
* });
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
async create(graphConfig, productTag) {
|
|
205
|
+
var _a;
|
|
206
|
+
// Validate required fields
|
|
207
|
+
if (!graphConfig.name || !graphConfig.tag || !graphConfig.type || !((_a = graphConfig.envs) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
208
|
+
throw graph_error_1.GraphError.validationError('Graph configuration requires name, tag, type, and at least one environment');
|
|
209
|
+
}
|
|
210
|
+
// Validate graph type
|
|
211
|
+
if (!this.adapterFactory.isSupported(graphConfig.type)) {
|
|
212
|
+
throw graph_error_1.GraphError.validationError(`Unsupported graph type: ${graphConfig.type}. ` +
|
|
213
|
+
`Supported types: ${this.adapterFactory.getSupportedTypes().join(', ')}`);
|
|
214
|
+
}
|
|
215
|
+
// If productTag is provided, use ProductBuilder to persist to backend
|
|
216
|
+
if (productTag) {
|
|
217
|
+
const builder = await this.getProductBuilder(productTag);
|
|
218
|
+
const productGraph = {
|
|
219
|
+
name: graphConfig.name,
|
|
220
|
+
tag: graphConfig.tag,
|
|
221
|
+
description: graphConfig.description,
|
|
222
|
+
type: graphConfig.type,
|
|
223
|
+
envs: graphConfig.envs.map((env) => ({
|
|
224
|
+
slug: env.slug,
|
|
225
|
+
connection_url: env.connection_url,
|
|
226
|
+
description: env.description,
|
|
227
|
+
database: env.database,
|
|
228
|
+
graphName: env.graphName,
|
|
229
|
+
region: env.region,
|
|
230
|
+
})),
|
|
231
|
+
};
|
|
232
|
+
await builder.createGraph(productGraph);
|
|
233
|
+
}
|
|
234
|
+
// Store locally
|
|
235
|
+
this.localConfigs.set(graphConfig.tag, graphConfig);
|
|
236
|
+
// Create adapters for each environment
|
|
237
|
+
for (const envConfig of graphConfig.envs) {
|
|
238
|
+
const contextKey = `${graphConfig.tag}:${envConfig.slug}`;
|
|
239
|
+
const adapter = this.adapterFactory.create(graphConfig.type);
|
|
240
|
+
this.adapters.set(contextKey, adapter);
|
|
241
|
+
// Store connection context (not connected yet)
|
|
242
|
+
this.connectionContexts.set(contextKey, {
|
|
243
|
+
graph: graphConfig.tag,
|
|
244
|
+
env: envConfig.slug,
|
|
245
|
+
type: graphConfig.type,
|
|
246
|
+
connectionUrl: envConfig.connection_url,
|
|
247
|
+
connected: false,
|
|
248
|
+
name: graphConfig.name,
|
|
249
|
+
description: graphConfig.description,
|
|
250
|
+
database: envConfig.database,
|
|
251
|
+
graphName: envConfig.graphName,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Fetch all registered graphs for a product
|
|
257
|
+
*/
|
|
258
|
+
async fetchAll(productTag) {
|
|
259
|
+
// Return local configs if no product tag
|
|
260
|
+
if (!productTag) {
|
|
261
|
+
return Array.from(this.localConfigs.values());
|
|
262
|
+
}
|
|
263
|
+
// Fetch from API using ProductBuilder
|
|
264
|
+
try {
|
|
265
|
+
const builder = await this.getProductBuilder(productTag);
|
|
266
|
+
const graphs = await builder.fetchGraphs();
|
|
267
|
+
// Convert IProductGraph[] to IGraphConfig[]
|
|
268
|
+
return graphs.map((graph) => this.productGraphToConfig(graph));
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
271
|
+
// Fall back to local configs if API fails
|
|
272
|
+
return Array.from(this.localConfigs.values());
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Fetch a specific graph configuration
|
|
277
|
+
*/
|
|
278
|
+
async fetch(graphTag, productTag) {
|
|
279
|
+
// If productTag is provided, fetch from API
|
|
280
|
+
if (productTag) {
|
|
281
|
+
try {
|
|
282
|
+
const builder = await this.getProductBuilder(productTag);
|
|
283
|
+
const graph = await builder.fetchGraph(graphTag);
|
|
284
|
+
if (graph) {
|
|
285
|
+
const config = this.productGraphToConfig(graph);
|
|
286
|
+
// Also update local cache
|
|
287
|
+
this.localConfigs.set(graphTag, config);
|
|
288
|
+
return config;
|
|
289
|
+
}
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
292
|
+
catch (error) {
|
|
293
|
+
// Fall back to local config
|
|
294
|
+
return this.localConfigs.get(graphTag) || null;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return this.localConfigs.get(graphTag) || null;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Update graph configuration
|
|
301
|
+
*/
|
|
302
|
+
async update(graphTag, updates, productTag) {
|
|
303
|
+
var _a;
|
|
304
|
+
// If productTag is provided, use ProductBuilder to update in backend
|
|
305
|
+
if (productTag) {
|
|
306
|
+
const builder = await this.getProductBuilder(productTag);
|
|
307
|
+
const productGraphUpdates = {
|
|
308
|
+
name: updates.name,
|
|
309
|
+
description: updates.description,
|
|
310
|
+
type: updates.type,
|
|
311
|
+
envs: (_a = updates.envs) === null || _a === void 0 ? void 0 : _a.map((env) => ({
|
|
312
|
+
slug: env.slug,
|
|
313
|
+
connection_url: env.connection_url,
|
|
314
|
+
description: env.description,
|
|
315
|
+
database: env.database,
|
|
316
|
+
graphName: env.graphName,
|
|
317
|
+
region: env.region,
|
|
318
|
+
})),
|
|
319
|
+
};
|
|
320
|
+
await builder.updateGraph(graphTag, productGraphUpdates);
|
|
321
|
+
}
|
|
322
|
+
const existing = this.localConfigs.get(graphTag);
|
|
323
|
+
if (!existing && !productTag) {
|
|
324
|
+
throw graph_error_1.GraphError.notFoundError(`Graph '${graphTag}' not found`);
|
|
325
|
+
}
|
|
326
|
+
const updated = Object.assign(Object.assign(Object.assign({}, (existing || {})), updates), { tag: graphTag });
|
|
327
|
+
this.localConfigs.set(graphTag, updated);
|
|
328
|
+
// Update connection contexts
|
|
329
|
+
if (updates.envs) {
|
|
330
|
+
for (const envConfig of updates.envs) {
|
|
331
|
+
const contextKey = `${graphTag}:${envConfig.slug}`;
|
|
332
|
+
const existingContext = this.connectionContexts.get(contextKey);
|
|
333
|
+
if (existingContext) {
|
|
334
|
+
this.connectionContexts.set(contextKey, Object.assign(Object.assign({}, existingContext), { connectionUrl: envConfig.connection_url, database: envConfig.database, graphName: envConfig.graphName }));
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Delete a graph configuration
|
|
341
|
+
*/
|
|
342
|
+
async delete(graphTag, productTag) {
|
|
343
|
+
var _a;
|
|
344
|
+
// If productTag is provided, use ProductBuilder to delete from backend
|
|
345
|
+
if (productTag) {
|
|
346
|
+
const builder = await this.getProductBuilder(productTag);
|
|
347
|
+
await builder.deleteGraph(graphTag);
|
|
348
|
+
}
|
|
349
|
+
// Get local config to clean up adapters and contexts
|
|
350
|
+
const config = this.localConfigs.get(graphTag);
|
|
351
|
+
if (config) {
|
|
352
|
+
// Clean up adapters and contexts for each environment
|
|
353
|
+
for (const envConfig of config.envs) {
|
|
354
|
+
const contextKey = `${graphTag}:${envConfig.slug}`;
|
|
355
|
+
// Disconnect adapter if connected
|
|
356
|
+
const adapter = this.adapters.get(contextKey);
|
|
357
|
+
if (adapter) {
|
|
358
|
+
try {
|
|
359
|
+
await adapter.disconnect();
|
|
360
|
+
}
|
|
361
|
+
catch (error) {
|
|
362
|
+
// Ignore disconnect errors during cleanup
|
|
363
|
+
}
|
|
364
|
+
this.adapters.delete(contextKey);
|
|
365
|
+
}
|
|
366
|
+
// Remove connection context
|
|
367
|
+
this.connectionContexts.delete(contextKey);
|
|
368
|
+
}
|
|
369
|
+
// Remove from local configs
|
|
370
|
+
this.localConfigs.delete(graphTag);
|
|
371
|
+
// Clear current context if it was the deleted graph
|
|
372
|
+
if (((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.graph) === graphTag) {
|
|
373
|
+
this.currentContext = null;
|
|
374
|
+
this.transactionManager = null;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
else if (!productTag) {
|
|
378
|
+
throw graph_error_1.GraphError.notFoundError(`Graph '${graphTag}' not found`);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Convert IProductGraph to IGraphConfig
|
|
383
|
+
*/
|
|
384
|
+
productGraphToConfig(graph) {
|
|
385
|
+
return {
|
|
386
|
+
name: graph.name,
|
|
387
|
+
tag: graph.tag,
|
|
388
|
+
type: graph.type,
|
|
389
|
+
description: graph.description,
|
|
390
|
+
envs: graph.envs.map((env) => ({
|
|
391
|
+
slug: env.slug,
|
|
392
|
+
connection_url: env.connection_url,
|
|
393
|
+
description: env.description,
|
|
394
|
+
database: env.database,
|
|
395
|
+
graphName: env.graphName,
|
|
396
|
+
region: env.region,
|
|
397
|
+
})),
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
// ==================== CONNECTION MANAGEMENT ====================
|
|
401
|
+
/**
|
|
402
|
+
* Connect to a graph database
|
|
403
|
+
* As documented in getting-started.md
|
|
404
|
+
*
|
|
405
|
+
* @example
|
|
406
|
+
* ```ts
|
|
407
|
+
* await ductape.graph.connect({
|
|
408
|
+
* env: 'dev',
|
|
409
|
+
* product: 'my-app',
|
|
410
|
+
* graph: 'social-graph',
|
|
411
|
+
* });
|
|
412
|
+
* ```
|
|
413
|
+
*/
|
|
414
|
+
async connect(config) {
|
|
415
|
+
var _a, _b, _c, _d, _e, _f;
|
|
416
|
+
const process_id = (0, processor_utils_1.generateObjectId)();
|
|
417
|
+
const contextKey = `${config.graph}:${config.env}`;
|
|
418
|
+
// Get adapter
|
|
419
|
+
let adapter = this.adapters.get(contextKey);
|
|
420
|
+
let context = this.connectionContexts.get(contextKey);
|
|
421
|
+
// If not locally registered, try to fetch from API
|
|
422
|
+
if (!adapter || !context) {
|
|
423
|
+
// Initialize product builder to get productId for logging
|
|
424
|
+
if (config.product) {
|
|
425
|
+
await this.getProductBuilder(config.product);
|
|
426
|
+
}
|
|
427
|
+
const graphConfig = await this.fetchGraphFromProduct(config.product, config.graph);
|
|
428
|
+
if (!graphConfig) {
|
|
429
|
+
throw graph_error_1.GraphError.notFoundError(`Graph '${config.graph}' not found in product '${config.product}'`);
|
|
430
|
+
}
|
|
431
|
+
// Register the graph locally
|
|
432
|
+
await this.create(graphConfig);
|
|
433
|
+
adapter = this.adapters.get(contextKey);
|
|
434
|
+
context = this.connectionContexts.get(contextKey);
|
|
435
|
+
}
|
|
436
|
+
if (!adapter || !context) {
|
|
437
|
+
throw graph_error_1.GraphError.configurationError(`Failed to initialize adapter for ${contextKey}`);
|
|
438
|
+
}
|
|
439
|
+
// Initialize logging
|
|
440
|
+
this.initializeLogService();
|
|
441
|
+
const baseLogs = {
|
|
442
|
+
product_tag: config.product || '',
|
|
443
|
+
workspace_id: ((_a = this.config) === null || _a === void 0 ? void 0 : _a.workspace_id) || '',
|
|
444
|
+
env: config.env,
|
|
445
|
+
process_id,
|
|
446
|
+
type: logs_types_1.LogEventTypes.GRAPH,
|
|
447
|
+
parent_tag: config.graph,
|
|
448
|
+
data: { graph: config.graph, env: config.env },
|
|
449
|
+
};
|
|
450
|
+
(_b = this.logService) === null || _b === void 0 ? void 0 : _b.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph connect - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
|
|
451
|
+
try {
|
|
452
|
+
// Resolve secret references in connection URL
|
|
453
|
+
let connectionUrl = context.connectionUrl;
|
|
454
|
+
const secretCheck = (0, secrets_1.isSecretReference)(connectionUrl);
|
|
455
|
+
if (secretCheck.isSecret) {
|
|
456
|
+
const secretsService = (0, secrets_1.getSecretsService)();
|
|
457
|
+
if (secretsService) {
|
|
458
|
+
const resolved = await secretsService.resolve(connectionUrl, { env: config.env });
|
|
459
|
+
connectionUrl = resolved.value;
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
throw graph_error_1.GraphError.configurationError(`Connection URL contains secret reference '${connectionUrl}' but secrets service is not initialized. ` +
|
|
463
|
+
`Please ensure the Ductape client is properly initialized.`);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
// Connect
|
|
467
|
+
const result = await adapter.connect({
|
|
468
|
+
connectionUrl,
|
|
469
|
+
database: context.database,
|
|
470
|
+
graphName: context.graphName,
|
|
471
|
+
options: config.options,
|
|
472
|
+
});
|
|
473
|
+
// Update context
|
|
474
|
+
context.connected = result.connected;
|
|
475
|
+
context.product = config.product;
|
|
476
|
+
this.connectionContexts.set(contextKey, context);
|
|
477
|
+
// Set as current context
|
|
478
|
+
this.currentContext = context;
|
|
479
|
+
// Initialize transaction manager
|
|
480
|
+
this.transactionManager = new transaction_manager_1.GraphTransactionManager(adapter);
|
|
481
|
+
(_c = this.logService) === null || _c === void 0 ? void 0 : _c.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph connect - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
|
|
482
|
+
(_d = this.logService) === null || _d === void 0 ? void 0 : _d.publish();
|
|
483
|
+
return result;
|
|
484
|
+
}
|
|
485
|
+
catch (error) {
|
|
486
|
+
(_e = this.logService) === null || _e === void 0 ? void 0 : _e.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph connect - failed', failed_execution: true, data: { graph: config.graph, env: config.env, error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
|
|
487
|
+
await ((_f = this.logService) === null || _f === void 0 ? void 0 : _f.publish());
|
|
488
|
+
throw error;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Test connection to a graph database
|
|
493
|
+
*/
|
|
494
|
+
async testConnection(config) {
|
|
495
|
+
const contextKey = `${config.graph}:${config.env}`;
|
|
496
|
+
const context = this.connectionContexts.get(contextKey);
|
|
497
|
+
if (!context) {
|
|
498
|
+
throw graph_error_1.GraphError.notFoundError(`Graph configuration not found for ${config.graph}:${config.env}`);
|
|
499
|
+
}
|
|
500
|
+
const adapter = this.adapterFactory.create(context.type);
|
|
501
|
+
return adapter.testConnection({
|
|
502
|
+
connectionUrl: context.connectionUrl,
|
|
503
|
+
database: context.database,
|
|
504
|
+
graphName: context.graphName,
|
|
505
|
+
options: config.options,
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Disconnect from current graph
|
|
510
|
+
*/
|
|
511
|
+
async disconnect() {
|
|
512
|
+
if (this.currentContext) {
|
|
513
|
+
const contextKey = `${this.currentContext.graph}:${this.currentContext.env}`;
|
|
514
|
+
const adapter = this.adapters.get(contextKey);
|
|
515
|
+
if (adapter) {
|
|
516
|
+
// Rollback any pending transactions
|
|
517
|
+
if (this.transactionManager) {
|
|
518
|
+
await this.transactionManager.rollbackAll();
|
|
519
|
+
}
|
|
520
|
+
await adapter.disconnect();
|
|
521
|
+
this.currentContext.connected = false;
|
|
522
|
+
}
|
|
523
|
+
this.currentContext = null;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Disconnect from all graphs
|
|
528
|
+
*/
|
|
529
|
+
async disconnectAll() {
|
|
530
|
+
for (const [key, adapter] of this.adapters.entries()) {
|
|
531
|
+
try {
|
|
532
|
+
await adapter.disconnect();
|
|
533
|
+
const context = this.connectionContexts.get(key);
|
|
534
|
+
if (context) {
|
|
535
|
+
context.connected = false;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
catch (error) {
|
|
539
|
+
console.error(`Failed to disconnect ${key}:`, error);
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
if (this.transactionManager) {
|
|
543
|
+
await this.transactionManager.rollbackAll();
|
|
544
|
+
}
|
|
545
|
+
this.currentContext = null;
|
|
546
|
+
}
|
|
547
|
+
// ==================== NODE OPERATIONS ====================
|
|
548
|
+
/**
|
|
549
|
+
* Create a node
|
|
550
|
+
* As documented in nodes.md
|
|
551
|
+
*/
|
|
552
|
+
async createNode(options, transaction) {
|
|
553
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
554
|
+
const process_id = (0, processor_utils_1.generateObjectId)();
|
|
555
|
+
this.initializeLogService();
|
|
556
|
+
const baseLogs = {
|
|
557
|
+
product_tag: ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.product) || '',
|
|
558
|
+
workspace_id: ((_b = this.config) === null || _b === void 0 ? void 0 : _b.workspace_id) || '',
|
|
559
|
+
env: ((_c = this.currentContext) === null || _c === void 0 ? void 0 : _c.env) || '',
|
|
560
|
+
process_id,
|
|
561
|
+
type: logs_types_1.LogEventTypes.GRAPH,
|
|
562
|
+
parent_tag: ((_d = this.currentContext) === null || _d === void 0 ? void 0 : _d.graph) || '',
|
|
563
|
+
data: { labels: options.labels, operation: 'createNode' },
|
|
564
|
+
};
|
|
565
|
+
(_e = this.logService) === null || _e === void 0 ? void 0 : _e.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph createNode - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
|
|
566
|
+
try {
|
|
567
|
+
const adapter = this.getAdapter();
|
|
568
|
+
const result = await adapter.createNode(options, transaction);
|
|
569
|
+
(_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph createNode - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
|
|
570
|
+
(_g = this.logService) === null || _g === void 0 ? void 0 : _g.publish();
|
|
571
|
+
return result;
|
|
572
|
+
}
|
|
573
|
+
catch (error) {
|
|
574
|
+
(_h = this.logService) === null || _h === void 0 ? void 0 : _h.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph createNode - failed', failed_execution: true, data: { labels: options.labels, operation: 'createNode', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
|
|
575
|
+
await ((_j = this.logService) === null || _j === void 0 ? void 0 : _j.publish());
|
|
576
|
+
throw error;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Find nodes by criteria
|
|
581
|
+
* As documented in nodes.md
|
|
582
|
+
*/
|
|
583
|
+
async findNodes(options, transaction) {
|
|
584
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
585
|
+
const process_id = (0, processor_utils_1.generateObjectId)();
|
|
586
|
+
this.initializeLogService();
|
|
587
|
+
const baseLogs = {
|
|
588
|
+
product_tag: ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.product) || '',
|
|
589
|
+
workspace_id: ((_b = this.config) === null || _b === void 0 ? void 0 : _b.workspace_id) || '',
|
|
590
|
+
env: ((_c = this.currentContext) === null || _c === void 0 ? void 0 : _c.env) || '',
|
|
591
|
+
process_id,
|
|
592
|
+
type: logs_types_1.LogEventTypes.GRAPH,
|
|
593
|
+
parent_tag: ((_d = this.currentContext) === null || _d === void 0 ? void 0 : _d.graph) || '',
|
|
594
|
+
data: { labels: options.labels, operation: 'findNodes' },
|
|
595
|
+
};
|
|
596
|
+
(_e = this.logService) === null || _e === void 0 ? void 0 : _e.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph findNodes - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
|
|
597
|
+
try {
|
|
598
|
+
// Check cache if cache tag is provided
|
|
599
|
+
const productTag = (_f = this.currentContext) === null || _f === void 0 ? void 0 : _f.product;
|
|
600
|
+
const privateKey = productTag ? this.privateKeys.get(productTag) : undefined;
|
|
601
|
+
if (options.cache && this.cacheManager && privateKey) {
|
|
602
|
+
const cacheOptions = {
|
|
603
|
+
cache_tag: options.cache,
|
|
604
|
+
product_tag: productTag || '',
|
|
605
|
+
component_tag: ((_g = this.currentContext) === null || _g === void 0 ? void 0 : _g.graph) || '',
|
|
606
|
+
component_type: 'graph',
|
|
607
|
+
input: { labels: options.labels, where: options.where, select: options.select, orderBy: options.orderBy, limit: options.limit, offset: options.offset },
|
|
608
|
+
privateKey,
|
|
609
|
+
};
|
|
610
|
+
const cached = await this.cacheManager.fetch(cacheOptions);
|
|
611
|
+
if (cached.hit && cached.data) {
|
|
612
|
+
(_h = this.logService) === null || _h === void 0 ? void 0 : _h.add(Object.assign(Object.assign({}, baseLogs), { message: `Graph findNodes - cache hit (${cached.source})`, successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
|
|
613
|
+
(_j = this.logService) === null || _j === void 0 ? void 0 : _j.publish();
|
|
614
|
+
return cached.data;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
const adapter = this.getAdapter();
|
|
618
|
+
const result = await adapter.findNodes(options, transaction);
|
|
619
|
+
// Store in cache if cache tag is provided
|
|
620
|
+
if (options.cache && this.cacheManager && privateKey) {
|
|
621
|
+
const cacheOptions = {
|
|
622
|
+
cache_tag: options.cache,
|
|
623
|
+
product_tag: productTag || '',
|
|
624
|
+
component_tag: ((_k = this.currentContext) === null || _k === void 0 ? void 0 : _k.graph) || '',
|
|
625
|
+
component_type: 'graph',
|
|
626
|
+
input: { labels: options.labels, where: options.where, select: options.select, orderBy: options.orderBy, limit: options.limit, offset: options.offset },
|
|
627
|
+
privateKey,
|
|
628
|
+
};
|
|
629
|
+
await this.cacheManager.store(cacheOptions, result);
|
|
630
|
+
}
|
|
631
|
+
(_l = this.logService) === null || _l === void 0 ? void 0 : _l.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph findNodes - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
|
|
632
|
+
(_m = this.logService) === null || _m === void 0 ? void 0 : _m.publish();
|
|
633
|
+
return result;
|
|
634
|
+
}
|
|
635
|
+
catch (error) {
|
|
636
|
+
(_o = this.logService) === null || _o === void 0 ? void 0 : _o.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph findNodes - failed', failed_execution: true, data: { labels: options.labels, operation: 'findNodes', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
|
|
637
|
+
await ((_p = this.logService) === null || _p === void 0 ? void 0 : _p.publish());
|
|
638
|
+
throw error;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Find a node by ID
|
|
643
|
+
* As documented in nodes.md
|
|
644
|
+
*/
|
|
645
|
+
async findNodeById(id, transaction) {
|
|
646
|
+
const adapter = this.getAdapter();
|
|
647
|
+
return adapter.findNodeById(id, transaction);
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* Update a node
|
|
651
|
+
* As documented in nodes.md
|
|
652
|
+
*/
|
|
653
|
+
async updateNode(options, transaction) {
|
|
654
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
655
|
+
const process_id = (0, processor_utils_1.generateObjectId)();
|
|
656
|
+
this.initializeLogService();
|
|
657
|
+
const baseLogs = {
|
|
658
|
+
product_tag: ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.product) || '',
|
|
659
|
+
workspace_id: ((_b = this.config) === null || _b === void 0 ? void 0 : _b.workspace_id) || '',
|
|
660
|
+
env: ((_c = this.currentContext) === null || _c === void 0 ? void 0 : _c.env) || '',
|
|
661
|
+
process_id,
|
|
662
|
+
type: logs_types_1.LogEventTypes.GRAPH,
|
|
663
|
+
parent_tag: ((_d = this.currentContext) === null || _d === void 0 ? void 0 : _d.graph) || '',
|
|
664
|
+
data: { id: options.id, operation: 'updateNode' },
|
|
665
|
+
};
|
|
666
|
+
(_e = this.logService) === null || _e === void 0 ? void 0 : _e.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph updateNode - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
|
|
667
|
+
try {
|
|
668
|
+
const adapter = this.getAdapter();
|
|
669
|
+
const result = await adapter.updateNode(options, transaction);
|
|
670
|
+
(_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph updateNode - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
|
|
671
|
+
(_g = this.logService) === null || _g === void 0 ? void 0 : _g.publish();
|
|
672
|
+
return result;
|
|
673
|
+
}
|
|
674
|
+
catch (error) {
|
|
675
|
+
(_h = this.logService) === null || _h === void 0 ? void 0 : _h.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph updateNode - failed', failed_execution: true, data: { id: options.id, operation: 'updateNode', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
|
|
676
|
+
await ((_j = this.logService) === null || _j === void 0 ? void 0 : _j.publish());
|
|
677
|
+
throw error;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* Delete a node
|
|
682
|
+
* As documented in nodes.md
|
|
683
|
+
*/
|
|
684
|
+
async deleteNode(options, transaction) {
|
|
685
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
686
|
+
const process_id = (0, processor_utils_1.generateObjectId)();
|
|
687
|
+
this.initializeLogService();
|
|
688
|
+
const baseLogs = {
|
|
689
|
+
product_tag: ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.product) || '',
|
|
690
|
+
workspace_id: ((_b = this.config) === null || _b === void 0 ? void 0 : _b.workspace_id) || '',
|
|
691
|
+
env: ((_c = this.currentContext) === null || _c === void 0 ? void 0 : _c.env) || '',
|
|
692
|
+
process_id,
|
|
693
|
+
type: logs_types_1.LogEventTypes.GRAPH,
|
|
694
|
+
parent_tag: ((_d = this.currentContext) === null || _d === void 0 ? void 0 : _d.graph) || '',
|
|
695
|
+
data: { id: options.id, operation: 'deleteNode' },
|
|
696
|
+
};
|
|
697
|
+
(_e = this.logService) === null || _e === void 0 ? void 0 : _e.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph deleteNode - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
|
|
698
|
+
try {
|
|
699
|
+
const adapter = this.getAdapter();
|
|
700
|
+
const result = await adapter.deleteNode(options, transaction);
|
|
701
|
+
(_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph deleteNode - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
|
|
702
|
+
(_g = this.logService) === null || _g === void 0 ? void 0 : _g.publish();
|
|
703
|
+
return result;
|
|
704
|
+
}
|
|
705
|
+
catch (error) {
|
|
706
|
+
(_h = this.logService) === null || _h === void 0 ? void 0 : _h.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph deleteNode - failed', failed_execution: true, data: { id: options.id, operation: 'deleteNode', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
|
|
707
|
+
await ((_j = this.logService) === null || _j === void 0 ? void 0 : _j.publish());
|
|
708
|
+
throw error;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
/**
|
|
712
|
+
* Merge (upsert) a node
|
|
713
|
+
* As documented in nodes.md
|
|
714
|
+
*/
|
|
715
|
+
async mergeNode(options, transaction) {
|
|
716
|
+
const adapter = this.getAdapter();
|
|
717
|
+
return adapter.mergeNode(options, transaction);
|
|
718
|
+
}
|
|
719
|
+
// ==================== LABEL MANAGEMENT ====================
|
|
720
|
+
/**
|
|
721
|
+
* Add labels to an existing node
|
|
722
|
+
*
|
|
723
|
+
* @example
|
|
724
|
+
* ```ts
|
|
725
|
+
* const result = await graphService.addLabels({
|
|
726
|
+
* id: 'node-123',
|
|
727
|
+
* labels: ['Admin', 'Verified'],
|
|
728
|
+
* });
|
|
729
|
+
* console.log(result.node.labels); // ['Person', 'Admin', 'Verified']
|
|
730
|
+
* ```
|
|
731
|
+
*/
|
|
732
|
+
async addLabels(options, transaction) {
|
|
733
|
+
const adapter = this.getAdapter();
|
|
734
|
+
return adapter.addLabels(options, transaction);
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Remove labels from an existing node
|
|
738
|
+
*
|
|
739
|
+
* @example
|
|
740
|
+
* ```ts
|
|
741
|
+
* const result = await graphService.removeLabels({
|
|
742
|
+
* id: 'node-123',
|
|
743
|
+
* labels: ['Temporary'],
|
|
744
|
+
* });
|
|
745
|
+
* console.log(result.removedLabels); // ['Temporary']
|
|
746
|
+
* ```
|
|
747
|
+
*/
|
|
748
|
+
async removeLabels(options, transaction) {
|
|
749
|
+
const adapter = this.getAdapter();
|
|
750
|
+
return adapter.removeLabels(options, transaction);
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* Set labels on a node (replaces all existing labels)
|
|
754
|
+
*
|
|
755
|
+
* @example
|
|
756
|
+
* ```ts
|
|
757
|
+
* const result = await graphService.setLabels({
|
|
758
|
+
* id: 'node-123',
|
|
759
|
+
* labels: ['Person', 'Employee'],
|
|
760
|
+
* });
|
|
761
|
+
* console.log(result.previousLabels); // ['Person', 'Contractor']
|
|
762
|
+
* console.log(result.newLabels); // ['Person', 'Employee']
|
|
763
|
+
* ```
|
|
764
|
+
*/
|
|
765
|
+
async setLabels(options, transaction) {
|
|
766
|
+
const adapter = this.getAdapter();
|
|
767
|
+
return adapter.setLabels(options, transaction);
|
|
768
|
+
}
|
|
769
|
+
// ==================== RELATIONSHIP OPERATIONS ====================
|
|
770
|
+
/**
|
|
771
|
+
* Create a relationship
|
|
772
|
+
* As documented in relationships.md
|
|
773
|
+
*/
|
|
774
|
+
async createRelationship(options, transaction) {
|
|
775
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
776
|
+
const process_id = (0, processor_utils_1.generateObjectId)();
|
|
777
|
+
this.initializeLogService();
|
|
778
|
+
const baseLogs = {
|
|
779
|
+
product_tag: ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.product) || '',
|
|
780
|
+
workspace_id: ((_b = this.config) === null || _b === void 0 ? void 0 : _b.workspace_id) || '',
|
|
781
|
+
env: ((_c = this.currentContext) === null || _c === void 0 ? void 0 : _c.env) || '',
|
|
782
|
+
process_id,
|
|
783
|
+
type: logs_types_1.LogEventTypes.GRAPH,
|
|
784
|
+
parent_tag: ((_d = this.currentContext) === null || _d === void 0 ? void 0 : _d.graph) || '',
|
|
785
|
+
data: { type: options.type, operation: 'createRelationship' },
|
|
786
|
+
};
|
|
787
|
+
(_e = this.logService) === null || _e === void 0 ? void 0 : _e.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph createRelationship - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
|
|
788
|
+
try {
|
|
789
|
+
const adapter = this.getAdapter();
|
|
790
|
+
const result = await adapter.createRelationship(options, transaction);
|
|
791
|
+
(_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph createRelationship - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
|
|
792
|
+
(_g = this.logService) === null || _g === void 0 ? void 0 : _g.publish();
|
|
793
|
+
return result;
|
|
794
|
+
}
|
|
795
|
+
catch (error) {
|
|
796
|
+
(_h = this.logService) === null || _h === void 0 ? void 0 : _h.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph createRelationship - failed', failed_execution: true, data: { type: options.type, operation: 'createRelationship', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
|
|
797
|
+
await ((_j = this.logService) === null || _j === void 0 ? void 0 : _j.publish());
|
|
798
|
+
throw error;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
/**
|
|
802
|
+
* Find relationships by criteria
|
|
803
|
+
* As documented in relationships.md
|
|
804
|
+
*/
|
|
805
|
+
async findRelationships(options, transaction) {
|
|
806
|
+
const adapter = this.getAdapter();
|
|
807
|
+
return adapter.findRelationships(options, transaction);
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Find a relationship by ID
|
|
811
|
+
*/
|
|
812
|
+
async findRelationshipById(id, transaction) {
|
|
813
|
+
const adapter = this.getAdapter();
|
|
814
|
+
return adapter.findRelationshipById(id, transaction);
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* Update a relationship
|
|
818
|
+
* As documented in relationships.md
|
|
819
|
+
*/
|
|
820
|
+
async updateRelationship(options, transaction) {
|
|
821
|
+
const adapter = this.getAdapter();
|
|
822
|
+
return adapter.updateRelationship(options, transaction);
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Delete a relationship
|
|
826
|
+
* As documented in relationships.md
|
|
827
|
+
*/
|
|
828
|
+
async deleteRelationship(options, transaction) {
|
|
829
|
+
const adapter = this.getAdapter();
|
|
830
|
+
return adapter.deleteRelationship(options, transaction);
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* Merge (upsert) a relationship
|
|
834
|
+
* As documented in relationships.md
|
|
835
|
+
*/
|
|
836
|
+
async mergeRelationship(options, transaction) {
|
|
837
|
+
const adapter = this.getAdapter();
|
|
838
|
+
return adapter.mergeRelationship(options, transaction);
|
|
839
|
+
}
|
|
840
|
+
// ==================== TRAVERSAL OPERATIONS ====================
|
|
841
|
+
/**
|
|
842
|
+
* Traverse the graph from a starting node
|
|
843
|
+
* As documented in traversals.md
|
|
844
|
+
*/
|
|
845
|
+
async traverse(options, transaction) {
|
|
846
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
847
|
+
const process_id = (0, processor_utils_1.generateObjectId)();
|
|
848
|
+
this.initializeLogService();
|
|
849
|
+
const baseLogs = {
|
|
850
|
+
product_tag: ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.product) || '',
|
|
851
|
+
workspace_id: ((_b = this.config) === null || _b === void 0 ? void 0 : _b.workspace_id) || '',
|
|
852
|
+
env: ((_c = this.currentContext) === null || _c === void 0 ? void 0 : _c.env) || '',
|
|
853
|
+
process_id,
|
|
854
|
+
type: logs_types_1.LogEventTypes.GRAPH,
|
|
855
|
+
parent_tag: ((_d = this.currentContext) === null || _d === void 0 ? void 0 : _d.graph) || '',
|
|
856
|
+
data: { startNodeId: options.startNodeId, operation: 'traverse' },
|
|
857
|
+
};
|
|
858
|
+
(_e = this.logService) === null || _e === void 0 ? void 0 : _e.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph traverse - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
|
|
859
|
+
try {
|
|
860
|
+
const adapter = this.getAdapter();
|
|
861
|
+
const result = await adapter.traverse(options, transaction);
|
|
862
|
+
(_f = this.logService) === null || _f === void 0 ? void 0 : _f.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph traverse - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
|
|
863
|
+
(_g = this.logService) === null || _g === void 0 ? void 0 : _g.publish();
|
|
864
|
+
return result;
|
|
865
|
+
}
|
|
866
|
+
catch (error) {
|
|
867
|
+
(_h = this.logService) === null || _h === void 0 ? void 0 : _h.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph traverse - failed', failed_execution: true, data: { startNodeId: options.startNodeId, operation: 'traverse', error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
|
|
868
|
+
await ((_j = this.logService) === null || _j === void 0 ? void 0 : _j.publish());
|
|
869
|
+
throw error;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Find the shortest path between two nodes
|
|
874
|
+
* As documented in traversals.md
|
|
875
|
+
*/
|
|
876
|
+
async shortestPath(options, transaction) {
|
|
877
|
+
const adapter = this.getAdapter();
|
|
878
|
+
return adapter.shortestPath(options, transaction);
|
|
879
|
+
}
|
|
880
|
+
/**
|
|
881
|
+
* Find all paths between two nodes
|
|
882
|
+
* As documented in traversals.md
|
|
883
|
+
*/
|
|
884
|
+
async allPaths(options, transaction) {
|
|
885
|
+
const adapter = this.getAdapter();
|
|
886
|
+
return adapter.allPaths(options, transaction);
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Get the neighborhood of a node
|
|
890
|
+
* As documented in traversals.md
|
|
891
|
+
*/
|
|
892
|
+
async getNeighborhood(options, transaction) {
|
|
893
|
+
const adapter = this.getAdapter();
|
|
894
|
+
return adapter.getNeighborhood(options, transaction);
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* Find connected components in the graph
|
|
898
|
+
* As documented in traversals.md
|
|
899
|
+
*/
|
|
900
|
+
async findConnectedComponents(options, transaction) {
|
|
901
|
+
const adapter = this.getAdapter();
|
|
902
|
+
return adapter.findConnectedComponents(options, transaction);
|
|
903
|
+
}
|
|
904
|
+
// ==================== AGGREGATION OPERATIONS ====================
|
|
905
|
+
/**
|
|
906
|
+
* Count nodes matching criteria
|
|
907
|
+
* As documented in overview.md
|
|
908
|
+
*/
|
|
909
|
+
async countNodes(labels, where, transaction) {
|
|
910
|
+
const adapter = this.getAdapter();
|
|
911
|
+
return adapter.countNodes(labels, where, transaction);
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Count relationships matching criteria
|
|
915
|
+
* As documented in overview.md
|
|
916
|
+
*/
|
|
917
|
+
async countRelationships(types, where, transaction) {
|
|
918
|
+
const adapter = this.getAdapter();
|
|
919
|
+
return adapter.countRelationships(types, where, transaction);
|
|
920
|
+
}
|
|
921
|
+
/**
|
|
922
|
+
* Get graph statistics
|
|
923
|
+
* As documented in overview.md
|
|
924
|
+
*/
|
|
925
|
+
async getStatistics(transaction) {
|
|
926
|
+
const adapter = this.getAdapter();
|
|
927
|
+
return adapter.getStatistics(transaction);
|
|
928
|
+
}
|
|
929
|
+
// ==================== SEARCH OPERATIONS ====================
|
|
930
|
+
/**
|
|
931
|
+
* Full-text search
|
|
932
|
+
* As documented in overview.md
|
|
933
|
+
*/
|
|
934
|
+
async fullTextSearch(options, transaction) {
|
|
935
|
+
const adapter = this.getAdapter();
|
|
936
|
+
return adapter.fullTextSearch(options, transaction);
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* Vector similarity search
|
|
940
|
+
* As documented in overview.md
|
|
941
|
+
*/
|
|
942
|
+
async vectorSearch(options, transaction) {
|
|
943
|
+
const adapter = this.getAdapter();
|
|
944
|
+
return adapter.vectorSearch(options, transaction);
|
|
945
|
+
}
|
|
946
|
+
// ==================== RAW QUERY ====================
|
|
947
|
+
/**
|
|
948
|
+
* Execute a raw query
|
|
949
|
+
* As documented in overview.md
|
|
950
|
+
*
|
|
951
|
+
* @example
|
|
952
|
+
* ```ts
|
|
953
|
+
* const result = await ductape.graph.query(
|
|
954
|
+
* 'MATCH (p:Person)-[:FRIENDS_WITH]->(f) WHERE p.name = $name RETURN f',
|
|
955
|
+
* { name: 'Alice' }
|
|
956
|
+
* );
|
|
957
|
+
* ```
|
|
958
|
+
*/
|
|
959
|
+
async query(query, params, transaction) {
|
|
960
|
+
const adapter = this.getAdapter();
|
|
961
|
+
return adapter.query({ query, params }, transaction);
|
|
962
|
+
}
|
|
963
|
+
// ==================== SCHEMA OPERATIONS ====================
|
|
964
|
+
/**
|
|
965
|
+
* Create a node index
|
|
966
|
+
* As documented in overview.md
|
|
967
|
+
*/
|
|
968
|
+
async createNodeIndex(options) {
|
|
969
|
+
const adapter = this.getAdapter();
|
|
970
|
+
return adapter.createNodeIndex(options);
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* Create a node constraint
|
|
974
|
+
* As documented in overview.md
|
|
975
|
+
*/
|
|
976
|
+
async createNodeConstraint(options) {
|
|
977
|
+
const adapter = this.getAdapter();
|
|
978
|
+
return adapter.createNodeConstraint(options);
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* Create a relationship index
|
|
982
|
+
*/
|
|
983
|
+
async createRelationshipIndex(options) {
|
|
984
|
+
const adapter = this.getAdapter();
|
|
985
|
+
return adapter.createRelationshipIndex(options);
|
|
986
|
+
}
|
|
987
|
+
/**
|
|
988
|
+
* List all indexes
|
|
989
|
+
* As documented in overview.md
|
|
990
|
+
*/
|
|
991
|
+
async listIndexes() {
|
|
992
|
+
const adapter = this.getAdapter();
|
|
993
|
+
return adapter.listIndexes();
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* List all constraints
|
|
997
|
+
*/
|
|
998
|
+
async listConstraints() {
|
|
999
|
+
const adapter = this.getAdapter();
|
|
1000
|
+
return adapter.listConstraints();
|
|
1001
|
+
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Drop an index
|
|
1004
|
+
*/
|
|
1005
|
+
async dropIndex(name) {
|
|
1006
|
+
const adapter = this.getAdapter();
|
|
1007
|
+
return adapter.dropIndex(name);
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Drop a constraint
|
|
1011
|
+
*/
|
|
1012
|
+
async dropConstraint(name) {
|
|
1013
|
+
const adapter = this.getAdapter();
|
|
1014
|
+
return adapter.dropConstraint(name);
|
|
1015
|
+
}
|
|
1016
|
+
// ==================== SCHEMA INTROSPECTION ====================
|
|
1017
|
+
/**
|
|
1018
|
+
* List all node labels with counts and property information
|
|
1019
|
+
* Used for GraphExplorer sidebar
|
|
1020
|
+
*/
|
|
1021
|
+
async listLabels() {
|
|
1022
|
+
const adapter = this.getAdapter();
|
|
1023
|
+
return adapter.listLabels();
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* List all relationship types with counts
|
|
1027
|
+
* Used for GraphExplorer sidebar
|
|
1028
|
+
*/
|
|
1029
|
+
async listRelationshipTypes() {
|
|
1030
|
+
const adapter = this.getAdapter();
|
|
1031
|
+
return adapter.listRelationshipTypes();
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* Generate a URL-safe tag from a name
|
|
1035
|
+
*/
|
|
1036
|
+
generateActionTag(name) {
|
|
1037
|
+
return name
|
|
1038
|
+
.toLowerCase()
|
|
1039
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
1040
|
+
.replace(/^-+|-+$/g, '');
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Create a new graph action (saved parameterized query)
|
|
1044
|
+
*
|
|
1045
|
+
* @example
|
|
1046
|
+
* ```ts
|
|
1047
|
+
* const action = await graphService.createAction({
|
|
1048
|
+
* name: 'Find Persons',
|
|
1049
|
+
* description: 'Find persons with configurable limit',
|
|
1050
|
+
* operation: 'findNodes',
|
|
1051
|
+
* query: {
|
|
1052
|
+
* operation: 'findNodes',
|
|
1053
|
+
* options: { labels: ['Person'], limit: '{{limit}}' }
|
|
1054
|
+
* },
|
|
1055
|
+
* parameters: [
|
|
1056
|
+
* { name: 'limit', path: 'options.limit', defaultValue: 25, type: 'number' }
|
|
1057
|
+
* ]
|
|
1058
|
+
* }, 'my-product');
|
|
1059
|
+
* ```
|
|
1060
|
+
*/
|
|
1061
|
+
async createAction(options, productTag) {
|
|
1062
|
+
var _a;
|
|
1063
|
+
const graphTag = options.graphTag || ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.graph);
|
|
1064
|
+
if (!graphTag) {
|
|
1065
|
+
throw graph_error_1.GraphError.configurationError('No graph specified. Please connect first or provide graphTag.');
|
|
1066
|
+
}
|
|
1067
|
+
const actionTag = this.generateActionTag(options.name);
|
|
1068
|
+
const now = new Date().toISOString();
|
|
1069
|
+
const action = {
|
|
1070
|
+
id: `action_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
|
|
1071
|
+
tag: actionTag,
|
|
1072
|
+
name: options.name,
|
|
1073
|
+
description: options.description,
|
|
1074
|
+
operation: options.operation,
|
|
1075
|
+
query: options.query,
|
|
1076
|
+
parameters: options.parameters,
|
|
1077
|
+
createdAt: now,
|
|
1078
|
+
graphTag,
|
|
1079
|
+
};
|
|
1080
|
+
// If productTag is provided, persist to backend using ProductBuilder
|
|
1081
|
+
if (productTag) {
|
|
1082
|
+
try {
|
|
1083
|
+
const builder = await this.getProductBuilder(productTag);
|
|
1084
|
+
await builder.createGraphAction(graphTag, action);
|
|
1085
|
+
}
|
|
1086
|
+
catch (error) {
|
|
1087
|
+
// Fall back to local storage if API fails
|
|
1088
|
+
console.warn('Failed to persist action to backend, storing locally:', error);
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
// Store locally
|
|
1092
|
+
const graphActions = this.actions.get(graphTag) || [];
|
|
1093
|
+
graphActions.push(action);
|
|
1094
|
+
this.actions.set(graphTag, graphActions);
|
|
1095
|
+
return action;
|
|
1096
|
+
}
|
|
1097
|
+
/**
|
|
1098
|
+
* List all actions for a graph
|
|
1099
|
+
*/
|
|
1100
|
+
async listActions(graphTag, productTag) {
|
|
1101
|
+
var _a;
|
|
1102
|
+
const tag = graphTag || ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.graph);
|
|
1103
|
+
if (!tag) {
|
|
1104
|
+
throw graph_error_1.GraphError.configurationError('No graph specified. Please connect first or provide graphTag.');
|
|
1105
|
+
}
|
|
1106
|
+
// If productTag is provided, fetch from backend using ProductBuilder
|
|
1107
|
+
if (productTag) {
|
|
1108
|
+
try {
|
|
1109
|
+
const builder = await this.getProductBuilder(productTag);
|
|
1110
|
+
const actions = await builder.fetchGraphActions(tag);
|
|
1111
|
+
// Update local cache
|
|
1112
|
+
this.actions.set(tag, actions);
|
|
1113
|
+
return { actions };
|
|
1114
|
+
}
|
|
1115
|
+
catch (error) {
|
|
1116
|
+
// Fall back to local cache
|
|
1117
|
+
console.warn('Failed to fetch actions from backend, using local cache:', error);
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
const actions = this.actions.get(tag) || [];
|
|
1121
|
+
return { actions };
|
|
1122
|
+
}
|
|
1123
|
+
/**
|
|
1124
|
+
* Get a specific action by tag
|
|
1125
|
+
*/
|
|
1126
|
+
async getAction(actionTag, graphTag, productTag) {
|
|
1127
|
+
var _a;
|
|
1128
|
+
const tag = graphTag || ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.graph);
|
|
1129
|
+
if (!tag) {
|
|
1130
|
+
throw graph_error_1.GraphError.configurationError('No graph specified. Please connect first or provide graphTag.');
|
|
1131
|
+
}
|
|
1132
|
+
// If productTag is provided, fetch from backend using ProductBuilder
|
|
1133
|
+
if (productTag) {
|
|
1134
|
+
try {
|
|
1135
|
+
const builder = await this.getProductBuilder(productTag);
|
|
1136
|
+
const action = await builder.fetchGraphAction(tag, actionTag);
|
|
1137
|
+
if (action) {
|
|
1138
|
+
// Update local cache
|
|
1139
|
+
const actions = this.actions.get(tag) || [];
|
|
1140
|
+
const existingIndex = actions.findIndex(a => a.tag === actionTag);
|
|
1141
|
+
if (existingIndex >= 0) {
|
|
1142
|
+
actions[existingIndex] = action;
|
|
1143
|
+
}
|
|
1144
|
+
else {
|
|
1145
|
+
actions.push(action);
|
|
1146
|
+
}
|
|
1147
|
+
this.actions.set(tag, actions);
|
|
1148
|
+
return action;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
catch (error) {
|
|
1152
|
+
// Fall back to local cache
|
|
1153
|
+
console.warn('Failed to fetch action from backend, using local cache:', error);
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
const actions = this.actions.get(tag) || [];
|
|
1157
|
+
return actions.find(a => a.tag === actionTag) || null;
|
|
1158
|
+
}
|
|
1159
|
+
/**
|
|
1160
|
+
* Update an existing action
|
|
1161
|
+
*/
|
|
1162
|
+
async updateAction(actionTag, updates, graphTag, productTag) {
|
|
1163
|
+
var _a, _b, _c, _d, _e;
|
|
1164
|
+
const tag = graphTag || ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.graph);
|
|
1165
|
+
if (!tag) {
|
|
1166
|
+
throw graph_error_1.GraphError.configurationError('No graph specified. Please connect first or provide graphTag.');
|
|
1167
|
+
}
|
|
1168
|
+
const actions = this.actions.get(tag) || [];
|
|
1169
|
+
const index = actions.findIndex(a => a.tag === actionTag);
|
|
1170
|
+
if (index === -1) {
|
|
1171
|
+
throw graph_error_1.GraphError.notFoundError(`Action '${actionTag}' not found`);
|
|
1172
|
+
}
|
|
1173
|
+
const existing = actions[index];
|
|
1174
|
+
const updated = Object.assign(Object.assign({}, existing), { name: (_b = updates.name) !== null && _b !== void 0 ? _b : existing.name, description: (_c = updates.description) !== null && _c !== void 0 ? _c : existing.description, query: (_d = updates.query) !== null && _d !== void 0 ? _d : existing.query, parameters: (_e = updates.parameters) !== null && _e !== void 0 ? _e : existing.parameters, updatedAt: new Date().toISOString() });
|
|
1175
|
+
// If productTag is provided, persist to backend using ProductBuilder
|
|
1176
|
+
if (productTag) {
|
|
1177
|
+
try {
|
|
1178
|
+
const builder = await this.getProductBuilder(productTag);
|
|
1179
|
+
await builder.updateGraphAction(tag, actionTag, updated);
|
|
1180
|
+
}
|
|
1181
|
+
catch (error) {
|
|
1182
|
+
console.warn('Failed to update action in backend:', error);
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
actions[index] = updated;
|
|
1186
|
+
this.actions.set(tag, actions);
|
|
1187
|
+
return updated;
|
|
1188
|
+
}
|
|
1189
|
+
/**
|
|
1190
|
+
* Delete an action
|
|
1191
|
+
*/
|
|
1192
|
+
async deleteAction(actionTag, graphTag, productTag) {
|
|
1193
|
+
var _a;
|
|
1194
|
+
const tag = graphTag || ((_a = this.currentContext) === null || _a === void 0 ? void 0 : _a.graph);
|
|
1195
|
+
if (!tag) {
|
|
1196
|
+
throw graph_error_1.GraphError.configurationError('No graph specified. Please connect first or provide graphTag.');
|
|
1197
|
+
}
|
|
1198
|
+
// If productTag is provided, delete from backend using ProductBuilder
|
|
1199
|
+
if (productTag) {
|
|
1200
|
+
try {
|
|
1201
|
+
const builder = await this.getProductBuilder(productTag);
|
|
1202
|
+
await builder.deleteGraphAction(tag, actionTag);
|
|
1203
|
+
}
|
|
1204
|
+
catch (error) {
|
|
1205
|
+
console.warn('Failed to delete action from backend:', error);
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
const actions = this.actions.get(tag) || [];
|
|
1209
|
+
const filtered = actions.filter(a => a.tag !== actionTag);
|
|
1210
|
+
if (filtered.length === actions.length) {
|
|
1211
|
+
throw graph_error_1.GraphError.notFoundError(`Action '${actionTag}' not found`);
|
|
1212
|
+
}
|
|
1213
|
+
this.actions.set(tag, filtered);
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Execute a graph action with parameter substitution
|
|
1217
|
+
*
|
|
1218
|
+
* @example
|
|
1219
|
+
* ```ts
|
|
1220
|
+
* const result = await graphService.execute({
|
|
1221
|
+
* product: 'my-app',
|
|
1222
|
+
* env: 'dev',
|
|
1223
|
+
* graph: 'social-graph',
|
|
1224
|
+
* action: 'find-persons',
|
|
1225
|
+
* input: { limit: 50 }
|
|
1226
|
+
* });
|
|
1227
|
+
* ```
|
|
1228
|
+
*/
|
|
1229
|
+
async execute(options) {
|
|
1230
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1231
|
+
const process_id = (0, processor_utils_1.generateObjectId)();
|
|
1232
|
+
const startTime = Date.now();
|
|
1233
|
+
// Session log fields (will be populated if session is provided)
|
|
1234
|
+
let sessionLogFields = {};
|
|
1235
|
+
let resolvedOptions = options;
|
|
1236
|
+
// Initialize product builder and logging
|
|
1237
|
+
if (options.product) {
|
|
1238
|
+
const builder = await this.getProductBuilder(options.product);
|
|
1239
|
+
// Process session if provided
|
|
1240
|
+
if (options.session) {
|
|
1241
|
+
const privateKey = builder.fetchPrivateKey();
|
|
1242
|
+
if (privateKey) {
|
|
1243
|
+
const { processSessionForExecution } = await Promise.resolve().then(() => __importStar(require('../sessions')));
|
|
1244
|
+
const sessionResult = await processSessionForExecution(options.session, privateKey, options, options.env);
|
|
1245
|
+
if (sessionResult.error) {
|
|
1246
|
+
throw new Error(`Session validation failed: ${sessionResult.error}`);
|
|
1247
|
+
}
|
|
1248
|
+
resolvedOptions = sessionResult.input;
|
|
1249
|
+
sessionLogFields = sessionResult.logFields;
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
this.initializeLogService();
|
|
1254
|
+
const baseLogs = Object.assign({ product_tag: options.product || '', workspace_id: ((_a = this.config) === null || _a === void 0 ? void 0 : _a.workspace_id) || '', env: options.env, process_id, type: logs_types_1.LogEventTypes.GRAPH, parent_tag: options.graph, child_tag: options.action, data: { graph: options.graph, action: options.action } }, sessionLogFields);
|
|
1255
|
+
(_b = this.logService) === null || _b === void 0 ? void 0 : _b.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph action execute - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
|
|
1256
|
+
// Get the action
|
|
1257
|
+
const action = await this.getAction(resolvedOptions.action, resolvedOptions.graph);
|
|
1258
|
+
if (!action) {
|
|
1259
|
+
(_c = this.logService) === null || _c === void 0 ? void 0 : _c.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph action execute - failed', failed_execution: true, data: { graph: options.graph, action: options.action, error: `Action '${options.action}' not found` }, status: logs_types_1.LogEventStatus.FAIL }));
|
|
1260
|
+
await ((_d = this.logService) === null || _d === void 0 ? void 0 : _d.publish());
|
|
1261
|
+
return {
|
|
1262
|
+
success: false,
|
|
1263
|
+
executionTime: Date.now() - startTime,
|
|
1264
|
+
data: [],
|
|
1265
|
+
count: 0,
|
|
1266
|
+
error: `Action '${options.action}' not found`,
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
try {
|
|
1270
|
+
// Build the query with parameter substitution
|
|
1271
|
+
const query = this.substituteParameters(action.query, action.parameters, resolvedOptions.input || {});
|
|
1272
|
+
// Execute based on operation type
|
|
1273
|
+
const result = await this.executeOperation(query);
|
|
1274
|
+
(_e = this.logService) === null || _e === void 0 ? void 0 : _e.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph action execute - success', successful_execution: true, status: logs_types_1.LogEventStatus.SUCCESS }));
|
|
1275
|
+
(_f = this.logService) === null || _f === void 0 ? void 0 : _f.publish();
|
|
1276
|
+
return {
|
|
1277
|
+
success: true,
|
|
1278
|
+
executionTime: Date.now() - startTime,
|
|
1279
|
+
data: result.data,
|
|
1280
|
+
count: result.data.length,
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
catch (error) {
|
|
1284
|
+
(_g = this.logService) === null || _g === void 0 ? void 0 : _g.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph action execute - failed', failed_execution: true, data: { graph: options.graph, action: options.action, error: error.message || 'Execution failed' }, status: logs_types_1.LogEventStatus.FAIL }));
|
|
1285
|
+
await ((_h = this.logService) === null || _h === void 0 ? void 0 : _h.publish());
|
|
1286
|
+
return {
|
|
1287
|
+
success: false,
|
|
1288
|
+
executionTime: Date.now() - startTime,
|
|
1289
|
+
data: [],
|
|
1290
|
+
count: 0,
|
|
1291
|
+
error: error.message || 'Execution failed',
|
|
1292
|
+
};
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
// ==================== DISPATCH OPERATIONS ====================
|
|
1296
|
+
/**
|
|
1297
|
+
* Action dispatch operations - for predefined graph actions.
|
|
1298
|
+
*/
|
|
1299
|
+
get action() {
|
|
1300
|
+
return {
|
|
1301
|
+
/**
|
|
1302
|
+
* Dispatches a graph action to run as a scheduled job.
|
|
1303
|
+
* @param {IGraphActionDispatchInput} data - The graph action dispatch input.
|
|
1304
|
+
* @returns {Promise<IDispatchResult>} The dispatch result with job ID and status.
|
|
1305
|
+
* @example
|
|
1306
|
+
* // Schedule a graph action to run in 1 hour
|
|
1307
|
+
* await ductape.graph.action.dispatch({
|
|
1308
|
+
* product: 'my-product',
|
|
1309
|
+
* env: 'production',
|
|
1310
|
+
* graph: 'social-graph',
|
|
1311
|
+
* event: 'compute-recommendations',
|
|
1312
|
+
* input: { userId: '123', limit: 10 },
|
|
1313
|
+
* schedule: { start_at: Date.now() + 3600000 }
|
|
1314
|
+
* });
|
|
1315
|
+
*
|
|
1316
|
+
* // Run on a cron schedule
|
|
1317
|
+
* await ductape.graph.action.dispatch({
|
|
1318
|
+
* product: 'my-product',
|
|
1319
|
+
* env: 'production',
|
|
1320
|
+
* graph: 'analytics-graph',
|
|
1321
|
+
* event: 'aggregate-metrics',
|
|
1322
|
+
* input: {},
|
|
1323
|
+
* schedule: { cron: '0 0 * * *' } // Daily at midnight
|
|
1324
|
+
* });
|
|
1325
|
+
*/
|
|
1326
|
+
dispatch: async (data) => {
|
|
1327
|
+
const processorService = this.createNewProcessor();
|
|
1328
|
+
const productBuilder = await this.getProductBuilder(data.product);
|
|
1329
|
+
const schedule = data.schedule || {};
|
|
1330
|
+
const startAt = typeof schedule.start_at === 'string'
|
|
1331
|
+
? new Date(schedule.start_at).getTime()
|
|
1332
|
+
: schedule.start_at || Date.now();
|
|
1333
|
+
// Generate job tag based on type, graph, and event
|
|
1334
|
+
const jobTag = `graph-action:${data.graph}:${data.event}`;
|
|
1335
|
+
// Check if job exists, if not create it
|
|
1336
|
+
const existingJob = await productBuilder.fetchJob(jobTag);
|
|
1337
|
+
if (!existingJob) {
|
|
1338
|
+
await productBuilder.createJob({
|
|
1339
|
+
tag: jobTag,
|
|
1340
|
+
name: `Graph Action: ${data.graph}/${data.event}`,
|
|
1341
|
+
description: `Auto-created job for graph action ${data.event} on graph ${data.graph}`,
|
|
1342
|
+
type: productsBuilder_types_1.JobEventTypes.GRAPH_ACTION,
|
|
1343
|
+
app: data.graph,
|
|
1344
|
+
event: data.event,
|
|
1345
|
+
executions: 0,
|
|
1346
|
+
intervals: schedule.every || 0,
|
|
1347
|
+
start_at: startAt,
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
const jobInput = {
|
|
1351
|
+
product: data.product,
|
|
1352
|
+
env: data.env,
|
|
1353
|
+
event: jobTag,
|
|
1354
|
+
input: data.input,
|
|
1355
|
+
retries: data.retries || 0,
|
|
1356
|
+
start_at: startAt,
|
|
1357
|
+
session: data.session,
|
|
1358
|
+
cache: data.cache,
|
|
1359
|
+
repeat: schedule.cron || schedule.every ? {
|
|
1360
|
+
cron: schedule.cron,
|
|
1361
|
+
every: schedule.every,
|
|
1362
|
+
limit: schedule.limit,
|
|
1363
|
+
endDate: schedule.endDate,
|
|
1364
|
+
tz: schedule.tz,
|
|
1365
|
+
} : undefined,
|
|
1366
|
+
};
|
|
1367
|
+
await processorService.processJob(jobInput);
|
|
1368
|
+
const isRecurring = !!(schedule.cron || schedule.every);
|
|
1369
|
+
let nextRunAt;
|
|
1370
|
+
if (isRecurring && schedule.every) {
|
|
1371
|
+
nextRunAt = startAt + schedule.every;
|
|
1372
|
+
}
|
|
1373
|
+
return {
|
|
1374
|
+
job_id: (0, crypto_1.randomUUID)(),
|
|
1375
|
+
status: startAt > Date.now() ? 'scheduled' : 'queued',
|
|
1376
|
+
scheduled_at: startAt,
|
|
1377
|
+
recurring: isRecurring,
|
|
1378
|
+
next_run_at: nextRunAt,
|
|
1379
|
+
};
|
|
1380
|
+
},
|
|
1381
|
+
};
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* Dispatches a graph operation to run as a scheduled job.
|
|
1385
|
+
* Use this for direct graph operations (traverse, query, createNode, deleteNodes, etc.).
|
|
1386
|
+
* @param {IGraphOperationDispatchInput} data - The graph operation dispatch input.
|
|
1387
|
+
* @returns {Promise<IDispatchResult>} The dispatch result with job ID and status.
|
|
1388
|
+
* @example
|
|
1389
|
+
* // Schedule a graph traversal operation
|
|
1390
|
+
* await ductape.graph.dispatch({
|
|
1391
|
+
* product: 'my-product',
|
|
1392
|
+
* env: 'production',
|
|
1393
|
+
* graph: 'social-graph',
|
|
1394
|
+
* operation: 'traverse',
|
|
1395
|
+
* input: { startNode: 'user:123', direction: 'outgoing', depth: 3 },
|
|
1396
|
+
* schedule: { start_at: Date.now() + 3600000 }
|
|
1397
|
+
* });
|
|
1398
|
+
*
|
|
1399
|
+
* // Run periodic graph cleanup
|
|
1400
|
+
* await ductape.graph.dispatch({
|
|
1401
|
+
* product: 'my-product',
|
|
1402
|
+
* env: 'production',
|
|
1403
|
+
* graph: 'session-graph',
|
|
1404
|
+
* operation: 'deleteNodes',
|
|
1405
|
+
* input: { filter: { expired: true } },
|
|
1406
|
+
* schedule: { cron: '0 4 * * *' } // Daily at 4 AM
|
|
1407
|
+
* });
|
|
1408
|
+
*/
|
|
1409
|
+
async dispatch(data) {
|
|
1410
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1411
|
+
const process_id = (0, processor_utils_1.generateObjectId)();
|
|
1412
|
+
const processorService = this.createNewProcessor();
|
|
1413
|
+
const productBuilder = await this.getProductBuilder(data.product);
|
|
1414
|
+
const schedule = data.schedule || {};
|
|
1415
|
+
const startAt = typeof schedule.start_at === 'string'
|
|
1416
|
+
? new Date(schedule.start_at).getTime()
|
|
1417
|
+
: schedule.start_at || Date.now();
|
|
1418
|
+
// Generate job tag based on type, graph, and operation
|
|
1419
|
+
const jobTag = `graph-operation:${data.graph}:${data.operation}`;
|
|
1420
|
+
// Initialize logging
|
|
1421
|
+
this.initializeLogService();
|
|
1422
|
+
const baseLogs = {
|
|
1423
|
+
product_tag: data.product,
|
|
1424
|
+
workspace_id: ((_a = this.config) === null || _a === void 0 ? void 0 : _a.workspace_id) || '',
|
|
1425
|
+
env: data.env,
|
|
1426
|
+
process_id,
|
|
1427
|
+
type: logs_types_1.LogEventTypes.GRAPH,
|
|
1428
|
+
parent_tag: data.graph,
|
|
1429
|
+
child_tag: data.operation,
|
|
1430
|
+
data: { graph: data.graph, operation: data.operation },
|
|
1431
|
+
};
|
|
1432
|
+
(_b = this.logService) === null || _b === void 0 ? void 0 : _b.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph dispatch - initiated', status: logs_types_1.LogEventStatus.PROCESSING }));
|
|
1433
|
+
try {
|
|
1434
|
+
// Check if job exists, if not create it
|
|
1435
|
+
const existingJob = await productBuilder.fetchJob(jobTag);
|
|
1436
|
+
if (!existingJob) {
|
|
1437
|
+
await productBuilder.createJob({
|
|
1438
|
+
tag: jobTag,
|
|
1439
|
+
name: `Graph Operation: ${data.graph}/${data.operation}`,
|
|
1440
|
+
description: `Auto-created job for graph operation ${data.operation} on graph ${data.graph}`,
|
|
1441
|
+
type: productsBuilder_types_1.JobEventTypes.GRAPH_OPERATION,
|
|
1442
|
+
app: data.graph,
|
|
1443
|
+
event: data.operation,
|
|
1444
|
+
executions: 0,
|
|
1445
|
+
intervals: schedule.every || 0,
|
|
1446
|
+
start_at: startAt,
|
|
1447
|
+
});
|
|
1448
|
+
}
|
|
1449
|
+
const jobInput = {
|
|
1450
|
+
product: data.product,
|
|
1451
|
+
env: data.env,
|
|
1452
|
+
event: jobTag,
|
|
1453
|
+
input: data.input,
|
|
1454
|
+
retries: data.retries || 0,
|
|
1455
|
+
start_at: startAt,
|
|
1456
|
+
session: data.session,
|
|
1457
|
+
cache: data.cache,
|
|
1458
|
+
repeat: schedule.cron || schedule.every ? {
|
|
1459
|
+
cron: schedule.cron,
|
|
1460
|
+
every: schedule.every,
|
|
1461
|
+
limit: schedule.limit,
|
|
1462
|
+
endDate: schedule.endDate,
|
|
1463
|
+
tz: schedule.tz,
|
|
1464
|
+
} : undefined,
|
|
1465
|
+
};
|
|
1466
|
+
await processorService.processJob(jobInput);
|
|
1467
|
+
const isRecurring = !!(schedule.cron || schedule.every);
|
|
1468
|
+
let nextRunAt;
|
|
1469
|
+
if (isRecurring && schedule.every) {
|
|
1470
|
+
nextRunAt = startAt + schedule.every;
|
|
1471
|
+
}
|
|
1472
|
+
const job_id = (0, crypto_1.randomUUID)();
|
|
1473
|
+
(_c = this.logService) === null || _c === void 0 ? void 0 : _c.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph dispatch - success', successful_execution: true, data: { graph: data.graph, operation: data.operation, job_id }, status: logs_types_1.LogEventStatus.SUCCESS }));
|
|
1474
|
+
(_d = this.logService) === null || _d === void 0 ? void 0 : _d.publish();
|
|
1475
|
+
return {
|
|
1476
|
+
job_id,
|
|
1477
|
+
status: startAt > Date.now() ? 'scheduled' : 'queued',
|
|
1478
|
+
scheduled_at: startAt,
|
|
1479
|
+
recurring: isRecurring,
|
|
1480
|
+
next_run_at: nextRunAt,
|
|
1481
|
+
};
|
|
1482
|
+
}
|
|
1483
|
+
catch (error) {
|
|
1484
|
+
(_e = this.logService) === null || _e === void 0 ? void 0 : _e.add(Object.assign(Object.assign({}, baseLogs), { message: 'Graph dispatch - failed', failed_execution: true, data: { graph: data.graph, operation: data.operation, error: String(error) }, status: logs_types_1.LogEventStatus.FAIL }));
|
|
1485
|
+
await ((_f = this.logService) === null || _f === void 0 ? void 0 : _f.publish());
|
|
1486
|
+
throw error;
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
/**
|
|
1490
|
+
* Substitute parameter placeholders in a query object
|
|
1491
|
+
*/
|
|
1492
|
+
substituteParameters(query, parameters, input) {
|
|
1493
|
+
var _a;
|
|
1494
|
+
// Deep clone the query
|
|
1495
|
+
const result = JSON.parse(JSON.stringify(query));
|
|
1496
|
+
// Substitute each parameter
|
|
1497
|
+
for (const param of parameters) {
|
|
1498
|
+
const value = (_a = input[param.name]) !== null && _a !== void 0 ? _a : param.defaultValue;
|
|
1499
|
+
this.setNestedValue(result, param.path, value);
|
|
1500
|
+
}
|
|
1501
|
+
return result;
|
|
1502
|
+
}
|
|
1503
|
+
/**
|
|
1504
|
+
* Set a nested value in an object using a dot-notation path
|
|
1505
|
+
*/
|
|
1506
|
+
setNestedValue(obj, path, value) {
|
|
1507
|
+
const keys = path.replace(/\[(\d+)\]/g, '.$1').split('.');
|
|
1508
|
+
let current = obj;
|
|
1509
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
1510
|
+
const key = keys[i];
|
|
1511
|
+
if (current[key] === undefined) {
|
|
1512
|
+
current[key] = {};
|
|
1513
|
+
}
|
|
1514
|
+
current = current[key];
|
|
1515
|
+
}
|
|
1516
|
+
current[keys[keys.length - 1]] = value;
|
|
1517
|
+
}
|
|
1518
|
+
/**
|
|
1519
|
+
* Execute an operation based on the query object
|
|
1520
|
+
*/
|
|
1521
|
+
async executeOperation(query) {
|
|
1522
|
+
const { operation, options } = query;
|
|
1523
|
+
switch (operation) {
|
|
1524
|
+
case 'findNodes': {
|
|
1525
|
+
const result = await this.findNodes(options);
|
|
1526
|
+
return { data: result.nodes };
|
|
1527
|
+
}
|
|
1528
|
+
case 'findRelationships': {
|
|
1529
|
+
const result = await this.findRelationships(options);
|
|
1530
|
+
return { data: result.relationships };
|
|
1531
|
+
}
|
|
1532
|
+
case 'traverse': {
|
|
1533
|
+
const result = await this.traverse(options);
|
|
1534
|
+
return { data: result.paths };
|
|
1535
|
+
}
|
|
1536
|
+
case 'shortestPath': {
|
|
1537
|
+
const result = await this.shortestPath(options);
|
|
1538
|
+
return { data: result.path ? [result.path] : [] };
|
|
1539
|
+
}
|
|
1540
|
+
case 'allPaths': {
|
|
1541
|
+
const result = await this.allPaths(options);
|
|
1542
|
+
return { data: result.paths };
|
|
1543
|
+
}
|
|
1544
|
+
case 'getNeighborhood': {
|
|
1545
|
+
const result = await this.getNeighborhood(options);
|
|
1546
|
+
return { data: result.nodes };
|
|
1547
|
+
}
|
|
1548
|
+
case 'countNodes': {
|
|
1549
|
+
const result = await this.countNodes(options === null || options === void 0 ? void 0 : options.labels, options === null || options === void 0 ? void 0 : options.where);
|
|
1550
|
+
return { data: [{ count: result.count }] };
|
|
1551
|
+
}
|
|
1552
|
+
case 'countRelationships': {
|
|
1553
|
+
const result = await this.countRelationships(options === null || options === void 0 ? void 0 : options.types, options === null || options === void 0 ? void 0 : options.where);
|
|
1554
|
+
return { data: [{ count: result.count }] };
|
|
1555
|
+
}
|
|
1556
|
+
case 'getStatistics': {
|
|
1557
|
+
const result = await this.getStatistics();
|
|
1558
|
+
return { data: [result] };
|
|
1559
|
+
}
|
|
1560
|
+
case 'executeRaw':
|
|
1561
|
+
case 'query': {
|
|
1562
|
+
const result = await this.query(options.query, options.params);
|
|
1563
|
+
return { data: result.records };
|
|
1564
|
+
}
|
|
1565
|
+
default:
|
|
1566
|
+
throw new Error(`Unsupported operation: ${operation}`);
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
// ==================== TRANSACTION OPERATIONS ====================
|
|
1570
|
+
/**
|
|
1571
|
+
* Execute operations within a transaction
|
|
1572
|
+
* As documented in transactions.md
|
|
1573
|
+
*
|
|
1574
|
+
* @example
|
|
1575
|
+
* ```ts
|
|
1576
|
+
* const result = await ductape.graph.executeTransaction(async (transaction) => {
|
|
1577
|
+
* const alice = await ductape.graph.createNode({
|
|
1578
|
+
* labels: ['Person'],
|
|
1579
|
+
* properties: { name: 'Alice' },
|
|
1580
|
+
* }, transaction);
|
|
1581
|
+
*
|
|
1582
|
+
* const bob = await ductape.graph.createNode({
|
|
1583
|
+
* labels: ['Person'],
|
|
1584
|
+
* properties: { name: 'Bob' },
|
|
1585
|
+
* }, transaction);
|
|
1586
|
+
*
|
|
1587
|
+
* await ductape.graph.createRelationship({
|
|
1588
|
+
* type: 'FRIENDS_WITH',
|
|
1589
|
+
* startNodeId: alice.node.id,
|
|
1590
|
+
* endNodeId: bob.node.id,
|
|
1591
|
+
* }, transaction);
|
|
1592
|
+
*
|
|
1593
|
+
* return { alice, bob };
|
|
1594
|
+
* });
|
|
1595
|
+
* ```
|
|
1596
|
+
*/
|
|
1597
|
+
async executeTransaction(callback, options) {
|
|
1598
|
+
if (!this.transactionManager) {
|
|
1599
|
+
throw graph_error_1.GraphError.configurationError('No connection established. Please connect first.');
|
|
1600
|
+
}
|
|
1601
|
+
return this.transactionManager.executeTransaction(callback, options);
|
|
1602
|
+
}
|
|
1603
|
+
/**
|
|
1604
|
+
* Begin a manual transaction
|
|
1605
|
+
* As documented in transactions.md
|
|
1606
|
+
*/
|
|
1607
|
+
async beginTransaction(options) {
|
|
1608
|
+
if (!this.transactionManager) {
|
|
1609
|
+
throw graph_error_1.GraphError.configurationError('No connection established. Please connect first.');
|
|
1610
|
+
}
|
|
1611
|
+
return this.transactionManager.beginTransaction(options);
|
|
1612
|
+
}
|
|
1613
|
+
/**
|
|
1614
|
+
* Commit a transaction
|
|
1615
|
+
*/
|
|
1616
|
+
async commitTransaction(transaction) {
|
|
1617
|
+
if (!this.transactionManager) {
|
|
1618
|
+
throw graph_error_1.GraphError.configurationError('No connection established.');
|
|
1619
|
+
}
|
|
1620
|
+
return this.transactionManager.commitTransaction(transaction);
|
|
1621
|
+
}
|
|
1622
|
+
/**
|
|
1623
|
+
* Rollback a transaction
|
|
1624
|
+
*/
|
|
1625
|
+
async rollbackTransaction(transaction) {
|
|
1626
|
+
if (!this.transactionManager) {
|
|
1627
|
+
throw graph_error_1.GraphError.configurationError('No connection established.');
|
|
1628
|
+
}
|
|
1629
|
+
return this.transactionManager.rollbackTransaction(transaction);
|
|
1630
|
+
}
|
|
1631
|
+
// ==================== UTILITY METHODS ====================
|
|
1632
|
+
/**
|
|
1633
|
+
* Get the current adapter
|
|
1634
|
+
*/
|
|
1635
|
+
getAdapter() {
|
|
1636
|
+
if (!this.currentContext) {
|
|
1637
|
+
throw graph_error_1.GraphError.configurationError('No connection established. Please call connect() first.');
|
|
1638
|
+
}
|
|
1639
|
+
const contextKey = `${this.currentContext.graph}:${this.currentContext.env}`;
|
|
1640
|
+
const adapter = this.adapters.get(contextKey);
|
|
1641
|
+
if (!adapter) {
|
|
1642
|
+
throw graph_error_1.GraphError.configurationError(`Adapter not found for ${contextKey}`);
|
|
1643
|
+
}
|
|
1644
|
+
if (!this.currentContext.connected) {
|
|
1645
|
+
throw graph_error_1.GraphError.connectionError('Not connected to graph database');
|
|
1646
|
+
}
|
|
1647
|
+
return adapter;
|
|
1648
|
+
}
|
|
1649
|
+
/**
|
|
1650
|
+
* Fetch graph configuration from product API
|
|
1651
|
+
*/
|
|
1652
|
+
async fetchGraphFromProduct(productTag, graphTag) {
|
|
1653
|
+
try {
|
|
1654
|
+
const builder = await this.getProductBuilder(productTag);
|
|
1655
|
+
// Note: This would need corresponding API endpoints for graphs
|
|
1656
|
+
// For now, return null to fall back to local configs
|
|
1657
|
+
return null;
|
|
1658
|
+
}
|
|
1659
|
+
catch (error) {
|
|
1660
|
+
return null;
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
/**
|
|
1664
|
+
* Get current connection context
|
|
1665
|
+
*/
|
|
1666
|
+
getCurrentContext() {
|
|
1667
|
+
return this.currentContext;
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Check if a feature is supported by the current adapter
|
|
1671
|
+
*/
|
|
1672
|
+
supportsFeature(feature) {
|
|
1673
|
+
try {
|
|
1674
|
+
const adapter = this.getAdapter();
|
|
1675
|
+
return adapter.supportsFeature(feature);
|
|
1676
|
+
}
|
|
1677
|
+
catch (_a) {
|
|
1678
|
+
return false;
|
|
1679
|
+
}
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
exports.GraphService = GraphService;
|
|
1683
|
+
//# sourceMappingURL=graphs.service.js.map
|