@elementumai/edk 0.11.0 → 0.13.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 +40 -6
- package/dist-sdk/src/catalog/factories.d.ts +7 -1
- package/dist-sdk/src/catalog/factories.js +2 -0
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +1 -1
- package/dist-sdk/src/catalog/org.js +79 -34
- package/dist-sdk/src/catalog/token.js +5 -0
- package/dist-sdk/src/catalog/types.d.ts +7 -1
- package/dist-sdk/src/catalog/types.js +3 -0
- package/dist-sdk/src/core/system-fields.d.ts +1 -1
- package/dist-sdk/src/core/system-fields.js +1 -1
- package/dist-sdk/src/core/triggers/on-demand.d.ts +2 -0
- package/dist-sdk/src/core/triggers/on-demand.js +3 -0
- package/dist-sdk/src/core/types/app.d.ts +6 -0
- package/dist-sdk/src/engine/build/context.d.ts +3 -0
- package/dist-sdk/src/engine/coverage-gaps.d.ts +5 -0
- package/dist-sdk/src/engine/coverage-gaps.js +9 -0
- package/dist-sdk/src/engine/ei/run.d.ts +20 -1
- package/dist-sdk/src/engine/ei/run.js +102 -14
- package/dist-sdk/src/engine/pull/authored-address.js +42 -6
- package/dist-sdk/src/engine/pull/authored-root.d.ts +88 -0
- package/dist-sdk/src/engine/pull/authored-root.js +306 -0
- package/dist-sdk/src/engine/pull/context.d.ts +10 -0
- package/dist-sdk/src/engine/pull/field-refs-registry.d.ts +114 -0
- package/dist-sdk/src/engine/pull/field-refs-registry.js +501 -0
- package/dist-sdk/src/engine/pull/org.d.ts +1 -0
- package/dist-sdk/src/engine/pull/org.js +2 -0
- package/dist-sdk/src/engine/pull/partition.d.ts +8 -0
- package/dist-sdk/src/engine/pull/partition.js +43 -0
- package/dist-sdk/src/engine/pull/pulled-roots.d.ts +89 -0
- package/dist-sdk/src/engine/pull/pulled-roots.js +203 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +22 -0
- package/dist-sdk/src/engine/pull/ref-only.js +59 -1
- package/dist-sdk/src/engine/pull/source-resources.d.ts +39 -0
- package/dist-sdk/src/engine/pull/source-resources.js +110 -0
- package/dist-sdk/src/engine/pull/stream-root.d.ts +148 -0
- package/dist-sdk/src/engine/pull/stream-root.js +563 -0
- package/dist-sdk/src/engine/workspace/reserved-catalog-keys.d.ts +47 -0
- package/dist-sdk/src/engine/workspace/reserved-catalog-keys.js +115 -0
- package/dist-sdk/src/entities/access-policy/build.d.ts +2 -1
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +9 -1
- package/dist-sdk/src/entities/access-policy/from-tf.js +25 -4
- package/dist-sdk/src/entities/access-policy/module.js +5 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +19 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +65 -8
- package/dist-sdk/src/entities/agent/build.d.ts +52 -1
- package/dist-sdk/src/entities/agent/build.js +34 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +68 -0
- package/dist-sdk/src/entities/agent/from-tf.d.ts +34 -1
- package/dist-sdk/src/entities/agent/from-tf.js +262 -2
- package/dist-sdk/src/entities/agent/index.d.ts +1 -1
- package/dist-sdk/src/entities/agent/to-tf.d.ts +8 -10
- package/dist-sdk/src/entities/agent/to-tf.js +158 -14
- package/dist-sdk/src/entities/agent-tool/from-tf.js +6 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +2 -2
- package/dist-sdk/src/entities/app/build.d.ts +34 -14
- package/dist-sdk/src/entities/app/build.js +93 -16
- package/dist-sdk/src/entities/app/from-tf.js +25 -11
- package/dist-sdk/src/entities/app/index.d.ts +1 -0
- package/dist-sdk/src/entities/app/index.js +1 -0
- package/dist-sdk/src/entities/app/module.js +1 -0
- package/dist-sdk/src/entities/app/stage-keys.d.ts +20 -5
- package/dist-sdk/src/entities/app/stage-keys.js +43 -9
- package/dist-sdk/src/entities/app/to-tf.js +2 -0
- package/dist-sdk/src/entities/approval-chain/build.d.ts +46 -11
- package/dist-sdk/src/entities/approval-chain/build.js +120 -8
- package/dist-sdk/src/entities/approval-chain/from-tf.d.ts +24 -2
- package/dist-sdk/src/entities/approval-chain/from-tf.js +148 -6
- package/dist-sdk/src/entities/approval-chain/index.d.ts +4 -1
- package/dist-sdk/src/entities/approval-chain/index.js +4 -1
- package/dist-sdk/src/entities/approval-chain/module.js +23 -5
- package/dist-sdk/src/entities/approval-chain/printer.d.ts +1 -1
- package/dist-sdk/src/entities/approval-chain/printer.js +91 -5
- package/dist-sdk/src/entities/approval-chain/steps-tf.d.ts +77 -0
- package/dist-sdk/src/entities/approval-chain/steps-tf.js +255 -0
- package/dist-sdk/src/entities/approval-chain/steps.d.ts +71 -0
- package/dist-sdk/src/entities/approval-chain/steps.js +83 -0
- package/dist-sdk/src/entities/approval-chain/to-tf.d.ts +16 -6
- package/dist-sdk/src/entities/approval-chain/to-tf.js +37 -4
- package/dist-sdk/src/entities/automation/build.d.ts +50 -24
- package/dist-sdk/src/entities/automation/build.js +86 -33
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +52 -8
- package/dist-sdk/src/entities/automation/from-tf.d.ts +38 -6
- package/dist-sdk/src/entities/automation/from-tf.js +855 -157
- package/dist-sdk/src/entities/automation/index.d.ts +2 -1
- package/dist-sdk/src/entities/automation/index.js +1 -0
- package/dist-sdk/src/entities/automation/module.d.ts +4 -3
- package/dist-sdk/src/entities/automation/module.js +33 -12
- package/dist-sdk/src/entities/automation/refs-read.d.ts +19 -0
- package/dist-sdk/src/entities/automation/refs-read.js +48 -0
- package/dist-sdk/src/entities/automation/run-target.d.ts +2 -0
- package/dist-sdk/src/entities/automation/run-target.js +5 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +2 -1
- package/dist-sdk/src/entities/automation/script-code.js +82 -1
- package/dist-sdk/src/entities/automation/script-lint.d.ts +13 -0
- package/dist-sdk/src/entities/automation/script-lint.js +418 -0
- package/dist-sdk/src/entities/automation/slack-message-refs.d.ts +9 -0
- package/dist-sdk/src/entities/automation/slack-message-refs.js +75 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +12 -1
- package/dist-sdk/src/entities/automation/task-output-labels.js +32 -1
- package/dist-sdk/src/entities/automation/tasks.d.ts +76 -18
- package/dist-sdk/src/entities/automation/tasks.js +52 -15
- package/dist-sdk/src/entities/automation/to-tf.d.ts +3 -0
- package/dist-sdk/src/entities/automation/to-tf.js +585 -97
- package/dist-sdk/src/entities/automation/triggers.d.ts +48 -23
- package/dist-sdk/src/entities/automation/triggers.js +27 -12
- package/dist-sdk/src/entities/automation/unsafe-script-output.d.ts +50 -0
- package/dist-sdk/src/entities/automation/unsafe-script-output.js +92 -0
- package/dist-sdk/src/entities/chart/build.d.ts +18 -2
- package/dist-sdk/src/entities/chart/from-tf.d.ts +2 -2
- package/dist-sdk/src/entities/chart/from-tf.js +28 -1
- package/dist-sdk/src/entities/chart/index.d.ts +1 -1
- package/dist-sdk/src/entities/chart/printer.js +5 -2
- package/dist-sdk/src/entities/chart/to-tf.js +38 -3
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +3 -0
- package/dist-sdk/src/entities/dynamic-layout/condition-keys.d.ts +48 -0
- package/dist-sdk/src/entities/dynamic-layout/condition-keys.js +261 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +45 -6
- package/dist-sdk/src/entities/dynamic-layout/module.js +2 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +46 -12
- package/dist-sdk/src/entities/element/audit-field-guard.d.ts +9 -0
- package/dist-sdk/src/entities/element/audit-field-guard.js +88 -0
- package/dist-sdk/src/entities/element/build.js +2 -1
- package/dist-sdk/src/entities/element/from-tf.js +15 -2
- package/dist-sdk/src/entities/element/module.js +3 -0
- package/dist-sdk/src/entities/element/system-fields.d.ts +13 -0
- package/dist-sdk/src/entities/element/system-fields.js +23 -0
- package/dist-sdk/src/entities/element/to-tf.js +2 -0
- package/dist-sdk/src/entities/field/build.d.ts +9 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +29 -1
- package/dist-sdk/src/entities/field/from-tf.js +99 -6
- package/dist-sdk/src/entities/field/module.js +12 -2
- package/dist-sdk/src/entities/field/to-tf.d.ts +13 -3
- package/dist-sdk/src/entities/field/to-tf.js +90 -46
- package/dist-sdk/src/entities/org/category.js +1 -0
- package/dist-sdk/src/entities/org/index.d.ts +1 -0
- package/dist-sdk/src/entities/org/index.js +1 -0
- package/dist-sdk/src/entities/org/role.js +5 -0
- package/dist-sdk/src/entities/org/voice-auth.d.ts +5 -0
- package/dist-sdk/src/entities/org/voice-auth.js +33 -0
- package/dist-sdk/src/entities/organization/build.d.ts +3 -0
- package/dist-sdk/src/entities/organization/build.js +2 -0
- package/dist-sdk/src/entities/organization/index.d.ts +1 -0
- package/dist-sdk/src/entities/organization/index.js +1 -0
- package/dist-sdk/src/entities/organization/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/organization/to-tf.js +59 -1
- package/dist-sdk/src/entities/organization/voice-auth.d.ts +60 -0
- package/dist-sdk/src/entities/organization/voice-auth.js +60 -0
- package/dist-sdk/src/entities/phone-service/build.d.ts +9 -1
- package/dist-sdk/src/entities/phone-service/build.js +1 -0
- package/dist-sdk/src/entities/phone-service/deserializer/print-phone-service.js +3 -0
- package/dist-sdk/src/entities/phone-service/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/phone-service/from-tf.js +8 -1
- package/dist-sdk/src/entities/phone-service/to-tf.js +16 -0
- package/dist-sdk/src/entities/record-create-form/from-tf.js +2 -2
- package/dist-sdk/src/entities/relationship/from-tf.js +7 -2
- package/dist-sdk/src/entities/relationship/module.js +2 -2
- package/dist-sdk/src/entities/relationship/pair-check.d.ts +6 -2
- package/dist-sdk/src/entities/relationship/pair-check.js +105 -18
- package/dist-sdk/src/entities/relationship/to-tf.js +5 -2
- package/dist-sdk/src/entities/role/permission-levels.d.ts +7 -0
- package/dist-sdk/src/entities/role/permission-levels.js +78 -0
- package/dist-sdk/src/entities/role/to-tf.js +32 -2
- package/dist-sdk/src/entities/service-account/module.d.ts +2 -1
- package/dist-sdk/src/entities/service-account/module.js +9 -1
- package/dist-sdk/src/entities/service-account/resource-type.d.ts +2 -0
- package/dist-sdk/src/entities/service-account/resource-type.js +2 -0
- package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +5 -5
- package/dist-sdk/src/entities/service-account/role-fidelity.js +21 -13
- package/dist-sdk/src/entities/service-account/role-membership-check.d.ts +20 -0
- package/dist-sdk/src/entities/service-account/role-membership-check.js +80 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +15 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +36 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +4 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +85 -14
- package/dist-sdk/src/entities/shared/filters/index.js +18 -6
- package/dist-sdk/src/entities/shared/filters/option-lookups.d.ts +57 -0
- package/dist-sdk/src/entities/shared/filters/option-lookups.js +108 -0
- package/dist-sdk/src/entities/shared/filters/print.js +9 -5
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +12 -7
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +9 -5
- package/dist-sdk/src/entities/shared/raw-option-id.d.ts +30 -0
- package/dist-sdk/src/entities/shared/raw-option-id.js +41 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -2
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +6 -3
- package/dist-sdk/src/entities/shared/types/field-types.js +3 -1
- package/dist-sdk/src/entities/skill/input-coverage.js +5 -2
- package/dist-sdk/src/entities/skill/module.js +2 -0
- package/dist-sdk/src/entities/sla/build.d.ts +96 -0
- package/dist-sdk/src/entities/sla/build.js +124 -0
- package/dist-sdk/src/entities/sla/from-tf.d.ts +40 -0
- package/dist-sdk/src/entities/sla/from-tf.js +164 -0
- package/dist-sdk/src/entities/sla/index.d.ts +1 -0
- package/dist-sdk/src/entities/sla/index.js +1 -0
- package/dist-sdk/src/entities/sla/module.d.ts +4 -0
- package/dist-sdk/src/entities/sla/module.js +73 -0
- package/dist-sdk/src/entities/sla/printer.d.ts +2 -0
- package/dist-sdk/src/entities/sla/printer.js +84 -0
- package/dist-sdk/src/entities/sla/to-tf.d.ts +12 -0
- package/dist-sdk/src/entities/sla/to-tf.js +81 -0
- package/dist-sdk/src/entities/table/build.d.ts +7 -2
- package/dist-sdk/src/entities/table/build.js +22 -1
- package/dist-sdk/src/entities/table/deserializer/normalize.d.ts +4 -1
- package/dist-sdk/src/entities/table/from-tf.js +89 -14
- package/dist-sdk/src/entities/table/index.d.ts +1 -1
- package/dist-sdk/src/entities/table/to-tf.js +41 -2
- package/dist-sdk/src/entities/task/from-tf.js +2 -1
- package/dist-sdk/src/entities/task/to-tf.js +1 -0
- package/dist-sdk/src/entities/view/from-tf.d.ts +8 -4
- package/dist-sdk/src/entities/view/from-tf.js +10 -9
- package/dist-sdk/src/entities/view/module.js +5 -0
- package/dist-sdk/src/entities/widget/from-tf.js +15 -4
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +51 -4
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +20 -2
- package/dist-sdk/src/graph/index.js +19 -0
- package/dist-sdk/src/graph/modules.js +11 -1
- package/dist-sdk/src/graph/resource-types.d.ts +47 -0
- package/dist-sdk/src/graph/resource-types.js +62 -0
- package/dist-sdk/src/graph/types.d.ts +116 -6
- package/package.json +6 -3
|
@@ -17,6 +17,7 @@ export { AUTOMATION_RESOURCE_TYPES, AUTOMATION_TASK_TYPES, AUTOMATION_TRIGGER_TY
|
|
|
17
17
|
export * as filter from "../shared/filters/index.js";
|
|
18
18
|
export { automationStatus, chainableTrigger, actions, automation, type ActionBuilder, type ActionChain, type ActionDef, type ActionOptions, type ActionSequenceDef, type ActionsStarted, type AutomationConfigured, type AutomationOptions, type AutomationStatus, type ForkJoinBranch, type ForkJoinBranchBuilder, type ForkJoinConfig, type ForEachBuilder, type ForEachConfig, type 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
|
+
export { unsafeScriptOutput } from "./unsafe-script-output.js";
|
|
20
21
|
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 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
|
+
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 ExecuteScriptOutput, 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
23
|
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";
|
|
@@ -17,6 +17,7 @@ export { AUTOMATION_RESOURCE_TYPES, AUTOMATION_TASK_TYPES, AUTOMATION_TRIGGER_TY
|
|
|
17
17
|
export * as filter from "../shared/filters/index.js";
|
|
18
18
|
export { automationStatus, chainableTrigger, actions, automation } from "./build.js";
|
|
19
19
|
export { ScriptCodeError, scriptFile } from "./script-code.js";
|
|
20
|
+
export { unsafeScriptOutput } from "./unsafe-script-output.js";
|
|
20
21
|
export { workflowOutput, workflowOutputType, } from "./workflow-output.js";
|
|
21
22
|
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
23
|
export { approvalProcessStatusUpdated, attachment, commentAdded, conversationEnd, dataMine, emailReceived, onDemand, recordCreated, recordUpdated, schedule, slackMessage, surveyResponseCreate, temporal, webHook, webhook } from "./triggers.js";
|
|
@@ -9,9 +9,10 @@ import { type EntityKindModule } from "../../graph/types.js";
|
|
|
9
9
|
* any automation is skipped, so a released file left in place would still
|
|
10
10
|
* build and the next plan would create a duplicate. The file is kept instead
|
|
11
11
|
* when a resource that stays in source still references the automation
|
|
12
|
-
* (`keptFor`): agent and skill run-automation tools
|
|
13
|
-
*
|
|
14
|
-
*
|
|
12
|
+
* (`keptFor`): agent and skill run-automation tools and other kept
|
|
13
|
+
* automations can only name an automation in source, so archiving would
|
|
14
|
+
* break build. A widget can (#1901), and so can a dynamic-layout button
|
|
15
|
+
* (#2693). An automation pull skips without releasing keeps its state and
|
|
15
16
|
* its existing source file, so the next plan builds that older file against
|
|
16
17
|
* the live automation.
|
|
17
18
|
*/
|
|
@@ -11,7 +11,7 @@ import { hasUnresolvedForEachItem, preserveAuthoredAutomationPullMeta, printAuto
|
|
|
11
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 { taskOutputReferences, USER_SEARCH_OUTPUT_REFERENCES } from "./task-output-labels.js";
|
|
14
|
+
import { executeScriptOutputReferences, 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
17
|
import { IMPLEMENTED_FILE_READER_RESOURCE_TYPES } from "../file-reader/types.js";
|
|
@@ -129,9 +129,10 @@ function registerForeignObjectIdDeps(doc, automationLabel, ctx) {
|
|
|
129
129
|
* any automation is skipped, so a released file left in place would still
|
|
130
130
|
* build and the next plan would create a duplicate. The file is kept instead
|
|
131
131
|
* when a resource that stays in source still references the automation
|
|
132
|
-
* (`keptFor`): agent and skill run-automation tools
|
|
133
|
-
*
|
|
134
|
-
*
|
|
132
|
+
* (`keptFor`): agent and skill run-automation tools and other kept
|
|
133
|
+
* automations can only name an automation in source, so archiving would
|
|
134
|
+
* break build. A widget can (#1901), and so can a dynamic-layout button
|
|
135
|
+
* (#2693). An automation pull skips without releasing keeps its state and
|
|
135
136
|
* its existing source file, so the next plan builds that older file against
|
|
136
137
|
* the live automation.
|
|
137
138
|
*/
|
|
@@ -143,7 +144,7 @@ export function droppedAutomationGap(autoBlock, autoLabel, gap) {
|
|
|
143
144
|
entity: `automation ${JSON.stringify(display)} (${autoLabel})`,
|
|
144
145
|
detail: `skipped, not written to source: ${gap.why}`,
|
|
145
146
|
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
|
|
147
|
+
? `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 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
148
|
: gap.released && gap.settleByState === true
|
|
148
149
|
? `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
150
|
: gap.released
|
|
@@ -157,7 +158,8 @@ const FIX_OR_REPORT = "If you can change what the reason names in the platform,
|
|
|
157
158
|
* Addresses of the stream's resources that stay in source (`inSource`) and
|
|
158
159
|
* reference any of `owned` by source name. A widget does not count: with its
|
|
159
160
|
* automation out of source, build points it at the live automation through a
|
|
160
|
-
* display-name lookup (#1901), so archiving is safe.
|
|
161
|
+
* display-name lookup (#1901), so archiving is safe. A dynamic-layout button
|
|
162
|
+
* does not count either (#2693). Any other reference from that layout still does.
|
|
161
163
|
*/
|
|
162
164
|
function externalReferrers(stream, owned, inSource) {
|
|
163
165
|
const ownedSet = new Set(owned);
|
|
@@ -168,11 +170,26 @@ function externalReferrers(stream, owned, inSource) {
|
|
|
168
170
|
const address = `${block.type}.${block.label}`;
|
|
169
171
|
if (ownedSet.has(address) || block.type === "elementum_widget" || !inSource(address))
|
|
170
172
|
continue;
|
|
171
|
-
|
|
173
|
+
const attrs = block.type === "elementum_dynamic_layout" ? withoutAutomationButtons(block.attrs) : block.attrs;
|
|
174
|
+
if (referenceIn(attrs, ownedSet) !== undefined)
|
|
172
175
|
referrers.push(address);
|
|
173
176
|
}
|
|
174
177
|
return referrers;
|
|
175
178
|
}
|
|
179
|
+
/** Layout attrs with each `automation_button` removed, so a button's automation ref does not keep the file. */
|
|
180
|
+
function withoutAutomationButtons(value) {
|
|
181
|
+
if (Array.isArray(value))
|
|
182
|
+
return value.map(withoutAutomationButtons);
|
|
183
|
+
if (value === null || typeof value !== "object")
|
|
184
|
+
return value;
|
|
185
|
+
const out = {};
|
|
186
|
+
for (const [key, child] of Object.entries(value)) {
|
|
187
|
+
if (key === "automation_button")
|
|
188
|
+
continue;
|
|
189
|
+
out[key] = withoutAutomationButtons(child);
|
|
190
|
+
}
|
|
191
|
+
return out;
|
|
192
|
+
}
|
|
176
193
|
/** Addresses of the stream's approval processes that pull leaves unmanaged because their stage lost its only handle (#1136). */
|
|
177
194
|
function lostStageApprovalChains(stream, ctx) {
|
|
178
195
|
const lost = new Set();
|
|
@@ -274,7 +291,7 @@ function extractAutomations(ownBlocks, stream, ctx) {
|
|
|
274
291
|
}
|
|
275
292
|
}
|
|
276
293
|
try {
|
|
277
|
-
const extracted = automationFromTf(doc, autoLabel, ctx.appRefName, ctx.foreignFieldRefsById, ctx.foreignFieldRefsByDataAddress, ctx.foreignTableRefsById, ctx.
|
|
294
|
+
const extracted = automationFromTf(doc, autoLabel, ctx.appRefName, ctx.foreignFieldRefsById, ctx.foreignFieldRefsByDataAddress, ctx.foreignTableRefsById, ctx.picklistOptionsByField, ctx.fieldNamesByOwnerRefName, ctx.foreignAppRefNames, ctx.foreignElementRefNames, ctx.procedureKeysByDiscriminator, ctx.foreignTaskRefNames, ctx.groupKeysByName, ctx.serviceAccountsById, ctx.foreignFileReaderRefsById, ctx.foreignAppRefNamespaces);
|
|
278
295
|
// edk#1646 / #1858: adopt when a rebuilt ctx ref matches provider Read.
|
|
279
296
|
// Otherwise the automation stays platform-managed. Releasing its state
|
|
280
297
|
// also archives the authored file, so the next plan does not create a
|
|
@@ -383,10 +400,12 @@ function extractAutomations(ownBlocks, stream, ctx) {
|
|
|
383
400
|
}
|
|
384
401
|
}
|
|
385
402
|
// Archive a released automation's file only when nothing that stays in
|
|
386
|
-
// source still references it (#1877)
|
|
387
|
-
// tools
|
|
388
|
-
//
|
|
389
|
-
//
|
|
403
|
+
// source still references it (#1877). Agent and skill run-automation
|
|
404
|
+
// tools and other automations can only name an automation in source, so
|
|
405
|
+
// a reference from one of those keeps the file, and the warning says so.
|
|
406
|
+
// A dynamic-layout button looks the live automation up by the display
|
|
407
|
+
// name pull prints (#2693), so its reference does not keep the file.
|
|
408
|
+
// What stays in source is known only after
|
|
390
409
|
// every own-file child of the stream is extracted, so stream root decides
|
|
391
410
|
// it and calls back. A kept file is source too: what it references must
|
|
392
411
|
// stay (an automation a kept automation runs is kept as well), so iterate
|
|
@@ -573,6 +592,7 @@ export const automationModule = {
|
|
|
573
592
|
...(ctx.fieldAddressesByAppRefName !== undefined ? { fieldAddressesByAppRefName: ctx.fieldAddressesByAppRefName } : {}),
|
|
574
593
|
...(ctx.authoredAspectKeys !== undefined ? { authoredAspectKeys: ctx.authoredAspectKeys } : {}),
|
|
575
594
|
...(ctx.allowUnknownPicklistOptions === true ? { allowUnknownPicklistOptions: true } : {}),
|
|
595
|
+
...(ctx.optionIds !== undefined ? { optionIds: ctx.optionIds } : {}),
|
|
576
596
|
orgRefs: ctx.orgRefs,
|
|
577
597
|
workspaceAspects: ctx.workspaceAspects,
|
|
578
598
|
...(ctx.outOfScopeApps !== undefined && { outOfScopeApps: ctx.outOfScopeApps }),
|
|
@@ -605,6 +625,7 @@ export const automationModule = {
|
|
|
605
625
|
taskOutputReferences: {
|
|
606
626
|
...taskOutputReferences(),
|
|
607
627
|
elementum_user_search_task: USER_SEARCH_OUTPUT_REFERENCES,
|
|
628
|
+
elementum_execute_script_task: executeScriptOutputReferences(),
|
|
608
629
|
},
|
|
609
630
|
// An on-demand parameter used as a script input: the build writes the
|
|
610
631
|
// envelope with the platform's normalized name (#1525), the export the
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A record-bearing task's or trigger's write-only `refs_read` (edk#2648):
|
|
3
|
+
* the `refs` keys this automation's resources read from it. The provider
|
|
4
|
+
* plans `refs` unknown while the owner's field set changes (edk#2280,
|
|
5
|
+
* edk#2438), which made every task that reads a trigger's refs plan an
|
|
6
|
+
* update when one field was added. With `refs_read` it keeps `refs` known
|
|
7
|
+
* when every key read is still right, and plans them unknown only when a key
|
|
8
|
+
* read is new or belongs to a field that changes in this apply.
|
|
9
|
+
*/
|
|
10
|
+
import { type TfBlock } from "../../engine/tf/index.js";
|
|
11
|
+
/**
|
|
12
|
+
* Sets `refs_read` on each block that has `object_field_ids`, from every
|
|
13
|
+
* `<type>.<label>.refs["<key>"]` read in `blocks`. A read of the whole map,
|
|
14
|
+
* or of a key that isn't a literal index, leaves `refs_read` unset, so the
|
|
15
|
+
* provider plans as before. Pull's build-vs-export compare skips `refs_read`
|
|
16
|
+
* because export does not write it; it is a build-only planning hint
|
|
17
|
+
* (edk#2649 H1).
|
|
18
|
+
*/
|
|
19
|
+
export declare function setRefsRead(blocks: readonly TfBlock[]): void;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A record-bearing task's or trigger's write-only `refs_read` (edk#2648):
|
|
3
|
+
* the `refs` keys this automation's resources read from it. The provider
|
|
4
|
+
* plans `refs` unknown while the owner's field set changes (edk#2280,
|
|
5
|
+
* edk#2438), which made every task that reads a trigger's refs plan an
|
|
6
|
+
* update when one field was added. With `refs_read` it keeps `refs` known
|
|
7
|
+
* when every key read is still right, and plans them unknown only when a key
|
|
8
|
+
* read is new or belongs to a field that changes in this apply.
|
|
9
|
+
*/
|
|
10
|
+
import { forEachExpr } from "../../engine/tf/index.js";
|
|
11
|
+
/**
|
|
12
|
+
* Sets `refs_read` on each block that has `object_field_ids`, from every
|
|
13
|
+
* `<type>.<label>.refs["<key>"]` read in `blocks`. A read of the whole map,
|
|
14
|
+
* or of a key that isn't a literal index, leaves `refs_read` unset, so the
|
|
15
|
+
* provider plans as before. Pull's build-vs-export compare skips `refs_read`
|
|
16
|
+
* because export does not write it; it is a build-only planning hint
|
|
17
|
+
* (edk#2649 H1).
|
|
18
|
+
*/
|
|
19
|
+
export function setRefsRead(blocks) {
|
|
20
|
+
const readKeys = new Map();
|
|
21
|
+
for (const block of blocks) {
|
|
22
|
+
for (const value of Object.values(block.attrs)) {
|
|
23
|
+
forEachExpr(value, (e) => {
|
|
24
|
+
if (e.$expr !== "resource-attr" || e.path[0] !== "refs")
|
|
25
|
+
return;
|
|
26
|
+
const address = `${e.type}.${e.label}`;
|
|
27
|
+
const index = e.path[1];
|
|
28
|
+
if (e.path.length !== 2 || typeof index !== "object") {
|
|
29
|
+
readKeys.set(address, "whole map");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const keys = readKeys.get(address) ?? new Set();
|
|
33
|
+
if (keys === "whole map")
|
|
34
|
+
return;
|
|
35
|
+
keys.add(index.index);
|
|
36
|
+
readKeys.set(address, keys);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
for (const block of blocks) {
|
|
41
|
+
if (block.kind !== "resource" || block.attrs["object_field_ids"] === undefined)
|
|
42
|
+
continue;
|
|
43
|
+
const keys = readKeys.get(`${block.type}.${block.label}`) ?? new Set();
|
|
44
|
+
if (keys === "whole map")
|
|
45
|
+
continue;
|
|
46
|
+
block.attrs["refs_read"] = [...keys].sort();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -44,6 +44,8 @@ export declare function recordInputMappingProblem(target: {
|
|
|
44
44
|
export declare function automationRunTargetResourceAttr(appTfLabel: string, automationRefName: string, activeAutomationRefNames: ReadonlySet<string> | undefined, scope?: ChildResourceScope, handle?: string): TfExpr;
|
|
45
45
|
/** The publish resource addresses a compiled automation file declares (its own). */
|
|
46
46
|
export declare function automationPublishDeclarations(text: string): string[];
|
|
47
|
+
/** The `elementum_automation` label a compiled automation file declares. */
|
|
48
|
+
export declare function automationDeclaration(text: string): string | undefined;
|
|
47
49
|
/**
|
|
48
50
|
* The publish addresses of a compiled automation file's static
|
|
49
51
|
* `runAutomation` targets. A static call to an ACTIVE target names the
|
|
@@ -70,12 +70,17 @@ export function automationRunTargetResourceAttr(appTfLabel, automationRefName, a
|
|
|
70
70
|
}
|
|
71
71
|
return expr.resourceAttr(AUTOMATION_RESOURCE_TYPE, label, ["id"]);
|
|
72
72
|
}
|
|
73
|
+
const AUTOMATION_DECL = new RegExp(`^resource\\s+"${AUTOMATION_RESOURCE_TYPE}"\\s+"([^"]+)"`, "m");
|
|
73
74
|
const PUBLISH_DECL = new RegExp(`^resource\\s+"${WORKFLOW_PUBLISH_RESOURCE_TYPE}"\\s+"([^"]+)"`, "gm");
|
|
74
75
|
const PUBLISH_REF = new RegExp(`(?<![\\w.])${WORKFLOW_PUBLISH_RESOURCE_TYPE}\\.([a-z0-9_]+)`, "g");
|
|
75
76
|
/** The publish resource addresses a compiled automation file declares (its own). */
|
|
76
77
|
export function automationPublishDeclarations(text) {
|
|
77
78
|
return [...text.matchAll(PUBLISH_DECL)].map((match) => `${WORKFLOW_PUBLISH_RESOURCE_TYPE}.${match[1]}`);
|
|
78
79
|
}
|
|
80
|
+
/** The `elementum_automation` label a compiled automation file declares. */
|
|
81
|
+
export function automationDeclaration(text) {
|
|
82
|
+
return AUTOMATION_DECL.exec(text)?.[1];
|
|
83
|
+
}
|
|
79
84
|
/**
|
|
80
85
|
* The publish addresses of a compiled automation file's static
|
|
81
86
|
* `runAutomation` targets. A static call to an ACTIVE target names the
|
|
@@ -78,7 +78,8 @@ export declare function stripTsIgnoreLines(code: string): string;
|
|
|
78
78
|
* half of what the `code` function's TS return type already gives the type
|
|
79
79
|
* system. Same best-effort contract as the closure scan:
|
|
80
80
|
*
|
|
81
|
-
* - every `return`ed object literal contributes its top-level keys
|
|
81
|
+
* - every top-level `return`ed object literal contributes its top-level keys
|
|
82
|
+
* (a return inside a callback or nested function is skipped); multiple
|
|
82
83
|
* returns merge (a key typed differently across branches widens to "text")
|
|
83
84
|
* - value types come from LITERAL values only: string/template → "text",
|
|
84
85
|
* integral number → "integer", other number → "number", true/false →
|
|
@@ -297,7 +297,8 @@ function collectParamNames(params) {
|
|
|
297
297
|
* half of what the `code` function's TS return type already gives the type
|
|
298
298
|
* system. Same best-effort contract as the closure scan:
|
|
299
299
|
*
|
|
300
|
-
* - every `return`ed object literal contributes its top-level keys
|
|
300
|
+
* - every top-level `return`ed object literal contributes its top-level keys
|
|
301
|
+
* (a return inside a callback or nested function is skipped); multiple
|
|
301
302
|
* returns merge (a key typed differently across branches widens to "text")
|
|
302
303
|
* - value types come from LITERAL values only: string/template → "text",
|
|
303
304
|
* integral number → "integer", other number → "number", true/false →
|
|
@@ -312,6 +313,18 @@ function collectParamNames(params) {
|
|
|
312
313
|
* with `${}` nesting) so braces inside them don't derail the literal walk.
|
|
313
314
|
*/
|
|
314
315
|
export function inferOutputSchema(body) {
|
|
316
|
+
let topLevel = topLevelReturns(body);
|
|
317
|
+
if (topLevel === undefined) {
|
|
318
|
+
// A stored TypeScript body (a scriptFile keeps its types): scan the
|
|
319
|
+
// type-stripped body the #2286 lint also reads, so both see the same
|
|
320
|
+
// top-level returns. A body that still doesn't parse reads every return.
|
|
321
|
+
const stripped = typeStrippedBody(body);
|
|
322
|
+
if (stripped !== undefined) {
|
|
323
|
+
topLevel = topLevelReturns(stripped);
|
|
324
|
+
if (topLevel !== undefined)
|
|
325
|
+
body = stripped;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
315
328
|
const merged = {};
|
|
316
329
|
let found = false;
|
|
317
330
|
const src = body;
|
|
@@ -329,11 +342,21 @@ export function inferOutputSchema(body) {
|
|
|
329
342
|
if (src.startsWith("return", i) &&
|
|
330
343
|
!/[A-Za-z0-9_$]/.test(src[i + 6] ?? "") &&
|
|
331
344
|
!/[A-Za-z0-9_$.]/.test(src[i - 1] ?? "")) {
|
|
345
|
+
const returned = topLevel?.get(i);
|
|
346
|
+
if (topLevel !== undefined && (returned === undefined || returned === "nothing")) {
|
|
347
|
+
// A return inside a callback or nested function is not the script's
|
|
348
|
+
// result, and a bare `return` (including `return` followed by a
|
|
349
|
+
// newline and `{`, which automatic semicolon insertion ends) sets no keys.
|
|
350
|
+
i += 6;
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
332
353
|
let j = skipWs(src, i + 6);
|
|
333
354
|
while (src[j] === "(")
|
|
334
355
|
j = skipWs(src, j + 1);
|
|
335
356
|
if (src[j] !== "{")
|
|
336
357
|
return undefined; // non-literal return → bail
|
|
358
|
+
if (returned !== undefined && returned !== j)
|
|
359
|
+
return undefined; // `{ ... }.x` or another non-literal → bail
|
|
337
360
|
const lit = parseReturnedLiteral(src, j);
|
|
338
361
|
if (lit === undefined)
|
|
339
362
|
return undefined; // spread/computed key → bail
|
|
@@ -348,6 +371,64 @@ export function inferOutputSchema(body) {
|
|
|
348
371
|
}
|
|
349
372
|
return found ? merged : undefined;
|
|
350
373
|
}
|
|
374
|
+
/**
|
|
375
|
+
* The body's top-level `return` statements: the ones the script's own
|
|
376
|
+
* function runs, not those inside a callback or nested function
|
|
377
|
+
* (`ROWS.map((r) => { return { id: r.id }; })`). Maps each `return` keyword's
|
|
378
|
+
* offset to the offset of its returned object literal, "nothing" for a bare
|
|
379
|
+
* `return`, or "other" for any other value. Undefined when the body is not
|
|
380
|
+
* plain JavaScript.
|
|
381
|
+
*/
|
|
382
|
+
function topLevelReturns(body) {
|
|
383
|
+
let program;
|
|
384
|
+
try {
|
|
385
|
+
program = parse(body, {
|
|
386
|
+
ecmaVersion: "latest",
|
|
387
|
+
sourceType: "script",
|
|
388
|
+
allowReturnOutsideFunction: true,
|
|
389
|
+
allowAwaitOutsideFunction: true,
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
catch {
|
|
393
|
+
return undefined;
|
|
394
|
+
}
|
|
395
|
+
const returns = new Map();
|
|
396
|
+
const visit = (node) => {
|
|
397
|
+
if (Array.isArray(node)) {
|
|
398
|
+
for (const child of node)
|
|
399
|
+
visit(child);
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
if (typeof node !== "object" || node === null)
|
|
403
|
+
return;
|
|
404
|
+
const { type, start, argument } = node;
|
|
405
|
+
if (typeof type !== "string")
|
|
406
|
+
return;
|
|
407
|
+
if (type === "FunctionDeclaration" || type === "FunctionExpression" || type === "ArrowFunctionExpression")
|
|
408
|
+
return;
|
|
409
|
+
if (type === "ReturnStatement" && typeof start === "number") {
|
|
410
|
+
const literal = argument;
|
|
411
|
+
returns.set(start, literal === null || literal === undefined
|
|
412
|
+
? "nothing"
|
|
413
|
+
: literal.type === "ObjectExpression" && typeof literal.start === "number" ? literal.start : "other");
|
|
414
|
+
}
|
|
415
|
+
for (const [key, value] of Object.entries(node))
|
|
416
|
+
if (key !== "type")
|
|
417
|
+
visit(value);
|
|
418
|
+
};
|
|
419
|
+
visit(program);
|
|
420
|
+
return returns;
|
|
421
|
+
}
|
|
422
|
+
/** The body with TypeScript types stripped, or undefined when it can't be (no TypeScript, or it doesn't parse). */
|
|
423
|
+
function typeStrippedBody(body) {
|
|
424
|
+
try {
|
|
425
|
+
const stripped = toPlatformScriptBody(body, "executeScript output inference");
|
|
426
|
+
return stripped === body ? undefined : stripped;
|
|
427
|
+
}
|
|
428
|
+
catch {
|
|
429
|
+
return undefined;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
351
432
|
/** Skip whitespace and comments. */
|
|
352
433
|
function skipWs(src, i) {
|
|
353
434
|
for (;;) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** The input names a script reads from `input.parameters`, and the keys its top-level object returns set. */
|
|
2
|
+
export interface ScriptParameterUse {
|
|
3
|
+
readonly reads: ReadonlySet<string>;
|
|
4
|
+
/** Undefined when a top-level return isn't a plain object literal with static keys. */
|
|
5
|
+
readonly returnedKeys: ReadonlySet<string> | undefined;
|
|
6
|
+
/** Whether any top-level `return` returns a value. With none, every run returns undefined and fails. */
|
|
7
|
+
readonly returnsValue: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function scriptParameterUse(code: string): ScriptParameterUse | undefined;
|
|
10
|
+
/** The top-level output names an `outputs` schema declares, or undefined when its shape isn't a plain object. */
|
|
11
|
+
export declare function declaredScriptOutputs(outputSchema: unknown): readonly string[] | undefined;
|
|
12
|
+
/** Advisory messages for one executeScript task. */
|
|
13
|
+
export declare function scriptLintFindings(taskName: string, code: unknown, inputs: unknown, outputSchema: unknown): string[];
|