@elementumai/edk 0.8.2-alpha.6 → 0.9.2
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 +18 -14
- 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 +2 -10
- package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.d.ts +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/src/catalog/factories.d.ts +53 -19
- package/dist-sdk/src/catalog/factories.js +51 -12
- package/dist-sdk/src/catalog/from-authoring.js +13 -3
- 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 +1 -0
- package/dist-sdk/src/catalog/render.js +6 -0
- package/dist-sdk/src/catalog/token.js +7 -0
- package/dist-sdk/src/catalog/types.d.ts +34 -23
- package/dist-sdk/src/catalog/types.js +7 -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 +1 -0
- package/dist-sdk/src/core/index.js +1 -0
- 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} +2 -2
- package/dist-sdk/src/{entities/flow/activities/render-catalog.js → core/render-tree.js} +6 -8
- package/dist-sdk/src/core/types/app.d.ts +13 -23
- package/dist-sdk/src/core/types/app.js +0 -1
- package/dist-sdk/src/engine/build/context.d.ts +3 -3
- 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 +39 -0
- package/dist-sdk/src/engine/pull/org.d.ts +1 -0
- package/dist-sdk/src/engine/pull/org.js +2 -0
- package/dist-sdk/src/engine/tf/expr.d.ts +1 -1
- package/dist-sdk/src/engine/tf/expr.js +10 -3
- package/dist-sdk/src/engine/workspace/authoring-layout.js +4 -2
- package/dist-sdk/src/entities/access-policy/build.d.ts +4 -13
- package/dist-sdk/src/entities/access-policy/build.js +1 -1
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +12 -38
- package/dist-sdk/src/entities/access-policy/from-tf.js +16 -74
- package/dist-sdk/src/entities/access-policy/principal.d.ts +29 -0
- package/dist-sdk/src/entities/access-policy/principal.js +13 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +20 -5
- package/dist-sdk/src/entities/access-policy/to-tf.js +26 -54
- package/dist-sdk/src/entities/agent/build.d.ts +39 -8
- package/dist-sdk/src/entities/agent/build.js +36 -15
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +5 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +121 -36
- package/dist-sdk/src/entities/agent/from-tf.js +5 -8
- 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 +5 -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 +2 -1
- package/dist-sdk/src/entities/agent/to-tf.js +2 -1
- package/dist-sdk/src/entities/agent/tools.d.ts +60 -48
- package/dist-sdk/src/entities/agent/tools.js +44 -38
- 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-tool/from-tf.d.ts +17 -8
- package/dist-sdk/src/entities/agent-tool/from-tf.js +127 -37
- package/dist-sdk/src/entities/agent-tool/module.js +6 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +5 -5
- package/dist-sdk/src/entities/agent-tool/to-tf.js +93 -20
- package/dist-sdk/src/entities/agent-tool/types.d.ts +4 -5
- package/dist-sdk/src/entities/agent-tool/types.js +36 -8
- package/dist-sdk/src/entities/app/build.d.ts +137 -25
- package/dist-sdk/src/entities/app/build.js +104 -53
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +173 -1
- package/dist-sdk/src/entities/app/deserializer/pulled-expression.d.ts +59 -0
- package/dist-sdk/src/entities/app/deserializer/pulled-expression.js +68 -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 +13 -4
- package/dist-sdk/src/entities/app/index.js +8 -1
- package/dist-sdk/src/entities/app/module.js +27 -2
- package/dist-sdk/src/entities/app/to-tf.js +75 -1
- 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 +10 -6
- package/dist-sdk/src/entities/automation/build.js +5 -4
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +10 -8
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +51 -114
- 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 +4 -0
- package/dist-sdk/src/entities/automation/from-tf.js +202 -119
- package/dist-sdk/src/entities/automation/index.d.ts +4 -2
- package/dist-sdk/src/entities/automation/index.js +3 -1
- package/dist-sdk/src/entities/automation/module.js +10 -4
- package/dist-sdk/src/entities/automation/script-code.js +94 -6
- package/dist-sdk/src/entities/automation/tasks.d.ts +20 -19
- package/dist-sdk/src/entities/automation/tasks.js +2 -2
- package/dist-sdk/src/entities/automation/to-tf.d.ts +34 -2
- package/dist-sdk/src/entities/automation/to-tf.js +273 -98
- package/dist-sdk/src/entities/automation/triggers.d.ts +18 -17
- package/dist-sdk/src/entities/automation/triggers.js +1 -1
- package/dist-sdk/src/entities/dashboard/build.d.ts +17 -0
- package/dist-sdk/src/entities/dashboard/from-tf.d.ts +12 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +95 -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 +30 -0
- package/dist-sdk/src/entities/dashboard/to-tf.js +94 -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/build.js +1 -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 +303 -0
- package/dist-sdk/src/entities/dynamic-layout/build.js +4 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +2 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.js +9 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +10 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +233 -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 +31 -14
- package/dist-sdk/src/entities/element/build.js +12 -4
- 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 +8 -3
- package/dist-sdk/src/entities/element/index.js +4 -1
- package/dist-sdk/src/entities/element/module.js +19 -2
- package/dist-sdk/src/entities/element/to-tf.js +57 -1
- package/dist-sdk/src/entities/field/build.d.ts +4 -3
- package/dist-sdk/src/entities/field/calculation-types.d.ts +6 -0
- package/dist-sdk/src/entities/field/calculation-types.js +42 -0
- package/dist-sdk/src/entities/field/from-tf.js +90 -11
- package/dist-sdk/src/entities/field/module.d.ts +1 -0
- package/dist-sdk/src/entities/field/module.js +5 -2
- package/dist-sdk/src/entities/field/record-shape.d.ts +1 -1
- package/dist-sdk/src/entities/field/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/field/to-tf.js +22 -6
- package/dist-sdk/src/entities/field/types.js +3 -0
- package/dist-sdk/src/entities/file-reader/build.d.ts +66 -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 +11 -9
- 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/group.js +4 -5
- 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.d.ts +4 -0
- package/dist-sdk/src/entities/org/phone-provider.js +33 -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 +29 -0
- package/dist-sdk/src/entities/organization/build.js +24 -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 +18 -0
- package/dist-sdk/src/entities/organization/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/organization/to-tf.js +37 -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 +54 -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 +80 -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 +31 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +153 -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 +11 -0
- package/dist-sdk/src/entities/service-account/to-tf.js +72 -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/filters/ast.d.ts +21 -79
- package/dist-sdk/src/entities/shared/filters/ast.js +5 -2
- package/dist-sdk/src/entities/shared/filters/index.d.ts +94 -206
- package/dist-sdk/src/entities/shared/filters/index.js +189 -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/skill/build.d.ts +2 -2
- package/dist-sdk/src/entities/skill/build.js +4 -3
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +10 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +74 -32
- package/dist-sdk/src/entities/skill/index.d.ts +2 -1
- package/dist-sdk/src/entities/skill/index.js +2 -1
- package/dist-sdk/src/entities/skill/module.js +6 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +5 -1
- package/dist-sdk/src/entities/skill/to-tf.js +18 -0
- package/dist-sdk/src/entities/skill/tools.d.ts +46 -31
- package/dist-sdk/src/entities/skill/tools.js +33 -20
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +4 -1
- package/dist-sdk/src/entities/skill-tool/from-tf.js +76 -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 +94 -42
- 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 +33 -18
- package/dist-sdk/src/entities/table/catalog-render.js +6 -0
- 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 +230 -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/from-tf.d.ts +7 -2
- package/dist-sdk/src/entities/view/from-tf.js +209 -25
- package/dist-sdk/src/entities/view/module.js +5 -1
- package/dist-sdk/src/entities/view/to-tf.d.ts +49 -7
- package/dist-sdk/src/entities/view/to-tf.js +155 -18
- package/dist-sdk/src/entities/view/types.d.ts +8 -0
- package/dist-sdk/src/entities/view/types.js +43 -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 +14 -0
- package/dist-sdk/src/entities/visual-flow/to-tf.js +101 -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 +44 -0
- package/dist-sdk/src/entities/widget/to-tf.js +204 -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 +7 -0
- package/dist-sdk/src/graph/index.js +4 -18
- package/dist-sdk/src/graph/modules.js +30 -1
- package/dist-sdk/src/graph/types.d.ts +55 -7
- package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
- package/dist-sdk/src/internal/sdk-package.js +4 -2
- package/package.json +30 -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 → dashboard/build.js} +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { EntityTfError } from "../../engine/entity.js";
|
|
2
|
+
import { resourceRefLabel } from "../../engine/pull/context.js";
|
|
3
|
+
import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
4
|
+
import { fieldKeyFromTfRef } from "../field/from-tf.js";
|
|
5
|
+
import { APPROVAL_PROCESS_RESOURCE_TYPE } from "./module.js";
|
|
6
|
+
const KNOWN = new Set(["id", "app_id", "name", "stage_id", "number_of_dynamic_approvers", "locked_field_ids", "managed_by_automation", "approve_button_text", "deny_button_text", "exception_button_text", "default_reason", "approval_summary"]);
|
|
7
|
+
function stringAttr(attrs, key) { return typeof attrs[key] === "string" ? attrs[key] : undefined; }
|
|
8
|
+
export function approvalChainFromTf(block, appTfLabel, _ctx) {
|
|
9
|
+
if (block.type !== APPROVAL_PROCESS_RESOURCE_TYPE || block.label === undefined)
|
|
10
|
+
throw new EntityTfError(`expected ${APPROVAL_PROCESS_RESOURCE_TYPE}`);
|
|
11
|
+
for (const key of Object.keys(block.attrs))
|
|
12
|
+
if (!KNOWN.has(key))
|
|
13
|
+
throw new EntityTfError(`${block.type}.${block.label}: unknown attribute ${key}`);
|
|
14
|
+
if (resourceRefLabel(block.attrs["app_id"], "elementum_app") !== appTfLabel)
|
|
15
|
+
throw new EntityTfError(`${block.type}.${block.label}: wrong app_id`);
|
|
16
|
+
const name = stringAttr(block.attrs, "name");
|
|
17
|
+
const count = block.attrs["number_of_dynamic_approvers"];
|
|
18
|
+
const managed = block.attrs["managed_by_automation"];
|
|
19
|
+
const deny = stringAttr(block.attrs, "deny_button_text");
|
|
20
|
+
// ei's export (cmd/elementum/export/hcl_approval.go) now always emits
|
|
21
|
+
// approve_button_text, but this fallback stays for backward compatibility
|
|
22
|
+
// with pre-fix captured .tf/in/ exports that omitted the key — don't
|
|
23
|
+
// reintroduce conditional emission logic under the false premise that
|
|
24
|
+
// ei's export still omits it.
|
|
25
|
+
const approve = stringAttr(block.attrs, "approve_button_text") ?? "Approve";
|
|
26
|
+
if (name === undefined || typeof count !== "number" || typeof managed !== "boolean" || deny === undefined)
|
|
27
|
+
throw new EntityTfError(`${block.type}.${block.label}: missing required approval attributes`);
|
|
28
|
+
const stageValue = block.attrs["stage_id"];
|
|
29
|
+
let stage;
|
|
30
|
+
let stageId;
|
|
31
|
+
if (isTfExpr(stageValue) && stageValue.$expr === "local" && stageValue.name === `${appTfLabel}_stage_ids_by_key`) {
|
|
32
|
+
const index = stageValue.path[0];
|
|
33
|
+
if (typeof index === "object")
|
|
34
|
+
stage = tfLabelToTsLabel(index.index);
|
|
35
|
+
}
|
|
36
|
+
else if (typeof stageValue === "string")
|
|
37
|
+
stageId = stageValue;
|
|
38
|
+
else if (stageValue !== undefined)
|
|
39
|
+
throw new EntityTfError(`${block.type}.${block.label}: unsupported stage_id expression`);
|
|
40
|
+
const rawFields = block.attrs["locked_field_ids"];
|
|
41
|
+
if (rawFields !== undefined && !Array.isArray(rawFields))
|
|
42
|
+
throw new EntityTfError(`${block.type}.${block.label}: locked_field_ids must be a list`);
|
|
43
|
+
const lockedFields = (rawFields ?? []).map((value) => {
|
|
44
|
+
const key = fieldKeyFromTfRef(value, appTfLabel, "app");
|
|
45
|
+
if (key === undefined)
|
|
46
|
+
throw new EntityTfError(`${block.type}.${block.label}: locked field is not a local field reference`);
|
|
47
|
+
return key;
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
refName: scopedLabelToBagKey(appTfLabel, block.label, "app"), name,
|
|
51
|
+
...(stage !== undefined && { stage }), ...(stageId !== undefined && { stageId }),
|
|
52
|
+
numberOfDynamicApprovers: count, managedByAutomation: managed, denyButton: deny, approveButton: approve, lockedFields,
|
|
53
|
+
...(stringAttr(block.attrs, "exception_button_text") !== undefined && { exceptionButton: stringAttr(block.attrs, "exception_button_text") }),
|
|
54
|
+
...(stringAttr(block.attrs, "default_reason") !== undefined && { defaultReason: stringAttr(block.attrs, "default_reason") }),
|
|
55
|
+
...(stringAttr(block.attrs, "approval_summary") !== undefined && { summary: stringAttr(block.attrs, "approval_summary") }),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Approval-process authoring. App-owned; PUT-updatable.
|
|
3
3
|
* Standalone from v1's `src/approvalChains`.
|
|
4
4
|
*/
|
|
5
|
-
export {
|
|
6
|
-
export { groupStep, userStep, type ApprovalGroupStep, type ApprovalStep, type ApprovalUserStep, } from "./steps.js";
|
|
5
|
+
export { defineApprovalProcess, unsafeApprovalStageId, type ApprovalProcessConfigured, type DefineApprovalProcessOptions, type UnsafeApprovalStageId, } from "./build.js";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Approval-process authoring. App-owned; PUT-updatable.
|
|
3
3
|
* Standalone from v1's `src/approvalChains`.
|
|
4
4
|
*/
|
|
5
|
-
export {
|
|
6
|
-
export { groupStep, userStep, } from "./steps.js";
|
|
5
|
+
export { defineApprovalProcess, unsafeApprovalStageId, } from "./build.js";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { rootParentFactoryEntry } from "../../catalog/render-helpers.js";
|
|
2
|
+
import { NO_DATA } from "../../graph/types.js";
|
|
3
|
+
import { approvalChainFromTf } from "./from-tf.js";
|
|
4
|
+
import { printApprovalChain } from "./printer.js";
|
|
5
|
+
import { approvalChainToTf } from "./to-tf.js";
|
|
6
|
+
export const APPROVAL_PROCESS_RESOURCE_TYPE = "elementum_approval_process";
|
|
7
|
+
function stub(refName, parent) { return { __kind: "approvalChain", refName, name: refName, parent }; }
|
|
8
|
+
function refFromAuthoring(args) {
|
|
9
|
+
const value = args.defaultExport;
|
|
10
|
+
if (typeof value === "object" &&
|
|
11
|
+
value !== null &&
|
|
12
|
+
typeof value.ref === "function" &&
|
|
13
|
+
typeof value.def === "function") {
|
|
14
|
+
const ref = value.ref(args.refName);
|
|
15
|
+
return typeof ref === "object" && ref !== null && ref.__kind === "approvalChain"
|
|
16
|
+
? ref
|
|
17
|
+
: undefined;
|
|
18
|
+
}
|
|
19
|
+
if (typeof value !== "object" || value === null || value.kind !== "approvalChain")
|
|
20
|
+
return undefined;
|
|
21
|
+
const entity = value;
|
|
22
|
+
const name = entity.payload?.name;
|
|
23
|
+
return { __kind: "approvalChain", refName: entity.refName || args.refName, name: typeof name === "string" ? name : args.refName, parent: entity.parent || args.parent };
|
|
24
|
+
}
|
|
25
|
+
function extract(blocks, _stream, ctx) {
|
|
26
|
+
const items = [];
|
|
27
|
+
const skipped = [];
|
|
28
|
+
const diagnostics = [];
|
|
29
|
+
for (const block of blocks) {
|
|
30
|
+
try {
|
|
31
|
+
items.push(approvalChainFromTf(block, ctx.appTfLabel, ctx));
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
skipped.push(`${block.type}.${block.label ?? ""}`);
|
|
35
|
+
diagnostics.push(error instanceof Error ? error.message : String(error));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return { items, skipped, diagnostics };
|
|
39
|
+
}
|
|
40
|
+
export const approvalChainModule = {
|
|
41
|
+
kind: "approval-chain", stream: { role: "streamMember" }, authoring: { unit: "ownFile", bag: "approval-chains" },
|
|
42
|
+
parents: [{ parent: "app", child: "approval-chain" }],
|
|
43
|
+
resource: { shape: "single", resourceType: APPROVAL_PROCESS_RESOURCE_TYPE, adoptable: true }, data: NO_DATA,
|
|
44
|
+
lifecycle: {
|
|
45
|
+
participates: true, extractOwnFile: extract,
|
|
46
|
+
printOwnFile: (item, opts) => { const chain = item; return { refName: chain.refName, source: printApprovalChain(chain, opts.appRefName) }; },
|
|
47
|
+
toTf: (entity, ctx) => approvalChainToTf(entity, { appRefName: ctx.appRefName, appTfLabel: ctx.appTfLabel }),
|
|
48
|
+
},
|
|
49
|
+
canvas: { participates: true, label: "Approval processes", glyph: "✓", component: "generic" },
|
|
50
|
+
catalog: { participates: true, refKind: "approvalChain", catalogBag: "approvalChains", renderOrder: 26, catalogRoot: "app", renderEntry: rootParentFactoryEntry("approvalChainRef"), stubRef: stub, refFromAuthoring },
|
|
51
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const safe = (value) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value) ? value : JSON.stringify(value);
|
|
2
|
+
export function printApprovalChain(chain, appRefName) {
|
|
3
|
+
const imports = ["defineApprovalProcess", ...(chain.stageId !== undefined ? ["unsafeApprovalStageId"] : [])];
|
|
4
|
+
const lines = [`import { ${imports.join(", ")} } from "@elementumai/edk/approvalProcesses";`, `import catalog from "@catalog";`];
|
|
5
|
+
const props = [
|
|
6
|
+
`app: catalog.${safe(appRefName)}`,
|
|
7
|
+
`name: ${JSON.stringify(chain.name)}`,
|
|
8
|
+
...(chain.stage !== undefined ? [`stage: ${JSON.stringify(chain.stage)}`] : []),
|
|
9
|
+
...(chain.stageId !== undefined ? [`unsafeStageId: unsafeApprovalStageId(${JSON.stringify(chain.stageId)})`] : []),
|
|
10
|
+
`numberOfDynamicApprovers: ${chain.numberOfDynamicApprovers}`,
|
|
11
|
+
`managedByAutomation: ${chain.managedByAutomation}`,
|
|
12
|
+
`denyButton: ${JSON.stringify(chain.denyButton)}`,
|
|
13
|
+
`approveButton: ${JSON.stringify(chain.approveButton)}`,
|
|
14
|
+
...(chain.exceptionButton !== undefined ? [`exceptionButton: ${JSON.stringify(chain.exceptionButton)}`] : []),
|
|
15
|
+
...(chain.defaultReason !== undefined ? [`defaultReason: ${JSON.stringify(chain.defaultReason)}`] : []),
|
|
16
|
+
...(chain.summary !== undefined ? [`summary: ${JSON.stringify(chain.summary)}`] : []),
|
|
17
|
+
...(chain.lockedFields.length > 0 ? [`lockedFields: [${[...chain.lockedFields].sort().map((key) => `catalog.${safe(appRefName)}.fields.${safe(key)}`).join(", ")}]`] : []),
|
|
18
|
+
];
|
|
19
|
+
lines.push(``, `export default defineApprovalProcess({`, ...props.map((prop) => ` ${prop},`), `});`, ``);
|
|
20
|
+
return lines.join("\n");
|
|
21
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type DeployableEntity } from "../../engine/entity.js";
|
|
2
|
+
import { type TfBlock } from "../../engine/tf/index.js";
|
|
3
|
+
export declare function approvalChainToTf(entity: DeployableEntity, ctx: {
|
|
4
|
+
appRefName: string;
|
|
5
|
+
appTfLabel: string;
|
|
6
|
+
}): {
|
|
7
|
+
blocks: readonly TfBlock[];
|
|
8
|
+
address: string;
|
|
9
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { EntityTfError } from "../../engine/entity.js";
|
|
2
|
+
import { appScopedResourceLabel, expr, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
3
|
+
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
4
|
+
import { fieldRefToTfValue } from "../field/to-tf.js";
|
|
5
|
+
import { APPROVAL_PROCESS_RESOURCE_TYPE } from "./module.js";
|
|
6
|
+
export function approvalChainToTf(entity, ctx) {
|
|
7
|
+
if (entity.kind !== "approvalChain")
|
|
8
|
+
throw new EntityTfError(`approvalChainToTf expects approvalChain; got ${entity.kind}`);
|
|
9
|
+
const payload = entity.payload;
|
|
10
|
+
if (payload === null)
|
|
11
|
+
throw new EntityTfError(`approval chain ${entity.refName} has no payload`);
|
|
12
|
+
const label = appScopedResourceLabel(ctx.appTfLabel, tsLabelToTfLabel(entity.refName));
|
|
13
|
+
const attrs = {
|
|
14
|
+
app_id: expr.resourceAttr(APP_RESOURCE_TYPE, ctx.appTfLabel, ["id"]),
|
|
15
|
+
name: payload.name ?? "",
|
|
16
|
+
number_of_dynamic_approvers: payload.numberOfDynamicApprovers ?? 0,
|
|
17
|
+
managed_by_automation: payload.managedByAutomation ?? false,
|
|
18
|
+
deny_button_text: payload.denyButton ?? "Deny",
|
|
19
|
+
approve_button_text: payload.approveButton ?? "Approve",
|
|
20
|
+
};
|
|
21
|
+
if (payload.stage !== undefined)
|
|
22
|
+
attrs["stage_id"] = expr.local(`${ctx.appTfLabel}_stage_ids_by_key`, [{ index: tsLabelToTfLabel(payload.stage) }]);
|
|
23
|
+
else if (payload.stageId !== undefined)
|
|
24
|
+
attrs["stage_id"] = payload.stageId;
|
|
25
|
+
if (payload.exceptionButton !== undefined)
|
|
26
|
+
attrs["exception_button_text"] = payload.exceptionButton;
|
|
27
|
+
if (payload.defaultReason !== undefined)
|
|
28
|
+
attrs["default_reason"] = payload.defaultReason;
|
|
29
|
+
if (payload.summary !== undefined)
|
|
30
|
+
attrs["approval_summary"] = payload.summary;
|
|
31
|
+
if (payload.lockedFieldIds !== undefined) {
|
|
32
|
+
attrs["locked_field_ids"] = payload.lockedFieldIds.map((field) => {
|
|
33
|
+
if (field.parent !== undefined && field.parent !== "" && field.parent !== ctx.appRefName)
|
|
34
|
+
throw new EntityTfError(`approval chain ${entity.refName}: locked field belongs to ${field.parent}`);
|
|
35
|
+
const value = fieldRefToTfValue(field.fieldType ?? "", field.refName ?? "", ctx.appTfLabel);
|
|
36
|
+
if (value === undefined)
|
|
37
|
+
throw new EntityTfError(`approval chain ${entity.refName}: locked field ${field.refName ?? ""} has no Terraform mapping`);
|
|
38
|
+
return value;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const block = { kind: "resource", type: APPROVAL_PROCESS_RESOURCE_TYPE, label, attrs };
|
|
42
|
+
return { blocks: [block], address: `${APPROVAL_PROCESS_RESOURCE_TYPE}.${label}` };
|
|
43
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { AutomationCatalogRef } from "../../catalog/index.js";
|
|
1
|
+
import type { AutomationCatalogRef, CatalogRef } from "../../catalog/index.js";
|
|
2
|
+
import type { ServiceAccountRef } from "../service-account/ref.js";
|
|
2
3
|
import { type Context } from "../shared/context.js";
|
|
3
4
|
import { type Ref, type Simplify, type ValueOrRef } from "../shared/ref.js";
|
|
4
5
|
import { type DeployableEntity, type EntityDeployOptions, type RecordFieldContext } from "../../engine/entity.js";
|
|
6
|
+
import type { Filter } from "./filter.js";
|
|
5
7
|
import { type ScriptInput } from "./script-code.js";
|
|
6
8
|
/** Structural empty object — neutral element for the `&`-accumulated task map. */
|
|
7
9
|
type EmptyObject = {
|
|
@@ -40,7 +42,7 @@ export interface ChildTask {
|
|
|
40
42
|
*/
|
|
41
43
|
export interface OperatorChild {
|
|
42
44
|
readonly label: string | null;
|
|
43
|
-
readonly filter?:
|
|
45
|
+
readonly filter?: Filter;
|
|
44
46
|
readonly tasks: readonly ChildTask[];
|
|
45
47
|
/**
|
|
46
48
|
* The switch default branch's actual display label, when it deviates from
|
|
@@ -233,9 +235,11 @@ export interface AutomationV2Options extends EntityDeployOptions {
|
|
|
233
235
|
readonly description?: string;
|
|
234
236
|
/** Whether this workflow may trigger other automations. */
|
|
235
237
|
readonly triggersOtherAutomations?: boolean;
|
|
236
|
-
/** The
|
|
237
|
-
readonly
|
|
238
|
-
readonly status?: "DRAFT" | "ACTIVE";
|
|
238
|
+
/** The app that owns this automation. */
|
|
239
|
+
readonly app: CatalogRef<"app">;
|
|
240
|
+
readonly status?: "DRAFT" | "INACTIVE" | "ACTIVE";
|
|
241
|
+
/** App-owned identity used to execute this workflow. */
|
|
242
|
+
readonly serviceAccount?: ServiceAccountRef;
|
|
239
243
|
/** The workflow body — a `defineWorkflow()` chain with a trigger set. */
|
|
240
244
|
readonly workflow: WorkflowChain;
|
|
241
245
|
}
|
|
@@ -251,7 +255,7 @@ export interface AutomationConfigured {
|
|
|
251
255
|
}
|
|
252
256
|
/**
|
|
253
257
|
* Define a v2 automation. Identity comes from the authoring file's `refName`
|
|
254
|
-
* plus `
|
|
258
|
+
* plus the typed `app` reference; the display `name` lives only in the payload, so renaming an
|
|
255
259
|
* automation plans as an update rather than a create. Returns an
|
|
256
260
|
* `AutomationConfigured` with `ref(refName)` and `def(refName)`.
|
|
257
261
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* defineAutomation({
|
|
6
6
|
* name: "Escalate",
|
|
7
|
-
*
|
|
7
|
+
* app: catalog.incidents,
|
|
8
8
|
* workflowRevision: "1.0.0",
|
|
9
9
|
* status: "DRAFT",
|
|
10
10
|
* workflow: defineWorkflow()
|
|
@@ -374,7 +374,7 @@ export function defineWorkflow() {
|
|
|
374
374
|
}
|
|
375
375
|
/**
|
|
376
376
|
* Define a v2 automation. Identity comes from the authoring file's `refName`
|
|
377
|
-
* plus `
|
|
377
|
+
* plus the typed `app` reference; the display `name` lives only in the payload, so renaming an
|
|
378
378
|
* automation plans as an update rather than a create. Returns an
|
|
379
379
|
* `AutomationConfigured` with `ref(refName)` and `def(refName)`.
|
|
380
380
|
*/
|
|
@@ -409,7 +409,7 @@ export function defineAutomation(opts) {
|
|
|
409
409
|
__kind: "automation",
|
|
410
410
|
refName: refName,
|
|
411
411
|
name: opts.name,
|
|
412
|
-
parent: opts.
|
|
412
|
+
parent: opts.app.refName,
|
|
413
413
|
...(trigger !== undefined ? { trigger } : {}),
|
|
414
414
|
...(outputs !== undefined ? { outputs } : {}),
|
|
415
415
|
};
|
|
@@ -423,7 +423,7 @@ export function defineAutomation(opts) {
|
|
|
423
423
|
// `recordFieldContextOf` to read back at deploy time.
|
|
424
424
|
const entity = {
|
|
425
425
|
kind: "automation",
|
|
426
|
-
parent: opts.
|
|
426
|
+
parent: opts.app.refName,
|
|
427
427
|
refName,
|
|
428
428
|
payload: {
|
|
429
429
|
name: opts.name,
|
|
@@ -431,6 +431,7 @@ export function defineAutomation(opts) {
|
|
|
431
431
|
...(opts.description !== undefined ? { description: opts.description } : {}),
|
|
432
432
|
triggersOtherAutomations: opts.triggersOtherAutomations ?? false,
|
|
433
433
|
status: opts.status ?? "DRAFT",
|
|
434
|
+
...(opts.serviceAccount !== undefined ? { serviceAccount: opts.serviceAccount } : {}),
|
|
434
435
|
trigger: wf.trigger,
|
|
435
436
|
tasks: wf.tasks,
|
|
436
437
|
...(wf.outputProperties ? { outputProperties: wf.outputProperties } : {}),
|
|
@@ -10,12 +10,13 @@
|
|
|
10
10
|
* re-exported here for backwards compatibility. Other tool surfaces
|
|
11
11
|
* (agent search tools, etc.) import the same definitions from there.
|
|
12
12
|
*/
|
|
13
|
-
import type { RefExpr,
|
|
14
|
-
|
|
13
|
+
import type { RefExpr, SortAst, ApprovalChainRefAst, DatamineRefAst, AppRefAst, FieldRefAst, UserFieldRefAst, UnresolvedRefAst } from "../../shared/filters/ast.js";
|
|
14
|
+
import type { Filter } from "../../shared/filters/types.js";
|
|
15
|
+
export type { RefExpr, SortAst, AppRefAst, ApprovalChainRefAst, DatamineRefAst, FieldRefAst, UserFieldRefAst, UnresolvedRefAst, };
|
|
15
16
|
/**
|
|
16
17
|
* A TaskCall represents one call to a task factory like `executeScript({...})`.
|
|
17
18
|
* `args` is a map of argument-name -> value; the printer emits each value
|
|
18
|
-
* according to its dynamic shape (RefExpr,
|
|
19
|
+
* according to its dynamic shape (RefExpr, Filter, nested object, etc.).
|
|
19
20
|
*
|
|
20
21
|
* `children` carries the AST for operator tasks (forEach / switch). For
|
|
21
22
|
* forEach the array has exactly one entry; for switch each entry is a case
|
|
@@ -33,7 +34,7 @@ export interface TaskCall {
|
|
|
33
34
|
}
|
|
34
35
|
export interface OperatorChildAst {
|
|
35
36
|
readonly label: string | null;
|
|
36
|
-
readonly filter?:
|
|
37
|
+
readonly filter?: Filter<RefExpr, RefExpr>;
|
|
37
38
|
readonly tasks: readonly TaskCall[];
|
|
38
39
|
/** The switch default branch's actual display label, when `label` is `null` and it deviates from "Default". */
|
|
39
40
|
readonly defaultLabel?: string;
|
|
@@ -72,14 +73,14 @@ export type TriggerAst = {
|
|
|
72
73
|
kind: "recordCreate" | "recordUpdate" | "attachment";
|
|
73
74
|
/** The owning app — `{kind: "unresolved", ...}` when the aspect never made it into the pull's catalog. */
|
|
74
75
|
app: AppRefAst | UnresolvedRefAst;
|
|
75
|
-
filter?:
|
|
76
|
+
filter?: Filter<RefExpr, RefExpr>;
|
|
76
77
|
changedFields?: readonly (FieldRefAst | UnresolvedRefAst)[];
|
|
77
78
|
thinkUi?: boolean;
|
|
78
79
|
} | {
|
|
79
80
|
kind: "commentAdded";
|
|
80
81
|
app: AppRefAst | UnresolvedRefAst;
|
|
81
82
|
conversationType: string;
|
|
82
|
-
filter?:
|
|
83
|
+
filter?: Filter<RefExpr, RefExpr>;
|
|
83
84
|
} | {
|
|
84
85
|
kind: "conversationEnd";
|
|
85
86
|
app: AppRefAst | UnresolvedRefAst;
|
|
@@ -123,7 +124,7 @@ export type TriggerAst = {
|
|
|
123
124
|
dayOfMonth?: number;
|
|
124
125
|
} | {
|
|
125
126
|
kind: "dataMine";
|
|
126
|
-
|
|
127
|
+
datamine: DatamineRefAst | string;
|
|
127
128
|
fireOnAlert?: boolean;
|
|
128
129
|
fireOnRecovery?: boolean;
|
|
129
130
|
} | {
|
|
@@ -142,7 +143,8 @@ export interface AutomationAst {
|
|
|
142
143
|
readonly workflowRevision: string;
|
|
143
144
|
readonly description?: string;
|
|
144
145
|
readonly triggersOtherAutomations?: boolean;
|
|
145
|
-
readonly status: "DRAFT" | "ACTIVE";
|
|
146
|
+
readonly status: "DRAFT" | "INACTIVE" | "ACTIVE";
|
|
147
|
+
readonly serviceAccountName?: string;
|
|
146
148
|
readonly trigger: TriggerAst;
|
|
147
149
|
readonly tasks: readonly TaskCall[];
|
|
148
150
|
readonly outputs?: readonly {
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
import { camelCase } from "../../../../pull/util.js";
|
|
34
34
|
import { sdkPackageSpecifier } from "../../../internal/sdk-package.js";
|
|
35
35
|
import { isRefExpr } from "../../shared/filters/ast.js";
|
|
36
|
+
import { printFilter as printCanonicalFilter } from "../../shared/filters/print.js";
|
|
36
37
|
import { UNRESOLVED_REFERENCE_MARKER } from "../filter.js";
|
|
37
38
|
// ---------------------------------------------------------------------------
|
|
38
39
|
// Factory name mapping — v1 AST `factory` → v2 factory function name.
|
|
@@ -114,6 +115,8 @@ function emptyImports() {
|
|
|
114
115
|
usesChildTask: false,
|
|
115
116
|
usesTemplate: false,
|
|
116
117
|
usesUnresolvedField: false,
|
|
118
|
+
usesUnsafePlatformId: false,
|
|
119
|
+
usesOrg: false,
|
|
117
120
|
};
|
|
118
121
|
}
|
|
119
122
|
const DEFAULT_CTX = { ctxName: "ctx" };
|
|
@@ -180,7 +183,10 @@ function printAutomation(ast, opts) {
|
|
|
180
183
|
if (ast.triggersOtherAutomations !== undefined) {
|
|
181
184
|
body.push(` triggersOtherAutomations: ${ast.triggersOtherAutomations},`);
|
|
182
185
|
}
|
|
183
|
-
body.push(`
|
|
186
|
+
body.push(` app: catalog.${opts.appRefName ?? ast.ownerHandle},`);
|
|
187
|
+
if (ast.serviceAccountName !== undefined) {
|
|
188
|
+
body.push(` serviceAccount: serviceAccountRef({ app: catalog.${opts.appRefName ?? ast.ownerHandle}, name: ${quote(ast.serviceAccountName)} }),`);
|
|
189
|
+
}
|
|
184
190
|
body.push(` status: ${quote(ast.status)},`);
|
|
185
191
|
body.push(` workflow: defineWorkflow()`);
|
|
186
192
|
body.push(`${chain.join("\n")},`);
|
|
@@ -232,6 +238,8 @@ function renderHeader(ast, imports, _opts) {
|
|
|
232
238
|
// (its v2 name collides with the automation's own const) prints as
|
|
233
239
|
// `name as alias` so the import and every call site agree.
|
|
234
240
|
const named = new Set(["defineAutomation", "defineWorkflow"]);
|
|
241
|
+
if (ast.serviceAccountName !== undefined)
|
|
242
|
+
named.add("serviceAccountRef");
|
|
235
243
|
for (const f of imports.factories)
|
|
236
244
|
named.add(f);
|
|
237
245
|
if (imports.usesChildTask)
|
|
@@ -245,15 +253,17 @@ function renderHeader(ast, imports, _opts) {
|
|
|
245
253
|
return alias ? `${name} as ${alias}` : name;
|
|
246
254
|
});
|
|
247
255
|
lines.push(`import { ${sortedSpecifiers.join(", ")} } from "${sdkPackageSpecifier("automations")}";`);
|
|
248
|
-
if (imports.usesTemplate || imports.usesUnresolvedField) {
|
|
256
|
+
if (imports.usesTemplate || imports.usesUnresolvedField || imports.usesUnsafePlatformId) {
|
|
249
257
|
const coreNamed = [];
|
|
250
258
|
if (imports.usesTemplate)
|
|
251
259
|
coreNamed.push("template");
|
|
252
260
|
if (imports.usesUnresolvedField)
|
|
253
261
|
coreNamed.push("unresolvedField");
|
|
262
|
+
if (imports.usesUnsafePlatformId)
|
|
263
|
+
coreNamed.push("unsafePlatformId");
|
|
254
264
|
lines.push(`import { ${coreNamed.join(", ")} } from "${sdkPackageSpecifier("core")}";`);
|
|
255
265
|
}
|
|
256
|
-
lines.push(`import catalog from "@catalog";`);
|
|
266
|
+
lines.push(imports.usesOrg ? `import catalog, { org } from "@catalog";` : `import catalog from "@catalog";`);
|
|
257
267
|
return lines.join("\n");
|
|
258
268
|
}
|
|
259
269
|
// ---------------------------------------------------------------------------
|
|
@@ -363,8 +373,16 @@ function printTrigger(trigger, state) {
|
|
|
363
373
|
}
|
|
364
374
|
case "dataMine": {
|
|
365
375
|
const dataMine = trackFactory("dataMine", state);
|
|
376
|
+
let datamine;
|
|
377
|
+
if (typeof trigger.datamine === "string") {
|
|
378
|
+
state.imports.usesUnsafePlatformId = true;
|
|
379
|
+
datamine = `unsafePlatformId(${quote(trigger.datamine)})`;
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
datamine = printRef(trigger.datamine, state, DEFAULT_CTX);
|
|
383
|
+
}
|
|
366
384
|
const parts = [
|
|
367
|
-
`
|
|
385
|
+
`datamine: ${datamine}`,
|
|
368
386
|
];
|
|
369
387
|
if (trigger.fireOnAlert !== undefined) {
|
|
370
388
|
parts.push(`fireOnAlert: ${trigger.fireOnAlert}`);
|
|
@@ -745,7 +763,7 @@ function taskPrimaryAppHandle(args) {
|
|
|
745
763
|
function printArgValue(name, value, state, indent, refCtx) {
|
|
746
764
|
if (isRefExpr(value))
|
|
747
765
|
return printRef(value, state, refCtx);
|
|
748
|
-
if (
|
|
766
|
+
if (isFilter(value))
|
|
749
767
|
return printFilter(value, state);
|
|
750
768
|
// executeScript body (AST key `code`, legacy `script`) — always function form.
|
|
751
769
|
if ((name === "code" || name === "script") && typeof value === "string") {
|
|
@@ -873,6 +891,13 @@ function printRef(ref, state, refCtx) {
|
|
|
873
891
|
return `catalog.${ref.appHandle}.agents${safeMember(ref.agentKey)}`;
|
|
874
892
|
case "automation":
|
|
875
893
|
return `catalog.${ref.appHandle}.automations${safeMember(ref.automationKey)}`;
|
|
894
|
+
case "phoneService":
|
|
895
|
+
return `catalog.${ref.appHandle}.phoneServices${safeMember(ref.phoneServiceKey)}`;
|
|
896
|
+
case "datamine":
|
|
897
|
+
state.imports.usesOrg = true;
|
|
898
|
+
return `org.tables.${ref.tableHandle}.datamines${safeMember(ref.datamineKey)}`;
|
|
899
|
+
case "user":
|
|
900
|
+
return `${trackFactory("userRef", state)}(${quote(ref.email)})`;
|
|
876
901
|
case "documentModel":
|
|
877
902
|
return `catalog.${ref.appHandle}.fileReaders${safeMember(ref.documentModelKey)}`;
|
|
878
903
|
case "documentModelField":
|
|
@@ -922,88 +947,18 @@ function printRef(ref, state, refCtx) {
|
|
|
922
947
|
// Filter printer — the v2 `filter.*` DSL. Namespaced under `filter`, it takes
|
|
923
948
|
// either a `FieldRef` token (`app.fields.x`) or a task/trigger `Ref`
|
|
924
949
|
// (`ctx.tasks.x.y` — for row-less contexts like switch conditions) at the
|
|
925
|
-
// left-hand position, and exposes
|
|
926
|
-
// isNotNull/inList/between/contains/overlaps/and/or/whereTrue/whereFalse`.
|
|
950
|
+
// left-hand position, and exposes the canonical filter helper namespace.
|
|
927
951
|
// One call surface regardless of what's on the left — `printFilterField`
|
|
928
952
|
// prints the LHS as either a catalog field expression or a ctx ref
|
|
929
953
|
// expression, and both are valid arguments to the same `filter.*` function.
|
|
930
954
|
// ---------------------------------------------------------------------------
|
|
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
|
-
}
|
|
955
|
+
function printFilter(filter, state) {
|
|
956
|
+
return printCanonicalFilter(filter, {
|
|
957
|
+
field: (field) => printFilterField(field, state),
|
|
958
|
+
reference: (reference) => printFilterReference(reference, state),
|
|
959
|
+
quote,
|
|
960
|
+
used: (helper) => state.imports.filterOps.add(helper),
|
|
961
|
+
});
|
|
1007
962
|
}
|
|
1008
963
|
/**
|
|
1009
964
|
* Render the left-hand side of a `filter.*` call: a `FieldRef` token
|
|
@@ -1039,32 +994,13 @@ function printFilterField(left, state) {
|
|
|
1039
994
|
* ref — the v2 filter DSL accepts refs and serializes them to the platform's
|
|
1040
995
|
* REFERENCE value shape.
|
|
1041
996
|
*/
|
|
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);
|
|
997
|
+
function printFilterReference(reference, state) {
|
|
998
|
+
if (reference.kind === "unresolved") {
|
|
999
|
+
return `${quote(`${UNRESOLVED_REFERENCE_MARKER}${reference.uuid}`)} as any /* TODO: unresolved ${reference.hint} */`;
|
|
1067
1000
|
}
|
|
1001
|
+
if (reference.kind === "literal")
|
|
1002
|
+
return literalJson(reference.value);
|
|
1003
|
+
return printRef(reference, state, DEFAULT_CTX);
|
|
1068
1004
|
}
|
|
1069
1005
|
function printSortArray(sorts, state, refCtx) {
|
|
1070
1006
|
// v2 takes `sort` as a pre-built wire object; the slice has no sort DSL. Emit
|
|
@@ -1096,14 +1032,15 @@ function printArrayLiteral(arr, state, indent, refCtx) {
|
|
|
1096
1032
|
// ---------------------------------------------------------------------------
|
|
1097
1033
|
// Heuristics / type guards
|
|
1098
1034
|
// ---------------------------------------------------------------------------
|
|
1099
|
-
function
|
|
1035
|
+
function isFilter(value) {
|
|
1100
1036
|
if (!value || typeof value !== "object")
|
|
1101
1037
|
return false;
|
|
1102
|
-
const
|
|
1103
|
-
return
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1038
|
+
const type = value.type;
|
|
1039
|
+
return typeof type === "string" && new Set([
|
|
1040
|
+
"EQUALS", "GREATER_THAN", "GREATER_THAN_EQUALS", "LESS_THAN", "LESS_THAN_EQUALS",
|
|
1041
|
+
"LIKE", "IN", "BETWEEN", "CURRENT_RANGE", "CONSECUTIVE_RANGE", "CONTAINS",
|
|
1042
|
+
"OVERLAPS", "IS_NULL", "AND", "OR", "TRUE", "FALSE",
|
|
1043
|
+
]).has(type);
|
|
1107
1044
|
}
|
|
1108
1045
|
function isSort(value) {
|
|
1109
1046
|
return (!!value &&
|