@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,75 @@
|
|
|
1
|
+
import { getEmailProviderConfigFingerprint } from './config';
|
|
2
|
+
import { DEFAULT_EMAIL_PROVIDER } from './constants';
|
|
3
|
+
import { SendgridEmailProvider } from './providers/sendgrid';
|
|
4
|
+
import { SesEmailProvider } from './providers/ses';
|
|
5
|
+
import { SmtpEmailProvider } from './providers/smtp';
|
|
6
|
+
import {
|
|
7
|
+
IEmailProvider,
|
|
8
|
+
IEmailProviderConfig,
|
|
9
|
+
TEmailProviderName,
|
|
10
|
+
} from './types';
|
|
11
|
+
|
|
12
|
+
export const resolveEmailProviderName = (
|
|
13
|
+
config: IEmailProviderConfig,
|
|
14
|
+
): TEmailProviderName => {
|
|
15
|
+
const value = (config.DEFAULT_EMAIL_SERVICE || '').trim();
|
|
16
|
+
|
|
17
|
+
if (value.toLowerCase() === 'sendgrid') {
|
|
18
|
+
return 'sendgrid';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (value.toLowerCase() === 'custom') {
|
|
22
|
+
return 'custom';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (value.toUpperCase() === 'SES') {
|
|
26
|
+
return 'SES';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return DEFAULT_EMAIL_PROVIDER;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const createEmailProvider = (
|
|
33
|
+
config: IEmailProviderConfig,
|
|
34
|
+
): IEmailProvider => {
|
|
35
|
+
switch (resolveEmailProviderName(config)) {
|
|
36
|
+
case 'sendgrid':
|
|
37
|
+
return new SendgridEmailProvider(config);
|
|
38
|
+
case 'custom':
|
|
39
|
+
return new SmtpEmailProvider(config);
|
|
40
|
+
default:
|
|
41
|
+
return new SesEmailProvider(config);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const providerCache = new Map<
|
|
46
|
+
string,
|
|
47
|
+
{ fingerprint: string; provider: IEmailProvider }
|
|
48
|
+
>();
|
|
49
|
+
|
|
50
|
+
export const getEmailProvider = (
|
|
51
|
+
cacheKey: string,
|
|
52
|
+
config: IEmailProviderConfig,
|
|
53
|
+
): IEmailProvider => {
|
|
54
|
+
const fingerprint = getEmailProviderConfigFingerprint(config);
|
|
55
|
+
const cached = providerCache.get(cacheKey);
|
|
56
|
+
|
|
57
|
+
if (cached && cached.fingerprint === fingerprint) {
|
|
58
|
+
return cached.provider;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const provider = createEmailProvider(config);
|
|
62
|
+
|
|
63
|
+
providerCache.set(cacheKey, { fingerprint, provider });
|
|
64
|
+
|
|
65
|
+
return provider;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const clearEmailProviderCache = (cacheKey?: string) => {
|
|
69
|
+
if (cacheKey) {
|
|
70
|
+
providerCache.delete(cacheKey);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
providerCache.clear();
|
|
75
|
+
};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { getEmailProvider } from './resolveProvider';
|
|
2
|
+
import {
|
|
3
|
+
IEmailProviderConfig,
|
|
4
|
+
IOutboundEmail,
|
|
5
|
+
ISentEmail,
|
|
6
|
+
TEmailProviderName,
|
|
7
|
+
} from './types';
|
|
8
|
+
|
|
9
|
+
export const EMAIL_DELIVERY_ID_KEY = 'EmailDeliveryId';
|
|
10
|
+
|
|
11
|
+
export const EMAIL_SUBDOMAIN_KEY = 'Subdomain';
|
|
12
|
+
|
|
13
|
+
export interface IDeliveryLogInput {
|
|
14
|
+
toEmails: string[];
|
|
15
|
+
ccEmails?: string[];
|
|
16
|
+
from: string;
|
|
17
|
+
subject: string;
|
|
18
|
+
provider: TEmailProviderName;
|
|
19
|
+
source?: string;
|
|
20
|
+
sourceId?: string;
|
|
21
|
+
userId?: string;
|
|
22
|
+
notificationId?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface IDeliveryLogPatch {
|
|
26
|
+
status: 'sent' | 'failed';
|
|
27
|
+
sentAt: Date;
|
|
28
|
+
messageId?: string;
|
|
29
|
+
providerResponse?: string;
|
|
30
|
+
rejected?: string[];
|
|
31
|
+
error?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface IDeliveryLogPort {
|
|
35
|
+
create(input: IDeliveryLogInput): Promise<string | undefined>;
|
|
36
|
+
update(id: string, patch: IDeliveryLogPatch): Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface ISuppressionPort {
|
|
40
|
+
blocked(emails: string[], source?: string): Promise<string[]>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface ISendOutcome extends ISentEmail {
|
|
44
|
+
deliveryId?: string;
|
|
45
|
+
skipped?: boolean;
|
|
46
|
+
suppressed?: string[];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const toDeliveryLogProvider = (
|
|
50
|
+
name: TEmailProviderName,
|
|
51
|
+
): 'sendgrid' | 'smtp' | 'ses' => {
|
|
52
|
+
if (name === 'sendgrid') {
|
|
53
|
+
return 'sendgrid';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (name === 'SES') {
|
|
57
|
+
return 'ses';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return 'smtp';
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const toErrorMessage = (error: unknown) =>
|
|
64
|
+
error instanceof Error ? error.message : String(error);
|
|
65
|
+
|
|
66
|
+
export const deliverEmail = async ({
|
|
67
|
+
cacheKey,
|
|
68
|
+
config,
|
|
69
|
+
message,
|
|
70
|
+
log,
|
|
71
|
+
suppression,
|
|
72
|
+
meta,
|
|
73
|
+
}: {
|
|
74
|
+
cacheKey: string;
|
|
75
|
+
config: IEmailProviderConfig;
|
|
76
|
+
message: IOutboundEmail;
|
|
77
|
+
log?: IDeliveryLogPort;
|
|
78
|
+
suppression?: ISuppressionPort;
|
|
79
|
+
meta?: {
|
|
80
|
+
source?: string;
|
|
81
|
+
sourceId?: string;
|
|
82
|
+
userId?: string;
|
|
83
|
+
notificationId?: string;
|
|
84
|
+
subdomain?: string;
|
|
85
|
+
};
|
|
86
|
+
}): Promise<ISendOutcome> => {
|
|
87
|
+
const provider = getEmailProvider(cacheKey, config);
|
|
88
|
+
|
|
89
|
+
let recipients = message;
|
|
90
|
+
let suppressed: string[] = [];
|
|
91
|
+
|
|
92
|
+
if (suppression) {
|
|
93
|
+
suppressed = await suppression.blocked(
|
|
94
|
+
[...message.to, ...(message.cc || []), ...(message.bcc || [])],
|
|
95
|
+
meta?.source,
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
if (suppressed.length) {
|
|
99
|
+
const closed = new Set(suppressed);
|
|
100
|
+
const to = message.to.filter((email) => !closed.has(email));
|
|
101
|
+
|
|
102
|
+
if (!to.length) {
|
|
103
|
+
return {
|
|
104
|
+
messageId: '',
|
|
105
|
+
provider: provider.name,
|
|
106
|
+
accepted: [],
|
|
107
|
+
rejected: [],
|
|
108
|
+
skipped: true,
|
|
109
|
+
suppressed,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
recipients = {
|
|
114
|
+
...message,
|
|
115
|
+
to,
|
|
116
|
+
cc: (message.cc || []).filter((email) => !closed.has(email)),
|
|
117
|
+
bcc: (message.bcc || []).filter((email) => !closed.has(email)),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
let deliveryId: string | undefined;
|
|
123
|
+
|
|
124
|
+
if (log) {
|
|
125
|
+
try {
|
|
126
|
+
deliveryId = await log.create({
|
|
127
|
+
toEmails: recipients.to,
|
|
128
|
+
ccEmails: recipients.cc,
|
|
129
|
+
from: recipients.from,
|
|
130
|
+
subject: recipients.subject,
|
|
131
|
+
provider: provider.name,
|
|
132
|
+
source: meta?.source,
|
|
133
|
+
sourceId: meta?.sourceId,
|
|
134
|
+
userId: meta?.userId,
|
|
135
|
+
notificationId: meta?.notificationId,
|
|
136
|
+
});
|
|
137
|
+
} catch (error) {
|
|
138
|
+
console.error(
|
|
139
|
+
`Failed to record email delivery: ${toErrorMessage(error)}`,
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const tracking = {
|
|
145
|
+
...(deliveryId ? { [EMAIL_DELIVERY_ID_KEY]: deliveryId } : {}),
|
|
146
|
+
...(meta?.subdomain ? { [EMAIL_SUBDOMAIN_KEY]: meta.subdomain } : {}),
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const outbound: IOutboundEmail = Object.keys(tracking).length
|
|
150
|
+
? {
|
|
151
|
+
...recipients,
|
|
152
|
+
customArgs: { ...(recipients.customArgs || {}), ...tracking },
|
|
153
|
+
}
|
|
154
|
+
: recipients;
|
|
155
|
+
|
|
156
|
+
try {
|
|
157
|
+
const result = await provider.send(outbound);
|
|
158
|
+
|
|
159
|
+
if (log && deliveryId) {
|
|
160
|
+
await log
|
|
161
|
+
.update(deliveryId, {
|
|
162
|
+
status: 'sent',
|
|
163
|
+
sentAt: new Date(),
|
|
164
|
+
messageId: result.messageId,
|
|
165
|
+
rejected: result.rejected,
|
|
166
|
+
})
|
|
167
|
+
.catch((error) => {
|
|
168
|
+
console.error(
|
|
169
|
+
`Failed to update email delivery: ${toErrorMessage(error)}`,
|
|
170
|
+
);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return {
|
|
175
|
+
...result,
|
|
176
|
+
deliveryId,
|
|
177
|
+
suppressed: suppressed.length ? suppressed : undefined,
|
|
178
|
+
};
|
|
179
|
+
} catch (error) {
|
|
180
|
+
if (log && deliveryId) {
|
|
181
|
+
await log
|
|
182
|
+
.update(deliveryId, {
|
|
183
|
+
status: 'failed',
|
|
184
|
+
sentAt: new Date(),
|
|
185
|
+
error: toErrorMessage(error),
|
|
186
|
+
})
|
|
187
|
+
.catch(() => undefined);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
throw error;
|
|
191
|
+
}
|
|
192
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
export type TEmailProviderName = 'SES' | 'sendgrid' | 'custom';
|
|
2
|
+
|
|
3
|
+
export interface IEmailAttachment {
|
|
4
|
+
filename: string;
|
|
5
|
+
path?: string;
|
|
6
|
+
content?: string;
|
|
7
|
+
contentType?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface IOutboundEmail {
|
|
11
|
+
from: string;
|
|
12
|
+
to: string[];
|
|
13
|
+
cc?: string[];
|
|
14
|
+
bcc?: string[];
|
|
15
|
+
replyTo?: string;
|
|
16
|
+
subject: string;
|
|
17
|
+
html: string;
|
|
18
|
+
text?: string;
|
|
19
|
+
attachments?: IEmailAttachment[];
|
|
20
|
+
headers?: Record<string, string>;
|
|
21
|
+
customArgs?: Record<string, string>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ISentEmail {
|
|
25
|
+
messageId: string;
|
|
26
|
+
provider: TEmailProviderName;
|
|
27
|
+
accepted: string[];
|
|
28
|
+
rejected: string[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type TDnsRecordType = 'CNAME' | 'TXT' | 'MX';
|
|
32
|
+
|
|
33
|
+
export interface IDnsRecord {
|
|
34
|
+
type: TDnsRecordType;
|
|
35
|
+
host: string;
|
|
36
|
+
data: string;
|
|
37
|
+
valid: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type TSenderStatus = 'pending' | 'verified' | 'failed';
|
|
41
|
+
|
|
42
|
+
export type TSenderType = 'single' | 'domain';
|
|
43
|
+
|
|
44
|
+
export interface ISender {
|
|
45
|
+
id: string;
|
|
46
|
+
type: TSenderType;
|
|
47
|
+
value: string;
|
|
48
|
+
name?: string;
|
|
49
|
+
status: TSenderStatus;
|
|
50
|
+
dnsRecords?: IDnsRecord[];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ISingleSenderInput {
|
|
54
|
+
email: string;
|
|
55
|
+
name?: string;
|
|
56
|
+
replyTo?: string;
|
|
57
|
+
address?: string;
|
|
58
|
+
city?: string;
|
|
59
|
+
country?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface IEmailProviderConfig {
|
|
63
|
+
DEFAULT_EMAIL_SERVICE?: string;
|
|
64
|
+
|
|
65
|
+
AWS_SES_ACCESS_KEY_ID?: string;
|
|
66
|
+
AWS_SES_SECRET_ACCESS_KEY?: string;
|
|
67
|
+
AWS_REGION?: string;
|
|
68
|
+
AWS_SES_CONFIG_SET?: string;
|
|
69
|
+
|
|
70
|
+
SENDGRID_API_KEY?: string;
|
|
71
|
+
SENDGRID_SUBUSER?: string;
|
|
72
|
+
|
|
73
|
+
MAIL_SERVICE?: string;
|
|
74
|
+
MAIL_HOST?: string;
|
|
75
|
+
MAIL_PORT?: string;
|
|
76
|
+
MAIL_USER?: string;
|
|
77
|
+
MAIL_PASS?: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface IEmailProvider {
|
|
81
|
+
readonly name: TEmailProviderName;
|
|
82
|
+
|
|
83
|
+
send(message: IOutboundEmail): Promise<ISentEmail>;
|
|
84
|
+
|
|
85
|
+
listSingleSenders(ids?: string[]): Promise<ISender[]>;
|
|
86
|
+
listAuthenticatedDomains(domains?: string[]): Promise<ISender[]>;
|
|
87
|
+
|
|
88
|
+
verifySingleSender(input: ISingleSenderInput): Promise<ISender>;
|
|
89
|
+
|
|
90
|
+
removeSender(id: string): Promise<void>;
|
|
91
|
+
|
|
92
|
+
authenticateDomain(domain: string): Promise<ISender>;
|
|
93
|
+
|
|
94
|
+
validateDomain(id: string): Promise<ISender>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export class EmailProviderNotSupportedError extends Error {
|
|
98
|
+
constructor(provider: string, operation: string) {
|
|
99
|
+
super(
|
|
100
|
+
`"${operation}" is not supported by the "${provider}" email provider`,
|
|
101
|
+
);
|
|
102
|
+
this.name = 'EmailProviderNotSupportedError';
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export class EmailProviderConfigError extends Error {
|
|
107
|
+
constructor(provider: string, missing: string[]) {
|
|
108
|
+
super(
|
|
109
|
+
`"${provider}" email provider is missing configuration: ${missing.join(
|
|
110
|
+
', ',
|
|
111
|
+
)}`,
|
|
112
|
+
);
|
|
113
|
+
this.name = 'EmailProviderConfigError';
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export class EmailProviderRequestError extends Error {
|
|
118
|
+
public status: number;
|
|
119
|
+
public body: string;
|
|
120
|
+
|
|
121
|
+
constructor(provider: string, status: number, body: string) {
|
|
122
|
+
super(`"${provider}" API request failed with status ${status}: ${body}`);
|
|
123
|
+
this.name = 'EmailProviderRequestError';
|
|
124
|
+
this.status = status;
|
|
125
|
+
this.body = body;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import {
|
|
2
|
+
classifyError,
|
|
3
|
+
isExpectedError,
|
|
4
|
+
extractMessage,
|
|
5
|
+
sentryExpectedErrorFilter,
|
|
6
|
+
ExpectedError,
|
|
7
|
+
createExpectedError,
|
|
8
|
+
EXPECTED_ERROR_NAME,
|
|
9
|
+
} from './errorClassifier';
|
|
10
|
+
|
|
11
|
+
describe('errorClassifier', () => {
|
|
12
|
+
describe('classifyError', () => {
|
|
13
|
+
test.each([
|
|
14
|
+
['User not found', 'EXPECTED', true, 200],
|
|
15
|
+
['Email already exists', 'EXPECTED', true, 200],
|
|
16
|
+
['Name is required', 'EXPECTED', true, 200],
|
|
17
|
+
['Invalid email format', 'EXPECTED', true, 200],
|
|
18
|
+
['Wrong password', 'EXPECTED', true, 200],
|
|
19
|
+
['Permission denied', 'EXPECTED', true, 200],
|
|
20
|
+
['Not authenticated', 'EXPECTED', true, 200],
|
|
21
|
+
])('should classify "%s" as EXPECTED', (msg, category, isExpected, statusCode) => {
|
|
22
|
+
const result = classifyError(new Error(msg));
|
|
23
|
+
expect(result.category).toBe(category);
|
|
24
|
+
expect(result.isExpected).toBe(isExpected);
|
|
25
|
+
expect(result.statusCode).toBe(statusCode);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// Regression: real prod Sentry noise that previously leaked through because
|
|
29
|
+
// the messages don't contain "is required"/"are required"/etc.
|
|
30
|
+
test.each([
|
|
31
|
+
['Login required'],
|
|
32
|
+
['Permission required'],
|
|
33
|
+
['OAuth scope required'],
|
|
34
|
+
['Client portal required'],
|
|
35
|
+
['Client portal user required'],
|
|
36
|
+
['You do not have permission to manage this identifier'],
|
|
37
|
+
['Access denied: You do not have access to this private pipeline'],
|
|
38
|
+
['This operation is only allowed in saas version.'],
|
|
39
|
+
['Start date must be before end date'],
|
|
40
|
+
])('should classify auth/business noise "%s" as EXPECTED', (msg) => {
|
|
41
|
+
const result = classifyError(new Error(msg));
|
|
42
|
+
expect(result.category).toBe('EXPECTED');
|
|
43
|
+
expect(result.isExpected).toBe(true);
|
|
44
|
+
expect(result.statusCode).toBe(200);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should classify "MongoNetworkError" as SYSTEM', () => {
|
|
48
|
+
const error = new Error('MongoNetworkError: connection failed');
|
|
49
|
+
const result = classifyError(error);
|
|
50
|
+
expect(result.category).toBe('SYSTEM');
|
|
51
|
+
expect(result.isExpected).toBe(false);
|
|
52
|
+
expect(result.statusCode).toBe(500);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test.each([
|
|
56
|
+
['Request timeout', 'PROVIDER', false, 502],
|
|
57
|
+
['connect ECONNREFUSED 127.0.0.1:27017', 'PROVIDER', false, 502],
|
|
58
|
+
])('should classify "%s" as PROVIDER', (msg, category, isExpected, statusCode) => {
|
|
59
|
+
const result = classifyError(new Error(msg));
|
|
60
|
+
expect(result.category).toBe(category);
|
|
61
|
+
expect(result.isExpected).toBe(isExpected);
|
|
62
|
+
expect(result.statusCode).toBe(statusCode);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('should classify unknown errors as UNKNOWN', () => {
|
|
66
|
+
const result = classifyError(new Error('Something weird happened'));
|
|
67
|
+
expect(result.category).toBe('UNKNOWN');
|
|
68
|
+
expect(result.isExpected).toBe(false);
|
|
69
|
+
expect(result.statusCode).toBe(500);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('should classify string errors', () => {
|
|
73
|
+
const result = classifyError('Not found');
|
|
74
|
+
expect(result.category).toBe('EXPECTED');
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('should classify by error code', () => {
|
|
78
|
+
const error = new Error('Validation failed') as any;
|
|
79
|
+
error.code = 'VALIDATION_ERROR';
|
|
80
|
+
const result = classifyError(error);
|
|
81
|
+
expect(result.category).toBe('EXPECTED');
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
describe('ExpectedError (explicit marker)', () => {
|
|
86
|
+
it('is always EXPECTED regardless of message wording', () => {
|
|
87
|
+
// A message that matches NONE of the regex patterns must still be expected.
|
|
88
|
+
const result = classifyError(new ExpectedError('totally novel wording xyz'));
|
|
89
|
+
expect(result.category).toBe('EXPECTED');
|
|
90
|
+
expect(result.isExpected).toBe(true);
|
|
91
|
+
expect(result.statusCode).toBe(200);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('beats SYSTEM patterns when explicitly marked', () => {
|
|
95
|
+
// Even a message containing a SYSTEM keyword stays EXPECTED when the
|
|
96
|
+
// thrower has declared intent via ExpectedError.
|
|
97
|
+
const result = classifyError(new ExpectedError('TypeError-looking message'));
|
|
98
|
+
expect(result.category).toBe('EXPECTED');
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it('createExpectedError produces an ExpectedError', () => {
|
|
102
|
+
const err = createExpectedError('Login required', 'UNAUTHORIZED');
|
|
103
|
+
expect(err).toBeInstanceOf(ExpectedError);
|
|
104
|
+
expect(err.name).toBe(EXPECTED_ERROR_NAME);
|
|
105
|
+
expect(err.code).toBe('UNAUTHORIZED');
|
|
106
|
+
expect(err.isExpected).toBe(true);
|
|
107
|
+
expect(classifyError(err).category).toBe('EXPECTED');
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('honours a plain object with isExpected === true', () => {
|
|
111
|
+
const result = classifyError({ message: 'whatever', isExpected: true });
|
|
112
|
+
expect(result.category).toBe('EXPECTED');
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
describe('isExpectedError', () => {
|
|
117
|
+
it('should return true for expected errors', () => {
|
|
118
|
+
expect(isExpectedError(new Error('Not found'))).toBe(true);
|
|
119
|
+
expect(isExpectedError(new Error('Already exists'))).toBe(true);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('should return false for system errors', () => {
|
|
123
|
+
expect(isExpectedError(new Error('MongoNetworkError'))).toBe(false);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
describe('extractMessage', () => {
|
|
128
|
+
it('should extract message from Error', () => {
|
|
129
|
+
expect(extractMessage(new Error('test'))).toBe('test');
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
it('should return string as-is', () => {
|
|
133
|
+
expect(extractMessage('test')).toBe('test');
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it('should handle objects with message property', () => {
|
|
137
|
+
expect(extractMessage({ message: 'test' })).toBe('test');
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('should handle unknown types', () => {
|
|
141
|
+
expect(extractMessage(123)).toBe('123');
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
describe('SYSTEM vs EXPECTED ordering', () => {
|
|
146
|
+
it('should classify "Cannot find module" as SYSTEM, not EXPECTED', () => {
|
|
147
|
+
const result = classifyError(new Error("Cannot find module 'lodash'"));
|
|
148
|
+
expect(result.category).toBe('SYSTEM');
|
|
149
|
+
expect(result.isExpected).toBe(false);
|
|
150
|
+
expect(result.statusCode).toBe(500);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('should classify "Missing environment variable" as SYSTEM, not EXPECTED', () => {
|
|
154
|
+
const result = classifyError(new Error('Missing environment variable: API_KEY'));
|
|
155
|
+
expect(result.category).toBe('SYSTEM');
|
|
156
|
+
expect(result.isExpected).toBe(false);
|
|
157
|
+
expect(result.statusCode).toBe(500);
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it('should classify Mongoose BSON errors as SYSTEM', () => {
|
|
161
|
+
const error = new Error('BSONTypeError: Cast to ObjectId failed for value "abc" at path "_id"');
|
|
162
|
+
const result = classifyError(error);
|
|
163
|
+
expect(result.category).toBe('SYSTEM');
|
|
164
|
+
expect(result.isExpected).toBe(false);
|
|
165
|
+
expect(result.statusCode).toBe(500);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('should classify Cast to ObjectId as SYSTEM', () => {
|
|
169
|
+
const error = new Error('Cast to ObjectId failed for value "invalid"');
|
|
170
|
+
const result = classifyError(error);
|
|
171
|
+
expect(result.category).toBe('SYSTEM');
|
|
172
|
+
expect(result.isExpected).toBe(false);
|
|
173
|
+
expect(result.statusCode).toBe(500);
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
describe('sentryExpectedErrorFilter', () => {
|
|
178
|
+
it('should return null for EXPECTED errors', () => {
|
|
179
|
+
const event = {
|
|
180
|
+
exception: {
|
|
181
|
+
values: [{ value: 'User not found' }]
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
expect(sentryExpectedErrorFilter(event as any)).toBeNull();
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('should return event for SYSTEM errors', () => {
|
|
188
|
+
const event = {
|
|
189
|
+
exception: {
|
|
190
|
+
values: [{ value: 'MongoNetworkError: connection failed' }]
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
expect(sentryExpectedErrorFilter(event as any)).toBe(event as any);
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it('should return event for PROVIDER errors', () => {
|
|
197
|
+
const event = {
|
|
198
|
+
exception: {
|
|
199
|
+
values: [{ value: 'Request timeout' }]
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
expect(sentryExpectedErrorFilter(event as any)).toBe(event as any);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it('should return event when no exception value', () => {
|
|
206
|
+
const event = { exception: { values: [{}] } };
|
|
207
|
+
expect(sentryExpectedErrorFilter(event as any)).toBe(event as any);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
it('should return event when no exception', () => {
|
|
211
|
+
const event = {};
|
|
212
|
+
expect(sentryExpectedErrorFilter(event as any)).toBe(event as any);
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it('should drop events by ExpectedError type even if message is unmatched', () => {
|
|
216
|
+
const event = {
|
|
217
|
+
exception: {
|
|
218
|
+
values: [{ type: EXPECTED_ERROR_NAME, value: 'novel wording xyz' }],
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
expect(sentryExpectedErrorFilter(event as any)).toBeNull();
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it('should drop "Login required" (regression)', () => {
|
|
225
|
+
const event = {
|
|
226
|
+
exception: { values: [{ type: 'Error', value: 'Login required' }] },
|
|
227
|
+
};
|
|
228
|
+
expect(sentryExpectedErrorFilter(event as any)).toBeNull();
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
});
|