@elementumai/edk 0.9.10 → 0.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-sdk/src/catalog/factories.d.ts +8 -1
- package/dist-sdk/src/catalog/factories.js +13 -1
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +1 -1
- package/dist-sdk/src/catalog/types.d.ts +19 -2
- package/dist-sdk/src/catalog/types.js +1 -0
- package/dist-sdk/src/engine/build/context.d.ts +3 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +3 -3
- package/dist-sdk/src/entities/access-policy/from-tf.js +27 -8
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +13 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +34 -3
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +13 -7
- package/dist-sdk/src/entities/agent-tool/to-tf.js +13 -0
- package/dist-sdk/src/entities/app/build.d.ts +15 -2
- package/dist-sdk/src/entities/app/build.js +6 -0
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +13 -3
- package/dist-sdk/src/entities/app/from-tf.js +6 -3
- package/dist-sdk/src/entities/app/to-tf.js +5 -1
- package/dist-sdk/src/entities/automation/from-tf.js +113 -1
- package/dist-sdk/src/entities/automation/module.js +1 -0
- package/dist-sdk/src/entities/automation/tasks.js +17 -0
- package/dist-sdk/src/entities/automation/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/automation/to-tf.js +153 -46
- package/dist-sdk/src/entities/automation/types.js +1 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +11 -2
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +2 -1
- package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +8 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.js +12 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +7 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +64 -10
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +54 -6
- package/dist-sdk/src/entities/element/build.d.ts +7 -0
- package/dist-sdk/src/entities/element/from-tf.js +1 -1
- package/dist-sdk/src/entities/element/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/to-tf.js +19 -1
- package/dist-sdk/src/entities/field/build.d.ts +10 -1
- package/dist-sdk/src/entities/field/build.js +2 -1
- package/dist-sdk/src/entities/field/calc/index.js +7 -7
- package/dist-sdk/src/entities/field/calc/runtime.d.ts +19 -0
- package/dist-sdk/src/entities/field/calc/runtime.js +32 -0
- package/dist-sdk/src/entities/field/calc/types.d.ts +6 -0
- package/dist-sdk/src/entities/file-reader/to-tf.js +10 -2
- package/dist-sdk/src/entities/relationship/build.d.ts +14 -7
- package/dist-sdk/src/entities/relationship/from-tf.js +14 -14
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +18 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +15 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +21 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +16 -4
- package/dist-sdk/src/entities/skill/tools.d.ts +10 -0
- package/dist-sdk/src/entities/skill/tools.js +10 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +7 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +22 -2
- package/dist-sdk/src/entities/skill-tool/to-tf.js +21 -0
- package/dist-sdk/src/entities/table/catalog-render.js +2 -1
- package/dist-sdk/src/entities/view/from-tf.js +9 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +7 -0
- package/dist-sdk/src/entities/view/to-tf.js +34 -5
- package/dist-sdk/src/entities/widget/build.d.ts +17 -7
- package/dist-sdk/src/entities/widget/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/widget/from-tf.js +132 -18
- package/dist-sdk/src/entities/widget/to-tf.d.ts +17 -0
- package/dist-sdk/src/entities/widget/to-tf.js +40 -0
- package/dist-sdk/src/graph/types.d.ts +8 -0
- package/package.json +1 -1
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
* nothing reads those interim values.
|
|
20
20
|
*/
|
|
21
21
|
import type { AiProviderLlmModel, AiProviderType } from "./ai-provider-models.js";
|
|
22
|
-
import type { AgentEvaluationRef, AgentRef, AppCatalogRef, AiProviderRef, ApprovalChainRef, AutomationCatalogRef, CatalogRef, CategoryRef, ChartRef, DashboardRef, CloudLinkRef, ConnectorRef, DatamineRef, GroupRef, PhoneProviderRef, PhoneServiceRef, ProcedureParameterType, ProcedureRef, FileReaderCatalogRef, DocumentModelFieldRef, ElementCatalogRef, FieldRef, OutputPropertyRef, SearchTableRef, StoredFunctionRef, StoredFunctionScalarType, SkillRef, TableColumnRef, TableRef, TriggerParameterRef } from "./types.js";
|
|
22
|
+
import type { AgentEvaluationRef, AgentRef, AppCatalogRef, AppOrElementRef, AiProviderRef, ApprovalChainRef, AutomationCatalogRef, CatalogRef, CategoryRef, ChartRef, DashboardRef, WidgetRef, CloudLinkRef, ConnectorRef, DatamineRef, GroupRef, PhoneProviderRef, PhoneServiceRef, ProcedureParameterType, ProcedureRef, FileReaderCatalogRef, DocumentModelFieldRef, ElementCatalogRef, FieldRef, OutputPropertyRef, RecordIdentityRef, SearchTableRef, StoredFunctionRef, StoredFunctionScalarType, SkillRef, TableColumnRef, TableRef, TriggerParameterRef } from "./types.js";
|
|
23
|
+
export declare function recordIdentity<const Target extends AppOrElementRef | TableRef>(target: Target): RecordIdentityRef<Target>;
|
|
23
24
|
/** Fixed platform user-directory schema used by userSearch filters. */
|
|
24
25
|
export declare const usersCatalog: {
|
|
25
26
|
readonly fields: {
|
|
@@ -173,6 +174,11 @@ export declare function dashboardRef<const Parent extends string = string, const
|
|
|
173
174
|
readonly name?: string;
|
|
174
175
|
readonly parent?: Parent;
|
|
175
176
|
}): DashboardRef<Parent, RefName>;
|
|
177
|
+
export declare function widgetRef<const Parent extends string = string, const RefName extends string = string>(opts?: {
|
|
178
|
+
readonly refName?: RefName;
|
|
179
|
+
readonly name?: string;
|
|
180
|
+
readonly parent?: Parent;
|
|
181
|
+
}): WidgetRef<Parent, RefName>;
|
|
176
182
|
/**
|
|
177
183
|
* Skill ref — no required arguments, same shape as {@link agentRef}. `handle` and `parent`
|
|
178
184
|
* are injected by the enclosing `appCatalog`/`elementCatalog`; `name` defaults to `""`.
|
|
@@ -189,6 +195,7 @@ export declare function phoneServiceRef(opts?: {
|
|
|
189
195
|
export declare function datamineRef(opts?: {
|
|
190
196
|
readonly name?: string;
|
|
191
197
|
readonly parent?: string;
|
|
198
|
+
readonly parentName?: string;
|
|
192
199
|
}): DatamineRef;
|
|
193
200
|
export declare const approvalChainRef: (opts: Omit<ApprovalChainRef<string, string>, "parent" | "refName" | "__kind">) => Omit<ApprovalChainRef<string, string>, "parent" | "refName" | "__kind"> & {
|
|
194
201
|
readonly __kind: "approvalChain";
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export function recordIdentity(target) {
|
|
2
|
+
return { __kind: "recordIdentity", refName: "id", name: "Record ID", target };
|
|
3
|
+
}
|
|
1
4
|
/** Fixed platform user-directory schema used by userSearch filters. */
|
|
2
5
|
export const usersCatalog = {
|
|
3
6
|
fields: {
|
|
@@ -87,6 +90,9 @@ export function chartRef(opts) {
|
|
|
87
90
|
export function dashboardRef(opts) {
|
|
88
91
|
return { __kind: "dashboard", refName: opts?.refName ?? "", name: opts?.name ?? "", ...(opts?.parent !== undefined ? { parent: opts.parent } : {}) };
|
|
89
92
|
}
|
|
93
|
+
export function widgetRef(opts) {
|
|
94
|
+
return { __kind: "widget", refName: opts?.refName ?? "", name: opts?.name ?? "", ...(opts?.parent !== undefined ? { parent: opts.parent } : {}) };
|
|
95
|
+
}
|
|
90
96
|
/**
|
|
91
97
|
* Skill ref — no required arguments, same shape as {@link agentRef}. `handle` and `parent`
|
|
92
98
|
* are injected by the enclosing `appCatalog`/`elementCatalog`; `name` defaults to `""`.
|
|
@@ -104,7 +110,13 @@ export function phoneServiceRef(opts) {
|
|
|
104
110
|
return { __kind: "phone-service", refName: "", name: opts?.name ?? "", ...(opts?.parent !== undefined ? { parent: opts.parent } : {}) };
|
|
105
111
|
}
|
|
106
112
|
export function datamineRef(opts) {
|
|
107
|
-
return {
|
|
113
|
+
return {
|
|
114
|
+
__kind: "datamine",
|
|
115
|
+
refName: "",
|
|
116
|
+
name: opts?.name ?? "",
|
|
117
|
+
...(opts?.parent !== undefined ? { parent: opts.parent } : {}),
|
|
118
|
+
...(opts?.parentName !== undefined ? { parentName: opts.parentName } : {}),
|
|
119
|
+
};
|
|
108
120
|
}
|
|
109
121
|
export const approvalChainRef = refFactory("approvalChain");
|
|
110
122
|
function searchTableRefFor(opts, variant) {
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* ids appear here (identity lives in `src/deploy/state`).
|
|
5
5
|
*/
|
|
6
6
|
export { AI_PROVIDER_LLM_MODELS, type AiProviderLlmModel, type AiProviderType } from "./ai-provider-models.js";
|
|
7
|
-
export { REF_SCOPE, REF_UPDATABLE, type AgentRef, type AgentEvaluationRef, type AiProviderRef, type ApprovalChainRef, type ApprovalProcessRef, type AppCatalogRef, type AppOrElementRef, type AutomationCatalogRef, type AutomationRef, type CatalogRef, type CatalogRefKind, type CategoryRef, type ChartRef, type DashboardRef, type CloudLinkRef, type AiServiceRef, type ConnectorRef, type GroupRef, type PhoneProviderRef, type PhoneServiceRef, PROCEDURE_PARAMETER_TYPES, type ProcedureParameterType, type ProcedureRef, type FileReaderCatalogRef, type DocumentModelFieldRef, type ElementCatalogRef, type FieldRef, type OutputPropertyRef, type SearchTableRef, type StoredFunctionRef, type StoredFunctionScalarType, type DatamineRef, type SkillRef, type TableColumnRef, type TableRef, type TriggerParameterRef, USER_FIELD_KEYS, type UserFieldKey, type UserFieldRef, } from "./types.js";
|
|
7
|
+
export { REF_SCOPE, REF_UPDATABLE, type AgentRef, type AgentEvaluationRef, type AiProviderRef, type ApprovalChainRef, type ApprovalProcessRef, type AppCatalogRef, type AppOrElementRef, type AutomationCatalogRef, type AutomationRef, type CatalogRef, type CatalogRefKind, type CategoryRef, type ChartRef, type DashboardRef, type WidgetRef, type CloudLinkRef, type AiServiceRef, type ConnectorRef, type GroupRef, type PhoneProviderRef, type PhoneServiceRef, PROCEDURE_PARAMETER_TYPES, type ProcedureParameterType, type ProcedureRef, type FileReaderCatalogRef, type DocumentModelFieldRef, type ElementCatalogRef, type FieldRef, type OutputPropertyRef, type RecordIdentityRef, type SearchTableRef, type StoredFunctionRef, type StoredFunctionScalarType, type DatamineRef, type SkillRef, type TableColumnRef, type TableRef, type TriggerParameterRef, USER_FIELD_KEYS, type UserFieldKey, type UserFieldRef, } from "./types.js";
|
|
8
8
|
export { renderBarrel, renderCatalog, renderFragment, type BarrelEntry, type BarrelRoot, } from "./render.js";
|
|
9
9
|
export { appCatalogTarget, barrelPathFor, orgCatalogTarget, regenerateBarrel, writeCatalog, writeFlatCatalog, writeFragment, type CatalogTarget, } from "./write.js";
|
|
10
10
|
export { isCatalogToken, slimToken, slimTokens } from "./token.js";
|
|
11
11
|
export { buildAppCatalogFromAuthoring, listEntityFilesFromPaths, refNameOf, regenerateAppCatalogsUnder, writeAppCatalog, writeAppCatalogFromAuthoring, type AppAuthoringCatalog, type AppCatalogRegenResult, type ConfiguredEntity, } from "./from-authoring.js";
|
|
12
|
-
export { agentRef, agentEvaluationRef, appRef, appCatalog, approvalChainRef, automationRef, categoryRef, chartRef, dashboardRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, searchTableRef, datamineRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, triggerParameterRef, usersCatalog, } from "./factories.js";
|
|
12
|
+
export { agentRef, agentEvaluationRef, appRef, appCatalog, approvalChainRef, automationRef, categoryRef, chartRef, dashboardRef, widgetRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, recordIdentity, searchTableRef, datamineRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, triggerParameterRef, usersCatalog, } from "./factories.js";
|
|
@@ -9,4 +9,4 @@ export { renderBarrel, renderCatalog, renderFragment, } from "./render.js";
|
|
|
9
9
|
export { appCatalogTarget, barrelPathFor, orgCatalogTarget, regenerateBarrel, writeCatalog, writeFlatCatalog, writeFragment, } from "./write.js";
|
|
10
10
|
export { isCatalogToken, slimToken, slimTokens } from "./token.js";
|
|
11
11
|
export { buildAppCatalogFromAuthoring, listEntityFilesFromPaths, refNameOf, regenerateAppCatalogsUnder, writeAppCatalog, writeAppCatalogFromAuthoring, } from "./from-authoring.js";
|
|
12
|
-
export { agentRef, agentEvaluationRef, appRef, appCatalog, approvalChainRef, automationRef, categoryRef, chartRef, dashboardRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, searchTableRef, datamineRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, triggerParameterRef, usersCatalog, } from "./factories.js";
|
|
12
|
+
export { agentRef, agentEvaluationRef, appRef, appCatalog, approvalChainRef, automationRef, categoryRef, chartRef, dashboardRef, widgetRef, cloudLinkRef, connectorRef, aiProvider, groupRef, linkedSearchTableRef, phoneProviderRef, phoneServiceRef, procedureRef, documentModelFieldRef, documentModelRef, elementCatalog, elementRef, fieldRef, orgCatalog, outputPropertyRef, recordIdentity, searchTableRef, datamineRef, skillRef, storedFunctionRef, tableColumnRef, tableRef, tableSearchTableRef, triggerParameterRef, usersCatalog, } from "./factories.js";
|
|
@@ -36,7 +36,7 @@ import type { AiProviderLlmModel, AiProviderType } from "./ai-provider-models.js
|
|
|
36
36
|
* resolved to the current-version param/output id via the parent
|
|
37
37
|
* automation's state binding.
|
|
38
38
|
*/
|
|
39
|
-
export type CatalogRefKind = "automation" | "agent" | "agent-evaluation" | "chart" | "dashboard" | "skill" | "visual-flow" | "approvalChain" | "table" | "tableColumn" | "cloudLink" | "storedFunction" | "procedure" | "field" | "searchTable" | "documentModel" | "documentModelField" | "connector" | "aiProvider" | "category" | "group" | "phoneProvider" | "phone-service" | "datamine" | "app" | "element" | "task" | "triggerParameter" | "outputProperty";
|
|
39
|
+
export type CatalogRefKind = "automation" | "agent" | "agent-evaluation" | "chart" | "dashboard" | "widget" | "skill" | "visual-flow" | "approvalChain" | "table" | "tableColumn" | "cloudLink" | "storedFunction" | "procedure" | "field" | "searchTable" | "documentModel" | "documentModelField" | "connector" | "aiProvider" | "category" | "group" | "phoneProvider" | "phone-service" | "datamine" | "app" | "element" | "task" | "triggerParameter" | "outputProperty";
|
|
40
40
|
/**
|
|
41
41
|
* The reference surface for a catalog entity. `handle` is the stable join key
|
|
42
42
|
* (no id); `name` is for readability/diagnostics, never a match key.
|
|
@@ -70,6 +70,7 @@ export type AgentRef<Parent extends string = string, RefName extends string = st
|
|
|
70
70
|
export type AgentEvaluationRef<Parent extends string = string, RefName extends string = string> = CatalogRef<"agent-evaluation", RefName, Parent>;
|
|
71
71
|
export type ChartRef<Parent extends string = string, RefName extends string = string> = CatalogRef<"chart", RefName, Parent>;
|
|
72
72
|
export type DashboardRef<Parent extends string = string, RefName extends string = string> = CatalogRef<"dashboard", RefName, Parent>;
|
|
73
|
+
export type WidgetRef<Parent extends string = string, RefName extends string = string> = CatalogRef<"widget", RefName, Parent>;
|
|
73
74
|
export interface SkillRef extends CatalogRef<"skill"> {
|
|
74
75
|
/**
|
|
75
76
|
* Display name of the app that owns this skill. Generated app catalogs
|
|
@@ -113,7 +114,16 @@ export interface TableRef<RefName extends string = string, Columns extends Reado
|
|
|
113
114
|
readonly categoryId?: string;
|
|
114
115
|
}
|
|
115
116
|
export type SearchTableRef<Parent extends string = string, RefName extends string = string> = CatalogRef<"searchTable", RefName, Parent>;
|
|
116
|
-
export
|
|
117
|
+
export interface DatamineRef<Parent extends string = string, RefName extends string = string> extends CatalogRef<"datamine", RefName, Parent> {
|
|
118
|
+
/**
|
|
119
|
+
* The owning table's display NAME, stamped alongside `parent` for the same
|
|
120
|
+
* reason `FieldRef.parentName`/`TableColumnRef.parentName` are — a
|
|
121
|
+
* datamine trigger referencing a table outside this workspace builds to
|
|
122
|
+
* `data.elementum_table.<t>`, and that lookup keys by the table's display
|
|
123
|
+
* name, which `parent` (a refName) doesn't carry.
|
|
124
|
+
*/
|
|
125
|
+
readonly parentName?: string;
|
|
126
|
+
}
|
|
117
127
|
/** Public reference to an AI service/model selected for runtime use. */
|
|
118
128
|
export type AiServiceRef = CatalogRef<"connector">;
|
|
119
129
|
/** @internal Backend compatibility name. Prefer {@link AiServiceRef} on authoring surfaces. */
|
|
@@ -182,6 +192,13 @@ export type ElementCatalogRef<RefName extends string = string> = CatalogRef<"ele
|
|
|
182
192
|
readonly namespace?: string;
|
|
183
193
|
};
|
|
184
194
|
export type AppOrElementRef<RefName extends string = string> = AppCatalogRef<RefName> | ElementCatalogRef<RefName>;
|
|
195
|
+
/** A record's own identity, referenceable without exposing its platform id. */
|
|
196
|
+
export interface RecordIdentityRef<Target extends AppOrElementRef | TableRef = AppOrElementRef | TableRef> {
|
|
197
|
+
readonly __kind: "recordIdentity";
|
|
198
|
+
readonly refName: "id";
|
|
199
|
+
readonly name: "Record ID";
|
|
200
|
+
readonly target: Target;
|
|
201
|
+
}
|
|
185
202
|
/**
|
|
186
203
|
* A field reference. Beyond the shared surface it carries `fieldType` (the
|
|
187
204
|
* platform field type — `"TEXT"`, `"PICKLIST"`, …) so builders can constrain
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { ChildResourceScope, TfValue } from "../tf/index.js";
|
|
7
7
|
import type { KindId } from "../../graph/types.js";
|
|
8
|
+
import type { DeployableEntity } from "../entity.js";
|
|
8
9
|
export interface ForeignRootIdentity {
|
|
9
10
|
readonly name: string;
|
|
10
11
|
readonly namespace?: string;
|
|
@@ -86,6 +87,8 @@ export interface OrgRefLookup {
|
|
|
86
87
|
export interface WorkspaceAspect {
|
|
87
88
|
readonly kind: ChildResourceScope | "table";
|
|
88
89
|
readonly tfLabel: string;
|
|
90
|
+
/** Loaded stream root, available to entity-owned cross-stream resolvers. */
|
|
91
|
+
readonly streamRootEntity?: DeployableEntity;
|
|
89
92
|
/** ACTIVE authored automations owned by this root, keyed by source refName with their display name. */
|
|
90
93
|
readonly activeAutomationNamesByRefName?: ReadonlyMap<string, string>;
|
|
91
94
|
/** Sole on-demand record parameter targeting this same owner, keyed by automation refName, for CURRENT_RECORD widget binding. */
|
|
@@ -37,8 +37,8 @@ export interface NormalizedAccessPolicy {
|
|
|
37
37
|
}
|
|
38
38
|
/** Decode one `filter` attribute through the shared exhaustive codec. */
|
|
39
39
|
export declare function filterFromTf(value: TfValue, owner: AccessPolicyOwner, where: string): Filter<RefExpr, RefExpr>;
|
|
40
|
-
export declare function principalList(value: TfValue | undefined, dataType: "elementum_user", where: string, ctx: FromTfContext): AccessPolicyUserRef[] | undefined;
|
|
41
|
-
export declare function principalList(value: TfValue | undefined, dataType: "elementum_group", where: string, ctx: FromTfContext): AccessPolicyGroupRef[] | undefined;
|
|
42
|
-
export declare function principalList(value: TfValue | undefined, dataType: "elementum_service_account", where: string, ctx: FromTfContext): AccessPolicyServiceAccountRef[] | undefined;
|
|
40
|
+
export declare function principalList(value: TfValue | undefined, dataType: "elementum_user", where: string, ctx: FromTfContext, owner?: AccessPolicyOwner): AccessPolicyUserRef[] | undefined;
|
|
41
|
+
export declare function principalList(value: TfValue | undefined, dataType: "elementum_group", where: string, ctx: FromTfContext, owner?: AccessPolicyOwner): AccessPolicyGroupRef[] | undefined;
|
|
42
|
+
export declare function principalList(value: TfValue | undefined, dataType: "elementum_service_account", where: string, ctx: FromTfContext, owner?: AccessPolicyOwner): AccessPolicyServiceAccountRef[] | undefined;
|
|
43
43
|
/** One `elementum_access_policy` block → its normalized shape, or undefined when it belongs to a different owner. */
|
|
44
44
|
export declare function accessPolicyFromTf(block: TfBlock, owner: AccessPolicyOwner, ctx: FromTfContext): NormalizedAccessPolicy | undefined;
|
|
@@ -77,14 +77,33 @@ export function filterFromTf(value, owner, where) {
|
|
|
77
77
|
});
|
|
78
78
|
return decoded;
|
|
79
79
|
}
|
|
80
|
-
function principalListItem(item, dataType, where, ctx) {
|
|
80
|
+
function principalListItem(item, dataType, where, ctx, owner) {
|
|
81
81
|
const label = dataRefLabel(item, dataType);
|
|
82
82
|
if (label !== undefined) {
|
|
83
83
|
const value = ctx.dataName(dataType, label);
|
|
84
|
-
if (value
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
84
|
+
if (value === undefined) {
|
|
85
|
+
ctx.diagnostics.push(`${where}: references data.${dataType}.${label}, but the stream has no matching data block; dropped`);
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
if (dataType === "elementum_service_account") {
|
|
89
|
+
const appId = ctx.dataAttrs?.(dataType, label)?.["app_id"];
|
|
90
|
+
const appDataLabel = dataRefLabel(appId, "elementum_app");
|
|
91
|
+
const appResourceLabel = resourceRefLabel(appId, "elementum_app");
|
|
92
|
+
const appName = appDataLabel === undefined ? undefined : ctx.dataName("elementum_app", appDataLabel);
|
|
93
|
+
const appRefName = appName !== undefined
|
|
94
|
+
? ctx.foreignAppRefNames?.get(appName)
|
|
95
|
+
: appResourceLabel !== undefined && owner?.scope === "app" && owner.label === appResourceLabel
|
|
96
|
+
? owner.ownerRefName
|
|
97
|
+
: appResourceLabel === undefined
|
|
98
|
+
? undefined
|
|
99
|
+
: ctx.foreignAppRefNamespaces?.get(appResourceLabel);
|
|
100
|
+
if (appRefName === undefined) {
|
|
101
|
+
ctx.diagnostics.push(`${where}: data.${dataType}.${label} has no resolvable app_id owner; dropped`);
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
return { __kind: "serviceAccount", appRefName, name: value };
|
|
105
|
+
}
|
|
106
|
+
return { __kind: "orgPrincipalRef", dataType, label, value };
|
|
88
107
|
}
|
|
89
108
|
if (typeof item === "string") {
|
|
90
109
|
if (dataType === "elementum_user")
|
|
@@ -97,7 +116,7 @@ function principalListItem(item, dataType, where, ctx) {
|
|
|
97
116
|
ctx.diagnostics.push(`${where}: list item has an unrecognized shape; dropped`);
|
|
98
117
|
return undefined;
|
|
99
118
|
}
|
|
100
|
-
export function principalList(value, dataType, where, ctx) {
|
|
119
|
+
export function principalList(value, dataType, where, ctx, owner) {
|
|
101
120
|
if (value === undefined)
|
|
102
121
|
return undefined;
|
|
103
122
|
if (!Array.isArray(value)) {
|
|
@@ -110,7 +129,7 @@ export function principalList(value, dataType, where, ctx) {
|
|
|
110
129
|
? principalListItem(item, "elementum_user", where, ctx)
|
|
111
130
|
: dataType === "elementum_group"
|
|
112
131
|
? principalListItem(item, "elementum_group", where, ctx)
|
|
113
|
-
: principalListItem(item, "elementum_service_account", where, ctx);
|
|
132
|
+
: principalListItem(item, "elementum_service_account", where, ctx, owner);
|
|
114
133
|
if (decoded !== undefined)
|
|
115
134
|
items.push(decoded);
|
|
116
135
|
}
|
|
@@ -138,7 +157,7 @@ export function accessPolicyFromTf(block, owner, ctx) {
|
|
|
138
157
|
const filter = attrs["filter"] !== undefined ? filterFromTf(attrs["filter"], filterOwner, where) : { type: "TRUE" };
|
|
139
158
|
const userIds = principalList(attrs["user_ids"], "elementum_user", `${where}: user_ids`, ctx);
|
|
140
159
|
const groupIds = principalList(attrs["group_ids"], "elementum_group", `${where}: group_ids`, ctx);
|
|
141
|
-
const serviceAccountIds = principalList(attrs["service_account_ids"], "elementum_service_account", `${where}: service_account_ids`, ctx);
|
|
160
|
+
const serviceAccountIds = principalList(attrs["service_account_ids"], "elementum_service_account", `${where}: service_account_ids`, ctx, owner);
|
|
142
161
|
return {
|
|
143
162
|
filter,
|
|
144
163
|
...(userIds !== undefined && { userIds }),
|
|
@@ -38,6 +38,19 @@ export interface AccessPolicyToTfContext {
|
|
|
38
38
|
readonly appRefName?: string;
|
|
39
39
|
readonly serviceAccounts?: Readonly<Record<string, AppServiceAccount>>;
|
|
40
40
|
readonly fieldAddresses?: ReadonlyMap<string, string>;
|
|
41
|
+
/**
|
|
42
|
+
* Resolve an app that owns a `serviceAccountRef` in these policies but is
|
|
43
|
+
* NOT this policy's owner — an element granting an app's service account
|
|
44
|
+
* access, which publishing an automation that reads the element requires.
|
|
45
|
+
* The owner's to-tf supplies it (only it knows the workspace's other stream
|
|
46
|
+
* roots and may name the app resource type); owners that cannot host such a
|
|
47
|
+
* reference omit it and the ref is dropped with a diagnostic.
|
|
48
|
+
*/
|
|
49
|
+
readonly resolveServiceAccountApp?: (appRefName: string) => {
|
|
50
|
+
readonly appTfLabel: string;
|
|
51
|
+
readonly appId: TfValue;
|
|
52
|
+
readonly serviceAccounts?: Readonly<Record<string, AppServiceAccount>>;
|
|
53
|
+
} | undefined;
|
|
41
54
|
}
|
|
42
55
|
/** Filter conversion only needs owner/field context; org lookups are accepted so full policy contexts remain assignable. */
|
|
43
56
|
export interface FilterToTfContext extends Omit<AccessPolicyToTfContext, "orgRefs"> {
|
|
@@ -90,6 +90,18 @@ function isGroupToken(v) {
|
|
|
90
90
|
function isServiceAccountToken(v) {
|
|
91
91
|
return typeof v === "object" && v !== null && v.__kind === "serviceAccount";
|
|
92
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Point a cross-stream `serviceAccountRef` at the app that owns it. The
|
|
95
|
+
* account is not in this owner's bag, so `serviceAccounts` stays undefined and
|
|
96
|
+
* `serviceAccountRefToTf` takes its foreign data-source path.
|
|
97
|
+
*/
|
|
98
|
+
function resolveForeignOwningApp(item, ctx) {
|
|
99
|
+
const appRefName = item.appRefName;
|
|
100
|
+
if (appRefName === undefined || appRefName === "")
|
|
101
|
+
return undefined;
|
|
102
|
+
const resolved = ctx.resolveServiceAccountApp?.(appRefName);
|
|
103
|
+
return resolved === undefined ? undefined : { appRefName, ...resolved };
|
|
104
|
+
}
|
|
93
105
|
export function principalListToTf(items, dataType, where, ctx) {
|
|
94
106
|
if (items === undefined || items.length === 0)
|
|
95
107
|
return undefined;
|
|
@@ -99,6 +111,18 @@ export function principalListToTf(items, dataType, where, ctx) {
|
|
|
99
111
|
if (ctx.orgRefs === undefined) {
|
|
100
112
|
ctx.diagnostics.push(`${where}: pulled principal reference requires org context; dropped`);
|
|
101
113
|
}
|
|
114
|
+
else if (item.dataType === "elementum_service_account") {
|
|
115
|
+
// A service account is app-owned, so its data source requires
|
|
116
|
+
// `app_id`. The pulled shape carries only a name, so the owner must be
|
|
117
|
+
// the owning app — an element cannot say which app it meant.
|
|
118
|
+
if (ctx.scope !== "app") {
|
|
119
|
+
ctx.diagnostics.push(`${where}: pulled service-account reference ${JSON.stringify(item.value)} needs an app owner to supply app_id; dropped`);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
ctx.orgRefs.rawLookup(item.dataType, item.label, item.value, { app_id: ctx.objectId });
|
|
123
|
+
values.push(expr.dataAttr(item.dataType, item.label, ["id"]));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
102
126
|
else {
|
|
103
127
|
ctx.orgRefs.rawLookup(item.dataType, item.label, item.value);
|
|
104
128
|
values.push(expr.dataAttr(item.dataType, item.label, ["id"]));
|
|
@@ -124,11 +148,18 @@ export function principalListToTf(items, dataType, where, ctx) {
|
|
|
124
148
|
}
|
|
125
149
|
}
|
|
126
150
|
else if (dataType === "elementum_service_account" && isServiceAccountToken(item)) {
|
|
127
|
-
|
|
128
|
-
|
|
151
|
+
// The owner IS the owning app: its own `serviceAccounts` bag can resolve
|
|
152
|
+
// the name to a resource ref. Otherwise the owner is a different stream
|
|
153
|
+
// root and must point at the owning app for the data source's `app_id`.
|
|
154
|
+
const ownedByOwner = ctx.appRefName !== undefined && item.appRefName === ctx.appRefName;
|
|
155
|
+
const owning = ownedByOwner
|
|
156
|
+
? { appRefName: ctx.appRefName, appTfLabel: ctx.ownerTfLabel, appId: ctx.objectId, serviceAccounts: ctx.serviceAccounts }
|
|
157
|
+
: resolveForeignOwningApp(item, ctx);
|
|
158
|
+
if (owning === undefined || ctx.orgRefs === undefined) {
|
|
159
|
+
ctx.diagnostics.push(`${where}: serviceAccount ${JSON.stringify(item.name ?? "")} cannot resolve its owning app ${JSON.stringify(item.appRefName ?? "")}; dropped`);
|
|
129
160
|
}
|
|
130
161
|
else {
|
|
131
|
-
const value = serviceAccountRefToTf(item, {
|
|
162
|
+
const value = serviceAccountRefToTf(item, { ...owning, orgRefs: ctx.orgRefs }, where, ctx.diagnostics);
|
|
132
163
|
if (value !== undefined)
|
|
133
164
|
values.push(value);
|
|
134
165
|
}
|
|
@@ -108,7 +108,9 @@ export function printAgentV2(agent, opts) {
|
|
|
108
108
|
return ((tool.filterVariables?.length ?? 0) > 0 ||
|
|
109
109
|
tool.fields?.some((field) => field.rawFieldId !== undefined) === true ||
|
|
110
110
|
tool.searchTableFields?.some((field) => !searchTableFieldMatchesTarget(field.fieldId, targetOwner, opts.foreignFieldRefsById)) === true ||
|
|
111
|
-
tool.returnFields?.some((field) => !searchTableFieldMatchesTarget(field.fieldId, targetOwner, opts.foreignFieldRefsById)) === true
|
|
111
|
+
tool.returnFields?.some((field) => !searchTableFieldMatchesTarget(field.fieldId, targetOwner, opts.foreignFieldRefsById)) === true ||
|
|
112
|
+
tool.target?.kind === "unresolved" ||
|
|
113
|
+
tool.relatedTarget?.kind === "unresolved");
|
|
112
114
|
});
|
|
113
115
|
const lines = [];
|
|
114
116
|
lines.push("/**");
|
|
@@ -476,10 +478,13 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
|
|
|
476
478
|
}
|
|
477
479
|
else if (tool.target?.kind === "unresolved") {
|
|
478
480
|
// Export couldn't resolve target_id to any portable app/element
|
|
479
|
-
// reference (board issue #648) — keep the raw platform id visible
|
|
480
|
-
//
|
|
481
|
+
// reference (board issue #648) — keep the raw platform id visible via
|
|
482
|
+
// the same unsafePlatformId() escape automation/field refs already use,
|
|
483
|
+
// so build round-trips it directly instead of misreading it as a named
|
|
484
|
+
// reference; cast past the type system since the field itself is a
|
|
485
|
+
// strict CatalogRef.
|
|
481
486
|
const entityKind = tool.typeKey === "searchTable" ? "element" : "app";
|
|
482
|
-
lines.push(` ${entityKind}: ${quote(tool.target.uuid)} as any /* TODO: unresolved ${entityKind} - export couldn't resolve target_id to a portable reference; replace with a real ref before deploying */,`);
|
|
487
|
+
lines.push(` ${entityKind}: unsafePlatformId(${quote(tool.target.uuid)}) as any /* TODO: unresolved ${entityKind} - export couldn't resolve target_id to a portable reference; replace with a real ref before deploying */,`);
|
|
483
488
|
}
|
|
484
489
|
else if (tool.target !== undefined && tool.target.kind === "foreignApp") {
|
|
485
490
|
const foreignRefName = foreignAppRefNames?.get(tool.target.name);
|
|
@@ -518,9 +523,10 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
|
|
|
518
523
|
}
|
|
519
524
|
else if (tool.typeKey === "relateRecord" && tool.relatedTarget?.kind === "unresolved") {
|
|
520
525
|
// Export couldn't resolve related_target_id to any portable reference
|
|
521
|
-
// (board issue #648) — keep the raw platform id visible
|
|
522
|
-
// silently dropping
|
|
523
|
-
|
|
526
|
+
// (board issue #648) — keep the raw platform id visible via the same
|
|
527
|
+
// unsafePlatformId() escape used above, instead of silently dropping
|
|
528
|
+
// the tool.
|
|
529
|
+
lines.push(` relatedApp: unsafePlatformId(${quote(tool.relatedTarget.uuid)}) as any /* TODO: unresolved relatedApp - export couldn't resolve related_target_id to a portable reference; replace with a real ref before deploying */,`);
|
|
524
530
|
}
|
|
525
531
|
else if (tool.typeKey === "relateRecord" && tool.relatedTarget?.kind === "foreignApp") {
|
|
526
532
|
const foreignRefName = foreignAppRefNames?.get(tool.relatedTarget.name);
|
|
@@ -37,6 +37,19 @@ function serviceAccountIdValue(token, where, ctx) {
|
|
|
37
37
|
}
|
|
38
38
|
/** authoring app/element token → its resolved target (workspace resource or foreign data ref). */
|
|
39
39
|
function resolveTarget(token, ctx) {
|
|
40
|
+
// Legacy escape hatch (pre-#889): pull used to print an unresolved target
|
|
41
|
+
// as a bare platform-id string cast (`"<uuid>" as any`) rather than
|
|
42
|
+
// unsafePlatformId(...) — already-pulled workspaces still have this shape
|
|
43
|
+
// on disk and must keep round-tripping directly as target_id.
|
|
44
|
+
if (typeof token === "string") {
|
|
45
|
+
return { value: token, refName: token, kind: "app" };
|
|
46
|
+
}
|
|
47
|
+
// Pull's escape hatch for a target export couldn't resolve to any
|
|
48
|
+
// portable reference (#648) - the platform id round-trips directly as
|
|
49
|
+
// target_id, no name/namespace data lookup needed or even possible.
|
|
50
|
+
if (token.__unsafe === "platformId" && typeof token.value === "string" && token.value !== "") {
|
|
51
|
+
return { value: token.value, refName: token.value, kind: "app" };
|
|
52
|
+
}
|
|
40
53
|
const refName = token.refName ?? "";
|
|
41
54
|
const kind = token.__kind === "element" ? "element" : "app";
|
|
42
55
|
if (kind === "app" && refName === ctx.appRefName) {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* Includes typed scalar, Dropdown/Multi-Select, relation, calculation, and
|
|
12
12
|
* record-experience configuration with build/pull round-trip support.
|
|
13
13
|
*/
|
|
14
|
-
import { type AgentRef, type AppOrElementRef, type AutomationCatalogRef, type CatalogRef, type ChartRef, type CloudLinkRef, type DashboardRef, type FieldRef } from "../../catalog/index.js";
|
|
14
|
+
import { type AgentRef, type AppOrElementRef, type AutomationCatalogRef, type CatalogRef, type ChartRef, type CloudLinkRef, type DashboardRef, type FieldRef, type WidgetRef } from "../../catalog/index.js";
|
|
15
15
|
import type { WorkflowFieldType } from "../shared/types/field-types.js";
|
|
16
16
|
import { type SystemFieldKey } from "../../core/system-fields.js";
|
|
17
17
|
import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
|
|
@@ -240,6 +240,8 @@ export interface AppSystemFields {
|
|
|
240
240
|
* one here, same as `systemFields: {}` is already keyed.
|
|
241
241
|
*/
|
|
242
242
|
export type AppViewFieldRef = FieldRef | SystemFieldKey;
|
|
243
|
+
/** A typed reference to an app-owned widget for placement in a classic layout group. */
|
|
244
|
+
export type AppLayoutWidgetRef<Parent extends string = string, RefName extends string = string> = WidgetRef<Parent, RefName>;
|
|
243
245
|
/**
|
|
244
246
|
* One section of a per-stage record layout (`elementum_layout`). The
|
|
245
247
|
* provider's own 9-value `type` enum (default `"group"`): only `"group"`
|
|
@@ -263,6 +265,8 @@ export interface AppLayoutSection {
|
|
|
263
265
|
readonly maxColumns?: number;
|
|
264
266
|
/** `"group"` only — the fields shown in this group, in order. */
|
|
265
267
|
readonly fields?: readonly AppViewFieldRef[];
|
|
268
|
+
/** `"group"` only — app-owned action/record widgets shown after the fields. */
|
|
269
|
+
readonly widgets?: readonly AppLayoutWidgetRef[];
|
|
266
270
|
}
|
|
267
271
|
/** A stage's record-detail layout (`elementum_layout`) — immutable after creation; any change replaces it. */
|
|
268
272
|
export interface AppLayout {
|
|
@@ -374,6 +378,8 @@ export interface AppV2Options<F extends Record<string, AppField> = Record<string
|
|
|
374
378
|
readonly cloudOptions?: AppCloudOptions;
|
|
375
379
|
/** Enables the record-view comments panel. Platform default is `false`. */
|
|
376
380
|
readonly commentsEnabled?: boolean;
|
|
381
|
+
/** Locks the stage selector during record creation so lifecycle automations own initial progression. */
|
|
382
|
+
readonly lockStages?: boolean;
|
|
377
383
|
/** Fields keyed by ref name. At least one required by the compose API. */
|
|
378
384
|
readonly fields: F;
|
|
379
385
|
/**
|
|
@@ -419,7 +425,13 @@ export interface AppV2Options<F extends Record<string, AppField> = Record<string
|
|
|
419
425
|
readonly recordCreateForm?: AppRecordCreateForm;
|
|
420
426
|
/** Typed V2 DASHBOARD layouts, keyed by stable EDK ref name. */
|
|
421
427
|
readonly dynamicLayouts?: Readonly<Record<string, AppDynamicLayout>>;
|
|
422
|
-
/**
|
|
428
|
+
/**
|
|
429
|
+
* Parent-owned joins keyed by stable ref name. A `relatedRecords` widget
|
|
430
|
+
* targeting another app/element lists rows through a matching entry here
|
|
431
|
+
* whose columns join comparable stored values, not through that child's
|
|
432
|
+
* `relationField` / `autoRelate`. Do not join system `"id"` (HANDLE) to a
|
|
433
|
+
* child `relationField`.
|
|
434
|
+
*/
|
|
423
435
|
readonly relationships?: Readonly<Record<string, AppRelationship>>;
|
|
424
436
|
/** Display order of all authored views (by key). Defaults to declaration order by view bag. */
|
|
425
437
|
readonly viewOrder?: readonly string[];
|
|
@@ -544,6 +556,7 @@ export type AppSelfRef<F extends Record<string, AppField> = Record<string, AppFi
|
|
|
544
556
|
automation<const Name extends string>(refName: Name, name?: string): AutomationCatalogRef & CatalogRef<"automation", Name, RefName>;
|
|
545
557
|
chart<const Name extends string>(refName: Name, name?: string): ChartRef<RefName, Name>;
|
|
546
558
|
dashboard<const Name extends string>(refName: Name, name?: string): DashboardRef<RefName, Name>;
|
|
559
|
+
widget<const Name extends string>(refName: Name, name?: string): AppLayoutWidgetRef<RefName, Name>;
|
|
547
560
|
};
|
|
548
561
|
/** Reference-bearing app options that can safely be authored from `withRefs`. */
|
|
549
562
|
export type AppReferenceConfiguration = Pick<AppV2Options, "layouts" | "listViews" | "calendarViews" | "kanbanViews" | "dashboards" | "widgets" | "dashboardViews" | "agentViews" | "recordCreateForm" | "dynamicLayouts" | "relationships" | "viewOrder" | "accessPolicies">;
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import { slimTokens } from "../../catalog/index.js";
|
|
15
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";
|
|
16
16
|
import { serializeDisplayBlocks } from "./display-blocks.js";
|
|
17
|
+
import { assertCalculatedFieldRoot } from "../field/calc/runtime.js";
|
|
17
18
|
export { dashboardChartWidget, dashboardRecordsWidget, dashboardWidgetSize, } from "../dashboard/build.js";
|
|
18
19
|
/**
|
|
19
20
|
* Map a platform field type to the `AspectFieldInput` variant key. "relation"
|
|
@@ -154,6 +155,7 @@ export function serializeField(field, refName) {
|
|
|
154
155
|
// Calculated field: the calc expression serializes to a text grammar string
|
|
155
156
|
// (field refs emitted by name; the platform resolves them on compose).
|
|
156
157
|
if (field.expression !== undefined) {
|
|
158
|
+
assertCalculatedFieldRoot(field.expression, field.name);
|
|
157
159
|
const includeTypes = field.include === undefined || field.include === "auto" ? []
|
|
158
160
|
: field.include === "manual" ? [{ manual: { type: "MANUAL" } }]
|
|
159
161
|
: field.include === "both" ? [{ auto: { type: "AUTO" } }, { manual: { type: "MANUAL" } }]
|
|
@@ -370,6 +372,9 @@ export function app(opts) {
|
|
|
370
372
|
dashboard(childRefName, name = childRefName) {
|
|
371
373
|
return { __kind: "dashboard", refName: childRefName, name, parent: refName };
|
|
372
374
|
},
|
|
375
|
+
widget(childRefName, name = childRefName) {
|
|
376
|
+
return { __kind: "widget", refName: childRefName, name, parent: refName };
|
|
377
|
+
},
|
|
373
378
|
};
|
|
374
379
|
return self;
|
|
375
380
|
}
|
|
@@ -417,6 +422,7 @@ export function app(opts) {
|
|
|
417
422
|
...(opts.cloudLink !== undefined ? { cloudLinkId: opts.cloudLink } : {}), // token → id at deploy
|
|
418
423
|
...(opts.cloudOptions !== undefined ? { cloudOptions: opts.cloudOptions } : {}),
|
|
419
424
|
...(opts.commentsEnabled !== undefined ? { commentsEnabled: opts.commentsEnabled } : {}),
|
|
425
|
+
...(opts.lockStages !== undefined ? { lockStages: opts.lockStages } : {}),
|
|
420
426
|
fields: [
|
|
421
427
|
...serializeSystemFields(opts.systemFields),
|
|
422
428
|
...Object.entries(opts.fields).map(([bagKey, field]) => serializeField(field, bagKey)),
|
|
@@ -120,6 +120,7 @@ export interface NormalizedLayoutSection {
|
|
|
120
120
|
readonly color?: string;
|
|
121
121
|
readonly maxColumns?: number;
|
|
122
122
|
readonly fields?: readonly string[];
|
|
123
|
+
readonly widgets?: readonly string[];
|
|
123
124
|
}
|
|
124
125
|
/** A stage's record-detail layout, keyed by stage key on `NormalizedApp.layouts`. */
|
|
125
126
|
export interface NormalizedLayout {
|
|
@@ -190,11 +191,16 @@ export type NormalizedDashboardWidget = {
|
|
|
190
191
|
readonly chartKey: string;
|
|
191
192
|
};
|
|
192
193
|
export interface NormalizedWidgetRef {
|
|
193
|
-
readonly kind: "app" | "element" | "automation" | "field";
|
|
194
|
+
readonly kind: "app" | "element" | "automation" | "field" | "recordIdentity";
|
|
194
195
|
readonly key: string;
|
|
195
196
|
readonly name: string;
|
|
196
197
|
readonly parent?: string;
|
|
197
198
|
readonly fieldType?: string;
|
|
199
|
+
readonly target?: NormalizedWidgetRef;
|
|
200
|
+
/** A foreign app/element target resolved by namespace rather than a display-name lookup. */
|
|
201
|
+
readonly namespace?: string;
|
|
202
|
+
/** `key`/`name` are the target's real pulled catalog identity - print via appRef()/elementRef(). */
|
|
203
|
+
readonly catalogRef?: true;
|
|
198
204
|
}
|
|
199
205
|
export interface NormalizedWidgetButtonStyle {
|
|
200
206
|
readonly buttonType: "INLINE" | "PRIMARY" | "SECONDARY";
|
|
@@ -261,10 +267,12 @@ export interface NormalizedRecordCreateForm {
|
|
|
261
267
|
readonly sections: readonly NormalizedRecordCreateFormSection[];
|
|
262
268
|
}
|
|
263
269
|
export interface PulledDynamicLayoutRef {
|
|
264
|
-
readonly __pulledRef: "field" | "automation" | "app" | "element";
|
|
270
|
+
readonly __pulledRef: "field" | "automation" | "agent" | "app" | "element";
|
|
265
271
|
readonly key: string;
|
|
266
272
|
readonly parent?: string;
|
|
267
273
|
readonly name?: string;
|
|
274
|
+
/** A foreign app/element target resolved by namespace rather than a display-name lookup. */
|
|
275
|
+
readonly namespace?: string;
|
|
268
276
|
}
|
|
269
277
|
export interface NormalizedDynamicLayout {
|
|
270
278
|
readonly key: string;
|
|
@@ -272,7 +280,7 @@ export interface NormalizedDynamicLayout {
|
|
|
272
280
|
readonly layout: Readonly<Record<string, unknown>>;
|
|
273
281
|
}
|
|
274
282
|
export interface PulledRelationshipRef {
|
|
275
|
-
readonly kind: "app" | "element" | "table" | "field" | "tableColumn";
|
|
283
|
+
readonly kind: "app" | "element" | "table" | "field" | "tableColumn" | "recordIdentity";
|
|
276
284
|
readonly key: string;
|
|
277
285
|
readonly name: string;
|
|
278
286
|
readonly parent?: string;
|
|
@@ -285,6 +293,7 @@ export interface PulledRelationshipRef {
|
|
|
285
293
|
readonly parentKind?: "app" | "element";
|
|
286
294
|
readonly parentName?: string;
|
|
287
295
|
readonly parentNamespace?: string;
|
|
296
|
+
readonly target?: PulledRelationshipRef;
|
|
288
297
|
}
|
|
289
298
|
export interface NormalizedRelationship {
|
|
290
299
|
readonly key: string;
|
|
@@ -326,6 +335,7 @@ export interface NormalizedApp {
|
|
|
326
335
|
readonly cloudLinkId?: string;
|
|
327
336
|
readonly cloudLinkClientHandle?: string;
|
|
328
337
|
readonly commentsEnabled?: boolean;
|
|
338
|
+
readonly lockStages?: boolean;
|
|
329
339
|
readonly cloudOptions?: {
|
|
330
340
|
readonly snowflake?: {
|
|
331
341
|
readonly hybridTable?: boolean;
|
|
@@ -12,7 +12,7 @@ import { EntityTfError } from "../../engine/entity.js";
|
|
|
12
12
|
import { dataRefLabel, optionalString, plainObject } from "../../engine/pull/context.js";
|
|
13
13
|
import { snakeSlug, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
14
14
|
import { accessPolicyFromTf } from "../access-policy/from-tf.js";
|
|
15
|
-
import { dynamicLayoutsFromTf } from "../dynamic-layout/from-tf.js";
|
|
15
|
+
import { dynamicLayoutCompanionWidgetLabels, dynamicLayoutsFromTf, } from "../dynamic-layout/from-tf.js";
|
|
16
16
|
import { dashboardsFromTf } from "../dashboard/from-tf.js";
|
|
17
17
|
import { fieldFromTf } from "../field/from-tf.js";
|
|
18
18
|
import { optionsFromTf } from "../field/options.js";
|
|
@@ -42,6 +42,7 @@ const KNOWN_APP_ATTRS = new Set([
|
|
|
42
42
|
"id_field_description",
|
|
43
43
|
"status_field_description",
|
|
44
44
|
"comments_enabled",
|
|
45
|
+
"lock_stages",
|
|
45
46
|
"system_field_config",
|
|
46
47
|
]);
|
|
47
48
|
const SYSTEM_FIELD_TYPE_BY_KEY = {
|
|
@@ -108,6 +109,7 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
|
|
|
108
109
|
const idFieldDescription = optionalString(attrs, "id_field_description", `app "${label}"`, ctx);
|
|
109
110
|
const statusFieldDescription = optionalString(attrs, "status_field_description", `app "${label}"`, ctx);
|
|
110
111
|
const commentsEnabled = typeof attrs["comments_enabled"] === "boolean" ? attrs["comments_enabled"] : undefined;
|
|
112
|
+
const lockStages = typeof attrs["lock_stages"] === "boolean" ? attrs["lock_stages"] : undefined;
|
|
111
113
|
// --- Org data references (category / cloud link).
|
|
112
114
|
let category;
|
|
113
115
|
if (attrs["category_id"] !== undefined) {
|
|
@@ -211,14 +213,14 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
|
|
|
211
213
|
}
|
|
212
214
|
// --- View pass: layouts / list views / view order (entities/view), owner passed in.
|
|
213
215
|
const dashboards = dashboardsFromTf(viewBlocks.dashboardBlocks, viewBlocks.dashboardWidgetBlocks, { type: APP_RESOURCE_TYPE, label, ownerTfLabel: refName, ownerRefName: refName, scope: "app", ownerType: "APP_ASPECT" }, ctx);
|
|
214
|
-
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:
|
|
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);
|
|
215
217
|
if (viewBlocks.recordCreateFormBlocks.length > 1) {
|
|
216
218
|
ctx.diagnostics.push(`app "${label}": found ${viewBlocks.recordCreateFormBlocks.length} record create forms; only the first is used`);
|
|
217
219
|
}
|
|
218
220
|
const recordCreateForm = recordCreateFormFromTf(viewBlocks.recordCreateFormBlocks[0], { type: APP_RESOURCE_TYPE, label, ownerTfLabel: refName, scope: "app" }, ctx);
|
|
219
221
|
const dynamicLayouts = dynamicLayoutsFromTf(viewBlocks.dynamicLayoutBlocks, { type: APP_RESOURCE_TYPE, label, ownerRefName: refName, ownerTfLabel: refName }, ctx);
|
|
220
222
|
const relationships = relationshipsFromTf(viewBlocks.relationshipBlocks, { kind: "app", label, ownerRefName: refName, ownerTfLabel: refName, scope: "app" }, ctx);
|
|
221
|
-
const widgets = widgetsFromTf(viewBlocks.widgetBlocks, { type: APP_RESOURCE_TYPE, label, ownerRefName: refName, ownerTfLabel: label, scope: "app" }, ctx);
|
|
223
|
+
const widgets = widgetsFromTf(viewBlocks.widgetBlocks, { type: APP_RESOURCE_TYPE, label, ownerRefName: refName, ownerTfLabel: label, scope: "app" }, ctx, dynamicLayoutCompanionWidgetLabels(viewBlocks.dynamicLayoutBlocks));
|
|
222
224
|
// --- Access policies (entities/access-policy), owner passed in.
|
|
223
225
|
const accessPolicyOwner = {
|
|
224
226
|
type: APP_RESOURCE_TYPE,
|
|
@@ -250,6 +252,7 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
|
|
|
250
252
|
stages,
|
|
251
253
|
...(cloudLinkId !== undefined && { cloudLinkId }),
|
|
252
254
|
...(commentsEnabled !== undefined && { commentsEnabled }),
|
|
255
|
+
...(lockStages !== undefined && { lockStages }),
|
|
253
256
|
...(layouts.length > 0 && { layouts }),
|
|
254
257
|
...(listViews.length > 0 && { listViews }),
|
|
255
258
|
...(calendarViews.length > 0 && { calendarViews }),
|