@elementumai/edk 0.9.19 → 0.10.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 +159 -7
- package/dist-sdk/src/catalog/factories.d.ts +33 -2
- package/dist-sdk/src/catalog/factories.js +40 -1
- package/dist-sdk/src/catalog/from-authoring.d.ts +13 -8
- package/dist-sdk/src/catalog/from-authoring.js +34 -9
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +2 -2
- package/dist-sdk/src/catalog/render.js +6 -6
- package/dist-sdk/src/catalog/token.js +11 -0
- package/dist-sdk/src/catalog/types.d.ts +40 -1
- package/dist-sdk/src/catalog/types.js +12 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +40 -4
- package/dist-sdk/src/core/triggers/on-demand.js +17 -2
- package/dist-sdk/src/core/types/app.d.ts +2 -2
- package/dist-sdk/src/engine/build/context.d.ts +1 -1
- package/dist-sdk/src/engine/coverage-gaps.d.ts +86 -0
- package/dist-sdk/src/engine/coverage-gaps.js +156 -0
- package/dist-sdk/src/engine/ei/run.d.ts +169 -0
- package/dist-sdk/src/engine/ei/run.js +1219 -0
- package/dist-sdk/src/engine/logging.d.ts +17 -0
- package/dist-sdk/src/engine/logging.js +18 -0
- package/dist-sdk/src/engine/pull/catalog-ref.d.ts +16 -0
- package/dist-sdk/src/engine/pull/catalog-ref.js +24 -0
- package/dist-sdk/src/engine/pull/context.d.ts +68 -6
- package/dist-sdk/src/engine/pull/context.js +40 -1
- package/dist-sdk/src/engine/pull/procedure-refs.d.ts +8 -0
- package/dist-sdk/src/engine/pull/procedure-refs.js +28 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +5 -0
- package/dist-sdk/src/engine/pull/ref-only.js +10 -7
- package/dist-sdk/src/engine/pull/result-output.d.ts +6 -0
- package/dist-sdk/src/engine/pull/result-output.js +113 -3
- package/dist-sdk/src/engine/tf/expr.js +1 -1
- package/dist-sdk/src/engine/tf/index.d.ts +2 -2
- package/dist-sdk/src/engine/tf/index.js +1 -1
- package/dist-sdk/src/engine/tf/labels.d.ts +28 -5
- package/dist-sdk/src/engine/tf/labels.js +54 -3
- package/dist-sdk/src/engine/tf/model.d.ts +22 -1
- package/dist-sdk/src/engine/tf/parse.js +93 -4
- package/dist-sdk/src/engine/tf/render.d.ts +4 -2
- package/dist-sdk/src/engine/tf/render.js +41 -7
- package/dist-sdk/src/engine/validation.d.ts +44 -0
- package/dist-sdk/src/engine/validation.js +95 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +38 -1
- package/dist-sdk/src/entities/access-policy/principal.d.ts +2 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +5 -2
- package/dist-sdk/src/entities/agent/build.d.ts +4 -16
- package/dist-sdk/src/entities/agent/build.js +40 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +3 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +46 -21
- package/dist-sdk/src/entities/agent/from-tf.js +11 -3
- package/dist-sdk/src/entities/agent/module.js +2 -0
- package/dist-sdk/src/entities/agent/to-tf.js +20 -6
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +10 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.js +18 -6
- package/dist-sdk/src/entities/agent-tool/module.js +3 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +27 -5
- package/dist-sdk/src/entities/app/auto-share.d.ts +38 -0
- package/dist-sdk/src/entities/app/auto-share.js +49 -0
- package/dist-sdk/src/entities/app/build.d.ts +105 -22
- package/dist-sdk/src/entities/app/build.js +107 -10
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +22 -1
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/app/from-tf.js +11 -2
- package/dist-sdk/src/entities/app/index.d.ts +7 -6
- package/dist-sdk/src/entities/app/index.js +2 -8
- package/dist-sdk/src/entities/app/module.js +5 -2
- package/dist-sdk/src/entities/app/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/app/to-tf.js +40 -13
- package/dist-sdk/src/entities/automation/build.d.ts +56 -6
- package/dist-sdk/src/entities/automation/build.js +230 -26
- package/dist-sdk/src/entities/automation/calculation-expression.d.ts +7 -7
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +41 -5
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +470 -58
- package/dist-sdk/src/entities/automation/from-tf.d.ts +37 -8
- package/dist-sdk/src/entities/automation/from-tf.js +791 -131
- package/dist-sdk/src/entities/automation/generated/task-output-contracts.d.ts +33 -0
- package/dist-sdk/src/entities/automation/generated/task-output-contracts.js +183 -0
- package/dist-sdk/src/entities/automation/index.d.ts +2 -2
- package/dist-sdk/src/entities/automation/index.js +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +3 -0
- package/dist-sdk/src/entities/automation/module.js +107 -15
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +7 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +36 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +9 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +13 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +20 -0
- package/dist-sdk/src/entities/automation/script-code.js +109 -5
- package/dist-sdk/src/entities/automation/system-ref-name.js +4 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +39 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +85 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +116 -22
- package/dist-sdk/src/entities/automation/tasks.js +86 -24
- package/dist-sdk/src/entities/automation/to-tf.d.ts +24 -3
- package/dist-sdk/src/entities/automation/to-tf.js +1082 -132
- package/dist-sdk/src/entities/automation/triggers.d.ts +12 -6
- package/dist-sdk/src/entities/automation/triggers.js +4 -0
- package/dist-sdk/src/entities/automation/types.d.ts +9 -0
- package/dist-sdk/src/entities/automation/types.js +19 -0
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +1 -1
- package/dist-sdk/src/entities/automation/value-ref-tf.js +1 -1
- package/dist-sdk/src/entities/chart/from-tf.js +9 -1
- package/dist-sdk/src/entities/chart/to-tf.js +10 -3
- package/dist-sdk/src/entities/data-lookup/module.js +2 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +24 -31
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +7 -5
- package/dist-sdk/src/entities/element/build.d.ts +28 -13
- package/dist-sdk/src/entities/element/build.js +5 -1
- package/dist-sdk/src/entities/element/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/element/from-tf.js +62 -1
- package/dist-sdk/src/entities/element/index.d.ts +5 -3
- package/dist-sdk/src/entities/element/index.js +1 -0
- package/dist-sdk/src/entities/element/module.js +9 -3
- package/dist-sdk/src/entities/element/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/to-tf.js +16 -16
- package/dist-sdk/src/entities/field/build.d.ts +17 -3
- package/dist-sdk/src/entities/field/build.js +3 -0
- package/dist-sdk/src/entities/field/calc.d.ts +7 -7
- package/dist-sdk/src/entities/field/from-tf.d.ts +5 -4
- package/dist-sdk/src/entities/field/from-tf.js +244 -49
- package/dist-sdk/src/entities/field/media-types.d.ts +6 -0
- package/dist-sdk/src/entities/field/media-types.js +30 -0
- package/dist-sdk/src/entities/field/module.js +2 -0
- package/dist-sdk/src/entities/field/options.js +6 -1
- package/dist-sdk/src/entities/field/to-tf.d.ts +26 -5
- package/dist-sdk/src/entities/field/to-tf.js +137 -15
- package/dist-sdk/src/entities/field/types.d.ts +2 -0
- package/dist-sdk/src/entities/field/types.js +27 -0
- package/dist-sdk/src/entities/file-reader/from-tf.js +14 -5
- package/dist-sdk/src/entities/file-reader/module.js +1 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +2 -0
- package/dist-sdk/src/entities/file-reader/types.js +1 -1
- package/dist-sdk/src/entities/portal/build.d.ts +26 -0
- package/dist-sdk/src/entities/portal/build.js +37 -0
- package/dist-sdk/src/entities/portal/from-tf.d.ts +27 -0
- package/dist-sdk/src/entities/portal/from-tf.js +75 -0
- package/dist-sdk/src/entities/portal/index.d.ts +1 -0
- package/dist-sdk/src/entities/portal/index.js +1 -0
- package/dist-sdk/src/entities/portal/module.d.ts +3 -0
- package/dist-sdk/src/entities/portal/module.js +28 -0
- package/dist-sdk/src/entities/portal/to-tf.d.ts +12 -0
- package/dist-sdk/src/entities/portal/to-tf.js +73 -0
- package/dist-sdk/src/entities/portal/types.d.ts +1 -0
- package/dist-sdk/src/entities/portal/types.js +1 -0
- package/dist-sdk/src/entities/relationship/module.js +2 -0
- package/dist-sdk/src/entities/relationship/pair-check.d.ts +7 -0
- package/dist-sdk/src/entities/relationship/pair-check.js +68 -0
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +12 -3
- package/dist-sdk/src/entities/role/from-tf.js +3 -3
- package/dist-sdk/src/entities/role/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/role/to-tf.js +12 -4
- package/dist-sdk/src/entities/search-table/module.js +1 -0
- package/dist-sdk/src/entities/search-table/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/to-tf.js +1 -1
- package/dist-sdk/src/entities/service-account/build.d.ts +15 -2
- package/dist-sdk/src/entities/service-account/from-tf.d.ts +2 -4
- package/dist-sdk/src/entities/service-account/from-tf.js +20 -8
- package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +56 -0
- package/dist-sdk/src/entities/service-account/role-fidelity.js +243 -0
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/service-account/to-tf.js +17 -0
- package/dist-sdk/src/entities/service-account/workspace-owner.d.ts +16 -0
- package/dist-sdk/src/entities/service-account/workspace-owner.js +22 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +5 -2
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +23 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +2 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +7 -0
- package/dist-sdk/src/entities/shared/filters/index.js +19 -4
- package/dist-sdk/src/entities/shared/filters/print.js +24 -3
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +7 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +46 -7
- package/dist-sdk/src/entities/shared/filters/types.d.ts +15 -2
- package/dist-sdk/src/entities/shared/ref.d.ts +5 -7
- package/dist-sdk/src/entities/shared/ref.js +5 -7
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +9 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +35 -2
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +20 -5
- package/dist-sdk/src/entities/shared/types/field-types.js +8 -0
- package/dist-sdk/src/entities/skill/access-policy.js +3 -3
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +3 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +14 -6
- package/dist-sdk/src/entities/skill/from-tf.js +70 -15
- package/dist-sdk/src/entities/skill/input-coverage.d.ts +7 -0
- package/dist-sdk/src/entities/skill/input-coverage.js +11 -0
- package/dist-sdk/src/entities/skill/module.js +2 -0
- package/dist-sdk/src/entities/skill/to-tf.js +14 -4
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +49 -10
- package/dist-sdk/src/entities/skill-tool/module.js +3 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -8
- package/dist-sdk/src/entities/skill-tool/to-tf.js +49 -14
- package/dist-sdk/src/entities/table/catalog.d.ts +14 -0
- package/dist-sdk/src/entities/table/catalog.js +66 -0
- package/dist-sdk/src/entities/table/module.js +2 -1
- package/dist-sdk/src/entities/table/to-tf.js +2 -2
- package/dist-sdk/src/entities/task/build.d.ts +8 -0
- package/dist-sdk/src/entities/task/build.js +10 -1
- package/dist-sdk/src/entities/task/from-tf.d.ts +4 -2
- package/dist-sdk/src/entities/task/from-tf.js +7 -2
- package/dist-sdk/src/entities/task/module.js +2 -2
- package/dist-sdk/src/entities/task/to-tf.d.ts +8 -4
- package/dist-sdk/src/entities/task/to-tf.js +28 -1
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +49 -9
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +71 -18
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +19 -4
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +82 -10
- package/dist-sdk/src/entities/view/agent-view-layout.d.ts +53 -23
- package/dist-sdk/src/entities/view/agent-view-layout.js +1 -1
- package/dist-sdk/src/entities/view/from-tf.d.ts +3 -2
- package/dist-sdk/src/entities/view/from-tf.js +133 -13
- package/dist-sdk/src/entities/view/module.js +30 -3
- package/dist-sdk/src/entities/view/to-tf.d.ts +20 -8
- package/dist-sdk/src/entities/view/to-tf.js +86 -18
- package/dist-sdk/src/entities/view/types.d.ts +4 -15
- package/dist-sdk/src/entities/view/types.js +15 -15
- package/dist-sdk/src/entities/visual-flow/build.d.ts +16 -1
- package/dist-sdk/src/entities/visual-flow/build.js +9 -0
- package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +14 -0
- package/dist-sdk/src/entities/visual-flow/from-tf.js +51 -3
- package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -1
- package/dist-sdk/src/entities/visual-flow/index.js +1 -1
- package/dist-sdk/src/entities/visual-flow/printer.js +19 -0
- package/dist-sdk/src/entities/visual-flow/to-tf.js +87 -3
- package/dist-sdk/src/entities/widget/build.d.ts +16 -1
- package/dist-sdk/src/entities/widget/build.js +11 -1
- package/dist-sdk/src/entities/widget/from-tf.js +3 -3
- package/dist-sdk/src/entities/widget/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/widget/to-tf.js +41 -14
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +148 -13
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +12 -0
- package/dist-sdk/src/graph/index.js +21 -0
- package/dist-sdk/src/graph/modules.js +2 -0
- package/dist-sdk/src/graph/types.d.ts +83 -4
- package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
- package/dist-sdk/src/internal/sdk-package.js +1 -0
- package/package.json +16 -3
|
@@ -1,18 +1,38 @@
|
|
|
1
|
+
import { parse } from "acorn";
|
|
1
2
|
import { readFileSync } from "node:fs";
|
|
2
3
|
import { createRequire } from "node:module";
|
|
3
4
|
import { dirname, isAbsolute, resolve } from "node:path";
|
|
4
5
|
import { currentImportingFile, currentSourceText } from "../../engine/build/source-context.js";
|
|
5
|
-
let
|
|
6
|
+
let packageTsModule;
|
|
6
7
|
function getTs() {
|
|
7
|
-
if (
|
|
8
|
+
if (packageTsModule === undefined) {
|
|
8
9
|
try {
|
|
9
|
-
|
|
10
|
+
packageTsModule = createRequire(import.meta.url)("typescript");
|
|
10
11
|
}
|
|
11
12
|
catch {
|
|
12
|
-
|
|
13
|
+
packageTsModule = null;
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
+
if (packageTsModule !== null)
|
|
17
|
+
return packageTsModule;
|
|
18
|
+
// The SDK intentionally does not require TypeScript at runtime. When an
|
|
19
|
+
// authored inline body does need type erasure, resolve the workspace's
|
|
20
|
+
// optional TypeScript from the automation being loaded, not only from the
|
|
21
|
+
// caller's cwd (`elementum build /path/to/org` may run anywhere).
|
|
22
|
+
const importingFile = currentSourceText()?.filePath ?? currentImportingFile();
|
|
23
|
+
const roots = [
|
|
24
|
+
...(importingFile === undefined ? [] : [importingFile]),
|
|
25
|
+
resolve(process.cwd(), "package.json"),
|
|
26
|
+
];
|
|
27
|
+
for (const root of roots) {
|
|
28
|
+
try {
|
|
29
|
+
return createRequire(root)("typescript");
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// Try the next legitimate module root.
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
16
36
|
}
|
|
17
37
|
/**
|
|
18
38
|
* Reference a plain-JavaScript script file for `executeScript`'s `code:`.
|
|
@@ -119,6 +139,90 @@ export class ScriptCodeError extends Error {
|
|
|
119
139
|
this.name = "ScriptCodeError";
|
|
120
140
|
}
|
|
121
141
|
}
|
|
142
|
+
const SCRIPT_WRAPPER_OPEN = "function __edkScript(input) {\n";
|
|
143
|
+
const SCRIPT_WRAPPER_CLOSE = "\n}\n";
|
|
144
|
+
function scriptSyntaxErrors(wrapped, fileName, ts) {
|
|
145
|
+
const output = ts.transpileModule(wrapped, {
|
|
146
|
+
fileName,
|
|
147
|
+
reportDiagnostics: true,
|
|
148
|
+
compilerOptions: { target: ts.ScriptTarget.ESNext, module: ts.ModuleKind.ESNext, removeComments: false },
|
|
149
|
+
});
|
|
150
|
+
return (output.diagnostics ?? [])
|
|
151
|
+
.filter((diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error)
|
|
152
|
+
.map((diagnostic) => ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
|
|
153
|
+
}
|
|
154
|
+
function plainJavaScriptSyntaxError(body) {
|
|
155
|
+
try {
|
|
156
|
+
parse(body, {
|
|
157
|
+
ecmaVersion: "latest",
|
|
158
|
+
sourceType: "script",
|
|
159
|
+
allowReturnOutsideFunction: true,
|
|
160
|
+
allowAwaitOutsideFunction: true,
|
|
161
|
+
});
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
return error instanceof Error ? error.message : String(error);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* The platform runs a script body as plain JavaScript, so TypeScript-only
|
|
170
|
+
* syntax (`const out: Record<string, string> = {}`, `x as T`, `value!`,
|
|
171
|
+
* `implements`) fails there at runtime. A body that parses as JavaScript,
|
|
172
|
+
* which includes every pulled script, is returned unchanged so it round-trips
|
|
173
|
+
* byte for byte (`f(a < b, c > (d))` stays two comparisons). One that parses
|
|
174
|
+
* only as TypeScript has its types erased by the TypeScript transpiler with an
|
|
175
|
+
* ESNext target, so no syntax is downleveled into helpers; one that parses as
|
|
176
|
+
* neither is refused. `label` names the script in errors. With
|
|
177
|
+
* `stripTypes: false` (script files) a TypeScript body is kept byte for byte
|
|
178
|
+
* so a pulled workflow round-trips. When TypeScript is available, a body that
|
|
179
|
+
* parses as neither JavaScript nor TypeScript is refused. When the TypeScript
|
|
180
|
+
* package cannot be loaded, the stored body is kept so pull can finish,
|
|
181
|
+
* including a body that cannot be classified.
|
|
182
|
+
*/
|
|
183
|
+
export function toPlatformScriptBody(body, label, options = {}) {
|
|
184
|
+
const wrapped = `${SCRIPT_WRAPPER_OPEN}${body}${SCRIPT_WRAPPER_CLOSE}`;
|
|
185
|
+
const jsError = plainJavaScriptSyntaxError(body);
|
|
186
|
+
if (jsError === undefined)
|
|
187
|
+
return body;
|
|
188
|
+
if (options.stripTypes === false) {
|
|
189
|
+
// Script files round-trip the platform body. Live workflows store
|
|
190
|
+
// TypeScript syntax in that body; stripping it would plan a rewrite and
|
|
191
|
+
// refusing it stops pull (#1424). When TypeScript loads, a body that
|
|
192
|
+
// parses as neither JavaScript nor TypeScript still fails.
|
|
193
|
+
const ts = (options.loadTypeScript === undefined ? getTs() : options.loadTypeScript());
|
|
194
|
+
// The standalone CLI does not bundle TypeScript, and the workspace often
|
|
195
|
+
// does not install it either. Keep the stored body so pull can finish,
|
|
196
|
+
// including one that is not valid TypeScript: without a parser it cannot
|
|
197
|
+
// be told apart from a TypeScript workflow body.
|
|
198
|
+
if (ts === undefined)
|
|
199
|
+
return body;
|
|
200
|
+
const tsErrors = scriptSyntaxErrors(wrapped, "script.ts", ts);
|
|
201
|
+
if (tsErrors.length > 0) {
|
|
202
|
+
throw new ScriptCodeError(`${label}: the script body does not parse: ${tsErrors.join("; ")}`);
|
|
203
|
+
}
|
|
204
|
+
return body;
|
|
205
|
+
}
|
|
206
|
+
const ts = (options.loadTypeScript === undefined ? getTs() : options.loadTypeScript());
|
|
207
|
+
if (ts === undefined) {
|
|
208
|
+
throw new ScriptCodeError(`${label}: the script body is not plain JavaScript and TypeScript is unavailable: ${jsError}`);
|
|
209
|
+
}
|
|
210
|
+
const tsErrors = scriptSyntaxErrors(wrapped, "script.ts", ts);
|
|
211
|
+
if (tsErrors.length > 0) {
|
|
212
|
+
throw new ScriptCodeError(`${label}: the script body does not parse: ${tsErrors.join("; ")}`);
|
|
213
|
+
}
|
|
214
|
+
const output = ts.transpileModule(wrapped, {
|
|
215
|
+
fileName: "script.ts",
|
|
216
|
+
compilerOptions: { target: ts.ScriptTarget.ESNext, module: ts.ModuleKind.ESNext, removeComments: false },
|
|
217
|
+
}).outputText;
|
|
218
|
+
const start = output.indexOf("function __edkScript(input)");
|
|
219
|
+
const open = start < 0 ? -1 : output.indexOf("{", start);
|
|
220
|
+
const close = output.lastIndexOf("}");
|
|
221
|
+
if (open < 0 || close <= open) {
|
|
222
|
+
throw new ScriptCodeError(`${label}: could not remove TypeScript types from the script body.`);
|
|
223
|
+
}
|
|
224
|
+
return dedent(output.slice(open + 1, close).replace(/^\n+/, "").replace(/\n[ \t]*$/, ""));
|
|
225
|
+
}
|
|
122
226
|
/**
|
|
123
227
|
* Extract the platform script body from an authored code function. Accepts the
|
|
124
228
|
* shapes a transpiler emits for `(input) => …`: arrow with block body, arrow
|
|
@@ -16,6 +16,10 @@ export const PROVIDER_FIXED_SYSTEM_FIELD_KEYS = new Set([
|
|
|
16
16
|
const PROVIDER_ALIASED_REF_NAMES = new Map([
|
|
17
17
|
["Created by Email", "Created By Email"],
|
|
18
18
|
["Created By Email", "Created by Email"],
|
|
19
|
+
["Updated by Email", "Updated By Email"],
|
|
20
|
+
["Updated By Email", "Updated by Email"],
|
|
21
|
+
["Created by Manager Email", "Created By Manager Email"],
|
|
22
|
+
["Created By Manager Email", "Created by Manager Email"],
|
|
19
23
|
["Updated by Manager Email", "Updated By Manager Email"],
|
|
20
24
|
["Updated By Manager Email", "Updated by Manager Email"],
|
|
21
25
|
]);
|
|
@@ -13,3 +13,42 @@ export declare const TASK_OUTPUT_REFERENCE_NAMES: Readonly<Record<string, Readon
|
|
|
13
13
|
* `record_reference` needs; a field-mapped input needs the record itself.
|
|
14
14
|
*/
|
|
15
15
|
export declare const WHOLE_RECORD_REF_WIRE_NAMES: Readonly<Record<string, string>>;
|
|
16
|
+
/**
|
|
17
|
+
* Marks a trigger reference that a field-mapped script input reads as the
|
|
18
|
+
* whole record (edk#1284). Record triggers expose the whole record
|
|
19
|
+
* (`record`, ASPECT_RECORD) and the record ID (ASPECT_RECORD_ID) under one
|
|
20
|
+
* display name, "Record", and the provider's refs map keeps only the ID there.
|
|
21
|
+
* Build sets this on the input's value; to-tf then writes the exact reference
|
|
22
|
+
* JSON (`triggerWholeRecordRefJson`) instead of `refs["Record"]`.
|
|
23
|
+
*/
|
|
24
|
+
export declare const TRIGGER_WHOLE_RECORD_MARKER = "__edkTriggerWholeRecord";
|
|
25
|
+
/** The trigger's whole record (`record`) in field mappings. */
|
|
26
|
+
export declare const TRIGGER_WHOLE_RECORD_REF_NAME = "record";
|
|
27
|
+
/**
|
|
28
|
+
* The reference JSON for a trigger's whole record: the string provider Read
|
|
29
|
+
* returns for it and the exporter emits, byte for byte (sorted keys).
|
|
30
|
+
*/
|
|
31
|
+
export declare function triggerWholeRecordRefJson(name: string): string;
|
|
32
|
+
/** The trigger reference name a whole-record reference JSON names, if `value` is one. */
|
|
33
|
+
export declare function parseTriggerWholeRecordRefJson(value: unknown): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* An attachment trigger's own payload fields. A record field can share one's
|
|
36
|
+
* display name (a "Description" field) and then owns that refs key, so build
|
|
37
|
+
* always writes these as exact reference JSON.
|
|
38
|
+
*/
|
|
39
|
+
export declare const ATTACHMENT_PAYLOAD_FIELD_TYPES: Readonly<Record<string, string>>;
|
|
40
|
+
/**
|
|
41
|
+
* The reference for an attachment payload field. JSON-encoded (sorted keys),
|
|
42
|
+
* it is the string provider Read returns for it.
|
|
43
|
+
*/
|
|
44
|
+
export declare function triggerAttachmentPayloadRef(key: string): {
|
|
45
|
+
readonly fieldType: string;
|
|
46
|
+
readonly multiple: false;
|
|
47
|
+
readonly triggerReference: {
|
|
48
|
+
readonly name: string;
|
|
49
|
+
};
|
|
50
|
+
} | undefined;
|
|
51
|
+
/** The attachment payload field an exact reference JSON names, if `value` is one. */
|
|
52
|
+
export declare function parseTriggerAttachmentPayloadRefJson(value: unknown): string | undefined;
|
|
53
|
+
/** aiSearchTable accessor → [refs-map display label, canonical `service_tasks` output name]. */
|
|
54
|
+
export declare const AI_SEARCH_TABLE_OUTPUT_NAMES: Readonly<Record<string, readonly [display: string, canonical: string]>>;
|
|
@@ -6,6 +6,7 @@ export const USER_SEARCH_REF_WIRE_NAMES = {
|
|
|
6
6
|
"user.managerName": "Manager Name",
|
|
7
7
|
"user.managerEmail": "Manager Email",
|
|
8
8
|
users: "All found users",
|
|
9
|
+
count: "Users Size",
|
|
9
10
|
};
|
|
10
11
|
/**
|
|
11
12
|
* Task-own outputs whose WorkflowTaskReference name (what an exported
|
|
@@ -25,6 +26,11 @@ export const TASK_OUTPUT_REFERENCE_NAMES = {
|
|
|
25
26
|
Name: "group.name",
|
|
26
27
|
"All found groups": "groups",
|
|
27
28
|
},
|
|
29
|
+
// Captured live from a deployed bulk_update_fields task's refs map.
|
|
30
|
+
elementum_bulk_update_fields_task: {
|
|
31
|
+
"Records Updated": "recordsUpdated",
|
|
32
|
+
"All Matching Records Updated": "allMatchingRecordsUpdated",
|
|
33
|
+
},
|
|
28
34
|
};
|
|
29
35
|
/**
|
|
30
36
|
* A record-bearing task's whole-record output (ASPECT_RECORD). The bare
|
|
@@ -36,3 +42,82 @@ export const WHOLE_RECORD_REF_WIRE_NAMES = {
|
|
|
36
42
|
createRecord: "Created record",
|
|
37
43
|
updateField: "Updated record",
|
|
38
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* Marks a trigger reference that a field-mapped script input reads as the
|
|
47
|
+
* whole record (edk#1284). Record triggers expose the whole record
|
|
48
|
+
* (`record`, ASPECT_RECORD) and the record ID (ASPECT_RECORD_ID) under one
|
|
49
|
+
* display name, "Record", and the provider's refs map keeps only the ID there.
|
|
50
|
+
* Build sets this on the input's value; to-tf then writes the exact reference
|
|
51
|
+
* JSON (`triggerWholeRecordRefJson`) instead of `refs["Record"]`.
|
|
52
|
+
*/
|
|
53
|
+
export const TRIGGER_WHOLE_RECORD_MARKER = "__edkTriggerWholeRecord";
|
|
54
|
+
/** The trigger's whole record (`record`) in field mappings. */
|
|
55
|
+
export const TRIGGER_WHOLE_RECORD_REF_NAME = "record";
|
|
56
|
+
/**
|
|
57
|
+
* The reference JSON for a trigger's whole record: the string provider Read
|
|
58
|
+
* returns for it and the exporter emits, byte for byte (sorted keys).
|
|
59
|
+
*/
|
|
60
|
+
export function triggerWholeRecordRefJson(name) {
|
|
61
|
+
return JSON.stringify({ fieldType: "ASPECT_RECORD", multiple: false, triggerReference: { name } });
|
|
62
|
+
}
|
|
63
|
+
/** The trigger reference name a whole-record reference JSON names, if `value` is one. */
|
|
64
|
+
export function parseTriggerWholeRecordRefJson(value) {
|
|
65
|
+
const ref = parseSingleTriggerRefJson(value);
|
|
66
|
+
return ref?.fieldType === "ASPECT_RECORD" ? ref.name : undefined;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* An attachment trigger's own payload fields. A record field can share one's
|
|
70
|
+
* display name (a "Description" field) and then owns that refs key, so build
|
|
71
|
+
* always writes these as exact reference JSON.
|
|
72
|
+
*/
|
|
73
|
+
export const ATTACHMENT_PAYLOAD_FIELD_TYPES = {
|
|
74
|
+
name: "TEXT",
|
|
75
|
+
url: "TEXT",
|
|
76
|
+
mediaType: "TEXT",
|
|
77
|
+
size: "NUMBER",
|
|
78
|
+
description: "TEXT",
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* The reference for an attachment payload field. JSON-encoded (sorted keys),
|
|
82
|
+
* it is the string provider Read returns for it.
|
|
83
|
+
*/
|
|
84
|
+
export function triggerAttachmentPayloadRef(key) {
|
|
85
|
+
const fieldType = ATTACHMENT_PAYLOAD_FIELD_TYPES[key];
|
|
86
|
+
if (fieldType === undefined)
|
|
87
|
+
return undefined;
|
|
88
|
+
return { fieldType, multiple: false, triggerReference: { name: `attachment.${key}` } };
|
|
89
|
+
}
|
|
90
|
+
/** The attachment payload field an exact reference JSON names, if `value` is one. */
|
|
91
|
+
export function parseTriggerAttachmentPayloadRefJson(value) {
|
|
92
|
+
const ref = parseSingleTriggerRefJson(value);
|
|
93
|
+
if (ref === undefined || !ref.name.startsWith("attachment."))
|
|
94
|
+
return undefined;
|
|
95
|
+
const key = ref.name.slice("attachment.".length);
|
|
96
|
+
return ATTACHMENT_PAYLOAD_FIELD_TYPES[key] === ref.fieldType ? key : undefined;
|
|
97
|
+
}
|
|
98
|
+
function parseSingleTriggerRefJson(value) {
|
|
99
|
+
if (typeof value !== "string" || !value.startsWith("{"))
|
|
100
|
+
return undefined;
|
|
101
|
+
let parsed;
|
|
102
|
+
try {
|
|
103
|
+
parsed = JSON.parse(value);
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
109
|
+
return undefined;
|
|
110
|
+
const { fieldType, multiple, triggerReference, ...rest } = parsed;
|
|
111
|
+
if ((multiple !== undefined && multiple !== false) || Object.keys(rest).length > 0)
|
|
112
|
+
return undefined;
|
|
113
|
+
const name = triggerReference?.name;
|
|
114
|
+
return typeof name === "string" && Object.keys(triggerReference).length === 1 ? { name, fieldType } : undefined;
|
|
115
|
+
}
|
|
116
|
+
/** aiSearchTable accessor → [refs-map display label, canonical `service_tasks` output name]. */
|
|
117
|
+
export const AI_SEARCH_TABLE_OUTPUT_NAMES = {
|
|
118
|
+
records: ["All Records", "searchTableRecords"],
|
|
119
|
+
recordsText: ["All Records Text", "searchTableRecordsText"],
|
|
120
|
+
recordsJson: ["All Records JSON", "searchTableRecordsJson"],
|
|
121
|
+
firstRecordText: ["First Record Text", "firstFoundRecordText"],
|
|
122
|
+
firstRecordJson: ["First Record JSON", "firstFoundRecordJson"],
|
|
123
|
+
};
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
* accept a literal or a `ctx` `Ref` and are pre-serialized to the platform's
|
|
12
12
|
* `ValueReference` JSON via the shared, agnostic `serializeValueOrRef`.
|
|
13
13
|
*/
|
|
14
|
-
import type { AgentRef, AppOrElementOrTaskRef, AppOrElementRef, ApprovalProcessRef, AutomationCatalogRef, CloudLinkRef, ConnectorRef, DocumentModelFieldRef, FieldRef, FileReaderCatalogRef, OutputPropertyRef, PhoneServiceRef, ProcedureParameterType, ProcedureRef, SearchTableRef, TableRef } from "../../catalog/index.js";
|
|
14
|
+
import type { AgentRef, AppOrElementOrTaskRef, AppOrElementRef, ApprovalProcessRef, AutomationCatalogRef, CloudLinkRef, ConnectorRef, DocumentModelFieldRef, FieldRef, FileReaderCatalogRef, GroupRef, OutputPropertyRef, PhoneServiceRef, ProcedureParameterType, ProcedureRef, SearchTableRef, TableRef } from "../../catalog/index.js";
|
|
15
15
|
import type { UnsafePlatformId } from "../../core/platform-id.js";
|
|
16
16
|
import type { CalculationInclude, Expr, ExprCardinality, ExprContext, ExprType } from "../field/calc/types.js";
|
|
17
17
|
import type { RecordId, RecordShape } from "../field/record-shape.js";
|
|
18
18
|
import type { RoleUserRef } from "../role/build.js";
|
|
19
|
-
import type
|
|
19
|
+
import { type Ref, type ValueOrRef } from "../shared/ref.js";
|
|
20
20
|
import type { DropdownValue } from "../shared/types/platform.js";
|
|
21
21
|
import type { ActionDef } from "./build.js";
|
|
22
22
|
import { type CalculationValue } from "./calculation-expression.js";
|
|
@@ -124,6 +124,22 @@ export interface UpdateFieldOptions<A extends AppOrElementOrTaskRef = AppOrEleme
|
|
|
124
124
|
export declare function updateField<A extends AppOrElementOrTaskRef, const Fields extends readonly FieldAssignment[]>(opts: UpdateFieldOptions<A, Fields>): ActionDef<{
|
|
125
125
|
record: RecordShape<A>;
|
|
126
126
|
}>;
|
|
127
|
+
/** The two scalar outputs a bulk update exposes. */
|
|
128
|
+
export interface BulkUpdateFieldsOutput {
|
|
129
|
+
readonly recordsUpdated: number;
|
|
130
|
+
readonly allMatchingRecordsUpdated: boolean;
|
|
131
|
+
}
|
|
132
|
+
export interface BulkUpdateFieldsOptions<A extends AppOrElementOrTaskRef = AppOrElementOrTaskRef, Fields extends readonly FieldAssignment[] = readonly FieldAssignment[]> {
|
|
133
|
+
readonly app: A;
|
|
134
|
+
/** Required — every record matching this filter is updated (use `filter.whereTrue()` for all). */
|
|
135
|
+
readonly filter: Filter;
|
|
136
|
+
readonly fields: Fields & ValidatedUpdateFieldAssignments<NoInfer<Fields>>;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Update fields on every record matching a filter — a filter-scoped mass
|
|
140
|
+
* updateField. No single-record option: the filter selects the set.
|
|
141
|
+
*/
|
|
142
|
+
export declare function bulkUpdateFields<A extends AppOrElementOrTaskRef, const Fields extends readonly FieldAssignment[]>(opts: BulkUpdateFieldsOptions<A, Fields>): ActionDef<BulkUpdateFieldsOutput>;
|
|
127
143
|
export interface FindRelatedRecordsOptions<A extends AppOrElementOrTaskRef = AppOrElementOrTaskRef> {
|
|
128
144
|
readonly relatedApp: A;
|
|
129
145
|
/**
|
|
@@ -334,10 +350,15 @@ export interface ExecuteScriptListInputToken {
|
|
|
334
350
|
readonly fields: readonly ExecuteScriptFieldMapping[];
|
|
335
351
|
}
|
|
336
352
|
/**
|
|
337
|
-
* Wrap a
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
353
|
+
* Wrap a record-valued executeScript input with the field mappings the script
|
|
354
|
+
* can read - which fields, and under what alias. The value is a whole record
|
|
355
|
+
* or a list of records (a prior task's `.records`, read per item).
|
|
356
|
+
*
|
|
357
|
+
* Inside this wrapper these deploy the whole record: a record trigger's
|
|
358
|
+
* `ctx.trigger.record`, and the `.record` of `recordSearch`, `createRecord`
|
|
359
|
+
* and `updateField`. Elsewhere they are the record ID a `record:` slot takes.
|
|
360
|
+
* An on-demand record parameter and `findRelatedRecords`' `.record` expose
|
|
361
|
+
* only the record ID, so they stay the ID here too.
|
|
341
362
|
*/
|
|
342
363
|
export declare function withFieldMappings(value: ValueOrRef<unknown>, fields: readonly ExecuteScriptFieldMapping[]): ExecuteScriptListInputToken;
|
|
343
364
|
export interface ExecuteScriptOptions<O extends ScriptOutputs | undefined = undefined> {
|
|
@@ -358,8 +379,9 @@ export interface ExecuteScriptOptions<O extends ScriptOutputs | undefined = unde
|
|
|
358
379
|
*/
|
|
359
380
|
readonly code: ScriptCodeFn<Record<string, unknown>, Record<string, unknown>> | ScriptFile;
|
|
360
381
|
/**
|
|
361
|
-
* A
|
|
362
|
-
*
|
|
382
|
+
* A record-valued input (a whole record, or a list of records) can carry
|
|
383
|
+
* {@link withFieldMappings} to declare which fields the script can read, and
|
|
384
|
+
* under what alias.
|
|
363
385
|
*/
|
|
364
386
|
readonly inputs?: Record<string, ValueOrRef<unknown> | ExecuteScriptListInputToken>;
|
|
365
387
|
/**
|
|
@@ -388,7 +410,26 @@ export interface ApiRequestHeader {
|
|
|
388
410
|
readonly name: string;
|
|
389
411
|
readonly value: ValueOrRef<unknown>;
|
|
390
412
|
}
|
|
413
|
+
/**
|
|
414
|
+
* A required sensitive Terraform variable for a write-only value the export
|
|
415
|
+
* could not read (an API header, or basic auth's username). Plan refuses
|
|
416
|
+
* until `TF_VAR_<variable>` is a non-empty string. This is not a vault
|
|
417
|
+
* secret — vault-entry references are a separate contract.
|
|
418
|
+
*/
|
|
419
|
+
export interface RequiredSecret {
|
|
420
|
+
readonly kind: "requiredSecret";
|
|
421
|
+
readonly variable: string;
|
|
422
|
+
}
|
|
423
|
+
export declare function requiredSecret(variable: string): RequiredSecret;
|
|
424
|
+
export declare function isRequiredSecret(value: unknown): value is RequiredSecret;
|
|
391
425
|
export interface ApiRequestBasicAuth {
|
|
426
|
+
/**
|
|
427
|
+
* A static username, a `requiredSecret()` write-only username, or
|
|
428
|
+
* `secret("KEY")` for a username bound to a vault entry. A vault-bound
|
|
429
|
+
* username builds to `basic_auth.reference_username` through a key-only
|
|
430
|
+
* `elementum_vault_entry` lookup, so no vault ID or value lands in source
|
|
431
|
+
* or HCL (edk#1283).
|
|
432
|
+
*/
|
|
392
433
|
readonly username: ValueOrRef<unknown>;
|
|
393
434
|
/**
|
|
394
435
|
* elementum_api_task's `basic_auth.reference_password` - a dynamic
|
|
@@ -414,16 +455,18 @@ export interface ApiRequestBearerAuth {
|
|
|
414
455
|
readonly referenceToken?: ValueOrRef<unknown>;
|
|
415
456
|
}
|
|
416
457
|
/**
|
|
417
|
-
* elementum_api_task's `oauth` block (client-credentials grant).
|
|
418
|
-
* `clientSecret`
|
|
458
|
+
* elementum_api_task's `oauth` block (client-credentials grant). A plain
|
|
459
|
+
* string `clientId`/`clientSecret` is static and write-only on read like
|
|
419
460
|
* bearer_auth.token - always resent from authored source, never
|
|
420
|
-
* reconstructed from a pull.
|
|
421
|
-
* `
|
|
461
|
+
* reconstructed from a pull. `secret("KEY")` binds either one to a vault
|
|
462
|
+
* entry instead: it builds to `reference_client_id`/`reference_client_secret`
|
|
463
|
+
* through a key-only `elementum_vault_entry` lookup and round-trips through a
|
|
464
|
+
* pull (edk#1283). Mutually exclusive with `basicAuth`/`bearerAuth`.
|
|
422
465
|
*/
|
|
423
466
|
export interface ApiRequestOAuth {
|
|
424
467
|
readonly url?: ValueOrRef<unknown>;
|
|
425
|
-
readonly clientId?: string
|
|
426
|
-
readonly clientSecret?: string
|
|
468
|
+
readonly clientId?: string | Ref<string>;
|
|
469
|
+
readonly clientSecret?: string | Ref<string>;
|
|
427
470
|
readonly requestType: "BASIC" | "FORM";
|
|
428
471
|
readonly headers?: readonly ApiRequestHeader[];
|
|
429
472
|
}
|
|
@@ -494,6 +537,14 @@ export interface AiSearchTableOptions {
|
|
|
494
537
|
*/
|
|
495
538
|
export interface AiSearchTableOutput {
|
|
496
539
|
readonly records: readonly unknown[];
|
|
540
|
+
/** `refs["All Records Text"]`: every found record rendered as text (e.g. for an AI prompt). */
|
|
541
|
+
readonly recordsText: string;
|
|
542
|
+
/** `refs["All Records JSON"]`. */
|
|
543
|
+
readonly recordsJson: unknown;
|
|
544
|
+
/** `refs["First Record Text"]`. */
|
|
545
|
+
readonly firstRecordText: string;
|
|
546
|
+
/** `refs["First Record JSON"]`. */
|
|
547
|
+
readonly firstRecordJson: unknown;
|
|
497
548
|
}
|
|
498
549
|
export declare function aiSearchTable(opts: AiSearchTableOptions): ActionDef<AiSearchTableOutput>;
|
|
499
550
|
export interface AiSummarizeOptions {
|
|
@@ -563,13 +614,19 @@ export declare function aiClassify(opts: AiClassifyOptions): ActionDef<{
|
|
|
563
614
|
output: unknown;
|
|
564
615
|
}>;
|
|
565
616
|
type Empty = Record<string, never>;
|
|
617
|
+
/** A user recipient picked by identity rather than mapped from a record. */
|
|
618
|
+
export type StaticUserRecipient = RoleUserRef | string;
|
|
619
|
+
/** A group recipient picked by identity rather than mapped from a record. */
|
|
620
|
+
export type StaticGroupRecipient = GroupRef | string;
|
|
566
621
|
export interface NotificationOptions {
|
|
567
622
|
readonly title: ValueOrRef<string>;
|
|
568
623
|
readonly message: ValueOrRef<string>;
|
|
569
|
-
/**
|
|
570
|
-
readonly description?: string
|
|
571
|
-
|
|
572
|
-
readonly
|
|
624
|
+
/** Description shown in the notification's metadata. Supports templates with value references. */
|
|
625
|
+
readonly description?: ValueOrRef<string>;
|
|
626
|
+
/** Users picked directly as recipients: `userRef(email)`, or a platform id. */
|
|
627
|
+
readonly userIds?: readonly StaticUserRecipient[];
|
|
628
|
+
/** Groups picked directly as recipients: an `org.groups.<key>` token, or a platform id. */
|
|
629
|
+
readonly groupIds?: readonly StaticGroupRecipient[];
|
|
573
630
|
readonly userRefs?: readonly ValueOrRef<string>[];
|
|
574
631
|
readonly groupRefs?: readonly ValueOrRef<string>[];
|
|
575
632
|
/** Also notify the record's watchers. */
|
|
@@ -587,8 +644,8 @@ export interface AssignGroupOptions {
|
|
|
587
644
|
}
|
|
588
645
|
export declare function assignGroup(opts: AssignGroupOptions): ActionDef<Empty>;
|
|
589
646
|
export interface AddWatcherOptions {
|
|
590
|
-
readonly userIds?: readonly
|
|
591
|
-
readonly groupIds?: readonly
|
|
647
|
+
readonly userIds?: readonly StaticUserRecipient[];
|
|
648
|
+
readonly groupIds?: readonly StaticGroupRecipient[];
|
|
592
649
|
readonly record?: ValueOrRef<unknown>;
|
|
593
650
|
}
|
|
594
651
|
export declare function addWatcher(opts: AddWatcherOptions): ActionDef<Empty>;
|
|
@@ -613,6 +670,8 @@ export interface FoundUserShape {
|
|
|
613
670
|
}
|
|
614
671
|
/** Outputs of a user search (the platform's "User's Id", "Manager Email", "All found users", …). */
|
|
615
672
|
export interface UserSearchOutput {
|
|
673
|
+
/** `refs["Users Size"]`: how many users matched. */
|
|
674
|
+
readonly count: number;
|
|
616
675
|
readonly user: FoundUserShape;
|
|
617
676
|
readonly users: readonly unknown[];
|
|
618
677
|
}
|
|
@@ -822,7 +881,8 @@ type WorkflowOutputValue<T extends string | undefined, Multiple extends boolean
|
|
|
822
881
|
export type RunAutomationOutput<A extends AutomationCatalogRef> = A["outputs"] extends Record<string, OutputPropertyRef> ? {
|
|
823
882
|
readonly [K in keyof A["outputs"]]: WorkflowOutputValue<A["outputs"][K]["valueType"], A["outputs"][K]["multiple"]>;
|
|
824
883
|
} : Record<string, unknown>;
|
|
825
|
-
|
|
884
|
+
/** The UI's "Select Automation" mode: a known automation chosen at build time. */
|
|
885
|
+
export interface RunAutomationStaticOptions<A extends AutomationCatalogRef = AutomationCatalogRef> {
|
|
826
886
|
readonly automation: A;
|
|
827
887
|
readonly synchronous?: boolean;
|
|
828
888
|
/**
|
|
@@ -838,7 +898,41 @@ export interface RunAutomationOptions<A extends AutomationCatalogRef = Automatio
|
|
|
838
898
|
*/
|
|
839
899
|
readonly outputs?: readonly string[];
|
|
840
900
|
}
|
|
841
|
-
|
|
901
|
+
/**
|
|
902
|
+
* The UI's "Dynamic Reference" mode: the automation to run is a value
|
|
903
|
+
* resolved at runtime, such as a trigger parameter or an earlier step's
|
|
904
|
+
* output holding an automation ID. The platform always waits for a dynamic
|
|
905
|
+
* target, so `synchronous` must be `true`.
|
|
906
|
+
*/
|
|
907
|
+
export interface RunAutomationDynamicReferenceOptions<Outputs extends readonly string[] | undefined = undefined> {
|
|
908
|
+
readonly automation: Ref<string>;
|
|
909
|
+
readonly synchronous: true;
|
|
910
|
+
/** Input mappings by the target's on-demand trigger parameter **name**. */
|
|
911
|
+
readonly inputs?: readonly RunAutomationInput[];
|
|
912
|
+
/**
|
|
913
|
+
* Output names to capture from whichever automation runs. The target is
|
|
914
|
+
* unknown at build time, so each captured name is `unknown`. Omitting
|
|
915
|
+
* `outputs` exposes nothing on the step result.
|
|
916
|
+
*/
|
|
917
|
+
readonly outputs?: Outputs;
|
|
918
|
+
}
|
|
919
|
+
/** Keys of a Dynamic Reference `runAutomation` step. Empty when `outputs` is omitted. */
|
|
920
|
+
export type RunAutomationDynamicResult<Outputs extends readonly string[] | undefined> = [
|
|
921
|
+
Outputs
|
|
922
|
+
] extends [readonly string[]] ? {
|
|
923
|
+
readonly [K in Outputs[number]]: unknown;
|
|
924
|
+
} : Record<never, never>;
|
|
925
|
+
/** Step result for one `runAutomation` options object, static or Dynamic Reference. */
|
|
926
|
+
export type RunAutomationStepResult<O> = O extends {
|
|
927
|
+
readonly automation: Ref<string>;
|
|
928
|
+
} ? RunAutomationDynamicResult<O extends {
|
|
929
|
+
readonly outputs?: infer Out extends readonly string[] | undefined;
|
|
930
|
+
} ? Out : undefined> : O extends {
|
|
931
|
+
readonly automation: infer A extends AutomationCatalogRef;
|
|
932
|
+
} ? RunAutomationOutput<A> : Record<string, unknown>;
|
|
933
|
+
export type RunAutomationOptions<A extends AutomationCatalogRef = AutomationCatalogRef> = RunAutomationStaticOptions<A> | RunAutomationDynamicReferenceOptions;
|
|
934
|
+
export declare function runAutomation<const A extends AutomationCatalogRef>(opts: RunAutomationStaticOptions<A>): ActionDef<RunAutomationOutput<A>>;
|
|
935
|
+
export declare function runAutomation<const Outputs extends readonly string[] | undefined = undefined>(opts: RunAutomationDynamicReferenceOptions<Outputs>): ActionDef<RunAutomationDynamicResult<Outputs>>;
|
|
842
936
|
export type ReadFileDataSource = {
|
|
843
937
|
readonly type: "attachmentId";
|
|
844
938
|
readonly value: ValueOrRef<unknown>;
|