@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,355 @@
|
|
|
1
|
+
import { parsePropertyDataKey, toPropertyGroupKey } from '../properties/keys';
|
|
2
|
+
import { mergePropertyRowConditions } from '../properties/mergeRows';
|
|
3
|
+
import {
|
|
4
|
+
PERIOD_OPERATORS,
|
|
5
|
+
SegmentOperator,
|
|
6
|
+
normalizeSegmentOperator,
|
|
7
|
+
} from './operators';
|
|
8
|
+
import { SegmentFieldMeta, SegmentFieldNamespace } from './fieldMeta';
|
|
9
|
+
import {
|
|
10
|
+
SEGMENT_MEMBERSHIP_FIELD,
|
|
11
|
+
SegmentFieldNode,
|
|
12
|
+
SegmentNode,
|
|
13
|
+
SegmentValue,
|
|
14
|
+
} from './nodes';
|
|
15
|
+
import {
|
|
16
|
+
anniversaryRanges,
|
|
17
|
+
DEFAULT_SEGMENT_TIME_ZONE,
|
|
18
|
+
shiftZonedDays,
|
|
19
|
+
zonedDate,
|
|
20
|
+
zonedDayStart,
|
|
21
|
+
zonedPeriodRange,
|
|
22
|
+
} from './zonedTime';
|
|
23
|
+
|
|
24
|
+
export type SegmentMongoFilter = Record<string, unknown>;
|
|
25
|
+
|
|
26
|
+
export type SegmentCompileContext = {
|
|
27
|
+
fields: SegmentFieldMeta[];
|
|
28
|
+
namespaces?: SegmentFieldNamespace[];
|
|
29
|
+
now?: Date;
|
|
30
|
+
timeZone?: string;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type SegmentCompileResult = {
|
|
34
|
+
filter: SegmentMongoFilter;
|
|
35
|
+
unsupported: string[];
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const MINUTE_MS = 60_000;
|
|
39
|
+
|
|
40
|
+
const escapeRegex = (value: string) =>
|
|
41
|
+
value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
42
|
+
|
|
43
|
+
const toArray = (value: SegmentValue): SegmentValue[] =>
|
|
44
|
+
Array.isArray(value) ? value : [value];
|
|
45
|
+
|
|
46
|
+
const toNumber = (value: SegmentValue | undefined): number | undefined => {
|
|
47
|
+
if (value === undefined) {
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const parsed = Number(String(value).replace(/,/g, ''));
|
|
52
|
+
|
|
53
|
+
return Number.isNaN(parsed) ? undefined : parsed;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const toDate = (value: SegmentValue): Date | undefined => {
|
|
57
|
+
const parsed = value instanceof Date ? value : new Date(String(value));
|
|
58
|
+
|
|
59
|
+
return Number.isNaN(parsed.getTime()) ? undefined : parsed;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const minuteBucket = (
|
|
63
|
+
value: SegmentValue,
|
|
64
|
+
now: Date,
|
|
65
|
+
offset: 1 | -1,
|
|
66
|
+
): Record<string, Date> | undefined => {
|
|
67
|
+
const amount = toNumber(value);
|
|
68
|
+
|
|
69
|
+
if (amount === undefined) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const target =
|
|
74
|
+
Math.floor((now.getTime() + offset * amount * MINUTE_MS) / MINUTE_MS) *
|
|
75
|
+
MINUTE_MS;
|
|
76
|
+
|
|
77
|
+
return { $gte: new Date(target), $lte: new Date(target + MINUTE_MS - 1) };
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const dayBucket = (
|
|
81
|
+
value: SegmentValue,
|
|
82
|
+
now: Date,
|
|
83
|
+
timeZone: string,
|
|
84
|
+
offset: 1 | -1,
|
|
85
|
+
): Record<string, Date> | undefined => {
|
|
86
|
+
const amount = toNumber(value);
|
|
87
|
+
|
|
88
|
+
if (amount === undefined) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const day = shiftZonedDays(zonedDate(now, timeZone), offset * amount);
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
$gte: zonedDayStart(day, timeZone),
|
|
96
|
+
$lt: zonedDayStart(shiftZonedDays(day, 1), timeZone),
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const anniversaryOn = (
|
|
101
|
+
path: string,
|
|
102
|
+
value: SegmentValue | undefined,
|
|
103
|
+
now: Date,
|
|
104
|
+
timeZone: string,
|
|
105
|
+
offset: 0 | 1 | -1,
|
|
106
|
+
): SegmentMongoFilter | undefined => {
|
|
107
|
+
const amount = offset === 0 ? 0 : toNumber(value);
|
|
108
|
+
|
|
109
|
+
if (amount === undefined) {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const target = shiftZonedDays(zonedDate(now, timeZone), offset * amount);
|
|
114
|
+
|
|
115
|
+
return {
|
|
116
|
+
$or: anniversaryRanges(target, timeZone).map((range) => ({
|
|
117
|
+
[path]: { $gte: range.gte, $lt: range.lt },
|
|
118
|
+
})),
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const ANNIVERSARY_OFFSETS: Partial<Record<SegmentOperator, 0 | 1 | -1>> = {
|
|
123
|
+
[SegmentOperator.AnniversaryToday]: 0,
|
|
124
|
+
[SegmentOperator.AnniversaryFromNow]: 1,
|
|
125
|
+
[SegmentOperator.AnniversaryAgo]: -1,
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const compareOn = (
|
|
129
|
+
operator: SegmentOperator,
|
|
130
|
+
value: SegmentValue | undefined,
|
|
131
|
+
now: Date,
|
|
132
|
+
timeZone: string,
|
|
133
|
+
): Record<string, unknown> | undefined => {
|
|
134
|
+
switch (operator) {
|
|
135
|
+
case SegmentOperator.IsSet:
|
|
136
|
+
return { $nin: [null, []], $exists: true };
|
|
137
|
+
case SegmentOperator.IsNotSet:
|
|
138
|
+
return { $in: [null, []] };
|
|
139
|
+
case SegmentOperator.IsTrue:
|
|
140
|
+
return { $in: [true, 'true'] };
|
|
141
|
+
case SegmentOperator.IsFalse:
|
|
142
|
+
return { $in: [false, 'false'] };
|
|
143
|
+
default:
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const period = PERIOD_OPERATORS[operator];
|
|
148
|
+
|
|
149
|
+
if (period) {
|
|
150
|
+
const { gte, lt } = zonedPeriodRange(now, timeZone, period);
|
|
151
|
+
|
|
152
|
+
return { $gte: gte, $lt: lt };
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (value === undefined) {
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
switch (operator) {
|
|
160
|
+
case SegmentOperator.Equals:
|
|
161
|
+
return { $eq: value };
|
|
162
|
+
case SegmentOperator.NotEquals:
|
|
163
|
+
return { $ne: value };
|
|
164
|
+
case SegmentOperator.Contains:
|
|
165
|
+
return { $regex: escapeRegex(String(value)), $options: 'i' };
|
|
166
|
+
case SegmentOperator.NotContains:
|
|
167
|
+
return {
|
|
168
|
+
$not: new RegExp(escapeRegex(String(value)), 'i'),
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
case SegmentOperator.In:
|
|
172
|
+
return { $in: toArray(value) };
|
|
173
|
+
case SegmentOperator.NotIn:
|
|
174
|
+
return { $nin: toArray(value) };
|
|
175
|
+
|
|
176
|
+
case SegmentOperator.NumberGt: {
|
|
177
|
+
const parsed = toNumber(value);
|
|
178
|
+
return parsed === undefined ? undefined : { $gte: parsed };
|
|
179
|
+
}
|
|
180
|
+
case SegmentOperator.NumberLt: {
|
|
181
|
+
const parsed = toNumber(value);
|
|
182
|
+
return parsed === undefined ? undefined : { $lte: parsed };
|
|
183
|
+
}
|
|
184
|
+
case SegmentOperator.DateGte: {
|
|
185
|
+
const parsed = toDate(value);
|
|
186
|
+
return parsed === undefined ? undefined : { $gte: parsed };
|
|
187
|
+
}
|
|
188
|
+
case SegmentOperator.DateLte: {
|
|
189
|
+
const parsed = toDate(value);
|
|
190
|
+
return parsed === undefined ? undefined : { $lte: parsed };
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
case SegmentOperator.MinutesFromNow:
|
|
194
|
+
return minuteBucket(value, now, 1);
|
|
195
|
+
case SegmentOperator.MinutesAgo:
|
|
196
|
+
return minuteBucket(value, now, -1);
|
|
197
|
+
case SegmentOperator.DaysFromNow:
|
|
198
|
+
return dayBucket(value, now, timeZone, 1);
|
|
199
|
+
case SegmentOperator.DaysAgo:
|
|
200
|
+
return dayBucket(value, now, timeZone, -1);
|
|
201
|
+
|
|
202
|
+
default:
|
|
203
|
+
return undefined;
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const compileField = (
|
|
208
|
+
node: SegmentFieldNode,
|
|
209
|
+
context: SegmentCompileContext,
|
|
210
|
+
now: Date,
|
|
211
|
+
): SegmentMongoFilter | undefined => {
|
|
212
|
+
const operator = normalizeSegmentOperator(node.operator);
|
|
213
|
+
const timeZone = context.timeZone || DEFAULT_SEGMENT_TIME_ZONE;
|
|
214
|
+
const anniversary = ANNIVERSARY_OFFSETS[operator];
|
|
215
|
+
|
|
216
|
+
const declared = context.fields.find((field) => field.key === node.fieldKey);
|
|
217
|
+
|
|
218
|
+
if (declared) {
|
|
219
|
+
if (declared.kind !== 'projected') {
|
|
220
|
+
return undefined;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (anniversary !== undefined) {
|
|
224
|
+
return anniversaryOn(
|
|
225
|
+
declared.path,
|
|
226
|
+
node.value,
|
|
227
|
+
now,
|
|
228
|
+
timeZone,
|
|
229
|
+
anniversary,
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const comparison = compareOn(operator, node.value, now, timeZone);
|
|
234
|
+
|
|
235
|
+
return comparison ? { [declared.path]: comparison } : undefined;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const [prefix, ...rest] = node.fieldKey.split('.');
|
|
239
|
+
const namespace = (context.namespaces || []).find(
|
|
240
|
+
(candidate) => candidate.prefix === prefix,
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
if (!namespace || !rest.length) {
|
|
244
|
+
return undefined;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const entryKey = rest.join('.');
|
|
248
|
+
const key = parsePropertyDataKey(entryKey);
|
|
249
|
+
|
|
250
|
+
// the leaf path is relative to one row, so the comparison goes inside it
|
|
251
|
+
if (key.kind === 'row') {
|
|
252
|
+
const rowsPath = `${namespace.path}.${toPropertyGroupKey(key.groupId)}`;
|
|
253
|
+
|
|
254
|
+
if (anniversary !== undefined) {
|
|
255
|
+
const branches = anniversaryOn(
|
|
256
|
+
key.fieldId,
|
|
257
|
+
node.value,
|
|
258
|
+
now,
|
|
259
|
+
timeZone,
|
|
260
|
+
anniversary,
|
|
261
|
+
);
|
|
262
|
+
|
|
263
|
+
return branches ? { [rowsPath]: { $elemMatch: branches } } : undefined;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const rowComparison = compareOn(operator, node.value, now, timeZone);
|
|
267
|
+
|
|
268
|
+
return rowComparison
|
|
269
|
+
? { [rowsPath]: { $elemMatch: { [key.fieldId]: rowComparison } } }
|
|
270
|
+
: undefined;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// The values are one object keyed by field id, so a namespaced field is the
|
|
274
|
+
// dotted path it reads as - the same shape any stored field compiles to.
|
|
275
|
+
const path = `${namespace.path}.${entryKey}`;
|
|
276
|
+
|
|
277
|
+
if (anniversary !== undefined) {
|
|
278
|
+
const branches = anniversaryOn(
|
|
279
|
+
path,
|
|
280
|
+
node.value,
|
|
281
|
+
now,
|
|
282
|
+
timeZone,
|
|
283
|
+
anniversary,
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
return branches ? branches : undefined;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const comparison = compareOn(operator, node.value, now, timeZone);
|
|
290
|
+
|
|
291
|
+
return comparison ? { [path]: comparison } : undefined;
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
const compileNode = (
|
|
295
|
+
node: SegmentNode,
|
|
296
|
+
context: SegmentCompileContext,
|
|
297
|
+
now: Date,
|
|
298
|
+
unsupported: string[],
|
|
299
|
+
): SegmentMongoFilter | undefined => {
|
|
300
|
+
if (node.kind === 'field') {
|
|
301
|
+
const compiled = compileField(node, context, now);
|
|
302
|
+
|
|
303
|
+
if (!compiled) {
|
|
304
|
+
unsupported.push(`${node.contentType}.${node.fieldKey}`);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return compiled;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
if (node.kind === 'relation') {
|
|
311
|
+
unsupported.push(node.relationKey);
|
|
312
|
+
return undefined;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
if (node.kind === 'segment') {
|
|
316
|
+
return {
|
|
317
|
+
[SEGMENT_MEMBERSHIP_FIELD]: node.exclude
|
|
318
|
+
? { $ne: node.segmentId }
|
|
319
|
+
: node.segmentId,
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
const compiled = node.children
|
|
324
|
+
.map((child) => compileNode(child, context, now, unsupported))
|
|
325
|
+
.filter((child): child is SegmentMongoFilter => Boolean(child));
|
|
326
|
+
|
|
327
|
+
if (!compiled.length) {
|
|
328
|
+
return undefined;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// only siblings that all have to hold can share one entry
|
|
332
|
+
const children =
|
|
333
|
+
node.conjunction === 'or' ? compiled : mergePropertyRowConditions(compiled);
|
|
334
|
+
|
|
335
|
+
if (children.length === 1) {
|
|
336
|
+
return children[0];
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return node.conjunction === 'or' ? { $or: children } : { $and: children };
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
export const compileSegmentMongoFilter = (
|
|
343
|
+
node: SegmentNode,
|
|
344
|
+
context: SegmentCompileContext,
|
|
345
|
+
): SegmentCompileResult => {
|
|
346
|
+
const unsupported: string[] = [];
|
|
347
|
+
const filter = compileNode(
|
|
348
|
+
node,
|
|
349
|
+
context,
|
|
350
|
+
context.now || new Date(),
|
|
351
|
+
unsupported,
|
|
352
|
+
);
|
|
353
|
+
|
|
354
|
+
return { filter: filter || {}, unsupported };
|
|
355
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SegmentFieldNode,
|
|
3
|
+
SegmentRelationNode,
|
|
4
|
+
SEGMENT_MEMBERSHIP_FIELD,
|
|
5
|
+
} from './nodes';
|
|
6
|
+
|
|
7
|
+
export const segmentReferenceRef = (subjectType: string): string =>
|
|
8
|
+
`${subjectType}.${SEGMENT_MEMBERSHIP_FIELD}`;
|
|
9
|
+
|
|
10
|
+
export const segmentFieldRef = (node: SegmentFieldNode): string =>
|
|
11
|
+
`${node.contentType}.${node.fieldKey}`;
|
|
12
|
+
|
|
13
|
+
const hashValue = (value: unknown): string => {
|
|
14
|
+
const source = JSON.stringify(value);
|
|
15
|
+
let hash = 0x811c9dc5;
|
|
16
|
+
|
|
17
|
+
for (let index = 0; index < source.length; index++) {
|
|
18
|
+
hash ^= source.charCodeAt(index);
|
|
19
|
+
hash = Math.imul(hash, 0x01000193) >>> 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return hash.toString(16).padStart(8, '0');
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const segmentRelationRef = (node: SegmentRelationNode): string =>
|
|
26
|
+
`${node.relationKey}#${hashValue({
|
|
27
|
+
measure: node.measure,
|
|
28
|
+
child: node.child,
|
|
29
|
+
})}`;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { SegmentOperator } from './operators';
|
|
2
|
+
|
|
3
|
+
export type SegmentValue = string | number | boolean | Date | string[];
|
|
4
|
+
|
|
5
|
+
export type SegmentGroupNode = {
|
|
6
|
+
kind: 'group';
|
|
7
|
+
conjunction: 'and' | 'or';
|
|
8
|
+
children: SegmentNode[];
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type SegmentFieldNode = {
|
|
12
|
+
kind: 'field';
|
|
13
|
+
contentType: string;
|
|
14
|
+
fieldKey: string;
|
|
15
|
+
operator: SegmentOperator;
|
|
16
|
+
value?: SegmentValue;
|
|
17
|
+
meta?: Record<string, string>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type SegmentMeasure =
|
|
21
|
+
| { op: 'exists' }
|
|
22
|
+
| { op: 'none' }
|
|
23
|
+
| { op: 'count' }
|
|
24
|
+
| { op: 'sum' | 'avg' | 'min' | 'max'; fieldKey: string };
|
|
25
|
+
|
|
26
|
+
export type SegmentRelationNode = {
|
|
27
|
+
kind: 'relation';
|
|
28
|
+
relationKey: string;
|
|
29
|
+
measure: SegmentMeasure;
|
|
30
|
+
child?: SegmentNode;
|
|
31
|
+
operator?: SegmentOperator;
|
|
32
|
+
value?: SegmentValue;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type SegmentReferenceNode = {
|
|
36
|
+
kind: 'segment';
|
|
37
|
+
segmentId: string;
|
|
38
|
+
exclude?: boolean;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type SegmentNode =
|
|
42
|
+
| SegmentGroupNode
|
|
43
|
+
| SegmentFieldNode
|
|
44
|
+
| SegmentRelationNode
|
|
45
|
+
| SegmentReferenceNode;
|
|
46
|
+
|
|
47
|
+
/** The field every record carries its membership in, added by `schemaWrapper`. */
|
|
48
|
+
export const SEGMENT_MEMBERSHIP_FIELD = 'segmentIds';
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import type { ZonedPeriod } from './zonedTime';
|
|
2
|
+
|
|
3
|
+
export enum SegmentOperator {
|
|
4
|
+
Equals = 'e',
|
|
5
|
+
NotEquals = 'dne',
|
|
6
|
+
Contains = 'c',
|
|
7
|
+
NotContains = 'dnc',
|
|
8
|
+
|
|
9
|
+
IsSet = 'is',
|
|
10
|
+
IsNotSet = 'ins',
|
|
11
|
+
|
|
12
|
+
IsTrue = 'it',
|
|
13
|
+
IsFalse = 'if',
|
|
14
|
+
|
|
15
|
+
In = 'in',
|
|
16
|
+
NotIn = 'nin',
|
|
17
|
+
|
|
18
|
+
NumberGt = 'numberigt',
|
|
19
|
+
NumberLt = 'numberilt',
|
|
20
|
+
|
|
21
|
+
DateGte = 'dateigt',
|
|
22
|
+
DateLte = 'dateilt',
|
|
23
|
+
|
|
24
|
+
MinutesFromNow = 'wobm',
|
|
25
|
+
MinutesAgo = 'woam',
|
|
26
|
+
DaysFromNow = 'wobd',
|
|
27
|
+
DaysAgo = 'woad',
|
|
28
|
+
|
|
29
|
+
AnniversaryToday = 'annt',
|
|
30
|
+
AnniversaryFromNow = 'annfn',
|
|
31
|
+
AnniversaryAgo = 'annago',
|
|
32
|
+
|
|
33
|
+
DateIsSet = 'dateis',
|
|
34
|
+
DateIsNotSet = 'dateins',
|
|
35
|
+
NumberEquals = 'numbere',
|
|
36
|
+
NumberNotEquals = 'numberdne',
|
|
37
|
+
DateThisMonth = 'dtm',
|
|
38
|
+
DateThisQuarter = 'dtq',
|
|
39
|
+
DateThisYear = 'dty',
|
|
40
|
+
|
|
41
|
+
DateRelativeLt = 'drlt',
|
|
42
|
+
DateRelativeGt = 'drgt',
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type SegmentOperatorInput = 'none' | 'field' | 'number';
|
|
46
|
+
|
|
47
|
+
export type SegmentOperatorSpec = {
|
|
48
|
+
value: SegmentOperator;
|
|
49
|
+
label: string;
|
|
50
|
+
input: SegmentOperatorInput;
|
|
51
|
+
hint?: string;
|
|
52
|
+
deprecated?: SegmentOperator;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const SEGMENT_OPERATOR_SPECS: Record<
|
|
56
|
+
SegmentOperator,
|
|
57
|
+
SegmentOperatorSpec
|
|
58
|
+
> = {
|
|
59
|
+
[SegmentOperator.Equals]: {
|
|
60
|
+
value: SegmentOperator.Equals,
|
|
61
|
+
label: 'equals to',
|
|
62
|
+
input: 'field',
|
|
63
|
+
},
|
|
64
|
+
[SegmentOperator.NotEquals]: {
|
|
65
|
+
value: SegmentOperator.NotEquals,
|
|
66
|
+
label: 'is not equal to',
|
|
67
|
+
input: 'field',
|
|
68
|
+
},
|
|
69
|
+
[SegmentOperator.Contains]: {
|
|
70
|
+
value: SegmentOperator.Contains,
|
|
71
|
+
label: 'contains',
|
|
72
|
+
input: 'field',
|
|
73
|
+
},
|
|
74
|
+
[SegmentOperator.NotContains]: {
|
|
75
|
+
value: SegmentOperator.NotContains,
|
|
76
|
+
label: 'does not contain',
|
|
77
|
+
input: 'field',
|
|
78
|
+
},
|
|
79
|
+
[SegmentOperator.IsSet]: {
|
|
80
|
+
value: SegmentOperator.IsSet,
|
|
81
|
+
label: 'is set',
|
|
82
|
+
input: 'none',
|
|
83
|
+
},
|
|
84
|
+
[SegmentOperator.IsNotSet]: {
|
|
85
|
+
value: SegmentOperator.IsNotSet,
|
|
86
|
+
label: 'is not set',
|
|
87
|
+
input: 'none',
|
|
88
|
+
},
|
|
89
|
+
[SegmentOperator.IsTrue]: {
|
|
90
|
+
value: SegmentOperator.IsTrue,
|
|
91
|
+
label: 'is true',
|
|
92
|
+
input: 'none',
|
|
93
|
+
},
|
|
94
|
+
[SegmentOperator.IsFalse]: {
|
|
95
|
+
value: SegmentOperator.IsFalse,
|
|
96
|
+
label: 'is false',
|
|
97
|
+
input: 'none',
|
|
98
|
+
},
|
|
99
|
+
[SegmentOperator.In]: {
|
|
100
|
+
value: SegmentOperator.In,
|
|
101
|
+
label: 'is any of',
|
|
102
|
+
input: 'field',
|
|
103
|
+
},
|
|
104
|
+
[SegmentOperator.NotIn]: {
|
|
105
|
+
value: SegmentOperator.NotIn,
|
|
106
|
+
label: 'is none of',
|
|
107
|
+
input: 'field',
|
|
108
|
+
},
|
|
109
|
+
[SegmentOperator.NumberGt]: {
|
|
110
|
+
value: SegmentOperator.NumberGt,
|
|
111
|
+
label: 'is greater than or equal to',
|
|
112
|
+
input: 'field',
|
|
113
|
+
},
|
|
114
|
+
[SegmentOperator.NumberLt]: {
|
|
115
|
+
value: SegmentOperator.NumberLt,
|
|
116
|
+
label: 'is less than or equal to',
|
|
117
|
+
input: 'field',
|
|
118
|
+
},
|
|
119
|
+
[SegmentOperator.DateGte]: {
|
|
120
|
+
value: SegmentOperator.DateGte,
|
|
121
|
+
label: 'is on or after',
|
|
122
|
+
input: 'field',
|
|
123
|
+
},
|
|
124
|
+
[SegmentOperator.DateLte]: {
|
|
125
|
+
value: SegmentOperator.DateLte,
|
|
126
|
+
label: 'is on or before',
|
|
127
|
+
input: 'field',
|
|
128
|
+
},
|
|
129
|
+
[SegmentOperator.MinutesFromNow]: {
|
|
130
|
+
value: SegmentOperator.MinutesFromNow,
|
|
131
|
+
label: 'minute(s) before',
|
|
132
|
+
input: 'number',
|
|
133
|
+
hint: 'That one minute, not everything between now and then.',
|
|
134
|
+
},
|
|
135
|
+
[SegmentOperator.MinutesAgo]: {
|
|
136
|
+
value: SegmentOperator.MinutesAgo,
|
|
137
|
+
label: 'minute(s) later',
|
|
138
|
+
input: 'number',
|
|
139
|
+
hint: 'That one minute, not everything since.',
|
|
140
|
+
},
|
|
141
|
+
[SegmentOperator.DaysFromNow]: {
|
|
142
|
+
value: SegmentOperator.DaysFromNow,
|
|
143
|
+
label: 'day(s) before',
|
|
144
|
+
input: 'number',
|
|
145
|
+
hint: 'That one day, not everything between now and then.',
|
|
146
|
+
},
|
|
147
|
+
[SegmentOperator.DaysAgo]: {
|
|
148
|
+
value: SegmentOperator.DaysAgo,
|
|
149
|
+
label: 'day(s) later',
|
|
150
|
+
input: 'number',
|
|
151
|
+
hint: 'That one day, not everything since.',
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
[SegmentOperator.AnniversaryToday]: {
|
|
155
|
+
value: SegmentOperator.AnniversaryToday,
|
|
156
|
+
label: 'anniversary is today',
|
|
157
|
+
input: 'none',
|
|
158
|
+
hint: 'The day and month, in any year - a birthday rather than the date itself. Re-checked every night, so it holds only for the day.',
|
|
159
|
+
},
|
|
160
|
+
[SegmentOperator.DateThisMonth]: {
|
|
161
|
+
value: SegmentOperator.DateThisMonth,
|
|
162
|
+
label: 'is in this month',
|
|
163
|
+
input: 'none',
|
|
164
|
+
hint: 'From the 1st of the current month; moves on by itself each month.',
|
|
165
|
+
},
|
|
166
|
+
[SegmentOperator.DateThisQuarter]: {
|
|
167
|
+
value: SegmentOperator.DateThisQuarter,
|
|
168
|
+
label: 'is in this quarter',
|
|
169
|
+
input: 'none',
|
|
170
|
+
hint: 'From the first day of the current quarter; moves on by itself.',
|
|
171
|
+
},
|
|
172
|
+
[SegmentOperator.DateThisYear]: {
|
|
173
|
+
value: SegmentOperator.DateThisYear,
|
|
174
|
+
label: 'is in this year',
|
|
175
|
+
input: 'none',
|
|
176
|
+
hint: 'From January 1st of the current year; moves on by itself each year.',
|
|
177
|
+
},
|
|
178
|
+
[SegmentOperator.AnniversaryFromNow]: {
|
|
179
|
+
value: SegmentOperator.AnniversaryFromNow,
|
|
180
|
+
label: 'anniversary in day(s)',
|
|
181
|
+
input: 'number',
|
|
182
|
+
hint: 'Counts forward to the next time that day and month come round, in any year.',
|
|
183
|
+
},
|
|
184
|
+
[SegmentOperator.AnniversaryAgo]: {
|
|
185
|
+
value: SegmentOperator.AnniversaryAgo,
|
|
186
|
+
label: 'day(s) since anniversary',
|
|
187
|
+
input: 'number',
|
|
188
|
+
hint: 'Counts back to the last time that day and month came round, in any year.',
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
[SegmentOperator.DateIsSet]: {
|
|
192
|
+
value: SegmentOperator.DateIsSet,
|
|
193
|
+
label: 'is set',
|
|
194
|
+
input: 'none',
|
|
195
|
+
deprecated: SegmentOperator.IsSet,
|
|
196
|
+
},
|
|
197
|
+
[SegmentOperator.DateIsNotSet]: {
|
|
198
|
+
value: SegmentOperator.DateIsNotSet,
|
|
199
|
+
label: 'is not set',
|
|
200
|
+
input: 'none',
|
|
201
|
+
deprecated: SegmentOperator.IsNotSet,
|
|
202
|
+
},
|
|
203
|
+
[SegmentOperator.NumberEquals]: {
|
|
204
|
+
value: SegmentOperator.NumberEquals,
|
|
205
|
+
label: 'equals to',
|
|
206
|
+
input: 'field',
|
|
207
|
+
deprecated: SegmentOperator.Equals,
|
|
208
|
+
},
|
|
209
|
+
[SegmentOperator.NumberNotEquals]: {
|
|
210
|
+
value: SegmentOperator.NumberNotEquals,
|
|
211
|
+
label: 'is not equal to',
|
|
212
|
+
input: 'field',
|
|
213
|
+
deprecated: SegmentOperator.NotEquals,
|
|
214
|
+
},
|
|
215
|
+
[SegmentOperator.DateRelativeLt]: {
|
|
216
|
+
value: SegmentOperator.DateRelativeLt,
|
|
217
|
+
label: 'is on or before',
|
|
218
|
+
input: 'field',
|
|
219
|
+
deprecated: SegmentOperator.DateLte,
|
|
220
|
+
},
|
|
221
|
+
[SegmentOperator.DateRelativeGt]: {
|
|
222
|
+
value: SegmentOperator.DateRelativeGt,
|
|
223
|
+
label: 'is on or after',
|
|
224
|
+
input: 'field',
|
|
225
|
+
deprecated: SegmentOperator.DateGte,
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
export const SEGMENT_IMPLICIT_OPERATORS: SegmentOperator[] = [
|
|
230
|
+
SegmentOperator.IsSet,
|
|
231
|
+
SegmentOperator.IsNotSet,
|
|
232
|
+
];
|
|
233
|
+
|
|
234
|
+
export const normalizeSegmentOperator = (
|
|
235
|
+
operator: SegmentOperator,
|
|
236
|
+
): SegmentOperator => SEGMENT_OPERATOR_SPECS[operator]?.deprecated || operator;
|
|
237
|
+
|
|
238
|
+
// Calendar periods holding "now", moving on by themselves.
|
|
239
|
+
export const PERIOD_OPERATORS: Partial<Record<SegmentOperator, ZonedPeriod>> = {
|
|
240
|
+
[SegmentOperator.DateThisMonth]: 'month',
|
|
241
|
+
[SegmentOperator.DateThisQuarter]: 'quarter',
|
|
242
|
+
[SegmentOperator.DateThisYear]: 'year',
|
|
243
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type SegmentOwnedSource = {
|
|
2
|
+
find: (
|
|
3
|
+
query: Record<string, unknown>,
|
|
4
|
+
projection: Record<string, 1>,
|
|
5
|
+
) => Promise<Record<string, unknown>[]>;
|
|
6
|
+
|
|
7
|
+
aggregate?: (
|
|
8
|
+
pipeline: Record<string, unknown>[],
|
|
9
|
+
) => Promise<Record<string, unknown>[]>;
|
|
10
|
+
|
|
11
|
+
baseQuery?: Record<string, unknown>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type SegmentSourceResolver = (
|
|
15
|
+
contentType: string,
|
|
16
|
+
) => SegmentOwnedSource | null;
|