@elementumai/edk 0.9.10 → 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 +42 -14
- package/dist-sdk/src/catalog/factories.js +77 -14
- package/dist-sdk/src/catalog/from-authoring.js +4 -4
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +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 +32 -5
- package/dist-sdk/src/catalog/types.js +1 -0
- 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/build/context.d.ts +3 -0
- 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/access-policy/from-tf.d.ts +3 -3
- package/dist-sdk/src/entities/access-policy/from-tf.js +27 -8
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +13 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +34 -3
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +13 -7
- package/dist-sdk/src/entities/agent/tools.d.ts +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +13 -0
- package/dist-sdk/src/entities/app/build.d.ts +22 -2
- package/dist-sdk/src/entities/app/build.js +6 -0
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +13 -3
- package/dist-sdk/src/entities/app/from-tf.js +10 -7
- package/dist-sdk/src/entities/app/to-tf.js +14 -14
- 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 +276 -19
- package/dist-sdk/src/entities/automation/index.d.ts +2 -2
- package/dist-sdk/src/entities/automation/module.js +3 -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 +48 -15
- package/dist-sdk/src/entities/automation/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/automation/to-tf.js +514 -103
- 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/automation/types.js +1 -0
- 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/dashboard/from-tf.js +11 -2
- package/dist-sdk/src/entities/datamine/from-tf.js +11 -1
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +2 -1
- package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +8 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.js +12 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +7 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +64 -10
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +54 -6
- package/dist-sdk/src/entities/element/build.d.ts +8 -0
- package/dist-sdk/src/entities/element/from-tf.js +4 -3
- package/dist-sdk/src/entities/element/module.js +1 -0
- package/dist-sdk/src/entities/element/to-tf.d.ts +4 -1
- package/dist-sdk/src/entities/element/to-tf.js +28 -2
- package/dist-sdk/src/entities/field/build.d.ts +10 -1
- package/dist-sdk/src/entities/field/build.js +2 -1
- package/dist-sdk/src/entities/field/calc/index.js +7 -7
- package/dist-sdk/src/entities/field/calc/runtime.d.ts +19 -0
- package/dist-sdk/src/entities/field/calc/runtime.js +32 -0
- package/dist-sdk/src/entities/field/calc/types.d.ts +6 -0
- package/dist-sdk/src/entities/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/file-reader/to-tf.js +10 -2
- package/dist-sdk/src/entities/relationship/build.d.ts +27 -9
- 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 +33 -48
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +33 -2
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +15 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +21 -0
- package/dist-sdk/src/entities/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 +52 -27
- 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 +48 -12
- package/dist-sdk/src/entities/skill/tools.js +12 -1
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +15 -12
- package/dist-sdk/src/entities/skill-tool/from-tf.js +50 -46
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +4 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +66 -7
- package/dist-sdk/src/entities/table/build.js +10 -2
- package/dist-sdk/src/entities/table/catalog-render.js +2 -1
- package/dist-sdk/src/entities/view/from-tf.js +9 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +7 -0
- package/dist-sdk/src/entities/view/to-tf.js +39 -12
- package/dist-sdk/src/entities/widget/build.d.ts +43 -7
- package/dist-sdk/src/entities/widget/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/widget/from-tf.js +162 -23
- package/dist-sdk/src/entities/widget/to-tf.d.ts +17 -0
- package/dist-sdk/src/entities/widget/to-tf.js +150 -6
- package/dist-sdk/src/graph/types.d.ts +13 -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
|
@@ -48,7 +48,7 @@ type UpdateModeForField<F extends FieldRef | UnsafePlatformId> = [F] extends [Mu
|
|
|
48
48
|
type UpdateValueForField<F extends FieldRef | UnsafePlatformId> = IsAny<F> extends true ? {
|
|
49
49
|
readonly value: ValueOrRef<unknown>;
|
|
50
50
|
} : [F] extends [MultiSelectFieldRef] ? {
|
|
51
|
-
readonly value: readonly string[] | Ref<readonly DropdownValue[], string>;
|
|
51
|
+
readonly value: readonly string[] | Ref<readonly string[], string> | Ref<readonly DropdownValue[], string>;
|
|
52
52
|
} : {
|
|
53
53
|
readonly value: ValueOrRef<unknown>;
|
|
54
54
|
};
|
|
@@ -103,8 +103,12 @@ export interface CreateRecordOptions<A extends AppOrElementRef = AppOrElementRef
|
|
|
103
103
|
readonly fields: readonly FieldAssignment[];
|
|
104
104
|
/** Relate the new record to `record` (the triggering/source record). */
|
|
105
105
|
readonly relateToRecord?: boolean;
|
|
106
|
-
/**
|
|
107
|
-
|
|
106
|
+
/**
|
|
107
|
+
* A record reference to relate to, when `relateToRecord` is set. This is
|
|
108
|
+
* typically the TRIGGERING record, which belongs to a DIFFERENT app/element
|
|
109
|
+
* than the one being created here (`app: A`) - deliberately not tied to `A`.
|
|
110
|
+
*/
|
|
111
|
+
readonly record?: RecordReference;
|
|
108
112
|
}
|
|
109
113
|
export declare function createRecord<A extends AppOrElementRef>(opts: CreateRecordOptions<A>): ActionDef<CreateRecordOutput<A>>;
|
|
110
114
|
type ValidatedUpdateFieldAssignments<Fields extends readonly FieldAssignment[]> = {
|
|
@@ -116,18 +120,32 @@ export interface UpdateFieldOptions<A extends AppOrElementRef = AppOrElementRef,
|
|
|
116
120
|
readonly record: RecordReference<A>;
|
|
117
121
|
readonly fields: Fields & ValidatedUpdateFieldAssignments<NoInfer<Fields>>;
|
|
118
122
|
}
|
|
123
|
+
/** Update fields on an existing record. `value: ""` or `value: null` clears a nullable field (including Dropdown). */
|
|
119
124
|
export declare function updateField<A extends AppOrElementRef, const Fields extends readonly FieldAssignment[]>(opts: UpdateFieldOptions<A, Fields>): ActionDef<{
|
|
120
125
|
record: RecordShape<A>;
|
|
121
126
|
}>;
|
|
122
127
|
export interface FindRelatedRecordsOptions<A extends AppOrElementRef = AppOrElementRef> {
|
|
123
128
|
readonly relatedApp: A;
|
|
124
|
-
/**
|
|
125
|
-
|
|
129
|
+
/**
|
|
130
|
+
* The record whose related records to find. Belongs to the app/element the
|
|
131
|
+
* relation starts from, not to `relatedApp` (`A`), so it is not tied to `A`.
|
|
132
|
+
*/
|
|
133
|
+
readonly record: RecordReference;
|
|
126
134
|
readonly filter?: Filter;
|
|
127
135
|
readonly sort?: Record<string, unknown>;
|
|
128
136
|
readonly limit?: number;
|
|
129
137
|
}
|
|
130
|
-
|
|
138
|
+
/**
|
|
139
|
+
* findRelatedRecords collection + first-record outputs.
|
|
140
|
+
* Intentionally not `RecordSearchOutput`: the platform's available refs
|
|
141
|
+
* include `Record` and `All found records`, but not recordSearch's
|
|
142
|
+
* `Records Size` (`totalCount`). Do not invent a count ref.
|
|
143
|
+
*/
|
|
144
|
+
export interface FindRelatedRecordsOutput<A extends AppOrElementRef = AppOrElementRef> {
|
|
145
|
+
readonly records: readonly RecordShape<A>[];
|
|
146
|
+
readonly record: RecordShape<A>;
|
|
147
|
+
}
|
|
148
|
+
export declare function findRelatedRecords<A extends AppOrElementRef>(opts: FindRelatedRecordsOptions<A>): ActionDef<FindRelatedRecordsOutput<A>>;
|
|
131
149
|
export interface RelateRecordsOptions {
|
|
132
150
|
/** One or more source record references. */
|
|
133
151
|
readonly sources: readonly ValueOrRef<unknown>[];
|
|
@@ -212,8 +230,18 @@ export interface SetVariableOptions {
|
|
|
212
230
|
readonly update?: readonly VariableAssign[];
|
|
213
231
|
}
|
|
214
232
|
export declare function setVariable(opts: SetVariableOptions): ActionDef<Record<string, never>>;
|
|
233
|
+
/** Scalar types supported by an executeScript output schema. */
|
|
234
|
+
export type ScriptOutputScalarType = "text" | "string" | "integer" | "number" | "decimal" | "boolean" | "object";
|
|
235
|
+
/** A recursively typed executeScript output schema node. */
|
|
236
|
+
export type ScriptOutputType = ScriptOutputScalarType | {
|
|
237
|
+
readonly type: "array";
|
|
238
|
+
readonly items: ScriptOutputType;
|
|
239
|
+
} | {
|
|
240
|
+
readonly type: "object";
|
|
241
|
+
readonly properties?: ScriptOutputProperties;
|
|
242
|
+
};
|
|
215
243
|
/** An output schema's properties: output name → type. */
|
|
216
|
-
export type ScriptOutputProperties = Record<string,
|
|
244
|
+
export type ScriptOutputProperties = Record<string, ScriptOutputType>;
|
|
217
245
|
/**
|
|
218
246
|
* A script's declared outputs — either the properties alone, or those
|
|
219
247
|
* properties plus the root object's own `name`.
|
|
@@ -226,22 +254,33 @@ export type ScriptOutputProperties = Record<string, string>;
|
|
|
226
254
|
* a pull reads back has to survive a rebuild unchanged; a task whose root
|
|
227
255
|
* carries a name prints the second form.
|
|
228
256
|
*
|
|
229
|
-
* The two forms are distinguished by `properties` holding an object
|
|
230
|
-
*
|
|
257
|
+
* The two forms are distinguished by `properties` holding an object. Flat
|
|
258
|
+
* values may be scalar type strings or recursive `{ type: "array", ... }` /
|
|
259
|
+
* `{ type: "object", ... }` descriptors, so an output actually named
|
|
231
260
|
* `properties` or `name` stays unambiguous.
|
|
232
261
|
*/
|
|
233
262
|
export type ScriptOutputs = ScriptOutputProperties | {
|
|
234
263
|
readonly name?: string;
|
|
235
264
|
readonly properties: ScriptOutputProperties;
|
|
236
265
|
};
|
|
237
|
-
type ExecuteScriptFieldValue<T extends
|
|
266
|
+
type ExecuteScriptFieldValue<T extends ScriptOutputType> = T extends {
|
|
267
|
+
readonly type: "array";
|
|
268
|
+
readonly items: infer I extends ScriptOutputType;
|
|
269
|
+
} ? readonly ExecuteScriptFieldValue<I>[] : T extends {
|
|
270
|
+
readonly type: "object";
|
|
271
|
+
readonly properties: infer P extends ScriptOutputProperties;
|
|
272
|
+
} ? {
|
|
273
|
+
readonly [K in keyof P]: ExecuteScriptFieldValue<P[K]>;
|
|
274
|
+
} : T extends {
|
|
275
|
+
readonly type: "object";
|
|
276
|
+
} ? Record<string, unknown> : T extends "integer" | "number" | "decimal" ? number : T extends "boolean" ? boolean : string;
|
|
238
277
|
/** The properties of an authored `outputs` option, in either accepted form. */
|
|
239
278
|
type ScriptOutputPropertiesOf<O> = O extends {
|
|
240
|
-
readonly properties:
|
|
241
|
-
} ? O["properties"] : O extends
|
|
279
|
+
readonly properties: ScriptOutputProperties;
|
|
280
|
+
} ? O["properties"] : O extends ScriptOutputProperties ? O : undefined;
|
|
242
281
|
type ExecuteScriptOutput<O extends ScriptOutputs | undefined> = {
|
|
243
|
-
readonly result: ScriptOutputPropertiesOf<O> extends
|
|
244
|
-
readonly [K in keyof ScriptOutputPropertiesOf<O>]: ExecuteScriptFieldValue<Extract<ScriptOutputPropertiesOf<O>[K],
|
|
282
|
+
readonly result: ScriptOutputPropertiesOf<O> extends ScriptOutputProperties ? {
|
|
283
|
+
readonly [K in keyof ScriptOutputPropertiesOf<O>]: ExecuteScriptFieldValue<Extract<ScriptOutputPropertiesOf<O>[K], ScriptOutputType>>;
|
|
245
284
|
} : Record<string, unknown>;
|
|
246
285
|
};
|
|
247
286
|
export interface ExecuteScriptOptions<O extends ScriptOutputs | undefined = undefined> {
|
|
@@ -408,9 +447,7 @@ export interface AiTransformOptions {
|
|
|
408
447
|
readonly fieldType: string;
|
|
409
448
|
readonly connector?: ConnectorRef;
|
|
410
449
|
}
|
|
411
|
-
export declare function aiTransform(opts: AiTransformOptions): ActionDef<
|
|
412
|
-
output: unknown;
|
|
413
|
-
}>;
|
|
450
|
+
export declare function aiTransform(opts: AiTransformOptions): ActionDef<Record<string, unknown>>;
|
|
414
451
|
export interface AiEmailAnalysisOptions {
|
|
415
452
|
readonly emailBody: ValueOrRef<unknown>;
|
|
416
453
|
readonly emailSubject: ValueOrRef<unknown>;
|
|
@@ -584,12 +621,8 @@ export type TypedProcedureOptions<Parameters extends readonly ProcedureParameter
|
|
|
584
621
|
readonly parameters: ProcedureParameterValues<Parameters>;
|
|
585
622
|
});
|
|
586
623
|
export type ProcedureOptions = LegacyProcedureOptions | TypedProcedureOptions<readonly ProcedureParameterType[]>;
|
|
587
|
-
export declare function procedure<const Parameters extends readonly ProcedureParameterType[]>(opts: TypedProcedureOptions<Parameters>): ActionDef<
|
|
588
|
-
|
|
589
|
-
}>;
|
|
590
|
-
export declare function procedure(opts: LegacyProcedureOptions): ActionDef<{
|
|
591
|
-
output: unknown;
|
|
592
|
-
}>;
|
|
624
|
+
export declare function procedure<const Parameters extends readonly ProcedureParameterType[]>(opts: TypedProcedureOptions<Parameters>): ActionDef<Record<string, unknown>>;
|
|
625
|
+
export declare function procedure(opts: LegacyProcedureOptions): ActionDef<Record<string, unknown>>;
|
|
593
626
|
export interface InitiateCallOptions {
|
|
594
627
|
readonly agent: AgentRef;
|
|
595
628
|
readonly phoneService: PhoneServiceRef;
|
|
@@ -690,7 +723,8 @@ export interface RunAutomationInput {
|
|
|
690
723
|
* output's source wasn't a typed executeScript result) stays `unknown` —
|
|
691
724
|
* an honest "we don't know", never a wrong guess.
|
|
692
725
|
*/
|
|
693
|
-
type
|
|
726
|
+
type WorkflowOutputScalar<T extends string | undefined> = T extends "BOOLEAN" ? boolean : T extends "NUMBER" | "DECIMAL" ? number : T extends "TEXT" ? string : unknown;
|
|
727
|
+
type WorkflowOutputValue<T extends string | undefined, Multiple extends boolean | undefined> = Multiple extends true ? readonly WorkflowOutputScalar<T>[] : WorkflowOutputScalar<T>;
|
|
694
728
|
/**
|
|
695
729
|
* A `runAutomation` step's result: flat, one property per key the target
|
|
696
730
|
* automation's `AutomationCatalogRef.outputs` declares — matches the real
|
|
@@ -698,7 +732,7 @@ type WorkflowOutputValue<T extends string | undefined> = T extends "BOOLEAN" ? b
|
|
|
698
732
|
* confirmed live), not a nested `.output` wrapper.
|
|
699
733
|
*/
|
|
700
734
|
export type RunAutomationOutput<A extends AutomationCatalogRef> = A["outputs"] extends Record<string, OutputPropertyRef> ? {
|
|
701
|
-
readonly [K in keyof A["outputs"]]: WorkflowOutputValue<A["outputs"][K]["valueType"]>;
|
|
735
|
+
readonly [K in keyof A["outputs"]]: WorkflowOutputValue<A["outputs"][K]["valueType"], A["outputs"][K]["multiple"]>;
|
|
702
736
|
} : Record<string, unknown>;
|
|
703
737
|
export interface RunAutomationOptions<A extends AutomationCatalogRef = AutomationCatalogRef> {
|
|
704
738
|
readonly automation: A;
|
|
@@ -735,9 +769,7 @@ export interface ReadFileOptions {
|
|
|
735
769
|
readonly record?: ValueOrRef<unknown>;
|
|
736
770
|
readonly dataSource: ReadFileDataSource;
|
|
737
771
|
}
|
|
738
|
-
export declare function readFile(opts: ReadFileOptions): ActionDef<
|
|
739
|
-
output: unknown;
|
|
740
|
-
}>;
|
|
772
|
+
export declare function readFile(opts: ReadFileOptions): ActionDef<Record<string, unknown>>;
|
|
741
773
|
export type BulkExcelFieldSource = {
|
|
742
774
|
readonly type: "documentModelField";
|
|
743
775
|
readonly field: DocumentModelFieldRef;
|
|
@@ -56,6 +56,7 @@ export function createRecord(opts) {
|
|
|
56
56
|
__recordApp: opts.app.refName,
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
+
/** Update fields on an existing record. `value: ""` or `value: null` clears a nullable field (including Dropdown). */
|
|
59
60
|
export function updateField(opts) {
|
|
60
61
|
if (opts.fields.length === 0)
|
|
61
62
|
throw new Error("updateField requires at least one field.");
|
|
@@ -80,6 +81,7 @@ export function findRelatedRecords(opts) {
|
|
|
80
81
|
...(opts.limit !== undefined ? { limit: opts.limit } : {}),
|
|
81
82
|
},
|
|
82
83
|
__recordApp: opts.relatedApp.refName,
|
|
84
|
+
__recordKind: opts.relatedApp.__kind === "element" ? "element" : "app",
|
|
83
85
|
};
|
|
84
86
|
}
|
|
85
87
|
export function relateRecords(opts) {
|
|
@@ -191,24 +193,38 @@ function normalizeScriptOutputs(outputs) {
|
|
|
191
193
|
properties: properties,
|
|
192
194
|
};
|
|
193
195
|
}
|
|
194
|
-
/** Map
|
|
195
|
-
function
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
/** Map one public output-schema node to the platform's tagged union shape. */
|
|
197
|
+
function outputSchemaNode(name, type) {
|
|
198
|
+
if (typeof type === "string") {
|
|
199
|
+
const named = name === undefined ? {} : { name };
|
|
198
200
|
switch (type) {
|
|
199
|
-
case "integer":
|
|
200
|
-
return { integer: { name } };
|
|
201
|
+
case "integer": return { integer: named };
|
|
201
202
|
case "number":
|
|
202
|
-
case "decimal":
|
|
203
|
-
|
|
204
|
-
case "
|
|
205
|
-
|
|
206
|
-
case "
|
|
207
|
-
|
|
208
|
-
default:
|
|
209
|
-
return { string: { name } };
|
|
203
|
+
case "decimal": return { number: named };
|
|
204
|
+
case "boolean": return { bool: named };
|
|
205
|
+
case "object": return { object: named };
|
|
206
|
+
case "text":
|
|
207
|
+
case "string":
|
|
208
|
+
default: return { string: named };
|
|
210
209
|
}
|
|
211
|
-
}
|
|
210
|
+
}
|
|
211
|
+
if (type.type === "array") {
|
|
212
|
+
return { array: { ...(name === undefined ? {} : { name }), item: outputSchemaNode(undefined, type.items) } };
|
|
213
|
+
}
|
|
214
|
+
const properties = type.properties === undefined
|
|
215
|
+
? undefined
|
|
216
|
+
: Object.entries(type.properties).map(([propertyName, propertyType]) => outputSchemaNode(propertyName, propertyType));
|
|
217
|
+
return {
|
|
218
|
+
object: {
|
|
219
|
+
...(name === undefined ? {} : { name }),
|
|
220
|
+
...(properties === undefined ? {} : { properties }),
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
/** Map an output schema to the platform's tagged object shape. */
|
|
225
|
+
function outputSchema(outputs) {
|
|
226
|
+
const { name: rootName, properties: declared } = normalizeScriptOutputs(outputs);
|
|
227
|
+
const properties = Object.entries(declared).map(([name, type]) => outputSchemaNode(name, type));
|
|
212
228
|
return { object: { ...(rootName !== undefined ? { name: rootName } : {}), properties } };
|
|
213
229
|
}
|
|
214
230
|
/**
|
|
@@ -360,7 +376,22 @@ export function aiEmailAnalysis(opts) {
|
|
|
360
376
|
},
|
|
361
377
|
};
|
|
362
378
|
}
|
|
379
|
+
function isFileReaderCatalogRef(value) {
|
|
380
|
+
return (typeof value === "object" &&
|
|
381
|
+
value !== null &&
|
|
382
|
+
value.__kind === "documentModel" &&
|
|
383
|
+
typeof value.refName === "string");
|
|
384
|
+
}
|
|
385
|
+
function isUnresolvedFileReaderPlaceholder(value) {
|
|
386
|
+
return typeof value === "string";
|
|
387
|
+
}
|
|
388
|
+
function assertFileReaderReference(value, taskName) {
|
|
389
|
+
if (isFileReaderCatalogRef(value) || isUnresolvedFileReaderPlaceholder(value))
|
|
390
|
+
return;
|
|
391
|
+
throw new Error(`${taskName} requires a FileReaderCatalogRef or an unresolved pulled placeholder.`);
|
|
392
|
+
}
|
|
363
393
|
export function aiFileAnalysis(opts) {
|
|
394
|
+
assertFileReaderReference(opts.documentModel, "aiFileAnalysis");
|
|
364
395
|
return {
|
|
365
396
|
key: "aiFileAnalysis",
|
|
366
397
|
config: {
|
|
@@ -715,6 +746,7 @@ export function runAutomation(opts) {
|
|
|
715
746
|
};
|
|
716
747
|
}
|
|
717
748
|
export function readFile(opts) {
|
|
749
|
+
assertFileReaderReference(opts.fileReader, "readFile");
|
|
718
750
|
return {
|
|
719
751
|
key: "documentModel",
|
|
720
752
|
config: {
|
|
@@ -727,6 +759,7 @@ export function readFile(opts) {
|
|
|
727
759
|
export function bulkExcel(opts) {
|
|
728
760
|
if (opts.fieldMappings.length === 0)
|
|
729
761
|
throw new Error("bulkExcel requires at least one fieldMapping.");
|
|
762
|
+
assertFileReaderReference(opts.documentModel, "bulkExcel");
|
|
730
763
|
return {
|
|
731
764
|
key: "bulkExcel",
|
|
732
765
|
config: {
|
|
@@ -18,6 +18,14 @@ export interface AutomationToTfContext {
|
|
|
18
18
|
* typed against a DIFFERENT aspect resolve cross-app refs (#490).
|
|
19
19
|
*/
|
|
20
20
|
readonly fieldNamesByAppRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>;
|
|
21
|
+
/**
|
|
22
|
+
* Field resource ADDRESSES for every app/element in this build, keyed the
|
|
23
|
+
* same way as {@link fieldNamesByAppRefName}. The calc engine addresses a
|
|
24
|
+
* found record's field by field id rather than display name, so a
|
|
25
|
+
* cross-aspect `recordSearch` output used inside a calculation needs the
|
|
26
|
+
* searched aspect's own `<resource>.<label>.id` to interpolate.
|
|
27
|
+
*/
|
|
28
|
+
readonly fieldAddressesByAppRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>;
|
|
21
29
|
/** Build-time tolerance for stale labels retained by pulled automations. */
|
|
22
30
|
readonly allowUnknownPicklistOptions?: boolean;
|
|
23
31
|
readonly orgRefs?: OrgRefLookup;
|