@elementumai/edk 0.8.0-preview.11 → 0.8.1
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 +378 -324
- package/dist-sdk/src/catalog/ai-provider-models.d.ts +30 -0
- package/dist-sdk/src/catalog/ai-provider-models.js +63 -0
- package/dist-sdk/src/catalog/factories.d.ts +56 -3
- package/dist-sdk/src/catalog/factories.js +65 -2
- package/dist-sdk/src/catalog/from-authoring.js +6 -1
- package/dist-sdk/src/catalog/index.d.ts +3 -2
- package/dist-sdk/src/catalog/index.js +3 -2
- package/dist-sdk/src/catalog/org.d.ts +1 -1
- package/dist-sdk/src/catalog/org.js +83 -6
- package/dist-sdk/src/catalog/render.d.ts +13 -1
- package/dist-sdk/src/catalog/render.js +21 -4
- package/dist-sdk/src/catalog/token.js +14 -0
- package/dist-sdk/src/catalog/types.d.ts +60 -3
- package/dist-sdk/src/catalog/types.js +3 -0
- package/dist-sdk/src/core/system-fields.d.ts +2 -0
- package/dist-sdk/src/core/system-fields.js +2 -0
- package/dist-sdk/src/core/types/ai-provider.d.ts +10 -23
- package/dist-sdk/src/core/types/ai-provider.js +1 -25
- package/dist-sdk/src/core/types/app.d.ts +20 -1
- package/dist-sdk/src/engine/build/context.d.ts +18 -0
- package/dist-sdk/src/engine/build/source-context.d.ts +45 -0
- package/dist-sdk/src/engine/build/source-context.js +23 -0
- package/dist-sdk/src/engine/pull/context.d.ts +15 -0
- package/dist-sdk/src/engine/pull/org.d.ts +10 -0
- package/dist-sdk/src/engine/pull/org.js +34 -4
- package/dist-sdk/src/engine/tf/index.d.ts +1 -1
- package/dist-sdk/src/engine/tf/index.js +1 -1
- package/dist-sdk/src/engine/tf/labels.d.ts +45 -0
- package/dist-sdk/src/engine/tf/labels.js +71 -0
- package/dist-sdk/src/entities/access-policy/build.d.ts +26 -0
- package/dist-sdk/src/entities/access-policy/build.js +7 -0
- package/dist-sdk/src/entities/access-policy/filter.d.ts +61 -0
- package/dist-sdk/src/entities/access-policy/filter.js +83 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +48 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +189 -0
- package/dist-sdk/src/entities/access-policy/module.d.ts +3 -0
- package/dist-sdk/src/entities/access-policy/module.js +17 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +36 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +149 -0
- package/dist-sdk/src/entities/access-policy/types.d.ts +4 -0
- package/dist-sdk/src/entities/access-policy/types.js +10 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +38 -3
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +199 -32
- package/dist-sdk/src/entities/agent/from-tf.d.ts +18 -3
- package/dist-sdk/src/entities/agent/from-tf.js +135 -15
- package/dist-sdk/src/entities/agent/index.d.ts +1 -1
- package/dist-sdk/src/entities/agent/module.js +8 -2
- package/dist-sdk/src/entities/agent/to-tf.js +62 -10
- package/dist-sdk/src/entities/agent/tools.d.ts +88 -9
- package/dist-sdk/src/entities/agent/tools.js +46 -7
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +51 -4
- package/dist-sdk/src/entities/agent-tool/from-tf.js +131 -35
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +4 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +103 -17
- package/dist-sdk/src/entities/agent-tool/types.d.ts +5 -4
- package/dist-sdk/src/entities/agent-tool/types.js +38 -6
- package/dist-sdk/src/entities/app/build.d.ts +63 -13
- package/dist-sdk/src/entities/app/build.js +48 -1
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +3 -0
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/app/from-tf.js +32 -15
- package/dist-sdk/src/entities/app/index.d.ts +4 -1
- package/dist-sdk/src/entities/app/index.js +2 -1
- package/dist-sdk/src/entities/app/module.js +9 -2
- package/dist-sdk/src/entities/app/to-tf.d.ts +5 -0
- package/dist-sdk/src/entities/app/to-tf.js +33 -4
- package/dist-sdk/src/entities/automation/build.d.ts +57 -13
- package/dist-sdk/src/entities/automation/build.js +48 -36
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +25 -8
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +16 -1
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +179 -43
- package/dist-sdk/src/entities/automation/filter.d.ts +15 -3
- package/dist-sdk/src/entities/automation/filter.js +12 -2
- package/dist-sdk/src/entities/automation/from-tf.d.ts +26 -27
- package/dist-sdk/src/entities/automation/from-tf.js +1229 -223
- package/dist-sdk/src/entities/automation/index.d.ts +4 -0
- package/dist-sdk/src/entities/automation/index.js +4 -0
- package/dist-sdk/src/entities/automation/module.js +29 -32
- package/dist-sdk/src/entities/automation/operators.d.ts +29 -2
- package/dist-sdk/src/entities/automation/operators.js +27 -1
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +19 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +24 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +10 -21
- package/dist-sdk/src/entities/automation/script-code.js +272 -5
- package/dist-sdk/src/entities/automation/tasks.d.ts +125 -19
- package/dist-sdk/src/entities/automation/tasks.js +83 -15
- package/dist-sdk/src/entities/automation/to-tf.d.ts +10 -29
- package/dist-sdk/src/entities/automation/to-tf.js +1134 -231
- package/dist-sdk/src/entities/automation/triggers.d.ts +9 -1
- package/dist-sdk/src/entities/automation/types.d.ts +29 -4
- package/dist-sdk/src/entities/automation/types.js +76 -46
- package/dist-sdk/src/entities/element/build.d.ts +23 -10
- package/dist-sdk/src/entities/element/build.js +1 -0
- package/dist-sdk/src/entities/element/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/from-tf.js +18 -3
- package/dist-sdk/src/entities/element/index.d.ts +4 -1
- package/dist-sdk/src/entities/element/index.js +2 -1
- package/dist-sdk/src/entities/element/module.js +3 -1
- package/dist-sdk/src/entities/element/to-tf.js +21 -3
- package/dist-sdk/src/entities/field/build.d.ts +56 -13
- package/dist-sdk/src/entities/field/build.js +10 -0
- package/dist-sdk/src/entities/field/calc/runtime.js +4 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +5 -3
- package/dist-sdk/src/entities/field/from-tf.js +118 -7
- package/dist-sdk/src/entities/field/module.js +3 -2
- package/dist-sdk/src/entities/field/to-tf.d.ts +27 -9
- package/dist-sdk/src/entities/field/to-tf.js +62 -17
- package/dist-sdk/src/entities/field/types.d.ts +26 -0
- package/dist-sdk/src/entities/field/types.js +34 -12
- package/dist-sdk/src/entities/file-reader/build.d.ts +108 -50
- package/dist-sdk/src/entities/file-reader/build.js +23 -23
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +6 -0
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +109 -0
- package/dist-sdk/src/entities/file-reader/from-tf.d.ts +13 -0
- package/dist-sdk/src/entities/file-reader/from-tf.js +172 -0
- package/dist-sdk/src/entities/file-reader/index.d.ts +8 -3
- package/dist-sdk/src/entities/file-reader/index.js +7 -2
- package/dist-sdk/src/entities/file-reader/module.d.ts +3 -0
- package/dist-sdk/src/entities/file-reader/module.js +115 -0
- package/dist-sdk/src/entities/file-reader/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/file-reader/to-tf.js +84 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +32 -0
- package/dist-sdk/src/entities/file-reader/types.js +30 -0
- package/dist-sdk/src/entities/org/ai-provider.d.ts +13 -0
- package/dist-sdk/src/entities/org/ai-provider.js +46 -0
- package/dist-sdk/src/entities/org/connector.d.ts +8 -1
- package/dist-sdk/src/entities/org/connector.js +12 -14
- package/dist-sdk/src/entities/org/group.js +10 -1
- package/dist-sdk/src/entities/org/index.d.ts +1 -0
- package/dist-sdk/src/entities/org/index.js +1 -0
- package/dist-sdk/src/entities/org/user.js +10 -1
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +44 -9
- package/dist-sdk/src/entities/shared/filters/types.d.ts +1 -1
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +17 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +31 -0
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -1
- package/dist-sdk/src/entities/shared/types/field-types.js +9 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +19 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +36 -8
- package/dist-sdk/src/entities/skill/from-tf.js +4 -3
- package/dist-sdk/src/entities/skill/index.d.ts +1 -1
- package/dist-sdk/src/entities/skill/module.js +6 -1
- package/dist-sdk/src/entities/skill/to-tf.js +3 -2
- package/dist-sdk/src/entities/skill/tools.d.ts +25 -3
- package/dist-sdk/src/entities/skill/tools.js +17 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +15 -2
- package/dist-sdk/src/entities/skill-tool/from-tf.js +32 -11
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +32 -9
- package/dist-sdk/src/entities/view/from-tf.d.ts +6 -2
- package/dist-sdk/src/entities/view/from-tf.js +11 -9
- package/dist-sdk/src/entities/view/to-tf.d.ts +9 -7
- package/dist-sdk/src/entities/view/to-tf.js +33 -18
- package/dist-sdk/src/entities/view/types.d.ts +1 -1
- package/dist-sdk/src/entities/view/types.js +1 -1
- package/dist-sdk/src/graph/deferred-catalog-render.d.ts +0 -5
- package/dist-sdk/src/graph/deferred-catalog-render.js +1 -20
- package/dist-sdk/src/graph/index.d.ts +8 -0
- package/dist-sdk/src/graph/index.js +13 -9
- package/dist-sdk/src/graph/modules.js +6 -1
- package/dist-sdk/src/graph/types.d.ts +77 -3
- package/package.json +42 -14
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +0 -76
- package/dist-sdk/src/entities/automation/value-ref-tf.js +0 -190
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/** The file-reader entity's registry entry (see src/graph/). */
|
|
2
|
+
import { safeCatalogKey } from "../../catalog/render-helpers.js";
|
|
3
|
+
import { NO_CANVAS, } from "../../graph/types.js";
|
|
4
|
+
import { NO_DATA } from "../../graph/types.js";
|
|
5
|
+
import { printFileReader } from "./deserializer/print-file-reader.js";
|
|
6
|
+
import { fileReaderFromTf } from "./from-tf.js";
|
|
7
|
+
import { fileReaderToTf } from "./to-tf.js";
|
|
8
|
+
import { ALL_FILE_READER_RESOURCE_TYPES, FILE_READER_SUB_TYPES } from "./types.js";
|
|
9
|
+
function isConfigured(value) {
|
|
10
|
+
return (typeof value === "object" &&
|
|
11
|
+
value !== null &&
|
|
12
|
+
typeof value.ref === "function" &&
|
|
13
|
+
typeof value.def === "function");
|
|
14
|
+
}
|
|
15
|
+
function fileReaderStubRef(refName, parent) {
|
|
16
|
+
return { __kind: "documentModel", refName, name: refName, parent, readerType: "text" };
|
|
17
|
+
}
|
|
18
|
+
/** Top-level field names a file reader's payload exposes for downstream reference. */
|
|
19
|
+
function topLevelFieldNames(payload) {
|
|
20
|
+
if (payload.type === "excel")
|
|
21
|
+
return payload.fields.map((f) => f.name);
|
|
22
|
+
if (payload.type === "json")
|
|
23
|
+
return payload.structure.map((f) => f.name);
|
|
24
|
+
if (payload.type === "ai")
|
|
25
|
+
return payload.fields.map((f) => f.name);
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
function fileReaderRefFromAuthoring(args) {
|
|
29
|
+
const { refName, parent, defaultExport } = args;
|
|
30
|
+
if (!isConfigured(defaultExport))
|
|
31
|
+
return undefined;
|
|
32
|
+
const catalogRef = defaultExport.ref(refName);
|
|
33
|
+
if (catalogRef.__kind !== "documentModel")
|
|
34
|
+
return undefined;
|
|
35
|
+
const entity = defaultExport.def(refName);
|
|
36
|
+
const payload = entity.payload;
|
|
37
|
+
const fieldNames = topLevelFieldNames(payload);
|
|
38
|
+
const fields = Object.fromEntries(fieldNames.map((name) => [name, { __kind: "documentModelField", refName: name, name, parent: refName }]));
|
|
39
|
+
return {
|
|
40
|
+
...catalogRef,
|
|
41
|
+
parent,
|
|
42
|
+
...(fieldNames.length > 0 ? { fields } : {}),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function renderFileReaderEntry(args) {
|
|
46
|
+
const ref = args.ref;
|
|
47
|
+
const fieldKeys = Object.keys(ref.fields ?? {}).sort();
|
|
48
|
+
const head = `${args.baseIndent}${safeCatalogKey(args.keyName)}: documentModelRef({ name: ${JSON.stringify(ref.name)}, readerType: ${JSON.stringify(ref.readerType)}`;
|
|
49
|
+
if (fieldKeys.length === 0)
|
|
50
|
+
return { lines: [`${head} }),`] };
|
|
51
|
+
const lines = [`${head},`, `${args.baseIndent} fields: {`];
|
|
52
|
+
for (const key of fieldKeys) {
|
|
53
|
+
const field = ref.fields[key];
|
|
54
|
+
lines.push(`${args.baseIndent} ${safeCatalogKey(key)}: documentModelFieldRef({ name: ${JSON.stringify(field.name)}, parent: ${JSON.stringify(field.parent ?? "")} }),`);
|
|
55
|
+
}
|
|
56
|
+
lines.push(`${args.baseIndent} },`, `${args.baseIndent}}),`);
|
|
57
|
+
return { lines, extraFactories: ["documentModelFieldRef"] };
|
|
58
|
+
}
|
|
59
|
+
function extractFileReaders(ownBlocks, _stream, ctx) {
|
|
60
|
+
const items = [];
|
|
61
|
+
const skipped = [];
|
|
62
|
+
const diagnostics = [];
|
|
63
|
+
for (const block of ownBlocks) {
|
|
64
|
+
if (!ALL_FILE_READER_RESOURCE_TYPES.includes(block.type ?? ""))
|
|
65
|
+
continue;
|
|
66
|
+
try {
|
|
67
|
+
const { fileReader, skippedReason } = fileReaderFromTf(block, ctx.appTfLabel, ctx);
|
|
68
|
+
if (fileReader !== undefined)
|
|
69
|
+
items.push(fileReader);
|
|
70
|
+
else if (skippedReason !== undefined)
|
|
71
|
+
skipped.push(skippedReason);
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
diagnostics.push(err instanceof Error ? err.message : String(err));
|
|
75
|
+
skipped.push(`${block.type}.${block.label ?? ""}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return { items, skipped, diagnostics };
|
|
79
|
+
}
|
|
80
|
+
export const fileReaderModule = {
|
|
81
|
+
kind: "file-reader",
|
|
82
|
+
stream: { role: "streamMember" },
|
|
83
|
+
authoring: { unit: "ownFile", bag: "fileReaders" },
|
|
84
|
+
parents: [{ parent: "app", child: "file-reader" }],
|
|
85
|
+
resource: {
|
|
86
|
+
shape: "subTypes",
|
|
87
|
+
rows: FILE_READER_SUB_TYPES.map((t) => ({
|
|
88
|
+
key: t.typeKey,
|
|
89
|
+
resourceType: t.resourceType,
|
|
90
|
+
implemented: t.implemented === true,
|
|
91
|
+
})),
|
|
92
|
+
},
|
|
93
|
+
data: NO_DATA,
|
|
94
|
+
lifecycle: {
|
|
95
|
+
participates: true,
|
|
96
|
+
extractOwnFile: extractFileReaders,
|
|
97
|
+
printOwnFile: (item, opts) => {
|
|
98
|
+
const fileReader = item;
|
|
99
|
+
return { refName: fileReader.refName, source: printFileReader(fileReader, { parent: opts.appRefName }) };
|
|
100
|
+
},
|
|
101
|
+
toTf: (entity, ctx) => fileReaderToTf(entity, { appTfLabel: ctx.appTfLabel }),
|
|
102
|
+
},
|
|
103
|
+
canvas: NO_CANVAS,
|
|
104
|
+
catalog: {
|
|
105
|
+
participates: true,
|
|
106
|
+
refKind: "documentModel",
|
|
107
|
+
catalogBag: "fileReaders",
|
|
108
|
+
renderOrder: 55,
|
|
109
|
+
catalogRoot: "app",
|
|
110
|
+
factoryName: "documentModelRef",
|
|
111
|
+
renderEntry: renderFileReaderEntry,
|
|
112
|
+
stubRef: fileReaderStubRef,
|
|
113
|
+
refFromAuthoring: fileReaderRefFromAuthoring,
|
|
114
|
+
},
|
|
115
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `DeployableEntity` (kind "documentModel", built by `defineFileReader`) →
|
|
3
|
+
* one `elementum_<excel|json|text>_file_reader` resource block. Mirrors
|
|
4
|
+
* `skill/to-tf.ts`'s shape for a single-resource own-file kind.
|
|
5
|
+
*/
|
|
6
|
+
import { type DeployableEntity } from "../../engine/entity.js";
|
|
7
|
+
import { type TfBlock } from "../../engine/tf/index.js";
|
|
8
|
+
export interface FileReaderToTfContext {
|
|
9
|
+
readonly appTfLabel: string;
|
|
10
|
+
}
|
|
11
|
+
export interface FileReaderToTfResult {
|
|
12
|
+
readonly blocks: readonly TfBlock[];
|
|
13
|
+
}
|
|
14
|
+
export declare function fileReaderToTf(entity: DeployableEntity, ctx: FileReaderToTfContext): FileReaderToTfResult;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `DeployableEntity` (kind "documentModel", built by `defineFileReader`) →
|
|
3
|
+
* one `elementum_<excel|json|text>_file_reader` resource block. Mirrors
|
|
4
|
+
* `skill/to-tf.ts`'s shape for a single-resource own-file kind.
|
|
5
|
+
*/
|
|
6
|
+
import { EntityTfError } from "../../engine/entity.js";
|
|
7
|
+
import { appScopedResourceLabel, expr, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
8
|
+
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
9
|
+
import { FILE_READER_SUB_TYPE_BY_TYPE_KEY } from "./types.js";
|
|
10
|
+
function serializeStructureField(f) {
|
|
11
|
+
switch (f.type) {
|
|
12
|
+
case "text":
|
|
13
|
+
return { text: { name: f.name } };
|
|
14
|
+
case "number":
|
|
15
|
+
return { number: { name: f.name } };
|
|
16
|
+
case "decimal":
|
|
17
|
+
return { decimal: { name: f.name } };
|
|
18
|
+
case "boolean":
|
|
19
|
+
return { bool: { name: f.name } };
|
|
20
|
+
case "date":
|
|
21
|
+
return { date: { name: f.name, format: f.format } };
|
|
22
|
+
case "datetime":
|
|
23
|
+
return { datetime: { name: f.name, format: f.format } };
|
|
24
|
+
case "object":
|
|
25
|
+
return { object: { name: f.name, properties: f.properties.map(serializeStructureField) } };
|
|
26
|
+
case "array":
|
|
27
|
+
return { array: { name: f.name, arrayType: serializeStructureField(f.itemType) } };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function aiFieldToTf(f) {
|
|
31
|
+
return {
|
|
32
|
+
name: f.name,
|
|
33
|
+
description: f.description,
|
|
34
|
+
type: f.type,
|
|
35
|
+
...(f.required !== undefined ? { required: f.required } : {}),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function excelFieldToTf(f) {
|
|
39
|
+
const location = f.location;
|
|
40
|
+
return {
|
|
41
|
+
name: f.name,
|
|
42
|
+
type: f.type,
|
|
43
|
+
location: { sheet: location.sheet, row: location.row, column: location.column },
|
|
44
|
+
...(f.include !== undefined ? { include: f.include } : {}),
|
|
45
|
+
...(f.required !== undefined ? { required: f.required } : {}),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
export function fileReaderToTf(entity, ctx) {
|
|
49
|
+
if (entity.kind !== "documentModel") {
|
|
50
|
+
throw new EntityTfError(`fileReaderToTf expects kind "documentModel"; got "${entity.kind}" (refName "${entity.refName}")`);
|
|
51
|
+
}
|
|
52
|
+
const payload = entity.payload;
|
|
53
|
+
if (payload === null || typeof payload !== "object") {
|
|
54
|
+
throw new EntityTfError(`file reader "${entity.refName}" has no payload — was it built with defineFileReader?`);
|
|
55
|
+
}
|
|
56
|
+
const subType = FILE_READER_SUB_TYPE_BY_TYPE_KEY.get(payload.type);
|
|
57
|
+
if (subType === undefined || subType.implemented !== true) {
|
|
58
|
+
throw new EntityTfError(`file reader "${entity.refName}": type "${payload.type}" does not build on the terraform path yet`);
|
|
59
|
+
}
|
|
60
|
+
const tfLabel = appScopedResourceLabel(ctx.appTfLabel, tsLabelToTfLabel(entity.refName));
|
|
61
|
+
const attrs = {
|
|
62
|
+
app_id: expr.resourceAttr(APP_RESOURCE_TYPE, ctx.appTfLabel, ["id"]),
|
|
63
|
+
name: payload.name,
|
|
64
|
+
};
|
|
65
|
+
if (payload.type === "excel") {
|
|
66
|
+
attrs.first_row_is_header = payload.firstRowIsHeader;
|
|
67
|
+
attrs.fields = payload.fields.map(excelFieldToTf);
|
|
68
|
+
if (payload.documentContent !== undefined)
|
|
69
|
+
attrs.document_content = payload.documentContent;
|
|
70
|
+
if (payload.documentName !== undefined)
|
|
71
|
+
attrs.document_name = payload.documentName;
|
|
72
|
+
if (payload.fileType !== undefined)
|
|
73
|
+
attrs.file_type = payload.fileType;
|
|
74
|
+
}
|
|
75
|
+
else if (payload.type === "json") {
|
|
76
|
+
attrs.structure = expr.jsonencode({ properties: payload.structure.map(serializeStructureField) });
|
|
77
|
+
}
|
|
78
|
+
else if (payload.type === "ai") {
|
|
79
|
+
attrs.instructions = payload.instructions;
|
|
80
|
+
attrs.fields = payload.fields.map(aiFieldToTf);
|
|
81
|
+
}
|
|
82
|
+
// text: name only, already set above.
|
|
83
|
+
return { blocks: [{ kind: "resource", type: subType.resourceType, label: tfLabel, attrs }] };
|
|
84
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The file-reader entity's sub-type table. Five platform resource types share
|
|
3
|
+
* one ownership shape (app-scoped, own-file, one `.ts` per instance):
|
|
4
|
+
* `elementum_excel_file_reader`, `elementum_json_file_reader`,
|
|
5
|
+
* `elementum_text_file_reader`, `elementum_xml_file_reader`, and
|
|
6
|
+
* `elementum_ai_file_reader` — exactly the `entities/field/types.ts` /
|
|
7
|
+
* `entities/agent-tool/types.ts` pattern, one ROW per sub-type.
|
|
8
|
+
*
|
|
9
|
+
* excel/json/text/ai are implemented. excel/json/text are the three
|
|
10
|
+
* `elementum_file_reader_task.file_reader_id` accepts (the provider's own
|
|
11
|
+
* schema docs say so explicitly); `ai` backs `elementum_ai_file_read_task`
|
|
12
|
+
* instead (see `entities/automation/types.ts`'s `aiFileAnalysis` row) — a
|
|
13
|
+
* live capture also confirms a plain `elementum_file_reader_task` can
|
|
14
|
+
* reference one. `xml` is declared so streams REPORT it by name (plan §6)
|
|
15
|
+
* instead of "unknown resource" — it has no confirmed live capture yet —
|
|
16
|
+
* and adoption scopes ONLY the implemented ones.
|
|
17
|
+
*/
|
|
18
|
+
export interface FileReaderSubType {
|
|
19
|
+
/** The authoring `type` discriminant (`FileReaderOptions.type`). */
|
|
20
|
+
readonly typeKey: "excel" | "json" | "text" | "xml" | "ai";
|
|
21
|
+
/** Terraform resource type, e.g. "elementum_excel_file_reader". */
|
|
22
|
+
readonly resourceType: string;
|
|
23
|
+
/** Round-trips on the terraform path (to-tf + from-tf + printer). */
|
|
24
|
+
readonly implemented?: true;
|
|
25
|
+
}
|
|
26
|
+
export declare const FILE_READER_SUB_TYPES: readonly FileReaderSubType[];
|
|
27
|
+
export declare const FILE_READER_SUB_TYPE_BY_TYPE_KEY: ReadonlyMap<string, FileReaderSubType>;
|
|
28
|
+
export declare const FILE_READER_SUB_TYPE_BY_RESOURCE: ReadonlyMap<string, FileReaderSubType>;
|
|
29
|
+
/** The resource types the terraform path round-trips today (adoption scope). */
|
|
30
|
+
export declare const IMPLEMENTED_FILE_READER_RESOURCE_TYPES: readonly string[];
|
|
31
|
+
/** Every declared file-reader resource type — stream partition recognizes these by name. */
|
|
32
|
+
export declare const ALL_FILE_READER_RESOURCE_TYPES: readonly string[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The file-reader entity's sub-type table. Five platform resource types share
|
|
3
|
+
* one ownership shape (app-scoped, own-file, one `.ts` per instance):
|
|
4
|
+
* `elementum_excel_file_reader`, `elementum_json_file_reader`,
|
|
5
|
+
* `elementum_text_file_reader`, `elementum_xml_file_reader`, and
|
|
6
|
+
* `elementum_ai_file_reader` — exactly the `entities/field/types.ts` /
|
|
7
|
+
* `entities/agent-tool/types.ts` pattern, one ROW per sub-type.
|
|
8
|
+
*
|
|
9
|
+
* excel/json/text/ai are implemented. excel/json/text are the three
|
|
10
|
+
* `elementum_file_reader_task.file_reader_id` accepts (the provider's own
|
|
11
|
+
* schema docs say so explicitly); `ai` backs `elementum_ai_file_read_task`
|
|
12
|
+
* instead (see `entities/automation/types.ts`'s `aiFileAnalysis` row) — a
|
|
13
|
+
* live capture also confirms a plain `elementum_file_reader_task` can
|
|
14
|
+
* reference one. `xml` is declared so streams REPORT it by name (plan §6)
|
|
15
|
+
* instead of "unknown resource" — it has no confirmed live capture yet —
|
|
16
|
+
* and adoption scopes ONLY the implemented ones.
|
|
17
|
+
*/
|
|
18
|
+
export const FILE_READER_SUB_TYPES = [
|
|
19
|
+
{ typeKey: "excel", resourceType: "elementum_excel_file_reader", implemented: true },
|
|
20
|
+
{ typeKey: "json", resourceType: "elementum_json_file_reader", implemented: true },
|
|
21
|
+
{ typeKey: "text", resourceType: "elementum_text_file_reader", implemented: true },
|
|
22
|
+
{ typeKey: "xml", resourceType: "elementum_xml_file_reader" },
|
|
23
|
+
{ typeKey: "ai", resourceType: "elementum_ai_file_reader", implemented: true },
|
|
24
|
+
];
|
|
25
|
+
export const FILE_READER_SUB_TYPE_BY_TYPE_KEY = new Map(FILE_READER_SUB_TYPES.map((t) => [t.typeKey, t]));
|
|
26
|
+
export const FILE_READER_SUB_TYPE_BY_RESOURCE = new Map(FILE_READER_SUB_TYPES.map((t) => [t.resourceType, t]));
|
|
27
|
+
/** The resource types the terraform path round-trips today (adoption scope). */
|
|
28
|
+
export const IMPLEMENTED_FILE_READER_RESOURCE_TYPES = FILE_READER_SUB_TYPES.filter((t) => t.implemented === true).map((t) => t.resourceType);
|
|
29
|
+
/** Every declared file-reader resource type — stream partition recognizes these by name. */
|
|
30
|
+
export const ALL_FILE_READER_RESOURCE_TYPES = FILE_READER_SUB_TYPES.map((t) => t.resourceType);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI providers: org-owned reference identities, name-keyed lookups — never
|
|
3
|
+
* authored/created (they hold credentials, manually configured on the
|
|
4
|
+
* platform; src/CLAUDE.md), only referenced. One kind per AiProviderType
|
|
5
|
+
* (Anthropic, Bedrock, ..., matching the 10 distinct `elementum_<type>_
|
|
6
|
+
* ai_provider` terraform data sources) sharing the single "aiProviders" org
|
|
7
|
+
* bag — `pull org`/`catalog/org.ts` treat that bag's entries uniformly
|
|
8
|
+
* regardless of which of the 10 kinds produced them.
|
|
9
|
+
*/
|
|
10
|
+
import { type EntityKindModule } from "../../graph/types.js";
|
|
11
|
+
/** org.ts / OrgRefLookup bag — keep in lockstep with `data.orgBag`. */
|
|
12
|
+
export declare const AI_PROVIDER_ORG_BAG: "aiProviders";
|
|
13
|
+
export declare const aiProviderModules: readonly EntityKindModule[];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI providers: org-owned reference identities, name-keyed lookups — never
|
|
3
|
+
* authored/created (they hold credentials, manually configured on the
|
|
4
|
+
* platform; src/CLAUDE.md), only referenced. One kind per AiProviderType
|
|
5
|
+
* (Anthropic, Bedrock, ..., matching the 10 distinct `elementum_<type>_
|
|
6
|
+
* ai_provider` terraform data sources) sharing the single "aiProviders" org
|
|
7
|
+
* bag — `pull org`/`catalog/org.ts` treat that bag's entries uniformly
|
|
8
|
+
* regardless of which of the 10 kinds produced them.
|
|
9
|
+
*/
|
|
10
|
+
import { NO_CATALOG, NO_LIFECYCLE } from "../../graph/types.js";
|
|
11
|
+
/** org.ts / OrgRefLookup bag — keep in lockstep with `data.orgBag`. */
|
|
12
|
+
export const AI_PROVIDER_ORG_BAG = "aiProviders";
|
|
13
|
+
const AI_PROVIDER_TYPES = [
|
|
14
|
+
{ kind: "ai-provider-anthropic", resourceType: "elementum_anthropic_ai_provider", label: "Anthropic" },
|
|
15
|
+
{ kind: "ai-provider-bedrock", resourceType: "elementum_bedrock_ai_provider", label: "Bedrock" },
|
|
16
|
+
{ kind: "ai-provider-custom", resourceType: "elementum_custom_ai_provider", label: "Custom" },
|
|
17
|
+
{ kind: "ai-provider-deepgram", resourceType: "elementum_deepgram_ai_provider", label: "Deepgram" },
|
|
18
|
+
{ kind: "ai-provider-elevenlab", resourceType: "elementum_elevenlab_ai_provider", label: "ElevenLab" },
|
|
19
|
+
{ kind: "ai-provider-gemini", resourceType: "elementum_gemini_ai_provider", label: "Gemini" },
|
|
20
|
+
{ kind: "ai-provider-openai", resourceType: "elementum_openai_ai_provider", label: "OpenAI" },
|
|
21
|
+
{ kind: "ai-provider-snowflake", resourceType: "elementum_snowflake_ai_provider", label: "Snowflake" },
|
|
22
|
+
{ kind: "ai-provider-xai", resourceType: "elementum_xai_ai_provider", label: "xAI" },
|
|
23
|
+
{ kind: "ai-provider-managed", resourceType: "elementum_managed_ai_provider", label: "Elementum Managed" },
|
|
24
|
+
];
|
|
25
|
+
export const aiProviderModules = AI_PROVIDER_TYPES.map(({ kind, resourceType, label }) => ({
|
|
26
|
+
kind,
|
|
27
|
+
stream: { role: "orgExport" },
|
|
28
|
+
data: {
|
|
29
|
+
participates: true,
|
|
30
|
+
lookupAttr: "name",
|
|
31
|
+
catalogKind: "aiProvider",
|
|
32
|
+
orgBag: AI_PROVIDER_ORG_BAG,
|
|
33
|
+
// Connectors reference their provider (`provider_id`), so build emits
|
|
34
|
+
// this data source and the build-vs-export scopes it.
|
|
35
|
+
referencedByBuild: true,
|
|
36
|
+
},
|
|
37
|
+
authoring: { unit: "none" },
|
|
38
|
+
parents: [{ parent: "org", child: kind }],
|
|
39
|
+
resource: { shape: "single", resourceType, adoptable: false },
|
|
40
|
+
lifecycle: NO_LIFECYCLE,
|
|
41
|
+
canvas: { participates: true, label: `AI Providers (${label})`, glyph: "◆", component: "orgIdentity" },
|
|
42
|
+
// Rendered specially in src/catalog/org.ts (nested with each provider's
|
|
43
|
+
// connectors under `aiProviders.<provider>.models.<model>`), not through
|
|
44
|
+
// the generic per-bag catalog renderer.
|
|
45
|
+
catalog: NO_CATALOG,
|
|
46
|
+
}));
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* AI provider connectors: org-owned reference identities, model_name-keyed
|
|
3
|
+
* lookups. Never their own top-level catalog bag — nested under their
|
|
4
|
+
* owning provider instead (`catalog.aiProviders.<provider>.models.<model>`,
|
|
5
|
+
* rendered specially in `src/catalog/org.ts`), since a connector's
|
|
6
|
+
* `provider_id` is a real reference to one of the 10 `elementum_<type>_
|
|
7
|
+
* ai_provider` blocks (entities/org/ai-provider.ts), not a plain string.
|
|
8
|
+
*/
|
|
2
9
|
import { type EntityKindModule } from "../../graph/types.js";
|
|
3
10
|
/** org.ts / OrgRefLookup bag — keep in lockstep with `data.orgBag`. */
|
|
4
11
|
export declare const CONNECTOR_ORG_BAG: "connectors";
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* AI provider connectors: org-owned reference identities, model_name-keyed
|
|
3
|
+
* lookups. Never their own top-level catalog bag — nested under their
|
|
4
|
+
* owning provider instead (`catalog.aiProviders.<provider>.models.<model>`,
|
|
5
|
+
* rendered specially in `src/catalog/org.ts`), since a connector's
|
|
6
|
+
* `provider_id` is a real reference to one of the 10 `elementum_<type>_
|
|
7
|
+
* ai_provider` blocks (entities/org/ai-provider.ts), not a plain string.
|
|
8
|
+
*/
|
|
9
|
+
import { NO_CATALOG, NO_LIFECYCLE } from "../../graph/types.js";
|
|
4
10
|
/** org.ts / OrgRefLookup bag — keep in lockstep with `data.orgBag`. */
|
|
5
11
|
export const CONNECTOR_ORG_BAG = "connectors";
|
|
6
12
|
export const connectorModule = {
|
|
@@ -9,6 +15,7 @@ export const connectorModule = {
|
|
|
9
15
|
data: {
|
|
10
16
|
participates: true,
|
|
11
17
|
lookupAttr: "model_name",
|
|
18
|
+
providerRefAttr: "provider_id",
|
|
12
19
|
catalogKind: "connector",
|
|
13
20
|
orgBag: CONNECTOR_ORG_BAG,
|
|
14
21
|
// Agents pin connectors (`ai_provider_connector_id`), so build emits this
|
|
@@ -23,15 +30,6 @@ export const connectorModule = {
|
|
|
23
30
|
adoptable: false,
|
|
24
31
|
},
|
|
25
32
|
lifecycle: NO_LIFECYCLE,
|
|
26
|
-
canvas: { participates: true, label: "Connectors", glyph: "⚡", component: "orgIdentity" },
|
|
27
|
-
catalog:
|
|
28
|
-
participates: true,
|
|
29
|
-
refKind: "connector",
|
|
30
|
-
catalogBag: "connectors",
|
|
31
|
-
renderOrder: 90,
|
|
32
|
-
catalogRoot: "org",
|
|
33
|
-
renderEntry: namedOnlyFactoryEntry("connectorRef"),
|
|
34
|
-
stubRef: (refName) => ({ __kind: "connector", refName, name: refName }),
|
|
35
|
-
refFromAuthoring: () => undefined,
|
|
36
|
-
},
|
|
33
|
+
canvas: { participates: true, label: "AI Provider Connectors", glyph: "⚡", component: "orgIdentity" },
|
|
34
|
+
catalog: NO_CATALOG,
|
|
37
35
|
};
|
|
@@ -11,7 +11,16 @@ export const groupModule = {
|
|
|
11
11
|
lookupAttr: "name",
|
|
12
12
|
catalogKind: "group",
|
|
13
13
|
orgBag: GROUP_ORG_BAG,
|
|
14
|
-
|
|
14
|
+
// A GROUP field's `default_value` (entities/field/types.ts's
|
|
15
|
+
// OrgFieldRefValue) and an access policy's `group_ids` (board issue #69)
|
|
16
|
+
// both round-trip as `data.elementum_group` lookups via the generic
|
|
17
|
+
// `rawLookup` mechanism — real, tested coverage, so this participates in
|
|
18
|
+
// the byte-fidelity roundtrip scope. A captured `elementum_group` data
|
|
19
|
+
// block for any OTHER reason still fails loud (missing from build
|
|
20
|
+
// output) rather than silently passing — surfacing gaps instead of
|
|
21
|
+
// hiding them was the tradeoff of leaving this false; if that surfaces a
|
|
22
|
+
// real one, extend the reproducing path rather than reverting this flag.
|
|
23
|
+
referencedByBuild: true,
|
|
15
24
|
},
|
|
16
25
|
authoring: { unit: "none" },
|
|
17
26
|
parents: [{ parent: "org", child: "group" }],
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Org identity / data-facet kinds. Each file exports an EntityKindModule;
|
|
3
3
|
* assembly into KIND_MODULES lives in src/graph/modules.ts.
|
|
4
4
|
*/
|
|
5
|
+
export { aiProviderModules } from "./ai-provider.js";
|
|
5
6
|
export { categoryModule } from "./category.js";
|
|
6
7
|
export { cloudLinkModule } from "./cloud-link.js";
|
|
7
8
|
export { connectorModule } from "./connector.js";
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Org identity / data-facet kinds. Each file exports an EntityKindModule;
|
|
3
3
|
* assembly into KIND_MODULES lives in src/graph/modules.ts.
|
|
4
4
|
*/
|
|
5
|
+
export { aiProviderModules } from "./ai-provider.js";
|
|
5
6
|
export { categoryModule } from "./category.js";
|
|
6
7
|
export { cloudLinkModule } from "./cloud-link.js";
|
|
7
8
|
export { connectorModule } from "./connector.js";
|
|
@@ -10,7 +10,16 @@ export const userModule = {
|
|
|
10
10
|
data: {
|
|
11
11
|
participates: true,
|
|
12
12
|
lookupAttr: "email",
|
|
13
|
-
|
|
13
|
+
// A USER field's `default_value` (entities/field/types.ts's
|
|
14
|
+
// OrgFieldRefValue) and an access policy's `user_ids` (board issue #69)
|
|
15
|
+
// both round-trip as `data.elementum_user` lookups via the generic
|
|
16
|
+
// `rawLookup` mechanism — real, tested coverage, so this participates in
|
|
17
|
+
// the byte-fidelity roundtrip scope. A captured `elementum_user` data
|
|
18
|
+
// block for any OTHER reason still fails loud (missing from build
|
|
19
|
+
// output) rather than silently passing — surfacing gaps instead of
|
|
20
|
+
// hiding them was the tradeoff of leaving this false; if that surfaces a
|
|
21
|
+
// real one, extend the reproducing path rather than reverting this flag.
|
|
22
|
+
referencedByBuild: true,
|
|
14
23
|
},
|
|
15
24
|
authoring: { unit: "none" },
|
|
16
25
|
parents: [{ parent: "org", child: "user" }],
|
|
@@ -33,10 +33,16 @@
|
|
|
33
33
|
* filters, for instance, only produce `literal`, `field`, `app`, and
|
|
34
34
|
* `unresolved`).
|
|
35
35
|
*/
|
|
36
|
+
import type { LikeMode } from "./types.js";
|
|
37
|
+
import type { UserFieldKey } from "../../../catalog/types.js";
|
|
36
38
|
/** Reference to an app: `<appHandle>`. */
|
|
37
39
|
export interface AppRefAst {
|
|
38
40
|
readonly kind: "app";
|
|
39
41
|
readonly appHandle: string;
|
|
42
|
+
/** Present for a foreign data lookup that is not in the local catalog. */
|
|
43
|
+
readonly entityType?: "app" | "element";
|
|
44
|
+
/** Provider lookup name for that foreign app/element. */
|
|
45
|
+
readonly name?: string;
|
|
40
46
|
}
|
|
41
47
|
/** Reference to an app field: `<appHandle>.fields.<fieldKey>`. */
|
|
42
48
|
export interface FieldRefAst {
|
|
@@ -44,6 +50,11 @@ export interface FieldRefAst {
|
|
|
44
50
|
readonly appHandle: string;
|
|
45
51
|
readonly fieldKey: string;
|
|
46
52
|
}
|
|
53
|
+
/** Reference to a fixed platform user-directory attribute. */
|
|
54
|
+
export interface UserFieldRefAst {
|
|
55
|
+
readonly kind: "userField";
|
|
56
|
+
readonly fieldKey: UserFieldKey;
|
|
57
|
+
}
|
|
47
58
|
/** Reference to an app's search table: `<appHandle>.searchTables.<tableKey>`. */
|
|
48
59
|
export interface SearchTableRefAst {
|
|
49
60
|
readonly kind: "searchTable";
|
|
@@ -82,21 +93,38 @@ export interface ApprovalChainRefAst {
|
|
|
82
93
|
readonly kind: "approvalChain";
|
|
83
94
|
readonly appHandle: string;
|
|
84
95
|
readonly approvalChainKey: string;
|
|
96
|
+
/** Imported provider id used when EDK does not emit the approval process. */
|
|
97
|
+
readonly unresolvedId?: string;
|
|
85
98
|
}
|
|
86
99
|
/**
|
|
87
|
-
* Reference to an org-level AI provider connector
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
* key (e.g. `bedrockSonnet`)
|
|
93
|
-
*
|
|
100
|
+
* Reference to an org-level AI provider connector, nested under its owning
|
|
101
|
+
* provider (`catalog.aiProviders.<provider>.models.<model>`) — connectors
|
|
102
|
+
* aren't app-owned, so there's no `appHandle`. `id` is the wire connector id,
|
|
103
|
+
* carried even when resolved so the printer can fall back to an id-only TODO
|
|
104
|
+
* literal on a catalog miss; `name` is set only when the connector catalog
|
|
105
|
+
* resolved a display name. `handle` is the model key (e.g. `bedrockSonnet`)
|
|
106
|
+
* resolved via the connector catalog — when present, the printer emits it
|
|
107
|
+
* directly rather than re-deriving a handle from `name`. `providerKey` is the
|
|
108
|
+
* owning AI provider's key, resolved from the connector's `provider_id`
|
|
109
|
+
* reference; when unset (the provider couldn't be resolved), the printer
|
|
110
|
+
* falls back to a TODO placeholder rather than a flat `catalog.connectors`
|
|
111
|
+
* lookup, which no longer exists on the catalog barrel.
|
|
94
112
|
*/
|
|
95
113
|
export interface ConnectorRefAst {
|
|
96
114
|
readonly kind: "connector";
|
|
97
115
|
readonly id: string;
|
|
98
116
|
readonly name?: string;
|
|
99
117
|
readonly handle?: string;
|
|
118
|
+
readonly providerKey?: string;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Reference to an org-level cloud link (`catalog.cloudLinks.<handle>`) —
|
|
122
|
+
* flat, no provider nesting like a connector, and org-owned (no appHandle).
|
|
123
|
+
*/
|
|
124
|
+
export interface CloudLinkRefAst {
|
|
125
|
+
readonly kind: "cloudLink";
|
|
126
|
+
readonly handle: string;
|
|
127
|
+
readonly name?: string;
|
|
100
128
|
}
|
|
101
129
|
/**
|
|
102
130
|
* Placeholder for an identifier (uuid or clientHandle) the catalog couldn't
|
|
@@ -155,7 +183,13 @@ export type RefExpr =
|
|
|
155
183
|
| {
|
|
156
184
|
kind: "template";
|
|
157
185
|
parts: readonly (string | RefExpr)[];
|
|
158
|
-
} | FieldRefAst | AppRefAst | AgentRefAst | AutomationRefAst | DocumentModelRefAst | DocumentModelFieldRefAst | ApprovalChainRefAst | ConnectorRefAst | UnresolvedRefAst
|
|
186
|
+
} | FieldRefAst | UserFieldRefAst | AppRefAst | AgentRefAst | AutomationRefAst | DocumentModelRefAst | DocumentModelFieldRefAst | ApprovalChainRefAst | ConnectorRefAst | CloudLinkRefAst | UnresolvedRefAst
|
|
187
|
+
/** Preserved terraform local expression for round-trip (e.g. status option ids by label). */
|
|
188
|
+
| {
|
|
189
|
+
kind: "localRef";
|
|
190
|
+
readonly localName: string;
|
|
191
|
+
readonly path: readonly import("../../../engine/tf/model.js").PathSeg[];
|
|
192
|
+
};
|
|
159
193
|
export type FilterValueAst = {
|
|
160
194
|
kind: "text";
|
|
161
195
|
value: string;
|
|
@@ -178,6 +212,7 @@ export type FilterValueAst = {
|
|
|
178
212
|
kind: "null";
|
|
179
213
|
} | {
|
|
180
214
|
kind: "currentUser";
|
|
215
|
+
currentUserType: "id" | "email" | "domain";
|
|
181
216
|
}
|
|
182
217
|
/** A reference value — wraps a RefExpr for the printer to render. */
|
|
183
218
|
| {
|
|
@@ -196,7 +231,7 @@ export type FilterAst = {
|
|
|
196
231
|
right: FilterValueAst | RefExpr;
|
|
197
232
|
not?: boolean;
|
|
198
233
|
caseInsensitive?: boolean;
|
|
199
|
-
mode?:
|
|
234
|
+
mode?: LikeMode;
|
|
200
235
|
} | {
|
|
201
236
|
kind: "in";
|
|
202
237
|
left: RefExpr;
|
|
@@ -63,7 +63,7 @@ export type FilterValue = {
|
|
|
63
63
|
realType: ValueType;
|
|
64
64
|
value: FilterReference;
|
|
65
65
|
};
|
|
66
|
-
export type LikeMode = "
|
|
66
|
+
export type LikeMode = "starts_with" | "ends_with" | "contains" | "legacy";
|
|
67
67
|
export interface EqualsFilter {
|
|
68
68
|
type: "EQUALS";
|
|
69
69
|
field?: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A tool's `field_id` value → the TARGET aspect's field bag key. Shared by
|
|
3
|
+
* `agent-tool`/`skill-tool` from-tf (neither owns the other, so this lives in
|
|
4
|
+
* the cross-entity commons rather than either module). Two shapes: a
|
|
5
|
+
* `resource-attr` to the field's own resource (custom fields, which have a
|
|
6
|
+
* dedicated `elementum_<type>_field` block), or a `local.<aspect>_<key>_
|
|
7
|
+
* field_id` reference (system fields - title/status/closedBy/…, which have
|
|
8
|
+
* no resource of their own). Same recognition `automation/from-tf.ts`'s
|
|
9
|
+
* `decodeValue` already does for record-path field refs.
|
|
10
|
+
*
|
|
11
|
+
* `scopeTfLabel`/`scope` identify the tool's RESOLVED target aspect (self,
|
|
12
|
+
* or a foreign app/element per `target_id` — board issue #169), not always
|
|
13
|
+
* the owning app: a field on a foreign aspect is scoped under that aspect's
|
|
14
|
+
* own label, not the caller's.
|
|
15
|
+
*/
|
|
16
|
+
import { type ChildResourceScope, type TfValue } from "../../engine/tf/index.js";
|
|
17
|
+
export declare function resolveToolFieldKey(fieldRef: TfValue | undefined, scopeTfLabel: string, scope?: ChildResourceScope): string | undefined;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A tool's `field_id` value → the TARGET aspect's field bag key. Shared by
|
|
3
|
+
* `agent-tool`/`skill-tool` from-tf (neither owns the other, so this lives in
|
|
4
|
+
* the cross-entity commons rather than either module). Two shapes: a
|
|
5
|
+
* `resource-attr` to the field's own resource (custom fields, which have a
|
|
6
|
+
* dedicated `elementum_<type>_field` block), or a `local.<aspect>_<key>_
|
|
7
|
+
* field_id` reference (system fields - title/status/closedBy/…, which have
|
|
8
|
+
* no resource of their own). Same recognition `automation/from-tf.ts`'s
|
|
9
|
+
* `decodeValue` already does for record-path field refs.
|
|
10
|
+
*
|
|
11
|
+
* `scopeTfLabel`/`scope` identify the tool's RESOLVED target aspect (self,
|
|
12
|
+
* or a foreign app/element per `target_id` — board issue #169), not always
|
|
13
|
+
* the owning app: a field on a foreign aspect is scoped under that aspect's
|
|
14
|
+
* own label, not the caller's.
|
|
15
|
+
*/
|
|
16
|
+
import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
17
|
+
import { SUB_TYPE_BY_RESOURCE as FIELD_SUB_TYPE_BY_RESOURCE } from "../field/types.js";
|
|
18
|
+
export function resolveToolFieldKey(fieldRef, scopeTfLabel, scope = "app") {
|
|
19
|
+
if (fieldRef === undefined)
|
|
20
|
+
return undefined;
|
|
21
|
+
if (isTfExpr(fieldRef) && fieldRef.$expr === "resource-attr" && FIELD_SUB_TYPE_BY_RESOURCE.has(fieldRef.type)) {
|
|
22
|
+
return scopedLabelToBagKey(scopeTfLabel, fieldRef.label, scope);
|
|
23
|
+
}
|
|
24
|
+
if (isTfExpr(fieldRef) && fieldRef.$expr === "local") {
|
|
25
|
+
const prefix = `${scopeTfLabel}_`;
|
|
26
|
+
if (fieldRef.name.startsWith(prefix) && fieldRef.name.endsWith("_field_id")) {
|
|
27
|
+
return tfLabelToTsLabel(fieldRef.name.slice(prefix.length, -"_field_id".length));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
@@ -6,10 +6,19 @@
|
|
|
6
6
|
* configurations is surfaced here. The full enum is listed for
|
|
7
7
|
* forward-compatibility; uncommon types are commented.
|
|
8
8
|
*/
|
|
9
|
-
export type WorkflowFieldType = "TEXT" | "HANDLE" | "NUMBER" | "DECIMAL" | "BOOLEAN" | "DATE" | "DATETIME" | "HTML" | "USER" | "USER_ID" | "GROUP" | "GROUP_ID" | "FILE" | "ATTACHMENT" | "ATTACHMENT_ID" | "ASPECT_ID" | "ASPECT_RECORD" | "ASPECT_RECORD_ID" | "ASPECT_FIELD_ID" | "FILTER" | "OBJECT" | "JSON" | "PICKLIST" | "PICKLIST_ID" | "MULTI_PICKLIST" | "MULTI_PICKLIST_ID" | "SEARCH_TABLE_ID" | "TABLE_ID" | "TABLE_RECORD" | "VARIABLE" | "RICH_TEXT" | "AI_SEARCH_TABLE_RECORD";
|
|
9
|
+
export type WorkflowFieldType = "TEXT" | "HANDLE" | "NUMBER" | "DECIMAL" | "BOOLEAN" | "DATE" | "DATETIME" | "HTML" | "USER" | "USER_ID" | "GROUP" | "GROUP_ID" | "FILE" | "ATTACHMENT" | "ATTACHMENT_ID" | "ASPECT_ID" | "ASPECT_RECORD" | "ASPECT_RECORD_ID" | "ASPECT_FIELD_ID" | "FILTER" | "OBJECT" | "JSON" | "PICKLIST" | "PICKLIST_ID" | "MULTI_PICKLIST" | "MULTI_PICKLIST_ID" | "RELATION" | "SEARCH_TABLE_ID" | "TABLE_ID" | "TABLE_RECORD" | "VARIABLE" | "RICH_TEXT" | "AI_SEARCH_TABLE_RECORD";
|
|
10
10
|
/**
|
|
11
11
|
* Map from user-friendly type names (used in the SDK's onDemand input
|
|
12
12
|
* schema) to the platform's WorkflowFieldType value.
|
|
13
|
+
*
|
|
14
|
+
* `attachmentId` is the odd one out: `elementum_on_demand_trigger`'s own
|
|
15
|
+
* `parameters[].type` terraform attribute (on_demand_trigger_resource.go)
|
|
16
|
+
* only validates a bare "attachment" - there is no "attachment_id" spelling
|
|
17
|
+
* at that layer, unlike every other row here where the wire string is just
|
|
18
|
+
* the WorkflowFieldType name lowercased. automation/to-tf.ts special-cases
|
|
19
|
+
* ATTACHMENT_ID -> "attachment" (and from-tf.ts the inverse) rather than
|
|
20
|
+
* renaming this alias, to avoid a breaking change to authored `onDemand({})`
|
|
21
|
+
* calls that already use `type: "attachmentId"`.
|
|
13
22
|
*/
|
|
14
23
|
export declare const FIELD_TYPE_MAP: {
|
|
15
24
|
readonly text: "TEXT";
|