@ductape/sdk 0.0.4-v6 → 0.0.4-v60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +310 -0
- package/dist/agents/agents.service.js +1249 -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 +1227 -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.d.ts +51 -5
- package/dist/api/services/appApi.service.js +101 -3
- package/dist/api/services/appApi.service.js.map +1 -1
- package/dist/api/services/pricingApi.service.d.ts +10 -0
- package/dist/api/services/pricingApi.service.js +34 -0
- package/dist/api/services/pricingApi.service.js.map +1 -0
- package/dist/api/services/processorApi.service.d.ts +334 -2
- package/dist/api/services/processorApi.service.js +264 -2
- package/dist/api/services/processorApi.service.js.map +1 -1
- package/dist/api/services/productsApi.service.d.ts +108 -1
- package/dist/api/services/productsApi.service.js +150 -3
- 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 +50 -0
- package/dist/api/services/secretsApi.service.js +124 -0
- package/dist/api/services/secretsApi.service.js.map +1 -0
- 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.d.ts +8 -0
- package/dist/api/services/workspaceApi.service.js +20 -0
- package/dist/api/services/workspaceApi.service.js.map +1 -1
- package/dist/api/urls.d.ts +65 -1
- package/dist/api/urls.js +90 -18
- package/dist/api/urls.js.map +1 -1
- package/dist/api/utils/auth.utils.d.ts +1 -3
- package/dist/api/utils/auth.utils.js.map +1 -1
- package/dist/api/utils/cache.utils.d.ts +1 -1
- package/dist/api/utils/cache.utils.js +2 -2
- package/dist/api/utils/cache.utils.js.map +1 -1
- package/dist/api/utils/strings.utils.d.ts +2 -0
- package/dist/api/utils/strings.utils.js +14 -0
- package/dist/api/utils/strings.utils.js.map +1 -1
- package/dist/apps/services/app.service.d.ts +41 -33
- package/dist/apps/services/app.service.js +472 -184
- 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 +429 -0
- package/dist/apps/utils/oauth-manager.js.map +1 -0
- package/dist/apps/validators/joi-validators/create.appAction.validator.d.ts +1 -2
- package/dist/apps/validators/joi-validators/create.appAction.validator.js +21 -2
- package/dist/apps/validators/joi-validators/create.appAction.validator.js.map +1 -1
- package/dist/apps/validators/joi-validators/update.appAction.validator.js +11 -1
- package/dist/apps/validators/joi-validators/update.appAction.validator.js.map +1 -1
- package/dist/apps/validators/joi-validators/update.appActionResponse.validator.d.ts +1 -1
- package/dist/apps/validators/joi-validators/update.appActionResponse.validator.js +34 -1
- package/dist/apps/validators/joi-validators/update.appActionResponse.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 +289 -0
- package/dist/brokers/brokers.service.js +722 -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 +314 -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 +23 -0
- package/dist/brokers/utils/providers/kafka.service.js +131 -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 +15 -0
- package/dist/brokers/utils/providers/rabbitmq.service.js +151 -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/clients/pricing.client.d.ts +3 -0
- package/dist/clients/pricing.client.js +33 -0
- package/dist/clients/pricing.client.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 +393 -0
- package/dist/database/adapters/base.adapter.js +150 -0
- package/dist/database/adapters/base.adapter.js.map +1 -0
- package/dist/database/adapters/cassandra.adapter.d.ts +91 -0
- package/dist/database/adapters/cassandra.adapter.js +1075 -0
- package/dist/database/adapters/cassandra.adapter.js.map +1 -0
- package/dist/database/adapters/dynamodb.adapter.d.ts +109 -0
- package/dist/database/adapters/dynamodb.adapter.js +1534 -0
- package/dist/database/adapters/dynamodb.adapter.js.map +1 -0
- 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 +120 -0
- package/dist/database/adapters/mongodb.adapter.js +1253 -0
- package/dist/database/adapters/mongodb.adapter.js.map +1 -0
- package/dist/database/adapters/mysql.adapter.d.ts +85 -0
- package/dist/database/adapters/mysql.adapter.js +1313 -0
- package/dist/database/adapters/mysql.adapter.js.map +1 -0
- package/dist/database/adapters/postgresql.adapter.d.ts +88 -0
- package/dist/database/adapters/postgresql.adapter.js +1434 -0
- package/dist/database/adapters/postgresql.adapter.js.map +1 -0
- package/dist/database/databases.service.d.ts +1388 -0
- package/dist/database/databases.service.js +2821 -0
- package/dist/database/databases.service.js.map +1 -0
- package/dist/database/index.d.ts +46 -0
- package/dist/database/index.js +109 -0
- package/dist/database/index.js.map +1 -0
- 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 +67 -0
- package/dist/database/operators/aggregation-builder.js +841 -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 +59 -0
- package/dist/database/operators/query-builder.js +397 -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 +185 -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 +14 -0
- package/dist/database/types/index.js +31 -0
- package/dist/database/types/index.js.map +1 -0
- 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 +205 -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 +216 -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 +86 -0
- package/dist/graph/adapters/arangodb.adapter.js +1522 -0
- package/dist/graph/adapters/arangodb.adapter.js.map +1 -0
- package/dist/graph/adapters/base.adapter.d.ts +245 -0
- package/dist/graph/adapters/base.adapter.js +64 -0
- package/dist/graph/adapters/base.adapter.js.map +1 -0
- package/dist/graph/adapters/index.d.ts +11 -0
- package/dist/graph/adapters/index.js +21 -0
- package/dist/graph/adapters/index.js.map +1 -0
- package/dist/graph/adapters/memgraph.adapter.d.ts +110 -0
- package/dist/graph/adapters/memgraph.adapter.js +1345 -0
- package/dist/graph/adapters/memgraph.adapter.js.map +1 -0
- package/dist/graph/adapters/neo4j.adapter.d.ts +81 -0
- package/dist/graph/adapters/neo4j.adapter.js +1198 -0
- package/dist/graph/adapters/neo4j.adapter.js.map +1 -0
- package/dist/graph/adapters/neptune.adapter.d.ts +82 -0
- package/dist/graph/adapters/neptune.adapter.js +1313 -0
- package/dist/graph/adapters/neptune.adapter.js.map +1 -0
- package/dist/graph/graphs.service.d.ts +546 -0
- package/dist/graph/graphs.service.js +1893 -0
- package/dist/graph/graphs.service.js.map +1 -0
- package/dist/graph/index.d.ts +57 -0
- package/dist/graph/index.js +77 -0
- package/dist/graph/index.js.map +1 -0
- 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 +149 -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 +13 -0
- package/dist/graph/types/index.js +20 -0
- package/dist/graph/types/index.js.map +1 -0
- 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 +175 -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/imports/imports.service.d.ts +3 -3
- package/dist/imports/imports.service.js +8 -7
- package/dist/imports/imports.service.js.map +1 -1
- package/dist/imports/imports.types.d.ts +8 -0
- package/dist/imports/repos/openApi.repo.d.ts +1 -1
- package/dist/imports/repos/openApi.repo.js +414 -47
- package/dist/imports/repos/openApi.repo.js.map +1 -1
- package/dist/imports/repos/postmanV21.repo.d.ts +1 -1
- package/dist/imports/repos/postmanV21.repo.js +126 -83
- package/dist/imports/repos/postmanV21.repo.js.map +1 -1
- package/dist/index.d.ts +3239 -285
- package/dist/index.js +4705 -687
- 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/inputs/inputs.service.d.ts +1 -1
- package/dist/inputs/inputs.service.js +2 -2
- package/dist/inputs/inputs.service.js.map +1 -1
- package/dist/inputs/utils/inputs.utils.create.js +1 -1
- package/dist/inputs/utils/inputs.utils.create.js.map +1 -1
- 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 +16 -1
- package/dist/logs/logs.types.js +5 -0
- 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 +257 -0
- package/dist/notifications/notifications.service.js +656 -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/parsers/index.d.ts +3 -0
- package/dist/parsers/index.js +27 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/parsers/pipelines/postman.pipelines.d.ts +15 -0
- package/dist/parsers/pipelines/postman.pipelines.js +103 -0
- package/dist/parsers/pipelines/postman.pipelines.js.map +1 -0
- package/dist/parsers/types/postman.types.d.ts +200 -0
- package/dist/parsers/types/postman.types.js +3 -0
- package/dist/parsers/types/postman.types.js.map +1 -0
- package/dist/parsers/utils/postman.utils.d.ts +12 -0
- package/dist/parsers/utils/postman.utils.js +116 -0
- package/dist/parsers/utils/postman.utils.js.map +1 -0
- package/dist/parsers/validators/postman-auth.validators.d.ts +10 -0
- package/dist/parsers/validators/postman-auth.validators.js +127 -0
- package/dist/parsers/validators/postman-auth.validators.js.map +1 -0
- package/dist/parsers/validators/postman-request.validators.d.ts +13 -0
- package/dist/parsers/validators/postman-request.validators.js +139 -0
- package/dist/parsers/validators/postman-request.validators.js.map +1 -0
- package/dist/parsers/validators/postman-response.validators.d.ts +13 -0
- package/dist/parsers/validators/postman-response.validators.js +150 -0
- package/dist/parsers/validators/postman-response.validators.js.map +1 -0
- package/dist/parsers/validators/postman-variable.validators.d.ts +14 -0
- package/dist/parsers/validators/postman-variable.validators.js +163 -0
- package/dist/parsers/validators/postman-variable.validators.js.map +1 -0
- package/dist/pricing/pricing.repo.js +1 -0
- package/dist/pricing/pricing.repo.js.map +1 -0
- package/dist/pricing/pricing.service.d.ts +24 -0
- package/dist/pricing/pricing.service.js +51 -0
- package/dist/pricing/pricing.service.js.map +1 -0
- package/dist/pricing/pricing.types.d.ts +76 -0
- package/dist/pricing/pricing.types.js +21 -0
- package/dist/pricing/pricing.types.js.map +1 -0
- package/dist/pricing/utils/string.utils.d.ts +1 -0
- package/dist/pricing/utils/string.utils.js +9 -0
- package/dist/pricing/utils/string.utils.js.map +1 -0
- package/dist/processor/services/processor.service.d.ts +120 -73
- package/dist/processor/services/processor.service.js +1705 -1294
- package/dist/processor/services/processor.service.js.map +1 -1
- package/dist/processor/services/request.service.d.ts +36 -0
- package/dist/processor/services/request.service.js +304 -0
- package/dist/processor/services/request.service.js.map +1 -0
- package/dist/processor/types/request.types.d.ts +14 -0
- package/dist/processor/types/request.types.js +3 -0
- package/dist/processor/types/request.types.js.map +1 -0
- package/dist/processor/utils/processor.utils.d.ts +3 -0
- package/dist/processor/utils/processor.utils.js +87 -21
- package/dist/processor/utils/processor.utils.js.map +1 -1
- package/dist/processor/utils/request.utils.d.ts +20 -0
- package/dist/processor/utils/request.utils.js +113 -0
- package/dist/processor/utils/request.utils.js.map +1 -0
- package/dist/products/services/products.service.d.ts +330 -77
- package/dist/products/services/products.service.js +2586 -397
- package/dist/products/services/products.service.js.map +1 -1
- package/dist/products/utils/string.utils.d.ts +1 -1
- package/dist/products/utils/string.utils.js +14 -2
- package/dist/products/utils/string.utils.js.map +1 -1
- package/dist/products/validators/index.d.ts +7 -1
- package/dist/products/validators/index.js +16 -1
- 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 +266 -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.productEnv.validator.js +1 -0
- package/dist/products/validators/joi-validators/create.productEnv.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productGraph.validator.js +89 -0
- package/dist/products/validators/joi-validators/create.productGraph.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/create.productHealthcheck.validator.d.ts +4 -0
- package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js +58 -0
- package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js +81 -25
- 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 +133 -45
- 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.dataValue.validator.js +1 -0
- package/dist/products/validators/joi-validators/update.dataValue.validator.js.map +1 -1
- 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.productEnv.validator.js +3 -0
- package/dist/products/validators/joi-validators/update.productEnv.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/update.productGraph.validator.js +88 -0
- package/dist/products/validators/joi-validators/update.productGraph.validator.js.map +1 -0
- package/dist/resilience/fallback.service.d.ts +140 -0
- package/dist/resilience/fallback.service.js +764 -0
- package/dist/resilience/fallback.service.js.map +1 -0
- package/dist/resilience/healthcheck.service.d.ts +159 -0
- package/dist/resilience/healthcheck.service.js +943 -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 +82 -0
- package/dist/resilience/quota.service.js +516 -0
- package/dist/resilience/quota.service.js.map +1 -0
- package/dist/resilience/resilience.service.d.ts +98 -0
- package/dist/resilience/resilience.service.js +560 -0
- package/dist/resilience/resilience.service.js.map +1 -0
- package/dist/resilience/types/index.d.ts +513 -0
- package/dist/resilience/types/index.js +29 -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 +93 -0
- package/dist/secrets/secrets.service.js +258 -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 +151 -0
- package/dist/storage/storage.service.js +522 -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 +11 -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.broker.kafka.js +172 -0
- package/dist/test/test.broker.kafka.js.map +1 -0
- package/dist/test/test.broker.nats.js +193 -0
- package/dist/test/test.broker.nats.js.map +1 -0
- package/dist/test/test.broker.pubsub.js +171 -0
- package/dist/test/test.broker.pubsub.js.map +1 -0
- package/dist/test/test.broker.rabbitmq.js +164 -0
- package/dist/test/test.broker.rabbitmq.js.map +1 -0
- package/dist/test/test.broker.redis.js +168 -0
- package/dist/test/test.broker.redis.js.map +1 -0
- package/dist/test/test.broker.sqs.d.ts +1 -0
- package/dist/test/test.broker.sqs.js +158 -0
- package/dist/test/test.broker.sqs.js.map +1 -0
- package/dist/test/test.caches.d.ts +1 -0
- package/dist/test/test.caches.js +231 -0
- package/dist/test/test.caches.js.map +1 -0
- package/dist/test/test.database.d.ts +1 -0
- package/dist/test/test.database.dynamo.d.ts +1 -0
- package/dist/test/test.database.dynamo.js +265 -0
- package/dist/test/test.database.dynamo.js.map +1 -0
- package/dist/test/test.database.js +140 -0
- package/dist/test/test.database.js.map +1 -0
- package/dist/test/test.database.mongo.d.ts +1 -0
- package/dist/test/test.database.mongo.js +371 -0
- package/dist/test/test.database.mongo.js.map +1 -0
- package/dist/test/test.database.mysql.d.ts +1 -0
- package/dist/test/test.database.mysql.js +415 -0
- package/dist/test/test.database.mysql.js.map +1 -0
- package/dist/test/test.database.postgres.d.ts +1 -0
- package/dist/test/test.database.postgres.js +412 -0
- package/dist/test/test.database.postgres.js.map +1 -0
- package/dist/test/test.email.brevo.d.ts +1 -0
- package/dist/test/test.email.brevo.js +326 -0
- package/dist/test/test.email.brevo.js.map +1 -0
- package/dist/test/test.email.mailgun.d.ts +1 -0
- package/dist/test/test.email.mailgun.js +352 -0
- package/dist/test/test.email.mailgun.js.map +1 -0
- package/dist/test/test.email.postmark.d.ts +1 -0
- package/dist/test/test.email.postmark.js +316 -0
- package/dist/test/test.email.postmark.js.map +1 -0
- package/dist/test/test.email.sendgrid.d.ts +1 -0
- package/dist/test/test.email.sendgrid.js +365 -0
- package/dist/test/test.email.sendgrid.js.map +1 -0
- package/dist/test/test.email.smtp.d.ts +1 -0
- package/dist/test/test.email.smtp.js +323 -0
- package/dist/test/test.email.smtp.js.map +1 -0
- package/dist/test/test.graph.arangodb.d.ts +1 -0
- package/dist/test/test.graph.arangodb.js +358 -0
- package/dist/test/test.graph.arangodb.js.map +1 -0
- package/dist/test/test.graph.memgraph.d.ts +1 -0
- package/dist/test/test.graph.memgraph.js +320 -0
- package/dist/test/test.graph.memgraph.js.map +1 -0
- package/dist/test/test.graph.neo4j.d.ts +1 -0
- package/dist/test/test.graph.neo4j.js +218 -0
- package/dist/test/test.graph.neo4j.js.map +1 -0
- package/dist/test/test.graph.neptune.d.ts +1 -0
- package/dist/test/test.graph.neptune.js +331 -0
- package/dist/test/test.graph.neptune.js.map +1 -0
- package/dist/test/test.health.js +1 -0
- package/dist/test/test.health.js.map +1 -0
- package/dist/test/test.import.d.ts +0 -1
- package/dist/test/test.import.js +0 -1459
- 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.js +14 -55
- 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.notifications.d.ts +1 -0
- package/dist/test/test.notifications.js +198 -0
- package/dist/test/test.notifications.js.map +1 -0
- package/dist/test/test.notifiers.js +1 -0
- package/dist/test/test.notifiers.js.map +1 -0
- package/dist/test/test.processor.d.ts +0 -1
- package/dist/test/test.processor.js +0 -122
- 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.js +1 -0
- package/dist/test/test.products.js.map +1 -0
- package/dist/test/test.push.expo.d.ts +1 -0
- package/dist/test/test.push.expo.js +442 -0
- package/dist/test/test.push.expo.js.map +1 -0
- package/dist/test/test.push.firebase.d.ts +1 -0
- package/dist/test/test.push.firebase.js +409 -0
- package/dist/test/test.push.firebase.js.map +1 -0
- package/dist/test/test.session.d.ts +1 -0
- package/dist/test/test.session.js +299 -0
- package/dist/test/test.session.js.map +1 -0
- package/dist/test/test.sms.nexmo.d.ts +1 -0
- package/dist/test/test.sms.nexmo.js +278 -0
- package/dist/test/test.sms.nexmo.js.map +1 -0
- package/dist/test/test.sms.twilio.d.ts +1 -0
- package/dist/test/test.sms.twilio.js +275 -0
- package/dist/test/test.sms.twilio.js.map +1 -0
- package/dist/test/test.storage.d.ts +1 -0
- package/dist/test/test.storage.js +202 -0
- package/dist/test/test.storage.js.map +1 -0
- package/dist/test/test.triggers.d.ts +1 -0
- package/dist/test/test.triggers.js +314 -0
- package/dist/test/test.triggers.js.map +1 -0
- package/dist/test/test.vector.pinecone.d.ts +1 -0
- package/dist/test/test.vector.pinecone.js +238 -0
- package/dist/test/test.vector.pinecone.js.map +1 -0
- package/dist/test/test.vector.qdrant.d.ts +1 -0
- package/dist/test/test.vector.qdrant.js +307 -0
- package/dist/test/test.vector.qdrant.js.map +1 -0
- package/dist/test/test.vector.weaviate.d.ts +1 -0
- package/dist/test/test.vector.weaviate.js +325 -0
- package/dist/test/test.vector.weaviate.js.map +1 -0
- package/dist/types/appBuilder.types.d.ts +10 -13
- package/dist/types/enums.d.ts +11 -1
- package/dist/types/enums.js +10 -0
- package/dist/types/enums.js.map +1 -1
- package/dist/types/index.types.d.ts +6 -4
- package/dist/types/index.types.js +0 -1
- package/dist/types/index.types.js.map +1 -1
- package/dist/types/pricing.types.d.ts +4 -0
- package/dist/types/pricing.types.js +3 -0
- package/dist/types/pricing.types.js.map +1 -0
- package/dist/types/processor.types.d.ts +245 -20
- package/dist/types/processor.types.js +9 -1
- package/dist/types/processor.types.js.map +1 -1
- package/dist/types/productsBuilder.types.d.ts +906 -24
- package/dist/types/productsBuilder.types.js +173 -2
- package/dist/types/productsBuilder.types.js.map +1 -1
- package/dist/types/request-tracker.interface.js +1 -0
- package/dist/types/request-tracker.interface.js.map +1 -0
- package/dist/types/requests.types.d.ts +2 -0
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.js +5 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +24 -52
- 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 +116 -0
- package/dist/vector/utils/vector-error.js.map +1 -0
- package/dist/vector/vector-database.service.d.ts +408 -0
- package/dist/vector/vector-database.service.js +545 -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 +384 -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 +208 -0
- package/dist/workflows/workflow-executor.js +1194 -0
- package/dist/workflows/workflow-executor.js.map +1 -0
- package/dist/workflows/workflows.service.d.ts +404 -0
- package/dist/workflows/workflows.service.js +1620 -0
- package/dist/workflows/workflows.service.js.map +1 -0
- package/package.json +54 -11
- package/dist/actions/actions.repo.js +0 -13
- package/dist/actions/actions.repo.js.map +0 -1
- package/dist/actions/actions.service.js +0 -24
- package/dist/actions/actions.service.js.map +0 -1
- 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/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.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.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/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.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/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/test.appBuilder.js +0 -14
- package/dist/test.appBuilder.js.map +0 -1
- 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.js +0 -23
- package/dist/test.processor.js.map +0 -1
- package/dist/test.utils.js +0 -25
- package/dist/test.utils.js.map +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/{actions/actions.repo.d.ts → pricing/pricing.repo.d.ts} +0 -0
- /package/dist/{appBuilder/validators/joi-validators/create.app.validator.d.ts → products/validators/joi-validators/create.productGraph.validator.d.ts} +0 -0
- /package/dist/{appBuilder/validators/joi-validators/update.validation.entityData.validator.d.ts → products/validators/joi-validators/update.productGraph.validator.d.ts} +0 -0
- /package/dist/{test.appBuilder.d.ts → test/test.broker.kafka.d.ts} +0 -0
- /package/dist/{test.imports.d.ts → test/test.broker.nats.d.ts} +0 -0
- /package/dist/{test.integrationBuilder.d.ts → test/test.broker.pubsub.d.ts} +0 -0
- /package/dist/{test.processor.d.ts → test/test.broker.rabbitmq.d.ts} +0 -0
- /package/dist/{test.utils.d.ts → test/test.broker.redis.d.ts} +0 -0
- /package/dist/{actions/actions.service.d.ts → test/test.health.d.ts} +0 -0
- /package/dist/{actions/utils/actions.util.read.d.ts → test/test.notifiers.d.ts} +0 -0
- /package/dist/{processor/utils/mongo.util.d.ts → test/test.products.d.ts} +0 -0
- /package/dist/{test.import.d.ts → types/request-tracker.interface.d.ts} +0 -0
|
@@ -0,0 +1,1522 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ArangoDB Graph Database Adapter
|
|
4
|
+
*
|
|
5
|
+
* Implements the BaseGraphAdapter for ArangoDB.
|
|
6
|
+
* ArangoDB is a multi-model database that supports documents, graphs, and key-value.
|
|
7
|
+
* Uses AQL (ArangoDB Query Language) for graph operations.
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.ArangoDBAdapter = void 0;
|
|
44
|
+
const base_adapter_1 = require("./base.adapter");
|
|
45
|
+
const enums_1 = require("../types/enums");
|
|
46
|
+
const graph_error_1 = require("../utils/graph-error");
|
|
47
|
+
/**
|
|
48
|
+
* ArangoDB adapter using arangojs
|
|
49
|
+
*/
|
|
50
|
+
class ArangoDBAdapter extends base_adapter_1.BaseGraphAdapter {
|
|
51
|
+
constructor() {
|
|
52
|
+
super(...arguments);
|
|
53
|
+
this.graphType = enums_1.GraphType.ARANGODB;
|
|
54
|
+
this.supportedFeatures = new Set([
|
|
55
|
+
enums_1.GraphFeature.TRANSACTIONS,
|
|
56
|
+
enums_1.GraphFeature.SCHEMA_INDEXES,
|
|
57
|
+
enums_1.GraphFeature.FULL_TEXT_SEARCH,
|
|
58
|
+
enums_1.GraphFeature.MULTI_TENANCY,
|
|
59
|
+
]);
|
|
60
|
+
this.db = null;
|
|
61
|
+
this.graph = null;
|
|
62
|
+
this.graphName = '';
|
|
63
|
+
this.vertexCollections = [];
|
|
64
|
+
this.edgeCollections = [];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Connect to ArangoDB
|
|
68
|
+
*/
|
|
69
|
+
async connect(options) {
|
|
70
|
+
var _a;
|
|
71
|
+
try {
|
|
72
|
+
// Dynamically import arangojs
|
|
73
|
+
const arangojs = await Promise.resolve().then(() => __importStar(require('arangojs')));
|
|
74
|
+
const { Database } = arangojs;
|
|
75
|
+
this.db = new Database({
|
|
76
|
+
url: options.connectionUrl,
|
|
77
|
+
databaseName: options.database || '_system',
|
|
78
|
+
});
|
|
79
|
+
// If graph name is provided, get the graph
|
|
80
|
+
if (options.graphName) {
|
|
81
|
+
this.graphName = options.graphName;
|
|
82
|
+
this.graph = this.db.graph(options.graphName);
|
|
83
|
+
// Get graph info
|
|
84
|
+
const graphInfo = await this.graph.get();
|
|
85
|
+
this.vertexCollections = graphInfo.orphanCollections || [];
|
|
86
|
+
this.edgeCollections = ((_a = graphInfo.edgeDefinitions) === null || _a === void 0 ? void 0 : _a.map((ed) => ed.collection)) || [];
|
|
87
|
+
// Add vertex collections from edge definitions
|
|
88
|
+
for (const ed of graphInfo.edgeDefinitions || []) {
|
|
89
|
+
this.vertexCollections.push(...ed.from, ...ed.to);
|
|
90
|
+
}
|
|
91
|
+
this.vertexCollections = [...new Set(this.vertexCollections)];
|
|
92
|
+
}
|
|
93
|
+
this.client = this.db;
|
|
94
|
+
this.connected = true;
|
|
95
|
+
return {
|
|
96
|
+
connected: true,
|
|
97
|
+
type: this.graphType,
|
|
98
|
+
version: await this.getVersion(),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
this.connected = false;
|
|
103
|
+
throw graph_error_1.GraphError.connectionError(`Failed to connect to ArangoDB: ${error.message}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async getVersion() {
|
|
107
|
+
try {
|
|
108
|
+
const info = await this.db.version();
|
|
109
|
+
return info.version;
|
|
110
|
+
}
|
|
111
|
+
catch (_a) {
|
|
112
|
+
return 'unknown';
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Disconnect from ArangoDB
|
|
117
|
+
*/
|
|
118
|
+
async disconnect() {
|
|
119
|
+
if (this.db) {
|
|
120
|
+
this.db = null;
|
|
121
|
+
this.graph = null;
|
|
122
|
+
this.client = null;
|
|
123
|
+
this.connected = false;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Test ArangoDB connection
|
|
128
|
+
*/
|
|
129
|
+
async testConnection(options) {
|
|
130
|
+
try {
|
|
131
|
+
await this.connect(options);
|
|
132
|
+
const startTime = Date.now();
|
|
133
|
+
const version = await this.getVersion();
|
|
134
|
+
const latency = Date.now() - startTime;
|
|
135
|
+
await this.disconnect();
|
|
136
|
+
return {
|
|
137
|
+
connected: true,
|
|
138
|
+
type: this.graphType,
|
|
139
|
+
version,
|
|
140
|
+
latency,
|
|
141
|
+
features: ['aql', 'multi-model', 'transactions'],
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
return {
|
|
146
|
+
connected: false,
|
|
147
|
+
type: this.graphType,
|
|
148
|
+
error: error.message,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// ==================== NODE OPERATIONS ====================
|
|
153
|
+
async createNode(options, transaction) {
|
|
154
|
+
this.ensureConnected();
|
|
155
|
+
try {
|
|
156
|
+
const collectionName = options.labels[0];
|
|
157
|
+
const collection = this.db.collection(collectionName);
|
|
158
|
+
const doc = Object.assign(Object.assign({}, options.properties), { _labels: options.labels });
|
|
159
|
+
const result = await collection.save(doc, { returnNew: true });
|
|
160
|
+
const node = {
|
|
161
|
+
id: result._key,
|
|
162
|
+
labels: options.labels,
|
|
163
|
+
properties: result.new,
|
|
164
|
+
elementId: result._id,
|
|
165
|
+
};
|
|
166
|
+
return { node, created: true };
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
throw graph_error_1.GraphError.queryError(`Failed to create node: ${error.message}`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
async findNodes(options, transaction) {
|
|
173
|
+
var _a, _b, _c, _d, _e;
|
|
174
|
+
this.ensureConnected();
|
|
175
|
+
try {
|
|
176
|
+
let aql = 'FOR doc IN @@collection';
|
|
177
|
+
const bindVars = {};
|
|
178
|
+
const collectionName = ((_a = options.labels) === null || _a === void 0 ? void 0 : _a[0]) || this.vertexCollections[0];
|
|
179
|
+
bindVars['@collection'] = collectionName;
|
|
180
|
+
if (options.where) {
|
|
181
|
+
const { filterStr, filterVars } = this.buildArangoWhereClause(options.where, 'doc');
|
|
182
|
+
if (filterStr) {
|
|
183
|
+
aql += ` FILTER ${filterStr}`;
|
|
184
|
+
Object.assign(bindVars, filterVars);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if ((_b = options.orderBy) === null || _b === void 0 ? void 0 : _b.length) {
|
|
188
|
+
const sortParts = options.orderBy.map((o) => `doc.${o.property} ${o.direction || 'ASC'}`);
|
|
189
|
+
aql += ` SORT ${sortParts.join(', ')}`;
|
|
190
|
+
}
|
|
191
|
+
const skipValue = (_d = (_c = options.skip) !== null && _c !== void 0 ? _c : options.offset) !== null && _d !== void 0 ? _d : 0;
|
|
192
|
+
const limitValue = (_e = options.limit) !== null && _e !== void 0 ? _e : 100;
|
|
193
|
+
aql += ` LIMIT ${skipValue}, ${limitValue}`;
|
|
194
|
+
aql += ' RETURN doc';
|
|
195
|
+
const cursor = await this.db.query(aql, bindVars);
|
|
196
|
+
const docs = await cursor.all();
|
|
197
|
+
const nodes = docs.map((doc) => ({
|
|
198
|
+
id: doc._key,
|
|
199
|
+
labels: doc._labels || [collectionName],
|
|
200
|
+
properties: this.cleanArangoProps(doc),
|
|
201
|
+
elementId: doc._id,
|
|
202
|
+
}));
|
|
203
|
+
const countAql = `RETURN LENGTH(FOR doc IN @@collection ${options.where ? `FILTER ${this.buildArangoWhereClause(options.where, 'doc').filterStr}` : ''} RETURN 1)`;
|
|
204
|
+
const countCursor = await this.db.query(countAql, { '@collection': collectionName });
|
|
205
|
+
const [total] = await countCursor.all();
|
|
206
|
+
return { nodes, total };
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
throw graph_error_1.GraphError.queryError(`Failed to find nodes: ${error.message}`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
async findNodeById(id, transaction) {
|
|
213
|
+
this.ensureConnected();
|
|
214
|
+
try {
|
|
215
|
+
const docId = String(id).includes('/') ? id : null;
|
|
216
|
+
if (!docId) {
|
|
217
|
+
for (const collName of this.vertexCollections) {
|
|
218
|
+
try {
|
|
219
|
+
const collection = this.db.collection(collName);
|
|
220
|
+
const doc = await collection.document(id);
|
|
221
|
+
return {
|
|
222
|
+
id: doc._key,
|
|
223
|
+
labels: doc._labels || [collName],
|
|
224
|
+
properties: this.cleanArangoProps(doc),
|
|
225
|
+
elementId: doc._id,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
catch (_a) {
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
const [collName] = String(docId).split('/');
|
|
235
|
+
const collection = this.db.collection(collName);
|
|
236
|
+
const doc = await collection.document(docId);
|
|
237
|
+
return {
|
|
238
|
+
id: doc._key,
|
|
239
|
+
labels: doc._labels || [collName],
|
|
240
|
+
properties: this.cleanArangoProps(doc),
|
|
241
|
+
elementId: doc._id,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
if (error.code === 404) {
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
throw graph_error_1.GraphError.queryError(`Failed to find node by ID: ${error.message}`);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
async updateNode(options, transaction) {
|
|
252
|
+
this.ensureConnected();
|
|
253
|
+
try {
|
|
254
|
+
const docId = String(options.id);
|
|
255
|
+
const [collName] = docId.includes('/') ? docId.split('/') : [this.vertexCollections[0]];
|
|
256
|
+
const collection = this.db.collection(collName);
|
|
257
|
+
const key = docId.includes('/') ? docId.split('/')[1] : docId;
|
|
258
|
+
let updateData = {};
|
|
259
|
+
if (options.properties) {
|
|
260
|
+
if ('$SET' in options.properties) {
|
|
261
|
+
updateData = Object.assign(Object.assign({}, updateData), options.properties.$SET);
|
|
262
|
+
}
|
|
263
|
+
if ('$UNSET' in options.properties) {
|
|
264
|
+
for (const prop of options.properties.$UNSET || []) {
|
|
265
|
+
updateData[prop] = null;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if ('$INCREMENT' in options.properties) {
|
|
269
|
+
for (const [prop, value] of Object.entries(options.properties.$INCREMENT || {})) {
|
|
270
|
+
const current = await collection.document(key);
|
|
271
|
+
updateData[prop] = (current[prop] || 0) + value;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if ('$APPEND' in options.properties) {
|
|
275
|
+
for (const [prop, value] of Object.entries(options.properties.$APPEND || {})) {
|
|
276
|
+
const current = await collection.document(key);
|
|
277
|
+
updateData[prop] = [...(current[prop] || []), value];
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
const result = await collection.update(key, updateData, { returnNew: true });
|
|
282
|
+
const node = {
|
|
283
|
+
id: result._key,
|
|
284
|
+
labels: result.new._labels || [collName],
|
|
285
|
+
properties: this.cleanArangoProps(result.new),
|
|
286
|
+
elementId: result._id,
|
|
287
|
+
};
|
|
288
|
+
return { node, updated: true };
|
|
289
|
+
}
|
|
290
|
+
catch (error) {
|
|
291
|
+
throw graph_error_1.GraphError.queryError(`Failed to update node: ${error.message}`);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
async deleteNode(options, transaction) {
|
|
295
|
+
this.ensureConnected();
|
|
296
|
+
try {
|
|
297
|
+
const docId = String(options.id);
|
|
298
|
+
const [collName] = docId.includes('/') ? docId.split('/') : [this.vertexCollections[0]];
|
|
299
|
+
const collection = this.db.collection(collName);
|
|
300
|
+
const key = docId.includes('/') ? docId.split('/')[1] : docId;
|
|
301
|
+
if (options.detach) {
|
|
302
|
+
const fullId = docId.includes('/') ? docId : `${collName}/${key}`;
|
|
303
|
+
for (const edgeCollName of this.edgeCollections) {
|
|
304
|
+
await this.db.query(`FOR e IN @@collection FILTER e._from == @id OR e._to == @id REMOVE e IN @@collection`, { '@collection': edgeCollName, id: fullId });
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
await collection.remove(key);
|
|
308
|
+
return { deleted: true, id: options.id };
|
|
309
|
+
}
|
|
310
|
+
catch (error) {
|
|
311
|
+
throw graph_error_1.GraphError.queryError(`Failed to delete node: ${error.message}`);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
async mergeNode(options, transaction) {
|
|
315
|
+
this.ensureConnected();
|
|
316
|
+
try {
|
|
317
|
+
const collectionName = options.labels[0];
|
|
318
|
+
const collection = this.db.collection(collectionName);
|
|
319
|
+
const { filterStr, filterVars } = this.buildArangoWhereClause(options.matchProperties, 'doc');
|
|
320
|
+
const findAql = `FOR doc IN @@collection FILTER ${filterStr} LIMIT 1 RETURN doc`;
|
|
321
|
+
const cursor = await this.db.query(findAql, Object.assign({ '@collection': collectionName }, filterVars));
|
|
322
|
+
const existing = await cursor.all();
|
|
323
|
+
if (existing.length > 0) {
|
|
324
|
+
const doc = existing[0];
|
|
325
|
+
const updateData = options.onMatch || {};
|
|
326
|
+
const result = await collection.update(doc._key, updateData, { returnNew: true });
|
|
327
|
+
return {
|
|
328
|
+
node: {
|
|
329
|
+
id: result._key,
|
|
330
|
+
labels: options.labels,
|
|
331
|
+
properties: this.cleanArangoProps(result.new),
|
|
332
|
+
elementId: result._id,
|
|
333
|
+
},
|
|
334
|
+
created: false,
|
|
335
|
+
merged: true,
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
const createData = Object.assign(Object.assign(Object.assign({}, options.matchProperties), (options.onCreate || {})), { _labels: options.labels });
|
|
340
|
+
const result = await collection.save(createData, { returnNew: true });
|
|
341
|
+
return {
|
|
342
|
+
node: {
|
|
343
|
+
id: result._key,
|
|
344
|
+
labels: options.labels,
|
|
345
|
+
properties: this.cleanArangoProps(result.new),
|
|
346
|
+
elementId: result._id,
|
|
347
|
+
},
|
|
348
|
+
created: true,
|
|
349
|
+
merged: true,
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
catch (error) {
|
|
354
|
+
throw graph_error_1.GraphError.queryError(`Failed to merge node: ${error.message}`);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
// ==================== LABEL MANAGEMENT ====================
|
|
358
|
+
async addLabels(options, _transaction) {
|
|
359
|
+
this.ensureConnected();
|
|
360
|
+
try {
|
|
361
|
+
// In ArangoDB, we store labels in a _labels array property
|
|
362
|
+
// First, find the document
|
|
363
|
+
const docId = String(options.id);
|
|
364
|
+
const isFullId = docId.includes('/');
|
|
365
|
+
let doc;
|
|
366
|
+
if (isFullId) {
|
|
367
|
+
const [collectionName, key] = docId.split('/');
|
|
368
|
+
const collection = this.db.collection(collectionName);
|
|
369
|
+
doc = await collection.document(key);
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
// Search across vertex collections
|
|
373
|
+
for (const collectionName of this.vertexCollections) {
|
|
374
|
+
try {
|
|
375
|
+
const collection = this.db.collection(collectionName);
|
|
376
|
+
doc = await collection.document(docId);
|
|
377
|
+
break;
|
|
378
|
+
}
|
|
379
|
+
catch (_a) {
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (!doc) {
|
|
385
|
+
throw graph_error_1.GraphError.notFoundError(`Node with ID ${options.id} not found`);
|
|
386
|
+
}
|
|
387
|
+
const existingLabels = doc._labels || [];
|
|
388
|
+
const newLabels = [...new Set([...existingLabels, ...options.labels])];
|
|
389
|
+
const [collectionName] = doc._id.split('/');
|
|
390
|
+
const collection = this.db.collection(collectionName);
|
|
391
|
+
const result = await collection.update(doc._key, { _labels: newLabels }, { returnNew: true });
|
|
392
|
+
return {
|
|
393
|
+
node: {
|
|
394
|
+
id: result._key,
|
|
395
|
+
labels: newLabels,
|
|
396
|
+
properties: this.cleanArangoProps(result.new),
|
|
397
|
+
elementId: result._id,
|
|
398
|
+
},
|
|
399
|
+
addedLabels: options.labels,
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
catch (error) {
|
|
403
|
+
if (error instanceof graph_error_1.GraphError)
|
|
404
|
+
throw error;
|
|
405
|
+
throw graph_error_1.GraphError.queryError(`Failed to add labels: ${error.message}`);
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
async removeLabels(options, _transaction) {
|
|
409
|
+
this.ensureConnected();
|
|
410
|
+
try {
|
|
411
|
+
const docId = String(options.id);
|
|
412
|
+
const isFullId = docId.includes('/');
|
|
413
|
+
let doc;
|
|
414
|
+
if (isFullId) {
|
|
415
|
+
const [collectionName, key] = docId.split('/');
|
|
416
|
+
const collection = this.db.collection(collectionName);
|
|
417
|
+
doc = await collection.document(key);
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
for (const collectionName of this.vertexCollections) {
|
|
421
|
+
try {
|
|
422
|
+
const collection = this.db.collection(collectionName);
|
|
423
|
+
doc = await collection.document(docId);
|
|
424
|
+
break;
|
|
425
|
+
}
|
|
426
|
+
catch (_a) {
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
if (!doc) {
|
|
432
|
+
throw graph_error_1.GraphError.notFoundError(`Node with ID ${options.id} not found`);
|
|
433
|
+
}
|
|
434
|
+
const existingLabels = doc._labels || [];
|
|
435
|
+
const newLabels = existingLabels.filter(l => !options.labels.includes(l));
|
|
436
|
+
const [collectionName] = doc._id.split('/');
|
|
437
|
+
const collection = this.db.collection(collectionName);
|
|
438
|
+
const result = await collection.update(doc._key, { _labels: newLabels }, { returnNew: true });
|
|
439
|
+
return {
|
|
440
|
+
node: {
|
|
441
|
+
id: result._key,
|
|
442
|
+
labels: newLabels,
|
|
443
|
+
properties: this.cleanArangoProps(result.new),
|
|
444
|
+
elementId: result._id,
|
|
445
|
+
},
|
|
446
|
+
removedLabels: options.labels,
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
catch (error) {
|
|
450
|
+
if (error instanceof graph_error_1.GraphError)
|
|
451
|
+
throw error;
|
|
452
|
+
throw graph_error_1.GraphError.queryError(`Failed to remove labels: ${error.message}`);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
async setLabels(options, _transaction) {
|
|
456
|
+
this.ensureConnected();
|
|
457
|
+
try {
|
|
458
|
+
const docId = String(options.id);
|
|
459
|
+
const isFullId = docId.includes('/');
|
|
460
|
+
let doc;
|
|
461
|
+
if (isFullId) {
|
|
462
|
+
const [collectionName, key] = docId.split('/');
|
|
463
|
+
const collection = this.db.collection(collectionName);
|
|
464
|
+
doc = await collection.document(key);
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
for (const collectionName of this.vertexCollections) {
|
|
468
|
+
try {
|
|
469
|
+
const collection = this.db.collection(collectionName);
|
|
470
|
+
doc = await collection.document(docId);
|
|
471
|
+
break;
|
|
472
|
+
}
|
|
473
|
+
catch (_a) {
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
if (!doc) {
|
|
479
|
+
throw graph_error_1.GraphError.notFoundError(`Node with ID ${options.id} not found`);
|
|
480
|
+
}
|
|
481
|
+
const previousLabels = doc._labels || [];
|
|
482
|
+
const [collectionName] = doc._id.split('/');
|
|
483
|
+
const collection = this.db.collection(collectionName);
|
|
484
|
+
const result = await collection.update(doc._key, { _labels: options.labels }, { returnNew: true });
|
|
485
|
+
return {
|
|
486
|
+
node: {
|
|
487
|
+
id: result._key,
|
|
488
|
+
labels: options.labels,
|
|
489
|
+
properties: this.cleanArangoProps(result.new),
|
|
490
|
+
elementId: result._id,
|
|
491
|
+
},
|
|
492
|
+
previousLabels,
|
|
493
|
+
newLabels: options.labels,
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
catch (error) {
|
|
497
|
+
if (error instanceof graph_error_1.GraphError)
|
|
498
|
+
throw error;
|
|
499
|
+
throw graph_error_1.GraphError.queryError(`Failed to set labels: ${error.message}`);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
// ==================== RELATIONSHIP OPERATIONS ====================
|
|
503
|
+
async createRelationship(options, transaction) {
|
|
504
|
+
this.ensureConnected();
|
|
505
|
+
try {
|
|
506
|
+
const edgeCollectionName = options.type;
|
|
507
|
+
const edgeCollection = this.db.collection(edgeCollectionName);
|
|
508
|
+
const fromId = String(options.startNodeId).includes('/')
|
|
509
|
+
? options.startNodeId
|
|
510
|
+
: await this.resolveNodeId(options.startNodeId);
|
|
511
|
+
const toId = String(options.endNodeId).includes('/')
|
|
512
|
+
? options.endNodeId
|
|
513
|
+
: await this.resolveNodeId(options.endNodeId);
|
|
514
|
+
const edgeDoc = Object.assign({ _from: fromId, _to: toId }, options.properties);
|
|
515
|
+
const result = await edgeCollection.save(edgeDoc, { returnNew: true });
|
|
516
|
+
const relationship = {
|
|
517
|
+
id: result._key,
|
|
518
|
+
type: options.type,
|
|
519
|
+
startNodeId: fromId,
|
|
520
|
+
endNodeId: toId,
|
|
521
|
+
properties: this.cleanArangoProps(result.new),
|
|
522
|
+
elementId: result._id,
|
|
523
|
+
};
|
|
524
|
+
return { relationship, created: true };
|
|
525
|
+
}
|
|
526
|
+
catch (error) {
|
|
527
|
+
throw graph_error_1.GraphError.queryError(`Failed to create relationship: ${error.message}`);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
async findRelationships(options, transaction) {
|
|
531
|
+
var _a, _b, _c, _d;
|
|
532
|
+
this.ensureConnected();
|
|
533
|
+
try {
|
|
534
|
+
const edgeCollectionName = ((_a = options.types) === null || _a === void 0 ? void 0 : _a[0]) || (Array.isArray(options.type) ? options.type[0] : options.type) || this.edgeCollections[0];
|
|
535
|
+
let aql = 'FOR edge IN @@collection';
|
|
536
|
+
const bindVars = { '@collection': edgeCollectionName };
|
|
537
|
+
if (options.where) {
|
|
538
|
+
const { filterStr, filterVars } = this.buildArangoWhereClause(options.where, 'edge');
|
|
539
|
+
if (filterStr) {
|
|
540
|
+
aql += ` FILTER ${filterStr}`;
|
|
541
|
+
Object.assign(bindVars, filterVars);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
const skipValue = (_c = (_b = options.skip) !== null && _b !== void 0 ? _b : options.offset) !== null && _c !== void 0 ? _c : 0;
|
|
545
|
+
const limitValue = (_d = options.limit) !== null && _d !== void 0 ? _d : 100;
|
|
546
|
+
aql += ` LIMIT ${skipValue}, ${limitValue}`;
|
|
547
|
+
aql += ' RETURN edge';
|
|
548
|
+
const cursor = await this.db.query(aql, bindVars);
|
|
549
|
+
const edges = await cursor.all();
|
|
550
|
+
const relationships = edges.map((edge) => ({
|
|
551
|
+
id: edge._key,
|
|
552
|
+
type: edgeCollectionName,
|
|
553
|
+
startNodeId: edge._from,
|
|
554
|
+
endNodeId: edge._to,
|
|
555
|
+
properties: this.cleanArangoProps(edge),
|
|
556
|
+
elementId: edge._id,
|
|
557
|
+
}));
|
|
558
|
+
return { relationships, total: relationships.length };
|
|
559
|
+
}
|
|
560
|
+
catch (error) {
|
|
561
|
+
throw graph_error_1.GraphError.queryError(`Failed to find relationships: ${error.message}`);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
async findRelationshipById(id, transaction) {
|
|
565
|
+
this.ensureConnected();
|
|
566
|
+
try {
|
|
567
|
+
const docId = String(id);
|
|
568
|
+
if (!docId.includes('/')) {
|
|
569
|
+
for (const collName of this.edgeCollections) {
|
|
570
|
+
try {
|
|
571
|
+
const collection = this.db.collection(collName);
|
|
572
|
+
const edge = await collection.document(id);
|
|
573
|
+
return {
|
|
574
|
+
id: edge._key,
|
|
575
|
+
type: collName,
|
|
576
|
+
startNodeId: edge._from,
|
|
577
|
+
endNodeId: edge._to,
|
|
578
|
+
properties: this.cleanArangoProps(edge),
|
|
579
|
+
elementId: edge._id,
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
catch (_a) {
|
|
583
|
+
continue;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
return null;
|
|
587
|
+
}
|
|
588
|
+
const [collName] = docId.split('/');
|
|
589
|
+
const collection = this.db.collection(collName);
|
|
590
|
+
const edge = await collection.document(docId);
|
|
591
|
+
return {
|
|
592
|
+
id: edge._key,
|
|
593
|
+
type: collName,
|
|
594
|
+
startNodeId: edge._from,
|
|
595
|
+
endNodeId: edge._to,
|
|
596
|
+
properties: this.cleanArangoProps(edge),
|
|
597
|
+
elementId: edge._id,
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
catch (error) {
|
|
601
|
+
if (error.code === 404) {
|
|
602
|
+
return null;
|
|
603
|
+
}
|
|
604
|
+
throw graph_error_1.GraphError.queryError(`Failed to find relationship by ID: ${error.message}`);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
async updateRelationship(options, transaction) {
|
|
608
|
+
this.ensureConnected();
|
|
609
|
+
try {
|
|
610
|
+
const docId = String(options.id);
|
|
611
|
+
const [collName] = docId.includes('/') ? docId.split('/') : [this.edgeCollections[0]];
|
|
612
|
+
const collection = this.db.collection(collName);
|
|
613
|
+
const key = docId.includes('/') ? docId.split('/')[1] : docId;
|
|
614
|
+
let updateData = {};
|
|
615
|
+
if (options.properties) {
|
|
616
|
+
if ('$SET' in options.properties) {
|
|
617
|
+
updateData = Object.assign(Object.assign({}, updateData), options.properties.$SET);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
const result = await collection.update(key, updateData, { returnNew: true });
|
|
621
|
+
const relationship = {
|
|
622
|
+
id: result._key,
|
|
623
|
+
type: collName,
|
|
624
|
+
startNodeId: result.new._from,
|
|
625
|
+
endNodeId: result.new._to,
|
|
626
|
+
properties: this.cleanArangoProps(result.new),
|
|
627
|
+
elementId: result._id,
|
|
628
|
+
};
|
|
629
|
+
return { relationship, updated: true };
|
|
630
|
+
}
|
|
631
|
+
catch (error) {
|
|
632
|
+
throw graph_error_1.GraphError.queryError(`Failed to update relationship: ${error.message}`);
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
async deleteRelationship(options, transaction) {
|
|
636
|
+
this.ensureConnected();
|
|
637
|
+
try {
|
|
638
|
+
const docId = String(options.id);
|
|
639
|
+
const [collName] = docId.includes('/') ? docId.split('/') : [this.edgeCollections[0]];
|
|
640
|
+
const collection = this.db.collection(collName);
|
|
641
|
+
const key = docId.includes('/') ? docId.split('/')[1] : docId;
|
|
642
|
+
await collection.remove(key);
|
|
643
|
+
return { deleted: true, id: options.id };
|
|
644
|
+
}
|
|
645
|
+
catch (error) {
|
|
646
|
+
throw graph_error_1.GraphError.queryError(`Failed to delete relationship: ${error.message}`);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
async mergeRelationship(options, transaction) {
|
|
650
|
+
this.ensureConnected();
|
|
651
|
+
try {
|
|
652
|
+
const edgeCollectionName = options.type;
|
|
653
|
+
const fromId = String(options.startNodeId).includes('/')
|
|
654
|
+
? options.startNodeId
|
|
655
|
+
: await this.resolveNodeId(options.startNodeId);
|
|
656
|
+
const toId = String(options.endNodeId).includes('/')
|
|
657
|
+
? options.endNodeId
|
|
658
|
+
: await this.resolveNodeId(options.endNodeId);
|
|
659
|
+
let filterStr = 'edge._from == @from AND edge._to == @to';
|
|
660
|
+
const bindVars = {
|
|
661
|
+
'@collection': edgeCollectionName,
|
|
662
|
+
from: fromId,
|
|
663
|
+
to: toId,
|
|
664
|
+
};
|
|
665
|
+
if (options.matchProperties) {
|
|
666
|
+
const { filterStr: matchFilter, filterVars } = this.buildArangoWhereClause(options.matchProperties, 'edge');
|
|
667
|
+
if (matchFilter) {
|
|
668
|
+
filterStr += ` AND ${matchFilter}`;
|
|
669
|
+
Object.assign(bindVars, filterVars);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
const findAql = `FOR edge IN @@collection FILTER ${filterStr} LIMIT 1 RETURN edge`;
|
|
673
|
+
const cursor = await this.db.query(findAql, bindVars);
|
|
674
|
+
const existing = await cursor.all();
|
|
675
|
+
if (existing.length > 0) {
|
|
676
|
+
const edge = existing[0];
|
|
677
|
+
const collection = this.db.collection(edgeCollectionName);
|
|
678
|
+
const updateData = options.onMatch || {};
|
|
679
|
+
const result = await collection.update(edge._key, updateData, { returnNew: true });
|
|
680
|
+
return {
|
|
681
|
+
relationship: {
|
|
682
|
+
id: result._key,
|
|
683
|
+
type: options.type,
|
|
684
|
+
startNodeId: result.new._from,
|
|
685
|
+
endNodeId: result.new._to,
|
|
686
|
+
properties: this.cleanArangoProps(result.new),
|
|
687
|
+
elementId: result._id,
|
|
688
|
+
},
|
|
689
|
+
created: false,
|
|
690
|
+
merged: true,
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
else {
|
|
694
|
+
const createProps = Object.assign(Object.assign({}, options.matchProperties), (options.onCreate || {}));
|
|
695
|
+
const result = await this.createRelationship({
|
|
696
|
+
type: options.type,
|
|
697
|
+
startNodeId: options.startNodeId,
|
|
698
|
+
endNodeId: options.endNodeId,
|
|
699
|
+
properties: createProps,
|
|
700
|
+
});
|
|
701
|
+
return { relationship: result.relationship, created: true, merged: true };
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
catch (error) {
|
|
705
|
+
throw graph_error_1.GraphError.queryError(`Failed to merge relationship: ${error.message}`);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
// ==================== TRAVERSAL OPERATIONS ====================
|
|
709
|
+
async traverse(options, transaction) {
|
|
710
|
+
var _a;
|
|
711
|
+
this.ensureConnected();
|
|
712
|
+
try {
|
|
713
|
+
const startId = String(options.startNodeId).includes('/')
|
|
714
|
+
? options.startNodeId
|
|
715
|
+
: await this.resolveNodeId(options.startNodeId);
|
|
716
|
+
const direction = this.mapDirection(options.direction);
|
|
717
|
+
const maxDepth = options.maxDepth || 3;
|
|
718
|
+
const minDepth = 1;
|
|
719
|
+
const edgeCollections = ((_a = options.relationshipTypes) === null || _a === void 0 ? void 0 : _a.length)
|
|
720
|
+
? options.relationshipTypes.join(', ')
|
|
721
|
+
: this.edgeCollections.join(', ');
|
|
722
|
+
const aql = `
|
|
723
|
+
FOR v, e, p IN ${minDepth}..${maxDepth} ${direction} @startVertex
|
|
724
|
+
${edgeCollections}
|
|
725
|
+
OPTIONS { bfs: true, uniqueVertices: 'global' }
|
|
726
|
+
RETURN { vertex: v, edge: e, path: p }
|
|
727
|
+
`;
|
|
728
|
+
const cursor = await this.db.query(aql, { startVertex: startId });
|
|
729
|
+
const results = await cursor.all();
|
|
730
|
+
const nodesMap = new Map();
|
|
731
|
+
const relationshipsMap = new Map();
|
|
732
|
+
for (const result of results) {
|
|
733
|
+
if (result.vertex) {
|
|
734
|
+
const v = result.vertex;
|
|
735
|
+
nodesMap.set(v._id, {
|
|
736
|
+
id: v._key,
|
|
737
|
+
labels: v._labels || [v._id.split('/')[0]],
|
|
738
|
+
properties: this.cleanArangoProps(v),
|
|
739
|
+
elementId: v._id,
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
if (result.edge) {
|
|
743
|
+
const e = result.edge;
|
|
744
|
+
relationshipsMap.set(e._id, {
|
|
745
|
+
id: e._key,
|
|
746
|
+
type: e._id.split('/')[0],
|
|
747
|
+
startNodeId: e._from,
|
|
748
|
+
endNodeId: e._to,
|
|
749
|
+
properties: this.cleanArangoProps(e),
|
|
750
|
+
elementId: e._id,
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
return {
|
|
755
|
+
nodes: Array.from(nodesMap.values()),
|
|
756
|
+
relationships: Array.from(relationshipsMap.values()),
|
|
757
|
+
paths: [],
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
catch (error) {
|
|
761
|
+
throw graph_error_1.GraphError.queryError(`Failed to traverse: ${error.message}`);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
async shortestPath(options, transaction) {
|
|
765
|
+
var _a;
|
|
766
|
+
this.ensureConnected();
|
|
767
|
+
try {
|
|
768
|
+
const startId = String(options.startNodeId).includes('/')
|
|
769
|
+
? options.startNodeId
|
|
770
|
+
: await this.resolveNodeId(options.startNodeId);
|
|
771
|
+
const endId = String(options.endNodeId).includes('/')
|
|
772
|
+
? options.endNodeId
|
|
773
|
+
: await this.resolveNodeId(options.endNodeId);
|
|
774
|
+
const edgeCollections = ((_a = options.relationshipTypes) === null || _a === void 0 ? void 0 : _a.length)
|
|
775
|
+
? options.relationshipTypes.join(', ')
|
|
776
|
+
: this.edgeCollections.join(', ');
|
|
777
|
+
let aql;
|
|
778
|
+
if (options.weightProperty) {
|
|
779
|
+
aql = `
|
|
780
|
+
FOR v, e IN OUTBOUND SHORTEST_PATH @start TO @end
|
|
781
|
+
${edgeCollections}
|
|
782
|
+
OPTIONS { weightAttribute: @weight }
|
|
783
|
+
RETURN { vertex: v, edge: e }
|
|
784
|
+
`;
|
|
785
|
+
}
|
|
786
|
+
else {
|
|
787
|
+
aql = `
|
|
788
|
+
FOR v, e IN OUTBOUND SHORTEST_PATH @start TO @end
|
|
789
|
+
${edgeCollections}
|
|
790
|
+
RETURN { vertex: v, edge: e }
|
|
791
|
+
`;
|
|
792
|
+
}
|
|
793
|
+
const cursor = await this.db.query(aql, {
|
|
794
|
+
start: startId,
|
|
795
|
+
end: endId,
|
|
796
|
+
weight: options.weightProperty,
|
|
797
|
+
});
|
|
798
|
+
const results = await cursor.all();
|
|
799
|
+
if (results.length === 0) {
|
|
800
|
+
return { path: null, length: -1, found: false };
|
|
801
|
+
}
|
|
802
|
+
const nodes = [];
|
|
803
|
+
const relationships = [];
|
|
804
|
+
for (const result of results) {
|
|
805
|
+
if (result.vertex) {
|
|
806
|
+
nodes.push({
|
|
807
|
+
id: result.vertex._key,
|
|
808
|
+
labels: result.vertex._labels || [result.vertex._id.split('/')[0]],
|
|
809
|
+
properties: this.cleanArangoProps(result.vertex),
|
|
810
|
+
elementId: result.vertex._id,
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
if (result.edge) {
|
|
814
|
+
relationships.push({
|
|
815
|
+
id: result.edge._key,
|
|
816
|
+
type: result.edge._id.split('/')[0],
|
|
817
|
+
startNodeId: result.edge._from,
|
|
818
|
+
endNodeId: result.edge._to,
|
|
819
|
+
properties: this.cleanArangoProps(result.edge),
|
|
820
|
+
elementId: result.edge._id,
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
return {
|
|
825
|
+
path: {
|
|
826
|
+
nodes,
|
|
827
|
+
relationships,
|
|
828
|
+
length: relationships.length,
|
|
829
|
+
},
|
|
830
|
+
length: relationships.length,
|
|
831
|
+
found: true,
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
catch (error) {
|
|
835
|
+
throw graph_error_1.GraphError.queryError(`Failed to find shortest path: ${error.message}`);
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
async allPaths(options, transaction) {
|
|
839
|
+
var _a;
|
|
840
|
+
this.ensureConnected();
|
|
841
|
+
try {
|
|
842
|
+
const startId = String(options.startNodeId).includes('/')
|
|
843
|
+
? options.startNodeId
|
|
844
|
+
: await this.resolveNodeId(options.startNodeId);
|
|
845
|
+
const endId = String(options.endNodeId).includes('/')
|
|
846
|
+
? options.endNodeId
|
|
847
|
+
: await this.resolveNodeId(options.endNodeId);
|
|
848
|
+
const maxDepth = options.maxDepth || 5;
|
|
849
|
+
const maxPaths = options.maxPaths || options.limit || 10;
|
|
850
|
+
const edgeCollections = ((_a = options.relationshipTypes) === null || _a === void 0 ? void 0 : _a.length)
|
|
851
|
+
? options.relationshipTypes.join(', ')
|
|
852
|
+
: this.edgeCollections.join(', ');
|
|
853
|
+
const aql = `
|
|
854
|
+
FOR p IN 1..@maxDepth OUTBOUND @start
|
|
855
|
+
${edgeCollections}
|
|
856
|
+
PRUNE p.vertices[-1]._id == @end
|
|
857
|
+
OPTIONS { bfs: false }
|
|
858
|
+
FILTER p.vertices[-1]._id == @end
|
|
859
|
+
LIMIT @maxPaths
|
|
860
|
+
RETURN p
|
|
861
|
+
`;
|
|
862
|
+
const cursor = await this.db.query(aql, {
|
|
863
|
+
start: startId,
|
|
864
|
+
end: endId,
|
|
865
|
+
maxDepth,
|
|
866
|
+
maxPaths,
|
|
867
|
+
});
|
|
868
|
+
const pathResults = await cursor.all();
|
|
869
|
+
const paths = pathResults.map((p) => {
|
|
870
|
+
const nodes = p.vertices.map((v) => ({
|
|
871
|
+
id: v._key,
|
|
872
|
+
labels: v._labels || [v._id.split('/')[0]],
|
|
873
|
+
properties: this.cleanArangoProps(v),
|
|
874
|
+
elementId: v._id,
|
|
875
|
+
}));
|
|
876
|
+
const relationships = p.edges.map((e) => ({
|
|
877
|
+
id: e._key,
|
|
878
|
+
type: e._id.split('/')[0],
|
|
879
|
+
startNodeId: e._from,
|
|
880
|
+
endNodeId: e._to,
|
|
881
|
+
properties: this.cleanArangoProps(e),
|
|
882
|
+
elementId: e._id,
|
|
883
|
+
}));
|
|
884
|
+
return { nodes, relationships, length: relationships.length };
|
|
885
|
+
});
|
|
886
|
+
return { paths, total: paths.length };
|
|
887
|
+
}
|
|
888
|
+
catch (error) {
|
|
889
|
+
throw graph_error_1.GraphError.queryError(`Failed to find all paths: ${error.message}`);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
async getNeighborhood(options, transaction) {
|
|
893
|
+
var _a;
|
|
894
|
+
this.ensureConnected();
|
|
895
|
+
try {
|
|
896
|
+
const nodeId = String(options.nodeId).includes('/')
|
|
897
|
+
? options.nodeId
|
|
898
|
+
: await this.resolveNodeId(options.nodeId);
|
|
899
|
+
const direction = this.mapDirection(options.direction);
|
|
900
|
+
const depth = options.depth || 1;
|
|
901
|
+
const edgeCollections = ((_a = options.relationshipTypes) === null || _a === void 0 ? void 0 : _a.length)
|
|
902
|
+
? options.relationshipTypes.join(', ')
|
|
903
|
+
: this.edgeCollections.join(', ');
|
|
904
|
+
let aql = `
|
|
905
|
+
FOR v, e IN 1..@depth ${direction} @start
|
|
906
|
+
${edgeCollections}
|
|
907
|
+
OPTIONS { uniqueVertices: 'global' }
|
|
908
|
+
`;
|
|
909
|
+
if (options.limit) {
|
|
910
|
+
aql += ` LIMIT @limit`;
|
|
911
|
+
}
|
|
912
|
+
aql += ` RETURN { vertex: v, edge: e }`;
|
|
913
|
+
const cursor = await this.db.query(aql, {
|
|
914
|
+
start: nodeId,
|
|
915
|
+
depth,
|
|
916
|
+
limit: options.limit,
|
|
917
|
+
});
|
|
918
|
+
const results = await cursor.all();
|
|
919
|
+
const nodesMap = new Map();
|
|
920
|
+
const relationshipsMap = new Map();
|
|
921
|
+
for (const result of results) {
|
|
922
|
+
if (result.vertex) {
|
|
923
|
+
nodesMap.set(result.vertex._id, {
|
|
924
|
+
id: result.vertex._key,
|
|
925
|
+
labels: result.vertex._labels || [result.vertex._id.split('/')[0]],
|
|
926
|
+
properties: this.cleanArangoProps(result.vertex),
|
|
927
|
+
elementId: result.vertex._id,
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
if (result.edge) {
|
|
931
|
+
relationshipsMap.set(result.edge._id, {
|
|
932
|
+
id: result.edge._key,
|
|
933
|
+
type: result.edge._id.split('/')[0],
|
|
934
|
+
startNodeId: result.edge._from,
|
|
935
|
+
endNodeId: result.edge._to,
|
|
936
|
+
properties: this.cleanArangoProps(result.edge),
|
|
937
|
+
elementId: result.edge._id,
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
return {
|
|
942
|
+
nodes: Array.from(nodesMap.values()),
|
|
943
|
+
relationships: Array.from(relationshipsMap.values()),
|
|
944
|
+
depth,
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
catch (error) {
|
|
948
|
+
throw graph_error_1.GraphError.queryError(`Failed to get neighborhood: ${error.message}`);
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
async findConnectedComponents(options, transaction) {
|
|
952
|
+
throw graph_error_1.GraphError.unsupportedOperationError('Connected components', 'ArangoDB (requires Pregel or SmartGraphs)');
|
|
953
|
+
}
|
|
954
|
+
// ==================== AGGREGATION ====================
|
|
955
|
+
async countNodes(labels, where, transaction) {
|
|
956
|
+
this.ensureConnected();
|
|
957
|
+
try {
|
|
958
|
+
const collectionName = (labels === null || labels === void 0 ? void 0 : labels[0]) || this.vertexCollections[0];
|
|
959
|
+
let aql = 'RETURN LENGTH(FOR doc IN @@collection';
|
|
960
|
+
const bindVars = { '@collection': collectionName };
|
|
961
|
+
if (where) {
|
|
962
|
+
const { filterStr, filterVars } = this.buildArangoWhereClause(where, 'doc');
|
|
963
|
+
if (filterStr) {
|
|
964
|
+
aql += ` FILTER ${filterStr}`;
|
|
965
|
+
Object.assign(bindVars, filterVars);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
aql += ' RETURN 1)';
|
|
969
|
+
const cursor = await this.db.query(aql, bindVars);
|
|
970
|
+
const [count] = await cursor.all();
|
|
971
|
+
return { count };
|
|
972
|
+
}
|
|
973
|
+
catch (error) {
|
|
974
|
+
throw graph_error_1.GraphError.queryError(`Failed to count nodes: ${error.message}`);
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
async countRelationships(types, where, transaction) {
|
|
978
|
+
this.ensureConnected();
|
|
979
|
+
try {
|
|
980
|
+
const collectionName = (types === null || types === void 0 ? void 0 : types[0]) || this.edgeCollections[0];
|
|
981
|
+
let aql = 'RETURN LENGTH(FOR edge IN @@collection';
|
|
982
|
+
const bindVars = { '@collection': collectionName };
|
|
983
|
+
if (where) {
|
|
984
|
+
const { filterStr, filterVars } = this.buildArangoWhereClause(where, 'edge');
|
|
985
|
+
if (filterStr) {
|
|
986
|
+
aql += ` FILTER ${filterStr}`;
|
|
987
|
+
Object.assign(bindVars, filterVars);
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
aql += ' RETURN 1)';
|
|
991
|
+
const cursor = await this.db.query(aql, bindVars);
|
|
992
|
+
const [count] = await cursor.all();
|
|
993
|
+
return { count };
|
|
994
|
+
}
|
|
995
|
+
catch (error) {
|
|
996
|
+
throw graph_error_1.GraphError.queryError(`Failed to count relationships: ${error.message}`);
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
async getStatistics(transaction) {
|
|
1000
|
+
this.ensureConnected();
|
|
1001
|
+
try {
|
|
1002
|
+
let nodeCount = 0;
|
|
1003
|
+
let relationshipCount = 0;
|
|
1004
|
+
const nodesByLabel = {};
|
|
1005
|
+
const relationshipsByType = {};
|
|
1006
|
+
for (const collName of this.vertexCollections) {
|
|
1007
|
+
const cursor = await this.db.query('RETURN LENGTH(FOR doc IN @@collection RETURN 1)', { '@collection': collName });
|
|
1008
|
+
const [count] = await cursor.all();
|
|
1009
|
+
nodesByLabel[collName] = count;
|
|
1010
|
+
nodeCount += count;
|
|
1011
|
+
}
|
|
1012
|
+
for (const collName of this.edgeCollections) {
|
|
1013
|
+
const cursor = await this.db.query('RETURN LENGTH(FOR edge IN @@collection RETURN 1)', { '@collection': collName });
|
|
1014
|
+
const [count] = await cursor.all();
|
|
1015
|
+
relationshipsByType[collName] = count;
|
|
1016
|
+
relationshipCount += count;
|
|
1017
|
+
}
|
|
1018
|
+
return {
|
|
1019
|
+
nodeCount,
|
|
1020
|
+
relationshipCount,
|
|
1021
|
+
nodesByLabel,
|
|
1022
|
+
relationshipsByType,
|
|
1023
|
+
};
|
|
1024
|
+
}
|
|
1025
|
+
catch (error) {
|
|
1026
|
+
throw graph_error_1.GraphError.queryError(`Failed to get statistics: ${error.message}`);
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
// ==================== SEARCH ====================
|
|
1030
|
+
async fullTextSearch(options, transaction) {
|
|
1031
|
+
this.ensureConnected();
|
|
1032
|
+
try {
|
|
1033
|
+
const aql = `
|
|
1034
|
+
FOR doc IN ${options.indexName}
|
|
1035
|
+
SEARCH ANALYZER(doc.content IN TOKENS(@query, 'text_en'), 'text_en')
|
|
1036
|
+
SORT BM25(doc) DESC
|
|
1037
|
+
LIMIT @limit
|
|
1038
|
+
RETURN doc
|
|
1039
|
+
`;
|
|
1040
|
+
const cursor = await this.db.query(aql, {
|
|
1041
|
+
query: options.query,
|
|
1042
|
+
limit: options.limit || 10,
|
|
1043
|
+
});
|
|
1044
|
+
const results = await cursor.all();
|
|
1045
|
+
return {
|
|
1046
|
+
nodes: results.map((doc) => ({
|
|
1047
|
+
id: doc._key,
|
|
1048
|
+
labels: doc._labels || [doc._id.split('/')[0]],
|
|
1049
|
+
properties: this.cleanArangoProps(doc),
|
|
1050
|
+
elementId: doc._id,
|
|
1051
|
+
})),
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
catch (error) {
|
|
1055
|
+
throw graph_error_1.GraphError.queryError(`Failed to perform full-text search: ${error.message}`);
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
async vectorSearch(options, transaction) {
|
|
1059
|
+
throw graph_error_1.GraphError.unsupportedOperationError('Vector search', 'ArangoDB');
|
|
1060
|
+
}
|
|
1061
|
+
// ==================== RAW QUERY ====================
|
|
1062
|
+
async query(options, transaction) {
|
|
1063
|
+
this.ensureConnected();
|
|
1064
|
+
try {
|
|
1065
|
+
const cursor = await this.db.query(options.query, options.params || {});
|
|
1066
|
+
const records = await cursor.all();
|
|
1067
|
+
return {
|
|
1068
|
+
records: records,
|
|
1069
|
+
summary: {
|
|
1070
|
+
database: this.db.name,
|
|
1071
|
+
},
|
|
1072
|
+
};
|
|
1073
|
+
}
|
|
1074
|
+
catch (error) {
|
|
1075
|
+
throw graph_error_1.GraphError.queryError(`Failed to execute query: ${error.message}`);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
// ==================== SCHEMA ====================
|
|
1079
|
+
async createNodeIndex(options) {
|
|
1080
|
+
var _a, _b;
|
|
1081
|
+
this.ensureConnected();
|
|
1082
|
+
try {
|
|
1083
|
+
const collection = this.db.collection(options.label);
|
|
1084
|
+
const indexOptions = {
|
|
1085
|
+
type: this.mapIndexType(options.type),
|
|
1086
|
+
fields: options.properties,
|
|
1087
|
+
name: options.name,
|
|
1088
|
+
};
|
|
1089
|
+
if (((_a = options.options) === null || _a === void 0 ? void 0 : _a.sparse) !== undefined) {
|
|
1090
|
+
indexOptions.sparse = options.options.sparse;
|
|
1091
|
+
}
|
|
1092
|
+
if (((_b = options.options) === null || _b === void 0 ? void 0 : _b.unique) !== undefined) {
|
|
1093
|
+
indexOptions.unique = options.options.unique;
|
|
1094
|
+
}
|
|
1095
|
+
const result = await collection.ensureIndex(indexOptions);
|
|
1096
|
+
return {
|
|
1097
|
+
created: result.isNewlyCreated,
|
|
1098
|
+
name: result.name,
|
|
1099
|
+
};
|
|
1100
|
+
}
|
|
1101
|
+
catch (error) {
|
|
1102
|
+
throw graph_error_1.GraphError.queryError(`Failed to create index: ${error.message}`);
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
async createNodeConstraint(options) {
|
|
1106
|
+
this.ensureConnected();
|
|
1107
|
+
try {
|
|
1108
|
+
const collection = this.db.collection(options.label);
|
|
1109
|
+
const fields = options.properties || (options.property ? [options.property] : []);
|
|
1110
|
+
const result = await collection.ensureIndex({
|
|
1111
|
+
type: 'persistent',
|
|
1112
|
+
fields,
|
|
1113
|
+
name: options.name,
|
|
1114
|
+
unique: true,
|
|
1115
|
+
});
|
|
1116
|
+
return {
|
|
1117
|
+
created: result.isNewlyCreated,
|
|
1118
|
+
name: result.name,
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
catch (error) {
|
|
1122
|
+
throw graph_error_1.GraphError.queryError(`Failed to create constraint: ${error.message}`);
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
async createRelationshipIndex(options) {
|
|
1126
|
+
return this.createNodeIndex({
|
|
1127
|
+
label: options.type,
|
|
1128
|
+
properties: options.properties,
|
|
1129
|
+
name: options.name,
|
|
1130
|
+
type: options.type,
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
async listIndexes() {
|
|
1134
|
+
this.ensureConnected();
|
|
1135
|
+
try {
|
|
1136
|
+
const indexes = [];
|
|
1137
|
+
for (const collName of [...this.vertexCollections, ...this.edgeCollections]) {
|
|
1138
|
+
const collection = this.db.collection(collName);
|
|
1139
|
+
const collIndexes = await collection.indexes();
|
|
1140
|
+
for (const idx of collIndexes) {
|
|
1141
|
+
indexes.push({
|
|
1142
|
+
name: idx.name,
|
|
1143
|
+
labelOrType: collName,
|
|
1144
|
+
properties: idx.fields || [],
|
|
1145
|
+
type: idx.type,
|
|
1146
|
+
unique: idx.unique || false,
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
return { indexes };
|
|
1151
|
+
}
|
|
1152
|
+
catch (error) {
|
|
1153
|
+
throw graph_error_1.GraphError.queryError(`Failed to list indexes: ${error.message}`);
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
async listConstraints() {
|
|
1157
|
+
this.ensureConnected();
|
|
1158
|
+
try {
|
|
1159
|
+
const constraints = [];
|
|
1160
|
+
for (const collName of this.vertexCollections) {
|
|
1161
|
+
const collection = this.db.collection(collName);
|
|
1162
|
+
const indexes = await collection.indexes();
|
|
1163
|
+
for (const idx of indexes) {
|
|
1164
|
+
if (idx.unique) {
|
|
1165
|
+
constraints.push({
|
|
1166
|
+
name: idx.name,
|
|
1167
|
+
label: collName,
|
|
1168
|
+
property: (idx.fields || [])[0] || '',
|
|
1169
|
+
type: 'UNIQUE',
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
return { constraints };
|
|
1175
|
+
}
|
|
1176
|
+
catch (error) {
|
|
1177
|
+
throw graph_error_1.GraphError.queryError(`Failed to list constraints: ${error.message}`);
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
async dropIndex(name) {
|
|
1181
|
+
this.ensureConnected();
|
|
1182
|
+
try {
|
|
1183
|
+
for (const collName of [...this.vertexCollections, ...this.edgeCollections]) {
|
|
1184
|
+
const collection = this.db.collection(collName);
|
|
1185
|
+
try {
|
|
1186
|
+
await collection.dropIndex(name);
|
|
1187
|
+
return { dropped: true };
|
|
1188
|
+
}
|
|
1189
|
+
catch (_a) {
|
|
1190
|
+
continue;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
return { dropped: false };
|
|
1194
|
+
}
|
|
1195
|
+
catch (error) {
|
|
1196
|
+
throw graph_error_1.GraphError.queryError(`Failed to drop index: ${error.message}`);
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
async dropConstraint(name) {
|
|
1200
|
+
const result = await this.dropIndex(name);
|
|
1201
|
+
return { dropped: result.dropped };
|
|
1202
|
+
}
|
|
1203
|
+
// ==================== SCHEMA INTROSPECTION ====================
|
|
1204
|
+
async listLabels() {
|
|
1205
|
+
this.ensureConnected();
|
|
1206
|
+
const labels = [];
|
|
1207
|
+
// In ArangoDB, vertex collections act as "labels"
|
|
1208
|
+
for (const collectionName of this.vertexCollections) {
|
|
1209
|
+
try {
|
|
1210
|
+
const collection = this.db.collection(collectionName);
|
|
1211
|
+
// Get count
|
|
1212
|
+
const countResult = await collection.count();
|
|
1213
|
+
const count = countResult.count || 0;
|
|
1214
|
+
// Get properties from a sample of documents
|
|
1215
|
+
const cursor = await this.db.query(`
|
|
1216
|
+
FOR doc IN \`${collectionName}\`
|
|
1217
|
+
LIMIT 100
|
|
1218
|
+
RETURN ATTRIBUTES(doc, true)
|
|
1219
|
+
`);
|
|
1220
|
+
const attributeArrays = await cursor.all();
|
|
1221
|
+
// Flatten and dedupe property names
|
|
1222
|
+
const propertyNames = new Set();
|
|
1223
|
+
for (const attrs of attributeArrays) {
|
|
1224
|
+
for (const attr of attrs) {
|
|
1225
|
+
if (attr !== '_key' && attr !== '_id' && attr !== '_rev') {
|
|
1226
|
+
propertyNames.add(attr);
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
const properties = Array.from(propertyNames).map(name => ({
|
|
1231
|
+
name,
|
|
1232
|
+
type: 'unknown',
|
|
1233
|
+
}));
|
|
1234
|
+
labels.push({
|
|
1235
|
+
name: collectionName,
|
|
1236
|
+
count,
|
|
1237
|
+
properties,
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
catch (error) {
|
|
1241
|
+
// Skip collections that don't exist or have errors
|
|
1242
|
+
continue;
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
return { labels };
|
|
1246
|
+
}
|
|
1247
|
+
async listRelationshipTypes() {
|
|
1248
|
+
this.ensureConnected();
|
|
1249
|
+
const types = [];
|
|
1250
|
+
// In ArangoDB, edge collections act as "relationship types"
|
|
1251
|
+
for (const collectionName of this.edgeCollections) {
|
|
1252
|
+
try {
|
|
1253
|
+
const collection = this.db.collection(collectionName);
|
|
1254
|
+
// Get count
|
|
1255
|
+
const countResult = await collection.count();
|
|
1256
|
+
const count = countResult.count || 0;
|
|
1257
|
+
// Get source and target collection information
|
|
1258
|
+
const endpointsCursor = await this.db.query(`
|
|
1259
|
+
FOR edge IN \`${collectionName}\`
|
|
1260
|
+
LIMIT 100
|
|
1261
|
+
RETURN {
|
|
1262
|
+
fromCollection: PARSE_IDENTIFIER(edge._from).collection,
|
|
1263
|
+
toCollection: PARSE_IDENTIFIER(edge._to).collection
|
|
1264
|
+
}
|
|
1265
|
+
`);
|
|
1266
|
+
const endpoints = await endpointsCursor.all();
|
|
1267
|
+
const fromLabelsSet = new Set();
|
|
1268
|
+
const toLabelsSet = new Set();
|
|
1269
|
+
for (const ep of endpoints) {
|
|
1270
|
+
if (ep.fromCollection)
|
|
1271
|
+
fromLabelsSet.add(ep.fromCollection);
|
|
1272
|
+
if (ep.toCollection)
|
|
1273
|
+
toLabelsSet.add(ep.toCollection);
|
|
1274
|
+
}
|
|
1275
|
+
// Get properties from a sample of edges
|
|
1276
|
+
const propsCursor = await this.db.query(`
|
|
1277
|
+
FOR edge IN \`${collectionName}\`
|
|
1278
|
+
LIMIT 100
|
|
1279
|
+
RETURN ATTRIBUTES(edge, true)
|
|
1280
|
+
`);
|
|
1281
|
+
const attributeArrays = await propsCursor.all();
|
|
1282
|
+
const propertyNames = new Set();
|
|
1283
|
+
for (const attrs of attributeArrays) {
|
|
1284
|
+
for (const attr of attrs) {
|
|
1285
|
+
if (!['_key', '_id', '_rev', '_from', '_to'].includes(attr)) {
|
|
1286
|
+
propertyNames.add(attr);
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
const properties = Array.from(propertyNames).map(name => ({
|
|
1291
|
+
name,
|
|
1292
|
+
type: 'unknown',
|
|
1293
|
+
}));
|
|
1294
|
+
types.push({
|
|
1295
|
+
type: collectionName,
|
|
1296
|
+
count,
|
|
1297
|
+
fromLabels: Array.from(fromLabelsSet),
|
|
1298
|
+
toLabels: Array.from(toLabelsSet),
|
|
1299
|
+
properties: properties.length > 0 ? properties : undefined,
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
catch (error) {
|
|
1303
|
+
// Skip collections that don't exist or have errors
|
|
1304
|
+
continue;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
return { types };
|
|
1308
|
+
}
|
|
1309
|
+
// ==================== TRANSACTIONS ====================
|
|
1310
|
+
async beginTransaction() {
|
|
1311
|
+
this.ensureConnected();
|
|
1312
|
+
try {
|
|
1313
|
+
const trx = await this.db.beginTransaction({
|
|
1314
|
+
write: [...this.vertexCollections, ...this.edgeCollections],
|
|
1315
|
+
read: [...this.vertexCollections, ...this.edgeCollections],
|
|
1316
|
+
});
|
|
1317
|
+
return {
|
|
1318
|
+
id: trx.id,
|
|
1319
|
+
status: enums_1.GraphTransactionStatus.ACTIVE,
|
|
1320
|
+
startTime: new Date(),
|
|
1321
|
+
nativeTransaction: trx,
|
|
1322
|
+
};
|
|
1323
|
+
}
|
|
1324
|
+
catch (error) {
|
|
1325
|
+
throw graph_error_1.GraphError.transactionError(`Failed to begin transaction: ${error.message}`);
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
async commitTransaction(transaction) {
|
|
1329
|
+
try {
|
|
1330
|
+
await transaction.nativeTransaction.commit();
|
|
1331
|
+
transaction.status = enums_1.GraphTransactionStatus.COMMITTED;
|
|
1332
|
+
}
|
|
1333
|
+
catch (error) {
|
|
1334
|
+
throw graph_error_1.GraphError.transactionError(`Failed to commit transaction: ${error.message}`);
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
async rollbackTransaction(transaction) {
|
|
1338
|
+
try {
|
|
1339
|
+
await transaction.nativeTransaction.abort();
|
|
1340
|
+
transaction.status = enums_1.GraphTransactionStatus.ROLLED_BACK;
|
|
1341
|
+
}
|
|
1342
|
+
catch (error) {
|
|
1343
|
+
throw graph_error_1.GraphError.transactionError(`Failed to rollback transaction: ${error.message}`);
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
// ==================== HELPERS ====================
|
|
1347
|
+
mapDirection(direction) {
|
|
1348
|
+
switch (direction) {
|
|
1349
|
+
case enums_1.TraversalDirection.OUTGOING:
|
|
1350
|
+
case 'OUTGOING':
|
|
1351
|
+
return 'OUTBOUND';
|
|
1352
|
+
case enums_1.TraversalDirection.INCOMING:
|
|
1353
|
+
case 'INCOMING':
|
|
1354
|
+
return 'INBOUND';
|
|
1355
|
+
case enums_1.TraversalDirection.BOTH:
|
|
1356
|
+
case 'BOTH':
|
|
1357
|
+
default:
|
|
1358
|
+
return 'ANY';
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
mapIndexType(type) {
|
|
1362
|
+
switch (type) {
|
|
1363
|
+
case 'fulltext':
|
|
1364
|
+
return 'fulltext';
|
|
1365
|
+
case 'geo':
|
|
1366
|
+
case 'point':
|
|
1367
|
+
return 'geo';
|
|
1368
|
+
case 'ttl':
|
|
1369
|
+
return 'ttl';
|
|
1370
|
+
default:
|
|
1371
|
+
return 'persistent';
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
buildWhereClause(where) {
|
|
1375
|
+
return this.buildArangoWhereClause(where, 'doc');
|
|
1376
|
+
}
|
|
1377
|
+
parseError(error) {
|
|
1378
|
+
if (error instanceof graph_error_1.GraphError) {
|
|
1379
|
+
return error;
|
|
1380
|
+
}
|
|
1381
|
+
return graph_error_1.GraphError.queryError(String(error));
|
|
1382
|
+
}
|
|
1383
|
+
buildArangoWhereClause(where, varName) {
|
|
1384
|
+
const conditions = [];
|
|
1385
|
+
const filterVars = {};
|
|
1386
|
+
let varCounter = 0;
|
|
1387
|
+
for (const [key, value] of Object.entries(where)) {
|
|
1388
|
+
// Normalize key to lowercase for comparison
|
|
1389
|
+
const normalizedKey = key.toLowerCase();
|
|
1390
|
+
if (normalizedKey === '$and') {
|
|
1391
|
+
if (Array.isArray(value)) {
|
|
1392
|
+
const subConditions = [];
|
|
1393
|
+
for (const item of value) {
|
|
1394
|
+
const { filterStr, filterVars: andVars } = this.buildArangoWhereClause(item, varName);
|
|
1395
|
+
if (filterStr) {
|
|
1396
|
+
subConditions.push(filterStr);
|
|
1397
|
+
Object.assign(filterVars, andVars);
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
if (subConditions.length > 0) {
|
|
1401
|
+
conditions.push(`(${subConditions.join(' AND ')})`);
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
else {
|
|
1405
|
+
const { filterStr, filterVars: andVars } = this.buildArangoWhereClause(value, varName);
|
|
1406
|
+
if (filterStr) {
|
|
1407
|
+
conditions.push(`(${filterStr})`);
|
|
1408
|
+
Object.assign(filterVars, andVars);
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
else if (normalizedKey === '$or') {
|
|
1413
|
+
if (Array.isArray(value)) {
|
|
1414
|
+
const subConditions = [];
|
|
1415
|
+
for (const item of value) {
|
|
1416
|
+
const { filterStr, filterVars: orVars } = this.buildArangoWhereClause(item, varName);
|
|
1417
|
+
if (filterStr) {
|
|
1418
|
+
subConditions.push(filterStr);
|
|
1419
|
+
Object.assign(filterVars, orVars);
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
if (subConditions.length > 0) {
|
|
1423
|
+
conditions.push(`(${subConditions.join(' OR ')})`);
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
else {
|
|
1427
|
+
const { filterStr, filterVars: orVars } = this.buildArangoWhereClause(value, varName);
|
|
1428
|
+
if (filterStr) {
|
|
1429
|
+
conditions.push(`(${filterStr.replace(/ AND /g, ' OR ')})`);
|
|
1430
|
+
Object.assign(filterVars, orVars);
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
}
|
|
1434
|
+
else if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
1435
|
+
for (const [op, opValue] of Object.entries(value)) {
|
|
1436
|
+
const normalizedOp = op.toLowerCase();
|
|
1437
|
+
const varKey = `v${varCounter++}`;
|
|
1438
|
+
filterVars[varKey] = opValue;
|
|
1439
|
+
switch (normalizedOp) {
|
|
1440
|
+
case '$gt':
|
|
1441
|
+
conditions.push(`${varName}.${key} > @${varKey}`);
|
|
1442
|
+
break;
|
|
1443
|
+
case '$gte':
|
|
1444
|
+
conditions.push(`${varName}.${key} >= @${varKey}`);
|
|
1445
|
+
break;
|
|
1446
|
+
case '$lt':
|
|
1447
|
+
conditions.push(`${varName}.${key} < @${varKey}`);
|
|
1448
|
+
break;
|
|
1449
|
+
case '$lte':
|
|
1450
|
+
conditions.push(`${varName}.${key} <= @${varKey}`);
|
|
1451
|
+
break;
|
|
1452
|
+
case '$ne':
|
|
1453
|
+
conditions.push(`${varName}.${key} != @${varKey}`);
|
|
1454
|
+
break;
|
|
1455
|
+
case '$in':
|
|
1456
|
+
conditions.push(`${varName}.${key} IN @${varKey}`);
|
|
1457
|
+
break;
|
|
1458
|
+
case '$nin':
|
|
1459
|
+
case '$not_in':
|
|
1460
|
+
conditions.push(`${varName}.${key} NOT IN @${varKey}`);
|
|
1461
|
+
break;
|
|
1462
|
+
case '$contains':
|
|
1463
|
+
conditions.push(`CONTAINS(${varName}.${key}, @${varKey})`);
|
|
1464
|
+
break;
|
|
1465
|
+
case '$startswith':
|
|
1466
|
+
case '$starts_with':
|
|
1467
|
+
conditions.push(`STARTS_WITH(${varName}.${key}, @${varKey})`);
|
|
1468
|
+
break;
|
|
1469
|
+
case '$endswith':
|
|
1470
|
+
case '$ends_with':
|
|
1471
|
+
conditions.push(`LIKE(${varName}.${key}, CONCAT('%', @${varKey}))`);
|
|
1472
|
+
break;
|
|
1473
|
+
case '$exists':
|
|
1474
|
+
if (opValue) {
|
|
1475
|
+
conditions.push(`${varName}.${key} != null`);
|
|
1476
|
+
}
|
|
1477
|
+
else {
|
|
1478
|
+
conditions.push(`${varName}.${key} == null`);
|
|
1479
|
+
}
|
|
1480
|
+
break;
|
|
1481
|
+
case '$regex':
|
|
1482
|
+
conditions.push(`REGEX_TEST(${varName}.${key}, @${varKey})`);
|
|
1483
|
+
break;
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
else {
|
|
1488
|
+
const varKey = `v${varCounter++}`;
|
|
1489
|
+
filterVars[varKey] = value;
|
|
1490
|
+
conditions.push(`${varName}.${key} == @${varKey}`);
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
return {
|
|
1494
|
+
filterStr: conditions.join(' AND '),
|
|
1495
|
+
filterVars,
|
|
1496
|
+
};
|
|
1497
|
+
}
|
|
1498
|
+
cleanArangoProps(doc) {
|
|
1499
|
+
const result = {};
|
|
1500
|
+
for (const [key, value] of Object.entries(doc)) {
|
|
1501
|
+
if (!key.startsWith('_')) {
|
|
1502
|
+
result[key] = value;
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
return result;
|
|
1506
|
+
}
|
|
1507
|
+
async resolveNodeId(id) {
|
|
1508
|
+
for (const collName of this.vertexCollections) {
|
|
1509
|
+
try {
|
|
1510
|
+
const collection = this.db.collection(collName);
|
|
1511
|
+
await collection.document(id);
|
|
1512
|
+
return `${collName}/${id}`;
|
|
1513
|
+
}
|
|
1514
|
+
catch (_a) {
|
|
1515
|
+
continue;
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
throw graph_error_1.GraphError.notFoundError(`Node with ID ${id} not found`);
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
exports.ArangoDBAdapter = ArangoDBAdapter;
|
|
1522
|
+
//# sourceMappingURL=arangodb.adapter.js.map
|