@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,9 +1,16 @@
|
|
|
1
1
|
import { serializeValueOrRef } from "../../core/wire/ref-serializer.js";
|
|
2
2
|
import { isExpr } from "../field/calc/runtime.js";
|
|
3
|
+
import { isRef } from "../shared/ref.js";
|
|
3
4
|
import { renderCalculationExpression, } from "./calculation-expression.js";
|
|
4
|
-
import { extractScriptBody, isScriptFile, readScriptFile } from "./script-code.js";
|
|
5
|
+
import { extractScriptBody, isScriptFile, readScriptFile, toPlatformScriptBody } from "./script-code.js";
|
|
5
6
|
function workflowFields(fields) {
|
|
6
|
-
return fields.map((f) => {
|
|
7
|
+
return fields.map((f, index) => {
|
|
8
|
+
if (typeof f.field !== "object" || f.field === null) {
|
|
9
|
+
// `app.fields.someKey` evaluates to undefined when the key is not in the
|
|
10
|
+
// bag (renamed or removed, e.g. by a re-pull, #1579).
|
|
11
|
+
throw new Error(`updateField: fields[${index}].field is ${String(f.field)}; the field key it reads does not exist on its app/element ` +
|
|
12
|
+
"(renamed or removed?). Check the app's fields bag for the current key.");
|
|
13
|
+
}
|
|
7
14
|
const updateMode = "updateMode" in f ? f.updateMode : undefined;
|
|
8
15
|
const fieldType = "fieldType" in f.field ? f.field.fieldType : undefined;
|
|
9
16
|
if (updateMode !== undefined && fieldType !== "MULTI_PICKLIST" && fieldType !== "MULTI_PICKLIST_ID") {
|
|
@@ -17,6 +24,9 @@ function workflowFields(fields) {
|
|
|
17
24
|
};
|
|
18
25
|
});
|
|
19
26
|
}
|
|
27
|
+
function recordKindOf(target) {
|
|
28
|
+
return target.__kind === "app" || target.__kind === "element" ? { __recordKind: target.__kind } : {};
|
|
29
|
+
}
|
|
20
30
|
export function recordSearch(opts) {
|
|
21
31
|
return {
|
|
22
32
|
key: "recordSearch",
|
|
@@ -27,6 +37,7 @@ export function recordSearch(opts) {
|
|
|
27
37
|
...(opts.limit !== undefined ? { limit: opts.limit } : {}),
|
|
28
38
|
},
|
|
29
39
|
__recordApp: opts.app.refName,
|
|
40
|
+
...recordKindOf(opts.app),
|
|
30
41
|
};
|
|
31
42
|
}
|
|
32
43
|
export function tableRecordsSearch(opts) {
|
|
@@ -54,6 +65,7 @@ export function createRecord(opts) {
|
|
|
54
65
|
...(opts.record !== undefined ? { recordReference: serializeValueOrRef(opts.record) } : {}),
|
|
55
66
|
},
|
|
56
67
|
__recordApp: opts.app.refName,
|
|
68
|
+
...recordKindOf(opts.app),
|
|
57
69
|
};
|
|
58
70
|
}
|
|
59
71
|
/** Update fields on an existing record. `value: ""` or `value: null` clears a nullable field (including Dropdown). */
|
|
@@ -68,6 +80,25 @@ export function updateField(opts) {
|
|
|
68
80
|
workflowFields: workflowFields(opts.fields),
|
|
69
81
|
},
|
|
70
82
|
__recordApp: opts.app.refName,
|
|
83
|
+
...recordKindOf(opts.app),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Update fields on every record matching a filter — a filter-scoped mass
|
|
88
|
+
* updateField. No single-record option: the filter selects the set.
|
|
89
|
+
*/
|
|
90
|
+
export function bulkUpdateFields(opts) {
|
|
91
|
+
if (opts.fields.length === 0)
|
|
92
|
+
throw new Error("bulkUpdateFields requires at least one field.");
|
|
93
|
+
return {
|
|
94
|
+
key: "bulkUpdateFields",
|
|
95
|
+
config: {
|
|
96
|
+
aspectId: opts.app,
|
|
97
|
+
filter: opts.filter,
|
|
98
|
+
workflowFields: workflowFields(opts.fields),
|
|
99
|
+
},
|
|
100
|
+
__recordApp: opts.app.refName,
|
|
101
|
+
...recordKindOf(opts.app),
|
|
71
102
|
};
|
|
72
103
|
}
|
|
73
104
|
export function findRelatedRecords(opts) {
|
|
@@ -249,28 +280,41 @@ function outputSchemaNode(name, type) {
|
|
|
249
280
|
},
|
|
250
281
|
};
|
|
251
282
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
283
|
+
return outputSchemaObjectNode(name, type.properties);
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* The platform's object node. An object with no properties carries no
|
|
287
|
+
* `properties` key: live GraphQL returns `properties: []`, and both ei export
|
|
288
|
+
* and provider import omit the empty list, so emitting `properties = []`
|
|
289
|
+
* would differ from imported state and plan an in-place update. The provider
|
|
290
|
+
* sends the required empty list itself when the key is absent.
|
|
291
|
+
*/
|
|
292
|
+
function outputSchemaObjectNode(name, declared) {
|
|
293
|
+
const properties = Object.entries(declared ?? {})
|
|
294
|
+
.map(([propertyName, propertyType]) => outputSchemaNode(propertyName, propertyType));
|
|
255
295
|
return {
|
|
256
296
|
object: {
|
|
257
297
|
...(name === undefined ? {} : { name }),
|
|
258
|
-
...(properties ===
|
|
298
|
+
...(properties.length === 0 ? {} : { properties }),
|
|
259
299
|
},
|
|
260
300
|
};
|
|
261
301
|
}
|
|
262
302
|
/** Map an output schema to the platform's tagged object shape. */
|
|
263
303
|
function outputSchema(outputs) {
|
|
264
304
|
const { name: rootName, properties: declared } = normalizeScriptOutputs(outputs);
|
|
265
|
-
|
|
266
|
-
return { object: { ...(rootName !== undefined ? { name: rootName } : {}), properties } };
|
|
305
|
+
return outputSchemaObjectNode(rootName, declared);
|
|
267
306
|
}
|
|
268
307
|
const EXECUTE_SCRIPT_LIST_INPUT_MARKER = "__edkExecuteScriptListInput";
|
|
269
308
|
/**
|
|
270
|
-
* Wrap a
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
309
|
+
* Wrap a record-valued executeScript input with the field mappings the script
|
|
310
|
+
* can read - which fields, and under what alias. The value is a whole record
|
|
311
|
+
* or a list of records (a prior task's `.records`, read per item).
|
|
312
|
+
*
|
|
313
|
+
* Inside this wrapper these deploy the whole record: a record trigger's
|
|
314
|
+
* `ctx.trigger.record`, and the `.record` of `recordSearch`, `createRecord`
|
|
315
|
+
* and `updateField`. Elsewhere they are the record ID a `record:` slot takes.
|
|
316
|
+
* An on-demand record parameter and `findRelatedRecords`' `.record` expose
|
|
317
|
+
* only the record ID, so they stay the ID here too.
|
|
274
318
|
*/
|
|
275
319
|
export function withFieldMappings(value, fields) {
|
|
276
320
|
return { [EXECUTE_SCRIPT_LIST_INPUT_MARKER]: true, value, fields };
|
|
@@ -308,7 +352,22 @@ export function executeScriptActionDefWithBody(body, opts) {
|
|
|
308
352
|
};
|
|
309
353
|
}
|
|
310
354
|
export function executeScript(opts) {
|
|
311
|
-
|
|
355
|
+
const body = isScriptFile(opts.code)
|
|
356
|
+
? toPlatformScriptBody(readScriptFile(opts.code), `executeScript scriptFile("${opts.code.path}")`, { stripTypes: false })
|
|
357
|
+
: toPlatformScriptBody(extractScriptBody(opts.code), "executeScript");
|
|
358
|
+
return executeScriptActionDefWithBody(body, opts);
|
|
359
|
+
}
|
|
360
|
+
const TF_VARIABLE_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
361
|
+
export function requiredSecret(variable) {
|
|
362
|
+
if (!TF_VARIABLE_NAME.test(variable)) {
|
|
363
|
+
throw new Error(`requiredSecret() needs a Terraform variable name (letters, digits, underscore; no leading digit), got ${JSON.stringify(variable)}`);
|
|
364
|
+
}
|
|
365
|
+
return { kind: "requiredSecret", variable };
|
|
366
|
+
}
|
|
367
|
+
export function isRequiredSecret(value) {
|
|
368
|
+
return typeof value === "object" && value !== null &&
|
|
369
|
+
value.kind === "requiredSecret" &&
|
|
370
|
+
typeof value.variable === "string";
|
|
312
371
|
}
|
|
313
372
|
function apiRequestHeaders(headers) {
|
|
314
373
|
return (headers ?? []).map((h) => ({ name: h.name, value: serializeValueOrRef(h.value) }));
|
|
@@ -355,8 +414,12 @@ export function apiRequest(opts) {
|
|
|
355
414
|
oauth: {
|
|
356
415
|
requestType: opts.oauth.requestType,
|
|
357
416
|
...(opts.oauth.url !== undefined ? { url: serializeValueOrRef(opts.oauth.url) } : {}),
|
|
358
|
-
...(opts.oauth.clientId !== undefined
|
|
359
|
-
|
|
417
|
+
...(opts.oauth.clientId !== undefined
|
|
418
|
+
? { clientId: typeof opts.oauth.clientId === "string" ? opts.oauth.clientId : serializeValueOrRef(opts.oauth.clientId) }
|
|
419
|
+
: {}),
|
|
420
|
+
...(opts.oauth.clientSecret !== undefined
|
|
421
|
+
? { clientSecret: typeof opts.oauth.clientSecret === "string" ? opts.oauth.clientSecret : serializeValueOrRef(opts.oauth.clientSecret) }
|
|
422
|
+
: {}),
|
|
360
423
|
...(opts.oauth.headers !== undefined ? { headers: apiRequestHeaders(opts.oauth.headers) } : {}),
|
|
361
424
|
},
|
|
362
425
|
} : {}),
|
|
@@ -494,19 +557,12 @@ export function aiClassify(opts) {
|
|
|
494
557
|
};
|
|
495
558
|
}
|
|
496
559
|
export function notification(opts) {
|
|
497
|
-
if (!opts.userIds?.length &&
|
|
498
|
-
!opts.groupIds?.length &&
|
|
499
|
-
!opts.userRefs?.length &&
|
|
500
|
-
!opts.groupRefs?.length &&
|
|
501
|
-
!opts.notifyWatchers) {
|
|
502
|
-
throw new Error("notification requires at least one recipient (userIds, groupIds, userRefs, groupRefs, or notifyWatchers).");
|
|
503
|
-
}
|
|
504
560
|
return {
|
|
505
561
|
key: "notification",
|
|
506
562
|
config: {
|
|
507
563
|
titleReference: serializeValueOrRef(opts.title),
|
|
508
564
|
messageReference: serializeValueOrRef(opts.message),
|
|
509
|
-
...(opts.description !== undefined ? {
|
|
565
|
+
...(opts.description !== undefined ? { descriptionReference: serializeValueOrRef(opts.description) } : {}),
|
|
510
566
|
...(opts.userIds?.length ? { userIds: opts.userIds } : {}),
|
|
511
567
|
...(opts.groupIds?.length ? { groupIds: opts.groupIds } : {}),
|
|
512
568
|
...(opts.userRefs !== undefined ? { users: refList(opts.userRefs) } : {}),
|
|
@@ -785,10 +841,16 @@ export function approvalStatusUpdate(opts) {
|
|
|
785
841
|
export function runAutomation(opts) {
|
|
786
842
|
const inputs = opts.inputs ?? [];
|
|
787
843
|
const outputs = opts.outputs ?? [];
|
|
844
|
+
const dynamic = isRef(opts.automation);
|
|
845
|
+
if (dynamic && opts.synchronous !== true) {
|
|
846
|
+
throw new Error("runAutomation: a Dynamic Reference target requires synchronous: true");
|
|
847
|
+
}
|
|
788
848
|
return {
|
|
789
849
|
key: "runAutomation",
|
|
790
850
|
config: {
|
|
791
|
-
|
|
851
|
+
...(dynamic
|
|
852
|
+
? { targetAutomationRef: serializeValueOrRef(opts.automation) }
|
|
853
|
+
: { targetAutomationId: opts.automation }),
|
|
792
854
|
synchronous: opts.synchronous ?? false,
|
|
793
855
|
...(inputs.length > 0
|
|
794
856
|
? { inputMappings: inputs.map((input) => ({ name: input.name, value: serializeValueOrRef(input.value) })) }
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DeployableEntity } from "../../engine/entity.js";
|
|
2
|
-
import { type
|
|
2
|
+
import { type ValidationFailure } from "../../engine/validation.js";
|
|
3
|
+
import { type ChildResourceScope, type TfBlock, type TfExpr, type TfValue } from "../../engine/tf/index.js";
|
|
3
4
|
import { type OrgRefLookup, type WorkspaceAspect } from "../../engine/build/context.js";
|
|
4
5
|
import type { BuildFieldMetadata } from "../../graph/types.js";
|
|
5
6
|
import type { AppServiceAccount } from "../service-account/build.js";
|
|
@@ -8,6 +9,12 @@ export interface AutomationToTfContext {
|
|
|
8
9
|
readonly appRefName?: string;
|
|
9
10
|
/** The product owner kind; defaults to app for direct legacy callers. */
|
|
10
11
|
readonly parentScope?: "app" | "element";
|
|
12
|
+
/** Element handle. ei prefixes element automation labels with SanitizeName(handle). */
|
|
13
|
+
readonly ownerHandle?: string;
|
|
14
|
+
/** Element owners only: the element declares `systemFields.audit`. */
|
|
15
|
+
readonly ownerAuditFields?: boolean;
|
|
16
|
+
/** RefNames of the workspace's elements without `systemFields.audit`. */
|
|
17
|
+
readonly elementsWithoutAuditFields?: ReadonlySet<string>;
|
|
11
18
|
readonly appTfLabel: string;
|
|
12
19
|
readonly fieldAddresses?: ReadonlyMap<string, string>;
|
|
13
20
|
readonly fieldNames?: ReadonlyMap<string, string>;
|
|
@@ -62,11 +69,25 @@ export interface AutomationToTfContext {
|
|
|
62
69
|
*/
|
|
63
70
|
readonly localsAttrs?: Record<string, TfValue>;
|
|
64
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Terraform data label for a vault key. Keep this in lockstep with the
|
|
74
|
+
* exporter's VaultEntryLabel: readable for conventional uppercase keys and
|
|
75
|
+
* hash-suffixed whenever normalization could collide.
|
|
76
|
+
*/
|
|
77
|
+
export declare function vaultEntryLabel(key: string): string;
|
|
65
78
|
export interface AutomationToTfResult {
|
|
66
79
|
readonly blocks: readonly TfBlock[];
|
|
67
80
|
readonly address: string;
|
|
68
81
|
}
|
|
69
82
|
/** Run-automation targets reference publish for ACTIVE automations, automation for draft/inactive. */
|
|
70
|
-
export declare function automationRunTargetResourceAttr(appTfLabel: string, automationRefName: string, activeAutomationRefNames: ReadonlySet<string> | undefined): TfExpr;
|
|
71
|
-
/**
|
|
83
|
+
export declare function automationRunTargetResourceAttr(appTfLabel: string, automationRefName: string, activeAutomationRefNames: ReadonlySet<string> | undefined, scope?: ChildResourceScope, handle?: string): TfExpr;
|
|
84
|
+
/**
|
|
85
|
+
* edk#1499: script-input field mappings read fields off a whole record. A
|
|
86
|
+
* value that exposes only a record ID (an onDemand record parameter, or
|
|
87
|
+
* findRelatedRecords' `.record`) deploys refs["Record"] (ASPECT_RECORD_ID)
|
|
88
|
+
* plus field mappings, and the script receives `{}` at runtime. Record
|
|
89
|
+
* triggers' `ctx.trigger.record` and the `.record` of recordSearch,
|
|
90
|
+
* createRecord and updateField carry the whole record (#1284, #1489).
|
|
91
|
+
*/
|
|
92
|
+
export declare function recordIdFieldMappingFailures(entity: DeployableEntity, payload: object, address: string): ValidationFailure[];
|
|
72
93
|
export declare function automationToTf(entity: DeployableEntity, ctx: AutomationToTfContext): AutomationToTfResult;
|