@erxes/api-shared 3.3.3-next.1 → 3.3.3-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var startPlugin = require('../../dist/start-plugin-2944ceaa.cjs.dev.js');
5
+ var startPlugin = require('../../dist/start-plugin-2c3dcde9.cjs.dev.js');
6
6
  var dayjs = require('dayjs');
7
7
  require('node-fetch');
8
8
  var nanoid = require('nanoid');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var startPlugin = require('../../dist/start-plugin-7ebe8e9b.cjs.prod.js');
5
+ var startPlugin = require('../../dist/start-plugin-882163d1.cjs.prod.js');
6
6
  var dayjs = require('dayjs');
7
7
  require('node-fetch');
8
8
  var nanoid = require('nanoid');
@@ -1,5 +1,5 @@
1
- import { _ as _asyncToGenerator, a as _regeneratorRuntime, x as _toConsumableArray, c9 as isSameRecordReferenceType, i as _objectSpread2, k as _createForOfIteratorHelper, ca as normalizeRecordReferenceTypes, cb as normalizeRecordReferenceExtensions, b6 as getPlugin, b1 as getPlugins, cc as propertyDataPath, cd as toPropertyRowKey, ce as getLocalRecordReferenceType, cf as getRecordReferencePluginName, cg as _typeof, h as _slicedToArray, ch as resolveRecordReferenceValue, ci as _toArray, cj as AUTOMATION_ERROR_CODES, s as sendWorkerQueue, ck as _objectWithoutProperties, cl as _toPropertyKey, cm as replaceOutputPlaceholders, ap as redis, p as sendTRPCMessage, cn as SEGMENT_MEMBERSHIP_FIELD, co as parsePropertyDataKey, cp as toPropertyGroupKey, cq as walkSegmentNodes, cr as segmentFieldRef, cs as segmentReferenceRef, ct as segmentRelationRef, cu as DEFAULT_SEGMENT_TIME_ZONE, cv as normalizeSegmentOperator, cw as SegmentOperator, cx as PERIOD_OPERATORS, cy as zonedPeriodRange, cz as shiftZonedDays, cA as zonedDate, cB as isAnniversary, w as _defineProperty, cC as compileSegmentMongoFilter, g as getEnv, cD as gatherSegmentRelations, bu as escapeRegExp, cE as mergePropertyRowConditions, cF as parsePropertyColumnKey, cG as isPropertyGroupKey, cH as propertyGroupIdFromKey, cI as toPropertyRowColumnKey, cJ as PROPERTIES_DATA, cK as logActivityLogError, cL as matchesFieldPattern$1, cM as findResolver, cN as getSnapshot, cO as detectAssignmentDelta, c2 as ExpectedError, m as _createClass, n as _classCallCheck } from '../../dist/start-plugin-b4d9fece.esm.js';
2
- export { fI as APPROVAL_APPROVER_SCOPES, fM as APPROVAL_DECISIONS, fH as APPROVAL_LOCK_STATUSES, fJ as APPROVAL_MODES, fO as APPROVAL_NOTIFICATION_ACTIONS, fN as APPROVAL_NOTIFICATION_CONTENT_TYPE, fL as APPROVAL_REQUEST_KINDS, fK as APPROVAL_REQUEST_STATUSES, dO as AUTOMATION_ACTION_CONTRIBUTIONS, dD as AUTOMATION_CORE_ACTIONS, dI as AUTOMATION_CORE_ACTION_DEFERRED, dJ as AUTOMATION_CORE_ACTION_PLACEMENTS, dE as AUTOMATION_CORE_TRIGGER_TYPES, dK as AUTOMATION_DEFERRED_TIMEOUT, dG as AUTOMATION_EMAIL_RECIPIENTS_TYPES, cj as AUTOMATION_ERROR_CODES, dT as AUTOMATION_EXECUTION_STATUS, dH as AUTOMATION_NON_DEFERRABLE_CORE_ACTIONS, dZ as AUTOMATION_OUTPUT_ITEM_COUNT, dA as AUTOMATION_PROPERTY_OPERATORS, dC as AUTOMATION_STATUSES, gi as AUTO_MATCH_CONFIDENCE, f6 as ApplyMembershipInput, ea as AutomationActionInput, e7 as AutomationBaseInput, e8 as AutomationExecActionInput, e9 as AutomationExecutionInput, dM as BROADCAST_TARGET_TYPE, dL as BROADCAST_TRIGGER_TYPE, g9 as BatchSkipRowInput, d3 as COMPANY_BUSINESS_TYPES, d5 as COMPANY_INDUSTRY_TYPES, df as CUSTOMER_SELECT_OPTIONS, ek as CheckCustomTriggerInput, ed as CheckCustomTriggerInputData, f5 as CountSegmentMembersInput, d4 as DEFAULT_COMPANY_INDUSTRY_TYPES, da as DEFAULT_CONSTANT_VALUES, cu as DEFAULT_SEGMENT_TIME_ZONE, eV as DEFAULT_SEGMENT_VALUE_FIELD, d8 as DEFAULT_SEX_CHOICES, d6 as DEFAULT_SOCIAL_LINKS, fr as EMAIL_LANES, fu as EMAIL_RAMP_ID, fq as EMAIL_SCREEN_REASONS, dP as EXECUTE_WAIT_TYPES, f3 as EvaluateFieldsInput, el as FindObjectInput, ee as FindObjectInputData, eo as GenerateAiContextInput, eh as GenerateAiContextInputData, ga as GetExportDataInput, g8 as GetExportHeadersInput, gc as GetImportHeadersInput, gd as GetImportHeadersOutput, di as INPUT_TYPE, g7 as InsertImportRowsInput, g4 as InsertImportRowsInputSchema, gb as InsertImportRowsOutput, f4 as ListSegmentMembersInput, ep as LoadAiKnowledgeDocumentBatchInput, ei as LoadAiKnowledgeDocumentBatchInputData, eq as LookupAiToolInput, ej as LookupAiToolInputData, cx as PERIOD_OPERATORS, cJ as PROPERTIES_DATA, f9 as PROPERTY_ANY_ROW_KEY_SEP, f7 as PROPERTY_GROUP_KEY_PREFIX, fe as PROPERTY_ROW_INDEX_SEP, f8 as PROPERTY_ROW_KEY_SEP, fh as PropertyValueUsageInput, ec as ReceiveActionsInput, eb as ReceiveActionsInputData, em as ResolveOutputPathsInput, ef as ResolveOutputPathsInputData, ey as SEGMENT_BOOLEAN_OPERATORS, ex as SEGMENT_DATE_OPERATORS, ev as SEGMENT_ID_OPERATORS, e_ as SEGMENT_IMPLICIT_OPERATORS, cn as SEGMENT_MEMBERSHIP_FIELD, ew as SEGMENT_NUMBER_OPERATORS, eZ as SEGMENT_OPERATOR_SPECS, eD as SEGMENT_QUEUES, eu as SEGMENT_TEXT_OPERATORS, d9 as SEX_OPTIONS, d7 as SOCIAL_LINKS, dB as STATIC_PLACEHOLDER, d2 as STATUSES, dd as STRUCTURE_STATUSES, gj as SUGGEST_CONFIDENCE, f2 as SegmentBaseInput, ez as SegmentField, f1 as SegmentNodeSchema, cw as SegmentOperator, en as SetPropertiesInput, eg as SetPropertiesInputData, fP as TApprovalChangeProducers, dR as TAutomationActionFolks, dF as TAutomationFindObjectType, dQ as TAutomationProducers, g5 as TImportExportProducers, fg as TPropertyProducers, f0 as TSegmentProducers, fj as UNKNOWN_VALUE_COUNTS, fi as UNKNOWN_VALUE_SAMPLES, dh as USER_EXPORT_EXTENDED_FIELDS, dg as USER_EXTENDED_FIELDS, de as USER_MOVEMENT_STATUSES, dc as USER_PROPERTIES_INFO, db as USER_ROLES, g1 as USER_TYPES, fp as activityLogsSchema, dV as aiAgentSchema, eR as anniversaryRanges, dr as appSchema, fU as approvalChangeApplyInputSchema, fC as approvalChangePluginName, fQ as approvalLockCheckInputSchema, fS as approvalLockCreateInputSchema, fR as approvalLockStatesInputSchema, fT as approvalRequestCreateInputSchema, dl as attachmentSchema, dU as automationExecutionSchema, dS as automationSchema, e6 as buildRuntimeOutputsIndex, ds as buildSetPropertyModifier, cX as canGroup, cT as checkLogin, c_ as checkPermissionGroup, cW as clearGroupActionsCache, fV as clientPortalSchema, eT as collectSegmentReferences, eS as collectSegmentValueRefs, g2 as commentSchema, cC as compileSegmentMongoFilter, gn as countCsvDataRows, fW as cpNotificationConfigUserSchema, g3 as cpNotificationSchema, fY as cpNotificationSettingsSchema, fX as cpTwoFactor, g0 as cpUserSchema, dn as createEventHandlers, f as createScopedEventHandlers, dj as customFieldSchema, cO as detectAssignmentDelta, fs as emailAddressSchema, ft as emailDeliverySchema, fv as emailRampSchema, fw as emailSenderSchema, f$ as fcmDeviceSchema, fb as fieldIdFromPropertyDataPath, cM as findResolver, eL as gatherSegmentEventTypes, eN as gatherSegmentFieldSources, eO as gatherSegmentJoinPaths, eM as gatherSegmentRecordTypes, cD as gatherSegmentRelations, dq as generateEventHandlersFromRequest, d_ as getAutomationActionConstant, e3 as getAutomationNodeType, dv as getContentType, cV as getGroupActionsMap, ge as getImportExportJobOptions, dw as getModuleName, dx as getPluginName, dt as getSetPropertySelector, cN as getSnapshot, dN as getTriggerTargetType, dY as getValueByPath, cY as hasDeclaredOAuthScopes, eU as hasSegmentReferenceInRelation, fG as initApproval, ff as initPropertyProducers, dm as initRecordReferences, e$ as initSegmentProducers, cB as isAnniversary, eQ as isLeapYear, fa as isPropertyDataPath, cG as isPropertyGroupKey, d$ as isReEnrollableTrigger, e0 as isReEnrollingTrigger, fE as localApprovalChangeType, cK as logActivityLogError, gg as logImportExportEvent, fo as logsSchema, dX as matchAutomationResolverKey, gl as matchImportHeaders, cL as matchesFieldPattern, fm as measurePropertyValueCounts, fl as measurePropertyValueSamples, fn as measurePropertyValueUsage, cE as mergePropertyRowConditions, fD as normalizeApprovalChangeType, fF as normalizeApprovalConfig, e5 as normalizeAutomationConstantsForTransport, gk as normalizeHeader, cv as normalizeSegmentOperator, fx as notificationSchema, fy as notificationSettingsSchema, fz as notificationZTypeSchema, cF as parsePropertyColumnKey, co as parsePropertyDataKey, cP as permissionGroupSchema, cR as permissionSchema, gm as processCSVStream, fc as propertyDataExistsFilter, cc as propertyDataPath, fd as propertyDataRegexFilter, cH as propertyGroupIdFromKey, fZ as refreshTokenSchema, cm as replaceOutputPlaceholders, cZ as resolveActionOAuthScopes, e1 as resolveAutomationActionInputs, dW as resolveFromSourceField, e2 as resolveOutputPathsByNodeType, ch as resolveRecordReferenceValue, eX as resolveSegmentFieldDependencies, eW as resolveSegmentFieldOperators, eY as resolveSegmentValueField, cS as roleSchema, dk as ruleSchema, gh as safeCleanup, eF as scheduleSegmentReconcile, eB as segmentDependencies, eA as segmentDependencyKey, eC as segmentDependsOnClock, cr as segmentFieldRef, eK as segmentJoinChanges, eE as segmentQueueFor, cs as segmentReferenceRef, ct as segmentRelationRef, et as sendAutomationDeferredCompletion, es as sendAutomationRun, er as sendAutomationTrigger, fA as sendNotification, fB as sendNotificationChannels, eG as sendSegmentChanged, eJ as sendSegmentForget, eI as sendSegmentRebuild, eH as sendSegmentReconcile, dp as setEventHandlerRuntimeContext, du as setProperty, cz as shiftZonedDays, f_ as socialAuthProviderSchema, dy as splitType, dz as startAutomations, g6 as startImportExportWorker, cp as toPropertyGroupKey, cI as toPropertyRowColumnKey, cd as toPropertyRowKey, gf as toTerminalImportExportError, e4 as toTransportOutput, fk as unknownValueUsage, cQ as userGroupSchema, d1 as userMovemmentSchema, d0 as userSchema, cq as walkSegmentNodes, cU as wrapPermission, c$ as wrapPublicResolver, cA as zonedDate, eP as zonedDayStart, cy as zonedPeriodRange } from '../../dist/start-plugin-b4d9fece.esm.js';
1
+ import { _ as _asyncToGenerator, a as _regeneratorRuntime, x as _toConsumableArray, c9 as isSameRecordReferenceType, i as _objectSpread2, k as _createForOfIteratorHelper, ca as normalizeRecordReferenceTypes, cb as normalizeRecordReferenceExtensions, b6 as getPlugin, b1 as getPlugins, cc as propertyDataPath, cd as toPropertyRowKey, ce as getLocalRecordReferenceType, cf as getRecordReferencePluginName, cg as _typeof, h as _slicedToArray, ch as resolveRecordReferenceValue, ci as _toArray, cj as AUTOMATION_ERROR_CODES, s as sendWorkerQueue, ck as _objectWithoutProperties, cl as _toPropertyKey, cm as replaceOutputPlaceholders, ap as redis, p as sendTRPCMessage, cn as SEGMENT_MEMBERSHIP_FIELD, co as parsePropertyDataKey, cp as toPropertyGroupKey, cq as walkSegmentNodes, cr as segmentFieldRef, cs as segmentReferenceRef, ct as segmentRelationRef, cu as DEFAULT_SEGMENT_TIME_ZONE, cv as normalizeSegmentOperator, cw as SegmentOperator, cx as PERIOD_OPERATORS, cy as zonedPeriodRange, cz as shiftZonedDays, cA as zonedDate, cB as isAnniversary, w as _defineProperty, cC as compileSegmentMongoFilter, g as getEnv, cD as gatherSegmentRelations, bu as escapeRegExp, cE as mergePropertyRowConditions, cF as parsePropertyColumnKey, cG as isPropertyGroupKey, cH as propertyGroupIdFromKey, cI as toPropertyRowColumnKey, cJ as PROPERTIES_DATA, cK as logActivityLogError, cL as matchesFieldPattern$1, cM as findResolver, cN as getSnapshot, cO as detectAssignmentDelta, c2 as ExpectedError, m as _createClass, n as _classCallCheck } from '../../dist/start-plugin-322626b5.esm.js';
2
+ export { fI as APPROVAL_APPROVER_SCOPES, fM as APPROVAL_DECISIONS, fH as APPROVAL_LOCK_STATUSES, fJ as APPROVAL_MODES, fO as APPROVAL_NOTIFICATION_ACTIONS, fN as APPROVAL_NOTIFICATION_CONTENT_TYPE, fL as APPROVAL_REQUEST_KINDS, fK as APPROVAL_REQUEST_STATUSES, dO as AUTOMATION_ACTION_CONTRIBUTIONS, dD as AUTOMATION_CORE_ACTIONS, dI as AUTOMATION_CORE_ACTION_DEFERRED, dJ as AUTOMATION_CORE_ACTION_PLACEMENTS, dE as AUTOMATION_CORE_TRIGGER_TYPES, dK as AUTOMATION_DEFERRED_TIMEOUT, dG as AUTOMATION_EMAIL_RECIPIENTS_TYPES, cj as AUTOMATION_ERROR_CODES, dT as AUTOMATION_EXECUTION_STATUS, dH as AUTOMATION_NON_DEFERRABLE_CORE_ACTIONS, dZ as AUTOMATION_OUTPUT_ITEM_COUNT, dA as AUTOMATION_PROPERTY_OPERATORS, dC as AUTOMATION_STATUSES, gi as AUTO_MATCH_CONFIDENCE, f6 as ApplyMembershipInput, ea as AutomationActionInput, e7 as AutomationBaseInput, e8 as AutomationExecActionInput, e9 as AutomationExecutionInput, dM as BROADCAST_TARGET_TYPE, dL as BROADCAST_TRIGGER_TYPE, g9 as BatchSkipRowInput, d3 as COMPANY_BUSINESS_TYPES, d5 as COMPANY_INDUSTRY_TYPES, df as CUSTOMER_SELECT_OPTIONS, ek as CheckCustomTriggerInput, ed as CheckCustomTriggerInputData, f5 as CountSegmentMembersInput, d4 as DEFAULT_COMPANY_INDUSTRY_TYPES, da as DEFAULT_CONSTANT_VALUES, cu as DEFAULT_SEGMENT_TIME_ZONE, eV as DEFAULT_SEGMENT_VALUE_FIELD, d8 as DEFAULT_SEX_CHOICES, d6 as DEFAULT_SOCIAL_LINKS, fr as EMAIL_LANES, fu as EMAIL_RAMP_ID, fq as EMAIL_SCREEN_REASONS, dP as EXECUTE_WAIT_TYPES, f3 as EvaluateFieldsInput, el as FindObjectInput, ee as FindObjectInputData, eo as GenerateAiContextInput, eh as GenerateAiContextInputData, ga as GetExportDataInput, g8 as GetExportHeadersInput, gc as GetImportHeadersInput, gd as GetImportHeadersOutput, di as INPUT_TYPE, g7 as InsertImportRowsInput, g4 as InsertImportRowsInputSchema, gb as InsertImportRowsOutput, f4 as ListSegmentMembersInput, ep as LoadAiKnowledgeDocumentBatchInput, ei as LoadAiKnowledgeDocumentBatchInputData, eq as LookupAiToolInput, ej as LookupAiToolInputData, cx as PERIOD_OPERATORS, cJ as PROPERTIES_DATA, f9 as PROPERTY_ANY_ROW_KEY_SEP, f7 as PROPERTY_GROUP_KEY_PREFIX, fe as PROPERTY_ROW_INDEX_SEP, f8 as PROPERTY_ROW_KEY_SEP, fh as PropertyValueUsageInput, ec as ReceiveActionsInput, eb as ReceiveActionsInputData, em as ResolveOutputPathsInput, ef as ResolveOutputPathsInputData, ey as SEGMENT_BOOLEAN_OPERATORS, ex as SEGMENT_DATE_OPERATORS, ev as SEGMENT_ID_OPERATORS, e_ as SEGMENT_IMPLICIT_OPERATORS, cn as SEGMENT_MEMBERSHIP_FIELD, ew as SEGMENT_NUMBER_OPERATORS, eZ as SEGMENT_OPERATOR_SPECS, eD as SEGMENT_QUEUES, eu as SEGMENT_TEXT_OPERATORS, d9 as SEX_OPTIONS, d7 as SOCIAL_LINKS, dB as STATIC_PLACEHOLDER, d2 as STATUSES, dd as STRUCTURE_STATUSES, gj as SUGGEST_CONFIDENCE, f2 as SegmentBaseInput, ez as SegmentField, f1 as SegmentNodeSchema, cw as SegmentOperator, en as SetPropertiesInput, eg as SetPropertiesInputData, fP as TApprovalChangeProducers, dR as TAutomationActionFolks, dF as TAutomationFindObjectType, dQ as TAutomationProducers, g5 as TImportExportProducers, fg as TPropertyProducers, f0 as TSegmentProducers, fj as UNKNOWN_VALUE_COUNTS, fi as UNKNOWN_VALUE_SAMPLES, dh as USER_EXPORT_EXTENDED_FIELDS, dg as USER_EXTENDED_FIELDS, de as USER_MOVEMENT_STATUSES, dc as USER_PROPERTIES_INFO, db as USER_ROLES, g1 as USER_TYPES, fp as activityLogsSchema, dV as aiAgentSchema, eR as anniversaryRanges, dr as appSchema, fU as approvalChangeApplyInputSchema, fC as approvalChangePluginName, fQ as approvalLockCheckInputSchema, fS as approvalLockCreateInputSchema, fR as approvalLockStatesInputSchema, fT as approvalRequestCreateInputSchema, dl as attachmentSchema, dU as automationExecutionSchema, dS as automationSchema, e6 as buildRuntimeOutputsIndex, ds as buildSetPropertyModifier, cX as canGroup, cT as checkLogin, c_ as checkPermissionGroup, cW as clearGroupActionsCache, fV as clientPortalSchema, eT as collectSegmentReferences, eS as collectSegmentValueRefs, g2 as commentSchema, cC as compileSegmentMongoFilter, gn as countCsvDataRows, fW as cpNotificationConfigUserSchema, g3 as cpNotificationSchema, fY as cpNotificationSettingsSchema, fX as cpTwoFactor, g0 as cpUserSchema, dn as createEventHandlers, f as createScopedEventHandlers, dj as customFieldSchema, cO as detectAssignmentDelta, fs as emailAddressSchema, ft as emailDeliverySchema, fv as emailRampSchema, fw as emailSenderSchema, f$ as fcmDeviceSchema, fb as fieldIdFromPropertyDataPath, cM as findResolver, eL as gatherSegmentEventTypes, eN as gatherSegmentFieldSources, eO as gatherSegmentJoinPaths, eM as gatherSegmentRecordTypes, cD as gatherSegmentRelations, dq as generateEventHandlersFromRequest, d_ as getAutomationActionConstant, e3 as getAutomationNodeType, dv as getContentType, cV as getGroupActionsMap, ge as getImportExportJobOptions, dw as getModuleName, dx as getPluginName, dt as getSetPropertySelector, cN as getSnapshot, dN as getTriggerTargetType, dY as getValueByPath, cY as hasDeclaredOAuthScopes, eU as hasSegmentReferenceInRelation, fG as initApproval, ff as initPropertyProducers, dm as initRecordReferences, e$ as initSegmentProducers, cB as isAnniversary, eQ as isLeapYear, fa as isPropertyDataPath, cG as isPropertyGroupKey, d$ as isReEnrollableTrigger, e0 as isReEnrollingTrigger, fE as localApprovalChangeType, cK as logActivityLogError, gg as logImportExportEvent, fo as logsSchema, dX as matchAutomationResolverKey, gl as matchImportHeaders, cL as matchesFieldPattern, fm as measurePropertyValueCounts, fl as measurePropertyValueSamples, fn as measurePropertyValueUsage, cE as mergePropertyRowConditions, fD as normalizeApprovalChangeType, fF as normalizeApprovalConfig, e5 as normalizeAutomationConstantsForTransport, gk as normalizeHeader, cv as normalizeSegmentOperator, fx as notificationSchema, fy as notificationSettingsSchema, fz as notificationZTypeSchema, cF as parsePropertyColumnKey, co as parsePropertyDataKey, cP as permissionGroupSchema, cR as permissionSchema, gm as processCSVStream, fc as propertyDataExistsFilter, cc as propertyDataPath, fd as propertyDataRegexFilter, cH as propertyGroupIdFromKey, fZ as refreshTokenSchema, cm as replaceOutputPlaceholders, cZ as resolveActionOAuthScopes, e1 as resolveAutomationActionInputs, dW as resolveFromSourceField, e2 as resolveOutputPathsByNodeType, ch as resolveRecordReferenceValue, eX as resolveSegmentFieldDependencies, eW as resolveSegmentFieldOperators, eY as resolveSegmentValueField, cS as roleSchema, dk as ruleSchema, gh as safeCleanup, eF as scheduleSegmentReconcile, eB as segmentDependencies, eA as segmentDependencyKey, eC as segmentDependsOnClock, cr as segmentFieldRef, eK as segmentJoinChanges, eE as segmentQueueFor, cs as segmentReferenceRef, ct as segmentRelationRef, et as sendAutomationDeferredCompletion, es as sendAutomationRun, er as sendAutomationTrigger, fA as sendNotification, fB as sendNotificationChannels, eG as sendSegmentChanged, eJ as sendSegmentForget, eI as sendSegmentRebuild, eH as sendSegmentReconcile, dp as setEventHandlerRuntimeContext, du as setProperty, cz as shiftZonedDays, f_ as socialAuthProviderSchema, dy as splitType, dz as startAutomations, g6 as startImportExportWorker, cp as toPropertyGroupKey, cI as toPropertyRowColumnKey, cd as toPropertyRowKey, gf as toTerminalImportExportError, e4 as toTransportOutput, fk as unknownValueUsage, cQ as userGroupSchema, d1 as userMovemmentSchema, d0 as userSchema, cq as walkSegmentNodes, cU as wrapPermission, c$ as wrapPublicResolver, cA as zonedDate, eP as zonedDayStart, cy as zonedPeriodRange } from '../../dist/start-plugin-322626b5.esm.js';
3
3
  import dayjs from 'dayjs';
