@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,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
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface AuthoringTenantContext {
|
|
2
|
+
/** Organization slug from `ei auth` (folder basename). */
|
|
3
|
+
readonly organization: string;
|
|
4
|
+
/** Instance slug from `ei auth` (e.g. `eu`, `us`, `dev`). */
|
|
5
|
+
readonly instance: string;
|
|
6
|
+
}
|
|
7
|
+
/** Walk up from `startDir` to the nearest directory that contains `tsconfig.json`. */
|
|
8
|
+
export declare function findOrgWorkspaceByTsconfig(startDir: string): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Validate a path relative to the org workspace root (posix-style segments).
|
|
11
|
+
* Example: `elements/tag/tag.ts`, `apps/incident/automations/triage.ts`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function assertRelativeAuthoringPath(relPath: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* Org root directory must be `<org>` or `<instance>/<org>` for this tenant.
|
|
16
|
+
*/
|
|
17
|
+
export declare function assertOrgRootMatchesTenant(orgRoot: string, tenant: AuthoringTenantContext): void;
|
|
18
|
+
/**
|
|
19
|
+
* Absolute paths of org workspaces allowed for this auth tenant under `cwd`:
|
|
20
|
+
* `<org>` and `<instance>/<org>`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function approvedOrgWorkspaceRoots(tenant: AuthoringTenantContext, cwd?: string): string[];
|
|
23
|
+
/**
|
|
24
|
+
* Full plan/apply path gate.
|
|
25
|
+
*
|
|
26
|
+
* 1. Resolve org workspace via nearest `tsconfig.json`
|
|
27
|
+
* 2. Relative path from that root must be a complete valid authoring path
|
|
28
|
+
* 3. Org workspace folder must match authenticated org/instance
|
|
29
|
+
*/
|
|
30
|
+
export declare function assertAuthoringPathForTenant(file: string, tenant: AuthoringTenantContext): void;
|
|
31
|
+
/**
|
|
32
|
+
* Layout-only check for discovery without a tenant context (tests).
|
|
33
|
+
* Prefers validating relative to the nearest `tsconfig.json` org root; falls
|
|
34
|
+
* back to requiring a valid `apps|elements/…` suffix in the absolute path.
|
|
35
|
+
*/
|
|
36
|
+
export declare function assertValidAuthoringLayout(file: string): void;
|
|
37
|
+
/** @deprecated Use {@link assertAuthoringPathForTenant}. */
|
|
38
|
+
export declare function assertUnderAuthenticatedOrgWorkspace(file: string, tenant: AuthoringTenantContext): void;
|
|
39
|
+
/** Build tenant path context from active `ei auth`. */
|
|
40
|
+
export declare function authoringTenantFromEiAuth(auth: {
|
|
41
|
+
readonly organization: string;
|
|
42
|
+
readonly instance: string;
|
|
43
|
+
}): AuthoringTenantContext;
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authoring-path validation for plan/apply.
|
|
3
|
+
*
|
|
4
|
+
* Workspace root = nearest ancestor directory that contains `tsconfig.json`
|
|
5
|
+
* (the org root written by `elementum import org`).
|
|
6
|
+
*
|
|
7
|
+
* From that root, the relative path must be fully valid for the authenticated
|
|
8
|
+
* tenant:
|
|
9
|
+
*
|
|
10
|
+
* elements/<ref>/<ref>.ts
|
|
11
|
+
* apps/<ref>/<ref>.ts
|
|
12
|
+
* tables/<ref>/<ref>.ts
|
|
13
|
+
* {apps|elements}/<ref>/{automations,agents,…}/<name>.ts
|
|
14
|
+
*
|
|
15
|
+
* The org root itself must match auth:
|
|
16
|
+
* <org>/ or
|
|
17
|
+
* <instance>/<org>/ (e.g. eu/sanofi)
|
|
18
|
+
*/
|
|
19
|
+
import { existsSync } from "node:fs";
|
|
20
|
+
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
21
|
+
import { ENTITY_KIND_MODULES, ownFileBagsUnder } from "../../graph/index.js";
|
|
22
|
+
/** Org-root aspect bags from graph nodes parented by org with streamRoot + ownFile. */
|
|
23
|
+
const ASPECT_ROOTS = new Set(ENTITY_KIND_MODULES.flatMap((m) => {
|
|
24
|
+
if (m.stream.role !== "streamRoot" || m.authoring.unit !== "ownFile")
|
|
25
|
+
return [];
|
|
26
|
+
if (!m.parents.some((e) => e.parent === "org"))
|
|
27
|
+
return [];
|
|
28
|
+
return [m.authoring.bag];
|
|
29
|
+
}));
|
|
30
|
+
/**
|
|
31
|
+
* Child bags under apps|elements: union of own-file bags under app/element,
|
|
32
|
+
* plus legacy authoring dirs not yet registered as graph kinds (flows, …).
|
|
33
|
+
*/
|
|
34
|
+
const LEGACY_CHILD_BAGS = ["flows", "approval-chains", "tables", "fileReaders"];
|
|
35
|
+
const CHILD_BAGS = new Set([
|
|
36
|
+
...ownFileBagsUnder("app"),
|
|
37
|
+
...ownFileBagsUnder("element"),
|
|
38
|
+
...LEGACY_CHILD_BAGS,
|
|
39
|
+
]);
|
|
40
|
+
/** Instance folder names used in multi-instance parent workspaces. */
|
|
41
|
+
const INSTANCE_FOLDER_NAMES = new Set(["us", "eu", "stage", "dev", "local"]);
|
|
42
|
+
/** Walk up from `startDir` to the nearest directory that contains `tsconfig.json`. */
|
|
43
|
+
export function findOrgWorkspaceByTsconfig(startDir) {
|
|
44
|
+
let cur = resolve(startDir);
|
|
45
|
+
while (true) {
|
|
46
|
+
if (existsSync(join(cur, "tsconfig.json")))
|
|
47
|
+
return cur;
|
|
48
|
+
const parent = dirname(cur);
|
|
49
|
+
if (parent === cur)
|
|
50
|
+
return undefined;
|
|
51
|
+
cur = parent;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Validate a path relative to the org workspace root (posix-style segments).
|
|
56
|
+
* Example: `elements/tag/tag.ts`, `apps/incident/automations/triage.ts`.
|
|
57
|
+
*/
|
|
58
|
+
export function assertRelativeAuthoringPath(relPath) {
|
|
59
|
+
const rel = relPath.split(/[/\\]/).filter((p) => p && p !== ".").join("/");
|
|
60
|
+
if (rel === "" || rel.includes("..")) {
|
|
61
|
+
throw new Error(`Authoring path must be inside the org workspace: ${relPath}`);
|
|
62
|
+
}
|
|
63
|
+
const parts = rel.split("/");
|
|
64
|
+
const file = parts[parts.length - 1];
|
|
65
|
+
if (!/\.(ts|js|mjs)$/.test(file) || file.endsWith(".d.ts") || file.endsWith(".test.ts")) {
|
|
66
|
+
throw new Error(`Not an entity source file: ${relPath}`);
|
|
67
|
+
}
|
|
68
|
+
if (file.startsWith("_")) {
|
|
69
|
+
throw new Error(`Not an entity source file: ${relPath}`);
|
|
70
|
+
}
|
|
71
|
+
const stem = file.replace(/\.(ts|js|mjs)$/, "");
|
|
72
|
+
const bag = parts[0];
|
|
73
|
+
// Org-owned table root (graph: table.authoring.bag) — special-cased path shape.
|
|
74
|
+
if (bag === "tables") {
|
|
75
|
+
if (parts.length === 3) {
|
|
76
|
+
const refFolder = parts[1];
|
|
77
|
+
if (refFolder !== stem) {
|
|
78
|
+
throw new Error(`Table file must be tables/${refFolder}/${refFolder}.ts, got ${rel}`);
|
|
79
|
+
}
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (parts.length === 2) {
|
|
83
|
+
throw new Error(`Flat authoring path is not allowed (${bag}/${stem}.ts). ` +
|
|
84
|
+
`Use ${bag}/${stem}/${stem}.ts instead.`);
|
|
85
|
+
}
|
|
86
|
+
throw new Error(`Org-owned table authoring path must be tables/<ref>/<ref>.ts, got: ${rel}`);
|
|
87
|
+
}
|
|
88
|
+
if (!bag || !ASPECT_ROOTS.has(bag)) {
|
|
89
|
+
throw new Error(`Authoring file must live under apps/<ref>/, elements/<ref>/, or tables/<ref>/ (from org workspace root), got: ${rel}`);
|
|
90
|
+
}
|
|
91
|
+
// apps|elements / <ref> / <ref>.ts
|
|
92
|
+
if (parts.length === 3) {
|
|
93
|
+
const refFolder = parts[1];
|
|
94
|
+
if (refFolder !== stem) {
|
|
95
|
+
throw new Error(`Aspect file must be ${bag}/${refFolder}/${refFolder}.ts, got ${rel}`);
|
|
96
|
+
}
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
// apps|elements / <ref> / <bag> / <name>.ts
|
|
100
|
+
if (parts.length === 4) {
|
|
101
|
+
const childBag = parts[2];
|
|
102
|
+
if (!CHILD_BAGS.has(childBag)) {
|
|
103
|
+
throw new Error(`Unknown bag "${childBag}" under ${bag}/${parts[1]}/ — expected one of ${[...CHILD_BAGS].join(", ")}`);
|
|
104
|
+
}
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (parts.length === 2) {
|
|
108
|
+
throw new Error(`Flat authoring path is not allowed (${bag}/${stem}.ts). ` +
|
|
109
|
+
`Use ${bag}/${stem}/${stem}.ts instead.`);
|
|
110
|
+
}
|
|
111
|
+
throw new Error(`Authoring path is too deep or malformed: ${rel}`);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Org root directory must be `<org>` or `<instance>/<org>` for this tenant.
|
|
115
|
+
*/
|
|
116
|
+
export function assertOrgRootMatchesTenant(orgRoot, tenant) {
|
|
117
|
+
const orgSlug = tenant.organization.trim().toLowerCase();
|
|
118
|
+
const instanceSlug = tenant.instance.trim().toLowerCase();
|
|
119
|
+
if (orgSlug === "" || instanceSlug === "") {
|
|
120
|
+
throw new Error("ei auth instance and organization are required to validate authoring paths.");
|
|
121
|
+
}
|
|
122
|
+
const root = resolve(orgRoot);
|
|
123
|
+
const base = basename(root).toLowerCase();
|
|
124
|
+
const parent = basename(dirname(root)).toLowerCase();
|
|
125
|
+
if (base !== orgSlug) {
|
|
126
|
+
throw new Error(`Org workspace folder must be "${orgSlug}" (ei auth organization), got "${base}" (${root})`);
|
|
127
|
+
}
|
|
128
|
+
if (INSTANCE_FOLDER_NAMES.has(parent) && parent !== instanceSlug) {
|
|
129
|
+
throw new Error(`Org workspace is under instance folder "${parent}" but ei auth instance is "${instanceSlug}" (${root})`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Absolute paths of org workspaces allowed for this auth tenant under `cwd`:
|
|
134
|
+
* `<org>` and `<instance>/<org>`.
|
|
135
|
+
*/
|
|
136
|
+
export function approvedOrgWorkspaceRoots(tenant, cwd = process.cwd()) {
|
|
137
|
+
const org = tenant.organization.trim();
|
|
138
|
+
const instance = tenant.instance.trim();
|
|
139
|
+
if (org === "" || instance === "")
|
|
140
|
+
return [];
|
|
141
|
+
return [resolve(cwd, instance, org)];
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Full plan/apply path gate.
|
|
145
|
+
*
|
|
146
|
+
* 1. Resolve org workspace via nearest `tsconfig.json`
|
|
147
|
+
* 2. Relative path from that root must be a complete valid authoring path
|
|
148
|
+
* 3. Org workspace folder must match authenticated org/instance
|
|
149
|
+
*/
|
|
150
|
+
export function assertAuthoringPathForTenant(file, tenant) {
|
|
151
|
+
const abs = resolve(file);
|
|
152
|
+
const orgRoot = findOrgWorkspaceByTsconfig(dirname(abs));
|
|
153
|
+
if (orgRoot === undefined) {
|
|
154
|
+
throw new Error(`No org workspace (tsconfig.json) found above ${abs}`);
|
|
155
|
+
}
|
|
156
|
+
const rel = relative(orgRoot, abs);
|
|
157
|
+
if (rel.startsWith("..") || isAbsolute(rel)) {
|
|
158
|
+
throw new Error(`Authoring file is outside org workspace ${orgRoot}: ${abs}`);
|
|
159
|
+
}
|
|
160
|
+
assertRelativeAuthoringPath(rel);
|
|
161
|
+
assertOrgRootMatchesTenant(orgRoot, tenant);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Layout-only check for discovery without a tenant context (tests).
|
|
165
|
+
* Prefers validating relative to the nearest `tsconfig.json` org root; falls
|
|
166
|
+
* back to requiring a valid `apps|elements/…` suffix in the absolute path.
|
|
167
|
+
*/
|
|
168
|
+
export function assertValidAuthoringLayout(file) {
|
|
169
|
+
const abs = resolve(file);
|
|
170
|
+
const orgRoot = findOrgWorkspaceByTsconfig(dirname(abs));
|
|
171
|
+
if (orgRoot !== undefined) {
|
|
172
|
+
const rel = relative(orgRoot, abs);
|
|
173
|
+
if (!rel.startsWith("..") && !isAbsolute(rel)) {
|
|
174
|
+
assertRelativeAuthoringPath(rel);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
// No tsconfig above the file — still reject obviously flat/misplaced paths
|
|
179
|
+
// by inspecting the absolute path's apps|elements|tables suffix.
|
|
180
|
+
const parts = abs.replace(/\.(ts|js|mjs)$/, "").split(sep);
|
|
181
|
+
const idx = Math.max(parts.lastIndexOf("apps"), parts.lastIndexOf("elements"), parts.lastIndexOf("tables"));
|
|
182
|
+
if (idx === -1) {
|
|
183
|
+
throw new Error(`Authoring file must live under an org workspace with tsconfig.json ` +
|
|
184
|
+
`(apps/<ref>/, elements/<ref>/, or tables/<ref>/): ${abs}`);
|
|
185
|
+
}
|
|
186
|
+
const suffix = parts.slice(idx).join("/");
|
|
187
|
+
assertRelativeAuthoringPath(`${suffix}.ts`);
|
|
188
|
+
}
|
|
189
|
+
/** @deprecated Use {@link assertAuthoringPathForTenant}. */
|
|
190
|
+
export function assertUnderAuthenticatedOrgWorkspace(file, tenant) {
|
|
191
|
+
assertAuthoringPathForTenant(file, tenant);
|
|
192
|
+
}
|
|
193
|
+
/** Build tenant path context from active `ei auth`. */
|
|
194
|
+
export function authoringTenantFromEiAuth(auth) {
|
|
195
|
+
const organization = auth.organization.trim();
|
|
196
|
+
const instance = auth.instance.trim();
|
|
197
|
+
if (organization === "" || instance === "") {
|
|
198
|
+
throw new Error("ei auth instance and organization are required.");
|
|
199
|
+
}
|
|
200
|
+
return { organization, instance };
|
|
201
|
+
}
|