@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
|
@@ -28,6 +28,7 @@ const TRIGGER_KINDS = {
|
|
|
28
28
|
elementum_approval_chain_trigger: "approvalProcessStatusUpdated",
|
|
29
29
|
elementum_datamine_trigger: "dataMine",
|
|
30
30
|
elementum_survey_trigger: "surveyResponseCreate",
|
|
31
|
+
elementum_schedule_trigger: "schedule",
|
|
31
32
|
};
|
|
32
33
|
const TASK_FACTORIES = {
|
|
33
34
|
elementum_message_task: "postComment",
|
|
@@ -97,6 +98,7 @@ const ATTR_TO_ARG = {
|
|
|
97
98
|
text_to_classify: "text",
|
|
98
99
|
field_type: "fieldType",
|
|
99
100
|
category_source: "categorySource",
|
|
101
|
+
dynamic_category_source: "categorySource",
|
|
100
102
|
user_ids: "userIds",
|
|
101
103
|
group_ids: "groupIds",
|
|
102
104
|
notify_watchers: "notifyWatchers",
|
|
@@ -229,9 +231,11 @@ function assertAllowed(block, allowed) {
|
|
|
229
231
|
}
|
|
230
232
|
const TRIGGER_ATTRIBUTES = new Set([
|
|
231
233
|
"automation", "filter", "changed_fields", "think_ui", "conversation_type",
|
|
232
|
-
"authenticated", "custom_response", "
|
|
234
|
+
"authenticated", "custom_response", "parameters",
|
|
233
235
|
"approval_chain_template_id", "status", "datamine_id", "fire_on_alert",
|
|
234
236
|
"fire_on_recovery", "email_alias_id", "survey_template_id",
|
|
237
|
+
"frequency", "interval", "timezone", "start_at", "weekdays", "day_of_month",
|
|
238
|
+
"end_at", "ends_after_count", "interval_unit",
|
|
235
239
|
]);
|
|
236
240
|
const TASK_ATTRIBUTES = new Set([
|
|
237
241
|
"parent", "name", "depends_on", "filter", "fields", "inputs", "output_schema",
|
|
@@ -243,7 +247,7 @@ const TASK_ATTRIBUTES = new Set([
|
|
|
243
247
|
"from_personal", "external_emails", "users", "groups", "attachments", "contents",
|
|
244
248
|
"agent_id", "prompt", "output_type", "json_fields", "ai_provider_connector_id",
|
|
245
249
|
"url", "response_type", "continue_on_error", "search_table_id",
|
|
246
|
-
"text_to_summarize", "text_to_classify", "field_type", "category_source",
|
|
250
|
+
"text_to_summarize", "text_to_classify", "field_type", "category_source", "dynamic_category_source",
|
|
247
251
|
"title", "user_ids", "group_ids", "notify_watchers", "field_id", "user_id", "group_id",
|
|
248
252
|
"fields_to_lock", "fields_to_unlock", "file", "file_id", "attachment", "attachment_id", "view_state", "target_automation_id",
|
|
249
253
|
"target_automation_ref", "input_mappings", "dynamic_input_mappings",
|
|
@@ -402,6 +406,17 @@ const RECORD_SEARCH_TASK_REF_SEGMENT_TO_TS = {
|
|
|
402
406
|
"All found records": "records",
|
|
403
407
|
Record: "record",
|
|
404
408
|
};
|
|
409
|
+
/**
|
|
410
|
+
* The same outputs as seen from a CALCULATION formula, which addresses a
|
|
411
|
+
* reference by its WorkflowTaskReference name rather than the refs-map
|
|
412
|
+
* display key above (`to-tf.ts`'s `CALCULATION_TASK_OUTPUT_REF_NAME` is the
|
|
413
|
+
* write side). Only the names that differ from their authoring path are
|
|
414
|
+
* listed; the rest already read back correctly.
|
|
415
|
+
*/
|
|
416
|
+
const RECORD_SEARCH_CALCULATION_REF_NAME_TO_TS = {
|
|
417
|
+
count: ["totalCount"],
|
|
418
|
+
recordId: ["record", "recordId"],
|
|
419
|
+
};
|
|
405
420
|
// aiSearchTable's own output ref name — same scoping reason as
|
|
406
421
|
// RECORD_SEARCH_TASK_REF_SEGMENT_TO_TS: "All Records" is a platform-fixed
|
|
407
422
|
// wire key on elementum_ai_search_table_task only. A trigger field could
|
|
@@ -509,6 +524,36 @@ function aspectRefFromObjectId(objectId, ctx) {
|
|
|
509
524
|
name: identity,
|
|
510
525
|
};
|
|
511
526
|
}
|
|
527
|
+
function aspectKindFromObjectId(objectId) {
|
|
528
|
+
if (!isTfExpr(objectId) || (objectId.$expr !== "resource-attr" && objectId.$expr !== "data-attr")) {
|
|
529
|
+
return undefined;
|
|
530
|
+
}
|
|
531
|
+
if (objectId.type === "elementum_app")
|
|
532
|
+
return "app";
|
|
533
|
+
if (objectId.type === "elementum_element")
|
|
534
|
+
return "element";
|
|
535
|
+
return undefined;
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* findRelatedRecords field outputs. App-related FIND_PARENT no longer
|
|
539
|
+
* exposes system Title — live refs use HANDLE (`"ID"`). A stale export
|
|
540
|
+
* `refs["Title"]` (or live `refs["ID"]`) targeting an app decodes as
|
|
541
|
+
* `.record.id` so rebuild stamps the handle. Element-related Title stays
|
|
542
|
+
* `.record.title`.
|
|
543
|
+
*/
|
|
544
|
+
function findRelatedRecordsFieldPath(wireName, taskAddress, ctx) {
|
|
545
|
+
const ownerRefName = taskAddress !== undefined
|
|
546
|
+
? ctx.taskTargetOwnerRefNameByAddress?.get(taskAddress) ?? ctx.appRefName
|
|
547
|
+
: ctx.appRefName;
|
|
548
|
+
const kind = taskAddress !== undefined
|
|
549
|
+
? ctx.taskTargetOwnerKindByAddress?.get(taskAddress)
|
|
550
|
+
: undefined;
|
|
551
|
+
const lower = wireName.toLowerCase();
|
|
552
|
+
if (kind === "app" && (lower === "title" || lower === "id")) {
|
|
553
|
+
return ["record", "id"];
|
|
554
|
+
}
|
|
555
|
+
return recordFieldRefPath(wireName, ctx, ownerRefName);
|
|
556
|
+
}
|
|
512
557
|
function lookupFieldKeyByDisplayName(ownerRefName, displayName, ctx) {
|
|
513
558
|
const lower = displayName.toLowerCase();
|
|
514
559
|
const foreign = ctx.fieldNamesByOwnerRefName?.get(ownerRefName)?.get(lower);
|
|
@@ -526,6 +571,22 @@ function lookupFieldKeyByDisplayName(ownerRefName, displayName, ctx) {
|
|
|
526
571
|
}
|
|
527
572
|
return undefined;
|
|
528
573
|
}
|
|
574
|
+
/**
|
|
575
|
+
* `record.<field-uuid>[.suffix]` — how a calculation formula names a found
|
|
576
|
+
* record's field (the calc engine resolves it by field id, not display
|
|
577
|
+
* name). Mirrors the same shape already handled for live filters in
|
|
578
|
+
* `decodeReferenceString`, resolving the id back to its authoring bag key.
|
|
579
|
+
*/
|
|
580
|
+
function calculationRecordFieldPath(taskAddress, wireName, ctx) {
|
|
581
|
+
if (taskAddress === undefined)
|
|
582
|
+
return undefined;
|
|
583
|
+
const [head, ...tail] = wireName.split(".");
|
|
584
|
+
if (head !== "record" || tail.length === 0 || !/^[a-f0-9-]{36}$/i.test(tail[0]))
|
|
585
|
+
return undefined;
|
|
586
|
+
const ownerRefName = ctx.taskTargetOwnerRefNameByAddress?.get(taskAddress) ?? ctx.appRefName;
|
|
587
|
+
const fieldKey = resolveFieldKeyFromId(tail[0], ownerRefName, ctx);
|
|
588
|
+
return ["record", fieldKey ?? tail[0], ...tail.slice(1)];
|
|
589
|
+
}
|
|
529
590
|
function taskRecordSearchFieldPath(taskAddress, wireName, ctx) {
|
|
530
591
|
if (ctx.taskTargetOwnerRefNameByAddress?.get(taskAddress) === undefined)
|
|
531
592
|
return undefined;
|
|
@@ -677,18 +738,29 @@ function triggerRefPath(path, ctx) {
|
|
|
677
738
|
if (wireName === "Attachment Id")
|
|
678
739
|
return ["attachment", "id"];
|
|
679
740
|
}
|
|
741
|
+
// emailReceived's own trigger-output field names (EmailReceivedTriggerOutput,
|
|
742
|
+
// triggers.ts) use snake_case matching the platform's field identifiers,
|
|
743
|
+
// not the human display labels the platform emits in triggerReference.name
|
|
744
|
+
// (live-confirmed: "Sender's Email Address", "Sender's Name",
|
|
745
|
+
// "Body (Plain Text)", "Body (Rich Text)") - live-confirmed spellings only;
|
|
746
|
+
// an unmapped label falls through to the raw-string default below rather
|
|
747
|
+
// than guessing (#929).
|
|
748
|
+
if (ctx.trigger.type === "elementum_email_ingestion_trigger") {
|
|
749
|
+
if (wireName === "Sender's Email Address")
|
|
750
|
+
return ["sender_email"];
|
|
751
|
+
if (wireName === "Sender's Name")
|
|
752
|
+
return ["sender_name"];
|
|
753
|
+
if (wireName === "Body (Plain Text)")
|
|
754
|
+
return ["body"];
|
|
755
|
+
if (wireName === "Body (Rich Text)")
|
|
756
|
+
return ["body_html"];
|
|
757
|
+
}
|
|
680
758
|
if (ctx.trigger.type === "elementum_webhook_trigger") {
|
|
681
759
|
const webhookMatch = WEBHOOK_REF_PATTERN.exec(wireName);
|
|
682
760
|
if (webhookMatch)
|
|
683
761
|
return [webhookMatch[1].toLowerCase(), webhookMatch[2]];
|
|
684
762
|
}
|
|
685
763
|
if (ctx.trigger.type === "elementum_on_demand_trigger") {
|
|
686
|
-
if (wireName === "Triggered By's Id")
|
|
687
|
-
return ["triggeredBy", "id"];
|
|
688
|
-
if (wireName === "Triggered By's Name")
|
|
689
|
-
return ["triggeredBy", "name"];
|
|
690
|
-
if (wireName === "Triggered By's Email")
|
|
691
|
-
return ["triggeredBy", "email"];
|
|
692
764
|
const recordPath = prefixedOnDemandRecordRefPath(wireName, ctx);
|
|
693
765
|
if (recordPath !== undefined)
|
|
694
766
|
return recordPath;
|
|
@@ -796,6 +868,25 @@ function decodeTaskReferenceFromString(taskIdOrKey, pathSegments, ctx) {
|
|
|
796
868
|
if (aiAgentPath !== undefined)
|
|
797
869
|
return { kind: "taskRef", task: refKey, path: aiAgentPath };
|
|
798
870
|
}
|
|
871
|
+
// A task's own record output can be addressed by an unresolved field UUID
|
|
872
|
+
// (`record.<field-uuid>[.suffix]`) the same way a recordSearch task's
|
|
873
|
+
// found-record fields already are below - an updateField task's "record"
|
|
874
|
+
// refers to the record it just updated (same-app field, live-confirmed on
|
|
875
|
+
// purchaseorder/eu-sanofi), so it needs the identical UUID resolution or
|
|
876
|
+
// it falls through to the raw-uuid escape even for a resolvable field.
|
|
877
|
+
if (block?.type === "elementum_update_field_task" &&
|
|
878
|
+
pathSegments.length >= 2 &&
|
|
879
|
+
pathSegments[0] === "record" &&
|
|
880
|
+
/^[a-f0-9-]{36}$/i.test(pathSegments[1])) {
|
|
881
|
+
const taskAddress = block.label !== undefined ? `${block.type}.${block.label}` : undefined;
|
|
882
|
+
const ownerRefName = (taskAddress !== undefined ? ctx.taskTargetOwnerRefNameByAddress?.get(taskAddress) : undefined) ?? ctx.appRefName;
|
|
883
|
+
const fieldKey = resolveFieldKeyFromId(pathSegments[1], ownerRefName, ctx);
|
|
884
|
+
return {
|
|
885
|
+
kind: "taskRef",
|
|
886
|
+
task: refKey,
|
|
887
|
+
path: ["record", fieldKey ?? pathSegments[1], ...pathSegments.slice(2)],
|
|
888
|
+
};
|
|
889
|
+
}
|
|
799
890
|
if (block?.type === "elementum_record_search_task" && pathSegments.length >= 1) {
|
|
800
891
|
const [head, ...tail] = pathSegments;
|
|
801
892
|
if (head === "count") {
|
|
@@ -872,6 +963,12 @@ function decodeTaskReferenceFromString(taskIdOrKey, pathSegments, ctx) {
|
|
|
872
963
|
return { kind: "taskRef", task: refKey, path: recordPath };
|
|
873
964
|
}
|
|
874
965
|
}
|
|
966
|
+
if (block.type === "elementum_find_related_records_task" && pathSegments.length === 1) {
|
|
967
|
+
const recordPath = findRelatedRecordsFieldPath(head, block.label !== undefined ? `${block.type}.${block.label}` : undefined, ctx);
|
|
968
|
+
if (recordPath !== undefined) {
|
|
969
|
+
return { kind: "taskRef", task: refKey, path: recordPath };
|
|
970
|
+
}
|
|
971
|
+
}
|
|
875
972
|
}
|
|
876
973
|
if (block?.type === "elementum_api_task" && pathSegments.length === 1) {
|
|
877
974
|
const apiPath = apiTaskRefAuthoringPath(pathSegments[0]);
|
|
@@ -1008,6 +1105,19 @@ function fieldKeyFromTriggerFieldIdExpr(fieldPart, ctx) {
|
|
|
1008
1105
|
return tfLabelToTsLabel(fieldPart.name.slice(prefix.length, -9));
|
|
1009
1106
|
}
|
|
1010
1107
|
}
|
|
1108
|
+
if ((fieldPart.$expr === "data-attr" || fieldPart.$expr === "resource-attr") &&
|
|
1109
|
+
fieldPart.type === TABLE_RESOURCE_TYPE &&
|
|
1110
|
+
fieldPart.path[0] === "field_ids") {
|
|
1111
|
+
const index = fieldPart.path[1];
|
|
1112
|
+
const name = typeof index === "string"
|
|
1113
|
+
? index
|
|
1114
|
+
: typeof index === "object" && index !== null && "index" in index && typeof index.index === "string"
|
|
1115
|
+
? index.index
|
|
1116
|
+
: undefined;
|
|
1117
|
+
if (name !== undefined) {
|
|
1118
|
+
return tfLabelToTsLabel(sanitizeName(name));
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1011
1121
|
return undefined;
|
|
1012
1122
|
}
|
|
1013
1123
|
/** Same provider/model derivation as `agentFromTf` and `renderAiProvidersBag`, read off the stream's own data blocks. */
|
|
@@ -1185,6 +1295,12 @@ function decodeValue(value, ctx) {
|
|
|
1185
1295
|
return { kind: "taskRef", task: task.refKey, path: recordPath };
|
|
1186
1296
|
}
|
|
1187
1297
|
}
|
|
1298
|
+
if (task.block.type === "elementum_find_related_records_task" && rawSegments.length === 1) {
|
|
1299
|
+
const recordPath = findRelatedRecordsFieldPath(rawSegments[0], `${task.block.type}.${task.block.label}`, ctx);
|
|
1300
|
+
if (recordPath !== undefined) {
|
|
1301
|
+
return { kind: "taskRef", task: task.refKey, path: recordPath };
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1188
1304
|
if (task.block.type === "elementum_record_search_task" && rawSegments.length >= 1) {
|
|
1189
1305
|
const recordSearchName = RECORD_SEARCH_TASK_REF_SEGMENT_TO_TS[rawSegments[0]];
|
|
1190
1306
|
if (recordSearchName !== undefined) {
|
|
@@ -1232,8 +1348,9 @@ function decodeValue(value, ctx) {
|
|
|
1232
1348
|
: keyPath;
|
|
1233
1349
|
return { kind: "taskRef", task: task.refKey, path: outputKeyPath };
|
|
1234
1350
|
}
|
|
1235
|
-
if (value.type === "elementum_app"
|
|
1236
|
-
return appRef(ctx.appRefName);
|
|
1351
|
+
if ((value.type === "elementum_app" || value.type === "elementum_element") && value.path[0] === "id") {
|
|
1352
|
+
return appRef(value.label === ctx.appTfLabel ? ctx.appRefName : tfLabelToTsLabel(value.label));
|
|
1353
|
+
}
|
|
1237
1354
|
if (value.type.endsWith("_field") && value.path[0] === "id") {
|
|
1238
1355
|
return {
|
|
1239
1356
|
kind: "field",
|
|
@@ -1297,12 +1414,14 @@ function decodeValue(value, ctx) {
|
|
|
1297
1414
|
};
|
|
1298
1415
|
}
|
|
1299
1416
|
if (value.type === "elementum_approval_process" && value.path[0] === "id") {
|
|
1300
|
-
|
|
1417
|
+
// Managed resource-attr references already carry type+label — rebuild
|
|
1418
|
+
// elementum_approval_process.<label>.id on to-tf. unresolvedId is only
|
|
1419
|
+
// for raw UUID / unresolvable refs (see ApprovalChainRef); stamping the
|
|
1420
|
+
// import id here made print/to-tf prefer the UUID and rewrite live pulls.
|
|
1301
1421
|
return {
|
|
1302
1422
|
kind: "approvalChain",
|
|
1303
1423
|
appHandle: ctx.appRefName,
|
|
1304
1424
|
approvalChainKey: scopedLabelToBagKey(ctx.appTfLabel, value.label),
|
|
1305
|
-
...(unresolvedId !== undefined ? { unresolvedId } : {}),
|
|
1306
1425
|
};
|
|
1307
1426
|
}
|
|
1308
1427
|
if ((value.type === SEARCH_TABLE_RESOURCE_TYPES.snowflake ||
|
|
@@ -1694,12 +1813,22 @@ function decodeCalculationTaskMustache(taskId, wireName, ctx) {
|
|
|
1694
1813
|
if (aiAgentPath !== undefined)
|
|
1695
1814
|
return { kind: "taskRef", task: refKey, path: aiAgentPath };
|
|
1696
1815
|
}
|
|
1816
|
+
// A calculation mustache carries the WorkflowTaskReference name, not the
|
|
1817
|
+
// refs-map display key: a found record's field is `record.<field-uuid>`
|
|
1818
|
+
// and the task's own outputs are their internal names. Both are addressed
|
|
1819
|
+
// here before the display-key tables below, which never match them.
|
|
1820
|
+
const taskAddress = taskBlock?.label !== undefined ? `${taskBlock.type}.${taskBlock.label}` : undefined;
|
|
1821
|
+
const calcRecordFieldPath = calculationRecordFieldPath(taskAddress, wireName, ctx);
|
|
1822
|
+
if (calcRecordFieldPath !== undefined)
|
|
1823
|
+
return { kind: "taskRef", task: refKey, path: calcRecordFieldPath };
|
|
1697
1824
|
if (taskBlock?.type === "elementum_record_search_task") {
|
|
1825
|
+
const calcOwnOutput = RECORD_SEARCH_CALCULATION_REF_NAME_TO_TS[wireName];
|
|
1826
|
+
if (calcOwnOutput !== undefined)
|
|
1827
|
+
return { kind: "taskRef", task: refKey, path: [...calcOwnOutput] };
|
|
1698
1828
|
const recordSearchName = RECORD_SEARCH_TASK_REF_SEGMENT_TO_TS[wireName];
|
|
1699
1829
|
if (recordSearchName !== undefined) {
|
|
1700
1830
|
return { kind: "taskRef", task: refKey, path: [recordSearchName] };
|
|
1701
1831
|
}
|
|
1702
|
-
const taskAddress = taskBlock.label !== undefined ? `${taskBlock.type}.${taskBlock.label}` : undefined;
|
|
1703
1832
|
if (taskAddress !== undefined) {
|
|
1704
1833
|
const recordFieldPath = taskRecordSearchFieldPath(taskAddress, wireName, ctx);
|
|
1705
1834
|
if (recordFieldPath !== undefined) {
|
|
@@ -1791,6 +1920,24 @@ function resolveVariableReference(rawId, rawName, outputName, ctx) {
|
|
|
1791
1920
|
return { kind: "variableParamRef", varTask: byOutput.refKey, name: byOutput.varName };
|
|
1792
1921
|
}
|
|
1793
1922
|
}
|
|
1923
|
+
// 4. The variable's real platform id is Computed on the provider, so the
|
|
1924
|
+
// static `variable_task` block does not carry `variable_id`. Export puts it
|
|
1925
|
+
// in an EDK-only `edk_variable_id_<label>` local (hydrated onto the block
|
|
1926
|
+
// before this resolver runs). Without that, a workflow OUTPUT's
|
|
1927
|
+
// `variableReference.name` is the synthetic "variable|<uuid>" placeholder,
|
|
1928
|
+
// and #2/#3's name-based matches routinely
|
|
1929
|
+
// miss on casing/spacing (output "Output Message" vs. variable "Output
|
|
1930
|
+
// message" - live-confirmed on purchaseorder/eu-sanofi's Authorization
|
|
1931
|
+
// Check automation). With exactly one variable task in the whole
|
|
1932
|
+
// automation there is no other candidate it could mean. Scoped to
|
|
1933
|
+
// outputName (workflow_publish outputs only) - a bare filter reference's
|
|
1934
|
+
// "variable.<uuid>" is a DIFFERENT wire dialect with no such guarantee
|
|
1935
|
+
// (board issue #171 contract: a filter referencing variable.<uuid> must
|
|
1936
|
+
// NOT bind to a same-automation variable task).
|
|
1937
|
+
if (rawId !== undefined && outputName !== undefined && variableTasks.length === 1) {
|
|
1938
|
+
const only = variableTasks[0];
|
|
1939
|
+
return { kind: "variableParamRef", varTask: only.refKey, name: only.varName };
|
|
1940
|
+
}
|
|
1794
1941
|
return undefined;
|
|
1795
1942
|
}
|
|
1796
1943
|
function decodeFilterReferenceEnvelope(value, ctx, outputName) {
|
|
@@ -1926,7 +2073,7 @@ function triggerFromBlock(block, ctx) {
|
|
|
1926
2073
|
...(!record && parameter.default_value !== undefined ? { defaultValue: parameter.default_value } : {}),
|
|
1927
2074
|
...(typeof parameter.description === "string" ? { description: parameter.description } : {}),
|
|
1928
2075
|
};
|
|
1929
|
-
})
|
|
2076
|
+
})
|
|
1930
2077
|
};
|
|
1931
2078
|
}
|
|
1932
2079
|
case "recordCreate":
|
|
@@ -1940,7 +2087,7 @@ function triggerFromBlock(block, ctx) {
|
|
|
1940
2087
|
case "conversationEnd":
|
|
1941
2088
|
if (typeof block.attrs.conversation_type !== "string")
|
|
1942
2089
|
throw new EntityTfError("conversation trigger requires conversation_type");
|
|
1943
|
-
return { kind, app, conversationType: block.attrs.conversation_type };
|
|
2090
|
+
return { kind, app, conversationType: block.attrs.conversation_type, ...(filter ? { filter } : {}) };
|
|
1944
2091
|
case "webhook":
|
|
1945
2092
|
// ei's export only reliably emits `authenticated` when it can (see
|
|
1946
2093
|
// cmd/elementum/export/hcl_trigger.go) - a real captured stream can
|
|
@@ -1985,6 +2132,42 @@ function triggerFromBlock(block, ctx) {
|
|
|
1985
2132
|
if (typeof block.attrs.survey_template_id !== "string")
|
|
1986
2133
|
throw new EntityTfError("survey trigger requires survey_template_id");
|
|
1987
2134
|
return { kind, app, survey: block.attrs.survey_template_id };
|
|
2135
|
+
case "schedule": {
|
|
2136
|
+
if (typeof block.attrs.frequency !== "string")
|
|
2137
|
+
throw new EntityTfError("schedule trigger requires frequency");
|
|
2138
|
+
if (typeof block.attrs.timezone !== "string")
|
|
2139
|
+
throw new EntityTfError("schedule trigger requires timezone");
|
|
2140
|
+
if (typeof block.attrs.start_at !== "string")
|
|
2141
|
+
throw new EntityTfError("schedule trigger requires start_at");
|
|
2142
|
+
const frequency = block.attrs.frequency;
|
|
2143
|
+
if (frequency !== "HOURLY" && frequency !== "DAILY" && frequency !== "WEEKLY" && frequency !== "MONTHLY") {
|
|
2144
|
+
throw new EntityTfError(`schedule trigger frequency "${frequency}" is not a public EDK schedule frequency`);
|
|
2145
|
+
}
|
|
2146
|
+
if (block.attrs.end_at !== undefined) {
|
|
2147
|
+
throw new EntityTfError("schedule trigger end_at is not a public EDK schedule option");
|
|
2148
|
+
}
|
|
2149
|
+
if (block.attrs.ends_after_count !== undefined) {
|
|
2150
|
+
throw new EntityTfError("schedule trigger ends_after_count is not a public EDK schedule option");
|
|
2151
|
+
}
|
|
2152
|
+
if (block.attrs.interval_unit !== undefined) {
|
|
2153
|
+
throw new EntityTfError("schedule trigger interval_unit is not a public EDK schedule option");
|
|
2154
|
+
}
|
|
2155
|
+
if (block.attrs.filter !== undefined) {
|
|
2156
|
+
throw new EntityTfError("schedule trigger filter is not a public EDK schedule option");
|
|
2157
|
+
}
|
|
2158
|
+
const weekdays = Array.isArray(block.attrs.weekdays)
|
|
2159
|
+
? block.attrs.weekdays.filter((day) => typeof day === "string")
|
|
2160
|
+
: undefined;
|
|
2161
|
+
return {
|
|
2162
|
+
kind,
|
|
2163
|
+
frequency,
|
|
2164
|
+
timezone: block.attrs.timezone,
|
|
2165
|
+
startAt: block.attrs.start_at,
|
|
2166
|
+
...(typeof block.attrs.interval === "number" ? { interval: block.attrs.interval } : {}),
|
|
2167
|
+
...(weekdays !== undefined && weekdays.length > 0 ? { weekdays } : {}),
|
|
2168
|
+
...(typeof block.attrs.day_of_month === "number" ? { dayOfMonth: block.attrs.day_of_month } : {}),
|
|
2169
|
+
};
|
|
2170
|
+
}
|
|
1988
2171
|
default: throw new EntityTfError(`trigger "${kind}" is outside the Terraform contract`);
|
|
1989
2172
|
}
|
|
1990
2173
|
}
|
|
@@ -2037,13 +2220,36 @@ function taskArgs(block, factory, ctx) {
|
|
|
2037
2220
|
const raw = isTfExpr(value) && value.$expr === "jsonencode" ? value.value : value;
|
|
2038
2221
|
const root = isObject(raw) && isObject(raw.object) ? raw.object : undefined;
|
|
2039
2222
|
const props = Array.isArray(root?.properties) ? root.properties : [];
|
|
2223
|
+
const decodeNode = (node) => {
|
|
2224
|
+
if (!isObject(node))
|
|
2225
|
+
throw new EntityTfError("invalid script output schema node");
|
|
2226
|
+
const [type, definition] = Object.entries(node)[0] ?? [];
|
|
2227
|
+
if (type === undefined || !isObject(definition))
|
|
2228
|
+
throw new EntityTfError("invalid script output property");
|
|
2229
|
+
if (type === "array") {
|
|
2230
|
+
return { type: "array", items: decodeNode(definition.item) };
|
|
2231
|
+
}
|
|
2232
|
+
if (type === "object" && Array.isArray(definition.properties)) {
|
|
2233
|
+
const properties = Object.fromEntries(definition.properties.map((child) => {
|
|
2234
|
+
if (!isObject(child))
|
|
2235
|
+
throw new EntityTfError("invalid nested script output property");
|
|
2236
|
+
const childDefinition = Object.values(child)[0];
|
|
2237
|
+
if (!isObject(childDefinition) || typeof childDefinition.name !== "string") {
|
|
2238
|
+
throw new EntityTfError("nested script output property requires a name");
|
|
2239
|
+
}
|
|
2240
|
+
return [childDefinition.name, decodeNode(child)];
|
|
2241
|
+
}));
|
|
2242
|
+
return { type: "object", properties };
|
|
2243
|
+
}
|
|
2244
|
+
return type === "bool" ? "boolean" : type;
|
|
2245
|
+
};
|
|
2040
2246
|
const properties = Object.fromEntries(props.map((property) => {
|
|
2041
2247
|
if (!isObject(property))
|
|
2042
2248
|
throw new EntityTfError("invalid script output schema");
|
|
2043
|
-
const
|
|
2044
|
-
if (
|
|
2249
|
+
const definition = Object.values(property)[0];
|
|
2250
|
+
if (!isObject(definition) || typeof definition.name !== "string")
|
|
2045
2251
|
throw new EntityTfError("invalid script output property");
|
|
2046
|
-
return [definition.name,
|
|
2252
|
+
return [definition.name, decodeNode(property)];
|
|
2047
2253
|
}));
|
|
2048
2254
|
// The root object's own name is inert to the platform but real stored
|
|
2049
2255
|
// data, so carry it through rather than rebuilding a schema that
|
|
@@ -2154,6 +2360,24 @@ function taskArgs(block, factory, ctx) {
|
|
|
2154
2360
|
};
|
|
2155
2361
|
continue;
|
|
2156
2362
|
}
|
|
2363
|
+
if (attr === "dynamic_category_source" && factory === "aiClassify") {
|
|
2364
|
+
if (!isObject(value))
|
|
2365
|
+
throw new EntityTfError("dynamic_category_source must be an object");
|
|
2366
|
+
if (value.object_id === undefined || value.label_field_id === undefined) {
|
|
2367
|
+
throw new EntityTfError("dynamic_category_source requires object_id and label_field_id");
|
|
2368
|
+
}
|
|
2369
|
+
args.categorySource = {
|
|
2370
|
+
type: "dynamic",
|
|
2371
|
+
app: aspectRefFromObjectId(value.object_id, ctx) ?? decodeValue(value.object_id, ctx),
|
|
2372
|
+
labelField: fieldRef(value.label_field_id, ctx),
|
|
2373
|
+
...(value.description_field_id !== undefined
|
|
2374
|
+
? { descriptionField: fieldRef(value.description_field_id, ctx) }
|
|
2375
|
+
: {}),
|
|
2376
|
+
...(value.filter !== undefined ? { filter: decodeFilter(value.filter, ctx) } : {}),
|
|
2377
|
+
...(typeof value.limit === "number" ? { limit: value.limit } : {}),
|
|
2378
|
+
};
|
|
2379
|
+
continue;
|
|
2380
|
+
}
|
|
2157
2381
|
if (attr === "table_id" && factory === "tableRecordsSearch") {
|
|
2158
2382
|
const foreign = typeof value === "string" ? ctx.foreignTableRefsById?.get(value) : undefined;
|
|
2159
2383
|
args.table = foreign !== undefined
|
|
@@ -2553,6 +2777,31 @@ export function automationOwnedAddresses(doc, automationLabel) {
|
|
|
2553
2777
|
}
|
|
2554
2778
|
return [...owned];
|
|
2555
2779
|
}
|
|
2780
|
+
const EDK_VARIABLE_ID_LOCAL_PREFIX = "edk_variable_id_";
|
|
2781
|
+
/** Pull-only: computed variable_id cannot live on the resource schema. */
|
|
2782
|
+
function exportedVariableIdsByTaskLabel(doc) {
|
|
2783
|
+
const ids = new Map();
|
|
2784
|
+
for (const block of doc.blocks) {
|
|
2785
|
+
if (block.kind !== "locals")
|
|
2786
|
+
continue;
|
|
2787
|
+
for (const [key, value] of Object.entries(block.attrs)) {
|
|
2788
|
+
if (key.startsWith(EDK_VARIABLE_ID_LOCAL_PREFIX) && typeof value === "string" && value !== "") {
|
|
2789
|
+
ids.set(key.slice(EDK_VARIABLE_ID_LOCAL_PREFIX.length), value);
|
|
2790
|
+
}
|
|
2791
|
+
}
|
|
2792
|
+
}
|
|
2793
|
+
return ids;
|
|
2794
|
+
}
|
|
2795
|
+
function withExportedVariableId(block, ids) {
|
|
2796
|
+
if (block.type !== "elementum_variable_task" || block.label === undefined)
|
|
2797
|
+
return block;
|
|
2798
|
+
if (typeof block.attrs.variable_id === "string" && block.attrs.variable_id !== "")
|
|
2799
|
+
return block;
|
|
2800
|
+
const exported = ids.get(block.label);
|
|
2801
|
+
if (exported === undefined)
|
|
2802
|
+
return block;
|
|
2803
|
+
return { ...block, attrs: { ...block.attrs, variable_id: exported } };
|
|
2804
|
+
}
|
|
2556
2805
|
/** Bridge metadata for required values that GraphQL could not reconstruct. */
|
|
2557
2806
|
function unresolvedAuthoringValues(doc) {
|
|
2558
2807
|
const values = [];
|
|
@@ -2637,7 +2886,10 @@ function automationFromTfDocument(doc, automationLabel, appRefName, foreignField
|
|
|
2637
2886
|
}
|
|
2638
2887
|
}
|
|
2639
2888
|
}
|
|
2640
|
-
const
|
|
2889
|
+
const exportedVariableIds = exportedVariableIdsByTaskLabel(doc);
|
|
2890
|
+
const tasks = taskCandidates
|
|
2891
|
+
.filter((block) => owned.has(`${block.type}.${block.label}`))
|
|
2892
|
+
.map((block) => withExportedVariableId(block, exportedVariableIds));
|
|
2641
2893
|
const ownedBranches = branches.filter((block) => owned.has(`${block.type}.${block.label}`));
|
|
2642
2894
|
// A required value that the bridge could not reconstruct is not a literal
|
|
2643
2895
|
// empty string. Exclude the whole automation graph from authoring/adoption,
|
|
@@ -2707,10 +2959,14 @@ function automationFromTfDocument(doc, automationLabel, appRefName, foreignField
|
|
|
2707
2959
|
return to === from ? [] : [{ from, to }];
|
|
2708
2960
|
});
|
|
2709
2961
|
const taskTargetOwnerRefNameByAddress = new Map();
|
|
2962
|
+
const taskTargetOwnerKindByAddress = new Map();
|
|
2710
2963
|
for (const [address, { block }] of taskByAddress) {
|
|
2711
2964
|
const ownerRefName = aspectOwnerRefNameFromObjectId(block.attrs.object_id, appRefName, appTfLabel, dataBlocks, foreignAppRefNames, foreignElementRefNames);
|
|
2712
2965
|
if (ownerRefName !== undefined)
|
|
2713
2966
|
taskTargetOwnerRefNameByAddress.set(address, ownerRefName);
|
|
2967
|
+
const ownerKind = aspectKindFromObjectId(block.attrs.object_id);
|
|
2968
|
+
if (ownerKind !== undefined)
|
|
2969
|
+
taskTargetOwnerKindByAddress.set(address, ownerKind);
|
|
2714
2970
|
}
|
|
2715
2971
|
const resourceImportIds = new Map();
|
|
2716
2972
|
for (const block of doc.blocks) {
|
|
@@ -2758,6 +3014,7 @@ function automationFromTfDocument(doc, automationLabel, appRefName, foreignField
|
|
|
2758
3014
|
...(picklistOptionLabelById !== undefined && { picklistOptionLabelById }),
|
|
2759
3015
|
...(fieldNamesByOwnerRefName !== undefined && { fieldNamesByOwnerRefName }),
|
|
2760
3016
|
...(taskTargetOwnerRefNameByAddress.size > 0 && { taskTargetOwnerRefNameByAddress }),
|
|
3017
|
+
...(taskTargetOwnerKindByAddress.size > 0 && { taskTargetOwnerKindByAddress }),
|
|
2761
3018
|
...(foreignAppRefNames !== undefined && { foreignAppRefNames }),
|
|
2762
3019
|
...(foreignElementRefNames !== undefined && { foreignElementRefNames }),
|
|
2763
3020
|
...(procedureKeysByDiscriminator !== undefined && { procedureKeysByDiscriminator }),
|
|
@@ -17,5 +17,5 @@ export { AUTOMATION_RESOURCE_TYPES, AUTOMATION_TASK_TYPES, AUTOMATION_TRIGGER_TY
|
|
|
17
17
|
export * as filter from "../shared/filters/index.js";
|
|
18
18
|
export { automationStatus, chainableTrigger, actions, automation, type ActionBuilder, type ActionChain, type ActionDef, type ActionOptions, type ActionSequenceDef, type ActionsStarted, type AutomationConfigured, type AutomationOptions, type AutomationStatus, type ForkJoinBranch, type ForkJoinBranchBuilder, type ForkJoinConfig, type ForEachBuilder, type ForEachConfig, type NestedActionBuilder, type NestedActionChain, type NestedActionContext, type OperatorChild, type SwitchCase, type SwitchCaseBuilder, type SwitchConfig, type TriggerChain, type TriggerDef, type TriggerParamMeta } from "./build.js";
|
|
19
19
|
export { ScriptCodeError, type ScriptCodeFn, type ScriptInput } from "./script-code.js";
|
|
20
|
-
export { addWatcher, aiAgent, aiClassify, aiEmailAnalysis, aiFileAnalysis, aiSearchTable, aiSummarize, aiTransform, apiRequest, approvalChain, approvalChainTemplate, approvalStatusUpdate, assignGroup, assignUser, assignmentEngine, bulkExcel, calculation, createRecord, executeScript, filterAction, findRelatedRecords, generateReport, initiateCall, initiateEmailConversation, notification, postComment, postTeamsMessage, procedure, readFile, recordFieldLocking, recordSearch, relateRecords, runAutomation, saveAttachment, sendEmail, sendSurvey, setVariable, tableRecordsSearch, unzip, updateField, userGroupSearch, userSearch, type AddWatcherOptions, type AiAgentOptions, type AiAgentOutput, type AiAgentOutputField, type AiAgentOutputFieldType, type AiClassifyCategorySource, type AiClassifyOptions, type AiClassifyStaticCategory, type AiEmailAnalysisOptions, type AiFileAnalysisOptions, type AiSearchTableOptions, type AiSearchTableOutput, type AiSummarizeOptions, type AiTransformOptions, type ApiRequestHeader, type ApiRequestOptions, type ApprovalChainOptions, type ApprovalChainTemplateOptions, type ApprovalStatusUpdateOptions, type ApprovalStatusUpdateStatus, type AssignGroupOptions, type AssignUserOptions, type AssignmentEngineOptions, type BulkExcelFieldMapping, type BulkExcelFieldSource, type BulkExcelOptions, type CalculationEntry, type CalculationExpression, type CalculationInclude, type CalculationOptions, type CalculationOutputs, type CalculationValueInput, type CalculationValueOptions, type CalculationValueOutputs, type CalculationValues, type CreateRecordOptions, type CreateRecordOutput, type EmailAttachment, type ExecuteScriptOptions, type FieldAssignment, type FilterActionOptions, type FindRelatedRecordsOptions, type GenerateReportOptions, type InitiateCallOptions, type InitiateEmailConversationOptions, type InitiateEmailFirstEmail, type LegacyCalculationOptions, type MultiSelectUpdateMode, type NotificationOptions, type PostCommentOptions, type PostTeamsMessageOptions, type LegacyProcedureOptions, type ProcedureOptions, type TypedProcedureOptions, type ReadFileDataSource, type ReadFileOptions, type RecordFieldLockingOptions, type RecordId, type RecordReference, type RecordSearchOptions, type RecordSearchOutput, type RelateRecordsOptions, type RunAutomationInput, type RunAutomationOptions, type SaveAttachmentOptions, type ScriptOutputProperties, type ScriptOutputs, type SendEmailOptions, type SendSurveyOptions, type SetVariableOptions, type TableRecordsSearchOptions, type TableRecordsSearchOutput, type UnzipOptions, type UpdateFieldAssignment, type UpdateFieldOptions, type UserSearchOptions, type VariableAssign, type VariableDecl } from "./tasks.js";
|
|
21
|
-
export { approvalProcessStatusUpdated, attachment, commentAdded, conversationEnd, dataMine, emailReceived, onDemand, recordCreated, recordUpdated, schedule, slackMessage, surveyResponseCreate, temporal, webHook, webhook, type AttachmentTriggerOptions, type AttachmentTriggerOutput, type CommentAddedTriggerOptions, type CommentAddedTriggerOutput, type ConversationEndConversationType, type ConversationEndTriggerOptions, type ConversationEndTriggerOutput, type DataMineTriggerOptions, type EmailReceivedTriggerOptions, type EmailReceivedTriggerOutput, type RecordTriggerOptions, type RecordTriggerOutput, type ScheduleFrequency, type ScheduleTriggerOptions, type ScheduleTriggerOutput, type SlackMessageTriggerOutput, type SurveyResponseCreateTriggerOptions, type SurveyResponseCreateTriggerOutput, type TemporalTriggerOptions, type TemporalUnit, type WebhookTriggerOptions, type WebhookTriggerOutput, type Weekday, type approvalProcessStatusUpdatedStatus, type approvalProcessStatusUpdatedTriggerOptions } from "./triggers.js";
|
|
20
|
+
export { addWatcher, aiAgent, aiClassify, aiEmailAnalysis, aiFileAnalysis, aiSearchTable, aiSummarize, aiTransform, apiRequest, approvalChain, approvalChainTemplate, approvalStatusUpdate, assignGroup, assignUser, assignmentEngine, bulkExcel, calculation, createRecord, executeScript, filterAction, findRelatedRecords, generateReport, initiateCall, initiateEmailConversation, notification, postComment, postTeamsMessage, procedure, readFile, recordFieldLocking, recordSearch, relateRecords, runAutomation, saveAttachment, sendEmail, sendSurvey, setVariable, tableRecordsSearch, unzip, updateField, userGroupSearch, userSearch, type AddWatcherOptions, type AiAgentOptions, type AiAgentOutput, type AiAgentOutputField, type AiAgentOutputFieldType, type AiClassifyCategorySource, type AiClassifyOptions, type AiClassifyStaticCategory, type AiEmailAnalysisOptions, type AiFileAnalysisOptions, type AiSearchTableOptions, type AiSearchTableOutput, type AiSummarizeOptions, type AiTransformOptions, type ApiRequestHeader, type ApiRequestOptions, type ApprovalChainOptions, type ApprovalChainTemplateOptions, type ApprovalStatusUpdateOptions, type ApprovalStatusUpdateStatus, type AssignGroupOptions, type AssignUserOptions, type AssignmentEngineOptions, type BulkExcelFieldMapping, type BulkExcelFieldSource, type BulkExcelOptions, type CalculationEntry, type CalculationExpression, type CalculationInclude, type CalculationOptions, type CalculationOutputs, type CalculationValueInput, type CalculationValueOptions, type CalculationValueOutputs, type CalculationValues, type CreateRecordOptions, type CreateRecordOutput, type EmailAttachment, type ExecuteScriptOptions, type FieldAssignment, type FilterActionOptions, type FindRelatedRecordsOptions, type FindRelatedRecordsOutput, type GenerateReportOptions, type InitiateCallOptions, type InitiateEmailConversationOptions, type InitiateEmailFirstEmail, type LegacyCalculationOptions, type MultiSelectUpdateMode, type NotificationOptions, type PostCommentOptions, type PostTeamsMessageOptions, type LegacyProcedureOptions, type ProcedureOptions, type TypedProcedureOptions, type ReadFileDataSource, type ReadFileOptions, type RecordFieldLockingOptions, type RecordId, type RecordReference, type RecordSearchOptions, type RecordSearchOutput, type RelateRecordsOptions, type RunAutomationInput, type RunAutomationOptions, type SaveAttachmentOptions, type ScriptOutputProperties, type ScriptOutputScalarType, type ScriptOutputType, type ScriptOutputs, type SendEmailOptions, type SendSurveyOptions, type SetVariableOptions, type TableRecordsSearchOptions, type TableRecordsSearchOutput, type UnzipOptions, type UpdateFieldAssignment, type UpdateFieldOptions, type UserSearchOptions, type VariableAssign, type VariableDecl } from "./tasks.js";
|
|
21
|
+
export { approvalProcessStatusUpdated, attachment, commentAdded, conversationEnd, dataMine, emailReceived, onDemand, recordCreated, recordUpdated, schedule, slackMessage, surveyResponseCreate, temporal, webHook, webhook, type AttachmentTriggerOptions, type AttachmentTriggerOutput, type CommentAddedTriggerOptions, type CommentAddedTriggerOutput, type ConversationEndConversationType, type ConversationEndTriggerOptions, type ConversationEndTriggerOutput, type DataMineTriggerOptions, type DataMineTriggerOutput, type EmailReceivedTriggerOptions, type EmailReceivedTriggerOutput, type RecordTriggerOptions, type RecordTriggerOutput, type ScheduleFrequency, type ScheduleTriggerOptions, type ScheduleTriggerOutput, type SlackMessageTriggerOutput, type SurveyResponseCreateTriggerOptions, type SurveyResponseCreateTriggerOutput, type TemporalTriggerOptions, type TemporalUnit, type WebhookTriggerOptions, type WebhookTriggerOutput, type Weekday, type approvalProcessStatusUpdatedStatus, type approvalProcessStatusUpdatedTriggerOptions } from "./triggers.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** The automation entity's registry entry (see src/graph/). */
|
|
2
2
|
import { sanitizeName, tfLabelToTsLabel, isTfExpr } from "../../engine/tf/index.js";
|
|
3
3
|
import { renderAutomationCatalogEntry } from "./catalog-render.js";
|
|
4
|
-
import {
|
|
4
|
+
import { preserveAuthoredAutomationPullMeta, printAutomationV2 } from "./deserializer/print-automation.js";
|
|
5
5
|
import { automationFromTf, automationOwnedAddresses } from "./from-tf.js";
|
|
6
6
|
import { automationToTf } from "./to-tf.js";
|
|
7
7
|
import { ALL_AUTOMATION_SUB_TYPES, AUTOMATION_RESOURCE_TYPE, WORKFLOW_PUBLISH_RESOURCE_TYPE, } from "./types.js";
|
|
@@ -194,7 +194,7 @@ export const automationModule = {
|
|
|
194
194
|
}),
|
|
195
195
|
};
|
|
196
196
|
},
|
|
197
|
-
mergePulledSource:
|
|
197
|
+
mergePulledSource: preserveAuthoredAutomationPullMeta,
|
|
198
198
|
toTf: (entity, ctx) => automationToTf(entity, {
|
|
199
199
|
appRefName: ctx.appRefName,
|
|
200
200
|
appTfLabel: ctx.appTfLabel,
|
|
@@ -204,6 +204,7 @@ export const automationModule = {
|
|
|
204
204
|
fieldNames: ctx.fieldNames ?? new Map(),
|
|
205
205
|
fieldMetadata: ctx.fieldMetadata ?? new Map(),
|
|
206
206
|
...(ctx.fieldNamesByAppRefName !== undefined ? { fieldNamesByAppRefName: ctx.fieldNamesByAppRefName } : {}),
|
|
207
|
+
...(ctx.fieldAddressesByAppRefName !== undefined ? { fieldAddressesByAppRefName: ctx.fieldAddressesByAppRefName } : {}),
|
|
207
208
|
...(ctx.allowUnknownPicklistOptions === true ? { allowUnknownPicklistOptions: true } : {}),
|
|
208
209
|
orgRefs: ctx.orgRefs,
|
|
209
210
|
workspaceAspects: ctx.workspaceAspects,
|
|
@@ -21,24 +21,36 @@ export function outputFieldTypesFromScriptSchema(schema) {
|
|
|
21
21
|
if (!Array.isArray(properties))
|
|
22
22
|
return undefined;
|
|
23
23
|
const out = new Map();
|
|
24
|
+
const nodeType = (node) => {
|
|
25
|
+
if (!isObject(node))
|
|
26
|
+
return undefined;
|
|
27
|
+
const [kind, body] = Object.entries(node)[0] ?? [];
|
|
28
|
+
if (!isObject(body) || typeof kind !== "string")
|
|
29
|
+
return undefined;
|
|
30
|
+
if (kind === "array") {
|
|
31
|
+
const item = nodeType(body.item);
|
|
32
|
+
return item === undefined ? undefined : { ...item, multiple: true, kind: "array" };
|
|
33
|
+
}
|
|
34
|
+
if (kind === "object")
|
|
35
|
+
return { fieldType: "TEXT", multiple: false, kind };
|
|
36
|
+
const fieldType = kind === "bool" ? "BOOLEAN"
|
|
37
|
+
: kind === "integer" ? "NUMBER"
|
|
38
|
+
: kind === "number" ? "DECIMAL"
|
|
39
|
+
: kind === "string" ? "TEXT"
|
|
40
|
+
: undefined;
|
|
41
|
+
return fieldType === undefined ? undefined : { fieldType, multiple: false, kind };
|
|
42
|
+
};
|
|
24
43
|
for (const property of properties) {
|
|
25
44
|
if (!isObject(property))
|
|
26
45
|
continue;
|
|
27
|
-
for (const
|
|
46
|
+
for (const body of Object.values(property)) {
|
|
28
47
|
if (!isObject(body) || typeof body.name !== "string")
|
|
29
48
|
continue;
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// "string" is a real, confirmed-text kind; anything else (e.g. "object")
|
|
36
|
-
// is an unmodeled schema kind falling back to the platform's own TEXT
|
|
37
|
-
// default — real for the wire, but callers that need to know whether
|
|
38
|
-
// this was an ACTUAL text kind (not a guess) should check `kind` too.
|
|
39
|
-
: "TEXT";
|
|
40
|
-
out.set(`result.${body.name}`, { fieldType, multiple: false, kind });
|
|
41
|
-
out.set(body.name, { fieldType, multiple: false, kind });
|
|
49
|
+
const resolved = nodeType(property);
|
|
50
|
+
if (resolved === undefined)
|
|
51
|
+
continue;
|
|
52
|
+
out.set(`result.${body.name}`, resolved);
|
|
53
|
+
out.set(body.name, resolved);
|
|
42
54
|
}
|
|
43
55
|
}
|
|
44
56
|
return out.size > 0 ? out : undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ScriptOutputType } from "./tasks.js";
|
|
1
2
|
/** The shape the platform passes to a script: inputs under `parameters`. */
|
|
2
3
|
export interface ScriptInput<I extends Record<string, unknown> = Record<string, unknown>> {
|
|
3
4
|
readonly parameters: I;
|
|
@@ -39,13 +40,20 @@ export declare function stripTsIgnoreLines(code: string): string;
|
|
|
39
40
|
* The scan is context-aware (skips comments, strings, and template literals
|
|
40
41
|
* with `${}` nesting) so braces inside them don't derail the literal walk.
|
|
41
42
|
*/
|
|
42
|
-
export declare function inferOutputSchema(body: string): Record<string,
|
|
43
|
+
export declare function inferOutputSchema(body: string): Record<string, ScriptOutputType> | undefined;
|
|
43
44
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
45
|
+
* Free-identifier scan: uses the TypeScript compiler parser when available
|
|
46
|
+
* for full AST-level grammar fidelity, falling back to a tokenizing lexer when
|
|
47
|
+
* typescript is not present in the runtime environment.
|
|
47
48
|
*/
|
|
48
49
|
export declare function freeIdentifiers(body: string, params: ReadonlySet<string>): string[];
|
|
50
|
+
/**
|
|
51
|
+
* Best-effort fallback tokenizing scan: strip comments/strings/templates, collect
|
|
52
|
+
* identifier tokens that are not property accesses, object keys, declarations,
|
|
53
|
+
* params, keywords, or known script globals. Scope-aware for nested methods,
|
|
54
|
+
* functions, catch clauses, and arrow function parameter blocks.
|
|
55
|
+
*/
|
|
56
|
+
export declare function freeIdentifiersLexer(body: string, params: ReadonlySet<string>): string[];
|
|
49
57
|
/**
|
|
50
58
|
* Look up task `name`'s `code:` body verbatim from the automation file
|
|
51
59
|
* `elementum build` is currently importing (tracked engine-side by
|