@elementumai/edk 0.13.3 → 0.14.0

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.
Files changed (140) hide show
  1. package/dist-sdk/src/catalog/factories.d.ts +4 -2
  2. package/dist-sdk/src/catalog/factories.js +3 -1
  3. package/dist-sdk/src/catalog/from-authoring.d.ts +8 -3
  4. package/dist-sdk/src/catalog/from-authoring.js +21 -8
  5. package/dist-sdk/src/engine/build/context.d.ts +17 -0
  6. package/dist-sdk/src/engine/coverage-gaps.d.ts +13 -0
  7. package/dist-sdk/src/engine/coverage-gaps.js +21 -0
  8. package/dist-sdk/src/engine/pull/context.d.ts +57 -1
  9. package/dist-sdk/src/engine/pull/context.js +9 -1
  10. package/dist-sdk/src/engine/pull/pulled-roots.d.ts +14 -1
  11. package/dist-sdk/src/engine/pull/pulled-roots.js +23 -3
  12. package/dist-sdk/src/engine/pull/ref-only.d.ts +6 -1
  13. package/dist-sdk/src/engine/pull/ref-only.js +4 -1
  14. package/dist-sdk/src/engine/pull/stream-root.d.ts +17 -1
  15. package/dist-sdk/src/engine/pull/stream-root.js +57 -4
  16. package/dist-sdk/src/engine/tf/index.d.ts +1 -0
  17. package/dist-sdk/src/engine/tf/index.js +1 -0
  18. package/dist-sdk/src/engine/tf/jsonencode.d.ts +19 -0
  19. package/dist-sdk/src/engine/tf/jsonencode.js +49 -0
  20. package/dist-sdk/src/engine/validation.d.ts +36 -1
  21. package/dist-sdk/src/engine/validation.js +56 -2
  22. package/dist-sdk/src/engine/workspace/loader.d.ts +6 -0
  23. package/dist-sdk/src/engine/workspace/loader.js +87 -2
  24. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +7 -0
  25. package/dist-sdk/src/entities/access-policy/from-tf.js +58 -17
  26. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +3 -1
  27. package/dist-sdk/src/entities/access-policy/to-tf.js +1 -1
  28. package/dist-sdk/src/entities/agent/build.d.ts +15 -0
  29. package/dist-sdk/src/entities/agent/build.js +139 -16
  30. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +3 -3
  31. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +39 -25
  32. package/dist-sdk/src/entities/agent/module.js +95 -3
  33. package/dist-sdk/src/entities/agent/to-tf.js +6 -4
  34. package/dist-sdk/src/entities/agent-evaluation/from-tf.d.ts +7 -0
  35. package/dist-sdk/src/entities/agent-evaluation/from-tf.js +14 -5
  36. package/dist-sdk/src/entities/agent-evaluation/module.js +4 -2
  37. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +11 -2
  38. package/dist-sdk/src/entities/agent-tool/from-tf.js +38 -40
  39. package/dist-sdk/src/entities/agent-tool/to-tf.js +12 -5
  40. package/dist-sdk/src/entities/app/build.d.ts +1 -1
  41. package/dist-sdk/src/entities/app/index.d.ts +1 -1
  42. package/dist-sdk/src/entities/automation/approval-trigger-refs.d.ts +20 -0
  43. package/dist-sdk/src/entities/automation/approval-trigger-refs.js +83 -0
  44. package/dist-sdk/src/entities/automation/build.d.ts +75 -42
  45. package/dist-sdk/src/entities/automation/build.js +18 -8
  46. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +14 -2
  47. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +9 -0
  48. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +64 -12
  49. package/dist-sdk/src/entities/automation/from-tf.d.ts +53 -0
  50. package/dist-sdk/src/entities/automation/from-tf.js +579 -106
  51. package/dist-sdk/src/entities/automation/index.d.ts +2 -2
  52. package/dist-sdk/src/entities/automation/index.js +1 -1
  53. package/dist-sdk/src/entities/automation/lookup-owner.d.ts +23 -0
  54. package/dist-sdk/src/entities/automation/lookup-owner.js +27 -0
  55. package/dist-sdk/src/entities/automation/module.js +265 -26
  56. package/dist-sdk/src/entities/automation/operators.d.ts +6 -2
  57. package/dist-sdk/src/entities/automation/operators.js +0 -2
  58. package/dist-sdk/src/entities/automation/task-output-labels.d.ts +8 -0
  59. package/dist-sdk/src/entities/automation/task-output-labels.js +11 -0
  60. package/dist-sdk/src/entities/automation/tasks.d.ts +37 -2
  61. package/dist-sdk/src/entities/automation/tasks.js +38 -1
  62. package/dist-sdk/src/entities/automation/to-tf.d.ts +8 -0
  63. package/dist-sdk/src/entities/automation/to-tf.js +576 -52
  64. package/dist-sdk/src/entities/automation/triggers.d.ts +47 -1
  65. package/dist-sdk/src/entities/automation/unsafe-script-output.d.ts +10 -5
  66. package/dist-sdk/src/entities/automation/unsafe-script-output.js +10 -5
  67. package/dist-sdk/src/entities/chart/to-tf.js +18 -5
  68. package/dist-sdk/src/entities/dashboard/from-tf.js +45 -11
  69. package/dist-sdk/src/entities/dashboard-widget-order/order.d.ts +5 -3
  70. package/dist-sdk/src/entities/dashboard-widget-order/order.js +6 -4
  71. package/dist-sdk/src/entities/datamine/from-tf.js +10 -3
  72. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +38 -11
  73. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +35 -7
  74. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +101 -9
  75. package/dist-sdk/src/entities/element/build.d.ts +4 -1
  76. package/dist-sdk/src/entities/element/build.js +3 -4
  77. package/dist-sdk/src/entities/element/index.d.ts +1 -1
  78. package/dist-sdk/src/entities/field/from-tf.js +8 -1
  79. package/dist-sdk/src/entities/field/to-tf.d.ts +29 -2
  80. package/dist-sdk/src/entities/field/to-tf.js +106 -7
  81. package/dist-sdk/src/entities/phone-service/from-tf.d.ts +7 -0
  82. package/dist-sdk/src/entities/phone-service/from-tf.js +15 -7
  83. package/dist-sdk/src/entities/phone-service/module.js +4 -2
  84. package/dist-sdk/src/entities/portal/to-tf.d.ts +1 -1
  85. package/dist-sdk/src/entities/portal/to-tf.js +61 -2
  86. package/dist-sdk/src/entities/record-create-form/from-tf.js +3 -1
  87. package/dist-sdk/src/entities/relationship/from-tf.js +34 -4
  88. package/dist-sdk/src/entities/relationship/to-tf.js +24 -6
  89. package/dist-sdk/src/entities/role/from-tf.js +3 -1
  90. package/dist-sdk/src/entities/search-table/from-tf.d.ts +3 -1
  91. package/dist-sdk/src/entities/search-table/from-tf.js +6 -3
  92. package/dist-sdk/src/entities/search-table/module.js +18 -2
  93. package/dist-sdk/src/entities/search-table/to-tf.js +10 -16
  94. package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +6 -1
  95. package/dist-sdk/src/entities/shared/filters/ast.d.ts +6 -0
  96. package/dist-sdk/src/entities/shared/filters/index.d.ts +21 -4
  97. package/dist-sdk/src/entities/shared/filters/index.js +27 -3
  98. package/dist-sdk/src/entities/shared/filters/print.js +23 -7
  99. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +24 -0
  100. package/dist-sdk/src/entities/shared/filters/tf-codec.js +98 -3
  101. package/dist-sdk/src/entities/shared/filters/types.d.ts +8 -1
  102. package/dist-sdk/src/entities/shared/run-automation-requirement.d.ts +15 -0
  103. package/dist-sdk/src/entities/shared/run-automation-requirement.js +28 -0
  104. package/dist-sdk/src/entities/shared/search-table-address.d.ts +17 -0
  105. package/dist-sdk/src/entities/shared/search-table-address.js +24 -0
  106. package/dist-sdk/src/entities/shared/skip-release.d.ts +49 -0
  107. package/dist-sdk/src/entities/shared/skip-release.js +74 -0
  108. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +3 -3
  109. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +11 -5
  110. package/dist-sdk/src/entities/skill/module.js +3 -25
  111. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +4 -2
  112. package/dist-sdk/src/entities/skill-tool/from-tf.js +28 -27
  113. package/dist-sdk/src/entities/skill-tool/to-tf.js +12 -5
  114. package/dist-sdk/src/entities/skill-tool/types.d.ts +1 -0
  115. package/dist-sdk/src/entities/skill-tool/types.js +2 -1
  116. package/dist-sdk/src/entities/table/catalog.d.ts +16 -0
  117. package/dist-sdk/src/entities/table/catalog.js +44 -2
  118. package/dist-sdk/src/entities/table/from-tf.js +30 -4
  119. package/dist-sdk/src/entities/table/keys.d.ts +27 -0
  120. package/dist-sdk/src/entities/table/keys.js +46 -0
  121. package/dist-sdk/src/entities/table/to-tf.js +2 -2
  122. package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +12 -1
  123. package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +9 -4
  124. package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +215 -10
  125. package/dist-sdk/src/entities/view/agent-view-layout.d.ts +10 -4
  126. package/dist-sdk/src/entities/view/custom-view-runtime-rules.d.ts +43 -0
  127. package/dist-sdk/src/entities/view/custom-view-runtime-rules.js +285 -0
  128. package/dist-sdk/src/entities/view/custom-view-validate.d.ts +3 -1
  129. package/dist-sdk/src/entities/view/custom-view-validate.js +24 -5
  130. package/dist-sdk/src/entities/view/from-tf.js +14 -1
  131. package/dist-sdk/src/entities/widget/from-tf.js +14 -7
  132. package/dist-sdk/src/entities/widget/to-tf.js +9 -6
  133. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +4 -2
  134. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
  135. package/dist-sdk/src/graph/index.d.ts +14 -1
  136. package/dist-sdk/src/graph/index.js +2 -0
  137. package/dist-sdk/src/graph/resource-types.d.ts +2 -0
  138. package/dist-sdk/src/graph/resource-types.js +3 -0
  139. package/dist-sdk/src/graph/types.d.ts +105 -0
  140. package/package.json +1 -1
