@elementumai/edk 0.9.11 → 0.9.12
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 +39 -5
- package/dist-sdk/src/catalog/factories.d.ts +35 -14
- package/dist-sdk/src/catalog/factories.js +64 -13
- package/dist-sdk/src/catalog/from-authoring.js +4 -4
- package/dist-sdk/src/catalog/index.d.ts +1 -1
- package/dist-sdk/src/catalog/org.js +3 -2
- package/dist-sdk/src/catalog/token.js +4 -0
- package/dist-sdk/src/catalog/types.d.ts +13 -3
- package/dist-sdk/src/core/triggers/on-demand.d.ts +4 -28
- package/dist-sdk/src/core/triggers/on-demand.js +2 -4
- package/dist-sdk/src/engine/entity.d.ts +2 -0
- package/dist-sdk/src/engine/logging.d.ts +90 -0
- package/dist-sdk/src/engine/logging.js +124 -0
- package/dist-sdk/src/engine/progress.d.ts +119 -0
- package/dist-sdk/src/engine/progress.js +647 -0
- package/dist-sdk/src/engine/pull/result-output.d.ts +24 -0
- package/dist-sdk/src/engine/pull/result-output.js +48 -0
- package/dist-sdk/src/entities/agent/tools.d.ts +2 -2
- package/dist-sdk/src/entities/app/build.d.ts +8 -1
- package/dist-sdk/src/entities/app/from-tf.js +4 -4
- package/dist-sdk/src/entities/app/to-tf.js +9 -13
- package/dist-sdk/src/entities/automation/build.d.ts +11 -16
- package/dist-sdk/src/entities/automation/build.js +38 -8
- package/dist-sdk/src/entities/automation/catalog-render.js +1 -1
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +1 -2
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +23 -5
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +239 -34
- package/dist-sdk/src/entities/automation/from-tf.js +168 -23
- package/dist-sdk/src/entities/automation/index.d.ts +2 -2
- package/dist-sdk/src/entities/automation/module.js +2 -2
- package/dist-sdk/src/entities/automation/output-field-types.js +25 -13
- package/dist-sdk/src/entities/automation/script-code.d.ts +12 -4
- package/dist-sdk/src/entities/automation/script-code.js +659 -101
- package/dist-sdk/src/entities/automation/tasks.d.ts +60 -28
- package/dist-sdk/src/entities/automation/tasks.js +31 -15
- package/dist-sdk/src/entities/automation/to-tf.js +362 -58
- package/dist-sdk/src/entities/automation/triggers.d.ts +15 -9
- package/dist-sdk/src/entities/automation/triggers.js +4 -2
- package/dist-sdk/src/entities/chart/build.d.ts +15 -3
- package/dist-sdk/src/entities/chart/build.js +6 -1
- package/dist-sdk/src/entities/chart/from-tf.d.ts +8 -2
- package/dist-sdk/src/entities/chart/from-tf.js +71 -8
- package/dist-sdk/src/entities/chart/index.d.ts +1 -1
- package/dist-sdk/src/entities/chart/index.js +1 -1
- package/dist-sdk/src/entities/chart/printer.js +27 -7
- package/dist-sdk/src/entities/chart/to-tf.js +56 -2
- package/dist-sdk/src/entities/datamine/from-tf.js +11 -1
- package/dist-sdk/src/entities/element/build.d.ts +6 -5
- package/dist-sdk/src/entities/element/from-tf.js +3 -2
- package/dist-sdk/src/entities/element/module.js +1 -0
- package/dist-sdk/src/entities/element/to-tf.d.ts +3 -0
- package/dist-sdk/src/entities/element/to-tf.js +9 -1
- package/dist-sdk/src/entities/field/from-tf.d.ts +24 -0
- package/dist-sdk/src/entities/field/from-tf.js +73 -1
- package/dist-sdk/src/entities/field/metadata.d.ts +18 -0
- package/dist-sdk/src/entities/field/metadata.js +34 -0
- package/dist-sdk/src/entities/relationship/build.d.ts +17 -6
- package/dist-sdk/src/entities/relationship/column-contract.d.ts +24 -0
- package/dist-sdk/src/entities/relationship/column-contract.js +41 -0
- package/dist-sdk/src/entities/relationship/from-tf.js +19 -34
- package/dist-sdk/src/entities/relationship/to-tf.js +15 -2
- package/dist-sdk/src/entities/shared/context.d.ts +6 -3
- package/dist-sdk/src/entities/shared/context.js +19 -1
- package/dist-sdk/src/entities/shared/filters/index.d.ts +7 -0
- package/dist-sdk/src/entities/shared/filters/index.js +28 -0
- package/dist-sdk/src/entities/shared/filters/print.js +2 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +8 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +10 -6
- package/dist-sdk/src/entities/shared/filters/types.d.ts +1 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +5 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +36 -23
- package/dist-sdk/src/entities/skill/module.js +1 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/skill/to-tf.js +17 -0
- package/dist-sdk/src/entities/skill/tools.d.ts +38 -12
- package/dist-sdk/src/entities/skill/tools.js +2 -1
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +8 -12
- package/dist-sdk/src/entities/skill-tool/from-tf.js +28 -44
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +4 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +45 -7
- package/dist-sdk/src/entities/table/build.js +10 -2
- package/dist-sdk/src/entities/view/to-tf.js +5 -7
- package/dist-sdk/src/entities/widget/build.d.ts +26 -0
- package/dist-sdk/src/entities/widget/from-tf.js +30 -5
- package/dist-sdk/src/entities/widget/to-tf.js +111 -7
- package/dist-sdk/src/graph/types.d.ts +5 -0
- package/package.json +1 -1
- package/dist-sdk/src/core/types/platform.d.ts +0 -2
- package/dist-sdk/src/core/types/platform.js +0 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { renderTextEffects, writeUserOutput } from "../progress.js";
|
|
2
|
+
export function managedResultStatus(operation, verdict) {
|
|
3
|
+
const outcome = verdict.failed === true
|
|
4
|
+
? "failure"
|
|
5
|
+
: (verdict.skipped ?? 0) > 0 || (verdict.gaps ?? 0) > 0
|
|
6
|
+
? "warning"
|
|
7
|
+
: "success";
|
|
8
|
+
return { operation, outcome };
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Pull commands are pleasant for a person on a terminal and remain stable for
|
|
12
|
+
* scripts: interactive stdout gets a concise user summary, while a pipe or
|
|
13
|
+
* redirect gets the complete machine-readable result object.
|
|
14
|
+
*/
|
|
15
|
+
export function writePullResult(result, humanLines, status) {
|
|
16
|
+
const resultWithStatus = status !== undefined && result !== null && typeof result === "object"
|
|
17
|
+
? { ...result, status: status.outcome }
|
|
18
|
+
: result;
|
|
19
|
+
if (process.stdout.isTTY === true) {
|
|
20
|
+
const renderedLines = humanLines.flatMap((line) => Array.isArray(line) && line.length === 0 ? [] : [renderPullResultLine(line)]);
|
|
21
|
+
if (status !== undefined) {
|
|
22
|
+
const message = status.outcome === "success"
|
|
23
|
+
? `${status.operation} completed successfully`
|
|
24
|
+
: status.outcome === "warning"
|
|
25
|
+
? `${status.operation} completed with warnings, see details above:`
|
|
26
|
+
: `${status.operation} has failed, see details below:`;
|
|
27
|
+
renderedLines.push(renderTextEffects(message, [{
|
|
28
|
+
start: 0,
|
|
29
|
+
end: message.length,
|
|
30
|
+
color: status.outcome === "success" ? "green" : status.outcome === "warning" ? "yellow" : "red",
|
|
31
|
+
bold: true,
|
|
32
|
+
}]));
|
|
33
|
+
}
|
|
34
|
+
writeUserOutput(`${renderedLines.join("\n")}\n`);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
process.stdout.write(`${JSON.stringify(resultWithStatus, null, 2)}\n`);
|
|
38
|
+
}
|
|
39
|
+
function renderPullResultLine(line) {
|
|
40
|
+
if (typeof line === "string")
|
|
41
|
+
return line;
|
|
42
|
+
return line.map((segment) => renderTextEffects(segment.text, segment.textEffects)).join("");
|
|
43
|
+
}
|
|
44
|
+
export function countSummary(entries) {
|
|
45
|
+
return entries
|
|
46
|
+
.map(([singular, count, plural]) => `${count} ${count === 1 ? singular : (plural ?? `${singular}s`)}`)
|
|
47
|
+
.join(", ");
|
|
48
|
+
}
|
|
@@ -239,8 +239,8 @@ type KnownKeys<T> = {
|
|
|
239
239
|
* - wide token (plain AutomationCatalogRef — foreign app or hand-written)
|
|
240
240
|
* → permissive Record (graceful degradation; def() still validates).
|
|
241
241
|
*/
|
|
242
|
-
type TriggerBagOf<A extends AutomationCatalogRef> = [NonNullable<A["trigger"]>] extends [never] ? EmptyBag : KnownKeys<NonNullable<A["trigger"]>> extends infer KK ? [keyof KK] extends [never] ? Readonly<Record<string, TriggerParameterRef>> : KK : never;
|
|
243
|
-
type OutputBagOf<A extends AutomationCatalogRef> = [NonNullable<A["outputs"]>] extends [never] ? EmptyBag : KnownKeys<NonNullable<A["outputs"]>> extends infer KK ? [keyof KK] extends [never] ? Readonly<Record<string, OutputPropertyRef>> : KK : never;
|
|
242
|
+
export type TriggerBagOf<A extends AutomationCatalogRef> = [NonNullable<A["trigger"]>] extends [never] ? EmptyBag : KnownKeys<NonNullable<A["trigger"]>> extends infer KK ? [keyof KK] extends [never] ? Readonly<Record<string, TriggerParameterRef>> : KK : never;
|
|
243
|
+
export type OutputBagOf<A extends AutomationCatalogRef> = [NonNullable<A["outputs"]>] extends [never] ? EmptyBag : KnownKeys<NonNullable<A["outputs"]>> extends infer KK ? [keyof KK] extends [never] ? Readonly<Record<string, OutputPropertyRef>> : KK : never;
|
|
244
244
|
/** Keys whose catalog entry carries `required: true` (rendered by the generated catalog). */
|
|
245
245
|
type RequiredParamKeys<T> = {
|
|
246
246
|
[K in keyof T]: T[K] extends {
|
|
@@ -275,6 +275,12 @@ export interface AppLayout {
|
|
|
275
275
|
/** A saved list view (`elementum_list_view`). */
|
|
276
276
|
export interface AppListView extends ManagedViewSharing {
|
|
277
277
|
readonly name: string;
|
|
278
|
+
/**
|
|
279
|
+
* Display columns for the saved list. Create/update also seeds the
|
|
280
|
+
* organization (Everyone) Display Settings table-state default
|
|
281
|
+
* (`owner` = this app/element, `parentId` = the list view id). Show/Hide
|
|
282
|
+
* Columns (ColumnOrder) and Just Me preferences are not authored here.
|
|
283
|
+
*/
|
|
278
284
|
readonly columns: readonly AppViewFieldRef[];
|
|
279
285
|
readonly allowRecordCreation?: boolean;
|
|
280
286
|
readonly density?: ListViewDensity;
|
|
@@ -430,7 +436,8 @@ export interface AppV2Options<F extends Record<string, AppField> = Record<string
|
|
|
430
436
|
* targeting another app/element lists rows through a matching entry here
|
|
431
437
|
* whose columns join comparable stored values, not through that child's
|
|
432
438
|
* `relationField` / `autoRelate`. Do not join system `"id"` (HANDLE) to a
|
|
433
|
-
* child `relationField
|
|
439
|
+
* child `relationField` or dynamic dropdown (create fails with
|
|
440
|
+
* `Unable to validate`).
|
|
434
441
|
*/
|
|
435
442
|
readonly relationships?: Readonly<Record<string, AppRelationship>>;
|
|
436
443
|
/** Display order of all authored views (by key). Defaults to declaration order by view bag. */
|
|
@@ -149,16 +149,16 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
|
|
|
149
149
|
const systemConfig = systemFieldConfigFromTf(attrs["system_field_config"], `app "${label}"`, ctx);
|
|
150
150
|
const titleName = optionalString(attrs, "title_field_name", `app "${label}"`, ctx);
|
|
151
151
|
if (titleName !== undefined || titleFieldDescription !== undefined || systemConfig.has("title")) {
|
|
152
|
-
fields.push(systemEntry("title", titleName ??
|
|
152
|
+
fields.push(systemEntry("title", titleName ?? DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES.title, "TEXT", "TITLE", titleFieldDescription, systemConfig.get("title")));
|
|
153
153
|
}
|
|
154
154
|
const idName = optionalString(attrs, "id_field_name", `app "${label}"`, ctx);
|
|
155
155
|
if (idName !== undefined || idFieldDescription !== undefined || systemConfig.has("id")) {
|
|
156
|
-
fields.push(systemEntry("id", idName ??
|
|
156
|
+
fields.push(systemEntry("id", idName ?? DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES.id, "TEXT", "HANDLE", idFieldDescription, systemConfig.get("id")));
|
|
157
157
|
}
|
|
158
|
-
const statusName = optionalString(attrs, "status_field_name", `app "${label}"`, ctx) ??
|
|
158
|
+
const statusName = optionalString(attrs, "status_field_name", `app "${label}"`, ctx) ?? DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES.status;
|
|
159
159
|
const statusOptions = optionsFromTf(attrs["status_options"], `app "${label}" status_options`, ctx);
|
|
160
160
|
if (!hasCustomStatusField
|
|
161
|
-
&& (statusName !==
|
|
161
|
+
&& (statusName !== DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES.status || statusOptions !== undefined || statusFieldDescription !== undefined || systemConfig.has("status"))) {
|
|
162
162
|
const flags = systemConfig.get("status");
|
|
163
163
|
fields.push({
|
|
164
164
|
key: "status",
|
|
@@ -21,9 +21,9 @@ import { expr, snakeSlug } from "../../engine/tf/index.js";
|
|
|
21
21
|
import { accessPolicyToTf } from "../access-policy/to-tf.js";
|
|
22
22
|
import { dashboardsToTf } from "../dashboard/to-tf.js";
|
|
23
23
|
import { picklistLabel } from "../field/options.js";
|
|
24
|
+
import { fieldMetadataFromEntries } from "../field/metadata.js";
|
|
24
25
|
import { dynamicLayoutsToTf } from "../dynamic-layout/to-tf.js";
|
|
25
26
|
import { fieldToTf } from "../field/to-tf.js";
|
|
26
|
-
import { SUB_TYPE_BY_TYPE_KEY } from "../field/types.js";
|
|
27
27
|
import { CATEGORY_ORG_BAG } from "../org/category.js";
|
|
28
28
|
import { categoryIdExpr, missingCategoryDiagnostic } from "../org/category-ref.js";
|
|
29
29
|
import { CLOUD_LINK_ORG_BAG } from "../org/cloud-link.js";
|
|
@@ -114,7 +114,7 @@ export function appToTf(entity, ctx) {
|
|
|
114
114
|
// --- Field pass: fold system-tagged fields, emit one resource per custom field.
|
|
115
115
|
const blocks = [];
|
|
116
116
|
const fieldAddresses = new Map();
|
|
117
|
-
const fieldMetadata =
|
|
117
|
+
const fieldMetadata = fieldMetadataFromEntries(payload.fields);
|
|
118
118
|
const fieldNames = new Map();
|
|
119
119
|
let statusOptions;
|
|
120
120
|
let stages;
|
|
@@ -128,17 +128,6 @@ export function appToTf(entity, ctx) {
|
|
|
128
128
|
const inner = fieldEntry[typeKey];
|
|
129
129
|
const name = inner.name ?? "";
|
|
130
130
|
const fieldKey = inner.__refName ?? snakeSlug(name);
|
|
131
|
-
const subType = SUB_TYPE_BY_TYPE_KEY.get(typeKey);
|
|
132
|
-
if (fieldKey !== "" && name !== "" && subType !== undefined) {
|
|
133
|
-
fieldMetadata.set(fieldKey, {
|
|
134
|
-
name,
|
|
135
|
-
fieldType: subType.authoringType,
|
|
136
|
-
...(inner.picklistValues !== undefined
|
|
137
|
-
? { options: inner.picklistValues.map((value) => picklistLabel(value)) }
|
|
138
|
-
: {}),
|
|
139
|
-
...(inner.tags !== undefined ? { tags: inner.tags } : {}),
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
131
|
if (fieldKey !== "" && name !== "")
|
|
143
132
|
fieldNames.set(fieldKey, name);
|
|
144
133
|
const systemTag = inner.tags?.find((tag) => SYSTEM_FIELD_TAGS.has(tag));
|
|
@@ -148,6 +137,13 @@ export function appToTf(entity, ctx) {
|
|
|
148
137
|
ctx.diagnostics.push(`systemFields: unsupported semantic tag ${systemTag}; validation flags dropped`);
|
|
149
138
|
}
|
|
150
139
|
else {
|
|
140
|
+
// Canonical system key (title/id/status/…) must map to the display
|
|
141
|
+
// name even when __refName was missing and fieldKey became
|
|
142
|
+
// snakeSlug("App Name") → "app_name". Cross-app automation refs
|
|
143
|
+
// look up record.title by the system key; missing it silently
|
|
144
|
+
// falls back to DEPLOY_DEFAULT "Title" (tofu Invalid index).
|
|
145
|
+
if (name !== "")
|
|
146
|
+
fieldNames.set(systemKey, name);
|
|
151
147
|
systemFieldConfig[SYSTEM_FIELD_HCL_KEY_BY_KEY[systemKey]] = {
|
|
152
148
|
required: inner.required ?? false,
|
|
153
149
|
required_on_close: inner.requiredOnClose ?? false,
|
|
@@ -79,6 +79,8 @@ export interface ActionDef<TOutput> {
|
|
|
79
79
|
readonly __output?: TOutput;
|
|
80
80
|
/** The owning app's refName, when this task's `record`/`records` output is app-field-typed. */
|
|
81
81
|
readonly __recordApp?: string;
|
|
82
|
+
/** Product kind of `__recordApp` — app vs element. Used to pick live FIND_PARENT refs keys. */
|
|
83
|
+
readonly __recordKind?: "app" | "element";
|
|
82
84
|
}
|
|
83
85
|
/** Placeholder `forEachTaskRefKey` the forEach item proxy emits; replaced with the real refKey. */
|
|
84
86
|
export declare const FOR_EACH_PLACEHOLDER = "__forEach__";
|
|
@@ -173,9 +175,10 @@ interface ActionMethods<TTrigger, TActions extends Record<string, unknown>, TVar
|
|
|
173
175
|
readonly inputs?: (ctx: NestedActionContext<TTrigger, TActions, TVars, TItem>) => I;
|
|
174
176
|
readonly code: (input: ScriptInput<ResolvedRefs<NoInfer<I>>>) => R;
|
|
175
177
|
/**
|
|
176
|
-
* Override the inferred output schema: property name →
|
|
177
|
-
*
|
|
178
|
-
*
|
|
178
|
+
* Override the inferred output schema: property name → scalar type or a
|
|
179
|
+
* recursive `{ type: "array", items }` / `{ type: "object", properties }`
|
|
180
|
+
* descriptor; the object form may also carry `name` for the root.
|
|
181
|
+
* `null`
|
|
179
182
|
* explicitly means "no schema" and suppresses inference; omitting the
|
|
180
183
|
* option infers from the code body.
|
|
181
184
|
*/
|
|
@@ -207,7 +210,7 @@ interface ActionMethods<TTrigger, TActions extends Record<string, unknown>, TVar
|
|
|
207
210
|
updateField<TName extends string, A extends AppOrElementRef, const Fields extends readonly import("./tasks.js").FieldAssignment[]>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").UpdateFieldOptions<A, Fields>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, {
|
|
208
211
|
record: RecordShape<A>;
|
|
209
212
|
}>;
|
|
210
|
-
findRelatedRecords<TName extends string, A extends AppOrElementRef>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").FindRelatedRecordsOptions<A>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").
|
|
213
|
+
findRelatedRecords<TName extends string, A extends AppOrElementRef>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").FindRelatedRecordsOptions<A>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").FindRelatedRecordsOutput<A>>;
|
|
211
214
|
relateRecords<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").RelateRecordsOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
212
215
|
sendEmail<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").SendEmailOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
213
216
|
postComment<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").PostCommentOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
@@ -219,9 +222,7 @@ interface ActionMethods<TTrigger, TActions extends Record<string, unknown>, TVar
|
|
|
219
222
|
aiSummarize<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").AiSummarizeOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, {
|
|
220
223
|
output: unknown;
|
|
221
224
|
}>;
|
|
222
|
-
aiTransform<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").AiTransformOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName,
|
|
223
|
-
output: unknown;
|
|
224
|
-
}>;
|
|
225
|
+
aiTransform<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").AiTransformOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, Record<string, unknown>>;
|
|
225
226
|
aiSearchTable<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").AiSearchTableOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").AiSearchTableOutput>;
|
|
226
227
|
aiFileAnalysis<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").AiFileAnalysisOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, {
|
|
227
228
|
output: unknown;
|
|
@@ -234,16 +235,10 @@ interface ActionMethods<TTrigger, TActions extends Record<string, unknown>, TVar
|
|
|
234
235
|
}>;
|
|
235
236
|
calculation<TName extends string, const Values extends import("./tasks.js").CalculationValues>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").CalculationOptions<Values>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").CalculationValueOutputs<Values>>;
|
|
236
237
|
calculation<TName extends string, const Entries extends readonly import("./tasks.js").CalculationEntry[]>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").LegacyCalculationOptions<Entries>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").CalculationOutputs<Entries>>;
|
|
237
|
-
procedure<TName extends string, const Parameters extends readonly import("../../catalog/types.js").ProcedureParameterType[]>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").TypedProcedureOptions<Parameters>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName,
|
|
238
|
-
|
|
239
|
-
}>;
|
|
240
|
-
procedure<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").LegacyProcedureOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, {
|
|
241
|
-
output: unknown;
|
|
242
|
-
}>;
|
|
238
|
+
procedure<TName extends string, const Parameters extends readonly import("../../catalog/types.js").ProcedureParameterType[]>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").TypedProcedureOptions<Parameters>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, Record<string, unknown>>;
|
|
239
|
+
procedure<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").LegacyProcedureOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, Record<string, unknown>>;
|
|
243
240
|
runAutomation<TName extends string, const A extends AutomationCatalogRef>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").RunAutomationOptions<A>>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").RunAutomationOutput<A>>;
|
|
244
|
-
readFile<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").ReadFileOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName,
|
|
245
|
-
output: unknown;
|
|
246
|
-
}>;
|
|
241
|
+
readFile<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").ReadFileOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, Record<string, unknown>>;
|
|
247
242
|
approvalChain<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").ApprovalChainOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
248
243
|
approvalStatusUpdate<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").ApprovalStatusUpdateOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
249
244
|
addWatcher<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").AddWatcherOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
|
|
@@ -134,7 +134,6 @@ function collectExecuteScriptOutputSchemas(tasks) {
|
|
|
134
134
|
* unrecognized, including `"object"`), which is real for the wire's own
|
|
135
135
|
* default but would be a wrong guess if promoted to `OutputPropertyRef.valueType`.
|
|
136
136
|
*/
|
|
137
|
-
const KNOWN_SCRIPT_OUTPUT_KINDS = new Set(["bool", "integer", "number", "string"]);
|
|
138
137
|
/**
|
|
139
138
|
* Resolve an automation-level output's `valueType` from its (already
|
|
140
139
|
* serialized) value: only when it's a plain ref to an executeScript task's
|
|
@@ -157,9 +156,9 @@ function resolveOutputValueType(value, scriptSchemas) {
|
|
|
157
156
|
if (schema === undefined)
|
|
158
157
|
return undefined;
|
|
159
158
|
const resolved = outputFieldTypesFromScriptSchema(schema)?.get(name);
|
|
160
|
-
if (resolved === undefined || !
|
|
159
|
+
if (resolved === undefined || !["bool", "integer", "number", "string", "array"].includes(resolved.kind))
|
|
161
160
|
return undefined;
|
|
162
|
-
return resolved.fieldType;
|
|
161
|
+
return { fieldType: resolved.fieldType, multiple: resolved.multiple };
|
|
163
162
|
}
|
|
164
163
|
/**
|
|
165
164
|
* Map every record-bearing task's refKey to the app refName that owns its
|
|
@@ -181,16 +180,39 @@ function collectRecordApps(tasks) {
|
|
|
181
180
|
visit(tasks);
|
|
182
181
|
return out;
|
|
183
182
|
}
|
|
183
|
+
function collectRecordKinds(tasks) {
|
|
184
|
+
const out = {};
|
|
185
|
+
const visit = (entries) => {
|
|
186
|
+
for (const { name, def } of entries) {
|
|
187
|
+
if (def.__recordKind !== undefined)
|
|
188
|
+
out[name] = def.__recordKind;
|
|
189
|
+
for (const child of def.operatorChildren ?? [])
|
|
190
|
+
visit(child.tasks);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
visit(tasks);
|
|
194
|
+
return out;
|
|
195
|
+
}
|
|
184
196
|
/**
|
|
185
197
|
* Tasks whose output carries a `.record` sub-object. Mirrors the deserializer's
|
|
186
198
|
* `RECORD_BEARING_TASK_TYPES` — kept local to avoid a builder → pull-path import.
|
|
187
199
|
*/
|
|
188
200
|
const RECORD_BEARING_TASK_KEYS = new Set(["recordSearch", "createRecord", "findRelatedRecords"]);
|
|
201
|
+
const FIND_RELATED_RECORDS_COUNT_REF_NAMES = new Set(["totalCount", "Records Size", "count"]);
|
|
202
|
+
function findRelatedRecordsTotalCountError(taskRefKey) {
|
|
203
|
+
const task = taskRefKey === undefined ? "findRelatedRecords" : `findRelatedRecords task "${taskRefKey}"`;
|
|
204
|
+
return new EntityTfError(`${task} does not expose totalCount. That output is recordSearch-only ` +
|
|
205
|
+
`(platform refs["Records Size"]). Use ctx.actions.<recordSearchTask>.totalCount ` +
|
|
206
|
+
`for a match count, or ctx.actions.${taskRefKey ?? "<findRelatedRecordsTask>"}.record / .records ` +
|
|
207
|
+
`for related rows. Do not invent a count ref.`);
|
|
208
|
+
}
|
|
189
209
|
/**
|
|
190
210
|
* Forward output-name rewrites, the inverse of the deserializer's read-side
|
|
191
211
|
* normalization (`applyOutputNameInverseRewrites` in
|
|
192
212
|
* `materialize/ref-deserializer.ts` — keep the two in sync):
|
|
193
213
|
* - recordSearch: `totalCount` → the platform's `Records Size`.
|
|
214
|
+
* findRelatedRecords does **not** expose this key — reject it instead of
|
|
215
|
+
* emitting a fake `refs["totalCount"]` / `refs["Records Size"]`.
|
|
194
216
|
* - aiSearchTable: `records` → the platform's `All Records` (NOT
|
|
195
217
|
* recordSearch's `All found records` — #398.1).
|
|
196
218
|
* - tableRecordsSearch interpolations map `records` → `All matching table
|
|
@@ -212,7 +234,10 @@ const RECORD_BEARING_TASK_KEYS = new Set(["recordSearch", "createRecord", "findR
|
|
|
212
234
|
* - single-scalar-output tasks (see `OUTPUT_KEY_WIRE_NAME`): `output` →
|
|
213
235
|
* the platform's actual output name for that task kind.
|
|
214
236
|
*/
|
|
215
|
-
function rewriteForwardTaskRefName(taskKey, name) {
|
|
237
|
+
function rewriteForwardTaskRefName(taskKey, name, taskRefKey) {
|
|
238
|
+
if (taskKey === "findRelatedRecords" && FIND_RELATED_RECORDS_COUNT_REF_NAMES.has(name.split(".")[0])) {
|
|
239
|
+
throw findRelatedRecordsTotalCountError(taskRefKey);
|
|
240
|
+
}
|
|
216
241
|
if (taskKey === "api") {
|
|
217
242
|
return API_TASK_REF_WIRE_NAMES[name] ?? name;
|
|
218
243
|
}
|
|
@@ -265,10 +290,10 @@ function rewriteTaskOutputRefs(node, taskKindByRefKey) {
|
|
|
265
290
|
const rec = node;
|
|
266
291
|
const ref = rec.taskReference;
|
|
267
292
|
if (ref && typeof ref.taskRefKey === "string" && typeof ref.name === "string") {
|
|
268
|
-
ref.name = rewriteForwardTaskRefName(taskKindByRefKey.get(ref.taskRefKey), ref.name);
|
|
293
|
+
ref.name = rewriteForwardTaskRefName(taskKindByRefKey.get(ref.taskRefKey), ref.name, ref.taskRefKey);
|
|
269
294
|
}
|
|
270
295
|
if (rec.type === "TASK" && typeof rec.taskRefKey === "string" && typeof rec.name === "string") {
|
|
271
|
-
rec.name = rewriteForwardTaskRefName(taskKindByRefKey.get(rec.taskRefKey), rec.name);
|
|
296
|
+
rec.name = rewriteForwardTaskRefName(taskKindByRefKey.get(rec.taskRefKey), rec.name, rec.taskRefKey);
|
|
272
297
|
}
|
|
273
298
|
for (const v of Object.values(rec))
|
|
274
299
|
rewriteTaskOutputRefs(v, taskKindByRefKey);
|
|
@@ -496,10 +521,12 @@ function makeActionBuilder(state, mode = "root", item) {
|
|
|
496
521
|
resolveVariableParamMarkers(outputs, variableIdMap);
|
|
497
522
|
}
|
|
498
523
|
const taskAppRefNameByRefKey = collectRecordApps(state.tasks);
|
|
524
|
+
const taskAppKindByRefKey = collectRecordKinds(state.tasks);
|
|
499
525
|
const recordFieldContext = state.trigger.__recordApp !== undefined || Object.keys(taskAppRefNameByRefKey).length > 0
|
|
500
526
|
? {
|
|
501
527
|
...(state.trigger.__recordApp !== undefined ? { triggerAppRefName: state.trigger.__recordApp } : {}),
|
|
502
528
|
...(Object.keys(taskAppRefNameByRefKey).length > 0 ? { taskAppRefNameByRefKey } : {}),
|
|
529
|
+
...(Object.keys(taskAppKindByRefKey).length > 0 ? { taskAppKindByRefKey } : {}),
|
|
503
530
|
}
|
|
504
531
|
: undefined;
|
|
505
532
|
return {
|
|
@@ -566,7 +593,7 @@ export function automation(opts) {
|
|
|
566
593
|
: undefined;
|
|
567
594
|
const outputs = outputEntries.length > 0
|
|
568
595
|
? Object.fromEntries(outputEntries.map(({ name: n, value }) => {
|
|
569
|
-
const
|
|
596
|
+
const resolvedOutput = resolveOutputValueType(value, scriptSchemas);
|
|
570
597
|
return [
|
|
571
598
|
n,
|
|
572
599
|
{
|
|
@@ -574,7 +601,10 @@ export function automation(opts) {
|
|
|
574
601
|
refName: n,
|
|
575
602
|
name: n,
|
|
576
603
|
parent: refName,
|
|
577
|
-
...(
|
|
604
|
+
...(resolvedOutput !== undefined ? {
|
|
605
|
+
valueType: resolvedOutput.fieldType,
|
|
606
|
+
...(resolvedOutput.multiple ? { multiple: true } : {}),
|
|
607
|
+
} : {}),
|
|
578
608
|
},
|
|
579
609
|
];
|
|
580
610
|
}))
|
|
@@ -29,7 +29,7 @@ export function renderAutomationCatalogEntry(args) {
|
|
|
29
29
|
lines.push(`${baseIndent} outputs: {`);
|
|
30
30
|
for (const key of outputKeys) {
|
|
31
31
|
const prop = ref.outputs[key];
|
|
32
|
-
lines.push(`${baseIndent} ${safeCatalogKey(key)}: outputPropertyRef({ name: ${JSON.stringify(prop.name)}, parent: ${JSON.stringify(prop.parent ?? "")}${prop.valueType !== undefined ? `, valueType: ${JSON.stringify(prop.valueType)}` : ""} }),`);
|
|
32
|
+
lines.push(`${baseIndent} ${safeCatalogKey(key)}: outputPropertyRef({ name: ${JSON.stringify(prop.name)}, parent: ${JSON.stringify(prop.parent ?? "")}${prop.valueType !== undefined ? `, valueType: ${JSON.stringify(prop.valueType)}` : ""}${prop.multiple === true ? ", multiple: true" : ""} }),`);
|
|
33
33
|
}
|
|
34
34
|
lines.push(`${baseIndent} },`);
|
|
35
35
|
}
|
|
@@ -72,8 +72,6 @@ export type TriggerAst = {
|
|
|
72
72
|
defaultValue?: unknown;
|
|
73
73
|
description?: string;
|
|
74
74
|
}>;
|
|
75
|
-
/** Round-tripped from the wire's `onDemand.showTriggeredBy` flag. */
|
|
76
|
-
showTriggeredBy?: boolean;
|
|
77
75
|
} | {
|
|
78
76
|
kind: "recordCreate" | "recordUpdate" | "attachment";
|
|
79
77
|
/** The owning app — `{kind: "unresolved", ...}` when the aspect never made it into the pull's catalog. */
|
|
@@ -90,6 +88,7 @@ export type TriggerAst = {
|
|
|
90
88
|
kind: "conversationEnd";
|
|
91
89
|
app: AppRefAst | UnresolvedRefAst;
|
|
92
90
|
conversationType: string;
|
|
91
|
+
filter?: Filter<RefExpr, RefExpr>;
|
|
93
92
|
} | {
|
|
94
93
|
kind: "webhook";
|
|
95
94
|
authenticated: boolean;
|
|
@@ -34,14 +34,32 @@ import type { AutomationAst } from "./ast.js";
|
|
|
34
34
|
import type { UnresolvedReferenceDiagnostic } from "../../../graph/types.js";
|
|
35
35
|
/** Keep the authored publish token across pull; live workflow versions are not author intent. */
|
|
36
36
|
export declare function preserveAuthoredAutomationRevision(freshSource: string, existingSource: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Extract a string-literal (or `+`-concatenated literals) description from
|
|
39
|
+
* authored automation source. Pull reprints often omit description entirely
|
|
40
|
+
* because Go export cannot read it back from the platform today.
|
|
41
|
+
*/
|
|
42
|
+
export declare function extractAuthoredAutomationDescription(source: string): string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Keep a non-empty authored `description` across pull.
|
|
45
|
+
*
|
|
46
|
+
* Platform discovery historically omitted automation description (and the TF
|
|
47
|
+
* provider still does not round-trip it through GraphQL), so Go HCL export
|
|
48
|
+
* drops the attribute. Without this merge, pull → reprint → build clears
|
|
49
|
+
* description from config while state still has it, forcing an adopt update.
|
|
50
|
+
* Prefer a freshly pulled description when present; only reinstate the
|
|
51
|
+
* authored value when the fresh source omitted it.
|
|
52
|
+
*/
|
|
53
|
+
export declare function preserveAuthoredAutomationDescription(freshSource: string, existingSource: string): string;
|
|
54
|
+
/** Pull merge: preserve authored revision + description across live reprint. */
|
|
55
|
+
export declare function preserveAuthoredAutomationPullMeta(freshSource: string, existingSource: string): string;
|
|
37
56
|
export interface PrintAutomationV2Options {
|
|
38
57
|
readonly refName?: string;
|
|
39
58
|
/**
|
|
40
|
-
* The owning app's
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* source app.
|
|
59
|
+
* The owning app's authored catalog key. Defaults to `ast.ownerHandle`.
|
|
60
|
+
* Pull passes the on-disk refName (`eDKCloudBuilder`) when extract used
|
|
61
|
+
* the export label (`edkcloudbuilder`); every owner catalog path
|
|
62
|
+
* (`app:`, `.fields`, `.agents`, …) follows this key.
|
|
45
63
|
*/
|
|
46
64
|
readonly appRefName?: string;
|
|
47
65
|
/**
|