@ductape/sdk 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -53
- package/dist/agents/agent-context.d.ts +100 -0
- package/dist/agents/agent-context.js +604 -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 +1253 -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 +1240 -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 +116 -9
- package/dist/api/services/appApi.service.js.map +1 -1
- package/dist/api/services/logsApi.service.d.ts +51 -0
- package/dist/api/services/logsApi.service.js +19 -2
- package/dist/api/services/logsApi.service.js.map +1 -1
- package/dist/api/services/pricingApi.service.d.ts +10 -0
- package/dist/api/services/pricingApi.service.js +34 -0
- package/dist/api/services/pricingApi.service.js.map +1 -0
- package/dist/api/services/processorApi.service.d.ts +900 -2
- package/dist/api/services/processorApi.service.js +665 -12
- package/dist/api/services/processorApi.service.js.map +1 -1
- package/dist/api/services/productsApi.service.d.ts +130 -1
- package/dist/api/services/productsApi.service.js +198 -11
- package/dist/api/services/productsApi.service.js.map +1 -1
- package/dist/api/services/resilienceApi.service.d.ts +106 -0
- package/dist/api/services/resilienceApi.service.js +224 -0
- package/dist/api/services/resilienceApi.service.js.map +1 -0
- package/dist/api/services/secretsApi.service.d.ts +50 -0
- package/dist/api/services/secretsApi.service.js +113 -0
- package/dist/api/services/secretsApi.service.js.map +1 -0
- package/dist/api/services/webhooksApi.service.js +13 -6
- package/dist/api/services/webhooksApi.service.js.map +1 -1
- package/dist/api/services/workflowApi.service.d.ts +199 -0
- package/dist/api/services/workflowApi.service.js +201 -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 +92 -1
- package/dist/api/urls.js +118 -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 +42 -33
- package/dist/apps/services/app.service.js +574 -223
- package/dist/apps/services/app.service.js.map +1 -1
- package/dist/apps/utils/auth-context-manager.d.ts +137 -0
- package/dist/apps/utils/auth-context-manager.js +248 -0
- package/dist/apps/utils/auth-context-manager.js.map +1 -0
- package/dist/apps/utils/credential-manager.d.ts +128 -0
- package/dist/apps/utils/credential-manager.js +199 -0
- package/dist/apps/utils/credential-manager.js.map +1 -0
- package/dist/apps/utils/index.d.ts +10 -0
- package/dist/apps/utils/index.js +54 -0
- package/dist/apps/utils/index.js.map +1 -0
- package/dist/apps/utils/input-helpers.d.ts +67 -0
- package/dist/apps/utils/input-helpers.js +185 -0
- package/dist/apps/utils/input-helpers.js.map +1 -0
- package/dist/apps/utils/input-resolver.d.ts +165 -0
- package/dist/apps/utils/input-resolver.js +477 -0
- package/dist/apps/utils/input-resolver.js.map +1 -0
- package/dist/apps/utils/oauth-manager.d.ts +196 -0
- package/dist/apps/utils/oauth-manager.js +429 -0
- package/dist/apps/utils/oauth-manager.js.map +1 -0
- package/dist/apps/validators/joi-validators/create.appAction.validator.d.ts +1 -2
- package/dist/apps/validators/joi-validators/create.appAction.validator.js +22 -2
- package/dist/apps/validators/joi-validators/create.appAction.validator.js.map +1 -1
- package/dist/apps/validators/joi-validators/update.app.validator.js +2 -0
- package/dist/apps/validators/joi-validators/update.app.validator.js.map +1 -1
- package/dist/apps/validators/joi-validators/update.appAction.validator.js +23 -2
- package/dist/apps/validators/joi-validators/update.appAction.validator.js.map +1 -1
- package/dist/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 +435 -0
- package/dist/brokers/brokers.service.js +1205 -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 +567 -0
- package/dist/brokers/types/index.js +8 -0
- package/dist/brokers/types/index.js.map +1 -0
- package/dist/brokers/utils/broker.util.d.ts +33 -0
- package/dist/brokers/utils/broker.util.js +125 -0
- package/dist/brokers/utils/broker.util.js.map +1 -0
- package/dist/{processor/services/messagebrokers → brokers/utils/providers}/aws-sqs.service.d.ts +3 -2
- package/dist/brokers/utils/providers/aws-sqs.service.js +71 -0
- package/dist/brokers/utils/providers/aws-sqs.service.js.map +1 -0
- package/dist/{processor/services/messagebrokers → brokers/utils/providers}/google-pubsub.service.d.ts +2 -2
- package/dist/{processor/services/messagebrokers → brokers/utils/providers}/google-pubsub.service.js +16 -7
- package/dist/brokers/utils/providers/google-pubsub.service.js.map +1 -0
- package/dist/brokers/utils/providers/index.d.ts +6 -0
- package/dist/brokers/utils/providers/index.js +16 -0
- package/dist/brokers/utils/providers/index.js.map +1 -0
- package/dist/brokers/utils/providers/kafka.service.d.ts +23 -0
- package/dist/brokers/utils/providers/kafka.service.js +131 -0
- package/dist/brokers/utils/providers/kafka.service.js.map +1 -0
- package/dist/brokers/utils/providers/nats.service.d.ts +18 -0
- package/dist/brokers/utils/providers/nats.service.js +63 -0
- package/dist/brokers/utils/providers/nats.service.js.map +1 -0
- package/dist/brokers/utils/providers/rabbitmq.service.d.ts +25 -0
- package/dist/brokers/utils/providers/rabbitmq.service.js +138 -0
- package/dist/brokers/utils/providers/rabbitmq.service.js.map +1 -0
- package/dist/{processor/services/messagebrokers → brokers/utils/providers}/redis.service.d.ts +3 -3
- package/dist/{processor/services/messagebrokers → brokers/utils/providers}/redis.service.js +25 -14
- package/dist/brokers/utils/providers/redis.service.js.map +1 -0
- package/dist/cache/cache.manager.d.ts +308 -0
- package/dist/cache/cache.manager.js +900 -0
- package/dist/cache/cache.manager.js.map +1 -0
- package/dist/cache/cache.service.d.ts +191 -0
- package/dist/cache/cache.service.js +594 -0
- package/dist/cache/cache.service.js.map +1 -0
- package/dist/cache/index.d.ts +52 -0
- package/dist/cache/index.js +81 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/types/index.d.ts +110 -0
- package/dist/cache/types/index.js +6 -0
- package/dist/cache/types/index.js.map +1 -0
- package/dist/clients/apps.client.js +1 -1
- package/dist/clients/apps.client.js.map +1 -1
- package/dist/clients/pricing.client.d.ts +3 -0
- package/dist/clients/pricing.client.js +33 -0
- package/dist/clients/pricing.client.js.map +1 -0
- package/dist/database/actions/action-manager.d.ts +170 -0
- package/dist/database/actions/action-manager.js +465 -0
- package/dist/database/actions/action-manager.js.map +1 -0
- package/dist/database/actions/index.d.ts +6 -0
- package/dist/database/actions/index.js +13 -0
- package/dist/database/actions/index.js.map +1 -0
- package/dist/database/adapters/adapter.factory.d.ts +62 -0
- package/dist/database/adapters/adapter.factory.js +97 -0
- package/dist/database/adapters/adapter.factory.js.map +1 -0
- package/dist/database/adapters/base.adapter.d.ts +423 -0
- package/dist/database/adapters/base.adapter.js +260 -0
- package/dist/database/adapters/base.adapter.js.map +1 -0
- package/dist/database/adapters/cassandra.adapter.d.ts +92 -0
- package/dist/database/adapters/cassandra.adapter.js +1091 -0
- package/dist/database/adapters/cassandra.adapter.js.map +1 -0
- package/dist/database/adapters/dynamodb.adapter.d.ts +110 -0
- package/dist/database/adapters/dynamodb.adapter.js +1564 -0
- package/dist/database/adapters/dynamodb.adapter.js.map +1 -0
- package/dist/database/adapters/index.d.ts +11 -0
- package/dist/database/adapters/index.js +27 -0
- package/dist/database/adapters/index.js.map +1 -0
- package/dist/database/adapters/mariadb.adapter.d.ts +100 -0
- package/dist/database/adapters/mariadb.adapter.js +247 -0
- package/dist/database/adapters/mariadb.adapter.js.map +1 -0
- package/dist/database/adapters/mongodb.adapter.d.ts +121 -0
- package/dist/database/adapters/mongodb.adapter.js +1284 -0
- package/dist/database/adapters/mongodb.adapter.js.map +1 -0
- package/dist/database/adapters/mysql.adapter.d.ts +86 -0
- package/dist/database/adapters/mysql.adapter.js +1371 -0
- package/dist/database/adapters/mysql.adapter.js.map +1 -0
- package/dist/database/adapters/postgresql.adapter.d.ts +90 -0
- package/dist/database/adapters/postgresql.adapter.js +1487 -0
- package/dist/database/adapters/postgresql.adapter.js.map +1 -0
- package/dist/database/databases.service.d.ts +1476 -0
- package/dist/database/databases.service.js +3068 -0
- package/dist/database/databases.service.js.map +1 -0
- package/dist/database/index.d.ts +46 -0
- package/dist/database/index.js +109 -0
- package/dist/database/index.js.map +1 -0
- package/dist/database/migrations/index.d.ts +6 -0
- package/dist/database/migrations/index.js +12 -0
- package/dist/database/migrations/index.js.map +1 -0
- package/dist/database/migrations/migration-engine.d.ts +136 -0
- package/dist/database/migrations/migration-engine.js +1421 -0
- package/dist/database/migrations/migration-engine.js.map +1 -0
- package/dist/database/operators/aggregation-builder.d.ts +67 -0
- package/dist/database/operators/aggregation-builder.js +841 -0
- package/dist/database/operators/aggregation-builder.js.map +1 -0
- package/dist/database/operators/index.d.ts +7 -0
- package/dist/database/operators/index.js +15 -0
- package/dist/database/operators/index.js.map +1 -0
- package/dist/database/operators/query-builder.d.ts +69 -0
- package/dist/database/operators/query-builder.js +447 -0
- package/dist/database/operators/query-builder.js.map +1 -0
- package/dist/database/presave/decrypt.d.ts +25 -0
- package/dist/database/presave/decrypt.js +146 -0
- package/dist/database/presave/decrypt.js.map +1 -0
- package/dist/database/presave/index.d.ts +9 -0
- package/dist/database/presave/index.js +18 -0
- package/dist/database/presave/index.js.map +1 -0
- package/dist/database/presave/presave-processor.d.ts +148 -0
- package/dist/database/presave/presave-processor.js +702 -0
- package/dist/database/presave/presave-processor.js.map +1 -0
- package/dist/database/schema/index.d.ts +7 -0
- package/dist/database/schema/index.js +13 -0
- package/dist/database/schema/index.js.map +1 -0
- package/dist/database/schema/schema-manager.d.ts +258 -0
- package/dist/database/schema/schema-manager.js +638 -0
- package/dist/database/schema/schema-manager.js.map +1 -0
- package/dist/database/transactions/index.d.ts +6 -0
- package/dist/database/transactions/index.js +13 -0
- package/dist/database/transactions/index.js.map +1 -0
- package/dist/database/transactions/transaction-manager.d.ts +113 -0
- package/dist/database/transactions/transaction-manager.js +344 -0
- package/dist/database/transactions/transaction-manager.js.map +1 -0
- package/dist/database/triggers/index.d.ts +7 -0
- package/dist/database/triggers/index.js +14 -0
- package/dist/database/triggers/index.js.map +1 -0
- package/dist/database/triggers/trigger-processor.d.ts +239 -0
- package/dist/database/triggers/trigger-processor.js +1034 -0
- package/dist/database/triggers/trigger-processor.js.map +1 -0
- package/dist/database/types/action.interface.d.ts +148 -0
- package/dist/database/types/action.interface.js +6 -0
- package/dist/database/types/action.interface.js.map +1 -0
- package/dist/database/types/aggregation.interface.d.ts +185 -0
- package/dist/database/types/aggregation.interface.js +6 -0
- package/dist/database/types/aggregation.interface.js.map +1 -0
- package/dist/database/types/connection.interface.d.ts +137 -0
- package/dist/database/types/connection.interface.js +6 -0
- package/dist/database/types/connection.interface.js.map +1 -0
- package/dist/database/types/dashboard.interface.d.ts +74 -0
- package/dist/database/types/dashboard.interface.js +7 -0
- package/dist/database/types/dashboard.interface.js.map +1 -0
- package/dist/database/types/enums.d.ts +195 -0
- package/dist/database/types/enums.js +244 -0
- package/dist/database/types/enums.js.map +1 -0
- package/dist/database/types/index.d.ts +15 -0
- package/dist/database/types/index.js +31 -0
- package/dist/database/types/index.js.map +1 -0
- package/dist/database/types/migration.interface.d.ts +686 -0
- package/dist/database/types/migration.interface.js +9 -0
- package/dist/database/types/migration.interface.js.map +1 -0
- package/dist/database/types/presave.interface.d.ts +292 -0
- package/dist/database/types/presave.interface.js +60 -0
- package/dist/database/types/presave.interface.js.map +1 -0
- package/dist/database/types/query.interface.d.ts +205 -0
- package/dist/database/types/query.interface.js +6 -0
- package/dist/database/types/query.interface.js.map +1 -0
- package/dist/database/types/schema.interface.d.ts +412 -0
- package/dist/database/types/schema.interface.js +6 -0
- package/dist/database/types/schema.interface.js.map +1 -0
- package/dist/database/types/transaction.interface.d.ts +84 -0
- package/dist/database/types/transaction.interface.js +6 -0
- package/dist/database/types/transaction.interface.js.map +1 -0
- package/dist/database/types/trigger.interface.d.ts +612 -0
- package/dist/database/types/trigger.interface.js +121 -0
- package/dist/database/types/trigger.interface.js.map +1 -0
- package/dist/database/types/write.interface.d.ts +216 -0
- package/dist/database/types/write.interface.js +6 -0
- package/dist/database/types/write.interface.js.map +1 -0
- package/dist/database/utils/database-error.d.ts +96 -0
- package/dist/database/utils/database-error.js +221 -0
- package/dist/database/utils/database-error.js.map +1 -0
- package/dist/database/utils/index.d.ts +6 -0
- package/dist/database/utils/index.js +11 -0
- package/dist/database/utils/index.js.map +1 -0
- package/dist/graph/adapters/adapter.factory.d.ts +47 -0
- package/dist/graph/adapters/adapter.factory.js +77 -0
- package/dist/graph/adapters/adapter.factory.js.map +1 -0
- package/dist/graph/adapters/arangodb.adapter.d.ts +86 -0
- package/dist/graph/adapters/arangodb.adapter.js +1588 -0
- package/dist/graph/adapters/arangodb.adapter.js.map +1 -0
- package/dist/graph/adapters/base.adapter.d.ts +264 -0
- package/dist/graph/adapters/base.adapter.js +156 -0
- package/dist/graph/adapters/base.adapter.js.map +1 -0
- package/dist/graph/adapters/index.d.ts +11 -0
- package/dist/graph/adapters/index.js +21 -0
- package/dist/graph/adapters/index.js.map +1 -0
- package/dist/graph/adapters/memgraph.adapter.d.ts +110 -0
- package/dist/graph/adapters/memgraph.adapter.js +1452 -0
- package/dist/graph/adapters/memgraph.adapter.js.map +1 -0
- package/dist/graph/adapters/neo4j.adapter.d.ts +81 -0
- package/dist/graph/adapters/neo4j.adapter.js +1317 -0
- package/dist/graph/adapters/neo4j.adapter.js.map +1 -0
- package/dist/graph/adapters/neptune.adapter.d.ts +82 -0
- package/dist/graph/adapters/neptune.adapter.js +1369 -0
- package/dist/graph/adapters/neptune.adapter.js.map +1 -0
- package/dist/graph/graphs.service.d.ts +606 -0
- package/dist/graph/graphs.service.js +2434 -0
- package/dist/graph/graphs.service.js.map +1 -0
- package/dist/graph/index.d.ts +57 -0
- package/dist/graph/index.js +77 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/transactions/index.d.ts +4 -0
- package/dist/graph/transactions/index.js +9 -0
- package/dist/graph/transactions/index.js.map +1 -0
- package/dist/graph/transactions/transaction-manager.d.ts +61 -0
- package/dist/graph/transactions/transaction-manager.js +126 -0
- package/dist/graph/transactions/transaction-manager.js.map +1 -0
- package/dist/graph/types/connection.interface.d.ts +149 -0
- package/dist/graph/types/connection.interface.js +9 -0
- package/dist/graph/types/connection.interface.js.map +1 -0
- package/dist/graph/types/enums.d.ts +101 -0
- package/dist/graph/types/enums.js +114 -0
- package/dist/graph/types/enums.js.map +1 -0
- package/dist/graph/types/index.d.ts +13 -0
- package/dist/graph/types/index.js +20 -0
- package/dist/graph/types/index.js.map +1 -0
- package/dist/graph/types/node.interface.d.ts +248 -0
- package/dist/graph/types/node.interface.js +9 -0
- package/dist/graph/types/node.interface.js.map +1 -0
- package/dist/graph/types/query.interface.d.ts +175 -0
- package/dist/graph/types/query.interface.js +9 -0
- package/dist/graph/types/query.interface.js.map +1 -0
- package/dist/graph/types/relationship.interface.d.ts +207 -0
- package/dist/graph/types/relationship.interface.js +9 -0
- package/dist/graph/types/relationship.interface.js.map +1 -0
- package/dist/graph/types/schema.interface.d.ts +295 -0
- package/dist/graph/types/schema.interface.js +9 -0
- package/dist/graph/types/schema.interface.js.map +1 -0
- package/dist/graph/types/transaction.interface.d.ts +55 -0
- package/dist/graph/types/transaction.interface.js +9 -0
- package/dist/graph/types/transaction.interface.js.map +1 -0
- package/dist/graph/types/traversal.interface.d.ts +181 -0
- package/dist/graph/types/traversal.interface.js +9 -0
- package/dist/graph/types/traversal.interface.js.map +1 -0
- package/dist/graph/utils/graph-error.d.ts +71 -0
- package/dist/graph/utils/graph-error.js +142 -0
- package/dist/graph/utils/graph-error.js.map +1 -0
- package/dist/graph/utils/index.d.ts +4 -0
- package/dist/graph/utils/index.js +9 -0
- package/dist/graph/utils/index.js.map +1 -0
- package/dist/imports/imports.service.d.ts +3 -3
- package/dist/imports/imports.service.js +8 -7
- package/dist/imports/imports.service.js.map +1 -1
- package/dist/imports/imports.types.d.ts +8 -0
- package/dist/imports/repos/openApi.repo.d.ts +1 -2
- package/dist/imports/repos/openApi.repo.js +409 -70
- 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 +3926 -269
- package/dist/index.js +5475 -682
- package/dist/index.js.map +1 -1
- package/dist/init.interface.d.ts +407 -0
- package/dist/{processor/services/messagebrokers/messagebrokers.type.js → init.interface.js} +1 -1
- package/dist/init.interface.js.map +1 -0
- package/dist/inputs/inputs.service.d.ts +1 -1
- package/dist/inputs/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.service.js +6 -1
- package/dist/logs/logs.service.js.map +1 -1
- package/dist/logs/logs.types.d.ts +33 -1
- package/dist/logs/logs.types.js +17 -0
- package/dist/logs/logs.types.js.map +1 -1
- package/dist/models/index.d.ts +6 -0
- package/dist/models/index.js +11 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/models.service.d.ts +137 -0
- package/dist/models/models.service.js +195 -0
- package/dist/models/models.service.js.map +1 -0
- package/dist/notifications/index.d.ts +13 -0
- package/dist/notifications/index.js +26 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/notifications/notifications.service.d.ts +268 -0
- package/dist/notifications/notifications.service.js +905 -0
- package/dist/notifications/notifications.service.js.map +1 -0
- package/dist/notifications/types/index.d.ts +4 -0
- package/dist/notifications/types/index.js +21 -0
- package/dist/notifications/types/index.js.map +1 -0
- package/dist/notifications/types/notifications.types.d.ts +452 -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/repos/sms.repo.d.ts +4 -4
- package/dist/processor/repos/sms.repo.js +23 -10
- package/dist/processor/repos/sms.repo.js.map +1 -1
- package/dist/processor/services/processor.service.d.ts +251 -78
- package/dist/processor/services/processor.service.js +2803 -1495
- 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 +8 -0
- package/dist/processor/utils/processor.utils.js +152 -12
- 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/processor/utils/storage.util.js +63 -40
- package/dist/processor/utils/storage.util.js.map +1 -1
- package/dist/products/services/products.service.d.ts +386 -76
- package/dist/products/services/products.service.js +3221 -419
- 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.productApp.validator.js +2 -2
- package/dist/products/validators/joi-validators/create.productApp.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productDatabase.validator.js +5 -0
- package/dist/products/validators/joi-validators/create.productDatabase.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productEnv.validator.js +1 -0
- package/dist/products/validators/joi-validators/create.productEnv.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productFeature.validator.js +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/{processor/services/messagebrokers/rabbitmq.service.js → products/validators/joi-validators/create.productHealthcheck.validator.js} +23 -32
- package/dist/products/validators/joi-validators/create.productHealthcheck.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/create.productJob.validator.js +2 -2
- package/dist/products/validators/joi-validators/create.productJob.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productMessageBrokerTopic.validator.js +1 -0
- package/dist/products/validators/joi-validators/create.productMessageBrokerTopic.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js +81 -25
- package/dist/products/validators/joi-validators/create.productMessageBrokers.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productModel.validator.d.ts +3 -0
- package/dist/products/validators/joi-validators/create.productModel.validator.js +132 -0
- package/dist/products/validators/joi-validators/create.productModel.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/create.productNotification.validator.js +150 -51
- package/dist/products/validators/joi-validators/create.productNotification.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productStorage.validator.js +77 -18
- package/dist/products/validators/joi-validators/create.productStorage.validator.js.map +1 -1
- package/dist/products/validators/joi-validators/create.productVector.validator.d.ts +3 -0
- package/dist/products/validators/joi-validators/create.productVector.validator.js +136 -0
- package/dist/products/validators/joi-validators/create.productVector.validator.js.map +1 -0
- package/dist/products/validators/joi-validators/create.userAuth.validator.js +1 -0
- package/dist/products/validators/joi-validators/create.userAuth.validator.js.map +1 -1
- 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/products/validators/joi-validators/update.userAuth.validator.js +1 -0
- package/dist/products/validators/joi-validators/update.userAuth.validator.js.map +1 -1
- package/dist/resilience/fallback.service.d.ts +141 -0
- package/dist/resilience/fallback.service.js +766 -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 +83 -0
- package/dist/resilience/quota.service.js +518 -0
- package/dist/resilience/quota.service.js.map +1 -0
- package/dist/resilience/resilience.service.d.ts +98 -0
- package/dist/resilience/resilience.service.js +560 -0
- package/dist/resilience/resilience.service.js.map +1 -0
- package/dist/resilience/types/index.d.ts +513 -0
- package/dist/resilience/types/index.js +29 -0
- package/dist/resilience/types/index.js.map +1 -0
- package/dist/secrets/index.d.ts +10 -0
- package/dist/secrets/index.js +33 -0
- package/dist/secrets/index.js.map +1 -0
- package/dist/secrets/secrets.resolver.d.ts +52 -0
- package/dist/secrets/secrets.resolver.js +236 -0
- package/dist/secrets/secrets.resolver.js.map +1 -0
- package/dist/secrets/secrets.service.d.ts +93 -0
- package/dist/secrets/secrets.service.js +246 -0
- package/dist/secrets/secrets.service.js.map +1 -0
- package/dist/secrets/secrets.types.d.ts +188 -0
- package/dist/secrets/secrets.types.js +87 -0
- package/dist/secrets/secrets.types.js.map +1 -0
- package/dist/sessions/index.d.ts +50 -0
- package/dist/sessions/index.js +96 -0
- package/dist/sessions/index.js.map +1 -0
- package/dist/sessions/sessions.helper.d.ts +88 -0
- package/dist/sessions/sessions.helper.js +133 -0
- package/dist/sessions/sessions.helper.js.map +1 -0
- package/dist/sessions/sessions.resolver.d.ts +188 -0
- package/dist/sessions/sessions.resolver.js +603 -0
- package/dist/sessions/sessions.resolver.js.map +1 -0
- package/dist/sessions/sessions.service.d.ts +194 -0
- package/dist/sessions/sessions.service.js +987 -0
- package/dist/sessions/sessions.service.js.map +1 -0
- package/dist/sessions/types/index.d.ts +342 -0
- package/dist/sessions/types/index.js +6 -0
- package/dist/sessions/types/index.js.map +1 -0
- package/dist/storage/index.d.ts +66 -0
- package/dist/storage/index.js +99 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/storage.service.d.ts +177 -0
- package/dist/storage/storage.service.js +897 -0
- package/dist/storage/storage.service.js.map +1 -0
- package/dist/storage/types/index.d.ts +267 -0
- package/dist/storage/types/index.js +6 -0
- package/dist/storage/types/index.js.map +1 -0
- package/dist/storage/utils/storage.util.d.ts +62 -0
- package/dist/storage/utils/storage.util.js +593 -0
- package/dist/storage/utils/storage.util.js.map +1 -0
- package/dist/types/appBuilder.types.d.ts +13 -14
- 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 +9 -4
- package/dist/types/index.types.js +0 -1
- package/dist/types/index.types.js.map +1 -1
- package/dist/types/inputs.types.d.ts +1 -0
- package/dist/types/inputs.types.js +4 -3
- package/dist/types/inputs.types.js.map +1 -1
- package/dist/types/pricing.types.d.ts +4 -0
- package/dist/types/pricing.types.js +3 -0
- package/dist/types/pricing.types.js.map +1 -0
- package/dist/types/processor.types.d.ts +324 -18
- package/dist/types/processor.types.js +9 -1
- package/dist/types/processor.types.js.map +1 -1
- package/dist/types/productsBuilder.types.d.ts +1007 -23
- package/dist/types/productsBuilder.types.js +216 -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/actions/action-manager.d.ts +140 -0
- package/dist/vector/actions/action-manager.js +356 -0
- package/dist/vector/actions/action-manager.js.map +1 -0
- package/dist/vector/adapters/base.adapter.d.ts +169 -0
- package/dist/vector/adapters/base.adapter.js +218 -0
- package/dist/vector/adapters/base.adapter.js.map +1 -0
- package/dist/vector/adapters/index.d.ts +10 -0
- package/dist/vector/adapters/index.js +19 -0
- package/dist/vector/adapters/index.js.map +1 -0
- package/dist/vector/adapters/memory.adapter.d.ts +85 -0
- package/dist/vector/adapters/memory.adapter.js +505 -0
- package/dist/vector/adapters/memory.adapter.js.map +1 -0
- package/dist/vector/adapters/pinecone.adapter.d.ts +52 -0
- package/dist/vector/adapters/pinecone.adapter.js +433 -0
- package/dist/vector/adapters/pinecone.adapter.js.map +1 -0
- package/dist/vector/adapters/qdrant.adapter.d.ts +56 -0
- package/dist/vector/adapters/qdrant.adapter.js +442 -0
- package/dist/vector/adapters/qdrant.adapter.js.map +1 -0
- package/dist/vector/adapters/weaviate.adapter.d.ts +68 -0
- package/dist/vector/adapters/weaviate.adapter.js +661 -0
- package/dist/vector/adapters/weaviate.adapter.js.map +1 -0
- package/dist/vector/index.d.ts +36 -0
- package/dist/vector/index.js +70 -0
- package/dist/vector/index.js.map +1 -0
- package/dist/vector/types/action.interface.d.ts +195 -0
- package/dist/vector/types/action.interface.js +100 -0
- package/dist/vector/types/action.interface.js.map +1 -0
- package/dist/vector/types/connection.interface.d.ts +151 -0
- package/dist/vector/types/connection.interface.js +8 -0
- package/dist/vector/types/connection.interface.js.map +1 -0
- package/dist/vector/types/embedding.interface.d.ts +144 -0
- package/dist/vector/types/embedding.interface.js +8 -0
- package/dist/vector/types/embedding.interface.js.map +1 -0
- package/dist/vector/types/enums.d.ts +104 -0
- package/dist/vector/types/enums.js +113 -0
- package/dist/vector/types/enums.js.map +1 -0
- package/dist/vector/types/index.d.ts +11 -0
- package/dist/vector/types/index.js +23 -0
- package/dist/vector/types/index.js.map +1 -0
- package/dist/vector/types/vector.interface.d.ts +315 -0
- package/dist/vector/types/vector.interface.js +8 -0
- package/dist/vector/types/vector.interface.js.map +1 -0
- package/dist/vector/utils/index.d.ts +6 -0
- package/dist/vector/utils/index.js +11 -0
- package/dist/vector/utils/index.js.map +1 -0
- package/dist/vector/utils/vector-error.d.ts +69 -0
- package/dist/vector/utils/vector-error.js +116 -0
- package/dist/vector/utils/vector-error.js.map +1 -0
- package/dist/vector/vector-database.service.d.ts +476 -0
- package/dist/vector/vector-database.service.js +892 -0
- package/dist/vector/vector-database.service.js.map +1 -0
- package/dist/vector/vector.service.d.ts +283 -0
- package/dist/vector/vector.service.js +544 -0
- package/dist/vector/vector.service.js.map +1 -0
- package/dist/warehouse/executor/index.d.ts +5 -0
- package/dist/warehouse/executor/index.js +12 -0
- package/dist/warehouse/executor/index.js.map +1 -0
- package/dist/warehouse/executor/joins/index.d.ts +5 -0
- package/dist/warehouse/executor/joins/index.js +11 -0
- package/dist/warehouse/executor/joins/index.js.map +1 -0
- package/dist/warehouse/executor/joins/join-executor.d.ts +101 -0
- package/dist/warehouse/executor/joins/join-executor.js +493 -0
- package/dist/warehouse/executor/joins/join-executor.js.map +1 -0
- package/dist/warehouse/executor/joins/semantic-join.d.ts +64 -0
- package/dist/warehouse/executor/joins/semantic-join.js +241 -0
- package/dist/warehouse/executor/joins/semantic-join.js.map +1 -0
- package/dist/warehouse/executor/single-source-executor.d.ts +155 -0
- package/dist/warehouse/executor/single-source-executor.js +573 -0
- package/dist/warehouse/executor/single-source-executor.js.map +1 -0
- package/dist/warehouse/index.d.ts +79 -0
- package/dist/warehouse/index.js +111 -0
- package/dist/warehouse/index.js.map +1 -0
- package/dist/warehouse/parser/index.d.ts +4 -0
- package/dist/warehouse/parser/index.js +10 -0
- package/dist/warehouse/parser/index.js.map +1 -0
- package/dist/warehouse/parser/query-parser.d.ts +181 -0
- package/dist/warehouse/parser/query-parser.js +415 -0
- package/dist/warehouse/parser/query-parser.js.map +1 -0
- package/dist/warehouse/registry/data-source-registry.d.ts +207 -0
- package/dist/warehouse/registry/data-source-registry.js +396 -0
- package/dist/warehouse/registry/data-source-registry.js.map +1 -0
- package/dist/warehouse/registry/index.d.ts +4 -0
- package/dist/warehouse/registry/index.js +9 -0
- package/dist/warehouse/registry/index.js.map +1 -0
- package/dist/warehouse/transactions/index.d.ts +4 -0
- package/dist/warehouse/transactions/index.js +9 -0
- package/dist/warehouse/transactions/index.js.map +1 -0
- package/dist/warehouse/transactions/saga-orchestrator.d.ts +92 -0
- package/dist/warehouse/transactions/saga-orchestrator.js +383 -0
- package/dist/warehouse/transactions/saga-orchestrator.js.map +1 -0
- package/dist/warehouse/types/index.d.ts +9 -0
- package/dist/warehouse/types/index.js +33 -0
- package/dist/warehouse/types/index.js.map +1 -0
- package/dist/warehouse/types/join.interface.d.ts +225 -0
- package/dist/warehouse/types/join.interface.js +87 -0
- package/dist/warehouse/types/join.interface.js.map +1 -0
- package/dist/warehouse/types/query.interface.d.ts +232 -0
- package/dist/warehouse/types/query.interface.js +9 -0
- package/dist/warehouse/types/query.interface.js.map +1 -0
- package/dist/warehouse/types/transaction.interface.d.ts +236 -0
- package/dist/warehouse/types/transaction.interface.js +74 -0
- package/dist/warehouse/types/transaction.interface.js.map +1 -0
- package/dist/warehouse/types/where.interface.d.ts +208 -0
- package/dist/warehouse/types/where.interface.js +89 -0
- package/dist/warehouse/types/where.interface.js.map +1 -0
- package/dist/warehouse/warehouse.service.d.ts +200 -0
- package/dist/warehouse/warehouse.service.js +470 -0
- package/dist/warehouse/warehouse.service.js.map +1 -0
- package/dist/workflows/index.d.ts +30 -0
- package/dist/workflows/index.js +64 -0
- package/dist/workflows/index.js.map +1 -0
- package/dist/workflows/types/index.d.ts +6 -0
- package/dist/workflows/types/index.js +23 -0
- package/dist/workflows/types/index.js.map +1 -0
- package/dist/workflows/types/workflows.types.d.ts +1095 -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 +353 -0
- package/dist/workflows/workflow-builder.js.map +1 -0
- package/dist/workflows/workflow-executor.d.ts +287 -0
- package/dist/workflows/workflow-executor.js +2399 -0
- package/dist/workflows/workflow-executor.js.map +1 -0
- package/dist/workflows/workflows.service.d.ts +412 -0
- package/dist/workflows/workflows.service.js +2188 -0
- package/dist/workflows/workflows.service.js.map +1 -0
- package/package.json +83 -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.d.ts +0 -0
- package/dist/actions/utils/actions.util.read.js +0 -427
- package/dist/actions/utils/actions.util.read.js.map +0 -1
- package/dist/api/services/integrationsApi.service.d.ts +0 -18
- package/dist/api/services/integrationsApi.service.js +0 -80
- package/dist/api/services/integrationsApi.service.js.map +0 -1
- package/dist/appBuilder/services/app.service.d.ts +0 -111
- package/dist/appBuilder/services/app.service.js +0 -737
- package/dist/appBuilder/services/app.service.js.map +0 -1
- package/dist/appBuilder/services/appBuilder.service.d.ts +0 -111
- package/dist/appBuilder/services/appBuilder.service.js +0 -662
- package/dist/appBuilder/services/appBuilder.service.js.map +0 -1
- package/dist/appBuilder/utils/objects.utils.d.ts +0 -3
- package/dist/appBuilder/utils/objects.utils.js +0 -9
- package/dist/appBuilder/utils/objects.utils.js.map +0 -1
- package/dist/appBuilder/utils/string.utils.d.ts +0 -2
- package/dist/appBuilder/utils/string.utils.js +0 -57
- package/dist/appBuilder/utils/string.utils.js.map +0 -1
- package/dist/appBuilder/validators/index.d.ts +0 -19
- package/dist/appBuilder/validators/index.js +0 -40
- package/dist/appBuilder/validators/index.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.app.validator.js +0 -10
- package/dist/appBuilder/validators/joi-validators/create.app.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appAction.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appAction.validator.js +0 -20
- package/dist/appBuilder/validators/joi-validators/create.appAction.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appActionResponse.validator.d.ts +0 -7
- package/dist/appBuilder/validators/joi-validators/create.appActionResponse.validator.js +0 -44
- package/dist/appBuilder/validators/joi-validators/create.appActionResponse.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appAuth.validator.d.ts +0 -3
- package/dist/appBuilder/validators/joi-validators/create.appAuth.validator.js +0 -31
- package/dist/appBuilder/validators/joi-validators/create.appAuth.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appBody.validators.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appBody.validators.js +0 -11
- package/dist/appBuilder/validators/joi-validators/create.appBody.validators.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appConstants.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appConstants.validator.js +0 -12
- package/dist/appBuilder/validators/joi-validators/create.appConstants.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appEnv.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appEnv.validator.js +0 -17
- package/dist/appBuilder/validators/joi-validators/create.appEnv.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appEvent.validator.d.ts +0 -5
- package/dist/appBuilder/validators/joi-validators/create.appEvent.validator.js +0 -30
- package/dist/appBuilder/validators/joi-validators/create.appEvent.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/create.appVariable.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/create.appVariable.validator.js +0 -14
- package/dist/appBuilder/validators/joi-validators/create.appVariable.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/sample.validator.d.ts +0 -5
- package/dist/appBuilder/validators/joi-validators/sample.validator.js +0 -26
- package/dist/appBuilder/validators/joi-validators/sample.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.app.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.app.validator.js +0 -34
- package/dist/appBuilder/validators/joi-validators/update.app.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appAction.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appAction.validator.js +0 -23
- package/dist/appBuilder/validators/joi-validators/update.appAction.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appActionResponse.validator.d.ts +0 -3
- package/dist/appBuilder/validators/joi-validators/update.appActionResponse.validator.js +0 -21
- package/dist/appBuilder/validators/joi-validators/update.appActionResponse.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appAuth.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appAuth.validator.js +0 -19
- package/dist/appBuilder/validators/joi-validators/update.appAuth.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appConstants.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appConstants.validator.js +0 -12
- package/dist/appBuilder/validators/joi-validators/update.appConstants.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appEnv.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appEnv.validator.js +0 -17
- package/dist/appBuilder/validators/joi-validators/update.appEnv.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appEvent.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appEvent.validator.js +0 -16
- package/dist/appBuilder/validators/joi-validators/update.appEvent.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.appVariables.validator.d.ts +0 -4
- package/dist/appBuilder/validators/joi-validators/update.appVariables.validator.js +0 -14
- package/dist/appBuilder/validators/joi-validators/update.appVariables.validator.js.map +0 -1
- package/dist/appBuilder/validators/joi-validators/update.validation.entityData.validator.js +0 -27
- package/dist/appBuilder/validators/joi-validators/update.validation.entityData.validator.js.map +0 -1
- package/dist/apps/validators/joi-validators/create.appEvent.validator.d.ts +0 -5
- package/dist/apps/validators/joi-validators/create.appEvent.validator.js +0 -30
- package/dist/apps/validators/joi-validators/create.appEvent.validator.js.map +0 -1
- package/dist/apps/validators/joi-validators/update.appEvent.validator.d.ts +0 -4
- package/dist/apps/validators/joi-validators/update.appEvent.validator.js +0 -16
- package/dist/apps/validators/joi-validators/update.appEvent.validator.js.map +0 -1
- package/dist/clients/integrations.client.d.ts +0 -2
- package/dist/clients/integrations.client.js +0 -26
- package/dist/clients/integrations.client.js.map +0 -1
- package/dist/integrationsBuilder/services/integration.service.d.ts +0 -138
- package/dist/integrationsBuilder/services/integration.service.js +0 -1148
- package/dist/integrationsBuilder/services/integration.service.js.map +0 -1
- package/dist/integrationsBuilder/services/integrationBuilder.service.d.ts +0 -130
- package/dist/integrationsBuilder/services/integrationBuilder.service.js +0 -1017
- package/dist/integrationsBuilder/services/integrationBuilder.service.js.map +0 -1
- package/dist/integrationsBuilder/utils/objects.utils.d.ts +0 -2
- package/dist/integrationsBuilder/utils/objects.utils.js +0 -48
- package/dist/integrationsBuilder/utils/objects.utils.js.map +0 -1
- package/dist/integrationsBuilder/utils/string.utils.d.ts +0 -1
- package/dist/integrationsBuilder/utils/string.utils.js +0 -9
- package/dist/integrationsBuilder/utils/string.utils.js.map +0 -1
- package/dist/integrationsBuilder/validators/index.d.ts +0 -18
- package/dist/integrationsBuilder/validators/index.js +0 -38
- package/dist/integrationsBuilder/validators/index.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integration.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integration.validator.js +0 -10
- package/dist/integrationsBuilder/validators/joi-validators/create.integration.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationApp.validator.d.ts +0 -4
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationApp.validator.js +0 -26
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationApp.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationCache.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationCache.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationCache.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationDatabase.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationDatabase.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationDatabase.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationEnv.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationEnv.validator.js +0 -10
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationEnv.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFeature.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFeature.validator.js +0 -60
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFeature.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFunction.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFunction.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationFunction.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationJob.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationJob.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationJob.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationNotification.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationNotification.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/create.integrationNotification.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationApp.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationApp.validator.js +0 -9
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationApp.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationCache.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationCache.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationCache.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationDatabase.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationDatabase.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationDatabase.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationEnv.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationEnv.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationEnv.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFeature.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFeature.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFeature.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFunction.validator copy.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFunction.validator copy.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationFunction.validator copy.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationJob.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationJob.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationJob.validator.js.map +0 -1
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationNotification.validator.d.ts +0 -3
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationNotification.validator.js +0 -8
- package/dist/integrationsBuilder/validators/joi-validators/update.integrationNotification.validator.js.map +0 -1
- package/dist/postman.d.ts +0 -1
- package/dist/postman.js +0 -21674
- package/dist/postman.js.map +0 -1
- package/dist/processor/services/fallback.service.d.ts +0 -5
- package/dist/processor/services/fallback.service.js +0 -43
- package/dist/processor/services/fallback.service.js.map +0 -1
- package/dist/processor/services/messagebrokers/aws-sqs.service.js +0 -77
- package/dist/processor/services/messagebrokers/aws-sqs.service.js.map +0 -1
- package/dist/processor/services/messagebrokers/google-pubsub.service.js.map +0 -1
- package/dist/processor/services/messagebrokers/index.d.ts +0 -3
- package/dist/processor/services/messagebrokers/index.js +0 -26
- package/dist/processor/services/messagebrokers/index.js.map +0 -1
- package/dist/processor/services/messagebrokers/kafka.service.d.ts +0 -14
- package/dist/processor/services/messagebrokers/kafka.service.js +0 -45
- package/dist/processor/services/messagebrokers/kafka.service.js.map +0 -1
- package/dist/processor/services/messagebrokers/messagebrokers.type.d.ts +0 -6
- package/dist/processor/services/messagebrokers/messagebrokers.type.js.map +0 -1
- package/dist/processor/services/messagebrokers/rabbitmq.service.d.ts +0 -14
- package/dist/processor/services/messagebrokers/rabbitmq.service.js.map +0 -1
- package/dist/processor/services/messagebrokers/redis.service.js.map +0 -1
- package/dist/processor/services/quota.service.d.ts +0 -15
- package/dist/processor/services/quota.service.js +0 -63
- package/dist/processor/services/quota.service.js.map +0 -1
- package/dist/processor/utils/mongo.util.d.ts +0 -0
- package/dist/processor/utils/mongo.util.js +0 -152
- package/dist/processor/utils/mongo.util.js.map +0 -1
- package/dist/processor/utils/postgres.util.d.ts +0 -14
- package/dist/processor/utils/postgres.util.js +0 -83
- package/dist/processor/utils/postgres.util.js.map +0 -1
- package/dist/products/validators/joi-validators/create.product.validator.d.ts +0 -3
- package/dist/products/validators/joi-validators/create.product.validator.js +0 -10
- package/dist/products/validators/joi-validators/create.product.validator.js.map +0 -1
- package/dist/test/test.appBuilder.d.ts +0 -1
- package/dist/test/test.appBuilder.js +0 -16
- package/dist/test/test.appBuilder.js.map +0 -1
- package/dist/test/test.import.d.ts +0 -1
- package/dist/test/test.import.js +0 -1460
- package/dist/test/test.import.js.map +0 -1
- package/dist/test/test.import.openapi.d.ts +0 -1
- package/dist/test/test.import.openapi.js +0 -76
- package/dist/test/test.import.openapi.js.map +0 -1
- package/dist/test/test.imports.d.ts +0 -1
- package/dist/test/test.imports.js +0 -62
- package/dist/test/test.imports.js.map +0 -1
- package/dist/test/test.logs.d.ts +0 -1
- package/dist/test/test.logs.js +0 -18
- package/dist/test/test.logs.js.map +0 -1
- package/dist/test/test.processor.d.ts +0 -1
- package/dist/test/test.processor.js +0 -123
- package/dist/test/test.processor.js.map +0 -1
- package/dist/test/test.productBuilder.d.ts +0 -1
- package/dist/test/test.productBuilder.js +0 -661
- package/dist/test/test.productBuilder.js.map +0 -1
- package/dist/test.appBuilder.d.ts +0 -1
- package/dist/test.appBuilder.js +0 -14
- package/dist/test.appBuilder.js.map +0 -1
- package/dist/test.import.d.ts +0 -0
- package/dist/test.import.js +0 -24
- package/dist/test.import.js.map +0 -1
- package/dist/test.imports.d.ts +0 -1
- package/dist/test.imports.js +0 -28
- package/dist/test.imports.js.map +0 -1
- package/dist/test.integrationBuilder.d.ts +0 -1
- package/dist/test.integrationBuilder.js +0 -276
- package/dist/test.integrationBuilder.js.map +0 -1
- package/dist/test.processor.d.ts +0 -1
- package/dist/test.processor.js +0 -23
- package/dist/test.processor.js.map +0 -1
- package/dist/test.utils.d.ts +0 -1
- package/dist/test.utils.js +0 -25
- package/dist/test.utils.js.map +0 -1
- package/dist/types/integrationsBuilder.types.d.ts +0 -276
- package/dist/types/integrationsBuilder.types.js +0 -51
- package/dist/types/integrationsBuilder.types.js.map +0 -1
- /package/dist/{actions/actions.repo.d.ts → pricing/pricing.repo.d.ts} +0 -0
- /package/dist/{appBuilder/validators/joi-validators/create.app.validator.d.ts → products/validators/joi-validators/create.productGraph.validator.d.ts} +0 -0
- /package/dist/{appBuilder/validators/joi-validators/update.validation.entityData.validator.d.ts → products/validators/joi-validators/update.productGraph.validator.d.ts} +0 -0
- /package/dist/{actions/actions.service.d.ts → types/request-tracker.interface.d.ts} +0 -0
|
@@ -36,7 +36,7 @@ class AppBuilderService {
|
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
38
|
const app = await this.createNewApp(data);
|
|
39
|
-
await this.initializeApp(app._id);
|
|
39
|
+
//await this.initializeApp(app._id);
|
|
40
40
|
}
|
|
41
41
|
return { app_id: this.app._id };
|
|
42
42
|
}
|
|
@@ -44,12 +44,20 @@ class AppBuilderService {
|
|
|
44
44
|
throw e;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
initAppVersion() {
|
|
48
|
-
|
|
47
|
+
initAppVersion(versionTag) {
|
|
48
|
+
if (versionTag) {
|
|
49
|
+
this.appVersion = this.app.versions.find((version) => version.tag === versionTag);
|
|
50
|
+
if (!this.appVersion) {
|
|
51
|
+
throw new Error(`Version ${versionTag} not found`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
this.appVersion = this.app.versions.find((version) => version.latest === true);
|
|
56
|
+
}
|
|
49
57
|
}
|
|
50
58
|
async initializeAppByTag(app_tag) {
|
|
51
59
|
try {
|
|
52
|
-
this.app = await this.appApi.
|
|
60
|
+
this.app = await this.appApi.initApp(app_tag, this.getUserAccess());
|
|
53
61
|
this.app_id = this.app._id;
|
|
54
62
|
this.initAppVersion();
|
|
55
63
|
}
|
|
@@ -59,7 +67,7 @@ class AppBuilderService {
|
|
|
59
67
|
}
|
|
60
68
|
async initializeApp(app_id) {
|
|
61
69
|
try {
|
|
62
|
-
this.app = await this.appApi.
|
|
70
|
+
this.app = await this.appApi.initApp(app_id, this.getUserAccess());
|
|
63
71
|
this.app_id = app_id;
|
|
64
72
|
this.initAppVersion();
|
|
65
73
|
}
|
|
@@ -106,7 +114,7 @@ class AppBuilderService {
|
|
|
106
114
|
throw new Error('App not initialized');
|
|
107
115
|
await validators_1.UpdateAppBuilderSchema.validateAsync(data);
|
|
108
116
|
await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({}, data), { component: types_1.AppComponents.APP, action: types_1.RequestAction.UPDATE }), this.getUserAccess());
|
|
109
|
-
await this.initializeApp(this.app_id);
|
|
117
|
+
//await this.initializeApp(this.app_id);
|
|
110
118
|
}
|
|
111
119
|
catch (e) {
|
|
112
120
|
throw e;
|
|
@@ -115,10 +123,11 @@ class AppBuilderService {
|
|
|
115
123
|
async createEnv(data, throwErrorIfExists = false) {
|
|
116
124
|
try {
|
|
117
125
|
// TODO: figure out a way to check if this has run before, halt if it has
|
|
118
|
-
|
|
126
|
+
const existingEnv = await this.fetchEnv(data.slug, false);
|
|
127
|
+
if (!existingEnv) {
|
|
119
128
|
await validators_1.CreateAppEnvSchema.validateAsync(data);
|
|
120
129
|
await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({}, data), { component: types_1.AppComponents.ENV, action: types_1.RequestAction.CREATE }), this.getUserAccess());
|
|
121
|
-
await this.initializeApp(this.app_id);
|
|
130
|
+
//await this.initializeApp(this.app_id);
|
|
122
131
|
}
|
|
123
132
|
else {
|
|
124
133
|
if (throwErrorIfExists)
|
|
@@ -131,24 +140,29 @@ class AppBuilderService {
|
|
|
131
140
|
}
|
|
132
141
|
async updateEnv(slug, data) {
|
|
133
142
|
try {
|
|
134
|
-
// const { _id } = this.fetchEnv(slug);
|
|
143
|
+
// const { _id } = await this.fetchEnv(slug);
|
|
135
144
|
await validators_1.UpdateAppEnvSchema.validateAsync(Object.assign(Object.assign({}, data), { slug }));
|
|
136
|
-
if (data.slug
|
|
137
|
-
|
|
145
|
+
if (data.slug) {
|
|
146
|
+
const existingEnv = await this.fetchEnv(data.slug, false);
|
|
147
|
+
if (existingEnv) {
|
|
148
|
+
throw new Error(`slug ${slug} is in use`); // TODO: also check on the backend
|
|
149
|
+
}
|
|
138
150
|
}
|
|
139
151
|
// TODO: check
|
|
140
152
|
await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({ slug }, data), { component: types_1.AppComponents.ENV, action: types_1.RequestAction.UPDATE }), this.getUserAccess());
|
|
141
|
-
await this.initializeApp(this.app_id);
|
|
153
|
+
//await this.initializeApp(this.app_id);
|
|
142
154
|
}
|
|
143
155
|
catch (e) {
|
|
144
156
|
throw e;
|
|
145
157
|
}
|
|
146
158
|
}
|
|
147
|
-
fetchEnvs() {
|
|
148
|
-
|
|
159
|
+
async fetchEnvs() {
|
|
160
|
+
const components = await this.appApi.fetchAppComponents(this.app_id, 'env', this.getUserAccess(), this.appVersion.tag);
|
|
161
|
+
return components;
|
|
149
162
|
}
|
|
150
|
-
fetchEnv(slug, throwErrorIfExists = true) {
|
|
151
|
-
const
|
|
163
|
+
async fetchEnv(slug, throwErrorIfExists = true) {
|
|
164
|
+
const envs = await this.fetchEnvs();
|
|
165
|
+
const env = envs.find((data) => data.slug === slug);
|
|
152
166
|
if (!env && throwErrorIfExists)
|
|
153
167
|
throw new Error(`Env ${slug} not found`);
|
|
154
168
|
return env;
|
|
@@ -179,137 +193,418 @@ class AppBuilderService {
|
|
|
179
193
|
},
|
|
180
194
|
};
|
|
181
195
|
}
|
|
196
|
+
// Helper function to merge metadata into parsed schema data
|
|
197
|
+
mergeMetadataIntoSchema(parsedData, metadataMap) {
|
|
198
|
+
if (!metadataMap || Object.keys(metadataMap).length === 0) {
|
|
199
|
+
return parsedData;
|
|
200
|
+
}
|
|
201
|
+
return parsedData.map(item => {
|
|
202
|
+
const metadata = metadataMap[item.key || ''];
|
|
203
|
+
if (metadata) {
|
|
204
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, item), (metadata.minLength !== undefined ? { minLength: metadata.minLength } : {})), (metadata.maxLength !== undefined ? { maxLength: metadata.maxLength } : {})), (metadata.required !== undefined ? { required: metadata.required } : {})), (metadata.type !== undefined ? { type: metadata.type } : {}));
|
|
205
|
+
}
|
|
206
|
+
return item;
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
// Helper function to merge nested metadata for body fields
|
|
210
|
+
mergeNestedBodyMetadata(parsedData, fieldsMetadata) {
|
|
211
|
+
if (!fieldsMetadata || Object.keys(fieldsMetadata).length === 0) {
|
|
212
|
+
return parsedData;
|
|
213
|
+
}
|
|
214
|
+
const applyMetadataRecursively = (data, pathPrefix = '') => {
|
|
215
|
+
return data.map((item) => {
|
|
216
|
+
const fullPath = pathPrefix ? `${pathPrefix}.${item.key}` : item.key;
|
|
217
|
+
const metadata = fieldsMetadata[fullPath];
|
|
218
|
+
let updatedItem = Object.assign({}, item);
|
|
219
|
+
if (metadata) {
|
|
220
|
+
updatedItem = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, updatedItem), (metadata.minLength !== undefined ? { minLength: metadata.minLength } : {})), (metadata.maxLength !== undefined ? { maxLength: metadata.maxLength } : {})), (metadata.required !== undefined ? { required: metadata.required } : {})), (metadata.type !== undefined ? { type: metadata.type } : {}));
|
|
221
|
+
}
|
|
222
|
+
// Recursively apply to nested data (if the parsed item has nested structure)
|
|
223
|
+
if (updatedItem.data && Array.isArray(updatedItem.data) && updatedItem.data.length > 0) {
|
|
224
|
+
updatedItem.data = applyMetadataRecursively(updatedItem.data, fullPath);
|
|
225
|
+
}
|
|
226
|
+
return updatedItem;
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
return applyMetadataRecursively(parsedData);
|
|
230
|
+
}
|
|
182
231
|
async createAction(data, throwErrorIfExists = false) {
|
|
232
|
+
// Validate schema
|
|
233
|
+
await validators_1.CreateAppActionSchema.validateAsync(data);
|
|
234
|
+
data.tag = (0, string_utils_1.tagify)(data.tag);
|
|
235
|
+
const { tag } = data;
|
|
236
|
+
// Check if action already exists
|
|
237
|
+
let exists;
|
|
183
238
|
try {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
239
|
+
exists = await this.fetchAction(tag);
|
|
240
|
+
}
|
|
241
|
+
catch (e) {
|
|
242
|
+
exists = false;
|
|
243
|
+
}
|
|
244
|
+
if (exists && throwErrorIfExists) {
|
|
245
|
+
throw new Error(`App action ${tag} already exists`);
|
|
246
|
+
}
|
|
247
|
+
if (exists) {
|
|
248
|
+
return; // Silently skip if already exists and not throwing error
|
|
249
|
+
}
|
|
250
|
+
// Build the action body (similar to updateAction but without fetching existing action)
|
|
251
|
+
const body = Object.assign({ tag: data.tag, name: data.name, method: data.method, request_type: data.request_type || types_1.DataFormats.JSON, description: data.description || '', responses: [] }, (data.folder_id ? { folder_id: data.folder_id } : {}));
|
|
252
|
+
// Batch all parsing operations for parallel execution
|
|
253
|
+
const parseOperations = [];
|
|
254
|
+
const parseKeys = [];
|
|
255
|
+
// Prepare params parsing
|
|
256
|
+
if (data.params) {
|
|
257
|
+
parseKeys.push('params');
|
|
258
|
+
parseOperations.push(this.inputsService.parseJson({
|
|
259
|
+
data: data.params.sample,
|
|
260
|
+
expected: types_1.ExpectedValues.PARSESAMPLE,
|
|
261
|
+
category: types_1.Categories.PARAMS
|
|
262
|
+
}).then(parsedData => ({
|
|
263
|
+
key: 'params',
|
|
264
|
+
parsedData: parsedData,
|
|
265
|
+
metadata: this.extractMetadata(data.params)
|
|
266
|
+
})));
|
|
267
|
+
}
|
|
268
|
+
// Prepare query parsing
|
|
269
|
+
if (data.query) {
|
|
270
|
+
parseKeys.push('query');
|
|
271
|
+
parseOperations.push(this.inputsService.parseJson({
|
|
272
|
+
data: data.query.sample,
|
|
273
|
+
expected: types_1.ExpectedValues.PARSESAMPLE,
|
|
274
|
+
category: types_1.Categories.QUERY
|
|
275
|
+
}).then(parsedData => ({
|
|
276
|
+
key: 'query',
|
|
277
|
+
parsedData: parsedData,
|
|
278
|
+
metadata: this.extractMetadata(data.query)
|
|
279
|
+
})));
|
|
280
|
+
}
|
|
281
|
+
// Prepare body parsing
|
|
282
|
+
if (data.body) {
|
|
283
|
+
const fieldsMetadata = data.body.fieldsMetadata;
|
|
284
|
+
const bodySample = data.body.sample || data.body;
|
|
285
|
+
parseKeys.push('body');
|
|
286
|
+
parseOperations.push(this.inputsService.parseJson({
|
|
287
|
+
data: bodySample,
|
|
288
|
+
expected: types_1.ExpectedValues.PARSESAMPLE,
|
|
289
|
+
category: types_1.Categories.BODY
|
|
290
|
+
}).then(parsedData => ({
|
|
291
|
+
key: 'body',
|
|
292
|
+
parsedData: parsedData,
|
|
293
|
+
fieldsMetadata,
|
|
294
|
+
bodySample,
|
|
295
|
+
metadata: fieldsMetadata ? null : this.extractMetadata(data.body)
|
|
296
|
+
})));
|
|
297
|
+
}
|
|
298
|
+
// Prepare headers parsing
|
|
299
|
+
if (data.headers) {
|
|
300
|
+
parseKeys.push('headers');
|
|
301
|
+
parseOperations.push(this.inputsService.parseJson({
|
|
302
|
+
data: data.headers.sample,
|
|
303
|
+
expected: types_1.ExpectedValues.PARSESAMPLE,
|
|
304
|
+
category: types_1.Categories.HEADER
|
|
305
|
+
}).then(parsedData => ({
|
|
306
|
+
key: 'headers',
|
|
307
|
+
parsedData: parsedData,
|
|
308
|
+
metadata: this.extractMetadata(data.headers)
|
|
309
|
+
})));
|
|
310
|
+
}
|
|
311
|
+
// Prepare response parsing
|
|
312
|
+
if (data.response) {
|
|
313
|
+
parseKeys.push('response');
|
|
314
|
+
parseOperations.push(this.inputsService.parseJson({
|
|
315
|
+
data: data.response.body,
|
|
316
|
+
expected: types_1.ExpectedValues.PARSESAMPLE
|
|
317
|
+
}).then(parsedData => ({
|
|
318
|
+
key: 'response',
|
|
319
|
+
parsedData: parsedData
|
|
320
|
+
})));
|
|
321
|
+
}
|
|
322
|
+
// Execute all parsing operations in parallel
|
|
323
|
+
const parseResults = await Promise.all(parseOperations);
|
|
324
|
+
// Process parsed results
|
|
325
|
+
for (const result of parseResults) {
|
|
326
|
+
switch (result.key) {
|
|
327
|
+
case 'params':
|
|
328
|
+
body.params = {
|
|
329
|
+
type: types_1.InputsTypes.JSON,
|
|
330
|
+
sample: JSON.stringify(data.params.sample),
|
|
331
|
+
data: this.mergeMetadataIntoSchema(result.parsedData, result.metadata)
|
|
332
|
+
};
|
|
333
|
+
break;
|
|
334
|
+
case 'query':
|
|
335
|
+
body.query = {
|
|
336
|
+
type: types_1.InputsTypes.JSON,
|
|
337
|
+
sample: JSON.stringify(data.query.sample),
|
|
338
|
+
data: this.mergeMetadataIntoSchema(result.parsedData, result.metadata)
|
|
339
|
+
};
|
|
340
|
+
break;
|
|
341
|
+
case 'body':
|
|
342
|
+
let finalData = result.parsedData;
|
|
343
|
+
if (result.fieldsMetadata) {
|
|
344
|
+
finalData = this.mergeNestedBodyMetadata(result.parsedData, result.fieldsMetadata);
|
|
345
|
+
}
|
|
346
|
+
else if (result.metadata && Object.keys(result.metadata).length > 0) {
|
|
347
|
+
finalData = this.mergeMetadataIntoSchema(result.parsedData, result.metadata);
|
|
348
|
+
}
|
|
349
|
+
body.body = {
|
|
350
|
+
type: types_1.InputsTypes.JSON,
|
|
351
|
+
sample: JSON.stringify(result.bodySample),
|
|
352
|
+
data: finalData
|
|
353
|
+
};
|
|
354
|
+
break;
|
|
355
|
+
case 'headers':
|
|
356
|
+
body.headers = {
|
|
357
|
+
type: types_1.InputsTypes.JSON,
|
|
358
|
+
sample: JSON.stringify(data.headers.sample),
|
|
359
|
+
data: this.mergeMetadataIntoSchema(result.parsedData, result.metadata)
|
|
360
|
+
};
|
|
361
|
+
break;
|
|
362
|
+
case 'response':
|
|
363
|
+
const response = {
|
|
364
|
+
name: data.response.name || `Response - ${data.response.status_code}`,
|
|
365
|
+
tag: data.tag,
|
|
366
|
+
response_format: data.response.response_format,
|
|
367
|
+
status_code: data.response.status_code,
|
|
368
|
+
success: data.response.success,
|
|
369
|
+
body: {
|
|
370
|
+
sample: JSON.stringify(data.response.body),
|
|
371
|
+
type: types_1.InputsTypes.JSON,
|
|
372
|
+
data: result.parsedData,
|
|
373
|
+
status_code: data.response.status_code,
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
body.responses = [response];
|
|
377
|
+
break;
|
|
201
378
|
}
|
|
202
|
-
|
|
203
|
-
|
|
379
|
+
}
|
|
380
|
+
// Handle resource URL parsing
|
|
381
|
+
if (data.resource) {
|
|
382
|
+
body.resource = (0, strings_utils_1.extractURLPath)(data.resource);
|
|
383
|
+
// Only extract params/query from resource if they weren't already provided
|
|
384
|
+
if (!data.params && !data.query) {
|
|
385
|
+
const { params, query: queryData } = await this.extractResourceData(data.resource);
|
|
386
|
+
// Only set if not already defined and sample exists
|
|
387
|
+
if (!body.params && params.sample) {
|
|
388
|
+
body.params = {
|
|
389
|
+
type: types_1.InputsTypes.JSON,
|
|
390
|
+
sample: params.sample,
|
|
391
|
+
data: params.data
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
if (!body.query && queryData.sample) {
|
|
395
|
+
body.query = {
|
|
396
|
+
type: types_1.InputsTypes.JSON,
|
|
397
|
+
sample: queryData.sample,
|
|
398
|
+
data: queryData.data
|
|
399
|
+
};
|
|
400
|
+
}
|
|
204
401
|
}
|
|
205
402
|
}
|
|
206
|
-
|
|
207
|
-
|
|
403
|
+
// Create action via API
|
|
404
|
+
await this.updateActionProcess(tag, body, types_1.RequestAction.CREATE);
|
|
405
|
+
// Update local cache instead of full app refetch
|
|
406
|
+
//this.appVersion.actions.push(body as IAppAction);
|
|
407
|
+
}
|
|
408
|
+
// Helper method to extract metadata from data object
|
|
409
|
+
extractMetadata(data) {
|
|
410
|
+
const metadataMap = {};
|
|
411
|
+
if (data && data.data && Array.isArray(data.data)) {
|
|
412
|
+
data.data.forEach((item) => {
|
|
413
|
+
if (item.metadata) {
|
|
414
|
+
metadataMap[item.key] = item.metadata;
|
|
415
|
+
}
|
|
416
|
+
});
|
|
208
417
|
}
|
|
418
|
+
return metadataMap;
|
|
209
419
|
}
|
|
210
|
-
fetchActions() {
|
|
211
|
-
|
|
420
|
+
async fetchActions() {
|
|
421
|
+
const components = await this.appApi.fetchAppComponents(this.app_id, 'action', this.getUserAccess(), this.appVersion.tag);
|
|
422
|
+
return components;
|
|
212
423
|
}
|
|
213
|
-
fetchAction(identifier) {
|
|
214
|
-
const
|
|
424
|
+
async fetchAction(identifier) {
|
|
425
|
+
const actions = await this.fetchActions();
|
|
426
|
+
const action = actions.find((data) => data.tag === identifier || data._id === identifier);
|
|
215
427
|
if (!action)
|
|
216
428
|
throw new Error(`Action ${identifier} not found`);
|
|
217
429
|
return action;
|
|
218
430
|
}
|
|
219
431
|
async updateAction(tag, data) {
|
|
432
|
+
// Validate schema
|
|
220
433
|
await validators_1.UpdateAppActionSchema.validateAsync(data);
|
|
221
|
-
const action = this.fetchAction(tag);
|
|
434
|
+
const action = await this.fetchAction(tag);
|
|
222
435
|
const body = action;
|
|
223
436
|
if (!action) {
|
|
224
437
|
throw new Error(`Action ${tag} not found`);
|
|
225
438
|
}
|
|
439
|
+
// Batch all parsing operations for parallel execution
|
|
440
|
+
const parseOperations = [];
|
|
441
|
+
// Prepare params parsing
|
|
226
442
|
if (data.params) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
443
|
+
parseOperations.push(this.inputsService.parseJson({
|
|
444
|
+
data: data.params.sample,
|
|
445
|
+
expected: types_1.ExpectedValues.PARSESAMPLE,
|
|
446
|
+
category: types_1.Categories.PARAMS
|
|
447
|
+
}).then(parsedData => ({
|
|
448
|
+
key: 'params',
|
|
449
|
+
parsedData: parsedData
|
|
450
|
+
})));
|
|
232
451
|
}
|
|
452
|
+
// Prepare query parsing
|
|
233
453
|
if (data.query) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
}
|
|
454
|
+
parseOperations.push(this.inputsService.parseJson({
|
|
455
|
+
data: data.query.sample,
|
|
456
|
+
expected: types_1.ExpectedValues.PARSESAMPLE,
|
|
457
|
+
category: types_1.Categories.QUERY
|
|
458
|
+
}).then(parsedData => ({
|
|
459
|
+
key: 'query',
|
|
460
|
+
parsedData: parsedData
|
|
461
|
+
})));
|
|
239
462
|
}
|
|
463
|
+
// Prepare body parsing
|
|
240
464
|
if (data.body) {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
465
|
+
parseOperations.push(this.inputsService.parseJson({
|
|
466
|
+
data: data.body.sample,
|
|
467
|
+
expected: types_1.ExpectedValues.PARSESAMPLE,
|
|
468
|
+
category: types_1.Categories.BODY
|
|
469
|
+
}).then(parsedData => ({
|
|
470
|
+
key: 'body',
|
|
471
|
+
parsedData: parsedData
|
|
472
|
+
})));
|
|
246
473
|
}
|
|
474
|
+
// Prepare headers parsing
|
|
247
475
|
if (data.headers) {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
476
|
+
parseOperations.push(this.inputsService.parseJson({
|
|
477
|
+
data: data.headers.sample,
|
|
478
|
+
expected: types_1.ExpectedValues.PARSESAMPLE,
|
|
479
|
+
category: types_1.Categories.HEADER
|
|
480
|
+
}).then(parsedData => ({
|
|
481
|
+
key: 'headers',
|
|
482
|
+
parsedData: parsedData
|
|
483
|
+
})));
|
|
484
|
+
}
|
|
485
|
+
// Prepare response parsing
|
|
486
|
+
if (data.response) {
|
|
487
|
+
parseOperations.push(this.inputsService.parseJson({
|
|
488
|
+
data: data.response.body,
|
|
489
|
+
expected: types_1.ExpectedValues.PARSESAMPLE
|
|
490
|
+
}).then(parsedData => ({
|
|
491
|
+
key: 'response',
|
|
492
|
+
parsedData: parsedData
|
|
493
|
+
})));
|
|
494
|
+
}
|
|
495
|
+
// Execute all parsing operations in parallel
|
|
496
|
+
const parseResults = await Promise.all(parseOperations);
|
|
497
|
+
// Process parsed results
|
|
498
|
+
for (const result of parseResults) {
|
|
499
|
+
switch (result.key) {
|
|
500
|
+
case 'params':
|
|
501
|
+
body.params = {
|
|
502
|
+
type: types_1.InputsTypes.JSON,
|
|
503
|
+
sample: JSON.stringify(data.params),
|
|
504
|
+
data: result.parsedData
|
|
505
|
+
};
|
|
506
|
+
break;
|
|
507
|
+
case 'query':
|
|
508
|
+
body.query = {
|
|
509
|
+
type: types_1.InputsTypes.JSON,
|
|
510
|
+
sample: JSON.stringify(data.query),
|
|
511
|
+
data: result.parsedData
|
|
512
|
+
};
|
|
513
|
+
break;
|
|
514
|
+
case 'body':
|
|
515
|
+
body.body = {
|
|
516
|
+
type: types_1.InputsTypes.JSON,
|
|
517
|
+
sample: JSON.stringify(data.body),
|
|
518
|
+
data: result.parsedData
|
|
519
|
+
};
|
|
520
|
+
break;
|
|
521
|
+
case 'headers':
|
|
522
|
+
body.headers = {
|
|
523
|
+
type: types_1.InputsTypes.JSON,
|
|
524
|
+
sample: JSON.stringify(data.headers),
|
|
525
|
+
data: result.parsedData
|
|
526
|
+
};
|
|
527
|
+
break;
|
|
528
|
+
case 'response':
|
|
529
|
+
body.responses = action.responses;
|
|
530
|
+
const response = {
|
|
531
|
+
name: `Response - ${data.response.status_code}`,
|
|
532
|
+
response_format: data.response.response_format,
|
|
533
|
+
status_code: data.response.status_code,
|
|
534
|
+
success: data.response.success,
|
|
535
|
+
body: {
|
|
536
|
+
sample: JSON.stringify(data.response.body),
|
|
537
|
+
type: types_1.InputsTypes.JSON,
|
|
538
|
+
data: result.parsedData,
|
|
539
|
+
status_code: data.response.status_code,
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
const statusIndex = body.responses.findIndex((resp) => resp.status_code === data.response.status_code);
|
|
543
|
+
if (data.response.success === true) {
|
|
544
|
+
const index = action.responses.findIndex((resp) => resp.success === true);
|
|
545
|
+
if (index > -1) {
|
|
546
|
+
body.responses[index] = response;
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
if (statusIndex > -1) {
|
|
550
|
+
body.responses.splice(statusIndex, 1);
|
|
551
|
+
}
|
|
552
|
+
body.responses.push(response);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
else {
|
|
556
|
+
if (statusIndex > -1) {
|
|
557
|
+
body.responses.splice(statusIndex, 1);
|
|
558
|
+
}
|
|
559
|
+
body.responses.push(response);
|
|
560
|
+
}
|
|
561
|
+
break;
|
|
562
|
+
}
|
|
253
563
|
}
|
|
564
|
+
// Handle resource URL parsing
|
|
254
565
|
if (data.resource) {
|
|
255
|
-
const { params, query: queryData } = await this.extractResourceData(data.resource);
|
|
256
566
|
body.resource = (0, strings_utils_1.extractURLPath)(data.resource);
|
|
257
|
-
|
|
258
|
-
|
|
567
|
+
// Only extract params/query from resource if they weren't already provided in update data
|
|
568
|
+
if (!data.params && !data.query) {
|
|
569
|
+
const { params, query: queryData } = await this.extractResourceData(data.resource);
|
|
570
|
+
// Only set if not already defined in body (from existing action)
|
|
571
|
+
if (!body.params && params.sample) {
|
|
572
|
+
body.params = {
|
|
573
|
+
type: types_1.InputsTypes.JSON,
|
|
574
|
+
sample: params.sample,
|
|
575
|
+
data: params.data
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
if (!body.query && queryData.sample) {
|
|
579
|
+
body.query = {
|
|
580
|
+
type: types_1.InputsTypes.JSON,
|
|
581
|
+
sample: queryData.sample,
|
|
582
|
+
data: queryData.data
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
}
|
|
259
586
|
}
|
|
587
|
+
// Update simple fields
|
|
260
588
|
if (data.description) {
|
|
261
589
|
body.description = data.description;
|
|
262
590
|
}
|
|
263
|
-
/*if(body.description === ''){
|
|
264
|
-
body.description = undefined
|
|
265
|
-
}*/
|
|
266
591
|
if (data.method) {
|
|
267
592
|
body.method = data.method;
|
|
268
593
|
}
|
|
269
594
|
if (data.request_type) {
|
|
270
595
|
body.request_type = data.request_type;
|
|
271
596
|
}
|
|
272
|
-
|
|
273
|
-
body.responses = action.responses;
|
|
274
|
-
const response = {
|
|
275
|
-
name: `Response - ${data.response.status_code}`,
|
|
276
|
-
response_format: data.response.response_format,
|
|
277
|
-
status_code: data.response.status_code,
|
|
278
|
-
success: data.response.success,
|
|
279
|
-
body: {
|
|
280
|
-
sample: JSON.stringify(data.response.body),
|
|
281
|
-
type: types_1.InputsTypes.JSON,
|
|
282
|
-
data: await this.inputsService.parseJson({
|
|
283
|
-
data: data.response.body,
|
|
284
|
-
expected: types_1.ExpectedValues.PARSESAMPLE
|
|
285
|
-
}),
|
|
286
|
-
status_code: data.response.status_code,
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
const statusIndex = body.responses.findIndex((resp) => resp.status_code === data.response.status_code);
|
|
290
|
-
if (data.response.success === true) {
|
|
291
|
-
const index = action.responses.findIndex((resp) => resp.success === true);
|
|
292
|
-
if (index > -1) {
|
|
293
|
-
body.responses[index] = response;
|
|
294
|
-
}
|
|
295
|
-
else {
|
|
296
|
-
if (statusIndex > -1) {
|
|
297
|
-
body.responses.splice(statusIndex, 1);
|
|
298
|
-
}
|
|
299
|
-
body.responses.push(response);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
else {
|
|
303
|
-
if (statusIndex > -1) {
|
|
304
|
-
body.responses.splice(statusIndex, 1);
|
|
305
|
-
}
|
|
306
|
-
body.responses.push(response);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
597
|
+
// Update action via API
|
|
309
598
|
await this.updateActionProcess(tag, body, types_1.RequestAction.UPDATE);
|
|
599
|
+
// Update local cache instead of full app refetch
|
|
600
|
+
//const actionIndex = this.appVersion.actions.findIndex(a => a.tag === tag || a._id === action._id);
|
|
601
|
+
//if (actionIndex > -1) {
|
|
602
|
+
//this.appVersion.actions[actionIndex] = body as IAppAction;
|
|
603
|
+
//}
|
|
310
604
|
}
|
|
311
605
|
async updateActionProcess(tag, data, action) {
|
|
312
|
-
const query = Object.assign({ component: types_1.AppComponents.ACTION, action
|
|
606
|
+
const query = Object.assign({ component: types_1.AppComponents.ACTION, action,
|
|
607
|
+
tag }, data);
|
|
313
608
|
await this.appApi.updateApp(this.app_id, query, this.getUserAccess());
|
|
314
609
|
}
|
|
315
610
|
async createActionRequestData(category, tag, payload, throwErrorIfExists = false) {
|
|
@@ -341,10 +636,10 @@ class AppBuilderService {
|
|
|
341
636
|
return Object.assign(Object.assign({}, payload), { sample, data });
|
|
342
637
|
}
|
|
343
638
|
// private fetc
|
|
344
|
-
fetchActionRequestData(category, tag) {
|
|
639
|
+
async fetchActionRequestData(category, tag) {
|
|
345
640
|
try {
|
|
346
641
|
let data;
|
|
347
|
-
const action = this.fetchAction(tag);
|
|
642
|
+
const action = await this.fetchAction(tag);
|
|
348
643
|
if (category === types_1.Categories.BODY) {
|
|
349
644
|
const { body } = action;
|
|
350
645
|
data = body.data;
|
|
@@ -370,10 +665,10 @@ class AppBuilderService {
|
|
|
370
665
|
throw e;
|
|
371
666
|
}
|
|
372
667
|
}
|
|
373
|
-
fetchActionRequestSample(category, tag) {
|
|
668
|
+
async fetchActionRequestSample(category, tag) {
|
|
374
669
|
try {
|
|
375
670
|
let sample;
|
|
376
|
-
const action = this.fetchAction(tag);
|
|
671
|
+
const action = await this.fetchAction(tag);
|
|
377
672
|
if (category === types_1.Categories.BODY) {
|
|
378
673
|
const { body } = action;
|
|
379
674
|
sample = body.sample;
|
|
@@ -401,10 +696,10 @@ class AppBuilderService {
|
|
|
401
696
|
}
|
|
402
697
|
async createAppActionResponse(action_tag, payload) {
|
|
403
698
|
try {
|
|
404
|
-
this.fetchAction(action_tag);
|
|
699
|
+
await this.fetchAction(action_tag);
|
|
405
700
|
await validators_1.CreateAppActionResponseSchema.validateAsync(Object.assign({}, payload));
|
|
406
701
|
payload.tag = (0, string_utils_1.tagify)(payload.tag);
|
|
407
|
-
const exists = this.fetchAppActionResponse(action_tag, payload.tag);
|
|
702
|
+
const exists = await this.fetchAppActionResponse(action_tag, payload.tag);
|
|
408
703
|
if (!exists) {
|
|
409
704
|
payload = await this.parseResponsePayload(payload);
|
|
410
705
|
await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({}, payload), { action_tag, action: types_1.RequestAction.CREATE, component: types_1.AppComponents.ACTION_RESPONSE }), this.getUserAccess());
|
|
@@ -451,19 +746,21 @@ class AppBuilderService {
|
|
|
451
746
|
payload.body.data = data;
|
|
452
747
|
payload.body.sample = JSON.stringify(payload.body.sample);
|
|
453
748
|
if (payload.envs && payload.envs.length) {
|
|
454
|
-
|
|
455
|
-
const
|
|
456
|
-
return
|
|
457
|
-
});
|
|
749
|
+
const envIds = await Promise.all(payload.envs.map(async (slug) => {
|
|
750
|
+
const env = await this.fetchEnv(slug);
|
|
751
|
+
return env._id;
|
|
752
|
+
}));
|
|
753
|
+
payload.envs = envIds;
|
|
458
754
|
}
|
|
459
755
|
return payload;
|
|
460
756
|
}
|
|
461
|
-
fetchAppActionResponse(action_tag, response_tag, throwErrorIfExists = false) {
|
|
462
|
-
const
|
|
463
|
-
const
|
|
464
|
-
|
|
757
|
+
async fetchAppActionResponse(action_tag, response_tag, throwErrorIfExists = false) {
|
|
758
|
+
const action = await this.fetchAction(action_tag);
|
|
759
|
+
const { responses } = action;
|
|
760
|
+
const response = responses.find((data) => data.tag === response_tag);
|
|
761
|
+
if (!response && throwErrorIfExists)
|
|
465
762
|
throw new Error(`Response ${response_tag} not found`);
|
|
466
|
-
return
|
|
763
|
+
return response;
|
|
467
764
|
}
|
|
468
765
|
/*async extractEventData(data: Partial<IAppEvent>): Promise<Partial<IAppEvent>> {
|
|
469
766
|
if (data.response) {
|
|
@@ -541,7 +838,7 @@ class AppBuilderService {
|
|
|
541
838
|
this.getUserAccess(),
|
|
542
839
|
);
|
|
543
840
|
|
|
544
|
-
await this.initializeApp(this.app_id);
|
|
841
|
+
//await this.initializeApp(this.app_id);
|
|
545
842
|
} catch (e) {
|
|
546
843
|
throw e;
|
|
547
844
|
}
|
|
@@ -572,7 +869,7 @@ class AppBuilderService {
|
|
|
572
869
|
this.getUserAccess(),
|
|
573
870
|
);
|
|
574
871
|
|
|
575
|
-
await this.initializeApp(this.app_id);
|
|
872
|
+
//await this.initializeApp(this.app_id);
|
|
576
873
|
} catch (e) {
|
|
577
874
|
throw e;
|
|
578
875
|
}
|
|
@@ -647,11 +944,11 @@ class AppBuilderService {
|
|
|
647
944
|
throw new Error(`token has to have one of body, headers, params or query set`);
|
|
648
945
|
}
|
|
649
946
|
if (setup_type === types_1.AuthTypes.CREDENTIALS) {
|
|
650
|
-
this.fetchAction(action_tag);
|
|
947
|
+
await this.fetchAction(action_tag);
|
|
651
948
|
}
|
|
652
949
|
data = await this.extractAuthData(Object.assign({}, data));
|
|
653
950
|
await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({}, data), { action: types_1.RequestAction.CREATE, component: types_1.AppComponents.AUTH }), this.getUserAccess());
|
|
654
|
-
await this.initializeApp(this.app_id);
|
|
951
|
+
//await this.initializeApp(this.app_id);
|
|
655
952
|
}
|
|
656
953
|
catch (e) {
|
|
657
954
|
throw e;
|
|
@@ -660,21 +957,23 @@ class AppBuilderService {
|
|
|
660
957
|
async updateAuth(tag, data) {
|
|
661
958
|
try {
|
|
662
959
|
await validators_1.UpdateAppAuthSchema.validateAsync(data);
|
|
663
|
-
const auth = this.fetchAuth(tag);
|
|
960
|
+
const auth = await this.fetchAuth(tag);
|
|
664
961
|
data = await this.extractAuthData(Object.assign(Object.assign({}, auth), data));
|
|
665
962
|
await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({ tag }, data), { action: types_1.RequestAction.UPDATE, component: types_1.AppComponents.AUTH }), this.getUserAccess());
|
|
666
|
-
await this.initializeApp(this.app_id);
|
|
667
|
-
await this.initializeApp(this.app_id);
|
|
963
|
+
//await this.initializeApp(this.app_id);
|
|
964
|
+
//await this.initializeApp(this.app_id);
|
|
668
965
|
}
|
|
669
966
|
catch (e) {
|
|
670
967
|
throw e;
|
|
671
968
|
}
|
|
672
969
|
}
|
|
673
|
-
fetchAuths() {
|
|
674
|
-
|
|
970
|
+
async fetchAuths() {
|
|
971
|
+
const components = await this.appApi.fetchAppComponents(this.app_id, 'auth', this.getUserAccess(), this.appVersion.tag);
|
|
972
|
+
return components;
|
|
675
973
|
}
|
|
676
|
-
fetchAuth(tag) {
|
|
677
|
-
const
|
|
974
|
+
async fetchAuth(tag) {
|
|
975
|
+
const auths = await this.fetchAuths();
|
|
976
|
+
const auth = auths.find((data) => data.tag === tag);
|
|
678
977
|
if (!auth)
|
|
679
978
|
throw new Error(`Auth ${tag} not found`);
|
|
680
979
|
return auth;
|
|
@@ -682,13 +981,13 @@ class AppBuilderService {
|
|
|
682
981
|
async createVariable(data, throwErrorIfExists = false) {
|
|
683
982
|
try {
|
|
684
983
|
await validators_1.CreateAppVariableSchema.validateAsync(data);
|
|
685
|
-
const exists = this.fetchVariable(data.key, false);
|
|
984
|
+
const exists = await this.fetchVariable(data.key, false);
|
|
686
985
|
if (exists && throwErrorIfExists)
|
|
687
986
|
throw new Error(`Variable ${data.key} exists`);
|
|
688
987
|
if (!exists) {
|
|
689
988
|
await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({}, data), { action: types_1.RequestAction.CREATE, component: types_1.AppComponents.VARIABLE }), this.getUserAccess());
|
|
690
989
|
}
|
|
691
|
-
await this.initializeApp(this.app_id);
|
|
990
|
+
//await this.initializeApp(this.app_id);
|
|
692
991
|
}
|
|
693
992
|
catch (e) {
|
|
694
993
|
throw e;
|
|
@@ -697,19 +996,21 @@ class AppBuilderService {
|
|
|
697
996
|
async updateVariable(key, data) {
|
|
698
997
|
try {
|
|
699
998
|
await validators_1.UpdateAppVariableSchema.validateAsync(data);
|
|
700
|
-
this.fetchVariable(key);
|
|
999
|
+
await this.fetchVariable(key);
|
|
701
1000
|
await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({}, data), { key, action: types_1.RequestAction.UPDATE, component: types_1.AppComponents.VARIABLE }), this.getUserAccess());
|
|
702
|
-
await this.initializeApp(this.app_id);
|
|
1001
|
+
//await this.initializeApp(this.app_id);
|
|
703
1002
|
}
|
|
704
1003
|
catch (e) {
|
|
705
1004
|
throw e;
|
|
706
1005
|
}
|
|
707
1006
|
}
|
|
708
|
-
fetchVariables() {
|
|
709
|
-
|
|
1007
|
+
async fetchVariables() {
|
|
1008
|
+
const components = await this.appApi.fetchAppComponents(this.app_id, 'variable', this.getUserAccess(), this.appVersion.tag);
|
|
1009
|
+
return components;
|
|
710
1010
|
}
|
|
711
|
-
fetchVariable(key, throwErrorIfExists = true) {
|
|
712
|
-
const
|
|
1011
|
+
async fetchVariable(key, throwErrorIfExists = true) {
|
|
1012
|
+
const variables = await this.fetchVariables();
|
|
1013
|
+
const variable = variables.find((data) => data.key === key);
|
|
713
1014
|
if (!variable && throwErrorIfExists)
|
|
714
1015
|
throw new Error(`Variable ${key} not found`);
|
|
715
1016
|
return variable;
|
|
@@ -717,11 +1018,11 @@ class AppBuilderService {
|
|
|
717
1018
|
async createConstant(data, throwErrorIfExists = false) {
|
|
718
1019
|
try {
|
|
719
1020
|
await validators_1.CreateAppConstantSchema.validateAsync(data);
|
|
720
|
-
const exists = this.fetchConstant(data.key, false);
|
|
1021
|
+
const exists = await this.fetchConstant(data.key, false);
|
|
721
1022
|
if (exists && throwErrorIfExists)
|
|
722
1023
|
throw new Error(`Constant ${data.key} exists`);
|
|
723
1024
|
await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({}, data), { action: types_1.RequestAction.CREATE, component: types_1.AppComponents.CONSTANT }), this.getUserAccess());
|
|
724
|
-
await this.initializeApp(this.app_id);
|
|
1025
|
+
//await this.initializeApp(this.app_id);
|
|
725
1026
|
}
|
|
726
1027
|
catch (e) {
|
|
727
1028
|
throw e;
|
|
@@ -729,15 +1030,17 @@ class AppBuilderService {
|
|
|
729
1030
|
}
|
|
730
1031
|
async updateConstant(key, data) {
|
|
731
1032
|
await validators_1.UpdateAppConstantSchema.validateAsync(data);
|
|
732
|
-
this.fetchConstant(key);
|
|
1033
|
+
await this.fetchConstant(key);
|
|
733
1034
|
await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({}, data), { action: types_1.RequestAction.UPDATE, component: types_1.AppComponents.CONSTANT }), this.getUserAccess());
|
|
734
|
-
await this.initializeApp(this.app_id);
|
|
1035
|
+
//await this.initializeApp(this.app_id);
|
|
735
1036
|
}
|
|
736
|
-
fetchConstants() {
|
|
737
|
-
|
|
1037
|
+
async fetchConstants() {
|
|
1038
|
+
const components = await this.appApi.fetchAppComponents(this.app_id, 'constant', this.getUserAccess(), this.appVersion.tag);
|
|
1039
|
+
return components;
|
|
738
1040
|
}
|
|
739
|
-
fetchConstant(key, throwErrorIfExists = true) {
|
|
740
|
-
const
|
|
1041
|
+
async fetchConstant(key, throwErrorIfExists = true) {
|
|
1042
|
+
const constants = await this.fetchConstants();
|
|
1043
|
+
const variable = constants.find((data) => data.key === key);
|
|
741
1044
|
if (!variable && throwErrorIfExists)
|
|
742
1045
|
throw new Error(`Constant ${key} not found`);
|
|
743
1046
|
return variable;
|
|
@@ -747,17 +1050,19 @@ class AppBuilderService {
|
|
|
747
1050
|
if (stages.length === 0) {
|
|
748
1051
|
throw new Error(`Missing locators in ${locator}`);
|
|
749
1052
|
}
|
|
1053
|
+
// Convert stages to string[] for functions expecting string[]
|
|
1054
|
+
const stringStages = stages.map(stage => String(stage));
|
|
750
1055
|
if (locator.startsWith('$Body{')) {
|
|
751
|
-
await this.updateValidation(types_1.AppCategories.BODY,
|
|
1056
|
+
await this.updateValidation(types_1.AppCategories.BODY, stringStages, update);
|
|
752
1057
|
}
|
|
753
1058
|
else if (locator.startsWith('$Query{')) {
|
|
754
|
-
await this.updateValidation(types_1.AppCategories.QUERY,
|
|
1059
|
+
await this.updateValidation(types_1.AppCategories.QUERY, stringStages, update);
|
|
755
1060
|
}
|
|
756
1061
|
else if (locator.startsWith('$Params{')) {
|
|
757
|
-
await this.updateValidation(types_1.AppCategories.PARAMS,
|
|
1062
|
+
await this.updateValidation(types_1.AppCategories.PARAMS, stringStages, update);
|
|
758
1063
|
}
|
|
759
1064
|
else if (locator.startsWith('$Header{')) {
|
|
760
|
-
await this.updateValidation(types_1.AppCategories.HEADER,
|
|
1065
|
+
await this.updateValidation(types_1.AppCategories.HEADER, stringStages, update);
|
|
761
1066
|
}
|
|
762
1067
|
else {
|
|
763
1068
|
throw new Error(`Invalid input ${locator}`);
|
|
@@ -766,7 +1071,7 @@ class AppBuilderService {
|
|
|
766
1071
|
async updateValidation(category, stages, update) {
|
|
767
1072
|
try {
|
|
768
1073
|
const action_tag = stages[0];
|
|
769
|
-
const action = this.fetchAction(action_tag);
|
|
1074
|
+
const action = await this.fetchAction(action_tag);
|
|
770
1075
|
const data = action[category];
|
|
771
1076
|
let level = -1;
|
|
772
1077
|
let key = '';
|
|
@@ -805,8 +1110,8 @@ class AppBuilderService {
|
|
|
805
1110
|
'responses',
|
|
806
1111
|
...exclude,
|
|
807
1112
|
]);
|
|
808
|
-
await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({ tag: action_tag },
|
|
809
|
-
await this.initializeApp(this.app_id);
|
|
1113
|
+
await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({ tag: action_tag }, action), { component: types_1.AppComponents.VALIDATION, action: types_1.RequestAction.UPDATE }), this.getUserAccess());
|
|
1114
|
+
//await this.initializeApp(this.app_id);
|
|
810
1115
|
}
|
|
811
1116
|
catch (e) {
|
|
812
1117
|
throw e;
|
|
@@ -815,10 +1120,11 @@ class AppBuilderService {
|
|
|
815
1120
|
async createWebhook(data, throwErrorIfExists = false) {
|
|
816
1121
|
try {
|
|
817
1122
|
// TODO: figure out a way to check if this has run before, halt if it has
|
|
818
|
-
|
|
1123
|
+
const existingWebhook = await this.fetchWebhook(data.tag);
|
|
1124
|
+
if (!existingWebhook) {
|
|
819
1125
|
await create_appWebhook_validator_1.IAppWebhookSchema.validateAsync(data);
|
|
820
|
-
data.envs = data.envs.map((env) => {
|
|
821
|
-
const exists = this.fetchEnv(env.slug);
|
|
1126
|
+
data.envs = await Promise.all(data.envs.map(async (env) => {
|
|
1127
|
+
const exists = await this.fetchEnv(env.slug);
|
|
822
1128
|
if (!exists) {
|
|
823
1129
|
throw new Error(`Env ${env.slug} does not exist`);
|
|
824
1130
|
}
|
|
@@ -836,8 +1142,8 @@ class AppBuilderService {
|
|
|
836
1142
|
env.sample_data = [...bodyTemplate, ...queryTemplate, ...paramsTemplate, ...headerTemplate];
|
|
837
1143
|
}
|
|
838
1144
|
return env;
|
|
839
|
-
});
|
|
840
|
-
const envs = this.fetchEnvs();
|
|
1145
|
+
}));
|
|
1146
|
+
const envs = await this.fetchEnvs();
|
|
841
1147
|
envs.map((env) => {
|
|
842
1148
|
const exists = data.envs.findIndex((dbEnv) => dbEnv.slug === env.slug);
|
|
843
1149
|
if (exists === -1) {
|
|
@@ -845,7 +1151,7 @@ class AppBuilderService {
|
|
|
845
1151
|
}
|
|
846
1152
|
});
|
|
847
1153
|
await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({}, data), { component: types_1.AppComponents.WEBHOOK, action: types_1.RequestAction.CREATE }), this.getUserAccess());
|
|
848
|
-
await this.initializeApp(this.app_id);
|
|
1154
|
+
//await this.initializeApp(this.app_id);
|
|
849
1155
|
}
|
|
850
1156
|
else {
|
|
851
1157
|
if (throwErrorIfExists)
|
|
@@ -858,13 +1164,17 @@ class AppBuilderService {
|
|
|
858
1164
|
}
|
|
859
1165
|
async updateWebhook(tag, data) {
|
|
860
1166
|
try {
|
|
861
|
-
const
|
|
1167
|
+
const webhook = await this.fetchWebhook(tag);
|
|
1168
|
+
const { _id, envs } = webhook;
|
|
862
1169
|
await update_appWebhook_validator_1.IAppWebhookUpdateSchema.validateAsync(data); // Change to update;
|
|
863
|
-
if (data.tag
|
|
864
|
-
|
|
1170
|
+
if (data.tag) {
|
|
1171
|
+
const existingWebhook = await this.fetchWebhook(data.tag);
|
|
1172
|
+
if (existingWebhook) {
|
|
1173
|
+
throw new Error(`tag ${tag} is in use`); // TODO: also check on the backend
|
|
1174
|
+
}
|
|
865
1175
|
}
|
|
866
|
-
data.envs = data.envs.map((env) => {
|
|
867
|
-
const exists = this.fetchEnv(env.slug);
|
|
1176
|
+
data.envs = await Promise.all(data.envs.map(async (env) => {
|
|
1177
|
+
const exists = await this.fetchEnv(env.slug);
|
|
868
1178
|
if (!exists) {
|
|
869
1179
|
throw new Error(`Env ${env.slug} does not exist`);
|
|
870
1180
|
}
|
|
@@ -880,12 +1190,13 @@ class AppBuilderService {
|
|
|
880
1190
|
env.sample_data = [...bodyTemplate, ...queryTemplate, ...paramsTemplate, ...headerTemplate];
|
|
881
1191
|
}
|
|
882
1192
|
return env;
|
|
883
|
-
});
|
|
1193
|
+
}));
|
|
884
1194
|
const overwrite = [];
|
|
885
1195
|
const newEnvs = [];
|
|
886
|
-
|
|
1196
|
+
for (const env of envs) {
|
|
887
1197
|
const exists = data.envs.findIndex((dataEnv) => env.slug === dataEnv.slug);
|
|
888
|
-
|
|
1198
|
+
const envExists = await this.fetchEnv(env.slug, false);
|
|
1199
|
+
if (!envExists) {
|
|
889
1200
|
throw new Error(`Product Environment ${env.slug} doesn't exist`);
|
|
890
1201
|
}
|
|
891
1202
|
if (exists === -1) {
|
|
@@ -894,7 +1205,7 @@ class AppBuilderService {
|
|
|
894
1205
|
else {
|
|
895
1206
|
overwrite.push(Object.assign(Object.assign({}, env), data.envs[exists]));
|
|
896
1207
|
}
|
|
897
|
-
}
|
|
1208
|
+
}
|
|
898
1209
|
const unchanged = [];
|
|
899
1210
|
envs.map((env) => {
|
|
900
1211
|
const newEnv = newEnvs.findIndex((dataEnv) => env.slug === dataEnv.slug) > -1;
|
|
@@ -906,20 +1217,20 @@ class AppBuilderService {
|
|
|
906
1217
|
data.envs = [...unchanged, ...overwrite, ...newEnvs];
|
|
907
1218
|
data.envs = [...overwrite, ...newEnvs];
|
|
908
1219
|
await this.appApi.updateApp(this.app_id, Object.assign(Object.assign({ _id }, data), { component: types_1.AppComponents.WEBHOOK, action: types_1.RequestAction.UPDATE }), this.getUserAccess());
|
|
909
|
-
await this.initializeApp(this.app_id);
|
|
1220
|
+
//await this.initializeApp(this.app_id);
|
|
910
1221
|
}
|
|
911
1222
|
catch (e) {
|
|
912
1223
|
throw e;
|
|
913
1224
|
}
|
|
914
1225
|
}
|
|
915
|
-
fetchWebhook(tag) {
|
|
916
|
-
|
|
917
|
-
const exists =
|
|
1226
|
+
async fetchWebhook(tag) {
|
|
1227
|
+
const webhooks = await this.fetchWebhooks();
|
|
1228
|
+
const exists = webhooks === null || webhooks === void 0 ? void 0 : webhooks.find((data) => data.tag === tag);
|
|
918
1229
|
return exists;
|
|
919
1230
|
}
|
|
920
|
-
fetchWebhooks() {
|
|
921
|
-
|
|
922
|
-
return
|
|
1231
|
+
async fetchWebhooks() {
|
|
1232
|
+
const components = await this.appApi.fetchAppComponents(this.app_id, 'webhook', this.getUserAccess(), this.appVersion.tag);
|
|
1233
|
+
return components;
|
|
923
1234
|
}
|
|
924
1235
|
async createWebhookEvent(data, throwErrorIfExists = false) {
|
|
925
1236
|
try {
|
|
@@ -931,44 +1242,64 @@ class AppBuilderService {
|
|
|
931
1242
|
if (!webhookTag || !tag) {
|
|
932
1243
|
throw new Error(`tag is expected to be defined as "webhook_tag:event_tag"`);
|
|
933
1244
|
}
|
|
934
|
-
const exists = this.fetchWebhookEvent(data.tag);
|
|
1245
|
+
const exists = await this.fetchWebhookEvent(data.tag);
|
|
935
1246
|
data.tag = tag;
|
|
936
1247
|
if (!exists) {
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
}
|
|
940
|
-
const
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
if (current && typeof current === 'object' && stage in current) {
|
|
944
|
-
current = current[stage];
|
|
1248
|
+
// Handle comma-separated selectors (e.g., "$Event{Status},$Event{Type}")
|
|
1249
|
+
const selectors = data.selector.split(',').map(s => s.trim());
|
|
1250
|
+
const selectorValues = {};
|
|
1251
|
+
for (const selector of selectors) {
|
|
1252
|
+
if (!selector.startsWith('$Event{')) {
|
|
1253
|
+
throw new Error('Selector should be in the format $Event{...}{key}');
|
|
945
1254
|
}
|
|
946
|
-
|
|
947
|
-
|
|
1255
|
+
const stages = (0, string_utils_2.extractStages)(selector);
|
|
1256
|
+
let current = data.sample;
|
|
1257
|
+
for (const stage of stages) {
|
|
1258
|
+
if (current && typeof current === 'object' && stage in current) {
|
|
1259
|
+
current = current[stage];
|
|
1260
|
+
}
|
|
1261
|
+
else {
|
|
1262
|
+
throw new Error(`${selector} not found in event sample`);
|
|
1263
|
+
}
|
|
948
1264
|
}
|
|
1265
|
+
if (current === null ||
|
|
1266
|
+
typeof current === "undefined" ||
|
|
1267
|
+
typeof current === "object") {
|
|
1268
|
+
throw new Error("Selector value is not allowed to be an object|array|null|undefined");
|
|
1269
|
+
}
|
|
1270
|
+
// Store the selector and its value
|
|
1271
|
+
selectorValues[selector] = current;
|
|
949
1272
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
}
|
|
1273
|
+
// For single selector, use the value directly; for multiple, use the object
|
|
1274
|
+
const combinedSelectorValue = selectors.length === 1
|
|
1275
|
+
? selectorValues[selectors[0]]
|
|
1276
|
+
: selectorValues;
|
|
955
1277
|
//check other webhooksevents to see if there are other places where selector and selectorValue match up
|
|
956
|
-
const existing = this.fetchWebhookEvents(webhookTag);
|
|
1278
|
+
const existing = await this.fetchWebhookEvents(webhookTag);
|
|
957
1279
|
existing === null || existing === void 0 ? void 0 : existing.map((event) => {
|
|
958
|
-
if (
|
|
959
|
-
|
|
1280
|
+
if (selectors.length === 1) {
|
|
1281
|
+
// Single selector comparison (backward compatible)
|
|
1282
|
+
if (event.selector === data.selector && event.selectorValue === combinedSelectorValue) {
|
|
1283
|
+
throw new Error(`Selector ${data.selector} with value ${combinedSelectorValue} already exists on event ${event.tag}`);
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
else {
|
|
1287
|
+
// Multiple selectors - compare the full selector string and combined values
|
|
1288
|
+
if (event.selector === data.selector && JSON.stringify(event.selectorValue) === JSON.stringify(combinedSelectorValue)) {
|
|
1289
|
+
throw new Error(`Selectors ${data.selector} with values ${JSON.stringify(combinedSelectorValue)} already exists on event ${event.tag}`);
|
|
1290
|
+
}
|
|
960
1291
|
}
|
|
961
1292
|
});
|
|
962
1293
|
data.sample_data = await this.inputsService.parseJson({
|
|
963
1294
|
data: data.sample,
|
|
964
1295
|
expected: types_1.ExpectedValues.PARSESAMPLE
|
|
965
1296
|
});
|
|
966
|
-
data.selectorValue =
|
|
1297
|
+
data.selectorValue = combinedSelectorValue;
|
|
967
1298
|
delete data.tag;
|
|
968
1299
|
const payload = Object.assign(Object.assign({}, data), { webhookTag,
|
|
969
1300
|
tag, component: types_1.AppComponents.WEBHOOK_EVENT, action: types_1.RequestAction.CREATE });
|
|
970
1301
|
await this.appApi.updateApp(this.app_id, payload, this.getUserAccess());
|
|
971
|
-
await this.initializeApp(this.app_id);
|
|
1302
|
+
//await this.initializeApp(this.app_id);
|
|
972
1303
|
}
|
|
973
1304
|
else {
|
|
974
1305
|
if (throwErrorIfExists)
|
|
@@ -998,36 +1329,56 @@ class AppBuilderService {
|
|
|
998
1329
|
throw new Error(`selector is required when new event sample is supplied`);
|
|
999
1330
|
}
|
|
1000
1331
|
if (data.sample) {
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
}
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
if (current && typeof current === 'object' && stage in current) {
|
|
1008
|
-
current = current[stage];
|
|
1332
|
+
// Handle comma-separated selectors (e.g., "$Event{Status},$Event{Type}")
|
|
1333
|
+
const selectors = data.selector.split(',').map(s => s.trim());
|
|
1334
|
+
const selectorValues = {};
|
|
1335
|
+
for (const selector of selectors) {
|
|
1336
|
+
if (!selector.startsWith('$Event{')) {
|
|
1337
|
+
throw new Error('Selector should be in the format $Event{...}{key}');
|
|
1009
1338
|
}
|
|
1010
|
-
|
|
1011
|
-
|
|
1339
|
+
const stages = (0, string_utils_2.extractStages)(selector);
|
|
1340
|
+
let current = data.sample;
|
|
1341
|
+
for (const stage of stages) {
|
|
1342
|
+
if (current && typeof current === 'object' && stage in current) {
|
|
1343
|
+
current = current[stage];
|
|
1344
|
+
}
|
|
1345
|
+
else {
|
|
1346
|
+
throw new Error(`${selector} not found in event sample`);
|
|
1347
|
+
}
|
|
1012
1348
|
}
|
|
1349
|
+
if (current === null ||
|
|
1350
|
+
typeof current === "undefined" ||
|
|
1351
|
+
typeof current === "object") {
|
|
1352
|
+
throw new Error("Selector value is not allowed to be an object|array|null|undefined");
|
|
1353
|
+
}
|
|
1354
|
+
// Store the selector and its value
|
|
1355
|
+
selectorValues[selector] = current;
|
|
1013
1356
|
}
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
}
|
|
1357
|
+
// For single selector, use the value directly; for multiple, use the object
|
|
1358
|
+
const combinedSelectorValue = selectors.length === 1
|
|
1359
|
+
? selectorValues[selectors[0]]
|
|
1360
|
+
: selectorValues;
|
|
1019
1361
|
//check other webhooksevents to see if there are other places where selector and selectorValue match up
|
|
1020
|
-
const existing = this.fetchWebhookEvents(webhookTag);
|
|
1021
|
-
existing === null || existing === void 0 ? void 0 : existing.map((
|
|
1022
|
-
if (
|
|
1023
|
-
|
|
1362
|
+
const existing = await this.fetchWebhookEvents(webhookTag);
|
|
1363
|
+
existing === null || existing === void 0 ? void 0 : existing.map((existingEvent) => {
|
|
1364
|
+
if (selectors.length === 1) {
|
|
1365
|
+
// Single selector comparison (backward compatible)
|
|
1366
|
+
if (existingEvent.selector === data.selector && existingEvent.selectorValue === combinedSelectorValue && existingEvent.tag !== tag) {
|
|
1367
|
+
throw new Error(`Selector ${data.selector} with value ${combinedSelectorValue} already exists on event ${existingEvent.tag}`);
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
else {
|
|
1371
|
+
// Multiple selectors - compare the full selector string and combined values
|
|
1372
|
+
if (existingEvent.selector === data.selector && JSON.stringify(existingEvent.selectorValue) === JSON.stringify(combinedSelectorValue) && existingEvent.tag !== tag) {
|
|
1373
|
+
throw new Error(`Selectors ${data.selector} with values ${JSON.stringify(combinedSelectorValue)} already exists on event ${existingEvent.tag}`);
|
|
1374
|
+
}
|
|
1024
1375
|
}
|
|
1025
1376
|
});
|
|
1026
1377
|
data.sample_data = await this.inputsService.parseJson({
|
|
1027
1378
|
data: data.sample,
|
|
1028
1379
|
expected: types_1.ExpectedValues.PARSESAMPLE
|
|
1029
1380
|
});
|
|
1030
|
-
data.selectorValue =
|
|
1381
|
+
data.selectorValue = combinedSelectorValue;
|
|
1031
1382
|
}
|
|
1032
1383
|
// Construct payload
|
|
1033
1384
|
delete data.tag;
|
|
@@ -1035,26 +1386,26 @@ class AppBuilderService {
|
|
|
1035
1386
|
webhookTag, component: types_1.AppComponents.WEBHOOK_EVENT, action: types_1.RequestAction.UPDATE });
|
|
1036
1387
|
// Update product and reinitialize
|
|
1037
1388
|
await this.appApi.updateApp(this.app_id, payload, this.getUserAccess());
|
|
1038
|
-
await this.initializeApp(this.app_id);
|
|
1389
|
+
//await this.initializeApp(this.app_id);
|
|
1039
1390
|
}
|
|
1040
1391
|
catch (error) {
|
|
1041
1392
|
throw error;
|
|
1042
1393
|
}
|
|
1043
1394
|
}
|
|
1044
|
-
fetchWebhookEvent(tag) {
|
|
1395
|
+
async fetchWebhookEvent(tag) {
|
|
1045
1396
|
const [webhookTag, eventTag] = tag.split(':');
|
|
1046
1397
|
;
|
|
1047
1398
|
if (!webhookTag || !eventTag) {
|
|
1048
1399
|
throw new Error(`webhook events should be in the format webhook_tag:event_tag`);
|
|
1049
1400
|
}
|
|
1050
|
-
const events = this.fetchWebhookEvents(webhookTag);
|
|
1401
|
+
const events = await this.fetchWebhookEvents(webhookTag);
|
|
1051
1402
|
const event = events.find((event) => {
|
|
1052
1403
|
return event.tag === eventTag;
|
|
1053
1404
|
});
|
|
1054
1405
|
return event;
|
|
1055
1406
|
}
|
|
1056
|
-
fetchWebhookEvents(tag) {
|
|
1057
|
-
const webhook = this.fetchWebhook(tag);
|
|
1407
|
+
async fetchWebhookEvents(tag) {
|
|
1408
|
+
const webhook = await this.fetchWebhook(tag);
|
|
1058
1409
|
if (!webhook) {
|
|
1059
1410
|
throw new Error(`Webhook ${tag} does not exist`);
|
|
1060
1411
|
}
|