@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,34 @@
|
|
|
1
|
+
/** The re-enrollment rule that matches every new event, not a field change. */
|
|
2
|
+
export const AUTOMATION_RE_ENROLL_EVERY_TIME = '*';
|
|
3
|
+
|
|
4
|
+
type TReEnrollmentConfig = {
|
|
5
|
+
reEnrollment?: boolean;
|
|
6
|
+
reEnrollmentRules?: string[];
|
|
7
|
+
once?: boolean;
|
|
8
|
+
} | null;
|
|
9
|
+
|
|
10
|
+
/** Whether a trigger's config asks to run again on every event. */
|
|
11
|
+
export const reEnrollsEveryTime = (config?: TReEnrollmentConfig) =>
|
|
12
|
+
!!config?.reEnrollment &&
|
|
13
|
+
!!config.reEnrollmentRules?.includes(AUTOMATION_RE_ENROLL_EVERY_TIME);
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Segment membership runs every time unless told otherwise. Before the shared
|
|
17
|
+
* re-enrollment setting it was told with `once`, which still counts while the
|
|
18
|
+
* automation has not been saved with the new setting.
|
|
19
|
+
*/
|
|
20
|
+
export const segmentMembershipRunsEveryTime = (config?: TReEnrollmentConfig) =>
|
|
21
|
+
config?.reEnrollment === undefined
|
|
22
|
+
? !config?.once
|
|
23
|
+
: reEnrollsEveryTime(config);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A rule watching one of the trigger segment's relation conditions — a sum
|
|
27
|
+
* of the customer's deals — by its place in the tree: `relation:children.0`.
|
|
28
|
+
*/
|
|
29
|
+
export const AUTOMATION_RE_ENROLL_RELATION_PREFIX = 'relation:';
|
|
30
|
+
|
|
31
|
+
export const reEnrollmentRelationPaths = (rules: string[] = []) =>
|
|
32
|
+
rules
|
|
33
|
+
.filter((rule) => rule.startsWith(AUTOMATION_RE_ENROLL_RELATION_PREFIX))
|
|
34
|
+
.map((rule) => rule.slice(AUTOMATION_RE_ENROLL_RELATION_PREFIX.length));
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { sendWorkerQueue } from '../../utils/mq-worker';
|
|
2
|
+
import { SegmentMembershipTransition } from '../segments/types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A trigger that fires when a record enters or leaves a materialized segment.
|
|
6
|
+
* Its type stays the record's own type, so every action reads the target as
|
|
7
|
+
* usual; the marker and the two exits live in the config.
|
|
8
|
+
*/
|
|
9
|
+
export const AUTOMATION_SEGMENT_MEMBERSHIP_EVENT = 'segmentMembership';
|
|
10
|
+
|
|
11
|
+
export const AUTOMATION_SEGMENT_MEMBERSHIP_FOLKS = ['joined', 'left'] as const;
|
|
12
|
+
|
|
13
|
+
export type TAutomationSegmentMembershipFolk =
|
|
14
|
+
(typeof AUTOMATION_SEGMENT_MEMBERSHIP_FOLKS)[number];
|
|
15
|
+
|
|
16
|
+
export type TAutomationSegmentMembershipJob = {
|
|
17
|
+
contentType: string;
|
|
18
|
+
transitions: SegmentMembershipTransition[];
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const isSegmentMembershipTrigger = (trigger?: {
|
|
22
|
+
config?: Record<string, any>;
|
|
23
|
+
}) => trigger?.config?.event === AUTOMATION_SEGMENT_MEMBERSHIP_EVENT;
|
|
24
|
+
|
|
25
|
+
/** Hands the segment worker's joins and leaves to the automations service. */
|
|
26
|
+
export const sendSegmentMembershipToAutomations = (
|
|
27
|
+
subdomain: string,
|
|
28
|
+
data: TAutomationSegmentMembershipJob,
|
|
29
|
+
) =>
|
|
30
|
+
sendWorkerQueue('automations', 'segmentMembership')
|
|
31
|
+
.add('segmentMembership', { subdomain, data })
|
|
32
|
+
.catch((error) => {
|
|
33
|
+
console.error('Error adding segment membership job:', error);
|
|
34
|
+
});
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { TCreatedVia } from '../../core-types/common';
|
|
2
|
+
import { sendWorkerQueue } from '../../utils/mq-worker';
|
|
3
|
+
import type { DefaultJobOptions } from 'bullmq';
|
|
4
|
+
import { createTRPCUntypedClient, httpBatchLink } from '@trpc/client';
|
|
5
|
+
import {
|
|
6
|
+
encodeTRPCContextHeader,
|
|
7
|
+
trpcContextHeaderName,
|
|
8
|
+
} from '../../utils/trpc';
|
|
9
|
+
import { redis } from '../../utils/redis';
|
|
10
|
+
|
|
11
|
+
type TSendAutomationTriggerProps = {
|
|
12
|
+
transport?: 'bullmq' | 'trpc';
|
|
13
|
+
jobOptions?: DefaultJobOptions;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const sendAutomationTrigger = (
|
|
17
|
+
subdomain: string,
|
|
18
|
+
{
|
|
19
|
+
type,
|
|
20
|
+
targets,
|
|
21
|
+
repeatOptions,
|
|
22
|
+
recordType,
|
|
23
|
+
eventUpdateDescription,
|
|
24
|
+
}: {
|
|
25
|
+
type: string;
|
|
26
|
+
targets: any;
|
|
27
|
+
repeatOptions?: {
|
|
28
|
+
executionId: string;
|
|
29
|
+
actionId: string;
|
|
30
|
+
optionalConnectId?: string;
|
|
31
|
+
};
|
|
32
|
+
recordType?: 'new' | 'existing';
|
|
33
|
+
eventUpdateDescription?: Record<string, any>;
|
|
34
|
+
},
|
|
35
|
+
{ transport = 'bullmq', jobOptions }: TSendAutomationTriggerProps = {},
|
|
36
|
+
): void => {
|
|
37
|
+
const automtionTriggerPayload = {
|
|
38
|
+
type,
|
|
39
|
+
targets,
|
|
40
|
+
repeatOptions,
|
|
41
|
+
recordType,
|
|
42
|
+
eventUpdateDescription,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
if (transport === 'trpc') {
|
|
46
|
+
redis
|
|
47
|
+
.get('erxes-service-automations')
|
|
48
|
+
.then((address) => {
|
|
49
|
+
const trpcUrl = address ? `${address}/trpc` : null;
|
|
50
|
+
|
|
51
|
+
if (!trpcUrl) {
|
|
52
|
+
throw new Error(
|
|
53
|
+
'Missing trpcUrl for sendAutomationTrigger. Provide props.trpcUrl or ensure service discovery has erxes-service-automations set.',
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const contextHeader = encodeTRPCContextHeader(
|
|
58
|
+
subdomain,
|
|
59
|
+
'mutation',
|
|
60
|
+
{},
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const client = createTRPCUntypedClient({
|
|
64
|
+
links: [
|
|
65
|
+
httpBatchLink({
|
|
66
|
+
url: trpcUrl,
|
|
67
|
+
headers: () => ({
|
|
68
|
+
[trpcContextHeaderName]: contextHeader,
|
|
69
|
+
}),
|
|
70
|
+
}),
|
|
71
|
+
],
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
client
|
|
75
|
+
.mutation('automations.trigger', automtionTriggerPayload)
|
|
76
|
+
.catch((error) => {
|
|
77
|
+
console.error('Error sending trpc request ', error);
|
|
78
|
+
});
|
|
79
|
+
})
|
|
80
|
+
.catch((error) => {
|
|
81
|
+
console.error('Error sending trpc request ', error);
|
|
82
|
+
});
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const queue = sendWorkerQueue('automations', 'trigger');
|
|
87
|
+
|
|
88
|
+
queue
|
|
89
|
+
.add(
|
|
90
|
+
'trigger',
|
|
91
|
+
{
|
|
92
|
+
subdomain,
|
|
93
|
+
data: automtionTriggerPayload,
|
|
94
|
+
},
|
|
95
|
+
jobOptions,
|
|
96
|
+
)
|
|
97
|
+
.catch((error) => {
|
|
98
|
+
console.error('Error adding job to queue:', error);
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Runs one named automation against one target the caller already chose.
|
|
104
|
+
*
|
|
105
|
+
* Unlike `sendAutomationTrigger`, which announces an event and lets the
|
|
106
|
+
* service decide which automations enrol which targets, this addresses an
|
|
107
|
+
* automation directly. The caller is responsible for choosing the target and
|
|
108
|
+
* for its own idempotency.
|
|
109
|
+
*/
|
|
110
|
+
export const sendAutomationRun = (
|
|
111
|
+
subdomain: string,
|
|
112
|
+
{
|
|
113
|
+
automationId,
|
|
114
|
+
target,
|
|
115
|
+
triggerId,
|
|
116
|
+
createdVia,
|
|
117
|
+
}: {
|
|
118
|
+
automationId: string;
|
|
119
|
+
target: Record<string, any>;
|
|
120
|
+
triggerId?: string;
|
|
121
|
+
/**
|
|
122
|
+
* What is asking for this run — the caller's own configuration and whoever
|
|
123
|
+
* set it going. Only the caller knows: to the automations service this is
|
|
124
|
+
* just an automation being addressed.
|
|
125
|
+
*/
|
|
126
|
+
createdVia?: TCreatedVia;
|
|
127
|
+
},
|
|
128
|
+
{ transport = 'bullmq', jobOptions }: TSendAutomationTriggerProps = {},
|
|
129
|
+
): void => {
|
|
130
|
+
const payload = { automationId, target, triggerId, createdVia };
|
|
131
|
+
|
|
132
|
+
if (transport === 'trpc') {
|
|
133
|
+
redis
|
|
134
|
+
.get('erxes-service-automations')
|
|
135
|
+
.then((address) => {
|
|
136
|
+
const trpcUrl = address ? `${address}/trpc` : null;
|
|
137
|
+
|
|
138
|
+
if (!trpcUrl) {
|
|
139
|
+
throw new Error(
|
|
140
|
+
'Missing trpcUrl for sendAutomationRun. Ensure service discovery has erxes-service-automations set.',
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const contextHeader = encodeTRPCContextHeader(
|
|
145
|
+
subdomain,
|
|
146
|
+
'mutation',
|
|
147
|
+
{},
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
const client = createTRPCUntypedClient({
|
|
151
|
+
links: [
|
|
152
|
+
httpBatchLink({
|
|
153
|
+
url: trpcUrl,
|
|
154
|
+
headers: () => ({
|
|
155
|
+
[trpcContextHeaderName]: contextHeader,
|
|
156
|
+
}),
|
|
157
|
+
}),
|
|
158
|
+
],
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
client.mutation('automations.runForTarget', payload).catch((error) => {
|
|
162
|
+
console.error('Error sending trpc request ', error);
|
|
163
|
+
});
|
|
164
|
+
})
|
|
165
|
+
.catch((error) => {
|
|
166
|
+
console.error('Error sending trpc request ', error);
|
|
167
|
+
});
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
sendWorkerQueue('automations', 'runForTarget')
|
|
172
|
+
.add('runForTarget', { subdomain, data: payload }, jobOptions)
|
|
173
|
+
.catch((error) => {
|
|
174
|
+
console.error('Error adding job to queue:', error);
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export type TDeferredCompletion = {
|
|
179
|
+
executionId: string;
|
|
180
|
+
actionId: string;
|
|
181
|
+
jobId: string;
|
|
182
|
+
status: 'success' | 'error' | 'dropped';
|
|
183
|
+
result?: any;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Reports a deferred action back to the automations service. The plugin that
|
|
188
|
+
* queued the work owns the callback, so this is the other half of the marker
|
|
189
|
+
* returned from `receiveActions`.
|
|
190
|
+
*/
|
|
191
|
+
export const sendAutomationDeferredCompletion = async (
|
|
192
|
+
subdomain: string,
|
|
193
|
+
completion: TDeferredCompletion,
|
|
194
|
+
): Promise<void> => {
|
|
195
|
+
const address = await redis.get('erxes-service-automations');
|
|
196
|
+
|
|
197
|
+
if (!address) {
|
|
198
|
+
throw new Error(
|
|
199
|
+
'Missing address for sendAutomationDeferredCompletion. Ensure service discovery has erxes-service-automations set.',
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const client = createTRPCUntypedClient({
|
|
204
|
+
links: [
|
|
205
|
+
httpBatchLink({
|
|
206
|
+
url: `${address}/trpc`,
|
|
207
|
+
headers: () => ({
|
|
208
|
+
[trpcContextHeaderName]: encodeTRPCContextHeader(
|
|
209
|
+
subdomain,
|
|
210
|
+
'mutation',
|
|
211
|
+
{},
|
|
212
|
+
),
|
|
213
|
+
}),
|
|
214
|
+
}),
|
|
215
|
+
],
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
await client.mutation('automations.completeDeferredAction', completion);
|
|
219
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { sendTRPCMessage } from '../../utils/trpc';
|
|
2
|
+
import {
|
|
3
|
+
BROADCAST_TARGET_TYPE,
|
|
4
|
+
BROADCAST_TRIGGER_TYPE,
|
|
5
|
+
getTriggerTargetType,
|
|
6
|
+
} from './constants';
|
|
7
|
+
import { setProperty } from './utils';
|
|
8
|
+
|
|
9
|
+
jest.mock('../../utils/trpc', () => ({ sendTRPCMessage: jest.fn() }));
|
|
10
|
+
|
|
11
|
+
const mockedSendTRPCMessage = jest.mocked(sendTRPCMessage);
|
|
12
|
+
|
|
13
|
+
type TSetPropertyArgs = Parameters<typeof setProperty>[0];
|
|
14
|
+
|
|
15
|
+
const execution = {} as TSetPropertyArgs['execution'];
|
|
16
|
+
|
|
17
|
+
const run = (overrides: Partial<TSetPropertyArgs>) =>
|
|
18
|
+
setProperty({
|
|
19
|
+
models: {},
|
|
20
|
+
subdomain: 'test',
|
|
21
|
+
module: 'core:contacts.customers',
|
|
22
|
+
rules: [{ field: 'propertiesData.plan', operator: 'set', value: 'pro' }],
|
|
23
|
+
execution,
|
|
24
|
+
...overrides,
|
|
25
|
+
} as TSetPropertyArgs);
|
|
26
|
+
|
|
27
|
+
describe('setProperty · outcome', () => {
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
mockedSendTRPCMessage.mockReset();
|
|
30
|
+
// validateFieldValues echoes what it was given
|
|
31
|
+
mockedSendTRPCMessage.mockImplementation(
|
|
32
|
+
async ({ input }: never) => (input as { data: unknown }).data,
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('marks the change updated when a record matched', async () => {
|
|
37
|
+
const result = await run({
|
|
38
|
+
selector: { _id: 'c1' },
|
|
39
|
+
update: async () => ({ matchedCount: 1 }),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
expect(result.target?.count).toBe(1);
|
|
43
|
+
expect(result.changes?.map(({ status }) => status)).toEqual(['updated']);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('marks the change skipped when nothing matched', async () => {
|
|
47
|
+
const result = await run({
|
|
48
|
+
selector: { _id: { $in: [] } },
|
|
49
|
+
update: async () => ({ matchedCount: 0 }),
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
expect(result.target?.count).toBe(0);
|
|
53
|
+
expect(result.changes?.map(({ status }) => status)).toEqual(['skipped']);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('marks every rule skipped when a current-value rule finds no record', async () => {
|
|
57
|
+
const update = jest.fn();
|
|
58
|
+
|
|
59
|
+
const result = await run({
|
|
60
|
+
rules: [{ field: 'propertiesData.score', operator: 'add', value: '5' }],
|
|
61
|
+
selector: { _id: 'missing' },
|
|
62
|
+
fetchItems: async () => [],
|
|
63
|
+
update,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
expect(update).not.toHaveBeenCalled();
|
|
67
|
+
expect(result.target?.count).toBe(0);
|
|
68
|
+
expect(result.changes?.map(({ status }) => status)).toEqual(['skipped']);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('skips only the item a per-record update did not reach', async () => {
|
|
72
|
+
const update = jest
|
|
73
|
+
.fn()
|
|
74
|
+
.mockResolvedValueOnce({ matchedCount: 1 })
|
|
75
|
+
.mockResolvedValueOnce({ matchedCount: 0 });
|
|
76
|
+
|
|
77
|
+
const result = await run({
|
|
78
|
+
rules: [{ field: 'propertiesData.score', operator: 'add', value: '5' }],
|
|
79
|
+
selector: { _id: { $in: ['a', 'b'] } },
|
|
80
|
+
fetchItems: async () => [
|
|
81
|
+
{ _id: 'a', propertiesData: { score: 1 } },
|
|
82
|
+
{ _id: 'b', propertiesData: { score: 2 } },
|
|
83
|
+
],
|
|
84
|
+
update,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
expect(result.target?.count).toBe(1);
|
|
88
|
+
expect(result.changes?.map(({ status }) => status)).toEqual([
|
|
89
|
+
'updated',
|
|
90
|
+
'skipped',
|
|
91
|
+
]);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe('getTriggerTargetType', () => {
|
|
96
|
+
it('runs a broadcast against the customer it hands each run', () => {
|
|
97
|
+
expect(getTriggerTargetType(BROADCAST_TRIGGER_TYPE)).toBe(
|
|
98
|
+
BROADCAST_TARGET_TYPE,
|
|
99
|
+
);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('keeps any other trigger as its own target type', () => {
|
|
103
|
+
expect(getTriggerTargetType('sales:sales.deals')).toBe('sales:sales.deals');
|
|
104
|
+
});
|
|
105
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { sendTRPCMessage } from '../../utils/trpc';
|
|
2
|
+
import { buildSetPropertyModifier } from './utils';
|
|
3
|
+
|
|
4
|
+
jest.mock('../../utils/trpc', () => ({ sendTRPCMessage: jest.fn() }));
|
|
5
|
+
jest.mock('nanoid', () => ({
|
|
6
|
+
...jest.requireActual('nanoid'),
|
|
7
|
+
nanoid: () => 'row1',
|
|
8
|
+
}));
|
|
9
|
+
|
|
10
|
+
const mockedSendTRPCMessage = jest.mocked(sendTRPCMessage);
|
|
11
|
+
|
|
12
|
+
const execution = {} as Parameters<
|
|
13
|
+
typeof buildSetPropertyModifier
|
|
14
|
+
>[0]['execution'];
|
|
15
|
+
|
|
16
|
+
const build = (rules: { field: string; operator: string; value?: unknown }[]) =>
|
|
17
|
+
buildSetPropertyModifier({ subdomain: 'test', rules, execution });
|
|
18
|
+
|
|
19
|
+
describe('buildSetPropertyModifier · repeating groups', () => {
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
mockedSendTRPCMessage.mockReset();
|
|
22
|
+
// validateFieldValues echoes what it was given
|
|
23
|
+
mockedSendTRPCMessage.mockImplementation(
|
|
24
|
+
async ({ input }: never) => (input as { data: unknown }).data,
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('appends one row carrying every rule of the same group', async () => {
|
|
29
|
+
const modifier = await build([
|
|
30
|
+
{ field: 'propertiesData.g:edu/school', operator: 'set', value: 'MUIS' },
|
|
31
|
+
{ field: 'propertiesData.g:edu/year', operator: 'set', value: '2020' },
|
|
32
|
+
]);
|
|
33
|
+
|
|
34
|
+
expect(modifier).toEqual({
|
|
35
|
+
$push: {
|
|
36
|
+
// a numeric string is evaluated to a number before it is stored
|
|
37
|
+
'propertiesData.g:edu': { school: 'MUIS', year: 2020, _id: 'row1' },
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('keeps a plain field on $set beside an appended row', async () => {
|
|
43
|
+
const modifier = await build([
|
|
44
|
+
{ field: 'propertiesData.plan', operator: 'set', value: 'pro' },
|
|
45
|
+
{ field: 'propertiesData.g:edu/school', operator: 'set', value: 'MUIS' },
|
|
46
|
+
]);
|
|
47
|
+
|
|
48
|
+
expect(modifier.$set).toEqual({ 'propertiesData.plan': 'pro' });
|
|
49
|
+
expect(modifier.$push).toEqual({
|
|
50
|
+
'propertiesData.g:edu': { school: 'MUIS', _id: 'row1' },
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('appends nothing when every rule of the group resolves empty', async () => {
|
|
55
|
+
const modifier = await build([
|
|
56
|
+
{ field: 'propertiesData.g:edu/school', operator: 'set', value: '' },
|
|
57
|
+
]);
|
|
58
|
+
|
|
59
|
+
expect(modifier.$push).toBeUndefined();
|
|
60
|
+
});
|
|
61
|
+
});
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { AnyProcedure, initTRPC } from '@trpc/server';
|
|
2
|
+
import * as trpcExpress from '@trpc/server/adapters/express';
|
|
3
|
+
import { Express } from 'express';
|
|
4
|
+
import { nanoid } from 'nanoid';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { initializePluginConfig } from '../../utils';
|
|
7
|
+
import { createTRPCContext } from '../../utils/trpc';
|
|
8
|
+
import {
|
|
9
|
+
buildRuntimeOutputsIndex,
|
|
10
|
+
normalizeAutomationConstantsForTransport,
|
|
11
|
+
resolveOutputPathsByNodeType,
|
|
12
|
+
} from './outputResolvers';
|
|
13
|
+
import {
|
|
14
|
+
AutomationConfigs,
|
|
15
|
+
IAutomationContext,
|
|
16
|
+
TAutomationProducers,
|
|
17
|
+
} from './types';
|
|
18
|
+
import {
|
|
19
|
+
CheckCustomTriggerInput,
|
|
20
|
+
FindObjectInput,
|
|
21
|
+
GenerateAiContextInput,
|
|
22
|
+
LoadAiKnowledgeDocumentBatchInput,
|
|
23
|
+
LookupAiToolInput,
|
|
24
|
+
ReceiveActionsInput,
|
|
25
|
+
ResolveOutputPathsInput,
|
|
26
|
+
SetPropertiesInput,
|
|
27
|
+
} from './zodTypes';
|
|
28
|
+
|
|
29
|
+
const generateRuntimeResolveOutputPaths = (
|
|
30
|
+
pluginName: string,
|
|
31
|
+
config: AutomationConfigs,
|
|
32
|
+
) => {
|
|
33
|
+
const { resolveOutputPaths, constants } = config || {};
|
|
34
|
+
|
|
35
|
+
if (resolveOutputPaths) {
|
|
36
|
+
return resolveOutputPaths;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const runtimeOutputs = buildRuntimeOutputsIndex(pluginName, constants);
|
|
40
|
+
const runtimeOutputKeys = Object.keys(runtimeOutputs);
|
|
41
|
+
|
|
42
|
+
if (!runtimeOutputKeys?.length) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return async (
|
|
46
|
+
{ subdomain, data }: z.infer<typeof ResolveOutputPathsInput>,
|
|
47
|
+
_context: IAutomationContext,
|
|
48
|
+
) => {
|
|
49
|
+
if (!runtimeOutputs[data.nodeType]) {
|
|
50
|
+
return {};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const resolvedValues = await resolveOutputPathsByNodeType({
|
|
54
|
+
subdomain,
|
|
55
|
+
nodeType: data.nodeType,
|
|
56
|
+
source: data.source || {},
|
|
57
|
+
paths: data.paths || [],
|
|
58
|
+
defaultValue: data.defaultValue,
|
|
59
|
+
runtimeOutputs,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return Object.fromEntries(
|
|
63
|
+
(data.paths || []).map((path) => {
|
|
64
|
+
const resolvedValue = resolvedValues?.[path];
|
|
65
|
+
|
|
66
|
+
return [
|
|
67
|
+
path,
|
|
68
|
+
resolvedValue === undefined ? data.defaultValue : resolvedValue,
|
|
69
|
+
];
|
|
70
|
+
}),
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export const startAutomations = async (
|
|
76
|
+
app: Express,
|
|
77
|
+
pluginName: string,
|
|
78
|
+
config: AutomationConfigs,
|
|
79
|
+
) => {
|
|
80
|
+
const transportConfig = {
|
|
81
|
+
...config,
|
|
82
|
+
constants: normalizeAutomationConstantsForTransport(
|
|
83
|
+
pluginName,
|
|
84
|
+
config.constants,
|
|
85
|
+
),
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
await initializePluginConfig(pluginName, 'automations', transportConfig);
|
|
89
|
+
const t = initTRPC.context<IAutomationContext>().create();
|
|
90
|
+
|
|
91
|
+
const {
|
|
92
|
+
receiveActions,
|
|
93
|
+
setProperties,
|
|
94
|
+
checkCustomTrigger,
|
|
95
|
+
findObject,
|
|
96
|
+
generateAiContext,
|
|
97
|
+
loadAiKnowledgeDocumentBatch,
|
|
98
|
+
lookupAiTool,
|
|
99
|
+
} = config || {};
|
|
100
|
+
|
|
101
|
+
const automationProcedures: Partial<
|
|
102
|
+
Record<TAutomationProducers, AnyProcedure>
|
|
103
|
+
> = {};
|
|
104
|
+
|
|
105
|
+
if (receiveActions) {
|
|
106
|
+
automationProcedures[TAutomationProducers.RECEIVE_ACTIONS] = t.procedure
|
|
107
|
+
.input(ReceiveActionsInput)
|
|
108
|
+
.mutation(async ({ ctx, input }) => receiveActions(input, ctx));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (setProperties) {
|
|
112
|
+
automationProcedures[TAutomationProducers.SET_PROPERTIES] = t.procedure
|
|
113
|
+
.input(SetPropertiesInput)
|
|
114
|
+
.mutation(async ({ ctx, input }) => setProperties(input, ctx));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (generateAiContext) {
|
|
118
|
+
automationProcedures[TAutomationProducers.GENERATE_AI_CONTEXT] = t.procedure
|
|
119
|
+
.input(GenerateAiContextInput)
|
|
120
|
+
.mutation(async ({ ctx, input }) =>
|
|
121
|
+
generateAiContext(
|
|
122
|
+
{ subdomain: input.subdomain, data: input.data },
|
|
123
|
+
ctx,
|
|
124
|
+
),
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (loadAiKnowledgeDocumentBatch) {
|
|
129
|
+
automationProcedures[
|
|
130
|
+
TAutomationProducers.LOAD_AI_KNOWLEDGE_DOCUMENT_BATCH
|
|
131
|
+
] = t.procedure
|
|
132
|
+
.input(LoadAiKnowledgeDocumentBatchInput)
|
|
133
|
+
.mutation(async ({ ctx, input }) =>
|
|
134
|
+
loadAiKnowledgeDocumentBatch(input, ctx),
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (lookupAiTool) {
|
|
139
|
+
automationProcedures[TAutomationProducers.LOOKUP_AI_TOOL] = t.procedure
|
|
140
|
+
.input(LookupAiToolInput)
|
|
141
|
+
.mutation(async ({ ctx, input }) => lookupAiTool(input, ctx));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const runtimeResolveOutputPaths = generateRuntimeResolveOutputPaths(
|
|
145
|
+
pluginName,
|
|
146
|
+
config,
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
if (runtimeResolveOutputPaths) {
|
|
150
|
+
automationProcedures[TAutomationProducers.RESOLVE_OUTPUT_PATHS] =
|
|
151
|
+
t.procedure
|
|
152
|
+
.input(ResolveOutputPathsInput)
|
|
153
|
+
.mutation(async ({ ctx, input }) =>
|
|
154
|
+
runtimeResolveOutputPaths(input, ctx),
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (checkCustomTrigger) {
|
|
159
|
+
automationProcedures[TAutomationProducers.CHECK_CUSTOM_TRIGGER] =
|
|
160
|
+
t.procedure
|
|
161
|
+
.input(CheckCustomTriggerInput)
|
|
162
|
+
.mutation(async ({ ctx, input }) => checkCustomTrigger(input, ctx));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (findObject) {
|
|
166
|
+
automationProcedures[TAutomationProducers.FIND_OBJECT] = t.procedure
|
|
167
|
+
.input(FindObjectInput)
|
|
168
|
+
.mutation(async ({ ctx, input }) => findObject(input, ctx));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const automationsRouter = t.router(automationProcedures);
|
|
172
|
+
|
|
173
|
+
const trpcMiddleware = trpcExpress.createExpressMiddleware({
|
|
174
|
+
router: automationsRouter,
|
|
175
|
+
createContext: createTRPCContext<IAutomationContext>(
|
|
176
|
+
async (_subdomain, context) => {
|
|
177
|
+
const processId = nanoid(12);
|
|
178
|
+
|
|
179
|
+
context.processId = processId;
|
|
180
|
+
|
|
181
|
+
return context;
|
|
182
|
+
},
|
|
183
|
+
),
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
app.use('/automations', trpcMiddleware);
|
|
187
|
+
};
|