@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,37 @@
|
|
|
1
|
+
import { expr, sanitizeName, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
2
|
+
const CATEGORY = "elementum_category";
|
|
3
|
+
const GROUP = "elementum_group";
|
|
4
|
+
const USER = "elementum_user";
|
|
5
|
+
export function organizationToTf(organization, ctx) {
|
|
6
|
+
const blocks = [];
|
|
7
|
+
for (const [key, category] of Object.entries(organization.categories)) {
|
|
8
|
+
const attrs = { name: category.name };
|
|
9
|
+
if (category.color !== undefined)
|
|
10
|
+
attrs["color"] = category.color;
|
|
11
|
+
if (category.icon !== undefined)
|
|
12
|
+
attrs["icon"] = category.icon;
|
|
13
|
+
if (category.description !== undefined)
|
|
14
|
+
attrs["description"] = category.description;
|
|
15
|
+
blocks.push({ kind: "resource", type: CATEGORY, label: tsLabelToTfLabel(key), attrs });
|
|
16
|
+
}
|
|
17
|
+
for (const [key, group] of Object.entries(organization.groups)) {
|
|
18
|
+
const attrs = { name: group.name };
|
|
19
|
+
for (const [wire, value] of [
|
|
20
|
+
["approver", group.approver], ["assignable", group.assignable], ["mentionable", group.mentionable],
|
|
21
|
+
["watchable", group.watchable], ["dynamic", group.dynamic],
|
|
22
|
+
])
|
|
23
|
+
if (value !== undefined)
|
|
24
|
+
attrs[wire] = value;
|
|
25
|
+
if (group.tags !== undefined)
|
|
26
|
+
attrs["tags"] = [...group.tags];
|
|
27
|
+
if (group.members !== undefined) {
|
|
28
|
+
attrs["members"] = group.members.map(({ email }) => {
|
|
29
|
+
const label = sanitizeName(email);
|
|
30
|
+
ctx.orgRefs.rawLookup(USER, label, email);
|
|
31
|
+
return expr.dataAttr(USER, label, ["id"]);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
blocks.push({ kind: "resource", type: GROUP, label: tsLabelToTfLabel(key), attrs });
|
|
35
|
+
}
|
|
36
|
+
return blocks;
|
|
37
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type AgentRef, type CatalogRef, type PhoneProviderRef, type PhoneServiceRef } from "../../catalog/index.js";
|
|
2
|
+
import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
|
|
3
|
+
import { type PhoneServiceNumber } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* An app-owned phone line. Apps may own any number of phone services, and
|
|
6
|
+
* each service independently chooses the agent that handles its calls.
|
|
7
|
+
*/
|
|
8
|
+
export type PhoneServiceOptions<AppRefName extends string = string> = EntityDeployOptions & PhoneServiceNumber & {
|
|
9
|
+
readonly app: CatalogRef<"app", AppRefName>;
|
|
10
|
+
readonly agent: AgentRef<NoInfer<AppRefName>>;
|
|
11
|
+
readonly provider: PhoneProviderRef;
|
|
12
|
+
};
|
|
13
|
+
export interface PhoneServiceConfigured {
|
|
14
|
+
ref(refName: string): PhoneServiceRef;
|
|
15
|
+
def(refName: string): DeployableEntity;
|
|
16
|
+
}
|
|
17
|
+
export declare function definePhoneService<const AppRefName extends string>(opts: PhoneServiceOptions<AppRefName>): PhoneServiceConfigured;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { slimTokens } from "../../catalog/index.js";
|
|
2
|
+
import { validatePhoneService } from "./types.js";
|
|
3
|
+
export function definePhoneService(opts) {
|
|
4
|
+
return {
|
|
5
|
+
ref(refName) {
|
|
6
|
+
return { __kind: "phone-service", refName, name: refName, parent: opts.app.refName };
|
|
7
|
+
},
|
|
8
|
+
def(refName) {
|
|
9
|
+
validatePhoneService(refName, opts);
|
|
10
|
+
if (opts.agent.parent !== opts.app.refName) {
|
|
11
|
+
throw new Error(`definePhoneService "${refName}": agent "${opts.agent.refName}" belongs to app ` +
|
|
12
|
+
`"${opts.agent.parent ?? "unknown"}", not "${opts.app.refName}"`);
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
kind: "phone-service",
|
|
16
|
+
parent: opts.app.refName,
|
|
17
|
+
refName,
|
|
18
|
+
payload: slimTokens({
|
|
19
|
+
app: opts.app,
|
|
20
|
+
agent: opts.agent,
|
|
21
|
+
provider: opts.provider,
|
|
22
|
+
...(opts.callerAccessMode !== undefined ? { callerAccessMode: opts.callerAccessMode } : {}),
|
|
23
|
+
...(opts.twilioExistingNumber !== undefined ? { twilioExistingNumber: opts.twilioExistingNumber } : {}),
|
|
24
|
+
...(opts.twilioNewNumber !== undefined ? { twilioNewNumber: opts.twilioNewNumber } : {}),
|
|
25
|
+
...(opts.registration !== undefined ? { registration: opts.registration } : {}),
|
|
26
|
+
}),
|
|
27
|
+
...(opts.enabled !== undefined ? { enabled: opts.enabled } : {}),
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { quote } from "../../../../pull/util.js";
|
|
2
|
+
import { sdkPackageSpecifier } from "../../../internal/sdk-package.js";
|
|
3
|
+
import { callerAccessMode } from "../types.js";
|
|
4
|
+
function constantKey(values, value) {
|
|
5
|
+
const entry = Object.entries(values).find(([, candidate]) => candidate === value);
|
|
6
|
+
if (entry === undefined)
|
|
7
|
+
throw new Error(`No public constant for ${value}`);
|
|
8
|
+
return entry[0];
|
|
9
|
+
}
|
|
10
|
+
export function printPhoneService(service, opts) {
|
|
11
|
+
const lines = [
|
|
12
|
+
"/**",
|
|
13
|
+
" * Auto-generated by EDK (v2 pull). Hand-edit freely; the generator is a",
|
|
14
|
+
" * one-shot starting point, not a live-binding view.",
|
|
15
|
+
" */",
|
|
16
|
+
"",
|
|
17
|
+
];
|
|
18
|
+
const imports = ["definePhoneService"];
|
|
19
|
+
if (service.callerAccessMode !== undefined)
|
|
20
|
+
imports.push("callerAccessMode");
|
|
21
|
+
lines.push(`import { ${imports.sort().join(", ")} } from ${quote(sdkPackageSpecifier("app"))};`);
|
|
22
|
+
lines.push('import catalog from "@catalog";');
|
|
23
|
+
lines.push("");
|
|
24
|
+
lines.push(`const ${service.refName} = definePhoneService({`);
|
|
25
|
+
lines.push(` app: catalog.${opts.appRefName},`);
|
|
26
|
+
lines.push(` agent: catalog.${opts.appRefName}.agents.${service.agentKey},`);
|
|
27
|
+
lines.push(` provider: catalog.phoneProviders.${service.providerKey},`);
|
|
28
|
+
if (service.callerAccessMode !== undefined) {
|
|
29
|
+
lines.push(` callerAccessMode: callerAccessMode.${constantKey(callerAccessMode, service.callerAccessMode)},`);
|
|
30
|
+
}
|
|
31
|
+
if (service.twilioExistingNumber !== undefined) {
|
|
32
|
+
lines.push(` twilioExistingNumber: { phoneNumber: ${quote(service.twilioExistingNumber.phoneNumber)} },`);
|
|
33
|
+
}
|
|
34
|
+
if (service.twilioNewNumber !== undefined) {
|
|
35
|
+
lines.push(` twilioNewNumber: { areaCode: ${service.twilioNewNumber.areaCode} },`);
|
|
36
|
+
}
|
|
37
|
+
if (service.registration !== undefined) {
|
|
38
|
+
const registration = service.registration;
|
|
39
|
+
const parts = [];
|
|
40
|
+
if (registration.generateFirstMessage !== undefined)
|
|
41
|
+
parts.push(`generateFirstMessage: ${registration.generateFirstMessage}`);
|
|
42
|
+
if (registration.expandLanguages !== undefined)
|
|
43
|
+
parts.push(`expandLanguages: ${registration.expandLanguages}`);
|
|
44
|
+
if (registration.defaultLanguage !== undefined)
|
|
45
|
+
parts.push(`defaultLanguage: ${quote(registration.defaultLanguage)}`);
|
|
46
|
+
if (registration.enableLanguageRouting !== undefined)
|
|
47
|
+
parts.push(`enableLanguageRouting: ${registration.enableLanguageRouting}`);
|
|
48
|
+
if (registration.preferredLanguages !== undefined)
|
|
49
|
+
parts.push(`preferredLanguages: ${JSON.stringify(registration.preferredLanguages)}`);
|
|
50
|
+
lines.push(` registration: { ${parts.join(", ")} },`);
|
|
51
|
+
}
|
|
52
|
+
lines.push("});", "", `export default ${service.refName};`, "");
|
|
53
|
+
return lines.join("\n");
|
|
54
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type FromTfContext } from "../../engine/pull/context.js";
|
|
2
|
+
import { type TfBlock } from "../../engine/tf/index.js";
|
|
3
|
+
import { type CallerAccessMode, type E164PhoneNumber } from "./types.js";
|
|
4
|
+
export interface NormalizedPhoneService {
|
|
5
|
+
readonly refName: string;
|
|
6
|
+
readonly agentKey: string;
|
|
7
|
+
readonly providerKey: string;
|
|
8
|
+
readonly callerAccessMode?: CallerAccessMode;
|
|
9
|
+
readonly twilioExistingNumber?: {
|
|
10
|
+
readonly phoneNumber: E164PhoneNumber;
|
|
11
|
+
};
|
|
12
|
+
readonly twilioNewNumber?: {
|
|
13
|
+
readonly areaCode: number;
|
|
14
|
+
};
|
|
15
|
+
readonly registration?: {
|
|
16
|
+
readonly generateFirstMessage?: boolean;
|
|
17
|
+
readonly expandLanguages?: boolean;
|
|
18
|
+
readonly defaultLanguage?: string;
|
|
19
|
+
readonly enableLanguageRouting?: boolean;
|
|
20
|
+
readonly preferredLanguages?: readonly string[];
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare function phoneServiceFromTf(block: TfBlock, opts: {
|
|
24
|
+
readonly appLabel: string;
|
|
25
|
+
}, ctx: FromTfContext): NormalizedPhoneService | undefined;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { dataRefLabel, optionalString, plainObject, resourceRefLabel } from "../../engine/pull/context.js";
|
|
2
|
+
import { scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
3
|
+
import { AGENT_RESOURCE_TYPE } from "../agent/module.js";
|
|
4
|
+
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
5
|
+
import { callerAccessMode } from "./types.js";
|
|
6
|
+
const KNOWN_ATTRS = new Set([
|
|
7
|
+
"app_id", "provider_id", "agent_id", "caller_access_mode", "twilio_existing_number",
|
|
8
|
+
"twilio_new_number", "registration",
|
|
9
|
+
]);
|
|
10
|
+
const CALLER_ACCESS_MODES = new Set(Object.values(callerAccessMode));
|
|
11
|
+
function isCallerAccessMode(value) {
|
|
12
|
+
return CALLER_ACCESS_MODES.has(value);
|
|
13
|
+
}
|
|
14
|
+
export function phoneServiceFromTf(block, opts, ctx) {
|
|
15
|
+
const label = block.label ?? "";
|
|
16
|
+
const where = `phone service "${label}"`;
|
|
17
|
+
for (const key of Object.keys(block.attrs)) {
|
|
18
|
+
if (!KNOWN_ATTRS.has(key))
|
|
19
|
+
ctx.diagnostics.push(`${where}: unhandled attribute "${key}" — extend phoneServiceFromTf deliberately`);
|
|
20
|
+
}
|
|
21
|
+
if (resourceRefLabel(block.attrs["app_id"], APP_RESOURCE_TYPE) !== opts.appLabel) {
|
|
22
|
+
ctx.diagnostics.push(`${where}: app_id does not reference ${APP_RESOURCE_TYPE}.${opts.appLabel}; skipped`);
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
const agentLabel = resourceRefLabel(block.attrs["agent_id"], AGENT_RESOURCE_TYPE);
|
|
26
|
+
if (agentLabel === undefined) {
|
|
27
|
+
ctx.diagnostics.push(`${where}: agent_id is not a managed ${AGENT_RESOURCE_TYPE} reference; skipped`);
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
const providerLabel = dataRefLabel(block.attrs["provider_id"], "elementum_phone_provider");
|
|
31
|
+
const providerName = providerLabel !== undefined ? ctx.dataName("elementum_phone_provider", providerLabel) : undefined;
|
|
32
|
+
if (providerLabel === undefined || providerName === undefined) {
|
|
33
|
+
ctx.diagnostics.push(`${where}: provider_id is not a resolvable elementum_phone_provider data reference; skipped`);
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
const existing = plainObject(block.attrs["twilio_existing_number"]);
|
|
37
|
+
const created = plainObject(block.attrs["twilio_new_number"]);
|
|
38
|
+
const existingNumber = existing?.["phone_number"];
|
|
39
|
+
const areaCode = created?.["area_code"];
|
|
40
|
+
const hasExisting = typeof existingNumber === "string" && /^\+[1-9]\d{7,14}$/.test(existingNumber);
|
|
41
|
+
const hasCreated = typeof areaCode === "number" && Number.isInteger(areaCode);
|
|
42
|
+
if (hasExisting === hasCreated) {
|
|
43
|
+
ctx.diagnostics.push(`${where}: expected exactly one valid Twilio existing number or new area code; skipped`);
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
const callerAccess = optionalString(block.attrs, "caller_access_mode", where, ctx);
|
|
47
|
+
if (callerAccess !== undefined && !isCallerAccessMode(callerAccess)) {
|
|
48
|
+
ctx.diagnostics.push(`${where}: unsupported caller_access_mode "${callerAccess}"; omitted`);
|
|
49
|
+
}
|
|
50
|
+
const registrationRaw = plainObject(block.attrs["registration"]);
|
|
51
|
+
const preferred = registrationRaw?.["preferred_languages"];
|
|
52
|
+
const preferredLanguages = Array.isArray(preferred) && preferred.every((value) => typeof value === "string")
|
|
53
|
+
? preferred
|
|
54
|
+
: undefined;
|
|
55
|
+
if (preferred !== undefined && preferredLanguages === undefined) {
|
|
56
|
+
ctx.diagnostics.push(`${where}: preferred_languages is not a string list; omitted`);
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
refName: scopedLabelToBagKey(opts.appLabel, label, "app"),
|
|
60
|
+
agentKey: scopedLabelToBagKey(opts.appLabel, agentLabel, "app"),
|
|
61
|
+
providerKey: tfLabelToTsLabel(providerLabel),
|
|
62
|
+
...(callerAccess !== undefined && isCallerAccessMode(callerAccess) ? { callerAccessMode: callerAccess } : {}),
|
|
63
|
+
...(hasExisting ? { twilioExistingNumber: { phoneNumber: existingNumber } } : {}),
|
|
64
|
+
...(hasCreated ? { twilioNewNumber: { areaCode: areaCode } } : {}),
|
|
65
|
+
...(registrationRaw !== undefined ? {
|
|
66
|
+
registration: {
|
|
67
|
+
...(typeof registrationRaw["generate_first_message"] === "boolean" ? { generateFirstMessage: registrationRaw["generate_first_message"] } : {}),
|
|
68
|
+
...(typeof registrationRaw["expand_languages"] === "boolean" ? { expandLanguages: registrationRaw["expand_languages"] } : {}),
|
|
69
|
+
...(typeof registrationRaw["default_language"] === "string" ? { defaultLanguage: registrationRaw["default_language"] } : {}),
|
|
70
|
+
...(typeof registrationRaw["enable_language_routing"] === "boolean" ? { enableLanguageRouting: registrationRaw["enable_language_routing"] } : {}),
|
|
71
|
+
...(preferredLanguages !== undefined ? { preferredLanguages } : {}),
|
|
72
|
+
},
|
|
73
|
+
} : {}),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { bareFactoryEntry } from "../../catalog/render-helpers.js";
|
|
2
|
+
import { NO_CANVAS } from "../../graph/types.js";
|
|
3
|
+
import { printPhoneService } from "./deserializer/print-phone-service.js";
|
|
4
|
+
import { phoneServiceFromTf } from "./from-tf.js";
|
|
5
|
+
import { phoneServiceToTf } from "./to-tf.js";
|
|
6
|
+
export const PHONE_SERVICE_RESOURCE_TYPE = "elementum_phone_service";
|
|
7
|
+
function phoneServiceStubRef(refName, parent) {
|
|
8
|
+
return { __kind: "phone-service", refName, name: refName, parent };
|
|
9
|
+
}
|
|
10
|
+
function phoneServiceRefFromAuthoring(args) {
|
|
11
|
+
const configured = args.defaultExport;
|
|
12
|
+
return typeof configured?.ref === "function" ? configured.ref(args.refName) : undefined;
|
|
13
|
+
}
|
|
14
|
+
export const phoneServiceModule = {
|
|
15
|
+
kind: "phone-service",
|
|
16
|
+
stream: { role: "streamMember" },
|
|
17
|
+
authoring: { unit: "ownFile", bag: "phoneServices" },
|
|
18
|
+
parents: [{ parent: "app", child: "phone-service" }],
|
|
19
|
+
resource: { shape: "single", resourceType: PHONE_SERVICE_RESOURCE_TYPE, adoptable: true },
|
|
20
|
+
data: { participates: true, resourceType: PHONE_SERVICE_RESOURCE_TYPE, lookupAttr: "id", referencedByBuild: false },
|
|
21
|
+
lifecycle: {
|
|
22
|
+
participates: true,
|
|
23
|
+
extractOwnFile: (ownBlocks, _stream, ctx) => {
|
|
24
|
+
const items = [];
|
|
25
|
+
for (const block of ownBlocks) {
|
|
26
|
+
const service = phoneServiceFromTf(block, { appLabel: ctx.appTfLabel }, ctx);
|
|
27
|
+
if (service !== undefined)
|
|
28
|
+
items.push(service);
|
|
29
|
+
}
|
|
30
|
+
return { items, skipped: [], diagnostics: [] };
|
|
31
|
+
},
|
|
32
|
+
printOwnFile: (item, opts) => {
|
|
33
|
+
const service = item;
|
|
34
|
+
return { refName: service.refName, source: printPhoneService(service, { appRefName: opts.appRefName }) };
|
|
35
|
+
},
|
|
36
|
+
toTf: (entity, ctx) => phoneServiceToTf(entity, {
|
|
37
|
+
appRefName: ctx.appRefName,
|
|
38
|
+
appTfLabel: ctx.appTfLabel,
|
|
39
|
+
orgRefs: ctx.orgRefs,
|
|
40
|
+
diagnostics: ctx.diagnostics,
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
43
|
+
canvas: NO_CANVAS,
|
|
44
|
+
catalog: {
|
|
45
|
+
participates: true,
|
|
46
|
+
refKind: "phone-service",
|
|
47
|
+
catalogBag: "phoneServices",
|
|
48
|
+
renderOrder: 65,
|
|
49
|
+
catalogRoot: "app",
|
|
50
|
+
factoryName: "phoneServiceRef",
|
|
51
|
+
renderEntry: ({ keyName, baseIndent }) => bareFactoryEntry("phoneServiceRef", keyName, baseIndent),
|
|
52
|
+
stubRef: phoneServiceStubRef,
|
|
53
|
+
refFromAuthoring: phoneServiceRefFromAuthoring,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OrgRefLookup } from "../../engine/build/context.js";
|
|
2
|
+
import { type DeployableEntity } from "../../engine/entity.js";
|
|
3
|
+
import { type TfBlock } from "../../engine/tf/index.js";
|
|
4
|
+
export declare function phoneServiceToTf(entity: DeployableEntity, opts: {
|
|
5
|
+
readonly appRefName: string;
|
|
6
|
+
readonly appTfLabel: string;
|
|
7
|
+
readonly orgRefs: OrgRefLookup;
|
|
8
|
+
readonly diagnostics: string[];
|
|
9
|
+
}): {
|
|
10
|
+
readonly blocks: readonly TfBlock[];
|
|
11
|
+
readonly address: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { EntityTfError } from "../../engine/entity.js";
|
|
2
|
+
import { expr, scopedResourceLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
3
|
+
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
4
|
+
import { AGENT_RESOURCE_TYPE } from "../agent/module.js";
|
|
5
|
+
import { PHONE_PROVIDER_ORG_BAG } from "../org/phone-provider.js";
|
|
6
|
+
import { PHONE_SERVICE_RESOURCE_TYPE } from "./module.js";
|
|
7
|
+
export function phoneServiceToTf(entity, opts) {
|
|
8
|
+
if (entity.kind !== "phone-service") {
|
|
9
|
+
throw new EntityTfError(`phoneServiceToTf expects kind "phone-service"; got "${entity.kind}"`);
|
|
10
|
+
}
|
|
11
|
+
const service = entity.payload;
|
|
12
|
+
if (service === null || service.app?.refName !== opts.appRefName) {
|
|
13
|
+
throw new EntityTfError(`phone service "${entity.refName}" does not reference owning app "${opts.appRefName}"`);
|
|
14
|
+
}
|
|
15
|
+
const agentRefName = service.agent?.refName;
|
|
16
|
+
if (agentRefName === undefined || service.agent?.parent !== opts.appRefName) {
|
|
17
|
+
throw new EntityTfError(`phone service "${entity.refName}" does not reference an agent owned by app "${opts.appRefName}"`);
|
|
18
|
+
}
|
|
19
|
+
const providerKey = service.provider?.refName ?? "";
|
|
20
|
+
const provider = opts.orgRefs.byTsLabel(PHONE_PROVIDER_ORG_BAG, providerKey);
|
|
21
|
+
if (provider === undefined) {
|
|
22
|
+
throw new EntityTfError(`phone service "${entity.refName}": provider token "${providerKey}" is not in org.phoneProviders — re-run \`elementum pull org --data-only\``);
|
|
23
|
+
}
|
|
24
|
+
const label = scopedResourceLabel(opts.appTfLabel, tsLabelToTfLabel(entity.refName), "app");
|
|
25
|
+
const attrs = {
|
|
26
|
+
app_id: expr.resourceAttr(APP_RESOURCE_TYPE, opts.appTfLabel, ["id"]),
|
|
27
|
+
provider_id: expr.dataAttr("elementum_phone_provider", provider.tfLabel, ["id"]),
|
|
28
|
+
agent_id: expr.resourceAttr(AGENT_RESOURCE_TYPE, scopedResourceLabel(opts.appTfLabel, tsLabelToTfLabel(agentRefName), "app"), ["id"]),
|
|
29
|
+
};
|
|
30
|
+
if (service.callerAccessMode !== undefined)
|
|
31
|
+
attrs["caller_access_mode"] = service.callerAccessMode;
|
|
32
|
+
if (service.twilioExistingNumber !== undefined) {
|
|
33
|
+
attrs["twilio_existing_number"] = { phone_number: service.twilioExistingNumber.phoneNumber ?? "" };
|
|
34
|
+
}
|
|
35
|
+
if (service.twilioNewNumber !== undefined) {
|
|
36
|
+
attrs["twilio_new_number"] = { area_code: service.twilioNewNumber.areaCode ?? 0 };
|
|
37
|
+
}
|
|
38
|
+
if (service.registration !== undefined) {
|
|
39
|
+
const registration = {};
|
|
40
|
+
if (service.registration.generateFirstMessage !== undefined)
|
|
41
|
+
registration["generate_first_message"] = service.registration.generateFirstMessage;
|
|
42
|
+
if (service.registration.expandLanguages !== undefined)
|
|
43
|
+
registration["expand_languages"] = service.registration.expandLanguages;
|
|
44
|
+
if (service.registration.defaultLanguage !== undefined)
|
|
45
|
+
registration["default_language"] = service.registration.defaultLanguage;
|
|
46
|
+
if (service.registration.enableLanguageRouting !== undefined)
|
|
47
|
+
registration["enable_language_routing"] = service.registration.enableLanguageRouting;
|
|
48
|
+
if (service.registration.preferredLanguages !== undefined)
|
|
49
|
+
registration["preferred_languages"] = [...service.registration.preferredLanguages];
|
|
50
|
+
attrs["registration"] = registration;
|
|
51
|
+
}
|
|
52
|
+
const block = { kind: "resource", type: PHONE_SERVICE_RESOURCE_TYPE, label, attrs };
|
|
53
|
+
return { blocks: [block], address: `${PHONE_SERVICE_RESOURCE_TYPE}.${label}` };
|
|
54
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Caller-access modes documented by the phone-service HCL resource. */
|
|
2
|
+
export declare const callerAccessMode: {
|
|
3
|
+
readonly allowAll: "ALLOW_ALL";
|
|
4
|
+
readonly knownCallersOnly: "KNOWN_CALLERS_ONLY";
|
|
5
|
+
};
|
|
6
|
+
export type CallerAccessMode = (typeof callerAccessMode)[keyof typeof callerAccessMode];
|
|
7
|
+
/** A syntactically explicit international phone number. */
|
|
8
|
+
export type E164PhoneNumber = `+${number}`;
|
|
9
|
+
export interface PhoneServiceRegistration {
|
|
10
|
+
readonly generateFirstMessage?: boolean;
|
|
11
|
+
readonly expandLanguages?: boolean;
|
|
12
|
+
/** The provider accepts a language string (for example, `en-US`). */
|
|
13
|
+
readonly defaultLanguage?: string;
|
|
14
|
+
readonly enableLanguageRouting?: boolean;
|
|
15
|
+
readonly preferredLanguages?: readonly string[];
|
|
16
|
+
}
|
|
17
|
+
interface PhoneServiceNumberBase {
|
|
18
|
+
readonly callerAccessMode?: CallerAccessMode;
|
|
19
|
+
readonly registration?: PhoneServiceRegistration;
|
|
20
|
+
}
|
|
21
|
+
/** Exactly one HCL number configuration is required. */
|
|
22
|
+
export type PhoneServiceNumber = PhoneServiceNumberBase & ({
|
|
23
|
+
readonly twilioExistingNumber: {
|
|
24
|
+
readonly phoneNumber: E164PhoneNumber;
|
|
25
|
+
};
|
|
26
|
+
readonly twilioNewNumber?: never;
|
|
27
|
+
} | {
|
|
28
|
+
readonly twilioExistingNumber?: never;
|
|
29
|
+
readonly twilioNewNumber: {
|
|
30
|
+
readonly areaCode: number;
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
/** Runtime backstop for JavaScript callers and dynamically constructed input. */
|
|
34
|
+
export declare function validatePhoneService(name: string, service: PhoneServiceNumber): void;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Caller-access modes documented by the phone-service HCL resource. */
|
|
2
|
+
export const callerAccessMode = {
|
|
3
|
+
allowAll: "ALLOW_ALL",
|
|
4
|
+
knownCallersOnly: "KNOWN_CALLERS_ONLY",
|
|
5
|
+
};
|
|
6
|
+
/** Runtime backstop for JavaScript callers and dynamically constructed input. */
|
|
7
|
+
export function validatePhoneService(name, service) {
|
|
8
|
+
const fail = (message) => {
|
|
9
|
+
throw new Error(`definePhoneService "${name}": ${message}`);
|
|
10
|
+
};
|
|
11
|
+
const existing = service.twilioExistingNumber;
|
|
12
|
+
const created = service.twilioNewNumber;
|
|
13
|
+
if ((existing === undefined) === (created === undefined)) {
|
|
14
|
+
fail("set exactly one of twilioExistingNumber or twilioNewNumber");
|
|
15
|
+
}
|
|
16
|
+
if (existing !== undefined && !/^\+[1-9]\d{7,14}$/.test(existing.phoneNumber)) {
|
|
17
|
+
fail("twilioExistingNumber.phoneNumber must be an E.164 number such as +14155551234");
|
|
18
|
+
}
|
|
19
|
+
if (created !== undefined && !Number.isInteger(created.areaCode)) {
|
|
20
|
+
fail("twilioNewNumber.areaCode must be an integer");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type FromTfContext } from "../../engine/pull/context.js";
|
|
2
|
+
import { type ChildResourceScope, type TfBlock } from "../../engine/tf/index.js";
|
|
3
|
+
import type { NormalizedRecordCreateForm } from "../app/deserializer/normalize.js";
|
|
4
|
+
export interface RecordCreateFormOwner {
|
|
5
|
+
readonly type: string;
|
|
6
|
+
readonly label: string;
|
|
7
|
+
readonly ownerTfLabel: string;
|
|
8
|
+
readonly scope: ChildResourceScope;
|
|
9
|
+
}
|
|
10
|
+
/** Provider resource -> id-free normalized create-form authoring. */
|
|
11
|
+
export declare function recordCreateFormFromTf(block: TfBlock | undefined, owner: RecordCreateFormOwner, ctx: FromTfContext): NormalizedRecordCreateForm | undefined;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { optionalString, plainObject, resourceRefLabel } from "../../engine/pull/context.js";
|
|
2
|
+
import { reportUnknownAttrs } from "../../engine/pull/attrs.js";
|
|
3
|
+
import { scopedLabelToBagKey } from "../../engine/tf/index.js";
|
|
4
|
+
import { fieldKeyFromTfRef } from "../field/from-tf.js";
|
|
5
|
+
import { RECORD_CREATE_FORM_RESOURCE_TYPE } from "./module.js";
|
|
6
|
+
const KNOWN_ATTRS = new Set(["app_id", "sections"]);
|
|
7
|
+
const KNOWN_SECTION_ATTRS = new Set([
|
|
8
|
+
"name", "field_ids", "agent_id", "icon", "color", "display_order", "display_location",
|
|
9
|
+
"side_nav_item", "hidden", "max_columns",
|
|
10
|
+
]);
|
|
11
|
+
/** Provider resource -> id-free normalized create-form authoring. */
|
|
12
|
+
export function recordCreateFormFromTf(block, owner, ctx) {
|
|
13
|
+
if (block === undefined)
|
|
14
|
+
return undefined;
|
|
15
|
+
const where = `${RECORD_CREATE_FORM_RESOURCE_TYPE}.${block.label ?? "?"}`;
|
|
16
|
+
reportUnknownAttrs(block.attrs, KNOWN_ATTRS, where, "recordCreateFormFromTf", ctx);
|
|
17
|
+
if (resourceRefLabel(block.attrs["app_id"], owner.type) !== owner.label) {
|
|
18
|
+
ctx.diagnostics.push(`${where}: app_id does not reference ${owner.type}.${owner.label}; skipped`);
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
const rawSections = block.attrs["sections"];
|
|
22
|
+
if (!Array.isArray(rawSections)) {
|
|
23
|
+
ctx.diagnostics.push(`${where}: sections is not a list; skipped`);
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const sections = [];
|
|
27
|
+
for (const [index, raw] of rawSections.entries()) {
|
|
28
|
+
const section = sectionFromTf(raw, index, where, owner, ctx);
|
|
29
|
+
if (section !== undefined)
|
|
30
|
+
sections.push(section);
|
|
31
|
+
}
|
|
32
|
+
return { sections };
|
|
33
|
+
}
|
|
34
|
+
function sectionFromTf(raw, index, formWhere, owner, ctx) {
|
|
35
|
+
const rec = plainObject(raw);
|
|
36
|
+
const where = `${formWhere} section ${index}`;
|
|
37
|
+
if (rec === undefined) {
|
|
38
|
+
ctx.diagnostics.push(`${where}: unrecognized shape; dropped`);
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
reportUnknownAttrs(rec, KNOWN_SECTION_ATTRS, where, "recordCreateFormFromTf", ctx);
|
|
42
|
+
const fieldIds = rec["field_ids"];
|
|
43
|
+
if (!Array.isArray(fieldIds)) {
|
|
44
|
+
ctx.diagnostics.push(`${where}: field_ids is not a list; dropped`);
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
const fields = [];
|
|
48
|
+
for (const fieldId of fieldIds) {
|
|
49
|
+
const key = fieldKeyFromTfRef(fieldId, owner.ownerTfLabel, owner.scope);
|
|
50
|
+
if (key === undefined)
|
|
51
|
+
ctx.diagnostics.push(`${where}: a field_ids entry is not a known field reference; dropped`);
|
|
52
|
+
else
|
|
53
|
+
fields.push(key);
|
|
54
|
+
}
|
|
55
|
+
const agentLabel = resourceRefLabel(rec["agent_id"], "elementum_agent");
|
|
56
|
+
if (rec["agent_id"] !== undefined && agentLabel === undefined) {
|
|
57
|
+
ctx.diagnostics.push(`${where}: agent_id is not an elementum_agent resource reference; dropped`);
|
|
58
|
+
}
|
|
59
|
+
if (agentLabel !== undefined && owner.scope !== "app") {
|
|
60
|
+
ctx.diagnostics.push(`${where}: agent-assisted sections are only supported on app-owned forms; agent dropped`);
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
name: optionalString(rec, "name", where, ctx) ?? "",
|
|
64
|
+
fields,
|
|
65
|
+
...(agentLabel !== undefined && owner.scope === "app" && { agentKey: scopedLabelToBagKey(owner.ownerTfLabel, agentLabel, "app") }),
|
|
66
|
+
...(typeof rec["icon"] === "string" && { icon: rec["icon"] }),
|
|
67
|
+
...(typeof rec["color"] === "string" && { color: rec["color"] }),
|
|
68
|
+
...(typeof rec["display_order"] === "number" && { displayOrder: rec["display_order"] }),
|
|
69
|
+
...(typeof rec["display_location"] === "string" && { displayLocation: rec["display_location"] }),
|
|
70
|
+
...(typeof rec["side_nav_item"] === "boolean" && { sideNavItem: rec["side_nav_item"] }),
|
|
71
|
+
...(typeof rec["hidden"] === "boolean" && { hidden: rec["hidden"] }),
|
|
72
|
+
...(typeof rec["max_columns"] === "number" && { maxColumns: rec["max_columns"] }),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Record-create-form graph declaration. */
|
|
2
|
+
import { type EntityKindModule } from "../../graph/types.js";
|
|
3
|
+
export declare const RECORD_CREATE_FORM_RESOURCE_TYPE = "elementum_record_create_form";
|
|
4
|
+
/**
|
|
5
|
+
* One immutable create form may be owned by an app or element. Task ownership
|
|
6
|
+
* is not wired into the graph yet. Its
|
|
7
|
+
* provider id is deliberately the owner's id, but Terraform supports the
|
|
8
|
+
* two distinct resource addresses in state, so this resource remains
|
|
9
|
+
* adoptable and participates in pull's zero-write gate.
|
|
10
|
+
*/
|
|
11
|
+
export declare const recordCreateFormModule: EntityKindModule;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Record-create-form graph declaration. */
|
|
2
|
+
import { NO_CANVAS, NO_CATALOG, NO_DATA, NO_LIFECYCLE } from "../../graph/types.js";
|
|
3
|
+
export const RECORD_CREATE_FORM_RESOURCE_TYPE = "elementum_record_create_form";
|
|
4
|
+
/**
|
|
5
|
+
* One immutable create form may be owned by an app or element. Task ownership
|
|
6
|
+
* is not wired into the graph yet. Its
|
|
7
|
+
* provider id is deliberately the owner's id, but Terraform supports the
|
|
8
|
+
* two distinct resource addresses in state, so this resource remains
|
|
9
|
+
* adoptable and participates in pull's zero-write gate.
|
|
10
|
+
*/
|
|
11
|
+
export const recordCreateFormModule = {
|
|
12
|
+
kind: "record-create-form",
|
|
13
|
+
stream: { role: "streamMember" },
|
|
14
|
+
authoring: { unit: "inline", bag: "recordCreateForm" },
|
|
15
|
+
parents: [
|
|
16
|
+
{ parent: "app", child: "record-create-form" },
|
|
17
|
+
{ parent: "element", child: "record-create-form" },
|
|
18
|
+
],
|
|
19
|
+
resource: { shape: "single", resourceType: RECORD_CREATE_FORM_RESOURCE_TYPE, adoptable: true },
|
|
20
|
+
data: NO_DATA,
|
|
21
|
+
lifecycle: NO_LIFECYCLE,
|
|
22
|
+
canvas: NO_CANVAS,
|
|
23
|
+
catalog: NO_CATALOG,
|
|
24
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ChildResourceScope, type TfBlock, type TfValue } from "../../engine/tf/index.js";
|
|
2
|
+
export type RecordCreateFormFieldRefWire = string | {
|
|
3
|
+
readonly refName?: string;
|
|
4
|
+
readonly fieldType?: string;
|
|
5
|
+
readonly parent?: string;
|
|
6
|
+
};
|
|
7
|
+
export interface RecordCreateFormSectionWire {
|
|
8
|
+
readonly name?: string;
|
|
9
|
+
readonly fields?: readonly RecordCreateFormFieldRefWire[];
|
|
10
|
+
readonly agent?: {
|
|
11
|
+
readonly refName?: string;
|
|
12
|
+
readonly parent?: string;
|
|
13
|
+
};
|
|
14
|
+
readonly icon?: string;
|
|
15
|
+
readonly color?: string;
|
|
16
|
+
readonly displayOrder?: number;
|
|
17
|
+
readonly displayLocation?: string;
|
|
18
|
+
readonly sideNavItem?: boolean;
|
|
19
|
+
readonly hidden?: boolean;
|
|
20
|
+
readonly maxColumns?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface RecordCreateFormWire {
|
|
23
|
+
readonly sections?: readonly RecordCreateFormSectionWire[];
|
|
24
|
+
}
|
|
25
|
+
export interface RecordCreateFormToTfOptions {
|
|
26
|
+
readonly ownerRefName: string;
|
|
27
|
+
readonly ownerTfLabel: string;
|
|
28
|
+
readonly scope: ChildResourceScope;
|
|
29
|
+
readonly objectId: TfValue;
|
|
30
|
+
readonly diagnostics: string[];
|
|
31
|
+
}
|
|
32
|
+
/** Typed authoring form -> the provider's immutable sections resource. */
|
|
33
|
+
export declare function recordCreateFormToTf(form: RecordCreateFormWire | undefined, opts: RecordCreateFormToTfOptions): TfBlock | undefined;
|