@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.
Files changed (976) hide show
  1. package/__tests__/_helpers/fake-fetch.ts +75 -0
  2. package/__tests__/_helpers/gui-place-order-statements.ts +17 -0
  3. package/__tests__/_helpers/inserted-lines.ts +22 -0
  4. package/__tests__/_helpers/invoice-store.ts +10 -1
  5. package/__tests__/_helpers/load-security-runtime.ts +45 -0
  6. package/__tests__/_helpers/load-server-runtime.ts +26 -3
  7. package/__tests__/_helpers/run-account-delete-route.ts +3 -1
  8. package/__tests__/_helpers/run-generated-middleware.ts +7 -2
  9. package/__tests__/account-delete-owned-rows.test.ts +3 -1
  10. package/__tests__/adopted-element-trigger-code.test.ts +128 -0
  11. package/__tests__/analytics-track-outcome.test.ts +145 -0
  12. package/__tests__/auth-password-change-ends-sessions.test.ts +8 -1
  13. package/__tests__/auth-password-security.test.ts +2275 -0
  14. package/__tests__/auth-session-cost.test.ts +31 -0
  15. package/__tests__/auth-signup-route.test.ts +960 -0
  16. package/__tests__/authored-code-every-path.test.ts +247 -0
  17. package/__tests__/automations-bus.test.ts +3820 -0
  18. package/__tests__/automations-catalog-drift.test.ts +97 -0
  19. package/__tests__/booking-calendar-feed-route.test.ts +20 -3
  20. package/__tests__/cart-price-order.test.ts +336 -1
  21. package/__tests__/code-lookup-rate-limit-route.test.ts +189 -0
  22. package/__tests__/cost-bearing-node-types.test.ts +119 -0
  23. package/__tests__/credential-columns-reply.test.ts +9 -0
  24. package/__tests__/credential-result-reply.test.ts +19 -5
  25. package/__tests__/cron-route-loop-templateparams.test.ts +6 -3
  26. package/__tests__/custom-js-authored-code.test.ts +304 -0
  27. package/__tests__/custom-node-custom-code-gate.test.ts +136 -0
  28. package/__tests__/custom-node-step-handlers.test.ts +251 -0
  29. package/__tests__/custom-node-step-reach.test.ts +63 -0
  30. package/__tests__/data-api-anon-user-id-fallback.test.ts +7 -2
  31. package/__tests__/data-api-browser-reads.test.ts +7 -0
  32. package/__tests__/data-api-business-events.test.ts +403 -0
  33. package/__tests__/data-api-invalid-body.test.ts +7 -0
  34. package/__tests__/data-api-low-stock-autofire.test.ts +30 -4
  35. package/__tests__/data-api-optional-feature-columns.test.ts +44 -0
  36. package/__tests__/data-api-owner-scope-credentials.test.ts +1324 -0
  37. package/__tests__/data-api-protected-tables.test.ts +48 -15
  38. package/__tests__/data-api-retired-table-and-account-fields.test.ts +208 -0
  39. package/__tests__/email-locale-senders.test.ts +5 -3
  40. package/__tests__/expression-injection.test.ts +343 -0
  41. package/__tests__/fixtures/admin-file-workflows.json +242 -0
  42. package/__tests__/form-confirmation-email-template.test.ts +44 -0
  43. package/__tests__/internal-request-headers.test.ts +25 -0
  44. package/__tests__/invoice-pdf-service-project-header.test.ts +120 -0
  45. package/__tests__/invoice-self-call-origin.test.ts +57 -1
  46. package/__tests__/legacy-webhook-self-calls.test.ts +86 -1
  47. package/__tests__/middleware-home-route-protection.test.ts +3 -1
  48. package/__tests__/middleware-subscriber-access.test.ts +1 -1
  49. package/__tests__/newsletter-admin-route.test.ts +649 -0
  50. package/__tests__/newsletter-plugin.test.ts +1248 -0
  51. package/__tests__/outbound-nodes-security.test.ts +1929 -0
  52. package/__tests__/page-access-guard.test.ts +217 -0
  53. package/__tests__/page-access-route-table.test.ts +231 -0
  54. package/__tests__/payment-drivers-module.test.ts +23 -0
  55. package/__tests__/payment-legacy-webhook-routes.test.ts +100 -5
  56. package/__tests__/payment-webhook-route.test.ts +4 -1
  57. package/__tests__/paypal-webhook-signature-verification.test.ts +44 -0
  58. package/__tests__/place-order-guards.test.ts +506 -0
  59. package/__tests__/public-step-guards.test.ts +310 -0
  60. package/__tests__/publish-refusals.test.ts +505 -0
  61. package/__tests__/realtime-identity-routes.test.ts +492 -0
  62. package/__tests__/record-event-writer-server-only.test.ts +975 -0
  63. package/__tests__/resolve-config-template-params.test.ts +3 -3
  64. package/__tests__/runtime-storage-upload-access.test.ts +280 -17
  65. package/__tests__/security-integration-env-names.test.ts +74 -0
  66. package/__tests__/security-lists-parity.test.ts +245 -0
  67. package/__tests__/security-runtime-shadow.test.ts +224 -1
  68. package/__tests__/security-runtime.test.ts +893 -0
  69. package/__tests__/segment-rate-limit-error-branch.test.ts +284 -0
  70. package/__tests__/segment-route-abuse-gate.test.ts +309 -0
  71. package/__tests__/server-job-hops-real-data-api.test.ts +669 -0
  72. package/__tests__/server-session-identity.test.ts +522 -0
  73. package/__tests__/server-step-chain.test.ts +222 -0
  74. package/__tests__/server-step-signing.test.ts +107 -2
  75. package/__tests__/session-cookie-resolver.test.ts +62 -106
  76. package/__tests__/signup-event.test.ts +649 -0
  77. package/__tests__/signup-reply-identical.test.ts +144 -0
  78. package/__tests__/slack-message-escaping.test.ts +123 -0
  79. package/__tests__/visitor-step-limits.test.ts +318 -0
  80. package/__tests__/webhook-delivery-lease.test.ts +4 -1
  81. package/__tests__/webpack-safe-handlers.test.ts +57 -8
  82. package/__tests__/workflow-auth-guard.test.ts +9 -1
  83. package/dist/cjs/account-delete-route-generator.d.ts +1 -0
  84. package/dist/cjs/account-delete-route-generator.d.ts.map +1 -1
  85. package/dist/cjs/account-delete-route-generator.js +18 -3
  86. package/dist/cjs/account-delete-route-generator.js.map +1 -1
  87. package/dist/cjs/api-route-generator.d.ts +52 -3
  88. package/dist/cjs/api-route-generator.d.ts.map +1 -1
  89. package/dist/cjs/api-route-generator.js +600 -145
  90. package/dist/cjs/api-route-generator.js.map +1 -1
  91. package/dist/cjs/auth-generator.d.ts +126 -3
  92. package/dist/cjs/auth-generator.d.ts.map +1 -1
  93. package/dist/cjs/auth-generator.js +1353 -139
  94. package/dist/cjs/auth-generator.js.map +1 -1
  95. package/dist/cjs/automations/activity-kicks.d.ts +12 -0
  96. package/dist/cjs/automations/activity-kicks.d.ts.map +1 -0
  97. package/dist/cjs/automations/activity-kicks.js +123 -0
  98. package/dist/cjs/automations/activity-kicks.js.map +1 -0
  99. package/dist/cjs/automations/app-events-source.d.ts +33 -0
  100. package/dist/cjs/automations/app-events-source.d.ts.map +1 -0
  101. package/dist/cjs/automations/app-events-source.js +109 -0
  102. package/dist/cjs/automations/app-events-source.js.map +1 -0
  103. package/dist/cjs/automations/automations-project-plugin.d.ts +21 -0
  104. package/dist/cjs/automations/automations-project-plugin.d.ts.map +1 -0
  105. package/dist/cjs/automations/automations-project-plugin.js +102 -0
  106. package/dist/cjs/automations/automations-project-plugin.js.map +1 -0
  107. package/dist/cjs/automations/automations-scope.d.ts +104 -0
  108. package/dist/cjs/automations/automations-scope.d.ts.map +1 -0
  109. package/dist/cjs/automations/automations-scope.js +176 -0
  110. package/dist/cjs/automations/automations-scope.js.map +1 -0
  111. package/dist/cjs/automations/dispatcher-source.d.ts +72 -0
  112. package/dist/cjs/automations/dispatcher-source.d.ts.map +1 -0
  113. package/dist/cjs/automations/dispatcher-source.js +1008 -0
  114. package/dist/cjs/automations/dispatcher-source.js.map +1 -0
  115. package/dist/cjs/automations/event-bus-source.d.ts +44 -0
  116. package/dist/cjs/automations/event-bus-source.d.ts.map +1 -0
  117. package/dist/cjs/automations/event-bus-source.js +427 -0
  118. package/dist/cjs/automations/event-bus-source.js.map +1 -0
  119. package/dist/cjs/automations/handler-module-generator.d.ts +25 -0
  120. package/dist/cjs/automations/handler-module-generator.d.ts.map +1 -0
  121. package/dist/cjs/automations/handler-module-generator.js +78 -0
  122. package/dist/cjs/automations/handler-module-generator.js.map +1 -0
  123. package/dist/cjs/automations/hydrators-source.d.ts +33 -0
  124. package/dist/cjs/automations/hydrators-source.d.ts.map +1 -0
  125. package/dist/cjs/automations/hydrators-source.js +571 -0
  126. package/dist/cjs/automations/hydrators-source.js.map +1 -0
  127. package/dist/cjs/booking-calendar-feed-route-generator.d.ts.map +1 -1
  128. package/dist/cjs/booking-calendar-feed-route-generator.js +8 -0
  129. package/dist/cjs/booking-calendar-feed-route-generator.js.map +1 -1
  130. package/dist/cjs/configured-nextauth-url.d.ts +17 -0
  131. package/dist/cjs/configured-nextauth-url.d.ts.map +1 -0
  132. package/dist/cjs/configured-nextauth-url.js +20 -0
  133. package/dist/cjs/configured-nextauth-url.js.map +1 -0
  134. package/dist/cjs/cron-request-verification.d.ts +22 -1
  135. package/dist/cjs/cron-request-verification.d.ts.map +1 -1
  136. package/dist/cjs/cron-request-verification.js +50 -6
  137. package/dist/cjs/cron-request-verification.js.map +1 -1
  138. package/dist/cjs/data-api-route-generator.d.ts +19 -0
  139. package/dist/cjs/data-api-route-generator.d.ts.map +1 -1
  140. package/dist/cjs/data-api-route-generator.js +711 -43
  141. package/dist/cjs/data-api-route-generator.js.map +1 -1
  142. package/dist/cjs/ecommerce/parameterized-stock-chain.d.ts +3 -1
  143. package/dist/cjs/ecommerce/parameterized-stock-chain.d.ts.map +1 -1
  144. package/dist/cjs/ecommerce/parameterized-stock-chain.js +45 -5
  145. package/dist/cjs/ecommerce/parameterized-stock-chain.js.map +1 -1
  146. package/dist/cjs/ecommerce/place-order-guards.d.ts +126 -0
  147. package/dist/cjs/ecommerce/place-order-guards.d.ts.map +1 -0
  148. package/dist/cjs/ecommerce/place-order-guards.js +670 -0
  149. package/dist/cjs/ecommerce/place-order-guards.js.map +1 -0
  150. package/dist/cjs/ecommerce-customhandler-rewriter.d.ts +2 -0
  151. package/dist/cjs/ecommerce-customhandler-rewriter.d.ts.map +1 -1
  152. package/dist/cjs/ecommerce-customhandler-rewriter.js +38 -2
  153. package/dist/cjs/ecommerce-customhandler-rewriter.js.map +1 -1
  154. package/dist/cjs/executor-generator.d.ts.map +1 -1
  155. package/dist/cjs/executor-generator.js +368 -60
  156. package/dist/cjs/executor-generator.js.map +1 -1
  157. package/dist/cjs/graph-utils.d.ts +9 -0
  158. package/dist/cjs/graph-utils.d.ts.map +1 -1
  159. package/dist/cjs/graph-utils.js +32 -1
  160. package/dist/cjs/graph-utils.js.map +1 -1
  161. package/dist/cjs/index.d.ts +20 -1
  162. package/dist/cjs/index.d.ts.map +1 -1
  163. package/dist/cjs/index.js +72 -2
  164. package/dist/cjs/index.js.map +1 -1
  165. package/dist/cjs/invoice/api-routes-code.d.ts +9 -3
  166. package/dist/cjs/invoice/api-routes-code.d.ts.map +1 -1
  167. package/dist/cjs/invoice/api-routes-code.js +9 -7
  168. package/dist/cjs/invoice/api-routes-code.js.map +1 -1
  169. package/dist/cjs/invoice/index.d.ts.map +1 -1
  170. package/dist/cjs/invoice/index.js +12 -7
  171. package/dist/cjs/invoice/index.js.map +1 -1
  172. package/dist/cjs/invoice/invoice-assembly-code.d.ts.map +1 -1
  173. package/dist/cjs/invoice/invoice-assembly-code.js +8 -3
  174. package/dist/cjs/invoice/invoice-assembly-code.js.map +1 -1
  175. package/dist/cjs/invoice/pdf-generator-code.d.ts.map +1 -1
  176. package/dist/cjs/invoice/pdf-generator-code.js +2 -1
  177. package/dist/cjs/invoice/pdf-generator-code.js.map +1 -1
  178. package/dist/cjs/invoice/pdf-service-client-code.d.ts.map +1 -1
  179. package/dist/cjs/invoice/pdf-service-client-code.js +15 -7
  180. package/dist/cjs/invoice/pdf-service-client-code.js.map +1 -1
  181. package/dist/cjs/newsletter/admin-route-code.d.ts +60 -0
  182. package/dist/cjs/newsletter/admin-route-code.d.ts.map +1 -0
  183. package/dist/cjs/newsletter/admin-route-code.js +300 -0
  184. package/dist/cjs/newsletter/admin-route-code.js.map +1 -0
  185. package/dist/cjs/newsletter/helper-code.d.ts +109 -0
  186. package/dist/cjs/newsletter/helper-code.d.ts.map +1 -0
  187. package/dist/cjs/newsletter/helper-code.js +662 -0
  188. package/dist/cjs/newsletter/helper-code.js.map +1 -0
  189. package/dist/cjs/newsletter/newsletter-scope.d.ts +65 -0
  190. package/dist/cjs/newsletter/newsletter-scope.d.ts.map +1 -0
  191. package/dist/cjs/newsletter/newsletter-scope.js +103 -0
  192. package/dist/cjs/newsletter/newsletter-scope.js.map +1 -0
  193. package/dist/cjs/newsletter/project-plugin.d.ts +18 -0
  194. package/dist/cjs/newsletter/project-plugin.d.ts.map +1 -0
  195. package/dist/cjs/newsletter/project-plugin.js +97 -0
  196. package/dist/cjs/newsletter/project-plugin.js.map +1 -0
  197. package/dist/cjs/newsletter/routes-code.d.ts +6 -0
  198. package/dist/cjs/newsletter/routes-code.d.ts.map +1 -0
  199. package/dist/cjs/newsletter/routes-code.js +181 -0
  200. package/dist/cjs/newsletter/routes-code.js.map +1 -0
  201. package/dist/cjs/nodes/account/account-compare-passwords.d.ts.map +1 -1
  202. package/dist/cjs/nodes/account/account-compare-passwords.js +16 -6
  203. package/dist/cjs/nodes/account/account-compare-passwords.js.map +1 -1
  204. package/dist/cjs/nodes/account/account-delete-current.js +1 -1
  205. package/dist/cjs/nodes/account/account-get-current.js +1 -1
  206. package/dist/cjs/nodes/account/account-hash-password.d.ts.map +1 -1
  207. package/dist/cjs/nodes/account/account-hash-password.js +15 -3
  208. package/dist/cjs/nodes/account/account-hash-password.js.map +1 -1
  209. package/dist/cjs/nodes/account/account-login.d.ts.map +1 -1
  210. package/dist/cjs/nodes/account/account-login.js +23 -6
  211. package/dist/cjs/nodes/account/account-login.js.map +1 -1
  212. package/dist/cjs/nodes/account/account-logout.js +1 -1
  213. package/dist/cjs/nodes/account/account-refresh-session.js +1 -1
  214. package/dist/cjs/nodes/account/account-request-password-reset.d.ts +3 -0
  215. package/dist/cjs/nodes/account/account-request-password-reset.d.ts.map +1 -0
  216. package/dist/cjs/nodes/account/account-request-password-reset.js +46 -0
  217. package/dist/cjs/nodes/account/account-request-password-reset.js.map +1 -0
  218. package/dist/cjs/nodes/account/account-reset-password.d.ts +3 -0
  219. package/dist/cjs/nodes/account/account-reset-password.d.ts.map +1 -0
  220. package/dist/cjs/nodes/account/account-reset-password.js +44 -0
  221. package/dist/cjs/nodes/account/account-reset-password.js.map +1 -0
  222. package/dist/cjs/nodes/account/account-signup.d.ts.map +1 -1
  223. package/dist/cjs/nodes/account/account-signup.js +82 -19
  224. package/dist/cjs/nodes/account/account-signup.js.map +1 -1
  225. package/dist/cjs/nodes/account/account-social-login.js +1 -1
  226. package/dist/cjs/nodes/ai/ai-custom-prompt.d.ts.map +1 -1
  227. package/dist/cjs/nodes/ai/ai-custom-prompt.js +20 -5
  228. package/dist/cjs/nodes/ai/ai-custom-prompt.js.map +1 -1
  229. package/dist/cjs/nodes/ai/ai-detect-language.d.ts.map +1 -1
  230. package/dist/cjs/nodes/ai/ai-detect-language.js +20 -5
  231. package/dist/cjs/nodes/ai/ai-detect-language.js.map +1 -1
  232. package/dist/cjs/nodes/ai/ai-generate-text-embedding.d.ts.map +1 -1
  233. package/dist/cjs/nodes/ai/ai-generate-text-embedding.js +10 -2
  234. package/dist/cjs/nodes/ai/ai-generate-text-embedding.js.map +1 -1
  235. package/dist/cjs/nodes/ai/ai-provider-utils-sources.generated.js +2 -2
  236. package/dist/cjs/nodes/ai/ai-provider-utils-sources.generated.js.map +1 -1
  237. package/dist/cjs/nodes/ai/ai-provider-utils.d.ts +31 -2
  238. package/dist/cjs/nodes/ai/ai-provider-utils.d.ts.map +1 -1
  239. package/dist/cjs/nodes/ai/ai-provider-utils.js +125 -11
  240. package/dist/cjs/nodes/ai/ai-provider-utils.js.map +1 -1
  241. package/dist/cjs/nodes/ai/ai-select-database-data.d.ts.map +1 -1
  242. package/dist/cjs/nodes/ai/ai-select-database-data.js +6 -2
  243. package/dist/cjs/nodes/ai/ai-select-database-data.js.map +1 -1
  244. package/dist/cjs/nodes/ai/ai-sentiment-analysis.d.ts.map +1 -1
  245. package/dist/cjs/nodes/ai/ai-sentiment-analysis.js +20 -5
  246. package/dist/cjs/nodes/ai/ai-sentiment-analysis.js.map +1 -1
  247. package/dist/cjs/nodes/ai/ai-summarization.d.ts.map +1 -1
  248. package/dist/cjs/nodes/ai/ai-summarization.js +20 -5
  249. package/dist/cjs/nodes/ai/ai-summarization.js.map +1 -1
  250. package/dist/cjs/nodes/ai/ai-text-classifier.d.ts.map +1 -1
  251. package/dist/cjs/nodes/ai/ai-text-classifier.js +20 -5
  252. package/dist/cjs/nodes/ai/ai-text-classifier.js.map +1 -1
  253. package/dist/cjs/nodes/ai/ai-text-transform.d.ts.map +1 -1
  254. package/dist/cjs/nodes/ai/ai-text-transform.js +20 -5
  255. package/dist/cjs/nodes/ai/ai-text-transform.js.map +1 -1
  256. package/dist/cjs/nodes/analytics/analytics-track-outcome.d.ts +3 -0
  257. package/dist/cjs/nodes/analytics/analytics-track-outcome.d.ts.map +1 -0
  258. package/dist/cjs/nodes/analytics/analytics-track-outcome.js +110 -0
  259. package/dist/cjs/nodes/analytics/analytics-track-outcome.js.map +1 -0
  260. package/dist/cjs/nodes/cart/cart-price-order.d.ts.map +1 -1
  261. package/dist/cjs/nodes/cart/cart-price-order.js +161 -2
  262. package/dist/cjs/nodes/cart/cart-price-order.js.map +1 -1
  263. package/dist/cjs/nodes/cost-bearing-node-types.d.ts +4 -0
  264. package/dist/cjs/nodes/cost-bearing-node-types.d.ts.map +1 -0
  265. package/dist/cjs/nodes/cost-bearing-node-types.js +43 -0
  266. package/dist/cjs/nodes/cost-bearing-node-types.js.map +1 -0
  267. package/dist/cjs/nodes/data/data-select.d.ts.map +1 -1
  268. package/dist/cjs/nodes/data/data-select.js +12 -2
  269. package/dist/cjs/nodes/data/data-select.js.map +1 -1
  270. package/dist/cjs/nodes/email/email-mailersend.d.ts.map +1 -1
  271. package/dist/cjs/nodes/email/email-mailersend.js +15 -11
  272. package/dist/cjs/nodes/email/email-mailersend.js.map +1 -1
  273. package/dist/cjs/nodes/email/email-mailgun.d.ts.map +1 -1
  274. package/dist/cjs/nodes/email/email-mailgun.js +15 -15
  275. package/dist/cjs/nodes/email/email-mailgun.js.map +1 -1
  276. package/dist/cjs/nodes/email/email-postmark.d.ts.map +1 -1
  277. package/dist/cjs/nodes/email/email-postmark.js +15 -15
  278. package/dist/cjs/nodes/email/email-postmark.js.map +1 -1
  279. package/dist/cjs/nodes/email/email-resend.d.ts.map +1 -1
  280. package/dist/cjs/nodes/email/email-resend.js +15 -15
  281. package/dist/cjs/nodes/email/email-resend.js.map +1 -1
  282. package/dist/cjs/nodes/email/email-sendgrid.d.ts.map +1 -1
  283. package/dist/cjs/nodes/email/email-sendgrid.js +15 -15
  284. package/dist/cjs/nodes/email/email-sendgrid.js.map +1 -1
  285. package/dist/cjs/nodes/email/html-escape-code.d.ts +3 -0
  286. package/dist/cjs/nodes/email/html-escape-code.d.ts.map +1 -0
  287. package/dist/cjs/nodes/email/html-escape-code.js +23 -0
  288. package/dist/cjs/nodes/email/html-escape-code.js.map +1 -0
  289. package/dist/cjs/nodes/email/message-trust.d.ts +40 -0
  290. package/dist/cjs/nodes/email/message-trust.d.ts.map +1 -0
  291. package/dist/cjs/nodes/email/message-trust.js +167 -0
  292. package/dist/cjs/nodes/email/message-trust.js.map +1 -0
  293. package/dist/cjs/nodes/email/outbound-message-guard.d.ts +113 -0
  294. package/dist/cjs/nodes/email/outbound-message-guard.d.ts.map +1 -0
  295. package/dist/cjs/nodes/email/outbound-message-guard.js +460 -0
  296. package/dist/cjs/nodes/email/outbound-message-guard.js.map +1 -0
  297. package/dist/cjs/nodes/email/trusted-html-code.d.ts +22 -0
  298. package/dist/cjs/nodes/email/trusted-html-code.d.ts.map +1 -0
  299. package/dist/cjs/nodes/email/trusted-html-code.js +52 -0
  300. package/dist/cjs/nodes/email/trusted-html-code.js.map +1 -0
  301. package/dist/cjs/nodes/general/general-custom-js.d.ts.map +1 -1
  302. package/dist/cjs/nodes/general/general-custom-js.js +44 -7
  303. package/dist/cjs/nodes/general/general-custom-js.js.map +1 -1
  304. package/dist/cjs/nodes/general/general-http-request.d.ts.map +1 -1
  305. package/dist/cjs/nodes/general/general-http-request.js +431 -45
  306. package/dist/cjs/nodes/general/general-http-request.js.map +1 -1
  307. package/dist/cjs/nodes/general/general-rate-limiter.d.ts.map +1 -1
  308. package/dist/cjs/nodes/general/general-rate-limiter.js +46 -78
  309. package/dist/cjs/nodes/general/general-rate-limiter.js.map +1 -1
  310. package/dist/cjs/nodes/general/general-wait.d.ts +3 -0
  311. package/dist/cjs/nodes/general/general-wait.d.ts.map +1 -0
  312. package/dist/cjs/nodes/general/general-wait.js +81 -0
  313. package/dist/cjs/nodes/general/general-wait.js.map +1 -0
  314. package/dist/cjs/nodes/general/visitor-request.d.ts +44 -0
  315. package/dist/cjs/nodes/general/visitor-request.d.ts.map +1 -0
  316. package/dist/cjs/nodes/general/visitor-request.js +72 -0
  317. package/dist/cjs/nodes/general/visitor-request.js.map +1 -0
  318. package/dist/cjs/nodes/index.d.ts.map +1 -1
  319. package/dist/cjs/nodes/index.js +7 -1
  320. package/dist/cjs/nodes/index.js.map +1 -1
  321. package/dist/cjs/nodes/integrations/integration-slack.d.ts.map +1 -1
  322. package/dist/cjs/nodes/integrations/integration-slack.js +17 -6
  323. package/dist/cjs/nodes/integrations/integration-slack.js.map +1 -1
  324. package/dist/cjs/nodes/newsletter/newsletter-confirm.d.ts +3 -0
  325. package/dist/cjs/nodes/newsletter/newsletter-confirm.d.ts.map +1 -0
  326. package/dist/cjs/nodes/newsletter/newsletter-confirm.js +41 -0
  327. package/dist/cjs/nodes/newsletter/newsletter-confirm.js.map +1 -0
  328. package/dist/cjs/nodes/newsletter/newsletter-subscribe.d.ts +7 -0
  329. package/dist/cjs/nodes/newsletter/newsletter-subscribe.d.ts.map +1 -0
  330. package/dist/cjs/nodes/newsletter/newsletter-subscribe.js +69 -0
  331. package/dist/cjs/nodes/newsletter/newsletter-subscribe.js.map +1 -0
  332. package/dist/cjs/nodes/newsletter/newsletter-unsubscribe.d.ts +3 -0
  333. package/dist/cjs/nodes/newsletter/newsletter-unsubscribe.d.ts.map +1 -0
  334. package/dist/cjs/nodes/newsletter/newsletter-unsubscribe.js +42 -0
  335. package/dist/cjs/nodes/newsletter/newsletter-unsubscribe.js.map +1 -0
  336. package/dist/cjs/nodes/realtime/realtime-join-channel.d.ts.map +1 -1
  337. package/dist/cjs/nodes/realtime/realtime-join-channel.js +5 -4
  338. package/dist/cjs/nodes/realtime/realtime-join-channel.js.map +1 -1
  339. package/dist/cjs/nodes/realtime/realtime-send-channel-event.d.ts.map +1 -1
  340. package/dist/cjs/nodes/realtime/realtime-send-channel-event.js +11 -2
  341. package/dist/cjs/nodes/realtime/realtime-send-channel-event.js.map +1 -1
  342. package/dist/cjs/nodes/realtime/realtime-send-channel-message.d.ts.map +1 -1
  343. package/dist/cjs/nodes/realtime/realtime-send-channel-message.js +11 -2
  344. package/dist/cjs/nodes/realtime/realtime-send-channel-message.js.map +1 -1
  345. package/dist/cjs/nodes/sms/sms-infobip.d.ts.map +1 -1
  346. package/dist/cjs/nodes/sms/sms-infobip.js +11 -8
  347. package/dist/cjs/nodes/sms/sms-infobip.js.map +1 -1
  348. package/dist/cjs/nodes/sms/sms-smsapi.d.ts.map +1 -1
  349. package/dist/cjs/nodes/sms/sms-smsapi.js +11 -8
  350. package/dist/cjs/nodes/sms/sms-smsapi.js.map +1 -1
  351. package/dist/cjs/nodes/sms/sms-textmagic.d.ts.map +1 -1
  352. package/dist/cjs/nodes/sms/sms-textmagic.js +11 -8
  353. package/dist/cjs/nodes/sms/sms-textmagic.js.map +1 -1
  354. package/dist/cjs/nodes/sms/sms-twilio.d.ts.map +1 -1
  355. package/dist/cjs/nodes/sms/sms-twilio.js +12 -10
  356. package/dist/cjs/nodes/sms/sms-twilio.js.map +1 -1
  357. package/dist/cjs/nodes/types.d.ts +8 -1
  358. package/dist/cjs/nodes/types.d.ts.map +1 -1
  359. package/dist/cjs/nodes/utility/utility-similarity-scoring.d.ts.map +1 -1
  360. package/dist/cjs/nodes/utility/utility-similarity-scoring.js +29 -10
  361. package/dist/cjs/nodes/utility/utility-similarity-scoring.js.map +1 -1
  362. package/dist/cjs/page-access-guard-generator.d.ts +23 -0
  363. package/dist/cjs/page-access-guard-generator.d.ts.map +1 -0
  364. package/dist/cjs/page-access-guard-generator.js +135 -0
  365. package/dist/cjs/page-access-guard-generator.js.map +1 -0
  366. package/dist/cjs/password-reset-route-generator.d.ts +119 -0
  367. package/dist/cjs/password-reset-route-generator.d.ts.map +1 -0
  368. package/dist/cjs/password-reset-route-generator.js +460 -0
  369. package/dist/cjs/password-reset-route-generator.js.map +1 -0
  370. package/dist/cjs/payments/payment-core-code.d.ts.map +1 -1
  371. package/dist/cjs/payments/payment-core-code.js +12 -7
  372. package/dist/cjs/payments/payment-core-code.js.map +1 -1
  373. package/dist/cjs/project-code-scanner.d.ts +11 -0
  374. package/dist/cjs/project-code-scanner.d.ts.map +1 -0
  375. package/dist/cjs/project-code-scanner.js +80 -0
  376. package/dist/cjs/project-code-scanner.js.map +1 -0
  377. package/dist/cjs/public-step-guards.d.ts +122 -0
  378. package/dist/cjs/public-step-guards.d.ts.map +1 -0
  379. package/dist/cjs/public-step-guards.js +288 -0
  380. package/dist/cjs/public-step-guards.js.map +1 -0
  381. package/dist/cjs/publish-refusals.d.ts +66 -0
  382. package/dist/cjs/publish-refusals.d.ts.map +1 -0
  383. package/dist/cjs/publish-refusals.js +278 -0
  384. package/dist/cjs/publish-refusals.js.map +1 -0
  385. package/dist/cjs/realtime-generator.d.ts +63 -1
  386. package/dist/cjs/realtime-generator.d.ts.map +1 -1
  387. package/dist/cjs/realtime-generator.js +404 -230
  388. package/dist/cjs/realtime-generator.js.map +1 -1
  389. package/dist/cjs/runtime-storage-generator.d.ts +32 -1
  390. package/dist/cjs/runtime-storage-generator.d.ts.map +1 -1
  391. package/dist/cjs/runtime-storage-generator.js +265 -12
  392. package/dist/cjs/runtime-storage-generator.js.map +1 -1
  393. package/dist/cjs/security-runtime/index.d.ts +14 -0
  394. package/dist/cjs/security-runtime/index.d.ts.map +1 -0
  395. package/dist/cjs/security-runtime/index.js +48 -0
  396. package/dist/cjs/security-runtime/index.js.map +1 -0
  397. package/dist/cjs/security-runtime/security-runtime-code.d.ts +53 -0
  398. package/dist/cjs/security-runtime/security-runtime-code.d.ts.map +1 -0
  399. package/dist/cjs/security-runtime/security-runtime-code.js +580 -0
  400. package/dist/cjs/security-runtime/security-runtime-code.js.map +1 -0
  401. package/dist/cjs/security-scanner.d.ts +72 -3
  402. package/dist/cjs/security-scanner.d.ts.map +1 -1
  403. package/dist/cjs/security-scanner.js +220 -8
  404. package/dist/cjs/security-scanner.js.map +1 -1
  405. package/dist/cjs/segment-splitter.d.ts.map +1 -1
  406. package/dist/cjs/segment-splitter.js +10 -2
  407. package/dist/cjs/segment-splitter.js.map +1 -1
  408. package/dist/cjs/segment-trust.d.ts +36 -0
  409. package/dist/cjs/segment-trust.d.ts.map +1 -1
  410. package/dist/cjs/segment-trust.js +147 -3
  411. package/dist/cjs/segment-trust.js.map +1 -1
  412. package/dist/cjs/self-call-headers.d.ts +31 -0
  413. package/dist/cjs/self-call-headers.d.ts.map +1 -0
  414. package/dist/cjs/self-call-headers.js +48 -0
  415. package/dist/cjs/self-call-headers.js.map +1 -0
  416. package/dist/cjs/sent-email-log/index.d.ts +7 -0
  417. package/dist/cjs/sent-email-log/index.d.ts.map +1 -1
  418. package/dist/cjs/sent-email-log/index.js +17 -1
  419. package/dist/cjs/sent-email-log/index.js.map +1 -1
  420. package/dist/cjs/sent-email-log/sent-email-log-code.d.ts +7 -0
  421. package/dist/cjs/sent-email-log/sent-email-log-code.d.ts.map +1 -1
  422. package/dist/cjs/sent-email-log/sent-email-log-code.js +17 -3
  423. package/dist/cjs/sent-email-log/sent-email-log-code.js.map +1 -1
  424. package/dist/cjs/server-custom-node-call.d.ts +79 -0
  425. package/dist/cjs/server-custom-node-call.d.ts.map +1 -0
  426. package/dist/cjs/server-custom-node-call.js +285 -0
  427. package/dist/cjs/server-custom-node-call.js.map +1 -0
  428. package/dist/cjs/server-runtime-code.d.ts +39 -12
  429. package/dist/cjs/server-runtime-code.d.ts.map +1 -1
  430. package/dist/cjs/server-runtime-code.js +484 -41
  431. package/dist/cjs/server-runtime-code.js.map +1 -1
  432. package/dist/cjs/session-cookie-resolver.d.ts +3 -1
  433. package/dist/cjs/session-cookie-resolver.d.ts.map +1 -1
  434. package/dist/cjs/session-revocation-generator.d.ts +39 -0
  435. package/dist/cjs/session-revocation-generator.d.ts.map +1 -0
  436. package/dist/cjs/session-revocation-generator.js +177 -0
  437. package/dist/cjs/session-revocation-generator.js.map +1 -0
  438. package/dist/cjs/slack-message-values.d.ts +6 -0
  439. package/dist/cjs/slack-message-values.d.ts.map +1 -0
  440. package/dist/cjs/slack-message-values.js +73 -0
  441. package/dist/cjs/slack-message-values.js.map +1 -0
  442. package/dist/cjs/transactional-email-code.d.ts +11 -0
  443. package/dist/cjs/transactional-email-code.d.ts.map +1 -1
  444. package/dist/cjs/transactional-email-code.js +29 -5
  445. package/dist/cjs/transactional-email-code.js.map +1 -1
  446. package/dist/cjs/trigger-generator.d.ts +2 -0
  447. package/dist/cjs/trigger-generator.d.ts.map +1 -1
  448. package/dist/cjs/trigger-generator.js +17 -4
  449. package/dist/cjs/trigger-generator.js.map +1 -1
  450. package/dist/cjs/tsconfig.tsbuildinfo +1 -1
  451. package/dist/cjs/visitor-step-limits.d.ts +66 -0
  452. package/dist/cjs/visitor-step-limits.d.ts.map +1 -0
  453. package/dist/cjs/visitor-step-limits.js +187 -0
  454. package/dist/cjs/visitor-step-limits.js.map +1 -0
  455. package/dist/cjs/webhook-generator.d.ts.map +1 -1
  456. package/dist/cjs/webhook-generator.js +93 -15
  457. package/dist/cjs/webhook-generator.js.map +1 -1
  458. package/dist/cjs/webhook-signature-verification.d.ts.map +1 -1
  459. package/dist/cjs/webhook-signature-verification.js +13 -3
  460. package/dist/cjs/webhook-signature-verification.js.map +1 -1
  461. package/dist/cjs/workflow-auth-generator.d.ts +4 -1
  462. package/dist/cjs/workflow-auth-generator.d.ts.map +1 -1
  463. package/dist/cjs/workflow-auth-generator.js +8 -3
  464. package/dist/cjs/workflow-auth-generator.js.map +1 -1
  465. package/dist/cjs/workflow-component-plugin.js +11 -3
  466. package/dist/cjs/workflow-component-plugin.js.map +1 -1
  467. package/dist/cjs/workflow-project-plugin.d.ts.map +1 -1
  468. package/dist/cjs/workflow-project-plugin.js +302 -56
  469. package/dist/cjs/workflow-project-plugin.js.map +1 -1
  470. package/dist/cjs/workflow-scope.d.ts.map +1 -1
  471. package/dist/cjs/workflow-scope.js +5 -0
  472. package/dist/cjs/workflow-scope.js.map +1 -1
  473. package/dist/esm/account-delete-route-generator.d.ts +1 -0
  474. package/dist/esm/account-delete-route-generator.d.ts.map +1 -1
  475. package/dist/esm/account-delete-route-generator.js +18 -3
  476. package/dist/esm/account-delete-route-generator.js.map +1 -1
  477. package/dist/esm/api-route-generator.d.ts +52 -3
  478. package/dist/esm/api-route-generator.d.ts.map +1 -1
  479. package/dist/esm/api-route-generator.js +595 -142
  480. package/dist/esm/api-route-generator.js.map +1 -1
  481. package/dist/esm/auth-generator.d.ts +126 -3
  482. package/dist/esm/auth-generator.d.ts.map +1 -1
  483. package/dist/esm/auth-generator.js +1350 -140
  484. package/dist/esm/auth-generator.js.map +1 -1
  485. package/dist/esm/automations/activity-kicks.d.ts +12 -0
  486. package/dist/esm/automations/activity-kicks.d.ts.map +1 -0
  487. package/dist/esm/automations/activity-kicks.js +118 -0
  488. package/dist/esm/automations/activity-kicks.js.map +1 -0
  489. package/dist/esm/automations/app-events-source.d.ts +33 -0
  490. package/dist/esm/automations/app-events-source.d.ts.map +1 -0
  491. package/dist/esm/automations/app-events-source.js +104 -0
  492. package/dist/esm/automations/app-events-source.js.map +1 -0
  493. package/dist/esm/automations/automations-project-plugin.d.ts +21 -0
  494. package/dist/esm/automations/automations-project-plugin.d.ts.map +1 -0
  495. package/dist/esm/automations/automations-project-plugin.js +98 -0
  496. package/dist/esm/automations/automations-project-plugin.js.map +1 -0
  497. package/dist/esm/automations/automations-scope.d.ts +104 -0
  498. package/dist/esm/automations/automations-scope.d.ts.map +1 -0
  499. package/dist/esm/automations/automations-scope.js +165 -0
  500. package/dist/esm/automations/automations-scope.js.map +1 -0
  501. package/dist/esm/automations/dispatcher-source.d.ts +72 -0
  502. package/dist/esm/automations/dispatcher-source.d.ts.map +1 -0
  503. package/dist/esm/automations/dispatcher-source.js +999 -0
  504. package/dist/esm/automations/dispatcher-source.js.map +1 -0
  505. package/dist/esm/automations/event-bus-source.d.ts +44 -0
  506. package/dist/esm/automations/event-bus-source.d.ts.map +1 -0
  507. package/dist/esm/automations/event-bus-source.js +421 -0
  508. package/dist/esm/automations/event-bus-source.js.map +1 -0
  509. package/dist/esm/automations/handler-module-generator.d.ts +25 -0
  510. package/dist/esm/automations/handler-module-generator.d.ts.map +1 -0
  511. package/dist/esm/automations/handler-module-generator.js +71 -0
  512. package/dist/esm/automations/handler-module-generator.js.map +1 -0
  513. package/dist/esm/automations/hydrators-source.d.ts +33 -0
  514. package/dist/esm/automations/hydrators-source.d.ts.map +1 -0
  515. package/dist/esm/automations/hydrators-source.js +567 -0
  516. package/dist/esm/automations/hydrators-source.js.map +1 -0
  517. package/dist/esm/booking-calendar-feed-route-generator.d.ts.map +1 -1
  518. package/dist/esm/booking-calendar-feed-route-generator.js +8 -0
  519. package/dist/esm/booking-calendar-feed-route-generator.js.map +1 -1
  520. package/dist/esm/configured-nextauth-url.d.ts +17 -0
  521. package/dist/esm/configured-nextauth-url.d.ts.map +1 -0
  522. package/dist/esm/configured-nextauth-url.js +17 -0
  523. package/dist/esm/configured-nextauth-url.js.map +1 -0
  524. package/dist/esm/cron-request-verification.d.ts +22 -1
  525. package/dist/esm/cron-request-verification.d.ts.map +1 -1
  526. package/dist/esm/cron-request-verification.js +48 -5
  527. package/dist/esm/cron-request-verification.js.map +1 -1
  528. package/dist/esm/data-api-route-generator.d.ts +19 -0
  529. package/dist/esm/data-api-route-generator.d.ts.map +1 -1
  530. package/dist/esm/data-api-route-generator.js +710 -43
  531. package/dist/esm/data-api-route-generator.js.map +1 -1
  532. package/dist/esm/ecommerce/parameterized-stock-chain.d.ts +3 -1
  533. package/dist/esm/ecommerce/parameterized-stock-chain.d.ts.map +1 -1
  534. package/dist/esm/ecommerce/parameterized-stock-chain.js +43 -4
  535. package/dist/esm/ecommerce/parameterized-stock-chain.js.map +1 -1
  536. package/dist/esm/ecommerce/place-order-guards.d.ts +126 -0
  537. package/dist/esm/ecommerce/place-order-guards.d.ts.map +1 -0
  538. package/dist/esm/ecommerce/place-order-guards.js +655 -0
  539. package/dist/esm/ecommerce/place-order-guards.js.map +1 -0
  540. package/dist/esm/ecommerce-customhandler-rewriter.d.ts +2 -0
  541. package/dist/esm/ecommerce-customhandler-rewriter.d.ts.map +1 -1
  542. package/dist/esm/ecommerce-customhandler-rewriter.js +38 -2
  543. package/dist/esm/ecommerce-customhandler-rewriter.js.map +1 -1
  544. package/dist/esm/executor-generator.d.ts.map +1 -1
  545. package/dist/esm/executor-generator.js +368 -60
  546. package/dist/esm/executor-generator.js.map +1 -1
  547. package/dist/esm/graph-utils.d.ts +9 -0
  548. package/dist/esm/graph-utils.d.ts.map +1 -1
  549. package/dist/esm/graph-utils.js +30 -0
  550. package/dist/esm/graph-utils.js.map +1 -1
  551. package/dist/esm/index.d.ts +20 -1
  552. package/dist/esm/index.d.ts.map +1 -1
  553. package/dist/esm/index.js +27 -1
  554. package/dist/esm/index.js.map +1 -1
  555. package/dist/esm/invoice/api-routes-code.d.ts +9 -3
  556. package/dist/esm/invoice/api-routes-code.d.ts.map +1 -1
  557. package/dist/esm/invoice/api-routes-code.js +9 -7
  558. package/dist/esm/invoice/api-routes-code.js.map +1 -1
  559. package/dist/esm/invoice/index.d.ts.map +1 -1
  560. package/dist/esm/invoice/index.js +12 -7
  561. package/dist/esm/invoice/index.js.map +1 -1
  562. package/dist/esm/invoice/invoice-assembly-code.d.ts.map +1 -1
  563. package/dist/esm/invoice/invoice-assembly-code.js +8 -3
  564. package/dist/esm/invoice/invoice-assembly-code.js.map +1 -1
  565. package/dist/esm/invoice/pdf-generator-code.d.ts.map +1 -1
  566. package/dist/esm/invoice/pdf-generator-code.js +2 -1
  567. package/dist/esm/invoice/pdf-generator-code.js.map +1 -1
  568. package/dist/esm/invoice/pdf-service-client-code.d.ts.map +1 -1
  569. package/dist/esm/invoice/pdf-service-client-code.js +15 -7
  570. package/dist/esm/invoice/pdf-service-client-code.js.map +1 -1
  571. package/dist/esm/newsletter/admin-route-code.d.ts +60 -0
  572. package/dist/esm/newsletter/admin-route-code.d.ts.map +1 -0
  573. package/dist/esm/newsletter/admin-route-code.js +295 -0
  574. package/dist/esm/newsletter/admin-route-code.js.map +1 -0
  575. package/dist/esm/newsletter/helper-code.d.ts +109 -0
  576. package/dist/esm/newsletter/helper-code.d.ts.map +1 -0
  577. package/dist/esm/newsletter/helper-code.js +656 -0
  578. package/dist/esm/newsletter/helper-code.js.map +1 -0
  579. package/dist/esm/newsletter/newsletter-scope.d.ts +65 -0
  580. package/dist/esm/newsletter/newsletter-scope.d.ts.map +1 -0
  581. package/dist/esm/newsletter/newsletter-scope.js +97 -0
  582. package/dist/esm/newsletter/newsletter-scope.js.map +1 -0
  583. package/dist/esm/newsletter/project-plugin.d.ts +18 -0
  584. package/dist/esm/newsletter/project-plugin.d.ts.map +1 -0
  585. package/dist/esm/newsletter/project-plugin.js +93 -0
  586. package/dist/esm/newsletter/project-plugin.js.map +1 -0
  587. package/dist/esm/newsletter/routes-code.d.ts +6 -0
  588. package/dist/esm/newsletter/routes-code.d.ts.map +1 -0
  589. package/dist/esm/newsletter/routes-code.js +175 -0
  590. package/dist/esm/newsletter/routes-code.js.map +1 -0
  591. package/dist/esm/nodes/account/account-compare-passwords.d.ts.map +1 -1
  592. package/dist/esm/nodes/account/account-compare-passwords.js +16 -6
  593. package/dist/esm/nodes/account/account-compare-passwords.js.map +1 -1
  594. package/dist/esm/nodes/account/account-delete-current.js +1 -1
  595. package/dist/esm/nodes/account/account-get-current.js +1 -1
  596. package/dist/esm/nodes/account/account-hash-password.d.ts.map +1 -1
  597. package/dist/esm/nodes/account/account-hash-password.js +15 -3
  598. package/dist/esm/nodes/account/account-hash-password.js.map +1 -1
  599. package/dist/esm/nodes/account/account-login.d.ts.map +1 -1
  600. package/dist/esm/nodes/account/account-login.js +23 -6
  601. package/dist/esm/nodes/account/account-login.js.map +1 -1
  602. package/dist/esm/nodes/account/account-logout.js +1 -1
  603. package/dist/esm/nodes/account/account-refresh-session.js +1 -1
  604. package/dist/esm/nodes/account/account-request-password-reset.d.ts +3 -0
  605. package/dist/esm/nodes/account/account-request-password-reset.d.ts.map +1 -0
  606. package/dist/esm/nodes/account/account-request-password-reset.js +43 -0
  607. package/dist/esm/nodes/account/account-request-password-reset.js.map +1 -0
  608. package/dist/esm/nodes/account/account-reset-password.d.ts +3 -0
  609. package/dist/esm/nodes/account/account-reset-password.d.ts.map +1 -0
  610. package/dist/esm/nodes/account/account-reset-password.js +41 -0
  611. package/dist/esm/nodes/account/account-reset-password.js.map +1 -0
  612. package/dist/esm/nodes/account/account-signup.d.ts.map +1 -1
  613. package/dist/esm/nodes/account/account-signup.js +82 -19
  614. package/dist/esm/nodes/account/account-signup.js.map +1 -1
  615. package/dist/esm/nodes/account/account-social-login.js +1 -1
  616. package/dist/esm/nodes/ai/ai-custom-prompt.d.ts.map +1 -1
  617. package/dist/esm/nodes/ai/ai-custom-prompt.js +20 -5
  618. package/dist/esm/nodes/ai/ai-custom-prompt.js.map +1 -1
  619. package/dist/esm/nodes/ai/ai-detect-language.d.ts.map +1 -1
  620. package/dist/esm/nodes/ai/ai-detect-language.js +20 -5
  621. package/dist/esm/nodes/ai/ai-detect-language.js.map +1 -1
  622. package/dist/esm/nodes/ai/ai-generate-text-embedding.d.ts.map +1 -1
  623. package/dist/esm/nodes/ai/ai-generate-text-embedding.js +10 -2
  624. package/dist/esm/nodes/ai/ai-generate-text-embedding.js.map +1 -1
  625. package/dist/esm/nodes/ai/ai-provider-utils-sources.generated.js +2 -2
  626. package/dist/esm/nodes/ai/ai-provider-utils-sources.generated.js.map +1 -1
  627. package/dist/esm/nodes/ai/ai-provider-utils.d.ts +31 -2
  628. package/dist/esm/nodes/ai/ai-provider-utils.d.ts.map +1 -1
  629. package/dist/esm/nodes/ai/ai-provider-utils.js +124 -10
  630. package/dist/esm/nodes/ai/ai-provider-utils.js.map +1 -1
  631. package/dist/esm/nodes/ai/ai-select-database-data.d.ts.map +1 -1
  632. package/dist/esm/nodes/ai/ai-select-database-data.js +6 -2
  633. package/dist/esm/nodes/ai/ai-select-database-data.js.map +1 -1
  634. package/dist/esm/nodes/ai/ai-sentiment-analysis.d.ts.map +1 -1
  635. package/dist/esm/nodes/ai/ai-sentiment-analysis.js +20 -5
  636. package/dist/esm/nodes/ai/ai-sentiment-analysis.js.map +1 -1
  637. package/dist/esm/nodes/ai/ai-summarization.d.ts.map +1 -1
  638. package/dist/esm/nodes/ai/ai-summarization.js +20 -5
  639. package/dist/esm/nodes/ai/ai-summarization.js.map +1 -1
  640. package/dist/esm/nodes/ai/ai-text-classifier.d.ts.map +1 -1
  641. package/dist/esm/nodes/ai/ai-text-classifier.js +20 -5
  642. package/dist/esm/nodes/ai/ai-text-classifier.js.map +1 -1
  643. package/dist/esm/nodes/ai/ai-text-transform.d.ts.map +1 -1
  644. package/dist/esm/nodes/ai/ai-text-transform.js +20 -5
  645. package/dist/esm/nodes/ai/ai-text-transform.js.map +1 -1
  646. package/dist/esm/nodes/analytics/analytics-track-outcome.d.ts +3 -0
  647. package/dist/esm/nodes/analytics/analytics-track-outcome.d.ts.map +1 -0
  648. package/dist/esm/nodes/analytics/analytics-track-outcome.js +107 -0
  649. package/dist/esm/nodes/analytics/analytics-track-outcome.js.map +1 -0
  650. package/dist/esm/nodes/cart/cart-price-order.d.ts.map +1 -1
  651. package/dist/esm/nodes/cart/cart-price-order.js +161 -2
  652. package/dist/esm/nodes/cart/cart-price-order.js.map +1 -1
  653. package/dist/esm/nodes/cost-bearing-node-types.d.ts +4 -0
  654. package/dist/esm/nodes/cost-bearing-node-types.d.ts.map +1 -0
  655. package/dist/esm/nodes/cost-bearing-node-types.js +39 -0
  656. package/dist/esm/nodes/cost-bearing-node-types.js.map +1 -0
  657. package/dist/esm/nodes/data/data-select.d.ts.map +1 -1
  658. package/dist/esm/nodes/data/data-select.js +12 -2
  659. package/dist/esm/nodes/data/data-select.js.map +1 -1
  660. package/dist/esm/nodes/email/email-mailersend.d.ts.map +1 -1
  661. package/dist/esm/nodes/email/email-mailersend.js +15 -11
  662. package/dist/esm/nodes/email/email-mailersend.js.map +1 -1
  663. package/dist/esm/nodes/email/email-mailgun.d.ts.map +1 -1
  664. package/dist/esm/nodes/email/email-mailgun.js +15 -15
  665. package/dist/esm/nodes/email/email-mailgun.js.map +1 -1
  666. package/dist/esm/nodes/email/email-postmark.d.ts.map +1 -1
  667. package/dist/esm/nodes/email/email-postmark.js +15 -15
  668. package/dist/esm/nodes/email/email-postmark.js.map +1 -1
  669. package/dist/esm/nodes/email/email-resend.d.ts.map +1 -1
  670. package/dist/esm/nodes/email/email-resend.js +15 -15
  671. package/dist/esm/nodes/email/email-resend.js.map +1 -1
  672. package/dist/esm/nodes/email/email-sendgrid.d.ts.map +1 -1
  673. package/dist/esm/nodes/email/email-sendgrid.js +15 -15
  674. package/dist/esm/nodes/email/email-sendgrid.js.map +1 -1
  675. package/dist/esm/nodes/email/html-escape-code.d.ts +3 -0
  676. package/dist/esm/nodes/email/html-escape-code.d.ts.map +1 -0
  677. package/dist/esm/nodes/email/html-escape-code.js +18 -0
  678. package/dist/esm/nodes/email/html-escape-code.js.map +1 -0
  679. package/dist/esm/nodes/email/message-trust.d.ts +40 -0
  680. package/dist/esm/nodes/email/message-trust.d.ts.map +1 -0
  681. package/dist/esm/nodes/email/message-trust.js +161 -0
  682. package/dist/esm/nodes/email/message-trust.js.map +1 -0
  683. package/dist/esm/nodes/email/outbound-message-guard.d.ts +113 -0
  684. package/dist/esm/nodes/email/outbound-message-guard.d.ts.map +1 -0
  685. package/dist/esm/nodes/email/outbound-message-guard.js +452 -0
  686. package/dist/esm/nodes/email/outbound-message-guard.js.map +1 -0
  687. package/dist/esm/nodes/email/trusted-html-code.d.ts +22 -0
  688. package/dist/esm/nodes/email/trusted-html-code.d.ts.map +1 -0
  689. package/dist/esm/nodes/email/trusted-html-code.js +49 -0
  690. package/dist/esm/nodes/email/trusted-html-code.js.map +1 -0
  691. package/dist/esm/nodes/general/general-custom-js.d.ts.map +1 -1
  692. package/dist/esm/nodes/general/general-custom-js.js +44 -7
  693. package/dist/esm/nodes/general/general-custom-js.js.map +1 -1
  694. package/dist/esm/nodes/general/general-http-request.d.ts.map +1 -1
  695. package/dist/esm/nodes/general/general-http-request.js +431 -45
  696. package/dist/esm/nodes/general/general-http-request.js.map +1 -1
  697. package/dist/esm/nodes/general/general-rate-limiter.d.ts.map +1 -1
  698. package/dist/esm/nodes/general/general-rate-limiter.js +46 -78
  699. package/dist/esm/nodes/general/general-rate-limiter.js.map +1 -1
  700. package/dist/esm/nodes/general/general-wait.d.ts +3 -0
  701. package/dist/esm/nodes/general/general-wait.d.ts.map +1 -0
  702. package/dist/esm/nodes/general/general-wait.js +78 -0
  703. package/dist/esm/nodes/general/general-wait.js.map +1 -0
  704. package/dist/esm/nodes/general/visitor-request.d.ts +44 -0
  705. package/dist/esm/nodes/general/visitor-request.d.ts.map +1 -0
  706. package/dist/esm/nodes/general/visitor-request.js +65 -0
  707. package/dist/esm/nodes/general/visitor-request.js.map +1 -0
  708. package/dist/esm/nodes/index.d.ts.map +1 -1
  709. package/dist/esm/nodes/index.js +7 -1
  710. package/dist/esm/nodes/index.js.map +1 -1
  711. package/dist/esm/nodes/integrations/integration-slack.d.ts.map +1 -1
  712. package/dist/esm/nodes/integrations/integration-slack.js +17 -6
  713. package/dist/esm/nodes/integrations/integration-slack.js.map +1 -1
  714. package/dist/esm/nodes/newsletter/newsletter-confirm.d.ts +3 -0
  715. package/dist/esm/nodes/newsletter/newsletter-confirm.d.ts.map +1 -0
  716. package/dist/esm/nodes/newsletter/newsletter-confirm.js +38 -0
  717. package/dist/esm/nodes/newsletter/newsletter-confirm.js.map +1 -0
  718. package/dist/esm/nodes/newsletter/newsletter-subscribe.d.ts +7 -0
  719. package/dist/esm/nodes/newsletter/newsletter-subscribe.d.ts.map +1 -0
  720. package/dist/esm/nodes/newsletter/newsletter-subscribe.js +66 -0
  721. package/dist/esm/nodes/newsletter/newsletter-subscribe.js.map +1 -0
  722. package/dist/esm/nodes/newsletter/newsletter-unsubscribe.d.ts +3 -0
  723. package/dist/esm/nodes/newsletter/newsletter-unsubscribe.d.ts.map +1 -0
  724. package/dist/esm/nodes/newsletter/newsletter-unsubscribe.js +39 -0
  725. package/dist/esm/nodes/newsletter/newsletter-unsubscribe.js.map +1 -0
  726. package/dist/esm/nodes/realtime/realtime-join-channel.d.ts.map +1 -1
  727. package/dist/esm/nodes/realtime/realtime-join-channel.js +5 -4
  728. package/dist/esm/nodes/realtime/realtime-join-channel.js.map +1 -1
  729. package/dist/esm/nodes/realtime/realtime-send-channel-event.d.ts.map +1 -1
  730. package/dist/esm/nodes/realtime/realtime-send-channel-event.js +11 -2
  731. package/dist/esm/nodes/realtime/realtime-send-channel-event.js.map +1 -1
  732. package/dist/esm/nodes/realtime/realtime-send-channel-message.d.ts.map +1 -1
  733. package/dist/esm/nodes/realtime/realtime-send-channel-message.js +11 -2
  734. package/dist/esm/nodes/realtime/realtime-send-channel-message.js.map +1 -1
  735. package/dist/esm/nodes/sms/sms-infobip.d.ts.map +1 -1
  736. package/dist/esm/nodes/sms/sms-infobip.js +11 -8
  737. package/dist/esm/nodes/sms/sms-infobip.js.map +1 -1
  738. package/dist/esm/nodes/sms/sms-smsapi.d.ts.map +1 -1
  739. package/dist/esm/nodes/sms/sms-smsapi.js +11 -8
  740. package/dist/esm/nodes/sms/sms-smsapi.js.map +1 -1
  741. package/dist/esm/nodes/sms/sms-textmagic.d.ts.map +1 -1
  742. package/dist/esm/nodes/sms/sms-textmagic.js +11 -8
  743. package/dist/esm/nodes/sms/sms-textmagic.js.map +1 -1
  744. package/dist/esm/nodes/sms/sms-twilio.d.ts.map +1 -1
  745. package/dist/esm/nodes/sms/sms-twilio.js +12 -10
  746. package/dist/esm/nodes/sms/sms-twilio.js.map +1 -1
  747. package/dist/esm/nodes/types.d.ts +8 -1
  748. package/dist/esm/nodes/types.d.ts.map +1 -1
  749. package/dist/esm/nodes/utility/utility-similarity-scoring.d.ts.map +1 -1
  750. package/dist/esm/nodes/utility/utility-similarity-scoring.js +29 -10
  751. package/dist/esm/nodes/utility/utility-similarity-scoring.js.map +1 -1
  752. package/dist/esm/page-access-guard-generator.d.ts +23 -0
  753. package/dist/esm/page-access-guard-generator.d.ts.map +1 -0
  754. package/dist/esm/page-access-guard-generator.js +131 -0
  755. package/dist/esm/page-access-guard-generator.js.map +1 -0
  756. package/dist/esm/password-reset-route-generator.d.ts +119 -0
  757. package/dist/esm/password-reset-route-generator.d.ts.map +1 -0
  758. package/dist/esm/password-reset-route-generator.js +448 -0
  759. package/dist/esm/password-reset-route-generator.js.map +1 -0
  760. package/dist/esm/payments/payment-core-code.d.ts.map +1 -1
  761. package/dist/esm/payments/payment-core-code.js +12 -7
  762. package/dist/esm/payments/payment-core-code.js.map +1 -1
  763. package/dist/esm/project-code-scanner.d.ts +11 -0
  764. package/dist/esm/project-code-scanner.d.ts.map +1 -0
  765. package/dist/esm/project-code-scanner.js +75 -0
  766. package/dist/esm/project-code-scanner.js.map +1 -0
  767. package/dist/esm/public-step-guards.d.ts +122 -0
  768. package/dist/esm/public-step-guards.d.ts.map +1 -0
  769. package/dist/esm/public-step-guards.js +280 -0
  770. package/dist/esm/public-step-guards.js.map +1 -0
  771. package/dist/esm/publish-refusals.d.ts +66 -0
  772. package/dist/esm/publish-refusals.d.ts.map +1 -0
  773. package/dist/esm/publish-refusals.js +271 -0
  774. package/dist/esm/publish-refusals.js.map +1 -0
  775. package/dist/esm/realtime-generator.d.ts +63 -1
  776. package/dist/esm/realtime-generator.d.ts.map +1 -1
  777. package/dist/esm/realtime-generator.js +401 -229
  778. package/dist/esm/realtime-generator.js.map +1 -1
  779. package/dist/esm/runtime-storage-generator.d.ts +32 -1
  780. package/dist/esm/runtime-storage-generator.d.ts.map +1 -1
  781. package/dist/esm/runtime-storage-generator.js +264 -11
  782. package/dist/esm/runtime-storage-generator.js.map +1 -1
  783. package/dist/esm/security-runtime/index.d.ts +14 -0
  784. package/dist/esm/security-runtime/index.d.ts.map +1 -0
  785. package/dist/esm/security-runtime/index.js +37 -0
  786. package/dist/esm/security-runtime/index.js.map +1 -0
  787. package/dist/esm/security-runtime/security-runtime-code.d.ts +53 -0
  788. package/dist/esm/security-runtime/security-runtime-code.d.ts.map +1 -0
  789. package/dist/esm/security-runtime/security-runtime-code.js +575 -0
  790. package/dist/esm/security-runtime/security-runtime-code.js.map +1 -0
  791. package/dist/esm/security-scanner.d.ts +72 -3
  792. package/dist/esm/security-scanner.d.ts.map +1 -1
  793. package/dist/esm/security-scanner.js +217 -8
  794. package/dist/esm/security-scanner.js.map +1 -1
  795. package/dist/esm/segment-splitter.d.ts.map +1 -1
  796. package/dist/esm/segment-splitter.js +10 -2
  797. package/dist/esm/segment-splitter.js.map +1 -1
  798. package/dist/esm/segment-trust.d.ts +36 -0
  799. package/dist/esm/segment-trust.d.ts.map +1 -1
  800. package/dist/esm/segment-trust.js +146 -2
  801. package/dist/esm/segment-trust.js.map +1 -1
  802. package/dist/esm/self-call-headers.d.ts +31 -0
  803. package/dist/esm/self-call-headers.d.ts.map +1 -0
  804. package/dist/esm/self-call-headers.js +43 -0
  805. package/dist/esm/self-call-headers.js.map +1 -0
  806. package/dist/esm/sent-email-log/index.d.ts +7 -0
  807. package/dist/esm/sent-email-log/index.d.ts.map +1 -1
  808. package/dist/esm/sent-email-log/index.js +15 -0
  809. package/dist/esm/sent-email-log/index.js.map +1 -1
  810. package/dist/esm/sent-email-log/sent-email-log-code.d.ts +7 -0
  811. package/dist/esm/sent-email-log/sent-email-log-code.d.ts.map +1 -1
  812. package/dist/esm/sent-email-log/sent-email-log-code.js +17 -3
  813. package/dist/esm/sent-email-log/sent-email-log-code.js.map +1 -1
  814. package/dist/esm/server-custom-node-call.d.ts +79 -0
  815. package/dist/esm/server-custom-node-call.d.ts.map +1 -0
  816. package/dist/esm/server-custom-node-call.js +278 -0
  817. package/dist/esm/server-custom-node-call.js.map +1 -0
  818. package/dist/esm/server-runtime-code.d.ts +39 -12
  819. package/dist/esm/server-runtime-code.d.ts.map +1 -1
  820. package/dist/esm/server-runtime-code.js +483 -40
  821. package/dist/esm/server-runtime-code.js.map +1 -1
  822. package/dist/esm/session-cookie-resolver.d.ts +3 -1
  823. package/dist/esm/session-cookie-resolver.d.ts.map +1 -1
  824. package/dist/esm/session-revocation-generator.d.ts +39 -0
  825. package/dist/esm/session-revocation-generator.d.ts.map +1 -0
  826. package/dist/esm/session-revocation-generator.js +172 -0
  827. package/dist/esm/session-revocation-generator.js.map +1 -0
  828. package/dist/esm/slack-message-values.d.ts +6 -0
  829. package/dist/esm/slack-message-values.d.ts.map +1 -0
  830. package/dist/esm/slack-message-values.js +68 -0
  831. package/dist/esm/slack-message-values.js.map +1 -0
  832. package/dist/esm/transactional-email-code.d.ts +11 -0
  833. package/dist/esm/transactional-email-code.d.ts.map +1 -1
  834. package/dist/esm/transactional-email-code.js +28 -4
  835. package/dist/esm/transactional-email-code.js.map +1 -1
  836. package/dist/esm/trigger-generator.d.ts +2 -0
  837. package/dist/esm/trigger-generator.d.ts.map +1 -1
  838. package/dist/esm/trigger-generator.js +15 -3
  839. package/dist/esm/trigger-generator.js.map +1 -1
  840. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  841. package/dist/esm/visitor-step-limits.d.ts +66 -0
  842. package/dist/esm/visitor-step-limits.d.ts.map +1 -0
  843. package/dist/esm/visitor-step-limits.js +181 -0
  844. package/dist/esm/visitor-step-limits.js.map +1 -0
  845. package/dist/esm/webhook-generator.d.ts.map +1 -1
  846. package/dist/esm/webhook-generator.js +93 -15
  847. package/dist/esm/webhook-generator.js.map +1 -1
  848. package/dist/esm/webhook-signature-verification.d.ts.map +1 -1
  849. package/dist/esm/webhook-signature-verification.js +13 -3
  850. package/dist/esm/webhook-signature-verification.js.map +1 -1
  851. package/dist/esm/workflow-auth-generator.d.ts +4 -1
  852. package/dist/esm/workflow-auth-generator.d.ts.map +1 -1
  853. package/dist/esm/workflow-auth-generator.js +8 -3
  854. package/dist/esm/workflow-auth-generator.js.map +1 -1
  855. package/dist/esm/workflow-component-plugin.js +12 -4
  856. package/dist/esm/workflow-component-plugin.js.map +1 -1
  857. package/dist/esm/workflow-project-plugin.d.ts.map +1 -1
  858. package/dist/esm/workflow-project-plugin.js +306 -60
  859. package/dist/esm/workflow-project-plugin.js.map +1 -1
  860. package/dist/esm/workflow-scope.d.ts.map +1 -1
  861. package/dist/esm/workflow-scope.js +5 -0
  862. package/dist/esm/workflow-scope.js.map +1 -1
  863. package/package.json +4 -4
  864. package/src/account-delete-route-generator.ts +28 -4
  865. package/src/api-route-generator.ts +712 -134
  866. package/src/auth-generator.ts +1471 -142
  867. package/src/automations/activity-kicks.ts +139 -0
  868. package/src/automations/app-events-source.ts +117 -0
  869. package/src/automations/automations-project-plugin.ts +202 -0
  870. package/src/automations/automations-scope.ts +196 -0
  871. package/src/automations/dispatcher-source.ts +1072 -0
  872. package/src/automations/event-bus-source.ts +428 -0
  873. package/src/automations/handler-module-generator.ts +107 -0
  874. package/src/automations/hydrators-source.ts +647 -0
  875. package/src/booking-calendar-feed-route-generator.ts +8 -0
  876. package/src/configured-nextauth-url.ts +17 -0
  877. package/src/cron-request-verification.ts +55 -5
  878. package/src/data-api-route-generator.ts +780 -43
  879. package/src/ecommerce/parameterized-stock-chain.ts +52 -5
  880. package/src/ecommerce/place-order-guards.ts +785 -0
  881. package/src/ecommerce-customhandler-rewriter.ts +55 -2
  882. package/src/executor-generator.ts +372 -60
  883. package/src/graph-utils.ts +33 -0
  884. package/src/index.ts +70 -0
  885. package/src/invoice/api-routes-code.ts +20 -7
  886. package/src/invoice/index.ts +11 -6
  887. package/src/invoice/invoice-assembly-code.ts +8 -3
  888. package/src/invoice/pdf-generator-code.ts +2 -1
  889. package/src/invoice/pdf-service-client-code.ts +15 -7
  890. package/src/newsletter/admin-route-code.ts +319 -0
  891. package/src/newsletter/helper-code.ts +748 -0
  892. package/src/newsletter/newsletter-scope.ts +116 -0
  893. package/src/newsletter/project-plugin.ts +119 -0
  894. package/src/newsletter/routes-code.ts +186 -0
  895. package/src/nodes/account/account-compare-passwords.ts +17 -6
  896. package/src/nodes/account/account-delete-current.ts +1 -1
  897. package/src/nodes/account/account-get-current.ts +1 -1
  898. package/src/nodes/account/account-hash-password.ts +19 -3
  899. package/src/nodes/account/account-login.ts +24 -7
  900. package/src/nodes/account/account-logout.ts +1 -1
  901. package/src/nodes/account/account-refresh-session.ts +1 -1
  902. package/src/nodes/account/account-request-password-reset.ts +47 -0
  903. package/src/nodes/account/account-reset-password.ts +45 -0
  904. package/src/nodes/account/account-signup.ts +86 -20
  905. package/src/nodes/account/account-social-login.ts +1 -1
  906. package/src/nodes/ai/ai-custom-prompt.ts +25 -6
  907. package/src/nodes/ai/ai-detect-language.ts +25 -6
  908. package/src/nodes/ai/ai-generate-text-embedding.ts +16 -3
  909. package/src/nodes/ai/ai-provider-utils-sources.generated.ts +2 -2
  910. package/src/nodes/ai/ai-provider-utils.ts +135 -10
  911. package/src/nodes/ai/ai-select-database-data.ts +8 -3
  912. package/src/nodes/ai/ai-sentiment-analysis.ts +25 -6
  913. package/src/nodes/ai/ai-summarization.ts +25 -6
  914. package/src/nodes/ai/ai-text-classifier.ts +25 -6
  915. package/src/nodes/ai/ai-text-transform.ts +25 -6
  916. package/src/nodes/analytics/analytics-track-outcome.ts +111 -0
  917. package/src/nodes/cart/cart-price-order.ts +200 -2
  918. package/src/nodes/cost-bearing-node-types.ts +45 -0
  919. package/src/nodes/data/data-select.ts +11 -2
  920. package/src/nodes/email/email-mailersend.ts +16 -8
  921. package/src/nodes/email/email-mailgun.ts +17 -12
  922. package/src/nodes/email/email-postmark.ts +17 -12
  923. package/src/nodes/email/email-resend.ts +17 -12
  924. package/src/nodes/email/email-sendgrid.ts +17 -12
  925. package/src/nodes/email/html-escape-code.ts +21 -0
  926. package/src/nodes/email/message-trust.ts +198 -0
  927. package/src/nodes/email/outbound-message-guard.ts +572 -0
  928. package/src/nodes/email/trusted-html-code.ts +49 -0
  929. package/src/nodes/general/general-custom-js.ts +46 -7
  930. package/src/nodes/general/general-http-request.ts +449 -46
  931. package/src/nodes/general/general-rate-limiter.ts +54 -81
  932. package/src/nodes/general/general-wait.ts +80 -0
  933. package/src/nodes/general/visitor-request.ts +79 -0
  934. package/src/nodes/index.ts +12 -0
  935. package/src/nodes/integrations/integration-slack.ts +21 -6
  936. package/src/nodes/newsletter/newsletter-confirm.ts +44 -0
  937. package/src/nodes/newsletter/newsletter-subscribe.ts +78 -0
  938. package/src/nodes/newsletter/newsletter-unsubscribe.ts +43 -0
  939. package/src/nodes/realtime/realtime-join-channel.ts +5 -4
  940. package/src/nodes/realtime/realtime-send-channel-event.ts +13 -2
  941. package/src/nodes/realtime/realtime-send-channel-message.ts +13 -2
  942. package/src/nodes/sms/sms-infobip.ts +14 -4
  943. package/src/nodes/sms/sms-smsapi.ts +14 -4
  944. package/src/nodes/sms/sms-textmagic.ts +14 -4
  945. package/src/nodes/sms/sms-twilio.ts +14 -4
  946. package/src/nodes/types.ts +9 -1
  947. package/src/nodes/utility/utility-similarity-scoring.ts +33 -12
  948. package/src/page-access-guard-generator.ts +154 -0
  949. package/src/password-reset-route-generator.ts +531 -0
  950. package/src/payments/payment-core-code.ts +12 -7
  951. package/src/project-code-scanner.ts +98 -0
  952. package/src/public-step-guards.ts +448 -0
  953. package/src/publish-refusals.ts +459 -0
  954. package/src/realtime-generator.ts +457 -234
  955. package/src/runtime-storage-generator.ts +270 -11
  956. package/src/security-runtime/index.ts +53 -0
  957. package/src/security-runtime/security-runtime-code.ts +579 -0
  958. package/src/security-scanner.ts +253 -10
  959. package/src/segment-splitter.ts +10 -2
  960. package/src/segment-trust.ts +205 -2
  961. package/src/self-call-headers.ts +46 -0
  962. package/src/sent-email-log/index.ts +16 -0
  963. package/src/sent-email-log/sent-email-log-code.ts +30 -4
  964. package/src/server-custom-node-call.ts +331 -0
  965. package/src/server-runtime-code.ts +488 -40
  966. package/src/session-revocation-generator.ts +177 -0
  967. package/src/slack-message-values.ts +84 -0
  968. package/src/transactional-email-code.ts +30 -4
  969. package/src/trigger-generator.ts +19 -3
  970. package/src/visitor-step-limits.ts +228 -0
  971. package/src/webhook-generator.ts +94 -14
  972. package/src/webhook-signature-verification.ts +13 -3
  973. package/src/workflow-auth-generator.ts +9 -4
  974. package/src/workflow-component-plugin.ts +14 -4
  975. package/src/workflow-project-plugin.ts +374 -61
  976. package/src/workflow-scope.ts +6 -0
