@elementumai/edk 0.8.2-alpha.6 → 0.9.5
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 +49 -37
- 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 +3 -11
- package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.d.ts +1 -1
- package/dist-sdk/elementum-entity-client/clients/skills/models/skill.d.ts +1 -1
- package/dist-sdk/elementum-entity-client/clients/skills/models/skill.js +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/pull/util.d.ts +1 -1
- package/dist-sdk/pull/util.js +3 -3
- package/dist-sdk/src/catalog/factories.d.ts +96 -23
- package/dist-sdk/src/catalog/factories.js +141 -21
- package/dist-sdk/src/catalog/from-authoring.d.ts +5 -5
- package/dist-sdk/src/catalog/from-authoring.js +20 -10
- 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 +63 -4
- package/dist-sdk/src/catalog/render-helpers.d.ts +1 -1
- package/dist-sdk/src/catalog/render-helpers.js +1 -1
- package/dist-sdk/src/catalog/render.d.ts +1 -0
- package/dist-sdk/src/catalog/render.js +8 -2
- package/dist-sdk/src/catalog/token.js +18 -4
- package/dist-sdk/src/catalog/types.d.ts +64 -24
- package/dist-sdk/src/catalog/types.js +12 -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 +11 -10
- package/dist-sdk/src/core/index.js +10 -9
- 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} +3 -3
- package/dist-sdk/src/{entities/flow/activities/render-catalog.js → core/render-tree.js} +7 -10
- package/dist-sdk/src/core/types/ai-provider.d.ts +1 -1
- package/dist-sdk/src/core/types/ai-provider.js +1 -1
- package/dist-sdk/src/core/types/app.d.ts +78 -52
- package/dist-sdk/src/core/types/app.js +2 -3
- package/dist-sdk/src/core/types/aspect-category.d.ts +4 -4
- package/dist-sdk/src/core/types/aspect-category.js +4 -4
- package/dist-sdk/src/core/types/cloud-link.d.ts +3 -3
- package/dist-sdk/src/core/types/cloud-link.js +3 -3
- package/dist-sdk/src/core/types/display-block.d.ts +2 -2
- package/dist-sdk/src/core/types/display-block.js +2 -2
- package/dist-sdk/src/core/types/group.d.ts +1 -1
- package/dist-sdk/src/core/types/group.js +1 -1
- package/dist-sdk/src/core/types/user.d.ts +1 -1
- package/dist-sdk/src/core/types/user.js +1 -1
- package/dist-sdk/src/core/wire/ref-serializer.js +3 -3
- package/dist-sdk/src/engine/build/context.d.ts +23 -16
- package/dist-sdk/src/engine/entity.d.ts +1 -1
- 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 +73 -0
- package/dist-sdk/src/engine/pull/context.js +14 -0
- package/dist-sdk/src/engine/pull/org.d.ts +10 -0
- package/dist-sdk/src/engine/pull/org.js +35 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +37 -0
- package/dist-sdk/src/engine/pull/ref-only.js +204 -0
- package/dist-sdk/src/engine/tf/expr.d.ts +7 -3
- package/dist-sdk/src/engine/tf/expr.js +27 -15
- package/dist-sdk/src/engine/tf/index.d.ts +1 -1
- package/dist-sdk/src/engine/tf/index.js +1 -1
- package/dist-sdk/src/engine/tf/model.d.ts +8 -1
- package/dist-sdk/src/engine/tf/model.js +4 -0
- package/dist-sdk/src/engine/tf/parse.js +13 -2
- package/dist-sdk/src/engine/tf/render.js +4 -0
- package/dist-sdk/src/engine/workspace/authoring-layout.js +4 -2
- package/dist-sdk/src/entities/access-policy/build.d.ts +6 -16
- package/dist-sdk/src/entities/access-policy/build.js +2 -2
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +14 -40
- package/dist-sdk/src/entities/access-policy/from-tf.js +26 -85
- package/dist-sdk/src/entities/access-policy/principal.d.ts +39 -0
- package/dist-sdk/src/entities/access-policy/principal.js +13 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +33 -6
- package/dist-sdk/src/entities/access-policy/to-tf.js +62 -60
- package/dist-sdk/src/entities/agent/build.d.ts +42 -11
- package/dist-sdk/src/entities/agent/build.js +40 -19
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +11 -1
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +180 -45
- package/dist-sdk/src/entities/agent/from-tf.d.ts +3 -1
- package/dist-sdk/src/entities/agent/from-tf.js +17 -12
- 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 +7 -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 +6 -2
- package/dist-sdk/src/entities/agent/to-tf.js +58 -9
- package/dist-sdk/src/entities/agent/tools.d.ts +97 -70
- package/dist-sdk/src/entities/agent/tools.js +63 -43
- 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-evaluation/build.d.ts +19 -0
- package/dist-sdk/src/entities/agent-evaluation/build.js +41 -0
- package/dist-sdk/src/entities/agent-evaluation/deserializer/print-agent-evaluation.d.ts +4 -0
- package/dist-sdk/src/entities/agent-evaluation/deserializer/print-agent-evaluation.js +30 -0
- package/dist-sdk/src/entities/agent-evaluation/from-tf.d.ts +12 -0
- package/dist-sdk/src/entities/agent-evaluation/from-tf.js +46 -0
- package/dist-sdk/src/entities/agent-evaluation/index.d.ts +1 -0
- package/dist-sdk/src/entities/agent-evaluation/index.js +1 -0
- package/dist-sdk/src/entities/agent-evaluation/module.d.ts +3 -0
- package/dist-sdk/src/entities/agent-evaluation/module.js +58 -0
- package/dist-sdk/src/entities/agent-evaluation/to-tf.d.ts +12 -0
- package/dist-sdk/src/entities/agent-evaluation/to-tf.js +35 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +25 -15
- package/dist-sdk/src/entities/agent-tool/from-tf.js +175 -43
- package/dist-sdk/src/entities/agent-tool/module.js +6 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +15 -7
- package/dist-sdk/src/entities/agent-tool/to-tf.js +169 -48
- package/dist-sdk/src/entities/agent-tool/types.d.ts +4 -6
- package/dist-sdk/src/entities/agent-tool/types.js +30 -29
- package/dist-sdk/src/entities/app/build.d.ts +214 -47
- package/dist-sdk/src/entities/app/build.js +128 -66
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +188 -8
- package/dist-sdk/src/entities/app/deserializer/pulled-expression.d.ts +59 -0
- package/dist-sdk/src/entities/app/deserializer/pulled-expression.js +70 -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 +20 -8
- package/dist-sdk/src/entities/app/index.js +16 -6
- package/dist-sdk/src/entities/app/module.js +29 -4
- package/dist-sdk/src/entities/app/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/app/to-tf.js +97 -7
- 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 +177 -95
- package/dist-sdk/src/entities/automation/build.js +164 -72
- package/dist-sdk/src/entities/automation/calculation-expression.d.ts +191 -0
- package/dist-sdk/src/entities/automation/calculation-expression.js +57 -0
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +18 -9
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +18 -14
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +214 -311
- 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 +28 -0
- package/dist-sdk/src/entities/automation/from-tf.js +695 -182
- package/dist-sdk/src/entities/automation/index.d.ts +9 -10
- package/dist-sdk/src/entities/automation/index.js +11 -11
- package/dist-sdk/src/entities/automation/module.js +82 -8
- package/dist-sdk/src/entities/automation/operators.d.ts +32 -48
- package/dist-sdk/src/entities/automation/operators.js +10 -37
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +1 -1
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +1 -1
- package/dist-sdk/src/entities/automation/script-code.js +107 -28
- package/dist-sdk/src/entities/automation/serialize.js +1 -1
- package/dist-sdk/src/entities/automation/tasks.d.ts +167 -102
- package/dist-sdk/src/entities/automation/tasks.js +66 -13
- package/dist-sdk/src/entities/automation/to-tf.d.ts +44 -3
- package/dist-sdk/src/entities/automation/to-tf.js +607 -161
- package/dist-sdk/src/entities/automation/triggers.d.ts +33 -25
- package/dist-sdk/src/entities/automation/triggers.js +8 -2
- package/dist-sdk/src/entities/automation/types.d.ts +3 -2
- package/dist-sdk/src/entities/automation/types.js +3 -2
- package/dist-sdk/src/entities/chart/build.d.ts +95 -0
- package/dist-sdk/src/entities/chart/build.js +42 -0
- package/dist-sdk/src/entities/chart/from-tf.d.ts +55 -0
- package/dist-sdk/src/entities/chart/from-tf.js +269 -0
- package/dist-sdk/src/entities/chart/index.d.ts +4 -0
- package/dist-sdk/src/entities/chart/index.js +3 -0
- package/dist-sdk/src/entities/chart/module.d.ts +3 -0
- package/dist-sdk/src/entities/chart/module.js +61 -0
- package/dist-sdk/src/entities/chart/printer.d.ts +5 -0
- package/dist-sdk/src/entities/chart/printer.js +104 -0
- package/dist-sdk/src/entities/chart/to-tf.d.ts +15 -0
- package/dist-sdk/src/entities/chart/to-tf.js +150 -0
- package/dist-sdk/src/entities/chart/types.d.ts +53 -0
- package/dist-sdk/src/entities/chart/types.js +22 -0
- package/dist-sdk/src/entities/dashboard/build.d.ts +44 -0
- package/dist-sdk/src/entities/dashboard/build.js +16 -0
- package/dist-sdk/src/entities/dashboard/from-tf.d.ts +12 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +113 -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 +43 -0
- package/dist-sdk/src/entities/dashboard/to-tf.js +121 -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/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 +304 -0
- package/dist-sdk/src/entities/dynamic-layout/build.js +4 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +4 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.js +47 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +10 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +239 -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 +48 -38
- package/dist-sdk/src/entities/element/build.js +24 -33
- 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 +14 -7
- package/dist-sdk/src/entities/element/index.js +11 -5
- package/dist-sdk/src/entities/element/module.js +26 -5
- package/dist-sdk/src/entities/element/to-tf.d.ts +2 -1
- package/dist-sdk/src/entities/element/to-tf.js +64 -4
- package/dist-sdk/src/entities/field/build.d.ts +55 -27
- package/dist-sdk/src/entities/field/build.js +31 -6
- package/dist-sdk/src/entities/field/calc/aggregate.d.ts +52 -21
- package/dist-sdk/src/entities/field/calc/aggregate.js +59 -29
- package/dist-sdk/src/entities/field/calc/date.d.ts +78 -29
- package/dist-sdk/src/entities/field/calc/date.js +120 -29
- package/dist-sdk/src/entities/field/calc/index.d.ts +80 -85
- package/dist-sdk/src/entities/field/calc/index.js +82 -139
- package/dist-sdk/src/entities/field/calc/numeric.d.ts +8 -12
- package/dist-sdk/src/entities/field/calc/numeric.js +10 -27
- package/dist-sdk/src/entities/field/calc/runtime.d.ts +19 -2
- package/dist-sdk/src/entities/field/calc/runtime.js +79 -8
- package/dist-sdk/src/entities/field/calc/text.d.ts +32 -23
- package/dist-sdk/src/entities/field/calc/text.js +43 -31
- package/dist-sdk/src/entities/field/calc/types.d.ts +36 -81
- package/dist-sdk/src/entities/field/calc/types.js +1 -22
- package/dist-sdk/src/entities/field/calc.d.ts +71 -48
- package/dist-sdk/src/entities/field/calc.js +5 -15
- package/dist-sdk/src/entities/field/calculation-types.d.ts +6 -0
- package/dist-sdk/src/entities/field/calculation-types.js +49 -0
- package/dist-sdk/src/entities/field/from-tf.js +238 -13
- package/dist-sdk/src/entities/field/locals.d.ts +11 -3
- package/dist-sdk/src/entities/field/locals.js +15 -2
- package/dist-sdk/src/entities/field/module.d.ts +1 -0
- package/dist-sdk/src/entities/field/module.js +27 -7
- package/dist-sdk/src/entities/field/record-shape.d.ts +25 -11
- package/dist-sdk/src/entities/field/to-tf.d.ts +41 -2
- package/dist-sdk/src/entities/field/to-tf.js +314 -40
- package/dist-sdk/src/entities/field/types.d.ts +1 -1
- package/dist-sdk/src/entities/field/types.js +10 -1
- package/dist-sdk/src/entities/file-reader/build.d.ts +71 -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 +12 -10
- 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/cloud-link.js +4 -5
- package/dist-sdk/src/entities/org/email-alias.d.ts +2 -0
- package/dist-sdk/src/entities/org/email-alias.js +12 -0
- package/dist-sdk/src/entities/org/group.js +4 -5
- package/dist-sdk/src/entities/org/index.d.ts +2 -0
- package/dist-sdk/src/entities/org/index.js +2 -0
- package/dist-sdk/src/entities/org/phone-provider.d.ts +4 -0
- package/dist-sdk/src/entities/org/phone-provider.js +30 -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 +241 -0
- package/dist-sdk/src/entities/organization/build.js +165 -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 +21 -0
- package/dist-sdk/src/entities/organization/to-tf.d.ts +7 -0
- package/dist-sdk/src/entities/organization/to-tf.js +154 -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 +56 -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 +88 -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 +32 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +145 -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 +32 -0
- package/dist-sdk/src/entities/service-account/to-tf.js +103 -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/context.d.ts +25 -24
- package/dist-sdk/src/entities/shared/context.js +36 -35
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +30 -81
- package/dist-sdk/src/entities/shared/filters/ast.js +6 -2
- package/dist-sdk/src/entities/shared/filters/index.d.ts +95 -206
- package/dist-sdk/src/entities/shared/filters/index.js +196 -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/shared/foreign-ref.d.ts +14 -0
- package/dist-sdk/src/entities/shared/foreign-ref.js +12 -0
- package/dist-sdk/src/entities/shared/ref.d.ts +26 -11
- package/dist-sdk/src/entities/shared/ref.js +8 -3
- package/dist-sdk/src/entities/shared/types/common.d.ts +2 -2
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +1 -1
- package/dist-sdk/src/entities/shared/types/field-types.js +1 -1
- package/dist-sdk/src/entities/skill/build.d.ts +4 -4
- package/dist-sdk/src/entities/skill/build.js +6 -5
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +11 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +100 -39
- package/dist-sdk/src/entities/skill/index.d.ts +3 -2
- package/dist-sdk/src/entities/skill/index.js +3 -2
- package/dist-sdk/src/entities/skill/module.js +8 -2
- package/dist-sdk/src/entities/skill/to-tf.d.ts +6 -2
- package/dist-sdk/src/entities/skill/to-tf.js +20 -2
- package/dist-sdk/src/entities/skill/tools.d.ts +47 -31
- package/dist-sdk/src/entities/skill/tools.js +37 -23
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +17 -1
- package/dist-sdk/src/entities/skill-tool/from-tf.js +118 -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 +100 -48
- 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 +41 -26
- package/dist-sdk/src/entities/table/catalog-render.js +15 -1
- 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 +222 -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/build.d.ts +46 -0
- package/dist-sdk/src/entities/view/build.js +19 -0
- package/dist-sdk/src/entities/view/from-tf.d.ts +7 -2
- package/dist-sdk/src/entities/view/from-tf.js +264 -30
- package/dist-sdk/src/entities/view/module.d.ts +6 -13
- package/dist-sdk/src/entities/view/module.js +12 -15
- package/dist-sdk/src/entities/view/sharing.d.ts +10 -0
- package/dist-sdk/src/entities/view/sharing.js +6 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +56 -12
- package/dist-sdk/src/entities/view/to-tf.js +192 -20
- package/dist-sdk/src/entities/view/types.d.ts +8 -0
- package/dist-sdk/src/entities/view/types.js +46 -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 +15 -0
- package/dist-sdk/src/entities/visual-flow/to-tf.js +97 -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 +45 -0
- package/dist-sdk/src/entities/widget/to-tf.js +206 -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 +12 -1
- package/dist-sdk/src/graph/index.js +8 -19
- package/dist-sdk/src/graph/modules.js +35 -1
- package/dist-sdk/src/graph/types.d.ts +106 -7
- package/dist-sdk/src/internal/safe-identifier.d.ts +4 -0
- package/dist-sdk/src/internal/safe-identifier.js +13 -0
- package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
- package/dist-sdk/src/internal/sdk-package.js +5 -2
- package/package.json +39 -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 → datamine/build.js} +0 -0
|
@@ -1,32 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Public surface of the calculated-field DSL — the `calc` namespace.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* coercion handles the common case automatically)
|
|
11
|
-
* - Sub-select projections: label, id, email, name
|
|
12
|
-
*
|
|
13
|
-
* Out of scope for v1 (lands in PR 3+ per the agreed scoping):
|
|
14
|
-
* - IFS, COALESCE, NULLIF, ISBLANK, BLANK
|
|
15
|
-
* - Aggregations (SUM, COUNT, AVG, MIN, MAX, …)
|
|
16
|
-
* - Date functions (NOW, DATEDIF, YEAR, …)
|
|
17
|
-
* - Text functions (CONCAT, LEN, UPPER, …)
|
|
18
|
-
* - Regex, JSON, manifest-driven tier-2 functions
|
|
19
|
-
* - Parameters ({{trigger}}, {{task}}), UDFs
|
|
4
|
+
* Covers the public Knowhere calculated-expression grammar: arithmetic and
|
|
5
|
+
* comparisons; logical/conditional functions; aggregate functions; date,
|
|
6
|
+
* text, regex, JSON, and numeric functions; literals; and field projections.
|
|
7
|
+
* Automation workflow parameters layer on in
|
|
8
|
+
* `automation/calculation-expression.ts` because they are not calculated-field
|
|
9
|
+
* concepts.
|
|
20
10
|
*
|
|
21
11
|
* Operator naming: `plus` / `minus` / `times` / `dividedBy` instead of
|
|
22
12
|
* `add` / `subtract` / `multiply` / `divide` so the resulting code
|
|
23
13
|
* reads close to the math expression. Same shape as the Java
|
|
24
14
|
* `ExpressionUtil.addition` / `subtraction` / etc. helpers.
|
|
25
15
|
*/
|
|
26
|
-
import { coerce, makeExpr } from "./runtime.js";
|
|
27
|
-
import { concat, toText, len, trim, upper, lower, left, right, mid, substitute, find, search, splitText, regexMatch, regexReplace, regexExtract, jsonEscape, jsonUnescape, } from "./text.js";
|
|
28
|
-
import { round, power, sqrt,
|
|
29
|
-
import { now,
|
|
16
|
+
import { coerce, makeComposedExpr, makeExpr } from "./runtime.js";
|
|
17
|
+
import { concat, toText, len, trim, upper, lower, left, right, mid, substitute, find, search, split, splitText, regexMatch, regexReplace, regexExtract, jsonEscape, jsonUnescape, repeat, } from "./text.js";
|
|
18
|
+
import { round, power, sqrt, toNumber, uuid } from "./numeric.js";
|
|
19
|
+
import { now, makeDate, dateTime, dateValue, dateDiff, dateDif, truncateDateTime, dateTimeTrunc, weekday, year, month, day, hour, minute, second, } from "./date.js";
|
|
30
20
|
import { countIf, sumIf, stringAgg, stringAggUnique, } from "./aggregate.js";
|
|
31
21
|
// ---------------------------------------------------------------------------
|
|
32
22
|
// Aggregations
|
|
@@ -71,13 +61,30 @@ function text(value) {
|
|
|
71
61
|
function bool(value) {
|
|
72
62
|
return coerce(value);
|
|
73
63
|
}
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
// Arithmetic
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
// Arithmetic statically follows Knowhere's promotion rules: integer-only
|
|
68
|
+
// operations stay NUMBER, any DECIMAL operand promotes to DECIMAL, and
|
|
69
|
+
// division always yields DECIMAL. The server remains authoritative and
|
|
70
|
+
// validates the inferred type at compose time.
|
|
71
|
+
// plus and minus are overloaded for date/datetime arithmetic:
|
|
72
|
+
// - date + numeric → date (e.g. "Due Date" + 5 → 5 days later)
|
|
73
|
+
// - datetime + numeric → datetime
|
|
74
|
+
// - numeric + numeric → numeric (default arithmetic)
|
|
75
|
+
//
|
|
76
|
+
// DATE plus a decimal promotes to DATETIME because fractional days do not fit
|
|
77
|
+
// in a DATE; DATE plus a NUMBER remains DATE. DATETIME remains DATETIME.
|
|
78
|
+
//
|
|
79
|
+
// times and dividedBy stay numeric-only — date * number and
|
|
80
|
+
// date / number aren't valid in the calc grammar.
|
|
74
81
|
function plus(a, b) {
|
|
75
82
|
const ae = coerce(a);
|
|
76
83
|
const be = coerce(b);
|
|
77
84
|
const brand = ae.__exprType === "date" ? "date" :
|
|
78
85
|
ae.__exprType === "datetime" ? "datetime" :
|
|
79
86
|
"decimal";
|
|
80
|
-
return
|
|
87
|
+
return makeComposedExpr(brand, [ae, be], () => `(${ae.toCalcString()} + ${be.toCalcString()})`);
|
|
81
88
|
}
|
|
82
89
|
function minus(a, b) {
|
|
83
90
|
const ae = coerce(a);
|
|
@@ -85,118 +92,74 @@ function minus(a, b) {
|
|
|
85
92
|
const brand = ae.__exprType === "date" ? "date" :
|
|
86
93
|
ae.__exprType === "datetime" ? "datetime" :
|
|
87
94
|
"decimal";
|
|
88
|
-
return
|
|
95
|
+
return makeComposedExpr(brand, [ae, be], () => `(${ae.toCalcString()} - ${be.toCalcString()})`);
|
|
89
96
|
}
|
|
90
97
|
function times(a, b) {
|
|
91
98
|
const ae = coerce(a);
|
|
92
99
|
const be = coerce(b);
|
|
93
|
-
|
|
100
|
+
const type = ae.__exprType === "decimal" || be.__exprType === "decimal" ? "decimal" : "number";
|
|
101
|
+
return makeComposedExpr(type, [ae, be], () => `(${ae.toCalcString()} * ${be.toCalcString()})`);
|
|
94
102
|
}
|
|
95
103
|
function dividedBy(a, b) {
|
|
96
104
|
const ae = coerce(a);
|
|
97
105
|
const be = coerce(b);
|
|
98
|
-
return
|
|
106
|
+
return makeComposedExpr("decimal", [ae, be], () => `(${ae.toCalcString()} / ${be.toCalcString()})`);
|
|
99
107
|
}
|
|
100
|
-
// ---------------------------------------------------------------------------
|
|
101
|
-
// Comparison
|
|
102
|
-
// ---------------------------------------------------------------------------
|
|
103
|
-
// `gt` / `lt` / `gte` / `lte` are restricted to ComparableExprType
|
|
104
|
-
// (number, decimal, text, date, datetime). `eq` / `ne` widen to any
|
|
105
|
-
// `ExprType` so authors can compare booleans, picklist ids, user ids,
|
|
106
|
-
// etc. — anything assignable from one side is assignable from the other.
|
|
107
|
-
//
|
|
108
|
-
// Wire format: comparison expressions are emitted BARE — no
|
|
109
|
-
// surrounding parens. The ANTLR grammar's "expression" production
|
|
110
|
-
// covers arithmetic / column refs / literals but NOT comparisons; a
|
|
111
|
-
// comparison is a "boolean expression," a separate production. So
|
|
112
|
-
// `(a > b)` fails to parse — the parser sees `(` and expects an
|
|
113
|
-
// expression, then chokes on `>`. Authors compose comparisons with
|
|
114
|
-
// `and` / `or` / `not` / `if` etc., never inside parens.
|
|
115
108
|
function gt(a, b) {
|
|
116
109
|
const ae = coerce(a);
|
|
117
110
|
const be = coerce(b);
|
|
118
|
-
return
|
|
111
|
+
return makeComposedExpr("bool", [ae, be], () => `${ae.toCalcString()} > ${be.toCalcString()}`);
|
|
119
112
|
}
|
|
120
113
|
function lt(a, b) {
|
|
121
114
|
const ae = coerce(a);
|
|
122
115
|
const be = coerce(b);
|
|
123
|
-
return
|
|
116
|
+
return makeComposedExpr("bool", [ae, be], () => `${ae.toCalcString()} < ${be.toCalcString()}`);
|
|
124
117
|
}
|
|
125
118
|
function gte(a, b) {
|
|
126
119
|
const ae = coerce(a);
|
|
127
120
|
const be = coerce(b);
|
|
128
|
-
return
|
|
121
|
+
return makeComposedExpr("bool", [ae, be], () => `${ae.toCalcString()} >= ${be.toCalcString()}`);
|
|
129
122
|
}
|
|
130
123
|
function lte(a, b) {
|
|
131
124
|
const ae = coerce(a);
|
|
132
125
|
const be = coerce(b);
|
|
133
|
-
return
|
|
126
|
+
return makeComposedExpr("bool", [ae, be], () => `${ae.toCalcString()} <= ${be.toCalcString()}`);
|
|
134
127
|
}
|
|
135
128
|
function eq(a, b) {
|
|
136
129
|
const ae = coerce(a);
|
|
137
130
|
const be = coerce(b);
|
|
138
|
-
return
|
|
131
|
+
return makeComposedExpr("bool", [ae, be], () => `${ae.toCalcString()} = ${be.toCalcString()}`);
|
|
139
132
|
}
|
|
140
133
|
function ne(a, b) {
|
|
141
134
|
const ae = coerce(a);
|
|
142
135
|
const be = coerce(b);
|
|
143
|
-
return
|
|
136
|
+
return makeComposedExpr("bool", [ae, be], () => `${ae.toCalcString()} <> ${be.toCalcString()}`);
|
|
144
137
|
}
|
|
145
138
|
// ---------------------------------------------------------------------------
|
|
146
139
|
// Logical
|
|
147
140
|
// ---------------------------------------------------------------------------
|
|
148
141
|
function and(a, b, ...rest) {
|
|
149
142
|
const all = [a, b, ...rest].map((v) => coerce(v));
|
|
150
|
-
return
|
|
143
|
+
return makeComposedExpr("bool", all, () => `AND(${all.map((e) => e.toCalcString()).join(", ")})`);
|
|
151
144
|
}
|
|
152
145
|
function or(a, b, ...rest) {
|
|
153
146
|
const all = [a, b, ...rest].map((v) => coerce(v));
|
|
154
|
-
return
|
|
155
|
-
}
|
|
156
|
-
function not(value) {
|
|
157
|
-
const e = coerce(value);
|
|
158
|
-
return makeExpr("bool", () => `NOT(${e.toCalcString()})`);
|
|
147
|
+
return makeComposedExpr("bool", all, () => `OR(${all.map((e) => e.toCalcString()).join(", ")})`);
|
|
159
148
|
}
|
|
160
|
-
// ---------------------------------------------------------------------------
|
|
161
|
-
// Conditional
|
|
162
|
-
// ---------------------------------------------------------------------------
|
|
163
|
-
// `if(cond, then, else)` — both arms must produce the same brand, so
|
|
164
|
-
// the generic infers from the wider of the two arms. The output
|
|
165
|
-
// inherits the arms' brand.
|
|
166
149
|
function if_(cond, thenArm, elseArm) {
|
|
167
150
|
const c = coerce(cond);
|
|
168
151
|
const t = coerce(thenArm);
|
|
169
152
|
const e = coerce(elseArm);
|
|
170
|
-
return
|
|
153
|
+
return makeComposedExpr(t.__exprType, [c, t, e], () => `IF(${c.toCalcString()}, ${t.toCalcString()}, ${e.toCalcString()})`);
|
|
171
154
|
}
|
|
172
|
-
/**
|
|
173
|
-
* Multi-branch conditional — `IFS(c1, v1, c2, v2, …, finalElse?)`.
|
|
174
|
-
* Conditions are evaluated in order; the first one whose check
|
|
175
|
-
* passes determines the result. If no condition matches and no
|
|
176
|
-
* final-else value is supplied, the result is null (BLANK on the
|
|
177
|
-
* wire).
|
|
178
|
-
*
|
|
179
|
-
* Args must come in (cond, value) pairs, optionally with one
|
|
180
|
-
* trailing value as the final else. The typing accepts the pairs
|
|
181
|
-
* as `[BoolLike, ExprLike<T>]` tuples plus an optional final
|
|
182
|
-
* `ExprLike<T>` so all branches share the same result brand.
|
|
183
|
-
*
|
|
184
|
-
* Runtime validates parity — the EDK throws if an odd-then-even-
|
|
185
|
-
* looking arg list slips past TS (e.g. when args is spread from an
|
|
186
|
-
* untyped source).
|
|
187
|
-
*/
|
|
188
155
|
function ifs(...args) {
|
|
189
|
-
if (args.length
|
|
190
|
-
throw new Error("calc.ifs:
|
|
156
|
+
if (args.length < 2 || args.length % 2 !== 0) {
|
|
157
|
+
throw new Error("calc.ifs: condition/value arguments must be complete pairs.");
|
|
191
158
|
}
|
|
192
|
-
// The first arg is always a condition; pairs alternate from there.
|
|
193
|
-
// A trailing odd-positioned arg (after at least one full pair) is
|
|
194
|
-
// the final else. Validate the shape so a malformed call surfaces
|
|
195
|
-
// early instead of producing nonsense wire text.
|
|
196
159
|
const branches = [];
|
|
197
160
|
let inferredBrand = undefined;
|
|
198
161
|
for (let i = 0; i < args.length; i++) {
|
|
199
|
-
const expectBool = i % 2 === 0
|
|
162
|
+
const expectBool = i % 2 === 0;
|
|
200
163
|
if (expectBool) {
|
|
201
164
|
branches.push(coerce(args[i]));
|
|
202
165
|
}
|
|
@@ -210,28 +173,7 @@ function ifs(...args) {
|
|
|
210
173
|
if (inferredBrand == null) {
|
|
211
174
|
throw new Error("calc.ifs: at least one value arm is required.");
|
|
212
175
|
}
|
|
213
|
-
return
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Return the first non-null argument. All args must share the same
|
|
217
|
-
* result brand. The wire emits `COALESCE(a, b, …)`.
|
|
218
|
-
*/
|
|
219
|
-
function coalesce(...args) {
|
|
220
|
-
if (args.length < 2) {
|
|
221
|
-
throw new Error("calc.coalesce: at least two arguments are required.");
|
|
222
|
-
}
|
|
223
|
-
const exprs = args.map((a) => coerce(a));
|
|
224
|
-
return makeExpr(exprs[0].__exprType, () => `COALESCE(${exprs.map((e) => e.toCalcString()).join(", ")})`);
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Return null when `a` and `b` are equal; otherwise return `a`.
|
|
228
|
-
* Mirrors SQL `NULLIF`. Useful for guarding against divide-by-zero:
|
|
229
|
-
* `calc.dividedBy(x, calc.nullIf(y, 0))`.
|
|
230
|
-
*/
|
|
231
|
-
function nullIf(a, b) {
|
|
232
|
-
const ae = coerce(a);
|
|
233
|
-
const be = coerce(b);
|
|
234
|
-
return makeExpr(ae.__exprType, () => `NULLIF(${ae.toCalcString()}, ${be.toCalcString()})`);
|
|
176
|
+
return makeComposedExpr(inferredBrand, branches, () => `IFS(${branches.map((e) => e.toCalcString()).join(", ")})`);
|
|
235
177
|
}
|
|
236
178
|
/**
|
|
237
179
|
* True when the argument is null/empty. Accepts any expression type.
|
|
@@ -240,35 +182,33 @@ function nullIf(a, b) {
|
|
|
240
182
|
*/
|
|
241
183
|
function isBlank(value) {
|
|
242
184
|
const e = coerce(value);
|
|
243
|
-
return
|
|
185
|
+
return makeComposedExpr("bool", [e], () => `ISBLANK(${e.toCalcString()})`);
|
|
244
186
|
}
|
|
245
|
-
|
|
246
|
-
* Null literal — the wire `BLANK()` function. Returns an `Expr<T>`
|
|
247
|
-
* whose brand is inferred from surrounding context (e.g. an
|
|
248
|
-
* `if`/`ifs` arm). Standalone use requires an explicit type argument
|
|
249
|
-
* (`calc.blank<"text">()`) because TS can't infer T from a
|
|
250
|
-
* zero-argument call site.
|
|
251
|
-
*/
|
|
252
|
-
function blank() {
|
|
187
|
+
function blank(_type) {
|
|
253
188
|
// Brand carried as a generic; the runtime doesn't know which type
|
|
254
189
|
// the call site expects. The wire string is the same in every
|
|
255
190
|
// context — server resolves the actual type at parse time based on
|
|
256
191
|
// surrounding expressions.
|
|
257
192
|
return makeExpr("text", () => "BLANK()");
|
|
258
193
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
//
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
194
|
+
/** Explicitly typed escape hatch for pulled and legacy formula text. */
|
|
195
|
+
function raw(formula, resultType) {
|
|
196
|
+
// Raw text is the deliberately unsafe boundary: its field/context needs are
|
|
197
|
+
// opaque to TypeScript and remain subject to Ultron validation at build.
|
|
198
|
+
return makeExpr(resultType, () => formula);
|
|
199
|
+
}
|
|
200
|
+
/** Invoke a configured scalar user-defined function from its CloudLink catalog ref. */
|
|
201
|
+
function call(udf, ...args) {
|
|
202
|
+
const expressions = args.map((arg) => coerce(arg));
|
|
203
|
+
if (expressions.length !== udf.parameterTypes.length) {
|
|
204
|
+
throw new Error(`calc.call: ${udf.name} expects ${udf.parameterTypes.length} arguments, received ${expressions.length}.`);
|
|
205
|
+
}
|
|
206
|
+
const name = udf.name.replace(/"/g, '""');
|
|
207
|
+
return makeExpr(udf.resultType, () => `Function."${name}"(${expressions.map((expression) => expression.toCalcString()).join(", ")})`, { context: "record" });
|
|
208
|
+
}
|
|
269
209
|
function sum(value) {
|
|
270
210
|
const e = coerce(value);
|
|
271
|
-
return
|
|
211
|
+
return makeComposedExpr(e.__exprType, [e], () => `SUM(${e.toCalcString()})`);
|
|
272
212
|
}
|
|
273
213
|
/**
|
|
274
214
|
* Count of non-null values for the argument expression across related
|
|
@@ -276,7 +216,7 @@ function sum(value) {
|
|
|
276
216
|
*/
|
|
277
217
|
function count(value) {
|
|
278
218
|
const e = coerce(value);
|
|
279
|
-
return
|
|
219
|
+
return makeComposedExpr("number", [e], () => `COUNT(${e.toCalcString()})`);
|
|
280
220
|
}
|
|
281
221
|
/**
|
|
282
222
|
* Distinct count of the argument expression across related rows.
|
|
@@ -285,7 +225,7 @@ function count(value) {
|
|
|
285
225
|
*/
|
|
286
226
|
function countUnique(value) {
|
|
287
227
|
const e = coerce(value);
|
|
288
|
-
return
|
|
228
|
+
return makeComposedExpr("number", [e], () => `COUNTUNIQUE(${e.toCalcString()})`);
|
|
289
229
|
}
|
|
290
230
|
/**
|
|
291
231
|
* Arithmetic mean of a numeric expression across related rows.
|
|
@@ -294,7 +234,7 @@ function countUnique(value) {
|
|
|
294
234
|
*/
|
|
295
235
|
function average(value) {
|
|
296
236
|
const e = coerce(value);
|
|
297
|
-
return
|
|
237
|
+
return makeComposedExpr("decimal", [e], () => `AVERAGE(${e.toCalcString()})`);
|
|
298
238
|
}
|
|
299
239
|
/**
|
|
300
240
|
* Standard deviation of a numeric expression across related rows.
|
|
@@ -302,21 +242,21 @@ function average(value) {
|
|
|
302
242
|
*/
|
|
303
243
|
function stdev(value) {
|
|
304
244
|
const e = coerce(value);
|
|
305
|
-
return
|
|
245
|
+
return makeComposedExpr("decimal", [e], () => `STDEV(${e.toCalcString()})`);
|
|
306
246
|
}
|
|
307
247
|
function min(...args) {
|
|
308
248
|
if (args.length === 0) {
|
|
309
249
|
throw new Error("calc.min: at least one argument is required.");
|
|
310
250
|
}
|
|
311
251
|
const exprs = args.map((a) => coerce(a));
|
|
312
|
-
return
|
|
252
|
+
return makeComposedExpr(exprs[0].__exprType, exprs, () => `MIN(${exprs.map((e) => e.toCalcString()).join(", ")})`);
|
|
313
253
|
}
|
|
314
254
|
function max(...args) {
|
|
315
255
|
if (args.length === 0) {
|
|
316
256
|
throw new Error("calc.max: at least one argument is required.");
|
|
317
257
|
}
|
|
318
258
|
const exprs = args.map((a) => coerce(a));
|
|
319
|
-
return
|
|
259
|
+
return makeComposedExpr(exprs[0].__exprType, exprs, () => `MAX(${exprs.map((e) => e.toCalcString()).join(", ")})`);
|
|
320
260
|
}
|
|
321
261
|
// ---------------------------------------------------------------------------
|
|
322
262
|
// Sub-select projections
|
|
@@ -327,22 +267,22 @@ function max(...args) {
|
|
|
327
267
|
/** Project a picklist field reference to its display label (text). */
|
|
328
268
|
function label(field) {
|
|
329
269
|
const e = coerce(field);
|
|
330
|
-
return
|
|
270
|
+
return makeComposedExpr("text", [e], () => `${e.toCalcString()}.LABEL`);
|
|
331
271
|
}
|
|
332
272
|
/** Project a reference-typed field to its id form (no-op for already-id refs). */
|
|
333
273
|
function id(field) {
|
|
334
274
|
const e = coerce(field);
|
|
335
|
-
return
|
|
275
|
+
return makeComposedExpr(e.__exprType, [e], () => `${e.toCalcString()}.ID`);
|
|
336
276
|
}
|
|
337
277
|
/** Project a user field reference to its email address (text). */
|
|
338
278
|
function email(field) {
|
|
339
279
|
const e = coerce(field);
|
|
340
|
-
return
|
|
280
|
+
return makeComposedExpr("text", [e], () => `${e.toCalcString()}.EMAIL`);
|
|
341
281
|
}
|
|
342
282
|
/** Project a group field reference to its name (text). */
|
|
343
283
|
function name(field) {
|
|
344
284
|
const e = coerce(field);
|
|
345
|
-
return
|
|
285
|
+
return makeComposedExpr("text", [e], () => `${e.toCalcString()}.NAME`);
|
|
346
286
|
}
|
|
347
287
|
// ---------------------------------------------------------------------------
|
|
348
288
|
// Public namespace
|
|
@@ -359,6 +299,8 @@ export const calc = {
|
|
|
359
299
|
text,
|
|
360
300
|
bool,
|
|
361
301
|
blank,
|
|
302
|
+
raw,
|
|
303
|
+
call,
|
|
362
304
|
plus,
|
|
363
305
|
minus,
|
|
364
306
|
times,
|
|
@@ -371,11 +313,8 @@ export const calc = {
|
|
|
371
313
|
ne,
|
|
372
314
|
and,
|
|
373
315
|
or,
|
|
374
|
-
not,
|
|
375
316
|
if: if_,
|
|
376
317
|
ifs,
|
|
377
|
-
coalesce,
|
|
378
|
-
nullIf,
|
|
379
318
|
isBlank,
|
|
380
319
|
sum,
|
|
381
320
|
count,
|
|
@@ -396,24 +335,26 @@ export const calc = {
|
|
|
396
335
|
substitute,
|
|
397
336
|
find,
|
|
398
337
|
search,
|
|
338
|
+
split,
|
|
399
339
|
splitText,
|
|
400
340
|
regexMatch,
|
|
401
341
|
regexReplace,
|
|
402
342
|
regexExtract,
|
|
403
343
|
jsonEscape,
|
|
404
344
|
jsonUnescape,
|
|
345
|
+
repeat,
|
|
405
346
|
round,
|
|
406
347
|
power,
|
|
407
348
|
sqrt,
|
|
408
|
-
mod,
|
|
409
|
-
abs,
|
|
410
349
|
toNumber,
|
|
411
350
|
uuid,
|
|
412
351
|
now,
|
|
413
|
-
today,
|
|
414
352
|
makeDate,
|
|
353
|
+
dateTime,
|
|
415
354
|
dateValue,
|
|
355
|
+
dateDiff,
|
|
416
356
|
dateDif,
|
|
357
|
+
truncateDateTime,
|
|
417
358
|
dateTimeTrunc,
|
|
418
359
|
weekday,
|
|
419
360
|
year,
|
|
@@ -431,3 +372,5 @@ export const calc = {
|
|
|
431
372
|
email,
|
|
432
373
|
name,
|
|
433
374
|
};
|
|
375
|
+
export { dateDiffUnit, dateDifUnit, dateTimeTruncPrecision, weekdayMode, } from "./date.js";
|
|
376
|
+
export { orderByDirection, predicateOp } from "./aggregate.js";
|
|
@@ -3,20 +3,16 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Each builder is a thin typed wrapper over a wire `FUNC(...)` form.
|
|
5
5
|
* Output brands mirror the Java test's behavior:
|
|
6
|
-
* - `round`
|
|
7
|
-
* (ROUND(x) returns the same bias as x; ROUND(x, n) returns
|
|
8
|
-
* DECIMAL because the caller asked for decimal places).
|
|
6
|
+
* - `round` returns NUMBER without places and DECIMAL with places.
|
|
9
7
|
* - `power`, `sqrt` return DECIMAL (fractional results possible).
|
|
10
|
-
* - `mod`, `abs` preserve numeric brand via overload.
|
|
11
8
|
* - `toNumber` coerces text → NUMBER.
|
|
12
9
|
* - `uuid` is nullary and returns a `uuid`-branded expression.
|
|
13
10
|
*/
|
|
14
|
-
import type { Expr, ExprLike,
|
|
15
|
-
export declare function round(value:
|
|
16
|
-
export declare function round(value:
|
|
17
|
-
export declare function
|
|
18
|
-
export declare function
|
|
19
|
-
export declare function
|
|
20
|
-
export declare function
|
|
21
|
-
export declare function toNumber(value: ExprLike<"text">): Expr<"number">;
|
|
11
|
+
import type { ComposedExpr, Expr, ExprLike, NumericLike } from "./types.js";
|
|
12
|
+
export declare function round<const Value extends NumericLike>(value: Value): ComposedExpr<"number", [Value]>;
|
|
13
|
+
export declare function round<const Value extends NumericLike>(value: Value, digits: 0): ComposedExpr<"number", [Value]>;
|
|
14
|
+
export declare function round<const Value extends NumericLike>(value: Value, digits: number): ComposedExpr<"decimal", [Value]>;
|
|
15
|
+
export declare function power<const Base extends NumericLike, const Exponent extends NumericLike>(base: Base, exponent: Exponent): ComposedExpr<"decimal", [Base, Exponent]>;
|
|
16
|
+
export declare function sqrt<const Value extends NumericLike>(value: Value): ComposedExpr<"decimal", [Value]>;
|
|
17
|
+
export declare function toNumber<const Value extends ExprLike<"text">>(value: Value): ComposedExpr<"number", [Value]>;
|
|
22
18
|
export declare function uuid(): Expr<"uuid">;
|
|
@@ -3,22 +3,21 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Each builder is a thin typed wrapper over a wire `FUNC(...)` form.
|
|
5
5
|
* Output brands mirror the Java test's behavior:
|
|
6
|
-
* - `round`
|
|
7
|
-
* (ROUND(x) returns the same bias as x; ROUND(x, n) returns
|
|
8
|
-
* DECIMAL because the caller asked for decimal places).
|
|
6
|
+
* - `round` returns NUMBER without places and DECIMAL with places.
|
|
9
7
|
* - `power`, `sqrt` return DECIMAL (fractional results possible).
|
|
10
|
-
* - `mod`, `abs` preserve numeric brand via overload.
|
|
11
8
|
* - `toNumber` coerces text → NUMBER.
|
|
12
9
|
* - `uuid` is nullary and returns a `uuid`-branded expression.
|
|
13
10
|
*/
|
|
14
|
-
import { coerce, makeExpr } from "./runtime.js";
|
|
11
|
+
import { coerce, makeComposedExpr, makeExpr } from "./runtime.js";
|
|
15
12
|
export function round(value, digits) {
|
|
16
13
|
const v = coerce(value);
|
|
17
14
|
if (digits === undefined) {
|
|
18
|
-
return
|
|
15
|
+
return makeComposedExpr("number", [v], () => `ROUND(${v.toCalcString()})`);
|
|
19
16
|
}
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
if (!Number.isInteger(digits) || digits < 0) {
|
|
18
|
+
throw new Error("calc.round: digits must be a non-negative integer literal.");
|
|
19
|
+
}
|
|
20
|
+
return makeComposedExpr(digits === 0 ? "number" : "decimal", [v], () => `ROUND(${v.toCalcString()}, ${digits})`);
|
|
22
21
|
}
|
|
23
22
|
// ---------------------------------------------------------------------------
|
|
24
23
|
// POWER — base^exponent, decimal output.
|
|
@@ -26,30 +25,14 @@ export function round(value, digits) {
|
|
|
26
25
|
export function power(base, exponent) {
|
|
27
26
|
const b = coerce(base);
|
|
28
27
|
const e = coerce(exponent);
|
|
29
|
-
return
|
|
28
|
+
return makeComposedExpr("decimal", [b, e], () => `POWER(${b.toCalcString()}, ${e.toCalcString()})`);
|
|
30
29
|
}
|
|
31
30
|
// ---------------------------------------------------------------------------
|
|
32
31
|
// SQRT — square root, decimal output. Server null-guards negatives.
|
|
33
32
|
// ---------------------------------------------------------------------------
|
|
34
33
|
export function sqrt(value) {
|
|
35
34
|
const v = coerce(value);
|
|
36
|
-
return
|
|
37
|
-
}
|
|
38
|
-
// ---------------------------------------------------------------------------
|
|
39
|
-
// MOD — remainder. Server emits this as the `%` operator under the
|
|
40
|
-
// hood, but the wire grammar accepts MOD(a, b) too. Preserves brand.
|
|
41
|
-
// ---------------------------------------------------------------------------
|
|
42
|
-
export function mod(a, b) {
|
|
43
|
-
const ae = coerce(a);
|
|
44
|
-
const be = coerce(b);
|
|
45
|
-
return makeExpr("decimal", () => `MOD(${ae.toCalcString()}, ${be.toCalcString()})`);
|
|
46
|
-
}
|
|
47
|
-
// ---------------------------------------------------------------------------
|
|
48
|
-
// ABS — absolute value. Preserves brand.
|
|
49
|
-
// ---------------------------------------------------------------------------
|
|
50
|
-
export function abs(value) {
|
|
51
|
-
const v = coerce(value);
|
|
52
|
-
return makeExpr("decimal", () => `ABS(${v.toCalcString()})`);
|
|
35
|
+
return makeComposedExpr("decimal", [v], () => `SQRT(${v.toCalcString()})`);
|
|
53
36
|
}
|
|
54
37
|
// ---------------------------------------------------------------------------
|
|
55
38
|
// VALUE (toNumber) — coerce text to numeric. Wire form is `VALUE(text)`.
|
|
@@ -57,7 +40,7 @@ export function abs(value) {
|
|
|
57
40
|
// ---------------------------------------------------------------------------
|
|
58
41
|
export function toNumber(value) {
|
|
59
42
|
const v = coerce(value);
|
|
60
|
-
return
|
|
43
|
+
return makeComposedExpr("number", [v], () => `VALUE(${v.toCalcString()})`);
|
|
61
44
|
}
|
|
62
45
|
// ---------------------------------------------------------------------------
|
|
63
46
|
// UUID — nullary generator, returns `uuid`-branded.
|
|
@@ -21,12 +21,25 @@
|
|
|
21
21
|
* canonical shape per the Java test).
|
|
22
22
|
*/
|
|
23
23
|
import type { AppField, FieldScope } from "../../../core/types/app.js";
|
|
24
|
-
import
|
|
24
|
+
import { type Ref } from "../../shared/ref.js";
|
|
25
|
+
import type { Expr, ExprCardinality, ExprContext, ExprLike, ExprType } from "./types.js";
|
|
25
26
|
/**
|
|
26
27
|
* Build an `Expr<T>` node from its type brand and a serializer
|
|
27
28
|
* closure. Internal — public builders compose this.
|
|
28
29
|
*/
|
|
29
|
-
export declare function makeExpr<T extends ExprType>(type: T, serialize: () => string
|
|
30
|
+
export declare function makeExpr<T extends ExprType, Cardinality extends ExprCardinality = "single", Context extends ExprContext = "standalone">(type: T, serialize: () => string, metadata?: {
|
|
31
|
+
readonly cardinality?: Cardinality;
|
|
32
|
+
readonly context?: Context;
|
|
33
|
+
}): Expr<T, Cardinality, Context>;
|
|
34
|
+
/**
|
|
35
|
+
* True if `value` is already an `Expr<T>` (built by a prior `calc.*`
|
|
36
|
+
* call or a pulled-expression marker). Discriminator-checked.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isExpr(value: unknown): value is Expr<ExprType, ExprCardinality, ExprContext>;
|
|
39
|
+
/** Aggregate runtime context metadata for a composed expression. */
|
|
40
|
+
export declare function expressionContext(expressions: readonly Expr<ExprType, ExprCardinality, ExprContext>[]): ExprContext;
|
|
41
|
+
/** Build a scalar parent node while preserving record-context metadata. */
|
|
42
|
+
export declare function makeComposedExpr<T extends ExprType>(type: T, expressions: readonly Expr<ExprType, ExprCardinality, ExprContext>[], serialize: () => string): Expr<T, "single", ExprContext>;
|
|
30
43
|
/**
|
|
31
44
|
* Emit the wire form of a field reference. UUID ids emit as
|
|
32
45
|
* `"<uuid>"`; placeholder ids fall back to `"<name>"`. The server
|
|
@@ -36,6 +49,9 @@ export declare function makeExpr<T extends ExprType>(type: T, serialize: () => s
|
|
|
36
49
|
* doubling) per the ANTLR grammar's IDENTIFIER_QUOTED rule.
|
|
37
50
|
*/
|
|
38
51
|
export declare function emitFieldRef(field: AppField<FieldScope>): string;
|
|
52
|
+
type WorkflowRefRenderer = (value: Ref<unknown, string>) => string;
|
|
53
|
+
/** Install the automation calculation parameter collector for one render. */
|
|
54
|
+
export declare function withWorkflowRefRenderer<T>(renderer: WorkflowRefRenderer, render: () => T): T;
|
|
39
55
|
/**
|
|
40
56
|
* Quote a TS string for the wire. Single-quoted with `''` escapes per
|
|
41
57
|
* the ANTLR grammar's STRING_LITERAL rule.
|
|
@@ -59,3 +75,4 @@ export declare function emitStringLiteral(value: string): string;
|
|
|
59
75
|
* reaching here.
|
|
60
76
|
*/
|
|
61
77
|
export declare function coerce<T extends ExprType>(value: ExprLike<T>): Expr<T>;
|
|
78
|
+
export {};
|