@elementumai/edk 0.13.2 → 0.13.3
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/dist-sdk/src/engine/pull/context.d.ts +10 -4
- package/dist-sdk/src/engine/pull/context.js +2 -0
- package/dist-sdk/src/engine/pull/stream-root.d.ts +3 -1
- package/dist-sdk/src/engine/pull/stream-root.js +3 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +8 -0
- package/dist-sdk/src/entities/automation/module.js +29 -7
- package/dist-sdk/src/entities/automation/omitted-ref.d.ts +12 -0
- package/dist-sdk/src/entities/automation/omitted-ref.js +21 -0
- package/dist-sdk/src/entities/automation/to-tf.js +7 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +12 -7
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +37 -21
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +9 -3
- package/dist-sdk/src/entities/widget/from-tf.js +8 -4
- package/dist-sdk/src/graph/index.d.ts +1 -1
- package/dist-sdk/src/graph/types.d.ts +13 -0
- package/package.json +1 -1
|
@@ -15,10 +15,14 @@ export interface ImportedResourceRef {
|
|
|
15
15
|
readonly label: string;
|
|
16
16
|
readonly attrs: Readonly<Record<string, TfValue>>;
|
|
17
17
|
}
|
|
18
|
+
/** Why the bridge left an automation out; a bridge from before #1764 writes no kind. */
|
|
19
|
+
export declare const OMITTED_AUTOMATION_KINDS: readonly ["unrepresentable", "disabled", "no-draft", "unadoptable"];
|
|
20
|
+
export type OmittedAutomationKind = (typeof OMITTED_AUTOMATION_KINDS)[number];
|
|
18
21
|
/** Extraction context: stream lookups + the diagnostics sink. */
|
|
19
22
|
/** An automation the export left out, as omitted-automations.json names it. */
|
|
20
23
|
export interface OmittedAutomationIdentity {
|
|
21
24
|
readonly name: string;
|
|
25
|
+
readonly kind?: OmittedAutomationKind;
|
|
22
26
|
readonly reason: string;
|
|
23
27
|
}
|
|
24
28
|
export interface FromTfContext {
|
|
@@ -158,10 +162,12 @@ export interface FromTfContext {
|
|
|
158
162
|
readonly serviceAccountsById?: ReadonlyMap<string, ServiceAccountIdentity>;
|
|
159
163
|
/**
|
|
160
164
|
* The automations the export left out (omitted-automations.json), by
|
|
161
|
-
* platform id (#1877). A
|
|
162
|
-
* listed here
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
+
* platform id (#1877). A widget or layout button whose raw automation id is
|
|
166
|
+
* listed here and not DISABLED pulls as a reference by display name, which
|
|
167
|
+
* build looks up; a DISABLED one warns, naming the automation and the
|
|
168
|
+
* export's reason. Any other raw id (such as another app's automation) is a
|
|
169
|
+
* valid reference and stays silent. Undefined: no listed id, so only an
|
|
170
|
+
* empty id warns.
|
|
165
171
|
*/
|
|
166
172
|
readonly omittedAutomationsById?: ReadonlyMap<string, OmittedAutomationIdentity>;
|
|
167
173
|
/**
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { EntityTfError } from "../entity.js";
|
|
8
8
|
import { isTfExpr, tfLabelToTsLabel } from "../tf/index.js";
|
|
9
|
+
/** Why the bridge left an automation out; a bridge from before #1764 writes no kind. */
|
|
10
|
+
export const OMITTED_AUTOMATION_KINDS = ["unrepresentable", "disabled", "no-draft", "unadoptable"];
|
|
9
11
|
/** The pull-abort (or, for `clone app`, clone-abort) message for one or more authoring blockers. */
|
|
10
12
|
export function authoringBlockedMessage(blockers, command = "pull") {
|
|
11
13
|
const remedies = [...new Set(blockers.map((blocker) => blocker.remedy))];
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Kind switches live in the entity graph — this file walks TYPE_TO_KIND /
|
|
13
13
|
* lifecycle hooks and must not import entity modules (value or type).
|
|
14
14
|
*/
|
|
15
|
-
import { type EntityKindId, type AdoptionAddressAlias } from "../../graph/index.js";
|
|
15
|
+
import { type EntityKindId, type AdoptionAddressAlias, type UnmanagedLookup } from "../../graph/index.js";
|
|
16
16
|
import type { QuarantinedOwnFile } from "../../graph/types.js";
|
|
17
17
|
import { type TfDocument } from "../tf/index.js";
|
|
18
18
|
import type { ValidationFailure } from "../validation.js";
|
|
@@ -55,6 +55,8 @@ export interface StreamRootExtract {
|
|
|
55
55
|
readonly importIds: ReadonlyMap<string, string>;
|
|
56
56
|
/** Export addresses whose printed current-API source rebuilds at a canonical alias. */
|
|
57
57
|
readonly adoptionAddressAliases: readonly AdoptionAddressAlias[];
|
|
58
|
+
/** Lookups adoption declares for references to skipped resources (see {@link UnmanagedLookup}). */
|
|
59
|
+
readonly unmanagedLookups?: readonly UnmanagedLookup[];
|
|
58
60
|
/**
|
|
59
61
|
* Resource address → the addresses it `depends_on` (e.g. a workflow_publish
|
|
60
62
|
* depending on its automation's tasks). `tofu plan -target=X` implicitly
|
|
@@ -446,6 +446,7 @@ export function extractStreamRoot(doc, kindId, opts = {}) {
|
|
|
446
446
|
};
|
|
447
447
|
const ownFileByKind = new Map();
|
|
448
448
|
const adoptionAddressAliases = [];
|
|
449
|
+
const unmanagedLookups = [];
|
|
449
450
|
const quarantineOwnFiles = [];
|
|
450
451
|
const validationFailures = [];
|
|
451
452
|
const settles = [];
|
|
@@ -462,6 +463,7 @@ export function extractStreamRoot(doc, kindId, opts = {}) {
|
|
|
462
463
|
diagnostics.push(...result.diagnostics);
|
|
463
464
|
validationFailures.push(...(result.validations ?? []));
|
|
464
465
|
adoptionAddressAliases.push(...(result.adoptionAddressAliases ?? []));
|
|
466
|
+
unmanagedLookups.push(...(result.unmanagedLookups ?? []));
|
|
465
467
|
quarantineOwnFiles.push(...(result.quarantineOwnFiles ?? []));
|
|
466
468
|
if (result.settleAfterExtract !== undefined)
|
|
467
469
|
settles.push(result.settleAfterExtract);
|
|
@@ -497,6 +499,7 @@ export function extractStreamRoot(doc, kindId, opts = {}) {
|
|
|
497
499
|
reports,
|
|
498
500
|
importIds,
|
|
499
501
|
adoptionAddressAliases,
|
|
502
|
+
...(unmanagedLookups.length > 0 && { unmanagedLookups }),
|
|
500
503
|
dependsOn,
|
|
501
504
|
unresolvedForeignRefs: { apps: [...unresolvedForeignApps], elements: [...unresolvedForeignElements] },
|
|
502
505
|
authoringBlockers: [
|
|
@@ -1699,6 +1699,14 @@ function printRef(ref, state, refCtx) {
|
|
|
1699
1699
|
}
|
|
1700
1700
|
return `${ctxName}.actions${safeMember(ref.task)}` + ref.path.map(safeMember).join("");
|
|
1701
1701
|
}
|
|
1702
|
+
// A Run Automation task's outputs are the called automation's declared
|
|
1703
|
+
// output names (typed from its catalog ref or `outputs:` list), not
|
|
1704
|
+
// record fields: a name that isn't a valid identifier ("My Output",
|
|
1705
|
+
// punctuation, a reserved word) is still a real key, so print it as
|
|
1706
|
+
// bracket access instead of the unresolved-field escape (#3026).
|
|
1707
|
+
if (state.taskFactoriesByRefKey.get(ref.task) === "runAutomation") {
|
|
1708
|
+
return `${ctxName}.actions${safeMember(ref.task)}` + ref.path.map(safeMember).join("");
|
|
1709
|
+
}
|
|
1702
1710
|
return printPathAccess(`${ctxName}.actions${safeMember(ref.task)}`, ref.path);
|
|
1703
1711
|
}
|
|
1704
1712
|
case "triggerRef": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** The automation entity's registry entry (see src/graph/). */
|
|
2
2
|
import { canonicalAuditRefKey } from "./system-ref-name.js";
|
|
3
|
-
import { appScopedResourceLabel, sanitizeName, scopedLabelToBagKey, tfLabelToTsLabel, isTfExpr } from "../../engine/tf/index.js";
|
|
3
|
+
import { appScopedResourceLabel, sanitizeName, scopedLabelToBagKey, tfLabelToTsLabel, tsLabelToTfLabel, isTfExpr } from "../../engine/tf/index.js";
|
|
4
4
|
function elementOwnerHandle(payload) {
|
|
5
5
|
if (payload === null || typeof payload !== "object" || !("handle" in payload))
|
|
6
6
|
return undefined;
|
|
@@ -153,6 +153,23 @@ export function droppedAutomationGap(autoBlock, autoLabel, gap) {
|
|
|
153
153
|
: `it is not adopted. If this workspace already manages it, its state and its existing source file are kept as they were, so the next plan compares that older source with the live automation: it can undo edits made in the platform, or delete the automation if its source file is gone. Review the plan before applying. ${gap.nextStep}`,
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* The `data.elementum_automation` lookup by display name that stands in for a
|
|
158
|
+
* skipped automation, the shape build emits for a dynamic-layout button whose
|
|
159
|
+
* automation is not in source (edk#2693). A button input reads its on-demand
|
|
160
|
+
* trigger's `parameter_ids`, which the lookup carries too (#3023).
|
|
161
|
+
*/
|
|
162
|
+
function unmanagedAutomationLookup(autoBlock, owned, label) {
|
|
163
|
+
const name = autoBlock.attrs["name"];
|
|
164
|
+
const appId = autoBlock.attrs["app_id"];
|
|
165
|
+
const triggers = owned.filter((address) => address.startsWith("elementum_on_demand_trigger."));
|
|
166
|
+
if (typeof name !== "string" || name === "" || appId === undefined || triggers.length === 0)
|
|
167
|
+
return undefined;
|
|
168
|
+
return {
|
|
169
|
+
lookup: { kind: "data", type: AUTOMATION_RESOURCE_TYPE, label, attrs: { app_id: appId, name } },
|
|
170
|
+
addresses: triggers,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
156
173
|
const FIX_IN_PLATFORM = "To manage it with the EDK, change what the reason names in the platform, then pull again.";
|
|
157
174
|
const FIX_OR_REPORT = "If you can change what the reason names in the platform, do so and pull again; otherwise report it as an EDK bug.";
|
|
158
175
|
/**
|
|
@@ -255,9 +272,13 @@ function extractAutomations(ownBlocks, stream, ctx) {
|
|
|
255
272
|
const released = [];
|
|
256
273
|
// Which file each skipped automation's resources come from (#1877).
|
|
257
274
|
const skippedOwnFiles = [];
|
|
258
|
-
const
|
|
275
|
+
const unmanagedLookups = [];
|
|
276
|
+
const skip = (autoBlock, owned, refName) => {
|
|
259
277
|
skipped.push(...owned);
|
|
260
278
|
skippedOwnFiles.push({ refName, addresses: owned });
|
|
279
|
+
const lookup = unmanagedAutomationLookup(autoBlock, owned, `${ctx.appTfLabel}_${tsLabelToTfLabel(refName)}`);
|
|
280
|
+
if (lookup !== undefined)
|
|
281
|
+
unmanagedLookups.push(lookup);
|
|
261
282
|
};
|
|
262
283
|
const settledByState = new Set();
|
|
263
284
|
const release = (entry) => {
|
|
@@ -282,7 +303,7 @@ function extractAutomations(ownBlocks, stream, ctx) {
|
|
|
282
303
|
const owned = automationOwnedAddresses(doc, autoLabel);
|
|
283
304
|
const chain = referencedAddress(stream, owned, lostChains);
|
|
284
305
|
if (chain !== undefined) {
|
|
285
|
-
skip(owned, scopedLabelToBagKey(ctx.appTfLabel, autoLabel));
|
|
306
|
+
skip(autoBlock, owned, scopedLabelToBagKey(ctx.appTfLabel, autoLabel));
|
|
286
307
|
release({
|
|
287
308
|
autoBlock, autoLabel, owned, refName: scopedLabelToBagKey(ctx.appTfLabel, autoLabel),
|
|
288
309
|
why: `it uses ${chain}, which pull leaves unmanaged because its stage has no handle of its own (#1136)`,
|
|
@@ -299,7 +320,7 @@ function extractAutomations(ownBlocks, stream, ctx) {
|
|
|
299
320
|
// second copy of the live automation.
|
|
300
321
|
if (extracted.stringifiedValueReferences === true) {
|
|
301
322
|
const owned = automationOwnedAddresses(doc, autoLabel);
|
|
302
|
-
skip(owned, extracted.refName);
|
|
323
|
+
skip(autoBlock, owned, extracted.refName);
|
|
303
324
|
release({
|
|
304
325
|
autoBlock, autoLabel, owned, refName: extracted.refName,
|
|
305
326
|
why: "its export embeds a value reference as text that source cannot rebuild exactly (edk#1646)",
|
|
@@ -333,7 +354,7 @@ function extractAutomations(ownBlocks, stream, ctx) {
|
|
|
333
354
|
message: err.message,
|
|
334
355
|
code: "unresolved-task-filter-ref",
|
|
335
356
|
});
|
|
336
|
-
skip(owned, scopedLabelToBagKey(ctx.appTfLabel, autoLabel));
|
|
357
|
+
skip(autoBlock, owned, scopedLabelToBagKey(ctx.appTfLabel, autoLabel));
|
|
337
358
|
release({
|
|
338
359
|
autoBlock, autoLabel, owned, refName: scopedLabelToBagKey(ctx.appTfLabel, autoLabel),
|
|
339
360
|
why: `pull could not turn its export into source: ${err.message}`,
|
|
@@ -343,7 +364,7 @@ function extractAutomations(ownBlocks, stream, ctx) {
|
|
|
343
364
|
});
|
|
344
365
|
continue;
|
|
345
366
|
}
|
|
346
|
-
skip(owned, scopedLabelToBagKey(ctx.appTfLabel, autoLabel));
|
|
367
|
+
skip(autoBlock, owned, scopedLabelToBagKey(ctx.appTfLabel, autoLabel));
|
|
347
368
|
// No authored form can manage these, so release an earlier adoption
|
|
348
369
|
// rather than let the next apply destroy the live automation:
|
|
349
370
|
// sibling-loop item refs (#1320) and multi-trigger (#1785 / #39).
|
|
@@ -383,7 +404,7 @@ function extractAutomations(ownBlocks, stream, ctx) {
|
|
|
383
404
|
continue;
|
|
384
405
|
kept.delete(entry);
|
|
385
406
|
cascaded = true;
|
|
386
|
-
skip(entry.owned, entry.extracted.refName);
|
|
407
|
+
skip(entry.autoBlock, entry.owned, entry.extracted.refName);
|
|
387
408
|
const gap = {
|
|
388
409
|
why: `it uses ${target}, which pull skipped, so its reference would point at nothing`,
|
|
389
410
|
nextStep: `Fix ${target} first (see its own warning), then pull again.`,
|
|
@@ -499,6 +520,7 @@ function extractAutomations(ownBlocks, stream, ctx) {
|
|
|
499
520
|
items, skipped, releaseIfManaged, diagnostics, adoptionAddressAliases,
|
|
500
521
|
...(validations.length > 0 && { validations }),
|
|
501
522
|
...(skippedOwnFiles.length > 0 && { skippedOwnFiles }),
|
|
523
|
+
...(unmanagedLookups.length > 0 && { unmanagedLookups }),
|
|
502
524
|
...(settleAfterExtract !== undefined && { settleAfterExtract }),
|
|
503
525
|
};
|
|
504
526
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FromTfContext } from "../../engine/pull/context.js";
|
|
2
|
+
/**
|
|
3
|
+
* The export writes a live automation it left out (no draft, for example) as
|
|
4
|
+
* its platform id. Its display name from omitted-automations.json lets build
|
|
5
|
+
* look it up by name (edk#2693), so the reference keeps its automation with
|
|
6
|
+
* no id in source. A DISABLED automation is deleted, and a key that names an
|
|
7
|
+
* exported automation would build that one instead, so neither gets a key.
|
|
8
|
+
*/
|
|
9
|
+
export declare function omittedAutomationKey(id: string, ownerTfLabel: string, ctx: FromTfContext): {
|
|
10
|
+
readonly key: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
} | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isTfLabel, sanitizeName, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
2
|
+
import { AUTOMATION_RESOURCE_TYPE, automationResourceLabel } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* The export writes a live automation it left out (no draft, for example) as
|
|
5
|
+
* its platform id. Its display name from omitted-automations.json lets build
|
|
6
|
+
* look it up by name (edk#2693), so the reference keeps its automation with
|
|
7
|
+
* no id in source. A DISABLED automation is deleted, and a key that names an
|
|
8
|
+
* exported automation would build that one instead, so neither gets a key.
|
|
9
|
+
*/
|
|
10
|
+
export function omittedAutomationKey(id, ownerTfLabel, ctx) {
|
|
11
|
+
const omitted = ctx.omittedAutomationsById?.get(id);
|
|
12
|
+
if (omitted === undefined || omitted.kind === "disabled")
|
|
13
|
+
return undefined;
|
|
14
|
+
const label = sanitizeName(omitted.name);
|
|
15
|
+
if (!isTfLabel(label))
|
|
16
|
+
return undefined;
|
|
17
|
+
const key = tfLabelToTsLabel(label);
|
|
18
|
+
if (ctx.resourceByAddress?.(`${AUTOMATION_RESOURCE_TYPE}.${automationResourceLabel(ownerTfLabel, key)}`) !== undefined)
|
|
19
|
+
return undefined;
|
|
20
|
+
return { key, name: omitted.name };
|
|
21
|
+
}
|
|
@@ -2051,6 +2051,13 @@ function findRelatedRecordsAppTitleWireKey(name, taskRefKey, refs) {
|
|
|
2051
2051
|
return names?.get("id") ?? DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES.id;
|
|
2052
2052
|
}
|
|
2053
2053
|
function taskWireRefName(name, taskRefKey, refs) {
|
|
2054
|
+
// A Run Automation task's refs are keyed by the called automation's published
|
|
2055
|
+
// output names, exactly as written (#3026). None of the record/trigger
|
|
2056
|
+
// display-name rewrites below apply: an output named `status`, `id`, `title`
|
|
2057
|
+
// or `record` is not a record field, and rewriting it to "Status"/"ID"/…
|
|
2058
|
+
// indexes a key the refs map does not contain (Invalid index at plan).
|
|
2059
|
+
if (refs.tasks.get(taskRefKey)?.type === TASK_RESOURCES.runAutomation)
|
|
2060
|
+
return name;
|
|
2054
2061
|
assertFindRelatedRecordsHasNoCountRef(refs.tasks.get(taskRefKey)?.type, name, taskRefKey);
|
|
2055
2062
|
const handleKey = findRelatedRecordsAppTitleWireKey(name, taskRefKey, refs);
|
|
2056
2063
|
if (handleKey !== undefined)
|
|
@@ -94,6 +94,15 @@ interface DynamicLayoutComponentCommon<ComponentKey extends string = string, Con
|
|
|
94
94
|
readonly saveGroup?: SaveGroupKey;
|
|
95
95
|
readonly blockId?: string;
|
|
96
96
|
}
|
|
97
|
+
interface DynamicLayoutActionButton {
|
|
98
|
+
readonly label?: string;
|
|
99
|
+
readonly variant?: "default" | "outline" | "ghost";
|
|
100
|
+
readonly icon?: string;
|
|
101
|
+
readonly color?: string;
|
|
102
|
+
readonly fullWidth?: boolean;
|
|
103
|
+
/** Display widget on the layout's owner that the layout editor tied to the button. */
|
|
104
|
+
readonly widget?: WidgetRef;
|
|
105
|
+
}
|
|
97
106
|
/** @internal Public component variants used to keep the HCL dialect table exhaustive. */
|
|
98
107
|
export interface DynamicLayoutComponentVariantMap {
|
|
99
108
|
readonly container: {
|
|
@@ -167,15 +176,11 @@ export interface DynamicLayoutComponentVariantMap {
|
|
|
167
176
|
/** Run-automation widget the button executes through; omit to have build derive one. */
|
|
168
177
|
readonly widget?: WidgetRef;
|
|
169
178
|
};
|
|
170
|
-
readonly createButton: {
|
|
179
|
+
readonly createButton: DynamicLayoutActionButton & {
|
|
171
180
|
readonly target: AppOrElementRef;
|
|
172
|
-
readonly label?: string;
|
|
173
|
-
readonly variant?: "default" | "outline" | "ghost";
|
|
174
181
|
};
|
|
175
|
-
readonly relateButton: {
|
|
176
|
-
readonly
|
|
177
|
-
readonly variant?: "default" | "outline" | "ghost";
|
|
178
|
-
readonly icon?: string;
|
|
182
|
+
readonly relateButton: DynamicLayoutActionButton & {
|
|
183
|
+
readonly target?: AppOrElementRef;
|
|
179
184
|
};
|
|
180
185
|
readonly updateBlock: DynamicLayoutBlockCommon & {
|
|
181
186
|
readonly fields?: readonly AppViewFieldRef[];
|
|
@@ -3,6 +3,7 @@ import { dataRefLabel, optionalString, plainObject, reportAuthoringBlocker, reso
|
|
|
3
3
|
import { isTfExpr, isUuid, scopedLabelToBagKey, tfLabelToTsLabel, } from "../../engine/tf/index.js";
|
|
4
4
|
import { filterFromTf } from "../access-policy/from-tf.js";
|
|
5
5
|
import { elementAuditFieldReference, fieldKeyFromTfValue } from "../field/from-tf.js";
|
|
6
|
+
import { omittedAutomationKey } from "../automation/omitted-ref.js";
|
|
6
7
|
import { filterOwnerForAspect } from "../relationship/from-tf.js";
|
|
7
8
|
import { filterWireToTf } from "../shared/filters/tf-codec.js";
|
|
8
9
|
import { resolveDataAspectTarget } from "../shared/aspect-target-from-tf.js";
|
|
@@ -206,11 +207,13 @@ function componentMap(values, layoutKey, owner, ctx, where) {
|
|
|
206
207
|
const automationId = automation["automationId"];
|
|
207
208
|
if (automation["automationId"] !== undefined) {
|
|
208
209
|
const label = resourceRefLabel(automation["automationId"], "elementum_automation");
|
|
209
|
-
|
|
210
|
+
const ref = label !== undefined
|
|
210
211
|
// The display name lets build look the automation up when pull
|
|
211
212
|
// leaves it platform-managed, so it is not in source (edk#2693).
|
|
212
|
-
|
|
213
|
-
|
|
213
|
+
? pulledRef("automation", scopedLabelToBagKey(owner.ownerTfLabel, label, "app"), owner.ownerRefName, exportedAutomationName(label, ctx))
|
|
214
|
+
: omittedButtonAutomation(automation["automationId"], owner, ctx);
|
|
215
|
+
if (ref !== undefined)
|
|
216
|
+
automation["automation"] = ref;
|
|
214
217
|
else
|
|
215
218
|
ctx.diagnostics.push(`${where}.components.${id}.automationButton: automation_id is not a managed automation ref; dropped`);
|
|
216
219
|
delete automation["automationId"];
|
|
@@ -264,15 +267,8 @@ function componentMap(values, layoutKey, owner, ctx, where) {
|
|
|
264
267
|
const related = plainUnknownObject(component["relatedItemsBlock"]);
|
|
265
268
|
if (related !== undefined)
|
|
266
269
|
relatedItemsBlock(related, owner, ctx, `${where}.components.${id}.relatedItemsBlock`);
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
const ref = aspectRef(create["targetAspectId"], owner, ctx);
|
|
270
|
-
if (ref !== undefined)
|
|
271
|
-
create["target"] = ref;
|
|
272
|
-
else
|
|
273
|
-
ctx.diagnostics.push(`${where}.components.${id}.createButton: target_aspect_id is not resolvable; dropped`);
|
|
274
|
-
delete create["targetAspectId"];
|
|
275
|
-
}
|
|
270
|
+
buttonTarget(plainUnknownObject(component["createButton"]), owner, ctx, `${where}.components.${id}.createButton`);
|
|
271
|
+
buttonTarget(plainUnknownObject(component["relateButton"]), owner, ctx, `${where}.components.${id}.relateButton`);
|
|
276
272
|
out[id] = component;
|
|
277
273
|
}
|
|
278
274
|
return out;
|
|
@@ -303,6 +299,10 @@ function managedParameter(parameter, ctx) {
|
|
|
303
299
|
const automationLabel = automationId === undefined ? undefined : resourceRefLabel(automationId, "elementum_automation");
|
|
304
300
|
return automationLabel === undefined ? undefined : { automationLabel, name };
|
|
305
301
|
}
|
|
302
|
+
function omittedButtonAutomation(value, owner, ctx) {
|
|
303
|
+
const omitted = typeof value === "string" ? omittedAutomationKey(value, owner.ownerTfLabel, ctx) : undefined;
|
|
304
|
+
return omitted === undefined ? undefined : pulledRef("automation", omitted.key, owner.ownerRefName, omitted.name);
|
|
305
|
+
}
|
|
306
306
|
/** Display name of an exported `elementum_automation`, when the stream has one. */
|
|
307
307
|
function exportedAutomationName(label, ctx) {
|
|
308
308
|
const exportedName = ctx.resourceByAddress?.(`elementum_automation.${label}`)?.attrs["name"];
|
|
@@ -331,15 +331,7 @@ function relatedItemsBlock(block, owner, ctx, where) {
|
|
|
331
331
|
else
|
|
332
332
|
ctx.diagnostics.push(`${where}: related_aspect_id is not resolvable; dropped`);
|
|
333
333
|
}
|
|
334
|
-
|
|
335
|
-
delete block["widgetId"];
|
|
336
|
-
if (widgetId !== undefined) {
|
|
337
|
-
const label = resourceRefLabel(widgetId, WIDGET_RESOURCE_TYPE);
|
|
338
|
-
if (label !== undefined)
|
|
339
|
-
block["widget"] = pulledRef("widget", scopedLabelToBagKey(owner.label, label, scopeOf(owner)), owner.ownerRefName);
|
|
340
|
-
else
|
|
341
|
-
ctx.diagnostics.push(`${where}: widget_id is not a managed widget ref; dropped`);
|
|
342
|
-
}
|
|
334
|
+
widgetRef(block, owner, ctx, where);
|
|
343
335
|
const raw = block["filter"];
|
|
344
336
|
delete block["filter"];
|
|
345
337
|
if (raw === undefined)
|
|
@@ -533,6 +525,30 @@ function stageIndex(value, owner) {
|
|
|
533
525
|
}
|
|
534
526
|
return undefined;
|
|
535
527
|
}
|
|
528
|
+
function buttonTarget(button, owner, ctx, where) {
|
|
529
|
+
if (button === undefined)
|
|
530
|
+
return;
|
|
531
|
+
widgetRef(button, owner, ctx, where);
|
|
532
|
+
if (button["targetAspectId"] === undefined)
|
|
533
|
+
return;
|
|
534
|
+
const ref = aspectRef(button["targetAspectId"], owner, ctx);
|
|
535
|
+
if (ref !== undefined)
|
|
536
|
+
button["target"] = ref;
|
|
537
|
+
else
|
|
538
|
+
ctx.diagnostics.push(`${where}: target_aspect_id is not resolvable; dropped`);
|
|
539
|
+
delete button["targetAspectId"];
|
|
540
|
+
}
|
|
541
|
+
function widgetRef(rec, owner, ctx, where) {
|
|
542
|
+
const widgetId = rec["widgetId"];
|
|
543
|
+
delete rec["widgetId"];
|
|
544
|
+
if (widgetId === undefined)
|
|
545
|
+
return;
|
|
546
|
+
const label = resourceRefLabel(widgetId, WIDGET_RESOURCE_TYPE);
|
|
547
|
+
if (label !== undefined)
|
|
548
|
+
rec["widget"] = pulledRef("widget", scopedLabelToBagKey(owner.label, label, scopeOf(owner)), owner.ownerRefName);
|
|
549
|
+
else
|
|
550
|
+
ctx.diagnostics.push(`${where}: widget_id is not a managed widget ref; dropped`);
|
|
551
|
+
}
|
|
536
552
|
function aspectRef(value, owner, ctx) {
|
|
537
553
|
if (resourceRefLabel(value, owner.type) === owner.label)
|
|
538
554
|
return pulledRef(scopeOf(owner), owner.ownerRefName);
|
|
@@ -541,14 +541,20 @@ function componentMap(components, layoutKey, layoutLabel, where, opts) {
|
|
|
541
541
|
if (automation !== undefined)
|
|
542
542
|
attrs["automation_button"] = button;
|
|
543
543
|
}
|
|
544
|
-
else if (key === "createButton") {
|
|
544
|
+
else if (key === "createButton" || key === "relateButton") {
|
|
545
545
|
const rec = object(value);
|
|
546
546
|
const button = snakeObject(rec, where, opts);
|
|
547
547
|
delete button["target"];
|
|
548
|
-
|
|
548
|
+
delete button["widget"];
|
|
549
|
+
const target = resolveAspect(rec["target"], `${where}.components.${componentId}.${key}`, opts);
|
|
549
550
|
if (target !== undefined)
|
|
550
551
|
button["target_aspect_id"] = target;
|
|
551
|
-
|
|
552
|
+
if (rec["widget"] !== undefined) {
|
|
553
|
+
const widget = resolveWidget(rec["widget"], `${where}.components.${componentId}.${key}.widget`, opts);
|
|
554
|
+
if (widget !== undefined)
|
|
555
|
+
button["widget_id"] = widget;
|
|
556
|
+
}
|
|
557
|
+
attrs[key === "createButton" ? "create_button" : "relate_button"] = button;
|
|
552
558
|
}
|
|
553
559
|
else if (key === "relatedItemsBlock") {
|
|
554
560
|
attrs["related_items_block"] = relatedItemsBlock(object(value), `${where}.components.${componentId}.relatedItemsBlock`, opts);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { typedCoverageGap } from "../../engine/coverage-gaps.js";
|
|
2
2
|
import { dataRefLabel, optionalBoolean, optionalString, plainObject, reportAuthoringBlocker, resourceRefLabel } from "../../engine/pull/context.js";
|
|
3
3
|
import { bareChildResourceLabel, isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
4
|
+
import { omittedAutomationKey } from "../automation/omitted-ref.js";
|
|
4
5
|
import { AUTOMATION_RESOURCE_TYPE } from "../automation/types.js";
|
|
5
6
|
import { decodeForeignDataField, fieldKeyFromTfRef } from "../field/from-tf.js";
|
|
6
7
|
import { SUB_TYPE_BY_RESOURCE } from "../field/types.js";
|
|
@@ -286,8 +287,9 @@ function recordIdentityTarget(resourceType, target) {
|
|
|
286
287
|
* A run-automation widget keeps a raw automation id as is. Pull warns, naming
|
|
287
288
|
* the widget and the automation, and continues (#1877) only when the
|
|
288
289
|
* automation is known to be dropped: the export listed it in
|
|
289
|
-
* omitted-automations.json
|
|
290
|
-
*
|
|
290
|
+
* omitted-automations.json and pull could not give it a key (a DISABLED
|
|
291
|
+
* automation, which is how the platform marks a deleted one; see
|
|
292
|
+
* {@link omittedAutomationKey}), or wrote no id at all. Any other raw id is a valid reference to an automation this
|
|
291
293
|
* pull does not export, such as another app's, which build emits as is, so
|
|
292
294
|
* it stays silent. Unlike an unextracted field reference (#1978), a dropped
|
|
293
295
|
* automation does not fail the pull.
|
|
@@ -313,8 +315,10 @@ function droppedAutomationGap(widgetKey, automationId, owner, ctx) {
|
|
|
313
315
|
});
|
|
314
316
|
}
|
|
315
317
|
function automationRef(value, owner, ctx) {
|
|
316
|
-
if (typeof value === "string")
|
|
317
|
-
|
|
318
|
+
if (typeof value === "string") {
|
|
319
|
+
const omitted = omittedAutomationKey(value, owner.ownerTfLabel, ctx);
|
|
320
|
+
return omitted === undefined ? value : { kind: "automation", key: omitted.key, name: omitted.name, parent: owner.ownerRefName };
|
|
321
|
+
}
|
|
318
322
|
const label = resourceRefLabel(value, AUTOMATION_RESOURCE_TYPE);
|
|
319
323
|
if (label === undefined)
|
|
320
324
|
return undefined;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Public graph barrel: KIND_MODULES + derived views for pull/build/canvas.
|
|
3
3
|
*/
|
|
4
4
|
import { type CatalogRenderArgs, type CatalogRenderResult, type EntityKindModule, type KindId, type ParentEdge, type PortableEmptiedList, type PortableLeaveOut, type PortablePrincipals, type StateAlignment, type StateScopedPlatformEntry, type TaskOutputReference, matchType } from "./types.js";
|
|
5
|
-
export type { AdoptionAddressAlias, AuthoringFacet, CanvasComponentId, CanvasFacet, CanvasView, CatalogAuthoringArgs, CatalogFacet, CatalogRenderArgs, CatalogRenderResult, CatalogRoot, DataFacet, DataFacetCatalogKind, EntityKindId, EntityKindModule, KindId, LifecycleFacet, OrgIdentityBag, ParentEdge, ParentageFacet, ResourceFacet, StateAlignment, StateReferenceResolver, StateScopedPlatformEntry, StreamFacet, StreamMatch, StreamPartition, StreamRootExtractResult, TaskOutputReference, ToTfResult, } from "./types.js";
|
|
5
|
+
export type { AdoptionAddressAlias, AuthoringFacet, CanvasComponentId, CanvasFacet, CanvasView, CatalogAuthoringArgs, CatalogFacet, CatalogRenderArgs, CatalogRenderResult, CatalogRoot, DataFacet, DataFacetCatalogKind, EntityKindId, EntityKindModule, KindId, LifecycleFacet, OrgIdentityBag, ParentEdge, ParentageFacet, ResourceFacet, StateAlignment, StateReferenceResolver, StateScopedPlatformEntry, StreamFacet, StreamMatch, StreamPartition, StreamRootExtractResult, TaskOutputReference, ToTfResult, UnmanagedLookup, } from "./types.js";
|
|
6
6
|
export type { ReferenceLookupStrategy } from "./types.js";
|
|
7
7
|
export { NO_CANVAS, NO_CATALOG, NO_DATA, NO_LIFECYCLE, defaultMatchResourceType, implementedResourceTypes, isResourceAdoptable, isTfLive, knownResourceTypes, matchType, singleResourceType, } from "./types.js";
|
|
8
8
|
export { KIND_MODULES } from "./modules.js";
|
|
@@ -346,6 +346,8 @@ export interface OwnFileExtractResult {
|
|
|
346
346
|
readonly validations?: readonly ValidationFailure[];
|
|
347
347
|
/** Export address → canonical address rebuilt by the printed current API. */
|
|
348
348
|
readonly adoptionAddressAliases?: readonly AdoptionAddressAlias[];
|
|
349
|
+
/** Lookups for skipped resources that other resources in the stream reference (see {@link UnmanagedLookup}). */
|
|
350
|
+
readonly unmanagedLookups?: readonly UnmanagedLookup[];
|
|
349
351
|
/**
|
|
350
352
|
* Own-file ref names released from state on this pull. Their authored files
|
|
351
353
|
* are archived so the next plan does not recreate the live resource (#1858).
|
|
@@ -385,6 +387,17 @@ export interface AdoptionAddressAlias {
|
|
|
385
387
|
readonly from: string;
|
|
386
388
|
readonly to: string;
|
|
387
389
|
}
|
|
390
|
+
/**
|
|
391
|
+
* A data lookup that stands in for skipped resources in the export adoption
|
|
392
|
+
* plans (#3023). Adoption replaces each `.id` reference to a skipped resource
|
|
393
|
+
* with its platform id, but has no literal for any other attribute. A
|
|
394
|
+
* reference to another attribute of one of `addresses` reads the attribute of
|
|
395
|
+
* the same name from `lookup` instead, so it stays declared.
|
|
396
|
+
*/
|
|
397
|
+
export interface UnmanagedLookup {
|
|
398
|
+
readonly lookup: TfBlock;
|
|
399
|
+
readonly addresses: readonly string[];
|
|
400
|
+
}
|
|
388
401
|
export interface PrintedOwnFile {
|
|
389
402
|
readonly refName: string;
|
|
390
403
|
readonly source: string;
|
package/package.json
CHANGED