@elementumai/edk 0.9.14 → 0.9.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-sdk/pull/util.d.ts +0 -15
- package/dist-sdk/pull/util.js +44 -5
- package/dist-sdk/src/catalog/factories.d.ts +4 -2
- package/dist-sdk/src/catalog/factories.js +4 -0
- package/dist-sdk/src/catalog/from-authoring.js +5 -1
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +1 -1
- package/dist-sdk/src/catalog/token.js +2 -2
- package/dist-sdk/src/catalog/types.d.ts +7 -2
- package/dist-sdk/src/core/types/app.d.ts +4 -4
- package/dist-sdk/src/engine/build/context.d.ts +5 -4
- package/dist-sdk/src/engine/build/source-context.d.ts +2 -0
- package/dist-sdk/src/engine/build/source-context.js +16 -0
- package/dist-sdk/src/engine/progress.d.ts +19 -1
- package/dist-sdk/src/engine/progress.js +33 -5
- package/dist-sdk/src/engine/pull/context.d.ts +9 -1
- package/dist-sdk/src/engine/pull/ref-only.d.ts +6 -2
- package/dist-sdk/src/engine/pull/ref-only.js +14 -3
- package/dist-sdk/src/engine/workspace/loader.js +23 -2
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/access-policy/from-tf.js +47 -12
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +5 -3
- package/dist-sdk/src/entities/access-policy/to-tf.js +23 -1
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +6 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +50 -4
- package/dist-sdk/src/entities/agent/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/agent/from-tf.js +18 -3
- package/dist-sdk/src/entities/agent/module.js +1 -0
- package/dist-sdk/src/entities/agent/to-tf.js +15 -0
- package/dist-sdk/src/entities/agent/tools.d.ts +98 -5
- package/dist-sdk/src/entities/agent/tools.js +12 -3
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +15 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +47 -4
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +9 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +82 -25
- package/dist-sdk/src/entities/app/build.d.ts +2 -2
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +4 -4
- package/dist-sdk/src/entities/app/module.js +8 -0
- package/dist-sdk/src/entities/app/to-tf.js +1 -0
- package/dist-sdk/src/entities/approval-chain/build.d.ts +8 -1
- package/dist-sdk/src/entities/approval-chain/build.js +3 -0
- package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +2 -1
- package/dist-sdk/src/entities/approval-chain/from-tf.js +20 -7
- package/dist-sdk/src/entities/approval-chain/printer.js +13 -2
- package/dist-sdk/src/entities/approval-chain/to-tf.js +3 -0
- package/dist-sdk/src/entities/automation/build.d.ts +19 -12
- package/dist-sdk/src/entities/automation/build.js +36 -13
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +4 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +19 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +222 -65
- package/dist-sdk/src/entities/automation/from-tf.d.ts +86 -6
- package/dist-sdk/src/entities/automation/from-tf.js +360 -63
- package/dist-sdk/src/entities/automation/index.d.ts +3 -2
- package/dist-sdk/src/entities/automation/index.js +3 -2
- package/dist-sdk/src/entities/automation/module.js +21 -16
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +5 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +12 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +20 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +22 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +32 -0
- package/dist-sdk/src/entities/automation/script-code.js +72 -5
- package/dist-sdk/src/entities/automation/tasks.d.ts +60 -24
- package/dist-sdk/src/entities/automation/tasks.js +33 -14
- package/dist-sdk/src/entities/automation/to-tf.d.ts +0 -2
- package/dist-sdk/src/entities/automation/to-tf.js +123 -46
- package/dist-sdk/src/entities/automation/triggers.d.ts +5 -2
- package/dist-sdk/src/entities/automation/types.d.ts +2 -0
- package/dist-sdk/src/entities/automation/types.js +5 -0
- package/dist-sdk/src/entities/automation/workflow-output.d.ts +35 -0
- package/dist-sdk/src/entities/automation/workflow-output.js +53 -0
- package/dist-sdk/src/entities/chart/build.d.ts +3 -3
- package/dist-sdk/src/entities/chart/from-tf.d.ts +2 -2
- package/dist-sdk/src/entities/chart/from-tf.js +20 -13
- package/dist-sdk/src/entities/chart/to-tf.js +7 -5
- package/dist-sdk/src/entities/dashboard/from-tf.js +1 -1
- package/dist-sdk/src/entities/dashboard/to-tf.js +1 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +3 -2
- package/dist-sdk/src/entities/element/build.d.ts +11 -8
- package/dist-sdk/src/entities/element/build.js +14 -5
- package/dist-sdk/src/entities/element/locals.d.ts +2 -2
- package/dist-sdk/src/entities/element/locals.js +6 -2
- package/dist-sdk/src/entities/element/system-fields.d.ts +4 -0
- package/dist-sdk/src/entities/element/system-fields.js +12 -0
- package/dist-sdk/src/entities/element/to-tf.js +1 -0
- package/dist-sdk/src/entities/field/build.d.ts +2 -2
- package/dist-sdk/src/entities/field/from-tf.js +82 -4
- package/dist-sdk/src/entities/field/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/field/to-tf.js +11 -4
- package/dist-sdk/src/entities/record-create-form/from-tf.js +3 -2
- package/dist-sdk/src/entities/relationship/from-tf.js +8 -5
- package/dist-sdk/src/entities/relationship/to-tf.js +13 -3
- package/dist-sdk/src/entities/search-table/from-tf.js +6 -6
- package/dist-sdk/src/entities/search-table/module.js +2 -2
- package/dist-sdk/src/entities/search-table/types.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/types.js +1 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +3 -3
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +10 -6
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +4 -2
- package/dist-sdk/src/entities/shared/filters/index.d.ts +12 -2
- package/dist-sdk/src/entities/shared/filters/index.js +17 -1
- package/dist-sdk/src/entities/shared/filters/print.js +25 -11
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +1 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +39 -7
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +1 -1
- package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -2
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +6 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +47 -18
- package/dist-sdk/src/entities/skill/module.js +10 -0
- package/dist-sdk/src/entities/skill/to-tf.js +19 -0
- package/dist-sdk/src/entities/skill/tools.d.ts +29 -7
- package/dist-sdk/src/entities/skill/tools.js +6 -2
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +18 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +77 -4
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +90 -46
- package/dist-sdk/src/entities/task/module.js +1 -1
- package/dist-sdk/src/entities/view/from-tf.js +30 -9
- package/dist-sdk/src/entities/view/to-tf.js +18 -10
- package/dist-sdk/src/entities/widget/from-tf.js +3 -3
- package/dist-sdk/src/entities/widget/to-tf.js +1 -0
- package/dist-sdk/src/graph/index.d.ts +15 -0
- package/dist-sdk/src/graph/index.js +19 -0
- package/dist-sdk/src/graph/types.d.ts +37 -1
- package/package.json +2 -1
|
@@ -32,13 +32,14 @@ import { buildContext, createForEachItemProxy } from "../shared/context.js";
|
|
|
32
32
|
import { outputFieldTypesFromScriptSchema } from "./output-field-types.js";
|
|
33
33
|
import { isRef } from "../shared/ref.js";
|
|
34
34
|
import { API_TASK_REF_WIRE_NAMES, OUTPUT_KEY_WIRE_NAME } from "./output-key-wire-name.js";
|
|
35
|
-
import { extractScriptBody, inferOutputSchema, tryExtractFromCurrentSource } from "./script-code.js";
|
|
35
|
+
import { extractScriptBody, inferOutputSchema, isScriptFile, readScriptFile, tryExtractFromCurrentSource } from "./script-code.js";
|
|
36
36
|
import { serializeNode } from "./serialize.js";
|
|
37
37
|
// Runtime factory imports stay below the public action-native surface. Their
|
|
38
38
|
// ActionDef return values are an internal serialization detail; authored
|
|
39
39
|
// automations call the direct fluent methods declared on ActionBuilder.
|
|
40
40
|
import * as operatorFactories from "./operators.js";
|
|
41
41
|
import * as actionFactories from "./tasks.js";
|
|
42
|
+
import { isWorkflowOutputDeclaration, workflowOutputFieldType, } from "./workflow-output.js";
|
|
42
43
|
/** Placeholder `forEachTaskRefKey` the forEach item proxy emits; replaced with the real refKey. */
|
|
43
44
|
export const FOR_EACH_PLACEHOLDER = "__forEach__";
|
|
44
45
|
/**
|
|
@@ -128,23 +129,24 @@ function collectExecuteScriptOutputSchemas(tasks) {
|
|
|
128
129
|
visit(tasks);
|
|
129
130
|
return out;
|
|
130
131
|
}
|
|
131
|
-
/**
|
|
132
|
-
* Schema kinds `outputFieldTypesFromScriptSchema` maps to an EXACT field
|
|
133
|
-
* type — as opposed to its own catch-all default (`"TEXT"` for anything
|
|
134
|
-
* unrecognized, including `"object"`), which is real for the wire's own
|
|
135
|
-
* default but would be a wrong guess if promoted to `OutputPropertyRef.valueType`.
|
|
136
|
-
*/
|
|
137
132
|
/**
|
|
138
133
|
* Resolve an automation-level output's `valueType` from its (already
|
|
139
|
-
* serialized) value
|
|
140
|
-
* `result.<prop>` whose declared schema has an
|
|
141
|
-
* kind
|
|
142
|
-
* a
|
|
143
|
-
*
|
|
134
|
+
* serialized) value. Explicit workflowOutput metadata wins. Otherwise, infer
|
|
135
|
+
* only a plain executeScript `result.<prop>` whose declared schema has an
|
|
136
|
+
* exact kind; the schema reader's catch-all TEXT default is not enough to
|
|
137
|
+
* stamp a catalog type. Anything else returns `undefined` (unknown, not a
|
|
138
|
+
* guess).
|
|
144
139
|
*/
|
|
145
140
|
function resolveOutputValueType(value, scriptSchemas) {
|
|
146
141
|
if (value === null || typeof value !== "object")
|
|
147
142
|
return undefined;
|
|
143
|
+
const explicitFieldType = value.fieldType;
|
|
144
|
+
if (typeof explicitFieldType === "string") {
|
|
145
|
+
return {
|
|
146
|
+
fieldType: explicitFieldType,
|
|
147
|
+
multiple: value.multiple === true,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
148
150
|
const ref = value.taskReference;
|
|
149
151
|
if (ref === null || typeof ref !== "object")
|
|
150
152
|
return undefined;
|
|
@@ -372,6 +374,23 @@ function resolveVariableParamMarkers(node, idMap) {
|
|
|
372
374
|
resolveVariableParamMarkers(v, idMap);
|
|
373
375
|
}
|
|
374
376
|
function serializeOutputValue(value) {
|
|
377
|
+
if (isWorkflowOutputDeclaration(value)) {
|
|
378
|
+
if (!isRef(value.value)) {
|
|
379
|
+
throw new EntityTfError("workflowOutput value must be a typed automation reference");
|
|
380
|
+
}
|
|
381
|
+
const serialized = serializeNode(value.value);
|
|
382
|
+
if (serialized === null || typeof serialized !== "object" || Array.isArray(serialized)) {
|
|
383
|
+
throw new EntityTfError("workflowOutput reference did not serialize to an object");
|
|
384
|
+
}
|
|
385
|
+
if (!("taskReference" in serialized) && !("triggerReference" in serialized)) {
|
|
386
|
+
throw new EntityTfError("workflowOutput explicit metadata is supported only for task and trigger references");
|
|
387
|
+
}
|
|
388
|
+
return {
|
|
389
|
+
...serialized,
|
|
390
|
+
fieldType: workflowOutputFieldType(value.type),
|
|
391
|
+
multiple: value.multiple,
|
|
392
|
+
};
|
|
393
|
+
}
|
|
375
394
|
return isRef(value) ? serializeNode(value) : { value };
|
|
376
395
|
}
|
|
377
396
|
function makeActionBuilder(state, mode = "root", item) {
|
|
@@ -430,7 +449,11 @@ function makeActionBuilder(state, mode = "root", item) {
|
|
|
430
449
|
// and suppresses inference (pulled sources with no platform
|
|
431
450
|
// output_schema print this, so adopted no-schema scripts do not
|
|
432
451
|
// drift); omitting `outputs` entirely infers from the body.
|
|
433
|
-
|
|
452
|
+
// A `scriptFile(...)` reference IS the exact text (no source scan, no
|
|
453
|
+
// toString(), no closure hazard: it is never a JS closure).
|
|
454
|
+
const body = isScriptFile(opts.code)
|
|
455
|
+
? readScriptFile(opts.code)
|
|
456
|
+
: tryExtractFromCurrentSource(name) ?? extractScriptBody(opts.code);
|
|
434
457
|
const outputs = opts.outputs === undefined ? inferOutputSchema(body) : (opts.outputs ?? undefined);
|
|
435
458
|
const def = actionFactories.executeScriptActionDefWithBody(body, {
|
|
436
459
|
...(opts.inputs !== undefined ? { inputs: opts.inputs(context()) } : {}),
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import type { RefExpr, SortAst, ApprovalChainRefAst, DatamineRefAst, TableRefAst, AppRefAst, FieldRefAst, UserFieldRefAst, UnresolvedRefAst } from "../../shared/filters/ast.js";
|
|
14
14
|
import type { Filter } from "../../shared/filters/types.js";
|
|
15
15
|
import type { AutomationStatus } from "../build.js";
|
|
16
|
+
import type { WorkflowOutputType } from "../workflow-output.js";
|
|
16
17
|
export type { RefExpr, SortAst, AppRefAst, ApprovalChainRefAst, DatamineRefAst, TableRefAst, FieldRefAst, UserFieldRefAst, UnresolvedRefAst, };
|
|
17
18
|
/**
|
|
18
19
|
* A TaskCall represents one call to a task factory like `executeScript({...})`.
|
|
@@ -154,5 +155,8 @@ export interface AutomationAst {
|
|
|
154
155
|
readonly outputs?: readonly {
|
|
155
156
|
name: string;
|
|
156
157
|
value: unknown;
|
|
158
|
+
/** Present only when bare-reference inference cannot reproduce live metadata. */
|
|
159
|
+
explicitType?: WorkflowOutputType;
|
|
160
|
+
explicitMultiple?: boolean;
|
|
157
161
|
}[];
|
|
158
162
|
}
|
|
@@ -53,6 +53,13 @@ export declare function extractAuthoredAutomationDescription(source: string): st
|
|
|
53
53
|
export declare function preserveAuthoredAutomationDescription(freshSource: string, existingSource: string): string;
|
|
54
54
|
/** Pull merge: preserve authored revision + description across live reprint. */
|
|
55
55
|
export declare function preserveAuthoredAutomationPullMeta(freshSource: string, existingSource: string): string;
|
|
56
|
+
/** A plain-JS script file printed beside the automation, relative to the automations folder. */
|
|
57
|
+
export interface PrintedScriptFile {
|
|
58
|
+
readonly path: string;
|
|
59
|
+
readonly content: string;
|
|
60
|
+
}
|
|
61
|
+
/** Folder (inside the automations folder) that holds printed script files. */
|
|
62
|
+
export declare const SCRIPT_FILES_DIR = "scripts";
|
|
56
63
|
export interface PrintAutomationV2Options {
|
|
57
64
|
readonly refName?: string;
|
|
58
65
|
/**
|
|
@@ -69,6 +76,7 @@ export interface PrintAutomationV2Options {
|
|
|
69
76
|
*/
|
|
70
77
|
readonly foreignAppRefNames?: ReadonlyMap<string, string>;
|
|
71
78
|
readonly foreignElementRefNames?: ReadonlyMap<string, string>;
|
|
79
|
+
readonly foreignTaskRefNames?: ReadonlyMap<string, string>;
|
|
72
80
|
/** Diagnostics emitted by the bridge for raw UUIDs retained in this pull. */
|
|
73
81
|
readonly unresolvedReferences?: readonly UnresolvedReferenceDiagnostic[];
|
|
74
82
|
}
|
|
@@ -77,3 +85,14 @@ export interface PrintAutomationV2Options {
|
|
|
77
85
|
* printer's `printAutomationFinalized` convention.
|
|
78
86
|
*/
|
|
79
87
|
export declare function printAutomationV2(ast: AutomationAst, opts?: PrintAutomationV2Options): string;
|
|
88
|
+
/**
|
|
89
|
+
* Like {@link printAutomationV2}, but `executeScript` bodies print as
|
|
90
|
+
* `scriptFile("./scripts/<automation>.<task>.js")` references and the bodies
|
|
91
|
+
* come back as files to write beside the automation (relative to the
|
|
92
|
+
* automations folder). The bodies never enter the TypeScript source, so they
|
|
93
|
+
* are never type-checked, annotated or type-stripped.
|
|
94
|
+
*/
|
|
95
|
+
export declare function printAutomationV2WithScriptFiles(ast: AutomationAst, opts?: PrintAutomationV2Options): {
|
|
96
|
+
readonly source: string;
|
|
97
|
+
readonly scriptFiles: readonly PrintedScriptFile[];
|
|
98
|
+
};
|