@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,482 @@
|
|
|
1
|
+
import './sentry-instrument';
|
|
2
|
+
import { ApolloServer } from '@apollo/server';
|
|
3
|
+
import { expressMiddleware } from '@apollo/server/express4';
|
|
4
|
+
import { ApolloServerPluginDrainHttpServer } from '@apollo/server/plugin/drainHttpServer';
|
|
5
|
+
import { buildSubgraphSchema } from '@apollo/subgraph';
|
|
6
|
+
import * as trpcExpress from '@trpc/server/adapters/express';
|
|
7
|
+
import cookieParser from 'cookie-parser';
|
|
8
|
+
import cors from 'cors';
|
|
9
|
+
import * as dotenv from 'dotenv';
|
|
10
|
+
import express, {
|
|
11
|
+
Request as ApiRequest,
|
|
12
|
+
Response as ApiResponse,
|
|
13
|
+
Application,
|
|
14
|
+
Router,
|
|
15
|
+
} from 'express';
|
|
16
|
+
import { DocumentNode, GraphQLScalarType } from 'graphql';
|
|
17
|
+
import * as http from 'http';
|
|
18
|
+
import * as path from 'path';
|
|
19
|
+
import rateLimit from 'express-rate-limit';
|
|
20
|
+
import { startPayments } from '../common-modules/payment/worker';
|
|
21
|
+
import type {
|
|
22
|
+
IPropertyMeta,
|
|
23
|
+
LogsConfigs,
|
|
24
|
+
SegmentConfigs,
|
|
25
|
+
TApprovalConfig,
|
|
26
|
+
TRecordReferencesConfig,
|
|
27
|
+
} from '../core-modules';
|
|
28
|
+
import {
|
|
29
|
+
initApproval,
|
|
30
|
+
initPropertyProducers,
|
|
31
|
+
initRecordReferences,
|
|
32
|
+
initSegmentProducers,
|
|
33
|
+
startAutomations,
|
|
34
|
+
} from '../core-modules';
|
|
35
|
+
import { AutomationConfigs } from '../core-modules/automations/types';
|
|
36
|
+
import type { ImportExportConfigs } from '../core-modules/import-export/types';
|
|
37
|
+
import { startImportExportWorker } from '../core-modules/import-export/worker';
|
|
38
|
+
import { IMainContext, IPermissionConfig } from '../core-types';
|
|
39
|
+
import {
|
|
40
|
+
generateApolloContext,
|
|
41
|
+
startBeforeResolvers,
|
|
42
|
+
wrapApolloResolvers,
|
|
43
|
+
expectedErrorPlugin,
|
|
44
|
+
} from './apollo';
|
|
45
|
+
import { BeforeResolversConfig } from './apollo/beforeResolvers';
|
|
46
|
+
import { extractUserFromHeader } from './headers';
|
|
47
|
+
import { AfterProcessConfigs, logHandler, startAfterProcess } from './logs';
|
|
48
|
+
import { closeMongooose } from './mongo';
|
|
49
|
+
import {
|
|
50
|
+
initializePluginConfig,
|
|
51
|
+
joinErxesGateway,
|
|
52
|
+
leaveErxesGateway,
|
|
53
|
+
} from './service-discovery';
|
|
54
|
+
import { createTRPCContext } from './trpc';
|
|
55
|
+
import { mountAgentTools } from './agent-tools';
|
|
56
|
+
import { applyTrustProxy, getSubdomain } from './utils';
|
|
57
|
+
import * as Sentry from '@sentry/node';
|
|
58
|
+
|
|
59
|
+
export const MAX_HEADER_BYTES = 64 * 1024;
|
|
60
|
+
|
|
61
|
+
dotenv.config();
|
|
62
|
+
|
|
63
|
+
enum API_METHODS {
|
|
64
|
+
GET = 'get',
|
|
65
|
+
POST = 'post',
|
|
66
|
+
PUT = 'put',
|
|
67
|
+
PATCH = 'patch',
|
|
68
|
+
DELETE = 'delete',
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
type TAPIMethod = keyof typeof API_METHODS;
|
|
72
|
+
|
|
73
|
+
type IMeta = {
|
|
74
|
+
automations?: AutomationConfigs;
|
|
75
|
+
segments?: SegmentConfigs;
|
|
76
|
+
logs?: LogsConfigs;
|
|
77
|
+
afterProcess?: AfterProcessConfigs;
|
|
78
|
+
payments?: any;
|
|
79
|
+
notifications?: any;
|
|
80
|
+
tags?: any;
|
|
81
|
+
documents?: {
|
|
82
|
+
types: {
|
|
83
|
+
label: string;
|
|
84
|
+
contentType: string;
|
|
85
|
+
}[];
|
|
86
|
+
};
|
|
87
|
+
properties?: IPropertyMeta;
|
|
88
|
+
references?: TRecordReferencesConfig;
|
|
89
|
+
approval?: TApprovalConfig;
|
|
90
|
+
permissions?: IPermissionConfig;
|
|
91
|
+
beforeResolvers?: BeforeResolversConfig;
|
|
92
|
+
importExport?: ImportExportConfigs;
|
|
93
|
+
relations?: {
|
|
94
|
+
subscribedTypes: string[];
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
type ApiHandler = {
|
|
99
|
+
method: TAPIMethod;
|
|
100
|
+
path: string;
|
|
101
|
+
resolver: (req: ApiRequest, res: ApiResponse) => Promise<void> | void;
|
|
102
|
+
};
|
|
103
|
+
type ResolverObject = {
|
|
104
|
+
[key: string]: (...args: any[]) => any;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
type GraphqlResolver = {
|
|
108
|
+
[key: string]: ResolverObject | GraphQLScalarType;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
type ConfigTypes = {
|
|
112
|
+
name: string;
|
|
113
|
+
port: number;
|
|
114
|
+
graphql: () => Promise<{
|
|
115
|
+
resolvers: GraphqlResolver;
|
|
116
|
+
typeDefs: DocumentNode;
|
|
117
|
+
}>;
|
|
118
|
+
expressRouter?: Router;
|
|
119
|
+
apolloServerContext: (
|
|
120
|
+
subdomain: string,
|
|
121
|
+
context: any,
|
|
122
|
+
req: ApiRequest,
|
|
123
|
+
res: ApiResponse,
|
|
124
|
+
) => Promise<IMainContext>;
|
|
125
|
+
onServerInit?: (app: express.Express) => Promise<void>;
|
|
126
|
+
middlewares?: any;
|
|
127
|
+
apiHandlers?: ApiHandler[];
|
|
128
|
+
hasSubscriptions?: boolean;
|
|
129
|
+
corsOptions?: any;
|
|
130
|
+
subscriptionPluginPath?: any;
|
|
131
|
+
trpcAppRouter?: {
|
|
132
|
+
router: any;
|
|
133
|
+
createContext: <TContext>(
|
|
134
|
+
subdomain: string,
|
|
135
|
+
context: any,
|
|
136
|
+
) => Promise<TContext>;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* tRPC procedure paths to exclude from the agent capability manifest.
|
|
140
|
+
* Agent-tools endpoints are mounted automatically on every plugin that
|
|
141
|
+
* supplies a `trpcAppRouter`. Only procedures declaring
|
|
142
|
+
* `.meta({ agent: { permission } })` appear in the manifest; this list
|
|
143
|
+
* removes specific annotated procedures when needed.
|
|
144
|
+
*/
|
|
145
|
+
agentToolsExclude?: string[];
|
|
146
|
+
meta?: IMeta;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
export async function startPlugin(
|
|
150
|
+
configs: ConfigTypes,
|
|
151
|
+
): Promise<express.Express> {
|
|
152
|
+
const {
|
|
153
|
+
//common
|
|
154
|
+
name,
|
|
155
|
+
port,
|
|
156
|
+
// api configs
|
|
157
|
+
corsOptions = {},
|
|
158
|
+
expressRouter,
|
|
159
|
+
middlewares,
|
|
160
|
+
apiHandlers,
|
|
161
|
+
// graphql
|
|
162
|
+
hasSubscriptions,
|
|
163
|
+
subscriptionPluginPath,
|
|
164
|
+
graphql,
|
|
165
|
+
apolloServerContext,
|
|
166
|
+
trpcAppRouter,
|
|
167
|
+
onServerInit,
|
|
168
|
+
// agent capability endpoint exclusions
|
|
169
|
+
agentToolsExclude,
|
|
170
|
+
// meta
|
|
171
|
+
meta,
|
|
172
|
+
} = configs || {};
|
|
173
|
+
const PORT = process.env.PORT ? Number(process.env.PORT) : port;
|
|
174
|
+
|
|
175
|
+
Sentry.getGlobalScope().setTags({
|
|
176
|
+
plugin: name,
|
|
177
|
+
service: name,
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const app = express();
|
|
181
|
+
applyTrustProxy(app);
|
|
182
|
+
app.disable('x-powered-by');
|
|
183
|
+
app.use(cors(corsOptions));
|
|
184
|
+
app.use(
|
|
185
|
+
express.json({
|
|
186
|
+
limit: '15mb',
|
|
187
|
+
verify: (req: any, _res, buf: Buffer) => {
|
|
188
|
+
req.rawBody = buf;
|
|
189
|
+
},
|
|
190
|
+
}),
|
|
191
|
+
);
|
|
192
|
+
app.use(cookieParser());
|
|
193
|
+
|
|
194
|
+
// for health check
|
|
195
|
+
app.get('/health', async (_req, res) => {
|
|
196
|
+
res.end('ok');
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
app.get('/debug-sentry', () => {
|
|
200
|
+
throw new Error('Sentry test error: ' + new Date().toISOString());
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
if (expressRouter) {
|
|
204
|
+
app.use(expressRouter);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (middlewares) {
|
|
208
|
+
for (const middleware of middlewares) {
|
|
209
|
+
app.use(middleware);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (apiHandlers) {
|
|
214
|
+
for (const handler of apiHandlers) {
|
|
215
|
+
const { method, path, resolver } = handler;
|
|
216
|
+
|
|
217
|
+
type LowercaseMethod = (typeof API_METHODS)[TAPIMethod];
|
|
218
|
+
|
|
219
|
+
// Ensure `method` is one of the keys
|
|
220
|
+
const METHOD = API_METHODS[method] as LowercaseMethod;
|
|
221
|
+
type TApiMethodApp = Record<
|
|
222
|
+
LowercaseMethod,
|
|
223
|
+
Application[LowercaseMethod]
|
|
224
|
+
>;
|
|
225
|
+
|
|
226
|
+
(app as TApiMethodApp)[METHOD](
|
|
227
|
+
path,
|
|
228
|
+
async (req: ApiRequest, res: ApiResponse) => {
|
|
229
|
+
return await logHandler(async () => await resolver(req, res), {
|
|
230
|
+
subdomain: getSubdomain(req),
|
|
231
|
+
source: 'webhook',
|
|
232
|
+
action: method,
|
|
233
|
+
payload: {
|
|
234
|
+
path,
|
|
235
|
+
headers: req.headers,
|
|
236
|
+
body: req.body,
|
|
237
|
+
query: req?.query,
|
|
238
|
+
},
|
|
239
|
+
userId: extractUserFromHeader(req.headers)?._id,
|
|
240
|
+
});
|
|
241
|
+
},
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (hasSubscriptions) {
|
|
247
|
+
if (!subscriptionPluginPath) {
|
|
248
|
+
throw new Error(
|
|
249
|
+
'subscriptionPluginPath is required when hasSubscriptions is true',
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Protects the public subscription bundle endpoint from request floods.
|
|
255
|
+
*
|
|
256
|
+
* The limit is intentionally generous so regular page loads, retries, and
|
|
257
|
+
* normal multi-user traffic are not blocked. It only throttles abnormal
|
|
258
|
+
* high-frequency bursts from the same IP.
|
|
259
|
+
*/
|
|
260
|
+
const subscriptionFileLimiter = rateLimit({
|
|
261
|
+
windowMs: 15 * 60 * 1000,
|
|
262
|
+
max: 1000,
|
|
263
|
+
standardHeaders: true,
|
|
264
|
+
legacyHeaders: false,
|
|
265
|
+
message: 'Too many requests from this IP, please try again later.',
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
app.get('/subscriptionPlugin.js', subscriptionFileLimiter, (_req, res) => {
|
|
269
|
+
res.sendFile(path.resolve(subscriptionPluginPath));
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (trpcAppRouter) {
|
|
274
|
+
const { router, createContext } = trpcAppRouter;
|
|
275
|
+
app.use(
|
|
276
|
+
'/trpc',
|
|
277
|
+
trpcExpress.createExpressMiddleware({
|
|
278
|
+
router,
|
|
279
|
+
createContext: createTRPCContext(createContext),
|
|
280
|
+
}),
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// Agent capability endpoints are mounted automatically on every plugin with
|
|
285
|
+
// a tRPC router. The manifest is admit-only: only procedures declaring
|
|
286
|
+
// `.meta({ agent: { permission } })` are exposed, so an empty router
|
|
287
|
+
// produces an empty manifest and zero callable tools.
|
|
288
|
+
if (trpcAppRouter) {
|
|
289
|
+
mountAgentTools(app, {
|
|
290
|
+
plugin: name,
|
|
291
|
+
trpcRouter: trpcAppRouter.router,
|
|
292
|
+
createContext: trpcAppRouter.createContext,
|
|
293
|
+
exclude: agentToolsExclude || [],
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
app.use((req: any, _res, next) => {
|
|
298
|
+
if (req.rawBody === undefined) {
|
|
299
|
+
req.rawBody = '';
|
|
300
|
+
|
|
301
|
+
req.on('data', (chunk: any) => {
|
|
302
|
+
req.rawBody += chunk.toString();
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
next();
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
// Error handling middleware
|
|
310
|
+
// app.use((error: any, _req: any, res: any) => {
|
|
311
|
+
// const msg = filterXSS(error.message);
|
|
312
|
+
|
|
313
|
+
// // debugError(`Error: ${msg}`);
|
|
314
|
+
|
|
315
|
+
// res.status(500).send(msg);
|
|
316
|
+
// });
|
|
317
|
+
|
|
318
|
+
const httpServer = http.createServer(
|
|
319
|
+
{ maxHeaderSize: MAX_HEADER_BYTES },
|
|
320
|
+
app,
|
|
321
|
+
);
|
|
322
|
+
httpServer.keepAliveTimeout = 120000;
|
|
323
|
+
httpServer.headersTimeout = 121000;
|
|
324
|
+
|
|
325
|
+
// GRACEFULL SHUTDOWN
|
|
326
|
+
process.stdin.resume(); // so the program will not close instantly
|
|
327
|
+
|
|
328
|
+
async function closeHttpServer() {
|
|
329
|
+
try {
|
|
330
|
+
await new Promise<void>((resolve, reject) => {
|
|
331
|
+
// Stops the server from accepting new connections and finishes existing connections.
|
|
332
|
+
httpServer.close((error: Error | undefined) => {
|
|
333
|
+
if (error) {
|
|
334
|
+
return reject(error);
|
|
335
|
+
}
|
|
336
|
+
resolve();
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
} catch (e) {
|
|
340
|
+
console.error(e);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
async function leaveServiceDiscovery() {
|
|
345
|
+
try {
|
|
346
|
+
await leaveErxesGateway(name, PORT);
|
|
347
|
+
console.log(`Left service discovery. name=${name} port=${PORT}`);
|
|
348
|
+
} catch (e) {
|
|
349
|
+
console.error(e);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// If the Node process ends, close the Mongoose connection
|
|
354
|
+
(['SIGINT', 'SIGTERM'] as NodeJS.Signals[]).forEach((sig) => {
|
|
355
|
+
process.on(sig, async () => {
|
|
356
|
+
await closeHttpServer();
|
|
357
|
+
await closeMongooose();
|
|
358
|
+
await leaveServiceDiscovery();
|
|
359
|
+
process.exit(0);
|
|
360
|
+
});
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
const generateApolloServer = async () => {
|
|
364
|
+
// const services = await getServices();
|
|
365
|
+
// debugInfo(`Enabled services .... ${JSON.stringify(services)}`);
|
|
366
|
+
|
|
367
|
+
const { typeDefs, resolvers } = await graphql();
|
|
368
|
+
|
|
369
|
+
return new ApolloServer({
|
|
370
|
+
schema: buildSubgraphSchema([
|
|
371
|
+
{
|
|
372
|
+
typeDefs,
|
|
373
|
+
resolvers: wrapApolloResolvers(resolvers as any),
|
|
374
|
+
},
|
|
375
|
+
]),
|
|
376
|
+
|
|
377
|
+
// for graceful shutdown
|
|
378
|
+
plugins: [
|
|
379
|
+
ApolloServerPluginDrainHttpServer({ httpServer }),
|
|
380
|
+
expectedErrorPlugin,
|
|
381
|
+
],
|
|
382
|
+
});
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
const apolloServer = await generateApolloServer();
|
|
386
|
+
await apolloServer.start();
|
|
387
|
+
|
|
388
|
+
app.use(
|
|
389
|
+
'/graphql',
|
|
390
|
+
expressMiddleware(apolloServer, {
|
|
391
|
+
context: generateApolloContext<IMainContext>(apolloServerContext),
|
|
392
|
+
}),
|
|
393
|
+
);
|
|
394
|
+
|
|
395
|
+
await new Promise<void>((resolve) =>
|
|
396
|
+
httpServer.listen({ port: PORT }, resolve),
|
|
397
|
+
);
|
|
398
|
+
|
|
399
|
+
console.log(
|
|
400
|
+
`🚀 ${name} graphql api ready at http://localhost:${PORT}/graphql`,
|
|
401
|
+
);
|
|
402
|
+
|
|
403
|
+
await joinErxesGateway({
|
|
404
|
+
name,
|
|
405
|
+
port: PORT,
|
|
406
|
+
hasSubscriptions,
|
|
407
|
+
meta,
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
if (meta) {
|
|
411
|
+
const {
|
|
412
|
+
automations,
|
|
413
|
+
segments,
|
|
414
|
+
afterProcess,
|
|
415
|
+
notifications,
|
|
416
|
+
payments,
|
|
417
|
+
beforeResolvers,
|
|
418
|
+
references,
|
|
419
|
+
importExport,
|
|
420
|
+
approval,
|
|
421
|
+
properties,
|
|
422
|
+
} = meta || {};
|
|
423
|
+
|
|
424
|
+
if (beforeResolvers) {
|
|
425
|
+
await startBeforeResolvers(app, name, beforeResolvers);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
if (afterProcess) {
|
|
429
|
+
await startAfterProcess(app, name, afterProcess);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
if (references) {
|
|
433
|
+
await initRecordReferences(app, name, references);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
if (approval) {
|
|
437
|
+
await initApproval(app, name, approval);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
if (automations) {
|
|
441
|
+
await startAutomations(app, name, automations);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
if (segments) {
|
|
445
|
+
await initSegmentProducers(app, name, segments);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
if (properties?.valueUsage) {
|
|
449
|
+
initPropertyProducers(app, properties.valueUsage);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
if (notifications) {
|
|
453
|
+
await initializePluginConfig(name, 'notifications', notifications);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
if (importExport) {
|
|
457
|
+
startImportExportWorker({
|
|
458
|
+
pluginName: name,
|
|
459
|
+
config: importExport,
|
|
460
|
+
app,
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
if (payments) {
|
|
465
|
+
await startPayments(name, payments);
|
|
466
|
+
}
|
|
467
|
+
} // end meta if
|
|
468
|
+
|
|
469
|
+
if (onServerInit) {
|
|
470
|
+
onServerInit(app);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// applyInspectorEndpoints(name);
|
|
474
|
+
|
|
475
|
+
// debugInfo(`${name} server is running on port: ${PORT}`);
|
|
476
|
+
|
|
477
|
+
Sentry.setupExpressErrorHandler(app);
|
|
478
|
+
|
|
479
|
+
return app;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
export default startPlugin;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import * as crypto from 'crypto';
|
|
2
|
+
|
|
3
|
+
export const stripAnsi = async (str: string) => {
|
|
4
|
+
let stripAnsiModule: ((str: string) => string) | null = null;
|
|
5
|
+
|
|
6
|
+
if (!stripAnsiModule) {
|
|
7
|
+
const { default: imported } = await import('strip-ansi');
|
|
8
|
+
stripAnsiModule = imported;
|
|
9
|
+
}
|
|
10
|
+
return stripAnsiModule(str);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Removes the last trailing slash from a string if it exists.
|
|
15
|
+
*
|
|
16
|
+
* @param text - the string to remove the trailing slash from
|
|
17
|
+
* @returns the modified string with the trailing slash removed
|
|
18
|
+
*/
|
|
19
|
+
export const removeLastTrailingSlash = (text: string) => {
|
|
20
|
+
return text.replace(/\/$/, '');
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Replaces multiple whitespace characters in a string with a single space and trims
|
|
25
|
+
* the string of leading and trailing whitespace.
|
|
26
|
+
*
|
|
27
|
+
* @param text - the string to remove extra spaces from
|
|
28
|
+
* @returns the modified string with extra spaces removed
|
|
29
|
+
*/
|
|
30
|
+
export const removeExtraSpaces = (text: string) => {
|
|
31
|
+
return text.replaceAll(/\s+/g, ' ').trim();
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Checks if the given string is a valid URL.
|
|
36
|
+
*
|
|
37
|
+
* @param url - the string to check
|
|
38
|
+
* @returns true if the string is a valid URL, false otherwise
|
|
39
|
+
*/
|
|
40
|
+
export const isValidURL = (url: string): boolean => {
|
|
41
|
+
try {
|
|
42
|
+
return Boolean(new URL(url));
|
|
43
|
+
} catch {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Splits text into chunks of strings limited by the given character count.
|
|
50
|
+
*
|
|
51
|
+
* Regex explanation:
|
|
52
|
+
* .{1,100}(\\s|$)
|
|
53
|
+
* - . → matches any character (except line terminators)
|
|
54
|
+
* - {1,100} → matches 1 to 100 of the preceding token
|
|
55
|
+
* - (\\s|$) → ends with a whitespace OR end of string
|
|
56
|
+
*
|
|
57
|
+
* @param str - Text to be split
|
|
58
|
+
* @param size - Character length of each chunk
|
|
59
|
+
* @returns An array of string chunks
|
|
60
|
+
*/
|
|
61
|
+
export const splitStr = async (
|
|
62
|
+
str: string,
|
|
63
|
+
size: number,
|
|
64
|
+
): Promise<string[]> => {
|
|
65
|
+
const cleanStr = await stripAnsi(str);
|
|
66
|
+
|
|
67
|
+
const regex = new RegExp(String.raw`.{1,${size}}(\s|$)`, 'g');
|
|
68
|
+
|
|
69
|
+
const matches: string[] = [];
|
|
70
|
+
let match;
|
|
71
|
+
while ((match = regex.exec(cleanStr)) !== null) {
|
|
72
|
+
matches.push(match[0]);
|
|
73
|
+
}
|
|
74
|
+
return matches;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Cleans the given HTML content by removing ANSI escape codes
|
|
79
|
+
* and truncating the result to a maximum of 100 characters.
|
|
80
|
+
*
|
|
81
|
+
* @param content - The HTML content to be cleaned.
|
|
82
|
+
* @returns The cleaned content as a string.
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
export const cleanHtml = async (content?: string): Promise<string> =>
|
|
86
|
+
(await stripAnsi(content || '')).substring(0, 100);
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Escapes a string so that it can be used in a regular expression.
|
|
90
|
+
* This escapes all characters that have special meanings in regular
|
|
91
|
+
* expressions, so that the string can be used verbatim in a regular
|
|
92
|
+
* expression.
|
|
93
|
+
*
|
|
94
|
+
* @param {string} str the string to escape
|
|
95
|
+
* @returns {string} the escaped string
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Takes an array of strings and returns a single string that is
|
|
99
|
+
* suitable for use as a search query. The function trims the
|
|
100
|
+
* resulting string to 512 characters if it is longer than that.
|
|
101
|
+
*
|
|
102
|
+
* @param {string[]} values an array of strings to join
|
|
103
|
+
* @returns {string} a single string suitable for use as a search query
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Generates a random string of a given length using a given pattern.
|
|
108
|
+
*
|
|
109
|
+
* The pattern string can contain the following special characters:
|
|
110
|
+
* - `a`: lowercase letters
|
|
111
|
+
* - `A`: uppercase letters
|
|
112
|
+
* - `0`: numbers
|
|
113
|
+
* - `!`: special characters
|
|
114
|
+
*
|
|
115
|
+
* Any other characters in the pattern string are interpreted as literal
|
|
116
|
+
* characters and are included in the resulting string.
|
|
117
|
+
*
|
|
118
|
+
* If no valid pattern is provided, the function throws an error.
|
|
119
|
+
*
|
|
120
|
+
* @param {string} pattern the pattern to use when generating the string
|
|
121
|
+
* @param {number} length the length of the resulting string
|
|
122
|
+
* @returns {string} the generated string
|
|
123
|
+
*/
|
|
124
|
+
export const random = (pattern: string, length: number) => {
|
|
125
|
+
const maskMap: Record<string, string> = {
|
|
126
|
+
a: 'abcdefghijklmnopqrstuvwxyz',
|
|
127
|
+
A: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
|
|
128
|
+
'0': '0123456789',
|
|
129
|
+
'!': '~`!@#$%^&*()_+-={}[]:";\'<>?,./|\\',
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
let chars = '';
|
|
133
|
+
|
|
134
|
+
for (const char of pattern) {
|
|
135
|
+
if (maskMap[char]) {
|
|
136
|
+
chars += maskMap[char];
|
|
137
|
+
} else {
|
|
138
|
+
chars += char;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (!chars) throw new Error('No valid pattern provided.');
|
|
143
|
+
|
|
144
|
+
let result = '';
|
|
145
|
+
|
|
146
|
+
const maxByte = 255;
|
|
147
|
+
const maxMultiple = Math.floor(maxByte / chars.length) * chars.length;
|
|
148
|
+
|
|
149
|
+
while (result.length < length) {
|
|
150
|
+
const randomBytes = crypto.randomBytes(1);
|
|
151
|
+
const randomValue = randomBytes[0];
|
|
152
|
+
|
|
153
|
+
if (randomValue < maxMultiple) {
|
|
154
|
+
result += chars[randomValue % chars.length];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return result;
|
|
159
|
+
};
|