@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,67 @@
|
|
|
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 { coerce, makeExpr } from "./runtime.js";
|
|
15
|
+
export function round(value, digits) {
|
|
16
|
+
const v = coerce(value);
|
|
17
|
+
if (digits === undefined) {
|
|
18
|
+
return makeExpr("decimal", () => `ROUND(${v.toCalcString()})`);
|
|
19
|
+
}
|
|
20
|
+
const d = coerce(digits);
|
|
21
|
+
return makeExpr("decimal", () => `ROUND(${v.toCalcString()}, ${d.toCalcString()})`);
|
|
22
|
+
}
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// POWER — base^exponent, decimal output.
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
export function power(base, exponent) {
|
|
27
|
+
const b = coerce(base);
|
|
28
|
+
const e = coerce(exponent);
|
|
29
|
+
return makeExpr("decimal", () => `POWER(${b.toCalcString()}, ${e.toCalcString()})`);
|
|
30
|
+
}
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// SQRT — square root, decimal output. Server null-guards negatives.
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
export function sqrt(value) {
|
|
35
|
+
const v = coerce(value);
|
|
36
|
+
return makeExpr("decimal", () => `SQRT(${v.toCalcString()})`);
|
|
37
|
+
}
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
// MOD — remainder. Server emits this as the `%` operator under the
|
|
40
|
+
// hood, but the wire grammar accepts MOD(a, b) too. Preserves brand.
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
export function mod(a, b) {
|
|
43
|
+
const ae = coerce(a);
|
|
44
|
+
const be = coerce(b);
|
|
45
|
+
return makeExpr("decimal", () => `MOD(${ae.toCalcString()}, ${be.toCalcString()})`);
|
|
46
|
+
}
|
|
47
|
+
// ---------------------------------------------------------------------------
|
|
48
|
+
// ABS — absolute value. Preserves brand.
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
export function abs(value) {
|
|
51
|
+
const v = coerce(value);
|
|
52
|
+
return makeExpr("decimal", () => `ABS(${v.toCalcString()})`);
|
|
53
|
+
}
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
// VALUE (toNumber) — coerce text to numeric. Wire form is `VALUE(text)`.
|
|
56
|
+
// Renamed to `toNumber` in the EDK for parity with `toText`.
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
export function toNumber(value) {
|
|
59
|
+
const v = coerce(value);
|
|
60
|
+
return makeExpr("number", () => `VALUE(${v.toCalcString()})`);
|
|
61
|
+
}
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
// UUID — nullary generator, returns `uuid`-branded.
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
export function uuid() {
|
|
66
|
+
return makeExpr("uuid", () => `UUID()`);
|
|
67
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime layer for the calculated-field DSL — coercion + node
|
|
3
|
+
* construction.
|
|
4
|
+
*
|
|
5
|
+
* Every `calc.*` builder funnels its inputs through `coerce()`, which
|
|
6
|
+
* normalizes one of {already-an-Expr, typed AppField, raw literal}
|
|
7
|
+
* into an `Expr<T>`. The builder then composes the resulting
|
|
8
|
+
* `toCalcString()` closures into a parent node. No mutable AST — each
|
|
9
|
+
* node carries its own serializer closure built at construction time.
|
|
10
|
+
*
|
|
11
|
+
* Wire-format choices baked in here:
|
|
12
|
+
* - Field refs emit `"<uuid>"` when the field has a UUID id, and
|
|
13
|
+
* `"<name>"` otherwise. Both forms parse on the server. The UUID
|
|
14
|
+
* form is preferred because it's rename-safe; the name form is
|
|
15
|
+
* the fallback for placeholder-id fields being created in the
|
|
16
|
+
* same compose (the server resolves the name within the request).
|
|
17
|
+
* - String literals are single-quoted with `''` escapes per the
|
|
18
|
+
* ANTLR grammar.
|
|
19
|
+
* - Boolean literals are `TRUE()` / `FALSE()` (the parser accepts
|
|
20
|
+
* both these and the bare keywords; the function form is the
|
|
21
|
+
* canonical shape per the Java test).
|
|
22
|
+
*/
|
|
23
|
+
import type { AppField, FieldScope } from "../../../core/types/app.js";
|
|
24
|
+
import type { Expr, ExprLike, ExprType } from "./types.js";
|
|
25
|
+
/**
|
|
26
|
+
* Build an `Expr<T>` node from its type brand and a serializer
|
|
27
|
+
* closure. Internal — public builders compose this.
|
|
28
|
+
*/
|
|
29
|
+
export declare function makeExpr<T extends ExprType>(type: T, serialize: () => string): Expr<T>;
|
|
30
|
+
/**
|
|
31
|
+
* Emit the wire form of a field reference. UUID ids emit as
|
|
32
|
+
* `"<uuid>"`; placeholder ids fall back to `"<name>"`. The server
|
|
33
|
+
* accepts both inside the same compose body.
|
|
34
|
+
*
|
|
35
|
+
* Field name quoting uses `""` escapes (ANSI SQL double-quote
|
|
36
|
+
* doubling) per the ANTLR grammar's IDENTIFIER_QUOTED rule.
|
|
37
|
+
*/
|
|
38
|
+
export declare function emitFieldRef(field: AppField<FieldScope>): string;
|
|
39
|
+
/**
|
|
40
|
+
* Quote a TS string for the wire. Single-quoted with `''` escapes per
|
|
41
|
+
* the ANTLR grammar's STRING_LITERAL rule.
|
|
42
|
+
*/
|
|
43
|
+
export declare function emitStringLiteral(value: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Normalize an `ExprLike<T>` into an `Expr<T>`. The three branches:
|
|
46
|
+
*
|
|
47
|
+
* 1. Already an `Expr<T>` (or a pulled-expression marker) → return
|
|
48
|
+
* verbatim.
|
|
49
|
+
* 2. An `AppField` handle → wrap as an `Expr<...>` whose
|
|
50
|
+
* `toCalcString()` emits the wire field reference.
|
|
51
|
+
* 3. A raw TS literal (number / string / boolean) → wrap as a
|
|
52
|
+
* typed literal expression.
|
|
53
|
+
*
|
|
54
|
+
* The function's input type is `ExprLike<T>` so TypeScript already
|
|
55
|
+
* narrowed which `T` is expected at the call site; the runtime
|
|
56
|
+
* branches just route the value through the right factory. Coercion
|
|
57
|
+
* doesn't validate that the value's actual type matches `T` — the
|
|
58
|
+
* compile-time `ExprLike<T>` union prevents the mismatch from ever
|
|
59
|
+
* reaching here.
|
|
60
|
+
*/
|
|
61
|
+
export declare function coerce<T extends ExprType>(value: ExprLike<T>): Expr<T>;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime layer for the calculated-field DSL — coercion + node
|
|
3
|
+
* construction.
|
|
4
|
+
*
|
|
5
|
+
* Every `calc.*` builder funnels its inputs through `coerce()`, which
|
|
6
|
+
* normalizes one of {already-an-Expr, typed AppField, raw literal}
|
|
7
|
+
* into an `Expr<T>`. The builder then composes the resulting
|
|
8
|
+
* `toCalcString()` closures into a parent node. No mutable AST — each
|
|
9
|
+
* node carries its own serializer closure built at construction time.
|
|
10
|
+
*
|
|
11
|
+
* Wire-format choices baked in here:
|
|
12
|
+
* - Field refs emit `"<uuid>"` when the field has a UUID id, and
|
|
13
|
+
* `"<name>"` otherwise. Both forms parse on the server. The UUID
|
|
14
|
+
* form is preferred because it's rename-safe; the name form is
|
|
15
|
+
* the fallback for placeholder-id fields being created in the
|
|
16
|
+
* same compose (the server resolves the name within the request).
|
|
17
|
+
* - String literals are single-quoted with `''` escapes per the
|
|
18
|
+
* ANTLR grammar.
|
|
19
|
+
* - Boolean literals are `TRUE()` / `FALSE()` (the parser accepts
|
|
20
|
+
* both these and the bare keywords; the function form is the
|
|
21
|
+
* canonical shape per the Java test).
|
|
22
|
+
*/
|
|
23
|
+
import { isUuid } from "../../../../pull/util.js";
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// Node construction
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
/**
|
|
28
|
+
* Build an `Expr<T>` node from its type brand and a serializer
|
|
29
|
+
* closure. Internal — public builders compose this.
|
|
30
|
+
*/
|
|
31
|
+
export function makeExpr(type, serialize) {
|
|
32
|
+
return {
|
|
33
|
+
__calc: true,
|
|
34
|
+
__exprType: type,
|
|
35
|
+
toCalcString: serialize,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* True if `value` is already an `Expr<T>` (built by a prior `calc.*`
|
|
40
|
+
* call or a pulled-expression marker). Discriminator-checked.
|
|
41
|
+
*/
|
|
42
|
+
function isExpr(value) {
|
|
43
|
+
return (typeof value === "object" &&
|
|
44
|
+
value !== null &&
|
|
45
|
+
"__calc" in value &&
|
|
46
|
+
value.__calc === true);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* True if `value` looks like an `AppField`. Structural check — looks
|
|
50
|
+
* for the `type` + `id` + `name` triplet every variant carries.
|
|
51
|
+
*/
|
|
52
|
+
function isAppField(value) {
|
|
53
|
+
return (typeof value === "object" &&
|
|
54
|
+
value !== null &&
|
|
55
|
+
"type" in value &&
|
|
56
|
+
"id" in value &&
|
|
57
|
+
"name" in value);
|
|
58
|
+
}
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
// Field-ref serialization
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
/**
|
|
63
|
+
* Emit the wire form of a field reference. UUID ids emit as
|
|
64
|
+
* `"<uuid>"`; placeholder ids fall back to `"<name>"`. The server
|
|
65
|
+
* accepts both inside the same compose body.
|
|
66
|
+
*
|
|
67
|
+
* Field name quoting uses `""` escapes (ANSI SQL double-quote
|
|
68
|
+
* doubling) per the ANTLR grammar's IDENTIFIER_QUOTED rule.
|
|
69
|
+
*/
|
|
70
|
+
export function emitFieldRef(field) {
|
|
71
|
+
if (isUuid(field.id)) {
|
|
72
|
+
return `"${field.id}"`;
|
|
73
|
+
}
|
|
74
|
+
return `"${field.name.replace(/"/g, '""')}"`;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Map an `AppField.type` to the matching `ExprType` brand. Used by
|
|
78
|
+
* `coerce()` when wrapping a bare field handle into an `Expr<T>`.
|
|
79
|
+
*
|
|
80
|
+
* `CALCULATED` deliberately throws — a calculated field's output type
|
|
81
|
+
* is server-inferred and the EDK doesn't know it locally without
|
|
82
|
+
* walking the source expression. Allowing cross-calculated refs would
|
|
83
|
+
* need an inference pass; deferred from v1.
|
|
84
|
+
*/
|
|
85
|
+
function appFieldExprType(field) {
|
|
86
|
+
switch (field.type) {
|
|
87
|
+
case "NUMBER": return "number";
|
|
88
|
+
case "DECIMAL": return "decimal";
|
|
89
|
+
case "TEXT":
|
|
90
|
+
case "RICH_TEXT":
|
|
91
|
+
case "HTML":
|
|
92
|
+
case "HANDLE": return "text";
|
|
93
|
+
case "BOOLEAN": return "bool";
|
|
94
|
+
case "DATE": return "date";
|
|
95
|
+
case "DATETIME": return "datetime";
|
|
96
|
+
case "PICKLIST":
|
|
97
|
+
case "MULTI_PICKLIST": return "picklist";
|
|
98
|
+
case "USER":
|
|
99
|
+
case "USER_ID": return "user";
|
|
100
|
+
case "GROUP":
|
|
101
|
+
case "GROUP_ID": return "group";
|
|
102
|
+
case "ATTACHMENT":
|
|
103
|
+
case "ATTACHMENT_ID": return "attachment";
|
|
104
|
+
case "JSON": return "json";
|
|
105
|
+
case "CALCULATED":
|
|
106
|
+
throw new Error(`calc: cannot reference calculated field "${field.name}" inside another ` +
|
|
107
|
+
`calculation — referring to a calculated field's value needs the server ` +
|
|
108
|
+
`to infer its output type, which the EDK doesn't replicate locally. ` +
|
|
109
|
+
`Inline the upstream expression or split the work across automation tasks.`);
|
|
110
|
+
default: {
|
|
111
|
+
const _exhaustive = field;
|
|
112
|
+
void _exhaustive;
|
|
113
|
+
throw new Error(`calc: unsupported field type on "${field.name}"`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// ---------------------------------------------------------------------------
|
|
118
|
+
// Literal serialization
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
/**
|
|
121
|
+
* Quote a TS string for the wire. Single-quoted with `''` escapes per
|
|
122
|
+
* the ANTLR grammar's STRING_LITERAL rule.
|
|
123
|
+
*/
|
|
124
|
+
export function emitStringLiteral(value) {
|
|
125
|
+
return `'${value.replace(/'/g, "''")}'`;
|
|
126
|
+
}
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
// Coercion
|
|
129
|
+
// ---------------------------------------------------------------------------
|
|
130
|
+
/**
|
|
131
|
+
* Normalize an `ExprLike<T>` into an `Expr<T>`. The three branches:
|
|
132
|
+
*
|
|
133
|
+
* 1. Already an `Expr<T>` (or a pulled-expression marker) → return
|
|
134
|
+
* verbatim.
|
|
135
|
+
* 2. An `AppField` handle → wrap as an `Expr<...>` whose
|
|
136
|
+
* `toCalcString()` emits the wire field reference.
|
|
137
|
+
* 3. A raw TS literal (number / string / boolean) → wrap as a
|
|
138
|
+
* typed literal expression.
|
|
139
|
+
*
|
|
140
|
+
* The function's input type is `ExprLike<T>` so TypeScript already
|
|
141
|
+
* narrowed which `T` is expected at the call site; the runtime
|
|
142
|
+
* branches just route the value through the right factory. Coercion
|
|
143
|
+
* doesn't validate that the value's actual type matches `T` — the
|
|
144
|
+
* compile-time `ExprLike<T>` union prevents the mismatch from ever
|
|
145
|
+
* reaching here.
|
|
146
|
+
*/
|
|
147
|
+
export function coerce(value) {
|
|
148
|
+
if (isExpr(value)) {
|
|
149
|
+
return value;
|
|
150
|
+
}
|
|
151
|
+
if (isAppField(value)) {
|
|
152
|
+
const field = value;
|
|
153
|
+
const exprType = appFieldExprType(field);
|
|
154
|
+
return makeExpr(exprType, () => emitFieldRef(field));
|
|
155
|
+
}
|
|
156
|
+
if (typeof value === "number") {
|
|
157
|
+
// Integer → number, fractional → decimal. The runtime split
|
|
158
|
+
// matches the server's promotion: any non-integer literal forces
|
|
159
|
+
// decimal context.
|
|
160
|
+
const branded = Number.isInteger(value) ? "number" : "decimal";
|
|
161
|
+
return makeExpr(branded, () => String(value));
|
|
162
|
+
}
|
|
163
|
+
if (typeof value === "string") {
|
|
164
|
+
return makeExpr("text", () => emitStringLiteral(value));
|
|
165
|
+
}
|
|
166
|
+
if (typeof value === "boolean") {
|
|
167
|
+
return makeExpr("bool", () => (value ? "TRUE()" : "FALSE()"));
|
|
168
|
+
}
|
|
169
|
+
throw new Error(`calc: cannot coerce value of type "${typeof value}" to Expr — pass a calc.* node, an AppField handle, or a primitive literal.`);
|
|
170
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tier-2 text, regex, and JSON builders for the calc DSL.
|
|
3
|
+
*
|
|
4
|
+
* All functions in this module produce or consume `Expr<"text">`. They
|
|
5
|
+
* follow the same shape as tier-1: each builder coerces its inputs
|
|
6
|
+
* through `coerce()`, composes their `toCalcString()` outputs into the
|
|
7
|
+
* wire form, and brands the result.
|
|
8
|
+
*
|
|
9
|
+
* Type rules baked in:
|
|
10
|
+
* - `concat` accepts any expression — the server stringifies non-text
|
|
11
|
+
* arguments as part of the concatenation (matches the Java test's
|
|
12
|
+
* `CONCAT("Partner", "Closed on")` case where a datetime concatenates
|
|
13
|
+
* into a text result).
|
|
14
|
+
* - `len` accepts text only (server rejects numeric).
|
|
15
|
+
* - `regexMatch` returns bool; the rest return text.
|
|
16
|
+
* - Argument naming favors readability over wire-form parity
|
|
17
|
+
* (`needle` / `haystack` for FIND/SEARCH; `pattern` for regex).
|
|
18
|
+
*/
|
|
19
|
+
import type { Expr, ExprLike, ExprType } from "./types.js";
|
|
20
|
+
/**
|
|
21
|
+
* Concatenate two or more expressions into a single text value.
|
|
22
|
+
* Non-text expressions are stringified by the server. At least two
|
|
23
|
+
* args are required — wire `CONCAT` rejects a single-arg call.
|
|
24
|
+
*/
|
|
25
|
+
export declare function concat(a: ExprLike<ExprType>, b: ExprLike<ExprType>, ...rest: ExprLike<ExprType>[]): Expr<"text">;
|
|
26
|
+
/**
|
|
27
|
+
* Coerce any expression to text. Wire `TEXT(value)`. Useful for
|
|
28
|
+
* embedding non-text values inside a string-shaped expression where
|
|
29
|
+
* the server's implicit promotion isn't enough.
|
|
30
|
+
*/
|
|
31
|
+
export declare function toText<T extends ExprType>(value: ExprLike<T>): Expr<"text">;
|
|
32
|
+
/** Character length of a text expression. Returns NUMBER. */
|
|
33
|
+
export declare function len(value: ExprLike<"text">): Expr<"number">;
|
|
34
|
+
/** Strip leading/trailing whitespace. */
|
|
35
|
+
export declare function trim(value: ExprLike<"text">): Expr<"text">;
|
|
36
|
+
/** Upper-case. */
|
|
37
|
+
export declare function upper(value: ExprLike<"text">): Expr<"text">;
|
|
38
|
+
/** Lower-case. */
|
|
39
|
+
export declare function lower(value: ExprLike<"text">): Expr<"text">;
|
|
40
|
+
/**
|
|
41
|
+
* Leftmost `n` characters of a text expression. `n` defaults to 1 on
|
|
42
|
+
* the server when omitted. Wire emits `LEFT(text)` or `LEFT(text, n)`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function left(value: ExprLike<"text">, n?: ExprLike<"number">): Expr<"text">;
|
|
45
|
+
/**
|
|
46
|
+
* Rightmost `n` characters of a text expression. `n` defaults to 1 on
|
|
47
|
+
* the server when omitted.
|
|
48
|
+
*/
|
|
49
|
+
export declare function right(value: ExprLike<"text">, n?: ExprLike<"number">): Expr<"text">;
|
|
50
|
+
/**
|
|
51
|
+
* Substring from `start` (1-indexed) for `length` characters. Wire
|
|
52
|
+
* emits `MID(text, start, length)`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function mid(value: ExprLike<"text">, start: ExprLike<"number">, length: ExprLike<"number">): Expr<"text">;
|
|
55
|
+
/**
|
|
56
|
+
* Replace every occurrence of `find` with `replace` in `value`. Wire
|
|
57
|
+
* emits `SUBSTITUTE(value, find, replace)`. For pattern-based
|
|
58
|
+
* replacement use `regexReplace`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function substitute(value: ExprLike<"text">, find: ExprLike<"text">, replace: ExprLike<"text">): Expr<"text">;
|
|
61
|
+
/**
|
|
62
|
+
* Case-sensitive index of `needle` within `haystack` (1-indexed).
|
|
63
|
+
* `start` is the 1-indexed position to begin searching from. Wire:
|
|
64
|
+
* `FIND(needle, haystack)` / `FIND(needle, haystack, start)`.
|
|
65
|
+
*/
|
|
66
|
+
export declare function find(needle: ExprLike<"text">, haystack: ExprLike<"text">, start?: ExprLike<"number">): Expr<"number">;
|
|
67
|
+
/**
|
|
68
|
+
* Case-INsensitive variant of `find`. Wire: `SEARCH(...)`.
|
|
69
|
+
*/
|
|
70
|
+
export declare function search(needle: ExprLike<"text">, haystack: ExprLike<"text">, start?: ExprLike<"number">): Expr<"number">;
|
|
71
|
+
/**
|
|
72
|
+
* Split a text expression by a separator. Wire `SPLIT(text, sep)`.
|
|
73
|
+
* The server returns a text array internally; in expression context
|
|
74
|
+
* it surfaces as a multi-valued text. Note the method name
|
|
75
|
+
* `splitText` to avoid colliding with Array.prototype.split or the
|
|
76
|
+
* JS keyword `split` in `calc.split` — `splitText` reads cleanly in
|
|
77
|
+
* the calc namespace.
|
|
78
|
+
*/
|
|
79
|
+
export declare function splitText(value: ExprLike<"text">, separator: ExprLike<"text">): Expr<"text">;
|
|
80
|
+
/**
|
|
81
|
+
* Regex match test. Wire `REGEXMATCH(text, pattern)` or
|
|
82
|
+
* `REGEXMATCH(text, pattern, TRUE)` for case-insensitive matching.
|
|
83
|
+
* The `ignoreCase` flag is a bool literal on the wire — TS accepts a
|
|
84
|
+
* raw boolean here so the agent doesn't have to wrap it.
|
|
85
|
+
*/
|
|
86
|
+
export declare function regexMatch(value: ExprLike<"text">, pattern: ExprLike<"text">, ignoreCase?: boolean): Expr<"bool">;
|
|
87
|
+
/**
|
|
88
|
+
* Regex search-and-replace. Wire `REGEXREPLACE(text, pattern, repl)`
|
|
89
|
+
* or `REGEXREPLACE(text, pattern, repl, TRUE)` for case-insensitive.
|
|
90
|
+
*/
|
|
91
|
+
export declare function regexReplace(value: ExprLike<"text">, pattern: ExprLike<"text">, replacement: ExprLike<"text">, ignoreCase?: boolean): Expr<"text">;
|
|
92
|
+
/**
|
|
93
|
+
* Regex extract — returns the first matching substring (or capture
|
|
94
|
+
* group) as text. Wire `REGEXEXTRACT(text, pattern)`.
|
|
95
|
+
*/
|
|
96
|
+
export declare function regexExtract(value: ExprLike<"text">, pattern: ExprLike<"text">): Expr<"text">;
|
|
97
|
+
/** Escape a text value for embedding in a JSON string literal. */
|
|
98
|
+
export declare function jsonEscape(value: ExprLike<"text">): Expr<"text">;
|
|
99
|
+
/** Reverse the effect of `jsonEscape` — decode a JSON-escaped string. */
|
|
100
|
+
export declare function jsonUnescape(value: ExprLike<"text">): Expr<"text">;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tier-2 text, regex, and JSON builders for the calc DSL.
|
|
3
|
+
*
|
|
4
|
+
* All functions in this module produce or consume `Expr<"text">`. They
|
|
5
|
+
* follow the same shape as tier-1: each builder coerces its inputs
|
|
6
|
+
* through `coerce()`, composes their `toCalcString()` outputs into the
|
|
7
|
+
* wire form, and brands the result.
|
|
8
|
+
*
|
|
9
|
+
* Type rules baked in:
|
|
10
|
+
* - `concat` accepts any expression — the server stringifies non-text
|
|
11
|
+
* arguments as part of the concatenation (matches the Java test's
|
|
12
|
+
* `CONCAT("Partner", "Closed on")` case where a datetime concatenates
|
|
13
|
+
* into a text result).
|
|
14
|
+
* - `len` accepts text only (server rejects numeric).
|
|
15
|
+
* - `regexMatch` returns bool; the rest return text.
|
|
16
|
+
* - Argument naming favors readability over wire-form parity
|
|
17
|
+
* (`needle` / `haystack` for FIND/SEARCH; `pattern` for regex).
|
|
18
|
+
*/
|
|
19
|
+
import { coerce, makeExpr } from "./runtime.js";
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// CONCAT / TEXT — assembling text values
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
/**
|
|
24
|
+
* Concatenate two or more expressions into a single text value.
|
|
25
|
+
* Non-text expressions are stringified by the server. At least two
|
|
26
|
+
* args are required — wire `CONCAT` rejects a single-arg call.
|
|
27
|
+
*/
|
|
28
|
+
export function concat(a, b, ...rest) {
|
|
29
|
+
const exprs = [a, b, ...rest].map((v) => coerce(v));
|
|
30
|
+
return makeExpr("text", () => `CONCAT(${exprs.map((e) => e.toCalcString()).join(", ")})`);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Coerce any expression to text. Wire `TEXT(value)`. Useful for
|
|
34
|
+
* embedding non-text values inside a string-shaped expression where
|
|
35
|
+
* the server's implicit promotion isn't enough.
|
|
36
|
+
*/
|
|
37
|
+
export function toText(value) {
|
|
38
|
+
const e = coerce(value);
|
|
39
|
+
return makeExpr("text", () => `TEXT(${e.toCalcString()})`);
|
|
40
|
+
}
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
// LEN / TRIM / case
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
/** Character length of a text expression. Returns NUMBER. */
|
|
45
|
+
export function len(value) {
|
|
46
|
+
const e = coerce(value);
|
|
47
|
+
return makeExpr("number", () => `LEN(${e.toCalcString()})`);
|
|
48
|
+
}
|
|
49
|
+
/** Strip leading/trailing whitespace. */
|
|
50
|
+
export function trim(value) {
|
|
51
|
+
const e = coerce(value);
|
|
52
|
+
return makeExpr("text", () => `TRIM(${e.toCalcString()})`);
|
|
53
|
+
}
|
|
54
|
+
/** Upper-case. */
|
|
55
|
+
export function upper(value) {
|
|
56
|
+
const e = coerce(value);
|
|
57
|
+
return makeExpr("text", () => `UPPER(${e.toCalcString()})`);
|
|
58
|
+
}
|
|
59
|
+
/** Lower-case. */
|
|
60
|
+
export function lower(value) {
|
|
61
|
+
const e = coerce(value);
|
|
62
|
+
return makeExpr("text", () => `LOWER(${e.toCalcString()})`);
|
|
63
|
+
}
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
// LEFT / RIGHT / MID — substring helpers
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
/**
|
|
68
|
+
* Leftmost `n` characters of a text expression. `n` defaults to 1 on
|
|
69
|
+
* the server when omitted. Wire emits `LEFT(text)` or `LEFT(text, n)`.
|
|
70
|
+
*/
|
|
71
|
+
export function left(value, n) {
|
|
72
|
+
const e = coerce(value);
|
|
73
|
+
if (n === undefined) {
|
|
74
|
+
return makeExpr("text", () => `LEFT(${e.toCalcString()})`);
|
|
75
|
+
}
|
|
76
|
+
const ne = coerce(n);
|
|
77
|
+
return makeExpr("text", () => `LEFT(${e.toCalcString()}, ${ne.toCalcString()})`);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Rightmost `n` characters of a text expression. `n` defaults to 1 on
|
|
81
|
+
* the server when omitted.
|
|
82
|
+
*/
|
|
83
|
+
export function right(value, n) {
|
|
84
|
+
const e = coerce(value);
|
|
85
|
+
if (n === undefined) {
|
|
86
|
+
return makeExpr("text", () => `RIGHT(${e.toCalcString()})`);
|
|
87
|
+
}
|
|
88
|
+
const ne = coerce(n);
|
|
89
|
+
return makeExpr("text", () => `RIGHT(${e.toCalcString()}, ${ne.toCalcString()})`);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Substring from `start` (1-indexed) for `length` characters. Wire
|
|
93
|
+
* emits `MID(text, start, length)`.
|
|
94
|
+
*/
|
|
95
|
+
export function mid(value, start, length) {
|
|
96
|
+
const e = coerce(value);
|
|
97
|
+
const se = coerce(start);
|
|
98
|
+
const le = coerce(length);
|
|
99
|
+
return makeExpr("text", () => `MID(${e.toCalcString()}, ${se.toCalcString()}, ${le.toCalcString()})`);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Replace every occurrence of `find` with `replace` in `value`. Wire
|
|
103
|
+
* emits `SUBSTITUTE(value, find, replace)`. For pattern-based
|
|
104
|
+
* replacement use `regexReplace`.
|
|
105
|
+
*/
|
|
106
|
+
export function substitute(value, find, replace) {
|
|
107
|
+
const v = coerce(value);
|
|
108
|
+
const f = coerce(find);
|
|
109
|
+
const r = coerce(replace);
|
|
110
|
+
return makeExpr("text", () => `SUBSTITUTE(${v.toCalcString()}, ${f.toCalcString()}, ${r.toCalcString()})`);
|
|
111
|
+
}
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
// FIND / SEARCH — substring location
|
|
114
|
+
// ---------------------------------------------------------------------------
|
|
115
|
+
/**
|
|
116
|
+
* Case-sensitive index of `needle` within `haystack` (1-indexed).
|
|
117
|
+
* `start` is the 1-indexed position to begin searching from. Wire:
|
|
118
|
+
* `FIND(needle, haystack)` / `FIND(needle, haystack, start)`.
|
|
119
|
+
*/
|
|
120
|
+
export function find(needle, haystack, start) {
|
|
121
|
+
const n = coerce(needle);
|
|
122
|
+
const h = coerce(haystack);
|
|
123
|
+
if (start === undefined) {
|
|
124
|
+
return makeExpr("number", () => `FIND(${n.toCalcString()}, ${h.toCalcString()})`);
|
|
125
|
+
}
|
|
126
|
+
const s = coerce(start);
|
|
127
|
+
return makeExpr("number", () => `FIND(${n.toCalcString()}, ${h.toCalcString()}, ${s.toCalcString()})`);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Case-INsensitive variant of `find`. Wire: `SEARCH(...)`.
|
|
131
|
+
*/
|
|
132
|
+
export function search(needle, haystack, start) {
|
|
133
|
+
const n = coerce(needle);
|
|
134
|
+
const h = coerce(haystack);
|
|
135
|
+
if (start === undefined) {
|
|
136
|
+
return makeExpr("number", () => `SEARCH(${n.toCalcString()}, ${h.toCalcString()})`);
|
|
137
|
+
}
|
|
138
|
+
const s = coerce(start);
|
|
139
|
+
return makeExpr("number", () => `SEARCH(${n.toCalcString()}, ${h.toCalcString()}, ${s.toCalcString()})`);
|
|
140
|
+
}
|
|
141
|
+
// ---------------------------------------------------------------------------
|
|
142
|
+
// SPLIT
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
/**
|
|
145
|
+
* Split a text expression by a separator. Wire `SPLIT(text, sep)`.
|
|
146
|
+
* The server returns a text array internally; in expression context
|
|
147
|
+
* it surfaces as a multi-valued text. Note the method name
|
|
148
|
+
* `splitText` to avoid colliding with Array.prototype.split or the
|
|
149
|
+
* JS keyword `split` in `calc.split` — `splitText` reads cleanly in
|
|
150
|
+
* the calc namespace.
|
|
151
|
+
*/
|
|
152
|
+
export function splitText(value, separator) {
|
|
153
|
+
const v = coerce(value);
|
|
154
|
+
const s = coerce(separator);
|
|
155
|
+
return makeExpr("text", () => `SPLIT(${v.toCalcString()}, ${s.toCalcString()})`);
|
|
156
|
+
}
|
|
157
|
+
// ---------------------------------------------------------------------------
|
|
158
|
+
// REGEX
|
|
159
|
+
// ---------------------------------------------------------------------------
|
|
160
|
+
/**
|
|
161
|
+
* Regex match test. Wire `REGEXMATCH(text, pattern)` or
|
|
162
|
+
* `REGEXMATCH(text, pattern, TRUE)` for case-insensitive matching.
|
|
163
|
+
* The `ignoreCase` flag is a bool literal on the wire — TS accepts a
|
|
164
|
+
* raw boolean here so the agent doesn't have to wrap it.
|
|
165
|
+
*/
|
|
166
|
+
export function regexMatch(value, pattern, ignoreCase) {
|
|
167
|
+
const v = coerce(value);
|
|
168
|
+
const p = coerce(pattern);
|
|
169
|
+
if (ignoreCase === undefined) {
|
|
170
|
+
return makeExpr("bool", () => `REGEXMATCH(${v.toCalcString()}, ${p.toCalcString()})`);
|
|
171
|
+
}
|
|
172
|
+
return makeExpr("bool", () => `REGEXMATCH(${v.toCalcString()}, ${p.toCalcString()}, ${ignoreCase ? "TRUE" : "FALSE"})`);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Regex search-and-replace. Wire `REGEXREPLACE(text, pattern, repl)`
|
|
176
|
+
* or `REGEXREPLACE(text, pattern, repl, TRUE)` for case-insensitive.
|
|
177
|
+
*/
|
|
178
|
+
export function regexReplace(value, pattern, replacement, ignoreCase) {
|
|
179
|
+
const v = coerce(value);
|
|
180
|
+
const p = coerce(pattern);
|
|
181
|
+
const r = coerce(replacement);
|
|
182
|
+
if (ignoreCase === undefined) {
|
|
183
|
+
return makeExpr("text", () => `REGEXREPLACE(${v.toCalcString()}, ${p.toCalcString()}, ${r.toCalcString()})`);
|
|
184
|
+
}
|
|
185
|
+
return makeExpr("text", () => `REGEXREPLACE(${v.toCalcString()}, ${p.toCalcString()}, ${r.toCalcString()}, ${ignoreCase ? "TRUE" : "FALSE"})`);
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Regex extract — returns the first matching substring (or capture
|
|
189
|
+
* group) as text. Wire `REGEXEXTRACT(text, pattern)`.
|
|
190
|
+
*/
|
|
191
|
+
export function regexExtract(value, pattern) {
|
|
192
|
+
const v = coerce(value);
|
|
193
|
+
const p = coerce(pattern);
|
|
194
|
+
return makeExpr("text", () => `REGEXEXTRACT(${v.toCalcString()}, ${p.toCalcString()})`);
|
|
195
|
+
}
|
|
196
|
+
// ---------------------------------------------------------------------------
|
|
197
|
+
// JSON escape helpers
|
|
198
|
+
// ---------------------------------------------------------------------------
|
|
199
|
+
/** Escape a text value for embedding in a JSON string literal. */
|
|
200
|
+
export function jsonEscape(value) {
|
|
201
|
+
const e = coerce(value);
|
|
202
|
+
return makeExpr("text", () => `JSON_ESCAPE(${e.toCalcString()})`);
|
|
203
|
+
}
|
|
204
|
+
/** Reverse the effect of `jsonEscape` — decode a JSON-escaped string. */
|
|
205
|
+
export function jsonUnescape(value) {
|
|
206
|
+
const e = coerce(value);
|
|
207
|
+
return makeExpr("text", () => `JSON_UNESCAPE(${e.toCalcString()})`);
|
|
208
|
+
}
|