@elementumai/edk 0.10.1 → 0.10.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.
Files changed (125) hide show
  1. package/README.md +7 -7
  2. package/dist-sdk/src/catalog/org.d.ts +7 -5
  3. package/dist-sdk/src/catalog/org.js +14 -9
  4. package/dist-sdk/src/catalog/token.js +4 -0
  5. package/dist-sdk/src/core/types/app.d.ts +22 -0
  6. package/dist-sdk/src/engine/build/context.d.ts +8 -0
  7. package/dist-sdk/src/engine/build/source-context.d.ts +3 -4
  8. package/dist-sdk/src/engine/coverage-gaps.d.ts +2 -0
  9. package/dist-sdk/src/engine/coverage-gaps.js +3 -0
  10. package/dist-sdk/src/engine/ei/state.d.ts +48 -0
  11. package/dist-sdk/src/engine/ei/state.js +91 -0
  12. package/dist-sdk/src/engine/pull/authored-address.d.ts +100 -0
  13. package/dist-sdk/src/engine/pull/authored-address.js +360 -0
  14. package/dist-sdk/src/engine/pull/context.d.ts +59 -0
  15. package/dist-sdk/src/engine/tf/expr.d.ts +7 -0
  16. package/dist-sdk/src/engine/tf/expr.js +62 -18
  17. package/dist-sdk/src/engine/tf/index.d.ts +1 -1
  18. package/dist-sdk/src/engine/tf/index.js +1 -1
  19. package/dist-sdk/src/engine/tf/labels.d.ts +10 -2
  20. package/dist-sdk/src/engine/tf/labels.js +15 -2
  21. package/dist-sdk/src/engine/tf/parse.js +19 -6
  22. package/dist-sdk/src/engine/workspace/backend.d.ts +34 -0
  23. package/dist-sdk/src/engine/workspace/backend.js +104 -0
  24. package/dist-sdk/src/engine/workspace/generated-file.d.ts +3 -0
  25. package/dist-sdk/src/engine/workspace/generated-file.js +6 -0
  26. package/dist-sdk/src/engine/workspace/loader.js +2 -2
  27. package/dist-sdk/src/entities/agent-tool/to-tf.js +1 -1
  28. package/dist-sdk/src/entities/app/build.d.ts +36 -4
  29. package/dist-sdk/src/entities/app/build.js +67 -4
  30. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +12 -0
  31. package/dist-sdk/src/entities/app/from-tf.js +13 -9
  32. package/dist-sdk/src/entities/app/module.js +3 -1
  33. package/dist-sdk/src/entities/app/stage-keys.d.ts +82 -0
  34. package/dist-sdk/src/entities/app/stage-keys.js +160 -0
  35. package/dist-sdk/src/entities/app/to-tf.js +21 -21
  36. package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +9 -1
  37. package/dist-sdk/src/entities/approval-chain/from-tf.js +31 -3
  38. package/dist-sdk/src/entities/approval-chain/module.js +12 -4
  39. package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +1 -0
  40. package/dist-sdk/src/entities/approval-chain/to-tf.js +6 -1
  41. package/dist-sdk/src/entities/automation/build.d.ts +2 -0
  42. package/dist-sdk/src/entities/automation/build.js +25 -17
  43. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +3 -0
  44. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +5 -3
  45. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +127 -31
  46. package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -6
  47. package/dist-sdk/src/entities/automation/from-tf.js +172 -27
  48. package/dist-sdk/src/entities/automation/module.js +123 -37
  49. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +21 -0
  50. package/dist-sdk/src/entities/automation/output-key-wire-name.js +38 -0
  51. package/dist-sdk/src/entities/automation/to-tf.d.ts +3 -1
  52. package/dist-sdk/src/entities/automation/to-tf.js +191 -33
  53. package/dist-sdk/src/entities/automation/triggers.d.ts +2 -0
  54. package/dist-sdk/src/entities/automation/triggers.js +1 -0
  55. package/dist-sdk/src/entities/chart/from-tf.d.ts +6 -0
  56. package/dist-sdk/src/entities/chart/from-tf.js +9 -1
  57. package/dist-sdk/src/entities/dashboard/from-tf.js +51 -4
  58. package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +3 -0
  59. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +48 -4
  60. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +2 -0
  61. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +7 -2
  62. package/dist-sdk/src/entities/element/build.js +1 -1
  63. package/dist-sdk/src/entities/element/from-tf.d.ts +12 -6
  64. package/dist-sdk/src/entities/element/from-tf.js +23 -7
  65. package/dist-sdk/src/entities/element/module.js +5 -3
  66. package/dist-sdk/src/entities/element/to-tf.d.ts +3 -2
  67. package/dist-sdk/src/entities/element/to-tf.js +36 -25
  68. package/dist-sdk/src/entities/field/allow-list.d.ts +18 -0
  69. package/dist-sdk/src/entities/field/allow-list.js +42 -0
  70. package/dist-sdk/src/entities/field/build.d.ts +38 -3
  71. package/dist-sdk/src/entities/field/build.js +7 -2
  72. package/dist-sdk/src/entities/field/from-tf.js +252 -76
  73. package/dist-sdk/src/entities/field/module.d.ts +6 -0
  74. package/dist-sdk/src/entities/field/module.js +24 -2
  75. package/dist-sdk/src/entities/field/options.d.ts +2 -0
  76. package/dist-sdk/src/entities/field/order.d.ts +25 -0
  77. package/dist-sdk/src/entities/field/order.js +74 -0
  78. package/dist-sdk/src/entities/field/to-tf.d.ts +6 -0
  79. package/dist-sdk/src/entities/field/to-tf.js +87 -0
  80. package/dist-sdk/src/entities/field/types.d.ts +5 -0
  81. package/dist-sdk/src/entities/field/types.js +8 -0
  82. package/dist-sdk/src/entities/relationship/build.d.ts +3 -3
  83. package/dist-sdk/src/entities/relationship/from-tf.js +4 -2
  84. package/dist-sdk/src/entities/relationship/to-tf.js +3 -1
  85. package/dist-sdk/src/entities/service-account/workspace-owner.d.ts +8 -3
  86. package/dist-sdk/src/entities/service-account/workspace-owner.js +12 -4
  87. package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +5 -0
  88. package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +13 -0
  89. package/dist-sdk/src/entities/shared/filters/ast.d.ts +7 -0
  90. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +1 -1
  91. package/dist-sdk/src/entities/skill/to-tf.js +19 -14
  92. package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
  93. package/dist-sdk/src/entities/skill-tool/from-tf.js +3 -0
  94. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +6 -1
  95. package/dist-sdk/src/entities/skill-tool/to-tf.js +6 -1
  96. package/dist-sdk/src/entities/task/build.js +1 -1
  97. package/dist-sdk/src/entities/task/module.js +2 -1
  98. package/dist-sdk/src/entities/task/to-tf.js +4 -0
  99. package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +11 -0
  100. package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +13 -38
  101. package/dist-sdk/src/entities/view/custom-view-validate.d.ts +29 -0
  102. package/dist-sdk/src/entities/view/custom-view-validate.js +292 -0
  103. package/dist-sdk/src/entities/view/from-tf.d.ts +2 -0
  104. package/dist-sdk/src/entities/view/from-tf.js +40 -6
  105. package/dist-sdk/src/entities/view/module.js +4 -1
  106. package/dist-sdk/src/entities/view/to-tf.d.ts +6 -0
  107. package/dist-sdk/src/entities/view/to-tf.js +25 -9
  108. package/dist-sdk/src/entities/view/types.d.ts +6 -0
  109. package/dist-sdk/src/entities/view/types.js +6 -0
  110. package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +2 -1
  111. package/dist-sdk/src/entities/visual-flow/from-tf.js +11 -2
  112. package/dist-sdk/src/entities/visual-flow/module.js +15 -5
  113. package/dist-sdk/src/entities/visual-flow/to-tf.d.ts +2 -0
  114. package/dist-sdk/src/entities/visual-flow/to-tf.js +1 -1
  115. package/dist-sdk/src/entities/widget/build.d.ts +8 -1
  116. package/dist-sdk/src/entities/widget/from-tf.js +12 -6
  117. package/dist-sdk/src/entities/widget/to-tf.d.ts +1 -0
  118. package/dist-sdk/src/entities/widget/to-tf.js +16 -0
  119. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +8 -2
  120. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
  121. package/dist-sdk/src/graph/index.d.ts +9 -2
  122. package/dist-sdk/src/graph/index.js +4 -0
  123. package/dist-sdk/src/graph/modules.js +2 -1
  124. package/dist-sdk/src/graph/types.d.ts +72 -3
  125. package/package.json +2 -17
