@elementumai/edk 0.13.2 → 0.13.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist-sdk/src/engine/coverage-gaps.d.ts +3 -0
  2. package/dist-sdk/src/engine/coverage-gaps.js +5 -0
  3. package/dist-sdk/src/engine/pull/context.d.ts +10 -4
  4. package/dist-sdk/src/engine/pull/context.js +2 -0
  5. package/dist-sdk/src/engine/pull/stream-root.d.ts +7 -1
  6. package/dist-sdk/src/engine/pull/stream-root.js +6 -0
  7. package/dist-sdk/src/engine/tf/index.d.ts +1 -0
  8. package/dist-sdk/src/engine/tf/index.js +1 -0
  9. package/dist-sdk/src/engine/tf/jsonencode.d.ts +19 -0
  10. package/dist-sdk/src/engine/tf/jsonencode.js +49 -0
  11. package/dist-sdk/src/entities/app/index.d.ts +1 -1
  12. package/dist-sdk/src/entities/automation/approval-trigger-refs.d.ts +20 -0
  13. package/dist-sdk/src/entities/automation/approval-trigger-refs.js +83 -0
  14. package/dist-sdk/src/entities/automation/build.js +1 -1
  15. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +15 -0
  16. package/dist-sdk/src/entities/automation/from-tf.d.ts +2 -0
  17. package/dist-sdk/src/entities/automation/from-tf.js +104 -14
  18. package/dist-sdk/src/entities/automation/index.d.ts +1 -1
  19. package/dist-sdk/src/entities/automation/lookup-owner.d.ts +23 -0
  20. package/dist-sdk/src/entities/automation/lookup-owner.js +27 -0
  21. package/dist-sdk/src/entities/automation/module.js +200 -20
  22. package/dist-sdk/src/entities/automation/omitted-ref.d.ts +12 -0
  23. package/dist-sdk/src/entities/automation/omitted-ref.js +21 -0
  24. package/dist-sdk/src/entities/automation/to-tf.js +170 -5
  25. package/dist-sdk/src/entities/automation/triggers.d.ts +47 -1
  26. package/dist-sdk/src/entities/automation/unsafe-script-output.d.ts +10 -5
  27. package/dist-sdk/src/entities/automation/unsafe-script-output.js +10 -5
  28. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +43 -18
  29. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +37 -21
  30. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +47 -5
  31. package/dist-sdk/src/entities/element/index.d.ts +1 -1
  32. package/dist-sdk/src/entities/shared/filters/ast.d.ts +6 -0
  33. package/dist-sdk/src/entities/shared/filters/index.d.ts +15 -3
  34. package/dist-sdk/src/entities/shared/filters/index.js +19 -1
  35. package/dist-sdk/src/entities/shared/filters/print.js +5 -0
  36. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +13 -0
  37. package/dist-sdk/src/entities/shared/filters/tf-codec.js +74 -1
  38. package/dist-sdk/src/entities/shared/filters/types.d.ts +8 -1
  39. package/dist-sdk/src/entities/widget/from-tf.js +8 -4
  40. package/dist-sdk/src/entities/widget/to-tf.js +2 -1
  41. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +4 -2
  42. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
  43. package/dist-sdk/src/graph/index.d.ts +1 -1
  44. package/dist-sdk/src/graph/types.d.ts +36 -0
  45. package/package.json +1 -1
