@elementumai/edk 0.9.15 → 0.9.17
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/pull/util.d.ts +0 -15
- package/dist-sdk/pull/util.js +44 -5
- package/dist-sdk/src/engine/build/context.d.ts +2 -2
- package/dist-sdk/src/engine/progress.d.ts +4 -0
- package/dist-sdk/src/engine/progress.js +16 -4
- package/dist-sdk/src/engine/pull/context.d.ts +5 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +4 -0
- package/dist-sdk/src/engine/pull/ref-only.js +11 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/access-policy/from-tf.js +47 -12
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +5 -3
- package/dist-sdk/src/entities/access-policy/to-tf.js +23 -1
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +27 -2
- package/dist-sdk/src/entities/agent/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/agent/from-tf.js +18 -3
- package/dist-sdk/src/entities/agent/to-tf.js +14 -0
- package/dist-sdk/src/entities/agent/tools.d.ts +79 -2
- package/dist-sdk/src/entities/agent/tools.js +2 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +45 -3
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +7 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +72 -20
- package/dist-sdk/src/entities/app/module.js +8 -0
- package/dist-sdk/src/entities/app/to-tf.js +1 -0
- package/dist-sdk/src/entities/automation/build.d.ts +12 -5
- package/dist-sdk/src/entities/automation/build.js +30 -11
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +4 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +108 -23
- package/dist-sdk/src/entities/automation/from-tf.d.ts +73 -5
- package/dist-sdk/src/entities/automation/from-tf.js +270 -30
- package/dist-sdk/src/entities/automation/index.d.ts +2 -1
- package/dist-sdk/src/entities/automation/index.js +2 -1
- package/dist-sdk/src/entities/automation/module.js +6 -7
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +5 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +12 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +20 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +22 -0
- package/dist-sdk/src/entities/automation/script-code.js +13 -4
- package/dist-sdk/src/entities/automation/tasks.d.ts +61 -5
- package/dist-sdk/src/entities/automation/tasks.js +42 -9
- package/dist-sdk/src/entities/automation/to-tf.d.ts +0 -2
- package/dist-sdk/src/entities/automation/to-tf.js +85 -36
- package/dist-sdk/src/entities/automation/triggers.d.ts +5 -2
- package/dist-sdk/src/entities/automation/types.d.ts +2 -0
- package/dist-sdk/src/entities/automation/types.js +5 -0
- package/dist-sdk/src/entities/automation/workflow-output.d.ts +35 -0
- package/dist-sdk/src/entities/automation/workflow-output.js +53 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +1 -1
- package/dist-sdk/src/entities/dashboard/to-tf.js +1 -0
- package/dist-sdk/src/entities/element/build.d.ts +11 -8
- package/dist-sdk/src/entities/element/build.js +14 -5
- package/dist-sdk/src/entities/element/locals.d.ts +2 -2
- package/dist-sdk/src/entities/element/locals.js +6 -2
- package/dist-sdk/src/entities/element/system-fields.d.ts +4 -0
- package/dist-sdk/src/entities/element/system-fields.js +12 -0
- package/dist-sdk/src/entities/element/to-tf.js +1 -0
- package/dist-sdk/src/entities/field/from-tf.js +47 -1
- package/dist-sdk/src/entities/relationship/from-tf.js +2 -2
- package/dist-sdk/src/entities/relationship/to-tf.js +1 -0
- package/dist-sdk/src/entities/search-table/from-tf.js +6 -6
- package/dist-sdk/src/entities/search-table/module.js +2 -2
- package/dist-sdk/src/entities/search-table/types.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/types.js +1 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +2 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +12 -2
- package/dist-sdk/src/entities/shared/filters/index.js +17 -1
- package/dist-sdk/src/entities/shared/filters/print.js +25 -11
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +1 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +39 -7
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +18 -2
- package/dist-sdk/src/entities/skill/module.js +9 -0
- package/dist-sdk/src/entities/skill/to-tf.js +18 -0
- package/dist-sdk/src/entities/skill/tools.d.ts +18 -4
- package/dist-sdk/src/entities/skill/tools.js +1 -1
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +12 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +58 -3
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +78 -43
- package/dist-sdk/src/entities/view/from-tf.js +30 -9
- package/dist-sdk/src/entities/view/to-tf.js +18 -10
- package/dist-sdk/src/entities/widget/from-tf.js +1 -1
- package/dist-sdk/src/entities/widget/to-tf.js +1 -0
- package/dist-sdk/src/graph/index.d.ts +13 -0
- package/dist-sdk/src/graph/index.js +5 -0
- package/dist-sdk/src/graph/types.d.ts +10 -0
- package/package.json +2 -1
|
@@ -11,20 +11,27 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { expr, isCanonicalTsLabel, sanitizeName, scopedResourceLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
|
|
13
13
|
import { fieldRefToTfValue as customFieldRefToTfValue } from "../field/to-tf.js";
|
|
14
|
+
import { ELEMENT_SYSTEM_FIELD_KEYS } from "../element/system-fields.js";
|
|
14
15
|
import { filterToTf, principalListToTf } from "../access-policy/to-tf.js";
|
|
15
16
|
import { SUB_TYPE_BY_AUTHORING_TYPE } from "../field/types.js";
|
|
16
17
|
import { DASHBOARD_RESOURCE_TYPE } from "../dashboard/module.js";
|
|
17
18
|
import { WIDGET_RESOURCE_TYPE } from "../widget/module.js";
|
|
18
19
|
import { AGENT_VIEW_RESOURCE_TYPE, CALENDAR_VIEW_RESOURCE_TYPE, DASHBOARD_VIEW_RESOURCE_TYPE, GROUP_SECTION_WIRE_TYPE, LAYOUT_RESOURCE_TYPE, LAYOUT_RESTRICTED_SYSTEM_FIELD_KEYS, LIST_VIEW_RESOURCE_TYPE, KANBAN_VIEW_RESOURCE_TYPE, MANAGED_VIEW_ORDER_RESOURCE_TYPE, SECTION_TYPE_TO_WIRE, SYSTEM_FIELD_ID_ATTR_BY_KEY, UPDATE_SECTION_WIRE_TYPE, } from "./types.js";
|
|
19
|
-
/** Elements only have `id`/`title` as real system fields (no status/stage/audit fields) — see `element/locals.ts`. */
|
|
20
|
-
const ELEMENT_SYSTEM_FIELD_KEYS = new Set(["id", "title"]);
|
|
21
20
|
function appendViewSharingAttrs(attrs, view, where, ctx) {
|
|
22
21
|
const userIds = principalListToTf(view.userIds, "elementum_user", `${where}.userIds`, ctx);
|
|
23
22
|
const groupIds = principalListToTf(view.groupIds, "elementum_group", `${where}.groupIds`, ctx);
|
|
24
|
-
if (userIds !== undefined)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
if (view.userIds !== undefined) {
|
|
24
|
+
if (view.userIds.length === 0)
|
|
25
|
+
attrs["user_ids"] = [];
|
|
26
|
+
else if (userIds !== undefined)
|
|
27
|
+
attrs["user_ids"] = userIds;
|
|
28
|
+
}
|
|
29
|
+
if (view.groupIds !== undefined) {
|
|
30
|
+
if (view.groupIds.length === 0)
|
|
31
|
+
attrs["group_ids"] = [];
|
|
32
|
+
else if (groupIds !== undefined)
|
|
33
|
+
attrs["group_ids"] = groupIds;
|
|
34
|
+
}
|
|
28
35
|
}
|
|
29
36
|
/** `layouts`/`listViews`/`viewOrder` → their resource blocks, in ei's dialect. */
|
|
30
37
|
export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboardViews, agentViews, viewOrder, opts) {
|
|
@@ -71,6 +78,7 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
71
78
|
if (view.filter !== undefined) {
|
|
72
79
|
attrs.filter = filterToTf(view.filter, `${where}.filter`, {
|
|
73
80
|
ownerTfLabel,
|
|
81
|
+
appRefName: ownerRefName,
|
|
74
82
|
scope,
|
|
75
83
|
objectId,
|
|
76
84
|
diagnostics,
|
|
@@ -119,7 +127,7 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
119
127
|
}
|
|
120
128
|
}
|
|
121
129
|
if (view.filter !== undefined)
|
|
122
|
-
attrs["filter"] = filterToTf(view.filter, `${where}.filter`, { ownerTfLabel, scope, objectId, diagnostics, resolvePicklistLiterals: false, fieldAddresses });
|
|
130
|
+
attrs["filter"] = filterToTf(view.filter, `${where}.filter`, { ownerTfLabel, appRefName: ownerRefName, scope, objectId, diagnostics, resolvePicklistLiterals: false, fieldAddresses });
|
|
123
131
|
if (view.sort !== undefined)
|
|
124
132
|
attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `${where}.sort`, diagnostics, fieldAddresses);
|
|
125
133
|
appendViewSharingAttrs(attrs, view, where, principalCtx);
|
|
@@ -161,7 +169,7 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
161
169
|
allow_record_creation: view.allowRecordCreation ?? true,
|
|
162
170
|
};
|
|
163
171
|
if (view.filter !== undefined)
|
|
164
|
-
attrs["filter"] = filterToTf(view.filter, `dashboardViews.${viewKey}.filter`, { ownerTfLabel, scope, objectId, diagnostics, resolvePicklistLiterals: false, fieldAddresses });
|
|
172
|
+
attrs["filter"] = filterToTf(view.filter, `dashboardViews.${viewKey}.filter`, { ownerTfLabel, appRefName: ownerRefName, scope, objectId, diagnostics, resolvePicklistLiterals: false, fieldAddresses });
|
|
165
173
|
if (view.sort !== undefined)
|
|
166
174
|
attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `dashboardViews.${viewKey}.sort`, diagnostics, fieldAddresses);
|
|
167
175
|
appendViewSharingAttrs(attrs, view, `dashboardViews.${viewKey}`, principalCtx);
|
|
@@ -194,7 +202,7 @@ export function viewToTf(layouts, listViews, calendarViews, kanbanViews, dashboa
|
|
|
194
202
|
allow_record_creation: view.allowRecordCreation ?? true,
|
|
195
203
|
};
|
|
196
204
|
if (view.filter !== undefined)
|
|
197
|
-
attrs["filter"] = filterToTf(view.filter, `agentViews.${viewKey}.filter`, { ownerTfLabel, scope, objectId, diagnostics, resolvePicklistLiterals: false, fieldAddresses });
|
|
205
|
+
attrs["filter"] = filterToTf(view.filter, `agentViews.${viewKey}.filter`, { ownerTfLabel, appRefName: ownerRefName, scope, objectId, diagnostics, resolvePicklistLiterals: false, fieldAddresses });
|
|
198
206
|
if (view.sort !== undefined)
|
|
199
207
|
attrs["sort"] = managedViewSortToTf(view.sort, ownerTfLabel, scope, `agentViews.${viewKey}.sort`, diagnostics, fieldAddresses);
|
|
200
208
|
appendViewSharingAttrs(attrs, view, `agentViews.${viewKey}`, principalCtx);
|
|
@@ -360,7 +368,7 @@ function fieldRefToTfValue(ref, ownerTfLabel, scope, where, diagnostics, fieldAd
|
|
|
360
368
|
return undefined;
|
|
361
369
|
}
|
|
362
370
|
if (typeof ref === "string") {
|
|
363
|
-
if (scope === "element" && !ELEMENT_SYSTEM_FIELD_KEYS.
|
|
371
|
+
if (scope === "element" && !ELEMENT_SYSTEM_FIELD_KEYS.includes(ref)) {
|
|
364
372
|
diagnostics.push(`${where}: "${ref}" is not a known system field key on an element; dropped`);
|
|
365
373
|
return undefined;
|
|
366
374
|
}
|
|
@@ -79,7 +79,7 @@ function widgetFromTf(block, owner, ctx, dynamicLayoutCompanionLabels) {
|
|
|
79
79
|
};
|
|
80
80
|
const filter = body["filter"] === undefined
|
|
81
81
|
? undefined
|
|
82
|
-
: filterFromTf(body["filter"], filterOwner, `${where}.${variant}.filter
|
|
82
|
+
: filterFromTf(body["filter"], filterOwner, `${where}.${variant}.filter`, ctx);
|
|
83
83
|
return {
|
|
84
84
|
key,
|
|
85
85
|
type: "linkRecords",
|
|
@@ -52,6 +52,7 @@ export function widgetsToTf(widgets, opts) {
|
|
|
52
52
|
if (widget.filter !== undefined)
|
|
53
53
|
body["filter"] = filterToTf(widget.filter, `${where}.filter`, {
|
|
54
54
|
ownerTfLabel: opts.ownerTfLabel,
|
|
55
|
+
appRefName: opts.ownerRefName,
|
|
55
56
|
scope: opts.scope,
|
|
56
57
|
objectId: opts.objectId,
|
|
57
58
|
diagnostics: opts.diagnostics,
|
|
@@ -80,6 +80,19 @@ export declare const STREAM_ROOT_RESOURCE_TYPES: ReadonlySet<string>;
|
|
|
80
80
|
* entities/ directly.
|
|
81
81
|
*/
|
|
82
82
|
export declare const AUTHORING_TYPE_BY_RESOURCE_TYPE: ReadonlyMap<string, string>;
|
|
83
|
+
/** Entity-declared value equivalences used to compare builder and exporter HCL. */
|
|
84
|
+
export declare const BUILD_VS_EXPORT_NORMALIZATIONS: {
|
|
85
|
+
readonly omittedAttributeDefaults: {
|
|
86
|
+
attribute: string;
|
|
87
|
+
value: import("../engine/tf/model.js").TfValue;
|
|
88
|
+
blockType: string;
|
|
89
|
+
}[];
|
|
90
|
+
readonly stringSuffixAliases: {
|
|
91
|
+
attribute: string;
|
|
92
|
+
suffix: string;
|
|
93
|
+
blockType: string;
|
|
94
|
+
}[];
|
|
95
|
+
};
|
|
83
96
|
/** Own-file children of a parent kind (build discovery + pull print paths). */
|
|
84
97
|
export declare function ownFileChildrenOf(parent: KindId): readonly EntityKindModule[];
|
|
85
98
|
/**
|
|
@@ -98,6 +98,11 @@ export const STREAM_ROOT_RESOURCE_TYPES = new Set(STREAM_ROOT_MODULES.flatMap((m
|
|
|
98
98
|
export const AUTHORING_TYPE_BY_RESOURCE_TYPE = new Map(KIND_MODULES.flatMap((m) => m.resource.shape === "subTypes"
|
|
99
99
|
? m.resource.rows.flatMap((row) => (row.authoringType === undefined ? [] : [[row.resourceType, row.authoringType]]))
|
|
100
100
|
: []));
|
|
101
|
+
/** Entity-declared value equivalences used to compare builder and exporter HCL. */
|
|
102
|
+
export const BUILD_VS_EXPORT_NORMALIZATIONS = {
|
|
103
|
+
omittedAttributeDefaults: KIND_MODULES.flatMap((module) => (module.roundtrip?.omittedAttributeDefaults ?? []).flatMap((equivalence) => implementedResourceTypes(module.resource).map((blockType) => ({ blockType, ...equivalence })))),
|
|
104
|
+
stringSuffixAliases: KIND_MODULES.flatMap((module) => (module.roundtrip?.stringSuffixAliases ?? []).flatMap((equivalence) => implementedResourceTypes(module.resource).map((blockType) => ({ blockType, ...equivalence })))),
|
|
105
|
+
};
|
|
101
106
|
/** Own-file children of a parent kind (build discovery + pull print paths). */
|
|
102
107
|
export function ownFileChildrenOf(parent) {
|
|
103
108
|
return KIND_MODULES.filter((m) => m.authoring.unit === "ownFile" &&
|
|
@@ -538,6 +538,16 @@ export interface EntityKindModule {
|
|
|
538
538
|
readonly nestedAttribute: string;
|
|
539
539
|
readonly dataType: string;
|
|
540
540
|
}[];
|
|
541
|
+
/** Values the exporter writes explicitly while the builder omits them as provider defaults. */
|
|
542
|
+
readonly omittedAttributeDefaults?: readonly {
|
|
543
|
+
readonly attribute: string;
|
|
544
|
+
readonly value: TfValue;
|
|
545
|
+
}[];
|
|
546
|
+
/** Exact exporter-only suffixes that carry no additional authored meaning. */
|
|
547
|
+
readonly stringSuffixAliases?: readonly {
|
|
548
|
+
readonly attribute: string;
|
|
549
|
+
readonly suffix: string;
|
|
550
|
+
}[];
|
|
541
551
|
};
|
|
542
552
|
}
|
|
543
553
|
export declare function implementedResourceTypes(resource: ResourceFacet): readonly string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementumai/edk",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.17",
|
|
4
4
|
"description": "Elementum Development Kit — statically typed SDK for building Elementum apps, automations, and agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -195,6 +195,7 @@
|
|
|
195
195
|
"test:cli": "vitest run __tests__/cli",
|
|
196
196
|
"test:binary": "npm run build:sdk && npm run build:binary:bun && npm run smoke:binary:bun",
|
|
197
197
|
"test:integration": "node integration/run.mjs",
|
|
198
|
+
"reap:orphans": "node integration/tools/reap-orphaned-test-entities.mjs",
|
|
198
199
|
"typecheck": "npm run typecheck:ci",
|
|
199
200
|
"typecheck:ci": "tsc --noEmit -p tsconfig.ci.json && tsc --noEmit -p tsconfig.examples-check.json",
|
|
200
201
|
"typecheck:src": "tsc --noEmit",
|