@elementumai/edk 0.0.0-oidc-bootstrap → 0.8.0-preview.11
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 +408 -3
- package/dist-sdk/elementum-entity-client/clients/agents/models/agent-tool.d.ts +188 -0
- package/dist-sdk/elementum-entity-client/clients/agents/models/agent-tool.js +20 -0
- package/dist-sdk/elementum-entity-client/clients/agents/models/agent.d.ts +245 -0
- package/dist-sdk/elementum-entity-client/clients/agents/models/agent.js +30 -0
- package/dist-sdk/elementum-entity-client/clients/ai-provider-connectors/models/ai-provider-connector.d.ts +18 -0
- package/dist-sdk/elementum-entity-client/clients/ai-provider-connectors/models/ai-provider-connector.js +8 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/aspect.d.ts +718 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/aspect.js +52 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/field-base.d.ts +23 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/field-base.js +1 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/field-types.d.ts +148 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/field-types.js +12 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/format.d.ts +63 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/format.js +17 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/index.d.ts +39 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/index.js +35 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/picklist-config.d.ts +116 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/picklist-config.js +11 -0
- package/dist-sdk/elementum-entity-client/clients/automation/models/automation.d.ts +178 -0
- package/dist-sdk/elementum-entity-client/clients/automation/models/automation.js +18 -0
- package/dist-sdk/elementum-entity-client/clients/document-models/models/document-model.d.ts +200 -0
- package/dist-sdk/elementum-entity-client/clients/document-models/models/document-model.js +1 -0
- package/dist-sdk/elementum-entity-client/clients/search-tables/models/index.d.ts +1 -0
- package/dist-sdk/elementum-entity-client/clients/search-tables/models/index.js +1 -0
- package/dist-sdk/elementum-entity-client/clients/search-tables/models/search-table-wire.d.ts +141 -0
- package/dist-sdk/elementum-entity-client/clients/search-tables/models/search-table-wire.js +22 -0
- package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.d.ts +123 -0
- package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.js +14 -0
- package/dist-sdk/elementum-entity-client/clients/skills/models/skill.d.ts +78 -0
- package/dist-sdk/elementum-entity-client/clients/skills/models/skill.js +23 -0
- package/dist-sdk/elementum-entity-client/clients/tables/models/index.d.ts +1 -0
- package/dist-sdk/elementum-entity-client/clients/tables/models/index.js +1 -0
- package/dist-sdk/elementum-entity-client/clients/tables/models/table-wire.d.ts +265 -0
- package/dist-sdk/elementum-entity-client/clients/tables/models/table-wire.js +15 -0
- package/dist-sdk/elementum-entity-client/errors.d.ts +90 -0
- package/dist-sdk/elementum-entity-client/errors.js +111 -0
- package/dist-sdk/elementum-entity-client/models/connection.d.ts +30 -0
- package/dist-sdk/elementum-entity-client/models/connection.js +16 -0
- package/dist-sdk/elementum-entity-client/types.d.ts +71 -0
- package/dist-sdk/elementum-entity-client/types.js +1 -0
- package/dist-sdk/fs/entity.d.ts +104 -0
- package/dist-sdk/fs/entity.js +52 -0
- package/dist-sdk/pull/util.d.ts +130 -0
- package/dist-sdk/pull/util.js +204 -0
- package/dist-sdk/src/catalog/factories.d.ts +189 -0
- package/dist-sdk/src/catalog/factories.js +202 -0
- package/dist-sdk/src/catalog/from-authoring.d.ts +103 -0
- package/dist-sdk/src/catalog/from-authoring.js +462 -0
- package/dist-sdk/src/catalog/index.d.ts +11 -0
- package/dist-sdk/src/catalog/index.js +11 -0
- package/dist-sdk/src/catalog/org.d.ts +11 -0
- package/dist-sdk/src/catalog/org.js +211 -0
- package/dist-sdk/src/catalog/render-helpers.d.ts +35 -0
- package/dist-sdk/src/catalog/render-helpers.js +82 -0
- package/dist-sdk/src/catalog/render.d.ts +36 -0
- package/dist-sdk/src/catalog/render.js +176 -0
- package/dist-sdk/src/catalog/token.d.ts +10 -0
- package/dist-sdk/src/catalog/token.js +62 -0
- package/dist-sdk/src/catalog/types.d.ts +158 -0
- package/dist-sdk/src/catalog/types.js +83 -0
- package/dist-sdk/src/catalog/write.d.ts +43 -0
- package/dist-sdk/src/catalog/write.js +109 -0
- package/dist-sdk/src/core/app-to-ui.d.ts +22 -0
- package/dist-sdk/src/core/app-to-ui.js +75 -0
- package/dist-sdk/src/core/index.d.ts +10 -0
- package/dist-sdk/src/core/index.js +9 -0
- package/dist-sdk/src/core/system-fields.d.ts +93 -0
- package/dist-sdk/src/core/system-fields.js +151 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +144 -0
- package/dist-sdk/src/core/triggers/on-demand.js +112 -0
- package/dist-sdk/src/core/types/ai-provider.d.ts +36 -0
- package/dist-sdk/src/core/types/ai-provider.js +32 -0
- package/dist-sdk/src/core/types/app.d.ts +838 -0
- package/dist-sdk/src/core/types/app.js +210 -0
- package/dist-sdk/src/core/types/aspect-category.d.ts +35 -0
- package/dist-sdk/src/core/types/aspect-category.js +33 -0
- package/dist-sdk/src/core/types/cloud-link.d.ts +34 -0
- package/dist-sdk/src/core/types/cloud-link.js +32 -0
- package/dist-sdk/src/core/types/display-block.d.ts +149 -0
- package/dist-sdk/src/core/types/display-block.js +61 -0
- package/dist-sdk/src/core/types/group.d.ts +13 -0
- package/dist-sdk/src/core/types/group.js +6 -0
- package/dist-sdk/src/core/types/platform.d.ts +2 -0
- package/dist-sdk/src/core/types/platform.js +1 -0
- package/dist-sdk/src/core/types/user.d.ts +20 -0
- package/dist-sdk/src/core/types/user.js +8 -0
- package/dist-sdk/src/core/wire/ref-serializer.d.ts +45 -0
- package/dist-sdk/src/core/wire/ref-serializer.js +89 -0
- package/dist-sdk/src/engine/build/context.d.ts +49 -0
- package/dist-sdk/src/engine/build/context.js +6 -0
- package/dist-sdk/src/engine/entity.d.ts +44 -0
- package/dist-sdk/src/engine/entity.js +15 -0
- package/dist-sdk/src/engine/pull/context.d.ts +23 -0
- package/dist-sdk/src/engine/pull/context.js +44 -0
- package/dist-sdk/src/engine/pull/org.d.ts +44 -0
- package/dist-sdk/src/engine/pull/org.js +104 -0
- package/dist-sdk/src/engine/tf/escape.d.ts +22 -0
- package/dist-sdk/src/engine/tf/escape.js +28 -0
- package/dist-sdk/src/engine/tf/expr.d.ts +25 -0
- package/dist-sdk/src/engine/tf/expr.js +405 -0
- package/dist-sdk/src/engine/tf/index.d.ts +12 -0
- package/dist-sdk/src/engine/tf/index.js +11 -0
- package/dist-sdk/src/engine/tf/labels.d.ts +31 -0
- package/dist-sdk/src/engine/tf/labels.js +125 -0
- package/dist-sdk/src/engine/tf/model.d.ts +84 -0
- package/dist-sdk/src/engine/tf/model.js +49 -0
- package/dist-sdk/src/engine/tf/parse.d.ts +41 -0
- package/dist-sdk/src/engine/tf/parse.js +189 -0
- package/dist-sdk/src/engine/tf/render.d.ts +13 -0
- package/dist-sdk/src/engine/tf/render.js +102 -0
- package/dist-sdk/src/engine/workspace/authoring-layout.d.ts +43 -0
- package/dist-sdk/src/engine/workspace/authoring-layout.js +201 -0
- package/dist-sdk/src/entities/agent/build.d.ts +108 -0
- package/dist-sdk/src/entities/agent/build.js +148 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +18 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +177 -0
- package/dist-sdk/src/entities/agent/from-tf.d.ts +50 -0
- package/dist-sdk/src/entities/agent/from-tf.js +169 -0
- package/dist-sdk/src/entities/agent/index.d.ts +7 -0
- package/dist-sdk/src/entities/agent/index.js +7 -0
- package/dist-sdk/src/entities/agent/module.d.ts +4 -0
- package/dist-sdk/src/entities/agent/module.js +116 -0
- package/dist-sdk/src/entities/agent/to-tf.d.ts +33 -0
- package/dist-sdk/src/entities/agent/to-tf.js +136 -0
- package/dist-sdk/src/entities/agent/tools.d.ts +205 -0
- package/dist-sdk/src/entities/agent/tools.js +199 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +63 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +169 -0
- package/dist-sdk/src/entities/agent-tool/module.d.ts +3 -0
- package/dist-sdk/src/entities/agent-tool/module.js +32 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +38 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +164 -0
- package/dist-sdk/src/entities/agent-tool/types.d.ts +42 -0
- package/dist-sdk/src/entities/agent-tool/types.js +70 -0
- package/dist-sdk/src/entities/app/build.d.ts +318 -0
- package/dist-sdk/src/entities/app/build.js +325 -0
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +165 -0
- package/dist-sdk/src/entities/app/deserializer/normalize.js +12 -0
- package/dist-sdk/src/entities/app/display-blocks.d.ts +26 -0
- package/dist-sdk/src/entities/app/display-blocks.js +34 -0
- package/dist-sdk/src/entities/app/from-tf.d.ts +23 -0
- package/dist-sdk/src/entities/app/from-tf.js +180 -0
- package/dist-sdk/src/entities/app/index.d.ts +11 -0
- package/dist-sdk/src/entities/app/index.js +10 -0
- package/dist-sdk/src/entities/app/locals.d.ts +11 -0
- package/dist-sdk/src/entities/app/locals.js +31 -0
- package/dist-sdk/src/entities/app/module.d.ts +4 -0
- package/dist-sdk/src/entities/app/module.js +59 -0
- package/dist-sdk/src/entities/app/to-tf.d.ts +28 -0
- package/dist-sdk/src/entities/app/to-tf.js +183 -0
- package/dist-sdk/src/entities/approval-chain/build.d.ts +24 -0
- package/dist-sdk/src/entities/approval-chain/build.js +56 -0
- package/dist-sdk/src/entities/approval-chain/index.d.ts +6 -0
- package/dist-sdk/src/entities/approval-chain/index.js +6 -0
- package/dist-sdk/src/entities/approval-chain/steps.d.ts +24 -0
- package/dist-sdk/src/entities/approval-chain/steps.js +20 -0
- package/dist-sdk/src/entities/automation/build.d.ts +215 -0
- package/dist-sdk/src/entities/automation/build.js +424 -0
- package/dist-sdk/src/entities/automation/catalog-render.d.ts +5 -0
- package/dist-sdk/src/entities/automation/catalog-render.js +35 -0
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +135 -0
- package/dist-sdk/src/entities/automation/deserializer/ast.js +13 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +40 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +1040 -0
- package/dist-sdk/src/entities/automation/filter.d.ts +81 -0
- package/dist-sdk/src/entities/automation/filter.js +146 -0
- package/dist-sdk/src/entities/automation/from-tf.d.ts +36 -0
- package/dist-sdk/src/entities/automation/from-tf.js +252 -0
- package/dist-sdk/src/entities/automation/index.d.ts +18 -0
- package/dist-sdk/src/entities/automation/index.js +21 -0
- package/dist-sdk/src/entities/automation/module.d.ts +3 -0
- package/dist-sdk/src/entities/automation/module.js +153 -0
- package/dist-sdk/src/entities/automation/operators.d.ts +66 -0
- package/dist-sdk/src/entities/automation/operators.js +43 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +62 -0
- package/dist-sdk/src/entities/automation/script-code.js +366 -0
- package/dist-sdk/src/entities/automation/serialize.d.ts +6 -0
- package/dist-sdk/src/entities/automation/serialize.js +41 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +535 -0
- package/dist-sdk/src/entities/automation/tasks.js +697 -0
- package/dist-sdk/src/entities/automation/to-tf.d.ts +38 -0
- package/dist-sdk/src/entities/automation/to-tf.js +266 -0
- package/dist-sdk/src/entities/automation/triggers.d.ts +197 -0
- package/dist-sdk/src/entities/automation/triggers.js +202 -0
- package/dist-sdk/src/entities/automation/types.d.ts +53 -0
- package/dist-sdk/src/entities/automation/types.js +101 -0
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +76 -0
- package/dist-sdk/src/entities/automation/value-ref-tf.js +190 -0
- package/dist-sdk/src/entities/element/build.d.ts +108 -0
- package/dist-sdk/src/entities/element/build.js +109 -0
- package/dist-sdk/src/entities/element/from-tf.d.ts +19 -0
- package/dist-sdk/src/entities/element/from-tf.js +155 -0
- package/dist-sdk/src/entities/element/index.d.ts +9 -0
- package/dist-sdk/src/entities/element/index.js +9 -0
- package/dist-sdk/src/entities/element/locals.d.ts +7 -0
- package/dist-sdk/src/entities/element/locals.js +12 -0
- package/dist-sdk/src/entities/element/module.d.ts +8 -0
- package/dist-sdk/src/entities/element/module.js +63 -0
- package/dist-sdk/src/entities/element/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/element/to-tf.js +151 -0
- package/dist-sdk/src/entities/field/build.d.ts +69 -0
- package/dist-sdk/src/entities/field/build.js +74 -0
- package/dist-sdk/src/entities/field/calc/aggregate.d.ts +60 -0
- package/dist-sdk/src/entities/field/calc/aggregate.js +71 -0
- package/dist-sdk/src/entities/field/calc/date.d.ts +73 -0
- package/dist-sdk/src/entities/field/calc/date.js +109 -0
- package/dist-sdk/src/entities/field/calc/index.d.ts +229 -0
- package/dist-sdk/src/entities/field/calc/index.js +433 -0
- package/dist-sdk/src/entities/field/calc/numeric.d.ts +22 -0
- package/dist-sdk/src/entities/field/calc/numeric.js +67 -0
- package/dist-sdk/src/entities/field/calc/runtime.d.ts +61 -0
- package/dist-sdk/src/entities/field/calc/runtime.js +170 -0
- package/dist-sdk/src/entities/field/calc/text.d.ts +100 -0
- package/dist-sdk/src/entities/field/calc/text.js +208 -0
- package/dist-sdk/src/entities/field/calc/types.d.ts +86 -0
- package/dist-sdk/src/entities/field/calc/types.js +23 -0
- package/dist-sdk/src/entities/field/calc.d.ts +108 -0
- package/dist-sdk/src/entities/field/calc.js +54 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +29 -0
- package/dist-sdk/src/entities/field/from-tf.js +73 -0
- package/dist-sdk/src/entities/field/locals.d.ts +8 -0
- package/dist-sdk/src/entities/field/locals.js +24 -0
- package/dist-sdk/src/entities/field/module.d.ts +3 -0
- package/dist-sdk/src/entities/field/module.js +49 -0
- package/dist-sdk/src/entities/field/options.d.ts +27 -0
- package/dist-sdk/src/entities/field/options.js +76 -0
- package/dist-sdk/src/entities/field/record-shape.d.ts +57 -0
- package/dist-sdk/src/entities/field/record-shape.js +1 -0
- package/dist-sdk/src/entities/field/to-tf.d.ts +55 -0
- package/dist-sdk/src/entities/field/to-tf.js +97 -0
- package/dist-sdk/src/entities/field/types.d.ts +27 -0
- package/dist-sdk/src/entities/field/types.js +46 -0
- package/dist-sdk/src/entities/file-reader/build.d.ts +124 -0
- package/dist-sdk/src/entities/file-reader/build.js +105 -0
- package/dist-sdk/src/entities/file-reader/index.d.ts +5 -0
- package/dist-sdk/src/entities/file-reader/index.js +5 -0
- package/dist-sdk/src/entities/flow/activities/agent.d.ts +15 -0
- package/dist-sdk/src/entities/flow/activities/agent.js +29 -0
- package/dist-sdk/src/entities/flow/activities/approval.d.ts +9 -0
- package/dist-sdk/src/entities/flow/activities/approval.js +18 -0
- package/dist-sdk/src/entities/flow/activities/automation.d.ts +12 -0
- package/dist-sdk/src/entities/flow/activities/automation.js +22 -0
- package/dist-sdk/src/entities/flow/activities/ctx.d.ts +34 -0
- package/dist-sdk/src/entities/flow/activities/ctx.js +38 -0
- package/dist-sdk/src/entities/flow/activities/form.d.ts +22 -0
- package/dist-sdk/src/entities/flow/activities/form.js +36 -0
- package/dist-sdk/src/entities/flow/activities/index.d.ts +14 -0
- package/dist-sdk/src/entities/flow/activities/index.js +13 -0
- package/dist-sdk/src/entities/flow/activities/input-refs.d.ts +39 -0
- package/dist-sdk/src/entities/flow/activities/input-refs.js +19 -0
- package/dist-sdk/src/entities/flow/activities/prompt-template.d.ts +13 -0
- package/dist-sdk/src/entities/flow/activities/prompt-template.js +34 -0
- package/dist-sdk/src/entities/flow/activities/render-catalog.d.ts +140 -0
- package/dist-sdk/src/entities/flow/activities/render-catalog.js +174 -0
- package/dist-sdk/src/entities/flow/activities/types.d.ts +33 -0
- package/dist-sdk/src/entities/flow/activities/types.js +1 -0
- package/dist-sdk/src/entities/flow/build.d.ts +38 -0
- package/dist-sdk/src/entities/flow/build.js +115 -0
- package/dist-sdk/src/entities/flow/index.d.ts +8 -0
- package/dist-sdk/src/entities/flow/index.js +7 -0
- package/dist-sdk/src/entities/flow/serialize.d.ts +51 -0
- package/dist-sdk/src/entities/flow/serialize.js +94 -0
- package/dist-sdk/src/entities/flow/util.d.ts +27 -0
- package/dist-sdk/src/entities/flow/util.js +38 -0
- package/dist-sdk/src/entities/org/category.d.ts +5 -0
- package/dist-sdk/src/entities/org/category.js +33 -0
- package/dist-sdk/src/entities/org/cloud-link.d.ts +5 -0
- package/dist-sdk/src/entities/org/cloud-link.js +33 -0
- package/dist-sdk/src/entities/org/connector.d.ts +5 -0
- package/dist-sdk/src/entities/org/connector.js +37 -0
- package/dist-sdk/src/entities/org/group.d.ts +5 -0
- package/dist-sdk/src/entities/org/group.js +31 -0
- package/dist-sdk/src/entities/org/index.d.ts +10 -0
- package/dist-sdk/src/entities/org/index.js +10 -0
- package/dist-sdk/src/entities/org/role.d.ts +7 -0
- package/dist-sdk/src/entities/org/role.js +21 -0
- package/dist-sdk/src/entities/org/user.d.ts +7 -0
- package/dist-sdk/src/entities/org/user.js +21 -0
- package/dist-sdk/src/entities/search-table/build.d.ts +41 -0
- package/dist-sdk/src/entities/search-table/build.js +79 -0
- package/dist-sdk/src/entities/search-table/index.d.ts +5 -0
- package/dist-sdk/src/entities/search-table/index.js +5 -0
- package/dist-sdk/src/entities/search-table/module.d.ts +6 -0
- package/dist-sdk/src/entities/search-table/module.js +64 -0
- package/dist-sdk/src/entities/shared/context.d.ts +93 -0
- package/dist-sdk/src/entities/shared/context.js +156 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +242 -0
- package/dist-sdk/src/entities/shared/filters/ast.js +65 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +211 -0
- package/dist-sdk/src/entities/shared/filters/index.js +372 -0
- package/dist-sdk/src/entities/shared/filters/types.d.ts +170 -0
- package/dist-sdk/src/entities/shared/filters/types.js +7 -0
- package/dist-sdk/src/entities/shared/ref.d.ts +160 -0
- package/dist-sdk/src/entities/shared/ref.js +119 -0
- package/dist-sdk/src/entities/shared/types/common.d.ts +106 -0
- package/dist-sdk/src/entities/shared/types/common.js +64 -0
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +49 -0
- package/dist-sdk/src/entities/shared/types/field-types.js +48 -0
- package/dist-sdk/src/entities/shared/types/platform.d.ts +46 -0
- package/dist-sdk/src/entities/shared/types/platform.js +10 -0
- package/dist-sdk/src/entities/skill/build.d.ts +25 -0
- package/dist-sdk/src/entities/skill/build.js +50 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +20 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +96 -0
- package/dist-sdk/src/entities/skill/from-tf.d.ts +33 -0
- package/dist-sdk/src/entities/skill/from-tf.js +95 -0
- package/dist-sdk/src/entities/skill/index.d.ts +7 -0
- package/dist-sdk/src/entities/skill/index.js +7 -0
- package/dist-sdk/src/entities/skill/module.d.ts +4 -0
- package/dist-sdk/src/entities/skill/module.js +106 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +33 -0
- package/dist-sdk/src/entities/skill/to-tf.js +58 -0
- package/dist-sdk/src/entities/skill/tools.d.ts +71 -0
- package/dist-sdk/src/entities/skill/tools.js +88 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +47 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +121 -0
- package/dist-sdk/src/entities/skill-tool/module.d.ts +3 -0
- package/dist-sdk/src/entities/skill-tool/module.js +21 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +32 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +107 -0
- package/dist-sdk/src/entities/skill-tool/types.d.ts +40 -0
- package/dist-sdk/src/entities/skill-tool/types.js +67 -0
- package/dist-sdk/src/entities/table/build.d.ts +74 -0
- package/dist-sdk/src/entities/table/build.js +339 -0
- package/dist-sdk/src/entities/table/catalog-render.d.ts +5 -0
- package/dist-sdk/src/entities/table/catalog-render.js +39 -0
- package/dist-sdk/src/entities/table/fields.d.ts +81 -0
- package/dist-sdk/src/entities/table/fields.js +70 -0
- package/dist-sdk/src/entities/table/filter.d.ts +41 -0
- package/dist-sdk/src/entities/table/filter.js +89 -0
- package/dist-sdk/src/entities/table/index.d.ts +8 -0
- package/dist-sdk/src/entities/table/index.js +12 -0
- package/dist-sdk/src/entities/table/joins.d.ts +26 -0
- package/dist-sdk/src/entities/table/joins.js +31 -0
- package/dist-sdk/src/entities/table/keys.d.ts +11 -0
- package/dist-sdk/src/entities/table/keys.js +25 -0
- package/dist-sdk/src/entities/table/module.d.ts +5 -0
- package/dist-sdk/src/entities/table/module.js +25 -0
- package/dist-sdk/src/entities/table/state.d.ts +39 -0
- package/dist-sdk/src/entities/table/state.js +43 -0
- package/dist-sdk/src/entities/view/from-tf.d.ts +25 -0
- package/dist-sdk/src/entities/view/from-tf.js +233 -0
- package/dist-sdk/src/entities/view/module.d.ts +24 -0
- package/dist-sdk/src/entities/view/module.js +61 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +63 -0
- package/dist-sdk/src/entities/view/to-tf.js +156 -0
- package/dist-sdk/src/entities/view/types.d.ts +58 -0
- package/dist-sdk/src/entities/view/types.js +89 -0
- package/dist-sdk/src/graph/deferred-catalog-render.d.ts +14 -0
- package/dist-sdk/src/graph/deferred-catalog-render.js +37 -0
- package/dist-sdk/src/graph/index.d.ts +83 -0
- package/dist-sdk/src/graph/index.js +207 -0
- package/dist-sdk/src/graph/modules.d.ts +7 -0
- package/dist-sdk/src/graph/modules.js +37 -0
- package/dist-sdk/src/graph/types.d.ts +301 -0
- package/dist-sdk/src/graph/types.js +102 -0
- package/dist-sdk/src/internal/sdk-package.d.ts +7 -0
- package/dist-sdk/src/internal/sdk-package.js +23 -0
- package/package.json +173 -8
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public surface of the calculated-field DSL — the `calc` namespace.
|
|
3
|
+
*
|
|
4
|
+
* v1 minimal scope:
|
|
5
|
+
* - Arithmetic operators: plus, minus, times, dividedBy
|
|
6
|
+
* - Comparison operators: gt, lt, gte, lte, eq, ne
|
|
7
|
+
* - Logical operators: and, or, not
|
|
8
|
+
* - Conditional: if
|
|
9
|
+
* - Literals: num, dec, text, bool (mostly disambiguation helpers —
|
|
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
|
|
20
|
+
*
|
|
21
|
+
* Operator naming: `plus` / `minus` / `times` / `dividedBy` instead of
|
|
22
|
+
* `add` / `subtract` / `multiply` / `divide` so the resulting code
|
|
23
|
+
* reads close to the math expression. Same shape as the Java
|
|
24
|
+
* `ExpressionUtil.addition` / `subtraction` / etc. helpers.
|
|
25
|
+
*/
|
|
26
|
+
import type { BoolLike, ComparableExprType, Expr, ExprLike, ExprType, NumericExpr, NumericLike } from "./types.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, mod, abs, toNumber, uuid } from "./numeric.js";
|
|
29
|
+
import { now, today, makeDate, dateValue, dateDif, dateTimeTrunc, weekday, year, month, day, hour, minute, second } from "./date.js";
|
|
30
|
+
import { countIf, sumIf, stringAgg, stringAggUnique } from "./aggregate.js";
|
|
31
|
+
/** Integer literal — `Expr<"number">`. */
|
|
32
|
+
declare function num(value: number): Expr<"number">;
|
|
33
|
+
/** Decimal literal — `Expr<"decimal">`. */
|
|
34
|
+
declare function dec(value: number): Expr<"decimal">;
|
|
35
|
+
/** Text literal — `Expr<"text">`. Single-quoted on the wire. */
|
|
36
|
+
declare function text(value: string): Expr<"text">;
|
|
37
|
+
/** Boolean literal — `Expr<"bool">`. Emits `TRUE()` / `FALSE()`. */
|
|
38
|
+
declare function bool(value: boolean): Expr<"bool">;
|
|
39
|
+
declare function plus(a: NumericLike, b: NumericLike): NumericExpr;
|
|
40
|
+
declare function plus(a: ExprLike<"date">, b: NumericLike): Expr<"date">;
|
|
41
|
+
declare function plus(a: ExprLike<"datetime">, b: NumericLike): Expr<"datetime">;
|
|
42
|
+
declare function minus(a: NumericLike, b: NumericLike): NumericExpr;
|
|
43
|
+
declare function minus(a: ExprLike<"date">, b: NumericLike): Expr<"date">;
|
|
44
|
+
declare function minus(a: ExprLike<"datetime">, b: NumericLike): Expr<"datetime">;
|
|
45
|
+
declare function times(a: NumericLike, b: NumericLike): NumericExpr;
|
|
46
|
+
declare function dividedBy(a: NumericLike, b: NumericLike): NumericExpr;
|
|
47
|
+
declare function gt<T extends ComparableExprType>(a: ExprLike<T>, b: ExprLike<T>): Expr<"bool">;
|
|
48
|
+
declare function lt<T extends ComparableExprType>(a: ExprLike<T>, b: ExprLike<T>): Expr<"bool">;
|
|
49
|
+
declare function gte<T extends ComparableExprType>(a: ExprLike<T>, b: ExprLike<T>): Expr<"bool">;
|
|
50
|
+
declare function lte<T extends ComparableExprType>(a: ExprLike<T>, b: ExprLike<T>): Expr<"bool">;
|
|
51
|
+
declare function eq<T extends ExprType>(a: ExprLike<T>, b: ExprLike<T>): Expr<"bool">;
|
|
52
|
+
declare function ne<T extends ExprType>(a: ExprLike<T>, b: ExprLike<T>): Expr<"bool">;
|
|
53
|
+
declare function and(a: BoolLike, b: BoolLike, ...rest: BoolLike[]): Expr<"bool">;
|
|
54
|
+
declare function or(a: BoolLike, b: BoolLike, ...rest: BoolLike[]): Expr<"bool">;
|
|
55
|
+
declare function not(value: BoolLike): Expr<"bool">;
|
|
56
|
+
declare function if_<T extends ExprType>(cond: BoolLike, thenArm: ExprLike<T>, elseArm: ExprLike<T>): Expr<T>;
|
|
57
|
+
/**
|
|
58
|
+
* Multi-branch conditional — `IFS(c1, v1, c2, v2, …, finalElse?)`.
|
|
59
|
+
* Conditions are evaluated in order; the first one whose check
|
|
60
|
+
* passes determines the result. If no condition matches and no
|
|
61
|
+
* final-else value is supplied, the result is null (BLANK on the
|
|
62
|
+
* wire).
|
|
63
|
+
*
|
|
64
|
+
* Args must come in (cond, value) pairs, optionally with one
|
|
65
|
+
* trailing value as the final else. The typing accepts the pairs
|
|
66
|
+
* as `[BoolLike, ExprLike<T>]` tuples plus an optional final
|
|
67
|
+
* `ExprLike<T>` so all branches share the same result brand.
|
|
68
|
+
*
|
|
69
|
+
* Runtime validates parity — the EDK throws if an odd-then-even-
|
|
70
|
+
* looking arg list slips past TS (e.g. when args is spread from an
|
|
71
|
+
* untyped source).
|
|
72
|
+
*/
|
|
73
|
+
declare function ifs<T extends ExprType>(...args: readonly [
|
|
74
|
+
BoolLike,
|
|
75
|
+
ExprLike<T>,
|
|
76
|
+
...Array<BoolLike | ExprLike<T>>
|
|
77
|
+
]): Expr<T>;
|
|
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>;
|
|
89
|
+
/**
|
|
90
|
+
* True when the argument is null/empty. Accepts any expression type.
|
|
91
|
+
* Equivalent to SQL `IS NULL` for non-text values; for text values
|
|
92
|
+
* the server also treats whitespace-only strings as blank.
|
|
93
|
+
*/
|
|
94
|
+
declare function isBlank<T extends ExprType>(value: ExprLike<T>): Expr<"bool">;
|
|
95
|
+
/**
|
|
96
|
+
* Null literal — the wire `BLANK()` function. Returns an `Expr<T>`
|
|
97
|
+
* whose brand is inferred from surrounding context (e.g. an
|
|
98
|
+
* `if`/`ifs` arm). Standalone use requires an explicit type argument
|
|
99
|
+
* (`calc.blank<"text">()`) because TS can't infer T from a
|
|
100
|
+
* zero-argument call site.
|
|
101
|
+
*/
|
|
102
|
+
declare function blank<T extends ExprType>(): Expr<T>;
|
|
103
|
+
/**
|
|
104
|
+
* Sum of a numeric expression across related rows. Server preserves
|
|
105
|
+
* the input brand — `sum(NUMBER)` → NUMBER on the wire,
|
|
106
|
+
* `sum(DECIMAL)` → DECIMAL. The DSL collapses the output to
|
|
107
|
+
* `NumericExpr` (the number-or-decimal union) since the caller's
|
|
108
|
+
* downstream usage typically doesn't distinguish.
|
|
109
|
+
*/
|
|
110
|
+
declare function sum(value: NumericLike): NumericExpr;
|
|
111
|
+
/**
|
|
112
|
+
* Count of non-null values for the argument expression across related
|
|
113
|
+
* rows. Always returns `NUMBER` regardless of input brand.
|
|
114
|
+
*/
|
|
115
|
+
declare function count<T extends ExprType>(value: ExprLike<T>): Expr<"number">;
|
|
116
|
+
/**
|
|
117
|
+
* Distinct count of the argument expression across related rows.
|
|
118
|
+
* Wire emits `COUNTUNIQUE` (matches the Java grammar's
|
|
119
|
+
* `countDistinct` alias).
|
|
120
|
+
*/
|
|
121
|
+
declare function countUnique<T extends ExprType>(value: ExprLike<T>): Expr<"number">;
|
|
122
|
+
/**
|
|
123
|
+
* Arithmetic mean of a numeric expression across related rows.
|
|
124
|
+
* Always returns `DECIMAL` (the server casts even integer fields to
|
|
125
|
+
* decimal for division).
|
|
126
|
+
*/
|
|
127
|
+
declare function average(value: NumericLike): Expr<"decimal">;
|
|
128
|
+
/**
|
|
129
|
+
* Standard deviation of a numeric expression across related rows.
|
|
130
|
+
* Always returns `DECIMAL`.
|
|
131
|
+
*/
|
|
132
|
+
declare function stdev(value: NumericLike): Expr<"decimal">;
|
|
133
|
+
declare function min<T extends ComparableExprType>(value: ExprLike<T>): Expr<T>;
|
|
134
|
+
declare function min<T extends ComparableExprType>(a: ExprLike<T>, b: ExprLike<T>, ...rest: ExprLike<T>[]): Expr<T>;
|
|
135
|
+
declare function max<T extends ComparableExprType>(value: ExprLike<T>): Expr<T>;
|
|
136
|
+
declare function max<T extends ComparableExprType>(a: ExprLike<T>, b: ExprLike<T>, ...rest: ExprLike<T>[]): Expr<T>;
|
|
137
|
+
/** Project a picklist field reference to its display label (text). */
|
|
138
|
+
declare function label(field: ExprLike<"picklist">): Expr<"text">;
|
|
139
|
+
/** 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">(field: ExprLike<T>): Expr<T>;
|
|
141
|
+
/** Project a user field reference to its email address (text). */
|
|
142
|
+
declare function email(field: ExprLike<"user">): Expr<"text">;
|
|
143
|
+
/** Project a group field reference to its name (text). */
|
|
144
|
+
declare function name(field: ExprLike<"group">): Expr<"text">;
|
|
145
|
+
/**
|
|
146
|
+
* The `calc` namespace — every public builder lives here so authors
|
|
147
|
+
* have one discoverable entry point. `calc.if` works because object
|
|
148
|
+
* property names can be reserved words; only declarations like
|
|
149
|
+
* `function if(){}` would conflict.
|
|
150
|
+
*/
|
|
151
|
+
export declare const calc: {
|
|
152
|
+
readonly num: typeof num;
|
|
153
|
+
readonly dec: typeof dec;
|
|
154
|
+
readonly text: typeof text;
|
|
155
|
+
readonly bool: typeof bool;
|
|
156
|
+
readonly blank: typeof blank;
|
|
157
|
+
readonly plus: typeof plus;
|
|
158
|
+
readonly minus: typeof minus;
|
|
159
|
+
readonly times: typeof times;
|
|
160
|
+
readonly dividedBy: typeof dividedBy;
|
|
161
|
+
readonly gt: typeof gt;
|
|
162
|
+
readonly lt: typeof lt;
|
|
163
|
+
readonly gte: typeof gte;
|
|
164
|
+
readonly lte: typeof lte;
|
|
165
|
+
readonly eq: typeof eq;
|
|
166
|
+
readonly ne: typeof ne;
|
|
167
|
+
readonly and: typeof and;
|
|
168
|
+
readonly or: typeof or;
|
|
169
|
+
readonly not: typeof not;
|
|
170
|
+
readonly if: typeof if_;
|
|
171
|
+
readonly ifs: typeof ifs;
|
|
172
|
+
readonly coalesce: typeof coalesce;
|
|
173
|
+
readonly nullIf: typeof nullIf;
|
|
174
|
+
readonly isBlank: typeof isBlank;
|
|
175
|
+
readonly sum: typeof sum;
|
|
176
|
+
readonly count: typeof count;
|
|
177
|
+
readonly countUnique: typeof countUnique;
|
|
178
|
+
readonly average: typeof average;
|
|
179
|
+
readonly stdev: typeof stdev;
|
|
180
|
+
readonly min: typeof min;
|
|
181
|
+
readonly max: typeof max;
|
|
182
|
+
readonly concat: typeof concat;
|
|
183
|
+
readonly toText: typeof toText;
|
|
184
|
+
readonly len: typeof len;
|
|
185
|
+
readonly trim: typeof trim;
|
|
186
|
+
readonly upper: typeof upper;
|
|
187
|
+
readonly lower: typeof lower;
|
|
188
|
+
readonly left: typeof left;
|
|
189
|
+
readonly right: typeof right;
|
|
190
|
+
readonly mid: typeof mid;
|
|
191
|
+
readonly substitute: typeof substitute;
|
|
192
|
+
readonly find: typeof find;
|
|
193
|
+
readonly search: typeof search;
|
|
194
|
+
readonly splitText: typeof splitText;
|
|
195
|
+
readonly regexMatch: typeof regexMatch;
|
|
196
|
+
readonly regexReplace: typeof regexReplace;
|
|
197
|
+
readonly regexExtract: typeof regexExtract;
|
|
198
|
+
readonly jsonEscape: typeof jsonEscape;
|
|
199
|
+
readonly jsonUnescape: typeof jsonUnescape;
|
|
200
|
+
readonly round: typeof round;
|
|
201
|
+
readonly power: typeof power;
|
|
202
|
+
readonly sqrt: typeof sqrt;
|
|
203
|
+
readonly mod: typeof mod;
|
|
204
|
+
readonly abs: typeof abs;
|
|
205
|
+
readonly toNumber: typeof toNumber;
|
|
206
|
+
readonly uuid: typeof uuid;
|
|
207
|
+
readonly now: typeof now;
|
|
208
|
+
readonly today: typeof today;
|
|
209
|
+
readonly makeDate: typeof makeDate;
|
|
210
|
+
readonly dateValue: typeof dateValue;
|
|
211
|
+
readonly dateDif: typeof dateDif;
|
|
212
|
+
readonly dateTimeTrunc: typeof dateTimeTrunc;
|
|
213
|
+
readonly weekday: typeof weekday;
|
|
214
|
+
readonly year: typeof year;
|
|
215
|
+
readonly month: typeof month;
|
|
216
|
+
readonly day: typeof day;
|
|
217
|
+
readonly hour: typeof hour;
|
|
218
|
+
readonly minute: typeof minute;
|
|
219
|
+
readonly second: typeof second;
|
|
220
|
+
readonly countIf: typeof countIf;
|
|
221
|
+
readonly sumIf: typeof sumIf;
|
|
222
|
+
readonly stringAgg: typeof stringAgg;
|
|
223
|
+
readonly stringAggUnique: typeof stringAggUnique;
|
|
224
|
+
readonly label: typeof label;
|
|
225
|
+
readonly id: typeof id;
|
|
226
|
+
readonly email: typeof email;
|
|
227
|
+
readonly name: typeof name;
|
|
228
|
+
};
|
|
229
|
+
export type { Expr, ExprLike, ExprType, NumericExpr, BoolLike } from "./types.js";
|
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public surface of the calculated-field DSL — the `calc` namespace.
|
|
3
|
+
*
|
|
4
|
+
* v1 minimal scope:
|
|
5
|
+
* - Arithmetic operators: plus, minus, times, dividedBy
|
|
6
|
+
* - Comparison operators: gt, lt, gte, lte, eq, ne
|
|
7
|
+
* - Logical operators: and, or, not
|
|
8
|
+
* - Conditional: if
|
|
9
|
+
* - Literals: num, dec, text, bool (mostly disambiguation helpers —
|
|
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
|
|
20
|
+
*
|
|
21
|
+
* Operator naming: `plus` / `minus` / `times` / `dividedBy` instead of
|
|
22
|
+
* `add` / `subtract` / `multiply` / `divide` so the resulting code
|
|
23
|
+
* reads close to the math expression. Same shape as the Java
|
|
24
|
+
* `ExpressionUtil.addition` / `subtraction` / etc. helpers.
|
|
25
|
+
*/
|
|
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, mod, abs, toNumber, uuid, } from "./numeric.js";
|
|
29
|
+
import { now, today, makeDate, dateValue, dateDif, dateTimeTrunc, weekday, year, month, day, hour, minute, second, } from "./date.js";
|
|
30
|
+
import { countIf, sumIf, stringAgg, stringAggUnique, } from "./aggregate.js";
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Aggregations
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Server-side aggregations over a related aspect's rows. The server
|
|
35
|
+
// enforces "the argument must be a field on a related aspect, not a
|
|
36
|
+
// field on the current aspect" — the EDK leaves that rule for the
|
|
37
|
+
// server to validate at deploy time (the error message is clear:
|
|
38
|
+
// AGGREGATION_REQUIRED).
|
|
39
|
+
//
|
|
40
|
+
// Type rules:
|
|
41
|
+
// - sum: numeric-in, numeric-out (server preserves NUMBER vs DECIMAL)
|
|
42
|
+
// - count / countUnique: anything-in, NUMBER-out
|
|
43
|
+
// - average / stdev: numeric-in, DECIMAL-out
|
|
44
|
+
// - min / max: comparable-in, same-brand-out
|
|
45
|
+
//
|
|
46
|
+
// min and max are overloaded: the single-arg form is aggregation
|
|
47
|
+
// across related rows; the variadic form (2+ args) is pointwise
|
|
48
|
+
// least/greatest across the args on a single row. Same function name
|
|
49
|
+
// in the wire calc grammar.
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
// Literal helpers
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
// These are mostly disambiguation hatches — bare TS literals coerce
|
|
54
|
+
// automatically through `coerce()`. The explicit forms are useful when:
|
|
55
|
+
// - You need a decimal literal but TS sees an integer (`calc.dec(5)`).
|
|
56
|
+
// - You're in a position where the surrounding builder hasn't pinned
|
|
57
|
+
// `T` and you want to force a brand.
|
|
58
|
+
/** Integer literal — `Expr<"number">`. */
|
|
59
|
+
function num(value) {
|
|
60
|
+
return makeExpr("number", () => String(value));
|
|
61
|
+
}
|
|
62
|
+
/** Decimal literal — `Expr<"decimal">`. */
|
|
63
|
+
function dec(value) {
|
|
64
|
+
return makeExpr("decimal", () => String(value));
|
|
65
|
+
}
|
|
66
|
+
/** Text literal — `Expr<"text">`. Single-quoted on the wire. */
|
|
67
|
+
function text(value) {
|
|
68
|
+
return coerce(value);
|
|
69
|
+
}
|
|
70
|
+
/** Boolean literal — `Expr<"bool">`. Emits `TRUE()` / `FALSE()`. */
|
|
71
|
+
function bool(value) {
|
|
72
|
+
return coerce(value);
|
|
73
|
+
}
|
|
74
|
+
function plus(a, b) {
|
|
75
|
+
const ae = coerce(a);
|
|
76
|
+
const be = coerce(b);
|
|
77
|
+
const brand = ae.__exprType === "date" ? "date" :
|
|
78
|
+
ae.__exprType === "datetime" ? "datetime" :
|
|
79
|
+
"decimal";
|
|
80
|
+
return makeExpr(brand, () => `(${ae.toCalcString()} + ${be.toCalcString()})`);
|
|
81
|
+
}
|
|
82
|
+
function minus(a, b) {
|
|
83
|
+
const ae = coerce(a);
|
|
84
|
+
const be = coerce(b);
|
|
85
|
+
const brand = ae.__exprType === "date" ? "date" :
|
|
86
|
+
ae.__exprType === "datetime" ? "datetime" :
|
|
87
|
+
"decimal";
|
|
88
|
+
return makeExpr(brand, () => `(${ae.toCalcString()} - ${be.toCalcString()})`);
|
|
89
|
+
}
|
|
90
|
+
function times(a, b) {
|
|
91
|
+
const ae = coerce(a);
|
|
92
|
+
const be = coerce(b);
|
|
93
|
+
return makeExpr("decimal", () => `(${ae.toCalcString()} * ${be.toCalcString()})`);
|
|
94
|
+
}
|
|
95
|
+
function dividedBy(a, b) {
|
|
96
|
+
const ae = coerce(a);
|
|
97
|
+
const be = coerce(b);
|
|
98
|
+
return makeExpr("decimal", () => `(${ae.toCalcString()} / ${be.toCalcString()})`);
|
|
99
|
+
}
|
|
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
|
+
function gt(a, b) {
|
|
116
|
+
const ae = coerce(a);
|
|
117
|
+
const be = coerce(b);
|
|
118
|
+
return makeExpr("bool", () => `${ae.toCalcString()} > ${be.toCalcString()}`);
|
|
119
|
+
}
|
|
120
|
+
function lt(a, b) {
|
|
121
|
+
const ae = coerce(a);
|
|
122
|
+
const be = coerce(b);
|
|
123
|
+
return makeExpr("bool", () => `${ae.toCalcString()} < ${be.toCalcString()}`);
|
|
124
|
+
}
|
|
125
|
+
function gte(a, b) {
|
|
126
|
+
const ae = coerce(a);
|
|
127
|
+
const be = coerce(b);
|
|
128
|
+
return makeExpr("bool", () => `${ae.toCalcString()} >= ${be.toCalcString()}`);
|
|
129
|
+
}
|
|
130
|
+
function lte(a, b) {
|
|
131
|
+
const ae = coerce(a);
|
|
132
|
+
const be = coerce(b);
|
|
133
|
+
return makeExpr("bool", () => `${ae.toCalcString()} <= ${be.toCalcString()}`);
|
|
134
|
+
}
|
|
135
|
+
function eq(a, b) {
|
|
136
|
+
const ae = coerce(a);
|
|
137
|
+
const be = coerce(b);
|
|
138
|
+
return makeExpr("bool", () => `${ae.toCalcString()} = ${be.toCalcString()}`);
|
|
139
|
+
}
|
|
140
|
+
function ne(a, b) {
|
|
141
|
+
const ae = coerce(a);
|
|
142
|
+
const be = coerce(b);
|
|
143
|
+
return makeExpr("bool", () => `${ae.toCalcString()} <> ${be.toCalcString()}`);
|
|
144
|
+
}
|
|
145
|
+
// ---------------------------------------------------------------------------
|
|
146
|
+
// Logical
|
|
147
|
+
// ---------------------------------------------------------------------------
|
|
148
|
+
function and(a, b, ...rest) {
|
|
149
|
+
const all = [a, b, ...rest].map((v) => coerce(v));
|
|
150
|
+
return makeExpr("bool", () => `AND(${all.map((e) => e.toCalcString()).join(", ")})`);
|
|
151
|
+
}
|
|
152
|
+
function or(a, b, ...rest) {
|
|
153
|
+
const all = [a, b, ...rest].map((v) => coerce(v));
|
|
154
|
+
return makeExpr("bool", () => `OR(${all.map((e) => e.toCalcString()).join(", ")})`);
|
|
155
|
+
}
|
|
156
|
+
function not(value) {
|
|
157
|
+
const e = coerce(value);
|
|
158
|
+
return makeExpr("bool", () => `NOT(${e.toCalcString()})`);
|
|
159
|
+
}
|
|
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
|
+
function if_(cond, thenArm, elseArm) {
|
|
167
|
+
const c = coerce(cond);
|
|
168
|
+
const t = coerce(thenArm);
|
|
169
|
+
const e = coerce(elseArm);
|
|
170
|
+
return makeExpr(t.__exprType, () => `IF(${c.toCalcString()}, ${t.toCalcString()}, ${e.toCalcString()})`);
|
|
171
|
+
}
|
|
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
|
+
function ifs(...args) {
|
|
189
|
+
if (args.length === 0) {
|
|
190
|
+
throw new Error("calc.ifs: at least one condition/value pair is required.");
|
|
191
|
+
}
|
|
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
|
+
const branches = [];
|
|
197
|
+
let inferredBrand = undefined;
|
|
198
|
+
for (let i = 0; i < args.length; i++) {
|
|
199
|
+
const expectBool = i % 2 === 0 && i < args.length - 1;
|
|
200
|
+
if (expectBool) {
|
|
201
|
+
branches.push(coerce(args[i]));
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
const v = coerce(args[i]);
|
|
205
|
+
branches.push(v);
|
|
206
|
+
if (inferredBrand == null)
|
|
207
|
+
inferredBrand = v.__exprType;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (inferredBrand == null) {
|
|
211
|
+
throw new Error("calc.ifs: at least one value arm is required.");
|
|
212
|
+
}
|
|
213
|
+
return makeExpr(inferredBrand, () => `IFS(${branches.map((e) => e.toCalcString()).join(", ")})`);
|
|
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()})`);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* True when the argument is null/empty. Accepts any expression type.
|
|
238
|
+
* Equivalent to SQL `IS NULL` for non-text values; for text values
|
|
239
|
+
* the server also treats whitespace-only strings as blank.
|
|
240
|
+
*/
|
|
241
|
+
function isBlank(value) {
|
|
242
|
+
const e = coerce(value);
|
|
243
|
+
return makeExpr("bool", () => `ISBLANK(${e.toCalcString()})`);
|
|
244
|
+
}
|
|
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() {
|
|
253
|
+
// Brand carried as a generic; the runtime doesn't know which type
|
|
254
|
+
// the call site expects. The wire string is the same in every
|
|
255
|
+
// context — server resolves the actual type at parse time based on
|
|
256
|
+
// surrounding expressions.
|
|
257
|
+
return makeExpr("text", () => "BLANK()");
|
|
258
|
+
}
|
|
259
|
+
// ---------------------------------------------------------------------------
|
|
260
|
+
// Aggregation builders
|
|
261
|
+
// ---------------------------------------------------------------------------
|
|
262
|
+
/**
|
|
263
|
+
* Sum of a numeric expression across related rows. Server preserves
|
|
264
|
+
* the input brand — `sum(NUMBER)` → NUMBER on the wire,
|
|
265
|
+
* `sum(DECIMAL)` → DECIMAL. The DSL collapses the output to
|
|
266
|
+
* `NumericExpr` (the number-or-decimal union) since the caller's
|
|
267
|
+
* downstream usage typically doesn't distinguish.
|
|
268
|
+
*/
|
|
269
|
+
function sum(value) {
|
|
270
|
+
const e = coerce(value);
|
|
271
|
+
return makeExpr("decimal", () => `SUM(${e.toCalcString()})`);
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Count of non-null values for the argument expression across related
|
|
275
|
+
* rows. Always returns `NUMBER` regardless of input brand.
|
|
276
|
+
*/
|
|
277
|
+
function count(value) {
|
|
278
|
+
const e = coerce(value);
|
|
279
|
+
return makeExpr("number", () => `COUNT(${e.toCalcString()})`);
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Distinct count of the argument expression across related rows.
|
|
283
|
+
* Wire emits `COUNTUNIQUE` (matches the Java grammar's
|
|
284
|
+
* `countDistinct` alias).
|
|
285
|
+
*/
|
|
286
|
+
function countUnique(value) {
|
|
287
|
+
const e = coerce(value);
|
|
288
|
+
return makeExpr("number", () => `COUNTUNIQUE(${e.toCalcString()})`);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Arithmetic mean of a numeric expression across related rows.
|
|
292
|
+
* Always returns `DECIMAL` (the server casts even integer fields to
|
|
293
|
+
* decimal for division).
|
|
294
|
+
*/
|
|
295
|
+
function average(value) {
|
|
296
|
+
const e = coerce(value);
|
|
297
|
+
return makeExpr("decimal", () => `AVERAGE(${e.toCalcString()})`);
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Standard deviation of a numeric expression across related rows.
|
|
301
|
+
* Always returns `DECIMAL`.
|
|
302
|
+
*/
|
|
303
|
+
function stdev(value) {
|
|
304
|
+
const e = coerce(value);
|
|
305
|
+
return makeExpr("decimal", () => `STDEV(${e.toCalcString()})`);
|
|
306
|
+
}
|
|
307
|
+
function min(...args) {
|
|
308
|
+
if (args.length === 0) {
|
|
309
|
+
throw new Error("calc.min: at least one argument is required.");
|
|
310
|
+
}
|
|
311
|
+
const exprs = args.map((a) => coerce(a));
|
|
312
|
+
return makeExpr(exprs[0].__exprType, () => `MIN(${exprs.map((e) => e.toCalcString()).join(", ")})`);
|
|
313
|
+
}
|
|
314
|
+
function max(...args) {
|
|
315
|
+
if (args.length === 0) {
|
|
316
|
+
throw new Error("calc.max: at least one argument is required.");
|
|
317
|
+
}
|
|
318
|
+
const exprs = args.map((a) => coerce(a));
|
|
319
|
+
return makeExpr(exprs[0].__exprType, () => `MAX(${exprs.map((e) => e.toCalcString()).join(", ")})`);
|
|
320
|
+
}
|
|
321
|
+
// ---------------------------------------------------------------------------
|
|
322
|
+
// Sub-select projections
|
|
323
|
+
// ---------------------------------------------------------------------------
|
|
324
|
+
// Explicit projection — a bare reference to a picklist / user / group /
|
|
325
|
+
// attachment field is the id form. To get text (label / email / name)
|
|
326
|
+
// the author calls the matching projection. No implicit text default.
|
|
327
|
+
/** Project a picklist field reference to its display label (text). */
|
|
328
|
+
function label(field) {
|
|
329
|
+
const e = coerce(field);
|
|
330
|
+
return makeExpr("text", () => `${e.toCalcString()}.LABEL`);
|
|
331
|
+
}
|
|
332
|
+
/** Project a reference-typed field to its id form (no-op for already-id refs). */
|
|
333
|
+
function id(field) {
|
|
334
|
+
const e = coerce(field);
|
|
335
|
+
return makeExpr(e.__exprType, () => `${e.toCalcString()}.ID`);
|
|
336
|
+
}
|
|
337
|
+
/** Project a user field reference to its email address (text). */
|
|
338
|
+
function email(field) {
|
|
339
|
+
const e = coerce(field);
|
|
340
|
+
return makeExpr("text", () => `${e.toCalcString()}.EMAIL`);
|
|
341
|
+
}
|
|
342
|
+
/** Project a group field reference to its name (text). */
|
|
343
|
+
function name(field) {
|
|
344
|
+
const e = coerce(field);
|
|
345
|
+
return makeExpr("text", () => `${e.toCalcString()}.NAME`);
|
|
346
|
+
}
|
|
347
|
+
// ---------------------------------------------------------------------------
|
|
348
|
+
// Public namespace
|
|
349
|
+
// ---------------------------------------------------------------------------
|
|
350
|
+
/**
|
|
351
|
+
* The `calc` namespace — every public builder lives here so authors
|
|
352
|
+
* have one discoverable entry point. `calc.if` works because object
|
|
353
|
+
* property names can be reserved words; only declarations like
|
|
354
|
+
* `function if(){}` would conflict.
|
|
355
|
+
*/
|
|
356
|
+
export const calc = {
|
|
357
|
+
num,
|
|
358
|
+
dec,
|
|
359
|
+
text,
|
|
360
|
+
bool,
|
|
361
|
+
blank,
|
|
362
|
+
plus,
|
|
363
|
+
minus,
|
|
364
|
+
times,
|
|
365
|
+
dividedBy,
|
|
366
|
+
gt,
|
|
367
|
+
lt,
|
|
368
|
+
gte,
|
|
369
|
+
lte,
|
|
370
|
+
eq,
|
|
371
|
+
ne,
|
|
372
|
+
and,
|
|
373
|
+
or,
|
|
374
|
+
not,
|
|
375
|
+
if: if_,
|
|
376
|
+
ifs,
|
|
377
|
+
coalesce,
|
|
378
|
+
nullIf,
|
|
379
|
+
isBlank,
|
|
380
|
+
sum,
|
|
381
|
+
count,
|
|
382
|
+
countUnique,
|
|
383
|
+
average,
|
|
384
|
+
stdev,
|
|
385
|
+
min,
|
|
386
|
+
max,
|
|
387
|
+
concat,
|
|
388
|
+
toText,
|
|
389
|
+
len,
|
|
390
|
+
trim,
|
|
391
|
+
upper,
|
|
392
|
+
lower,
|
|
393
|
+
left,
|
|
394
|
+
right,
|
|
395
|
+
mid,
|
|
396
|
+
substitute,
|
|
397
|
+
find,
|
|
398
|
+
search,
|
|
399
|
+
splitText,
|
|
400
|
+
regexMatch,
|
|
401
|
+
regexReplace,
|
|
402
|
+
regexExtract,
|
|
403
|
+
jsonEscape,
|
|
404
|
+
jsonUnescape,
|
|
405
|
+
round,
|
|
406
|
+
power,
|
|
407
|
+
sqrt,
|
|
408
|
+
mod,
|
|
409
|
+
abs,
|
|
410
|
+
toNumber,
|
|
411
|
+
uuid,
|
|
412
|
+
now,
|
|
413
|
+
today,
|
|
414
|
+
makeDate,
|
|
415
|
+
dateValue,
|
|
416
|
+
dateDif,
|
|
417
|
+
dateTimeTrunc,
|
|
418
|
+
weekday,
|
|
419
|
+
year,
|
|
420
|
+
month,
|
|
421
|
+
day,
|
|
422
|
+
hour,
|
|
423
|
+
minute,
|
|
424
|
+
second,
|
|
425
|
+
countIf,
|
|
426
|
+
sumIf,
|
|
427
|
+
stringAgg,
|
|
428
|
+
stringAggUnique,
|
|
429
|
+
label,
|
|
430
|
+
id,
|
|
431
|
+
email,
|
|
432
|
+
name,
|
|
433
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tier-2 numeric helpers for the calc DSL.
|
|
3
|
+
*
|
|
4
|
+
* Each builder is a thin typed wrapper over a wire `FUNC(...)` form.
|
|
5
|
+
* Output brands mirror the Java test's behavior:
|
|
6
|
+
* - `round` preserves caller's brand expectation via overloads
|
|
7
|
+
* (ROUND(x) returns the same bias as x; ROUND(x, n) returns
|
|
8
|
+
* DECIMAL because the caller asked for decimal places).
|
|
9
|
+
* - `power`, `sqrt` return DECIMAL (fractional results possible).
|
|
10
|
+
* - `mod`, `abs` preserve numeric brand via overload.
|
|
11
|
+
* - `toNumber` coerces text → NUMBER.
|
|
12
|
+
* - `uuid` is nullary and returns a `uuid`-branded expression.
|
|
13
|
+
*/
|
|
14
|
+
import type { Expr, ExprLike, NumericExpr, NumericLike } from "./types.js";
|
|
15
|
+
export declare function round(value: NumericLike): NumericExpr;
|
|
16
|
+
export declare function round(value: NumericLike, digits: ExprLike<"number">): Expr<"decimal">;
|
|
17
|
+
export declare function power(base: NumericLike, exponent: NumericLike): Expr<"decimal">;
|
|
18
|
+
export declare function sqrt(value: NumericLike): Expr<"decimal">;
|
|
19
|
+
export declare function mod(a: NumericLike, b: NumericLike): NumericExpr;
|
|
20
|
+
export declare function abs(value: NumericLike): NumericExpr;
|
|
21
|
+
export declare function toNumber(value: ExprLike<"text">): Expr<"number">;
|
|
22
|
+
export declare function uuid(): Expr<"uuid">;
|