@@ -3,6 +3,7 @@ import { resolveForeignRef } from "../shared/foreign-ref.js";
3
3
  import { expr, isCanonicalTsLabel, isTfExpr, isUuid, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
4
4
  import { filterToTf } from "../access-policy/to-tf.js";
5
5
  import { AUTOMATION_RESOURCE_TYPE, WORKFLOW_PUBLISH_RESOURCE_TYPE, automationResourceLabel } from "../automation/types.js";
6
+ import { automationLookupOwnerId } from "../automation/lookup-owner.js";
6
7
  import { isUnsafePlatformId } from "../../core/platform-id.js";
7
8
  import { droppedEntryGap, fieldRefToTfValue, UNRESOLVED_FIELD_REF } from "../field/to-tf.js";
8
9
  import { targetFilterFieldResolver } from "../relationship/to-tf.js";
@@ -541,14 +542,20 @@ function componentMap(components, layoutKey, layoutLabel, where, opts) {
541
542
  if (automation !== undefined)
542
543
  attrs["automation_button"] = button;
543
544
  }
544
- else if (key === "createButton") {
545
+ else if (key === "createButton" || key === "relateButton") {
545
546
  const rec = object(value);
546
547
  const button = snakeObject(rec, where, opts);
547
548
  delete button["target"];
548
- const target = resolveAspect(rec["target"], `${where}.components.${componentId}.createButton`, opts);
549
+ delete button["widget"];
550
+ const target = resolveAspect(rec["target"], `${where}.components.${componentId}.${key}`, opts);
549
551
  if (target !== undefined)
550
552
  button["target_aspect_id"] = target;
551
- attrs["create_button"] = button;
553
+ if (rec["widget"] !== undefined) {
554
+ const widget = resolveWidget(rec["widget"], `${where}.components.${componentId}.${key}.widget`, opts);
555
+ if (widget !== undefined)
556
+ button["widget_id"] = widget;
557
+ }
558
+ attrs[key === "createButton" ? "create_button" : "relate_button"] = button;
552
559
  }
553
560
  else if (key === "relatedItemsBlock") {
554
561
  attrs["related_items_block"] = relatedItemsBlock(object(value), `${where}.components.${componentId}.relatedItemsBlock`, opts);
@@ -652,8 +659,10 @@ function conditionMap(conditions, where, opts) {
652
659
  const field = resolveField(rec["field"], `${where}.conditions.${conditionId}.${key}`, opts);
653
660
  if (field !== undefined)
654
661
  comparison["field_id"] = field;
655
- if (rec["value"] !== undefined)
662
+ if (rec["value"] !== undefined) {
663
+ checkViewerValue(key, rec["value"], rec["field"], `${where}.conditions.${conditionId}.${key}`, opts);
656
664
  comparison["value"] = typedValue(rec["value"], rec["field"], opts);
665
+ }
657
666
  attrs[snakeKey(key)] = comparison;
658
667
  }
659
668
  else if (key === "stage") {
@@ -740,6 +749,39 @@ function resolveField(value, where, opts) {
740
749
  opts.diagnostics.push(`${where}: field "${refName}" has no Terraform mapping; dropped`);
741
750
  return resolved;
742
751
  }
752
+ /**
753
+ * The layout editor offers Current User only on a user field with equals /
754
+ * not equals, and Current User's Groups only on a group field with equals /
755
+ * not equals / in / not in (edk#3038). The provider rejects any other
756
+ * operator; a field of another type still applies but never matches as
757
+ * intended, so build says so.
758
+ */
759
+ const VIEWER_VALUE_RULES = {
760
+ currentUser: { operators: new Set(["equals", "notEquals"]), fieldTypes: new Set(["USER", "USER_ID"]), label: "a user field" },
761
+ currentUserGroups: { operators: new Set(["equals", "notEquals", "in", "notIn"]), fieldTypes: new Set(["GROUP", "GROUP_ID"]), label: "a group field" },
762
+ };
763
+ function checkViewerValue(operator, value, fieldValue, where, opts) {
764
+ const rec = object(value);
765
+ for (const [marker, rule] of Object.entries(VIEWER_VALUE_RULES)) {
766
+ // An undefined key is absent, as everywhere else in this file.
767
+ if (rec[marker] === undefined)
768
+ continue;
769
+ if (rec[marker] !== true) {
770
+ throw new EntityTfError(`${where}: ${marker} must be true`);
771
+ }
772
+ const others = Object.keys(rec).filter((key) => key !== marker && rec[key] !== undefined);
773
+ if (others.length > 0) {
774
+ throw new EntityTfError(`${where}: ${marker} is the whole value; remove ${others.join(", ")}`);
775
+ }
776
+ if (!rule.operators.has(operator)) {
777
+ throw new EntityTfError(`${where}: ${marker} can't be used with ${operator}; use ${[...rule.operators].join(", ")}`);
778
+ }
779
+ const fieldType = fieldValue?.fieldType;
780
+ if (fieldType !== undefined && !rule.fieldTypes.has(fieldType)) {
781
+ opts.diagnostics.push(`${where}: ${marker} compares ${rule.label}, but this field is ${fieldType}; the condition will not match the viewer as intended`);
782
+ }
783
+ }
784
+ }
743
785
  function typedValue(value, fieldValue, opts) {
744
786
  const rec = object(value);
745
787
  const token = fieldValue;
@@ -795,7 +837,7 @@ function resolveAutomation(token, where, opts) {
795
837
  const platformName = platformAutomationName(token, opts);
796
838
  if (platformName !== undefined) {
797
839
  const label = `${opts.ownerTfLabel}_${tsLabelToTfLabel(refName)}`;
798
- opts.orgRefs.rawLookup(AUTOMATION_RESOURCE_TYPE, label, platformName, { app_id: opts.objectId });
840
+ opts.orgRefs.rawLookup(AUTOMATION_RESOURCE_TYPE, label, platformName, { app_id: automationLookupOwnerId(scopeOf(opts), opts.ownerTfLabel, opts.orgRefs) });
799
841
  return expr.dataAttr(AUTOMATION_RESOURCE_TYPE, label, ["id"]);
800
842
  }
801
843
  return expr.resourceAttr(AUTOMATION_RESOURCE_TYPE, automationResourceLabel(opts.ownerTfLabel, refName, scopeOf(opts), scopeOf(opts) === "element" ? opts.ownerHandle : undefined), ["id"]);
@@ -11,7 +11,7 @@ export { type AppRecordCreateForm, type AppRecordCreateFormSection } from "../ap
11
11
  export { listViewDensity, managedViewSortAggregation, managedViewSortDirection, type ListViewDensity, type ManagedViewSort, type ManagedViewSortAggregation, type ManagedViewSortDirection, type ManagedViewSortField, type ManagedViewSortOrder, } from "../view/build.js";
12
12
  export { type AppRelationship, type AppRelationshipColumn } from "../relationship/build.js";
13
13
  export { runAutomationParameterValue, type RunAutomationParameterValue } from "../widget/build.js";
14
- export { type DynamicLayoutBlockCommon, type DynamicLayoutComponent, type DynamicLayoutCondition, type DynamicLayoutCssLength, type DynamicLayoutDependency, type DynamicLayoutFieldComponent, type DynamicLayoutFieldValidation, type DynamicLayoutSaveGroup, type DynamicLayoutStyle, type DynamicLayoutTypedValue, type DynamicLayoutValidationRule, type ElementDynamicLayout, dynamicLayout, } from "../dynamic-layout/build.js";
14
+ export { type DynamicLayoutBlockCommon, type DynamicLayoutComponent, type DynamicLayoutCondition, type DynamicLayoutCssLength, type DynamicLayoutDependency, type DynamicLayoutFieldComponent, type DynamicLayoutFieldValidation, type DynamicLayoutSaveGroup, type DynamicLayoutStyle, type DynamicLayoutTypedValue, type DynamicLayoutCurrentUserValue, type DynamicLayoutCurrentUserGroupsValue, type DynamicLayoutEqualityComparison, type DynamicLayoutMembershipComparison, type DynamicLayoutValidationRule, type ElementDynamicLayout, dynamicLayout, } from "../dynamic-layout/build.js";
15
15
  export { dashboardChartWidget, dashboardRecordsWidget, dashboardWidgetSize, type DashboardChartWidget, type DashboardRecordsWidget, type DashboardWidget, type DashboardWidgetSize, } from "../dashboard/build.js";
16
16
  export { attachmentField, booleanField, calculatedField, dateField, dateTimeField, decimalField, dropdownDisplay, dropdownField, dropdownOption, dropdownValue, groupField, jsonField, multiSelectField, numberField, relationField, richTextField, textField, userField, type AttachmentFieldOptions, type BaseFieldOptions, type CalculatedFieldOptions, type InferredCalculatedField, type NumericFieldFormat, type DropdownConfig, type DropdownDisplay, type DropdownFieldOptions, type DropdownOption, type DropdownParentValueRef, type DynamicDropdownConfig, type DynamicDropdownParent, type DynamicDropdownParentMapping, type MultiSelectFieldOptions, type NumericFieldOptions, type RelationFieldOptions, type QrFieldFormat, type TextFieldOptions, } from "../field/build.js";
17
17
  export { calc, dateDifUnit, dateTimeTruncPrecision, field, orderByDirection, predicateOp, weekdayMode, type ConcatExprType, type DateDifUnit, type DateTimeTruncPrecision, type Expr, type ExprType, type FieldRefExprType, type OrderByDirection, type Predicate, type PredicateOp, type StringAggOptions, type StringAggOrderBy, type WeekdayMode, } from "../field/calc.js";
@@ -130,6 +130,12 @@ export interface AutomationRefAst {
130
130
  readonly kind: "automation";
131
131
  readonly appHandle: string;
132
132
  readonly automationKey: string;
133
+ /**
134
+ * Display name of an automation pull leaves platform-managed, so it is not
135
+ * in source: printed as `automationRef({ refName, name, parent })`, which
136
+ * build looks up by that name (#3047).
137
+ */
138
+ readonly unmanagedName?: string;
133
139
  }
134
140
  /** Reference to an app's document model via the app's `documentModels` bag. */
135
141
  export interface DocumentModelRefAst {
@@ -4,8 +4,8 @@ import type { UnsafePlatformId } from "../../../core/platform-id.js";
4
4
  import { type AppField, type FieldScope } from "../../../core/types/app.js";
5
5
  import { type Ref } from "../ref.js";
6
6
  import type { WorkflowFieldType } from "../types/field-types.js";
7
- import type { AndFilter, BetweenFilter, ConsecutiveRangeFilter, ContainsFilter, CurrentRangeFilter, DateTimeUnit, EqualsFilter, FalseFilter, Filter, FilterReference, FilterValue, GreaterThanEqualsFilter, GreaterThanFilter, InFilter, IsNullFilter, LessThanEqualsFilter, LessThanFilter, LikeFilter, LikeMode, OrFilter, OverlapsFilter, TrueFilter, ValueType } from "./types.js";
8
- export type { AndFilter, BetweenFilter, ConsecutiveRangeFilter, ContainsFilter, CurrentRangeFilter, DateTimeUnit, EqualsFilter, FalseFilter, FieldFilterOptions, Filter, FilterReference, FilterValue, GreaterThanEqualsFilter, GreaterThanFilter, InFilter, IsNullFilter, LessThanEqualsFilter, LessThanFilter, LikeFilter, LikeMode, OrFilter, OverlapsFilter, TrueFilter, ValueType, } from "./types.js";
7
+ import type { AndFilter, BetweenFilter, ConsecutiveRangeFilter, ContainsFilter, CurrentRangeFilter, DateTimeUnit, EqualsFilter, FalseFilter, Filter, FilterReference, FilterValue, GreaterThanEqualsFilter, GreaterThanFilter, InFilter, IsNullFilter, LessThanEqualsFilter, LessThanFilter, LikeFilter, LikeMode, OrFilter, OverlapsFilter, ReferenceValueType, TrueFilter, ValueType } from "./types.js";
8
+ export type { AndFilter, BetweenFilter, ConsecutiveRangeFilter, ContainsFilter, CurrentRangeFilter, DateTimeUnit, EqualsFilter, FalseFilter, FieldFilterOptions, Filter, FilterReference, FilterValue, GreaterThanEqualsFilter, GreaterThanFilter, InFilter, IsNullFilter, LessThanEqualsFilter, LessThanFilter, LikeFilter, LikeMode, OrFilter, OverlapsFilter, ReferenceValueType, TrueFilter, ValueType, } from "./types.js";
9
9
  export type FilterField = AppOrElementRef | FieldRef | UserFieldRef | UserGroupFieldRef | TableColumnRef | TableRef | AppField<FieldScope> | UnsafePlatformId | string;
10
10
  /**
11
11
  * A filter field named by a field token or `unsafePlatformId()`, never by a bare
@@ -29,7 +29,7 @@ declare const FILTER_REFERENCE_BRAND: unique symbol;
29
29
  export interface FilterReferenceInput {
30
30
  readonly [FILTER_REFERENCE_BRAND]: true;
31
31
  readonly ref: Ref<unknown> | string;
32
- readonly valueType: ValueType;
32
+ readonly valueType: ReferenceValueType;
33
33
  /** The caller named this type. Build must not replace it with field metadata. */
34
34
  readonly explicit: true;
35
35
  readonly multiple?: boolean;
@@ -52,6 +52,18 @@ export declare function text(ref: Ref<unknown> | string, options?: {
52
52
  export declare function uuid(ref: Ref<unknown> | string, options?: {
53
53
  readonly multiple?: boolean;
54
54
  }): FilterReferenceInput;
55
+ /**
56
+ * The groups of the user a reference holds (the automation builder's
57
+ * "<user>'s groups", such as "Triggered By's groups"), for a record search on
58
+ * a Group field:
59
+ * `filter.isIn(self.fields.assignmentGroup, [filter.groupsOf(ctx.trigger.triggeredBy.id)])`
60
+ * matches a record whose group is one of that user's groups (`isNotIn`: is
61
+ * not). The platform accepts it only as the sole value of `isIn` / `isNotIn`
62
+ * on a Group field, and build refuses anything else. The reference must hold
63
+ * one user's id, such as `ctx.trigger.triggeredBy.id` or a user-id output, not
64
+ * an email or name (edk#3039).
65
+ */
66
+ export declare function groupsOf(ref: Ref<unknown> | string): FilterReferenceInput;
55
67
  export declare function isFilterReferenceInput(value: unknown): value is FilterReferenceInput;
56
68
  /**
57
69
  * A picklist, status, or stage option selected by its LABEL. Build resolves
@@ -72,6 +72,20 @@ export function text(ref, options) {
72
72
  export function uuid(ref, options) {
73
73
  return referenceInput(ref, "UUID", options);
74
74
  }
75
+ /**
76
+ * The groups of the user a reference holds (the automation builder's
77
+ * "<user>'s groups", such as "Triggered By's groups"), for a record search on
78
+ * a Group field:
79
+ * `filter.isIn(self.fields.assignmentGroup, [filter.groupsOf(ctx.trigger.triggeredBy.id)])`
80
+ * matches a record whose group is one of that user's groups (`isNotIn`: is
81
+ * not). The platform accepts it only as the sole value of `isIn` / `isNotIn`
82
+ * on a Group field, and build refuses anything else. The reference must hold
83
+ * one user's id, such as `ctx.trigger.triggeredBy.id` or a user-id output, not
84
+ * an email or name (edk#3039).
85
+ */
86
+ export function groupsOf(ref) {
87
+ return referenceInput(ref, "USER_GROUPS");
88
+ }
75
89
  export function isFilterReferenceInput(value) {
76
90
  return typeof value === "object" && value !== null && FILTER_REFERENCE_BRAND in value;
77
91
  }
@@ -188,8 +202,12 @@ function leftType(left, fallback, explicit) {
188
202
  return leftType(sourceField(left), fallback, explicit);
189
203
  if (explicit !== undefined)
190
204
  return explicit;
191
- if (isFilterReferenceInput(left))
205
+ if (isFilterReferenceInput(left)) {
206
+ if (left.valueType === "USER_GROUPS") {
207
+ throw new EdkValidationError("filter.groupsOf(...) can't be the compared side: use it as the only value of filter.isIn / filter.isNotIn on a Group field");
208
+ }
192
209
  return left.valueType;
210
+ }
193
211
  if (isRef(left) || typeof left === "string" || isUnsafePlatformId(left))
194
212
  return fallback;
195
213
  return fieldTypeToValueType(isAppField(left) ? left.type : "fieldType" in left ? left.fieldType : undefined);
@@ -164,6 +164,11 @@ function printFilterValue(value, codec, call, quote) {
164
164
  case "UUID":
165
165
  helper = "uuid";
166
166
  break;
167
+ case "USER_GROUPS":
168
+ if (value.multiple === true)
169
+ throw new EntityTfError("a user-groups filter value holds one user, never a list");
170
+ helper = "groupsOf";
171
+ break;
167
172
  case undefined:
168
173
  return `${codec.reference(value.value)}${options}`;
169
174
  default: throw new Error(`unsupported filter reference type "${realType}"`);
@@ -117,6 +117,19 @@ export interface FilterToTfCodec {
117
117
  * that authored type is kept as written.
118
118
  */
119
119
  readonly referenceRealType?: (reference: unknown, role: "left" | "value", authored: string | undefined) => string | undefined;
120
+ /**
121
+ * `filter.groupsOf(...)` is accepted only where the owner sets this: the
122
+ * platform expands USER_GROUPS in record search filters alone (edk#3039).
123
+ */
124
+ readonly allowGroupsOf?: boolean;
125
+ /**
126
+ * The declared type of what a reference holds (`USER_ID`, `TEXT`, …), or
127
+ * undefined when the owner can't tell. `filter.groupsOf` needs a user id.
128
+ */
129
+ readonly referenceDeclaredType?: (reference: unknown) => {
130
+ readonly type: string;
131
+ readonly multiple?: boolean;
132
+ } | undefined;
120
133
  }
121
134
  /** Which schema a filter's `field_id` addresses: app/element fields, or the fixed platform user / user-group directory. */
122
135
  export type FilterFieldScope = "app" | "user" | "userGroup";
@@ -64,6 +64,78 @@ function fieldOptions(filter, codec, type) {
64
64
  : {}),
65
65
  };
66
66
  }
67
+ function isGroupsOfValue(value) {
68
+ if (typeof value !== "object" || value === null)
69
+ return false;
70
+ const raw = value;
71
+ const realType = raw.realType ?? raw.real_type;
72
+ return typeof realType === "string" && realType.toUpperCase() === "USER_GROUPS";
73
+ }
74
+ /** Why a reference of this declared type isn't one user's id, in product words. */
75
+ function groupsOfTypeProblem(declared) {
76
+ if (declared === "USER")
77
+ return "is a whole user (use its .id)";
78
+ if (declared === "OBJECT")
79
+ return "is a whole item, not one user's id";
80
+ if (declared === "ASPECT_RECORD_ID" || declared === "RECORD_ID")
81
+ return "is a record's id, not a user's id";
82
+ if (declared === "GROUP" || declared === "GROUP_ID")
83
+ return "is a group, not a user's id";
84
+ if (declared === "RECORD_HANDLE")
85
+ return "is the record's ID, not a user's id";
86
+ if (declared === "DROPDOWN" || declared === "PICKLIST" || declared === "SYSTEM_FIELD" || declared.endsWith("_PART"))
87
+ return "is not a user's id";
88
+ return `holds a ${declared.toLowerCase().replace(/_/g, " ")} value, not a user's id`;
89
+ }
90
+ /**
91
+ * The platform expands `filter.groupsOf(...)` (realType USER_GROUPS) only as
92
+ * the sole value of an IN filter on a Group field, from one user's id (jarvis
93
+ * UserGroupsFilterResolver); anything else fails when the automation runs.
94
+ * edk#3039.
95
+ */
96
+ function checkGroupsOfPlacement(filter, type, field, codec) {
97
+ const values = Array.isArray(filter.values) ? filter.values : [];
98
+ const others = [filter.leftValue, filter.value, filter.min, filter.max];
99
+ if (!others.some(isGroupsOfValue) && !values.some(isGroupsOfValue))
100
+ return;
101
+ const fail = (why) => {
102
+ throw new EntityTfError(`filter.groupsOf(...) ${why}: use it as the only value of filter.isIn / filter.isNotIn on a Group field in a record search`);
103
+ };
104
+ // A problem with the reference itself: its own advice, not the placement's.
105
+ const failReference = (why) => {
106
+ throw new EntityTfError(`filter.groupsOf(...) ${why}; it takes one user's id, such as ctx.trigger.triggeredBy.id or a user field's .id`);
107
+ };
108
+ if (codec.allowGroupsOf !== true)
109
+ fail("works only in a record search filter");
110
+ if (isGroupsOfValue(filter.leftValue))
111
+ fail("can't be the compared side");
112
+ // The platform reads the compared field's id (operator.getField()); a
113
+ // fieldValue(...) left side leaves it empty.
114
+ if (filter.field === undefined)
115
+ fail("needs a field as the compared side, not a fieldValue(...) or a reference");
116
+ if (type !== "in")
117
+ fail(`can't be used with ${type}`);
118
+ if (values.length !== 1)
119
+ fail("must be the only value in its list");
120
+ const fieldType = typeof field === "object" && field !== null ? field.fieldType : undefined;
121
+ if (typeof fieldType === "string" && fieldType !== "GROUP" && fieldType !== "GROUP_ID")
122
+ fail(`compares a ${fieldType} field`);
123
+ const groupsOfValue = values[0];
124
+ if (groupsOfValue.multiple === true)
125
+ failReference("holds a list");
126
+ const reference = groupsOfValue.value;
127
+ const declaredType = codec.referenceDeclaredType?.(reference);
128
+ const declared = declaredType?.type.toUpperCase();
129
+ if (declaredType?.multiple === true)
130
+ failReference("holds a list");
131
+ if (declared !== undefined && declared !== "USER_ID")
132
+ failReference(groupsOfTypeProblem(declared));
133
+ const name = typeof reference === "object" && reference !== null ? reference.name : undefined;
134
+ // Without a declared type, a reference named for an email or a name
135
+ // ("triggeredBy.email", "User's Email", "managerEmail") never holds an id.
136
+ if (declared === undefined && typeof name === "string" && /(?:email|name)$/i.test(name))
137
+ failReference(`holds ${JSON.stringify(name)}, not a user's id`);
138
+ }
67
139
  /** The only authored/wire-filter -> Terraform-HCL filter serializer. */
68
140
  export function filterToTf(value, codec) {
69
141
  const filter = wireFilter(value);
@@ -76,6 +148,7 @@ export function filterToTf(value, codec) {
76
148
  return { type, children: filter.children.map((child) => filterToTf(child, codec)) };
77
149
  }
78
150
  const field = filter.field ?? codec.fieldFromLeftValue?.(filter.leftValue);
151
+ checkGroupsOfPlacement(filter, type, field, codec);
79
152
  const left = withLeft(filter, codec, type);
80
153
  if (left.field_id === undefined && left.left_value === undefined) {
81
154
  throw new EntityTfError(`${type} filter has no left side`);
@@ -491,7 +564,7 @@ function decodedReferenceRealType(codec, reference, stored) {
491
564
  const fallback = (present ? stored.toUpperCase() : "TEXT");
492
565
  if (present)
493
566
  return fallback;
494
- return codec.referenceType?.(reference, fallback) ?? fallback;
567
+ return codec.referenceType?.(reference, "TEXT") ?? fallback;
495
568
  }
496
569
  /** The only Terraform-HCL filter -> strongly typed deserializer AST. */
497
570
  export function filterFromTf(value, codec, fieldScope = "app") {
@@ -4,6 +4,13 @@
4
4
  * Discriminated on `type` with values matching platform filter type names.
5
5
  */
6
6
  export type ValueType = "BOOLEAN" | "CURRENT_USER" | "DATE" | "DATETIME" | "FIELD" | "NULL" | "NUMBER" | "RECORD_FIELD" | "REFERENCE" | "TEXT" | "UUID";
7
+ /**
8
+ * The type a REFERENCE value compares as. Besides every comparison type it
9
+ * can be USER_GROUPS: the groups of the user the reference holds, which only
10
+ * `filter.groupsOf(...)` writes (edk#3039). It is not a comparison type an
11
+ * operator accepts.
12
+ */
13
+ export type ReferenceValueType = ValueType | "USER_GROUPS";
7
14
  export type FilterReference = {
8
15
  type: "TRIGGER";
9
16
  name: string;
@@ -95,7 +102,7 @@ export type FilterValue<FieldValue = string, ReferenceValue = FilterReference> =
95
102
  */
96
103
  | {
97
104
  type: "REFERENCE";
98
- realType?: ValueType;
105
+ realType?: ReferenceValueType;
99
106
  explicit?: true;
100
107
  value: ReferenceValue;
101
108
  label?: string;
@@ -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 (deleted, DISABLED, no draft, or unrepresentable),
290
- * or wrote no id at all. Any other raw id is a valid reference to an automation this
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
- return value;
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;
@@ -3,6 +3,7 @@ import { workspaceAspectKey } from "../../engine/build/context.js";
3
3
  import { foreignFieldDataLabel, resolveForeignRef } from "../shared/foreign-ref.js";
4
4
  import { expr, isCanonicalTsLabel, sanitizeName, scopedResourceLabel, tfLabelToTsLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
5
5
  import { AUTOMATION_RESOURCE_TYPE, automationResourceLabel } from "../automation/types.js";
6
+ import { automationLookupOwnerId } from "../automation/lookup-owner.js";
6
7
  import { fieldMetadataFromEntries } from "../field/metadata.js";
7
8
  import { authoredFieldKeysFromPayload, droppedEntryGap, fieldLookupName, fieldRefToTfValue, unauthoredSiblingFieldRef, UNRESOLVED_FIELD_REF, } from "../field/to-tf.js";
8
9
  import { runAutomationParameterValue } from "./build.js";
@@ -391,7 +392,7 @@ function resolveAutomation(value, widgetKey, where, opts) {
391
392
  return undefined;
392
393
  }
393
394
  const label = `${opts.ownerTfLabel}_${tsLabelToTfLabel(refName)}`;
394
- opts.orgRefs.rawLookup(AUTOMATION_RESOURCE_TYPE, label, displayName, { app_id: opts.objectId });
395
+ opts.orgRefs.rawLookup(AUTOMATION_RESOURCE_TYPE, label, displayName, { app_id: automationLookupOwnerId(opts.scope, opts.ownerTfLabel, opts.orgRefs) });
395
396
  return expr.dataAttr(AUTOMATION_RESOURCE_TYPE, label, ["id"]);
396
397
  }
397
398
  return expr.resourceAttr(AUTOMATION_RESOURCE_TYPE, automationResourceLabel(opts.ownerTfLabel, refName, opts.scope, opts.scope === "element" ? opts.ownerHandle : undefined), ["id"]);
@@ -167,7 +167,7 @@ export type ListControlsOption = {
167
167
  /**
168
168
  * Customer-facing name: Record list
169
169
  * Customer-facing description: A compact stacked list of records with titles and status pills. Use it for queues and pickers.
170
- * Internal authoring guidance: Dual presentational/self-fetching selectable stacked list with title, identifier, pills, and optional collapsible groups. Place every ListCollectionBlock under a root PanesBlock so clicks can support secondary/detail panes. Use items for authored content, or aspectId/search/filter props for live records; self-fetching falls back to the runtime default aspect. Optional density: "compact" | "standard" | "comfortable" (List View names); omit to keep today’s spacing. Live lists show a matching record count in the collection footer. Set showExport: true to show Export in the top-right of the collection; omit or false keeps Export hidden. Optional fields is an ordered string[] of real aspect field ids shown as labeled attribute chips beside each title (user/group avatars, picklist color, locale dates, number/currency). Omit fields to keep today’s fixed system pills; when fields is set, do not also expect those pills. Never invent field UUIDs; resolve ids from Owning App fields when the admin asks in plain language (for example "show Team and Priority on each row"). To share a ListControls filter, bind this list’s filterJson and quickFilterValue to the exact same paths as the control: use /query/filter and /query/statusGroup for one shared pair, or /query/filter/{blockKey} and /query/statusGroup/{blockKey} for an independent same-aspect pair. Each block-keyed pair can define its own quickFilters chips. For a view with more than one App, use /query/filter/<aspectId> and /query/statusGroup/<aspectId> for every block serving that App. Exception: independent ListControls/list pairs on the same App, including in a multi-App view, use /query/filter/{blockKey} and /query/statusGroup/{blockKey}. Shared and aspect-scoped paths remain first-class. Use filterPreset only for a no-chip seed or an independent list filter. Looks like a ticket queue, not a spreadsheet. Prefer DataTableBlock for dense columns.
170
+ * Internal authoring guidance: Dual presentational/self-fetching selectable stacked list with title, identifier, pills, and optional collapsible groups. Place every ListCollectionBlock under a root PanesBlock so clicks can support secondary/detail panes. Use items for authored content, or aspectId/search/filter props for live records; self-fetching falls back to the runtime default aspect. Optional density: "compact" | "standard" | "comfortable" (List View names); omit to keep today’s spacing. Live lists show a matching record count in the collection footer. Set showExport: true to show Export in the top-right of the collection; omit or false keeps Export hidden. Optional fields is an ordered string[] of real aspect field ids shown as labeled attribute chips beside each title (user/group avatars, picklist color, locale dates, number/currency). Omit fields to keep today’s fixed system pills; when fields is set, do not also expect those pills. Set booleanDisplay to "badge" (default) or "icon" to choose how read-only checkbox/boolean fields render among configured attributes; the field name stays visible. Never invent field UUIDs; resolve ids from Owning App fields when the admin asks in plain language (for example "show Team and Priority on each row"). To share a ListControls filter, bind this list’s filterJson and quickFilterValue to the exact same paths as the control: use /query/filter and /query/statusGroup for one shared pair, or /query/filter/{blockKey} and /query/statusGroup/{blockKey} for an independent same-aspect pair. Each block-keyed pair can define its own quickFilters chips. For a view with more than one App, use /query/filter/<aspectId> and /query/statusGroup/<aspectId> for every block serving that App. Exception: independent ListControls/list pairs on the same App, including in a multi-App view, use /query/filter/{blockKey} and /query/statusGroup/{blockKey}. Shared and aspect-scoped paths remain first-class. Use filterPreset only for a no-chip seed or an independent list filter. Looks like a ticket queue, not a spreadsheet. Prefer DataTableBlock for dense columns.
171
171
  */
172
172
  export type ListCollectionBlockElement = {
173
173
  readonly type: "ListCollectionBlock";
@@ -226,6 +226,7 @@ export type ListCollectionBlockSelfFetchingProps = {
226
226
  readonly loadingMessage?: (string) | (PropExpression);
227
227
  readonly errorMessage?: (string) | (PropExpression);
228
228
  readonly emptyMessage?: (string) | (PropExpression);
229
+ readonly booleanDisplay?: ("badge" | "icon") | (PropExpression);
229
230
  readonly aspectId?: (string) | (PropExpression);
230
231
  readonly searchValue?: (string) | (PropExpression);
231
232
  readonly filterJson?: (((JsonSafeState) & ((string) | (number) | (boolean) | (null) | (ReadonlyArray<OpaqueJson>) | ({
@@ -420,7 +421,7 @@ export type CardBlockProps = {
420
421
  /**
421
422
  * Customer-facing name: Data table
422
423
  * Customer-facing description: A spreadsheet-style table with typed columns for structured rows.
423
- * Internal authoring guidance: Dual presentational/self-fetching data table with typed columns, row selection, optional nested children, and loading/empty/error states. Use rows or object columns for authored data, or aspectId with record columns for live records; self-fetching falls back to the runtime default aspect. Optional density: "compact" | "standard" | "comfortable" (List View names); omit to keep today’s spacing. Self-fetching columns are registered system keys (handle, title, status, priority, assignee, assignmentGroup, createdBy, createdTime, updatedAt, stage) and/or real aspect field ids - never invent field UUIDs - as strings, or { key, width?, minWidth?, maxWidth? } for admin default widths (key is the same system key or field id). Prefer semantic system keys when they exist. Optional columnHeaders maps the same column string to a display label; omit to use i18n/system headers or the field name from aspect metadata. Object columns with header/type/align select the presentational branch. Live tables show a matching record count in the collection footer; CMV users may resize columns (browser-local, not written back to Spec). Set showExport: true to show Export in the top-right of the collection; omit or false keeps Export hidden. Presentational rows may set href (absolute https:// opens a new tab, "/path" navigates inside Elementum) so the primary title cell renders as a link; same rules as ActionCardBlock. Per-cell links use a cell-hint object with href. To share a ListControls filter, bind this table’s filterJson and quickFilterValue to the exact same paths as the control: use /query/filter and /query/statusGroup for one shared pair, or /query/filter/{blockKey} and /query/statusGroup/{blockKey} for an independent same-aspect pair. Each block-keyed pair can define its own quickFilters chips. For a view with more than one App, use /query/filter/<aspectId> and /query/statusGroup/<aspectId> for every block serving that App. Shared and aspect-scoped paths remain first-class. Use filterPreset only for a no-chip seed or an independent table filter. Looks like a spreadsheet-style grid; wrap in CardBlock with padding "none". Prefer ListCollectionBlock for compact record queues.
424
+ * Internal authoring guidance: Dual presentational/self-fetching data table with typed columns, row selection, optional nested children, and loading/empty/error states. Use rows or object columns for authored data, or aspectId with record columns for live records; self-fetching falls back to the runtime default aspect. Optional density: "compact" | "standard" | "comfortable" (List View names); omit to keep today’s spacing. Self-fetching columns are registered system keys (handle, title, status, priority, assignee, assignmentGroup, createdBy, createdTime, updatedAt, stage) and/or real aspect field ids - never invent field UUIDs - as strings, or { key, width?, minWidth?, maxWidth? } for admin default widths (key is the same system key or field id). Prefer semantic system keys when they exist. Optional columnHeaders maps the same column string to a display label; omit to use i18n/system headers or the field name from aspect metadata. Set booleanDisplay to "badge" (default) or "icon" to choose how read-only checkbox/boolean aspect fields render in live records. Object columns with header/type/align select the presentational branch. Live tables show a matching record count in the collection footer; CMV users may resize columns (browser-local, not written back to Spec). Set showExport: true to show Export in the top-right of the collection; omit or false keeps Export hidden. Presentational rows may set href (absolute https:// opens a new tab, "/path" navigates inside Elementum) so the primary title cell renders as a link; same rules as ActionCardBlock. Per-cell links use a cell-hint object with href. To share a ListControls filter, bind this table’s filterJson and quickFilterValue to the exact same paths as the control: use /query/filter and /query/statusGroup for one shared pair, or /query/filter/{blockKey} and /query/statusGroup/{blockKey} for an independent same-aspect pair. Each block-keyed pair can define its own quickFilters chips. For a view with more than one App, use /query/filter/<aspectId> and /query/statusGroup/<aspectId> for every block serving that App. Shared and aspect-scoped paths remain first-class. Use filterPreset only for a no-chip seed or an independent table filter. Looks like a spreadsheet-style grid; wrap in CardBlock with padding "none". Prefer ListCollectionBlock for compact record queues.
424
425
  */
425
426
  export type DataTableBlockElement = {
426
427
  readonly type: "DataTableBlock";
@@ -484,6 +485,7 @@ export type DataTableBlockSelfFetchingProps = {
484
485
  readonly loadingMessage?: (string) | (PropExpression);
485
486
  readonly errorMessage?: (string) | (PropExpression);
486
487
  readonly emptyMessage?: (string) | (PropExpression);
488
+ readonly booleanDisplay?: ("badge" | "icon") | (PropExpression);
487
489
  readonly aspectId?: (string) | (PropExpression);
488
490
  readonly columns?: (ReadonlyArray<DataTableSelfFetchingColumn>) | (PropExpression);
489
491
  readonly columnHeaders?: ({
@@ -1,5 +1,5 @@
1
1
  // Generated by `npm run generate:ragnarok` — do not edit. Refresh with `npm run refresh:ragnarok`.
2
- // Source: urn:elementum:elementum-blocks:spec:v1 version 1.45.0
3
- // Schema sha256: 91b420eaae8a05c4f85c273d2651067786d3e3de650b71cc1520b3ca1a1818e0
2
+ // Source: urn:elementum:elementum-blocks:spec:v1 version 1.46.0
3
+ // Schema sha256: d8dfa173c9efe7aa2eedf7a5f44abeb9eb9d6a3c34e920216c39971f3e6f5a63
4
4
  // Generator revision: 2
5
5
  export {};
@@ -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, SkippedOwnFileReport, } 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,10 @@ 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[];
351
+ /** One entry per own-file child this pull skipped, for the pull summary (see {@link SkippedOwnFileReport}). */
352
+ readonly skippedReports?: readonly SkippedOwnFileReport[];
349
353
  /**
350
354
  * Own-file ref names released from state on this pull. Their authored files
351
355
  * are archived so the next plan does not recreate the live resource (#1858).
@@ -385,6 +389,38 @@ export interface AdoptionAddressAlias {
385
389
  readonly from: string;
386
390
  readonly to: string;
387
391
  }
392
+ /**
393
+ * An own-file child pull skipped, as the pull summary lists it (#3053).
394
+ * `address` is its root resource; `causedBy`, when set, is the root resource
395
+ * of the skipped child whose skip this one follows from (transitively, the
396
+ * first one skipped for a reason of its own).
397
+ */
398
+ export interface SkippedOwnFileReport {
399
+ readonly address: string;
400
+ readonly name: string;
401
+ readonly reason: string;
402
+ readonly causedBy?: string;
403
+ }
404
+ /**
405
+ * A data lookup that stands in for skipped resources in the export adoption
406
+ * plans (#3023). Adoption replaces each `.id` reference to a skipped resource
407
+ * with its platform id, but has no literal for any other attribute. A
408
+ * reference to another attribute of one of `addresses` reads the attribute of
409
+ * the same name from `lookup` instead, so it stays declared.
410
+ */
411
+ export interface UnmanagedLookup {
412
+ readonly lookup: TfBlock;
413
+ /** Skipped resources whose attributes other than `id` the lookup carries. */
414
+ readonly addresses: readonly string[];
415
+ /**
416
+ * Skipped resources the lookup stands for entirely, `id` included: every
417
+ * reference to one reads the lookup, never a platform id, so it pairs with
418
+ * the lookup build emits for the same reference (#3047).
419
+ */
420
+ readonly idAddresses?: readonly string[];
421
+ /** Data blocks `lookup` reads (its owner's lookup), declared with it when not already declared. */
422
+ readonly supporting?: readonly TfBlock[];
423
+ }
388
424
  export interface PrintedOwnFile {
389
425
  readonly refName: string;
390
426
  readonly source: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementumai/edk",
3
- "version": "0.13.2",
3
+ "version": "0.13.4",
4
4
  "description": "Elementum Development Kit — statically typed SDK for building Elementum apps, automations, and agents",
5
5
  "type": "module",
6
6
  "license": "SEE LICENSE IN LICENSE",