@teleporthq/teleport-plugin-next-workflows 0.43.9 → 0.43.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/account-node-output-contract.test.ts +69 -0
- package/__tests__/data-create-item-cart-mark-ordered.test.ts +30 -0
- package/__tests__/navigation-go-to-page.test.ts +34 -0
- package/__tests__/node-audit-fixes.test.ts +144 -0
- package/__tests__/runtime-trigger-element-roundtrip.test.ts +156 -0
- package/__tests__/state-update-default-value.test.ts +286 -0
- package/__tests__/transform-generate-output.test.ts +47 -0
- package/dist/cjs/executor-generator.d.ts.map +1 -1
- package/dist/cjs/executor-generator.js +72 -8
- package/dist/cjs/executor-generator.js.map +1 -1
- package/dist/cjs/nodes/account/account-compare-passwords.d.ts.map +1 -1
- package/dist/cjs/nodes/account/account-compare-passwords.js +3 -1
- package/dist/cjs/nodes/account/account-compare-passwords.js.map +1 -1
- package/dist/cjs/nodes/account/account-get-current.d.ts.map +1 -1
- package/dist/cjs/nodes/account/account-get-current.js +23 -4
- package/dist/cjs/nodes/account/account-get-current.js.map +1 -1
- package/dist/cjs/nodes/account/account-login.d.ts.map +1 -1
- package/dist/cjs/nodes/account/account-login.js +15 -5
- package/dist/cjs/nodes/account/account-login.js.map +1 -1
- package/dist/cjs/nodes/account/account-signup.d.ts.map +1 -1
- package/dist/cjs/nodes/account/account-signup.js +15 -5
- package/dist/cjs/nodes/account/account-signup.js.map +1 -1
- package/dist/cjs/nodes/ai/ai-provider-utils.d.ts.map +1 -1
- package/dist/cjs/nodes/ai/ai-provider-utils.js +24 -9
- package/dist/cjs/nodes/ai/ai-provider-utils.js.map +1 -1
- package/dist/cjs/nodes/data/data-create-item.d.ts.map +1 -1
- package/dist/cjs/nodes/data/data-create-item.js +15 -0
- package/dist/cjs/nodes/data/data-create-item.js.map +1 -1
- package/dist/cjs/nodes/element/element-add-class.d.ts.map +1 -1
- package/dist/cjs/nodes/element/element-add-class.js +14 -5
- package/dist/cjs/nodes/element/element-add-class.js.map +1 -1
- package/dist/cjs/nodes/element/element-remove-class.d.ts.map +1 -1
- package/dist/cjs/nodes/element/element-remove-class.js +14 -5
- package/dist/cjs/nodes/element/element-remove-class.js.map +1 -1
- package/dist/cjs/nodes/element/element-set-attribute.d.ts.map +1 -1
- package/dist/cjs/nodes/element/element-set-attribute.js +11 -1
- package/dist/cjs/nodes/element/element-set-attribute.js.map +1 -1
- package/dist/cjs/nodes/element/element-toggle-class.d.ts.map +1 -1
- package/dist/cjs/nodes/element/element-toggle-class.js +20 -4
- package/dist/cjs/nodes/element/element-toggle-class.js.map +1 -1
- package/dist/cjs/nodes/email/email-resend.d.ts.map +1 -1
- package/dist/cjs/nodes/email/email-resend.js +3 -1
- package/dist/cjs/nodes/email/email-resend.js.map +1 -1
- package/dist/cjs/nodes/integrations/integration-amazon-s3.d.ts.map +1 -1
- package/dist/cjs/nodes/integrations/integration-amazon-s3.js +21 -5
- package/dist/cjs/nodes/integrations/integration-amazon-s3.js.map +1 -1
- package/dist/cjs/nodes/integrations/integration-amplitude.d.ts.map +1 -1
- package/dist/cjs/nodes/integrations/integration-amplitude.js +5 -3
- package/dist/cjs/nodes/integrations/integration-amplitude.js.map +1 -1
- package/dist/cjs/nodes/integrations/integration-discord.d.ts.map +1 -1
- package/dist/cjs/nodes/integrations/integration-discord.js +4 -1
- package/dist/cjs/nodes/integrations/integration-discord.js.map +1 -1
- package/dist/cjs/nodes/integrations/integration-generic.d.ts +1 -1
- package/dist/cjs/nodes/integrations/integration-generic.d.ts.map +1 -1
- package/dist/cjs/nodes/integrations/integration-generic.js +7 -2
- package/dist/cjs/nodes/integrations/integration-generic.js.map +1 -1
- package/dist/cjs/nodes/integrations/integration-greenhouse.d.ts.map +1 -1
- package/dist/cjs/nodes/integrations/integration-greenhouse.js +16 -2
- package/dist/cjs/nodes/integrations/integration-greenhouse.js.map +1 -1
- package/dist/cjs/nodes/integrations/integration-linear.d.ts.map +1 -1
- package/dist/cjs/nodes/integrations/integration-linear.js +3 -1
- package/dist/cjs/nodes/integrations/integration-linear.js.map +1 -1
- package/dist/cjs/nodes/integrations/integration-mailchimp.d.ts.map +1 -1
- package/dist/cjs/nodes/integrations/integration-mailchimp.js +3 -0
- package/dist/cjs/nodes/integrations/integration-mailchimp.js.map +1 -1
- package/dist/cjs/nodes/integrations/integration-monday.d.ts.map +1 -1
- package/dist/cjs/nodes/integrations/integration-monday.js +8 -0
- package/dist/cjs/nodes/integrations/integration-monday.js.map +1 -1
- package/dist/cjs/nodes/integrations/integration-segment.d.ts.map +1 -1
- package/dist/cjs/nodes/integrations/integration-segment.js +3 -1
- package/dist/cjs/nodes/integrations/integration-segment.js.map +1 -1
- package/dist/cjs/nodes/integrations/integration-slack.d.ts.map +1 -1
- package/dist/cjs/nodes/integrations/integration-slack.js +17 -6
- package/dist/cjs/nodes/integrations/integration-slack.js.map +1 -1
- package/dist/cjs/nodes/integrations/integration-woocommerce.d.ts.map +1 -1
- package/dist/cjs/nodes/integrations/integration-woocommerce.js +7 -1
- package/dist/cjs/nodes/integrations/integration-woocommerce.js.map +1 -1
- package/dist/cjs/nodes/integrations/integration-youtube.js +7 -7
- package/dist/cjs/nodes/integrations/integration-youtube.js.map +1 -1
- package/dist/cjs/nodes/navigation/navigation-go-to-page.d.ts.map +1 -1
- package/dist/cjs/nodes/navigation/navigation-go-to-page.js +18 -4
- package/dist/cjs/nodes/navigation/navigation-go-to-page.js.map +1 -1
- package/dist/cjs/nodes/payment/payment-create-customer.d.ts.map +1 -1
- package/dist/cjs/nodes/payment/payment-create-customer.js +14 -1
- package/dist/cjs/nodes/payment/payment-create-customer.js.map +1 -1
- package/dist/cjs/nodes/sms/sms-infobip.d.ts.map +1 -1
- package/dist/cjs/nodes/sms/sms-infobip.js +3 -1
- package/dist/cjs/nodes/sms/sms-infobip.js.map +1 -1
- package/dist/cjs/nodes/toast/toast-show.js +1 -1
- package/dist/cjs/nodes/transform/transform-date-time.d.ts.map +1 -1
- package/dist/cjs/nodes/transform/transform-date-time.js +1 -0
- package/dist/cjs/nodes/transform/transform-date-time.js.map +1 -1
- package/dist/cjs/nodes/transform/transform-generate.d.ts.map +1 -1
- package/dist/cjs/nodes/transform/transform-generate.js +6 -3
- package/dist/cjs/nodes/transform/transform-generate.js.map +1 -1
- package/dist/cjs/nodes/transform/transform-validate.d.ts.map +1 -1
- package/dist/cjs/nodes/transform/transform-validate.js +1 -2
- package/dist/cjs/nodes/transform/transform-validate.js.map +1 -1
- package/dist/cjs/nodes/utility/utility-scrape-website.d.ts.map +1 -1
- package/dist/cjs/nodes/utility/utility-scrape-website.js +11 -2
- package/dist/cjs/nodes/utility/utility-scrape-website.js.map +1 -1
- package/dist/cjs/nodes/utility/utility-xml-parse.d.ts.map +1 -1
- package/dist/cjs/nodes/utility/utility-xml-parse.js +11 -2
- package/dist/cjs/nodes/utility/utility-xml-parse.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/cjs/workflow-component-plugin.js +23 -4
- package/dist/cjs/workflow-component-plugin.js.map +1 -1
- package/dist/cjs/workflow-project-plugin.d.ts.map +1 -1
- package/dist/cjs/workflow-project-plugin.js +15 -10
- package/dist/cjs/workflow-project-plugin.js.map +1 -1
- package/dist/esm/executor-generator.d.ts.map +1 -1
- package/dist/esm/executor-generator.js +72 -8
- package/dist/esm/executor-generator.js.map +1 -1
- package/dist/esm/nodes/account/account-compare-passwords.d.ts.map +1 -1
- package/dist/esm/nodes/account/account-compare-passwords.js +3 -1
- package/dist/esm/nodes/account/account-compare-passwords.js.map +1 -1
- package/dist/esm/nodes/account/account-get-current.d.ts.map +1 -1
- package/dist/esm/nodes/account/account-get-current.js +23 -4
- package/dist/esm/nodes/account/account-get-current.js.map +1 -1
- package/dist/esm/nodes/account/account-login.d.ts.map +1 -1
- package/dist/esm/nodes/account/account-login.js +15 -5
- package/dist/esm/nodes/account/account-login.js.map +1 -1
- package/dist/esm/nodes/account/account-signup.d.ts.map +1 -1
- package/dist/esm/nodes/account/account-signup.js +15 -5
- package/dist/esm/nodes/account/account-signup.js.map +1 -1
- package/dist/esm/nodes/ai/ai-provider-utils.d.ts.map +1 -1
- package/dist/esm/nodes/ai/ai-provider-utils.js +24 -9
- package/dist/esm/nodes/ai/ai-provider-utils.js.map +1 -1
- package/dist/esm/nodes/data/data-create-item.d.ts.map +1 -1
- package/dist/esm/nodes/data/data-create-item.js +15 -0
- package/dist/esm/nodes/data/data-create-item.js.map +1 -1
- package/dist/esm/nodes/element/element-add-class.d.ts.map +1 -1
- package/dist/esm/nodes/element/element-add-class.js +14 -5
- package/dist/esm/nodes/element/element-add-class.js.map +1 -1
- package/dist/esm/nodes/element/element-remove-class.d.ts.map +1 -1
- package/dist/esm/nodes/element/element-remove-class.js +14 -5
- package/dist/esm/nodes/element/element-remove-class.js.map +1 -1
- package/dist/esm/nodes/element/element-set-attribute.d.ts.map +1 -1
- package/dist/esm/nodes/element/element-set-attribute.js +11 -1
- package/dist/esm/nodes/element/element-set-attribute.js.map +1 -1
- package/dist/esm/nodes/element/element-toggle-class.d.ts.map +1 -1
- package/dist/esm/nodes/element/element-toggle-class.js +20 -4
- package/dist/esm/nodes/element/element-toggle-class.js.map +1 -1
- package/dist/esm/nodes/email/email-resend.d.ts.map +1 -1
- package/dist/esm/nodes/email/email-resend.js +3 -1
- package/dist/esm/nodes/email/email-resend.js.map +1 -1
- package/dist/esm/nodes/integrations/integration-amazon-s3.d.ts.map +1 -1
- package/dist/esm/nodes/integrations/integration-amazon-s3.js +21 -5
- package/dist/esm/nodes/integrations/integration-amazon-s3.js.map +1 -1
- package/dist/esm/nodes/integrations/integration-amplitude.d.ts.map +1 -1
- package/dist/esm/nodes/integrations/integration-amplitude.js +5 -3
- package/dist/esm/nodes/integrations/integration-amplitude.js.map +1 -1
- package/dist/esm/nodes/integrations/integration-discord.d.ts.map +1 -1
- package/dist/esm/nodes/integrations/integration-discord.js +4 -1
- package/dist/esm/nodes/integrations/integration-discord.js.map +1 -1
- package/dist/esm/nodes/integrations/integration-generic.d.ts +1 -1
- package/dist/esm/nodes/integrations/integration-generic.d.ts.map +1 -1
- package/dist/esm/nodes/integrations/integration-generic.js +7 -2
- package/dist/esm/nodes/integrations/integration-generic.js.map +1 -1
- package/dist/esm/nodes/integrations/integration-greenhouse.d.ts.map +1 -1
- package/dist/esm/nodes/integrations/integration-greenhouse.js +16 -2
- package/dist/esm/nodes/integrations/integration-greenhouse.js.map +1 -1
- package/dist/esm/nodes/integrations/integration-linear.d.ts.map +1 -1
- package/dist/esm/nodes/integrations/integration-linear.js +3 -1
- package/dist/esm/nodes/integrations/integration-linear.js.map +1 -1
- package/dist/esm/nodes/integrations/integration-mailchimp.d.ts.map +1 -1
- package/dist/esm/nodes/integrations/integration-mailchimp.js +3 -0
- package/dist/esm/nodes/integrations/integration-mailchimp.js.map +1 -1
- package/dist/esm/nodes/integrations/integration-monday.d.ts.map +1 -1
- package/dist/esm/nodes/integrations/integration-monday.js +8 -0
- package/dist/esm/nodes/integrations/integration-monday.js.map +1 -1
- package/dist/esm/nodes/integrations/integration-segment.d.ts.map +1 -1
- package/dist/esm/nodes/integrations/integration-segment.js +3 -1
- package/dist/esm/nodes/integrations/integration-segment.js.map +1 -1
- package/dist/esm/nodes/integrations/integration-slack.d.ts.map +1 -1
- package/dist/esm/nodes/integrations/integration-slack.js +17 -6
- package/dist/esm/nodes/integrations/integration-slack.js.map +1 -1
- package/dist/esm/nodes/integrations/integration-woocommerce.d.ts.map +1 -1
- package/dist/esm/nodes/integrations/integration-woocommerce.js +7 -1
- package/dist/esm/nodes/integrations/integration-woocommerce.js.map +1 -1
- package/dist/esm/nodes/integrations/integration-youtube.js +7 -7
- package/dist/esm/nodes/integrations/integration-youtube.js.map +1 -1
- package/dist/esm/nodes/navigation/navigation-go-to-page.d.ts.map +1 -1
- package/dist/esm/nodes/navigation/navigation-go-to-page.js +18 -4
- package/dist/esm/nodes/navigation/navigation-go-to-page.js.map +1 -1
- package/dist/esm/nodes/payment/payment-create-customer.d.ts.map +1 -1
- package/dist/esm/nodes/payment/payment-create-customer.js +14 -1
- package/dist/esm/nodes/payment/payment-create-customer.js.map +1 -1
- package/dist/esm/nodes/sms/sms-infobip.d.ts.map +1 -1
- package/dist/esm/nodes/sms/sms-infobip.js +3 -1
- package/dist/esm/nodes/sms/sms-infobip.js.map +1 -1
- package/dist/esm/nodes/toast/toast-show.js +1 -1
- package/dist/esm/nodes/transform/transform-date-time.d.ts.map +1 -1
- package/dist/esm/nodes/transform/transform-date-time.js +1 -0
- package/dist/esm/nodes/transform/transform-date-time.js.map +1 -1
- package/dist/esm/nodes/transform/transform-generate.d.ts.map +1 -1
- package/dist/esm/nodes/transform/transform-generate.js +6 -3
- package/dist/esm/nodes/transform/transform-generate.js.map +1 -1
- package/dist/esm/nodes/transform/transform-validate.d.ts.map +1 -1
- package/dist/esm/nodes/transform/transform-validate.js +1 -2
- package/dist/esm/nodes/transform/transform-validate.js.map +1 -1
- package/dist/esm/nodes/utility/utility-scrape-website.d.ts.map +1 -1
- package/dist/esm/nodes/utility/utility-scrape-website.js +11 -2
- package/dist/esm/nodes/utility/utility-scrape-website.js.map +1 -1
- package/dist/esm/nodes/utility/utility-xml-parse.d.ts.map +1 -1
- package/dist/esm/nodes/utility/utility-xml-parse.js +11 -2
- package/dist/esm/nodes/utility/utility-xml-parse.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/workflow-component-plugin.js +23 -4
- package/dist/esm/workflow-component-plugin.js.map +1 -1
- package/dist/esm/workflow-project-plugin.d.ts.map +1 -1
- package/dist/esm/workflow-project-plugin.js +15 -10
- package/dist/esm/workflow-project-plugin.js.map +1 -1
- package/package.json +2 -2
- package/src/executor-generator.ts +72 -8
- package/src/nodes/account/account-compare-passwords.ts +3 -1
- package/src/nodes/account/account-get-current.ts +23 -4
- package/src/nodes/account/account-login.ts +15 -5
- package/src/nodes/account/account-signup.ts +15 -5
- package/src/nodes/ai/ai-provider-utils.ts +26 -9
- package/src/nodes/data/data-create-item.ts +15 -0
- package/src/nodes/element/element-add-class.ts +14 -5
- package/src/nodes/element/element-remove-class.ts +14 -5
- package/src/nodes/element/element-set-attribute.ts +10 -1
- package/src/nodes/element/element-toggle-class.ts +19 -4
- package/src/nodes/email/email-resend.ts +3 -1
- package/src/nodes/integrations/integration-amazon-s3.ts +21 -5
- package/src/nodes/integrations/integration-amplitude.ts +5 -3
- package/src/nodes/integrations/integration-discord.ts +4 -1
- package/src/nodes/integrations/integration-generic.ts +9 -2
- package/src/nodes/integrations/integration-greenhouse.ts +16 -2
- package/src/nodes/integrations/integration-linear.ts +3 -1
- package/src/nodes/integrations/integration-mailchimp.ts +3 -0
- package/src/nodes/integrations/integration-monday.ts +8 -0
- package/src/nodes/integrations/integration-segment.ts +3 -1
- package/src/nodes/integrations/integration-slack.ts +17 -6
- package/src/nodes/integrations/integration-woocommerce.ts +7 -1
- package/src/nodes/integrations/integration-youtube.ts +7 -7
- package/src/nodes/navigation/navigation-go-to-page.ts +16 -4
- package/src/nodes/payment/payment-create-customer.ts +13 -1
- package/src/nodes/sms/sms-infobip.ts +3 -1
- package/src/nodes/toast/toast-show.ts +1 -1
- package/src/nodes/transform/transform-date-time.ts +1 -0
- package/src/nodes/transform/transform-generate.ts +6 -3
- package/src/nodes/transform/transform-validate.ts +1 -2
- package/src/nodes/utility/utility-scrape-website.ts +11 -3
- package/src/nodes/utility/utility-xml-parse.ts +11 -3
- package/src/workflow-component-plugin.ts +23 -4
- package/src/workflow-project-plugin.ts +12 -7
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
// Regression guard for "state-update node wired without a value writes
|
|
2
|
+
// `undefined` into state". A node may legitimately be configured without an
|
|
3
|
+
// explicit value (e.g. the admin "Close Detail Panel" workflow clearing an id).
|
|
4
|
+
// The client runtime must then fall back to the state type's empty default —
|
|
5
|
+
// string -> '', array -> [], object -> {}, anything else -> null — so a setter
|
|
6
|
+
// never receives `undefined` (which flips a controlled input to uncontrolled).
|
|
7
|
+
//
|
|
8
|
+
// `__stateUpdateHandler` / `__defaultValueForType` / the `state-batch-update`
|
|
9
|
+
// handler all live inside the page-level `__createWorkflowHandlers` factory
|
|
10
|
+
// emitted by the workflow component plugin (and only the trigger surface is
|
|
11
|
+
// returned, not the handler map). We can't import them directly, so we pull the
|
|
12
|
+
// individual function sources out of the generated module-level code and
|
|
13
|
+
// reconstitute them in a sandbox with the closure variables they rely on (same
|
|
14
|
+
// approach as state-setter-value-key-unwrap.test.ts).
|
|
15
|
+
|
|
16
|
+
import { createNextWorkflowPlugin } from '../src/workflow-component-plugin'
|
|
17
|
+
|
|
18
|
+
// Brace-match a `function NAME(...) { ... }` declaration out of generated code.
|
|
19
|
+
const extractFunctionSource = (haystack: string, funcDecl: string): string => {
|
|
20
|
+
const startIdx = haystack.indexOf(funcDecl)
|
|
21
|
+
if (startIdx === -1) {
|
|
22
|
+
throw new Error('Helper not found: ' + funcDecl)
|
|
23
|
+
}
|
|
24
|
+
return braceMatchFrom(haystack, startIdx)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Brace-match the `function(...) { ... }` expression assigned to a given LHS,
|
|
28
|
+
// e.g. `__handlers['state-batch-update'] = function(config, context) { ... }`.
|
|
29
|
+
const extractAssignedFunction = (haystack: string, lhs: string): string => {
|
|
30
|
+
const lhsIdx = haystack.indexOf(lhs)
|
|
31
|
+
if (lhsIdx === -1) {
|
|
32
|
+
throw new Error('Assignment not found: ' + lhs)
|
|
33
|
+
}
|
|
34
|
+
const fnIdx = haystack.indexOf('function', lhsIdx)
|
|
35
|
+
if (fnIdx === -1) {
|
|
36
|
+
throw new Error('No function expression after ' + lhs)
|
|
37
|
+
}
|
|
38
|
+
return braceMatchFrom(haystack, fnIdx)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const braceMatchFrom = (haystack: string, startIdx: number): string => {
|
|
42
|
+
let depth = 0
|
|
43
|
+
let i = haystack.indexOf('{', startIdx)
|
|
44
|
+
if (i === -1) {
|
|
45
|
+
throw new Error('No opening brace from index ' + startIdx)
|
|
46
|
+
}
|
|
47
|
+
for (; i < haystack.length; i++) {
|
|
48
|
+
const ch = haystack.charAt(i)
|
|
49
|
+
if (ch === '{') {
|
|
50
|
+
depth++
|
|
51
|
+
} else if (ch === '}') {
|
|
52
|
+
depth--
|
|
53
|
+
if (depth === 0) {
|
|
54
|
+
return haystack.slice(startIdx, i + 1)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
throw new Error('Unbalanced braces from index ' + startIdx)
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const buildStructure = (): any => {
|
|
62
|
+
const triggerNodeId = 'trigger-1'
|
|
63
|
+
const stateUpdateNodeId = 'update-1'
|
|
64
|
+
const workflow = {
|
|
65
|
+
id: 'wf-1',
|
|
66
|
+
name: 'Test WF',
|
|
67
|
+
trigger: {
|
|
68
|
+
type: 'event-page-loaded',
|
|
69
|
+
nodeId: triggerNodeId,
|
|
70
|
+
scope: 'page',
|
|
71
|
+
config: { pageId: 'page-1' },
|
|
72
|
+
},
|
|
73
|
+
nodes: [
|
|
74
|
+
{
|
|
75
|
+
id: stateUpdateNodeId,
|
|
76
|
+
type: 'state-update-local-state',
|
|
77
|
+
config: { property: 'myStr', value: 'x' },
|
|
78
|
+
stepNumber: 1,
|
|
79
|
+
label: 'X',
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
edges: [{ id: 'e', source: triggerNodeId, target: stateUpdateNodeId }],
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
uidl: {
|
|
86
|
+
name: 'Page',
|
|
87
|
+
outputOptions: { pageId: 'page-1', fileName: 'page-1' },
|
|
88
|
+
node: { type: 'element', content: { elementType: 'container', name: 'Container' } },
|
|
89
|
+
stateDefinitions: {
|
|
90
|
+
myStr: { type: 'string', defaultValue: '' },
|
|
91
|
+
myObj: { type: 'object', defaultValue: {} },
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
chunks: [
|
|
95
|
+
{
|
|
96
|
+
type: 'chunk-type-ast',
|
|
97
|
+
name: 'jsx-component',
|
|
98
|
+
content: {
|
|
99
|
+
type: 'VariableDeclaration',
|
|
100
|
+
declarations: [
|
|
101
|
+
{
|
|
102
|
+
type: 'VariableDeclarator',
|
|
103
|
+
init: {
|
|
104
|
+
type: 'ArrowFunctionExpression',
|
|
105
|
+
body: {
|
|
106
|
+
type: 'BlockStatement',
|
|
107
|
+
body: [{ type: 'ReturnStatement', argument: null }],
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
options: {
|
|
116
|
+
workflows: { workflows: { 'wf-1': workflow }, customNodes: {} },
|
|
117
|
+
},
|
|
118
|
+
dependencies: {},
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
type HandlerFn = (config: any, context: any) => Promise<any>
|
|
123
|
+
|
|
124
|
+
interface Runtime {
|
|
125
|
+
update: HandlerFn
|
|
126
|
+
batch: HandlerFn
|
|
127
|
+
defaultForType: (type: string | undefined) => unknown
|
|
128
|
+
writes: Record<string, unknown>
|
|
129
|
+
hasWrite: (prop: string) => boolean
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
let cachedModuleCode: string | null = null
|
|
133
|
+
|
|
134
|
+
const getModuleCode = async (): Promise<string> => {
|
|
135
|
+
if (cachedModuleCode) {
|
|
136
|
+
return cachedModuleCode
|
|
137
|
+
}
|
|
138
|
+
const plugin = createNextWorkflowPlugin({ isPage: true })
|
|
139
|
+
const structure = buildStructure()
|
|
140
|
+
await plugin(structure as any)
|
|
141
|
+
const moduleChunk = (structure.chunks as any[]).find((c: any) => c.name === 'workflow-module')
|
|
142
|
+
if (!moduleChunk) {
|
|
143
|
+
throw new Error('workflow-module chunk not emitted by plugin')
|
|
144
|
+
}
|
|
145
|
+
cachedModuleCode = String(moduleChunk.content)
|
|
146
|
+
return cachedModuleCode
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Reconstitute the state-update runtime (handler + helpers) in a sandbox,
|
|
150
|
+
// wiring spying setters so we can assert what value each update writes.
|
|
151
|
+
const buildRuntime = async (stateTypes: Record<string, string>): Promise<Runtime> => {
|
|
152
|
+
const moduleCode = await getModuleCode()
|
|
153
|
+
const coerceSrc = extractFunctionSource(moduleCode, 'function __coerceValue')
|
|
154
|
+
const defaultSrc = extractFunctionSource(moduleCode, 'function __defaultValueForType')
|
|
155
|
+
const updateSrc = extractFunctionSource(moduleCode, 'function __stateUpdateHandler')
|
|
156
|
+
const batchSrc = extractAssignedFunction(moduleCode, "__handlers['state-batch-update']")
|
|
157
|
+
|
|
158
|
+
const writes: Record<string, unknown> = {}
|
|
159
|
+
const written = new Set<string>()
|
|
160
|
+
const stateSetters: Record<string, (v: unknown) => void> = {}
|
|
161
|
+
for (const key of Object.keys(stateTypes)) {
|
|
162
|
+
stateSetters[key] = (v: unknown) => {
|
|
163
|
+
writes[key] = v
|
|
164
|
+
written.add(key)
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const stateValuesRef = { current: {} as Record<string, unknown> }
|
|
168
|
+
|
|
169
|
+
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
170
|
+
const factory = new Function(
|
|
171
|
+
'stateSetters',
|
|
172
|
+
'stateTypes',
|
|
173
|
+
'stateValuesRef',
|
|
174
|
+
'refreshGlobalState',
|
|
175
|
+
`
|
|
176
|
+
var __stateNameMap = {};
|
|
177
|
+
var __setterKeys = Object.keys(stateSetters);
|
|
178
|
+
for (var __i = 0; __i < __setterKeys.length; __i++) {
|
|
179
|
+
__stateNameMap[__setterKeys[__i]] = __setterKeys[__i];
|
|
180
|
+
var __snake = __setterKeys[__i].replace(/[A-Z]/g, function(l) { return '_' + l.toLowerCase(); });
|
|
181
|
+
if (__snake !== __setterKeys[__i]) __stateNameMap[__snake] = __setterKeys[__i];
|
|
182
|
+
}
|
|
183
|
+
function __resolveName(name) { return __stateNameMap[name] || name; }
|
|
184
|
+
${coerceSrc}
|
|
185
|
+
${defaultSrc}
|
|
186
|
+
${updateSrc}
|
|
187
|
+
var __batch = ${batchSrc};
|
|
188
|
+
return { update: __stateUpdateHandler, batch: __batch, defaultForType: __defaultValueForType };
|
|
189
|
+
`
|
|
190
|
+
)
|
|
191
|
+
const rt = factory(stateSetters, stateTypes, stateValuesRef, undefined)
|
|
192
|
+
return {
|
|
193
|
+
update: rt.update,
|
|
194
|
+
batch: rt.batch,
|
|
195
|
+
defaultForType: rt.defaultForType,
|
|
196
|
+
writes,
|
|
197
|
+
hasWrite: (prop: string) => written.has(prop),
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const STATE_TYPES = {
|
|
202
|
+
myStr: 'string',
|
|
203
|
+
myArr: 'array',
|
|
204
|
+
myObj: 'object',
|
|
205
|
+
myNum: 'number',
|
|
206
|
+
myBool: 'boolean',
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
describe('__defaultValueForType mapping', () => {
|
|
210
|
+
it('maps each state type to its empty default', async () => {
|
|
211
|
+
const rt = await buildRuntime(STATE_TYPES)
|
|
212
|
+
expect(rt.defaultForType('string')).toBe('')
|
|
213
|
+
expect(rt.defaultForType('array')).toEqual([])
|
|
214
|
+
expect(rt.defaultForType('object')).toEqual({})
|
|
215
|
+
expect(rt.defaultForType('number')).toBeNull()
|
|
216
|
+
expect(rt.defaultForType('boolean')).toBeNull()
|
|
217
|
+
expect(rt.defaultForType(undefined)).toBeNull()
|
|
218
|
+
})
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
describe('state-update without a value defaults by state type', () => {
|
|
222
|
+
it("defaults a string state to ''", async () => {
|
|
223
|
+
const rt = await buildRuntime(STATE_TYPES)
|
|
224
|
+
await rt.update({ property: 'myStr' }, { __stateValues: {} })
|
|
225
|
+
expect(rt.writes.myStr).toBe('')
|
|
226
|
+
})
|
|
227
|
+
|
|
228
|
+
it('defaults an array state to []', async () => {
|
|
229
|
+
const rt = await buildRuntime(STATE_TYPES)
|
|
230
|
+
await rt.update({ property: 'myArr' }, { __stateValues: {} })
|
|
231
|
+
expect(rt.writes.myArr).toEqual([])
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
it('defaults an object state to {}', async () => {
|
|
235
|
+
const rt = await buildRuntime(STATE_TYPES)
|
|
236
|
+
await rt.update({ property: 'myObj' }, { __stateValues: {} })
|
|
237
|
+
expect(rt.writes.myObj).toEqual({})
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
it('defaults number and boolean states to null', async () => {
|
|
241
|
+
const rt = await buildRuntime(STATE_TYPES)
|
|
242
|
+
await rt.update({ property: 'myNum' }, { __stateValues: {} })
|
|
243
|
+
await rt.update({ property: 'myBool' }, { __stateValues: {} })
|
|
244
|
+
expect(rt.writes.myNum).toBeNull()
|
|
245
|
+
expect(rt.writes.myBool).toBeNull()
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
it('preserves an explicit null (a real value — only a missing value defaults)', async () => {
|
|
249
|
+
// A dynamic binding can resolve to null at runtime; defaulting it (e.g.
|
|
250
|
+
// object -> {}) would flip downstream truthiness checks. Only a statically
|
|
251
|
+
// absent value (config.value === undefined) is treated as "not set".
|
|
252
|
+
const rt = await buildRuntime(STATE_TYPES)
|
|
253
|
+
await rt.update({ property: 'myStr', value: null }, { __stateValues: {} })
|
|
254
|
+
expect(rt.writes.myStr).toBeNull()
|
|
255
|
+
})
|
|
256
|
+
|
|
257
|
+
it('preserves an explicit value (no defaulting)', async () => {
|
|
258
|
+
const rt = await buildRuntime(STATE_TYPES)
|
|
259
|
+
await rt.update({ property: 'myStr', value: 'hello' }, { __stateValues: {} })
|
|
260
|
+
expect(rt.writes.myStr).toBe('hello')
|
|
261
|
+
})
|
|
262
|
+
|
|
263
|
+
it('defaults unset entries in a batch update too', async () => {
|
|
264
|
+
const rt = await buildRuntime(STATE_TYPES)
|
|
265
|
+
await rt.batch(
|
|
266
|
+
{
|
|
267
|
+
updates: [{ key: 'myStr' }, { key: 'myArr', value: undefined }, { key: 'myNum', value: 7 }],
|
|
268
|
+
},
|
|
269
|
+
{ __stateValues: {} }
|
|
270
|
+
)
|
|
271
|
+
expect(rt.writes.myStr).toBe('')
|
|
272
|
+
expect(rt.writes.myArr).toEqual([])
|
|
273
|
+
expect(rt.writes.myNum).toBe(7)
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
it('does NOT default a property-mode update (sub-property stays undefined)', async () => {
|
|
277
|
+
// Object property-mode updates set a single key; an unset value there means
|
|
278
|
+
// "clear this property", not "replace the object with its type default".
|
|
279
|
+
const rt = await buildRuntime(STATE_TYPES)
|
|
280
|
+
await rt.update(
|
|
281
|
+
{ property: 'myObj', objectUpdateMode: 'property', objectPropertyPath: 'a' },
|
|
282
|
+
{ __stateValues: { myObj: { a: 1 } } }
|
|
283
|
+
)
|
|
284
|
+
expect(rt.writes.myObj).toEqual({ a: undefined })
|
|
285
|
+
})
|
|
286
|
+
})
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* tslint:disable:no-eval */
|
|
2
|
+
import { transformGenerate } from '../src/nodes/transform/transform-generate'
|
|
3
|
+
|
|
4
|
+
// Regression: the password-reset (and booking) workflow builders, and the
|
|
5
|
+
// node-context-schemas contract, all read transform-generate's output as
|
|
6
|
+
// `.value` ({ value, type, timestamp }). The node previously returned
|
|
7
|
+
// `{ result }`, so `.value` was undefined — which inserted NULL into the
|
|
8
|
+
// NOT-NULL `password_reset_tokens.token` column ("null value in column token
|
|
9
|
+
// ... violates not-null constraint"). The node must honour its declared
|
|
10
|
+
// output contract.
|
|
11
|
+
|
|
12
|
+
function evalHandler(): any {
|
|
13
|
+
return eval('(' + transformGenerate.generateHandler() + ')')
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
describe('transform-generate output contract', () => {
|
|
17
|
+
it('returns the generated value under `.value` (contract: { value, type, timestamp })', async () => {
|
|
18
|
+
const handler = evalHandler()
|
|
19
|
+
const out = await handler({ generateType: 'uuid' }, {})
|
|
20
|
+
expect(typeof out.value).toBe('string')
|
|
21
|
+
expect(out.value).toMatch(
|
|
22
|
+
/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i
|
|
23
|
+
)
|
|
24
|
+
expect(out.type).toBe('uuid')
|
|
25
|
+
expect(typeof out.timestamp).toBe('number')
|
|
26
|
+
// `result` retained as a defensive alias so nothing that read it breaks.
|
|
27
|
+
expect(out.result).toBe(out.value)
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it('exposes `.value` for every generate type (random-string, random-number, timestamp)', async () => {
|
|
31
|
+
const handler = evalHandler()
|
|
32
|
+
const s = await handler({ generateType: 'random-string', length: 10 }, {})
|
|
33
|
+
expect(typeof s.value).toBe('string')
|
|
34
|
+
expect(s.value.length).toBe(10)
|
|
35
|
+
const n = await handler({ generateType: 'random-number', min: 1, max: 5 }, {})
|
|
36
|
+
expect(typeof n.value).toBe('number')
|
|
37
|
+
const t = await handler({ generateType: 'timestamp' }, {})
|
|
38
|
+
expect(typeof t.value).toBe('number')
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
it('error paths still expose `.value: null` (never undefined)', async () => {
|
|
42
|
+
const handler = evalHandler()
|
|
43
|
+
const out = await handler({ generateType: 'no-such-type' }, {})
|
|
44
|
+
expect(out.value).toBeNull()
|
|
45
|
+
expect(out.error).toContain('Unknown generate type')
|
|
46
|
+
})
|
|
47
|
+
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor-generator.d.ts","sourceRoot":"","sources":["../../src/executor-generator.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,8BAA8B,QAAO,MAovBjD,CAAA;AAED,eAAO,MAAM,yBAAyB,QAAO,
|
|
1
|
+
{"version":3,"file":"executor-generator.d.ts","sourceRoot":"","sources":["../../src/executor-generator.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,8BAA8B,QAAO,MAovBjD,CAAA;AAED,eAAO,MAAM,yBAAyB,QAAO,MAsc5C,CAAA;AAED,eAAO,MAAM,yBAAyB,QAAO,MAK5C,CAAA"}
|
|
@@ -762,6 +762,39 @@ exports.generateSharedRuntimeUtilsCode = generateSharedRuntimeUtilsCode;
|
|
|
762
762
|
const generateClientRuntimeCode = () => {
|
|
763
763
|
return `const utils = require('./runtime-utils');
|
|
764
764
|
|
|
765
|
+
// A live DOM element (the workflow trigger element) cannot cross the network
|
|
766
|
+
// to a server segment — JSON.stringify throws on its circular references, so it
|
|
767
|
+
// used to prune down to { __serializationError: true }. That dropped the
|
|
768
|
+
// element's dataset, which server nodes rely on (e.g. a cart "+" button whose
|
|
769
|
+
// data-select filters products by trigger.element.dataset.productId, or a
|
|
770
|
+
// cart-update node reading trigger.element.dataset.cartItemId). We replace any
|
|
771
|
+
// DOM node with a serializable snapshot carrying its dataset + form value, so
|
|
772
|
+
// those reads keep resolving on both sides of the round-trip.
|
|
773
|
+
function isDomNode(v) {
|
|
774
|
+
return !!v && typeof v === 'object' && typeof v.nodeType === 'number' && v.nodeType === 1;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
function snapshotDomNode(el) {
|
|
778
|
+
var snap = { __domSnapshot: true, dataset: {} };
|
|
779
|
+
try { snap.tagName = el.tagName || null; } catch (e) {}
|
|
780
|
+
try { snap.id = el.id || ''; } catch (e) {}
|
|
781
|
+
try { snap.name = el.name || ''; } catch (e) {}
|
|
782
|
+
try { snap.type = el.type || ''; } catch (e) {}
|
|
783
|
+
try { snap.className = typeof el.className === 'string' ? el.className : ''; } catch (e) {}
|
|
784
|
+
try { if ('value' in el) snap.value = el.value; } catch (e) {}
|
|
785
|
+
try { if ('checked' in el) snap.checked = el.checked; } catch (e) {}
|
|
786
|
+
try {
|
|
787
|
+
if (el.dataset) {
|
|
788
|
+
for (var k in el.dataset) { snap.dataset[k] = el.dataset[k]; }
|
|
789
|
+
}
|
|
790
|
+
} catch (e) {}
|
|
791
|
+
return snap;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
function domSerializationReplacer(key, value) {
|
|
795
|
+
return isDomNode(value) ? snapshotDomNode(value) : value;
|
|
796
|
+
}
|
|
797
|
+
|
|
765
798
|
function pruneContext(context) {
|
|
766
799
|
const pruned = {};
|
|
767
800
|
const keys = Object.keys(context);
|
|
@@ -771,11 +804,15 @@ function pruneContext(context) {
|
|
|
771
804
|
if (val === undefined || val === null) continue;
|
|
772
805
|
if (typeof val === 'function') continue;
|
|
773
806
|
try {
|
|
774
|
-
|
|
807
|
+
// Replace DOM nodes with serializable snapshots as we stringify, then
|
|
808
|
+
// re-parse so the request body itself (JSON.stringify(prunedContext) in
|
|
809
|
+
// callServerSegment, which has no replacer) never sees a live DOM node.
|
|
810
|
+
const serialized = JSON.stringify(val, domSerializationReplacer);
|
|
811
|
+
if (serialized === undefined) continue;
|
|
775
812
|
if (serialized.length > 100000) {
|
|
776
813
|
pruned[key] = { __truncated: true, type: typeof val };
|
|
777
814
|
} else {
|
|
778
|
-
pruned[key] =
|
|
815
|
+
pruned[key] = JSON.parse(serialized);
|
|
779
816
|
}
|
|
780
817
|
} catch(e) {
|
|
781
818
|
pruned[key] = { __serializationError: true };
|
|
@@ -784,6 +821,36 @@ function pruneContext(context) {
|
|
|
784
821
|
return pruned;
|
|
785
822
|
}
|
|
786
823
|
|
|
824
|
+
// Merge a server segment's returned context back into the live client context.
|
|
825
|
+
// Two rules protect client-only state that cannot survive the round-trip:
|
|
826
|
+
// 1. A server-side placeholder ({ __serializationError } / { __truncated })
|
|
827
|
+
// must never overwrite a real client value.
|
|
828
|
+
// 2. The trigger element/node is authoritative on the client. The live DOM
|
|
829
|
+
// element is sent to the server as a snapshot (see pruneContext) and
|
|
830
|
+
// echoed back as that snapshot; keeping the client's real element means a
|
|
831
|
+
// post-server client node (cart-update reading
|
|
832
|
+
// trigger.element.dataset.cartItemId, or any node calling a DOM method)
|
|
833
|
+
// still works against the genuine element rather than a frozen copy.
|
|
834
|
+
function mergeServerResults(context, serverResults, triggerNodeId) {
|
|
835
|
+
if (!serverResults || typeof serverResults !== 'object') return;
|
|
836
|
+
const keys = Object.keys(serverResults);
|
|
837
|
+
for (let i = 0; i < keys.length; i++) {
|
|
838
|
+
const key = keys[i];
|
|
839
|
+
const clientVal = context[key];
|
|
840
|
+
// Keep the client's authoritative live DOM trigger element. The top-level
|
|
841
|
+
// triggerElement holds the node directly; the trigger node's context holds
|
|
842
|
+
// it under .element. The generic .element guard also covers the trigger
|
|
843
|
+
// node id even when it is not passed in (e.g. inside a custom node).
|
|
844
|
+
if (key === 'triggerElement' && isDomNode(clientVal)) continue;
|
|
845
|
+
if (triggerNodeId && key === triggerNodeId && clientVal && isDomNode(clientVal.element)) continue;
|
|
846
|
+
if (clientVal && typeof clientVal === 'object' && isDomNode(clientVal.element)) continue;
|
|
847
|
+
const val = serverResults[key];
|
|
848
|
+
// A server-side serialization placeholder must never clobber a real value.
|
|
849
|
+
if (val && typeof val === 'object' && (val.__serializationError === true || val.__truncated === true)) continue;
|
|
850
|
+
context[key] = val;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
|
|
787
854
|
// Absolutizes a workflow-segment URL for server-side execution.
|
|
788
855
|
//
|
|
789
856
|
// Custom nodes are generated once and shared between client and server
|
|
@@ -942,10 +1009,7 @@ async function callStreamingServerSegment(segmentUrl, context, streamingInfo, al
|
|
|
942
1009
|
context[data.nodeId] = data.result;
|
|
943
1010
|
} else if (data.type === 'done') {
|
|
944
1011
|
if (data.results) {
|
|
945
|
-
|
|
946
|
-
for (let rk = 0; rk < rKeys.length; rk++) {
|
|
947
|
-
context[rKeys[rk]] = data.results[rKeys[rk]];
|
|
948
|
-
}
|
|
1012
|
+
mergeServerResults(context, data.results, workflowConfig && workflowConfig.triggerNodeId);
|
|
949
1013
|
}
|
|
950
1014
|
const streamedKeys = Object.keys(streamedNodeIds);
|
|
951
1015
|
for (let sk = 0; sk < streamedKeys.length; sk++) {
|
|
@@ -1038,7 +1102,7 @@ async function executeWorkflowWithSegments(workflowConfig, triggerContext, clien
|
|
|
1038
1102
|
const url = serverSegmentUrls[seg.id];
|
|
1039
1103
|
if (!url) throw new Error('No server URL for segment: ' + seg.id);
|
|
1040
1104
|
const serverResults = await callServerSegment(url, context);
|
|
1041
|
-
|
|
1105
|
+
mergeServerResults(context, serverResults, workflowConfig.triggerNodeId);
|
|
1042
1106
|
var segNodes = seg.nodes;
|
|
1043
1107
|
if (segNodes && segNodes.length > 0 && serverResults) {
|
|
1044
1108
|
var sortedSeg = segNodes.slice().sort(function(a, b) {
|
|
@@ -1147,7 +1211,7 @@ async function executeWorkflowWithSegments(workflowConfig, triggerContext, clien
|
|
|
1147
1211
|
return context;
|
|
1148
1212
|
}
|
|
1149
1213
|
|
|
1150
|
-
module.exports = { executeWorkflowWithSegments, callServerSegment, callStreamingServerSegment, findStreamingAINodes };
|
|
1214
|
+
module.exports = { executeWorkflowWithSegments, callServerSegment, callStreamingServerSegment, mergeServerResults, findStreamingAINodes };
|
|
1151
1215
|
`;
|
|
1152
1216
|
};
|
|
1153
1217
|
exports.generateClientRuntimeCode = generateClientRuntimeCode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor-generator.js","sourceRoot":"","sources":["../../src/executor-generator.ts"],"names":[],"mappings":";;;AAAO,MAAM,8BAA8B,GAAG,GAAW,EAAE;IACzD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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BAAyB,GAAG,GAAW,EAAE;IACpD,OAAO;;;CAGR,CAAA;AACD,CAAC,CAAA;AALY,QAAA,yBAAyB,6BAKrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-compare-passwords.d.ts","sourceRoot":"","sources":["../../../../src/nodes/account/account-compare-passwords.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAmB,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"account-compare-passwords.d.ts","sourceRoot":"","sources":["../../../../src/nodes/account/account-compare-passwords.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAmB,MAAM,UAAU,CAAA;AAiDhE,eAAO,MAAM,uBAAuB,EAAE,oBASrC,CAAA"}
|
|
@@ -35,7 +35,9 @@ async function account_compare_passwords(config, context) {
|
|
|
35
35
|
.update(passwordStr + PEPPER)
|
|
36
36
|
.digest('base64');
|
|
37
37
|
const isMatch = bcrypt.compareSync(sha, hashStr);
|
|
38
|
-
|
|
38
|
+
// `isMatch` is the contract key; `match` is a defensive alias for any
|
|
39
|
+
// workflow that reads `.match` (the delete-account template did).
|
|
40
|
+
return { isMatch, match: isMatch };
|
|
39
41
|
}
|
|
40
42
|
exports.accountComparePasswords = {
|
|
41
43
|
nodeType: 'account-compare-passwords',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-compare-passwords.js","sourceRoot":"","sources":["../../../../src/nodes/account/account-compare-passwords.ts"],"names":[],"mappings":";;;AAAA,oCAAgE;AAEhE,KAAK,UAAU,yBAAyB,CAAC,MAAW,EAAE,OAAgC;IACpF,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAA;IAChC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;IAExB,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,EAAE,EAAE;QAChC,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;KACxC;IAED,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;KACpC;IAED,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;IACpC,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;IAE5B,IAAI,WAAW,CAAC,MAAM,GAAG,IAAI,EAAE;QAC7B,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;KACnD;IAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;KACxC;IAED,yEAAyE;IACzE,mEAAmE;IACnE,2EAA2E;IAC3E,4EAA4E;IAC5E,4EAA4E;IAC5E,uEAAuE;IACvE,oEAAoE;IACpE,MAAM,aAAa,GACjB,OAAO,uBAAuB,KAAK,WAAW,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,OAAO,CAAA;IACpF,MAAM,MAAM,GAAG,aAAa,CAAC,UAAU,CAAC,CAAA;IACxC,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAA;IAEtC,MAAM,MAAM,GAAI,UAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE,CAAA;IAChE,MAAM,GAAG,GAAG,MAAM;SACf,UAAU,CAAC,QAAQ,CAAC;SACpB,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC;SAC5B,MAAM,CAAC,QAAQ,CAAC,CAAA;IACnB,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;IAEhD,OAAO,EAAE,OAAO,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"account-compare-passwords.js","sourceRoot":"","sources":["../../../../src/nodes/account/account-compare-passwords.ts"],"names":[],"mappings":";;;AAAA,oCAAgE;AAEhE,KAAK,UAAU,yBAAyB,CAAC,MAAW,EAAE,OAAgC;IACpF,MAAM,QA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,sEAAsE;IACtE,kEAAkE;IAClE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;AACpC,CAAC;AAEY,QAAA,uBAAuB,GAAyB;IAC3D,QAAQ,EAAE,2BAA2B;IACrC,YAAY,EAAE,QAAQ;IACtB,YAAY,EAAE;QACZ,QAAQ,EAAE,QAAQ;KACnB;IACD,eAAe;QACb,OAAO,IAAA,uBAAe,EAAC,yBAAyB,CAAC,CAAA;IACnD,CAAC;CACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-get-current.d.ts","sourceRoot":"","sources":["../../../../src/nodes/account/account-get-current.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAmB,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"account-get-current.d.ts","sourceRoot":"","sources":["../../../../src/nodes/account/account-get-current.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAmB,MAAM,UAAU,CAAA;AAiEhE,eAAO,MAAM,iBAAiB,EAAE,oBAS/B,CAAA"}
|
|
@@ -4,6 +4,25 @@ exports.accountGetCurrent = void 0;
|
|
|
4
4
|
const types_1 = require("../types");
|
|
5
5
|
async function account_get_current(_config, context) {
|
|
6
6
|
const baseUrl = (context && context.__baseUrl) || '';
|
|
7
|
+
// The declared output contract (node-context-schemas) exposes the user's
|
|
8
|
+
// fields at the TOP LEVEL (id, email, name, image, ...). Workflow builders
|
|
9
|
+
// read e.g. `wfCtx(node, ['id'])` for a row's user_id, and the AI reads the
|
|
10
|
+
// flat fields too. Emit the user's fields flat AND keep a `user` object for
|
|
11
|
+
// anything that reads `.user`.
|
|
12
|
+
// Copy the user's fields onto a fresh object (no Object.assign/spread — this
|
|
13
|
+
// handler is .toString()'d and bundled, where down-levelled spread would
|
|
14
|
+
// reference a tslib helper that doesn't exist at runtime).
|
|
15
|
+
const __out = (user) => {
|
|
16
|
+
const o = {};
|
|
17
|
+
if (user) {
|
|
18
|
+
const ks = Object.keys(user);
|
|
19
|
+
for (let i = 0; i < ks.length; i++) {
|
|
20
|
+
o[ks[i]] = user[ks[i]];
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
o.user = user || null;
|
|
24
|
+
return o;
|
|
25
|
+
};
|
|
7
26
|
try {
|
|
8
27
|
const response = await fetch(baseUrl + '/api/auth/session');
|
|
9
28
|
if (response.ok) {
|
|
@@ -20,25 +39,25 @@ async function account_get_current(_config, context) {
|
|
|
20
39
|
}
|
|
21
40
|
catch (_e) { }
|
|
22
41
|
}
|
|
23
|
-
return
|
|
42
|
+
return __out(user);
|
|
24
43
|
}
|
|
25
44
|
if (typeof window !== 'undefined') {
|
|
26
45
|
try {
|
|
27
46
|
const cached = window.localStorage.getItem('teleport_auth_user');
|
|
28
47
|
if (cached) {
|
|
29
|
-
return
|
|
48
|
+
return __out(JSON.parse(cached));
|
|
30
49
|
}
|
|
31
50
|
}
|
|
32
51
|
catch (_e) { }
|
|
33
52
|
}
|
|
34
|
-
return
|
|
53
|
+
return __out(null);
|
|
35
54
|
}
|
|
36
55
|
catch (err) {
|
|
37
56
|
if (typeof window !== 'undefined') {
|
|
38
57
|
try {
|
|
39
58
|
const fallback = window.localStorage.getItem('teleport_auth_user');
|
|
40
59
|
if (fallback) {
|
|
41
|
-
return
|
|
60
|
+
return __out(JSON.parse(fallback));
|
|
42
61
|
}
|
|
43
62
|
}
|
|
44
63
|
catch (_e) { }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-get-current.js","sourceRoot":"","sources":["../../../../src/nodes/account/account-get-current.ts"],"names":[],"mappings":";;;AAAA,oCAAgE;AAEhE,KAAK,UAAU,mBAAmB,CAAC,OAAgB,EAAE,OAAgC;IACnF,MAAM,OAAO,GAAG,CAAC,OAAO,IAAK,OAAe,CAAC,SAAS,CAAC,IAAI,EAAE,CAAA;IAC7D,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,G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AAW,EAAE;YACjC,IAAI;gBACF,MAAM,QAAQ,GAAG,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAA;gBAClE,IAAI,QAAQ,EAAE;oBACZ,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;iBACnC;aACF;YAAC,OAAO,EAAE,EAAE,GAAE;SAChB;QACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAG,GAAa,CAAC,OAAO,EAAE,CAAA;KACrD;AACH,CAAC;AAEY,QAAA,iBAAiB,GAAyB;IACrD,QAAQ,EAAE,qBAAqB;IAC/B,YAAY,EAAE,QAAQ;IACtB,YAAY,EAAE;QACZ,WAAW,EAAE,SAAS;KACvB;IACD,eAAe;QACb,OAAO,IAAA,uBAAe,EAAC,mBAAmB,CAAC,CAAA;IAC7C,CAAC;CACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-login.d.ts","sourceRoot":"","sources":["../../../../src/nodes/account/account-login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAmB,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"account-login.d.ts","sourceRoot":"","sources":["../../../../src/nodes/account/account-login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAmB,MAAM,UAAU,CAAA;AAyEhE,eAAO,MAAM,YAAY,EAAE,oBAmC1B,CAAA"}
|
|
@@ -52,7 +52,19 @@ async function account_login(config, context) {
|
|
|
52
52
|
window.dispatchEvent(new CustomEvent('teleport:auth-user-changed', { detail: { user } }));
|
|
53
53
|
window.location.href = '/';
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
// Contract exposes user fields flat (id, email, name, ...) plus `user`/`success`.
|
|
56
|
+
// Built without Object.assign/spread — this handler is .toString()'d and
|
|
57
|
+
// bundled, where down-levelled spread would reference a missing tslib helper.
|
|
58
|
+
const __out = {};
|
|
59
|
+
if (user) {
|
|
60
|
+
const __k = Object.keys(user);
|
|
61
|
+
for (let __i = 0; __i < __k.length; __i++) {
|
|
62
|
+
__out[__k[__i]] = user[__k[__i]];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
__out.user = user || null;
|
|
66
|
+
__out.success = true;
|
|
67
|
+
return __out;
|
|
56
68
|
}
|
|
57
69
|
exports.accountLogin = {
|
|
58
70
|
nodeType: 'account-login',
|
|
@@ -85,10 +97,8 @@ exports.accountLogin = {
|
|
|
85
97
|
throw new Error('Invalid email or password');
|
|
86
98
|
}
|
|
87
99
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
success: true,
|
|
91
|
-
};
|
|
100
|
+
const __su = authUtils.sanitizeUser(user);
|
|
101
|
+
return Object.assign({}, __su || {}, { user: __su, success: true });
|
|
92
102
|
}`;
|
|
93
103
|
},
|
|
94
104
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-login.js","sourceRoot":"","sources":["../../../../src/nodes/account/account-login.ts"],"names":[],"mappings":";;;AAAA,oCAAgE;AAEhE,KAAK,UAAU,aAAa,CAAC,MAAW,EAAE,OAAgC;IACxE,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;IAC1B,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAA;IAEhC,IAAI,CAAC,KAAK,IAAI,CAAC,QAAQ,EAAE;QACvB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;KACnD;IAED,wEAAwE;IACxE,4EAA4E;IAC5E,wEAAwE;IACxE,2EAA2E;IAC3E,4EAA4E;IAC5E,uEAAuE;IACvE,uEAAuE;IACvE,2EAA2E;IAC3E,yEAAyE;IACzE,yEAAyE;IACzE,sEAAsE;IACtE,MAAM,aAAa,GACjB,CAAC,OAAO,MAAM,KAAK,WAAW,IAAK,MAAc,CAAC,kBAAkB,CAAC,IAAI,IAAI,CAAA;IAC/E,IAAI,CAAC,aAA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Y,GAAyB;IAChD,QAAQ,EAAE,eAAe;IACzB,YAAY,EAAE,QAAQ;IACtB,YAAY,EAAE;QACZ,WAAW,EAAE,SAAS;KACvB;IACD,eAAe;QACb,OAAO,IAAA,uBAAe,EAAC,aAAa,CAAC,CAAA;IACvC,CAAC;IACD,qBAAqB;QACnB,OAAO;;;;;;;;;;;;;;;;;;;;;;;EAuBT,CAAA;IACA,CAAC;CACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-signup.d.ts","sourceRoot":"","sources":["../../../../src/nodes/account/account-signup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAmB,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"account-signup.d.ts","sourceRoot":"","sources":["../../../../src/nodes/account/account-signup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAmB,MAAM,UAAU,CAAA;AA0FhE,eAAO,MAAM,aAAa,EAAE,oBA8D3B,CAAA"}
|