@teleporthq/teleport-plugin-next-workflows 0.44.10 → 0.44.17
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 +225 -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 +46 -8
- 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 +221 -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 +46 -8
- 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 +218 -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 +48 -8
- 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 +254 -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,18 +1,321 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { UIDLWorkflows } from '@teleporthq/teleport-types'
|
|
2
|
+
import { generateCommonJsSessionTokenResolverCode } from './session-cookie-resolver'
|
|
3
|
+
import { REALTIME_TRIGGER_TYPES } from './graph-utils'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Who a realtime request acts for, and what it may do.
|
|
7
|
+
*
|
|
8
|
+
* The site's `/api/realtime/*` routes hold the project's realtime key, so the
|
|
9
|
+
* realtime worker trusts what they send. They used to forward the browser's
|
|
10
|
+
* body as it came — `userId`, `senderId`, `senderName` — and the worker gave
|
|
11
|
+
* every token every channel of the project (`<projectId>:*`): any visitor
|
|
12
|
+
* subscribed to every channel, joined presence and published as anyone it
|
|
13
|
+
* named.
|
|
14
|
+
*
|
|
15
|
+
* Now the route decides the identity itself, and the browser cannot name one:
|
|
16
|
+
* - the signed-in user of the site's own session (its id, its name);
|
|
17
|
+
* - otherwise an opaque per-visitor id, `anon_<hash>`, derived from a random
|
|
18
|
+
* key in an httpOnly cookie this route sets. The id is a one-way hash of the
|
|
19
|
+
* key, so knowing someone's id (presence shows it) does not let anyone
|
|
20
|
+
* present their cookie. On https the cookie is `__Host-tq_rt` (`Path=/`,
|
|
21
|
+
* `Secure`, no `Domain`), which a sibling site on the shared hosting domain
|
|
22
|
+
* cannot set; plain http (local development) uses `__tq_rt`. Its value is
|
|
23
|
+
* `<key>.<HMAC(app secret, key)>`: a value this server did not issue is
|
|
24
|
+
* replaced, never adopted, and without the app secret the route refuses.
|
|
25
|
+
* It sends that identity to the worker in the `x-realtime-identity` header,
|
|
26
|
+
* and the worker then (real-time-worker `src/lib/identity.ts`):
|
|
27
|
+
* - uses it as the token's clientId, the presence member and the sender;
|
|
28
|
+
* - grants a token exactly the channels that identity may use: the channels
|
|
29
|
+
* the site's pages subscribe to (`collectSiteRealtimeChannels`), the ones it
|
|
30
|
+
* joined, and its own `user.<id>` channel — never `<projectId>:*`;
|
|
31
|
+
* - keeps `user.<id>` and `user.<id>.<anything>` private to `<id>`: nobody
|
|
32
|
+
* else may subscribe, join, list or publish there. Every other channel name
|
|
33
|
+
* is public.
|
|
34
|
+
* Every route is rate-limited per visitor through the shared security runtime.
|
|
35
|
+
* What Ably vouches for in presence is the member's clientId (that identity);
|
|
36
|
+
* a member's presence `userName` / `userData` are what its own browser sent
|
|
37
|
+
* with presence.enter, so they are display data, never proof of who it is.
|
|
38
|
+
*
|
|
39
|
+
* The workflow nodes that SEND (`realtime-send-channel-message/event`) run on
|
|
40
|
+
* the server and call the worker with the key directly; they send as the
|
|
41
|
+
* author configured, and may address any channel, `user.<id>` included — that
|
|
42
|
+
* is how a site notifies one user.
|
|
43
|
+
*/
|
|
44
|
+
export const REALTIME_IDENTITY_HEADER = 'x-realtime-identity'
|
|
45
|
+
export const REALTIME_ANON_COOKIE = '__tq_rt'
|
|
46
|
+
export const REALTIME_ANON_COOKIE_SECURE = '__Host-tq_rt'
|
|
47
|
+
export const REALTIME_MAX_SITE_CHANNELS = 100
|
|
48
|
+
|
|
49
|
+
/** Per-visitor limits of each route, `[limit, windowSeconds]` pairs. */
|
|
50
|
+
export const REALTIME_ROUTE_LIMITS: Record<string, Array<[number, number]>> = {
|
|
51
|
+
'realtime-token': [[60, 60]],
|
|
52
|
+
'realtime-join': [[30, 60]],
|
|
53
|
+
'realtime-leave': [[60, 60]],
|
|
54
|
+
'realtime-message': [
|
|
55
|
+
[20, 60],
|
|
56
|
+
[300, 86400],
|
|
57
|
+
],
|
|
58
|
+
'realtime-event': [
|
|
59
|
+
[20, 60],
|
|
60
|
+
[300, 86400],
|
|
61
|
+
],
|
|
62
|
+
'realtime-channels-list': [[30, 60]],
|
|
63
|
+
'realtime-channels-members': [[30, 60]],
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const CHANNEL_NAME_PATTERN = /^[a-zA-Z0-9._-]{1,256}$/
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The fixed channel names the site's pages subscribe to (the realtime
|
|
70
|
+
* triggers). A token is granted these plus whatever the visitor joined; a
|
|
71
|
+
* name bound to workflow context is not fixed and is granted on join.
|
|
72
|
+
*/
|
|
73
|
+
export const collectSiteRealtimeChannels = (workflows: UIDLWorkflows | undefined): string[] => {
|
|
74
|
+
const names = new Set<string>()
|
|
75
|
+
const add = (type: string, config: Record<string, unknown> | undefined) => {
|
|
76
|
+
const channelName = config ? config.channelName : undefined
|
|
77
|
+
if (
|
|
78
|
+
REALTIME_TRIGGER_TYPES.has(type) &&
|
|
79
|
+
typeof channelName === 'string' &&
|
|
80
|
+
CHANNEL_NAME_PATTERN.test(channelName)
|
|
81
|
+
) {
|
|
82
|
+
names.add(channelName)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const all = (workflows && workflows.workflows) || {}
|
|
86
|
+
for (const workflow of Object.values(all)) {
|
|
87
|
+
if (workflow.trigger) {
|
|
88
|
+
add(workflow.trigger.type, workflow.trigger.config)
|
|
89
|
+
}
|
|
90
|
+
for (const node of workflow.nodes || []) {
|
|
91
|
+
add(node.type, node.config)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return Array.from(names).sort().slice(0, REALTIME_MAX_SITE_CHANNELS)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Whether a workflow node of the project calls `/api/realtime/<route>` (a
|
|
99
|
+
* custom-code or HTTP node naming the path). The send nodes do not: they run
|
|
100
|
+
* on the server and call the realtime worker directly. Without a caller the
|
|
101
|
+
* browser-facing message / event routes are not emitted — each one is a way
|
|
102
|
+
* to spend the project's message quota.
|
|
103
|
+
*/
|
|
104
|
+
export const projectCallsRealtimeRoute = (
|
|
105
|
+
workflows: UIDLWorkflows | undefined,
|
|
106
|
+
route: 'message' | 'event'
|
|
107
|
+
): boolean => {
|
|
108
|
+
// The path itself, not a longer one that starts with it.
|
|
109
|
+
const calls = new RegExp(`/api/realtime/${route}(?![A-Za-z0-9_-])`)
|
|
110
|
+
const nodeLists: Array<Array<{ config?: unknown }>> = []
|
|
111
|
+
for (const workflow of Object.values((workflows && workflows.workflows) || {})) {
|
|
112
|
+
nodeLists.push(workflow.nodes || [])
|
|
113
|
+
}
|
|
114
|
+
for (const customNode of Object.values((workflows && workflows.customNodes) || {})) {
|
|
115
|
+
nodeLists.push(
|
|
116
|
+
((customNode as { nodes?: Array<{ config?: unknown }> }).nodes || []) as Array<{
|
|
117
|
+
config?: unknown
|
|
118
|
+
}>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
return nodeLists.some((nodes) =>
|
|
122
|
+
nodes.some((node) => calls.test(JSON.stringify(node.config === undefined ? null : node.config)))
|
|
123
|
+
)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export const generateRealtimeServerHelperCode = (
|
|
127
|
+
workflows?: UIDLWorkflows,
|
|
128
|
+
options: { withSessionRevocation?: boolean } = {}
|
|
129
|
+
): string => {
|
|
130
|
+
return `const crypto = require('crypto');
|
|
131
|
+
const __security = require('../security-runtime');
|
|
132
|
+
|
|
133
|
+
const REALTIME_SERVER_URL = process.env.REALTIME_SERVER_URL;
|
|
3
134
|
const REALTIME_SERVER_API_KEY = process.env.REALTIME_SERVER_API_KEY;
|
|
4
135
|
|
|
5
|
-
|
|
136
|
+
// The channels this site's pages subscribe to; every token covers them.
|
|
137
|
+
const SITE_CHANNELS = ${JSON.stringify(collectSiteRealtimeChannels(workflows))};
|
|
138
|
+
|
|
139
|
+
// Per-visitor limits of each route: [limit, windowSeconds].
|
|
140
|
+
const ROUTE_LIMITS = ${JSON.stringify(REALTIME_ROUTE_LIMITS)};
|
|
141
|
+
|
|
142
|
+
// __Host- on https: only this origin can set it (no Domain, Path=/, Secure).
|
|
143
|
+
const ANON_COOKIE_SECURE = '${REALTIME_ANON_COOKIE_SECURE}';
|
|
144
|
+
const ANON_COOKIE_PLAIN = '${REALTIME_ANON_COOKIE}';
|
|
145
|
+
// <32 hex key>.<64 hex HMAC of the key>
|
|
146
|
+
const ANON_COOKIE_PATTERN = /^([0-9a-f]{32})\\.([0-9a-f]{64})$/;
|
|
147
|
+
// What the realtime worker accepts as an identity id (no dots: user.<id>.<x>).
|
|
148
|
+
const IDENTITY_ID_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;
|
|
149
|
+
|
|
150
|
+
${generateCommonJsSessionTokenResolverCode('../..', {
|
|
151
|
+
withRevocation: options.withSessionRevocation !== false,
|
|
152
|
+
})}
|
|
153
|
+
|
|
154
|
+
function sha256Hex(value) {
|
|
155
|
+
return crypto.createHash('sha256').update(String(value)).digest('hex');
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Every value the request carries for the cookie name.
|
|
159
|
+
function readCookies(req, name) {
|
|
160
|
+
const raw = (req && req.headers && req.headers.cookie) || '';
|
|
161
|
+
const parts = String(raw).split(';');
|
|
162
|
+
const values = [];
|
|
163
|
+
for (let i = 0; i < parts.length; i++) {
|
|
164
|
+
const eq = parts[i].indexOf('=');
|
|
165
|
+
if (eq > 0 && parts[i].slice(0, eq).trim() === name) {
|
|
166
|
+
values.push(parts[i].slice(eq + 1).trim());
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return values;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function signAnonKey(secret, key) {
|
|
173
|
+
return crypto.createHmac('sha256', secret).update('teleport-realtime-anon:v1:' + key).digest('hex');
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// The key of a cookie this server issued, or null: an unsigned or wrongly
|
|
177
|
+
// signed value is never adopted.
|
|
178
|
+
function issuedAnonKey(req, name, secret) {
|
|
179
|
+
const values = readCookies(req, name);
|
|
180
|
+
for (let i = 0; i < values.length; i++) {
|
|
181
|
+
const match = ANON_COOKIE_PATTERN.exec(values[i]);
|
|
182
|
+
if (match && __security.safeEqual(match[2], signAnonKey(secret, match[1]))) {
|
|
183
|
+
return match[1];
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function appendSetCookie(res, cookie) {
|
|
190
|
+
const existing = res.getHeader ? res.getHeader('Set-Cookie') : undefined;
|
|
191
|
+
const list = !existing ? [] : Array.isArray(existing) ? existing : [String(existing)];
|
|
192
|
+
res.setHeader('Set-Cookie', list.concat([cookie]));
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Who this request acts for. The signed-in user of the site's own session;
|
|
196
|
+
// otherwise an opaque id derived from a random key in an httpOnly cookie this
|
|
197
|
+
// route sets. Nothing the browser sends can choose it.
|
|
198
|
+
async function resolveIdentity(req, res) {
|
|
199
|
+
let token = null;
|
|
200
|
+
try {
|
|
201
|
+
token = await __tqSessionToken(req);
|
|
202
|
+
} catch (e) {
|
|
203
|
+
token = null;
|
|
204
|
+
}
|
|
205
|
+
const userId = token && typeof token === 'object' ? (token.id != null ? token.id : token.sub) : null;
|
|
206
|
+
if (userId != null && String(userId) !== '') {
|
|
207
|
+
const raw = String(userId);
|
|
208
|
+
const name = typeof token.name === 'string' ? token.name.trim().slice(0, 100) : '';
|
|
209
|
+
return {
|
|
210
|
+
id: IDENTITY_ID_PATTERN.test(raw) ? raw : 'u_' + sha256Hex(raw).slice(0, 32),
|
|
211
|
+
name: name || 'Anonymous',
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
// The cookie is signed with the app secret; without it the route refuses.
|
|
215
|
+
const secret = process.env.NEXTAUTH_SECRET;
|
|
216
|
+
if (!secret) {
|
|
217
|
+
throw new Error('NEXTAUTH_SECRET is not set: the anonymous realtime identity cannot be signed');
|
|
218
|
+
}
|
|
219
|
+
const secure = __tqRequestIsSecure(req);
|
|
220
|
+
const cookieName = secure ? ANON_COOKIE_SECURE : ANON_COOKIE_PLAIN;
|
|
221
|
+
let key = issuedAnonKey(req, cookieName, secret);
|
|
222
|
+
if (!key) {
|
|
223
|
+
key = crypto.randomBytes(16).toString('hex');
|
|
224
|
+
appendSetCookie(
|
|
225
|
+
res,
|
|
226
|
+
cookieName + '=' + key + '.' + signAnonKey(secret, key) +
|
|
227
|
+
(secure ? '; Path=/; Secure; HttpOnly; SameSite=Lax' : '; Path=/api/realtime; HttpOnly; SameSite=Lax')
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
return { id: 'anon_' + sha256Hex('teleport-realtime-anon:' + key).slice(0, 32), name: 'Anonymous' };
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// The visitor's rate limits for one route; false = the 429 is already sent.
|
|
234
|
+
async function allow(req, res, scope) {
|
|
235
|
+
const limits = ROUTE_LIMITS[scope] || [];
|
|
236
|
+
for (let i = 0; i < limits.length; i++) {
|
|
237
|
+
const ok = await __security.rateLimitRequest(req, res, {
|
|
238
|
+
scope: scope,
|
|
239
|
+
limit: limits[i][0],
|
|
240
|
+
windowSeconds: limits[i][1],
|
|
241
|
+
});
|
|
242
|
+
if (!ok) return false;
|
|
243
|
+
}
|
|
244
|
+
return true;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function readBody(req) {
|
|
248
|
+
if (req.body && typeof req.body === 'object') return req.body;
|
|
249
|
+
if (typeof req.body === 'string' && req.body) {
|
|
250
|
+
try {
|
|
251
|
+
const parsed = JSON.parse(req.body);
|
|
252
|
+
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
253
|
+
} catch (e) {
|
|
254
|
+
return {};
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return {};
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
async function realtimeServerFetch(path, options, identity) {
|
|
6
261
|
const url = REALTIME_SERVER_URL + '/api/realtime' + path;
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
262
|
+
const headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + REALTIME_SERVER_API_KEY };
|
|
263
|
+
if (identity) {
|
|
264
|
+
headers['${REALTIME_IDENTITY_HEADER}'] = Buffer.from(
|
|
265
|
+
JSON.stringify({ id: identity.id, name: identity.name })
|
|
266
|
+
).toString('base64url');
|
|
267
|
+
}
|
|
268
|
+
return fetch(url, Object.assign({}, options || {}, { headers: headers }));
|
|
13
269
|
}
|
|
14
270
|
|
|
15
|
-
|
|
271
|
+
// One proxied call: limits, identity, the worker's answer. The call names the
|
|
272
|
+
// route's limit scope, the worker path (from the browser's body), the method,
|
|
273
|
+
// the body sent upstream (only fields the route names) and whether the answer
|
|
274
|
+
// tells the browser who it is. The browser gets the worker's own answer or a
|
|
275
|
+
// generic error.
|
|
276
|
+
async function relay(req, res, call) {
|
|
277
|
+
if (req.method !== 'POST') {
|
|
278
|
+
res.status(405).json({ error: 'Method not allowed' });
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (!(await allow(req, res, call.scope))) return;
|
|
282
|
+
const input = readBody(req);
|
|
283
|
+
try {
|
|
284
|
+
const identity = await resolveIdentity(req, res);
|
|
285
|
+
const path = call.path(input, identity);
|
|
286
|
+
if (!path) {
|
|
287
|
+
res.status(400).json({ error: 'channelName is required' });
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
const options = { method: call.method };
|
|
291
|
+
if (call.body) {
|
|
292
|
+
// The identity's fields as the old request shape names them, so a
|
|
293
|
+
// realtime worker not yet updated still acts for this identity; an
|
|
294
|
+
// updated one reads the identity header and ignores them.
|
|
295
|
+
options.body = JSON.stringify(Object.assign({}, call.body(input), {
|
|
296
|
+
userId: identity.id,
|
|
297
|
+
userName: identity.name,
|
|
298
|
+
senderId: identity.id,
|
|
299
|
+
senderName: identity.name,
|
|
300
|
+
}));
|
|
301
|
+
}
|
|
302
|
+
const response = await realtimeServerFetch(path, options, identity);
|
|
303
|
+
const data = await response.json();
|
|
304
|
+
if (call.withIdentity && response.ok && data && typeof data === 'object') {
|
|
305
|
+
data.identity = { id: identity.id, name: identity.name };
|
|
306
|
+
}
|
|
307
|
+
res.status(response.status).json(data);
|
|
308
|
+
} catch (error) {
|
|
309
|
+
__security.sendClientError(res, 502, 'Realtime is unavailable right now.', error);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
module.exports = {
|
|
314
|
+
realtimeServerFetch: realtimeServerFetch,
|
|
315
|
+
resolveIdentity: resolveIdentity,
|
|
316
|
+
relay: relay,
|
|
317
|
+
SITE_CHANNELS: SITE_CHANNELS,
|
|
318
|
+
};
|
|
16
319
|
`
|
|
17
320
|
}
|
|
18
321
|
|
|
@@ -21,11 +324,17 @@ export const generateRealtimeClientCode = (): string => {
|
|
|
21
324
|
|
|
22
325
|
let _ablyClient = null;
|
|
23
326
|
let _namespace = null;
|
|
327
|
+
// Who the server says this visitor is (its session, or an opaque id it
|
|
328
|
+
// issued). Set from every token and join answer; never chosen here.
|
|
329
|
+
let _identity = null;
|
|
24
330
|
let _userId = null;
|
|
25
331
|
let _userName = null;
|
|
26
332
|
let _channelRefCounts = {};
|
|
27
333
|
let _readyCallbacks = [];
|
|
28
334
|
let _isReady = false;
|
|
335
|
+
// A token a join answer brought, handed to Ably on its next authorize().
|
|
336
|
+
let _pendingTokenRequest = null;
|
|
337
|
+
let _authorizing = null;
|
|
29
338
|
|
|
30
339
|
function _notifyReady() {
|
|
31
340
|
_isReady = true;
|
|
@@ -35,24 +344,21 @@ function _notifyReady() {
|
|
|
35
344
|
}
|
|
36
345
|
|
|
37
346
|
function whenReady() {
|
|
38
|
-
|
|
39
|
-
|
|
347
|
+
const ready = _isReady && _namespace
|
|
348
|
+
? Promise.resolve()
|
|
349
|
+
: new Promise(function(resolve) { _readyCallbacks.push(resolve); });
|
|
350
|
+
return _authorizing ? Promise.all([ready, _authorizing]).then(function() {}) : ready;
|
|
40
351
|
}
|
|
41
352
|
|
|
42
|
-
function
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
if (
|
|
46
|
-
id = 'anon_' + (typeof crypto !== 'undefined' && crypto.randomUUID
|
|
47
|
-
? crypto.randomUUID()
|
|
48
|
-
: Math.random().toString(36).substr(2, 16));
|
|
49
|
-
sessionStorage.setItem('__realtime_anon_id', id);
|
|
50
|
-
}
|
|
51
|
-
return id;
|
|
353
|
+
function _absorb(data) {
|
|
354
|
+
if (!data) return;
|
|
355
|
+
if (data.namespace) _namespace = data.namespace;
|
|
356
|
+
if (data.identity && data.identity.id) _identity = data.identity;
|
|
52
357
|
}
|
|
53
358
|
|
|
54
|
-
function
|
|
55
|
-
function
|
|
359
|
+
function getIdentity() { return _identity; }
|
|
360
|
+
function getUserId() { return (_identity && _identity.id) || _userId || ''; }
|
|
361
|
+
function getUserName() { return (_identity && _identity.name) || _userName || 'Anonymous'; }
|
|
56
362
|
function setUser(userId, userName) { _userId = userId; _userName = userName; }
|
|
57
363
|
function getNamespace() { return _namespace; }
|
|
58
364
|
|
|
@@ -61,61 +367,62 @@ function getNamespacedChannelName(channelName) {
|
|
|
61
367
|
return _namespace + ':' + channelName;
|
|
62
368
|
}
|
|
63
369
|
|
|
64
|
-
function
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
}).catch(function(err) { callback(err, null); });
|
|
87
|
-
};
|
|
370
|
+
function _authCallback(tokenParams, callback) {
|
|
371
|
+
if (_pendingTokenRequest) {
|
|
372
|
+
const t = _pendingTokenRequest;
|
|
373
|
+
_pendingTokenRequest = null;
|
|
374
|
+
callback(null, t);
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
fetch('/api/realtime/token', {
|
|
378
|
+
method: 'POST',
|
|
379
|
+
headers: { 'Content-Type': 'application/json' },
|
|
380
|
+
body: '{}'
|
|
381
|
+
}).then(function(res) { return res.json(); })
|
|
382
|
+
.then(function(data) {
|
|
383
|
+
_absorb(data);
|
|
384
|
+
if (data.tokenRequest) {
|
|
385
|
+
if (!_isReady) _notifyReady();
|
|
386
|
+
callback(null, data.tokenRequest);
|
|
387
|
+
} else {
|
|
388
|
+
callback(new Error((data.error && data.error.message) || 'Token request failed'), null);
|
|
389
|
+
}
|
|
390
|
+
}).catch(function(err) { callback(err, null); });
|
|
88
391
|
}
|
|
89
392
|
|
|
90
|
-
function
|
|
91
|
-
|
|
92
|
-
if (typeof window === 'undefined') return null;
|
|
93
|
-
|
|
94
|
-
_ablyClient = new Ably.Realtime({ authCallback: _createAuthCallback(null) });
|
|
95
|
-
|
|
393
|
+
function _createClient() {
|
|
394
|
+
_ablyClient = new Ably.Realtime({ authCallback: _authCallback });
|
|
96
395
|
_ablyClient.connection.on('connected', function() {
|
|
97
396
|
if (_namespace && !_isReady) _notifyReady();
|
|
98
397
|
});
|
|
99
|
-
|
|
100
398
|
return _ablyClient;
|
|
101
399
|
}
|
|
102
400
|
|
|
401
|
+
function getAblyClient() {
|
|
402
|
+
if (_ablyClient) return _ablyClient;
|
|
403
|
+
if (typeof window === 'undefined') return null;
|
|
404
|
+
return _createClient();
|
|
405
|
+
}
|
|
406
|
+
|
|
103
407
|
function initializeClient(joinData) {
|
|
104
|
-
|
|
408
|
+
_absorb(joinData);
|
|
409
|
+
const tokenRequest = joinData && joinData.tokenRequest ? joinData.tokenRequest : null;
|
|
105
410
|
if (_ablyClient) {
|
|
411
|
+
if (tokenRequest) {
|
|
412
|
+
// The join widened the channels this connection may use: swap its token.
|
|
413
|
+
_pendingTokenRequest = tokenRequest;
|
|
414
|
+
const authorizing = Promise.resolve()
|
|
415
|
+
.then(function() { return _ablyClient.auth.authorize(); })
|
|
416
|
+
.catch(function() {})
|
|
417
|
+
.then(function() { if (_authorizing === authorizing) _authorizing = null; });
|
|
418
|
+
_authorizing = authorizing;
|
|
419
|
+
}
|
|
106
420
|
if (_namespace && !_isReady) _notifyReady();
|
|
107
421
|
return _ablyClient;
|
|
108
422
|
}
|
|
109
423
|
if (typeof window === 'undefined') return null;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
_ablyClient = new Ably.Realtime({ authCallback: _createAuthCallback(tokenRequest) });
|
|
113
|
-
|
|
114
|
-
_ablyClient.connection.on('connected', function() {
|
|
115
|
-
if (_namespace && !_isReady) _notifyReady();
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
return _ablyClient;
|
|
424
|
+
_pendingTokenRequest = tokenRequest;
|
|
425
|
+
return _createClient();
|
|
119
426
|
}
|
|
120
427
|
|
|
121
428
|
function closeClient() {
|
|
@@ -124,9 +431,12 @@ function closeClient() {
|
|
|
124
431
|
_ablyClient = null;
|
|
125
432
|
}
|
|
126
433
|
_namespace = null;
|
|
434
|
+
_identity = null;
|
|
127
435
|
_channelRefCounts = {};
|
|
128
436
|
_isReady = false;
|
|
129
437
|
_readyCallbacks = [];
|
|
438
|
+
_pendingTokenRequest = null;
|
|
439
|
+
_authorizing = null;
|
|
130
440
|
}
|
|
131
441
|
|
|
132
442
|
function incrementChannelRef(channelName) {
|
|
@@ -151,6 +461,7 @@ const _exports = {
|
|
|
151
461
|
whenReady: whenReady,
|
|
152
462
|
getNamespace: getNamespace,
|
|
153
463
|
getNamespacedChannelName: getNamespacedChannelName,
|
|
464
|
+
getIdentity: getIdentity,
|
|
154
465
|
getUserId: getUserId,
|
|
155
466
|
getUserName: getUserName,
|
|
156
467
|
setUser: setUser,
|
|
@@ -170,177 +481,89 @@ module.exports = _exports;
|
|
|
170
481
|
`
|
|
171
482
|
}
|
|
172
483
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
module.exports = async function handler(req, res) {
|
|
177
|
-
if (req.method !== 'POST') {
|
|
178
|
-
res.status(405).json({ error: 'Method not allowed' });
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
try {
|
|
182
|
-
const body = typeof req.body === 'string' ? JSON.parse(req.body) : req.body;
|
|
183
|
-
const response = await realtimeServer.realtimeServerFetch('/auth/token', {
|
|
184
|
-
method: 'POST',
|
|
185
|
-
body: JSON.stringify({ userId: body.userId })
|
|
186
|
-
});
|
|
187
|
-
const data = await response.json();
|
|
188
|
-
res.status(response.status).json(data);
|
|
189
|
-
} catch (error) {
|
|
190
|
-
console.error('Realtime token error:', error);
|
|
191
|
-
res.status(500).json({ error: 'Failed to get realtime token' });
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
`
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
export const generateRealtimeJoinRoute = (): string => {
|
|
198
|
-
return `const realtimeServer = require('../../../utils/realtime/server');
|
|
199
|
-
|
|
200
|
-
module.exports = async function handler(req, res) {
|
|
201
|
-
if (req.method !== 'POST') {
|
|
202
|
-
res.status(405).json({ error: 'Method not allowed' });
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
try {
|
|
206
|
-
const body = typeof req.body === 'string' ? JSON.parse(req.body) : req.body;
|
|
207
|
-
const response = await realtimeServer.realtimeServerFetch('/channels/join', {
|
|
208
|
-
method: 'POST',
|
|
209
|
-
body: JSON.stringify(body)
|
|
210
|
-
});
|
|
211
|
-
const data = await response.json();
|
|
212
|
-
res.status(response.status).json(data);
|
|
213
|
-
} catch (error) {
|
|
214
|
-
console.error('Realtime join error:', error);
|
|
215
|
-
res.status(500).json({ error: 'Failed to join channel' });
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
`
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export const generateRealtimeLeaveRoute = (): string => {
|
|
222
|
-
return `const realtimeServer = require('../../../utils/realtime/server');
|
|
484
|
+
const relayRoute = (depth: string, call: string): string =>
|
|
485
|
+
`const realtimeServer = require('${depth}/utils/realtime/server');
|
|
223
486
|
|
|
487
|
+
// See realtime-generator.ts: the identity is the server's, never the body's.
|
|
224
488
|
module.exports = async function handler(req, res) {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
try {
|
|
230
|
-
const body = typeof req.body === 'string' ? JSON.parse(req.body) : req.body;
|
|
231
|
-
const response = await realtimeServer.realtimeServerFetch('/channels/leave', {
|
|
232
|
-
method: 'POST',
|
|
233
|
-
body: JSON.stringify(body)
|
|
234
|
-
});
|
|
235
|
-
const data = await response.json();
|
|
236
|
-
res.status(response.status).json(data);
|
|
237
|
-
} catch (error) {
|
|
238
|
-
console.error('Realtime leave error:', error);
|
|
239
|
-
res.status(500).json({ error: 'Failed to leave channel' });
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
`
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
export const generateRealtimeMessageRoute = (): string => {
|
|
246
|
-
return `const realtimeServer = require('../../../utils/realtime/server');
|
|
247
|
-
|
|
248
|
-
module.exports = async function handler(req, res) {
|
|
249
|
-
if (req.method !== 'POST') {
|
|
250
|
-
res.status(405).json({ error: 'Method not allowed' });
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
try {
|
|
254
|
-
const body = typeof req.body === 'string' ? JSON.parse(req.body) : req.body;
|
|
255
|
-
const response = await realtimeServer.realtimeServerFetch('/channels/message', {
|
|
256
|
-
method: 'POST',
|
|
257
|
-
body: JSON.stringify(body)
|
|
258
|
-
});
|
|
259
|
-
const data = await response.json();
|
|
260
|
-
res.status(response.status).json(data);
|
|
261
|
-
} catch (error) {
|
|
262
|
-
console.error('Realtime message error:', error);
|
|
263
|
-
res.status(500).json({ error: 'Failed to send message' });
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
`
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
export const generateRealtimeEventRoute = (): string => {
|
|
270
|
-
return `const realtimeServer = require('../../../utils/realtime/server');
|
|
271
|
-
|
|
272
|
-
module.exports = async function handler(req, res) {
|
|
273
|
-
if (req.method !== 'POST') {
|
|
274
|
-
res.status(405).json({ error: 'Method not allowed' });
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
try {
|
|
278
|
-
const body = typeof req.body === 'string' ? JSON.parse(req.body) : req.body;
|
|
279
|
-
const response = await realtimeServer.realtimeServerFetch('/channels/event', {
|
|
280
|
-
method: 'POST',
|
|
281
|
-
body: JSON.stringify(body)
|
|
282
|
-
});
|
|
283
|
-
const data = await response.json();
|
|
284
|
-
res.status(response.status).json(data);
|
|
285
|
-
} catch (error) {
|
|
286
|
-
console.error('Realtime event error:', error);
|
|
287
|
-
res.status(500).json({ error: 'Failed to send event' });
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
`
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
export const generateRealtimeChannelsListRoute = (): string => {
|
|
294
|
-
return `const realtimeServer = require('../../../../utils/realtime/server');
|
|
295
|
-
|
|
296
|
-
module.exports = async function handler(req, res) {
|
|
297
|
-
if (req.method !== 'POST') {
|
|
298
|
-
res.status(405).json({ error: 'Method not allowed' });
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
try {
|
|
302
|
-
const body = typeof req.body === 'string' ? JSON.parse(req.body) : req.body;
|
|
303
|
-
let query = '';
|
|
304
|
-
if (body.filterByUser) query += 'filterByUser=true';
|
|
305
|
-
if (body.userId) query += (query ? '&' : '') + 'userId=' + encodeURIComponent(body.userId);
|
|
306
|
-
const response = await realtimeServer.realtimeServerFetch('/channels' + (query ? '?' + query : ''), {
|
|
307
|
-
method: 'GET'
|
|
308
|
-
});
|
|
309
|
-
const data = await response.json();
|
|
310
|
-
res.status(response.status).json(data);
|
|
311
|
-
} catch (error) {
|
|
312
|
-
console.error('Realtime list channels error:', error);
|
|
313
|
-
res.status(500).json({ error: 'Failed to list channels' });
|
|
314
|
-
}
|
|
489
|
+
await realtimeServer.relay(req, res, {
|
|
490
|
+
${call}
|
|
491
|
+
});
|
|
315
492
|
};
|
|
316
493
|
`
|
|
317
|
-
}
|
|
318
494
|
|
|
319
|
-
export const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
return;
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
`
|
|
346
|
-
|
|
495
|
+
export const generateRealtimeTokenRoute = (): string =>
|
|
496
|
+
relayRoute(
|
|
497
|
+
'../../..',
|
|
498
|
+
` scope: 'realtime-token',
|
|
499
|
+
method: 'POST',
|
|
500
|
+
path: function() { return '/auth/token'; },
|
|
501
|
+
body: function() { return { channels: realtimeServer.SITE_CHANNELS }; },
|
|
502
|
+
withIdentity: true,`
|
|
503
|
+
)
|
|
504
|
+
|
|
505
|
+
export const generateRealtimeJoinRoute = (): string =>
|
|
506
|
+
relayRoute(
|
|
507
|
+
'../../..',
|
|
508
|
+
` scope: 'realtime-join',
|
|
509
|
+
method: 'POST',
|
|
510
|
+
path: function() { return '/channels/join'; },
|
|
511
|
+
// The answer's token replaces the connection's, so it covers the site's channels too.
|
|
512
|
+
body: function(input) {
|
|
513
|
+
return { channelName: input.channelName, userData: input.userData, channels: realtimeServer.SITE_CHANNELS };
|
|
514
|
+
},
|
|
515
|
+
withIdentity: true,`
|
|
516
|
+
)
|
|
517
|
+
|
|
518
|
+
export const generateRealtimeLeaveRoute = (): string =>
|
|
519
|
+
relayRoute(
|
|
520
|
+
'../../..',
|
|
521
|
+
` scope: 'realtime-leave',
|
|
522
|
+
method: 'POST',
|
|
523
|
+
path: function() { return '/channels/leave'; },
|
|
524
|
+
body: function(input) { return { channelName: input.channelName }; },`
|
|
525
|
+
)
|
|
526
|
+
|
|
527
|
+
export const generateRealtimeMessageRoute = (): string =>
|
|
528
|
+
relayRoute(
|
|
529
|
+
'../../..',
|
|
530
|
+
` scope: 'realtime-message',
|
|
531
|
+
method: 'POST',
|
|
532
|
+
path: function() { return '/channels/message'; },
|
|
533
|
+
body: function(input) {
|
|
534
|
+
return { channelName: input.channelName, message: input.message, messageData: input.messageData };
|
|
535
|
+
},`
|
|
536
|
+
)
|
|
537
|
+
|
|
538
|
+
export const generateRealtimeEventRoute = (): string =>
|
|
539
|
+
relayRoute(
|
|
540
|
+
'../../..',
|
|
541
|
+
` scope: 'realtime-event',
|
|
542
|
+
method: 'POST',
|
|
543
|
+
path: function() { return '/channels/event'; },
|
|
544
|
+
body: function(input) {
|
|
545
|
+
return { channelName: input.channelName, eventName: input.eventName, eventData: input.eventData };
|
|
546
|
+
},`
|
|
547
|
+
)
|
|
548
|
+
|
|
549
|
+
export const generateRealtimeChannelsListRoute = (): string =>
|
|
550
|
+
relayRoute(
|
|
551
|
+
'../../../..',
|
|
552
|
+
` scope: 'realtime-channels-list',
|
|
553
|
+
method: 'GET',
|
|
554
|
+
path: function(input, identity) {
|
|
555
|
+
return '/channels' + (input.filterByUser ? '?filterByUser=true&userId=' + encodeURIComponent(identity.id) : '');
|
|
556
|
+
},`
|
|
557
|
+
)
|
|
558
|
+
|
|
559
|
+
export const generateRealtimeChannelsMembersRoute = (): string =>
|
|
560
|
+
relayRoute(
|
|
561
|
+
'../../../..',
|
|
562
|
+
` scope: 'realtime-channels-members',
|
|
563
|
+
method: 'GET',
|
|
564
|
+
path: function(input) {
|
|
565
|
+
return typeof input.channelName === 'string' && input.channelName
|
|
566
|
+
? '/channels/' + encodeURIComponent(input.channelName) + '/members'
|
|
567
|
+
: null;
|
|
568
|
+
},`
|
|
569
|
+
)
|