@elementumai/edk 0.9.6 → 0.9.9
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/README.md +34 -3
- package/dist-sdk/src/catalog/factories.d.ts +26 -6
- package/dist-sdk/src/catalog/factories.js +41 -6
- package/dist-sdk/src/catalog/from-authoring.js +27 -33
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +2 -2
- package/dist-sdk/src/catalog/org.js +93 -42
- package/dist-sdk/src/catalog/token.js +10 -0
- package/dist-sdk/src/catalog/types.d.ts +42 -3
- package/dist-sdk/src/catalog/types.js +5 -0
- package/dist-sdk/src/core/index.d.ts +2 -2
- package/dist-sdk/src/core/index.js +1 -1
- package/dist-sdk/src/core/platform-id.d.ts +2 -0
- package/dist-sdk/src/core/platform-id.js +4 -0
- package/dist-sdk/src/core/system-fields.d.ts +18 -0
- package/dist-sdk/src/core/system-fields.js +21 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +27 -24
- package/dist-sdk/src/core/triggers/on-demand.js +33 -12
- package/dist-sdk/src/core/types/app.d.ts +14 -9
- package/dist-sdk/src/core/types/aspect-category.d.ts +1 -0
- package/dist-sdk/src/core/types/aspect-category.js +1 -0
- package/dist-sdk/src/core/types/platform.d.ts +1 -1
- package/dist-sdk/src/engine/build/context.d.ts +24 -8
- package/dist-sdk/src/engine/build/source-context.d.ts +14 -17
- package/dist-sdk/src/engine/build/source-context.js +1 -1
- package/dist-sdk/src/engine/pull/context.d.ts +18 -0
- package/dist-sdk/src/engine/pull/org.d.ts +4 -0
- package/dist-sdk/src/engine/pull/org.js +17 -2
- package/dist-sdk/src/engine/pull/procedure-refs.d.ts +16 -0
- package/dist-sdk/src/engine/pull/procedure-refs.js +69 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +14 -0
- package/dist-sdk/src/engine/pull/ref-only.js +35 -2
- package/dist-sdk/src/engine/tf/expr.js +1 -1
- package/dist-sdk/src/engine/workspace/authoring-layout.d.ts +15 -0
- package/dist-sdk/src/engine/workspace/authoring-layout.js +33 -1
- package/dist-sdk/src/engine/workspace/loader.d.ts +40 -0
- package/dist-sdk/src/engine/workspace/loader.js +328 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +4 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +24 -4
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +7 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +11 -3
- package/dist-sdk/src/entities/agent/build.d.ts +54 -8
- package/dist-sdk/src/entities/agent/build.js +36 -1
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +144 -3
- package/dist-sdk/src/entities/agent/from-tf.d.ts +7 -6
- package/dist-sdk/src/entities/agent/from-tf.js +176 -5
- package/dist-sdk/src/entities/agent/index.d.ts +2 -2
- package/dist-sdk/src/entities/agent/index.js +1 -1
- package/dist-sdk/src/entities/agent/module.js +1 -0
- package/dist-sdk/src/entities/agent/to-tf.d.ts +5 -4
- package/dist-sdk/src/entities/agent/to-tf.js +186 -11
- package/dist-sdk/src/entities/agent/tools.d.ts +16 -5
- package/dist-sdk/src/entities/agent/tools.js +13 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +16 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +39 -6
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +12 -12
- package/dist-sdk/src/entities/agent-tool/types.js +1 -0
- package/dist-sdk/src/entities/app/build.d.ts +44 -24
- package/dist-sdk/src/entities/app/build.js +18 -8
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +15 -0
- package/dist-sdk/src/entities/app/display-blocks-to-layout.d.ts +45 -0
- package/dist-sdk/src/entities/app/display-blocks-to-layout.js +98 -0
- package/dist-sdk/src/entities/app/display-blocks-to-record-create-form.d.ts +55 -0
- package/dist-sdk/src/entities/app/display-blocks-to-record-create-form.js +99 -0
- package/dist-sdk/src/entities/app/from-tf.js +79 -14
- package/dist-sdk/src/entities/app/index.d.ts +3 -2
- package/dist-sdk/src/entities/app/index.js +2 -1
- package/dist-sdk/src/entities/app/to-tf.js +30 -6
- package/dist-sdk/src/entities/automation/build.d.ts +37 -18
- package/dist-sdk/src/entities/automation/build.js +121 -12
- package/dist-sdk/src/entities/automation/catalog-render.js +5 -2
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +8 -10
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +2 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +103 -20
- package/dist-sdk/src/entities/automation/from-tf.d.ts +10 -1
- package/dist-sdk/src/entities/automation/from-tf.js +1165 -91
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.js +15 -5
- package/dist-sdk/src/entities/automation/operators.d.ts +2 -2
- package/dist-sdk/src/entities/automation/operators.js +1 -0
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +17 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +45 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +20 -4
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +33 -6
- package/dist-sdk/src/entities/automation/script-code.d.ts +1 -1
- package/dist-sdk/src/entities/automation/script-code.js +168 -36
- package/dist-sdk/src/entities/automation/task-label.d.ts +2 -0
- package/dist-sdk/src/entities/automation/task-label.js +18 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +159 -45
- package/dist-sdk/src/entities/automation/tasks.js +60 -47
- package/dist-sdk/src/entities/automation/to-tf.d.ts +7 -1
- package/dist-sdk/src/entities/automation/to-tf.js +816 -87
- package/dist-sdk/src/entities/automation/triggers.d.ts +14 -5
- package/dist-sdk/src/entities/automation/triggers.js +1 -1
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +78 -0
- package/dist-sdk/src/entities/automation/value-ref-tf.js +193 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +1 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +1 -1
- package/dist-sdk/src/entities/element/build.d.ts +30 -7
- package/dist-sdk/src/entities/element/build.js +7 -3
- package/dist-sdk/src/entities/element/from-tf.js +7 -3
- package/dist-sdk/src/entities/element/index.d.ts +3 -2
- package/dist-sdk/src/entities/element/index.js +3 -2
- package/dist-sdk/src/entities/element/to-tf.js +49 -8
- package/dist-sdk/src/entities/field/build.d.ts +94 -3
- package/dist-sdk/src/entities/field/build.js +82 -3
- package/dist-sdk/src/entities/field/from-tf.d.ts +6 -0
- package/dist-sdk/src/entities/field/from-tf.js +104 -1
- package/dist-sdk/src/entities/field/locals.js +6 -7
- package/dist-sdk/src/entities/field/module.js +1 -0
- package/dist-sdk/src/entities/field/options.d.ts +2 -0
- package/dist-sdk/src/entities/field/options.js +12 -2
- package/dist-sdk/src/entities/field/record-shape.d.ts +12 -15
- package/dist-sdk/src/entities/field/to-tf.d.ts +13 -3
- package/dist-sdk/src/entities/field/to-tf.js +191 -56
- package/dist-sdk/src/entities/field/types.js +2 -0
- package/dist-sdk/src/entities/org/category-ref.d.ts +5 -0
- package/dist-sdk/src/entities/org/category-ref.js +12 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.js +3 -3
- package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/record-create-form/to-tf.js +18 -13
- package/dist-sdk/src/entities/relationship/from-tf.js +100 -7
- package/dist-sdk/src/entities/role/from-tf.js +10 -4
- package/dist-sdk/src/entities/search-table/build.d.ts +1 -1
- package/dist-sdk/src/entities/search-table/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/from-tf.js +6 -0
- package/dist-sdk/src/entities/search-table/printer.js +3 -1
- package/dist-sdk/src/entities/search-table/to-tf.js +3 -3
- package/dist-sdk/src/entities/search-table/types.js +1 -0
- package/dist-sdk/src/entities/service-account/from-tf.js +10 -4
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +2 -1
- package/dist-sdk/src/entities/service-account/to-tf.js +7 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +9 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +39 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +24 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +4 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +13 -2
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +14 -8
- package/dist-sdk/src/entities/shared/handle-description.d.ts +12 -0
- package/dist-sdk/src/entities/shared/handle-description.js +20 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +5 -3
- package/dist-sdk/src/entities/shared/tool-field-ref.js +11 -16
- package/dist-sdk/src/entities/shared/types/common.d.ts +7 -5
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +6 -1
- package/dist-sdk/src/entities/shared/types/field-types.js +5 -8
- package/dist-sdk/src/entities/shared/types/platform.d.ts +15 -2
- package/dist-sdk/src/entities/skill/build.d.ts +51 -2
- package/dist-sdk/src/entities/skill/build.js +65 -8
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +1 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +79 -18
- package/dist-sdk/src/entities/skill/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/skill/from-tf.js +47 -5
- package/dist-sdk/src/entities/skill/index.d.ts +1 -1
- package/dist-sdk/src/entities/skill/index.js +1 -1
- package/dist-sdk/src/entities/skill/input-coverage.d.ts +89 -0
- package/dist-sdk/src/entities/skill/input-coverage.js +327 -0
- package/dist-sdk/src/entities/skill/module.js +2 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +9 -25
- package/dist-sdk/src/entities/skill/to-tf.js +29 -40
- package/dist-sdk/src/entities/skill/tools.d.ts +12 -2
- package/dist-sdk/src/entities/skill/tools.js +3 -6
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +19 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +50 -14
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +9 -7
- package/dist-sdk/src/entities/skill-tool/to-tf.js +29 -23
- package/dist-sdk/src/entities/table/to-tf.js +21 -5
- package/dist-sdk/src/entities/task/to-tf.js +3 -2
- package/dist-sdk/src/entities/view/from-tf.js +36 -10
- package/dist-sdk/src/entities/view/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/view/to-tf.js +49 -30
- package/dist-sdk/src/entities/visual-flow/from-tf.js +6 -2
- package/dist-sdk/src/entities/widget/from-tf.js +2 -2
- package/dist-sdk/src/entities/widget/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/widget/to-tf.js +52 -23
- package/dist-sdk/src/graph/index.d.ts +19 -1
- package/dist-sdk/src/graph/index.js +20 -0
- package/dist-sdk/src/graph/types.d.ts +22 -0
- package/package.json +11 -5
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
* fields: {
|
|
7
7
|
* glamourShot: attachmentField({ name: "Glamour Shot" }),
|
|
8
8
|
* hasPetLlama: booleanField({ name: "Has Pet Llama", required: true }),
|
|
9
|
-
* club:
|
|
9
|
+
* club: dropdownField({
|
|
10
|
+
* name: "Club",
|
|
11
|
+
* config: { static: { values: ["FFA", "Rex Kwon Do"] } },
|
|
12
|
+
* }),
|
|
10
13
|
* }
|
|
11
14
|
*
|
|
12
15
|
* Each factory returns a plain {@link AppField} with the `type` discriminator
|
|
@@ -19,6 +22,8 @@ import type { AppOrElementRef, FieldRef } from "../../catalog/index.js";
|
|
|
19
22
|
import type { AppFieldOfExprType, CalculationInclude, Expr, ExprContext, ExprType, ExprTypeOf, FieldRefOfExprType } from "./calc/types.js";
|
|
20
23
|
import type { UnsafePlatformId } from "../../core/platform-id.js";
|
|
21
24
|
import type { AspectFieldQrFormat, AspectNumericFieldFormat } from "../../../elementum-entity-client/clients/aspects/models/format.js";
|
|
25
|
+
import type { Filter } from "../shared/filters/types.js";
|
|
26
|
+
import type { SortOrder } from "../shared/types/common.js";
|
|
22
27
|
/** Statically typed display options for NUMBER and DECIMAL fields. */
|
|
23
28
|
export type NumericFieldFormat = AspectNumericFieldFormat;
|
|
24
29
|
/** Statically typed QR display options for text fields. */
|
|
@@ -41,7 +46,7 @@ type WithExpression<T extends ExprType> = {
|
|
|
41
46
|
/** @deprecated Prefer `calculatedField({ name, expression })` for calculated values. */
|
|
42
47
|
readonly expression?: ScalarExpression<T>;
|
|
43
48
|
};
|
|
44
|
-
/**
|
|
49
|
+
/** @deprecated Use {@link DropdownFieldOptions} or {@link MultiSelectFieldOptions}. */
|
|
45
50
|
export interface PicklistFieldOptions extends BaseFieldOptions {
|
|
46
51
|
/** Static options; omit for dynamic picklists (`config.dynamic`). */
|
|
47
52
|
readonly options?: readonly (string | PicklistOption)[];
|
|
@@ -51,6 +56,71 @@ export interface PicklistFieldOptions extends BaseFieldOptions {
|
|
|
51
56
|
/** @deprecated Prefer `calculatedField({ name, expression })`. */
|
|
52
57
|
readonly expression?: ScalarExpression<"picklist" | "multiPicklist">;
|
|
53
58
|
}
|
|
59
|
+
/** Product-visible rendering modes for dynamically sourced values. */
|
|
60
|
+
export declare const dropdownDisplay: {
|
|
61
|
+
readonly dropdown: "DROPDOWN";
|
|
62
|
+
readonly table: "TABLE";
|
|
63
|
+
};
|
|
64
|
+
export type DropdownDisplay = (typeof dropdownDisplay)[keyof typeof dropdownDisplay];
|
|
65
|
+
/** A typed reference to a value on a parent Dropdown or Multi-Select field. */
|
|
66
|
+
export interface DropdownParentValueRef {
|
|
67
|
+
readonly __kind: "dropdownValue";
|
|
68
|
+
readonly field: FieldRef<string, string, "PICKLIST" | "MULTI_PICKLIST">;
|
|
69
|
+
readonly label: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Reference a static value on a parent selection field without exposing its
|
|
73
|
+
* platform UUID. The provider resolves the label through the parent's
|
|
74
|
+
* options-by-label local.
|
|
75
|
+
*/
|
|
76
|
+
export declare function dropdownValue(field: FieldRef<string, string, "PICKLIST" | "MULTI_PICKLIST">, label: string): DropdownParentValueRef;
|
|
77
|
+
/** Product-facing static value declaration shared by Dropdown and Multi-Select. */
|
|
78
|
+
export interface DropdownOption {
|
|
79
|
+
readonly label: string;
|
|
80
|
+
readonly active?: boolean;
|
|
81
|
+
readonly icon?: string;
|
|
82
|
+
readonly color?: string;
|
|
83
|
+
readonly tags?: readonly ("CLOSED" | "CRITICAL" | "HIGH" | "MEDIUM" | "LOW")[];
|
|
84
|
+
readonly availableWhen?: readonly DropdownParentValueRef[];
|
|
85
|
+
}
|
|
86
|
+
export declare function dropdownOption(option: DropdownOption): DropdownOption;
|
|
87
|
+
/** One parent/source-field equality used by a cascading dynamic selection field. */
|
|
88
|
+
export interface DynamicDropdownParentMapping {
|
|
89
|
+
readonly parentSourceField: FieldRef;
|
|
90
|
+
readonly sourceField: FieldRef;
|
|
91
|
+
}
|
|
92
|
+
export interface DynamicDropdownParent {
|
|
93
|
+
/** Dynamic parents are single-select Dropdown fields in the product UI. */
|
|
94
|
+
readonly field: FieldRef<string, string, "PICKLIST">;
|
|
95
|
+
readonly mappings: readonly DynamicDropdownParentMapping[];
|
|
96
|
+
}
|
|
97
|
+
export interface StaticDropdownConfig {
|
|
98
|
+
readonly values: readonly (string | DropdownOption)[];
|
|
99
|
+
readonly parent?: FieldRef<string, string, "PICKLIST" | "MULTI_PICKLIST">;
|
|
100
|
+
}
|
|
101
|
+
export interface DynamicDropdownConfig {
|
|
102
|
+
readonly source: AppOrElementRef | UnsafePlatformId;
|
|
103
|
+
readonly label: FieldRef | UnsafePlatformId;
|
|
104
|
+
readonly parent?: DynamicDropdownParent;
|
|
105
|
+
readonly autoRelate?: boolean;
|
|
106
|
+
readonly displayAs?: DropdownDisplay;
|
|
107
|
+
readonly filter?: Filter;
|
|
108
|
+
readonly sort?: readonly SortOrder<FieldRef | UnsafePlatformId>[];
|
|
109
|
+
}
|
|
110
|
+
/** Exactly one value source is required. */
|
|
111
|
+
export type DropdownConfig = {
|
|
112
|
+
readonly static: StaticDropdownConfig;
|
|
113
|
+
readonly dynamic?: never;
|
|
114
|
+
} | {
|
|
115
|
+
readonly static?: never;
|
|
116
|
+
readonly dynamic: DynamicDropdownConfig;
|
|
117
|
+
};
|
|
118
|
+
export interface DropdownFieldOptions extends BaseFieldOptions {
|
|
119
|
+
readonly config: DropdownConfig;
|
|
120
|
+
}
|
|
121
|
+
export interface MultiSelectFieldOptions extends BaseFieldOptions {
|
|
122
|
+
readonly config: DropdownConfig;
|
|
123
|
+
}
|
|
54
124
|
/** Extra options for the numeric kinds (`numberField` / `decimalField`). */
|
|
55
125
|
export interface NumericFieldOptions extends BaseFieldOptions {
|
|
56
126
|
readonly numericFormat?: NumericFieldFormat;
|
|
@@ -68,7 +138,7 @@ export interface TextFieldOptions extends BaseFieldOptions {
|
|
|
68
138
|
/**
|
|
69
139
|
* Options for `relationField` — a dynamic dropdown sourced from another
|
|
70
140
|
* App/Element/Task's records (`elementum_relation_field`), distinct from a
|
|
71
|
-
* static `
|
|
141
|
+
* static `dropdownField`. `relatedObject`/`relatedLabelField` (see
|
|
72
142
|
* {@link RelationAppField}) accept a catalog token or a raw platform id. A
|
|
73
143
|
* token naming a SIBLING app/element authored in the same build resolves
|
|
74
144
|
* to a direct resource reference and does not need to already exist on the
|
|
@@ -114,9 +184,30 @@ export declare function attachmentField(opts: BaseFieldOptions & WithExpression<
|
|
|
114
184
|
export declare function jsonField(opts: BaseFieldOptions & WithExpression<"json">): AppField & {
|
|
115
185
|
readonly type: "JSON";
|
|
116
186
|
};
|
|
187
|
+
/** A single-value Dropdown field, using the product's Static/Dynamic configuration model. */
|
|
188
|
+
type DynamicSelectionMarker<Config extends DropdownConfig> = Config extends {
|
|
189
|
+
readonly dynamic: DynamicDropdownConfig;
|
|
190
|
+
} ? {
|
|
191
|
+
readonly dynamicSource: true;
|
|
192
|
+
} : {
|
|
193
|
+
readonly dynamicSource?: never;
|
|
194
|
+
};
|
|
195
|
+
export declare function dropdownField<const Config extends DropdownConfig>(opts: Omit<DropdownFieldOptions, "config"> & {
|
|
196
|
+
readonly config: Config;
|
|
197
|
+
}): AppField & {
|
|
198
|
+
readonly type: "PICKLIST";
|
|
199
|
+
} & DynamicSelectionMarker<Config>;
|
|
200
|
+
/** A multiple-value Multi-Select field, using the product's Static/Dynamic configuration model. */
|
|
201
|
+
export declare function multiSelectField<const Config extends DropdownConfig>(opts: Omit<MultiSelectFieldOptions, "config"> & {
|
|
202
|
+
readonly config: Config;
|
|
203
|
+
}): AppField & {
|
|
204
|
+
readonly type: "MULTI_PICKLIST";
|
|
205
|
+
} & DynamicSelectionMarker<Config>;
|
|
206
|
+
/** @deprecated Use {@link dropdownField}. */
|
|
117
207
|
export declare function picklistField(opts: Omit<PicklistFieldOptions, "expression"> & WithExpression<"picklist">): AppField & {
|
|
118
208
|
readonly type: "PICKLIST";
|
|
119
209
|
};
|
|
210
|
+
/** @deprecated Use {@link multiSelectField}. */
|
|
120
211
|
export declare function multiPicklistField(opts: Omit<PicklistFieldOptions, "expression"> & WithExpression<"multiPicklist">): AppField & {
|
|
121
212
|
readonly type: "MULTI_PICKLIST";
|
|
122
213
|
};
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
* fields: {
|
|
7
7
|
* glamourShot: attachmentField({ name: "Glamour Shot" }),
|
|
8
8
|
* hasPetLlama: booleanField({ name: "Has Pet Llama", required: true }),
|
|
9
|
-
* club:
|
|
9
|
+
* club: dropdownField({
|
|
10
|
+
* name: "Club",
|
|
11
|
+
* config: { static: { values: ["FFA", "Rex Kwon Do"] } },
|
|
12
|
+
* }),
|
|
10
13
|
* }
|
|
11
14
|
*
|
|
12
15
|
* Each factory returns a plain {@link AppField} with the `type` discriminator
|
|
@@ -15,6 +18,22 @@
|
|
|
15
18
|
* AppField is accepted.
|
|
16
19
|
*/
|
|
17
20
|
import { coerce } from "./calc/runtime.js";
|
|
21
|
+
/** Product-visible rendering modes for dynamically sourced values. */
|
|
22
|
+
export const dropdownDisplay = {
|
|
23
|
+
dropdown: "DROPDOWN",
|
|
24
|
+
table: "TABLE",
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Reference a static value on a parent selection field without exposing its
|
|
28
|
+
* platform UUID. The provider resolves the label through the parent's
|
|
29
|
+
* options-by-label local.
|
|
30
|
+
*/
|
|
31
|
+
export function dropdownValue(field, label) {
|
|
32
|
+
return { __kind: "dropdownValue", field, label };
|
|
33
|
+
}
|
|
34
|
+
export function dropdownOption(option) {
|
|
35
|
+
return option;
|
|
36
|
+
}
|
|
18
37
|
// Generic over the literal type discriminator so a field factory's return
|
|
19
38
|
// type carries e.g. `type: "PICKLIST"`, not the widened `WorkflowFieldType`
|
|
20
39
|
// union — required for the live catalog path (`app`'s `.ref()`) to
|
|
@@ -57,9 +76,69 @@ export function attachmentField(opts) {
|
|
|
57
76
|
export function jsonField(opts) {
|
|
58
77
|
return field("JSON", opts);
|
|
59
78
|
}
|
|
79
|
+
function selectionFieldOptions(opts) {
|
|
80
|
+
const { config, ...base } = opts;
|
|
81
|
+
if (config.static !== undefined) {
|
|
82
|
+
const options = config.static.values.map((value) => {
|
|
83
|
+
if (typeof value === "string")
|
|
84
|
+
return value;
|
|
85
|
+
return {
|
|
86
|
+
label: value.label,
|
|
87
|
+
...(value.active !== undefined && { active: value.active }),
|
|
88
|
+
...(value.icon !== undefined && { icon: value.icon }),
|
|
89
|
+
...(value.color !== undefined && { color: value.color }),
|
|
90
|
+
...(value.tags !== undefined && { tags: value.tags }),
|
|
91
|
+
...(value.availableWhen !== undefined && { parentValues: value.availableWhen }),
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
...base,
|
|
96
|
+
options,
|
|
97
|
+
...(config.static.parent !== undefined && { parentField: config.static.parent }),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const dynamic = config.dynamic;
|
|
101
|
+
return {
|
|
102
|
+
...base,
|
|
103
|
+
config: {
|
|
104
|
+
dynamic: {
|
|
105
|
+
relatedAspectId: dynamic.source,
|
|
106
|
+
relatedLabelFieldId: dynamic.label,
|
|
107
|
+
...(dynamic.parent !== undefined && {
|
|
108
|
+
parentFieldId: dynamic.parent.field,
|
|
109
|
+
parentMappings: dynamic.parent.mappings.map((mapping) => ({
|
|
110
|
+
parentAspectFieldId: mapping.parentSourceField,
|
|
111
|
+
relatedAspectFieldId: mapping.sourceField,
|
|
112
|
+
})),
|
|
113
|
+
}),
|
|
114
|
+
...(dynamic.autoRelate !== undefined && { autoRelate: dynamic.autoRelate }),
|
|
115
|
+
...(dynamic.displayAs !== undefined && { valuesRenderType: dynamic.displayAs }),
|
|
116
|
+
...(dynamic.filter !== undefined && { filter: dynamic.filter }),
|
|
117
|
+
...(dynamic.sort !== undefined && { sort: { orders: dynamic.sort } }),
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export function dropdownField(opts) {
|
|
123
|
+
const built = field("PICKLIST", selectionFieldOptions(opts));
|
|
124
|
+
return {
|
|
125
|
+
...built,
|
|
126
|
+
...("dynamic" in opts.config ? { dynamicSource: true } : {}),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/** A multiple-value Multi-Select field, using the product's Static/Dynamic configuration model. */
|
|
130
|
+
export function multiSelectField(opts) {
|
|
131
|
+
const built = field("MULTI_PICKLIST", selectionFieldOptions(opts));
|
|
132
|
+
return {
|
|
133
|
+
...built,
|
|
134
|
+
...("dynamic" in opts.config ? { dynamicSource: true } : {}),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/** @deprecated Use {@link dropdownField}. */
|
|
60
138
|
export function picklistField(opts) {
|
|
61
139
|
return field("PICKLIST", opts);
|
|
62
140
|
}
|
|
141
|
+
/** @deprecated Use {@link multiSelectField}. */
|
|
63
142
|
export function multiPicklistField(opts) {
|
|
64
143
|
return field("MULTI_PICKLIST", opts);
|
|
65
144
|
}
|
|
@@ -103,7 +182,7 @@ export const FIELD_FACTORY_BY_TYPE = new Map([
|
|
|
103
182
|
["GROUP", "groupField"],
|
|
104
183
|
["ATTACHMENT", "attachmentField"],
|
|
105
184
|
["JSON", "jsonField"],
|
|
106
|
-
["PICKLIST", "
|
|
107
|
-
["MULTI_PICKLIST", "
|
|
185
|
+
["PICKLIST", "dropdownField"],
|
|
186
|
+
["MULTI_PICKLIST", "multiSelectField"],
|
|
108
187
|
["RELATION", "relationField"],
|
|
109
188
|
]);
|
|
@@ -29,3 +29,9 @@ export declare function fieldFromTf(block: TfBlock, owner: FieldOwner, ctx: From
|
|
|
29
29
|
* unknown resource type.
|
|
30
30
|
*/
|
|
31
31
|
export declare function fieldKeyFromTfRef(v: TfValue, ownerTfLabel?: string, scope?: ChildResourceScope): string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Resolve either a normal Terraform field reference or a raw platform field
|
|
34
|
+
* ID recovered from post-adoption state. The owner check prevents a UUID from
|
|
35
|
+
* one app or element from becoming a same-owner field token accidentally.
|
|
36
|
+
*/
|
|
37
|
+
export declare function fieldKeyFromTfValue(v: TfValue, ownerRefName: string, ownerTfLabel: string, scope: ChildResourceScope, ctx: FromTfContext): string | undefined;
|
|
@@ -101,7 +101,20 @@ function dynamicPicklistFilterFieldRef(value, ctx) {
|
|
|
101
101
|
if (typeof resolved === "string")
|
|
102
102
|
return { kind: "unresolved", uuid: resolved, hint: "field" };
|
|
103
103
|
if (resolved !== undefined) {
|
|
104
|
-
return {
|
|
104
|
+
return {
|
|
105
|
+
kind: "field",
|
|
106
|
+
appHandle: resolved.ownerRefName,
|
|
107
|
+
fieldKey: resolved.fieldKey,
|
|
108
|
+
...(resolved.ownerKind !== undefined && resolved.ownerName !== undefined ? {
|
|
109
|
+
foreign: {
|
|
110
|
+
entityType: resolved.ownerKind,
|
|
111
|
+
name: resolved.ownerName,
|
|
112
|
+
...(resolved.ownerNamespace !== undefined ? { namespace: resolved.ownerNamespace } : {}),
|
|
113
|
+
...(resolved.fieldName !== undefined ? { fieldName: resolved.fieldName } : {}),
|
|
114
|
+
...(resolved.fieldType !== undefined ? { fieldType: resolved.fieldType } : {}),
|
|
115
|
+
},
|
|
116
|
+
} : {}),
|
|
117
|
+
};
|
|
105
118
|
}
|
|
106
119
|
throw new EntityTfError("dynamic picklist filter field reference cannot be reconstructed");
|
|
107
120
|
}
|
|
@@ -165,11 +178,38 @@ function dynamicConfigFromTf(value, owner, ctx, where) {
|
|
|
165
178
|
ctx.diagnostics.push(`${where}: dynamic_config.sort is not a jsonencode(...) object; dropped`);
|
|
166
179
|
}
|
|
167
180
|
}
|
|
181
|
+
let parentMappings;
|
|
182
|
+
if (attrs["parent_mappings"] !== undefined) {
|
|
183
|
+
const rawMappings = attrs["parent_mappings"];
|
|
184
|
+
if (!Array.isArray(rawMappings)) {
|
|
185
|
+
ctx.diagnostics.push(`${where}: dynamic_config.parent_mappings is not a list; dropped`);
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
parentMappings = [];
|
|
189
|
+
for (const rawMapping of rawMappings) {
|
|
190
|
+
if (typeof rawMapping !== "object" || rawMapping === null || Array.isArray(rawMapping) || isTfExpr(rawMapping)) {
|
|
191
|
+
ctx.diagnostics.push(`${where}: dynamic_config parent mapping has an unexpected shape; dropped`);
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
const mapping = rawMapping;
|
|
195
|
+
const parentAspectFieldId = resolveRelatedId(mapping["parent_aspect_field_id"], ctx);
|
|
196
|
+
const relatedAspectFieldId = resolveRelatedId(mapping["related_aspect_field_id"], ctx);
|
|
197
|
+
if (parentAspectFieldId === undefined || relatedAspectFieldId === undefined) {
|
|
198
|
+
ctx.diagnostics.push(`${where}: dynamic_config parent mapping field IDs could not be reconstructed; dropped`);
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
parentMappings.push({ parentAspectFieldId, relatedAspectFieldId });
|
|
202
|
+
}
|
|
203
|
+
if (parentMappings.length === 0)
|
|
204
|
+
parentMappings = undefined;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
168
207
|
return {
|
|
169
208
|
dynamic: {
|
|
170
209
|
relatedAspectId,
|
|
171
210
|
relatedLabelFieldId,
|
|
172
211
|
...(parentFieldId !== undefined && { parentFieldId }),
|
|
212
|
+
...(parentMappings !== undefined && { parentMappings }),
|
|
173
213
|
...(autoRelate !== undefined && { autoRelate }),
|
|
174
214
|
...(valuesRenderType !== undefined && { valuesRenderType }),
|
|
175
215
|
...(filter !== undefined && { filter }),
|
|
@@ -177,6 +217,53 @@ function dynamicConfigFromTf(value, owner, ctx, where) {
|
|
|
177
217
|
},
|
|
178
218
|
};
|
|
179
219
|
}
|
|
220
|
+
function staticParentLinkageFromTf(value, optionsValue, owner, ctx, where) {
|
|
221
|
+
if (value === undefined)
|
|
222
|
+
return undefined;
|
|
223
|
+
if (typeof value !== "object" || value === null || isTfExpr(value) || Array.isArray(value)) {
|
|
224
|
+
ctx.diagnostics.push(`${where}: static_config has an unexpected shape; dropped`);
|
|
225
|
+
return undefined;
|
|
226
|
+
}
|
|
227
|
+
const parentFieldValue = value["parent_field_id"];
|
|
228
|
+
if (parentFieldValue === undefined)
|
|
229
|
+
return undefined;
|
|
230
|
+
const parentFieldKey = fieldKeyFromTfRef(parentFieldValue, owner.label, owner.scope ?? "app");
|
|
231
|
+
if (parentFieldKey === undefined) {
|
|
232
|
+
ctx.diagnostics.push(`${where}: static_config.parent_field_id could not be resolved to a same-app field; dropped`);
|
|
233
|
+
return undefined;
|
|
234
|
+
}
|
|
235
|
+
const optionParentLabels = new Map();
|
|
236
|
+
if (Array.isArray(optionsValue)) {
|
|
237
|
+
for (const rawOption of optionsValue) {
|
|
238
|
+
if (typeof rawOption !== "object" || rawOption === null || Array.isArray(rawOption) || isTfExpr(rawOption))
|
|
239
|
+
continue;
|
|
240
|
+
const option = rawOption;
|
|
241
|
+
const label = typeof option["label"] === "string" ? option["label"] : undefined;
|
|
242
|
+
const parentValues = option["parent_value_ids"];
|
|
243
|
+
if (label === undefined || !Array.isArray(parentValues))
|
|
244
|
+
continue;
|
|
245
|
+
const labels = [];
|
|
246
|
+
for (const parentValue of parentValues) {
|
|
247
|
+
if (isTfExpr(parentValue) &&
|
|
248
|
+
parentValue.$expr === "local" &&
|
|
249
|
+
parentValue.path.length === 1 &&
|
|
250
|
+
typeof parentValue.path[0] === "object" &&
|
|
251
|
+
"index" in parentValue.path[0]) {
|
|
252
|
+
labels.push(parentValue.path[0].index);
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
ctx.diagnostics.push(`${where}: option "${label}" has an unresolvable parent_value_ids entry; dropped`);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
if (labels.length > 0)
|
|
259
|
+
optionParentLabels.set(label, labels);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return {
|
|
263
|
+
parentFieldKey,
|
|
264
|
+
...(optionParentLabels.size > 0 && { optionParentLabels }),
|
|
265
|
+
};
|
|
266
|
+
}
|
|
180
267
|
/**
|
|
181
268
|
* One field block → its normalized entry; undefined = skipped with a
|
|
182
269
|
* diagnostic (unknown resource type, or a field belonging to a different
|
|
@@ -221,6 +308,9 @@ export function fieldFromTf(block, owner, ctx) {
|
|
|
221
308
|
? optionsFromTf(attrs["options"], `${where} options`, ctx)
|
|
222
309
|
: undefined;
|
|
223
310
|
const config = subType.hasOptions === true ? dynamicConfigFromTf(attrs["dynamic_config"], owner, ctx, where) : undefined;
|
|
311
|
+
const parentLinkage = subType.hasOptions === true && attrs["dynamic_config"] === undefined
|
|
312
|
+
? staticParentLinkageFromTf(attrs["static_config"], attrs["options"], owner, ctx, where)
|
|
313
|
+
: undefined;
|
|
224
314
|
let decimalPlaces;
|
|
225
315
|
if (subType.typeKey === "decimal" && attrs["decimal_places"] !== undefined) {
|
|
226
316
|
if (typeof attrs["decimal_places"] === "number")
|
|
@@ -352,6 +442,7 @@ export function fieldFromTf(block, owner, ctx) {
|
|
|
352
442
|
}
|
|
353
443
|
return {
|
|
354
444
|
key: scopedLabelToBagKey(owner.label, fieldLabel, scope),
|
|
445
|
+
...(parentLinkage !== undefined && { parentLinkage }),
|
|
355
446
|
...(isCalculationResultType(calculationType) && { calculationType }),
|
|
356
447
|
...(calculationInclude !== undefined && { calculationInclude }),
|
|
357
448
|
field: {
|
|
@@ -407,3 +498,15 @@ export function fieldKeyFromTfRef(v, ownerTfLabel, scope = "app") {
|
|
|
407
498
|
const bare = ownerTfLabel !== undefined ? bareChildResourceLabel(ownerTfLabel, v.label, scope) : v.label;
|
|
408
499
|
return ownerTfLabel !== undefined ? scopedLabelToBagKey(ownerTfLabel, v.label, scope) : tfLabelToTsLabel(bare);
|
|
409
500
|
}
|
|
501
|
+
/**
|
|
502
|
+
* Resolve either a normal Terraform field reference or a raw platform field
|
|
503
|
+
* ID recovered from post-adoption state. The owner check prevents a UUID from
|
|
504
|
+
* one app or element from becoming a same-owner field token accidentally.
|
|
505
|
+
*/
|
|
506
|
+
export function fieldKeyFromTfValue(v, ownerRefName, ownerTfLabel, scope, ctx) {
|
|
507
|
+
if (typeof v === "string") {
|
|
508
|
+
const stateRef = ctx.foreignFieldRefsById?.get(v);
|
|
509
|
+
return stateRef?.ownerRefName === ownerRefName ? stateRef.fieldKey : undefined;
|
|
510
|
+
}
|
|
511
|
+
return fieldKeyFromTfRef(v, ownerTfLabel, scope);
|
|
512
|
+
}
|
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
* resource (bare field label — ei does not namespace-prefix these).
|
|
5
5
|
*/
|
|
6
6
|
import { expr } from "../../engine/tf/index.js";
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const OPTION_LOOKUP_FIELD_RESOURCE_TYPES = new Set(["elementum_dropdown_field"]);
|
|
7
|
+
// Both product selection fields need label-to-id lookups: dependent static
|
|
8
|
+
// options can use either a Dropdown or Multi-Select as their parent.
|
|
9
|
+
const OPTION_LOOKUP_FIELD_RESOURCE_TYPES = new Set([
|
|
10
|
+
"elementum_dropdown_field",
|
|
11
|
+
"elementum_multiselect_field",
|
|
12
|
+
]);
|
|
14
13
|
/**
|
|
15
14
|
* Append one app's field-level lookup locals, keyed by the emitted field
|
|
16
15
|
* addresses. Skips any dropdown field whose values come from `dynamic_config`
|
|
@@ -13,6 +13,8 @@ export interface PicklistValueWire {
|
|
|
13
13
|
readonly value?: string;
|
|
14
14
|
readonly tags?: readonly string[];
|
|
15
15
|
readonly color?: string;
|
|
16
|
+
readonly icon?: string;
|
|
17
|
+
readonly active?: boolean;
|
|
16
18
|
readonly relatedParentValues?: unknown;
|
|
17
19
|
}
|
|
18
20
|
export declare function picklistLabel(pv: PicklistValueWire): string;
|
|
@@ -39,11 +39,13 @@ export function optionsFromTf(v, where, ctx) {
|
|
|
39
39
|
continue;
|
|
40
40
|
}
|
|
41
41
|
for (const key of Object.keys(rec)) {
|
|
42
|
-
if (key !== "label" && key !== "tags" && key !== "color") {
|
|
42
|
+
if (key !== "label" && key !== "tags" && key !== "color" && key !== "icon" && key !== "active" && key !== "parent_value_ids") {
|
|
43
43
|
ctx.diagnostics.push(`${where}: option "${optLabel}" has an unhandled property "${key}"; dropped`);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
const color = typeof rec["color"] === "string" && rec["color"] !== "" ? rec["color"] : undefined;
|
|
47
|
+
const icon = typeof rec["icon"] === "string" && rec["icon"] !== "" ? rec["icon"] : undefined;
|
|
48
|
+
const active = typeof rec["active"] === "boolean" ? rec["active"] : undefined;
|
|
47
49
|
const tags = [];
|
|
48
50
|
const rawTags = rec["tags"];
|
|
49
51
|
if (Array.isArray(rawTags)) {
|
|
@@ -59,7 +61,13 @@ export function optionsFromTf(v, where, ctx) {
|
|
|
59
61
|
else if (rawTags !== undefined) {
|
|
60
62
|
ctx.diagnostics.push(`${where}: option "${optLabel}" tags is not a list; dropped`);
|
|
61
63
|
}
|
|
62
|
-
parsed.push({
|
|
64
|
+
parsed.push({
|
|
65
|
+
label: optLabel,
|
|
66
|
+
...(color !== undefined && { color }),
|
|
67
|
+
...(icon !== undefined && { icon }),
|
|
68
|
+
...(active !== undefined && { active }),
|
|
69
|
+
tags,
|
|
70
|
+
});
|
|
63
71
|
}
|
|
64
72
|
if (parsed.length === 0)
|
|
65
73
|
return undefined;
|
|
@@ -69,6 +77,8 @@ export function optionsFromTf(v, where, ctx) {
|
|
|
69
77
|
id: "",
|
|
70
78
|
label: item.label,
|
|
71
79
|
...(item.color !== undefined && { color: item.color }),
|
|
80
|
+
...(item.icon !== undefined && { icon: item.icon }),
|
|
81
|
+
...(item.active !== undefined && { active: item.active }),
|
|
72
82
|
...(item.tags.length > 0 && { tags: item.tags }),
|
|
73
83
|
};
|
|
74
84
|
}
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* …). A few carry richer sub-properties that the platform resolves at
|
|
9
9
|
* runtime, so their record value is an object instead — `DeepRef` then
|
|
10
10
|
* exposes those sub-properties for drilling, e.g.
|
|
11
|
-
* `ctx.trigger.record.severity.label
|
|
11
|
+
* `ctx.trigger.record.severity.label`, `ctx.trigger.record.owner.email`,
|
|
12
|
+
* or `ctx.trigger.record.parentTicket.recordId` (dynamic Dropdown).
|
|
12
13
|
* Object shapes come from `entities/shared/types/platform.ts` so a
|
|
13
14
|
* `User`/`Attachment`/… means the same thing everywhere in the SDK.
|
|
14
15
|
*
|
|
@@ -17,11 +18,17 @@
|
|
|
17
18
|
*/
|
|
18
19
|
import type { FieldRef } from "../../catalog/types.js";
|
|
19
20
|
import type { CalculationTypedValue } from "../shared/ref.js";
|
|
20
|
-
import type { Attachment, Group,
|
|
21
|
+
import type { Attachment, DropdownValue, DynamicDropdownValue, Group, RecordId, RichText, User } from "../shared/types/platform.js";
|
|
22
|
+
export type { RecordId } from "../shared/types/platform.js";
|
|
21
23
|
/** Map a platform field type literal to the TS type exposed on a record field. */
|
|
22
24
|
type CalculationTypeForField<FieldType extends string> = FieldType extends "NUMBER" ? "number" : FieldType extends "DECIMAL" ? "decimal" : FieldType extends "BOOLEAN" ? "bool" : FieldType extends "DATE" ? "date" : FieldType extends "DATETIME" ? "datetime" : FieldType extends "PICKLIST" | "PICKLIST_ID" ? "picklist" : FieldType extends "MULTI_PICKLIST" | "MULTI_PICKLIST_ID" ? "multiPicklist" : FieldType extends "ATTACHMENT" | "ATTACHMENT_ID" | "FILE" ? "attachment" : FieldType extends "USER" | "USER_ID" ? "user" : FieldType extends "GROUP" | "GROUP_ID" ? "group" : FieldType extends "JSON" | "OBJECT" ? "json" : FieldType extends "HTML" ? "html" : FieldType extends "HANDLE" ? "handle" : FieldType extends "RICH_TEXT" ? "text" : "text";
|
|
23
|
-
type RawFieldValueType<FieldType extends string> = FieldType extends "NUMBER" | "DECIMAL" ? number : FieldType extends "BOOLEAN" ? boolean : FieldType extends "JSON" | "OBJECT" ? unknown : FieldType extends "PICKLIST" | "PICKLIST_ID" ?
|
|
24
|
-
|
|
25
|
+
type RawFieldValueType<FieldType extends string> = FieldType extends "NUMBER" | "DECIMAL" ? number : FieldType extends "BOOLEAN" ? boolean : FieldType extends "JSON" | "OBJECT" ? unknown : FieldType extends "PICKLIST" | "PICKLIST_ID" ? DropdownValue : FieldType extends "MULTI_PICKLIST" | "MULTI_PICKLIST_ID" ? readonly DropdownValue[] : FieldType extends "ATTACHMENT" | "ATTACHMENT_ID" | "FILE" ? Attachment : FieldType extends "RICH_TEXT" ? RichText : FieldType extends "USER" | "USER_ID" ? User : FieldType extends "GROUP" | "GROUP_ID" ? Group : string;
|
|
26
|
+
type CalculatedFieldValueType<FieldType extends string> = CalculationTypedValue<RawFieldValueType<FieldType>, CalculationTypeForField<FieldType>>;
|
|
27
|
+
export type FieldValueType<Field extends string | FieldRef> = Field extends FieldRef<string, string, infer FieldType> ? FieldType extends "PICKLIST" | "PICKLIST_ID" ? Field extends {
|
|
28
|
+
readonly dynamicSource: unknown;
|
|
29
|
+
} ? DynamicDropdownValue : DropdownValue : FieldType extends "MULTI_PICKLIST" | "MULTI_PICKLIST_ID" ? readonly (Field extends {
|
|
30
|
+
readonly dynamicSource: unknown;
|
|
31
|
+
} ? DynamicDropdownValue : DropdownValue)[] : CalculatedFieldValueType<FieldType> : Field extends string ? CalculatedFieldValueType<Field> : never;
|
|
25
32
|
/**
|
|
26
33
|
* Extract the `fields` bag off an app/element-like ref, e.g. `typeof catalog.myApp`.
|
|
27
34
|
* `undefined` when the ref carries no `fields` bag (a hand-built `AppOrElementRef`
|
|
@@ -30,15 +37,6 @@ export type FieldValueType<FieldType extends string> = CalculationTypedValue<Raw
|
|
|
30
37
|
export type AppFieldsOf<A> = A extends {
|
|
31
38
|
readonly fields: infer F extends Record<string, FieldRef>;
|
|
32
39
|
} ? F : undefined;
|
|
33
|
-
declare const recordIdBrand: unique symbol;
|
|
34
|
-
/**
|
|
35
|
-
* Platform record identity (wire type ASPECT_RECORD_ID). Distinct from a
|
|
36
|
-
* record's TEXT `id` handle so `Ref<RecordId>` cannot be satisfied by
|
|
37
|
-
* `ctx.trigger.record.id` (`refs["ID"]`).
|
|
38
|
-
*/
|
|
39
|
-
export type RecordId = string & {
|
|
40
|
-
readonly [recordIdBrand]: "recordId";
|
|
41
|
-
};
|
|
42
40
|
/**
|
|
43
41
|
* The typed record shape for an app/element ref. When `A` carries a concrete
|
|
44
42
|
* `fields` bag (a real catalog app), this is a closed, per-field-typed object —
|
|
@@ -66,6 +64,5 @@ export type RecordShape<A> = {
|
|
|
66
64
|
readonly id: string;
|
|
67
65
|
readonly recordId: RecordId;
|
|
68
66
|
} & (AppFieldsOf<A> extends Record<string, FieldRef> ? {
|
|
69
|
-
readonly [K in keyof AppFieldsOf<A>]: FieldValueType<AppFieldsOf<A>[K]
|
|
67
|
+
readonly [K in keyof AppFieldsOf<A>]: FieldValueType<AppFieldsOf<A>[K]>;
|
|
70
68
|
} : {});
|
|
71
|
-
export {};
|
|
@@ -26,6 +26,8 @@ interface FieldTokenWire {
|
|
|
26
26
|
readonly name?: string;
|
|
27
27
|
readonly parent?: string;
|
|
28
28
|
readonly parentNamespace?: string;
|
|
29
|
+
readonly parentKind?: "app" | "element";
|
|
30
|
+
readonly parentName?: string;
|
|
29
31
|
readonly fieldType?: string;
|
|
30
32
|
}
|
|
31
33
|
/**
|
|
@@ -53,6 +55,10 @@ interface DynamicPicklistConfigWire {
|
|
|
53
55
|
readonly relatedAspectId?: AspectTokenWire | string;
|
|
54
56
|
readonly relatedLabelFieldId?: FieldTokenWire | string;
|
|
55
57
|
readonly parentFieldId?: FieldTokenWire | string;
|
|
58
|
+
readonly parentMappings?: readonly {
|
|
59
|
+
readonly parentAspectFieldId?: FieldTokenWire | string;
|
|
60
|
+
readonly relatedAspectFieldId?: FieldTokenWire | string;
|
|
61
|
+
}[];
|
|
56
62
|
readonly autoRelate?: boolean;
|
|
57
63
|
readonly valuesRenderType?: string;
|
|
58
64
|
readonly filter?: unknown;
|
|
@@ -60,10 +66,14 @@ interface DynamicPicklistConfigWire {
|
|
|
60
66
|
readonly orders: readonly DynamicPicklistSortOrderWire[];
|
|
61
67
|
} | Record<string, unknown>;
|
|
62
68
|
}
|
|
63
|
-
|
|
69
|
+
interface StaticPicklistConfigWire {
|
|
70
|
+
readonly parentFieldId?: FieldTokenWire | string;
|
|
71
|
+
readonly filter?: unknown;
|
|
72
|
+
readonly sort?: Record<string, unknown>;
|
|
73
|
+
}
|
|
64
74
|
interface FieldConfigWire {
|
|
65
75
|
readonly dynamic?: DynamicPicklistConfigWire;
|
|
66
|
-
readonly static?:
|
|
76
|
+
readonly static?: StaticPicklistConfigWire;
|
|
67
77
|
}
|
|
68
78
|
/** The authored field shape (post-`slimTokens` compose body). Deliberately loose — degrade, don't assert. */
|
|
69
79
|
export interface FieldInnerWire {
|
|
@@ -125,5 +135,5 @@ export interface FieldToTfResult {
|
|
|
125
135
|
}
|
|
126
136
|
/** One custom field → its resource block; undefined = degraded (diagnostic already pushed). */
|
|
127
137
|
export declare function fieldToTf(typeKey: string, inner: FieldInnerWire, opts: FieldToTfOptions): FieldToTfResult | undefined;
|
|
128
|
-
export declare function fieldRefToTfValue(fieldType: string, refName: string, ownerTfLabel: string, scope?: ChildResourceScope): TfExpr | undefined;
|
|
138
|
+
export declare function fieldRefToTfValue(fieldType: string, refName: string, ownerTfLabel: string, scope?: ChildResourceScope, fieldAddresses?: ReadonlyMap<string, string>): TfExpr | undefined;
|
|
129
139
|
export {};
|