@@ -611,6 +611,7 @@ export function fieldToTf(typeKey, inner, opts) {
611
611
  if (inner.tags !== undefined && inner.tags.length > 0) {
612
612
  attrs["field_role"] = [...inner.tags];
613
613
  }
614
+ allowListToTf(subType.typeKey, inner, opts, attrs, name);
614
615
  if (inner.mediaTypes !== undefined) {
615
616
  if (subType.typeKey !== "attachment") {
616
617
  diagnostics.push(`field "${name}": mediaTypes is only valid on attachment fields; dropped`);
@@ -714,6 +715,92 @@ export function fieldToTf(typeKey, inner, opts) {
714
715
  const block = { kind: "resource", type: subType.resourceType, label: tfLabel, attrs };
715
716
  return { block, bagKey, address: `${subType.resourceType}.${tfLabel}` };
716
717
  }
718
+ /**
719
+ * Group/user field pick-list restrictions (edk#1776) → `allowed_group_ids`,
720
+ * `allowed_user_ids`, `parent_group_field_id`. Fail closed: a principal that
721
+ * does not resolve throws instead of being dropped, since dropping one entry
722
+ * would broaden who can be picked. `[]` and a null parent are emitted as the
723
+ * provider's explicit clear values (`[]` / `""`); an unset option emits
724
+ * nothing, and the provider rejects that plan when the live field still has
725
+ * a restriction.
726
+ */
727
+ function allowListToTf(typeKey, inner, opts, attrs, name) {
728
+ const where = `field "${name}"`;
729
+ const groupOrUser = typeKey === "group" || typeKey === "user";
730
+ if (!groupOrUser) {
731
+ if (inner.allowedGroups !== undefined || inner.allowedUsers !== undefined || inner.parentGroupField !== undefined) {
732
+ throw new EntityTfError(`${where}: allowedGroups, allowedUsers and parentGroupField are only valid on group and user fields`);
733
+ }
734
+ return;
735
+ }
736
+ if (typeKey === "group" && (inner.allowedUsers !== undefined || inner.parentGroupField !== undefined)) {
737
+ throw new EntityTfError(`${where}: allowedUsers and parentGroupField are only valid on user fields`);
738
+ }
739
+ if (inner.allowedGroups !== undefined) {
740
+ if (!Array.isArray(inner.allowedGroups))
741
+ throw new EntityTfError(`${where}: allowedGroups must be a list of org.groups references`);
742
+ if (inner.allowedGroups.length > 0 && opts.orgRefs === undefined) {
743
+ throw new EntityTfError(`${where}: allowedGroups needs org context to resolve org.groups references`);
744
+ }
745
+ const seen = new Set();
746
+ attrs["allowed_group_ids"] = inner.allowedGroups.flatMap((entry) => {
747
+ const token = entry;
748
+ if (token === null || typeof token !== "object" || token.__kind !== "group" || typeof token.refName !== "string" || token.refName === "") {
749
+ throw new EntityTfError(`${where}: allowedGroups requires org.groups references; raw ids and other principals are unsupported`);
750
+ }
751
+ if (seen.has(token.refName))
752
+ return [];
753
+ seen.add(token.refName);
754
+ const resolved = opts.orgRefs.byTsLabel("groups", token.refName);
755
+ if (resolved === undefined)
756
+ throw new EntityTfError(`${where}: allowedGroups group ${JSON.stringify(token.refName)} is not in org.ts; run \`elementum pull org --data-only\``);
757
+ return [resolved.managed
758
+ ? expr.resourceAttr("elementum_group", resolved.tfLabel, ["id"])
759
+ : expr.dataAttr("elementum_group", resolved.tfLabel, ["id"])];
760
+ });
761
+ }
762
+ if (inner.allowedUsers !== undefined) {
763
+ if (!Array.isArray(inner.allowedUsers))
764
+ throw new EntityTfError(`${where}: allowedUsers must be a list of userRef(email) references`);
765
+ if (inner.allowedUsers.length > 0 && opts.orgRefs === undefined) {
766
+ throw new EntityTfError(`${where}: allowedUsers needs org context to write user lookups`);
767
+ }
768
+ const seen = new Set();
769
+ attrs["allowed_user_ids"] = inner.allowedUsers.flatMap((entry) => {
770
+ const user = entry;
771
+ if (user === null || typeof user !== "object" || user.__kind !== "user" || typeof user.email !== "string" || !/^[^\s@]+@[^\s@]+$/.test(user.email)) {
772
+ throw new EntityTfError(`${where}: allowedUsers requires userRef(email); raw ids and other principals are unsupported`);
773
+ }
774
+ if (seen.has(user.email))
775
+ return [];
776
+ seen.add(user.email);
777
+ // The whole email names the lookup, as ei's export does, so two users
778
+ // sharing a local part never share one data address.
779
+ const label = sanitizeName(user.email);
780
+ if (label === "")
781
+ throw new EntityTfError(`${where}: allowedUsers email ${JSON.stringify(user.email)} has no usable lookup label`);
782
+ opts.orgRefs.rawLookup("elementum_user", label, user.email);
783
+ return [expr.dataAttr("elementum_user", label, ["id"])];
784
+ });
785
+ }
786
+ if (inner.parentGroupField !== undefined) {
787
+ if (inner.parentGroupField === null) {
788
+ attrs["parent_group_field_id"] = "";
789
+ return;
790
+ }
791
+ const token = inner.parentGroupField;
792
+ if (typeof token !== "object" || token.__kind !== "field" || (token.fieldType !== "GROUP" && token.fieldType !== "GROUP_ID")) {
793
+ throw new EntityTfError(`${where}: parentGroupField must reference a group field on the same app or element`);
794
+ }
795
+ if (token.parent !== undefined && token.parent !== opts.appRefName) {
796
+ throw new EntityTfError(`${where}: parentGroupField must belong to the same app or element, not ${JSON.stringify(token.parent)}`);
797
+ }
798
+ const value = fieldRefToTfValue(token.fieldType, token.refName ?? "", opts.ownerTfLabel, opts.scope ?? "app", opts.fieldOwnership);
799
+ if (value === undefined)
800
+ throw new EntityTfError(`${where}: parentGroupField ${JSON.stringify(token.refName ?? "")} does not resolve to a group field resource`);
801
+ attrs["parent_group_field_id"] = value;
802
+ }
803
+ }
717
804
  /**
718
805
  * Attachment `media_types`. An unset or empty list stays omitted so a field
719
806
  * without a restriction keeps its previous HCL. A value that is not
@@ -53,3 +53,8 @@ export declare const FIELD_RESOURCE_TYPES: readonly string[];
53
53
  export declare const KNOWN_FIELD_ATTRS: ReadonlySet<string>;
54
54
  /** Provider resource type a field constructor builds, or undefined for unmodeled constructors. */
55
55
  export declare function fieldResourceTypeForCtor(ctor: string): string | undefined;
56
+ /**
57
+ * The order of an app's, element's or task's custom fields: the default column
58
+ * order of its record tables (#1670). One per owner, keyed by the owner's id.
59
+ */
60
+ export declare const MANAGED_FIELD_ORDER_RESOURCE_TYPE = "elementum_managed_field_order";
@@ -76,6 +76,9 @@ export const KNOWN_FIELD_ATTRS = new Set([
76
76
  "include_type",
77
77
  "picklist_field_id",
78
78
  "media_types",
79
+ "allowed_group_ids",
80
+ "allowed_user_ids",
81
+ "parent_group_field_id",
79
82
  ]);
80
83
  /** Authoring constructor base name (`richText` for `richTextField`) → FIELD_SUB_TYPES typeKey. */
81
84
  const FIELD_CTOR_TYPE_KEYS = {
@@ -104,3 +107,8 @@ export function fieldResourceTypeForCtor(ctor) {
104
107
  const typeKey = FIELD_CTOR_TYPE_KEYS[ctor];
105
108
  return typeKey === undefined ? undefined : FIELD_SUB_TYPES.find((t) => t.typeKey === typeKey)?.resourceType;
106
109
  }
110
+ /**
111
+ * The order of an app's, element's or task's custom fields: the default column
112
+ * order of its record tables (#1670). One per owner, keyed by the owner's id.
113
+ */
114
+ export const MANAGED_FIELD_ORDER_RESOURCE_TYPE = "elementum_managed_field_order";
@@ -1,7 +1,7 @@
1
- import type { AppOrElementRef, FieldRef, RecordIdentityRef, TableColumnRef, TableRef } from "../../catalog/index.js";
1
+ import type { AppOrElementOrTaskRef, FieldRef, RecordIdentityRef, TableColumnRef, TableRef } from "../../catalog/index.js";
2
2
  import type { Filter } from "../shared/filters/types.js";
3
3
  import type { AppViewFieldRef } from "../app/build.js";
4
- export interface AppRelationshipColumn<Target extends AppOrElementRef | TableRef = AppOrElementRef | TableRef> {
4
+ export interface AppRelationshipColumn<Target extends AppOrElementOrTaskRef | TableRef = AppOrElementOrTaskRef | TableRef> {
5
5
  /**
6
6
  * Field on the owning app/element. System `"id"` is HANDLE (the record
7
7
  * handle), not the record UUID. AutoRelation create rejects HANDLE joined
@@ -26,7 +26,7 @@ export interface AppRelationshipColumn<Target extends AppOrElementRef | TableRef
26
26
  * A child `relationField` / `autoRelate` is an instance link, not a substitute
27
27
  * for a join owned here, and does not populate a parent `relatedRecords` widget.
28
28
  */
29
- export interface AppRelationship<Target extends AppOrElementRef | TableRef = AppOrElementRef | TableRef> {
29
+ export interface AppRelationship<Target extends AppOrElementOrTaskRef | TableRef = AppOrElementOrTaskRef | TableRef> {
30
30
  readonly target: Target;
31
31
  readonly columns: readonly AppRelationshipColumn<Target>[];
32
32
  /** Uses the same typed filter DSL as access policies. */
@@ -2,7 +2,7 @@ import { dataRefLabel, resourceRefLabel } from "../../engine/pull/context.js";
2
2
  import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel, } from "../../engine/tf/index.js";
3
3
  import { filterFromTf } from "../access-policy/from-tf.js";
4
4
  import { decodeForeignDataField, fieldKeyFromTfRef, fieldKeyFromTfValue } from "../field/from-tf.js";
5
- import { resolveDataAspectTarget } from "../shared/aspect-target-from-tf.js";
5
+ import { resolveDataAspectTarget, resolveDataTaskTarget } from "../shared/aspect-target-from-tf.js";
6
6
  import { SUB_TYPE_BY_RESOURCE } from "../field/types.js";
7
7
  import { RELATIONSHIP_RESOURCE_TYPE } from "./module.js";
8
8
  const KNOWN_ATTRS = new Set(["object_id", "related_object_id", "columns", "filter"]);
@@ -145,7 +145,9 @@ function targetRef(value, owner, ctx) {
145
145
  return { kind, key: tfLabelToTsLabel(resourceLabel), name: tfLabelToTsLabel(resourceLabel), tfLabel: resourceLabel, managed: true };
146
146
  const dataLabel = dataRefLabel(value, type);
147
147
  if (dataLabel !== undefined) {
148
- if (kind === "app" || kind === "element" || kind === "task") {
148
+ if (kind === "task")
149
+ return { kind, tfLabel: dataLabel, managed: false, ...resolveDataTaskTarget(ctx, dataLabel) };
150
+ if (kind === "app" || kind === "element") {
149
151
  return { kind, tfLabel: dataLabel, managed: false, ...resolveDataAspectTarget(ctx, kind, dataLabel) };
150
152
  }
151
153
  const name = ctx.dataName(type, dataLabel) ?? tfLabelToTsLabel(dataLabel);
@@ -189,9 +189,11 @@ function resolveRelatedField(value, target, where, opts) {
189
189
  opts.diagnostics.push(`${where}: field "${refName}" does not belong to target "${target.refName}"; dropped`);
190
190
  return undefined;
191
191
  }
192
+ // A task has no system-field locals, so only its custom fields resolve to
193
+ // their resources; its Title/ID/Status stay a lookup on the task.
192
194
  if (target.managed &&
193
195
  target.kind !== "table" &&
194
- target.kind !== "task" &&
196
+ (target.kind !== "task" || target.fieldOwnership?.has(refName) === true) &&
195
197
  target.tfLabel !== undefined) {
196
198
  const direct = fieldRefToTfValue(value?.fieldType ?? "", refName, target.tfLabel, target.kind, target.fieldOwnership);
197
199
  if (direct !== undefined)
@@ -1,4 +1,4 @@
1
- import { type WorkspaceAspect } from "../../engine/build/context.js";
1
+ import { type ForeignRootIdentity, type OrgRefLookup, type WorkspaceAspect } from "../../engine/build/context.js";
2
2
  import { type TfValue } from "../../engine/tf/index.js";
3
3
  import type { AppServiceAccount } from "./build.js";
4
4
  /** The app that owns a service account, as a role or policy on another object resolves it. */
@@ -11,6 +11,11 @@ export interface ServiceAccountOwningApp {
11
11
  * Resolve the workspace app that owns a `serviceAccountRef` named from a
12
12
  * different object (another app or an element), so its lookup is scoped to the
13
13
  * OWNING app (#1592), not the object that grants it access. A managed account
14
- * becomes a direct resource ref, so same-apply creation is sequenced.
14
+ * becomes a direct resource ref, so same-apply creation is sequenced. An app
15
+ * left out of a scoped build resolves through its `data.elementum_app` lookup,
16
+ * so the account becomes a `data.elementum_service_account` lookup (#1912).
15
17
  */
16
- export declare function workspaceServiceAccountAppResolver(workspaceAspects: ReadonlyMap<string, WorkspaceAspect> | undefined): (appRefName: string) => ServiceAccountOwningApp | undefined;
18
+ export declare function workspaceServiceAccountAppResolver(workspaceAspects: ReadonlyMap<string, WorkspaceAspect> | undefined, outOfScope?: {
19
+ readonly apps?: ReadonlyMap<string, ForeignRootIdentity>;
20
+ readonly orgRefs?: OrgRefLookup;
21
+ }): (appRefName: string) => ServiceAccountOwningApp | undefined;
@@ -1,17 +1,25 @@
1
1
  import { workspaceAspectKey } from "../../engine/build/context.js";
2
2
  import { expr } from "../../engine/tf/index.js";
3
3
  import { APP_RESOURCE_TYPE } from "../app/module.js";
4
+ import { resolveForeignRef } from "../shared/foreign-ref.js";
4
5
  /**
5
6
  * Resolve the workspace app that owns a `serviceAccountRef` named from a
6
7
  * different object (another app or an element), so its lookup is scoped to the
7
8
  * OWNING app (#1592), not the object that grants it access. A managed account
8
- * becomes a direct resource ref, so same-apply creation is sequenced.
9
+ * becomes a direct resource ref, so same-apply creation is sequenced. An app
10
+ * left out of a scoped build resolves through its `data.elementum_app` lookup,
11
+ * so the account becomes a `data.elementum_service_account` lookup (#1912).
9
12
  */
10
- export function workspaceServiceAccountAppResolver(workspaceAspects) {
13
+ export function workspaceServiceAccountAppResolver(workspaceAspects, outOfScope) {
11
14
  return (appRefName) => {
12
15
  const app = workspaceAspects?.get(workspaceAspectKey("app", appRefName));
13
- if (app === undefined)
14
- return undefined;
16
+ if (app === undefined) {
17
+ const identity = outOfScope?.apps?.get(appRefName);
18
+ if (identity === undefined || outOfScope?.orgRefs === undefined)
19
+ return undefined;
20
+ const foreign = resolveForeignRef("app", identity, outOfScope.orgRefs);
21
+ return { appTfLabel: foreign.tfLabel, appId: foreign.value };
22
+ }
15
23
  const serviceAccounts = app.streamRootEntity?.payload?.serviceAccounts;
16
24
  return {
17
25
  appTfLabel: app.tfLabel,
@@ -7,6 +7,11 @@ import type { FromTfContext } from "../../engine/pull/context.js";
7
7
  export declare function dataAspectDisplayName(ctx: FromTfContext, kind: "app" | "element" | "task", label: string): string | undefined;
8
8
  /** Resolve the stable pulled catalog key for the same foreign lookup. */
9
9
  export declare function dataAspectRefName(ctx: FromTfContext, kind: "app" | "element" | "task", label: string, displayName?: string): string | undefined;
10
+ /**
11
+ * Resolve a foreign task data lookup to the task on disk. ei names a task by
12
+ * display name (or namespace) only, so its label is just the fallback key.
13
+ */
14
+ export declare function resolveDataTaskTarget(ctx: FromTfContext, dataLabel: string): ResolvedAspectTarget;
10
15
  export interface ResolvedAspectTarget {
11
16
  readonly key: string;
12
17
  readonly name: string;
@@ -45,6 +45,19 @@ export function dataAspectRefName(ctx, kind, label, displayName) {
45
45
  // ElementResourceName), so the namespace alone gives the real refName before the target is pulled.
46
46
  return pulled ?? (namespace === undefined ? undefined : tfLabelToTsLabel(sanitizeName(namespace)));
47
47
  }
48
+ /**
49
+ * Resolve a foreign task data lookup to the task on disk. ei names a task by
50
+ * display name (or namespace) only, so its label is just the fallback key.
51
+ */
52
+ export function resolveDataTaskTarget(ctx, dataLabel) {
53
+ const attrs = ctx.dataAttrs?.("elementum_task", dataLabel);
54
+ const namespace = typeof attrs?.namespace === "string" ? attrs.namespace : undefined;
55
+ const name = ctx.dataName("elementum_task", dataLabel) ?? (typeof attrs?.name === "string" ? attrs.name : undefined);
56
+ const refName = (namespace !== undefined ? ctx.foreignTaskRefNamespaces?.get(namespace) : undefined)
57
+ ?? (name !== undefined ? ctx.foreignTaskRefNames?.get(name) : undefined);
58
+ const key = refName ?? tfLabelToTsLabel(dataLabel);
59
+ return { key, name: name ?? key, ...(namespace !== undefined ? { namespace } : {}), catalogRef: true };
60
+ }
48
61
  /**
49
62
  * Resolve a foreign app/element data lookup to the full identity a caller
50
63
  * needs to build its own ref shape: the real display name/refName when the
@@ -60,6 +60,13 @@ export interface FieldRefAst {
60
60
  */
61
61
  readonly foreign?: {
62
62
  readonly entityType: "app" | "element" | "task";
63
+ /**
64
+ * Set when `entityType` is only a placeholder: the field was resolved
65
+ * from a raw field id whose registry entry names the owner but not its
66
+ * kind. Printers must then resolve the owner against pulled apps AND
67
+ * elements instead of trusting `entityType`.
68
+ */
69
+ readonly ownerKindUnknown?: true;
63
70
  /** The owner's display name — resolves a same-name local catalog entry, same convention as `AppRefAst.name`. */
64
71
  readonly name: string;
65
72
  /** Stable namespace for a portable inline fieldRef owner lookup. */
@@ -227,7 +227,7 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
227
227
  // foreign-literal fallback used for an unresolved search table
228
228
  // elsewhere in this printer). refName is a best-effort guess
229
229
  // from the display name, not a verified catalog key.
230
- ` automation: { __kind: "automation", refName: ${quote(tfLabelToTsLabel(sanitizeName(tool.automationForeignName)))}, name: ${quote(tool.automationForeignName)}, parent: ${quote(tool.automationForeignParentRefName ?? tool.automationForeignParentName ?? "")}, parentName: ${quote(tool.automationForeignParentName ?? "")}, parentKind: ${quote(tool.automationForeignParentKind ?? "app")} } /* TODO: foreign automation reference - no catalog token available; verify the parent/refName before deploying */,`
230
+ ` automation: { __kind: "automation", refName: ${quote(tfLabelToTsLabel(sanitizeName(tool.automationForeignName)))}, name: ${quote(tool.automationForeignName)}, parent: ${quote(tool.automationForeignParentRefName ?? tool.automationForeignParentName ?? "")}, parentName: ${quote(tool.automationForeignParentName ?? "")}, parentKind: ${quote(tool.automationForeignParentKind ?? "app")}${tool.automationForeignParentNamespace !== undefined ? `, parentNamespace: ${quote(tool.automationForeignParentNamespace)}` : ""} } /* TODO: foreign automation reference - no catalog token available; verify the parent/refName before deploying */,`
231
231
  : ` automation: catalog.${appRefName}.automations${safeMember(tool.automationKey ?? "")},`);
232
232
  const inputs = tool.inputs ?? [];
233
233
  if (inputs.length > 0) {
@@ -15,6 +15,7 @@
15
15
  import { workspaceAspectKey } from "../../engine/build/context.js";
16
16
  import { EntityTfError } from "../../engine/entity.js";
17
17
  import { appScopedResourceLabel, expr, sanitizeName, tsLabelToTfLabel } from "../../engine/tf/index.js";
18
+ import { resolveForeignRef } from "../shared/foreign-ref.js";
18
19
  import { skillToolToTf } from "../skill-tool/to-tf.js";
19
20
  import { APP_RESOURCE_TYPE } from "../app/module.js";
20
21
  import { SERVICE_ACCOUNT_RESOURCE_TYPE } from "../service-account/module.js";
@@ -139,21 +140,25 @@ export function skillToTf(entity, ctx) {
139
140
  });
140
141
  return expr.dataAttr("elementum_search_table", label, ["id"]);
141
142
  },
142
- foreignAutomationRef: (tfLabel, parentKind, _parentRefName, parentName, automationName) => {
143
- // sanitizeName(parentName), not the refName: ei labels the export
144
- // from the owner's DISPLAY name, and sanitizeName doesn't split a
145
- // capital before a digit the way reversing a refName would need
146
- // (same lesson as #1095's table-owned search-table label fix).
147
- const parentType = parentKind === "element" ? "elementum_element" : "elementum_app";
148
- const parentLabel = sanitizeName(parentName);
149
- // ei labels a foreign automation data block `${lookup.Label}_${SanitizeName(name)}`
150
- // (imports.go), not the bare automation label - a bare label both
151
- // diverges from the pulled state (plan diff) and collides in
152
- // ctx.orgRefs.rawLookup's `${type}.${label}` registry key across apps.
153
- const automationLabel = `${parentLabel}_${tfLabel}`;
154
- ctx.orgRefs.rawLookup(parentType, parentLabel, parentName);
143
+ foreignAutomationRef: (tfLabel, owner, automationName) => {
144
+ // The owner app/element resolves through the kind graph's root
145
+ // lookup (by namespace), the same as the agent tool path, automation
146
+ // tasks and every other foreign reference to it. A display-name
147
+ // rawLookup here gave the shared data address a second identity and
148
+ // failed the build when anything else referenced that owner (#1722).
149
+ const ownerRef = resolveForeignRef(owner.kind, { name: owner.name, ...(owner.namespace !== undefined ? { namespace: owner.namespace } : {}) }, ctx.orgRefs, ctx.diagnostics, "skill run-automation owner");
150
+ // Owner-scoped label: the owner prefix is the graph root-lookup label
151
+ // (sanitized namespace; the name only as the compatibility fallback)
152
+ // and the suffix is the automation's tfLabel, the same address an
153
+ // automation task's foreign target uses. A bare automation label
154
+ // would collide in ctx.orgRefs.rawLookup's `${type}.${label}` registry
155
+ // key across owners. ei's export prefixes `lookup.Label`, which is
156
+ // SanitizeName(display name) (imports.go), so the address equals
157
+ // ei's only when the name and namespace sanitize alike; data-block
158
+ // labels don't affect plans.
159
+ const automationLabel = `${ownerRef.tfLabel}_${tfLabel}`;
155
160
  ctx.orgRefs.rawLookup("elementum_automation", automationLabel, automationName, {
156
- app_id: expr.dataAttr(parentType, parentLabel, ["id"]),
161
+ app_id: ownerRef.value,
157
162
  });
158
163
  return expr.dataAttr("elementum_automation", automationLabel, ["id"]);
159
164
  },
@@ -90,6 +90,8 @@ export interface NormalizedSkillTool {
90
90
  readonly automationForeignParentName?: string;
91
91
  /** Canonical catalog refName of the owning app/element, when known. */
92
92
  readonly automationForeignParentRefName?: string;
93
+ /** Namespace of the owning app/element, when the export looked it up by namespace. */
94
+ readonly automationForeignParentNamespace?: string;
93
95
  readonly automationForeignParentKind?: "app" | "element";
94
96
  readonly searchTableKey?: string;
95
97
  /** Foreign table lookup name when search_table_id is data.elementum_search_table. */
@@ -149,6 +149,7 @@ export function skillToolFromTf(block, owner, ctx) {
149
149
  let automationForeignName;
150
150
  let automationForeignParentName;
151
151
  let automationForeignParentRefName;
152
+ let automationForeignParentNamespace;
152
153
  let automationForeignParentKind;
153
154
  if (automationLabel === undefined &&
154
155
  automationRawId === undefined &&
@@ -173,6 +174,7 @@ export function skillToolFromTf(block, owner, ctx) {
173
174
  automationForeignName = automationName;
174
175
  automationForeignParentName = resolvedOwner.name;
175
176
  automationForeignParentRefName = resolvedOwner.key;
177
+ automationForeignParentNamespace = resolvedOwner.namespace;
176
178
  automationForeignParentKind = ownerKind;
177
179
  }
178
180
  if (automationLabel === undefined && automationRawId === undefined && automationForeignName === undefined) {
@@ -220,6 +222,7 @@ export function skillToolFromTf(block, owner, ctx) {
220
222
  automationForeignName,
221
223
  ...(automationForeignParentName !== undefined && { automationForeignParentName }),
222
224
  ...(automationForeignParentRefName !== undefined && { automationForeignParentRefName }),
225
+ ...(automationForeignParentNamespace !== undefined && { automationForeignParentNamespace }),
223
226
  ...(automationForeignParentKind !== undefined && { automationForeignParentKind }),
224
227
  }
225
228
  : { automationKey: scopedLabelToBagKey(owner.ownerTfLabel, automationLabel) }),
@@ -41,7 +41,12 @@ export interface SkillToolToTfContext {
41
41
  * skill/agent tool targeting an automation this workspace doesn't own),
42
42
  * returning the resolved `.id`. Live-confirmed on sanofi/eu (#1177).
43
43
  */
44
- foreignAutomationRef?(tfLabel: string, parentKind: "app" | "element", parentRefName: string, parentName: string, automationName: string): TfValue | void;
44
+ foreignAutomationRef?(tfLabel: string, owner: {
45
+ readonly kind: "app" | "element";
46
+ readonly refName: string;
47
+ readonly name: string;
48
+ readonly namespace?: string;
49
+ }, automationName: string): TfValue | void;
45
50
  /** Resolves a table-column token for a table-owned search tool. */
46
51
  tableColumnRef?(tableRefName: string, tableName: string, columnName: string): TfValue | void;
47
52
  /** App-local automations whose publish resource will be emitted in this build. */
@@ -229,7 +229,12 @@ export function skillToolToTf(entry, ctx) {
229
229
  if (ctx.foreignAutomationRef !== undefined &&
230
230
  typeof automation.parentName === "string" && automation.parentName !== "" &&
231
231
  typeof automation.name === "string" && automation.name !== "") {
232
- const lookup = ctx.foreignAutomationRef(automationTfLabel, automation.parentKind ?? "app", automation.parent, automation.parentName, automation.name);
232
+ const lookup = ctx.foreignAutomationRef(automationTfLabel, {
233
+ kind: automation.parentKind ?? "app",
234
+ refName: automation.parent,
235
+ name: automation.parentName,
236
+ ...(automation.parentNamespace !== undefined ? { namespace: automation.parentNamespace } : {}),
237
+ }, automation.name);
233
238
  if (lookup === undefined) {
234
239
  ctx.diagnostics.push(droppedSkillTool(where, "foreign automation lookup could not be materialized; dropped"));
235
240
  return undefined;
@@ -20,7 +20,7 @@ export function task(opts) {
20
20
  if (TASK_SYSTEM_FIELD_KEYS.has(key))
21
21
  throw new Error(`task ${JSON.stringify(opts.name)}: fields.${key} collides with the task's ${key} system field; use ${key}Field or another key.`);
22
22
  }
23
- const fields = authoredFields === undefined ? undefined : Object.entries(authoredFields).map(([bagKey, field]) => serializeField(field, bagKey));
23
+ const fields = authoredFields === undefined ? undefined : Object.entries(authoredFields).map(([bagKey, field]) => serializeField(field, bagKey, `task ${JSON.stringify(opts.name)}`));
24
24
  return { kind: "task", parent: "org", refName, payload: slimTokens({ ...rest, handle, namespace, ...(fields !== undefined && fields.length > 0 ? { fields } : {}) }), ...(opts.enabled !== undefined ? { enabled: opts.enabled } : {}) };
25
25
  } };
26
26
  }
@@ -1,9 +1,10 @@
1
+ import { inManagedFieldOrder } from "../field/order.js";
1
2
  import { NO_CATALOG } from "../../graph/types.js";
2
3
  import { taskFromTf } from "./from-tf.js";
3
4
  import { taskToTf } from "./to-tf.js";
4
5
  export const TASK_RESOURCE_TYPE = "elementum_task";
5
6
  function extract(stream, ctx) { const blocks = stream.byKind.get("task") ?? []; if (blocks.length !== 1)
6
- throw new Error(`expected exactly one ${TASK_RESOURCE_TYPE}, found ${blocks.length}`); return { instance: taskFromTf(blocks[0], ctx, stream.byKind.get("field") ?? []) }; }
7
+ throw new Error(`expected exactly one ${TASK_RESOURCE_TYPE}, found ${blocks.length}`); return { instance: taskFromTf(blocks[0], ctx, inManagedFieldOrder(stream.byKind.get("field") ?? [], stream.byKind.get("managed-field-order") ?? [])) }; }
7
8
  export const taskModule = {
8
9
  kind: "task", stream: { role: "streamRoot", exportVerb: "tasks" }, authoring: { unit: "ownFile", bag: "tasks" }, parents: [{ parent: "org", child: "task" }],
9
10
  resource: { shape: "single", resourceType: TASK_RESOURCE_TYPE, adoptable: true }, data: { participates: true, lookupAttr: "name", referencedByBuild: true, referenceLookups: [{ strategy: "rootNamespace", compatibilityFallback: "name" }] },
@@ -1,3 +1,4 @@
1
+ import { managedFieldOrderToTf } from "../field/order.js";
1
2
  import { authoredFieldKeysFromPayload, claimFieldDisplayName, fieldToTf } from "../field/to-tf.js";
2
3
  import { EntityTfError } from "../../engine/entity.js";
3
4
  import { expr } from "../../engine/tf/index.js";
@@ -73,5 +74,8 @@ export function taskToTf(entity, ctx) {
73
74
  blocks.push(field.block);
74
75
  fieldAddresses.set(field.bagKey, field.address);
75
76
  }
77
+ const fieldOrder = managedFieldOrderToTf(p.namespace, "task", objectId, fieldAddresses);
78
+ if (fieldOrder !== undefined)
79
+ blocks.push(fieldOrder);
76
80
  return { blocks, fieldAddresses };
77
81
  }
@@ -9,6 +9,7 @@
9
9
  */
10
10
  import type { OrgRefLookup, WorkspaceAspect } from "../../engine/build/context.js";
11
11
  import { type ChildResourceScope, type TfValue } from "../../engine/tf/index.js";
12
+ import type { BuildFieldMetadata } from "../../graph/types.js";
12
13
  export interface AgentViewLayoutToTfOptions {
13
14
  readonly ownerRefName: string;
14
15
  /** The view owner's kind; an agent view's owner is always an app. */
@@ -18,6 +19,10 @@ export interface AgentViewLayoutToTfOptions {
18
19
  readonly objectId: TfValue;
19
20
  readonly diagnostics: string[];
20
21
  readonly fieldAddresses?: ReadonlyMap<string, string>;
22
+ /** Field bag key → display name, for custom-view calc("Name") checks. */
23
+ readonly fieldNames?: ReadonlyMap<string, string>;
24
+ /** Field bag key → metadata (type, option labels, tags). */
25
+ readonly fieldMetadata?: ReadonlyMap<string, BuildFieldMetadata>;
21
26
  readonly orgRefs?: OrgRefLookup;
22
27
  readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
23
28
  /** Resolves an own-app field reference (view/to-tf's field resolver). */
@@ -46,6 +51,12 @@ export interface ViewBlocksToTfPolicy {
46
51
  * policy.
47
52
  */
48
53
  readonly editorPolicy: boolean;
54
+ /**
55
+ * Fail the build on structure / binding / reference problems the page cannot
56
+ * render (check.mjs Layer 1 + catalog Layer 3). Custom views set this; agent
57
+ * views keep soft diagnostics so a pulled broken welcome screen still builds.
58
+ */
59
+ readonly strictStructure?: boolean;
49
60
  }
50
61
  /** A blocks layout → its HCL value (wrap it in `jsonencode`). */
51
62
  export declare function viewBlocksToTf(spec: unknown, where: string, opts: AgentViewLayoutToTfOptions, policy: ViewBlocksToTfPolicy): TfValue;
@@ -6,6 +6,7 @@ import { SUB_TYPE_BY_TYPE_KEY } from "../field/types.js";
6
6
  import { foreignFieldDataLabel, resolveForeignRef } from "../shared/foreign-ref.js";
7
7
  import { SYSTEM_FIELD_ID_ATTR_BY_KEY } from "./types.js";
8
8
  import { AGENT_VIEW_SPEC_FILTER_PROPS, AGENT_VIEW_SPEC_ID_PROPS, agentViewFontFamily, } from "./agent-view-layout.js";
9
+ import { reportStructureProblems, validateCustomViewLayout } from "./custom-view-validate.js";
9
10
  const PLATFORM_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
10
11
  const HEX_COLOR = /^#[0-9a-fA-F]{3,8}$/;
11
12
  const FONT_FAMILIES = new Set(Object.values(agentViewFontFamily));
@@ -68,7 +69,16 @@ export function viewBlocksToTf(spec, where, opts, policy) {
68
69
  throw new EntityTfError(`${where}.root must name an element`);
69
70
  if (elements === undefined || Object.keys(elements).length === 0)
70
71
  throw new EntityTfError(`${where}.elements must have at least one element`);
71
- checkStructure(doc["root"], elements, where, opts.diagnostics);
72
+ if (policy.strictStructure) {
73
+ validateCustomViewLayout(doc, where, {
74
+ ...(opts.fieldNames !== undefined ? { fieldNames: opts.fieldNames } : {}),
75
+ ...(opts.fieldMetadata !== undefined ? { fieldMetadata: opts.fieldMetadata } : {}),
76
+ diagnostics: opts.diagnostics,
77
+ });
78
+ }
79
+ else {
80
+ checkStructure(doc["root"], elements, where, opts.diagnostics);
81
+ }
72
82
  const out = {};
73
83
  for (const [key, value] of Object.entries(doc)) {
74
84
  if (key === "elements")
@@ -282,43 +292,8 @@ function checkStructure(root, elements, where, diagnostics) {
282
292
  if (children !== undefined && !Array.isArray(children))
283
293
  throw new EntityTfError(`${where}.elements.${id}.children must be a list of element ids`);
284
294
  }
285
- // The platform stores these (its schema does not cross-check child ids), but
286
- // the page fails to render them. Warn rather than fail, so a pulled layout
287
- // still builds and round-trips; fixing it is the author's call.
288
- for (const [id, raw] of Object.entries(elements)) {
289
- const children = record(raw)?.["children"];
290
- if (record(raw)?.["repeat"] !== undefined && (!Array.isArray(children) || children.length === 0)) {
291
- diagnostics.push(`${where}.elements.${id}.repeat: a repeated element needs a child element as its template; the page will fail to render this custom view`);
292
- }
293
- if (!Array.isArray(children))
294
- continue;
295
- for (const child of children) {
296
- if (typeof child !== "string" || !(child in elements)) {
297
- diagnostics.push(`${where}.elements.${id}.children: "${String(child)}" is not an element; the page will fail to render this custom view`);
298
- }
299
- }
300
- }
301
- const state = new Map();
302
- let cycle;
303
- const visit = (id, path) => {
304
- if (cycle !== undefined || state.get(id) === "done")
305
- return;
306
- if (state.get(id) === "visiting") {
307
- cycle = [...path, id].join(" → ");
308
- return;
309
- }
310
- state.set(id, "visiting");
311
- const children = record(elements[id])?.["children"];
312
- if (Array.isArray(children))
313
- for (const child of children)
314
- if (typeof child === "string" && child in elements)
315
- visit(child, [...path, id]);
316
- state.set(id, "done");
317
- };
318
- for (const id of Object.keys(elements))
319
- visit(id, []);
320
- if (cycle !== undefined)
321
- diagnostics.push(`${where}: children form a cycle (${cycle}); the page will fail to render this custom view`);
295
+ // Agent views: warn so a pulled broken welcome screen still builds.
296
+ reportStructureProblems(root, elements, where, diagnostics);
322
297
  }
323
298
  function policyWarnings(type, element, where, diagnostics) {
324
299
  const reason = !UI_EDITABLE_BLOCKS.has(type)
@@ -0,0 +1,29 @@
1
+ /**
2
+ * check.mjs-parity structure checks for Custom managed views (#1771 / #1758).
3
+ * Hard structural failures (missing root/type, cycles, broken filters) fail the
4
+ * build as EntityTfError. Reachability and live-list selection gaps match
5
+ * check.mjs `warn` — they push to diagnostics so a pulled live layout still
6
+ * builds and plans clean (Blueprint Supplier Workspace has both). Agent views
7
+ * keep the softer diagnostics in checkStructure / reportStructureProblems.
8
+ *
9
+ * Layer 3 catalog checks (calc field names, option ids, tag helpers against
10
+ * the live App) need aspect-aware resolution; typed field refs already fail
11
+ * via resolveField. Syntax-only calc rules (AVG / empty COUNT) live here.
12
+ * TODO(#1784): consume fieldNames / fieldMetadata for Layer 3 + tag helpers.
13
+ */
14
+ import type { BuildFieldMetadata } from "../../graph/types.js";
15
+ export interface CustomViewValidateOptions {
16
+ /** TODO(#1784): aspect-aware Layer 3 once #1770 lands Preston custom views. */
17
+ readonly fieldNames?: ReadonlyMap<string, string>;
18
+ readonly fieldMetadata?: ReadonlyMap<string, BuildFieldMetadata>;
19
+ /** Build warnings (check.mjs `warn`); pushed, never thrown. */
20
+ readonly diagnostics?: string[];
21
+ }
22
+ /**
23
+ * Offline Layer 1 checks that Javier's check.mjs runs before paste.
24
+ * Call only for `customViews.*.layout` (strictStructure).
25
+ * Collects every problem, then throws once (parity with Go / check.mjs).
26
+ */
27
+ export declare function validateCustomViewLayout(spec: unknown, where: string, opts?: CustomViewValidateOptions): void;
28
+ /** Soft version used by agent views: same tree checks as today (diagnostics, not fatal). */
29
+ export declare function reportStructureProblems(_root: string, elements: Readonly<Record<string, unknown>>, where: string, diagnostics: string[]): void;