backendless 7.2.4 → 7.2.6

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.
@@ -116,12 +116,9 @@ var Logging = /*#__PURE__*/function () {
116
116
  }, {
117
117
  key: "push",
118
118
  value: function push(logger, logLevel, message, exception) {
119
- if (typeof message !== 'string') {
120
- throw new Error('"message" must be a string');
121
- }
122
119
  this.messages.push({
123
120
  logger: logger,
124
- message: message,
121
+ message: convertMessageToString(message),
125
122
  exception: exception,
126
123
  'log-level': logLevel,
127
124
  timestamp: Date.now()
@@ -190,4 +187,16 @@ var Logging = /*#__PURE__*/function () {
190
187
  }]);
191
188
  return Logging;
192
189
  }();
193
- exports["default"] = Logging;
190
+ exports["default"] = Logging;
191
+ function convertMessageToString(message) {
192
+ if (typeof message === 'string') {
193
+ return message;
194
+ }
195
+ if (typeof message === 'undefined') {
196
+ return 'undefined';
197
+ }
198
+ if (typeof message === 'function') {
199
+ return Object.prototype.toString.call(message);
200
+ }
201
+ return JSON.stringify(message);
202
+ }
@@ -62,7 +62,7 @@ var OpResult = /*#__PURE__*/function () {
62
62
  }, {
63
63
  key: "isObjectRef",
64
64
  value: function isObjectRef() {
65
- return this.operationType === _constants.OperationType.CREATE || this.operationType === _constants.OperationType.UPDATE;
65
+ return this.operationType === _constants.OperationType.CREATE || this.operationType === _constants.OperationType.UPDATE || this.operationType === _constants.OperationType.UPSERT;
66
66
  }
67
67
  }, {
68
68
  key: "setOpResultId",
@@ -116,12 +116,9 @@ var Logging = /*#__PURE__*/function () {
116
116
  }, {
117
117
  key: "push",
118
118
  value: function push(logger, logLevel, message, exception) {
119
- if (typeof message !== 'string') {
120
- throw new Error('"message" must be a string');
121
- }
122
119
  this.messages.push({
123
120
  logger: logger,
124
- message: message,
121
+ message: convertMessageToString(message),
125
122
  exception: exception,
126
123
  'log-level': logLevel,
127
124
  timestamp: Date.now()
@@ -190,4 +187,16 @@ var Logging = /*#__PURE__*/function () {
190
187
  }]);
191
188
  return Logging;
192
189
  }();
193
- exports["default"] = Logging;
190
+ exports["default"] = Logging;
191
+ function convertMessageToString(message) {
192
+ if (typeof message === 'string') {
193
+ return message;
194
+ }
195
+ if (typeof message === 'undefined') {
196
+ return 'undefined';
197
+ }
198
+ if (typeof message === 'function') {
199
+ return Object.prototype.toString.call(message);
200
+ }
201
+ return JSON.stringify(message);
202
+ }
@@ -62,7 +62,7 @@ var OpResult = /*#__PURE__*/function () {
62
62
  }, {
63
63
  key: "isObjectRef",
64
64
  value: function isObjectRef() {
65
- return this.operationType === _constants.OperationType.CREATE || this.operationType === _constants.OperationType.UPDATE;
65
+ return this.operationType === _constants.OperationType.CREATE || this.operationType === _constants.OperationType.UPDATE || this.operationType === _constants.OperationType.UPSERT;
66
66
  }
67
67
  }, {
68
68
  key: "setOpResultId",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backendless",
3
- "version": "7.2.4",
3
+ "version": "7.2.6",
4
4
  "description": "Backendless JavaScript SDK for Node.js and the browser",
5
5
  "browser": "dist/backendless.js",
6
6
  "main": "lib/index.js",
@@ -97,11 +97,13 @@ export default class Logging {
97
97
  }
98
98
 
99
99
  push(logger, logLevel, message, exception) {
100
- if (typeof message !== 'string') {
101
- throw new Error('"message" must be a string')
102
- }
103
-
104
- this.messages.push({ logger, message, exception, 'log-level': logLevel, timestamp: Date.now() })
100
+ this.messages.push({
101
+ logger,
102
+ message : convertMessageToString(message),
103
+ exception,
104
+ 'log-level': logLevel,
105
+ timestamp : Date.now()
106
+ })
105
107
 
106
108
  this.checkMessagesLen()
107
109
  }
@@ -160,5 +162,20 @@ export default class Logging {
160
162
 
161
163
  this.checkMessagesLimit()
162
164
  }
165
+ }
166
+
167
+ function convertMessageToString(message) {
168
+ if (typeof message === 'string') {
169
+ return message
170
+ }
171
+
172
+ if (typeof message === 'undefined') {
173
+ return 'undefined'
174
+ }
175
+
176
+ if (typeof message === 'function') {
177
+ return Object.prototype.toString.call(message)
178
+ }
163
179
 
180
+ return JSON.stringify(message)
164
181
  }
@@ -47,7 +47,11 @@ export class OpResult {
47
47
  }
48
48
 
49
49
  isObjectRef() {
50
- return this.operationType === OperationType.CREATE || this.operationType === OperationType.UPDATE
50
+ return (
51
+ this.operationType === OperationType.CREATE ||
52
+ this.operationType === OperationType.UPDATE ||
53
+ this.operationType === OperationType.UPSERT
54
+ )
51
55
  }
52
56
 
53
57
  setOpResultId(opResultId) {