@@ -13,7 +13,17 @@
13
13
 
14
14
  import { generateSqlValidatorCode } from './sql-validator'
15
15
  import { generateCommonJsSessionTokenResolverCode } from './session-cookie-resolver'
16
- import { ContentTables, TableAccess } from '@teleporthq/teleport-shared'
16
+ import {
17
+ AccountFields,
18
+ ContentTables,
19
+ DataExposure,
20
+ TableAccess,
21
+ } from '@teleporthq/teleport-shared'
22
+ import type { DataReadExposure, ProjectDataExposure } from '@teleporthq/teleport-types'
23
+ import { AUTOMATIONS_PATH } from './automations/automations-scope'
24
+ import { APP_EVENTS_FILE_NAME, APP_EVENTS_PATH } from './automations/app-events-source'
25
+ import { CONFIGURED_NEXTAUTH_URL_EXPRESSION } from './configured-nextauth-url'
26
+ import { generateSelfCallHeadersCode } from './self-call-headers'
17
27
 
18
28
  export const DATA_NODE_TYPES: ReadonlySet<string> = new Set([
19
29
  'data-select',
@@ -54,8 +64,241 @@ export interface DataAPIRouteOptions {
54
64
  // SELECT itself didn't carry a `<= N` filter that the auto-fire could
55
65
  // extract. Defaulting to 5 mirrors the GUI's default.
56
66
  lowStockThreshold?: number
67
+ // The project has the in-app event bus (`hasAutomationsBus`): a
68
+ // successful write to `teleport_events` wakes the automations, each
69
+ // product a low-stock scan finds is recorded as `product-low-stock`, and
70
+ // every request starts the due check (automations/activity-kicks.ts).
71
+ withAutomations?: boolean
72
+ // The roles the project grants staff access (`TableAccess.resolveStaffRoles`):
73
+ // the only sessions a server segment reads or changes OTHER customers'
74
+ // records for. Absent, only the explicit `admin` role.
75
+ staffRoles?: string[]
76
+ // Who reads which table from a browser (`DataExposure.resolveDataExposure`):
77
+ // the data API admits a browser's read of a table outside the storefront's
78
+ // own the way that table's per-table route does. Absent, none.
79
+ dataExposure?: ProjectDataExposure
80
+ // The project's TeleportHQ data sources (`DataExposure.managedDataSourceIds`):
81
+ // the only ones this route reads (the managed database), so the only ids a
82
+ // browser's read may name. Absent, none.
83
+ managedDataSourceIds?: string[]
57
84
  }
58
85
 
86
+ /** What the data API needs of the exposure: who reads each table, not how many rows. */
87
+ const browserExposureTables = (
88
+ exposure: ProjectDataExposure | undefined,
89
+ managedDataSourceIds: string[]
90
+ ): Record<
91
+ string,
92
+ Pick<DataReadExposure, 'public' | 'anySession' | 'roles' | 'subscriberRules'>
93
+ > => {
94
+ const out: Record<
95
+ string,
96
+ Pick<DataReadExposure, 'public' | 'anySession' | 'roles' | 'subscriberRules'>
97
+ > = {}
98
+ Object.entries((exposure && exposure.tables) || {}).forEach(([key, entry]) => {
99
+ // This route reads the managed database only: another source's table of the
100
+ // same name is that source's route's to admit.
101
+ const source = key.slice(0, key.lastIndexOf(':'))
102
+ if (source !== '*' && managedDataSourceIds.indexOf(source) === -1) {
103
+ return
104
+ }
105
+ const admits =
106
+ entry.public ||
107
+ entry.anySession ||
108
+ entry.roles.length > 0 ||
109
+ (entry.subscriberRules || []).length > 0
110
+ if (admits) {
111
+ out[key] = {
112
+ public: entry.public,
113
+ anySession: entry.anySession,
114
+ roles: entry.roles,
115
+ ...(entry.subscriberRules && { subscriberRules: entry.subscriberRules }),
116
+ }
117
+ }
118
+ })
119
+ return out
120
+ }
121
+
122
+ /** From `pages/api/data/[...params].js` to the project root. */
123
+ const DATA_ROUTE_ROOT = '../../..'
124
+
125
+ /**
126
+ * The row window of a BROWSER read through the data API (the storefront's own
127
+ * reads: products, the discount feed, the regional pricing tables). The largest
128
+ * count the generated storefront asks for is 1000 (the regional pricing rows),
129
+ * so that is the most a browser read gets; a read naming no count gets 100.
130
+ */
131
+ export const DATA_API_BROWSER_DEFAULT_LIMIT = 100
132
+ export const DATA_API_BROWSER_MAX_LIMIT = 1000
133
+ export const DATA_API_BROWSER_MAX_OFFSET = 1000000
134
+
135
+ /**
136
+ * The columns that key a GUEST's own rows in a customer table (a favourite, a
137
+ * cart, a conversation kept by the browser's session id): a read that names
138
+ * one, for a visitor without a session, finds the rows no account owns.
139
+ */
140
+ const GUEST_KEY_COLUMNS = [
141
+ 'session_id',
142
+ 'anonymous_id',
143
+ 'anon_id',
144
+ 'visitor_id',
145
+ 'guest_id',
146
+ 'device_id',
147
+ 'browser_id',
148
+ 'cart_id',
149
+ 'cart_token',
150
+ 'basket_id',
151
+ ]
152
+
153
+ /**
154
+ * Whether the route requires `utils/app-events.js` (`ensureAppEventsModule`):
155
+ * it records the low-stock events through it.
156
+ */
157
+ export const dataAPIRouteRecordsLowStock = (options: DataAPIRouteOptions): boolean =>
158
+ !!options.withAutomations && !!options.lowStockAlertsEnabled
159
+
160
+ /**
161
+ * The wake-up and the low-stock events, for a project with automations. The
162
+ * regex finds an INSERT into the ledger in a raw query, however the table is
163
+ * written (`public.`, quoted, any case), the order event claims'
164
+ * `WITH claim AS (INSERT INTO teleport_events (…` included.
165
+ */
166
+ const generateBusinessEventsCode = (
167
+ recordsLowStock: boolean
168
+ ): string => `// The project has automations. A new teleport_events row wakes their queue
169
+ // (the in-app event bus, lib/automations/event-bus.js) off the request path,
170
+ // once the write has succeeded: a create into the table, or a raw query that
171
+ // inserts into it (the order event claims). A claim row is inserted BEFORE the
172
+ // step it gates, so a dispatch may start while that step is still running;
173
+ // that is harmless, the dispatcher runs off the request and reads every record
174
+ // afresh. A node that writes the ledger straight to the database, not through
175
+ // this route, bypasses the wake-up.
176
+ var BUSINESS_EVENTS_TABLE = 'teleport_events';
177
+ var BUSINESS_EVENT_INSERT_RE = /\\binsert\\s+into\\s+(?:"?public"?\\s*\\.\\s*)?"?teleport_events"?(?![\\w$])/i;
178
+
179
+ // How many rows each request's raw query touched (handleRawQuery notes it):
180
+ // an insert that wrote none — a row ON CONFLICT DO NOTHING skipped, an error
181
+ // answered as an empty result — wakes nothing.
182
+ var RAW_QUERY_ROW_COUNTS = new WeakMap();
183
+
184
+ // An order event claim answers whether it took its row (its claimed column); a claim
185
+ // that lost to an earlier one wrote nothing.
186
+ function answersUnclaimed(result) {
187
+ var rows = result && Array.isArray(result.rows) ? result.rows : [];
188
+ return rows.length > 0 && rows.every(function (row) {
189
+ if (!row || !Object.prototype.hasOwnProperty.call(row, 'claimed')) {
190
+ return false;
191
+ }
192
+ var flag = row.claimed;
193
+ return !(flag === true || flag === 'true' || Number(flag) > 0);
194
+ });
195
+ }
196
+
197
+ function wroteBusinessEvent(operation, body, result, req) {
198
+ if (!body || typeof body !== 'object') {
199
+ return false;
200
+ }
201
+ if (operation === 'create') {
202
+ return __dataPublicTable(body.tableName) === BUSINESS_EVENTS_TABLE && !!(result && result.item);
203
+ }
204
+ if (operation === 'raw-query') {
205
+ return (
206
+ typeof body.query === 'string' &&
207
+ BUSINESS_EVENT_INSERT_RE.test(body.query) &&
208
+ RAW_QUERY_ROW_COUNTS.get(req) > 0 &&
209
+ !answersUnclaimed(result)
210
+ );
211
+ }
212
+ return false;
213
+ }
214
+
215
+ // Site activity: due automation work (a Wait, a retry) starts off the request
216
+ // (lib/automations/due-check.js checks at most once a minute).
217
+ function kickDueAutomations(req) {
218
+ try {
219
+ require('${DATA_ROUTE_ROOT}/${AUTOMATIONS_PATH.join('/')}/due-check').kickWhenDue(req);
220
+ } catch (error) {
221
+ console.warn('[data-api] could not check for due automations: ' + (error && error.message ? error.message : String(error)));
222
+ }
223
+ }
224
+
225
+ function wakeAutomations(req) {
226
+ try {
227
+ require('${DATA_ROUTE_ROOT}/${AUTOMATIONS_PATH.join('/')}/event-bus').scheduleDispatch(req);
228
+ } catch (error) {
229
+ console.warn('[data-api] could not wake the automations: ' + (error && error.message ? error.message : String(error)));
230
+ }
231
+ }
232
+ ${
233
+ recordsLowStock
234
+ ? `
235
+ // Each product a low-stock scan finds is a product-low-stock event: one per
236
+ // product and stock level reached, so a scan that finds the same level again
237
+ // records nothing new. Written on a connection of its own and never awaited by
238
+ // the request, like the alert email; on Vercel the platform keeps it alive
239
+ // until it is done.
240
+ function lowStockLevel(row) {
241
+ var raw = row.stock !== undefined && row.stock !== null ? row.stock : row.quantity;
242
+ if (raw === undefined || raw === null || raw === '') {
243
+ return null;
244
+ }
245
+ var level = Number(raw);
246
+ return isFinite(level) ? level : null;
247
+ }
248
+
249
+ function recordLowStockEvents(req, rows, threshold) {
250
+ var work = (async function () {
251
+ var eventClient = getClient();
252
+ try {
253
+ var appEvents = require('${DATA_ROUTE_ROOT}/${APP_EVENTS_PATH.join(
254
+ '/'
255
+ )}/${APP_EVENTS_FILE_NAME}');
256
+ await eventClient.connect();
257
+ for (var i = 0; i < rows.length; i++) {
258
+ var row = rows[i] || {};
259
+ if (row.id === undefined || row.id === null || row.id === '') {
260
+ continue;
261
+ }
262
+ var id = String(row.id);
263
+ var stock = lowStockLevel(row);
264
+ var product = {
265
+ id: id,
266
+ name: row.name !== undefined && row.name !== null ? String(row.name) : '',
267
+ stock: stock,
268
+ threshold: threshold,
269
+ };
270
+ if (row.sku !== undefined && row.sku !== null && row.sku !== '') {
271
+ product.sku = String(row.sku);
272
+ }
273
+ await appEvents.recordAppEvent(eventClient, {
274
+ type: 'product-low-stock',
275
+ entityType: 'product',
276
+ entityId: id,
277
+ payload: { product: product },
278
+ actorType: 'system',
279
+ dedupeKey: 'low-stock:' + id + ':' + String(stock),
280
+ }, req);
281
+ }
282
+ } catch (error) {
283
+ console.error('[data-api] could not record the low-stock events: ' + (error && error.message ? error.message : String(error)));
284
+ } finally {
285
+ try { await eventClient.end(); } catch (_e) {}
286
+ }
287
+ })();
288
+ try {
289
+ var keepAlive = require('${DATA_ROUTE_ROOT}/${AUTOMATIONS_PATH.join(
290
+ '/'
291
+ )}/wait-until').waitUntil;
292
+ if (typeof keepAlive === 'function') {
293
+ keepAlive(work);
294
+ }
295
+ } catch (_e) {}
296
+ }
297
+ `
298
+ : ''
299
+ }
300
+ `
301
+
59
302
  /**
60
303
  * The only tables a BROWSER reads through this route, in an app whose server
61
304
  * code identifies itself with the app secret (see `__taBrowserIsReadOnly`).
@@ -100,6 +343,21 @@ export const generateDataAPIRoute = (options: DataAPIRouteOptions = {}): string
100
343
  typeof options.lowStockThreshold === 'number' && options.lowStockThreshold >= 0
101
344
  ? options.lowStockThreshold
102
345
  : 5
346
+ const withAutomations = !!options.withAutomations
347
+ const managedDataSourceIds = Array.isArray(options.managedDataSourceIds)
348
+ ? Array.from(
349
+ new Set(options.managedDataSourceIds.filter((id) => typeof id === 'string'))
350
+ ).sort()
351
+ : []
352
+ const exposureTables = browserExposureTables(options.dataExposure, managedDataSourceIds)
353
+ const hasSubscriberRules = Object.values(exposureTables).some(
354
+ (entry) => (entry.subscriberRules || []).length > 0
355
+ )
356
+ const staffRoles =
357
+ Array.isArray(options.staffRoles) && options.staffRoles.length > 0
358
+ ? Array.from(new Set(options.staffRoles.filter((role) => typeof role === 'string'))).sort()
359
+ : [TableAccess.ADMIN_ROLE]
360
+ const recordsLowStock = dataAPIRouteRecordsLowStock(options)
103
361
 
104
362
  return `const { Client, types: pgTypes } = require('pg');
105
363
  // A DATE stays the day it names, whatever the server's time zone: node-pg would read it as
@@ -170,10 +428,12 @@ const getClient = () => {
170
428
  if (ssl === false && connStr) {
171
429
  connStr = stripSslQueryParamsFromConnectionString(connStr);
172
430
  }
431
+ // No query waits on the database longer than this (enforced by the client:
432
+ // a server-side statement_timeout does not survive a pooler).
173
433
  if (connStr) {
174
434
  return new Client(
175
435
  Object.assign(
176
- { connectionString: connStr },
436
+ { connectionString: connStr, query_timeout: ${DataExposure.READ_QUERY_TIMEOUT_MS} },
177
437
  ssl !== undefined ? { ssl: ssl } : {}
178
438
  )
179
439
  );
@@ -186,6 +446,7 @@ const getClient = () => {
186
446
  user: process.env.TELEPORT_DB_USER,
187
447
  password: process.env.TELEPORT_DB_PASSWORD,
188
448
  database: process.env.TELEPORT_DB_NAME,
449
+ query_timeout: ${DataExposure.READ_QUERY_TIMEOUT_MS},
189
450
  },
190
451
  ssl !== undefined ? { ssl: ssl } : {}
191
452
  )
@@ -282,6 +543,11 @@ function buildWhereClause(filters, queryParams, startIndex, options) {
282
543
  var paramIndex = startIndex;
283
544
  var skipOptionalEmpty = !!(options && options.skipOptionalEmpty);
284
545
  var strict = !!(options && options.strict);
546
+ var ownerScope = (options && options.ownerScope) || null;
547
+ // A read already bound to the visitor — an owner filter that is the
548
+ // session's own id or email, or a guest's own browser key — may drop a
549
+ // wildcard on another key: that only widens it within the visitor's own rows.
550
+ var visitorScoped = !!ownerScope && __dataReadIsBoundToVisitor(ownerScope, filters);
285
551
 
286
552
  if (!filters || !Array.isArray(filters) || filters.length === 0) {
287
553
  return { clause: '', paramIndex: paramIndex };
@@ -299,6 +565,27 @@ function buildWhereClause(filters, queryParams, startIndex, options) {
299
565
  var value = f.destination !== undefined ? f.destination : f.value;
300
566
  var operand = f.operand || f.operator || '=';
301
567
 
568
+ // A read of a customer table for a visitor: the filter on whose record it
569
+ // is never widens the read, and names only the visitor's own (see
570
+ // __dataOwnerScope).
571
+ if (ownerScope && __dataIsOwnerColumn(ownerScope, field)) {
572
+ var ownerClause = __dataOwnerClause(ownerScope, field, value, operand, f, filters);
573
+ if (ownerClause !== null) {
574
+ conditions.push(ownerClause);
575
+ continue;
576
+ }
577
+ } else if (ownerScope && !visitorScoped && __dataIsWideningValue(value, f)) {
578
+ // A customer table read for a visitor: an empty, "all" or wildcard value
579
+ // on ANY key matches nothing — it never drops the condition and widens
580
+ // the read to every customer's rows.
581
+ conditions.push('FALSE');
582
+ continue;
583
+ } else if (!strict && f.__skippable === true) {
584
+ // The data-select node keeps every filter it would have left out, for the
585
+ // scope above; anywhere else it is left out, as the node always did.
586
+ continue;
587
+ }
588
+
302
589
  if (strict && isMissingFilterValue(value)) throw refuseUnscopedWrite(field);
303
590
  if (value === undefined) continue;
304
591
  if (skipOptionalEmpty && (isSkippableFilterValue(value) || isAllSentinelFilterValue(value, f))) continue;
@@ -399,6 +686,9 @@ async function handleSelect(client, body, req) {
399
686
  __taAssertFeedFields(tableName, feed, filters.map(function(f) { return f && (f.source || f.field); }));
400
687
  __taAssertFeedFields(tableName, feed, sorts.map(function(s) { return s && s.field; }));
401
688
  }
689
+ // A browser never filters, sorts or selects by a credential column.
690
+ __dataAssertNoCredentialFields(req, tableName, filters.map(function(f) { return f && (f.source || f.field); })
691
+ .concat(sorts.map(function(s) { return s && s.field; }), selectedColumns));
402
692
  // A browser reads a published table's public rows, and never names a hidden
403
693
  // column — to read it, filter by it or sort by it.
404
694
  var rowPolicy = __dataRowPolicy(req, tableName);
@@ -408,12 +698,20 @@ async function handleSelect(client, body, req) {
408
698
  __dataAssertVisibleFields(rowPolicy, selectedColumns);
409
699
  }
410
700
 
701
+ // A browser reads a bounded page of rows, of whole numbers (see
702
+ // __dataReadWindow); the app's own server code reads what it names.
703
+ var rowWindow = __dataReadWindow(req, limit, skip);
704
+ limit = rowWindow.limit;
705
+ skip = rowWindow.skip;
706
+ var ownerScope = await __dataOwnerScope(req, tableName);
707
+
411
708
  var queryParams = [];
412
709
  var cols = selectedColumns.length > 0 ? selectedColumns.join(', ') : '*';
413
710
  if (feed) cols = feed.columns.join(', ');
414
711
  var sql = 'SELECT ' + cols + ' FROM ' + tableName;
415
712
 
416
- var where = buildWhereClause(filters, queryParams, 1, { skipOptionalEmpty: true });
713
+ var where = buildWhereClause(filters, queryParams, 1, { skipOptionalEmpty: true, ownerScope: ownerScope });
714
+ if (!rawQueryUserPart) where = await __dataWithPrivateScope(client, ownerScope, filters, queryParams, where);
417
715
  sql += where.clause;
418
716
  if (feed) sql += (where.clause ? ' AND ' : ' WHERE ') + feed.predicate;
419
717
  if (rowPolicy) sql += (where.clause || feed ? ' AND ' : ' WHERE ') + '(' + rowPolicy.predicate + ')';
@@ -429,11 +727,11 @@ async function handleSelect(client, body, req) {
429
727
  }
430
728
  }
431
729
 
432
- if (limit !== undefined && limit !== null) {
433
- sql += ' LIMIT ' + parseInt(limit);
730
+ if (limit !== undefined) {
731
+ sql += ' LIMIT ' + limit;
434
732
  }
435
- if (skip !== undefined && skip !== null) {
436
- sql += ' OFFSET ' + parseInt(skip);
733
+ if (skip !== undefined) {
734
+ sql += ' OFFSET ' + skip;
437
735
  }
438
736
 
439
737
  if (rawQueryUserPart) {
@@ -452,13 +750,18 @@ async function handleSelect(client, body, req) {
452
750
 
453
751
  var result = await safeQuery(client, sql, queryParams, 'select');
454
752
  var rows = Array.isArray(result.rows) ? result.rows : [];
455
- // A browser reads the users table's profile, never its credentials.
456
- if (!isInternalDataRequest(req)) rows = __taWithoutCredentials(rows, tableName);
753
+ // No credential column leaves in a row — a server segment relays its rows
754
+ // to the browser. Only a server-side caller that names one in its own
755
+ // projection (a check that compares a hash on the server) gets it.
756
+ rows = rawQueryUserPart
757
+ ? __taWithoutCredentials(rows, null, isAuthLayerCall(req) ? __taCredentialsNamedBy(rawQueryUserPart, rows) : [])
758
+ : __taWithoutCredentials(rows, tableName, isAuthLayerCall(req) ? selectedColumns : []);
457
759
  if (rowPolicy) rows = __dataWithoutHidden(rowPolicy, rows);
458
760
 
459
761
  var countSql = 'SELECT COUNT(*) FROM ' + tableName;
460
762
  var countParams = [];
461
- var countWhere = buildWhereClause(filters, countParams, 1, { skipOptionalEmpty: true });
763
+ var countWhere = buildWhereClause(filters, countParams, 1, { skipOptionalEmpty: true, ownerScope: ownerScope });
764
+ countWhere = await __dataWithPrivateScope(client, ownerScope, filters, countParams, countWhere);
462
765
  countSql += countWhere.clause;
463
766
  if (feed) countSql += (countWhere.clause ? ' AND ' : ' WHERE ') + feed.predicate;
464
767
  if (rowPolicy) countSql += (countWhere.clause || feed ? ' AND ' : ' WHERE ') + '(' + rowPolicy.predicate + ')';
@@ -479,13 +782,16 @@ async function handleCount(client, body, req) {
479
782
  if (feed) {
480
783
  __taAssertFeedFields(tableName, feed, filters.map(function(f) { return f && (f.source || f.field); }));
481
784
  }
785
+ __dataAssertNoCredentialFields(req, tableName, filters.map(function(f) { return f && (f.source || f.field); }));
482
786
  var rowPolicy = __dataRowPolicy(req, tableName);
483
787
  if (rowPolicy) {
484
788
  __dataAssertVisibleFields(rowPolicy, filters.map(function(f) { return f && (f.source || f.field); }));
485
789
  }
790
+ var ownerScope = await __dataOwnerScope(req, tableName);
486
791
  var queryParams = [];
487
792
  var sql = 'SELECT COUNT(*) FROM ' + tableName;
488
- var where = buildWhereClause(filters, queryParams, 1, { skipOptionalEmpty: true });
793
+ var where = buildWhereClause(filters, queryParams, 1, { skipOptionalEmpty: true, ownerScope: ownerScope });
794
+ where = await __dataWithPrivateScope(client, ownerScope, filters, queryParams, where);
489
795
  sql += where.clause;
490
796
  if (feed) sql += (where.clause ? ' AND ' : ' WHERE ') + feed.predicate;
491
797
  if (rowPolicy) sql += (where.clause || feed ? ' AND ' : ' WHERE ') + '(' + rowPolicy.predicate + ')';
@@ -651,7 +957,8 @@ function stampRequestLocale(tableName, entries, colTypes, requestLocale) {
651
957
  }
652
958
 
653
959
  // Columns a feature added after stores were provisioned: product options
654
- // (the definitions on the product, the chosen configuration on an order line).
960
+ // (the definitions on the product, the chosen configuration on an order line)
961
+ // and the record an activity-log line is about (its entity).
655
962
  // A write naming one on a store whose table never gained it drops that column
656
963
  // instead of failing the whole statement — an order must never lose its lines
657
964
  // over a column that was not added. Only when the table's columns are known:
@@ -659,6 +966,7 @@ function stampRequestLocale(tableName, entries, colTypes, requestLocale) {
659
966
  var OPTIONAL_FEATURE_COLUMNS = {
660
967
  teleport_products: ['option_groups', 'product_page'],
661
968
  teleport_order_items: ['configuration', 'configuration_label'],
969
+ teleport_events: ['entity_type', 'entity_id', 'claimed_at'],
662
970
  };
663
971
 
664
972
  function dropMissingOptionalColumns(tableName, entries, colTypes) {
@@ -680,18 +988,14 @@ function dropMissingOptionalColumns(tableName, entries, colTypes) {
680
988
  // The row a create or update answers with, whoever asked, without the auth
681
989
  // users table's credentials (the columns a browser read is served without):
682
990
  // a server-side caller hands that answer on to the browser as its result.
683
- function withoutCredentialColumns(row, tableName) {
684
- return row ? __taWithoutCredentials([row], tableName)[0] : row;
685
- }
686
-
687
- async function handleCreate(client, body) {
991
+ async function handleCreate(client, body, req) {
688
992
  var tableName = body.tableName;
689
993
  var columnMappings = body.columnMappings || {};
690
994
  // Optional fallback passed by the data-create-item workflow handler
691
995
  // when the workflow context carries a resolve-user output. See
692
996
  // coerceUuidColumnValue for why ownership columns get this special
693
997
  // treatment instead of being NULL'd outright.
694
- var anonymousUserIdFallback = body.__anonymousUserId;
998
+ var anonymousUserIdFallback = await __dataGuestFallback(client, req, body.__anonymousUserId);
695
999
 
696
1000
  // Validate table name
697
1001
  assertIdentifierSafe(tableName, 'table name');
@@ -758,14 +1062,15 @@ async function handleCreate(client, body) {
758
1062
  var item = result.rows && result.rows[0] ? result.rows[0] : null;
759
1063
  var idIdx = columns.indexOf('id');
760
1064
  var resolvedId = item ? (item.id || null) : (idIdx >= 0 ? values[idIdx] : null);
761
- return { item: withoutCredentialColumns(item, tableName), id: resolvedId };
1065
+ // The written row goes back to a segment that relays it: never its credentials.
1066
+ return { item: __dataWithoutItemCredentials(item, tableName), id: resolvedId };
762
1067
  }
763
1068
 
764
- async function handleUpdate(client, body) {
1069
+ async function handleUpdate(client, body, req) {
765
1070
  var tableName = body.tableName;
766
1071
  var filters = body.filters || [];
767
1072
  var columnMappings = body.columnMappings || {};
768
- var anonymousUserIdFallback = body.__anonymousUserId;
1073
+ var anonymousUserIdFallback = await __dataGuestFallback(client, req, body.__anonymousUserId);
769
1074
 
770
1075
  // Validate table name
771
1076
  assertIdentifierSafe(tableName, 'table name');
@@ -811,7 +1116,11 @@ async function handleUpdate(client, body) {
811
1116
 
812
1117
  var result = await safeQuery(client, sql, queryParams, 'update');
813
1118
  var updated = result.rows[0] || null;
814
- return { updatedCount: result.rowCount || 0, item: withoutCredentialColumns(updated, tableName), id: (updated && updated.id) || null };
1119
+ return {
1120
+ updatedCount: result.rowCount || 0,
1121
+ item: __dataWithoutItemCredentials(updated, tableName),
1122
+ id: (updated && updated.id) || null,
1123
+ };
815
1124
  }
816
1125
 
817
1126
  async function handleDelete(client, body) {
@@ -889,7 +1198,9 @@ function extractThresholdFromQuery(query) {
889
1198
  // local server on another port than a local NEXTAUTH_URL keeps its own
890
1199
  // loopback address (NEXTAUTH_URL stuck at :3000 while the dev server runs on
891
1200
  // :3001). Env vars are tried as fallbacks for the rare serverless
892
- // background-work case where the request context isn't visible.
1201
+ // background-work case where the request context isn't visible. NEXTAUTH_URL
1202
+ // is read as configured, never as the auth route rewrote it from a request
1203
+ // (configured-nextauth-url.ts).
893
1204
  function isLoopbackHost(host) {
894
1205
  var name = String(host || '').replace(/:[0-9]+$/, '').toLowerCase();
895
1206
  return name === 'localhost' || name === '127.0.0.1' || name === '[::1]';
@@ -901,18 +1212,20 @@ function resolveSelfBaseUrl(req) {
901
1212
  var proto = (req && req.headers && req.headers['x-forwarded-proto']) || (isLoopbackHost(host) ? 'http' : 'https');
902
1213
  var requestOrigin = String(proto).split(',')[0].trim() + '://' + host;
903
1214
  if (process.env.VERCEL) return requestOrigin;
904
- var configured = String(process.env.NEXTAUTH_URL || '').trim();
1215
+ var configured = String(${CONFIGURED_NEXTAUTH_URL_EXPRESSION} || '').trim();
905
1216
  if (!configured) return requestOrigin;
906
1217
  var origin;
907
1218
  try { origin = new URL(configured).origin; } catch (e) { return requestOrigin; }
908
1219
  if (isLoopbackHost(host) && isLoopbackHost(new URL(origin).host)) return requestOrigin;
909
1220
  return origin;
910
1221
  }
911
- if (process.env.NEXTAUTH_URL) return String(process.env.NEXTAUTH_URL).replace(/\\/+$/, '');
1222
+ if (${CONFIGURED_NEXTAUTH_URL_EXPRESSION}) return String(${CONFIGURED_NEXTAUTH_URL_EXPRESSION}).replace(/\\/+$/, '');
912
1223
  if (process.env.VERCEL_URL) return 'https://' + String(process.env.VERCEL_URL).replace(/\\/+$/, '');
913
1224
  return '';
914
1225
  }
915
1226
 
1227
+ ${generateSelfCallHeadersCode()}
1228
+
916
1229
  // Fire-and-forget POST to /api/ecommerce/low-stock-alert. Errors
917
1230
  // are swallowed because the merchant must never see a failed alert
918
1231
  // surface as a failed checkout — the worst case is a missed email,
@@ -943,7 +1256,7 @@ function fireAndForgetLowStockAlert(req, rows, threshold) {
943
1256
  method: 'POST',
944
1257
  // The alert route emails the merchant only for the store's own server
945
1258
  // code, which presents the app secret.
946
- headers: { 'Content-Type': 'application/json', 'x-internal-data-secret': process.env.NEXTAUTH_SECRET || '' },
1259
+ headers: __selfCallHeaders({ 'Content-Type': 'application/json' }),
947
1260
  body: JSON.stringify(payload),
948
1261
  }).catch(function(err) {
949
1262
  console.error('[data-api] low-stock alert POST failed: ' + (err && err.message ? err.message : String(err)));
@@ -953,7 +1266,9 @@ function fireAndForgetLowStockAlert(req, rows, threshold) {
953
1266
  }
954
1267
  }
955
1268
 
956
- async function handleRawQuery(client, body, req) {
1269
+ ${
1270
+ withAutomations ? generateBusinessEventsCode(recordsLowStock) : ''
1271
+ }async function handleRawQuery(client, body, req) {
957
1272
  var query = body.query;
958
1273
  if (!query || typeof query !== 'string') {
959
1274
  return { rows: [], error: 'No query provided' };
@@ -977,7 +1292,13 @@ async function handleRawQuery(client, body, req) {
977
1292
  }
978
1293
 
979
1294
  var result = await safeQuery(client, query, params, 'raw-query');
1295
+ // No credential column comes back to a segment a visitor's request runs: its
1296
+ // results are relayed to the browser. A server job (a cron's calendar sync)
1297
+ // and the auth layer get the credential columns the statement names itself
1298
+ // (see __taCredentialsNamedBy); a SELECT * over the users table brings none.
980
1299
  var rows = Array.isArray(result.rows) ? result.rows : [];
1300
+ var namedCredentials = __dataIsServerJob(req) || isAuthLayerCall(req) ? __taCredentialsNamedBy(query, rows) : [];
1301
+ rows = __taWithoutCredentials(rows, null, namedCredentials);
981
1302
 
982
1303
  // Auto-fire the low-stock alert when the workflow runs the post-
983
1304
  // stock-decrement SELECT and gets back a non-empty list. The
@@ -986,8 +1307,14 @@ async function handleRawQuery(client, body, req) {
986
1307
  // that gap without requiring the AI to wire an email-send node.
987
1308
  if (LOW_STOCK_ALERTS_ENABLED && rows.length > 0 && looksLikeLowStockProductSelect(query)) {
988
1309
  fireAndForgetLowStockAlert(req, rows, extractThresholdFromQuery(query));
989
- }
990
-
1310
+ ${
1311
+ recordsLowStock ? ' recordLowStockEvents(req, rows, extractThresholdFromQuery(query));\n' : ''
1312
+ } }
1313
+ ${
1314
+ withAutomations
1315
+ ? " RAW_QUERY_ROW_COUNTS.set(req, typeof result.rowCount === 'number' ? result.rowCount : rows.length);\n"
1316
+ : ''
1317
+ }
991
1318
  return { rows: rows };
992
1319
  }
993
1320
 
@@ -999,6 +1326,342 @@ function isInternalDataRequest(req) {
999
1326
  return __taIsInternalRequest(req);
1000
1327
  }
1001
1328
 
1329
+ // A server job — a cron, a webhook or an automation run, which runs no
1330
+ // visitor's request — flags its data calls (the runners put x-tq-server-job in
1331
+ // the run's __internalHeaders) and presents the app secret; the flag counts
1332
+ // only with it. Every other internal call is a segment a visitor's request
1333
+ // runs: its reads of customer records are the visitor's (__dataOwnerScope), and
1334
+ // its raw results carry no credential.
1335
+ function __dataIsServerJob(req) {
1336
+ if (!isInternalDataRequest(req)) return false;
1337
+ var flag = req && req.headers && req.headers['x-tq-server-job'];
1338
+ return (Array.isArray(flag) ? flag[0] : flag) === '1';
1339
+ }
1340
+
1341
+ // The auth layer's own in-process call (a property, never a header, so nothing
1342
+ // on the wire can claim it): the only caller a credential column it names in
1343
+ // its projection is returned to. Every other caller — every workflow segment —
1344
+ // gets the row without its credentials.
1345
+ function isAuthLayerCall(req) {
1346
+ return !!(req && req.__tqAuthLayerCall === true && req.__tqServerCall === true);
1347
+ }
1348
+
1349
+ function __dataAssertNoCredentialFields(req, tableName, fields) {
1350
+ if (isInternalDataRequest(req)) return;
1351
+ for (var i = 0; i < fields.length; i++) {
1352
+ if (!fields[i]) continue;
1353
+ var name = __taNormalizeTable(fields[i]);
1354
+ if (__taIsCredentialColumn(name) || (__taIsCredentialTable(tableName) && __TA_CREDENTIAL_COLUMNS.indexOf(name) !== -1)) {
1355
+ var err = new Error('Invalid field');
1356
+ err.status = 400;
1357
+ throw err;
1358
+ }
1359
+ }
1360
+ }
1361
+
1362
+ // Who reads which table from a browser beyond the storefront's own tables:
1363
+ // the pages that bind it decide (DataExposure in teleport-shared), as on the
1364
+ // per-table read routes — anyone for a public page's table, a session the
1365
+ // binding pages admit otherwise (with the entitlement on a subscriber-only
1366
+ // page). A row-owned page's table is read on its own route, never here.
1367
+ var DATA_EXPOSURE_TABLES = ${JSON.stringify(exposureTables)};
1368
+ ${hasSubscriberRules ? DataExposure.generateEntitlementCheckCode() : ''}
1369
+ var MANAGED_DATA_SOURCE_IDS = ${JSON.stringify(managedDataSourceIds)};
1370
+ async function __dataBrowserMayRead(req, dataSourceId, tableName) {
1371
+ // This route reads the managed database whatever id the path names: a browser
1372
+ // names one of its sources, never another's whose table has the same name.
1373
+ if (MANAGED_DATA_SOURCE_IDS.indexOf(dataSourceId) === -1) return false;
1374
+ var bare = __dataPublicTable(tableName);
1375
+ if (!bare) return false;
1376
+ var entry = DATA_EXPOSURE_TABLES[dataSourceId + ':' + bare] || DATA_EXPOSURE_TABLES['*:' + bare];
1377
+ if (!entry) return false;
1378
+ if (entry.public) return true;
1379
+ var token = await __dataSession(req);
1380
+ if (!token) return false;
1381
+ if (entry.anySession) return true;
1382
+ var role = __taRoleOf(token);
1383
+ if (role && entry.roles.indexOf(role) !== -1) return true;
1384
+ var rules = entry.subscriberRules || [];
1385
+ var products = null;
1386
+ for (var i = 0; i < rules.length; i++) {
1387
+ if (rules[i].roles.length > 0 && (!role || rules[i].roles.indexOf(role) === -1)) continue;
1388
+ products = rules[i].productIds.length === 0 || (products && products.length === 0)
1389
+ ? []
1390
+ : (products || []).concat(rules[i].productIds);
1391
+ }
1392
+ return !!products && (await __dxEntitled(token, products));
1393
+ }
1394
+
1395
+ function __dataWithoutItemCredentials(item, tableName) {
1396
+ if (!item || typeof item !== 'object') return item;
1397
+ return __taWithoutCredentials([item], tableName)[0];
1398
+ }
1399
+
1400
+ // The id a guest's row may be filed under when its owner column got no id of
1401
+ // its own (see coerceUuidColumnValue): an ANONYMOUS id only. With a session it
1402
+ // must be the session's own id; without one it must not be a registered
1403
+ // account's id — any users row but the guest's own anonymous one
1404
+ // (<uuid>${TableAccess.ANONYMOUS_GUEST_EMAIL_SUFFIX}, written by "Resolve Current User"
1405
+ // before the checkout's insert; see TableAccess.registeredAccountEmailSql) — a
1406
+ // request never files a row under someone else's account. Any doubt (no users
1407
+ // table, a failed check) drops it.
1408
+ async function __dataGuestFallback(client, req, value) {
1409
+ if (typeof value !== 'string' || !UUID_RE.test(value)) return undefined;
1410
+ var token = await __dataSession(req);
1411
+ if (token) {
1412
+ var own = token.id || token.sub;
1413
+ return own && String(own) === value ? value : undefined;
1414
+ }
1415
+ try {
1416
+ var registered = await client.query(
1417
+ 'SELECT 1 FROM ' + GUEST_FALLBACK_USERS_TABLE + " WHERE id::text = $1 AND ${TableAccess.registeredAccountEmailSql(
1418
+ 'email'
1419
+ )} LIMIT 1",
1420
+ [value]
1421
+ );
1422
+ return registered && registered.rows && registered.rows.length > 0 ? undefined : value;
1423
+ } catch (e) {
1424
+ return undefined;
1425
+ }
1426
+ }
1427
+
1428
+ // How many rows a read gets. A browser (the storefront's own reads) gets
1429
+ // BROWSER_DEFAULT_LIMIT rows when it names no count, never more than
1430
+ // BROWSER_MAX_LIMIT, starts no further in than BROWSER_MAX_OFFSET, and a count
1431
+ // that is not a whole number is refused. The app's own server code reads what
1432
+ // it names (a count it cannot read is left out, as before).
1433
+ var BROWSER_DEFAULT_LIMIT = ${DATA_API_BROWSER_DEFAULT_LIMIT};
1434
+ var BROWSER_MAX_LIMIT = ${DATA_API_BROWSER_MAX_LIMIT};
1435
+ var BROWSER_MAX_OFFSET = ${DATA_API_BROWSER_MAX_OFFSET};
1436
+
1437
+ function __dataRowCount(value, label, strict) {
1438
+ if (value === undefined || value === null || value === '') return undefined;
1439
+ var text = String(value).trim();
1440
+ if (/^[0-9]{1,15}$/.test(text)) return parseInt(text, 10);
1441
+ if (strict) {
1442
+ var err = new Error('Invalid ' + label);
1443
+ err.status = 400;
1444
+ throw err;
1445
+ }
1446
+ var parsed = parseInt(text, 10);
1447
+ return isNaN(parsed) || parsed < 0 ? undefined : parsed;
1448
+ }
1449
+
1450
+ function __dataReadWindow(req, limit, skip) {
1451
+ if (isInternalDataRequest(req)) {
1452
+ return { limit: __dataRowCount(limit, 'limit', false), skip: __dataRowCount(skip, 'skip', false) };
1453
+ }
1454
+ var browserLimit = __dataRowCount(limit, 'limit', true);
1455
+ var browserSkip = __dataRowCount(skip, 'skip', true);
1456
+ return {
1457
+ limit: Math.min(browserLimit === undefined ? BROWSER_DEFAULT_LIMIT : browserLimit, BROWSER_MAX_LIMIT),
1458
+ skip: browserSkip === undefined ? undefined : Math.min(browserSkip, BROWSER_MAX_OFFSET),
1459
+ };
1460
+ }
1461
+
1462
+ // Whose record a customer-table row is (see TableAccess.OWNER_* in
1463
+ // teleport-shared). A server segment reads these tables for a visitor with the
1464
+ // app secret, so the browser's session reaches here only as the cookie the
1465
+ // segment forwards — and the filter values only as the context the browser
1466
+ // sent. So for a visitor who is not staff — a guest, an ordinary account, a
1467
+ // customer role such as a subscription's member — a filter on an owner column:
1468
+ // - never widens the read: an empty or "all" value, a negation or a pattern
1469
+ // matches nothing — a guest's own rows, found by the guest key the same read
1470
+ // names (session_id …), are the ones no account owns;
1471
+ // - names only the visitor: for a signed-in visitor the value must be the
1472
+ // session's own id (or email), never one the browser chose.
1473
+ // A staff role (STAFF_ROLES: the admin panel's roles and admin) reads every
1474
+ // customer's records.
1475
+ var OWNER_SCOPED_TABLES = ${JSON.stringify(TableAccess.CUSTOMER_RECORD_TABLES)};
1476
+ var OWNER_ID_COLUMNS = ${JSON.stringify(TableAccess.OWNER_ID_COLUMNS)};
1477
+ var OWNER_EMAIL_COLUMNS = ${JSON.stringify(TableAccess.OWNER_EMAIL_COLUMNS)};
1478
+ var OWNER_COLUMNS_BY_TABLE = ${JSON.stringify(TableAccess.OWNER_COLUMNS_BY_TABLE)};
1479
+ // The private customer records (TableAccess.PRIVATE_CUSTOMER_RECORD_TABLES): a
1480
+ // visitor's read of one is always the visitor's own rows, whatever its filters
1481
+ // name (__dataWithPrivateScope).
1482
+ var PRIVATE_RECORD_TABLES = ${JSON.stringify(TableAccess.PRIVATE_CUSTOMER_RECORD_TABLES)};
1483
+ var PRIVATE_RECORD_PARENTS = ${JSON.stringify(TableAccess.PRIVATE_RECORD_PARENTS)};
1484
+ var GUEST_KEY_COLUMNS = ${JSON.stringify(GUEST_KEY_COLUMNS)};
1485
+ // The accounts table a guest's fallback id is checked against.
1486
+ var GUEST_FALLBACK_USERS_TABLE = ${JSON.stringify(
1487
+ authUsersTable && /^[A-Za-z_][A-Za-z0-9_]*$/.test(authUsersTable) ? authUsersTable : 'users'
1488
+ )};
1489
+ var STAFF_ROLES = ${JSON.stringify(staffRoles)};
1490
+
1491
+ async function __dataSession(req) {
1492
+ if (typeof __tqSessionToken !== 'function') return null;
1493
+ try {
1494
+ return (await __tqSessionToken(req)) || null;
1495
+ } catch (e) {
1496
+ return null;
1497
+ }
1498
+ }
1499
+
1500
+ // The visitor a read of \`tableName\` is scoped to, or null when it is not
1501
+ // scoped: not a customer table, a browser (which reads none of them here), or
1502
+ // a staff role.
1503
+ async function __dataOwnerScope(req, tableName) {
1504
+ if (!isInternalDataRequest(req)) return null;
1505
+ // Every segment a visitor's request runs is scoped; only a server job (a
1506
+ // cron, a webhook, an automation) reads the customer records as before. An
1507
+ // admin server step runs with a staff session (below).
1508
+ if (__dataIsServerJob(req)) return null;
1509
+ var table = __taNormalizeTable(tableName);
1510
+ if (OWNER_SCOPED_TABLES.indexOf(table) === -1) return null;
1511
+ var token = await __dataSession(req);
1512
+ var role = token ? __taRoleOf(token) : null;
1513
+ if (role && STAFF_ROLES.indexOf(role) !== -1) return null;
1514
+ var own = Object.prototype.hasOwnProperty.call(OWNER_COLUMNS_BY_TABLE, table) ? OWNER_COLUMNS_BY_TABLE[table] : null;
1515
+ return {
1516
+ table: table,
1517
+ ids: own ? own.ids : OWNER_ID_COLUMNS,
1518
+ emails: own ? own.emails : OWNER_EMAIL_COLUMNS,
1519
+ signedIn: !!token,
1520
+ sessionId: token && (token.id || token.sub) ? String(token.id || token.sub) : '',
1521
+ sessionEmail: token && token.email ? String(token.email).trim().toLowerCase() : '',
1522
+ };
1523
+ }
1524
+
1525
+ // A visitor's read of a private record table that its own filters do not bind
1526
+ // to the visitor (__dataReadIsBoundToVisitor) gets the owner condition anyway:
1527
+ // a list built with no owner filter shows only the visitor's rows. A session's
1528
+ // is its id or email on the table's owner columns (or its parent row's, for a
1529
+ // table owned through one); a guest's read of one is its guest key's, or
1530
+ // nothing.
1531
+ async function __dataWithPrivateScope(client, scope, filters, queryParams, where) {
1532
+ if (!scope || PRIVATE_RECORD_TABLES.indexOf(scope.table) === -1) return where;
1533
+ if (__dataReadIsBoundToVisitor(scope, filters)) return where;
1534
+ // A read one of whose conditions is already FALSE finds nothing as it is.
1535
+ if (/(?:^ WHERE | AND )FALSE(?: AND |$)/.test(where.clause || '')) return where;
1536
+ var condition = scope.signedIn
1537
+ ? await __dataPrivateOwnerCondition(client, scope, scope.table, queryParams, 0)
1538
+ : 'FALSE';
1539
+ return {
1540
+ clause: (where.clause ? where.clause + ' AND ' : ' WHERE ') + condition,
1541
+ paramIndex: queryParams.length + 1,
1542
+ };
1543
+ }
1544
+
1545
+ // The session's own rows of \`table\`, by the owner columns it has (read from
1546
+ // the schema), or by its parent row's (PRIVATE_RECORD_PARENTS); 'FALSE' when it
1547
+ // has neither, or the session lacks the identity they name.
1548
+ async function __dataPrivateOwnerCondition(client, scope, table, queryParams, depth) {
1549
+ var types = await getColumnTypes(client, table);
1550
+ var columns = Object.keys(types).map(function(name) { return String(name).toLowerCase(); });
1551
+ var own = Object.prototype.hasOwnProperty.call(OWNER_COLUMNS_BY_TABLE, table) ? OWNER_COLUMNS_BY_TABLE[table] : null;
1552
+ var present = function(name) { return columns.indexOf(name) !== -1; };
1553
+ var ids = (own ? own.ids : OWNER_ID_COLUMNS).filter(present);
1554
+ var emails = (own ? own.emails : OWNER_EMAIL_COLUMNS).filter(present);
1555
+ if (ids.length > 0 || emails.length > 0) {
1556
+ var parts = [];
1557
+ if (scope.sessionId) {
1558
+ ids.forEach(function(name) {
1559
+ queryParams.push(scope.sessionId);
1560
+ parts.push(name + '::text = $' + queryParams.length);
1561
+ });
1562
+ }
1563
+ if (scope.sessionEmail) {
1564
+ emails.forEach(function(name) {
1565
+ queryParams.push(scope.sessionEmail);
1566
+ parts.push('LOWER(' + name + '::text) = $' + queryParams.length);
1567
+ });
1568
+ }
1569
+ return parts.length > 0 ? '(' + parts.join(' OR ') + ')' : 'FALSE';
1570
+ }
1571
+ var parent = Object.prototype.hasOwnProperty.call(PRIVATE_RECORD_PARENTS, table) ? PRIVATE_RECORD_PARENTS[table] : null;
1572
+ if (!parent || depth >= 3 || !present(parent.column)) return 'FALSE';
1573
+ var inner = await __dataPrivateOwnerCondition(client, scope, parent.parent, queryParams, depth + 1);
1574
+ if (inner === 'FALSE') return 'FALSE';
1575
+ return parent.column + ' IN (SELECT id FROM ' + parent.parent + ' WHERE ' + inner + ')';
1576
+ }
1577
+
1578
+ function __dataIsOwnerColumn(scope, field) {
1579
+ var column = __taNormalizeTable(field);
1580
+ return scope.ids.indexOf(column) !== -1 || scope.emails.indexOf(column) !== -1;
1581
+ }
1582
+
1583
+ // Whether a filter binds the read to a guest's own browser key: a guest-key
1584
+ // column equal (=, nothing else) to one concrete value. A LIKE, a negation, a
1585
+ // "contains", a list or a value that would drop the condition (empty, "all", a
1586
+ // bare wildcard) binds nothing.
1587
+ function __dataNamesGuestKey(filters) {
1588
+ for (var i = 0; i < filters.length; i++) {
1589
+ var f = filters[i] || {};
1590
+ var column = __taNormalizeTable(f.source || f.field);
1591
+ var value = f.destination !== undefined ? f.destination : f.value;
1592
+ if (
1593
+ GUEST_KEY_COLUMNS.indexOf(column) !== -1 &&
1594
+ typeof value === 'string' &&
1595
+ __dataFilterOperator(f.operand || f.operator || '=', value) === '=' &&
1596
+ !__dataIsWideningValue(value, f)
1597
+ ) {
1598
+ return true;
1599
+ }
1600
+ }
1601
+ return false;
1602
+ }
1603
+
1604
+ // The operator buildWhereClause would write for this filter.
1605
+ function __dataFilterOperator(operand, value) {
1606
+ var normalized = String(operand || '=').toLowerCase();
1607
+ if (Array.isArray(value)) return operand === '!=' ? '!=' : '=';
1608
+ if (/^(?:not[_-]?)?contains$|^starts[_-]?with$|^ends[_-]?with$/.test(normalized)) return 'like';
1609
+ var validOps = ['=', '!=', '>', '<', '>=', '<=', 'LIKE', 'ILIKE'];
1610
+ return validOps.indexOf(operand) !== -1 ? operand : '=';
1611
+ }
1612
+
1613
+ // null when the owner filter may run as written, else the clause it becomes.
1614
+ // Whether some filter binds the read to the visitor: for a signed-in visitor an
1615
+ // owner filter whose value is the session's own; for a guest a guest-key filter.
1616
+ function __dataReadIsBoundToVisitor(scope, filters) {
1617
+ if (!Array.isArray(filters)) return false;
1618
+ if (!scope.signedIn) return __dataNamesGuestKey(filters);
1619
+ for (var i = 0; i < filters.length; i++) {
1620
+ var f = filters[i] || {};
1621
+ var field = f.source || f.field;
1622
+ if (!field || !__dataIsOwnerColumn(scope, field)) continue;
1623
+ var value = f.destination !== undefined ? f.destination : f.value;
1624
+ if (__dataOwnerClause(scope, field, value, f.operand || f.operator || '=', f, filters) === null) return true;
1625
+ }
1626
+ return false;
1627
+ }
1628
+
1629
+ // A value that would drop its condition: empty, missing, "all"/wildcard, or one
1630
+ // the data-select node marked as left out.
1631
+ function __dataIsWideningValue(value, filter) {
1632
+ return filter.__skippable === true || isMissingFilterValue(value) || isSkippableFilterValue(value) ||
1633
+ isAllSentinelFilterValue(value, filter) || value === '__TQ_UNRESOLVED_ROUTE_PARAM__' ||
1634
+ (typeof value === 'string' && /^[*%]+$/.test(value.trim()));
1635
+ }
1636
+
1637
+ function __dataOwnerClause(scope, field, value, operand, filter, filters) {
1638
+ var empty = __dataIsWideningValue(value, filter);
1639
+ if (empty) {
1640
+ return !scope.signedIn && __dataNamesGuestKey(filters) ? field + ' IS NULL' : 'FALSE';
1641
+ }
1642
+ if (__dataFilterOperator(operand, value) !== '=') return 'FALSE';
1643
+ var values = Array.isArray(value) ? value : [value];
1644
+ var isEmailColumn = scope.emails.indexOf(__taNormalizeTable(field)) !== -1;
1645
+ for (var i = 0; i < values.length; i++) {
1646
+ var entry = values[i];
1647
+ if (entry === null || entry === undefined || typeof entry === 'object') return 'FALSE';
1648
+ var text = String(entry).trim();
1649
+ if (text === '' || isAllSentinelFilterValue(text, null)) return 'FALSE';
1650
+ // A guest never names whose record to read: only a read bound to the
1651
+ // guest's own browser key (a guest-key filter with a value) may carry one.
1652
+ if (!scope.signedIn) {
1653
+ if (!__dataNamesGuestKey(filters)) return 'FALSE';
1654
+ continue;
1655
+ }
1656
+ var own = isEmailColumn ? scope.sessionEmail : scope.sessionId;
1657
+ if (!own || (isEmailColumn ? text.toLowerCase() !== own : text !== own)) {
1658
+ console.warn('[data-api] refused a read of ' + scope.table + ' by ' + field + ': it names another account than the session');
1659
+ return 'FALSE';
1660
+ }
1661
+ }
1662
+ return null;
1663
+ }
1664
+
1002
1665
  var WRITE_OPERATIONS = { create: 1, update: 1, delete: 1 };
1003
1666
 
1004
1667
  // See BROWSER_READABLE_TABLES / BROWSER_ROW_POLICIES in data-api-route-generator.ts.
@@ -1084,6 +1747,20 @@ function __forbidBrowserOperation(what) {
1084
1747
  throw err;
1085
1748
  }
1086
1749
 
1750
+ // The retired tables (TableAccess.RETIRED_TABLES: the old password_reset_tokens)
1751
+ // are refused to EVERY caller, the app's own server code and its jobs included,
1752
+ // before anything else runs: by the table a request names, and by any mention
1753
+ // in a raw statement's text.
1754
+ function assertNoRetiredTable(operation, body) {
1755
+ if (!body || typeof body !== 'object') return;
1756
+ var sql = operation === 'raw-query' ? body.query : body.rawQueryUserPart;
1757
+ if (__taRetiredTableNamed(body.tableName, typeof sql === 'string' ? sql : null)) {
1758
+ var err = new Error('Forbidden');
1759
+ err.status = 403;
1760
+ throw err;
1761
+ }
1762
+ }
1763
+
1087
1764
  // Refuses a browser's access to the money tables (see the shared table-access
1088
1765
  // helper above); a trusted internal call passes untouched. Where the app can
1089
1766
  // tell its own server-side calls apart (__taBrowserIsReadOnly), a browser only
@@ -1094,7 +1771,10 @@ function assertTableAccess(req, operation, body) {
1094
1771
  if (__taBrowserIsReadOnly(req)) {
1095
1772
  if (operation !== 'select' && operation !== 'count') __forbidBrowserOperation('the ' + operation + ' operation');
1096
1773
  if (body.rawQueryUserPart) __forbidBrowserOperation('a raw query');
1097
- if (BROWSER_READABLE_TABLES.indexOf(__dataPublicTable(body.tableName)) === -1) {
1774
+ if (
1775
+ BROWSER_READABLE_TABLES.indexOf(__dataPublicTable(body.tableName)) === -1 &&
1776
+ req.__tqBrowserExposure !== true
1777
+ ) {
1098
1778
  __forbidBrowserOperation('reading ' + String(body.tableName || 'this table'));
1099
1779
  }
1100
1780
  }
@@ -1114,14 +1794,55 @@ function assertTableAccess(req, operation, body) {
1114
1794
  }
1115
1795
 
1116
1796
  // The columns of the auth users table that decide what a session may DO, not
1117
- // who it is. The session token carries role / roleName / roles off the
1118
- // \`users\` row, and the middleware's page gates and the money-table guard
1119
- // both read the role off it — so a browser that could write one of these
1120
- // columns would be handing itself the store administrator's reads. Everything
1121
- // else on the row stays writable: a generated profile form updates whatever
1122
- // columns the merchant put there, and only the server-side segments (which
1123
- // present the app secret) may grant a role.
1124
- var AUTH_ROLE_COLUMNS = { role: 1, roles: 1, rolename: 1, role_name: 1 };
1797
+ // who it is: a role, an admin or staff flag, a verified email, credit, a plan,
1798
+ // an entitlement, in any spelling (the one shared rule,
1799
+ // AccountFields.isPrivilegedAccountField). The session token carries the role
1800
+ // off the \`users\` row, and the middleware's page gates and the money-table
1801
+ // guard both read it — so a visitor who could write one of these would be
1802
+ // handing themselves the store administrator's reads. A browser never writes
1803
+ // one; a server segment writes one only for staff (STAFF_ROLES) or as the
1804
+ // server's own job (no visitor): a segment acts for the visitor whose cookie
1805
+ // it forwards, and a profile form that maps one of these would let a customer
1806
+ // make themselves the administrator. Everything else on the row stays
1807
+ // writable, and the rule is the ACCOUNT table's only: \`plan\`, \`tier\` or
1808
+ // \`credits\` are ordinary columns of any other table.
1809
+ ${AccountFields.generatePrivilegedAccountFieldCode('__dataIsPrivilegedAccountColumn')}
1810
+
1811
+ // The privileged account columns a statement's text names.
1812
+ function __dataPrivilegedColumnsNamed(text) {
1813
+ var words = String(text || '').match(/[A-Za-z_][A-Za-z0-9_$]*/g) || [];
1814
+ return words.filter(__dataIsPrivilegedAccountColumn);
1815
+ }
1816
+
1817
+ function __dataWrittenColumns(body) {
1818
+ var columnMappings = (body && body.columnMappings) || {};
1819
+ return Array.isArray(columnMappings)
1820
+ ? columnMappings.map(function(m) { return m && (m.source || m.column); })
1821
+ : Object.keys(columnMappings);
1822
+ }
1823
+
1824
+ async function assertNoPrivilegeWriteForCustomer(req, operation, body) {
1825
+ if (ROLE_SOURCE_TABLES.length === 0 || !isInternalDataRequest(req)) return;
1826
+ if (!body || typeof body !== 'object') return;
1827
+ var sql = operation === 'raw-query' ? body.query : null;
1828
+ var written = [];
1829
+ if (typeof sql === 'string' && sql.length > 0) {
1830
+ var cleaned = __taCleanSql(sql);
1831
+ if (cleaned.ok && !__TA_SQL_WRITE_RE.test(cleaned.text)) return;
1832
+ var mentionsAccounts = ROLE_SOURCE_TABLES.some(function(table) { return __taSqlMentionsTable(sql, table); });
1833
+ if (!mentionsAccounts) return;
1834
+ written = __dataPrivilegedColumnsNamed(cleaned.ok ? cleaned.text : sql);
1835
+ } else if (operation === 'create' || operation === 'update') {
1836
+ if (ROLE_SOURCE_TABLES.indexOf(__taNormalizeTable(body.tableName)) === -1) return;
1837
+ written = __dataWrittenColumns(body).filter(function(column) { return __dataIsPrivilegedAccountColumn(column); });
1838
+ }
1839
+ if (written.length === 0) return;
1840
+ var token = await __dataSession(req);
1841
+ if (!token) return;
1842
+ var role = __taRoleOf(token);
1843
+ if (role && STAFF_ROLES.indexOf(role) !== -1) return;
1844
+ __forbidRoleWrite(written[0]);
1845
+ }
1125
1846
 
