@elementumai/edk 0.9.6 → 0.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -3
- package/dist-sdk/src/catalog/factories.d.ts +26 -6
- package/dist-sdk/src/catalog/factories.js +41 -6
- package/dist-sdk/src/catalog/from-authoring.js +27 -33
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +2 -2
- package/dist-sdk/src/catalog/org.js +93 -42
- package/dist-sdk/src/catalog/token.js +10 -0
- package/dist-sdk/src/catalog/types.d.ts +42 -3
- package/dist-sdk/src/catalog/types.js +5 -0
- package/dist-sdk/src/core/index.d.ts +2 -2
- package/dist-sdk/src/core/index.js +1 -1
- package/dist-sdk/src/core/platform-id.d.ts +2 -0
- package/dist-sdk/src/core/platform-id.js +4 -0
- package/dist-sdk/src/core/system-fields.d.ts +18 -0
- package/dist-sdk/src/core/system-fields.js +21 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +27 -24
- package/dist-sdk/src/core/triggers/on-demand.js +33 -12
- package/dist-sdk/src/core/types/app.d.ts +14 -9
- package/dist-sdk/src/core/types/aspect-category.d.ts +1 -0
- package/dist-sdk/src/core/types/aspect-category.js +1 -0
- package/dist-sdk/src/core/types/platform.d.ts +1 -1
- package/dist-sdk/src/engine/build/context.d.ts +24 -8
- package/dist-sdk/src/engine/build/source-context.d.ts +14 -17
- package/dist-sdk/src/engine/build/source-context.js +1 -1
- package/dist-sdk/src/engine/pull/context.d.ts +18 -0
- package/dist-sdk/src/engine/pull/org.d.ts +4 -0
- package/dist-sdk/src/engine/pull/org.js +17 -2
- package/dist-sdk/src/engine/pull/procedure-refs.d.ts +16 -0
- package/dist-sdk/src/engine/pull/procedure-refs.js +69 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +14 -0
- package/dist-sdk/src/engine/pull/ref-only.js +35 -2
- package/dist-sdk/src/engine/tf/expr.js +1 -1
- package/dist-sdk/src/engine/workspace/authoring-layout.d.ts +15 -0
- package/dist-sdk/src/engine/workspace/authoring-layout.js +33 -1
- package/dist-sdk/src/engine/workspace/loader.d.ts +40 -0
- package/dist-sdk/src/engine/workspace/loader.js +328 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +4 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +24 -4
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +7 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +11 -3
- package/dist-sdk/src/entities/agent/build.d.ts +54 -8
- package/dist-sdk/src/entities/agent/build.js +36 -1
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +144 -3
- package/dist-sdk/src/entities/agent/from-tf.d.ts +7 -6
- package/dist-sdk/src/entities/agent/from-tf.js +176 -5
- package/dist-sdk/src/entities/agent/index.d.ts +2 -2
- package/dist-sdk/src/entities/agent/index.js +1 -1
- package/dist-sdk/src/entities/agent/module.js +1 -0
- package/dist-sdk/src/entities/agent/to-tf.d.ts +5 -4
- package/dist-sdk/src/entities/agent/to-tf.js +186 -11
- package/dist-sdk/src/entities/agent/tools.d.ts +16 -5
- package/dist-sdk/src/entities/agent/tools.js +13 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +16 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +39 -6
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +12 -12
- package/dist-sdk/src/entities/agent-tool/types.js +1 -0
- package/dist-sdk/src/entities/app/build.d.ts +44 -24
- package/dist-sdk/src/entities/app/build.js +18 -8
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +15 -0
- package/dist-sdk/src/entities/app/display-blocks-to-layout.d.ts +45 -0
- package/dist-sdk/src/entities/app/display-blocks-to-layout.js +98 -0
- package/dist-sdk/src/entities/app/display-blocks-to-record-create-form.d.ts +55 -0
- package/dist-sdk/src/entities/app/display-blocks-to-record-create-form.js +99 -0
- package/dist-sdk/src/entities/app/from-tf.js +79 -14
- package/dist-sdk/src/entities/app/index.d.ts +3 -2
- package/dist-sdk/src/entities/app/index.js +2 -1
- package/dist-sdk/src/entities/app/to-tf.js +30 -6
- package/dist-sdk/src/entities/automation/build.d.ts +37 -18
- package/dist-sdk/src/entities/automation/build.js +121 -12
- package/dist-sdk/src/entities/automation/catalog-render.js +5 -2
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +8 -10
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +2 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +103 -20
- package/dist-sdk/src/entities/automation/from-tf.d.ts +10 -1
- package/dist-sdk/src/entities/automation/from-tf.js +1165 -91
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.js +15 -5
- package/dist-sdk/src/entities/automation/operators.d.ts +2 -2
- package/dist-sdk/src/entities/automation/operators.js +1 -0
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +17 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +45 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +20 -4
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +33 -6
- package/dist-sdk/src/entities/automation/script-code.d.ts +1 -1
- package/dist-sdk/src/entities/automation/script-code.js +168 -36
- package/dist-sdk/src/entities/automation/task-label.d.ts +2 -0
- package/dist-sdk/src/entities/automation/task-label.js +18 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +159 -45
- package/dist-sdk/src/entities/automation/tasks.js +60 -47
- package/dist-sdk/src/entities/automation/to-tf.d.ts +7 -1
- package/dist-sdk/src/entities/automation/to-tf.js +816 -87
- package/dist-sdk/src/entities/automation/triggers.d.ts +14 -5
- package/dist-sdk/src/entities/automation/triggers.js +1 -1
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +78 -0
- package/dist-sdk/src/entities/automation/value-ref-tf.js +193 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +1 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +1 -1
- package/dist-sdk/src/entities/element/build.d.ts +30 -7
- package/dist-sdk/src/entities/element/build.js +7 -3
- package/dist-sdk/src/entities/element/from-tf.js +7 -3
- package/dist-sdk/src/entities/element/index.d.ts +3 -2
- package/dist-sdk/src/entities/element/index.js +3 -2
- package/dist-sdk/src/entities/element/to-tf.js +49 -8
- package/dist-sdk/src/entities/field/build.d.ts +94 -3
- package/dist-sdk/src/entities/field/build.js +82 -3
- package/dist-sdk/src/entities/field/from-tf.d.ts +6 -0
- package/dist-sdk/src/entities/field/from-tf.js +104 -1
- package/dist-sdk/src/entities/field/locals.js +6 -7
- package/dist-sdk/src/entities/field/module.js +1 -0
- package/dist-sdk/src/entities/field/options.d.ts +2 -0
- package/dist-sdk/src/entities/field/options.js +12 -2
- package/dist-sdk/src/entities/field/record-shape.d.ts +12 -15
- package/dist-sdk/src/entities/field/to-tf.d.ts +13 -3
- package/dist-sdk/src/entities/field/to-tf.js +191 -56
- package/dist-sdk/src/entities/field/types.js +2 -0
- package/dist-sdk/src/entities/org/category-ref.d.ts +5 -0
- package/dist-sdk/src/entities/org/category-ref.js +12 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.js +3 -3
- package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/record-create-form/to-tf.js +18 -13
- package/dist-sdk/src/entities/relationship/from-tf.js +100 -7
- package/dist-sdk/src/entities/role/from-tf.js +10 -4
- package/dist-sdk/src/entities/search-table/build.d.ts +1 -1
- package/dist-sdk/src/entities/search-table/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/from-tf.js +6 -0
- package/dist-sdk/src/entities/search-table/printer.js +3 -1
- package/dist-sdk/src/entities/search-table/to-tf.js +3 -3
- package/dist-sdk/src/entities/search-table/types.js +1 -0
- package/dist-sdk/src/entities/service-account/from-tf.js +10 -4
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +2 -1
- package/dist-sdk/src/entities/service-account/to-tf.js +7 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +9 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +39 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +24 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +4 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +13 -2
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +14 -8
- package/dist-sdk/src/entities/shared/handle-description.d.ts +12 -0
- package/dist-sdk/src/entities/shared/handle-description.js +20 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +5 -3
- package/dist-sdk/src/entities/shared/tool-field-ref.js +11 -16
- package/dist-sdk/src/entities/shared/types/common.d.ts +7 -5
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +6 -1
- package/dist-sdk/src/entities/shared/types/field-types.js +5 -8
- package/dist-sdk/src/entities/shared/types/platform.d.ts +15 -2
- package/dist-sdk/src/entities/skill/build.d.ts +51 -2
- package/dist-sdk/src/entities/skill/build.js +65 -8
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +1 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +79 -18
- package/dist-sdk/src/entities/skill/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/skill/from-tf.js +47 -5
- package/dist-sdk/src/entities/skill/index.d.ts +1 -1
- package/dist-sdk/src/entities/skill/index.js +1 -1
- package/dist-sdk/src/entities/skill/input-coverage.d.ts +89 -0
- package/dist-sdk/src/entities/skill/input-coverage.js +327 -0
- package/dist-sdk/src/entities/skill/module.js +2 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +9 -25
- package/dist-sdk/src/entities/skill/to-tf.js +29 -40
- package/dist-sdk/src/entities/skill/tools.d.ts +12 -2
- package/dist-sdk/src/entities/skill/tools.js +3 -6
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +19 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +50 -14
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +9 -7
- package/dist-sdk/src/entities/skill-tool/to-tf.js +29 -23
- package/dist-sdk/src/entities/table/to-tf.js +21 -5
- package/dist-sdk/src/entities/task/to-tf.js +3 -2
- package/dist-sdk/src/entities/view/from-tf.js +36 -10
- package/dist-sdk/src/entities/view/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/view/to-tf.js +49 -30
- package/dist-sdk/src/entities/visual-flow/from-tf.js +6 -2
- package/dist-sdk/src/entities/widget/from-tf.js +2 -2
- package/dist-sdk/src/entities/widget/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/widget/to-tf.js +52 -23
- package/dist-sdk/src/graph/index.d.ts +19 -1
- package/dist-sdk/src/graph/index.js +20 -0
- package/dist-sdk/src/graph/types.d.ts +22 -0
- package/package.json +11 -5
|
@@ -6,6 +6,7 @@ export interface NormalizedSnowflakeSearchTable {
|
|
|
6
6
|
readonly name?: string;
|
|
7
7
|
readonly fieldKey: string;
|
|
8
8
|
readonly attributeFieldKeys: readonly string[];
|
|
9
|
+
readonly textIndexFieldKeys?: readonly string[];
|
|
9
10
|
readonly connectorKey: string;
|
|
10
11
|
readonly duration: "DAYS" | "HOURS" | "MINUTES" | "SECONDS";
|
|
11
12
|
readonly targetLag: number;
|
|
@@ -91,6 +91,9 @@ export function searchTableFromTf(block, ownerTfLabel, scope, ctx) {
|
|
|
91
91
|
const rawAttributes = block.attrs["attribute_field_ids"];
|
|
92
92
|
if (!Array.isArray(rawAttributes))
|
|
93
93
|
throw new EntityTfError(`${where}: "attribute_field_ids" must be a list`);
|
|
94
|
+
const rawTextIndexFields = block.attrs["text_index_field_ids"];
|
|
95
|
+
if (rawTextIndexFields !== undefined && !Array.isArray(rawTextIndexFields))
|
|
96
|
+
throw new EntityTfError(`${where}: "text_index_field_ids" must be a list`);
|
|
94
97
|
const duration = requiredString(block.attrs, "duration", where);
|
|
95
98
|
if (!["DAYS", "HOURS", "MINUTES", "SECONDS"].includes(duration)) {
|
|
96
99
|
throw new EntityTfError(`${where}: unsupported duration ${JSON.stringify(duration)}`);
|
|
@@ -104,6 +107,9 @@ export function searchTableFromTf(block, ownerTfLabel, scope, ctx) {
|
|
|
104
107
|
...(typeof block.attrs["name"] === "string" && { name: block.attrs["name"] }),
|
|
105
108
|
fieldKey: fieldKey(block.attrs["field_id"], ownerTfLabel, aspectScope, where),
|
|
106
109
|
attributeFieldKeys: rawAttributes.map((value) => fieldKey(value, ownerTfLabel, aspectScope, where)),
|
|
110
|
+
...(rawTextIndexFields !== undefined && {
|
|
111
|
+
textIndexFieldKeys: rawTextIndexFields.map((value) => fieldKey(value, ownerTfLabel, aspectScope, where)),
|
|
112
|
+
}),
|
|
107
113
|
connectorKey: connectorKey(block.attrs["ai_provider_connector_id"], ctx, where),
|
|
108
114
|
duration: duration,
|
|
109
115
|
targetLag,
|
|
@@ -36,7 +36,9 @@ parentScope, orgImportPath) {
|
|
|
36
36
|
lines.push(` creationTimeout: ${quote(table.creationTimeout)},`);
|
|
37
37
|
}
|
|
38
38
|
else if (table.kind === "snowflake") {
|
|
39
|
-
lines.push(` ${parentScope}: catalog${member(ownerRefName)},`, ` name: ${quote(table.name ?? table.refName)},`, ` attributeFields: [${table.attributeFieldKeys.map((key) => `catalog${member(ownerRefName)}.fields${member(key)}`).join(", ")}],`,
|
|
39
|
+
lines.push(` ${parentScope}: catalog${member(ownerRefName)},`, ` name: ${quote(table.name ?? table.refName)},`, ` attributeFields: [${table.attributeFieldKeys.map((key) => `catalog${member(ownerRefName)}.fields${member(key)}`).join(", ")}],`, ...(table.textIndexFieldKeys !== undefined
|
|
40
|
+
? [` textIndexFields: [${table.textIndexFieldKeys.map((key) => `catalog${member(ownerRefName)}.fields${member(key)}`).join(", ")}],`]
|
|
41
|
+
: []), ` vectorIndex: { field: catalog${member(ownerRefName)}.fields${member(table.fieldKey)}, service: ${connectorExpr(table.connectorKey)} },`, ` duration: searchTableDuration.${table.duration.toLowerCase()},`, ` targetLag: ${table.targetLag},`);
|
|
40
42
|
if (table.warehouse !== undefined)
|
|
41
43
|
lines.push(` warehouse: ${quote(table.warehouse)},`);
|
|
42
44
|
if (table.creationTimeout !== undefined)
|
|
@@ -82,9 +82,6 @@ export function searchTableToTf(entity, ctx) {
|
|
|
82
82
|
throw new EntityTfError(`search table ${entity.refName}: no vector index`);
|
|
83
83
|
if ((payload.vectorIndexes?.length ?? 0) > 1)
|
|
84
84
|
throw new EntityTfError(`search table ${entity.refName}: Terraform supports exactly one vector index`);
|
|
85
|
-
if ((payload.textIndexFieldIds?.length ?? 0) > 0) {
|
|
86
|
-
ctx.diagnostics.push(`search table ${entity.refName}: textIndexFields have no elementum_ai_search_table attribute; dropped`);
|
|
87
|
-
}
|
|
88
85
|
const attrs = {
|
|
89
86
|
object_id: objectId,
|
|
90
87
|
field_id: fieldValue(index.fieldId, aspectCtx, `search table ${entity.refName}`),
|
|
@@ -93,6 +90,9 @@ export function searchTableToTf(entity, ctx) {
|
|
|
93
90
|
duration: payload.duration ?? "DAYS",
|
|
94
91
|
target_lag: payload.targetLag ?? 1,
|
|
95
92
|
};
|
|
93
|
+
if (payload.textIndexFieldIds !== undefined) {
|
|
94
|
+
attrs["text_index_field_ids"] = payload.textIndexFieldIds.map((field) => fieldValue(field, aspectCtx, `search table ${entity.refName}`));
|
|
95
|
+
}
|
|
96
96
|
if (payload.name !== undefined)
|
|
97
97
|
attrs["name"] = payload.name;
|
|
98
98
|
if (payload.warehouse !== undefined)
|
|
@@ -8,10 +8,16 @@ function principal(value, type, where, ctx) {
|
|
|
8
8
|
const label = dataRefLabel(value, type);
|
|
9
9
|
if (label !== undefined) {
|
|
10
10
|
const name = ctx.dataName(type, label);
|
|
11
|
-
if (name !== undefined)
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
if (name !== undefined) {
|
|
12
|
+
if (type === "elementum_user") {
|
|
13
|
+
if (name.trim() === "" || !name.includes("@")) {
|
|
14
|
+
ctx.diagnostics.push(`${where}: data.${type}.${label} has invalid email ${JSON.stringify(name)}; dropped`);
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
return { __kind: "user", email: name.trim() };
|
|
18
|
+
}
|
|
19
|
+
return { __kind: "group", refName: tfLabelToTsLabel(label), name };
|
|
20
|
+
}
|
|
15
21
|
ctx.diagnostics.push(`${where}: data.${type}.${label} has no lookup value; dropped`);
|
|
16
22
|
return undefined;
|
|
17
23
|
}
|
|
@@ -19,7 +19,8 @@ export declare function serviceAccountRefToTf(token: {
|
|
|
19
19
|
}, opts: {
|
|
20
20
|
readonly appRefName: string;
|
|
21
21
|
readonly appTfLabel: string;
|
|
22
|
-
|
|
22
|
+
/** Missing for a foreign reference whose owning app was not exported. */
|
|
23
|
+
readonly appId: TfValue | undefined;
|
|
23
24
|
readonly serviceAccounts?: Readonly<Record<string, AppServiceAccount>>;
|
|
24
25
|
readonly orgRefs: OrgRefLookup;
|
|
25
26
|
}, where: string, diagnostics: string[]): TfValue | undefined;
|
|
@@ -27,6 +27,13 @@ export function serviceAccountRefToTf(token, opts, where, diagnostics) {
|
|
|
27
27
|
if (local.length === 1) {
|
|
28
28
|
return expr.resourceAttr(SERVICE_ACCOUNT_RESOURCE_TYPE, appScopedResourceLabel(opts.appTfLabel, tsLabelToTfLabel(local[0][0])), ["id"]);
|
|
29
29
|
}
|
|
30
|
+
// A pulled foreign reference can lack an owning app id when the exporter
|
|
31
|
+
// could not resolve that app. Do not emit an invalid data source block with
|
|
32
|
+
// a missing required app_id; callers treat an undefined lookup as absent.
|
|
33
|
+
if (opts.appId === undefined) {
|
|
34
|
+
diagnostics.push(`${where}: service account ${JSON.stringify(token.name)} has no resolvable owning app id; dropped`);
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
30
37
|
const label = appScopedResourceLabel(opts.appTfLabel, sanitizeName(token.name));
|
|
31
38
|
opts.orgRefs.rawLookup(SERVICE_ACCOUNT_RESOURCE_TYPE, label, token.name, { app_id: opts.appId });
|
|
32
39
|
return expr.dataAttr(SERVICE_ACCOUNT_RESOURCE_TYPE, label, ["id"]);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FromTfContext } from "../../engine/pull/context.js";
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a foreign app/element data lookup to its display name. Ref-only
|
|
4
|
+
* lookups are intentionally namespace-only, so fall back through the
|
|
5
|
+
* recursive pull's namespace -> refName and display-name -> refName maps.
|
|
6
|
+
*/
|
|
7
|
+
export declare function dataAspectDisplayName(ctx: FromTfContext, kind: "app" | "element", label: string): string | undefined;
|
|
8
|
+
/** Resolve the stable pulled catalog key for the same foreign lookup. */
|
|
9
|
+
export declare function dataAspectRefName(ctx: FromTfContext, kind: "app" | "element", label: string, displayName?: string): string | undefined;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve a foreign app/element data lookup to its display name. Ref-only
|
|
3
|
+
* lookups are intentionally namespace-only, so fall back through the
|
|
4
|
+
* recursive pull's namespace -> refName and display-name -> refName maps.
|
|
5
|
+
*/
|
|
6
|
+
export function dataAspectDisplayName(ctx, kind, label) {
|
|
7
|
+
const type = kind === "app" ? "elementum_app" : "elementum_element";
|
|
8
|
+
const direct = ctx.dataName(type, label);
|
|
9
|
+
if (direct !== undefined)
|
|
10
|
+
return direct;
|
|
11
|
+
const attrs = ctx.dataAttrs?.(type, label);
|
|
12
|
+
if (typeof attrs?.name === "string")
|
|
13
|
+
return attrs.name;
|
|
14
|
+
const namespace = typeof attrs?.namespace === "string" ? attrs.namespace : undefined;
|
|
15
|
+
if (namespace === undefined)
|
|
16
|
+
return undefined;
|
|
17
|
+
const refName = kind === "app"
|
|
18
|
+
? ctx.foreignAppRefNamespaces?.get(namespace)
|
|
19
|
+
: ctx.foreignElementRefNamespaces?.get(namespace);
|
|
20
|
+
if (refName === undefined)
|
|
21
|
+
return undefined;
|
|
22
|
+
const names = kind === "app" ? ctx.foreignAppRefNames : ctx.foreignElementRefNames;
|
|
23
|
+
return [...(names?.entries() ?? [])].find(([, candidateRefName]) => candidateRefName === refName)?.[0];
|
|
24
|
+
}
|
|
25
|
+
/** Resolve the stable pulled catalog key for the same foreign lookup. */
|
|
26
|
+
export function dataAspectRefName(ctx, kind, label, displayName) {
|
|
27
|
+
const type = kind === "app" ? "elementum_app" : "elementum_element";
|
|
28
|
+
const attrs = ctx.dataAttrs?.(type, label);
|
|
29
|
+
const namespace = typeof attrs?.namespace === "string" ? attrs.namespace : undefined;
|
|
30
|
+
const byNamespace = kind === "app" ? ctx.foreignAppRefNamespaces : ctx.foreignElementRefNamespaces;
|
|
31
|
+
if (namespace !== undefined) {
|
|
32
|
+
const refName = byNamespace?.get(namespace);
|
|
33
|
+
if (refName !== undefined)
|
|
34
|
+
return refName;
|
|
35
|
+
}
|
|
36
|
+
const name = displayName ?? dataAspectDisplayName(ctx, kind, label);
|
|
37
|
+
const byName = kind === "app" ? ctx.foreignAppRefNames : ctx.foreignElementRefNames;
|
|
38
|
+
return name === undefined ? undefined : byName?.get(name);
|
|
39
|
+
}
|
|
@@ -60,8 +60,11 @@ export interface FieldRefAst {
|
|
|
60
60
|
readonly entityType: "app" | "element";
|
|
61
61
|
/** The owner's display name — resolves a same-name local catalog entry, same convention as `AppRefAst.name`. */
|
|
62
62
|
readonly name: string;
|
|
63
|
+
/** Stable namespace for a portable inline fieldRef owner lookup. */
|
|
64
|
+
readonly namespace?: string;
|
|
63
65
|
/** The field's OWN display name (the `data.elementum_field` block's `name` attr), when the stream carried it — used for the raw stub's `name:` when the owner isn't locally resolvable. */
|
|
64
66
|
readonly fieldName?: string;
|
|
67
|
+
readonly fieldType?: string;
|
|
65
68
|
};
|
|
66
69
|
}
|
|
67
70
|
/** Reference to a fixed platform user-directory attribute. */
|
|
@@ -134,6 +137,20 @@ export interface TableRefAst {
|
|
|
134
137
|
/** Display name from a `data.elementum_table` lookup, when the export carried it. */
|
|
135
138
|
readonly name?: string;
|
|
136
139
|
}
|
|
140
|
+
/**
|
|
141
|
+
* Reference to one column of an org-owned table:
|
|
142
|
+
* `catalog.tables.<tableHandle>.columns.<columnKey>`. Exports address a column
|
|
143
|
+
* by DISPLAY name (`field_ids["PK Location ID"]`), so `name` is the round-trip
|
|
144
|
+
* authority and `columnKey` is only the catalog bag key derived from it.
|
|
145
|
+
*/
|
|
146
|
+
export interface TableColumnRefAst {
|
|
147
|
+
readonly kind: "tableColumn";
|
|
148
|
+
readonly tableHandle: string;
|
|
149
|
+
readonly columnKey: string;
|
|
150
|
+
readonly name: string;
|
|
151
|
+
/** Display name from a `data.elementum_table` lookup, when the export carried it. */
|
|
152
|
+
readonly tableName?: string;
|
|
153
|
+
}
|
|
137
154
|
/**
|
|
138
155
|
* Reference to an org-level AI provider connector, nested under its owning
|
|
139
156
|
* provider (`catalog.aiProviders.<provider>.models.<model>`) — connectors
|
|
@@ -164,6 +181,12 @@ export interface CloudLinkRefAst {
|
|
|
164
181
|
readonly handle: string;
|
|
165
182
|
readonly name?: string;
|
|
166
183
|
}
|
|
184
|
+
/** Reference to a configured procedure nested beneath its owning CloudLink. */
|
|
185
|
+
export interface ProcedureRefAst {
|
|
186
|
+
readonly kind: "procedure";
|
|
187
|
+
readonly cloudLinkKey: string;
|
|
188
|
+
readonly procedureKey: string;
|
|
189
|
+
}
|
|
167
190
|
/**
|
|
168
191
|
* Placeholder for an identifier (uuid or clientHandle) the catalog couldn't
|
|
169
192
|
* resolve — printer emits it as a quoted literal with a `/* TODO *\/` comment.
|
|
@@ -221,7 +244,7 @@ export type RefExpr =
|
|
|
221
244
|
| {
|
|
222
245
|
kind: "template";
|
|
223
246
|
parts: readonly (string | RefExpr)[];
|
|
224
|
-
} | FieldRefAst | UserFieldRefAst | AppRefAst | AgentRefAst | AutomationRefAst | DocumentModelRefAst | DocumentModelFieldRefAst | ApprovalChainRefAst | DatamineRefAst | TableRefAst | ConnectorRefAst | CloudLinkRefAst | PhoneServiceRefAst | UserRefAst | UnresolvedRefAst
|
|
247
|
+
} | FieldRefAst | UserFieldRefAst | AppRefAst | AgentRefAst | AutomationRefAst | DocumentModelRefAst | DocumentModelFieldRefAst | ApprovalChainRefAst | DatamineRefAst | TableRefAst | TableColumnRefAst | SearchTableRefAst | ConnectorRefAst | CloudLinkRefAst | ProcedureRefAst | PhoneServiceRefAst | UserRefAst | UnresolvedRefAst
|
|
225
248
|
/** Preserved terraform local expression for round-trip (e.g. status option ids by label). */
|
|
226
249
|
| {
|
|
227
250
|
kind: "localRef";
|
|
@@ -62,7 +62,11 @@ export function isRefExpr(value) {
|
|
|
62
62
|
kind === "approvalChain" ||
|
|
63
63
|
kind === "datamine" ||
|
|
64
64
|
kind === "table" ||
|
|
65
|
+
kind === "tableColumn" ||
|
|
66
|
+
kind === "searchTable" ||
|
|
65
67
|
kind === "connector" ||
|
|
68
|
+
kind === "cloudLink" ||
|
|
69
|
+
kind === "procedure" ||
|
|
66
70
|
kind === "phoneService" ||
|
|
67
71
|
kind === "user" ||
|
|
68
72
|
kind === "unresolved");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type TfValue } from "../../../engine/tf/index.js";
|
|
2
|
-
import type { DateTimeUnit, Filter, LikeMode } from "./types.js";
|
|
2
|
+
import type { DateTimeUnit, Filter, LikeMode, ValueType } from "./types.js";
|
|
3
3
|
export type TfFilterType = "and" | "or" | "equals" | "greater_than" | "greater_than_equals" | "less_than" | "less_than_equals" | "like" | "in" | "between" | "contains" | "overlaps" | "is_null" | "current_range" | "consecutive_range" | "true" | "false";
|
|
4
4
|
type TfDateTimeUnit = Lowercase<DateTimeUnit>;
|
|
5
5
|
type TfLikeMode = Lowercase<LikeMode>;
|
|
@@ -84,7 +84,12 @@ export type TfFilter = Readonly<{
|
|
|
84
84
|
export interface FilterToTfCodec {
|
|
85
85
|
readonly field: (value: unknown) => TfValue;
|
|
86
86
|
readonly aspect?: (value: unknown) => TfValue;
|
|
87
|
-
|
|
87
|
+
/**
|
|
88
|
+
* `role` distinguishes filter left_value (switch-case comparisons) from
|
|
89
|
+
* right-hand `value`/`values` references — provider Read / ei use different
|
|
90
|
+
* wire forms for TASK refs in each slot (#490).
|
|
91
|
+
*/
|
|
92
|
+
readonly reference: (value: unknown, role?: "left" | "value", realType?: string) => TfValue;
|
|
88
93
|
readonly literal?: (value: TfValue, field: unknown | undefined, valueType: string) => TfValue;
|
|
89
94
|
readonly fieldFromLeftValue?: (value: unknown) => unknown | undefined;
|
|
90
95
|
}
|
|
@@ -92,6 +97,12 @@ export interface FilterFromTfCodec<Field = string, ReferenceValue = never> {
|
|
|
92
97
|
readonly field: (value: TfValue, fieldScope: "app" | "user") => Field;
|
|
93
98
|
readonly aspect?: (value: TfValue) => Field;
|
|
94
99
|
readonly reference: (value: TfValue) => ReferenceValue;
|
|
100
|
+
/**
|
|
101
|
+
* A structured reference envelope can carry a more authoritative output
|
|
102
|
+
* type than the provider's legacy outer `real_type` default. Consumers
|
|
103
|
+
* that understand that envelope may override the fallback here.
|
|
104
|
+
*/
|
|
105
|
+
readonly referenceType?: (value: TfValue, fallback: ValueType) => ValueType;
|
|
95
106
|
readonly literal?: (value: TfValue, valueType: string) => TfValue;
|
|
96
107
|
}
|
|
97
108
|
export type WireFilterValue = Readonly<{
|
|
@@ -44,7 +44,7 @@ function withLeft(filter, codec) {
|
|
|
44
44
|
if (filter.field_id !== undefined)
|
|
45
45
|
return { field_id: filter.field_id };
|
|
46
46
|
if (filter.leftValue !== undefined) {
|
|
47
|
-
const value = wireFilterValueToTf(filter.leftValue, undefined, codec);
|
|
47
|
+
const value = wireFilterValueToTf(filter.leftValue, undefined, codec, "left");
|
|
48
48
|
if (value.type === "field" && value.field_id !== undefined)
|
|
49
49
|
return { left_value: { field_id: value.field_id } };
|
|
50
50
|
if (value.type === "reference" && value.value_reference !== undefined)
|
|
@@ -156,7 +156,7 @@ function filterValueToWire(value) {
|
|
|
156
156
|
...(value.required !== undefined && { required: value.required }),
|
|
157
157
|
};
|
|
158
158
|
}
|
|
159
|
-
function wireFilterValueToTf(value, field, codec) {
|
|
159
|
+
function wireFilterValueToTf(value, field, codec, role = "value") {
|
|
160
160
|
if (value === null || typeof value !== "object" || isTfExpr(value)) {
|
|
161
161
|
throw new EntityTfError("invalid wire filter value");
|
|
162
162
|
}
|
|
@@ -177,11 +177,13 @@ function wireFilterValueToTf(value, field, codec) {
|
|
|
177
177
|
const reference = raw.value ?? raw.valueReference ?? raw.value_reference;
|
|
178
178
|
if (reference === undefined)
|
|
179
179
|
throw new EntityTfError("reference filter value requires value");
|
|
180
|
+
// ei export always writes an explicit `multiple = false` on scalar text
|
|
181
|
+
// references. Omitting it plans null-vs-false drift after pull.
|
|
180
182
|
return {
|
|
181
183
|
type,
|
|
182
|
-
value_reference: codec.reference(reference),
|
|
184
|
+
value_reference: codec.reference(reference, role, String(raw.realType ?? raw.real_type ?? "TEXT")),
|
|
183
185
|
real_type: String(raw.realType ?? raw.real_type ?? "TEXT").toLowerCase(),
|
|
184
|
-
|
|
186
|
+
multiple: typeof raw.multiple === "boolean" ? raw.multiple : false,
|
|
185
187
|
};
|
|
186
188
|
}
|
|
187
189
|
if (type === "field") {
|
|
@@ -423,14 +425,16 @@ export function filterFromTf(value, codec, fieldScope = "app") {
|
|
|
423
425
|
return undefined;
|
|
424
426
|
if (filter.left_value.field_id !== undefined)
|
|
425
427
|
return { leftValue: { type: "FIELD", value: codec.field(filter.left_value.field_id, fieldScope) } };
|
|
426
|
-
if (filter.left_value.value_reference !== undefined)
|
|
428
|
+
if (filter.left_value.value_reference !== undefined) {
|
|
429
|
+
const fallback = (filter.left_value.real_type?.toUpperCase() ?? "TEXT");
|
|
427
430
|
return {
|
|
428
431
|
leftValue: {
|
|
429
432
|
type: "REFERENCE",
|
|
430
|
-
realType: (filter.left_value.
|
|
433
|
+
realType: codec.referenceType?.(filter.left_value.value_reference, fallback) ?? fallback,
|
|
431
434
|
value: codec.reference(filter.left_value.value_reference),
|
|
432
435
|
},
|
|
433
436
|
};
|
|
437
|
+
}
|
|
434
438
|
return undefined;
|
|
435
439
|
})();
|
|
436
440
|
if (left === undefined)
|
|
@@ -485,15 +489,17 @@ function filterValueFromTf(value, codec, fieldScope) {
|
|
|
485
489
|
const currentUserType = value.current_user_type?.toUpperCase();
|
|
486
490
|
return { type: "CURRENT_USER", valueType: currentUserType === "EMAIL" || currentUserType === "DOMAIN" ? currentUserType : "ID" };
|
|
487
491
|
}
|
|
488
|
-
case "reference":
|
|
492
|
+
case "reference": {
|
|
489
493
|
if (value.value_reference === undefined)
|
|
490
494
|
throw new EntityTfError("reference filter value requires value_reference");
|
|
495
|
+
const fallback = (value.real_type?.toUpperCase() ?? "TEXT");
|
|
491
496
|
return {
|
|
492
497
|
type: "REFERENCE",
|
|
493
|
-
realType: (value.
|
|
498
|
+
realType: codec.referenceType?.(value.value_reference, fallback) ?? fallback,
|
|
494
499
|
value: codec.reference(value.value_reference),
|
|
495
500
|
...(value.multiple === true && { multiple: true }),
|
|
496
501
|
};
|
|
502
|
+
}
|
|
497
503
|
case "field":
|
|
498
504
|
if (value.field_id === undefined)
|
|
499
505
|
throw new EntityTfError("field filter value requires field_id");
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TfValue } from "../../engine/tf/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* `handle_description` on an update-record tool (skill or agent) is optional
|
|
4
|
+
* on the wire: the platform accepts omitting it entirely (matching a legacy
|
|
5
|
+
* record's `null`), but always rejects an explicit empty string at apply
|
|
6
|
+
* with an opaque "Unable to validate" error - confirmed live against the
|
|
7
|
+
* platform (edk#801). Authoring should catch that mistake immediately
|
|
8
|
+
* rather than let it surface later during build.
|
|
9
|
+
*/
|
|
10
|
+
export declare function assertHandleDescriptionNotEmpty(value: string | undefined, where: string): void;
|
|
11
|
+
/** Sets `handle_description` only when there's a real value - omitting matches how the platform itself treats "no description." */
|
|
12
|
+
export declare function encodeOptionalHandleDescription(attrs: Record<string, TfValue>, value: string | undefined): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright (c) ElementumAI, Inc.
|
|
2
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
3
|
+
/**
|
|
4
|
+
* `handle_description` on an update-record tool (skill or agent) is optional
|
|
5
|
+
* on the wire: the platform accepts omitting it entirely (matching a legacy
|
|
6
|
+
* record's `null`), but always rejects an explicit empty string at apply
|
|
7
|
+
* with an opaque "Unable to validate" error - confirmed live against the
|
|
8
|
+
* platform (edk#801). Authoring should catch that mistake immediately
|
|
9
|
+
* rather than let it surface later during build.
|
|
10
|
+
*/
|
|
11
|
+
export function assertHandleDescriptionNotEmpty(value, where) {
|
|
12
|
+
if (value === "") {
|
|
13
|
+
throw new Error(`${where}'s handleDescription must not be an empty string - omit it entirely if there is no description.`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/** Sets `handle_description` only when there's a real value - omitting matches how the platform itself treats "no description." */
|
|
17
|
+
export function encodeOptionalHandleDescription(attrs, value) {
|
|
18
|
+
if (value)
|
|
19
|
+
attrs["handle_description"] = value;
|
|
20
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A tool's `field_id` value → the TARGET aspect's field bag key. Shared by
|
|
3
3
|
* `agent-tool`/`skill-tool` from-tf (neither owns the other, so this lives in
|
|
4
|
-
* the cross-entity commons rather than either module).
|
|
4
|
+
* the cross-entity commons rather than either module). Three shapes: a
|
|
5
5
|
* `resource-attr` to the field's own resource (custom fields, which have a
|
|
6
|
-
* dedicated `elementum_<type>_field` block),
|
|
6
|
+
* dedicated `elementum_<type>_field` block), a ref-only
|
|
7
|
+
* `data.elementum_field` lookup on a recursively pulled target, or a `local.<aspect>_<key>_
|
|
7
8
|
* field_id` reference (system fields - title/status/closedBy/…, which have
|
|
8
9
|
* no resource of their own). Same recognition `automation/from-tf.ts`'s
|
|
9
10
|
* `decodeValue` already does for record-path field refs.
|
|
@@ -13,5 +14,6 @@
|
|
|
13
14
|
* the owning app: a field on a foreign aspect is scoped under that aspect's
|
|
14
15
|
* own label, not the caller's.
|
|
15
16
|
*/
|
|
17
|
+
import type { FromTfContext } from "../../engine/pull/context.js";
|
|
16
18
|
import { type ChildResourceScope, type TfValue } from "../../engine/tf/index.js";
|
|
17
|
-
export declare function resolveToolFieldKey(fieldRef: TfValue | undefined, scopeTfLabel: string, scope?: ChildResourceScope): string | undefined;
|
|
19
|
+
export declare function resolveToolFieldKey(fieldRef: TfValue | undefined, scopeTfLabel: string, scope?: ChildResourceScope, ctx?: Pick<FromTfContext, "dataAttrs" | "foreignFieldRefsByDataAddress">): string | undefined;
|
|
@@ -1,27 +1,22 @@
|
|
|
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
1
|
import { isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
17
2
|
import { SUB_TYPE_BY_RESOURCE as FIELD_SUB_TYPE_BY_RESOURCE } from "../field/types.js";
|
|
18
|
-
export function resolveToolFieldKey(fieldRef, scopeTfLabel, scope = "app") {
|
|
3
|
+
export function resolveToolFieldKey(fieldRef, scopeTfLabel, scope = "app", ctx) {
|
|
19
4
|
if (fieldRef === undefined)
|
|
20
5
|
return undefined;
|
|
21
6
|
if (isTfExpr(fieldRef) && fieldRef.$expr === "resource-attr" && FIELD_SUB_TYPE_BY_RESOURCE.has(fieldRef.type)) {
|
|
22
7
|
return scopedLabelToBagKey(scopeTfLabel, fieldRef.label, scope);
|
|
23
8
|
}
|
|
24
9
|
if (isTfExpr(fieldRef) && fieldRef.$expr === "data-attr" && fieldRef.type === "elementum_field") {
|
|
10
|
+
const fieldAttrs = ctx?.dataAttrs?.("elementum_field", fieldRef.label);
|
|
11
|
+
const objectId = fieldAttrs?.object_id;
|
|
12
|
+
const ownerType = scope === "element" ? "elementum_element" : "elementum_app";
|
|
13
|
+
const addressesResolvedToSameTarget = objectId !== undefined && isTfExpr(objectId) && objectId.$expr === "data-attr" &&
|
|
14
|
+
objectId.type === ownerType && objectId.label === scopeTfLabel && objectId.path.join(".") === "id";
|
|
15
|
+
if (addressesResolvedToSameTarget) {
|
|
16
|
+
const refOnlyField = ctx?.foreignFieldRefsByDataAddress?.get(`elementum_field.${fieldRef.label}`);
|
|
17
|
+
if (refOnlyField !== undefined)
|
|
18
|
+
return refOnlyField.fieldKey;
|
|
19
|
+
}
|
|
25
20
|
// The reverse of `agent-tool`/`skill-tool` to-tf's
|
|
26
21
|
// `foreignTargetFieldRefValue`: a CUSTOM field on the tool's target
|
|
27
22
|
// aspect, resolved via a `data.elementum_field` lookup rather than a
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Shared types used across automations, agents, and other EDK domains.
|
|
3
3
|
*/
|
|
4
4
|
import type { AppField } from "../../../core/types/app.js";
|
|
5
|
+
import type { FieldRef } from "../../../catalog/types.js";
|
|
6
|
+
import type { UnsafePlatformId } from "../../../core/platform-id.js";
|
|
5
7
|
import type { Ref, ValueOrRef } from "../ref.js";
|
|
6
8
|
import type { Attachment } from "./platform.js";
|
|
7
9
|
export type HttpMethod = "GET" | "POST" | "PUT" | "DELETE";
|
|
@@ -79,14 +81,14 @@ export interface MultipartBody {
|
|
|
79
81
|
export type ApiBody = JsonBody | FormBody | CustomBody | MultipartBody;
|
|
80
82
|
export type SortDirection = "ASC" | "DESC";
|
|
81
83
|
/** One sort clause (field id + direction). Use {@link asc}, {@link desc}, or {@link sortBy}. */
|
|
82
|
-
export interface SortOrder {
|
|
83
|
-
field:
|
|
84
|
+
export interface SortOrder<Field = AppField> {
|
|
85
|
+
field: Field;
|
|
84
86
|
direction: SortDirection;
|
|
85
87
|
}
|
|
86
|
-
export declare function asc(field:
|
|
87
|
-
export declare function desc(field:
|
|
88
|
+
export declare function asc<Field extends AppField | FieldRef | UnsafePlatformId>(field: Field): SortOrder<Field>;
|
|
89
|
+
export declare function desc<Field extends AppField | FieldRef | UnsafePlatformId>(field: Field): SortOrder<Field>;
|
|
88
90
|
/** Multi-field sort (order is significant). Serializes to `Sort.orders` for Mobius. */
|
|
89
|
-
export declare function sortBy(...orders: SortOrder[]): readonly SortOrder[];
|
|
91
|
+
export declare function sortBy<Field>(...orders: SortOrder<Field>[]): readonly SortOrder<Field>[];
|
|
90
92
|
/**
|
|
91
93
|
* Serialize an authored `SortOrder | readonly SortOrder[]` to the
|
|
92
94
|
* platform's `Sort` JSON shape: `{ orders: [{ field: <id>, direction }] }`.
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { AppOrElementRef } from "../../../catalog/types.js";
|
|
2
|
+
import type { RecordShape } from "../../field/record-shape.js";
|
|
1
3
|
/**
|
|
2
4
|
* WorkflowFieldType — mirrors the Java enum in
|
|
3
5
|
* jarvis/util/.../WorkflowFieldType.java
|
|
@@ -31,8 +33,11 @@ export declare const FIELD_TYPE_MAP: {
|
|
|
31
33
|
readonly json: "JSON";
|
|
32
34
|
readonly object: "OBJECT";
|
|
33
35
|
readonly attachmentId: "ATTACHMENT_ID";
|
|
36
|
+
readonly record: "ASPECT_RECORD";
|
|
34
37
|
};
|
|
35
38
|
export type FieldTypeAlias = keyof typeof FIELD_TYPE_MAP;
|
|
39
|
+
/** On-demand `type: "record"` and its WorkflowFieldType / HCL spellings. */
|
|
40
|
+
export declare function isOnDemandRecordType(type: string | undefined): boolean;
|
|
36
41
|
/**
|
|
37
42
|
* Subset of {@link FieldTypeAlias} that Mobius's `onDemand` trigger
|
|
38
43
|
* validator accepts. Mobius rejects `WorkflowFieldType.USER` and
|
|
@@ -55,4 +60,4 @@ export type TriggerFieldTypeAlias = Exclude<FieldTypeAlias, "user">;
|
|
|
55
60
|
* Used when generating app definitions from Hydra's field metadata.
|
|
56
61
|
*/
|
|
57
62
|
export declare const ASPECT_FIELD_TYPE_NAME_TO_WORKFLOW_FIELD_TYPE: Record<string, WorkflowFieldType>;
|
|
58
|
-
export type FieldTypeToTS<A extends FieldTypeAlias> = A extends "text" ? string : A extends "number" | "decimal" ? number : A extends "boolean" ? boolean : A extends "date" | "datetime" ? string : A extends "user" ? string : A extends "attachmentId" ? string : A extends "json" | "object" ? unknown : unknown;
|
|
63
|
+
export type FieldTypeToTS<A extends FieldTypeAlias> = A extends "text" ? string : A extends "number" | "decimal" ? number : A extends "boolean" ? boolean : A extends "date" | "datetime" ? string : A extends "user" ? string : A extends "attachmentId" ? string : A extends "json" | "object" ? unknown : A extends "record" ? RecordShape<AppOrElementRef> : unknown;
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WorkflowFieldType — mirrors the Java enum in
|
|
3
|
-
* jarvis/util/.../WorkflowFieldType.java
|
|
4
|
-
*
|
|
5
|
-
* Only the subset relevant to on-demand trigger inputs and task
|
|
6
|
-
* configurations is surfaced here. The full enum is listed for
|
|
7
|
-
* forward-compatibility; uncommon types are commented.
|
|
8
|
-
*/
|
|
9
1
|
/**
|
|
10
2
|
* Map from user-friendly type names (used in the SDK's onDemand input
|
|
11
3
|
* schema) to the platform's WorkflowFieldType value.
|
|
@@ -30,7 +22,12 @@ export const FIELD_TYPE_MAP = {
|
|
|
30
22
|
json: "JSON",
|
|
31
23
|
object: "OBJECT",
|
|
32
24
|
attachmentId: "ATTACHMENT_ID",
|
|
25
|
+
record: "ASPECT_RECORD",
|
|
33
26
|
};
|
|
27
|
+
/** On-demand `type: "record"` and its WorkflowFieldType / HCL spellings. */
|
|
28
|
+
export function isOnDemandRecordType(type) {
|
|
29
|
+
return type === "record" || type === "ASPECT_RECORD";
|
|
30
|
+
}
|
|
34
31
|
/**
|
|
35
32
|
* Maps a user-friendly FieldTypeAlias to the TypeScript type it represents.
|
|
36
33
|
* Used to derive the phantom T in Ref<T> for trigger inputs.
|
|
@@ -39,8 +39,21 @@ export interface RichText {
|
|
|
39
39
|
readonly plainText: string;
|
|
40
40
|
readonly html: string;
|
|
41
41
|
}
|
|
42
|
-
/** A selected
|
|
43
|
-
export interface
|
|
42
|
+
/** A selected Dropdown option. Multi-Select fields expose an array of these. */
|
|
43
|
+
export interface DropdownValue {
|
|
44
44
|
readonly id: string;
|
|
45
45
|
readonly label: string;
|
|
46
46
|
}
|
|
47
|
+
declare const recordIdBrand: unique symbol;
|
|
48
|
+
/** Platform record identity (wire type ASPECT_RECORD_ID). */
|
|
49
|
+
export type RecordId = string & {
|
|
50
|
+
readonly [recordIdBrand]: "recordId";
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* A dynamically sourced Dropdown selection. It retains the normal Dropdown
|
|
54
|
+
* option id/label and also exposes the selected source record's identity.
|
|
55
|
+
*/
|
|
56
|
+
export interface DynamicDropdownValue extends DropdownValue {
|
|
57
|
+
readonly recordId: RecordId;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
@@ -1,16 +1,65 @@
|
|
|
1
1
|
import type { CatalogRef, SkillRef } from "../../catalog/index.js";
|
|
2
2
|
import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
|
|
3
3
|
import type { SkillTool } from "./tools.js";
|
|
4
|
-
export interface
|
|
4
|
+
export interface SkillInputSpec {
|
|
5
|
+
/** Optional explicit field name (defaults to the record key when using an object shape). */
|
|
6
|
+
readonly name?: string;
|
|
7
|
+
readonly description?: string;
|
|
8
|
+
readonly required?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface SkillLookupSpec {
|
|
11
|
+
readonly input: string;
|
|
12
|
+
readonly tool: string;
|
|
13
|
+
readonly source?: string;
|
|
14
|
+
}
|
|
15
|
+
export type SkillInputsOption = Readonly<Record<string, SkillInputSpec | string>> | readonly (SkillInputSpec & {
|
|
16
|
+
readonly name: string;
|
|
17
|
+
})[];
|
|
18
|
+
export type SkillLookupsOption = readonly SkillLookupSpec[] | Readonly<Record<string, {
|
|
19
|
+
readonly tool: string;
|
|
20
|
+
readonly source?: string;
|
|
21
|
+
} | string>>;
|
|
22
|
+
export type SkillV2Options = EntityDeployOptions & {
|
|
5
23
|
readonly name: string;
|
|
6
24
|
readonly app: CatalogRef<"app">;
|
|
7
25
|
readonly description: string;
|
|
8
|
-
readonly instructions: string;
|
|
9
26
|
/** Skill status. Defaults to `DRAFT`. */
|
|
10
27
|
readonly status?: "DRAFT" | "ACTIVE" | "INACTIVE";
|
|
11
28
|
/** Opaque passthrough for the skill's `properties` JSON field. */
|
|
12
29
|
readonly properties?: Record<string, unknown>;
|
|
30
|
+
/** Typed discovery signals used when routing user requests to this skill. */
|
|
31
|
+
readonly discovery?: SkillDiscoveryOptions;
|
|
13
32
|
readonly tools?: readonly SkillTool[];
|
|
33
|
+
} & ({
|
|
34
|
+
/**
|
|
35
|
+
* Procedural instructions for the skill. When `inputs` or `lookups` are defined,
|
|
36
|
+
* the `## Input Schema` and `## Lookup Notes` sections are automatically derived.
|
|
37
|
+
*/
|
|
38
|
+
readonly instructions: string;
|
|
39
|
+
/** Declarative input schema (form variables) for this skill. */
|
|
40
|
+
readonly inputs?: SkillInputsOption;
|
|
41
|
+
/** Declarative lookup bindings mapping form variables to lookup tools. */
|
|
42
|
+
readonly lookups?: SkillLookupsOption;
|
|
43
|
+
} | {
|
|
44
|
+
readonly instructions?: string;
|
|
45
|
+
/** Declarative input schema (form variables) for this skill. */
|
|
46
|
+
readonly inputs: SkillInputsOption;
|
|
47
|
+
/** Declarative lookup bindings mapping form variables to lookup tools. */
|
|
48
|
+
readonly lookups?: SkillLookupsOption;
|
|
49
|
+
} | {
|
|
50
|
+
readonly instructions?: string;
|
|
51
|
+
/** Declarative input schema (form variables) for this skill. */
|
|
52
|
+
readonly inputs?: SkillInputsOption;
|
|
53
|
+
/** Declarative lookup bindings mapping form variables to lookup tools. */
|
|
54
|
+
readonly lookups: SkillLookupsOption;
|
|
55
|
+
});
|
|
56
|
+
export interface SkillDiscoveryOptions {
|
|
57
|
+
/** Manual routing tie-breaker on the provider/UI scale, from -100 to 100. */
|
|
58
|
+
readonly routingPriority?: number;
|
|
59
|
+
readonly aliases?: readonly string[];
|
|
60
|
+
readonly exampleUtterances?: readonly string[];
|
|
61
|
+
readonly positiveKeywords?: readonly string[];
|
|
62
|
+
readonly negativeKeywords?: readonly string[];
|
|
14
63
|
}
|
|
15
64
|
/**
|
|
16
65
|
* The configured result of `skill` — its catalog reference (`ref()`) and
|