@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
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The platform's calc grammar treats DATE and DATETIME as distinct
|
|
5
5
|
* brands — DATE is calendar date (no time component), DATETIME is
|
|
6
|
-
* instant-in-time.
|
|
7
|
-
*
|
|
6
|
+
* instant-in-time. Knowhere accepts either brand for date-part extraction
|
|
7
|
+
* and DATETIME_TRUNC.
|
|
8
8
|
*
|
|
9
9
|
* Constrained string arguments are typed as literal unions so the
|
|
10
10
|
* agent gets autocomplete and compile-time validation:
|
|
11
|
-
* - `dateDif` unit: '
|
|
11
|
+
* - `dateDif` unit: 'S' | 'MIN' | 'H' | 'Y' | 'M' | 'D'
|
|
12
12
|
* - `dateTimeTrunc` precision: a date-part literal union
|
|
13
13
|
* - `weekday` mode: 1 | 2 | 3
|
|
14
14
|
*/
|
|
15
|
-
import { coerce, makeExpr, emitStringLiteral } from "./runtime.js";
|
|
15
|
+
import { coerce, makeComposedExpr, makeExpr, emitStringLiteral } from "./runtime.js";
|
|
16
16
|
// ---------------------------------------------------------------------------
|
|
17
17
|
// Constructors
|
|
18
18
|
// ---------------------------------------------------------------------------
|
|
@@ -20,10 +20,6 @@ import { coerce, makeExpr, emitStringLiteral } from "./runtime.js";
|
|
|
20
20
|
export function now() {
|
|
21
21
|
return makeExpr("datetime", () => `NOW()`);
|
|
22
22
|
}
|
|
23
|
-
/** Today's calendar date. Wire `TODAY()`. Returns DATE. */
|
|
24
|
-
export function today() {
|
|
25
|
-
return makeExpr("date", () => `TODAY()`);
|
|
26
|
-
}
|
|
27
23
|
/**
|
|
28
24
|
* Build a DATE from numeric year / month / day components.
|
|
29
25
|
* Wire `DATE(year, month, day)`. The `make` prefix avoids colliding
|
|
@@ -33,7 +29,16 @@ export function makeDate(year, month, day) {
|
|
|
33
29
|
const y = coerce(year);
|
|
34
30
|
const m = coerce(month);
|
|
35
31
|
const d = coerce(day);
|
|
36
|
-
return
|
|
32
|
+
return makeComposedExpr("date", [y, m, d], () => `DATE(${y.toCalcString()}, ${m.toCalcString()}, ${d.toCalcString()})`);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Build a DATETIME from numeric date and time components.
|
|
36
|
+
* Wire `DATETIME(year, month, day, hour, minute, second)`.
|
|
37
|
+
*/
|
|
38
|
+
export function dateTime(...values) {
|
|
39
|
+
const [year, month, day, hour, minute, second] = values;
|
|
40
|
+
const parts = [year, month, day, hour, minute, second].map((part) => coerce(part));
|
|
41
|
+
return makeComposedExpr("datetime", parts, () => `DATETIME(${parts.map((part) => part.toCalcString()).join(", ")})`);
|
|
37
42
|
}
|
|
38
43
|
/**
|
|
39
44
|
* Parse a text expression into a DATE. The server accepts ISO-style
|
|
@@ -42,68 +47,154 @@ export function makeDate(year, month, day) {
|
|
|
42
47
|
*/
|
|
43
48
|
export function dateValue(value) {
|
|
44
49
|
const v = coerce(value);
|
|
45
|
-
return
|
|
50
|
+
return makeComposedExpr("date", [v], () => `DATEVALUE(${v.toCalcString()})`);
|
|
46
51
|
}
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
// DATEDIF — difference between two dates/datetimes, in the specified unit.
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
/** Discoverable unit codes accepted by the wire `DATEDIF` function. */
|
|
56
|
+
export const dateDifUnit = {
|
|
57
|
+
seconds: "S",
|
|
58
|
+
minutes: "MIN",
|
|
59
|
+
hours: "H",
|
|
60
|
+
years: "Y",
|
|
61
|
+
months: "M",
|
|
62
|
+
days: "D",
|
|
63
|
+
};
|
|
64
|
+
/** Human-readable date difference units accepted by {@link dateDiff}. */
|
|
65
|
+
export const dateDiffUnit = {
|
|
66
|
+
seconds: "seconds",
|
|
67
|
+
minutes: "minutes",
|
|
68
|
+
hours: "hours",
|
|
69
|
+
years: "years",
|
|
70
|
+
months: "months",
|
|
71
|
+
days: "days",
|
|
72
|
+
};
|
|
73
|
+
const DATE_DIFF_UNIT_WIRE = {
|
|
74
|
+
seconds: "S",
|
|
75
|
+
minutes: "MIN",
|
|
76
|
+
hours: "H",
|
|
77
|
+
years: "Y",
|
|
78
|
+
months: "M",
|
|
79
|
+
days: "D",
|
|
80
|
+
};
|
|
47
81
|
/**
|
|
48
82
|
* Difference between `end` and `start` in the specified unit.
|
|
49
|
-
* - `'
|
|
50
|
-
* - `'
|
|
51
|
-
* - `'M'` — months
|
|
83
|
+
* - `'S'` — seconds; `'MIN'` — minutes; `'H'` — hours
|
|
84
|
+
* - `'D'` — days; `'M'` — months; `'Y'` — years
|
|
52
85
|
*/
|
|
86
|
+
/** @deprecated Prefer {@link dateDiff} with human-readable units. */
|
|
53
87
|
export function dateDif(start, end, unit) {
|
|
54
88
|
const s = coerce(start);
|
|
55
89
|
const e = coerce(end);
|
|
56
|
-
return
|
|
90
|
+
return makeComposedExpr("number", [s, e], () => `DATEDIF(${s.toCalcString()}, ${e.toCalcString()}, ${emitStringLiteral(unit)})`);
|
|
91
|
+
}
|
|
92
|
+
/** Difference between two dates using a readable unit name. */
|
|
93
|
+
export function dateDiff(start, end, unit) {
|
|
94
|
+
return dateDif(start, end, DATE_DIFF_UNIT_WIRE[unit]);
|
|
57
95
|
}
|
|
96
|
+
// ---------------------------------------------------------------------------
|
|
97
|
+
// DATETIME_TRUNC — truncate a datetime to the given precision.
|
|
98
|
+
// ---------------------------------------------------------------------------
|
|
99
|
+
/** Discoverable precision values accepted by `DATETIME_TRUNC`. */
|
|
100
|
+
export const dateTimeTruncPrecision = {
|
|
101
|
+
microseconds: "MICROSECONDS",
|
|
102
|
+
milliseconds: "MILLISECONDS",
|
|
103
|
+
second: "SECOND",
|
|
104
|
+
minute: "MINUTE",
|
|
105
|
+
hour: "HOUR",
|
|
106
|
+
day: "DAY",
|
|
107
|
+
week: "WEEK",
|
|
108
|
+
month: "MONTH",
|
|
109
|
+
quarter: "QUARTER",
|
|
110
|
+
year: "YEAR",
|
|
111
|
+
decade: "DECADE",
|
|
112
|
+
century: "CENTURY",
|
|
113
|
+
millennium: "MILLENNIUM",
|
|
114
|
+
};
|
|
115
|
+
const DATE_TIME_PRECISION_WIRE = {
|
|
116
|
+
microseconds: "MICROSECONDS",
|
|
117
|
+
milliseconds: "MILLISECONDS",
|
|
118
|
+
second: "SECOND",
|
|
119
|
+
minute: "MINUTE",
|
|
120
|
+
hour: "HOUR",
|
|
121
|
+
day: "DAY",
|
|
122
|
+
week: "WEEK",
|
|
123
|
+
month: "MONTH",
|
|
124
|
+
quarter: "QUARTER",
|
|
125
|
+
year: "YEAR",
|
|
126
|
+
decade: "DECADE",
|
|
127
|
+
century: "CENTURY",
|
|
128
|
+
millennium: "MILLENNIUM",
|
|
129
|
+
};
|
|
58
130
|
/**
|
|
59
|
-
* Truncate a DATETIME to the given precision. E.g.
|
|
131
|
+
* Truncate a DATE or DATETIME to the given precision. E.g.
|
|
60
132
|
* `dateTimeTrunc(t, "MONTH")` returns the first instant of `t`'s month.
|
|
61
133
|
*/
|
|
134
|
+
/** @deprecated Prefer {@link truncateDateTime} with human-readable precision. */
|
|
62
135
|
export function dateTimeTrunc(value, precision) {
|
|
63
136
|
const v = coerce(value);
|
|
64
|
-
return
|
|
137
|
+
return makeComposedExpr("datetime", [v], () => `DATETIME_TRUNC(${v.toCalcString()}, ${emitStringLiteral(precision)})`);
|
|
65
138
|
}
|
|
139
|
+
/** Truncate a date/datetime using a readable precision name. */
|
|
140
|
+
export function truncateDateTime(value, precision) {
|
|
141
|
+
return dateTimeTrunc(value, DATE_TIME_PRECISION_WIRE[precision]);
|
|
142
|
+
}
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
// WEEKDAY — day-of-week as a number, with optional mode.
|
|
145
|
+
// ---------------------------------------------------------------------------
|
|
146
|
+
/**
|
|
147
|
+
* Modes accepted by the wire `WEEKDAY` function.
|
|
148
|
+
* - 1 — Sunday=1 .. Saturday=7 (default)
|
|
149
|
+
* - 2 — Monday=1 .. Sunday=7
|
|
150
|
+
* - 3 — Monday=0 .. Sunday=6
|
|
151
|
+
*/
|
|
152
|
+
export const weekdayMode = {
|
|
153
|
+
sundayOne: 1,
|
|
154
|
+
mondayOne: 2,
|
|
155
|
+
mondayZero: 3,
|
|
156
|
+
};
|
|
66
157
|
/**
|
|
67
158
|
* Day-of-week as a numeric, optionally selecting the numbering scheme.
|
|
68
159
|
*/
|
|
69
160
|
export function weekday(value, mode) {
|
|
70
161
|
const v = coerce(value);
|
|
71
162
|
if (mode === undefined) {
|
|
72
|
-
return
|
|
163
|
+
return makeComposedExpr("number", [v], () => `WEEKDAY(${v.toCalcString()})`);
|
|
73
164
|
}
|
|
74
|
-
|
|
165
|
+
const wireMode = typeof mode === "string" ? weekdayMode[mode] : mode;
|
|
166
|
+
return makeComposedExpr("number", [v], () => `WEEKDAY(${v.toCalcString()}, ${wireMode})`);
|
|
75
167
|
}
|
|
76
168
|
// ---------------------------------------------------------------------------
|
|
77
|
-
// Date-part extraction —
|
|
78
|
-
// HOUR/MINUTE/SECOND accept datetime only.
|
|
169
|
+
// Date-part extraction — all six functions accept date|datetime in Knowhere.
|
|
79
170
|
// ---------------------------------------------------------------------------
|
|
80
171
|
/** Year component as NUMBER. */
|
|
81
172
|
export function year(value) {
|
|
82
173
|
const v = coerce(value);
|
|
83
|
-
return
|
|
174
|
+
return makeComposedExpr("number", [v], () => `YEAR(${v.toCalcString()})`);
|
|
84
175
|
}
|
|
85
176
|
/** Month component (1–12) as NUMBER. */
|
|
86
177
|
export function month(value) {
|
|
87
178
|
const v = coerce(value);
|
|
88
|
-
return
|
|
179
|
+
return makeComposedExpr("number", [v], () => `MONTH(${v.toCalcString()})`);
|
|
89
180
|
}
|
|
90
181
|
/** Day-of-month (1–31) as NUMBER. */
|
|
91
182
|
export function day(value) {
|
|
92
183
|
const v = coerce(value);
|
|
93
|
-
return
|
|
184
|
+
return makeComposedExpr("number", [v], () => `DAY(${v.toCalcString()})`);
|
|
94
185
|
}
|
|
95
|
-
/** Hour (0–23) from a DATETIME. */
|
|
186
|
+
/** Hour (0–23) from a DATE or DATETIME. */
|
|
96
187
|
export function hour(value) {
|
|
97
188
|
const v = coerce(value);
|
|
98
|
-
return
|
|
189
|
+
return makeComposedExpr("number", [v], () => `HOUR(${v.toCalcString()})`);
|
|
99
190
|
}
|
|
100
|
-
/** Minute (0–59) from a DATETIME. */
|
|
191
|
+
/** Minute (0–59) from a DATE or DATETIME. */
|
|
101
192
|
export function minute(value) {
|
|
102
193
|
const v = coerce(value);
|
|
103
|
-
return
|
|
194
|
+
return makeComposedExpr("number", [v], () => `MINUTE(${v.toCalcString()})`);
|
|
104
195
|
}
|
|
105
|
-
/** Second (0–59) from a DATETIME. */
|
|
196
|
+
/** Second (0–59) from a DATE or DATETIME. */
|
|
106
197
|
export function second(value) {
|
|
107
198
|
const v = coerce(value);
|
|
108
|
-
return
|
|
199
|
+
return makeComposedExpr("number", [v], () => `SECOND(${v.toCalcString()})`);
|
|
109
200
|
}
|
|
@@ -1,32 +1,23 @@
|
|
|
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 type {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
16
|
+
import type { StoredFunctionRef, StoredFunctionScalarType } from "../../../catalog/types.js";
|
|
17
|
+
import type { BoolLike, ComposedExpr, ComparableExprType, DateMathPromotion, Expr, ExprLike, ExprType, ExprTypeOf, NumericPromotion, NumericLike } from "./types.js";
|
|
18
|
+
import { concat, toText, len, trim, upper, lower, left, right, mid, substitute, find, search, splitText, regexMatch, regexReplace, regexExtract, jsonEscape, jsonUnescape, repeat } from "./text.js";
|
|
19
|
+
import { round, power, sqrt, toNumber, uuid } from "./numeric.js";
|
|
20
|
+
import { now, makeDate, dateTime, dateValue, dateDiff, dateDif, truncateDateTime, dateTimeTrunc, weekday, year, month, day, hour, minute, second } from "./date.js";
|
|
30
21
|
import { countIf, sumIf, stringAgg, stringAggUnique } from "./aggregate.js";
|
|
31
22
|
/** Integer literal — `Expr<"number">`. */
|
|
32
23
|
declare function num(value: number): Expr<"number">;
|
|
@@ -36,62 +27,52 @@ declare function dec(value: number): Expr<"decimal">;
|
|
|
36
27
|
declare function text(value: string): Expr<"text">;
|
|
37
28
|
/** Boolean literal — `Expr<"bool">`. Emits `TRUE()` / `FALSE()`. */
|
|
38
29
|
declare function bool(value: boolean): Expr<"bool">;
|
|
39
|
-
declare function plus(a:
|
|
40
|
-
declare function
|
|
41
|
-
declare function
|
|
42
|
-
declare function
|
|
43
|
-
|
|
44
|
-
declare function
|
|
45
|
-
declare function
|
|
46
|
-
declare function
|
|
47
|
-
declare function
|
|
48
|
-
declare function
|
|
49
|
-
declare function gte<T extends
|
|
50
|
-
declare function lte<
|
|
51
|
-
declare function
|
|
52
|
-
|
|
53
|
-
declare function
|
|
54
|
-
declare function
|
|
55
|
-
declare function
|
|
56
|
-
declare function
|
|
30
|
+
declare function plus<const A extends NumericLike | ExprLike<"date"> | ExprLike<"datetime">, const B extends NumericLike>(a: A, b: B): ComposedExpr<DateMathPromotion<A, B>, [A, B]>;
|
|
31
|
+
declare function minus<const A extends NumericLike | ExprLike<"date"> | ExprLike<"datetime">, const B extends NumericLike>(a: A, b: B): ComposedExpr<DateMathPromotion<A, B>, [A, B]>;
|
|
32
|
+
declare function times<const A extends NumericLike, const B extends NumericLike>(a: A, b: B): ComposedExpr<NumericPromotion<A, B>, [A, B]>;
|
|
33
|
+
declare function dividedBy<const A extends NumericLike, const B extends NumericLike>(a: A, b: B): ComposedExpr<"decimal", [A, B]>;
|
|
34
|
+
type NonNumericComparableExprType = Exclude<ComparableExprType, "number" | "decimal">;
|
|
35
|
+
declare function gt<const A extends NumericLike, const B extends NumericLike>(a: A, b: B): ComposedExpr<"bool", [A, B]>;
|
|
36
|
+
declare function gt<T extends NonNumericComparableExprType, const A extends ExprLike<T>, const B extends ExprLike<NoInfer<T>>>(a: A, b: B): ComposedExpr<"bool", [A, B]>;
|
|
37
|
+
declare function lt<const A extends NumericLike, const B extends NumericLike>(a: A, b: B): ComposedExpr<"bool", [A, B]>;
|
|
38
|
+
declare function lt<T extends NonNumericComparableExprType, const A extends ExprLike<T>, const B extends ExprLike<NoInfer<T>>>(a: A, b: B): ComposedExpr<"bool", [A, B]>;
|
|
39
|
+
declare function gte<const A extends NumericLike, const B extends NumericLike>(a: A, b: B): ComposedExpr<"bool", [A, B]>;
|
|
40
|
+
declare function gte<T extends NonNumericComparableExprType, const A extends ExprLike<T>, const B extends ExprLike<NoInfer<T>>>(a: A, b: B): ComposedExpr<"bool", [A, B]>;
|
|
41
|
+
declare function lte<const A extends NumericLike, const B extends NumericLike>(a: A, b: B): ComposedExpr<"bool", [A, B]>;
|
|
42
|
+
declare function lte<T extends NonNumericComparableExprType, const A extends ExprLike<T>, const B extends ExprLike<NoInfer<T>>>(a: A, b: B): ComposedExpr<"bool", [A, B]>;
|
|
43
|
+
type NonNumericExprType = Exclude<ExprType, "number" | "decimal">;
|
|
44
|
+
declare function eq<const A extends NumericLike, const B extends NumericLike>(a: A, b: B): ComposedExpr<"bool", [A, B]>;
|
|
45
|
+
declare function eq<T extends NonNumericExprType, const A extends ExprLike<T>, const B extends ExprLike<NoInfer<T>>>(a: A, b: B): ComposedExpr<"bool", [A, B]>;
|
|
46
|
+
declare function ne<const A extends NumericLike, const B extends NumericLike>(a: A, b: B): ComposedExpr<"bool", [A, B]>;
|
|
47
|
+
declare function ne<T extends NonNumericExprType, const A extends ExprLike<T>, const B extends ExprLike<NoInfer<T>>>(a: A, b: B): ComposedExpr<"bool", [A, B]>;
|
|
48
|
+
declare function and<const A extends BoolLike, const B extends BoolLike, const Rest extends readonly BoolLike[]>(a: A, b: B, ...rest: Rest): ComposedExpr<"bool", [A, B, ...Rest]>;
|
|
49
|
+
declare function or<const A extends BoolLike, const B extends BoolLike, const Rest extends readonly BoolLike[]>(a: A, b: B, ...rest: Rest): ComposedExpr<"bool", [A, B, ...Rest]>;
|
|
50
|
+
declare function if_<const Condition extends BoolLike, const Then extends NumericLike, const Else extends NumericLike>(cond: Condition, thenArm: Then, elseArm: Else): ComposedExpr<NumericPromotion<Then, Else>, [Condition, Then, Else]>;
|
|
51
|
+
declare function if_<T extends NonNumericExprType, const Condition extends BoolLike, const Then extends ExprLike<T>, const Else extends ExprLike<NoInfer<T>>>(cond: Condition, thenArm: Then, elseArm: Else): ComposedExpr<T, [Condition, Then, Else]>;
|
|
57
52
|
/**
|
|
58
|
-
* Multi-branch conditional — `IFS(c1, v1, c2, v2,
|
|
53
|
+
* Multi-branch conditional — `IFS(c1, v1, c2, v2, …)`.
|
|
59
54
|
* Conditions are evaluated in order; the first one whose check
|
|
60
|
-
* passes determines the result. If no condition matches
|
|
61
|
-
* final-else value is supplied, the result is null (BLANK on the
|
|
62
|
-
* wire).
|
|
55
|
+
* passes determines the result. If no condition matches, the result is null.
|
|
63
56
|
*
|
|
64
|
-
* Args must come in (
|
|
65
|
-
*
|
|
66
|
-
* as `[BoolLike, ExprLike<T>]` tuples plus an optional final
|
|
67
|
-
* `ExprLike<T>` so all branches share the same result brand.
|
|
57
|
+
* Args must come in complete `(condition, value)` pairs, and all value arms
|
|
58
|
+
* share the same result brand.
|
|
68
59
|
*
|
|
69
60
|
* Runtime validates parity — the EDK throws if an odd-then-even-
|
|
70
61
|
* looking arg list slips past TS (e.g. when args is spread from an
|
|
71
62
|
* untyped source).
|
|
72
63
|
*/
|
|
73
|
-
|
|
74
|
-
BoolLike,
|
|
75
|
-
ExprLike<T>,
|
|
76
|
-
...
|
|
77
|
-
]
|
|
78
|
-
|
|
79
|
-
* Return the first non-null argument. All args must share the same
|
|
80
|
-
* result brand. The wire emits `COALESCE(a, b, …)`.
|
|
81
|
-
*/
|
|
82
|
-
declare function coalesce<T extends ExprType>(...args: readonly [ExprLike<T>, ExprLike<T>, ...ExprLike<T>[]]): Expr<T>;
|
|
83
|
-
/**
|
|
84
|
-
* Return null when `a` and `b` are equal; otherwise return `a`.
|
|
85
|
-
* Mirrors SQL `NULLIF`. Useful for guarding against divide-by-zero:
|
|
86
|
-
* `calc.dividedBy(x, calc.nullIf(y, 0))`.
|
|
87
|
-
*/
|
|
88
|
-
declare function nullIf<T extends ExprType>(a: ExprLike<T>, b: ExprLike<T>): Expr<T>;
|
|
64
|
+
type IfsRest<T extends ExprType, Args extends readonly unknown[]> = Args extends readonly [] ? readonly [] : Args extends readonly [infer Condition, infer Value, ...infer Rest] ? readonly [
|
|
65
|
+
Condition & BoolLike,
|
|
66
|
+
Value & ExprLike<T>,
|
|
67
|
+
...IfsRest<T, Rest>
|
|
68
|
+
] : never;
|
|
69
|
+
declare function ifs<T extends ExprType, const Rest extends readonly unknown[]>(condition: BoolLike, value: ExprLike<T>, ...rest: Rest & IfsRest<NoInfer<T>, Rest>): ComposedExpr<T, [typeof condition, typeof value, ...Rest]>;
|
|
89
70
|
/**
|
|
90
71
|
* True when the argument is null/empty. Accepts any expression type.
|
|
91
72
|
* Equivalent to SQL `IS NULL` for non-text values; for text values
|
|
92
73
|
* the server also treats whitespace-only strings as blank.
|
|
93
74
|
*/
|
|
94
|
-
declare function isBlank<T extends ExprType
|
|
75
|
+
declare function isBlank<T extends ExprType, const Value extends ExprLike<T>>(value: Value): ComposedExpr<"bool", [Value]>;
|
|
95
76
|
/**
|
|
96
77
|
* Null literal — the wire `BLANK()` function. Returns an `Expr<T>`
|
|
97
78
|
* whose brand is inferred from surrounding context (e.g. an
|
|
@@ -99,49 +80,57 @@ declare function isBlank<T extends ExprType>(value: ExprLike<T>): Expr<"bool">;
|
|
|
99
80
|
* (`calc.blank<"text">()`) because TS can't infer T from a
|
|
100
81
|
* zero-argument call site.
|
|
101
82
|
*/
|
|
83
|
+
declare function blank<T extends ExprType>(type: T): Expr<T>;
|
|
102
84
|
declare function blank<T extends ExprType>(): Expr<T>;
|
|
85
|
+
/** Explicitly typed escape hatch for pulled and legacy formula text. */
|
|
86
|
+
declare function raw<T extends ExprType>(formula: string, resultType: T): Expr<T>;
|
|
87
|
+
type StoredFunctionArguments<Parameters extends readonly ExprType[]> = {
|
|
88
|
+
readonly [Index in keyof Parameters]: Parameters[Index] extends ExprType ? ExprLike<Parameters[Index]> : never;
|
|
89
|
+
};
|
|
90
|
+
/** Invoke a configured scalar user-defined function from its CloudLink catalog ref. */
|
|
91
|
+
declare function call<const Parameters extends readonly StoredFunctionScalarType[], const Result extends StoredFunctionScalarType>(udf: StoredFunctionRef<Parameters, Result>, ...args: StoredFunctionArguments<Parameters>): Expr<Result, "single", "record">;
|
|
103
92
|
/**
|
|
104
93
|
* Sum of a numeric expression across related rows. Server preserves
|
|
105
94
|
* the input brand — `sum(NUMBER)` → NUMBER on the wire,
|
|
106
|
-
* `sum(DECIMAL)` → DECIMAL.
|
|
107
|
-
* `NumericExpr` (the number-or-decimal union) since the caller's
|
|
108
|
-
* downstream usage typically doesn't distinguish.
|
|
95
|
+
* `sum(DECIMAL)` → DECIMAL. Overloads retain that exact brand for callers.
|
|
109
96
|
*/
|
|
110
|
-
declare function sum(value:
|
|
97
|
+
declare function sum<const Value extends ExprLike<"number">>(value: Value): ComposedExpr<"number", [Value]>;
|
|
98
|
+
declare function sum<const Value extends ExprLike<"decimal">>(value: Value): ComposedExpr<"decimal", [Value]>;
|
|
111
99
|
/**
|
|
112
100
|
* Count of non-null values for the argument expression across related
|
|
113
101
|
* rows. Always returns `NUMBER` regardless of input brand.
|
|
114
102
|
*/
|
|
115
|
-
declare function count<T extends ExprType
|
|
103
|
+
declare function count<T extends ExprType, const Value extends ExprLike<T>>(value: Value): ComposedExpr<"number", [Value]>;
|
|
116
104
|
/**
|
|
117
105
|
* Distinct count of the argument expression across related rows.
|
|
118
106
|
* Wire emits `COUNTUNIQUE` (matches the Java grammar's
|
|
119
107
|
* `countDistinct` alias).
|
|
120
108
|
*/
|
|
121
|
-
declare function countUnique<T extends ExprType
|
|
109
|
+
declare function countUnique<T extends ExprType, const Value extends ExprLike<T>>(value: Value): ComposedExpr<"number", [Value]>;
|
|
122
110
|
/**
|
|
123
111
|
* Arithmetic mean of a numeric expression across related rows.
|
|
124
112
|
* Always returns `DECIMAL` (the server casts even integer fields to
|
|
125
113
|
* decimal for division).
|
|
126
114
|
*/
|
|
127
|
-
declare function average(value:
|
|
115
|
+
declare function average<const Value extends NumericLike>(value: Value): ComposedExpr<"decimal", [Value]>;
|
|
128
116
|
/**
|
|
129
117
|
* Standard deviation of a numeric expression across related rows.
|
|
130
118
|
* Always returns `DECIMAL`.
|
|
131
119
|
*/
|
|
132
|
-
declare function stdev(value:
|
|
133
|
-
|
|
134
|
-
declare function min<
|
|
135
|
-
declare function
|
|
136
|
-
declare function max<
|
|
120
|
+
declare function stdev<const Value extends NumericLike>(value: Value): ComposedExpr<"decimal", [Value]>;
|
|
121
|
+
type MinMaxExprType = "number" | "decimal" | "date" | "datetime";
|
|
122
|
+
declare function min<const Value extends ExprLike<MinMaxExprType>>(value: Value): ComposedExpr<Extract<ExprTypeOf<Value>, MinMaxExprType>, [Value]>;
|
|
123
|
+
declare function min<const A extends ExprLike<MinMaxExprType>, const B extends ExprLike<Extract<ExprTypeOf<A>, MinMaxExprType>>, const Rest extends readonly ExprLike<Extract<ExprTypeOf<A>, MinMaxExprType>>[]>(a: A, b: B, ...rest: Rest): ComposedExpr<Extract<ExprTypeOf<A>, MinMaxExprType>, [A, B, ...Rest]>;
|
|
124
|
+
declare function max<const Value extends ExprLike<MinMaxExprType>>(value: Value): ComposedExpr<Extract<ExprTypeOf<Value>, MinMaxExprType>, [Value]>;
|
|
125
|
+
declare function max<const A extends ExprLike<MinMaxExprType>, const B extends ExprLike<Extract<ExprTypeOf<A>, MinMaxExprType>>, const Rest extends readonly ExprLike<Extract<ExprTypeOf<A>, MinMaxExprType>>[]>(a: A, b: B, ...rest: Rest): ComposedExpr<Extract<ExprTypeOf<A>, MinMaxExprType>, [A, B, ...Rest]>;
|
|
137
126
|
/** Project a picklist field reference to its display label (text). */
|
|
138
|
-
declare function label
|
|
127
|
+
declare function label<const Field extends ExprLike<"picklist">>(field: Field): ComposedExpr<"text", [Field]>;
|
|
139
128
|
/** Project a reference-typed field to its id form (no-op for already-id refs). */
|
|
140
|
-
declare function id<T extends "picklist" | "user" | "group" | "attachment"
|
|
129
|
+
declare function id<T extends "picklist" | "user" | "group" | "attachment", const Field extends ExprLike<T>>(field: Field): ComposedExpr<T, [Field]>;
|
|
141
130
|
/** Project a user field reference to its email address (text). */
|
|
142
|
-
declare function email
|
|
131
|
+
declare function email<const Field extends ExprLike<"user">>(field: Field): ComposedExpr<"text", [Field]>;
|
|
143
132
|
/** Project a group field reference to its name (text). */
|
|
144
|
-
declare function name
|
|
133
|
+
declare function name<const Field extends ExprLike<"group">>(field: Field): ComposedExpr<"text", [Field]>;
|
|
145
134
|
/**
|
|
146
135
|
* The `calc` namespace — every public builder lives here so authors
|
|
147
136
|
* have one discoverable entry point. `calc.if` works because object
|
|
@@ -154,6 +143,8 @@ export declare const calc: {
|
|
|
154
143
|
readonly text: typeof text;
|
|
155
144
|
readonly bool: typeof bool;
|
|
156
145
|
readonly blank: typeof blank;
|
|
146
|
+
readonly raw: typeof raw;
|
|
147
|
+
readonly call: typeof call;
|
|
157
148
|
readonly plus: typeof plus;
|
|
158
149
|
readonly minus: typeof minus;
|
|
159
150
|
readonly times: typeof times;
|
|
@@ -166,11 +157,8 @@ export declare const calc: {
|
|
|
166
157
|
readonly ne: typeof ne;
|
|
167
158
|
readonly and: typeof and;
|
|
168
159
|
readonly or: typeof or;
|
|
169
|
-
readonly not: typeof not;
|
|
170
160
|
readonly if: typeof if_;
|
|
171
161
|
readonly ifs: typeof ifs;
|
|
172
|
-
readonly coalesce: typeof coalesce;
|
|
173
|
-
readonly nullIf: typeof nullIf;
|
|
174
162
|
readonly isBlank: typeof isBlank;
|
|
175
163
|
readonly sum: typeof sum;
|
|
176
164
|
readonly count: typeof count;
|
|
@@ -191,24 +179,26 @@ export declare const calc: {
|
|
|
191
179
|
readonly substitute: typeof substitute;
|
|
192
180
|
readonly find: typeof find;
|
|
193
181
|
readonly search: typeof search;
|
|
182
|
+
readonly split: typeof splitText;
|
|
194
183
|
readonly splitText: typeof splitText;
|
|
195
184
|
readonly regexMatch: typeof regexMatch;
|
|
196
185
|
readonly regexReplace: typeof regexReplace;
|
|
197
186
|
readonly regexExtract: typeof regexExtract;
|
|
198
187
|
readonly jsonEscape: typeof jsonEscape;
|
|
199
188
|
readonly jsonUnescape: typeof jsonUnescape;
|
|
189
|
+
readonly repeat: typeof repeat;
|
|
200
190
|
readonly round: typeof round;
|
|
201
191
|
readonly power: typeof power;
|
|
202
192
|
readonly sqrt: typeof sqrt;
|
|
203
|
-
readonly mod: typeof mod;
|
|
204
|
-
readonly abs: typeof abs;
|
|
205
193
|
readonly toNumber: typeof toNumber;
|
|
206
194
|
readonly uuid: typeof uuid;
|
|
207
195
|
readonly now: typeof now;
|
|
208
|
-
readonly today: typeof today;
|
|
209
196
|
readonly makeDate: typeof makeDate;
|
|
197
|
+
readonly dateTime: typeof dateTime;
|
|
210
198
|
readonly dateValue: typeof dateValue;
|
|
199
|
+
readonly dateDiff: typeof dateDiff;
|
|
211
200
|
readonly dateDif: typeof dateDif;
|
|
201
|
+
readonly truncateDateTime: typeof truncateDateTime;
|
|
212
202
|
readonly dateTimeTrunc: typeof dateTimeTrunc;
|
|
213
203
|
readonly weekday: typeof weekday;
|
|
214
204
|
readonly year: typeof year;
|
|
@@ -227,3 +217,8 @@ export declare const calc: {
|
|
|
227
217
|
readonly name: typeof name;
|
|
228
218
|
};
|
|
229
219
|
export type { Expr, ExprLike, ExprType, NumericExpr, BoolLike } from "./types.js";
|
|
220
|
+
export type { ConcatExprType } from "./text.js";
|
|
221
|
+
export { dateDiffUnit, dateDifUnit, dateTimeTruncPrecision, weekdayMode, } from "./date.js";
|
|
222
|
+
export type { DateDiffUnit, DateDifUnit, DateTimePrecision, DateTimeTruncPrecision, WeekdayConvention, WeekdayMode } from "./date.js";
|
|
223
|
+
export { orderByDirection, predicateOp } from "./aggregate.js";
|
|
224
|
+
export type { OrderByDirection, ErgonomicOrderByDirection, ErgonomicPredicate, Predicate, PredicateInput, PredicateOp, StringAggOptions, StringAggOrderBy, } from "./aggregate.js";
|