@ductape/sdk 0.0.4-v12 → 0.0.4-v120
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 +1254 -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/logsApi.service.d.ts +51 -0
- package/dist/api/services/logsApi.service.js +14 -0
- package/dist/api/services/logsApi.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 +745 -0
- package/dist/api/services/processorApi.service.js +536 -2
- package/dist/api/services/processorApi.service.js.map +1 -1
- package/dist/api/services/productsApi.service.d.ts +103 -0
- package/dist/api/services/productsApi.service.js +133 -7
- 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 +113 -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 +80 -0
- package/dist/api/urls.js +106 -17
- 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 +42 -33
- package/dist/apps/services/app.service.js +574 -223
- 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 +22 -2
- package/dist/apps/validators/joi-validators/create.appAction.validator.js.map +1 -1
- package/dist/apps/validators/joi-validators/update.app.validator.js +2 -0
- package/dist/apps/validators/joi-validators/update.app.validator.js.map +1 -1
- package/dist/apps/validators/joi-validators/update.appAction.validator.js +23 -2
- package/dist/apps/validators/joi-validators/update.appAction.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 +418 -0
- package/dist/brokers/brokers.service.js +1156 -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 +565 -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/{processor/services/messagebrokers → brokers/utils/providers}/aws-sqs.service.d.ts +3 -2
- 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/{processor/services/messagebrokers → brokers/utils/providers}/google-pubsub.service.d.ts +2 -2
- package/dist/{processor/services/messagebrokers → brokers/utils/providers}/google-pubsub.service.js +16 -7
- 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/{processor/services/messagebrokers → brokers/utils/providers}/rabbitmq.service.d.ts +4 -3
- package/dist/brokers/utils/providers/rabbitmq.service.js +118 -0
- package/dist/brokers/utils/providers/rabbitmq.service.js.map +1 -0
- package/dist/{processor/services/messagebrokers → brokers/utils/providers}/redis.service.d.ts +3 -3
- package/dist/{processor/services/messagebrokers → brokers/utils/providers}/redis.service.js +25 -14
- package/dist/brokers/utils/providers/redis.service.js.map +1 -0
- package/dist/cache/cache.manager.d.ts +308 -0
- package/dist/cache/cache.manager.js +900 -0
- package/dist/cache/cache.manager.js.map +1 -0
- package/dist/cache/cache.service.d.ts +191 -0
- package/dist/cache/cache.service.js +594 -0
- package/dist/cache/cache.service.js.map +1 -0
- package/dist/cache/index.d.ts +52 -0
- package/dist/cache/index.js +81 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/types/index.d.ts +110 -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 +423 -0
- package/dist/database/adapters/base.adapter.js +260 -0
- package/dist/database/adapters/base.adapter.js.map +1 -0
- package/dist/database/adapters/cassandra.adapter.d.ts +92 -0
- package/dist/database/adapters/cassandra.adapter.js +1091 -0
- package/dist/database/adapters/cassandra.adapter.js.map +1 -0
- package/dist/database/adapters/dynamodb.adapter.d.ts +110 -0
- package/dist/database/adapters/dynamodb.adapter.js +1564 -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 +121 -0
- package/dist/database/adapters/mongodb.adapter.js +1284 -0
- package/dist/database/adapters/mongodb.adapter.js.map +1 -0
- package/dist/database/adapters/mysql.adapter.d.ts +86 -0
- package/dist/database/adapters/mysql.adapter.js +1371 -0
- package/dist/database/adapters/mysql.adapter.js.map +1 -0
- package/dist/database/adapters/postgresql.adapter.d.ts +90 -0
- package/dist/database/adapters/postgresql.adapter.js +1487 -0
- package/dist/database/adapters/postgresql.adapter.js.map +1 -0
- package/dist/database/databases.service.d.ts +1476 -0
- package/dist/database/databases.service.js +3068 -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 +136 -0
- package/dist/database/migrations/migration-engine.js +1421 -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 +69 -0
- package/dist/database/operators/query-builder.js +447 -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 +638 -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/dashboard.interface.d.ts +74 -0
- package/dist/database/types/dashboard.interface.js +7 -0
- package/dist/database/types/dashboard.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 +15 -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 +412 -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 +1588 -0
- package/dist/graph/adapters/arangodb.adapter.js.map +1 -0
- package/dist/graph/adapters/base.adapter.d.ts +264 -0
- package/dist/graph/adapters/base.adapter.js +156 -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 +1452 -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 +1317 -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 +1369 -0
- package/dist/graph/adapters/neptune.adapter.js.map +1 -0
- package/dist/graph/graphs.service.d.ts +606 -0
- package/dist/graph/graphs.service.js +2434 -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 +3366 -743
- package/dist/index.js +4885 -1107
- package/dist/index.js.map +1 -1
- package/dist/init.interface.d.ts +407 -0
- package/dist/{processor/services/messagebrokers/messagebrokers.type.js → init.interface.js} +1 -1
- package/dist/init.interface.js.map +1 -0
- package/dist/inputs/inputs.service.d.ts +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.service.js +6 -2
- package/dist/logs/logs.service.js.map +1 -1
- package/dist/logs/logs.types.d.ts +24 -1
- package/dist/logs/logs.types.js +9 -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 +268 -0
- package/dist/notifications/notifications.service.js +905 -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 +404 -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 +101 -72
- package/dist/processor/services/processor.service.js +1573 -1343
- 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.js +32 -20
- 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 +358 -79
- package/dist/products/services/products.service.js +2918 -434
- 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 +6 -1
- package/dist/products/validators/index.js +14 -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.productApp.validator.js +2 -2
- package/dist/products/validators/joi-validators/create.productApp.validator.js.map +1 -1
- 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.productMessageBrokerTopic.validator.js +1 -0
- package/dist/products/validators/joi-validators/create.productMessageBrokerTopic.validator.js.map +1 -1
- 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 +150 -51
- 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 +136 -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 +236 -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 +246 -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 +96 -0
- package/dist/sessions/index.js.map +1 -0
- package/dist/sessions/sessions.helper.d.ts +88 -0
- package/dist/sessions/sessions.helper.js +133 -0
- package/dist/sessions/sessions.helper.js.map +1 -0
- package/dist/sessions/sessions.resolver.d.ts +188 -0
- package/dist/sessions/sessions.resolver.js +603 -0
- package/dist/sessions/sessions.resolver.js.map +1 -0
- package/dist/sessions/sessions.service.d.ts +194 -0
- package/dist/sessions/sessions.service.js +987 -0
- package/dist/sessions/sessions.service.js.map +1 -0
- package/dist/sessions/types/index.d.ts +342 -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 +99 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/storage.service.d.ts +177 -0
- package/dist/storage/storage.service.js +897 -0
- package/dist/storage/storage.service.js.map +1 -0
- package/dist/storage/types/index.d.ts +267 -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 +62 -0
- package/dist/storage/utils/storage.util.js +593 -0
- package/dist/storage/utils/storage.util.js.map +1 -0
- package/dist/types/appBuilder.types.d.ts +12 -3
- package/dist/types/enums.d.ts +10 -1
- package/dist/types/enums.js +9 -0
- package/dist/types/enums.js.map +1 -1
- package/dist/types/index.types.d.ts +4 -7
- package/dist/types/index.types.js +0 -1
- package/dist/types/index.types.js.map +1 -1
- package/dist/types/inputs.types.js +1 -1
- package/dist/types/inputs.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 +265 -38
- package/dist/types/processor.types.js +9 -1
- package/dist/types/processor.types.js.map +1 -1
- package/dist/types/productsBuilder.types.d.ts +954 -29
- package/dist/types/productsBuilder.types.js +210 -3
- 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/actions/action-manager.d.ts +140 -0
- package/dist/vector/actions/action-manager.js +356 -0
- package/dist/vector/actions/action-manager.js.map +1 -0
- package/dist/vector/adapters/base.adapter.d.ts +169 -0
- package/dist/vector/adapters/base.adapter.js +218 -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 +433 -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 +442 -0
- package/dist/vector/adapters/qdrant.adapter.js.map +1 -0
- package/dist/vector/adapters/weaviate.adapter.d.ts +68 -0
- package/dist/vector/adapters/weaviate.adapter.js +661 -0
- package/dist/vector/adapters/weaviate.adapter.js.map +1 -0
- package/dist/vector/index.d.ts +36 -0
- package/dist/vector/index.js +70 -0
- package/dist/vector/index.js.map +1 -0
- package/dist/vector/types/action.interface.d.ts +195 -0
- package/dist/vector/types/action.interface.js +100 -0
- package/dist/vector/types/action.interface.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 +11 -0
- package/dist/vector/types/index.js +23 -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 +476 -0
- package/dist/vector/vector-database.service.js +892 -0
- package/dist/vector/vector-database.service.js.map +1 -0
- package/dist/vector/vector.service.d.ts +283 -0
- package/dist/vector/vector.service.js +544 -0
- package/dist/vector/vector.service.js.map +1 -0
- package/dist/warehouse/executor/index.d.ts +5 -0
- package/dist/warehouse/executor/index.js +12 -0
- package/dist/warehouse/executor/index.js.map +1 -0
- package/dist/warehouse/executor/joins/index.d.ts +5 -0
- package/dist/warehouse/executor/joins/index.js +11 -0
- package/dist/warehouse/executor/joins/index.js.map +1 -0
- package/dist/warehouse/executor/joins/join-executor.d.ts +101 -0
- package/dist/warehouse/executor/joins/join-executor.js +493 -0
- package/dist/warehouse/executor/joins/join-executor.js.map +1 -0
- package/dist/warehouse/executor/joins/semantic-join.d.ts +64 -0
- package/dist/warehouse/executor/joins/semantic-join.js +241 -0
- package/dist/warehouse/executor/joins/semantic-join.js.map +1 -0
- package/dist/warehouse/executor/single-source-executor.d.ts +155 -0
- package/dist/warehouse/executor/single-source-executor.js +573 -0
- package/dist/warehouse/executor/single-source-executor.js.map +1 -0
- package/dist/warehouse/index.d.ts +79 -0
- package/dist/warehouse/index.js +111 -0
- package/dist/warehouse/index.js.map +1 -0
- package/dist/warehouse/parser/index.d.ts +4 -0
- package/dist/warehouse/parser/index.js +10 -0
- package/dist/warehouse/parser/index.js.map +1 -0
- package/dist/warehouse/parser/query-parser.d.ts +181 -0
- package/dist/warehouse/parser/query-parser.js +415 -0
- package/dist/warehouse/parser/query-parser.js.map +1 -0
- package/dist/warehouse/registry/data-source-registry.d.ts +207 -0
- package/dist/warehouse/registry/data-source-registry.js +396 -0
- package/dist/warehouse/registry/data-source-registry.js.map +1 -0
- package/dist/warehouse/registry/index.d.ts +4 -0
- package/dist/warehouse/registry/index.js +9 -0
- package/dist/warehouse/registry/index.js.map +1 -0
- package/dist/warehouse/transactions/index.d.ts +4 -0
- package/dist/warehouse/transactions/index.js +9 -0
- package/dist/warehouse/transactions/index.js.map +1 -0
- package/dist/warehouse/transactions/saga-orchestrator.d.ts +92 -0
- package/dist/warehouse/transactions/saga-orchestrator.js +383 -0
- package/dist/warehouse/transactions/saga-orchestrator.js.map +1 -0
- package/dist/warehouse/types/index.d.ts +9 -0
- package/dist/warehouse/types/index.js +33 -0
- package/dist/warehouse/types/index.js.map +1 -0
- package/dist/warehouse/types/join.interface.d.ts +225 -0
- package/dist/warehouse/types/join.interface.js +87 -0
- package/dist/warehouse/types/join.interface.js.map +1 -0
- package/dist/warehouse/types/query.interface.d.ts +232 -0
- package/dist/warehouse/types/query.interface.js +9 -0
- package/dist/warehouse/types/query.interface.js.map +1 -0
- package/dist/warehouse/types/transaction.interface.d.ts +236 -0
- package/dist/warehouse/types/transaction.interface.js +74 -0
- package/dist/warehouse/types/transaction.interface.js.map +1 -0
- package/dist/warehouse/types/where.interface.d.ts +208 -0
- package/dist/warehouse/types/where.interface.js +89 -0
- package/dist/warehouse/types/where.interface.js.map +1 -0
- package/dist/warehouse/warehouse.service.d.ts +200 -0
- package/dist/warehouse/warehouse.service.js +470 -0
- package/dist/warehouse/warehouse.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 +1037 -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 +412 -0
- package/dist/workflows/workflows.service.js +1746 -0
- package/dist/workflows/workflows.service.js.map +1 -0
- package/package.json +75 -13
- 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.d.ts +0 -0
- package/dist/actions/utils/actions.util.read.js +0 -427
- package/dist/actions/utils/actions.util.read.js.map +0 -1
- package/dist/api/services/integrationsApi.service.d.ts +0 -18
- package/dist/api/services/integrationsApi.service.js +0 -80
- package/dist/api/services/integrationsApi.service.js.map +0 -1
- package/dist/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/services/fallback.service.d.ts +0 -5
- package/dist/processor/services/fallback.service.js +0 -43
- package/dist/processor/services/fallback.service.js.map +0 -1
- package/dist/processor/services/messagebrokers/aws-sqs.service.js +0 -77
- package/dist/processor/services/messagebrokers/aws-sqs.service.js.map +0 -1
- package/dist/processor/services/messagebrokers/google-pubsub.service.js.map +0 -1
- package/dist/processor/services/messagebrokers/index.d.ts +0 -3
- package/dist/processor/services/messagebrokers/index.js +0 -26
- package/dist/processor/services/messagebrokers/index.js.map +0 -1
- package/dist/processor/services/messagebrokers/kafka.service.d.ts +0 -14
- package/dist/processor/services/messagebrokers/kafka.service.js +0 -45
- package/dist/processor/services/messagebrokers/kafka.service.js.map +0 -1
- package/dist/processor/services/messagebrokers/messagebrokers.type.d.ts +0 -6
- package/dist/processor/services/messagebrokers/messagebrokers.type.js.map +0 -1
- package/dist/processor/services/messagebrokers/rabbitmq.service.js +0 -67
- package/dist/processor/services/messagebrokers/rabbitmq.service.js.map +0 -1
- package/dist/processor/services/messagebrokers/redis.service.js.map +0 -1
- package/dist/processor/services/quota.service.d.ts +0 -15
- package/dist/processor/services/quota.service.js +0 -63
- package/dist/processor/services/quota.service.js.map +0 -1
- package/dist/processor/utils/mongo.util.d.ts +0 -0
- package/dist/processor/utils/mongo.util.js +0 -152
- package/dist/processor/utils/mongo.util.js.map +0 -1
- package/dist/processor/utils/postgres.util.d.ts +0 -14
- package/dist/processor/utils/postgres.util.js +0 -83
- package/dist/processor/utils/postgres.util.js.map +0 -1
- package/dist/products/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/test.appBuilder.d.ts +0 -1
- package/dist/test/test.appBuilder.js +0 -16
- package/dist/test/test.appBuilder.js.map +0 -1
- package/dist/test/test.health.d.ts +0 -1
- package/dist/test/test.health.js +0 -49
- package/dist/test/test.health.js.map +0 -1
- package/dist/test/test.import.d.ts +0 -1
- package/dist/test/test.import.js +0 -1460
- package/dist/test/test.import.js.map +0 -1
- package/dist/test/test.import.openapi.d.ts +0 -1
- package/dist/test/test.import.openapi.js +0 -76
- package/dist/test/test.import.openapi.js.map +0 -1
- package/dist/test/test.imports.d.ts +0 -1
- package/dist/test/test.imports.js +0 -62
- package/dist/test/test.imports.js.map +0 -1
- package/dist/test/test.logs.d.ts +0 -1
- package/dist/test/test.logs.js +0 -18
- package/dist/test/test.logs.js.map +0 -1
- package/dist/test/test.processor.d.ts +0 -1
- package/dist/test/test.processor.js +0 -123
- package/dist/test/test.processor.js.map +0 -1
- package/dist/test/test.productBuilder.d.ts +0 -1
- package/dist/test/test.productBuilder.js +0 -661
- package/dist/test/test.productBuilder.js.map +0 -1
- package/dist/test.appBuilder.d.ts +0 -1
- package/dist/test.appBuilder.js +0 -14
- package/dist/test.appBuilder.js.map +0 -1
- package/dist/test.import.d.ts +0 -0
- package/dist/test.import.js +0 -24
- package/dist/test.import.js.map +0 -1
- package/dist/test.imports.d.ts +0 -1
- package/dist/test.imports.js +0 -28
- package/dist/test.imports.js.map +0 -1
- package/dist/test.integrationBuilder.d.ts +0 -1
- package/dist/test.integrationBuilder.js +0 -276
- package/dist/test.integrationBuilder.js.map +0 -1
- package/dist/test.processor.d.ts +0 -1
- package/dist/test.processor.js +0 -23
- package/dist/test.processor.js.map +0 -1
- package/dist/test.utils.d.ts +0 -1
- package/dist/test.utils.js +0 -25
- package/dist/test.utils.js.map +0 -1
- package/dist/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/{actions/actions.service.d.ts → types/request-tracker.interface.d.ts} +0 -0
|
@@ -0,0 +1,1452 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Memgraph Graph Database Adapter
|
|
4
|
+
*
|
|
5
|
+
* Implements the BaseGraphAdapter for Memgraph.
|
|
6
|
+
* Memgraph is a high-performance, in-memory graph database
|
|
7
|
+
* that is fully compatible with Neo4j's Bolt protocol and Cypher query language.
|
|
8
|
+
*
|
|
9
|
+
* Key features:
|
|
10
|
+
* - Cypher query language compatibility
|
|
11
|
+
* - Bolt protocol support
|
|
12
|
+
* - In-memory performance
|
|
13
|
+
* - Triggers and streams support
|
|
14
|
+
* - MAGE graph algorithms library
|
|
15
|
+
*/
|
|
16
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(o, k2, desc);
|
|
23
|
+
}) : (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
}));
|
|
27
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
+
}) : function(o, v) {
|
|
30
|
+
o["default"] = v;
|
|
31
|
+
});
|
|
32
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
33
|
+
var ownKeys = function(o) {
|
|
34
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
35
|
+
var ar = [];
|
|
36
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
39
|
+
return ownKeys(o);
|
|
40
|
+
};
|
|
41
|
+
return function (mod) {
|
|
42
|
+
if (mod && mod.__esModule) return mod;
|
|
43
|
+
var result = {};
|
|
44
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
45
|
+
__setModuleDefault(result, mod);
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
})();
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.MemgraphAdapter = void 0;
|
|
51
|
+
const base_adapter_1 = require("./base.adapter");
|
|
52
|
+
const enums_1 = require("../types/enums");
|
|
53
|
+
const graph_error_1 = require("../utils/graph-error");
|
|
54
|
+
/**
|
|
55
|
+
* Memgraph adapter - Cypher-compatible graph database
|
|
56
|
+
* Uses the neo4j-driver package as Memgraph supports the Bolt protocol
|
|
57
|
+
*/
|
|
58
|
+
class MemgraphAdapter extends base_adapter_1.BaseGraphAdapter {
|
|
59
|
+
constructor() {
|
|
60
|
+
super(...arguments);
|
|
61
|
+
this.graphType = enums_1.GraphType.MEMGRAPH;
|
|
62
|
+
this.supportedFeatures = new Set([
|
|
63
|
+
enums_1.GraphFeature.TRANSACTIONS,
|
|
64
|
+
enums_1.GraphFeature.SCHEMA_INDEXES,
|
|
65
|
+
enums_1.GraphFeature.TRIGGERS,
|
|
66
|
+
enums_1.GraphFeature.CHANGE_STREAMS,
|
|
67
|
+
enums_1.GraphFeature.GRAPH_ALGORITHMS,
|
|
68
|
+
]);
|
|
69
|
+
this.driver = null;
|
|
70
|
+
this.session = null;
|
|
71
|
+
}
|
|
72
|
+
// ==================== CONNECTION MANAGEMENT ====================
|
|
73
|
+
async connect(options) {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
try {
|
|
76
|
+
// Store connection options for reconnection
|
|
77
|
+
this.connectionOptions = options;
|
|
78
|
+
// Memgraph uses the Bolt protocol, compatible with neo4j-driver
|
|
79
|
+
const neo4j = await Promise.resolve().then(() => __importStar(require('neo4j-driver')));
|
|
80
|
+
const auth = options.auth
|
|
81
|
+
? neo4j.auth.basic(options.auth.username, options.auth.password)
|
|
82
|
+
: neo4j.auth.basic('', ''); // Memgraph can run without auth
|
|
83
|
+
// Check if encryption is already specified in the URL scheme
|
|
84
|
+
// bolt+s:// and bolt+ssc:// indicate encryption is configured via URL
|
|
85
|
+
const urlHasEncryption = options.connectionUrl.startsWith('bolt+s://') ||
|
|
86
|
+
options.connectionUrl.startsWith('bolt+ssc://') ||
|
|
87
|
+
options.connectionUrl.startsWith('neo4j+s://') ||
|
|
88
|
+
options.connectionUrl.startsWith('neo4j+ssc://');
|
|
89
|
+
// Build driver config - only set encrypted if URL doesn't already specify it
|
|
90
|
+
const driverConfig = Object.assign({}, options.options);
|
|
91
|
+
if (!urlHasEncryption) {
|
|
92
|
+
// Only set encrypted option when URL doesn't already configure it
|
|
93
|
+
driverConfig.encrypted = (_b = (_a = options.options) === null || _a === void 0 ? void 0 : _a.encrypted) !== null && _b !== void 0 ? _b : false;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
// Remove any conflicting encryption settings when URL specifies encryption
|
|
97
|
+
delete driverConfig.encrypted;
|
|
98
|
+
delete driverConfig.trust;
|
|
99
|
+
}
|
|
100
|
+
this.driver = neo4j.driver(options.connectionUrl, auth, driverConfig);
|
|
101
|
+
// Verify connection
|
|
102
|
+
await this.driver.verifyConnectivity();
|
|
103
|
+
this.connected = true;
|
|
104
|
+
this.connectionUrl = options.connectionUrl;
|
|
105
|
+
return {
|
|
106
|
+
connected: true,
|
|
107
|
+
type: enums_1.GraphType.MEMGRAPH,
|
|
108
|
+
latency: 0,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
this.connected = false;
|
|
113
|
+
throw graph_error_1.GraphError.connectionError(`Failed to connect to Memgraph: ${error.message}`, error);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async testConnection(options) {
|
|
117
|
+
try {
|
|
118
|
+
const neo4j = await Promise.resolve().then(() => __importStar(require('neo4j-driver')));
|
|
119
|
+
const startTime = Date.now();
|
|
120
|
+
const auth = options.auth
|
|
121
|
+
? neo4j.auth.basic(options.auth.username, options.auth.password)
|
|
122
|
+
: neo4j.auth.basic('', '');
|
|
123
|
+
// Check if encryption is already specified in the URL scheme
|
|
124
|
+
const urlHasEncryption = options.connectionUrl.startsWith('bolt+s://') ||
|
|
125
|
+
options.connectionUrl.startsWith('bolt+ssc://') ||
|
|
126
|
+
options.connectionUrl.startsWith('neo4j+s://') ||
|
|
127
|
+
options.connectionUrl.startsWith('neo4j+ssc://');
|
|
128
|
+
// Build driver config - avoid conflicting encryption settings
|
|
129
|
+
const driverConfig = Object.assign(Object.assign({}, options.options), { connectionTimeout: 5000 });
|
|
130
|
+
if (urlHasEncryption) {
|
|
131
|
+
delete driverConfig.encrypted;
|
|
132
|
+
delete driverConfig.trust;
|
|
133
|
+
}
|
|
134
|
+
const testDriver = neo4j.driver(options.connectionUrl, auth, driverConfig);
|
|
135
|
+
await testDriver.verifyConnectivity();
|
|
136
|
+
// Get Memgraph version
|
|
137
|
+
const session = testDriver.session();
|
|
138
|
+
const result = await session.run('CALL mg.info() YIELD key, value WHERE key = "version" RETURN value');
|
|
139
|
+
const version = result.records.length > 0 ? result.records[0].get('value') : 'unknown';
|
|
140
|
+
await session.close();
|
|
141
|
+
await testDriver.close();
|
|
142
|
+
return {
|
|
143
|
+
connected: true,
|
|
144
|
+
type: enums_1.GraphType.MEMGRAPH,
|
|
145
|
+
version,
|
|
146
|
+
latency: Date.now() - startTime,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
return {
|
|
151
|
+
connected: false,
|
|
152
|
+
type: enums_1.GraphType.MEMGRAPH,
|
|
153
|
+
error: error.message,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
async disconnect() {
|
|
158
|
+
if (this.session) {
|
|
159
|
+
await this.session.close();
|
|
160
|
+
this.session = null;
|
|
161
|
+
}
|
|
162
|
+
if (this.driver) {
|
|
163
|
+
await this.driver.close();
|
|
164
|
+
this.driver = null;
|
|
165
|
+
}
|
|
166
|
+
this.connected = false;
|
|
167
|
+
}
|
|
168
|
+
getSession(transaction) {
|
|
169
|
+
if (transaction === null || transaction === void 0 ? void 0 : transaction.client) {
|
|
170
|
+
return transaction.client;
|
|
171
|
+
}
|
|
172
|
+
if (!this.session) {
|
|
173
|
+
this.ensureConnected();
|
|
174
|
+
this.session = this.driver.session();
|
|
175
|
+
}
|
|
176
|
+
return this.session;
|
|
177
|
+
}
|
|
178
|
+
// ==================== NODE OPERATIONS ====================
|
|
179
|
+
async createNode(options, transaction) {
|
|
180
|
+
this.ensureConnected();
|
|
181
|
+
return this.executeWithRetry(async () => {
|
|
182
|
+
const labels = options.labels.join(':');
|
|
183
|
+
const query = `CREATE (n:${labels} $props) RETURN n, id(n) as nodeId`;
|
|
184
|
+
const session = this.getSession(transaction);
|
|
185
|
+
const result = await session.run(query, { props: options.properties });
|
|
186
|
+
const record = result.records[0];
|
|
187
|
+
const node = record.get('n');
|
|
188
|
+
const nodeId = record.get('nodeId');
|
|
189
|
+
return {
|
|
190
|
+
node: this.mapMemgraphNode(node, nodeId),
|
|
191
|
+
created: true,
|
|
192
|
+
};
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
async findNodes(options, transaction) {
|
|
196
|
+
this.ensureConnected();
|
|
197
|
+
return this.executeWithRetry(async () => {
|
|
198
|
+
var _a, _b;
|
|
199
|
+
const labels = ((_a = options.labels) === null || _a === void 0 ? void 0 : _a.join(':')) || '';
|
|
200
|
+
const labelClause = labels ? `:${labels}` : '';
|
|
201
|
+
let query = `MATCH (n${labelClause})`;
|
|
202
|
+
const params = {};
|
|
203
|
+
if (options.where) {
|
|
204
|
+
const { clause, params: whereParams } = this.buildWhereClause(options.where, 'n');
|
|
205
|
+
query += ` WHERE ${clause}`;
|
|
206
|
+
Object.assign(params, whereParams);
|
|
207
|
+
}
|
|
208
|
+
query += ' RETURN n, id(n) as nodeId';
|
|
209
|
+
if ((_b = options.orderBy) === null || _b === void 0 ? void 0 : _b.length) {
|
|
210
|
+
const orderClauses = options.orderBy.map(o => `n.${o.property} ${o.direction.toUpperCase()}`);
|
|
211
|
+
query += ` ORDER BY ${orderClauses.join(', ')}`;
|
|
212
|
+
}
|
|
213
|
+
if (options.skip) {
|
|
214
|
+
query += ` SKIP ${options.skip}`;
|
|
215
|
+
}
|
|
216
|
+
if (options.limit) {
|
|
217
|
+
query += ` LIMIT ${options.limit}`;
|
|
218
|
+
}
|
|
219
|
+
const session = this.getSession(transaction);
|
|
220
|
+
const result = await session.run(query, params);
|
|
221
|
+
const nodes = result.records.map((record) => this.mapMemgraphNode(record.get('n'), record.get('nodeId')));
|
|
222
|
+
return {
|
|
223
|
+
nodes,
|
|
224
|
+
count: nodes.length,
|
|
225
|
+
};
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
async findNodeById(id, transaction) {
|
|
229
|
+
this.ensureConnected();
|
|
230
|
+
return this.executeWithRetry(async () => {
|
|
231
|
+
// Memgraph uses internal id() function
|
|
232
|
+
const query = `MATCH (n) WHERE id(n) = $id RETURN n, id(n) as nodeId`;
|
|
233
|
+
const session = this.getSession(transaction);
|
|
234
|
+
const result = await session.run(query, {
|
|
235
|
+
id: typeof id === 'number' ? id : parseInt(id, 10),
|
|
236
|
+
});
|
|
237
|
+
if (result.records.length === 0) {
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
return this.mapMemgraphNode(result.records[0].get('n'), result.records[0].get('nodeId'));
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
async updateNode(options, transaction) {
|
|
244
|
+
this.ensureConnected();
|
|
245
|
+
return this.executeWithRetry(async () => {
|
|
246
|
+
var _a;
|
|
247
|
+
let query;
|
|
248
|
+
const params = { props: options.properties };
|
|
249
|
+
if (options.id) {
|
|
250
|
+
query = `MATCH (n) WHERE id(n) = $id SET n += $props RETURN n, id(n) as nodeId`;
|
|
251
|
+
params.id = typeof options.id === 'number' ? options.id : parseInt(options.id, 10);
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
const labels = ((_a = options.labels) === null || _a === void 0 ? void 0 : _a.join(':')) || '';
|
|
255
|
+
const labelClause = labels ? `:${labels}` : '';
|
|
256
|
+
query = `MATCH (n${labelClause})`;
|
|
257
|
+
if (options.where) {
|
|
258
|
+
const { clause, params: whereParams } = this.buildWhereClause(options.where, 'n');
|
|
259
|
+
query += ` WHERE ${clause}`;
|
|
260
|
+
Object.assign(params, whereParams);
|
|
261
|
+
}
|
|
262
|
+
query += ' SET n += $props RETURN n, id(n) as nodeId';
|
|
263
|
+
}
|
|
264
|
+
const session = this.getSession(transaction);
|
|
265
|
+
const result = await session.run(query, params);
|
|
266
|
+
const nodes = result.records.map((record) => this.mapMemgraphNode(record.get('n'), record.get('nodeId')));
|
|
267
|
+
return {
|
|
268
|
+
node: nodes.length === 1 ? nodes[0] : undefined,
|
|
269
|
+
nodes: nodes.length > 1 ? nodes : undefined,
|
|
270
|
+
updatedCount: nodes.length,
|
|
271
|
+
updated: nodes.length > 0,
|
|
272
|
+
};
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
async deleteNode(options, transaction) {
|
|
276
|
+
this.ensureConnected();
|
|
277
|
+
return this.executeWithRetry(async () => {
|
|
278
|
+
var _a;
|
|
279
|
+
let query;
|
|
280
|
+
const params = {};
|
|
281
|
+
const detach = options.detach ? 'DETACH ' : '';
|
|
282
|
+
if (options.id) {
|
|
283
|
+
query = `MATCH (n) WHERE id(n) = $id ${detach}DELETE n`;
|
|
284
|
+
params.id = typeof options.id === 'number' ? options.id : parseInt(options.id, 10);
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
const labels = ((_a = options.labels) === null || _a === void 0 ? void 0 : _a.join(':')) || '';
|
|
288
|
+
const labelClause = labels ? `:${labels}` : '';
|
|
289
|
+
query = `MATCH (n${labelClause})`;
|
|
290
|
+
if (options.where) {
|
|
291
|
+
const { clause, params: whereParams } = this.buildWhereClause(options.where, 'n');
|
|
292
|
+
query += ` WHERE ${clause}`;
|
|
293
|
+
Object.assign(params, whereParams);
|
|
294
|
+
}
|
|
295
|
+
query += ` ${detach}DELETE n`;
|
|
296
|
+
}
|
|
297
|
+
const session = this.getSession(transaction);
|
|
298
|
+
await session.run(query, params);
|
|
299
|
+
return {
|
|
300
|
+
deleted: true,
|
|
301
|
+
deletedCount: 1,
|
|
302
|
+
};
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
async mergeNode(options, transaction) {
|
|
306
|
+
this.ensureConnected();
|
|
307
|
+
return this.executeWithRetry(async () => {
|
|
308
|
+
const labels = options.labels.join(':');
|
|
309
|
+
const matchProps = Object.entries(options.matchProperties)
|
|
310
|
+
.map(([key]) => `${key}: $match_${key}`)
|
|
311
|
+
.join(', ');
|
|
312
|
+
let query = `MERGE (n:${labels} {${matchProps}})`;
|
|
313
|
+
const params = {};
|
|
314
|
+
// Add match properties to params
|
|
315
|
+
Object.entries(options.matchProperties).forEach(([key, value]) => {
|
|
316
|
+
params[`match_${key}`] = value;
|
|
317
|
+
});
|
|
318
|
+
if (options.onCreate) {
|
|
319
|
+
query += ' ON CREATE SET n += $onCreateProps';
|
|
320
|
+
params.onCreateProps = options.onCreate;
|
|
321
|
+
}
|
|
322
|
+
if (options.onMatch) {
|
|
323
|
+
query += ' ON MATCH SET n += $onMatchProps';
|
|
324
|
+
params.onMatchProps = options.onMatch;
|
|
325
|
+
}
|
|
326
|
+
query += ' RETURN n, id(n) as nodeId';
|
|
327
|
+
const session = this.getSession(transaction);
|
|
328
|
+
const result = await session.run(query, params);
|
|
329
|
+
const record = result.records[0];
|
|
330
|
+
const node = this.mapMemgraphNode(record.get('n'), record.get('nodeId'));
|
|
331
|
+
return {
|
|
332
|
+
node,
|
|
333
|
+
created: true, // Memgraph doesn't easily tell us if it was created or matched
|
|
334
|
+
merged: true,
|
|
335
|
+
};
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
// ==================== LABEL MANAGEMENT ====================
|
|
339
|
+
async addLabels(options, transaction) {
|
|
340
|
+
this.ensureConnected();
|
|
341
|
+
return this.executeWithRetry(async () => {
|
|
342
|
+
const labels = options.labels.map(l => `:\`${l}\``).join('');
|
|
343
|
+
const query = `
|
|
344
|
+
MATCH (n)
|
|
345
|
+
WHERE id(n) = $id
|
|
346
|
+
SET n${labels}
|
|
347
|
+
RETURN n, id(n) as nodeId
|
|
348
|
+
`;
|
|
349
|
+
const params = {
|
|
350
|
+
id: typeof options.id === 'number' ? options.id : parseInt(options.id, 10),
|
|
351
|
+
};
|
|
352
|
+
const session = this.getSession(transaction);
|
|
353
|
+
const result = await session.run(query, params);
|
|
354
|
+
if (result.records.length === 0) {
|
|
355
|
+
throw graph_error_1.GraphError.notFoundError(`Node with ID ${options.id} not found`);
|
|
356
|
+
}
|
|
357
|
+
const record = result.records[0];
|
|
358
|
+
const node = this.mapMemgraphNode(record.get('n'), record.get('nodeId'));
|
|
359
|
+
return {
|
|
360
|
+
node,
|
|
361
|
+
addedLabels: options.labels,
|
|
362
|
+
};
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
async removeLabels(options, transaction) {
|
|
366
|
+
this.ensureConnected();
|
|
367
|
+
return this.executeWithRetry(async () => {
|
|
368
|
+
const labels = options.labels.map(l => `:\`${l}\``).join('');
|
|
369
|
+
const query = `
|
|
370
|
+
MATCH (n)
|
|
371
|
+
WHERE id(n) = $id
|
|
372
|
+
REMOVE n${labels}
|
|
373
|
+
RETURN n, id(n) as nodeId
|
|
374
|
+
`;
|
|
375
|
+
const params = {
|
|
376
|
+
id: typeof options.id === 'number' ? options.id : parseInt(options.id, 10),
|
|
377
|
+
};
|
|
378
|
+
const session = this.getSession(transaction);
|
|
379
|
+
const result = await session.run(query, params);
|
|
380
|
+
if (result.records.length === 0) {
|
|
381
|
+
throw graph_error_1.GraphError.notFoundError(`Node with ID ${options.id} not found`);
|
|
382
|
+
}
|
|
383
|
+
const record = result.records[0];
|
|
384
|
+
const node = this.mapMemgraphNode(record.get('n'), record.get('nodeId'));
|
|
385
|
+
return {
|
|
386
|
+
node,
|
|
387
|
+
removedLabels: options.labels,
|
|
388
|
+
};
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
async setLabels(options, transaction) {
|
|
392
|
+
this.ensureConnected();
|
|
393
|
+
return this.executeWithRetry(async () => {
|
|
394
|
+
// First get current labels
|
|
395
|
+
const getQuery = `
|
|
396
|
+
MATCH (n)
|
|
397
|
+
WHERE id(n) = $id
|
|
398
|
+
RETURN labels(n) as currentLabels
|
|
399
|
+
`;
|
|
400
|
+
const params = {
|
|
401
|
+
id: typeof options.id === 'number' ? options.id : parseInt(options.id, 10),
|
|
402
|
+
};
|
|
403
|
+
const session = this.getSession(transaction);
|
|
404
|
+
const getResult = await session.run(getQuery, params);
|
|
405
|
+
if (getResult.records.length === 0) {
|
|
406
|
+
throw graph_error_1.GraphError.notFoundError(`Node with ID ${options.id} not found`);
|
|
407
|
+
}
|
|
408
|
+
const previousLabels = getResult.records[0].get('currentLabels');
|
|
409
|
+
// Remove all existing labels and add new ones
|
|
410
|
+
const removeLabels = previousLabels.map(l => `:\`${l}\``).join('');
|
|
411
|
+
const addLabels = options.labels.map(l => `:\`${l}\``).join('');
|
|
412
|
+
const setQuery = `
|
|
413
|
+
MATCH (n)
|
|
414
|
+
WHERE id(n) = $id
|
|
415
|
+
REMOVE n${removeLabels}
|
|
416
|
+
SET n${addLabels}
|
|
417
|
+
RETURN n, id(n) as nodeId
|
|
418
|
+
`;
|
|
419
|
+
const result = await session.run(setQuery, params);
|
|
420
|
+
const node = this.mapMemgraphNode(result.records[0].get('n'), result.records[0].get('nodeId'));
|
|
421
|
+
return {
|
|
422
|
+
node,
|
|
423
|
+
previousLabels,
|
|
424
|
+
newLabels: options.labels,
|
|
425
|
+
};
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
// ==================== RELATIONSHIP OPERATIONS ====================
|
|
429
|
+
async createRelationship(options, transaction) {
|
|
430
|
+
this.ensureConnected();
|
|
431
|
+
return this.executeWithRetry(async () => {
|
|
432
|
+
const query = `
|
|
433
|
+
MATCH (a), (b)
|
|
434
|
+
WHERE id(a) = $startId AND id(b) = $endId
|
|
435
|
+
CREATE (a)-[r:${options.type} $props]->(b)
|
|
436
|
+
RETURN r, id(r) as relId, id(a) as startId, id(b) as endId
|
|
437
|
+
`;
|
|
438
|
+
const params = {
|
|
439
|
+
startId: typeof options.startNodeId === 'number' ? options.startNodeId : parseInt(options.startNodeId, 10),
|
|
440
|
+
endId: typeof options.endNodeId === 'number' ? options.endNodeId : parseInt(options.endNodeId, 10),
|
|
441
|
+
props: options.properties || {},
|
|
442
|
+
};
|
|
443
|
+
const session = this.getSession(transaction);
|
|
444
|
+
const result = await session.run(query, params);
|
|
445
|
+
const record = result.records[0];
|
|
446
|
+
const rel = record.get('r');
|
|
447
|
+
return {
|
|
448
|
+
relationship: this.mapMemgraphRelationship(rel, record.get('relId'), record.get('startId'), record.get('endId')),
|
|
449
|
+
created: true,
|
|
450
|
+
};
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
async findRelationships(options, transaction) {
|
|
454
|
+
this.ensureConnected();
|
|
455
|
+
return this.executeWithRetry(async () => {
|
|
456
|
+
const types = options.type
|
|
457
|
+
? (Array.isArray(options.type) ? options.type.join('|') : options.type)
|
|
458
|
+
: (options.types ? options.types.join('|') : '');
|
|
459
|
+
const typeClause = types ? `:${types}` : '';
|
|
460
|
+
let query = `MATCH (a)-[r${typeClause}]->(b)`;
|
|
461
|
+
const params = {};
|
|
462
|
+
const conditions = [];
|
|
463
|
+
if (options.startNodeId) {
|
|
464
|
+
conditions.push('id(a) = $startId');
|
|
465
|
+
params.startId = typeof options.startNodeId === 'number' ? options.startNodeId : parseInt(options.startNodeId, 10);
|
|
466
|
+
}
|
|
467
|
+
if (options.endNodeId) {
|
|
468
|
+
conditions.push('id(b) = $endId');
|
|
469
|
+
params.endId = typeof options.endNodeId === 'number' ? options.endNodeId : parseInt(options.endNodeId, 10);
|
|
470
|
+
}
|
|
471
|
+
if (options.where) {
|
|
472
|
+
const { clause, params: whereParams } = this.buildWhereClause(options.where, 'r');
|
|
473
|
+
conditions.push(clause);
|
|
474
|
+
Object.assign(params, whereParams);
|
|
475
|
+
}
|
|
476
|
+
if (conditions.length > 0) {
|
|
477
|
+
query += ` WHERE ${conditions.join(' AND ')}`;
|
|
478
|
+
}
|
|
479
|
+
query += ' RETURN r, id(r) as relId, id(a) as startId, id(b) as endId';
|
|
480
|
+
if (options.skip) {
|
|
481
|
+
query += ` SKIP ${options.skip}`;
|
|
482
|
+
}
|
|
483
|
+
if (options.limit) {
|
|
484
|
+
query += ` LIMIT ${options.limit}`;
|
|
485
|
+
}
|
|
486
|
+
const session = this.getSession(transaction);
|
|
487
|
+
const result = await session.run(query, params);
|
|
488
|
+
const relationships = result.records.map((record) => this.mapMemgraphRelationship(record.get('r'), record.get('relId'), record.get('startId'), record.get('endId')));
|
|
489
|
+
return {
|
|
490
|
+
relationships,
|
|
491
|
+
count: relationships.length,
|
|
492
|
+
};
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
async findRelationshipById(id, transaction) {
|
|
496
|
+
this.ensureConnected();
|
|
497
|
+
return this.executeWithRetry(async () => {
|
|
498
|
+
const query = `
|
|
499
|
+
MATCH (a)-[r]->(b)
|
|
500
|
+
WHERE id(r) = $id
|
|
501
|
+
RETURN r, id(r) as relId, id(a) as startId, id(b) as endId
|
|
502
|
+
`;
|
|
503
|
+
const session = this.getSession(transaction);
|
|
504
|
+
const result = await session.run(query, {
|
|
505
|
+
id: typeof id === 'number' ? id : parseInt(id, 10),
|
|
506
|
+
});
|
|
507
|
+
if (result.records.length === 0) {
|
|
508
|
+
return null;
|
|
509
|
+
}
|
|
510
|
+
const record = result.records[0];
|
|
511
|
+
return this.mapMemgraphRelationship(record.get('r'), record.get('relId'), record.get('startId'), record.get('endId'));
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
async updateRelationship(options, transaction) {
|
|
515
|
+
this.ensureConnected();
|
|
516
|
+
return this.executeWithRetry(async () => {
|
|
517
|
+
let query;
|
|
518
|
+
const params = { props: options.properties };
|
|
519
|
+
if (options.id) {
|
|
520
|
+
query = `
|
|
521
|
+
MATCH (a)-[r]->(b)
|
|
522
|
+
WHERE id(r) = $id
|
|
523
|
+
SET r += $props
|
|
524
|
+
RETURN r, id(r) as relId, id(a) as startId, id(b) as endId
|
|
525
|
+
`;
|
|
526
|
+
params.id = typeof options.id === 'number' ? options.id : parseInt(options.id, 10);
|
|
527
|
+
}
|
|
528
|
+
else {
|
|
529
|
+
const typeClause = options.type ? `:${options.type}` : '';
|
|
530
|
+
query = `MATCH (a)-[r${typeClause}]->(b)`;
|
|
531
|
+
if (options.where) {
|
|
532
|
+
const { clause, params: whereParams } = this.buildWhereClause(options.where, 'r');
|
|
533
|
+
query += ` WHERE ${clause}`;
|
|
534
|
+
Object.assign(params, whereParams);
|
|
535
|
+
}
|
|
536
|
+
query += ' SET r += $props RETURN r, id(r) as relId, id(a) as startId, id(b) as endId';
|
|
537
|
+
}
|
|
538
|
+
const session = this.getSession(transaction);
|
|
539
|
+
const result = await session.run(query, params);
|
|
540
|
+
const relationships = result.records.map((record) => this.mapMemgraphRelationship(record.get('r'), record.get('relId'), record.get('startId'), record.get('endId')));
|
|
541
|
+
return {
|
|
542
|
+
relationship: relationships.length === 1 ? relationships[0] : undefined,
|
|
543
|
+
relationships: relationships.length > 1 ? relationships : undefined,
|
|
544
|
+
updatedCount: relationships.length,
|
|
545
|
+
updated: relationships.length > 0,
|
|
546
|
+
};
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
async deleteRelationship(options, transaction) {
|
|
550
|
+
this.ensureConnected();
|
|
551
|
+
return this.executeWithRetry(async () => {
|
|
552
|
+
var _a;
|
|
553
|
+
let query;
|
|
554
|
+
const params = {};
|
|
555
|
+
if (options.id) {
|
|
556
|
+
query = `MATCH ()-[r]->() WHERE id(r) = $id DELETE r RETURN count(r) as count`;
|
|
557
|
+
params.id = typeof options.id === 'number' ? options.id : parseInt(options.id, 10);
|
|
558
|
+
}
|
|
559
|
+
else {
|
|
560
|
+
const typeClause = options.type ? `:${options.type}` : '';
|
|
561
|
+
query = `MATCH (a)-[r${typeClause}]->(b)`;
|
|
562
|
+
const conditions = [];
|
|
563
|
+
if (options.startNodeId) {
|
|
564
|
+
conditions.push('id(a) = $startId');
|
|
565
|
+
params.startId = typeof options.startNodeId === 'number' ? options.startNodeId : parseInt(options.startNodeId, 10);
|
|
566
|
+
}
|
|
567
|
+
if (options.endNodeId) {
|
|
568
|
+
conditions.push('id(b) = $endId');
|
|
569
|
+
params.endId = typeof options.endNodeId === 'number' ? options.endNodeId : parseInt(options.endNodeId, 10);
|
|
570
|
+
}
|
|
571
|
+
if (options.where) {
|
|
572
|
+
const { clause, params: whereParams } = this.buildWhereClause(options.where, 'r');
|
|
573
|
+
conditions.push(clause);
|
|
574
|
+
Object.assign(params, whereParams);
|
|
575
|
+
}
|
|
576
|
+
if (conditions.length > 0) {
|
|
577
|
+
query += ` WHERE ${conditions.join(' AND ')}`;
|
|
578
|
+
}
|
|
579
|
+
query += ' DELETE r RETURN count(r) as count';
|
|
580
|
+
}
|
|
581
|
+
const session = this.getSession(transaction);
|
|
582
|
+
const result = await session.run(query, params);
|
|
583
|
+
const count = this.toNumber((_a = result.records[0]) === null || _a === void 0 ? void 0 : _a.get('count')) || 0;
|
|
584
|
+
return {
|
|
585
|
+
deleted: count > 0,
|
|
586
|
+
deletedCount: count,
|
|
587
|
+
};
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
async mergeRelationship(options, transaction) {
|
|
591
|
+
this.ensureConnected();
|
|
592
|
+
return this.executeWithRetry(async () => {
|
|
593
|
+
let matchPropsClause = '';
|
|
594
|
+
const params = {
|
|
595
|
+
startId: typeof options.startNodeId === 'number' ? options.startNodeId : parseInt(options.startNodeId, 10),
|
|
596
|
+
endId: typeof options.endNodeId === 'number' ? options.endNodeId : parseInt(options.endNodeId, 10),
|
|
597
|
+
};
|
|
598
|
+
if (options.matchProperties) {
|
|
599
|
+
const matchProps = Object.entries(options.matchProperties)
|
|
600
|
+
.map(([key]) => `${key}: $match_${key}`)
|
|
601
|
+
.join(', ');
|
|
602
|
+
matchPropsClause = ` {${matchProps}}`;
|
|
603
|
+
Object.entries(options.matchProperties).forEach(([key, value]) => {
|
|
604
|
+
params[`match_${key}`] = value;
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
let query = `
|
|
608
|
+
MATCH (a), (b)
|
|
609
|
+
WHERE id(a) = $startId AND id(b) = $endId
|
|
610
|
+
MERGE (a)-[r:${options.type}${matchPropsClause}]->(b)
|
|
611
|
+
`;
|
|
612
|
+
if (options.onCreate) {
|
|
613
|
+
query += ' ON CREATE SET r += $onCreateProps';
|
|
614
|
+
params.onCreateProps = options.onCreate;
|
|
615
|
+
}
|
|
616
|
+
if (options.onMatch) {
|
|
617
|
+
query += ' ON MATCH SET r += $onMatchProps';
|
|
618
|
+
params.onMatchProps = options.onMatch;
|
|
619
|
+
}
|
|
620
|
+
query += ' RETURN r, id(r) as relId, id(a) as startId, id(b) as endId';
|
|
621
|
+
const session = this.getSession(transaction);
|
|
622
|
+
const result = await session.run(query, params);
|
|
623
|
+
const record = result.records[0];
|
|
624
|
+
const relationship = this.mapMemgraphRelationship(record.get('r'), record.get('relId'), record.get('startId'), record.get('endId'));
|
|
625
|
+
return {
|
|
626
|
+
relationship,
|
|
627
|
+
created: true,
|
|
628
|
+
merged: true,
|
|
629
|
+
};
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
// ==================== TRAVERSAL OPERATIONS ====================
|
|
633
|
+
async traverse(options, transaction) {
|
|
634
|
+
this.ensureConnected();
|
|
635
|
+
return this.executeWithRetry(async () => {
|
|
636
|
+
var _a;
|
|
637
|
+
const direction = this.getDirectionArrow(options.direction);
|
|
638
|
+
const relTypes = ((_a = options.relationshipTypes) === null || _a === void 0 ? void 0 : _a.join('|')) || '';
|
|
639
|
+
const relClause = relTypes ? `:${relTypes}` : '';
|
|
640
|
+
const minDepth = options.minDepth || 1;
|
|
641
|
+
const maxDepth = options.maxDepth || 3;
|
|
642
|
+
const query = `
|
|
643
|
+
MATCH path = (start)${direction.left}[${relClause}*${minDepth}..${maxDepth}]${direction.right}(end)
|
|
644
|
+
WHERE id(start) = $startId
|
|
645
|
+
RETURN path
|
|
646
|
+
${options.limit ? `LIMIT ${options.limit}` : ''}
|
|
647
|
+
`;
|
|
648
|
+
const params = {
|
|
649
|
+
startId: typeof options.startNodeId === 'number' ? options.startNodeId : parseInt(options.startNodeId, 10),
|
|
650
|
+
};
|
|
651
|
+
const session = this.getSession(transaction);
|
|
652
|
+
const result = await session.run(query, params);
|
|
653
|
+
const paths = result.records.map((record) => this.mapMemgraphPath(record.get('path')));
|
|
654
|
+
// Collect unique nodes and relationships
|
|
655
|
+
const nodesMap = new Map();
|
|
656
|
+
const relsMap = new Map();
|
|
657
|
+
paths.forEach(path => {
|
|
658
|
+
path.nodes.forEach(node => nodesMap.set(String(node.id), node));
|
|
659
|
+
path.relationships.forEach(rel => relsMap.set(String(rel.id), rel));
|
|
660
|
+
});
|
|
661
|
+
return {
|
|
662
|
+
paths,
|
|
663
|
+
nodes: Array.from(nodesMap.values()),
|
|
664
|
+
relationships: Array.from(relsMap.values()),
|
|
665
|
+
count: paths.length,
|
|
666
|
+
};
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
async shortestPath(options, transaction) {
|
|
670
|
+
this.ensureConnected();
|
|
671
|
+
return this.executeWithRetry(async () => {
|
|
672
|
+
var _a;
|
|
673
|
+
const relTypes = ((_a = options.relationshipTypes) === null || _a === void 0 ? void 0 : _a.join('|')) || '';
|
|
674
|
+
const relClause = relTypes ? `:${relTypes}` : '';
|
|
675
|
+
const maxDepth = options.maxDepth || 15;
|
|
676
|
+
// Use BFS for shortest path in Memgraph
|
|
677
|
+
const query = `
|
|
678
|
+
MATCH (start), (end)
|
|
679
|
+
WHERE id(start) = $startId AND id(end) = $endId
|
|
680
|
+
MATCH path = shortestPath((start)-[${relClause}*..${maxDepth}]-(end))
|
|
681
|
+
RETURN path
|
|
682
|
+
`;
|
|
683
|
+
const params = {
|
|
684
|
+
startId: typeof options.startNodeId === 'number' ? options.startNodeId : parseInt(options.startNodeId, 10),
|
|
685
|
+
endId: typeof options.endNodeId === 'number' ? options.endNodeId : parseInt(options.endNodeId, 10),
|
|
686
|
+
};
|
|
687
|
+
const session = this.getSession(transaction);
|
|
688
|
+
const result = await session.run(query, params);
|
|
689
|
+
if (result.records.length === 0) {
|
|
690
|
+
return { path: null, found: false };
|
|
691
|
+
}
|
|
692
|
+
const path = this.mapMemgraphPath(result.records[0].get('path'));
|
|
693
|
+
return {
|
|
694
|
+
path,
|
|
695
|
+
length: path.length,
|
|
696
|
+
found: true,
|
|
697
|
+
totalWeight: options.weightProperty
|
|
698
|
+
? path.relationships.reduce((sum, r) => sum + (r.properties[options.weightProperty] || 0), 0)
|
|
699
|
+
: undefined,
|
|
700
|
+
};
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
async allPaths(options, transaction) {
|
|
704
|
+
this.ensureConnected();
|
|
705
|
+
return this.executeWithRetry(async () => {
|
|
706
|
+
var _a;
|
|
707
|
+
const relTypes = ((_a = options.relationshipTypes) === null || _a === void 0 ? void 0 : _a.join('|')) || '';
|
|
708
|
+
const relClause = relTypes ? `:${relTypes}` : '';
|
|
709
|
+
const minDepth = options.minDepth || 1;
|
|
710
|
+
const maxDepth = options.maxDepth || 5;
|
|
711
|
+
const limit = options.limit || options.maxPaths;
|
|
712
|
+
const query = `
|
|
713
|
+
MATCH (start), (end)
|
|
714
|
+
WHERE id(start) = $startId AND id(end) = $endId
|
|
715
|
+
MATCH path = (start)-[${relClause}*${minDepth}..${maxDepth}]-(end)
|
|
716
|
+
RETURN path
|
|
717
|
+
${limit ? `LIMIT ${limit}` : ''}
|
|
718
|
+
`;
|
|
719
|
+
const params = {
|
|
720
|
+
startId: typeof options.startNodeId === 'number' ? options.startNodeId : parseInt(options.startNodeId, 10),
|
|
721
|
+
endId: typeof options.endNodeId === 'number' ? options.endNodeId : parseInt(options.endNodeId, 10),
|
|
722
|
+
};
|
|
723
|
+
const session = this.getSession(transaction);
|
|
724
|
+
const result = await session.run(query, params);
|
|
725
|
+
const paths = result.records.map((record) => this.mapMemgraphPath(record.get('path')));
|
|
726
|
+
return {
|
|
727
|
+
paths,
|
|
728
|
+
count: paths.length,
|
|
729
|
+
total: paths.length,
|
|
730
|
+
};
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
async getNeighborhood(options, transaction) {
|
|
734
|
+
this.ensureConnected();
|
|
735
|
+
return this.executeWithRetry(async () => {
|
|
736
|
+
var _a;
|
|
737
|
+
const direction = this.getDirectionArrow(options.direction);
|
|
738
|
+
const relTypes = ((_a = options.relationshipTypes) === null || _a === void 0 ? void 0 : _a.join('|')) || '';
|
|
739
|
+
const relClause = relTypes ? `:${relTypes}` : '';
|
|
740
|
+
const depth = options.depth || 1;
|
|
741
|
+
const limit = options.limit;
|
|
742
|
+
const query = `
|
|
743
|
+
MATCH (start)
|
|
744
|
+
WHERE id(start) = $nodeId
|
|
745
|
+
MATCH path = (start)${direction.left}[r${relClause}*1..${depth}]${direction.right}(neighbor)
|
|
746
|
+
RETURN DISTINCT neighbor, id(neighbor) as neighborId, r
|
|
747
|
+
${limit ? `LIMIT ${limit}` : ''}
|
|
748
|
+
`;
|
|
749
|
+
const params = {
|
|
750
|
+
nodeId: typeof options.nodeId === 'number' ? options.nodeId : parseInt(options.nodeId, 10),
|
|
751
|
+
};
|
|
752
|
+
const session = this.getSession(transaction);
|
|
753
|
+
const result = await session.run(query, params);
|
|
754
|
+
const nodesMap = new Map();
|
|
755
|
+
const relationshipsSet = [];
|
|
756
|
+
result.records.forEach((record) => {
|
|
757
|
+
const neighbor = record.get('neighbor');
|
|
758
|
+
const neighborId = record.get('neighborId');
|
|
759
|
+
const nodeKey = String(this.toNumber(neighborId));
|
|
760
|
+
if (!nodesMap.has(nodeKey)) {
|
|
761
|
+
nodesMap.set(nodeKey, this.mapMemgraphNode(neighbor, neighborId));
|
|
762
|
+
}
|
|
763
|
+
const rels = record.get('r');
|
|
764
|
+
if (Array.isArray(rels)) {
|
|
765
|
+
rels.forEach((rel) => {
|
|
766
|
+
relationshipsSet.push(this.mapMemgraphRelationship(rel, rel.identity, rel.start, rel.end));
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
});
|
|
770
|
+
return {
|
|
771
|
+
nodes: Array.from(nodesMap.values()),
|
|
772
|
+
relationships: relationshipsSet,
|
|
773
|
+
depth,
|
|
774
|
+
};
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
async findConnectedComponents(options, transaction) {
|
|
778
|
+
this.ensureConnected();
|
|
779
|
+
return this.executeWithRetry(async () => {
|
|
780
|
+
var _a;
|
|
781
|
+
// Memgraph has MAGE library for graph algorithms
|
|
782
|
+
// Use weakly connected components algorithm
|
|
783
|
+
const labels = ((_a = options.labels) === null || _a === void 0 ? void 0 : _a.join(':')) || '';
|
|
784
|
+
const labelClause = labels ? `:${labels}` : '';
|
|
785
|
+
try {
|
|
786
|
+
// Try using MAGE library first (if installed)
|
|
787
|
+
const query = `
|
|
788
|
+
CALL weakly_connected_components.get()
|
|
789
|
+
YIELD node, component_id
|
|
790
|
+
WITH component_id, collect(node) as nodes
|
|
791
|
+
RETURN nodes, size(nodes) as size, component_id
|
|
792
|
+
ORDER BY size DESC
|
|
793
|
+
`;
|
|
794
|
+
const session = this.getSession(transaction);
|
|
795
|
+
const result = await session.run(query, {});
|
|
796
|
+
const components = result.records.map((record) => ({
|
|
797
|
+
nodes: record.get('nodes').map((n) => this.mapMemgraphNode(n, n.identity)),
|
|
798
|
+
size: this.toNumber(record.get('size')),
|
|
799
|
+
}));
|
|
800
|
+
return {
|
|
801
|
+
components,
|
|
802
|
+
count: components.length,
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
catch (_b) {
|
|
806
|
+
// Fallback to basic Cypher implementation
|
|
807
|
+
const query = `
|
|
808
|
+
MATCH (n${labelClause})
|
|
809
|
+
WITH collect(n) as allNodes
|
|
810
|
+
UNWIND allNodes as node
|
|
811
|
+
MATCH path = (node)-[*]-(connected)
|
|
812
|
+
WITH node, collect(DISTINCT connected) + [node] as component
|
|
813
|
+
WITH collect(DISTINCT component) as allComponents
|
|
814
|
+
UNWIND allComponents as comp
|
|
815
|
+
WITH comp, size(comp) as compSize
|
|
816
|
+
RETURN comp as nodes, compSize as size
|
|
817
|
+
ORDER BY size DESC
|
|
818
|
+
`;
|
|
819
|
+
const session = this.getSession(transaction);
|
|
820
|
+
const result = await session.run(query, {});
|
|
821
|
+
const components = result.records.map((record) => ({
|
|
822
|
+
nodes: record.get('nodes').map((n) => this.mapMemgraphNode(n, n.identity)),
|
|
823
|
+
size: this.toNumber(record.get('size')),
|
|
824
|
+
}));
|
|
825
|
+
return {
|
|
826
|
+
components,
|
|
827
|
+
count: components.length,
|
|
828
|
+
};
|
|
829
|
+
}
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
// ==================== AGGREGATION OPERATIONS ====================
|
|
833
|
+
async countNodes(labels, where, transaction) {
|
|
834
|
+
this.ensureConnected();
|
|
835
|
+
return this.executeWithRetry(async () => {
|
|
836
|
+
var _a;
|
|
837
|
+
const labelClause = (labels === null || labels === void 0 ? void 0 : labels.length) ? `:${labels.join(':')}` : '';
|
|
838
|
+
let query = `MATCH (n${labelClause})`;
|
|
839
|
+
const params = {};
|
|
840
|
+
if (where) {
|
|
841
|
+
const { clause, params: whereParams } = this.buildWhereClause(where, 'n');
|
|
842
|
+
query += ` WHERE ${clause}`;
|
|
843
|
+
Object.assign(params, whereParams);
|
|
844
|
+
}
|
|
845
|
+
query += ' RETURN count(n) as count';
|
|
846
|
+
const session = this.getSession(transaction);
|
|
847
|
+
const result = await session.run(query, params);
|
|
848
|
+
return {
|
|
849
|
+
count: this.toNumber((_a = result.records[0]) === null || _a === void 0 ? void 0 : _a.get('count')) || 0,
|
|
850
|
+
};
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
async countRelationships(types, where, transaction) {
|
|
854
|
+
this.ensureConnected();
|
|
855
|
+
return this.executeWithRetry(async () => {
|
|
856
|
+
var _a;
|
|
857
|
+
const typeClause = (types === null || types === void 0 ? void 0 : types.length) ? `:${types.join('|')}` : '';
|
|
858
|
+
let query = `MATCH ()-[r${typeClause}]->()`;
|
|
859
|
+
const params = {};
|
|
860
|
+
if (where) {
|
|
861
|
+
const { clause, params: whereParams } = this.buildWhereClause(where, 'r');
|
|
862
|
+
query += ` WHERE ${clause}`;
|
|
863
|
+
Object.assign(params, whereParams);
|
|
864
|
+
}
|
|
865
|
+
query += ' RETURN count(r) as count';
|
|
866
|
+
const session = this.getSession(transaction);
|
|
867
|
+
const result = await session.run(query, params);
|
|
868
|
+
return {
|
|
869
|
+
count: this.toNumber((_a = result.records[0]) === null || _a === void 0 ? void 0 : _a.get('count')) || 0,
|
|
870
|
+
};
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
async getStatistics(transaction) {
|
|
874
|
+
this.ensureConnected();
|
|
875
|
+
return this.executeWithRetry(async () => {
|
|
876
|
+
var _a, _b;
|
|
877
|
+
const session = this.getSession(transaction);
|
|
878
|
+
const nodeCountResult = await session.run('MATCH (n) RETURN count(n) as count');
|
|
879
|
+
const relCountResult = await session.run('MATCH ()-[r]->() RETURN count(r) as count');
|
|
880
|
+
return {
|
|
881
|
+
nodeCount: this.toNumber((_a = nodeCountResult.records[0]) === null || _a === void 0 ? void 0 : _a.get('count')) || 0,
|
|
882
|
+
relationshipCount: this.toNumber((_b = relCountResult.records[0]) === null || _b === void 0 ? void 0 : _b.get('count')) || 0,
|
|
883
|
+
};
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
// ==================== SEARCH OPERATIONS ====================
|
|
887
|
+
async fullTextSearch(options, transaction) {
|
|
888
|
+
this.ensureConnected();
|
|
889
|
+
return this.executeWithRetry(async () => {
|
|
890
|
+
// Memgraph supports text search through MAGE text_search module
|
|
891
|
+
// Use the index name to search
|
|
892
|
+
const query = `
|
|
893
|
+
CALL text_search.search($indexName, $searchQuery, $limit)
|
|
894
|
+
YIELD node, score
|
|
895
|
+
RETURN node, id(node) as nodeId, score
|
|
896
|
+
`;
|
|
897
|
+
const session = this.getSession(transaction);
|
|
898
|
+
const result = await session.run(query, {
|
|
899
|
+
indexName: options.indexName,
|
|
900
|
+
searchQuery: options.query,
|
|
901
|
+
limit: options.limit || 100,
|
|
902
|
+
});
|
|
903
|
+
const nodes = result.records.map((r) => this.mapMemgraphNode(r.get('node'), r.get('nodeId')));
|
|
904
|
+
const scores = result.records.map((r) => r.get('score') || 1.0);
|
|
905
|
+
return {
|
|
906
|
+
nodes,
|
|
907
|
+
scores,
|
|
908
|
+
};
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
async vectorSearch(_options, _transaction) {
|
|
912
|
+
// Memgraph doesn't natively support vector search yet
|
|
913
|
+
// This would require a custom implementation or external service
|
|
914
|
+
throw graph_error_1.GraphError.unsupportedOperationError('Vector search is not natively supported in Memgraph. Consider using an external vector database.', this.graphType);
|
|
915
|
+
}
|
|
916
|
+
// ==================== RAW QUERY ====================
|
|
917
|
+
async query(options, transaction) {
|
|
918
|
+
this.ensureConnected();
|
|
919
|
+
return this.executeWithRetry(async () => {
|
|
920
|
+
var _a, _b;
|
|
921
|
+
const session = this.getSession(transaction);
|
|
922
|
+
const result = await session.run(options.query, options.params || {});
|
|
923
|
+
return {
|
|
924
|
+
records: result.records.map((r) => r.toObject()),
|
|
925
|
+
summary: {
|
|
926
|
+
resultAvailableAfter: this.toNumber((_a = result.summary) === null || _a === void 0 ? void 0 : _a.resultAvailableAfter),
|
|
927
|
+
resultConsumedAfter: this.toNumber((_b = result.summary) === null || _b === void 0 ? void 0 : _b.resultConsumedAfter),
|
|
928
|
+
},
|
|
929
|
+
};
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
// ==================== SCHEMA OPERATIONS ====================
|
|
933
|
+
async createNodeIndex(options) {
|
|
934
|
+
this.ensureConnected();
|
|
935
|
+
return this.executeWithRetry(async () => {
|
|
936
|
+
// Memgraph uses CREATE INDEX ON :Label(property)
|
|
937
|
+
const query = `CREATE INDEX ON :${options.label}(${options.properties.join(', ')})`;
|
|
938
|
+
const session = this.getSession();
|
|
939
|
+
await session.run(query);
|
|
940
|
+
return { created: true, name: options.name };
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
async createNodeConstraint(options) {
|
|
944
|
+
this.ensureConnected();
|
|
945
|
+
return this.executeWithRetry(async () => {
|
|
946
|
+
let query;
|
|
947
|
+
const property = options.property || (options.properties && options.properties[0]);
|
|
948
|
+
switch (options.type) {
|
|
949
|
+
case 'UNIQUE':
|
|
950
|
+
// Memgraph uses CREATE CONSTRAINT ON (n:Label) ASSERT n.property IS UNIQUE
|
|
951
|
+
query = `CREATE CONSTRAINT ON (n:${options.label}) ASSERT n.${property} IS UNIQUE`;
|
|
952
|
+
break;
|
|
953
|
+
case 'EXISTS':
|
|
954
|
+
query = `CREATE CONSTRAINT ON (n:${options.label}) ASSERT EXISTS (n.${property})`;
|
|
955
|
+
break;
|
|
956
|
+
default:
|
|
957
|
+
throw graph_error_1.GraphError.validationError(`Unsupported constraint type: ${options.type}`);
|
|
958
|
+
}
|
|
959
|
+
const session = this.getSession();
|
|
960
|
+
await session.run(query);
|
|
961
|
+
return { created: true, name: options.name };
|
|
962
|
+
});
|
|
963
|
+
}
|
|
964
|
+
async createRelationshipIndex(options) {
|
|
965
|
+
this.ensureConnected();
|
|
966
|
+
return this.executeWithRetry(async () => {
|
|
967
|
+
// Memgraph relationship indexes
|
|
968
|
+
const query = `CREATE INDEX ON :${options.type}(${options.properties.join(', ')})`;
|
|
969
|
+
const session = this.getSession();
|
|
970
|
+
await session.run(query);
|
|
971
|
+
return { created: true, name: options.name };
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
async listIndexes() {
|
|
975
|
+
this.ensureConnected();
|
|
976
|
+
return this.executeWithRetry(async () => {
|
|
977
|
+
const query = 'SHOW INDEX INFO';
|
|
978
|
+
const session = this.getSession();
|
|
979
|
+
const result = await session.run(query);
|
|
980
|
+
const indexes = result.records.map((r) => ({
|
|
981
|
+
name: r.get('index name') || '',
|
|
982
|
+
labelOrType: r.get('label') || '',
|
|
983
|
+
properties: [r.get('property') || ''],
|
|
984
|
+
unique: false, // Memgraph doesn't distinguish in SHOW INDEX INFO
|
|
985
|
+
type: r.get('index type') || 'BTREE',
|
|
986
|
+
state: 'ONLINE',
|
|
987
|
+
}));
|
|
988
|
+
return { indexes };
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
async listConstraints() {
|
|
992
|
+
this.ensureConnected();
|
|
993
|
+
return this.executeWithRetry(async () => {
|
|
994
|
+
const query = 'SHOW CONSTRAINT INFO';
|
|
995
|
+
const session = this.getSession();
|
|
996
|
+
const result = await session.run(query);
|
|
997
|
+
const constraints = result.records.map((r) => ({
|
|
998
|
+
name: `constraint_${r.get('label')}_${r.get('property')}`,
|
|
999
|
+
label: r.get('label') || '',
|
|
1000
|
+
property: r.get('property') || '',
|
|
1001
|
+
type: r.get('constraint type') || 'UNIQUE',
|
|
1002
|
+
}));
|
|
1003
|
+
return { constraints };
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
async dropIndex(name) {
|
|
1007
|
+
this.ensureConnected();
|
|
1008
|
+
return this.executeWithRetry(async () => {
|
|
1009
|
+
// In Memgraph, we need label and property to drop index
|
|
1010
|
+
// This is a simplified version
|
|
1011
|
+
const query = `DROP INDEX ON :${name}`;
|
|
1012
|
+
const session = this.getSession();
|
|
1013
|
+
try {
|
|
1014
|
+
await session.run(query);
|
|
1015
|
+
return { dropped: true };
|
|
1016
|
+
}
|
|
1017
|
+
catch (_a) {
|
|
1018
|
+
return { dropped: false };
|
|
1019
|
+
}
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1022
|
+
async dropConstraint(name) {
|
|
1023
|
+
this.ensureConnected();
|
|
1024
|
+
return this.executeWithRetry(async () => {
|
|
1025
|
+
// Memgraph requires the full constraint definition to drop
|
|
1026
|
+
// This is a simplified version that might need adjustment
|
|
1027
|
+
const query = `DROP CONSTRAINT ON (n:${name}) ASSERT n.id IS UNIQUE`;
|
|
1028
|
+
const session = this.getSession();
|
|
1029
|
+
try {
|
|
1030
|
+
await session.run(query);
|
|
1031
|
+
return { dropped: true };
|
|
1032
|
+
}
|
|
1033
|
+
catch (_a) {
|
|
1034
|
+
return { dropped: false };
|
|
1035
|
+
}
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
// ==================== SCHEMA INTROSPECTION ====================
|
|
1039
|
+
async listLabels() {
|
|
1040
|
+
this.ensureConnected();
|
|
1041
|
+
return this.executeWithRetry(async () => {
|
|
1042
|
+
var _a, _b, _c, _d;
|
|
1043
|
+
const session = this.getSession();
|
|
1044
|
+
// Get all labels using Memgraph's CALL mg.labels()
|
|
1045
|
+
const labelsResult = await session.run('CALL mg.labels() YIELD label RETURN label');
|
|
1046
|
+
const labelNames = labelsResult.records.map((r) => r.get('label'));
|
|
1047
|
+
const labels = [];
|
|
1048
|
+
for (const labelName of labelNames) {
|
|
1049
|
+
// Get count for each label
|
|
1050
|
+
const countResult = await session.run(`MATCH (n:\`${labelName}\`) RETURN count(n) as count`);
|
|
1051
|
+
const count = ((_c = (_b = (_a = countResult.records[0]) === null || _a === void 0 ? void 0 : _a.get('count')) === null || _b === void 0 ? void 0 : _b.toNumber) === null || _c === void 0 ? void 0 : _c.call(_b)) ||
|
|
1052
|
+
((_d = countResult.records[0]) === null || _d === void 0 ? void 0 : _d.get('count')) || 0;
|
|
1053
|
+
// Get properties for a sample of nodes with this label
|
|
1054
|
+
const propsResult = await session.run(`MATCH (n:\`${labelName}\`) WITH n LIMIT 100
|
|
1055
|
+
UNWIND keys(n) as key
|
|
1056
|
+
RETURN DISTINCT key`);
|
|
1057
|
+
const properties = propsResult.records.map((r) => ({
|
|
1058
|
+
name: r.get('key'),
|
|
1059
|
+
type: 'unknown',
|
|
1060
|
+
}));
|
|
1061
|
+
labels.push({
|
|
1062
|
+
name: labelName,
|
|
1063
|
+
count: typeof count === 'number' ? count : Number(count),
|
|
1064
|
+
properties,
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
return { labels };
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
async listRelationshipTypes() {
|
|
1071
|
+
this.ensureConnected();
|
|
1072
|
+
return this.executeWithRetry(async () => {
|
|
1073
|
+
var _a, _b, _c, _d;
|
|
1074
|
+
const session = this.getSession();
|
|
1075
|
+
// Get all relationship types using Memgraph's CALL mg.relationship_types()
|
|
1076
|
+
const typesResult = await session.run('CALL mg.relationship_types() YIELD relationshipType RETURN relationshipType');
|
|
1077
|
+
const typeNames = typesResult.records.map((r) => r.get('relationshipType'));
|
|
1078
|
+
const types = [];
|
|
1079
|
+
for (const typeName of typeNames) {
|
|
1080
|
+
// Get count for each type
|
|
1081
|
+
const countResult = await session.run(`MATCH ()-[r:\`${typeName}\`]->() RETURN count(r) as count`);
|
|
1082
|
+
const count = ((_c = (_b = (_a = countResult.records[0]) === null || _a === void 0 ? void 0 : _a.get('count')) === null || _b === void 0 ? void 0 : _b.toNumber) === null || _c === void 0 ? void 0 : _c.call(_b)) ||
|
|
1083
|
+
((_d = countResult.records[0]) === null || _d === void 0 ? void 0 : _d.get('count')) || 0;
|
|
1084
|
+
// Get source and target label information
|
|
1085
|
+
const endpointsResult = await session.run(`MATCH (a)-[r:\`${typeName}\`]->(b)
|
|
1086
|
+
WITH labels(a) as fromLabels, labels(b) as toLabels
|
|
1087
|
+
RETURN DISTINCT fromLabels[0] as fromLabel, toLabels[0] as toLabel
|
|
1088
|
+
LIMIT 10`);
|
|
1089
|
+
const fromLabelsArray = endpointsResult.records
|
|
1090
|
+
.map((r) => r.get('fromLabel'))
|
|
1091
|
+
.filter((l) => Boolean(l));
|
|
1092
|
+
const fromLabels = [...new Set(fromLabelsArray)];
|
|
1093
|
+
const toLabelsArray = endpointsResult.records
|
|
1094
|
+
.map((r) => r.get('toLabel'))
|
|
1095
|
+
.filter((l) => Boolean(l));
|
|
1096
|
+
const toLabels = [...new Set(toLabelsArray)];
|
|
1097
|
+
// Get properties for relationships of this type
|
|
1098
|
+
const propsResult = await session.run(`MATCH ()-[r:\`${typeName}\`]->() WITH r LIMIT 100
|
|
1099
|
+
UNWIND keys(r) as key
|
|
1100
|
+
RETURN DISTINCT key`);
|
|
1101
|
+
const properties = propsResult.records.map((r) => ({
|
|
1102
|
+
name: r.get('key'),
|
|
1103
|
+
type: 'unknown',
|
|
1104
|
+
}));
|
|
1105
|
+
types.push({
|
|
1106
|
+
type: typeName,
|
|
1107
|
+
count: typeof count === 'number' ? count : Number(count),
|
|
1108
|
+
fromLabels,
|
|
1109
|
+
toLabels,
|
|
1110
|
+
properties: properties.length > 0 ? properties : undefined,
|
|
1111
|
+
});
|
|
1112
|
+
}
|
|
1113
|
+
return { types };
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
// ==================== TRANSACTION OPERATIONS ====================
|
|
1117
|
+
async beginTransaction(_options) {
|
|
1118
|
+
this.ensureConnected();
|
|
1119
|
+
return this.executeWithRetry(async () => {
|
|
1120
|
+
const session = this.driver.session();
|
|
1121
|
+
const tx = session.beginTransaction();
|
|
1122
|
+
return {
|
|
1123
|
+
id: `tx_${Date.now()}`,
|
|
1124
|
+
status: enums_1.GraphTransactionStatus.ACTIVE,
|
|
1125
|
+
client: tx,
|
|
1126
|
+
nativeTransaction: tx,
|
|
1127
|
+
startTime: new Date(),
|
|
1128
|
+
commit: async () => {
|
|
1129
|
+
await tx.commit();
|
|
1130
|
+
await session.close();
|
|
1131
|
+
},
|
|
1132
|
+
rollback: async () => {
|
|
1133
|
+
await tx.rollback();
|
|
1134
|
+
await session.close();
|
|
1135
|
+
},
|
|
1136
|
+
};
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
async commitTransaction(transaction) {
|
|
1140
|
+
if (transaction.commit) {
|
|
1141
|
+
await transaction.commit();
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
async rollbackTransaction(transaction) {
|
|
1145
|
+
if (transaction.rollback) {
|
|
1146
|
+
await transaction.rollback();
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
// ==================== MEMGRAPH-SPECIFIC FEATURES ====================
|
|
1150
|
+
/**
|
|
1151
|
+
* Create a trigger in Memgraph
|
|
1152
|
+
*/
|
|
1153
|
+
async createTrigger(name, event, target, procedure) {
|
|
1154
|
+
this.ensureConnected();
|
|
1155
|
+
return this.executeWithRetry(async () => {
|
|
1156
|
+
const eventClause = `${event === 'CREATE' ? 'CREATED' : event === 'UPDATE' ? 'UPDATED' : 'DELETED'}`;
|
|
1157
|
+
const targetClause = target === 'NODE' ? 'VERTEX' : 'EDGE';
|
|
1158
|
+
const query = `
|
|
1159
|
+
CREATE TRIGGER ${name}
|
|
1160
|
+
ON ${eventClause} ${targetClause}
|
|
1161
|
+
EXECUTE ${procedure}
|
|
1162
|
+
`;
|
|
1163
|
+
const session = this.getSession();
|
|
1164
|
+
await session.run(query);
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Drop a trigger in Memgraph
|
|
1169
|
+
*/
|
|
1170
|
+
async dropTrigger(name) {
|
|
1171
|
+
this.ensureConnected();
|
|
1172
|
+
return this.executeWithRetry(async () => {
|
|
1173
|
+
const query = `DROP TRIGGER ${name}`;
|
|
1174
|
+
const session = this.getSession();
|
|
1175
|
+
await session.run(query);
|
|
1176
|
+
});
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* List all triggers in Memgraph
|
|
1180
|
+
*/
|
|
1181
|
+
async listTriggers() {
|
|
1182
|
+
this.ensureConnected();
|
|
1183
|
+
return this.executeWithRetry(async () => {
|
|
1184
|
+
const query = 'SHOW TRIGGERS';
|
|
1185
|
+
const session = this.getSession();
|
|
1186
|
+
const result = await session.run(query);
|
|
1187
|
+
return result.records.map((r) => ({
|
|
1188
|
+
name: r.get('trigger name'),
|
|
1189
|
+
statement: r.get('statement'),
|
|
1190
|
+
}));
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Create a stream consumer in Memgraph
|
|
1195
|
+
*/
|
|
1196
|
+
async createStream(name, type, topics, transformationProcedure, config) {
|
|
1197
|
+
this.ensureConnected();
|
|
1198
|
+
return this.executeWithRetry(async () => {
|
|
1199
|
+
const configStr = Object.entries(config)
|
|
1200
|
+
.map(([k, v]) => `${k} = '${v}'`)
|
|
1201
|
+
.join(', ');
|
|
1202
|
+
const query = `
|
|
1203
|
+
CREATE ${type} STREAM ${name}
|
|
1204
|
+
TOPICS ${topics.join(', ')}
|
|
1205
|
+
TRANSFORM ${transformationProcedure}
|
|
1206
|
+
${configStr ? `CONFIGS { ${configStr} }` : ''}
|
|
1207
|
+
`;
|
|
1208
|
+
const session = this.getSession();
|
|
1209
|
+
await session.run(query);
|
|
1210
|
+
});
|
|
1211
|
+
}
|
|
1212
|
+
/**
|
|
1213
|
+
* Run a MAGE algorithm (if installed)
|
|
1214
|
+
*/
|
|
1215
|
+
async runMageAlgorithm(algorithm, params = {}) {
|
|
1216
|
+
this.ensureConnected();
|
|
1217
|
+
return this.executeWithRetry(async () => {
|
|
1218
|
+
const paramsList = Object.entries(params)
|
|
1219
|
+
.map(([k]) => `${k}: $${k}`)
|
|
1220
|
+
.join(', ');
|
|
1221
|
+
const query = `CALL ${algorithm}(${paramsList ? `{${paramsList}}` : ''}) YIELD *`;
|
|
1222
|
+
const session = this.getSession();
|
|
1223
|
+
const result = await session.run(query, params);
|
|
1224
|
+
return result.records.map((r) => r.toObject());
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
// ==================== UTILITY METHODS ====================
|
|
1228
|
+
buildWhereClause(where, alias = 'n') {
|
|
1229
|
+
const conditions = [];
|
|
1230
|
+
const params = {};
|
|
1231
|
+
let paramIndex = 0;
|
|
1232
|
+
const processCondition = (key, value, prefix = '') => {
|
|
1233
|
+
const fullKey = prefix ? `${prefix}_${key}` : key;
|
|
1234
|
+
const paramName = `param_${paramIndex++}`;
|
|
1235
|
+
// Normalize key to lowercase for comparison
|
|
1236
|
+
const normalizedKey = key.toLowerCase();
|
|
1237
|
+
if (normalizedKey === '$and') {
|
|
1238
|
+
const subConditions = [];
|
|
1239
|
+
if (Array.isArray(value)) {
|
|
1240
|
+
value.forEach((v) => {
|
|
1241
|
+
Object.entries(v).forEach(([k, val]) => {
|
|
1242
|
+
processCondition(k, val, fullKey);
|
|
1243
|
+
subConditions.push(conditions.pop());
|
|
1244
|
+
});
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
else {
|
|
1248
|
+
Object.entries(value).forEach(([k, v]) => {
|
|
1249
|
+
processCondition(k, v, fullKey);
|
|
1250
|
+
subConditions.push(conditions.pop());
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1253
|
+
conditions.push(`(${subConditions.join(' AND ')})`);
|
|
1254
|
+
return;
|
|
1255
|
+
}
|
|
1256
|
+
if (normalizedKey === '$or') {
|
|
1257
|
+
const subConditions = [];
|
|
1258
|
+
if (Array.isArray(value)) {
|
|
1259
|
+
value.forEach((v) => {
|
|
1260
|
+
Object.entries(v).forEach(([k, val]) => {
|
|
1261
|
+
processCondition(k, val, fullKey);
|
|
1262
|
+
subConditions.push(conditions.pop());
|
|
1263
|
+
});
|
|
1264
|
+
});
|
|
1265
|
+
}
|
|
1266
|
+
else {
|
|
1267
|
+
Object.entries(value).forEach(([k, v]) => {
|
|
1268
|
+
processCondition(k, v, fullKey);
|
|
1269
|
+
subConditions.push(conditions.pop());
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
conditions.push(`(${subConditions.join(' OR ')})`);
|
|
1273
|
+
return;
|
|
1274
|
+
}
|
|
1275
|
+
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
1276
|
+
Object.entries(value).forEach(([op, opValue]) => {
|
|
1277
|
+
const normalizedOp = op.toLowerCase();
|
|
1278
|
+
const opParamName = `${paramName}_${normalizedOp}`;
|
|
1279
|
+
switch (normalizedOp) {
|
|
1280
|
+
case '$gt':
|
|
1281
|
+
conditions.push(`${alias}.${key} > $${opParamName}`);
|
|
1282
|
+
params[opParamName] = opValue;
|
|
1283
|
+
break;
|
|
1284
|
+
case '$gte':
|
|
1285
|
+
conditions.push(`${alias}.${key} >= $${opParamName}`);
|
|
1286
|
+
params[opParamName] = opValue;
|
|
1287
|
+
break;
|
|
1288
|
+
case '$lt':
|
|
1289
|
+
conditions.push(`${alias}.${key} < $${opParamName}`);
|
|
1290
|
+
params[opParamName] = opValue;
|
|
1291
|
+
break;
|
|
1292
|
+
case '$lte':
|
|
1293
|
+
conditions.push(`${alias}.${key} <= $${opParamName}`);
|
|
1294
|
+
params[opParamName] = opValue;
|
|
1295
|
+
break;
|
|
1296
|
+
case '$ne':
|
|
1297
|
+
conditions.push(`${alias}.${key} <> $${opParamName}`);
|
|
1298
|
+
params[opParamName] = opValue;
|
|
1299
|
+
break;
|
|
1300
|
+
case '$in':
|
|
1301
|
+
conditions.push(`${alias}.${key} IN $${opParamName}`);
|
|
1302
|
+
params[opParamName] = opValue;
|
|
1303
|
+
break;
|
|
1304
|
+
case '$nin':
|
|
1305
|
+
case '$not_in':
|
|
1306
|
+
conditions.push(`NOT ${alias}.${key} IN $${opParamName}`);
|
|
1307
|
+
params[opParamName] = opValue;
|
|
1308
|
+
break;
|
|
1309
|
+
case '$contains':
|
|
1310
|
+
conditions.push(`${alias}.${key} CONTAINS $${opParamName}`);
|
|
1311
|
+
params[opParamName] = opValue;
|
|
1312
|
+
break;
|
|
1313
|
+
case '$startswith':
|
|
1314
|
+
case '$starts_with':
|
|
1315
|
+
conditions.push(`${alias}.${key} STARTS WITH $${opParamName}`);
|
|
1316
|
+
params[opParamName] = opValue;
|
|
1317
|
+
break;
|
|
1318
|
+
case '$endswith':
|
|
1319
|
+
case '$ends_with':
|
|
1320
|
+
conditions.push(`${alias}.${key} ENDS WITH $${opParamName}`);
|
|
1321
|
+
params[opParamName] = opValue;
|
|
1322
|
+
break;
|
|
1323
|
+
case '$exists':
|
|
1324
|
+
if (opValue) {
|
|
1325
|
+
conditions.push(`${alias}.${key} IS NOT NULL`);
|
|
1326
|
+
}
|
|
1327
|
+
else {
|
|
1328
|
+
conditions.push(`${alias}.${key} IS NULL`);
|
|
1329
|
+
}
|
|
1330
|
+
break;
|
|
1331
|
+
case '$regex':
|
|
1332
|
+
conditions.push(`${alias}.${key} =~ $${opParamName}`);
|
|
1333
|
+
params[opParamName] = opValue;
|
|
1334
|
+
break;
|
|
1335
|
+
}
|
|
1336
|
+
});
|
|
1337
|
+
}
|
|
1338
|
+
else {
|
|
1339
|
+
conditions.push(`${alias}.${key} = $${paramName}`);
|
|
1340
|
+
params[paramName] = value;
|
|
1341
|
+
}
|
|
1342
|
+
};
|
|
1343
|
+
Object.entries(where).forEach(([key, value]) => {
|
|
1344
|
+
processCondition(key, value);
|
|
1345
|
+
});
|
|
1346
|
+
return {
|
|
1347
|
+
clause: conditions.join(' AND ') || 'true',
|
|
1348
|
+
params,
|
|
1349
|
+
};
|
|
1350
|
+
}
|
|
1351
|
+
parseError(error) {
|
|
1352
|
+
if (error instanceof graph_error_1.GraphError) {
|
|
1353
|
+
return error;
|
|
1354
|
+
}
|
|
1355
|
+
return graph_error_1.GraphError.queryError(String(error));
|
|
1356
|
+
}
|
|
1357
|
+
// ==================== PRIVATE HELPER METHODS ====================
|
|
1358
|
+
mapMemgraphNode(node, nodeId) {
|
|
1359
|
+
const id = nodeId !== undefined ? this.toNumber(nodeId) : this.toNumber(node.identity);
|
|
1360
|
+
return {
|
|
1361
|
+
id: String(id),
|
|
1362
|
+
labels: node.labels || [],
|
|
1363
|
+
properties: this.convertProperties(node.properties || {}),
|
|
1364
|
+
};
|
|
1365
|
+
}
|
|
1366
|
+
mapMemgraphRelationship(rel, relId, startId, endId) {
|
|
1367
|
+
const id = relId !== undefined ? this.toNumber(relId) : this.toNumber(rel.identity);
|
|
1368
|
+
const start = startId !== undefined ? this.toNumber(startId) : this.toNumber(rel.start);
|
|
1369
|
+
const end = endId !== undefined ? this.toNumber(endId) : this.toNumber(rel.end);
|
|
1370
|
+
return {
|
|
1371
|
+
id: String(id),
|
|
1372
|
+
type: rel.type,
|
|
1373
|
+
startNodeId: String(start),
|
|
1374
|
+
endNodeId: String(end),
|
|
1375
|
+
properties: this.convertProperties(rel.properties || {}),
|
|
1376
|
+
};
|
|
1377
|
+
}
|
|
1378
|
+
mapMemgraphPath(path) {
|
|
1379
|
+
const nodes = [];
|
|
1380
|
+
const relationships = [];
|
|
1381
|
+
if (path.segments) {
|
|
1382
|
+
path.segments.forEach((segment, index) => {
|
|
1383
|
+
if (index === 0) {
|
|
1384
|
+
nodes.push(this.mapMemgraphNode(segment.start, segment.start.identity));
|
|
1385
|
+
}
|
|
1386
|
+
nodes.push(this.mapMemgraphNode(segment.end, segment.end.identity));
|
|
1387
|
+
relationships.push(this.mapMemgraphRelationship(segment.relationship, segment.relationship.identity, segment.start.identity, segment.end.identity));
|
|
1388
|
+
});
|
|
1389
|
+
}
|
|
1390
|
+
return {
|
|
1391
|
+
nodes,
|
|
1392
|
+
relationships,
|
|
1393
|
+
length: relationships.length,
|
|
1394
|
+
};
|
|
1395
|
+
}
|
|
1396
|
+
convertProperties(props) {
|
|
1397
|
+
const result = {};
|
|
1398
|
+
for (const [key, value] of Object.entries(props)) {
|
|
1399
|
+
result[key] = this.convertValue(value);
|
|
1400
|
+
}
|
|
1401
|
+
return result;
|
|
1402
|
+
}
|
|
1403
|
+
convertValue(value) {
|
|
1404
|
+
var _a, _b, _c;
|
|
1405
|
+
if (value === null || value === undefined) {
|
|
1406
|
+
return value;
|
|
1407
|
+
}
|
|
1408
|
+
// Handle Integer type (from neo4j-driver)
|
|
1409
|
+
if (typeof value === 'object' && ((_a = value.constructor) === null || _a === void 0 ? void 0 : _a.name) === 'Integer') {
|
|
1410
|
+
return this.toNumber(value);
|
|
1411
|
+
}
|
|
1412
|
+
// Handle Date types
|
|
1413
|
+
if (typeof value === 'object' && (((_b = value.constructor) === null || _b === void 0 ? void 0 : _b.name) === 'Date' || ((_c = value.constructor) === null || _c === void 0 ? void 0 : _c.name) === 'DateTime')) {
|
|
1414
|
+
return new Date(value.toString());
|
|
1415
|
+
}
|
|
1416
|
+
if (Array.isArray(value)) {
|
|
1417
|
+
return value.map(v => this.convertValue(v));
|
|
1418
|
+
}
|
|
1419
|
+
return value;
|
|
1420
|
+
}
|
|
1421
|
+
toNumber(value) {
|
|
1422
|
+
if (value === null || value === undefined) {
|
|
1423
|
+
return 0;
|
|
1424
|
+
}
|
|
1425
|
+
if (typeof value === 'number') {
|
|
1426
|
+
return value;
|
|
1427
|
+
}
|
|
1428
|
+
if (typeof value === 'object' && typeof value.toNumber === 'function') {
|
|
1429
|
+
return value.toNumber();
|
|
1430
|
+
}
|
|
1431
|
+
if (typeof value === 'object' && typeof value.toInt === 'function') {
|
|
1432
|
+
return value.toInt();
|
|
1433
|
+
}
|
|
1434
|
+
return parseInt(String(value), 10) || 0;
|
|
1435
|
+
}
|
|
1436
|
+
getDirectionArrow(direction) {
|
|
1437
|
+
switch (direction) {
|
|
1438
|
+
case enums_1.TraversalDirection.OUTGOING:
|
|
1439
|
+
case 'OUTGOING':
|
|
1440
|
+
return { left: '-', right: '->' };
|
|
1441
|
+
case enums_1.TraversalDirection.INCOMING:
|
|
1442
|
+
case 'INCOMING':
|
|
1443
|
+
return { left: '<-', right: '-' };
|
|
1444
|
+
case enums_1.TraversalDirection.BOTH:
|
|
1445
|
+
case 'BOTH':
|
|
1446
|
+
default:
|
|
1447
|
+
return { left: '-', right: '-' };
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
exports.MemgraphAdapter = MemgraphAdapter;
|
|
1452
|
+
//# sourceMappingURL=memgraph.adapter.js.map
|