@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,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regenerate the shared org catalog barrel (`generated/catalog.ts`): imports
|
|
3
|
+
* every app's, element's, and table's own per-entity `generated/catalog.ts`
|
|
4
|
+
* (written by `writeAppCatalog`/`writeAppCatalogFromAuthoring`) and exposes
|
|
5
|
+
* apps/elements flat plus tables under `catalog.tables`, alongside org
|
|
6
|
+
* connectors/cloud links. `import catalog from "@catalog"` gives
|
|
7
|
+
* `catalog.testingAles`, `catalog.tables.orders`,
|
|
8
|
+
* `catalog.connectors.claude`, etc.
|
|
9
|
+
*
|
|
10
|
+
* Elements and apps share the exact same per-entity catalog shape — an
|
|
11
|
+
* element just lives under `elements/<handle>/` instead of `apps/<handle>/`.
|
|
12
|
+
* There's nothing element-specific left in this file; it only needs to know
|
|
13
|
+
* where to look.
|
|
14
|
+
*
|
|
15
|
+
* Called by every import command that touches org state (importApp,
|
|
16
|
+
* importCloudLinks, importConnectors) so the catalog is always in sync.
|
|
17
|
+
*/
|
|
18
|
+
import { existsSync } from "node:fs";
|
|
19
|
+
import { readdir } from "node:fs/promises";
|
|
20
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
21
|
+
import { join } from "node:path";
|
|
22
|
+
import { ORG_IDENTITY_BAGS, orgRootOwnFileBags } from "../graph/index.js";
|
|
23
|
+
import { sdkPackageSpecifier } from "../internal/sdk-package.js";
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// Public entry points
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
export async function writeOrgCatalogFromExtract(root, extract) {
|
|
28
|
+
const genDir = join(root, "generated");
|
|
29
|
+
const catalogPath = join(genDir, "catalog.ts");
|
|
30
|
+
const orgPath = join(root, "org.ts");
|
|
31
|
+
const { appHandles, elementHandles, tableHandles } = await discoverOrgRootHandles(root);
|
|
32
|
+
await mkdir(genDir, { recursive: true });
|
|
33
|
+
await writeFile(orgPath, renderOrgTs(extract), "utf8");
|
|
34
|
+
await writeFile(catalogPath, renderBarrel(appHandles, elementHandles, tableHandles), "utf8");
|
|
35
|
+
return { catalogPath, orgPath };
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Rewrite generated/catalog.ts ALONE from the current file tree — org.ts is
|
|
39
|
+
* untouched (it belongs to `pull org`). Called after a pull writes new
|
|
40
|
+
* authoring (apps/agents) so `@catalog` resolves the fresh entries.
|
|
41
|
+
*/
|
|
42
|
+
export async function writeCatalogBarrel(root) {
|
|
43
|
+
const genDir = join(root, "generated");
|
|
44
|
+
const catalogPath = join(genDir, "catalog.ts");
|
|
45
|
+
const { appHandles, elementHandles, tableHandles } = await discoverOrgRootHandles(root);
|
|
46
|
+
await mkdir(genDir, { recursive: true });
|
|
47
|
+
await writeFile(catalogPath, renderBarrel(appHandles, elementHandles, tableHandles), "utf8");
|
|
48
|
+
return catalogPath;
|
|
49
|
+
}
|
|
50
|
+
/** Render generated/org.ts from the stream extract — bag/factory from CatalogFacet. */
|
|
51
|
+
function renderOrgTs(extract) {
|
|
52
|
+
const bags = ORG_IDENTITY_BAGS.flatMap((m) => {
|
|
53
|
+
if (!m.data.participates || m.data.orgBag === undefined || !m.catalog.participates)
|
|
54
|
+
return [];
|
|
55
|
+
const bag = m.data.orgBag;
|
|
56
|
+
const factory = m.catalog.factoryName ?? `${m.catalog.refKind}Ref`;
|
|
57
|
+
const entries = extract[bag];
|
|
58
|
+
if (entries.length === 0)
|
|
59
|
+
return [];
|
|
60
|
+
return [{ bag, factory, entries, order: m.catalog.renderOrder }];
|
|
61
|
+
}).sort((a, b) => a.order - b.order || a.bag.localeCompare(b.bag));
|
|
62
|
+
const factories = ["orgCatalog", ...bags.map((b) => b.factory)].sort();
|
|
63
|
+
const lines = [
|
|
64
|
+
"// Org reference identities from `elementum pull org --data-only` — refresh by re-running it.",
|
|
65
|
+
"// Each key IS the identity's terraform label in camelCase: tfLabel = tsLabelToTfLabel(key)",
|
|
66
|
+
"// (the lossless bijection in src/tf/labels.ts — the stable naming contract).",
|
|
67
|
+
`import { ${factories.join(", ")} } from "${sdkPackageSpecifier("catalog")}";`,
|
|
68
|
+
"",
|
|
69
|
+
"export const org = orgCatalog({",
|
|
70
|
+
];
|
|
71
|
+
for (const { bag, factory, entries } of bags) {
|
|
72
|
+
lines.push(` ${bag}: {`);
|
|
73
|
+
for (const e of entries) {
|
|
74
|
+
lines.push(` ${e.tsLabel}: ${factory}({ name: ${q(e.name)} }),`);
|
|
75
|
+
}
|
|
76
|
+
lines.push(" },");
|
|
77
|
+
}
|
|
78
|
+
lines.push("});", "");
|
|
79
|
+
return lines.join("\n");
|
|
80
|
+
}
|
|
81
|
+
/** Render generated/catalog.ts as a pure barrel over org.ts + disk-scanned catalogs. */
|
|
82
|
+
function renderBarrel(appHandles, elementHandles, tableHandles) {
|
|
83
|
+
const { elementKeys, tableImports, lines: importLines } = aspectImportLines(appHandles, elementHandles, tableHandles);
|
|
84
|
+
const lines = [
|
|
85
|
+
'import { org } from "../org.js";',
|
|
86
|
+
...importLines,
|
|
87
|
+
"",
|
|
88
|
+
"const catalog = {",
|
|
89
|
+
];
|
|
90
|
+
for (const h of appHandles)
|
|
91
|
+
lines.push(` ${h},`);
|
|
92
|
+
for (const h of elementHandles) {
|
|
93
|
+
const key = elementKeys.get(h);
|
|
94
|
+
lines.push(key === h ? ` ${h},` : ` ${key},`);
|
|
95
|
+
}
|
|
96
|
+
lines.push(" connectors: org.connectors,");
|
|
97
|
+
lines.push(" cloudLinks: org.cloudLinks,");
|
|
98
|
+
lines.push(" categories: org.categories,");
|
|
99
|
+
lines.push(" groups: org.groups,");
|
|
100
|
+
if (tableHandles.length > 0) {
|
|
101
|
+
lines.push(" tables: {");
|
|
102
|
+
for (const h of tableHandles)
|
|
103
|
+
lines.push(` ${safeKey(h)}: ${tableImports.get(h)},`);
|
|
104
|
+
lines.push(" },");
|
|
105
|
+
}
|
|
106
|
+
lines.push("};", "", "export { org };", "export type Ref = typeof catalog;", "export default catalog;", "");
|
|
107
|
+
return lines.join("\n");
|
|
108
|
+
}
|
|
109
|
+
/** Shared import-line rendering for the barrel (element collision + table alias rules). */
|
|
110
|
+
function aspectImportLines(appHandles, elementHandles, tableHandles) {
|
|
111
|
+
const used = new Set(appHandles);
|
|
112
|
+
const elementKeys = new Map();
|
|
113
|
+
for (const h of elementHandles) {
|
|
114
|
+
if (!used.has(h)) {
|
|
115
|
+
elementKeys.set(h, h);
|
|
116
|
+
used.add(h);
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
let i = 2;
|
|
120
|
+
let candidate = `${h}${i}`;
|
|
121
|
+
while (used.has(candidate)) {
|
|
122
|
+
i++;
|
|
123
|
+
candidate = `${h}${i}`;
|
|
124
|
+
}
|
|
125
|
+
elementKeys.set(h, candidate);
|
|
126
|
+
used.add(candidate);
|
|
127
|
+
console.error(`[elementum] warning: "${h}" names both an app and an element — the element is exposed as catalog.${candidate} (the app keeps catalog.${h}) to avoid a collision.`);
|
|
128
|
+
}
|
|
129
|
+
const tableImports = localTableNames(tableHandles, new Set([...appHandles, ...elementHandles.map((h) => `${h}$element`)]));
|
|
130
|
+
const lines = [];
|
|
131
|
+
for (const h of appHandles)
|
|
132
|
+
lines.push(`import { ${h} } from "../apps/${h}/generated/catalog.js";`);
|
|
133
|
+
for (const h of elementHandles) {
|
|
134
|
+
const key = elementKeys.get(h);
|
|
135
|
+
lines.push(key === h
|
|
136
|
+
? `import { ${h} } from "../elements/${h}/generated/catalog.js";`
|
|
137
|
+
: `import { ${h} as ${key} } from "../elements/${h}/generated/catalog.js";`);
|
|
138
|
+
}
|
|
139
|
+
for (const h of tableHandles)
|
|
140
|
+
lines.push(`import ${tableImports.get(h)} from "../tables/${h}/generated/catalog.js";`);
|
|
141
|
+
return { elementKeys, tableImports, lines };
|
|
142
|
+
}
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
// App / element / table handle discovery (dirs from orgRootOwnFileBags)
|
|
145
|
+
// ---------------------------------------------------------------------------
|
|
146
|
+
async function discoverHandles(root, subdir) {
|
|
147
|
+
const dir = join(root, subdir);
|
|
148
|
+
const handles = [];
|
|
149
|
+
try {
|
|
150
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
151
|
+
for (const e of entries) {
|
|
152
|
+
if (!e.isDirectory())
|
|
153
|
+
continue;
|
|
154
|
+
if (existsSync(join(dir, e.name, "generated", "catalog.ts"))) {
|
|
155
|
+
handles.push(e.name);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
catch { /* subdir doesn't exist yet — no handles */ }
|
|
160
|
+
return handles.sort();
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Scan org-root own-file bags from the graph. Apps/elements stay flat on the
|
|
164
|
+
* barrel; `tables` nests under `catalog.tables` (historical shape).
|
|
165
|
+
*/
|
|
166
|
+
async function discoverOrgRootHandles(root) {
|
|
167
|
+
const bags = new Set(orgRootOwnFileBags());
|
|
168
|
+
const appHandles = bags.has("apps") ? await discoverHandles(root, "apps") : [];
|
|
169
|
+
const elementHandles = bags.has("elements") ? await discoverHandles(root, "elements") : [];
|
|
170
|
+
const tableHandles = bags.has("tables") ? await discoverHandles(root, "tables") : [];
|
|
171
|
+
return { appHandles, elementHandles, tableHandles };
|
|
172
|
+
}
|
|
173
|
+
// ---------------------------------------------------------------------------
|
|
174
|
+
// Renderer
|
|
175
|
+
// ---------------------------------------------------------------------------
|
|
176
|
+
function q(s) {
|
|
177
|
+
return JSON.stringify(s);
|
|
178
|
+
}
|
|
179
|
+
const RESERVED_IDENT = new Set([
|
|
180
|
+
"break", "case", "catch", "class", "const", "continue", "debugger", "default",
|
|
181
|
+
"delete", "do", "else", "export", "extends", "false", "finally", "for",
|
|
182
|
+
"function", "if", "import", "in", "instanceof", "new", "null", "return",
|
|
183
|
+
"super", "switch", "this", "throw", "true", "try", "typeof", "var", "void",
|
|
184
|
+
"while", "with", "let", "static", "yield", "enum",
|
|
185
|
+
]);
|
|
186
|
+
function safeKey(name) {
|
|
187
|
+
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) && !RESERVED_IDENT.has(name)
|
|
188
|
+
? name
|
|
189
|
+
: q(name);
|
|
190
|
+
}
|
|
191
|
+
function localTableNames(handles, usedNames) {
|
|
192
|
+
const out = new Map();
|
|
193
|
+
for (const handle of handles) {
|
|
194
|
+
const base = `${identifierBase(handle)}$table`;
|
|
195
|
+
let candidate = base;
|
|
196
|
+
let n = 2;
|
|
197
|
+
while (usedNames.has(candidate) || RESERVED_IDENT.has(candidate)) {
|
|
198
|
+
candidate = `${base}${n}`;
|
|
199
|
+
n += 1;
|
|
200
|
+
}
|
|
201
|
+
usedNames.add(candidate);
|
|
202
|
+
out.set(handle, candidate);
|
|
203
|
+
}
|
|
204
|
+
return out;
|
|
205
|
+
}
|
|
206
|
+
function identifierBase(handle) {
|
|
207
|
+
const sanitized = handle.replace(/[^A-Za-z0-9_$]/g, "_");
|
|
208
|
+
if (sanitized === "")
|
|
209
|
+
return "_";
|
|
210
|
+
return /^[A-Za-z_$]/.test(sanitized) ? sanitized : `_${sanitized}`;
|
|
211
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entity-agnostic helpers for CatalogFacet.renderEntry implementations.
|
|
3
|
+
* Engine render.ts only dispatches; dialect lives on facets / deferred meta.
|
|
4
|
+
*/
|
|
5
|
+
import type { CatalogRenderResult } from "../graph/types.js";
|
|
6
|
+
/** Quote bag keys that are not safe bare identifiers. */
|
|
7
|
+
export declare function safeCatalogKey(name: string): string;
|
|
8
|
+
/** `key: factoryName(),` — agent/skill/empty automation style. */
|
|
9
|
+
export declare function bareFactoryEntry(factoryName: string, keyName: string, baseIndent: string): CatalogRenderResult;
|
|
10
|
+
export interface NamedFactoryEntryOpts {
|
|
11
|
+
readonly factoryName: string;
|
|
12
|
+
readonly keyName: string;
|
|
13
|
+
readonly baseIndent: string;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
/** When set, emit `parent: …`. Omit for appCatalog-injected kinds. */
|
|
16
|
+
readonly parent?: string;
|
|
17
|
+
/** Extra `key: value` fragments already formatted (e.g. `fieldType: "TEXT"`). */
|
|
18
|
+
readonly extraParts?: readonly string[];
|
|
19
|
+
readonly extraFactories?: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
/** `key: factoryName({ name, … }),` */
|
|
22
|
+
export declare function namedFactoryEntry(opts: NamedFactoryEntryOpts): CatalogRenderResult;
|
|
23
|
+
/** Narrow an unknown catalog ref to a name-bearing record. */
|
|
24
|
+
export declare function asNamedRef(ref: unknown): {
|
|
25
|
+
name: string;
|
|
26
|
+
parent?: string;
|
|
27
|
+
refName?: string;
|
|
28
|
+
};
|
|
29
|
+
/** `{ name }` only — org identity bags and similar. */
|
|
30
|
+
export declare function namedOnlyFactoryEntry(factoryName: string): (args: import("../graph/types.js").CatalogRenderArgs) => CatalogRenderResult;
|
|
31
|
+
/**
|
|
32
|
+
* `{ name }` with parent omitted — appCatalog injects parent from the root
|
|
33
|
+
* (fields, search tables).
|
|
34
|
+
*/
|
|
35
|
+
export declare function rootParentFactoryEntry(factoryName: string, extraParts?: (ref: unknown) => readonly string[]): (args: import("../graph/types.js").CatalogRenderArgs) => CatalogRenderResult;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entity-agnostic helpers for CatalogFacet.renderEntry implementations.
|
|
3
|
+
* Engine render.ts only dispatches; dialect lives on facets / deferred meta.
|
|
4
|
+
*/
|
|
5
|
+
const RESERVED_IDENT = new Set([
|
|
6
|
+
"break", "case", "catch", "class", "const", "continue", "debugger", "default",
|
|
7
|
+
"delete", "do", "else", "export", "extends", "false", "finally", "for",
|
|
8
|
+
"function", "if", "import", "in", "instanceof", "new", "null", "return",
|
|
9
|
+
"super", "switch", "this", "throw", "true", "try", "typeof", "var", "void",
|
|
10
|
+
"while", "with", "let", "static", "yield", "enum",
|
|
11
|
+
]);
|
|
12
|
+
/** Quote bag keys that are not safe bare identifiers. */
|
|
13
|
+
export function safeCatalogKey(name) {
|
|
14
|
+
if (!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) || RESERVED_IDENT.has(name)) {
|
|
15
|
+
return JSON.stringify(name);
|
|
16
|
+
}
|
|
17
|
+
return name;
|
|
18
|
+
}
|
|
19
|
+
/** `key: factoryName(),` — agent/skill/empty automation style. */
|
|
20
|
+
export function bareFactoryEntry(factoryName, keyName, baseIndent) {
|
|
21
|
+
return {
|
|
22
|
+
lines: [`${baseIndent}${safeCatalogKey(keyName)}: ${factoryName}(),`],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** `key: factoryName({ name, … }),` */
|
|
26
|
+
export function namedFactoryEntry(opts) {
|
|
27
|
+
const parts = [`name: ${JSON.stringify(opts.name)}`];
|
|
28
|
+
if (opts.parent !== undefined) {
|
|
29
|
+
parts.push(`parent: ${JSON.stringify(opts.parent)}`);
|
|
30
|
+
}
|
|
31
|
+
if (opts.extraParts !== undefined)
|
|
32
|
+
parts.push(...opts.extraParts);
|
|
33
|
+
return {
|
|
34
|
+
lines: [
|
|
35
|
+
`${opts.baseIndent}${safeCatalogKey(opts.keyName)}: ${opts.factoryName}({ ${parts.join(", ")} }),`,
|
|
36
|
+
],
|
|
37
|
+
extraFactories: opts.extraFactories,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** Narrow an unknown catalog ref to a name-bearing record. */
|
|
41
|
+
export function asNamedRef(ref) {
|
|
42
|
+
if (ref === null || typeof ref !== "object") {
|
|
43
|
+
throw new Error("catalog renderEntry expected an object ref");
|
|
44
|
+
}
|
|
45
|
+
const r = ref;
|
|
46
|
+
if (typeof r.name !== "string") {
|
|
47
|
+
throw new Error("catalog renderEntry expected ref.name: string");
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
name: r.name,
|
|
51
|
+
parent: typeof r.parent === "string" ? r.parent : undefined,
|
|
52
|
+
refName: typeof r.refName === "string" ? r.refName : undefined,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** `{ name }` only — org identity bags and similar. */
|
|
56
|
+
export function namedOnlyFactoryEntry(factoryName) {
|
|
57
|
+
return (args) => {
|
|
58
|
+
const named = asNamedRef(args.ref);
|
|
59
|
+
return namedFactoryEntry({
|
|
60
|
+
factoryName,
|
|
61
|
+
keyName: args.keyName,
|
|
62
|
+
baseIndent: args.baseIndent,
|
|
63
|
+
name: named.name,
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* `{ name }` with parent omitted — appCatalog injects parent from the root
|
|
69
|
+
* (fields, search tables).
|
|
70
|
+
*/
|
|
71
|
+
export function rootParentFactoryEntry(factoryName, extraParts) {
|
|
72
|
+
return (args) => {
|
|
73
|
+
const named = asNamedRef(args.ref);
|
|
74
|
+
return namedFactoryEntry({
|
|
75
|
+
factoryName,
|
|
76
|
+
keyName: args.keyName,
|
|
77
|
+
baseIndent: args.baseIndent,
|
|
78
|
+
name: named.name,
|
|
79
|
+
extraParts: extraParts?.(args.ref),
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure rendering for the v2 catalog.
|
|
3
|
+
*
|
|
4
|
+
* `renderCatalog` is the canonical renderer: it produces a single flat
|
|
5
|
+
* TypeScript file per catalog root (app, element, or org). Per-kind emission
|
|
6
|
+
* dialect lives on CatalogFacet.renderEntry (and deferred graph meta) — this
|
|
7
|
+
* file only orchestrates imports, bag order, and indentation.
|
|
8
|
+
*/
|
|
9
|
+
import type { CatalogRef, CatalogRefKind } from "./types.js";
|
|
10
|
+
/** Identity of the catalog root the file represents. */
|
|
11
|
+
export interface BarrelRoot {
|
|
12
|
+
readonly kind: "app" | "element" | "org";
|
|
13
|
+
readonly refName: string;
|
|
14
|
+
readonly name: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Render a single flat catalog file. App/element catalogs use `appCatalog()` /
|
|
18
|
+
* `elementCatalog()` so `__kind` stays inside the factory. The org catalog uses
|
|
19
|
+
* `orgCatalog()`. Behavioral kinds (automation/agent) have their own entity
|
|
20
|
+
* files — their refs land here too, but the caller sources them by calling
|
|
21
|
+
* `.ref()` on each entity file's `defineX(...)` result
|
|
22
|
+
* (`src/catalog/from-authoring.ts`), not from server-side import data.
|
|
23
|
+
*
|
|
24
|
+
* @deprecated `automationTriggerKinds` is no longer used — pass nothing or omit.
|
|
25
|
+
*/
|
|
26
|
+
export declare function renderCatalog(root: BarrelRoot, refs: readonly CatalogRef[], _automationTriggerKinds?: Map<string, string>): string;
|
|
27
|
+
/** One entry the barrel imports and aggregates. */
|
|
28
|
+
export interface BarrelEntry {
|
|
29
|
+
readonly kind: CatalogRefKind;
|
|
30
|
+
readonly refName: string;
|
|
31
|
+
readonly importPath: string;
|
|
32
|
+
}
|
|
33
|
+
/** @deprecated Use renderCatalog instead. */
|
|
34
|
+
export declare function renderFragment(ref: CatalogRef): string;
|
|
35
|
+
/** @deprecated Use renderCatalog instead. */
|
|
36
|
+
export declare function renderBarrel(root: BarrelRoot, entries: readonly BarrelEntry[]): string;
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure rendering for the v2 catalog.
|
|
3
|
+
*
|
|
4
|
+
* `renderCatalog` is the canonical renderer: it produces a single flat
|
|
5
|
+
* TypeScript file per catalog root (app, element, or org). Per-kind emission
|
|
6
|
+
* dialect lives on CatalogFacet.renderEntry (and deferred graph meta) — this
|
|
7
|
+
* file only orchestrates imports, bag order, and indentation.
|
|
8
|
+
*/
|
|
9
|
+
import { catalogKindsForRoot, catalogBagForRefKind, } from "../graph/index.js";
|
|
10
|
+
import { sdkPackageSpecifier } from "../internal/sdk-package.js";
|
|
11
|
+
import { safeCatalogKey } from "./render-helpers.js";
|
|
12
|
+
function bagName(kind) {
|
|
13
|
+
const bag = catalogBagForRefKind(kind);
|
|
14
|
+
if (bag === undefined) {
|
|
15
|
+
throw new Error(`catalog bag name unknown for ref kind "${kind}" — register a CatalogFacet or deferred meta`);
|
|
16
|
+
}
|
|
17
|
+
return bag;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Render a single flat catalog file. App/element catalogs use `appCatalog()` /
|
|
21
|
+
* `elementCatalog()` so `__kind` stays inside the factory. The org catalog uses
|
|
22
|
+
* `orgCatalog()`. Behavioral kinds (automation/agent) have their own entity
|
|
23
|
+
* files — their refs land here too, but the caller sources them by calling
|
|
24
|
+
* `.ref()` on each entity file's `defineX(...)` result
|
|
25
|
+
* (`src/catalog/from-authoring.ts`), not from server-side import data.
|
|
26
|
+
*
|
|
27
|
+
* @deprecated `automationTriggerKinds` is no longer used — pass nothing or omit.
|
|
28
|
+
*/
|
|
29
|
+
export function renderCatalog(root, refs, _automationTriggerKinds) {
|
|
30
|
+
const isApp = root.kind === "app" || root.kind === "element";
|
|
31
|
+
// Graph CatalogFacet (+ deferred meta) drives which kinds belong on this root
|
|
32
|
+
// and their emission order — no hard-wired KIND_ORDER / bag lists here.
|
|
33
|
+
const usedMeta = catalogKindsForRoot(root.kind).filter((m) => refs.some((r) => r.__kind === m.refKind));
|
|
34
|
+
const factoryNames = new Set();
|
|
35
|
+
if (isApp) {
|
|
36
|
+
factoryNames.add(root.kind === "element" ? "elementCatalog" : "appCatalog");
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
factoryNames.add("orgCatalog");
|
|
40
|
+
}
|
|
41
|
+
for (const m of usedMeta)
|
|
42
|
+
factoryNames.add(m.factoryName);
|
|
43
|
+
const entryIndent = isApp ? " " : " ";
|
|
44
|
+
for (const m of usedMeta) {
|
|
45
|
+
const kindRefs = refs.filter((r) => r.__kind === m.refKind);
|
|
46
|
+
for (const ref of kindRefs) {
|
|
47
|
+
const rendered = m.renderEntry({
|
|
48
|
+
ref,
|
|
49
|
+
keyName: ref.refName,
|
|
50
|
+
baseIndent: entryIndent,
|
|
51
|
+
});
|
|
52
|
+
for (const f of rendered.extraFactories ?? [])
|
|
53
|
+
factoryNames.add(f);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const lines = [];
|
|
57
|
+
lines.push(`import { ${[...factoryNames].sort().join(", ")} } from "${sdkPackageSpecifier("catalog")}";`);
|
|
58
|
+
lines.push("");
|
|
59
|
+
if (isApp) {
|
|
60
|
+
const catalogFn = root.kind === "element" ? "elementCatalog" : "appCatalog";
|
|
61
|
+
lines.push(`export const ${root.refName} = ${catalogFn}(`);
|
|
62
|
+
lines.push(` { refName: ${JSON.stringify(root.refName)}, name: ${JSON.stringify(root.name)} },`);
|
|
63
|
+
lines.push(` {`);
|
|
64
|
+
for (const m of usedMeta) {
|
|
65
|
+
const bag = bagName(m.refKind);
|
|
66
|
+
const kindRefs = refs
|
|
67
|
+
.filter((r) => r.__kind === m.refKind)
|
|
68
|
+
.sort((a, b) => a.refName.localeCompare(b.refName));
|
|
69
|
+
lines.push(` ${bag}: {`);
|
|
70
|
+
for (const ref of kindRefs) {
|
|
71
|
+
const rendered = m.renderEntry({
|
|
72
|
+
ref,
|
|
73
|
+
keyName: ref.refName,
|
|
74
|
+
baseIndent: entryIndent,
|
|
75
|
+
});
|
|
76
|
+
lines.push(...rendered.lines);
|
|
77
|
+
}
|
|
78
|
+
lines.push(` },`);
|
|
79
|
+
}
|
|
80
|
+
lines.push(` },`);
|
|
81
|
+
lines.push(`);`);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
lines.push(`export const org = orgCatalog({`);
|
|
85
|
+
for (const m of usedMeta) {
|
|
86
|
+
const bag = bagName(m.refKind);
|
|
87
|
+
const kindRefs = refs
|
|
88
|
+
.filter((r) => r.__kind === m.refKind)
|
|
89
|
+
.sort((a, b) => a.refName.localeCompare(b.refName));
|
|
90
|
+
lines.push(` ${bag}: {`);
|
|
91
|
+
for (const ref of kindRefs) {
|
|
92
|
+
const rendered = m.renderEntry({
|
|
93
|
+
ref,
|
|
94
|
+
keyName: ref.refName,
|
|
95
|
+
baseIndent: entryIndent,
|
|
96
|
+
});
|
|
97
|
+
lines.push(...rendered.lines);
|
|
98
|
+
}
|
|
99
|
+
lines.push(` },`);
|
|
100
|
+
}
|
|
101
|
+
lines.push(`});`);
|
|
102
|
+
lines.push("");
|
|
103
|
+
lines.push(`export type Ref = typeof org;`);
|
|
104
|
+
}
|
|
105
|
+
lines.push("");
|
|
106
|
+
return lines.join("\n");
|
|
107
|
+
}
|
|
108
|
+
/** @deprecated Use renderCatalog instead. */
|
|
109
|
+
export function renderFragment(ref) {
|
|
110
|
+
const lines = [
|
|
111
|
+
`export const ${ref.refName} = {`,
|
|
112
|
+
` __kind: ${JSON.stringify(ref.__kind)},`,
|
|
113
|
+
` refName: ${JSON.stringify(ref.refName)},`,
|
|
114
|
+
` name: ${JSON.stringify(ref.name)},`,
|
|
115
|
+
];
|
|
116
|
+
if (ref.parent !== undefined)
|
|
117
|
+
lines.push(` parent: ${JSON.stringify(ref.parent)},`);
|
|
118
|
+
if (ref.__kind === "field") {
|
|
119
|
+
const field = ref;
|
|
120
|
+
lines.push(` fieldType: ${JSON.stringify(field.fieldType)},`);
|
|
121
|
+
if (field.tags !== undefined) {
|
|
122
|
+
lines.push(` tags: ${JSON.stringify(field.tags)},`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (ref.__kind === "automation") {
|
|
126
|
+
lines.push(...renderMemberBag("trigger", ref.trigger));
|
|
127
|
+
lines.push(...renderMemberBag("outputs", ref.outputs));
|
|
128
|
+
}
|
|
129
|
+
lines.push(`} as const;`, "");
|
|
130
|
+
return lines.join("\n");
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Render a nested ref bag (`trigger` / `outputs`) inside an automation fragment:
|
|
134
|
+
* `bag: { <key>: { __kind, refName, name, parent }, … }`. Keys are sorted for
|
|
135
|
+
* byte-stability; an empty/absent bag emits nothing.
|
|
136
|
+
*/
|
|
137
|
+
function renderMemberBag(bag, members) {
|
|
138
|
+
const keys = Object.keys(members ?? {}).sort();
|
|
139
|
+
if (keys.length === 0)
|
|
140
|
+
return [];
|
|
141
|
+
const entries = keys.map((key) => {
|
|
142
|
+
const m = members[key];
|
|
143
|
+
const parts = [
|
|
144
|
+
`__kind: ${JSON.stringify(m.__kind)}`,
|
|
145
|
+
`refName: ${JSON.stringify(m.refName)}`,
|
|
146
|
+
`name: ${JSON.stringify(m.name)}`,
|
|
147
|
+
...(m.parent !== undefined ? [`parent: ${JSON.stringify(m.parent)}`] : []),
|
|
148
|
+
];
|
|
149
|
+
return ` ${safeCatalogKey(key)}: { ${parts.join(", ")} },`;
|
|
150
|
+
});
|
|
151
|
+
return [` ${bag}: {`, ...entries, ` },`];
|
|
152
|
+
}
|
|
153
|
+
/** @deprecated Use renderCatalog instead. */
|
|
154
|
+
export function renderBarrel(root, entries) {
|
|
155
|
+
const imports = [...entries]
|
|
156
|
+
.sort((a, b) => (a.importPath < b.importPath ? -1 : a.importPath > b.importPath ? 1 : 0))
|
|
157
|
+
.map((e) => `import { ${e.refName} } from ${JSON.stringify(e.importPath)};`);
|
|
158
|
+
const lines = [];
|
|
159
|
+
if (imports.length > 0)
|
|
160
|
+
lines.push(...imports, "");
|
|
161
|
+
lines.push(`export const ${root.refName} = {`);
|
|
162
|
+
lines.push(` __kind: ${JSON.stringify(root.kind)},`);
|
|
163
|
+
lines.push(` refName: ${JSON.stringify(root.refName)},`);
|
|
164
|
+
lines.push(` name: ${JSON.stringify(root.name)},`);
|
|
165
|
+
for (const meta of catalogKindsForRoot(root.kind)) {
|
|
166
|
+
const refNames = entries
|
|
167
|
+
.filter((e) => e.kind === meta.refKind)
|
|
168
|
+
.map((e) => e.refName)
|
|
169
|
+
.sort();
|
|
170
|
+
if (refNames.length === 0)
|
|
171
|
+
continue;
|
|
172
|
+
lines.push(` ${meta.catalogBag}: { ${refNames.join(", ")} },`);
|
|
173
|
+
}
|
|
174
|
+
lines.push(`} as const;`, "");
|
|
175
|
+
return lines.join("\n");
|
|
176
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** True when `v` is a catalog ref token (`__kind ∈ REF_SCOPE` + a string refName). */
|
|
2
|
+
export declare function isCatalogToken(v: unknown): boolean;
|
|
3
|
+
/** Reduce a catalog token to its canonical fields (dropping barrel bags etc.). */
|
|
4
|
+
export declare function slimToken(token: Record<string, unknown>): Record<string, unknown>;
|
|
5
|
+
/**
|
|
6
|
+
* Deep-walk `node`, replacing every catalog token with its slim canonical form.
|
|
7
|
+
* Non-token objects/arrays are recursed; scalars pass through. Tokens are not
|
|
8
|
+
* recursed into (their bags are dropped wholesale).
|
|
9
|
+
*/
|
|
10
|
+
export declare function slimTokens(node: unknown): unknown;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Catalog-token helpers shared by the v2 builders.
|
|
3
|
+
*
|
|
4
|
+
* A reference embedded in an entity payload should be the **canonical token**
|
|
5
|
+
* (`{ __kind, refName, name, parent? }`) and nothing more — just enough for
|
|
6
|
+
* `resolvePayload` to swap it for an id at deploy. But the natural thing to pass
|
|
7
|
+
* for an aspect ref is the barrel *root* object (`incidents`), which also
|
|
8
|
+
* carries every bag (`automations`, `fields`, …). Embedding that verbatim bloats
|
|
9
|
+
* the stored baseline and makes diffs unreadable. {@link slimTokens} walks a
|
|
10
|
+
* payload and reduces every catalog token to its canonical fields, leaving
|
|
11
|
+
* non-token values untouched.
|
|
12
|
+
*/
|
|
13
|
+
import { REF_SCOPE } from "./types.js";
|
|
14
|
+
/** True when `v` is a catalog ref token (`__kind ∈ REF_SCOPE` + a string refName). */
|
|
15
|
+
export function isCatalogToken(v) {
|
|
16
|
+
if (typeof v !== "object" || v === null)
|
|
17
|
+
return false;
|
|
18
|
+
const rec = v;
|
|
19
|
+
return (typeof rec.__kind === "string" &&
|
|
20
|
+
rec.__kind in REF_SCOPE &&
|
|
21
|
+
typeof rec.refName === "string");
|
|
22
|
+
}
|
|
23
|
+
/** Reduce a catalog token to its canonical fields (dropping barrel bags etc.). */
|
|
24
|
+
export function slimToken(token) {
|
|
25
|
+
const out = {
|
|
26
|
+
__kind: token.__kind,
|
|
27
|
+
refName: token.refName,
|
|
28
|
+
};
|
|
29
|
+
if (typeof token.name === "string")
|
|
30
|
+
out.name = token.name;
|
|
31
|
+
if (token.parent !== undefined)
|
|
32
|
+
out.parent = token.parent;
|
|
33
|
+
// The terraform path derives a field's resource type from its authoring
|
|
34
|
+
// type — canonical field metadata, not a barrel bag.
|
|
35
|
+
if (token.__kind === "field" && typeof token.fieldType === "string")
|
|
36
|
+
out.fieldType = token.fieldType;
|
|
37
|
+
if ((token.__kind === "field" || token.__kind === "tableColumn") && Array.isArray(token.tags)) {
|
|
38
|
+
out.tags = token.tags.filter((tag) => typeof tag === "string");
|
|
39
|
+
}
|
|
40
|
+
else if ((token.__kind === "field" || token.__kind === "tableColumn") && Array.isArray(token.semanticTags)) {
|
|
41
|
+
out.tags = token.semanticTags.filter((tag) => typeof tag === "string");
|
|
42
|
+
}
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Deep-walk `node`, replacing every catalog token with its slim canonical form.
|
|
47
|
+
* Non-token objects/arrays are recursed; scalars pass through. Tokens are not
|
|
48
|
+
* recursed into (their bags are dropped wholesale).
|
|
49
|
+
*/
|
|
50
|
+
export function slimTokens(node) {
|
|
51
|
+
if (isCatalogToken(node))
|
|
52
|
+
return slimToken(node);
|
|
53
|
+
if (Array.isArray(node))
|
|
54
|
+
return node.map(slimTokens);
|
|
55
|
+
if (node !== null && typeof node === "object") {
|
|
56
|
+
const out = {};
|
|
57
|
+
for (const [k, v] of Object.entries(node))
|
|
58
|
+
out[k] = slimTokens(v);
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
return node;
|
|
62
|
+
}
|