@messenger-box/platform-server 10.0.3-alpha.7 → 10.0.3-alpha.72
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/lib/containers/containers.js +4 -1
- package/lib/containers/containers.js.map +1 -1
- package/lib/containers/context-services-from-container.d.ts +1 -1
- package/lib/containers/context-services-from-container.js +1 -1
- package/lib/containers/context-services-from-container.js.map +1 -1
- package/lib/graphql/resolvers/channel-member.d.ts +3 -2
- package/lib/graphql/resolvers/channel-member.js +30 -5
- package/lib/graphql/resolvers/channel-member.js.map +1 -1
- package/lib/graphql/resolvers/channel.d.ts +3 -2
- package/lib/graphql/resolvers/channel.js +279 -53
- package/lib/graphql/resolvers/channel.js.map +1 -1
- package/lib/graphql/resolvers/extended-token-account.d.ts +3 -2
- package/lib/graphql/resolvers/extended-token-account.js +90 -23
- package/lib/graphql/resolvers/extended-token-account.js.map +1 -1
- package/lib/graphql/resolvers/index.d.ts +1 -1
- package/lib/graphql/resolvers/post-thread.d.ts +1 -1
- package/lib/graphql/resolvers/post-thread.js +294 -132
- package/lib/graphql/resolvers/post-thread.js.map +1 -1
- package/lib/graphql/resolvers/post.d.ts +2 -3
- package/lib/graphql/resolvers/post.js +696 -234
- package/lib/graphql/resolvers/post.js.map +1 -1
- package/lib/graphql/resolvers/reaction.d.ts +3 -2
- package/lib/graphql/resolvers/reaction.js +96 -14
- package/lib/graphql/resolvers/reaction.js.map +1 -1
- package/lib/graphql/schema/channel-member.graphql +110 -21
- package/lib/graphql/schema/channel-member.graphql.js +1 -1
- package/lib/graphql/schema/channel.graphql +337 -38
- package/lib/graphql/schema/channel.graphql.js +1 -1
- package/lib/graphql/schema/post-thread.graphql +167 -21
- package/lib/graphql/schema/post-thread.graphql.js +1 -1
- package/lib/graphql/schema/post.graphql +284 -40
- package/lib/graphql/schema/post.graphql.js +1 -1
- package/lib/graphql/schema/reaction.graphql +71 -13
- package/lib/graphql/schema/reaction.graphql.js +1 -1
- package/lib/graphql/schema/services.graphql +2 -0
- package/lib/graphql/schema/users.graphql +76 -13
- package/lib/graphql/schema/users.graphql.js +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/interfaces/index.d.ts +0 -1
- package/lib/interfaces/services.d.ts +1 -1
- package/lib/migrations/dbMigrations/AddPostsConfigurationsMigration.d.ts +17 -0
- package/lib/migrations/dbMigrations/AddPostsConfigurationsMigration.js +44 -0
- package/lib/migrations/dbMigrations/AddPostsConfigurationsMigration.js.map +1 -0
- package/lib/migrations/dbMigrations/index.d.ts +1 -0
- package/lib/migrations/index.d.ts +1 -0
- package/lib/migrations/mail-template-migration.js +1 -1
- package/lib/migrations/message-notification-template-migration.d.ts +1 -1
- package/lib/migrations/message-notification-template-migration.js +1 -1
- package/lib/plugins/channel-moleculer-service.d.ts +21 -1
- package/lib/plugins/channel-moleculer-service.js +417 -115
- package/lib/plugins/channel-moleculer-service.js.map +1 -1
- package/lib/plugins/extended-token-account-moleculer-service.d.ts +25 -1
- package/lib/plugins/extended-token-account-moleculer-service.js +348 -22
- package/lib/plugins/extended-token-account-moleculer-service.js.map +1 -1
- package/lib/plugins/messenger-notification-moleculer-service.d.ts +27 -3
- package/lib/plugins/messenger-notification-moleculer-service.js +404 -58
- package/lib/plugins/messenger-notification-moleculer-service.js.map +1 -1
- package/lib/plugins/post-moleculer-service.d.ts +85 -21
- package/lib/plugins/post-moleculer-service.js +986 -256
- package/lib/plugins/post-moleculer-service.js.map +1 -1
- package/lib/plugins/post-thread-moleculer-service.d.ts +33 -1
- package/lib/plugins/post-thread-moleculer-service.js +326 -8
- package/lib/plugins/post-thread-moleculer-service.js.map +1 -1
- package/lib/plugins/reaction-moleculer-service.js +1 -1
- package/lib/plugins/reaction-moleculer-service.js.map +1 -1
- package/lib/preferences/settings/post-settings.d.ts +2 -0
- package/lib/preferences/settings/post-settings.js +47 -9
- package/lib/preferences/settings/post-settings.js.map +1 -1
- package/lib/services/channel-service.d.ts +179 -33
- package/lib/services/channel-service.js +821 -274
- package/lib/services/channel-service.js.map +1 -1
- package/lib/services/extended-token-account-service.d.ts +130 -14
- package/lib/services/extended-token-account-service.js +462 -52
- package/lib/services/extended-token-account-service.js.map +1 -1
- package/lib/services/index.d.ts +1 -0
- package/lib/services/messenger-notification-service.d.ts +106 -13
- package/lib/services/messenger-notification-service.js +824 -442
- package/lib/services/messenger-notification-service.js.map +1 -1
- package/lib/services/post-service.d.ts +182 -16
- package/lib/services/post-service.js +731 -115
- package/lib/services/post-service.js.map +1 -1
- package/lib/services/post-thread-service.d.ts +114 -5
- package/lib/services/post-thread-service.js +400 -13
- package/lib/services/post-thread-service.js.map +1 -1
- package/lib/services/proxy-services/channel-microservice.d.ts +5 -3
- package/lib/services/proxy-services/channel-microservice.js +19 -10
- package/lib/services/proxy-services/channel-microservice.js.map +1 -1
- package/lib/services/proxy-services/messenger-notification-microservice.d.ts +128 -8
- package/lib/services/proxy-services/messenger-notification-microservice.js +324 -29
- package/lib/services/proxy-services/messenger-notification-microservice.js.map +1 -1
- package/lib/services/proxy-services/post-microservice.d.ts +186 -12
- package/lib/services/proxy-services/post-microservice.js +543 -54
- package/lib/services/proxy-services/post-microservice.js.map +1 -1
- package/lib/services/proxy-services/post-thread-microservice.d.ts +134 -3
- package/lib/services/proxy-services/post-thread-microservice.js +388 -6
- package/lib/services/proxy-services/post-thread-microservice.js.map +1 -1
- package/lib/services/proxy-services/reaction-microservice.d.ts +161 -3
- package/lib/services/proxy-services/reaction-microservice.js +474 -2
- package/lib/services/proxy-services/reaction-microservice.js.map +1 -1
- package/lib/services/reaction-service.d.ts +124 -4
- package/lib/services/reaction-service.js +415 -3
- package/lib/services/reaction-service.js.map +1 -1
- package/lib/services/redis-cache-manager.d.ts +18 -0
- package/lib/services/redis-cache-manager.js +83 -0
- package/lib/services/redis-cache-manager.js.map +1 -0
- package/lib/store/models/account-token-store.d.ts +1 -1
- package/lib/store/models/account-token-store.js.map +1 -1
- package/lib/store/models/channel.d.ts +2 -3
- package/lib/store/models/channel.js +181 -72
- package/lib/store/models/channel.js.map +1 -1
- package/lib/store/models/post-thread.d.ts +3 -3
- package/lib/store/models/post-thread.js +96 -14
- package/lib/store/models/post-thread.js.map +1 -1
- package/lib/store/models/post.d.ts +2 -3
- package/lib/store/models/post.js +143 -23
- package/lib/store/models/post.js.map +1 -1
- package/lib/store/models/reaction.d.ts +2 -3
- package/lib/store/models/reaction.js +67 -8
- package/lib/store/models/reaction.js.map +1 -1
- package/lib/store/repositories/__tests__/__fixtures__/team-repository.d.ts +3 -3
- package/lib/store/repositories/channel-repository.d.ts +6 -6
- package/lib/store/repositories/channel-repository.js +5 -2
- package/lib/store/repositories/channel-repository.js.map +1 -1
- package/lib/store/repositories/post-repository.d.ts +6 -6
- package/lib/store/repositories/post-repository.js +5 -2
- package/lib/store/repositories/post-repository.js.map +1 -1
- package/lib/store/repositories/post-thread-repository.d.ts +6 -6
- package/lib/store/repositories/post-thread-repository.js +5 -2
- package/lib/store/repositories/post-thread-repository.js.map +1 -1
- package/lib/store/repositories/reaction-repository.d.ts +6 -6
- package/lib/store/repositories/reaction-repository.js +5 -2
- package/lib/store/repositories/reaction-repository.js.map +1 -1
- package/lib/templates/constants/SERVER_TYPES.ts.template +0 -3
- package/lib/templates/repositories/ChannelRepository.ts.template +3 -3
- package/lib/templates/repositories/PostRepository.ts.template +3 -3
- package/lib/templates/repositories/PostThreadRepository.ts.template +3 -3
- package/lib/templates/repositories/ReactionRepository.ts.template +3 -4
- package/lib/templates/services/ChannelService.ts.template +280 -39
- package/lib/templates/services/ExtendedTokenAccountService.ts.template +104 -9
- package/lib/templates/services/MessengerNotificationService.ts.template +94 -19
- package/lib/templates/services/PostService.ts.template +184 -20
- package/lib/templates/services/PostThreadService.ts.template +151 -6
- package/lib/templates/services/ReactionService.ts.template +129 -3
- package/lib/templates/services/RedisCacheManager.ts.template +22 -0
- package/package.json +6 -5
- package/lib/interfaces/context.d.ts +0 -14
- package/lib/store/models/common-options.js +0 -20
- package/lib/store/models/common-options.js.map +0 -1
|
@@ -1,81 +1,491 @@
|
|
|
1
|
-
import {__decorate,__param,__metadata}from'tslib';import {injectable,inject}from'inversify';import {CommonType}from'@common-stack/core';import {ServiceBroker}from'moleculer';import {MoleculerServiceName,AccountServiceAction,TokenTypesEnum,AuthStrategy}from'common';
|
|
1
|
+
import {__decorate,__param,__metadata}from'tslib';import {injectable,inject}from'inversify';import {CommonType}from'@common-stack/core';import {ServiceBroker}from'moleculer';import'@cdm-logger/core';import {DisposableCollection}from'@adminide-stack/core';import {MoleculerServiceName,AccountServiceAction,TokenTypesEnum,AuthStrategy}from'common/server';import {BaseService2}from'@common-stack/store-mongo';/**
|
|
2
|
+
* Extended Token Account Service Implementation
|
|
3
|
+
*
|
|
4
|
+
* This service handles comprehensive device token management and account operations
|
|
5
|
+
* within the messenger platform, providing advanced token lifecycle management
|
|
6
|
+
* and user account integration capabilities.
|
|
7
|
+
*
|
|
8
|
+
* Key capabilities:
|
|
9
|
+
* - Device token management (add, remove, retrieve)
|
|
10
|
+
* - Expo notification token handling
|
|
11
|
+
* - Auth0 integration and user lookup
|
|
12
|
+
* - Token lifecycle tracking (refresh count, usage count)
|
|
13
|
+
* - Bulk token operations and cleanup
|
|
14
|
+
* - Account service integration through Moleculer broker
|
|
15
|
+
* - Cross-platform token synchronization
|
|
16
|
+
* - Token validation and verification
|
|
17
|
+
* - User context and authentication strategy handling
|
|
18
|
+
* - Comprehensive error handling and logging
|
|
19
|
+
*
|
|
20
|
+
* The service integrates with the account microservice through Moleculer broker
|
|
21
|
+
* and provides robust token management for mobile and web applications,
|
|
22
|
+
* ensuring reliable push notification delivery and user authentication flows.
|
|
23
|
+
*/
|
|
24
|
+
let ExtendedTokenAccountService = class ExtendedTokenAccountService extends BaseService2 {
|
|
2
25
|
broker;
|
|
3
|
-
|
|
26
|
+
toDispose = new DisposableCollection();
|
|
27
|
+
logger;
|
|
28
|
+
constructor(broker, logger) {
|
|
29
|
+
super({});
|
|
4
30
|
this.broker = broker;
|
|
31
|
+
this.logger = logger?.child({
|
|
32
|
+
className: 'ExtendedTokenAccountService'
|
|
33
|
+
}) || console;
|
|
5
34
|
}
|
|
6
35
|
/**
|
|
36
|
+
* Disposes of resources used by the service
|
|
37
|
+
*/
|
|
38
|
+
dispose() {
|
|
39
|
+
this.toDispose.dispose();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Retrieves device tokens for a specific account
|
|
7
43
|
*
|
|
8
|
-
* @
|
|
9
|
-
*
|
|
44
|
+
* @description Fetches the complete user account with all associated device tokens
|
|
45
|
+
* for notification delivery and device management purposes
|
|
10
46
|
*
|
|
11
|
-
* tokens
|
|
12
|
-
*
|
|
13
|
-
* token: 'deviceName:xdfjdljfdljfllk',
|
|
14
|
-
* }]
|
|
47
|
+
* @param {string} accountId - The account ID to retrieve tokens for
|
|
48
|
+
* @returns {Promise<AsDomainType<IUserAccountModel> | Error>} - User account with tokens or error
|
|
15
49
|
*/
|
|
16
50
|
async getDeviceToken(accountId) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
51
|
+
try {
|
|
52
|
+
if (!accountId) {
|
|
53
|
+
return new Error('Account ID is required');
|
|
54
|
+
}
|
|
55
|
+
this.logger.debug('Retrieving device tokens for account', {
|
|
56
|
+
accountId
|
|
57
|
+
});
|
|
58
|
+
const user = await this.broker.call(`${MoleculerServiceName.AccountUser}.${AccountServiceAction.FindAccountById}`, {
|
|
59
|
+
id: accountId
|
|
60
|
+
});
|
|
61
|
+
if (!user) {
|
|
62
|
+
return new Error(`Account not found for ID: ${accountId}`);
|
|
63
|
+
}
|
|
64
|
+
this.logger.debug('Device tokens retrieved successfully', {
|
|
65
|
+
accountId,
|
|
66
|
+
tokenCount: user.tokens?.length || 0
|
|
67
|
+
});
|
|
68
|
+
// Convert IUserAccount to AsDomainType<IUserAccountModel>
|
|
69
|
+
return user;
|
|
70
|
+
} catch (error) {
|
|
71
|
+
this.logger.error('Error retrieving device tokens: %o', error);
|
|
72
|
+
return error instanceof Error ? error : new Error('Unknown error occurred while retrieving device tokens');
|
|
73
|
+
}
|
|
20
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Sets or updates a device token for an account
|
|
77
|
+
*
|
|
78
|
+
* @description Adds a new Expo notification token to the user's account
|
|
79
|
+
* for push notification delivery, with tracking metadata
|
|
80
|
+
*
|
|
81
|
+
* @param {string} deviceToken - The device token to add
|
|
82
|
+
* @param {string} accountId - The account ID to add the token to
|
|
83
|
+
* @returns {Promise<AsDomainType<IUserAccountModel> | Error>} - Updated user account or error
|
|
84
|
+
*/
|
|
21
85
|
async setDeviceToken(deviceToken, accountId) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
86
|
+
try {
|
|
87
|
+
if (!deviceToken) {
|
|
88
|
+
return new Error('Device token is required');
|
|
89
|
+
}
|
|
90
|
+
if (!accountId) {
|
|
91
|
+
return new Error('Account ID is required');
|
|
92
|
+
}
|
|
93
|
+
this.logger.debug('Setting device token for account', {
|
|
94
|
+
accountId,
|
|
95
|
+
tokenLength: deviceToken.length
|
|
96
|
+
});
|
|
97
|
+
const mobileToken = {
|
|
98
|
+
type: TokenTypesEnum.ExpoNotificationToken,
|
|
99
|
+
token: deviceToken,
|
|
100
|
+
refreshedCount: 0,
|
|
101
|
+
usedCount: 0,
|
|
102
|
+
createdAt: new Date(),
|
|
103
|
+
lastUsedAt: null
|
|
104
|
+
};
|
|
105
|
+
const result = await this.broker.call(`${MoleculerServiceName.AccountUser}.${AccountServiceAction.AddUserToken}`, {
|
|
106
|
+
userId: accountId,
|
|
107
|
+
token: mobileToken
|
|
108
|
+
});
|
|
109
|
+
if (!result) {
|
|
110
|
+
return new Error('Failed to add device token');
|
|
111
|
+
}
|
|
112
|
+
this.logger.debug('Device token added successfully', {
|
|
113
|
+
accountId,
|
|
114
|
+
tokenType: mobileToken.type
|
|
115
|
+
});
|
|
116
|
+
// Convert IUserAccount to AsDomainType<IUserAccountModel>
|
|
117
|
+
return result;
|
|
118
|
+
} catch (error) {
|
|
119
|
+
this.logger.error('Error setting device token: %o', error);
|
|
120
|
+
return error instanceof Error ? error : new Error('Unknown error occurred while setting device token');
|
|
121
|
+
}
|
|
32
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Removes a device token from an account
|
|
125
|
+
*
|
|
126
|
+
* @description Removes the specified Expo notification token from the user's account
|
|
127
|
+
* to stop push notifications to that device
|
|
128
|
+
*
|
|
129
|
+
* @param {string} deviceToken - The device token to remove
|
|
130
|
+
* @param {string} accountId - The account ID to remove the token from
|
|
131
|
+
* @returns {Promise<AsDomainType<IUserAccountModel> | Error>} - Updated user account or error
|
|
132
|
+
*/
|
|
33
133
|
async removeDeviceToken(deviceToken, accountId) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
134
|
+
try {
|
|
135
|
+
if (!deviceToken) {
|
|
136
|
+
return new Error('Device token is required');
|
|
137
|
+
}
|
|
138
|
+
if (!accountId) {
|
|
139
|
+
return new Error('Account ID is required');
|
|
140
|
+
}
|
|
141
|
+
this.logger.debug('Removing device token from account', {
|
|
142
|
+
accountId,
|
|
143
|
+
tokenLength: deviceToken.length
|
|
144
|
+
});
|
|
145
|
+
const mobileToken = {
|
|
146
|
+
type: TokenTypesEnum.ExpoNotificationToken,
|
|
147
|
+
token: deviceToken,
|
|
148
|
+
refreshedCount: 0,
|
|
149
|
+
usedCount: 0
|
|
150
|
+
};
|
|
151
|
+
const result = await this.broker.call(`${MoleculerServiceName.AccountUser}.${AccountServiceAction.RemoveUserToken}`, {
|
|
152
|
+
userId: accountId,
|
|
153
|
+
token: mobileToken
|
|
154
|
+
});
|
|
155
|
+
if (!result) {
|
|
156
|
+
return new Error('Failed to remove device token');
|
|
157
|
+
}
|
|
158
|
+
this.logger.debug('Device token removed successfully', {
|
|
159
|
+
accountId,
|
|
160
|
+
tokenType: mobileToken.type
|
|
161
|
+
});
|
|
162
|
+
// Convert IUserAccount to AsDomainType<IUserAccountModel>
|
|
163
|
+
return result;
|
|
164
|
+
} catch (error) {
|
|
165
|
+
this.logger.error('Error removing device token: %o', error);
|
|
166
|
+
return error instanceof Error ? error : new Error('Unknown error occurred while removing device token');
|
|
167
|
+
}
|
|
46
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Retrieves an account by Auth0 ID
|
|
171
|
+
*
|
|
172
|
+
* @description Finds a user account using Auth0 authentication ID
|
|
173
|
+
* with proper authentication strategy context
|
|
174
|
+
*
|
|
175
|
+
* @param {string} auth0Id - The Auth0 user ID
|
|
176
|
+
* @param {IAccountServiceContext} context - Optional account service context
|
|
177
|
+
* @returns {Promise<AsDomainType<IUserAccountModel> | Error>} - User account or error
|
|
178
|
+
*/
|
|
47
179
|
async getAccountByAuth0Id(auth0Id, context) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
authStrategy: AuthStrategy.Auth0 // should be replaced with sessioin context
|
|
180
|
+
try {
|
|
181
|
+
if (!auth0Id) {
|
|
182
|
+
return new Error('Auth0 ID is required');
|
|
52
183
|
}
|
|
53
|
-
|
|
184
|
+
this.logger.debug('Retrieving account by Auth0 ID', {
|
|
185
|
+
auth0Id
|
|
186
|
+
});
|
|
187
|
+
const serviceContext = context || {
|
|
188
|
+
authStrategy: AuthStrategy.Auth0
|
|
189
|
+
};
|
|
190
|
+
const user = await this.broker.call(`${MoleculerServiceName.AccountUser}.${AccountServiceAction.FindAccountByUser}`, {
|
|
191
|
+
id: auth0Id,
|
|
192
|
+
context: serviceContext
|
|
193
|
+
});
|
|
194
|
+
if (!user) {
|
|
195
|
+
return new Error(`Account not found for Auth0 ID: ${auth0Id}`);
|
|
196
|
+
}
|
|
197
|
+
this.logger.debug('Account retrieved successfully by Auth0 ID', {
|
|
198
|
+
auth0Id,
|
|
199
|
+
accountId: user.id,
|
|
200
|
+
authStrategy: serviceContext.authStrategy
|
|
201
|
+
});
|
|
202
|
+
// Convert IUserAccount to AsDomainType<IUserAccountModel>
|
|
203
|
+
return user;
|
|
204
|
+
} catch (error) {
|
|
205
|
+
this.logger.error('Error retrieving account by Auth0 ID: %o', error);
|
|
206
|
+
return error instanceof Error ? error : new Error('Unknown error occurred while retrieving account by Auth0 ID');
|
|
207
|
+
}
|
|
54
208
|
}
|
|
209
|
+
/**
|
|
210
|
+
* Removes all Expo notification tokens for a user by Auth0 ID
|
|
211
|
+
*
|
|
212
|
+
* @description Cleans up all Expo notification tokens associated with a user account
|
|
213
|
+
* identified by Auth0 ID, typically used during logout or account deactivation
|
|
214
|
+
*
|
|
215
|
+
* @param {string} auth0Id - The Auth0 user ID
|
|
216
|
+
* @param {IAccountServiceContext} context - Optional account service context
|
|
217
|
+
* @returns {Promise<void | Error>} - Success status or error
|
|
218
|
+
*/
|
|
55
219
|
async removeUserExpoTokenByAuth0Id(auth0Id, context) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
220
|
+
try {
|
|
221
|
+
if (!auth0Id) {
|
|
222
|
+
return new Error('Auth0 ID is required');
|
|
223
|
+
}
|
|
224
|
+
this.logger.debug('Removing Expo tokens for Auth0 user', {
|
|
225
|
+
auth0Id
|
|
226
|
+
});
|
|
227
|
+
const serviceContext = context || {
|
|
228
|
+
authStrategy: AuthStrategy.Auth0
|
|
229
|
+
};
|
|
230
|
+
const user = await this.broker.call(`${MoleculerServiceName.AccountUser}.${AccountServiceAction.FindAccountByUser}`, {
|
|
231
|
+
id: auth0Id,
|
|
232
|
+
context: serviceContext
|
|
233
|
+
});
|
|
234
|
+
if (!user) {
|
|
235
|
+
return new Error(`Account not found for Auth0 ID: ${auth0Id}`);
|
|
236
|
+
}
|
|
237
|
+
const expoTokens = user?.tokens?.filter(t => t?.type === 'EXPO_NOTIFICATION_TOKEN') || [];
|
|
238
|
+
if (expoTokens.length === 0) {
|
|
239
|
+
this.logger.debug('No Expo tokens found to remove', {
|
|
240
|
+
auth0Id
|
|
241
|
+
});
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
this.logger.debug('Found Expo tokens to remove', {
|
|
245
|
+
auth0Id,
|
|
246
|
+
tokenCount: expoTokens.length
|
|
247
|
+
});
|
|
248
|
+
// Process token removals in parallel for better performance
|
|
249
|
+
const removalPromises = expoTokens.map(async token => {
|
|
250
|
+
try {
|
|
66
251
|
const mobileToken = {
|
|
67
252
|
type: TokenTypesEnum.ExpoNotificationToken,
|
|
68
|
-
token:
|
|
253
|
+
token: token?.token,
|
|
69
254
|
refreshedCount: 0,
|
|
70
255
|
usedCount: 0
|
|
71
256
|
};
|
|
72
|
-
this.broker.call(`${MoleculerServiceName.AccountUser}.${AccountServiceAction.RemoveUserToken}`, {
|
|
73
|
-
userId: user
|
|
257
|
+
await this.broker.call(`${MoleculerServiceName.AccountUser}.${AccountServiceAction.RemoveUserToken}`, {
|
|
258
|
+
userId: user.id,
|
|
74
259
|
token: mobileToken
|
|
75
260
|
});
|
|
261
|
+
return true;
|
|
262
|
+
} catch (error) {
|
|
263
|
+
this.logger.error('Error removing individual token: %o', error);
|
|
264
|
+
return false;
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
const results = await Promise.all(removalPromises);
|
|
268
|
+
const successCount = results.filter(Boolean).length;
|
|
269
|
+
const failureCount = results.length - successCount;
|
|
270
|
+
if (failureCount > 0) {
|
|
271
|
+
this.logger.warn('Some token removals failed', {
|
|
272
|
+
auth0Id,
|
|
273
|
+
successCount,
|
|
274
|
+
failureCount
|
|
76
275
|
});
|
|
276
|
+
return new Error(`Failed to remove ${failureCount} tokens`);
|
|
277
|
+
}
|
|
278
|
+
this.logger.debug('Expo token removal completed', {
|
|
279
|
+
auth0Id,
|
|
280
|
+
totalTokens: expoTokens.length,
|
|
281
|
+
successfulRemovals: successCount,
|
|
282
|
+
failedRemovals: failureCount
|
|
283
|
+
});
|
|
284
|
+
} catch (error) {
|
|
285
|
+
this.logger.error('Error removing user Expo tokens by Auth0 ID: %o', error);
|
|
286
|
+
return error instanceof Error ? error : new Error('Unknown error occurred while removing user Expo tokens');
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Retrieves device tokens for multiple users
|
|
291
|
+
*
|
|
292
|
+
* @description Fetches device tokens for a list of user accounts
|
|
293
|
+
* for bulk notification operations
|
|
294
|
+
*
|
|
295
|
+
* @param {string[]} userIds - Array of user IDs to get tokens for
|
|
296
|
+
* @returns {Promise<Record<string, AsDomainType<IUserAccountModel>> | Error>} - Map of user ID to account or error
|
|
297
|
+
*/
|
|
298
|
+
async getAllDeviceToken(userIds) {
|
|
299
|
+
try {
|
|
300
|
+
if (!userIds || userIds.length === 0) {
|
|
301
|
+
return new Error('User IDs array is required and cannot be empty');
|
|
302
|
+
}
|
|
303
|
+
this.logger.debug('Retrieving device tokens for multiple users', {
|
|
304
|
+
userCount: userIds.length
|
|
305
|
+
});
|
|
306
|
+
// Process user lookups in parallel for better performance
|
|
307
|
+
const userPromises = userIds.map(async userId => {
|
|
308
|
+
try {
|
|
309
|
+
const user = await this.getDeviceToken(userId);
|
|
310
|
+
return {
|
|
311
|
+
userId,
|
|
312
|
+
user
|
|
313
|
+
};
|
|
314
|
+
} catch (error) {
|
|
315
|
+
this.logger.warn('Failed to get tokens for user', {
|
|
316
|
+
userId,
|
|
317
|
+
error
|
|
318
|
+
});
|
|
319
|
+
return {
|
|
320
|
+
userId,
|
|
321
|
+
user: null
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
const results = await Promise.all(userPromises);
|
|
326
|
+
// Filter out failed requests and build result map
|
|
327
|
+
const userMap = {};
|
|
328
|
+
let successCount = 0;
|
|
329
|
+
results.forEach(({
|
|
330
|
+
userId,
|
|
331
|
+
user
|
|
332
|
+
}) => {
|
|
333
|
+
if (user && !(user instanceof Error)) {
|
|
334
|
+
userMap[userId] = user;
|
|
335
|
+
successCount++;
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
this.logger.debug('Bulk device token retrieval completed', {
|
|
339
|
+
totalRequested: userIds.length,
|
|
340
|
+
successfulRetrievals: successCount,
|
|
341
|
+
failedRetrievals: userIds.length - successCount
|
|
342
|
+
});
|
|
343
|
+
return userMap;
|
|
344
|
+
} catch (error) {
|
|
345
|
+
this.logger.error('Error retrieving device tokens for multiple users: %o', error);
|
|
346
|
+
return error instanceof Error ? error : new Error('Unknown error occurred while retrieving device tokens for multiple users');
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Retrieves device tokens for multiple users by their account IDs
|
|
351
|
+
*
|
|
352
|
+
* @description Alternative method for bulk token retrieval using account IDs
|
|
353
|
+
* with enhanced filtering and validation
|
|
354
|
+
*
|
|
355
|
+
* @param {string[]} accountIds - Array of account IDs to get tokens for
|
|
356
|
+
* @returns {Promise<Array<{ accountId: string; tokens: any[] }> | Error>} - Array of account tokens or error
|
|
357
|
+
*/
|
|
358
|
+
async getAllDeviceTokenById(accountIds) {
|
|
359
|
+
try {
|
|
360
|
+
if (!accountIds || accountIds.length === 0) {
|
|
361
|
+
return new Error('Account IDs array is required and cannot be empty');
|
|
362
|
+
}
|
|
363
|
+
this.logger.debug('Retrieving device tokens by account IDs', {
|
|
364
|
+
accountCount: accountIds.length
|
|
365
|
+
});
|
|
366
|
+
const tokenResults = [];
|
|
367
|
+
// Process each account to extract tokens
|
|
368
|
+
for (const accountId of accountIds) {
|
|
369
|
+
try {
|
|
370
|
+
const userResult = await this.getDeviceToken(accountId);
|
|
371
|
+
if (userResult instanceof Error) {
|
|
372
|
+
this.logger.warn('Failed to get account data', {
|
|
373
|
+
accountId,
|
|
374
|
+
error: userResult.message
|
|
375
|
+
});
|
|
376
|
+
continue;
|
|
377
|
+
}
|
|
378
|
+
const tokens = userResult.tokens?.filter(t => t?.type === TokenTypesEnum.ExpoNotificationToken && t?.token) || [];
|
|
379
|
+
tokenResults.push({
|
|
380
|
+
accountId,
|
|
381
|
+
tokens: tokens.map(t => ({
|
|
382
|
+
token: t.token,
|
|
383
|
+
type: t.type,
|
|
384
|
+
refreshedCount: t.refreshedCount || 0,
|
|
385
|
+
usedCount: t.usedCount || 0,
|
|
386
|
+
createdAt: t.createdAt,
|
|
387
|
+
lastUsedAt: t.lastUsedAt
|
|
388
|
+
}))
|
|
389
|
+
});
|
|
390
|
+
} catch (error) {
|
|
391
|
+
this.logger.warn('Error processing account for token retrieval', {
|
|
392
|
+
accountId,
|
|
393
|
+
error
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
this.logger.debug('Bulk token retrieval by ID completed', {
|
|
398
|
+
totalRequested: accountIds.length,
|
|
399
|
+
successfulRetrievals: tokenResults.length,
|
|
400
|
+
totalTokens: tokenResults.reduce((sum, result) => sum + result.tokens.length, 0)
|
|
401
|
+
});
|
|
402
|
+
return tokenResults;
|
|
403
|
+
} catch (error) {
|
|
404
|
+
this.logger.error('Error retrieving device tokens by account IDs: %o', error);
|
|
405
|
+
return error instanceof Error ? error : new Error('Unknown error occurred while retrieving device tokens by account IDs');
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Validates if a device token is active and valid
|
|
410
|
+
*
|
|
411
|
+
* @description Checks if a device token exists and is active for an account
|
|
412
|
+
*
|
|
413
|
+
* @param {string} deviceToken - The device token to validate
|
|
414
|
+
* @param {string} accountId - The account ID to check against
|
|
415
|
+
* @returns {Promise<boolean | Error>} - Validation result or error
|
|
416
|
+
*/
|
|
417
|
+
async validateDeviceToken(deviceToken, accountId) {
|
|
418
|
+
try {
|
|
419
|
+
if (!deviceToken || !accountId) {
|
|
420
|
+
return new Error('Device token and account ID are required');
|
|
421
|
+
}
|
|
422
|
+
this.logger.debug('Validating device token', {
|
|
423
|
+
accountId,
|
|
424
|
+
tokenLength: deviceToken.length
|
|
425
|
+
});
|
|
426
|
+
const userResult = await this.getDeviceToken(accountId);
|
|
427
|
+
if (userResult instanceof Error) {
|
|
428
|
+
return userResult;
|
|
429
|
+
}
|
|
430
|
+
const hasValidToken = userResult.tokens?.some(t => t?.type === TokenTypesEnum.ExpoNotificationToken && t?.token === deviceToken) || false;
|
|
431
|
+
this.logger.debug('Device token validation completed', {
|
|
432
|
+
accountId,
|
|
433
|
+
isValid: hasValidToken
|
|
434
|
+
});
|
|
435
|
+
return hasValidToken;
|
|
436
|
+
} catch (error) {
|
|
437
|
+
this.logger.error('Error validating device token: %o', error);
|
|
438
|
+
return error instanceof Error ? error : new Error('Unknown error occurred while validating device token');
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Updates token usage statistics
|
|
443
|
+
*
|
|
444
|
+
* @description Increments usage count for a device token
|
|
445
|
+
*
|
|
446
|
+
* @param {string} deviceToken - The device token to update
|
|
447
|
+
* @param {string} accountId - The account ID the token belongs to
|
|
448
|
+
* @returns {Promise<boolean | Error>} - Update result or error
|
|
449
|
+
*/
|
|
450
|
+
async updateTokenUsage(deviceToken, accountId) {
|
|
451
|
+
try {
|
|
452
|
+
if (!deviceToken || !accountId) {
|
|
453
|
+
return new Error('Device token and account ID are required');
|
|
454
|
+
}
|
|
455
|
+
this.logger.debug('Updating token usage statistics', {
|
|
456
|
+
accountId
|
|
457
|
+
});
|
|
458
|
+
// First remove the old token
|
|
459
|
+
const removeResult = await this.removeDeviceToken(deviceToken, accountId);
|
|
460
|
+
if (removeResult instanceof Error) {
|
|
461
|
+
return removeResult;
|
|
462
|
+
}
|
|
463
|
+
// Then add it back with updated usage count
|
|
464
|
+
// Note: This is a simplified approach. In a real implementation,
|
|
465
|
+
// you might want to have a dedicated endpoint for updating token metadata
|
|
466
|
+
const updatedToken = {
|
|
467
|
+
type: TokenTypesEnum.ExpoNotificationToken,
|
|
468
|
+
token: deviceToken,
|
|
469
|
+
refreshedCount: 0,
|
|
470
|
+
usedCount: 1,
|
|
471
|
+
// Increment usage
|
|
472
|
+
lastUsedAt: new Date()
|
|
473
|
+
};
|
|
474
|
+
const addResult = await this.broker.call(`${MoleculerServiceName.AccountUser}.${AccountServiceAction.AddUserToken}`, {
|
|
475
|
+
userId: accountId,
|
|
476
|
+
token: updatedToken
|
|
477
|
+
});
|
|
478
|
+
if (!addResult) {
|
|
479
|
+
return new Error('Failed to update token usage');
|
|
77
480
|
}
|
|
481
|
+
this.logger.debug('Token usage updated successfully', {
|
|
482
|
+
accountId
|
|
483
|
+
});
|
|
484
|
+
return true;
|
|
485
|
+
} catch (error) {
|
|
486
|
+
this.logger.error('Error updating token usage: %o', error);
|
|
487
|
+
return error instanceof Error ? error : new Error('Unknown error occurred while updating token usage');
|
|
78
488
|
}
|
|
79
489
|
}
|
|
80
490
|
};
|
|
81
|
-
ExtendedTokenAccountService = __decorate([injectable(), __param(0, inject(CommonType.MOLECULER_BROKER)), __metadata("design:paramtypes", [ServiceBroker])], ExtendedTokenAccountService);export{ExtendedTokenAccountService};//# sourceMappingURL=extended-token-account-service.js.map
|
|
491
|
+
ExtendedTokenAccountService = __decorate([injectable(), __param(0, inject(CommonType.MOLECULER_BROKER)), __param(1, inject('Logger')), __metadata("design:paramtypes", [ServiceBroker, Object])], ExtendedTokenAccountService);export{ExtendedTokenAccountService};//# sourceMappingURL=extended-token-account-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extended-token-account-service.js","sources":["../../src/services/extended-token-account-service.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extended-token-account-service.js","sources":["../../src/services/extended-token-account-service.ts"],"sourcesContent":[null],"names":[],"mappings":"sZAsBA;;;;;;;;;;;;;;;;;;;;;;AAsBG;A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