@elementumai/edk 0.12.0 → 0.13.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 (193) hide show
  1. package/README.md +2 -0
  2. package/dist-sdk/src/catalog/factories.d.ts +7 -1
  3. package/dist-sdk/src/catalog/factories.js +2 -0
  4. package/dist-sdk/src/catalog/index.d.ts +2 -2
  5. package/dist-sdk/src/catalog/index.js +1 -1
  6. package/dist-sdk/src/catalog/org.js +79 -34
  7. package/dist-sdk/src/catalog/token.js +5 -0
  8. package/dist-sdk/src/catalog/types.d.ts +7 -1
  9. package/dist-sdk/src/catalog/types.js +3 -0
  10. package/dist-sdk/src/core/system-fields.d.ts +1 -1
  11. package/dist-sdk/src/core/system-fields.js +1 -1
  12. package/dist-sdk/src/core/types/app.d.ts +6 -0
  13. package/dist-sdk/src/engine/build/context.d.ts +3 -0
  14. package/dist-sdk/src/engine/pull/authored-address.js +42 -6
  15. package/dist-sdk/src/engine/pull/authored-root.d.ts +88 -0
  16. package/dist-sdk/src/engine/pull/authored-root.js +306 -0
  17. package/dist-sdk/src/engine/pull/context.d.ts +10 -0
  18. package/dist-sdk/src/engine/pull/field-refs-registry.d.ts +114 -0
  19. package/dist-sdk/src/engine/pull/field-refs-registry.js +501 -0
  20. package/dist-sdk/src/engine/pull/org.d.ts +1 -0
  21. package/dist-sdk/src/engine/pull/org.js +2 -0
  22. package/dist-sdk/src/engine/pull/partition.d.ts +8 -0
  23. package/dist-sdk/src/engine/pull/partition.js +43 -0
  24. package/dist-sdk/src/engine/pull/pulled-roots.d.ts +89 -0
  25. package/dist-sdk/src/engine/pull/pulled-roots.js +203 -0
  26. package/dist-sdk/src/engine/pull/ref-only.d.ts +4 -0
  27. package/dist-sdk/src/engine/pull/ref-only.js +7 -1
  28. package/dist-sdk/src/engine/pull/source-resources.d.ts +39 -0
  29. package/dist-sdk/src/engine/pull/source-resources.js +110 -0
  30. package/dist-sdk/src/engine/pull/stream-root.d.ts +148 -0
  31. package/dist-sdk/src/engine/pull/stream-root.js +563 -0
  32. package/dist-sdk/src/engine/workspace/reserved-catalog-keys.d.ts +47 -0
  33. package/dist-sdk/src/engine/workspace/reserved-catalog-keys.js +115 -0
  34. package/dist-sdk/src/entities/access-policy/build.d.ts +2 -1
  35. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +7 -0
  36. package/dist-sdk/src/entities/access-policy/from-tf.js +18 -3
  37. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +19 -0
  38. package/dist-sdk/src/entities/access-policy/to-tf.js +65 -8
  39. package/dist-sdk/src/entities/agent/build.d.ts +52 -1
  40. package/dist-sdk/src/entities/agent/build.js +34 -0
  41. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +68 -0
  42. package/dist-sdk/src/entities/agent/from-tf.d.ts +34 -1
  43. package/dist-sdk/src/entities/agent/from-tf.js +262 -2
  44. package/dist-sdk/src/entities/agent/index.d.ts +1 -1
  45. package/dist-sdk/src/entities/agent/to-tf.d.ts +8 -10
  46. package/dist-sdk/src/entities/agent/to-tf.js +158 -14
  47. package/dist-sdk/src/entities/agent-tool/from-tf.js +6 -0
  48. package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
  49. package/dist-sdk/src/entities/agent-tool/to-tf.js +2 -2
  50. package/dist-sdk/src/entities/app/build.d.ts +33 -13
  51. package/dist-sdk/src/entities/app/build.js +14 -12
  52. package/dist-sdk/src/entities/app/from-tf.js +24 -9
  53. package/dist-sdk/src/entities/app/index.d.ts +1 -0
  54. package/dist-sdk/src/entities/app/index.js +1 -0
  55. package/dist-sdk/src/entities/app/module.js +1 -0
  56. package/dist-sdk/src/entities/app/stage-keys.d.ts +2 -2
  57. package/dist-sdk/src/entities/app/stage-keys.js +3 -3
  58. package/dist-sdk/src/entities/app/to-tf.js +1 -0
  59. package/dist-sdk/src/entities/approval-chain/build.d.ts +46 -11
  60. package/dist-sdk/src/entities/approval-chain/build.js +120 -8
  61. package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +24 -2
  62. package/dist-sdk/src/entities/approval-chain/from-tf.js +148 -6
  63. package/dist-sdk/src/entities/approval-chain/index.d.ts +4 -1
  64. package/dist-sdk/src/entities/approval-chain/index.js +4 -1
  65. package/dist-sdk/src/entities/approval-chain/module.js +23 -5
  66. package/dist-sdk/src/entities/approval-chain/printer.d.ts +1 -1
  67. package/dist-sdk/src/entities/approval-chain/printer.js +91 -5
  68. package/dist-sdk/src/entities/approval-chain/steps-tf.d.ts +77 -0
  69. package/dist-sdk/src/entities/approval-chain/steps-tf.js +255 -0
  70. package/dist-sdk/src/entities/approval-chain/steps.d.ts +71 -0
  71. package/dist-sdk/src/entities/approval-chain/steps.js +83 -0
  72. package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +16 -6
  73. package/dist-sdk/src/entities/approval-chain/to-tf.js +37 -4
  74. package/dist-sdk/src/entities/automation/build.js +70 -27
  75. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +20 -5
  76. package/dist-sdk/src/entities/automation/from-tf.d.ts +26 -5
  77. package/dist-sdk/src/entities/automation/from-tf.js +593 -101
  78. package/dist-sdk/src/entities/automation/index.d.ts +1 -0
  79. package/dist-sdk/src/entities/automation/index.js +1 -0
  80. package/dist-sdk/src/entities/automation/module.d.ts +4 -3
  81. package/dist-sdk/src/entities/automation/module.js +33 -12
  82. package/dist-sdk/src/entities/automation/refs-read.d.ts +19 -0
  83. package/dist-sdk/src/entities/automation/refs-read.js +48 -0
  84. package/dist-sdk/src/entities/automation/slack-message-refs.d.ts +9 -0
  85. package/dist-sdk/src/entities/automation/slack-message-refs.js +75 -0
  86. package/dist-sdk/src/entities/automation/task-output-labels.d.ts +11 -0
  87. package/dist-sdk/src/entities/automation/task-output-labels.js +23 -0
  88. package/dist-sdk/src/entities/automation/tasks.d.ts +29 -4
  89. package/dist-sdk/src/entities/automation/tasks.js +34 -11
  90. package/dist-sdk/src/entities/automation/to-tf.d.ts +3 -0
  91. package/dist-sdk/src/entities/automation/to-tf.js +337 -77
  92. package/dist-sdk/src/entities/automation/triggers.d.ts +0 -8
  93. package/dist-sdk/src/entities/automation/triggers.js +26 -11
  94. package/dist-sdk/src/entities/automation/unsafe-script-output.d.ts +50 -0
  95. package/dist-sdk/src/entities/automation/unsafe-script-output.js +92 -0
  96. package/dist-sdk/src/entities/chart/build.d.ts +9 -1
  97. package/dist-sdk/src/entities/chart/from-tf.js +3 -0
  98. package/dist-sdk/src/entities/chart/to-tf.js +19 -2
  99. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +2 -0
  100. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +44 -5
  101. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +46 -12
  102. package/dist-sdk/src/entities/element/audit-field-guard.d.ts +9 -0
  103. package/dist-sdk/src/entities/element/audit-field-guard.js +88 -0
  104. package/dist-sdk/src/entities/element/build.js +2 -1
  105. package/dist-sdk/src/entities/element/from-tf.js +15 -2
  106. package/dist-sdk/src/entities/element/module.js +3 -0
  107. package/dist-sdk/src/entities/element/system-fields.d.ts +13 -0
  108. package/dist-sdk/src/entities/element/system-fields.js +23 -0
  109. package/dist-sdk/src/entities/element/to-tf.js +1 -0
  110. package/dist-sdk/src/entities/field/build.d.ts +9 -0
  111. package/dist-sdk/src/entities/field/from-tf.d.ts +29 -1
  112. package/dist-sdk/src/entities/field/from-tf.js +99 -6
  113. package/dist-sdk/src/entities/field/module.js +4 -0
  114. package/dist-sdk/src/entities/field/to-tf.d.ts +5 -1
  115. package/dist-sdk/src/entities/field/to-tf.js +33 -12
  116. package/dist-sdk/src/entities/org/category.js +1 -0
  117. package/dist-sdk/src/entities/org/index.d.ts +1 -0
  118. package/dist-sdk/src/entities/org/index.js +1 -0
  119. package/dist-sdk/src/entities/org/voice-auth.d.ts +5 -0
  120. package/dist-sdk/src/entities/org/voice-auth.js +33 -0
  121. package/dist-sdk/src/entities/organization/build.d.ts +3 -0
  122. package/dist-sdk/src/entities/organization/build.js +2 -0
  123. package/dist-sdk/src/entities/organization/index.d.ts +1 -0
  124. package/dist-sdk/src/entities/organization/index.js +1 -0
  125. package/dist-sdk/src/entities/organization/to-tf.d.ts +2 -0
  126. package/dist-sdk/src/entities/organization/to-tf.js +59 -1
  127. package/dist-sdk/src/entities/organization/voice-auth.d.ts +60 -0
  128. package/dist-sdk/src/entities/organization/voice-auth.js +60 -0
  129. package/dist-sdk/src/entities/phone-service/build.d.ts +9 -1
  130. package/dist-sdk/src/entities/phone-service/build.js +1 -0
  131. package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +3 -0
  132. package/dist-sdk/src/entities/phone-service/from-tf.d.ts +1 -0
  133. package/dist-sdk/src/entities/phone-service/from-tf.js +8 -1
  134. package/dist-sdk/src/entities/phone-service/to-tf.js +16 -0
  135. package/dist-sdk/src/entities/record-create-form/from-tf.js +2 -2
  136. package/dist-sdk/src/entities/relationship/from-tf.js +7 -2
  137. package/dist-sdk/src/entities/relationship/module.js +2 -2
  138. package/dist-sdk/src/entities/relationship/pair-check.d.ts +6 -2
  139. package/dist-sdk/src/entities/relationship/pair-check.js +105 -18
  140. package/dist-sdk/src/entities/relationship/to-tf.js +5 -2
  141. package/dist-sdk/src/entities/role/permission-levels.d.ts +7 -0
  142. package/dist-sdk/src/entities/role/permission-levels.js +78 -0
  143. package/dist-sdk/src/entities/role/to-tf.js +32 -2
  144. package/dist-sdk/src/entities/service-account/module.d.ts +2 -1
  145. package/dist-sdk/src/entities/service-account/module.js +4 -1
  146. package/dist-sdk/src/entities/service-account/resource-type.d.ts +2 -0
  147. package/dist-sdk/src/entities/service-account/resource-type.js +2 -0
  148. package/dist-sdk/src/entities/service-account/role-membership-check.d.ts +20 -0
  149. package/dist-sdk/src/entities/service-account/role-membership-check.js +80 -0
  150. package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +15 -0
  151. package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +36 -0
  152. package/dist-sdk/src/entities/shared/filters/ast.d.ts +2 -0
  153. package/dist-sdk/src/entities/shared/filters/index.d.ts +85 -14
  154. package/dist-sdk/src/entities/shared/filters/index.js +18 -6
  155. package/dist-sdk/src/entities/shared/filters/option-lookups.d.ts +57 -0
  156. package/dist-sdk/src/entities/shared/filters/option-lookups.js +108 -0
  157. package/dist-sdk/src/entities/shared/filters/print.js +9 -5
  158. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +12 -7
  159. package/dist-sdk/src/entities/shared/filters/tf-codec.js +9 -5
  160. package/dist-sdk/src/entities/shared/raw-option-id.d.ts +30 -0
  161. package/dist-sdk/src/entities/shared/raw-option-id.js +41 -0
  162. package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -2
  163. package/dist-sdk/src/entities/skill/input-coverage.js +5 -2
  164. package/dist-sdk/src/entities/sla/build.d.ts +96 -0
  165. package/dist-sdk/src/entities/sla/build.js +124 -0
  166. package/dist-sdk/src/entities/sla/from-tf.d.ts +40 -0
  167. package/dist-sdk/src/entities/sla/from-tf.js +164 -0
  168. package/dist-sdk/src/entities/sla/index.d.ts +1 -0
  169. package/dist-sdk/src/entities/sla/index.js +1 -0
  170. package/dist-sdk/src/entities/sla/module.d.ts +4 -0
  171. package/dist-sdk/src/entities/sla/module.js +73 -0
  172. package/dist-sdk/src/entities/sla/printer.d.ts +2 -0
  173. package/dist-sdk/src/entities/sla/printer.js +84 -0
  174. package/dist-sdk/src/entities/sla/to-tf.d.ts +12 -0
  175. package/dist-sdk/src/entities/sla/to-tf.js +81 -0
  176. package/dist-sdk/src/entities/table/build.d.ts +7 -2
  177. package/dist-sdk/src/entities/table/build.js +22 -1
  178. package/dist-sdk/src/entities/table/deserializer/normalize.d.ts +4 -1
  179. package/dist-sdk/src/entities/table/from-tf.js +89 -14
  180. package/dist-sdk/src/entities/table/index.d.ts +1 -1
  181. package/dist-sdk/src/entities/table/to-tf.js +41 -2
  182. package/dist-sdk/src/entities/task/from-tf.js +2 -1
  183. package/dist-sdk/src/entities/view/from-tf.js +7 -4
  184. package/dist-sdk/src/entities/widget/from-tf.js +13 -2
  185. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +49 -4
  186. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
  187. package/dist-sdk/src/graph/index.d.ts +5 -0
  188. package/dist-sdk/src/graph/index.js +7 -0
  189. package/dist-sdk/src/graph/modules.js +11 -1
  190. package/dist-sdk/src/graph/resource-types.d.ts +47 -0
  191. package/dist-sdk/src/graph/resource-types.js +62 -0
  192. package/dist-sdk/src/graph/types.d.ts +78 -6
  193. package/package.json +6 -3
