@elementumai/edk 0.10.2 → 0.10.4
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 +7 -7
- package/dist-sdk/src/catalog/org.d.ts +7 -5
- package/dist-sdk/src/catalog/org.js +14 -9
- package/dist-sdk/src/catalog/token.js +4 -0
- package/dist-sdk/src/core/types/app.d.ts +22 -0
- package/dist-sdk/src/engine/build/context.d.ts +8 -0
- package/dist-sdk/src/engine/build/source-context.d.ts +3 -4
- package/dist-sdk/src/engine/coverage-gaps.d.ts +2 -0
- package/dist-sdk/src/engine/coverage-gaps.js +3 -0
- package/dist-sdk/src/engine/ei/state.d.ts +48 -0
- package/dist-sdk/src/engine/ei/state.js +91 -0
- package/dist-sdk/src/engine/pull/authored-address.d.ts +100 -0
- package/dist-sdk/src/engine/pull/authored-address.js +360 -0
- package/dist-sdk/src/engine/pull/context.d.ts +69 -0
- package/dist-sdk/src/engine/tf/expr.d.ts +7 -0
- package/dist-sdk/src/engine/tf/expr.js +62 -18
- package/dist-sdk/src/engine/tf/index.d.ts +2 -1
- package/dist-sdk/src/engine/tf/index.js +2 -1
- package/dist-sdk/src/engine/tf/labels.d.ts +10 -2
- package/dist-sdk/src/engine/tf/labels.js +15 -2
- package/dist-sdk/src/engine/tf/parse.js +19 -6
- package/dist-sdk/src/engine/tf/scan.d.ts +22 -0
- package/dist-sdk/src/engine/tf/scan.js +123 -0
- package/dist-sdk/src/engine/workspace/backend.d.ts +34 -0
- package/dist-sdk/src/engine/workspace/backend.js +104 -0
- package/dist-sdk/src/engine/workspace/generated-file.d.ts +3 -0
- package/dist-sdk/src/engine/workspace/generated-file.js +6 -0
- package/dist-sdk/src/engine/workspace/loader.d.ts +8 -0
- package/dist-sdk/src/engine/workspace/loader.js +22 -2
- package/dist-sdk/src/entities/agent/to-tf.d.ts +13 -11
- package/dist-sdk/src/entities/agent/to-tf.js +17 -12
- package/dist-sdk/src/entities/agent-tool/from-tf.js +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +10 -1
- package/dist-sdk/src/entities/app/build.d.ts +36 -4
- package/dist-sdk/src/entities/app/build.js +67 -4
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +18 -0
- package/dist-sdk/src/entities/app/from-tf.js +17 -9
- package/dist-sdk/src/entities/app/module.js +1 -0
- package/dist-sdk/src/entities/app/stage-keys.d.ts +82 -0
- package/dist-sdk/src/entities/app/stage-keys.js +160 -0
- package/dist-sdk/src/entities/app/to-tf.js +17 -21
- package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +9 -1
- package/dist-sdk/src/entities/approval-chain/from-tf.js +31 -3
- package/dist-sdk/src/entities/approval-chain/module.js +12 -4
- package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/approval-chain/to-tf.js +6 -1
- package/dist-sdk/src/entities/automation/build.js +25 -8
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +3 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +5 -3
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +90 -17
- package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -6
- package/dist-sdk/src/entities/automation/from-tf.js +140 -23
- package/dist-sdk/src/entities/automation/module.js +158 -44
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +8 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +20 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +2 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +18 -0
- package/dist-sdk/src/entities/automation/to-tf.d.ts +10 -1
- package/dist-sdk/src/entities/automation/to-tf.js +200 -38
- package/dist-sdk/src/entities/automation/triggers.d.ts +2 -0
- package/dist-sdk/src/entities/automation/triggers.js +1 -0
- package/dist-sdk/src/entities/chart/from-tf.d.ts +6 -0
- package/dist-sdk/src/entities/chart/from-tf.js +9 -1
- package/dist-sdk/src/entities/dashboard/from-tf.js +51 -4
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +48 -4
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +7 -2
- package/dist-sdk/src/entities/element/build.js +1 -1
- package/dist-sdk/src/entities/element/from-tf.d.ts +12 -6
- package/dist-sdk/src/entities/element/from-tf.js +26 -8
- package/dist-sdk/src/entities/element/module.js +3 -2
- package/dist-sdk/src/entities/element/to-tf.d.ts +3 -2
- package/dist-sdk/src/entities/element/to-tf.js +32 -25
- package/dist-sdk/src/entities/field/allow-list.d.ts +18 -0
- package/dist-sdk/src/entities/field/allow-list.js +42 -0
- package/dist-sdk/src/entities/field/build.d.ts +38 -3
- package/dist-sdk/src/entities/field/build.js +7 -2
- package/dist-sdk/src/entities/field/from-tf.js +178 -20
- package/dist-sdk/src/entities/field/module.js +2 -0
- package/dist-sdk/src/entities/field/options.d.ts +2 -0
- package/dist-sdk/src/entities/field/order.d.ts +9 -0
- package/dist-sdk/src/entities/field/order.js +33 -0
- package/dist-sdk/src/entities/field/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/field/to-tf.js +87 -0
- package/dist-sdk/src/entities/field/types.js +3 -0
- package/dist-sdk/src/entities/relationship/build.d.ts +3 -3
- package/dist-sdk/src/entities/relationship/from-tf.js +4 -2
- package/dist-sdk/src/entities/relationship/to-tf.js +3 -1
- package/dist-sdk/src/entities/service-account/workspace-owner.d.ts +8 -3
- package/dist-sdk/src/entities/service-account/workspace-owner.js +12 -4
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +5 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +13 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +7 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +1 -1
- package/dist-sdk/src/entities/skill/module.js +28 -2
- package/dist-sdk/src/entities/skill/to-tf.js +19 -14
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +3 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +6 -1
- package/dist-sdk/src/entities/skill-tool/to-tf.js +6 -1
- package/dist-sdk/src/entities/task/build.js +1 -1
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +6 -2
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +11 -0
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +13 -38
- package/dist-sdk/src/entities/view/custom-view-validate.d.ts +29 -0
- package/dist-sdk/src/entities/view/custom-view-validate.js +293 -0
- package/dist-sdk/src/entities/view/from-tf.d.ts +10 -0
- package/dist-sdk/src/entities/view/from-tf.js +164 -26
- package/dist-sdk/src/entities/view/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/view/to-tf.js +14 -6
- package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +2 -1
- package/dist-sdk/src/entities/visual-flow/from-tf.js +11 -2
- package/dist-sdk/src/entities/visual-flow/module.js +15 -5
- package/dist-sdk/src/entities/visual-flow/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/visual-flow/to-tf.js +1 -1
- package/dist-sdk/src/entities/widget/build.d.ts +8 -1
- package/dist-sdk/src/entities/widget/from-tf.js +12 -6
- package/dist-sdk/src/entities/widget/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/widget/to-tf.js +16 -0
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +8 -2
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +6 -0
- package/dist-sdk/src/graph/index.js +1 -0
- package/dist-sdk/src/graph/types.d.ts +66 -2
- package/package.json +2 -17
|
@@ -27,6 +27,26 @@ function stringFormatFieldType(format) {
|
|
|
27
27
|
return format;
|
|
28
28
|
return "TEXT";
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* True when the schema's only top-level property is a TEXT list (a format-less
|
|
32
|
+
* or EMAIL/UUID4 string array). The runtime then also fills
|
|
33
|
+
* `stringArrayResult` with it (#1725 live repro). DATE/DATETIME and object
|
|
34
|
+
* arrays don't count, and an unwrapped `{ properties }` root is no schema, as
|
|
35
|
+
* in build's `declaredScriptResultProperties`.
|
|
36
|
+
*/
|
|
37
|
+
export function scriptSchemaIsSingleStringArray(schema) {
|
|
38
|
+
if (!isObject(schema) || !isObject(schema.object))
|
|
39
|
+
return false;
|
|
40
|
+
const properties = schema.object.properties;
|
|
41
|
+
if (!Array.isArray(properties) || properties.length !== 1 || !isObject(properties[0]))
|
|
42
|
+
return false;
|
|
43
|
+
const array = properties[0].array;
|
|
44
|
+
if (!isObject(array) || !isObject(array.item) || !("string" in array.item))
|
|
45
|
+
return false;
|
|
46
|
+
const declared = [...(outputFieldTypesFromScriptSchema(schema) ?? [])].filter(([key]) => key.startsWith("result."));
|
|
47
|
+
const type = declared.length === 1 ? declared[0][1] : undefined;
|
|
48
|
+
return type?.kind === "array" && type.fieldType === "TEXT";
|
|
49
|
+
}
|
|
30
50
|
/** Map executeScript output_schema properties to refs keys (`result.<name>`). */
|
|
31
51
|
export function outputFieldTypesFromScriptSchema(schema) {
|
|
32
52
|
if (!isObject(schema))
|
|
@@ -45,6 +45,8 @@ export declare const OUTPUT_KEY_CANONICAL: Readonly<Record<string, string>>;
|
|
|
45
45
|
* onto `.output` too and rebuild it as `refs["text"]`.
|
|
46
46
|
*/
|
|
47
47
|
export declare function matchesOutputWireKey(segment: string, wireKey: string): boolean;
|
|
48
|
+
/** refs-map key for one AI completion task output, or undefined when `name` is not one. */
|
|
49
|
+
export declare function aiCompletionRefsIndex(resourceType: string, name: string): string | undefined;
|
|
48
50
|
/**
|
|
49
51
|
* apiRequest task outputs in authoring use camelCase segments (`statusCode`,
|
|
50
52
|
* `file.content`, …) but the provider refs map uses display labels — confirmed
|
|
@@ -56,6 +56,24 @@ export const OUTPUT_KEY_CANONICAL = {
|
|
|
56
56
|
export function matchesOutputWireKey(segment, wireKey) {
|
|
57
57
|
return segment === wireKey || segment === wireKey.toLowerCase();
|
|
58
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* AI completion task outputs: canonical (`service_tasks`) name → refs-map key.
|
|
61
|
+
* The provider's `refs` map is Title-Case (`Response`, `Success`, and
|
|
62
|
+
* aiClassify's `Reason`; see {@link OUTPUT_KEY_WIRE_NAME}), but a switch
|
|
63
|
+
* case's stored envelope names the output in lowercase, so pull prints
|
|
64
|
+
* `.success` and build must index `refs["Success"]` (edk#1730: Sanofi
|
|
65
|
+
* conciergeforfield plan failed with "Invalid index" on `refs["success"]`).
|
|
66
|
+
* Exact canonical names only; a Title-Case key passes through unchanged.
|
|
67
|
+
*/
|
|
68
|
+
const AI_COMPLETION_REFS_INDEX = {
|
|
69
|
+
elementum_ai_classify_task: { response: "Response", reason: "Reason", success: "Success" },
|
|
70
|
+
elementum_ai_summarize_task: { response: "Response", success: "Success" },
|
|
71
|
+
elementum_ai_transform_task: { response: "Response", success: "Success" },
|
|
72
|
+
};
|
|
73
|
+
/** refs-map key for one AI completion task output, or undefined when `name` is not one. */
|
|
74
|
+
export function aiCompletionRefsIndex(resourceType, name) {
|
|
75
|
+
return AI_COMPLETION_REFS_INDEX[resourceType]?.[name];
|
|
76
|
+
}
|
|
59
77
|
/**
|
|
60
78
|
* apiRequest task outputs in authoring use camelCase segments (`statusCode`,
|
|
61
79
|
* `file.content`, …) but the provider refs map uses display labels — confirmed
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DeployableEntity } from "../../engine/entity.js";
|
|
2
2
|
import { type ValidationFailure } from "../../engine/validation.js";
|
|
3
3
|
import { type ChildResourceScope, type TfBlock, type TfExpr, type TfValue } from "../../engine/tf/index.js";
|
|
4
|
-
import { type OrgRefLookup, type WorkspaceAspect } from "../../engine/build/context.js";
|
|
4
|
+
import { type ForeignRootIdentity, type OrgRefLookup, type WorkspaceAspect } from "../../engine/build/context.js";
|
|
5
5
|
import type { BuildFieldMetadata } from "../../graph/types.js";
|
|
6
6
|
import type { AppServiceAccount } from "../service-account/build.js";
|
|
7
7
|
export interface AutomationToTfContext {
|
|
@@ -33,6 +33,13 @@ export interface AutomationToTfContext {
|
|
|
33
33
|
* searched aspect's own `<resource>.<label>.id` to interpolate.
|
|
34
34
|
*/
|
|
35
35
|
readonly fieldAddressesByAppRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>;
|
|
36
|
+
/**
|
|
37
|
+
* Every app/element authored in the workspace, keyed by
|
|
38
|
+
* `workspaceAspectKey`, including those this build leaves out (pull builds
|
|
39
|
+
* only the pulled root). A calculation over such a sibling's found record
|
|
40
|
+
* addresses the field by data lookup.
|
|
41
|
+
*/
|
|
42
|
+
readonly authoredAspectKeys?: ReadonlySet<string>;
|
|
36
43
|
/** Build-time tolerance for stale labels retained by pulled automations. */
|
|
37
44
|
readonly allowUnknownPicklistOptions?: boolean;
|
|
38
45
|
readonly orgRefs?: OrgRefLookup;
|
|
@@ -59,6 +66,8 @@ export interface AutomationToTfContext {
|
|
|
59
66
|
* label shape from an element-owned one.
|
|
60
67
|
*/
|
|
61
68
|
readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
|
|
69
|
+
/** See `ToTfContext.outOfScopeApps`. */
|
|
70
|
+
readonly outOfScopeApps?: ReadonlyMap<string, ForeignRootIdentity>;
|
|
62
71
|
/**
|
|
63
72
|
* The build's shared `locals.tf` attrs map — mutated in place so a foreign
|
|
64
73
|
* field crossing through {@link crossAppFieldToTf} can contribute its own
|
|
@@ -8,10 +8,12 @@ import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
|
8
8
|
import { SEARCH_TABLE_RESOURCE_TYPES } from "../search-table/types.js";
|
|
9
9
|
import { fieldRefToTfValue } from "../field/to-tf.js";
|
|
10
10
|
import { SERVICE_ACCOUNT_RESOURCE_TYPE } from "../service-account/module.js";
|
|
11
|
+
import { serviceAccountRefToTf } from "../service-account/to-tf.js";
|
|
12
|
+
import { workspaceServiceAccountAppResolver } from "../service-account/workspace-owner.js";
|
|
11
13
|
import { foreignFieldDataLabel, resolveForeignRef } from "../shared/foreign-ref.js";
|
|
12
14
|
import { filterToTf as serializeFilterToTf } from "../shared/filters/tf-codec.js";
|
|
13
15
|
import { referenceValueTypeForField } from "../shared/filters/index.js";
|
|
14
|
-
import { API_TASK_REF_AUTHORING_NAMES, API_TASK_REF_WIRE_NAMES, executeScriptRefsIndex, OUTPUT_KEY_CANONICAL, OUTPUT_KEY_WIRE_NAME } from "./output-key-wire-name.js";
|
|
16
|
+
import { aiCompletionRefsIndex, API_TASK_REF_AUTHORING_NAMES, API_TASK_REF_WIRE_NAMES, executeScriptRefsIndex, OUTPUT_KEY_CANONICAL, OUTPUT_KEY_WIRE_NAME } from "./output-key-wire-name.js";
|
|
15
17
|
import { outputFieldTypesFromScriptSchema, scriptOutputReferenceIsDeclared } from "./output-field-types.js";
|
|
16
18
|
import { RESOURCE_TYPE_TO_EXECUTOR, TASK_OUTPUT_CONTRACTS } from "./generated/task-output-contracts.js";
|
|
17
19
|
import { CONNECTOR_ORG_BAG } from "../org/connector.js";
|
|
@@ -26,7 +28,7 @@ import { onDemandTriggerRefKey } from "./value-ref-tf.js";
|
|
|
26
28
|
import { normalizeOnDemandParamKey } from "../../../pull/util.js";
|
|
27
29
|
import { PROVIDER_FIXED_SYSTEM_FIELD_KEYS, recordFieldWireRefName } from "./system-ref-name.js";
|
|
28
30
|
import { taskTfLabel } from "./task-label.js";
|
|
29
|
-
import { isOnDemandRecordType } from "../shared/types/field-types.js";
|
|
31
|
+
import { FIELD_TYPE_MAP, isOnDemandRecordType } from "../shared/types/field-types.js";
|
|
30
32
|
/** The context for reading records of `appRefName` (a `kind`), retargeted from the owner. */
|
|
31
33
|
/**
|
|
32
34
|
* Wire WorkflowFieldType -> elementum_on_demand_trigger `parameters[].type`.
|
|
@@ -1207,7 +1209,7 @@ function calculationTaskRefName(targetType, name, taskRefKey, refs) {
|
|
|
1207
1209
|
const fieldKey = segments[1];
|
|
1208
1210
|
return [
|
|
1209
1211
|
"record.",
|
|
1210
|
-
calculationRawFieldId(fieldKey) ??
|
|
1212
|
+
calculationRawFieldId(fieldKey) ?? calculationFoundRecordFieldId(fieldKey, taskRefKey, refs),
|
|
1211
1213
|
suffix.length > 0 ? `.${suffix}` : "",
|
|
1212
1214
|
];
|
|
1213
1215
|
}
|
|
@@ -1217,26 +1219,59 @@ function calculationTaskRefName(targetType, name, taskRefKey, refs) {
|
|
|
1217
1219
|
}
|
|
1218
1220
|
return [refName];
|
|
1219
1221
|
}
|
|
1222
|
+
/**
|
|
1223
|
+
* The calc-engine field id of a found record's field. A field of an aspect in
|
|
1224
|
+
* this build is its resource id. A sibling the workspace authors but this
|
|
1225
|
+
* build leaves out (pull builds only the pulled root, #1763) is read through
|
|
1226
|
+
* the same `data.elementum_field` lookup ei's export declares for it; the
|
|
1227
|
+
* whole-workspace build, which has the sibling, addresses its resource.
|
|
1228
|
+
*/
|
|
1229
|
+
function calculationFoundRecordFieldId(fieldKey, taskRefKey, refs) {
|
|
1230
|
+
const taskApp = refs.recordFieldContext?.taskAppRefNameByRefKey?.[taskRefKey];
|
|
1231
|
+
const recordTargetKind = refs.tasks.get(taskRefKey)?.recordTarget?.__kind;
|
|
1232
|
+
const kind = refs.recordFieldContext?.taskAppKindByRefKey?.[taskRefKey] ??
|
|
1233
|
+
(recordTargetKind === "app" || recordTargetKind === "element" ? recordTargetKind : undefined);
|
|
1234
|
+
// An app and an element may share a refName, so "outside this build" and
|
|
1235
|
+
// "authored" are both checked by kind. (The owner check and the display-name
|
|
1236
|
+
// map below are still keyed by refName only.)
|
|
1237
|
+
const outsideBuild = taskApp !== undefined && taskApp !== refs.owner.appRefName && kind !== undefined &&
|
|
1238
|
+
refs.owner.workspaceAspects !== undefined && !refs.owner.workspaceAspects.has(workspaceAspectKey(kind, taskApp));
|
|
1239
|
+
if (!outsideBuild)
|
|
1240
|
+
return calculationRecordFieldId(fieldKey, calculationFieldScope(taskRefKey, refs));
|
|
1241
|
+
if (refs.owner.authoredAspectKeys?.has(workspaceAspectKey(kind, taskApp)) !== true)
|
|
1242
|
+
throw calculationNotAuthoredError(taskApp);
|
|
1243
|
+
const lookup = foreignFoundRecordFieldId(fieldKey, taskRefKey, refs);
|
|
1244
|
+
if (lookup !== undefined)
|
|
1245
|
+
return lookup;
|
|
1246
|
+
if (refs.fieldNamesByAppRefName?.get(taskApp) !== undefined) {
|
|
1247
|
+
throw new EntityTfError(`automation calculation targets field "${fieldKey}" which does not exist in app "${taskApp}"`);
|
|
1248
|
+
}
|
|
1249
|
+
throw new EntityTfError(`automation calculation reads field "${fieldKey}" of "${taskApp}", which is authored but outside this build, ` +
|
|
1250
|
+
`and its field names are not in the workspace catalog — run \`elementum generate\` and retry`);
|
|
1251
|
+
}
|
|
1220
1252
|
/**
|
|
1221
1253
|
* The aspect whose fields a task's `record.<field>` output belongs to. A
|
|
1222
1254
|
* cross-aspect `recordSearch` reads the SEARCHED aspect's fields, and the
|
|
1223
|
-
* calc engine wants their ids, so that aspect must be
|
|
1224
|
-
* a `data.elementum_app` stub carries display names but no field
|
|
1255
|
+
* calc engine wants their ids, so that aspect must be authored in this
|
|
1256
|
+
* workspace — a `data.elementum_app` stub carries display names but no field
|
|
1257
|
+
* resources.
|
|
1225
1258
|
*/
|
|
1226
1259
|
function calculationFieldScope(taskRefKey, refs) {
|
|
1227
1260
|
const taskApp = refs.recordFieldContext?.taskAppRefNameByRefKey?.[taskRefKey];
|
|
1228
1261
|
if (taskApp === undefined || taskApp === refs.owner.appRefName)
|
|
1229
1262
|
return refs.owner;
|
|
1230
1263
|
const fieldAddresses = refs.fieldAddressesByAppRefName?.get(taskApp);
|
|
1231
|
-
if (fieldAddresses === undefined)
|
|
1232
|
-
throw
|
|
1233
|
-
`this workspace — the calc engine addresses a found record's field by field id, which only a ` +
|
|
1234
|
-
`built aspect can supply`);
|
|
1235
|
-
}
|
|
1264
|
+
if (fieldAddresses === undefined)
|
|
1265
|
+
throw calculationNotAuthoredError(taskApp);
|
|
1236
1266
|
const aspect = refs.owner.workspaceAspects?.get(workspaceAspectKey("app", taskApp))
|
|
1237
1267
|
?? refs.owner.workspaceAspects?.get(workspaceAspectKey("element", taskApp));
|
|
1238
1268
|
return { appRefName: taskApp, appTfLabel: aspect?.tfLabel ?? refs.owner.appTfLabel, fieldAddresses };
|
|
1239
1269
|
}
|
|
1270
|
+
function calculationNotAuthoredError(taskApp) {
|
|
1271
|
+
return new EntityTfError(`automation calculation reads a field of "${taskApp}", but that app/element is not authored in ` +
|
|
1272
|
+
`this workspace — the calc engine addresses a found record's field by field id, which only a ` +
|
|
1273
|
+
`built aspect can supply`);
|
|
1274
|
+
}
|
|
1240
1275
|
const FOUND_RECORD_TASK_TYPES = new Set([
|
|
1241
1276
|
"elementum_record_search_task",
|
|
1242
1277
|
"elementum_create_record_task",
|
|
@@ -1266,13 +1301,31 @@ function foundRecordFieldReferenceName(targetType, name, taskRefKey, refs) {
|
|
|
1266
1301
|
}
|
|
1267
1302
|
}
|
|
1268
1303
|
function foreignFoundRecordFieldReferenceName(segments, taskRefKey, refs) {
|
|
1304
|
+
// Reached only when the field id could not be resolved above. An
|
|
1305
|
+
// updateField record of an aspect the workspace does not author keeps the
|
|
1306
|
+
// display-label form it had before updateField carried a `recordTarget`; one
|
|
1307
|
+
// of an authored sibling outside this build already resolved to its
|
|
1308
|
+
// `data.elementum_field` lookup (the field-id form ei exports, #1763).
|
|
1309
|
+
if (refs.tasks.get(taskRefKey)?.type === TASK_RESOURCES.updateField)
|
|
1310
|
+
return undefined;
|
|
1311
|
+
const fieldId = foreignFoundRecordFieldId(segments[1], taskRefKey, refs);
|
|
1312
|
+
if (fieldId === undefined)
|
|
1313
|
+
return undefined;
|
|
1314
|
+
const suffix = segments.slice(2).join(".");
|
|
1315
|
+
return ["record.", fieldId, ...(suffix.length > 0 ? [`.${suffix}`] : [])];
|
|
1316
|
+
}
|
|
1317
|
+
/**
|
|
1318
|
+
* The `data.elementum_field` id of a found record's field when the record's
|
|
1319
|
+
* app/element is outside this build. Undefined when the task's target is in
|
|
1320
|
+
* this build or the field's display name is unknown.
|
|
1321
|
+
*/
|
|
1322
|
+
function foreignFoundRecordFieldId(fieldKey, taskRefKey, refs) {
|
|
1269
1323
|
const target = refs.tasks.get(taskRefKey)?.recordTarget;
|
|
1270
1324
|
if (target === undefined || (target.__kind !== "app" && target.__kind !== "element") || target.name === undefined) {
|
|
1271
1325
|
return undefined;
|
|
1272
1326
|
}
|
|
1273
1327
|
if (refs.owner.workspaceAspects?.has(workspaceAspectKey(target.__kind, target.refName)))
|
|
1274
1328
|
return undefined;
|
|
1275
|
-
const fieldKey = segments[1];
|
|
1276
1329
|
const fieldName = refs.fieldNamesByAppRefName?.get(target.refName)?.get(fieldKey);
|
|
1277
1330
|
if (fieldName === undefined)
|
|
1278
1331
|
return undefined;
|
|
@@ -1285,12 +1338,7 @@ function foreignFoundRecordFieldReferenceName(segments, taskRefKey, refs) {
|
|
|
1285
1338
|
parentName: target.name,
|
|
1286
1339
|
...(target.namespace !== undefined ? { parentNamespace: target.namespace } : {}),
|
|
1287
1340
|
};
|
|
1288
|
-
|
|
1289
|
-
return [
|
|
1290
|
-
"record.",
|
|
1291
|
-
expr.dataAttr("elementum_field", registerForeignFieldLookup(fieldToken, refs.owner, refs.dataBlocks), ["id"]),
|
|
1292
|
-
...(suffix.length > 0 ? [`.${suffix}`] : []),
|
|
1293
|
-
];
|
|
1341
|
+
return expr.dataAttr("elementum_field", registerForeignFieldLookup(fieldToken, refs.owner, refs.dataBlocks), ["id"]);
|
|
1294
1342
|
}
|
|
1295
1343
|
function calculationTriggerMustache(name, refs) {
|
|
1296
1344
|
const onDemandName = onDemandTriggerRefName(name, refs);
|
|
@@ -1683,6 +1731,9 @@ function taskOutputWireRefKey(targetType, name, taskRefKey, refs) {
|
|
|
1683
1731
|
if (scriptIndex !== undefined)
|
|
1684
1732
|
return scriptIndex;
|
|
1685
1733
|
}
|
|
1734
|
+
const aiIndex = aiCompletionRefsIndex(targetType, name);
|
|
1735
|
+
if (aiIndex !== undefined)
|
|
1736
|
+
return aiIndex;
|
|
1686
1737
|
return taskWireRefName(name, taskRefKey, refs);
|
|
1687
1738
|
}
|
|
1688
1739
|
/** The platform's own on-demand "Triggered By" refs (live refs-map keys). */
|
|
@@ -2192,6 +2243,53 @@ function unresolvedForEachFailures(entity, payload, address) {
|
|
|
2192
2243
|
"(e.g. restructure the loops, or pass the value through a variable) before this automation can build",
|
|
2193
2244
|
}));
|
|
2194
2245
|
}
|
|
2246
|
+
/**
|
|
2247
|
+
* An on-demand scalar whose refs key is also a record field's display name.
|
|
2248
|
+
* The field owns that key, so the parameter is written as the same envelope
|
|
2249
|
+
* export uses (`buildTriggerRefJSONFull`: fieldType, multiple, and the
|
|
2250
|
+
* normalized trigger name) instead of `refs["<display name>"]`.
|
|
2251
|
+
*/
|
|
2252
|
+
function shadowedOnDemandParamRef(value, refs) {
|
|
2253
|
+
if (refs.trigger.type !== TRIGGER_RESOURCES.onDemand)
|
|
2254
|
+
return undefined;
|
|
2255
|
+
if (!isObject(value.triggerReference) || typeof value.triggerReference.name !== "string")
|
|
2256
|
+
return undefined;
|
|
2257
|
+
const inputName = onDemandTriggerRefKey(value.triggerReference.name, [...refs.triggerParamFieldTypes.keys()]);
|
|
2258
|
+
const input = refs.triggerParamFieldTypes.get(inputName);
|
|
2259
|
+
if (input === undefined ||
|
|
2260
|
+
refs.recordParamNames.includes(inputName) ||
|
|
2261
|
+
refs.userParamNames.includes(inputName))
|
|
2262
|
+
return undefined;
|
|
2263
|
+
const refsKey = triggerWireRefName(value.triggerReference.name, refs);
|
|
2264
|
+
let ownedByField = false;
|
|
2265
|
+
for (const displayName of refs.owner.fieldNames.values()) {
|
|
2266
|
+
if (displayName === refsKey) {
|
|
2267
|
+
ownedByField = true;
|
|
2268
|
+
break;
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
if (!ownedByField)
|
|
2272
|
+
return undefined;
|
|
2273
|
+
const typed = typeof value.fieldType === "string"
|
|
2274
|
+
? { fieldType: value.fieldType, multiple: value.multiple === true }
|
|
2275
|
+
: { fieldType: onDemandEnvelopeFieldType(input.fieldType), multiple: input.multiple };
|
|
2276
|
+
return {
|
|
2277
|
+
fieldType: typed.fieldType,
|
|
2278
|
+
multiple: typed.multiple,
|
|
2279
|
+
triggerReference: { name: normalizeOnDemandParamKey(inputName) },
|
|
2280
|
+
};
|
|
2281
|
+
}
|
|
2282
|
+
/** Authoring / HCL parameter type → the WorkflowFieldType export writes into the envelope. */
|
|
2283
|
+
function onDemandEnvelopeFieldType(type) {
|
|
2284
|
+
if (type === "attachment")
|
|
2285
|
+
return "ATTACHMENT_ID";
|
|
2286
|
+
if (type === "group")
|
|
2287
|
+
return "GROUP_ID";
|
|
2288
|
+
const mapped = FIELD_TYPE_MAP[type];
|
|
2289
|
+
if (mapped !== undefined)
|
|
2290
|
+
return mapped;
|
|
2291
|
+
return type;
|
|
2292
|
+
}
|
|
2195
2293
|
/**
|
|
2196
2294
|
* execute_script `inputs[].value` only. Provider Read stores the
|
|
2197
2295
|
* Mobius-normalized short name (`reasonForClosingEarly`) for on-demand
|
|
@@ -2259,6 +2357,35 @@ function normalizeTriggerRecordIdEnvelopeString(raw, refs) {
|
|
|
2259
2357
|
envelope.multiple = false;
|
|
2260
2358
|
return JSON.stringify(envelope);
|
|
2261
2359
|
}
|
|
2360
|
+
function undeclaredExecuteScriptFieldEnvelope(reference, refs, fieldType = "TEXT") {
|
|
2361
|
+
let value = reference;
|
|
2362
|
+
while (isObject(value) && "value" in value && Object.keys(value).length === 1) {
|
|
2363
|
+
value = value.value;
|
|
2364
|
+
}
|
|
2365
|
+
if (!isObject(value) || !isObject(value.taskReference))
|
|
2366
|
+
return undefined;
|
|
2367
|
+
const taskRef = value.taskReference;
|
|
2368
|
+
const taskRefKey = taskRef.taskRefKey;
|
|
2369
|
+
const name = taskRef.name;
|
|
2370
|
+
if (typeof taskRefKey !== "string" || typeof name !== "string" || !name.startsWith("result."))
|
|
2371
|
+
return undefined;
|
|
2372
|
+
const task = refs.tasks.get(taskRefKey);
|
|
2373
|
+
if (task?.type !== TASK_RESOURCES.executeScript)
|
|
2374
|
+
return undefined;
|
|
2375
|
+
// A declared output is a real refs["result.<key>"] entry. An undeclared one
|
|
2376
|
+
// (outputs omitted, or a key the schema does not list) is not in that map —
|
|
2377
|
+
// indexing it fails the plan. Provider Read stores the JSON envelope instead.
|
|
2378
|
+
if (task.outputFieldTypes !== undefined && scriptOutputReferenceIsDeclared(task.outputFieldTypes, name))
|
|
2379
|
+
return undefined;
|
|
2380
|
+
return expr.jsonencode({
|
|
2381
|
+
fieldType,
|
|
2382
|
+
multiple: false,
|
|
2383
|
+
taskReference: {
|
|
2384
|
+
name,
|
|
2385
|
+
taskId: expr.resourceAttr(task.type, task.label, ["id"]),
|
|
2386
|
+
},
|
|
2387
|
+
});
|
|
2388
|
+
}
|
|
2262
2389
|
function valueToTf(value, refs) {
|
|
2263
2390
|
const catalog = token(value);
|
|
2264
2391
|
if (catalog !== undefined)
|
|
@@ -2311,6 +2438,9 @@ function valueToTf(value, refs) {
|
|
|
2311
2438
|
if (payloadRef !== undefined)
|
|
2312
2439
|
return expr.jsonencode(payloadRef);
|
|
2313
2440
|
}
|
|
2441
|
+
const shadowedParam = shadowedOnDemandParamRef(value, refs);
|
|
2442
|
+
if (shadowedParam !== undefined)
|
|
2443
|
+
return expr.jsonencode(shadowedParam);
|
|
2314
2444
|
return expr.resourceAttr(refs.trigger.type, refs.trigger.label, ["refs", { index: triggerWireRefName(value.triggerReference.name, refs) }]);
|
|
2315
2445
|
}
|
|
2316
2446
|
if (isObject(value.taskReference) && typeof value.taskReference.taskRefKey === "string" && typeof value.taskReference.name === "string") {
|
|
@@ -2739,7 +2869,7 @@ function filterReferenceToTf(value, refs, role = "value", realType, operator) {
|
|
|
2739
2869
|
}
|
|
2740
2870
|
const refsIndex = task.type === TASK_RESOURCES.executeScript
|
|
2741
2871
|
? executeScriptRefsIndex(wireName) ?? wireName
|
|
2742
|
-
: wireName;
|
|
2872
|
+
: aiCompletionRefsIndex(task.type, wireName) ?? wireName;
|
|
2743
2873
|
return expr.resourceAttr(task.type, task.label, ["refs", { index: refsIndex }]);
|
|
2744
2874
|
}
|
|
2745
2875
|
const recordFieldName = foundRecordFieldReferenceName(task.type, value.name, value.taskRefKey, refs);
|
|
@@ -3026,6 +3156,12 @@ function configAttrs(kind, config, refs) {
|
|
|
3026
3156
|
attrs.relate_to_record_reference = valueToTf(raw, refs);
|
|
3027
3157
|
continue;
|
|
3028
3158
|
}
|
|
3159
|
+
if (key === "recordReference" && kind === "elementum_update_field_task") {
|
|
3160
|
+
attrs.record_reference =
|
|
3161
|
+
undeclaredExecuteScriptFieldEnvelope(raw, refs, "ASPECT_RECORD_ID") ??
|
|
3162
|
+
valueToTf(raw, refs);
|
|
3163
|
+
continue;
|
|
3164
|
+
}
|
|
3029
3165
|
if (key === "code" && kind === "elementum_execute_script_task") {
|
|
3030
3166
|
if (typeof raw !== "string")
|
|
3031
3167
|
throw new EntityTfError("executeScript code must be a string");
|
|
@@ -3347,7 +3483,11 @@ function configAttrs(kind, config, refs) {
|
|
|
3347
3483
|
};
|
|
3348
3484
|
}
|
|
3349
3485
|
if (Array.isArray(staticValue)) {
|
|
3350
|
-
|
|
3486
|
+
// An empty list on a raw platform-id field is the Multi-Select clear
|
|
3487
|
+
// export prints when the field's owner is outside the workspace; a
|
|
3488
|
+
// non-empty list still needs a typed Multi-Select field (#1707).
|
|
3489
|
+
const rawIdClear = fieldToken === undefined && staticValue.length === 0;
|
|
3490
|
+
if (fieldToken?.fieldType !== "MULTI_PICKLIST" && !rawIdClear) {
|
|
3351
3491
|
throw new EntityTfError(`automation field "${fieldToken?.name ?? fieldToken?.refName ?? "unknown"}" uses an array value but is not a Multi-Select field`);
|
|
3352
3492
|
}
|
|
3353
3493
|
const values = staticValue.map((value) => picklistFilterValueToTf(value, fieldToken, refs) ?? valueToTf(value, refs));
|
|
@@ -3370,7 +3510,7 @@ function configAttrs(kind, config, refs) {
|
|
|
3370
3510
|
}
|
|
3371
3511
|
return {
|
|
3372
3512
|
field_id: valueToTf(field.aspectFieldId, refs),
|
|
3373
|
-
value: optionValue ?? valueToTf(reference, refs),
|
|
3513
|
+
value: optionValue ?? undeclaredExecuteScriptFieldEnvelope(reference, refs) ?? valueToTf(reference, refs),
|
|
3374
3514
|
...(field.operation === "ADD" ? { update_mode: "add" } : {}),
|
|
3375
3515
|
};
|
|
3376
3516
|
});
|
|
@@ -3564,6 +3704,9 @@ function fileReaderDependsOn(blocks) {
|
|
|
3564
3704
|
});
|
|
3565
3705
|
return deps;
|
|
3566
3706
|
}
|
|
3707
|
+
function automationStatusPublishes(status) {
|
|
3708
|
+
return status === "ACTIVE" || status === "INACTIVE";
|
|
3709
|
+
}
|
|
3567
3710
|
/** App- or element-owned `automation` entity → provider HCL blocks. */
|
|
3568
3711
|
function elementHandleOf(explicit, payload) {
|
|
3569
3712
|
if (explicit !== undefined && explicit !== "")
|
|
@@ -3587,10 +3730,12 @@ export function automationToTf(entity, ctx) {
|
|
|
3587
3730
|
orgRefs: ctx.orgRefs,
|
|
3588
3731
|
localsAttrs: ctx.localsAttrs,
|
|
3589
3732
|
workspaceAspects: ctx.workspaceAspects,
|
|
3733
|
+
...(ctx.outOfScopeApps !== undefined ? { outOfScopeApps: ctx.outOfScopeApps } : {}),
|
|
3590
3734
|
diagnostics: ctx.diagnostics ?? [],
|
|
3591
3735
|
activeAutomationRefNames: ctx.activeAutomationRefNames,
|
|
3592
3736
|
...(ctx.elementsWithoutAuditFields !== undefined ? { elementsWithoutAuditFields: ctx.elementsWithoutAuditFields } : {}),
|
|
3593
3737
|
...(ctx.fieldAddressesByAppRefName !== undefined ? { fieldAddressesByAppRefName: ctx.fieldAddressesByAppRefName } : {}),
|
|
3738
|
+
...(ctx.authoredAspectKeys !== undefined ? { authoredAspectKeys: ctx.authoredAspectKeys } : {}),
|
|
3594
3739
|
recordLacksAuditFields: ctx.parentScope === "element" && ctx.ownerAuditFields !== true,
|
|
3595
3740
|
};
|
|
3596
3741
|
if (entity.kind !== "automation")
|
|
@@ -3630,22 +3775,37 @@ export function automationToTf(entity, ctx) {
|
|
|
3630
3775
|
},
|
|
3631
3776
|
};
|
|
3632
3777
|
if (payload.serviceAccount !== undefined) {
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3778
|
+
const accountApp = payload.serviceAccount.appRefName;
|
|
3779
|
+
if (accountApp !== owner.appRefName) {
|
|
3780
|
+
// A sibling app's account uses the same resolver as roles (#1592):
|
|
3781
|
+
// bag key → resource ref, miss → data source. Do not guess the label
|
|
3782
|
+
// from the display name.
|
|
3783
|
+
const owning = workspaceServiceAccountAppResolver(owner.workspaceAspects, { apps: owner.outOfScopeApps, orgRefs: owner.orgRefs })(accountApp);
|
|
3784
|
+
if (owning === undefined || owner.orgRefs === undefined) {
|
|
3785
|
+
throw new EntityTfError(`automation "${entity.refName}" service account belongs to app "${accountApp}", which is not in this workspace`);
|
|
3786
|
+
}
|
|
3787
|
+
const diagnostics = [];
|
|
3788
|
+
const value = serviceAccountRefToTf(payload.serviceAccount, { appRefName: accountApp, ...owning, orgRefs: owner.orgRefs }, `automation "${entity.refName}" serviceAccount`, diagnostics);
|
|
3789
|
+
if (value === undefined) {
|
|
3790
|
+
throw new EntityTfError(diagnostics[0] ?? `automation "${entity.refName}" cannot resolve service account "${payload.serviceAccount.name}"`);
|
|
3791
|
+
}
|
|
3792
|
+
automation.attrs.service_account_id = value;
|
|
3646
3793
|
}
|
|
3647
3794
|
else {
|
|
3648
|
-
|
|
3795
|
+
const local = Object.entries(ctx.serviceAccounts ?? {}).find(([, account]) => `${account.firstName} ${account.lastName}` === payload.serviceAccount.name);
|
|
3796
|
+
if (local !== undefined) {
|
|
3797
|
+
automation.attrs.service_account_id = expr.resourceAttr(SERVICE_ACCOUNT_RESOURCE_TYPE, appScopedResourceLabel(owner.appTfLabel, tsLabelToTfLabel(local[0])), ["id"]);
|
|
3798
|
+
}
|
|
3799
|
+
else if (owner.orgRefs !== undefined) {
|
|
3800
|
+
const lookupLabel = sanitizeName(payload.serviceAccount.name);
|
|
3801
|
+
owner.orgRefs.rawLookup(SERVICE_ACCOUNT_RESOURCE_TYPE, lookupLabel, payload.serviceAccount.name, {
|
|
3802
|
+
app_id: expr.resourceAttr("elementum_app", owner.appTfLabel, ["id"]),
|
|
3803
|
+
});
|
|
3804
|
+
automation.attrs.service_account_id = expr.dataAttr(SERVICE_ACCOUNT_RESOURCE_TYPE, lookupLabel, ["id"]);
|
|
3805
|
+
}
|
|
3806
|
+
else {
|
|
3807
|
+
throw new EntityTfError(`automation "${entity.refName}" cannot resolve service account "${payload.serviceAccount.name}"`);
|
|
3808
|
+
}
|
|
3649
3809
|
}
|
|
3650
3810
|
}
|
|
3651
3811
|
const [triggerKey, triggerConfig] = onlyEntry(payload.trigger, `automation "${entity.refName}" trigger`);
|
|
@@ -3691,7 +3851,8 @@ export function automationToTf(entity, ctx) {
|
|
|
3691
3851
|
? [[field.name, { fieldType: field.type, multiple: false }]]
|
|
3692
3852
|
: []))
|
|
3693
3853
|
: undefined;
|
|
3694
|
-
|
|
3854
|
+
// updateField's `record` output is the record it updated, of its `aspectId` app/element.
|
|
3855
|
+
const recordTarget = FOUND_RECORD_TASK_TYPES.has(resourceType) || resourceType === TASK_RESOURCES.updateField
|
|
3695
3856
|
? token(taskBody.aspectId ?? taskBody.relatedAspectId)
|
|
3696
3857
|
: undefined;
|
|
3697
3858
|
taskRefs.set(refKey, {
|
|
@@ -3942,8 +4103,9 @@ export function automationToTf(entity, ctx) {
|
|
|
3942
4103
|
const target = token(inner.targetAutomationId) ?? (isObject(inner.targetAutomationRef) ? token(inner.targetAutomationRef.value) : undefined);
|
|
3943
4104
|
if (target?.__kind === "automation") {
|
|
3944
4105
|
const targetLabel = scopedLabel(owner.appTfLabel, tsLabelToTfLabel(target.refName));
|
|
3945
|
-
//
|
|
3946
|
-
//
|
|
4106
|
+
// Only a running (ACTIVE) target is a run dependency. A paused
|
|
4107
|
+
// target keeps its publish resource, but ei export does not wait
|
|
4108
|
+
// on it, and a draft target has none.
|
|
3947
4109
|
if (ctx.activeAutomationRefNames?.has(target.refName) === true) {
|
|
3948
4110
|
block.attrs.depends_on = [expr.resourceAttr(WORKFLOW_PUBLISH_RESOURCE_TYPE, targetLabel)];
|
|
3949
4111
|
runAutomationPublishes.add(targetLabel);
|
|
@@ -4083,7 +4245,7 @@ export function automationToTf(entity, ctx) {
|
|
|
4083
4245
|
if (fileReaderDeps.length > 0) {
|
|
4084
4246
|
automation.attrs.depends_on = fileReaderDeps;
|
|
4085
4247
|
}
|
|
4086
|
-
if (payload.status
|
|
4248
|
+
if (automationStatusPublishes(payload.status)) {
|
|
4087
4249
|
const outputValues = payload.outputProperties?.outputs ?? [];
|
|
4088
4250
|
const publish = {
|
|
4089
4251
|
kind: "resource",
|
|
@@ -123,6 +123,8 @@ export interface approvalProcessStatusUpdatedTriggerOptions<A extends AppOrEleme
|
|
|
123
123
|
*/
|
|
124
124
|
readonly approvalChain?: ApprovalChainRef | UnsafePlatformId;
|
|
125
125
|
readonly status: approvalProcessStatusUpdatedStatus;
|
|
126
|
+
/** Record filter the approval-chain trigger additionally requires. */
|
|
127
|
+
readonly filter?: Filter;
|
|
126
128
|
}
|
|
127
129
|
/** Fires when an approval chain on a record changes to the configured status. */
|
|
128
130
|
export declare function approvalProcessStatusUpdated<A extends AppOrElementRef>(opts: approvalProcessStatusUpdatedTriggerOptions<A>): TriggerChain<RecordTriggerOutput<A>>;
|
|
@@ -119,6 +119,7 @@ export function approvalProcessStatusUpdated(opts) {
|
|
|
119
119
|
aspectId: opts.app,
|
|
120
120
|
...(opts.approvalChain !== undefined ? { approvalChainTemplateId: opts.approvalChain } : {}),
|
|
121
121
|
status: opts.status,
|
|
122
|
+
...(opts.filter !== undefined ? { filter: opts.filter } : {}),
|
|
122
123
|
type: "APPROVAL_CHAIN_UPDATE",
|
|
123
124
|
},
|
|
124
125
|
},
|
|
@@ -55,6 +55,12 @@ export interface NormalizedChart {
|
|
|
55
55
|
readonly properties?: ChartProperties;
|
|
56
56
|
readonly subscriptions: readonly (NormalizedChartSubscription | NormalizedChartOpaqueSubscription)[];
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* The chart's refName, which is also its own-file name (`charts/<refName>.ts`)
|
|
60
|
+
* and the key a dashboard chart widget prints: the chart's TF label with the
|
|
61
|
+
* owning app's TF label (not its camelCase ref) stripped (#1731).
|
|
62
|
+
*/
|
|
63
|
+
export declare function chartRefNameFromTfLabel(appTfLabel: string, chartTfLabel: string): string;
|
|
58
64
|
export declare function chartFromTf(block: TfBlock, opts: {
|
|
59
65
|
readonly appLabel: string;
|
|
60
66
|
readonly appRefName: string;
|
|
@@ -329,6 +329,14 @@ function parseSubscription(value, appLabel, appRefName, ctx, where) {
|
|
|
329
329
|
...(stringList(rec["tags"]) !== undefined ? { tags: stringList(rec["tags"]) } : {}),
|
|
330
330
|
};
|
|
331
331
|
}
|
|
332
|
+
/**
|
|
333
|
+
* The chart's refName, which is also its own-file name (`charts/<refName>.ts`)
|
|
334
|
+
* and the key a dashboard chart widget prints: the chart's TF label with the
|
|
335
|
+
* owning app's TF label (not its camelCase ref) stripped (#1731).
|
|
336
|
+
*/
|
|
337
|
+
export function chartRefNameFromTfLabel(appTfLabel, chartTfLabel) {
|
|
338
|
+
return scopedLabelToBagKey(appTfLabel, chartTfLabel, "app");
|
|
339
|
+
}
|
|
332
340
|
export function chartFromTf(block, opts, ctx) {
|
|
333
341
|
if (block.type !== CHART_RESOURCE_TYPE || block.label === undefined)
|
|
334
342
|
return undefined;
|
|
@@ -356,7 +364,7 @@ export function chartFromTf(block, opts, ctx) {
|
|
|
356
364
|
...(typeof rawProperties["target"] === "number" ? { target: rawProperties["target"] } : {}),
|
|
357
365
|
};
|
|
358
366
|
return {
|
|
359
|
-
refName:
|
|
367
|
+
refName: chartRefNameFromTfLabel(opts.appLabel, block.label), name, type,
|
|
360
368
|
...(typeof block.attrs["target"] === "number" ? { target: block.attrs["target"] } : {}),
|
|
361
369
|
...(properties !== undefined ? { properties } : {}), subscriptions,
|
|
362
370
|
};
|