4
4
  import 'node-fetch';
5
5
  import { nanoid } from 'nanoid';
@@ -9,6 +9,7 @@ export interface NotificationChannel {
9
9
  export interface NotificationEvent {
10
10
  enabled: boolean;
11
11
  channels: string[];
12
+ mutedChannels?: string[];
12
13
  }
13
14
  export interface NotificationSettings {
14
15
  userId: string;
@@ -31,6 +32,7 @@ export declare const notificationSettingsSchema: Schema<any, import("mongoose").
31
32
  events: Map<string, {
32
33
  enabled: boolean;
33
34
  channels: string[];
35
+ mutedChannels: string[];
34
36
  }>;
35
37
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
36
38
  createdAt: NativeDate;
@@ -44,6 +46,7 @@ export declare const notificationSettingsSchema: Schema<any, import("mongoose").
44
46
  events: Map<string, {
45
47
  enabled: boolean;
46
48
  channels: string[];
49
+ mutedChannels: string[];
47
50
  }>;
48
51
  }>> & import("mongoose").FlatRecord<{
49
52
  createdAt: NativeDate;
@@ -57,6 +60,7 @@ export declare const notificationSettingsSchema: Schema<any, import("mongoose").
57
60
  events: Map<string, {
58
61
  enabled: boolean;
59
62
  channels: string[];
63
+ mutedChannels: string[];
60
64
  }>;
61
65
  }> & {
62
66
  _id: import("mongoose").Types.ObjectId;
@@ -1 +1 @@
1
- {"version":3,"file":"notificationSettings.d.ts","sourceRoot":"../../../../../../src/core-modules/notifications/definitions","sources":["notificationSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,WAAW,2BAA2B;IAC1C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,2BAA2B,CAAC;CACxC;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC3C,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IACvC,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAoBD,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBtC,CAAC"}
1
+ {"version":3,"file":"notificationSettings.d.ts","sourceRoot":"../../../../../../src/core-modules/notifications/definitions","sources":["notificationSettings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,MAAM,WAAW,2BAA2B;IAC1C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,2BAA2B,CAAC;CACxC;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC3C,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IACvC,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAqBD,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBtC,CAAC"}
@@ -81,5 +81,6 @@ export declare const sendNotificationChannels: (subdomain: string, notification:
81
81
  userIds: string[];
82
82
  notificationType?: string;
83
83
  fromUserId?: string;
84
+ contentTypeId?: string | Types.ObjectId;
84
85
  } & Partial<INotificationData>) => Promise<void>;
85
86
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"../../../../../src/core-modules/notifications","sources":["utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA+BxB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,gBAAgB,GAC3B,WAAW,MAAM,EACjB,MAAM;IACJ,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,OAAO,CAAC,iBAAiB,CAAC,kBAwB/B,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,WAAW,MAAM,EACjB,cAAc;IACZ,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,iBAAiB,CAAC,kBAkE/B,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"../../../../../src/core-modules/notifications","sources":["utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA+BxB,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,gBAAgB,GAC3B,WAAW,MAAM,EACjB,MAAM;IACJ,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,OAAO,CAAC,iBAAiB,CAAC,kBAwB/B,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACnC,WAAW,MAAM,EACjB,cAAc;IACZ,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC;CACzC,GAAG,OAAO,CAAC,iBAAiB,CAAC,kBAoG/B,CAAC"}
@@ -11616,6 +11616,10 @@ var notifcationEventSchema = new mongoose.Schema({
11616
11616
  channels: {
11617
11617
  type: [String],
11618
11618
  "default": []
11619
+ },
11620
+ mutedChannels: {
11621
+ type: [String],
11622
+ "default": []
11619
11623
  }
11620
11624
  }, {
11621
11625
  _id: false
@@ -11871,19 +11875,19 @@ var sendNotification = /*#__PURE__*/function () {
11871
11875
  var sendNotificationChannels = /*#__PURE__*/function () {
11872
11876
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(subdomain, notification) {
11873
11877
  var _recipientIds$email;
11874
- var _ref3, eventName, userIds, contentType, fromUserId, _contentType$split, _contentType$split2, _contentType$split2$, pluginName, _contentType$split2$2, moduleName, userNotificationSettings, recipientIds, _iterator, _step, _events$pluginName, _events, _events2, _events$pluginName2, userNotificationSetting, _ref4, userId, events, channels;
11875
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
11876
- while (1) switch (_context2.prev = _context2.next) {
11878
+ var _ref3, eventName, userIds, contentType, contentTypeId, fromUserId, title, message, _contentType$split, _contentType$split2, _contentType$split2$, pluginName, _contentType$split2$2, moduleName, userNotificationSettings, recipientIds, _iterator, _step, _loop, _ret;
11879
+ return _regeneratorRuntime().wrap(function _callee2$(_context3) {
11880
+ while (1) switch (_context3.prev = _context3.next) {
11877
11881
  case 0:
11878
- _ref3 = notification || {}, eventName = _ref3.notificationType, userIds = _ref3.userIds, contentType = _ref3.contentType, fromUserId = _ref3.fromUserId;
11882
+ _ref3 = notification || {}, eventName = _ref3.notificationType, userIds = _ref3.userIds, contentType = _ref3.contentType, contentTypeId = _ref3.contentTypeId, fromUserId = _ref3.fromUserId, title = _ref3.title, message = _ref3.message;
11879
11883
  if (contentType) {
11880
- _context2.next = 3;
11884
+ _context3.next = 3;
11881
11885
  break;
11882
11886
  }
11883
- return _context2.abrupt("return");
11887
+ return _context3.abrupt("return");
11884
11888
  case 3:
11885
11889
  _contentType$split = contentType.split(':'), _contentType$split2 = _slicedToArray(_contentType$split, 2), _contentType$split2$ = _contentType$split2[0], pluginName = _contentType$split2$ === void 0 ? '' : _contentType$split2$, _contentType$split2$2 = _contentType$split2[1], moduleName = _contentType$split2$2 === void 0 ? '' : _contentType$split2$2;
11886
- _context2.next = 6;
11890
+ _context3.next = 6;
11887
11891
  return sendTRPCMessage({
11888
11892
  subdomain: subdomain,
11889
11893
  pluginName: 'core',
@@ -11896,88 +11900,141 @@ var sendNotificationChannels = /*#__PURE__*/function () {
11896
11900
  defaultValue: []
11897
11901
  });
11898
11902
  case 6:
11899
- userNotificationSettings = _context2.sent;
11903
+ userNotificationSettings = _context3.sent;
11900
11904
  recipientIds = {
11901
- email: []
11905
+ email: [],
11906
+ mobile: []
11902
11907
  };
11903
11908
  _iterator = _createForOfIteratorHelper(userNotificationSettings);
11904
- _context2.prev = 9;
11909
+ _context3.prev = 9;
11910
+ _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
11911
+ var _events$pluginName, _events, _events$pluginName2;
11912
+ var userNotificationSetting, _ref4, userId, events, eventSetting, mutedChannels, channels;
11913
+ return _regeneratorRuntime().wrap(function _loop$(_context2) {
11914
+ while (1) switch (_context2.prev = _context2.next) {
11915
+ case 0:
11916
+ userNotificationSetting = _step.value;
11917
+ _ref4 = userNotificationSetting || {}, userId = _ref4.userId, events = _ref4.events;
11918
+ if (!(fromUserId && userId === fromUserId)) {
11919
+ _context2.next = 4;
11920
+ break;
11921
+ }
11922
+ return _context2.abrupt("return", 0);
11923
+ case 4:
11924
+ if (userIds.includes(userId)) {
11925
+ _context2.next = 6;
11926
+ break;
11927
+ }
11928
+ return _context2.abrupt("return", 0);
11929
+ case 6:
11930
+ if (events !== null && events !== void 0 && (_events$pluginName = events[pluginName]) !== null && _events$pluginName !== void 0 && _events$pluginName.enabled) {
11931
+ _context2.next = 8;
11932
+ break;
11933
+ }
11934
+ return _context2.abrupt("return", 0);
11935
+ case 8:
11936
+ if (events !== null && events !== void 0 && (_events = events["".concat(pluginName, ":").concat(moduleName)]) !== null && _events !== void 0 && _events.enabled) {
11937
+ _context2.next = 10;
11938
+ break;
11939
+ }
11940
+ return _context2.abrupt("return", 0);
11941
+ case 10:
11942
+ eventSetting = events === null || events === void 0 ? void 0 : events["".concat(pluginName, ":").concat(moduleName, ":").concat(eventName)];
11943
+ if (eventSetting !== null && eventSetting !== void 0 && eventSetting.enabled) {
11944
+ _context2.next = 13;
11945
+ break;
11946
+ }
11947
+ return _context2.abrupt("return", 0);
11948
+ case 13:
11949
+ mutedChannels = eventSetting.mutedChannels || [];
11950
+ channels = ((events === null || events === void 0 || (_events$pluginName2 = events[pluginName]) === null || _events$pluginName2 === void 0 ? void 0 : _events$pluginName2.channels) || []).filter(function (channel) {
11951
+ return !mutedChannels.includes(channel);
11952
+ });
11953
+ if (channels.length) {
11954
+ _context2.next = 17;
11955
+ break;
11956
+ }
11957
+ return _context2.abrupt("return", 0);
11958
+ case 17:
11959
+ if (channels.includes('email')) {
11960
+ recipientIds['email'].push(userId);
11961
+ }
11962
+ if (channels.includes('mobile')) {
11963
+ recipientIds['mobile'].push(userId);
11964
+ }
11965
+ case 19:
11966
+ case "end":
11967
+ return _context2.stop();
11968
+ }
11969
+ }, _loop);
11970
+ });
11905
11971
  _iterator.s();
11906
- case 11:
11972
+ case 12:
11907
11973
  if ((_step = _iterator.n()).done) {
11908
- _context2.next = 30;
11909
- break;
11910
- }
11911
- userNotificationSetting = _step.value;
11912
- _ref4 = userNotificationSetting || {}, userId = _ref4.userId, events = _ref4.events;
11913
- if (!(fromUserId && userId === fromUserId)) {
11914
- _context2.next = 16;
11915
- break;
11916
- }
11917
- return _context2.abrupt("continue", 28);
11918
- case 16:
11919
- if (userIds.includes(userId)) {
11920
- _context2.next = 18;
11921
- break;
11922
- }
11923
- return _context2.abrupt("continue", 28);
11924
- case 18:
11925
- if (events !== null && events !== void 0 && (_events$pluginName = events[pluginName]) !== null && _events$pluginName !== void 0 && _events$pluginName.enabled) {
11926
- _context2.next = 20;
11927
- break;
11928
- }
11929
- return _context2.abrupt("continue", 28);
11930
- case 20:
11931
- if (events !== null && events !== void 0 && (_events = events["".concat(pluginName, ":").concat(moduleName)]) !== null && _events !== void 0 && _events.enabled) {
11932
- _context2.next = 22;
11974
+ _context3.next = 19;
11933
11975
  break;
11934
11976
  }
11935
- return _context2.abrupt("continue", 28);
11936
- case 22:
11937
- if (events !== null && events !== void 0 && (_events2 = events["".concat(pluginName, ":").concat(moduleName, ":").concat(eventName)]) !== null && _events2 !== void 0 && _events2.enabled) {
11938
- _context2.next = 24;
11977
+ return _context3.delegateYield(_loop(), "t0", 14);
11978
+ case 14:
11979
+ _ret = _context3.t0;
11980
+ if (!(_ret === 0)) {
11981
+ _context3.next = 17;
11939
11982
  break;
11940
11983
  }
11941
- return _context2.abrupt("continue", 28);
11984
+ return _context3.abrupt("continue", 17);
11985
+ case 17:
11986
+ _context3.next = 12;
11987
+ break;
11988
+ case 19:
11989
+ _context3.next = 24;
11990
+ break;
11991
+ case 21:
11992
+ _context3.prev = 21;
11993
+ _context3.t1 = _context3["catch"](9);
11994
+ _iterator.e(_context3.t1);
11942
11995
  case 24:
11943
- channels = (events === null || events === void 0 || (_events$pluginName2 = events[pluginName]) === null || _events$pluginName2 === void 0 ? void 0 : _events$pluginName2.channels) || [];
11944
- if (channels.length) {
11945
- _context2.next = 27;
11946
- break;
11947
- }
11948
- return _context2.abrupt("continue", 28);
11996
+ _context3.prev = 24;
11997
+ _iterator.f();
11998
+ return _context3.finish(24);
11949
11999
  case 27:
11950
- if (channels.includes('email')) {
11951
- recipientIds['email'].push(userId);
12000
+ if (!recipientIds['mobile'].length) {
12001
+ _context3.next = 30;
12002
+ break;
11952
12003
  }
11953
- case 28:
11954
- _context2.next = 11;
11955
- break;
12004
+ _context3.next = 30;
12005
+ return sendTRPCMessage({
12006
+ subdomain: subdomain,
12007
+ pluginName: 'core',
12008
+ method: 'mutation',
12009
+ module: 'notifications',
12010
+ action: 'sendMobileNotification',
12011
+ input: {
12012
+ receivers: recipientIds['mobile'],
12013
+ title: title,
12014
+ body: message,
12015
+ // FCM data values must be strings
12016
+ data: {
12017
+ contentType: contentType,
12018
+ contentTypeId: String(contentTypeId !== null && contentTypeId !== void 0 ? contentTypeId : ''),
12019
+ notificationType: eventName !== null && eventName !== void 0 ? eventName : ''
12020
+ }
12021
+ },
12022
+ defaultValue: null
12023
+ });
11956
12024
  case 30:
11957
- _context2.next = 35;
11958
- break;
11959
- case 32:
11960
- _context2.prev = 32;
11961
- _context2.t0 = _context2["catch"](9);
11962
- _iterator.e(_context2.t0);
11963
- case 35:
11964
- _context2.prev = 35;
11965
- _iterator.f();
11966
- return _context2.finish(35);
11967
- case 38:
11968
12025
  if (!((_recipientIds$email = recipientIds['email']) !== null && _recipientIds$email !== void 0 && _recipientIds$email.length)) {
11969
- _context2.next = 41;
12026
+ _context3.next = 33;
11970
12027
  break;
11971
12028
  }
11972
- _context2.next = 41;
12029
+ _context3.next = 33;
11973
12030
  return sendNotificationEmail(subdomain, _objectSpread2(_objectSpread2({}, notification), {}, {
11974
12031
  userIds: recipientIds['email']
11975
12032
  }));
11976
- case 41:
12033
+ case 33:
11977
12034
  case "end":
11978
- return _context2.stop();
12035
+ return _context3.stop();
11979
12036
  }
11980
- }, _callee2, null, [[9, 32, 35, 38]]);
12037
+ }, _callee2, null, [[9, 21, 24, 27]]);
11981
12038
  }));
11982
12039
  return function sendNotificationChannels(_x3, _x4) {
11983
12040
  return _ref2.apply(this, arguments);
@@ -11573,6 +11573,10 @@ var notifcationEventSchema = new Schema({
11573
11573
  channels: {
11574
11574
  type: [String],
11575
11575
  "default": []
11576
+ },
11577
+ mutedChannels: {
11578
+ type: [String],
11579
+ "default": []
11576
11580
  }
11577
11581
  }, {
11578
11582
  _id: false
@@ -11828,19 +11832,19 @@ var sendNotification = /*#__PURE__*/function () {
11828
11832
  var sendNotificationChannels = /*#__PURE__*/function () {
11829
11833
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(subdomain, notification) {
11830
11834
  var _recipientIds$email;
11831
- var _ref3, eventName, userIds, contentType, fromUserId, _contentType$split, _contentType$split2, _contentType$split2$, pluginName, _contentType$split2$2, moduleName, userNotificationSettings, recipientIds, _iterator, _step, _events$pluginName, _events, _events2, _events$pluginName2, userNotificationSetting, _ref4, userId, events, channels;
11832
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
11833
- while (1) switch (_context2.prev = _context2.next) {
11835
+ var _ref3, eventName, userIds, contentType, contentTypeId, fromUserId, title, message, _contentType$split, _contentType$split2, _contentType$split2$, pluginName, _contentType$split2$2, moduleName, userNotificationSettings, recipientIds, _iterator, _step, _loop, _ret;
11836
+ return _regeneratorRuntime().wrap(function _callee2$(_context3) {
11837
+ while (1) switch (_context3.prev = _context3.next) {
11834
11838
  case 0:
11835
- _ref3 = notification || {}, eventName = _ref3.notificationType, userIds = _ref3.userIds, contentType = _ref3.contentType, fromUserId = _ref3.fromUserId;
11839
+ _ref3 = notification || {}, eventName = _ref3.notificationType, userIds = _ref3.userIds, contentType = _ref3.contentType, contentTypeId = _ref3.contentTypeId, fromUserId = _ref3.fromUserId, title = _ref3.title, message = _ref3.message;
11836
11840
  if (contentType) {
11837
- _context2.next = 3;
11841
+ _context3.next = 3;
11838
11842
  break;
11839
11843
  }
11840
- return _context2.abrupt("return");
11844
+ return _context3.abrupt("return");
11841
11845
  case 3:
11842
11846
  _contentType$split = contentType.split(':'), _contentType$split2 = _slicedToArray(_contentType$split, 2), _contentType$split2$ = _contentType$split2[0], pluginName = _contentType$split2$ === void 0 ? '' : _contentType$split2$, _contentType$split2$2 = _contentType$split2[1], moduleName = _contentType$split2$2 === void 0 ? '' : _contentType$split2$2;
11843
- _context2.next = 6;
11847
+ _context3.next = 6;
11844
11848
  return sendTRPCMessage({
11845
11849
  subdomain: subdomain,
11846
11850
  pluginName: 'core',
@@ -11853,88 +11857,141 @@ var sendNotificationChannels = /*#__PURE__*/function () {
11853
11857
  defaultValue: []
11854
11858
  });
11855
11859
  case 6:
11856
- userNotificationSettings = _context2.sent;
11860
+ userNotificationSettings = _context3.sent;
11857
11861
  recipientIds = {
11858
- email: []
11862
+ email: [],
11863
+ mobile: []
11859
11864
  };
11860
11865
  _iterator = _createForOfIteratorHelper(userNotificationSettings);
11861
- _context2.prev = 9;
11866
+ _context3.prev = 9;
11867
+ _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
11868
+ var _events$pluginName, _events, _events$pluginName2;
11869
+ var userNotificationSetting, _ref4, userId, events, eventSetting, mutedChannels, channels;
11870
+ return _regeneratorRuntime().wrap(function _loop$(_context2) {
11871
+ while (1) switch (_context2.prev = _context2.next) {
11872
+ case 0:
11873
+ userNotificationSetting = _step.value;
11874
+ _ref4 = userNotificationSetting || {}, userId = _ref4.userId, events = _ref4.events;
11875
+ if (!(fromUserId && userId === fromUserId)) {
11876
+ _context2.next = 4;
11877
+ break;
11878
+ }
11879
+ return _context2.abrupt("return", 0);
11880
+ case 4:
11881
+ if (userIds.includes(userId)) {
11882
+ _context2.next = 6;
11883
+ break;
11884
+ }
11885
+ return _context2.abrupt("return", 0);
11886
+ case 6:
11887
+ if (events !== null && events !== void 0 && (_events$pluginName = events[pluginName]) !== null && _events$pluginName !== void 0 && _events$pluginName.enabled) {
11888
+ _context2.next = 8;
11889
+ break;
11890
+ }
11891
+ return _context2.abrupt("return", 0);
11892
+ case 8:
11893
+ if (events !== null && events !== void 0 && (_events = events["".concat(pluginName, ":").concat(moduleName)]) !== null && _events !== void 0 && _events.enabled) {
11894
+ _context2.next = 10;
11895
+ break;
11896
+ }
11897
+ return _context2.abrupt("return", 0);
11898
+ case 10:
11899
+ eventSetting = events === null || events === void 0 ? void 0 : events["".concat(pluginName, ":").concat(moduleName, ":").concat(eventName)];
11900
+ if (eventSetting !== null && eventSetting !== void 0 && eventSetting.enabled) {
11901
+ _context2.next = 13;
11902
+ break;
11903
+ }
11904
+ return _context2.abrupt("return", 0);
11905
+ case 13:
11906
+ mutedChannels = eventSetting.mutedChannels || [];
11907
+ channels = ((events === null || events === void 0 || (_events$pluginName2 = events[pluginName]) === null || _events$pluginName2 === void 0 ? void 0 : _events$pluginName2.channels) || []).filter(function (channel) {
11908
+ return !mutedChannels.includes(channel);
11909
+ });
11910
+ if (channels.length) {
11911
+ _context2.next = 17;
11912
+ break;
11913
+ }
11914
+ return _context2.abrupt("return", 0);
11915
+ case 17:
11916
+ if (channels.includes('email')) {
11917
+ recipientIds['email'].push(userId);
11918
+ }
11919
+ if (channels.includes('mobile')) {
11920
+ recipientIds['mobile'].push(userId);
11921
+ }
11922
+ case 19:
11923
+ case "end":
11924
+ return _context2.stop();
11925
+ }
11926
+ }, _loop);
11927
+ });
11862
11928
  _iterator.s();
11863
- case 11:
11929
+ case 12:
11864
11930
  if ((_step = _iterator.n()).done) {
11865
- _context2.next = 30;
11866
- break;
11867
- }
11868
- userNotificationSetting = _step.value;
11869
- _ref4 = userNotificationSetting || {}, userId = _ref4.userId, events = _ref4.events;
11870
- if (!(fromUserId && userId === fromUserId)) {
11871
- _context2.next = 16;
11872
- break;
11873
- }
11874
- return _context2.abrupt("continue", 28);
11875
- case 16:
11876
- if (userIds.includes(userId)) {
11877
- _context2.next = 18;
11878
- break;
11879
- }
11880
- return _context2.abrupt("continue", 28);
11881
- case 18:
11882
- if (events !== null && events !== void 0 && (_events$pluginName = events[pluginName]) !== null && _events$pluginName !== void 0 && _events$pluginName.enabled) {
11883
- _context2.next = 20;
11884
- break;
11885
- }
11886
- return _context2.abrupt("continue", 28);
11887
- case 20:
11888
- if (events !== null && events !== void 0 && (_events = events["".concat(pluginName, ":").concat(moduleName)]) !== null && _events !== void 0 && _events.enabled) {
11889
- _context2.next = 22;
11931
+ _context3.next = 19;
11890
11932
  break;
11891
11933
  }
11892
- return _context2.abrupt("continue", 28);
11893
- case 22:
11894
- if (events !== null && events !== void 0 && (_events2 = events["".concat(pluginName, ":").concat(moduleName, ":").concat(eventName)]) !== null && _events2 !== void 0 && _events2.enabled) {
11895
- _context2.next = 24;
11934
+ return _context3.delegateYield(_loop(), "t0", 14);
11935
+ case 14:
11936
+ _ret = _context3.t0;
11937
+ if (!(_ret === 0)) {
11938
+ _context3.next = 17;
11896
11939
  break;
11897
11940
  }
11898
- return _context2.abrupt("continue", 28);
11941
+ return _context3.abrupt("continue", 17);
11942
+ case 17:
11943
+ _context3.next = 12;
11944
+ break;
11945
+ case 19:
11946
+ _context3.next = 24;
11947
+ break;
11948
+ case 21:
11949
+ _context3.prev = 21;
11950
+ _context3.t1 = _context3["catch"](9);
11951
+ _iterator.e(_context3.t1);
11899
11952
  case 24:
11900
- channels = (events === null || events === void 0 || (_events$pluginName2 = events[pluginName]) === null || _events$pluginName2 === void 0 ? void 0 : _events$pluginName2.channels) || [];
11901
- if (channels.length) {
11902
- _context2.next = 27;
11903
- break;
11904
- }
11905
- return _context2.abrupt("continue", 28);
11953
+ _context3.prev = 24;
11954
+ _iterator.f();
11955
+ return _context3.finish(24);
11906
11956
  case 27:
11907
- if (channels.includes('email')) {
11908
- recipientIds['email'].push(userId);
11957
+ if (!recipientIds['mobile'].length) {
11958
+ _context3.next = 30;
11959
+ break;
11909
11960
  }
11910
- case 28:
11911
- _context2.next = 11;
11912
- break;
11961
+ _context3.next = 30;
11962
+ return sendTRPCMessage({
11963
+ subdomain: subdomain,
11964
+ pluginName: 'core',
11965
+ method: 'mutation',
11966
+ module: 'notifications',
11967
+ action: 'sendMobileNotification',
11968
+ input: {
11969
+ receivers: recipientIds['mobile'],
11970
+ title: title,
11971
+ body: message,
11972
+ // FCM data values must be strings
11973
+ data: {
11974
+ contentType: contentType,
11975
+ contentTypeId: String(contentTypeId !== null && contentTypeId !== void 0 ? contentTypeId : ''),
11976
+ notificationType: eventName !== null && eventName !== void 0 ? eventName : ''
11977
+ }
11978
+ },
11979
+ defaultValue: null
11980
+ });
11913
11981
  case 30:
11914
- _context2.next = 35;
11915
- break;
11916
- case 32:
11917
- _context2.prev = 32;
11918
- _context2.t0 = _context2["catch"](9);
11919
- _iterator.e(_context2.t0);
11920
- case 35:
11921
- _context2.prev = 35;
11922
- _iterator.f();
11923
- return _context2.finish(35);
11924
- case 38:
11925
11982
  if (!((_recipientIds$email = recipientIds['email']) !== null && _recipientIds$email !== void 0 && _recipientIds$email.length)) {
11926
- _context2.next = 41;
11983
+ _context3.next = 33;
11927
11984
  break;
11928
11985
  }
11929
- _context2.next = 41;
11986
+ _context3.next = 33;
11930
11987
  return sendNotificationEmail(subdomain, _objectSpread2(_objectSpread2({}, notification), {}, {
11931
11988
  userIds: recipientIds['email']
11932
11989
  }));
11933
- case 41:
11990
+ case 33:
11934
11991
  case "end":
11935
- return _context2.stop();
11992
+ return _context3.stop();
11936
11993
  }
11937
- }, _callee2, null, [[9, 32, 35, 38]]);
11994
+ }, _callee2, null, [[9, 21, 24, 27]]);
11938
11995
  }));
11939
11996
  return function sendNotificationChannels(_x3, _x4) {
11940
11997
  return _ref2.apply(this, arguments);
@@ -11614,6 +11614,10 @@ var notifcationEventSchema = new mongoose.Schema({
11614
11614
  channels: {
11615
11615
  type: [String],
11616
11616
  "default": []
11617
+ },
11618
+ mutedChannels: {
11619
+ type: [String],
11620
+ "default": []
11617
11621
  }
11618
11622
  }, {
11619
11623
  _id: false
@@ -11869,19 +11873,19 @@ var sendNotification = /*#__PURE__*/function () {
11869
11873
  var sendNotificationChannels = /*#__PURE__*/function () {
11870
11874
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(subdomain, notification) {
11871
11875
  var _recipientIds$email;
11872
- var _ref3, eventName, userIds, contentType, fromUserId, _contentType$split, _contentType$split2, _contentType$split2$, pluginName, _contentType$split2$2, moduleName, userNotificationSettings, recipientIds, _iterator, _step, _events$pluginName, _events, _events2, _events$pluginName2, userNotificationSetting, _ref4, userId, events, channels;
11873
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
11874
- while (1) switch (_context2.prev = _context2.next) {
11876
+ var _ref3, eventName, userIds, contentType, contentTypeId, fromUserId, title, message, _contentType$split, _contentType$split2, _contentType$split2$, pluginName, _contentType$split2$2, moduleName, userNotificationSettings, recipientIds, _iterator, _step, _loop, _ret;
11877
+ return _regeneratorRuntime().wrap(function _callee2$(_context3) {
11878
+ while (1) switch (_context3.prev = _context3.next) {
11875
11879
  case 0:
11876
- _ref3 = notification || {}, eventName = _ref3.notificationType, userIds = _ref3.userIds, contentType = _ref3.contentType, fromUserId = _ref3.fromUserId;
11880
+ _ref3 = notification || {}, eventName = _ref3.notificationType, userIds = _ref3.userIds, contentType = _ref3.contentType, contentTypeId = _ref3.contentTypeId, fromUserId = _ref3.fromUserId, title = _ref3.title, message = _ref3.message;
11877
11881
  if (contentType) {
11878
- _context2.next = 3;
11882
+ _context3.next = 3;
11879
11883
  break;
11880
11884
  }
11881
- return _context2.abrupt("return");
11885
+ return _context3.abrupt("return");
11882
11886
  case 3:
11883
11887
  _contentType$split = contentType.split(':'), _contentType$split2 = _slicedToArray(_contentType$split, 2), _contentType$split2$ = _contentType$split2[0], pluginName = _contentType$split2$ === void 0 ? '' : _contentType$split2$, _contentType$split2$2 = _contentType$split2[1], moduleName = _contentType$split2$2 === void 0 ? '' : _contentType$split2$2;
11884
- _context2.next = 6;
11888
+ _context3.next = 6;
11885
11889
  return sendTRPCMessage({
11886
11890
  subdomain: subdomain,
11887
11891
  pluginName: 'core',
@@ -11894,88 +11898,141 @@ var sendNotificationChannels = /*#__PURE__*/function () {
11894
11898
  defaultValue: []
11895
11899
  });
11896
11900
  case 6:
11897
- userNotificationSettings = _context2.sent;
11901
+ userNotificationSettings = _context3.sent;
11898
11902
  recipientIds = {
11899
- email: []
11903
+ email: [],
11904
+ mobile: []
11900
11905
  };
11901
11906
  _iterator = _createForOfIteratorHelper(userNotificationSettings);
11902
- _context2.prev = 9;
11907
+ _context3.prev = 9;
11908
+ _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
11909
+ var _events$pluginName, _events, _events$pluginName2;
11910
+ var userNotificationSetting, _ref4, userId, events, eventSetting, mutedChannels, channels;
11911
+ return _regeneratorRuntime().wrap(function _loop$(_context2) {
11912
+ while (1) switch (_context2.prev = _context2.next) {
11913
+ case 0:
11914
+ userNotificationSetting = _step.value;
11915
+ _ref4 = userNotificationSetting || {}, userId = _ref4.userId, events = _ref4.events;
11916
+ if (!(fromUserId && userId === fromUserId)) {
11917
+ _context2.next = 4;
11918
+ break;
11919
+ }
11920
+ return _context2.abrupt("return", 0);
11921
+ case 4:
11922
+ if (userIds.includes(userId)) {
11923
+ _context2.next = 6;
11924
+ break;
11925
+ }
11926
+ return _context2.abrupt("return", 0);
11927
+ case 6:
11928
+ if (events !== null && events !== void 0 && (_events$pluginName = events[pluginName]) !== null && _events$pluginName !== void 0 && _events$pluginName.enabled) {
11929
+ _context2.next = 8;
11930
+ break;
11931
+ }
11932
+ return _context2.abrupt("return", 0);
11933
+ case 8:
11934
+ if (events !== null && events !== void 0 && (_events = events["".concat(pluginName, ":").concat(moduleName)]) !== null && _events !== void 0 && _events.enabled) {
11935
+ _context2.next = 10;
11936
+ break;
11937
+ }
11938
+ return _context2.abrupt("return", 0);
11939
+ case 10:
11940
+ eventSetting = events === null || events === void 0 ? void 0 : events["".concat(pluginName, ":").concat(moduleName, ":").concat(eventName)];
11941
+ if (eventSetting !== null && eventSetting !== void 0 && eventSetting.enabled) {
11942
+ _context2.next = 13;
11943
+ break;
11944
+ }
11945
+ return _context2.abrupt("return", 0);
11946
+ case 13:
11947
+ mutedChannels = eventSetting.mutedChannels || [];
11948
+ channels = ((events === null || events === void 0 || (_events$pluginName2 = events[pluginName]) === null || _events$pluginName2 === void 0 ? void 0 : _events$pluginName2.channels) || []).filter(function (channel) {
11949
+ return !mutedChannels.includes(channel);
11950
+ });
11951
+ if (channels.length) {
11952
+ _context2.next = 17;
11953
+ break;
11954
+ }
11955
+ return _context2.abrupt("return", 0);
11956
+ case 17:
11957
+ if (channels.includes('email')) {
11958
+ recipientIds['email'].push(userId);
11959
+ }
11960
+ if (channels.includes('mobile')) {
11961
+ recipientIds['mobile'].push(userId);
11962
+ }
11963
+ case 19:
11964
+ case "end":
11965
+ return _context2.stop();
11966
+ }
11967
+ }, _loop);
11968
+ });
11903
11969
  _iterator.s();
11904
- case 11:
11970
+ case 12:
11905
11971
  if ((_step = _iterator.n()).done) {
11906
- _context2.next = 30;
11907
- break;
11908
- }
11909
- userNotificationSetting = _step.value;
11910
- _ref4 = userNotificationSetting || {}, userId = _ref4.userId, events = _ref4.events;
11911
- if (!(fromUserId && userId === fromUserId)) {
11912
- _context2.next = 16;
11913
- break;
11914
- }
11915
- return _context2.abrupt("continue", 28);
11916
- case 16:
11917
- if (userIds.includes(userId)) {
11918
- _context2.next = 18;
11919
- break;
11920
- }
11921
- return _context2.abrupt("continue", 28);
11922
- case 18:
11923
- if (events !== null && events !== void 0 && (_events$pluginName = events[pluginName]) !== null && _events$pluginName !== void 0 && _events$pluginName.enabled) {
11924
- _context2.next = 20;
11925
- break;
11926
- }
11927
- return _context2.abrupt("continue", 28);
11928
- case 20:
11929
- if (events !== null && events !== void 0 && (_events = events["".concat(pluginName, ":").concat(moduleName)]) !== null && _events !== void 0 && _events.enabled) {
11930
- _context2.next = 22;
11972
+ _context3.next = 19;
11931
11973
  break;
11932
11974
  }
11933
- return _context2.abrupt("continue", 28);
11934
- case 22:
11935
- if (events !== null && events !== void 0 && (_events2 = events["".concat(pluginName, ":").concat(moduleName, ":").concat(eventName)]) !== null && _events2 !== void 0 && _events2.enabled) {
11936
- _context2.next = 24;
11975
+ return _context3.delegateYield(_loop(), "t0", 14);
11976
+ case 14:
11977
+ _ret = _context3.t0;
11978
+ if (!(_ret === 0)) {
11979
+ _context3.next = 17;
11937
11980
  break;
11938
11981
  }
11939
- return _context2.abrupt("continue", 28);
11982
+ return _context3.abrupt("continue", 17);
11983
+ case 17:
11984
+ _context3.next = 12;
11985
+ break;
11986
+ case 19:
11987
+ _context3.next = 24;
11988
+ break;
11989
+ case 21:
11990
+ _context3.prev = 21;
11991
+ _context3.t1 = _context3["catch"](9);
11992
+ _iterator.e(_context3.t1);
11940
11993
  case 24:
11941
- channels = (events === null || events === void 0 || (_events$pluginName2 = events[pluginName]) === null || _events$pluginName2 === void 0 ? void 0 : _events$pluginName2.channels) || [];
11942
- if (channels.length) {
11943
- _context2.next = 27;
11944
- break;
11945
- }
11946
- return _context2.abrupt("continue", 28);
11994
+ _context3.prev = 24;
11995
+ _iterator.f();
11996
+ return _context3.finish(24);
11947
11997
  case 27:
11948
- if (channels.includes('email')) {
11949
- recipientIds['email'].push(userId);
11998
+ if (!recipientIds['mobile'].length) {
11999
+ _context3.next = 30;
12000
+ break;
11950
12001
  }
11951
- case 28:
11952
- _context2.next = 11;
11953
- break;
12002
+ _context3.next = 30;
12003
+ return sendTRPCMessage({
12004
+ subdomain: subdomain,
12005
+ pluginName: 'core',
12006
+ method: 'mutation',
12007
+ module: 'notifications',
12008
+ action: 'sendMobileNotification',
12009
+ input: {
12010
+ receivers: recipientIds['mobile'],
12011
+ title: title,
12012
+ body: message,
12013
+ // FCM data values must be strings
12014
+ data: {
12015
+ contentType: contentType,
12016
+ contentTypeId: String(contentTypeId !== null && contentTypeId !== void 0 ? contentTypeId : ''),
12017
+ notificationType: eventName !== null && eventName !== void 0 ? eventName : ''
12018
+ }
12019
+ },
12020
+ defaultValue: null
12021
+ });
11954
12022
  case 30:
11955
- _context2.next = 35;
11956
- break;
11957
- case 32:
11958
- _context2.prev = 32;
11959
- _context2.t0 = _context2["catch"](9);
11960
- _iterator.e(_context2.t0);
11961
- case 35:
11962
- _context2.prev = 35;
11963
- _iterator.f();
11964
- return _context2.finish(35);
11965
- case 38:
11966
12023
  if (!((_recipientIds$email = recipientIds['email']) !== null && _recipientIds$email !== void 0 && _recipientIds$email.length)) {
11967
- _context2.next = 41;
12024
+ _context3.next = 33;
11968
12025
  break;
11969
12026
  }
11970
- _context2.next = 41;
12027
+ _context3.next = 33;
11971
12028
  return sendNotificationEmail(subdomain, _objectSpread2(_objectSpread2({}, notification), {}, {
11972
12029
  userIds: recipientIds['email']
11973
12030
  }));
11974
- case 41:
12031
+ case 33:
11975
12032
  case "end":
11976
- return _context2.stop();
12033
+ return _context3.stop();
11977
12034
  }
11978
- }, _callee2, null, [[9, 32, 35, 38]]);
12035
+ }, _callee2, null, [[9, 21, 24, 27]]);
11979
12036
  }));
11980
12037
  return function sendNotificationChannels(_x3, _x4) {
11981
12038
  return _ref2.apply(this, arguments);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erxes/api-shared",
3
- "version": "3.3.3-next.1",
3
+ "version": "3.3.3-next.2",
4
4
  "description": "Shared platform utilities for erxes backend plugins: plugin startup, tenant-scoped models, service discovery, messaging and core types.",
5
5
  "license": "AGPL-3.0-only",
6
6
  "repository": {
@@ -12,6 +12,7 @@ export interface NotificationChannel {
12
12
  export interface NotificationEvent {
13
13
  enabled: boolean;
14
14
  channels: string[];
15
+ mutedChannels?: string[];
15
16
  }
16
17
 
17
18
  export interface NotificationSettings {
@@ -34,6 +35,7 @@ const notifcationEventSchema = new Schema(
34
35
  {
35
36
  enabled: { type: Boolean, default: false },
36
37
  channels: { type: [String], default: [] },
38
+ mutedChannels: { type: [String], default: [] },
37
39
  },
38
40
  {
39
41
  _id: false,
@@ -74,13 +74,17 @@ export const sendNotificationChannels = async (
74
74
  userIds: string[];
75
75
  notificationType?: string;
76
76
  fromUserId?: string;
77
+ contentTypeId?: string | Types.ObjectId;
77
78
  } & Partial<INotificationData>,
78
79
  ) => {
79
80
  const {
80
81
  notificationType: eventName,
81
82
  userIds,
82
83
  contentType,
84
+ contentTypeId,
83
85
  fromUserId,
86
+ title,
87
+ message,
84
88
  } = notification || {};
85
89
 
86
90
  if (!contentType) return;
@@ -98,7 +102,7 @@ export const sendNotificationChannels = async (
98
102
  defaultValue: [],
99
103
  });
100
104
 
101
- const recipientIds: Record<string, string[]> = { email: [] };
105
+ const recipientIds: Record<string, string[]> = { email: [], mobile: [] };
102
106
 
103
107
  for (const userNotificationSetting of userNotificationSettings) {
104
108
  const { userId, events } = userNotificationSetting || {};
@@ -119,11 +123,16 @@ export const sendNotificationChannels = async (
119
123
  continue;
120
124
  }
121
125
 
122
- if (!events?.[`${pluginName}:${moduleName}:${eventName}`]?.enabled) {
126
+ const eventSetting = events?.[`${pluginName}:${moduleName}:${eventName}`];
127
+
128
+ if (!eventSetting?.enabled) {
123
129
  continue;
124
130
  }
125
131
 
126
- const channels = events?.[pluginName]?.channels || [];
132
+ const mutedChannels: string[] = eventSetting.mutedChannels || [];
133
+ const channels = (events?.[pluginName]?.channels || []).filter(
134
+ (channel: string) => !mutedChannels.includes(channel),
135
+ );
127
136
 
128
137
  if (!channels.length) {
129
138
  continue;
@@ -132,6 +141,32 @@ export const sendNotificationChannels = async (
132
141
  if (channels.includes('email')) {
133
142
  recipientIds['email'].push(userId);
134
143
  }
144
+
145
+ if (channels.includes('mobile')) {
146
+ recipientIds['mobile'].push(userId);
147
+ }
148
+ }
149
+
150
+ if (recipientIds['mobile'].length) {
151
+ await sendTRPCMessage({
152
+ subdomain,
153
+ pluginName: 'core',
154
+ method: 'mutation',
155
+ module: 'notifications',
156
+ action: 'sendMobileNotification',
157
+ input: {
158
+ receivers: recipientIds['mobile'],
159
+ title,
160
+ body: message,
161
+ // FCM data values must be strings
162
+ data: {
163
+ contentType,
164
+ contentTypeId: String(contentTypeId ?? ''),
165
+ notificationType: eventName ?? '',
166
+ },
167
+ },
168
+ defaultValue: null,
169
+ });
135
170
  }
136
171
 
137
172
  if (recipientIds['email']?.length) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var startPlugin = require('../../dist/start-plugin-2944ceaa.cjs.dev.js');
5
+ var startPlugin = require('../../dist/start-plugin-2c3dcde9.cjs.dev.js');
6
6
  var mongoose = require('mongoose');
7
7
  var stream$1 = require('stream');
8
8
  var _loadash = require('lodash');
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var startPlugin = require('../../dist/start-plugin-7ebe8e9b.cjs.prod.js');
5
+ var startPlugin = require('../../dist/start-plugin-882163d1.cjs.prod.js');
6
6
  var mongoose = require('mongoose');
7
7
  var stream$1 = require('stream');
8
8
  var _loadash = require('lodash');
@@ -1,5 +1,5 @@
1
- import { u as userHeaderName, g as getEnv, c as connect, _ as _asyncToGenerator, a as _regeneratorRuntime, b as coreModelOrganizations, d as getSubdomain, e as getSaasCoreConnection, f as createScopedEventHandlers, h as _slicedToArray, l as logHandler, r as runBeforeResolvers, s as sendWorkerQueue, i as _objectSpread2, j as chunkArray, k as _createForOfIteratorHelper, m as _createClass, n as _classCallCheck, o as isValidURL, p as sendTRPCMessage, q as _inherits, t as _wrapNativeSuper, v as _callSuper, w as _defineProperty, x as _toConsumableArray } from '../../dist/start-plugin-b4d9fece.esm.js';
2
- export { K as AGENT_TOOL_DEFAULT_MAX_RESPONSE_BYTES, ak as DEFAULT_JOB_OPTIONS, c1 as EXPECTED_ERROR_NAME, c2 as ExpectedError, aU as GP_STATUS, W as HEADER_SIZE_WARN_BYTES, bc as MAX_HEADER_BYTES, aA as ORGANIZATION_ID_MAPPING, T as TBeforeResolversProducers, V as USER_HEADER_OMITTED_FIELDS, N as agentToolResponseTooLargeError, F as agentToolsAuthHeaderName, y as apolloCustomScalars, bn as applyTrustProxy, bp as authCookieOptions, I as buildAgentToolManifest, bW as buildCursorQuery, ag as buildSearchTokenFilter, D as checkBeforeResolvers, aa as checkCollectionCodeDuplication, bM as checkServiceRunning, by as checkUserIds, j as chunkArray, c4 as classifyError, b$ as cleanHtml, b5 as clearServiceDiscoveryCache, P as clientPortalHeaderName, ad as closeMongooose, X as compactUserForHeader, ah as configureSchemaSearchTokens, c as connect, bo as connectionOptions, ar as coreModelAddons, as as coreModelBundles, av as coreModelEndpoints, ay as coreModelExperiences, at as coreModelInstallations, az as coreModelOrganizationPlanHistories, b as coreModelOrganizations, ax as coreModelPlugins, aw as coreModelPromoCodes, au as coreModelUsers, Q as cpUserHeaderName, c3 as createExpectedError, bL as createHealthRoute, al as createMQWorkerWithListeners, bh as createPluginTRPCContext, bi as createTRPCContext, a8 as cursorPaginate, a9 as cursorPaginateAggregation, bH as dateToShortStr, H as decodeAgentToolsAuthHeader, bV as decodeCursor, bg as decodeTRPCContextHeader, a7 as defaultPaginate, G as encodeAgentToolsAuthHeader, bU as encodeCursor, bf as encodeTRPCContextHeader, bk as err, bu as escapeRegExp, E as expectedErrorPlugin, S as extractCPUserFromHeader, U as extractClientPortalFromHeader, c6 as extractMessage, R as extractUserFromHeader, bx as fixDate, bG as fixNum, bP as flattenObject, z as generateApolloContext, af as generateConfiguredSearchTokens, bN as generateRequestProcess, b3 as getActivePlugins, L as getAgentToolMaxResponseBytes, b4 as getAvailablePlugins, bt as getCoreDomain, bA as getDate, bO as getDiffObjects, g as getEnv, bC as getFullDate, aY as getGlobalProfileV2Plugins, bF as getNextMonth, b6 as getPlugin, ba as getPluginAddress, b1 as getPlugins, bD as getPureDate, e as getSaasCoreConnection, aT as getSaasOrgPromoCodes, aO as getSaasOrganizationActiveAddons, aH as getSaasOrganizationByHelpCenterDomain, aM as getSaasOrganizationDetail, aI as getSaasOrganizationHelpCenterDomains, aB as getSaasOrganizationIdBySubdomain, aN as getSaasOrganizationPlanHistories, aD as getSaasOrganizations, aE as getSaasOrganizationsByFilter, aJ as getSaasOrganizationsWithPendingHelpCenterDomain, aC as getSaasOrgsCache, aR as getSaasPlugin, aQ as getSaasPlugins, aS as getSaasPromoCodes, ai as getSchemaSearchTokenConfig, d as getSubdomain, bB as getToday, bE as getTomorrow, bm as getTrustProxySetting, bz as getUniqueValue, O as graphqlPubsub, aG as helpCenterDomainsOf, c8 as initErxesSentry, bb as initializePluginConfig, a$ as isDev, b9 as isEnabled, c5 as isExpectedError, aV as isGlobalProfileV2, bJ as isImage, o as isValidURL, bK as isVideo, b7 as joinErxesGateway, b0 as keyForConfig, b8 as leaveErxesGateway, l as logHandler, B as markResolvers, a3 as mongoStringRequired, ac as mongooseConnectionOptions, a5 as mongooseField, a2 as mongooseStringNonBlank, a1 as mongooseStringRandomId, a4 as mongooseStringRequiredNonBlank, J as mountAgentTools, bj as ok, M as oversizedAgentToolResultBytes, bq as paginate, aX as pluginsFromStripe, aW as pluginsOfStripeItem, bw as pluralFormation, c0 as random, an as randomAlphanumeric, ao as randomLowercase, bR as readFileFromStorage, bS as readFileStreamFromStorage, bQ as readFileUrl, ap as redis, bs as regexSearchText, bZ as removeExtraSpaces, bY as removeLastTrailingSlash, aP as removeOrgsCache, aL as removeSaasOrganizationHelpCenterDomain, aq as resetConfigsCache, r as runBeforeResolvers, aZ as sanitizeFilename, a_ as sanitizeKey, aK as saveSaasOrganizationHelpCenterDomain, ab as schemaWrapper, bl as sendCoreModuleProducer, p as sendTRPCMessage, am as sendWorkerMessage, s as sendWorkerQueue, c7 as sentryExpectedErrorFilter, b2 as setActivePlugins, Z as setCPUserHeader, $ as setClientPortalHeader, Y as setUserHeader, bI as shortStrToDate, ae as splitSearchWords, b_ as splitStr, a0 as startAfterProcess, C as startBeforeResolvers, bd as startPlugin, bX as stripAnsi, aj as toSerializablePayload, be as trpcContextHeaderName, a6 as updateMongoDocumentOrder, bv as updateOrder, aF as updateSaasOrganization, bT as uploadFileToStorage, u as userHeaderName, br as validSearchText, A as wrapApolloResolvers } from '../../dist/start-plugin-b4d9fece.esm.js';
1
+ import { u as userHeaderName, g as getEnv, c as connect, _ as _asyncToGenerator, a as _regeneratorRuntime, b as coreModelOrganizations, d as getSubdomain, e as getSaasCoreConnection, f as createScopedEventHandlers, h as _slicedToArray, l as logHandler, r as runBeforeResolvers, s as sendWorkerQueue, i as _objectSpread2, j as chunkArray, k as _createForOfIteratorHelper, m as _createClass, n as _classCallCheck, o as isValidURL, p as sendTRPCMessage, q as _inherits, t as _wrapNativeSuper, v as _callSuper, w as _defineProperty, x as _toConsumableArray } from '../../dist/start-plugin-322626b5.esm.js';
2
+ export { K as AGENT_TOOL_DEFAULT_MAX_RESPONSE_BYTES, ak as DEFAULT_JOB_OPTIONS, c1 as EXPECTED_ERROR_NAME, c2 as ExpectedError, aU as GP_STATUS, W as HEADER_SIZE_WARN_BYTES, bc as MAX_HEADER_BYTES, aA as ORGANIZATION_ID_MAPPING, T as TBeforeResolversProducers, V as USER_HEADER_OMITTED_FIELDS, N as agentToolResponseTooLargeError, F as agentToolsAuthHeaderName, y as apolloCustomScalars, bn as applyTrustProxy, bp as authCookieOptions, I as buildAgentToolManifest, bW as buildCursorQuery, ag as buildSearchTokenFilter, D as checkBeforeResolvers, aa as checkCollectionCodeDuplication, bM as checkServiceRunning, by as checkUserIds, j as chunkArray, c4 as classifyError, b$ as cleanHtml, b5 as clearServiceDiscoveryCache, P as clientPortalHeaderName, ad as closeMongooose, X as compactUserForHeader, ah as configureSchemaSearchTokens, c as connect, bo as connectionOptions, ar as coreModelAddons, as as coreModelBundles, av as coreModelEndpoints, ay as coreModelExperiences, at as coreModelInstallations, az as coreModelOrganizationPlanHistories, b as coreModelOrganizations, ax as coreModelPlugins, aw as coreModelPromoCodes, au as coreModelUsers, Q as cpUserHeaderName, c3 as createExpectedError, bL as createHealthRoute, al as createMQWorkerWithListeners, bh as createPluginTRPCContext, bi as createTRPCContext, a8 as cursorPaginate, a9 as cursorPaginateAggregation, bH as dateToShortStr, H as decodeAgentToolsAuthHeader, bV as decodeCursor, bg as decodeTRPCContextHeader, a7 as defaultPaginate, G as encodeAgentToolsAuthHeader, bU as encodeCursor, bf as encodeTRPCContextHeader, bk as err, bu as escapeRegExp, E as expectedErrorPlugin, S as extractCPUserFromHeader, U as extractClientPortalFromHeader, c6 as extractMessage, R as extractUserFromHeader, bx as fixDate, bG as fixNum, bP as flattenObject, z as generateApolloContext, af as generateConfiguredSearchTokens, bN as generateRequestProcess, b3 as getActivePlugins, L as getAgentToolMaxResponseBytes, b4 as getAvailablePlugins, bt as getCoreDomain, bA as getDate, bO as getDiffObjects, g as getEnv, bC as getFullDate, aY as getGlobalProfileV2Plugins, bF as getNextMonth, b6 as getPlugin, ba as getPluginAddress, b1 as getPlugins, bD as getPureDate, e as getSaasCoreConnection, aT as getSaasOrgPromoCodes, aO as getSaasOrganizationActiveAddons, aH as getSaasOrganizationByHelpCenterDomain, aM as getSaasOrganizationDetail, aI as getSaasOrganizationHelpCenterDomains, aB as getSaasOrganizationIdBySubdomain, aN as getSaasOrganizationPlanHistories, aD as getSaasOrganizations, aE as getSaasOrganizationsByFilter, aJ as getSaasOrganizationsWithPendingHelpCenterDomain, aC as getSaasOrgsCache, aR as getSaasPlugin, aQ as getSaasPlugins, aS as getSaasPromoCodes, ai as getSchemaSearchTokenConfig, d as getSubdomain, bB as getToday, bE as getTomorrow, bm as getTrustProxySetting, bz as getUniqueValue, O as graphqlPubsub, aG as helpCenterDomainsOf, c8 as initErxesSentry, bb as initializePluginConfig, a$ as isDev, b9 as isEnabled, c5 as isExpectedError, aV as isGlobalProfileV2, bJ as isImage, o as isValidURL, bK as isVideo, b7 as joinErxesGateway, b0 as keyForConfig, b8 as leaveErxesGateway, l as logHandler, B as markResolvers, a3 as mongoStringRequired, ac as mongooseConnectionOptions, a5 as mongooseField, a2 as mongooseStringNonBlank, a1 as mongooseStringRandomId, a4 as mongooseStringRequiredNonBlank, J as mountAgentTools, bj as ok, M as oversizedAgentToolResultBytes, bq as paginate, aX as pluginsFromStripe, aW as pluginsOfStripeItem, bw as pluralFormation, c0 as random, an as randomAlphanumeric, ao as randomLowercase, bR as readFileFromStorage, bS as readFileStreamFromStorage, bQ as readFileUrl, ap as redis, bs as regexSearchText, bZ as removeExtraSpaces, bY as removeLastTrailingSlash, aP as removeOrgsCache, aL as removeSaasOrganizationHelpCenterDomain, aq as resetConfigsCache, r as runBeforeResolvers, aZ as sanitizeFilename, a_ as sanitizeKey, aK as saveSaasOrganizationHelpCenterDomain, ab as schemaWrapper, bl as sendCoreModuleProducer, p as sendTRPCMessage, am as sendWorkerMessage, s as sendWorkerQueue, c7 as sentryExpectedErrorFilter, b2 as setActivePlugins, Z as setCPUserHeader, $ as setClientPortalHeader, Y as setUserHeader, bI as shortStrToDate, ae as splitSearchWords, b_ as splitStr, a0 as startAfterProcess, C as startBeforeResolvers, bd as startPlugin, bX as stripAnsi, aj as toSerializablePayload, be as trpcContextHeaderName, a6 as updateMongoDocumentOrder, bv as updateOrder, aF as updateSaasOrganization, bT as uploadFileToStorage, u as userHeaderName, br as validSearchText, A as wrapApolloResolvers } from '../../dist/start-plugin-322626b5.esm.js';
3
3
  import mongoose from 'mongoose';
4
4
  import { Transform } from 'stream';
5
5
  import { keyBy } from 'lodash';