@@ -7,6 +7,13 @@ import type { WorkflowFieldType } from "../types/field-types.js";
7
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
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";
9
9
  export type FilterField = AppOrElementRef | FieldRef | UserFieldRef | UserGroupFieldRef | TableColumnRef | TableRef | AppField<FieldScope> | UnsafePlatformId | string;
10
+ /**
11
+ * A filter field named by a field token or `unsafePlatformId()`, never by a bare
12
+ * string. Views and access policies take only these, because their build can't
13
+ * resolve a field name (#1873); a filter whose left side is a bare string keeps
14
+ * the wider `FilterField` type, so the editor flags it there instead of build.
15
+ */
16
+ export type FilterFieldToken = Exclude<FilterField, string>;
10
17
  export type FilterReferenceValue = FilterReference | {
11
18
  readonly __rawFilterReference: string;
12
19
  };
@@ -47,29 +54,46 @@ export declare function uuid(ref: Ref<unknown> | string, options?: {
47
54
  }): FilterReferenceInput;
48
55
  export declare function isFilterReferenceInput(value: unknown): value is FilterReferenceInput;
49
56
  /**
50
- * A picklist, status, or stage option selected by its LABEL and stored behind
51
- * the platform's TEXT value wrapper, which is how many live list-view filters
52
- * hold their option ids. Build resolves the label to that option's id either
53
- * way, so the wrapper is the only difference: pass a plain label for a raw text
54
- * comparison, `"UUID"` as the comparison's value type for the UUID wrapper, and
55
- * this for the TEXT one.
57
+ * A picklist, status, or stage option selected by its LABEL. Build resolves
58
+ * the label to that option's id, which is what the platform stores.
59
+ * This is the one spelling for an option (#1733):
60
+ *
61
+ * - In a filter, a plain string is literal text, sent as written. Use this to
62
+ * compare against an option. A `"UUID"` comparison value type also resolves
63
+ * its label, behind the platform's UUID wrapper; this keeps the TEXT one.
64
+ * - In an automation field assignment to a Dropdown or Multi-Select with
65
+ * static options, this is required. A plain string there is a build error.
66
+ *
67
+ * Build fails when the label names no option of the compared field, or more
68
+ * than one. Pull prints a stored option id this way.
56
69
  */
