@elementumai/edk 0.9.20 → 0.10.2
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 +19 -7
- package/dist-sdk/src/catalog/factories.d.ts +10 -2
- package/dist-sdk/src/catalog/factories.js +10 -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 +4 -0
- package/dist-sdk/src/catalog/types.d.ts +7 -1
- package/dist-sdk/src/catalog/types.js +1 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +2 -2
- package/dist-sdk/src/core/triggers/on-demand.js +7 -0
- package/dist-sdk/src/core/types/app.d.ts +2 -2
- package/dist-sdk/src/engine/coverage-gaps.d.ts +86 -0
- package/dist-sdk/src/engine/coverage-gaps.js +156 -0
- package/dist-sdk/src/engine/ei/run.d.ts +21 -1
- package/dist-sdk/src/engine/ei/run.js +89 -2
- package/dist-sdk/src/engine/pull/catalog-ref.d.ts +16 -0
- package/dist-sdk/src/engine/pull/catalog-ref.js +24 -0
- package/dist-sdk/src/engine/pull/context.d.ts +68 -6
- package/dist-sdk/src/engine/pull/context.js +40 -1
- package/dist-sdk/src/engine/pull/procedure-refs.d.ts +8 -0
- package/dist-sdk/src/engine/pull/procedure-refs.js +28 -0
- package/dist-sdk/src/engine/pull/result-output.js +27 -1
- 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 +22 -5
- package/dist-sdk/src/engine/tf/labels.js +45 -3
- package/dist-sdk/src/engine/tf/parse.js +3 -2
- package/dist-sdk/src/engine/validation.d.ts +5 -0
- package/dist-sdk/src/engine/validation.js +12 -2
- package/dist-sdk/src/entities/access-policy/from-tf.js +38 -1
- package/dist-sdk/src/entities/access-policy/principal.d.ts +2 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +3 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +42 -19
- package/dist-sdk/src/entities/agent/from-tf.js +11 -3
- package/dist-sdk/src/entities/agent/module.js +2 -0
- package/dist-sdk/src/entities/agent/to-tf.js +14 -3
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +8 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.js +11 -5
- package/dist-sdk/src/entities/agent-tool/module.js +3 -0
- package/dist-sdk/src/entities/app/auto-share.d.ts +38 -0
- package/dist-sdk/src/entities/app/auto-share.js +49 -0
- package/dist-sdk/src/entities/app/build.d.ts +17 -3
- package/dist-sdk/src/entities/app/build.js +56 -4
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +6 -1
- package/dist-sdk/src/entities/app/from-tf.js +4 -0
- package/dist-sdk/src/entities/app/index.d.ts +2 -1
- package/dist-sdk/src/entities/app/index.js +1 -8
- package/dist-sdk/src/entities/app/module.js +2 -1
- package/dist-sdk/src/entities/app/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/app/to-tf.js +25 -2
- package/dist-sdk/src/entities/automation/build.d.ts +12 -2
- package/dist-sdk/src/entities/automation/build.js +105 -17
- package/dist-sdk/src/entities/automation/calculation-expression.d.ts +7 -7
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +17 -4
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +187 -27
- package/dist-sdk/src/entities/automation/from-tf.d.ts +9 -2
- package/dist-sdk/src/entities/automation/from-tf.js +397 -89
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/index.js +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +3 -0
- package/dist-sdk/src/entities/automation/module.js +70 -7
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +21 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +38 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +5 -2
- package/dist-sdk/src/entities/automation/script-code.js +23 -5
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +37 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +76 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +92 -20
- package/dist-sdk/src/entities/automation/tasks.js +48 -15
- package/dist-sdk/src/entities/automation/to-tf.d.ts +20 -3
- package/dist-sdk/src/entities/automation/to-tf.js +656 -65
- package/dist-sdk/src/entities/automation/triggers.d.ts +8 -4
- package/dist-sdk/src/entities/automation/types.d.ts +9 -0
- package/dist-sdk/src/entities/automation/types.js +19 -0
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +1 -1
- package/dist-sdk/src/entities/automation/value-ref-tf.js +1 -1
- package/dist-sdk/src/entities/chart/from-tf.js +9 -1
- package/dist-sdk/src/entities/data-lookup/module.js +2 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +7 -5
- package/dist-sdk/src/entities/element/build.d.ts +3 -0
- package/dist-sdk/src/entities/element/build.js +1 -0
- package/dist-sdk/src/entities/element/from-tf.js +4 -0
- package/dist-sdk/src/entities/element/module.js +2 -1
- package/dist-sdk/src/entities/element/to-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/to-tf.js +12 -14
- package/dist-sdk/src/entities/field/build.d.ts +3 -2
- package/dist-sdk/src/entities/field/calc.d.ts +7 -7
- package/dist-sdk/src/entities/field/from-tf.d.ts +4 -4
- package/dist-sdk/src/entities/field/from-tf.js +255 -80
- package/dist-sdk/src/entities/field/module.d.ts +6 -0
- package/dist-sdk/src/entities/field/module.js +23 -2
- package/dist-sdk/src/entities/field/options.js +6 -1
- package/dist-sdk/src/entities/field/order.d.ts +16 -0
- package/dist-sdk/src/entities/field/order.js +41 -0
- package/dist-sdk/src/entities/field/to-tf.d.ts +4 -4
- package/dist-sdk/src/entities/field/to-tf.js +7 -1
- package/dist-sdk/src/entities/field/types.d.ts +7 -0
- package/dist-sdk/src/entities/field/types.js +32 -0
- package/dist-sdk/src/entities/role/from-tf.js +3 -3
- package/dist-sdk/src/entities/role/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/role/to-tf.js +12 -4
- package/dist-sdk/src/entities/service-account/from-tf.js +3 -3
- package/dist-sdk/src/entities/service-account/workspace-owner.d.ts +16 -0
- package/dist-sdk/src/entities/service-account/workspace-owner.js +22 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +15 -1
- package/dist-sdk/src/entities/shared/filters/ast.js +2 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +5 -0
- package/dist-sdk/src/entities/shared/filters/index.js +5 -0
- package/dist-sdk/src/entities/shared/filters/print.js +7 -2
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +5 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +42 -7
- package/dist-sdk/src/entities/shared/filters/types.d.ts +8 -3
- package/dist-sdk/src/entities/shared/ref.d.ts +5 -7
- package/dist-sdk/src/entities/shared/ref.js +5 -7
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +9 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +35 -2
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -0
- package/dist-sdk/src/entities/shared/types/field-types.js +4 -0
- package/dist-sdk/src/entities/skill/access-policy.js +3 -3
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +3 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +12 -5
- package/dist-sdk/src/entities/skill/from-tf.js +4 -2
- package/dist-sdk/src/entities/skill/module.js +2 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +41 -8
- package/dist-sdk/src/entities/skill-tool/module.js +3 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +0 -6
- package/dist-sdk/src/entities/skill-tool/to-tf.js +22 -9
- package/dist-sdk/src/entities/task/build.d.ts +8 -0
- package/dist-sdk/src/entities/task/build.js +10 -1
- package/dist-sdk/src/entities/task/from-tf.d.ts +4 -2
- package/dist-sdk/src/entities/task/from-tf.js +7 -2
- package/dist-sdk/src/entities/task/module.js +3 -2
- package/dist-sdk/src/entities/task/to-tf.d.ts +8 -4
- package/dist-sdk/src/entities/task/to-tf.js +32 -1
- package/dist-sdk/src/entities/view/from-tf.js +9 -1
- package/dist-sdk/src/entities/view/module.js +4 -1
- package/dist-sdk/src/entities/view/to-tf.d.ts +6 -7
- package/dist-sdk/src/entities/view/to-tf.js +30 -11
- package/dist-sdk/src/entities/view/types.d.ts +6 -0
- package/dist-sdk/src/entities/view/types.js +6 -0
- package/dist-sdk/src/entities/visual-flow/build.d.ts +16 -1
- package/dist-sdk/src/entities/visual-flow/build.js +9 -0
- package/dist-sdk/src/entities/visual-flow/from-tf.d.ts +14 -0
- package/dist-sdk/src/entities/visual-flow/from-tf.js +51 -3
- package/dist-sdk/src/entities/visual-flow/index.d.ts +1 -1
- package/dist-sdk/src/entities/visual-flow/index.js +1 -1
- package/dist-sdk/src/entities/visual-flow/printer.js +19 -0
- package/dist-sdk/src/entities/visual-flow/to-tf.js +87 -3
- package/dist-sdk/src/entities/widget/from-tf.js +3 -3
- package/dist-sdk/src/entities/widget/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/widget/to-tf.js +7 -6
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +133 -9
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +4 -2
- package/dist-sdk/src/graph/index.js +3 -0
- package/dist-sdk/src/graph/modules.js +2 -1
- package/dist-sdk/src/graph/types.d.ts +41 -3
- package/package.json +7 -3
|
@@ -18,5 +18,5 @@ 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 ForEachScope, type LoopScope, 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, scriptFile, type ScriptCodeFn, type ScriptFile, type ScriptInput } from "./script-code.js";
|
|
20
20
|
export { workflowOutput, workflowOutputType, type WorkflowOutputDeclaration, type WorkflowOutputType, } from "./workflow-output.js";
|
|
21
|
-
export { addWatcher, aiAgent, aiClassify, aiEmailAnalysis, aiFileAnalysis, aiSearchTable, aiSummarize, aiTransform, apiRequest, approvalChain, approvalChainTemplate, approvalStatusUpdate, requiredSecret, assignGroup, assignUser, assignmentEngine, bulkExcel, calculation, createRecord, executeScript, findRelatedRecords, generateReport, initiateCall, initiateEmailConversation, notification, postComment, postTeamsMessage, procedure, readFile, recordFieldLocking, recordSearch, relateRecords, runAutomation, saveAttachment, sendEmail, sendSurvey, setVariable, tableRecordsSearch, unzip, updateField, userGroupSearch, userSearch, withFieldMappings, type AddWatcherOptions, type AiAgentAttachment, 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 RequiredSecret, 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 ExecuteScriptFieldMapping, type ExecuteScriptOptions, type FieldAssignment, 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 UserGroupSearchOptions, type UserGroupSearchOutput, type UserGroupShape, type UserSearchOptions, type VariableAssign, type VariableDecl } from "./tasks.js";
|
|
21
|
+
export { addWatcher, aiAgent, aiClassify, aiEmailAnalysis, aiFileAnalysis, aiSearchTable, aiSummarize, aiTransform, apiRequest, approvalChain, approvalChainTemplate, approvalStatusUpdate, requiredSecret, assignGroup, assignUser, assignmentEngine, bulkExcel, bulkUpdateFields, calculation, createRecord, executeScript, findRelatedRecords, generateReport, initiateCall, initiateEmailConversation, notification, postComment, postTeamsMessage, procedure, readFile, recordFieldLocking, recordSearch, relateRecords, runAutomation, saveAttachment, sendEmail, sendSurvey, setVariable, tableRecordsSearch, unzip, updateField, userGroupSearch, userSearch, withFieldMappings, type AddWatcherOptions, type AiAgentAttachment, 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 RequiredSecret, type ApprovalChainTemplateOptions, type ApprovalStatusUpdateOptions, type ApprovalStatusUpdateStatus, type AssignGroupOptions, type AssignUserOptions, type AssignmentEngineOptions, type BulkExcelFieldMapping, type BulkExcelFieldSource, type BulkExcelOptions, type BulkUpdateFieldsOptions, type BulkUpdateFieldsOutput, 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 ExecuteScriptFieldMapping, type ExecuteScriptOptions, type FieldAssignment, type FindRelatedRecordsOptions, type FindRelatedRecordsOutput, type GenerateReportOptions, type InitiateCallOptions, type InitiateEmailConversationOptions, type InitiateEmailFirstEmail, type LegacyCalculationOptions, type MultiSelectUpdateMode, type NotificationOptions, type StaticGroupRecipient, type StaticUserRecipient, 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 RunAutomationDynamicReferenceOptions, type RunAutomationOptions, type RunAutomationStaticOptions, 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 UserGroupSearchOptions, type UserGroupSearchOutput, type UserGroupShape, type UserSearchOptions, type VariableAssign, type VariableDecl } from "./tasks.js";
|
|
22
22
|
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";
|
|
@@ -18,7 +18,7 @@ export * as filter from "../shared/filters/index.js";
|
|
|
18
18
|
export { automationStatus, chainableTrigger, actions, automation } from "./build.js";
|
|
19
19
|
export { ScriptCodeError, scriptFile } from "./script-code.js";
|
|
20
20
|
export { workflowOutput, workflowOutputType, } from "./workflow-output.js";
|
|
21
|
-
export { addWatcher, aiAgent, aiClassify, aiEmailAnalysis, aiFileAnalysis, aiSearchTable, aiSummarize, aiTransform, apiRequest, approvalChain, approvalChainTemplate, approvalStatusUpdate, requiredSecret, assignGroup, assignUser, assignmentEngine, bulkExcel, calculation, createRecord, executeScript, findRelatedRecords, generateReport, initiateCall, initiateEmailConversation, notification, postComment, postTeamsMessage, procedure, readFile, recordFieldLocking, recordSearch, relateRecords, runAutomation, saveAttachment, sendEmail, sendSurvey, setVariable, tableRecordsSearch, unzip, updateField, userGroupSearch, userSearch, withFieldMappings } from "./tasks.js";
|
|
21
|
+
export { addWatcher, aiAgent, aiClassify, aiEmailAnalysis, aiFileAnalysis, aiSearchTable, aiSummarize, aiTransform, apiRequest, approvalChain, approvalChainTemplate, approvalStatusUpdate, requiredSecret, assignGroup, assignUser, assignmentEngine, bulkExcel, bulkUpdateFields, calculation, createRecord, executeScript, findRelatedRecords, generateReport, initiateCall, initiateEmailConversation, notification, postComment, postTeamsMessage, procedure, readFile, recordFieldLocking, recordSearch, relateRecords, runAutomation, saveAttachment, sendEmail, sendSurvey, setVariable, tableRecordsSearch, unzip, updateField, userGroupSearch, userSearch, withFieldMappings } from "./tasks.js";
|
|
22
22
|
export { approvalProcessStatusUpdated, attachment, commentAdded, conversationEnd, dataMine, emailReceived, onDemand, recordCreated, recordUpdated, schedule, slackMessage, surveyResponseCreate, temporal, webHook, webhook } from "./triggers.js";
|
|
23
23
|
// Pull a deployed automation back as editable v2 source. `automation`
|
|
24
24
|
// is a plain factory returning a builder-chain object (not an Object.assign-able
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/** The automation entity's registry entry (see src/graph/). */
|
|
2
|
+
import { type TfBlock } from "../../engine/tf/index.js";
|
|
2
3
|
import { type EntityKindModule } from "../../graph/types.js";
|
|
4
|
+
/** The named WARN for an automation pull could not extract (edk#1054, edk#1480). */
|
|
5
|
+
export declare function droppedAutomationGap(autoBlock: TfBlock, autoLabel: string, reason: string): string;
|
|
3
6
|
export declare const automationModule: EntityKindModule;
|
|
4
7
|
/** The provider's `normalizeOnDemandFilterRefName`, which computes `filter_refs` at plan time. */
|
|
5
8
|
export declare function onDemandFilterRefName(name: string): string;
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
/** The automation entity's registry entry (see src/graph/). */
|
|
2
|
-
import { sanitizeName, tfLabelToTsLabel, isTfExpr } from "../../engine/tf/index.js";
|
|
2
|
+
import { appScopedResourceLabel, sanitizeName, tfLabelToTsLabel, isTfExpr } from "../../engine/tf/index.js";
|
|
3
|
+
function elementOwnerHandle(payload) {
|
|
4
|
+
if (payload === null || typeof payload !== "object" || !("handle" in payload))
|
|
5
|
+
return undefined;
|
|
6
|
+
const handle = payload.handle;
|
|
7
|
+
return typeof handle === "string" && handle !== "" ? handle : undefined;
|
|
8
|
+
}
|
|
3
9
|
import { renderAutomationCatalogEntry } from "./catalog-render.js";
|
|
4
10
|
import { hasUnresolvedForEachItem, preserveAuthoredAutomationPullMeta, printAutomationV2WithScriptFiles, SCRIPT_FILES_DIR } from "./deserializer/print-automation.js";
|
|
11
|
+
import { reportAuthoringBlocker } from "../../engine/pull/context.js";
|
|
5
12
|
import { recordValidations } from "../../engine/validation.js";
|
|
6
13
|
import { automationFromTf, automationOwnedAddresses, ForEachItemOutsideLoopError, UnsupportedMultiTriggerError } from "./from-tf.js";
|
|
7
14
|
import { scriptFileRefs } from "./script-code.js";
|
|
15
|
+
import { typedCoverageGap } from "../../engine/coverage-gaps.js";
|
|
8
16
|
import { TASK_OUTPUT_REFERENCE_NAMES } from "./task-output-labels.js";
|
|
9
17
|
import { automationToTf } from "./to-tf.js";
|
|
10
18
|
import { ALL_AUTOMATION_SUB_TYPES, AUTOMATION_RESOURCE_TYPE, WORKFLOW_PUBLISH_RESOURCE_TYPE, } from "./types.js";
|
|
19
|
+
const AUTOMATION_MEMBER_TYPES = new Set([
|
|
20
|
+
WORKFLOW_PUBLISH_RESOURCE_TYPE,
|
|
21
|
+
...ALL_AUTOMATION_SUB_TYPES.map((subType) => subType.resourceType),
|
|
22
|
+
]);
|
|
11
23
|
function isConfigured(value) {
|
|
12
24
|
return (typeof value === "object" &&
|
|
13
25
|
value !== null &&
|
|
@@ -89,19 +101,36 @@ function registerForeignObjectIdDeps(doc, automationLabel, ctx) {
|
|
|
89
101
|
if (!isTfExpr(objectId) || objectId.$expr !== "data-attr")
|
|
90
102
|
continue;
|
|
91
103
|
if (objectId.type === "elementum_app") {
|
|
92
|
-
|
|
104
|
+
// Namespace-only data blocks (ei's common foreign-app shape) leave
|
|
105
|
+
// dataName undefined; fall back to the namespace attribute (#1647).
|
|
106
|
+
const attrs = ctx.dataAttrs?.("elementum_app", objectId.label);
|
|
107
|
+
const name = ctx.dataName("elementum_app", objectId.label)
|
|
108
|
+
?? (typeof attrs?.["namespace"] === "string" ? attrs["namespace"] : undefined);
|
|
93
109
|
if (name === undefined || ctx.foreignAppRefNames?.has(name))
|
|
94
110
|
continue;
|
|
95
111
|
unresolved.apps.add(name);
|
|
96
112
|
}
|
|
97
113
|
else if (objectId.type === "elementum_element") {
|
|
98
|
-
const
|
|
114
|
+
const attrs = ctx.dataAttrs?.("elementum_element", objectId.label);
|
|
115
|
+
const name = ctx.dataName("elementum_element", objectId.label)
|
|
116
|
+
?? (typeof attrs?.["namespace"] === "string" ? attrs["namespace"] : undefined);
|
|
99
117
|
if (name === undefined || ctx.foreignElementRefNames?.has(name))
|
|
100
118
|
continue;
|
|
101
119
|
unresolved.elements.add(name);
|
|
102
120
|
}
|
|
103
121
|
}
|
|
104
122
|
}
|
|
123
|
+
/** The named WARN for an automation pull could not extract (edk#1054, edk#1480). */
|
|
124
|
+
export function droppedAutomationGap(autoBlock, autoLabel, reason) {
|
|
125
|
+
const name = autoBlock.attrs["name"];
|
|
126
|
+
const display = typeof name === "string" && name !== "" ? name : autoLabel;
|
|
127
|
+
return typedCoverageGap({
|
|
128
|
+
kind: "skipped",
|
|
129
|
+
entity: `automation ${JSON.stringify(display)} (${autoLabel})`,
|
|
130
|
+
detail: `not pulled, skipped: ${reason}`,
|
|
131
|
+
consequence: "it is not written to source or adopted; it keeps running on the platform unmanaged",
|
|
132
|
+
});
|
|
133
|
+
}
|
|
105
134
|
function extractAutomations(ownBlocks, stream, ctx) {
|
|
106
135
|
const items = [];
|
|
107
136
|
const skipped = [];
|
|
@@ -117,7 +146,7 @@ function extractAutomations(ownBlocks, stream, ctx) {
|
|
|
117
146
|
// (one owned-address walk) relative to from-tf.
|
|
118
147
|
registerForeignObjectIdDeps(doc, autoLabel, ctx);
|
|
119
148
|
try {
|
|
120
|
-
const extracted = automationFromTf(doc, autoLabel, ctx.appRefName, ctx.foreignFieldRefsById, ctx.foreignFieldRefsByDataAddress, ctx.foreignTableRefsById, ctx.picklistOptionLabelById, ctx.fieldNamesByOwnerRefName, ctx.foreignAppRefNames, ctx.foreignElementRefNames, ctx.procedureKeysByDiscriminator, ctx.foreignTaskRefNames);
|
|
149
|
+
const extracted = automationFromTf(doc, autoLabel, ctx.appRefName, ctx.foreignFieldRefsById, ctx.foreignFieldRefsByDataAddress, ctx.foreignTableRefsById, ctx.picklistOptionLabelById, ctx.fieldNamesByOwnerRefName, ctx.foreignAppRefNames, ctx.foreignElementRefNames, ctx.procedureKeysByDiscriminator, ctx.foreignTaskRefNames, ctx.groupKeysByName);
|
|
121
150
|
// Keep automationFromTf's label-derived refName — agent/skill tools store
|
|
122
151
|
// the same scopedLabelToBagKey as automationKey. Pushing bare AST (name
|
|
123
152
|
// only) made missing-automation diagnostics false-positive on every real
|
|
@@ -158,9 +187,36 @@ function extractAutomations(ownBlocks, stream, ctx) {
|
|
|
158
187
|
// not printed, so the build must not also report the placeholder.
|
|
159
188
|
if (err instanceof ForEachItemOutsideLoopError)
|
|
160
189
|
releaseIfManaged.push(...owned);
|
|
161
|
-
|
|
190
|
+
// edk#1480: name the dropped automation and say what that means, as a
|
|
191
|
+
// typed gap so it counts (and fails --strict-coverage) by itself.
|
|
192
|
+
diagnostics.push(droppedAutomationGap(autoBlock, autoLabel, err instanceof Error ? err.message : String(err)));
|
|
162
193
|
}
|
|
163
194
|
}
|
|
195
|
+
// A trigger, task, or publish with no automation resource is not in any
|
|
196
|
+
// skeleton's graph. extractAutomations never sees it, and its resource type
|
|
197
|
+
// is still adoptable, so the next plan can destroy it (#1484).
|
|
198
|
+
const doc = { blocks: [...stream.allBlocks] };
|
|
199
|
+
const owned = new Set();
|
|
200
|
+
for (const autoBlock of ownBlocks) {
|
|
201
|
+
if (autoBlock.label === undefined || autoBlock.label === "")
|
|
202
|
+
continue;
|
|
203
|
+
for (const address of automationOwnedAddresses(doc, autoBlock.label))
|
|
204
|
+
owned.add(address);
|
|
205
|
+
}
|
|
206
|
+
for (const block of stream.familyByKind.get("automation") ?? []) {
|
|
207
|
+
if (block.type === undefined || block.label === undefined || !AUTOMATION_MEMBER_TYPES.has(block.type))
|
|
208
|
+
continue;
|
|
209
|
+
const address = `${block.type}.${block.label}`;
|
|
210
|
+
if (owned.has(address))
|
|
211
|
+
continue;
|
|
212
|
+
skipped.push(address);
|
|
213
|
+
reportAuthoringBlocker(ctx, {
|
|
214
|
+
address,
|
|
215
|
+
ownFileKind: "automation",
|
|
216
|
+
description: `${address} is not owned by an ${AUTOMATION_RESOURCE_TYPE} resource, so it cannot be pulled`,
|
|
217
|
+
remedy: "The export is missing the automation these resources belong to. Re-export the app, or remove the orphaned automation resources, then pull again.",
|
|
218
|
+
});
|
|
219
|
+
}
|
|
164
220
|
return { items, skipped, releaseIfManaged, diagnostics, validations, adoptionAddressAliases };
|
|
165
221
|
}
|
|
166
222
|
export const automationModule = {
|
|
@@ -174,6 +230,9 @@ export const automationModule = {
|
|
|
174
230
|
resource: {
|
|
175
231
|
shape: "composite",
|
|
176
232
|
adoptable: true,
|
|
233
|
+
// An element-owned automation's ref name already carries the handle prefix
|
|
234
|
+
// ei exports and build keeps (`<handle>_<automation>`).
|
|
235
|
+
childLabel: (ownerTfLabel, childTfLabel, scope) => scope === "element" ? childTfLabel : appScopedResourceLabel(ownerTfLabel, childTfLabel),
|
|
177
236
|
members: [
|
|
178
237
|
{ role: "skeleton", resourceType: AUTOMATION_RESOURCE_TYPE, implemented: true },
|
|
179
238
|
{ role: "publish", resourceType: WORKFLOW_PUBLISH_RESOURCE_TYPE, implemented: true },
|
|
@@ -221,6 +280,8 @@ export const automationModule = {
|
|
|
221
280
|
appRefName: opts.appRefName,
|
|
222
281
|
...(opts.foreignAppRefNames !== undefined && { foreignAppRefNames: opts.foreignAppRefNames }),
|
|
223
282
|
...(opts.foreignElementRefNames !== undefined && { foreignElementRefNames: opts.foreignElementRefNames }),
|
|
283
|
+
...(opts.foreignAppRefNamespaces !== undefined && { foreignAppRefNamespaces: opts.foreignAppRefNamespaces }),
|
|
284
|
+
...(opts.foreignElementRefNamespaces !== undefined && { foreignElementRefNamespaces: opts.foreignElementRefNamespaces }),
|
|
224
285
|
...(opts.foreignTaskRefNames !== undefined && { foreignTaskRefNames: opts.foreignTaskRefNames }),
|
|
225
286
|
...(opts.unresolvedReferences !== undefined && { unresolvedReferences: opts.unresolvedReferences }),
|
|
226
287
|
});
|
|
@@ -236,6 +297,7 @@ export const automationModule = {
|
|
|
236
297
|
appRefName: ctx.appRefName,
|
|
237
298
|
appTfLabel: ctx.appTfLabel,
|
|
238
299
|
parentScope: ctx.parentScope === "element" ? "element" : "app",
|
|
300
|
+
...(ctx.parentScope === "element" ? { ownerHandle: elementOwnerHandle(ctx.streamRootEntity?.payload) } : {}),
|
|
239
301
|
...(ctx.streamRootEntity?.payload?.auditFields === true
|
|
240
302
|
? { ownerAuditFields: true }
|
|
241
303
|
: {}),
|
|
@@ -286,8 +348,9 @@ export const automationModule = {
|
|
|
286
348
|
}],
|
|
287
349
|
exportedAttributeLocals: [{
|
|
288
350
|
resourceType: "elementum_variable_task",
|
|
289
|
-
attribute: "
|
|
290
|
-
localPrefix: "
|
|
351
|
+
attribute: "variables",
|
|
352
|
+
localPrefix: "edk_variable_ids_",
|
|
353
|
+
listField: "id",
|
|
291
354
|
}],
|
|
292
355
|
},
|
|
293
356
|
};
|
|
@@ -62,3 +62,24 @@ export declare const API_TASK_REF_AUTHORING_NAMES: Readonly<Record<string, strin
|
|
|
62
62
|
* callers can fall back to the generic segment mapping.
|
|
63
63
|
*/
|
|
64
64
|
export declare function apiTaskRefAuthoringPath(wireSegment: string): string[] | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* executeScript contract outputs whose authoring name is not the refs-map key.
|
|
67
|
+
*
|
|
68
|
+
* Live provider state (UA Activity) keys the whole JSON result as `Result`
|
|
69
|
+
* and the text-list contract output as `Text List Result`. The canonical
|
|
70
|
+
* taskReference names — and the accessors EDK authors — stay `result` and
|
|
71
|
+
* `stringArrayResult`. Property refs stay `result.<prop>` on both sides, so
|
|
72
|
+
* this table is exact keys only: `result.passed` must not become `Result.passed`.
|
|
73
|
+
* `numberArrayResult` is already the refs key. A variable named `Result` is a
|
|
74
|
+
* different resource and must not use this table.
|
|
75
|
+
*/
|
|
76
|
+
export declare const EXECUTE_SCRIPT_REFS_INDEX: Readonly<Record<string, string>>;
|
|
77
|
+
/** Inverse of {@link EXECUTE_SCRIPT_REFS_INDEX}, plus the canonical names themselves. */
|
|
78
|
+
export declare const EXECUTE_SCRIPT_REF_AUTHORING_PATH: Readonly<Record<string, readonly string[]>>;
|
|
79
|
+
/** refs-map key for one executeScript contract output, or undefined when `name` is not one. */
|
|
80
|
+
export declare function executeScriptRefsIndex(name: string): string | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* Authoring path for an executeScript refs key or canonical output name.
|
|
83
|
+
* Undefined for `result.<prop>` and for any other task's output.
|
|
84
|
+
*/
|
|
85
|
+
export declare function executeScriptAuthoringPath(name: string): readonly string[] | undefined;
|
|
@@ -84,3 +84,41 @@ export function apiTaskRefAuthoringPath(wireSegment) {
|
|
|
84
84
|
const authoring = API_TASK_REF_AUTHORING_NAMES[wireSegment];
|
|
85
85
|
return authoring !== undefined ? authoring.split(".") : undefined;
|
|
86
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* executeScript contract outputs whose authoring name is not the refs-map key.
|
|
89
|
+
*
|
|
90
|
+
* Live provider state (UA Activity) keys the whole JSON result as `Result`
|
|
91
|
+
* and the text-list contract output as `Text List Result`. The canonical
|
|
92
|
+
* taskReference names — and the accessors EDK authors — stay `result` and
|
|
93
|
+
* `stringArrayResult`. Property refs stay `result.<prop>` on both sides, so
|
|
94
|
+
* this table is exact keys only: `result.passed` must not become `Result.passed`.
|
|
95
|
+
* `numberArrayResult` is already the refs key. A variable named `Result` is a
|
|
96
|
+
* different resource and must not use this table.
|
|
97
|
+
*/
|
|
98
|
+
export const EXECUTE_SCRIPT_REFS_INDEX = {
|
|
99
|
+
result: "Result",
|
|
100
|
+
textResult: "Text Result",
|
|
101
|
+
stringArrayResult: "Text List Result",
|
|
102
|
+
numberArrayResult: "numberArrayResult",
|
|
103
|
+
};
|
|
104
|
+
/** Inverse of {@link EXECUTE_SCRIPT_REFS_INDEX}, plus the canonical names themselves. */
|
|
105
|
+
export const EXECUTE_SCRIPT_REF_AUTHORING_PATH = {
|
|
106
|
+
Result: ["result"],
|
|
107
|
+
result: ["result"],
|
|
108
|
+
"Text Result": ["textResult"],
|
|
109
|
+
textResult: ["textResult"],
|
|
110
|
+
"Text List Result": ["stringArrayResult"],
|
|
111
|
+
stringArrayResult: ["stringArrayResult"],
|
|
112
|
+
numberArrayResult: ["numberArrayResult"],
|
|
113
|
+
};
|
|
114
|
+
/** refs-map key for one executeScript contract output, or undefined when `name` is not one. */
|
|
115
|
+
export function executeScriptRefsIndex(name) {
|
|
116
|
+
return EXECUTE_SCRIPT_REFS_INDEX[name];
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Authoring path for an executeScript refs key or canonical output name.
|
|
120
|
+
* Undefined for `result.<prop>` and for any other task's output.
|
|
121
|
+
*/
|
|
122
|
+
export function executeScriptAuthoringPath(name) {
|
|
123
|
+
return EXECUTE_SCRIPT_REF_AUTHORING_PATH[name];
|
|
124
|
+
}
|
|
@@ -48,8 +48,11 @@ export declare class ScriptCodeError extends Error {
|
|
|
48
48
|
* only as TypeScript has its types erased by the TypeScript transpiler with an
|
|
49
49
|
* ESNext target, so no syntax is downleveled into helpers; one that parses as
|
|
50
50
|
* neither is refused. `label` names the script in errors. With
|
|
51
|
-
* `stripTypes: false` (script files
|
|
52
|
-
* TypeScript
|
|
51
|
+
* `stripTypes: false` (script files) a TypeScript body is kept byte for byte
|
|
52
|
+
* so a pulled workflow round-trips. When TypeScript is available, a body that
|
|
53
|
+
* parses as neither JavaScript nor TypeScript is refused. When the TypeScript
|
|
54
|
+
* package cannot be loaded, the stored body is kept so pull can finish,
|
|
55
|
+
* including a body that cannot be classified.
|
|
53
56
|
*/
|
|
54
57
|
export declare function toPlatformScriptBody(body: string, label: string, options?: {
|
|
55
58
|
readonly stripTypes?: boolean;
|
|
@@ -174,17 +174,35 @@ function plainJavaScriptSyntaxError(body) {
|
|
|
174
174
|
* only as TypeScript has its types erased by the TypeScript transpiler with an
|
|
175
175
|
* ESNext target, so no syntax is downleveled into helpers; one that parses as
|
|
176
176
|
* neither is refused. `label` names the script in errors. With
|
|
177
|
-
* `stripTypes: false` (script files
|
|
178
|
-
* TypeScript
|
|
177
|
+
* `stripTypes: false` (script files) a TypeScript body is kept byte for byte
|
|
178
|
+
* so a pulled workflow round-trips. When TypeScript is available, a body that
|
|
179
|
+
* parses as neither JavaScript nor TypeScript is refused. When the TypeScript
|
|
180
|
+
* package cannot be loaded, the stored body is kept so pull can finish,
|
|
181
|
+
* including a body that cannot be classified.
|
|
179
182
|
*/
|
|
180
183
|
export function toPlatformScriptBody(body, label, options = {}) {
|
|
181
184
|
const wrapped = `${SCRIPT_WRAPPER_OPEN}${body}${SCRIPT_WRAPPER_CLOSE}`;
|
|
182
|
-
const plainJsRefusal = () => new ScriptCodeError(`${label}: script files must be plain JavaScript, but this one uses TypeScript syntax (type annotations, \`as\`, \`!\`, ...).`);
|
|
183
185
|
const jsError = plainJavaScriptSyntaxError(body);
|
|
184
186
|
if (jsError === undefined)
|
|
185
187
|
return body;
|
|
186
|
-
if (options.stripTypes === false)
|
|
187
|
-
|
|
188
|
+
if (options.stripTypes === false) {
|
|
189
|
+
// Script files round-trip the platform body. Live workflows store
|
|
190
|
+
// TypeScript syntax in that body; stripping it would plan a rewrite and
|
|
191
|
+
// refusing it stops pull (#1424). When TypeScript loads, a body that
|
|
192
|
+
// parses as neither JavaScript nor TypeScript still fails.
|
|
193
|
+
const ts = (options.loadTypeScript === undefined ? getTs() : options.loadTypeScript());
|
|
194
|
+
// The standalone CLI does not bundle TypeScript, and the workspace often
|
|
195
|
+
// does not install it either. Keep the stored body so pull can finish,
|
|
196
|
+
// including one that is not valid TypeScript: without a parser it cannot
|
|
197
|
+
// be told apart from a TypeScript workflow body.
|
|
198
|
+
if (ts === undefined)
|
|
199
|
+
return body;
|
|
200
|
+
const tsErrors = scriptSyntaxErrors(wrapped, "script.ts", ts);
|
|
201
|
+
if (tsErrors.length > 0) {
|
|
202
|
+
throw new ScriptCodeError(`${label}: the script body does not parse: ${tsErrors.join("; ")}`);
|
|
203
|
+
}
|
|
204
|
+
return body;
|
|
205
|
+
}
|
|
188
206
|
const ts = (options.loadTypeScript === undefined ? getTs() : options.loadTypeScript());
|
|
189
207
|
if (ts === undefined) {
|
|
190
208
|
throw new ScriptCodeError(`${label}: the script body is not plain JavaScript and TypeScript is unavailable: ${jsError}`);
|
|
@@ -13,5 +13,42 @@ export declare const TASK_OUTPUT_REFERENCE_NAMES: Readonly<Record<string, Readon
|
|
|
13
13
|
* `record_reference` needs; a field-mapped input needs the record itself.
|
|
14
14
|
*/
|
|
15
15
|
export declare const WHOLE_RECORD_REF_WIRE_NAMES: Readonly<Record<string, string>>;
|
|
16
|
+
/**
|
|
17
|
+
* Marks a trigger reference that a field-mapped script input reads as the
|
|
18
|
+
* whole record (edk#1284). Record triggers expose the whole record
|
|
19
|
+
* (`record`, ASPECT_RECORD) and the record ID (ASPECT_RECORD_ID) under one
|
|
20
|
+
* display name, "Record", and the provider's refs map keeps only the ID there.
|
|
21
|
+
* Build sets this on the input's value; to-tf then writes the exact reference
|
|
22
|
+
* JSON (`triggerWholeRecordRefJson`) instead of `refs["Record"]`.
|
|
23
|
+
*/
|
|
24
|
+
export declare const TRIGGER_WHOLE_RECORD_MARKER = "__edkTriggerWholeRecord";
|
|
25
|
+
/** The trigger's whole record (`record`) in field mappings. */
|
|
26
|
+
export declare const TRIGGER_WHOLE_RECORD_REF_NAME = "record";
|
|
27
|
+
/**
|
|
28
|
+
* The reference JSON for a trigger's whole record: the string provider Read
|
|
29
|
+
* returns for it and the exporter emits, byte for byte (sorted keys).
|
|
30
|
+
*/
|
|
31
|
+
export declare function triggerWholeRecordRefJson(name: string): string;
|
|
32
|
+
/** The trigger reference name a whole-record reference JSON names, if `value` is one. */
|
|
33
|
+
export declare function parseTriggerWholeRecordRefJson(value: unknown): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* An attachment trigger's own payload fields. A record field can share one's
|
|
36
|
+
* display name (a "Description" field) and then owns that refs key, so build
|
|
37
|
+
* always writes these as exact reference JSON.
|
|
38
|
+
*/
|
|
39
|
+
export declare const ATTACHMENT_PAYLOAD_FIELD_TYPES: Readonly<Record<string, string>>;
|
|
40
|
+
/**
|
|
41
|
+
* The reference for an attachment payload field. JSON-encoded (sorted keys),
|
|
42
|
+
* it is the string provider Read returns for it.
|
|
43
|
+
*/
|
|
44
|
+
export declare function triggerAttachmentPayloadRef(key: string): {
|
|
45
|
+
readonly fieldType: string;
|
|
46
|
+
readonly multiple: false;
|
|
47
|
+
readonly triggerReference: {
|
|
48
|
+
readonly name: string;
|
|
49
|
+
};
|
|
50
|
+
} | undefined;
|
|
51
|
+
/** The attachment payload field an exact reference JSON names, if `value` is one. */
|
|
52
|
+
export declare function parseTriggerAttachmentPayloadRefJson(value: unknown): string | undefined;
|
|
16
53
|
/** aiSearchTable accessor → [refs-map display label, canonical `service_tasks` output name]. */
|
|
17
54
|
export declare const AI_SEARCH_TABLE_OUTPUT_NAMES: Readonly<Record<string, readonly [display: string, canonical: string]>>;
|
|
@@ -26,6 +26,11 @@ export const TASK_OUTPUT_REFERENCE_NAMES = {
|
|
|
26
26
|
Name: "group.name",
|
|
27
27
|
"All found groups": "groups",
|
|
28
28
|
},
|
|
29
|
+
// Captured live from a deployed bulk_update_fields task's refs map.
|
|
30
|
+
elementum_bulk_update_fields_task: {
|
|
31
|
+
"Records Updated": "recordsUpdated",
|
|
32
|
+
"All Matching Records Updated": "allMatchingRecordsUpdated",
|
|
33
|
+
},
|
|
29
34
|
};
|
|
30
35
|
/**
|
|
31
36
|
* A record-bearing task's whole-record output (ASPECT_RECORD). The bare
|
|
@@ -37,6 +42,77 @@ export const WHOLE_RECORD_REF_WIRE_NAMES = {
|
|
|
37
42
|
createRecord: "Created record",
|
|
38
43
|
updateField: "Updated record",
|
|
39
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* Marks a trigger reference that a field-mapped script input reads as the
|
|
47
|
+
* whole record (edk#1284). Record triggers expose the whole record
|
|
48
|
+
* (`record`, ASPECT_RECORD) and the record ID (ASPECT_RECORD_ID) under one
|
|
49
|
+
* display name, "Record", and the provider's refs map keeps only the ID there.
|
|
50
|
+
* Build sets this on the input's value; to-tf then writes the exact reference
|
|
51
|
+
* JSON (`triggerWholeRecordRefJson`) instead of `refs["Record"]`.
|
|
52
|
+
*/
|
|
53
|
+
export const TRIGGER_WHOLE_RECORD_MARKER = "__edkTriggerWholeRecord";
|
|
54
|
+
/** The trigger's whole record (`record`) in field mappings. */
|
|
55
|
+
export const TRIGGER_WHOLE_RECORD_REF_NAME = "record";
|
|
56
|
+
/**
|
|
57
|
+
* The reference JSON for a trigger's whole record: the string provider Read
|
|
58
|
+
* returns for it and the exporter emits, byte for byte (sorted keys).
|
|
59
|
+
*/
|
|
60
|
+
export function triggerWholeRecordRefJson(name) {
|
|
61
|
+
return JSON.stringify({ fieldType: "ASPECT_RECORD", multiple: false, triggerReference: { name } });
|
|
62
|
+
}
|
|
63
|
+
/** The trigger reference name a whole-record reference JSON names, if `value` is one. */
|
|
64
|
+
export function parseTriggerWholeRecordRefJson(value) {
|
|
65
|
+
const ref = parseSingleTriggerRefJson(value);
|
|
66
|
+
return ref?.fieldType === "ASPECT_RECORD" ? ref.name : undefined;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* An attachment trigger's own payload fields. A record field can share one's
|
|
70
|
+
* display name (a "Description" field) and then owns that refs key, so build
|
|
71
|
+
* always writes these as exact reference JSON.
|
|
72
|
+
*/
|
|
73
|
+
export const ATTACHMENT_PAYLOAD_FIELD_TYPES = {
|
|
74
|
+
name: "TEXT",
|
|
75
|
+
url: "TEXT",
|
|
76
|
+
mediaType: "TEXT",
|
|
77
|
+
size: "NUMBER",
|
|
78
|
+
description: "TEXT",
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* The reference for an attachment payload field. JSON-encoded (sorted keys),
|
|
82
|
+
* it is the string provider Read returns for it.
|
|
83
|
+
*/
|
|
84
|
+
export function triggerAttachmentPayloadRef(key) {
|
|
85
|
+
const fieldType = ATTACHMENT_PAYLOAD_FIELD_TYPES[key];
|
|
86
|
+
if (fieldType === undefined)
|
|
87
|
+
return undefined;
|
|
88
|
+
return { fieldType, multiple: false, triggerReference: { name: `attachment.${key}` } };
|
|
89
|
+
}
|
|
90
|
+
/** The attachment payload field an exact reference JSON names, if `value` is one. */
|
|
91
|
+
export function parseTriggerAttachmentPayloadRefJson(value) {
|
|
92
|
+
const ref = parseSingleTriggerRefJson(value);
|
|
93
|
+
if (ref === undefined || !ref.name.startsWith("attachment."))
|
|
94
|
+
return undefined;
|
|
95
|
+
const key = ref.name.slice("attachment.".length);
|
|
96
|
+
return ATTACHMENT_PAYLOAD_FIELD_TYPES[key] === ref.fieldType ? key : undefined;
|
|
97
|
+
}
|
|
98
|
+
function parseSingleTriggerRefJson(value) {
|
|
99
|
+
if (typeof value !== "string" || !value.startsWith("{"))
|
|
100
|
+
return undefined;
|
|
101
|
+
let parsed;
|
|
102
|
+
try {
|
|
103
|
+
parsed = JSON.parse(value);
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
109
|
+
return undefined;
|
|
110
|
+
const { fieldType, multiple, triggerReference, ...rest } = parsed;
|
|
111
|
+
if ((multiple !== undefined && multiple !== false) || Object.keys(rest).length > 0)
|
|
112
|
+
return undefined;
|
|
113
|
+
const name = triggerReference?.name;
|
|
114
|
+
return typeof name === "string" && Object.keys(triggerReference).length === 1 ? { name, fieldType } : undefined;
|
|
115
|
+
}
|
|
40
116
|
/** aiSearchTable accessor → [refs-map display label, canonical `service_tasks` output name]. */
|
|
41
117
|
export const AI_SEARCH_TABLE_OUTPUT_NAMES = {
|
|
42
118
|
records: ["All Records", "searchTableRecords"],
|