@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,633 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function-form `code:` for executeScript (authoring v3).
|
|
3
|
+
*
|
|
4
|
+
* The platform's script contract (Hydra AddExecuteScriptActionInternalToolProvider):
|
|
5
|
+
* the code is a top-level script body with `input` in scope — inputs are read
|
|
6
|
+
* via `input.parameters.<name>`, and the script MUST `return` a plain object;
|
|
7
|
+
* downstream refs read `result.<key>`. So an authored
|
|
8
|
+
*
|
|
9
|
+
* code: (input) => { const { X } = input.parameters; return { OUT: X }; }
|
|
10
|
+
*
|
|
11
|
+
* ships as the function's BODY. `code:` is ALWAYS a real function — #125
|
|
12
|
+
* deliberately banned a raw-string alternative so pulled automations stay
|
|
13
|
+
* editable TypeScript, not opaque blobs.
|
|
14
|
+
*
|
|
15
|
+
* Two authoring hazards, handled here:
|
|
16
|
+
* - CLOSURES CANNOT SURVIVE: `const x = 5; code: () => ({v: x})` serializes the
|
|
17
|
+
* reference, not the value — on the platform `x` is undefined. A best-effort
|
|
18
|
+
* free-identifier scan throws at def() time on obvious captures (per the
|
|
19
|
+
* tranche decision: best effort, not a guarantee).
|
|
20
|
+
* - WHAT YOU AUTHOR IS TRANSPILED FIRST: jiti/Babel strip type annotations by
|
|
21
|
+
* fully re-printing the function from its AST, which normalizes formatting
|
|
22
|
+
* (`{done: true}` becomes `{ done: true }`) regardless of the original
|
|
23
|
+
* source's spacing. `Function.prototype.toString()` only ever sees that
|
|
24
|
+
* reprinted form. For a HAND-authored script this is harmless (there is no
|
|
25
|
+
* "original" spacing to preserve — the author's intent survives). For a
|
|
26
|
+
* PULLED script it's lossy: the platform's exact text stops matching after
|
|
27
|
+
* one `edk build`, producing a spurious plan diff forever.
|
|
28
|
+
*
|
|
29
|
+
* `elementum build` avoids that loss for pulled scripts WITHOUT relying on
|
|
30
|
+
* `toString()` at all: `src/engine/build/build.ts` wraps each automation
|
|
31
|
+
* file's jiti import with that file's own untranspiled text (engine-side,
|
|
32
|
+
* entity-agnostic — `source-context.ts`), and `tryExtractFromCurrentSource`
|
|
33
|
+
* here locates the matching `.executeScript("name", { code: (input) => {...}
|
|
34
|
+
* })` (or nested `childTask("name", executeScript({...}))`) call by a
|
|
35
|
+
* lightweight source scan — the same string/comment-aware tokenizing already
|
|
36
|
+
* used by {@link inferOutputSchema} — and slices the body's ORIGINAL text directly out
|
|
37
|
+
* of the file, never touching the transpiled function. `extractScriptBody`
|
|
38
|
+
* (the `toString()` path) remains the fallback for contexts with no tracked
|
|
39
|
+
* source (tests constructing automations directly, nested childTask bodies).
|
|
40
|
+
*/
|
|
41
|
+
import { currentSourceText } from "../../engine/build/source-context.js";
|
|
42
|
+
/** Globals a script body may legitimately reference on the platform runtime. */
|
|
43
|
+
const SCRIPT_GLOBALS = new Set([
|
|
44
|
+
"input",
|
|
45
|
+
"result",
|
|
46
|
+
"console",
|
|
47
|
+
"JSON",
|
|
48
|
+
"Math",
|
|
49
|
+
"Date",
|
|
50
|
+
"Object",
|
|
51
|
+
"Array",
|
|
52
|
+
"String",
|
|
53
|
+
"Number",
|
|
54
|
+
"Boolean",
|
|
55
|
+
"RegExp",
|
|
56
|
+
"Map",
|
|
57
|
+
"Set",
|
|
58
|
+
"Promise",
|
|
59
|
+
"Error",
|
|
60
|
+
"TypeError",
|
|
61
|
+
"RangeError",
|
|
62
|
+
"parseInt",
|
|
63
|
+
"parseFloat",
|
|
64
|
+
"isNaN",
|
|
65
|
+
"isFinite",
|
|
66
|
+
"encodeURIComponent",
|
|
67
|
+
"decodeURIComponent",
|
|
68
|
+
"undefined",
|
|
69
|
+
"NaN",
|
|
70
|
+
"Infinity",
|
|
71
|
+
"Intl",
|
|
72
|
+
"Symbol",
|
|
73
|
+
"BigInt",
|
|
74
|
+
"structuredClone",
|
|
75
|
+
"atob",
|
|
76
|
+
"btoa",
|
|
77
|
+
]);
|
|
78
|
+
const KEYWORDS = new Set([
|
|
79
|
+
"const", "let", "var", "function", "class", "return", "if", "else", "for", "while", "do",
|
|
80
|
+
"switch", "case", "default", "break", "continue", "new", "delete", "typeof", "instanceof",
|
|
81
|
+
"in", "of", "try", "catch", "finally", "throw", "void", "this", "null", "true", "false",
|
|
82
|
+
"async", "await", "yield", "static", "get", "set", "extends", "super",
|
|
83
|
+
]);
|
|
84
|
+
export class ScriptCodeError extends Error {
|
|
85
|
+
constructor(message) {
|
|
86
|
+
super(message);
|
|
87
|
+
this.name = "ScriptCodeError";
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Extract the platform script body from an authored code function. Accepts the
|
|
92
|
+
* shapes a transpiler emits for `(input) => …`: arrow with block body, arrow
|
|
93
|
+
* with expression body (wrapped into a `return`), and `function` declarations.
|
|
94
|
+
*/
|
|
95
|
+
export function extractScriptBody(fn) {
|
|
96
|
+
const src = fn.toString().trim();
|
|
97
|
+
// function (input) { body } / function name(input) { body }
|
|
98
|
+
let m = /^(?:async\s+)?function\b[^(]*\(([^)]*)\)\s*\{([\s\S]*)\}$/.exec(src);
|
|
99
|
+
if (m !== undefined && m !== null)
|
|
100
|
+
return finishBody(m[2] ?? "", m[1] ?? "", src);
|
|
101
|
+
// (input) => { body } / input => { body }
|
|
102
|
+
m = /^(?:async\s+)?(?:\(([^)]*)\)|([A-Za-z_$][\w$]*))\s*=>\s*\{([\s\S]*)\}$/.exec(src);
|
|
103
|
+
if (m !== undefined && m !== null)
|
|
104
|
+
return finishBody(m[3] ?? "", m[1] ?? m[2] ?? "", src);
|
|
105
|
+
// (input) => expr — wrap into a return. `(input) => ({...})` included.
|
|
106
|
+
m = /^(?:async\s+)?(?:\(([^)]*)\)|([A-Za-z_$][\w$]*))\s*=>\s*([\s\S]+)$/.exec(src);
|
|
107
|
+
if (m !== undefined && m !== null) {
|
|
108
|
+
const expr = (m[3] ?? "").trim();
|
|
109
|
+
return finishBody(`return ${expr};`, m[1] ?? m[2] ?? "", src);
|
|
110
|
+
}
|
|
111
|
+
throw new ScriptCodeError("executeScript code: could not extract a script body from the function source — " +
|
|
112
|
+
"author it as `(input) => { ... return {...}; }`.");
|
|
113
|
+
}
|
|
114
|
+
function finishBody(rawBody, rawParams, fullSrc) {
|
|
115
|
+
const body = dedent(rawBody.replace(/^\n+/, "").replace(/\s+$/, ""));
|
|
116
|
+
const params = collectParamNames(rawParams);
|
|
117
|
+
const unknown = freeIdentifiers(body, params);
|
|
118
|
+
if (unknown.length > 0) {
|
|
119
|
+
throw new ScriptCodeError(`executeScript code references identifier(s) not defined inside the script: ${unknown.join(", ")}. ` +
|
|
120
|
+
"The function is serialized to TEXT and runs on the platform — closures over outer variables " +
|
|
121
|
+
"cannot survive. Read inputs via `input.parameters.<name>` (declare them in `inputs:`), or " +
|
|
122
|
+
"inline the value.\n--- function source ---\n" +
|
|
123
|
+
fullSrc);
|
|
124
|
+
}
|
|
125
|
+
return body;
|
|
126
|
+
}
|
|
127
|
+
/** Parameter identifiers, including destructured ones (best effort). */
|
|
128
|
+
function collectParamNames(params) {
|
|
129
|
+
const names = new Set();
|
|
130
|
+
for (const m of params.matchAll(/[A-Za-z_$][\w$]*/g))
|
|
131
|
+
names.add(m[0]);
|
|
132
|
+
return names;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Infer the executeScript output schema (property name → authoring type
|
|
136
|
+
* alias) from the script body's `return {...}` object literals — the runtime
|
|
137
|
+
* half of what the `code` function's TS return type already gives the type
|
|
138
|
+
* system. Same best-effort contract as the closure scan:
|
|
139
|
+
*
|
|
140
|
+
* - every `return`ed object literal contributes its top-level keys; multiple
|
|
141
|
+
* returns merge (a key typed differently across branches widens to "text")
|
|
142
|
+
* - value types come from LITERAL values only: string/template → "text",
|
|
143
|
+
* integral number → "integer", other number → "number", true/false →
|
|
144
|
+
* "boolean"; any other expression defaults to "text"
|
|
145
|
+
* - a return that is NOT a statically enumerable object literal (returning a
|
|
146
|
+
* variable, a call, a literal with spread/computed keys) makes the whole
|
|
147
|
+
* inference bail — returns undefined, meaning NO schema is emitted. Using
|
|
148
|
+
* `result.<prop>` refs downstream then fails at build with the explicit
|
|
149
|
+
* `outputs:` fix-it. The explicit `outputs` option always overrides.
|
|
150
|
+
*
|
|
151
|
+
* The scan is context-aware (skips comments, strings, and template literals
|
|
152
|
+
* with `${}` nesting) so braces inside them don't derail the literal walk.
|
|
153
|
+
*/
|
|
154
|
+
export function inferOutputSchema(body) {
|
|
155
|
+
const merged = {};
|
|
156
|
+
let found = false;
|
|
157
|
+
const src = body;
|
|
158
|
+
const n = src.length;
|
|
159
|
+
let i = 0;
|
|
160
|
+
while (i < n) {
|
|
161
|
+
i = skipNonCode(src, i);
|
|
162
|
+
const c = src[i];
|
|
163
|
+
if (c === undefined)
|
|
164
|
+
break;
|
|
165
|
+
if (c === '"' || c === "'" || c === "`") {
|
|
166
|
+
i = skipString(src, i);
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
if (src.startsWith("return", i) &&
|
|
170
|
+
!/[A-Za-z0-9_$]/.test(src[i + 6] ?? "") &&
|
|
171
|
+
!/[A-Za-z0-9_$.]/.test(src[i - 1] ?? "")) {
|
|
172
|
+
let j = skipWs(src, i + 6);
|
|
173
|
+
while (src[j] === "(")
|
|
174
|
+
j = skipWs(src, j + 1);
|
|
175
|
+
if (src[j] !== "{")
|
|
176
|
+
return undefined; // non-literal return → bail
|
|
177
|
+
const lit = parseReturnedLiteral(src, j);
|
|
178
|
+
if (lit === undefined)
|
|
179
|
+
return undefined; // spread/computed key → bail
|
|
180
|
+
for (const [key, type] of lit.entries) {
|
|
181
|
+
merged[key] = merged[key] !== undefined && merged[key] !== type ? "text" : type;
|
|
182
|
+
}
|
|
183
|
+
found = true;
|
|
184
|
+
i = lit.end; // trailing `)`s are skipped by the scan loop
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
i += 1;
|
|
188
|
+
}
|
|
189
|
+
return found ? merged : undefined;
|
|
190
|
+
}
|
|
191
|
+
/** Skip whitespace and comments. */
|
|
192
|
+
function skipWs(src, i) {
|
|
193
|
+
for (;;) {
|
|
194
|
+
while (i < src.length && /\s/.test(src[i]))
|
|
195
|
+
i += 1;
|
|
196
|
+
const j = skipNonCode(src, i);
|
|
197
|
+
if (j === i)
|
|
198
|
+
return i;
|
|
199
|
+
i = j;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/** If `i` starts a comment, skip past it (idempotent otherwise). */
|
|
203
|
+
function skipNonCode(src, i) {
|
|
204
|
+
if (src.startsWith("//", i)) {
|
|
205
|
+
const nl = src.indexOf("\n", i);
|
|
206
|
+
return nl === -1 ? src.length : nl + 1;
|
|
207
|
+
}
|
|
208
|
+
if (src.startsWith("/*", i)) {
|
|
209
|
+
const close = src.indexOf("*/", i + 2);
|
|
210
|
+
return close === -1 ? src.length : close + 2;
|
|
211
|
+
}
|
|
212
|
+
return i;
|
|
213
|
+
}
|
|
214
|
+
/** Skip a string/template starting at `i` (which must be a quote char); returns the index after it. */
|
|
215
|
+
function skipString(src, i) {
|
|
216
|
+
const quote = src[i];
|
|
217
|
+
let j = i + 1;
|
|
218
|
+
while (j < src.length) {
|
|
219
|
+
const c = src[j];
|
|
220
|
+
if (c === "\\") {
|
|
221
|
+
j += 2;
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (c === quote)
|
|
225
|
+
return j + 1;
|
|
226
|
+
if (quote === "`" && c === "$" && src[j + 1] === "{") {
|
|
227
|
+
// ${…} — nested expression; balance braces (strings inside recurse).
|
|
228
|
+
let depth = 1;
|
|
229
|
+
j += 2;
|
|
230
|
+
while (j < src.length && depth > 0) {
|
|
231
|
+
const d = src[j];
|
|
232
|
+
if (d === '"' || d === "'" || d === "`")
|
|
233
|
+
j = skipString(src, j);
|
|
234
|
+
else {
|
|
235
|
+
if (d === "{")
|
|
236
|
+
depth += 1;
|
|
237
|
+
if (d === "}")
|
|
238
|
+
depth -= 1;
|
|
239
|
+
j += 1;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
j += 1;
|
|
245
|
+
}
|
|
246
|
+
return j;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Parse the object literal starting at src[open] === "{". Returns its
|
|
250
|
+
* top-level entries as [key, typeAlias] pairs and the index just past the
|
|
251
|
+
* closing brace — or undefined if the literal isn't statically enumerable.
|
|
252
|
+
*/
|
|
253
|
+
function parseReturnedLiteral(src, open) {
|
|
254
|
+
const entries = [];
|
|
255
|
+
let i = open + 1;
|
|
256
|
+
for (;;) {
|
|
257
|
+
i = skipWs(src, i);
|
|
258
|
+
if (i >= src.length)
|
|
259
|
+
return undefined;
|
|
260
|
+
if (src[i] === "}")
|
|
261
|
+
return { entries, end: i + 1 };
|
|
262
|
+
if (src[i] === ",") {
|
|
263
|
+
i += 1;
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
if (src.startsWith("...", i))
|
|
267
|
+
return undefined; // spread — can't enumerate
|
|
268
|
+
if (src[i] === "[")
|
|
269
|
+
return undefined; // computed key
|
|
270
|
+
// Key: identifier or quoted string.
|
|
271
|
+
let key;
|
|
272
|
+
if (src[i] === '"' || src[i] === "'") {
|
|
273
|
+
const end = skipString(src, i);
|
|
274
|
+
key = src.slice(i + 1, end - 1);
|
|
275
|
+
i = end;
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
const m = /^[A-Za-z_$][\w$]*/.exec(src.slice(i));
|
|
279
|
+
if (m === null)
|
|
280
|
+
return undefined;
|
|
281
|
+
key = m[0];
|
|
282
|
+
i += key.length;
|
|
283
|
+
}
|
|
284
|
+
i = skipWs(src, i);
|
|
285
|
+
if (src[i] !== ":") {
|
|
286
|
+
// Shorthand ({ FOO }) or method — shorthand contributes text; methods bail.
|
|
287
|
+
if (src[i] === "," || src[i] === "}") {
|
|
288
|
+
entries.push([key, "text"]);
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
return undefined;
|
|
292
|
+
}
|
|
293
|
+
i += 1;
|
|
294
|
+
// Value: capture the expression text up to the next top-level , or }.
|
|
295
|
+
const valueStart = skipWs(src, i);
|
|
296
|
+
let depth = 0;
|
|
297
|
+
let j = valueStart;
|
|
298
|
+
while (j < src.length) {
|
|
299
|
+
j = skipNonCode(src, j);
|
|
300
|
+
const c = src[j];
|
|
301
|
+
if (c === undefined)
|
|
302
|
+
return undefined;
|
|
303
|
+
if (c === '"' || c === "'" || c === "`") {
|
|
304
|
+
j = skipString(src, j);
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
if (c === "(" || c === "[" || c === "{")
|
|
308
|
+
depth += 1;
|
|
309
|
+
else if (c === ")" || c === "]")
|
|
310
|
+
depth -= 1;
|
|
311
|
+
else if (c === "}") {
|
|
312
|
+
if (depth === 0)
|
|
313
|
+
break;
|
|
314
|
+
depth -= 1;
|
|
315
|
+
}
|
|
316
|
+
else if (c === "," && depth === 0)
|
|
317
|
+
break;
|
|
318
|
+
j += 1;
|
|
319
|
+
}
|
|
320
|
+
entries.push([key, classifyValueExpr(src.slice(valueStart, j).trim())]);
|
|
321
|
+
i = j;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
/** Literal-based type alias for a value expression; anything non-literal is "text". */
|
|
325
|
+
function classifyValueExpr(expr) {
|
|
326
|
+
if (/^-?\d+$/.test(expr))
|
|
327
|
+
return "integer";
|
|
328
|
+
if (/^-?(?:\d+\.\d*|\.\d+)(?:[eE][+-]?\d+)?$/.test(expr) || /^-?\d+[eE][+-]?\d+$/.test(expr))
|
|
329
|
+
return "number";
|
|
330
|
+
if (expr === "true" || expr === "false")
|
|
331
|
+
return "boolean";
|
|
332
|
+
return "text";
|
|
333
|
+
}
|
|
334
|
+
/** Strip the common leading indentation (the flush-left fixed point survives ei's heredoc round trip). */
|
|
335
|
+
function dedent(body) {
|
|
336
|
+
const lines = body.split("\n");
|
|
337
|
+
const indents = lines.filter((l) => l.trim() !== "").map((l) => /^\s*/.exec(l)[0].length);
|
|
338
|
+
const min = indents.length > 0 ? Math.min(...indents) : 0;
|
|
339
|
+
return lines.map((l) => (l.trim() === "" ? "" : l.slice(min))).join("\n");
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Best-effort free-identifier scan: strip comments/strings/templates, collect
|
|
343
|
+
* identifier tokens that are not property accesses, object keys, declarations,
|
|
344
|
+
* params, keywords, or known script globals.
|
|
345
|
+
*/
|
|
346
|
+
export function freeIdentifiers(body, params) {
|
|
347
|
+
const stripped = body
|
|
348
|
+
.replace(/\/\*[\s\S]*?\*\//g, " ")
|
|
349
|
+
.replace(/\/\/[^\n]*/g, " ")
|
|
350
|
+
.replace(/`(?:\\.|\$\{[^}]*\}|[^`\\])*`/g, '""') // templates: keep ${} contents out (best effort)
|
|
351
|
+
.replace(/'(?:\\.|[^'\\])*'/g, '""')
|
|
352
|
+
.replace(/"(?:\\.|[^"\\])*"/g, '""');
|
|
353
|
+
const declared = new Set(params);
|
|
354
|
+
// const/let/var declarations, incl. destructuring lists; function/class names.
|
|
355
|
+
for (const m of stripped.matchAll(/\b(?:const|let|var)\s+([^=;]+)/g)) {
|
|
356
|
+
for (const id of (m[1] ?? "").matchAll(/[A-Za-z_$][\w$]*/g))
|
|
357
|
+
declared.add(id[0]);
|
|
358
|
+
}
|
|
359
|
+
for (const m of stripped.matchAll(/\b(?:function|class)\s+([A-Za-z_$][\w$]*)/g))
|
|
360
|
+
declared.add(m[1]);
|
|
361
|
+
// catch (e) / for (const x of ...) already covered by const/let/var; arrow params inside:
|
|
362
|
+
for (const m of stripped.matchAll(/\(([^)]*)\)\s*=>/g)) {
|
|
363
|
+
for (const id of (m[1] ?? "").matchAll(/[A-Za-z_$][\w$]*/g))
|
|
364
|
+
declared.add(id[0]);
|
|
365
|
+
}
|
|
366
|
+
for (const m of stripped.matchAll(/\bcatch\s*\(([^)]*)\)/g)) {
|
|
367
|
+
for (const id of (m[1] ?? "").matchAll(/[A-Za-z_$][\w$]*/g))
|
|
368
|
+
declared.add(id[0]);
|
|
369
|
+
}
|
|
370
|
+
const unknown = new Set();
|
|
371
|
+
const idRe = /[A-Za-z_$][\w$]*/g;
|
|
372
|
+
let match;
|
|
373
|
+
while ((match = idRe.exec(stripped)) !== null) {
|
|
374
|
+
const id = match[0];
|
|
375
|
+
const before = stripped.slice(0, match.index);
|
|
376
|
+
const after = stripped.slice(match.index + id.length);
|
|
377
|
+
if (/[.]\s*$/.test(before))
|
|
378
|
+
continue; // property access: a.b
|
|
379
|
+
if (/^\s*:/.test(after) && !/\?\s*$/.test(before))
|
|
380
|
+
continue; // object key: {b: ...} (not ternary)
|
|
381
|
+
if (KEYWORDS.has(id) || SCRIPT_GLOBALS.has(id) || declared.has(id))
|
|
382
|
+
continue;
|
|
383
|
+
unknown.add(id);
|
|
384
|
+
}
|
|
385
|
+
return [...unknown].sort();
|
|
386
|
+
}
|
|
387
|
+
// ---------------------------------------------------------------------------
|
|
388
|
+
// Byte-exact body extraction from untranspiled source (elementum build only)
|
|
389
|
+
// ---------------------------------------------------------------------------
|
|
390
|
+
/** Per-context (by object identity) cache of `scanExecuteScriptBodies`'s result — parse each file once. */
|
|
391
|
+
const scanCache = new WeakMap();
|
|
392
|
+
/**
|
|
393
|
+
* Look up task `name`'s `code:` body verbatim from the automation file
|
|
394
|
+
* `elementum build` is currently importing (tracked engine-side by
|
|
395
|
+
* `withSourceText` around each own-file-child's `jiti.import()` —
|
|
396
|
+
* `src/engine/build/build.ts`/`source-context.ts`), or `undefined` if
|
|
397
|
+
* there's no tracked source (not running under `elementum build`, e.g. an
|
|
398
|
+
* automation constructed directly in a test) or the name/shape wasn't found
|
|
399
|
+
* by the scan (falls back to `extractScriptBody`).
|
|
400
|
+
*/
|
|
401
|
+
export function tryExtractFromCurrentSource(name) {
|
|
402
|
+
const ctx = currentSourceText();
|
|
403
|
+
if (ctx === undefined)
|
|
404
|
+
return undefined;
|
|
405
|
+
let bodies = scanCache.get(ctx);
|
|
406
|
+
if (bodies === undefined) {
|
|
407
|
+
bodies = scanExecuteScriptBodies(ctx.text);
|
|
408
|
+
scanCache.set(ctx, bodies);
|
|
409
|
+
}
|
|
410
|
+
return bodies.get(name);
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Scan raw (untranspiled) `.ts` source text for every top-level
|
|
414
|
+
* `.executeScript("name", {...})` call and nested
|
|
415
|
+
* `childTask("name", executeScript({...}))` call, extracting each one's
|
|
416
|
+
* `code:` function body VERBATIM. Reuses this file's own comment/string-aware
|
|
417
|
+
* tokenizing ({@link skipNonCode}/{@link skipString}) rather than a full
|
|
418
|
+
* parser — the input is EDK's own printer output (a predictable shape) plus
|
|
419
|
+
* reasonable hand-edits, not arbitrary JavaScript. A call whose shape doesn't
|
|
420
|
+
* match is simply omitted, not an error — the caller falls back to
|
|
421
|
+
* `extractScriptBody`.
|
|
422
|
+
*/
|
|
423
|
+
function scanExecuteScriptBodies(src) {
|
|
424
|
+
const result = new Map();
|
|
425
|
+
const n = src.length;
|
|
426
|
+
let i = 0;
|
|
427
|
+
while (i < n) {
|
|
428
|
+
i = skipNonCode(src, i);
|
|
429
|
+
const c = src[i];
|
|
430
|
+
if (c === undefined)
|
|
431
|
+
break;
|
|
432
|
+
if (c === '"' || c === "'" || c === "`") {
|
|
433
|
+
i = skipString(src, i);
|
|
434
|
+
continue;
|
|
435
|
+
}
|
|
436
|
+
if (isIdentifierBoundaryMatch(src, i, "executeScript")) {
|
|
437
|
+
const openParen = skipWs(src, i + "executeScript".length);
|
|
438
|
+
if (src[openParen] === "(") {
|
|
439
|
+
const call = scanCallArgs(src, openParen);
|
|
440
|
+
if (call !== undefined && call.args.length >= 2) {
|
|
441
|
+
const name = unquoteIfStringLiteral(call.args[0]);
|
|
442
|
+
if (name !== undefined) {
|
|
443
|
+
const body = extractCodeBody(call.args[1]);
|
|
444
|
+
if (body !== undefined)
|
|
445
|
+
result.set(name, dedent(body.replace(/^\n+/, "").replace(/\s+$/, "")));
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
if (isIdentifierBoundaryMatch(src, i, "childTask")) {
|
|
451
|
+
const openParen = skipWs(src, i + "childTask".length);
|
|
452
|
+
if (src[openParen] === "(") {
|
|
453
|
+
const call = scanCallArgs(src, openParen);
|
|
454
|
+
if (call !== undefined && call.args.length >= 2) {
|
|
455
|
+
const name = unquoteIfStringLiteral(call.args[0]);
|
|
456
|
+
const inner = call.args[1].trim();
|
|
457
|
+
const innerOpen = "executeScript".length;
|
|
458
|
+
if (name !== undefined && inner.startsWith("executeScript") && inner[innerOpen] === "(" && inner.endsWith(")")) {
|
|
459
|
+
const body = extractCodeBody(inner.slice(innerOpen + 1, -1));
|
|
460
|
+
if (body !== undefined)
|
|
461
|
+
result.set(name, dedent(body.replace(/^\n+/, "").replace(/\s+$/, "")));
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
i += 1;
|
|
467
|
+
}
|
|
468
|
+
return result;
|
|
469
|
+
}
|
|
470
|
+
/** True if `src` has identifier `name` starting at `i`, not as a substring of a longer identifier. */
|
|
471
|
+
function isIdentifierBoundaryMatch(src, i, name) {
|
|
472
|
+
return src.startsWith(name, i) && !/[A-Za-z0-9_$]/.test(src[i - 1] ?? "") && !/[A-Za-z0-9_$]/.test(src[i + name.length] ?? "");
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Parse a balanced `(...)` argument list starting at `src[open] === "("`.
|
|
476
|
+
* Returns each top-level, comma-separated argument's raw text (untrimmed
|
|
477
|
+
* boundaries trimmed) — undefined if unbalanced before the string ends.
|
|
478
|
+
*/
|
|
479
|
+
function scanCallArgs(src, open) {
|
|
480
|
+
const args = [];
|
|
481
|
+
let depth = 0;
|
|
482
|
+
let argStart = open + 1;
|
|
483
|
+
let i = open + 1;
|
|
484
|
+
while (i < src.length) {
|
|
485
|
+
i = skipNonCode(src, i);
|
|
486
|
+
const c = src[i];
|
|
487
|
+
if (c === undefined)
|
|
488
|
+
return undefined;
|
|
489
|
+
if (c === '"' || c === "'" || c === "`") {
|
|
490
|
+
i = skipString(src, i);
|
|
491
|
+
continue;
|
|
492
|
+
}
|
|
493
|
+
if (c === "(" || c === "[" || c === "{") {
|
|
494
|
+
depth += 1;
|
|
495
|
+
i += 1;
|
|
496
|
+
continue;
|
|
497
|
+
}
|
|
498
|
+
if (c === ")" && depth === 0) {
|
|
499
|
+
const arg = src.slice(argStart, i).trim();
|
|
500
|
+
if (arg.length > 0 || args.length > 0)
|
|
501
|
+
args.push(arg);
|
|
502
|
+
return { args };
|
|
503
|
+
}
|
|
504
|
+
if (c === ")" || c === "]" || c === "}") {
|
|
505
|
+
depth -= 1;
|
|
506
|
+
i += 1;
|
|
507
|
+
continue;
|
|
508
|
+
}
|
|
509
|
+
if (c === "," && depth === 0) {
|
|
510
|
+
args.push(src.slice(argStart, i).trim());
|
|
511
|
+
argStart = i + 1;
|
|
512
|
+
i += 1;
|
|
513
|
+
continue;
|
|
514
|
+
}
|
|
515
|
+
i += 1;
|
|
516
|
+
}
|
|
517
|
+
return undefined;
|
|
518
|
+
}
|
|
519
|
+
/** Unwrap a `"..."` / `'...'` / `` `...` `` string-literal argument's raw text; undefined if not a plain string literal. */
|
|
520
|
+
function unquoteIfStringLiteral(text) {
|
|
521
|
+
const t = text.trim();
|
|
522
|
+
if (t.length < 2)
|
|
523
|
+
return undefined;
|
|
524
|
+
const q = t[0];
|
|
525
|
+
if ((q === '"' || q === "'" || q === "`") && t[t.length - 1] === q) {
|
|
526
|
+
return t.slice(1, -1).replace(/\\(.)/g, "$1");
|
|
527
|
+
}
|
|
528
|
+
return undefined;
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Given the raw text of an `executeScript(...)` options object literal
|
|
532
|
+
* (starting at its own `{`), find the top-level `code:` property and return
|
|
533
|
+
* its function value's body text verbatim — undefined if there's no `code:`
|
|
534
|
+
* key or its value isn't a recognizable function literal.
|
|
535
|
+
*/
|
|
536
|
+
function extractCodeBody(optsText) {
|
|
537
|
+
const n = optsText.length;
|
|
538
|
+
let depth = 0;
|
|
539
|
+
let i = 0;
|
|
540
|
+
while (i < n) {
|
|
541
|
+
i = skipNonCode(optsText, i);
|
|
542
|
+
const c = optsText[i];
|
|
543
|
+
if (c === undefined)
|
|
544
|
+
break;
|
|
545
|
+
if (c === '"' || c === "'" || c === "`") {
|
|
546
|
+
i = skipString(optsText, i);
|
|
547
|
+
continue;
|
|
548
|
+
}
|
|
549
|
+
if (c === "{" || c === "(" || c === "[") {
|
|
550
|
+
depth += 1;
|
|
551
|
+
i += 1;
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
554
|
+
if (c === "}" || c === ")" || c === "]") {
|
|
555
|
+
depth -= 1;
|
|
556
|
+
i += 1;
|
|
557
|
+
continue;
|
|
558
|
+
}
|
|
559
|
+
if (depth === 1 && isIdentifierBoundaryMatch(optsText, i, "code")) {
|
|
560
|
+
let j = skipWs(optsText, i + "code".length);
|
|
561
|
+
if (optsText[j] === ":") {
|
|
562
|
+
j = skipWs(optsText, j + 1);
|
|
563
|
+
return extractFunctionBlockBodyAt(optsText, j);
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
i += 1;
|
|
567
|
+
}
|
|
568
|
+
return undefined;
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Given text starting at a function-literal value (`(input) => { ... }` or
|
|
572
|
+
* `function(input) { ... }`, block-bodied only — matches what the printer
|
|
573
|
+
* always emits and what {@link extractScriptBody} otherwise requires), return
|
|
574
|
+
* the exact text between its outermost `{` and `}`.
|
|
575
|
+
*/
|
|
576
|
+
function extractFunctionBlockBodyAt(text, start) {
|
|
577
|
+
const n = text.length;
|
|
578
|
+
let i = start;
|
|
579
|
+
let sawArrow = false;
|
|
580
|
+
let parenDepth = 0;
|
|
581
|
+
while (i < n) {
|
|
582
|
+
i = skipNonCode(text, i);
|
|
583
|
+
const c = text[i];
|
|
584
|
+
if (c === undefined)
|
|
585
|
+
return undefined;
|
|
586
|
+
if (c === '"' || c === "'" || c === "`") {
|
|
587
|
+
i = skipString(text, i);
|
|
588
|
+
continue;
|
|
589
|
+
}
|
|
590
|
+
if (text.startsWith("=>", i)) {
|
|
591
|
+
sawArrow = true;
|
|
592
|
+
i += 2;
|
|
593
|
+
continue;
|
|
594
|
+
}
|
|
595
|
+
if (c === "(" || c === "[") {
|
|
596
|
+
parenDepth += 1;
|
|
597
|
+
i += 1;
|
|
598
|
+
continue;
|
|
599
|
+
}
|
|
600
|
+
if (c === ")" || c === "]") {
|
|
601
|
+
parenDepth -= 1;
|
|
602
|
+
i += 1;
|
|
603
|
+
continue;
|
|
604
|
+
}
|
|
605
|
+
if (c === "{" && parenDepth === 0) {
|
|
606
|
+
if (!sawArrow && !/^function\b/.test(text.slice(start, i).trimStart()))
|
|
607
|
+
return undefined;
|
|
608
|
+
const bodyStart = i + 1;
|
|
609
|
+
let blockDepth = 1;
|
|
610
|
+
let k = bodyStart;
|
|
611
|
+
while (k < n && blockDepth > 0) {
|
|
612
|
+
k = skipNonCode(text, k);
|
|
613
|
+
const cc = text[k];
|
|
614
|
+
if (cc === undefined)
|
|
615
|
+
return undefined;
|
|
616
|
+
if (cc === '"' || cc === "'" || cc === "`") {
|
|
617
|
+
k = skipString(text, k);
|
|
618
|
+
continue;
|
|
619
|
+
}
|
|
620
|
+
if (cc === "{")
|
|
621
|
+
blockDepth += 1;
|
|
622
|
+
else if (cc === "}")
|
|
623
|
+
blockDepth -= 1;
|
|
624
|
+
k += 1;
|
|
625
|
+
}
|
|
626
|
+
return blockDepth === 0 ? text.slice(bodyStart, k - 1) : undefined;
|
|
627
|
+
}
|
|
628
|
+
if ((c === "," || c === "}") && parenDepth === 0 && !sawArrow)
|
|
629
|
+
return undefined; // not a function value
|
|
630
|
+
i += 1;
|
|
631
|
+
}
|
|
632
|
+
return undefined;
|
|
633
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deep-walk a config node: internal `Ref`s → wire ref JSON; `CatalogRef` tokens
|
|
3
|
+
* slimmed to their canonical fields and left in place (resolved at deploy);
|
|
4
|
+
* arrays/objects recursed; scalars passed through.
|
|
5
|
+
*/
|
|
6
|
+
export declare function serializeNode(node: unknown): unknown;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2 automation payload serialization — the single deep-walk that turns an
|
|
3
|
+
* authored task/trigger config into its handle-form wire shape.
|
|
4
|
+
*
|
|
5
|
+
* Two kinds of reference live in a config, and they're handled differently:
|
|
6
|
+
* - **Internal `Ref`s** (`ctx.trigger.x`, `ctx.tasks.y`, `template(...)`) —
|
|
7
|
+
* data flow *inside* the automation. Converted here to the platform's
|
|
8
|
+
* `ValueReference` JSON via the shared, reference-model-agnostic
|
|
9
|
+
* `serializeRefData` (depends only on `core/ref`). This is the same code
|
|
10
|
+
* path v1 uses; it moves to `core` at the eventual cutover.
|
|
11
|
+
* - **`CatalogRef` tokens** (`app.fields.x`, another automation/agent) —
|
|
12
|
+
* cross-entity refs. Left **in place**; `resolvePayload` swaps them for ids
|
|
13
|
+
* at deploy. Detected by `__kind ∈ REF_SCOPE`.
|
|
14
|
+
*
|
|
15
|
+
* Everything else passes through untouched.
|
|
16
|
+
*/
|
|
17
|
+
import { isCatalogToken, slimToken } from "../../catalog/index.js";
|
|
18
|
+
import { isRef } from "../shared/ref.js";
|
|
19
|
+
// Shared agnostic internal-ref serializer (pure over `core/ref`); relocates to
|
|
20
|
+
// `core` when v1's serializer is retired.
|
|
21
|
+
import { serializeRefData } from "../../core/wire/ref-serializer.js";
|
|
22
|
+
/**
|
|
23
|
+
* Deep-walk a config node: internal `Ref`s → wire ref JSON; `CatalogRef` tokens
|
|
24
|
+
* slimmed to their canonical fields and left in place (resolved at deploy);
|
|
25
|
+
* arrays/objects recursed; scalars passed through.
|
|
26
|
+
*/
|
|
27
|
+
export function serializeNode(node) {
|
|
28
|
+
if (isRef(node))
|
|
29
|
+
return serializeRefData(node.__data);
|
|
30
|
+
if (isCatalogToken(node))
|
|
31
|
+
return slimToken(node);
|
|
32
|
+
if (Array.isArray(node))
|
|
33
|
+
return node.map(serializeNode);
|
|
34
|
+
if (node !== null && typeof node === "object") {
|
|
35
|
+
const out = {};
|
|
36
|
+
for (const [k, v] of Object.entries(node))
|
|
37
|
+
out[k] = serializeNode(v);
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
return node;
|
|
41
|
+
}
|