@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
|
@@ -8,9 +8,8 @@
|
|
|
8
8
|
* inline (a new app's fields get server-assigned ids on compose). Deployed via
|
|
9
9
|
* the wire client's compose path (`composeAspect`).
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* follow the same pattern and land as expansion.
|
|
11
|
+
* Includes typed scalar, Dropdown/Multi-Select, relation, calculation, and
|
|
12
|
+
* record-experience configuration with build/pull round-trip support.
|
|
14
13
|
*/
|
|
15
14
|
import { type AgentRef, type AppOrElementRef, type AutomationCatalogRef, type CatalogRef, type ChartRef, type CloudLinkRef, type DashboardRef, type FieldRef } from "../../catalog/index.js";
|
|
16
15
|
import type { WorkflowFieldType } from "../shared/types/field-types.js";
|
|
@@ -43,7 +42,10 @@ export interface AppPicklistDynamicSortOrder {
|
|
|
43
42
|
readonly aggregation?: unknown;
|
|
44
43
|
}
|
|
45
44
|
/**
|
|
46
|
-
*
|
|
45
|
+
* @deprecated Internal compatibility shape. Author Dropdowns through
|
|
46
|
+
* `DropdownConfig` on `dropdownField` or `multiSelectField`.
|
|
47
|
+
*
|
|
48
|
+
* Wire `PicklistConfigInput` uses bare id
|
|
47
49
|
* strings; here `relatedAspectId` / `relatedLabelFieldId` / `parentFieldId`
|
|
48
50
|
* may be catalog tokens that `resolvePayload` swaps for ids at plan/apply.
|
|
49
51
|
*
|
|
@@ -62,6 +64,10 @@ export interface AppPicklistDynamicConfig {
|
|
|
62
64
|
readonly relatedAspectId: AppOrElementRef | UnsafePlatformId;
|
|
63
65
|
readonly relatedLabelFieldId: FieldRef | UnsafePlatformId;
|
|
64
66
|
readonly parentFieldId?: FieldRef | UnsafePlatformId;
|
|
67
|
+
readonly parentMappings?: readonly {
|
|
68
|
+
readonly parentAspectFieldId: FieldRef | UnsafePlatformId;
|
|
69
|
+
readonly relatedAspectFieldId: FieldRef | UnsafePlatformId;
|
|
70
|
+
}[];
|
|
65
71
|
readonly autoRelate?: boolean;
|
|
66
72
|
readonly valuesRenderType?: string;
|
|
67
73
|
readonly filter?: Filter;
|
|
@@ -71,14 +77,18 @@ export interface AppPicklistDynamicConfig {
|
|
|
71
77
|
readonly orders?: never;
|
|
72
78
|
});
|
|
73
79
|
}
|
|
74
|
-
|
|
75
|
-
|
|
80
|
+
/** @deprecated Use `DropdownConfig` through the selection-field factories. */
|
|
81
|
+
export type AppPicklistConfig = {
|
|
82
|
+
readonly static: {
|
|
76
83
|
readonly parentFieldId?: FieldRef | UnsafePlatformId;
|
|
77
84
|
readonly filter?: Filter;
|
|
78
85
|
readonly sort?: Readonly<Record<string, unknown>>;
|
|
79
86
|
};
|
|
80
|
-
readonly dynamic?:
|
|
81
|
-
}
|
|
87
|
+
readonly dynamic?: never;
|
|
88
|
+
} | {
|
|
89
|
+
readonly static?: never;
|
|
90
|
+
readonly dynamic: AppPicklistDynamicConfig;
|
|
91
|
+
};
|
|
82
92
|
/**
|
|
83
93
|
* A field authored on a v2 app or element — shared with `element`
|
|
84
94
|
* (`src/elements/build.ts`), which imports this type and {@link serializeField}
|
|
@@ -104,10 +114,9 @@ export interface AppField {
|
|
|
104
114
|
*/
|
|
105
115
|
readonly tags?: readonly string[];
|
|
106
116
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* for now.) Omit for dynamic picklists (`config.dynamic`).
|
|
117
|
+
* Legacy selection values (`PICKLIST` / `MULTI_PICKLIST`). New authoring
|
|
118
|
+
* should use `config.static.values` on `dropdownField`/`multiSelectField`;
|
|
119
|
+
* typed `dropdownValue(...)` references avoid parent-option UUIDs.
|
|
111
120
|
*/
|
|
112
121
|
readonly options?: readonly (string | PicklistOption)[];
|
|
113
122
|
/** Parent picklist for a dependent dropdown (token → `config.static.parentFieldId`). */
|
|
@@ -147,11 +156,17 @@ export interface AppField {
|
|
|
147
156
|
/** `RELATION` only. Defaults to `true` on the platform. */
|
|
148
157
|
readonly autoRelate?: boolean;
|
|
149
158
|
}
|
|
150
|
-
/**
|
|
159
|
+
/** @deprecated Use `DropdownOption` and `dropdownOption(...)`. */
|
|
151
160
|
export interface PicklistOption {
|
|
152
161
|
readonly label: string;
|
|
153
|
-
/** Parent
|
|
154
|
-
readonly parentValues?: readonly string
|
|
162
|
+
/** Parent values that activate this option. Prefer typed `dropdownValue(...)` refs. */
|
|
163
|
+
readonly parentValues?: readonly (string | {
|
|
164
|
+
readonly __kind: "dropdownValue";
|
|
165
|
+
readonly field: FieldRef<string, string, "PICKLIST" | "MULTI_PICKLIST">;
|
|
166
|
+
readonly label: string;
|
|
167
|
+
})[];
|
|
168
|
+
readonly active?: boolean;
|
|
169
|
+
readonly icon?: string;
|
|
155
170
|
/** Option tags (e.g. "CLOSED" marks the closing status option). */
|
|
156
171
|
readonly tags?: readonly PicklistOptionTag[];
|
|
157
172
|
/** Display color (hex, e.g. "#3B82F6") — surfaced on status options; cosmetic only. */
|
|
@@ -181,18 +196,19 @@ export interface AppCloudOptions {
|
|
|
181
196
|
* genuinely allows overriding is authorable: the display name, an optional
|
|
182
197
|
* description (title/id/status only — the app resource has no
|
|
183
198
|
* `*_field_description` attribute for the others), and, for the status/stage
|
|
184
|
-
* picklists, the option set. `type`
|
|
185
|
-
* are
|
|
186
|
-
*
|
|
199
|
+
* picklists, the option set. `type` stays platform-owned; the three validation
|
|
200
|
+
* flags are first-class because they affect record creation/closure and phone
|
|
201
|
+
* agent behavior.
|
|
187
202
|
*/
|
|
188
203
|
export interface AppSystemFieldOverride {
|
|
189
204
|
readonly name: string;
|
|
190
205
|
readonly description?: string;
|
|
206
|
+
readonly required?: boolean;
|
|
207
|
+
readonly requiredOnClose?: boolean;
|
|
208
|
+
readonly showOnCreate?: boolean;
|
|
191
209
|
}
|
|
192
210
|
/** A system-picklist override (status/stage): display name + option set. */
|
|
193
|
-
export interface AppSystemPicklistOverride {
|
|
194
|
-
readonly name: string;
|
|
195
|
-
readonly description?: string;
|
|
211
|
+
export interface AppSystemPicklistOverride extends AppSystemFieldOverride {
|
|
196
212
|
readonly options: readonly (string | PicklistOption)[];
|
|
197
213
|
}
|
|
198
214
|
/**
|
|
@@ -336,8 +352,8 @@ export interface AppV2Options<F extends Record<string, AppField> = Record<string
|
|
|
336
352
|
readonly name: string;
|
|
337
353
|
readonly category: AppCategory;
|
|
338
354
|
readonly namespace?: string;
|
|
339
|
-
/**
|
|
340
|
-
readonly handle
|
|
355
|
+
/** Required platform aspect handle (business acronym, e.g. "PRD") — distinct from the refName. */
|
|
356
|
+
readonly handle: string;
|
|
341
357
|
readonly description?: string;
|
|
342
358
|
readonly icon?: string;
|
|
343
359
|
readonly color?: string;
|
|
@@ -456,7 +472,11 @@ export declare function serializeSystemFields(overrides: AppSystemFields | undef
|
|
|
456
472
|
* (`entities/field/record-shape.ts`) needs to discriminate value types.
|
|
457
473
|
*/
|
|
458
474
|
export type AppFieldRefs<F extends Record<string, AppField>, Parent extends string = string> = {
|
|
459
|
-
readonly [K in keyof F]: FieldRef<Parent, Extract<K, string>, F[K]["type"]
|
|
475
|
+
readonly [K in keyof F]: FieldRef<Parent, Extract<K, string>, F[K]["type"]> & (F[K] extends {
|
|
476
|
+
readonly dynamicSource: true;
|
|
477
|
+
} ? {
|
|
478
|
+
readonly dynamicSource: true;
|
|
479
|
+
} : {});
|
|
460
480
|
};
|
|
461
481
|
/**
|
|
462
482
|
* The platform field type each auto-provisioned system field carries —
|
|
@@ -8,9 +8,8 @@
|
|
|
8
8
|
* inline (a new app's fields get server-assigned ids on compose). Deployed via
|
|
9
9
|
* the wire client's compose path (`composeAspect`).
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* follow the same pattern and land as expansion.
|
|
11
|
+
* Includes typed scalar, Dropdown/Multi-Select, relation, calculation, and
|
|
12
|
+
* record-experience configuration with build/pull round-trip support.
|
|
14
13
|
*/
|
|
15
14
|
import { slimTokens } from "../../catalog/index.js";
|
|
16
15
|
import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_KEYS, SYSTEM_FIELD_REQUIRED, SYSTEM_FIELD_TAG_BY_KEY, WRITABLE_SYSTEM_TAG_NAMES, } from "../../core/system-fields.js";
|
|
@@ -104,6 +103,8 @@ function picklistValue(opt) {
|
|
|
104
103
|
value: opt.label,
|
|
105
104
|
label: opt.label,
|
|
106
105
|
...(opt.parentValues !== undefined ? { relatedParentValues: opt.parentValues } : {}),
|
|
106
|
+
...(opt.active !== undefined ? { active: opt.active } : {}),
|
|
107
|
+
...(opt.icon !== undefined ? { icon: opt.icon } : {}),
|
|
107
108
|
...(opt.tags !== undefined ? { tags: opt.tags } : {}),
|
|
108
109
|
...(opt.color !== undefined ? { color: opt.color } : {}),
|
|
109
110
|
};
|
|
@@ -224,6 +225,11 @@ export function serializeSystemFields(overrides) {
|
|
|
224
225
|
const tag = SYSTEM_FIELD_TAG_BY_KEY[key];
|
|
225
226
|
const override = overrides[key];
|
|
226
227
|
const name = override.name ?? DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES[key];
|
|
228
|
+
const flags = {
|
|
229
|
+
required: override.required ?? SYSTEM_FIELD_REQUIRED[key],
|
|
230
|
+
requiredOnClose: override.requiredOnClose ?? false,
|
|
231
|
+
showOnCreate: override.showOnCreate ?? false,
|
|
232
|
+
};
|
|
227
233
|
if (key === "stage") {
|
|
228
234
|
// Constructed directly, not via serializeField: the REST compose API
|
|
229
235
|
// rejects stage picklistValues (stage mutations have dedicated
|
|
@@ -233,7 +239,7 @@ export function serializeSystemFields(overrides) {
|
|
|
233
239
|
return {
|
|
234
240
|
picklist: {
|
|
235
241
|
name,
|
|
236
|
-
|
|
242
|
+
...flags,
|
|
237
243
|
tags: [tag],
|
|
238
244
|
__refName: key,
|
|
239
245
|
picklistValues: override.options.map(picklistValue),
|
|
@@ -243,7 +249,7 @@ export function serializeSystemFields(overrides) {
|
|
|
243
249
|
const field = {
|
|
244
250
|
name,
|
|
245
251
|
type: SYSTEM_FIELD_TAG_TO_TYPE[tag],
|
|
246
|
-
|
|
252
|
+
...flags,
|
|
247
253
|
tags: [tag],
|
|
248
254
|
...(override.description !== undefined ? { description: override.description } : {}),
|
|
249
255
|
...(key === "status" ? { options: override.options } : {}),
|
|
@@ -273,11 +279,14 @@ export const APP_HANDLE_RE = /^[a-zA-Z]+$/;
|
|
|
273
279
|
* as an opaque platform error during apply. App-specific on purpose: elements
|
|
274
280
|
* carry their own equivalent in `src/elements/build.ts`.
|
|
275
281
|
*
|
|
276
|
-
* - `handle` — letters only (a–z, A–Z)
|
|
282
|
+
* - `handle` — required and letters only (a–z, A–Z)
|
|
277
283
|
* - `namespace` — lowercase letters only (a–z), when provided
|
|
278
284
|
*/
|
|
279
285
|
function validateAppOptions(opts) {
|
|
280
|
-
if (
|
|
286
|
+
if (!opts.handle) {
|
|
287
|
+
throw new Error(`app "${opts.name}": handle is required by the platform.`);
|
|
288
|
+
}
|
|
289
|
+
if (!APP_HANDLE_RE.test(opts.handle)) {
|
|
281
290
|
throw new Error(`app "${opts.name}": handle "${opts.handle}" must contain only letters (a–z, A–Z).`);
|
|
282
291
|
}
|
|
283
292
|
if (opts.namespace !== undefined && !/^[a-z]+$/.test(opts.namespace)) {
|
|
@@ -309,7 +318,8 @@ export function app(opts) {
|
|
|
309
318
|
parent: refName,
|
|
310
319
|
parentKind: kind,
|
|
311
320
|
parentName: opts.name,
|
|
312
|
-
fieldType: field.type,
|
|
321
|
+
fieldType: field.expression !== undefined ? "CALCULATED" : field.type,
|
|
322
|
+
...("dynamicSource" in field && field.dynamicSource === true ? { dynamicSource: true } : {}),
|
|
313
323
|
...(field.options !== undefined ? { options: picklistOptionLabels(field.options) } : {}),
|
|
314
324
|
...(field.tags !== undefined ? { tags: field.tags } : {}),
|
|
315
325
|
};
|
|
@@ -53,6 +53,10 @@ export interface NormalizedField {
|
|
|
53
53
|
readonly parentFieldId?: string;
|
|
54
54
|
/** Map of this field's option id → parent option ids. */
|
|
55
55
|
readonly optionParents?: ReadonlyMap<string, readonly string[]>;
|
|
56
|
+
/** Same information reconstructed from Terraform's name-based locals. */
|
|
57
|
+
readonly parentFieldKey?: string;
|
|
58
|
+
/** Child option label -> parent option labels. */
|
|
59
|
+
readonly optionParentLabels?: ReadonlyMap<string, readonly string[]>;
|
|
56
60
|
};
|
|
57
61
|
}
|
|
58
62
|
/**
|
|
@@ -275,6 +279,12 @@ export interface PulledRelationshipRef {
|
|
|
275
279
|
readonly fieldType?: string;
|
|
276
280
|
readonly tfLabel?: string;
|
|
277
281
|
readonly managed?: boolean;
|
|
282
|
+
/** The recursive pull resolved this reference to an on-disk generated catalog token. */
|
|
283
|
+
readonly catalogRef?: boolean;
|
|
284
|
+
readonly namespace?: string;
|
|
285
|
+
readonly parentKind?: "app" | "element";
|
|
286
|
+
readonly parentName?: string;
|
|
287
|
+
readonly parentNamespace?: string;
|
|
278
288
|
}
|
|
279
289
|
export interface NormalizedRelationship {
|
|
280
290
|
readonly key: string;
|
|
@@ -316,6 +326,11 @@ export interface NormalizedApp {
|
|
|
316
326
|
readonly cloudLinkId?: string;
|
|
317
327
|
readonly cloudLinkClientHandle?: string;
|
|
318
328
|
readonly commentsEnabled?: boolean;
|
|
329
|
+
readonly cloudOptions?: {
|
|
330
|
+
readonly snowflake?: {
|
|
331
|
+
readonly hybridTable?: boolean;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
319
334
|
readonly cloudConnection?: NormalizedCloudConnectionSnowflake;
|
|
320
335
|
/** Record-view (LAYOUT) display blocks, flat with `childKeys` linkage. */
|
|
321
336
|
readonly displayBlocks?: readonly NormalizedDisplayBlock[];
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compose→terraform bridge for `displayBlocks`/`recordCreateDisplayBlocks`.
|
|
3
|
+
* `serializeDisplayBlocks` (`display-blocks.ts`) turns the authored
|
|
4
|
+
* `DisplayBlock[]` into the GraphQL-compose wire shape consumed by `to-tf`
|
|
5
|
+
* payloads — this module maps THAT wire shape into `AppLayoutSectionWire[]`,
|
|
6
|
+
* the shape `viewToTf`/`layoutToTf` (`entities/view/to-tf.ts`) already knows
|
|
7
|
+
* how to emit as `elementum_layout`.
|
|
8
|
+
*
|
|
9
|
+
* Only `field`/`group` blocks have an `elementum_layout` equivalent — the
|
|
10
|
+
* provider's `sections` schema has no `widget`/`comments` section type (see
|
|
11
|
+
* `entities/view/types.ts`'s `SECTION_TYPE_TO_WIRE`). `widget`/`comments`
|
|
12
|
+
* blocks are diagnosed and dropped individually rather than killing the
|
|
13
|
+
* whole payload. `AppLayoutSectionWire` groups are flat (`fields` only) —
|
|
14
|
+
* a `group` nested inside a `group` is diagnosed and dropped (its own
|
|
15
|
+
* contents only; the outer group keeps its direct fields), since there is
|
|
16
|
+
* no nested-section shape to target.
|
|
17
|
+
*
|
|
18
|
+
* This is a pure, entity-agnostic transform (it knows nothing about apps or
|
|
19
|
+
* elements) — kept alongside `display-blocks.ts` rather than under
|
|
20
|
+
* `entities/element/`.
|
|
21
|
+
*/
|
|
22
|
+
import type { AppLayoutSectionWire } from "../view/to-tf.js";
|
|
23
|
+
/**
|
|
24
|
+
* Maps serialized `displayBlocks` (the `Record<string, unknown>[]` shape
|
|
25
|
+
* `serializeDisplayBlocks` produces) into `elementum_layout` group sections.
|
|
26
|
+
*
|
|
27
|
+
* - A top-level `GROUP` block → one section (`name`/`icon`/`color`/
|
|
28
|
+
* `maxColumns` carried over, `fields` from its direct `FIELD` children).
|
|
29
|
+
* - Top-level `FIELD` blocks with no enclosing group are collected into one
|
|
30
|
+
* implicit group section named `"Details"` (the target shape requires a
|
|
31
|
+
* non-empty section name — see `IMPLICIT_GROUP_NAME`).
|
|
32
|
+
* Intentionally always appended LAST, after every named `GROUP` section,
|
|
33
|
+
* regardless of where the bare fields appeared relative to groups in the
|
|
34
|
+
* authored list — e.g. `[field, group]` renders as
|
|
35
|
+
* `[group, implicit-field-group]`. A single implicit group has no natural
|
|
36
|
+
* authored position of its own (it isn't one authored block, it's the
|
|
37
|
+
* union of every bare field), so a fixed, deterministic position was
|
|
38
|
+
* chosen over trying to infer one from interleaving.
|
|
39
|
+
* - `WIDGET`/`COMMENTS` blocks (top-level or nested) and nested `GROUP`
|
|
40
|
+
* blocks are diagnosed and dropped individually; everything else mappable
|
|
41
|
+
* in the same payload still lands. A block with no recognizable shape at
|
|
42
|
+
* all (not a record, or missing/malformed `properties.type`) is likewise
|
|
43
|
+
* diagnosed and dropped rather than silently ignored.
|
|
44
|
+
*/
|
|
45
|
+
export declare function displayBlocksToLayoutSections(blocks: readonly unknown[], where: string, diagnostics: string[]): AppLayoutSectionWire[];
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/** Default name for the implicit group synthesized below — the provider's
|
|
2
|
+
* own Create() validation rejects a `type: "group"` section with an empty
|
|
3
|
+
* `name` (required, not merely cosmetic), so this can never be `""`. */
|
|
4
|
+
const IMPLICIT_GROUP_NAME = "Details";
|
|
5
|
+
function isRecord(value) {
|
|
6
|
+
return typeof value === "object" && value !== null;
|
|
7
|
+
}
|
|
8
|
+
/** The `properties.type` discriminator `serializeBlock` writes: "FIELD" | "GROUP" | "WIDGET" | "COMMENTS". */
|
|
9
|
+
function serializedBlockType(block) {
|
|
10
|
+
const props = block["properties"];
|
|
11
|
+
return isRecord(props) && typeof props["type"] === "string" ? props["type"] : undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Maps serialized `displayBlocks` (the `Record<string, unknown>[]` shape
|
|
15
|
+
* `serializeDisplayBlocks` produces) into `elementum_layout` group sections.
|
|
16
|
+
*
|
|
17
|
+
* - A top-level `GROUP` block → one section (`name`/`icon`/`color`/
|
|
18
|
+
* `maxColumns` carried over, `fields` from its direct `FIELD` children).
|
|
19
|
+
* - Top-level `FIELD` blocks with no enclosing group are collected into one
|
|
20
|
+
* implicit group section named `"Details"` (the target shape requires a
|
|
21
|
+
* non-empty section name — see `IMPLICIT_GROUP_NAME`).
|
|
22
|
+
* Intentionally always appended LAST, after every named `GROUP` section,
|
|
23
|
+
* regardless of where the bare fields appeared relative to groups in the
|
|
24
|
+
* authored list — e.g. `[field, group]` renders as
|
|
25
|
+
* `[group, implicit-field-group]`. A single implicit group has no natural
|
|
26
|
+
* authored position of its own (it isn't one authored block, it's the
|
|
27
|
+
* union of every bare field), so a fixed, deterministic position was
|
|
28
|
+
* chosen over trying to infer one from interleaving.
|
|
29
|
+
* - `WIDGET`/`COMMENTS` blocks (top-level or nested) and nested `GROUP`
|
|
30
|
+
* blocks are diagnosed and dropped individually; everything else mappable
|
|
31
|
+
* in the same payload still lands. A block with no recognizable shape at
|
|
32
|
+
* all (not a record, or missing/malformed `properties.type`) is likewise
|
|
33
|
+
* diagnosed and dropped rather than silently ignored.
|
|
34
|
+
*/
|
|
35
|
+
export function displayBlocksToLayoutSections(blocks, where, diagnostics) {
|
|
36
|
+
const sections = [];
|
|
37
|
+
const implicitFields = [];
|
|
38
|
+
for (const raw of blocks) {
|
|
39
|
+
if (!isRecord(raw)) {
|
|
40
|
+
diagnostics.push(`${where}: a block has an unrecognized shape; dropped`);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const kind = serializedBlockType(raw);
|
|
44
|
+
if (kind === "GROUP") {
|
|
45
|
+
sections.push(groupBlockToSection(raw, where, diagnostics));
|
|
46
|
+
}
|
|
47
|
+
else if (kind === "FIELD") {
|
|
48
|
+
implicitFields.push(raw["fieldId"]);
|
|
49
|
+
}
|
|
50
|
+
else if (kind === undefined) {
|
|
51
|
+
diagnostics.push(`${where}: a block has an unrecognized shape; dropped`);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
diagnostics.push(`${where}: "${kind.toLowerCase()}" blocks have no terraform layout equivalent; dropped`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (implicitFields.length > 0) {
|
|
58
|
+
sections.push({ type: "group", name: IMPLICIT_GROUP_NAME, fields: implicitFields });
|
|
59
|
+
}
|
|
60
|
+
return sections;
|
|
61
|
+
}
|
|
62
|
+
function groupBlockToSection(block, where, diagnostics) {
|
|
63
|
+
const props = isRecord(block["properties"]) ? block["properties"] : {};
|
|
64
|
+
const children = Array.isArray(block["children"]) ? block["children"] : [];
|
|
65
|
+
const fields = [];
|
|
66
|
+
for (const child of children) {
|
|
67
|
+
if (!isRecord(child)) {
|
|
68
|
+
diagnostics.push(`${where}: a nested block has an unrecognized shape; dropped`);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const childKind = serializedBlockType(child);
|
|
72
|
+
if (childKind === "FIELD") {
|
|
73
|
+
fields.push(child["fieldId"]);
|
|
74
|
+
}
|
|
75
|
+
else if (childKind === "GROUP") {
|
|
76
|
+
diagnostics.push(`${where}: nested group blocks have no terraform layout equivalent; dropped`);
|
|
77
|
+
}
|
|
78
|
+
else if (childKind === undefined) {
|
|
79
|
+
diagnostics.push(`${where}: a nested block has an unrecognized shape; dropped`);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
diagnostics.push(`${where}: "${childKind.toLowerCase()}" blocks have no terraform layout equivalent; dropped`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
type: "group",
|
|
87
|
+
// A group block's own name comes from authored `DisplayBlock.group.name`
|
|
88
|
+
// (a required string on the authoring type — see display-blocks.ts) —
|
|
89
|
+
// this fallback only guards against a malformed/missing properties.name
|
|
90
|
+
// in the serialized shape, which "shouldn't happen" but must still never
|
|
91
|
+
// produce the empty string the provider rejects.
|
|
92
|
+
name: typeof props["name"] === "string" && props["name"] !== "" ? props["name"] : IMPLICIT_GROUP_NAME,
|
|
93
|
+
icon: typeof props["icon"] === "string" ? props["icon"] : undefined,
|
|
94
|
+
color: typeof props["color"] === "string" ? props["color"] : undefined,
|
|
95
|
+
maxColumns: typeof props["maxColumns"] === "number" ? props["maxColumns"] : undefined,
|
|
96
|
+
fields,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compose→terraform bridge for `recordCreateDisplayBlocks` (CREATE surface).
|
|
3
|
+
* `serializeDisplayBlocks` (`display-blocks.ts`) turns the authored
|
|
4
|
+
* `DisplayBlock[]` into the GraphQL-compose wire shape consumed by `to-tf`
|
|
5
|
+
* payloads — this module maps THAT wire shape into
|
|
6
|
+
* `RecordCreateFormSectionWire[]`, the shape `recordCreateFormToTf`
|
|
7
|
+
* (`entities/record-create-form/to-tf.ts`) already knows how to emit as
|
|
8
|
+
* `elementum_record_create_form`.
|
|
9
|
+
*
|
|
10
|
+
* Only `field`/`group` blocks have a `elementum_record_create_form`
|
|
11
|
+
* equivalent — the provider's `sections` schema has no `widget`/`comments`
|
|
12
|
+
* section type, same restriction `display-blocks-to-layout.ts` documents for
|
|
13
|
+
* the LAYOUT surface. `widget`/`comments` blocks are diagnosed and dropped
|
|
14
|
+
* individually rather than killing the whole payload. Record-create-form
|
|
15
|
+
* sections are flat (`fields` only) — a `group` nested inside a `group` is
|
|
16
|
+
* diagnosed and dropped (its own contents only; the outer group keeps its
|
|
17
|
+
* direct fields), since there is no nested-section shape to target.
|
|
18
|
+
*
|
|
19
|
+
* Unlike `AppLayoutSectionWire`, `RecordCreateFormSectionWire` carries no
|
|
20
|
+
* section-type discriminator at all (no `type: "group"` to set) — otherwise
|
|
21
|
+
* the mapping is identical, so this is intentionally a near-duplicate of
|
|
22
|
+
* `displayBlocksToLayoutSections` rather than a shared generic: the two
|
|
23
|
+
* target wire shapes are close enough to invite one, but diverge exactly at
|
|
24
|
+
* the field this module must NOT set.
|
|
25
|
+
*
|
|
26
|
+
* This is a pure, entity-agnostic transform (it knows nothing about apps or
|
|
27
|
+
* elements) — kept alongside `display-blocks.ts` rather than under
|
|
28
|
+
* `entities/element/`.
|
|
29
|
+
*/
|
|
30
|
+
import type { RecordCreateFormSectionWire } from "../record-create-form/to-tf.js";
|
|
31
|
+
/**
|
|
32
|
+
* Maps serialized `recordCreateDisplayBlocks` (the `Record<string,
|
|
33
|
+
* unknown>[]` shape `serializeDisplayBlocks` produces) into
|
|
34
|
+
* `elementum_record_create_form` sections.
|
|
35
|
+
*
|
|
36
|
+
* - A top-level `GROUP` block → one section (`name`/`icon`/`color`/
|
|
37
|
+
* `maxColumns` carried over, `fields` from its direct `FIELD` children).
|
|
38
|
+
* `displayOrder`/`displayLocation`/`sideNavItem`/`hidden`/`agent` are not
|
|
39
|
+
* authorable through `DisplayBlock` — `recordCreateFormToTf` defaults them
|
|
40
|
+
* (index-based `display_order`, `"CENTER"`, `true`, `false`) the same way
|
|
41
|
+
* it does for a directly-authored `recordCreateForm` section that omits
|
|
42
|
+
* them.
|
|
43
|
+
* - Top-level `FIELD` blocks with no enclosing group are collected into one
|
|
44
|
+
* implicit group section named `"Details"` (the target shape requires a
|
|
45
|
+
* non-empty section name — see `IMPLICIT_GROUP_NAME`). Intentionally
|
|
46
|
+
* always appended LAST, after every named `GROUP` section — see
|
|
47
|
+
* `displayBlocksToLayoutSections`'s doc comment for why a fixed,
|
|
48
|
+
* deterministic position was chosen over inferring one from interleaving.
|
|
49
|
+
* - `WIDGET`/`COMMENTS` blocks (top-level or nested) and nested `GROUP`
|
|
50
|
+
* blocks are diagnosed and dropped individually; everything else mappable
|
|
51
|
+
* in the same payload still lands. A block with no recognizable shape at
|
|
52
|
+
* all (not a record, or missing/malformed `properties.type`) is likewise
|
|
53
|
+
* diagnosed and dropped rather than silently ignored.
|
|
54
|
+
*/
|
|
55
|
+
export declare function displayBlocksToRecordCreateFormSections(blocks: readonly unknown[], where: string, diagnostics: string[]): RecordCreateFormSectionWire[];
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/** Default name for the implicit group synthesized below — the provider's
|
|
2
|
+
* own Create() validation rejects a section with an empty `name` (required,
|
|
3
|
+
* not merely cosmetic), so this can never be `""`. */
|
|
4
|
+
const IMPLICIT_GROUP_NAME = "Details";
|
|
5
|
+
function isRecord(value) {
|
|
6
|
+
return typeof value === "object" && value !== null;
|
|
7
|
+
}
|
|
8
|
+
/** The `properties.type` discriminator `serializeBlock` writes: "FIELD" | "GROUP" | "WIDGET" | "COMMENTS". */
|
|
9
|
+
function serializedBlockType(block) {
|
|
10
|
+
const props = block["properties"];
|
|
11
|
+
return isRecord(props) && typeof props["type"] === "string" ? props["type"] : undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Maps serialized `recordCreateDisplayBlocks` (the `Record<string,
|
|
15
|
+
* unknown>[]` shape `serializeDisplayBlocks` produces) into
|
|
16
|
+
* `elementum_record_create_form` sections.
|
|
17
|
+
*
|
|
18
|
+
* - A top-level `GROUP` block → one section (`name`/`icon`/`color`/
|
|
19
|
+
* `maxColumns` carried over, `fields` from its direct `FIELD` children).
|
|
20
|
+
* `displayOrder`/`displayLocation`/`sideNavItem`/`hidden`/`agent` are not
|
|
21
|
+
* authorable through `DisplayBlock` — `recordCreateFormToTf` defaults them
|
|
22
|
+
* (index-based `display_order`, `"CENTER"`, `true`, `false`) the same way
|
|
23
|
+
* it does for a directly-authored `recordCreateForm` section that omits
|
|
24
|
+
* them.
|
|
25
|
+
* - Top-level `FIELD` blocks with no enclosing group are collected into one
|
|
26
|
+
* implicit group section named `"Details"` (the target shape requires a
|
|
27
|
+
* non-empty section name — see `IMPLICIT_GROUP_NAME`). Intentionally
|
|
28
|
+
* always appended LAST, after every named `GROUP` section — see
|
|
29
|
+
* `displayBlocksToLayoutSections`'s doc comment for why a fixed,
|
|
30
|
+
* deterministic position was chosen over inferring one from interleaving.
|
|
31
|
+
* - `WIDGET`/`COMMENTS` blocks (top-level or nested) and nested `GROUP`
|
|
32
|
+
* blocks are diagnosed and dropped individually; everything else mappable
|
|
33
|
+
* in the same payload still lands. A block with no recognizable shape at
|
|
34
|
+
* all (not a record, or missing/malformed `properties.type`) is likewise
|
|
35
|
+
* diagnosed and dropped rather than silently ignored.
|
|
36
|
+
*/
|
|
37
|
+
export function displayBlocksToRecordCreateFormSections(blocks, where, diagnostics) {
|
|
38
|
+
const sections = [];
|
|
39
|
+
const implicitFields = [];
|
|
40
|
+
for (const raw of blocks) {
|
|
41
|
+
if (!isRecord(raw)) {
|
|
42
|
+
diagnostics.push(`${where}: a block has an unrecognized shape; dropped`);
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const kind = serializedBlockType(raw);
|
|
46
|
+
if (kind === "GROUP") {
|
|
47
|
+
sections.push(groupBlockToSection(raw, where, diagnostics));
|
|
48
|
+
}
|
|
49
|
+
else if (kind === "FIELD") {
|
|
50
|
+
implicitFields.push(raw["fieldId"]);
|
|
51
|
+
}
|
|
52
|
+
else if (kind === undefined) {
|
|
53
|
+
diagnostics.push(`${where}: a block has an unrecognized shape; dropped`);
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
diagnostics.push(`${where}: "${kind.toLowerCase()}" blocks have no terraform record create form equivalent; dropped`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (implicitFields.length > 0) {
|
|
60
|
+
sections.push({ name: IMPLICIT_GROUP_NAME, fields: implicitFields });
|
|
61
|
+
}
|
|
62
|
+
return sections;
|
|
63
|
+
}
|
|
64
|
+
function groupBlockToSection(block, where, diagnostics) {
|
|
65
|
+
const props = isRecord(block["properties"]) ? block["properties"] : {};
|
|
66
|
+
const children = Array.isArray(block["children"]) ? block["children"] : [];
|
|
67
|
+
const fields = [];
|
|
68
|
+
for (const child of children) {
|
|
69
|
+
if (!isRecord(child)) {
|
|
70
|
+
diagnostics.push(`${where}: a nested block has an unrecognized shape; dropped`);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
const childKind = serializedBlockType(child);
|
|
74
|
+
if (childKind === "FIELD") {
|
|
75
|
+
fields.push(child["fieldId"]);
|
|
76
|
+
}
|
|
77
|
+
else if (childKind === "GROUP") {
|
|
78
|
+
diagnostics.push(`${where}: nested group blocks have no terraform record create form equivalent; dropped`);
|
|
79
|
+
}
|
|
80
|
+
else if (childKind === undefined) {
|
|
81
|
+
diagnostics.push(`${where}: a nested block has an unrecognized shape; dropped`);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
diagnostics.push(`${where}: "${childKind.toLowerCase()}" blocks have no terraform record create form equivalent; dropped`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
// A group block's own name comes from authored `DisplayBlock.group.name`
|
|
89
|
+
// (a required string on the authoring type — see display-blocks.ts) —
|
|
90
|
+
// this fallback only guards against a malformed/missing properties.name
|
|
91
|
+
// in the serialized shape, which "shouldn't happen" but must still never
|
|
92
|
+
// produce the empty string the provider rejects.
|
|
93
|
+
name: typeof props["name"] === "string" && props["name"] !== "" ? props["name"] : IMPLICIT_GROUP_NAME,
|
|
94
|
+
icon: typeof props["icon"] === "string" ? props["icon"] : undefined,
|
|
95
|
+
color: typeof props["color"] === "string" ? props["color"] : undefined,
|
|
96
|
+
maxColumns: typeof props["maxColumns"] === "number" ? props["maxColumns"] : undefined,
|
|
97
|
+
fields,
|
|
98
|
+
};
|
|
99
|
+
}
|