@elementumai/edk 0.0.0-oidc-bootstrap → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +462 -3
- package/dist-sdk/elementum-entity-client/clients/agents/models/agent-tool.d.ts +188 -0
- package/dist-sdk/elementum-entity-client/clients/agents/models/agent-tool.js +20 -0
- package/dist-sdk/elementum-entity-client/clients/agents/models/agent.d.ts +245 -0
- package/dist-sdk/elementum-entity-client/clients/agents/models/agent.js +30 -0
- package/dist-sdk/elementum-entity-client/clients/ai-provider-connectors/models/ai-provider-connector.d.ts +18 -0
- package/dist-sdk/elementum-entity-client/clients/ai-provider-connectors/models/ai-provider-connector.js +8 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/aspect.d.ts +718 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/aspect.js +52 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/field-base.d.ts +23 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/field-base.js +1 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/field-types.d.ts +148 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/field-types.js +12 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/format.d.ts +63 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/format.js +17 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/index.d.ts +39 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/index.js +35 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/picklist-config.d.ts +116 -0
- package/dist-sdk/elementum-entity-client/clients/aspects/models/picklist-config.js +11 -0
- package/dist-sdk/elementum-entity-client/clients/automation/models/automation.d.ts +178 -0
- package/dist-sdk/elementum-entity-client/clients/automation/models/automation.js +18 -0
- package/dist-sdk/elementum-entity-client/clients/document-models/models/document-model.d.ts +200 -0
- package/dist-sdk/elementum-entity-client/clients/document-models/models/document-model.js +1 -0
- package/dist-sdk/elementum-entity-client/clients/search-tables/models/index.d.ts +1 -0
- package/dist-sdk/elementum-entity-client/clients/search-tables/models/index.js +1 -0
- package/dist-sdk/elementum-entity-client/clients/search-tables/models/search-table-wire.d.ts +141 -0
- package/dist-sdk/elementum-entity-client/clients/search-tables/models/search-table-wire.js +22 -0
- package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.d.ts +123 -0
- package/dist-sdk/elementum-entity-client/clients/skills/models/skill-tool.js +14 -0
- package/dist-sdk/elementum-entity-client/clients/skills/models/skill.d.ts +78 -0
- package/dist-sdk/elementum-entity-client/clients/skills/models/skill.js +23 -0
- package/dist-sdk/elementum-entity-client/clients/tables/models/index.d.ts +1 -0
- package/dist-sdk/elementum-entity-client/clients/tables/models/index.js +1 -0
- package/dist-sdk/elementum-entity-client/clients/tables/models/table-wire.d.ts +265 -0
- package/dist-sdk/elementum-entity-client/clients/tables/models/table-wire.js +15 -0
- package/dist-sdk/elementum-entity-client/errors.d.ts +90 -0
- package/dist-sdk/elementum-entity-client/errors.js +111 -0
- package/dist-sdk/elementum-entity-client/models/connection.d.ts +30 -0
- package/dist-sdk/elementum-entity-client/models/connection.js +16 -0
- package/dist-sdk/elementum-entity-client/types.d.ts +71 -0
- package/dist-sdk/elementum-entity-client/types.js +1 -0
- package/dist-sdk/fs/entity.d.ts +104 -0
- package/dist-sdk/fs/entity.js +52 -0
- package/dist-sdk/pull/util.d.ts +130 -0
- package/dist-sdk/pull/util.js +204 -0
- package/dist-sdk/src/catalog/ai-provider-models.d.ts +30 -0
- package/dist-sdk/src/catalog/ai-provider-models.js +63 -0
- package/dist-sdk/src/catalog/factories.d.ts +242 -0
- package/dist-sdk/src/catalog/factories.js +265 -0
- package/dist-sdk/src/catalog/from-authoring.d.ts +103 -0
- package/dist-sdk/src/catalog/from-authoring.js +467 -0
- package/dist-sdk/src/catalog/index.d.ts +12 -0
- package/dist-sdk/src/catalog/index.js +12 -0
- package/dist-sdk/src/catalog/org.d.ts +11 -0
- package/dist-sdk/src/catalog/org.js +288 -0
- package/dist-sdk/src/catalog/render-helpers.d.ts +35 -0
- package/dist-sdk/src/catalog/render-helpers.js +82 -0
- package/dist-sdk/src/catalog/render.d.ts +48 -0
- package/dist-sdk/src/catalog/render.js +193 -0
- package/dist-sdk/src/catalog/token.d.ts +10 -0
- package/dist-sdk/src/catalog/token.js +76 -0
- package/dist-sdk/src/catalog/types.d.ts +215 -0
- package/dist-sdk/src/catalog/types.js +86 -0
- package/dist-sdk/src/catalog/write.d.ts +43 -0
- package/dist-sdk/src/catalog/write.js +109 -0
- package/dist-sdk/src/core/app-to-ui.d.ts +22 -0
- package/dist-sdk/src/core/app-to-ui.js +75 -0
- package/dist-sdk/src/core/index.d.ts +10 -0
- package/dist-sdk/src/core/index.js +9 -0
- package/dist-sdk/src/core/system-fields.d.ts +95 -0
- package/dist-sdk/src/core/system-fields.js +153 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +144 -0
- package/dist-sdk/src/core/triggers/on-demand.js +112 -0
- package/dist-sdk/src/core/types/ai-provider.d.ts +23 -0
- package/dist-sdk/src/core/types/ai-provider.js +8 -0
- package/dist-sdk/src/core/types/app.d.ts +857 -0
- package/dist-sdk/src/core/types/app.js +210 -0
- package/dist-sdk/src/core/types/aspect-category.d.ts +35 -0
- package/dist-sdk/src/core/types/aspect-category.js +33 -0
- package/dist-sdk/src/core/types/cloud-link.d.ts +34 -0
- package/dist-sdk/src/core/types/cloud-link.js +32 -0
- package/dist-sdk/src/core/types/display-block.d.ts +149 -0
- package/dist-sdk/src/core/types/display-block.js +61 -0
- package/dist-sdk/src/core/types/group.d.ts +13 -0
- package/dist-sdk/src/core/types/group.js +6 -0
- package/dist-sdk/src/core/types/platform.d.ts +2 -0
- package/dist-sdk/src/core/types/platform.js +1 -0
- package/dist-sdk/src/core/types/user.d.ts +20 -0
- package/dist-sdk/src/core/types/user.js +8 -0
- package/dist-sdk/src/core/wire/ref-serializer.d.ts +45 -0
- package/dist-sdk/src/core/wire/ref-serializer.js +89 -0
- package/dist-sdk/src/engine/build/context.d.ts +67 -0
- package/dist-sdk/src/engine/build/context.js +6 -0
- package/dist-sdk/src/engine/build/source-context.d.ts +45 -0
- package/dist-sdk/src/engine/build/source-context.js +23 -0
- package/dist-sdk/src/engine/entity.d.ts +44 -0
- package/dist-sdk/src/engine/entity.js +15 -0
- package/dist-sdk/src/engine/pull/context.d.ts +38 -0
- package/dist-sdk/src/engine/pull/context.js +44 -0
- package/dist-sdk/src/engine/pull/org.d.ts +54 -0
- package/dist-sdk/src/engine/pull/org.js +134 -0
- package/dist-sdk/src/engine/tf/escape.d.ts +22 -0
- package/dist-sdk/src/engine/tf/escape.js +28 -0
- package/dist-sdk/src/engine/tf/expr.d.ts +25 -0
- package/dist-sdk/src/engine/tf/expr.js +405 -0
- package/dist-sdk/src/engine/tf/index.d.ts +12 -0
- package/dist-sdk/src/engine/tf/index.js +11 -0
- package/dist-sdk/src/engine/tf/labels.d.ts +76 -0
- package/dist-sdk/src/engine/tf/labels.js +196 -0
- package/dist-sdk/src/engine/tf/model.d.ts +84 -0
- package/dist-sdk/src/engine/tf/model.js +49 -0
- package/dist-sdk/src/engine/tf/parse.d.ts +41 -0
- package/dist-sdk/src/engine/tf/parse.js +189 -0
- package/dist-sdk/src/engine/tf/render.d.ts +13 -0
- package/dist-sdk/src/engine/tf/render.js +102 -0
- package/dist-sdk/src/engine/workspace/authoring-layout.d.ts +43 -0
- package/dist-sdk/src/engine/workspace/authoring-layout.js +201 -0
- package/dist-sdk/src/entities/access-policy/build.d.ts +26 -0
- package/dist-sdk/src/entities/access-policy/build.js +7 -0
- package/dist-sdk/src/entities/access-policy/filter.d.ts +61 -0
- package/dist-sdk/src/entities/access-policy/filter.js +83 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +48 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +189 -0
- package/dist-sdk/src/entities/access-policy/module.d.ts +3 -0
- package/dist-sdk/src/entities/access-policy/module.js +17 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +36 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +149 -0
- package/dist-sdk/src/entities/access-policy/types.d.ts +4 -0
- package/dist-sdk/src/entities/access-policy/types.js +10 -0
- package/dist-sdk/src/entities/agent/build.d.ts +108 -0
- package/dist-sdk/src/entities/agent/build.js +148 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +53 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +344 -0
- package/dist-sdk/src/entities/agent/from-tf.d.ts +65 -0
- package/dist-sdk/src/entities/agent/from-tf.js +289 -0
- package/dist-sdk/src/entities/agent/index.d.ts +7 -0
- package/dist-sdk/src/entities/agent/index.js +7 -0
- package/dist-sdk/src/entities/agent/module.d.ts +4 -0
- package/dist-sdk/src/entities/agent/module.js +122 -0
- package/dist-sdk/src/entities/agent/to-tf.d.ts +33 -0
- package/dist-sdk/src/entities/agent/to-tf.js +188 -0
- package/dist-sdk/src/entities/agent/tools.d.ts +284 -0
- package/dist-sdk/src/entities/agent/tools.js +238 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +110 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +265 -0
- package/dist-sdk/src/entities/agent-tool/module.d.ts +3 -0
- package/dist-sdk/src/entities/agent-tool/module.js +32 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +40 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +250 -0
- package/dist-sdk/src/entities/agent-tool/types.d.ts +43 -0
- package/dist-sdk/src/entities/agent-tool/types.js +102 -0
- package/dist-sdk/src/entities/app/build.d.ts +368 -0
- package/dist-sdk/src/entities/app/build.js +372 -0
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +168 -0
- package/dist-sdk/src/entities/app/deserializer/normalize.js +12 -0
- package/dist-sdk/src/entities/app/display-blocks.d.ts +26 -0
- package/dist-sdk/src/entities/app/display-blocks.js +34 -0
- package/dist-sdk/src/entities/app/from-tf.d.ts +23 -0
- package/dist-sdk/src/entities/app/from-tf.js +197 -0
- package/dist-sdk/src/entities/app/index.d.ts +14 -0
- package/dist-sdk/src/entities/app/index.js +11 -0
- package/dist-sdk/src/entities/app/locals.d.ts +11 -0
- package/dist-sdk/src/entities/app/locals.js +31 -0
- package/dist-sdk/src/entities/app/module.d.ts +4 -0
- package/dist-sdk/src/entities/app/module.js +66 -0
- package/dist-sdk/src/entities/app/to-tf.d.ts +33 -0
- package/dist-sdk/src/entities/app/to-tf.js +212 -0
- package/dist-sdk/src/entities/approval-chain/build.d.ts +24 -0
- package/dist-sdk/src/entities/approval-chain/build.js +56 -0
- package/dist-sdk/src/entities/approval-chain/index.d.ts +6 -0
- package/dist-sdk/src/entities/approval-chain/index.js +6 -0
- package/dist-sdk/src/entities/approval-chain/steps.d.ts +24 -0
- package/dist-sdk/src/entities/approval-chain/steps.js +20 -0
- package/dist-sdk/src/entities/automation/build.d.ts +259 -0
- package/dist-sdk/src/entities/automation/build.js +436 -0
- package/dist-sdk/src/entities/automation/catalog-render.d.ts +5 -0
- package/dist-sdk/src/entities/automation/catalog-render.js +35 -0
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +152 -0
- package/dist-sdk/src/entities/automation/deserializer/ast.js +13 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +55 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +1176 -0
- package/dist-sdk/src/entities/automation/filter.d.ts +93 -0
- package/dist-sdk/src/entities/automation/filter.js +156 -0
- package/dist-sdk/src/entities/automation/from-tf.d.ts +35 -0
- package/dist-sdk/src/entities/automation/from-tf.js +1258 -0
- package/dist-sdk/src/entities/automation/index.d.ts +22 -0
- package/dist-sdk/src/entities/automation/index.js +25 -0
- package/dist-sdk/src/entities/automation/module.d.ts +3 -0
- package/dist-sdk/src/entities/automation/module.js +150 -0
- package/dist-sdk/src/entities/automation/operators.d.ts +93 -0
- package/dist-sdk/src/entities/automation/operators.js +69 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +19 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +24 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +51 -0
- package/dist-sdk/src/entities/automation/script-code.js +633 -0
- package/dist-sdk/src/entities/automation/serialize.d.ts +6 -0
- package/dist-sdk/src/entities/automation/serialize.js +41 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +641 -0
- package/dist-sdk/src/entities/automation/tasks.js +765 -0
- package/dist-sdk/src/entities/automation/to-tf.d.ts +19 -0
- package/dist-sdk/src/entities/automation/to-tf.js +1169 -0
- package/dist-sdk/src/entities/automation/triggers.d.ts +205 -0
- package/dist-sdk/src/entities/automation/triggers.js +202 -0
- package/dist-sdk/src/entities/automation/types.d.ts +78 -0
- package/dist-sdk/src/entities/automation/types.js +131 -0
- package/dist-sdk/src/entities/element/build.d.ts +121 -0
- package/dist-sdk/src/entities/element/build.js +110 -0
- package/dist-sdk/src/entities/element/from-tf.d.ts +19 -0
- package/dist-sdk/src/entities/element/from-tf.js +170 -0
- package/dist-sdk/src/entities/element/index.d.ts +12 -0
- package/dist-sdk/src/entities/element/index.js +10 -0
- package/dist-sdk/src/entities/element/locals.d.ts +7 -0
- package/dist-sdk/src/entities/element/locals.js +12 -0
- package/dist-sdk/src/entities/element/module.d.ts +8 -0
- package/dist-sdk/src/entities/element/module.js +65 -0
- package/dist-sdk/src/entities/element/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/element/to-tf.js +169 -0
- package/dist-sdk/src/entities/field/build.d.ts +112 -0
- package/dist-sdk/src/entities/field/build.js +84 -0
- package/dist-sdk/src/entities/field/calc/aggregate.d.ts +60 -0
- package/dist-sdk/src/entities/field/calc/aggregate.js +71 -0
- package/dist-sdk/src/entities/field/calc/date.d.ts +73 -0
- package/dist-sdk/src/entities/field/calc/date.js +109 -0
- package/dist-sdk/src/entities/field/calc/index.d.ts +229 -0
- package/dist-sdk/src/entities/field/calc/index.js +433 -0
- package/dist-sdk/src/entities/field/calc/numeric.d.ts +22 -0
- package/dist-sdk/src/entities/field/calc/numeric.js +67 -0
- package/dist-sdk/src/entities/field/calc/runtime.d.ts +61 -0
- package/dist-sdk/src/entities/field/calc/runtime.js +174 -0
- package/dist-sdk/src/entities/field/calc/text.d.ts +100 -0
- package/dist-sdk/src/entities/field/calc/text.js +208 -0
- package/dist-sdk/src/entities/field/calc/types.d.ts +86 -0
- package/dist-sdk/src/entities/field/calc/types.js +23 -0
- package/dist-sdk/src/entities/field/calc.d.ts +108 -0
- package/dist-sdk/src/entities/field/calc.js +54 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +31 -0
- package/dist-sdk/src/entities/field/from-tf.js +184 -0
- package/dist-sdk/src/entities/field/locals.d.ts +8 -0
- package/dist-sdk/src/entities/field/locals.js +24 -0
- package/dist-sdk/src/entities/field/module.d.ts +3 -0
- package/dist-sdk/src/entities/field/module.js +50 -0
- package/dist-sdk/src/entities/field/options.d.ts +27 -0
- package/dist-sdk/src/entities/field/options.js +76 -0
- package/dist-sdk/src/entities/field/record-shape.d.ts +57 -0
- package/dist-sdk/src/entities/field/record-shape.js +1 -0
- package/dist-sdk/src/entities/field/to-tf.d.ts +73 -0
- package/dist-sdk/src/entities/field/to-tf.js +142 -0
- package/dist-sdk/src/entities/field/types.d.ts +53 -0
- package/dist-sdk/src/entities/field/types.js +68 -0
- package/dist-sdk/src/entities/file-reader/build.d.ts +182 -0
- package/dist-sdk/src/entities/file-reader/build.js +105 -0
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +6 -0
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +109 -0
- package/dist-sdk/src/entities/file-reader/from-tf.d.ts +13 -0
- package/dist-sdk/src/entities/file-reader/from-tf.js +172 -0
- package/dist-sdk/src/entities/file-reader/index.d.ts +10 -0
- package/dist-sdk/src/entities/file-reader/index.js +10 -0
- package/dist-sdk/src/entities/file-reader/module.d.ts +3 -0
- package/dist-sdk/src/entities/file-reader/module.js +115 -0
- package/dist-sdk/src/entities/file-reader/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/file-reader/to-tf.js +84 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +32 -0
- package/dist-sdk/src/entities/file-reader/types.js +30 -0
- package/dist-sdk/src/entities/flow/activities/agent.d.ts +15 -0
- package/dist-sdk/src/entities/flow/activities/agent.js +29 -0
- package/dist-sdk/src/entities/flow/activities/approval.d.ts +9 -0
- package/dist-sdk/src/entities/flow/activities/approval.js +18 -0
- package/dist-sdk/src/entities/flow/activities/automation.d.ts +12 -0
- package/dist-sdk/src/entities/flow/activities/automation.js +22 -0
- package/dist-sdk/src/entities/flow/activities/ctx.d.ts +34 -0
- package/dist-sdk/src/entities/flow/activities/ctx.js +38 -0
- package/dist-sdk/src/entities/flow/activities/form.d.ts +22 -0
- package/dist-sdk/src/entities/flow/activities/form.js +36 -0
- package/dist-sdk/src/entities/flow/activities/index.d.ts +14 -0
- package/dist-sdk/src/entities/flow/activities/index.js +13 -0
- package/dist-sdk/src/entities/flow/activities/input-refs.d.ts +39 -0
- package/dist-sdk/src/entities/flow/activities/input-refs.js +19 -0
- package/dist-sdk/src/entities/flow/activities/prompt-template.d.ts +13 -0
- package/dist-sdk/src/entities/flow/activities/prompt-template.js +34 -0
- package/dist-sdk/src/entities/flow/activities/render-catalog.d.ts +140 -0
- package/dist-sdk/src/entities/flow/activities/render-catalog.js +174 -0
- package/dist-sdk/src/entities/flow/activities/types.d.ts +33 -0
- package/dist-sdk/src/entities/flow/activities/types.js +1 -0
- package/dist-sdk/src/entities/flow/build.d.ts +38 -0
- package/dist-sdk/src/entities/flow/build.js +115 -0
- package/dist-sdk/src/entities/flow/index.d.ts +8 -0
- package/dist-sdk/src/entities/flow/index.js +7 -0
- package/dist-sdk/src/entities/flow/serialize.d.ts +51 -0
- package/dist-sdk/src/entities/flow/serialize.js +94 -0
- package/dist-sdk/src/entities/flow/util.d.ts +27 -0
- package/dist-sdk/src/entities/flow/util.js +38 -0
- package/dist-sdk/src/entities/org/ai-provider.d.ts +13 -0
- package/dist-sdk/src/entities/org/ai-provider.js +46 -0
- package/dist-sdk/src/entities/org/category.d.ts +5 -0
- package/dist-sdk/src/entities/org/category.js +33 -0
- package/dist-sdk/src/entities/org/cloud-link.d.ts +5 -0
- package/dist-sdk/src/entities/org/cloud-link.js +33 -0
- package/dist-sdk/src/entities/org/connector.d.ts +12 -0
- package/dist-sdk/src/entities/org/connector.js +35 -0
- package/dist-sdk/src/entities/org/group.d.ts +5 -0
- package/dist-sdk/src/entities/org/group.js +40 -0
- package/dist-sdk/src/entities/org/index.d.ts +11 -0
- package/dist-sdk/src/entities/org/index.js +11 -0
- package/dist-sdk/src/entities/org/role.d.ts +7 -0
- package/dist-sdk/src/entities/org/role.js +21 -0
- package/dist-sdk/src/entities/org/user.d.ts +7 -0
- package/dist-sdk/src/entities/org/user.js +30 -0
- package/dist-sdk/src/entities/search-table/build.d.ts +41 -0
- package/dist-sdk/src/entities/search-table/build.js +79 -0
- package/dist-sdk/src/entities/search-table/index.d.ts +5 -0
- package/dist-sdk/src/entities/search-table/index.js +5 -0
- package/dist-sdk/src/entities/search-table/module.d.ts +6 -0
- package/dist-sdk/src/entities/search-table/module.js +64 -0
- package/dist-sdk/src/entities/shared/context.d.ts +93 -0
- package/dist-sdk/src/entities/shared/context.js +156 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +277 -0
- package/dist-sdk/src/entities/shared/filters/ast.js +65 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +211 -0
- package/dist-sdk/src/entities/shared/filters/index.js +372 -0
- package/dist-sdk/src/entities/shared/filters/types.d.ts +170 -0
- package/dist-sdk/src/entities/shared/filters/types.js +7 -0
- package/dist-sdk/src/entities/shared/ref.d.ts +160 -0
- package/dist-sdk/src/entities/shared/ref.js +119 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +17 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +31 -0
- package/dist-sdk/src/entities/shared/types/common.d.ts +106 -0
- package/dist-sdk/src/entities/shared/types/common.js +64 -0
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +58 -0
- package/dist-sdk/src/entities/shared/types/field-types.js +57 -0
- package/dist-sdk/src/entities/shared/types/platform.d.ts +46 -0
- package/dist-sdk/src/entities/shared/types/platform.js +10 -0
- package/dist-sdk/src/entities/skill/build.d.ts +25 -0
- package/dist-sdk/src/entities/skill/build.js +50 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +39 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +124 -0
- package/dist-sdk/src/entities/skill/from-tf.d.ts +33 -0
- package/dist-sdk/src/entities/skill/from-tf.js +96 -0
- package/dist-sdk/src/entities/skill/index.d.ts +7 -0
- package/dist-sdk/src/entities/skill/index.js +7 -0
- package/dist-sdk/src/entities/skill/module.d.ts +4 -0
- package/dist-sdk/src/entities/skill/module.js +111 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +33 -0
- package/dist-sdk/src/entities/skill/to-tf.js +59 -0
- package/dist-sdk/src/entities/skill/tools.d.ts +93 -0
- package/dist-sdk/src/entities/skill/tools.js +105 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +60 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +142 -0
- package/dist-sdk/src/entities/skill-tool/module.d.ts +3 -0
- package/dist-sdk/src/entities/skill-tool/module.js +21 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +34 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +130 -0
- package/dist-sdk/src/entities/skill-tool/types.d.ts +40 -0
- package/dist-sdk/src/entities/skill-tool/types.js +67 -0
- package/dist-sdk/src/entities/table/build.d.ts +74 -0
- package/dist-sdk/src/entities/table/build.js +339 -0
- package/dist-sdk/src/entities/table/catalog-render.d.ts +5 -0
- package/dist-sdk/src/entities/table/catalog-render.js +39 -0
- package/dist-sdk/src/entities/table/fields.d.ts +81 -0
- package/dist-sdk/src/entities/table/fields.js +70 -0
- package/dist-sdk/src/entities/table/filter.d.ts +41 -0
- package/dist-sdk/src/entities/table/filter.js +89 -0
- package/dist-sdk/src/entities/table/index.d.ts +8 -0
- package/dist-sdk/src/entities/table/index.js +12 -0
- package/dist-sdk/src/entities/table/joins.d.ts +26 -0
- package/dist-sdk/src/entities/table/joins.js +31 -0
- package/dist-sdk/src/entities/table/keys.d.ts +11 -0
- package/dist-sdk/src/entities/table/keys.js +25 -0
- package/dist-sdk/src/entities/table/module.d.ts +5 -0
- package/dist-sdk/src/entities/table/module.js +25 -0
- package/dist-sdk/src/entities/table/state.d.ts +39 -0
- package/dist-sdk/src/entities/table/state.js +43 -0
- package/dist-sdk/src/entities/view/from-tf.d.ts +29 -0
- package/dist-sdk/src/entities/view/from-tf.js +235 -0
- package/dist-sdk/src/entities/view/module.d.ts +24 -0
- package/dist-sdk/src/entities/view/module.js +61 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +65 -0
- package/dist-sdk/src/entities/view/to-tf.js +171 -0
- package/dist-sdk/src/entities/view/types.d.ts +58 -0
- package/dist-sdk/src/entities/view/types.js +89 -0
- package/dist-sdk/src/graph/deferred-catalog-render.d.ts +9 -0
- package/dist-sdk/src/graph/deferred-catalog-render.js +18 -0
- package/dist-sdk/src/graph/index.d.ts +91 -0
- package/dist-sdk/src/graph/index.js +211 -0
- package/dist-sdk/src/graph/modules.d.ts +7 -0
- package/dist-sdk/src/graph/modules.js +42 -0
- package/dist-sdk/src/graph/types.d.ts +375 -0
- package/dist-sdk/src/graph/types.js +102 -0
- package/dist-sdk/src/internal/sdk-package.d.ts +7 -0
- package/dist-sdk/src/internal/sdk-package.js +23 -0
- package/package.json +201 -8
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2 automation authoring — an options-shaped `defineAutomation` whose workflow
|
|
3
|
+
* body is a typed, chainable `defineWorkflow()`:
|
|
4
|
+
*
|
|
5
|
+
* defineAutomation({
|
|
6
|
+
* name: "Escalate",
|
|
7
|
+
* parent: "incidents",
|
|
8
|
+
* workflowRevision: "1.0.0",
|
|
9
|
+
* status: "DRAFT",
|
|
10
|
+
* workflow: defineWorkflow()
|
|
11
|
+
* .trigger(recordCreated({ app }))
|
|
12
|
+
* .task("search", (ctx) => recordSearch({ app, filter: ... }))
|
|
13
|
+
* .task("notify", (ctx) => sendEmail({ to: "...", body: ctx.tasks.search.totalCount }))
|
|
14
|
+
* .outputs((ctx) => ({ found: ctx.tasks.search.totalCount })), // optional
|
|
15
|
+
* }) // → AutomationConfigured
|
|
16
|
+
*
|
|
17
|
+
* `defineAutomation` is **not** chained — it takes an options object and returns
|
|
18
|
+
* an `AutomationConfigured` with `.ref(refName)` and `.def(refName)`. The chaining
|
|
19
|
+
* lives on the `workflow` field, built by `defineWorkflow()`: set a trigger, chain
|
|
20
|
+
* `.task(...)`, optionally close with `.outputs(...)`. Assign the chain straight to
|
|
21
|
+
* `workflow:` — no terminal `.build()` call.
|
|
22
|
+
*
|
|
23
|
+
* The typed `ctx` (compile-time-safe `ctx.trigger.x` / `ctx.tasks.y.output`)
|
|
24
|
+
* comes from the **shared core engine** (`core/context` + `core/ref`), which is
|
|
25
|
+
* reference-model-agnostic — it only models data flow *inside* the automation.
|
|
26
|
+
* Cross-entity references are `CatalogRef` tokens, resolved at deploy.
|
|
27
|
+
*/
|
|
28
|
+
import { randomUUID } from "crypto";
|
|
29
|
+
import { valid as validSemver } from "semver";
|
|
30
|
+
import { buildContext } from "../shared/context.js";
|
|
31
|
+
import { isRef } from "../shared/ref.js";
|
|
32
|
+
import { EntityTfError } from "../../engine/entity.js";
|
|
33
|
+
import { serializeNode } from "./serialize.js";
|
|
34
|
+
import { extractScriptBody, inferOutputSchema, tryExtractFromCurrentSource } from "./script-code.js";
|
|
35
|
+
import { OUTPUT_KEY_WIRE_NAME } from "./output-key-wire-name.js";
|
|
36
|
+
// Runtime import of the Phase-1 factories the fluent methods sugar over.
|
|
37
|
+
// tasks.ts's own import of build.ts is type-only, so there is no runtime cycle.
|
|
38
|
+
import { executeScriptTaskDefWithBody, setVariable as setVariableTask } from "./tasks.js";
|
|
39
|
+
/** Placeholder `forEachTaskRefKey` the forEach item proxy emits; replaced with the real refKey. */
|
|
40
|
+
export const FOR_EACH_PLACEHOLDER = "__forEach__";
|
|
41
|
+
/**
|
|
42
|
+
* Serialize one task (recursively for operators) to the wire
|
|
43
|
+
* `{ refKey, task, children? }` shape. The task's human display name is
|
|
44
|
+
* injected into the body — `displayName` when given (an adopted task whose
|
|
45
|
+
* platform-side name differs from its `refKey`, e.g. "For Each" vs.
|
|
46
|
+
* "For_Each"), else `refKey` itself, matching prior behavior; operator
|
|
47
|
+
* children become `children`; a forEach task's `__forEach__` placeholder is
|
|
48
|
+
* swapped for its real refKey.
|
|
49
|
+
*/
|
|
50
|
+
function serializeTaskEntry(name, def, displayName, hclParent) {
|
|
51
|
+
const result = {
|
|
52
|
+
refKey: name,
|
|
53
|
+
task: serializeNode({ [def.key]: { name: displayName ?? name, ...def.config } }),
|
|
54
|
+
...(hclParent !== undefined ? { hclParent } : {}),
|
|
55
|
+
};
|
|
56
|
+
if (def.operatorChildren && def.operatorChildren.length > 0) {
|
|
57
|
+
result.children = def.operatorChildren.map((child) => ({
|
|
58
|
+
label: child.label,
|
|
59
|
+
...(child.filter !== undefined ? { filter: serializeNode(child.filter) } : {}),
|
|
60
|
+
...(child.defaultLabel !== undefined ? { defaultLabel: child.defaultLabel } : {}),
|
|
61
|
+
...(child.defaultFilterMode !== undefined ? { defaultFilterMode: child.defaultFilterMode } : {}),
|
|
62
|
+
tasks: child.tasks.map((t) => serializeTaskEntry(t.name, t.def, t.displayName, t.hclParent)),
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
if (def.key === "forEach")
|
|
66
|
+
replaceForEachPlaceholder(result, name);
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
/** Replace every `forEachTaskRefKey: "__forEach__"` in the tree with `refKey`. */
|
|
70
|
+
function replaceForEachPlaceholder(node, refKey) {
|
|
71
|
+
if (node === null || typeof node !== "object")
|
|
72
|
+
return;
|
|
73
|
+
if (Array.isArray(node)) {
|
|
74
|
+
for (const item of node)
|
|
75
|
+
replaceForEachPlaceholder(item, refKey);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const rec = node;
|
|
79
|
+
for (const key of Object.keys(rec)) {
|
|
80
|
+
if (key === "forEachTaskRefKey" && rec[key] === FOR_EACH_PLACEHOLDER) {
|
|
81
|
+
rec[key] = refKey;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
replaceForEachPlaceholder(rec[key], refKey);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Map every task's refKey (its `.task(name, …)` name) to its factory key,
|
|
90
|
+
* descending into operator children — the forward mirror of the deserializer's
|
|
91
|
+
* `taskTypeByRefKey`. Used to resolve the type of the task a `taskReference`
|
|
92
|
+
* points at so output-name rewrites apply only to the right task kind.
|
|
93
|
+
*/
|
|
94
|
+
function collectTaskKinds(tasks) {
|
|
95
|
+
const out = new Map();
|
|
96
|
+
const visit = (entries) => {
|
|
97
|
+
for (const { name, def } of entries) {
|
|
98
|
+
out.set(name, def.key);
|
|
99
|
+
for (const child of def.operatorChildren ?? [])
|
|
100
|
+
visit(child.tasks);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
visit(tasks);
|
|
104
|
+
return out;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Map every record-bearing task's refKey to the app refName that owns its
|
|
108
|
+
* `.record`/`.records` output, descending into operator children — mirrors
|
|
109
|
+
* `collectTaskKinds`. Feeds `RecordFieldContext.taskAppRefNameByRefKey` so the
|
|
110
|
+
* deploy pipeline knows which app's fields a `record.<refName>` wire path
|
|
111
|
+
* under that refKey belongs to.
|
|
112
|
+
*/
|
|
113
|
+
function collectRecordApps(tasks) {
|
|
114
|
+
const out = {};
|
|
115
|
+
const visit = (entries) => {
|
|
116
|
+
for (const { name, def } of entries) {
|
|
117
|
+
if (def.__recordApp !== undefined)
|
|
118
|
+
out[name] = def.__recordApp;
|
|
119
|
+
for (const child of def.operatorChildren ?? [])
|
|
120
|
+
visit(child.tasks);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
visit(tasks);
|
|
124
|
+
return out;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Tasks whose output carries a `.record` sub-object. Mirrors the deserializer's
|
|
128
|
+
* `RECORD_BEARING_TASK_TYPES` — kept local to avoid a builder → pull-path import.
|
|
129
|
+
*/
|
|
130
|
+
const RECORD_BEARING_TASK_KEYS = new Set(["recordSearch", "createRecord", "findRelatedRecords"]);
|
|
131
|
+
/**
|
|
132
|
+
* Forward output-name rewrites, the inverse of the deserializer's read-side
|
|
133
|
+
* normalization (`applyOutputNameInverseRewrites` in
|
|
134
|
+
* `materialize/ref-deserializer.ts` — keep the two in sync):
|
|
135
|
+
* - recordSearch: `totalCount` → the platform's `count`.
|
|
136
|
+
* - aiAgent: `result` / `result.<field>` → the platform's
|
|
137
|
+
* `ai_agent_task_response` (text) / `ai_agent_task_structured_output.<field>` (json).
|
|
138
|
+
* - record-bearing tasks: the read path reinjects a `.record` hop on the id
|
|
139
|
+
* accessor (wire `recordId` → source `record.recordId`); collapse it back to
|
|
140
|
+
* the platform's flat `recordId` on write.
|
|
141
|
+
* - single-scalar-output tasks (see `OUTPUT_KEY_WIRE_NAME`): `output` →
|
|
142
|
+
* the platform's actual output name for that task kind.
|
|
143
|
+
*/
|
|
144
|
+
function rewriteForwardTaskRefName(taskKey, name) {
|
|
145
|
+
if (taskKey === "recordSearch" && name === "totalCount") {
|
|
146
|
+
return "count";
|
|
147
|
+
}
|
|
148
|
+
if (taskKey === "aiAgent") {
|
|
149
|
+
const segs = name.split(".");
|
|
150
|
+
if (segs[0] !== "result")
|
|
151
|
+
return name;
|
|
152
|
+
if (segs.length === 1)
|
|
153
|
+
return "ai_agent_task_response";
|
|
154
|
+
return ["ai_agent_task_structured_output", ...segs.slice(1).map((s) => s.toLowerCase())].join(".");
|
|
155
|
+
}
|
|
156
|
+
if (taskKey && RECORD_BEARING_TASK_KEYS.has(taskKey) && name === "record.recordId") {
|
|
157
|
+
return "recordId";
|
|
158
|
+
}
|
|
159
|
+
const wireOutputKey = taskKey ? OUTPUT_KEY_WIRE_NAME[taskKey] : undefined;
|
|
160
|
+
if (wireOutputKey) {
|
|
161
|
+
const segs = name.split(".");
|
|
162
|
+
if (segs[0] === "output")
|
|
163
|
+
return [wireOutputKey, ...segs.slice(1)].join(".");
|
|
164
|
+
}
|
|
165
|
+
return name;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Walk a serialized wire node and rewrite, in place, the `name` of every task
|
|
169
|
+
* output reference whose target task needs an output-name rewrite. Two wire
|
|
170
|
+
* shapes carry a task-ref name: `{ taskReference: { taskRefKey, name } }`
|
|
171
|
+
* (`core/wire/ref-serializer`'s `serializeRefData`, used at ordinary value
|
|
172
|
+
* positions) and `{ type: "TASK", taskRefKey, name }` (`core/filters`'
|
|
173
|
+
* `refDataToFilterReference`, used at filter `leftValue`/`value` positions by
|
|
174
|
+
* the `ref*` filter helpers) — both need the same rewrite. Runs at finalize,
|
|
175
|
+
* when the full refKey→kind map is known.
|
|
176
|
+
*/
|
|
177
|
+
function rewriteTaskOutputRefs(node, taskKindByRefKey) {
|
|
178
|
+
if (Array.isArray(node)) {
|
|
179
|
+
for (const item of node)
|
|
180
|
+
rewriteTaskOutputRefs(item, taskKindByRefKey);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (node === null || typeof node !== "object")
|
|
184
|
+
return;
|
|
185
|
+
const rec = node;
|
|
186
|
+
const ref = rec.taskReference;
|
|
187
|
+
if (ref && typeof ref.taskRefKey === "string" && typeof ref.name === "string") {
|
|
188
|
+
ref.name = rewriteForwardTaskRefName(taskKindByRefKey.get(ref.taskRefKey), ref.name);
|
|
189
|
+
}
|
|
190
|
+
if (rec.type === "TASK" && typeof rec.taskRefKey === "string" && typeof rec.name === "string") {
|
|
191
|
+
rec.name = rewriteForwardTaskRefName(taskKindByRefKey.get(rec.taskRefKey), rec.name);
|
|
192
|
+
}
|
|
193
|
+
for (const v of Object.values(rec))
|
|
194
|
+
rewriteTaskOutputRefs(v, taskKindByRefKey);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Walk serialized tasks and assign UUIDs to any `variable.create` entries that
|
|
198
|
+
* lack one. Returns a `"taskRefKey::varName" → uuid` map used by
|
|
199
|
+
* `resolveVariableParamMarkers` to replace `__variableParamRef` placeholders.
|
|
200
|
+
*/
|
|
201
|
+
function stampAndCollectVariableIds(tasks) {
|
|
202
|
+
const map = new Map();
|
|
203
|
+
const visit = (ts) => {
|
|
204
|
+
for (const t of ts) {
|
|
205
|
+
const refKey = t.refKey;
|
|
206
|
+
const task = t.task;
|
|
207
|
+
const variable = task?.variable;
|
|
208
|
+
if (variable?.create) {
|
|
209
|
+
for (const c of variable.create) {
|
|
210
|
+
if (!c.id)
|
|
211
|
+
c.id = randomUUID();
|
|
212
|
+
map.set(`${refKey}::${c.name}`, c.id);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
const children = t.children;
|
|
216
|
+
if (children) {
|
|
217
|
+
for (const ch of children)
|
|
218
|
+
visit(ch.tasks);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
visit(tasks);
|
|
223
|
+
return map;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Replace every `{ __variableParamRef: { variableTaskRefKey, name } }` marker
|
|
227
|
+
* in the serialized tree with `{ variableReference: { id, name: "variable|<id>" } }`.
|
|
228
|
+
* Throws when a referenced variable isn't in `idMap` — the variable must be
|
|
229
|
+
* created by a `setVariable` task in the same workflow.
|
|
230
|
+
*/
|
|
231
|
+
function resolveVariableParamMarkers(node, idMap) {
|
|
232
|
+
if (node === null || typeof node !== "object")
|
|
233
|
+
return;
|
|
234
|
+
if (Array.isArray(node)) {
|
|
235
|
+
for (const item of node)
|
|
236
|
+
resolveVariableParamMarkers(item, idMap);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const o = node;
|
|
240
|
+
const marker = o.__variableParamRef;
|
|
241
|
+
if (marker) {
|
|
242
|
+
const key = `${marker.variableTaskRefKey}::${marker.name}`;
|
|
243
|
+
const id = idMap.get(key);
|
|
244
|
+
if (!id) {
|
|
245
|
+
throw new Error(`Variable "${marker.name}" not found on task "${marker.variableTaskRefKey}". ` +
|
|
246
|
+
`Check that a setVariable task with that refKey creates a variable with that name.`);
|
|
247
|
+
}
|
|
248
|
+
delete o.__variableParamRef;
|
|
249
|
+
o.variableReference = { id, name: `variable|${id}` };
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
for (const v of Object.values(o))
|
|
253
|
+
resolveVariableParamMarkers(v, idMap);
|
|
254
|
+
}
|
|
255
|
+
function serializeOutputValue(value) {
|
|
256
|
+
return isRef(value) ? serializeNode(value) : { value };
|
|
257
|
+
}
|
|
258
|
+
function makeWorkflowBuilder(state) {
|
|
259
|
+
const appendTask = (name, def, displayName, hclParent) => makeWorkflowBuilder({ ...state, tasks: [...state.tasks, { name, def, displayName, hclParent }] });
|
|
260
|
+
const builder = {
|
|
261
|
+
task(name, fn, displayName, hclParent) {
|
|
262
|
+
const ctx = buildContext(state.tasks.map((t) => t.name));
|
|
263
|
+
const def = fn(ctx);
|
|
264
|
+
if (def.key === "executeScript") {
|
|
265
|
+
throw new Error(`Use .executeScript(${JSON.stringify(name)}, { inputs, code }) instead of ` +
|
|
266
|
+
`.task(${JSON.stringify(name)}, () => executeScript(...)). ` +
|
|
267
|
+
`Nested operator bodies still use childTask(..., executeScript({ code: (input) => ... })).`);
|
|
268
|
+
}
|
|
269
|
+
return appendTask(name, def, displayName, hclParent);
|
|
270
|
+
},
|
|
271
|
+
executeScript(name, opts) {
|
|
272
|
+
// Resolve the body BYTE-EXACT from the automation file's own
|
|
273
|
+
// untranspiled source when running under `elementum build`
|
|
274
|
+
// (tryExtractFromCurrentSource); fall back to the toString()-based
|
|
275
|
+
// extractScriptBody otherwise (e.g. an automation built directly in a
|
|
276
|
+
// test, with no tracked source file). Either way the body is computed
|
|
277
|
+
// exactly ONCE here and threaded straight into the TaskDef — no
|
|
278
|
+
// separate re-extraction downstream.
|
|
279
|
+
// Explicit `outputs` always wins; an explicit `null` means "no schema"
|
|
280
|
+
// and suppresses inference (pulled sources with no platform
|
|
281
|
+
// output_schema print this, so adopted no-schema scripts do not
|
|
282
|
+
// drift); omitting `outputs` entirely infers from the body.
|
|
283
|
+
const body = tryExtractFromCurrentSource(name) ?? extractScriptBody(opts.code);
|
|
284
|
+
const outputs = opts.outputs === undefined ? inferOutputSchema(body) : (opts.outputs ?? undefined);
|
|
285
|
+
const ctx = buildContext(state.tasks.map((t) => t.name));
|
|
286
|
+
const def = executeScriptTaskDefWithBody(body, {
|
|
287
|
+
...(opts.inputs !== undefined ? { inputs: opts.inputs(ctx) } : {}),
|
|
288
|
+
...(outputs !== undefined ? { outputs } : {}),
|
|
289
|
+
});
|
|
290
|
+
return appendTask(name, def);
|
|
291
|
+
},
|
|
292
|
+
setVariable(name, opts) {
|
|
293
|
+
const ctx = buildContext(state.tasks.map((t) => t.name));
|
|
294
|
+
const def = setVariableTask({
|
|
295
|
+
create: [{ name, type: opts.type ?? "TEXT", value: opts.value(ctx) }],
|
|
296
|
+
});
|
|
297
|
+
return appendTask(name, def);
|
|
298
|
+
},
|
|
299
|
+
outputs(fn) {
|
|
300
|
+
const ctx = buildContext(state.tasks.map((t) => t.name));
|
|
301
|
+
const map = fn(ctx);
|
|
302
|
+
const outputs = Object.entries(map).map(([name, value]) => ({
|
|
303
|
+
name,
|
|
304
|
+
value: serializeOutputValue(value),
|
|
305
|
+
}));
|
|
306
|
+
return makeWorkflowBuilder({ ...state, outputs });
|
|
307
|
+
},
|
|
308
|
+
__triggerParams() {
|
|
309
|
+
return state.trigger.__params ?? [];
|
|
310
|
+
},
|
|
311
|
+
__outputNames() {
|
|
312
|
+
return state.outputs?.map((o) => o.name) ?? [];
|
|
313
|
+
},
|
|
314
|
+
__finalize() {
|
|
315
|
+
const taskKindByRefKey = collectTaskKinds(state.tasks);
|
|
316
|
+
const tasks = state.tasks.map((t) => serializeTaskEntry(t.name, t.def, t.displayName, t.hclParent));
|
|
317
|
+
const outputs = state.outputs?.map((o) => ({ ...o }));
|
|
318
|
+
rewriteTaskOutputRefs(tasks, taskKindByRefKey);
|
|
319
|
+
if (outputs)
|
|
320
|
+
rewriteTaskOutputRefs(outputs, taskKindByRefKey);
|
|
321
|
+
// Trigger reference names are NOT canonicalized: the authored name is
|
|
322
|
+
// the name, everywhere in EDK. (Mobius canonicalizes reference names in
|
|
323
|
+
// ITS storage — `ValueReference.ofTriggerReference` — but on the tf
|
|
324
|
+
// path the provider mints references from the trigger's refs map, which
|
|
325
|
+
// is keyed by DECLARED parameter names, so the canonical form never
|
|
326
|
+
// crosses EDK's boundary. The old canonicalize-then-reverse-map dance
|
|
327
|
+
// existed for the legacy compose path and mangled ALL-CAPS names.)
|
|
328
|
+
const variableIdMap = stampAndCollectVariableIds(tasks);
|
|
329
|
+
if (variableIdMap.size > 0) {
|
|
330
|
+
resolveVariableParamMarkers(tasks, variableIdMap);
|
|
331
|
+
if (outputs)
|
|
332
|
+
resolveVariableParamMarkers(outputs, variableIdMap);
|
|
333
|
+
}
|
|
334
|
+
const taskAppRefNameByRefKey = collectRecordApps(state.tasks);
|
|
335
|
+
const recordFieldContext = state.trigger.__recordApp !== undefined || Object.keys(taskAppRefNameByRefKey).length > 0
|
|
336
|
+
? {
|
|
337
|
+
...(state.trigger.__recordApp !== undefined ? { triggerAppRefName: state.trigger.__recordApp } : {}),
|
|
338
|
+
...(Object.keys(taskAppRefNameByRefKey).length > 0 ? { taskAppRefNameByRefKey } : {}),
|
|
339
|
+
}
|
|
340
|
+
: undefined;
|
|
341
|
+
return {
|
|
342
|
+
trigger: serializeNode(state.trigger.wire),
|
|
343
|
+
tasks,
|
|
344
|
+
...(outputs && outputs.length > 0 ? { outputProperties: { outputs } } : {}),
|
|
345
|
+
...(recordFieldContext !== undefined ? { recordFieldContext } : {}),
|
|
346
|
+
};
|
|
347
|
+
},
|
|
348
|
+
};
|
|
349
|
+
return builder;
|
|
350
|
+
}
|
|
351
|
+
/** Wrap a TriggerDef so it doubles as the chain start. Used by the trigger factories. */
|
|
352
|
+
export function chainableTrigger(trigger) {
|
|
353
|
+
return { ...trigger, ...makeWorkflowBuilder({ trigger, tasks: [] }) };
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Begin a workflow body. Set a trigger, chain `.task(...)`, optionally close
|
|
357
|
+
* with `.outputs(...)`, then assign the result to `defineAutomation`'s
|
|
358
|
+
* `workflow:` field — no terminal `.build()`.
|
|
359
|
+
*/
|
|
360
|
+
export function defineWorkflow() {
|
|
361
|
+
return {
|
|
362
|
+
trigger(trigger) {
|
|
363
|
+
return makeWorkflowBuilder({ trigger, tasks: [] });
|
|
364
|
+
},
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Define a v2 automation. Identity comes from the authoring file's `refName`
|
|
369
|
+
* plus `parent`; the display `name` lives only in the payload, so renaming an
|
|
370
|
+
* automation plans as an update rather than a create. Returns an
|
|
371
|
+
* `AutomationConfigured` with `ref(refName)` and `def(refName)`.
|
|
372
|
+
*/
|
|
373
|
+
export function defineAutomation(opts) {
|
|
374
|
+
if (validSemver(opts.workflowRevision) === null) {
|
|
375
|
+
throw new EntityTfError(`automation "${opts.name}" has invalid workflowRevision ${JSON.stringify(opts.workflowRevision)}; expected a SemVer string such as "1.0.0"`);
|
|
376
|
+
}
|
|
377
|
+
return {
|
|
378
|
+
ref(refName) {
|
|
379
|
+
const triggerParams = opts.workflow.__triggerParams();
|
|
380
|
+
const outputNames = opts.workflow.__outputNames();
|
|
381
|
+
// Bag keys are the DECLARED names, verbatim (no canonicalization —
|
|
382
|
+
// access non-identifier names with brackets: trigger["STUDENT NAME 2"]).
|
|
383
|
+
// `required: true` is stamped only when true (canonical form) — it is
|
|
384
|
+
// what agentRunAutomation's typed inputs and def() validation read.
|
|
385
|
+
const trigger = triggerParams.length > 0
|
|
386
|
+
? Object.fromEntries(triggerParams.map((p) => [
|
|
387
|
+
p.name,
|
|
388
|
+
{
|
|
389
|
+
__kind: "triggerParameter",
|
|
390
|
+
refName: p.name,
|
|
391
|
+
name: p.name,
|
|
392
|
+
parent: refName,
|
|
393
|
+
...(p.required ? { required: true } : {}),
|
|
394
|
+
},
|
|
395
|
+
]))
|
|
396
|
+
: undefined;
|
|
397
|
+
const outputs = outputNames.length > 0
|
|
398
|
+
? Object.fromEntries(outputNames.map((n) => [n, { __kind: "outputProperty", refName: n, name: n, parent: refName }]))
|
|
399
|
+
: undefined;
|
|
400
|
+
return {
|
|
401
|
+
__kind: "automation",
|
|
402
|
+
refName: refName,
|
|
403
|
+
name: opts.name,
|
|
404
|
+
parent: opts.parent,
|
|
405
|
+
...(trigger !== undefined ? { trigger } : {}),
|
|
406
|
+
...(outputs !== undefined ? { outputs } : {}),
|
|
407
|
+
};
|
|
408
|
+
},
|
|
409
|
+
def(refName) {
|
|
410
|
+
const wf = opts.workflow.__finalize();
|
|
411
|
+
// `recordFieldContext` is a structural extension, not a declared `DeployableEntity`
|
|
412
|
+
// property (see `RecordFieldContext`'s doc comment) — assigning to `entity`
|
|
413
|
+
// first (rather than returning the literal directly) avoids an excess-property
|
|
414
|
+
// error against the `DeployableEntity` return type while still attaching it for
|
|
415
|
+
// `recordFieldContextOf` to read back at deploy time.
|
|
416
|
+
const entity = {
|
|
417
|
+
kind: "automation",
|
|
418
|
+
parent: opts.parent,
|
|
419
|
+
refName,
|
|
420
|
+
payload: {
|
|
421
|
+
name: opts.name,
|
|
422
|
+
workflowRevision: opts.workflowRevision,
|
|
423
|
+
...(opts.description !== undefined ? { description: opts.description } : {}),
|
|
424
|
+
triggersOtherAutomations: opts.triggersOtherAutomations ?? false,
|
|
425
|
+
status: opts.status ?? "DRAFT",
|
|
426
|
+
trigger: wf.trigger,
|
|
427
|
+
tasks: wf.tasks,
|
|
428
|
+
...(wf.outputProperties ? { outputProperties: wf.outputProperties } : {}),
|
|
429
|
+
},
|
|
430
|
+
...(opts.enabled !== undefined ? { enabled: opts.enabled } : {}),
|
|
431
|
+
...(wf.recordFieldContext !== undefined ? { recordFieldContext: wf.recordFieldContext } : {}),
|
|
432
|
+
};
|
|
433
|
+
return entity;
|
|
434
|
+
},
|
|
435
|
+
};
|
|
436
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Catalog emission dialect for automations (trigger / outputs bags).
|
|
3
|
+
*/
|
|
4
|
+
import { bareFactoryEntry, safeCatalogKey, } from "../../catalog/render-helpers.js";
|
|
5
|
+
export function renderAutomationCatalogEntry(args) {
|
|
6
|
+
const ref = args.ref;
|
|
7
|
+
const triggerKeys = Object.keys(ref.trigger ?? {}).sort();
|
|
8
|
+
const outputKeys = Object.keys(ref.outputs ?? {}).sort();
|
|
9
|
+
const { keyName, baseIndent } = args;
|
|
10
|
+
if (triggerKeys.length === 0 && outputKeys.length === 0) {
|
|
11
|
+
return bareFactoryEntry("automationRef", keyName, baseIndent);
|
|
12
|
+
}
|
|
13
|
+
const lines = [`${baseIndent}${safeCatalogKey(keyName)}: automationRef({`];
|
|
14
|
+
const extraFactories = [];
|
|
15
|
+
if (triggerKeys.length > 0) {
|
|
16
|
+
extraFactories.push("triggerParameterRef");
|
|
17
|
+
lines.push(`${baseIndent} trigger: {`);
|
|
18
|
+
for (const key of triggerKeys) {
|
|
19
|
+
const param = ref.trigger[key];
|
|
20
|
+
lines.push(`${baseIndent} ${safeCatalogKey(key)}: triggerParameterRef({ name: ${JSON.stringify(param.name)}, parent: ${JSON.stringify(param.parent ?? "")}${param.required === true ? ", required: true" : ""} }),`);
|
|
21
|
+
}
|
|
22
|
+
lines.push(`${baseIndent} },`);
|
|
23
|
+
}
|
|
24
|
+
if (outputKeys.length > 0) {
|
|
25
|
+
extraFactories.push("outputPropertyRef");
|
|
26
|
+
lines.push(`${baseIndent} outputs: {`);
|
|
27
|
+
for (const key of outputKeys) {
|
|
28
|
+
const prop = ref.outputs[key];
|
|
29
|
+
lines.push(`${baseIndent} ${safeCatalogKey(key)}: outputPropertyRef({ name: ${JSON.stringify(prop.name)}, parent: ${JSON.stringify(prop.parent ?? "")} }),`);
|
|
30
|
+
}
|
|
31
|
+
lines.push(`${baseIndent} },`);
|
|
32
|
+
}
|
|
33
|
+
lines.push(`${baseIndent}}),`);
|
|
34
|
+
return { lines, extraFactories };
|
|
35
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Printer AST — purpose-built, minimal, decoupled from TypeScript.
|
|
3
|
+
*
|
|
4
|
+
* The ref/filter/task deserializers return nodes in this AST; the printer
|
|
5
|
+
* is the only module that turns them into TS source. Strings that would
|
|
6
|
+
* otherwise get quote/escape foot-guns (e.g. `template` parts) live as
|
|
7
|
+
* structured data until the final print step.
|
|
8
|
+
*
|
|
9
|
+
* Filter / sort / ref types live in `src/core/filters/ast.ts` and are
|
|
10
|
+
* re-exported here for backwards compatibility. Other tool surfaces
|
|
11
|
+
* (agent search tools, etc.) import the same definitions from there.
|
|
12
|
+
*/
|
|
13
|
+
import type { RefExpr, FilterValueAst, FilterAst, SortAst, ApprovalChainRefAst, AppRefAst, FieldRefAst, UserFieldRefAst, UnresolvedRefAst } from "../../shared/filters/ast.js";
|
|
14
|
+
export type { RefExpr, FilterValueAst, FilterAst, SortAst, AppRefAst, ApprovalChainRefAst, FieldRefAst, UserFieldRefAst, UnresolvedRefAst, };
|
|
15
|
+
/**
|
|
16
|
+
* A TaskCall represents one call to a task factory like `executeScript({...})`.
|
|
17
|
+
* `args` is a map of argument-name -> value; the printer emits each value
|
|
18
|
+
* according to its dynamic shape (RefExpr, FilterAst, nested object, etc.).
|
|
19
|
+
*
|
|
20
|
+
* `children` carries the AST for operator tasks (forEach / switch). For
|
|
21
|
+
* forEach the array has exactly one entry; for switch each entry is a case
|
|
22
|
+
* branch (plus optionally a default, stored with `label: null`).
|
|
23
|
+
*/
|
|
24
|
+
export interface TaskCall {
|
|
25
|
+
readonly factory: string;
|
|
26
|
+
readonly refKey: string;
|
|
27
|
+
readonly args: Record<string, unknown>;
|
|
28
|
+
readonly children?: readonly OperatorChildAst[];
|
|
29
|
+
/** The task's real wire display name, when it differs from `refKey` (e.g. a platform-authored "For Each" vs. the slugged `refKey` "For_Each"). */
|
|
30
|
+
readonly displayName?: string;
|
|
31
|
+
/** Explicit provider graph parent (`trigger` or another task refKey). */
|
|
32
|
+
readonly hclParent?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface OperatorChildAst {
|
|
35
|
+
readonly label: string | null;
|
|
36
|
+
readonly filter?: FilterAst;
|
|
37
|
+
readonly tasks: readonly TaskCall[];
|
|
38
|
+
/** The switch default branch's actual display label, when `label` is `null` and it deviates from "Default". */
|
|
39
|
+
readonly defaultLabel?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Which of the two mutually-exclusive wire shapes this switch default
|
|
42
|
+
* branch was found in (`is_default = true` vs. an explicit
|
|
43
|
+
* `filter = {type:"true"}`) — both are live-confirmed on real orgs for the
|
|
44
|
+
* same case pattern (#157). Only set when the branch used the older
|
|
45
|
+
* filter-based shape; unset means the newer `is_default` shape, which is
|
|
46
|
+
* also to-tf.ts's default when this is absent (e.g. a freshly-authored
|
|
47
|
+
* branch). Present so a rebuild reproduces the shape a pulled case
|
|
48
|
+
* actually has instead of proposing a spurious "update".
|
|
49
|
+
*/
|
|
50
|
+
readonly defaultFilterMode?: "isDefault" | "explicitTrueFilter";
|
|
51
|
+
}
|
|
52
|
+
export type TriggerAst = {
|
|
53
|
+
kind: "onDemand";
|
|
54
|
+
/** Schema entries, keyed by camelCase input name. */
|
|
55
|
+
inputs: Array<{
|
|
56
|
+
name: string;
|
|
57
|
+
type: string;
|
|
58
|
+
required?: boolean;
|
|
59
|
+
multiple?: boolean;
|
|
60
|
+
defaultValue?: unknown;
|
|
61
|
+
description?: string;
|
|
62
|
+
}>;
|
|
63
|
+
/** Round-tripped from the wire's `onDemand.showTriggeredBy` flag. */
|
|
64
|
+
showTriggeredBy?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Set when a task in this workflow references `ctx.trigger.record` —
|
|
67
|
+
* i.e. this on-demand automation is invoked against a specific record.
|
|
68
|
+
* Not carried on the wire; inferred by scanning the deserialized tasks.
|
|
69
|
+
*/
|
|
70
|
+
hasRecord?: boolean;
|
|
71
|
+
} | {
|
|
72
|
+
kind: "recordCreate" | "recordUpdate" | "attachment";
|
|
73
|
+
/** The owning app — `{kind: "unresolved", ...}` when the aspect never made it into the pull's catalog. */
|
|
74
|
+
app: AppRefAst | UnresolvedRefAst;
|
|
75
|
+
filter?: FilterAst;
|
|
76
|
+
changedFields?: readonly (FieldRefAst | UnresolvedRefAst)[];
|
|
77
|
+
thinkUi?: boolean;
|
|
78
|
+
} | {
|
|
79
|
+
kind: "commentAdded";
|
|
80
|
+
app: AppRefAst | UnresolvedRefAst;
|
|
81
|
+
conversationType: string;
|
|
82
|
+
filter?: FilterAst;
|
|
83
|
+
} | {
|
|
84
|
+
kind: "conversationEnd";
|
|
85
|
+
app: AppRefAst | UnresolvedRefAst;
|
|
86
|
+
conversationType: string;
|
|
87
|
+
} | {
|
|
88
|
+
kind: "webhook";
|
|
89
|
+
authenticated?: boolean;
|
|
90
|
+
/** Raw passthrough — printer emits as-is. */
|
|
91
|
+
customResponse?: {
|
|
92
|
+
success?: {
|
|
93
|
+
enabled: boolean;
|
|
94
|
+
format: "JSON" | "XML" | "Text";
|
|
95
|
+
statusCode?: number;
|
|
96
|
+
body: string;
|
|
97
|
+
};
|
|
98
|
+
failure?: {
|
|
99
|
+
enabled: boolean;
|
|
100
|
+
format: "JSON" | "XML" | "Text";
|
|
101
|
+
statusCode?: number;
|
|
102
|
+
body: string;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
} | {
|
|
106
|
+
kind: "temporal";
|
|
107
|
+
app: AppRefAst | UnresolvedRefAst;
|
|
108
|
+
fieldKey: string;
|
|
109
|
+
temporalUnit: "MINUTES" | "HOURS" | "DAYS";
|
|
110
|
+
value: number;
|
|
111
|
+
} | {
|
|
112
|
+
kind: "approvalProcessStatusUpdated";
|
|
113
|
+
app: AppRefAst | UnresolvedRefAst;
|
|
114
|
+
approvalChain: string | ApprovalChainRefAst;
|
|
115
|
+
status: "ACTIVE" | "STEP_APPROVED" | "CANCELLED" | "DENIED" | "APPROVED";
|
|
116
|
+
} | {
|
|
117
|
+
kind: "schedule";
|
|
118
|
+
frequency: "HOURLY" | "DAILY" | "WEEKLY" | "MONTHLY";
|
|
119
|
+
interval?: number;
|
|
120
|
+
timezone: string;
|
|
121
|
+
startAt: string;
|
|
122
|
+
weekdays?: readonly string[];
|
|
123
|
+
dayOfMonth?: number;
|
|
124
|
+
} | {
|
|
125
|
+
kind: "dataMine";
|
|
126
|
+
datamineId: string;
|
|
127
|
+
fireOnAlert?: boolean;
|
|
128
|
+
fireOnRecovery?: boolean;
|
|
129
|
+
} | {
|
|
130
|
+
kind: "emailReceived";
|
|
131
|
+
emailAliasId: string;
|
|
132
|
+
} | {
|
|
133
|
+
kind: "slackMessage";
|
|
134
|
+
} | {
|
|
135
|
+
kind: "surveyResponseCreate";
|
|
136
|
+
app: AppRefAst | UnresolvedRefAst;
|
|
137
|
+
survey: string;
|
|
138
|
+
};
|
|
139
|
+
export interface AutomationAst {
|
|
140
|
+
readonly ownerHandle: string;
|
|
141
|
+
readonly name: string;
|
|
142
|
+
readonly workflowRevision: string;
|
|
143
|
+
readonly description?: string;
|
|
144
|
+
readonly triggersOtherAutomations?: boolean;
|
|
145
|
+
readonly status: "DRAFT" | "ACTIVE";
|
|
146
|
+
readonly trigger: TriggerAst;
|
|
147
|
+
readonly tasks: readonly TaskCall[];
|
|
148
|
+
readonly outputs?: readonly {
|
|
149
|
+
name: string;
|
|
150
|
+
value: unknown;
|
|
151
|
+
}[];
|
|
152
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Printer AST — purpose-built, minimal, decoupled from TypeScript.
|
|
3
|
+
*
|
|
4
|
+
* The ref/filter/task deserializers return nodes in this AST; the printer
|
|
5
|
+
* is the only module that turns them into TS source. Strings that would
|
|
6
|
+
* otherwise get quote/escape foot-guns (e.g. `template` parts) live as
|
|
7
|
+
* structured data until the final print step.
|
|
8
|
+
*
|
|
9
|
+
* Filter / sort / ref types live in `src/core/filters/ast.ts` and are
|
|
10
|
+
* re-exported here for backwards compatibility. Other tool surfaces
|
|
11
|
+
* (agent search tools, etc.) import the same definitions from there.
|
|
12
|
+
*/
|
|
13
|
+
export {};
|