@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,405 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for the CLOSED expression grammar ei export emits (plan §4.1):
|
|
3
|
+
*
|
|
4
|
+
* expr := jsonencode | reference
|
|
5
|
+
* reference := ("data." type "." label | type "." label) ("." ident)* index?
|
|
6
|
+
* | "local." ident
|
|
7
|
+
* index := "[" quoted-string "]"
|
|
8
|
+
* jsonencode:= "jsonencode(" hcl-literal ")"
|
|
9
|
+
*
|
|
10
|
+
* plus templates: strings mixing literal text with ${...} parts.
|
|
11
|
+
* Anything else is a LOUD error — an unknown form in a stream means the
|
|
12
|
+
* dialect grew and the grammar (and its approval) must grow with it.
|
|
13
|
+
*/
|
|
14
|
+
import { decodeTemplateEscapes } from "./escape.js";
|
|
15
|
+
import { expr } from "./model.js";
|
|
16
|
+
export class TfExprError extends Error {
|
|
17
|
+
constructor(message, source) {
|
|
18
|
+
super(`${message}\n in expression: ${source.length > 200 ? source.slice(0, 200) + "…" : source}`);
|
|
19
|
+
this.name = "TfExprError";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Parse a raw hcl2json string value into a logical string or expression.
|
|
24
|
+
* hcl2json encodes every expression attribute as "${...}"; plain strings
|
|
25
|
+
* stay plain (with template escapes still doubled).
|
|
26
|
+
*/
|
|
27
|
+
export function parseStringValue(raw) {
|
|
28
|
+
const parts = splitTemplate(raw);
|
|
29
|
+
if (parts.length === 1 && typeof parts[0] === "string") {
|
|
30
|
+
return parts[0]; // plain string, already decoded
|
|
31
|
+
}
|
|
32
|
+
if (parts.length === 1) {
|
|
33
|
+
return parts[0]; // exactly "${expr}"
|
|
34
|
+
}
|
|
35
|
+
return expr.template(parts);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Split a raw template string into alternating literal text (decoded) and
|
|
39
|
+
* parsed expressions. "$${" is an escape, not an interpolation start.
|
|
40
|
+
*/
|
|
41
|
+
function splitTemplate(raw) {
|
|
42
|
+
const parts = [];
|
|
43
|
+
let literal = "";
|
|
44
|
+
let i = 0;
|
|
45
|
+
while (i < raw.length) {
|
|
46
|
+
if (raw.startsWith("$${", i) || raw.startsWith("%%{", i)) {
|
|
47
|
+
literal += raw.slice(i, i + 3);
|
|
48
|
+
i += 3;
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (raw.startsWith("${", i)) {
|
|
52
|
+
const end = findInterpolationEnd(raw, i + 2);
|
|
53
|
+
if (literal !== "") {
|
|
54
|
+
parts.push(decodeTemplateEscapes(literal));
|
|
55
|
+
literal = "";
|
|
56
|
+
}
|
|
57
|
+
parts.push(parseExpression(raw.slice(i + 2, end)));
|
|
58
|
+
i = end + 1;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (raw.startsWith("%{", i)) {
|
|
62
|
+
throw new TfExprError("template directives (%{ ... }) are outside the supported grammar", raw);
|
|
63
|
+
}
|
|
64
|
+
literal += raw[i];
|
|
65
|
+
i++;
|
|
66
|
+
}
|
|
67
|
+
if (literal !== "" || parts.length === 0) {
|
|
68
|
+
parts.push(decodeTemplateEscapes(literal));
|
|
69
|
+
}
|
|
70
|
+
return parts;
|
|
71
|
+
}
|
|
72
|
+
/** Find the } closing an interpolation opened at `start`, honoring nesting and strings. */
|
|
73
|
+
function findInterpolationEnd(raw, start) {
|
|
74
|
+
let depth = 1;
|
|
75
|
+
let i = start;
|
|
76
|
+
while (i < raw.length) {
|
|
77
|
+
const c = raw[i];
|
|
78
|
+
if (c === '"') {
|
|
79
|
+
i = skipQuotedString(raw, i);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (c === "{")
|
|
83
|
+
depth++;
|
|
84
|
+
if (c === "}") {
|
|
85
|
+
depth--;
|
|
86
|
+
if (depth === 0)
|
|
87
|
+
return i;
|
|
88
|
+
}
|
|
89
|
+
i++;
|
|
90
|
+
}
|
|
91
|
+
throw new TfExprError("unterminated ${ interpolation", raw);
|
|
92
|
+
}
|
|
93
|
+
function skipQuotedString(s, openQuote) {
|
|
94
|
+
let i = openQuote + 1;
|
|
95
|
+
while (i < s.length) {
|
|
96
|
+
if (s[i] === "\\") {
|
|
97
|
+
i += 2;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (s[i] === '"')
|
|
101
|
+
return i + 1;
|
|
102
|
+
i++;
|
|
103
|
+
}
|
|
104
|
+
throw new TfExprError("unterminated string literal", s);
|
|
105
|
+
}
|
|
106
|
+
/** Parse the inside of a ${...} interpolation. */
|
|
107
|
+
export function parseExpression(src) {
|
|
108
|
+
const p = new Parser(src);
|
|
109
|
+
const e = p.parseExpr();
|
|
110
|
+
p.skipWs();
|
|
111
|
+
if (!p.done()) {
|
|
112
|
+
throw new TfExprError(`trailing content after expression: "${p.rest()}"`, src);
|
|
113
|
+
}
|
|
114
|
+
return e;
|
|
115
|
+
}
|
|
116
|
+
const IDENT_RE = /^[A-Za-z_][A-Za-z0-9_-]*/;
|
|
117
|
+
class Parser {
|
|
118
|
+
src;
|
|
119
|
+
pos = 0;
|
|
120
|
+
constructor(src) {
|
|
121
|
+
this.src = src;
|
|
122
|
+
}
|
|
123
|
+
parseExpr() {
|
|
124
|
+
this.skipWs();
|
|
125
|
+
if (this.peek() === "{") {
|
|
126
|
+
return this.parseForObject();
|
|
127
|
+
}
|
|
128
|
+
if (this.peekIdent() === "jsonencode") {
|
|
129
|
+
return this.parseJsonencode();
|
|
130
|
+
}
|
|
131
|
+
return this.parseReference();
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* The ONE for-expression shape ei emits (label→id lookup maps):
|
|
135
|
+
* { for <var> in <reference> : <var>.<path> => <var>.<path> }
|
|
136
|
+
* No filters, no grouping, no list-for — those are outside the grammar.
|
|
137
|
+
*/
|
|
138
|
+
parseForObject() {
|
|
139
|
+
this.expect("{");
|
|
140
|
+
this.skipWs();
|
|
141
|
+
if (this.takeIdent() !== "for") {
|
|
142
|
+
throw new TfExprError("object constructors are only supported as for-expressions", this.src);
|
|
143
|
+
}
|
|
144
|
+
const variable = this.takeIdent();
|
|
145
|
+
this.skipWs();
|
|
146
|
+
if (this.takeIdent() !== "in") {
|
|
147
|
+
throw new TfExprError('expected "in" in for-expression', this.src);
|
|
148
|
+
}
|
|
149
|
+
this.skipWs();
|
|
150
|
+
const collection = this.parseReference();
|
|
151
|
+
this.expect(":");
|
|
152
|
+
const key = this.parseScopedAttr();
|
|
153
|
+
this.skipWs();
|
|
154
|
+
if (!this.rest().startsWith("=>")) {
|
|
155
|
+
throw new TfExprError('expected "=>" in for-expression', this.src);
|
|
156
|
+
}
|
|
157
|
+
this.pos += 2;
|
|
158
|
+
const value = this.parseScopedAttr();
|
|
159
|
+
this.skipWs();
|
|
160
|
+
this.expect("}");
|
|
161
|
+
return expr.forObject(variable, collection, key, value);
|
|
162
|
+
}
|
|
163
|
+
parseScopedAttr() {
|
|
164
|
+
this.skipWs();
|
|
165
|
+
const name = this.takeIdent();
|
|
166
|
+
return expr.scopedAttr(name, this.parsePath());
|
|
167
|
+
}
|
|
168
|
+
parseJsonencode() {
|
|
169
|
+
this.takeIdent(); // jsonencode
|
|
170
|
+
this.expect("(");
|
|
171
|
+
const value = this.parseLiteral();
|
|
172
|
+
this.skipWs();
|
|
173
|
+
this.expect(")");
|
|
174
|
+
return expr.jsonencode(value);
|
|
175
|
+
}
|
|
176
|
+
parseReference() {
|
|
177
|
+
const first = this.takeIdent();
|
|
178
|
+
if (first === "local") {
|
|
179
|
+
this.expect(".");
|
|
180
|
+
const name = this.takeIdent();
|
|
181
|
+
return expr.local(name, this.parsePath());
|
|
182
|
+
}
|
|
183
|
+
let type;
|
|
184
|
+
let isData = false;
|
|
185
|
+
if (first === "data") {
|
|
186
|
+
isData = true;
|
|
187
|
+
this.expect(".");
|
|
188
|
+
type = this.takeIdent();
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
type = first;
|
|
192
|
+
}
|
|
193
|
+
if (!type.startsWith("elementum_")) {
|
|
194
|
+
// Keeps the grammar closed: var.*, module.*, each.* etc. are not part
|
|
195
|
+
// of the ei dialect and must fail loudly, not parse as resource refs.
|
|
196
|
+
throw new TfExprError(`"${type}" is not an elementum_* resource type — reference form outside the supported grammar`, this.src);
|
|
197
|
+
}
|
|
198
|
+
this.expect(".");
|
|
199
|
+
const label = this.takeIdent();
|
|
200
|
+
const path = this.parsePath();
|
|
201
|
+
return isData ? expr.dataAttr(type, label, path) : expr.resourceAttr(type, label, path);
|
|
202
|
+
}
|
|
203
|
+
/** Trailing .segment and ["key"] steps shared by every reference kind. */
|
|
204
|
+
parsePath() {
|
|
205
|
+
const path = [];
|
|
206
|
+
for (;;) {
|
|
207
|
+
if (this.peek() === ".") {
|
|
208
|
+
this.pos++;
|
|
209
|
+
path.push(this.takeIdent());
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
if (this.peek() === "[") {
|
|
213
|
+
this.pos++;
|
|
214
|
+
this.skipWs();
|
|
215
|
+
const key = this.parseQuotedString();
|
|
216
|
+
this.skipWs();
|
|
217
|
+
this.expect("]");
|
|
218
|
+
path.push({ index: key });
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
return path;
|
|
224
|
+
}
|
|
225
|
+
/** HCL literal value inside jsonencode(...): objects, arrays, scalars. */
|
|
226
|
+
parseLiteral() {
|
|
227
|
+
this.skipWs();
|
|
228
|
+
const c = this.peek();
|
|
229
|
+
if (c === "{")
|
|
230
|
+
return this.parseObjectLiteral();
|
|
231
|
+
if (c === "[")
|
|
232
|
+
return this.parseArrayLiteral();
|
|
233
|
+
if (c === '"')
|
|
234
|
+
return this.parseQuotedString();
|
|
235
|
+
if (c === "-" || (c !== undefined && c >= "0" && c <= "9"))
|
|
236
|
+
return this.parseNumber();
|
|
237
|
+
const ident = this.tryIdent();
|
|
238
|
+
if (ident === "true")
|
|
239
|
+
return true;
|
|
240
|
+
if (ident === "false")
|
|
241
|
+
return false;
|
|
242
|
+
if (ident === "null")
|
|
243
|
+
return null;
|
|
244
|
+
throw new TfExprError(`unsupported value in jsonencode payload at "${this.rest().slice(0, 40)}" — only literals are in the grammar`, this.src);
|
|
245
|
+
}
|
|
246
|
+
parseObjectLiteral() {
|
|
247
|
+
this.expect("{");
|
|
248
|
+
const obj = {};
|
|
249
|
+
for (;;) {
|
|
250
|
+
this.skipWsAndCommas();
|
|
251
|
+
if (this.peek() === "}") {
|
|
252
|
+
this.pos++;
|
|
253
|
+
return obj;
|
|
254
|
+
}
|
|
255
|
+
const key = this.peek() === '"' ? this.parseQuotedString() : this.takeIdent();
|
|
256
|
+
if (key === "$expr") {
|
|
257
|
+
throw new TfExprError('payload object key "$expr" collides with the expression tag', this.src);
|
|
258
|
+
}
|
|
259
|
+
this.skipWs();
|
|
260
|
+
this.expect("=");
|
|
261
|
+
obj[key] = this.parseLiteral();
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
parseArrayLiteral() {
|
|
265
|
+
this.expect("[");
|
|
266
|
+
const arr = [];
|
|
267
|
+
for (;;) {
|
|
268
|
+
this.skipWsAndCommas();
|
|
269
|
+
if (this.peek() === "]") {
|
|
270
|
+
this.pos++;
|
|
271
|
+
return arr;
|
|
272
|
+
}
|
|
273
|
+
arr.push(this.parseLiteral());
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
parseNumber() {
|
|
277
|
+
const m = /^-?\d+(\.\d+)?([eE][+-]?\d+)?/.exec(this.rest());
|
|
278
|
+
if (!m)
|
|
279
|
+
throw new TfExprError(`invalid number at "${this.rest().slice(0, 20)}"`, this.src);
|
|
280
|
+
this.pos += m[0].length;
|
|
281
|
+
const isInteger = !m[1] && !m[2];
|
|
282
|
+
if (isInteger && !Number.isSafeInteger(Number(m[0]))) {
|
|
283
|
+
throw new TfExprError(`integer literal ${m[0]} exceeds JavaScript's safe range — refusing to silently lose precision`, this.src);
|
|
284
|
+
}
|
|
285
|
+
return Number(m[0]);
|
|
286
|
+
}
|
|
287
|
+
parseQuotedString() {
|
|
288
|
+
if (this.peek() !== '"') {
|
|
289
|
+
throw new TfExprError(`expected string at "${this.rest().slice(0, 20)}"`, this.src);
|
|
290
|
+
}
|
|
291
|
+
const end = skipQuotedString(this.src, this.pos);
|
|
292
|
+
const rawInner = this.src.slice(this.pos + 1, end - 1);
|
|
293
|
+
this.pos = end;
|
|
294
|
+
// Live interpolations inside expression strings (a dynamic index key,
|
|
295
|
+
// an interpolated jsonencode payload string) are OUTSIDE the closed
|
|
296
|
+
// grammar — silently literalizing them would change semantics while the
|
|
297
|
+
// structural round-trip stayed green. Loud instead.
|
|
298
|
+
for (let i = 0; i < rawInner.length; i++) {
|
|
299
|
+
if (rawInner.startsWith("$${", i) || rawInner.startsWith("%%{", i)) {
|
|
300
|
+
i += 2;
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
if (rawInner.startsWith("${", i) || rawInner.startsWith("%{", i)) {
|
|
304
|
+
throw new TfExprError("interpolation inside an expression string is outside the supported grammar", this.src);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
// Every string crossing the parse boundary follows the same rule:
|
|
308
|
+
// standard escapes decode, then template escapes decode (render is the
|
|
309
|
+
// exact inverse via quoteHclString).
|
|
310
|
+
return decodeTemplateEscapes(decodeStringEscapes(rawInner, this.src));
|
|
311
|
+
}
|
|
312
|
+
// --- low-level helpers ---
|
|
313
|
+
peek() {
|
|
314
|
+
return this.src[this.pos];
|
|
315
|
+
}
|
|
316
|
+
done() {
|
|
317
|
+
return this.pos >= this.src.length;
|
|
318
|
+
}
|
|
319
|
+
rest() {
|
|
320
|
+
return this.src.slice(this.pos);
|
|
321
|
+
}
|
|
322
|
+
skipWs() {
|
|
323
|
+
while (!this.done() && /\s/.test(this.src[this.pos]))
|
|
324
|
+
this.pos++;
|
|
325
|
+
}
|
|
326
|
+
skipWsAndCommas() {
|
|
327
|
+
while (!this.done() && /[\s,]/.test(this.src[this.pos]))
|
|
328
|
+
this.pos++;
|
|
329
|
+
}
|
|
330
|
+
expect(ch) {
|
|
331
|
+
this.skipWs();
|
|
332
|
+
if (this.src[this.pos] !== ch) {
|
|
333
|
+
throw new TfExprError(`expected "${ch}" at "${this.rest().slice(0, 20)}"`, this.src);
|
|
334
|
+
}
|
|
335
|
+
this.pos++;
|
|
336
|
+
}
|
|
337
|
+
peekIdent() {
|
|
338
|
+
this.skipWs();
|
|
339
|
+
const m = IDENT_RE.exec(this.rest());
|
|
340
|
+
return m ? m[0] : null;
|
|
341
|
+
}
|
|
342
|
+
tryIdent() {
|
|
343
|
+
this.skipWs();
|
|
344
|
+
const m = IDENT_RE.exec(this.rest());
|
|
345
|
+
if (m)
|
|
346
|
+
this.pos += m[0].length;
|
|
347
|
+
return m ? m[0] : null;
|
|
348
|
+
}
|
|
349
|
+
takeIdent() {
|
|
350
|
+
const ident = this.tryIdent();
|
|
351
|
+
if (!ident) {
|
|
352
|
+
throw new TfExprError(`expected identifier at "${this.rest().slice(0, 20)}"`, this.src);
|
|
353
|
+
}
|
|
354
|
+
return ident;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
/** Decode HCL quoted-string escapes (the JSON-compatible subset ei emits). */
|
|
358
|
+
function decodeStringEscapes(raw, ctx) {
|
|
359
|
+
let out = "";
|
|
360
|
+
let i = 0;
|
|
361
|
+
while (i < raw.length) {
|
|
362
|
+
const c = raw[i];
|
|
363
|
+
if (c !== "\\") {
|
|
364
|
+
out += c;
|
|
365
|
+
i++;
|
|
366
|
+
continue;
|
|
367
|
+
}
|
|
368
|
+
const next = raw[i + 1];
|
|
369
|
+
switch (next) {
|
|
370
|
+
case "n":
|
|
371
|
+
out += "\n";
|
|
372
|
+
i += 2;
|
|
373
|
+
break;
|
|
374
|
+
case "t":
|
|
375
|
+
out += "\t";
|
|
376
|
+
i += 2;
|
|
377
|
+
break;
|
|
378
|
+
case "r":
|
|
379
|
+
out += "\r";
|
|
380
|
+
i += 2;
|
|
381
|
+
break;
|
|
382
|
+
case '"':
|
|
383
|
+
out += '"';
|
|
384
|
+
i += 2;
|
|
385
|
+
break;
|
|
386
|
+
case "\\":
|
|
387
|
+
out += "\\";
|
|
388
|
+
i += 2;
|
|
389
|
+
break;
|
|
390
|
+
case "u": {
|
|
391
|
+
const hex = raw.slice(i + 2, i + 6);
|
|
392
|
+
if (!/^[0-9a-fA-F]{4}$/.test(hex)) {
|
|
393
|
+
throw new TfExprError(`invalid \\u escape "\\u${hex}"`, ctx);
|
|
394
|
+
}
|
|
395
|
+
out += String.fromCharCode(parseInt(hex, 16));
|
|
396
|
+
i += 6;
|
|
397
|
+
break;
|
|
398
|
+
}
|
|
399
|
+
default:
|
|
400
|
+
throw new TfExprError(`unsupported string escape "\\${next ?? "<eof>"}"`, ctx);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
// Template escapes inside the literal decode by the shared rule.
|
|
404
|
+
return out;
|
|
405
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* src/tf — the ONE HCL parse/render surface (pristine-refactor plan §4.1).
|
|
3
|
+
* A second dialect must not exist: extractors consume TfBlock from parseHcl;
|
|
4
|
+
* toHcl emitters produce TfBlock rendered by renderDocument.
|
|
5
|
+
*/
|
|
6
|
+
export type { PathSeg, TfBlock, TfBlockKind, TfDocument, TfExpr, TfValue } from "./model.js";
|
|
7
|
+
export { expr, isTfExpr } from "./model.js";
|
|
8
|
+
export { decodeTemplateEscapes, encodeTemplateEscapes, quoteHclString } from "./escape.js";
|
|
9
|
+
export { parseExpression, parseStringValue, TfExprError } from "./expr.js";
|
|
10
|
+
export { assertNoUnsafeIntegers, parseHcl, TfParseError } from "./parse.js";
|
|
11
|
+
export { renderBlock, renderDocument } from "./render.js";
|
|
12
|
+
export { isCanonicalTsLabel, sanitizeName, snakeSlug, splitCamelCase, tfLabelToTsLabel, tsLabelToTfLabel } from "./labels.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* src/tf — the ONE HCL parse/render surface (pristine-refactor plan §4.1).
|
|
3
|
+
* A second dialect must not exist: extractors consume TfBlock from parseHcl;
|
|
4
|
+
* toHcl emitters produce TfBlock rendered by renderDocument.
|
|
5
|
+
*/
|
|
6
|
+
export { expr, isTfExpr } from "./model.js";
|
|
7
|
+
export { decodeTemplateEscapes, encodeTemplateEscapes, quoteHclString } from "./escape.js";
|
|
8
|
+
export { parseExpression, parseStringValue, TfExprError } from "./expr.js";
|
|
9
|
+
export { assertNoUnsafeIntegers, parseHcl, TfParseError } from "./parse.js";
|
|
10
|
+
export { renderBlock, renderDocument } from "./render.js";
|
|
11
|
+
export { isCanonicalTsLabel, sanitizeName, snakeSlug, splitCamelCase, tfLabelToTsLabel, tsLabelToTfLabel } from "./labels.js";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TS port of ei's SanitizeName (export/imports.go) + splitCamelCase
|
|
3
|
+
* (export/hcl_organize.go). Used ONLY for brand-new hand-authored entities
|
|
4
|
+
* (plan §4.2) — exported entities keep their RECORDED tfLabel, because
|
|
5
|
+
* SanitizeName is lossy and the exact exported label can't be re-derived.
|
|
6
|
+
* Ported faithfully so a generated label for a new entity matches what ei
|
|
7
|
+
* would generate on its next export of that entity.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Insert spaces at CamelCase word boundaries. "ValidateAdGroupRequest" →
|
|
11
|
+
* "Validate Ad Group Request"; acronyms stay together ("WaaSRequest" →
|
|
12
|
+
* "WaaS Request", "DLUpdate" → "DL Update", "A2ATranscript" → "A2A Transcript").
|
|
13
|
+
*/
|
|
14
|
+
export declare function splitCamelCase(name: string): string;
|
|
15
|
+
export declare function tfLabelToTsLabel(tfLabel: string): string;
|
|
16
|
+
export declare function tsLabelToTfLabel(tsLabel: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* A tsLabel is canonical when it survives the round trip — i.e. it is the
|
|
19
|
+
* exact image of its own tfLabel. Build validates authored keys with this
|
|
20
|
+
* (loud error otherwise) so every authored identifier has a well-defined
|
|
21
|
+
* terraform address.
|
|
22
|
+
*/
|
|
23
|
+
export declare function isCanonicalTsLabel(tsLabel: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Lowercase snake slug for display names: "To Do" → "to_do". Used where a
|
|
26
|
+
* label derives from a NAME rather than an authored key — stage keys (ei's
|
|
27
|
+
* stage-key shape) and the field bag-key fallback when `__refName` is absent.
|
|
28
|
+
*/
|
|
29
|
+
export declare function snakeSlug(s: string): string;
|
|
30
|
+
/** Faithful port of ei's SanitizeName: platform name → HCL identifier. */
|
|
31
|
+
export declare function sanitizeName(name: string): string;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TS port of ei's SanitizeName (export/imports.go) + splitCamelCase
|
|
3
|
+
* (export/hcl_organize.go). Used ONLY for brand-new hand-authored entities
|
|
4
|
+
* (plan §4.2) — exported entities keep their RECORDED tfLabel, because
|
|
5
|
+
* SanitizeName is lossy and the exact exported label can't be re-derived.
|
|
6
|
+
* Ported faithfully so a generated label for a new entity matches what ei
|
|
7
|
+
* would generate on its next export of that entity.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Insert spaces at CamelCase word boundaries. "ValidateAdGroupRequest" →
|
|
11
|
+
* "Validate Ad Group Request"; acronyms stay together ("WaaSRequest" →
|
|
12
|
+
* "WaaS Request", "DLUpdate" → "DL Update", "A2ATranscript" → "A2A Transcript").
|
|
13
|
+
*/
|
|
14
|
+
export function splitCamelCase(name) {
|
|
15
|
+
const runes = [...name];
|
|
16
|
+
const isUpper = (r) => r >= "A" && r <= "Z";
|
|
17
|
+
const isLower = (r) => r >= "a" && r <= "z";
|
|
18
|
+
const upperRunLen = (i) => {
|
|
19
|
+
let n = 0;
|
|
20
|
+
for (let j = i; j < runes.length && isUpper(runes[j]); j++)
|
|
21
|
+
n++;
|
|
22
|
+
return n;
|
|
23
|
+
};
|
|
24
|
+
let out = "";
|
|
25
|
+
for (let i = 0; i < runes.length; i++) {
|
|
26
|
+
const r = runes[i];
|
|
27
|
+
if (i > 0 && isUpper(r)) {
|
|
28
|
+
const prev = runes[i - 1];
|
|
29
|
+
const next = runes[i + 1];
|
|
30
|
+
if ((isLower(prev) && (next === undefined || isLower(next))) ||
|
|
31
|
+
(isUpper(prev) && next !== undefined && isLower(next)) ||
|
|
32
|
+
(isLower(prev) && next !== undefined && isUpper(next) && upperRunLen(i) >= 3)) {
|
|
33
|
+
out += " ";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
out += r;
|
|
37
|
+
}
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* tfLabel ↔ tsLabel: the ONE naming convention EDK owns.
|
|
42
|
+
*
|
|
43
|
+
* A display name is converted to a tfLabel exactly once, by ei's frozen
|
|
44
|
+
* SanitizeName, at export time — lossy, and not ours to define. Everything
|
|
45
|
+
* EDK-side derives from the tfLabel through this LOSSLESS bijection:
|
|
46
|
+
*
|
|
47
|
+
* tfLabel (snake_case, terraform address) ↔ tsLabel (camelCase, catalog key)
|
|
48
|
+
* seans_snowflake_cloud_link ↔ seansSnowflakeCloudLink
|
|
49
|
+
* claude_sonnet_4_5 ↔ claudeSonnet_4_5
|
|
50
|
+
* gpt_4_1 ↔ gpt_4_1
|
|
51
|
+
*
|
|
52
|
+
* Digits can't carry case, so an underscore BEFORE A DIGIT survives into the
|
|
53
|
+
* tsLabel — that's what keeps `ops_1` and `ops1` distinct in both directions.
|
|
54
|
+
* Hand-authored entities work backwards: the author writes the tsLabel (bag
|
|
55
|
+
* key / file name) and `elementum build` derives the tfLabel via the inverse.
|
|
56
|
+
*/
|
|
57
|
+
/** The alphabet ei's SanitizeName emits — the bijection's valid domain. */
|
|
58
|
+
const TF_LABEL_RE = /^[a-z_][a-z0-9_]*$/;
|
|
59
|
+
export function tfLabelToTsLabel(tfLabel) {
|
|
60
|
+
if (!TF_LABEL_RE.test(tfLabel)) {
|
|
61
|
+
// Outside [a-z0-9_] the conversion is not a bijection (an uppercase
|
|
62
|
+
// letter survives forward but decodes differently backward, silently
|
|
63
|
+
// colliding with a legitimate label). Loud, per the contract-drift rule.
|
|
64
|
+
throw new Error(`tfLabel "${tfLabel}" is outside ei's SanitizeName alphabet ([a-z0-9_], non-digit start) — refusing a lossy conversion`);
|
|
65
|
+
}
|
|
66
|
+
let out = "";
|
|
67
|
+
let i = 0;
|
|
68
|
+
while (i < tfLabel.length) {
|
|
69
|
+
const c = tfLabel[i];
|
|
70
|
+
if (c === "_" && i + 1 < tfLabel.length && /[a-z]/.test(tfLabel[i + 1])) {
|
|
71
|
+
out += tfLabel[i + 1].toUpperCase();
|
|
72
|
+
i += 2;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
out += c;
|
|
76
|
+
i++;
|
|
77
|
+
}
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
export function tsLabelToTfLabel(tsLabel) {
|
|
81
|
+
let out = "";
|
|
82
|
+
for (const c of tsLabel) {
|
|
83
|
+
out += /[A-Z]/.test(c) ? "_" + c.toLowerCase() : c;
|
|
84
|
+
}
|
|
85
|
+
return out;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* A tsLabel is canonical when it survives the round trip — i.e. it is the
|
|
89
|
+
* exact image of its own tfLabel. Build validates authored keys with this
|
|
90
|
+
* (loud error otherwise) so every authored identifier has a well-defined
|
|
91
|
+
* terraform address.
|
|
92
|
+
*/
|
|
93
|
+
export function isCanonicalTsLabel(tsLabel) {
|
|
94
|
+
if (!/^[A-Za-z0-9_]+$/.test(tsLabel))
|
|
95
|
+
return false;
|
|
96
|
+
const tf = tsLabelToTfLabel(tsLabel);
|
|
97
|
+
return TF_LABEL_RE.test(tf) && tfLabelToTsLabel(tf) === tsLabel;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Lowercase snake slug for display names: "To Do" → "to_do". Used where a
|
|
101
|
+
* label derives from a NAME rather than an authored key — stage keys (ei's
|
|
102
|
+
* stage-key shape) and the field bag-key fallback when `__refName` is absent.
|
|
103
|
+
*/
|
|
104
|
+
export function snakeSlug(s) {
|
|
105
|
+
return s
|
|
106
|
+
.toLowerCase()
|
|
107
|
+
.replace(/[^a-z0-9]+/g, "_")
|
|
108
|
+
.replace(/^_+|_+$/g, "");
|
|
109
|
+
}
|
|
110
|
+
/** Faithful port of ei's SanitizeName: platform name → HCL identifier. */
|
|
111
|
+
export function sanitizeName(name) {
|
|
112
|
+
let s = splitCamelCase(name).toLowerCase();
|
|
113
|
+
for (const sep of [" ", "-", ".", ":", "/", "\\"]) {
|
|
114
|
+
s = s.replaceAll(sep, "_");
|
|
115
|
+
}
|
|
116
|
+
s = [...s].filter((r) => (r >= "a" && r <= "z") || (r >= "0" && r <= "9") || r === "_").join("");
|
|
117
|
+
while (s.includes("__")) {
|
|
118
|
+
s = s.replaceAll("__", "_");
|
|
119
|
+
}
|
|
120
|
+
s = s.replace(/^_+|_+$/g, "");
|
|
121
|
+
if (s.length > 0 && s[0] >= "0" && s[0] <= "9") {
|
|
122
|
+
s = "_" + s;
|
|
123
|
+
}
|
|
124
|
+
return s === "" ? "resource" : s;
|
|
125
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The structural model for the ONE HCL parse/render surface (plan §4.1).
|
|
3
|
+
* Extractors consume TfBlock; toHcl emitters produce TfBlock. A second HCL
|
|
4
|
+
* dialect cannot exist because a second parser/renderer doesn't.
|
|
5
|
+
*
|
|
6
|
+
* Expressions are tagged with `$expr` (not the plan sketch's bare `kind`)
|
|
7
|
+
* so a plain object value from a jsonencode payload can never be mistaken
|
|
8
|
+
* for an expression — payload objects are user data and may contain any key,
|
|
9
|
+
* so parseJsonencodePayload loud-errors on a literal `$expr` key instead.
|
|
10
|
+
*/
|
|
11
|
+
/** One step in an attribute path: a field name, or a map-key index like ["Name"]. */
|
|
12
|
+
export type PathSeg = string | {
|
|
13
|
+
index: string;
|
|
14
|
+
};
|
|
15
|
+
export type TfExpr =
|
|
16
|
+
/** elementum_app.x.id · elementum_app.x.refs["Name"] */
|
|
17
|
+
{
|
|
18
|
+
$expr: "resource-attr";
|
|
19
|
+
type: string;
|
|
20
|
+
label: string;
|
|
21
|
+
path: PathSeg[];
|
|
22
|
+
}
|
|
23
|
+
/** data.elementum_category.x.id */
|
|
24
|
+
| {
|
|
25
|
+
$expr: "data-attr";
|
|
26
|
+
type: string;
|
|
27
|
+
label: string;
|
|
28
|
+
path: PathSeg[];
|
|
29
|
+
}
|
|
30
|
+
/** local.itsm_title_field_id · local.stage_ids_by_key["approve"] */
|
|
31
|
+
| {
|
|
32
|
+
$expr: "local";
|
|
33
|
+
name: string;
|
|
34
|
+
path: PathSeg[];
|
|
35
|
+
}
|
|
36
|
+
/** jsonencode({ ... }) — value is the payload as plain data */
|
|
37
|
+
| {
|
|
38
|
+
$expr: "jsonencode";
|
|
39
|
+
value: TfValue;
|
|
40
|
+
}
|
|
41
|
+
/** "text${expr}text" — parts alternate literal text and expressions */
|
|
42
|
+
| {
|
|
43
|
+
$expr: "template";
|
|
44
|
+
parts: (string | TfExpr)[];
|
|
45
|
+
}
|
|
46
|
+
/** a for-loop variable reference inside a for-object: s.name */
|
|
47
|
+
| {
|
|
48
|
+
$expr: "scoped-attr";
|
|
49
|
+
name: string;
|
|
50
|
+
path: PathSeg[];
|
|
51
|
+
}
|
|
52
|
+
/** { for s in <collection> : s.name => s.id } — ei's label→id lookup maps */
|
|
53
|
+
| {
|
|
54
|
+
$expr: "for-object";
|
|
55
|
+
variable: string;
|
|
56
|
+
collection: TfExpr;
|
|
57
|
+
key: TfExpr;
|
|
58
|
+
value: TfExpr;
|
|
59
|
+
};
|
|
60
|
+
export type TfValue = string | number | boolean | null | TfValue[] | {
|
|
61
|
+
[k: string]: TfValue;
|
|
62
|
+
} | TfExpr;
|
|
63
|
+
export type TfBlockKind = "resource" | "data" | "locals" | "import" | "provider" | "terraform";
|
|
64
|
+
export interface TfBlock {
|
|
65
|
+
kind: TfBlockKind;
|
|
66
|
+
/** resource/data only: the terraform type, e.g. "elementum_app" */
|
|
67
|
+
type?: string;
|
|
68
|
+
/** resource/data: the label; provider: the provider name */
|
|
69
|
+
label?: string;
|
|
70
|
+
attrs: Record<string, TfValue>;
|
|
71
|
+
}
|
|
72
|
+
export interface TfDocument {
|
|
73
|
+
blocks: TfBlock[];
|
|
74
|
+
}
|
|
75
|
+
export declare function isTfExpr(v: TfValue): v is TfExpr;
|
|
76
|
+
export declare const expr: {
|
|
77
|
+
resourceAttr(type: string, label: string, path?: PathSeg[]): TfExpr;
|
|
78
|
+
dataAttr(type: string, label: string, path?: PathSeg[]): TfExpr;
|
|
79
|
+
local(name: string, path?: PathSeg[]): TfExpr;
|
|
80
|
+
jsonencode(value: TfValue): TfExpr;
|
|
81
|
+
template(parts: (string | TfExpr)[]): TfExpr;
|
|
82
|
+
scopedAttr(name: string, path?: PathSeg[]): TfExpr;
|
|
83
|
+
forObject(variable: string, collection: TfExpr, key: TfExpr, value: TfExpr): TfExpr;
|
|
84
|
+
};
|