@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
|
@@ -0,0 +1,960 @@
|
|
|
1
|
+
/* tslint:disable:max-classes-per-file */
|
|
2
|
+
import * as nodeCrypto from 'crypto'
|
|
3
|
+
import * as net from 'net'
|
|
4
|
+
import type { UIDLAuthentication } from '@teleporthq/teleport-types'
|
|
5
|
+
import {
|
|
6
|
+
generateAuthDbHealthFile,
|
|
7
|
+
generateAuthOptionsFile,
|
|
8
|
+
generateHashPasswordFile,
|
|
9
|
+
generateSignupRouteFile,
|
|
10
|
+
SignupRouteOptions,
|
|
11
|
+
WelcomeEmailOptions,
|
|
12
|
+
} from '../src/auth-generator'
|
|
13
|
+
import { generateResetPasswordRoute } from '../src/password-reset-route-generator'
|
|
14
|
+
import { generateSessionRevocationFile } from '../src/session-revocation-generator'
|
|
15
|
+
import { generateSecurityRuntimeCode } from '../src/security-runtime/security-runtime-code'
|
|
16
|
+
import { EXISTING_ACCOUNT_EMAIL, SET_PASSWORD_EMAIL } from '../src/transactional-email-code'
|
|
17
|
+
import { accountLogin } from '../src/nodes/account/account-login'
|
|
18
|
+
import { accountSignup } from '../src/nodes/account/account-signup'
|
|
19
|
+
import { NextWorkflowProjectPlugin } from '../src/workflow-project-plugin'
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Newsletter Phase 0 (Task 0a): sign-up for people the site already knows
|
|
23
|
+
* without a password, and consent as the person gave it.
|
|
24
|
+
*
|
|
25
|
+
* A newsletter subscriber, a checkout or booking guest and a contact the owner
|
|
26
|
+
* added are `users` rows with no password. Signing up with such an address was
|
|
27
|
+
* answered "You already have an account" — wrong, they never had one. It must
|
|
28
|
+
* still never hand the row to whoever typed the address: the mailbox owner is
|
|
29
|
+
* sent a link to set a password (a password-reset link) instead. The page is
|
|
30
|
+
* answered exactly as for an account, so it never tells a subscriber or a
|
|
31
|
+
* guest from one, and the address is found in any letter case. Every new
|
|
32
|
+
* account gets `source = 'signup'` and `marketing_consent` from the box,
|
|
33
|
+
* never the column's TRUE default.
|
|
34
|
+
*
|
|
35
|
+
* The generated modules run against a fake Postgres that answers only the
|
|
36
|
+
* statements below, with the real security runtime (in-memory limits).
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
type Row = Record<string, any>
|
|
40
|
+
|
|
41
|
+
const sha256 = (value: string) => nodeCrypto.createHash('sha256').update(value).digest('hex')
|
|
42
|
+
|
|
43
|
+
// bcryptjs is not installed in the generator repo: a stand-in with its two calls.
|
|
44
|
+
const fakeBcrypt = {
|
|
45
|
+
hashSync: (value: string) => 'bcrypt:' + sha256(value),
|
|
46
|
+
compareSync: (value: string, hash: string) => hash === 'bcrypt:' + sha256(value),
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface Reset {
|
|
50
|
+
token_hash: string
|
|
51
|
+
user_id: string
|
|
52
|
+
expires_at: number
|
|
53
|
+
used_at: number | null
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
class FakePostgres {
|
|
57
|
+
users: Row[] = []
|
|
58
|
+
resets: Reset[] = []
|
|
59
|
+
/** Columns this users table lacks: one made before they existed. */
|
|
60
|
+
missingColumns: string[] = []
|
|
61
|
+
/** Column defaults, for the columns an INSERT leaves out. */
|
|
62
|
+
defaults: Row = {}
|
|
63
|
+
now = Date.UTC(2026, 9, 26, 12)
|
|
64
|
+
|
|
65
|
+
query(sql: string, values: any[] = []): { rows: Row[] } {
|
|
66
|
+
if (
|
|
67
|
+
/^(BEGIN|COMMIT|ROLLBACK)$/.test(sql) ||
|
|
68
|
+
sql.startsWith('SELECT pg_advisory_xact_lock') ||
|
|
69
|
+
sql.startsWith('CREATE TABLE IF NOT EXISTS teleport_password_resets') ||
|
|
70
|
+
sql.startsWith('CREATE INDEX IF NOT EXISTS teleport_password_resets') ||
|
|
71
|
+
sql.startsWith('DELETE FROM teleport_password_resets WHERE expires_at <')
|
|
72
|
+
) {
|
|
73
|
+
return { rows: [] }
|
|
74
|
+
}
|
|
75
|
+
if (sql === 'SELECT * FROM users WHERE email = $1 LIMIT 1') {
|
|
76
|
+
return { rows: this.users.filter((u) => u.email === values[0]).map((u) => ({ ...u })) }
|
|
77
|
+
}
|
|
78
|
+
if (sql === 'SELECT * FROM users WHERE LOWER(email) = LOWER($1) LIMIT 2') {
|
|
79
|
+
const folded = String(values[0]).toLowerCase()
|
|
80
|
+
return {
|
|
81
|
+
rows: this.users
|
|
82
|
+
.filter((u) => String(u.email).toLowerCase() === folded)
|
|
83
|
+
.slice(0, 2)
|
|
84
|
+
.map((u) => ({ ...u })),
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (sql.startsWith('INSERT INTO users (')) {
|
|
88
|
+
const columns = /INSERT INTO users \(([^)]*)\)/.exec(sql)![1].split(', ')
|
|
89
|
+
const missing = columns.find((column) => this.missingColumns.includes(column))
|
|
90
|
+
if (missing) {
|
|
91
|
+
throw Object.assign(new Error(`column "${missing}" of relation "users" does not exist`), {
|
|
92
|
+
code: '42703',
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
const row: Row = { id: 'u' + (this.users.length + 1), ...this.defaults }
|
|
96
|
+
columns.forEach((column, index) => {
|
|
97
|
+
row[column] = values[index]
|
|
98
|
+
})
|
|
99
|
+
this.users.push(row)
|
|
100
|
+
return { rows: [{ ...row }] }
|
|
101
|
+
}
|
|
102
|
+
if (sql.startsWith('UPDATE teleport_password_resets SET used_at = NOW() WHERE user_id = $1')) {
|
|
103
|
+
for (const reset of this.resets) {
|
|
104
|
+
if (reset.user_id === values[0] && reset.used_at === null) {
|
|
105
|
+
reset.used_at = this.now
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return { rows: [] }
|
|
109
|
+
}
|
|
110
|
+
if (sql.startsWith('INSERT INTO teleport_password_resets (token_hash, user_id, expires_at)')) {
|
|
111
|
+
this.resets.push({
|
|
112
|
+
token_hash: values[0],
|
|
113
|
+
user_id: values[1],
|
|
114
|
+
expires_at: this.now + Number(values[2]) * 1000,
|
|
115
|
+
used_at: null,
|
|
116
|
+
})
|
|
117
|
+
return { rows: [] }
|
|
118
|
+
}
|
|
119
|
+
if (sql.startsWith('WITH consumed AS ( UPDATE teleport_password_resets SET used_at = NOW()')) {
|
|
120
|
+
const reset = this.resets.find(
|
|
121
|
+
(r) => r.token_hash === values[0] && r.used_at === null && r.expires_at > this.now
|
|
122
|
+
)
|
|
123
|
+
const user = reset && this.users.find((u) => String(u.id) === reset.user_id)
|
|
124
|
+
if (!reset || !user) {
|
|
125
|
+
return { rows: [] }
|
|
126
|
+
}
|
|
127
|
+
reset.used_at = this.now
|
|
128
|
+
user.password = values[1]
|
|
129
|
+
return { rows: [{ id: user.id, email: user.email }] }
|
|
130
|
+
}
|
|
131
|
+
throw new Error('unexpected SQL: ' + sql)
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const pgFor = (db: FakePostgres) => ({
|
|
136
|
+
Client: class {
|
|
137
|
+
public async connect() {
|
|
138
|
+
return undefined
|
|
139
|
+
}
|
|
140
|
+
public async end() {
|
|
141
|
+
return undefined
|
|
142
|
+
}
|
|
143
|
+
public on() {
|
|
144
|
+
return undefined
|
|
145
|
+
}
|
|
146
|
+
public async query(sql: string, values?: any[]) {
|
|
147
|
+
return db.query(sql, values)
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
const AUTH = {
|
|
153
|
+
enabled: true,
|
|
154
|
+
dataSourceId: 'ds-1',
|
|
155
|
+
dataSourceType: 'postgresql',
|
|
156
|
+
passwordAuthEnabled: true,
|
|
157
|
+
providers: [],
|
|
158
|
+
roles: ['user', 'admin'],
|
|
159
|
+
tables: {},
|
|
160
|
+
pageProtection: {},
|
|
161
|
+
folderProtection: {},
|
|
162
|
+
authPages: {},
|
|
163
|
+
callbackBaseUrl: '/api/auth/callback',
|
|
164
|
+
envKeys: {},
|
|
165
|
+
customUserProperties: [],
|
|
166
|
+
} as UIDLAuthentication
|
|
167
|
+
|
|
168
|
+
const ENV = {
|
|
169
|
+
NEXTAUTH_SECRET: 'app-secret',
|
|
170
|
+
DB_CONNECTION_STRING: 'postgres://fake',
|
|
171
|
+
AUTH_PEPPER: 'project-id-1',
|
|
172
|
+
AUTH_PEPPER_SECRET: 'per-project-random-pepper',
|
|
173
|
+
NEXTAUTH_URL: 'https://shop.example',
|
|
174
|
+
RESEND_KEY: 're_test_key',
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const WELCOME: WelcomeEmailOptions = {
|
|
178
|
+
emailProvider: 'resend',
|
|
179
|
+
fromEmail: 'shop@brand.test',
|
|
180
|
+
emailSecretEnvName: 'RESEND_KEY',
|
|
181
|
+
emailSubject: 'Welcome',
|
|
182
|
+
emailBodyHtml: '<p>Welcome {{userName}}</p>',
|
|
183
|
+
siteName: 'Shop',
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
interface FakeResponse {
|
|
187
|
+
statusCode: number
|
|
188
|
+
body: any
|
|
189
|
+
status: (code: number) => FakeResponse
|
|
190
|
+
json: (body: unknown) => FakeResponse
|
|
191
|
+
setHeader: () => void
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const fakeResponse = (): FakeResponse => {
|
|
195
|
+
const res: FakeResponse = {
|
|
196
|
+
statusCode: 0,
|
|
197
|
+
body: undefined,
|
|
198
|
+
status: (code) => {
|
|
199
|
+
res.statusCode = code
|
|
200
|
+
return res
|
|
201
|
+
},
|
|
202
|
+
json: (body) => {
|
|
203
|
+
res.body = body
|
|
204
|
+
return res
|
|
205
|
+
},
|
|
206
|
+
setHeader: () => undefined,
|
|
207
|
+
}
|
|
208
|
+
return res
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const request = (body: Row, ip = '203.0.113.7') => ({
|
|
212
|
+
method: 'POST',
|
|
213
|
+
headers: { host: 'shop.example' },
|
|
214
|
+
socket: { remoteAddress: ip },
|
|
215
|
+
body,
|
|
216
|
+
query: {},
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
/** One app instance: the generated modules, required from each other as the files are. */
|
|
220
|
+
const loadApp = (
|
|
221
|
+
options: {
|
|
222
|
+
db?: FakePostgres
|
|
223
|
+
welcome?: WelcomeEmailOptions
|
|
224
|
+
signup?: SignupRouteOptions
|
|
225
|
+
env?: Record<string, string>
|
|
226
|
+
} = {}
|
|
227
|
+
) => {
|
|
228
|
+
const db = options.db || new FakePostgres()
|
|
229
|
+
const env = options.env || ENV
|
|
230
|
+
const sent: Row[] = []
|
|
231
|
+
const ledger: Row[] = []
|
|
232
|
+
const delays: number[] = []
|
|
233
|
+
const logs: unknown[][] = []
|
|
234
|
+
// What bcrypt is asked to do: the cost of each hash it makes, and how many compares.
|
|
235
|
+
const bcryptWork = { hashCosts: [] as number[], compares: 0 }
|
|
236
|
+
const countingBcrypt = {
|
|
237
|
+
hashSync: (value: string, cost: number) => {
|
|
238
|
+
bcryptWork.hashCosts.push(cost)
|
|
239
|
+
return fakeBcrypt.hashSync(value)
|
|
240
|
+
},
|
|
241
|
+
compareSync: (value: string, hash: string) => {
|
|
242
|
+
bcryptWork.compares++
|
|
243
|
+
return fakeBcrypt.compareSync(value, hash)
|
|
244
|
+
},
|
|
245
|
+
}
|
|
246
|
+
const quiet = {
|
|
247
|
+
error: (...args: unknown[]) => logs.push(args),
|
|
248
|
+
warn: (...args: unknown[]) => logs.push(args),
|
|
249
|
+
log: () => undefined,
|
|
250
|
+
info: () => undefined,
|
|
251
|
+
}
|
|
252
|
+
const sources: Record<string, string> = {
|
|
253
|
+
runtime: generateSecurityRuntimeCode(),
|
|
254
|
+
hash: generateHashPasswordFile(),
|
|
255
|
+
health: generateAuthDbHealthFile(),
|
|
256
|
+
revocation: generateSessionRevocationFile(),
|
|
257
|
+
options: generateAuthOptionsFile(AUTH, null),
|
|
258
|
+
signup: generateSignupRouteFile(
|
|
259
|
+
AUTH,
|
|
260
|
+
options.welcome === undefined ? WELCOME : options.welcome,
|
|
261
|
+
{},
|
|
262
|
+
{ fields: ['image'], ...(options.signup || {}) }
|
|
263
|
+
),
|
|
264
|
+
reset: generateResetPasswordRoute(),
|
|
265
|
+
}
|
|
266
|
+
const external: Record<string, unknown> = {
|
|
267
|
+
crypto: nodeCrypto,
|
|
268
|
+
net,
|
|
269
|
+
pg: pgFor(db),
|
|
270
|
+
bcryptjs: countingBcrypt,
|
|
271
|
+
'next-auth/providers/credentials': (config: unknown) => config,
|
|
272
|
+
resend: {
|
|
273
|
+
Resend: class {
|
|
274
|
+
public emails = {
|
|
275
|
+
send: async (msg: Row) => {
|
|
276
|
+
sent.push(msg)
|
|
277
|
+
return {}
|
|
278
|
+
},
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
'../../../utils/email/email-locale': {
|
|
283
|
+
resolveRequestLocale: () => '',
|
|
284
|
+
pickLocalizedTemplate: (base: Row) => base,
|
|
285
|
+
},
|
|
286
|
+
'../../../utils/email/sent-email-log': {
|
|
287
|
+
recordSentEmail: (entry: Row) => ledger.push(entry),
|
|
288
|
+
settleSentEmailLog: async () => undefined,
|
|
289
|
+
},
|
|
290
|
+
}
|
|
291
|
+
const files: Record<string, string> = {
|
|
292
|
+
'../security-runtime': 'runtime',
|
|
293
|
+
'../../../utils/security-runtime': 'runtime',
|
|
294
|
+
'./hash-password': 'hash',
|
|
295
|
+
'../../../utils/auth/hash-password': 'hash',
|
|
296
|
+
'./db-health': 'health',
|
|
297
|
+
'./session-revocation': 'revocation',
|
|
298
|
+
'./auth-options': 'options',
|
|
299
|
+
'../../../utils/auth/auth-options': 'options',
|
|
300
|
+
}
|
|
301
|
+
const cache: Record<string, { exports: any }> = {}
|
|
302
|
+
const load = (name: string): any => {
|
|
303
|
+
if (cache[name]) {
|
|
304
|
+
return cache[name].exports
|
|
305
|
+
}
|
|
306
|
+
const module = { exports: {} as any }
|
|
307
|
+
cache[name] = module
|
|
308
|
+
const req = (id: string): unknown => {
|
|
309
|
+
if (Object.prototype.hasOwnProperty.call(files, id)) {
|
|
310
|
+
return load(files[id])
|
|
311
|
+
}
|
|
312
|
+
if (Object.prototype.hasOwnProperty.call(external, id)) {
|
|
313
|
+
return external[id]
|
|
314
|
+
}
|
|
315
|
+
throw new Error(name + ' required an unexpected module: ' + id)
|
|
316
|
+
}
|
|
317
|
+
const setTimeoutShim = (fn: () => void, ms: number) => {
|
|
318
|
+
delays.push(ms)
|
|
319
|
+
fn()
|
|
320
|
+
return 0
|
|
321
|
+
}
|
|
322
|
+
// eslint-disable-next-line no-new-func
|
|
323
|
+
new Function(
|
|
324
|
+
'module',
|
|
325
|
+
'exports',
|
|
326
|
+
'require',
|
|
327
|
+
'process',
|
|
328
|
+
'console',
|
|
329
|
+
'Buffer',
|
|
330
|
+
'setTimeout',
|
|
331
|
+
sources[name]
|
|
332
|
+
)(module, module.exports, req, { env: { ...env } }, quiet, Buffer, setTimeoutShim)
|
|
333
|
+
return module.exports
|
|
334
|
+
}
|
|
335
|
+
const signUp = async (body: Row, ip?: string) => {
|
|
336
|
+
const res = fakeResponse()
|
|
337
|
+
await load('signup')(request(body, ip), res)
|
|
338
|
+
return res
|
|
339
|
+
}
|
|
340
|
+
/** The credentials sign-in (NextAuth's authorize): its error code, or 'ok'. */
|
|
341
|
+
const signIn = async (email: string, password: string): Promise<string> => {
|
|
342
|
+
const req = request({ email, password })
|
|
343
|
+
try {
|
|
344
|
+
await load('options').providers[0].authorize({ email, password }, req)
|
|
345
|
+
return 'ok'
|
|
346
|
+
} catch (err) {
|
|
347
|
+
return (err as Error).message
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return { db, sent, ledger, delays, logs, load, signUp, signIn, sources, bcryptWork }
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
const SUBSCRIBER = {
|
|
354
|
+
id: 'u-sub',
|
|
355
|
+
email: 'sub@site.test',
|
|
356
|
+
name: null,
|
|
357
|
+
password: null,
|
|
358
|
+
provider: null,
|
|
359
|
+
role: 'user',
|
|
360
|
+
source: 'newsletter',
|
|
361
|
+
marketing_consent: true,
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
const withSubscriber = (row: Row = SUBSCRIBER) => {
|
|
365
|
+
const db = new FakePostgres()
|
|
366
|
+
db.users.push({ ...row })
|
|
367
|
+
return db
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
const linkIn = (mail: Row | undefined): string => {
|
|
371
|
+
const match = /href="([^"]+)"/.exec(String(mail && mail.html))
|
|
372
|
+
return match ? match[1] : ''
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
describe('the generated sign-up route', () => {
|
|
376
|
+
const auth = AUTH
|
|
377
|
+
const welcome = WELCOME
|
|
378
|
+
const events = {}
|
|
379
|
+
const signup: SignupRouteOptions = { fields: ['image'] }
|
|
380
|
+
|
|
381
|
+
it('signup writes source=signup and explicit consent from the checkbox', () => {
|
|
382
|
+
const src = generateSignupRouteFile(auth, welcome, events, signup)
|
|
383
|
+
expect(src).toContain(`source: 'signup'`)
|
|
384
|
+
expect(src).toContain(`marketing_consent: body.marketing_consent === 'true'`)
|
|
385
|
+
})
|
|
386
|
+
|
|
387
|
+
it('signup on a password-less row sends the set-password email, never claims the row', () => {
|
|
388
|
+
const src = generateSignupRouteFile(auth, welcome, events, signup)
|
|
389
|
+
expect(src).toContain('sendSetPasswordEmail(')
|
|
390
|
+
expect(src).not.toContain('UPDATE users SET password')
|
|
391
|
+
})
|
|
392
|
+
|
|
393
|
+
it('writes no newsletter state: a ticked box subscribes through the newsletter helper', () => {
|
|
394
|
+
expect(generateSignupRouteFile(auth, welcome, events, signup)).not.toContain('newsletter_')
|
|
395
|
+
})
|
|
396
|
+
|
|
397
|
+
it('answers every address the site already knows alike, with no flag', () => {
|
|
398
|
+
const src = generateSignupRouteFile(auth, welcome, events, signup)
|
|
399
|
+
expect(src).not.toContain('setPassword')
|
|
400
|
+
expect(src).toContain('const existing = await findSignupUserByEmail(email);')
|
|
401
|
+
})
|
|
402
|
+
})
|
|
403
|
+
|
|
404
|
+
describe('sign-up writes where the person came from, and their consent as given', () => {
|
|
405
|
+
it('an unticked box, or a form without one, is an explicit no', async () => {
|
|
406
|
+
const app = loadApp()
|
|
407
|
+
expect((await app.signUp({ email: 'a@site.test', password: 'Passw0rd!' })).statusCode).toBe(201)
|
|
408
|
+
expect(
|
|
409
|
+
(
|
|
410
|
+
await app.signUp({
|
|
411
|
+
email: 'b@site.test',
|
|
412
|
+
password: 'Passw0rd!',
|
|
413
|
+
marketing_consent: 'false',
|
|
414
|
+
})
|
|
415
|
+
).statusCode
|
|
416
|
+
).toBe(201)
|
|
417
|
+
for (const row of app.db.users) {
|
|
418
|
+
expect(row).toMatchObject({ source: 'signup', marketing_consent: false, role: 'user' })
|
|
419
|
+
expect(row).not.toHaveProperty('newsletter_status')
|
|
420
|
+
}
|
|
421
|
+
})
|
|
422
|
+
|
|
423
|
+
it('a ticked box is consent', async () => {
|
|
424
|
+
const app = loadApp()
|
|
425
|
+
await app.signUp({ email: 'a@site.test', password: 'Passw0rd!', marketing_consent: 'true' })
|
|
426
|
+
expect(app.db.users[0]).toMatchObject({ source: 'signup', marketing_consent: true })
|
|
427
|
+
expect(app.db.users[0]).not.toHaveProperty('newsletter_status')
|
|
428
|
+
})
|
|
429
|
+
|
|
430
|
+
it('takes neither raw from the body, even as declared fields', async () => {
|
|
431
|
+
const app = loadApp({ signup: { fields: ['image', 'source', 'marketing_consent'] } })
|
|
432
|
+
await app.signUp({
|
|
433
|
+
email: 'a@site.test',
|
|
434
|
+
password: 'Passw0rd!',
|
|
435
|
+
source: 'import',
|
|
436
|
+
marketing_consent: 'yes',
|
|
437
|
+
})
|
|
438
|
+
expect(app.db.users[0]).toMatchObject({ source: 'signup', marketing_consent: false })
|
|
439
|
+
})
|
|
440
|
+
|
|
441
|
+
it('still signs the person up on a users table made before these columns', async () => {
|
|
442
|
+
const db = new FakePostgres()
|
|
443
|
+
db.missingColumns = ['source', 'marketing_consent']
|
|
444
|
+
const app = loadApp({ db })
|
|
445
|
+
const res = await app.signUp({ email: 'old@site.test', password: 'Passw0rd!' })
|
|
446
|
+
expect(res.statusCode).toBe(201)
|
|
447
|
+
expect(app.db.users).toHaveLength(1)
|
|
448
|
+
expect(app.db.users[0]).toMatchObject({ email: 'old@site.test', role: 'user' })
|
|
449
|
+
expect(app.db.users[0]).not.toHaveProperty('source')
|
|
450
|
+
expect(JSON.stringify(app.logs)).toContain('the account is created without it')
|
|
451
|
+
})
|
|
452
|
+
|
|
453
|
+
it('leaves out only the column the table lacks: a consent column defaulting to TRUE still gets the no', async () => {
|
|
454
|
+
const db = new FakePostgres()
|
|
455
|
+
db.missingColumns = ['source']
|
|
456
|
+
db.defaults = { marketing_consent: true }
|
|
457
|
+
const app = loadApp({ db })
|
|
458
|
+
const res = await app.signUp({ email: 'old@site.test', password: 'Passw0rd!' })
|
|
459
|
+
expect(res.statusCode).toBe(201)
|
|
460
|
+
expect(app.db.users).toHaveLength(1)
|
|
461
|
+
expect(app.db.users[0]).toMatchObject({ email: 'old@site.test', marketing_consent: false })
|
|
462
|
+
expect(app.db.users[0]).not.toHaveProperty('source')
|
|
463
|
+
expect(JSON.stringify(app.logs)).toContain('the users table has no source column yet')
|
|
464
|
+
})
|
|
465
|
+
})
|
|
466
|
+
|
|
467
|
+
describe('sign-up on an address the site knows without a password', () => {
|
|
468
|
+
it('mails its owner a link to set a password, and never takes the row', async () => {
|
|
469
|
+
const app = loadApp({ db: withSubscriber() })
|
|
470
|
+
const res = await app.signUp({ email: SUBSCRIBER.email, password: 'Passw0rd!', name: 'Eve' })
|
|
471
|
+
|
|
472
|
+
expect(res.statusCode).toBe(201)
|
|
473
|
+
expect(res.body).toEqual({ user: { email: SUBSCRIBER.email, name: 'Eve' } })
|
|
474
|
+
// The row is as it was: no password, no name, nothing the visitor typed.
|
|
475
|
+
expect(app.db.users).toEqual([SUBSCRIBER])
|
|
476
|
+
|
|
477
|
+
const mails = app.sent
|
|
478
|
+
expect(mails.map((mail) => mail.to)).toEqual([[SUBSCRIBER.email]])
|
|
479
|
+
expect(mails[0].subject).toBe('Set your password to finish creating your account')
|
|
480
|
+
const link = linkIn(mails[0])
|
|
481
|
+
expect(link).toMatch(/^https:\/\/shop\.example\/reset-password\?token=[0-9a-f]{64}$/)
|
|
482
|
+
const token = link.split('token=')[1]
|
|
483
|
+
expect(app.db.resets).toEqual([
|
|
484
|
+
expect.objectContaining({ token_hash: sha256(token), user_id: 'u-sub', used_at: null }),
|
|
485
|
+
])
|
|
486
|
+
|
|
487
|
+
// The sent-email log keeps the email with the link hidden.
|
|
488
|
+
expect(app.ledger).toHaveLength(1)
|
|
489
|
+
expect(app.ledger[0]).toMatchObject({
|
|
490
|
+
emailType: SET_PASSWORD_EMAIL,
|
|
491
|
+
to: SUBSCRIBER.email,
|
|
492
|
+
status: 'sent',
|
|
493
|
+
source: 'signup',
|
|
494
|
+
userId: 'u-sub',
|
|
495
|
+
})
|
|
496
|
+
expect(JSON.stringify(app.ledger)).not.toContain(token)
|
|
497
|
+
expect(app.ledger[0].html).toContain('[hidden]')
|
|
498
|
+
|
|
499
|
+
// Like the forgot-password answer, it takes at least 1200 ms.
|
|
500
|
+
expect(Math.max(...app.delays)).toBeGreaterThan(1000)
|
|
501
|
+
|
|
502
|
+
// The link is a reset link: it sets the password, once.
|
|
503
|
+
const reset = fakeResponse()
|
|
504
|
+
await app.load('reset')(request({ token, password: 'Mine#Pass1' }), reset)
|
|
505
|
+
expect(reset.body).toEqual({ valid: true, changed: true })
|
|
506
|
+
expect(app.db.users[0].password).toBeTruthy()
|
|
507
|
+
expect(app.db.users[0].name).toBeNull()
|
|
508
|
+
})
|
|
509
|
+
|
|
510
|
+
it('opens the project reset page, with the token in the fragment where the page reads it there', async () => {
|
|
511
|
+
const app = loadApp({
|
|
512
|
+
db: withSubscriber(),
|
|
513
|
+
signup: { resetPagePath: '/account/new-password', tokenInFragment: true },
|
|
514
|
+
})
|
|
515
|
+
await app.signUp({ email: SUBSCRIBER.email, password: 'Passw0rd!' })
|
|
516
|
+
expect(linkIn(app.sent[0])).toMatch(
|
|
517
|
+
/^https:\/\/shop\.example\/account\/new-password#token=[0-9a-f]{64}$/
|
|
518
|
+
)
|
|
519
|
+
})
|
|
520
|
+
|
|
521
|
+
it('sends one address at most 3 links an hour, answering the same', async () => {
|
|
522
|
+
const app = loadApp({ db: withSubscriber() })
|
|
523
|
+
for (let i = 0; i < 5; i++) {
|
|
524
|
+
const res = await app.signUp(
|
|
525
|
+
{ email: SUBSCRIBER.email, password: 'Passw0rd!' },
|
|
526
|
+
'198.51.100.' + (i + 30)
|
|
527
|
+
)
|
|
528
|
+
expect(res.statusCode).toBe(201)
|
|
529
|
+
expect(res.body).toEqual({ user: { email: SUBSCRIBER.email, name: null } })
|
|
530
|
+
}
|
|
531
|
+
expect(app.sent).toHaveLength(3)
|
|
532
|
+
expect(app.db.users).toEqual([SUBSCRIBER])
|
|
533
|
+
})
|
|
534
|
+
|
|
535
|
+
it('without an email provider sends nothing and answers the same', async () => {
|
|
536
|
+
const app = loadApp({ db: withSubscriber(), welcome: {} })
|
|
537
|
+
const res = await app.signUp({ email: SUBSCRIBER.email, password: 'Passw0rd!' })
|
|
538
|
+
expect(res.statusCode).toBe(201)
|
|
539
|
+
expect(res.body).toEqual({ user: { email: SUBSCRIBER.email, name: null } })
|
|
540
|
+
expect(app.sent).toEqual([])
|
|
541
|
+
expect(app.db.resets).toEqual([])
|
|
542
|
+
expect(JSON.stringify(app.logs)).toContain('set-password link not sent')
|
|
543
|
+
})
|
|
544
|
+
|
|
545
|
+
it('without a sign-up sender, mails through the forgot-password one', async () => {
|
|
546
|
+
const noticeEmail = {
|
|
547
|
+
emailProvider: 'resend',
|
|
548
|
+
fromEmail: 'reset@brand.test',
|
|
549
|
+
emailSecretEnvName: 'RESEND_KEY',
|
|
550
|
+
}
|
|
551
|
+
const subscriber = loadApp({ db: withSubscriber(), welcome: {}, signup: { noticeEmail } })
|
|
552
|
+
await subscriber.signUp({ email: SUBSCRIBER.email, password: 'Passw0rd!' })
|
|
553
|
+
expect(subscriber.sent.map((mail) => [mail.from, mail.to, mail.subject])).toEqual([
|
|
554
|
+
['reset@brand.test', [SUBSCRIBER.email], 'Set your password to finish creating your account'],
|
|
555
|
+
])
|
|
556
|
+
expect(subscriber.ledger).toEqual([
|
|
557
|
+
expect.objectContaining({ emailType: SET_PASSWORD_EMAIL, provider: 'resend' }),
|
|
558
|
+
])
|
|
559
|
+
|
|
560
|
+
const account = loadApp({
|
|
561
|
+
db: withSubscriber({ ...SUBSCRIBER, password: 'bcrypt:x' }),
|
|
562
|
+
welcome: {},
|
|
563
|
+
signup: { noticeEmail },
|
|
564
|
+
})
|
|
565
|
+
await account.signUp({ email: SUBSCRIBER.email, password: 'Passw0rd!' })
|
|
566
|
+
expect(account.sent.map((mail) => [mail.from, mail.subject])).toEqual([
|
|
567
|
+
['reset@brand.test', 'You already have an account'],
|
|
568
|
+
])
|
|
569
|
+
|
|
570
|
+
// The welcome email keeps the sign-up node's sender: none here.
|
|
571
|
+
const fresh = loadApp({ welcome: {}, signup: { noticeEmail } })
|
|
572
|
+
await fresh.signUp({ email: 'new@site.test', password: 'Passw0rd!' })
|
|
573
|
+
expect(fresh.sent).toEqual([])
|
|
574
|
+
})
|
|
575
|
+
|
|
576
|
+
it('where reset links cannot be kept (not Postgres), tells the owner the address is known', async () => {
|
|
577
|
+
const app = loadApp({ db: withSubscriber() })
|
|
578
|
+
app.load('options').PASSWORD_RESET_SUPPORTED = false
|
|
579
|
+
const res = await app.signUp({ email: SUBSCRIBER.email, password: 'Passw0rd!' })
|
|
580
|
+
expect(res.body).toEqual({ user: { email: SUBSCRIBER.email, name: null } })
|
|
581
|
+
expect(app.sent.map((mail) => [mail.to, mail.subject])).toEqual([
|
|
582
|
+
[[SUBSCRIBER.email], 'You already have an account'],
|
|
583
|
+
])
|
|
584
|
+
expect(app.ledger.map((entry) => entry.emailType)).toEqual([EXISTING_ACCOUNT_EMAIL])
|
|
585
|
+
expect(app.db.resets).toEqual([])
|
|
586
|
+
expect(app.db.users).toEqual([SUBSCRIBER])
|
|
587
|
+
})
|
|
588
|
+
|
|
589
|
+
it('an account (a password, or an OAuth sign-in) is still told it already has one, under its own purpose', async () => {
|
|
590
|
+
for (const row of [
|
|
591
|
+
{ ...SUBSCRIBER, password: 'bcrypt:x' },
|
|
592
|
+
{ ...SUBSCRIBER, provider: 'google' },
|
|
593
|
+
]) {
|
|
594
|
+
const app = loadApp({ db: withSubscriber(row) })
|
|
595
|
+
const res = await app.signUp({ email: SUBSCRIBER.email, password: 'Passw0rd!', name: 'Eve' })
|
|
596
|
+
expect(res.statusCode).toBe(201)
|
|
597
|
+
expect(res.body).toEqual({ user: { email: SUBSCRIBER.email, name: 'Eve' } })
|
|
598
|
+
expect(app.sent.map((mail) => mail.subject)).toEqual(['You already have an account'])
|
|
599
|
+
expect(app.ledger).toEqual([
|
|
600
|
+
expect.objectContaining({
|
|
601
|
+
emailType: EXISTING_ACCOUNT_EMAIL,
|
|
602
|
+
to: SUBSCRIBER.email,
|
|
603
|
+
subject: 'You already have an account',
|
|
604
|
+
status: 'sent',
|
|
605
|
+
userId: 'u-sub',
|
|
606
|
+
}),
|
|
607
|
+
])
|
|
608
|
+
expect(app.db.resets).toEqual([])
|
|
609
|
+
expect(app.db.users).toEqual([row])
|
|
610
|
+
}
|
|
611
|
+
})
|
|
612
|
+
|
|
613
|
+
it('answers a password-less row exactly as it answers an account, in the same time', async () => {
|
|
614
|
+
const account = loadApp({ db: withSubscriber({ ...SUBSCRIBER, password: 'bcrypt:x' }) })
|
|
615
|
+
const subscriber = loadApp({ db: withSubscriber() })
|
|
616
|
+
const body = { email: SUBSCRIBER.email, password: 'Passw0rd!', name: 'Eve' }
|
|
617
|
+
const toAccount = await account.signUp(body)
|
|
618
|
+
const toSubscriber = await subscriber.signUp(body)
|
|
619
|
+
|
|
620
|
+
expect(toSubscriber.statusCode).toBe(toAccount.statusCode)
|
|
621
|
+
expect(JSON.stringify(toSubscriber.body)).toBe(JSON.stringify(toAccount.body))
|
|
622
|
+
// Each email went out, under its own purpose.
|
|
623
|
+
expect(account.ledger.map((entry) => entry.emailType)).toEqual([EXISTING_ACCOUNT_EMAIL])
|
|
624
|
+
expect(subscriber.ledger.map((entry) => entry.emailType)).toEqual([SET_PASSWORD_EMAIL])
|
|
625
|
+
// Both wait out the same minimum.
|
|
626
|
+
expect(Math.max(...account.delays)).toBeGreaterThan(1000)
|
|
627
|
+
expect(Math.max(...subscriber.delays)).toBeGreaterThan(1000)
|
|
628
|
+
})
|
|
629
|
+
})
|
|
630
|
+
|
|
631
|
+
describe('sign-up finds the address in any letter case', () => {
|
|
632
|
+
it('reaches the row of the same address typed in another case, and never makes a second one', async () => {
|
|
633
|
+
const subscriber = loadApp({ db: withSubscriber() })
|
|
634
|
+
const res = await subscriber.signUp({ email: 'Sub@Site.TEST', password: 'Passw0rd!' })
|
|
635
|
+
expect(res.body).toEqual({ user: { email: 'Sub@Site.TEST', name: null } })
|
|
636
|
+
expect(subscriber.db.users).toEqual([SUBSCRIBER])
|
|
637
|
+
// The link goes to the address the row holds.
|
|
638
|
+
expect(subscriber.sent.map((mail) => mail.to)).toEqual([[SUBSCRIBER.email]])
|
|
639
|
+
expect(subscriber.sent[0].subject).toBe('Set your password to finish creating your account')
|
|
640
|
+
|
|
641
|
+
const account = loadApp({ db: withSubscriber({ ...SUBSCRIBER, password: 'bcrypt:x' }) })
|
|
642
|
+
await account.signUp({ email: 'SUB@site.test', password: 'Passw0rd!' })
|
|
643
|
+
expect(account.db.users).toHaveLength(1)
|
|
644
|
+
expect(account.sent.map((mail) => [mail.to, mail.subject])).toEqual([
|
|
645
|
+
[[SUBSCRIBER.email], 'You already have an account'],
|
|
646
|
+
])
|
|
647
|
+
})
|
|
648
|
+
|
|
649
|
+
it('prefers the exact address, and takes no row when the case-blind match is ambiguous', async () => {
|
|
650
|
+
const db = new FakePostgres()
|
|
651
|
+
db.users.push({ ...SUBSCRIBER, id: 'u-upper', email: 'Sub@site.test', password: 'bcrypt:x' })
|
|
652
|
+
db.users.push({ ...SUBSCRIBER })
|
|
653
|
+
const exact = loadApp({ db })
|
|
654
|
+
await exact.signUp({ email: SUBSCRIBER.email, password: 'Passw0rd!' })
|
|
655
|
+
expect(exact.sent.map((mail) => mail.subject)).toEqual([
|
|
656
|
+
'Set your password to finish creating your account',
|
|
657
|
+
])
|
|
658
|
+
|
|
659
|
+
const ambiguous = loadApp({ db })
|
|
660
|
+
const res = await ambiguous.signUp({ email: 'SUB@SITE.TEST', password: 'Passw0rd!' })
|
|
661
|
+
expect(res.statusCode).toBe(201)
|
|
662
|
+
expect(db.users.map((user) => user.email)).toEqual([
|
|
663
|
+
'Sub@site.test',
|
|
664
|
+
SUBSCRIBER.email,
|
|
665
|
+
'SUB@SITE.TEST',
|
|
666
|
+
])
|
|
667
|
+
})
|
|
668
|
+
|
|
669
|
+
it('sign-in keeps its exact lookup; stores other than Postgres keep theirs for sign-up too', () => {
|
|
670
|
+
const postgres = generateAuthOptionsFile(AUTH, null)
|
|
671
|
+
const signIn = /async function findUserByEmail\(email\) \{[\s\S]*?\n\}/.exec(postgres)![0]
|
|
672
|
+
expect(signIn).toContain("'SELECT * FROM users WHERE email = $1 LIMIT 1'")
|
|
673
|
+
expect(signIn).not.toContain('LOWER')
|
|
674
|
+
expect(postgres).toContain('module.exports.findSignupUserByEmail = findSignupUserByEmail;')
|
|
675
|
+
|
|
676
|
+
const mysql = generateAuthOptionsFile({ ...AUTH, dataSourceType: 'mysql' }, null)
|
|
677
|
+
expect(mysql).toContain(
|
|
678
|
+
'async function findSignupUserByEmail(email) {\n return findUserByEmail(email);\n}'
|
|
679
|
+
)
|
|
680
|
+
expect(mysql).not.toContain('LOWER(email)')
|
|
681
|
+
})
|
|
682
|
+
})
|
|
683
|
+
|
|
684
|
+
describe('the account-signup step', () => {
|
|
685
|
+
it('when no session follows an answered sign-up, says one thing whatever the address was', async () => {
|
|
686
|
+
const source = accountSignup.generateHandler()
|
|
687
|
+
expect(source).not.toContain('setPassword')
|
|
688
|
+
const calls: string[] = []
|
|
689
|
+
const fakeFetch = async (url: string) => {
|
|
690
|
+
calls.push(url)
|
|
691
|
+
return url === '/api/auth/session'
|
|
692
|
+
? { ok: true, json: async () => ({}) }
|
|
693
|
+
: { ok: true, json: async () => ({ user: { email: 'sub@site.test', name: null } }) }
|
|
694
|
+
}
|
|
695
|
+
const signInFails = {
|
|
696
|
+
__teleportNextAuth: { signIn: async () => ({ error: 'CredentialsSignin' }) },
|
|
697
|
+
}
|
|
698
|
+
const noSession = { __teleportNextAuth: { signIn: async () => ({ error: null }) } }
|
|
699
|
+
// A wrong password for an account, a row without one, no session, sign-in not loaded yet.
|
|
700
|
+
for (const window of [signInFails, noSession, undefined]) {
|
|
701
|
+
// eslint-disable-next-line no-new-func
|
|
702
|
+
const handler = new Function('fetch', 'window', `${source}\nreturn account_signup;`)(
|
|
703
|
+
fakeFetch,
|
|
704
|
+
window
|
|
705
|
+
)
|
|
706
|
+
await expect(handler({ email: 'sub@site.test', password: 'Passw0rd!' }, {})).rejects.toThrow(
|
|
707
|
+
'Check your inbox — we sent an email about this address.'
|
|
708
|
+
)
|
|
709
|
+
}
|
|
710
|
+
expect(calls.filter((url) => url === '/api/auth/signup')).toHaveLength(3)
|
|
711
|
+
})
|
|
712
|
+
|
|
713
|
+
it('sends the consent box as the route reads it: "true" when ticked, else "false"', async () => {
|
|
714
|
+
const source = accountSignup.generateHandler()
|
|
715
|
+
const bodies: Row[] = []
|
|
716
|
+
const fakeFetch = async (url: string, init?: { body: string }) => {
|
|
717
|
+
if (url === '/api/auth/signup' && init) {
|
|
718
|
+
bodies.push(JSON.parse(init.body))
|
|
719
|
+
}
|
|
720
|
+
return { ok: true, json: async () => ({}) }
|
|
721
|
+
}
|
|
722
|
+
// eslint-disable-next-line no-new-func
|
|
723
|
+
const handler = new Function('fetch', 'window', `${source}\nreturn account_signup;`)(
|
|
724
|
+
fakeFetch,
|
|
725
|
+
undefined
|
|
726
|
+
)
|
|
727
|
+
const values: unknown[] = [true, 'true', 'on', false, 'false', 'off', '', null, 'yes']
|
|
728
|
+
for (const value of values) {
|
|
729
|
+
await handler(
|
|
730
|
+
{ email: 'a@site.test', password: 'Passw0rd!', marketing_consent: value },
|
|
731
|
+
{}
|
|
732
|
+
).catch(() => undefined)
|
|
733
|
+
}
|
|
734
|
+
await handler({ email: 'a@site.test', password: 'Passw0rd!' }, {}).catch(() => undefined)
|
|
735
|
+
expect(bodies.map((body) => body.marketing_consent)).toEqual([
|
|
736
|
+
'true',
|
|
737
|
+
'true',
|
|
738
|
+
'true',
|
|
739
|
+
'false',
|
|
740
|
+
'false',
|
|
741
|
+
'false',
|
|
742
|
+
'false',
|
|
743
|
+
'false',
|
|
744
|
+
'false',
|
|
745
|
+
undefined,
|
|
746
|
+
])
|
|
747
|
+
})
|
|
748
|
+
|
|
749
|
+
const loadServerSignup = (existing: Row | null) => {
|
|
750
|
+
const created: Row[] = []
|
|
751
|
+
const looked: string[] = []
|
|
752
|
+
const modules: Record<string, unknown> = {
|
|
753
|
+
'../../../utils/auth/hash-password': Object.assign((p: string) => 'hashed:' + p, {
|
|
754
|
+
passwordPolicyError: () => '',
|
|
755
|
+
}),
|
|
756
|
+
'../../../utils/auth/auth-options': {
|
|
757
|
+
findSignupUserByEmail: async (email: string) => {
|
|
758
|
+
looked.push(email)
|
|
759
|
+
return existing
|
|
760
|
+
},
|
|
761
|
+
createUser: async (data: Row) => {
|
|
762
|
+
created.push(data)
|
|
763
|
+
return { id: 'u1', ...data }
|
|
764
|
+
},
|
|
765
|
+
sanitizeUser: (user: Row) => ({ id: user.id, email: user.email }),
|
|
766
|
+
},
|
|
767
|
+
}
|
|
768
|
+
// eslint-disable-next-line no-new-func
|
|
769
|
+
const handler = new Function(
|
|
770
|
+
'require',
|
|
771
|
+
`${accountSignup.generateServerHandler!({})}\nreturn account_signup;`
|
|
772
|
+
)((id: string) => modules[id])
|
|
773
|
+
return { handler, created, looked }
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
it('run on the server, writes where the person came from and their consent as given', async () => {
|
|
777
|
+
const { handler, created } = loadServerSignup(null)
|
|
778
|
+
await handler({ email: 'a@site.test', password: 'Passw0rd!' }, {})
|
|
779
|
+
await handler(
|
|
780
|
+
{
|
|
781
|
+
email: 'b@site.test',
|
|
782
|
+
password: 'Passw0rd!',
|
|
783
|
+
marketing_consent: 'true',
|
|
784
|
+
source: 'import',
|
|
785
|
+
},
|
|
786
|
+
{}
|
|
787
|
+
)
|
|
788
|
+
await handler({ email: 'c@site.test', password: 'Passw0rd!', marketing_consent: true }, {})
|
|
789
|
+
expect(created[0]).toMatchObject({ source: 'signup', marketing_consent: false })
|
|
790
|
+
expect(created[1]).toMatchObject({ source: 'signup', marketing_consent: true })
|
|
791
|
+
expect(created[2]).toMatchObject({ marketing_consent: true })
|
|
792
|
+
})
|
|
793
|
+
|
|
794
|
+
it('run on the server, refuses any address the site knows with one message, in any letter case', async () => {
|
|
795
|
+
for (const existing of [{ ...SUBSCRIBER, password: 'bcrypt:x' }, { ...SUBSCRIBER }]) {
|
|
796
|
+
const { handler, created, looked } = loadServerSignup(existing)
|
|
797
|
+
await expect(handler({ email: 'Sub@Site.test', password: 'Passw0rd!' }, {})).rejects.toThrow(
|
|
798
|
+
/^This email cannot be used to create an account here\.$/
|
|
799
|
+
)
|
|
800
|
+
expect(looked).toEqual(['Sub@Site.test'])
|
|
801
|
+
expect(created).toEqual([])
|
|
802
|
+
}
|
|
803
|
+
})
|
|
804
|
+
})
|
|
805
|
+
|
|
806
|
+
describe('every failed sign-in does the same bcrypt work', () => {
|
|
807
|
+
const ACCOUNT = { ...SUBSCRIBER, id: 'u-acc', email: 'acc@site.test', password: 'bcrypt:other' }
|
|
808
|
+
const attempts = [
|
|
809
|
+
['an unknown address', 'nobody@site.test'],
|
|
810
|
+
['a row without a password', SUBSCRIBER.email],
|
|
811
|
+
['an account, with a wrong password', ACCOUNT.email],
|
|
812
|
+
]
|
|
813
|
+
|
|
814
|
+
for (const [label, env] of [
|
|
815
|
+
['with the project pepper', ENV],
|
|
816
|
+
['on the old pepper only', { ...ENV, AUTH_PEPPER_SECRET: '' }],
|
|
817
|
+
] as Array<[string, Record<string, string>]>) {
|
|
818
|
+
it(label, async () => {
|
|
819
|
+
const db = withSubscriber()
|
|
820
|
+
db.users.push({ ...ACCOUNT })
|
|
821
|
+
const app = loadApp({ db, env })
|
|
822
|
+
// The stand-in hash is made once per process, at the cost of a real one.
|
|
823
|
+
await app.signIn('warm-up@site.test', 'Wrong#Pass1')
|
|
824
|
+
expect(app.bcryptWork.hashCosts).toEqual([12])
|
|
825
|
+
|
|
826
|
+
const compares: Record<string, number> = {}
|
|
827
|
+
for (const [what, email] of attempts) {
|
|
828
|
+
const before = app.bcryptWork.compares
|
|
829
|
+
expect(await app.signIn(email, 'Wrong#Pass1')).toBe('InvalidCredentials')
|
|
830
|
+
compares[what] = app.bcryptWork.compares - before
|
|
831
|
+
}
|
|
832
|
+
const expected = env.AUTH_PEPPER_SECRET ? 2 : 1
|
|
833
|
+
expect(compares).toEqual({
|
|
834
|
+
'an unknown address': expected,
|
|
835
|
+
'a row without a password': expected,
|
|
836
|
+
'an account, with a wrong password': expected,
|
|
837
|
+
})
|
|
838
|
+
expect(app.bcryptWork.hashCosts).toEqual([12])
|
|
839
|
+
})
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
it('the server-run sign-in step too', async () => {
|
|
843
|
+
const db = withSubscriber()
|
|
844
|
+
db.users.push({ ...ACCOUNT })
|
|
845
|
+
const app = loadApp({ db })
|
|
846
|
+
const modules: Record<string, unknown> = {
|
|
847
|
+
'../../../utils/auth/hash-password': app.load('hash'),
|
|
848
|
+
'../../../utils/auth/auth-options': app.load('options'),
|
|
849
|
+
'../../../utils/security-runtime': app.load('runtime'),
|
|
850
|
+
}
|
|
851
|
+
// eslint-disable-next-line no-new-func
|
|
852
|
+
const login = new Function(
|
|
853
|
+
'require',
|
|
854
|
+
`${accountLogin.generateServerHandler!({})}\nreturn account_login;`
|
|
855
|
+
)((id: string) => modules[id])
|
|
856
|
+
const counts: number[] = []
|
|
857
|
+
for (const [, email] of attempts) {
|
|
858
|
+
const before = app.bcryptWork.compares
|
|
859
|
+
await expect(login({ email, password: 'Wrong#Pass1' }, {})).rejects.toThrow(
|
|
860
|
+
'Invalid email or password'
|
|
861
|
+
)
|
|
862
|
+
counts.push(app.bcryptWork.compares - before)
|
|
863
|
+
}
|
|
864
|
+
expect(counts).toEqual([2, 2, 2])
|
|
865
|
+
})
|
|
866
|
+
})
|
|
867
|
+
|
|
868
|
+
describe('project wiring', () => {
|
|
869
|
+
const secret = { type: 'dynamic', content: { referenceType: 'secret', id: 'RESEND_KEY' } }
|
|
870
|
+
const SIGNUP_NODE_EMAIL = {
|
|
871
|
+
emailProvider: 'email-resend',
|
|
872
|
+
from: 'shop@brand.test',
|
|
873
|
+
apiKey: secret,
|
|
874
|
+
subject: 'Welcome',
|
|
875
|
+
body: '<p>Welcome</p>',
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
/** The project plugin's files for a sign-up node with `signupEmail` and a reset node with a sender. */
|
|
879
|
+
const runPlugin = async (signupEmail: Row) => {
|
|
880
|
+
const files = new Map<string, any>()
|
|
881
|
+
const node = (id: string, type: string, config: Row) => ({ id, type, config })
|
|
882
|
+
const structure = {
|
|
883
|
+
uidl: {
|
|
884
|
+
name: 'Shop',
|
|
885
|
+
globals: { env: {} as Record<string, string> },
|
|
886
|
+
authentication: AUTH,
|
|
887
|
+
dataSources: {},
|
|
888
|
+
workflows: {
|
|
889
|
+
workflows: {
|
|
890
|
+
signup: {
|
|
891
|
+
id: 'signup',
|
|
892
|
+
name: 'Sign Up Flow',
|
|
893
|
+
trigger: { type: 'event-element-clicked', nodeId: 't', config: {} },
|
|
894
|
+
nodes: [node('s1', 'account-signup', { email: 'x', password: 'y', ...signupEmail })],
|
|
895
|
+
edges: [],
|
|
896
|
+
},
|
|
897
|
+
forgot: {
|
|
898
|
+
id: 'forgot',
|
|
899
|
+
name: 'Forgot Password Flow',
|
|
900
|
+
trigger: { type: 'event-element-clicked', nodeId: 't', config: {} },
|
|
901
|
+
nodes: [
|
|
902
|
+
node('f1', 'account-request-password-reset', {
|
|
903
|
+
email: 'x',
|
|
904
|
+
emailProvider: 'email-resend',
|
|
905
|
+
from: 'reset@brand.test',
|
|
906
|
+
apiKey: secret,
|
|
907
|
+
resetPagePath: '/account/new-password',
|
|
908
|
+
}),
|
|
909
|
+
],
|
|
910
|
+
edges: [],
|
|
911
|
+
},
|
|
912
|
+
reset: {
|
|
913
|
+
id: 'reset',
|
|
914
|
+
name: 'Reset Password Flow',
|
|
915
|
+
trigger: { type: 'event-page-loaded', nodeId: 'p', config: {} },
|
|
916
|
+
nodes: [
|
|
917
|
+
node('r1', 'general-custom-js', {
|
|
918
|
+
code: 'function customHandler() { return sessionStorage.getItem("tq-reset-token"); }',
|
|
919
|
+
}),
|
|
920
|
+
],
|
|
921
|
+
edges: [],
|
|
922
|
+
},
|
|
923
|
+
},
|
|
924
|
+
},
|
|
925
|
+
},
|
|
926
|
+
files,
|
|
927
|
+
dependencies: {} as Record<string, string>,
|
|
928
|
+
devDependencies: {},
|
|
929
|
+
strategy: {},
|
|
930
|
+
}
|
|
931
|
+
await new NextWorkflowProjectPlugin().runAfter(structure as never)
|
|
932
|
+
return (key: string) => files.get(key)?.files?.[0]?.content as string
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
it('the set-password link opens the page the reset link opens, as the forgot route builds it', async () => {
|
|
936
|
+
const content = await runPlugin(SIGNUP_NODE_EMAIL)
|
|
937
|
+
expect(content('auth-forgot-password-route')).toContain(
|
|
938
|
+
'var RESET_PAGE_PATH = "/account/new-password";'
|
|
939
|
+
)
|
|
940
|
+
expect(content('auth-forgot-password-route')).toContain('var TOKEN_LINK_PREFIX = "#token=";')
|
|
941
|
+
expect(content('auth-signup-route')).toContain(
|
|
942
|
+
'var SET_PASSWORD_PAGE_PATH = "/account/new-password";'
|
|
943
|
+
)
|
|
944
|
+
expect(content('auth-signup-route')).toContain(
|
|
945
|
+
'var SET_PASSWORD_TOKEN_LINK_PREFIX = "#token=";'
|
|
946
|
+
)
|
|
947
|
+
// The sign-up node's sender is the known-address sender.
|
|
948
|
+
expect(content('auth-signup-route')).toContain('const NOTICE_EMAIL_FROM = "shop@brand.test";')
|
|
949
|
+
})
|
|
950
|
+
|
|
951
|
+
it('without a sign-up sender, the known-address emails use the forgot-password one', async () => {
|
|
952
|
+
const content = await runPlugin({})
|
|
953
|
+
expect(content('auth-signup-route')).toContain('const WELCOME_EMAIL_PROVIDER = null;')
|
|
954
|
+
expect(content('auth-signup-route')).toContain('const NOTICE_EMAIL_PROVIDER = "resend";')
|
|
955
|
+
expect(content('auth-signup-route')).toContain('const NOTICE_EMAIL_FROM = "reset@brand.test";')
|
|
956
|
+
expect(content('auth-signup-route')).toContain(
|
|
957
|
+
'const NOTICE_EMAIL_SECRET_ENV_NAME = "RESEND_KEY";'
|
|
958
|
+
)
|
|
959
|
+
})
|
|
960
|
+
})
|