1126
1847
  // The identity table this route guards, and \`users\`, which is where the auth
1127
1848
  // options read the session's role from whatever the identity table is called.
@@ -1159,7 +1880,7 @@ function assertNoBrowserRoleWrite(req, operation, body) {
1159
1880
  ? columnMappings.map(function(m) { return m && (m.source || m.column); })
1160
1881
  : Object.keys(columnMappings);
1161
1882
  for (var i = 0; i < written.length; i++) {
1162
- if (AUTH_ROLE_COLUMNS[__taNormalizeTable(written[i])]) __forbidRoleWrite(written[i]);
1883
+ if (__dataIsPrivilegedAccountColumn(written[i])) __forbidRoleWrite(written[i]);
1163
1884
  }
1164
1885
  }
1165
1886
 
@@ -1212,7 +1933,7 @@ module.exports = async function handler(req, res) {
1212
1933
  if (req.method !== 'POST') {
1213
1934
  return res.status(405).json({ error: 'Method not allowed' });
1214
1935
  }
1215
-
1936
+ ${withAutomations ? ' kickDueAutomations(req);\n' : ''}
1216
1937
  var params = req.query.params;
1217
1938
  if (!params || params.length < 2) {
1218
1939
  return res.status(400).json({ error: 'Invalid path. Expected /api/data/<dataSourceId>/<operation>' });
@@ -1231,8 +1952,15 @@ module.exports = async function handler(req, res) {
1231
1952
  var client = getClient();
1232
1953
 
1233
1954
  try {
1955
+ assertNoRetiredTable(operation, body);
1956
+ // A browser's read of a table the storefront runtime does not read is
1957
+ // admitted the way its per-table route admits it (DATA_EXPOSURE_TABLES).
1958
+ if (!isInternalDataRequest(req) && (operation === 'select' || operation === 'count') && body && body.tableName) {
1959
+ req.__tqBrowserExposure = await __dataBrowserMayRead(req, String(params[0]), body.tableName);
1960
+ }
1234
1961
  assertTableAccess(req, operation, body);
1235
1962
  assertNoBrowserRoleWrite(req, operation, body);
1963
+ await assertNoPrivilegeWriteForCustomer(req, operation, body);
1236
1964
  await assertSessionOwnsUsersRow(req, operation, body);
1237
1965
  await client.connect();
1238
1966
  var result;
@@ -1245,10 +1973,10 @@ module.exports = async function handler(req, res) {
1245
1973
  result = await handleCount(client, body, req);
1246
1974
  break;
1247
1975
  case 'create':
1248
- result = await handleCreate(client, body);
1976
+ result = await handleCreate(client, body, req);
1249
1977
  break;
1250
1978
  case 'update':
1251
- result = await handleUpdate(client, body);
1979
+ result = await handleUpdate(client, body, req);
1252
1980
  break;
1253
1981
  case 'delete':
1254
1982
  result = await handleDelete(client, body);
@@ -1263,7 +1991,16 @@ module.exports = async function handler(req, res) {
1263
1991
  return res.status(400).json({ error: 'Unknown operation: ' + operation });
1264
1992
  }
1265
1993
 
1266
- return res.status(200).json(result);
1994
+ ${
1995
+ withAutomations
1996
+ ? ` // The write succeeded: a new business event wakes the automations.
1997
+ if (wroteBusinessEvent(operation, body, result, req)) {
1998
+ wakeAutomations(req);
1999
+ }
2000
+
2001
+ `
2002
+ : ''
2003
+ } return res.status(200).json(result);
1267
2004
  } catch (error) {
1268
2005
  // Return proper status codes for validation errors
1269
2006
  var statusCode = error.status || 500;