@elementumai/edk 0.10.4 → 0.11.0
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 +11 -7
- package/dist-sdk/src/catalog/token.js +2 -1
- package/dist-sdk/src/core/wire/ref-serializer.js +26 -1
- package/dist-sdk/src/engine/build/context.d.ts +4 -0
- package/dist-sdk/src/engine/coverage-gaps.d.ts +2 -0
- package/dist-sdk/src/engine/coverage-gaps.js +3 -0
- package/dist-sdk/src/engine/ei/json-stream-reader.d.ts +43 -0
- package/dist-sdk/src/engine/ei/json-stream-reader.js +234 -0
- package/dist-sdk/src/engine/ei/run.d.ts +22 -0
- package/dist-sdk/src/engine/ei/run.js +99 -18
- package/dist-sdk/src/engine/ei/saved-plan.d.ts +16 -0
- package/dist-sdk/src/engine/ei/saved-plan.js +19 -0
- package/dist-sdk/src/engine/ei/state.d.ts +1 -1
- package/dist-sdk/src/engine/ei/state.js +17 -4
- package/dist-sdk/src/engine/progress.d.ts +3 -1
- package/dist-sdk/src/engine/progress.js +7 -3
- package/dist-sdk/src/engine/pull/authored-address.d.ts +15 -1
- package/dist-sdk/src/engine/pull/authored-address.js +180 -29
- package/dist-sdk/src/engine/pull/context.d.ts +37 -2
- package/dist-sdk/src/engine/pull/context.js +7 -4
- package/dist-sdk/src/engine/tf/index.d.ts +2 -2
- package/dist-sdk/src/engine/tf/index.js +2 -2
- package/dist-sdk/src/engine/tf/labels.d.ts +22 -0
- package/dist-sdk/src/engine/tf/labels.js +50 -0
- package/dist-sdk/src/engine/tf/model.d.ts +2 -0
- package/dist-sdk/src/engine/tf/model.js +26 -0
- package/dist-sdk/src/engine/validation.d.ts +2 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +17 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +52 -24
- package/dist-sdk/src/entities/access-policy/member-list.d.ts +32 -0
- package/dist-sdk/src/entities/access-policy/member-list.js +57 -0
- package/dist-sdk/src/entities/access-policy/module.js +5 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +4 -3
- package/dist-sdk/src/entities/access-policy/to-tf.js +21 -12
- package/dist-sdk/src/entities/agent/build.js +7 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +2 -0
- package/dist-sdk/src/entities/agent/from-tf.js +13 -3
- package/dist-sdk/src/entities/agent/to-tf.js +11 -5
- package/dist-sdk/src/entities/agent/tools.d.ts +8 -0
- package/dist-sdk/src/entities/agent/tools.js +6 -2
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +29 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +56 -3
- package/dist-sdk/src/entities/agent-tool/types.d.ts +12 -8
- package/dist-sdk/src/entities/agent-tool/types.js +13 -9
- package/dist-sdk/src/entities/app/build.d.ts +11 -0
- package/dist-sdk/src/entities/app/build.js +1 -0
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +5 -7
- package/dist-sdk/src/entities/app/from-tf.js +16 -10
- package/dist-sdk/src/entities/app/to-tf.js +6 -4
- package/dist-sdk/src/entities/automation/build.d.ts +2 -7
- package/dist-sdk/src/entities/automation/build.js +43 -14
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +7 -4
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +7 -11
- package/dist-sdk/src/entities/automation/from-tf.d.ts +23 -1
- package/dist-sdk/src/entities/automation/from-tf.js +456 -34
- package/dist-sdk/src/entities/automation/index.d.ts +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +22 -2
- package/dist-sdk/src/entities/automation/module.js +244 -57
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +22 -2
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +54 -3
- package/dist-sdk/src/entities/automation/run-target.d.ts +59 -0
- package/dist-sdk/src/entities/automation/run-target.js +99 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +9 -0
- package/dist-sdk/src/entities/automation/script-code.js +24 -3
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +16 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +49 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +20 -8
- package/dist-sdk/src/entities/automation/to-tf.d.ts +1 -3
- package/dist-sdk/src/entities/automation/to-tf.js +102 -40
- package/dist-sdk/src/entities/automation/triggers.d.ts +22 -3
- package/dist-sdk/src/entities/automation/triggers.js +40 -0
- package/dist-sdk/src/entities/automation/types.d.ts +21 -0
- package/dist-sdk/src/entities/automation/types.js +26 -0
- package/dist-sdk/src/entities/dashboard/from-tf.d.ts +11 -1
- package/dist-sdk/src/entities/dashboard/from-tf.js +57 -7
- package/dist-sdk/src/entities/dashboard/to-tf.js +13 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +7 -2
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +65 -19
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +4 -2
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +341 -32
- package/dist-sdk/src/entities/element/build.d.ts +10 -0
- package/dist-sdk/src/entities/element/build.js +1 -0
- package/dist-sdk/src/entities/element/from-tf.js +14 -9
- package/dist-sdk/src/entities/element/to-tf.js +6 -4
- package/dist-sdk/src/entities/field/from-tf.d.ts +24 -0
- package/dist-sdk/src/entities/field/from-tf.js +79 -1
- package/dist-sdk/src/entities/field/module.js +7 -0
- package/dist-sdk/src/entities/field/to-tf.d.ts +30 -1
- package/dist-sdk/src/entities/field/to-tf.js +51 -0
- package/dist-sdk/src/entities/file-reader/module.js +3 -3
- package/dist-sdk/src/entities/file-reader/to-tf.js +3 -3
- package/dist-sdk/src/entities/file-reader/types.d.ts +4 -16
- package/dist-sdk/src/entities/file-reader/types.js +7 -0
- package/dist-sdk/src/entities/org/group.d.ts +1 -0
- package/dist-sdk/src/entities/org/group.js +2 -1
- package/dist-sdk/src/entities/record-create-form/from-tf.d.ts +8 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.js +10 -2
- package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +2 -1
- package/dist-sdk/src/entities/record-create-form/to-tf.js +14 -2
- package/dist-sdk/src/entities/relationship/from-tf.d.ts +8 -0
- package/dist-sdk/src/entities/relationship/from-tf.js +88 -10
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +3 -2
- package/dist-sdk/src/entities/relationship/to-tf.js +79 -8
- package/dist-sdk/src/entities/role/from-tf.js +24 -7
- package/dist-sdk/src/entities/role/to-tf.js +25 -7
- package/dist-sdk/src/entities/service-account/from-tf.js +2 -1
- package/dist-sdk/src/entities/service-account/module.js +15 -0
- package/dist-sdk/src/entities/service-account/to-tf.js +12 -4
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +1 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +12 -7
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +5 -2
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +8 -1
- package/dist-sdk/src/entities/skill/from-tf.js +10 -3
- package/dist-sdk/src/entities/skill/module.js +16 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +8 -1
- package/dist-sdk/src/entities/skill/to-tf.js +23 -14
- package/dist-sdk/src/entities/skill/tools.d.ts +8 -0
- package/dist-sdk/src/entities/skill/tools.js +6 -2
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +8 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +6 -2
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +8 -2
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +20 -10
- package/dist-sdk/src/entities/view/from-tf.d.ts +60 -0
- package/dist-sdk/src/entities/view/from-tf.js +391 -17
- package/dist-sdk/src/entities/view/module.js +15 -0
- package/dist-sdk/src/entities/view/portable.d.ts +11 -0
- package/dist-sdk/src/entities/view/portable.js +47 -0
- package/dist-sdk/src/entities/view/to-tf.d.ts +4 -1
- package/dist-sdk/src/entities/view/to-tf.js +25 -7
- package/dist-sdk/src/entities/view/types.js +1 -1
- package/dist-sdk/src/entities/widget/build.d.ts +4 -3
- package/dist-sdk/src/entities/widget/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/widget/from-tf.js +100 -3
- package/dist-sdk/src/entities/widget/to-tf.d.ts +16 -1
- package/dist-sdk/src/entities/widget/to-tf.js +77 -14
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +27 -8
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/field-resource-types.d.ts +2 -0
- package/dist-sdk/src/graph/field-resource-types.js +11 -0
- package/dist-sdk/src/graph/index.d.ts +28 -3
- package/dist-sdk/src/graph/index.js +12 -2
- package/dist-sdk/src/graph/types.d.ts +157 -5
- package/package.json +1 -1
|
@@ -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, 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";
|
|
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 ApiRequestOutputs, type ApiResponseType, 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";
|
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
/** The automation entity's registry entry (see src/graph/). */
|
|
2
2
|
import { type TfBlock } from "../../engine/tf/index.js";
|
|
3
3
|
import { type EntityKindModule } from "../../graph/types.js";
|
|
4
|
-
/**
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The named WARN for an automation pull could not extract (edk#1054,
|
|
6
|
+
* edk#1480): what was skipped, why, what that means and what to do next
|
|
7
|
+
* (#1877). A released automation's authored file is archived
|
|
8
|
+
* (`quarantineOwnFiles`, #1858): the automation stale-file sweep is off while
|
|
9
|
+
* any automation is skipped, so a released file left in place would still
|
|
10
|
+
* build and the next plan would create a duplicate. The file is kept instead
|
|
11
|
+
* when a resource that stays in source still references the automation
|
|
12
|
+
* (`keptFor`): agent and skill run-automation tools, dynamic-layout buttons
|
|
13
|
+
* and their inputs, and other kept automations can only name an automation
|
|
14
|
+
* in source, so archiving would break build. A widget can (#1901). An automation pull skips without releasing keeps its state and
|
|
15
|
+
* its existing source file, so the next plan builds that older file against
|
|
16
|
+
* the live automation.
|
|
17
|
+
*/
|
|
18
|
+
export declare function droppedAutomationGap(autoBlock: TfBlock, autoLabel: string, gap: {
|
|
19
|
+
readonly why: string;
|
|
20
|
+
readonly released: boolean;
|
|
21
|
+
readonly nextStep: string;
|
|
22
|
+
readonly keptFor?: readonly string[];
|
|
23
|
+
/** The file waits for state (#2054): see `ReleasedAutomation.settleByState`. */
|
|
24
|
+
readonly settleByState?: boolean;
|
|
25
|
+
}): string;
|
|
6
26
|
export declare const automationModule: EntityKindModule;
|
|
7
27
|
/** The provider's `normalizeOnDemandFilterRefName`, which computes `filter_refs` at plan time. */
|
|
8
28
|
export declare function onDemandFilterRefName(name: string): string;
|
|
@@ -8,12 +8,13 @@ function elementOwnerHandle(payload) {
|
|
|
8
8
|
}
|
|
9
9
|
import { renderAutomationCatalogEntry } from "./catalog-render.js";
|
|
10
10
|
import { hasUnresolvedForEachItem, preserveAuthoredAutomationPullMeta, printAutomationV2WithScriptFiles, SCRIPT_FILES_DIR } from "./deserializer/print-automation.js";
|
|
11
|
-
import { automationFromTf, automationOwnedAddresses, ForEachItemOutsideLoopError, UnresolvedForeignServiceAccountError, UnsupportedMultiTriggerError } from "./from-tf.js";
|
|
11
|
+
import { automationFromTf, automationOwnedAddresses, ForEachItemOutsideLoopError, UnresolvedForeignServiceAccountError, UnresolvedTaskFilterRefError, UnsupportedMultiTriggerError } from "./from-tf.js";
|
|
12
12
|
import { scriptFileRefs } from "./script-code.js";
|
|
13
13
|
import { typedCoverageGap } from "../../engine/coverage-gaps.js";
|
|
14
|
-
import {
|
|
14
|
+
import { taskOutputReferences, USER_SEARCH_OUTPUT_REFERENCES } from "./task-output-labels.js";
|
|
15
15
|
import { automationToTf } from "./to-tf.js";
|
|
16
16
|
import { approvalChainLostStage } from "../approval-chain/from-tf.js";
|
|
17
|
+
import { IMPLEMENTED_FILE_READER_RESOURCE_TYPES } from "../file-reader/types.js";
|
|
17
18
|
import { stageHandleIndexFromTfStages } from "../app/stage-keys.js";
|
|
18
19
|
import { ALL_AUTOMATION_SUB_TYPES, AUTOMATION_RESOURCE_TYPE, WORKFLOW_PUBLISH_RESOURCE_TYPE, } from "./types.js";
|
|
19
20
|
const AUTOMATION_MEMBER_TYPES = new Set([
|
|
@@ -120,17 +121,58 @@ function registerForeignObjectIdDeps(doc, automationLabel, ctx) {
|
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
|
-
/**
|
|
124
|
-
|
|
124
|
+
/**
|
|
125
|
+
* The named WARN for an automation pull could not extract (edk#1054,
|
|
126
|
+
* edk#1480): what was skipped, why, what that means and what to do next
|
|
127
|
+
* (#1877). A released automation's authored file is archived
|
|
128
|
+
* (`quarantineOwnFiles`, #1858): the automation stale-file sweep is off while
|
|
129
|
+
* any automation is skipped, so a released file left in place would still
|
|
130
|
+
* build and the next plan would create a duplicate. The file is kept instead
|
|
131
|
+
* when a resource that stays in source still references the automation
|
|
132
|
+
* (`keptFor`): agent and skill run-automation tools, dynamic-layout buttons
|
|
133
|
+
* and their inputs, and other kept automations can only name an automation
|
|
134
|
+
* in source, so archiving would break build. A widget can (#1901). An automation pull skips without releasing keeps its state and
|
|
135
|
+
* its existing source file, so the next plan builds that older file against
|
|
136
|
+
* the live automation.
|
|
137
|
+
*/
|
|
138
|
+
export function droppedAutomationGap(autoBlock, autoLabel, gap) {
|
|
125
139
|
const name = autoBlock.attrs["name"];
|
|
126
140
|
const display = typeof name === "string" && name !== "" ? name : autoLabel;
|
|
127
141
|
return typedCoverageGap({
|
|
128
142
|
kind: "skipped",
|
|
129
143
|
entity: `automation ${JSON.stringify(display)} (${autoLabel})`,
|
|
130
|
-
detail: `not
|
|
131
|
-
consequence:
|
|
144
|
+
detail: `skipped, not written to source: ${gap.why}`,
|
|
145
|
+
consequence: gap.released && gap.keptFor !== undefined
|
|
146
|
+
? `it is not adopted, and adoption releases it from state if this workspace managed it, so it keeps running on the platform unmanaged. Pull keeps its authored file, if there is one, because ${gap.keptFor.join(", ")} still name${gap.keptFor.length === 1 ? "s" : ""} it in source, and agent and skill tools, dynamic-layout buttons and other automations cannot name a platform id instead, so moving the file would break build. While that file exists the next plan creates a second copy of the automation: review the plan before applying, and remove those references and the file to stop it. ${gap.nextStep}`
|
|
147
|
+
: gap.released && gap.settleByState === true
|
|
148
|
+
? `it is not adopted; adoption releases it from state if this workspace managed it, and once state no longer manages it pull moves its authored file, if there is one, to .edk-state/pull-backups so the next plan neither destroys it nor creates a duplicate. Until a pull releases it (under --no-adopt, or when adoption stops before releasing it), its file and state stay as they were and this workspace still manages it. Once a pull releases it, it keeps running on the platform unmanaged and its file is archived; do not restore that file. ${gap.nextStep}`
|
|
149
|
+
: gap.released
|
|
150
|
+
? `it is not adopted; adoption releases it from state if this workspace managed it, and pull moves its authored file, if there is one, to .edk-state/pull-backups so the next plan does not create a duplicate. It keeps running on the platform unmanaged; do not restore that file. ${gap.nextStep}`
|
|
151
|
+
: `it is not adopted. If this workspace already manages it, its state and its existing source file are kept as they were, so the next plan compares that older source with the live automation: it can undo edits made in the platform, or delete the automation if its source file is gone. Review the plan before applying. ${gap.nextStep}`,
|
|
132
152
|
});
|
|
133
153
|
}
|
|
154
|
+
const FIX_IN_PLATFORM = "To manage it with the EDK, change what the reason names in the platform, then pull again.";
|
|
155
|
+
const FIX_OR_REPORT = "If you can change what the reason names in the platform, do so and pull again; otherwise report it as an EDK bug.";
|
|
156
|
+
/**
|
|
157
|
+
* Addresses of the stream's resources that stay in source (`inSource`) and
|
|
158
|
+
* reference any of `owned` by source name. A widget does not count: with its
|
|
159
|
+
* automation out of source, build points it at the live automation through a
|
|
160
|
+
* display-name lookup (#1901), so archiving is safe.
|
|
161
|
+
*/
|
|
162
|
+
function externalReferrers(stream, owned, inSource) {
|
|
163
|
+
const ownedSet = new Set(owned);
|
|
164
|
+
const referrers = [];
|
|
165
|
+
for (const block of stream.allBlocks) {
|
|
166
|
+
if (block.kind !== "resource" || block.type === undefined || block.label === undefined)
|
|
167
|
+
continue;
|
|
168
|
+
const address = `${block.type}.${block.label}`;
|
|
169
|
+
if (ownedSet.has(address) || block.type === "elementum_widget" || !inSource(address))
|
|
170
|
+
continue;
|
|
171
|
+
if (referenceIn(block.attrs, ownedSet) !== undefined)
|
|
172
|
+
referrers.push(address);
|
|
173
|
+
}
|
|
174
|
+
return referrers;
|
|
175
|
+
}
|
|
134
176
|
/** Addresses of the stream's approval processes that pull leaves unmanaged because their stage lost its only handle (#1136). */
|
|
135
177
|
function lostStageApprovalChains(stream, ctx) {
|
|
136
178
|
const lost = new Set();
|
|
@@ -147,37 +189,38 @@ function lostStageApprovalChains(stream, ctx) {
|
|
|
147
189
|
}
|
|
148
190
|
return lost;
|
|
149
191
|
}
|
|
150
|
-
/** The first of `targets` that
|
|
151
|
-
function
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
for (const item of value) {
|
|
156
|
-
const hit = visit(item);
|
|
157
|
-
if (hit !== undefined)
|
|
158
|
-
return hit;
|
|
159
|
-
}
|
|
160
|
-
return undefined;
|
|
161
|
-
}
|
|
162
|
-
if (value === null || typeof value !== "object")
|
|
163
|
-
return undefined;
|
|
164
|
-
const record = value;
|
|
165
|
-
if (record["$expr"] === "resource-attr" && typeof record["type"] === "string" && typeof record["label"] === "string") {
|
|
166
|
-
const address = `${record["type"]}.${record["label"]}`;
|
|
167
|
-
if (targets.has(address))
|
|
168
|
-
return address;
|
|
169
|
-
}
|
|
170
|
-
for (const item of Object.values(record)) {
|
|
171
|
-
const hit = visit(item);
|
|
192
|
+
/** The first of `targets` that `value` references, if any. */
|
|
193
|
+
function referenceIn(value, targets) {
|
|
194
|
+
if (Array.isArray(value)) {
|
|
195
|
+
for (const item of value) {
|
|
196
|
+
const hit = referenceIn(item, targets);
|
|
172
197
|
if (hit !== undefined)
|
|
173
198
|
return hit;
|
|
174
199
|
}
|
|
175
200
|
return undefined;
|
|
176
|
-
}
|
|
201
|
+
}
|
|
202
|
+
if (value === null || typeof value !== "object")
|
|
203
|
+
return undefined;
|
|
204
|
+
const record = value;
|
|
205
|
+
if (record["$expr"] === "resource-attr" && typeof record["type"] === "string" && typeof record["label"] === "string") {
|
|
206
|
+
const address = `${record["type"]}.${record["label"]}`;
|
|
207
|
+
if (targets.has(address))
|
|
208
|
+
return address;
|
|
209
|
+
}
|
|
210
|
+
for (const item of Object.values(record)) {
|
|
211
|
+
const hit = referenceIn(item, targets);
|
|
212
|
+
if (hit !== undefined)
|
|
213
|
+
return hit;
|
|
214
|
+
}
|
|
215
|
+
return undefined;
|
|
216
|
+
}
|
|
217
|
+
/** The first of `targets` that any block at `owned` references, if any. */
|
|
218
|
+
function referencedAddress(stream, owned, targets) {
|
|
219
|
+
const ownedSet = new Set(owned);
|
|
177
220
|
for (const block of stream.allBlocks) {
|
|
178
221
|
if (block.type === undefined || block.label === undefined || !ownedSet.has(`${block.type}.${block.label}`))
|
|
179
222
|
continue;
|
|
180
|
-
const hit =
|
|
223
|
+
const hit = referenceIn(block.attrs, targets);
|
|
181
224
|
if (hit !== undefined)
|
|
182
225
|
return hit;
|
|
183
226
|
}
|
|
@@ -187,10 +230,25 @@ function extractAutomations(ownBlocks, stream, ctx) {
|
|
|
187
230
|
const items = [];
|
|
188
231
|
const skipped = [];
|
|
189
232
|
const releaseIfManaged = [];
|
|
190
|
-
const quarantineOwnFiles = [];
|
|
191
233
|
const diagnostics = [];
|
|
234
|
+
const validations = [];
|
|
192
235
|
const adoptionAddressAliases = [];
|
|
193
236
|
const extractedAutomations = [];
|
|
237
|
+
const released = [];
|
|
238
|
+
// Which file each skipped automation's resources come from (#1877).
|
|
239
|
+
const skippedOwnFiles = [];
|
|
240
|
+
const skip = (owned, refName) => {
|
|
241
|
+
skipped.push(...owned);
|
|
242
|
+
skippedOwnFiles.push({ refName, addresses: owned });
|
|
243
|
+
};
|
|
244
|
+
const settledByState = new Set();
|
|
245
|
+
const release = (entry) => {
|
|
246
|
+
releaseIfManaged.push(...entry.owned);
|
|
247
|
+
released.push(entry);
|
|
248
|
+
if (entry.settleByState === true)
|
|
249
|
+
for (const address of entry.owned)
|
|
250
|
+
settledByState.add(address);
|
|
251
|
+
};
|
|
194
252
|
const lostChains = lostStageApprovalChains(stream, ctx);
|
|
195
253
|
for (const autoBlock of ownBlocks) {
|
|
196
254
|
const autoLabel = autoBlock.label ?? "";
|
|
@@ -206,24 +264,29 @@ function extractAutomations(ownBlocks, stream, ctx) {
|
|
|
206
264
|
const owned = automationOwnedAddresses(doc, autoLabel);
|
|
207
265
|
const chain = referencedAddress(stream, owned, lostChains);
|
|
208
266
|
if (chain !== undefined) {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
267
|
+
skip(owned, scopedLabelToBagKey(ctx.appTfLabel, autoLabel));
|
|
268
|
+
release({
|
|
269
|
+
autoBlock, autoLabel, owned, refName: scopedLabelToBagKey(ctx.appTfLabel, autoLabel),
|
|
270
|
+
why: `it uses ${chain}, which pull leaves unmanaged because its stage has no handle of its own (#1136)`,
|
|
271
|
+
nextStep: "To manage it with the EDK, give that stage its own handle in the platform, then pull again.",
|
|
272
|
+
});
|
|
212
273
|
continue;
|
|
213
274
|
}
|
|
214
275
|
}
|
|
215
276
|
try {
|
|
216
|
-
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, ctx.serviceAccountsById);
|
|
277
|
+
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, ctx.serviceAccountsById, ctx.foreignFileReaderRefsById);
|
|
217
278
|
// edk#1646 / #1858: adopt when a rebuilt ctx ref matches provider Read.
|
|
218
279
|
// Otherwise the automation stays platform-managed. Releasing its state
|
|
219
280
|
// also archives the authored file, so the next plan does not create a
|
|
220
281
|
// second copy of the live automation.
|
|
221
282
|
if (extracted.stringifiedValueReferences === true) {
|
|
222
283
|
const owned = automationOwnedAddresses(doc, autoLabel);
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
284
|
+
skip(owned, extracted.refName);
|
|
285
|
+
release({
|
|
286
|
+
autoBlock, autoLabel, owned, refName: extracted.refName,
|
|
287
|
+
why: "its export embeds a value reference as text that source cannot rebuild exactly (edk#1646)",
|
|
288
|
+
nextStep: "Keep editing it in the platform.",
|
|
289
|
+
});
|
|
227
290
|
continue;
|
|
228
291
|
}
|
|
229
292
|
extractedAutomations.push({ autoBlock, autoLabel, owned: automationOwnedAddresses(doc, autoLabel), extracted });
|
|
@@ -235,26 +298,56 @@ function extractAutomations(ownBlocks, stream, ctx) {
|
|
|
235
298
|
// never wrote this automation to source) can't reproduce them, so
|
|
236
299
|
// `plan` shows them as destroy-on-apply. See automationOwnedAddresses.
|
|
237
300
|
const owned = automationOwnedAddresses(doc, autoLabel);
|
|
238
|
-
|
|
301
|
+
// A filter on a task id that is not this automation's (#2054) fails the
|
|
302
|
+
// pull, the same way source generation used to, now naming what the id
|
|
303
|
+
// points to. Skipping it with a warning would hide that (#1974). It is
|
|
304
|
+
// also released: an earlier pull may have written its file (which
|
|
305
|
+
// still builds into the old `unresolved task filter ref` error) and
|
|
306
|
+
// adopted it, so archive the file and drop the state binding together,
|
|
307
|
+
// or the next plan would destroy the live automation.
|
|
308
|
+
if (err instanceof UnresolvedTaskFilterRefError) {
|
|
309
|
+
const name = autoBlock.attrs["name"];
|
|
310
|
+
validations.push({
|
|
311
|
+
severity: "fatal",
|
|
312
|
+
address: `${autoBlock.type}.${autoLabel}`,
|
|
313
|
+
name: typeof name === "string" && name !== "" ? name : autoLabel,
|
|
314
|
+
ownerKind: "automation",
|
|
315
|
+
message: err.message,
|
|
316
|
+
code: "unresolved-task-filter-ref",
|
|
317
|
+
});
|
|
318
|
+
skip(owned, scopedLabelToBagKey(ctx.appTfLabel, autoLabel));
|
|
319
|
+
release({
|
|
320
|
+
autoBlock, autoLabel, owned, refName: scopedLabelToBagKey(ctx.appTfLabel, autoLabel),
|
|
321
|
+
why: `pull could not turn its export into source: ${err.message}`,
|
|
322
|
+
nextStep: FIX_IN_PLATFORM,
|
|
323
|
+
reportedAsFatal: true,
|
|
324
|
+
settleByState: true,
|
|
325
|
+
});
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
skip(owned, scopedLabelToBagKey(ctx.appTfLabel, autoLabel));
|
|
239
329
|
// No authored form can manage these, so release an earlier adoption
|
|
240
330
|
// rather than let the next apply destroy the live automation:
|
|
241
331
|
// sibling-loop item refs (#1320) and multi-trigger (#1785 / #39).
|
|
242
332
|
// Soft diagnostic, not a validation fatal — the rest of the app must
|
|
243
333
|
// still adopt and plan clean while these stay platform-managed only.
|
|
244
|
-
|
|
334
|
+
const released = err instanceof ForEachItemOutsideLoopError ||
|
|
245
335
|
err instanceof UnsupportedMultiTriggerError ||
|
|
246
|
-
err instanceof UnresolvedForeignServiceAccountError
|
|
247
|
-
releaseIfManaged.push(...owned);
|
|
248
|
-
}
|
|
249
|
-
if (err instanceof UnresolvedForeignServiceAccountError) {
|
|
250
|
-
quarantineOwnFiles.push({
|
|
251
|
-
kind: "automation",
|
|
252
|
-
refName: scopedLabelToBagKey(ctx.appTfLabel, autoLabel),
|
|
253
|
-
});
|
|
254
|
-
}
|
|
336
|
+
err instanceof UnresolvedForeignServiceAccountError;
|
|
255
337
|
// edk#1480: name the dropped automation and say what that means, as a
|
|
256
338
|
// typed gap so it counts (and fails --strict-coverage) by itself.
|
|
257
|
-
|
|
339
|
+
const why = `pull could not turn its export into source: ${err instanceof Error ? err.message : String(err)}`;
|
|
340
|
+
if (released) {
|
|
341
|
+
release({
|
|
342
|
+
autoBlock, autoLabel, owned, refName: scopedLabelToBagKey(ctx.appTfLabel, autoLabel), why,
|
|
343
|
+
nextStep: err instanceof UnresolvedForeignServiceAccountError
|
|
344
|
+
? "Pull the app that owns the service account (the reason names it), then pull this app again."
|
|
345
|
+
: FIX_IN_PLATFORM,
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
else {
|
|
349
|
+
diagnostics.push(droppedAutomationGap(autoBlock, autoLabel, { why, released: false, nextStep: FIX_OR_REPORT }));
|
|
350
|
+
}
|
|
258
351
|
}
|
|
259
352
|
}
|
|
260
353
|
// An automation that runs a skipped automation (or reads its trigger's
|
|
@@ -272,14 +365,75 @@ function extractAutomations(ownBlocks, stream, ctx) {
|
|
|
272
365
|
continue;
|
|
273
366
|
kept.delete(entry);
|
|
274
367
|
cascaded = true;
|
|
275
|
-
|
|
368
|
+
skip(entry.owned, entry.extracted.refName);
|
|
369
|
+
const gap = {
|
|
370
|
+
why: `it uses ${target}, which pull skipped, so its reference would point at nothing`,
|
|
371
|
+
nextStep: `Fix ${target} first (see its own warning), then pull again.`,
|
|
372
|
+
};
|
|
276
373
|
if (releasedAddresses.has(target)) {
|
|
277
|
-
|
|
278
|
-
|
|
374
|
+
release({
|
|
375
|
+
autoBlock: entry.autoBlock, autoLabel: entry.autoLabel, owned: entry.owned, refName: entry.extracted.refName, ...gap,
|
|
376
|
+
// Released only because its target was: settle it the same way (#2054).
|
|
377
|
+
...(settledByState.has(target) && { settleByState: true }),
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
diagnostics.push(droppedAutomationGap(entry.autoBlock, entry.autoLabel, { ...gap, released: false }));
|
|
279
382
|
}
|
|
280
|
-
diagnostics.push(droppedAutomationGap(entry.autoBlock, entry.autoLabel, `it references ${target}, which is skipped, so the reference would dangle`));
|
|
281
383
|
}
|
|
282
384
|
}
|
|
385
|
+
// Archive a released automation's file only when nothing that stays in
|
|
386
|
+
// source still references it (#1877): agent and skill run-automation
|
|
387
|
+
// tools, dynamic-layout buttons and other automations can only name an
|
|
388
|
+
// automation in source, so archiving under them would break build. Keep
|
|
389
|
+
// the file then, and say so. What stays in source is known only after
|
|
390
|
+
// every own-file child of the stream is extracted, so stream root decides
|
|
391
|
+
// it and calls back. A kept file is source too: what it references must
|
|
392
|
+
// stay (an automation a kept automation runs is kept as well), so iterate
|
|
393
|
+
// to a fixed point.
|
|
394
|
+
const settleAfterExtract = released.length === 0 ? undefined : (inSource) => {
|
|
395
|
+
const releasedOwned = new Set(released.flatMap((entry) => entry.owned));
|
|
396
|
+
const archived = new Set(released);
|
|
397
|
+
const archivedOwned = () => new Set([...archived].flatMap((entry) => entry.owned));
|
|
398
|
+
// A released automation's file is source exactly while it is kept.
|
|
399
|
+
const sourceGiven = (gone) => (address) => releasedOwned.has(address) ? !gone.has(address) : inSource(address);
|
|
400
|
+
for (let changed = true; changed;) {
|
|
401
|
+
changed = false;
|
|
402
|
+
const isSource = sourceGiven(archivedOwned());
|
|
403
|
+
for (const entry of [...archived]) {
|
|
404
|
+
if (externalReferrers(stream, entry.owned, isSource).length === 0)
|
|
405
|
+
continue;
|
|
406
|
+
archived.delete(entry);
|
|
407
|
+
changed = true;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
const isSource = sourceGiven(archivedOwned());
|
|
411
|
+
const quarantineOwnFiles = [];
|
|
412
|
+
const settled = [];
|
|
413
|
+
for (const entry of released) {
|
|
414
|
+
const keptFor = archived.has(entry) ? [] : externalReferrers(stream, entry.owned, isSource);
|
|
415
|
+
if (keptFor.length === 0) {
|
|
416
|
+
quarantineOwnFiles.push({
|
|
417
|
+
kind: "automation",
|
|
418
|
+
refName: entry.refName,
|
|
419
|
+
// Adoption still runs on a fatal pull and is what releases it, so
|
|
420
|
+
// its file goes only once state no longer binds any of these;
|
|
421
|
+
// otherwise the next plan would destroy the live automation (#2054).
|
|
422
|
+
...(entry.settleByState === true && { afterRelease: entry.owned }),
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
if (entry.reportedAsFatal === true && keptFor.length === 0)
|
|
426
|
+
continue;
|
|
427
|
+
settled.push(droppedAutomationGap(entry.autoBlock, entry.autoLabel, {
|
|
428
|
+
why: entry.why,
|
|
429
|
+
released: true,
|
|
430
|
+
nextStep: entry.nextStep,
|
|
431
|
+
...(keptFor.length > 0 && { keptFor }),
|
|
432
|
+
...(entry.settleByState === true && { settleByState: true }),
|
|
433
|
+
}));
|
|
434
|
+
}
|
|
435
|
+
return { quarantineOwnFiles, diagnostics: settled };
|
|
436
|
+
};
|
|
283
437
|
for (const { autoLabel, extracted } of kept) {
|
|
284
438
|
// Keep automationFromTf's label-derived refName — agent/skill tools store
|
|
285
439
|
// the same scopedLabelToBagKey as automationKey. Pushing bare AST (name
|
|
@@ -321,7 +475,12 @@ function extractAutomations(ownBlocks, stream, ctx) {
|
|
|
321
475
|
consequence: "it is not written to source or adopted; it keeps running on the platform unmanaged",
|
|
322
476
|
}));
|
|
323
477
|
}
|
|
324
|
-
return {
|
|
478
|
+
return {
|
|
479
|
+
items, skipped, releaseIfManaged, diagnostics, adoptionAddressAliases,
|
|
480
|
+
...(validations.length > 0 && { validations }),
|
|
481
|
+
...(skippedOwnFiles.length > 0 && { skippedOwnFiles }),
|
|
482
|
+
...(settleAfterExtract !== undefined && { settleAfterExtract }),
|
|
483
|
+
};
|
|
325
484
|
}
|
|
326
485
|
export const automationModule = {
|
|
327
486
|
kind: "automation",
|
|
@@ -443,7 +602,29 @@ export const automationModule = {
|
|
|
443
602
|
ownerType: "elementum_on_demand_trigger",
|
|
444
603
|
ownerReference: "automation",
|
|
445
604
|
}],
|
|
446
|
-
|
|
605
|
+
taskOutputReferences: {
|
|
606
|
+
...taskOutputReferences(),
|
|
607
|
+
elementum_user_search_task: USER_SEARCH_OUTPUT_REFERENCES,
|
|
608
|
+
},
|
|
609
|
+
// An on-demand parameter used as a script input: the build writes the
|
|
610
|
+
// envelope with the platform's normalized name (#1525), the export the
|
|
611
|
+
// trigger's refs read that holds it. A create-record value the trigger's
|
|
612
|
+
// refs cannot name: the build writes jsonencode, the export its string.
|
|
613
|
+
// An on-demand trigger's refs hold each declared parameter's reference
|
|
614
|
+
// under the parameter's name, computed from `parameters`, plus the
|
|
615
|
+
// trigger's system references (Environment, Manager, Triggered By's Id,
|
|
616
|
+
// ...). The build writes an envelope only for a declared parameter, so
|
|
617
|
+
// only those keys are read from state.
|
|
618
|
+
stateEvaluatedMaps: [{
|
|
619
|
+
resourceType: "elementum_on_demand_trigger",
|
|
620
|
+
attribute: "refs",
|
|
621
|
+
computedFrom: ["parameters"],
|
|
622
|
+
keyedBy: { listAttribute: "parameters", nameAttribute: "name" },
|
|
623
|
+
}],
|
|
624
|
+
renderedJsonencodeAttributes: [
|
|
625
|
+
{ resourceType: "elementum_execute_script_task", attribute: "inputs" },
|
|
626
|
+
{ resourceType: "elementum_create_record_task", attribute: "fields" },
|
|
627
|
+
],
|
|
447
628
|
recordFieldOutputKeys: [{ nameAttribute: "name", ownerAttribute: "object_id" }],
|
|
448
629
|
computedReferenceMaps: [{
|
|
449
630
|
resourceType: "elementum_on_demand_trigger",
|
|
@@ -466,6 +647,12 @@ export const automationModule = {
|
|
|
466
647
|
"elementum_update_field_task",
|
|
467
648
|
"elementum_bulk_update_fields_task",
|
|
468
649
|
].map((resourceType) => ({ resourceType, attribute: "fields", fieldAttribute: "field_id", valueAttribute: "value" })),
|
|
650
|
+
// Another app's file reader (edk#2007).
|
|
651
|
+
stateBoundReferences: [{
|
|
652
|
+
resourceType: "elementum_file_reader_task",
|
|
653
|
+
attribute: "file_reader_id",
|
|
654
|
+
referenceTypes: IMPLEMENTED_FILE_READER_RESOURCE_TYPES,
|
|
655
|
+
}],
|
|
469
656
|
},
|
|
470
657
|
};
|
|
471
658
|
/** The provider's `normalizeOnDemandFilterRefName`, which computes `filter_refs` at plan time. */
|
|
@@ -55,15 +55,35 @@ export declare function aiCompletionRefsIndex(resourceType: string, name: string
|
|
|
55
55
|
export declare const API_TASK_REF_WIRE_NAMES: Readonly<Record<string, string>>;
|
|
56
56
|
/** Inverse of {@link API_TASK_REF_WIRE_NAMES} for export jsonencode envelopes. */
|
|
57
57
|
export declare const API_TASK_REF_AUTHORING_NAMES: Readonly<Record<string, string>>;
|
|
58
|
+
/**
|
|
59
|
+
* refs-map key for one apiRequest output, given the task's `response_type`.
|
|
60
|
+
* A JSON task exposes only {@link API_TASK_JSON_REF_WIRE_NAMES}: an accessor
|
|
61
|
+
* or an already-rewritten key resolves, anything else is undefined so build
|
|
62
|
+
* fails instead of indexing a key the provider doesn't have. FILE and CUSTOM
|
|
63
|
+
* keep the {@link API_TASK_REF_WIRE_NAMES} mapping, passing unknown names
|
|
64
|
+
* through.
|
|
65
|
+
*/
|
|
66
|
+
export declare function apiTaskRefsIndex(responseType: string | undefined, name: string): string | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Contract name a workflow output of one apiRequest output carries. On a JSON
|
|
69
|
+
* task only `response` / `textResponse` / `statusCode` (or their refs keys)
|
|
70
|
+
* resolve; anything else is undefined so build fails. FILE and CUSTOM pass
|
|
71
|
+
* the name through unchanged.
|
|
72
|
+
*/
|
|
73
|
+
export declare function apiTaskCanonicalOutputName(responseType: string | undefined, name: string): string | undefined;
|
|
74
|
+
/** The refs-map keys a JSON apiRequest exposes, for build errors. */
|
|
75
|
+
export declare function apiTaskJsonRefsKeys(): readonly string[];
|
|
58
76
|
/**
|
|
59
77
|
* Resolve a single `elementum_api_task` refs[] wire label (e.g. "File",
|
|
60
78
|
* "Content Type") to its authoring path segments (e.g. ["file"], ["file",
|
|
61
|
-
* "contentType"]) via {@link API_TASK_REF_AUTHORING_NAMES}
|
|
79
|
+
* "contentType"]) via {@link API_TASK_REF_AUTHORING_NAMES}, plus
|
|
80
|
+
* {@link API_TASK_JSON_REF_WIRE_NAMES} for a JSON task (absent
|
|
81
|
+
* `response_type` is the provider default, JSON) — some authoring
|
|
62
82
|
* names are dotted (`file.content`) since they nest under the `file` output.
|
|
63
83
|
* Returns undefined for a wire label with no known authoring counterpart so
|
|
64
84
|
* callers can fall back to the generic segment mapping.
|
|
65
85
|
*/
|
|
66
|
-
export declare function apiTaskRefAuthoringPath(wireSegment: string): string[] | undefined;
|
|
86
|
+
export declare function apiTaskRefAuthoringPath(wireSegment: string, responseType?: string): string[] | undefined;
|
|
67
87
|
/**
|
|
68
88
|
* executeScript contract outputs whose authoring name is not the refs-map key.
|
|
69
89
|
*
|
|
@@ -90,16 +90,67 @@ export const API_TASK_REF_WIRE_NAMES = {
|
|
|
90
90
|
};
|
|
91
91
|
/** Inverse of {@link API_TASK_REF_WIRE_NAMES} for export jsonencode envelopes. */
|
|
92
92
|
export const API_TASK_REF_AUTHORING_NAMES = Object.fromEntries(Object.entries(API_TASK_REF_WIRE_NAMES).map(([authoring, wire]) => [wire, authoring]));
|
|
93
|
+
/**
|
|
94
|
+
* A JSON-response apiRequest's refs-map keys (edk#2058). JSON is the
|
|
95
|
+
* provider's default `response_type`. Confirmed live: `ei refs --from-remote`
|
|
96
|
+
* on dev/edk "Look Up Shipment" (FETCH_STATUS, response_type JSON, 2026-10-23)
|
|
97
|
+
* lists exactly these three keys, and Josh's Elementum-org state matches. The
|
|
98
|
+
* whole response is `API Response` (OBJECT), not the `Response` in
|
|
99
|
+
* {@link API_TASK_REF_WIRE_NAMES}, so `.response` used to build
|
|
100
|
+
* `refs["Response"]` and fail mid-apply with "Invalid index". FILE and CUSTOM
|
|
101
|
+
* tasks keep {@link API_TASK_REF_WIRE_NAMES} until they are confirmed live.
|
|
102
|
+
*/
|
|
103
|
+
const API_TASK_JSON_REF_WIRE_NAMES = {
|
|
104
|
+
response: "API Response",
|
|
105
|
+
textResponse: "API Response (text)",
|
|
106
|
+
statusCode: "API Response Status Code",
|
|
107
|
+
};
|
|
108
|
+
const API_TASK_JSON_REF_AUTHORING_NAMES = Object.fromEntries(Object.entries(API_TASK_JSON_REF_WIRE_NAMES).map(([authoring, wire]) => [wire, authoring]));
|
|
109
|
+
function isJsonApiResponse(responseType) {
|
|
110
|
+
return responseType === undefined || responseType === "JSON";
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* refs-map key for one apiRequest output, given the task's `response_type`.
|
|
114
|
+
* A JSON task exposes only {@link API_TASK_JSON_REF_WIRE_NAMES}: an accessor
|
|
115
|
+
* or an already-rewritten key resolves, anything else is undefined so build
|
|
116
|
+
* fails instead of indexing a key the provider doesn't have. FILE and CUSTOM
|
|
117
|
+
* keep the {@link API_TASK_REF_WIRE_NAMES} mapping, passing unknown names
|
|
118
|
+
* through.
|
|
119
|
+
*/
|
|
120
|
+
export function apiTaskRefsIndex(responseType, name) {
|
|
121
|
+
if (!isJsonApiResponse(responseType))
|
|
122
|
+
return API_TASK_REF_WIRE_NAMES[name] ?? name;
|
|
123
|
+
return API_TASK_JSON_REF_WIRE_NAMES[name] ?? (API_TASK_JSON_REF_AUTHORING_NAMES[name] !== undefined ? name : undefined);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Contract name a workflow output of one apiRequest output carries. On a JSON
|
|
127
|
+
* task only `response` / `textResponse` / `statusCode` (or their refs keys)
|
|
128
|
+
* resolve; anything else is undefined so build fails. FILE and CUSTOM pass
|
|
129
|
+
* the name through unchanged.
|
|
130
|
+
*/
|
|
131
|
+
export function apiTaskCanonicalOutputName(responseType, name) {
|
|
132
|
+
if (!isJsonApiResponse(responseType))
|
|
133
|
+
return name;
|
|
134
|
+
const key = apiTaskRefsIndex(responseType, name);
|
|
135
|
+
return key === undefined ? undefined : API_TASK_JSON_REF_AUTHORING_NAMES[key];
|
|
136
|
+
}
|
|
137
|
+
/** The refs-map keys a JSON apiRequest exposes, for build errors. */
|
|
138
|
+
export function apiTaskJsonRefsKeys() {
|
|
139
|
+
return Object.values(API_TASK_JSON_REF_WIRE_NAMES);
|
|
140
|
+
}
|
|
93
141
|
/**
|
|
94
142
|
* Resolve a single `elementum_api_task` refs[] wire label (e.g. "File",
|
|
95
143
|
* "Content Type") to its authoring path segments (e.g. ["file"], ["file",
|
|
96
|
-
* "contentType"]) via {@link API_TASK_REF_AUTHORING_NAMES}
|
|
144
|
+
* "contentType"]) via {@link API_TASK_REF_AUTHORING_NAMES}, plus
|
|
145
|
+
* {@link API_TASK_JSON_REF_WIRE_NAMES} for a JSON task (absent
|
|
146
|
+
* `response_type` is the provider default, JSON) — some authoring
|
|
97
147
|
* names are dotted (`file.content`) since they nest under the `file` output.
|
|
98
148
|
* Returns undefined for a wire label with no known authoring counterpart so
|
|
99
149
|
* callers can fall back to the generic segment mapping.
|
|
100
150
|
*/
|
|
101
|
-
export function apiTaskRefAuthoringPath(wireSegment) {
|
|
102
|
-
const authoring =
|
|
151
|
+
export function apiTaskRefAuthoringPath(wireSegment, responseType) {
|
|
152
|
+
const authoring = (isJsonApiResponse(responseType) ? API_TASK_JSON_REF_AUTHORING_NAMES[wireSegment] : undefined) ??
|
|
153
|
+
API_TASK_REF_AUTHORING_NAMES[wireSegment];
|
|
103
154
|
return authoring !== undefined ? authoring.split(".") : undefined;
|
|
104
155
|
}
|
|
105
156
|
/**
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type ChildResourceScope, type TfExpr } from "../../engine/tf/index.js";
|
|
2
|
+
/** A runAutomation target's owner fields, as a catalog token carries them. */
|
|
3
|
+
interface RunTargetOwnerFields {
|
|
4
|
+
readonly parent?: string;
|
|
5
|
+
readonly parentKind?: "app" | "element" | "task";
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The app or element that owns an automation token, and whether that is the
|
|
9
|
+
* building automation's own app or element. A token with no `parent` is the
|
|
10
|
+
* caller's own. A same-named automation in another app or element is a
|
|
11
|
+
* different automation (edk#2118).
|
|
12
|
+
*/
|
|
13
|
+
export declare function automationTargetOwner(value: RunTargetOwnerFields, ctx: {
|
|
14
|
+
readonly appRefName: string;
|
|
15
|
+
readonly parentScope: "app" | "element";
|
|
16
|
+
}): {
|
|
17
|
+
readonly ownerKind: NonNullable<RunTargetOwnerFields["parentKind"]>;
|
|
18
|
+
readonly isOwn: boolean;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* A bare platform-id target whose every input names a raw parameter id is a
|
|
22
|
+
* static run: pull prints a static export with an undiscovered target
|
|
23
|
+
* (`target_automation_id` + `input_mappings[].parameter_id`) as
|
|
24
|
+
* `automation: "<uuid>"` + `inputs[].name: "<uuid>"`. Dynamic mappings name
|
|
25
|
+
* the target's inputs, never a parameter id.
|
|
26
|
+
*/
|
|
27
|
+
export declare function bareStaticRunTarget(config: Record<string, unknown>): boolean;
|
|
28
|
+
/** The onDemand trigger's record parameters: they expose only a record ID. */
|
|
29
|
+
export declare function onDemandRecordParamNames(trigger: unknown): ReadonlySet<string>;
|
|
30
|
+
/** An automation payload's on-demand record inputs, for a static runAutomation caller's check (edk#1868). */
|
|
31
|
+
export declare function automationOnDemandRecordInputs(payload: unknown): ReadonlySet<string>;
|
|
32
|
+
/**
|
|
33
|
+
* edk#1868: a static runAutomation mapping into the target's on-demand record
|
|
34
|
+
* input reaches the target as no record, so every task reading it fails at
|
|
35
|
+
* run time. Returns the problem, naming the text-handle workaround, or
|
|
36
|
+
* undefined. `recordInputNames` is known only for a target this build owns.
|
|
37
|
+
*/
|
|
38
|
+
export declare function recordInputMappingProblem(target: {
|
|
39
|
+
readonly refName: string;
|
|
40
|
+
readonly name?: string;
|
|
41
|
+
readonly parent?: string;
|
|
42
|
+
}, mappings: readonly unknown[], recordInputNames: ReadonlySet<string> | undefined): string | undefined;
|
|
43
|
+
/** Run-automation targets reference publish for ACTIVE automations, automation for draft/inactive. */
|
|
44
|
+
export declare function automationRunTargetResourceAttr(appTfLabel: string, automationRefName: string, activeAutomationRefNames: ReadonlySet<string> | undefined, scope?: ChildResourceScope, handle?: string): TfExpr;
|
|
45
|
+
/** The publish resource addresses a compiled automation file declares (its own). */
|
|
46
|
+
export declare function automationPublishDeclarations(text: string): string[];
|
|
47
|
+
/**
|
|
48
|
+
* The publish addresses of a compiled automation file's static
|
|
49
|
+
* `runAutomation` targets. A static call to an ACTIVE target names the
|
|
50
|
+
* target's publish: the run task and the caller's publish `depends_on` it
|
|
51
|
+
* (own app or element, `automationToTf`), and the target lookup
|
|
52
|
+
* `data.<automation>.<target>_for_<caller>` `depends_on` it (another app or
|
|
53
|
+
* element in the workspace, `automationTargetToTf`). Nothing else in an
|
|
54
|
+
* automation file names another automation's publish. A target outside the
|
|
55
|
+
* workspace (a lookup by name) or one that is not ACTIVE names no publish and
|
|
56
|
+
* is not tracked.
|
|
57
|
+
*/
|
|
58
|
+
export declare function staticRunTargets(text: string): string[];
|
|
59
|
+
export {};
|