backend-manager 3.0.31 → 3.0.33
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/package.json
CHANGED
|
@@ -211,7 +211,7 @@ BackendAssistant.prototype.log = function () {
|
|
|
211
211
|
BackendAssistant.prototype.error = function () {
|
|
212
212
|
const self = this;
|
|
213
213
|
|
|
214
|
-
|
|
214
|
+
const args = Array.prototype.slice.call(arguments);
|
|
215
215
|
|
|
216
216
|
args.unshift('error');
|
|
217
217
|
self.log.apply(self, args);
|
|
@@ -220,17 +220,77 @@ BackendAssistant.prototype.error = function () {
|
|
|
220
220
|
BackendAssistant.prototype.warn = function () {
|
|
221
221
|
const self = this;
|
|
222
222
|
|
|
223
|
-
|
|
223
|
+
const args = Array.prototype.slice.call(arguments);
|
|
224
224
|
|
|
225
225
|
args.unshift('warn');
|
|
226
226
|
self.log.apply(self, args);
|
|
227
227
|
};
|
|
228
228
|
|
|
229
|
+
BackendAssistant.prototype.info = function () {
|
|
230
|
+
const self = this;
|
|
231
|
+
|
|
232
|
+
const args = Array.prototype.slice.call(arguments);
|
|
233
|
+
|
|
234
|
+
args.unshift('info');
|
|
235
|
+
self.log.apply(self, args);
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
BackendAssistant.prototype.debug = function () {
|
|
239
|
+
const self = this;
|
|
240
|
+
|
|
241
|
+
const args = Array.prototype.slice.call(arguments);
|
|
242
|
+
|
|
243
|
+
args.unshift('debug');
|
|
244
|
+
self.log.apply(self, args);
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
BackendAssistant.prototype.notice = function () {
|
|
248
|
+
const self = this;
|
|
249
|
+
|
|
250
|
+
const args = Array.prototype.slice.call(arguments);
|
|
251
|
+
|
|
252
|
+
args.unshift('notice');
|
|
253
|
+
self.log.apply(self, args);
|
|
254
|
+
|
|
255
|
+
// if (self.meta.environment === 'development') {
|
|
256
|
+
// args.unshift('debug');
|
|
257
|
+
// self.log.apply(self, args);
|
|
258
|
+
// } else {
|
|
259
|
+
// self.ref.functions.logger.write({
|
|
260
|
+
// severity: 'NOTICE',
|
|
261
|
+
// message: args,
|
|
262
|
+
// });
|
|
263
|
+
// }
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
BackendAssistant.prototype.critical = function () {
|
|
267
|
+
const self = this;
|
|
268
|
+
|
|
269
|
+
const args = Array.prototype.slice.call(arguments);
|
|
270
|
+
|
|
271
|
+
self.ref.functions.logger.write({
|
|
272
|
+
severity: 'CRITICAL',
|
|
273
|
+
message: args,
|
|
274
|
+
});
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
BackendAssistant.prototype.emergency = function () {
|
|
278
|
+
const self = this;
|
|
279
|
+
|
|
280
|
+
const args = Array.prototype.slice.call(arguments);
|
|
281
|
+
|
|
282
|
+
self.ref.functions.logger.write({
|
|
283
|
+
severity: 'EMERGENCY',
|
|
284
|
+
message: args,
|
|
285
|
+
});
|
|
286
|
+
};
|
|
287
|
+
|
|
229
288
|
BackendAssistant.prototype._log = function() {
|
|
230
289
|
const self = this;
|
|
231
290
|
|
|
232
291
|
// 1. Convert args to a normal array
|
|
233
|
-
|
|
292
|
+
const isDevelopment = self.meta.environment === 'development';
|
|
293
|
+
const logs = [...Array.prototype.slice.call(arguments)];
|
|
234
294
|
|
|
235
295
|
// 2. Prepend log prefix log string
|
|
236
296
|
logs.unshift(`[${self.meta.name}/${self.id} @ ${new Date().toISOString()}]:`);
|
|
@@ -242,6 +302,42 @@ BackendAssistant.prototype._log = function() {
|
|
|
242
302
|
} else if (logs[1] === 'warn') {
|
|
243
303
|
logs.splice(1,1)
|
|
244
304
|
console.warn.apply(console, logs);
|
|
305
|
+
} else if (logs[1] === 'info') {
|
|
306
|
+
logs.splice(1,1)
|
|
307
|
+
console.info.apply(console, logs);
|
|
308
|
+
} else if (logs[1] === 'debug') {
|
|
309
|
+
logs.splice(1,1)
|
|
310
|
+
console.debug.apply(console, logs);
|
|
311
|
+
} else if (logs[1] === 'notice') {
|
|
312
|
+
logs.splice(1,1)
|
|
313
|
+
if (isDevelopment) {
|
|
314
|
+
console.log.apply(console, logs);
|
|
315
|
+
} else {
|
|
316
|
+
self.ref.functions.logger.write({
|
|
317
|
+
severity: 'NOTICE',
|
|
318
|
+
message: logs,
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
} else if (logs[1] === 'critical') {
|
|
322
|
+
logs.splice(1,1)
|
|
323
|
+
if (isDevelopment) {
|
|
324
|
+
console.log.apply(console, logs);
|
|
325
|
+
} else {
|
|
326
|
+
self.ref.functions.logger.write({
|
|
327
|
+
severity: 'CRITICAL',
|
|
328
|
+
message: logs,
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
} else if (logs[1] === 'emergency') {
|
|
332
|
+
logs.splice(1,1)
|
|
333
|
+
if (isDevelopment) {
|
|
334
|
+
console.log.apply(console, logs);
|
|
335
|
+
} else {
|
|
336
|
+
self.ref.functions.logger.write({
|
|
337
|
+
severity: 'EMERGENCY',
|
|
338
|
+
message: logs,
|
|
339
|
+
});
|
|
340
|
+
}
|
|
245
341
|
} else if (logs[1] === 'log') {
|
|
246
342
|
logs.splice(1,1)
|
|
247
343
|
console.log.apply(console, logs);
|
|
@@ -63,7 +63,8 @@ Utilities.prototype.iterateCollection = function (callback, options) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
callback({
|
|
66
|
-
snap: snap,
|
|
66
|
+
snap: snap,
|
|
67
|
+
docs: snap.docs.map(x => x),
|
|
67
68
|
}, batch)
|
|
68
69
|
.then(r => {
|
|
69
70
|
// Construct a new query starting at this document
|
|
@@ -110,6 +111,10 @@ Utilities.prototype.iterateUsers = function (callback, options) {
|
|
|
110
111
|
|
|
111
112
|
batch++;
|
|
112
113
|
|
|
114
|
+
if (listUsersResult.users.length === 0) {
|
|
115
|
+
return resolve();
|
|
116
|
+
}
|
|
117
|
+
|
|
113
118
|
if (options.log) {
|
|
114
119
|
console.log('Processing batch:', batch);
|
|
115
120
|
}
|