@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,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2 approval-chain steps. Parallel to v1 `src/approvalChains/steps.ts`. A step
|
|
3
|
+
* targets a user or group by **raw id** (`UserRef`/`GroupRef`) — users and
|
|
4
|
+
* groups are org-directory entities the EDK never manages and that don't live
|
|
5
|
+
* in v2 state, so they're id-by-value, not catalog tokens.
|
|
6
|
+
*/
|
|
7
|
+
import { EdkValidationError } from "../../../elementum-entity-client/errors.js";
|
|
8
|
+
export function userStep(user, options) {
|
|
9
|
+
return { kind: "user", ref: user, ...(options?.id != null ? { id: options.id } : {}) };
|
|
10
|
+
}
|
|
11
|
+
export function groupStep(group, options) {
|
|
12
|
+
const { approvalsRequired, denialsRequired, id } = options;
|
|
13
|
+
if (approvalsRequired < 0 || denialsRequired < 0) {
|
|
14
|
+
throw new EdkValidationError(`groupStep: approvalsRequired and denialsRequired must be >= 0 (got ${approvalsRequired}, ${denialsRequired}).`);
|
|
15
|
+
}
|
|
16
|
+
if (approvalsRequired === 0 && denialsRequired === 0) {
|
|
17
|
+
throw new EdkValidationError("groupStep: at least one of approvalsRequired or denialsRequired must be > 0.");
|
|
18
|
+
}
|
|
19
|
+
return { kind: "group", ref: group, approvalsRequired, denialsRequired, ...(id != null ? { id } : {}) };
|
|
20
|
+
}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import type { AutomationCatalogRef } from "../../catalog/index.js";
|
|
2
|
+
import { type Context } from "../shared/context.js";
|
|
3
|
+
import { type Ref, type Simplify, type ValueOrRef } from "../shared/ref.js";
|
|
4
|
+
import type { DeployableEntity, EntityDeployOptions, RecordFieldContext } from "../../engine/entity.js";
|
|
5
|
+
import { type ScriptInput } from "./script-code.js";
|
|
6
|
+
/** Structural empty object — neutral element for the `&`-accumulated task map. */
|
|
7
|
+
type EmptyObject = {
|
|
8
|
+
[K in never]: never;
|
|
9
|
+
};
|
|
10
|
+
/** One onDemand trigger parameter's authoring metadata, surfaced to the catalog. */
|
|
11
|
+
export interface TriggerParamMeta {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly required: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A trigger definition: the full wire trigger envelope (discriminated by kind,
|
|
17
|
+
* e.g. `{ createRecord: {...} }`) and the typed `ctx.trigger` shape.
|
|
18
|
+
*/
|
|
19
|
+
export interface TriggerDef<TOutput> {
|
|
20
|
+
readonly wire: Record<string, unknown>;
|
|
21
|
+
/** Phantom — the typed shape exposed as `ctx.trigger`. */
|
|
22
|
+
readonly __output?: TOutput;
|
|
23
|
+
/** onDemand parameter metadata (declaration order) — used by `ref()` to populate the catalog's trigger bag. */
|
|
24
|
+
readonly __params?: readonly TriggerParamMeta[];
|
|
25
|
+
/** The owning app's refName, when this trigger's `record` output is app-field-typed. */
|
|
26
|
+
readonly __recordApp?: string;
|
|
27
|
+
}
|
|
28
|
+
/** A named child task inside an operator (forEach/switch/forkJoin) branch. */
|
|
29
|
+
export interface ChildTask {
|
|
30
|
+
readonly name: string;
|
|
31
|
+
readonly def: TaskDef<unknown>;
|
|
32
|
+
/** Display name distinct from `refKey` (`name`), when adopting a platform-authored task. */
|
|
33
|
+
readonly displayName?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* One branch of an operator: a label (case name, or `null` for forEach body /
|
|
37
|
+
* switch default), an optional filter (switch case condition), and its tasks.
|
|
38
|
+
* Maps to the wire `children` entry `{ label, filter?, tasks }`.
|
|
39
|
+
*/
|
|
40
|
+
export interface OperatorChild {
|
|
41
|
+
readonly label: string | null;
|
|
42
|
+
readonly filter?: Record<string, unknown>;
|
|
43
|
+
readonly tasks: readonly ChildTask[];
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A task definition produced by a factory. `key` is the one-of discriminator the
|
|
47
|
+
* platform expects (e.g. `"recordSearch"`); `config` is that task's inner body
|
|
48
|
+
* (minus `name`, which the builder injects from the `.task(name, …)` call —
|
|
49
|
+
* mirroring v1, where the task name lives inside the body). The wire task becomes
|
|
50
|
+
* `{ [key]: { name, ...config } }`. Operators additionally carry
|
|
51
|
+
* `operatorChildren`, emitted as the wire task's `children`.
|
|
52
|
+
*/
|
|
53
|
+
export interface TaskDef<TOutput> {
|
|
54
|
+
readonly key: string;
|
|
55
|
+
readonly config: Record<string, unknown>;
|
|
56
|
+
readonly operatorChildren?: readonly OperatorChild[];
|
|
57
|
+
/** Phantom — the typed shape exposed as `ctx.tasks.<name>`. */
|
|
58
|
+
readonly __output?: TOutput;
|
|
59
|
+
/** The owning app's refName, when this task's `record`/`records` output is app-field-typed. */
|
|
60
|
+
readonly __recordApp?: string;
|
|
61
|
+
}
|
|
62
|
+
/** Placeholder `forEachTaskRefKey` the forEach item proxy emits; replaced with the real refKey. */
|
|
63
|
+
export declare const FOR_EACH_PLACEHOLDER = "__forEach__";
|
|
64
|
+
/**
|
|
65
|
+
* The finalized workflow body `defineAutomation` embeds — the wire trigger, the
|
|
66
|
+
* serialized task list, and the optional output properties. Produced by
|
|
67
|
+
* {@link WorkflowChain.__finalize}; not authored by hand.
|
|
68
|
+
*/
|
|
69
|
+
export interface WorkflowDef {
|
|
70
|
+
readonly trigger: unknown;
|
|
71
|
+
readonly tasks: Record<string, unknown>[];
|
|
72
|
+
readonly outputProperties?: {
|
|
73
|
+
outputs: Array<{
|
|
74
|
+
name: string;
|
|
75
|
+
value: unknown;
|
|
76
|
+
}>;
|
|
77
|
+
};
|
|
78
|
+
/** See {@link RecordFieldContext}. Omitted when no trigger/task in this workflow is record-bearing. */
|
|
79
|
+
readonly recordFieldContext?: RecordFieldContext;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The minimal contract `defineAutomation`'s `workflow:` field accepts: anything
|
|
83
|
+
* that can finalize itself to a {@link WorkflowDef}. A `defineWorkflow()` chain
|
|
84
|
+
* satisfies this once a trigger is set ({@link WorkflowBuilder}). The pre-trigger
|
|
85
|
+
* stage ({@link WorkflowStarted}) does not, so a triggerless workflow is a
|
|
86
|
+
* compile error at the assignment.
|
|
87
|
+
*/
|
|
88
|
+
export interface WorkflowChain {
|
|
89
|
+
/** @internal — consumed by `defineAutomation`; not part of the authoring API. */
|
|
90
|
+
__finalize(): WorkflowDef;
|
|
91
|
+
/** @internal — onDemand parameter metadata; empty for non-onDemand triggers. */
|
|
92
|
+
__triggerParams(): readonly TriggerParamMeta[];
|
|
93
|
+
/** @internal — output property names declared via `.outputs()`; empty if none. */
|
|
94
|
+
__outputNames(): readonly string[];
|
|
95
|
+
}
|
|
96
|
+
/** A value an output property can carry: a typed ctx ref, or a literal. */
|
|
97
|
+
type OutputValue = Ref<unknown> | string | number | boolean | null;
|
|
98
|
+
/** `Ref<T>` values resolve to `T` by the time the platform hands them to a script. */
|
|
99
|
+
type ResolvedRefs<I> = {
|
|
100
|
+
[K in keyof I]: I[K] extends Ref<infer T> ? T : I[K];
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* A workflow with a trigger set. `.task()` accumulates typed task outputs;
|
|
104
|
+
* `.outputs()` declares the automation-level output properties (optional).
|
|
105
|
+
* Assign the chain straight to `defineAutomation`'s `workflow:` field.
|
|
106
|
+
*
|
|
107
|
+
* v3 fluent surface: trigger factories return this builder directly
|
|
108
|
+
* (`onDemand({...}).executeScript(...)`), and the Phase-1 task kinds have
|
|
109
|
+
* dedicated methods whose options take ctx-lambdas. The generic `.task()` stays
|
|
110
|
+
* as the escape hatch for every other kind.
|
|
111
|
+
*/
|
|
112
|
+
export interface WorkflowBuilder<TTrigger, TTasks extends Record<string, unknown>, TVars extends Record<string, unknown> = EmptyObject> extends WorkflowChain {
|
|
113
|
+
task<TName extends string, TOutput>(name: TName, fn: (ctx: Context<TTrigger, TTasks, TVars>) => TaskDef<TOutput>,
|
|
114
|
+
/**
|
|
115
|
+
* Display name distinct from `refKey` — only needed when adopting a
|
|
116
|
+
* platform-authored task whose wire `name` differs from its `refKey`
|
|
117
|
+
* (e.g. a UI-built "For Each" task, whose slugged refKey is "For_Each").
|
|
118
|
+
* Omit for normally-authored tasks; the wire name defaults to `refKey`.
|
|
119
|
+
*/
|
|
120
|
+
displayName?: string): WorkflowBuilder<TTrigger, Simplify<TTasks & Record<TName, TOutput>>, TVars>;
|
|
121
|
+
/**
|
|
122
|
+
* Fluent executeScript (v3). `inputs` is a ctx-lambda mapping input names to
|
|
123
|
+
* refs/values; `code` is a FUNCTION — the TS contract is the authoring
|
|
124
|
+
* surface (typed `input.parameters` from `inputs`; the return type flows to
|
|
125
|
+
* `ctx.tasks.<name>.result.*` downstream). Its transpiled body ships as the
|
|
126
|
+
* platform script. String bodies exist only on the generic factory, for the
|
|
127
|
+
* pulled-source path.
|
|
128
|
+
*
|
|
129
|
+
* The output schema is INFERRED from the code's `return {...}` literals —
|
|
130
|
+
* property names statically, property types from literal values (default
|
|
131
|
+
* text). Pass `outputs` only to override: a non-text property whose value
|
|
132
|
+
* isn't a literal, or a return the scan can't enumerate.
|
|
133
|
+
*/
|
|
134
|
+
executeScript<TName extends string, I extends Record<string, ValueOrRef<unknown>> = Record<string, never>, R extends Record<string, unknown> = Record<string, unknown>>(name: TName, opts: {
|
|
135
|
+
readonly inputs?: (ctx: Context<TTrigger, TTasks, TVars>) => I;
|
|
136
|
+
readonly code: (input: ScriptInput<ResolvedRefs<I>>) => R;
|
|
137
|
+
/** Override the inferred output schema: property name → `"text" | "integer" | "number" | "decimal" | "boolean"`. */
|
|
138
|
+
readonly outputs?: Record<string, string>;
|
|
139
|
+
}): WorkflowBuilder<TTrigger, Simplify<TTasks & Record<TName, {
|
|
140
|
+
result: R;
|
|
141
|
+
textResult: string;
|
|
142
|
+
}>>, TVars>;
|
|
143
|
+
/**
|
|
144
|
+
* Fluent setVariable (v3): one variable, NAMED THE SAME as its task — read
|
|
145
|
+
* it downstream as `ctx.variables.<name>`, the variable's typed ref
|
|
146
|
+
* (`Ref<string>` for the default TEXT type). (The variable name is
|
|
147
|
+
* platform-visible and must be workflow-unique — ei's export resolves
|
|
148
|
+
* variable refs by name per workflow — so it mirrors the task name rather
|
|
149
|
+
* than a fixed "value".) `value` is a ctx-lambda returning a ref, template,
|
|
150
|
+
* or literal (`(ctx) => "static"` for constants — the lambda form keeps
|
|
151
|
+
* `ctx` fully typed; a bare `ValueOrRef<unknown>` union would collapse to
|
|
152
|
+
* `unknown` and erase it).
|
|
153
|
+
*/
|
|
154
|
+
setVariable<TName extends string, TType extends string = "TEXT">(name: TName, opts: {
|
|
155
|
+
readonly value: (ctx: Context<TTrigger, TTasks, TVars>) => ValueOrRef<unknown>;
|
|
156
|
+
/** Platform variable type (default "TEXT"). */
|
|
157
|
+
readonly type?: TType;
|
|
158
|
+
}): WorkflowBuilder<TTrigger, Simplify<TTasks & Record<TName, Record<string, never>>>, Simplify<TVars & Record<TName, VariableValueOf<TType>>>>;
|
|
159
|
+
/**
|
|
160
|
+
* Declare the workflow's output properties — a map of output name → value,
|
|
161
|
+
* where each value is a typed ctx ref (`ctx.tasks.x.y`, `ctx.trigger.z`) or a
|
|
162
|
+
* literal. The ctx sees the trigger and every task, since outputs are read
|
|
163
|
+
* after the workflow runs.
|
|
164
|
+
*/
|
|
165
|
+
outputs(fn: (ctx: Context<TTrigger, TTasks, TVars>) => Record<string, OutputValue>): WorkflowBuilder<TTrigger, TTasks, TVars>;
|
|
166
|
+
}
|
|
167
|
+
/** Platform variable type → the TS value type its `ctx.variables.<name>` ref carries. */
|
|
168
|
+
type VariableValueOf<T extends string> = T extends "TEXT" ? string : T extends "NUMBER" | "DECIMAL" | "INTEGER" ? number : T extends "BOOLEAN" ? boolean : unknown;
|
|
169
|
+
/** The pre-trigger stage — a trigger must be set before tasks or outputs. */
|
|
170
|
+
export interface WorkflowStarted {
|
|
171
|
+
trigger<TOutput>(trigger: TriggerDef<TOutput>): WorkflowBuilder<TOutput, EmptyObject>;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* A trigger that is ALSO the start of a workflow chain (v3): assign it to
|
|
175
|
+
* `workflow:` and chain tasks directly — `onDemand({}).executeScript(...)` —
|
|
176
|
+
* or keep the legacy `defineWorkflow().trigger(...)` form; both accept it.
|
|
177
|
+
*/
|
|
178
|
+
export type TriggerChain<TOutput> = TriggerDef<TOutput> & WorkflowBuilder<TOutput, EmptyObject>;
|
|
179
|
+
/** Wrap a TriggerDef so it doubles as the chain start. Used by the trigger factories. */
|
|
180
|
+
export declare function chainableTrigger<TOutput>(trigger: TriggerDef<TOutput>): TriggerChain<TOutput>;
|
|
181
|
+
/**
|
|
182
|
+
* Begin a workflow body. Set a trigger, chain `.task(...)`, optionally close
|
|
183
|
+
* with `.outputs(...)`, then assign the result to `defineAutomation`'s
|
|
184
|
+
* `workflow:` field — no terminal `.build()`.
|
|
185
|
+
*/
|
|
186
|
+
export declare function defineWorkflow(): WorkflowStarted;
|
|
187
|
+
export interface AutomationV2Options extends EntityDeployOptions {
|
|
188
|
+
/** The automation's display name. Changing it updates the existing automation. */
|
|
189
|
+
readonly name: string;
|
|
190
|
+
/** The owning app's ref name (e.g. `"incidents"`). */
|
|
191
|
+
readonly parent: string;
|
|
192
|
+
readonly status?: "DRAFT" | "ACTIVE";
|
|
193
|
+
/** Publish token preserved by pull; bump deliberately to republish a changed workflow. */
|
|
194
|
+
readonly workflowRevision?: string;
|
|
195
|
+
/** The workflow body — a `defineWorkflow()` chain with a trigger set. */
|
|
196
|
+
readonly workflow: WorkflowChain;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* The configured result of `defineAutomation` — its reference surface (`ref()`)
|
|
200
|
+
* and its deployable entity (`def()`). Both take `refName` as a **call-time
|
|
201
|
+
* argument** (the file's own name, never stored on the entity) — see
|
|
202
|
+
* `AppConfigured` in `src/aspects/build.ts` for the design rationale.
|
|
203
|
+
*/
|
|
204
|
+
export interface AutomationConfigured {
|
|
205
|
+
ref(refName: string): AutomationCatalogRef;
|
|
206
|
+
def(refName: string): DeployableEntity;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Define a v2 automation. Identity comes from the authoring file's `refName`
|
|
210
|
+
* plus `parent`; the display `name` lives only in the payload, so renaming an
|
|
211
|
+
* automation plans as an update rather than a create. Returns an
|
|
212
|
+
* `AutomationConfigured` with `ref(refName)` and `def(refName)`.
|
|
213
|
+
*/
|
|
214
|
+
export declare function defineAutomation(opts: AutomationV2Options): AutomationConfigured;
|
|
215
|
+
export {};
|
|
@@ -0,0 +1,424 @@
|
|
|
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
|
+
* status: "DRAFT",
|
|
9
|
+
* workflow: defineWorkflow()
|
|
10
|
+
* .trigger(recordCreated({ app }))
|
|
11
|
+
* .task("search", (ctx) => recordSearch({ app, filter: ... }))
|
|
12
|
+
* .task("notify", (ctx) => sendEmail({ to: "...", body: ctx.tasks.search.totalCount }))
|
|
13
|
+
* .outputs((ctx) => ({ found: ctx.tasks.search.totalCount })), // optional
|
|
14
|
+
* }) // → AutomationConfigured
|
|
15
|
+
*
|
|
16
|
+
* `defineAutomation` is **not** chained — it takes an options object and returns
|
|
17
|
+
* an `AutomationConfigured` with `.ref(refName)` and `.def(refName)`. The chaining
|
|
18
|
+
* lives on the `workflow` field, built by `defineWorkflow()`: set a trigger, chain
|
|
19
|
+
* `.task(...)`, optionally close with `.outputs(...)`. Assign the chain straight to
|
|
20
|
+
* `workflow:` — no terminal `.build()` call.
|
|
21
|
+
*
|
|
22
|
+
* The typed `ctx` (compile-time-safe `ctx.trigger.x` / `ctx.tasks.y.output`)
|
|
23
|
+
* comes from the **shared core engine** (`core/context` + `core/ref`), which is
|
|
24
|
+
* reference-model-agnostic — it only models data flow *inside* the automation.
|
|
25
|
+
* Cross-entity references are `CatalogRef` tokens, resolved at deploy.
|
|
26
|
+
*/
|
|
27
|
+
import { randomUUID } from "crypto";
|
|
28
|
+
import { buildContext } from "../shared/context.js";
|
|
29
|
+
import { isRef } from "../shared/ref.js";
|
|
30
|
+
import { serializeNode } from "./serialize.js";
|
|
31
|
+
import { extractScriptBody, inferOutputSchema } from "./script-code.js";
|
|
32
|
+
// Runtime import of the two Phase-1 factories the fluent methods sugar over.
|
|
33
|
+
// tasks.ts's own import of build.ts is type-only, so there is no runtime cycle.
|
|
34
|
+
import { executeScript as executeScriptTask, setVariable as setVariableTask } from "./tasks.js";
|
|
35
|
+
/** Placeholder `forEachTaskRefKey` the forEach item proxy emits; replaced with the real refKey. */
|
|
36
|
+
export const FOR_EACH_PLACEHOLDER = "__forEach__";
|
|
37
|
+
/**
|
|
38
|
+
* Serialize one task (recursively for operators) to the wire
|
|
39
|
+
* `{ refKey, task, children? }` shape. The task's human display name is
|
|
40
|
+
* injected into the body — `displayName` when given (an adopted task whose
|
|
41
|
+
* platform-side name differs from its `refKey`, e.g. "For Each" vs.
|
|
42
|
+
* "For_Each"), else `refKey` itself, matching prior behavior; operator
|
|
43
|
+
* children become `children`; a forEach task's `__forEach__` placeholder is
|
|
44
|
+
* swapped for its real refKey.
|
|
45
|
+
*/
|
|
46
|
+
function serializeTaskEntry(name, def, displayName) {
|
|
47
|
+
const result = {
|
|
48
|
+
refKey: name,
|
|
49
|
+
task: serializeNode({ [def.key]: { name: displayName ?? name, ...def.config } }),
|
|
50
|
+
};
|
|
51
|
+
if (def.operatorChildren && def.operatorChildren.length > 0) {
|
|
52
|
+
result.children = def.operatorChildren.map((child) => ({
|
|
53
|
+
label: child.label,
|
|
54
|
+
...(child.filter !== undefined ? { filter: serializeNode(child.filter) } : {}),
|
|
55
|
+
tasks: child.tasks.map((t) => serializeTaskEntry(t.name, t.def, t.displayName)),
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
if (def.key === "forEach")
|
|
59
|
+
replaceForEachPlaceholder(result, name);
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
62
|
+
/** Replace every `forEachTaskRefKey: "__forEach__"` in the tree with `refKey`. */
|
|
63
|
+
function replaceForEachPlaceholder(node, refKey) {
|
|
64
|
+
if (node === null || typeof node !== "object")
|
|
65
|
+
return;
|
|
66
|
+
if (Array.isArray(node)) {
|
|
67
|
+
for (const item of node)
|
|
68
|
+
replaceForEachPlaceholder(item, refKey);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const rec = node;
|
|
72
|
+
for (const key of Object.keys(rec)) {
|
|
73
|
+
if (key === "forEachTaskRefKey" && rec[key] === FOR_EACH_PLACEHOLDER) {
|
|
74
|
+
rec[key] = refKey;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
replaceForEachPlaceholder(rec[key], refKey);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Map every task's refKey (its `.task(name, …)` name) to its factory key,
|
|
83
|
+
* descending into operator children — the forward mirror of the deserializer's
|
|
84
|
+
* `taskTypeByRefKey`. Used to resolve the type of the task a `taskReference`
|
|
85
|
+
* points at so output-name rewrites apply only to the right task kind.
|
|
86
|
+
*/
|
|
87
|
+
function collectTaskKinds(tasks) {
|
|
88
|
+
const out = new Map();
|
|
89
|
+
const visit = (entries) => {
|
|
90
|
+
for (const { name, def } of entries) {
|
|
91
|
+
out.set(name, def.key);
|
|
92
|
+
for (const child of def.operatorChildren ?? [])
|
|
93
|
+
visit(child.tasks);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
visit(tasks);
|
|
97
|
+
return out;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Map every record-bearing task's refKey to the app refName that owns its
|
|
101
|
+
* `.record`/`.records` output, descending into operator children — mirrors
|
|
102
|
+
* `collectTaskKinds`. Feeds `RecordFieldContext.taskAppRefNameByRefKey` so the
|
|
103
|
+
* deploy pipeline knows which app's fields a `record.<refName>` wire path
|
|
104
|
+
* under that refKey belongs to.
|
|
105
|
+
*/
|
|
106
|
+
function collectRecordApps(tasks) {
|
|
107
|
+
const out = {};
|
|
108
|
+
const visit = (entries) => {
|
|
109
|
+
for (const { name, def } of entries) {
|
|
110
|
+
if (def.__recordApp !== undefined)
|
|
111
|
+
out[name] = def.__recordApp;
|
|
112
|
+
for (const child of def.operatorChildren ?? [])
|
|
113
|
+
visit(child.tasks);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
visit(tasks);
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Tasks whose output carries a `.record` sub-object. Mirrors the deserializer's
|
|
121
|
+
* `RECORD_BEARING_TASK_TYPES` — kept local to avoid a builder → pull-path import.
|
|
122
|
+
*/
|
|
123
|
+
const RECORD_BEARING_TASK_KEYS = new Set(["recordSearch", "createRecord", "findRelatedRecords"]);
|
|
124
|
+
/**
|
|
125
|
+
* Single-scalar-output task kinds whose EDK factory exposes the result as
|
|
126
|
+
* `output` (`TaskDef<{ output: unknown }>`), but whose platform wire name
|
|
127
|
+
* differs. Confirmed against real pulled wire data — aiSummarize/aiTransform
|
|
128
|
+
* name their producing task's output `response`; documentModel (rawText data
|
|
129
|
+
* source) names it `text`. Mirrors the deserializer's `OUTPUT_KEY_WIRE_NAME`
|
|
130
|
+
* (`deserializer/ref-deserializer.ts`) — keep the two in sync.
|
|
131
|
+
*/
|
|
132
|
+
const OUTPUT_KEY_WIRE_NAME = {
|
|
133
|
+
aiSummarize: "response",
|
|
134
|
+
aiTransform: "response",
|
|
135
|
+
documentModel: "text",
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Forward output-name rewrites, the inverse of the deserializer's read-side
|
|
139
|
+
* normalization (`applyOutputNameInverseRewrites` in
|
|
140
|
+
* `materialize/ref-deserializer.ts` — keep the two in sync):
|
|
141
|
+
* - recordSearch: `totalCount` → the platform's `count`.
|
|
142
|
+
* - aiAgent: `result` / `result.<field>` → the platform's
|
|
143
|
+
* `ai_agent_task_response` (text) / `ai_agent_task_structured_output.<field>` (json).
|
|
144
|
+
* - record-bearing tasks: the read path reinjects a `.record` hop on the id
|
|
145
|
+
* accessor (wire `recordId` → source `record.recordId`); collapse it back to
|
|
146
|
+
* the platform's flat `recordId` on write.
|
|
147
|
+
* - single-scalar-output tasks (see `OUTPUT_KEY_WIRE_NAME`): `output` →
|
|
148
|
+
* the platform's actual output name for that task kind.
|
|
149
|
+
*/
|
|
150
|
+
function rewriteForwardTaskRefName(taskKey, name) {
|
|
151
|
+
if (taskKey === "recordSearch" && name === "totalCount") {
|
|
152
|
+
return "count";
|
|
153
|
+
}
|
|
154
|
+
if (taskKey === "aiAgent") {
|
|
155
|
+
const segs = name.split(".");
|
|
156
|
+
if (segs[0] !== "result")
|
|
157
|
+
return name;
|
|
158
|
+
if (segs.length === 1)
|
|
159
|
+
return "ai_agent_task_response";
|
|
160
|
+
return ["ai_agent_task_structured_output", ...segs.slice(1).map((s) => s.toLowerCase())].join(".");
|
|
161
|
+
}
|
|
162
|
+
if (taskKey && RECORD_BEARING_TASK_KEYS.has(taskKey) && name === "record.recordId") {
|
|
163
|
+
return "recordId";
|
|
164
|
+
}
|
|
165
|
+
const wireOutputKey = taskKey ? OUTPUT_KEY_WIRE_NAME[taskKey] : undefined;
|
|
166
|
+
if (wireOutputKey) {
|
|
167
|
+
const segs = name.split(".");
|
|
168
|
+
if (segs[0] === "output")
|
|
169
|
+
return [wireOutputKey, ...segs.slice(1)].join(".");
|
|
170
|
+
}
|
|
171
|
+
return name;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Walk a serialized wire node and rewrite, in place, the `name` of every task
|
|
175
|
+
* output reference whose target task needs an output-name rewrite. Two wire
|
|
176
|
+
* shapes carry a task-ref name: `{ taskReference: { taskRefKey, name } }`
|
|
177
|
+
* (`core/wire/ref-serializer`'s `serializeRefData`, used at ordinary value
|
|
178
|
+
* positions) and `{ type: "TASK", taskRefKey, name }` (`core/filters`'
|
|
179
|
+
* `refDataToFilterReference`, used at filter `leftValue`/`value` positions by
|
|
180
|
+
* the `ref*` filter helpers) — both need the same rewrite. Runs at finalize,
|
|
181
|
+
* when the full refKey→kind map is known.
|
|
182
|
+
*/
|
|
183
|
+
function rewriteTaskOutputRefs(node, taskKindByRefKey) {
|
|
184
|
+
if (Array.isArray(node)) {
|
|
185
|
+
for (const item of node)
|
|
186
|
+
rewriteTaskOutputRefs(item, taskKindByRefKey);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (node === null || typeof node !== "object")
|
|
190
|
+
return;
|
|
191
|
+
const rec = node;
|
|
192
|
+
const ref = rec.taskReference;
|
|
193
|
+
if (ref && typeof ref.taskRefKey === "string" && typeof ref.name === "string") {
|
|
194
|
+
ref.name = rewriteForwardTaskRefName(taskKindByRefKey.get(ref.taskRefKey), ref.name);
|
|
195
|
+
}
|
|
196
|
+
if (rec.type === "TASK" && typeof rec.taskRefKey === "string" && typeof rec.name === "string") {
|
|
197
|
+
rec.name = rewriteForwardTaskRefName(taskKindByRefKey.get(rec.taskRefKey), rec.name);
|
|
198
|
+
}
|
|
199
|
+
for (const v of Object.values(rec))
|
|
200
|
+
rewriteTaskOutputRefs(v, taskKindByRefKey);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Walk serialized tasks and assign UUIDs to any `variable.create` entries that
|
|
204
|
+
* lack one. Returns a `"taskRefKey::varName" → uuid` map used by
|
|
205
|
+
* `resolveVariableParamMarkers` to replace `__variableParamRef` placeholders.
|
|
206
|
+
*/
|
|
207
|
+
function stampAndCollectVariableIds(tasks) {
|
|
208
|
+
const map = new Map();
|
|
209
|
+
const visit = (ts) => {
|
|
210
|
+
for (const t of ts) {
|
|
211
|
+
const refKey = t.refKey;
|
|
212
|
+
const task = t.task;
|
|
213
|
+
const variable = task?.variable;
|
|
214
|
+
if (variable?.create) {
|
|
215
|
+
for (const c of variable.create) {
|
|
216
|
+
if (!c.id)
|
|
217
|
+
c.id = randomUUID();
|
|
218
|
+
map.set(`${refKey}::${c.name}`, c.id);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
const children = t.children;
|
|
222
|
+
if (children) {
|
|
223
|
+
for (const ch of children)
|
|
224
|
+
visit(ch.tasks);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
visit(tasks);
|
|
229
|
+
return map;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Replace every `{ __variableParamRef: { variableTaskRefKey, name } }` marker
|
|
233
|
+
* in the serialized tree with `{ variableReference: { id, name: "variable|<id>" } }`.
|
|
234
|
+
* Throws when a referenced variable isn't in `idMap` — the variable must be
|
|
235
|
+
* created by a `setVariable` task in the same workflow.
|
|
236
|
+
*/
|
|
237
|
+
function resolveVariableParamMarkers(node, idMap) {
|
|
238
|
+
if (node === null || typeof node !== "object")
|
|
239
|
+
return;
|
|
240
|
+
if (Array.isArray(node)) {
|
|
241
|
+
for (const item of node)
|
|
242
|
+
resolveVariableParamMarkers(item, idMap);
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const o = node;
|
|
246
|
+
const marker = o.__variableParamRef;
|
|
247
|
+
if (marker) {
|
|
248
|
+
const key = `${marker.variableTaskRefKey}::${marker.name}`;
|
|
249
|
+
const id = idMap.get(key);
|
|
250
|
+
if (!id) {
|
|
251
|
+
throw new Error(`Variable "${marker.name}" not found on task "${marker.variableTaskRefKey}". ` +
|
|
252
|
+
`Check that a setVariable task with that refKey creates a variable with that name.`);
|
|
253
|
+
}
|
|
254
|
+
delete o.__variableParamRef;
|
|
255
|
+
o.variableReference = { id, name: `variable|${id}` };
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
for (const v of Object.values(o))
|
|
259
|
+
resolveVariableParamMarkers(v, idMap);
|
|
260
|
+
}
|
|
261
|
+
function serializeOutputValue(value) {
|
|
262
|
+
return isRef(value) ? serializeNode(value) : { value };
|
|
263
|
+
}
|
|
264
|
+
function makeWorkflowBuilder(state) {
|
|
265
|
+
const builder = {
|
|
266
|
+
task(name, fn, displayName) {
|
|
267
|
+
const ctx = buildContext(state.tasks.map((t) => t.name));
|
|
268
|
+
const def = fn(ctx);
|
|
269
|
+
return makeWorkflowBuilder({ ...state, tasks: [...state.tasks, { name, def, displayName }] });
|
|
270
|
+
},
|
|
271
|
+
executeScript(name, opts) {
|
|
272
|
+
// Sugar over the generic factory: resolve the ctx-lambda inputs, then
|
|
273
|
+
// delegate. The declared return type carries the {result: R} phantom;
|
|
274
|
+
// the factory's runtime TaskDef is shape-identical. The body is
|
|
275
|
+
// extracted HERE (not left to the factory) so the output schema can be
|
|
276
|
+
// inferred from its return literals; the generic factory itself never
|
|
277
|
+
// infers — pulled sources must emit exactly the schema the platform
|
|
278
|
+
// has, or adopted no-schema scripts would drift.
|
|
279
|
+
const body = extractScriptBody(opts.code);
|
|
280
|
+
const outputs = opts.outputs ?? inferOutputSchema(body);
|
|
281
|
+
return builder.task(name, (ctx) => executeScriptTask({
|
|
282
|
+
code: body,
|
|
283
|
+
...(opts.inputs !== undefined ? { inputs: opts.inputs(ctx) } : {}),
|
|
284
|
+
...(outputs !== undefined ? { outputs } : {}),
|
|
285
|
+
}));
|
|
286
|
+
},
|
|
287
|
+
setVariable(name, opts) {
|
|
288
|
+
return builder.task(name, (ctx) => setVariableTask({
|
|
289
|
+
create: [{ name, type: opts.type ?? "TEXT", value: opts.value(ctx) }],
|
|
290
|
+
}));
|
|
291
|
+
},
|
|
292
|
+
outputs(fn) {
|
|
293
|
+
const ctx = buildContext(state.tasks.map((t) => t.name));
|
|
294
|
+
const map = fn(ctx);
|
|
295
|
+
const outputs = Object.entries(map).map(([name, value]) => ({
|
|
296
|
+
name,
|
|
297
|
+
value: serializeOutputValue(value),
|
|
298
|
+
}));
|
|
299
|
+
return makeWorkflowBuilder({ ...state, outputs });
|
|
300
|
+
},
|
|
301
|
+
__triggerParams() {
|
|
302
|
+
return state.trigger.__params ?? [];
|
|
303
|
+
},
|
|
304
|
+
__outputNames() {
|
|
305
|
+
return state.outputs?.map((o) => o.name) ?? [];
|
|
306
|
+
},
|
|
307
|
+
__finalize() {
|
|
308
|
+
const taskKindByRefKey = collectTaskKinds(state.tasks);
|
|
309
|
+
const tasks = state.tasks.map((t) => serializeTaskEntry(t.name, t.def, t.displayName));
|
|
310
|
+
const outputs = state.outputs?.map((o) => ({ ...o }));
|
|
311
|
+
rewriteTaskOutputRefs(tasks, taskKindByRefKey);
|
|
312
|
+
if (outputs)
|
|
313
|
+
rewriteTaskOutputRefs(outputs, taskKindByRefKey);
|
|
314
|
+
// Trigger reference names are NOT canonicalized: the authored name is
|
|
315
|
+
// the name, everywhere in EDK. (Mobius canonicalizes reference names in
|
|
316
|
+
// ITS storage — `ValueReference.ofTriggerReference` — but on the tf
|
|
317
|
+
// path the provider mints references from the trigger's refs map, which
|
|
318
|
+
// is keyed by DECLARED parameter names, so the canonical form never
|
|
319
|
+
// crosses EDK's boundary. The old canonicalize-then-reverse-map dance
|
|
320
|
+
// existed for the legacy compose path and mangled ALL-CAPS names.)
|
|
321
|
+
const variableIdMap = stampAndCollectVariableIds(tasks);
|
|
322
|
+
if (variableIdMap.size > 0) {
|
|
323
|
+
resolveVariableParamMarkers(tasks, variableIdMap);
|
|
324
|
+
if (outputs)
|
|
325
|
+
resolveVariableParamMarkers(outputs, variableIdMap);
|
|
326
|
+
}
|
|
327
|
+
const taskAppRefNameByRefKey = collectRecordApps(state.tasks);
|
|
328
|
+
const recordFieldContext = state.trigger.__recordApp !== undefined || Object.keys(taskAppRefNameByRefKey).length > 0
|
|
329
|
+
? {
|
|
330
|
+
...(state.trigger.__recordApp !== undefined ? { triggerAppRefName: state.trigger.__recordApp } : {}),
|
|
331
|
+
...(Object.keys(taskAppRefNameByRefKey).length > 0 ? { taskAppRefNameByRefKey } : {}),
|
|
332
|
+
}
|
|
333
|
+
: undefined;
|
|
334
|
+
return {
|
|
335
|
+
trigger: serializeNode(state.trigger.wire),
|
|
336
|
+
tasks,
|
|
337
|
+
...(outputs && outputs.length > 0 ? { outputProperties: { outputs } } : {}),
|
|
338
|
+
...(recordFieldContext !== undefined ? { recordFieldContext } : {}),
|
|
339
|
+
};
|
|
340
|
+
},
|
|
341
|
+
};
|
|
342
|
+
return builder;
|
|
343
|
+
}
|
|
344
|
+
/** Wrap a TriggerDef so it doubles as the chain start. Used by the trigger factories. */
|
|
345
|
+
export function chainableTrigger(trigger) {
|
|
346
|
+
return { ...trigger, ...makeWorkflowBuilder({ trigger, tasks: [] }) };
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Begin a workflow body. Set a trigger, chain `.task(...)`, optionally close
|
|
350
|
+
* with `.outputs(...)`, then assign the result to `defineAutomation`'s
|
|
351
|
+
* `workflow:` field — no terminal `.build()`.
|
|
352
|
+
*/
|
|
353
|
+
export function defineWorkflow() {
|
|
354
|
+
return {
|
|
355
|
+
trigger(trigger) {
|
|
356
|
+
return makeWorkflowBuilder({ trigger, tasks: [] });
|
|
357
|
+
},
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Define a v2 automation. Identity comes from the authoring file's `refName`
|
|
362
|
+
* plus `parent`; the display `name` lives only in the payload, so renaming an
|
|
363
|
+
* automation plans as an update rather than a create. Returns an
|
|
364
|
+
* `AutomationConfigured` with `ref(refName)` and `def(refName)`.
|
|
365
|
+
*/
|
|
366
|
+
export function defineAutomation(opts) {
|
|
367
|
+
return {
|
|
368
|
+
ref(refName) {
|
|
369
|
+
const triggerParams = opts.workflow.__triggerParams();
|
|
370
|
+
const outputNames = opts.workflow.__outputNames();
|
|
371
|
+
// Bag keys are the DECLARED names, verbatim (no canonicalization —
|
|
372
|
+
// access non-identifier names with brackets: trigger["STUDENT NAME 2"]).
|
|
373
|
+
// `required: true` is stamped only when true (canonical form) — it is
|
|
374
|
+
// what agentRunAutomation's typed inputs and def() validation read.
|
|
375
|
+
const trigger = triggerParams.length > 0
|
|
376
|
+
? Object.fromEntries(triggerParams.map((p) => [
|
|
377
|
+
p.name,
|
|
378
|
+
{
|
|
379
|
+
__kind: "triggerParameter",
|
|
380
|
+
refName: p.name,
|
|
381
|
+
name: p.name,
|
|
382
|
+
parent: refName,
|
|
383
|
+
...(p.required ? { required: true } : {}),
|
|
384
|
+
},
|
|
385
|
+
]))
|
|
386
|
+
: undefined;
|
|
387
|
+
const outputs = outputNames.length > 0
|
|
388
|
+
? Object.fromEntries(outputNames.map((n) => [n, { __kind: "outputProperty", refName: n, name: n, parent: refName }]))
|
|
389
|
+
: undefined;
|
|
390
|
+
return {
|
|
391
|
+
__kind: "automation",
|
|
392
|
+
refName: refName,
|
|
393
|
+
name: opts.name,
|
|
394
|
+
parent: opts.parent,
|
|
395
|
+
...(trigger !== undefined ? { trigger } : {}),
|
|
396
|
+
...(outputs !== undefined ? { outputs } : {}),
|
|
397
|
+
};
|
|
398
|
+
},
|
|
399
|
+
def(refName) {
|
|
400
|
+
const wf = opts.workflow.__finalize();
|
|
401
|
+
// `recordFieldContext` is a structural extension, not a declared `DeployableEntity`
|
|
402
|
+
// property (see `RecordFieldContext`'s doc comment) — assigning to `entity`
|
|
403
|
+
// first (rather than returning the literal directly) avoids an excess-property
|
|
404
|
+
// error against the `DeployableEntity` return type while still attaching it for
|
|
405
|
+
// `recordFieldContextOf` to read back at deploy time.
|
|
406
|
+
const entity = {
|
|
407
|
+
kind: "automation",
|
|
408
|
+
parent: opts.parent,
|
|
409
|
+
refName,
|
|
410
|
+
payload: {
|
|
411
|
+
name: opts.name,
|
|
412
|
+
status: opts.status ?? "DRAFT",
|
|
413
|
+
workflowRevision: opts.workflowRevision ?? "1.0.0",
|
|
414
|
+
trigger: wf.trigger,
|
|
415
|
+
tasks: wf.tasks,
|
|
416
|
+
...(wf.outputProperties ? { outputProperties: wf.outputProperties } : {}),
|
|
417
|
+
},
|
|
418
|
+
...(opts.enabled !== undefined ? { enabled: opts.enabled } : {}),
|
|
419
|
+
...(wf.recordFieldContext !== undefined ? { recordFieldContext: wf.recordFieldContext } : {}),
|
|
420
|
+
};
|
|
421
|
+
return entity;
|
|
422
|
+
},
|
|
423
|
+
};
|
|
424
|
+
}
|