@elementumai/edk 0.9.2 → 0.9.6
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/README.md +34 -26
- package/dist-sdk/elementum-entity-client/clients/automation/models/automation.d.ts +1 -1
- package/dist-sdk/elementum-entity-client/clients/skills/models/skill.d.ts +1 -1
- package/dist-sdk/elementum-entity-client/clients/skills/models/skill.js +1 -1
- package/dist-sdk/pull/util.d.ts +1 -1
- package/dist-sdk/pull/util.js +3 -3
- package/dist-sdk/src/catalog/factories.d.ts +49 -10
- package/dist-sdk/src/catalog/factories.js +94 -13
- package/dist-sdk/src/catalog/from-authoring.d.ts +5 -5
- package/dist-sdk/src/catalog/from-authoring.js +7 -7
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +1 -1
- package/dist-sdk/src/catalog/org.js +62 -4
- package/dist-sdk/src/catalog/render-helpers.d.ts +1 -1
- package/dist-sdk/src/catalog/render-helpers.js +1 -1
- package/dist-sdk/src/catalog/render.d.ts +1 -0
- package/dist-sdk/src/catalog/render.js +2 -2
- package/dist-sdk/src/catalog/token.js +11 -4
- package/dist-sdk/src/catalog/types.d.ts +33 -4
- package/dist-sdk/src/catalog/types.js +5 -0
- package/dist-sdk/src/core/index.d.ts +10 -10
- package/dist-sdk/src/core/index.js +9 -9
- package/dist-sdk/src/core/render-tree.d.ts +1 -1
- package/dist-sdk/src/core/render-tree.js +1 -2
- package/dist-sdk/src/core/types/ai-provider.d.ts +1 -1
- package/dist-sdk/src/core/types/ai-provider.js +1 -1
- package/dist-sdk/src/core/types/app.d.ts +66 -30
- package/dist-sdk/src/core/types/app.js +2 -2
- package/dist-sdk/src/core/types/aspect-category.d.ts +4 -4
- package/dist-sdk/src/core/types/aspect-category.js +4 -4
- package/dist-sdk/src/core/types/cloud-link.d.ts +3 -3
- package/dist-sdk/src/core/types/cloud-link.js +3 -3
- package/dist-sdk/src/core/types/display-block.d.ts +2 -2
- package/dist-sdk/src/core/types/display-block.js +2 -2
- package/dist-sdk/src/core/types/group.d.ts +1 -1
- package/dist-sdk/src/core/types/group.js +1 -1
- package/dist-sdk/src/core/types/user.d.ts +1 -1
- package/dist-sdk/src/core/types/user.js +1 -1
- package/dist-sdk/src/core/wire/ref-serializer.js +3 -3
- package/dist-sdk/src/engine/build/context.d.ts +20 -13
- package/dist-sdk/src/engine/entity.d.ts +1 -1
- package/dist-sdk/src/engine/pull/context.d.ts +34 -0
- package/dist-sdk/src/engine/pull/context.js +14 -0
- package/dist-sdk/src/engine/pull/org.d.ts +9 -0
- package/dist-sdk/src/engine/pull/org.js +33 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +37 -0
- package/dist-sdk/src/engine/pull/ref-only.js +204 -0
- package/dist-sdk/src/engine/tf/expr.d.ts +6 -2
- package/dist-sdk/src/engine/tf/expr.js +18 -13
- package/dist-sdk/src/engine/tf/index.d.ts +1 -1
- package/dist-sdk/src/engine/tf/index.js +1 -1
- package/dist-sdk/src/engine/tf/model.d.ts +8 -1
- package/dist-sdk/src/engine/tf/model.js +4 -0
- package/dist-sdk/src/engine/tf/parse.js +13 -2
- package/dist-sdk/src/engine/tf/render.js +4 -0
- package/dist-sdk/src/entities/access-policy/build.d.ts +4 -5
- package/dist-sdk/src/entities/access-policy/build.js +1 -1
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +4 -4
- package/dist-sdk/src/entities/access-policy/from-tf.js +12 -13
- package/dist-sdk/src/entities/access-policy/principal.d.ts +14 -4
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +14 -2
- package/dist-sdk/src/entities/access-policy/to-tf.js +36 -6
- package/dist-sdk/src/entities/agent/build.d.ts +3 -3
- package/dist-sdk/src/entities/agent/build.js +5 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +6 -1
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +68 -18
- package/dist-sdk/src/entities/agent/from-tf.d.ts +3 -1
- package/dist-sdk/src/entities/agent/from-tf.js +12 -4
- package/dist-sdk/src/entities/agent/index.d.ts +2 -2
- package/dist-sdk/src/entities/agent/index.js +1 -1
- package/dist-sdk/src/entities/agent/module.js +2 -0
- package/dist-sdk/src/entities/agent/to-tf.d.ts +5 -2
- package/dist-sdk/src/entities/agent/to-tf.js +56 -8
- package/dist-sdk/src/entities/agent/tools.d.ts +38 -23
- package/dist-sdk/src/entities/agent/tools.js +21 -7
- package/dist-sdk/src/entities/agent-evaluation/build.d.ts +19 -0
- package/dist-sdk/src/entities/agent-evaluation/build.js +41 -0
- package/dist-sdk/src/entities/agent-evaluation/deserializer/print-agent-evaluation.d.ts +4 -0
- package/dist-sdk/src/entities/agent-evaluation/deserializer/print-agent-evaluation.js +30 -0
- package/dist-sdk/src/entities/agent-evaluation/from-tf.d.ts +12 -0
- package/dist-sdk/src/entities/agent-evaluation/from-tf.js +46 -0
- package/dist-sdk/src/entities/agent-evaluation/index.d.ts +1 -0
- package/dist-sdk/src/entities/agent-evaluation/index.js +1 -0
- package/dist-sdk/src/entities/agent-evaluation/module.d.ts +3 -0
- package/dist-sdk/src/entities/agent-evaluation/module.js +58 -0
- package/dist-sdk/src/entities/agent-evaluation/to-tf.d.ts +12 -0
- package/dist-sdk/src/entities/agent-evaluation/to-tf.js +35 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +8 -7
- package/dist-sdk/src/entities/agent-tool/from-tf.js +48 -6
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +10 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +76 -28
- package/dist-sdk/src/entities/agent-tool/types.d.ts +0 -1
- package/dist-sdk/src/entities/agent-tool/types.js +10 -37
- package/dist-sdk/src/entities/app/build.d.ts +97 -42
- package/dist-sdk/src/entities/app/build.js +25 -14
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +32 -24
- package/dist-sdk/src/entities/app/deserializer/pulled-expression.d.ts +1 -1
- package/dist-sdk/src/entities/app/deserializer/pulled-expression.js +2 -0
- package/dist-sdk/src/entities/app/index.d.ts +11 -8
- package/dist-sdk/src/entities/app/index.js +10 -7
- package/dist-sdk/src/entities/app/module.js +2 -2
- package/dist-sdk/src/entities/app/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/app/to-tf.js +22 -6
- package/dist-sdk/src/entities/approval-chain/build.d.ts +1 -1
- package/dist-sdk/src/entities/approval-chain/build.js +5 -5
- package/dist-sdk/src/entities/approval-chain/index.d.ts +1 -1
- package/dist-sdk/src/entities/approval-chain/index.js +1 -1
- package/dist-sdk/src/entities/approval-chain/printer.js +2 -2
- package/dist-sdk/src/entities/automation/build.d.ts +172 -94
- package/dist-sdk/src/entities/automation/build.js +159 -68
- package/dist-sdk/src/entities/automation/calculation-expression.d.ts +191 -0
- package/dist-sdk/src/entities/automation/calculation-expression.js +57 -0
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +11 -4
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +18 -14
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +164 -198
- package/dist-sdk/src/entities/automation/from-tf.d.ts +26 -2
- package/dist-sdk/src/entities/automation/from-tf.js +510 -80
- package/dist-sdk/src/entities/automation/index.d.ts +9 -12
- package/dist-sdk/src/entities/automation/index.js +11 -13
- package/dist-sdk/src/entities/automation/module.js +74 -6
- package/dist-sdk/src/entities/automation/operators.d.ts +32 -48
- package/dist-sdk/src/entities/automation/operators.js +10 -37
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +1 -1
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +1 -1
- package/dist-sdk/src/entities/automation/script-code.js +13 -22
- package/dist-sdk/src/entities/automation/serialize.js +1 -1
- package/dist-sdk/src/entities/automation/tasks.d.ts +153 -89
- package/dist-sdk/src/entities/automation/tasks.js +64 -11
- package/dist-sdk/src/entities/automation/to-tf.d.ts +10 -1
- package/dist-sdk/src/entities/automation/to-tf.js +342 -71
- package/dist-sdk/src/entities/automation/triggers.d.ts +17 -10
- package/dist-sdk/src/entities/automation/triggers.js +7 -1
- package/dist-sdk/src/entities/automation/types.d.ts +3 -2
- package/dist-sdk/src/entities/automation/types.js +3 -2
- package/dist-sdk/src/entities/chart/build.d.ts +95 -0
- package/dist-sdk/src/entities/chart/build.js +42 -0
- package/dist-sdk/src/entities/chart/from-tf.d.ts +55 -0
- package/dist-sdk/src/entities/chart/from-tf.js +269 -0
- package/dist-sdk/src/entities/chart/index.d.ts +4 -0
- package/dist-sdk/src/entities/chart/index.js +3 -0
- package/dist-sdk/src/entities/chart/module.d.ts +3 -0
- package/dist-sdk/src/entities/chart/module.js +61 -0
- package/dist-sdk/src/entities/chart/printer.d.ts +5 -0
- package/dist-sdk/src/entities/chart/printer.js +104 -0
- package/dist-sdk/src/entities/chart/to-tf.d.ts +15 -0
- package/dist-sdk/src/entities/chart/to-tf.js +150 -0
- package/dist-sdk/src/entities/chart/types.d.ts +53 -0
- package/dist-sdk/src/entities/chart/types.js +22 -0
- package/dist-sdk/src/entities/dashboard/build.d.ts +34 -7
- package/dist-sdk/src/entities/dashboard/build.js +16 -1
- package/dist-sdk/src/entities/dashboard/from-tf.js +22 -4
- package/dist-sdk/src/entities/dashboard/to-tf.d.ts +16 -3
- package/dist-sdk/src/entities/dashboard/to-tf.js +37 -10
- package/dist-sdk/src/entities/datamine/module.js +1 -1
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +4 -3
- package/dist-sdk/src/entities/dynamic-layout/build.js +1 -1
- package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +2 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.js +43 -5
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +12 -6
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +10 -10
- package/dist-sdk/src/entities/element/build.d.ts +25 -32
- package/dist-sdk/src/entities/element/build.js +15 -32
- package/dist-sdk/src/entities/element/index.d.ts +7 -5
- package/dist-sdk/src/entities/element/index.js +7 -4
- package/dist-sdk/src/entities/element/module.js +7 -3
- package/dist-sdk/src/entities/element/to-tf.d.ts +2 -1
- package/dist-sdk/src/entities/element/to-tf.js +7 -3
- package/dist-sdk/src/entities/field/build.d.ts +51 -24
- package/dist-sdk/src/entities/field/build.js +31 -6
- package/dist-sdk/src/entities/field/calc/aggregate.d.ts +52 -21
- package/dist-sdk/src/entities/field/calc/aggregate.js +59 -29
- package/dist-sdk/src/entities/field/calc/date.d.ts +78 -29
- package/dist-sdk/src/entities/field/calc/date.js +120 -29
- package/dist-sdk/src/entities/field/calc/index.d.ts +80 -85
- package/dist-sdk/src/entities/field/calc/index.js +82 -139
- package/dist-sdk/src/entities/field/calc/numeric.d.ts +8 -12
- package/dist-sdk/src/entities/field/calc/numeric.js +10 -27
- package/dist-sdk/src/entities/field/calc/runtime.d.ts +19 -2
- package/dist-sdk/src/entities/field/calc/runtime.js +79 -8
- package/dist-sdk/src/entities/field/calc/text.d.ts +32 -23
- package/dist-sdk/src/entities/field/calc/text.js +43 -31
- package/dist-sdk/src/entities/field/calc/types.d.ts +36 -81
- package/dist-sdk/src/entities/field/calc/types.js +1 -22
- package/dist-sdk/src/entities/field/calc.d.ts +71 -48
- package/dist-sdk/src/entities/field/calc.js +5 -15
- package/dist-sdk/src/entities/field/calculation-types.js +10 -3
- package/dist-sdk/src/entities/field/from-tf.js +156 -10
- package/dist-sdk/src/entities/field/locals.d.ts +11 -3
- package/dist-sdk/src/entities/field/locals.js +15 -2
- package/dist-sdk/src/entities/field/module.js +23 -6
- package/dist-sdk/src/entities/field/record-shape.d.ts +24 -10
- package/dist-sdk/src/entities/field/to-tf.d.ts +40 -1
- package/dist-sdk/src/entities/field/to-tf.js +293 -35
- package/dist-sdk/src/entities/field/types.d.ts +1 -1
- package/dist-sdk/src/entities/field/types.js +7 -1
- package/dist-sdk/src/entities/file-reader/build.d.ts +5 -0
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +1 -1
- package/dist-sdk/src/entities/org/cloud-link.js +4 -5
- package/dist-sdk/src/entities/org/email-alias.d.ts +2 -0
- package/dist-sdk/src/entities/org/email-alias.js +12 -0
- package/dist-sdk/src/entities/org/index.d.ts +1 -0
- package/dist-sdk/src/entities/org/index.js +1 -0
- package/dist-sdk/src/entities/org/phone-provider.js +4 -7
- package/dist-sdk/src/entities/organization/build.d.ts +214 -2
- package/dist-sdk/src/entities/organization/build.js +145 -4
- package/dist-sdk/src/entities/organization/index.d.ts +1 -1
- package/dist-sdk/src/entities/organization/index.js +1 -1
- package/dist-sdk/src/entities/organization/module.js +4 -1
- package/dist-sdk/src/entities/organization/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/organization/to-tf.js +118 -1
- package/dist-sdk/src/entities/phone-service/build.d.ts +1 -1
- package/dist-sdk/src/entities/phone-service/build.js +2 -2
- package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +5 -3
- package/dist-sdk/src/entities/phone-service/index.d.ts +1 -1
- package/dist-sdk/src/entities/phone-service/index.js +1 -1
- package/dist-sdk/src/entities/phone-service/types.js +1 -1
- package/dist-sdk/src/entities/record-create-form/to-tf.js +9 -1
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +5 -13
- package/dist-sdk/src/entities/search-table/build.d.ts +4 -4
- package/dist-sdk/src/entities/search-table/build.js +13 -13
- package/dist-sdk/src/entities/search-table/index.d.ts +2 -2
- package/dist-sdk/src/entities/search-table/index.js +2 -2
- package/dist-sdk/src/entities/search-table/printer.js +5 -5
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +21 -0
- package/dist-sdk/src/entities/service-account/to-tf.js +32 -1
- package/dist-sdk/src/entities/shared/context.d.ts +25 -24
- package/dist-sdk/src/entities/shared/context.js +36 -35
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +10 -3
- package/dist-sdk/src/entities/shared/filters/ast.js +1 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +2 -1
- package/dist-sdk/src/entities/shared/filters/index.js +11 -4
- package/dist-sdk/src/entities/shared/foreign-ref.d.ts +14 -0
- package/dist-sdk/src/entities/shared/foreign-ref.js +12 -0
- package/dist-sdk/src/entities/shared/ref.d.ts +26 -11
- package/dist-sdk/src/entities/shared/ref.js +8 -3
- package/dist-sdk/src/entities/shared/types/common.d.ts +2 -2
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +1 -1
- package/dist-sdk/src/entities/shared/types/field-types.js +1 -1
- package/dist-sdk/src/entities/skill/build.d.ts +2 -2
- package/dist-sdk/src/entities/skill/build.js +3 -3
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +1 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +26 -7
- package/dist-sdk/src/entities/skill/index.d.ts +1 -1
- package/dist-sdk/src/entities/skill/index.js +1 -1
- package/dist-sdk/src/entities/skill/module.js +2 -2
- package/dist-sdk/src/entities/skill/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/skill/to-tf.js +2 -2
- package/dist-sdk/src/entities/skill/tools.d.ts +4 -3
- package/dist-sdk/src/entities/skill/tools.js +4 -3
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +13 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +42 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +6 -6
- package/dist-sdk/src/entities/table/build.d.ts +1 -1
- package/dist-sdk/src/entities/table/build.js +9 -9
- package/dist-sdk/src/entities/table/catalog-render.js +9 -1
- package/dist-sdk/src/entities/table/deserializer/normalize.js +4 -4
- package/dist-sdk/src/entities/table/fields/types.d.ts +1 -1
- package/dist-sdk/src/entities/table/fields/types.js +1 -1
- package/dist-sdk/src/entities/table/index.d.ts +2 -2
- package/dist-sdk/src/entities/table/index.js +3 -3
- package/dist-sdk/src/entities/table/module.js +1 -1
- package/dist-sdk/src/entities/table/to-tf.js +22 -30
- package/dist-sdk/src/entities/task/build.d.ts +1 -1
- package/dist-sdk/src/entities/task/build.js +5 -5
- package/dist-sdk/src/entities/task/index.d.ts +1 -1
- package/dist-sdk/src/entities/task/index.js +1 -1
- package/dist-sdk/src/entities/view/build.d.ts +46 -0
- package/dist-sdk/src/entities/view/build.js +19 -0
- package/dist-sdk/src/entities/view/from-tf.js +68 -18
- package/dist-sdk/src/entities/view/module.d.ts +6 -13
- package/dist-sdk/src/entities/view/module.js +7 -14
- package/dist-sdk/src/entities/view/sharing.d.ts +10 -0
- package/dist-sdk/src/entities/view/sharing.js +6 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +21 -19
- package/dist-sdk/src/entities/view/to-tf.js +61 -26
- package/dist-sdk/src/entities/view/types.js +3 -0
- package/dist-sdk/src/entities/visual-flow/build.d.ts +1 -1
- package/dist-sdk/src/entities/visual-flow/build.js +8 -8
- package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -1
- package/dist-sdk/src/entities/visual-flow/index.js +1 -1
- package/dist-sdk/src/entities/visual-flow/module.js +1 -1
- package/dist-sdk/src/entities/visual-flow/printer.js +3 -3
- package/dist-sdk/src/entities/visual-flow/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/visual-flow/to-tf.js +3 -7
- package/dist-sdk/src/entities/widget/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/widget/to-tf.js +9 -7
- package/dist-sdk/src/graph/index.d.ts +5 -1
- package/dist-sdk/src/graph/index.js +4 -1
- package/dist-sdk/src/graph/modules.js +6 -1
- package/dist-sdk/src/graph/types.d.ts +52 -1
- package/dist-sdk/src/internal/safe-identifier.d.ts +4 -0
- package/dist-sdk/src/internal/safe-identifier.js +13 -0
- package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
- package/dist-sdk/src/internal/sdk-package.js +1 -0
- package/package.json +12 -3
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* outputs chain lives on the `workflow` field.
|
|
2
|
+
* Automation printer — walks the internal `AutomationAst` produced by the
|
|
3
|
+
* platform deserializer and emits action-native EDK TypeScript source:
|
|
4
|
+
* `automation({ name, app, revision, status,
|
|
5
|
+
* actions: actions().trigger(...).recordSearch(...).outputs(...) })`,
|
|
6
|
+
* exported as default. `automation` itself is not chained; the fluent
|
|
7
|
+
* trigger/action/output sequence lives in the `actions` field.
|
|
9
8
|
*
|
|
10
|
-
* Where v1 emits `
|
|
9
|
+
* Where v1 emits `automation({ owner, name, status }).trigger(...)` with
|
|
11
10
|
* refs carrying ids, v2 emits the chainable builder with flat `name`/`parent`
|
|
12
11
|
* options and every cross-entity reference as a **handle-token** off the owning app's
|
|
13
12
|
* catalog barrel (`<ownerHandle>.fields.<key>`, `<ownerHandle>.agents.<key>`,
|
|
@@ -16,25 +15,29 @@
|
|
|
16
15
|
* The structure mirrors the v1 printer (`./
|
|
17
16
|
* print-automation.ts`): same `ImportTracker`, same `RefCtx` (the bound ctx
|
|
18
17
|
* name threaded through nested operator bodies), same quote/escape/indent
|
|
19
|
-
* helpers, same recursion over operator `children` via
|
|
18
|
+
* helpers, same recursion over operator `children` via fluent branch builders. Only the
|
|
20
19
|
* emitted *syntax* changes:
|
|
21
|
-
* - the builder API (`
|
|
22
|
-
* `forEach`/`switch`/`forkJoin
|
|
20
|
+
* - the builder API (`automation`, `recordCreated`, direct fluent action
|
|
21
|
+
* methods and nested `forEach`/`switch`/`forkJoin` branch builders);
|
|
23
22
|
* - references are catalog handle-tokens, not v1 typed-id objects;
|
|
24
23
|
* - filters use the `filter.*` DSL with `FieldRef` tokens (`filter.eq(app
|
|
25
24
|
* .fields.x, "v")`), passed as a bare value (not v1's `(app) => ...` lambda);
|
|
26
|
-
* - ctx refs use the v2 ctx shape (`ctx.trigger.…`, `ctx.
|
|
27
|
-
*
|
|
25
|
+
* - ctx refs use the v2 ctx shape (`ctx.trigger.…`, `ctx.actions.<key>.…`,
|
|
26
|
+
* and `ctx.item.…` for the current forEach item).
|
|
28
27
|
*
|
|
29
28
|
* Unresolved refs emit `"<uuid>" /* TODO: <hint> *\/` (v2 has no `val()`
|
|
30
29
|
* wrapper — value slots accept literals directly), so the generated file still
|
|
31
|
-
* compiles when the catalog is partial.
|
|
30
|
+
* compiles when the catalog is partial. Ref-only raw datamine IDs use the
|
|
31
|
+
* explicit `unsafePlatformId(...)` escape hatch and retain bridge diagnostics.
|
|
32
32
|
*/
|
|
33
33
|
import { camelCase } from "../../../../pull/util.js";
|
|
34
34
|
import { sdkPackageSpecifier } from "../../../internal/sdk-package.js";
|
|
35
|
+
import { safeIdentifier } from "../../../internal/safe-identifier.js";
|
|
35
36
|
import { isRefExpr } from "../../shared/filters/ast.js";
|
|
36
37
|
import { printFilter as printCanonicalFilter } from "../../shared/filters/print.js";
|
|
38
|
+
import { UNRESOLVED_FIELD_MARKER } from "../../shared/ref.js";
|
|
37
39
|
import { UNRESOLVED_REFERENCE_MARKER } from "../filter.js";
|
|
40
|
+
import { unresolvedReferenceComment } from "../../../engine/pull/ref-only.js";
|
|
38
41
|
// ---------------------------------------------------------------------------
|
|
39
42
|
// Factory name mapping — v1 AST `factory` → v2 factory function name.
|
|
40
43
|
//
|
|
@@ -58,7 +61,7 @@ const TASK_FACTORY_V2 = {
|
|
|
58
61
|
aiTransform: "aiTransform",
|
|
59
62
|
documentModel: "readFile",
|
|
60
63
|
notification: "notification",
|
|
61
|
-
filterTask: "
|
|
64
|
+
filterTask: "filterAction",
|
|
62
65
|
runAutomation: "runAutomation",
|
|
63
66
|
findRelatedRecords: "findRelatedRecords",
|
|
64
67
|
recordFieldLocking: "recordFieldLocking",
|
|
@@ -112,11 +115,11 @@ function emptyImports() {
|
|
|
112
115
|
filterOps: new Set(),
|
|
113
116
|
factories: new Set(),
|
|
114
117
|
aliases: new Map(),
|
|
115
|
-
usesChildTask: false,
|
|
116
118
|
usesTemplate: false,
|
|
117
119
|
usesUnresolvedField: false,
|
|
118
120
|
usesUnsafePlatformId: false,
|
|
119
121
|
usesOrg: false,
|
|
122
|
+
usesScriptInput: false,
|
|
120
123
|
};
|
|
121
124
|
}
|
|
122
125
|
const DEFAULT_CTX = { ctxName: "ctx" };
|
|
@@ -126,7 +129,7 @@ const DEFAULT_CTX = { ctxName: "ctx" };
|
|
|
126
129
|
* with the automation's own const (`state.localIdentifier`, e.g. an
|
|
127
130
|
* automation file literally named "calculation" using the `calculation`
|
|
128
131
|
* task), importing it unaliased produces a duplicate-declaration error
|
|
129
|
-
* (`import { calculation }` + `const calculation =
|
|
132
|
+
* (`import { calculation }` + `const calculation = automation(...)`)
|
|
130
133
|
* and every call site resolves to the wrong binding. On collision, alias the
|
|
131
134
|
* import (`calculation as edkCalculation`) and return the alias so the
|
|
132
135
|
* generated call site and the import statement agree.
|
|
@@ -145,7 +148,7 @@ function trackFactory(name, state) {
|
|
|
145
148
|
/**
|
|
146
149
|
* Build a lambda parameter list, prefixing each name with `_` when its
|
|
147
150
|
* bare-word form doesn't appear in the body — same trick the v1 printer uses
|
|
148
|
-
* so an operator body that ignores its
|
|
151
|
+
* so an operator body that ignores its context still typechecks
|
|
149
152
|
* cleanly under `noUnusedParameters`.
|
|
150
153
|
*/
|
|
151
154
|
function lambdaParams(body, ...names) {
|
|
@@ -153,31 +156,41 @@ function lambdaParams(body, ...names) {
|
|
|
153
156
|
.map((n) => (new RegExp(`\\b${n}\\b`).test(body) ? n : `_${n}`))
|
|
154
157
|
.join(", ");
|
|
155
158
|
}
|
|
159
|
+
function automationStatusKey(status) {
|
|
160
|
+
switch (status) {
|
|
161
|
+
case "DRAFT": return "draft";
|
|
162
|
+
case "INACTIVE": return "inactive";
|
|
163
|
+
case "ACTIVE": return "active";
|
|
164
|
+
}
|
|
165
|
+
}
|
|
156
166
|
function printAutomation(ast, opts) {
|
|
157
167
|
// Computed up front (independent of trigger/task printing) so `trackFactory`
|
|
158
168
|
// can alias any factory whose v2 name collides with it before emitting a
|
|
159
169
|
// single call site.
|
|
160
170
|
const refName = opts.refName ?? (camelCase(ast.name) || ast.name);
|
|
171
|
+
const identifier = safeIdentifier(refName, "automation");
|
|
161
172
|
const state = {
|
|
162
173
|
imports: emptyImports(),
|
|
163
174
|
localIdentifier: refName,
|
|
175
|
+
unresolvedReferences: opts.unresolvedReferences ?? [],
|
|
164
176
|
...(opts.foreignAppRefNames !== undefined && { foreignAppRefNames: opts.foreignAppRefNames }),
|
|
177
|
+
...(opts.foreignElementRefNames !== undefined && { foreignElementRefNames: opts.foreignElementRefNames }),
|
|
165
178
|
};
|
|
166
179
|
const triggerCode = printTrigger(ast.trigger, state);
|
|
167
|
-
// The trigger/
|
|
168
|
-
// level inside the `
|
|
169
|
-
// 2-deep base indent (4 spaces) to sit under `
|
|
180
|
+
// The trigger/action/output chain lives on the `actions` field, nested one
|
|
181
|
+
// level inside the `automation({...})` object — so actions print at a
|
|
182
|
+
// 2-deep base indent (4 spaces) to sit under `actions()`.
|
|
170
183
|
const taskCodes = ast.tasks.map((t) => printTask(t, state, 2));
|
|
171
184
|
const outputsCode = printOutputs(ast, state);
|
|
172
|
-
// The `
|
|
185
|
+
// The `actions:` value is the `actions()` chain; collect its links so
|
|
173
186
|
// the final one can take the trailing comma that terminates the property.
|
|
174
187
|
const chain = [` .trigger(${triggerCode})`, ...taskCodes];
|
|
175
188
|
if (outputsCode)
|
|
176
189
|
chain.push(outputsCode);
|
|
177
190
|
const body = [];
|
|
178
|
-
body.push(`const ${
|
|
191
|
+
body.push(`const ${identifier} = automation({`);
|
|
179
192
|
body.push(` name: ${quote(ast.name)},`);
|
|
180
|
-
body.push(`
|
|
193
|
+
body.push(` revision: ${quote(ast.workflowRevision)},`);
|
|
181
194
|
if (ast.description !== undefined)
|
|
182
195
|
body.push(` description: ${quote(ast.description)},`);
|
|
183
196
|
if (ast.triggersOtherAutomations !== undefined) {
|
|
@@ -187,19 +200,19 @@ function printAutomation(ast, opts) {
|
|
|
187
200
|
if (ast.serviceAccountName !== undefined) {
|
|
188
201
|
body.push(` serviceAccount: serviceAccountRef({ app: catalog.${opts.appRefName ?? ast.ownerHandle}, name: ${quote(ast.serviceAccountName)} }),`);
|
|
189
202
|
}
|
|
190
|
-
body.push(` status:
|
|
191
|
-
body.push(`
|
|
203
|
+
body.push(` status: automationStatus.${automationStatusKey(ast.status)},`);
|
|
204
|
+
body.push(` actions: actions()`);
|
|
192
205
|
body.push(`${chain.join("\n")},`);
|
|
193
206
|
body.push(`});`);
|
|
194
207
|
body.push("");
|
|
195
|
-
body.push(`export default ${
|
|
208
|
+
body.push(`export default ${identifier};`);
|
|
196
209
|
const header = renderHeader(ast, state.imports, opts);
|
|
197
210
|
return `${header}\n\n${body.join("\n")}\n`;
|
|
198
211
|
}
|
|
199
212
|
/**
|
|
200
213
|
* Emit the optional `.outputs((ctx) => ({ ... }))` chain link from the AST's
|
|
201
214
|
* automation-level output properties. Each value is a `RefExpr` — a ctx ref
|
|
202
|
-
* (`ctx.
|
|
215
|
+
* (`ctx.actions.x.y`) or a literal — rendered by the shared arg-value printer.
|
|
203
216
|
* Returns `""` when the automation declares no outputs (no chain link emitted).
|
|
204
217
|
*/
|
|
205
218
|
function printOutputs(ast, state) {
|
|
@@ -237,18 +250,20 @@ function renderHeader(ast, imports, _opts) {
|
|
|
237
250
|
// namespace. Import exactly what's used. A factory aliased by `trackFactory`
|
|
238
251
|
// (its v2 name collides with the automation's own const) prints as
|
|
239
252
|
// `name as alias` so the import and every call site agree.
|
|
240
|
-
const named = new Set(["
|
|
253
|
+
const named = new Set(["automationStatus", "automation", "actions"]);
|
|
241
254
|
if (ast.serviceAccountName !== undefined)
|
|
242
255
|
named.add("serviceAccountRef");
|
|
243
256
|
for (const f of imports.factories)
|
|
244
257
|
named.add(f);
|
|
245
|
-
if (imports.usesChildTask)
|
|
246
|
-
named.add("childTask");
|
|
247
258
|
if (imports.filterOps.size > 0)
|
|
248
259
|
named.add("filter");
|
|
260
|
+
if (imports.usesScriptInput)
|
|
261
|
+
named.add("ScriptInput");
|
|
249
262
|
const sortedSpecifiers = Array.from(named)
|
|
250
263
|
.sort()
|
|
251
264
|
.map((name) => {
|
|
265
|
+
if (name === "ScriptInput")
|
|
266
|
+
return "type ScriptInput";
|
|
252
267
|
const alias = imports.aliases.get(name);
|
|
253
268
|
return alias ? `${name} as ${alias}` : name;
|
|
254
269
|
});
|
|
@@ -322,12 +337,13 @@ function printTrigger(trigger, state) {
|
|
|
322
337
|
}
|
|
323
338
|
case "webhook": {
|
|
324
339
|
const webHook = trackFactory("webHook", state);
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
340
|
+
// Always print authenticated (like approveButton, #325) - it's
|
|
341
|
+
// always populated by from-tf.ts now, so this never omits a real
|
|
342
|
+
// false and round-trips symmetrically with the wire's actual state.
|
|
343
|
+
const parts = [`authenticated: ${trigger.authenticated}`];
|
|
328
344
|
if (trigger.customResponse)
|
|
329
345
|
parts.push(`customResponse: ${printCustomResponse(trigger.customResponse)}`);
|
|
330
|
-
return
|
|
346
|
+
return `${webHook}({\n ${parts.join(",\n ")}\n })`;
|
|
331
347
|
}
|
|
332
348
|
case "temporal": {
|
|
333
349
|
const temporal = trackFactory("temporal", state);
|
|
@@ -376,7 +392,7 @@ function printTrigger(trigger, state) {
|
|
|
376
392
|
let datamine;
|
|
377
393
|
if (typeof trigger.datamine === "string") {
|
|
378
394
|
state.imports.usesUnsafePlatformId = true;
|
|
379
|
-
datamine = `unsafePlatformId(${quote(trigger.datamine)})`;
|
|
395
|
+
datamine = `unsafePlatformId(${quote(trigger.datamine)})${unresolvedReferenceComment(trigger.datamine, state.unresolvedReferences)}`;
|
|
380
396
|
}
|
|
381
397
|
else {
|
|
382
398
|
datamine = printRef(trigger.datamine, state, DEFAULT_CTX);
|
|
@@ -436,7 +452,7 @@ function printFieldRef(appHandle, fieldKey) {
|
|
|
436
452
|
// Tasks
|
|
437
453
|
// ---------------------------------------------------------------------------
|
|
438
454
|
/**
|
|
439
|
-
* Trailing `, "Display Name"` arg for
|
|
455
|
+
* Trailing `, "Display Name"` arg for direct action calls — only
|
|
440
456
|
* emitted when the task's real wire name differs from its `refKey` (adopting
|
|
441
457
|
* a platform-authored task, e.g. "For Each" vs. the slugged refKey
|
|
442
458
|
* "For_Each"). Omitted otherwise so the common case stays two-arg.
|
|
@@ -449,36 +465,36 @@ function topLevelTaskTrailingArgs(task) {
|
|
|
449
465
|
return displayNameArg(task);
|
|
450
466
|
return `, ${task.displayName ? quote(task.displayName) : "undefined"}, ${quote(task.hclParent)}`;
|
|
451
467
|
}
|
|
452
|
-
function printTask(task, state, indent) {
|
|
468
|
+
function printTask(task, state, indent, refCtx = DEFAULT_CTX) {
|
|
453
469
|
const pad = " ".repeat(indent);
|
|
454
470
|
if (task.factory === "executeScript")
|
|
455
|
-
return formatExecuteScript(task, state, indent);
|
|
471
|
+
return formatExecuteScript(task, state, indent, refCtx);
|
|
456
472
|
if (task.factory === "forEach")
|
|
457
|
-
return formatForEach(task, state, indent);
|
|
473
|
+
return formatForEach(task, state, indent, refCtx);
|
|
458
474
|
if (task.factory === "switchTask")
|
|
459
|
-
return formatSwitch(task, state, indent);
|
|
475
|
+
return formatSwitch(task, state, indent, refCtx);
|
|
460
476
|
if (task.factory === "forkJoin")
|
|
461
|
-
return formatForkJoin(task, state, indent);
|
|
462
|
-
const
|
|
463
|
-
const args = printTaskArgs(task, state, indent + 1,
|
|
464
|
-
|
|
477
|
+
return formatForkJoin(task, state, indent, refCtx);
|
|
478
|
+
const method = TASK_FACTORY_V2[task.factory];
|
|
479
|
+
const args = printTaskArgs(task, state, indent + 1, refCtx);
|
|
480
|
+
if (!method) {
|
|
481
|
+
return `${pad}./* TODO: unsupported action factory ${quote(task.factory)} */ undefined`;
|
|
482
|
+
}
|
|
483
|
+
const options = /\bctx\b/.test(args) ? `(ctx) => (${args})` : args;
|
|
484
|
+
return `${pad}.${method}(${quote(task.refKey)}, ${options}${topLevelTaskTrailingArgs(task)})`;
|
|
465
485
|
}
|
|
466
|
-
/**
|
|
467
|
-
|
|
468
|
-
* with function-form `code`. Nested operator bodies still print
|
|
469
|
-
* `childTask(..., executeScript({…}))` via {@link printChildTask}.
|
|
470
|
-
*/
|
|
471
|
-
function formatExecuteScript(task, state, indent) {
|
|
486
|
+
/** Fluent `.executeScript(name, { inputs, code, outputs? })` in any action chain. */
|
|
487
|
+
function formatExecuteScript(task, state, indent, refCtx = DEFAULT_CTX) {
|
|
472
488
|
const pad = " ".repeat(indent);
|
|
473
489
|
const configPad = " ".repeat(indent + 1);
|
|
474
490
|
const lines = [];
|
|
475
491
|
if (task.args.inputs !== undefined && task.args.inputs !== null && typeof task.args.inputs === "object") {
|
|
476
|
-
const obj = printObjectLiteral(task.args.inputs, state, indent + 1,
|
|
492
|
+
const obj = printObjectLiteral(task.args.inputs, state, indent + 1, refCtx);
|
|
477
493
|
lines.push(`${configPad}inputs: (${lambdaParams(obj, "ctx")}) => (${obj}),`);
|
|
478
494
|
}
|
|
479
495
|
const code = task.args.code ?? task.args.script;
|
|
480
496
|
if (typeof code === "string") {
|
|
481
|
-
lines.push(`${configPad}code: ${printScriptCodeFn(code, indent + 1)},`);
|
|
497
|
+
lines.push(`${configPad}code: ${printScriptCodeFn(code, indent + 1, state)},`);
|
|
482
498
|
}
|
|
483
499
|
if (task.args.outputs !== undefined && task.args.outputs !== null && typeof task.args.outputs === "object") {
|
|
484
500
|
lines.push(`${configPad}outputs: ${printObjectLiteral(task.args.outputs, state, indent + 1, DEFAULT_CTX)},`);
|
|
@@ -490,9 +506,9 @@ function formatExecuteScript(task, state, indent) {
|
|
|
490
506
|
lines.push(`${configPad}outputs: null,`);
|
|
491
507
|
}
|
|
492
508
|
if (lines.length === 0) {
|
|
493
|
-
return `${pad}.executeScript(${quote(task.refKey)}, {})`;
|
|
509
|
+
return `${pad}.executeScript(${quote(task.refKey)}, {}${topLevelTaskTrailingArgs(task)})`;
|
|
494
510
|
}
|
|
495
|
-
return `${pad}.executeScript(${quote(task.refKey)}, {\n${lines.join("\n")}\n${pad}})`;
|
|
511
|
+
return `${pad}.executeScript(${quote(task.refKey)}, {\n${lines.join("\n")}\n${pad}}${topLevelTaskTrailingArgs(task)})`;
|
|
496
512
|
}
|
|
497
513
|
/**
|
|
498
514
|
* Wrap a platform script body as `(input) => { … }` for authoring / pull —
|
|
@@ -503,56 +519,57 @@ function formatExecuteScript(task, state, indent) {
|
|
|
503
519
|
* build time by `tryExtractFromCurrentSource` (`script-code.ts`), which reads
|
|
504
520
|
* this exact source text back out directly rather than trusting the
|
|
505
521
|
* transpiled runtime function.
|
|
522
|
+
*
|
|
523
|
+
* `input` is explicitly typed `ScriptInput<Record<string, unknown>>` rather
|
|
524
|
+
* than left for `.executeScript`'s contextual inference against the printed
|
|
525
|
+
* `inputs:` bag: the body is the platform's VERBATIM script text, and the
|
|
526
|
+
* platform's own configured `inputs` can legitimately not cover every name
|
|
527
|
+
* the script destructures off `input.parameters` (dead/leftover
|
|
528
|
+
* destructuring, a name bound some other way) — a real pulled automation hit
|
|
529
|
+
* this. Narrow inference would then reject a script EDK didn't write and
|
|
530
|
+
* can't safely edit; the explicit wider annotation keeps `input.parameters`
|
|
531
|
+
* a typed object (not `any`) while accepting whatever the verbatim body
|
|
532
|
+
* references. Hand-authored `.executeScript` calls are unaffected — they
|
|
533
|
+
* still get full inference since they never pass this printer.
|
|
506
534
|
*/
|
|
507
|
-
function printScriptCodeFn(body, indent) {
|
|
535
|
+
function printScriptCodeFn(body, indent, state) {
|
|
508
536
|
const pad = " ".repeat(indent);
|
|
509
537
|
const innerPad = " ".repeat(indent + 1);
|
|
510
538
|
const lines = body.replace(/\r\n/g, "\n").split("\n");
|
|
511
539
|
const indented = lines.map((line) => (line.length === 0 ? "" : `${innerPad}${line}`)).join("\n");
|
|
512
|
-
|
|
540
|
+
state.imports.usesScriptInput = true;
|
|
541
|
+
return `(input: ScriptInput<Record<string, unknown>>) => {\n${indented}\n${pad}}`;
|
|
513
542
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
function resolveTaskFactory(factory, state) {
|
|
520
|
-
const v2 = TASK_FACTORY_V2[factory];
|
|
521
|
-
if (v2) {
|
|
522
|
-
return trackFactory(v2, state);
|
|
523
|
-
}
|
|
524
|
-
// Unmappable (e.g. the deserializer's `__unknown`) — emit a clearly-marked
|
|
525
|
-
// placeholder so the file flags the gap rather than emitting invalid syntax.
|
|
526
|
-
return `/* TODO: unsupported task factory "${factory}" */ undefined as any`;
|
|
543
|
+
function formatNestedActions(tasks, state, indent, refCtx) {
|
|
544
|
+
if (tasks.length === 0)
|
|
545
|
+
return `(branch) => branch`;
|
|
546
|
+
const chain = tasks.map((task) => printTask(task, state, indent, refCtx)).join("\n");
|
|
547
|
+
return `(branch) => branch\n${chain}`;
|
|
527
548
|
}
|
|
528
|
-
function formatForEach(task, state, indent) {
|
|
549
|
+
function formatForEach(task, state, indent, refCtx) {
|
|
529
550
|
const pad = " ".repeat(indent);
|
|
530
551
|
const configIndent = " ".repeat(indent + 1);
|
|
531
|
-
|
|
532
|
-
const
|
|
533
|
-
|
|
534
|
-
|
|
552
|
+
const collectionCode = printArgValue("collection", task.args.collection, state, indent + 1, refCtx);
|
|
553
|
+
const childCtx = {
|
|
554
|
+
ctxName: "ctx",
|
|
555
|
+
selfTaskRefKeys: [...(refCtx.selfTaskRefKeys ?? []), task.refKey],
|
|
556
|
+
};
|
|
535
557
|
const children = task.children?.[0]?.tasks ?? [];
|
|
536
|
-
const
|
|
537
|
-
|
|
538
|
-
const tasksBlock = `(${lambdaParams(tbody, "item", "innerCtx")}) => ${tbody}`;
|
|
539
|
-
return `${pad}.task(${quote(task.refKey)}, (ctx) => ${forEach}(ctx, {\n${configIndent}collection: ${collectionCode},\n${configIndent}tasks: ${tasksBlock},\n${pad}})${topLevelTaskTrailingArgs(task)})`;
|
|
558
|
+
const actionsBlock = formatNestedActions(children, state, indent + 2, childCtx);
|
|
559
|
+
return `${pad}.forEach(${quote(task.refKey)}, {\n${configIndent}collection: (${lambdaParams(collectionCode, "ctx")}) => ${collectionCode},\n${configIndent}actions: ${actionsBlock},\n${pad}}${topLevelTaskTrailingArgs(task)})`;
|
|
540
560
|
}
|
|
541
561
|
/**
|
|
542
|
-
* Renders a switch's `
|
|
543
|
-
* text ("Default") uses the plain
|
|
562
|
+
* Renders a switch's `defaultActions:` config value. Platform-default label
|
|
563
|
+
* text ("Default") uses the plain fluent-builder callback form;
|
|
544
564
|
* anything else (e.g. a manual rename to "Default Path") is preserved via the
|
|
545
565
|
* `{ label, tasks }` object form so the build round trip reproduces it
|
|
546
566
|
* instead of hardcoding "Default".
|
|
547
567
|
*/
|
|
548
|
-
function
|
|
568
|
+
function formatDefaultActionsBlock(defaults, state, indent, configIndent, refCtx) {
|
|
549
569
|
const defaultTasks = defaults.flatMap((ch) => ch.tasks);
|
|
550
570
|
const defaultLabel = defaults.map((ch) => ch.defaultLabel).find((label) => label !== undefined);
|
|
551
571
|
const defaultFilterMode = defaults.map((ch) => ch.defaultFilterMode).find((mode) => mode !== undefined);
|
|
552
|
-
const
|
|
553
|
-
const defaultLines = defaultTasks.map((t) => printChildTask(t, state, indent + 2, innerCtx));
|
|
554
|
-
const dbody = defaultLines.length > 0 ? `[\n${defaultLines.join(",\n")}\n${configIndent}]` : `[]`;
|
|
555
|
-
const defaultFn = `(innerCtx: typeof ${ctxTypeName}) => ${dbody}`;
|
|
572
|
+
const defaultFn = formatNestedActions(defaultTasks, state, indent + 2, refCtx);
|
|
556
573
|
const needsLabel = defaultLabel !== undefined && defaultLabel !== "Default";
|
|
557
574
|
const needsFilterMode = defaultFilterMode === "explicitTrueFilter";
|
|
558
575
|
if (!needsLabel && !needsFilterMode)
|
|
@@ -561,29 +578,28 @@ function formatDefaultTasksBlock(defaults, state, indent, configIndent, ctxTypeN
|
|
|
561
578
|
const parts = [];
|
|
562
579
|
if (needsLabel)
|
|
563
580
|
parts.push(`${innerPad}label: ${quote(defaultLabel)}`);
|
|
564
|
-
parts.push(`${innerPad}
|
|
581
|
+
parts.push(`${innerPad}actions: ${defaultFn}`);
|
|
565
582
|
if (needsFilterMode)
|
|
566
583
|
parts.push(`${innerPad}defaultFilterMode: "explicitTrueFilter"`);
|
|
567
584
|
return `{\n${parts.join(",\n")},\n${configIndent}}`;
|
|
568
585
|
}
|
|
569
|
-
function formatSwitch(task, state, indent) {
|
|
586
|
+
function formatSwitch(task, state, indent, refCtx) {
|
|
570
587
|
const pad = " ".repeat(indent);
|
|
571
588
|
const configIndent = " ".repeat(indent + 1);
|
|
572
|
-
state.imports.usesChildTask = true;
|
|
573
|
-
const switchTask = trackFactory("switchTask", state);
|
|
574
589
|
const children = task.children ?? [];
|
|
575
590
|
const cases = children.filter((ch) => ch.label != null);
|
|
576
591
|
const defaults = children.filter((ch) => ch.label == null);
|
|
577
|
-
const
|
|
592
|
+
const branchCtx = { ctxName: "ctx", selfTaskRefKeys: refCtx.selfTaskRefKeys };
|
|
593
|
+
const caseLines = cases.map((ch) => formatSwitchCase(ch, state, indent + 2, branchCtx));
|
|
578
594
|
const configParts = [];
|
|
579
595
|
configParts.push(`${configIndent}cases: [\n${caseLines.join(",\n")}\n${configIndent}]`);
|
|
580
596
|
if (defaults.length > 0) {
|
|
581
|
-
const defaultBlock =
|
|
582
|
-
configParts.push(`${configIndent}
|
|
597
|
+
const defaultBlock = formatDefaultActionsBlock(defaults, state, indent, configIndent, branchCtx);
|
|
598
|
+
configParts.push(`${configIndent}defaultActions: ${defaultBlock}`);
|
|
583
599
|
}
|
|
584
|
-
return `${pad}.
|
|
600
|
+
return `${pad}.switch(${quote(task.refKey)}, (ctx) => ({\n${configParts.join(",\n")},\n${pad}})${topLevelTaskTrailingArgs(task)})`;
|
|
585
601
|
}
|
|
586
|
-
function formatSwitchCase(ch, state, indent,
|
|
602
|
+
function formatSwitchCase(ch, state, indent, refCtx) {
|
|
587
603
|
const pad = " ".repeat(indent);
|
|
588
604
|
const innerPad = " ".repeat(indent + 1);
|
|
589
605
|
const parts = [];
|
|
@@ -592,94 +608,22 @@ function formatSwitchCase(ch, state, indent, outerCtxName) {
|
|
|
592
608
|
// switch's outer scope; v2 takes it as a bare value (no `(app) =>` lambda).
|
|
593
609
|
if (ch.filter)
|
|
594
610
|
parts.push(`${innerPad}condition: ${printFilter(ch.filter, state)}`);
|
|
595
|
-
|
|
596
|
-
const taskLines = ch.tasks.map((t) => printChildTask(t, state, indent + 2, innerCtx));
|
|
597
|
-
const tbody = taskLines.length > 0 ? `[\n${taskLines.join(",\n")}\n${innerPad}]` : `[]`;
|
|
598
|
-
const taskBlock = `(innerCtx: typeof ${outerCtxName}) => ${tbody}`;
|
|
599
|
-
parts.push(`${innerPad}tasks: ${taskBlock}`);
|
|
611
|
+
parts.push(`${innerPad}actions: ${formatNestedActions(ch.tasks, state, indent + 2, refCtx)}`);
|
|
600
612
|
return `${pad}{\n${parts.join(",\n")},\n${pad}}`;
|
|
601
613
|
}
|
|
602
|
-
function formatForkJoin(task, state, indent) {
|
|
614
|
+
function formatForkJoin(task, state, indent, refCtx) {
|
|
603
615
|
const pad = " ".repeat(indent);
|
|
604
616
|
const configIndent = " ".repeat(indent + 1);
|
|
605
|
-
state.imports.usesChildTask = true;
|
|
606
|
-
const forkJoin = trackFactory("forkJoin", state);
|
|
607
617
|
const branches = task.children ?? [];
|
|
608
|
-
const
|
|
618
|
+
const branchCtx = { ctxName: "ctx", selfTaskRefKeys: refCtx.selfTaskRefKeys };
|
|
619
|
+
const branchLines = branches.map((ch) => formatForkJoinBranch(ch, state, indent + 2, branchCtx));
|
|
609
620
|
const branchesBlock = branchLines.length > 0 ? `[\n${branchLines.join(",\n")}\n${configIndent}]` : `[]`;
|
|
610
|
-
return `${pad}.
|
|
621
|
+
return `${pad}.forkJoin(${quote(task.refKey)}, {\n${configIndent}branches: ${branchesBlock},\n${pad}}${topLevelTaskTrailingArgs(task)})`;
|
|
611
622
|
}
|
|
612
|
-
function formatForkJoinBranch(ch, state, indent) {
|
|
623
|
+
function formatForkJoinBranch(ch, state, indent, refCtx) {
|
|
613
624
|
const pad = " ".repeat(indent);
|
|
614
625
|
const innerPad = " ".repeat(indent + 1);
|
|
615
|
-
|
|
616
|
-
const taskLines = ch.tasks.map((t) => printChildTask(t, state, indent + 2, innerCtx));
|
|
617
|
-
const tbody = taskLines.length > 0 ? `[\n${taskLines.join(",\n")}\n${innerPad}]` : `[]`;
|
|
618
|
-
const taskBlock = `(${lambdaParams(tbody, "innerCtx")}) => ${tbody}`;
|
|
619
|
-
return `${pad}{\n${innerPad}label: ${ch.label == null ? "null" : quote(ch.label)},\n${innerPad}tasks: ${taskBlock},\n${pad}}`;
|
|
620
|
-
}
|
|
621
|
-
/**
|
|
622
|
-
* Child-position task. `childTask(name, def)` takes a plain TaskDef (the
|
|
623
|
-
* factory call), not a `(ctx) =>` lambda — the enclosing operator body already
|
|
624
|
-
* bound a ctx (`innerCtx`), which refs inside resolve against. Nested
|
|
625
|
-
* operators recurse through dedicated child-position formatters so a forEach /
|
|
626
|
-
* switch / forkJoin inside another operator body renders its full child tree.
|
|
627
|
-
*/
|
|
628
|
-
function printChildTask(task, state, indent, refCtx) {
|
|
629
|
-
if (task.factory === "forEach")
|
|
630
|
-
return formatChildForEach(task, state, indent, refCtx);
|
|
631
|
-
if (task.factory === "switchTask")
|
|
632
|
-
return formatChildSwitch(task, state, indent, refCtx);
|
|
633
|
-
if (task.factory === "forkJoin")
|
|
634
|
-
return formatChildForkJoin(task, state, indent, refCtx);
|
|
635
|
-
state.imports.usesChildTask = true;
|
|
636
|
-
const factory = resolveTaskFactory(task.factory, state);
|
|
637
|
-
const pad = " ".repeat(indent);
|
|
638
|
-
const args = printTaskArgs(task, state, indent + 1, refCtx);
|
|
639
|
-
return `${pad}childTask(${quote(task.refKey)}, ${factory}(${args})${displayNameArg(task)})`;
|
|
640
|
-
}
|
|
641
|
-
function formatChildForEach(task, state, indent, refCtx) {
|
|
642
|
-
const pad = " ".repeat(indent);
|
|
643
|
-
const configIndent = " ".repeat(indent + 1);
|
|
644
|
-
state.imports.usesChildTask = true;
|
|
645
|
-
const forEach = trackFactory("forEach", state);
|
|
646
|
-
const collectionCode = printArgValue("collection", task.args.collection, state, indent + 1, refCtx);
|
|
647
|
-
const innerCtx = {
|
|
648
|
-
ctxName: "innerCtx",
|
|
649
|
-
selfTaskRefKeys: [...(refCtx.selfTaskRefKeys ?? []), task.refKey],
|
|
650
|
-
};
|
|
651
|
-
const children = task.children?.[0]?.tasks ?? [];
|
|
652
|
-
const childLines = children.map((c) => printChildTask(c, state, indent + 2, innerCtx));
|
|
653
|
-
const tbody = childLines.length > 0 ? `[\n${childLines.join(",\n")}\n${configIndent}]` : `[]`;
|
|
654
|
-
const tasksBlock = `(${lambdaParams(tbody, "item", "innerCtx")}) => ${tbody}`;
|
|
655
|
-
return `${pad}childTask(${quote(task.refKey)}, ${forEach}(${refCtx.ctxName}, {\n${configIndent}collection: ${collectionCode},\n${configIndent}tasks: ${tasksBlock},\n${pad}})${displayNameArg(task)})`;
|
|
656
|
-
}
|
|
657
|
-
function formatChildSwitch(task, state, indent, refCtx) {
|
|
658
|
-
const pad = " ".repeat(indent);
|
|
659
|
-
const configIndent = " ".repeat(indent + 1);
|
|
660
|
-
state.imports.usesChildTask = true;
|
|
661
|
-
const switchTask = trackFactory("switchTask", state);
|
|
662
|
-
const children = task.children ?? [];
|
|
663
|
-
const cases = children.filter((ch) => ch.label != null);
|
|
664
|
-
const defaults = children.filter((ch) => ch.label == null);
|
|
665
|
-
const caseLines = cases.map((ch) => formatSwitchCase(ch, state, indent + 2, refCtx.ctxName));
|
|
666
|
-
const configParts = [];
|
|
667
|
-
configParts.push(`${configIndent}cases: [\n${caseLines.join(",\n")}\n${configIndent}]`);
|
|
668
|
-
if (defaults.length > 0) {
|
|
669
|
-
const defaultBlock = formatDefaultTasksBlock(defaults, state, indent, configIndent, refCtx.ctxName);
|
|
670
|
-
configParts.push(`${configIndent}defaultTasks: ${defaultBlock}`);
|
|
671
|
-
}
|
|
672
|
-
return `${pad}childTask(${quote(task.refKey)}, ${switchTask}(${refCtx.ctxName}, {\n${configParts.join(",\n")},\n${pad}})${displayNameArg(task)})`;
|
|
673
|
-
}
|
|
674
|
-
function formatChildForkJoin(task, state, indent, refCtx) {
|
|
675
|
-
const pad = " ".repeat(indent);
|
|
676
|
-
const configIndent = " ".repeat(indent + 1);
|
|
677
|
-
state.imports.usesChildTask = true;
|
|
678
|
-
const forkJoin = trackFactory("forkJoin", state);
|
|
679
|
-
const branches = task.children ?? [];
|
|
680
|
-
const branchLines = branches.map((ch) => formatForkJoinBranch(ch, state, indent + 2));
|
|
681
|
-
const branchesBlock = branchLines.length > 0 ? `[\n${branchLines.join(",\n")}\n${configIndent}]` : `[]`;
|
|
682
|
-
return `${pad}childTask(${quote(task.refKey)}, ${forkJoin}(${refCtx.ctxName}, {\n${configIndent}branches: ${branchesBlock},\n${pad}})${displayNameArg(task)})`;
|
|
626
|
+
return `${pad}{\n${innerPad}label: ${ch.label == null ? "null" : quote(ch.label)},\n${innerPad}actions: ${formatNestedActions(ch.tasks, state, indent + 2, refCtx)},\n${pad}}`;
|
|
683
627
|
}
|
|
684
628
|
// ---------------------------------------------------------------------------
|
|
685
629
|
// Task args
|
|
@@ -694,7 +638,7 @@ function formatChildForkJoin(task, state, indent, refCtx) {
|
|
|
694
638
|
*/
|
|
695
639
|
function printTaskArgs(task, state, indent, refCtx) {
|
|
696
640
|
const renames = ARG_RENAMES[task.factory] ?? {};
|
|
697
|
-
const appHandle = taskPrimaryAppHandle(task.args);
|
|
641
|
+
const appHandle = taskPrimaryAppHandle(task.args, state);
|
|
698
642
|
const pad = " ".repeat(indent);
|
|
699
643
|
const lines = [];
|
|
700
644
|
for (const [k, v] of Object.entries(task.args)) {
|
|
@@ -720,8 +664,8 @@ function printTaskArgs(task, state, indent, refCtx) {
|
|
|
720
664
|
* Render the v2 `fields: [{ field, value }]` array from the v1 AST's
|
|
721
665
|
* `values: { <fieldKey>: <RefExpr> }` map. Field keys become catalog handle
|
|
722
666
|
* tokens off the task's app (`<appHandle>.fields.<key>`); an unresolved field
|
|
723
|
-
* key (`
|
|
724
|
-
*
|
|
667
|
+
* key (`UNRESOLVED_FIELD_MARKER + <uuid>`) is preserved through the explicit
|
|
668
|
+
* `unsafePlatformId` escape hatch so a non-recursive pull remains buildable.
|
|
725
669
|
*/
|
|
726
670
|
function printFieldAssignments(values, appHandle, state, indent, refCtx) {
|
|
727
671
|
if (!values || typeof values !== "object" || Array.isArray(values))
|
|
@@ -733,12 +677,15 @@ function printFieldAssignments(values, appHandle, state, indent, refCtx) {
|
|
|
733
677
|
const inner = " ".repeat(indent + 1);
|
|
734
678
|
const lines = entries.map(([fieldKey, value]) => {
|
|
735
679
|
let fieldExpr;
|
|
736
|
-
if (appHandle && !fieldKey.startsWith(
|
|
680
|
+
if (appHandle && !fieldKey.startsWith(UNRESOLVED_FIELD_MARKER)) {
|
|
737
681
|
fieldExpr = `catalog.${appHandle}.fields${safeMember(fieldKey)}`;
|
|
738
682
|
}
|
|
739
683
|
else {
|
|
740
|
-
const uuid = fieldKey.
|
|
741
|
-
|
|
684
|
+
const uuid = fieldKey.startsWith(UNRESOLVED_FIELD_MARKER)
|
|
685
|
+
? fieldKey.slice(UNRESOLVED_FIELD_MARKER.length)
|
|
686
|
+
: fieldKey;
|
|
687
|
+
state.imports.usesUnsafePlatformId = true;
|
|
688
|
+
fieldExpr = `unsafePlatformId(${quote(uuid)})`;
|
|
742
689
|
}
|
|
743
690
|
const valueExpr = printArgValue("", value, state, indent + 2, refCtx);
|
|
744
691
|
return `${inner}{ field: ${fieldExpr}, value: ${valueExpr} },`;
|
|
@@ -749,11 +696,16 @@ function printFieldAssignments(values, appHandle, state, indent, refCtx) {
|
|
|
749
696
|
* The task's primary app handle, used to resolve `values:` field keys to
|
|
750
697
|
* `<appHandle>.fields.<key>` tokens. Reads the `app` / `relatedApp` arg.
|
|
751
698
|
*/
|
|
752
|
-
function taskPrimaryAppHandle(args) {
|
|
699
|
+
function taskPrimaryAppHandle(args, state) {
|
|
753
700
|
for (const k of ["app", "relatedApp"]) {
|
|
754
701
|
const v = args[k];
|
|
755
|
-
if (isRefExpr(v) && v.kind === "app")
|
|
702
|
+
if (isRefExpr(v) && v.kind === "app") {
|
|
703
|
+
if (v.entityType === "app" && v.name !== undefined)
|
|
704
|
+
return state.foreignAppRefNames?.get(v.name) ?? v.appHandle;
|
|
705
|
+
if (v.entityType === "element" && v.name !== undefined)
|
|
706
|
+
return state.foreignElementRefNames?.get(v.name) ?? v.appHandle;
|
|
756
707
|
return v.appHandle;
|
|
708
|
+
}
|
|
757
709
|
}
|
|
758
710
|
return undefined;
|
|
759
711
|
}
|
|
@@ -761,13 +713,17 @@ function taskPrimaryAppHandle(args) {
|
|
|
761
713
|
// Argument value printer — dispatches on runtime shape
|
|
762
714
|
// ---------------------------------------------------------------------------
|
|
763
715
|
function printArgValue(name, value, state, indent, refCtx) {
|
|
716
|
+
if (isPulledRawCalculation(value)) {
|
|
717
|
+
const calc = trackFactory("calc", state);
|
|
718
|
+
return `${calc}.raw(${quote(value.text)}, ${quote(value.resultType)})`;
|
|
719
|
+
}
|
|
764
720
|
if (isRefExpr(value))
|
|
765
721
|
return printRef(value, state, refCtx);
|
|
766
722
|
if (isFilter(value))
|
|
767
723
|
return printFilter(value, state);
|
|
768
724
|
// executeScript body (AST key `code`, legacy `script`) — always function form.
|
|
769
725
|
if ((name === "code" || name === "script") && typeof value === "string") {
|
|
770
|
-
return printScriptCodeFn(value, indent);
|
|
726
|
+
return printScriptCodeFn(value, indent, state);
|
|
771
727
|
}
|
|
772
728
|
if (Array.isArray(value) && value.length > 0 && isSort(value[0])) {
|
|
773
729
|
return printSortArray(value, state, refCtx);
|
|
@@ -780,6 +736,9 @@ function printArgValue(name, value, state, indent, refCtx) {
|
|
|
780
736
|
}
|
|
781
737
|
return literalJson(value);
|
|
782
738
|
}
|
|
739
|
+
function isPulledRawCalculation(value) {
|
|
740
|
+
return !!value && typeof value === "object" && value.kind === "calculationRaw";
|
|
741
|
+
}
|
|
783
742
|
// ---------------------------------------------------------------------------
|
|
784
743
|
// RefExpr printer — emits v2 ctx refs + catalog handle-tokens
|
|
785
744
|
// ---------------------------------------------------------------------------
|
|
@@ -794,7 +753,7 @@ function printRef(ref, state, refCtx) {
|
|
|
794
753
|
return literalJson(ref.value);
|
|
795
754
|
case "taskRef": {
|
|
796
755
|
if (refCtx.selfTaskRefKeys?.includes(ref.task)) {
|
|
797
|
-
// `ctx.
|
|
756
|
+
// `ctx.actions` is a permissive runtime Proxy — `.For_Each` (or any
|
|
798
757
|
// key) always resolves to a working ref proxy, so this stays
|
|
799
758
|
// runtime-identical to an ordinary task ref. Only `TTasks` doesn't
|
|
800
759
|
// know about a forEach's own name inside its own body (it's typed
|
|
@@ -802,15 +761,15 @@ function printRef(ref, state, refCtx) {
|
|
|
802
761
|
// goes on the receiver — never on a literal `undefined` — to avoid
|
|
803
762
|
// suppressing the type error by introducing a real one at runtime.
|
|
804
763
|
const path = ref.path.map(safeMember).join("");
|
|
805
|
-
return `(${ctxName}.
|
|
764
|
+
return `(${ctxName}.actions as any /* TODO: "${ref.task}" isn't in scope inside its own forEach body yet */)${safeMember(ref.task)}${path}`;
|
|
806
765
|
}
|
|
807
766
|
// `result.<prop>` segments are output-schema property names — typed,
|
|
808
767
|
// legitimate — so print them with plain dot/bracket access; only record
|
|
809
768
|
// paths keep the unresolved-key as-any heuristic.
|
|
810
769
|
if (ref.path[0] === "result") {
|
|
811
|
-
return `${ctxName}.
|
|
770
|
+
return `${ctxName}.actions${safeMember(ref.task)}` + ref.path.map(safeMember).join("");
|
|
812
771
|
}
|
|
813
|
-
return printPathAccess(`${ctxName}.
|
|
772
|
+
return printPathAccess(`${ctxName}.actions${safeMember(ref.task)}`, ref.path);
|
|
814
773
|
}
|
|
815
774
|
case "triggerRef": {
|
|
816
775
|
// A bare `record.<unresolved-id>` path (no trailing sub-path) — the
|
|
@@ -836,10 +795,10 @@ function printRef(ref, state, refCtx) {
|
|
|
836
795
|
return printPathAccess(`${ctxName}.trigger${safeMember(head)}`, rest);
|
|
837
796
|
}
|
|
838
797
|
case "forEachRef":
|
|
839
|
-
return printPathAccess(`${ctxName}.
|
|
798
|
+
return printPathAccess(`${ctxName}.actions${safeMember(ref.forEachTask)}`, ref.path);
|
|
840
799
|
case "forEachItemRef": {
|
|
841
800
|
const path = ref.path.map(safeMember).join("");
|
|
842
|
-
return
|
|
801
|
+
return `${ctxName}.item${path}`;
|
|
843
802
|
}
|
|
844
803
|
case "variableParamRef":
|
|
845
804
|
return `${ctxName}.variables${safeMember(ref.varTask)}${safeMember(ref.name)}`;
|
|
@@ -866,12 +825,14 @@ function printRef(ref, state, refCtx) {
|
|
|
866
825
|
// pulled into this workspace (board issue #40, app-only) resolves to a
|
|
867
826
|
// typed token; otherwise a literal stub (field type is unconfirmed —
|
|
868
827
|
// ei's `elementum_field` data source doesn't expose it).
|
|
869
|
-
const foreignRefName = ref.foreign.entityType === "
|
|
828
|
+
const foreignRefName = ref.foreign.entityType === "element"
|
|
829
|
+
? state.foreignElementRefNames?.get(ref.foreign.name)
|
|
830
|
+
: state.foreignAppRefNames?.get(ref.foreign.name);
|
|
870
831
|
if (foreignRefName !== undefined)
|
|
871
832
|
return `catalog.${foreignRefName}.fields${safeMember(ref.fieldKey)}`;
|
|
872
833
|
return (`{ __kind: "field", refName: ${quote(ref.fieldKey)}, name: ${quote(ref.foreign.fieldName ?? ref.fieldKey)}, fieldType: "TEXT", ` +
|
|
873
834
|
`parent: ${quote(ref.appHandle)}, parentKind: ${quote(ref.foreign.entityType)}, parentName: ${quote(ref.foreign.name)} } ` +
|
|
874
|
-
|
|
835
|
+
`/* TODO: foreign field — type unconfirmed (ei's elementum_field data source doesn't expose it) and refName is a best-effort guess; verify against "${ref.foreign.name}" */`);
|
|
875
836
|
}
|
|
876
837
|
case "userField":
|
|
877
838
|
return `catalog.users.fields${safeMember(ref.fieldKey)}`;
|
|
@@ -879,10 +840,9 @@ function printRef(ref, state, refCtx) {
|
|
|
879
840
|
if (ref.entityType === undefined || ref.name === undefined) {
|
|
880
841
|
return `catalog.${ref.appHandle}`;
|
|
881
842
|
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
const foreignRefName = ref.entityType === "app" ? state.foreignAppRefNames?.get(ref.name) : undefined;
|
|
843
|
+
const foreignRefName = ref.entityType === "element"
|
|
844
|
+
? state.foreignElementRefNames?.get(ref.name)
|
|
845
|
+
: state.foreignAppRefNames?.get(ref.name);
|
|
886
846
|
if (foreignRefName !== undefined)
|
|
887
847
|
return `catalog.${foreignRefName}`;
|
|
888
848
|
return `{ __kind: ${quote(ref.entityType)}, refName: ${quote(ref.appHandle)}, name: ${quote(ref.name)} }`;
|
|
@@ -896,6 +856,12 @@ function printRef(ref, state, refCtx) {
|
|
|
896
856
|
case "datamine":
|
|
897
857
|
state.imports.usesOrg = true;
|
|
898
858
|
return `org.tables.${ref.tableHandle}.datamines${safeMember(ref.datamineKey)}`;
|
|
859
|
+
case "table":
|
|
860
|
+
// Org-table joins/filters print `org.tables.*`; automations print the
|
|
861
|
+
// default-catalog barrel path (`catalog.tables.*`) because pulled table
|
|
862
|
+
// modules are lazy-mounted there by `generated/catalog.ts`, not on the
|
|
863
|
+
// `org.ts` identity bag from `pull org --data-only`.
|
|
864
|
+
return `catalog.tables${safeMember(ref.tableHandle)}`;
|
|
899
865
|
case "user":
|
|
900
866
|
return `${trackFactory("userRef", state)}(${quote(ref.email)})`;
|
|
901
867
|
case "documentModel":
|
|
@@ -946,7 +912,7 @@ function printRef(ref, state, refCtx) {
|
|
|
946
912
|
// ---------------------------------------------------------------------------
|
|
947
913
|
// Filter printer — the v2 `filter.*` DSL. Namespaced under `filter`, it takes
|
|
948
914
|
// either a `FieldRef` token (`app.fields.x`) or a task/trigger `Ref`
|
|
949
|
-
// (`ctx.
|
|
915
|
+
// (`ctx.actions.x.y` — for row-less contexts like switch conditions) at the
|
|
950
916
|
// left-hand position, and exposes the canonical filter helper namespace.
|
|
951
917
|
// One call surface regardless of what's on the left — `printFilterField`
|
|
952
918
|
// prints the LHS as either a catalog field expression or a ctx ref
|
|
@@ -963,7 +929,7 @@ function printFilter(filter, state) {
|
|
|
963
929
|
/**
|
|
964
930
|
* Render the left-hand side of a `filter.*` call: a `FieldRef` token
|
|
965
931
|
* (`fieldRef` → `<handle>.fields.<key>`) when there's a field, or the ctx ref
|
|
966
|
-
* expression (`ctx.
|
|
932
|
+
* expression (`ctx.actions.x.y`) for a row-less (task/trigger-output) LHS —
|
|
967
933
|
* `filter.*` accepts either at the same argument position.
|
|
968
934
|
*/
|
|
969
935
|
function printFilterField(left, state) {
|
|
@@ -990,7 +956,7 @@ function printFilterField(left, state) {
|
|
|
990
956
|
}
|
|
991
957
|
/**
|
|
992
958
|
* Render the RHS of a v2 filter operator. A literal value AST collapses to its
|
|
993
|
-
* scalar; a reference RHS (`ctx.trigger.x`, `ctx.
|
|
959
|
+
* scalar; a reference RHS (`ctx.trigger.x`, `ctx.actions.y.z`) prints as the ctx
|
|
994
960
|
* ref — the v2 filter DSL accepts refs and serializes them to the platform's
|
|
995
961
|
* REFERENCE value shape.
|
|
996
962
|
*/
|