@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,527 @@
|
|
|
1
|
+
import { EntityTfError } from "../../../engine/entity.js";
|
|
2
|
+
import { isTfExpr } from "../../../engine/tf/index.js";
|
|
3
|
+
const TYPE_ALIASES = {
|
|
4
|
+
and: "and",
|
|
5
|
+
or: "or",
|
|
6
|
+
equals: "equals",
|
|
7
|
+
greater_than: "greater_than",
|
|
8
|
+
greater_than_equals: "greater_than_equals",
|
|
9
|
+
less_than: "less_than",
|
|
10
|
+
less_than_equals: "less_than_equals",
|
|
11
|
+
like: "like",
|
|
12
|
+
in: "in",
|
|
13
|
+
between: "between",
|
|
14
|
+
contains: "contains",
|
|
15
|
+
overlaps: "overlaps",
|
|
16
|
+
is_null: "is_null",
|
|
17
|
+
current_range: "current_range",
|
|
18
|
+
consecutive_range: "consecutive_range",
|
|
19
|
+
true: "true",
|
|
20
|
+
false: "false",
|
|
21
|
+
};
|
|
22
|
+
const NEGATABLE_FILTER_TYPES = new Set([
|
|
23
|
+
"equals", "like", "in", "between", "contains", "overlaps", "is_null",
|
|
24
|
+
]);
|
|
25
|
+
function canonicalType(value) {
|
|
26
|
+
const snake = value.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/-/g, "_").toLowerCase();
|
|
27
|
+
const type = TYPE_ALIASES[snake];
|
|
28
|
+
if (type === undefined)
|
|
29
|
+
throw new EntityTfError(`unsupported filter type "${value}"`);
|
|
30
|
+
return type;
|
|
31
|
+
}
|
|
32
|
+
function wireFilter(value) {
|
|
33
|
+
if (value === null || typeof value !== "object" || isTfExpr(value)) {
|
|
34
|
+
throw new EntityTfError("invalid filter object");
|
|
35
|
+
}
|
|
36
|
+
const type = value.type;
|
|
37
|
+
if (typeof type !== "string")
|
|
38
|
+
throw new EntityTfError("filter type is required");
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
function withLeft(filter, codec) {
|
|
42
|
+
if (filter.field !== undefined)
|
|
43
|
+
return { field_id: codec.field(filter.field) };
|
|
44
|
+
if (filter.field_id !== undefined)
|
|
45
|
+
return { field_id: filter.field_id };
|
|
46
|
+
if (filter.leftValue !== undefined) {
|
|
47
|
+
const value = wireFilterValueToTf(filter.leftValue, undefined, codec);
|
|
48
|
+
if (value.type === "field" && value.field_id !== undefined)
|
|
49
|
+
return { left_value: { field_id: value.field_id } };
|
|
50
|
+
if (value.type === "reference" && value.value_reference !== undefined)
|
|
51
|
+
return { left_value: { value_reference: value.value_reference, ...(value.real_type !== undefined && { real_type: value.real_type }) } };
|
|
52
|
+
throw new EntityTfError("filter leftValue must be a FIELD or REFERENCE value");
|
|
53
|
+
}
|
|
54
|
+
if (filter.left_value !== undefined)
|
|
55
|
+
return { left_value: filter.left_value };
|
|
56
|
+
return {};
|
|
57
|
+
}
|
|
58
|
+
function fieldOptions(filter, codec, type) {
|
|
59
|
+
return {
|
|
60
|
+
...(filter.aspect !== undefined && { aspect_id: (codec.aspect ?? codec.field)(filter.aspect) }),
|
|
61
|
+
...(filter.aspect === undefined && filter.aspect_id !== undefined && { aspect_id: filter.aspect_id }),
|
|
62
|
+
...(filter.semantic === true || ((type === "current_range" || type === "consecutive_range") && filter.semantic !== undefined)
|
|
63
|
+
? { semantic: filter.semantic }
|
|
64
|
+
: {}),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/** The only authored/wire-filter -> Terraform-HCL filter serializer. */
|
|
68
|
+
export function filterToTf(value, codec) {
|
|
69
|
+
const filter = wireFilter(value);
|
|
70
|
+
const type = canonicalType(filter.type);
|
|
71
|
+
if (type === "true" || type === "false")
|
|
72
|
+
return { type };
|
|
73
|
+
if (type === "and" || type === "or") {
|
|
74
|
+
if (!Array.isArray(filter.children))
|
|
75
|
+
throw new EntityTfError(`${type} filter has no children`);
|
|
76
|
+
return { type, children: filter.children.map((child) => filterToTf(child, codec)) };
|
|
77
|
+
}
|
|
78
|
+
const field = filter.field ?? codec.fieldFromLeftValue?.(filter.leftValue);
|
|
79
|
+
const left = withLeft(filter, codec);
|
|
80
|
+
if (left.field_id === undefined && left.left_value === undefined) {
|
|
81
|
+
throw new EntityTfError(`${type} filter has no left side`);
|
|
82
|
+
}
|
|
83
|
+
if (filter.not === true && !NEGATABLE_FILTER_TYPES.has(type)) {
|
|
84
|
+
throw new EntityTfError(`${type} filter does not support not`);
|
|
85
|
+
}
|
|
86
|
+
const not = filter.not === true ? { not: true } : {};
|
|
87
|
+
const options = fieldOptions(filter, codec, type);
|
|
88
|
+
if (type === "is_null")
|
|
89
|
+
return { type, ...left, ...options, ...not };
|
|
90
|
+
if (type === "current_range") {
|
|
91
|
+
if (typeof filter.unit !== "string")
|
|
92
|
+
throw new EntityTfError("current_range filter requires unit");
|
|
93
|
+
return { type, ...left, ...options, unit: filter.unit.toLowerCase(), ...((filter.isoWeek ?? filter.iso_week) !== undefined && { iso_week: (filter.isoWeek ?? filter.iso_week) }) };
|
|
94
|
+
}
|
|
95
|
+
if (type === "consecutive_range") {
|
|
96
|
+
if (typeof filter.unit !== "string" || typeof filter.count !== "number" || typeof filter.offset !== "number") {
|
|
97
|
+
throw new EntityTfError("consecutive_range filter requires unit, count, and offset");
|
|
98
|
+
}
|
|
99
|
+
return { type, ...left, ...options, unit: filter.unit.toLowerCase(), count: filter.count, offset: filter.offset, ...((filter.isoWeek ?? filter.iso_week) !== undefined && { iso_week: (filter.isoWeek ?? filter.iso_week) }) };
|
|
100
|
+
}
|
|
101
|
+
if (type === "in") {
|
|
102
|
+
if (!Array.isArray(filter.values))
|
|
103
|
+
throw new EntityTfError(`${type} filter has no values`);
|
|
104
|
+
return { type, ...left, ...options, ...not, values: filter.values.map((item) => wireFilterValueToTf(item, field, codec)) };
|
|
105
|
+
}
|
|
106
|
+
if (type === "contains" || type === "overlaps") {
|
|
107
|
+
if (!Array.isArray(filter.values) || filter.values.length === 0)
|
|
108
|
+
throw new EntityTfError(`${type} filter requires at least one value`);
|
|
109
|
+
return { type, ...left, ...options, ...not, values: filter.values.map((item) => wireFilterValueToTf(item, field, codec)) };
|
|
110
|
+
}
|
|
111
|
+
if (type === "between") {
|
|
112
|
+
if (filter.min === undefined || filter.max === undefined)
|
|
113
|
+
throw new EntityTfError("between filter requires min and max");
|
|
114
|
+
return { type, ...left, ...options, ...not, min: wireFilterValueToTf(filter.min, field, codec), max: wireFilterValueToTf(filter.max, field, codec) };
|
|
115
|
+
}
|
|
116
|
+
if (filter.value === undefined)
|
|
117
|
+
throw new EntityTfError(`${type} filter has no value`);
|
|
118
|
+
return {
|
|
119
|
+
type,
|
|
120
|
+
...left,
|
|
121
|
+
...options,
|
|
122
|
+
...not,
|
|
123
|
+
value: wireFilterValueToTf(filter.value, field, codec),
|
|
124
|
+
...(type === "like" && { case_insensitive: (filter.caseInsensitive ?? filter.case_insensitive) === true, mode: filter.mode?.toLowerCase() ?? "legacy" }),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function tfFilter(value) {
|
|
128
|
+
const filter = wireFilter(value);
|
|
129
|
+
return { ...filter, type: canonicalType(filter.type) };
|
|
130
|
+
}
|
|
131
|
+
function filterValueToWire(value) {
|
|
132
|
+
const type = value.type.toLowerCase();
|
|
133
|
+
const literal = (() => {
|
|
134
|
+
if (value.value === undefined || isTfExpr(value.value))
|
|
135
|
+
return value.value;
|
|
136
|
+
if (type === "number")
|
|
137
|
+
return Number(value.value);
|
|
138
|
+
if (type === "boolean")
|
|
139
|
+
return String(value.value).toLowerCase() === "true" || value.value === "1";
|
|
140
|
+
return value.value;
|
|
141
|
+
})();
|
|
142
|
+
return {
|
|
143
|
+
type: type.toUpperCase(),
|
|
144
|
+
...(type !== "null" && literal !== undefined && { value: literal }),
|
|
145
|
+
...(value.value_reference !== undefined && { value: tfReferenceToWire(value.value_reference) }),
|
|
146
|
+
...(value.current_user_type !== undefined && { valueType: value.current_user_type.toUpperCase() }),
|
|
147
|
+
...(value.real_type !== undefined && { realType: value.real_type.toUpperCase() }),
|
|
148
|
+
...(value.multiple !== undefined && { multiple: value.multiple }),
|
|
149
|
+
...(value.field_id !== undefined && { field: value.field_id }),
|
|
150
|
+
...(value.aspect_id !== undefined && { aspect: value.aspect_id }),
|
|
151
|
+
...(value.treat_null_as_equals !== undefined && { treatNullAsEquals: value.treat_null_as_equals }),
|
|
152
|
+
...(value.object !== undefined && { aspect: value.object }),
|
|
153
|
+
...(value.dynamic_field !== undefined && { dynamicField: value.dynamic_field }),
|
|
154
|
+
...(value.dynamic_field_object !== undefined && { dynamicFieldAspect: value.dynamic_field_object }),
|
|
155
|
+
...(value.source_field_type !== undefined && { sourceFieldType: value.source_field_type }),
|
|
156
|
+
...(value.required !== undefined && { required: value.required }),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function wireFilterValueToTf(value, field, codec) {
|
|
160
|
+
if (value === null || typeof value !== "object" || isTfExpr(value)) {
|
|
161
|
+
throw new EntityTfError("invalid wire filter value");
|
|
162
|
+
}
|
|
163
|
+
const raw = value;
|
|
164
|
+
if (typeof raw.type !== "string")
|
|
165
|
+
throw new EntityTfError("wire filter value type is required");
|
|
166
|
+
const type = raw.type.toLowerCase();
|
|
167
|
+
if (type === "null")
|
|
168
|
+
return { type, value: "" };
|
|
169
|
+
if (type === "current_user") {
|
|
170
|
+
const currentUserType = String(raw.valueType ?? raw.value_type ?? raw.current_user_type ?? "ID").toUpperCase();
|
|
171
|
+
if (currentUserType !== "ID" && currentUserType !== "EMAIL" && currentUserType !== "DOMAIN") {
|
|
172
|
+
throw new EntityTfError(`unsupported current-user value type "${currentUserType}"`);
|
|
173
|
+
}
|
|
174
|
+
return { type, current_user_type: currentUserType.toLowerCase() };
|
|
175
|
+
}
|
|
176
|
+
if (type === "reference") {
|
|
177
|
+
const reference = raw.value ?? raw.valueReference ?? raw.value_reference;
|
|
178
|
+
if (reference === undefined)
|
|
179
|
+
throw new EntityTfError("reference filter value requires value");
|
|
180
|
+
return {
|
|
181
|
+
type,
|
|
182
|
+
value_reference: codec.reference(reference),
|
|
183
|
+
real_type: String(raw.realType ?? raw.real_type ?? "TEXT").toLowerCase(),
|
|
184
|
+
...(typeof raw.multiple === "boolean" && { multiple: raw.multiple }),
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
if (type === "field") {
|
|
188
|
+
const fieldValue = raw.value ?? raw.field ?? raw.field_id;
|
|
189
|
+
if (fieldValue === undefined)
|
|
190
|
+
throw new EntityTfError("field filter value requires value");
|
|
191
|
+
return {
|
|
192
|
+
type,
|
|
193
|
+
field_id: codec.field(fieldValue),
|
|
194
|
+
...((raw.aspect ?? raw.aspect_id) !== undefined && { aspect_id: (raw.aspect ?? raw.aspect_id) }),
|
|
195
|
+
...((raw.treatNullAsEquals ?? raw.treat_null_as_equals) !== undefined && { treat_null_as_equals: Boolean(raw.treatNullAsEquals ?? raw.treat_null_as_equals) }),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
if (type === "record_field") {
|
|
199
|
+
if (raw.field === undefined || (raw.aspect ?? raw.object) === undefined || (raw.sourceFieldType ?? raw.source_field_type) === undefined) {
|
|
200
|
+
throw new EntityTfError("record_field filter value requires field, aspect, and sourceFieldType");
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
type,
|
|
204
|
+
field: raw.field,
|
|
205
|
+
object: (raw.aspect ?? raw.object),
|
|
206
|
+
source_field_type: String(raw.sourceFieldType ?? raw.source_field_type).toLowerCase(),
|
|
207
|
+
...((raw.dynamicField ?? raw.dynamic_field) !== undefined && { dynamic_field: (raw.dynamicField ?? raw.dynamic_field) }),
|
|
208
|
+
...((raw.dynamicFieldAspect ?? raw.dynamic_field_object) !== undefined && { dynamic_field_object: (raw.dynamicFieldAspect ?? raw.dynamic_field_object) }),
|
|
209
|
+
...(typeof raw.required === "boolean" && { required: raw.required }),
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
if (!["text", "number", "boolean", "uuid", "date", "datetime"].includes(type)) {
|
|
213
|
+
throw new EntityTfError(`unsupported filter value type "${raw.type}"`);
|
|
214
|
+
}
|
|
215
|
+
if (raw.value === undefined)
|
|
216
|
+
throw new EntityTfError(`${type} filter value requires value`);
|
|
217
|
+
const resolved = codec.literal?.(raw.value, field, type) ?? raw.value;
|
|
218
|
+
if (isTfExpr(resolved))
|
|
219
|
+
return { type, value: resolved };
|
|
220
|
+
if (type === "number") {
|
|
221
|
+
const number = typeof resolved === "number" ? resolved : Number(resolved);
|
|
222
|
+
if (!Number.isFinite(number))
|
|
223
|
+
throw new EntityTfError(`invalid number filter value "${String(resolved)}"`);
|
|
224
|
+
return { type, value: String(number) };
|
|
225
|
+
}
|
|
226
|
+
if (type === "boolean") {
|
|
227
|
+
if (typeof resolved === "boolean")
|
|
228
|
+
return { type, value: String(resolved) };
|
|
229
|
+
const normalized = String(resolved).toLowerCase();
|
|
230
|
+
if (normalized !== "true" && normalized !== "false" && normalized !== "1" && normalized !== "0") {
|
|
231
|
+
throw new EntityTfError(`invalid boolean filter value "${String(resolved)}"`);
|
|
232
|
+
}
|
|
233
|
+
return { type, value: normalized === "1" ? "true" : normalized === "0" ? "false" : normalized };
|
|
234
|
+
}
|
|
235
|
+
if (typeof resolved !== "string")
|
|
236
|
+
throw new EntityTfError(`${type} filter value must be a string`);
|
|
237
|
+
return { type, value: resolved };
|
|
238
|
+
}
|
|
239
|
+
function tfReferenceToWire(value) {
|
|
240
|
+
if (typeof value !== "string")
|
|
241
|
+
return value;
|
|
242
|
+
if (value.startsWith("trigger."))
|
|
243
|
+
return { type: "TRIGGER", name: value.slice("trigger.".length) };
|
|
244
|
+
if (value.startsWith("task.")) {
|
|
245
|
+
const [taskId, ...name] = value.slice("task.".length).split(".");
|
|
246
|
+
return taskId !== undefined && name.length > 0 ? { type: "TASK", taskId, name: name.join(".") } : value;
|
|
247
|
+
}
|
|
248
|
+
if (value.startsWith("variable."))
|
|
249
|
+
return { type: "VARIABLE", name: value.slice("variable.".length) };
|
|
250
|
+
if (value.startsWith("for_each.")) {
|
|
251
|
+
const [forEachTaskId, ...name] = value.slice("for_each.".length).split(".");
|
|
252
|
+
return forEachTaskId !== undefined && name.length > 0 ? { type: "FOR_EACH", forEachTaskId, name: name.join(".") } : value;
|
|
253
|
+
}
|
|
254
|
+
if (value.startsWith("{")) {
|
|
255
|
+
try {
|
|
256
|
+
return JSON.parse(value);
|
|
257
|
+
}
|
|
258
|
+
catch {
|
|
259
|
+
return value;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return value;
|
|
263
|
+
}
|
|
264
|
+
function wireReferenceToTf(value) {
|
|
265
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null || isTfExpr(value)) {
|
|
266
|
+
return value;
|
|
267
|
+
}
|
|
268
|
+
if (typeof value !== "object")
|
|
269
|
+
throw new EntityTfError("invalid filter reference");
|
|
270
|
+
const reference = value;
|
|
271
|
+
const type = typeof reference.type === "string" ? reference.type.toUpperCase() : "";
|
|
272
|
+
if (type === "TRIGGER" && typeof reference.name === "string")
|
|
273
|
+
return `trigger.${reference.name}`;
|
|
274
|
+
if (type === "TASK" && typeof reference.name === "string") {
|
|
275
|
+
const task = reference.taskId ?? reference.taskRefKey;
|
|
276
|
+
if (typeof task === "string")
|
|
277
|
+
return `task.${task}.${reference.name}`;
|
|
278
|
+
}
|
|
279
|
+
if (type === "VARIABLE") {
|
|
280
|
+
const name = reference.name ?? reference.variableId;
|
|
281
|
+
if (typeof name === "string")
|
|
282
|
+
return `variable.${name}`;
|
|
283
|
+
}
|
|
284
|
+
if (type === "FOR_EACH" && typeof reference.name === "string") {
|
|
285
|
+
const task = reference.forEachTaskId ?? reference.forEachTaskRefKey;
|
|
286
|
+
if (typeof task === "string")
|
|
287
|
+
return `for_each.${task}.${reference.name}`;
|
|
288
|
+
}
|
|
289
|
+
if (type === "VALUE")
|
|
290
|
+
return String(reference.value ?? "");
|
|
291
|
+
return JSON.stringify(reference);
|
|
292
|
+
}
|
|
293
|
+
/** Canonical platform wire-filter -> Terraform-HCL shape. */
|
|
294
|
+
export function filterWireToTf(value) {
|
|
295
|
+
const authoringValue = (() => {
|
|
296
|
+
if (value === null || typeof value !== "object" || isTfExpr(value))
|
|
297
|
+
return value;
|
|
298
|
+
const raw = value;
|
|
299
|
+
const children = Array.isArray(raw.children) ? raw.children.map((child) => filterWireToTf(child)) : raw.children;
|
|
300
|
+
if (String(raw.type).toUpperCase() === "BETWEEN" && Array.isArray(raw.values) && raw.values.length === 2) {
|
|
301
|
+
const { values, ...rest } = raw;
|
|
302
|
+
return { ...rest, ...(children !== undefined && { children }), min: values[0], max: values[1] };
|
|
303
|
+
}
|
|
304
|
+
return children === raw.children ? raw : { ...raw, children };
|
|
305
|
+
})();
|
|
306
|
+
return filterToTf(authoringValue, {
|
|
307
|
+
field: (field) => field,
|
|
308
|
+
reference: wireReferenceToTf,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
/** Canonical Terraform-HCL filter -> platform wire shape for tables/datamines. */
|
|
312
|
+
export function filterTfToWire(value) {
|
|
313
|
+
const filter = tfFilter(value);
|
|
314
|
+
const { type } = filter;
|
|
315
|
+
if (type === "true" || type === "false")
|
|
316
|
+
return { type: type.toUpperCase() };
|
|
317
|
+
if (type === "and" || type === "or") {
|
|
318
|
+
return {
|
|
319
|
+
type: type.toUpperCase(),
|
|
320
|
+
children: filter.children.map((child) => filterTfToWire(child)),
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
const left = {
|
|
324
|
+
...("field_id" in filter && filter.field_id !== undefined && { field: filter.field_id }),
|
|
325
|
+
...("left_value" in filter && filter.left_value !== undefined && {
|
|
326
|
+
leftValue: filter.left_value.field_id !== undefined
|
|
327
|
+
? { type: "FIELD", field: filter.left_value.field_id }
|
|
328
|
+
: { type: "REFERENCE", value: tfReferenceToWire(filter.left_value.value_reference), realType: (filter.left_value.real_type ?? "text").toUpperCase() },
|
|
329
|
+
}),
|
|
330
|
+
};
|
|
331
|
+
const options = {
|
|
332
|
+
...("aspect_id" in filter && filter.aspect_id !== undefined && { aspect: filter.aspect_id }),
|
|
333
|
+
...("semantic" in filter && (filter.semantic === true || type === "current_range" || type === "consecutive_range") && filter.semantic !== undefined
|
|
334
|
+
? { semantic: filter.semantic }
|
|
335
|
+
: {}),
|
|
336
|
+
};
|
|
337
|
+
if (type === "is_null")
|
|
338
|
+
return { type: "IS_NULL", ...left, ...options, ...(filter.not === true && { not: true }) };
|
|
339
|
+
if (type === "current_range") {
|
|
340
|
+
return {
|
|
341
|
+
type: "CURRENT_RANGE",
|
|
342
|
+
...left,
|
|
343
|
+
...options,
|
|
344
|
+
unit: filter.unit.toUpperCase(),
|
|
345
|
+
...(filter.iso_week !== undefined && { isoWeek: filter.iso_week }),
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
if (type === "consecutive_range") {
|
|
349
|
+
return {
|
|
350
|
+
type: "CONSECUTIVE_RANGE",
|
|
351
|
+
...left,
|
|
352
|
+
...options,
|
|
353
|
+
unit: filter.unit.toUpperCase(),
|
|
354
|
+
count: filter.count,
|
|
355
|
+
offset: filter.offset,
|
|
356
|
+
...(filter.iso_week !== undefined && { isoWeek: filter.iso_week }),
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
if (type === "in") {
|
|
360
|
+
return {
|
|
361
|
+
type: "IN",
|
|
362
|
+
...left,
|
|
363
|
+
...options,
|
|
364
|
+
values: filter.values.map(filterValueToWire),
|
|
365
|
+
...(filter.not === true && { not: true }),
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
if (type === "contains" || type === "overlaps") {
|
|
369
|
+
return {
|
|
370
|
+
type: type.toUpperCase(),
|
|
371
|
+
...left,
|
|
372
|
+
...options,
|
|
373
|
+
values: filter.values.map(filterValueToWire),
|
|
374
|
+
...(filter.not === true && { not: true }),
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
if (type === "between") {
|
|
378
|
+
return {
|
|
379
|
+
type: "BETWEEN",
|
|
380
|
+
...left,
|
|
381
|
+
...options,
|
|
382
|
+
values: [filterValueToWire(filter.min), filterValueToWire(filter.max)],
|
|
383
|
+
...(filter.not === true && { not: true }),
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
const single = filter;
|
|
387
|
+
if (type === "like")
|
|
388
|
+
return {
|
|
389
|
+
type: "LIKE",
|
|
390
|
+
...left,
|
|
391
|
+
...options,
|
|
392
|
+
value: filterValueToWire(single.value),
|
|
393
|
+
...(single.not === true && { not: true }),
|
|
394
|
+
...(single.case_insensitive !== undefined && { caseInsensitive: single.case_insensitive }),
|
|
395
|
+
...(single.mode !== undefined && { mode: single.mode.toUpperCase() }),
|
|
396
|
+
};
|
|
397
|
+
return {
|
|
398
|
+
type: type.toUpperCase(),
|
|
399
|
+
...left,
|
|
400
|
+
...options,
|
|
401
|
+
value: filterValueToWire(single.value),
|
|
402
|
+
...(single.not === true && { not: true }),
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
/** The only Terraform-HCL filter -> strongly typed deserializer AST. */
|
|
406
|
+
export function filterFromTf(value, codec, fieldScope = "app") {
|
|
407
|
+
const filter = tfFilter(value);
|
|
408
|
+
const { type } = filter;
|
|
409
|
+
if (type === "true" || type === "false")
|
|
410
|
+
return { type: type.toUpperCase() };
|
|
411
|
+
if (type === "and" || type === "or") {
|
|
412
|
+
if (!Array.isArray(filter.children))
|
|
413
|
+
throw new EntityTfError(`${type} filter has no children`);
|
|
414
|
+
return {
|
|
415
|
+
type: type.toUpperCase(),
|
|
416
|
+
children: filter.children.map((child) => filterFromTf(child, codec, fieldScope)),
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
const left = (() => {
|
|
420
|
+
if ("field_id" in filter && filter.field_id !== undefined)
|
|
421
|
+
return { field: codec.field(filter.field_id, fieldScope) };
|
|
422
|
+
if (!("left_value" in filter) || filter.left_value === undefined)
|
|
423
|
+
return undefined;
|
|
424
|
+
if (filter.left_value.field_id !== undefined)
|
|
425
|
+
return { leftValue: { type: "FIELD", value: codec.field(filter.left_value.field_id, fieldScope) } };
|
|
426
|
+
if (filter.left_value.value_reference !== undefined)
|
|
427
|
+
return {
|
|
428
|
+
leftValue: {
|
|
429
|
+
type: "REFERENCE",
|
|
430
|
+
realType: (filter.left_value.real_type?.toUpperCase() ?? "TEXT"),
|
|
431
|
+
value: codec.reference(filter.left_value.value_reference),
|
|
432
|
+
},
|
|
433
|
+
};
|
|
434
|
+
return undefined;
|
|
435
|
+
})();
|
|
436
|
+
if (left === undefined)
|
|
437
|
+
throw new EntityTfError(`${type} filter has no left side`);
|
|
438
|
+
if ("not" in filter && filter.not === true && !NEGATABLE_FILTER_TYPES.has(type)) {
|
|
439
|
+
throw new EntityTfError(`${type} filter does not support not`);
|
|
440
|
+
}
|
|
441
|
+
const not = "not" in filter && filter.not === true ? { not: true } : {};
|
|
442
|
+
const options = {
|
|
443
|
+
...("aspect_id" in filter && filter.aspect_id !== undefined && {
|
|
444
|
+
aspect: codec.aspect?.(filter.aspect_id) ?? codec.field(filter.aspect_id, fieldScope),
|
|
445
|
+
}),
|
|
446
|
+
...("semantic" in filter && filter.semantic !== undefined && { semantic: filter.semantic }),
|
|
447
|
+
};
|
|
448
|
+
if (type === "is_null")
|
|
449
|
+
return { type: "IS_NULL", ...left, ...options, ...not };
|
|
450
|
+
if (type === "current_range") {
|
|
451
|
+
return { type: "CURRENT_RANGE", ...left, ...options, unit: filter.unit.toUpperCase(), ...(filter.iso_week !== undefined && { isoWeek: filter.iso_week }) };
|
|
452
|
+
}
|
|
453
|
+
if (type === "consecutive_range") {
|
|
454
|
+
return { type: "CONSECUTIVE_RANGE", ...left, ...options, unit: filter.unit.toUpperCase(), count: filter.count, offset: filter.offset, ...(filter.iso_week !== undefined && { isoWeek: filter.iso_week }) };
|
|
455
|
+
}
|
|
456
|
+
if (type === "in") {
|
|
457
|
+
return { type: "IN", ...left, ...options, values: filter.values.map((item) => filterValueFromTf(item, codec, fieldScope)), ...not };
|
|
458
|
+
}
|
|
459
|
+
if (type === "contains" || type === "overlaps") {
|
|
460
|
+
return { type: type.toUpperCase(), ...left, ...options, values: filter.values.map((item) => filterValueFromTf(item, codec, fieldScope)), ...not };
|
|
461
|
+
}
|
|
462
|
+
if (type === "between") {
|
|
463
|
+
return { type: "BETWEEN", ...left, ...options, min: filterValueFromTf(filter.min, codec, fieldScope), max: filterValueFromTf(filter.max, codec, fieldScope), ...not };
|
|
464
|
+
}
|
|
465
|
+
const single = filter;
|
|
466
|
+
const filterType = {
|
|
467
|
+
equals: "EQUALS",
|
|
468
|
+
greater_than: "GREATER_THAN",
|
|
469
|
+
greater_than_equals: "GREATER_THAN_EQUALS",
|
|
470
|
+
less_than: "LESS_THAN",
|
|
471
|
+
less_than_equals: "LESS_THAN_EQUALS",
|
|
472
|
+
like: "LIKE",
|
|
473
|
+
};
|
|
474
|
+
const canonical = filterType[type];
|
|
475
|
+
return canonical === "LIKE"
|
|
476
|
+
? { type: canonical, ...left, ...options, value: filterValueFromTf(single.value, codec, fieldScope), ...not, ...(single.case_insensitive !== undefined && { caseInsensitive: single.case_insensitive }), ...(single.mode !== undefined && { mode: single.mode.toUpperCase() }) }
|
|
477
|
+
: { type: canonical, ...left, ...options, value: filterValueFromTf(single.value, codec, fieldScope), ...not };
|
|
478
|
+
}
|
|
479
|
+
function filterValueFromTf(value, codec, fieldScope) {
|
|
480
|
+
const type = value.type.toLowerCase();
|
|
481
|
+
const literal = codec.literal?.(value.value, type) ?? value.value;
|
|
482
|
+
switch (type) {
|
|
483
|
+
case "null": return { type: "NULL" };
|
|
484
|
+
case "current_user": {
|
|
485
|
+
const currentUserType = value.current_user_type?.toUpperCase();
|
|
486
|
+
return { type: "CURRENT_USER", valueType: currentUserType === "EMAIL" || currentUserType === "DOMAIN" ? currentUserType : "ID" };
|
|
487
|
+
}
|
|
488
|
+
case "reference":
|
|
489
|
+
if (value.value_reference === undefined)
|
|
490
|
+
throw new EntityTfError("reference filter value requires value_reference");
|
|
491
|
+
return {
|
|
492
|
+
type: "REFERENCE",
|
|
493
|
+
realType: (value.real_type?.toUpperCase() ?? "TEXT"),
|
|
494
|
+
value: codec.reference(value.value_reference),
|
|
495
|
+
...(value.multiple === true && { multiple: true }),
|
|
496
|
+
};
|
|
497
|
+
case "field":
|
|
498
|
+
if (value.field_id === undefined)
|
|
499
|
+
throw new EntityTfError("field filter value requires field_id");
|
|
500
|
+
return {
|
|
501
|
+
type: "FIELD",
|
|
502
|
+
value: codec.field(value.field_id, fieldScope),
|
|
503
|
+
...(typeof value.aspect_id === "string" && { aspect: value.aspect_id }),
|
|
504
|
+
...(value.treat_null_as_equals !== undefined && { treatNullAsEquals: value.treat_null_as_equals }),
|
|
505
|
+
};
|
|
506
|
+
case "record_field":
|
|
507
|
+
if (typeof value.field !== "string" || typeof value.object !== "string" || typeof value.source_field_type !== "string") {
|
|
508
|
+
throw new EntityTfError("record_field filter value requires field, object, and source_field_type");
|
|
509
|
+
}
|
|
510
|
+
return {
|
|
511
|
+
type: "RECORD_FIELD",
|
|
512
|
+
field: value.field,
|
|
513
|
+
aspect: value.object,
|
|
514
|
+
sourceFieldType: value.source_field_type.toUpperCase(),
|
|
515
|
+
...(typeof value.dynamic_field === "string" && { dynamicField: value.dynamic_field }),
|
|
516
|
+
...(typeof value.dynamic_field_object === "string" && { dynamicFieldAspect: value.dynamic_field_object }),
|
|
517
|
+
...(value.required !== undefined && { required: value.required }),
|
|
518
|
+
};
|
|
519
|
+
case "number": return { type: "NUMBER", value: typeof literal === "number" ? literal : Number(literal) };
|
|
520
|
+
case "boolean": return { type: "BOOLEAN", value: typeof literal === "boolean" ? literal : String(literal).toLowerCase() === "true" };
|
|
521
|
+
case "text":
|
|
522
|
+
case "uuid":
|
|
523
|
+
case "date":
|
|
524
|
+
case "datetime": return { type: type.toUpperCase(), value: String(literal) };
|
|
525
|
+
default: throw new EntityTfError(`unsupported filter value type "${value.type}"`);
|
|
526
|
+
}
|
|
527
|
+
}
|