@teleporthq/teleport-plugin-next-workflows 0.44.11 → 0.45.0
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/__tests__/_helpers/fake-fetch.ts +75 -0
- package/__tests__/_helpers/gui-place-order-statements.ts +17 -0
- package/__tests__/_helpers/inserted-lines.ts +22 -0
- package/__tests__/_helpers/invoice-store.ts +10 -1
- package/__tests__/_helpers/load-security-runtime.ts +45 -0
- package/__tests__/_helpers/load-server-runtime.ts +26 -3
- package/__tests__/_helpers/run-account-delete-route.ts +3 -1
- package/__tests__/_helpers/run-generated-middleware.ts +7 -2
- package/__tests__/account-delete-owned-rows.test.ts +3 -1
- package/__tests__/adopted-element-trigger-code.test.ts +128 -0
- package/__tests__/analytics-track-outcome.test.ts +145 -0
- package/__tests__/auth-password-change-ends-sessions.test.ts +8 -1
- package/__tests__/auth-password-security.test.ts +2275 -0
- package/__tests__/auth-session-cost.test.ts +31 -0
- package/__tests__/auth-signup-route.test.ts +960 -0
- package/__tests__/authored-code-every-path.test.ts +247 -0
- package/__tests__/automations-bus.test.ts +3820 -0
- package/__tests__/automations-catalog-drift.test.ts +97 -0
- package/__tests__/booking-calendar-feed-route.test.ts +20 -3
- package/__tests__/cart-price-order.test.ts +336 -1
- package/__tests__/code-lookup-rate-limit-route.test.ts +189 -0
- package/__tests__/cost-bearing-node-types.test.ts +119 -0
- package/__tests__/credential-columns-reply.test.ts +9 -0
- package/__tests__/credential-result-reply.test.ts +19 -5
- package/__tests__/cron-route-loop-templateparams.test.ts +6 -3
- package/__tests__/custom-js-authored-code.test.ts +304 -0
- package/__tests__/custom-node-custom-code-gate.test.ts +136 -0
- package/__tests__/custom-node-step-handlers.test.ts +251 -0
- package/__tests__/custom-node-step-reach.test.ts +63 -0
- package/__tests__/data-api-anon-user-id-fallback.test.ts +7 -2
- package/__tests__/data-api-browser-reads.test.ts +7 -0
- package/__tests__/data-api-business-events.test.ts +403 -0
- package/__tests__/data-api-invalid-body.test.ts +7 -0
- package/__tests__/data-api-low-stock-autofire.test.ts +30 -4
- package/__tests__/data-api-optional-feature-columns.test.ts +44 -0
- package/__tests__/data-api-owner-scope-credentials.test.ts +1324 -0
- package/__tests__/data-api-protected-tables.test.ts +48 -15
- package/__tests__/data-api-retired-table-and-account-fields.test.ts +208 -0
- package/__tests__/email-locale-senders.test.ts +5 -3
- package/__tests__/expression-injection.test.ts +343 -0
- package/__tests__/fixtures/admin-file-workflows.json +242 -0
- package/__tests__/form-confirmation-email-template.test.ts +44 -0
- package/__tests__/internal-request-headers.test.ts +25 -0
- package/__tests__/invoice-pdf-service-project-header.test.ts +120 -0
- package/__tests__/invoice-self-call-origin.test.ts +57 -1
- package/__tests__/legacy-webhook-self-calls.test.ts +86 -1
- package/__tests__/middleware-home-route-protection.test.ts +3 -1
- package/__tests__/middleware-subscriber-access.test.ts +1 -1
- package/__tests__/newsletter-admin-route.test.ts +649 -0
- package/__tests__/newsletter-plugin.test.ts +1248 -0
- package/__tests__/outbound-nodes-security.test.ts +1929 -0
- package/__tests__/page-access-guard.test.ts +217 -0
- package/__tests__/page-access-route-table.test.ts +231 -0
- package/__tests__/payment-drivers-module.test.ts +23 -0
- package/__tests__/payment-legacy-webhook-routes.test.ts +100 -5
- package/__tests__/payment-webhook-route.test.ts +4 -1
- package/__tests__/paypal-webhook-signature-verification.test.ts +44 -0
- package/__tests__/place-order-guards.test.ts +506 -0
- package/__tests__/public-step-guards.test.ts +310 -0
- package/__tests__/publish-refusals.test.ts +505 -0
- package/__tests__/realtime-identity-routes.test.ts +492 -0
- package/__tests__/record-event-writer-server-only.test.ts +975 -0
- package/__tests__/resolve-config-template-params.test.ts +3 -3
- package/__tests__/runtime-storage-upload-access.test.ts +280 -17
- package/__tests__/security-integration-env-names.test.ts +74 -0
- package/__tests__/security-lists-parity.test.ts +245 -0
- package/__tests__/security-runtime-shadow.test.ts +224 -1
- package/__tests__/security-runtime.test.ts +893 -0
- package/__tests__/segment-rate-limit-error-branch.test.ts +284 -0
- package/__tests__/segment-route-abuse-gate.test.ts +309 -0
- package/__tests__/server-job-hops-real-data-api.test.ts +669 -0
- package/__tests__/server-session-identity.test.ts +522 -0
- package/__tests__/server-step-chain.test.ts +222 -0
- package/__tests__/server-step-signing.test.ts +107 -2
- package/__tests__/session-cookie-resolver.test.ts +62 -106
- package/__tests__/signup-event.test.ts +649 -0
- package/__tests__/signup-reply-identical.test.ts +144 -0
- package/__tests__/slack-message-escaping.test.ts +123 -0
- package/__tests__/visitor-step-limits.test.ts +318 -0
- package/__tests__/webhook-delivery-lease.test.ts +4 -1
- package/__tests__/webpack-safe-handlers.test.ts +57 -8
- package/__tests__/workflow-auth-guard.test.ts +9 -1
- package/dist/cjs/account-delete-route-generator.d.ts +1 -0
- package/dist/cjs/account-delete-route-generator.d.ts.map +1 -1
- package/dist/cjs/account-delete-route-generator.js +18 -3
- package/dist/cjs/account-delete-route-generator.js.map +1 -1
- package/dist/cjs/api-route-generator.d.ts +52 -3
- package/dist/cjs/api-route-generator.d.ts.map +1 -1
- package/dist/cjs/api-route-generator.js +600 -145
- package/dist/cjs/api-route-generator.js.map +1 -1
- package/dist/cjs/auth-generator.d.ts +126 -3
- package/dist/cjs/auth-generator.d.ts.map +1 -1
- package/dist/cjs/auth-generator.js +1353 -139
- package/dist/cjs/auth-generator.js.map +1 -1
- package/dist/cjs/automations/activity-kicks.d.ts +12 -0
- package/dist/cjs/automations/activity-kicks.d.ts.map +1 -0
- package/dist/cjs/automations/activity-kicks.js +123 -0
- package/dist/cjs/automations/activity-kicks.js.map +1 -0
- package/dist/cjs/automations/app-events-source.d.ts +33 -0
- package/dist/cjs/automations/app-events-source.d.ts.map +1 -0
- package/dist/cjs/automations/app-events-source.js +109 -0
- package/dist/cjs/automations/app-events-source.js.map +1 -0
- package/dist/cjs/automations/automations-project-plugin.d.ts +21 -0
- package/dist/cjs/automations/automations-project-plugin.d.ts.map +1 -0
- package/dist/cjs/automations/automations-project-plugin.js +102 -0
- package/dist/cjs/automations/automations-project-plugin.js.map +1 -0
- package/dist/cjs/automations/automations-scope.d.ts +104 -0
- package/dist/cjs/automations/automations-scope.d.ts.map +1 -0
- package/dist/cjs/automations/automations-scope.js +176 -0
- package/dist/cjs/automations/automations-scope.js.map +1 -0
- package/dist/cjs/automations/dispatcher-source.d.ts +72 -0
- package/dist/cjs/automations/dispatcher-source.d.ts.map +1 -0
- package/dist/cjs/automations/dispatcher-source.js +1008 -0
- package/dist/cjs/automations/dispatcher-source.js.map +1 -0
- package/dist/cjs/automations/event-bus-source.d.ts +44 -0
- package/dist/cjs/automations/event-bus-source.d.ts.map +1 -0
- package/dist/cjs/automations/event-bus-source.js +427 -0
- package/dist/cjs/automations/event-bus-source.js.map +1 -0
- package/dist/cjs/automations/handler-module-generator.d.ts +25 -0
- package/dist/cjs/automations/handler-module-generator.d.ts.map +1 -0
- package/dist/cjs/automations/handler-module-generator.js +78 -0
- package/dist/cjs/automations/handler-module-generator.js.map +1 -0
- package/dist/cjs/automations/hydrators-source.d.ts +33 -0
- package/dist/cjs/automations/hydrators-source.d.ts.map +1 -0
- package/dist/cjs/automations/hydrators-source.js +571 -0
- package/dist/cjs/automations/hydrators-source.js.map +1 -0
- package/dist/cjs/booking-calendar-feed-route-generator.d.ts.map +1 -1
- package/dist/cjs/booking-calendar-feed-route-generator.js +8 -0
- package/dist/cjs/booking-calendar-feed-route-generator.js.map +1 -1
- package/dist/cjs/configured-nextauth-url.d.ts +17 -0
- package/dist/cjs/configured-nextauth-url.d.ts.map +1 -0
- package/dist/cjs/configured-nextauth-url.js +20 -0
- package/dist/cjs/configured-nextauth-url.js.map +1 -0
- package/dist/cjs/cron-request-verification.d.ts +22 -1
- package/dist/cjs/cron-request-verification.d.ts.map +1 -1
- package/dist/cjs/cron-request-verification.js +50 -6
- package/dist/cjs/cron-request-verification.js.map +1 -1
- package/dist/cjs/data-api-route-generator.d.ts +19 -0
- package/dist/cjs/data-api-route-generator.d.ts.map +1 -1
- package/dist/cjs/data-api-route-generator.js +711 -43
- package/dist/cjs/data-api-route-generator.js.map +1 -1
- package/dist/cjs/ecommerce/parameterized-stock-chain.d.ts +3 -1
- package/dist/cjs/ecommerce/parameterized-stock-chain.d.ts.map +1 -1
- package/dist/cjs/ecommerce/parameterized-stock-chain.js +45 -5
- package/dist/cjs/ecommerce/parameterized-stock-chain.js.map +1 -1
- package/dist/cjs/ecommerce/place-order-guards.d.ts +126 -0
- package/dist/cjs/ecommerce/place-order-guards.d.ts.map +1 -0
- package/dist/cjs/ecommerce/place-order-guards.js +670 -0
- package/dist/cjs/ecommerce/place-order-guards.js.map +1 -0
- package/dist/cjs/ecommerce-customhandler-rewriter.d.ts +2 -0
- package/dist/cjs/ecommerce-customhandler-rewriter.d.ts.map +1 -1
- package/dist/cjs/ecommerce-customhandler-rewriter.js +38 -2
- package/dist/cjs/ecommerce-customhandler-rewriter.js.map +1 -1
- package/dist/cjs/executor-generator.d.ts.map +1 -1
- package/dist/cjs/executor-generator.js +368 -60
- package/dist/cjs/executor-generator.js.map +1 -1
- package/dist/cjs/graph-utils.d.ts +9 -0
- package/dist/cjs/graph-utils.d.ts.map +1 -1
- package/dist/cjs/graph-utils.js +32 -1
- package/dist/cjs/graph-utils.js.map +1 -1
- package/dist/cjs/index.d.ts +20 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +72 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/invoice/api-routes-code.d.ts +9 -3
- package/dist/cjs/invoice/api-routes-code.d.ts.map +1 -1
- package/dist/cjs/invoice/api-routes-code.js +9 -7
- package/dist/cjs/invoice/api-routes-code.js.map +1 -1
- package/dist/cjs/invoice/index.d.ts.map +1 -1
- package/dist/cjs/invoice/index.js +12 -7
- package/dist/cjs/invoice/index.js.map +1 -1
- package/dist/cjs/invoice/invoice-assembly-code.d.ts.map +1 -1
- package/dist/cjs/invoice/invoice-assembly-code.js +8 -3
- package/dist/cjs/invoice/invoice-assembly-code.js.map +1 -1
- package/dist/cjs/invoice/pdf-generator-code.d.ts.map +1 -1
- package/dist/cjs/invoice/pdf-generator-code.js +2 -1
- package/dist/cjs/invoice/pdf-generator-code.js.map +1 -1
- package/dist/cjs/invoice/pdf-service-client-code.d.ts.map +1 -1
- package/dist/cjs/invoice/pdf-service-client-code.js +15 -7
- package/dist/cjs/invoice/pdf-service-client-code.js.map +1 -1
- package/dist/cjs/newsletter/admin-route-code.d.ts +60 -0
- package/dist/cjs/newsletter/admin-route-code.d.ts.map +1 -0
- package/dist/cjs/newsletter/admin-route-code.js +300 -0
- package/dist/cjs/newsletter/admin-route-code.js.map +1 -0
- package/dist/cjs/newsletter/helper-code.d.ts +109 -0
- package/dist/cjs/newsletter/helper-code.d.ts.map +1 -0
- package/dist/cjs/newsletter/helper-code.js +662 -0
- package/dist/cjs/newsletter/helper-code.js.map +1 -0
- package/dist/cjs/newsletter/newsletter-scope.d.ts +65 -0
- package/dist/cjs/newsletter/newsletter-scope.d.ts.map +1 -0
- package/dist/cjs/newsletter/newsletter-scope.js +103 -0
- package/dist/cjs/newsletter/newsletter-scope.js.map +1 -0
- package/dist/cjs/newsletter/project-plugin.d.ts +18 -0
- package/dist/cjs/newsletter/project-plugin.d.ts.map +1 -0
- package/dist/cjs/newsletter/project-plugin.js +97 -0
- package/dist/cjs/newsletter/project-plugin.js.map +1 -0
- package/dist/cjs/newsletter/routes-code.d.ts +6 -0
- package/dist/cjs/newsletter/routes-code.d.ts.map +1 -0
- package/dist/cjs/newsletter/routes-code.js +181 -0
- package/dist/cjs/newsletter/routes-code.js.map +1 -0
- package/dist/cjs/nodes/account/account-compare-passwords.d.ts.map +1 -1
- package/dist/cjs/nodes/account/account-compare-passwords.js +16 -6
- package/dist/cjs/nodes/account/account-compare-passwords.js.map +1 -1
- package/dist/cjs/nodes/account/account-delete-current.js +1 -1
- package/dist/cjs/nodes/account/account-get-current.js +1 -1
- package/dist/cjs/nodes/account/account-hash-password.d.ts.map +1 -1
- package/dist/cjs/nodes/account/account-hash-password.js +15 -3
- package/dist/cjs/nodes/account/account-hash-password.js.map +1 -1
- package/dist/cjs/nodes/account/account-login.d.ts.map +1 -1
- package/dist/cjs/nodes/account/account-login.js +23 -6
- package/dist/cjs/nodes/account/account-login.js.map +1 -1
- package/dist/cjs/nodes/account/account-logout.js +1 -1
- package/dist/cjs/nodes/account/account-refresh-session.js +1 -1
- package/dist/cjs/nodes/account/account-request-password-reset.d.ts +3 -0
- package/dist/cjs/nodes/account/account-request-password-reset.d.ts.map +1 -0
- package/dist/cjs/nodes/account/account-request-password-reset.js +46 -0
- package/dist/cjs/nodes/account/account-request-password-reset.js.map +1 -0
- package/dist/cjs/nodes/account/account-reset-password.d.ts +3 -0
- package/dist/cjs/nodes/account/account-reset-password.d.ts.map +1 -0
- package/dist/cjs/nodes/account/account-reset-password.js +44 -0
- package/dist/cjs/nodes/account/account-reset-password.js.map +1 -0
- package/dist/cjs/nodes/account/account-signup.d.ts.map +1 -1
- package/dist/cjs/nodes/account/account-signup.js +82 -19
- package/dist/cjs/nodes/account/account-signup.js.map +1 -1
- package/dist/cjs/nodes/account/account-social-login.js +1 -1
- package/dist/cjs/nodes/ai/ai-custom-prompt.d.ts.map +1 -1
- package/dist/cjs/nodes/ai/ai-custom-prompt.js +20 -5
- package/dist/cjs/nodes/ai/ai-custom-prompt.js.map +1 -1
- package/dist/cjs/nodes/ai/ai-detect-language.d.ts.map +1 -1
- package/dist/cjs/nodes/ai/ai-detect-language.js +20 -5
- package/dist/cjs/nodes/ai/ai-detect-language.js.map +1 -1
- package/dist/cjs/nodes/ai/ai-generate-text-embedding.d.ts.map +1 -1
- package/dist/cjs/nodes/ai/ai-generate-text-embedding.js +10 -2
- package/dist/cjs/nodes/ai/ai-generate-text-embedding.js.map +1 -1
- package/dist/cjs/nodes/ai/ai-provider-utils-sources.generated.js +2 -2
- package/dist/cjs/nodes/ai/ai-provider-utils-sources.generated.js.map +1 -1
- package/dist/cjs/nodes/ai/ai-provider-utils.d.ts +31 -2
- package/dist/cjs/nodes/ai/ai-provider-utils.d.ts.map +1 -1
- package/dist/cjs/nodes/ai/ai-provider-utils.js +125 -11
- package/dist/cjs/nodes/ai/ai-provider-utils.js.map +1 -1
- package/dist/cjs/nodes/ai/ai-select-database-data.d.ts.map +1 -1
- package/dist/cjs/nodes/ai/ai-select-database-data.js +6 -2
- package/dist/cjs/nodes/ai/ai-select-database-data.js.map +1 -1
- package/dist/cjs/nodes/ai/ai-sentiment-analysis.d.ts.map +1 -1
- package/dist/cjs/nodes/ai/ai-sentiment-analysis.js +20 -5
- package/dist/cjs/nodes/ai/ai-sentiment-analysis.js.map +1 -1
- package/dist/cjs/nodes/ai/ai-summarization.d.ts.map +1 -1
- package/dist/cjs/nodes/ai/ai-summarization.js +20 -5
- package/dist/cjs/nodes/ai/ai-summarization.js.map +1 -1
- package/dist/cjs/nodes/ai/ai-text-classifier.d.ts.map +1 -1
- package/dist/cjs/nodes/ai/ai-text-classifier.js +20 -5
- package/dist/cjs/nodes/ai/ai-text-classifier.js.map +1 -1
- package/dist/cjs/nodes/ai/ai-text-transform.d.ts.map +1 -1
- package/dist/cjs/nodes/ai/ai-text-transform.js +20 -5
- package/dist/cjs/nodes/ai/ai-text-transform.js.map +1 -1
- package/dist/cjs/nodes/analytics/analytics-track-outcome.d.ts +3 -0
- package/dist/cjs/nodes/analytics/analytics-track-outcome.d.ts.map +1 -0
- package/dist/cjs/nodes/analytics/analytics-track-outcome.js +110 -0
- package/dist/cjs/nodes/analytics/analytics-track-outcome.js.map +1 -0
- package/dist/cjs/nodes/cart/cart-price-order.d.ts.map +1 -1
- package/dist/cjs/nodes/cart/cart-price-order.js +161 -2
- package/dist/cjs/nodes/cart/cart-price-order.js.map +1 -1
- package/dist/cjs/nodes/cost-bearing-node-types.d.ts +4 -0
- package/dist/cjs/nodes/cost-bearing-node-types.d.ts.map +1 -0
- package/dist/cjs/nodes/cost-bearing-node-types.js +43 -0
- package/dist/cjs/nodes/cost-bearing-node-types.js.map +1 -0
- package/dist/cjs/nodes/data/data-select.d.ts.map +1 -1
- package/dist/cjs/nodes/data/data-select.js +12 -2
- package/dist/cjs/nodes/data/data-select.js.map +1 -1
- package/dist/cjs/nodes/email/email-mailersend.d.ts.map +1 -1
- package/dist/cjs/nodes/email/email-mailersend.js +15 -11
- package/dist/cjs/nodes/email/email-mailersend.js.map +1 -1
- package/dist/cjs/nodes/email/email-mailgun.d.ts.map +1 -1
- package/dist/cjs/nodes/email/email-mailgun.js +15 -15
- package/dist/cjs/nodes/email/email-mailgun.js.map +1 -1
- package/dist/cjs/nodes/email/email-postmark.d.ts.map +1 -1
- package/dist/cjs/nodes/email/email-postmark.js +15 -15
- package/dist/cjs/nodes/email/email-postmark.js.map +1 -1
- package/dist/cjs/nodes/email/email-resend.d.ts.map +1 -1
- package/dist/cjs/nodes/email/email-resend.js +15 -15
- package/dist/cjs/nodes/email/email-resend.js.map +1 -1
- package/dist/cjs/nodes/email/email-sendgrid.d.ts.map +1 -1
- package/dist/cjs/nodes/email/email-sendgrid.js +15 -15
- package/dist/cjs/nodes/email/email-sendgrid.js.map +1 -1
- package/dist/cjs/nodes/email/html-escape-code.d.ts +3 -0
- package/dist/cjs/nodes/email/html-escape-code.d.ts.map +1 -0
- package/dist/cjs/nodes/email/html-escape-code.js +23 -0
- package/dist/cjs/nodes/email/html-escape-code.js.map +1 -0
- package/dist/cjs/nodes/email/message-trust.d.ts +40 -0
- package/dist/cjs/nodes/email/message-trust.d.ts.map +1 -0
- package/dist/cjs/nodes/email/message-trust.js +167 -0
- package/dist/cjs/nodes/email/message-trust.js.map +1 -0
- package/dist/cjs/nodes/email/outbound-message-guard.d.ts +113 -0
- package/dist/cjs/nodes/email/outbound-message-guard.d.ts.map +1 -0
- package/dist/cjs/nodes/email/outbound-message-guard.js +460 -0
- package/dist/cjs/nodes/email/outbound-message-guard.js.map +1 -0
- package/dist/cjs/nodes/email/trusted-html-code.d.ts +22 -0
- package/dist/cjs/nodes/email/trusted-html-code.d.ts.map +1 -0
- package/dist/cjs/nodes/email/trusted-html-code.js +52 -0
- package/dist/cjs/nodes/email/trusted-html-code.js.map +1 -0
- package/dist/cjs/nodes/general/general-custom-js.d.ts.map +1 -1
- package/dist/cjs/nodes/general/general-custom-js.js +44 -7
- package/dist/cjs/nodes/general/general-custom-js.js.map +1 -1
- package/dist/cjs/nodes/general/general-http-request.d.ts.map +1 -1
- package/dist/cjs/nodes/general/general-http-request.js +431 -45
- package/dist/cjs/nodes/general/general-http-request.js.map +1 -1
- package/dist/cjs/nodes/general/general-rate-limiter.d.ts.map +1 -1
- package/dist/cjs/nodes/general/general-rate-limiter.js +46 -78
- package/dist/cjs/nodes/general/general-rate-limiter.js.map +1 -1
- package/dist/cjs/nodes/general/general-wait.d.ts +3 -0
- package/dist/cjs/nodes/general/general-wait.d.ts.map +1 -0
- package/dist/cjs/nodes/general/general-wait.js +81 -0
- package/dist/cjs/nodes/general/general-wait.js.map +1 -0
- package/dist/cjs/nodes/general/visitor-request.d.ts +44 -0
- package/dist/cjs/nodes/general/visitor-request.d.ts.map +1 -0
- package/dist/cjs/nodes/general/visitor-request.js +72 -0
- package/dist/cjs/nodes/general/visitor-request.js.map +1 -0
- package/dist/cjs/nodes/index.d.ts.map +1 -1
- package/dist/cjs/nodes/index.js +7 -1
- package/dist/cjs/nodes/index.js.map +1 -1
- package/dist/cjs/nodes/integrations/integration-slack.d.ts.map +1 -1
- package/dist/cjs/nodes/integrations/integration-slack.js +17 -6
- package/dist/cjs/nodes/integrations/integration-slack.js.map +1 -1
- package/dist/cjs/nodes/newsletter/newsletter-confirm.d.ts +3 -0
- package/dist/cjs/nodes/newsletter/newsletter-confirm.d.ts.map +1 -0
- package/dist/cjs/nodes/newsletter/newsletter-confirm.js +41 -0
- package/dist/cjs/nodes/newsletter/newsletter-confirm.js.map +1 -0
- package/dist/cjs/nodes/newsletter/newsletter-subscribe.d.ts +7 -0
- package/dist/cjs/nodes/newsletter/newsletter-subscribe.d.ts.map +1 -0
- package/dist/cjs/nodes/newsletter/newsletter-subscribe.js +69 -0
- package/dist/cjs/nodes/newsletter/newsletter-subscribe.js.map +1 -0
- package/dist/cjs/nodes/newsletter/newsletter-unsubscribe.d.ts +3 -0
- package/dist/cjs/nodes/newsletter/newsletter-unsubscribe.d.ts.map +1 -0
- package/dist/cjs/nodes/newsletter/newsletter-unsubscribe.js +42 -0
- package/dist/cjs/nodes/newsletter/newsletter-unsubscribe.js.map +1 -0
- package/dist/cjs/nodes/realtime/realtime-join-channel.d.ts.map +1 -1
- package/dist/cjs/nodes/realtime/realtime-join-channel.js +5 -4
- package/dist/cjs/nodes/realtime/realtime-join-channel.js.map +1 -1
- package/dist/cjs/nodes/realtime/realtime-send-channel-event.d.ts.map +1 -1
- package/dist/cjs/nodes/realtime/realtime-send-channel-event.js +11 -2
- package/dist/cjs/nodes/realtime/realtime-send-channel-event.js.map +1 -1
- package/dist/cjs/nodes/realtime/realtime-send-channel-message.d.ts.map +1 -1
- package/dist/cjs/nodes/realtime/realtime-send-channel-message.js +11 -2
- package/dist/cjs/nodes/realtime/realtime-send-channel-message.js.map +1 -1
- package/dist/cjs/nodes/sms/sms-infobip.d.ts.map +1 -1
- package/dist/cjs/nodes/sms/sms-infobip.js +11 -8
- package/dist/cjs/nodes/sms/sms-infobip.js.map +1 -1
- package/dist/cjs/nodes/sms/sms-smsapi.d.ts.map +1 -1
- package/dist/cjs/nodes/sms/sms-smsapi.js +11 -8
- package/dist/cjs/nodes/sms/sms-smsapi.js.map +1 -1
- package/dist/cjs/nodes/sms/sms-textmagic.d.ts.map +1 -1
- package/dist/cjs/nodes/sms/sms-textmagic.js +11 -8
- package/dist/cjs/nodes/sms/sms-textmagic.js.map +1 -1
- package/dist/cjs/nodes/sms/sms-twilio.d.ts.map +1 -1
- package/dist/cjs/nodes/sms/sms-twilio.js +12 -10
- package/dist/cjs/nodes/sms/sms-twilio.js.map +1 -1
- package/dist/cjs/nodes/types.d.ts +8 -1
- package/dist/cjs/nodes/types.d.ts.map +1 -1
- package/dist/cjs/nodes/utility/utility-similarity-scoring.d.ts.map +1 -1
- package/dist/cjs/nodes/utility/utility-similarity-scoring.js +29 -10
- package/dist/cjs/nodes/utility/utility-similarity-scoring.js.map +1 -1
- package/dist/cjs/page-access-guard-generator.d.ts +23 -0
- package/dist/cjs/page-access-guard-generator.d.ts.map +1 -0
- package/dist/cjs/page-access-guard-generator.js +135 -0
- package/dist/cjs/page-access-guard-generator.js.map +1 -0
- package/dist/cjs/password-reset-route-generator.d.ts +119 -0
- package/dist/cjs/password-reset-route-generator.d.ts.map +1 -0
- package/dist/cjs/password-reset-route-generator.js +460 -0
- package/dist/cjs/password-reset-route-generator.js.map +1 -0
- package/dist/cjs/payments/payment-core-code.d.ts.map +1 -1
- package/dist/cjs/payments/payment-core-code.js +12 -7
- package/dist/cjs/payments/payment-core-code.js.map +1 -1
- package/dist/cjs/project-code-scanner.d.ts +11 -0
- package/dist/cjs/project-code-scanner.d.ts.map +1 -0
- package/dist/cjs/project-code-scanner.js +80 -0
- package/dist/cjs/project-code-scanner.js.map +1 -0
- package/dist/cjs/public-step-guards.d.ts +122 -0
- package/dist/cjs/public-step-guards.d.ts.map +1 -0
- package/dist/cjs/public-step-guards.js +288 -0
- package/dist/cjs/public-step-guards.js.map +1 -0
- package/dist/cjs/publish-refusals.d.ts +66 -0
- package/dist/cjs/publish-refusals.d.ts.map +1 -0
- package/dist/cjs/publish-refusals.js +278 -0
- package/dist/cjs/publish-refusals.js.map +1 -0
- package/dist/cjs/realtime-generator.d.ts +63 -1
- package/dist/cjs/realtime-generator.d.ts.map +1 -1
- package/dist/cjs/realtime-generator.js +404 -230
- package/dist/cjs/realtime-generator.js.map +1 -1
- package/dist/cjs/runtime-storage-generator.d.ts +32 -1
- package/dist/cjs/runtime-storage-generator.d.ts.map +1 -1
- package/dist/cjs/runtime-storage-generator.js +265 -12
- package/dist/cjs/runtime-storage-generator.js.map +1 -1
- package/dist/cjs/security-runtime/index.d.ts +14 -0
- package/dist/cjs/security-runtime/index.d.ts.map +1 -0
- package/dist/cjs/security-runtime/index.js +48 -0
- package/dist/cjs/security-runtime/index.js.map +1 -0
- package/dist/cjs/security-runtime/security-runtime-code.d.ts +53 -0
- package/dist/cjs/security-runtime/security-runtime-code.d.ts.map +1 -0
- package/dist/cjs/security-runtime/security-runtime-code.js +580 -0
- package/dist/cjs/security-runtime/security-runtime-code.js.map +1 -0
- package/dist/cjs/security-scanner.d.ts +72 -3
- package/dist/cjs/security-scanner.d.ts.map +1 -1
- package/dist/cjs/security-scanner.js +220 -8
- package/dist/cjs/security-scanner.js.map +1 -1
- package/dist/cjs/segment-splitter.d.ts.map +1 -1
- package/dist/cjs/segment-splitter.js +10 -2
- package/dist/cjs/segment-splitter.js.map +1 -1
- package/dist/cjs/segment-trust.d.ts +36 -0
- package/dist/cjs/segment-trust.d.ts.map +1 -1
- package/dist/cjs/segment-trust.js +147 -3
- package/dist/cjs/segment-trust.js.map +1 -1
- package/dist/cjs/self-call-headers.d.ts +31 -0
- package/dist/cjs/self-call-headers.d.ts.map +1 -0
- package/dist/cjs/self-call-headers.js +48 -0
- package/dist/cjs/self-call-headers.js.map +1 -0
- package/dist/cjs/sent-email-log/index.d.ts +7 -0
- package/dist/cjs/sent-email-log/index.d.ts.map +1 -1
- package/dist/cjs/sent-email-log/index.js +17 -1
- package/dist/cjs/sent-email-log/index.js.map +1 -1
- package/dist/cjs/sent-email-log/sent-email-log-code.d.ts +7 -0
- package/dist/cjs/sent-email-log/sent-email-log-code.d.ts.map +1 -1
- package/dist/cjs/sent-email-log/sent-email-log-code.js +17 -3
- package/dist/cjs/sent-email-log/sent-email-log-code.js.map +1 -1
- package/dist/cjs/server-custom-node-call.d.ts +79 -0
- package/dist/cjs/server-custom-node-call.d.ts.map +1 -0
- package/dist/cjs/server-custom-node-call.js +285 -0
- package/dist/cjs/server-custom-node-call.js.map +1 -0
- package/dist/cjs/server-runtime-code.d.ts +39 -12
- package/dist/cjs/server-runtime-code.d.ts.map +1 -1
- package/dist/cjs/server-runtime-code.js +484 -41
- package/dist/cjs/server-runtime-code.js.map +1 -1
- package/dist/cjs/session-cookie-resolver.d.ts +3 -1
- package/dist/cjs/session-cookie-resolver.d.ts.map +1 -1
- package/dist/cjs/session-revocation-generator.d.ts +39 -0
- package/dist/cjs/session-revocation-generator.d.ts.map +1 -0
- package/dist/cjs/session-revocation-generator.js +177 -0
- package/dist/cjs/session-revocation-generator.js.map +1 -0
- package/dist/cjs/slack-message-values.d.ts +6 -0
- package/dist/cjs/slack-message-values.d.ts.map +1 -0
- package/dist/cjs/slack-message-values.js +73 -0
- package/dist/cjs/slack-message-values.js.map +1 -0
- package/dist/cjs/transactional-email-code.d.ts +11 -0
- package/dist/cjs/transactional-email-code.d.ts.map +1 -1
- package/dist/cjs/transactional-email-code.js +29 -5
- package/dist/cjs/transactional-email-code.js.map +1 -1
- package/dist/cjs/trigger-generator.d.ts +2 -0
- package/dist/cjs/trigger-generator.d.ts.map +1 -1
- package/dist/cjs/trigger-generator.js +17 -4
- package/dist/cjs/trigger-generator.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/cjs/visitor-step-limits.d.ts +66 -0
- package/dist/cjs/visitor-step-limits.d.ts.map +1 -0
- package/dist/cjs/visitor-step-limits.js +187 -0
- package/dist/cjs/visitor-step-limits.js.map +1 -0
- package/dist/cjs/webhook-generator.d.ts.map +1 -1
- package/dist/cjs/webhook-generator.js +93 -15
- package/dist/cjs/webhook-generator.js.map +1 -1
- package/dist/cjs/webhook-signature-verification.d.ts.map +1 -1
- package/dist/cjs/webhook-signature-verification.js +13 -3
- package/dist/cjs/webhook-signature-verification.js.map +1 -1
- package/dist/cjs/workflow-auth-generator.d.ts +4 -1
- package/dist/cjs/workflow-auth-generator.d.ts.map +1 -1
- package/dist/cjs/workflow-auth-generator.js +8 -3
- package/dist/cjs/workflow-auth-generator.js.map +1 -1
- package/dist/cjs/workflow-component-plugin.js +11 -3
- package/dist/cjs/workflow-component-plugin.js.map +1 -1
- package/dist/cjs/workflow-project-plugin.d.ts.map +1 -1
- package/dist/cjs/workflow-project-plugin.js +302 -56
- package/dist/cjs/workflow-project-plugin.js.map +1 -1
- package/dist/cjs/workflow-scope.d.ts.map +1 -1
- package/dist/cjs/workflow-scope.js +5 -0
- package/dist/cjs/workflow-scope.js.map +1 -1
- package/dist/esm/account-delete-route-generator.d.ts +1 -0
- package/dist/esm/account-delete-route-generator.d.ts.map +1 -1
- package/dist/esm/account-delete-route-generator.js +18 -3
- package/dist/esm/account-delete-route-generator.js.map +1 -1
- package/dist/esm/api-route-generator.d.ts +52 -3
- package/dist/esm/api-route-generator.d.ts.map +1 -1
- package/dist/esm/api-route-generator.js +595 -142
- package/dist/esm/api-route-generator.js.map +1 -1
- package/dist/esm/auth-generator.d.ts +126 -3
- package/dist/esm/auth-generator.d.ts.map +1 -1
- package/dist/esm/auth-generator.js +1350 -140
- package/dist/esm/auth-generator.js.map +1 -1
- package/dist/esm/automations/activity-kicks.d.ts +12 -0
- package/dist/esm/automations/activity-kicks.d.ts.map +1 -0
- package/dist/esm/automations/activity-kicks.js +118 -0
- package/dist/esm/automations/activity-kicks.js.map +1 -0
- package/dist/esm/automations/app-events-source.d.ts +33 -0
- package/dist/esm/automations/app-events-source.d.ts.map +1 -0
- package/dist/esm/automations/app-events-source.js +104 -0
- package/dist/esm/automations/app-events-source.js.map +1 -0
- package/dist/esm/automations/automations-project-plugin.d.ts +21 -0
- package/dist/esm/automations/automations-project-plugin.d.ts.map +1 -0
- package/dist/esm/automations/automations-project-plugin.js +98 -0
- package/dist/esm/automations/automations-project-plugin.js.map +1 -0
- package/dist/esm/automations/automations-scope.d.ts +104 -0
- package/dist/esm/automations/automations-scope.d.ts.map +1 -0
- package/dist/esm/automations/automations-scope.js +165 -0
- package/dist/esm/automations/automations-scope.js.map +1 -0
- package/dist/esm/automations/dispatcher-source.d.ts +72 -0
- package/dist/esm/automations/dispatcher-source.d.ts.map +1 -0
- package/dist/esm/automations/dispatcher-source.js +999 -0
- package/dist/esm/automations/dispatcher-source.js.map +1 -0
- package/dist/esm/automations/event-bus-source.d.ts +44 -0
- package/dist/esm/automations/event-bus-source.d.ts.map +1 -0
- package/dist/esm/automations/event-bus-source.js +421 -0
- package/dist/esm/automations/event-bus-source.js.map +1 -0
- package/dist/esm/automations/handler-module-generator.d.ts +25 -0
- package/dist/esm/automations/handler-module-generator.d.ts.map +1 -0
- package/dist/esm/automations/handler-module-generator.js +71 -0
- package/dist/esm/automations/handler-module-generator.js.map +1 -0
- package/dist/esm/automations/hydrators-source.d.ts +33 -0
- package/dist/esm/automations/hydrators-source.d.ts.map +1 -0
- package/dist/esm/automations/hydrators-source.js +567 -0
- package/dist/esm/automations/hydrators-source.js.map +1 -0
- package/dist/esm/booking-calendar-feed-route-generator.d.ts.map +1 -1
- package/dist/esm/booking-calendar-feed-route-generator.js +8 -0
- package/dist/esm/booking-calendar-feed-route-generator.js.map +1 -1
- package/dist/esm/configured-nextauth-url.d.ts +17 -0
- package/dist/esm/configured-nextauth-url.d.ts.map +1 -0
- package/dist/esm/configured-nextauth-url.js +17 -0
- package/dist/esm/configured-nextauth-url.js.map +1 -0
- package/dist/esm/cron-request-verification.d.ts +22 -1
- package/dist/esm/cron-request-verification.d.ts.map +1 -1
- package/dist/esm/cron-request-verification.js +48 -5
- package/dist/esm/cron-request-verification.js.map +1 -1
- package/dist/esm/data-api-route-generator.d.ts +19 -0
- package/dist/esm/data-api-route-generator.d.ts.map +1 -1
- package/dist/esm/data-api-route-generator.js +710 -43
- package/dist/esm/data-api-route-generator.js.map +1 -1
- package/dist/esm/ecommerce/parameterized-stock-chain.d.ts +3 -1
- package/dist/esm/ecommerce/parameterized-stock-chain.d.ts.map +1 -1
- package/dist/esm/ecommerce/parameterized-stock-chain.js +43 -4
- package/dist/esm/ecommerce/parameterized-stock-chain.js.map +1 -1
- package/dist/esm/ecommerce/place-order-guards.d.ts +126 -0
- package/dist/esm/ecommerce/place-order-guards.d.ts.map +1 -0
- package/dist/esm/ecommerce/place-order-guards.js +655 -0
- package/dist/esm/ecommerce/place-order-guards.js.map +1 -0
- package/dist/esm/ecommerce-customhandler-rewriter.d.ts +2 -0
- package/dist/esm/ecommerce-customhandler-rewriter.d.ts.map +1 -1
- package/dist/esm/ecommerce-customhandler-rewriter.js +38 -2
- package/dist/esm/ecommerce-customhandler-rewriter.js.map +1 -1
- package/dist/esm/executor-generator.d.ts.map +1 -1
- package/dist/esm/executor-generator.js +368 -60
- package/dist/esm/executor-generator.js.map +1 -1
- package/dist/esm/graph-utils.d.ts +9 -0
- package/dist/esm/graph-utils.d.ts.map +1 -1
- package/dist/esm/graph-utils.js +30 -0
- package/dist/esm/graph-utils.js.map +1 -1
- package/dist/esm/index.d.ts +20 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +27 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/invoice/api-routes-code.d.ts +9 -3
- package/dist/esm/invoice/api-routes-code.d.ts.map +1 -1
- package/dist/esm/invoice/api-routes-code.js +9 -7
- package/dist/esm/invoice/api-routes-code.js.map +1 -1
- package/dist/esm/invoice/index.d.ts.map +1 -1
- package/dist/esm/invoice/index.js +12 -7
- package/dist/esm/invoice/index.js.map +1 -1
- package/dist/esm/invoice/invoice-assembly-code.d.ts.map +1 -1
- package/dist/esm/invoice/invoice-assembly-code.js +8 -3
- package/dist/esm/invoice/invoice-assembly-code.js.map +1 -1
- package/dist/esm/invoice/pdf-generator-code.d.ts.map +1 -1
- package/dist/esm/invoice/pdf-generator-code.js +2 -1
- package/dist/esm/invoice/pdf-generator-code.js.map +1 -1
- package/dist/esm/invoice/pdf-service-client-code.d.ts.map +1 -1
- package/dist/esm/invoice/pdf-service-client-code.js +15 -7
- package/dist/esm/invoice/pdf-service-client-code.js.map +1 -1
- package/dist/esm/newsletter/admin-route-code.d.ts +60 -0
- package/dist/esm/newsletter/admin-route-code.d.ts.map +1 -0
- package/dist/esm/newsletter/admin-route-code.js +295 -0
- package/dist/esm/newsletter/admin-route-code.js.map +1 -0
- package/dist/esm/newsletter/helper-code.d.ts +109 -0
- package/dist/esm/newsletter/helper-code.d.ts.map +1 -0
- package/dist/esm/newsletter/helper-code.js +656 -0
- package/dist/esm/newsletter/helper-code.js.map +1 -0
- package/dist/esm/newsletter/newsletter-scope.d.ts +65 -0
- package/dist/esm/newsletter/newsletter-scope.d.ts.map +1 -0
- package/dist/esm/newsletter/newsletter-scope.js +97 -0
- package/dist/esm/newsletter/newsletter-scope.js.map +1 -0
- package/dist/esm/newsletter/project-plugin.d.ts +18 -0
- package/dist/esm/newsletter/project-plugin.d.ts.map +1 -0
- package/dist/esm/newsletter/project-plugin.js +93 -0
- package/dist/esm/newsletter/project-plugin.js.map +1 -0
- package/dist/esm/newsletter/routes-code.d.ts +6 -0
- package/dist/esm/newsletter/routes-code.d.ts.map +1 -0
- package/dist/esm/newsletter/routes-code.js +175 -0
- package/dist/esm/newsletter/routes-code.js.map +1 -0
- package/dist/esm/nodes/account/account-compare-passwords.d.ts.map +1 -1
- package/dist/esm/nodes/account/account-compare-passwords.js +16 -6
- package/dist/esm/nodes/account/account-compare-passwords.js.map +1 -1
- package/dist/esm/nodes/account/account-delete-current.js +1 -1
- package/dist/esm/nodes/account/account-get-current.js +1 -1
- package/dist/esm/nodes/account/account-hash-password.d.ts.map +1 -1
- package/dist/esm/nodes/account/account-hash-password.js +15 -3
- package/dist/esm/nodes/account/account-hash-password.js.map +1 -1
- package/dist/esm/nodes/account/account-login.d.ts.map +1 -1
- package/dist/esm/nodes/account/account-login.js +23 -6
- package/dist/esm/nodes/account/account-login.js.map +1 -1
- package/dist/esm/nodes/account/account-logout.js +1 -1
- package/dist/esm/nodes/account/account-refresh-session.js +1 -1
- package/dist/esm/nodes/account/account-request-password-reset.d.ts +3 -0
- package/dist/esm/nodes/account/account-request-password-reset.d.ts.map +1 -0
- package/dist/esm/nodes/account/account-request-password-reset.js +43 -0
- package/dist/esm/nodes/account/account-request-password-reset.js.map +1 -0
- package/dist/esm/nodes/account/account-reset-password.d.ts +3 -0
- package/dist/esm/nodes/account/account-reset-password.d.ts.map +1 -0
- package/dist/esm/nodes/account/account-reset-password.js +41 -0
- package/dist/esm/nodes/account/account-reset-password.js.map +1 -0
- package/dist/esm/nodes/account/account-signup.d.ts.map +1 -1
- package/dist/esm/nodes/account/account-signup.js +82 -19
- package/dist/esm/nodes/account/account-signup.js.map +1 -1
- package/dist/esm/nodes/account/account-social-login.js +1 -1
- package/dist/esm/nodes/ai/ai-custom-prompt.d.ts.map +1 -1
- package/dist/esm/nodes/ai/ai-custom-prompt.js +20 -5
- package/dist/esm/nodes/ai/ai-custom-prompt.js.map +1 -1
- package/dist/esm/nodes/ai/ai-detect-language.d.ts.map +1 -1
- package/dist/esm/nodes/ai/ai-detect-language.js +20 -5
- package/dist/esm/nodes/ai/ai-detect-language.js.map +1 -1
- package/dist/esm/nodes/ai/ai-generate-text-embedding.d.ts.map +1 -1
- package/dist/esm/nodes/ai/ai-generate-text-embedding.js +10 -2
- package/dist/esm/nodes/ai/ai-generate-text-embedding.js.map +1 -1
- package/dist/esm/nodes/ai/ai-provider-utils-sources.generated.js +2 -2
- package/dist/esm/nodes/ai/ai-provider-utils-sources.generated.js.map +1 -1
- package/dist/esm/nodes/ai/ai-provider-utils.d.ts +31 -2
- package/dist/esm/nodes/ai/ai-provider-utils.d.ts.map +1 -1
- package/dist/esm/nodes/ai/ai-provider-utils.js +124 -10
- package/dist/esm/nodes/ai/ai-provider-utils.js.map +1 -1
- package/dist/esm/nodes/ai/ai-select-database-data.d.ts.map +1 -1
- package/dist/esm/nodes/ai/ai-select-database-data.js +6 -2
- package/dist/esm/nodes/ai/ai-select-database-data.js.map +1 -1
- package/dist/esm/nodes/ai/ai-sentiment-analysis.d.ts.map +1 -1
- package/dist/esm/nodes/ai/ai-sentiment-analysis.js +20 -5
- package/dist/esm/nodes/ai/ai-sentiment-analysis.js.map +1 -1
- package/dist/esm/nodes/ai/ai-summarization.d.ts.map +1 -1
- package/dist/esm/nodes/ai/ai-summarization.js +20 -5
- package/dist/esm/nodes/ai/ai-summarization.js.map +1 -1
- package/dist/esm/nodes/ai/ai-text-classifier.d.ts.map +1 -1
- package/dist/esm/nodes/ai/ai-text-classifier.js +20 -5
- package/dist/esm/nodes/ai/ai-text-classifier.js.map +1 -1
- package/dist/esm/nodes/ai/ai-text-transform.d.ts.map +1 -1
- package/dist/esm/nodes/ai/ai-text-transform.js +20 -5
- package/dist/esm/nodes/ai/ai-text-transform.js.map +1 -1
- package/dist/esm/nodes/analytics/analytics-track-outcome.d.ts +3 -0
- package/dist/esm/nodes/analytics/analytics-track-outcome.d.ts.map +1 -0
- package/dist/esm/nodes/analytics/analytics-track-outcome.js +107 -0
- package/dist/esm/nodes/analytics/analytics-track-outcome.js.map +1 -0
- package/dist/esm/nodes/cart/cart-price-order.d.ts.map +1 -1
- package/dist/esm/nodes/cart/cart-price-order.js +161 -2
- package/dist/esm/nodes/cart/cart-price-order.js.map +1 -1
- package/dist/esm/nodes/cost-bearing-node-types.d.ts +4 -0
- package/dist/esm/nodes/cost-bearing-node-types.d.ts.map +1 -0
- package/dist/esm/nodes/cost-bearing-node-types.js +39 -0
- package/dist/esm/nodes/cost-bearing-node-types.js.map +1 -0
- package/dist/esm/nodes/data/data-select.d.ts.map +1 -1
- package/dist/esm/nodes/data/data-select.js +12 -2
- package/dist/esm/nodes/data/data-select.js.map +1 -1
- package/dist/esm/nodes/email/email-mailersend.d.ts.map +1 -1
- package/dist/esm/nodes/email/email-mailersend.js +15 -11
- package/dist/esm/nodes/email/email-mailersend.js.map +1 -1
- package/dist/esm/nodes/email/email-mailgun.d.ts.map +1 -1
- package/dist/esm/nodes/email/email-mailgun.js +15 -15
- package/dist/esm/nodes/email/email-mailgun.js.map +1 -1
- package/dist/esm/nodes/email/email-postmark.d.ts.map +1 -1
- package/dist/esm/nodes/email/email-postmark.js +15 -15
- package/dist/esm/nodes/email/email-postmark.js.map +1 -1
- package/dist/esm/nodes/email/email-resend.d.ts.map +1 -1
- package/dist/esm/nodes/email/email-resend.js +15 -15
- package/dist/esm/nodes/email/email-resend.js.map +1 -1
- package/dist/esm/nodes/email/email-sendgrid.d.ts.map +1 -1
- package/dist/esm/nodes/email/email-sendgrid.js +15 -15
- package/dist/esm/nodes/email/email-sendgrid.js.map +1 -1
- package/dist/esm/nodes/email/html-escape-code.d.ts +3 -0
- package/dist/esm/nodes/email/html-escape-code.d.ts.map +1 -0
- package/dist/esm/nodes/email/html-escape-code.js +18 -0
- package/dist/esm/nodes/email/html-escape-code.js.map +1 -0
- package/dist/esm/nodes/email/message-trust.d.ts +40 -0
- package/dist/esm/nodes/email/message-trust.d.ts.map +1 -0
- package/dist/esm/nodes/email/message-trust.js +161 -0
- package/dist/esm/nodes/email/message-trust.js.map +1 -0
- package/dist/esm/nodes/email/outbound-message-guard.d.ts +113 -0
- package/dist/esm/nodes/email/outbound-message-guard.d.ts.map +1 -0
- package/dist/esm/nodes/email/outbound-message-guard.js +452 -0
- package/dist/esm/nodes/email/outbound-message-guard.js.map +1 -0
- package/dist/esm/nodes/email/trusted-html-code.d.ts +22 -0
- package/dist/esm/nodes/email/trusted-html-code.d.ts.map +1 -0
- package/dist/esm/nodes/email/trusted-html-code.js +49 -0
- package/dist/esm/nodes/email/trusted-html-code.js.map +1 -0
- package/dist/esm/nodes/general/general-custom-js.d.ts.map +1 -1
- package/dist/esm/nodes/general/general-custom-js.js +44 -7
- package/dist/esm/nodes/general/general-custom-js.js.map +1 -1
- package/dist/esm/nodes/general/general-http-request.d.ts.map +1 -1
- package/dist/esm/nodes/general/general-http-request.js +431 -45
- package/dist/esm/nodes/general/general-http-request.js.map +1 -1
- package/dist/esm/nodes/general/general-rate-limiter.d.ts.map +1 -1
- package/dist/esm/nodes/general/general-rate-limiter.js +46 -78
- package/dist/esm/nodes/general/general-rate-limiter.js.map +1 -1
- package/dist/esm/nodes/general/general-wait.d.ts +3 -0
- package/dist/esm/nodes/general/general-wait.d.ts.map +1 -0
- package/dist/esm/nodes/general/general-wait.js +78 -0
- package/dist/esm/nodes/general/general-wait.js.map +1 -0
- package/dist/esm/nodes/general/visitor-request.d.ts +44 -0
- package/dist/esm/nodes/general/visitor-request.d.ts.map +1 -0
- package/dist/esm/nodes/general/visitor-request.js +65 -0
- package/dist/esm/nodes/general/visitor-request.js.map +1 -0
- package/dist/esm/nodes/index.d.ts.map +1 -1
- package/dist/esm/nodes/index.js +7 -1
- package/dist/esm/nodes/index.js.map +1 -1
- package/dist/esm/nodes/integrations/integration-slack.d.ts.map +1 -1
- package/dist/esm/nodes/integrations/integration-slack.js +17 -6
- package/dist/esm/nodes/integrations/integration-slack.js.map +1 -1
- package/dist/esm/nodes/newsletter/newsletter-confirm.d.ts +3 -0
- package/dist/esm/nodes/newsletter/newsletter-confirm.d.ts.map +1 -0
- package/dist/esm/nodes/newsletter/newsletter-confirm.js +38 -0
- package/dist/esm/nodes/newsletter/newsletter-confirm.js.map +1 -0
- package/dist/esm/nodes/newsletter/newsletter-subscribe.d.ts +7 -0
- package/dist/esm/nodes/newsletter/newsletter-subscribe.d.ts.map +1 -0
- package/dist/esm/nodes/newsletter/newsletter-subscribe.js +66 -0
- package/dist/esm/nodes/newsletter/newsletter-subscribe.js.map +1 -0
- package/dist/esm/nodes/newsletter/newsletter-unsubscribe.d.ts +3 -0
- package/dist/esm/nodes/newsletter/newsletter-unsubscribe.d.ts.map +1 -0
- package/dist/esm/nodes/newsletter/newsletter-unsubscribe.js +39 -0
- package/dist/esm/nodes/newsletter/newsletter-unsubscribe.js.map +1 -0
- package/dist/esm/nodes/realtime/realtime-join-channel.d.ts.map +1 -1
- package/dist/esm/nodes/realtime/realtime-join-channel.js +5 -4
- package/dist/esm/nodes/realtime/realtime-join-channel.js.map +1 -1
- package/dist/esm/nodes/realtime/realtime-send-channel-event.d.ts.map +1 -1
- package/dist/esm/nodes/realtime/realtime-send-channel-event.js +11 -2
- package/dist/esm/nodes/realtime/realtime-send-channel-event.js.map +1 -1
- package/dist/esm/nodes/realtime/realtime-send-channel-message.d.ts.map +1 -1
- package/dist/esm/nodes/realtime/realtime-send-channel-message.js +11 -2
- package/dist/esm/nodes/realtime/realtime-send-channel-message.js.map +1 -1
- package/dist/esm/nodes/sms/sms-infobip.d.ts.map +1 -1
- package/dist/esm/nodes/sms/sms-infobip.js +11 -8
- package/dist/esm/nodes/sms/sms-infobip.js.map +1 -1
- package/dist/esm/nodes/sms/sms-smsapi.d.ts.map +1 -1
- package/dist/esm/nodes/sms/sms-smsapi.js +11 -8
- package/dist/esm/nodes/sms/sms-smsapi.js.map +1 -1
- package/dist/esm/nodes/sms/sms-textmagic.d.ts.map +1 -1
- package/dist/esm/nodes/sms/sms-textmagic.js +11 -8
- package/dist/esm/nodes/sms/sms-textmagic.js.map +1 -1
- package/dist/esm/nodes/sms/sms-twilio.d.ts.map +1 -1
- package/dist/esm/nodes/sms/sms-twilio.js +12 -10
- package/dist/esm/nodes/sms/sms-twilio.js.map +1 -1
- package/dist/esm/nodes/types.d.ts +8 -1
- package/dist/esm/nodes/types.d.ts.map +1 -1
- package/dist/esm/nodes/utility/utility-similarity-scoring.d.ts.map +1 -1
- package/dist/esm/nodes/utility/utility-similarity-scoring.js +29 -10
- package/dist/esm/nodes/utility/utility-similarity-scoring.js.map +1 -1
- package/dist/esm/page-access-guard-generator.d.ts +23 -0
- package/dist/esm/page-access-guard-generator.d.ts.map +1 -0
- package/dist/esm/page-access-guard-generator.js +131 -0
- package/dist/esm/page-access-guard-generator.js.map +1 -0
- package/dist/esm/password-reset-route-generator.d.ts +119 -0
- package/dist/esm/password-reset-route-generator.d.ts.map +1 -0
- package/dist/esm/password-reset-route-generator.js +448 -0
- package/dist/esm/password-reset-route-generator.js.map +1 -0
- package/dist/esm/payments/payment-core-code.d.ts.map +1 -1
- package/dist/esm/payments/payment-core-code.js +12 -7
- package/dist/esm/payments/payment-core-code.js.map +1 -1
- package/dist/esm/project-code-scanner.d.ts +11 -0
- package/dist/esm/project-code-scanner.d.ts.map +1 -0
- package/dist/esm/project-code-scanner.js +75 -0
- package/dist/esm/project-code-scanner.js.map +1 -0
- package/dist/esm/public-step-guards.d.ts +122 -0
- package/dist/esm/public-step-guards.d.ts.map +1 -0
- package/dist/esm/public-step-guards.js +280 -0
- package/dist/esm/public-step-guards.js.map +1 -0
- package/dist/esm/publish-refusals.d.ts +66 -0
- package/dist/esm/publish-refusals.d.ts.map +1 -0
- package/dist/esm/publish-refusals.js +271 -0
- package/dist/esm/publish-refusals.js.map +1 -0
- package/dist/esm/realtime-generator.d.ts +63 -1
- package/dist/esm/realtime-generator.d.ts.map +1 -1
- package/dist/esm/realtime-generator.js +401 -229
- package/dist/esm/realtime-generator.js.map +1 -1
- package/dist/esm/runtime-storage-generator.d.ts +32 -1
- package/dist/esm/runtime-storage-generator.d.ts.map +1 -1
- package/dist/esm/runtime-storage-generator.js +264 -11
- package/dist/esm/runtime-storage-generator.js.map +1 -1
- package/dist/esm/security-runtime/index.d.ts +14 -0
- package/dist/esm/security-runtime/index.d.ts.map +1 -0
- package/dist/esm/security-runtime/index.js +37 -0
- package/dist/esm/security-runtime/index.js.map +1 -0
- package/dist/esm/security-runtime/security-runtime-code.d.ts +53 -0
- package/dist/esm/security-runtime/security-runtime-code.d.ts.map +1 -0
- package/dist/esm/security-runtime/security-runtime-code.js +575 -0
- package/dist/esm/security-runtime/security-runtime-code.js.map +1 -0
- package/dist/esm/security-scanner.d.ts +72 -3
- package/dist/esm/security-scanner.d.ts.map +1 -1
- package/dist/esm/security-scanner.js +217 -8
- package/dist/esm/security-scanner.js.map +1 -1
- package/dist/esm/segment-splitter.d.ts.map +1 -1
- package/dist/esm/segment-splitter.js +10 -2
- package/dist/esm/segment-splitter.js.map +1 -1
- package/dist/esm/segment-trust.d.ts +36 -0
- package/dist/esm/segment-trust.d.ts.map +1 -1
- package/dist/esm/segment-trust.js +146 -2
- package/dist/esm/segment-trust.js.map +1 -1
- package/dist/esm/self-call-headers.d.ts +31 -0
- package/dist/esm/self-call-headers.d.ts.map +1 -0
- package/dist/esm/self-call-headers.js +43 -0
- package/dist/esm/self-call-headers.js.map +1 -0
- package/dist/esm/sent-email-log/index.d.ts +7 -0
- package/dist/esm/sent-email-log/index.d.ts.map +1 -1
- package/dist/esm/sent-email-log/index.js +15 -0
- package/dist/esm/sent-email-log/index.js.map +1 -1
- package/dist/esm/sent-email-log/sent-email-log-code.d.ts +7 -0
- package/dist/esm/sent-email-log/sent-email-log-code.d.ts.map +1 -1
- package/dist/esm/sent-email-log/sent-email-log-code.js +17 -3
- package/dist/esm/sent-email-log/sent-email-log-code.js.map +1 -1
- package/dist/esm/server-custom-node-call.d.ts +79 -0
- package/dist/esm/server-custom-node-call.d.ts.map +1 -0
- package/dist/esm/server-custom-node-call.js +278 -0
- package/dist/esm/server-custom-node-call.js.map +1 -0
- package/dist/esm/server-runtime-code.d.ts +39 -12
- package/dist/esm/server-runtime-code.d.ts.map +1 -1
- package/dist/esm/server-runtime-code.js +483 -40
- package/dist/esm/server-runtime-code.js.map +1 -1
- package/dist/esm/session-cookie-resolver.d.ts +3 -1
- package/dist/esm/session-cookie-resolver.d.ts.map +1 -1
- package/dist/esm/session-revocation-generator.d.ts +39 -0
- package/dist/esm/session-revocation-generator.d.ts.map +1 -0
- package/dist/esm/session-revocation-generator.js +172 -0
- package/dist/esm/session-revocation-generator.js.map +1 -0
- package/dist/esm/slack-message-values.d.ts +6 -0
- package/dist/esm/slack-message-values.d.ts.map +1 -0
- package/dist/esm/slack-message-values.js +68 -0
- package/dist/esm/slack-message-values.js.map +1 -0
- package/dist/esm/transactional-email-code.d.ts +11 -0
- package/dist/esm/transactional-email-code.d.ts.map +1 -1
- package/dist/esm/transactional-email-code.js +28 -4
- package/dist/esm/transactional-email-code.js.map +1 -1
- package/dist/esm/trigger-generator.d.ts +2 -0
- package/dist/esm/trigger-generator.d.ts.map +1 -1
- package/dist/esm/trigger-generator.js +15 -3
- package/dist/esm/trigger-generator.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/visitor-step-limits.d.ts +66 -0
- package/dist/esm/visitor-step-limits.d.ts.map +1 -0
- package/dist/esm/visitor-step-limits.js +181 -0
- package/dist/esm/visitor-step-limits.js.map +1 -0
- package/dist/esm/webhook-generator.d.ts.map +1 -1
- package/dist/esm/webhook-generator.js +93 -15
- package/dist/esm/webhook-generator.js.map +1 -1
- package/dist/esm/webhook-signature-verification.d.ts.map +1 -1
- package/dist/esm/webhook-signature-verification.js +13 -3
- package/dist/esm/webhook-signature-verification.js.map +1 -1
- package/dist/esm/workflow-auth-generator.d.ts +4 -1
- package/dist/esm/workflow-auth-generator.d.ts.map +1 -1
- package/dist/esm/workflow-auth-generator.js +8 -3
- package/dist/esm/workflow-auth-generator.js.map +1 -1
- package/dist/esm/workflow-component-plugin.js +12 -4
- package/dist/esm/workflow-component-plugin.js.map +1 -1
- package/dist/esm/workflow-project-plugin.d.ts.map +1 -1
- package/dist/esm/workflow-project-plugin.js +306 -60
- package/dist/esm/workflow-project-plugin.js.map +1 -1
- package/dist/esm/workflow-scope.d.ts.map +1 -1
- package/dist/esm/workflow-scope.js +5 -0
- package/dist/esm/workflow-scope.js.map +1 -1
- package/package.json +4 -4
- package/src/account-delete-route-generator.ts +28 -4
- package/src/api-route-generator.ts +712 -134
- package/src/auth-generator.ts +1471 -142
- package/src/automations/activity-kicks.ts +139 -0
- package/src/automations/app-events-source.ts +117 -0
- package/src/automations/automations-project-plugin.ts +202 -0
- package/src/automations/automations-scope.ts +196 -0
- package/src/automations/dispatcher-source.ts +1072 -0
- package/src/automations/event-bus-source.ts +428 -0
- package/src/automations/handler-module-generator.ts +107 -0
- package/src/automations/hydrators-source.ts +647 -0
- package/src/booking-calendar-feed-route-generator.ts +8 -0
- package/src/configured-nextauth-url.ts +17 -0
- package/src/cron-request-verification.ts +55 -5
- package/src/data-api-route-generator.ts +780 -43
- package/src/ecommerce/parameterized-stock-chain.ts +52 -5
- package/src/ecommerce/place-order-guards.ts +785 -0
- package/src/ecommerce-customhandler-rewriter.ts +55 -2
- package/src/executor-generator.ts +372 -60
- package/src/graph-utils.ts +33 -0
- package/src/index.ts +70 -0
- package/src/invoice/api-routes-code.ts +20 -7
- package/src/invoice/index.ts +11 -6
- package/src/invoice/invoice-assembly-code.ts +8 -3
- package/src/invoice/pdf-generator-code.ts +2 -1
- package/src/invoice/pdf-service-client-code.ts +15 -7
- package/src/newsletter/admin-route-code.ts +319 -0
- package/src/newsletter/helper-code.ts +748 -0
- package/src/newsletter/newsletter-scope.ts +116 -0
- package/src/newsletter/project-plugin.ts +119 -0
- package/src/newsletter/routes-code.ts +186 -0
- package/src/nodes/account/account-compare-passwords.ts +17 -6
- package/src/nodes/account/account-delete-current.ts +1 -1
- package/src/nodes/account/account-get-current.ts +1 -1
- package/src/nodes/account/account-hash-password.ts +19 -3
- package/src/nodes/account/account-login.ts +24 -7
- package/src/nodes/account/account-logout.ts +1 -1
- package/src/nodes/account/account-refresh-session.ts +1 -1
- package/src/nodes/account/account-request-password-reset.ts +47 -0
- package/src/nodes/account/account-reset-password.ts +45 -0
- package/src/nodes/account/account-signup.ts +86 -20
- package/src/nodes/account/account-social-login.ts +1 -1
- package/src/nodes/ai/ai-custom-prompt.ts +25 -6
- package/src/nodes/ai/ai-detect-language.ts +25 -6
- package/src/nodes/ai/ai-generate-text-embedding.ts +16 -3
- package/src/nodes/ai/ai-provider-utils-sources.generated.ts +2 -2
- package/src/nodes/ai/ai-provider-utils.ts +135 -10
- package/src/nodes/ai/ai-select-database-data.ts +8 -3
- package/src/nodes/ai/ai-sentiment-analysis.ts +25 -6
- package/src/nodes/ai/ai-summarization.ts +25 -6
- package/src/nodes/ai/ai-text-classifier.ts +25 -6
- package/src/nodes/ai/ai-text-transform.ts +25 -6
- package/src/nodes/analytics/analytics-track-outcome.ts +111 -0
- package/src/nodes/cart/cart-price-order.ts +200 -2
- package/src/nodes/cost-bearing-node-types.ts +45 -0
- package/src/nodes/data/data-select.ts +11 -2
- package/src/nodes/email/email-mailersend.ts +16 -8
- package/src/nodes/email/email-mailgun.ts +17 -12
- package/src/nodes/email/email-postmark.ts +17 -12
- package/src/nodes/email/email-resend.ts +17 -12
- package/src/nodes/email/email-sendgrid.ts +17 -12
- package/src/nodes/email/html-escape-code.ts +21 -0
- package/src/nodes/email/message-trust.ts +198 -0
- package/src/nodes/email/outbound-message-guard.ts +572 -0
- package/src/nodes/email/trusted-html-code.ts +49 -0
- package/src/nodes/general/general-custom-js.ts +46 -7
- package/src/nodes/general/general-http-request.ts +449 -46
- package/src/nodes/general/general-rate-limiter.ts +54 -81
- package/src/nodes/general/general-wait.ts +80 -0
- package/src/nodes/general/visitor-request.ts +79 -0
- package/src/nodes/index.ts +12 -0
- package/src/nodes/integrations/integration-slack.ts +21 -6
- package/src/nodes/newsletter/newsletter-confirm.ts +44 -0
- package/src/nodes/newsletter/newsletter-subscribe.ts +78 -0
- package/src/nodes/newsletter/newsletter-unsubscribe.ts +43 -0
- package/src/nodes/realtime/realtime-join-channel.ts +5 -4
- package/src/nodes/realtime/realtime-send-channel-event.ts +13 -2
- package/src/nodes/realtime/realtime-send-channel-message.ts +13 -2
- package/src/nodes/sms/sms-infobip.ts +14 -4
- package/src/nodes/sms/sms-smsapi.ts +14 -4
- package/src/nodes/sms/sms-textmagic.ts +14 -4
- package/src/nodes/sms/sms-twilio.ts +14 -4
- package/src/nodes/types.ts +9 -1
- package/src/nodes/utility/utility-similarity-scoring.ts +33 -12
- package/src/page-access-guard-generator.ts +154 -0
- package/src/password-reset-route-generator.ts +531 -0
- package/src/payments/payment-core-code.ts +12 -7
- package/src/project-code-scanner.ts +98 -0
- package/src/public-step-guards.ts +448 -0
- package/src/publish-refusals.ts +459 -0
- package/src/realtime-generator.ts +457 -234
- package/src/runtime-storage-generator.ts +270 -11
- package/src/security-runtime/index.ts +53 -0
- package/src/security-runtime/security-runtime-code.ts +579 -0
- package/src/security-scanner.ts +253 -10
- package/src/segment-splitter.ts +10 -2
- package/src/segment-trust.ts +205 -2
- package/src/self-call-headers.ts +46 -0
- package/src/sent-email-log/index.ts +16 -0
- package/src/sent-email-log/sent-email-log-code.ts +30 -4
- package/src/server-custom-node-call.ts +331 -0
- package/src/server-runtime-code.ts +488 -40
- package/src/session-revocation-generator.ts +177 -0
- package/src/slack-message-values.ts +84 -0
- package/src/transactional-email-code.ts +30 -4
- package/src/trigger-generator.ts +19 -3
- package/src/visitor-step-limits.ts +228 -0
- package/src/webhook-generator.ts +94 -14
- package/src/webhook-signature-verification.ts +13 -3
- package/src/workflow-auth-generator.ts +9 -4
- package/src/workflow-component-plugin.ts +14 -4
- package/src/workflow-project-plugin.ts +374 -61
- package/src/workflow-scope.ts +6 -0
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getWebhookRoutePath = exports.findPaymentWebhookRouteUrl = exports.getWebhookRouteFileName = exports.generateWebhookWorkflowAPIRoute = exports.getCronRouteFileName = exports.getAPIRouteFileName = exports.generateCronAPIRoute = exports.generateStreamingServerSegmentAPIRoute = exports.hasStreamingAINode = exports.generateServerSegmentAPIRoute = void 0;
|
|
3
|
+
exports.getWebhookRoutePath = exports.findPaymentWebhookRouteUrl = exports.getWebhookRouteFileName = exports.generateHandlerFunction = exports.generateWebhookWorkflowAPIRoute = exports.isVerifiedWebhookConfig = exports.getCronRouteFileName = exports.getAPIRouteFileName = exports.generateCronAPIRoute = exports.CLIENT_ONLY_NODES = exports.generateStreamingServerSegmentAPIRoute = exports.hasStreamingAINode = exports.generateServerSegmentAPIRoute = exports.SEGMENT_PUBLIC_ERROR = exports.COST_BEARING_STEP_LIMITS = exports.isCostBearingNodeType = void 0;
|
|
4
|
+
const security_runtime_code_1 = require("./security-runtime/security-runtime-code");
|
|
5
|
+
const cost_bearing_node_types_1 = require("./nodes/cost-bearing-node-types");
|
|
6
|
+
Object.defineProperty(exports, "isCostBearingNodeType", { enumerable: true, get: function () { return cost_bearing_node_types_1.isCostBearingNodeType; } });
|
|
4
7
|
const nodes_1 = require("./nodes");
|
|
5
8
|
const types_1 = require("./nodes/types");
|
|
9
|
+
const general_wait_1 = require("./nodes/general/general-wait");
|
|
10
|
+
const visitor_request_1 = require("./nodes/general/visitor-request");
|
|
11
|
+
const outbound_message_guard_1 = require("./nodes/email/outbound-message-guard");
|
|
12
|
+
const ai_provider_utils_1 = require("./nodes/ai/ai-provider-utils");
|
|
13
|
+
const automations_scope_1 = require("./automations/automations-scope");
|
|
6
14
|
const graph_utils_1 = require("./graph-utils");
|
|
7
15
|
const webhook_signature_verification_1 = require("./webhook-signature-verification");
|
|
8
16
|
const workflow_auth_generator_1 = require("./workflow-auth-generator");
|
|
17
|
+
const visitor_step_limits_1 = require("./visitor-step-limits");
|
|
9
18
|
const sent_email_log_scope_1 = require("./sent-email-log/sent-email-log-scope");
|
|
10
19
|
const workflow_utils_alias_1 = require("./workflow-utils-alias");
|
|
11
20
|
const custom_node_modules_1 = require("./custom-node-modules");
|
|
21
|
+
const server_custom_node_call_1 = require("./server-custom-node-call");
|
|
12
22
|
const payments_1 = require("./payments");
|
|
13
23
|
const payment_drivers_scope_1 = require("./payments/payment-drivers-scope");
|
|
14
24
|
const cart_pricing_preamble_1 = require("./cart-pricing-preamble");
|
|
@@ -37,26 +47,202 @@ const resolveSegmentEntryNodeIds = (segment) => {
|
|
|
37
47
|
const targets = new Set(segment.edges.map((e) => e.target));
|
|
38
48
|
return segment.nodes.filter((n) => !targets.has(n.id)).map((n) => n.id);
|
|
39
49
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
/** Per visitor address, per route: a minute's and a day's allowance. */
|
|
51
|
+
exports.COST_BEARING_STEP_LIMITS = { perMinute: 30, perDay: 300 };
|
|
52
|
+
/** What a visitor sees when a step fails; the detail stays in the server log. */
|
|
53
|
+
exports.SEGMENT_PUBLIC_ERROR = 'Something went wrong. Please try again.';
|
|
54
|
+
/**
|
|
55
|
+
* The visitor's identity a route reads: what the graph says (current-user
|
|
56
|
+
* readers, identity-filtered reads, {{Current User.*}} tokens — see
|
|
57
|
+
* segment-trust.ts) plus the route's `userScoped` identity columns, which the
|
|
58
|
+
* route binds again after the node that produces them has run.
|
|
59
|
+
*/
|
|
60
|
+
const resolveSegmentSession = (options, protection) => {
|
|
61
|
+
var _a, _b;
|
|
62
|
+
const needs = (_a = options.trust) === null || _a === void 0 ? void 0 : _a.session;
|
|
63
|
+
const bindings = (((_b = protection === null || protection === void 0 ? void 0 : protection.userScoped) === null || _b === void 0 ? void 0 : _b.bindings) || []);
|
|
64
|
+
if (!needs && bindings.length === 0) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
return Object.assign({ identityNodes: (needs === null || needs === void 0 ? void 0 : needs.identityNodes) || {}, identityReads: (needs === null || needs === void 0 ? void 0 : needs.identityReads) || {} }, (bindings.length > 0 ? { bindings } : {}));
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* The env var names a segment's node configs reference (project-secret
|
|
71
|
+
* references): a reply never carries one, even inside a node's error result.
|
|
72
|
+
*/
|
|
73
|
+
const collectSecretNames = (segment) => {
|
|
74
|
+
const names = new Set();
|
|
75
|
+
const walk = (value) => {
|
|
76
|
+
if (typeof value === 'string') {
|
|
77
|
+
if (/^WORKFLOW_SECRET_[A-Za-z0-9_]+$/.test(value)) {
|
|
78
|
+
names.add(value);
|
|
79
|
+
}
|
|
80
|
+
else if (value.indexOf('teleporthq.secrets.') === 0 && value.length > 19) {
|
|
81
|
+
names.add(value.slice(19));
|
|
82
|
+
}
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (!value || typeof value !== 'object') {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const ref = value;
|
|
89
|
+
if (ref.type === 'dynamic' &&
|
|
90
|
+
ref.content &&
|
|
91
|
+
ref.content.referenceType === 'secret' &&
|
|
92
|
+
typeof ref.content.id === 'string' &&
|
|
93
|
+
ref.content.id) {
|
|
94
|
+
names.add(ref.content.id);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
Object.keys(value).forEach((key) => walk(value[key]));
|
|
98
|
+
};
|
|
99
|
+
segment.nodes.forEach((n) => walk(n.config));
|
|
100
|
+
return Array.from(names).sort();
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Whether `nodes` run a cost-bearing step, themselves or through a custom node
|
|
104
|
+
* they call (transitively): in-process, a server-only custom node's own
|
|
105
|
+
* segments are internal calls, which the gate does not count.
|
|
106
|
+
*/
|
|
107
|
+
const runsCostBearingStep = (nodes, customNodes, visited = new Set()) => nodes.some((n) => {
|
|
108
|
+
if ((0, cost_bearing_node_types_1.isCostBearingNodeType)(n.type)) {
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
const customNodeId = (n.config || {}).customNodeId;
|
|
112
|
+
if (n.type !== 'general-custom-node' || typeof customNodeId !== 'string') {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
if (visited.has(customNodeId)) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
visited.add(customNodeId);
|
|
119
|
+
const called = customNodes ? customNodes[customNodeId] : undefined;
|
|
120
|
+
return !!called && runsCostBearingStep(called.nodes || [], customNodes, visited);
|
|
121
|
+
});
|
|
122
|
+
/**
|
|
123
|
+
* The rate-limit scope of a segment route that runs a cost-bearing step, else
|
|
124
|
+
* null. Its own prefix: `workflow-step:<nodeId>` is a step's declared visitor
|
|
125
|
+
* limit (visitor-step-limits.ts).
|
|
126
|
+
*/
|
|
127
|
+
const resolveAbuseScope = (segment, workflowName, options) => {
|
|
128
|
+
var _a;
|
|
129
|
+
if (!runsCostBearingStep(segment.nodes, options.customNodes)) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
const owner = ((_a = options.trust) === null || _a === void 0 ? void 0 : _a.workflowId) || workflowName || 'workflow';
|
|
133
|
+
return `workflow-route:${owner}:${segment.id}`;
|
|
134
|
+
};
|
|
135
|
+
const SEGMENT_SECURITY_RUNTIME = (0, security_runtime_code_1.securityRuntimeSpecifier)('../../..');
|
|
136
|
+
/**
|
|
137
|
+
* Module-level code every segment route carries: the shared security runtime
|
|
138
|
+
* (required guarded, so a route still loads where it is absent — the abuse
|
|
139
|
+
* gate then refuses), the generic error a visitor sees, and the log line its
|
|
140
|
+
* detail goes to under the same opaque id.
|
|
141
|
+
*/
|
|
142
|
+
const SEGMENT_SECURITY_PREAMBLE = `// The shared security runtime: the generic error a visitor is shown (its detail
|
|
143
|
+
// stays in the server log, under the id the visitor sees) and the rate limit of
|
|
144
|
+
// a step that spends the site's money.
|
|
145
|
+
var __security = null;
|
|
146
|
+
try { __security = require('${SEGMENT_SECURITY_RUNTIME}'); } catch (_e) { __security = null; }
|
|
147
|
+
var __PUBLIC_ERROR = ${JSON.stringify(exports.SEGMENT_PUBLIC_ERROR)};
|
|
148
|
+
// The refusals that name nothing secret (an AI step: a prompt too long, the
|
|
149
|
+
// site's daily AI budget spent, AI unavailable) are shown as they are, with
|
|
150
|
+
// their status; any other error is the generic one.
|
|
151
|
+
var __PUBLIC_REFUSALS = ${JSON.stringify(ai_provider_utils_1.AI_PUBLIC_REFUSALS)};
|
|
152
|
+
function __publicRefusal(error) {
|
|
153
|
+
var message = error && typeof error.message === 'string' ? error.message : '';
|
|
154
|
+
return Object.prototype.hasOwnProperty.call(__PUBLIC_REFUSALS, message) ? message : null;
|
|
155
|
+
}
|
|
156
|
+
// Answers the generic error (when \`res\` can still answer) and logs \`error\`;
|
|
157
|
+
// returns the id the log line carries. An error the server runtime raised for
|
|
158
|
+
// the visitor to read (\`__tqPublic\`: a run that expired) keeps its message.
|
|
159
|
+
function __clientError(res, error) {
|
|
160
|
+
var own = error && error.__tqPublic && typeof error.__tqPublic.message === 'string' ? error.__tqPublic : null;
|
|
161
|
+
var refusal = own ? own.message : __publicRefusal(error);
|
|
162
|
+
var status = own ? own.status : refusal ? __PUBLIC_REFUSALS[refusal] : 500;
|
|
163
|
+
var message = refusal || __PUBLIC_ERROR;
|
|
164
|
+
if (__security && typeof __security.sendClientError === 'function') {
|
|
165
|
+
return __security.sendClientError(res, status, message, error);
|
|
166
|
+
}
|
|
167
|
+
console.error('Workflow segment error:', error);
|
|
168
|
+
if (res && !res.headersSent && typeof res.status === 'function') {
|
|
169
|
+
res.status(status).json({ error: message });
|
|
170
|
+
}
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
// What a parallel branch that failed reports: the generic error and its log id.
|
|
174
|
+
function __branchError(error) {
|
|
175
|
+
var id = __clientError({ headersSent: true }, error);
|
|
176
|
+
var message = __publicRefusal(error) || __PUBLIC_ERROR;
|
|
177
|
+
return id ? message + ' (' + id + ')' : message;
|
|
178
|
+
}
|
|
179
|
+
`;
|
|
180
|
+
/**
|
|
181
|
+
* First thing a segment route does when its segment spends the site's money
|
|
182
|
+
* or reaches outside it: count the visitor against this route, whatever the
|
|
183
|
+
* page's protection. This deployment's own server code (a webhook or cron
|
|
184
|
+
* running a custom node) carries the internal-call token and is not counted.
|
|
185
|
+
*/
|
|
186
|
+
const generateAbuseGateCode = (scope) => {
|
|
187
|
+
if (!scope) {
|
|
188
|
+
return '';
|
|
189
|
+
}
|
|
190
|
+
const { perMinute, perDay } = exports.COST_BEARING_STEP_LIMITS;
|
|
191
|
+
const scopeLiteral = JSON.stringify(scope);
|
|
192
|
+
return `
|
|
193
|
+
// This step spends the site's money or reaches outside it (an AI model, a
|
|
194
|
+
// mail, SMS or payment provider, another site): every visitor address is
|
|
195
|
+
// allowed ${perMinute} calls a minute and ${perDay} a day here, whatever the page's
|
|
196
|
+
// protection. This deployment's own server code is not a visitor.
|
|
197
|
+
if (!utils.isInternalCall(req)) {
|
|
198
|
+
if (!__security) {
|
|
199
|
+
res.status(503).json({ error: 'This action is unavailable right now.' });
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
var __minute = { scope: ${scopeLiteral}, limit: ${perMinute}, windowSeconds: 60 };
|
|
203
|
+
if (!(await __security.rateLimitRequest(req, res, __minute))) return;
|
|
204
|
+
var __day = { scope: ${scopeLiteral}, limit: ${perDay}, windowSeconds: 86400 };
|
|
205
|
+
if (!(await __security.rateLimitRequest(req, res, __day))) return;
|
|
206
|
+
}`;
|
|
207
|
+
};
|
|
208
|
+
/** The session binding a route that reads the visitor runs before its guard and its nodes. */
|
|
209
|
+
const generateSessionBindCode = (session) => session
|
|
210
|
+
? `
|
|
211
|
+
// Who the visitor is comes from the session cookie, never from the request
|
|
212
|
+
// (see bindSessionIdentity in the server runtime).
|
|
213
|
+
await utils.bindSessionIdentity(req, SEGMENT_CONFIG, context);`
|
|
214
|
+
: '';
|
|
215
|
+
/** Module-level: the handlers that read or bind the visitor's identity, wrapped. */
|
|
216
|
+
const generateSessionHandlersCode = (session) => session && (Object.keys(session.identityReads).length > 0 || (session.bindings || []).length > 0)
|
|
217
|
+
? `// Identity-filtered reads and userScoped identity columns (see
|
|
218
|
+
// bindSessionHandlers in the server runtime).
|
|
219
|
+
utils.bindSessionHandlers(SEGMENT_CONFIG, nodeHandlers);
|
|
220
|
+
`
|
|
221
|
+
: '';
|
|
222
|
+
const buildSegmentConfig = (segment, options, session) => {
|
|
223
|
+
const secretNames = collectSecretNames(segment);
|
|
224
|
+
return JSON.stringify(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (options.trust || {})), { session }), (secretNames.length > 0 ? { secretNames } : {})), { nodes: segment.nodes.map((n) => ({
|
|
225
|
+
id: n.id,
|
|
226
|
+
type: n.type,
|
|
227
|
+
config: n.config,
|
|
228
|
+
stepNumber: n.stepNumber,
|
|
229
|
+
label: n.label,
|
|
230
|
+
})), edges: segment.edges.map((e) => ({
|
|
231
|
+
id: e.id,
|
|
232
|
+
source: e.source,
|
|
233
|
+
target: e.target,
|
|
234
|
+
sourceHandle: e.sourceHandle,
|
|
235
|
+
targetHandle: e.targetHandle,
|
|
236
|
+
data: e.data,
|
|
237
|
+
})), entryNodeIds: resolveSegmentEntryNodeIds(segment) }), (options.customNodeIds ? { customNodeIds: options.customNodeIds } : {})), null, 2);
|
|
238
|
+
};
|
|
54
239
|
const generateServerSegmentAPIRoute = (segment, workflowName, protection, options = {}) => {
|
|
55
240
|
const usedNodeTypes = new Set(segment.nodes.map((n) => n.type));
|
|
56
241
|
const nodeHandlersEntries = generateNodeHandlersForSegment(usedNodeTypes, true);
|
|
57
|
-
const hasRateLimiter = usedNodeTypes.has('general-rate-limiter');
|
|
58
242
|
const auth = (0, workflow_auth_generator_1.buildWorkflowAuthInjection)(protection);
|
|
59
|
-
const
|
|
243
|
+
const session = resolveSegmentSession(options, protection);
|
|
244
|
+
const abuseScope = resolveAbuseScope(segment, workflowName, options);
|
|
245
|
+
const segmentConfig = buildSegmentConfig((0, outbound_message_guard_1.markVisitorBoundMessageNodes)(segment, options.trust, protection, workflowName), options, session);
|
|
60
246
|
const header = workflowName
|
|
61
247
|
? `/**
|
|
62
248
|
* Workflow Server Segment API Route
|
|
@@ -69,20 +255,19 @@ const generateServerSegmentAPIRoute = (segment, workflowName, protection, option
|
|
|
69
255
|
* Segment ID: ${sanitizeForBlockComment(segment.id)}
|
|
70
256
|
*/
|
|
71
257
|
`;
|
|
72
|
-
const requestInjection =
|
|
73
|
-
? `\n context.__request = { ip: __getClientIp(req), headers: req.headers || {} };`
|
|
74
|
-
: '';
|
|
258
|
+
const requestInjection = (0, visitor_request_1.needsVisitorRequest)(usedNodeTypes) ? visitor_request_1.VISITOR_REQUEST_INJECTION : '';
|
|
75
259
|
return `${header}
|
|
76
260
|
const utils = require('../../../utils/workflows/server-runtime');
|
|
77
|
-
${auth.requireLine}const
|
|
261
|
+
${auth.requireLine}const resolveNodeConfig = utils.resolveNodeConfig;
|
|
78
262
|
${(0, workflow_utils_alias_1.workflowUtilsAliasLine)('utils')}
|
|
79
263
|
${(0, cart_pricing_preamble_1.generateCartPricingPreamble)(usedNodeTypes, '../../..')}${generateSentEmailLogPreamble(usedNodeTypes, '../../..')}${(0, payments_1.generatePaymentDriversPreamble)((0, payment_drivers_scope_1.usesPaymentDriverNode)(usedNodeTypes), '../../..')}
|
|
264
|
+
${SEGMENT_SECURITY_PREAMBLE}
|
|
80
265
|
const SEGMENT_CONFIG = ${segmentConfig};
|
|
81
266
|
${auth.policyConst}
|
|
82
267
|
const nodeHandlers = {
|
|
83
268
|
${nodeHandlersEntries}
|
|
84
269
|
};
|
|
85
|
-
|
|
270
|
+
${(0, server_custom_node_call_1.generateServerCustomNodeCallCode)(segment, '../../..')}${generateSessionHandlersCode(session)}
|
|
86
271
|
module.exports = async function handler(req, res) {
|
|
87
272
|
if (req.method !== 'POST') {
|
|
88
273
|
res.status(405).json({ error: 'Method not allowed' });
|
|
@@ -91,7 +276,7 @@ module.exports = async function handler(req, res) {
|
|
|
91
276
|
// Kept outside the try so the catch below can still drain any fire-and-forget
|
|
92
277
|
// query this segment started before it failed.
|
|
93
278
|
var __wfContext = null;
|
|
94
|
-
try {
|
|
279
|
+
try {${generateAbuseGateCode(abuseScope)}
|
|
95
280
|
const body = typeof req.body === 'string' ? JSON.parse(req.body) : req.body;
|
|
96
281
|
const incomingContext = body.context || {};
|
|
97
282
|
// What the caller already holds, so the reply below carries only what this
|
|
@@ -100,7 +285,7 @@ module.exports = async function handler(req, res) {
|
|
|
100
285
|
|
|
101
286
|
const context = Object.assign({}, incomingContext);
|
|
102
287
|
utils.claimSegmentContext(SEGMENT_CONFIG, context);
|
|
103
|
-
__wfContext = context
|
|
288
|
+
__wfContext = context;${generateSessionBindCode(session)}
|
|
104
289
|
// Created eagerly so a custom node invoked from here shares the SAME
|
|
105
290
|
// fire-and-forget queue (it shallow-copies this context) and its queries
|
|
106
291
|
// are drained by the settle below rather than being lost when we reply.
|
|
@@ -112,10 +297,18 @@ module.exports = async function handler(req, res) {
|
|
|
112
297
|
// without them a protected deployment 401s itself and every data node
|
|
113
298
|
// returns no rows. See internalRequestHeaders in runtime-utils.
|
|
114
299
|
context.__internalHeaders = utils.internalRequestHeaders(req);
|
|
300
|
+
// A server job's hop — a webhook, cron or automation running a custom
|
|
301
|
+
// node, which calls this route with the internal-call token only this
|
|
302
|
+
// deployment's server code can mint — stays the job's: its data calls keep
|
|
303
|
+
// the server-job flag (see __dataIsServerJob). A browser's request never
|
|
304
|
+
// carries the token, so never the flag.
|
|
305
|
+
if (utils.isInternalCall(req) && req.headers && req.headers['x-tq-server-job'] === '1') {
|
|
306
|
+
context.__internalHeaders['x-tq-server-job'] = '1';
|
|
307
|
+
}
|
|
115
308
|
// The language of the page this run started on — carried by the client
|
|
116
309
|
// context, else read off the request — so a customer email node sends the
|
|
117
310
|
// copy that matches the storefront the visitor is browsing.
|
|
118
|
-
context.__locale = utils.resolveWorkflowLocale(req, incomingContext);${auth.guardCall}
|
|
311
|
+
context.__locale = utils.resolveWorkflowLocale(req, incomingContext);${auth.guardCall}${(0, visitor_step_limits_1.buildVisitorStepLimitGuard)(segment)}
|
|
119
312
|
const sortedNodes = SEGMENT_CONFIG.nodes.slice().sort(function(a, b) { return a.stepNumber - b.stepNumber; });
|
|
120
313
|
|
|
121
314
|
for (let i = 0; i < sortedNodes.length; i++) {
|
|
@@ -125,7 +318,7 @@ module.exports = async function handler(req, res) {
|
|
|
125
318
|
// the caller as if that branch had run (a custom node answers the output
|
|
126
319
|
// of the last node it ran).
|
|
127
320
|
if (context.__skippedNodes && context.__skippedNodes[node.id]) continue;
|
|
128
|
-
const resolved =
|
|
321
|
+
const resolved = resolveNodeConfig(node, context);
|
|
129
322
|
// Every data node lives in a SERVER segment, so this guard — which turns an
|
|
130
323
|
// unresolved {{…}} into a validation error instead of letting the literal
|
|
131
324
|
// token reach SQL — was doing nothing at all: it ran only in the CLIENT
|
|
@@ -138,7 +331,7 @@ module.exports = async function handler(req, res) {
|
|
|
138
331
|
// rather than the stub handler, which always returns { result: true }.
|
|
139
332
|
// After evaluating, mark the non-taken branch nodes as skipped.
|
|
140
333
|
if (node.type === 'general-if-statement') {
|
|
141
|
-
const condResult = utils.evaluateCondition(resolved, context);
|
|
334
|
+
const condResult = utils.evaluateCondition(resolved, context, node.config);
|
|
142
335
|
context[node.id] = { result: condResult };
|
|
143
336
|
var skipHandle = condResult ? 'false' : 'true';
|
|
144
337
|
var segEdgesIf = SEGMENT_CONFIG.edges || [];
|
|
@@ -217,10 +410,10 @@ module.exports = async function handler(req, res) {
|
|
|
217
410
|
context[node.id] = utils.loopIterationContext(collection, li);
|
|
218
411
|
for (var bi = 0; bi < bodyNodes.length; bi++) {
|
|
219
412
|
var bNode = bodyNodes[bi];
|
|
220
|
-
var bResolved =
|
|
413
|
+
var bResolved = resolveNodeConfig(bNode, context);
|
|
221
414
|
bResolved.__nodeId = bNode.id;
|
|
222
415
|
if (bNode.type === 'general-if-statement') {
|
|
223
|
-
context[bNode.id] = { result: utils.evaluateCondition(bResolved, context) };
|
|
416
|
+
context[bNode.id] = { result: utils.evaluateCondition(bResolved, context, bNode.config) };
|
|
224
417
|
continue;
|
|
225
418
|
}
|
|
226
419
|
var bHandler = nodeHandlers[bNode.type];
|
|
@@ -255,17 +448,9 @@ module.exports = async function handler(req, res) {
|
|
|
255
448
|
|
|
256
449
|
// Switch nodes evaluate a value, match a case, execute that branch, skip all others
|
|
257
450
|
if (node.type === 'general-switch') {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
var matchedCase =
|
|
261
|
-
for (var swci = 0; swci < switchCases.length; swci++) {
|
|
262
|
-
var caseVal = utils.resolveValue(switchCases[swci].condition, context);
|
|
263
|
-
if (resolved.comparisonMode === 'expression') {
|
|
264
|
-
try { if (new Function('value', 'context', 'return (' + caseVal + ')')(switchVal, context)) { matchedCase = switchCases[swci].id; break; } } catch(e) {}
|
|
265
|
-
} else {
|
|
266
|
-
if (switchVal === caseVal) { matchedCase = switchCases[swci].id; break; }
|
|
267
|
-
}
|
|
268
|
-
}
|
|
451
|
+
// Only an authored case expression is compiled; request text is data
|
|
452
|
+
// (see matchSwitchCase in runtime-utils).
|
|
453
|
+
var matchedCase = utils.matchSwitchCase(node.config, resolved, context);
|
|
269
454
|
context[node.id] = { matchedCase: matchedCase };
|
|
270
455
|
var segSwitchEdges = SEGMENT_CONFIG.edges || [];
|
|
271
456
|
var allSwitchBranchEdges = segSwitchEdges.filter(function(e) { return e.source === node.id; });
|
|
@@ -311,7 +496,7 @@ module.exports = async function handler(req, res) {
|
|
|
311
496
|
return (async function() {
|
|
312
497
|
for (var pbi = 0; pbi < branchNodes.length; pbi++) {
|
|
313
498
|
var pNode = branchNodes[pbi];
|
|
314
|
-
var pRes =
|
|
499
|
+
var pRes = resolveNodeConfig(pNode, branchCtx);
|
|
315
500
|
pRes.__nodeId = pNode.id;
|
|
316
501
|
var pHandler = nodeHandlers[pNode.type];
|
|
317
502
|
if (!pHandler) continue;
|
|
@@ -330,7 +515,8 @@ module.exports = async function handler(req, res) {
|
|
|
330
515
|
branchNodes.forEach(function(bn) { context[bn.id] = bc[bn.id]; });
|
|
331
516
|
return { success: true };
|
|
332
517
|
}).catch(function(err) {
|
|
333
|
-
|
|
518
|
+
// The branch result reaches the browser: the detail stays in the log.
|
|
519
|
+
return { success: false, error: __branchError(err) };
|
|
334
520
|
});
|
|
335
521
|
});
|
|
336
522
|
var parallelResults;
|
|
@@ -407,9 +593,10 @@ module.exports = async function handler(req, res) {
|
|
|
407
593
|
delete context.__internalHeaders;
|
|
408
594
|
res.status(200).json({ success: true, results: utils.segmentReply(SEGMENT_CONFIG, context, __incomingSnapshot) });
|
|
409
595
|
} catch (error) {
|
|
410
|
-
console.error('Workflow segment error:', error);
|
|
411
596
|
if (__wfContext) { await utils.handOffPendingNodePromises(__wfContext); }
|
|
412
|
-
|
|
597
|
+
// A generic error and an opaque id: a driver, provider or secret-name
|
|
598
|
+
// detail never reaches the browser (it is logged under the same id).
|
|
599
|
+
__clientError(res, error);
|
|
413
600
|
}
|
|
414
601
|
};
|
|
415
602
|
`;
|
|
@@ -422,27 +609,27 @@ exports.hasStreamingAINode = hasStreamingAINode;
|
|
|
422
609
|
const generateStreamingServerSegmentAPIRoute = (segment, workflowName, protection, options = {}) => {
|
|
423
610
|
const usedNodeTypes = new Set(segment.nodes.map((n) => n.type));
|
|
424
611
|
const nodeHandlersEntries = generateNodeHandlersForSegment(usedNodeTypes, true);
|
|
425
|
-
const hasRateLimiter = usedNodeTypes.has('general-rate-limiter');
|
|
426
612
|
const auth = (0, workflow_auth_generator_1.buildWorkflowAuthInjection)(protection);
|
|
427
|
-
const
|
|
613
|
+
const session = resolveSegmentSession(options, protection);
|
|
614
|
+
const abuseScope = resolveAbuseScope(segment, workflowName, options);
|
|
615
|
+
const segmentConfig = buildSegmentConfig((0, outbound_message_guard_1.markVisitorBoundMessageNodes)(segment, options.trust, protection, workflowName), options, session);
|
|
428
616
|
const aiNodeTypes = JSON.stringify(Array.from(graph_utils_1.AI_NODE_TYPES));
|
|
429
617
|
const header = workflowName
|
|
430
618
|
? `/**\n * Workflow Streaming Server Segment API Route\n * Workflow: ${sanitizeForBlockComment(workflowName)}\n * Segment ID: ${sanitizeForBlockComment(segment.id)}\n */\n`
|
|
431
619
|
: `/**\n * Workflow Streaming Server Segment API Route\n * Segment ID: ${sanitizeForBlockComment(segment.id)}\n */\n`;
|
|
432
|
-
const requestInjection =
|
|
433
|
-
? `\n context.__request = { ip: __getClientIp(req), headers: req.headers || {} };`
|
|
434
|
-
: '';
|
|
620
|
+
const requestInjection = (0, visitor_request_1.needsVisitorRequest)(usedNodeTypes) ? visitor_request_1.VISITOR_REQUEST_INJECTION : '';
|
|
435
621
|
return `${header}
|
|
436
622
|
const utils = require('../../../utils/workflows/server-runtime');
|
|
437
|
-
${auth.requireLine}const
|
|
623
|
+
${auth.requireLine}const resolveNodeConfig = utils.resolveNodeConfig;
|
|
438
624
|
${(0, workflow_utils_alias_1.workflowUtilsAliasLine)('utils')}
|
|
439
625
|
${(0, cart_pricing_preamble_1.generateCartPricingPreamble)(usedNodeTypes, '../../..')}${generateSentEmailLogPreamble(usedNodeTypes, '../../..')}${(0, payments_1.generatePaymentDriversPreamble)((0, payment_drivers_scope_1.usesPaymentDriverNode)(usedNodeTypes), '../../..')}
|
|
626
|
+
${SEGMENT_SECURITY_PREAMBLE}
|
|
440
627
|
const SEGMENT_CONFIG = ${segmentConfig};
|
|
441
628
|
${auth.policyConst}
|
|
442
629
|
const nodeHandlers = {
|
|
443
630
|
${nodeHandlersEntries}
|
|
444
631
|
};
|
|
445
|
-
|
|
632
|
+
${(0, server_custom_node_call_1.generateServerCustomNodeCallCode)(segment, '../../..')}${generateSessionHandlersCode(session)}
|
|
446
633
|
const __streamingAITypes = ${aiNodeTypes};
|
|
447
634
|
|
|
448
635
|
function __isStreamingAI(node, config) {
|
|
@@ -457,7 +644,7 @@ function __streamNodeResult(res, nodeId, result) {
|
|
|
457
644
|
if (__credentialResultIds[nodeId]) return;
|
|
458
645
|
const kept = SEGMENT_CONFIG.nodes.find(function(nd) { return nd.id === nodeId; });
|
|
459
646
|
if (kept && kept.config && kept.config.keepResultOnServer === true && !utils.isBranchingNodeType(kept.type)) return;
|
|
460
|
-
res.write('data: ' + JSON.stringify({ type: 'node-result', nodeId: nodeId, result: utils.withoutCredentialColumns(kept, result) }) + '\\n\\n');
|
|
647
|
+
res.write('data: ' + JSON.stringify({ type: 'node-result', nodeId: nodeId, result: utils.scrubSecretNames(SEGMENT_CONFIG, utils.withoutCredentialColumns(kept, result)) }) + '\\n\\n');
|
|
461
648
|
}
|
|
462
649
|
|
|
463
650
|
function __collectSegBranchNodes(startId, excludeId) {
|
|
@@ -498,13 +685,13 @@ module.exports = async function handler(req, res) {
|
|
|
498
685
|
// Kept outside the try so the catch below can still drain any fire-and-forget
|
|
499
686
|
// query this segment started before it failed.
|
|
500
687
|
var __wfContext = null;
|
|
501
|
-
try {
|
|
688
|
+
try {${generateAbuseGateCode(abuseScope)}
|
|
502
689
|
const body = typeof req.body === 'string' ? JSON.parse(req.body) : req.body;
|
|
503
690
|
const context = Object.assign({}, body.context || {});
|
|
504
691
|
// See the non-streaming segment route: the reply carries only what changed.
|
|
505
692
|
const __incomingSnapshot = utils.snapshotIncomingContext(body.context || {});
|
|
506
693
|
utils.claimSegmentContext(SEGMENT_CONFIG, context);
|
|
507
|
-
__wfContext = context
|
|
694
|
+
__wfContext = context;${generateSessionBindCode(session)}
|
|
508
695
|
// See the non-streaming segment route — shared queue for nested custom nodes.
|
|
509
696
|
context.__pendingNodePromises = [];${requestInjection}
|
|
510
697
|
// Where this deployment calls its own routes — never a host the request
|
|
@@ -514,15 +701,23 @@ module.exports = async function handler(req, res) {
|
|
|
514
701
|
// without them a protected deployment 401s itself and every data node
|
|
515
702
|
// returns no rows. See internalRequestHeaders in runtime-utils.
|
|
516
703
|
context.__internalHeaders = utils.internalRequestHeaders(req);
|
|
704
|
+
// A server job's hop — a webhook, cron or automation running a custom
|
|
705
|
+
// node, which calls this route with the internal-call token only this
|
|
706
|
+
// deployment's server code can mint — stays the job's: its data calls keep
|
|
707
|
+
// the server-job flag (see __dataIsServerJob). A browser's request never
|
|
708
|
+
// carries the token, so never the flag.
|
|
709
|
+
if (utils.isInternalCall(req) && req.headers && req.headers['x-tq-server-job'] === '1') {
|
|
710
|
+
context.__internalHeaders['x-tq-server-job'] = '1';
|
|
711
|
+
}
|
|
517
712
|
// See the non-streaming segment route: the run's language.
|
|
518
|
-
context.__locale = utils.resolveWorkflowLocale(req, body.context);${auth.guardCall}
|
|
713
|
+
context.__locale = utils.resolveWorkflowLocale(req, body.context);${auth.guardCall}${(0, visitor_step_limits_1.buildVisitorStepLimitGuard)(segment)}
|
|
519
714
|
const sortedNodes = SEGMENT_CONFIG.nodes.slice().sort(function(a, b) { return a.stepNumber - b.stepNumber; });
|
|
520
715
|
const executed = {};
|
|
521
716
|
|
|
522
717
|
for (let i = 0; i < sortedNodes.length; i++) {
|
|
523
718
|
const node = sortedNodes[i];
|
|
524
719
|
if (executed[node.id]) continue;
|
|
525
|
-
const resolved =
|
|
720
|
+
const resolved = resolveNodeConfig(node, context);
|
|
526
721
|
// See the non-streaming segment above — without this the unresolved-token
|
|
527
722
|
// guard never runs on the server, which is where every data node executes.
|
|
528
723
|
const __configError = utils.finalizeResolvedConfig(node.type, resolved);
|
|
@@ -531,7 +726,7 @@ module.exports = async function handler(req, res) {
|
|
|
531
726
|
|
|
532
727
|
// If-statement nodes must be evaluated using the runtime's evaluateCondition
|
|
533
728
|
if (node.type === 'general-if-statement') {
|
|
534
|
-
const condResult = utils.evaluateCondition(resolved, context);
|
|
729
|
+
const condResult = utils.evaluateCondition(resolved, context, node.config);
|
|
535
730
|
context[node.id] = { result: condResult };
|
|
536
731
|
executed[node.id] = true;
|
|
537
732
|
if (streamStarted) {
|
|
@@ -577,10 +772,10 @@ module.exports = async function handler(req, res) {
|
|
|
577
772
|
context[node.id] = utils.loopIterationContext(ssLoopCollection, ssli);
|
|
578
773
|
for (var ssbi = 0; ssbi < ssBodyNodes.length; ssbi++) {
|
|
579
774
|
var ssbNode = ssBodyNodes[ssbi];
|
|
580
|
-
var ssbRes =
|
|
775
|
+
var ssbRes = resolveNodeConfig(ssbNode, context);
|
|
581
776
|
ssbRes.__nodeId = ssbNode.id;
|
|
582
777
|
if (ssbNode.type === 'general-if-statement') {
|
|
583
|
-
context[ssbNode.id] = { result: utils.evaluateCondition(ssbRes, context) };
|
|
778
|
+
context[ssbNode.id] = { result: utils.evaluateCondition(ssbRes, context, ssbNode.config) };
|
|
584
779
|
continue;
|
|
585
780
|
}
|
|
586
781
|
var ssbHandler = nodeHandlers[ssbNode.type];
|
|
@@ -609,17 +804,8 @@ module.exports = async function handler(req, res) {
|
|
|
609
804
|
|
|
610
805
|
// Switch nodes in streaming segments
|
|
611
806
|
if (node.type === 'general-switch') {
|
|
612
|
-
|
|
613
|
-
var
|
|
614
|
-
var ssMatchedCase = 'default';
|
|
615
|
-
for (var ssswci = 0; ssswci < ssSwitchCases.length; ssswci++) {
|
|
616
|
-
var ssCaseVal = utils.resolveValue(ssSwitchCases[ssswci].condition, context);
|
|
617
|
-
if (resolved.comparisonMode === 'expression') {
|
|
618
|
-
try { if (new Function('value', 'context', 'return (' + ssCaseVal + ')')(ssSwitchVal, context)) { ssMatchedCase = ssSwitchCases[ssswci].id; break; } } catch(e) {}
|
|
619
|
-
} else {
|
|
620
|
-
if (ssSwitchVal === ssCaseVal) { ssMatchedCase = ssSwitchCases[ssswci].id; break; }
|
|
621
|
-
}
|
|
622
|
-
}
|
|
807
|
+
// See the non-streaming segment route: only authored expressions run.
|
|
808
|
+
var ssMatchedCase = utils.matchSwitchCase(node.config, resolved, context);
|
|
623
809
|
context[node.id] = { matchedCase: ssMatchedCase };
|
|
624
810
|
executed[node.id] = true;
|
|
625
811
|
var ssSwitchEdges = SEGMENT_CONFIG.edges || [];
|
|
@@ -669,7 +855,7 @@ module.exports = async function handler(req, res) {
|
|
|
669
855
|
return (async function() {
|
|
670
856
|
for (var sspbi = 0; sspbi < ssPBranchNodes.length; sspbi++) {
|
|
671
857
|
var sspNode = ssPBranchNodes[sspbi];
|
|
672
|
-
var sspRes =
|
|
858
|
+
var sspRes = resolveNodeConfig(sspNode, ssPBranchCtx);
|
|
673
859
|
sspRes.__nodeId = sspNode.id;
|
|
674
860
|
var sspHandler = nodeHandlers[sspNode.type];
|
|
675
861
|
if (!sspHandler) continue;
|
|
@@ -688,7 +874,8 @@ module.exports = async function handler(req, res) {
|
|
|
688
874
|
ssPBranchNodes.forEach(function(bn) { context[bn.id] = bc[bn.id]; });
|
|
689
875
|
return { success: true };
|
|
690
876
|
}).catch(function(err) {
|
|
691
|
-
|
|
877
|
+
// The branch result reaches the browser: the detail stays in the log.
|
|
878
|
+
return { success: false, error: __branchError(err) };
|
|
692
879
|
});
|
|
693
880
|
});
|
|
694
881
|
var ssParallelResults;
|
|
@@ -751,7 +938,8 @@ module.exports = async function handler(req, res) {
|
|
|
751
938
|
const sn = onStreamNodes[si];
|
|
752
939
|
const snHandler = nodeHandlers[sn.type];
|
|
753
940
|
if (!snHandler) continue;
|
|
754
|
-
const snResolved =
|
|
941
|
+
const snResolved = resolveNodeConfig(sn, context);
|
|
942
|
+
snResolved.__nodeId = sn.id;
|
|
755
943
|
if (utils.isFireAndForgetNode(sn)) {
|
|
756
944
|
utils.registerPendingNodePromise(context, utils.startFireAndForgetNode(sn, snHandler, snResolved, context));
|
|
757
945
|
context[sn.id] = null;
|
|
@@ -775,7 +963,8 @@ module.exports = async function handler(req, res) {
|
|
|
775
963
|
const en = onEndNodes[oi];
|
|
776
964
|
const enHandler = nodeHandlers[en.type];
|
|
777
965
|
if (!enHandler) continue;
|
|
778
|
-
const enResolved =
|
|
966
|
+
const enResolved = resolveNodeConfig(en, context);
|
|
967
|
+
enResolved.__nodeId = en.id;
|
|
779
968
|
if (utils.isFireAndForgetNode(en)) {
|
|
780
969
|
utils.registerPendingNodePromise(context, utils.startFireAndForgetNode(en, enHandler, enResolved, context));
|
|
781
970
|
context[en.id] = null;
|
|
@@ -842,21 +1031,52 @@ module.exports = async function handler(req, res) {
|
|
|
842
1031
|
res.status(200).json({ success: true, results: __reply });
|
|
843
1032
|
}
|
|
844
1033
|
} catch (error) {
|
|
845
|
-
console.error('Streaming workflow segment error:', error);
|
|
846
1034
|
if (__wfContext) { await utils.handOffPendingNodePromises(__wfContext); }
|
|
1035
|
+
// See the non-streaming segment route: a generic error and an opaque id.
|
|
847
1036
|
if (streamStarted) {
|
|
1037
|
+
var __errorId = __clientError({ headersSent: true }, error);
|
|
848
1038
|
try {
|
|
849
|
-
res.write('data: ' + JSON.stringify({ type: 'error', error: error
|
|
1039
|
+
res.write('data: ' + JSON.stringify({ type: 'error', error: __publicRefusal(error) || __PUBLIC_ERROR, id: __errorId }) + '\\n\\n');
|
|
850
1040
|
} catch(e) {}
|
|
851
1041
|
res.end();
|
|
852
1042
|
} else {
|
|
853
|
-
res
|
|
1043
|
+
__clientError(res, error);
|
|
854
1044
|
}
|
|
855
1045
|
}
|
|
856
1046
|
};
|
|
857
1047
|
`;
|
|
858
1048
|
};
|
|
859
1049
|
exports.generateStreamingServerSegmentAPIRoute = generateStreamingServerSegmentAPIRoute;
|
|
1050
|
+
/**
|
|
1051
|
+
* A node an automation cannot run: one that only works in a visitor's
|
|
1052
|
+
* browser. The editor refuses them in automations; a handler module that
|
|
1053
|
+
* still meets one fails the run with the reason instead of stubbing it the
|
|
1054
|
+
* way a webhook route does (a stub would report a step that never happened).
|
|
1055
|
+
*/
|
|
1056
|
+
const isBrowserOnlyNode = (nodeType, generator) => exports.CLIENT_ONLY_NODES.has(nodeType) ||
|
|
1057
|
+
(!!generator && generator.executionEnv === 'client' && !generator.generateServerHandler);
|
|
1058
|
+
/**
|
|
1059
|
+
* The step types a cron, webhook or automation route needs handlers for: its
|
|
1060
|
+
* own, and those of every custom node it calls, recursively — it runs them in
|
|
1061
|
+
* process (`utils/workflows/custom-nodes.js`) with this route's handler map. A
|
|
1062
|
+
* custom node's browser-only steps stay without one, as before (the runner
|
|
1063
|
+
* skips a step it has no handler for).
|
|
1064
|
+
*/
|
|
1065
|
+
const jobRouteNodeTypes = (ownNodes, customNodes) => {
|
|
1066
|
+
const types = new Set(ownNodes.map((n) => n.type));
|
|
1067
|
+
for (const type of (0, graph_utils_1.collectCalledCustomNodeTypes)(ownNodes, customNodes)) {
|
|
1068
|
+
if (!isBrowserOnlyNode(type, nodes_1.nodeRegistry[type])) {
|
|
1069
|
+
types.add(type);
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
return types;
|
|
1073
|
+
};
|
|
1074
|
+
const generateBrowserOnlyAutomationHandler = (nodeType) => {
|
|
1075
|
+
const fnName = nodeType.replace(/-/g, '_');
|
|
1076
|
+
return `async function ${fnName}(config, context) {
|
|
1077
|
+
throw new Error(${JSON.stringify(`The ${nodeType} step only runs in a visitor's browser, so an automation cannot run it`)});
|
|
1078
|
+
}`;
|
|
1079
|
+
};
|
|
860
1080
|
const generateClientOnlyServerStub = (nodeType) => {
|
|
861
1081
|
const fnName = nodeType.replace(/-/g, '_');
|
|
862
1082
|
return `async function ${fnName}(config, context) {
|
|
@@ -912,14 +1132,17 @@ function __wrapEmailHandler(nodeType, handler) {
|
|
|
912
1132
|
}
|
|
913
1133
|
`;
|
|
914
1134
|
};
|
|
915
|
-
const generateNodeHandlersForSegment = (usedNodeTypes, forServer = false) => {
|
|
1135
|
+
const generateNodeHandlersForSegment = (usedNodeTypes, forServer = false, automation = false, serverHandlerOptions = {}) => {
|
|
916
1136
|
return Array.from(usedNodeTypes)
|
|
917
1137
|
.map((nodeType) => {
|
|
918
|
-
const generator = nodes_1.nodeRegistry[nodeType];
|
|
1138
|
+
const generator = automation && nodeType === general_wait_1.generalWait.nodeType ? general_wait_1.generalWait : nodes_1.nodeRegistry[nodeType];
|
|
919
1139
|
let source;
|
|
920
|
-
if (generator) {
|
|
1140
|
+
if (automation && isBrowserOnlyNode(nodeType, generator)) {
|
|
1141
|
+
source = generateBrowserOnlyAutomationHandler(nodeType);
|
|
1142
|
+
}
|
|
1143
|
+
else if (generator) {
|
|
921
1144
|
if (forServer && generator.generateServerHandler) {
|
|
922
|
-
source = generator.generateServerHandler();
|
|
1145
|
+
source = generator.generateServerHandler(serverHandlerOptions);
|
|
923
1146
|
}
|
|
924
1147
|
else if (forServer && generator.executionEnv === 'client') {
|
|
925
1148
|
source = generateClientOnlyServerStub(nodeType);
|
|
@@ -946,7 +1169,12 @@ async function ${nodeType.replace(/-/g, '_')}(config, context) {
|
|
|
946
1169
|
})
|
|
947
1170
|
.join(',\n');
|
|
948
1171
|
};
|
|
949
|
-
|
|
1172
|
+
/**
|
|
1173
|
+
* The browser-only nodes a server route drops (and an automation refuses).
|
|
1174
|
+
* The editor's copy is `CLIENT_ONLY_NODE_TYPES` in teleport-gui
|
|
1175
|
+
* `packages/workflow-schema`; automations-catalog-drift.test.ts compares them.
|
|
1176
|
+
*/
|
|
1177
|
+
exports.CLIENT_ONLY_NODES = new Set([
|
|
950
1178
|
'navigation-go-to-page',
|
|
951
1179
|
'navigation-navigate-to-url',
|
|
952
1180
|
'navigation-refresh-page',
|
|
@@ -1007,11 +1235,29 @@ const CLIENT_ONLY_NODES = new Set([
|
|
|
1007
1235
|
'realtime-list-channels',
|
|
1008
1236
|
'realtime-list-channel-members',
|
|
1009
1237
|
]);
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1238
|
+
/**
|
|
1239
|
+
* What a cron or webhook route hands its nodes as `context.__request`: the
|
|
1240
|
+
* caller's ip for a rate limiter, and the request's headers for a signup in a
|
|
1241
|
+
* project with automations, which records its event on the origin the request
|
|
1242
|
+
* reached (see account-signup).
|
|
1243
|
+
*/
|
|
1244
|
+
const serverRouteRequestInjection = (nodeTypes, withAutomations) => {
|
|
1245
|
+
if (nodeTypes.has('general-rate-limiter')) {
|
|
1246
|
+
return visitor_request_1.VISITOR_REQUEST_INJECTION;
|
|
1247
|
+
}
|
|
1248
|
+
if (withAutomations && nodeTypes.has('account-signup')) {
|
|
1249
|
+
return `\n // The signup records its event on the origin this request reached.\n context.__request = { headers: req.headers || {} };`;
|
|
1250
|
+
}
|
|
1251
|
+
return '';
|
|
1252
|
+
};
|
|
1253
|
+
const generateCronAPIRoute = (workflow, customNodes, options = {}) => {
|
|
1254
|
+
const serverNodes = workflow.nodes.filter((n) => !exports.CLIENT_ONLY_NODES.has(n.type));
|
|
1255
|
+
const allNodeTypes = jobRouteNodeTypes(serverNodes, customNodes);
|
|
1256
|
+
// Cron routes live in pages/api/workflows.
|
|
1257
|
+
const nodeHandlersEntries = generateNodeHandlersForSegment(allNodeTypes, true, false, {
|
|
1258
|
+
withAutomations: options.withAutomations,
|
|
1259
|
+
relativePrefix: '../../..',
|
|
1260
|
+
});
|
|
1015
1261
|
const serverNodeIds = new Set(serverNodes.map((n) => n.id));
|
|
1016
1262
|
const serverEdges = workflow.edges.filter((e) => serverNodeIds.has(e.source) || serverNodeIds.has(e.target));
|
|
1017
1263
|
const hasCustomNodeUsage = serverNodes.some((n) => n.type === 'general-custom-node');
|
|
@@ -1028,9 +1274,7 @@ const generateCronAPIRoute = (workflow, customNodes) => {
|
|
|
1028
1274
|
})),
|
|
1029
1275
|
edges: serverEdges,
|
|
1030
1276
|
}, null, 2);
|
|
1031
|
-
const requestInjection =
|
|
1032
|
-
? `\n context.__request = { ip: __getClientIp(req), headers: req.headers || {} };`
|
|
1033
|
-
: '';
|
|
1277
|
+
const requestInjection = serverRouteRequestInjection(allNodeTypes, options.withAutomations);
|
|
1034
1278
|
// Cron routes live at pages/api/workflows/<file>.js → three levels up to root.
|
|
1035
1279
|
const customNodesImport = useCustomNodes
|
|
1036
1280
|
? `var __customNodes;\ntry { __customNodes = require('../../../utils/workflows/custom-nodes'); } catch (_e) { __customNodes = {}; }\n${(0, custom_node_modules_1.adminCustomNodesRequireLine)(serverNodes, customNodes, '../../..')}`
|
|
@@ -1049,7 +1293,7 @@ const generateCronAPIRoute = (workflow, customNodes) => {
|
|
|
1049
1293
|
*/
|
|
1050
1294
|
|
|
1051
1295
|
const utils = require('../../../utils/workflows/server-runtime');
|
|
1052
|
-
const
|
|
1296
|
+
const resolveNodeConfig = utils.resolveNodeConfig;
|
|
1053
1297
|
${(0, workflow_utils_alias_1.workflowUtilsAliasLine)('utils')}
|
|
1054
1298
|
${customNodesImport}${(0, cart_pricing_preamble_1.generateCartPricingPreamble)(allNodeTypes, '../../..')}${generateSentEmailLogPreamble(allNodeTypes, '../../..')}${(0, payments_1.generatePaymentDriversPreamble)((0, payment_drivers_scope_1.usesPaymentDriverNode)(allNodeTypes), '../../..')}
|
|
1055
1299
|
${(0, cron_request_verification_1.generateCronRequestVerificationCode)()}
|
|
@@ -1059,7 +1303,6 @@ const WORKFLOW_CONFIG = ${workflowConfig};
|
|
|
1059
1303
|
const nodeHandlers = {
|
|
1060
1304
|
${nodeHandlersEntries}
|
|
1061
1305
|
};
|
|
1062
|
-
|
|
1063
1306
|
module.exports = async function handler(req, res) {
|
|
1064
1307
|
if (req.method !== 'POST' && req.method !== 'GET') {
|
|
1065
1308
|
res.status(405).json({ error: 'Method not allowed' });
|
|
@@ -1088,6 +1331,10 @@ module.exports = async function handler(req, res) {
|
|
|
1088
1331
|
// without them a protected deployment 401s itself and every data node
|
|
1089
1332
|
// returns no rows. See internalRequestHeaders in runtime-utils.
|
|
1090
1333
|
context.__internalHeaders = utils.internalRequestHeaders(req);
|
|
1334
|
+
// A server job: no visitor's request runs here, so the data API reads the
|
|
1335
|
+
// customer records unscoped (see __dataIsServerJob; the flag counts only
|
|
1336
|
+
// with the app secret, which every data node presents).
|
|
1337
|
+
context.__internalHeaders['x-tq-server-job'] = '1';
|
|
1091
1338
|
context[WORKFLOW_CONFIG.triggerNodeId] = triggerContext;${requestInjection}
|
|
1092
1339
|
|
|
1093
1340
|
${executionLoop}
|
|
@@ -1152,6 +1399,48 @@ exports.getCronRouteFileName = getCronRouteFileName;
|
|
|
1152
1399
|
* Handles if-statements, loops, early responses, custom nodes, and terminal results.
|
|
1153
1400
|
*/
|
|
1154
1401
|
const generateNodeExecutionLoop = (configVar, options) => {
|
|
1402
|
+
const automation = (options === null || options === void 0 ? void 0 : options.automation) === true;
|
|
1403
|
+
// An automation handler resumes a parked run at `resumeFrom` (the node
|
|
1404
|
+
// after its Wait): the nodes before it ran in the earlier part, and the
|
|
1405
|
+
// restored context carries their results and branch decisions.
|
|
1406
|
+
const resumeBlock = automation
|
|
1407
|
+
? `
|
|
1408
|
+
var __startIndex = 0;
|
|
1409
|
+
if (resumeFrom) {
|
|
1410
|
+
__startIndex = sortedNodes.findIndex(function(n) { return n.id === resumeFrom; });
|
|
1411
|
+
if (__startIndex === -1) { throw new Error('This automation has no step ' + resumeFrom + ' to resume at'); }
|
|
1412
|
+
}
|
|
1413
|
+
`
|
|
1414
|
+
: '';
|
|
1415
|
+
// An automation has no caller to answer, so a response node only ends the
|
|
1416
|
+
// run; a Wait stored the run (see general-wait) and nothing after it runs now.
|
|
1417
|
+
const earlyResponseBlock = automation
|
|
1418
|
+
? `
|
|
1419
|
+
if (result && result.__earlyResponse) {
|
|
1420
|
+
await utils.settlePendingNodePromises(context);
|
|
1421
|
+
return { waiting: false };
|
|
1422
|
+
}
|
|
1423
|
+
if (result && result.__wait) {
|
|
1424
|
+
await utils.settlePendingNodePromises(context);
|
|
1425
|
+
return { waiting: true, until: result.until, wouldWait: result.wouldWait || null };
|
|
1426
|
+
}`
|
|
1427
|
+
: `
|
|
1428
|
+
if (result && result.__earlyResponse) {
|
|
1429
|
+
var earlyRes = result.__earlyResponse;
|
|
1430
|
+
var hKeys = Object.keys(earlyRes.headers || {});
|
|
1431
|
+
for (var h = 0; h < hKeys.length; h++) {
|
|
1432
|
+
res.setHeader(hKeys[h], earlyRes.headers[hKeys[h]]);
|
|
1433
|
+
}
|
|
1434
|
+
await utils.settlePendingNodePromises(context);
|
|
1435
|
+
res.status(earlyRes.status || 500).json(earlyRes.body || {});
|
|
1436
|
+
return;
|
|
1437
|
+
}`;
|
|
1438
|
+
// A branch runs on a copy of the context, so a Wait there could neither
|
|
1439
|
+
// store the run nor stop it.
|
|
1440
|
+
const parallelWaitGuard = automation
|
|
1441
|
+
? `
|
|
1442
|
+
if (wlpNode.type === 'general-wait') { throw new Error('A Wait cannot run inside a parallel branch'); }`
|
|
1443
|
+
: '';
|
|
1155
1444
|
const customNodeBlock = (options === null || options === void 0 ? void 0 : options.hasCustomNodes)
|
|
1156
1445
|
? `
|
|
1157
1446
|
if (result && result.__customNode) {
|
|
@@ -1174,13 +1463,13 @@ const generateNodeExecutionLoop = (configVar, options) => {
|
|
|
1174
1463
|
}`
|
|
1175
1464
|
: '';
|
|
1176
1465
|
return ` var sortedNodes = ${configVar}.nodes.slice().sort(function(a, b) { return a.stepNumber - b.stepNumber; });
|
|
1177
|
-
|
|
1178
|
-
for (var i = 0; i < sortedNodes.length; i++) {
|
|
1466
|
+
${resumeBlock}
|
|
1467
|
+
for (var i = ${automation ? '__startIndex' : '0'}; i < sortedNodes.length; i++) {
|
|
1179
1468
|
var node = sortedNodes[i];
|
|
1180
1469
|
// Never resolved nor run on a non-taken branch, an if-statement included
|
|
1181
1470
|
// (see the segment executor above).
|
|
1182
1471
|
if (context.__skippedNodes && context.__skippedNodes[node.id]) continue;
|
|
1183
|
-
var resolved =
|
|
1472
|
+
var resolved = resolveNodeConfig(node, context);
|
|
1184
1473
|
// See the other segment executors — the unresolved-token guard must run
|
|
1185
1474
|
// wherever data nodes execute, and they all execute on the server.
|
|
1186
1475
|
var __configError = utils.finalizeResolvedConfig(node.type, resolved);
|
|
@@ -1188,7 +1477,7 @@ const generateNodeExecutionLoop = (configVar, options) => {
|
|
|
1188
1477
|
resolved.__nodeId = node.id;
|
|
1189
1478
|
|
|
1190
1479
|
if (node.type === 'general-if-statement') {
|
|
1191
|
-
var condResult = utils.evaluateCondition(resolved, context);
|
|
1480
|
+
var condResult = utils.evaluateCondition(resolved, context, node.config);
|
|
1192
1481
|
context[node.id] = { result: condResult };
|
|
1193
1482
|
var skipHandle = condResult ? 'false' : 'true';
|
|
1194
1483
|
var cfgEdges = ${configVar}.edges || [];
|
|
@@ -1252,10 +1541,10 @@ const generateNodeExecutionLoop = (configVar, options) => {
|
|
|
1252
1541
|
context[node.id] = utils.loopIterationContext(collection, li);
|
|
1253
1542
|
for (var bi = 0; bi < bodyNodes.length; bi++) {
|
|
1254
1543
|
var bNode = bodyNodes[bi];
|
|
1255
|
-
var bResolved =
|
|
1544
|
+
var bResolved = resolveNodeConfig(bNode, context);
|
|
1256
1545
|
bResolved.__nodeId = bNode.id;
|
|
1257
1546
|
if (bNode.type === 'general-if-statement') {
|
|
1258
|
-
context[bNode.id] = { result: utils.evaluateCondition(bResolved, context) };
|
|
1547
|
+
context[bNode.id] = { result: utils.evaluateCondition(bResolved, context, bNode.config) };
|
|
1259
1548
|
continue;
|
|
1260
1549
|
}
|
|
1261
1550
|
var bHandler = nodeHandlers[bNode.type];
|
|
@@ -1287,17 +1576,8 @@ const generateNodeExecutionLoop = (configVar, options) => {
|
|
|
1287
1576
|
if (context.__loopBodyNodeIds && context.__loopBodyNodeIds[node.id]) continue;
|
|
1288
1577
|
|
|
1289
1578
|
if (node.type === 'general-switch') {
|
|
1290
|
-
|
|
1291
|
-
var
|
|
1292
|
-
var swMatchedCase = 'default';
|
|
1293
|
-
for (var swci = 0; swci < swCases.length; swci++) {
|
|
1294
|
-
var swCaseVal = utils.resolveValue(swCases[swci].condition, context);
|
|
1295
|
-
if (resolved.comparisonMode === 'expression') {
|
|
1296
|
-
try { if (new Function('value', 'context', 'return (' + swCaseVal + ')')(swVal, context)) { swMatchedCase = swCases[swci].id; break; } } catch(e) {}
|
|
1297
|
-
} else {
|
|
1298
|
-
if (swVal === swCaseVal) { swMatchedCase = swCases[swci].id; break; }
|
|
1299
|
-
}
|
|
1300
|
-
}
|
|
1579
|
+
// Only an authored case expression is compiled (see matchSwitchCase).
|
|
1580
|
+
var swMatchedCase = utils.matchSwitchCase(node.config, resolved, context);
|
|
1301
1581
|
context[node.id] = { matchedCase: swMatchedCase };
|
|
1302
1582
|
var swEdges = ${configVar}.edges || [];
|
|
1303
1583
|
var swBranchEdges = swEdges.filter(function(e) { return e.source === node.id; });
|
|
@@ -1341,8 +1621,8 @@ const generateNodeExecutionLoop = (configVar, options) => {
|
|
|
1341
1621
|
var wlBranchCtx = Object.assign({}, context);
|
|
1342
1622
|
return (async function() {
|
|
1343
1623
|
for (var wlpbi = 0; wlpbi < wlBranchNodes.length; wlpbi++) {
|
|
1344
|
-
var wlpNode = wlBranchNodes[wlpbi]
|
|
1345
|
-
var wlpRes =
|
|
1624
|
+
var wlpNode = wlBranchNodes[wlpbi];${parallelWaitGuard}
|
|
1625
|
+
var wlpRes = resolveNodeConfig(wlpNode, wlBranchCtx);
|
|
1346
1626
|
wlpRes.__nodeId = wlpNode.id;
|
|
1347
1627
|
var wlpHandler = nodeHandlers[wlpNode.type];
|
|
1348
1628
|
if (!wlpHandler) continue;
|
|
@@ -1405,17 +1685,7 @@ const generateNodeExecutionLoop = (configVar, options) => {
|
|
|
1405
1685
|
context[node.id] = null;
|
|
1406
1686
|
continue;
|
|
1407
1687
|
}
|
|
1408
|
-
var result = await handler(resolved, context)
|
|
1409
|
-
if (result && result.__earlyResponse) {
|
|
1410
|
-
var earlyRes = result.__earlyResponse;
|
|
1411
|
-
var hKeys = Object.keys(earlyRes.headers || {});
|
|
1412
|
-
for (var h = 0; h < hKeys.length; h++) {
|
|
1413
|
-
res.setHeader(hKeys[h], earlyRes.headers[hKeys[h]]);
|
|
1414
|
-
}
|
|
1415
|
-
await utils.settlePendingNodePromises(context);
|
|
1416
|
-
res.status(earlyRes.status || 500).json(earlyRes.body || {});
|
|
1417
|
-
return;
|
|
1418
|
-
}${customNodeBlock}
|
|
1688
|
+
var result = await handler(resolved, context);${earlyResponseBlock}${customNodeBlock}
|
|
1419
1689
|
if (utils.isFatalNodeResult(result) && !utils.continuesOnError(node)) {
|
|
1420
1690
|
throw new Error(utils.fatalNodeResultMessage(result));
|
|
1421
1691
|
}
|
|
@@ -1427,20 +1697,33 @@ const generateNodeExecutionLoop = (configVar, options) => {
|
|
|
1427
1697
|
// serverless function can be frozen the instant it replies.
|
|
1428
1698
|
await utils.settlePendingNodePromises(context);`;
|
|
1429
1699
|
};
|
|
1430
|
-
|
|
1700
|
+
/** A webhook whose payload a signature vouches for: a payment provider's, or a verified scheme other than `custom`. */
|
|
1701
|
+
const isVerifiedWebhookConfig = (webhookConfig) => (0, payments_1.isPaymentWebhookConfig)(webhookConfig) ||
|
|
1702
|
+
(!!webhookConfig.verifySignature && webhookConfig.signatureAlgorithm !== 'custom');
|
|
1703
|
+
exports.isVerifiedWebhookConfig = isVerifiedWebhookConfig;
|
|
1704
|
+
const generateWebhookWorkflowAPIRoute = (workflow, customNodes, options = {}) => {
|
|
1431
1705
|
var _a;
|
|
1432
1706
|
const webhookConfig = workflow.webhookConfig;
|
|
1433
|
-
const serverNodes = workflow.nodes.filter((n) => !CLIENT_ONLY_NODES.has(n.type));
|
|
1434
|
-
const allNodeTypes =
|
|
1435
|
-
const nodeHandlersEntries = generateNodeHandlersForSegment(allNodeTypes, true
|
|
1436
|
-
|
|
1707
|
+
const serverNodes = workflow.nodes.filter((n) => !exports.CLIENT_ONLY_NODES.has(n.type));
|
|
1708
|
+
const allNodeTypes = jobRouteNodeTypes(serverNodes, customNodes);
|
|
1709
|
+
const nodeHandlersEntries = generateNodeHandlersForSegment(allNodeTypes, true, false, {
|
|
1710
|
+
withAutomations: options.withAutomations,
|
|
1711
|
+
relativePrefix: (0, exports.getWebhookRoutePath)(workflow)
|
|
1712
|
+
.map(() => '..')
|
|
1713
|
+
.join('/'),
|
|
1714
|
+
});
|
|
1437
1715
|
const serverNodeIds = new Set(serverNodes.map((n) => n.id));
|
|
1438
1716
|
const serverEdges = workflow.edges.filter((e) => serverNodeIds.has(e.source) || serverNodeIds.has(e.target));
|
|
1439
1717
|
const hasCustomNodeUsage = serverNodes.some((n) => n.type === 'general-custom-node');
|
|
1440
1718
|
const hasCustomNodeDefs = customNodes && Object.keys(customNodes).length > 0;
|
|
1719
|
+
// Without a verified signature the payload is anyone's: email/SMS nodes are
|
|
1720
|
+
// marked for the send guard as on a page's route, and so are the sends of
|
|
1721
|
+
// the custom nodes it calls (see PUBLIC_CALLER_INJECTION).
|
|
1722
|
+
const webhookVerified = (0, exports.isVerifiedWebhookConfig)(webhookConfig);
|
|
1723
|
+
const webhookMessages = (0, outbound_message_guard_1.markWebhookMessageNodes)(workflow, serverNodes, serverEdges, webhookVerified);
|
|
1441
1724
|
const workflowConfig = JSON.stringify({
|
|
1442
1725
|
triggerNodeId: workflow.trigger.nodeId,
|
|
1443
|
-
nodes:
|
|
1726
|
+
nodes: webhookMessages.nodes.map((n) => ({
|
|
1444
1727
|
id: n.id,
|
|
1445
1728
|
type: n.type,
|
|
1446
1729
|
config: n.config,
|
|
@@ -1507,9 +1790,10 @@ const generateWebhookWorkflowAPIRoute = (workflow, customNodes) => {
|
|
|
1507
1790
|
const customNodesImport = hasCustomNodeUsage && hasCustomNodeDefs
|
|
1508
1791
|
? `var __customNodes;\ntry { __customNodes = require('${relativePrefix}/utils/workflows/custom-nodes'); } catch (_e) { __customNodes = {}; }\n${(0, custom_node_modules_1.adminCustomNodesRequireLine)(serverNodes, customNodes, relativePrefix)}`
|
|
1509
1792
|
: '';
|
|
1510
|
-
const requestInjection =
|
|
1511
|
-
?
|
|
1512
|
-
:
|
|
1793
|
+
const requestInjection = (webhookMessages.marked
|
|
1794
|
+
? visitor_request_1.VISITOR_REQUEST_INJECTION
|
|
1795
|
+
: serverRouteRequestInjection(allNodeTypes, options.withAutomations)) +
|
|
1796
|
+
(!webhookVerified && hasCustomNodeUsage ? outbound_message_guard_1.PUBLIC_CALLER_INJECTION : '');
|
|
1513
1797
|
const executionLoop = generateNodeExecutionLoop('WORKFLOW_CONFIG', {
|
|
1514
1798
|
hasCustomNodes: hasCustomNodeUsage && hasCustomNodeDefs,
|
|
1515
1799
|
});
|
|
@@ -1524,7 +1808,7 @@ if (typeof globalThis.fetch === 'undefined') {
|
|
|
1524
1808
|
}
|
|
1525
1809
|
|
|
1526
1810
|
const utils = require('${relativePrefix}/utils/workflows/server-runtime');
|
|
1527
|
-
const
|
|
1811
|
+
const resolveNodeConfig = utils.resolveNodeConfig;
|
|
1528
1812
|
${(0, workflow_utils_alias_1.workflowUtilsAliasLine)('utils')}
|
|
1529
1813
|
${customNodesImport}${(0, cart_pricing_preamble_1.generateCartPricingPreamble)(allNodeTypes, relativePrefix)}${generateSentEmailLogPreamble(allNodeTypes, relativePrefix)}${(0, payments_1.generatePaymentDriversPreamble)((0, payment_drivers_scope_1.usesPaymentDriverNode)(allNodeTypes) || isPaymentWebhook, relativePrefix)}${deliveryLease.preamble}
|
|
1530
1814
|
${webhookBodyCode}
|
|
@@ -1540,7 +1824,6 @@ var ERROR_HANDLER_NODES = ${errorHandlerNodesJson};
|
|
|
1540
1824
|
const nodeHandlers = {
|
|
1541
1825
|
${nodeHandlersEntries}
|
|
1542
1826
|
};
|
|
1543
|
-
|
|
1544
1827
|
module.exports = async function handler(req, res) {
|
|
1545
1828
|
if (req.method !== '${webhookConfig.httpMethod}') {
|
|
1546
1829
|
res.status(405).json({ error: 'Method not allowed' });
|
|
@@ -1576,14 +1859,35 @@ ${generateSignatureVerificationBlock(normalisedWebhookConfig)}${deliveryLease.cl
|
|
|
1576
1859
|
// Credentials for this deployment's calls to its own /api/data routes —
|
|
1577
1860
|
// without them a protected deployment 401s itself and every data node
|
|
1578
1861
|
// returns no rows. See internalRequestHeaders in runtime-utils.
|
|
1579
|
-
context.__internalHeaders = utils.internalRequestHeaders(req)
|
|
1862
|
+
context.__internalHeaders = utils.internalRequestHeaders(req);
|
|
1863
|
+
// A server job: no visitor's request runs here, so the data API reads the
|
|
1864
|
+
// customer records unscoped (see __dataIsServerJob; the flag counts only
|
|
1865
|
+
// with the app secret, which every data node presents).
|
|
1866
|
+
context.__internalHeaders['x-tq-server-job'] = '1';${requestInjection}
|
|
1580
1867
|
|
|
1581
1868
|
${executionLoop}
|
|
1582
1869
|
${deliveryLease.release}
|
|
1583
1870
|
res.status(200).json({ received: true });
|
|
1584
1871
|
} catch (error) {
|
|
1585
1872
|
console.error('Webhook workflow error:', error);
|
|
1586
|
-
|
|
1873
|
+
${generateErrorHandlerRunBlock('Webhook error handler failed:')}
|
|
1874
|
+
// Land whatever the main run started (an email's ledger row, a
|
|
1875
|
+
// fire-and-forget write) before replying — see the segment routes.
|
|
1876
|
+
if (typeof context !== 'undefined' && context) { await utils.settlePendingNodePromises(context); }${deliveryLease.release}
|
|
1877
|
+
res.status(500).json({ error: 'Webhook processing failed' });
|
|
1878
|
+
}
|
|
1879
|
+
};
|
|
1880
|
+
|
|
1881
|
+
module.exports.config = { api: { bodyParser: false } };
|
|
1882
|
+
`;
|
|
1883
|
+
};
|
|
1884
|
+
exports.generateWebhookWorkflowAPIRoute = generateWebhookWorkflowAPIRoute;
|
|
1885
|
+
/**
|
|
1886
|
+
* Runs the workflow's error-handler branch (`ERROR_HANDLER_NODES`) after the
|
|
1887
|
+
* main run threw `error`, on a copy of `context` that carries the error. A
|
|
1888
|
+
* failure of the branch itself is only logged, with `failureLabel`.
|
|
1889
|
+
*/
|
|
1890
|
+
const generateErrorHandlerRunBlock = (failureLabel) => ` if (ERROR_HANDLER_NODES) {
|
|
1587
1891
|
try {
|
|
1588
1892
|
var errCtx = Object.assign({}, context || {});
|
|
1589
1893
|
if (WORKFLOW_CONFIG.errorHandlerNodeId) {
|
|
@@ -1594,7 +1898,7 @@ ${deliveryLease.release}
|
|
|
1594
1898
|
}
|
|
1595
1899
|
for (var ei = 0; ei < ERROR_HANDLER_NODES.length; ei++) {
|
|
1596
1900
|
var eNode = ERROR_HANDLER_NODES[ei];
|
|
1597
|
-
var eResolved =
|
|
1901
|
+
var eResolved = resolveNodeConfig(eNode, errCtx);
|
|
1598
1902
|
eResolved.__nodeId = eNode.id;
|
|
1599
1903
|
var eHandler = nodeHandlers[eNode.type];
|
|
1600
1904
|
if (eHandler) {
|
|
@@ -1609,20 +1913,171 @@ ${deliveryLease.release}
|
|
|
1609
1913
|
}
|
|
1610
1914
|
await utils.settlePendingNodePromises(errCtx);
|
|
1611
1915
|
} catch (innerErr) {
|
|
1612
|
-
console.error('
|
|
1916
|
+
console.error('${failureLabel}', innerErr);
|
|
1613
1917
|
}
|
|
1614
|
-
}
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1918
|
+
}`;
|
|
1919
|
+
/**
|
|
1920
|
+
* An automation's handler module (`lib/automations/handlers/<file>.js`, see
|
|
1921
|
+
* automations/handler-module-generator.ts): the webhook route's node loop as
|
|
1922
|
+
* an importable function, `module.exports.run = async (event, context,
|
|
1923
|
+
* resumeFrom)`, which the in-app dispatcher awaits.
|
|
1924
|
+
*
|
|
1925
|
+
* - `event` is the event envelope (`{ event, actor, <entity> }`): the trigger
|
|
1926
|
+
* node's output. A resumed run passes it again, read afresh.
|
|
1927
|
+
* - `context` is `{}` for a new run (plus `__baseUrl` when the dispatcher
|
|
1928
|
+
* knows the app's origin), or the context a Wait stored.
|
|
1929
|
+
* - `resumeFrom` is the node to resume at; every node before it ran already.
|
|
1930
|
+
*
|
|
1931
|
+
* Every node runs as in a webhook route — server handlers, the same
|
|
1932
|
+
* `__baseUrl` / internal headers, the error-handler branch — except the
|
|
1933
|
+
* browser-only ones, which fail the run, and a Wait (`general-wait`), which
|
|
1934
|
+
* stores the run and resolves `{ waiting: true }` (a test event's Wait stores
|
|
1935
|
+
* nothing and resolves `{ waiting: true, wouldWait }`; a Wait with no step
|
|
1936
|
+
* after it stores nothing and the run ends there). A run that fails rejects,
|
|
1937
|
+
* after the error-handler branch ran, so the dispatcher records the failure.
|
|
1938
|
+
*/
|
|
1939
|
+
const generateHandlerFunction = (workflow, customNodes) => {
|
|
1940
|
+
var _a;
|
|
1941
|
+
const relativePrefix = automations_scope_1.AUTOMATION_HANDLERS_PATH.map(() => '..').join('/');
|
|
1942
|
+
const nodes = workflow.nodes || [];
|
|
1943
|
+
const allNodeTypes = jobRouteNodeTypes(nodes, customNodes);
|
|
1944
|
+
// An automation runs only in a project that has the event bus.
|
|
1945
|
+
const nodeHandlersEntries = generateNodeHandlersForSegment(allNodeTypes, true, true, {
|
|
1946
|
+
withAutomations: true,
|
|
1947
|
+
relativePrefix,
|
|
1948
|
+
});
|
|
1949
|
+
const hasCustomNodeUsage = nodes.some((n) => n.type === 'general-custom-node');
|
|
1950
|
+
const useCustomNodes = hasCustomNodeUsage && !!customNodes && Object.keys(customNodes).length > 0;
|
|
1951
|
+
const workflowConfig = JSON.stringify({
|
|
1952
|
+
triggerNodeId: workflow.trigger.nodeId,
|
|
1953
|
+
nodes: nodes.map((n) => ({
|
|
1954
|
+
id: n.id,
|
|
1955
|
+
type: n.type,
|
|
1956
|
+
config: n.config,
|
|
1957
|
+
stepNumber: n.stepNumber,
|
|
1958
|
+
label: n.label,
|
|
1959
|
+
})),
|
|
1960
|
+
edges: workflow.edges || [],
|
|
1961
|
+
errorHandlerNodeId: ((_a = workflow.errorHandler) === null || _a === void 0 ? void 0 : _a.nodeId) || null,
|
|
1962
|
+
}, null, 2);
|
|
1963
|
+
const errorHandlerNodes = workflow.errorHandler ? getErrorHandlerNodes(workflow) : null;
|
|
1964
|
+
const errorHandlerNodesJson = errorHandlerNodes
|
|
1965
|
+
? JSON.stringify(errorHandlerNodes, null, 2)
|
|
1966
|
+
: 'null';
|
|
1967
|
+
const customNodesImport = useCustomNodes
|
|
1968
|
+
? `var __customNodes;\ntry { __customNodes = require('${relativePrefix}/utils/workflows/custom-nodes'); } catch (_e) { __customNodes = {}; }\n${(0, custom_node_modules_1.adminCustomNodesRequireLine)(nodes, customNodes, relativePrefix)}`
|
|
1969
|
+
: '';
|
|
1970
|
+
const executionLoop = generateNodeExecutionLoop('WORKFLOW_CONFIG', {
|
|
1971
|
+
hasCustomNodes: useCustomNodes,
|
|
1972
|
+
automation: true,
|
|
1973
|
+
});
|
|
1974
|
+
return `/**
|
|
1975
|
+
* Automation handler
|
|
1976
|
+
* Workflow: ${sanitizeForBlockComment(workflow.name || workflow.id)}
|
|
1977
|
+
* Event: ${sanitizeForBlockComment((0, automations_scope_1.automationEventType)(workflow) || 'none')}
|
|
1978
|
+
*/
|
|
1979
|
+
if (typeof globalThis.fetch === 'undefined') {
|
|
1980
|
+
globalThis.fetch = require('node-fetch');
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
const utils = require('${relativePrefix}/utils/workflows/server-runtime');
|
|
1984
|
+
const resolveNodeConfig = utils.resolveNodeConfig;
|
|
1985
|
+
${(0, workflow_utils_alias_1.workflowUtilsAliasLine)('utils')}
|
|
1986
|
+
${customNodesImport}${(0, cart_pricing_preamble_1.generateCartPricingPreamble)(allNodeTypes, relativePrefix)}${generateSentEmailLogPreamble(allNodeTypes, relativePrefix)}${(0, payments_1.generatePaymentDriversPreamble)((0, payment_drivers_scope_1.usesPaymentDriverNode)(allNodeTypes), relativePrefix)}
|
|
1987
|
+
var __automationStore = require('../store');
|
|
1988
|
+
|
|
1989
|
+
var WORKFLOW_ID = ${JSON.stringify(workflow.id)};
|
|
1990
|
+
|
|
1991
|
+
const WORKFLOW_CONFIG = ${workflowConfig};
|
|
1992
|
+
|
|
1993
|
+
var ERROR_HANDLER_NODES = ${errorHandlerNodesJson};
|
|
1994
|
+
|
|
1995
|
+
const nodeHandlers = {
|
|
1996
|
+
${nodeHandlersEntries}
|
|
1620
1997
|
};
|
|
1998
|
+
// Rebuilt by every run, so never stored with a parked one: the queue of
|
|
1999
|
+
// fire-and-forget work, where and with which credentials the run calls the
|
|
2000
|
+
// app's own routes, and the run itself.
|
|
2001
|
+
var RUNTIME_CONTEXT_KEYS = ['__pendingNodePromises', '__baseUrl', '__internalHeaders', '__automation', '__request', '__emailAttribution'];
|
|
2002
|
+
|
|
2003
|
+
var SORTED_NODE_IDS = WORKFLOW_CONFIG.nodes
|
|
2004
|
+
.slice()
|
|
2005
|
+
.sort(function(a, b) { return a.stepNumber - b.stepNumber; })
|
|
2006
|
+
.map(function(n) { return n.id; });
|
|
2007
|
+
|
|
2008
|
+
// Stores the run at a Wait: the next node, and the context so far.
|
|
2009
|
+
async function park(context, nodeId, until) {
|
|
2010
|
+
var at = SORTED_NODE_IDS.indexOf(nodeId);
|
|
2011
|
+
var resumeNodeId = at === -1 ? null : SORTED_NODE_IDS[at + 1] || null;
|
|
2012
|
+
// Nothing after the Wait: the run is over.
|
|
2013
|
+
if (!resumeNodeId) return null;
|
|
2014
|
+
if (!context.__automation.eventId) {
|
|
2015
|
+
throw new Error('A Wait needs the event the automation runs for');
|
|
2016
|
+
}
|
|
2017
|
+
var saved = {};
|
|
2018
|
+
Object.keys(context).forEach(function(key) {
|
|
2019
|
+
if (RUNTIME_CONTEXT_KEYS.indexOf(key) === -1) saved[key] = context[key];
|
|
2020
|
+
});
|
|
2021
|
+
await __automationStore.saveWait({
|
|
2022
|
+
eventId: context.__automation.eventId,
|
|
2023
|
+
workflowId: WORKFLOW_ID,
|
|
2024
|
+
resumeNodeId: resumeNodeId,
|
|
2025
|
+
context: JSON.stringify(saved),
|
|
2026
|
+
runAt: until,
|
|
2027
|
+
});
|
|
2028
|
+
return resumeNodeId;
|
|
2029
|
+
}
|
|
1621
2030
|
|
|
1622
|
-
|
|
2031
|
+
async function runNodes(context, resumeFrom) {
|
|
2032
|
+
${executionLoop}
|
|
2033
|
+
return { waiting: false };
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
async function run(event, context, resumeFrom) {
|
|
2037
|
+
context = context && typeof context === 'object' ? context : {};
|
|
2038
|
+
// Shared fire-and-forget queue — drained before the run settles.
|
|
2039
|
+
context.__pendingNodePromises = [];
|
|
2040
|
+
// Where this deployment calls its own routes, and with which credentials
|
|
2041
|
+
// (see the webhook routes).
|
|
2042
|
+
if (!context.__baseUrl) {
|
|
2043
|
+
context.__baseUrl = __automationStore.appBaseUrl();
|
|
2044
|
+
}
|
|
2045
|
+
context.__internalHeaders = utils.internalRequestHeaders(null);
|
|
2046
|
+
// A server job: no visitor's request runs here, so the data API reads the
|
|
2047
|
+
// customer records unscoped (see __dataIsServerJob; the flag counts only
|
|
2048
|
+
// with the app secret, which every data node presents).
|
|
2049
|
+
context.__internalHeaders['x-tq-server-job'] = '1';
|
|
2050
|
+
if (event) {
|
|
2051
|
+
context[WORKFLOW_CONFIG.triggerNodeId] = event;
|
|
2052
|
+
}
|
|
2053
|
+
var trigger = context[WORKFLOW_CONFIG.triggerNodeId] || {};
|
|
2054
|
+
context.__automation = {
|
|
2055
|
+
workflowId: WORKFLOW_ID,
|
|
2056
|
+
eventId: trigger.event && trigger.event.id ? String(trigger.event.id) : '',
|
|
2057
|
+
// A test event runs once and never parks at a Wait (see general-wait).
|
|
2058
|
+
test: !!(trigger.event && trigger.event.test === true),
|
|
2059
|
+
park: function(nodeId, until) { return park(context, nodeId, until); },
|
|
2060
|
+
};
|
|
2061
|
+
// The mail this run sends is filed under the automation, and under the
|
|
2062
|
+
// event's order when it has one (the sent-email ledger reads this).
|
|
2063
|
+
context.__emailAttribution = {
|
|
2064
|
+
source: 'automation',
|
|
2065
|
+
sourceRef: WORKFLOW_ID,
|
|
2066
|
+
orderId: trigger.order && trigger.order.id ? String(trigger.order.id) : null,
|
|
2067
|
+
};
|
|
2068
|
+
try {
|
|
2069
|
+
return await runNodes(context, resumeFrom || null);
|
|
2070
|
+
} catch (error) {
|
|
2071
|
+
${generateErrorHandlerRunBlock('Automation error handler failed:')}
|
|
2072
|
+
await utils.settlePendingNodePromises(context);
|
|
2073
|
+
throw error;
|
|
2074
|
+
}
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
module.exports.run = run;
|
|
1623
2078
|
`;
|
|
1624
2079
|
};
|
|
1625
|
-
exports.
|
|
2080
|
+
exports.generateHandlerFunction = generateHandlerFunction;
|
|
1626
2081
|
const getWebhookRouteFileName = (workflow) => {
|
|
1627
2082
|
const webhookConfig = workflow.webhookConfig;
|
|
1628
2083
|
if (webhookConfig === null || webhookConfig === void 0 ? void 0 : webhookConfig.urlPath) {
|