@erxes/api-shared 0.0.0-stage → 3.2.19-1
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,99 @@
|
|
|
1
|
+
export const STATUSES = [
|
|
2
|
+
{ label: 'Active', value: 'Active' },
|
|
3
|
+
{ label: 'Deleted', value: 'Deleted' },
|
|
4
|
+
];
|
|
5
|
+
|
|
6
|
+
export const DEFAULT_SOCIAL_LINKS = [
|
|
7
|
+
{ label: 'Facebook', value: 'facebook' },
|
|
8
|
+
{ label: 'whatsapp', value: 'whatsapp' },
|
|
9
|
+
{ label: 'Twitter', value: 'twitter' },
|
|
10
|
+
{ label: 'Youtube', value: 'youtube' },
|
|
11
|
+
{ label: 'Website', value: 'website' },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
export const SOCIAL_LINKS = [
|
|
15
|
+
...DEFAULT_SOCIAL_LINKS,
|
|
16
|
+
{ label: 'Academia.edu', value: 'academia.edu' },
|
|
17
|
+
{ label: 'Chess.com', value: 'chess.com' },
|
|
18
|
+
{ label: 'Crunchyroll', value: 'crunchyroll' },
|
|
19
|
+
{ label: 'DeviantArt', value: 'deviantArt' },
|
|
20
|
+
{ label: 'Discord', value: 'discord' },
|
|
21
|
+
{ label: 'Douban', value: 'douban' },
|
|
22
|
+
{ label: 'eToro', value: 'eToro' },
|
|
23
|
+
{ label: 'Flickr', value: 'flickr' },
|
|
24
|
+
{ label: 'Gapo', value: 'gapo' },
|
|
25
|
+
{ label: 'Goodreads', value: 'goodreads' },
|
|
26
|
+
{ label: 'GitHub', value: 'gitHub' },
|
|
27
|
+
{ label: 'Instagram', value: 'instagram' },
|
|
28
|
+
{ label: 'KakaoStory', value: 'kakaoStory' },
|
|
29
|
+
{ label: 'KizlarSoruyor', value: 'kizlarSoruyor' },
|
|
30
|
+
{ label: 'Last.fm', value: 'last.fm' },
|
|
31
|
+
{ label: 'LinkedIn', value: 'linkedIn' },
|
|
32
|
+
{ label: 'LiveJournal', value: 'liveJournal' },
|
|
33
|
+
{ label: 'Pinterest', value: 'pinterest' },
|
|
34
|
+
{ label: 'Pixnet', value: 'pixnet' },
|
|
35
|
+
{ label: 'Plurk', value: 'plurk' },
|
|
36
|
+
{ label: 'Quora', value: 'quora' },
|
|
37
|
+
{ label: 'Reddit', value: 'reddit' },
|
|
38
|
+
{ label: 'Renren', value: 'renren' },
|
|
39
|
+
{ label: 'Sina Weibo', value: 'sinaWeibo' },
|
|
40
|
+
{ label: 'SoundCloud', value: 'soundCloud' },
|
|
41
|
+
{ label: 'Spotify', value: 'spotify' },
|
|
42
|
+
{ label: 'Steam', value: 'steam' },
|
|
43
|
+
{ label: 'Tagged', value: 'tagged' },
|
|
44
|
+
{ label: 'Taringa', value: 'taringa' },
|
|
45
|
+
{ label: 'Tumblr', value: 'tumblr' },
|
|
46
|
+
{ label: 'VK', value: 'vk' },
|
|
47
|
+
{ label: 'Voat', value: 'voat' },
|
|
48
|
+
{ label: 'Wattpad', value: 'wattpad' },
|
|
49
|
+
{ label: 'XING', value: 'xing' },
|
|
50
|
+
{ label: 'Yammer', value: 'yammer' },
|
|
51
|
+
{ label: 'Yelp', value: 'yelp' },
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
export const DEFAULT_SEX_CHOICES = [
|
|
55
|
+
{ label: 'Not known', value: 0 },
|
|
56
|
+
{ label: 'Male', value: 1 },
|
|
57
|
+
{ label: 'Female', value: 2 },
|
|
58
|
+
{ label: 'Not applicable', value: 9 },
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
export const SEX_OPTIONS = [
|
|
62
|
+
...DEFAULT_SEX_CHOICES,
|
|
63
|
+
{ label: 'co/co', value: 10 },
|
|
64
|
+
{ label: 'en/en', value: 11 },
|
|
65
|
+
{ label: 'ey/em', value: 12 },
|
|
66
|
+
{ label: 'he/him', value: 13 },
|
|
67
|
+
{ label: 'he/them', value: 14 },
|
|
68
|
+
{ label: 'she/her', value: 15 },
|
|
69
|
+
{ label: 'she/them', value: 16 },
|
|
70
|
+
{ label: 'they/them', value: 17 },
|
|
71
|
+
{ label: 'xie/hir', value: 18 },
|
|
72
|
+
{ label: 'yo/yo', value: 19 },
|
|
73
|
+
{ label: 'ze/zir', value: 20 },
|
|
74
|
+
{ label: 've/vis', value: 21 },
|
|
75
|
+
{ label: 'xe/xem', value: 22 },
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
export const USER_ROLES = {
|
|
79
|
+
SYSTEM: 'system',
|
|
80
|
+
USER: 'user',
|
|
81
|
+
ALL: ['system', 'user'],
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const LOG_STATUSES = {
|
|
85
|
+
FAILED: 'failed',
|
|
86
|
+
SUCCESS: 'success',
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const CONFORMITY_TYPE = {
|
|
90
|
+
customers: 'customer',
|
|
91
|
+
companies: 'company',
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const PERMISSION_ROLES = {
|
|
95
|
+
OWNER: 'owner',
|
|
96
|
+
ADMIN: 'admin',
|
|
97
|
+
MEMBER: 'member',
|
|
98
|
+
ALL: ['owner', 'admin', 'member'],
|
|
99
|
+
};
|
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
import { keyBy } from 'lodash';
|
|
2
|
+
import { IBrand, ICustomer, IProduct, IUser } from '../core-types';
|
|
3
|
+
import { isValidURL } from './string';
|
|
4
|
+
import { sendTRPCMessage } from './trpc';
|
|
5
|
+
|
|
6
|
+
export interface IReplacer {
|
|
7
|
+
key: string;
|
|
8
|
+
value: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface IArgs {
|
|
12
|
+
content: string;
|
|
13
|
+
customer?: any;
|
|
14
|
+
user?: IUser;
|
|
15
|
+
customerFields?: string[];
|
|
16
|
+
item?: any;
|
|
17
|
+
brand?: IBrand;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface ICustomerField {
|
|
21
|
+
_id: number;
|
|
22
|
+
name: string;
|
|
23
|
+
group?: string;
|
|
24
|
+
label?: string;
|
|
25
|
+
type?: string;
|
|
26
|
+
validation?: string;
|
|
27
|
+
options?: string[];
|
|
28
|
+
selectOptions?: Array<{ label: string; value: string }>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const getCustomerName = (customer: ICustomer) => {
|
|
32
|
+
if (customer.firstName || customer.lastName) {
|
|
33
|
+
return (customer.firstName || '') + ' ' + (customer.lastName || '');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (customer.primaryEmail || customer.primaryPhone) {
|
|
37
|
+
return customer.primaryEmail || customer.primaryPhone;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const { visitorContactInfo } = customer;
|
|
41
|
+
|
|
42
|
+
if (visitorContactInfo) {
|
|
43
|
+
return visitorContactInfo.phone || visitorContactInfo.email;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return 'Unknown';
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export function runReplacersOn(
|
|
50
|
+
content: string,
|
|
51
|
+
replacers: IReplacer[] = [],
|
|
52
|
+
): string {
|
|
53
|
+
let replacedContent = content;
|
|
54
|
+
|
|
55
|
+
for (const replacer of replacers) {
|
|
56
|
+
const regex = new RegExp(replacer.key, 'gi');
|
|
57
|
+
|
|
58
|
+
replacedContent = replacedContent.replace(regex, replacer.value);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return replacedContent;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export class EditorAttributeUtil {
|
|
65
|
+
private _possibleCustomerFields?: ICustomerField[];
|
|
66
|
+
private API_DOMAIN: string;
|
|
67
|
+
private availableServices: Set<string>;
|
|
68
|
+
private subdomain: string;
|
|
69
|
+
|
|
70
|
+
constructor(
|
|
71
|
+
API_DOMAIN: string,
|
|
72
|
+
availableServices: string[],
|
|
73
|
+
subdomain: string,
|
|
74
|
+
) {
|
|
75
|
+
this.API_DOMAIN = API_DOMAIN;
|
|
76
|
+
this.availableServices = new Set(availableServices);
|
|
77
|
+
this.subdomain = subdomain || 'os';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async fileToFileLink(url?: string, name?: string): Promise<string> {
|
|
81
|
+
if (!url) {
|
|
82
|
+
return '';
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
let href: string;
|
|
86
|
+
if (isValidURL(url) || url.includes('/')) {
|
|
87
|
+
href = url;
|
|
88
|
+
} else {
|
|
89
|
+
const key = url;
|
|
90
|
+
const uriName = name ? encodeURIComponent(name) : url;
|
|
91
|
+
href = `${this.API_DOMAIN}/read-file?key=${key}&name=${uriName}`;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return `<a target="_blank" download href="${href}">${name || url}</a>`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async customFieldsDataItemToFileLink(
|
|
98
|
+
customFieldDataItem: any,
|
|
99
|
+
): Promise<string> {
|
|
100
|
+
const value = customFieldDataItem.value;
|
|
101
|
+
|
|
102
|
+
if (Array.isArray(value)) {
|
|
103
|
+
const links = await Promise.all(
|
|
104
|
+
value.map((v) => this.fileToFileLink(v.url, v.name)),
|
|
105
|
+
);
|
|
106
|
+
return links.join(' | ');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return this.fileToFileLink(value.url, value.name);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async getPossibleCustomerFields(): Promise<ICustomerField[]> {
|
|
113
|
+
this._possibleCustomerFields ??= await sendTRPCMessage({
|
|
114
|
+
subdomain: this.subdomain,
|
|
115
|
+
|
|
116
|
+
pluginName: 'core',
|
|
117
|
+
method: 'query',
|
|
118
|
+
module: 'fields',
|
|
119
|
+
action: 'fieldsCombinedByContentType',
|
|
120
|
+
input: {
|
|
121
|
+
contentType: 'core:customer',
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
if (!this._possibleCustomerFields) {
|
|
126
|
+
throw new Error('Cannot acquire possibleCustomerFields');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return this._possibleCustomerFields || [];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async getCustomerFields(content: string): Promise<string[]> {
|
|
133
|
+
const customerFields = ['firstName', 'lastName', 'middleName'];
|
|
134
|
+
const possibleCustomerFields = await this.getPossibleCustomerFields();
|
|
135
|
+
|
|
136
|
+
for (const field of possibleCustomerFields) {
|
|
137
|
+
if (!content.includes(`{{ customer.${field.name} }}`)) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (field.name.includes('trackedData')) {
|
|
142
|
+
customerFields.push('trackedData');
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (field.name.includes('customFieldsData')) {
|
|
147
|
+
customerFields.push('customFieldsData');
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
customerFields.push(field.name);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return customerFields;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
async fillMissingCustomFieldsDataItemOfCustomer(
|
|
158
|
+
content: string,
|
|
159
|
+
customer: any,
|
|
160
|
+
): Promise<void> {
|
|
161
|
+
if (!customer.customFieldsData) {
|
|
162
|
+
customer.customFieldsData = [];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const existingItemsByFieldId = keyBy(customer.customFieldsData, 'field');
|
|
166
|
+
|
|
167
|
+
const possibleCustomerFields = await this.getPossibleCustomerFields();
|
|
168
|
+
|
|
169
|
+
for (const field of possibleCustomerFields) {
|
|
170
|
+
if (!content.includes(`{{ customer.${field.name} }}`)) {
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
if (field.name.includes('customFieldsData')) {
|
|
175
|
+
const fieldId = field.name.split('.').pop();
|
|
176
|
+
|
|
177
|
+
// if content has attribute that doesn't have fieldId, fill with dummy item
|
|
178
|
+
// if content has field attribute that doesn't exist on the customer.customFieldsData, fill with dummy item
|
|
179
|
+
if (!fieldId || !existingItemsByFieldId[fieldId]) {
|
|
180
|
+
customer.customFieldsData.push({
|
|
181
|
+
field: fieldId || '',
|
|
182
|
+
stringValue: '',
|
|
183
|
+
value: '',
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
async generateAmounts(productsData: IProduct[]) {
|
|
191
|
+
if (!this.availableServices.has('sales')) {
|
|
192
|
+
throw new Error('Sales service is not running.');
|
|
193
|
+
}
|
|
194
|
+
return sendTRPCMessage({
|
|
195
|
+
subdomain: this.subdomain,
|
|
196
|
+
pluginName: 'sales',
|
|
197
|
+
method: 'query',
|
|
198
|
+
module: 'deal',
|
|
199
|
+
action: 'generateAmounts',
|
|
200
|
+
input: productsData,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async generateProducts(productsData: IProduct[]): Promise<any> {
|
|
205
|
+
if (!this.availableServices.has('sales')) {
|
|
206
|
+
throw new Error('Sales service is not running.');
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return sendTRPCMessage({
|
|
210
|
+
subdomain: this.subdomain,
|
|
211
|
+
pluginName: 'sales',
|
|
212
|
+
method: 'query',
|
|
213
|
+
module: 'deal',
|
|
214
|
+
action: 'generateProducts',
|
|
215
|
+
input: productsData,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
async generateReplacers(args: IArgs): Promise<IReplacer[]> {
|
|
220
|
+
const { content, user, brand, item } = args;
|
|
221
|
+
const replacers: IReplacer[] = [];
|
|
222
|
+
|
|
223
|
+
// replace customer fields
|
|
224
|
+
if (args.customer) {
|
|
225
|
+
const customer = args.customer;
|
|
226
|
+
let customerFields = args.customerFields;
|
|
227
|
+
|
|
228
|
+
if (!customerFields || customerFields.length === 0) {
|
|
229
|
+
customerFields = await this.getCustomerFields(content);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
await this.fillMissingCustomFieldsDataItemOfCustomer(content, customer);
|
|
233
|
+
|
|
234
|
+
replacers.push({
|
|
235
|
+
key: '{{ customer.name }}',
|
|
236
|
+
value: getCustomerName(customer) || 'Unknown',
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
const fields = await sendTRPCMessage({
|
|
240
|
+
subdomain: this.subdomain,
|
|
241
|
+
|
|
242
|
+
pluginName: 'core',
|
|
243
|
+
method: 'query',
|
|
244
|
+
module: 'fields',
|
|
245
|
+
action: 'find',
|
|
246
|
+
input: {
|
|
247
|
+
query: {
|
|
248
|
+
type: 'file',
|
|
249
|
+
contentType: 'core:customer',
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
const customerFileFieldsById = keyBy(fields, '_id');
|
|
255
|
+
|
|
256
|
+
for (const field of customerFields) {
|
|
257
|
+
if (
|
|
258
|
+
field.includes('trackedData') ||
|
|
259
|
+
field.includes('customFieldsData')
|
|
260
|
+
) {
|
|
261
|
+
const dbFieldName = field.includes('trackedData')
|
|
262
|
+
? 'trackedData'
|
|
263
|
+
: 'customFieldsData';
|
|
264
|
+
|
|
265
|
+
for (const customFieldsDataItem of customer[dbFieldName] || []) {
|
|
266
|
+
const replaceValue = customerFileFieldsById[
|
|
267
|
+
customFieldsDataItem.field
|
|
268
|
+
]
|
|
269
|
+
? await this.customFieldsDataItemToFileLink(customFieldsDataItem)
|
|
270
|
+
: customFieldsDataItem.stringValue ||
|
|
271
|
+
customFieldsDataItem.value ||
|
|
272
|
+
'';
|
|
273
|
+
|
|
274
|
+
replacers.push({
|
|
275
|
+
key: `{{ customer.${dbFieldName}.${customFieldsDataItem.field} }}`,
|
|
276
|
+
value: replaceValue,
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
replacers.push({
|
|
284
|
+
key: `{{ customer.${field} }}`,
|
|
285
|
+
value: customer[field] || '',
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// replace user fields
|
|
291
|
+
if (user) {
|
|
292
|
+
replacers.push({ key: '{{ user.email }}', value: user.email || '' });
|
|
293
|
+
|
|
294
|
+
if (user.details) {
|
|
295
|
+
replacers.push(
|
|
296
|
+
{
|
|
297
|
+
key: '{{ user.fullName }}',
|
|
298
|
+
value: user.details.fullName || '',
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
key: '{{ user.position }}',
|
|
302
|
+
value: user.details.position || '',
|
|
303
|
+
},
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// replace brand fields
|
|
309
|
+
if (brand) {
|
|
310
|
+
replacers.push({ key: '{{ brandName }}', value: brand.name || '' });
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// deal, ticket, task mapping
|
|
314
|
+
if (item) {
|
|
315
|
+
replacers.push(
|
|
316
|
+
{ key: '{{ itemName }}', value: item.name || '' },
|
|
317
|
+
{
|
|
318
|
+
key: '{{ itemDescription }}',
|
|
319
|
+
value: item.description || '',
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
key: '{{ itemCloseDate }}',
|
|
323
|
+
value: item.closeDate
|
|
324
|
+
? new Date(item.closeDate).toLocaleDateString()
|
|
325
|
+
: '',
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
key: '{{ itemCreatedAt }}',
|
|
329
|
+
value: item.createdAt
|
|
330
|
+
? new Date(item.createdAt).toLocaleDateString()
|
|
331
|
+
: '',
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
key: '{{ itemModifiedAt }}',
|
|
335
|
+
value: item.modifiedAt
|
|
336
|
+
? new Date(item.modifiedAt).toLocaleDateString()
|
|
337
|
+
: '',
|
|
338
|
+
},
|
|
339
|
+
);
|
|
340
|
+
|
|
341
|
+
const products = await this.generateProducts(item.productsData);
|
|
342
|
+
const amounts = await this.generateAmounts(item.productsData);
|
|
343
|
+
|
|
344
|
+
replacers.push(
|
|
345
|
+
{
|
|
346
|
+
key: '{{ dealProducts }}',
|
|
347
|
+
value: products.map((p: any) => p.product.name).join(','),
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
key: '{{ dealAmounts }}',
|
|
351
|
+
value: Object.keys(amounts)
|
|
352
|
+
.map((key) => `${amounts[key]}${key}`)
|
|
353
|
+
.join(','),
|
|
354
|
+
},
|
|
355
|
+
);
|
|
356
|
+
|
|
357
|
+
const fieldMetaDatas: any = await sendTRPCMessage({
|
|
358
|
+
subdomain: this.subdomain,
|
|
359
|
+
|
|
360
|
+
pluginName: 'core',
|
|
361
|
+
method: 'query',
|
|
362
|
+
module: 'fields',
|
|
363
|
+
action: 'find',
|
|
364
|
+
input: {
|
|
365
|
+
query: {
|
|
366
|
+
contentType: item.contentType,
|
|
367
|
+
isDefinedByErxes: false,
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
for (const fieldMetaData of fieldMetaDatas) {
|
|
373
|
+
const customFieldsData: any[] = item.customFieldsData || [];
|
|
374
|
+
const customFieldsDataItem = customFieldsData.find(
|
|
375
|
+
(c) => c.field === fieldMetaData._id,
|
|
376
|
+
);
|
|
377
|
+
|
|
378
|
+
const key = `{{ itemCustomField.${fieldMetaData._id} }}`;
|
|
379
|
+
|
|
380
|
+
if (!customFieldsDataItem) {
|
|
381
|
+
if (content.includes(key)) {
|
|
382
|
+
replacers.push({
|
|
383
|
+
key,
|
|
384
|
+
value: '',
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
const replaceValue =
|
|
391
|
+
fieldMetaData.type === 'file'
|
|
392
|
+
? await this.customFieldsDataItemToFileLink(customFieldsDataItem)
|
|
393
|
+
: customFieldsDataItem.stringValue ||
|
|
394
|
+
customFieldsDataItem.value ||
|
|
395
|
+
'';
|
|
396
|
+
|
|
397
|
+
replacers.push({
|
|
398
|
+
key,
|
|
399
|
+
value: replaceValue,
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
return replacers;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
async replaceAttributes(args: IArgs): Promise<string> {
|
|
408
|
+
const replacers: IReplacer[] = await this.generateReplacers(args);
|
|
409
|
+
const replacedContent = runReplacersOn(args.content, replacers);
|
|
410
|
+
return replacedContent;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const normalizeEmail = (email: string) => email.trim().toLowerCase();
|
|
2
|
+
|
|
3
|
+
export const parseAddress = (value: string) => {
|
|
4
|
+
const match = /^\s*(.*?)\s*<([^>]+)>\s*$/.exec(value || '');
|
|
5
|
+
|
|
6
|
+
return match
|
|
7
|
+
? { name: match[1].replace(/^"|"$/g, ''), address: match[2].trim() }
|
|
8
|
+
: { name: '', address: (value || '').trim() };
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const SPECIALS = /[()<>@,;:\\".[\]]/;
|
|
12
|
+
|
|
13
|
+
const quoteName = (name: string) => {
|
|
14
|
+
const clean = name.replace(/[\r\n]/g, ' ').trim();
|
|
15
|
+
|
|
16
|
+
if (!clean) {
|
|
17
|
+
return '';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return SPECIALS.test(clean)
|
|
21
|
+
? `"${clean.replace(/(["\\])/g, '\\$1')}"`
|
|
22
|
+
: clean;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const alignSender = (
|
|
26
|
+
requested: string,
|
|
27
|
+
replyTo?: string,
|
|
28
|
+
alignedFrom?: string | null,
|
|
29
|
+
): { from: string; replyTo?: string } => {
|
|
30
|
+
const reply = replyTo?.trim() || undefined;
|
|
31
|
+
|
|
32
|
+
if (!alignedFrom) {
|
|
33
|
+
return { from: requested, replyTo: reply };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const { name, address } = parseAddress(requested);
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
from: `${quoteName(name) || address} <${alignedFrom}>`,
|
|
40
|
+
replyTo: reply || (address === alignedFrom ? undefined : address),
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import fetch from 'node-fetch';
|
|
2
|
+
import { IEmailAttachment } from './types';
|
|
3
|
+
|
|
4
|
+
const DOWNLOAD_TIMEOUT_MS = 15000;
|
|
5
|
+
const MAX_ATTACHMENT_BYTES = 25 * 1024 * 1024;
|
|
6
|
+
|
|
7
|
+
export const toBase64Attachment = async (
|
|
8
|
+
attachment: IEmailAttachment,
|
|
9
|
+
): Promise<{ filename: string; content: string; type?: string }> => {
|
|
10
|
+
if (attachment.content) {
|
|
11
|
+
return {
|
|
12
|
+
filename: attachment.filename,
|
|
13
|
+
content: attachment.content,
|
|
14
|
+
type: attachment.contentType,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (!attachment.path) {
|
|
19
|
+
throw new Error(
|
|
20
|
+
`Attachment "${attachment.filename}" has neither "content" nor "path"`,
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const controller = new AbortController();
|
|
25
|
+
const timer = setTimeout(() => controller.abort(), DOWNLOAD_TIMEOUT_MS);
|
|
26
|
+
|
|
27
|
+
let response;
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
response = await fetch(attachment.path, { signal: controller.signal });
|
|
31
|
+
} finally {
|
|
32
|
+
clearTimeout(timer);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!response.ok) {
|
|
36
|
+
throw new Error(
|
|
37
|
+
`Failed to download attachment "${attachment.filename}" from ${attachment.path}: ${response.status}`,
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const declaredSize = Number(response.headers.get('content-length'));
|
|
42
|
+
|
|
43
|
+
if (declaredSize && declaredSize > MAX_ATTACHMENT_BYTES) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
`Attachment "${attachment.filename}" exceeds the ${
|
|
46
|
+
MAX_ATTACHMENT_BYTES / (1024 * 1024)
|
|
47
|
+
}MB limit`,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const buffer = await response.buffer();
|
|
52
|
+
|
|
53
|
+
if (buffer.byteLength > MAX_ATTACHMENT_BYTES) {
|
|
54
|
+
throw new Error(
|
|
55
|
+
`Attachment "${attachment.filename}" exceeds the ${
|
|
56
|
+
MAX_ATTACHMENT_BYTES / (1024 * 1024)
|
|
57
|
+
}MB limit`,
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
filename: attachment.filename,
|
|
63
|
+
content: buffer.toString('base64'),
|
|
64
|
+
type:
|
|
65
|
+
attachment.contentType ||
|
|
66
|
+
response.headers.get('content-type') ||
|
|
67
|
+
undefined,
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const toBase64Attachments = async (
|
|
72
|
+
attachments: IEmailAttachment[] = [],
|
|
73
|
+
): Promise<Array<{ filename: string; content: string; type?: string }>> =>
|
|
74
|
+
Promise.all(attachments.map(toBase64Attachment));
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { EMAIL_PROVIDER_CONFIG_CODES } from './constants';
|
|
2
|
+
import { IEmailProviderConfig } from './types';
|
|
3
|
+
|
|
4
|
+
export type TConfigReader = (
|
|
5
|
+
code: string,
|
|
6
|
+
defaultValue?: string,
|
|
7
|
+
) => Promise<string | undefined>;
|
|
8
|
+
|
|
9
|
+
export const loadEmailProviderConfig = async (
|
|
10
|
+
read: TConfigReader,
|
|
11
|
+
): Promise<IEmailProviderConfig> => {
|
|
12
|
+
const values = await Promise.all(
|
|
13
|
+
EMAIL_PROVIDER_CONFIG_CODES.map((code) => read(code, '')),
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
return EMAIL_PROVIDER_CONFIG_CODES.reduce<IEmailProviderConfig>(
|
|
17
|
+
(config, code, index) => {
|
|
18
|
+
const value = values[index];
|
|
19
|
+
|
|
20
|
+
if (value) {
|
|
21
|
+
config[code] = value;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return config;
|
|
25
|
+
},
|
|
26
|
+
{},
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const resolveDefaultSenderEmail = ({
|
|
31
|
+
isSaas,
|
|
32
|
+
companyEmailFrom,
|
|
33
|
+
fallbackEmail,
|
|
34
|
+
}: {
|
|
35
|
+
isSaas: boolean;
|
|
36
|
+
companyEmailFrom?: string;
|
|
37
|
+
fallbackEmail?: string;
|
|
38
|
+
}): string =>
|
|
39
|
+
(isSaas ? fallbackEmail : companyEmailFrom || fallbackEmail) || '';
|
|
40
|
+
|
|
41
|
+
export const getEmailProviderConfigFingerprint = (
|
|
42
|
+
config: IEmailProviderConfig,
|
|
43
|
+
): string =>
|
|
44
|
+
EMAIL_PROVIDER_CONFIG_CODES.map(
|
|
45
|
+
(code) => `${code}=${config[code] ?? ''}`,
|
|
46
|
+
).join('|');
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TEmailProviderName } from './types';
|
|
2
|
+
|
|
3
|
+
export const EMAIL_PROVIDER_CONFIG_CODES = [
|
|
4
|
+
'DEFAULT_EMAIL_SERVICE',
|
|
5
|
+
|
|
6
|
+
'AWS_SES_ACCESS_KEY_ID',
|
|
7
|
+
'AWS_SES_SECRET_ACCESS_KEY',
|
|
8
|
+
'AWS_REGION',
|
|
9
|
+
'AWS_SES_CONFIG_SET',
|
|
10
|
+
|
|
11
|
+
'SENDGRID_API_KEY',
|
|
12
|
+
'SENDGRID_SUBUSER',
|
|
13
|
+
|
|
14
|
+
'MAIL_SERVICE',
|
|
15
|
+
'MAIL_HOST',
|
|
16
|
+
'MAIL_PORT',
|
|
17
|
+
'MAIL_USER',
|
|
18
|
+
'MAIL_PASS',
|
|
19
|
+
] as const;
|
|
20
|
+
|
|
21
|
+
export const DEFAULT_EMAIL_PROVIDER: TEmailProviderName = 'SES';
|
|
22
|
+
|
|
23
|
+
export const SENDGRID_API_BASE_URL = 'https://api.sendgrid.com/v3';
|
|
24
|
+
|
|
25
|
+
export const SES_DKIM_CNAME_SUFFIX = 'dkim.amazonses.com';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './address';
|
|
2
|
+
export * from './attachments';
|
|
3
|
+
export * from './config';
|
|
4
|
+
export * from './constants';
|
|
5
|
+
export * from './providers/sendgrid';
|
|
6
|
+
export * from './providers/sendgridEvents';
|
|
7
|
+
export * from './providers/ses';
|
|
8
|
+
export * from './providers/smtp';
|
|
9
|
+
export * from './resolveProvider';
|
|
10
|
+
export * from './service';
|
|
11
|
+
export * from './types';
|