@elementumai/edk 0.8.2-alpha.5 → 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
|
@@ -134,7 +134,7 @@ export function dataMine(opts) {
|
|
|
134
134
|
return chainableTrigger({
|
|
135
135
|
wire: {
|
|
136
136
|
datamine: {
|
|
137
|
-
datamineId: opts.
|
|
137
|
+
datamineId: opts.datamine,
|
|
138
138
|
type: "DATAMINE",
|
|
139
139
|
...(opts.fireOnAlert !== undefined ? { fireOnAlert: opts.fireOnAlert } : {}),
|
|
140
140
|
...(opts.fireOnRecovery !== undefined ? { fireOnRecovery: opts.fireOnRecovery } : {}),
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AppOrElementRef } from "../../catalog/index.js";
|
|
2
|
+
import type { Filter } from "../shared/filters/types.js";
|
|
3
|
+
export type DashboardWidgetSize = "EXTRA_SMALL" | "SMALL" | "MEDIUM" | "LARGE" | "EXTRA_LARGE";
|
|
4
|
+
interface DashboardWidgetBase {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly size?: DashboardWidgetSize;
|
|
7
|
+
readonly color?: string;
|
|
8
|
+
readonly icon?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DashboardRecordsWidget extends DashboardWidgetBase {
|
|
11
|
+
readonly type: "records";
|
|
12
|
+
readonly target: AppOrElementRef;
|
|
13
|
+
readonly filter?: Filter;
|
|
14
|
+
readonly sort?: unknown;
|
|
15
|
+
}
|
|
16
|
+
export type DashboardWidget = DashboardRecordsWidget;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type FromTfContext } from "../../engine/pull/context.js";
|
|
2
|
+
import { type ChildResourceScope, type TfBlock } from "../../engine/tf/index.js";
|
|
3
|
+
import type { NormalizedDashboard } from "../app/deserializer/normalize.js";
|
|
4
|
+
export interface DashboardOwner {
|
|
5
|
+
readonly type: "elementum_app" | "elementum_element";
|
|
6
|
+
readonly label: string;
|
|
7
|
+
readonly ownerTfLabel: string;
|
|
8
|
+
readonly ownerRefName?: string;
|
|
9
|
+
readonly scope: ChildResourceScope;
|
|
10
|
+
readonly ownerType: "APP_ASPECT" | "ELEMENT_ASPECT";
|
|
11
|
+
}
|
|
12
|
+
export declare function dashboardsFromTf(blocks: readonly TfBlock[], widgetBlocks: readonly TfBlock[], owner: DashboardOwner, ctx: FromTfContext): NormalizedDashboard[];
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { dataRefLabel, optionalString, plainObject, resourceRefLabel } from "../../engine/pull/context.js";
|
|
2
|
+
import { reportUnknownAttrs, stringList } from "../../engine/pull/attrs.js";
|
|
3
|
+
import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
4
|
+
import { filterFromTf } from "../access-policy/from-tf.js";
|
|
5
|
+
import { filterWireToTf } from "../shared/filters/tf-codec.js";
|
|
6
|
+
import { DASHBOARD_WIDGET_RESOURCE_TYPE } from "../dashboard-widget/module.js";
|
|
7
|
+
import { DASHBOARD_RESOURCE_TYPE } from "./module.js";
|
|
8
|
+
const KNOWN_DASHBOARD_ATTRS = new Set(["name", "owner_id", "owner_type", "favorite", "tags"]);
|
|
9
|
+
export function dashboardsFromTf(blocks, widgetBlocks, owner, ctx) {
|
|
10
|
+
const dashboards = [];
|
|
11
|
+
for (const block of blocks) {
|
|
12
|
+
const label = block.label;
|
|
13
|
+
if (label === undefined || label === "") {
|
|
14
|
+
ctx.diagnostics.push(`${DASHBOARD_RESOURCE_TYPE} block is missing its label; skipped`);
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
const where = `dashboard "${label}"`;
|
|
18
|
+
reportUnknownAttrs(block.attrs, KNOWN_DASHBOARD_ATTRS, where, "dashboardsFromTf", ctx);
|
|
19
|
+
if (resourceRefLabel(block.attrs["owner_id"], owner.type) !== owner.label) {
|
|
20
|
+
ctx.diagnostics.push(`${where}: owner_id does not reference ${owner.type}.${owner.label}; skipped`);
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
if (block.attrs["owner_type"] !== owner.ownerType) {
|
|
24
|
+
ctx.diagnostics.push(`${where}: owner_type is not ${owner.ownerType}; skipped`);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
const tags = stringList(block.attrs, "tags", where, ctx);
|
|
28
|
+
const key = scopedLabelToBagKey(owner.ownerTfLabel, label, owner.scope);
|
|
29
|
+
const widgets = dashboardWidgetsFromTf(widgetBlocks.filter((widget) => resourceRefLabel(widget.attrs["dashboard_id"], DASHBOARD_RESOURCE_TYPE) === label), label, owner, ctx);
|
|
30
|
+
dashboards.push({
|
|
31
|
+
key,
|
|
32
|
+
name: optionalString(block.attrs, "name", where, ctx) ?? "",
|
|
33
|
+
...(typeof block.attrs["favorite"] === "boolean" && { favorite: block.attrs["favorite"] }),
|
|
34
|
+
...(tags !== undefined && { tags }),
|
|
35
|
+
...(widgets.length > 0 && { widgets }),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return dashboards;
|
|
39
|
+
}
|
|
40
|
+
function dashboardWidgetsFromTf(blocks, dashboardLabel, owner, ctx) {
|
|
41
|
+
return blocks.flatMap((block) => {
|
|
42
|
+
const where = `${DASHBOARD_WIDGET_RESOURCE_TYPE}.${block.label ?? "?"}`;
|
|
43
|
+
const label = block.label ?? "";
|
|
44
|
+
const key = tfLabelToTsLabel(label.startsWith(`${dashboardLabel}_`) ? label.slice(dashboardLabel.length + 1) : label);
|
|
45
|
+
const name = optionalString(block.attrs, "name", where, ctx) ?? "";
|
|
46
|
+
const size = optionalString(block.attrs, "size", where, ctx) ?? "MEDIUM";
|
|
47
|
+
const color = optionalString(block.attrs, "color", where, ctx);
|
|
48
|
+
const icon = optionalString(block.attrs, "icon", where, ctx);
|
|
49
|
+
const aspect = plainObject(block.attrs["aspect_widget"]);
|
|
50
|
+
if (aspect === undefined) {
|
|
51
|
+
ctx.diagnostics.push(`${where}: expected an aspect_widget; skipped`);
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
const style = { key, name, size, ...(color !== undefined && { color }), ...(icon !== undefined && { icon }) };
|
|
55
|
+
const target = aspectRef(aspect["aspect_id"], owner, ctx);
|
|
56
|
+
if (target === undefined) {
|
|
57
|
+
ctx.diagnostics.push(`${where}.aspect_widget.aspect_id: unresolved; skipped`);
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
return [{ ...style, type: "records", target,
|
|
61
|
+
...(aspect["filter"] !== undefined && {
|
|
62
|
+
filter: filterFromTf(filterWireToTf(decodeJson(aspect["filter"])), { ...owner, ownerRefName: owner.ownerRefName ?? owner.ownerTfLabel }, `${where}.aspect_widget.filter`),
|
|
63
|
+
}),
|
|
64
|
+
...(aspect["sort"] !== undefined && { sort: decodeJson(aspect["sort"]) }),
|
|
65
|
+
}];
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function aspectRef(value, owner, ctx) {
|
|
69
|
+
if (typeof value === "string")
|
|
70
|
+
return value;
|
|
71
|
+
if (resourceRefLabel(value, owner.type) === owner.label)
|
|
72
|
+
return { kind: owner.scope, key: owner.ownerTfLabel, name: owner.ownerTfLabel };
|
|
73
|
+
for (const [type, kind] of [["elementum_app", "app"], ["elementum_element", "element"]]) {
|
|
74
|
+
const resourceLabel = resourceRefLabel(value, type);
|
|
75
|
+
if (resourceLabel !== undefined)
|
|
76
|
+
return { kind, key: tfLabelToTsLabel(resourceLabel), name: tfLabelToTsLabel(resourceLabel) };
|
|
77
|
+
const dataLabel = dataRefLabel(value, type);
|
|
78
|
+
if (dataLabel !== undefined)
|
|
79
|
+
return { kind, key: tfLabelToTsLabel(dataLabel), name: ctx.dataName(type, dataLabel) ?? tfLabelToTsLabel(dataLabel) };
|
|
80
|
+
}
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
function decodeJson(value) {
|
|
84
|
+
if (isTfExpr(value) && value.$expr === "jsonencode")
|
|
85
|
+
return value.value;
|
|
86
|
+
if (typeof value === "string") {
|
|
87
|
+
try {
|
|
88
|
+
return JSON.parse(value);
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
return value;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return value;
|
|
95
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NO_CANVAS, NO_CATALOG, NO_LIFECYCLE } from "../../graph/types.js";
|
|
2
|
+
export const DASHBOARD_RESOURCE_TYPE = "elementum_dashboard";
|
|
3
|
+
export const dashboardModule = {
|
|
4
|
+
kind: "dashboard",
|
|
5
|
+
stream: { role: "streamMember" },
|
|
6
|
+
authoring: { unit: "inline", bag: "dashboards" },
|
|
7
|
+
parents: [
|
|
8
|
+
{ parent: "app", child: "dashboard" },
|
|
9
|
+
{ parent: "element", child: "dashboard" },
|
|
10
|
+
],
|
|
11
|
+
resource: { shape: "single", resourceType: DASHBOARD_RESOURCE_TYPE, adoptable: true },
|
|
12
|
+
data: { participates: true, resourceType: DASHBOARD_RESOURCE_TYPE, lookupAttr: "name", referencedByBuild: false },
|
|
13
|
+
lifecycle: NO_LIFECYCLE,
|
|
14
|
+
canvas: NO_CANVAS,
|
|
15
|
+
catalog: NO_CATALOG,
|
|
16
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type ChildResourceScope, type TfBlock, type TfValue } from "../../engine/tf/index.js";
|
|
2
|
+
import { type OrgRefLookup, type WorkspaceAspect } from "../../engine/build/context.js";
|
|
3
|
+
import type { DashboardRecordsWidget } from "./build.js";
|
|
4
|
+
export interface AppDashboardWire {
|
|
5
|
+
readonly name?: string;
|
|
6
|
+
readonly favorite?: boolean;
|
|
7
|
+
readonly tags?: readonly string[];
|
|
8
|
+
readonly widgets?: Readonly<Record<string, DashboardWidgetWire>>;
|
|
9
|
+
}
|
|
10
|
+
interface RefWire {
|
|
11
|
+
readonly __kind?: string;
|
|
12
|
+
readonly refName?: string;
|
|
13
|
+
readonly name?: string;
|
|
14
|
+
}
|
|
15
|
+
type DashboardWidgetWire = Omit<DashboardRecordsWidget, "target"> & {
|
|
16
|
+
readonly target?: RefWire | string;
|
|
17
|
+
};
|
|
18
|
+
export interface DashboardToTfOptions {
|
|
19
|
+
readonly ownerTfLabel: string;
|
|
20
|
+
readonly scope: ChildResourceScope;
|
|
21
|
+
readonly ownerType: "APP_ASPECT" | "ELEMENT_ASPECT";
|
|
22
|
+
readonly ownerId: TfValue;
|
|
23
|
+
readonly ownerRefName?: string;
|
|
24
|
+
readonly ownerResourceType?: "elementum_app" | "elementum_element";
|
|
25
|
+
readonly orgRefs?: OrgRefLookup;
|
|
26
|
+
readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
|
|
27
|
+
readonly diagnostics: string[];
|
|
28
|
+
}
|
|
29
|
+
export declare function dashboardsToTf(dashboards: Readonly<Record<string, AppDashboardWire>> | undefined, opts: DashboardToTfOptions): TfBlock[];
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { expr, isCanonicalTsLabel, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
2
|
+
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
3
|
+
import { filterToTf } from "../access-policy/to-tf.js";
|
|
4
|
+
import { filterTfToWire } from "../shared/filters/tf-codec.js";
|
|
5
|
+
import { DASHBOARD_WIDGET_RESOURCE_TYPE } from "../dashboard-widget/module.js";
|
|
6
|
+
import { DASHBOARD_RESOURCE_TYPE } from "./module.js";
|
|
7
|
+
export function dashboardsToTf(dashboards, opts) {
|
|
8
|
+
const blocks = [];
|
|
9
|
+
for (const [key, dashboard] of Object.entries(dashboards ?? {})) {
|
|
10
|
+
if (!isCanonicalTsLabel(key)) {
|
|
11
|
+
opts.diagnostics.push(`dashboards key "${key}" is not a canonical tsLabel (see src/engine/tf/labels.ts) — rename the key`);
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
const attrs = {
|
|
15
|
+
name: dashboard.name ?? "",
|
|
16
|
+
owner_id: opts.ownerId,
|
|
17
|
+
owner_type: opts.ownerType,
|
|
18
|
+
favorite: dashboard.favorite ?? false,
|
|
19
|
+
};
|
|
20
|
+
if (dashboard.tags !== undefined)
|
|
21
|
+
attrs["tags"] = [...dashboard.tags];
|
|
22
|
+
const dashboardLabel = scopedResourceLabel(opts.ownerTfLabel, tsLabelToTfLabel(key), opts.scope);
|
|
23
|
+
blocks.push({
|
|
24
|
+
kind: "resource",
|
|
25
|
+
type: DASHBOARD_RESOURCE_TYPE,
|
|
26
|
+
label: dashboardLabel,
|
|
27
|
+
attrs,
|
|
28
|
+
});
|
|
29
|
+
for (const [widgetKey, widget] of Object.entries(dashboard.widgets ?? {})) {
|
|
30
|
+
const where = `dashboards.${key}.widgets.${widgetKey}`;
|
|
31
|
+
if (!isCanonicalTsLabel(widgetKey)) {
|
|
32
|
+
opts.diagnostics.push(`${where}: key is not a canonical tsLabel; dropped`);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const widgetAttrs = {
|
|
36
|
+
owner_id: opts.ownerId,
|
|
37
|
+
dashboard_id: expr.resourceAttr(DASHBOARD_RESOURCE_TYPE, dashboardLabel, ["id"]),
|
|
38
|
+
name: widget.name,
|
|
39
|
+
size: widget.size ?? "MEDIUM",
|
|
40
|
+
};
|
|
41
|
+
if (widget.color !== undefined)
|
|
42
|
+
widgetAttrs["color"] = widget.color;
|
|
43
|
+
if (widget.icon !== undefined)
|
|
44
|
+
widgetAttrs["icon"] = widget.icon;
|
|
45
|
+
if (widget.type === "records") {
|
|
46
|
+
const aspectId = resolveAspect(widget.target, `${where}.target`, opts);
|
|
47
|
+
if (aspectId === undefined)
|
|
48
|
+
continue;
|
|
49
|
+
const body = { aspect_id: aspectId };
|
|
50
|
+
if (widget.filter !== undefined) {
|
|
51
|
+
const hclFilter = filterToTf(widget.filter, `${where}.filter`, {
|
|
52
|
+
ownerTfLabel: opts.ownerTfLabel,
|
|
53
|
+
scope: opts.scope,
|
|
54
|
+
objectId: opts.ownerId,
|
|
55
|
+
diagnostics: opts.diagnostics,
|
|
56
|
+
orgRefs: opts.orgRefs,
|
|
57
|
+
});
|
|
58
|
+
body["filter"] = expr.jsonencode(filterTfToWire(hclFilter));
|
|
59
|
+
}
|
|
60
|
+
if (widget.sort !== undefined)
|
|
61
|
+
body["sort"] = expr.jsonencode(widget.sort);
|
|
62
|
+
widgetAttrs["aspect_widget"] = body;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
opts.diagnostics.push(`${where}: unsupported widget type; dropped`);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
blocks.push({ kind: "resource", type: DASHBOARD_WIDGET_RESOURCE_TYPE, label: scopedResourceLabel(opts.ownerTfLabel, tsLabelToTfLabel(`${key}_${widgetKey}`), opts.scope), attrs: widgetAttrs });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return blocks;
|
|
72
|
+
}
|
|
73
|
+
function resolveAspect(value, where, opts) {
|
|
74
|
+
if (typeof value === "string")
|
|
75
|
+
return value === "self" ? opts.ownerId : value;
|
|
76
|
+
const kind = value?.__kind === "element" ? "element" : "app";
|
|
77
|
+
const refName = value?.refName ?? "";
|
|
78
|
+
if (kind === opts.scope && refName === (opts.ownerRefName ?? opts.ownerTfLabel))
|
|
79
|
+
return opts.ownerId;
|
|
80
|
+
const sibling = opts.workspaceAspects?.get(workspaceAspectKey(kind, refName));
|
|
81
|
+
if (sibling !== undefined)
|
|
82
|
+
return expr.resourceAttr(kind === "app" ? "elementum_app" : "elementum_element", sibling.tfLabel, ["id"]);
|
|
83
|
+
const name = value?.name ?? refName;
|
|
84
|
+
if (name === "" || opts.orgRefs === undefined) {
|
|
85
|
+
opts.diagnostics.push(`${where}: target has no resolvable name; dropped`);
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
const label = tsLabelToTfLabel(name);
|
|
89
|
+
if (kind === "app")
|
|
90
|
+
opts.orgRefs.foreignApp(label, name);
|
|
91
|
+
else
|
|
92
|
+
opts.orgRefs.foreignElement(label, name);
|
|
93
|
+
return expr.dataAttr(kind === "app" ? "elementum_app" : "elementum_element", label, ["id"]);
|
|
94
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NO_CANVAS, NO_CATALOG, NO_DATA, NO_LIFECYCLE } from "../../graph/types.js";
|
|
2
|
+
export const DASHBOARD_WIDGET_RESOURCE_TYPE = "elementum_dashboard_widget";
|
|
3
|
+
export const dashboardWidgetModule = {
|
|
4
|
+
kind: "dashboard-widget",
|
|
5
|
+
stream: { role: "streamMember" },
|
|
6
|
+
authoring: { unit: "inline", bag: "widgets" },
|
|
7
|
+
parents: [{ parent: "dashboard", child: "dashboard-widget" }],
|
|
8
|
+
resource: { shape: "single", resourceType: DASHBOARD_WIDGET_RESOURCE_TYPE, adoptable: true },
|
|
9
|
+
data: NO_DATA, lifecycle: NO_LIFECYCLE, canvas: NO_CANVAS, catalog: NO_CATALOG,
|
|
10
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Provider data sources that are reference surfaces rather than authored resources. */
|
|
2
|
+
import { NO_CANVAS, NO_CATALOG, NO_LIFECYCLE } from "../../graph/types.js";
|
|
3
|
+
function lookup(kind, resourceType, lookupAttr, referencedByBuild = false) {
|
|
4
|
+
return {
|
|
5
|
+
kind,
|
|
6
|
+
stream: { role: "streamReported" },
|
|
7
|
+
authoring: { unit: "none" },
|
|
8
|
+
parents: [],
|
|
9
|
+
resource: { shape: "none" },
|
|
10
|
+
data: { participates: true, resourceType, lookupAttr, referencedByBuild },
|
|
11
|
+
lifecycle: NO_LIFECYCLE,
|
|
12
|
+
canvas: NO_CANVAS,
|
|
13
|
+
catalog: NO_CATALOG,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export const dataLookupModules = [
|
|
17
|
+
lookup("automation-value-references", "elementum_automation_value_references", "automation_id"),
|
|
18
|
+
// Empty lookupAttr means the singleton has no selector; pull keys it by block label.
|
|
19
|
+
lookup("organization", "elementum_organization", ""),
|
|
20
|
+
lookup("permission-template", "elementum_permission_template", "template"),
|
|
21
|
+
lookup("stored-function", "elementum_stored_function", "name"),
|
|
22
|
+
];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Filter } from "../shared/filters/types.js";
|
|
2
|
+
export type DatamineTimeUnit = "DAY" | "HOUR" | "MINUTE" | "MONTH" | "WEEK";
|
|
3
|
+
export type DatamineSchedule = {
|
|
4
|
+
readonly kind: "fixed";
|
|
5
|
+
readonly timeUnit: DatamineTimeUnit;
|
|
6
|
+
readonly value: number;
|
|
7
|
+
readonly description?: string;
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: "cron";
|
|
10
|
+
readonly cronExpression: string;
|
|
11
|
+
readonly description?: string;
|
|
12
|
+
};
|
|
13
|
+
/** A rule-based datamine owned by its containing table. Column keys are
|
|
14
|
+
* resolved to that table's field ids at build time. */
|
|
15
|
+
export interface TableDatamine<ColumnKey extends string = string> {
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly primaryColumns: readonly [ColumnKey, ...ColumnKey[]];
|
|
18
|
+
readonly description?: string;
|
|
19
|
+
readonly filter?: Filter;
|
|
20
|
+
readonly schedule?: DatamineSchedule;
|
|
21
|
+
readonly limit?: number;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type FromTfContext } from "../../engine/pull/context.js";
|
|
2
|
+
import { type TfBlock } from "../../engine/tf/index.js";
|
|
3
|
+
import type { Filter } from "../shared/filters/types.js";
|
|
4
|
+
import type { NormalizedTableFilterField } from "../table/deserializer/normalize.js";
|
|
5
|
+
import type { DatamineSchedule } from "./build.js";
|
|
6
|
+
export interface NormalizedTableDatamine {
|
|
7
|
+
readonly key: string;
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly primaryColumns: readonly string[];
|
|
10
|
+
readonly description?: string;
|
|
11
|
+
readonly filter?: Filter<NormalizedTableFilterField, never>;
|
|
12
|
+
readonly schedule?: DatamineSchedule;
|
|
13
|
+
readonly limit?: number;
|
|
14
|
+
}
|
|
15
|
+
/** Decode datamines exported with a table stream. Primary ids must be
|
|
16
|
+
* resource references to that table's name-keyed `field_ids` map. */
|
|
17
|
+
export declare function tableDataminesFromTf(blocks: readonly TfBlock[], tableTfLabel: string, columnKeyByName: ReadonlyMap<string, string>, ctx: FromTfContext, columnKeyById?: ReadonlyMap<string, string>): NormalizedTableDatamine[];
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { optionalString, plainObject, resourceRefLabel } from "../../engine/pull/context.js";
|
|
2
|
+
import { reportUnknownAttrs } from "../../engine/pull/attrs.js";
|
|
3
|
+
import { EntityTfError } from "../../engine/entity.js";
|
|
4
|
+
import { isTfExpr, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
5
|
+
import { filterFromTf } from "../shared/filters/tf-codec.js";
|
|
6
|
+
const KNOWN_DATAMINE_ATTRS = new Set([
|
|
7
|
+
"id",
|
|
8
|
+
"table_id",
|
|
9
|
+
"name",
|
|
10
|
+
"description",
|
|
11
|
+
"filter",
|
|
12
|
+
"primary_column_names",
|
|
13
|
+
"primary_column_ids",
|
|
14
|
+
"schedule_fixed",
|
|
15
|
+
"schedule_cron",
|
|
16
|
+
"limit",
|
|
17
|
+
"active",
|
|
18
|
+
]);
|
|
19
|
+
function isTimeUnit(value) {
|
|
20
|
+
return typeof value === "string" && ["DAY", "HOUR", "MINUTE", "MONTH", "WEEK"].includes(value);
|
|
21
|
+
}
|
|
22
|
+
/** Decode datamines exported with a table stream. Primary ids must be
|
|
23
|
+
* resource references to that table's name-keyed `field_ids` map. */
|
|
24
|
+
export function tableDataminesFromTf(blocks, tableTfLabel, columnKeyByName, ctx, columnKeyById = new Map()) {
|
|
25
|
+
return blocks.flatMap((block) => {
|
|
26
|
+
const label = block.label ?? "";
|
|
27
|
+
const where = `elementum_datamine.${label || "?"}`;
|
|
28
|
+
if (label === "") {
|
|
29
|
+
ctx.diagnostics.push(`${where}: missing label; skipped`);
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
reportUnknownAttrs(block.attrs, KNOWN_DATAMINE_ATTRS, where, "tableDataminesFromTf", ctx);
|
|
33
|
+
if (resourceRefLabel(block.attrs["table_id"], "elementum_table") !== tableTfLabel) {
|
|
34
|
+
ctx.diagnostics.push(`${where}.table_id does not reference elementum_table.${tableTfLabel}; skipped`);
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
const rawNames = block.attrs["primary_column_names"];
|
|
38
|
+
const rawIDs = block.attrs["primary_column_ids"];
|
|
39
|
+
if (!Array.isArray(rawNames) && !Array.isArray(rawIDs)) {
|
|
40
|
+
ctx.diagnostics.push(`${where}: expected primary_column_names or primary_column_ids; skipped`);
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
const rawColumns = Array.isArray(rawNames) ? rawNames : rawIDs;
|
|
44
|
+
const lookup = Array.isArray(rawNames) ? columnKeyByName : columnKeyById;
|
|
45
|
+
const primaryColumns = rawColumns.flatMap((value) => {
|
|
46
|
+
const key = typeof value === "string" ? lookup.get(value) : undefined;
|
|
47
|
+
return key === undefined ? [] : [key];
|
|
48
|
+
});
|
|
49
|
+
if (primaryColumns.length !== rawColumns.length) {
|
|
50
|
+
ctx.diagnostics.push(`${where}.${Array.isArray(rawNames) ? "primary_column_names" : "primary_column_ids"}: one or more columns could not be resolved to this table; skipped`);
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
const fixed = plainObject(block.attrs["schedule_fixed"]);
|
|
54
|
+
const cron = plainObject(block.attrs["schedule_cron"]);
|
|
55
|
+
let schedule;
|
|
56
|
+
if (fixed !== undefined && isTimeUnit(fixed["time_unit"]) && typeof fixed["value"] === "number") {
|
|
57
|
+
schedule = { kind: "fixed", timeUnit: fixed["time_unit"], value: fixed["value"], ...(typeof fixed["description"] === "string" && { description: fixed["description"] }) };
|
|
58
|
+
}
|
|
59
|
+
else if (cron !== undefined && typeof cron["cron_expression"] === "string") {
|
|
60
|
+
schedule = { kind: "cron", cronExpression: cron["cron_expression"], ...(typeof cron["description"] === "string" && { description: cron["description"] }) };
|
|
61
|
+
}
|
|
62
|
+
const prefix = `${tableTfLabel}_`;
|
|
63
|
+
const description = optionalString(block.attrs, "description", where, ctx);
|
|
64
|
+
return [{
|
|
65
|
+
key: tfLabelToTsLabel(label.startsWith(prefix) ? label.slice(prefix.length) : label),
|
|
66
|
+
name: optionalString(block.attrs, "name", where, ctx) ?? "",
|
|
67
|
+
primaryColumns,
|
|
68
|
+
...(description !== undefined && { description }),
|
|
69
|
+
...(block.attrs["filter"] !== undefined && {
|
|
70
|
+
filter: filterFromTf(block.attrs["filter"], {
|
|
71
|
+
field: (value) => ({
|
|
72
|
+
kind: "tableColumn",
|
|
73
|
+
tableRefName: tfLabelToTsLabel(tableTfLabel),
|
|
74
|
+
columnRefName: tableColumnKey(value, tableTfLabel, columnKeyByName, columnKeyById, where),
|
|
75
|
+
}),
|
|
76
|
+
reference: () => { throw new EntityTfError(`${where}.filter: datamine filters do not support reference values`); },
|
|
77
|
+
}),
|
|
78
|
+
}),
|
|
79
|
+
...(schedule !== undefined && { schedule }),
|
|
80
|
+
...(typeof block.attrs["limit"] === "number" && { limit: block.attrs["limit"] }),
|
|
81
|
+
}];
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function tableColumnKey(value, tableTfLabel, columnKeyByName, columnKeyById, where) {
|
|
85
|
+
if (typeof value === "string") {
|
|
86
|
+
return columnKeyById.get(value) ?? columnKeyByName.get(value) ?? value;
|
|
87
|
+
}
|
|
88
|
+
if (isTfExpr(value) && value.$expr === "resource-attr" && value.type === "elementum_table" && value.label === tableTfLabel && value.path[0] === "field_ids") {
|
|
89
|
+
const index = value.path[1];
|
|
90
|
+
const name = typeof index === "object" && index !== null && "index" in index && typeof index.index === "string"
|
|
91
|
+
? index.index
|
|
92
|
+
: typeof index === "string" ? index : undefined;
|
|
93
|
+
const key = name === undefined ? undefined : columnKeyByName.get(name) ?? tfLabelToTsLabel(name);
|
|
94
|
+
if (key !== undefined)
|
|
95
|
+
return key;
|
|
96
|
+
}
|
|
97
|
+
throw new EntityTfError(`${where}.filter: field does not resolve to a column on this table`);
|
|
98
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { bareFactoryEntry } from "../../catalog/render-helpers.js";
|
|
2
|
+
import { NO_CANVAS, NO_LIFECYCLE } from "../../graph/types.js";
|
|
3
|
+
export const DATAMINE_RESOURCE_TYPE = "elementum_datamine";
|
|
4
|
+
export const datamineModule = {
|
|
5
|
+
kind: "datamine",
|
|
6
|
+
stream: { role: "streamMember" },
|
|
7
|
+
authoring: { unit: "inline", bag: "datamines" },
|
|
8
|
+
parents: [{ parent: "table", child: "datamine" }],
|
|
9
|
+
resource: { shape: "single", resourceType: DATAMINE_RESOURCE_TYPE, adoptable: true },
|
|
10
|
+
data: { participates: true, resourceType: DATAMINE_RESOURCE_TYPE, lookupAttr: "name", referencedByBuild: true },
|
|
11
|
+
lifecycle: NO_LIFECYCLE,
|
|
12
|
+
canvas: NO_CANVAS,
|
|
13
|
+
catalog: {
|
|
14
|
+
participates: true,
|
|
15
|
+
refKind: "datamine",
|
|
16
|
+
catalogBag: "datamines",
|
|
17
|
+
renderOrder: 63,
|
|
18
|
+
catalogRoot: "org",
|
|
19
|
+
renderEntry: ({ keyName, baseIndent }) => bareFactoryEntry("datamineRef", keyName, baseIndent),
|
|
20
|
+
stubRef: (refName, parent) => ({ __kind: "datamine", refName, name: refName, parent }),
|
|
21
|
+
refFromAuthoring: () => undefined,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type TfBlock, type TfValue } from "../../engine/tf/index.js";
|
|
2
|
+
import type { Filter } from "../shared/filters/types.js";
|
|
3
|
+
import type { TableDatamine } from "./build.js";
|
|
4
|
+
export type TableDatamineWire = TableDatamine<string>;
|
|
5
|
+
/** Emit table-owned datamines using the web client's V2 ownership model. */
|
|
6
|
+
export declare function tableDataminesToTf(datamines: Readonly<Record<string, TableDatamineWire>> | undefined, opts: {
|
|
7
|
+
readonly tableTfLabel: string;
|
|
8
|
+
readonly columnNames: Readonly<Record<string, string>>;
|
|
9
|
+
readonly diagnostics: string[];
|
|
10
|
+
readonly filterToTf: (filter: Filter) => TfValue;
|
|
11
|
+
}): TfBlock[];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { expr, isCanonicalTsLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
2
|
+
import { DATAMINE_RESOURCE_TYPE } from "./module.js";
|
|
3
|
+
/** Emit table-owned datamines using the web client's V2 ownership model. */
|
|
4
|
+
export function tableDataminesToTf(datamines, opts) {
|
|
5
|
+
const blocks = [];
|
|
6
|
+
for (const [key, datamine] of Object.entries(datamines ?? {})) {
|
|
7
|
+
if (!isCanonicalTsLabel(key)) {
|
|
8
|
+
opts.diagnostics.push(`datamines key ${JSON.stringify(key)} is not a canonical tsLabel; dropped`);
|
|
9
|
+
continue;
|
|
10
|
+
}
|
|
11
|
+
const primaryColumnNames = datamine.primaryColumns.flatMap((columnKey) => {
|
|
12
|
+
const name = opts.columnNames[columnKey];
|
|
13
|
+
if (name === undefined) {
|
|
14
|
+
opts.diagnostics.push(`datamines.${key}.primaryColumns: unknown table column key ${JSON.stringify(columnKey)}; dropped`);
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
return [name];
|
|
18
|
+
});
|
|
19
|
+
if (primaryColumnNames.length !== datamine.primaryColumns.length)
|
|
20
|
+
continue;
|
|
21
|
+
const attrs = {
|
|
22
|
+
table_id: expr.resourceAttr("elementum_table", opts.tableTfLabel, ["id"]),
|
|
23
|
+
name: datamine.name,
|
|
24
|
+
primary_column_names: primaryColumnNames,
|
|
25
|
+
};
|
|
26
|
+
if (datamine.description !== undefined)
|
|
27
|
+
attrs["description"] = datamine.description;
|
|
28
|
+
if (datamine.filter !== undefined)
|
|
29
|
+
attrs["filter"] = opts.filterToTf(datamine.filter);
|
|
30
|
+
if (datamine.limit !== undefined)
|
|
31
|
+
attrs["limit"] = datamine.limit;
|
|
32
|
+
if (datamine.schedule?.kind === "fixed") {
|
|
33
|
+
attrs["schedule_fixed"] = {
|
|
34
|
+
time_unit: datamine.schedule.timeUnit,
|
|
35
|
+
value: datamine.schedule.value,
|
|
36
|
+
...(datamine.schedule.description !== undefined && { description: datamine.schedule.description }),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
else if (datamine.schedule?.kind === "cron") {
|
|
40
|
+
attrs["schedule_cron"] = {
|
|
41
|
+
cron_expression: datamine.schedule.cronExpression,
|
|
42
|
+
...(datamine.schedule.description !== undefined && { description: datamine.schedule.description }),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
blocks.push({
|
|
46
|
+
kind: "resource",
|
|
47
|
+
type: DATAMINE_RESOURCE_TYPE,
|
|
48
|
+
label: `${opts.tableTfLabel}_${tsLabelToTfLabel(key)}`,
|
|
49
|
+
attrs,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return blocks;
|
|
53
|
+
}
|