@elementumai/edk 0.8.2-alpha.6 → 0.9.5
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 +49 -37
- package/dist-sdk/elementum-entity-client/clients/agents/models/agent-tool.d.ts +3 -3
- package/dist-sdk/elementum-entity-client/clients/aspects/models/index.d.ts +1 -1
- package/dist-sdk/elementum-entity-client/clients/aspects/models/picklist-config.d.ts +3 -11
- package/dist-sdk/elementum-entity-client/clients/automation/models/automation.d.ts +3 -11
- package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.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/fs/entity.d.ts +2 -2
- package/dist-sdk/fs/entity.js +1 -1
- package/dist-sdk/pull/missing-report.d.ts +81 -0
- package/dist-sdk/pull/missing-report.js +52 -0
- 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 +96 -23
- package/dist-sdk/src/catalog/factories.js +141 -21
- package/dist-sdk/src/catalog/from-authoring.d.ts +5 -5
- package/dist-sdk/src/catalog/from-authoring.js +20 -10
- 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 +63 -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 +8 -2
- package/dist-sdk/src/catalog/token.js +18 -4
- package/dist-sdk/src/catalog/types.d.ts +64 -24
- package/dist-sdk/src/catalog/types.js +12 -4
- package/dist-sdk/src/core/app-to-ui.d.ts +6 -6
- package/dist-sdk/src/core/app-to-ui.js +7 -9
- package/dist-sdk/src/core/index.d.ts +11 -10
- package/dist-sdk/src/core/index.js +10 -9
- package/dist-sdk/src/core/platform-id.d.ts +11 -0
- package/dist-sdk/src/core/platform-id.js +8 -0
- package/dist-sdk/src/{entities/flow/activities/render-catalog.d.ts → core/render-tree.d.ts} +3 -3
- package/dist-sdk/src/{entities/flow/activities/render-catalog.js → core/render-tree.js} +7 -10
- 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 +78 -52
- package/dist-sdk/src/core/types/app.js +2 -3
- 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 +23 -16
- package/dist-sdk/src/engine/entity.d.ts +1 -1
- package/dist-sdk/src/engine/pull/attrs.d.ts +4 -0
- package/dist-sdk/src/engine/pull/attrs.js +17 -0
- package/dist-sdk/src/engine/pull/context.d.ts +73 -0
- package/dist-sdk/src/engine/pull/context.js +14 -0
- package/dist-sdk/src/engine/pull/org.d.ts +10 -0
- package/dist-sdk/src/engine/pull/org.js +35 -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 +7 -3
- package/dist-sdk/src/engine/tf/expr.js +27 -15
- 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/engine/workspace/authoring-layout.js +4 -2
- package/dist-sdk/src/entities/access-policy/build.d.ts +6 -16
- package/dist-sdk/src/entities/access-policy/build.js +2 -2
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +14 -40
- package/dist-sdk/src/entities/access-policy/from-tf.js +26 -85
- package/dist-sdk/src/entities/access-policy/principal.d.ts +39 -0
- package/dist-sdk/src/entities/access-policy/principal.js +13 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +33 -6
- package/dist-sdk/src/entities/access-policy/to-tf.js +62 -60
- package/dist-sdk/src/entities/agent/build.d.ts +42 -11
- package/dist-sdk/src/entities/agent/build.js +40 -19
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +11 -1
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +180 -45
- package/dist-sdk/src/entities/agent/from-tf.d.ts +3 -1
- package/dist-sdk/src/entities/agent/from-tf.js +17 -12
- package/dist-sdk/src/entities/agent/index.d.ts +5 -2
- package/dist-sdk/src/entities/agent/index.js +4 -2
- package/dist-sdk/src/entities/agent/module.js +7 -2
- package/dist-sdk/src/entities/agent/run-as.d.ts +16 -0
- package/dist-sdk/src/entities/agent/run-as.js +1 -0
- package/dist-sdk/src/entities/agent/to-tf.d.ts +6 -2
- package/dist-sdk/src/entities/agent/to-tf.js +58 -9
- package/dist-sdk/src/entities/agent/tools.d.ts +97 -70
- package/dist-sdk/src/entities/agent/tools.js +63 -43
- package/dist-sdk/src/entities/agent-a2a-skill/from-tf.js +1 -1
- package/dist-sdk/src/entities/agent-a2a-skill/to-tf.js +4 -4
- 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 +25 -15
- package/dist-sdk/src/entities/agent-tool/from-tf.js +175 -43
- package/dist-sdk/src/entities/agent-tool/module.js +6 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +15 -7
- package/dist-sdk/src/entities/agent-tool/to-tf.js +169 -48
- package/dist-sdk/src/entities/agent-tool/types.d.ts +4 -6
- package/dist-sdk/src/entities/agent-tool/types.js +30 -29
- package/dist-sdk/src/entities/app/build.d.ts +214 -47
- package/dist-sdk/src/entities/app/build.js +128 -66
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +188 -8
- package/dist-sdk/src/entities/app/deserializer/pulled-expression.d.ts +59 -0
- package/dist-sdk/src/entities/app/deserializer/pulled-expression.js +70 -0
- package/dist-sdk/src/entities/app/display-blocks.d.ts +2 -1
- package/dist-sdk/src/entities/app/display-blocks.js +1 -1
- package/dist-sdk/src/entities/app/from-tf.d.ts +11 -1
- package/dist-sdk/src/entities/app/from-tf.js +30 -2
- package/dist-sdk/src/entities/app/index.d.ts +20 -8
- package/dist-sdk/src/entities/app/index.js +16 -6
- package/dist-sdk/src/entities/app/module.js +29 -4
- package/dist-sdk/src/entities/app/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/app/to-tf.js +97 -7
- package/dist-sdk/src/entities/approval-chain/build.d.ts +31 -16
- package/dist-sdk/src/entities/approval-chain/build.js +49 -49
- package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +17 -0
- package/dist-sdk/src/entities/approval-chain/from-tf.js +57 -0
- package/dist-sdk/src/entities/approval-chain/index.d.ts +2 -3
- package/dist-sdk/src/entities/approval-chain/index.js +2 -3
- package/dist-sdk/src/entities/approval-chain/module.d.ts +3 -0
- package/dist-sdk/src/entities/approval-chain/module.js +51 -0
- package/dist-sdk/src/entities/approval-chain/printer.d.ts +2 -0
- package/dist-sdk/src/entities/approval-chain/printer.js +21 -0
- package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +9 -0
- package/dist-sdk/src/entities/approval-chain/to-tf.js +43 -0
- package/dist-sdk/src/entities/automation/build.d.ts +177 -95
- package/dist-sdk/src/entities/automation/build.js +164 -72
- 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 +18 -9
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +18 -14
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +214 -311
- package/dist-sdk/src/entities/automation/filter.d.ts +1 -115
- package/dist-sdk/src/entities/automation/filter.js +1 -197
- package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -0
- package/dist-sdk/src/entities/automation/from-tf.js +695 -182
- package/dist-sdk/src/entities/automation/index.d.ts +9 -10
- package/dist-sdk/src/entities/automation/index.js +11 -11
- package/dist-sdk/src/entities/automation/module.js +82 -8
- 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 +107 -28
- package/dist-sdk/src/entities/automation/serialize.js +1 -1
- package/dist-sdk/src/entities/automation/tasks.d.ts +167 -102
- package/dist-sdk/src/entities/automation/tasks.js +66 -13
- package/dist-sdk/src/entities/automation/to-tf.d.ts +44 -3
- package/dist-sdk/src/entities/automation/to-tf.js +607 -161
- package/dist-sdk/src/entities/automation/triggers.d.ts +33 -25
- package/dist-sdk/src/entities/automation/triggers.js +8 -2
- 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 +44 -0
- package/dist-sdk/src/entities/dashboard/build.js +16 -0
- package/dist-sdk/src/entities/dashboard/from-tf.d.ts +12 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +113 -0
- package/dist-sdk/src/entities/dashboard/module.d.ts +3 -0
- package/dist-sdk/src/entities/dashboard/module.js +16 -0
- package/dist-sdk/src/entities/dashboard/to-tf.d.ts +43 -0
- package/dist-sdk/src/entities/dashboard/to-tf.js +121 -0
- package/dist-sdk/src/entities/dashboard-widget/module.d.ts +3 -0
- package/dist-sdk/src/entities/dashboard-widget/module.js +10 -0
- package/dist-sdk/src/entities/data-lookup/module.d.ts +3 -0
- package/dist-sdk/src/entities/data-lookup/module.js +22 -0
- package/dist-sdk/src/entities/datamine/build.d.ts +22 -0
- package/dist-sdk/src/entities/datamine/from-tf.d.ts +17 -0
- package/dist-sdk/src/entities/datamine/from-tf.js +98 -0
- package/dist-sdk/src/entities/datamine/module.d.ts +3 -0
- package/dist-sdk/src/entities/datamine/module.js +23 -0
- package/dist-sdk/src/entities/datamine/to-tf.d.ts +11 -0
- package/dist-sdk/src/entities/datamine/to-tf.js +53 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +304 -0
- package/dist-sdk/src/entities/dynamic-layout/build.js +4 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +4 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.js +47 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +10 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +239 -0
- package/dist-sdk/src/entities/dynamic-layout/module.d.ts +3 -0
- package/dist-sdk/src/entities/dynamic-layout/module.js +13 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +26 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +267 -0
- package/dist-sdk/src/entities/element/build.d.ts +48 -38
- package/dist-sdk/src/entities/element/build.js +24 -33
- package/dist-sdk/src/entities/element/from-tf.d.ts +9 -1
- package/dist-sdk/src/entities/element/from-tf.js +31 -2
- package/dist-sdk/src/entities/element/index.d.ts +14 -7
- package/dist-sdk/src/entities/element/index.js +11 -5
- package/dist-sdk/src/entities/element/module.js +26 -5
- package/dist-sdk/src/entities/element/to-tf.d.ts +2 -1
- package/dist-sdk/src/entities/element/to-tf.js +64 -4
- package/dist-sdk/src/entities/field/build.d.ts +55 -27
- 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.d.ts +6 -0
- package/dist-sdk/src/entities/field/calculation-types.js +49 -0
- package/dist-sdk/src/entities/field/from-tf.js +238 -13
- 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.d.ts +1 -0
- package/dist-sdk/src/entities/field/module.js +27 -7
- package/dist-sdk/src/entities/field/record-shape.d.ts +25 -11
- package/dist-sdk/src/entities/field/to-tf.d.ts +41 -2
- package/dist-sdk/src/entities/field/to-tf.js +314 -40
- package/dist-sdk/src/entities/field/types.d.ts +1 -1
- package/dist-sdk/src/entities/field/types.js +10 -1
- package/dist-sdk/src/entities/file-reader/build.d.ts +71 -19
- package/dist-sdk/src/entities/file-reader/build.js +49 -4
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +1 -0
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +12 -10
- package/dist-sdk/src/entities/file-reader/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/file-reader/from-tf.js +31 -2
- package/dist-sdk/src/entities/file-reader/index.d.ts +3 -3
- package/dist-sdk/src/entities/file-reader/index.js +3 -3
- package/dist-sdk/src/entities/file-reader/module.js +6 -5
- package/dist-sdk/src/entities/file-reader/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/file-reader/to-tf.js +5 -2
- package/dist-sdk/src/entities/file-reader/types.d.ts +3 -4
- package/dist-sdk/src/entities/file-reader/types.js +4 -5
- package/dist-sdk/src/entities/org/category.js +4 -5
- 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/group.js +4 -5
- package/dist-sdk/src/entities/org/index.d.ts +2 -0
- package/dist-sdk/src/entities/org/index.js +2 -0
- package/dist-sdk/src/entities/org/phone-provider.d.ts +4 -0
- package/dist-sdk/src/entities/org/phone-provider.js +30 -0
- package/dist-sdk/src/entities/org/role.d.ts +3 -3
- package/dist-sdk/src/entities/org/role.js +9 -6
- package/dist-sdk/src/entities/organization/build.d.ts +241 -0
- package/dist-sdk/src/entities/organization/build.js +165 -0
- package/dist-sdk/src/entities/organization/index.d.ts +2 -0
- package/dist-sdk/src/entities/organization/index.js +2 -0
- package/dist-sdk/src/entities/organization/module.d.ts +2 -0
- package/dist-sdk/src/entities/organization/module.js +21 -0
- package/dist-sdk/src/entities/organization/to-tf.d.ts +7 -0
- package/dist-sdk/src/entities/organization/to-tf.js +154 -0
- package/dist-sdk/src/entities/phone-service/build.d.ts +17 -0
- package/dist-sdk/src/entities/phone-service/build.js +31 -0
- package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.d.ts +4 -0
- package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +56 -0
- package/dist-sdk/src/entities/phone-service/from-tf.d.ts +25 -0
- package/dist-sdk/src/entities/phone-service/from-tf.js +75 -0
- package/dist-sdk/src/entities/phone-service/index.d.ts +2 -0
- package/dist-sdk/src/entities/phone-service/index.js +2 -0
- package/dist-sdk/src/entities/phone-service/module.d.ts +3 -0
- package/dist-sdk/src/entities/phone-service/module.js +55 -0
- package/dist-sdk/src/entities/phone-service/to-tf.d.ts +12 -0
- package/dist-sdk/src/entities/phone-service/to-tf.js +54 -0
- package/dist-sdk/src/entities/phone-service/types.d.ts +35 -0
- package/dist-sdk/src/entities/phone-service/types.js +22 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.js +74 -0
- package/dist-sdk/src/entities/record-create-form/module.d.ts +11 -0
- package/dist-sdk/src/entities/record-create-form/module.js +24 -0
- package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +33 -0
- package/dist-sdk/src/entities/record-create-form/to-tf.js +88 -0
- package/dist-sdk/src/entities/relationship/build.d.ts +16 -0
- package/dist-sdk/src/entities/relationship/build.js +1 -0
- package/dist-sdk/src/entities/relationship/from-tf.d.ts +12 -0
- package/dist-sdk/src/entities/relationship/from-tf.js +109 -0
- package/dist-sdk/src/entities/relationship/module.d.ts +3 -0
- package/dist-sdk/src/entities/relationship/module.js +16 -0
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +32 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +145 -0
- package/dist-sdk/src/entities/role/build.d.ts +65 -0
- package/dist-sdk/src/entities/role/build.js +33 -0
- package/dist-sdk/src/entities/role/from-tf.d.ts +13 -0
- package/dist-sdk/src/entities/role/from-tf.js +138 -0
- package/dist-sdk/src/entities/role/to-tf.d.ts +13 -0
- package/dist-sdk/src/entities/role/to-tf.js +69 -0
- package/dist-sdk/src/entities/search-table/build.d.ts +67 -28
- package/dist-sdk/src/entities/search-table/build.js +110 -56
- package/dist-sdk/src/entities/search-table/from-tf.d.ts +37 -0
- package/dist-sdk/src/entities/search-table/from-tf.js +113 -0
- 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/module.js +88 -10
- package/dist-sdk/src/entities/search-table/printer.d.ts +2 -0
- package/dist-sdk/src/entities/search-table/printer.js +52 -0
- package/dist-sdk/src/entities/search-table/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/search-table/to-tf.js +104 -0
- package/dist-sdk/src/entities/search-table/types.d.ts +8 -0
- package/dist-sdk/src/entities/search-table/types.js +21 -0
- package/dist-sdk/src/entities/service-account/build.d.ts +32 -0
- package/dist-sdk/src/entities/service-account/build.js +9 -0
- package/dist-sdk/src/entities/service-account/from-tf.d.ts +10 -0
- package/dist-sdk/src/entities/service-account/from-tf.js +109 -0
- package/dist-sdk/src/entities/service-account/module.d.ts +4 -0
- package/dist-sdk/src/entities/service-account/module.js +21 -0
- package/dist-sdk/src/entities/service-account/ref.d.ts +11 -0
- package/dist-sdk/src/entities/service-account/ref.js +5 -0
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +32 -0
- package/dist-sdk/src/entities/service-account/to-tf.js +103 -0
- package/dist-sdk/src/entities/shared/connector-from-tf.d.ts +14 -0
- package/dist-sdk/src/entities/shared/connector-from-tf.js +14 -0
- 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 +30 -81
- package/dist-sdk/src/entities/shared/filters/ast.js +6 -2
- package/dist-sdk/src/entities/shared/filters/index.d.ts +95 -206
- package/dist-sdk/src/entities/shared/filters/index.js +196 -341
- package/dist-sdk/src/entities/shared/filters/print.d.ts +11 -0
- package/dist-sdk/src/entities/shared/filters/print.js +122 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +170 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +527 -0
- package/dist-sdk/src/entities/shared/filters/types.d.ts +66 -69
- package/dist-sdk/src/entities/shared/filters/types.js +2 -3
- 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 +4 -4
- package/dist-sdk/src/entities/skill/build.js +6 -5
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +11 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +100 -39
- package/dist-sdk/src/entities/skill/index.d.ts +3 -2
- package/dist-sdk/src/entities/skill/index.js +3 -2
- package/dist-sdk/src/entities/skill/module.js +8 -2
- package/dist-sdk/src/entities/skill/to-tf.d.ts +6 -2
- package/dist-sdk/src/entities/skill/to-tf.js +20 -2
- package/dist-sdk/src/entities/skill/tools.d.ts +47 -31
- package/dist-sdk/src/entities/skill/tools.js +37 -23
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +17 -1
- package/dist-sdk/src/entities/skill-tool/from-tf.js +118 -8
- package/dist-sdk/src/entities/skill-tool/module.js +9 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +6 -1
- package/dist-sdk/src/entities/skill-tool/to-tf.js +100 -48
- package/dist-sdk/src/entities/skill-tool/types.js +18 -1
- package/dist-sdk/src/entities/table/build.d.ts +64 -23
- package/dist-sdk/src/entities/table/build.js +41 -26
- package/dist-sdk/src/entities/table/catalog-render.js +15 -1
- package/dist-sdk/src/entities/table/deserializer/normalize.d.ts +99 -0
- package/dist-sdk/src/entities/table/deserializer/normalize.js +192 -0
- package/dist-sdk/src/entities/table/fields/types.d.ts +86 -0
- package/dist-sdk/src/entities/table/fields/types.js +12 -0
- package/dist-sdk/src/entities/table/fields.d.ts +107 -47
- package/dist-sdk/src/entities/table/fields.js +76 -55
- package/dist-sdk/src/entities/table/from-tf.d.ts +4 -0
- package/dist-sdk/src/entities/table/from-tf.js +261 -0
- package/dist-sdk/src/entities/table/index.d.ts +7 -5
- package/dist-sdk/src/entities/table/index.js +7 -7
- package/dist-sdk/src/entities/table/joins.d.ts +22 -9
- package/dist-sdk/src/entities/table/joins.js +8 -16
- package/dist-sdk/src/entities/table/module.d.ts +2 -1
- package/dist-sdk/src/entities/table/module.js +13 -6
- package/dist-sdk/src/entities/table/to-tf.d.ts +10 -0
- package/dist-sdk/src/entities/table/to-tf.js +222 -0
- package/dist-sdk/src/entities/task/build.d.ts +43 -0
- package/dist-sdk/src/entities/task/build.js +17 -0
- package/dist-sdk/src/entities/task/from-tf.d.ts +28 -0
- package/dist-sdk/src/entities/task/from-tf.js +38 -0
- package/dist-sdk/src/entities/task/index.d.ts +1 -0
- package/dist-sdk/src/entities/task/index.js +1 -0
- package/dist-sdk/src/entities/task/module.d.ts +3 -0
- package/dist-sdk/src/entities/task/module.js +12 -0
- package/dist-sdk/src/entities/task/to-tf.d.ts +9 -0
- package/dist-sdk/src/entities/task/to-tf.js +49 -0
- 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.d.ts +7 -2
- package/dist-sdk/src/entities/view/from-tf.js +264 -30
- package/dist-sdk/src/entities/view/module.d.ts +6 -13
- package/dist-sdk/src/entities/view/module.js +12 -15
- 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 +56 -12
- package/dist-sdk/src/entities/view/to-tf.js +192 -20
- package/dist-sdk/src/entities/view/types.d.ts +8 -0
- package/dist-sdk/src/entities/view/types.js +46 -0
- package/dist-sdk/src/entities/visual-flow/build.d.ts +87 -0
- package/dist-sdk/src/entities/visual-flow/build.js +72 -0
- package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +49 -0
- package/dist-sdk/src/entities/visual-flow/from-tf.js +124 -0
- package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -0
- package/dist-sdk/src/entities/visual-flow/index.js +1 -0
- package/dist-sdk/src/entities/visual-flow/module.d.ts +3 -0
- package/dist-sdk/src/entities/visual-flow/module.js +41 -0
- package/dist-sdk/src/entities/visual-flow/printer.d.ts +8 -0
- package/dist-sdk/src/entities/visual-flow/printer.js +92 -0
- package/dist-sdk/src/entities/visual-flow/to-tf.d.ts +15 -0
- package/dist-sdk/src/entities/visual-flow/to-tf.js +97 -0
- package/dist-sdk/src/entities/widget/build.d.ts +55 -0
- package/dist-sdk/src/entities/widget/build.js +1 -0
- package/dist-sdk/src/entities/widget/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/widget/from-tf.js +209 -0
- package/dist-sdk/src/entities/widget/module.d.ts +3 -0
- package/dist-sdk/src/entities/widget/module.js +16 -0
- package/dist-sdk/src/entities/widget/to-tf.d.ts +45 -0
- package/dist-sdk/src/entities/widget/to-tf.js +206 -0
- package/dist-sdk/src/graph/deferred-catalog-render.d.ts +1 -1
- package/dist-sdk/src/graph/deferred-catalog-render.js +1 -1
- package/dist-sdk/src/graph/index.d.ts +12 -1
- package/dist-sdk/src/graph/index.js +8 -19
- package/dist-sdk/src/graph/modules.js +35 -1
- package/dist-sdk/src/graph/types.d.ts +106 -7
- 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 +5 -2
- package/package.json +39 -15
- package/dist-sdk/src/entities/access-policy/filter.d.ts +0 -61
- package/dist-sdk/src/entities/access-policy/filter.js +0 -83
- package/dist-sdk/src/entities/approval-chain/steps.d.ts +0 -24
- package/dist-sdk/src/entities/approval-chain/steps.js +0 -20
- package/dist-sdk/src/entities/flow/activities/agent.d.ts +0 -15
- package/dist-sdk/src/entities/flow/activities/agent.js +0 -29
- package/dist-sdk/src/entities/flow/activities/approval.d.ts +0 -9
- package/dist-sdk/src/entities/flow/activities/approval.js +0 -18
- package/dist-sdk/src/entities/flow/activities/automation.d.ts +0 -12
- package/dist-sdk/src/entities/flow/activities/automation.js +0 -22
- package/dist-sdk/src/entities/flow/activities/ctx.d.ts +0 -34
- package/dist-sdk/src/entities/flow/activities/ctx.js +0 -38
- package/dist-sdk/src/entities/flow/activities/form.d.ts +0 -22
- package/dist-sdk/src/entities/flow/activities/form.js +0 -36
- package/dist-sdk/src/entities/flow/activities/index.d.ts +0 -14
- package/dist-sdk/src/entities/flow/activities/index.js +0 -13
- package/dist-sdk/src/entities/flow/activities/input-refs.d.ts +0 -39
- package/dist-sdk/src/entities/flow/activities/input-refs.js +0 -19
- package/dist-sdk/src/entities/flow/activities/prompt-template.d.ts +0 -13
- package/dist-sdk/src/entities/flow/activities/prompt-template.js +0 -34
- package/dist-sdk/src/entities/flow/activities/types.d.ts +0 -33
- package/dist-sdk/src/entities/flow/build.d.ts +0 -38
- package/dist-sdk/src/entities/flow/build.js +0 -115
- package/dist-sdk/src/entities/flow/index.d.ts +0 -8
- package/dist-sdk/src/entities/flow/index.js +0 -7
- package/dist-sdk/src/entities/flow/serialize.d.ts +0 -51
- package/dist-sdk/src/entities/flow/serialize.js +0 -94
- package/dist-sdk/src/entities/flow/util.d.ts +0 -27
- package/dist-sdk/src/entities/flow/util.js +0 -38
- package/dist-sdk/src/entities/table/filter.d.ts +0 -41
- package/dist-sdk/src/entities/table/filter.js +0 -89
- /package/dist-sdk/src/entities/{flow/activities/types.js → datamine/build.js} +0 -0
|
@@ -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,24 +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";
|
|
37
|
+
import { printFilter as printCanonicalFilter } from "../../shared/filters/print.js";
|
|
38
|
+
import { UNRESOLVED_FIELD_MARKER } from "../../shared/ref.js";
|
|
36
39
|
import { UNRESOLVED_REFERENCE_MARKER } from "../filter.js";
|
|
40
|
+
import { unresolvedReferenceComment } from "../../../engine/pull/ref-only.js";
|
|
37
41
|
// ---------------------------------------------------------------------------
|
|
38
42
|
// Factory name mapping — v1 AST `factory` → v2 factory function name.
|
|
39
43
|
//
|
|
@@ -57,7 +61,7 @@ const TASK_FACTORY_V2 = {
|
|
|
57
61
|
aiTransform: "aiTransform",
|
|
58
62
|
documentModel: "readFile",
|
|
59
63
|
notification: "notification",
|
|
60
|
-
filterTask: "
|
|
64
|
+
filterTask: "filterAction",
|
|
61
65
|
runAutomation: "runAutomation",
|
|
62
66
|
findRelatedRecords: "findRelatedRecords",
|
|
63
67
|
recordFieldLocking: "recordFieldLocking",
|
|
@@ -111,9 +115,11 @@ function emptyImports() {
|
|
|
111
115
|
filterOps: new Set(),
|
|
112
116
|
factories: new Set(),
|
|
113
117
|
aliases: new Map(),
|
|
114
|
-
usesChildTask: false,
|
|
115
118
|
usesTemplate: false,
|
|
116
119
|
usesUnresolvedField: false,
|
|
120
|
+
usesUnsafePlatformId: false,
|
|
121
|
+
usesOrg: false,
|
|
122
|
+
usesScriptInput: false,
|
|
117
123
|
};
|
|
118
124
|
}
|
|
119
125
|
const DEFAULT_CTX = { ctxName: "ctx" };
|
|
@@ -123,7 +129,7 @@ const DEFAULT_CTX = { ctxName: "ctx" };
|
|
|
123
129
|
* with the automation's own const (`state.localIdentifier`, e.g. an
|
|
124
130
|
* automation file literally named "calculation" using the `calculation`
|
|
125
131
|
* task), importing it unaliased produces a duplicate-declaration error
|
|
126
|
-
* (`import { calculation }` + `const calculation =
|
|
132
|
+
* (`import { calculation }` + `const calculation = automation(...)`)
|
|
127
133
|
* and every call site resolves to the wrong binding. On collision, alias the
|
|
128
134
|
* import (`calculation as edkCalculation`) and return the alias so the
|
|
129
135
|
* generated call site and the import statement agree.
|
|
@@ -142,7 +148,7 @@ function trackFactory(name, state) {
|
|
|
142
148
|
/**
|
|
143
149
|
* Build a lambda parameter list, prefixing each name with `_` when its
|
|
144
150
|
* bare-word form doesn't appear in the body — same trick the v1 printer uses
|
|
145
|
-
* so an operator body that ignores its
|
|
151
|
+
* so an operator body that ignores its context still typechecks
|
|
146
152
|
* cleanly under `noUnusedParameters`.
|
|
147
153
|
*/
|
|
148
154
|
function lambdaParams(body, ...names) {
|
|
@@ -150,50 +156,63 @@ function lambdaParams(body, ...names) {
|
|
|
150
156
|
.map((n) => (new RegExp(`\\b${n}\\b`).test(body) ? n : `_${n}`))
|
|
151
157
|
.join(", ");
|
|
152
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
|
+
}
|
|
153
166
|
function printAutomation(ast, opts) {
|
|
154
167
|
// Computed up front (independent of trigger/task printing) so `trackFactory`
|
|
155
168
|
// can alias any factory whose v2 name collides with it before emitting a
|
|
156
169
|
// single call site.
|
|
157
170
|
const refName = opts.refName ?? (camelCase(ast.name) || ast.name);
|
|
171
|
+
const identifier = safeIdentifier(refName, "automation");
|
|
158
172
|
const state = {
|
|
159
173
|
imports: emptyImports(),
|
|
160
174
|
localIdentifier: refName,
|
|
175
|
+
unresolvedReferences: opts.unresolvedReferences ?? [],
|
|
161
176
|
...(opts.foreignAppRefNames !== undefined && { foreignAppRefNames: opts.foreignAppRefNames }),
|
|
177
|
+
...(opts.foreignElementRefNames !== undefined && { foreignElementRefNames: opts.foreignElementRefNames }),
|
|
162
178
|
};
|
|
163
179
|
const triggerCode = printTrigger(ast.trigger, state);
|
|
164
|
-
// The trigger/
|
|
165
|
-
// level inside the `
|
|
166
|
-
// 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()`.
|
|
167
183
|
const taskCodes = ast.tasks.map((t) => printTask(t, state, 2));
|
|
168
184
|
const outputsCode = printOutputs(ast, state);
|
|
169
|
-
// The `
|
|
185
|
+
// The `actions:` value is the `actions()` chain; collect its links so
|
|
170
186
|
// the final one can take the trailing comma that terminates the property.
|
|
171
187
|
const chain = [` .trigger(${triggerCode})`, ...taskCodes];
|
|
172
188
|
if (outputsCode)
|
|
173
189
|
chain.push(outputsCode);
|
|
174
190
|
const body = [];
|
|
175
|
-
body.push(`const ${
|
|
191
|
+
body.push(`const ${identifier} = automation({`);
|
|
176
192
|
body.push(` name: ${quote(ast.name)},`);
|
|
177
|
-
body.push(`
|
|
193
|
+
body.push(` revision: ${quote(ast.workflowRevision)},`);
|
|
178
194
|
if (ast.description !== undefined)
|
|
179
195
|
body.push(` description: ${quote(ast.description)},`);
|
|
180
196
|
if (ast.triggersOtherAutomations !== undefined) {
|
|
181
197
|
body.push(` triggersOtherAutomations: ${ast.triggersOtherAutomations},`);
|
|
182
198
|
}
|
|
183
|
-
body.push(`
|
|
184
|
-
|
|
185
|
-
|
|
199
|
+
body.push(` app: catalog.${opts.appRefName ?? ast.ownerHandle},`);
|
|
200
|
+
if (ast.serviceAccountName !== undefined) {
|
|
201
|
+
body.push(` serviceAccount: serviceAccountRef({ app: catalog.${opts.appRefName ?? ast.ownerHandle}, name: ${quote(ast.serviceAccountName)} }),`);
|
|
202
|
+
}
|
|
203
|
+
body.push(` status: automationStatus.${automationStatusKey(ast.status)},`);
|
|
204
|
+
body.push(` actions: actions()`);
|
|
186
205
|
body.push(`${chain.join("\n")},`);
|
|
187
206
|
body.push(`});`);
|
|
188
207
|
body.push("");
|
|
189
|
-
body.push(`export default ${
|
|
208
|
+
body.push(`export default ${identifier};`);
|
|
190
209
|
const header = renderHeader(ast, state.imports, opts);
|
|
191
210
|
return `${header}\n\n${body.join("\n")}\n`;
|
|
192
211
|
}
|
|
193
212
|
/**
|
|
194
213
|
* Emit the optional `.outputs((ctx) => ({ ... }))` chain link from the AST's
|
|
195
214
|
* automation-level output properties. Each value is a `RefExpr` — a ctx ref
|
|
196
|
-
* (`ctx.
|
|
215
|
+
* (`ctx.actions.x.y`) or a literal — rendered by the shared arg-value printer.
|
|
197
216
|
* Returns `""` when the automation declares no outputs (no chain link emitted).
|
|
198
217
|
*/
|
|
199
218
|
function printOutputs(ast, state) {
|
|
@@ -231,29 +250,35 @@ function renderHeader(ast, imports, _opts) {
|
|
|
231
250
|
// namespace. Import exactly what's used. A factory aliased by `trackFactory`
|
|
232
251
|
// (its v2 name collides with the automation's own const) prints as
|
|
233
252
|
// `name as alias` so the import and every call site agree.
|
|
234
|
-
const named = new Set(["
|
|
253
|
+
const named = new Set(["automationStatus", "automation", "actions"]);
|
|
254
|
+
if (ast.serviceAccountName !== undefined)
|
|
255
|
+
named.add("serviceAccountRef");
|
|
235
256
|
for (const f of imports.factories)
|
|
236
257
|
named.add(f);
|
|
237
|
-
if (imports.usesChildTask)
|
|
238
|
-
named.add("childTask");
|
|
239
258
|
if (imports.filterOps.size > 0)
|
|
240
259
|
named.add("filter");
|
|
260
|
+
if (imports.usesScriptInput)
|
|
261
|
+
named.add("ScriptInput");
|
|
241
262
|
const sortedSpecifiers = Array.from(named)
|
|
242
263
|
.sort()
|
|
243
264
|
.map((name) => {
|
|
265
|
+
if (name === "ScriptInput")
|
|
266
|
+
return "type ScriptInput";
|
|
244
267
|
const alias = imports.aliases.get(name);
|
|
245
268
|
return alias ? `${name} as ${alias}` : name;
|
|
246
269
|
});
|
|
247
270
|
lines.push(`import { ${sortedSpecifiers.join(", ")} } from "${sdkPackageSpecifier("automations")}";`);
|
|
248
|
-
if (imports.usesTemplate || imports.usesUnresolvedField) {
|
|
271
|
+
if (imports.usesTemplate || imports.usesUnresolvedField || imports.usesUnsafePlatformId) {
|
|
249
272
|
const coreNamed = [];
|
|
250
273
|
if (imports.usesTemplate)
|
|
251
274
|
coreNamed.push("template");
|
|
252
275
|
if (imports.usesUnresolvedField)
|
|
253
276
|
coreNamed.push("unresolvedField");
|
|
277
|
+
if (imports.usesUnsafePlatformId)
|
|
278
|
+
coreNamed.push("unsafePlatformId");
|
|
254
279
|
lines.push(`import { ${coreNamed.join(", ")} } from "${sdkPackageSpecifier("core")}";`);
|
|
255
280
|
}
|
|
256
|
-
lines.push(`import catalog from "@catalog";`);
|
|
281
|
+
lines.push(imports.usesOrg ? `import catalog, { org } from "@catalog";` : `import catalog from "@catalog";`);
|
|
257
282
|
return lines.join("\n");
|
|
258
283
|
}
|
|
259
284
|
// ---------------------------------------------------------------------------
|
|
@@ -312,12 +337,13 @@ function printTrigger(trigger, state) {
|
|
|
312
337
|
}
|
|
313
338
|
case "webhook": {
|
|
314
339
|
const webHook = trackFactory("webHook", state);
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
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}`];
|
|
318
344
|
if (trigger.customResponse)
|
|
319
345
|
parts.push(`customResponse: ${printCustomResponse(trigger.customResponse)}`);
|
|
320
|
-
return
|
|
346
|
+
return `${webHook}({\n ${parts.join(",\n ")}\n })`;
|
|
321
347
|
}
|
|
322
348
|
case "temporal": {
|
|
323
349
|
const temporal = trackFactory("temporal", state);
|
|
@@ -363,8 +389,16 @@ function printTrigger(trigger, state) {
|
|
|
363
389
|
}
|
|
364
390
|
case "dataMine": {
|
|
365
391
|
const dataMine = trackFactory("dataMine", state);
|
|
392
|
+
let datamine;
|
|
393
|
+
if (typeof trigger.datamine === "string") {
|
|
394
|
+
state.imports.usesUnsafePlatformId = true;
|
|
395
|
+
datamine = `unsafePlatformId(${quote(trigger.datamine)})${unresolvedReferenceComment(trigger.datamine, state.unresolvedReferences)}`;
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
datamine = printRef(trigger.datamine, state, DEFAULT_CTX);
|
|
399
|
+
}
|
|
366
400
|
const parts = [
|
|
367
|
-
`
|
|
401
|
+
`datamine: ${datamine}`,
|
|
368
402
|
];
|
|
369
403
|
if (trigger.fireOnAlert !== undefined) {
|
|
370
404
|
parts.push(`fireOnAlert: ${trigger.fireOnAlert}`);
|
|
@@ -418,7 +452,7 @@ function printFieldRef(appHandle, fieldKey) {
|
|
|
418
452
|
// Tasks
|
|
419
453
|
// ---------------------------------------------------------------------------
|
|
420
454
|
/**
|
|
421
|
-
* Trailing `, "Display Name"` arg for
|
|
455
|
+
* Trailing `, "Display Name"` arg for direct action calls — only
|
|
422
456
|
* emitted when the task's real wire name differs from its `refKey` (adopting
|
|
423
457
|
* a platform-authored task, e.g. "For Each" vs. the slugged refKey
|
|
424
458
|
* "For_Each"). Omitted otherwise so the common case stays two-arg.
|
|
@@ -431,36 +465,36 @@ function topLevelTaskTrailingArgs(task) {
|
|
|
431
465
|
return displayNameArg(task);
|
|
432
466
|
return `, ${task.displayName ? quote(task.displayName) : "undefined"}, ${quote(task.hclParent)}`;
|
|
433
467
|
}
|
|
434
|
-
function printTask(task, state, indent) {
|
|
468
|
+
function printTask(task, state, indent, refCtx = DEFAULT_CTX) {
|
|
435
469
|
const pad = " ".repeat(indent);
|
|
436
470
|
if (task.factory === "executeScript")
|
|
437
|
-
return formatExecuteScript(task, state, indent);
|
|
471
|
+
return formatExecuteScript(task, state, indent, refCtx);
|
|
438
472
|
if (task.factory === "forEach")
|
|
439
|
-
return formatForEach(task, state, indent);
|
|
473
|
+
return formatForEach(task, state, indent, refCtx);
|
|
440
474
|
if (task.factory === "switchTask")
|
|
441
|
-
return formatSwitch(task, state, indent);
|
|
475
|
+
return formatSwitch(task, state, indent, refCtx);
|
|
442
476
|
if (task.factory === "forkJoin")
|
|
443
|
-
return formatForkJoin(task, state, indent);
|
|
444
|
-
const
|
|
445
|
-
const args = printTaskArgs(task, state, indent + 1,
|
|
446
|
-
|
|
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)})`;
|
|
447
485
|
}
|
|
448
|
-
/**
|
|
449
|
-
|
|
450
|
-
* with function-form `code`. Nested operator bodies still print
|
|
451
|
-
* `childTask(..., executeScript({…}))` via {@link printChildTask}.
|
|
452
|
-
*/
|
|
453
|
-
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) {
|
|
454
488
|
const pad = " ".repeat(indent);
|
|
455
489
|
const configPad = " ".repeat(indent + 1);
|
|
456
490
|
const lines = [];
|
|
457
491
|
if (task.args.inputs !== undefined && task.args.inputs !== null && typeof task.args.inputs === "object") {
|
|
458
|
-
const obj = printObjectLiteral(task.args.inputs, state, indent + 1,
|
|
492
|
+
const obj = printObjectLiteral(task.args.inputs, state, indent + 1, refCtx);
|
|
459
493
|
lines.push(`${configPad}inputs: (${lambdaParams(obj, "ctx")}) => (${obj}),`);
|
|
460
494
|
}
|
|
461
495
|
const code = task.args.code ?? task.args.script;
|
|
462
496
|
if (typeof code === "string") {
|
|
463
|
-
lines.push(`${configPad}code: ${printScriptCodeFn(code, indent + 1)},`);
|
|
497
|
+
lines.push(`${configPad}code: ${printScriptCodeFn(code, indent + 1, state)},`);
|
|
464
498
|
}
|
|
465
499
|
if (task.args.outputs !== undefined && task.args.outputs !== null && typeof task.args.outputs === "object") {
|
|
466
500
|
lines.push(`${configPad}outputs: ${printObjectLiteral(task.args.outputs, state, indent + 1, DEFAULT_CTX)},`);
|
|
@@ -472,9 +506,9 @@ function formatExecuteScript(task, state, indent) {
|
|
|
472
506
|
lines.push(`${configPad}outputs: null,`);
|
|
473
507
|
}
|
|
474
508
|
if (lines.length === 0) {
|
|
475
|
-
return `${pad}.executeScript(${quote(task.refKey)}, {})`;
|
|
509
|
+
return `${pad}.executeScript(${quote(task.refKey)}, {}${topLevelTaskTrailingArgs(task)})`;
|
|
476
510
|
}
|
|
477
|
-
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)})`;
|
|
478
512
|
}
|
|
479
513
|
/**
|
|
480
514
|
* Wrap a platform script body as `(input) => { … }` for authoring / pull —
|
|
@@ -485,56 +519,57 @@ function formatExecuteScript(task, state, indent) {
|
|
|
485
519
|
* build time by `tryExtractFromCurrentSource` (`script-code.ts`), which reads
|
|
486
520
|
* this exact source text back out directly rather than trusting the
|
|
487
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.
|
|
488
534
|
*/
|
|
489
|
-
function printScriptCodeFn(body, indent) {
|
|
535
|
+
function printScriptCodeFn(body, indent, state) {
|
|
490
536
|
const pad = " ".repeat(indent);
|
|
491
537
|
const innerPad = " ".repeat(indent + 1);
|
|
492
538
|
const lines = body.replace(/\r\n/g, "\n").split("\n");
|
|
493
539
|
const indented = lines.map((line) => (line.length === 0 ? "" : `${innerPad}${line}`)).join("\n");
|
|
494
|
-
|
|
540
|
+
state.imports.usesScriptInput = true;
|
|
541
|
+
return `(input: ScriptInput<Record<string, unknown>>) => {\n${indented}\n${pad}}`;
|
|
495
542
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
function resolveTaskFactory(factory, state) {
|
|
502
|
-
const v2 = TASK_FACTORY_V2[factory];
|
|
503
|
-
if (v2) {
|
|
504
|
-
return trackFactory(v2, state);
|
|
505
|
-
}
|
|
506
|
-
// Unmappable (e.g. the deserializer's `__unknown`) — emit a clearly-marked
|
|
507
|
-
// placeholder so the file flags the gap rather than emitting invalid syntax.
|
|
508
|
-
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}`;
|
|
509
548
|
}
|
|
510
|
-
function formatForEach(task, state, indent) {
|
|
549
|
+
function formatForEach(task, state, indent, refCtx) {
|
|
511
550
|
const pad = " ".repeat(indent);
|
|
512
551
|
const configIndent = " ".repeat(indent + 1);
|
|
513
|
-
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
|
|
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
|
+
};
|
|
517
557
|
const children = task.children?.[0]?.tasks ?? [];
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
const tasksBlock = `(${lambdaParams(tbody, "item", "innerCtx")}) => ${tbody}`;
|
|
521
|
-
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)})`;
|
|
522
560
|
}
|
|
523
561
|
/**
|
|
524
|
-
* Renders a switch's `
|
|
525
|
-
* 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;
|
|
526
564
|
* anything else (e.g. a manual rename to "Default Path") is preserved via the
|
|
527
565
|
* `{ label, tasks }` object form so the build round trip reproduces it
|
|
528
566
|
* instead of hardcoding "Default".
|
|
529
567
|
*/
|
|
530
|
-
function
|
|
568
|
+
function formatDefaultActionsBlock(defaults, state, indent, configIndent, refCtx) {
|
|
531
569
|
const defaultTasks = defaults.flatMap((ch) => ch.tasks);
|
|
532
570
|
const defaultLabel = defaults.map((ch) => ch.defaultLabel).find((label) => label !== undefined);
|
|
533
571
|
const defaultFilterMode = defaults.map((ch) => ch.defaultFilterMode).find((mode) => mode !== undefined);
|
|
534
|
-
const
|
|
535
|
-
const defaultLines = defaultTasks.map((t) => printChildTask(t, state, indent + 2, innerCtx));
|
|
536
|
-
const dbody = defaultLines.length > 0 ? `[\n${defaultLines.join(",\n")}\n${configIndent}]` : `[]`;
|
|
537
|
-
const defaultFn = `(innerCtx: typeof ${ctxTypeName}) => ${dbody}`;
|
|
572
|
+
const defaultFn = formatNestedActions(defaultTasks, state, indent + 2, refCtx);
|
|
538
573
|
const needsLabel = defaultLabel !== undefined && defaultLabel !== "Default";
|
|
539
574
|
const needsFilterMode = defaultFilterMode === "explicitTrueFilter";
|
|
540
575
|
if (!needsLabel && !needsFilterMode)
|
|
@@ -543,29 +578,28 @@ function formatDefaultTasksBlock(defaults, state, indent, configIndent, ctxTypeN
|
|
|
543
578
|
const parts = [];
|
|
544
579
|
if (needsLabel)
|
|
545
580
|
parts.push(`${innerPad}label: ${quote(defaultLabel)}`);
|
|
546
|
-
parts.push(`${innerPad}
|
|
581
|
+
parts.push(`${innerPad}actions: ${defaultFn}`);
|
|
547
582
|
if (needsFilterMode)
|
|
548
583
|
parts.push(`${innerPad}defaultFilterMode: "explicitTrueFilter"`);
|
|
549
584
|
return `{\n${parts.join(",\n")},\n${configIndent}}`;
|
|
550
585
|
}
|
|
551
|
-
function formatSwitch(task, state, indent) {
|
|
586
|
+
function formatSwitch(task, state, indent, refCtx) {
|
|
552
587
|
const pad = " ".repeat(indent);
|
|
553
588
|
const configIndent = " ".repeat(indent + 1);
|
|
554
|
-
state.imports.usesChildTask = true;
|
|
555
|
-
const switchTask = trackFactory("switchTask", state);
|
|
556
589
|
const children = task.children ?? [];
|
|
557
590
|
const cases = children.filter((ch) => ch.label != null);
|
|
558
591
|
const defaults = children.filter((ch) => ch.label == null);
|
|
559
|
-
const
|
|
592
|
+
const branchCtx = { ctxName: "ctx", selfTaskRefKeys: refCtx.selfTaskRefKeys };
|
|
593
|
+
const caseLines = cases.map((ch) => formatSwitchCase(ch, state, indent + 2, branchCtx));
|
|
560
594
|
const configParts = [];
|
|
561
595
|
configParts.push(`${configIndent}cases: [\n${caseLines.join(",\n")}\n${configIndent}]`);
|
|
562
596
|
if (defaults.length > 0) {
|
|
563
|
-
const defaultBlock =
|
|
564
|
-
configParts.push(`${configIndent}
|
|
597
|
+
const defaultBlock = formatDefaultActionsBlock(defaults, state, indent, configIndent, branchCtx);
|
|
598
|
+
configParts.push(`${configIndent}defaultActions: ${defaultBlock}`);
|
|
565
599
|
}
|
|
566
|
-
return `${pad}.
|
|
600
|
+
return `${pad}.switch(${quote(task.refKey)}, (ctx) => ({\n${configParts.join(",\n")},\n${pad}})${topLevelTaskTrailingArgs(task)})`;
|
|
567
601
|
}
|
|
568
|
-
function formatSwitchCase(ch, state, indent,
|
|
602
|
+
function formatSwitchCase(ch, state, indent, refCtx) {
|
|
569
603
|
const pad = " ".repeat(indent);
|
|
570
604
|
const innerPad = " ".repeat(indent + 1);
|
|
571
605
|
const parts = [];
|
|
@@ -574,94 +608,22 @@ function formatSwitchCase(ch, state, indent, outerCtxName) {
|
|
|
574
608
|
// switch's outer scope; v2 takes it as a bare value (no `(app) =>` lambda).
|
|
575
609
|
if (ch.filter)
|
|
576
610
|
parts.push(`${innerPad}condition: ${printFilter(ch.filter, state)}`);
|
|
577
|
-
|
|
578
|
-
const taskLines = ch.tasks.map((t) => printChildTask(t, state, indent + 2, innerCtx));
|
|
579
|
-
const tbody = taskLines.length > 0 ? `[\n${taskLines.join(",\n")}\n${innerPad}]` : `[]`;
|
|
580
|
-
const taskBlock = `(innerCtx: typeof ${outerCtxName}) => ${tbody}`;
|
|
581
|
-
parts.push(`${innerPad}tasks: ${taskBlock}`);
|
|
611
|
+
parts.push(`${innerPad}actions: ${formatNestedActions(ch.tasks, state, indent + 2, refCtx)}`);
|
|
582
612
|
return `${pad}{\n${parts.join(",\n")},\n${pad}}`;
|
|
583
613
|
}
|
|
584
|
-
function formatForkJoin(task, state, indent) {
|
|
614
|
+
function formatForkJoin(task, state, indent, refCtx) {
|
|
585
615
|
const pad = " ".repeat(indent);
|
|
586
616
|
const configIndent = " ".repeat(indent + 1);
|
|
587
|
-
state.imports.usesChildTask = true;
|
|
588
|
-
const forkJoin = trackFactory("forkJoin", state);
|
|
589
617
|
const branches = task.children ?? [];
|
|
590
|
-
const
|
|
618
|
+
const branchCtx = { ctxName: "ctx", selfTaskRefKeys: refCtx.selfTaskRefKeys };
|
|
619
|
+
const branchLines = branches.map((ch) => formatForkJoinBranch(ch, state, indent + 2, branchCtx));
|
|
591
620
|
const branchesBlock = branchLines.length > 0 ? `[\n${branchLines.join(",\n")}\n${configIndent}]` : `[]`;
|
|
592
|
-
return `${pad}.
|
|
621
|
+
return `${pad}.forkJoin(${quote(task.refKey)}, {\n${configIndent}branches: ${branchesBlock},\n${pad}}${topLevelTaskTrailingArgs(task)})`;
|
|
593
622
|
}
|
|
594
|
-
function formatForkJoinBranch(ch, state, indent) {
|
|
623
|
+
function formatForkJoinBranch(ch, state, indent, refCtx) {
|
|
595
624
|
const pad = " ".repeat(indent);
|
|
596
625
|
const innerPad = " ".repeat(indent + 1);
|
|
597
|
-
|
|
598
|
-
const taskLines = ch.tasks.map((t) => printChildTask(t, state, indent + 2, innerCtx));
|
|
599
|
-
const tbody = taskLines.length > 0 ? `[\n${taskLines.join(",\n")}\n${innerPad}]` : `[]`;
|
|
600
|
-
const taskBlock = `(${lambdaParams(tbody, "innerCtx")}) => ${tbody}`;
|
|
601
|
-
return `${pad}{\n${innerPad}label: ${ch.label == null ? "null" : quote(ch.label)},\n${innerPad}tasks: ${taskBlock},\n${pad}}`;
|
|
602
|
-
}
|
|
603
|
-
/**
|
|
604
|
-
* Child-position task. `childTask(name, def)` takes a plain TaskDef (the
|
|
605
|
-
* factory call), not a `(ctx) =>` lambda — the enclosing operator body already
|
|
606
|
-
* bound a ctx (`innerCtx`), which refs inside resolve against. Nested
|
|
607
|
-
* operators recurse through dedicated child-position formatters so a forEach /
|
|
608
|
-
* switch / forkJoin inside another operator body renders its full child tree.
|
|
609
|
-
*/
|
|
610
|
-
function printChildTask(task, state, indent, refCtx) {
|
|
611
|
-
if (task.factory === "forEach")
|
|
612
|
-
return formatChildForEach(task, state, indent, refCtx);
|
|
613
|
-
if (task.factory === "switchTask")
|
|
614
|
-
return formatChildSwitch(task, state, indent, refCtx);
|
|
615
|
-
if (task.factory === "forkJoin")
|
|
616
|
-
return formatChildForkJoin(task, state, indent, refCtx);
|
|
617
|
-
state.imports.usesChildTask = true;
|
|
618
|
-
const factory = resolveTaskFactory(task.factory, state);
|
|
619
|
-
const pad = " ".repeat(indent);
|
|
620
|
-
const args = printTaskArgs(task, state, indent + 1, refCtx);
|
|
621
|
-
return `${pad}childTask(${quote(task.refKey)}, ${factory}(${args})${displayNameArg(task)})`;
|
|
622
|
-
}
|
|
623
|
-
function formatChildForEach(task, state, indent, refCtx) {
|
|
624
|
-
const pad = " ".repeat(indent);
|
|
625
|
-
const configIndent = " ".repeat(indent + 1);
|
|
626
|
-
state.imports.usesChildTask = true;
|
|
627
|
-
const forEach = trackFactory("forEach", state);
|
|
628
|
-
const collectionCode = printArgValue("collection", task.args.collection, state, indent + 1, refCtx);
|
|
629
|
-
const innerCtx = {
|
|
630
|
-
ctxName: "innerCtx",
|
|
631
|
-
selfTaskRefKeys: [...(refCtx.selfTaskRefKeys ?? []), task.refKey],
|
|
632
|
-
};
|
|
633
|
-
const children = task.children?.[0]?.tasks ?? [];
|
|
634
|
-
const childLines = children.map((c) => printChildTask(c, state, indent + 2, innerCtx));
|
|
635
|
-
const tbody = childLines.length > 0 ? `[\n${childLines.join(",\n")}\n${configIndent}]` : `[]`;
|
|
636
|
-
const tasksBlock = `(${lambdaParams(tbody, "item", "innerCtx")}) => ${tbody}`;
|
|
637
|
-
return `${pad}childTask(${quote(task.refKey)}, ${forEach}(${refCtx.ctxName}, {\n${configIndent}collection: ${collectionCode},\n${configIndent}tasks: ${tasksBlock},\n${pad}})${displayNameArg(task)})`;
|
|
638
|
-
}
|
|
639
|
-
function formatChildSwitch(task, state, indent, refCtx) {
|
|
640
|
-
const pad = " ".repeat(indent);
|
|
641
|
-
const configIndent = " ".repeat(indent + 1);
|
|
642
|
-
state.imports.usesChildTask = true;
|
|
643
|
-
const switchTask = trackFactory("switchTask", state);
|
|
644
|
-
const children = task.children ?? [];
|
|
645
|
-
const cases = children.filter((ch) => ch.label != null);
|
|
646
|
-
const defaults = children.filter((ch) => ch.label == null);
|
|
647
|
-
const caseLines = cases.map((ch) => formatSwitchCase(ch, state, indent + 2, refCtx.ctxName));
|
|
648
|
-
const configParts = [];
|
|
649
|
-
configParts.push(`${configIndent}cases: [\n${caseLines.join(",\n")}\n${configIndent}]`);
|
|
650
|
-
if (defaults.length > 0) {
|
|
651
|
-
const defaultBlock = formatDefaultTasksBlock(defaults, state, indent, configIndent, refCtx.ctxName);
|
|
652
|
-
configParts.push(`${configIndent}defaultTasks: ${defaultBlock}`);
|
|
653
|
-
}
|
|
654
|
-
return `${pad}childTask(${quote(task.refKey)}, ${switchTask}(${refCtx.ctxName}, {\n${configParts.join(",\n")},\n${pad}})${displayNameArg(task)})`;
|
|
655
|
-
}
|
|
656
|
-
function formatChildForkJoin(task, state, indent, refCtx) {
|
|
657
|
-
const pad = " ".repeat(indent);
|
|
658
|
-
const configIndent = " ".repeat(indent + 1);
|
|
659
|
-
state.imports.usesChildTask = true;
|
|
660
|
-
const forkJoin = trackFactory("forkJoin", state);
|
|
661
|
-
const branches = task.children ?? [];
|
|
662
|
-
const branchLines = branches.map((ch) => formatForkJoinBranch(ch, state, indent + 2));
|
|
663
|
-
const branchesBlock = branchLines.length > 0 ? `[\n${branchLines.join(",\n")}\n${configIndent}]` : `[]`;
|
|
664
|
-
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}}`;
|
|
665
627
|
}
|
|
666
628
|
// ---------------------------------------------------------------------------
|
|
667
629
|
// Task args
|
|
@@ -676,7 +638,7 @@ function formatChildForkJoin(task, state, indent, refCtx) {
|
|
|
676
638
|
*/
|
|
677
639
|
function printTaskArgs(task, state, indent, refCtx) {
|
|
678
640
|
const renames = ARG_RENAMES[task.factory] ?? {};
|
|
679
|
-
const appHandle = taskPrimaryAppHandle(task.args);
|
|
641
|
+
const appHandle = taskPrimaryAppHandle(task.args, state);
|
|
680
642
|
const pad = " ".repeat(indent);
|
|
681
643
|
const lines = [];
|
|
682
644
|
for (const [k, v] of Object.entries(task.args)) {
|
|
@@ -702,8 +664,8 @@ function printTaskArgs(task, state, indent, refCtx) {
|
|
|
702
664
|
* Render the v2 `fields: [{ field, value }]` array from the v1 AST's
|
|
703
665
|
* `values: { <fieldKey>: <RefExpr> }` map. Field keys become catalog handle
|
|
704
666
|
* tokens off the task's app (`<appHandle>.fields.<key>`); an unresolved field
|
|
705
|
-
* key (`
|
|
706
|
-
*
|
|
667
|
+
* key (`UNRESOLVED_FIELD_MARKER + <uuid>`) is preserved through the explicit
|
|
668
|
+
* `unsafePlatformId` escape hatch so a non-recursive pull remains buildable.
|
|
707
669
|
*/
|
|
708
670
|
function printFieldAssignments(values, appHandle, state, indent, refCtx) {
|
|
709
671
|
if (!values || typeof values !== "object" || Array.isArray(values))
|
|
@@ -715,12 +677,15 @@ function printFieldAssignments(values, appHandle, state, indent, refCtx) {
|
|
|
715
677
|
const inner = " ".repeat(indent + 1);
|
|
716
678
|
const lines = entries.map(([fieldKey, value]) => {
|
|
717
679
|
let fieldExpr;
|
|
718
|
-
if (appHandle && !fieldKey.startsWith(
|
|
680
|
+
if (appHandle && !fieldKey.startsWith(UNRESOLVED_FIELD_MARKER)) {
|
|
719
681
|
fieldExpr = `catalog.${appHandle}.fields${safeMember(fieldKey)}`;
|
|
720
682
|
}
|
|
721
683
|
else {
|
|
722
|
-
const uuid = fieldKey.
|
|
723
|
-
|
|
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)})`;
|
|
724
689
|
}
|
|
725
690
|
const valueExpr = printArgValue("", value, state, indent + 2, refCtx);
|
|
726
691
|
return `${inner}{ field: ${fieldExpr}, value: ${valueExpr} },`;
|
|
@@ -731,11 +696,16 @@ function printFieldAssignments(values, appHandle, state, indent, refCtx) {
|
|
|
731
696
|
* The task's primary app handle, used to resolve `values:` field keys to
|
|
732
697
|
* `<appHandle>.fields.<key>` tokens. Reads the `app` / `relatedApp` arg.
|
|
733
698
|
*/
|
|
734
|
-
function taskPrimaryAppHandle(args) {
|
|
699
|
+
function taskPrimaryAppHandle(args, state) {
|
|
735
700
|
for (const k of ["app", "relatedApp"]) {
|
|
736
701
|
const v = args[k];
|
|
737
|
-
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;
|
|
738
707
|
return v.appHandle;
|
|
708
|
+
}
|
|
739
709
|
}
|
|
740
710
|
return undefined;
|
|
741
711
|
}
|
|
@@ -743,13 +713,17 @@ function taskPrimaryAppHandle(args) {
|
|
|
743
713
|
// Argument value printer — dispatches on runtime shape
|
|
744
714
|
// ---------------------------------------------------------------------------
|
|
745
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
|
+
}
|
|
746
720
|
if (isRefExpr(value))
|
|
747
721
|
return printRef(value, state, refCtx);
|
|
748
|
-
if (
|
|
722
|
+
if (isFilter(value))
|
|
749
723
|
return printFilter(value, state);
|
|
750
724
|
// executeScript body (AST key `code`, legacy `script`) — always function form.
|
|
751
725
|
if ((name === "code" || name === "script") && typeof value === "string") {
|
|
752
|
-
return printScriptCodeFn(value, indent);
|
|
726
|
+
return printScriptCodeFn(value, indent, state);
|
|
753
727
|
}
|
|
754
728
|
if (Array.isArray(value) && value.length > 0 && isSort(value[0])) {
|
|
755
729
|
return printSortArray(value, state, refCtx);
|
|
@@ -762,6 +736,9 @@ function printArgValue(name, value, state, indent, refCtx) {
|
|
|
762
736
|
}
|
|
763
737
|
return literalJson(value);
|
|
764
738
|
}
|
|
739
|
+
function isPulledRawCalculation(value) {
|
|
740
|
+
return !!value && typeof value === "object" && value.kind === "calculationRaw";
|
|
741
|
+
}
|
|
765
742
|
// ---------------------------------------------------------------------------
|
|
766
743
|
// RefExpr printer — emits v2 ctx refs + catalog handle-tokens
|
|
767
744
|
// ---------------------------------------------------------------------------
|
|
@@ -776,7 +753,7 @@ function printRef(ref, state, refCtx) {
|
|
|
776
753
|
return literalJson(ref.value);
|
|
777
754
|
case "taskRef": {
|
|
778
755
|
if (refCtx.selfTaskRefKeys?.includes(ref.task)) {
|
|
779
|
-
// `ctx.
|
|
756
|
+
// `ctx.actions` is a permissive runtime Proxy — `.For_Each` (or any
|
|
780
757
|
// key) always resolves to a working ref proxy, so this stays
|
|
781
758
|
// runtime-identical to an ordinary task ref. Only `TTasks` doesn't
|
|
782
759
|
// know about a forEach's own name inside its own body (it's typed
|
|
@@ -784,15 +761,15 @@ function printRef(ref, state, refCtx) {
|
|
|
784
761
|
// goes on the receiver — never on a literal `undefined` — to avoid
|
|
785
762
|
// suppressing the type error by introducing a real one at runtime.
|
|
786
763
|
const path = ref.path.map(safeMember).join("");
|
|
787
|
-
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}`;
|
|
788
765
|
}
|
|
789
766
|
// `result.<prop>` segments are output-schema property names — typed,
|
|
790
767
|
// legitimate — so print them with plain dot/bracket access; only record
|
|
791
768
|
// paths keep the unresolved-key as-any heuristic.
|
|
792
769
|
if (ref.path[0] === "result") {
|
|
793
|
-
return `${ctxName}.
|
|
770
|
+
return `${ctxName}.actions${safeMember(ref.task)}` + ref.path.map(safeMember).join("");
|
|
794
771
|
}
|
|
795
|
-
return printPathAccess(`${ctxName}.
|
|
772
|
+
return printPathAccess(`${ctxName}.actions${safeMember(ref.task)}`, ref.path);
|
|
796
773
|
}
|
|
797
774
|
case "triggerRef": {
|
|
798
775
|
// A bare `record.<unresolved-id>` path (no trailing sub-path) — the
|
|
@@ -818,10 +795,10 @@ function printRef(ref, state, refCtx) {
|
|
|
818
795
|
return printPathAccess(`${ctxName}.trigger${safeMember(head)}`, rest);
|
|
819
796
|
}
|
|
820
797
|
case "forEachRef":
|
|
821
|
-
return printPathAccess(`${ctxName}.
|
|
798
|
+
return printPathAccess(`${ctxName}.actions${safeMember(ref.forEachTask)}`, ref.path);
|
|
822
799
|
case "forEachItemRef": {
|
|
823
800
|
const path = ref.path.map(safeMember).join("");
|
|
824
|
-
return
|
|
801
|
+
return `${ctxName}.item${path}`;
|
|
825
802
|
}
|
|
826
803
|
case "variableParamRef":
|
|
827
804
|
return `${ctxName}.variables${safeMember(ref.varTask)}${safeMember(ref.name)}`;
|
|
@@ -848,12 +825,14 @@ function printRef(ref, state, refCtx) {
|
|
|
848
825
|
// pulled into this workspace (board issue #40, app-only) resolves to a
|
|
849
826
|
// typed token; otherwise a literal stub (field type is unconfirmed —
|
|
850
827
|
// ei's `elementum_field` data source doesn't expose it).
|
|
851
|
-
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);
|
|
852
831
|
if (foreignRefName !== undefined)
|
|
853
832
|
return `catalog.${foreignRefName}.fields${safeMember(ref.fieldKey)}`;
|
|
854
833
|
return (`{ __kind: "field", refName: ${quote(ref.fieldKey)}, name: ${quote(ref.foreign.fieldName ?? ref.fieldKey)}, fieldType: "TEXT", ` +
|
|
855
834
|
`parent: ${quote(ref.appHandle)}, parentKind: ${quote(ref.foreign.entityType)}, parentName: ${quote(ref.foreign.name)} } ` +
|
|
856
|
-
|
|
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}" */`);
|
|
857
836
|
}
|
|
858
837
|
case "userField":
|
|
859
838
|
return `catalog.users.fields${safeMember(ref.fieldKey)}`;
|
|
@@ -861,10 +840,9 @@ function printRef(ref, state, refCtx) {
|
|
|
861
840
|
if (ref.entityType === undefined || ref.name === undefined) {
|
|
862
841
|
return `catalog.${ref.appHandle}`;
|
|
863
842
|
}
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
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);
|
|
868
846
|
if (foreignRefName !== undefined)
|
|
869
847
|
return `catalog.${foreignRefName}`;
|
|
870
848
|
return `{ __kind: ${quote(ref.entityType)}, refName: ${quote(ref.appHandle)}, name: ${quote(ref.name)} }`;
|
|
@@ -873,6 +851,19 @@ function printRef(ref, state, refCtx) {
|
|
|
873
851
|
return `catalog.${ref.appHandle}.agents${safeMember(ref.agentKey)}`;
|
|
874
852
|
case "automation":
|
|
875
853
|
return `catalog.${ref.appHandle}.automations${safeMember(ref.automationKey)}`;
|
|
854
|
+
case "phoneService":
|
|
855
|
+
return `catalog.${ref.appHandle}.phoneServices${safeMember(ref.phoneServiceKey)}`;
|
|
856
|
+
case "datamine":
|
|
857
|
+
state.imports.usesOrg = true;
|
|
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)}`;
|
|
865
|
+
case "user":
|
|
866
|
+
return `${trackFactory("userRef", state)}(${quote(ref.email)})`;
|
|
876
867
|
case "documentModel":
|
|
877
868
|
return `catalog.${ref.appHandle}.fileReaders${safeMember(ref.documentModelKey)}`;
|
|
878
869
|
case "documentModelField":
|
|
@@ -921,94 +912,24 @@ function printRef(ref, state, refCtx) {
|
|
|
921
912
|
// ---------------------------------------------------------------------------
|
|
922
913
|
// Filter printer — the v2 `filter.*` DSL. Namespaced under `filter`, it takes
|
|
923
914
|
// either a `FieldRef` token (`app.fields.x`) or a task/trigger `Ref`
|
|
924
|
-
// (`ctx.
|
|
925
|
-
// left-hand position, and exposes
|
|
926
|
-
// isNotNull/inList/between/contains/overlaps/and/or/whereTrue/whereFalse`.
|
|
915
|
+
// (`ctx.actions.x.y` — for row-less contexts like switch conditions) at the
|
|
916
|
+
// left-hand position, and exposes the canonical filter helper namespace.
|
|
927
917
|
// One call surface regardless of what's on the left — `printFilterField`
|
|
928
918
|
// prints the LHS as either a catalog field expression or a ctx ref
|
|
929
919
|
// expression, and both are valid arguments to the same `filter.*` function.
|
|
930
920
|
// ---------------------------------------------------------------------------
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
// "legacy" is the platform's implicit default for a like filter that never
|
|
939
|
-
// had a mode authored — it's always returned on export regardless, so
|
|
940
|
-
// printing it back would fabricate an option the author never set.
|
|
941
|
-
if (f.mode && f.mode !== "legacy")
|
|
942
|
-
entries.push(`mode: ${quote(f.mode)}`);
|
|
943
|
-
return entries.length > 0 ? `, { ${entries.join(", ")} }` : "";
|
|
944
|
-
}
|
|
945
|
-
function printFilter(f, state) {
|
|
946
|
-
const track = (op) => state.imports.filterOps.add(op);
|
|
947
|
-
switch (f.kind) {
|
|
948
|
-
case "true":
|
|
949
|
-
track("whereTrue");
|
|
950
|
-
return `filter.whereTrue()`;
|
|
951
|
-
case "false":
|
|
952
|
-
track("whereFalse");
|
|
953
|
-
return `filter.whereFalse()`;
|
|
954
|
-
case "and":
|
|
955
|
-
case "or": {
|
|
956
|
-
track(f.kind);
|
|
957
|
-
return `filter.${f.kind}(${f.children.map((c) => printFilter(c, state)).join(", ")})`;
|
|
958
|
-
}
|
|
959
|
-
case "eq":
|
|
960
|
-
case "gt":
|
|
961
|
-
case "gte":
|
|
962
|
-
case "lt":
|
|
963
|
-
case "lte": {
|
|
964
|
-
const op = f.kind === "eq" && f.not === true ? "notEq" : f.kind;
|
|
965
|
-
track(op);
|
|
966
|
-
const left = printFilterField(f.left, state);
|
|
967
|
-
const right = printFilterPrimitive(f.right, state);
|
|
968
|
-
return `filter.${op}(${left}, ${right})`;
|
|
969
|
-
}
|
|
970
|
-
case "like": {
|
|
971
|
-
track("like");
|
|
972
|
-
const left = printFilterField(f.left, state);
|
|
973
|
-
const right = printFilterPrimitive(f.right, state);
|
|
974
|
-
return `filter.like(${left}, ${right}${printLikeOptions(f)})`;
|
|
975
|
-
}
|
|
976
|
-
case "in": {
|
|
977
|
-
track("inList");
|
|
978
|
-
const left = printFilterField(f.left, state);
|
|
979
|
-
const values = f.values.map((v) => printFilterPrimitive(v, state)).join(", ");
|
|
980
|
-
return `filter.inList(${left}, [${values}])`;
|
|
981
|
-
}
|
|
982
|
-
case "isNull": {
|
|
983
|
-
const op = f.not ? "isNotNull" : "isNull";
|
|
984
|
-
track(op);
|
|
985
|
-
return `filter.${op}(${printFilterField(f.left, state)})`;
|
|
986
|
-
}
|
|
987
|
-
case "between": {
|
|
988
|
-
track("between");
|
|
989
|
-
const left = printFilterField(f.left, state);
|
|
990
|
-
const [low, high] = f.values.map((v) => printFilterPrimitive(v, state));
|
|
991
|
-
const options = f.not ? ", { not: true }" : "";
|
|
992
|
-
return `filter.between(${left}, ${low}, ${high}${options})`;
|
|
993
|
-
}
|
|
994
|
-
case "consecutiveRange": {
|
|
995
|
-
track("consecutiveRange");
|
|
996
|
-
const left = printFilterField(f.left, state);
|
|
997
|
-
return `filter.consecutiveRange(${left}, { unit: ${quote(f.unit)}, count: ${f.count}, offset: ${f.offset}, semantic: ${f.semantic} })`;
|
|
998
|
-
}
|
|
999
|
-
case "contains":
|
|
1000
|
-
case "overlaps": {
|
|
1001
|
-
track(f.kind);
|
|
1002
|
-
const left = printFilterField(f.left, state);
|
|
1003
|
-
const values = f.values.map((v) => printFilterPrimitive(v, state)).join(", ");
|
|
1004
|
-
return `filter.${f.kind}(${left}, [${values}])`;
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
921
|
+
function printFilter(filter, state) {
|
|
922
|
+
return printCanonicalFilter(filter, {
|
|
923
|
+
field: (field) => printFilterField(field, state),
|
|
924
|
+
reference: (reference) => printFilterReference(reference, state),
|
|
925
|
+
quote,
|
|
926
|
+
used: (helper) => state.imports.filterOps.add(helper),
|
|
927
|
+
});
|
|
1007
928
|
}
|
|
1008
929
|
/**
|
|
1009
930
|
* Render the left-hand side of a `filter.*` call: a `FieldRef` token
|
|
1010
931
|
* (`fieldRef` → `<handle>.fields.<key>`) when there's a field, or the ctx ref
|
|
1011
|
-
* expression (`ctx.
|
|
932
|
+
* expression (`ctx.actions.x.y`) for a row-less (task/trigger-output) LHS —
|
|
1012
933
|
* `filter.*` accepts either at the same argument position.
|
|
1013
934
|
*/
|
|
1014
935
|
function printFilterField(left, state) {
|
|
@@ -1035,36 +956,17 @@ function printFilterField(left, state) {
|
|
|
1035
956
|
}
|
|
1036
957
|
/**
|
|
1037
958
|
* Render the RHS of a v2 filter operator. A literal value AST collapses to its
|
|
1038
|
-
* scalar; a reference RHS (`ctx.trigger.x`, `ctx.
|
|
959
|
+
* scalar; a reference RHS (`ctx.trigger.x`, `ctx.actions.y.z`) prints as the ctx
|
|
1039
960
|
* ref — the v2 filter DSL accepts refs and serializes them to the platform's
|
|
1040
961
|
* REFERENCE value shape.
|
|
1041
962
|
*/
|
|
1042
|
-
function
|
|
1043
|
-
if (
|
|
1044
|
-
return `
|
|
1045
|
-
if (isRefExpr(v)) {
|
|
1046
|
-
if (v.kind === "literal")
|
|
1047
|
-
return literalJson(v.value);
|
|
1048
|
-
return printRef(v, state, DEFAULT_CTX);
|
|
1049
|
-
}
|
|
1050
|
-
switch (v.kind) {
|
|
1051
|
-
case "text":
|
|
1052
|
-
case "uuid":
|
|
1053
|
-
case "date":
|
|
1054
|
-
case "datetime":
|
|
1055
|
-
return quote(v.value);
|
|
1056
|
-
case "number":
|
|
1057
|
-
return String(v.value);
|
|
1058
|
-
case "boolean":
|
|
1059
|
-
return String(v.value);
|
|
1060
|
-
case "null":
|
|
1061
|
-
return "null";
|
|
1062
|
-
case "currentUser":
|
|
1063
|
-
state.imports.filterOps.add("currentUser");
|
|
1064
|
-
return `filter.currentUser(${quote(v.currentUserType)})`;
|
|
1065
|
-
case "reference":
|
|
1066
|
-
return printRef(v.ref, state, DEFAULT_CTX);
|
|
963
|
+
function printFilterReference(reference, state) {
|
|
964
|
+
if (reference.kind === "unresolved") {
|
|
965
|
+
return `${quote(`${UNRESOLVED_REFERENCE_MARKER}${reference.uuid}`)} as any /* TODO: unresolved ${reference.hint} */`;
|
|
1067
966
|
}
|
|
967
|
+
if (reference.kind === "literal")
|
|
968
|
+
return literalJson(reference.value);
|
|
969
|
+
return printRef(reference, state, DEFAULT_CTX);
|
|
1068
970
|
}
|
|
1069
971
|
function printSortArray(sorts, state, refCtx) {
|
|
1070
972
|
// v2 takes `sort` as a pre-built wire object; the slice has no sort DSL. Emit
|
|
@@ -1096,14 +998,15 @@ function printArrayLiteral(arr, state, indent, refCtx) {
|
|
|
1096
998
|
// ---------------------------------------------------------------------------
|
|
1097
999
|
// Heuristics / type guards
|
|
1098
1000
|
// ---------------------------------------------------------------------------
|
|
1099
|
-
function
|
|
1001
|
+
function isFilter(value) {
|
|
1100
1002
|
if (!value || typeof value !== "object")
|
|
1101
1003
|
return false;
|
|
1102
|
-
const
|
|
1103
|
-
return
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1004
|
+
const type = value.type;
|
|
1005
|
+
return typeof type === "string" && new Set([
|
|
1006
|
+
"EQUALS", "GREATER_THAN", "GREATER_THAN_EQUALS", "LESS_THAN", "LESS_THAN_EQUALS",
|
|
1007
|
+
"LIKE", "IN", "BETWEEN", "CURRENT_RANGE", "CONSECUTIVE_RANGE", "CONTAINS",
|
|
1008
|
+
"OVERLAPS", "IS_NULL", "AND", "OR", "TRUE", "FALSE",
|
|
1009
|
+
]).has(type);
|
|
1107
1010
|
}
|
|
1108
1011
|
function isSort(value) {
|
|
1109
1012
|
return (!!value &&
|