@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,101 @@
|
|
|
1
|
+
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
2
|
+
import { EntityTfError } from "../../engine/entity.js";
|
|
3
|
+
import { appScopedResourceLabel, expr, sanitizeName, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
4
|
+
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
5
|
+
import { ELEMENT_RESOURCE_TYPE } from "../element/module.js";
|
|
6
|
+
import { VISUAL_FLOW_RESOURCE_TYPE } from "./module.js";
|
|
7
|
+
function ownedResourceRef(ref, expected, ctx) {
|
|
8
|
+
if (ref.__kind !== expected || !ref.refName || ref.parent !== ctx.appRefName) {
|
|
9
|
+
throw new EntityTfError(`visual flow ${expected} must be a typed reference owned by ${ctx.appRefName}`);
|
|
10
|
+
}
|
|
11
|
+
const type = expected === "agent" ? "elementum_agent" : "elementum_automation";
|
|
12
|
+
return expr.resourceAttr(type, appScopedResourceLabel(ctx.appTfLabel, tsLabelToTfLabel(ref.refName)), ["id"]);
|
|
13
|
+
}
|
|
14
|
+
function objectRef(ref, ctx) {
|
|
15
|
+
if ((ref.__kind !== "app" && ref.__kind !== "element") || !ref.refName) {
|
|
16
|
+
throw new EntityTfError("visual flow object must be a typed app or element reference");
|
|
17
|
+
}
|
|
18
|
+
const kind = ref.__kind;
|
|
19
|
+
const type = kind === "element" ? ELEMENT_RESOURCE_TYPE : APP_RESOURCE_TYPE;
|
|
20
|
+
if (ref.refName === ctx.appRefName && kind === ctx.parentScope) {
|
|
21
|
+
return expr.resourceAttr(type, ctx.appTfLabel, ["id"]);
|
|
22
|
+
}
|
|
23
|
+
const local = ctx.workspaceAspects?.get(workspaceAspectKey(kind, ref.refName));
|
|
24
|
+
if (local !== undefined)
|
|
25
|
+
return expr.resourceAttr(type, local.tfLabel, ["id"]);
|
|
26
|
+
const name = ref.name ?? ref.refName;
|
|
27
|
+
const label = sanitizeName(name);
|
|
28
|
+
if (kind === "element")
|
|
29
|
+
ctx.orgRefs.foreignElement(label, name);
|
|
30
|
+
else
|
|
31
|
+
ctx.orgRefs.foreignApp(label, name);
|
|
32
|
+
return expr.dataAttr(type, label, ["id"]);
|
|
33
|
+
}
|
|
34
|
+
function actionToTf(action, ctx) {
|
|
35
|
+
switch (action.kind) {
|
|
36
|
+
case "agent": {
|
|
37
|
+
const ref = action.agent;
|
|
38
|
+
if (ref === undefined)
|
|
39
|
+
throw new EntityTfError("visual flow agent action is missing its agent reference");
|
|
40
|
+
return { agent: { agent_id: ownedResourceRef(ref, "agent", ctx), ...(action.name !== undefined && action.name !== "" ? { name: action.name } : {}) } };
|
|
41
|
+
}
|
|
42
|
+
case "automation": {
|
|
43
|
+
const ref = action.automation;
|
|
44
|
+
if (ref === undefined)
|
|
45
|
+
throw new EntityTfError("visual flow automation action is missing its automation reference");
|
|
46
|
+
return { automation: { automation_id: ownedResourceRef(ref, "automation", ctx), ...(action.name !== undefined && action.name !== "" ? { name: action.name } : {}) } };
|
|
47
|
+
}
|
|
48
|
+
case "user":
|
|
49
|
+
if (!action.name)
|
|
50
|
+
throw new EntityTfError("visual flow user action requires a name");
|
|
51
|
+
return { user: { name: action.name } };
|
|
52
|
+
case "api":
|
|
53
|
+
if (!action.name)
|
|
54
|
+
throw new EntityTfError("visual flow API action requires a name");
|
|
55
|
+
return { api: { name: action.name } };
|
|
56
|
+
case "object": {
|
|
57
|
+
const ref = action.object;
|
|
58
|
+
if (ref === undefined)
|
|
59
|
+
throw new EntityTfError("visual flow object action is missing its object reference");
|
|
60
|
+
return { object: { object_id: objectRef(ref, ctx), ...(action.name !== undefined && action.name !== "" ? { name: action.name } : {}) } };
|
|
61
|
+
}
|
|
62
|
+
default:
|
|
63
|
+
throw new EntityTfError("visual flow action must come from a public action factory");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export function visualFlowToTf(entity, ctx) {
|
|
67
|
+
if (entity.kind !== "visual-flow")
|
|
68
|
+
throw new EntityTfError(`visualFlowToTf expects visual-flow; got ${entity.kind}`);
|
|
69
|
+
if (ctx.parentScope !== "app" && ctx.parentScope !== "element")
|
|
70
|
+
throw new EntityTfError("visual flows can only belong to apps or elements");
|
|
71
|
+
if (ctx.parentScope === "element")
|
|
72
|
+
throw new EntityTfError("element-owned visual flows are unsupported because elements do not expose stages");
|
|
73
|
+
if (entity.parent !== ctx.appRefName)
|
|
74
|
+
throw new EntityTfError(`visual flow ${entity.refName} belongs to ${entity.parent}, not ${ctx.appRefName}`);
|
|
75
|
+
const payload = entity.payload;
|
|
76
|
+
if (payload === null)
|
|
77
|
+
throw new EntityTfError(`visual flow ${entity.refName} has no payload`);
|
|
78
|
+
const ownerType = APP_RESOURCE_TYPE;
|
|
79
|
+
const label = appScopedResourceLabel(ctx.appTfLabel, tsLabelToTfLabel(entity.refName));
|
|
80
|
+
const stages = (payload.stages ?? []).map((stage) => {
|
|
81
|
+
if (!stage.stage)
|
|
82
|
+
throw new EntityTfError(`visual flow ${entity.refName}: every stage requires a stable key`);
|
|
83
|
+
return {
|
|
84
|
+
stage_id: expr.resourceAttr(ownerType, ctx.appTfLabel, ["stage_ids_by_key", { index: tsLabelToTfLabel(stage.stage) }]),
|
|
85
|
+
nodes: Object.entries(stage.nodes ?? {}).map(([key, node]) => ({
|
|
86
|
+
key,
|
|
87
|
+
...(node.description !== undefined && { description: node.description }),
|
|
88
|
+
symbol: node.symbol ?? "SQUARE",
|
|
89
|
+
source_position: node.sourcePosition ?? "RIGHT",
|
|
90
|
+
target_position: node.targetPosition ?? "LEFT",
|
|
91
|
+
x: node.x ?? 0,
|
|
92
|
+
y: node.y ?? 0,
|
|
93
|
+
connects_to: (node.connectsTo ?? []).map((connection) => typeof connection === "string" ? { target: connection } : { target: connection.target ?? "", ...(connection.label !== undefined && { label: connection.label }) }),
|
|
94
|
+
...(node.action !== undefined && { action: actionToTf(node.action, ctx) }),
|
|
95
|
+
...(node.target?.object !== undefined && { target: { object: { object_id: objectRef(node.target.object, ctx), name: node.target.name ?? node.target.object.name ?? node.target.object.refName ?? "Object" } } }),
|
|
96
|
+
})),
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
const block = { kind: "resource", type: VISUAL_FLOW_RESOURCE_TYPE, label, attrs: { object_id: expr.resourceAttr(ownerType, ctx.appTfLabel, ["id"]), stages } };
|
|
100
|
+
return { blocks: [block], address: `${VISUAL_FLOW_RESOURCE_TYPE}.${label}` };
|
|
101
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { AppOrElementRef, AutomationRef, FieldRef } from "../../catalog/index.js";
|
|
2
|
+
import type { WorkflowFieldType } from "../shared/types/field-types.js";
|
|
3
|
+
import type { Filter } from "../shared/filters/types.js";
|
|
4
|
+
export type WidgetButtonType = "INLINE" | "PRIMARY" | "SECONDARY";
|
|
5
|
+
export interface WidgetButtonStyle {
|
|
6
|
+
readonly buttonType: WidgetButtonType;
|
|
7
|
+
readonly color?: string;
|
|
8
|
+
readonly icon?: string;
|
|
9
|
+
readonly fullWidth?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface RelatedRecordsWidget {
|
|
12
|
+
readonly type: "relatedRecords";
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly target: AppOrElementRef;
|
|
15
|
+
readonly columns?: readonly FieldRef[];
|
|
16
|
+
readonly rows?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface LinkRecordsWidget extends WidgetButtonStyle {
|
|
19
|
+
readonly type: "linkRecords";
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly target: AppOrElementRef;
|
|
22
|
+
readonly columns?: readonly FieldRef[];
|
|
23
|
+
readonly rows?: number;
|
|
24
|
+
/** Provider-native filter payload. */
|
|
25
|
+
readonly filter?: Filter;
|
|
26
|
+
}
|
|
27
|
+
export interface CreateRecordWidget extends WidgetButtonStyle {
|
|
28
|
+
readonly type: "createRecord";
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly target: AppOrElementRef;
|
|
31
|
+
}
|
|
32
|
+
interface RunAutomationWidgetParameterBase {
|
|
33
|
+
readonly name: string;
|
|
34
|
+
readonly fieldType: WorkflowFieldType;
|
|
35
|
+
readonly multiple?: boolean;
|
|
36
|
+
readonly required?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export type RunAutomationWidgetParameter = RunAutomationWidgetParameterBase & ({
|
|
39
|
+
/** Read this field from the current record. Mutually exclusive with `value`. */
|
|
40
|
+
readonly field: FieldRef;
|
|
41
|
+
readonly value?: never;
|
|
42
|
+
} | {
|
|
43
|
+
/** Static value; supports the provider's `{{field-id}}` interpolation syntax. */
|
|
44
|
+
readonly field?: never;
|
|
45
|
+
readonly value: string;
|
|
46
|
+
});
|
|
47
|
+
export interface RunAutomationWidget extends WidgetButtonStyle {
|
|
48
|
+
readonly type: "runAutomation";
|
|
49
|
+
readonly name: string;
|
|
50
|
+
readonly automation: AutomationRef;
|
|
51
|
+
readonly parameters?: readonly RunAutomationWidgetParameter[];
|
|
52
|
+
}
|
|
53
|
+
/** One record-layout display widget (`elementum_widget`). */
|
|
54
|
+
export type AppWidget = RelatedRecordsWidget | LinkRecordsWidget | CreateRecordWidget | RunAutomationWidget;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type FromTfContext } from "../../engine/pull/context.js";
|
|
2
|
+
import { type ChildResourceScope, type TfBlock } from "../../engine/tf/index.js";
|
|
3
|
+
import type { NormalizedWidget } from "../app/deserializer/normalize.js";
|
|
4
|
+
export interface WidgetOwner {
|
|
5
|
+
readonly type: "elementum_app" | "elementum_element";
|
|
6
|
+
readonly label: string;
|
|
7
|
+
readonly ownerRefName: string;
|
|
8
|
+
readonly ownerTfLabel: string;
|
|
9
|
+
readonly scope: ChildResourceScope;
|
|
10
|
+
}
|
|
11
|
+
export declare function widgetsFromTf(blocks: readonly TfBlock[], owner: WidgetOwner, ctx: FromTfContext): NormalizedWidget[];
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { dataRefLabel, optionalBoolean, optionalString, plainObject, resourceRefLabel } from "../../engine/pull/context.js";
|
|
2
|
+
import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
3
|
+
import { AUTOMATION_RESOURCE_TYPE } from "../automation/types.js";
|
|
4
|
+
import { fieldKeyFromTfRef } from "../field/from-tf.js";
|
|
5
|
+
import { SUB_TYPE_BY_RESOURCE } from "../field/types.js";
|
|
6
|
+
import { WIDGET_RESOURCE_TYPE } from "./module.js";
|
|
7
|
+
import { filterFromTf } from "../access-policy/from-tf.js";
|
|
8
|
+
const KNOWN_ROOT_ATTRS = new Set(["object_id", "related_object", "related_link_action", "related_create_action", "run_automation_action"]);
|
|
9
|
+
export function widgetsFromTf(blocks, owner, ctx) {
|
|
10
|
+
const out = [];
|
|
11
|
+
for (const block of blocks) {
|
|
12
|
+
const widget = widgetFromTf(block, owner, ctx);
|
|
13
|
+
if (widget !== undefined)
|
|
14
|
+
out.push(widget);
|
|
15
|
+
}
|
|
16
|
+
return out;
|
|
17
|
+
}
|
|
18
|
+
function widgetFromTf(block, owner, ctx) {
|
|
19
|
+
const label = block.label ?? "";
|
|
20
|
+
const where = `${WIDGET_RESOURCE_TYPE}.${label || "?"}`;
|
|
21
|
+
for (const attr of Object.keys(block.attrs)) {
|
|
22
|
+
if (!KNOWN_ROOT_ATTRS.has(attr))
|
|
23
|
+
ctx.diagnostics.push(`${where}: unhandled attribute ${JSON.stringify(attr)}; extend widget extraction`);
|
|
24
|
+
}
|
|
25
|
+
if (resourceRefLabel(block.attrs["object_id"], owner.type) !== owner.label)
|
|
26
|
+
return undefined;
|
|
27
|
+
const key = scopedLabelToBagKey(owner.ownerTfLabel, label, owner.scope);
|
|
28
|
+
const variants = ["related_object", "related_link_action", "related_create_action", "run_automation_action"]
|
|
29
|
+
.filter((attr) => block.attrs[attr] !== undefined);
|
|
30
|
+
if (variants.length !== 1) {
|
|
31
|
+
ctx.diagnostics.push(`${where}: expected exactly one widget variant, found ${variants.length}; skipped`);
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
const variant = variants[0];
|
|
35
|
+
const body = plainObject(block.attrs[variant]);
|
|
36
|
+
if (body === undefined) {
|
|
37
|
+
ctx.diagnostics.push(`${where}.${variant}: expected an object; skipped`);
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
const name = optionalString(body, "name", `${where}.${variant}`, ctx) ?? "";
|
|
41
|
+
if (variant === "related_object") {
|
|
42
|
+
const target = aspectRef(body["object_id"], owner, ctx);
|
|
43
|
+
if (target === undefined)
|
|
44
|
+
return undefined;
|
|
45
|
+
return {
|
|
46
|
+
key,
|
|
47
|
+
type: "relatedRecords",
|
|
48
|
+
name,
|
|
49
|
+
target,
|
|
50
|
+
...columnsAndRows(body, target, owner, ctx, `${where}.${variant}`),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (variant === "related_link_action") {
|
|
54
|
+
const target = aspectRef(body["object_id"], owner, ctx);
|
|
55
|
+
if (target === undefined)
|
|
56
|
+
return undefined;
|
|
57
|
+
const filterOwner = typeof target !== "string" && (target.kind === "app" || target.kind === "element")
|
|
58
|
+
? { type: `elementum_${target.kind}`, label: target.key, ownerRefName: target.key, ownerTfLabel: target.key, scope: target.kind }
|
|
59
|
+
: { type: owner.type, label: owner.label, ownerRefName: owner.ownerRefName, ownerTfLabel: owner.ownerTfLabel, scope: owner.scope };
|
|
60
|
+
const filter = body["filter"] === undefined
|
|
61
|
+
? undefined
|
|
62
|
+
: filterFromTf(body["filter"], filterOwner, `${where}.${variant}.filter`);
|
|
63
|
+
return {
|
|
64
|
+
key,
|
|
65
|
+
type: "linkRecords",
|
|
66
|
+
name,
|
|
67
|
+
target,
|
|
68
|
+
...buttonStyle(body, where, ctx),
|
|
69
|
+
...columnsAndRows(body, target, owner, ctx, `${where}.${variant}`),
|
|
70
|
+
...(filter !== undefined && { filter }),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (variant === "related_create_action") {
|
|
74
|
+
const target = aspectRef(body["object_id"], owner, ctx);
|
|
75
|
+
if (target === undefined)
|
|
76
|
+
return undefined;
|
|
77
|
+
return { key, type: "createRecord", name, target, ...buttonStyle(body, where, ctx) };
|
|
78
|
+
}
|
|
79
|
+
const automation = automationRef(body["automation_id"], owner);
|
|
80
|
+
if (automation === undefined) {
|
|
81
|
+
ctx.diagnostics.push(`${where}.run_automation_action: automation_id is not resolvable; skipped`);
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
const parametersRaw = body["parameters"];
|
|
85
|
+
const parameters = Array.isArray(parametersRaw)
|
|
86
|
+
? parametersRaw.flatMap((raw, index) => {
|
|
87
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw) || isTfExpr(raw)) {
|
|
88
|
+
ctx.diagnostics.push(`${where}.run_automation_action.parameters[${index}]: expected an object; dropped`);
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
const rec = raw;
|
|
92
|
+
const field = ownerFieldRef(rec["field_id"], owner);
|
|
93
|
+
return [{
|
|
94
|
+
name: typeof rec["name"] === "string" ? rec["name"] : "",
|
|
95
|
+
fieldType: typeof rec["field_type"] === "string" ? rec["field_type"] : "TEXT",
|
|
96
|
+
multiple: rec["multiple"] === true,
|
|
97
|
+
required: rec["required"] === true,
|
|
98
|
+
...(field !== undefined && { field }),
|
|
99
|
+
...(typeof rec["value"] === "string" && { value: rec["value"] }),
|
|
100
|
+
}];
|
|
101
|
+
})
|
|
102
|
+
: undefined;
|
|
103
|
+
if (parametersRaw !== undefined && !Array.isArray(parametersRaw)) {
|
|
104
|
+
ctx.diagnostics.push(`${where}.run_automation_action.parameters: expected a list; dropped`);
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
key,
|
|
108
|
+
type: "runAutomation",
|
|
109
|
+
name,
|
|
110
|
+
automation,
|
|
111
|
+
...buttonStyle(body, where, ctx),
|
|
112
|
+
...(parameters !== undefined && { parameters }),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function buttonStyle(attrs, where, ctx) {
|
|
116
|
+
const buttonTypeRaw = optionalString(attrs, "button_type", where, ctx) ?? "INLINE";
|
|
117
|
+
const buttonType = buttonTypeRaw === "PRIMARY" || buttonTypeRaw === "SECONDARY" ? buttonTypeRaw : "INLINE";
|
|
118
|
+
const color = optionalString(attrs, "color", where, ctx);
|
|
119
|
+
const icon = optionalString(attrs, "icon", where, ctx);
|
|
120
|
+
const fullWidth = optionalBoolean(attrs, "full_width", where, ctx);
|
|
121
|
+
return {
|
|
122
|
+
buttonType,
|
|
123
|
+
...(color !== undefined && { color }),
|
|
124
|
+
...(icon !== undefined && { icon }),
|
|
125
|
+
...(fullWidth !== undefined && { fullWidth }),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function columnsAndRows(attrs, target, owner, ctx, where) {
|
|
129
|
+
const columnsRaw = attrs["columns"];
|
|
130
|
+
let columns;
|
|
131
|
+
if (Array.isArray(columnsRaw)) {
|
|
132
|
+
columns = columnsRaw.flatMap((value, index) => {
|
|
133
|
+
const decoded = widgetFieldRef(value, target, owner, ctx);
|
|
134
|
+
if (decoded === undefined) {
|
|
135
|
+
ctx.diagnostics.push(`${where}.columns[${index}]: field reference is not resolvable; dropped`);
|
|
136
|
+
return [];
|
|
137
|
+
}
|
|
138
|
+
return [decoded];
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
else if (columnsRaw !== undefined) {
|
|
142
|
+
ctx.diagnostics.push(`${where}.columns: expected a list; dropped`);
|
|
143
|
+
}
|
|
144
|
+
const rows = typeof attrs["rows"] === "number" ? attrs["rows"] : undefined;
|
|
145
|
+
return { ...(columns !== undefined && { columns }), ...(rows !== undefined && { rows }) };
|
|
146
|
+
}
|
|
147
|
+
function aspectRef(value, owner, ctx) {
|
|
148
|
+
if (typeof value === "string")
|
|
149
|
+
return value;
|
|
150
|
+
if (resourceRefLabel(value, owner.type) === owner.label) {
|
|
151
|
+
return { kind: owner.scope, key: owner.ownerRefName, name: owner.ownerRefName };
|
|
152
|
+
}
|
|
153
|
+
for (const [type, kind] of [["elementum_app", "app"], ["elementum_element", "element"]]) {
|
|
154
|
+
const resourceLabel = resourceRefLabel(value, type);
|
|
155
|
+
if (resourceLabel !== undefined)
|
|
156
|
+
return { kind, key: tfLabelToTsLabel(resourceLabel), name: tfLabelToTsLabel(resourceLabel) };
|
|
157
|
+
const dataLabel = dataRefLabel(value, type);
|
|
158
|
+
if (dataLabel !== undefined) {
|
|
159
|
+
const name = ctx.dataName(type, dataLabel) ?? tfLabelToTsLabel(dataLabel);
|
|
160
|
+
return { kind, key: tfLabelToTsLabel(dataLabel), name };
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
165
|
+
function widgetFieldRef(value, target, owner, ctx) {
|
|
166
|
+
if (typeof value === "string")
|
|
167
|
+
return value;
|
|
168
|
+
const targetLabel = typeof target === "string" ? undefined : target.key === owner.ownerRefName ? owner.ownerTfLabel : target.key;
|
|
169
|
+
const targetScope = typeof target === "string" || target.kind === "automation" || target.kind === "field" ? owner.scope : target.kind;
|
|
170
|
+
if (targetLabel !== undefined) {
|
|
171
|
+
const key = fieldKeyFromTfRef(value, targetLabel, targetScope);
|
|
172
|
+
if (key !== undefined) {
|
|
173
|
+
return { kind: "field", key, name: key, ...(typeof target !== "string" && { parent: target.key }), fieldType: "TEXT" };
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const dataLabel = dataRefLabel(value, "elementum_field");
|
|
177
|
+
if (dataLabel !== undefined) {
|
|
178
|
+
const name = ctx.dataName("elementum_field", dataLabel) ?? tfLabelToTsLabel(dataLabel);
|
|
179
|
+
return { kind: "field", key: tfLabelToTsLabel(dataLabel), name, ...(typeof target !== "string" && { parent: target.key }), fieldType: "TEXT" };
|
|
180
|
+
}
|
|
181
|
+
if (isTfExpr(value) && value.$expr === "resource-attr" && value.path.length === 1 && value.path[0] === "id") {
|
|
182
|
+
const subType = SUB_TYPE_BY_RESOURCE.get(value.type);
|
|
183
|
+
if (subType !== undefined) {
|
|
184
|
+
return { kind: "field", key: tfLabelToTsLabel(value.label), name: tfLabelToTsLabel(value.label), ...(typeof target !== "string" && { parent: target.key }), fieldType: subType.authoringType };
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return undefined;
|
|
188
|
+
}
|
|
189
|
+
function automationRef(value, owner) {
|
|
190
|
+
if (typeof value === "string")
|
|
191
|
+
return value;
|
|
192
|
+
const label = resourceRefLabel(value, AUTOMATION_RESOURCE_TYPE);
|
|
193
|
+
if (label === undefined)
|
|
194
|
+
return undefined;
|
|
195
|
+
return {
|
|
196
|
+
kind: "automation",
|
|
197
|
+
key: scopedLabelToBagKey(owner.ownerTfLabel, label, owner.scope),
|
|
198
|
+
name: scopedLabelToBagKey(owner.ownerTfLabel, label, owner.scope),
|
|
199
|
+
parent: owner.ownerRefName,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function ownerFieldRef(value, owner) {
|
|
203
|
+
if (value === undefined || value === null)
|
|
204
|
+
return undefined;
|
|
205
|
+
if (typeof value === "string")
|
|
206
|
+
return value;
|
|
207
|
+
const key = fieldKeyFromTfRef(value, owner.ownerTfLabel, owner.scope);
|
|
208
|
+
return key === undefined ? undefined : { kind: "field", key, name: key, parent: owner.ownerRefName, fieldType: "TEXT" };
|
|
209
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NO_CANVAS, NO_CATALOG, NO_DATA, NO_LIFECYCLE } from "../../graph/types.js";
|
|
2
|
+
export const WIDGET_RESOURCE_TYPE = "elementum_widget";
|
|
3
|
+
export const widgetModule = {
|
|
4
|
+
kind: "widget",
|
|
5
|
+
stream: { role: "streamMember" },
|
|
6
|
+
authoring: { unit: "inline", bag: "widgets" },
|
|
7
|
+
parents: [
|
|
8
|
+
{ parent: "app", child: "widget" },
|
|
9
|
+
{ parent: "element", child: "widget" },
|
|
10
|
+
],
|
|
11
|
+
resource: { shape: "single", resourceType: WIDGET_RESOURCE_TYPE, adoptable: true },
|
|
12
|
+
data: NO_DATA,
|
|
13
|
+
lifecycle: NO_LIFECYCLE,
|
|
14
|
+
canvas: NO_CANVAS,
|
|
15
|
+
catalog: NO_CATALOG,
|
|
16
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type OrgRefLookup, type WorkspaceAspect } from "../../engine/build/context.js";
|
|
2
|
+
import { type ChildResourceScope, type TfBlock, type TfValue } from "../../engine/tf/index.js";
|
|
3
|
+
import type { Filter } from "../shared/filters/types.js";
|
|
4
|
+
interface RefWire {
|
|
5
|
+
readonly __kind?: string;
|
|
6
|
+
readonly refName?: string;
|
|
7
|
+
readonly name?: string;
|
|
8
|
+
readonly parent?: string;
|
|
9
|
+
readonly fieldType?: string;
|
|
10
|
+
}
|
|
11
|
+
interface WidgetParameterWire {
|
|
12
|
+
readonly name?: string;
|
|
13
|
+
readonly fieldType?: string;
|
|
14
|
+
readonly multiple?: boolean;
|
|
15
|
+
readonly required?: boolean;
|
|
16
|
+
readonly field?: RefWire | string;
|
|
17
|
+
readonly value?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface AppWidgetWire {
|
|
20
|
+
readonly type?: "relatedRecords" | "linkRecords" | "createRecord" | "runAutomation";
|
|
21
|
+
readonly name?: string;
|
|
22
|
+
readonly target?: RefWire | string;
|
|
23
|
+
readonly columns?: readonly (RefWire | string)[];
|
|
24
|
+
readonly rows?: number;
|
|
25
|
+
readonly buttonType?: "INLINE" | "PRIMARY" | "SECONDARY";
|
|
26
|
+
readonly color?: string;
|
|
27
|
+
readonly icon?: string;
|
|
28
|
+
readonly fullWidth?: boolean;
|
|
29
|
+
readonly filter?: Filter;
|
|
30
|
+
readonly automation?: RefWire | string;
|
|
31
|
+
readonly parameters?: readonly WidgetParameterWire[];
|
|
32
|
+
}
|
|
33
|
+
export interface WidgetsToTfOptions {
|
|
34
|
+
readonly ownerRefName: string;
|
|
35
|
+
readonly ownerTfLabel: string;
|
|
36
|
+
readonly ownerType: "elementum_app" | "elementum_element";
|
|
37
|
+
readonly scope: ChildResourceScope;
|
|
38
|
+
readonly objectId: TfValue;
|
|
39
|
+
readonly orgRefs: OrgRefLookup;
|
|
40
|
+
readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
|
|
41
|
+
readonly diagnostics: string[];
|
|
42
|
+
}
|
|
43
|
+
export declare function widgetsToTf(widgets: Readonly<Record<string, AppWidgetWire>> | undefined, opts: WidgetsToTfOptions): TfBlock[];
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
2
|
+
import { expr, isCanonicalTsLabel, sanitizeName, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
3
|
+
import { AUTOMATION_RESOURCE_TYPE } from "../automation/types.js";
|
|
4
|
+
import { fieldRefToTfValue } from "../field/to-tf.js";
|
|
5
|
+
import { WIDGET_RESOURCE_TYPE } from "./module.js";
|
|
6
|
+
import { filterToTf } from "../access-policy/to-tf.js";
|
|
7
|
+
export function widgetsToTf(widgets, opts) {
|
|
8
|
+
const blocks = [];
|
|
9
|
+
for (const [key, widget] of Object.entries(widgets ?? {})) {
|
|
10
|
+
const where = `widgets.${key}`;
|
|
11
|
+
if (!isCanonicalTsLabel(key)) {
|
|
12
|
+
opts.diagnostics.push(`${where}: key is not a canonical tsLabel; dropped`);
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
const attrs = { object_id: opts.objectId };
|
|
16
|
+
switch (widget.type) {
|
|
17
|
+
case "relatedRecords": {
|
|
18
|
+
const target = resolveAspect(widget.target, `${where}.target`, opts);
|
|
19
|
+
if (target === undefined)
|
|
20
|
+
continue;
|
|
21
|
+
const body = { name: widget.name ?? "", object_id: target.value };
|
|
22
|
+
const columns = resolveColumns(widget.columns, target, `${where}.columns`, opts);
|
|
23
|
+
if (columns.length > 0)
|
|
24
|
+
body["columns"] = columns;
|
|
25
|
+
if (widget.rows !== undefined)
|
|
26
|
+
body["rows"] = widget.rows;
|
|
27
|
+
attrs["related_object"] = body;
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
case "linkRecords": {
|
|
31
|
+
const target = resolveAspect(widget.target, `${where}.target`, opts);
|
|
32
|
+
if (target === undefined)
|
|
33
|
+
continue;
|
|
34
|
+
const body = buttonBody(widget);
|
|
35
|
+
body["object_id"] = target.value;
|
|
36
|
+
const columns = resolveColumns(widget.columns, target, `${where}.columns`, opts);
|
|
37
|
+
if (columns.length > 0)
|
|
38
|
+
body["columns"] = columns;
|
|
39
|
+
if (widget.rows !== undefined)
|
|
40
|
+
body["rows"] = widget.rows;
|
|
41
|
+
if (widget.filter !== undefined)
|
|
42
|
+
body["filter"] = filterToTf(widget.filter, `${where}.filter`, {
|
|
43
|
+
ownerTfLabel: opts.ownerTfLabel,
|
|
44
|
+
scope: opts.scope,
|
|
45
|
+
objectId: opts.objectId,
|
|
46
|
+
diagnostics: opts.diagnostics,
|
|
47
|
+
orgRefs: opts.orgRefs,
|
|
48
|
+
});
|
|
49
|
+
attrs["related_link_action"] = body;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
case "createRecord": {
|
|
53
|
+
const target = resolveAspect(widget.target, `${where}.target`, opts);
|
|
54
|
+
if (target === undefined)
|
|
55
|
+
continue;
|
|
56
|
+
const body = buttonBody(widget);
|
|
57
|
+
body["object_id"] = target.value;
|
|
58
|
+
attrs["related_create_action"] = body;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
case "runAutomation": {
|
|
62
|
+
const automationId = resolveAutomation(widget.automation, `${where}.automation`, opts);
|
|
63
|
+
if (automationId === undefined)
|
|
64
|
+
continue;
|
|
65
|
+
const body = buttonBody(widget);
|
|
66
|
+
body["automation_id"] = automationId;
|
|
67
|
+
if (widget.parameters !== undefined) {
|
|
68
|
+
body["parameters"] = widget.parameters.map((parameter, index) => {
|
|
69
|
+
const fieldId = resolveOwnerField(parameter.field, `${where}.parameters[${index}].field`, opts);
|
|
70
|
+
if (fieldId !== undefined && parameter.value !== undefined) {
|
|
71
|
+
opts.diagnostics.push(`${where}.parameters[${index}]: field and value are mutually exclusive; value dropped`);
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
name: parameter.name ?? "",
|
|
75
|
+
field_type: parameter.fieldType ?? "TEXT",
|
|
76
|
+
multiple: parameter.multiple ?? false,
|
|
77
|
+
required: parameter.required ?? false,
|
|
78
|
+
field_id: fieldId ?? null,
|
|
79
|
+
value: fieldId === undefined ? parameter.value ?? null : null,
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
attrs["run_automation_action"] = body;
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
default:
|
|
87
|
+
opts.diagnostics.push(`${where}: unsupported widget type ${JSON.stringify(widget.type)}; dropped`);
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
blocks.push({
|
|
91
|
+
kind: "resource",
|
|
92
|
+
type: WIDGET_RESOURCE_TYPE,
|
|
93
|
+
label: scopedResourceLabel(opts.ownerTfLabel, tsLabelToTfLabel(key), opts.scope),
|
|
94
|
+
attrs,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return blocks;
|
|
98
|
+
}
|
|
99
|
+
function buttonBody(widget) {
|
|
100
|
+
const body = {
|
|
101
|
+
name: widget.name ?? "",
|
|
102
|
+
button_type: widget.buttonType ?? "INLINE",
|
|
103
|
+
};
|
|
104
|
+
if (widget.color !== undefined)
|
|
105
|
+
body["color"] = widget.color;
|
|
106
|
+
if (widget.icon !== undefined)
|
|
107
|
+
body["icon"] = widget.icon;
|
|
108
|
+
if (widget.fullWidth !== undefined)
|
|
109
|
+
body["full_width"] = widget.fullWidth;
|
|
110
|
+
return body;
|
|
111
|
+
}
|
|
112
|
+
function resolveAspect(value, where, opts) {
|
|
113
|
+
if (typeof value === "string")
|
|
114
|
+
return { value, managed: false };
|
|
115
|
+
const kind = value?.__kind === "element" ? "element" : "app";
|
|
116
|
+
const refName = value?.refName ?? "";
|
|
117
|
+
if (kind === opts.scope && refName === opts.ownerRefName) {
|
|
118
|
+
return { value: opts.objectId, kind, refName, tfLabel: opts.ownerTfLabel, managed: true };
|
|
119
|
+
}
|
|
120
|
+
const sibling = opts.workspaceAspects?.get(workspaceAspectKey(kind, refName));
|
|
121
|
+
if (sibling !== undefined) {
|
|
122
|
+
const type = kind === "app" ? "elementum_app" : "elementum_element";
|
|
123
|
+
return { value: expr.resourceAttr(type, sibling.tfLabel, ["id"]), kind, refName, tfLabel: sibling.tfLabel, managed: true };
|
|
124
|
+
}
|
|
125
|
+
const name = value?.name ?? refName;
|
|
126
|
+
if (name === "") {
|
|
127
|
+
opts.diagnostics.push(`${where}: target has no name/refName; dropped`);
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
const label = sanitizeName(name);
|
|
131
|
+
if (kind === "app")
|
|
132
|
+
opts.orgRefs.foreignApp(label, name);
|
|
133
|
+
else
|
|
134
|
+
opts.orgRefs.foreignElement(label, name);
|
|
135
|
+
return {
|
|
136
|
+
value: expr.dataAttr(kind === "app" ? "elementum_app" : "elementum_element", label, ["id"]),
|
|
137
|
+
kind,
|
|
138
|
+
refName,
|
|
139
|
+
tfLabel: label,
|
|
140
|
+
managed: false,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function resolveColumns(columns, target, where, opts) {
|
|
144
|
+
const out = [];
|
|
145
|
+
for (const [index, value] of (columns ?? []).entries()) {
|
|
146
|
+
if (typeof value === "string") {
|
|
147
|
+
out.push(value);
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
const refName = value.refName ?? "";
|
|
151
|
+
if (refName === "") {
|
|
152
|
+
opts.diagnostics.push(`${where}[${index}]: field has no refName; dropped`);
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
if (value.parent !== undefined && target.refName !== undefined && value.parent !== target.refName) {
|
|
156
|
+
opts.diagnostics.push(`${where}[${index}]: field belongs to ${JSON.stringify(value.parent)}, not target ${JSON.stringify(target.refName)}; dropped`);
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
if (target.managed && target.kind !== undefined && target.tfLabel !== undefined) {
|
|
160
|
+
const direct = fieldRefToTfValue(value.fieldType ?? "", refName, target.tfLabel, target.kind);
|
|
161
|
+
if (direct !== undefined) {
|
|
162
|
+
out.push(direct);
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (target.kind !== undefined) {
|
|
167
|
+
const label = sanitizeName(`${target.kind}_${target.tfLabel ?? target.refName ?? "target"}_${value.name ?? refName}`);
|
|
168
|
+
opts.orgRefs.foreignField("elementum_field", label, target.value, value.name ?? refName);
|
|
169
|
+
out.push(expr.dataAttr("elementum_field", label, ["id"]));
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
opts.diagnostics.push(`${where}[${index}]: a typed field needs a typed app/element target; dropped`);
|
|
173
|
+
}
|
|
174
|
+
return out;
|
|
175
|
+
}
|
|
176
|
+
function resolveAutomation(value, where, opts) {
|
|
177
|
+
if (typeof value === "string")
|
|
178
|
+
return value;
|
|
179
|
+
const refName = value?.refName ?? "";
|
|
180
|
+
if (refName === "") {
|
|
181
|
+
opts.diagnostics.push(`${where}: automation has no refName; dropped`);
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
if (value?.parent !== undefined && value.parent !== opts.ownerRefName) {
|
|
185
|
+
opts.diagnostics.push(`${where}: foreign automation references require a provider data lookup with app_id; use a raw id until that data-source tranche lands`);
|
|
186
|
+
return undefined;
|
|
187
|
+
}
|
|
188
|
+
return expr.resourceAttr(AUTOMATION_RESOURCE_TYPE, scopedResourceLabel(opts.ownerTfLabel, tsLabelToTfLabel(refName), opts.scope), ["id"]);
|
|
189
|
+
}
|
|
190
|
+
function resolveOwnerField(value, where, opts) {
|
|
191
|
+
if (typeof value === "string")
|
|
192
|
+
return value;
|
|
193
|
+
if (value === undefined)
|
|
194
|
+
return undefined;
|
|
195
|
+
const refName = value.refName ?? "";
|
|
196
|
+
if (value.parent !== undefined && value.parent !== opts.ownerRefName) {
|
|
197
|
+
opts.diagnostics.push(`${where}: field belongs to a different aspect; dropped`);
|
|
198
|
+
return undefined;
|
|
199
|
+
}
|
|
200
|
+
const resolved = fieldRefToTfValue(value.fieldType ?? "", refName, opts.ownerTfLabel, opts.scope);
|
|
201
|
+
if (resolved === undefined)
|
|
202
|
+
opts.diagnostics.push(`${where}: field ${JSON.stringify(refName)} has no Terraform mapping; dropped`);
|
|
203
|
+
return resolved;
|
|
204
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Moves onto each kind's CatalogFacet when its module lands.
|
|
4
4
|
*/
|
|
5
5
|
import type { CatalogRenderArgs, CatalogRenderResult } from "./types.js";
|
|
6
|
-
/** Simple `{ name }` / optional parent
|
|
6
|
+
/** Simple `{ name }` / optional parent for deferred catalog stubs. */
|
|
7
7
|
export declare function renderDeferredNamedEntry(factoryName: string, opts?: {
|
|
8
8
|
readonly omitParent?: boolean;
|
|
9
9
|
}): (args: CatalogRenderArgs) => CatalogRenderResult;
|