@elementumai/edk 0.9.18 → 0.9.20
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 +154 -9
- package/dist-sdk/src/catalog/factories.d.ts +35 -1
- package/dist-sdk/src/catalog/factories.js +36 -0
- package/dist-sdk/src/catalog/from-authoring.d.ts +13 -8
- package/dist-sdk/src/catalog/from-authoring.js +34 -9
- 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.d.ts +39 -1
- package/dist-sdk/src/catalog/org.js +460 -50
- package/dist-sdk/src/catalog/render.js +6 -6
- package/dist-sdk/src/catalog/token.js +7 -0
- package/dist-sdk/src/catalog/types.d.ts +44 -1
- package/dist-sdk/src/catalog/types.js +13 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +39 -3
- package/dist-sdk/src/core/triggers/on-demand.js +10 -2
- package/dist-sdk/src/engine/build/context.d.ts +1 -1
- package/dist-sdk/src/engine/ei/run.d.ts +149 -0
- package/dist-sdk/src/engine/ei/run.js +1132 -0
- package/dist-sdk/src/engine/logging.d.ts +17 -0
- package/dist-sdk/src/engine/logging.js +18 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +5 -0
- package/dist-sdk/src/engine/pull/ref-only.js +64 -27
- package/dist-sdk/src/engine/pull/result-output.d.ts +8 -0
- package/dist-sdk/src/engine/pull/result-output.js +88 -4
- package/dist-sdk/src/engine/tf/expr.js +39 -14
- package/dist-sdk/src/engine/tf/index.d.ts +3 -3
- package/dist-sdk/src/engine/tf/index.js +2 -2
- package/dist-sdk/src/engine/tf/labels.d.ts +8 -0
- package/dist-sdk/src/engine/tf/labels.js +13 -0
- package/dist-sdk/src/engine/tf/model.d.ts +22 -1
- package/dist-sdk/src/engine/tf/parse.d.ts +19 -0
- package/dist-sdk/src/engine/tf/parse.js +197 -10
- package/dist-sdk/src/engine/tf/render.d.ts +4 -2
- package/dist-sdk/src/engine/tf/render.js +41 -7
- package/dist-sdk/src/engine/validation.d.ts +39 -0
- package/dist-sdk/src/engine/validation.js +85 -0
- package/dist-sdk/src/engine/workspace/loader.js +49 -12
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +11 -1
- package/dist-sdk/src/entities/access-policy/from-tf.js +6 -1
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +11 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +16 -6
- package/dist-sdk/src/entities/agent/build.d.ts +4 -16
- package/dist-sdk/src/entities/agent/build.js +40 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +4 -2
- package/dist-sdk/src/entities/agent/to-tf.js +6 -3
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +7 -1
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +29 -6
- package/dist-sdk/src/entities/app/build.d.ts +98 -19
- package/dist-sdk/src/entities/app/build.js +51 -19
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +22 -1
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/app/from-tf.js +11 -5
- package/dist-sdk/src/entities/app/index.d.ts +6 -5
- package/dist-sdk/src/entities/app/index.js +2 -0
- package/dist-sdk/src/entities/app/module.js +18 -2
- package/dist-sdk/src/entities/app/to-tf.js +21 -11
- package/dist-sdk/src/entities/automation/build.d.ts +49 -6
- package/dist-sdk/src/entities/automation/build.js +163 -19
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +24 -1
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +320 -39
- package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -6
- package/dist-sdk/src/entities/automation/from-tf.js +563 -74
- package/dist-sdk/src/entities/automation/generated/task-output-contracts.d.ts +33 -0
- package/dist-sdk/src/entities/automation/generated/task-output-contracts.js +183 -0
- 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/module.d.ts +2 -0
- package/dist-sdk/src/entities/automation/module.js +93 -8
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +7 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +36 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +9 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +13 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +17 -0
- package/dist-sdk/src/entities/automation/script-code.js +91 -5
- package/dist-sdk/src/entities/automation/system-ref-name.d.ts +16 -0
- package/dist-sdk/src/entities/automation/system-ref-name.js +48 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +17 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +47 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +53 -4
- package/dist-sdk/src/entities/automation/tasks.js +38 -9
- package/dist-sdk/src/entities/automation/to-tf.d.ts +4 -0
- package/dist-sdk/src/entities/automation/to-tf.js +647 -167
- package/dist-sdk/src/entities/automation/triggers.d.ts +4 -2
- package/dist-sdk/src/entities/automation/triggers.js +4 -0
- package/dist-sdk/src/entities/automation/types.js +1 -0
- package/dist-sdk/src/entities/chart/from-tf.js +33 -17
- package/dist-sdk/src/entities/chart/module.js +3 -1
- package/dist-sdk/src/entities/chart/printer.d.ts +1 -0
- package/dist-sdk/src/entities/chart/printer.js +26 -16
- package/dist-sdk/src/entities/chart/rebind-owner.d.ts +3 -0
- package/dist-sdk/src/entities/chart/rebind-owner.js +42 -0
- package/dist-sdk/src/entities/chart/to-tf.js +21 -12
- package/dist-sdk/src/entities/dashboard/build.d.ts +4 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +15 -4
- package/dist-sdk/src/entities/dashboard/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/dashboard/to-tf.js +13 -0
- package/dist-sdk/src/entities/dashboard-widget/module.js +4 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +72 -30
- package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +3 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.js +5 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +9 -6
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +188 -26
- package/dist-sdk/src/entities/dynamic-layout/module.js +4 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +5 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +254 -23
- package/dist-sdk/src/entities/element/build.d.ts +33 -13
- package/dist-sdk/src/entities/element/build.js +5 -1
- package/dist-sdk/src/entities/element/from-tf.d.ts +12 -0
- package/dist-sdk/src/entities/element/from-tf.js +64 -3
- package/dist-sdk/src/entities/element/index.d.ts +5 -2
- package/dist-sdk/src/entities/element/index.js +2 -0
- package/dist-sdk/src/entities/element/module.js +11 -3
- package/dist-sdk/src/entities/element/to-tf.js +20 -2
- package/dist-sdk/src/entities/field/build.d.ts +14 -1
- package/dist-sdk/src/entities/field/build.js +3 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/field/from-tf.js +50 -1
- package/dist-sdk/src/entities/field/media-types.d.ts +6 -0
- package/dist-sdk/src/entities/field/media-types.js +30 -0
- package/dist-sdk/src/entities/field/module.js +1 -0
- package/dist-sdk/src/entities/field/to-tf.d.ts +23 -2
- package/dist-sdk/src/entities/field/to-tf.js +142 -22
- package/dist-sdk/src/entities/file-reader/from-tf.js +14 -5
- package/dist-sdk/src/entities/file-reader/module.js +1 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +2 -0
- package/dist-sdk/src/entities/file-reader/types.js +1 -1
- package/dist-sdk/src/entities/portal/build.d.ts +26 -0
- package/dist-sdk/src/entities/portal/build.js +37 -0
- package/dist-sdk/src/entities/portal/from-tf.d.ts +27 -0
- package/dist-sdk/src/entities/portal/from-tf.js +75 -0
- package/dist-sdk/src/entities/portal/index.d.ts +1 -0
- package/dist-sdk/src/entities/portal/index.js +1 -0
- package/dist-sdk/src/entities/portal/module.d.ts +3 -0
- package/dist-sdk/src/entities/portal/module.js +28 -0
- package/dist-sdk/src/entities/portal/to-tf.d.ts +12 -0
- package/dist-sdk/src/entities/portal/to-tf.js +73 -0
- package/dist-sdk/src/entities/portal/types.d.ts +1 -0
- package/dist-sdk/src/entities/portal/types.js +1 -0
- package/dist-sdk/src/entities/relationship/from-tf.d.ts +8 -1
- package/dist-sdk/src/entities/relationship/from-tf.js +53 -10
- package/dist-sdk/src/entities/relationship/module.js +2 -0
- package/dist-sdk/src/entities/relationship/pair-check.d.ts +7 -0
- package/dist-sdk/src/entities/relationship/pair-check.js +68 -0
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +10 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +31 -13
- package/dist-sdk/src/entities/search-table/module.js +1 -0
- package/dist-sdk/src/entities/search-table/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/to-tf.js +1 -1
- package/dist-sdk/src/entities/service-account/build.d.ts +15 -2
- package/dist-sdk/src/entities/service-account/from-tf.d.ts +2 -4
- package/dist-sdk/src/entities/service-account/from-tf.js +17 -5
- package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +56 -0
- package/dist-sdk/src/entities/service-account/role-fidelity.js +243 -0
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/service-account/to-tf.js +17 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +5 -2
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +15 -2
- package/dist-sdk/src/entities/shared/filters/index.d.ts +25 -2
- package/dist-sdk/src/entities/shared/filters/index.js +38 -5
- package/dist-sdk/src/entities/shared/filters/print.js +31 -3
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +25 -3
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +51 -15
- package/dist-sdk/src/entities/shared/filters/types.d.ts +22 -5
- package/dist-sdk/src/entities/shared/foreign-ref.d.ts +16 -0
- package/dist-sdk/src/entities/shared/foreign-ref.js +17 -1
- package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -9
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -5
- package/dist-sdk/src/entities/shared/types/field-types.js +4 -0
- package/dist-sdk/src/entities/skill/access-policy.d.ts +17 -0
- package/dist-sdk/src/entities/skill/access-policy.js +101 -0
- package/dist-sdk/src/entities/skill/build.d.ts +3 -0
- package/dist-sdk/src/entities/skill/build.js +3 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +4 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +23 -1
- package/dist-sdk/src/entities/skill/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill/from-tf.js +70 -22
- package/dist-sdk/src/entities/skill/index.d.ts +2 -0
- package/dist-sdk/src/entities/skill/index.js +1 -0
- package/dist-sdk/src/entities/skill/input-coverage.d.ts +7 -0
- package/dist-sdk/src/entities/skill/input-coverage.js +11 -0
- package/dist-sdk/src/entities/skill/module.js +1 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/skill/to-tf.js +19 -6
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +8 -2
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/skill-tool/to-tf.js +29 -6
- package/dist-sdk/src/entities/table/catalog.d.ts +14 -0
- package/dist-sdk/src/entities/table/catalog.js +66 -0
- package/dist-sdk/src/entities/table/module.js +2 -1
- package/dist-sdk/src/entities/table/to-tf.js +5 -5
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +89 -0
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +277 -0
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +51 -0
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +360 -0
- package/dist-sdk/src/entities/view/agent-view-layout.d.ts +151 -0
- package/dist-sdk/src/entities/view/agent-view-layout.js +21 -0
- package/dist-sdk/src/entities/view/from-tf.d.ts +6 -3
- package/dist-sdk/src/entities/view/from-tf.js +161 -14
- package/dist-sdk/src/entities/view/module.js +30 -3
- package/dist-sdk/src/entities/view/to-tf.d.ts +24 -2
- package/dist-sdk/src/entities/view/to-tf.js +95 -9
- package/dist-sdk/src/entities/view/types.d.ts +4 -15
- package/dist-sdk/src/entities/view/types.js +17 -15
- package/dist-sdk/src/entities/widget/build.d.ts +16 -1
- package/dist-sdk/src/entities/widget/build.js +11 -1
- package/dist-sdk/src/entities/widget/to-tf.js +36 -10
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +38 -10
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +54 -0
- package/dist-sdk/src/graph/index.js +30 -0
- package/dist-sdk/src/graph/modules.js +2 -0
- package/dist-sdk/src/graph/types.d.ts +133 -2
- package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
- package/dist-sdk/src/internal/sdk-package.js +1 -0
- package/package.json +11 -1
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
* v2 app/element authoring — `app`. Parallel to v1 `src/aspects`,
|
|
3
|
-
* standalone from it.
|
|
4
|
-
*
|
|
5
|
-
* Produces a `DeployableEntity` of kind `app`/`element` with `parent: "org"` (apps are
|
|
6
|
-
* org-owned), whose payload is the platform's `AgentAspectInput` compose body.
|
|
7
|
-
* The cloud link is a `CatalogRef` token resolved at deploy; fields are authored
|
|
8
|
-
* inline (a new app's fields get server-assigned ids on compose). Deployed via
|
|
9
|
-
* the wire client's compose path (`composeAspect`).
|
|
10
|
-
*
|
|
11
|
-
* Includes typed scalar, Dropdown/Multi-Select, relation, calculation, and
|
|
12
|
-
* record-experience configuration with build/pull round-trip support.
|
|
13
|
-
*/
|
|
14
|
-
import { slimTokens } from "../../catalog/index.js";
|
|
1
|
+
import { slimTokens, viewType } from "../../catalog/index.js";
|
|
15
2
|
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";
|
|
16
3
|
import { serializeDisplayBlocks } from "./display-blocks.js";
|
|
17
4
|
import { assertCalculatedFieldRoot } from "../field/calc/runtime.js";
|
|
5
|
+
import { assertAttachmentMediaTypes } from "../field/media-types.js";
|
|
18
6
|
export { dashboardChartWidget, dashboardRecordsWidget, dashboardWidgetSize, } from "../dashboard/build.js";
|
|
7
|
+
/** The view bag each authoring property holds (see {@link ViewRef.viewType}). */
|
|
8
|
+
export const APP_VIEW_BAGS = {
|
|
9
|
+
listViews: viewType.list,
|
|
10
|
+
calendarViews: viewType.calendar,
|
|
11
|
+
kanbanViews: viewType.kanban,
|
|
12
|
+
dashboardViews: viewType.dashboard,
|
|
13
|
+
agentViews: viewType.agent,
|
|
14
|
+
customViews: viewType.custom,
|
|
15
|
+
};
|
|
19
16
|
/**
|
|
20
17
|
* Map a platform field type to the `AspectFieldInput` variant key. "relation"
|
|
21
18
|
* is a terraform-only synthetic key (no `elementum-entity-client` REST
|
|
@@ -185,6 +182,11 @@ export function serializeField(field, refName) {
|
|
|
185
182
|
if (key === "decimal" && field.decimalPlaces !== undefined) {
|
|
186
183
|
base.decimalPlaces = field.decimalPlaces;
|
|
187
184
|
}
|
|
185
|
+
if ((field.type === "ATTACHMENT" || field.type === "ATTACHMENT_ID") && field.mediaTypes !== undefined) {
|
|
186
|
+
assertAttachmentMediaTypes(field.name, field.mediaTypes);
|
|
187
|
+
if (field.mediaTypes.length > 0)
|
|
188
|
+
base.mediaTypes = [...field.mediaTypes];
|
|
189
|
+
}
|
|
188
190
|
if ((key === "text" || key === "html") && field.qrFormat !== undefined) {
|
|
189
191
|
base.format = field.qrFormat;
|
|
190
192
|
}
|
|
@@ -227,11 +229,17 @@ export function serializeSystemFields(overrides) {
|
|
|
227
229
|
const tag = SYSTEM_FIELD_TAG_BY_KEY[key];
|
|
228
230
|
const override = overrides[key];
|
|
229
231
|
const name = override.name ?? DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES[key];
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
232
|
+
// Validation flags travel only when authored: a system field named or
|
|
233
|
+
// given options alone leaves its flags to the platform. Unset flags of an
|
|
234
|
+
// authored set take the platform's own defaults.
|
|
235
|
+
const authoredFlags = override.required !== undefined || override.requiredOnClose !== undefined || override.showOnCreate !== undefined;
|
|
236
|
+
const flags = authoredFlags
|
|
237
|
+
? {
|
|
238
|
+
required: override.required ?? SYSTEM_FIELD_REQUIRED[key],
|
|
239
|
+
requiredOnClose: override.requiredOnClose ?? false,
|
|
240
|
+
showOnCreate: override.showOnCreate ?? false,
|
|
241
|
+
}
|
|
242
|
+
: {};
|
|
235
243
|
if (key === "stage") {
|
|
236
244
|
// Constructed directly, not via serializeField: the REST compose API
|
|
237
245
|
// rejects stage picklistValues (stage mutations have dedicated
|
|
@@ -298,6 +306,28 @@ function validateAppOptions(opts) {
|
|
|
298
306
|
export function picklistOptionLabels(options) {
|
|
299
307
|
return options.map((option) => typeof option === "string" ? option : option.label);
|
|
300
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* One `ViewRef` per authored view, keyed by its bag key and stamped with the
|
|
311
|
+
* owner's identity, so other stream roots (a portal's menu) can reference it.
|
|
312
|
+
*/
|
|
313
|
+
export function appViewRefs(bags, owner, parentKind) {
|
|
314
|
+
const out = {};
|
|
315
|
+
for (const [bag, type] of Object.entries(APP_VIEW_BAGS)) {
|
|
316
|
+
for (const [key, view] of Object.entries(bags[bag] ?? {})) {
|
|
317
|
+
out[key] = {
|
|
318
|
+
__kind: "view",
|
|
319
|
+
refName: key,
|
|
320
|
+
name: view.name,
|
|
321
|
+
parent: owner.refName,
|
|
322
|
+
viewType: type,
|
|
323
|
+
parentKind,
|
|
324
|
+
parentName: owner.name,
|
|
325
|
+
...(owner.namespace !== undefined ? { parentNamespace: owner.namespace } : {}),
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return out;
|
|
330
|
+
}
|
|
301
331
|
export function app(opts) {
|
|
302
332
|
validateAppOptions(opts);
|
|
303
333
|
const fieldEntries = Object.values(opts.fields);
|
|
@@ -360,6 +390,7 @@ export function app(opts) {
|
|
|
360
390
|
name: opts.name,
|
|
361
391
|
...(opts.namespace !== undefined ? { namespace: opts.namespace } : {}),
|
|
362
392
|
fields,
|
|
393
|
+
views: appViewRefs(opts, { refName, name: opts.name, ...(opts.namespace !== undefined ? { namespace: opts.namespace } : {}) }, kind),
|
|
363
394
|
agent(childRefName, name = childRefName) {
|
|
364
395
|
return { __kind: "agent", refName: childRefName, name, parent: refName };
|
|
365
396
|
},
|
|
@@ -437,6 +468,7 @@ export function app(opts) {
|
|
|
437
468
|
...(opts.widgets !== undefined ? { widgets: opts.widgets } : {}),
|
|
438
469
|
...(opts.dashboardViews !== undefined ? { dashboardViews: opts.dashboardViews } : {}),
|
|
439
470
|
...(opts.agentViews !== undefined ? { agentViews: opts.agentViews } : {}),
|
|
471
|
+
...(opts.customViews !== undefined ? { customViews: opts.customViews } : {}),
|
|
440
472
|
...(opts.recordCreateForm !== undefined ? { recordCreateForm: opts.recordCreateForm } : {}),
|
|
441
473
|
...(opts.dynamicLayouts !== undefined ? { dynamicLayouts: opts.dynamicLayouts } : {}),
|
|
442
474
|
...(opts.relationships !== undefined ? { relationships: opts.relationships } : {}),
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* pristine-refactor pipeline these shapes are produced from `ei export`
|
|
10
10
|
* HCL streams instead (see `appFromTf`).
|
|
11
11
|
*/
|
|
12
|
+
import type { NormalizedAgentViewLayout } from "../../view/agent-view-layout-from-tf.js";
|
|
12
13
|
import type { AppCategory, AppField, AppStage, AspectType } from "../../../core/types/app.js";
|
|
13
14
|
import type { DisplayBlock } from "../../../core/types/display-block.js";
|
|
14
15
|
import type { NormalizedAccessPolicy } from "../../access-policy/from-tf.js";
|
|
@@ -121,6 +122,8 @@ export interface NormalizedLayoutSection {
|
|
|
121
122
|
readonly maxColumns?: number;
|
|
122
123
|
readonly fields?: readonly string[];
|
|
123
124
|
readonly widgets?: readonly string[];
|
|
125
|
+
/** `group` only — the app-owned agent embedded in the section, by bag key. */
|
|
126
|
+
readonly agentKey?: string;
|
|
124
127
|
}
|
|
125
128
|
/** A stage's record-detail layout, keyed by stage key on `NormalizedApp.layouts`. */
|
|
126
129
|
export interface NormalizedLayout {
|
|
@@ -148,6 +151,20 @@ export interface NormalizedAgentView extends ManagedViewSharing {
|
|
|
148
151
|
readonly filter?: Filter<RefExpr, RefExpr>;
|
|
149
152
|
readonly sort?: NormalizedManagedViewSort;
|
|
150
153
|
readonly displayOrder?: number;
|
|
154
|
+
readonly layout?: NormalizedAgentViewLayout;
|
|
155
|
+
}
|
|
156
|
+
/** A Custom view (`elementum_custom_view`): a page of Elementum Blocks. */
|
|
157
|
+
export interface NormalizedCustomView extends ManagedViewSharing {
|
|
158
|
+
readonly key: string;
|
|
159
|
+
readonly name: string;
|
|
160
|
+
/** Own agent bag key, when the view has an agent. */
|
|
161
|
+
readonly agentKey?: string;
|
|
162
|
+
readonly allowRecordCreation?: boolean;
|
|
163
|
+
readonly filter?: Filter<RefExpr, RefExpr>;
|
|
164
|
+
readonly sort?: NormalizedManagedViewSort;
|
|
165
|
+
readonly displayOrder?: number;
|
|
166
|
+
/** Plain JSON with `AgentViewSpecMarker` objects at reference positions. */
|
|
167
|
+
readonly layout?: unknown;
|
|
151
168
|
}
|
|
152
169
|
/** A calendar view (`elementum_calendar_view`). */
|
|
153
170
|
export interface NormalizedCalendarView extends ManagedViewSharing {
|
|
@@ -181,6 +198,7 @@ export type NormalizedDashboardWidget = {
|
|
|
181
198
|
readonly kind: "app" | "element";
|
|
182
199
|
};
|
|
183
200
|
readonly filter?: Filter<RefExpr, RefExpr>;
|
|
201
|
+
readonly sort?: NormalizedManagedViewSort;
|
|
184
202
|
} | {
|
|
185
203
|
readonly key: string;
|
|
186
204
|
readonly name: string;
|
|
@@ -267,7 +285,7 @@ export interface NormalizedRecordCreateForm {
|
|
|
267
285
|
readonly sections: readonly NormalizedRecordCreateFormSection[];
|
|
268
286
|
}
|
|
269
287
|
export interface PulledDynamicLayoutRef {
|
|
270
|
-
readonly __pulledRef: "field" | "automation" | "agent" | "app" | "element" | "task";
|
|
288
|
+
readonly __pulledRef: "field" | "automation" | "agent" | "app" | "element" | "task" | "widget";
|
|
271
289
|
readonly key: string;
|
|
272
290
|
readonly parent?: string;
|
|
273
291
|
readonly name?: string;
|
|
@@ -335,6 +353,8 @@ export interface NormalizedApp {
|
|
|
335
353
|
readonly cloudLinkId?: string;
|
|
336
354
|
readonly cloudLinkClientHandle?: string;
|
|
337
355
|
readonly commentsEnabled?: boolean;
|
|
356
|
+
/** Element only: the platform gave it audit fields (created/updated at/by). */
|
|
357
|
+
readonly auditFields?: boolean;
|
|
338
358
|
readonly lockStages?: boolean;
|
|
339
359
|
readonly cloudOptions?: {
|
|
340
360
|
readonly snowflake?: {
|
|
@@ -359,6 +379,7 @@ export interface NormalizedApp {
|
|
|
359
379
|
readonly widgets?: readonly NormalizedWidget[];
|
|
360
380
|
/** Agent-powered record views (`elementum_agent_view`). */
|
|
361
381
|
readonly agentViews?: readonly NormalizedAgentView[];
|
|
382
|
+
readonly customViews?: readonly NormalizedCustomView[];
|
|
362
383
|
/** New-record form (`elementum_record_create_form`). */
|
|
363
384
|
readonly recordCreateForm?: NormalizedRecordCreateForm;
|
|
364
385
|
readonly dynamicLayouts?: readonly NormalizedDynamicLayout[];
|
|
@@ -22,6 +22,7 @@ export interface AppFromTfViewBlocks {
|
|
|
22
22
|
readonly kanbanViewBlocks: readonly TfBlock[];
|
|
23
23
|
readonly dashboardViewBlocks: readonly TfBlock[];
|
|
24
24
|
readonly agentViewBlocks: readonly TfBlock[];
|
|
25
|
+
readonly customViewBlocks?: readonly TfBlock[];
|
|
25
26
|
readonly managedViewOrderBlocks: readonly TfBlock[];
|
|
26
27
|
readonly recordCreateFormBlocks: readonly TfBlock[];
|
|
27
28
|
readonly dynamicLayoutBlocks: readonly TfBlock[];
|
|
@@ -140,7 +140,7 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
|
|
|
140
140
|
}
|
|
141
141
|
// --- System-field attributes/config → tagged NormalizedField entries.
|
|
142
142
|
const fields = [];
|
|
143
|
-
const owner = { type: APP_RESOURCE_TYPE, label, scope: "app" };
|
|
143
|
+
const owner = { type: APP_RESOURCE_TYPE, label, scope: "app", refName };
|
|
144
144
|
const customFields = fieldBlocks.flatMap((block) => {
|
|
145
145
|
const entry = fieldFromTf(block, owner, ctx);
|
|
146
146
|
return entry === undefined ? [] : [entry];
|
|
@@ -213,14 +213,15 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
|
|
|
213
213
|
}
|
|
214
214
|
// --- View pass: layouts / list views / view order (entities/view), owner passed in.
|
|
215
215
|
const dashboards = dashboardsFromTf(viewBlocks.dashboardBlocks, viewBlocks.dashboardWidgetBlocks, { type: APP_RESOURCE_TYPE, label, ownerTfLabel: refName, ownerRefName: refName, scope: "app", ownerType: "APP_ASPECT" }, ctx);
|
|
216
|
-
const { layouts, listViews, calendarViews, kanbanViews, dashboardViews, agentViews, viewOrder } = viewsFromTf(viewBlocks.layoutBlocks, viewBlocks.listViewBlocks, viewBlocks.calendarViewBlocks, viewBlocks.kanbanViewBlocks, viewBlocks.dashboardViewBlocks, viewBlocks.agentViewBlocks, viewBlocks.managedViewOrderBlocks, { type: APP_RESOURCE_TYPE, label, ownerTfLabel: label, scope: "app", stageKeys: new Set(stages.map((stage) => stage.key)) }, ctx);
|
|
216
|
+
const { layouts, listViews, calendarViews, kanbanViews, dashboardViews, agentViews, customViews, viewOrder } = viewsFromTf(viewBlocks.layoutBlocks, viewBlocks.listViewBlocks, viewBlocks.calendarViewBlocks, viewBlocks.kanbanViewBlocks, viewBlocks.dashboardViewBlocks, viewBlocks.agentViewBlocks, viewBlocks.managedViewOrderBlocks, { type: APP_RESOURCE_TYPE, label, ownerTfLabel: label, scope: "app", stageKeys: new Set(stages.map((stage) => stage.key)) }, ctx, viewBlocks.customViewBlocks);
|
|
217
217
|
if (viewBlocks.recordCreateFormBlocks.length > 1) {
|
|
218
218
|
ctx.diagnostics.push(`app "${label}": found ${viewBlocks.recordCreateFormBlocks.length} record create forms; only the first is used`);
|
|
219
219
|
}
|
|
220
220
|
const recordCreateForm = recordCreateFormFromTf(viewBlocks.recordCreateFormBlocks[0], { type: APP_RESOURCE_TYPE, label, ownerTfLabel: refName, scope: "app" }, ctx);
|
|
221
|
-
const
|
|
221
|
+
const dynamicLayoutOwner = { type: APP_RESOURCE_TYPE, label, ownerRefName: refName, ownerTfLabel: label };
|
|
222
|
+
const dynamicLayouts = dynamicLayoutsFromTf(viewBlocks.dynamicLayoutBlocks, dynamicLayoutOwner, ctx);
|
|
222
223
|
const relationships = relationshipsFromTf(viewBlocks.relationshipBlocks, { kind: "app", label, ownerRefName: refName, ownerTfLabel: refName, scope: "app" }, ctx);
|
|
223
|
-
const widgets = widgetsFromTf(viewBlocks.widgetBlocks, { type: APP_RESOURCE_TYPE, label, ownerRefName: refName, ownerTfLabel: label, scope: "app" }, ctx, dynamicLayoutCompanionWidgetLabels(viewBlocks.dynamicLayoutBlocks));
|
|
224
|
+
const widgets = widgetsFromTf(viewBlocks.widgetBlocks, { type: APP_RESOURCE_TYPE, label, ownerRefName: refName, ownerTfLabel: label, scope: "app" }, ctx, dynamicLayoutCompanionWidgetLabels(viewBlocks.dynamicLayoutBlocks, dynamicLayoutOwner));
|
|
224
225
|
// --- Access policies (entities/access-policy), owner passed in.
|
|
225
226
|
const accessPolicyOwner = {
|
|
226
227
|
type: APP_RESOURCE_TYPE,
|
|
@@ -236,7 +237,11 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
|
|
|
236
237
|
accessPolicies.push(entry);
|
|
237
238
|
}
|
|
238
239
|
const roles = rolesFromTf(roleBlocks, accessPolicyOwner, ctx);
|
|
239
|
-
const serviceAccounts = serviceAccountsFromTf([...serviceAccountBlocks, ...roleBlocks], {
|
|
240
|
+
const serviceAccounts = serviceAccountsFromTf([...serviceAccountBlocks, ...roleBlocks], {
|
|
241
|
+
label,
|
|
242
|
+
ownerTfLabel: label,
|
|
243
|
+
sourceFile: `apps/${refName}/${refName}.ts`,
|
|
244
|
+
}, ctx);
|
|
240
245
|
const app = {
|
|
241
246
|
id: appId ?? "",
|
|
242
247
|
name,
|
|
@@ -261,6 +266,7 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
|
|
|
261
266
|
...(dashboards.length > 0 && { dashboards }),
|
|
262
267
|
...(widgets.length > 0 && { widgets }),
|
|
263
268
|
...(agentViews.length > 0 && { agentViews }),
|
|
269
|
+
...(customViews.length > 0 && { customViews }),
|
|
264
270
|
...(recordCreateForm !== undefined && { recordCreateForm }),
|
|
265
271
|
...(dynamicLayouts.length > 0 && { dynamicLayouts }),
|
|
266
272
|
...(relationships.length > 0 && { relationships }),
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* `src/elements/build.ts`'s header for why apps and elements split into
|
|
6
6
|
* dedicated builders despite sharing this module's field/print internals.
|
|
7
7
|
*/
|
|
8
|
-
export { app, type AppAgentView, type AppCalendarView, type AppDashboardView, type AppKanbanView, type AppListView, type AppCategory, type AppCloudOptions, type AppField, type AppPicklistConfig, type AppPicklistDynamicConfig, type AppPicklistDynamicSortOrder, type AppRecordCreateForm, type AppRecordCreateFormSection, type AppConfigured, type AppFieldRefs, type AppRef, type AppSelfRef, type AppReferenceConfiguration, type AppV2Options, } from "./build.js";
|
|
8
|
+
export { app, type AppAgentView, type AppCustomView, type AppCalendarView, type AppDashboardView, type AppKanbanView, type AppListView, type AppCategory, type AppCloudOptions, type AppField, type AppPicklistConfig, type AppPicklistDynamicConfig, type AppPicklistDynamicSortOrder, type AppRecordCreateForm, type AppRecordCreateFormSection, type AppConfigured, type AppFieldRefs, type AppRef, type AppSelfRef, type AppReferenceConfiguration, type AppV2Options, } from "./build.js";
|
|
9
9
|
export { listViewDensity, managedViewSortAggregation, managedViewSortDirection, type ListViewDensity, type ManagedViewSort, type ManagedViewSortAggregation, type ManagedViewSortDirection, type ManagedViewSortField, type ManagedViewSortOrder, } from "../view/build.js";
|
|
10
|
-
export { type AppWidget, type CreateRecordWidget, type LinkRecordsWidget, type RelatedRecordsWidget, type RunAutomationWidget, type RunAutomationWidgetParameter, type WidgetButtonStyle, type WidgetButtonType, } from "../widget/build.js";
|
|
10
|
+
export { runAutomationParameterValue, type AppWidget, type CreateRecordWidget, type LinkRecordsWidget, type RelatedRecordsWidget, type RunAutomationParameterValue, type RunAutomationWidget, type RunAutomationWidgetParameter, type WidgetButtonStyle, type WidgetButtonType, } from "../widget/build.js";
|
|
11
11
|
export { type DisplayBlock } from "./display-blocks.js";
|
|
12
12
|
export { type AppRelationship, type AppRelationshipColumn } from "../relationship/build.js";
|
|
13
13
|
export { dashboardChartWidget, dashboardRecordsWidget, dashboardWidgetSize, type DashboardChartWidget, type DashboardRecordsWidget, type DashboardWidget, type DashboardWidgetSize, } from "../dashboard/build.js";
|
|
14
|
-
export { type AppDynamicLayout, type DynamicLayoutComponent, type DynamicLayoutCondition, type DynamicLayoutCssLength, type DynamicLayoutDependency, type DynamicLayoutFieldComponent, type DynamicLayoutFieldValidation, type DynamicLayoutSaveGroup, type DynamicLayoutStyle, type DynamicLayoutTypedValue, type DynamicLayoutValidationRule, dynamicLayout, } from "../dynamic-layout/build.js";
|
|
15
|
-
export { attachmentField, booleanField, calculatedField, dateField, dateTimeField, decimalField, dropdownDisplay, dropdownField, dropdownOption, dropdownValue, groupField, jsonField, multiSelectField, numberField, relationField, richTextField, textField, userField, type BaseFieldOptions, type CalculatedFieldOptions, type InferredCalculatedField, type DropdownConfig, type DropdownDisplay, type DropdownFieldOptions, type DropdownOption, type DropdownParentValueRef, type DynamicDropdownConfig, type DynamicDropdownParent, type DynamicDropdownParentMapping, type MultiSelectFieldOptions, type NumericFieldOptions, type NumericFieldFormat, type PicklistFieldOptions, type RelationFieldOptions, type TextFieldOptions, type QrFieldFormat, } from "../field/build.js";
|
|
14
|
+
export { type AppDynamicLayout, type DynamicLayoutBlockCommon, type DynamicLayoutComponent, type DynamicLayoutCondition, type DynamicLayoutCssLength, type DynamicLayoutDependency, type DynamicLayoutFieldComponent, type DynamicLayoutFieldValidation, type DynamicLayoutSaveGroup, type DynamicLayoutStyle, type DynamicLayoutTypedValue, type DynamicLayoutValidationRule, dynamicLayout, } from "../dynamic-layout/build.js";
|
|
15
|
+
export { attachmentField, booleanField, calculatedField, dateField, dateTimeField, decimalField, dropdownDisplay, dropdownField, dropdownOption, dropdownValue, groupField, jsonField, multiSelectField, numberField, relationField, richTextField, textField, userField, type AttachmentFieldOptions, type BaseFieldOptions, type CalculatedFieldOptions, type InferredCalculatedField, type DropdownConfig, type DropdownDisplay, type DropdownFieldOptions, type DropdownOption, type DropdownParentValueRef, type DynamicDropdownConfig, type DynamicDropdownParent, type DynamicDropdownParentMapping, type MultiSelectFieldOptions, type NumericFieldOptions, type NumericFieldFormat, type PicklistFieldOptions, type RelationFieldOptions, type TextFieldOptions, type QrFieldFormat, } from "../field/build.js";
|
|
16
16
|
export { asc, desc, sortBy, type SortDirection, type SortOrder } from "../shared/types/common.js";
|
|
17
17
|
export { calc, dateDifUnit, dateTimeTruncPrecision, field, orderByDirection, predicateOp, weekdayMode, type ConcatExprType, type DateDifUnit, type DateTimeTruncPrecision, type Expr, type ExprType, type FieldRefExprType, type OrderByDirection, type Predicate, type PredicateOp, type StringAggOptions, type StringAggOrderBy, type WeekdayMode, } from "../field/calc.js";
|
|
18
18
|
export { agentEvaluation, type AgentEvaluationConfigured, type AgentEvaluationOptions, } from "../agent-evaluation/index.js";
|
|
@@ -21,8 +21,9 @@ export { preservePulledCalculation } from "./deserializer/pulled-expression.js";
|
|
|
21
21
|
export { groupId, userId, type AccessPolicyGroupRef, type AccessPolicyOptions, type AccessPolicyPrincipalRef, type AccessPolicyUserRef, type GroupId, type UserId } from "../access-policy/build.js";
|
|
22
22
|
export { type ManagedViewSharing } from "../view/sharing.js";
|
|
23
23
|
export { type ElementumBlocksElement, type ElementumBlocksSpec } from "../view/ragnarok.js";
|
|
24
|
+
export { agentViewFontFamily, type AgentViewBlock, type AgentViewBranding, type AgentViewCustomView, type AgentViewFontFamily, type AgentViewHexColor, type AgentViewImage, type AgentViewSpecApp, type AgentViewSpecField, type AgentViewSpecFilterRef, type AppAgentViewLayout, type ViewBlock, type ViewBlocksField, type ViewBlocksFilterRef, type ViewBlocksLayout, type ViewBlocksSource, } from "../view/agent-view-layout.js";
|
|
24
25
|
export { roleAutoShare, rolePermissionGroup, rolePermissionLevel, userRef, type AppRole, type RoleAutoShare, type RoleGroupRef, type RolePermission, type RolePermissionGroup, type RolePermissionLevel, type RoleUserRef } from "../role/build.js";
|
|
25
|
-
export { serviceAccountRoleRef, serviceAccountStatus, type AppServiceAccount, type ServiceAccountAccessPolicy, type ServiceAccountRoleRef, type ServiceAccountStatus } from "../service-account/build.js";
|
|
26
|
+
export { serviceAccountRoleRef, serviceAccountStatus, type AppServiceAccount, type ServiceAccountAccessPolicy, type ServiceAccountRole, type ServiceAccountRoleRef, type ServiceAccountStatus } from "../service-account/build.js";
|
|
26
27
|
export { serviceAccountRef, type ServiceAccountRef } from "../service-account/ref.js";
|
|
27
28
|
export * as filter from "../shared/filters/index.js";
|
|
28
29
|
export { type Filter } from "../shared/filters/index.js";
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { app, } from "./build.js";
|
|
9
9
|
export { listViewDensity, managedViewSortAggregation, managedViewSortDirection, } from "../view/build.js";
|
|
10
|
+
export { runAutomationParameterValue, } from "../widget/build.js";
|
|
10
11
|
export { dashboardChartWidget, dashboardRecordsWidget, dashboardWidgetSize, } from "../dashboard/build.js";
|
|
11
12
|
export { dynamicLayout, } from "../dynamic-layout/build.js";
|
|
12
13
|
export { attachmentField, booleanField, calculatedField, dateField, dateTimeField, decimalField, dropdownDisplay, dropdownField, dropdownOption, dropdownValue, groupField, jsonField, multiSelectField, numberField, relationField, richTextField, textField, userField, } from "../field/build.js";
|
|
@@ -16,6 +17,7 @@ export { agentEvaluation, } from "../agent-evaluation/index.js";
|
|
|
16
17
|
export { phoneService, callerAccessMode, } from "../phone-service/index.js";
|
|
17
18
|
export { preservePulledCalculation } from "./deserializer/pulled-expression.js";
|
|
18
19
|
export { groupId, userId } from "../access-policy/build.js";
|
|
20
|
+
export { agentViewFontFamily, } from "../view/agent-view-layout.js";
|
|
19
21
|
export { roleAutoShare, rolePermissionGroup, rolePermissionLevel, userRef } from "../role/build.js";
|
|
20
22
|
export { serviceAccountRoleRef, serviceAccountStatus } from "../service-account/build.js";
|
|
21
23
|
export { serviceAccountRef } from "../service-account/ref.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** The app entity's graph module + resource-type constant (see src/graph/). */
|
|
2
2
|
import { NO_CATALOG, } from "../../graph/types.js";
|
|
3
3
|
import { appendFieldLocals } from "../field/locals.js";
|
|
4
|
-
import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, LAYOUT_RESOURCE_TYPE, LIST_VIEW_RESOURCE_TYPE } from "../view/types.js";
|
|
4
|
+
import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, CUSTOM_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, LAYOUT_RESOURCE_TYPE, LIST_VIEW_RESOURCE_TYPE } from "../view/types.js";
|
|
5
5
|
import { appFromTf } from "./from-tf.js";
|
|
6
6
|
import { appendAppLocals } from "./locals.js";
|
|
7
7
|
import { appToTf } from "./to-tf.js";
|
|
@@ -20,6 +20,7 @@ function extractAppStreamRoot(stream, ctx) {
|
|
|
20
20
|
const kanbanViewBlocks = viewBlocks.filter((b) => b.type === KANBAN_VIEW_RESOURCE_TYPE);
|
|
21
21
|
const dashboardViewBlocks = viewBlocks.filter((b) => b.type === DASHBOARD_VIEW_RESOURCE_TYPE);
|
|
22
22
|
const agentViewBlocks = viewBlocks.filter((b) => b.type === AGENT_VIEW_RESOURCE_TYPE);
|
|
23
|
+
const customViewBlocks = viewBlocks.filter((b) => b.type === CUSTOM_VIEW_RESOURCE_TYPE);
|
|
23
24
|
const managedViewOrderBlocks = stream.byKind.get("managed-view-order") ?? [];
|
|
24
25
|
const recordCreateFormBlocks = stream.byKind.get("record-create-form") ?? [];
|
|
25
26
|
const dynamicLayoutBlocks = stream.byKind.get("dynamic-layout") ?? [];
|
|
@@ -40,6 +41,7 @@ function extractAppStreamRoot(stream, ctx) {
|
|
|
40
41
|
kanbanViewBlocks,
|
|
41
42
|
dashboardViewBlocks,
|
|
42
43
|
agentViewBlocks,
|
|
44
|
+
customViewBlocks,
|
|
43
45
|
managedViewOrderBlocks,
|
|
44
46
|
recordCreateFormBlocks,
|
|
45
47
|
dynamicLayoutBlocks,
|
|
@@ -58,7 +60,8 @@ export const appModule = {
|
|
|
58
60
|
stream: { role: "streamRoot", exportVerb: "apps" },
|
|
59
61
|
authoring: { unit: "ownFile", bag: "apps" },
|
|
60
62
|
parents: [{ parent: "org", child: "app" }],
|
|
61
|
-
|
|
63
|
+
// The provider keeps only the system fields a workspace sets (all of them after an import).
|
|
64
|
+
resource: { shape: "single", resourceType: APP_RESOURCE_TYPE, adoptable: true, stateScopedMapAttributes: ["system_field_config"] },
|
|
62
65
|
// Foreign/referenced apps: same KindId + bag; data facet emits
|
|
63
66
|
// `data.elementum_app` (ref-only stubs on disk are later).
|
|
64
67
|
data: { participates: true, lookupAttr: "name", referencedByBuild: true, referenceLookups: [{ strategy: "rootNamespace", compatibilityFallback: "name" }] },
|
|
@@ -95,6 +98,19 @@ export const appModule = {
|
|
|
95
98
|
{ attribute: "status_field_name", value: "Status" },
|
|
96
99
|
{ attribute: "title_field_name", value: "Title" },
|
|
97
100
|
],
|
|
101
|
+
keyedLocalAliases: [{
|
|
102
|
+
listAttribute: "stages",
|
|
103
|
+
keyAttribute: "key",
|
|
104
|
+
nameAttribute: "name",
|
|
105
|
+
byNameSuffix: "_stage_options_by_label",
|
|
106
|
+
byKeySuffix: "_stage_ids_by_key",
|
|
107
|
+
}],
|
|
108
|
+
computedMapAttributes: [{
|
|
109
|
+
attribute: "status_option_ids_by_label",
|
|
110
|
+
listAttribute: "status_options",
|
|
111
|
+
keyAttribute: "label",
|
|
112
|
+
valueAttribute: "id",
|
|
113
|
+
}],
|
|
98
114
|
},
|
|
99
115
|
catalog: NO_CATALOG,
|
|
100
116
|
};
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* never silent, never thrown (plan §4.3).
|
|
16
16
|
*/
|
|
17
17
|
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
18
|
-
import { DEPLOY_DEFAULT_STATUS_OPTION_VALUES, SYSTEM_FIELD_HCL_KEY_BY_KEY, SYSTEM_FIELD_KEY_BY_TAG } from "../../core/system-fields.js";
|
|
18
|
+
import { DEPLOY_DEFAULT_STATUS_OPTION_VALUES, SYSTEM_FIELD_HCL_KEY_BY_KEY, SYSTEM_FIELD_KEY_BY_TAG, SYSTEM_FIELD_REQUIRED } from "../../core/system-fields.js";
|
|
19
19
|
import { EntityTfError } from "../../engine/entity.js";
|
|
20
20
|
import { expr, snakeSlug } from "../../engine/tf/index.js";
|
|
21
21
|
import { accessPolicyToTf } from "../access-policy/to-tf.js";
|
|
@@ -23,14 +23,14 @@ import { dashboardsToTf } from "../dashboard/to-tf.js";
|
|
|
23
23
|
import { picklistLabel } from "../field/options.js";
|
|
24
24
|
import { fieldMetadataFromEntries } from "../field/metadata.js";
|
|
25
25
|
import { dynamicLayoutsToTf } from "../dynamic-layout/to-tf.js";
|
|
26
|
-
import { fieldToTf } from "../field/to-tf.js";
|
|
26
|
+
import { authoredFieldKeysFromPayload, claimFieldDisplayName, fieldToTf } from "../field/to-tf.js";
|
|
27
27
|
import { CATEGORY_ORG_BAG } from "../org/category.js";
|
|
28
28
|
import { categoryIdExpr, missingCategoryDiagnostic } from "../org/category-ref.js";
|
|
29
29
|
import { CLOUD_LINK_ORG_BAG } from "../org/cloud-link.js";
|
|
30
30
|
import { recordCreateFormToTf } from "../record-create-form/to-tf.js";
|
|
31
31
|
import { relationshipsToTf } from "../relationship/to-tf.js";
|
|
32
32
|
import { rolesToTf } from "../role/to-tf.js";
|
|
33
|
-
import {
|
|
33
|
+
import { appServiceAccountBlocks } from "../service-account/to-tf.js";
|
|
34
34
|
import { relationshipTargetsFromBag, widgetsToTf } from "../widget/to-tf.js";
|
|
35
35
|
import { viewToTf } from "../view/to-tf.js";
|
|
36
36
|
import { APP_RESOURCE_TYPE } from "./module.js";
|
|
@@ -114,6 +114,7 @@ export function appToTf(entity, ctx) {
|
|
|
114
114
|
// --- Field pass: fold system-tagged fields, emit one resource per custom field.
|
|
115
115
|
const blocks = [];
|
|
116
116
|
const fieldAddresses = new Map();
|
|
117
|
+
const fieldOwnership = authoredFieldKeysFromPayload(payload);
|
|
117
118
|
const fieldMetadata = fieldMetadataFromEntries(payload.fields);
|
|
118
119
|
const fieldNames = new Map();
|
|
119
120
|
let statusOptions;
|
|
@@ -121,6 +122,7 @@ export function appToTf(entity, ctx) {
|
|
|
121
122
|
const systemFieldConfig = {};
|
|
122
123
|
const stageTfLabels = new Set();
|
|
123
124
|
const objectId = expr.resourceAttr(APP_RESOURCE_TYPE, ctx.appTfLabel, ["id"]);
|
|
125
|
+
const fieldDisplayNames = new Map();
|
|
124
126
|
for (const fieldEntry of payload.fields ?? []) {
|
|
125
127
|
const typeKey = Object.keys(fieldEntry)[0];
|
|
126
128
|
if (typeKey === undefined)
|
|
@@ -144,11 +146,15 @@ export function appToTf(entity, ctx) {
|
|
|
144
146
|
// falls back to DEPLOY_DEFAULT "Title" (tofu Invalid index).
|
|
145
147
|
if (name !== "")
|
|
146
148
|
fieldNames.set(systemKey, name);
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
// Only a system field with authored validation flags is managed; one
|
|
150
|
+
// that is just named or given options leaves its flags to the platform.
|
|
151
|
+
if (inner.required !== undefined || inner.requiredOnClose !== undefined || inner.showOnCreate !== undefined) {
|
|
152
|
+
systemFieldConfig[SYSTEM_FIELD_HCL_KEY_BY_KEY[systemKey]] = {
|
|
153
|
+
required: inner.required ?? SYSTEM_FIELD_REQUIRED[systemKey],
|
|
154
|
+
required_on_close: inner.requiredOnClose ?? false,
|
|
155
|
+
show_on_create: inner.showOnCreate ?? false,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
152
158
|
}
|
|
153
159
|
switch (systemTag) {
|
|
154
160
|
case "TITLE":
|
|
@@ -209,9 +215,11 @@ export function appToTf(entity, ctx) {
|
|
|
209
215
|
diagnostics: ctx.diagnostics,
|
|
210
216
|
orgRefs: ctx.orgRefs,
|
|
211
217
|
workspaceAspects: ctx.workspaceAspects,
|
|
218
|
+
fieldOwnership,
|
|
212
219
|
});
|
|
213
220
|
if (field === undefined)
|
|
214
221
|
continue;
|
|
222
|
+
claimFieldDisplayName(fieldDisplayNames, field);
|
|
215
223
|
blocks.push(field.block);
|
|
216
224
|
fieldAddresses.set(field.bagKey, field.address);
|
|
217
225
|
}
|
|
@@ -268,10 +276,11 @@ export function appToTf(entity, ctx) {
|
|
|
268
276
|
stageTfLabels,
|
|
269
277
|
dashboardKeys: new Set(Object.keys(payload.dashboards ?? {})),
|
|
270
278
|
orgRefs: ctx.orgRefs,
|
|
279
|
+
workspaceAspects: ctx.workspaceAspects,
|
|
271
280
|
diagnostics: ctx.diagnostics,
|
|
272
281
|
fieldAddresses,
|
|
273
282
|
widgetKeys: new Set(Object.keys(payload.widgets ?? {})),
|
|
274
|
-
});
|
|
283
|
+
}, payload.customViews);
|
|
275
284
|
blocks.push(...viewBlocks);
|
|
276
285
|
const recordCreateForm = recordCreateFormToTf(payload.recordCreateForm, {
|
|
277
286
|
ownerRefName: ctx.appRefName,
|
|
@@ -291,6 +300,7 @@ export function appToTf(entity, ctx) {
|
|
|
291
300
|
orgRefs: ctx.orgRefs,
|
|
292
301
|
workspaceAspects: ctx.workspaceAspects,
|
|
293
302
|
fieldAddresses,
|
|
303
|
+
widgetKeys: new Set(Object.keys(payload.widgets ?? {})),
|
|
294
304
|
}));
|
|
295
305
|
blocks.push(...relationshipsToTf(payload.relationships, {
|
|
296
306
|
ownerRefName: ctx.appRefName,
|
|
@@ -301,6 +311,7 @@ export function appToTf(entity, ctx) {
|
|
|
301
311
|
orgRefs: ctx.orgRefs,
|
|
302
312
|
workspaceAspects: ctx.workspaceAspects,
|
|
303
313
|
diagnostics: ctx.diagnostics,
|
|
314
|
+
fieldOwnership: fieldAddresses,
|
|
304
315
|
}));
|
|
305
316
|
// --- Access policy pass (entities/access-policy), owner passed in.
|
|
306
317
|
// Authored entries only. Creating an app also has the platform mint a
|
|
@@ -329,10 +340,9 @@ export function appToTf(entity, ctx) {
|
|
|
329
340
|
orgRefs: ctx.orgRefs,
|
|
330
341
|
diagnostics: ctx.diagnostics,
|
|
331
342
|
}));
|
|
332
|
-
blocks.push(...
|
|
343
|
+
blocks.push(...appServiceAccountBlocks(payload, {
|
|
333
344
|
ownerTfLabel: ctx.appTfLabel,
|
|
334
345
|
appId: objectId,
|
|
335
|
-
roles: payload.roles,
|
|
336
346
|
orgRefs: ctx.orgRefs,
|
|
337
347
|
diagnostics: ctx.diagnostics,
|
|
338
348
|
}));
|
|
@@ -86,6 +86,18 @@ export interface ActionDef<TOutput> {
|
|
|
86
86
|
}
|
|
87
87
|
/** Placeholder `forEachTaskRefKey` the forEach item proxy emits; replaced with the real refKey. */
|
|
88
88
|
export declare const FOR_EACH_PLACEHOLDER = "__forEach__";
|
|
89
|
+
/**
|
|
90
|
+
* CANONICAL reference-name rewrite — used ONLY for workflow-publish OUTPUTS
|
|
91
|
+
* (see DESIGN-canonical-reference-model.md). A workflow output's
|
|
92
|
+
* `taskReference.name` must be the platform's CANONICAL output name
|
|
93
|
+
* (`service_tasks`), NOT the refs-map display label — the platform validates
|
|
94
|
+
* the published output against the canonical name (edk#835). Task INPUTS,
|
|
95
|
+
* FILTERS and CALC mustaches are UNCHANGED (they keep `rewriteForwardTaskRefName`
|
|
96
|
+
* / the display refs-map path — #1271 owns those positions). Maps EDK's friendly
|
|
97
|
+
* accessor → canonical; identity for most kinds. Validated against
|
|
98
|
+
* TASK_OUTPUT_CONTRACTS by canonical-reference-model.test.ts.
|
|
99
|
+
*/
|
|
100
|
+
export declare function rewriteCanonicalOutputRefName(taskKey: string | undefined, name: string, taskRefKey?: string): string;
|
|
89
101
|
/** One finalized automation-level output property (already serialized to wire). */
|
|
90
102
|
export interface OutputEntry {
|
|
91
103
|
readonly name: string;
|
|
@@ -143,9 +155,38 @@ type ResolvedRefs<I> = {
|
|
|
143
155
|
};
|
|
144
156
|
/** Static options or options computed from the typed outputs available so far. */
|
|
145
157
|
export type ActionOptions<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown>, TOptions> = TOptions | ((ctx: Context<TTrigger, TActions, TVars>) => TOptions);
|
|
146
|
-
/** One
|
|
147
|
-
export
|
|
158
|
+
/** One enclosing forEach, as `ctx.loops.<name>` sees it from inside its body. */
|
|
159
|
+
export interface ForEachScope<TItem> {
|
|
160
|
+
/** That loop's current item: what `ctx.item` is inside its own body. */
|
|
148
161
|
readonly item: ForEachItem<TItem>;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Inside a loop body, the builders' item type parameter carries the whole
|
|
165
|
+
* loop scope: the nearest loop's item plus every enclosing loop by name. One
|
|
166
|
+
* parameter instead of two keeps the ~40-method builder interface cheap to
|
|
167
|
+
* type-check (a separate loops parameter pushed CI's tsc past its heap).
|
|
168
|
+
*/
|
|
169
|
+
export interface LoopScope<TItem, TLoops> {
|
|
170
|
+
readonly __item: TItem;
|
|
171
|
+
readonly __loops: TLoops;
|
|
172
|
+
}
|
|
173
|
+
/** The nearest loop's item type in a builder's item parameter. */
|
|
174
|
+
type ScopeItem<T> = T extends LoopScope<infer TItem, unknown> ? TItem : T;
|
|
175
|
+
/**
|
|
176
|
+
* The enclosing loops in a builder's item parameter (none outside a body).
|
|
177
|
+
* `never` (the root builder) is checked first: a bare distributive
|
|
178
|
+
* conditional over `never` is `never`, which would erase every loop scope.
|
|
179
|
+
*/
|
|
180
|
+
type ScopeLoops<T> = [T] extends [never] ? EmptyObject : T extends LoopScope<unknown, infer TLoops> ? TLoops : EmptyObject;
|
|
181
|
+
/**
|
|
182
|
+
* One context object for nested actions. forEach bodies add the current item
|
|
183
|
+
* (`ctx.item`, the nearest loop) and every enclosing loop by name
|
|
184
|
+
* (`ctx.loops.<name>.item`), so a task in an inner loop can still read an
|
|
185
|
+
* outer loop's current item.
|
|
186
|
+
*/
|
|
187
|
+
export type NestedActionContext<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown>, TItem = never> = Context<TTrigger, TActions, TVars> & ([TItem] extends [never] ? Record<never, never> : {
|
|
188
|
+
readonly item: ForEachItem<ScopeItem<TItem>>;
|
|
189
|
+
readonly loops: ScopeLoops<TItem>;
|
|
149
190
|
});
|
|
150
191
|
type BuilderActionOptions<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown>, TItem, TOptions> = TOptions | ((ctx: NestedActionContext<TTrigger, TActions, TVars, TItem>) => TOptions);
|
|
151
192
|
type BuilderMode = "root" | "nested";
|
|
@@ -250,11 +291,12 @@ interface ActionMethods<TTrigger, TActions extends Record<string, unknown>, TVar
|
|
|
250
291
|
approvalStatusUpdate<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").ApprovalStatusUpdateOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
251
292
|
addWatcher<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").AddWatcherOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
252
293
|
saveAttachment<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").SaveAttachmentOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
253
|
-
userSearch<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").UserSearchOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").
|
|
294
|
+
userSearch<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").UserSearchOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").UserSearchOutput>;
|
|
295
|
+
userGroupSearch<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").UserGroupSearchOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").UserGroupSearchOutput>;
|
|
254
296
|
initiateCall<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").InitiateCallOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
255
297
|
recordFieldLocking<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").RecordFieldLockingOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
256
298
|
unimplementedTask<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").UnimplementedTaskOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
257
|
-
forEach<TName extends string, TForEachItem>(name: TName, opts: ForEachConfig<TTrigger, TActions, TVars, TItem, TForEachItem>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
299
|
+
forEach<TName extends string, TForEachItem>(name: TName, opts: ForEachConfig<TTrigger, TActions, TVars, TItem, TForEachItem, TName>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
258
300
|
switch<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, SwitchConfig<TTrigger, TActions, TVars, TItem>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
259
301
|
forkJoin<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, ForkJoinConfig<TTrigger, TActions, TVars, TItem>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
260
302
|
}
|
|
@@ -276,9 +318,10 @@ export type ForEachBuilder<TTrigger, TActions extends Record<string, unknown>, T
|
|
|
276
318
|
export type SwitchCaseBuilder<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown>, TItem = never> = NestedActionBuilder<TTrigger, TActions, TVars, TItem>;
|
|
277
319
|
/** A forkJoin branch body builder. */
|
|
278
320
|
export type ForkJoinBranchBuilder<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown>, TItem = never> = NestedActionBuilder<TTrigger, TActions, TVars, TItem>;
|
|
279
|
-
export interface ForEachConfig<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown>, TEnclosingItem, TItem> {
|
|
321
|
+
export interface ForEachConfig<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown>, TEnclosingItem, TItem, TName extends string = string> {
|
|
280
322
|
readonly collection: Ref<readonly TItem[]> | ((ctx: NestedActionContext<TTrigger, TActions, TVars, TEnclosingItem>) => Ref<readonly TItem[]>);
|
|
281
|
-
|
|
323
|
+
/** The loop body. Its context adds `ctx.item` and this loop as `ctx.loops.<name>`. */
|
|
324
|
+
readonly actions: (actions: ForEachBuilder<TTrigger, TActions, TVars, LoopScope<NoInfer<TItem>, ScopeLoops<TEnclosingItem> & Record<TName, ForEachScope<NoInfer<TItem>>>>>) => NestedActionChain;
|
|
282
325
|
}
|
|
283
326
|
export interface SwitchCase<TTrigger, TActions extends Record<string, unknown>, TVars extends Record<string, unknown>, TItem = never> {
|
|
284
327
|
readonly label?: string;
|