@elementumai/edk 0.8.0-preview.11 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +378 -324
- package/dist-sdk/src/catalog/ai-provider-models.d.ts +30 -0
- package/dist-sdk/src/catalog/ai-provider-models.js +63 -0
- package/dist-sdk/src/catalog/factories.d.ts +56 -3
- package/dist-sdk/src/catalog/factories.js +65 -2
- package/dist-sdk/src/catalog/from-authoring.js +6 -1
- package/dist-sdk/src/catalog/index.d.ts +3 -2
- package/dist-sdk/src/catalog/index.js +3 -2
- package/dist-sdk/src/catalog/org.d.ts +1 -1
- package/dist-sdk/src/catalog/org.js +83 -6
- package/dist-sdk/src/catalog/render.d.ts +13 -1
- package/dist-sdk/src/catalog/render.js +21 -4
- package/dist-sdk/src/catalog/token.js +14 -0
- package/dist-sdk/src/catalog/types.d.ts +60 -3
- package/dist-sdk/src/catalog/types.js +3 -0
- package/dist-sdk/src/core/system-fields.d.ts +2 -0
- package/dist-sdk/src/core/system-fields.js +2 -0
- package/dist-sdk/src/core/types/ai-provider.d.ts +10 -23
- package/dist-sdk/src/core/types/ai-provider.js +1 -25
- package/dist-sdk/src/core/types/app.d.ts +20 -1
- package/dist-sdk/src/engine/build/context.d.ts +18 -0
- package/dist-sdk/src/engine/build/source-context.d.ts +45 -0
- package/dist-sdk/src/engine/build/source-context.js +23 -0
- package/dist-sdk/src/engine/pull/context.d.ts +15 -0
- package/dist-sdk/src/engine/pull/org.d.ts +10 -0
- package/dist-sdk/src/engine/pull/org.js +34 -4
- package/dist-sdk/src/engine/tf/index.d.ts +1 -1
- package/dist-sdk/src/engine/tf/index.js +1 -1
- package/dist-sdk/src/engine/tf/labels.d.ts +45 -0
- package/dist-sdk/src/engine/tf/labels.js +71 -0
- package/dist-sdk/src/entities/access-policy/build.d.ts +26 -0
- package/dist-sdk/src/entities/access-policy/build.js +7 -0
- package/dist-sdk/src/entities/access-policy/filter.d.ts +61 -0
- package/dist-sdk/src/entities/access-policy/filter.js +83 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +48 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +189 -0
- package/dist-sdk/src/entities/access-policy/module.d.ts +3 -0
- package/dist-sdk/src/entities/access-policy/module.js +17 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +36 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +149 -0
- package/dist-sdk/src/entities/access-policy/types.d.ts +4 -0
- package/dist-sdk/src/entities/access-policy/types.js +10 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +38 -3
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +199 -32
- package/dist-sdk/src/entities/agent/from-tf.d.ts +18 -3
- package/dist-sdk/src/entities/agent/from-tf.js +135 -15
- package/dist-sdk/src/entities/agent/index.d.ts +1 -1
- package/dist-sdk/src/entities/agent/module.js +8 -2
- package/dist-sdk/src/entities/agent/to-tf.js +62 -10
- package/dist-sdk/src/entities/agent/tools.d.ts +88 -9
- package/dist-sdk/src/entities/agent/tools.js +46 -7
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +51 -4
- package/dist-sdk/src/entities/agent-tool/from-tf.js +131 -35
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +4 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +103 -17
- package/dist-sdk/src/entities/agent-tool/types.d.ts +5 -4
- package/dist-sdk/src/entities/agent-tool/types.js +38 -6
- package/dist-sdk/src/entities/app/build.d.ts +63 -13
- package/dist-sdk/src/entities/app/build.js +48 -1
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +3 -0
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/app/from-tf.js +32 -15
- package/dist-sdk/src/entities/app/index.d.ts +4 -1
- package/dist-sdk/src/entities/app/index.js +2 -1
- package/dist-sdk/src/entities/app/module.js +9 -2
- package/dist-sdk/src/entities/app/to-tf.d.ts +5 -0
- package/dist-sdk/src/entities/app/to-tf.js +33 -4
- package/dist-sdk/src/entities/automation/build.d.ts +57 -13
- package/dist-sdk/src/entities/automation/build.js +48 -36
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +25 -8
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +16 -1
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +179 -43
- package/dist-sdk/src/entities/automation/filter.d.ts +15 -3
- package/dist-sdk/src/entities/automation/filter.js +12 -2
- package/dist-sdk/src/entities/automation/from-tf.d.ts +26 -27
- package/dist-sdk/src/entities/automation/from-tf.js +1229 -223
- package/dist-sdk/src/entities/automation/index.d.ts +4 -0
- package/dist-sdk/src/entities/automation/index.js +4 -0
- package/dist-sdk/src/entities/automation/module.js +29 -32
- package/dist-sdk/src/entities/automation/operators.d.ts +29 -2
- package/dist-sdk/src/entities/automation/operators.js +27 -1
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +19 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +24 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +10 -21
- package/dist-sdk/src/entities/automation/script-code.js +272 -5
- package/dist-sdk/src/entities/automation/tasks.d.ts +125 -19
- package/dist-sdk/src/entities/automation/tasks.js +83 -15
- package/dist-sdk/src/entities/automation/to-tf.d.ts +10 -29
- package/dist-sdk/src/entities/automation/to-tf.js +1134 -231
- package/dist-sdk/src/entities/automation/triggers.d.ts +9 -1
- package/dist-sdk/src/entities/automation/types.d.ts +29 -4
- package/dist-sdk/src/entities/automation/types.js +76 -46
- package/dist-sdk/src/entities/element/build.d.ts +23 -10
- package/dist-sdk/src/entities/element/build.js +1 -0
- package/dist-sdk/src/entities/element/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/from-tf.js +18 -3
- package/dist-sdk/src/entities/element/index.d.ts +4 -1
- package/dist-sdk/src/entities/element/index.js +2 -1
- package/dist-sdk/src/entities/element/module.js +3 -1
- package/dist-sdk/src/entities/element/to-tf.js +21 -3
- package/dist-sdk/src/entities/field/build.d.ts +56 -13
- package/dist-sdk/src/entities/field/build.js +10 -0
- package/dist-sdk/src/entities/field/calc/runtime.js +4 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +5 -3
- package/dist-sdk/src/entities/field/from-tf.js +118 -7
- package/dist-sdk/src/entities/field/module.js +3 -2
- package/dist-sdk/src/entities/field/to-tf.d.ts +27 -9
- package/dist-sdk/src/entities/field/to-tf.js +62 -17
- package/dist-sdk/src/entities/field/types.d.ts +26 -0
- package/dist-sdk/src/entities/field/types.js +34 -12
- package/dist-sdk/src/entities/file-reader/build.d.ts +108 -50
- package/dist-sdk/src/entities/file-reader/build.js +23 -23
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +6 -0
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +109 -0
- package/dist-sdk/src/entities/file-reader/from-tf.d.ts +13 -0
- package/dist-sdk/src/entities/file-reader/from-tf.js +172 -0
- package/dist-sdk/src/entities/file-reader/index.d.ts +8 -3
- package/dist-sdk/src/entities/file-reader/index.js +7 -2
- package/dist-sdk/src/entities/file-reader/module.d.ts +3 -0
- package/dist-sdk/src/entities/file-reader/module.js +115 -0
- package/dist-sdk/src/entities/file-reader/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/file-reader/to-tf.js +84 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +32 -0
- package/dist-sdk/src/entities/file-reader/types.js +30 -0
- package/dist-sdk/src/entities/org/ai-provider.d.ts +13 -0
- package/dist-sdk/src/entities/org/ai-provider.js +46 -0
- package/dist-sdk/src/entities/org/connector.d.ts +8 -1
- package/dist-sdk/src/entities/org/connector.js +12 -14
- package/dist-sdk/src/entities/org/group.js +10 -1
- package/dist-sdk/src/entities/org/index.d.ts +1 -0
- package/dist-sdk/src/entities/org/index.js +1 -0
- package/dist-sdk/src/entities/org/user.js +10 -1
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +44 -9
- package/dist-sdk/src/entities/shared/filters/types.d.ts +1 -1
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +17 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +31 -0
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -1
- package/dist-sdk/src/entities/shared/types/field-types.js +9 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +19 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +36 -8
- package/dist-sdk/src/entities/skill/from-tf.js +4 -3
- package/dist-sdk/src/entities/skill/index.d.ts +1 -1
- package/dist-sdk/src/entities/skill/module.js +6 -1
- package/dist-sdk/src/entities/skill/to-tf.js +3 -2
- package/dist-sdk/src/entities/skill/tools.d.ts +25 -3
- package/dist-sdk/src/entities/skill/tools.js +17 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +15 -2
- package/dist-sdk/src/entities/skill-tool/from-tf.js +32 -11
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +32 -9
- package/dist-sdk/src/entities/view/from-tf.d.ts +6 -2
- package/dist-sdk/src/entities/view/from-tf.js +11 -9
- package/dist-sdk/src/entities/view/to-tf.d.ts +9 -7
- package/dist-sdk/src/entities/view/to-tf.js +33 -18
- package/dist-sdk/src/entities/view/types.d.ts +1 -1
- package/dist-sdk/src/entities/view/types.js +1 -1
- package/dist-sdk/src/graph/deferred-catalog-render.d.ts +0 -5
- package/dist-sdk/src/graph/deferred-catalog-render.js +1 -20
- package/dist-sdk/src/graph/index.d.ts +8 -0
- package/dist-sdk/src/graph/index.js +13 -9
- package/dist-sdk/src/graph/modules.js +6 -1
- package/dist-sdk/src/graph/types.d.ts +77 -3
- package/package.json +42 -14
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +0 -76
- package/dist-sdk/src/entities/automation/value-ref-tf.js +0 -190
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* accept a literal or a `ctx` `Ref` and are pre-serialized to the platform's
|
|
12
12
|
* `ValueReference` JSON via the shared, agnostic `serializeValueOrRef`.
|
|
13
13
|
*/
|
|
14
|
-
import type { AgentRef, AspectRef, AutomationRef, ConnectorRef, FileReaderCatalogRef, DocumentModelFieldRef, FieldRef, SearchTableRef } from "../../catalog/index.js";
|
|
14
|
+
import type { AgentRef, AspectRef, AutomationRef, CloudLinkRef, ConnectorRef, FileReaderCatalogRef, DocumentModelFieldRef, FieldRef, SearchTableRef } from "../../catalog/index.js";
|
|
15
15
|
import type { RecordShape } from "../field/record-shape.js";
|
|
16
16
|
import type { ValueOrRef } from "../shared/ref.js";
|
|
17
17
|
import type { TaskDef } from "./build.js";
|
|
@@ -125,8 +125,8 @@ export interface SendEmailOptions {
|
|
|
125
125
|
export declare function sendEmail(opts: SendEmailOptions): TaskDef<Record<string, never>>;
|
|
126
126
|
export interface PostCommentOptions {
|
|
127
127
|
readonly contents: ValueOrRef<unknown>;
|
|
128
|
-
/** Conversation tags —
|
|
129
|
-
readonly tags
|
|
128
|
+
/** Conversation tags. Omit for an untagged comment — the provider's message task has no tags of its own. */
|
|
129
|
+
readonly tags?: readonly string[];
|
|
130
130
|
/** The record to comment on (required). */
|
|
131
131
|
readonly record: ValueOrRef<unknown>;
|
|
132
132
|
}
|
|
@@ -180,32 +180,130 @@ export interface SetVariableOptions {
|
|
|
180
180
|
readonly update?: readonly VariableAssign[];
|
|
181
181
|
}
|
|
182
182
|
export declare function setVariable(opts: SetVariableOptions): TaskDef<Record<string, never>>;
|
|
183
|
-
|
|
183
|
+
type ExecuteScriptFieldValue<T extends string> = Uppercase<T> extends "INTEGER" | "NUMBER" | "DECIMAL" ? number : Uppercase<T> extends "BOOLEAN" ? boolean : string;
|
|
184
|
+
type ExecuteScriptOutput<O extends Record<string, string> | undefined> = {
|
|
185
|
+
readonly result: O extends Record<string, string> ? {
|
|
186
|
+
readonly [K in keyof O]: ExecuteScriptFieldValue<O[K]>;
|
|
187
|
+
} : Record<string, unknown>;
|
|
188
|
+
};
|
|
189
|
+
export interface ExecuteScriptOptions<O extends Record<string, string> | undefined = undefined> {
|
|
184
190
|
/**
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
191
|
+
* A FUNCTION whose body ships as the platform script (v3):
|
|
192
|
+
* `(input) => { const { X } = input.parameters; return { OUT: X }; }`.
|
|
193
|
+
* Matches the platform contract (`input.parameters.<name>`, mandatory
|
|
194
|
+
* plain-object return) and is serialized to TEXT — it must not close over
|
|
195
|
+
* outer variables (a best-effort scan throws on captures).
|
|
196
|
+
*
|
|
197
|
+
* Top-level workflows should use fluent `.executeScript(name, {…})` instead
|
|
198
|
+
* of `.task(name, () => executeScript(…))`. This factory remains for nested
|
|
199
|
+
* `childTask(…, executeScript(…))` (operators have no fluent surface).
|
|
190
200
|
*/
|
|
191
|
-
readonly code:
|
|
201
|
+
readonly code: ScriptCodeFn<Record<string, unknown>, Record<string, unknown>>;
|
|
192
202
|
readonly inputs?: Record<string, ValueOrRef<unknown>>;
|
|
193
203
|
/** Output schema: property name → `"text" | "integer" | "number" | "decimal" | "boolean"`. */
|
|
194
|
-
readonly outputs?:
|
|
204
|
+
readonly outputs?: O;
|
|
195
205
|
}
|
|
196
|
-
|
|
206
|
+
/**
|
|
207
|
+
* Build the executeScript `TaskDef` from an ALREADY-RESOLVED body string.
|
|
208
|
+
* Shared by the public `executeScript()` factory below (which resolves the
|
|
209
|
+
* body via `extractScriptBody`'s `toString()` path) and the fluent
|
|
210
|
+
* `WorkflowBuilder.executeScript()` in `build.ts` (which resolves it via
|
|
211
|
+
* `tryExtractFromCurrentSource` first, for byte-exact pulled-source fidelity,
|
|
212
|
+
* falling back to `extractScriptBody` only when there's no tracked source) —
|
|
213
|
+
* so the body is computed exactly once, not re-derived by each layer.
|
|
214
|
+
*/
|
|
215
|
+
export declare function executeScriptTaskDefWithBody<O extends Record<string, string> | undefined = undefined>(body: string, opts: Pick<ExecuteScriptOptions<O>, "inputs" | "outputs">): TaskDef<ExecuteScriptOutput<O>> & {
|
|
216
|
+
readonly key: "executeScript";
|
|
217
|
+
};
|
|
218
|
+
export declare function executeScript<const O extends Record<string, string> | undefined = undefined>(opts: ExecuteScriptOptions<O>): TaskDef<ExecuteScriptOutput<O>> & {
|
|
219
|
+
readonly key: "executeScript";
|
|
220
|
+
};
|
|
197
221
|
export interface ApiRequestHeader {
|
|
198
222
|
readonly name: string;
|
|
199
223
|
readonly value: ValueOrRef<unknown>;
|
|
200
224
|
}
|
|
225
|
+
export interface ApiRequestBasicAuth {
|
|
226
|
+
readonly username: ValueOrRef<unknown>;
|
|
227
|
+
/**
|
|
228
|
+
* elementum_api_task's `basic_auth.reference_password` - a dynamic
|
|
229
|
+
* password pulled from another task's refs at runtime. Mutually exclusive
|
|
230
|
+
* with a static password, which is NOT modeled: the provider schema
|
|
231
|
+
* treats it as write-only (confirmed against api_task_resource.go's
|
|
232
|
+
* reconstructAPITaskBasicAuth - the API never returns the real value, so
|
|
233
|
+
* it's always copied forward from whatever was already in state), so a
|
|
234
|
+
* plan rebuilt from a fresh pull could never reproduce it.
|
|
235
|
+
*/
|
|
236
|
+
readonly referencePassword?: ValueOrRef<unknown>;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* elementum_api_task's `bearer_auth` block. `token` is a plain static
|
|
240
|
+
* string only (no template/ref support on the wire, and - like basic_auth's
|
|
241
|
+
* password - write-only on read, so it always round-trips from authored
|
|
242
|
+
* source rather than a pull); `referenceToken` is the round-trippable
|
|
243
|
+
* dynamic alternative. Mutually exclusive with each other, and with
|
|
244
|
+
* `basicAuth`/`oauth` at the task level.
|
|
245
|
+
*/
|
|
246
|
+
export interface ApiRequestBearerAuth {
|
|
247
|
+
readonly token?: string;
|
|
248
|
+
readonly referenceToken?: ValueOrRef<unknown>;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* elementum_api_task's `oauth` block (client-credentials grant). `clientId`/
|
|
252
|
+
* `clientSecret` are plain static strings, write-only on read like
|
|
253
|
+
* bearer_auth.token - always resent from authored source, never
|
|
254
|
+
* reconstructed from a pull. Mutually exclusive with `basicAuth`/
|
|
255
|
+
* `bearerAuth`.
|
|
256
|
+
*/
|
|
257
|
+
export interface ApiRequestOAuth {
|
|
258
|
+
readonly url?: ValueOrRef<unknown>;
|
|
259
|
+
readonly clientId?: string;
|
|
260
|
+
readonly clientSecret?: string;
|
|
261
|
+
readonly requestType: "BASIC" | "FORM";
|
|
262
|
+
readonly headers?: readonly ApiRequestHeader[];
|
|
263
|
+
}
|
|
264
|
+
export interface ApiRequestFormValue {
|
|
265
|
+
readonly key: string;
|
|
266
|
+
readonly value: ValueOrRef<unknown>;
|
|
267
|
+
}
|
|
268
|
+
/** elementum_api_task's `custom_body` block - arbitrary content type + body text (XML, CSV, SOAP, ...). */
|
|
269
|
+
export interface ApiRequestCustomBody {
|
|
270
|
+
readonly contentType: string;
|
|
271
|
+
readonly content: ValueOrRef<unknown>;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* One part of a `multipart_body`. Exactly one of `value` (a plain text
|
|
275
|
+
* field - templated like other body content), `attachment`, `attachmentId`,
|
|
276
|
+
* or `file` (value references) should be set; the provider validates the
|
|
277
|
+
* mutual exclusivity server-side.
|
|
278
|
+
*/
|
|
279
|
+
export interface ApiRequestMultipartPart {
|
|
280
|
+
readonly name: string;
|
|
281
|
+
readonly value?: ValueOrRef<unknown>;
|
|
282
|
+
readonly attachment?: ValueOrRef<unknown>;
|
|
283
|
+
readonly attachmentId?: ValueOrRef<unknown>;
|
|
284
|
+
readonly file?: ValueOrRef<unknown>;
|
|
285
|
+
}
|
|
286
|
+
export interface ApiRequestMultipartBody {
|
|
287
|
+
readonly parts: readonly ApiRequestMultipartPart[];
|
|
288
|
+
}
|
|
201
289
|
export interface ApiRequestOptions {
|
|
202
290
|
readonly url: ValueOrRef<unknown>;
|
|
203
291
|
readonly method: string;
|
|
204
292
|
readonly headers?: readonly ApiRequestHeader[];
|
|
205
|
-
/**
|
|
206
|
-
readonly
|
|
207
|
-
/**
|
|
208
|
-
readonly
|
|
293
|
+
/** elementum_api_task's `basic_auth` block. Mutually exclusive with `bearerAuth`/`oauth`. */
|
|
294
|
+
readonly basicAuth?: ApiRequestBasicAuth;
|
|
295
|
+
/** elementum_api_task's `bearer_auth` block. Mutually exclusive with `basicAuth`/`oauth`. */
|
|
296
|
+
readonly bearerAuth?: ApiRequestBearerAuth;
|
|
297
|
+
/** elementum_api_task's `oauth` block. Mutually exclusive with `basicAuth`/`bearerAuth`. */
|
|
298
|
+
readonly oauth?: ApiRequestOAuth;
|
|
299
|
+
/** elementum_api_task's `json_body` attribute. Mutually exclusive with `formBody`/`customBody`/`multipartBody`. */
|
|
300
|
+
readonly jsonBody?: ValueOrRef<unknown>;
|
|
301
|
+
/** elementum_api_task's `form_body` attribute. Mutually exclusive with `jsonBody`/`customBody`/`multipartBody`. */
|
|
302
|
+
readonly formBody?: readonly ApiRequestFormValue[];
|
|
303
|
+
/** elementum_api_task's `custom_body` block. Mutually exclusive with `jsonBody`/`formBody`/`multipartBody`. */
|
|
304
|
+
readonly customBody?: ApiRequestCustomBody;
|
|
305
|
+
/** elementum_api_task's `multipart_body` block (file uploads). Mutually exclusive with `jsonBody`/`formBody`/`customBody`. */
|
|
306
|
+
readonly multipartBody?: ApiRequestMultipartBody;
|
|
209
307
|
readonly responseType?: string;
|
|
210
308
|
readonly continueOnError?: boolean;
|
|
211
309
|
}
|
|
@@ -250,7 +348,14 @@ export interface AiFileAnalysisOptions {
|
|
|
250
348
|
readonly attachmentId: ValueOrRef<unknown>;
|
|
251
349
|
/** Required — the document model to analyze the file against. */
|
|
252
350
|
readonly documentModel: FileReaderCatalogRef;
|
|
253
|
-
|
|
351
|
+
/**
|
|
352
|
+
* Required — unlike aiSummarize/aiClassify/aiTransform's `connector`
|
|
353
|
+
* (optional there; the provider falls back to the org default),
|
|
354
|
+
* elementum_ai_file_read_task's ai_provider_connector_id is Required in
|
|
355
|
+
* the provider's own schema (ai_file_read_task_resource.go). Omitting it
|
|
356
|
+
* here would build clean but fail at `plan`/`apply`.
|
|
357
|
+
*/
|
|
358
|
+
readonly connector: ConnectorRef;
|
|
254
359
|
}
|
|
255
360
|
export declare function aiFileAnalysis(opts: AiFileAnalysisOptions): TaskDef<{
|
|
256
361
|
output: unknown;
|
|
@@ -362,7 +467,8 @@ export interface AssignmentEngineOptions {
|
|
|
362
467
|
export declare function assignmentEngine(opts: AssignmentEngineOptions): TaskDef<Empty>;
|
|
363
468
|
export interface ProcedureOptions {
|
|
364
469
|
readonly procedureId: string;
|
|
365
|
-
|
|
470
|
+
/** A raw cloud link id, or a `catalog.cloudLinks.<handle>` reference. */
|
|
471
|
+
readonly cloudLinkId: string | CloudLinkRef;
|
|
366
472
|
/** Positional arguments (index == position). */
|
|
367
473
|
readonly parameters?: readonly ValueOrRef<unknown>[];
|
|
368
474
|
}
|
|
@@ -391,7 +497,7 @@ export interface CalculationEntry {
|
|
|
391
497
|
* concatenation) and rejects the request as malformed. Mirrors
|
|
392
498
|
* {@link VariableDecl.type}'s loose string typing.
|
|
393
499
|
*/
|
|
394
|
-
readonly outputType
|
|
500
|
+
readonly outputType?: string;
|
|
395
501
|
readonly record?: ValueOrRef<unknown>;
|
|
396
502
|
}
|
|
397
503
|
export interface CalculationOptions {
|
|
@@ -79,9 +79,9 @@ export function relateRecords(opts) {
|
|
|
79
79
|
return {
|
|
80
80
|
key: "relateRecords",
|
|
81
81
|
config: {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
// Always an array in wire — matches DSL `sources: [...]` and round-trips
|
|
83
|
+
// single-source HCL (scalar source_record_ids) via from-tf normalization.
|
|
84
|
+
sourceRecordIds: opts.sources.map((s) => serializeValueOrRef(s)),
|
|
85
85
|
targetRecordId: serializeValueOrRef(opts.target),
|
|
86
86
|
},
|
|
87
87
|
};
|
|
@@ -113,12 +113,12 @@ export function sendEmail(opts) {
|
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
export function postComment(opts) {
|
|
116
|
-
if (opts.tags.length === 0)
|
|
117
|
-
throw new Error("postComment
|
|
116
|
+
if (opts.tags !== undefined && opts.tags.length === 0)
|
|
117
|
+
throw new Error("postComment's tags, when given, must be non-empty.");
|
|
118
118
|
return {
|
|
119
119
|
key: "message",
|
|
120
120
|
config: {
|
|
121
|
-
tags: opts.tags,
|
|
121
|
+
...(opts.tags !== undefined ? { tags: opts.tags } : {}),
|
|
122
122
|
contentsReference: serializeValueOrRef(opts.contents),
|
|
123
123
|
recordReference: serializeValueOrRef(opts.record),
|
|
124
124
|
},
|
|
@@ -190,7 +190,16 @@ function outputSchema(outputs) {
|
|
|
190
190
|
// against both (adoption zero-change gate + build-vs-export).
|
|
191
191
|
return { object: { properties } };
|
|
192
192
|
}
|
|
193
|
-
|
|
193
|
+
/**
|
|
194
|
+
* Build the executeScript `TaskDef` from an ALREADY-RESOLVED body string.
|
|
195
|
+
* Shared by the public `executeScript()` factory below (which resolves the
|
|
196
|
+
* body via `extractScriptBody`'s `toString()` path) and the fluent
|
|
197
|
+
* `WorkflowBuilder.executeScript()` in `build.ts` (which resolves it via
|
|
198
|
+
* `tryExtractFromCurrentSource` first, for byte-exact pulled-source fidelity,
|
|
199
|
+
* falling back to `extractScriptBody` only when there's no tracked source) —
|
|
200
|
+
* so the body is computed exactly once, not re-derived by each layer.
|
|
201
|
+
*/
|
|
202
|
+
export function executeScriptTaskDefWithBody(body, opts) {
|
|
194
203
|
const inputs = Object.entries(opts.inputs ?? {}).map(([name, value]) => ({
|
|
195
204
|
name,
|
|
196
205
|
value: serializeValueOrRef(value),
|
|
@@ -199,23 +208,82 @@ export function executeScript(opts) {
|
|
|
199
208
|
key: "executeScript",
|
|
200
209
|
config: {
|
|
201
210
|
inputs,
|
|
202
|
-
code:
|
|
211
|
+
code: body,
|
|
203
212
|
...(opts.outputs !== undefined ? { outputSchema: outputSchema(opts.outputs) } : {}),
|
|
204
213
|
},
|
|
205
214
|
};
|
|
206
215
|
}
|
|
216
|
+
export function executeScript(opts) {
|
|
217
|
+
return executeScriptTaskDefWithBody(extractScriptBody(opts.code), opts);
|
|
218
|
+
}
|
|
219
|
+
function apiRequestHeaders(headers) {
|
|
220
|
+
return (headers ?? []).map((h) => ({ name: h.name, value: serializeValueOrRef(h.value) }));
|
|
221
|
+
}
|
|
222
|
+
const API_AUTH_KEYS = ["basicAuth", "bearerAuth", "oauth"];
|
|
223
|
+
const API_BODY_KEYS = ["jsonBody", "formBody", "customBody", "multipartBody"];
|
|
207
224
|
export function apiRequest(opts) {
|
|
225
|
+
const setAuthKeys = API_AUTH_KEYS.filter((k) => opts[k] !== undefined);
|
|
226
|
+
if (setAuthKeys.length > 1) {
|
|
227
|
+
throw new Error(`apiRequest: at most one of basicAuth/bearerAuth/oauth may be set (got ${setAuthKeys.join(", ")}).`);
|
|
228
|
+
}
|
|
229
|
+
const setBodyKeys = API_BODY_KEYS.filter((k) => opts[k] !== undefined);
|
|
230
|
+
if (setBodyKeys.length > 1) {
|
|
231
|
+
throw new Error(`apiRequest: at most one of jsonBody/formBody/customBody/multipartBody may be set (got ${setBodyKeys.join(", ")}).`);
|
|
232
|
+
}
|
|
208
233
|
return {
|
|
209
234
|
key: "api",
|
|
210
235
|
config: {
|
|
211
236
|
urlReference: serializeValueOrRef(opts.url),
|
|
212
237
|
method: opts.method,
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
...(opts.
|
|
238
|
+
// elementum_api_task's real attribute is `headers[].name` (confirmed
|
|
239
|
+
// against api_task_resource.go's schema) - not "header". Omit when
|
|
240
|
+
// unset rather than defaulting to `[]` - the platform leaves `headers`
|
|
241
|
+
// absent (not an empty list) on a task with none configured, so an
|
|
242
|
+
// unconditional `[]` here permanently diffed against state.
|
|
243
|
+
...(opts.headers !== undefined ? { headers: apiRequestHeaders(opts.headers) } : {}),
|
|
244
|
+
...(opts.basicAuth !== undefined ? {
|
|
245
|
+
basicAuth: {
|
|
246
|
+
username: serializeValueOrRef(opts.basicAuth.username),
|
|
247
|
+
...(opts.basicAuth.referencePassword !== undefined
|
|
248
|
+
? { referencePassword: serializeValueOrRef(opts.basicAuth.referencePassword) }
|
|
249
|
+
: {}),
|
|
250
|
+
},
|
|
251
|
+
} : {}),
|
|
252
|
+
...(opts.bearerAuth !== undefined ? {
|
|
253
|
+
bearerAuth: {
|
|
254
|
+
...(opts.bearerAuth.token !== undefined ? { token: opts.bearerAuth.token } : {}),
|
|
255
|
+
...(opts.bearerAuth.referenceToken !== undefined
|
|
256
|
+
? { referenceToken: serializeValueOrRef(opts.bearerAuth.referenceToken) }
|
|
257
|
+
: {}),
|
|
258
|
+
},
|
|
259
|
+
} : {}),
|
|
260
|
+
...(opts.oauth !== undefined ? {
|
|
261
|
+
oauth: {
|
|
262
|
+
requestType: opts.oauth.requestType,
|
|
263
|
+
...(opts.oauth.url !== undefined ? { url: serializeValueOrRef(opts.oauth.url) } : {}),
|
|
264
|
+
...(opts.oauth.clientId !== undefined ? { clientId: opts.oauth.clientId } : {}),
|
|
265
|
+
...(opts.oauth.clientSecret !== undefined ? { clientSecret: opts.oauth.clientSecret } : {}),
|
|
266
|
+
...(opts.oauth.headers !== undefined ? { headers: apiRequestHeaders(opts.oauth.headers) } : {}),
|
|
267
|
+
},
|
|
268
|
+
} : {}),
|
|
269
|
+
...(opts.jsonBody !== undefined ? { jsonBody: serializeValueOrRef(opts.jsonBody) } : {}),
|
|
270
|
+
...(opts.formBody !== undefined ? {
|
|
271
|
+
formBody: opts.formBody.map((v) => ({ key: v.key, value: serializeValueOrRef(v.value) })),
|
|
272
|
+
} : {}),
|
|
273
|
+
...(opts.customBody !== undefined ? {
|
|
274
|
+
customBody: { contentType: opts.customBody.contentType, content: serializeValueOrRef(opts.customBody.content) },
|
|
275
|
+
} : {}),
|
|
276
|
+
...(opts.multipartBody !== undefined ? {
|
|
277
|
+
multipartBody: {
|
|
278
|
+
parts: opts.multipartBody.parts.map((part) => ({
|
|
279
|
+
name: part.name,
|
|
280
|
+
...(part.value !== undefined ? { value: serializeValueOrRef(part.value) } : {}),
|
|
281
|
+
...(part.attachment !== undefined ? { attachment: serializeValueOrRef(part.attachment) } : {}),
|
|
282
|
+
...(part.attachmentId !== undefined ? { attachmentId: serializeValueOrRef(part.attachmentId) } : {}),
|
|
283
|
+
...(part.file !== undefined ? { file: serializeValueOrRef(part.file) } : {}),
|
|
284
|
+
})),
|
|
285
|
+
},
|
|
286
|
+
} : {}),
|
|
219
287
|
responseType: opts.responseType ?? "JSON",
|
|
220
288
|
continueOnError: opts.continueOnError ?? false,
|
|
221
289
|
},
|
|
@@ -277,7 +345,7 @@ export function aiFileAnalysis(opts) {
|
|
|
277
345
|
config: {
|
|
278
346
|
attachmentId: serializeValueOrRef(opts.attachmentId),
|
|
279
347
|
documentModelId: opts.documentModel,
|
|
280
|
-
|
|
348
|
+
aiProviderConnectorId: opts.connector,
|
|
281
349
|
},
|
|
282
350
|
};
|
|
283
351
|
}
|
|
@@ -1,38 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
* Automation emission (Phase 1). `automationToTf` consumes the discovered
|
|
3
|
-
* `DeployableEntity` (the `defineAutomation` def() payload) and emits the
|
|
4
|
-
* COMPOSITE ei dialect:
|
|
5
|
-
*
|
|
6
|
-
* elementum_automation.<autoLabel> — identity (app_id, name, ...)
|
|
7
|
-
* elementum_<trigger>_trigger.<autoLabel> — the one trigger (automation ref)
|
|
8
|
-
* elementum_<task>_task.<autoLabel>_<task> — one per task, parent-chained
|
|
9
|
-
* elementum_workflow_publish.<autoLabel> — version + depends_on(all tasks)
|
|
10
|
-
*
|
|
11
|
-
* Labels follow ei's export: the automation label is `sanitizeName(name)` and a
|
|
12
|
-
* task label is `<autoLabel>_<sanitizeName(taskName)>` — so build output matches
|
|
13
|
-
* ei's addresses for adoption/build-vs-export. Ordering is encoded exactly as ei does it:
|
|
14
|
-
* each task's `parent` points at the previous task (or the trigger, for the
|
|
15
|
-
* first). References are BARE resource refs (`elementum_automation.x`, no `.id`),
|
|
16
|
-
* matching the capture.
|
|
17
|
-
*
|
|
18
|
-
* Phase 1 carries the onDemand trigger and the executeScript + setVariable
|
|
19
|
-
* (create form → elementum_variable_task) tasks. Any other trigger/task kind, or
|
|
20
|
-
* an operator (forEach/forkJoin/switch), degrades through `diagnostics` —
|
|
21
|
-
* reported, never silently dropped (plan §6). Task BODY attributes beyond the
|
|
22
|
-
* Phase-1 set are reconciled against a fresh live capture (see the tranche plan).
|
|
23
|
-
*/
|
|
24
|
-
import { type DeployableEntity } from "../../engine/entity.js";
|
|
1
|
+
import type { DeployableEntity } from "../../engine/entity.js";
|
|
25
2
|
import { type TfBlock } from "../../engine/tf/index.js";
|
|
3
|
+
import type { OrgRefLookup } from "../../engine/build/context.js";
|
|
4
|
+
import type { BuildFieldMetadata } from "../../graph/types.js";
|
|
26
5
|
export interface AutomationToTfContext {
|
|
27
|
-
|
|
6
|
+
readonly appRefName?: string;
|
|
28
7
|
readonly appTfLabel: string;
|
|
29
|
-
|
|
30
|
-
readonly
|
|
8
|
+
readonly fieldAddresses?: ReadonlyMap<string, string>;
|
|
9
|
+
readonly fieldNames?: ReadonlyMap<string, string>;
|
|
10
|
+
readonly fieldMetadata?: ReadonlyMap<string, BuildFieldMetadata>;
|
|
11
|
+
readonly orgRefs?: OrgRefLookup;
|
|
12
|
+
readonly diagnostics?: string[];
|
|
31
13
|
}
|
|
32
14
|
export interface AutomationToTfResult {
|
|
33
15
|
readonly blocks: readonly TfBlock[];
|
|
34
|
-
/** The automation's terraform address. */
|
|
35
16
|
readonly address: string;
|
|
36
17
|
}
|
|
37
|
-
/**
|
|
18
|
+
/** App-owned `defineAutomation` entity → provider HCL blocks. */
|
|
38
19
|
export declare function automationToTf(entity: DeployableEntity, ctx: AutomationToTfContext): AutomationToTfResult;
|