@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,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Element emission: `defineElement` DeployableEntity → `elementum_element` +
|
|
3
|
+
* field resources in ei's dialect. No status_options/stages (apps always
|
|
4
|
+
* emit those; element captures do not).
|
|
5
|
+
*/
|
|
6
|
+
import { EntityTfError } from "../../engine/entity.js";
|
|
7
|
+
import { expr } from "../../engine/tf/index.js";
|
|
8
|
+
import { fieldToTf } from "../field/to-tf.js";
|
|
9
|
+
import { CATEGORY_ORG_BAG } from "../org/category.js";
|
|
10
|
+
import { CLOUD_LINK_ORG_BAG } from "../org/cloud-link.js";
|
|
11
|
+
import { viewToTf } from "../view/to-tf.js";
|
|
12
|
+
import { ELEMENT_RESOURCE_TYPE } from "./module.js";
|
|
13
|
+
/** System-field tags that fold into the element resource (no field resource). */
|
|
14
|
+
const SYSTEM_FIELD_TAGS = new Set([
|
|
15
|
+
"TITLE",
|
|
16
|
+
"HANDLE",
|
|
17
|
+
"STATUS",
|
|
18
|
+
"STAGE",
|
|
19
|
+
"CREATED_AT",
|
|
20
|
+
"CREATED_BY",
|
|
21
|
+
"UPDATED_AT",
|
|
22
|
+
"UPDATED_BY",
|
|
23
|
+
"CLOSED_AT",
|
|
24
|
+
"CLOSED_BY",
|
|
25
|
+
]);
|
|
26
|
+
/** `elementum_element` + one field resource per custom field. */
|
|
27
|
+
export function elementToTf(entity, ctx) {
|
|
28
|
+
if (entity.kind !== "element") {
|
|
29
|
+
throw new EntityTfError(`elementToTf expects kind "element"; got "${entity.kind}" (refName "${entity.refName}")`);
|
|
30
|
+
}
|
|
31
|
+
const payload = entity.payload;
|
|
32
|
+
if (payload === null || typeof payload !== "object") {
|
|
33
|
+
throw new EntityTfError(`element "${entity.refName}" has a non-object payload`);
|
|
34
|
+
}
|
|
35
|
+
const elementAttrs = {
|
|
36
|
+
name: payload.name ?? "",
|
|
37
|
+
};
|
|
38
|
+
// Optional+Computed on the provider: omitting it (rather than forcing a
|
|
39
|
+
// default) lets the platform's current value ride through unchanged.
|
|
40
|
+
if (payload.commentsEnabled !== undefined)
|
|
41
|
+
elementAttrs["comments_enabled"] = payload.commentsEnabled;
|
|
42
|
+
if (payload.namespace !== undefined)
|
|
43
|
+
elementAttrs["namespace"] = payload.namespace;
|
|
44
|
+
if (payload.handle !== undefined)
|
|
45
|
+
elementAttrs["handle"] = payload.handle;
|
|
46
|
+
if (payload.description !== undefined)
|
|
47
|
+
elementAttrs["description"] = payload.description;
|
|
48
|
+
if (payload.icon !== undefined)
|
|
49
|
+
elementAttrs["icon"] = payload.icon;
|
|
50
|
+
if (payload.color !== undefined)
|
|
51
|
+
elementAttrs["color"] = payload.color;
|
|
52
|
+
// A LINKED element's Snowflake table mapping — create-only (the table
|
|
53
|
+
// binding is immutable once set), but sent every build so a rebuild
|
|
54
|
+
// doesn't null it out on an in-place update.
|
|
55
|
+
const cloudConnection = payload.cloudConnection;
|
|
56
|
+
if (cloudConnection !== undefined) {
|
|
57
|
+
if (cloudConnection.database !== undefined)
|
|
58
|
+
elementAttrs["cloud_mapping_snowflake_database"] = cloudConnection.database;
|
|
59
|
+
if (cloudConnection.schema !== undefined)
|
|
60
|
+
elementAttrs["cloud_mapping_snowflake_schema"] = cloudConnection.schema;
|
|
61
|
+
if (cloudConnection.table !== undefined)
|
|
62
|
+
elementAttrs["cloud_mapping_snowflake_table"] = cloudConnection.table;
|
|
63
|
+
if (cloudConnection.hybridTable !== undefined)
|
|
64
|
+
elementAttrs["snowflake_hybrid_table"] = cloudConnection.hybridTable;
|
|
65
|
+
if (cloudConnection.titleColumnName !== undefined)
|
|
66
|
+
elementAttrs["title_column_name"] = cloudConnection.titleColumnName;
|
|
67
|
+
if (cloudConnection.idColumnName !== undefined)
|
|
68
|
+
elementAttrs["id_column_name"] = cloudConnection.idColumnName;
|
|
69
|
+
}
|
|
70
|
+
const categoryName = payload.category?.name;
|
|
71
|
+
if (categoryName !== undefined && categoryName !== "") {
|
|
72
|
+
const category = ctx.orgRefs.byName(CATEGORY_ORG_BAG, categoryName);
|
|
73
|
+
if (category === undefined) {
|
|
74
|
+
ctx.diagnostics.push(`category "${categoryName}" is not in the org catalog — re-run \`edk pull org --data-only\` (categories must already exist in the org)`);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
elementAttrs["category_id"] = expr.dataAttr("elementum_category", category.tfLabel, ["id"]);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const cloudLink = payload.cloudLinkId;
|
|
81
|
+
if (cloudLink !== undefined) {
|
|
82
|
+
const tsLabel = cloudLink.refName ?? "";
|
|
83
|
+
const resolved = ctx.orgRefs.byTsLabel(CLOUD_LINK_ORG_BAG, tsLabel);
|
|
84
|
+
if (resolved === undefined) {
|
|
85
|
+
ctx.diagnostics.push(`cloud link token "${tsLabel}" is not in the org catalog — re-run \`edk pull org --data-only\``);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
elementAttrs["cloud_link_id"] = expr.dataAttr("elementum_cloudlink", resolved.tfLabel, ["id"]);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (payload.cloudOptions !== undefined) {
|
|
92
|
+
ctx.diagnostics.push("cloudOptions are not supported on the terraform path yet; dropped");
|
|
93
|
+
}
|
|
94
|
+
if (payload.displayBlocks !== undefined || payload.recordCreateDisplayBlocks !== undefined) {
|
|
95
|
+
ctx.diagnostics.push("display blocks are not supported on the terraform path; dropped");
|
|
96
|
+
}
|
|
97
|
+
const blocks = [];
|
|
98
|
+
const fieldAddresses = new Map();
|
|
99
|
+
const objectId = expr.resourceAttr(ELEMENT_RESOURCE_TYPE, ctx.appTfLabel, ["id"]);
|
|
100
|
+
for (const fieldEntry of payload.fields ?? []) {
|
|
101
|
+
const typeKey = Object.keys(fieldEntry)[0];
|
|
102
|
+
if (typeKey === undefined)
|
|
103
|
+
continue;
|
|
104
|
+
const inner = fieldEntry[typeKey];
|
|
105
|
+
const name = inner.name ?? "";
|
|
106
|
+
const systemTag = inner.tags?.find((tag) => SYSTEM_FIELD_TAGS.has(tag));
|
|
107
|
+
if (systemTag !== undefined) {
|
|
108
|
+
switch (systemTag) {
|
|
109
|
+
case "TITLE":
|
|
110
|
+
if (name !== "Title")
|
|
111
|
+
elementAttrs["title_field_name"] = name;
|
|
112
|
+
if (inner.description !== undefined)
|
|
113
|
+
elementAttrs["title_field_description"] = inner.description;
|
|
114
|
+
break;
|
|
115
|
+
case "HANDLE":
|
|
116
|
+
if (name !== "ID")
|
|
117
|
+
elementAttrs["id_field_name"] = name;
|
|
118
|
+
if (inner.description !== undefined)
|
|
119
|
+
elementAttrs["id_field_description"] = inner.description;
|
|
120
|
+
break;
|
|
121
|
+
case "STATUS":
|
|
122
|
+
case "STAGE":
|
|
123
|
+
ctx.diagnostics.push(`systemFields.${systemTag.toLowerCase()}: elements do not carry status/stages on the terraform path; dropped`);
|
|
124
|
+
break;
|
|
125
|
+
default:
|
|
126
|
+
// Audit fields are provider-managed; nothing to emit.
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
const field = fieldToTf(typeKey, inner, { objectId, diagnostics: ctx.diagnostics });
|
|
132
|
+
if (field === undefined)
|
|
133
|
+
continue;
|
|
134
|
+
blocks.push(field.block);
|
|
135
|
+
fieldAddresses.set(field.bagKey, field.address);
|
|
136
|
+
}
|
|
137
|
+
const { blocks: viewBlocks } = viewToTf(payload.layouts, payload.listViews, payload.viewOrder, {
|
|
138
|
+
appTfLabel: ctx.appTfLabel,
|
|
139
|
+
appName: payload.name ?? "",
|
|
140
|
+
objectId,
|
|
141
|
+
diagnostics: ctx.diagnostics,
|
|
142
|
+
});
|
|
143
|
+
blocks.push(...viewBlocks);
|
|
144
|
+
blocks.unshift({
|
|
145
|
+
kind: "resource",
|
|
146
|
+
type: ELEMENT_RESOURCE_TYPE,
|
|
147
|
+
label: ctx.appTfLabel,
|
|
148
|
+
attrs: elementAttrs,
|
|
149
|
+
});
|
|
150
|
+
return { blocks, fieldAddresses };
|
|
151
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed field factories — the authoring surface for `defineApp`'s (and
|
|
3
|
+
* `defineElement`'s) `fields:` bag. One factory per field sub-type row
|
|
4
|
+
* (types.ts), each taking only the options valid for its kind:
|
|
5
|
+
*
|
|
6
|
+
* fields: {
|
|
7
|
+
* glamourShot: attachmentField({ name: "Glamour Shot" }),
|
|
8
|
+
* hasPetLlama: booleanField({ name: "Has Pet Llama", required: true }),
|
|
9
|
+
* club: picklistField({ name: "Club", options: ["FFA", "Rex Kwon Do"] }),
|
|
10
|
+
* }
|
|
11
|
+
*
|
|
12
|
+
* Each factory returns a plain {@link AppField} with the `type` discriminator
|
|
13
|
+
* baked in — the factories are sugar over the same authoring shape, so the
|
|
14
|
+
* literal form (`{ name, type: "TEXT" }`) remains valid where ever an
|
|
15
|
+
* AppField is accepted.
|
|
16
|
+
*/
|
|
17
|
+
import type { AppField, AppPicklistConfig, PicklistOption } from "../app/build.js";
|
|
18
|
+
import type { FieldRef } from "../../catalog/index.js";
|
|
19
|
+
import type { Expr, ExprType } from "./calc/types.js";
|
|
20
|
+
/** Options every field kind accepts (everything on {@link AppField} that isn't kind-specific). */
|
|
21
|
+
export interface BaseFieldOptions {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly required?: boolean;
|
|
24
|
+
readonly requiredOnClose?: boolean;
|
|
25
|
+
readonly showOnCreate?: boolean;
|
|
26
|
+
readonly lockOnCreate?: boolean;
|
|
27
|
+
readonly description?: string;
|
|
28
|
+
readonly columnName?: string;
|
|
29
|
+
readonly defaultValue?: unknown;
|
|
30
|
+
/** Platform semantic role tags for system fields (e.g. `["STATUS"]`). */
|
|
31
|
+
readonly tags?: readonly string[];
|
|
32
|
+
/**
|
|
33
|
+
* A calculated-field expression (from the `calc.*` builder). When set, the
|
|
34
|
+
* field serializes as a calculated field; the factory's kind is the
|
|
35
|
+
* declared output type.
|
|
36
|
+
*/
|
|
37
|
+
readonly expression?: Expr<ExprType>;
|
|
38
|
+
}
|
|
39
|
+
/** Extra options for the picklist kinds (`picklistField` / `multiPicklistField`). */
|
|
40
|
+
export interface PicklistFieldOptions extends BaseFieldOptions {
|
|
41
|
+
/** Static options; omit for dynamic picklists (`config.dynamic`). */
|
|
42
|
+
readonly options?: readonly (string | PicklistOption)[];
|
|
43
|
+
/** Parent picklist for a dependent dropdown. */
|
|
44
|
+
readonly parentField?: FieldRef;
|
|
45
|
+
readonly config?: AppPicklistConfig;
|
|
46
|
+
}
|
|
47
|
+
/** Extra options for the numeric kinds (`numberField` / `decimalField`). */
|
|
48
|
+
export interface NumericFieldOptions extends BaseFieldOptions {
|
|
49
|
+
readonly numericFormat?: Record<string, unknown>;
|
|
50
|
+
}
|
|
51
|
+
/** Extra options for `textField`. */
|
|
52
|
+
export interface TextFieldOptions extends BaseFieldOptions {
|
|
53
|
+
readonly qrFormat?: Record<string, unknown>;
|
|
54
|
+
}
|
|
55
|
+
export declare function textField(opts: TextFieldOptions): AppField;
|
|
56
|
+
export declare function htmlField(opts: BaseFieldOptions): AppField;
|
|
57
|
+
export declare function numberField(opts: NumericFieldOptions): AppField;
|
|
58
|
+
export declare function decimalField(opts: NumericFieldOptions): AppField;
|
|
59
|
+
export declare function booleanField(opts: BaseFieldOptions): AppField;
|
|
60
|
+
export declare function dateField(opts: BaseFieldOptions): AppField;
|
|
61
|
+
export declare function dateTimeField(opts: BaseFieldOptions): AppField;
|
|
62
|
+
export declare function userField(opts: BaseFieldOptions): AppField;
|
|
63
|
+
export declare function groupField(opts: BaseFieldOptions): AppField;
|
|
64
|
+
export declare function attachmentField(opts: BaseFieldOptions): AppField;
|
|
65
|
+
export declare function jsonField(opts: BaseFieldOptions): AppField;
|
|
66
|
+
export declare function picklistField(opts: PicklistFieldOptions): AppField;
|
|
67
|
+
export declare function multiPicklistField(opts: PicklistFieldOptions): AppField;
|
|
68
|
+
/** Authoring field type → its factory's exported name (the printer's emission table). */
|
|
69
|
+
export declare const FIELD_FACTORY_BY_TYPE: ReadonlyMap<string, string>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed field factories — the authoring surface for `defineApp`'s (and
|
|
3
|
+
* `defineElement`'s) `fields:` bag. One factory per field sub-type row
|
|
4
|
+
* (types.ts), each taking only the options valid for its kind:
|
|
5
|
+
*
|
|
6
|
+
* fields: {
|
|
7
|
+
* glamourShot: attachmentField({ name: "Glamour Shot" }),
|
|
8
|
+
* hasPetLlama: booleanField({ name: "Has Pet Llama", required: true }),
|
|
9
|
+
* club: picklistField({ name: "Club", options: ["FFA", "Rex Kwon Do"] }),
|
|
10
|
+
* }
|
|
11
|
+
*
|
|
12
|
+
* Each factory returns a plain {@link AppField} with the `type` discriminator
|
|
13
|
+
* baked in — the factories are sugar over the same authoring shape, so the
|
|
14
|
+
* literal form (`{ name, type: "TEXT" }`) remains valid where ever an
|
|
15
|
+
* AppField is accepted.
|
|
16
|
+
*/
|
|
17
|
+
function field(type, opts) {
|
|
18
|
+
return { ...opts, type };
|
|
19
|
+
}
|
|
20
|
+
export function textField(opts) {
|
|
21
|
+
return field("TEXT", opts);
|
|
22
|
+
}
|
|
23
|
+
export function htmlField(opts) {
|
|
24
|
+
return field("HTML", opts);
|
|
25
|
+
}
|
|
26
|
+
export function numberField(opts) {
|
|
27
|
+
return field("NUMBER", opts);
|
|
28
|
+
}
|
|
29
|
+
export function decimalField(opts) {
|
|
30
|
+
return field("DECIMAL", opts);
|
|
31
|
+
}
|
|
32
|
+
export function booleanField(opts) {
|
|
33
|
+
return field("BOOLEAN", opts);
|
|
34
|
+
}
|
|
35
|
+
export function dateField(opts) {
|
|
36
|
+
return field("DATE", opts);
|
|
37
|
+
}
|
|
38
|
+
export function dateTimeField(opts) {
|
|
39
|
+
return field("DATETIME", opts);
|
|
40
|
+
}
|
|
41
|
+
export function userField(opts) {
|
|
42
|
+
return field("USER", opts);
|
|
43
|
+
}
|
|
44
|
+
export function groupField(opts) {
|
|
45
|
+
return field("GROUP", opts);
|
|
46
|
+
}
|
|
47
|
+
export function attachmentField(opts) {
|
|
48
|
+
return field("ATTACHMENT", opts);
|
|
49
|
+
}
|
|
50
|
+
export function jsonField(opts) {
|
|
51
|
+
return field("JSON", opts);
|
|
52
|
+
}
|
|
53
|
+
export function picklistField(opts) {
|
|
54
|
+
return field("PICKLIST", opts);
|
|
55
|
+
}
|
|
56
|
+
export function multiPicklistField(opts) {
|
|
57
|
+
return field("MULTI_PICKLIST", opts);
|
|
58
|
+
}
|
|
59
|
+
/** Authoring field type → its factory's exported name (the printer's emission table). */
|
|
60
|
+
export const FIELD_FACTORY_BY_TYPE = new Map([
|
|
61
|
+
["TEXT", "textField"],
|
|
62
|
+
["HTML", "htmlField"],
|
|
63
|
+
["NUMBER", "numberField"],
|
|
64
|
+
["DECIMAL", "decimalField"],
|
|
65
|
+
["BOOLEAN", "booleanField"],
|
|
66
|
+
["DATE", "dateField"],
|
|
67
|
+
["DATETIME", "dateTimeField"],
|
|
68
|
+
["USER", "userField"],
|
|
69
|
+
["GROUP", "groupField"],
|
|
70
|
+
["ATTACHMENT", "attachmentField"],
|
|
71
|
+
["JSON", "jsonField"],
|
|
72
|
+
["PICKLIST", "picklistField"],
|
|
73
|
+
["MULTI_PICKLIST", "multiPicklistField"],
|
|
74
|
+
]);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tier-2 specialized aggregations — `countIf`, `sumIf`, `stringAgg`,
|
|
3
|
+
* `stringAggUnique`. These have argument shapes that don't fit the
|
|
4
|
+
* generic aggregation pattern in `index.ts`:
|
|
5
|
+
*
|
|
6
|
+
* - `countIf` / `sumIf` accept a *predicate text* second argument
|
|
7
|
+
* (e.g. `'>30'`, `'<30'`, `'30'`). The EDK models this as a
|
|
8
|
+
* structured `Predicate` object — `{ op, value }` — so the
|
|
9
|
+
* comparison operator is a typed literal union rather than a
|
|
10
|
+
* free-form string. The serializer assembles the wire predicate
|
|
11
|
+
* text.
|
|
12
|
+
*
|
|
13
|
+
* - `stringAgg` accepts an optional `ORDER BY` clause embedded
|
|
14
|
+
* inside its separator argument on the wire. The EDK models that
|
|
15
|
+
* as a structured `orderBy` option — `{ field, direction }`. The
|
|
16
|
+
* direction defaults to ASC if omitted.
|
|
17
|
+
*/
|
|
18
|
+
import type { Expr, ExprLike, ExprType } from "./types.js";
|
|
19
|
+
/** Comparison operators the wire `COUNTIF` / `SUMIF` predicate accepts. */
|
|
20
|
+
export type PredicateOp = "=" | ">" | "<" | ">=" | "<=" | "!=";
|
|
21
|
+
/**
|
|
22
|
+
* Predicate for `countIf` / `sumIf`. The operator defaults to `"="`
|
|
23
|
+
* when omitted (matches the wire form: a bare value like `'30'` means
|
|
24
|
+
* "equal to 30"). The value is stringified before quoting.
|
|
25
|
+
*/
|
|
26
|
+
export interface Predicate {
|
|
27
|
+
readonly op?: PredicateOp;
|
|
28
|
+
readonly value: string | number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Count rows where `field` matches the predicate. Wire form:
|
|
32
|
+
* `COUNTIF(field, 'predicate')` — the predicate is a quoted string
|
|
33
|
+
* with the comparison operator prefix (e.g. `'>30'`) and value.
|
|
34
|
+
*/
|
|
35
|
+
export declare function countIf<T extends ExprType>(field: ExprLike<T>, predicate: Predicate): Expr<"number">;
|
|
36
|
+
/**
|
|
37
|
+
* Sum rows of `field` where the value matches the predicate. Wire form:
|
|
38
|
+
* `SUMIF(field, 'predicate')`. Output brand is `decimal` — server may
|
|
39
|
+
* return either NUMBER or DECIMAL depending on input; we collapse to
|
|
40
|
+
* the wider brand.
|
|
41
|
+
*/
|
|
42
|
+
export declare function sumIf(field: ExprLike<"number"> | ExprLike<"decimal">, predicate: Predicate): Expr<"decimal">;
|
|
43
|
+
/** Sort direction for the optional `ORDER BY` clause on `stringAgg`. */
|
|
44
|
+
export type OrderByDirection = "ASC" | "DESC";
|
|
45
|
+
/**
|
|
46
|
+
* Optional ORDER BY shape for `stringAgg` / `stringAggUnique`. The
|
|
47
|
+
* field can be any expression — typically the same field being
|
|
48
|
+
* aggregated, but the server accepts any.
|
|
49
|
+
*/
|
|
50
|
+
export interface StringAggOrderBy {
|
|
51
|
+
readonly field: ExprLike<ExprType>;
|
|
52
|
+
readonly direction?: OrderByDirection;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Concatenate `field` values across related rows, separated by
|
|
56
|
+
* `separator`. Optional `orderBy` controls row ordering.
|
|
57
|
+
*/
|
|
58
|
+
export declare function stringAgg(field: ExprLike<ExprType>, separator: ExprLike<"text">, orderBy?: StringAggOrderBy): Expr<"text">;
|
|
59
|
+
/** Distinct-only variant of `stringAgg`. Server emits duplicates once. */
|
|
60
|
+
export declare function stringAggUnique(field: ExprLike<ExprType>, separator: ExprLike<"text">, orderBy?: StringAggOrderBy): Expr<"text">;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tier-2 specialized aggregations — `countIf`, `sumIf`, `stringAgg`,
|
|
3
|
+
* `stringAggUnique`. These have argument shapes that don't fit the
|
|
4
|
+
* generic aggregation pattern in `index.ts`:
|
|
5
|
+
*
|
|
6
|
+
* - `countIf` / `sumIf` accept a *predicate text* second argument
|
|
7
|
+
* (e.g. `'>30'`, `'<30'`, `'30'`). The EDK models this as a
|
|
8
|
+
* structured `Predicate` object — `{ op, value }` — so the
|
|
9
|
+
* comparison operator is a typed literal union rather than a
|
|
10
|
+
* free-form string. The serializer assembles the wire predicate
|
|
11
|
+
* text.
|
|
12
|
+
*
|
|
13
|
+
* - `stringAgg` accepts an optional `ORDER BY` clause embedded
|
|
14
|
+
* inside its separator argument on the wire. The EDK models that
|
|
15
|
+
* as a structured `orderBy` option — `{ field, direction }`. The
|
|
16
|
+
* direction defaults to ASC if omitted.
|
|
17
|
+
*/
|
|
18
|
+
import { coerce, emitStringLiteral, makeExpr } from "./runtime.js";
|
|
19
|
+
function formatPredicate(p) {
|
|
20
|
+
const op = p.op === undefined || p.op === "=" ? "" : p.op;
|
|
21
|
+
return emitStringLiteral(`${op}${String(p.value)}`);
|
|
22
|
+
}
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// COUNTIF / SUMIF
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
/**
|
|
27
|
+
* Count rows where `field` matches the predicate. Wire form:
|
|
28
|
+
* `COUNTIF(field, 'predicate')` — the predicate is a quoted string
|
|
29
|
+
* with the comparison operator prefix (e.g. `'>30'`) and value.
|
|
30
|
+
*/
|
|
31
|
+
export function countIf(field, predicate) {
|
|
32
|
+
const f = coerce(field);
|
|
33
|
+
return makeExpr("number", () => `COUNTIF(${f.toCalcString()}, ${formatPredicate(predicate)})`);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Sum rows of `field` where the value matches the predicate. Wire form:
|
|
37
|
+
* `SUMIF(field, 'predicate')`. Output brand is `decimal` — server may
|
|
38
|
+
* return either NUMBER or DECIMAL depending on input; we collapse to
|
|
39
|
+
* the wider brand.
|
|
40
|
+
*/
|
|
41
|
+
export function sumIf(field, predicate) {
|
|
42
|
+
const f = coerce(field);
|
|
43
|
+
return makeExpr("decimal", () => `SUMIF(${f.toCalcString()}, ${formatPredicate(predicate)})`);
|
|
44
|
+
}
|
|
45
|
+
function formatStringAggArgs(field, separator, orderBy) {
|
|
46
|
+
const f = coerce(field);
|
|
47
|
+
const s = coerce(separator);
|
|
48
|
+
if (orderBy === undefined) {
|
|
49
|
+
return `${f.toCalcString()}, ${s.toCalcString()}`;
|
|
50
|
+
}
|
|
51
|
+
const o = coerce(orderBy.field);
|
|
52
|
+
const dir = orderBy.direction ?? "ASC";
|
|
53
|
+
// Wire form: STRING_AGG(field, 'sep' ORDER BY orderField DIR) —
|
|
54
|
+
// the ORDER BY clause is embedded inside the second arg slot per
|
|
55
|
+
// the ANTLR grammar.
|
|
56
|
+
const dirSuffix = dir === "ASC" ? "" : ` ${dir}`;
|
|
57
|
+
return `${f.toCalcString()}, ${s.toCalcString()} ORDER BY ${o.toCalcString()}${dirSuffix}`;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Concatenate `field` values across related rows, separated by
|
|
61
|
+
* `separator`. Optional `orderBy` controls row ordering.
|
|
62
|
+
*/
|
|
63
|
+
export function stringAgg(field, separator, orderBy) {
|
|
64
|
+
const inner = formatStringAggArgs(field, separator, orderBy);
|
|
65
|
+
return makeExpr("text", () => `STRING_AGG(${inner})`);
|
|
66
|
+
}
|
|
67
|
+
/** Distinct-only variant of `stringAgg`. Server emits duplicates once. */
|
|
68
|
+
export function stringAggUnique(field, separator, orderBy) {
|
|
69
|
+
const inner = formatStringAggArgs(field, separator, orderBy);
|
|
70
|
+
return makeExpr("text", () => `STRING_AGG_UNIQUE(${inner})`);
|
|
71
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tier-2 date and date/time builders for the calc DSL.
|
|
3
|
+
*
|
|
4
|
+
* The platform's calc grammar treats DATE and DATETIME as distinct
|
|
5
|
+
* brands — DATE is calendar date (no time component), DATETIME is
|
|
6
|
+
* instant-in-time. Most extraction functions accept either, and a few
|
|
7
|
+
* builders are DATETIME-only (HOUR, MINUTE, SECOND, DATETIME_TRUNC).
|
|
8
|
+
*
|
|
9
|
+
* Constrained string arguments are typed as literal unions so the
|
|
10
|
+
* agent gets autocomplete and compile-time validation:
|
|
11
|
+
* - `dateDif` unit: 'D' | 'H' | 'M'
|
|
12
|
+
* - `dateTimeTrunc` precision: a date-part literal union
|
|
13
|
+
* - `weekday` mode: 1 | 2 | 3
|
|
14
|
+
*/
|
|
15
|
+
import type { Expr, ExprLike } from "./types.js";
|
|
16
|
+
/** Either a DATE-typed or DATETIME-typed expression. */
|
|
17
|
+
type DateOrDateTimeLike = ExprLike<"date"> | ExprLike<"datetime">;
|
|
18
|
+
/** Current instant. Wire `NOW()`. Returns DATETIME. */
|
|
19
|
+
export declare function now(): Expr<"datetime">;
|
|
20
|
+
/** Today's calendar date. Wire `TODAY()`. Returns DATE. */
|
|
21
|
+
export declare function today(): Expr<"date">;
|
|
22
|
+
/**
|
|
23
|
+
* Build a DATE from numeric year / month / day components.
|
|
24
|
+
* Wire `DATE(year, month, day)`. The `make` prefix avoids colliding
|
|
25
|
+
* with the JS `Date` global if someone destructures `calc`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function makeDate(year: ExprLike<"number">, month: ExprLike<"number">, day: ExprLike<"number">): Expr<"date">;
|
|
28
|
+
/**
|
|
29
|
+
* Parse a text expression into a DATE. The server accepts ISO-style
|
|
30
|
+
* `YYYY-MM-DD` literals; with a text expression as input the server
|
|
31
|
+
* does a TRY_CAST and returns null on parse failure.
|
|
32
|
+
*/
|
|
33
|
+
export declare function dateValue(value: ExprLike<"text">): Expr<"date">;
|
|
34
|
+
/** Unit codes accepted by the wire `DATEDIF` function. */
|
|
35
|
+
export type DateDifUnit = "D" | "H" | "M";
|
|
36
|
+
/**
|
|
37
|
+
* Difference between `end` and `start` in the specified unit.
|
|
38
|
+
* - `'D'` — days
|
|
39
|
+
* - `'H'` — hours
|
|
40
|
+
* - `'M'` — months
|
|
41
|
+
*/
|
|
42
|
+
export declare function dateDif(start: DateOrDateTimeLike, end: DateOrDateTimeLike, unit: DateDifUnit): Expr<"number">;
|
|
43
|
+
/** Precision values accepted by the wire `DATETIME_TRUNC` function. */
|
|
44
|
+
export type DateTimeTruncPrecision = "YEAR" | "QUARTER" | "MONTH" | "WEEK" | "DAY" | "HOUR" | "MINUTE" | "SECOND";
|
|
45
|
+
/**
|
|
46
|
+
* Truncate a DATETIME to the given precision. E.g.
|
|
47
|
+
* `dateTimeTrunc(t, "MONTH")` returns the first instant of `t`'s month.
|
|
48
|
+
*/
|
|
49
|
+
export declare function dateTimeTrunc(value: ExprLike<"datetime">, precision: DateTimeTruncPrecision): Expr<"datetime">;
|
|
50
|
+
/**
|
|
51
|
+
* Modes accepted by the wire `WEEKDAY` function.
|
|
52
|
+
* - 1 — Sunday=1 .. Saturday=7 (default)
|
|
53
|
+
* - 2 — Monday=1 .. Sunday=7
|
|
54
|
+
* - 3 — Monday=0 .. Sunday=6
|
|
55
|
+
*/
|
|
56
|
+
export type WeekdayMode = 1 | 2 | 3;
|
|
57
|
+
/**
|
|
58
|
+
* Day-of-week as a numeric, optionally selecting the numbering scheme.
|
|
59
|
+
*/
|
|
60
|
+
export declare function weekday(value: DateOrDateTimeLike, mode?: WeekdayMode): Expr<"number">;
|
|
61
|
+
/** Year component as NUMBER. */
|
|
62
|
+
export declare function year(value: DateOrDateTimeLike): Expr<"number">;
|
|
63
|
+
/** Month component (1–12) as NUMBER. */
|
|
64
|
+
export declare function month(value: DateOrDateTimeLike): Expr<"number">;
|
|
65
|
+
/** Day-of-month (1–31) as NUMBER. */
|
|
66
|
+
export declare function day(value: DateOrDateTimeLike): Expr<"number">;
|
|
67
|
+
/** Hour (0–23) from a DATETIME. */
|
|
68
|
+
export declare function hour(value: ExprLike<"datetime">): Expr<"number">;
|
|
69
|
+
/** Minute (0–59) from a DATETIME. */
|
|
70
|
+
export declare function minute(value: ExprLike<"datetime">): Expr<"number">;
|
|
71
|
+
/** Second (0–59) from a DATETIME. */
|
|
72
|
+
export declare function second(value: ExprLike<"datetime">): Expr<"number">;
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tier-2 date and date/time builders for the calc DSL.
|
|
3
|
+
*
|
|
4
|
+
* The platform's calc grammar treats DATE and DATETIME as distinct
|
|
5
|
+
* brands — DATE is calendar date (no time component), DATETIME is
|
|
6
|
+
* instant-in-time. Most extraction functions accept either, and a few
|
|
7
|
+
* builders are DATETIME-only (HOUR, MINUTE, SECOND, DATETIME_TRUNC).
|
|
8
|
+
*
|
|
9
|
+
* Constrained string arguments are typed as literal unions so the
|
|
10
|
+
* agent gets autocomplete and compile-time validation:
|
|
11
|
+
* - `dateDif` unit: 'D' | 'H' | 'M'
|
|
12
|
+
* - `dateTimeTrunc` precision: a date-part literal union
|
|
13
|
+
* - `weekday` mode: 1 | 2 | 3
|
|
14
|
+
*/
|
|
15
|
+
import { coerce, makeExpr, emitStringLiteral } from "./runtime.js";
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Constructors
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
/** Current instant. Wire `NOW()`. Returns DATETIME. */
|
|
20
|
+
export function now() {
|
|
21
|
+
return makeExpr("datetime", () => `NOW()`);
|
|
22
|
+
}
|
|
23
|
+
/** Today's calendar date. Wire `TODAY()`. Returns DATE. */
|
|
24
|
+
export function today() {
|
|
25
|
+
return makeExpr("date", () => `TODAY()`);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Build a DATE from numeric year / month / day components.
|
|
29
|
+
* Wire `DATE(year, month, day)`. The `make` prefix avoids colliding
|
|
30
|
+
* with the JS `Date` global if someone destructures `calc`.
|
|
31
|
+
*/
|
|
32
|
+
export function makeDate(year, month, day) {
|
|
33
|
+
const y = coerce(year);
|
|
34
|
+
const m = coerce(month);
|
|
35
|
+
const d = coerce(day);
|
|
36
|
+
return makeExpr("date", () => `DATE(${y.toCalcString()}, ${m.toCalcString()}, ${d.toCalcString()})`);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Parse a text expression into a DATE. The server accepts ISO-style
|
|
40
|
+
* `YYYY-MM-DD` literals; with a text expression as input the server
|
|
41
|
+
* does a TRY_CAST and returns null on parse failure.
|
|
42
|
+
*/
|
|
43
|
+
export function dateValue(value) {
|
|
44
|
+
const v = coerce(value);
|
|
45
|
+
return makeExpr("date", () => `DATEVALUE(${v.toCalcString()})`);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Difference between `end` and `start` in the specified unit.
|
|
49
|
+
* - `'D'` — days
|
|
50
|
+
* - `'H'` — hours
|
|
51
|
+
* - `'M'` — months
|
|
52
|
+
*/
|
|
53
|
+
export function dateDif(start, end, unit) {
|
|
54
|
+
const s = coerce(start);
|
|
55
|
+
const e = coerce(end);
|
|
56
|
+
return makeExpr("number", () => `DATEDIF(${s.toCalcString()}, ${e.toCalcString()}, ${emitStringLiteral(unit)})`);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Truncate a DATETIME to the given precision. E.g.
|
|
60
|
+
* `dateTimeTrunc(t, "MONTH")` returns the first instant of `t`'s month.
|
|
61
|
+
*/
|
|
62
|
+
export function dateTimeTrunc(value, precision) {
|
|
63
|
+
const v = coerce(value);
|
|
64
|
+
return makeExpr("datetime", () => `DATETIME_TRUNC(${v.toCalcString()}, ${emitStringLiteral(precision)})`);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Day-of-week as a numeric, optionally selecting the numbering scheme.
|
|
68
|
+
*/
|
|
69
|
+
export function weekday(value, mode) {
|
|
70
|
+
const v = coerce(value);
|
|
71
|
+
if (mode === undefined) {
|
|
72
|
+
return makeExpr("number", () => `WEEKDAY(${v.toCalcString()})`);
|
|
73
|
+
}
|
|
74
|
+
return makeExpr("number", () => `WEEKDAY(${v.toCalcString()}, ${mode})`);
|
|
75
|
+
}
|
|
76
|
+
// ---------------------------------------------------------------------------
|
|
77
|
+
// Date-part extraction — YEAR/MONTH/DAY accept date|datetime;
|
|
78
|
+
// HOUR/MINUTE/SECOND accept datetime only.
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
80
|
+
/** Year component as NUMBER. */
|
|
81
|
+
export function year(value) {
|
|
82
|
+
const v = coerce(value);
|
|
83
|
+
return makeExpr("number", () => `YEAR(${v.toCalcString()})`);
|
|
84
|
+
}
|
|
85
|
+
/** Month component (1–12) as NUMBER. */
|
|
86
|
+
export function month(value) {
|
|
87
|
+
const v = coerce(value);
|
|
88
|
+
return makeExpr("number", () => `MONTH(${v.toCalcString()})`);
|
|
89
|
+
}
|
|
90
|
+
/** Day-of-month (1–31) as NUMBER. */
|
|
91
|
+
export function day(value) {
|
|
92
|
+
const v = coerce(value);
|
|
93
|
+
return makeExpr("number", () => `DAY(${v.toCalcString()})`);
|
|
94
|
+
}
|
|
95
|
+
/** Hour (0–23) from a DATETIME. */
|
|
96
|
+
export function hour(value) {
|
|
97
|
+
const v = coerce(value);
|
|
98
|
+
return makeExpr("number", () => `HOUR(${v.toCalcString()})`);
|
|
99
|
+
}
|
|
100
|
+
/** Minute (0–59) from a DATETIME. */
|
|
101
|
+
export function minute(value) {
|
|
102
|
+
const v = coerce(value);
|
|
103
|
+
return makeExpr("number", () => `MINUTE(${v.toCalcString()})`);
|
|
104
|
+
}
|
|
105
|
+
/** Second (0–59) from a DATETIME. */
|
|
106
|
+
export function second(value) {
|
|
107
|
+
const v = coerce(value);
|
|
108
|
+
return makeExpr("number", () => `SECOND(${v.toCalcString()})`);
|
|
109
|
+
}
|