@@ -351,7 +351,7 @@ export interface CatalogViewRefOptions {
351
351
  readonly parentKind?: never;
352
352
  readonly parentNamespace?: never;
353
353
  }
354
- /** A view of an app or element outside this workspace, by its owner's namespace and its name. */
354
+ /** A view by its owner's namespace and its name: for an owner outside this workspace, or a view its source doesn't hold. */
355
355
  export interface OutsideViewRefOptions {
356
356
  readonly name: string;
357
357
  readonly parentKind: "app" | "element";
@@ -362,7 +362,9 @@ export interface OutsideViewRefOptions {
362
362
  /**
363
363
  * A view by its owner and name. Inside the workspace, use the generated
364
364
  * catalog (`catalog.<app>.views.<view>`); for a view of an app or element
365
- * outside it, pass `{ name, parentKind, parentNamespace }`.
365
+ * outside it, pass `{ name, parentKind, parentNamespace }`. The namespace form
366
+ * also works for an owner in the workspace: a portal finds the view by name
367
+ * in that owner's source, or looks it up live when the source doesn't have it.
366
368
  */
367
369
  export declare function viewRef(opts: CatalogViewRefOptions | OutsideViewRefOptions): ViewRef;
368
370
  /**
@@ -309,7 +309,9 @@ export const fieldRef = (opts) => ({ __kind: "field", ...opts, refName: opts.ref
309
309
  /**
310
310
  * A view by its owner and name. Inside the workspace, use the generated
311
311
  * catalog (`catalog.<app>.views.<view>`); for a view of an app or element
312
- * outside it, pass `{ name, parentKind, parentNamespace }`.
312
+ * outside it, pass `{ name, parentKind, parentNamespace }`. The namespace form
313
+ * also works for an owner in the workspace: a portal finds the view by name
314
+ * in that owner's source, or looks it up live when the source doesn't have it.
313
315
  */
314
316
  export function viewRef(opts) {
315
317
  if (opts.parentNamespace !== undefined) {
@@ -28,6 +28,11 @@ export declare function listEntityFilesFromPaths(paths: readonly string[], tenan
28
28
  * own copy of "strip the extension."
29
29
  */
30
30
  export declare function refNameOf(file: string): string;
31
+ /** How a catalog writer reports a child file it could not load and replaced with a typed stub. */
32
+ export interface CatalogChildLoadOptions {
33
+ /** Called instead of the default warning, for a caller that reports the failure itself. */
34
+ readonly onChildLoadFailure?: (file: string, error: unknown) => void;
35
+ }
31
36
  export interface AppAuthoringCatalog {
32
37
  /** Ref-only: `{ __kind, refName, name, fields, …catalogBags }`. */
33
38
  readonly refs: Record<string, unknown>;
@@ -45,7 +50,7 @@ export interface AppAuthoringCatalog {
45
50
  * yet. The stub is overwritten with the real catalog by this function's
46
51
  * caller.
47
52
  */
48
- export declare function buildAppCatalogFromAuthoring(appDir: string, appFile: string, orgCatalogPath?: string): Promise<AppAuthoringCatalog>;
53
+ export declare function buildAppCatalogFromAuthoring(appDir: string, appFile: string, orgCatalogPath?: string, options?: CatalogChildLoadOptions): Promise<AppAuthoringCatalog>;
49
54
  /**
50
55
  * Build the app's catalog from authoring files and persist `refs` as a static
51
56
  * catalog file at `<appDir>/generated/catalog.ts` — distinct from the app's own
@@ -58,7 +63,7 @@ export declare function buildAppCatalogFromAuthoring(appDir: string, appFile: st
58
63
  * so they keep showing up in the catalog instead of being dropped now that the
59
64
  * old embedded-in-the-app-file catalog section is gone.
60
65
  */
61
- export declare function writeAppCatalogFromAuthoring(appDir: string, appRefName: string, appName: string, appFile: string, extraRefs?: readonly CatalogRef[]): Promise<{
66
+ export declare function writeAppCatalogFromAuthoring(appDir: string, appRefName: string, appName: string, appFile: string, extraRefs?: readonly CatalogRef[], options?: CatalogChildLoadOptions): Promise<{
62
67
  catalogPath: string;
63
68
  defs: Record<string, unknown>;
64
69
  }>;
@@ -105,4 +110,4 @@ export interface AppCatalogRegenResult {
105
110
  */
106
111
  export declare function regenerateAppCatalogsUnder(pathOrPaths: string | readonly string[], tenant?: AuthoringTenantContext, options?: {
107
112
  readonly onLoadFailure?: (file: string, error: unknown) => void;
108
- }): Promise<AppCatalogRegenResult[]>;
113
+ } & CatalogChildLoadOptions): Promise<AppCatalogRegenResult[]>;
@@ -198,7 +198,7 @@ async function stubRefsForChild(appDir, child, parent) {
198
198
  * module's `catalog.refFromAuthoring`. Configured entities also contribute
199
199
  * `.def(refName)` into `defsOut[catalogBag]`.
200
200
  */
201
- async function loadCatalogChildBag(appDir, child, parent, catalogPath, defsOut) {
201
+ async function loadCatalogChildBag(appDir, child, parent, catalogPath, defsOut, options) {
202
202
  const facet = child.catalog;
203
203
  if (!facet.participates)
204
204
  return {};
@@ -213,7 +213,10 @@ async function loadCatalogChildBag(appDir, child, parent, catalogPath, defsOut)
213
213
  }
214
214
  catch (err) {
215
215
  const message = err instanceof Error ? err.message : String(err);
216
- writeTechnicalLog("WARN", "edk", `could not load catalog child ${file}; using typed stub ${parent}.${refName}: ${message}`);
216
+ if (options?.onChildLoadFailure !== undefined)
217
+ options.onChildLoadFailure(file, err);
218
+ else
219
+ writeTechnicalLog("WARN", "edk", `could not load catalog child ${file}; using typed stub ${parent}.${refName}: ${message}`);
217
220
  if (process.env.EDK_DEBUG) {
218
221
  writeTechnicalLog("DEBUG", "edk", `Failed to import ${file}: ${String(err)}`);
219
222
  }
@@ -239,7 +242,17 @@ async function loadCatalogChildBag(appDir, child, parent, catalogPath, defsOut)
239
242
  continue;
240
243
  refs[refName] = catalogRef;
241
244
  if (isConfiguredEntity(defaultExport)) {
242
- defs[refName] = defaultExport.def(refName);
245
+ try {
246
+ defs[refName] = defaultExport.def(refName);
247
+ }
248
+ catch (err) {
249
+ // Its ref stays; build loads it again and reports why def() fails.
250
+ // One child's def() no longer stops the whole catalog (#3112).
251
+ if (options?.onChildLoadFailure !== undefined)
252
+ options.onChildLoadFailure(file, err);
253
+ else
254
+ writeTechnicalLog("WARN", "edk", `catalog child ${file} loaded but its definition failed: ${err instanceof Error ? err.message : String(err)}`);
255
+ }
243
256
  }
244
257
  }
245
258
  if (Object.keys(defs).length > 0) {
@@ -286,7 +299,7 @@ async function writeStubCatalog(appDir, appRefName, appName, kind, fields, child
286
299
  * yet. The stub is overwritten with the real catalog by this function's
287
300
  * caller.
288
301
  */
289
- export async function buildAppCatalogFromAuthoring(appDir, appFile, orgCatalogPath) {
302
+ export async function buildAppCatalogFromAuthoring(appDir, appFile, orgCatalogPath, options) {
290
303
  // `appDir` is `<wsRoot>/apps/<handle>` or `<wsRoot>/elements/<handle>`.
291
304
  const resolvedOrgCatalogPath = orgCatalogPath ?? join(dirname(dirname(appDir)), "generated", "catalog.ts");
292
305
  const loader = authoringLoader(resolvedOrgCatalogPath);
@@ -325,7 +338,7 @@ export async function buildAppCatalogFromAuthoring(appDir, appFile, orgCatalogPa
325
338
  for (const child of children) {
326
339
  if (!child.catalog.participates)
327
340
  continue;
328
- childRefBags[child.catalog.catalogBag] = await loadCatalogChildBag(appDir, child, appRefName, resolvedOrgCatalogPath, childDefBags);
341
+ childRefBags[child.catalog.catalogBag] = await loadCatalogChildBag(appDir, child, appRefName, resolvedOrgCatalogPath, childDefBags, options);
329
342
  }
330
343
  const refs = {
331
344
  __kind: appRef.__kind,
@@ -355,11 +368,11 @@ export async function buildAppCatalogFromAuthoring(appDir, appFile, orgCatalogPa
355
368
  * so they keep showing up in the catalog instead of being dropped now that the
356
369
  * old embedded-in-the-app-file catalog section is gone.
357
370
  */
358
- export async function writeAppCatalogFromAuthoring(appDir, appRefName, appName, appFile, extraRefs = []) {
371
+ export async function writeAppCatalogFromAuthoring(appDir, appRefName, appName, appFile, extraRefs = [], options) {
359
372
  // Derive org catalog path once — passed to buildAppCatalogFromAuthoring and reused
360
373
  // for the trigger-kind scan so both use the identical `@catalog` alias.
361
374
  const orgCatalogPath = join(dirname(dirname(appDir)), "generated", "catalog.ts");
362
- const { refs, defs } = await buildAppCatalogFromAuthoring(appDir, appFile, orgCatalogPath);
375
+ const { refs, defs } = await buildAppCatalogFromAuthoring(appDir, appFile, orgCatalogPath, options);
363
376
  const fields = refs.fields ?? {};
364
377
  const views = refs.views ?? {};
365
378
  const parentKind = (refs.__kind === "element" ? "element" : "app");
@@ -505,7 +518,7 @@ export async function regenerateAppCatalogsUnder(pathOrPaths, tenant, options) {
505
518
  }
506
519
  if (ref.__kind !== "app" && ref.__kind !== "element")
507
520
  continue;
508
- const { catalogPath } = await writeAppCatalogFromAuthoring(dirname(file), appRefName, ref.name, file, []);
521
+ const { catalogPath } = await writeAppCatalogFromAuthoring(dirname(file), appRefName, ref.name, file, [], options?.onChildLoadFailure !== undefined ? { onChildLoadFailure: options.onChildLoadFailure } : undefined);
509
522
  out.push({ appRefName, appName: ref.name, kind: ref.__kind, catalogPath });
510
523
  }
511
524
  return out;
@@ -99,6 +99,15 @@ export interface WorkspaceAspect {
99
99
  readonly onDemandRecordParamByAutomationRefName?: ReadonlyMap<string, string>;
100
100
  /** Every on-demand record input, keyed by automation refName; a static runAutomation mapping into one is refused (edk#1868). */
101
101
  readonly onDemandRecordInputsByAutomationRefName?: ReadonlyMap<string, ReadonlySet<string>>;
102
+ /**
103
+ * Per automation refName: whether its trigger is on demand, and the owner
104
+ * (`"<kind>:<refName>"`, or undefined when unnamed) of each record input.
105
+ * A custom view button that runs it checks these (#3207).
106
+ */
107
+ readonly onDemandRunInfoByAutomationRefName?: ReadonlyMap<string, {
108
+ readonly onDemand: boolean;
109
+ readonly recordInputOwners: readonly (string | undefined)[];
110
+ }>;
102
111
  /** Automations recorded in applied-automation-revisions.json: the platform already has them, so a live shape build refuses for new ones is reported instead. */
103
112
  readonly pulledAutomationRefNames?: ReadonlySet<string>;
104
113
  /** Terraform labels of datamines managed by a table in this workspace. */
@@ -146,6 +155,14 @@ export interface ToTfContext {
146
155
  * to one resolves through a data lookup.
147
156
  */
148
157
  readonly outOfScopeApps?: ReadonlyMap<string, ForeignRootIdentity>;
158
+ /** Elements authored in this workspace but left out of a scoped build, as {@link outOfScopeApps}. */
159
+ readonly outOfScopeElements?: ReadonlyMap<string, ForeignRootIdentity>;
160
+ /**
161
+ * Every element the org catalog barrel lists, by refName, including those
162
+ * known only from a ref-only (dependency) catalog: a reference to one of
163
+ * their children resolves the element through a data lookup.
164
+ */
165
+ readonly catalogElementIdentities?: ReadonlyMap<string, ForeignRootIdentity>;
149
166
  /** App-local automations whose workflow_publish block is emitted in this build. */
150
167
  readonly activeAutomationRefNames?: ReadonlySet<string>;
151
168
  }
@@ -32,6 +32,19 @@
32
32
  * right-panel section sharing a displayOrder with a main-area one, and in
33
33
  * dynamic layouts an empty container or more than 8 stacked fields; the
34
34
  * layout is emitted as authored
35
+ * - a dynamic layout Current User / Current User's Groups condition on a
36
+ * field of another type (edk#3038; the condition is emitted as authored and
37
+ * never matches the viewer as intended)
38
+ * - a dynamic layout in / notIn condition with a single number or boolean
39
+ * (edk#3043; built as written, the record page never matches the in and
40
+ * always matches the notIn)
41
+ * - a dynamic layout condition value on a Dropdown, Multi-Select, status or
42
+ * stage field that is not one of its option labels (edk#3044; built as
43
+ * written, no record holds it: equals / in never match, notEquals / notIn
44
+ * always do)
45
+ * - a dynamic layout contains / notContains condition with a list (edk#3044;
46
+ * built as written, the record page never matches the contains and always
47
+ * matches the notContains)
35
48
  *
36
49
  * The ~600 emit sites push free-form `"<where>: <what>; dropped"` strings.
37
50
  * Rather than rewrite every site, they are classified here, where they leave
@@ -32,6 +32,19 @@
32
32
  * right-panel section sharing a displayOrder with a main-area one, and in
33
33
  * dynamic layouts an empty container or more than 8 stacked fields; the
34
34
  * layout is emitted as authored
35
+ * - a dynamic layout Current User / Current User's Groups condition on a
36
+ * field of another type (edk#3038; the condition is emitted as authored and
37
+ * never matches the viewer as intended)
38
+ * - a dynamic layout in / notIn condition with a single number or boolean
39
+ * (edk#3043; built as written, the record page never matches the in and
40
+ * always matches the notIn)
41
+ * - a dynamic layout condition value on a Dropdown, Multi-Select, status or
42
+ * stage field that is not one of its option labels (edk#3044; built as
43
+ * written, no record holds it: equals / in never match, notEquals / notIn
44
+ * always do)
45
+ * - a dynamic layout contains / notContains condition with a list (edk#3044;
46
+ * built as written, the record page never matches the contains and always
47
+ * matches the notContains)
35
48
  *
36
49
  * The ~600 emit sites push free-form `"<where>: <what>; dropped"` strings.
37
50
  * Rather than rewrite every site, they are classified here, where they leave
@@ -59,6 +72,14 @@ const ADVISORY_DIAGNOSTICS = [
59
72
  // Section names are quoted as authored, so match them with [\s\S]* and anchor on the fixed rest of the message.
60
73
  /\.sections\[\d+\](?: \("[\s\S]*"\))?: group section (?:has no fields, widgets or agent, so the record page shows an empty section; add fields or remove it|holds \d+ fields; split them into labeled groups \(key fields first\) so the record page doesn't read as one long list|stacks \d+ fields in one column \(maxColumns: 1\); use maxColumns: 2 or split it into labeled groups)$/,
61
74
  /\.sections\[\d+\](?: \("[\s\S]*"\))?: right-panel section shares displayOrder -?\d+ with main-area [\s\S]+; the platform reads sections back by displayOrder, so plan replaces this layout on every run\. Give each section its own displayOrder, counted across both panels$/,
75
+ // edk#3038: a viewer condition on a field of another type is built as written.
76
+ /dynamicLayouts\.[\s\S]+\.conditions\.[\s\S]+: currentUser(?:Groups)? compares a (?:user|group) field, but this field is [A-Z_]+; the condition will not match the viewer as intended$/,
77
+ // edk#3043: a single number or boolean on in / notIn is built as written.
78
+ /dynamicLayouts\.[\s\S]+\.conditions\.[\s\S]+: the record page reads only a string or a list as "one of", so (?:in|notIn) with a single (?:number|boolean) (?:never|always) matches; use (?:equals \(any of several equals for more values\)|notEquals \(all of several notEquals for more values\))$/,
79
+ // edk#3044: a condition value on a field with options that is not one of its labels is built as written.
80
+ /dynamicLayouts\.[\s\S]+\.conditions\.[\s\S]+: [\s\S]+ (?:is not an option|are not options) of this field; built as written, no record ever holds that value \(equals \/ in never match it; notEquals \/ notIn always do\)$/,
81
+ // edk#3044: contains / notContains with a list is built as written.
82
+ /dynamicLayouts\.[\s\S]+\.conditions\.[\s\S]+: the record page compares each option with the whole list, so (?:contains|notContains) with a list (?:never|always) matches; use (?:in|notIn)$/,
62
83
  /dynamicLayouts\.[\s\S]+\.components\.[\s\S]+: (?:(?:container|section|row|column|grid|card) has no children, so it renders empty; add components or remove it|(?:container|section|column|card) stacks \d+ fields in one column; put them in a grid \(columns: 2\) or split them into titled sections)$/,
63
84
  ];
64
85
  export function isAdvisoryDiagnostic(message) {
@@ -16,7 +16,7 @@ export interface ImportedResourceRef {
16
16
  readonly attrs: Readonly<Record<string, TfValue>>;
17
17
  }
18
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"];
19
+ export declare const OMITTED_AUTOMATION_KINDS: readonly ["unrepresentable", "disabled", "no-draft", "empty-draft", "unadoptable"];
20
20
  export type OmittedAutomationKind = (typeof OMITTED_AUTOMATION_KINDS)[number];
21
21
  /** Extraction context: stream lookups + the diagnostics sink. */
22
22
  /** An automation the export left out, as omitted-automations.json names it. */
@@ -92,6 +92,14 @@ export interface FromTfContext {
92
92
  readonly foreignAppRefNamespaces?: ReadonlyMap<string, string>;
93
93
  readonly foreignElementRefNamespaces?: ReadonlyMap<string, string>;
94
94
  readonly foreignTaskRefNamespaces?: ReadonlyMap<string, string>;
95
+ /**
96
+ * Display name / namespace → refName of each task-type app the export lists
97
+ * only as a ref-only root: not in the workspace, so absent from the two
98
+ * maps above. A `data "elementum_task"` lookup carries only the display
99
+ * name, while its fields' ref-only identities carry this refName (edk#3146).
100
+ */
101
+ readonly refOnlyTaskRefNames?: ReadonlyMap<string, string>;
102
+ readonly refOnlyTaskRefNamespaces?: ReadonlyMap<string, string>;
95
103
  /**
96
104
  * The identity a reference to the stream root itself is authored as, for a
97
105
  * stream without import ids (clone's `--no-imports` export, edk#1437): a
@@ -139,6 +147,13 @@ export interface FromTfContext {
139
147
  }>;
140
148
  /** Lower-cased field display name -> typed field key for each on-disk app/element catalog. */
141
149
  readonly fieldNamesByOwnerRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>;
150
+ /**
151
+ * Lower-cased display name -> `title`/`id` for each app or element whose
152
+ * Title or ID field is renamed (#3145). Neither has a field block, so
153
+ * {@link fieldNamesByOwnerRefName} can't name it; another root's export
154
+ * still looks it up by display name.
155
+ */
156
+ readonly renamedSystemFieldKeysByOwnerRefName?: ReadonlyMap<string, ReadonlyMap<string, "title" | "id">>;
142
157
  /**
143
158
  * Procedure discriminator (CloudLink + name + database + schema + ordered
144
159
  * parameter types, via `procedureDiscriminator` in `pull/procedure-refs.ts`)
@@ -170,6 +185,25 @@ export interface FromTfContext {
170
185
  * empty id warns.
171
186
  */
172
187
  readonly omittedAutomationsById?: ReadonlyMap<string, OmittedAutomationIdentity>;
188
+ /**
189
+ * The catalog keys of the automations in each app's and element's source in
190
+ * this workspace, by `<kind>:<refName>` (#3064): what its folder holds, or, for a
191
+ * root this pull writes, what the pull writes. A ref-only catalog stub is
192
+ * not listed. Another root's automation that the export names, but whose
193
+ * owner is listed without its key (the owner's pull skipped it), prints as
194
+ * `automationRef({ refName, name, parent })`, which build looks up by that
195
+ * name, instead of a `catalog.<owner>.automations.<key>` entry the owner's
196
+ * catalog doesn't have.
197
+ */
198
+ readonly workspaceAutomationKeys?: ReadonlyMap<string, ReadonlySet<string>>;
199
+ /**
200
+ * Own-file children whose printed source failed to load before adoption
201
+ * (#3112), by kind, then ref name -> the load error. Their extractor leaves
202
+ * them out of the pull and releases them, so nothing is imported for source
203
+ * that no plan can load. A kind's extractor that does not read this keeps
204
+ * its children.
205
+ */
206
+ readonly unloadableOwnFiles?: ReadonlyMap<EntityKindId, ReadonlyMap<string, string>>;
173
207
  /**
174
208
  * Ids of the access policies the export matched to the one the platform
175
209
  * adds for an app's creator (platform-creator-policies.json, edk#2156).
@@ -250,6 +284,12 @@ export interface FromTfContext {
250
284
  */
251
285
  readonly requiresExtracted?: ExtractRequirement[];
252
286
  }
287
+ /**
288
+ * The consequence sentence for a skipped resource printed as its own file:
289
+ * its file from an earlier pull is archived once adoption releases it
290
+ * (`quarantineOwnFiles` with `afterRelease`), so the user can find it.
291
+ */
292
+ export declare function ownFileArchiveConsequence(kind: string, refName: string): string;
253
293
  /** See {@link FromTfContext.requiresExtracted}. */
254
294
  export interface ExtractRequirement {
255
295
  /** Address (`type.label`) of the dependent resource. */
@@ -273,6 +313,22 @@ export interface ExtractRequirement {
273
313
  readonly kind: EntityKindId;
274
314
  readonly refName: string;
275
315
  };
316
+ /**
317
+ * The dependent lists `requires` as one entry of its `attribute` list (a
318
+ * dashboard's widget order lists its widgets in `widget_ids`). When
319
+ * `requires` is left out, the dependent stays without that entry instead of
320
+ * being skipped: adoption drops the entry from the export's block and
321
+ * imports the dependent with the id `trackedWithout(the entries left out)`
322
+ * gives, which tracks the ids it lists. Undefined from it, when no entry is
323
+ * left, skips the dependent as usual.
324
+ */
325
+ readonly listEntry?: {
326
+ readonly attribute: string;
327
+ readonly trackedWithout: (leftOut: ReadonlySet<string>) => {
328
+ readonly importId: string;
329
+ readonly keptIds: readonly string[];
330
+ } | undefined;
331
+ };
276
332
  /** The stream root without the dependent resource. */
277
333
  readonly prune: (root: {
278
334
  readonly refName: string;
@@ -7,7 +7,15 @@
7
7
  import { EntityTfError } from "../entity.js";
8
8
  import { isTfExpr, tfLabelToTsLabel } from "../tf/index.js";
9
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"];
10
+ export const OMITTED_AUTOMATION_KINDS = ["unrepresentable", "disabled", "no-draft", "empty-draft", "unadoptable"];
11
+ /**
12
+ * The consequence sentence for a skipped resource printed as its own file:
13
+ * its file from an earlier pull is archived once adoption releases it
14
+ * (`quarantineOwnFiles` with `afterRelease`), so the user can find it.
15
+ */
16
+ export function ownFileArchiveConsequence(kind, refName) {
17
+ return `. Its file from an earlier pull (${kind} ${refName}), if any, is moved to .edk-state/pull-backups once adoption releases it; with --no-adopt, or if adoption fails first, that file stays until a pull that adopts`;
18
+ }
11
19
  /** The pull-abort (or, for `clone app`, clone-abort) message for one or more authoring blockers. */
12
20
  export function authoringBlockedMessage(blockers, command = "pull") {
13
21
  const remedies = [...new Set(blockers.map((blocker) => blocker.remedy))];
@@ -10,7 +10,14 @@ interface PulledSource {
10
10
  * whole-workspace builds that see the file unchanged.
11
11
  */
12
12
  readonly compared?: Readonly<Record<string, string>>;
13
+ /**
14
+ * The pull wrote this source without adopting it (`--no-adopt`, or `--portable`, which never adopts), so
15
+ * state doesn't manage the live object (edk#3061). Absent when the pull adopted.
16
+ */
17
+ readonly adoptionSkipped?: AdoptionSkippedBy;
13
18
  }
19
+ /** The pull flag that left a root unadopted. */
20
+ export type AdoptionSkippedBy = "--no-adopt" | "--portable";
14
21
  interface PulledAge {
15
22
  readonly pulledAt: string;
16
23
  readonly pullRun?: string;
@@ -41,10 +48,12 @@ export type PulledSourceStatus = {
41
48
  /**
42
49
  * Record that `elementum pull <kind> <refName>` just wrote this root's own file. With `source`, also record
43
50
  * what it wrote. `markPulled: false` records only the source, for a file a pull writes as a dependency without
44
- * that counting as pulling the root.
51
+ * that counting as pulling the root. `adoptionSkipped` names the flag when the pull wrote the source without
52
+ * adopting it (edk#3061).
45
53
  */
46
54
  export declare function recordPulledRoot(orgRoot: string, kind: string, refName: string, source?: string, options?: {
47
55
  readonly markPulled?: boolean;
56
+ readonly adoptionSkipped?: AdoptionSkippedBy;
48
57
  }): Promise<void>;
49
58
  /** One root's pull record, as {@link readPulledRootRecord} reads it and {@link restorePulledRootRecord} puts it back. */
50
59
  export interface PulledRootRecord {
@@ -56,10 +65,14 @@ export interface PulledRootRecord {
56
65
  * adoption can restore the record too (edk#2628). `undefined` when the record can't be read.
57
66
  */
58
67
  export declare function readPulledRootRecord(orgRoot: string, kind: string, refName: string): Promise<PulledRootRecord | undefined>;
68
+ /** The record without its `adoptionSkipped` mark, for a root whose latest pull tried to adopt (edk#3061). */
69
+ export declare function withoutAdoptionSkipped(record: PulledRootRecord): PulledRootRecord;
59
70
  /** Put back a record {@link readPulledRootRecord} read. */
60
71
  export declare function restorePulledRootRecord(orgRoot: string, kind: string, refName: string, record: PulledRootRecord): Promise<void>;
61
72
  /** Was this root's own file actually written by a real pull, not just cloned/hand-authored? */
62
73
  export declare function wasRootPulled(orgRoot: string, kind: string, refName: string): Promise<boolean>;
74
+ /** The flag that kept this root's last pull from adopting it, or `undefined` when it adopted or isn't recorded (edk#3061). */
75
+ export declare function pulledRootAdoptionSkipped(orgRoot: string, kind: string, refName: string): Promise<AdoptionSkippedBy | undefined>;
63
76
  export interface PulledSourceInput {
64
77
  readonly kind: string;
65
78
  readonly refName: string;
@@ -40,6 +40,7 @@ function isPulledSource(value) {
40
40
  const source = value;
41
41
  return typeof source?.sha256 === "string" && typeof source.pulledAt === "string" &&
42
42
  (source.pullRun === undefined || typeof source.pullRun === "string") &&
43
+ (source.adoptionSkipped === undefined || source.adoptionSkipped === "--no-adopt" || source.adoptionSkipped === "--portable") &&
43
44
  (source.compared === undefined || (typeof source.compared === "object" && source.compared !== null &&
44
45
  Object.values(source.compared).every((hash) => typeof hash === "string")));
45
46
  }
@@ -85,15 +86,22 @@ function serialized(update) {
85
86
  /**
86
87
  * Record that `elementum pull <kind> <refName>` just wrote this root's own file. With `source`, also record
87
88
  * what it wrote. `markPulled: false` records only the source, for a file a pull writes as a dependency without
88
- * that counting as pulling the root.
89
+ * that counting as pulling the root. `adoptionSkipped` names the flag when the pull wrote the source without
90
+ * adopting it (edk#3061).
89
91
  */
90
92
  export function recordPulledRoot(orgRoot, kind, refName, source, options = {}) {
91
93
  return serialized(async () => {
92
94
  const { entries, sources } = await readManifest(orgRoot);
93
95
  if (options.markPulled !== false)
94
96
  entries.add(key(kind, refName));
95
- if (source !== undefined)
96
- sources.set(key(kind, refName), { sha256: sha256(source), pulledAt: new Date().toISOString(), pullRun: PULL_RUN });
97
+ if (source !== undefined) {
98
+ sources.set(key(kind, refName), {
99
+ sha256: sha256(source),
100
+ pulledAt: new Date().toISOString(),
101
+ pullRun: PULL_RUN,
102
+ ...(options.adoptionSkipped !== undefined && { adoptionSkipped: options.adoptionSkipped }),
103
+ });
104
+ }
97
105
  await writeManifest(orgRoot, entries, sources);
98
106
  });
99
107
  }
@@ -109,6 +117,13 @@ export async function readPulledRootRecord(orgRoot, kind, refName) {
109
117
  const source = sources.get(key(kind, refName));
110
118
  return { pulled: entries.has(key(kind, refName)), ...(source !== undefined && { source }) };
111
119
  }
120
+ /** The record without its `adoptionSkipped` mark, for a root whose latest pull tried to adopt (edk#3061). */
121
+ export function withoutAdoptionSkipped(record) {
122
+ if (record.source?.adoptionSkipped === undefined)
123
+ return record;
124
+ const { adoptionSkipped: _dropped, ...source } = record.source;
125
+ return { ...record, source };
126
+ }
112
127
  /** Put back a record {@link readPulledRootRecord} read. */
113
128
  export function restorePulledRootRecord(orgRoot, kind, refName, record) {
114
129
  return serialized(async () => {
@@ -129,6 +144,11 @@ export async function wasRootPulled(orgRoot, kind, refName) {
129
144
  const { entries } = await readManifest(orgRoot);
130
145
  return entries.has(key(kind, refName));
131
146
  }
147
+ /** The flag that kept this root's last pull from adopting it, or `undefined` when it adopted or isn't recorded (edk#3061). */
148
+ export async function pulledRootAdoptionSkipped(orgRoot, kind, refName) {
149
+ const { sources } = await readManifest(orgRoot);
150
+ return sources.get(key(kind, refName))?.adoptionSkipped;
151
+ }
132
152
  function rootWide(status) {
133
153
  return { group: () => status };
134
154
  }
@@ -33,10 +33,15 @@ export interface DirectReferenceRoot {
33
33
  readonly refName: string;
34
34
  readonly name: string;
35
35
  }[];
36
- /** The owner's AI search tables, keyed as the owner's own export keys them. */
36
+ /**
37
+ * The owner's AI search tables, keyed as the owner's own export keys them, under the
38
+ * name their data source looks them up by (an unnamed table's display name), with
39
+ * their platform id when the export gives one (edk#2880).
40
+ */
37
41
  readonly searchTables?: readonly {
38
42
  readonly refName: string;
39
43
  readonly name: string;
44
+ readonly id?: string;
40
45
  }[];
41
46
  }
42
47
  export type UnresolvedReference = UnresolvedReferenceDiagnostic;
@@ -154,7 +154,10 @@ function parseRoot(payload) {
154
154
  : [{ refName: tfLabelToTsLabel(itemRefName), name: itemName }];
155
155
  });
156
156
  const skills = namedItems(obj.skills);
157
- const searchTables = namedItems(obj.searchTables);
157
+ const searchTables = (Array.isArray(obj.searchTables) ? obj.searchTables : []).flatMap((rawItem) => {
158
+ const id = stringAt(record(rawItem) ?? {}, "id");
159
+ return namedItems([rawItem]).map((item) => (id !== undefined ? { ...item, id } : item));
160
+ });
158
161
  return {
159
162
  root: {
160
163
  kind,
@@ -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, type UnmanagedLookup } from "../../graph/index.js";
15
+ import { type EntityKindId, type AdoptionAddressAlias, type SkippedOwnFileReport, type TriggerReferenceRepair, type UnmanagedLookup, type TrimmedList } 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";
@@ -57,6 +57,16 @@ export interface StreamRootExtract {
57
57
  readonly adoptionAddressAliases: readonly AdoptionAddressAlias[];
58
58
  /** Lookups adoption declares for references to skipped resources (see {@link UnmanagedLookup}). */
59
59
  readonly unmanagedLookups?: readonly UnmanagedLookup[];
60
+ /** Resources kept without some list entries this pull left out (see `ExtractRequirement.listEntry`). */
61
+ readonly trimmedLists?: readonly TrimmedList[];
62
+ /** Export addresses adoption re-imports when already in state (see `OwnFileExtractResult.reimportForLive`). */
63
+ readonly reimportForLive?: readonly string[];
64
+ /** Each skipped own-file child, by kind, for the pull summary (#3053). */
65
+ readonly skippedReports?: readonly (SkippedOwnFileReport & {
66
+ readonly kind: EntityKindId;
67
+ })[];
68
+ /** References in the pulled source that the first plan rewrites, for the pull summary (#3109). */
69
+ readonly triggerReferenceRepairs?: readonly TriggerReferenceRepair[];
60
70
  /**
61
71
  * Resource address → the addresses it `depends_on` (e.g. a workflow_publish
62
72
  * depending on its automation's tasks). `tofu plan -target=X` implicitly
@@ -136,6 +146,8 @@ export interface StreamRootExtractOptions {
136
146
  readonly foreignFileReaderRefsById?: FromTfContext["foreignFileReaderRefsById"];
137
147
  readonly picklistOptionsByField?: ReadonlyMap<string, ReadonlyMap<string, string>>;
138
148
  readonly fieldNamesByOwnerRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>;
149
+ /** See `FromTfContext.renamedSystemFieldKeysByOwnerRefName` (#3145). */
150
+ readonly renamedSystemFieldKeysByOwnerRefName?: FromTfContext["renamedSystemFieldKeysByOwnerRefName"];
139
151
  readonly procedureKeysByDiscriminator?: ReadonlyMap<string, string>;
140
152
  /** See `FromTfContext.groupKeysByName`. */
141
153
  readonly groupKeysByName?: ReadonlyMap<string, string>;
@@ -143,8 +155,12 @@ export interface StreamRootExtractOptions {
143
155
  readonly serviceAccountsById?: FromTfContext["serviceAccountsById"];
144
156
  /** See `FromTfContext.omittedAutomationsById`. */
145
157
  readonly omittedAutomationsById?: FromTfContext["omittedAutomationsById"];
158
+ /** See `FromTfContext.workspaceAutomationKeys`. */
159
+ readonly workspaceAutomationKeys?: FromTfContext["workspaceAutomationKeys"];
146
160
  /** See `FromTfContext.platformCreatorPolicyIds`. */
147
161
  readonly platformCreatorPolicyIds?: FromTfContext["platformCreatorPolicyIds"];
162
+ /** See `FromTfContext.unloadableOwnFiles`. */
163
+ readonly unloadableOwnFiles?: FromTfContext["unloadableOwnFiles"];
148
164
  /**
149
165
  * Whether an authored own-file for a child this pull skipped stays on disk,
150
166
  * so build still emits it (#1731 SF3). `root` is the extracted stream root.