propro-utils 1.5.65 → 1.5.66
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/middlewares/account_info.js +30 -14
- package/package.json +1 -1
|
@@ -141,21 +141,37 @@ const checkIfUserExists = async accountId => {
|
|
|
141
141
|
let services;
|
|
142
142
|
try {
|
|
143
143
|
debugLog('services', 'Initializing services...');
|
|
144
|
+
|
|
145
|
+
// Wrap each service request in a proper Promise chain
|
|
146
|
+
const serviceRequests = [
|
|
147
|
+
Promise.resolve(ServiceManager.getService('UserSchema')).then(
|
|
148
|
+
service => service,
|
|
149
|
+
error => {
|
|
150
|
+
throw new Error(`Failed to get UserSchema: ${error.message}`);
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
Promise.resolve(ServiceManager.getService('UserStyleSchema')).then(
|
|
154
|
+
service => service,
|
|
155
|
+
error => {
|
|
156
|
+
throw new Error(`Failed to get UserStyleSchema: ${error.message}`);
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
Promise.resolve(ServiceManager.getService('FolderSchema')).then(
|
|
160
|
+
service => service,
|
|
161
|
+
error => {
|
|
162
|
+
throw new Error(`Failed to get FolderSchema: ${error.message}`);
|
|
163
|
+
}
|
|
164
|
+
),
|
|
165
|
+
Promise.resolve(ServiceManager.getService('Theme')).then(
|
|
166
|
+
service => service,
|
|
167
|
+
error => {
|
|
168
|
+
throw new Error(`Failed to get Theme: ${error.message}`);
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
];
|
|
172
|
+
|
|
144
173
|
services = await timeoutPromise(
|
|
145
|
-
Promise.all(
|
|
146
|
-
ServiceManager.getService('UserSchema').catch(e => {
|
|
147
|
-
throw new Error(`Failed to get UserSchema: ${e.message}`);
|
|
148
|
-
}),
|
|
149
|
-
ServiceManager.getService('UserStyleSchema').catch(e => {
|
|
150
|
-
throw new Error(`Failed to get UserStyleSchema: ${e.message}`);
|
|
151
|
-
}),
|
|
152
|
-
ServiceManager.getService('FolderSchema').catch(e => {
|
|
153
|
-
throw new Error(`Failed to get FolderSchema: ${e.message}`);
|
|
154
|
-
}),
|
|
155
|
-
ServiceManager.getService('Theme').catch(e => {
|
|
156
|
-
throw new Error(`Failed to get Theme: ${e.message}`);
|
|
157
|
-
}),
|
|
158
|
-
]),
|
|
174
|
+
Promise.all(serviceRequests),
|
|
159
175
|
5000,
|
|
160
176
|
'Service initialization'
|
|
161
177
|
);
|