@elementumai/edk 0.13.3 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-sdk/src/catalog/factories.d.ts +4 -2
- package/dist-sdk/src/catalog/factories.js +3 -1
- package/dist-sdk/src/catalog/from-authoring.d.ts +8 -3
- package/dist-sdk/src/catalog/from-authoring.js +21 -8
- package/dist-sdk/src/engine/build/context.d.ts +17 -0
- package/dist-sdk/src/engine/coverage-gaps.d.ts +13 -0
- package/dist-sdk/src/engine/coverage-gaps.js +21 -0
- package/dist-sdk/src/engine/pull/context.d.ts +57 -1
- package/dist-sdk/src/engine/pull/context.js +9 -1
- package/dist-sdk/src/engine/pull/pulled-roots.d.ts +14 -1
- package/dist-sdk/src/engine/pull/pulled-roots.js +23 -3
- package/dist-sdk/src/engine/pull/ref-only.d.ts +6 -1
- package/dist-sdk/src/engine/pull/ref-only.js +4 -1
- package/dist-sdk/src/engine/pull/stream-root.d.ts +17 -1
- package/dist-sdk/src/engine/pull/stream-root.js +57 -4
- package/dist-sdk/src/engine/tf/index.d.ts +1 -0
- package/dist-sdk/src/engine/tf/index.js +1 -0
- package/dist-sdk/src/engine/tf/jsonencode.d.ts +19 -0
- package/dist-sdk/src/engine/tf/jsonencode.js +49 -0
- package/dist-sdk/src/engine/validation.d.ts +36 -1
- package/dist-sdk/src/engine/validation.js +56 -2
- package/dist-sdk/src/engine/workspace/loader.d.ts +6 -0
- package/dist-sdk/src/engine/workspace/loader.js +87 -2
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +7 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +58 -17
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +3 -1
- package/dist-sdk/src/entities/access-policy/to-tf.js +1 -1
- package/dist-sdk/src/entities/agent/build.d.ts +15 -0
- package/dist-sdk/src/entities/agent/build.js +139 -16
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +3 -3
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +39 -25
- package/dist-sdk/src/entities/agent/module.js +95 -3
- package/dist-sdk/src/entities/agent/to-tf.js +6 -4
- package/dist-sdk/src/entities/agent-evaluation/from-tf.d.ts +7 -0
- package/dist-sdk/src/entities/agent-evaluation/from-tf.js +14 -5
- package/dist-sdk/src/entities/agent-evaluation/module.js +4 -2
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +11 -2
- package/dist-sdk/src/entities/agent-tool/from-tf.js +38 -40
- package/dist-sdk/src/entities/agent-tool/to-tf.js +12 -5
- package/dist-sdk/src/entities/app/build.d.ts +1 -1
- package/dist-sdk/src/entities/app/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/approval-trigger-refs.d.ts +20 -0
- package/dist-sdk/src/entities/automation/approval-trigger-refs.js +83 -0
- package/dist-sdk/src/entities/automation/build.d.ts +75 -42
- package/dist-sdk/src/entities/automation/build.js +18 -8
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +14 -2
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +9 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +64 -12
- package/dist-sdk/src/entities/automation/from-tf.d.ts +53 -0
- package/dist-sdk/src/entities/automation/from-tf.js +579 -106
- package/dist-sdk/src/entities/automation/index.d.ts +2 -2
- package/dist-sdk/src/entities/automation/index.js +1 -1
- package/dist-sdk/src/entities/automation/lookup-owner.d.ts +23 -0
- package/dist-sdk/src/entities/automation/lookup-owner.js +27 -0
- package/dist-sdk/src/entities/automation/module.js +265 -26
- package/dist-sdk/src/entities/automation/operators.d.ts +6 -2
- package/dist-sdk/src/entities/automation/operators.js +0 -2
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +8 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +11 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +37 -2
- package/dist-sdk/src/entities/automation/tasks.js +38 -1
- package/dist-sdk/src/entities/automation/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/automation/to-tf.js +576 -52
- package/dist-sdk/src/entities/automation/triggers.d.ts +47 -1
- package/dist-sdk/src/entities/automation/unsafe-script-output.d.ts +10 -5
- package/dist-sdk/src/entities/automation/unsafe-script-output.js +10 -5
- package/dist-sdk/src/entities/chart/to-tf.js +18 -5
- package/dist-sdk/src/entities/dashboard/from-tf.js +45 -11
- package/dist-sdk/src/entities/dashboard-widget-order/order.d.ts +5 -3
- package/dist-sdk/src/entities/dashboard-widget-order/order.js +6 -4
- package/dist-sdk/src/entities/datamine/from-tf.js +10 -3
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +38 -11
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +35 -7
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +101 -9
- package/dist-sdk/src/entities/element/build.d.ts +4 -1
- package/dist-sdk/src/entities/element/build.js +3 -4
- package/dist-sdk/src/entities/element/index.d.ts +1 -1
- package/dist-sdk/src/entities/field/from-tf.js +8 -1
- package/dist-sdk/src/entities/field/to-tf.d.ts +29 -2
- package/dist-sdk/src/entities/field/to-tf.js +106 -7
- package/dist-sdk/src/entities/phone-service/from-tf.d.ts +7 -0
- package/dist-sdk/src/entities/phone-service/from-tf.js +15 -7
- package/dist-sdk/src/entities/phone-service/module.js +4 -2
- package/dist-sdk/src/entities/portal/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/portal/to-tf.js +61 -2
- package/dist-sdk/src/entities/record-create-form/from-tf.js +3 -1
- package/dist-sdk/src/entities/relationship/from-tf.js +34 -4
- package/dist-sdk/src/entities/relationship/to-tf.js +24 -6
- package/dist-sdk/src/entities/role/from-tf.js +3 -1
- package/dist-sdk/src/entities/search-table/from-tf.d.ts +3 -1
- package/dist-sdk/src/entities/search-table/from-tf.js +6 -3
- package/dist-sdk/src/entities/search-table/module.js +18 -2
- package/dist-sdk/src/entities/search-table/to-tf.js +10 -16
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +6 -1
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +6 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +21 -4
- package/dist-sdk/src/entities/shared/filters/index.js +27 -3
- package/dist-sdk/src/entities/shared/filters/print.js +23 -7
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +24 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +98 -3
- package/dist-sdk/src/entities/shared/filters/types.d.ts +8 -1
- package/dist-sdk/src/entities/shared/run-automation-requirement.d.ts +15 -0
- package/dist-sdk/src/entities/shared/run-automation-requirement.js +28 -0
- package/dist-sdk/src/entities/shared/search-table-address.d.ts +17 -0
- package/dist-sdk/src/entities/shared/search-table-address.js +24 -0
- package/dist-sdk/src/entities/shared/skip-release.d.ts +49 -0
- package/dist-sdk/src/entities/shared/skip-release.js +74 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +3 -3
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +11 -5
- package/dist-sdk/src/entities/skill/module.js +3 -25
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +4 -2
- package/dist-sdk/src/entities/skill-tool/from-tf.js +28 -27
- package/dist-sdk/src/entities/skill-tool/to-tf.js +12 -5
- package/dist-sdk/src/entities/skill-tool/types.d.ts +1 -0
- package/dist-sdk/src/entities/skill-tool/types.js +2 -1
- package/dist-sdk/src/entities/table/catalog.d.ts +16 -0
- package/dist-sdk/src/entities/table/catalog.js +44 -2
- package/dist-sdk/src/entities/table/from-tf.js +30 -4
- package/dist-sdk/src/entities/table/keys.d.ts +27 -0
- package/dist-sdk/src/entities/table/keys.js +46 -0
- package/dist-sdk/src/entities/table/to-tf.js +2 -2
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +12 -1
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +9 -4
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +215 -10
- package/dist-sdk/src/entities/view/agent-view-layout.d.ts +10 -4
- package/dist-sdk/src/entities/view/custom-view-runtime-rules.d.ts +43 -0
- package/dist-sdk/src/entities/view/custom-view-runtime-rules.js +285 -0
- package/dist-sdk/src/entities/view/custom-view-validate.d.ts +3 -1
- package/dist-sdk/src/entities/view/custom-view-validate.js +24 -5
- package/dist-sdk/src/entities/view/from-tf.js +14 -1
- package/dist-sdk/src/entities/widget/from-tf.js +14 -7
- package/dist-sdk/src/entities/widget/to-tf.js +9 -6
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +4 -2
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +14 -1
- package/dist-sdk/src/graph/index.js +2 -0
- package/dist-sdk/src/graph/resource-types.d.ts +2 -0
- package/dist-sdk/src/graph/resource-types.js +3 -0
- package/dist-sdk/src/graph/types.d.ts +105 -0
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { reportUnknownAttrs } from "../../engine/pull/attrs.js";
|
|
|
3
3
|
import { scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
4
4
|
import { elementAuditFieldReference, fieldKeyFromTfValue } from "../field/from-tf.js";
|
|
5
5
|
import { unextractedFieldRefId } from "../view/from-tf.js";
|
|
6
|
+
import { skipAndRelease } from "../shared/skip-release.js";
|
|
6
7
|
import { RECORD_CREATE_FORM_RESOURCE_TYPE } from "./module.js";
|
|
7
8
|
const KNOWN_ATTRS = new Set(["app_id", "sections"]);
|
|
8
9
|
const KNOWN_SECTION_ATTRS = new Set([
|
|
@@ -21,7 +22,8 @@ export function recordCreateFormFromTf(block, owner, ctx) {
|
|
|
21
22
|
}
|
|
22
23
|
const rawSections = block.attrs["sections"];
|
|
23
24
|
if (!Array.isArray(rawSections)) {
|
|
24
|
-
|
|
25
|
+
// Written to no source, so also left out of adoption (edk#3172).
|
|
26
|
+
skipAndRelease(ctx, `${RECORD_CREATE_FORM_RESOURCE_TYPE}.${block.label ?? ""}`, { problem: "its sections is not a list" }, `${where}: sections is not a list; skipped`);
|
|
25
27
|
return undefined;
|
|
26
28
|
}
|
|
27
29
|
const sections = [];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { dataRefLabel, reportAuthoringBlocker, resourceRefLabel } from "../../engine/pull/context.js";
|
|
2
|
+
import { skipAndRelease, unresolvedReferenceName } from "../shared/skip-release.js";
|
|
2
3
|
import { expr, isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel, } from "../../engine/tf/index.js";
|
|
3
|
-
import { filterFromTf } from "../access-policy/from-tf.js";
|
|
4
|
+
import { filterFromTf, filterFromTfOfOwners } from "../access-policy/from-tf.js";
|
|
4
5
|
import { decodeForeignDataField, elementAuditFieldReference, fieldKeyFromTfRef, fieldKeyFromTfValue } from "../field/from-tf.js";
|
|
5
6
|
import { resolveDataAspectTarget, resolveDataTaskTarget } from "../shared/aspect-target-from-tf.js";
|
|
6
7
|
import { SUB_TYPE_BY_RESOURCE } from "../field/types.js";
|
|
@@ -27,14 +28,17 @@ function relationshipFromTf(block, owner, ctx) {
|
|
|
27
28
|
ctx.diagnostics.push(`${where}: object_id does not reference ${ownerResourceType}.${owner.label}; skipped`);
|
|
28
29
|
return undefined;
|
|
29
30
|
}
|
|
31
|
+
// A relationship written to no source is also left out of adoption, or
|
|
32
|
+
// the next plan destroys it (edk#3166).
|
|
33
|
+
const address = `${RELATIONSHIP_RESOURCE_TYPE}.${block.label ?? ""}`;
|
|
30
34
|
const target = targetRef(block.attrs["related_object_id"], owner, ctx);
|
|
31
35
|
if (target === undefined) {
|
|
32
|
-
ctx.
|
|
36
|
+
skipAndRelease(ctx, address, { reference: unresolvedReferenceName(block.attrs["related_object_id"], "related_object_id") }, `${where}: related_object_id is not resolvable; skipped`);
|
|
33
37
|
return undefined;
|
|
34
38
|
}
|
|
35
39
|
const columnsRaw = block.attrs["columns"];
|
|
36
40
|
if (!Array.isArray(columnsRaw)) {
|
|
37
|
-
ctx
|
|
41
|
+
skipAndRelease(ctx, address, { problem: "the export doesn't give its columns as a list" }, `${where}: columns is not a list; skipped`);
|
|
38
42
|
return undefined;
|
|
39
43
|
}
|
|
40
44
|
const columns = [];
|
|
@@ -121,7 +125,7 @@ function relationshipFromTf(block, owner, ctx) {
|
|
|
121
125
|
try {
|
|
122
126
|
if (targetFilterOwner === undefined)
|
|
123
127
|
throw ownerErr;
|
|
124
|
-
filter =
|
|
128
|
+
filter = targetOrBothSidesFilter(block.attrs["filter"], ownerFilterOwner, targetFilterOwner, `${where}.filter`, ctx);
|
|
125
129
|
}
|
|
126
130
|
catch (targetErr) {
|
|
127
131
|
// Neither side decodes the filter. Writing the relationship with no
|
|
@@ -143,6 +147,28 @@ function relationshipFromTf(block, owner, ctx) {
|
|
|
143
147
|
}
|
|
144
148
|
return { key, target, columns, ...(filter !== undefined && { filter }) };
|
|
145
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* A relationship filter over the target's fields, else over both sides'. A
|
|
152
|
+
* condition can compare a field of one side with a field of the other ("PR
|
|
153
|
+
* ID equals the related record's ID"), and the platform keeps that same
|
|
154
|
+
* filter on both sides, so each field resolves against the side it belongs
|
|
155
|
+
* to (#3144). Only a filter neither side decodes alone reaches the second
|
|
156
|
+
* decode, so every one-sided filter decodes as before; when that fails too,
|
|
157
|
+
* the target's error stands.
|
|
158
|
+
*/
|
|
159
|
+
function targetOrBothSidesFilter(value, owner, target, where, ctx) {
|
|
160
|
+
try {
|
|
161
|
+
return filterFromTf(value, target, where, ctx);
|
|
162
|
+
}
|
|
163
|
+
catch (targetErr) {
|
|
164
|
+
try {
|
|
165
|
+
return filterFromTfOfOwners(value, [owner, target], where, ctx);
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
throw targetErr;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
146
172
|
function filterOwnerForTarget(target, ctx) {
|
|
147
173
|
return target.kind === "app" || target.kind === "element"
|
|
148
174
|
? {
|
|
@@ -263,6 +289,10 @@ function targetResourceType(target) {
|
|
|
263
289
|
function relatedFieldRef(value, target, ctx) {
|
|
264
290
|
if (value === undefined)
|
|
265
291
|
return undefined;
|
|
292
|
+
// Not reached from a live export: the platform refuses an object's own id as
|
|
293
|
+
// a join column's related field ("Field with ID ... was not found", #3203),
|
|
294
|
+
// and a join on the target's ID field exports as that field. Kept for HCL
|
|
295
|
+
// written by hand; build turns recordIdentity into the target's ID field.
|
|
266
296
|
if (isTfExpr(value) && (value.$expr === "resource-attr" || value.$expr === "data-attr") && value.path.length === 1 && value.path[0] === "id") {
|
|
267
297
|
const targetType = target.kind === "app"
|
|
268
298
|
? "elementum_app"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { workspaceAspectKey, } from "../../engine/build/context.js";
|
|
2
|
-
import { expr, isCanonicalTsLabel, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
2
|
+
import { expr, isTfExpr, isCanonicalTsLabel, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
3
3
|
import { filterToTf } from "../access-policy/to-tf.js";
|
|
4
4
|
import { foreignFieldDataLabel, resolveForeignRef } from "../shared/foreign-ref.js";
|
|
5
|
-
import {
|
|
5
|
+
import { droppedEntryGap, fieldLookupName, fieldRefToTfValue, siblingFieldOwnership, skippedResourceGap, unauthoredSiblingFieldRef, UNRESOLVED_FIELD_REF, } from "../field/to-tf.js";
|
|
6
6
|
import { SYSTEM_FIELD_ID_ATTR_BY_KEY } from "../view/types.js";
|
|
7
7
|
import { ELEMENT_SYSTEM_FIELD_KEYS } from "../element/system-fields.js";
|
|
8
8
|
import { autoRelationColumnError } from "./column-contract.js";
|
|
@@ -176,7 +176,10 @@ function resolveTarget(value, where, opts) {
|
|
|
176
176
|
refName,
|
|
177
177
|
tfLabel: sibling.tfLabel,
|
|
178
178
|
managed: true,
|
|
179
|
-
|
|
179
|
+
// Each related field resolves to the address the sibling's own build
|
|
180
|
+
// gives it, whatever type the reference carries, so both sides of a
|
|
181
|
+
// pair name the same field (#3075).
|
|
182
|
+
fieldOwnership: siblingFieldOwnership(sibling.streamRootEntity?.payload, sibling.tfLabel, kind),
|
|
180
183
|
};
|
|
181
184
|
}
|
|
182
185
|
}
|
|
@@ -225,7 +228,7 @@ function unauthoredRelatedField(value, target, opts) {
|
|
|
225
228
|
const refName = value.refName ?? "";
|
|
226
229
|
if (refName === "" || (value.parent !== undefined && value.parent !== target.refName))
|
|
227
230
|
return undefined;
|
|
228
|
-
const reason = unauthoredSiblingFieldRef(refName, { kind: target.kind, refName: target.refName, fieldOwnership: target.fieldOwnership });
|
|
231
|
+
const reason = unauthoredSiblingFieldRef(refName, { kind: target.kind, refName: target.refName, fieldOwnership: target.fieldOwnership }, fieldLookupName(value));
|
|
229
232
|
return reason === undefined ? undefined : { reason, name: fieldLookupName(value) };
|
|
230
233
|
}
|
|
231
234
|
function resolveRelatedField(value, target, where, opts) {
|
|
@@ -249,7 +252,22 @@ function resolveRelatedField(value, target, where, opts) {
|
|
|
249
252
|
opts.diagnostics.push(`${where}: record identity target does not match relationship target; dropped`);
|
|
250
253
|
return undefined;
|
|
251
254
|
}
|
|
252
|
-
|
|
255
|
+
// A join column names a field: a record's identity is its system ID
|
|
256
|
+
// (HANDLE) field. The target's own id is not a field, and the platform
|
|
257
|
+
// refuses it ("Field with ID ... was not found").
|
|
258
|
+
// Fail rather than drop the column: a join that loses a column applies
|
|
259
|
+
// with a looser match.
|
|
260
|
+
if (target.kind === "table") {
|
|
261
|
+
throw new EntityTfError(`${where}: recordIdentity(<table>): a table has no record identity; name the table's ID column instead`);
|
|
262
|
+
}
|
|
263
|
+
// A task can rename its ID field, so read the managed task's own id_field_id
|
|
264
|
+
// rather than looking the field up by name.
|
|
265
|
+
if (target.kind === "task" && target.managed && isTfExpr(target.value) && target.value.$expr === "resource-attr") {
|
|
266
|
+
return expr.resourceAttr(target.value.type, target.value.label, ["id_field_id"]);
|
|
267
|
+
}
|
|
268
|
+
// A managed app or element builds its id field local; any other target
|
|
269
|
+
// looks the field up by its default name "ID".
|
|
270
|
+
return resolveRelatedField({ __kind: "field", refName: "id", name: "ID", fieldType: "HANDLE" }, target, where, opts);
|
|
253
271
|
}
|
|
254
272
|
const refName = value?.refName ?? "";
|
|
255
273
|
if (refName === "") {
|
|
@@ -266,7 +284,7 @@ function resolveRelatedField(value, target, where, opts) {
|
|
|
266
284
|
target.kind !== "table" &&
|
|
267
285
|
(target.kind !== "task" || target.fieldOwnership?.has(refName) === true) &&
|
|
268
286
|
target.tfLabel !== undefined) {
|
|
269
|
-
const direct = fieldRefToTfValue(value?.fieldType ?? "", refName, target.tfLabel, target.kind, target.fieldOwnership);
|
|
287
|
+
const direct = fieldRefToTfValue(value?.fieldType ?? "", refName, target.tfLabel, target.kind, target.fieldOwnership, undefined, value === undefined ? undefined : fieldLookupName(value));
|
|
270
288
|
if (direct !== undefined)
|
|
271
289
|
return direct;
|
|
272
290
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { dataRefLabel, groupCatalogKey, resourceRefLabel } from "../../engine/pull/context.js";
|
|
2
2
|
import { scopedLabelToBagKey } from "../../engine/tf/index.js";
|
|
3
3
|
import { ROLE_RESOURCE_TYPE } from "../org/role.js";
|
|
4
|
+
import { skipAndRelease } from "../shared/skip-release.js";
|
|
4
5
|
import { finishPulledMemberList } from "../access-policy/member-list.js";
|
|
5
6
|
import { serviceAccountAppRefName } from "../access-policy/from-tf.js";
|
|
6
7
|
const KNOWN = new Set(["id", "object_id", "name", "description", "auto_share", "user_ids", "group_ids", "service_account_ids", "permissions", "managed", "tags"]);
|
|
@@ -90,7 +91,8 @@ export function rolesFromTf(blocks, owner, ctx) {
|
|
|
90
91
|
if (!KNOWN.has(key))
|
|
91
92
|
ctx.diagnostics.push(`${where}: unhandled attribute ${JSON.stringify(key)}`);
|
|
92
93
|
if (typeof block.attrs["name"] !== "string") {
|
|
93
|
-
|
|
94
|
+
// Written to no source, so also left out of adoption (edk#3172).
|
|
95
|
+
skipAndRelease(ctx, `${ROLE_RESOURCE_TYPE}.${label}`, { problem: "its name is not text" }, `${where}: name is required; skipped`);
|
|
94
96
|
return [];
|
|
95
97
|
}
|
|
96
98
|
const autoShare = strings(block.attrs["auto_share"], `${where}.auto_share`, ctx);
|
|
@@ -35,4 +35,6 @@ export interface NormalizedTableSearchTable {
|
|
|
35
35
|
readonly creationTimeout?: string;
|
|
36
36
|
}
|
|
37
37
|
export type NormalizedSearchTable = NormalizedSnowflakeSearchTable | NormalizedLinkedSearchTable | NormalizedTableSearchTable;
|
|
38
|
-
export declare function searchTableFromTf(block: TfBlock, ownerTfLabel: string, scope: ChildResourceScope | "table", ctx: FromTfContext
|
|
38
|
+
export declare function searchTableFromTf(block: TfBlock, ownerTfLabel: string, scope: ChildResourceScope | "table", ctx: FromTfContext,
|
|
39
|
+
/** A table-owned search table's columns: display name → the key its table's source gives each one (#3167). */
|
|
40
|
+
columnKeyByName?: ReadonlyMap<string, string>): NormalizedSearchTable;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { EntityTfError } from "../../engine/entity.js";
|
|
2
2
|
import { resourceRefLabel } from "../../engine/pull/context.js";
|
|
3
|
-
import { isTfExpr,
|
|
3
|
+
import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel, } from "../../engine/tf/index.js";
|
|
4
4
|
import { fieldKeyFromTfValue } from "../field/from-tf.js";
|
|
5
5
|
import { KNOWN_SEARCH_TABLE_ATTRS, SEARCH_TABLE_VARIANT_BY_RESOURCE } from "./types.js";
|
|
6
|
+
import { tableColumnKey } from "../table/keys.js";
|
|
6
7
|
import { connectorIdentityFromTf } from "../shared/connector-from-tf.js";
|
|
7
8
|
function requiredString(attrs, key, where) {
|
|
8
9
|
const value = attrs[key];
|
|
@@ -35,7 +36,9 @@ function connectorKey(value, ctx, where) {
|
|
|
35
36
|
}
|
|
36
37
|
return identity.catalogKey;
|
|
37
38
|
}
|
|
38
|
-
export function searchTableFromTf(block, ownerTfLabel, scope, ctx
|
|
39
|
+
export function searchTableFromTf(block, ownerTfLabel, scope, ctx,
|
|
40
|
+
/** A table-owned search table's columns: display name → the key its table's source gives each one (#3167). */
|
|
41
|
+
columnKeyByName) {
|
|
39
42
|
const label = block.label;
|
|
40
43
|
if (label === undefined || label === "")
|
|
41
44
|
throw new EntityTfError(`${block.type} block is missing its label`);
|
|
@@ -53,7 +56,7 @@ export function searchTableFromTf(block, ownerTfLabel, scope, ctx) {
|
|
|
53
56
|
const index = value.path[1];
|
|
54
57
|
if (typeof index !== "object")
|
|
55
58
|
throw new EntityTfError(`${block.type}.${label}: table column reference has no key`);
|
|
56
|
-
return
|
|
59
|
+
return columnKeyByName?.get(index.index) ?? tableColumnKey(index.index);
|
|
57
60
|
};
|
|
58
61
|
const attrs = block.attrs["attribute_field_ids"];
|
|
59
62
|
if (!Array.isArray(attrs))
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { rootParentFactoryEntry } from "../../catalog/render-helpers.js";
|
|
6
6
|
import { EntityTfError } from "../../engine/entity.js";
|
|
7
|
+
import { plainObject } from "../../engine/pull/context.js";
|
|
8
|
+
import { tableColumnKeysByName } from "../table/keys.js";
|
|
7
9
|
import { searchTableFromTf } from "./from-tf.js";
|
|
8
10
|
import { printSearchTable } from "./printer.js";
|
|
9
11
|
import { searchTableToTf } from "./to-tf.js";
|
|
@@ -53,13 +55,27 @@ function searchTableRefFromAuthoring(args) {
|
|
|
53
55
|
...(variant !== undefined && { __variant: variant }),
|
|
54
56
|
};
|
|
55
57
|
}
|
|
56
|
-
|
|
58
|
+
/** Display name → key of each column of the stream's table, as its own source keys them (#3167). */
|
|
59
|
+
function ownTableColumnKeys(stream) {
|
|
60
|
+
const fields = stream.byKind.get("table")?.[0]?.attrs["fields"];
|
|
61
|
+
if (!Array.isArray(fields))
|
|
62
|
+
return undefined;
|
|
63
|
+
return tableColumnKeysByName(fields.flatMap((field) => {
|
|
64
|
+
const name = plainObject(field)?.["name"];
|
|
65
|
+
return typeof name === "string" ? [name] : [];
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
function extractSearchTables(ownBlocks, stream, ctx) {
|
|
57
69
|
const items = [];
|
|
58
70
|
const skipped = [];
|
|
59
71
|
const diagnostics = [];
|
|
72
|
+
let columnKeys;
|
|
60
73
|
for (const block of ownBlocks) {
|
|
61
74
|
try {
|
|
62
|
-
|
|
75
|
+
const tableOwned = block.type === SEARCH_TABLE_RESOURCE_TYPES.table;
|
|
76
|
+
if (tableOwned)
|
|
77
|
+
columnKeys ??= ownTableColumnKeys(stream);
|
|
78
|
+
items.push(searchTableFromTf(block, ctx.appTfLabel, tableOwned ? "table" : ctx.parentScope, ctx, tableOwned ? columnKeys : undefined));
|
|
63
79
|
}
|
|
64
80
|
catch (err) {
|
|
65
81
|
const address = `${block.type}.${block.label ?? ""}`;
|
|
@@ -15,18 +15,6 @@ function fieldValue(token, ctx, where) {
|
|
|
15
15
|
throw new EntityTfError(`${where}: field ${token.refName} has no Terraform resource mapping`);
|
|
16
16
|
return value;
|
|
17
17
|
}
|
|
18
|
-
/**
|
|
19
|
-
* The platform indexes the owner's record ID with every app or element search
|
|
20
|
-
* table and returns it first among the attribute fields, whether or not the
|
|
21
|
-
* source lists it. Build writes the same list, so a table that leaves out
|
|
22
|
-
* `fields.id` (or lists it later) doesn't plan a replacement on every apply,
|
|
23
|
-
* which `attribute_field_ids` forces on any difference (#2890).
|
|
24
|
-
*/
|
|
25
|
-
function withRecordIdFirst(attributes, ownerTfLabel) {
|
|
26
|
-
const recordId = expr.local(`${ownerTfLabel}_id_field_id`);
|
|
27
|
-
const key = JSON.stringify(recordId);
|
|
28
|
-
return [recordId, ...attributes.filter((value) => JSON.stringify(value) !== key)];
|
|
29
|
-
}
|
|
30
18
|
function connectorValue(token, ctx, where) {
|
|
31
19
|
const key = token?.parent !== undefined ? `${token.parent}.${token.refName ?? ""}` : token?.refName ?? "";
|
|
32
20
|
const resolved = ctx.orgRefs.byTsLabel(CONNECTOR_ORG_BAG, key);
|
|
@@ -96,15 +84,21 @@ export function searchTableToTf(entity, ctx) {
|
|
|
96
84
|
throw new EntityTfError(`search table ${entity.refName}: Terraform supports exactly one vector index`);
|
|
97
85
|
const vectorField = fieldValue(index.fieldId, aspectCtx, `search table ${entity.refName}`);
|
|
98
86
|
if (JSON.stringify(vectorField) === JSON.stringify(expr.local(`${ctx.appTfLabel}_id_field_id`))) {
|
|
99
|
-
//
|
|
100
|
-
//
|
|
101
|
-
|
|
87
|
+
// The platform adds the record ID to every new app or element search
|
|
88
|
+
// table's attribute fields (#2890), and a vector field can't also be an
|
|
89
|
+
// attribute: say so here, naming it.
|
|
90
|
+
throw new EntityTfError(`search table ${entity.refName}: the platform adds the record ID (fields.id) to a search table's attribute fields, so it can't be the vector index field; index a text field`);
|
|
102
91
|
}
|
|
103
92
|
const attrs = {
|
|
104
93
|
object_id: objectId,
|
|
105
94
|
field_id: vectorField,
|
|
106
95
|
ai_provider_connector_id: connectorValue(index.aiProviderConnectorId, ctx, `search table ${entity.refName}`),
|
|
107
|
-
|
|
96
|
+
// Exactly the authored list: pull prints the live attributes, which hold the
|
|
97
|
+
// record ID only when the platform added it (tables made before February
|
|
98
|
+
// 2026 don't have it), and the provider doesn't count the record ID the
|
|
99
|
+
// platform put first as a change when the source leaves it out or lists it
|
|
100
|
+
// later (#2890, #3086).
|
|
101
|
+
attribute_field_ids: (payload.attributeFieldIds ?? []).map((field) => fieldValue(field, aspectCtx, `search table ${entity.refName}`)),
|
|
108
102
|
duration: payload.duration ?? "DAYS",
|
|
109
103
|
target_lag: payload.targetLag ?? 1,
|
|
110
104
|
};
|
|
@@ -89,8 +89,13 @@ export function resolveDataTaskTarget(ctx, dataLabel) {
|
|
|
89
89
|
const attrs = ctx.dataAttrs?.("elementum_task", dataLabel);
|
|
90
90
|
const namespace = typeof attrs?.namespace === "string" ? attrs.namespace : undefined;
|
|
91
91
|
const name = ctx.dataName("elementum_task", dataLabel) ?? (typeof attrs?.name === "string" ? attrs.name : undefined);
|
|
92
|
+
// A task in the workspace first, then the export's ref-only root: the
|
|
93
|
+
// refName its fields' identities carry, so a relationship's target and its
|
|
94
|
+
// join fields name it alike (edk#3146). Only then the name-derived label.
|
|
92
95
|
const refName = (namespace !== undefined ? ctx.foreignTaskRefNamespaces?.get(namespace) : undefined)
|
|
93
|
-
?? (name !== undefined ? ctx.foreignTaskRefNames?.get(name) : undefined)
|
|
96
|
+
?? (name !== undefined ? ctx.foreignTaskRefNames?.get(name) : undefined)
|
|
97
|
+
?? (namespace !== undefined ? ctx.refOnlyTaskRefNamespaces?.get(namespace) : undefined)
|
|
98
|
+
?? (name !== undefined ? ctx.refOnlyTaskRefNames?.get(name) : undefined);
|
|
94
99
|
const key = refName ?? tfLabelToTsLabel(dataLabel);
|
|
95
100
|
return { key, name: name ?? key, ...(namespace !== undefined ? { namespace } : {}), catalogRef: true };
|
|
96
101
|
}
|
|
@@ -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:
|
|
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
|
|
@@ -94,8 +106,13 @@ export interface FieldLeftValue<Source extends FilterField = FilterField> {
|
|
|
94
106
|
readonly [FIELD_VALUE_SOURCE]?: Source;
|
|
95
107
|
}
|
|
96
108
|
export declare function fieldValue<Source extends FilterField>(value: Source): FieldLeftValue<Source>;
|
|
109
|
+
/**
|
|
110
|
+
* `aspect` (an app or element restriction by raw id) is refused: pull can't
|
|
111
|
+
* write it back to source without a platform id, so authoring it would
|
|
112
|
+
* produce source that no pull reproduces (#3144).
|
|
113
|
+
*/
|
|
97
114
|
export declare function fieldValue(value: FilterField, options?: {
|
|
98
|
-
readonly aspect?:
|
|
115
|
+
readonly aspect?: never;
|
|
99
116
|
readonly treatNullAsEquals?: boolean;
|
|
100
117
|
}): Extract<FilterValue<FilterField, FilterReferenceValue>, {
|
|
101
118
|
type: "FIELD";
|
|
@@ -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
|
}
|
|
@@ -104,10 +118,12 @@ export function currentUser(valueType = "ID") {
|
|
|
104
118
|
// Retain authoring-only type/options without adding them to the wire value.
|
|
105
119
|
const FIELD_VALUE_SOURCE = Symbol("FieldValueSource");
|
|
106
120
|
export function fieldValue(value, options) {
|
|
121
|
+
if (options?.aspect !== undefined) {
|
|
122
|
+
throw new EdkValidationError("filter.fieldValue: `aspect` is not supported; a field value restricted to an app or element has no portable form (#3144)");
|
|
123
|
+
}
|
|
107
124
|
const operand = {
|
|
108
125
|
type: "FIELD",
|
|
109
126
|
value: fieldWireValue(value),
|
|
110
|
-
...(options?.aspect !== undefined && { aspect: options.aspect }),
|
|
111
127
|
...(options?.treatNullAsEquals !== undefined && { treatNullAsEquals: options.treatNullAsEquals }),
|
|
112
128
|
};
|
|
113
129
|
Object.defineProperty(operand, FIELD_VALUE_SOURCE, { value });
|
|
@@ -188,8 +204,12 @@ function leftType(left, fallback, explicit) {
|
|
|
188
204
|
return leftType(sourceField(left), fallback, explicit);
|
|
189
205
|
if (explicit !== undefined)
|
|
190
206
|
return explicit;
|
|
191
|
-
if (isFilterReferenceInput(left))
|
|
207
|
+
if (isFilterReferenceInput(left)) {
|
|
208
|
+
if (left.valueType === "USER_GROUPS") {
|
|
209
|
+
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");
|
|
210
|
+
}
|
|
192
211
|
return left.valueType;
|
|
212
|
+
}
|
|
193
213
|
if (isRef(left) || typeof left === "string" || isUnsafePlatformId(left))
|
|
194
214
|
return fallback;
|
|
195
215
|
return fieldTypeToValueType(isAppField(left) ? left.type : "fieldType" in left ? left.fieldType : undefined);
|
|
@@ -224,8 +244,12 @@ function resolveStaticFieldValue(field, input) {
|
|
|
224
244
|
return picklistStaticValueToApiId(field, input);
|
|
225
245
|
}
|
|
226
246
|
export function toFilterValue(input, valueType = "TEXT") {
|
|
227
|
-
if (isCanonicalFilterValue(input))
|
|
247
|
+
if (isCanonicalFilterValue(input)) {
|
|
248
|
+
if (input.type === "FIELD" && input.aspect !== undefined) {
|
|
249
|
+
throw new EdkValidationError("a FIELD filter value can't name an app or element (`aspect`); it has no portable form (#3144)");
|
|
250
|
+
}
|
|
228
251
|
return input;
|
|
252
|
+
}
|
|
229
253
|
if (isCurrentUser(input))
|
|
230
254
|
return { type: "CURRENT_USER", valueType: input.valueType };
|
|
231
255
|
if (isUserRef(input)) {
|
|
@@ -122,13 +122,14 @@ function printFilterValue(value, codec, call, quote) {
|
|
|
122
122
|
case "BOOLEAN": return String(value.value);
|
|
123
123
|
case "NULL": return "null";
|
|
124
124
|
case "FIELD": {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
125
|
+
// `filter.fieldValue` refuses `aspect`, so it has no printed form (#3144).
|
|
126
|
+
if (value.aspect !== undefined)
|
|
127
|
+
throw new EntityTfError("a field filter value that names an app or element (aspect) has no printed form");
|
|
128
|
+
const field = codec.field(value.value);
|
|
129
|
+
if (value.treatNullAsEquals === undefined && printsAsFieldToken(field))
|
|
130
|
+
return field;
|
|
131
|
+
const options = value.treatNullAsEquals !== undefined ? [`treatNullAsEquals: ${value.treatNullAsEquals}`] : [];
|
|
132
|
+
return call("fieldValue", options.length === 0 ? field : `${field}, { ${options.join(", ")} }`);
|
|
132
133
|
}
|
|
133
134
|
case "CURRENT_USER": return call("currentUser", quote(value.valueType ?? "ID"));
|
|
134
135
|
case "USER": {
|
|
@@ -164,6 +165,11 @@ function printFilterValue(value, codec, call, quote) {
|
|
|
164
165
|
case "UUID":
|
|
165
166
|
helper = "uuid";
|
|
166
167
|
break;
|
|
168
|
+
case "USER_GROUPS":
|
|
169
|
+
if (value.multiple === true)
|
|
170
|
+
throw new EntityTfError("a user-groups filter value holds one user, never a list");
|
|
171
|
+
helper = "groupsOf";
|
|
172
|
+
break;
|
|
167
173
|
case undefined:
|
|
168
174
|
return `${codec.reference(value.value)}${options}`;
|
|
169
175
|
default: throw new Error(`unsupported filter reference type "${realType}"`);
|
|
@@ -188,3 +194,13 @@ function printFilterValue(value, codec, call, quote) {
|
|
|
188
194
|
}
|
|
189
195
|
}
|
|
190
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* Whether a printed field stands alone as a FIELD value. A quoted key or id
|
|
199
|
+
* would rebuild as a TEXT literal, and an `unsafePlatformId(...)` (a field
|
|
200
|
+
* pull couldn't name, such as a related record's field the export doesn't
|
|
201
|
+
* look up) is no comparison value at all, so either prints inside
|
|
202
|
+
* `fieldValue(...)` (#3144).
|
|
203
|
+
*/
|
|
204
|
+
function printsAsFieldToken(printed) {
|
|
205
|
+
return !/^["'`]/.test(printed) && !/(^|\.)unsafePlatformId\(/.test(printed);
|
|
206
|
+
}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
import { EntityTfError } from "../../../engine/entity.js";
|
|
1
2
|
import { type TfValue } from "../../../engine/tf/index.js";
|
|
2
3
|
import type { DateTimeUnit, Filter, LikeMode, ValueType } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* A filter value the platform holds but authored source can't, such as a
|
|
6
|
+
* FIELD value restricted to an app or element (`aspect`). A pull fails on it
|
|
7
|
+
* with an authoring blocker instead of dropping the filter, because writing
|
|
8
|
+
* the owner without it would remove the live filter on the next apply
|
|
9
|
+
* (#3144).
|
|
10
|
+
*/
|
|
11
|
+
export declare class UnauthorableFilterValueError extends EntityTfError {
|
|
12
|
+
constructor(message: string);
|
|
13
|
+
}
|
|
3
14
|
export type TfFilterType = "and" | "or" | "equals" | "greater_than" | "greater_than_equals" | "less_than" | "less_than_equals" | "like" | "in" | "between" | "contains" | "overlaps" | "is_null" | "current_range" | "consecutive_range" | "true" | "false";
|
|
4
15
|
type TfDateTimeUnit = Lowercase<DateTimeUnit>;
|
|
5
16
|
type TfLikeMode = Lowercase<LikeMode>;
|
|
@@ -117,6 +128,19 @@ export interface FilterToTfCodec {
|
|
|
117
128
|
* that authored type is kept as written.
|
|
118
129
|
*/
|
|
119
130
|
readonly referenceRealType?: (reference: unknown, role: "left" | "value", authored: string | undefined) => string | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* `filter.groupsOf(...)` is accepted only where the owner sets this: the
|
|
133
|
+
* platform expands USER_GROUPS in record search filters alone (edk#3039).
|
|
134
|
+
*/
|
|
135
|
+
readonly allowGroupsOf?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* The declared type of what a reference holds (`USER_ID`, `TEXT`, …), or
|
|
138
|
+
* undefined when the owner can't tell. `filter.groupsOf` needs a user id.
|
|
139
|
+
*/
|
|
140
|
+
readonly referenceDeclaredType?: (reference: unknown) => {
|
|
141
|
+
readonly type: string;
|
|
142
|
+
readonly multiple?: boolean;
|
|
143
|
+
} | undefined;
|
|
120
144
|
}
|
|
121
145
|
/** Which schema a filter's `field_id` addresses: app/element fields, or the fixed platform user / user-group directory. */
|
|
122
146
|
export type FilterFieldScope = "app" | "user" | "userGroup";
|