@elementumai/edk 0.0.0-oidc-bootstrap → 0.8.1
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 +462 -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/ai-provider-models.d.ts +30 -0
- package/dist-sdk/src/catalog/ai-provider-models.js +63 -0
- package/dist-sdk/src/catalog/factories.d.ts +242 -0
- package/dist-sdk/src/catalog/factories.js +265 -0
- package/dist-sdk/src/catalog/from-authoring.d.ts +103 -0
- package/dist-sdk/src/catalog/from-authoring.js +467 -0
- package/dist-sdk/src/catalog/index.d.ts +12 -0
- package/dist-sdk/src/catalog/index.js +12 -0
- package/dist-sdk/src/catalog/org.d.ts +11 -0
- package/dist-sdk/src/catalog/org.js +288 -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 +48 -0
- package/dist-sdk/src/catalog/render.js +193 -0
- package/dist-sdk/src/catalog/token.d.ts +10 -0
- package/dist-sdk/src/catalog/token.js +76 -0
- package/dist-sdk/src/catalog/types.d.ts +215 -0
- package/dist-sdk/src/catalog/types.js +86 -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 +95 -0
- package/dist-sdk/src/core/system-fields.js +153 -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 +23 -0
- package/dist-sdk/src/core/types/ai-provider.js +8 -0
- package/dist-sdk/src/core/types/app.d.ts +857 -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 +67 -0
- package/dist-sdk/src/engine/build/context.js +6 -0
- package/dist-sdk/src/engine/build/source-context.d.ts +45 -0
- package/dist-sdk/src/engine/build/source-context.js +23 -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 +38 -0
- package/dist-sdk/src/engine/pull/context.js +44 -0
- package/dist-sdk/src/engine/pull/org.d.ts +54 -0
- package/dist-sdk/src/engine/pull/org.js +134 -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 +76 -0
- package/dist-sdk/src/engine/tf/labels.js +196 -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/access-policy/build.d.ts +26 -0
- package/dist-sdk/src/entities/access-policy/build.js +7 -0
- package/dist-sdk/src/entities/access-policy/filter.d.ts +61 -0
- package/dist-sdk/src/entities/access-policy/filter.js +83 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +48 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +189 -0
- package/dist-sdk/src/entities/access-policy/module.d.ts +3 -0
- package/dist-sdk/src/entities/access-policy/module.js +17 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +36 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +149 -0
- package/dist-sdk/src/entities/access-policy/types.d.ts +4 -0
- package/dist-sdk/src/entities/access-policy/types.js +10 -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 +53 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +344 -0
- package/dist-sdk/src/entities/agent/from-tf.d.ts +65 -0
- package/dist-sdk/src/entities/agent/from-tf.js +289 -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 +122 -0
- package/dist-sdk/src/entities/agent/to-tf.d.ts +33 -0
- package/dist-sdk/src/entities/agent/to-tf.js +188 -0
- package/dist-sdk/src/entities/agent/tools.d.ts +284 -0
- package/dist-sdk/src/entities/agent/tools.js +238 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +110 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +265 -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 +40 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +250 -0
- package/dist-sdk/src/entities/agent-tool/types.d.ts +43 -0
- package/dist-sdk/src/entities/agent-tool/types.js +102 -0
- package/dist-sdk/src/entities/app/build.d.ts +368 -0
- package/dist-sdk/src/entities/app/build.js +372 -0
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +168 -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 +197 -0
- package/dist-sdk/src/entities/app/index.d.ts +14 -0
- package/dist-sdk/src/entities/app/index.js +11 -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 +66 -0
- package/dist-sdk/src/entities/app/to-tf.d.ts +33 -0
- package/dist-sdk/src/entities/app/to-tf.js +212 -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 +259 -0
- package/dist-sdk/src/entities/automation/build.js +436 -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 +152 -0
- package/dist-sdk/src/entities/automation/deserializer/ast.js +13 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +55 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +1176 -0
- package/dist-sdk/src/entities/automation/filter.d.ts +93 -0
- package/dist-sdk/src/entities/automation/filter.js +156 -0
- package/dist-sdk/src/entities/automation/from-tf.d.ts +35 -0
- package/dist-sdk/src/entities/automation/from-tf.js +1258 -0
- package/dist-sdk/src/entities/automation/index.d.ts +22 -0
- package/dist-sdk/src/entities/automation/index.js +25 -0
- package/dist-sdk/src/entities/automation/module.d.ts +3 -0
- package/dist-sdk/src/entities/automation/module.js +150 -0
- package/dist-sdk/src/entities/automation/operators.d.ts +93 -0
- package/dist-sdk/src/entities/automation/operators.js +69 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +19 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +24 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +51 -0
- package/dist-sdk/src/entities/automation/script-code.js +633 -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 +641 -0
- package/dist-sdk/src/entities/automation/tasks.js +765 -0
- package/dist-sdk/src/entities/automation/to-tf.d.ts +19 -0
- package/dist-sdk/src/entities/automation/to-tf.js +1169 -0
- package/dist-sdk/src/entities/automation/triggers.d.ts +205 -0
- package/dist-sdk/src/entities/automation/triggers.js +202 -0
- package/dist-sdk/src/entities/automation/types.d.ts +78 -0
- package/dist-sdk/src/entities/automation/types.js +131 -0
- package/dist-sdk/src/entities/element/build.d.ts +121 -0
- package/dist-sdk/src/entities/element/build.js +110 -0
- package/dist-sdk/src/entities/element/from-tf.d.ts +19 -0
- package/dist-sdk/src/entities/element/from-tf.js +170 -0
- package/dist-sdk/src/entities/element/index.d.ts +12 -0
- package/dist-sdk/src/entities/element/index.js +10 -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 +65 -0
- package/dist-sdk/src/entities/element/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/element/to-tf.js +169 -0
- package/dist-sdk/src/entities/field/build.d.ts +112 -0
- package/dist-sdk/src/entities/field/build.js +84 -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 +174 -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 +31 -0
- package/dist-sdk/src/entities/field/from-tf.js +184 -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 +50 -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 +73 -0
- package/dist-sdk/src/entities/field/to-tf.js +142 -0
- package/dist-sdk/src/entities/field/types.d.ts +53 -0
- package/dist-sdk/src/entities/field/types.js +68 -0
- package/dist-sdk/src/entities/file-reader/build.d.ts +182 -0
- package/dist-sdk/src/entities/file-reader/build.js +105 -0
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +6 -0
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +109 -0
- package/dist-sdk/src/entities/file-reader/from-tf.d.ts +13 -0
- package/dist-sdk/src/entities/file-reader/from-tf.js +172 -0
- package/dist-sdk/src/entities/file-reader/index.d.ts +10 -0
- package/dist-sdk/src/entities/file-reader/index.js +10 -0
- package/dist-sdk/src/entities/file-reader/module.d.ts +3 -0
- package/dist-sdk/src/entities/file-reader/module.js +115 -0
- package/dist-sdk/src/entities/file-reader/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/file-reader/to-tf.js +84 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +32 -0
- package/dist-sdk/src/entities/file-reader/types.js +30 -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/ai-provider.d.ts +13 -0
- package/dist-sdk/src/entities/org/ai-provider.js +46 -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 +12 -0
- package/dist-sdk/src/entities/org/connector.js +35 -0
- package/dist-sdk/src/entities/org/group.d.ts +5 -0
- package/dist-sdk/src/entities/org/group.js +40 -0
- package/dist-sdk/src/entities/org/index.d.ts +11 -0
- package/dist-sdk/src/entities/org/index.js +11 -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 +30 -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 +277 -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/tool-field-ref.d.ts +17 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +31 -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 +58 -0
- package/dist-sdk/src/entities/shared/types/field-types.js +57 -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 +39 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +124 -0
- package/dist-sdk/src/entities/skill/from-tf.d.ts +33 -0
- package/dist-sdk/src/entities/skill/from-tf.js +96 -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 +111 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +33 -0
- package/dist-sdk/src/entities/skill/to-tf.js +59 -0
- package/dist-sdk/src/entities/skill/tools.d.ts +93 -0
- package/dist-sdk/src/entities/skill/tools.js +105 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +60 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +142 -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 +34 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +130 -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 +29 -0
- package/dist-sdk/src/entities/view/from-tf.js +235 -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 +65 -0
- package/dist-sdk/src/entities/view/to-tf.js +171 -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 +9 -0
- package/dist-sdk/src/graph/deferred-catalog-render.js +18 -0
- package/dist-sdk/src/graph/index.d.ts +91 -0
- package/dist-sdk/src/graph/index.js +211 -0
- package/dist-sdk/src/graph/modules.d.ts +7 -0
- package/dist-sdk/src/graph/modules.js +42 -0
- package/dist-sdk/src/graph/types.d.ts +375 -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 +201 -8
|
@@ -0,0 +1,196 @@
|
|
|
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
|
+
}
|
|
126
|
+
/** Matches a raw platform id (v4-shaped, case-insensitive) — used to recognize an orphaned reference that round-trips as a bare id rather than a resolved name/label. */
|
|
127
|
+
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
128
|
+
/** True when `value` has the shape of a platform id (not a validity check — just the wire shape). */
|
|
129
|
+
export function isUuid(value) {
|
|
130
|
+
return UUID_RE.test(value);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Prefix for app-owned child resource labels in a shared `.tf/out/` workspace.
|
|
134
|
+
* Uses the platform namespace (`appTfLabel`), matching ei's `AppResourceName`.
|
|
135
|
+
*/
|
|
136
|
+
export function appResourceLabelPrefix(appTfLabel) {
|
|
137
|
+
return `apps_${appTfLabel}_`;
|
|
138
|
+
}
|
|
139
|
+
/** Prefix for element-owned children in a shared `.tf/out/` workspace. */
|
|
140
|
+
export function elementResourceLabelPrefix(elementTfLabel) {
|
|
141
|
+
return `elements_${elementTfLabel}_`;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Bare child label before scope prefix: `<ownerNs>_<childPart>` unless already qualified.
|
|
145
|
+
* Used ONLY by the element path, whose childPart already INCLUDES the namespace (element bag
|
|
146
|
+
* keys carry it), so the `startsWith` guard correctly avoids doubling. The app path must NOT
|
|
147
|
+
* use this — an app childPart omits the namespace and may legitimately begin with `<ns>_`
|
|
148
|
+
* (e.g. field `sourcingStatus` → `sourcing_status` under app `sourcing`), which the guard would
|
|
149
|
+
* misread as "already qualified", collapsing it onto the same label as a field named `status`
|
|
150
|
+
* (issue #115). Apps therefore always owner-prefix — see `appScopedResourceLabel`.
|
|
151
|
+
*/
|
|
152
|
+
export function ownerChildBareLabel(ownerTfLabel, childPart) {
|
|
153
|
+
return childPart.startsWith(`${ownerTfLabel}_`) ? childPart : `${ownerTfLabel}_${childPart}`;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* App-owned child resource label: `apps_<namespace>_<namespace>_<childPart>`, ALWAYS.
|
|
157
|
+
* An app childPart omits the namespace, so the owner prefix is prepended unconditionally to keep
|
|
158
|
+
* the encoding injective — `childPartFromScopedLabel` is its exact inverse (strips `apps_<ns>_`
|
|
159
|
+
* then one `<ns>_`). Never collapse when the childPart already starts with `<ns>_` (issue #115).
|
|
160
|
+
*/
|
|
161
|
+
export function appScopedResourceLabel(appTfLabel, childPart) {
|
|
162
|
+
return `${appResourceLabelPrefix(appTfLabel)}${appTfLabel}_${childPart}`;
|
|
163
|
+
}
|
|
164
|
+
/** Element-owned child resource label: `elements_<namespace>_<namespace>_<childPart>`. */
|
|
165
|
+
export function elementScopedResourceLabel(elementTfLabel, childPart) {
|
|
166
|
+
return `${elementResourceLabelPrefix(elementTfLabel)}${ownerChildBareLabel(elementTfLabel, childPart)}`;
|
|
167
|
+
}
|
|
168
|
+
/** Emit a scoped child label for the owning stream root kind. */
|
|
169
|
+
export function scopedResourceLabel(ownerTfLabel, childPart, scope) {
|
|
170
|
+
return scope === "app" ? appScopedResourceLabel(ownerTfLabel, childPart) : elementScopedResourceLabel(ownerTfLabel, childPart);
|
|
171
|
+
}
|
|
172
|
+
/** Strip a scoped child label back to its bare form (no-op when unprefixed). */
|
|
173
|
+
export function bareChildResourceLabel(ownerTfLabel, scopedLabel, scope = "app") {
|
|
174
|
+
const prefix = scope === "app" ? appResourceLabelPrefix(ownerTfLabel) : elementResourceLabelPrefix(ownerTfLabel);
|
|
175
|
+
return scopedLabel.startsWith(prefix) ? scopedLabel.slice(prefix.length) : scopedLabel;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Child part after the owner namespace — for apps, bag keys omit the namespace
|
|
179
|
+
* prefix; for elements, the bare label (which includes namespace) maps directly.
|
|
180
|
+
*
|
|
181
|
+
* The app branch strips `apps_<ns>_` then exactly one `<ns>_` — the exact inverse of
|
|
182
|
+
* `appScopedResourceLabel`'s always-double encoding (issue #115). The `startsWith` check is
|
|
183
|
+
* therefore always true for a well-formed app label; it is kept only to no-op on unprefixed input.
|
|
184
|
+
*/
|
|
185
|
+
export function childPartFromScopedLabel(ownerTfLabel, scopedLabel, scope) {
|
|
186
|
+
const bare = bareChildResourceLabel(ownerTfLabel, scopedLabel, scope);
|
|
187
|
+
if (scope === "app") {
|
|
188
|
+
const nsPrefix = `${ownerTfLabel}_`;
|
|
189
|
+
return bare.startsWith(nsPrefix) ? bare.slice(nsPrefix.length) : bare;
|
|
190
|
+
}
|
|
191
|
+
return bare;
|
|
192
|
+
}
|
|
193
|
+
/** Scoped terraform label → authoring bag key / ref key. */
|
|
194
|
+
export function scopedLabelToBagKey(ownerTfLabel, scopedLabel, scope = "app") {
|
|
195
|
+
return tfLabelToTsLabel(childPartFromScopedLabel(ownerTfLabel, scopedLabel, scope));
|
|
196
|
+
}
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
const EXPR_KINDS = new Set([
|
|
12
|
+
"resource-attr",
|
|
13
|
+
"data-attr",
|
|
14
|
+
"local",
|
|
15
|
+
"jsonencode",
|
|
16
|
+
"template",
|
|
17
|
+
"scoped-attr",
|
|
18
|
+
"for-object",
|
|
19
|
+
]);
|
|
20
|
+
export function isTfExpr(v) {
|
|
21
|
+
return (typeof v === "object" &&
|
|
22
|
+
v !== null &&
|
|
23
|
+
!Array.isArray(v) &&
|
|
24
|
+
typeof v.$expr === "string" &&
|
|
25
|
+
EXPR_KINDS.has(v.$expr));
|
|
26
|
+
}
|
|
27
|
+
export const expr = {
|
|
28
|
+
resourceAttr(type, label, path = []) {
|
|
29
|
+
return { $expr: "resource-attr", type, label, path };
|
|
30
|
+
},
|
|
31
|
+
dataAttr(type, label, path = []) {
|
|
32
|
+
return { $expr: "data-attr", type, label, path };
|
|
33
|
+
},
|
|
34
|
+
local(name, path = []) {
|
|
35
|
+
return { $expr: "local", name, path };
|
|
36
|
+
},
|
|
37
|
+
jsonencode(value) {
|
|
38
|
+
return { $expr: "jsonencode", value };
|
|
39
|
+
},
|
|
40
|
+
template(parts) {
|
|
41
|
+
return { $expr: "template", parts };
|
|
42
|
+
},
|
|
43
|
+
scopedAttr(name, path = []) {
|
|
44
|
+
return { $expr: "scoped-attr", name, path };
|
|
45
|
+
},
|
|
46
|
+
forObject(variable, collection, key, value) {
|
|
47
|
+
return { $expr: "for-object", variable, collection, key, value };
|
|
48
|
+
},
|
|
49
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* parseHcl: HCL text (an `ei ... export --stdout` stream or a built .tf
|
|
3
|
+
* file) → TfDocument. The ONLY parse entry point (plan §4.1).
|
|
4
|
+
*
|
|
5
|
+
* Built on @cdktf/hcl2json (HashiCorp's hcl2json compiled to WASM). Two
|
|
6
|
+
* facts from the spike shape this layer:
|
|
7
|
+
* - Expressions arrive verbatim as "${...}" strings → expr.ts owns them.
|
|
8
|
+
* - Plain number attributes cross JS floats, so integers beyond 2^53
|
|
9
|
+
* corrupt SILENTLY in the WASM layer — assertNoUnsafeIntegers scans the
|
|
10
|
+
* raw text first and loud-errors (platform ids are strings, so a hit
|
|
11
|
+
* means something new is going on → Pause).
|
|
12
|
+
*/
|
|
13
|
+
import type { TfDocument } from "./model.js";
|
|
14
|
+
type Hcl2JsonParser = (filename: string, contents: string) => Promise<Record<string, unknown>>;
|
|
15
|
+
/**
|
|
16
|
+
* The Bun executable installs an embedded-WASM parser before loading the CLI.
|
|
17
|
+
* Node/SDK consumers keep using the upstream package directly.
|
|
18
|
+
*
|
|
19
|
+
* This avoids importing @cdktf/hcl2json eagerly: its CommonJS bridge starts an
|
|
20
|
+
* asynchronous read of `join(__dirname, "..", "main.wasm.gz")` at module load.
|
|
21
|
+
* Bun freezes that package __dirname as the build machine's absolute path.
|
|
22
|
+
*/
|
|
23
|
+
export declare function installHcl2JsonRuntime(parser: Hcl2JsonParser): void;
|
|
24
|
+
export declare class TfParseError extends Error {
|
|
25
|
+
constructor(message: string);
|
|
26
|
+
}
|
|
27
|
+
export declare function parseHcl(text: string): Promise<TfDocument>;
|
|
28
|
+
/**
|
|
29
|
+
* Refuse to parse text whose integer literals exceed Number.MAX_SAFE_INTEGER —
|
|
30
|
+
* hcl2json would round them silently (verified: 2^53+1 → 2^53).
|
|
31
|
+
*
|
|
32
|
+
* Strings and comments are removed by ONE left-to-right scan in source
|
|
33
|
+
* order — two independent regex passes desynchronize when a comment
|
|
34
|
+
* contains an odd number of quotes (a real pattern in ei streams:
|
|
35
|
+
* `record_reference = "" # TODO … refs["ID"]`), which flipped code and
|
|
36
|
+
* string regions and made the guard both miss real literals and abort on
|
|
37
|
+
* string contents. Signs are part of the literal (`-9007199254740993`
|
|
38
|
+
* rounds just as silently as its positive twin).
|
|
39
|
+
*/
|
|
40
|
+
export declare function assertNoUnsafeIntegers(text: string): void;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* parseHcl: HCL text (an `ei ... export --stdout` stream or a built .tf
|
|
3
|
+
* file) → TfDocument. The ONLY parse entry point (plan §4.1).
|
|
4
|
+
*
|
|
5
|
+
* Built on @cdktf/hcl2json (HashiCorp's hcl2json compiled to WASM). Two
|
|
6
|
+
* facts from the spike shape this layer:
|
|
7
|
+
* - Expressions arrive verbatim as "${...}" strings → expr.ts owns them.
|
|
8
|
+
* - Plain number attributes cross JS floats, so integers beyond 2^53
|
|
9
|
+
* corrupt SILENTLY in the WASM layer — assertNoUnsafeIntegers scans the
|
|
10
|
+
* raw text first and loud-errors (platform ids are strings, so a hit
|
|
11
|
+
* means something new is going on → Pause).
|
|
12
|
+
*/
|
|
13
|
+
import { decodeTemplateEscapes } from "./escape.js";
|
|
14
|
+
import { parseStringValue, TfExprError } from "./expr.js";
|
|
15
|
+
let runtimeParser;
|
|
16
|
+
let packageParser;
|
|
17
|
+
const HCL2JSON_PACKAGE = `@cdktf/${"hcl2json"}`;
|
|
18
|
+
/**
|
|
19
|
+
* The Bun executable installs an embedded-WASM parser before loading the CLI.
|
|
20
|
+
* Node/SDK consumers keep using the upstream package directly.
|
|
21
|
+
*
|
|
22
|
+
* This avoids importing @cdktf/hcl2json eagerly: its CommonJS bridge starts an
|
|
23
|
+
* asynchronous read of `join(__dirname, "..", "main.wasm.gz")` at module load.
|
|
24
|
+
* Bun freezes that package __dirname as the build machine's absolute path.
|
|
25
|
+
*/
|
|
26
|
+
export function installHcl2JsonRuntime(parser) {
|
|
27
|
+
runtimeParser = parser;
|
|
28
|
+
}
|
|
29
|
+
async function parseWithHcl2Json(filename, contents) {
|
|
30
|
+
if (runtimeParser)
|
|
31
|
+
return runtimeParser(filename, contents);
|
|
32
|
+
packageParser ??= import(HCL2JSON_PACKAGE).then((module) => {
|
|
33
|
+
if (typeof module.parse !== "function") {
|
|
34
|
+
throw new Error(`${HCL2JSON_PACKAGE} does not export a parse function`);
|
|
35
|
+
}
|
|
36
|
+
return module.parse;
|
|
37
|
+
});
|
|
38
|
+
return (await packageParser)(filename, contents);
|
|
39
|
+
}
|
|
40
|
+
export class TfParseError extends Error {
|
|
41
|
+
constructor(message) {
|
|
42
|
+
super(message);
|
|
43
|
+
this.name = "TfParseError";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const KNOWN_TOP_LEVEL = new Set(["resource", "data", "locals", "import", "provider", "terraform"]);
|
|
47
|
+
export async function parseHcl(text) {
|
|
48
|
+
assertNoUnsafeIntegers(text);
|
|
49
|
+
let raw;
|
|
50
|
+
try {
|
|
51
|
+
raw = await parseWithHcl2Json("edk-parse.tf", text);
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
throw new TfParseError(`HCL parse failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
55
|
+
}
|
|
56
|
+
const blocks = [];
|
|
57
|
+
for (const key of Object.keys(raw)) {
|
|
58
|
+
if (!KNOWN_TOP_LEVEL.has(key)) {
|
|
59
|
+
throw new TfParseError(`unknown top-level block kind "${key}" — the closed dialect grew; extend the grammar deliberately`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// resource / data: { <type>: { <label>: [body, ...] } }
|
|
63
|
+
for (const kind of ["resource", "data"]) {
|
|
64
|
+
const byType = raw[kind];
|
|
65
|
+
if (!byType)
|
|
66
|
+
continue;
|
|
67
|
+
for (const [type, byLabel] of Object.entries(byType)) {
|
|
68
|
+
for (const [label, bodies] of Object.entries(byLabel)) {
|
|
69
|
+
for (const body of bodies) {
|
|
70
|
+
blocks.push({ kind, type, label, attrs: convertBody(body, `${kind}.${type}.${label}`) });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// locals / import: arrays of bodies
|
|
76
|
+
for (const kind of ["locals", "import"]) {
|
|
77
|
+
const bodies = raw[kind];
|
|
78
|
+
if (!bodies)
|
|
79
|
+
continue;
|
|
80
|
+
for (const body of bodies) {
|
|
81
|
+
blocks.push({ kind, attrs: convertBody(body, kind) });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// provider: { <name>: [body, ...] } ; terraform: [body, ...]
|
|
85
|
+
const providers = raw["provider"];
|
|
86
|
+
if (providers) {
|
|
87
|
+
for (const [name, bodies] of Object.entries(providers)) {
|
|
88
|
+
for (const body of bodies) {
|
|
89
|
+
blocks.push({ kind: "provider", label: name, attrs: convertBody(body, `provider.${name}`) });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const terraformBodies = raw["terraform"];
|
|
94
|
+
if (terraformBodies) {
|
|
95
|
+
for (const body of terraformBodies) {
|
|
96
|
+
blocks.push({ kind: "terraform", attrs: convertBody(body, "terraform") });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return { blocks };
|
|
100
|
+
}
|
|
101
|
+
function convertBody(body, ctx) {
|
|
102
|
+
if (typeof body !== "object" || body === null || Array.isArray(body)) {
|
|
103
|
+
throw new TfParseError(`unexpected block body shape at ${ctx}`);
|
|
104
|
+
}
|
|
105
|
+
const attrs = {};
|
|
106
|
+
for (const [key, value] of Object.entries(body)) {
|
|
107
|
+
attrs[key] = convertValue(value, `${ctx}.${key}`);
|
|
108
|
+
}
|
|
109
|
+
return attrs;
|
|
110
|
+
}
|
|
111
|
+
function convertValue(value, ctx) {
|
|
112
|
+
if (value === null)
|
|
113
|
+
return null;
|
|
114
|
+
if (typeof value === "boolean" || typeof value === "number")
|
|
115
|
+
return value;
|
|
116
|
+
if (typeof value === "string") {
|
|
117
|
+
try {
|
|
118
|
+
return parseStringValue(value);
|
|
119
|
+
}
|
|
120
|
+
catch (e) {
|
|
121
|
+
if (e instanceof TfExprError) {
|
|
122
|
+
throw new TfParseError(`at ${ctx}: ${e.message}`);
|
|
123
|
+
}
|
|
124
|
+
throw e;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (Array.isArray(value)) {
|
|
128
|
+
return value.map((v, i) => convertValue(v, `${ctx}[${i}]`));
|
|
129
|
+
}
|
|
130
|
+
if (typeof value === "object") {
|
|
131
|
+
const obj = {};
|
|
132
|
+
for (const [k, v] of Object.entries(value)) {
|
|
133
|
+
if (k === "$expr") {
|
|
134
|
+
// Mirror the jsonencode-payload guard: a plain map attribute with a
|
|
135
|
+
// literal $expr key would be misclassified as an expression later.
|
|
136
|
+
throw new TfParseError(`at ${ctx}: map key "$expr" collides with the expression tag`);
|
|
137
|
+
}
|
|
138
|
+
obj[decodeTemplateEscapes(k)] = convertValue(v, `${ctx}.${k}`);
|
|
139
|
+
}
|
|
140
|
+
return obj;
|
|
141
|
+
}
|
|
142
|
+
throw new TfParseError(`unsupported value type "${typeof value}" at ${ctx}`);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Refuse to parse text whose integer literals exceed Number.MAX_SAFE_INTEGER —
|
|
146
|
+
* hcl2json would round them silently (verified: 2^53+1 → 2^53).
|
|
147
|
+
*
|
|
148
|
+
* Strings and comments are removed by ONE left-to-right scan in source
|
|
149
|
+
* order — two independent regex passes desynchronize when a comment
|
|
150
|
+
* contains an odd number of quotes (a real pattern in ei streams:
|
|
151
|
+
* `record_reference = "" # TODO … refs["ID"]`), which flipped code and
|
|
152
|
+
* string regions and made the guard both miss real literals and abort on
|
|
153
|
+
* string contents. Signs are part of the literal (`-9007199254740993`
|
|
154
|
+
* rounds just as silently as its positive twin).
|
|
155
|
+
*/
|
|
156
|
+
export function assertNoUnsafeIntegers(text) {
|
|
157
|
+
const stripped = stripStringsAndComments(text);
|
|
158
|
+
for (const m of stripped.matchAll(/(?<![\w.-])-?\d{16,}(?![\w.])/g)) {
|
|
159
|
+
if (!Number.isSafeInteger(Number(m[0]))) {
|
|
160
|
+
throw new TfParseError(`integer literal ${m[0]} exceeds JavaScript's safe integer range; ` +
|
|
161
|
+
`parsing would silently corrupt it (platform ids are strings — this needs a human)`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/** One in-order scan: strings become `""`, line comments vanish. */
|
|
166
|
+
function stripStringsAndComments(text) {
|
|
167
|
+
let out = "";
|
|
168
|
+
let i = 0;
|
|
169
|
+
while (i < text.length) {
|
|
170
|
+
const c = text[i];
|
|
171
|
+
if (c === '"') {
|
|
172
|
+
let j = i + 1;
|
|
173
|
+
while (j < text.length && text[j] !== '"') {
|
|
174
|
+
j += text[j] === "\\" ? 2 : 1;
|
|
175
|
+
}
|
|
176
|
+
out += '""';
|
|
177
|
+
i = j + 1;
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
if (c === "#" || (c === "/" && text[i + 1] === "/")) {
|
|
181
|
+
while (i < text.length && text[i] !== "\n")
|
|
182
|
+
i++;
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
out += c;
|
|
186
|
+
i++;
|
|
187
|
+
}
|
|
188
|
+
return out;
|
|
189
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* renderDocument: TfDocument → HCL text. The single emitter (plan §4.1) —
|
|
3
|
+
* `elementum build` output and the round-trip check both flow through here.
|
|
4
|
+
*
|
|
5
|
+
* Formatting is OURS (deterministic, 2-space indent, attrs sorted
|
|
6
|
+
* alphabetically) — ei's incidental formatting is not replicated; the
|
|
7
|
+
* round-trip check is structural, both sides parsed by the same parser.
|
|
8
|
+
* The ei dialect is attributes-only (verified across real exports), so no
|
|
9
|
+
* nested-block syntax is emitted.
|
|
10
|
+
*/
|
|
11
|
+
import type { TfBlock, TfDocument } from "./model.js";
|
|
12
|
+
export declare function renderDocument(doc: TfDocument): string;
|
|
13
|
+
export declare function renderBlock(block: TfBlock): string;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* renderDocument: TfDocument → HCL text. The single emitter (plan §4.1) —
|
|
3
|
+
* `elementum build` output and the round-trip check both flow through here.
|
|
4
|
+
*
|
|
5
|
+
* Formatting is OURS (deterministic, 2-space indent, attrs sorted
|
|
6
|
+
* alphabetically) — ei's incidental formatting is not replicated; the
|
|
7
|
+
* round-trip check is structural, both sides parsed by the same parser.
|
|
8
|
+
* The ei dialect is attributes-only (verified across real exports), so no
|
|
9
|
+
* nested-block syntax is emitted.
|
|
10
|
+
*/
|
|
11
|
+
import { quoteHclString } from "./escape.js";
|
|
12
|
+
import { isTfExpr } from "./model.js";
|
|
13
|
+
export function renderDocument(doc) {
|
|
14
|
+
return doc.blocks.map(renderBlock).join("\n");
|
|
15
|
+
}
|
|
16
|
+
export function renderBlock(block) {
|
|
17
|
+
const header = blockHeader(block);
|
|
18
|
+
const body = Object.entries(block.attrs)
|
|
19
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
20
|
+
.map(([key, value]) => ` ${key} = ${renderValue(value, 1)}`)
|
|
21
|
+
.join("\n");
|
|
22
|
+
return `${header} {\n${body}\n}\n`;
|
|
23
|
+
}
|
|
24
|
+
function blockHeader(block) {
|
|
25
|
+
switch (block.kind) {
|
|
26
|
+
case "resource":
|
|
27
|
+
case "data":
|
|
28
|
+
return `${block.kind} ${quoteLabel(block.type)} ${quoteLabel(block.label)}`;
|
|
29
|
+
case "provider":
|
|
30
|
+
return `provider ${quoteLabel(block.label)}`;
|
|
31
|
+
case "locals":
|
|
32
|
+
case "import":
|
|
33
|
+
case "terraform":
|
|
34
|
+
return block.kind;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function quoteLabel(s) {
|
|
38
|
+
if (!s)
|
|
39
|
+
throw new Error("block is missing a required type/label");
|
|
40
|
+
return JSON.stringify(s);
|
|
41
|
+
}
|
|
42
|
+
function renderValue(value, depth) {
|
|
43
|
+
if (isTfExpr(value))
|
|
44
|
+
return renderExpr(value, depth);
|
|
45
|
+
if (value === null)
|
|
46
|
+
return "null";
|
|
47
|
+
if (typeof value === "boolean" || typeof value === "number")
|
|
48
|
+
return String(value);
|
|
49
|
+
if (typeof value === "string")
|
|
50
|
+
return quoteHclString(value);
|
|
51
|
+
const indent = " ".repeat(depth + 1);
|
|
52
|
+
const close = " ".repeat(depth);
|
|
53
|
+
if (Array.isArray(value)) {
|
|
54
|
+
if (value.length === 0)
|
|
55
|
+
return "[]";
|
|
56
|
+
const items = value.map((v) => `${indent}${renderValue(v, depth + 1)},`).join("\n");
|
|
57
|
+
return `[\n${items}\n${close}]`;
|
|
58
|
+
}
|
|
59
|
+
const entries = Object.entries(value);
|
|
60
|
+
if (entries.length === 0)
|
|
61
|
+
return "{}";
|
|
62
|
+
const body = entries
|
|
63
|
+
.map(([k, v]) => `${indent}${objectKey(k)} = ${renderValue(v, depth + 1)}`)
|
|
64
|
+
.join("\n");
|
|
65
|
+
return `{\n${body}\n${close}}`;
|
|
66
|
+
}
|
|
67
|
+
const BARE_KEY_RE = /^[A-Za-z_][A-Za-z0-9_-]*$/;
|
|
68
|
+
function objectKey(k) {
|
|
69
|
+
return BARE_KEY_RE.test(k) ? k : quoteHclString(k);
|
|
70
|
+
}
|
|
71
|
+
function renderExpr(e, depth) {
|
|
72
|
+
switch (e.$expr) {
|
|
73
|
+
case "resource-attr":
|
|
74
|
+
return `${e.type}.${e.label}${renderPath(e.path)}`;
|
|
75
|
+
case "data-attr":
|
|
76
|
+
return `data.${e.type}.${e.label}${renderPath(e.path)}`;
|
|
77
|
+
case "local":
|
|
78
|
+
return `local.${e.name}${renderPath(e.path)}`;
|
|
79
|
+
case "jsonencode":
|
|
80
|
+
return `jsonencode(${renderValue(e.value, depth)})`;
|
|
81
|
+
case "template": {
|
|
82
|
+
const inner = e.parts
|
|
83
|
+
.map((p) => (typeof p === "string" ? escapeTemplateLiteral(p) : `\${${renderExpr(p, depth)}}`))
|
|
84
|
+
.join("");
|
|
85
|
+
return `"${inner}"`;
|
|
86
|
+
}
|
|
87
|
+
case "scoped-attr":
|
|
88
|
+
return `${e.name}${renderPath(e.path)}`;
|
|
89
|
+
case "for-object":
|
|
90
|
+
return `{ for ${e.variable} in ${renderExpr(e.collection, depth)} : ${renderExpr(e.key, depth)} => ${renderExpr(e.value, depth)} }`;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function renderPath(path) {
|
|
94
|
+
return path
|
|
95
|
+
.map((seg) => (typeof seg === "string" ? `.${seg}` : `[${quoteHclString(seg.index)}]`))
|
|
96
|
+
.join("");
|
|
97
|
+
}
|
|
98
|
+
/** Literal text inside a template: quote-string escapes + template doubling, no outer quotes. */
|
|
99
|
+
function escapeTemplateLiteral(s) {
|
|
100
|
+
const quoted = quoteHclString(s);
|
|
101
|
+
return quoted.slice(1, -1);
|
|
102
|
+
}
|