57
- export declare function textOption(label: string): Extract<FilterValue<FilterField, FilterReferenceValue>, {
70
+ export declare function textOption(label: string): TextOptionValue;
71
+ /** An option selected by label: what {@link textOption} returns. */
72
+ export type TextOptionValue = Extract<FilterValue<FilterField, FilterReferenceValue>, {
58
73
  type: "TEXT";
59
- }>;
74
+ }> & {
75
+ readonly option: true;
76
+ };
77
+ export declare function isTextOptionValue(value: unknown): value is TextOptionValue;
60
78
  export interface CurrentUserFilterValue {
61
79
  readonly __kind: "currentUser";
62
80
  readonly valueType: "ID" | "EMAIL" | "DOMAIN";
63
81
  }
64
82
  export declare function currentUser(valueType?: "ID" | "EMAIL" | "DOMAIN"): CurrentUserFilterValue;
65
- /** A field used as an explicit comparison operand, preserving its identity. */
66
- export interface FieldLeftValue {
83
+ declare const FIELD_VALUE_SOURCE: unique symbol;
84
+ /**
85
+ * A field used as an explicit comparison operand, preserving its identity.
86
+ * `Source` is the field it was made from, so a bare string keeps a filter off
87
+ * views and access policies, as a bare-string left side does (#1873).
88
+ */
89
+ export interface FieldLeftValue<Source extends FilterField = FilterField> {
67
90
  readonly type: "FIELD";
68
91
  readonly value: FilterField;
69
92
  readonly aspect?: never;
70
93
  readonly treatNullAsEquals?: true;
94
+ readonly [FIELD_VALUE_SOURCE]?: Source;
71
95
  }
72
- export declare function fieldValue(value: FilterField): FieldLeftValue;
96
+ export declare function fieldValue<Source extends FilterField>(value: Source): FieldLeftValue<Source>;
73
97
  export declare function fieldValue(value: FilterField, options?: {
74
98
  readonly aspect?: string;
75
99
  readonly treatNullAsEquals?: boolean;
@@ -94,34 +118,67 @@ export declare function recordField(field: FilterField, options?: {
94
118
  type AuthoredFilterValue = FilterValue<FilterField, FilterReferenceValue>;
95
119
  export type FilterInput = string | number | boolean | null | Ref<unknown> | FilterReferenceInput | FilterField | CurrentUserFilterValue | AuthoredFilterValue;
96
120
  export type LeftRef = FilterField | Ref<unknown> | FilterReferenceInput | FieldLeftValue;
121
+ type TokenLeftRef = FilterFieldToken | Ref<unknown> | FilterReferenceInput | FieldLeftValue<FilterFieldToken>;
97
122
  export declare const UNRESOLVED_REFERENCE_MARKER = "__edkUnresolvedReference::";
98
123
  export declare function refDataToFilterReference(data: import("../ref.js").RefData): FilterReference;
99
124
  export declare function toFilterValue(input: FilterInput, valueType?: ValueType): FilterValue<FilterField, FilterReferenceValue>;
125
+ export declare function eq(left: TokenLeftRef, input: FilterInput, explicit?: ValueType): EqualsFilter<FilterFieldToken, FilterReferenceValue>;
100
126
  export declare function eq(left: LeftRef, input: FilterInput, explicit?: ValueType): EqualsFilter<FilterField, FilterReferenceValue>;
127
+ export declare function neq(left: TokenLeftRef, input: FilterInput, explicit?: ValueType): EqualsFilter<FilterFieldToken, FilterReferenceValue>;
101
128
  export declare function neq(left: LeftRef, input: FilterInput, explicit?: ValueType): EqualsFilter<FilterField, FilterReferenceValue>;
129
+ export declare function gt(left: TokenLeftRef, input: FilterInput, explicit?: ValueType): GreaterThanFilter<FilterFieldToken, FilterReferenceValue>;
102
130
  export declare function gt(left: LeftRef, input: FilterInput, explicit?: ValueType): GreaterThanFilter<FilterField, FilterReferenceValue>;
131
+ export declare function gte(left: TokenLeftRef, input: FilterInput, explicit?: ValueType): GreaterThanEqualsFilter<FilterFieldToken, FilterReferenceValue>;
103
132
  export declare function gte(left: LeftRef, input: FilterInput, explicit?: ValueType): GreaterThanEqualsFilter<FilterField, FilterReferenceValue>;
133
+ export declare function lt(left: TokenLeftRef, input: FilterInput, explicit?: ValueType): LessThanFilter<FilterFieldToken, FilterReferenceValue>;
104
134
  export declare function lt(left: LeftRef, input: FilterInput, explicit?: ValueType): LessThanFilter<FilterField, FilterReferenceValue>;
135
+ export declare function lte(left: TokenLeftRef, input: FilterInput, explicit?: ValueType): LessThanEqualsFilter<FilterFieldToken, FilterReferenceValue>;
105
136
  export declare function lte(left: LeftRef, input: FilterInput, explicit?: ValueType): LessThanEqualsFilter<FilterField, FilterReferenceValue>;
137
+ export declare function like(left: TokenLeftRef, input: FilterInput, options?: {
138
+ readonly not?: boolean;
139
+ readonly caseInsensitive?: boolean;
140
+ readonly mode?: Lowercase<LikeMode>;
141
+ }, explicit?: ValueType): LikeFilter<FilterFieldToken, FilterReferenceValue>;
106
142
  export declare function like(left: LeftRef, input: FilterInput, options?: {
107
143
  readonly not?: boolean;
108
144
  readonly caseInsensitive?: boolean;
109
145
  readonly mode?: Lowercase<LikeMode>;
110
146
  }, explicit?: ValueType): LikeFilter<FilterField, FilterReferenceValue>;
147
+ export declare function isNull(left: TokenLeftRef, options?: {
148
+ readonly not?: boolean;
149
+ }, explicit?: ValueType): IsNullFilter<FilterFieldToken, FilterReferenceValue>;
111
150
  export declare function isNull(left: LeftRef, options?: {
112
151
  readonly not?: boolean;
113
152
  }, explicit?: ValueType): IsNullFilter<FilterField, FilterReferenceValue>;
153
+ export declare function isNotNull(left: TokenLeftRef, explicit?: ValueType): IsNullFilter<FilterFieldToken, FilterReferenceValue>;
114
154
  export declare function isNotNull(left: LeftRef, explicit?: ValueType): IsNullFilter<FilterField, FilterReferenceValue>;
155
+ export declare function isIn(left: TokenLeftRef, input: readonly FilterInput[], explicit?: ValueType): InFilter<FilterFieldToken, FilterReferenceValue>;
115
156
  export declare function isIn(left: LeftRef, input: readonly FilterInput[], explicit?: ValueType): InFilter<FilterField, FilterReferenceValue>;
157
+ export declare function isNotIn(left: TokenLeftRef, input: readonly FilterInput[], explicit?: ValueType): InFilter<FilterFieldToken, FilterReferenceValue>;
116
158
  export declare function isNotIn(left: LeftRef, input: readonly FilterInput[], explicit?: ValueType): InFilter<FilterField, FilterReferenceValue>;
159
+ export declare function between(left: TokenLeftRef, min: FilterInput, max: FilterInput, options?: {
160
+ readonly not?: boolean;
161
+ }, explicit?: ValueType): BetweenFilter<FilterFieldToken, FilterReferenceValue>;
117
162
  export declare function between(left: LeftRef, min: FilterInput, max: FilterInput, options?: {
118
163
  readonly not?: boolean;
119
164
  }, explicit?: ValueType): BetweenFilter<FilterField, FilterReferenceValue>;
165
+ export declare function currentRange(left: TokenLeftRef, options: {
166
+ readonly unit: DateTimeUnit;
167
+ readonly semantic?: boolean;
168
+ readonly isoWeek?: boolean;
169
+ }, explicit?: ValueType): CurrentRangeFilter<FilterFieldToken, FilterReferenceValue>;
120
170
  export declare function currentRange(left: LeftRef, options: {
121
171
  readonly unit: DateTimeUnit;
122
172
  readonly semantic?: boolean;
123
173
  readonly isoWeek?: boolean;
124
174
  }, explicit?: ValueType): CurrentRangeFilter<FilterField, FilterReferenceValue>;
175
+ export declare function consecutiveRange(left: TokenLeftRef, options: {
176
+ readonly unit: DateTimeUnit;
177
+ readonly count: number;
178
+ readonly offset: number;
179
+ readonly semantic?: boolean;
180
+ readonly isoWeek?: boolean;
181
+ }, explicit?: ValueType): ConsecutiveRangeFilter<FilterFieldToken, FilterReferenceValue>;
125
182
  export declare function consecutiveRange(left: LeftRef, options: {
126
183
  readonly unit: DateTimeUnit;
127
184
  readonly count: number;
@@ -129,17 +186,31 @@ export declare function consecutiveRange(left: LeftRef, options: {
129
186
  readonly semantic?: boolean;
130
187
  readonly isoWeek?: boolean;
131
188
  }, explicit?: ValueType): ConsecutiveRangeFilter<FilterField, FilterReferenceValue>;
189
+ export declare function contains(left: TokenLeftRef, input: FilterInput | readonly FilterInput[], options?: {
190
+ readonly not?: boolean;
191
+ }, explicit?: ValueType): ContainsFilter<FilterFieldToken, FilterReferenceValue>;
132
192
  export declare function contains(left: LeftRef, input: FilterInput | readonly FilterInput[], options?: {
133
193
  readonly not?: boolean;
134
194
  }, explicit?: ValueType): ContainsFilter<FilterField, FilterReferenceValue>;
195
+ export declare function overlaps(left: TokenLeftRef, input: FilterInput | readonly FilterInput[], options?: {
196
+ readonly not?: boolean;
197
+ }, explicit?: ValueType): OverlapsFilter<FilterFieldToken, FilterReferenceValue>;
135
198
  export declare function overlaps(left: LeftRef, input: FilterInput | readonly FilterInput[], options?: {
136
199
  readonly not?: boolean;
137
200
  }, explicit?: ValueType): OverlapsFilter<FilterField, FilterReferenceValue>;
138
- export declare function and(...children: readonly Filter<FilterField, FilterReferenceValue>[]): AndFilter<FilterField, FilterReferenceValue>;
139
- export declare function or(...children: readonly Filter<FilterField, FilterReferenceValue>[]): OrFilter<FilterField, FilterReferenceValue>;
201
+ export declare function and<F extends FilterField = FilterField>(...children: readonly Filter<F, FilterReferenceValue>[]): AndFilter<F, FilterReferenceValue>;
202
+ export declare function or<F extends FilterField = FilterField>(...children: readonly Filter<F, FilterReferenceValue>[]): OrFilter<F, FilterReferenceValue>;
140
203
  export declare function whereTrue(): TrueFilter;
141
204
  export declare function whereFalse(): FalseFilter;
205
+ /**
206
+ * A token filter keeps its type only with a token `aspect`; a bare-string
207
+ * `aspect` widens it, so views and access policies reject it (#1873).
208
+ */
209
+ export declare function withOptions<T extends Filter<FilterFieldToken, FilterReferenceValue>>(value: T, options: {
210
+ readonly aspect?: FilterFieldToken;
211
+ readonly semantic?: boolean;
212
+ }): T;
142
213
  export declare function withOptions<T extends Filter<FilterField, FilterReferenceValue>>(value: T, options: {
143
214
  readonly aspect?: FilterField;
144
215
  readonly semantic?: boolean;
145
- }): T;
216
+ }): T extends Filter<FilterFieldToken, FilterReferenceValue> ? Filter<FilterField, FilterReferenceValue> : T;
@@ -76,16 +76,28 @@ export function isFilterReferenceInput(value) {
76
76
  return typeof value === "object" && value !== null && FILTER_REFERENCE_BRAND in value;
77
77
  }
78
78
  /**
79
- * A picklist, status, or stage option selected by its LABEL and stored behind
80
- * the platform's TEXT value wrapper, which is how many live list-view filters
81
- * hold their option ids. Build resolves the label to that option's id either
82
- * way, so the wrapper is the only difference: pass a plain label for a raw text
83
- * comparison, `"UUID"` as the comparison's value type for the UUID wrapper, and
84
- * this for the TEXT one.
79
+ * A picklist, status, or stage option selected by its LABEL. Build resolves
80
+ * the label to that option's id, which is what the platform stores.
81
+ * This is the one spelling for an option (#1733):
82
+ *
83
+ * - In a filter, a plain string is literal text, sent as written. Use this to
84
+ * compare against an option. A `"UUID"` comparison value type also resolves
85
+ * its label, behind the platform's UUID wrapper; this keeps the TEXT one.
86
+ * - In an automation field assignment to a Dropdown or Multi-Select with
87
+ * static options, this is required. A plain string there is a build error.
88
+ *
89
+ * Build fails when the label names no option of the compared field, or more
90
+ * than one. Pull prints a stored option id this way.
85
91
  */
86
92
  export function textOption(label) {
87
93
  return { type: "TEXT", value: label, option: true };
88
94
  }
95
+ export function isTextOptionValue(value) {
96
+ return typeof value === "object" && value !== null &&
97
+ value.type === "TEXT" &&
98
+ value.option === true &&
99
+ typeof value.value === "string";
100
+ }
89
101
  export function currentUser(valueType = "ID") {
90
102
  return { __kind: "currentUser", valueType };
91
103
  }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Dropdown option selections in chart, table and lookup-field filters
3
+ * (#2582), the same rule #1733 gave automation, view and access-policy
4
+ * filters. `filter.textOption(label)` is the preferred spelling: it must name
5
+ * exactly one option of the field and builds to that option's id through the
6
+ * field's `<label>_options_by_label` local (an app's Status and Stage use the
7
+ * app's `<ns>_status_options_by_label` / `<ns>_stage_options_by_label`, as
8
+ * access policies, automations and dynamic layouts do). A plain string or a
9
+ * raw option id still builds as written and warns, naming
10
+ * `filter.textOption(...)`. Pull reads the export's options-by-label lookup,
11
+ * and an app's `status_option_ids_by_label`, back as `filter.textOption(label)`.
12
+ */
13
+ import type { OptionIdIndex } from "../../../engine/pull/field-refs-registry.js";
14
+ import { type ChildResourceScope, type TfValue } from "../../../engine/tf/index.js";
15
+ interface OptionFieldToken {
16
+ readonly __kind?: string;
17
+ readonly refName?: string;
18
+ readonly name?: string;
19
+ readonly options?: readonly string[];
20
+ readonly tags?: readonly string[];
21
+ /** Natural bag key when pull re-keyed off a reserved system key (#1871). */
22
+ readonly resourceKey?: string;
23
+ }
24
+ export interface OptionSelectionOwner {
25
+ /** Where the filter sits, e.g. `chart "Votes".subscriptions[0].filter`. */
26
+ readonly where: string;
27
+ /** The resource address and name that warnings name. */
28
+ readonly address: string;
29
+ readonly name: string;
30
+ readonly ownerKind: "chart" | "table" | "field";
31
+ readonly optionIds?: OptionIdIndex;
32
+ /**
33
+ * The field's options-by-label local, when the field's owner is built in
34
+ * this workspace. Without it `filter.textOption(label)` has no option id
35
+ * to build and fails.
36
+ */
37
+ readonly optionsLocal: (field: OptionFieldToken) => string | undefined;
38
+ }
39
+ /** The options-by-label local of a field owned by an app or element in this build. */
40
+ export declare function optionsLocalName(ownerTfLabel: string, scope: ChildResourceScope, field: OptionFieldToken): string | undefined;
41
+ /** The filter codec's `literal` hook for an owner that compares stored option ids. */
42
+ export declare function optionSelectionLiteral(owner: OptionSelectionOwner): (value: TfValue, field: unknown, valueType: string, isOptionLabel: boolean) => TfValue;
43
+ /**
44
+ * Pull: the export writes a stored option id as
45
+ * `local.<field>_options_by_label["<label>"]`, a stage id as
46
+ * `local.<ns>_stage_options_by_label["<label>"]` and a status id as
47
+ * `elementum_app.<ns>.status_option_ids_by_label["<label>"]`. Read each back
48
+ * as the label; build writes the same option's id back through the field,
49
+ * stage or status local (#2582 S1).
50
+ */
51
+ export declare function optionLookupLabel(value: TfValue | undefined): string | undefined;
52
+ /** The decode hooks that print a stored option lookup as `filter.textOption(label)`. */
53
+ export declare const optionLookupDecode: {
54
+ readonly literal: (value: TfValue) => TfValue;
55
+ readonly optionLookupsAreIdentities: (stored: TfValue) => boolean;
56
+ };
57
+ export {};
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Dropdown option selections in chart, table and lookup-field filters
3
+ * (#2582), the same rule #1733 gave automation, view and access-policy
4
+ * filters. `filter.textOption(label)` is the preferred spelling: it must name
5
+ * exactly one option of the field and builds to that option's id through the
6
+ * field's `<label>_options_by_label` local (an app's Status and Stage use the
7
+ * app's `<ns>_status_options_by_label` / `<ns>_stage_options_by_label`, as
8
+ * access policies, automations and dynamic layouts do). A plain string or a
9
+ * raw option id still builds as written and warns, naming
10
+ * `filter.textOption(...)`. Pull reads the export's options-by-label lookup,
11
+ * and an app's `status_option_ids_by_label`, back as `filter.textOption(label)`.
12
+ */
13
+ import { EntityTfError } from "../../../engine/entity.js";
14
+ import { recordValidations } from "../../../engine/validation.js";
15
+ import { expr, isTfExpr, isUuid, scopedResourceLabel, tsLabelToTfLabel } from "../../../engine/tf/index.js";
16
+ import { plainOptionStringWarning, rawOptionIdWarning } from "../raw-option-id.js";
17
+ function optionField(field) {
18
+ if (typeof field !== "object" || field === null)
19
+ return undefined;
20
+ const token = field;
21
+ // A Stage token carries its stage names as `options`; it resolves through the stage local below.
22
+ if (token.__kind !== "field" || token.options === undefined)
23
+ return undefined;
24
+ return token;
25
+ }
26
+ /** The options-by-label local of a field owned by an app or element in this build. */
27
+ export function optionsLocalName(ownerTfLabel, scope, field) {
28
+ // #2582 S1: an app's Status and Stage ids live on the app's own locals
29
+ // (app/locals.ts), not a field local. Hand-built refs carry no tags, so
30
+ // match the system key too, as access policies do. Elements have neither.
31
+ if (scope === "app" && (field.tags?.includes("STATUS") === true || field.refName === "status"))
32
+ return `${ownerTfLabel}_status_options_by_label`;
33
+ if (scope === "app" && (field.tags?.includes("STAGE") === true || field.refName === "stage"))
34
+ return `${ownerTfLabel}_stage_options_by_label`;
35
+ if (field.refName === undefined || field.refName === "")
36
+ return undefined;
37
+ // Same child part fieldToTf uses: resourceKey when pull re-keyed (#1871).
38
+ const childPart = tsLabelToTfLabel(field.resourceKey ?? field.refName);
39
+ return `${scopedResourceLabel(ownerTfLabel, childPart, scope)}_options_by_label`;
40
+ }
41
+ /** The filter codec's `literal` hook for an owner that compares stored option ids. */
42
+ export function optionSelectionLiteral(owner) {
43
+ return (value, field, valueType, isOptionLabel) => {
44
+ if (typeof value !== "string" || value === "")
45
+ return value;
46
+ const token = optionField(field);
47
+ if (token === undefined)
48
+ return value;
49
+ const options = token.options ?? [];
50
+ const fieldName = token.name ?? token.refName ?? "unknown";
51
+ const warn = (message) => recordValidations([{ severity: "warning", address: owner.address, name: owner.name, ownerKind: owner.ownerKind, message }]);
52
+ if (isOptionLabel && valueType !== "text") {
53
+ // #2582 N1: the codec also sets isOptionLabel for a UUID wrapper. A
54
+ // label it names builds to the option's lookup; a raw id or any other
55
+ // string falls through to the warnings below.
56
+ const local = options.filter((option) => option === value).length === 1 ? owner.optionsLocal(token) : undefined;
57
+ if (local !== undefined)
58
+ return expr.local(local, [{ index: value }]);
59
+ }
60
+ else if (isOptionLabel) {
61
+ const matches = options.filter((option) => option === value).length;
62
+ if (matches !== 1) {
63
+ throw new EntityTfError(matches === 0
64
+ ? `${owner.where}: filter.textOption(${JSON.stringify(value)}) names no option of field "${fieldName}"; expected one of: ${options.map((option) => JSON.stringify(option)).join(", ")}`
65
+ : `${owner.where}: filter.textOption(${JSON.stringify(value)}) matches ${matches} options of field "${fieldName}", so it names no single option`);
66
+ }
67
+ const local = owner.optionsLocal(token);
68
+ if (local === undefined) {
69
+ throw new EntityTfError(`${owner.where}: filter.textOption(${JSON.stringify(value)}) on field "${fieldName}" needs that field's app or element in this workspace to build its option id`);
70
+ }
71
+ return expr.local(local, [{ index: value }]);
72
+ }
73
+ const slot = owner.where;
74
+ if (isUuid(value) && !options.includes(value)) {
75
+ warn(rawOptionIdWarning({ slot, fieldName, id: value, options, localName: owner.optionsLocal(token), index: owner.optionIds }));
76
+ return value;
77
+ }
78
+ warn(plainOptionStringWarning(slot, fieldName, value, options, false));
79
+ return value;
80
+ };
81
+ }
82
+ function indexLabel(segment) {
83
+ return typeof segment === "object" && segment !== null && "index" in segment && typeof segment.index === "string" ? segment.index : undefined;
84
+ }
85
+ /**
86
+ * Pull: the export writes a stored option id as
87
+ * `local.<field>_options_by_label["<label>"]`, a stage id as
88
+ * `local.<ns>_stage_options_by_label["<label>"]` and a status id as
89
+ * `elementum_app.<ns>.status_option_ids_by_label["<label>"]`. Read each back
90
+ * as the label; build writes the same option's id back through the field,
91
+ * stage or status local (#2582 S1).
92
+ */
93
+ export function optionLookupLabel(value) {
94
+ if (value === undefined || !isTfExpr(value))
95
+ return undefined;
96
+ if (value.$expr === "local") {
97
+ return value.name.endsWith("_options_by_label") && value.path.length === 1 ? indexLabel(value.path[0]) : undefined;
98
+ }
99
+ if (value.$expr === "resource-attr" && value.type === "elementum_app" && value.path.length === 2 && value.path[0] === "status_option_ids_by_label") {
100
+ return indexLabel(value.path[1]);
101
+ }
102
+ return undefined;
103
+ }
104
+ /** The decode hooks that print a stored option lookup as `filter.textOption(label)`. */
105
+ export const optionLookupDecode = {
106
+ literal: (value) => optionLookupLabel(value) ?? value,
107
+ optionLookupsAreIdentities: (stored) => optionLookupLabel(stored) !== undefined,
108
+ };
@@ -14,11 +14,15 @@ export function printFilter(filter, codec) {
14
14
  const uuidValues = literals.length > 0 && literals.every((literal) => literal.type === "UUID");
15
15
  const explicitType = uuidValues ? `, ${quote("UUID")}` : "";
16
16
  const impliedLiteralType = stringLiteralTypeImpliedBy(filter, uuidValues);
17
- const value = (input) => input.type === "UUID"
18
- ? uuidValues ? quote(input.value) : `{ type: "UUID", value: ${quote(input.value)} }`
19
- : (input.type === "TEXT" || input.type === "DATE" || input.type === "DATETIME") && impliedLiteralType !== undefined && input.type !== impliedLiteralType
20
- ? `{ type: ${quote(input.type)}, value: ${quote(input.value)} }`
21
- : printFilterValue(input, codec, call, quote);
17
+ // An option selection prints as `filter.textOption(label)` whatever the
18
+ // left side implies: a bare or wrapped TEXT literal builds as a raw word (#1733).
19
+ const value = (input) => input.type === "TEXT" && input.option === true
20
+ ? printFilterValue(input, codec, call, quote)
21
+ : input.type === "UUID"
22
+ ? uuidValues ? quote(input.value) : `{ type: "UUID", value: ${quote(input.value)} }`
23
+ : (input.type === "TEXT" || input.type === "DATE" || input.type === "DATETIME") && impliedLiteralType !== undefined && input.type !== impliedLiteralType
24
+ ? `{ type: ${quote(input.type)}, value: ${quote(input.value)} }`
25
+ : printFilterValue(input, codec, call, quote);
22
26
  if ("leftValue" in filter && filter.leftValue?.type === "FIELD") {
23
27
  const operand = filter.leftValue;
24
28
  if ((operand.aspect != null && operand.aspect !== "") || (operand.treatNullAsEquals != null && operand.treatNullAsEquals !== true)) {
@@ -96,6 +96,11 @@ export interface FilterToTfCodec {
96
96
  * lookup, whichever wrapper that is.
97
97
  */
98
98
  readonly literal?: (value: TfValue, field: unknown | undefined, valueType: string, isOptionLabel: boolean) => TfValue;
99
+ /**
100
+ * The owner keeps an option label its field no longer lists as written
101
+ * (a pulled automation, #1733), and its `literal` hook already warned.
102
+ */
103
+ readonly keepUnresolvedOptions?: boolean;
99
104
  /** A RECORD_FIELD value's source-record field; without it only raw platform ids encode. */
100
105
  readonly recordField?: (value: unknown) => TfValue;
101
106
  /** The owning app or element an `includeOwner` RECORD_FIELD value stores; without it such a value cannot encode. */
@@ -129,14 +134,14 @@ export interface FilterFromTfCodec<Field = string, ReferenceValue = never> {
129
134
  /** Whether a RECORD_FIELD `object` reference names the owning app or element; without it only raw platform ids decode. */
130
135
  readonly recordFieldOwner?: (value: TfValue) => boolean;
131
136
  /**
132
- * A TEXT-wrapped literal `literal` resolved from an option-id lookup is an
133
- * option LABEL, not a stored word. Set this when the owner cannot rebuild a
134
- * bare label into the same lookup — list views keep raw words literal, so
135
- * dropping the fact there rewrites the stored wrapper type. Owners that
136
- * always resolve labels (access policies) leave it off and keep printing
137
- * plain labels.
137
+ * A TEXT-wrapped literal that `literal` resolved from an option-id lookup or
138
+ * a raw option id is an option LABEL, not a stored word. Set this when the
139
+ * owner keeps a bare string as raw text, as list views and automations do
140
+ * (#1733), so the label prints as `filter.textOption(...)`. An owner whose
141
+ * hook also rewrites non-option values (an access policy's stage keys)
142
+ * passes a predicate naming which stored values are option lookups.
138
143
  */
139
- readonly optionLookupsAreIdentities?: boolean;
144
+ readonly optionLookupsAreIdentities?: boolean | ((stored: TfValue) => boolean);
140
145
  }
141
146
  export type WireFilterValue = Readonly<{
142
147
  type: string;
@@ -280,7 +280,7 @@ function wireFilterValueToTf(value, field, codec, role = "value", operator) {
280
280
  const resolved = codec.literal?.(raw.value, field, type, isOptionLabel) ?? raw.value;
281
281
  // Writing an option label where the platform stored an id is a silent data
282
282
  // change on a live view. Only a resolved lookup is an expression.
283
- if (raw.option === true && !isTfExpr(resolved)) {
283
+ if (raw.option === true && !isTfExpr(resolved) && codec.keepUnresolvedOptions !== true) {
284
284
  throw new EntityTfError(`option selection ${JSON.stringify(raw.value)} has no declared option identity`);
285
285
  }
286
286
  if (isTfExpr(resolved))
@@ -641,10 +641,14 @@ function filterValueFromTf(value, codec, fieldScope, field) {
641
641
  case "number": return { type: "NUMBER", value: typeof literal === "number" ? literal : Number(literal) };
642
642
  case "boolean": return { type: "BOOLEAN", value: typeof literal === "boolean" ? literal : String(literal).toLowerCase() === "true" };
643
643
  case "text": {
644
- // `type` stays the stored wrapper. An expression the codec collapsed to a
645
- // plain string was an id lookup, so this literal is an option LABEL —
646
- // the second, independent fact, which a TEXT wrapper cannot express.
647
- const option = codec.optionLookupsAreIdentities === true && isTfExpr(value.value);
644
+ // `type` stays the stored wrapper. A value the literal hook rewrote, an
645
+ // id lookup expression or a raw option id, was an option, so this
646
+ // literal is its LABEL: the second, independent fact, which a TEXT
647
+ // wrapper cannot express. Any other stored text stays plain (#1733).
648
+ const identities = codec.optionLookupsAreIdentities;
649
+ const option = typeof identities === "function"
650
+ ? identities(value.value)
651
+ : identities === true && (isTfExpr(value.value) || literal !== value.value);
648
652
  return { type: "TEXT", value: String(literal), ...(option && { option: true }) };
649
653
  }
650
654
  case "uuid":
@@ -0,0 +1,30 @@
1
+ /**
2
+ * A raw option id where an option is selected (#1733). Dax, 2026-11-03: "both
3
+ * should be supported. Anything that references ids should warn and mention
4
+ * the preferred method". A raw id builds as written, and build warns with the
5
+ * `filter.textOption(label)` spelling, naming the label when it is known.
6
+ */
7
+ import type { OptionIdIndex } from "../../engine/pull/field-refs-registry.js";
8
+ export interface RawOptionIdInput {
9
+ /** Where the id is used, e.g. `automation field "Club"`. */
10
+ readonly slot: string;
11
+ readonly fieldName: string;
12
+ readonly id: string;
13
+ /** The field's current option labels from source. */
14
+ readonly options: readonly string[];
15
+ /** The field's `<label>_options_by_label` local, when it has one in this workspace. */
16
+ readonly localName?: string;
17
+ readonly index?: OptionIdIndex;
18
+ }
19
+ /**
20
+ * The warning for a plain string compared with a Dropdown or Multi-Select
21
+ * with static options (#1733). Dax, 2026-11-03: "1733: warn on plain-string
22
+ * dropdown filters and point to textOption". `resolvesLabels` says what the
23
+ * filter's owner does with a string that matches an option label: access
24
+ * policies, dashboards, relationships and dynamic layouts resolve it to the
25
+ * option id, while automations and views send the word as written. A raw
26
+ * option id gets {@link rawOptionIdWarning} instead.
27
+ */
28
+ export declare function plainOptionStringWarning(slot: string, fieldName: string, value: string, options: readonly string[], resolvesLabels: boolean): string;
29
+ /** The warning for a raw option id: its option's label, a deleted option, or an unknown label. */
30
+ export declare function rawOptionIdWarning(input: RawOptionIdInput): string;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * A raw option id where an option is selected (#1733). Dax, 2026-11-03: "both
3
+ * should be supported. Anything that references ids should warn and mention
4
+ * the preferred method". A raw id builds as written, and build warns with the
5
+ * `filter.textOption(label)` spelling, naming the label when it is known.
6
+ */
7
+ /**
8
+ * The warning for a plain string compared with a Dropdown or Multi-Select
9
+ * with static options (#1733). Dax, 2026-11-03: "1733: warn on plain-string
10
+ * dropdown filters and point to textOption". `resolvesLabels` says what the
11
+ * filter's owner does with a string that matches an option label: access
12
+ * policies, dashboards, relationships and dynamic layouts resolve it to the
13
+ * option id, while automations and views send the word as written. A raw
14
+ * option id gets {@link rawOptionIdWarning} instead.
15
+ */
16
+ export function plainOptionStringWarning(slot, fieldName, value, options, resolvesLabels) {
17
+ const isLabel = options.includes(value);
18
+ const outcome = isLabel && resolvesLabels
19
+ ? "Build resolves it to that option's id"
20
+ : `It is sent as the literal text ${JSON.stringify(value)}, not an option id`;
21
+ return `${slot} compares field "${fieldName}" with the plain string ${JSON.stringify(value)}. ` +
22
+ `${outcome}; the preferred form for an option is filter.textOption(${JSON.stringify(isLabel ? value : "<label>")})`;
23
+ }
24
+ /** The warning for a raw option id: its option's label, a deleted option, or an unknown label. */
25
+ export function rawOptionIdWarning(input) {
26
+ const { slot, fieldName, id, options, localName, index } = input;
27
+ const fieldIds = localName === undefined ? undefined : index?.idsByLocal.get(localName);
28
+ const label = fieldIds !== undefined
29
+ ? [...fieldIds].find(([, optionId]) => optionId === id)?.[0]
30
+ : index?.labelById.get(id);
31
+ if (label !== undefined && options.includes(label)) {
32
+ return `${slot} uses raw option id ${JSON.stringify(id)}, the option ${JSON.stringify(label)} of field "${fieldName}". ` +
33
+ `Raw ids still build; the preferred form is filter.textOption(${JSON.stringify(label)})`;
34
+ }
35
+ if (fieldIds !== undefined || label !== undefined) {
36
+ return `${slot} uses raw option id ${JSON.stringify(id)}, which is no longer an option of field "${fieldName}", so the option no longer exists. ` +
37
+ `It builds as written; select a current option with filter.textOption("<label>")`;
38
+ }
39
+ return `${slot} uses raw option id ${JSON.stringify(id)} on field "${fieldName}", whose label is not known locally. ` +
40
+ `Raw ids still build; the preferred form is filter.textOption("<label>")`;
41
+ }
@@ -1,4 +1,7 @@
1
- import { isTfExpr, ownerFromScopedChildLabel, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
1
+ import { isTfExpr, ownerFromScopedChildLabel, tfLabelToTsLabel } from "../../engine/tf/index.js";
2
+ import { SYSTEM_FIELD_KEY_SET } from "../../core/system-fields.js";
3
+ import { bagKeyForPulledCustomField } from "../field/from-tf.js";
4
+ import { ELEMENT_SYSTEM_FIELD_KEYS } from "../element/system-fields.js";
2
5
  import { SUB_TYPE_BY_RESOURCE as FIELD_SUB_TYPE_BY_RESOURCE } from "../field/types.js";
3
6
  export function resolveToolFieldKey(fieldRef, scopeTfLabel, scope = "app", ctx) {
4
7
  if (fieldRef === undefined)
@@ -8,7 +11,8 @@ export function resolveToolFieldKey(fieldRef, scopeTfLabel, scope = "app", ctx)
8
11
  // into a key on this tool's target (edk#1403 review S1).
9
12
  if (toolFieldRefOtherOwner(fieldRef, scopeTfLabel, scope) !== undefined)
10
13
  return undefined;
11
- return scopedLabelToBagKey(scopeTfLabel, fieldRef.label, scope);
14
+ const reserved = scope === "element" ? new Set(ELEMENT_SYSTEM_FIELD_KEYS) : SYSTEM_FIELD_KEY_SET;
15
+ return bagKeyForPulledCustomField(scopeTfLabel, fieldRef.label, scope, reserved);
12
16
  }
13
17
  if (isTfExpr(fieldRef) && fieldRef.$expr === "data-attr" && fieldRef.type === "elementum_field") {
14
18
  const fieldAttrs = ctx?.dataAttrs?.("elementum_field", fieldRef.label);
@@ -104,10 +104,13 @@ export function formatSkillLookupNotes(lookups) {
104
104
  return lines.join("\n");
105
105
  }
106
106
  export function deriveSkillInstructions(baseProse, inputs, lookups) {
107
- const raw = baseProse?.trim() ?? "";
107
+ // With nothing to generate, send the text exactly as written: pull keeps the
108
+ // platform's instructions byte for byte, so trimming here planned a diff for
109
+ // every skill whose instructions end in a newline (edk#2512).
108
110
  if (inputs === undefined && lookups === undefined) {
109
- return raw;
111
+ return baseProse ?? "";
110
112
  }
113
+ const raw = baseProse?.trim() ?? "";
111
114
  const decomposed = decomposeSkillInstructions(raw);
112
115
  const effectiveInputs = inputs !== undefined
113
116
  ? inputs