@ductape/sdk 0.0.4-v6 → 0.0.4-v61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/agent-context.d.ts +98 -0
- package/dist/agents/agent-context.js +588 -0
- package/dist/agents/agent-context.js.map +1 -0
- package/dist/agents/agent-executor.d.ts +180 -0
- package/dist/agents/agent-executor.js +715 -0
- package/dist/agents/agent-executor.js.map +1 -0
- package/dist/agents/agents.service.d.ts +310 -0
- package/dist/agents/agents.service.js +1249 -0
- package/dist/agents/agents.service.js.map +1 -0
- package/dist/agents/index.d.ts +55 -0
- package/dist/agents/index.js +110 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/memory-manager.d.ts +182 -0
- package/dist/agents/memory-manager.js +383 -0
- package/dist/agents/memory-manager.js.map +1 -0
- package/dist/agents/tool-registry.d.ts +141 -0
- package/dist/agents/tool-registry.js +355 -0
- package/dist/agents/tool-registry.js.map +1 -0
- package/dist/agents/types/agents.types.d.ts +1227 -0
- package/dist/agents/types/agents.types.js +12 -0
- package/dist/agents/types/agents.types.js.map +1 -0
- package/dist/agents/types/index.d.ts +6 -0
- package/dist/agents/types/index.js +23 -0
- package/dist/agents/types/index.js.map +1 -0
- package/dist/agents/vector-store-adapter.d.ts +108 -0
- package/dist/agents/vector-store-adapter.js +213 -0
- package/dist/agents/vector-store-adapter.js.map +1 -0
- package/dist/api/services/appApi.service.d.ts +51 -5
- package/dist/api/services/appApi.service.js +101 -3
- package/dist/api/services/appApi.service.js.map +1 -1
- package/dist/api/services/pricingApi.service.d.ts +10 -0
- package/dist/api/services/pricingApi.service.js +34 -0
- package/dist/api/services/pricingApi.service.js.map +1 -0
- package/dist/api/services/processorApi.service.d.ts +334 -2
- package/dist/api/services/processorApi.service.js +264 -2
- package/dist/api/services/processorApi.service.js.map +1 -1
- package/dist/api/services/productsApi.service.d.ts +108 -1
- package/dist/api/services/productsApi.service.js +150 -3
- package/dist/api/services/productsApi.service.js.map +1 -1
- package/dist/api/services/resilienceApi.service.d.ts +106 -0
- package/dist/api/services/resilienceApi.service.js +224 -0
- package/dist/api/services/resilienceApi.service.js.map +1 -0
- package/dist/api/services/secretsApi.service.d.ts +50 -0
- package/dist/api/services/secretsApi.service.js +124 -0
- package/dist/api/services/secretsApi.service.js.map +1 -0
- package/dist/api/services/workflowApi.service.d.ts +199 -0
- package/dist/api/services/workflowApi.service.js +183 -0
- package/dist/api/services/workflowApi.service.js.map +1 -0
- package/dist/api/services/workspaceApi.service.d.ts +8 -0
- package/dist/api/services/workspaceApi.service.js +20 -0
- package/dist/api/services/workspaceApi.service.js.map +1 -1
- package/dist/api/urls.d.ts +65 -1
- package/dist/api/urls.js +90 -18
- package/dist/api/urls.js.map +1 -1
- package/dist/api/utils/auth.utils.d.ts +1 -3
- package/dist/api/utils/auth.utils.js.map +1 -1
- package/dist/api/utils/cache.utils.d.ts +1 -1
- package/dist/api/utils/cache.utils.js +2 -2
- package/dist/api/utils/cache.utils.js.map +1 -1
- package/dist/api/utils/strings.utils.d.ts +2 -0
- package/dist/api/utils/strings.utils.js +14 -0
- package/dist/api/utils/strings.utils.js.map +1 -1
- package/dist/apps/services/app.service.d.ts +41 -33
- package/dist/apps/services/app.service.js +472 -184
- package/dist/apps/services/app.service.js.map +1 -1
- package/dist/apps/utils/auth-context-manager.d.ts +137 -0
- package/dist/apps/utils/auth-context-manager.js +248 -0
- package/dist/apps/utils/auth-context-manager.js.map +1 -0
- package/dist/apps/utils/credential-manager.d.ts +128 -0
- package/dist/apps/utils/credential-manager.js +199 -0
- package/dist/apps/utils/credential-manager.js.map +1 -0
- package/dist/apps/utils/index.d.ts +10 -0
- package/dist/apps/utils/index.js +54 -0
- package/dist/apps/utils/index.js.map +1 -0
- package/dist/apps/utils/input-helpers.d.ts +67 -0
- package/dist/apps/utils/input-helpers.js +185 -0
- package/dist/apps/utils/input-helpers.js.map +1 -0
- package/dist/apps/utils/input-resolver.d.ts +165 -0
- package/dist/apps/utils/input-resolver.js +477 -0
- package/dist/apps/utils/input-resolver.js.map +1 -0
- package/dist/apps/utils/oauth-manager.d.ts +196 -0
- package/dist/apps/utils/oauth-manager.js +429 -0
- package/dist/apps/utils/oauth-manager.js.map +1 -0
- package/dist/apps/validators/joi-validators/create.appAction.validator.d.ts +1 -2
- package/dist/apps/validators/joi-validators/create.appAction.validator.js +21 -2
- package/dist/apps/validators/joi-validators/create.appAction.validator.js.map +1 -1
- package/dist/apps/validators/joi-validators/update.appAction.validator.js +11 -1
- package/dist/apps/validators/joi-validators/update.appAction.validator.js.map +1 -1
- package/dist/apps/validators/joi-validators/update.appActionResponse.validator.d.ts +1 -1
- package/dist/apps/validators/joi-validators/update.appActionResponse.validator.js +34 -1
- package/dist/apps/validators/joi-validators/update.appActionResponse.validator.js.map +1 -1
- package/dist/bin.d.ts +26 -0
- package/dist/bin.js +28 -0
- package/dist/bin.js.map +1 -0
- package/dist/brokers/brokers.service.d.ts +289 -0
- package/dist/brokers/brokers.service.js +722 -0
- package/dist/brokers/brokers.service.js.map +1 -0
- package/dist/brokers/index.d.ts +46 -0
- package/dist/brokers/index.js +83 -0
- package/dist/brokers/index.js.map +1 -0
- package/dist/brokers/types/index.d.ts +314 -0
- package/dist/brokers/types/index.js +8 -0
- package/dist/brokers/types/index.js.map +1 -0
- package/dist/brokers/utils/broker.util.d.ts +33 -0
- package/dist/brokers/utils/broker.util.js +125 -0
- package/dist/brokers/utils/broker.util.js.map +1 -0
- package/dist/brokers/utils/providers/aws-sqs.service.d.ts +16 -0
- package/dist/brokers/utils/providers/aws-sqs.service.js +71 -0
- package/dist/brokers/utils/providers/aws-sqs.service.js.map +1 -0
- package/dist/brokers/utils/providers/google-pubsub.service.d.ts +16 -0
- package/dist/brokers/utils/providers/google-pubsub.service.js +43 -0
- package/dist/brokers/utils/providers/google-pubsub.service.js.map +1 -0
- package/dist/brokers/utils/providers/index.d.ts +6 -0
- package/dist/brokers/utils/providers/index.js +16 -0
- package/dist/brokers/utils/providers/index.js.map +1 -0
- package/dist/brokers/utils/providers/kafka.service.d.ts +23 -0
- package/dist/brokers/utils/providers/kafka.service.js +131 -0
- package/dist/brokers/utils/providers/kafka.service.js.map +1 -0
- package/dist/brokers/utils/providers/nats.service.d.ts +18 -0
- package/dist/brokers/utils/providers/nats.service.js +63 -0
- package/dist/brokers/utils/providers/nats.service.js.map +1 -0
- package/dist/brokers/utils/providers/rabbitmq.service.d.ts +15 -0
- package/dist/brokers/utils/providers/rabbitmq.service.js +151 -0
- package/dist/brokers/utils/providers/rabbitmq.service.js.map +1 -0
- package/dist/brokers/utils/providers/redis.service.d.ts +18 -0
- package/dist/brokers/utils/providers/redis.service.js +93 -0
- package/dist/brokers/utils/providers/redis.service.js.map +1 -0
- package/dist/cache/cache.manager.d.ts +159 -0
- package/dist/cache/cache.manager.js +265 -0
- package/dist/cache/cache.manager.js.map +1 -0
- package/dist/cache/cache.service.d.ts +186 -0
- package/dist/cache/cache.service.js +437 -0
- package/dist/cache/cache.service.js.map +1 -0
- package/dist/cache/index.d.ts +52 -0
- package/dist/cache/index.js +79 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/types/index.d.ts +106 -0
- package/dist/cache/types/index.js +6 -0
- package/dist/cache/types/index.js.map +1 -0
- package/dist/clients/pricing.client.d.ts +3 -0
- package/dist/clients/pricing.client.js +33 -0
- package/dist/clients/pricing.client.js.map +1 -0
- package/dist/database/actions/action-manager.d.ts +170 -0
- package/dist/database/actions/action-manager.js +465 -0
- package/dist/database/actions/action-manager.js.map +1 -0
- package/dist/database/actions/index.d.ts +6 -0
- package/dist/database/actions/index.js +13 -0
- package/dist/database/actions/index.js.map +1 -0
- package/dist/database/adapters/adapter.factory.d.ts +62 -0
- package/dist/database/adapters/adapter.factory.js +97 -0
- package/dist/database/adapters/adapter.factory.js.map +1 -0
- package/dist/database/adapters/base.adapter.d.ts +393 -0
- package/dist/database/adapters/base.adapter.js +150 -0
- package/dist/database/adapters/base.adapter.js.map +1 -0
- package/dist/database/adapters/cassandra.adapter.d.ts +91 -0
- package/dist/database/adapters/cassandra.adapter.js +1075 -0
- package/dist/database/adapters/cassandra.adapter.js.map +1 -0
- package/dist/database/adapters/dynamodb.adapter.d.ts +109 -0
- package/dist/database/adapters/dynamodb.adapter.js +1534 -0
- package/dist/database/adapters/dynamodb.adapter.js.map +1 -0
- package/dist/database/adapters/index.d.ts +11 -0
- package/dist/database/adapters/index.js +27 -0
- package/dist/database/adapters/index.js.map +1 -0
- package/dist/database/adapters/mariadb.adapter.d.ts +100 -0
- package/dist/database/adapters/mariadb.adapter.js +247 -0
- package/dist/database/adapters/mariadb.adapter.js.map +1 -0
- package/dist/database/adapters/mongodb.adapter.d.ts +120 -0
- package/dist/database/adapters/mongodb.adapter.js +1253 -0
- package/dist/database/adapters/mongodb.adapter.js.map +1 -0
- package/dist/database/adapters/mysql.adapter.d.ts +85 -0
- package/dist/database/adapters/mysql.adapter.js +1313 -0
- package/dist/database/adapters/mysql.adapter.js.map +1 -0
- package/dist/database/adapters/postgresql.adapter.d.ts +88 -0
- package/dist/database/adapters/postgresql.adapter.js +1434 -0
- package/dist/database/adapters/postgresql.adapter.js.map +1 -0
- package/dist/database/databases.service.d.ts +1388 -0
- package/dist/database/databases.service.js +2821 -0
- package/dist/database/databases.service.js.map +1 -0
- package/dist/database/index.d.ts +46 -0
- package/dist/database/index.js +109 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/migrations/index.d.ts +6 -0
- package/dist/database/migrations/index.js +12 -0
- package/dist/database/migrations/index.js.map +1 -0
- package/dist/database/migrations/migration-engine.d.ts +132 -0
- package/dist/database/migrations/migration-engine.js +1356 -0
- package/dist/database/migrations/migration-engine.js.map +1 -0
- package/dist/database/operators/aggregation-builder.d.ts +67 -0
- package/dist/database/operators/aggregation-builder.js +841 -0
- package/dist/database/operators/aggregation-builder.js.map +1 -0
- package/dist/database/operators/index.d.ts +7 -0
- package/dist/database/operators/index.js +15 -0
- package/dist/database/operators/index.js.map +1 -0
- package/dist/database/operators/query-builder.d.ts +59 -0
- package/dist/database/operators/query-builder.js +397 -0
- package/dist/database/operators/query-builder.js.map +1 -0
- package/dist/database/presave/decrypt.d.ts +25 -0
- package/dist/database/presave/decrypt.js +146 -0
- package/dist/database/presave/decrypt.js.map +1 -0
- package/dist/database/presave/index.d.ts +9 -0
- package/dist/database/presave/index.js +18 -0
- package/dist/database/presave/index.js.map +1 -0
- package/dist/database/presave/presave-processor.d.ts +148 -0
- package/dist/database/presave/presave-processor.js +702 -0
- package/dist/database/presave/presave-processor.js.map +1 -0
- package/dist/database/schema/index.d.ts +7 -0
- package/dist/database/schema/index.js +13 -0
- package/dist/database/schema/index.js.map +1 -0
- package/dist/database/schema/schema-manager.d.ts +258 -0
- package/dist/database/schema/schema-manager.js +637 -0
- package/dist/database/schema/schema-manager.js.map +1 -0
- package/dist/database/transactions/index.d.ts +6 -0
- package/dist/database/transactions/index.js +13 -0
- package/dist/database/transactions/index.js.map +1 -0
- package/dist/database/transactions/transaction-manager.d.ts +113 -0
- package/dist/database/transactions/transaction-manager.js +344 -0
- package/dist/database/transactions/transaction-manager.js.map +1 -0
- package/dist/database/triggers/index.d.ts +7 -0
- package/dist/database/triggers/index.js +14 -0
- package/dist/database/triggers/index.js.map +1 -0
- package/dist/database/triggers/trigger-processor.d.ts +239 -0
- package/dist/database/triggers/trigger-processor.js +1034 -0
- package/dist/database/triggers/trigger-processor.js.map +1 -0
- package/dist/database/types/action.interface.d.ts +148 -0
- package/dist/database/types/action.interface.js +6 -0
- package/dist/database/types/action.interface.js.map +1 -0
- package/dist/database/types/aggregation.interface.d.ts +185 -0
- package/dist/database/types/aggregation.interface.js +6 -0
- package/dist/database/types/aggregation.interface.js.map +1 -0
- package/dist/database/types/connection.interface.d.ts +137 -0
- package/dist/database/types/connection.interface.js +6 -0
- package/dist/database/types/connection.interface.js.map +1 -0
- package/dist/database/types/enums.d.ts +195 -0
- package/dist/database/types/enums.js +244 -0
- package/dist/database/types/enums.js.map +1 -0
- package/dist/database/types/index.d.ts +14 -0
- package/dist/database/types/index.js +31 -0
- package/dist/database/types/index.js.map +1 -0
- package/dist/database/types/migration.interface.d.ts +686 -0
- package/dist/database/types/migration.interface.js +9 -0
- package/dist/database/types/migration.interface.js.map +1 -0
- package/dist/database/types/presave.interface.d.ts +292 -0
- package/dist/database/types/presave.interface.js +60 -0
- package/dist/database/types/presave.interface.js.map +1 -0
- package/dist/database/types/query.interface.d.ts +205 -0
- package/dist/database/types/query.interface.js +6 -0
- package/dist/database/types/query.interface.js.map +1 -0
- package/dist/database/types/schema.interface.d.ts +398 -0
- package/dist/database/types/schema.interface.js +6 -0
- package/dist/database/types/schema.interface.js.map +1 -0
- package/dist/database/types/transaction.interface.d.ts +84 -0
- package/dist/database/types/transaction.interface.js +6 -0
- package/dist/database/types/transaction.interface.js.map +1 -0
- package/dist/database/types/trigger.interface.d.ts +612 -0
- package/dist/database/types/trigger.interface.js +121 -0
- package/dist/database/types/trigger.interface.js.map +1 -0
- package/dist/database/types/write.interface.d.ts +216 -0
- package/dist/database/types/write.interface.js +6 -0
- package/dist/database/types/write.interface.js.map +1 -0
- package/dist/database/utils/database-error.d.ts +96 -0
- package/dist/database/utils/database-error.js +221 -0
- package/dist/database/utils/database-error.js.map +1 -0
- package/dist/database/utils/index.d.ts +6 -0
- package/dist/database/utils/index.js +11 -0
- package/dist/database/utils/index.js.map +1 -0
- package/dist/graph/adapters/adapter.factory.d.ts +47 -0
- package/dist/graph/adapters/adapter.factory.js +77 -0
- package/dist/graph/adapters/adapter.factory.js.map +1 -0
- package/dist/graph/adapters/arangodb.adapter.d.ts +86 -0
- package/dist/graph/adapters/arangodb.adapter.js +1522 -0
- package/dist/graph/adapters/arangodb.adapter.js.map +1 -0
- package/dist/graph/adapters/base.adapter.d.ts +245 -0
- package/dist/graph/adapters/base.adapter.js +64 -0
- package/dist/graph/adapters/base.adapter.js.map +1 -0
- package/dist/graph/adapters/index.d.ts +11 -0
- package/dist/graph/adapters/index.js +21 -0
- package/dist/graph/adapters/index.js.map +1 -0
- package/dist/graph/adapters/memgraph.adapter.d.ts +110 -0
- package/dist/graph/adapters/memgraph.adapter.js +1345 -0
- package/dist/graph/adapters/memgraph.adapter.js.map +1 -0
- package/dist/graph/adapters/neo4j.adapter.d.ts +81 -0
- package/dist/graph/adapters/neo4j.adapter.js +1198 -0
- package/dist/graph/adapters/neo4j.adapter.js.map +1 -0
- package/dist/graph/adapters/neptune.adapter.d.ts +82 -0
- package/dist/graph/adapters/neptune.adapter.js +1313 -0
- package/dist/graph/adapters/neptune.adapter.js.map +1 -0
- package/dist/graph/graphs.service.d.ts +546 -0
- package/dist/graph/graphs.service.js +1893 -0
- package/dist/graph/graphs.service.js.map +1 -0
- package/dist/graph/index.d.ts +57 -0
- package/dist/graph/index.js +77 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/transactions/index.d.ts +4 -0
- package/dist/graph/transactions/index.js +9 -0
- package/dist/graph/transactions/index.js.map +1 -0
- package/dist/graph/transactions/transaction-manager.d.ts +61 -0
- package/dist/graph/transactions/transaction-manager.js +126 -0
- package/dist/graph/transactions/transaction-manager.js.map +1 -0
- package/dist/graph/types/connection.interface.d.ts +149 -0
- package/dist/graph/types/connection.interface.js +9 -0
- package/dist/graph/types/connection.interface.js.map +1 -0
- package/dist/graph/types/enums.d.ts +101 -0
- package/dist/graph/types/enums.js +114 -0
- package/dist/graph/types/enums.js.map +1 -0
- package/dist/graph/types/index.d.ts +13 -0
- package/dist/graph/types/index.js +20 -0
- package/dist/graph/types/index.js.map +1 -0
- package/dist/graph/types/node.interface.d.ts +248 -0
- package/dist/graph/types/node.interface.js +9 -0
- package/dist/graph/types/node.interface.js.map +1 -0
- package/dist/graph/types/query.interface.d.ts +175 -0
- package/dist/graph/types/query.interface.js +9 -0
- package/dist/graph/types/query.interface.js.map +1 -0
- package/dist/graph/types/relationship.interface.d.ts +207 -0
- package/dist/graph/types/relationship.interface.js +9 -0
- package/dist/graph/types/relationship.interface.js.map +1 -0
- package/dist/graph/types/schema.interface.d.ts +295 -0
- package/dist/graph/types/schema.interface.js +9 -0
- package/dist/graph/types/schema.interface.js.map +1 -0
- package/dist/graph/types/transaction.interface.d.ts +55 -0
- package/dist/graph/types/transaction.interface.js +9 -0
- package/dist/graph/types/transaction.interface.js.map +1 -0
- package/dist/graph/types/traversal.interface.d.ts +181 -0
- package/dist/graph/types/traversal.interface.js +9 -0
- package/dist/graph/types/traversal.interface.js.map +1 -0
- package/dist/graph/utils/graph-error.d.ts +71 -0
- package/dist/graph/utils/graph-error.js +142 -0
- package/dist/graph/utils/graph-error.js.map +1 -0
- package/dist/graph/utils/index.d.ts +4 -0
- package/dist/graph/utils/index.js +9 -0
- package/dist/graph/utils/index.js.map +1 -0
- package/dist/imports/imports.service.d.ts +3 -3
- package/dist/imports/imports.service.js +8 -7
- package/dist/imports/imports.service.js.map +1 -1
- package/dist/imports/imports.types.d.ts +8 -0
- package/dist/imports/repos/openApi.repo.d.ts +1 -1
- package/dist/imports/repos/openApi.repo.js +414 -47
- package/dist/imports/repos/openApi.repo.js.map +1 -1
- package/dist/imports/repos/postmanV21.repo.d.ts +1 -1
- package/dist/imports/repos/postmanV21.repo.js +126 -83
- package/dist/imports/repos/postmanV21.repo.js.map +1 -1
- package/dist/index.d.ts +3241 -285
- package/dist/index.js +4711 -687
- package/dist/index.js.map +1 -1
- package/dist/init.interface.d.ts +407 -0
- package/dist/init.interface.js +3 -0
- package/dist/init.interface.js.map +1 -0
- package/dist/inputs/inputs.service.d.ts +1 -1
- package/dist/inputs/inputs.service.js +2 -2
- package/dist/inputs/inputs.service.js.map +1 -1
- package/dist/inputs/utils/inputs.utils.create.js +1 -1
- package/dist/inputs/utils/inputs.utils.create.js.map +1 -1
- package/dist/jobs/index.d.ts +38 -0
- package/dist/jobs/index.js +50 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/jobs.service.d.ts +154 -0
- package/dist/jobs/jobs.service.js +491 -0
- package/dist/jobs/jobs.service.js.map +1 -0
- package/dist/jobs/jobs.state.d.ts +113 -0
- package/dist/jobs/jobs.state.js +447 -0
- package/dist/jobs/jobs.state.js.map +1 -0
- package/dist/jobs/types.d.ts +449 -0
- package/dist/jobs/types.js +74 -0
- package/dist/jobs/types.js.map +1 -0
- package/dist/logs/logs.types.d.ts +16 -1
- package/dist/logs/logs.types.js +5 -0
- package/dist/logs/logs.types.js.map +1 -1
- package/dist/models/index.d.ts +6 -0
- package/dist/models/index.js +11 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/models.service.d.ts +137 -0
- package/dist/models/models.service.js +195 -0
- package/dist/models/models.service.js.map +1 -0
- package/dist/notifications/index.d.ts +13 -0
- package/dist/notifications/index.js +26 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/notifications/notifications.service.d.ts +257 -0
- package/dist/notifications/notifications.service.js +656 -0
- package/dist/notifications/notifications.service.js.map +1 -0
- package/dist/notifications/types/index.d.ts +4 -0
- package/dist/notifications/types/index.js +21 -0
- package/dist/notifications/types/index.js.map +1 -0
- package/dist/notifications/types/notifications.types.d.ts +400 -0
- package/dist/notifications/types/notifications.types.js +49 -0
- package/dist/notifications/types/notifications.types.js.map +1 -0
- package/dist/parsers/index.d.ts +3 -0
- package/dist/parsers/index.js +27 -0
- package/dist/parsers/index.js.map +1 -0
- package/dist/parsers/pipelines/postman.pipelines.d.ts +15 -0
- package/dist/parsers/pipelines/postman.pipelines.js +103 -0
- package/dist/parsers/pipelines/postman.pipelines.js.map +1 -0
- package/dist/parsers/types/postman.types.d.ts +200 -0
- package/dist/parsers/types/postman.types.js +3 -0
- package/dist/parsers/types/postman.types.js.map +1 -0
- package/dist/parsers/utils/postman.utils.d.ts +12 -0
- package/dist/parsers/utils/postman.utils.js +116 -0
- package/dist/parsers/utils/postman.utils.js.map +1 -0
- package/dist/parsers/validators/postman-auth.validators.d.ts +10 -0
- package/dist/parsers/validators/postman-auth.validators.js +127 -0
- package/dist/parsers/validators/postman-auth.validators.js.map +1 -0
- package/dist/parsers/validators/postman-request.validators.d.ts +13 -0
- package/dist/parsers/validators/postman-request.validators.js +139 -0
- package/dist/parsers/validators/postman-request.validators.js.map +1 -0
- package/dist/parsers/validators/postman-response.validators.d.ts +13 -0
- package/dist/parsers/validators/postman-response.validators.js +150 -0
- package/dist/parsers/validators/postman-response.validators.js.map +1 -0
- package/dist/parsers/validators/postman-variable.validators.d.ts +14 -0
- package/dist/parsers/validators/postman-variable.validators.js +163 -0
- package/dist/parsers/validators/postman-variable.validators.js.map +1 -0
- package/dist/pricing/pricing.repo.js +1 -0
- package/dist/pricing/pricing.repo.js.map +1 -0
- package/dist/pricing/pricing.service.d.ts +24 -0
- package/dist/pricing/pricing.service.js +51 -0
- package/dist/pricing/pricing.service.js.map +1 -0
- package/dist/pricing/pricing.types.d.ts +76 -0
- package/dist/pricing/pricing.types.js +21 -0
- package/dist/pricing/pricing.types.js.map +1 -0
- package/dist/pricing/utils/string.utils.d.ts +1 -0
- package/dist/pricing/utils/string.utils.js +9 -0
- package/dist/pricing/utils/string.utils.js.map +1 -0
- package/dist/processor/services/processor.service.d.ts +120 -73
- package/dist/processor/services/processor.service.js +1705 -1294
- package/dist/processor/services/processor.service.js.map +1 -1
- package/dist/processor/services/request.service.d.ts +36 -0
- package/dist/processor/services/request.service.js +304 -0
- package/dist/processor/services/request.service.js.map +1 -0
- package/dist/processor/types/request.types.d.ts +14 -0
- package/dist/processor/types/request.types.js +3 -0
- package/dist/processor/types/request.types.js.map +1 -0
- package/dist/processor/utils/processor.utils.d.ts +3 -0
- package/dist/processor/utils/processor.utils.js +87 -21
- package/dist/processor/utils/processor.utils.js.map +1 -1
- package/dist/processor/utils/request.utils.d.ts +20 -0
- package/dist/processor/utils/request.utils.js +113 -0
- package/dist/processor/utils/request.utils.js.map +1 -0
- package/dist/products/services/products.service.d.ts +330 -77
- package/dist/products/services/products.service.js +2586 -397
- package/dist/products/services/products.service.js.map +1 -1
- package/dist/products/utils/string.utils.d.ts +1 -1
- package/dist/products/utils/string.utils.js +14 -2
- package/dist/products/utils/string.utils.js.map +1 -1
- package/dist/products/validators/index.d.ts +7 -1
- package/dist/products/validators/index.js +16 -1
- package/dist/products/validators/index.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productAgent.validator.d.ts +3 -0
- package/dist/products/validators/joi-validators/create.productAgent.validator.js +266 -0
- package/dist/products/validators/joi-validators/create.productAgent.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/create.productDatabase.validator.js +5 -0
- package/dist/products/validators/joi-validators/create.productDatabase.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productEnv.validator.js +1 -0
- package/dist/products/validators/joi-validators/create.productEnv.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productGraph.validator.js +89 -0
- package/dist/products/validators/joi-validators/create.productGraph.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/create.productHealthcheck.validator.d.ts +4 -0
- package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js +58 -0
- package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js +81 -25
- package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productModel.validator.d.ts +3 -0
- package/dist/products/validators/joi-validators/create.productModel.validator.js +132 -0
- package/dist/products/validators/joi-validators/create.productModel.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/create.productNotification.validator.js +133 -45
- package/dist/products/validators/joi-validators/create.productNotification.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productStorage.validator.js +77 -18
- package/dist/products/validators/joi-validators/create.productStorage.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productVector.validator.d.ts +3 -0
- package/dist/products/validators/joi-validators/create.productVector.validator.js +135 -0
- package/dist/products/validators/joi-validators/create.productVector.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/update.dataValue.validator.js +1 -0
- package/dist/products/validators/joi-validators/update.dataValue.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/update.productDatabase.validator.js +5 -0
- package/dist/products/validators/joi-validators/update.productDatabase.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/update.productEnv.validator.js +3 -0
- package/dist/products/validators/joi-validators/update.productEnv.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/update.productGraph.validator.js +88 -0
- package/dist/products/validators/joi-validators/update.productGraph.validator.js.map +1 -0
- package/dist/resilience/fallback.service.d.ts +140 -0
- package/dist/resilience/fallback.service.js +764 -0
- package/dist/resilience/fallback.service.js.map +1 -0
- package/dist/resilience/healthcheck.service.d.ts +159 -0
- package/dist/resilience/healthcheck.service.js +943 -0
- package/dist/resilience/healthcheck.service.js.map +1 -0
- package/dist/resilience/index.d.ts +104 -0
- package/dist/resilience/index.js +140 -0
- package/dist/resilience/index.js.map +1 -0
- package/dist/resilience/quota.service.d.ts +82 -0
- package/dist/resilience/quota.service.js +516 -0
- package/dist/resilience/quota.service.js.map +1 -0
- package/dist/resilience/resilience.service.d.ts +98 -0
- package/dist/resilience/resilience.service.js +560 -0
- package/dist/resilience/resilience.service.js.map +1 -0
- package/dist/resilience/types/index.d.ts +513 -0
- package/dist/resilience/types/index.js +29 -0
- package/dist/resilience/types/index.js.map +1 -0
- package/dist/secrets/index.d.ts +10 -0
- package/dist/secrets/index.js +33 -0
- package/dist/secrets/index.js.map +1 -0
- package/dist/secrets/secrets.resolver.d.ts +52 -0
- package/dist/secrets/secrets.resolver.js +233 -0
- package/dist/secrets/secrets.resolver.js.map +1 -0
- package/dist/secrets/secrets.service.d.ts +93 -0
- package/dist/secrets/secrets.service.js +258 -0
- package/dist/secrets/secrets.service.js.map +1 -0
- package/dist/secrets/secrets.types.d.ts +188 -0
- package/dist/secrets/secrets.types.js +87 -0
- package/dist/secrets/secrets.types.js.map +1 -0
- package/dist/sessions/index.d.ts +50 -0
- package/dist/sessions/index.js +93 -0
- package/dist/sessions/index.js.map +1 -0
- package/dist/sessions/sessions.helper.d.ts +68 -0
- package/dist/sessions/sessions.helper.js +116 -0
- package/dist/sessions/sessions.helper.js.map +1 -0
- package/dist/sessions/sessions.resolver.d.ts +150 -0
- package/dist/sessions/sessions.resolver.js +356 -0
- package/dist/sessions/sessions.resolver.js.map +1 -0
- package/dist/sessions/sessions.service.d.ts +170 -0
- package/dist/sessions/sessions.service.js +736 -0
- package/dist/sessions/sessions.service.js.map +1 -0
- package/dist/sessions/types/index.d.ts +290 -0
- package/dist/sessions/types/index.js +6 -0
- package/dist/sessions/types/index.js.map +1 -0
- package/dist/storage/index.d.ts +66 -0
- package/dist/storage/index.js +98 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/storage.service.d.ts +151 -0
- package/dist/storage/storage.service.js +522 -0
- package/dist/storage/storage.service.js.map +1 -0
- package/dist/storage/types/index.d.ts +207 -0
- package/dist/storage/types/index.js +6 -0
- package/dist/storage/types/index.js.map +1 -0
- package/dist/storage/utils/storage.util.d.ts +51 -0
- package/dist/storage/utils/storage.util.js +402 -0
- package/dist/storage/utils/storage.util.js.map +1 -0
- package/dist/test/index.d.ts +3 -0
- package/dist/test/index.js +11 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/test.appBuilder.d.ts +0 -1
- package/dist/test/test.appBuilder.js +0 -15
- package/dist/test/test.appBuilder.js.map +1 -1
- package/dist/test/test.broker.kafka.js +172 -0
- package/dist/test/test.broker.kafka.js.map +1 -0
- package/dist/test/test.broker.nats.js +193 -0
- package/dist/test/test.broker.nats.js.map +1 -0
- package/dist/test/test.broker.pubsub.js +171 -0
- package/dist/test/test.broker.pubsub.js.map +1 -0
- package/dist/test/test.broker.rabbitmq.js +164 -0
- package/dist/test/test.broker.rabbitmq.js.map +1 -0
- package/dist/test/test.broker.redis.js +168 -0
- package/dist/test/test.broker.redis.js.map +1 -0
- package/dist/test/test.broker.sqs.d.ts +1 -0
- package/dist/test/test.broker.sqs.js +158 -0
- package/dist/test/test.broker.sqs.js.map +1 -0
- package/dist/test/test.caches.d.ts +1 -0
- package/dist/test/test.caches.js +231 -0
- package/dist/test/test.caches.js.map +1 -0
- package/dist/test/test.database.d.ts +1 -0
- package/dist/test/test.database.dynamo.d.ts +1 -0
- package/dist/test/test.database.dynamo.js +265 -0
- package/dist/test/test.database.dynamo.js.map +1 -0
- package/dist/test/test.database.js +140 -0
- package/dist/test/test.database.js.map +1 -0
- package/dist/test/test.database.mongo.d.ts +1 -0
- package/dist/test/test.database.mongo.js +371 -0
- package/dist/test/test.database.mongo.js.map +1 -0
- package/dist/test/test.database.mysql.d.ts +1 -0
- package/dist/test/test.database.mysql.js +415 -0
- package/dist/test/test.database.mysql.js.map +1 -0
- package/dist/test/test.database.postgres.d.ts +1 -0
- package/dist/test/test.database.postgres.js +412 -0
- package/dist/test/test.database.postgres.js.map +1 -0
- package/dist/test/test.email.brevo.d.ts +1 -0
- package/dist/test/test.email.brevo.js +326 -0
- package/dist/test/test.email.brevo.js.map +1 -0
- package/dist/test/test.email.mailgun.d.ts +1 -0
- package/dist/test/test.email.mailgun.js +352 -0
- package/dist/test/test.email.mailgun.js.map +1 -0
- package/dist/test/test.email.postmark.d.ts +1 -0
- package/dist/test/test.email.postmark.js +316 -0
- package/dist/test/test.email.postmark.js.map +1 -0
- package/dist/test/test.email.sendgrid.d.ts +1 -0
- package/dist/test/test.email.sendgrid.js +365 -0
- package/dist/test/test.email.sendgrid.js.map +1 -0
- package/dist/test/test.email.smtp.d.ts +1 -0
- package/dist/test/test.email.smtp.js +323 -0
- package/dist/test/test.email.smtp.js.map +1 -0
- package/dist/test/test.graph.arangodb.d.ts +1 -0
- package/dist/test/test.graph.arangodb.js +358 -0
- package/dist/test/test.graph.arangodb.js.map +1 -0
- package/dist/test/test.graph.memgraph.d.ts +1 -0
- package/dist/test/test.graph.memgraph.js +320 -0
- package/dist/test/test.graph.memgraph.js.map +1 -0
- package/dist/test/test.graph.neo4j.d.ts +1 -0
- package/dist/test/test.graph.neo4j.js +218 -0
- package/dist/test/test.graph.neo4j.js.map +1 -0
- package/dist/test/test.graph.neptune.d.ts +1 -0
- package/dist/test/test.graph.neptune.js +331 -0
- package/dist/test/test.graph.neptune.js.map +1 -0
- package/dist/test/test.health.js +1 -0
- package/dist/test/test.health.js.map +1 -0
- package/dist/test/test.import.d.ts +0 -1
- package/dist/test/test.import.js +0 -1459
- package/dist/test/test.import.js.map +1 -1
- package/dist/test/test.import.openapi.d.ts +0 -1
- package/dist/test/test.import.openapi.js +0 -75
- package/dist/test/test.import.openapi.js.map +1 -1
- package/dist/test/test.imports.js +14 -55
- package/dist/test/test.imports.js.map +1 -1
- package/dist/test/test.logs.d.ts +0 -1
- package/dist/test/test.logs.js +0 -17
- package/dist/test/test.logs.js.map +1 -1
- package/dist/test/test.notifications.d.ts +1 -0
- package/dist/test/test.notifications.js +198 -0
- package/dist/test/test.notifications.js.map +1 -0
- package/dist/test/test.notifiers.js +1 -0
- package/dist/test/test.notifiers.js.map +1 -0
- package/dist/test/test.processor.d.ts +0 -1
- package/dist/test/test.processor.js +0 -122
- package/dist/test/test.processor.js.map +1 -1
- package/dist/test/test.productBuilder.d.ts +0 -1
- package/dist/test/test.productBuilder.js +0 -660
- package/dist/test/test.productBuilder.js.map +1 -1
- package/dist/test/test.products.js +1 -0
- package/dist/test/test.products.js.map +1 -0
- package/dist/test/test.push.expo.d.ts +1 -0
- package/dist/test/test.push.expo.js +442 -0
- package/dist/test/test.push.expo.js.map +1 -0
- package/dist/test/test.push.firebase.d.ts +1 -0
- package/dist/test/test.push.firebase.js +409 -0
- package/dist/test/test.push.firebase.js.map +1 -0
- package/dist/test/test.session.d.ts +1 -0
- package/dist/test/test.session.js +299 -0
- package/dist/test/test.session.js.map +1 -0
- package/dist/test/test.sms.nexmo.d.ts +1 -0
- package/dist/test/test.sms.nexmo.js +278 -0
- package/dist/test/test.sms.nexmo.js.map +1 -0
- package/dist/test/test.sms.twilio.d.ts +1 -0
- package/dist/test/test.sms.twilio.js +275 -0
- package/dist/test/test.sms.twilio.js.map +1 -0
- package/dist/test/test.storage.d.ts +1 -0
- package/dist/test/test.storage.js +202 -0
- package/dist/test/test.storage.js.map +1 -0
- package/dist/test/test.triggers.d.ts +1 -0
- package/dist/test/test.triggers.js +314 -0
- package/dist/test/test.triggers.js.map +1 -0
- package/dist/test/test.vector.pinecone.d.ts +1 -0
- package/dist/test/test.vector.pinecone.js +238 -0
- package/dist/test/test.vector.pinecone.js.map +1 -0
- package/dist/test/test.vector.qdrant.d.ts +1 -0
- package/dist/test/test.vector.qdrant.js +307 -0
- package/dist/test/test.vector.qdrant.js.map +1 -0
- package/dist/test/test.vector.weaviate.d.ts +1 -0
- package/dist/test/test.vector.weaviate.js +325 -0
- package/dist/test/test.vector.weaviate.js.map +1 -0
- package/dist/types/appBuilder.types.d.ts +10 -13
- package/dist/types/enums.d.ts +11 -1
- package/dist/types/enums.js +10 -0
- package/dist/types/enums.js.map +1 -1
- package/dist/types/index.types.d.ts +6 -4
- package/dist/types/index.types.js +0 -1
- package/dist/types/index.types.js.map +1 -1
- package/dist/types/pricing.types.d.ts +4 -0
- package/dist/types/pricing.types.js +3 -0
- package/dist/types/pricing.types.js.map +1 -0
- package/dist/types/processor.types.d.ts +245 -20
- package/dist/types/processor.types.js +9 -1
- package/dist/types/processor.types.js.map +1 -1
- package/dist/types/productsBuilder.types.d.ts +906 -24
- package/dist/types/productsBuilder.types.js +173 -2
- package/dist/types/productsBuilder.types.js.map +1 -1
- package/dist/types/request-tracker.interface.js +1 -0
- package/dist/types/request-tracker.interface.js.map +1 -0
- package/dist/types/requests.types.d.ts +2 -0
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.js +5 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +24 -52
- package/dist/utils/index.js.map +1 -1
- package/dist/vector/adapters/base.adapter.d.ts +152 -0
- package/dist/vector/adapters/base.adapter.js +137 -0
- package/dist/vector/adapters/base.adapter.js.map +1 -0
- package/dist/vector/adapters/index.d.ts +10 -0
- package/dist/vector/adapters/index.js +19 -0
- package/dist/vector/adapters/index.js.map +1 -0
- package/dist/vector/adapters/memory.adapter.d.ts +85 -0
- package/dist/vector/adapters/memory.adapter.js +505 -0
- package/dist/vector/adapters/memory.adapter.js.map +1 -0
- package/dist/vector/adapters/pinecone.adapter.d.ts +52 -0
- package/dist/vector/adapters/pinecone.adapter.js +400 -0
- package/dist/vector/adapters/pinecone.adapter.js.map +1 -0
- package/dist/vector/adapters/qdrant.adapter.d.ts +56 -0
- package/dist/vector/adapters/qdrant.adapter.js +392 -0
- package/dist/vector/adapters/qdrant.adapter.js.map +1 -0
- package/dist/vector/adapters/weaviate.adapter.d.ts +64 -0
- package/dist/vector/adapters/weaviate.adapter.js +478 -0
- package/dist/vector/adapters/weaviate.adapter.js.map +1 -0
- package/dist/vector/index.d.ts +47 -0
- package/dist/vector/index.js +72 -0
- package/dist/vector/index.js.map +1 -0
- package/dist/vector/types/connection.interface.d.ts +151 -0
- package/dist/vector/types/connection.interface.js +8 -0
- package/dist/vector/types/connection.interface.js.map +1 -0
- package/dist/vector/types/embedding.interface.d.ts +144 -0
- package/dist/vector/types/embedding.interface.js +8 -0
- package/dist/vector/types/embedding.interface.js.map +1 -0
- package/dist/vector/types/enums.d.ts +104 -0
- package/dist/vector/types/enums.js +113 -0
- package/dist/vector/types/enums.js.map +1 -0
- package/dist/vector/types/index.d.ts +9 -0
- package/dist/vector/types/index.js +16 -0
- package/dist/vector/types/index.js.map +1 -0
- package/dist/vector/types/vector.interface.d.ts +315 -0
- package/dist/vector/types/vector.interface.js +8 -0
- package/dist/vector/types/vector.interface.js.map +1 -0
- package/dist/vector/utils/index.d.ts +6 -0
- package/dist/vector/utils/index.js +11 -0
- package/dist/vector/utils/index.js.map +1 -0
- package/dist/vector/utils/vector-error.d.ts +69 -0
- package/dist/vector/utils/vector-error.js +116 -0
- package/dist/vector/utils/vector-error.js.map +1 -0
- package/dist/vector/vector-database.service.d.ts +408 -0
- package/dist/vector/vector-database.service.js +545 -0
- package/dist/vector/vector-database.service.js.map +1 -0
- package/dist/vector/vector.service.d.ts +245 -0
- package/dist/vector/vector.service.js +384 -0
- package/dist/vector/vector.service.js.map +1 -0
- package/dist/workflows/index.d.ts +30 -0
- package/dist/workflows/index.js +64 -0
- package/dist/workflows/index.js.map +1 -0
- package/dist/workflows/types/index.d.ts +6 -0
- package/dist/workflows/types/index.js +23 -0
- package/dist/workflows/types/index.js.map +1 -0
- package/dist/workflows/types/workflows.types.d.ts +1035 -0
- package/dist/workflows/types/workflows.types.js +13 -0
- package/dist/workflows/types/workflows.types.js.map +1 -0
- package/dist/workflows/workflow-builder.d.ts +70 -0
- package/dist/workflows/workflow-builder.js +338 -0
- package/dist/workflows/workflow-builder.js.map +1 -0
- package/dist/workflows/workflow-executor.d.ts +208 -0
- package/dist/workflows/workflow-executor.js +1194 -0
- package/dist/workflows/workflow-executor.js.map +1 -0
- package/dist/workflows/workflows.service.d.ts +404 -0
- package/dist/workflows/workflows.service.js +1620 -0
- package/dist/workflows/workflows.service.js.map +1 -0
- package/package.json +54 -11
- package/dist/actions/actions.repo.js +0 -13
- package/dist/actions/actions.repo.js.map +0 -1
- package/dist/actions/actions.service.js +0 -24
- package/dist/actions/actions.service.js.map +0 -1
- package/dist/actions/utils/actions.util.read.js +0 -427
- package/dist/actions/utils/actions.util.read.js.map +0 -1
- package/dist/api/services/integrationsApi.service.d.ts +0 -18
- package/dist/api/services/integrationsApi.service.js +0 -80
- package/dist/api/services/integrationsApi.service.js.map +0 -1
- package/dist/appBuilder/services/app.service.d.ts +0 -111
- package/dist/appBuilder/services/app.service.js +0 -737
- package/dist/appBuilder/services/app.service.js.map +0 -1
- package/dist/appBuilder/services/appBuilder.service.d.ts +0 -111
- package/dist/appBuilder/services/appBuilder.service.js +0 -662
- package/dist/appBuilder/services/appBuilder.service.js.map +0 -1
- package/dist/appBuilder/utils/objects.utils.d.ts +0 -3
- package/dist/appBuilder/utils/objects.utils.js +0 -9
- package/dist/appBuilder/utils/objects.utils.js.map +0 -1
- package/dist/appBuilder/utils/string.utils.d.ts +0 -2
- package/dist/appBuilder/utils/string.utils.js +0 -57
- package/dist/appBuilder/utils/string.utils.js.map +0 -1
- package/dist/appBuilder/validators/index.d.ts +0 -19
- package/dist/appBuilder/validators/index.js +0 -40
- package/dist/appBuilder/validators/index.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.app.validator.js +0 -10
- package/dist/appBuilder/validators/joi-validators/create.app.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appAction.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appAction.validator.js +0 -20
- package/dist/appBuilder/validators/joi-validators/create.appAction.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appActionResponse.validator.d.ts +0 -7
- package/dist/appBuilder/validators/joi-validators/create.appActionResponse.validator.js +0 -44
- package/dist/appBuilder/validators/joi-validators/create.appActionResponse.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appAuth.validator.d.ts +0 -3
- package/dist/appBuilder/validators/joi-validators/create.appAuth.validator.js +0 -31
- package/dist/appBuilder/validators/joi-validators/create.appAuth.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appBody.validators.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appBody.validators.js +0 -11
- package/dist/appBuilder/validators/joi-validators/create.appBody.validators.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appConstants.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appConstants.validator.js +0 -12
- package/dist/appBuilder/validators/joi-validators/create.appConstants.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appEnv.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appEnv.validator.js +0 -17
- package/dist/appBuilder/validators/joi-validators/create.appEnv.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appEvent.validator.d.ts +0 -5
- package/dist/appBuilder/validators/joi-validators/create.appEvent.validator.js +0 -30
- package/dist/appBuilder/validators/joi-validators/create.appEvent.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appVariable.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appVariable.validator.js +0 -14
- package/dist/appBuilder/validators/joi-validators/create.appVariable.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/sample.validator.d.ts +0 -5
- package/dist/appBuilder/validators/joi-validators/sample.validator.js +0 -26
- package/dist/appBuilder/validators/joi-validators/sample.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.app.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.app.validator.js +0 -34
- package/dist/appBuilder/validators/joi-validators/update.app.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appAction.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appAction.validator.js +0 -23
- package/dist/appBuilder/validators/joi-validators/update.appAction.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appActionResponse.validator.d.ts +0 -3
- package/dist/appBuilder/validators/joi-validators/update.appActionResponse.validator.js +0 -21
- package/dist/appBuilder/validators/joi-validators/update.appActionResponse.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appAuth.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appAuth.validator.js +0 -19
- package/dist/appBuilder/validators/joi-validators/update.appAuth.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appConstants.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appConstants.validator.js +0 -12
- package/dist/appBuilder/validators/joi-validators/update.appConstants.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appEnv.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appEnv.validator.js +0 -17
- package/dist/appBuilder/validators/joi-validators/update.appEnv.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appEvent.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appEvent.validator.js +0 -16
- package/dist/appBuilder/validators/joi-validators/update.appEvent.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appVariables.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appVariables.validator.js +0 -14
- package/dist/appBuilder/validators/joi-validators/update.appVariables.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.validation.entityData.validator.js +0 -27
- package/dist/appBuilder/validators/joi-validators/update.validation.entityData.validator.js.map +0 -1
- package/dist/apps/validators/joi-validators/create.appEvent.validator.d.ts +0 -5
- package/dist/apps/validators/joi-validators/create.appEvent.validator.js +0 -30
- package/dist/apps/validators/joi-validators/create.appEvent.validator.js.map +0 -1
- package/dist/apps/validators/joi-validators/update.appEvent.validator.d.ts +0 -4
- package/dist/apps/validators/joi-validators/update.appEvent.validator.js +0 -16
- package/dist/apps/validators/joi-validators/update.appEvent.validator.js.map +0 -1
- package/dist/clients/integrations.client.d.ts +0 -2
- package/dist/clients/integrations.client.js +0 -26
- package/dist/clients/integrations.client.js.map +0 -1
- package/dist/integrationsBuilder/services/integration.service.d.ts +0 -138
- package/dist/integrationsBuilder/services/integration.service.js +0 -1148
- package/dist/integrationsBuilder/services/integration.service.js.map +0 -1
- package/dist/integrationsBuilder/services/integrationBuilder.service.d.ts +0 -130
- package/dist/integrationsBuilder/services/integrationBuilder.service.js +0 -1017
- package/dist/integrationsBuilder/services/integrationBuilder.service.js.map +0 -1
- package/dist/integrationsBuilder/utils/objects.utils.d.ts +0 -2
- package/dist/integrationsBuilder/utils/objects.utils.js +0 -48
- package/dist/integrationsBuilder/utils/objects.utils.js.map +0 -1
- package/dist/integrationsBuilder/utils/string.utils.d.ts +0 -1
- package/dist/integrationsBuilder/utils/string.utils.js +0 -9
- package/dist/integrationsBuilder/utils/string.utils.js.map +0 -1
- package/dist/integrationsBuilder/validators/index.d.ts +0 -18
- package/dist/integrationsBuilder/validators/index.js +0 -38
- package/dist/integrationsBuilder/validators/index.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integration.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integration.validator.js +0 -10
- package/dist/integrationsBuilder/validators/joi-validators/create.integration.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationApp.validator.d.ts +0 -4
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationApp.validator.js +0 -26
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationApp.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationCache.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationCache.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationCache.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationDatabase.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationDatabase.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationDatabase.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationEnv.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationEnv.validator.js +0 -10
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationEnv.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFeature.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFeature.validator.js +0 -60
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFeature.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFunction.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFunction.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFunction.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationJob.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationJob.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationJob.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationNotification.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationNotification.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationNotification.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationApp.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationApp.validator.js +0 -9
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationApp.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationCache.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationCache.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationCache.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationDatabase.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationDatabase.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationDatabase.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationEnv.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationEnv.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationEnv.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFeature.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFeature.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFeature.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFunction.validator copy.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFunction.validator copy.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFunction.validator copy.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationJob.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationJob.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationJob.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationNotification.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationNotification.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationNotification.validator.js.map +0 -1
- package/dist/postman.d.ts +0 -1
- package/dist/postman.js +0 -21674
- package/dist/postman.js.map +0 -1
- package/dist/processor/utils/mongo.util.js +0 -152
- package/dist/processor/utils/mongo.util.js.map +0 -1
- package/dist/processor/utils/postgres.util.d.ts +0 -14
- package/dist/processor/utils/postgres.util.js +0 -83
- package/dist/processor/utils/postgres.util.js.map +0 -1
- package/dist/products/validators/joi-validators/create.product.validator.d.ts +0 -3
- package/dist/products/validators/joi-validators/create.product.validator.js +0 -10
- package/dist/products/validators/joi-validators/create.product.validator.js.map +0 -1
- package/dist/test.appBuilder.js +0 -14
- package/dist/test.appBuilder.js.map +0 -1
- package/dist/test.import.js +0 -24
- package/dist/test.import.js.map +0 -1
- package/dist/test.imports.js +0 -28
- package/dist/test.imports.js.map +0 -1
- package/dist/test.integrationBuilder.js +0 -276
- package/dist/test.integrationBuilder.js.map +0 -1
- package/dist/test.processor.js +0 -23
- package/dist/test.processor.js.map +0 -1
- package/dist/test.utils.js +0 -25
- package/dist/test.utils.js.map +0 -1
- package/dist/types/integrationsBuilder.types.d.ts +0 -276
- package/dist/types/integrationsBuilder.types.js +0 -51
- package/dist/types/integrationsBuilder.types.js.map +0 -1
- /package/dist/{actions/actions.repo.d.ts → pricing/pricing.repo.d.ts} +0 -0
- /package/dist/{appBuilder/validators/joi-validators/create.app.validator.d.ts → products/validators/joi-validators/create.productGraph.validator.d.ts} +0 -0
- /package/dist/{appBuilder/validators/joi-validators/update.validation.entityData.validator.d.ts → products/validators/joi-validators/update.productGraph.validator.d.ts} +0 -0
- /package/dist/{test.appBuilder.d.ts → test/test.broker.kafka.d.ts} +0 -0
- /package/dist/{test.imports.d.ts → test/test.broker.nats.d.ts} +0 -0
- /package/dist/{test.integrationBuilder.d.ts → test/test.broker.pubsub.d.ts} +0 -0
- /package/dist/{test.processor.d.ts → test/test.broker.rabbitmq.d.ts} +0 -0
- /package/dist/{test.utils.d.ts → test/test.broker.redis.d.ts} +0 -0
- /package/dist/{actions/actions.service.d.ts → test/test.health.d.ts} +0 -0
- /package/dist/{actions/utils/actions.util.read.d.ts → test/test.notifiers.d.ts} +0 -0
- /package/dist/{processor/utils/mongo.util.d.ts → test/test.products.d.ts} +0 -0
- /package/dist/{test.import.d.ts → types/request-tracker.interface.d.ts} +0 -0
|
@@ -1,1148 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
const appApi_service_1 = require("../../api/services/appApi.service");
|
|
15
|
-
const productsApi_service_1 = require("../../api/services/productsApi.service");
|
|
16
|
-
const userApi_service_1 = require("../../api/services/userApi.service");
|
|
17
|
-
const inputs_service_1 = require("../../inputs/inputs.service");
|
|
18
|
-
const inputs_utils_create_1 = require("../../inputs/utils/inputs.utils.create");
|
|
19
|
-
const enums_1 = require("../../types/enums");
|
|
20
|
-
const productsBuilder_types_1 = require("../../types/productsBuilder.types");
|
|
21
|
-
const validators_1 = require("../validators");
|
|
22
|
-
const objects_utils_1 = require("../utils/objects.utils");
|
|
23
|
-
const inputs_types_1 = require("../../types/inputs.types");
|
|
24
|
-
const string_utils_1 = require("../utils/string.utils");
|
|
25
|
-
const workspaceApi_service_1 = require("../../api/services/workspaceApi.service");
|
|
26
|
-
const string_utils_2 = require("../../appBuilder/utils/string.utils");
|
|
27
|
-
class IntegrationsBuilderService {
|
|
28
|
-
constructor({ workspace_id, public_key, user_id, token }) {
|
|
29
|
-
this.workspace_id = workspace_id;
|
|
30
|
-
this.public_key = public_key;
|
|
31
|
-
this.user_id = user_id;
|
|
32
|
-
this.token = token;
|
|
33
|
-
this.userApi = new userApi_service_1.UserApiService();
|
|
34
|
-
this.integrationApi = new productsApi_service_1.IntegrationsApiService();
|
|
35
|
-
this.workspaceApi = new workspaceApi_service_1.WorkspaceApiService();
|
|
36
|
-
this.appApi = new appApi_service_1.AppApiService();
|
|
37
|
-
this.inputsService = new inputs_service_1.default();
|
|
38
|
-
this.thirdPartyApps = [];
|
|
39
|
-
}
|
|
40
|
-
async createIntegration(data) {
|
|
41
|
-
try {
|
|
42
|
-
await validators_1.CreateIntegrationBuilderSchema.validateAsync(data);
|
|
43
|
-
const exists = await this.checkIfIntegrationExists(data.name);
|
|
44
|
-
if (exists && (exists === null || exists === void 0 ? void 0 : exists._id)) {
|
|
45
|
-
await this.initializeIntegration(exists === null || exists === void 0 ? void 0 : exists._id);
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
const integration = await this.createNewIntegration(data);
|
|
49
|
-
await this.initializeIntegration(integration._id);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
catch (e) {
|
|
53
|
-
throw e;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
async initializeWorkspace() {
|
|
57
|
-
if (!this.workspace) {
|
|
58
|
-
this.workspace = await this.workspaceApi.fetchWorkspaceById(this.getUserAccess());
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
async initializeIntegration(integration_id) {
|
|
62
|
-
try {
|
|
63
|
-
this.integration = await this.integrationApi.fetchIntegration(integration_id, this.getUserAccess());
|
|
64
|
-
this.integration_id = integration_id;
|
|
65
|
-
}
|
|
66
|
-
catch (e) {
|
|
67
|
-
throw e;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
async updateIntegration(data) {
|
|
71
|
-
try {
|
|
72
|
-
if (!this.app_id)
|
|
73
|
-
throw new Error('Integration not initialized');
|
|
74
|
-
await validators_1.CreateIntegrationBuilderSchema.validateAsync(data);
|
|
75
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign({}, data), this.getUserAccess());
|
|
76
|
-
await this.initializeIntegration(this.integration_id);
|
|
77
|
-
}
|
|
78
|
-
catch (e) {
|
|
79
|
-
throw e;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
async createNewIntegration(data) {
|
|
83
|
-
return this.integrationApi.createIntegration(Object.assign({}, data), this.getUserAccess());
|
|
84
|
-
}
|
|
85
|
-
async checkIfIntegrationExists(name) {
|
|
86
|
-
try {
|
|
87
|
-
return await this.integrationApi.checkIntegrationNameExists(name, this.getUserAccess());
|
|
88
|
-
}
|
|
89
|
-
catch (e) {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
fetchIntegration() {
|
|
94
|
-
if (!this.integration) {
|
|
95
|
-
throw new Error('Integration not yet initiated');
|
|
96
|
-
}
|
|
97
|
-
return this.integration;
|
|
98
|
-
}
|
|
99
|
-
async createEnv(data, throwErrorIfExists = false) {
|
|
100
|
-
try {
|
|
101
|
-
// TODO: figure out a way to check if this has run before, halt if it has
|
|
102
|
-
if (!this.fetchEnv(data.slug)) {
|
|
103
|
-
await validators_1.CreateIntegrationEnvSchema.validateAsync(data);
|
|
104
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign(Object.assign({}, data), { component: enums_1.IntegrationComponents.ENV, action: enums_1.RequestAction.CREATE }), this.getUserAccess());
|
|
105
|
-
await this.initializeIntegration(this.integration_id);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
if (throwErrorIfExists)
|
|
109
|
-
throw new Error(`Environment ${data.slug} already exists`);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
catch (e) {
|
|
113
|
-
throw e;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
async updateEnv(slug, data) {
|
|
117
|
-
try {
|
|
118
|
-
const { _id } = this.fetchEnv(slug, true);
|
|
119
|
-
await validators_1.UpdateIntegrationEnvSchema.validateAsync(data); // Change to update;
|
|
120
|
-
if (data.slug && this.fetchEnv(data.slug)) {
|
|
121
|
-
throw new Error(`slug ${slug} is in use`); // TODO: also check on the backend
|
|
122
|
-
}
|
|
123
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign(Object.assign({ _id }, data), { component: enums_1.IntegrationComponents.ENV, action: enums_1.RequestAction.UPDATE }), this.getUserAccess());
|
|
124
|
-
await this.initializeIntegration(this.integration_id);
|
|
125
|
-
}
|
|
126
|
-
catch (e) {
|
|
127
|
-
throw e;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
fetchEnvs() {
|
|
131
|
-
return this.integration.envs;
|
|
132
|
-
}
|
|
133
|
-
fetchEnv(slug, throwErrorIfExists = false) {
|
|
134
|
-
const env = this.integration.envs.find((data) => data.slug === slug);
|
|
135
|
-
if (!env && throwErrorIfExists)
|
|
136
|
-
throw new Error(`Env ${slug} not found`);
|
|
137
|
-
return env;
|
|
138
|
-
}
|
|
139
|
-
async validateAppData(appData, app) {
|
|
140
|
-
// TODO:
|
|
141
|
-
const { envs } = app;
|
|
142
|
-
// const { envs: appEnvs, auths: appAuths } = appData
|
|
143
|
-
await this.validateAppEnvs(envs, appData);
|
|
144
|
-
// await this.validateAppAuth(auth, appData);
|
|
145
|
-
}
|
|
146
|
-
validateVariablesSchema(variables, appVariables) {
|
|
147
|
-
if (variables && variables.length) {
|
|
148
|
-
variables.map((data) => {
|
|
149
|
-
const appVar = appVariables.find((value) => value.key === data.key);
|
|
150
|
-
if (!appVar) {
|
|
151
|
-
throw new Error(`variable key: ${data.key} not found`);
|
|
152
|
-
}
|
|
153
|
-
// if()
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
validateVariablesValues(variables, appVariables) {
|
|
158
|
-
if (appVariables && appVariables.length) {
|
|
159
|
-
appVariables.map((data) => {
|
|
160
|
-
const find = variables.find((value) => value.key === data.key);
|
|
161
|
-
if (data.required) {
|
|
162
|
-
if (!find) {
|
|
163
|
-
throw new Error(`variable key: ${data.key} is required`);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
if (find && data.type === enums_1.DataTypes.STRING) {
|
|
167
|
-
this.inputsService.validateLength(data, find);
|
|
168
|
-
}
|
|
169
|
-
if (find && data.type === enums_1.DataTypes.BOOLEAN) {
|
|
170
|
-
this.inputsService.validateBoolean(find);
|
|
171
|
-
}
|
|
172
|
-
if (find && data.type === enums_1.DataTypes.NUMBER_STRING) {
|
|
173
|
-
this.inputsService.validateNumberString(data, find);
|
|
174
|
-
}
|
|
175
|
-
if (find && data.type === enums_1.DataTypes.UUID) {
|
|
176
|
-
this.inputsService.validateUUID(find);
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
async validateAppEnvs(envs, app) {
|
|
182
|
-
const { envs: appEnvs } = app;
|
|
183
|
-
envs.map(async (env) => {
|
|
184
|
-
const { auth } = env;
|
|
185
|
-
this.fetchEnv(env.integration_env_slug, true);
|
|
186
|
-
const appEnv = appEnvs.find((appEnv) => appEnv.slug === env.app_env_slug);
|
|
187
|
-
if (!appEnv) {
|
|
188
|
-
throw new Error(`app_env_slug ${env.app_env_slug} not found`);
|
|
189
|
-
}
|
|
190
|
-
await this.validateAppAuth(auth, app);
|
|
191
|
-
this.validateVariablesSchema(env.variables, app.variables);
|
|
192
|
-
this.validateVariablesValues(env.variables, app.variables);
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
async validateAppAuth(auth, app) {
|
|
196
|
-
const { auths: appAuth, actions } = app;
|
|
197
|
-
const exists = appAuth.find((appAuth) => appAuth.tag === auth.auth_tag);
|
|
198
|
-
if (!exists) {
|
|
199
|
-
throw new Error(`app_auth ${auth.auth_tag} not found`);
|
|
200
|
-
}
|
|
201
|
-
const { data } = auth;
|
|
202
|
-
let bodySchema;
|
|
203
|
-
let headerSchema;
|
|
204
|
-
let paramsSchema;
|
|
205
|
-
let querySchema;
|
|
206
|
-
if (exists.action_tag) {
|
|
207
|
-
const action = actions.find((action) => action.tag === exists.action_tag);
|
|
208
|
-
if (!action)
|
|
209
|
-
throw new Error(`Auth action tag ${exists.action_tag} not found`);
|
|
210
|
-
bodySchema = action.body;
|
|
211
|
-
headerSchema = action.headers;
|
|
212
|
-
paramsSchema = action.params;
|
|
213
|
-
querySchema = action.query;
|
|
214
|
-
const { body, headers, params, query } = data;
|
|
215
|
-
if (!body)
|
|
216
|
-
throw new Error(`Auth body not allowed to be undefined. If empty set as {}`);
|
|
217
|
-
if (!headers)
|
|
218
|
-
throw new Error(`Auth headers not allowed to be undefined. If empty set as {}`);
|
|
219
|
-
if (!params)
|
|
220
|
-
throw new Error(`Auth params not allowed to be undefined. If empty set as {}`);
|
|
221
|
-
if (!query)
|
|
222
|
-
throw new Error(`Auth query not allowed to be undefined. If empty set as {}`);
|
|
223
|
-
if (bodySchema && bodySchema.data) {
|
|
224
|
-
const bodyValues = (await this.inputsService.parseData({
|
|
225
|
-
data: body,
|
|
226
|
-
category: enums_1.Categories.SETUP,
|
|
227
|
-
expected: inputs_types_1.ExpectedValues.PARSEINPUT,
|
|
228
|
-
type: enums_1.InputsTypes.JSON,
|
|
229
|
-
}));
|
|
230
|
-
(0, inputs_utils_create_1.validateInputSchema)(bodyValues, bodySchema);
|
|
231
|
-
}
|
|
232
|
-
if (headerSchema && headerSchema.data) {
|
|
233
|
-
const headerValues = (await this.inputsService.parseData({
|
|
234
|
-
data: headers,
|
|
235
|
-
category: enums_1.Categories.SETUP,
|
|
236
|
-
expected: inputs_types_1.ExpectedValues.PARSEINPUT,
|
|
237
|
-
type: enums_1.InputsTypes.JSON,
|
|
238
|
-
}));
|
|
239
|
-
(0, inputs_utils_create_1.validateInputSchema)(headerValues, headerSchema);
|
|
240
|
-
}
|
|
241
|
-
if (paramsSchema && paramsSchema.data) {
|
|
242
|
-
const paramsValues = (await this.inputsService.parseData({
|
|
243
|
-
data: params,
|
|
244
|
-
category: enums_1.Categories.SETUP,
|
|
245
|
-
expected: inputs_types_1.ExpectedValues.PARSEINPUT,
|
|
246
|
-
type: enums_1.InputsTypes.JSON,
|
|
247
|
-
}));
|
|
248
|
-
(0, inputs_utils_create_1.validateInputSchema)(paramsValues, paramsSchema);
|
|
249
|
-
}
|
|
250
|
-
if (querySchema && querySchema.data) {
|
|
251
|
-
const queryValues = (await this.inputsService.parseData({
|
|
252
|
-
data: query,
|
|
253
|
-
category: enums_1.Categories.SETUP,
|
|
254
|
-
expected: inputs_types_1.ExpectedValues.PARSEINPUT,
|
|
255
|
-
type: enums_1.InputsTypes.JSON,
|
|
256
|
-
}));
|
|
257
|
-
(0, inputs_utils_create_1.validateInputSchema)(queryValues, querySchema);
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
async createAppAccessTag(app_tag) {
|
|
262
|
-
await this.initializeWorkspace();
|
|
263
|
-
const { name: workspace_name } = this.workspace;
|
|
264
|
-
const app = await this.appApi.fetchAppByTag(app_tag, this.getUserAccess());
|
|
265
|
-
if (!app) {
|
|
266
|
-
throw new Error(`App ${app_tag} not found`);
|
|
267
|
-
}
|
|
268
|
-
const { _id: app_id } = app;
|
|
269
|
-
const access_tag = `${app_tag}:${(0, string_utils_2.tagify)(workspace_name)}`;
|
|
270
|
-
const { access } = await this.appApi.createAppAccess(app_id, this.integration_id, access_tag, this.getUserAccess());
|
|
271
|
-
return {
|
|
272
|
-
access_tag,
|
|
273
|
-
access,
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
async addApp(app, throwErrorIfExists = false) {
|
|
277
|
-
try {
|
|
278
|
-
await validators_1.CreateIntegrationAppSchema.validateAsync(app);
|
|
279
|
-
// TODO: figure out a way to check if this has run before, halt if it has
|
|
280
|
-
if (!this.fetchApp(app.access_tag, throwErrorIfExists)) {
|
|
281
|
-
// console.log("ZOOMER =====>", app);
|
|
282
|
-
const access = await this.appApi.fetchAccessByTag(app.access_tag, this.getUserAccess());
|
|
283
|
-
if (!access) {
|
|
284
|
-
throw new Error(`Access to app ${app.access_tag} not found`);
|
|
285
|
-
}
|
|
286
|
-
const appData = await this.appApi.fetchApp(access.app_id, this.getUserAccess());
|
|
287
|
-
if (!appData) {
|
|
288
|
-
throw new Error(`App ${app.access_tag} not found`);
|
|
289
|
-
}
|
|
290
|
-
await this.validateAppData(appData, app);
|
|
291
|
-
// console.log("UPDATE INTEGRATION HERE ====>>>>>", app);
|
|
292
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign(Object.assign({}, app), { component: enums_1.IntegrationComponents.APP, action: enums_1.RequestAction.CREATE }), this.getUserAccess());
|
|
293
|
-
await this.initializeIntegration(this.integration_id);
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
if (throwErrorIfExists)
|
|
297
|
-
throw new Error(`App ${app.access_tag} already exists`);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
catch (e) {
|
|
301
|
-
throw e;
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
async updateApp(access_tag, data) {
|
|
305
|
-
try {
|
|
306
|
-
const { _id } = this.fetchApp(access_tag);
|
|
307
|
-
//await UpdateIntegrationAppSchema.validateAsync(data); // Change to update;
|
|
308
|
-
if (data.access_tag && data.access_tag !== access_tag) {
|
|
309
|
-
throw new Error(`access_tag mismatch between ${access_tag} and ${data.access_tag}`);
|
|
310
|
-
}
|
|
311
|
-
if (!this.fetchApp(access_tag)) {
|
|
312
|
-
throw new Error(`access_tag ${access_tag} not found`); // TODO: also check on the backend
|
|
313
|
-
}
|
|
314
|
-
/*if (data.access_tag && this.fetchApp(data.access_tag)) {
|
|
315
|
-
throw new Error(`access_tag ${access_tag} is in use`); // TODO: also check on the backend
|
|
316
|
-
}*/
|
|
317
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign(Object.assign({ _id }, data), { access_tag, component: enums_1.IntegrationComponents.APP, action: enums_1.RequestAction.UPDATE }), this.getUserAccess());
|
|
318
|
-
await this.initializeIntegration(this.integration_id);
|
|
319
|
-
}
|
|
320
|
-
catch (e) {
|
|
321
|
-
throw e;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
fetchApps() {
|
|
325
|
-
return this.integration.apps;
|
|
326
|
-
}
|
|
327
|
-
fetchApp(tag, throwErrorIfExists = false) {
|
|
328
|
-
const app = this.integration.apps.find((data) => data.access_tag === tag);
|
|
329
|
-
if (!app && throwErrorIfExists)
|
|
330
|
-
throw new Error(`App ${tag} not found`);
|
|
331
|
-
return app;
|
|
332
|
-
}
|
|
333
|
-
async createFunction(data, throwErrorIfExists = false) {
|
|
334
|
-
try {
|
|
335
|
-
// TODO: figure out a way to check if this has run before, halt if it has
|
|
336
|
-
if (!this.fetchFunction(data.tag)) {
|
|
337
|
-
await validators_1.CreateIntegrationFunctionSchema.validateAsync(data);
|
|
338
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign(Object.assign({}, data), { component: enums_1.IntegrationComponents.FUNCTION }), this.getUserAccess());
|
|
339
|
-
await this.initializeIntegration(this.integration_id);
|
|
340
|
-
}
|
|
341
|
-
else {
|
|
342
|
-
if (throwErrorIfExists)
|
|
343
|
-
throw new Error(`Function ${data.tag} already exists`);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
catch (e) {
|
|
347
|
-
throw e;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
async updateFunction(tag, data) {
|
|
351
|
-
try {
|
|
352
|
-
const { _id } = this.fetchFunction(tag);
|
|
353
|
-
await validators_1.UpdateIntegrationFunctionSchema.validateAsync(data); // Change to update;
|
|
354
|
-
if (data.tag && this.fetchFunction(data.tag)) {
|
|
355
|
-
throw new Error(`tag ${tag} is in use`); // TODO: also check on the backend
|
|
356
|
-
}
|
|
357
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign(Object.assign({ _id }, data), { component: enums_1.IntegrationComponents.FUNCTION }), this.getUserAccess());
|
|
358
|
-
await this.initializeIntegration(this.integration_id);
|
|
359
|
-
}
|
|
360
|
-
catch (e) {
|
|
361
|
-
throw e;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
fetchFunctions() {
|
|
365
|
-
return this.integration.functions;
|
|
366
|
-
}
|
|
367
|
-
fetchFunction(tag) {
|
|
368
|
-
const func = this.integration.functions.find((data) => data.tag === tag);
|
|
369
|
-
if (!func)
|
|
370
|
-
throw new Error(`Function ${tag} not found`);
|
|
371
|
-
return func;
|
|
372
|
-
}
|
|
373
|
-
async createCache(data, throwErrorIfExists = false) {
|
|
374
|
-
try {
|
|
375
|
-
// TODO: figure out a way to check if this has run before, halt if it has
|
|
376
|
-
if (!this.fetchCache(data.tag)) {
|
|
377
|
-
await validators_1.CreateIntegrationCacheSchema.validateAsync(data);
|
|
378
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign(Object.assign({}, data), { component: enums_1.IntegrationComponents.CACHE }), this.getUserAccess());
|
|
379
|
-
await this.initializeIntegration(this.integration_id);
|
|
380
|
-
}
|
|
381
|
-
else {
|
|
382
|
-
if (throwErrorIfExists)
|
|
383
|
-
throw new Error(`Cache ${data.tag} already exists`);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
catch (e) {
|
|
387
|
-
throw e;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
async updateCache(tag, data) {
|
|
391
|
-
try {
|
|
392
|
-
const { _id } = this.fetchCache(tag);
|
|
393
|
-
await validators_1.UpdateIntegrationCacheSchema.validateAsync(data); // Change to update;
|
|
394
|
-
if (data.tag && this.fetchCache(data.tag)) {
|
|
395
|
-
throw new Error(`tag ${tag} is in use`); // TODO: also check on the backend
|
|
396
|
-
}
|
|
397
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign(Object.assign({ _id }, data), { component: enums_1.IntegrationComponents.CACHE }), this.getUserAccess());
|
|
398
|
-
await this.initializeIntegration(this.integration_id);
|
|
399
|
-
}
|
|
400
|
-
catch (e) {
|
|
401
|
-
throw e;
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
fetchCache(tag) {
|
|
405
|
-
const cache = this.integration.caches.find((data) => data.tag === tag);
|
|
406
|
-
if (!cache)
|
|
407
|
-
throw new Error(`Function ${tag} not found`);
|
|
408
|
-
return cache;
|
|
409
|
-
}
|
|
410
|
-
fetchCaches() {
|
|
411
|
-
return this.integration.caches;
|
|
412
|
-
}
|
|
413
|
-
async createNotification(data, throwErrorIfExists = false) {
|
|
414
|
-
try {
|
|
415
|
-
// TODO: figure out a way to check if this has run before, halt if it has
|
|
416
|
-
if (!this.fetchNotification(data.tag)) {
|
|
417
|
-
await validators_1.CreateIntegrationNotificationSchema.validateAsync(data);
|
|
418
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign(Object.assign({}, data), { component: enums_1.IntegrationComponents.NOTIFICATION }), this.getUserAccess());
|
|
419
|
-
await this.initializeIntegration(this.integration_id);
|
|
420
|
-
}
|
|
421
|
-
else {
|
|
422
|
-
if (throwErrorIfExists)
|
|
423
|
-
throw new Error(`Notification ${data.tag} already exists`);
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
catch (e) {
|
|
427
|
-
throw e;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
async updateNotification(tag, data) {
|
|
431
|
-
try {
|
|
432
|
-
const { _id } = this.fetchNotification(tag);
|
|
433
|
-
await validators_1.UpdateIntegrationNotificationSchema.validateAsync(data); // Change to update;
|
|
434
|
-
if (data.tag && this.fetchNotification(data.tag)) {
|
|
435
|
-
throw new Error(`tag ${tag} is in use`); // TODO: also check on the backend
|
|
436
|
-
}
|
|
437
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign(Object.assign({ _id }, data), { component: enums_1.IntegrationComponents.NOTIFICATION }), this.getUserAccess());
|
|
438
|
-
await this.initializeIntegration(this.integration_id);
|
|
439
|
-
}
|
|
440
|
-
catch (e) {
|
|
441
|
-
throw e;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
fetchNotification(tag, notification_slug = '') {
|
|
445
|
-
const notification = this.integration.notifications.find((data) => data.tag === tag);
|
|
446
|
-
if (!notification)
|
|
447
|
-
throw new Error(`Function ${tag} not found`);
|
|
448
|
-
if (notification_slug) {
|
|
449
|
-
const { notifications, emails, webhook } = notification.envs.find((data) => (data.slug = notification_slug));
|
|
450
|
-
return { notifications, emails, webhook };
|
|
451
|
-
}
|
|
452
|
-
return notification;
|
|
453
|
-
}
|
|
454
|
-
fetchNotifications() {
|
|
455
|
-
return this.integration.notifications;
|
|
456
|
-
}
|
|
457
|
-
validateFeatureSequence(array) {
|
|
458
|
-
// Validate uniqueness of sequence_tag
|
|
459
|
-
const uniqueTags = new Set();
|
|
460
|
-
for (const item of array) {
|
|
461
|
-
if (uniqueTags.has(item.sequence_tag)) {
|
|
462
|
-
throw new Error(`Duplicate sequence_tag found: ${item.sequence_tag}`);
|
|
463
|
-
}
|
|
464
|
-
uniqueTags.add(item.sequence_tag);
|
|
465
|
-
}
|
|
466
|
-
// Validate levels are in order starting from 0
|
|
467
|
-
/*let expectedLevel = 0;
|
|
468
|
-
for (const item of array) {
|
|
469
|
-
if (item.level !== expectedLevel) {
|
|
470
|
-
throw new Error(`Invalid level found: expected ${expectedLevel}, found ${item.level}`);
|
|
471
|
-
}
|
|
472
|
-
expectedLevel++;
|
|
473
|
-
}*/
|
|
474
|
-
}
|
|
475
|
-
validateUniqueEventTags(data) {
|
|
476
|
-
// TODO: this might not be necessary o
|
|
477
|
-
const eventTagsSet = new Set(); // TODO: this might have to be moved to line 658
|
|
478
|
-
data.sequence.forEach((sequence) => {
|
|
479
|
-
sequence.events.forEach((data) => {
|
|
480
|
-
const { event } = data;
|
|
481
|
-
if (eventTagsSet.has(event)) {
|
|
482
|
-
throw new Error(`Duplicate event_tag found: ${event}`);
|
|
483
|
-
}
|
|
484
|
-
eventTagsSet.add(event);
|
|
485
|
-
});
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
async validateFeatureData(data) {
|
|
489
|
-
const { sequence } = data;
|
|
490
|
-
this.validateUniqueEventTags(data); // TODO: this might be unnecessary
|
|
491
|
-
this.validateFeatureSequence(sequence);
|
|
492
|
-
const promises = sequence.map((obj, sequence_index) => {
|
|
493
|
-
const { events, parents } = obj;
|
|
494
|
-
if (parents && parents.length) {
|
|
495
|
-
this.validateSequenceParents(parents, sequence_index, sequence);
|
|
496
|
-
}
|
|
497
|
-
events.map((event, event_index) => {
|
|
498
|
-
return this.validateEvent(data, sequence_index, event, event_index);
|
|
499
|
-
});
|
|
500
|
-
});
|
|
501
|
-
Promise.all(promises);
|
|
502
|
-
}
|
|
503
|
-
validateSequenceParents(parents, sequence_index, sequence) {
|
|
504
|
-
const map = new Map();
|
|
505
|
-
for (let i = 0; i < sequence_index; i++) {
|
|
506
|
-
map.set(sequence[i].sequence_tag, i);
|
|
507
|
-
}
|
|
508
|
-
for (let i = 0; i < parents.length; i++) {
|
|
509
|
-
if (map.get(parents[i]) === undefined) {
|
|
510
|
-
throw new Error(`Invalid parent ${parents[i]} in sequence ${sequence[sequence_index].sequence_tag}, parents have to be declared before their children`);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
validateSequenceInputParents(parent, sequence_index, sequence) {
|
|
515
|
-
let found = false;
|
|
516
|
-
const parents = sequence[sequence_index].parents;
|
|
517
|
-
if (!parents || parents.length === 0)
|
|
518
|
-
throw new Error(`Parents array cannot be empty or null when there is a $Sequence value in sequence ${sequence[sequence_index].sequence_tag}`);
|
|
519
|
-
for (let i = 0; i < sequence_index; i++) {
|
|
520
|
-
if (sequence[i].sequence_tag === parent)
|
|
521
|
-
found = true;
|
|
522
|
-
}
|
|
523
|
-
if (!found)
|
|
524
|
-
throw new Error(`Parents array needs to contain parent sequence ${parent} in ${sequence[sequence_index].sequence_tag}`);
|
|
525
|
-
}
|
|
526
|
-
async validateEvent(data, sequence_index, event, event_index) {
|
|
527
|
-
const app = this.fetchApp(event.app, true);
|
|
528
|
-
const { access_tag } = app;
|
|
529
|
-
// validate action_tag
|
|
530
|
-
const { actions } = await this.fetchThirdPartyAppByAccessTag(access_tag);
|
|
531
|
-
if (event.type === productsBuilder_types_1.FeatureEventTypes.ACTION) {
|
|
532
|
-
const action = this.fetchThirdPartyAppActionByTag(actions, event.event);
|
|
533
|
-
await this.validateActionDataInput(data, action, event.input, event_index, sequence_index);
|
|
534
|
-
// validate input
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
async validateActionDataInput(data, action, event_input, event_index, sequence_index) {
|
|
538
|
-
const { params, query, headers, body } = event_input;
|
|
539
|
-
const { params: actionParams, query: actionQuery, headers: actionHeaders, body: actionBody } = action;
|
|
540
|
-
const indexes = {
|
|
541
|
-
parent_key: '',
|
|
542
|
-
level: 0,
|
|
543
|
-
key: '',
|
|
544
|
-
index: 0,
|
|
545
|
-
};
|
|
546
|
-
await this.validateActionInputData({
|
|
547
|
-
obj: params,
|
|
548
|
-
sample: actionParams,
|
|
549
|
-
event_index,
|
|
550
|
-
sequence_index,
|
|
551
|
-
feature: data,
|
|
552
|
-
type: enums_1.Categories.PARAMS,
|
|
553
|
-
indexes,
|
|
554
|
-
});
|
|
555
|
-
await this.validateActionInputData({
|
|
556
|
-
obj: query,
|
|
557
|
-
sample: actionQuery,
|
|
558
|
-
event_index,
|
|
559
|
-
sequence_index,
|
|
560
|
-
feature: data,
|
|
561
|
-
type: enums_1.Categories.QUERY,
|
|
562
|
-
indexes,
|
|
563
|
-
});
|
|
564
|
-
await this.validateActionInputData({
|
|
565
|
-
obj: headers,
|
|
566
|
-
sample: actionHeaders,
|
|
567
|
-
event_index,
|
|
568
|
-
sequence_index,
|
|
569
|
-
feature: data,
|
|
570
|
-
type: enums_1.Categories.HEADER,
|
|
571
|
-
indexes,
|
|
572
|
-
});
|
|
573
|
-
await this.validateActionInputData({
|
|
574
|
-
obj: body,
|
|
575
|
-
sample: actionBody,
|
|
576
|
-
event_index,
|
|
577
|
-
sequence_index,
|
|
578
|
-
feature: data,
|
|
579
|
-
type: enums_1.Categories.BODY,
|
|
580
|
-
indexes,
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
async validateActionInputData(data) {
|
|
584
|
-
const { obj } = data, base_data = __rest(data, ["obj"]);
|
|
585
|
-
const sequence = data.feature.sequence[data.sequence_index];
|
|
586
|
-
if (obj === undefined || obj === null) {
|
|
587
|
-
throw new Error(`sequence ${sequence.sequence_tag} event ${sequence.events[data.event_index].event} ${data.type} should not be ${obj}`);
|
|
588
|
-
}
|
|
589
|
-
if (Object.values(obj).length > 0 && data.sample.data.length === 0) {
|
|
590
|
-
throw new Error(`sequence ${sequence.sequence_tag} event ${sequence.events[data.event_index].event} ${data.type} should be an empty object`);
|
|
591
|
-
}
|
|
592
|
-
if (Object.values(obj).length === 0 && data.sample.data.length === 0) {
|
|
593
|
-
return;
|
|
594
|
-
}
|
|
595
|
-
if (Object.values(obj).length === 0 && data.sample.data.length > 0) {
|
|
596
|
-
throw new Error(`sequence ${sequence.sequence_tag} event ${sequence.events[data.event_index].event} ${data.type} should not be an empty object`);
|
|
597
|
-
}
|
|
598
|
-
let index = 0;
|
|
599
|
-
for (const key in obj) {
|
|
600
|
-
if (typeof obj[key] === 'object') {
|
|
601
|
-
// Check if the object has keys "function" and "values"
|
|
602
|
-
if ('function' in obj[key] && 'values' in obj[key]) {
|
|
603
|
-
// Special handling for objects with keys "function" and "values"
|
|
604
|
-
await this.parseActionEventInput(Object.assign({ key, value: obj[key] }, base_data));
|
|
605
|
-
}
|
|
606
|
-
else {
|
|
607
|
-
// Normal recursive call for nested objects
|
|
608
|
-
await this.validateActionInputData(Object.assign(Object.assign({}, base_data), { obj: obj[key], indexes: {
|
|
609
|
-
key,
|
|
610
|
-
index,
|
|
611
|
-
parent_key: data.indexes.key,
|
|
612
|
-
level: data.indexes.level++,
|
|
613
|
-
} }));
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
else if (Array.isArray(obj[key])) {
|
|
617
|
-
// If it's an array, iterate through each element
|
|
618
|
-
Object.keys(obj[key]).forEach(async (elementKey) => {
|
|
619
|
-
const element = obj[key][elementKey];
|
|
620
|
-
if (typeof element === 'object') {
|
|
621
|
-
// Check if the object within array has keys "function" and "values"
|
|
622
|
-
if ('function' in element && 'values' in element) {
|
|
623
|
-
// Special handling for objects within array with keys "function" and "values"
|
|
624
|
-
await this.parseActionEventInput(Object.assign({ key: elementKey, value: element }, base_data));
|
|
625
|
-
}
|
|
626
|
-
else {
|
|
627
|
-
// Normal recursive call for nested objects within arrays
|
|
628
|
-
await this.validateActionInputData(Object.assign(Object.assign({}, base_data), { obj: element, indexes: {
|
|
629
|
-
key: elementKey,
|
|
630
|
-
index,
|
|
631
|
-
parent_key: data.indexes.key,
|
|
632
|
-
level: data.indexes.level++,
|
|
633
|
-
} }));
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
else {
|
|
637
|
-
await this.parseActionEventInput(Object.assign({ key: elementKey, value: element }, base_data));
|
|
638
|
-
}
|
|
639
|
-
});
|
|
640
|
-
}
|
|
641
|
-
else {
|
|
642
|
-
await this.parseActionEventInput(Object.assign({ key, value: obj[key] }, base_data));
|
|
643
|
-
}
|
|
644
|
-
index++;
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
async parseActionEventInput(data) {
|
|
648
|
-
const datapoint = this.validateActionKeyPlacement(data);
|
|
649
|
-
let stages, input;
|
|
650
|
-
if (typeof data.value === 'object') {
|
|
651
|
-
// TOPICAL PARSER
|
|
652
|
-
const { function: func, values } = data.value;
|
|
653
|
-
this.fetchFunction(func);
|
|
654
|
-
for (let i = 0; i < values.length; i++) {
|
|
655
|
-
stages = this.extractStages(values[i]);
|
|
656
|
-
input = data.feature.input;
|
|
657
|
-
this.parseInputString({ datapoint, value: values[i], input, stages }, {
|
|
658
|
-
feature: data.feature,
|
|
659
|
-
sequence_index: data.sequence_index,
|
|
660
|
-
event_index: data.event_index,
|
|
661
|
-
type: data.type,
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
else if (typeof data.value === 'string') {
|
|
666
|
-
stages = this.extractStages(data.value);
|
|
667
|
-
input = data.feature.input;
|
|
668
|
-
this.parseInputString({ datapoint, value: data.value, input, stages }, {
|
|
669
|
-
feature: data.feature,
|
|
670
|
-
sequence_index: data.sequence_index,
|
|
671
|
-
event_index: data.event_index,
|
|
672
|
-
type: data.type,
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
async parseInputString(payload, meta) {
|
|
677
|
-
const { datapoint, value, input, stages } = payload;
|
|
678
|
-
const sequence = meta.feature.sequence[meta.sequence_index];
|
|
679
|
-
if (value.startsWith('$Input{')) {
|
|
680
|
-
let current_input = input;
|
|
681
|
-
for (let i = 0; i < stages.length; i++) {
|
|
682
|
-
let stage = stages[i];
|
|
683
|
-
const matches = stage.match(/^\[(\d+)\]$/);
|
|
684
|
-
if (matches && matches.length === 2) {
|
|
685
|
-
const number = parseInt(matches[1], 10);
|
|
686
|
-
if (!isNaN(number)) {
|
|
687
|
-
stage = number;
|
|
688
|
-
}
|
|
689
|
-
else {
|
|
690
|
-
throw new Error(`Invalid array value ${matches[1]}, should be an integer value`);
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
if (!current_input[stage])
|
|
694
|
-
throw new Error(`Input key ${stage} in ${value} does not exist`);
|
|
695
|
-
current_input = current_input[stage];
|
|
696
|
-
}
|
|
697
|
-
if ((0, objects_utils_1.deepEqual)(current_input, input)) {
|
|
698
|
-
throw new Error(`Error 490101: something unexpected happened`);
|
|
699
|
-
}
|
|
700
|
-
this.compareInputWithExpectedInput(datapoint, current_input, value);
|
|
701
|
-
}
|
|
702
|
-
else if (value.startsWith('$Auth{')) {
|
|
703
|
-
// TODO: make sure that all auths have the same responses
|
|
704
|
-
// TODO: make sure apps have only one auth, for now
|
|
705
|
-
const { app: access_tag } = meta.feature.sequence[meta.sequence_index].events[meta.event_index];
|
|
706
|
-
const { actions, auths } = await this.fetchThirdPartyAppByAccessTag(access_tag);
|
|
707
|
-
const auth_tag = stages[0];
|
|
708
|
-
let auth;
|
|
709
|
-
for (let i = 0; i < auths.length; i++) {
|
|
710
|
-
if (auths[i].tag === auth_tag) {
|
|
711
|
-
auth = auths[i];
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
if (!auth) {
|
|
715
|
-
throw new Error(`Auth in ${value} not found in app ${access_tag}`);
|
|
716
|
-
}
|
|
717
|
-
/*const { envs } = this.fetchApp(access_tag, false);
|
|
718
|
-
|
|
719
|
-
for(let i=0; i< envs.length; i++) {
|
|
720
|
-
if (envs[i].auth.auth_tag ) {
|
|
721
|
-
throw new Error(`Auth ${auth_tag} not in use in integration environment ${envs[i].integration_env_slug}, please be uniform in environment auth definition`)
|
|
722
|
-
}
|
|
723
|
-
}*/
|
|
724
|
-
const action = actions.find((item) => {
|
|
725
|
-
return item.tag === auth.action_tag;
|
|
726
|
-
});
|
|
727
|
-
if (!action) {
|
|
728
|
-
throw new Error(`Could not find auth action ${auth.action_tag}`);
|
|
729
|
-
}
|
|
730
|
-
const response = action.responses.find((item) => item.success === true);
|
|
731
|
-
if (response) {
|
|
732
|
-
let parent_index = 0;
|
|
733
|
-
let increment = false;
|
|
734
|
-
let level = 0;
|
|
735
|
-
let parent_key = '';
|
|
736
|
-
let i = 1;
|
|
737
|
-
while (i < stages.length) {
|
|
738
|
-
let stage = stages[i];
|
|
739
|
-
const matches = stage.match(/^\[(\d+)\]$/);
|
|
740
|
-
if (matches && matches.length === 2) {
|
|
741
|
-
const number = parseInt(matches[1], 10);
|
|
742
|
-
if (!isNaN(number)) {
|
|
743
|
-
stage = number;
|
|
744
|
-
parent_index = number; // TODO: check whether this handles the array issue
|
|
745
|
-
i++; // move to next stage instantly
|
|
746
|
-
increment = true;
|
|
747
|
-
}
|
|
748
|
-
else {
|
|
749
|
-
throw new Error(`Invalid array value ${matches[1]}, should be an integer value`);
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
const found = response.body.data.find((item) => {
|
|
753
|
-
if (!increment) {
|
|
754
|
-
return item.parent_key === parent_key && item.key === stage && level === item.level;
|
|
755
|
-
}
|
|
756
|
-
else {
|
|
757
|
-
return (item.parent_key === parent_key &&
|
|
758
|
-
parent_index === stage &&
|
|
759
|
-
stages[i] === item.key &&
|
|
760
|
-
level === item.level);
|
|
761
|
-
}
|
|
762
|
-
});
|
|
763
|
-
if (!found) {
|
|
764
|
-
throw new Error(`Cannot find key: ${stage} in ${value}`);
|
|
765
|
-
}
|
|
766
|
-
level++;
|
|
767
|
-
parent_key = String(stages[i]);
|
|
768
|
-
if (i === stages.length - 1) {
|
|
769
|
-
this.compareInputWithExpectedInput(datapoint, found, value);
|
|
770
|
-
}
|
|
771
|
-
i++;
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
else {
|
|
775
|
-
throw new Error(`There is no successful response sample for Action ${auth.action_tag} in app ${access_tag}`);
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
else if (value.startsWith('$Sequence{')) {
|
|
779
|
-
//let current_input = input as unknown as Record<string, unknown>;
|
|
780
|
-
//const { feature, sequence_index, event_index} = meta;
|
|
781
|
-
let parent_key = '';
|
|
782
|
-
let level = 0;
|
|
783
|
-
let i = 0;
|
|
784
|
-
while (i < stages.length) {
|
|
785
|
-
let stage = stages[i];
|
|
786
|
-
let sequence;
|
|
787
|
-
let event;
|
|
788
|
-
let response;
|
|
789
|
-
// let current_data;
|
|
790
|
-
if (i === 0) {
|
|
791
|
-
// find sequence by tag, see if it exists and its before current sequence
|
|
792
|
-
this.validateSequenceInputParents(stage, meta.sequence_index, meta.feature.sequence);
|
|
793
|
-
sequence = this.fetchPriorSequence(meta, stage);
|
|
794
|
-
}
|
|
795
|
-
if (i === 1 && sequence) {
|
|
796
|
-
event = this.fetchSequenceEvent(sequence, stage);
|
|
797
|
-
if (!event) {
|
|
798
|
-
throw new Error(`event ${stage} not found in sequence ${sequence.sequence_tag}`);
|
|
799
|
-
}
|
|
800
|
-
let { type, app: access_tag, event: event_tag } = event;
|
|
801
|
-
if (type === productsBuilder_types_1.FeatureEventTypes.ACTION) {
|
|
802
|
-
const { actions } = await this.fetchThirdPartyAppByAccessTag(access_tag);
|
|
803
|
-
const { responses } = this.fetchThirdPartyAppActionByTag(actions, event_tag);
|
|
804
|
-
response = responses.find((item) => item.success === true);
|
|
805
|
-
// fetch success result
|
|
806
|
-
if (!response) {
|
|
807
|
-
throw new Error(`event ${stage} does not have a success response`);
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
//TODO: handle other types
|
|
811
|
-
}
|
|
812
|
-
if (i > 1 && response) {
|
|
813
|
-
let parent_index = 0;
|
|
814
|
-
let increment = false;
|
|
815
|
-
const matches = stage.match(/^\[(\d+)\]$/);
|
|
816
|
-
if (matches && matches.length === 2) {
|
|
817
|
-
const number = parseInt(matches[1], 10);
|
|
818
|
-
if (!isNaN(number)) {
|
|
819
|
-
stage = number;
|
|
820
|
-
parent_index = number; // TODO: check whether this handles the array issue
|
|
821
|
-
i++; // move to next stage instantly
|
|
822
|
-
increment = true;
|
|
823
|
-
}
|
|
824
|
-
else {
|
|
825
|
-
throw new Error(`Invalid array value ${matches[1]}, should be an integer value`);
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
const found = response.body.data.find((item) => {
|
|
829
|
-
if (!increment) {
|
|
830
|
-
return item.parent_key === parent_key && item.key === stage && level === item.level;
|
|
831
|
-
}
|
|
832
|
-
else {
|
|
833
|
-
return (item.parent_key === parent_key &&
|
|
834
|
-
parent_index === stage &&
|
|
835
|
-
stages[i] === item.key &&
|
|
836
|
-
level === item.level);
|
|
837
|
-
}
|
|
838
|
-
});
|
|
839
|
-
if (!found) {
|
|
840
|
-
throw new Error(`Cannot find key: ${stage} in ${value}`);
|
|
841
|
-
}
|
|
842
|
-
level++;
|
|
843
|
-
parent_key = String(stages[i]);
|
|
844
|
-
if (i === stages.length - 1) {
|
|
845
|
-
this.compareInputWithExpectedInput(datapoint, found, value);
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
i++;
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
else if (value === '$Default') {
|
|
852
|
-
if (!datapoint.defaultValue) {
|
|
853
|
-
throw new Error(`sequence ${sequence.sequence_tag} event ${sequence.events[meta.event_index].event} ${meta.type}, the key {${datapoint.key}: ${value}} does not have a default`);
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
else if (value.startsWith('$Variable{')) {
|
|
857
|
-
// $Variable{APP_NAME}$
|
|
858
|
-
const stages = this.extractStages(value);
|
|
859
|
-
if (stages.length < 2) {
|
|
860
|
-
throw new Error(`sequence ${sequence.sequence_tag} event ${sequence.events[meta.event_index].event} ${meta.type}, has invalid varibale definition ${value}, you have to define what variable is to be used`);
|
|
861
|
-
}
|
|
862
|
-
if (stages.length > 2) {
|
|
863
|
-
throw new Error(`sequence ${sequence.sequence_tag} event ${sequence.events[meta.event_index].event} ${meta.type}, has invalid varibale definition ${value}, only two keys is required`);
|
|
864
|
-
}
|
|
865
|
-
const app = this.fetchApp(stages[0]);
|
|
866
|
-
if (!app) {
|
|
867
|
-
throw new Error(`App ${stages[0]} not found in sequence ${sequence.sequence_tag} event ${sequence.events[meta.event_index].event} ${meta.type}, has invalid varibale definition ${value}. `);
|
|
868
|
-
}
|
|
869
|
-
if (!app.envs[0]) {
|
|
870
|
-
throw new Error(`App ${stages[0]} has not environments defined`);
|
|
871
|
-
}
|
|
872
|
-
const { variables } = app.envs[0];
|
|
873
|
-
if (!variables.find((item) => item.key === stages[1])) {
|
|
874
|
-
throw new Error(`Variable ${stages[1]} does not exist in app ${stages[0]} in value ${value} in sequence ${sequence.sequence_tag} event ${sequence.events[meta.event_index].event} ${meta.type}`);
|
|
875
|
-
}
|
|
876
|
-
}
|
|
877
|
-
else if (value.startsWith('$Constant{')) {
|
|
878
|
-
const stages = this.extractStages(value);
|
|
879
|
-
if (stages.length !== 2) {
|
|
880
|
-
throw new Error(`When using constants you need to specify the constant in the format $Constant{app_tag}{key} instead of ${value}`);
|
|
881
|
-
}
|
|
882
|
-
const app_tag = stages[0];
|
|
883
|
-
const key = stages[1];
|
|
884
|
-
const app = await this.fetchThirdPartyAppByAccessTag(app_tag);
|
|
885
|
-
if (!app) {
|
|
886
|
-
throw new Error(`App ${app_tag} not found in constant ${value}`);
|
|
887
|
-
}
|
|
888
|
-
const { constants } = app;
|
|
889
|
-
const exists = constants.find((item) => item.key === key);
|
|
890
|
-
if (!exists) {
|
|
891
|
-
throw new Error(`Constant with key ${key} in ${value}, does not exist on app ${app}`);
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
else {
|
|
895
|
-
throw new Error(`sequence ${sequence.sequence_tag} event ${sequence.events[meta.event_index].event} ${meta.type} has invalid : {${datapoint.key}: ${value}}`);
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
compareInputWithExpectedInput(datapoint, found_input, value) {
|
|
899
|
-
if (datapoint.maxLength != 0 && (!found_input.maxLength || found_input.maxLength > datapoint.maxLength)) {
|
|
900
|
-
throw new Error(`maxlength of ${value} cannot be greater than ${datapoint.maxLength}`);
|
|
901
|
-
}
|
|
902
|
-
if (datapoint.minLength != 0 && (!found_input.minLength || found_input.minLength < datapoint.minLength)) {
|
|
903
|
-
throw new Error(`minlength of ${value} cannot be less than ${datapoint.minLength}`);
|
|
904
|
-
}
|
|
905
|
-
if (datapoint.type !== found_input.type) {
|
|
906
|
-
throw new Error(`${value} is required to be ${datapoint.type} not ${found_input.type}`);
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
extractStages(input) {
|
|
910
|
-
return (0, string_utils_1.extractStages)(input);
|
|
911
|
-
}
|
|
912
|
-
fetchSequenceEvent(sequence, event) {
|
|
913
|
-
return sequence.events.find((item) => item.event === event);
|
|
914
|
-
}
|
|
915
|
-
fetchPriorSequence(meta, stage) {
|
|
916
|
-
let found;
|
|
917
|
-
for (let i = 0; i < meta.sequence_index; i++) {
|
|
918
|
-
if (meta.feature.sequence[i].sequence_tag === stage) {
|
|
919
|
-
found = meta.feature.sequence[i];
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
if (!found) {
|
|
923
|
-
const sequence = meta.feature.sequence[meta.sequence_index].sequence_tag;
|
|
924
|
-
throw `sequence ${stage} not found before ${sequence}, values can only inherit from sequences before them in the feature chain`;
|
|
925
|
-
}
|
|
926
|
-
return found;
|
|
927
|
-
}
|
|
928
|
-
validateActionKeyPlacement(data) {
|
|
929
|
-
const actionData = data.sample.data;
|
|
930
|
-
const { indexes } = data;
|
|
931
|
-
const sequence = data.feature.sequence[data.sequence_index];
|
|
932
|
-
const datapoint = actionData.find((item) => {
|
|
933
|
-
return (item.parent_key === indexes.parent_key &&
|
|
934
|
-
item.key === data.key &&
|
|
935
|
-
item.level === indexes.level &&
|
|
936
|
-
indexes.index === item.index);
|
|
937
|
-
});
|
|
938
|
-
if (!datapoint) {
|
|
939
|
-
console.log(indexes.parent_key + ' ' + data.key + ' ' + indexes.level + ' ' + indexes.index);
|
|
940
|
-
throw new Error(`Key ${data.key} not found for ${data.type} for sequence ${sequence.sequence_tag} event ${sequence.events[data.event_index].event}`);
|
|
941
|
-
}
|
|
942
|
-
return datapoint;
|
|
943
|
-
}
|
|
944
|
-
async fetchThirdPartyAppByAccessTag(access_tag) {
|
|
945
|
-
try {
|
|
946
|
-
const app = this.thirdPartyApps.find((item) => access_tag === item.access_tag);
|
|
947
|
-
if (app) {
|
|
948
|
-
return app.app;
|
|
949
|
-
}
|
|
950
|
-
const access = await this.appApi.fetchAccessByTag(access_tag, this.getUserAccess());
|
|
951
|
-
if (!access) {
|
|
952
|
-
throw new Error(`Access to app ${access_tag} not found`);
|
|
953
|
-
}
|
|
954
|
-
const appData = await this.appApi.fetchApp(access.app_id, this.getUserAccess());
|
|
955
|
-
this.thirdPartyApps.push({ access_tag, app: appData });
|
|
956
|
-
return appData;
|
|
957
|
-
}
|
|
958
|
-
catch (e) {
|
|
959
|
-
throw e;
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
fetchThirdPartyAppActionByTag(actions, action_tag) {
|
|
963
|
-
const action = actions.find((action) => action.tag === action_tag);
|
|
964
|
-
if (!action) {
|
|
965
|
-
throw new Error(`Action ${action_tag} not found`);
|
|
966
|
-
}
|
|
967
|
-
return action;
|
|
968
|
-
}
|
|
969
|
-
async createFeature(data, throwErrorIfExists = false) {
|
|
970
|
-
try {
|
|
971
|
-
// TODO: figure out a way to check if this has run before, halt if it has
|
|
972
|
-
if (!this.fetchFeature(data.tag, false)) {
|
|
973
|
-
await validators_1.CreateIntegrationFeatureSchema.validateAsync(data);
|
|
974
|
-
await this.validateFeatureData(data);
|
|
975
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign(Object.assign({}, data), { component: enums_1.IntegrationComponents.FEATURE }), this.getUserAccess());
|
|
976
|
-
await this.initializeIntegration(this.integration_id);
|
|
977
|
-
}
|
|
978
|
-
else {
|
|
979
|
-
if (throwErrorIfExists)
|
|
980
|
-
throw new Error(`Feature ${data.tag} already exists`);
|
|
981
|
-
}
|
|
982
|
-
}
|
|
983
|
-
catch (e) {
|
|
984
|
-
throw e;
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
async updateFeature(tag, data) {
|
|
988
|
-
try {
|
|
989
|
-
const { _id } = this.fetchFeature(tag);
|
|
990
|
-
await validators_1.UpdateIntegrationFeatureSchema.validateAsync(data); // Change to update;
|
|
991
|
-
if (data.tag && this.fetchFeature(data.tag)) {
|
|
992
|
-
throw new Error(`tag ${tag} is in use`); // TODO: also check on the backend
|
|
993
|
-
}
|
|
994
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign(Object.assign({ _id }, data), { component: enums_1.IntegrationComponents.FEATURE }), this.getUserAccess());
|
|
995
|
-
await this.initializeIntegration(this.integration_id);
|
|
996
|
-
}
|
|
997
|
-
catch (e) {
|
|
998
|
-
throw e;
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
fetchFeature(tag, throwErrorIfExists = true) {
|
|
1002
|
-
const feature = this.integration.features.find((data) => data.tag === tag);
|
|
1003
|
-
if (!feature && throwErrorIfExists)
|
|
1004
|
-
throw new Error(`Feature ${tag} not found`);
|
|
1005
|
-
return feature;
|
|
1006
|
-
}
|
|
1007
|
-
fetchFeatures() {
|
|
1008
|
-
return this.integration.features;
|
|
1009
|
-
}
|
|
1010
|
-
async createDatabase(data, throwErrorIfExists = false) {
|
|
1011
|
-
try {
|
|
1012
|
-
// TODO: figure out a way to check if this has run before, halt if it has
|
|
1013
|
-
if (!this.fetchDatabase(data.tag)) {
|
|
1014
|
-
await validators_1.CreateIntegrationDatabaseSchema.validateAsync(data);
|
|
1015
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign(Object.assign({}, data), { component: enums_1.IntegrationComponents.DATABASE }), this.getUserAccess());
|
|
1016
|
-
await this.initializeIntegration(this.integration_id);
|
|
1017
|
-
}
|
|
1018
|
-
else {
|
|
1019
|
-
if (throwErrorIfExists)
|
|
1020
|
-
throw new Error(`Database ${data.tag} already exists`);
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
catch (e) {
|
|
1024
|
-
throw e;
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
async updateDatabase(tag, data) {
|
|
1028
|
-
try {
|
|
1029
|
-
const { _id } = this.fetchDatabase(tag);
|
|
1030
|
-
await validators_1.UpdateIntegrationDatabaseSchema.validateAsync(data); // Change to update;
|
|
1031
|
-
if (data.tag && this.fetchDatabase(data.tag)) {
|
|
1032
|
-
throw new Error(`tag ${tag} is in use`); // TODO: also check on the backend
|
|
1033
|
-
}
|
|
1034
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign(Object.assign({ _id }, data), { component: enums_1.IntegrationComponents.DATABASE }), this.getUserAccess());
|
|
1035
|
-
await this.initializeIntegration(this.integration_id);
|
|
1036
|
-
}
|
|
1037
|
-
catch (e) {
|
|
1038
|
-
throw e;
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
fetchDatabase(tag) {
|
|
1042
|
-
const database = this.integration.databases.find((data) => data.tag === tag);
|
|
1043
|
-
if (!database)
|
|
1044
|
-
throw new Error(`Function ${tag} not found`);
|
|
1045
|
-
return database;
|
|
1046
|
-
}
|
|
1047
|
-
fetchDatabases() {
|
|
1048
|
-
return this.integration.databases;
|
|
1049
|
-
}
|
|
1050
|
-
async createDatabaseAction(databaseTag, data, throwErrorIfExists) {
|
|
1051
|
-
try {
|
|
1052
|
-
if (!this.fetchDatabaseAction(databaseTag, data.tag)) {
|
|
1053
|
-
await validators_1.CreateIntegrationDatabaseSchema.validateAsync(data);
|
|
1054
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign(Object.assign({}, data), { databaseTag, component: enums_1.IntegrationComponents.DATABASE_ACTION }), this.getUserAccess());
|
|
1055
|
-
await this.initializeIntegration(this.integration_id);
|
|
1056
|
-
}
|
|
1057
|
-
else {
|
|
1058
|
-
if (throwErrorIfExists)
|
|
1059
|
-
throw new Error(`Database ${data.tag} already exists`);
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
catch (e) {
|
|
1063
|
-
throw e;
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
async fetchDatabaseAction(databaseTag, tag) {
|
|
1067
|
-
const database = this.integration.databases.find((data) => data.tag === databaseTag);
|
|
1068
|
-
if (!database)
|
|
1069
|
-
throw new Error(`Database ${tag} not found`);
|
|
1070
|
-
const action = database.actions.find((data) => data.tag === tag);
|
|
1071
|
-
if (!action)
|
|
1072
|
-
throw new Error(`Database action ${tag} not found`);
|
|
1073
|
-
return action;
|
|
1074
|
-
}
|
|
1075
|
-
async updateDatabaseAction(databaseTag, data) {
|
|
1076
|
-
try {
|
|
1077
|
-
const { _id } = await this.fetchDatabaseAction(databaseTag, data.tag);
|
|
1078
|
-
await validators_1.UpdateIntegrationDatabaseSchema.validateAsync(data); // Change to update;
|
|
1079
|
-
if (data.tag && this.fetchDatabaseAction(databaseTag, data.tag)) {
|
|
1080
|
-
throw new Error(`tag ${databaseTag} is in use`); // TODO: also check on the backend
|
|
1081
|
-
}
|
|
1082
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign(Object.assign({ _id }, data), { component: enums_1.IntegrationComponents.DATABASE_ACTION }), this.getUserAccess());
|
|
1083
|
-
await this.initializeIntegration(this.integration_id);
|
|
1084
|
-
}
|
|
1085
|
-
catch (e) {
|
|
1086
|
-
throw e;
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
async fetchDatabaseActions(databaseTag) {
|
|
1090
|
-
const database = this.integration.databases.find((data) => data.tag === databaseTag);
|
|
1091
|
-
if (!database)
|
|
1092
|
-
throw new Error(`Database ${databaseTag} not found`);
|
|
1093
|
-
return database.actions;
|
|
1094
|
-
}
|
|
1095
|
-
async createJob(data, throwErrorIfExists = false) {
|
|
1096
|
-
try {
|
|
1097
|
-
// TODO: figure out a way to check if this has run before, halt if it has
|
|
1098
|
-
if (!this.fetchJob(data.tag)) {
|
|
1099
|
-
await validators_1.CreateIntegrationJobSchema.validateAsync(data);
|
|
1100
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign(Object.assign({}, data), { component: enums_1.IntegrationComponents.JOB }), this.getUserAccess());
|
|
1101
|
-
await this.initializeIntegration(this.integration_id);
|
|
1102
|
-
}
|
|
1103
|
-
else {
|
|
1104
|
-
if (throwErrorIfExists)
|
|
1105
|
-
throw new Error(`Job ${data.tag} already exists`);
|
|
1106
|
-
}
|
|
1107
|
-
}
|
|
1108
|
-
catch (e) {
|
|
1109
|
-
throw e;
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
async updateJob(tag, data) {
|
|
1113
|
-
try {
|
|
1114
|
-
const { _id } = this.fetchJob(tag);
|
|
1115
|
-
await validators_1.UpdateIntegrationJobSchema.validateAsync(data); // Change to update;
|
|
1116
|
-
if (data.tag && this.fetchJob(data.tag)) {
|
|
1117
|
-
throw new Error(`tag ${tag} is in use`); // TODO: also check on the backend
|
|
1118
|
-
}
|
|
1119
|
-
await this.integrationApi.updateIntegration(this.integration_id, Object.assign(Object.assign({ _id }, data), { component: enums_1.IntegrationComponents.JOB }), this.getUserAccess());
|
|
1120
|
-
await this.initializeIntegration(this.integration_id);
|
|
1121
|
-
}
|
|
1122
|
-
catch (e) {
|
|
1123
|
-
throw e;
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
fetchJob(tag) {
|
|
1127
|
-
const job = this.integration.jobs.find((data) => data.tag === tag);
|
|
1128
|
-
if (!job)
|
|
1129
|
-
throw new Error(`Job ${tag} not found`);
|
|
1130
|
-
return job;
|
|
1131
|
-
}
|
|
1132
|
-
fetchJobs() {
|
|
1133
|
-
return this.integration.jobs;
|
|
1134
|
-
}
|
|
1135
|
-
runJobs() {
|
|
1136
|
-
throw new Error('Method not implemented.');
|
|
1137
|
-
}
|
|
1138
|
-
getUserAccess() {
|
|
1139
|
-
return {
|
|
1140
|
-
user_id: this.user_id,
|
|
1141
|
-
workspace_id: this.workspace_id,
|
|
1142
|
-
token: this.token,
|
|
1143
|
-
public_key: this.public_key,
|
|
1144
|
-
};
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
exports.default = IntegrationsBuilderService;
|
|
1148
|
-
//# sourceMappingURL=integration.service.js.map
|