backend-manager 3.1.1 → 3.1.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.
- package/CHANGELOG.md +4 -3
- package/package.json +1 -1
- package/src/manager/helpers/assistant.js +11 -5
- package/src/manager/index.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -17,7 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
|
17
17
|
---
|
|
18
18
|
## [3.1.0] - 2023-12-19
|
|
19
19
|
### Added
|
|
20
|
-
- Added `.analytics()` GA4 support.
|
|
20
|
+
- Added `.analytics()` API GA4 support.
|
|
21
21
|
|
|
22
22
|
#### New Analytics Format
|
|
23
23
|
```js
|
|
@@ -30,8 +30,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
|
30
30
|
},
|
|
31
31
|
});
|
|
32
32
|
```
|
|
33
|
-
- Added `.usage()` to track
|
|
34
|
-
- Added `.middleware()` to help setup http functions.
|
|
33
|
+
- Added `.usage()` API to track user usage.
|
|
34
|
+
- Added `.middleware()` API to help setup http functions.
|
|
35
|
+
- Added `.respond()` function to `assistant.js` to help with http responses.
|
|
35
36
|
|
|
36
37
|
## [3.0.0] - 2023-09-05
|
|
37
38
|
### ⚠️ BREAKING
|
package/package.json
CHANGED
|
@@ -283,7 +283,7 @@ BackendAssistant.prototype.emergency = function () {
|
|
|
283
283
|
self.log.apply(self, args);
|
|
284
284
|
};
|
|
285
285
|
|
|
286
|
-
BackendAssistant.prototype._log = function() {
|
|
286
|
+
BackendAssistant.prototype._log = function () {
|
|
287
287
|
const self = this;
|
|
288
288
|
|
|
289
289
|
// 1. Convert args to a normal array
|
|
@@ -344,7 +344,7 @@ BackendAssistant.prototype._log = function() {
|
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
-
BackendAssistant.prototype.errorManager = function(e, options) {
|
|
347
|
+
BackendAssistant.prototype.errorManager = function (e, options) {
|
|
348
348
|
const self = this;
|
|
349
349
|
|
|
350
350
|
// Set options
|
|
@@ -361,6 +361,9 @@ BackendAssistant.prototype.errorManager = function(e, options) {
|
|
|
361
361
|
options.send = typeof options.send === 'undefined'
|
|
362
362
|
? true
|
|
363
363
|
: options.send;
|
|
364
|
+
options.stack = typeof options.stack === 'undefined'
|
|
365
|
+
? true
|
|
366
|
+
: options.stack;
|
|
364
367
|
|
|
365
368
|
// Construct error
|
|
366
369
|
const newError = e instanceof Error
|
|
@@ -390,12 +393,15 @@ BackendAssistant.prototype.errorManager = function(e, options) {
|
|
|
390
393
|
|
|
391
394
|
// Quit and respond to the request
|
|
392
395
|
if (options.send && self.ref.res && self.ref.res.status) {
|
|
396
|
+
const sendable = newError?.stack && options.stack
|
|
397
|
+
? newError?.stack
|
|
398
|
+
: newError?.message;
|
|
399
|
+
|
|
393
400
|
self.ref.res
|
|
394
401
|
.status(options.code)
|
|
395
402
|
.send((
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
? newError.message
|
|
403
|
+
sendable
|
|
404
|
+
? sendable
|
|
399
405
|
: newError
|
|
400
406
|
) || 'Unknown error');
|
|
401
407
|
}
|
package/src/manager/index.js
CHANGED
|
@@ -198,8 +198,8 @@ Manager.prototype.init = function (exporter, options) {
|
|
|
198
198
|
exporter.bm_api =
|
|
199
199
|
self.libraries.functions
|
|
200
200
|
.runWith({memory: '256MB', timeoutSeconds: 60})
|
|
201
|
-
|
|
202
|
-
.onRequest(async (req, res) => {
|
|
201
|
+
// TODO: Replace this with new API
|
|
202
|
+
.https.onRequest(async (req, res) => {
|
|
203
203
|
return self._process((new (require(`${core}/actions/api.js`))()).init(self, { req: req, res: res, }))
|
|
204
204
|
});
|
|
205
205
|
|