@erxes/api-shared 0.0.0-stage → 3.2.19-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +672 -0
- package/core-modules/dist/erxes-api-shared-core-modules.cjs.d.ts +2 -0
- package/core-modules/dist/erxes-api-shared-core-modules.cjs.dev.js +6685 -0
- package/core-modules/dist/erxes-api-shared-core-modules.cjs.js +7 -0
- package/core-modules/dist/erxes-api-shared-core-modules.cjs.prod.js +6685 -0
- package/core-modules/dist/erxes-api-shared-core-modules.esm.js +6298 -0
- package/core-modules/package.json +5 -0
- package/core-types/dist/erxes-api-shared-core-types.cjs.d.ts +2 -0
- package/core-types/dist/erxes-api-shared-core-types.cjs.dev.js +12 -0
- package/core-types/dist/erxes-api-shared-core-types.cjs.js +7 -0
- package/core-types/dist/erxes-api-shared-core-types.cjs.prod.js +12 -0
- package/core-types/dist/erxes-api-shared-core-types.esm.js +8 -0
- package/core-types/package.json +5 -0
- package/dist/declarations/src/core-modules/approval/approvalChangeTypes.d.ts +15 -0
- package/dist/declarations/src/core-modules/approval/approvalChangeTypes.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/approval/checkApprovalLock.d.ts +7 -0
- package/dist/declarations/src/core-modules/approval/checkApprovalLock.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/approval/constants.d.ts +37 -0
- package/dist/declarations/src/core-modules/approval/constants.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/approval/index.d.ts +7 -0
- package/dist/declarations/src/core-modules/approval/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/approval/initApproval.d.ts +9 -0
- package/dist/declarations/src/core-modules/approval/initApproval.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/approval/types.d.ts +164 -0
- package/dist/declarations/src/core-modules/approval/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/approval/zodSchemas.d.ts +125 -0
- package/dist/declarations/src/core-modules/approval/zodSchemas.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/apps/@types/app.d.ts +15 -0
- package/dist/declarations/src/core-modules/apps/@types/app.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/apps/db/definitions/apps.d.ts +13 -0
- package/dist/declarations/src/core-modules/apps/db/definitions/apps.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/apps/index.d.ts +3 -0
- package/dist/declarations/src/core-modules/apps/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/actionErrorPolicy.d.ts +68 -0
- package/dist/declarations/src/core-modules/automations/actionErrorPolicy.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/actionOutcome.d.ts +51 -0
- package/dist/declarations/src/core-modules/automations/actionOutcome.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/constants.d.ts +101 -0
- package/dist/declarations/src/core-modules/automations/constants.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/definitions/aiAgents.d.ts +141 -0
- package/dist/declarations/src/core-modules/automations/definitions/aiAgents.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/definitions/automations.d.ts +868 -0
- package/dist/declarations/src/core-modules/automations/definitions/automations.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/definitions/executions.d.ts +316 -0
- package/dist/declarations/src/core-modules/automations/definitions/executions.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/definitions/index.d.ts +4 -0
- package/dist/declarations/src/core-modules/automations/definitions/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/index.d.ts +14 -0
- package/dist/declarations/src/core-modules/automations/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/outputResolvers.d.ts +67 -0
- package/dist/declarations/src/core-modules/automations/outputResolvers.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/reEnrollment.d.ts +23 -0
- package/dist/declarations/src/core-modules/automations/reEnrollment.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/segmentMembership.d.ts +19 -0
- package/dist/declarations/src/core-modules/automations/segmentMembership.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/sendAutomationMessage.d.ts +51 -0
- package/dist/declarations/src/core-modules/automations/sendAutomationMessage.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/setupAutomationProducers.d.ts +4 -0
- package/dist/declarations/src/core-modules/automations/setupAutomationProducers.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/typeUtils.d.ts +2 -0
- package/dist/declarations/src/core-modules/automations/typeUtils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/types.d.ts +474 -0
- package/dist/declarations/src/core-modules/automations/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/utils.d.ts +38 -0
- package/dist/declarations/src/core-modules/automations/utils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/workflowValidation.d.ts +3 -0
- package/dist/declarations/src/core-modules/automations/workflowValidation.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/automations/zodTypes.d.ts +2366 -0
- package/dist/declarations/src/core-modules/automations/zodTypes.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/client-portals/definitions/clientPortal.d.ts +375 -0
- package/dist/declarations/src/core-modules/client-portals/definitions/clientPortal.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/client-portals/definitions/comment.d.ts +53 -0
- package/dist/declarations/src/core-modules/client-portals/definitions/comment.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/client-portals/definitions/cpNotification.d.ts +110 -0
- package/dist/declarations/src/core-modules/client-portals/definitions/cpNotification.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/client-portals/definitions/cpUser.d.ts +828 -0
- package/dist/declarations/src/core-modules/client-portals/definitions/cpUser.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/client-portals/index.d.ts +5 -0
- package/dist/declarations/src/core-modules/client-portals/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/db/definitions/common.d.ts +77 -0
- package/dist/declarations/src/core-modules/common/db/definitions/common.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/createEventHandlers.d.ts +8 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/createEventHandlers.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/generateEventHandlers.d.ts +4 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/generateEventHandlers.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/index.d.ts +5 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/runtimeContext.d.ts +9 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/runtimeContext.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/schemas.d.ts +82 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/schemas.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/types.d.ts +87 -0
- package/dist/declarations/src/core-modules/common/eventHandlers/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/index.d.ts +5 -0
- package/dist/declarations/src/core-modules/common/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/references/getRecordReferenceFields.d.ts +57 -0
- package/dist/declarations/src/core-modules/common/references/getRecordReferenceFields.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/references/index.d.ts +6 -0
- package/dist/declarations/src/core-modules/common/references/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/references/initRecordReferences.d.ts +4 -0
- package/dist/declarations/src/core-modules/common/references/initRecordReferences.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/references/resolveRecordReferencePlaceholders.d.ts +12 -0
- package/dist/declarations/src/core-modules/common/references/resolveRecordReferencePlaceholders.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/references/resolveRecordReferenceValue.d.ts +6 -0
- package/dist/declarations/src/core-modules/common/references/resolveRecordReferenceValue.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/references/types.d.ts +63 -0
- package/dist/declarations/src/core-modules/common/references/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/common/routeToModuleProducer.d.ts +55 -0
- package/dist/declarations/src/core-modules/common/routeToModuleProducer.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/email-content/blocksToHtml.d.ts +72 -0
- package/dist/declarations/src/core-modules/email-content/blocksToHtml.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/email-content/constants.d.ts +5 -0
- package/dist/declarations/src/core-modules/email-content/constants.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/email-content/emailFooter.d.ts +5 -0
- package/dist/declarations/src/core-modules/email-content/emailFooter.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/email-content/expandRepeatRows.d.ts +9 -0
- package/dist/declarations/src/core-modules/email-content/expandRepeatRows.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/email-content/index.d.ts +9 -0
- package/dist/declarations/src/core-modules/email-content/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/email-content/renderEmailContent.d.ts +19 -0
- package/dist/declarations/src/core-modules/email-content/renderEmailContent.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/email-content/replacePlaceholders.d.ts +36 -0
- package/dist/declarations/src/core-modules/email-content/replacePlaceholders.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/email-content/types.d.ts +48 -0
- package/dist/declarations/src/core-modules/email-content/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/email-content/unresolvedPlaceholders.d.ts +4 -0
- package/dist/declarations/src/core-modules/email-content/unresolvedPlaceholders.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/forms/index.d.ts +3 -0
- package/dist/declarations/src/core-modules/forms/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/forms/types.d.ts +55 -0
- package/dist/declarations/src/core-modules/forms/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/forms/utils.d.ts +4 -0
- package/dist/declarations/src/core-modules/forms/utils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/import-export/index.d.ts +8 -0
- package/dist/declarations/src/core-modules/import-export/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/import-export/types.d.ts +181 -0
- package/dist/declarations/src/core-modules/import-export/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/import-export/utils/exportCursor.d.ts +14 -0
- package/dist/declarations/src/core-modules/import-export/utils/exportCursor.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/import-export/utils/headerMatcher.d.ts +32 -0
- package/dist/declarations/src/core-modules/import-export/utils/headerMatcher.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/import-export/utils/importExportRuntime.d.ts +32 -0
- package/dist/declarations/src/core-modules/import-export/utils/importExportRuntime.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/import-export/utils/importUtils.d.ts +25 -0
- package/dist/declarations/src/core-modules/import-export/utils/importUtils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/import-export/worker.d.ts +8 -0
- package/dist/declarations/src/core-modules/import-export/worker.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/import-export/zodSchemas.d.ts +111 -0
- package/dist/declarations/src/core-modules/import-export/zodSchemas.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/index.d.ts +16 -0
- package/dist/declarations/src/core-modules/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/activityLog/builder.d.ts +3 -0
- package/dist/declarations/src/core-modules/logs/activityLog/builder.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/activityLog/index.d.ts +5 -0
- package/dist/declarations/src/core-modules/logs/activityLog/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/activityLog/sharedBuilders.d.ts +18 -0
- package/dist/declarations/src/core-modules/logs/activityLog/sharedBuilders.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/activityLog/types.d.ts +21 -0
- package/dist/declarations/src/core-modules/logs/activityLog/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/activityLog/utils.d.ts +10 -0
- package/dist/declarations/src/core-modules/logs/activityLog/utils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/activityLogUtils.d.ts +72 -0
- package/dist/declarations/src/core-modules/logs/activityLogUtils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/definitions/activityLog.d.ts +84 -0
- package/dist/declarations/src/core-modules/logs/definitions/activityLog.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/definitions/logs.d.ts +39 -0
- package/dist/declarations/src/core-modules/logs/definitions/logs.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/index.d.ts +6 -0
- package/dist/declarations/src/core-modules/logs/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/logs/types.d.ts +15 -0
- package/dist/declarations/src/core-modules/logs/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/notifications/definitions/emailAddresses.d.ts +73 -0
- package/dist/declarations/src/core-modules/notifications/definitions/emailAddresses.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/notifications/definitions/emailDeliveries.d.ts +115 -0
- package/dist/declarations/src/core-modules/notifications/definitions/emailDeliveries.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/notifications/definitions/emailRamp.d.ts +65 -0
- package/dist/declarations/src/core-modules/notifications/definitions/emailRamp.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/notifications/definitions/emailSenders.d.ts +58 -0
- package/dist/declarations/src/core-modules/notifications/definitions/emailSenders.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/notifications/definitions/notificationSettings.d.ts +66 -0
- package/dist/declarations/src/core-modules/notifications/definitions/notificationSettings.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/notifications/definitions/notifications.d.ts +89 -0
- package/dist/declarations/src/core-modules/notifications/definitions/notifications.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/notifications/index.d.ts +8 -0
- package/dist/declarations/src/core-modules/notifications/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/notifications/utils.d.ts +85 -0
- package/dist/declarations/src/core-modules/notifications/utils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/permissions/db/definitions/permissions.d.ts +60 -0
- package/dist/declarations/src/core-modules/permissions/db/definitions/permissions.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/permissions/index.d.ts +4 -0
- package/dist/declarations/src/core-modules/permissions/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/permissions/user-actions-map.d.ts +4 -0
- package/dist/declarations/src/core-modules/permissions/user-actions-map.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/permissions/utils.d.ts +22 -0
- package/dist/declarations/src/core-modules/permissions/utils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/filter.d.ts +5 -0
- package/dist/declarations/src/core-modules/properties/filter.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/importExport.d.ts +18 -0
- package/dist/declarations/src/core-modules/properties/importExport.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/index.d.ts +10 -0
- package/dist/declarations/src/core-modules/properties/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/keys.d.ts +46 -0
- package/dist/declarations/src/core-modules/properties/keys.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/mergeRows.d.ts +8 -0
- package/dist/declarations/src/core-modules/properties/mergeRows.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/operators.d.ts +6 -0
- package/dist/declarations/src/core-modules/properties/operators.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/options.d.ts +10 -0
- package/dist/declarations/src/core-modules/properties/options.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/setupPropertyProducers.d.ts +4 -0
- package/dist/declarations/src/core-modules/properties/setupPropertyProducers.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/types.d.ts +14 -0
- package/dist/declarations/src/core-modules/properties/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/properties/valueUsage.d.ts +56 -0
- package/dist/declarations/src/core-modules/properties/valueUsage.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/dependencies.d.ts +6 -0
- package/dist/declarations/src/core-modules/segments/dependencies.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/evaluate.d.ts +11 -0
- package/dist/declarations/src/core-modules/segments/evaluate.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/evaluateBatch.d.ts +42 -0
- package/dist/declarations/src/core-modules/segments/evaluateBatch.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/evaluateFieldsRouter.d.ts +29 -0
- package/dist/declarations/src/core-modules/segments/evaluateFieldsRouter.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/evaluateOwned.d.ts +27 -0
- package/dist/declarations/src/core-modules/segments/evaluateOwned.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/events.d.ts +45 -0
- package/dist/declarations/src/core-modules/segments/events.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/fieldBuilders.d.ts +35 -0
- package/dist/declarations/src/core-modules/segments/fieldBuilders.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/fieldMeta.d.ts +62 -0
- package/dist/declarations/src/core-modules/segments/fieldMeta.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/fieldRequests.d.ts +33 -0
- package/dist/declarations/src/core-modules/segments/fieldRequests.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/fingerprint.d.ts +6 -0
- package/dist/declarations/src/core-modules/segments/fingerprint.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/index.d.ts +31 -0
- package/dist/declarations/src/core-modules/segments/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/joinChanges.d.ts +11 -0
- package/dist/declarations/src/core-modules/segments/joinChanges.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/materialized.d.ts +9 -0
- package/dist/declarations/src/core-modules/segments/materialized.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/measureRelations.d.ts +18 -0
- package/dist/declarations/src/core-modules/segments/measureRelations.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/memberQuery.d.ts +13 -0
- package/dist/declarations/src/core-modules/segments/memberQuery.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/membership.d.ts +24 -0
- package/dist/declarations/src/core-modules/segments/membership.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/mongoFilter.d.ts +15 -0
- package/dist/declarations/src/core-modules/segments/mongoFilter.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/nodeRefs.d.ts +5 -0
- package/dist/declarations/src/core-modules/segments/nodeRefs.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/nodes.d.ts +42 -0
- package/dist/declarations/src/core-modules/segments/nodes.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/operators.d.ts +46 -0
- package/dist/declarations/src/core-modules/segments/operators.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/ownedSource.d.ts +7 -0
- package/dist/declarations/src/core-modules/segments/ownedSource.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/plan.d.ts +35 -0
- package/dist/declarations/src/core-modules/segments/plan.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/relationRegistry.d.ts +33 -0
- package/dist/declarations/src/core-modules/segments/relationRegistry.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/setupSegmentProducers.d.ts +4 -0
- package/dist/declarations/src/core-modules/segments/setupSegmentProducers.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/subjectsReachedBy.d.ts +11 -0
- package/dist/declarations/src/core-modules/segments/subjectsReachedBy.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/timeZone.d.ts +2 -0
- package/dist/declarations/src/core-modules/segments/timeZone.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/types.d.ts +67 -0
- package/dist/declarations/src/core-modules/segments/types.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/utils.d.ts +4 -0
- package/dist/declarations/src/core-modules/segments/utils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/walkNodes.d.ts +9 -0
- package/dist/declarations/src/core-modules/segments/walkNodes.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/zodSchemas.d.ts +532 -0
- package/dist/declarations/src/core-modules/segments/zodSchemas.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/segments/zonedTime.d.ts +25 -0
- package/dist/declarations/src/core-modules/segments/zonedTime.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/templates/index.d.ts +2 -0
- package/dist/declarations/src/core-modules/templates/index.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/templates/utils.d.ts +11 -0
- package/dist/declarations/src/core-modules/templates/utils.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/users/constants.d.ts +114 -0
- package/dist/declarations/src/core-modules/users/constants.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/users/db/definitions/users.d.ts +24 -0
- package/dist/declarations/src/core-modules/users/db/definitions/users.d.ts.map +1 -0
- package/dist/declarations/src/core-modules/users/index.d.ts +3 -0
- package/dist/declarations/src/core-modules/users/index.d.ts.map +1 -0
- package/dist/declarations/src/core-types/common.d.ts +149 -0
- package/dist/declarations/src/core-types/common.d.ts.map +1 -0
- package/dist/declarations/src/core-types/index.d.ts +20 -0
- package/dist/declarations/src/core-types/index.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/app/app.d.ts +12 -0
- package/dist/declarations/src/core-types/modules/app/app.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/automations/automations.d.ts +19 -0
- package/dist/declarations/src/core-types/modules/automations/automations.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/contacts/company.d.ts +53 -0
- package/dist/declarations/src/core-types/modules/contacts/company.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/contacts/contacts-common.d.ts +32 -0
- package/dist/declarations/src/core-types/modules/contacts/contacts-common.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/contacts/customer.d.ts +74 -0
- package/dist/declarations/src/core-types/modules/contacts/customer.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/emailTemplates/emailTemplate.d.ts +18 -0
- package/dist/declarations/src/core-types/modules/emailTemplates/emailTemplate.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/logs/logs.d.ts +28 -0
- package/dist/declarations/src/core-types/modules/logs/logs.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/permissions/permission.d.ts +56 -0
- package/dist/declarations/src/core-types/modules/permissions/permission.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/permissions/role.d.ts +21 -0
- package/dist/declarations/src/core-types/modules/permissions/role.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/products/product.d.ts +76 -0
- package/dist/declarations/src/core-types/modules/products/product.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/products/productCategory.d.ts +26 -0
- package/dist/declarations/src/core-types/modules/products/productCategory.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/products/productConfig.d.ts +9 -0
- package/dist/declarations/src/core-types/modules/products/productConfig.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/products/uom.d.ts +11 -0
- package/dist/declarations/src/core-types/modules/products/uom.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/relations/relations.d.ts +13 -0
- package/dist/declarations/src/core-types/modules/relations/relations.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/saas/organization.d.ts +8 -0
- package/dist/declarations/src/core-types/modules/saas/organization.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/tags/tag.d.ts +16 -0
- package/dist/declarations/src/core-types/modules/tags/tag.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/team-member/structure.d.ts +19 -0
- package/dist/declarations/src/core-types/modules/team-member/structure.d.ts.map +1 -0
- package/dist/declarations/src/core-types/modules/team-member/user.d.ts +90 -0
- package/dist/declarations/src/core-types/modules/team-member/user.d.ts.map +1 -0
- package/dist/declarations/src/index.d.ts +3 -0
- package/dist/declarations/src/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/agent-tools/auth.d.ts +18 -0
- package/dist/declarations/src/utils/agent-tools/auth.d.ts.map +1 -0
- package/dist/declarations/src/utils/agent-tools/endpoints.d.ts +16 -0
- package/dist/declarations/src/utils/agent-tools/endpoints.d.ts.map +1 -0
- package/dist/declarations/src/utils/agent-tools/index.d.ts +6 -0
- package/dist/declarations/src/utils/agent-tools/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/agent-tools/manifest.d.ts +11 -0
- package/dist/declarations/src/utils/agent-tools/manifest.d.ts.map +1 -0
- package/dist/declarations/src/utils/agent-tools/responseLimit.d.ts +26 -0
- package/dist/declarations/src/utils/agent-tools/responseLimit.d.ts.map +1 -0
- package/dist/declarations/src/utils/agent-tools/types.d.ts +48 -0
- package/dist/declarations/src/utils/agent-tools/types.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/beforeResolvers.d.ts +41 -0
- package/dist/declarations/src/utils/apollo/beforeResolvers.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/commonTypeDefs.d.ts +7 -0
- package/dist/declarations/src/utils/apollo/commonTypeDefs.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/constants.d.ts +3 -0
- package/dist/declarations/src/utils/apollo/constants.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/customScalars.d.ts +6 -0
- package/dist/declarations/src/utils/apollo/customScalars.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/expectedErrorPlugin.d.ts +11 -0
- package/dist/declarations/src/utils/apollo/expectedErrorPlugin.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/index.d.ts +10 -0
- package/dist/declarations/src/utils/apollo/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/runBeforeResolvers.d.ts +27 -0
- package/dist/declarations/src/utils/apollo/runBeforeResolvers.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/utils.d.ts +5 -0
- package/dist/declarations/src/utils/apollo/utils.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/wrapperMutations.d.ts +8 -0
- package/dist/declarations/src/utils/apollo/wrapperMutations.d.ts.map +1 -0
- package/dist/declarations/src/utils/apollo/wrapperResolvers.d.ts +8 -0
- package/dist/declarations/src/utils/apollo/wrapperResolvers.d.ts.map +1 -0
- package/dist/declarations/src/utils/bulkUtils.d.ts +7 -0
- package/dist/declarations/src/utils/bulkUtils.d.ts.map +1 -0
- package/dist/declarations/src/utils/constants.d.ts +40 -0
- package/dist/declarations/src/utils/constants.d.ts.map +1 -0
- package/dist/declarations/src/utils/editor.d.ts +45 -0
- package/dist/declarations/src/utils/editor.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/address.d.ts +10 -0
- package/dist/declarations/src/utils/email/address.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/attachments.d.ts +12 -0
- package/dist/declarations/src/utils/email/attachments.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/config.d.ts +10 -0
- package/dist/declarations/src/utils/email/config.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/constants.d.ts +6 -0
- package/dist/declarations/src/utils/email/constants.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/index.d.ts +12 -0
- package/dist/declarations/src/utils/email/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/providers/sendgrid.d.ts +17 -0
- package/dist/declarations/src/utils/email/providers/sendgrid.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/providers/sendgridEvents.d.ts +18 -0
- package/dist/declarations/src/utils/email/providers/sendgridEvents.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/providers/ses.d.ts +19 -0
- package/dist/declarations/src/utils/email/providers/ses.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/providers/smtp.d.ts +14 -0
- package/dist/declarations/src/utils/email/providers/smtp.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/resolveProvider.d.ts +6 -0
- package/dist/declarations/src/utils/email/resolveProvider.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/service.d.ts +50 -0
- package/dist/declarations/src/utils/email/service.d.ts.map +1 -0
- package/dist/declarations/src/utils/email/types.d.ts +87 -0
- package/dist/declarations/src/utils/email/types.d.ts.map +1 -0
- package/dist/declarations/src/utils/errorClassifier.d.ts +56 -0
- package/dist/declarations/src/utils/errorClassifier.d.ts.map +1 -0
- package/dist/declarations/src/utils/file/read.d.ts +14 -0
- package/dist/declarations/src/utils/file/read.d.ts.map +1 -0
- package/dist/declarations/src/utils/file/upload.d.ts +10 -0
- package/dist/declarations/src/utils/file/upload.d.ts.map +1 -0
- package/dist/declarations/src/utils/graphqlPubSub.d.ts +3 -0
- package/dist/declarations/src/utils/graphqlPubSub.d.ts.map +1 -0
- package/dist/declarations/src/utils/headers/get-hostname.d.ts +5 -0
- package/dist/declarations/src/utils/headers/get-hostname.d.ts.map +1 -0
- package/dist/declarations/src/utils/headers/index.d.ts +5 -0
- package/dist/declarations/src/utils/headers/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/headers/sanitize.d.ts +3 -0
- package/dist/declarations/src/utils/headers/sanitize.d.ts.map +1 -0
- package/dist/declarations/src/utils/headers/subdomain.d.ts +4 -0
- package/dist/declarations/src/utils/headers/subdomain.d.ts.map +1 -0
- package/dist/declarations/src/utils/headers/user.d.ts +14 -0
- package/dist/declarations/src/utils/headers/user.d.ts.map +1 -0
- package/dist/declarations/src/utils/index.d.ts +28 -0
- package/dist/declarations/src/utils/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/knowledge.d.ts +50 -0
- package/dist/declarations/src/utils/knowledge.d.ts.map +1 -0
- package/dist/declarations/src/utils/logs/index.d.ts +103 -0
- package/dist/declarations/src/utils/logs/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/mongo/cursor-util.d.ts +41 -0
- package/dist/declarations/src/utils/mongo/cursor-util.d.ts.map +1 -0
- package/dist/declarations/src/utils/mongo/generate-models.d.ts +4 -0
- package/dist/declarations/src/utils/mongo/generate-models.d.ts.map +1 -0
- package/dist/declarations/src/utils/mongo/index.d.ts +6 -0
- package/dist/declarations/src/utils/mongo/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/mongo/mongo-connection.d.ts +5 -0
- package/dist/declarations/src/utils/mongo/mongo-connection.d.ts.map +1 -0
- package/dist/declarations/src/utils/mongo/mongoose-types.d.ts +22 -0
- package/dist/declarations/src/utils/mongo/mongoose-types.d.ts.map +1 -0
- package/dist/declarations/src/utils/mongo/mongoose-utils.d.ts +30 -0
- package/dist/declarations/src/utils/mongo/mongoose-utils.d.ts.map +1 -0
- package/dist/declarations/src/utils/mongo/search-tokens.d.ts +21 -0
- package/dist/declarations/src/utils/mongo/search-tokens.d.ts.map +1 -0
- package/dist/declarations/src/utils/mq-worker.d.ts +19 -0
- package/dist/declarations/src/utils/mq-worker.d.ts.map +1 -0
- package/dist/declarations/src/utils/random.d.ts +3 -0
- package/dist/declarations/src/utils/random.d.ts.map +1 -0
- package/dist/declarations/src/utils/redis.d.ts +4 -0
- package/dist/declarations/src/utils/redis.d.ts.map +1 -0
- package/dist/declarations/src/utils/saas/index.d.ts +3 -0
- package/dist/declarations/src/utils/saas/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/saas/saas-mongo-connection.d.ts +59 -0
- package/dist/declarations/src/utils/saas/saas-mongo-connection.d.ts.map +1 -0
- package/dist/declarations/src/utils/saas/types.d.ts +96 -0
- package/dist/declarations/src/utils/saas/types.d.ts.map +1 -0
- package/dist/declarations/src/utils/sanitize.d.ts +3 -0
- package/dist/declarations/src/utils/sanitize.d.ts.map +1 -0
- package/dist/declarations/src/utils/sentry-init.d.ts +15 -0
- package/dist/declarations/src/utils/sentry-init.d.ts.map +1 -0
- package/dist/declarations/src/utils/sentry-instrument.d.ts +2 -0
- package/dist/declarations/src/utils/sentry-instrument.d.ts.map +1 -0
- package/dist/declarations/src/utils/serializablePayload.d.ts +11 -0
- package/dist/declarations/src/utils/serializablePayload.d.ts.map +1 -0
- package/dist/declarations/src/utils/service-discovery.d.ts +25 -0
- package/dist/declarations/src/utils/service-discovery.d.ts.map +1 -0
- package/dist/declarations/src/utils/start-plugin.d.ts +85 -0
- package/dist/declarations/src/utils/start-plugin.d.ts.map +1 -0
- package/dist/declarations/src/utils/string.d.ts +82 -0
- package/dist/declarations/src/utils/string.d.ts.map +1 -0
- package/dist/declarations/src/utils/trpc/index.d.ts +79 -0
- package/dist/declarations/src/utils/trpc/index.d.ts.map +1 -0
- package/dist/declarations/src/utils/trpc/sendCoreModuleProducer.d.ts +53 -0
- package/dist/declarations/src/utils/trpc/sendCoreModuleProducer.d.ts.map +1 -0
- package/dist/declarations/src/utils/utils.d.ts +69 -0
- package/dist/declarations/src/utils/utils.d.ts.map +1 -0
- package/dist/erxes-api-shared.cjs.d.ts +3 -0
- package/dist/erxes-api-shared.cjs.dev.js +7 -0
- package/dist/erxes-api-shared.cjs.js +7 -0
- package/dist/erxes-api-shared.cjs.prod.js +7 -0
- package/dist/erxes-api-shared.esm.js +3 -0
- package/dist/start-plugin-576e707d.cjs.prod.js +23223 -0
- package/dist/start-plugin-6e76556c.esm.js +22742 -0
- package/dist/start-plugin-89fa2bd2.cjs.dev.js +23225 -0
- package/package.json +105 -4
- package/src/common-modules/payment/worker.ts +53 -0
- package/src/core-modules/approval/approvalChangeTypes.ts +31 -0
- package/src/core-modules/approval/checkApprovalLock.ts +85 -0
- package/src/core-modules/approval/constants.ts +45 -0
- package/src/core-modules/approval/index.ts +6 -0
- package/src/core-modules/approval/initApproval.ts +59 -0
- package/src/core-modules/approval/types.ts +206 -0
- package/src/core-modules/approval/zodSchemas.ts +55 -0
- package/src/core-modules/apps/@types/app.ts +15 -0
- package/src/core-modules/apps/db/definitions/apps.ts +30 -0
- package/src/core-modules/apps/index.ts +2 -0
- package/src/core-modules/automations/actionErrorPolicy.test.ts +125 -0
- package/src/core-modules/automations/actionErrorPolicy.ts +162 -0
- package/src/core-modules/automations/actionInputs.test.ts +70 -0
- package/src/core-modules/automations/actionOutcome.test.ts +87 -0
- package/src/core-modules/automations/actionOutcome.ts +128 -0
- package/src/core-modules/automations/constants.ts +181 -0
- package/src/core-modules/automations/definitions/aiAgents.ts +343 -0
- package/src/core-modules/automations/definitions/automations.ts +207 -0
- package/src/core-modules/automations/definitions/executions.ts +190 -0
- package/src/core-modules/automations/definitions/index.ts +3 -0
- package/src/core-modules/automations/getValueByPath.test.ts +49 -0
- package/src/core-modules/automations/index.ts +13 -0
- package/src/core-modules/automations/outputResolvers.test.ts +97 -0
- package/src/core-modules/automations/outputResolvers.ts +1238 -0
- package/src/core-modules/automations/reEnrollment.ts +34 -0
- package/src/core-modules/automations/segmentMembership.ts +34 -0
- package/src/core-modules/automations/sendAutomationMessage.ts +219 -0
- package/src/core-modules/automations/setPropertyOutcome.test.ts +105 -0
- package/src/core-modules/automations/setPropertyRows.test.ts +61 -0
- package/src/core-modules/automations/setupAutomationProducers.ts +187 -0
- package/src/core-modules/automations/typeUtils.ts +3 -0
- package/src/core-modules/automations/types.ts +577 -0
- package/src/core-modules/automations/utils.ts +1128 -0
- package/src/core-modules/automations/workflowValidation.ts +32 -0
- package/src/core-modules/automations/zodTypes.ts +221 -0
- package/src/core-modules/client-portals/definitions/clientPortal.ts +230 -0
- package/src/core-modules/client-portals/definitions/comment.ts +26 -0
- package/src/core-modules/client-portals/definitions/cpNotification.ts +112 -0
- package/src/core-modules/client-portals/definitions/cpUser.ts +236 -0
- package/src/core-modules/client-portals/index.ts +4 -0
- package/src/core-modules/common/db/definitions/common.ts +43 -0
- package/src/core-modules/common/eventHandlers/createEventHandlers.ts +236 -0
- package/src/core-modules/common/eventHandlers/generateEventHandlers.ts +37 -0
- package/src/core-modules/common/eventHandlers/index.ts +11 -0
- package/src/core-modules/common/eventHandlers/runtimeContext.ts +36 -0
- package/src/core-modules/common/eventHandlers/schemas.ts +53 -0
- package/src/core-modules/common/eventHandlers/types.ts +97 -0
- package/src/core-modules/common/eventHandlers/utils.ts +113 -0
- package/src/core-modules/common/index.ts +4 -0
- package/src/core-modules/common/references/fetchRecordReferenceTargets.ts +43 -0
- package/src/core-modules/common/references/getRecordReferenceFields.ts +243 -0
- package/src/core-modules/common/references/index.ts +9 -0
- package/src/core-modules/common/references/initRecordReferences.ts +84 -0
- package/src/core-modules/common/references/normalizeRecordReferenceConfig.ts +59 -0
- package/src/core-modules/common/references/resolveRecordReferencePath.ts +473 -0
- package/src/core-modules/common/references/resolveRecordReferencePlaceholders.ts +173 -0
- package/src/core-modules/common/references/resolveRecordReferenceValue.ts +41 -0
- package/src/core-modules/common/references/resolveRecordRelationIds.ts +57 -0
- package/src/core-modules/common/references/types.ts +78 -0
- package/src/core-modules/common/references/utils.ts +60 -0
- package/src/core-modules/common/references/zodInputs.ts +13 -0
- package/src/core-modules/common/routeToModuleProducer.ts +118 -0
- package/src/core-modules/email-content/blocksToHtml.ts +551 -0
- package/src/core-modules/email-content/constants.ts +4 -0
- package/src/core-modules/email-content/emailFooter.ts +17 -0
- package/src/core-modules/email-content/expandRepeatRows.test.ts +36 -0
- package/src/core-modules/email-content/expandRepeatRows.ts +59 -0
- package/src/core-modules/email-content/index.ts +8 -0
- package/src/core-modules/email-content/renderEmailContent.ts +88 -0
- package/src/core-modules/email-content/replacePlaceholders.ts +143 -0
- package/src/core-modules/email-content/types.ts +49 -0
- package/src/core-modules/email-content/unresolvedPlaceholders.ts +27 -0
- package/src/core-modules/forms/index.ts +2 -0
- package/src/core-modules/forms/types.ts +86 -0
- package/src/core-modules/forms/utils.ts +34 -0
- package/src/core-modules/import-export/index.ts +7 -0
- package/src/core-modules/import-export/types.ts +204 -0
- package/src/core-modules/import-export/utils/createCoreImportClient.ts +131 -0
- package/src/core-modules/import-export/utils/exportBatchProcess.ts +560 -0
- package/src/core-modules/import-export/utils/exportCursor.ts +47 -0
- package/src/core-modules/import-export/utils/headerMatcher.test.ts +90 -0
- package/src/core-modules/import-export/utils/headerMatcher.ts +229 -0
- package/src/core-modules/import-export/utils/importBatchProcess.ts +780 -0
- package/src/core-modules/import-export/utils/importExportError.ts +71 -0
- package/src/core-modules/import-export/utils/importExportRuntime.ts +96 -0
- package/src/core-modules/import-export/utils/importUtils.ts +59 -0
- package/src/core-modules/import-export/utils/progressUpdate.ts +25 -0
- package/src/core-modules/import-export/utils/tempWorkspace.ts +34 -0
- package/src/core-modules/import-export/worker.ts +215 -0
- package/src/core-modules/import-export/zodSchemas.ts +63 -0
- package/src/core-modules/index.ts +15 -0
- package/src/core-modules/logs/activityLog/builder.ts +232 -0
- package/src/core-modules/logs/activityLog/index.ts +4 -0
- package/src/core-modules/logs/activityLog/sharedBuilders.ts +95 -0
- package/src/core-modules/logs/activityLog/types.ts +26 -0
- package/src/core-modules/logs/activityLog/utils.ts +61 -0
- package/src/core-modules/logs/activityLogUtils.ts +677 -0
- package/src/core-modules/logs/definitions/activityLog.ts +71 -0
- package/src/core-modules/logs/definitions/logs.ts +49 -0
- package/src/core-modules/logs/index.ts +5 -0
- package/src/core-modules/logs/types.ts +16 -0
- package/src/core-modules/notifications/definitions/emailAddresses.ts +105 -0
- package/src/core-modules/notifications/definitions/emailDeliveries.ts +188 -0
- package/src/core-modules/notifications/definitions/emailRamp.ts +83 -0
- package/src/core-modules/notifications/definitions/emailSenders.ts +84 -0
- package/src/core-modules/notifications/definitions/notificationConfigs.ts +110 -0
- package/src/core-modules/notifications/definitions/notificationSettings.ts +67 -0
- package/src/core-modules/notifications/definitions/notifications.ts +130 -0
- package/src/core-modules/notifications/emailUtils.ts +88 -0
- package/src/core-modules/notifications/index.ts +7 -0
- package/src/core-modules/notifications/utils.ts +143 -0
- package/src/core-modules/permissions/db/definitions/permissions.ts +82 -0
- package/src/core-modules/permissions/index.ts +3 -0
- package/src/core-modules/permissions/oauth-scopes.test.ts +102 -0
- package/src/core-modules/permissions/user-actions-map.ts +170 -0
- package/src/core-modules/permissions/utils.ts +317 -0
- package/src/core-modules/properties/README.md +161 -0
- package/src/core-modules/properties/filter.test.ts +74 -0
- package/src/core-modules/properties/filter.ts +156 -0
- package/src/core-modules/properties/importExport.ts +159 -0
- package/src/core-modules/properties/index.ts +9 -0
- package/src/core-modules/properties/keys.test.ts +71 -0
- package/src/core-modules/properties/keys.ts +128 -0
- package/src/core-modules/properties/mergePropertyData.test.ts +65 -0
- package/src/core-modules/properties/mergeRows.ts +93 -0
- package/src/core-modules/properties/operators.ts +91 -0
- package/src/core-modules/properties/options.test.ts +119 -0
- package/src/core-modules/properties/options.ts +55 -0
- package/src/core-modules/properties/setupPropertyProducers.ts +32 -0
- package/src/core-modules/properties/types.ts +31 -0
- package/src/core-modules/properties/valueUsage.test.ts +158 -0
- package/src/core-modules/properties/valueUsage.ts +153 -0
- package/src/core-modules/segments/anniversary.test.ts +122 -0
- package/src/core-modules/segments/dependencies.test.ts +173 -0
- package/src/core-modules/segments/dependencies.ts +70 -0
- package/src/core-modules/segments/evaluate.test.ts +339 -0
- package/src/core-modules/segments/evaluate.ts +388 -0
- package/src/core-modules/segments/evaluateBatch.test.ts +233 -0
- package/src/core-modules/segments/evaluateBatch.ts +263 -0
- package/src/core-modules/segments/evaluateFieldsRouter.test.ts +148 -0
- package/src/core-modules/segments/evaluateFieldsRouter.ts +94 -0
- package/src/core-modules/segments/evaluateOwned.ts +162 -0
- package/src/core-modules/segments/events.ts +142 -0
- package/src/core-modules/segments/fieldBuilders.ts +152 -0
- package/src/core-modules/segments/fieldMeta.ts +96 -0
- package/src/core-modules/segments/fieldRequests.test.ts +302 -0
- package/src/core-modules/segments/fieldRequests.ts +172 -0
- package/src/core-modules/segments/fieldSources.test.ts +99 -0
- package/src/core-modules/segments/fingerprint.test.ts +111 -0
- package/src/core-modules/segments/fingerprint.ts +70 -0
- package/src/core-modules/segments/index.ts +30 -0
- package/src/core-modules/segments/joinChanges.test.ts +96 -0
- package/src/core-modules/segments/joinChanges.ts +67 -0
- package/src/core-modules/segments/materialized.ts +23 -0
- package/src/core-modules/segments/measureRelations.test.ts +222 -0
- package/src/core-modules/segments/measureRelations.ts +322 -0
- package/src/core-modules/segments/memberQuery.test.ts +60 -0
- package/src/core-modules/segments/memberQuery.ts +45 -0
- package/src/core-modules/segments/membership.ts +170 -0
- package/src/core-modules/segments/mongoFilter.test.ts +326 -0
- package/src/core-modules/segments/mongoFilter.ts +355 -0
- package/src/core-modules/segments/nodeRefs.ts +29 -0
- package/src/core-modules/segments/nodes.ts +48 -0
- package/src/core-modules/segments/operators.ts +243 -0
- package/src/core-modules/segments/ownedSource.ts +16 -0
- package/src/core-modules/segments/plan.test.ts +172 -0
- package/src/core-modules/segments/plan.ts +155 -0
- package/src/core-modules/segments/relationRegistry.test.ts +64 -0
- package/src/core-modules/segments/relationRegistry.ts +198 -0
- package/src/core-modules/segments/segmentReference.test.ts +142 -0
- package/src/core-modules/segments/setupSegmentProducers.ts +77 -0
- package/src/core-modules/segments/subjectsReachedBy.ts +70 -0
- package/src/core-modules/segments/timeZone.ts +56 -0
- package/src/core-modules/segments/types.ts +97 -0
- package/src/core-modules/segments/utils.ts +122 -0
- package/src/core-modules/segments/walkNodes.ts +76 -0
- package/src/core-modules/segments/zodSchemas.ts +130 -0
- package/src/core-modules/segments/zonedTime.test.ts +163 -0
- package/src/core-modules/segments/zonedTime.ts +198 -0
- package/src/core-modules/templates/index.ts +1 -0
- package/src/core-modules/templates/utils.ts +91 -0
- package/src/core-modules/users/constants.ts +318 -0
- package/src/core-modules/users/db/definitions/users.ts +226 -0
- package/src/core-modules/users/index.ts +2 -0
- package/src/core-types/common.ts +183 -0
- package/src/core-types/index.ts +19 -0
- package/src/core-types/modules/app/app.ts +13 -0
- package/src/core-types/modules/automations/automations.ts +23 -0
- package/src/core-types/modules/contacts/company.ts +70 -0
- package/src/core-types/modules/contacts/contacts-common.ts +32 -0
- package/src/core-types/modules/contacts/customer.ts +94 -0
- package/src/core-types/modules/emailTemplates/emailTemplate.ts +19 -0
- package/src/core-types/modules/emailTemplates/index.ts +1 -0
- package/src/core-types/modules/logs/logs.ts +30 -0
- package/src/core-types/modules/permissions/permission.ts +63 -0
- package/src/core-types/modules/permissions/role.ts +24 -0
- package/src/core-types/modules/products/product.ts +100 -0
- package/src/core-types/modules/products/productCategory.ts +27 -0
- package/src/core-types/modules/products/productConfig.ts +10 -0
- package/src/core-types/modules/products/uom.ts +12 -0
- package/src/core-types/modules/relations/relations.ts +14 -0
- package/src/core-types/modules/saas/organization.ts +7 -0
- package/src/core-types/modules/structure/structure.ts +29 -0
- package/src/core-types/modules/tags/tag.ts +17 -0
- package/src/core-types/modules/team-member/structure.ts +23 -0
- package/src/core-types/modules/team-member/user.ts +93 -0
- package/src/index.ts +1 -0
- package/src/utils/agent-tools/auth.ts +129 -0
- package/src/utils/agent-tools/endpoints.ts +274 -0
- package/src/utils/agent-tools/index.ts +5 -0
- package/src/utils/agent-tools/manifest.ts +152 -0
- package/src/utils/agent-tools/responseLimit.test.ts +99 -0
- package/src/utils/agent-tools/responseLimit.ts +66 -0
- package/src/utils/agent-tools/types.ts +52 -0
- package/src/utils/apollo/beforeResolvers.ts +117 -0
- package/src/utils/apollo/commonTypeDefs.ts +78 -0
- package/src/utils/apollo/constants.ts +16 -0
- package/src/utils/apollo/customScalars.ts +69 -0
- package/src/utils/apollo/expectedErrorPlugin.ts +83 -0
- package/src/utils/apollo/index.ts +10 -0
- package/src/utils/apollo/runBeforeResolvers.ts +214 -0
- package/src/utils/apollo/utils.ts +80 -0
- package/src/utils/apollo/wrapperMutations.ts +75 -0
- package/src/utils/apollo/wrapperResolvers.ts +182 -0
- package/src/utils/bulkUtils.ts +62 -0
- package/src/utils/constants.ts +99 -0
- package/src/utils/editor.ts +412 -0
- package/src/utils/email/address.ts +42 -0
- package/src/utils/email/attachments.ts +74 -0
- package/src/utils/email/config.ts +46 -0
- package/src/utils/email/constants.ts +25 -0
- package/src/utils/email/index.ts +11 -0
- package/src/utils/email/providers/sendgrid.ts +280 -0
- package/src/utils/email/providers/sendgridEvents.ts +48 -0
- package/src/utils/email/providers/ses.ts +250 -0
- package/src/utils/email/providers/smtp.ts +99 -0
- package/src/utils/email/resolveProvider.ts +75 -0
- package/src/utils/email/service.ts +192 -0
- package/src/utils/email/types.ts +127 -0
- package/src/utils/errorClassifier.test.ts +231 -0
- package/src/utils/errorClassifier.ts +458 -0
- package/src/utils/file/read.ts +464 -0
- package/src/utils/file/upload.ts +531 -0
- package/src/utils/graphqlPubSub.ts +28 -0
- package/src/utils/headers/get-hostname.ts +18 -0
- package/src/utils/headers/index.ts +4 -0
- package/src/utils/headers/sanitize.ts +9 -0
- package/src/utils/headers/subdomain.ts +13 -0
- package/src/utils/headers/user.test.ts +76 -0
- package/src/utils/headers/user.ts +113 -0
- package/src/utils/index.ts +27 -0
- package/src/utils/knowledge.ts +107 -0
- package/src/utils/logs/index.ts +247 -0
- package/src/utils/mongo/cursor-util.ts +153 -0
- package/src/utils/mongo/generate-models.ts +97 -0
- package/src/utils/mongo/index.ts +5 -0
- package/src/utils/mongo/mongo-connection.ts +42 -0
- package/src/utils/mongo/mongoose-types.ts +26 -0
- package/src/utils/mongo/mongoose-utils.ts +329 -0
- package/src/utils/mongo/search-tokens.ts +193 -0
- package/src/utils/mq-worker.ts +150 -0
- package/src/utils/random.ts +6 -0
- package/src/utils/redis.ts +23 -0
- package/src/utils/saas/constants.ts +32 -0
- package/src/utils/saas/definition.ts +318 -0
- package/src/utils/saas/index.ts +2 -0
- package/src/utils/saas/saas-mongo-connection.ts +595 -0
- package/src/utils/saas/types.ts +107 -0
- package/src/utils/sanitize.ts +73 -0
- package/src/utils/sentry-init.ts +128 -0
- package/src/utils/sentry-instrument.ts +5 -0
- package/src/utils/serializablePayload.test.ts +65 -0
- package/src/utils/serializablePayload.ts +44 -0
- package/src/utils/service-discovery.ts +256 -0
- package/src/utils/start-plugin.ts +482 -0
- package/src/utils/string.ts +159 -0
- package/src/utils/trpc/index.ts +278 -0
- package/src/utils/trpc/sendCoreModuleProducer.ts +146 -0
- package/src/utils/trpc/trpc-setup.ts +91 -0
- package/src/utils/utils.ts +669 -0
- package/utils/dist/erxes-api-shared-utils.cjs.d.ts +2 -0
- package/utils/dist/erxes-api-shared-utils.cjs.dev.js +3066 -0
- package/utils/dist/erxes-api-shared-utils.cjs.js +7 -0
- package/utils/dist/erxes-api-shared-utils.cjs.prod.js +3066 -0
- package/utils/dist/erxes-api-shared-utils.esm.js +2776 -0
- package/utils/package.json +5 -0
- package/README.md +0 -3
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Schema } from 'mongoose';
|
|
2
|
+
import { mongooseField, schemaWrapper } from '../../../../utils';
|
|
3
|
+
export const appSchema = schemaWrapper(
|
|
4
|
+
new Schema({
|
|
5
|
+
_id: mongooseField({ pkey: true }),
|
|
6
|
+
name: mongooseField({ type: String, label: 'App name' }),
|
|
7
|
+
createdAt: mongooseField({
|
|
8
|
+
type: Date,
|
|
9
|
+
label: 'Created at',
|
|
10
|
+
default: new Date(),
|
|
11
|
+
}),
|
|
12
|
+
accessToken: mongooseField({ type: String, label: 'Access token' }),
|
|
13
|
+
refreshToken: mongooseField({
|
|
14
|
+
type: String,
|
|
15
|
+
label: 'Refresh token used to gain access token',
|
|
16
|
+
}),
|
|
17
|
+
isEnabled: mongooseField({ type: Boolean, label: 'Status of the app' }),
|
|
18
|
+
userGroupId: mongooseField({
|
|
19
|
+
type: String,
|
|
20
|
+
label: 'User group id',
|
|
21
|
+
optional: true,
|
|
22
|
+
}),
|
|
23
|
+
expireDate: mongooseField({ type: Date, label: 'Token expire date' }),
|
|
24
|
+
noExpire: mongooseField({ type: Boolean, label: 'noExpire' }),
|
|
25
|
+
allowAllPermission: mongooseField({
|
|
26
|
+
type: Boolean,
|
|
27
|
+
label: 'allowAllPermission',
|
|
28
|
+
}),
|
|
29
|
+
}),
|
|
30
|
+
);
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import {
|
|
2
|
+
actionRetryDelayMs,
|
|
3
|
+
AUTOMATION_RETRY_LIMITS,
|
|
4
|
+
resolveActionBranchTarget,
|
|
5
|
+
resolveActionErrorPolicy,
|
|
6
|
+
} from './actionErrorPolicy';
|
|
7
|
+
|
|
8
|
+
const policy = (errorPolicy: unknown) =>
|
|
9
|
+
resolveActionErrorPolicy({ errorPolicy });
|
|
10
|
+
|
|
11
|
+
describe('resolveActionErrorPolicy', () => {
|
|
12
|
+
it('defaults to today behaviour: no retry, the run fails', () => {
|
|
13
|
+
expect(resolveActionErrorPolicy(undefined)).toEqual({
|
|
14
|
+
attempts: 0,
|
|
15
|
+
delaySeconds: AUTOMATION_RETRY_LIMITS.DEFAULT_DELAY_SECONDS,
|
|
16
|
+
backoff: 'none',
|
|
17
|
+
onError: 'fail',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
expect(resolveActionErrorPolicy({ url: 'https://example.com' })).toEqual(
|
|
21
|
+
resolveActionErrorPolicy(undefined),
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('reads a configured policy', () => {
|
|
26
|
+
expect(
|
|
27
|
+
policy({
|
|
28
|
+
retry: { attempts: 3, delaySeconds: 30, backoff: 'exponential' },
|
|
29
|
+
onError: 'branch',
|
|
30
|
+
}),
|
|
31
|
+
).toEqual({
|
|
32
|
+
attempts: 3,
|
|
33
|
+
delaySeconds: 30,
|
|
34
|
+
backoff: 'exponential',
|
|
35
|
+
onError: 'branch',
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('never lets a hand-edited automation exceed the ceilings', () => {
|
|
40
|
+
const { MAX_ATTEMPTS, MAX_DELAY_SECONDS, MIN_DELAY_SECONDS } =
|
|
41
|
+
AUTOMATION_RETRY_LIMITS;
|
|
42
|
+
|
|
43
|
+
expect(
|
|
44
|
+
policy({ retry: { attempts: 99, delaySeconds: 999999 } }).attempts,
|
|
45
|
+
).toBe(MAX_ATTEMPTS);
|
|
46
|
+
expect(
|
|
47
|
+
policy({ retry: { attempts: 99, delaySeconds: 999999 } }).delaySeconds,
|
|
48
|
+
).toBe(MAX_DELAY_SECONDS);
|
|
49
|
+
expect(policy({ retry: { attempts: -4, delaySeconds: 0 } })).toMatchObject({
|
|
50
|
+
attempts: 0,
|
|
51
|
+
delaySeconds: MIN_DELAY_SECONDS,
|
|
52
|
+
});
|
|
53
|
+
expect(policy({ retry: { backoff: 'fibonacci' } }).backoff).toBe('none');
|
|
54
|
+
expect(policy({ onError: 'explode' }).onError).toBe('fail');
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
describe('actionRetryDelayMs', () => {
|
|
59
|
+
const base = { attempts: 3, delaySeconds: 60, onError: 'fail' } as const;
|
|
60
|
+
|
|
61
|
+
it('waits the same amount every time without a backoff', () => {
|
|
62
|
+
const flat = { ...base, backoff: 'none' } as const;
|
|
63
|
+
|
|
64
|
+
expect([2, 3, 4].map((n) => actionRetryDelayMs(flat, n))).toEqual([
|
|
65
|
+
60_000, 60_000, 60_000,
|
|
66
|
+
]);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('grows the wait with each further try', () => {
|
|
70
|
+
const linear = { ...base, backoff: 'linear' } as const;
|
|
71
|
+
const exponential = { ...base, backoff: 'exponential' } as const;
|
|
72
|
+
|
|
73
|
+
expect([2, 3, 4].map((n) => actionRetryDelayMs(linear, n))).toEqual([
|
|
74
|
+
60_000, 120_000, 180_000,
|
|
75
|
+
]);
|
|
76
|
+
expect([2, 3, 4].map((n) => actionRetryDelayMs(exponential, n))).toEqual([
|
|
77
|
+
60_000, 120_000, 240_000,
|
|
78
|
+
]);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('caps a growing wait at the ceiling', () => {
|
|
82
|
+
const exponential = {
|
|
83
|
+
...base,
|
|
84
|
+
delaySeconds: 3000,
|
|
85
|
+
backoff: 'exponential',
|
|
86
|
+
} as const;
|
|
87
|
+
|
|
88
|
+
expect(actionRetryDelayMs(exponential, 5)).toBe(
|
|
89
|
+
AUTOMATION_RETRY_LIMITS.MAX_DELAY_SECONDS * 1000,
|
|
90
|
+
);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe('resolveActionBranchTarget', () => {
|
|
95
|
+
const branching = {
|
|
96
|
+
nextActionId: 'plain-next',
|
|
97
|
+
config: {
|
|
98
|
+
errorPolicy: { onError: 'branch' },
|
|
99
|
+
onSuccessActionId: 'happy',
|
|
100
|
+
onErrorActionId: 'sad',
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
it('reads the plain next action while the policy is off', () => {
|
|
105
|
+
const action = { nextActionId: 'plain-next', config: {} };
|
|
106
|
+
|
|
107
|
+
expect(resolveActionBranchTarget(action, 'success')).toBe('plain-next');
|
|
108
|
+
expect(resolveActionBranchTarget(action, 'error')).toBeUndefined();
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('reads both named exits once the action branches', () => {
|
|
112
|
+
expect(resolveActionBranchTarget(branching, 'success')).toBe('happy');
|
|
113
|
+
expect(resolveActionBranchTarget(branching, 'error')).toBe('sad');
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('never falls back to the plain next action while branching', () => {
|
|
117
|
+
const halfWired = {
|
|
118
|
+
nextActionId: 'plain-next',
|
|
119
|
+
config: { errorPolicy: { onError: 'branch' } },
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
expect(resolveActionBranchTarget(halfWired, 'success')).toBeUndefined();
|
|
123
|
+
expect(resolveActionBranchTarget(halfWired, 'error')).toBeUndefined();
|
|
124
|
+
});
|
|
125
|
+
});
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an action does when it fails. Written by the builder onto the action's
|
|
3
|
+
* own config, read by the engine — the default keeps today's behaviour, where
|
|
4
|
+
* a failed action fails the run.
|
|
5
|
+
*
|
|
6
|
+
* 'branch' turns the action's single outgoing edge into a named pair, so a
|
|
7
|
+
* tolerated failure is something the canvas shows rather than a setting buried
|
|
8
|
+
* in a dialog.
|
|
9
|
+
*/
|
|
10
|
+
export const AUTOMATION_ERROR_BEHAVIOURS = {
|
|
11
|
+
FAIL: 'fail',
|
|
12
|
+
BRANCH: 'branch',
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
/** Config keys the branch writes its two targets to. */
|
|
16
|
+
export const AUTOMATION_BRANCH_KEYS = {
|
|
17
|
+
SUCCESS: 'onSuccessActionId',
|
|
18
|
+
ERROR: 'onErrorActionId',
|
|
19
|
+
} as const;
|
|
20
|
+
|
|
21
|
+
export type TAutomationErrorBehaviour =
|
|
22
|
+
(typeof AUTOMATION_ERROR_BEHAVIOURS)[keyof typeof AUTOMATION_ERROR_BEHAVIOURS];
|
|
23
|
+
|
|
24
|
+
export const AUTOMATION_RETRY_BACKOFFS = {
|
|
25
|
+
NONE: 'none',
|
|
26
|
+
LINEAR: 'linear',
|
|
27
|
+
EXPONENTIAL: 'exponential',
|
|
28
|
+
} as const;
|
|
29
|
+
|
|
30
|
+
export type TAutomationRetryBackoff =
|
|
31
|
+
(typeof AUTOMATION_RETRY_BACKOFFS)[keyof typeof AUTOMATION_RETRY_BACKOFFS];
|
|
32
|
+
|
|
33
|
+
/** A retry parks a live execution, so the ceilings are the platform's. */
|
|
34
|
+
export const AUTOMATION_RETRY_LIMITS = {
|
|
35
|
+
MAX_ATTEMPTS: 5,
|
|
36
|
+
DEFAULT_DELAY_SECONDS: 60,
|
|
37
|
+
MIN_DELAY_SECONDS: 5,
|
|
38
|
+
MAX_DELAY_SECONDS: 3600,
|
|
39
|
+
} as const;
|
|
40
|
+
|
|
41
|
+
export type TAutomationActionErrorPolicy = {
|
|
42
|
+
retry?: {
|
|
43
|
+
// Extra tries after the first one. 0 means no retry.
|
|
44
|
+
attempts?: number;
|
|
45
|
+
delaySeconds?: number;
|
|
46
|
+
backoff?: TAutomationRetryBackoff;
|
|
47
|
+
};
|
|
48
|
+
onError?: TAutomationErrorBehaviour;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export type TAutomationBranchConfig = {
|
|
52
|
+
errorPolicy?: TAutomationActionErrorPolicy;
|
|
53
|
+
[AUTOMATION_BRANCH_KEYS.SUCCESS]?: string;
|
|
54
|
+
[AUTOMATION_BRANCH_KEYS.ERROR]?: string;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export type TResolvedActionErrorPolicy = {
|
|
58
|
+
attempts: number;
|
|
59
|
+
delaySeconds: number;
|
|
60
|
+
backoff: TAutomationRetryBackoff;
|
|
61
|
+
onError: TAutomationErrorBehaviour;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
65
|
+
typeof value === 'object' && value !== null;
|
|
66
|
+
|
|
67
|
+
const asActionId = (value: unknown) =>
|
|
68
|
+
typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
69
|
+
|
|
70
|
+
const clamp = (value: number, min: number, max: number) =>
|
|
71
|
+
Math.min(Math.max(value, min), max);
|
|
72
|
+
|
|
73
|
+
const toCount = (value: unknown, fallback: number) => {
|
|
74
|
+
const parsed = Number(value);
|
|
75
|
+
|
|
76
|
+
return Number.isFinite(parsed) ? Math.floor(parsed) : fallback;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const isBackoff = (value: unknown): value is TAutomationRetryBackoff =>
|
|
80
|
+
value === AUTOMATION_RETRY_BACKOFFS.NONE ||
|
|
81
|
+
value === AUTOMATION_RETRY_BACKOFFS.LINEAR ||
|
|
82
|
+
value === AUTOMATION_RETRY_BACKOFFS.EXPONENTIAL;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Reads the policy off an action config. Anything missing or out of range
|
|
86
|
+
* falls back to the platform's own values, so a hand-edited automation can
|
|
87
|
+
* never park an execution for longer than the ceiling allows.
|
|
88
|
+
*/
|
|
89
|
+
export const resolveActionErrorPolicy = (
|
|
90
|
+
config: unknown,
|
|
91
|
+
): TResolvedActionErrorPolicy => {
|
|
92
|
+
const policy =
|
|
93
|
+
isRecord(config) && isRecord(config.errorPolicy)
|
|
94
|
+
? (config.errorPolicy as TAutomationActionErrorPolicy)
|
|
95
|
+
: {};
|
|
96
|
+
const retry = isRecord(policy.retry) ? policy.retry : {};
|
|
97
|
+
const {
|
|
98
|
+
MAX_ATTEMPTS,
|
|
99
|
+
DEFAULT_DELAY_SECONDS,
|
|
100
|
+
MIN_DELAY_SECONDS,
|
|
101
|
+
MAX_DELAY_SECONDS,
|
|
102
|
+
} = AUTOMATION_RETRY_LIMITS;
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
attempts: clamp(toCount(retry.attempts, 0), 0, MAX_ATTEMPTS),
|
|
106
|
+
delaySeconds: clamp(
|
|
107
|
+
toCount(retry.delaySeconds, DEFAULT_DELAY_SECONDS),
|
|
108
|
+
MIN_DELAY_SECONDS,
|
|
109
|
+
MAX_DELAY_SECONDS,
|
|
110
|
+
),
|
|
111
|
+
backoff: isBackoff(retry.backoff)
|
|
112
|
+
? retry.backoff
|
|
113
|
+
: AUTOMATION_RETRY_BACKOFFS.NONE,
|
|
114
|
+
onError:
|
|
115
|
+
policy.onError === AUTOMATION_ERROR_BEHAVIOURS.BRANCH
|
|
116
|
+
? AUTOMATION_ERROR_BEHAVIOURS.BRANCH
|
|
117
|
+
: AUTOMATION_ERROR_BEHAVIOURS.FAIL,
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Where the action goes next. A branching action names both of its exits, so
|
|
123
|
+
* the plain `nextActionId` is only read while the policy is off.
|
|
124
|
+
*/
|
|
125
|
+
export const resolveActionBranchTarget = (
|
|
126
|
+
action: { nextActionId?: string; config?: unknown },
|
|
127
|
+
outcome: 'success' | 'error',
|
|
128
|
+
): string | undefined => {
|
|
129
|
+
const config = isRecord(action?.config) ? action.config : {};
|
|
130
|
+
const branching =
|
|
131
|
+
resolveActionErrorPolicy(config).onError ===
|
|
132
|
+
AUTOMATION_ERROR_BEHAVIOURS.BRANCH;
|
|
133
|
+
|
|
134
|
+
if (!branching) {
|
|
135
|
+
return outcome === 'success' ? action?.nextActionId : undefined;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const key =
|
|
139
|
+
outcome === 'success'
|
|
140
|
+
? AUTOMATION_BRANCH_KEYS.SUCCESS
|
|
141
|
+
: AUTOMATION_BRANCH_KEYS.ERROR;
|
|
142
|
+
|
|
143
|
+
return asActionId(config[key]);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
/** Wait before attempt `nextAttempt` (2 is the first retry). */
|
|
147
|
+
export const actionRetryDelayMs = (
|
|
148
|
+
policy: TResolvedActionErrorPolicy,
|
|
149
|
+
nextAttempt: number,
|
|
150
|
+
) => {
|
|
151
|
+
const step = Math.max(nextAttempt - 1, 1);
|
|
152
|
+
const { backoff, delaySeconds } = policy;
|
|
153
|
+
|
|
154
|
+
const seconds =
|
|
155
|
+
backoff === AUTOMATION_RETRY_BACKOFFS.LINEAR
|
|
156
|
+
? delaySeconds * step
|
|
157
|
+
: backoff === AUTOMATION_RETRY_BACKOFFS.EXPONENTIAL
|
|
158
|
+
? delaySeconds * Math.pow(2, step - 1)
|
|
159
|
+
: delaySeconds;
|
|
160
|
+
|
|
161
|
+
return clamp(seconds, 0, AUTOMATION_RETRY_LIMITS.MAX_DELAY_SECONDS) * 1000;
|
|
162
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { getPlugin, sendCoreModuleProducer } from '../../utils';
|
|
2
|
+
import { resolveAutomationActionInputs } from './outputResolvers';
|
|
3
|
+
|
|
4
|
+
jest.mock('../../utils', () => ({
|
|
5
|
+
getPlugin: jest.fn(),
|
|
6
|
+
sendCoreModuleProducer: jest.fn(),
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
const mockedGetPlugin = jest.mocked(getPlugin);
|
|
10
|
+
const mockedProducer = jest.mocked(sendCoreModuleProducer);
|
|
11
|
+
|
|
12
|
+
const pluginWith = (trigger: Record<string, unknown>) =>
|
|
13
|
+
({
|
|
14
|
+
config: { meta: { automations: { constants: { triggers: [trigger] } } } },
|
|
15
|
+
}) as unknown as Awaited<ReturnType<typeof getPlugin>>;
|
|
16
|
+
|
|
17
|
+
describe('resolveAutomationActionInputs', () => {
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
mockedGetPlugin.mockReset();
|
|
20
|
+
mockedProducer.mockReset();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('fills the inputs from the trigger output keys it declared', async () => {
|
|
24
|
+
mockedGetPlugin.mockResolvedValue(
|
|
25
|
+
pluginWith({
|
|
26
|
+
type: 'sales:pos.orders',
|
|
27
|
+
output: {
|
|
28
|
+
variables: [
|
|
29
|
+
{ key: 'totalAmount', label: 'Total' },
|
|
30
|
+
{ key: 'paidAmount', label: 'Paid' },
|
|
31
|
+
],
|
|
32
|
+
resolverKeys: ['paidAmount'],
|
|
33
|
+
},
|
|
34
|
+
actionInputs: {
|
|
35
|
+
'loyalty:score.score.create': {
|
|
36
|
+
totalAmount: 'totalAmount',
|
|
37
|
+
paidAmount: 'paidAmount',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
);
|
|
42
|
+
// Keys with a resolver are computed by the trigger's own plugin.
|
|
43
|
+
mockedProducer.mockResolvedValue({ totalAmount: 1000, paidAmount: 800 });
|
|
44
|
+
|
|
45
|
+
await expect(
|
|
46
|
+
resolveAutomationActionInputs({
|
|
47
|
+
subdomain: 'test',
|
|
48
|
+
triggerType: 'sales:pos.orders',
|
|
49
|
+
actionType: 'loyalty:score.score.create',
|
|
50
|
+
target: { totalAmount: 1000 },
|
|
51
|
+
}),
|
|
52
|
+
).resolves.toEqual({ totalAmount: 1000, paidAmount: 800 });
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('gives nothing when the trigger declares nothing for the action', async () => {
|
|
56
|
+
mockedGetPlugin.mockResolvedValue(
|
|
57
|
+
pluginWith({ type: 'core:contacts.customers' }),
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
await expect(
|
|
61
|
+
resolveAutomationActionInputs({
|
|
62
|
+
subdomain: 'test',
|
|
63
|
+
triggerType: 'core:contacts.customers',
|
|
64
|
+
actionType: 'loyalty:score.score.create',
|
|
65
|
+
target: {},
|
|
66
|
+
}),
|
|
67
|
+
).resolves.toBeUndefined();
|
|
68
|
+
expect(mockedProducer).not.toHaveBeenCalled();
|
|
69
|
+
});
|
|
70
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildFailedAction,
|
|
3
|
+
buildSkippedAction,
|
|
4
|
+
isActionOutcomeEnvelope,
|
|
5
|
+
resolveActionOutcome,
|
|
6
|
+
} from './actionOutcome';
|
|
7
|
+
import { AUTOMATION_ERROR_CODES } from './constants';
|
|
8
|
+
|
|
9
|
+
describe('resolveActionOutcome', () => {
|
|
10
|
+
it('reads anything without an envelope as the action payload', () => {
|
|
11
|
+
expect(resolveActionOutcome({ ok: false, status: 404 })).toEqual({
|
|
12
|
+
status: 'success',
|
|
13
|
+
result: { ok: false, status: 404 },
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
expect(resolveActionOutcome(null)).toEqual({
|
|
17
|
+
status: 'success',
|
|
18
|
+
result: null,
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('leaves a payload that happens to carry its own outcome field alone', () => {
|
|
23
|
+
const response = { outcome: { winner: 'a' } };
|
|
24
|
+
|
|
25
|
+
expect(resolveActionOutcome(response)).toEqual({
|
|
26
|
+
status: 'success',
|
|
27
|
+
result: response,
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('carries the reason of a skipped action', () => {
|
|
32
|
+
expect(
|
|
33
|
+
resolveActionOutcome(
|
|
34
|
+
buildSkippedAction('window-closed', { lastInboundAt: 'yesterday' }),
|
|
35
|
+
),
|
|
36
|
+
).toEqual({
|
|
37
|
+
status: 'skipped',
|
|
38
|
+
reason: 'window-closed',
|
|
39
|
+
result: { lastInboundAt: 'yesterday' },
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('carries the message, code and evidence of a failed action', () => {
|
|
44
|
+
expect(
|
|
45
|
+
resolveActionOutcome(
|
|
46
|
+
buildFailedAction(
|
|
47
|
+
'Outgoing webhook responded 404 Not Found',
|
|
48
|
+
AUTOMATION_ERROR_CODES.WEBHOOK_FAILED,
|
|
49
|
+
{ status: 404 },
|
|
50
|
+
),
|
|
51
|
+
),
|
|
52
|
+
).toEqual({
|
|
53
|
+
status: 'failed',
|
|
54
|
+
message: 'Outgoing webhook responded 404 Not Found',
|
|
55
|
+
code: AUTOMATION_ERROR_CODES.WEBHOOK_FAILED,
|
|
56
|
+
result: { status: 404 },
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('never silences a malformed declaration into a success', () => {
|
|
61
|
+
expect(resolveActionOutcome({ outcome: { status: 'skipped' } })).toEqual({
|
|
62
|
+
status: 'skipped',
|
|
63
|
+
reason: 'unspecified',
|
|
64
|
+
result: undefined,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
expect(resolveActionOutcome({ outcome: { status: 'failed' } })).toEqual({
|
|
68
|
+
status: 'failed',
|
|
69
|
+
message: 'Action reported a failure',
|
|
70
|
+
code: AUTOMATION_ERROR_CODES.UNKNOWN,
|
|
71
|
+
result: undefined,
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
describe('isActionOutcomeEnvelope', () => {
|
|
77
|
+
it('recognizes only a declared outcome', () => {
|
|
78
|
+
expect(isActionOutcomeEnvelope(buildSkippedAction('send-blocked'))).toBe(
|
|
79
|
+
true,
|
|
80
|
+
);
|
|
81
|
+
expect(isActionOutcomeEnvelope({ outcome: { status: 'done' } })).toBe(
|
|
82
|
+
false,
|
|
83
|
+
);
|
|
84
|
+
expect(isActionOutcomeEnvelope({ result: { ok: true } })).toBe(false);
|
|
85
|
+
expect(isActionOutcomeEnvelope(undefined)).toBe(false);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { AUTOMATION_ERROR_CODES, TAutomationErrorCode } from './constants';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An action states how it went. Without this envelope the engine can only read
|
|
5
|
+
* "did not throw", which reports a refused send and a deliberate skip alike.
|
|
6
|
+
*/
|
|
7
|
+
export const AUTOMATION_ACTION_OUTCOMES = {
|
|
8
|
+
SUCCESS: 'success',
|
|
9
|
+
SKIPPED: 'skipped',
|
|
10
|
+
FAILED: 'failed',
|
|
11
|
+
} as const;
|
|
12
|
+
|
|
13
|
+
export type TAutomationActionOutcome =
|
|
14
|
+
(typeof AUTOMATION_ACTION_OUTCOMES)[keyof typeof AUTOMATION_ACTION_OUTCOMES];
|
|
15
|
+
|
|
16
|
+
type TOutcomeDeclaration =
|
|
17
|
+
| { status: typeof AUTOMATION_ACTION_OUTCOMES.SUCCESS }
|
|
18
|
+
| { status: typeof AUTOMATION_ACTION_OUTCOMES.SKIPPED; reason: string }
|
|
19
|
+
| {
|
|
20
|
+
status: typeof AUTOMATION_ACTION_OUTCOMES.FAILED;
|
|
21
|
+
message: string;
|
|
22
|
+
code?: TAutomationErrorCode;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type TAutomationActionOutcomeEnvelope = {
|
|
26
|
+
outcome: TOutcomeDeclaration;
|
|
27
|
+
result?: unknown;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type TResolvedActionOutcome =
|
|
31
|
+
| { status: typeof AUTOMATION_ACTION_OUTCOMES.SUCCESS; result: unknown }
|
|
32
|
+
| {
|
|
33
|
+
status: typeof AUTOMATION_ACTION_OUTCOMES.SKIPPED;
|
|
34
|
+
reason: string;
|
|
35
|
+
result: unknown;
|
|
36
|
+
}
|
|
37
|
+
| {
|
|
38
|
+
status: typeof AUTOMATION_ACTION_OUTCOMES.FAILED;
|
|
39
|
+
message: string;
|
|
40
|
+
code: TAutomationErrorCode;
|
|
41
|
+
result: unknown;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const UNSPECIFIED_SKIP_REASON = 'unspecified';
|
|
45
|
+
const UNSPECIFIED_FAILURE_MESSAGE = 'Action reported a failure';
|
|
46
|
+
|
|
47
|
+
/** The work was deliberately not done, and the flow carries on. */
|
|
48
|
+
export const buildSkippedAction = (
|
|
49
|
+
reason: string,
|
|
50
|
+
result?: unknown,
|
|
51
|
+
): TAutomationActionOutcomeEnvelope => ({
|
|
52
|
+
outcome: { status: AUTOMATION_ACTION_OUTCOMES.SKIPPED, reason },
|
|
53
|
+
result,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
/** The work was meant to happen and did not. */
|
|
57
|
+
export const buildFailedAction = (
|
|
58
|
+
message: string,
|
|
59
|
+
code?: TAutomationErrorCode,
|
|
60
|
+
result?: unknown,
|
|
61
|
+
): TAutomationActionOutcomeEnvelope => ({
|
|
62
|
+
outcome: { status: AUTOMATION_ACTION_OUTCOMES.FAILED, message, code },
|
|
63
|
+
result,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
67
|
+
typeof value === 'object' && value !== null;
|
|
68
|
+
|
|
69
|
+
const isDeclaredStatus = (value: unknown): value is TAutomationActionOutcome =>
|
|
70
|
+
value === AUTOMATION_ACTION_OUTCOMES.SUCCESS ||
|
|
71
|
+
value === AUTOMATION_ACTION_OUTCOMES.SKIPPED ||
|
|
72
|
+
value === AUTOMATION_ACTION_OUTCOMES.FAILED;
|
|
73
|
+
|
|
74
|
+
/** For callers that forward an action's answer without reading it. */
|
|
75
|
+
export const isActionOutcomeEnvelope = (
|
|
76
|
+
value: unknown,
|
|
77
|
+
): value is TAutomationActionOutcomeEnvelope =>
|
|
78
|
+
isRecord(value) &&
|
|
79
|
+
isRecord(value.outcome) &&
|
|
80
|
+
isDeclaredStatus(value.outcome.status);
|
|
81
|
+
|
|
82
|
+
const asString = (value: unknown) =>
|
|
83
|
+
typeof value === 'string' && value.trim() ? value.trim() : undefined;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Anything that is not a well-formed envelope is the action's own payload, so
|
|
87
|
+
* every existing action keeps reporting exactly as it does today.
|
|
88
|
+
*/
|
|
89
|
+
export const resolveActionOutcome = (
|
|
90
|
+
actionResponse: unknown,
|
|
91
|
+
): TResolvedActionOutcome => {
|
|
92
|
+
const asSuccess = {
|
|
93
|
+
status: AUTOMATION_ACTION_OUTCOMES.SUCCESS,
|
|
94
|
+
result: actionResponse,
|
|
95
|
+
} as const;
|
|
96
|
+
|
|
97
|
+
if (!isRecord(actionResponse) || !isRecord(actionResponse.outcome)) {
|
|
98
|
+
return asSuccess;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const { outcome, result } = actionResponse;
|
|
102
|
+
const status = outcome.status;
|
|
103
|
+
|
|
104
|
+
if (status === AUTOMATION_ACTION_OUTCOMES.SKIPPED) {
|
|
105
|
+
return {
|
|
106
|
+
status,
|
|
107
|
+
reason: asString(outcome.reason) ?? UNSPECIFIED_SKIP_REASON,
|
|
108
|
+
result,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (status === AUTOMATION_ACTION_OUTCOMES.FAILED) {
|
|
113
|
+
const code = asString(outcome.code) as TAutomationErrorCode | undefined;
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
status,
|
|
117
|
+
message: asString(outcome.message) ?? UNSPECIFIED_FAILURE_MESSAGE,
|
|
118
|
+
code: code ?? AUTOMATION_ERROR_CODES.UNKNOWN,
|
|
119
|
+
result,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (status === AUTOMATION_ACTION_OUTCOMES.SUCCESS) {
|
|
124
|
+
return { status, result };
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return asSuccess;
|
|
128
|
+
};
|