backendless 7.4.5 → 7.4.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.
- package/dist/backendless.js +25 -11
- package/dist/backendless.js.map +1 -1
- package/dist/backendless.min.js +2 -2
- package/es/index.js +4 -1
- package/es/logging/index.js +17 -9
- package/es/urls.js +3 -0
- package/lib/index.js +4 -1
- package/lib/logging/index.js +17 -9
- package/lib/urls.js +3 -0
- package/package.json +1 -1
- package/src/index.js +5 -1
- package/src/logging/index.js +25 -12
- package/src/urls.js +7 -0
package/es/index.js
CHANGED
|
@@ -291,7 +291,10 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
291
291
|
if (this.domain) {
|
|
292
292
|
return this.domain + this.apiURI;
|
|
293
293
|
}
|
|
294
|
-
|
|
294
|
+
if (this.appId && this.apiKey) {
|
|
295
|
+
return [this.serverURL, this.appId, this.apiKey].join('/');
|
|
296
|
+
}
|
|
297
|
+
return null;
|
|
295
298
|
},
|
|
296
299
|
set: function set(appPath) {
|
|
297
300
|
throw new Error("Setting '".concat(appPath, "' value to Backendless.appPath directly is not possible, ") + 'instead you must use Backendless.initApp(APP_ID, API_KEY) for setup the value');
|
package/es/logging/index.js
CHANGED
|
@@ -89,13 +89,15 @@ var Logging = /*#__PURE__*/function () {
|
|
|
89
89
|
this.stopFlushInterval();
|
|
90
90
|
messages = (0, _toConsumableArray2["default"])(this.messages);
|
|
91
91
|
this.messages = [];
|
|
92
|
-
this.flushRequest =
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
this.flushRequest = Promise.resolve().then(function () {
|
|
93
|
+
return _this2.app.request.put({
|
|
94
|
+
url: _this2.app.urls.logging(),
|
|
95
|
+
data: messages
|
|
96
|
+
})["catch"](function (error) {
|
|
97
|
+
_this2.messages = [].concat((0, _toConsumableArray2["default"])(messages), (0, _toConsumableArray2["default"])(_this2.messages));
|
|
98
|
+
_this2.checkMessagesLimit();
|
|
99
|
+
throw error;
|
|
100
|
+
});
|
|
99
101
|
})["finally"](function () {
|
|
100
102
|
return delete _this2.flushRequest;
|
|
101
103
|
});
|
|
@@ -133,7 +135,10 @@ var Logging = /*#__PURE__*/function () {
|
|
|
133
135
|
}
|
|
134
136
|
this.checkMessagesLenTimer = setTimeout(function () {
|
|
135
137
|
if (_this3.messages.length >= _this3.numOfMessages) {
|
|
136
|
-
_this3.flush()
|
|
138
|
+
_this3.flush()["catch"](function (error) {
|
|
139
|
+
// eslint-disable-next-line no-console
|
|
140
|
+
console.error('Could not flush log messages immediately: ', error);
|
|
141
|
+
});
|
|
137
142
|
} else {
|
|
138
143
|
_this3.startFlushInterval();
|
|
139
144
|
}
|
|
@@ -152,7 +157,10 @@ var Logging = /*#__PURE__*/function () {
|
|
|
152
157
|
var _this4 = this;
|
|
153
158
|
if (!this.flushInterval) {
|
|
154
159
|
this.flushInterval = setTimeout(function () {
|
|
155
|
-
|
|
160
|
+
_this4.flush()["catch"](function (error) {
|
|
161
|
+
// eslint-disable-next-line no-console
|
|
162
|
+
console.error('Could not flush log messages with timer: ', error);
|
|
163
|
+
});
|
|
156
164
|
}, this.timeFrequency * 1000);
|
|
157
165
|
}
|
|
158
166
|
}
|
package/es/urls.js
CHANGED
|
@@ -15,6 +15,9 @@ var Urls = /*#__PURE__*/function () {
|
|
|
15
15
|
(0, _createClass2["default"])(Urls, [{
|
|
16
16
|
key: "root",
|
|
17
17
|
value: function root() {
|
|
18
|
+
if (!this.app.appPath) {
|
|
19
|
+
throw new Error('Backendless API is not configured, make sure you run Backendless.initApp(...) ' + 'before the operation');
|
|
20
|
+
}
|
|
18
21
|
return this.app.appPath;
|
|
19
22
|
}
|
|
20
23
|
|
package/lib/index.js
CHANGED
|
@@ -291,7 +291,10 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
291
291
|
if (this.domain) {
|
|
292
292
|
return this.domain + this.apiURI;
|
|
293
293
|
}
|
|
294
|
-
|
|
294
|
+
if (this.appId && this.apiKey) {
|
|
295
|
+
return [this.serverURL, this.appId, this.apiKey].join('/');
|
|
296
|
+
}
|
|
297
|
+
return null;
|
|
295
298
|
},
|
|
296
299
|
set: function set(appPath) {
|
|
297
300
|
throw new Error("Setting '".concat(appPath, "' value to Backendless.appPath directly is not possible, ") + 'instead you must use Backendless.initApp(APP_ID, API_KEY) for setup the value');
|
package/lib/logging/index.js
CHANGED
|
@@ -89,13 +89,15 @@ var Logging = /*#__PURE__*/function () {
|
|
|
89
89
|
this.stopFlushInterval();
|
|
90
90
|
messages = (0, _toConsumableArray2["default"])(this.messages);
|
|
91
91
|
this.messages = [];
|
|
92
|
-
this.flushRequest =
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
this.flushRequest = Promise.resolve().then(function () {
|
|
93
|
+
return _this2.app.request.put({
|
|
94
|
+
url: _this2.app.urls.logging(),
|
|
95
|
+
data: messages
|
|
96
|
+
})["catch"](function (error) {
|
|
97
|
+
_this2.messages = [].concat((0, _toConsumableArray2["default"])(messages), (0, _toConsumableArray2["default"])(_this2.messages));
|
|
98
|
+
_this2.checkMessagesLimit();
|
|
99
|
+
throw error;
|
|
100
|
+
});
|
|
99
101
|
})["finally"](function () {
|
|
100
102
|
return delete _this2.flushRequest;
|
|
101
103
|
});
|
|
@@ -133,7 +135,10 @@ var Logging = /*#__PURE__*/function () {
|
|
|
133
135
|
}
|
|
134
136
|
this.checkMessagesLenTimer = setTimeout(function () {
|
|
135
137
|
if (_this3.messages.length >= _this3.numOfMessages) {
|
|
136
|
-
_this3.flush()
|
|
138
|
+
_this3.flush()["catch"](function (error) {
|
|
139
|
+
// eslint-disable-next-line no-console
|
|
140
|
+
console.error('Could not flush log messages immediately: ', error);
|
|
141
|
+
});
|
|
137
142
|
} else {
|
|
138
143
|
_this3.startFlushInterval();
|
|
139
144
|
}
|
|
@@ -152,7 +157,10 @@ var Logging = /*#__PURE__*/function () {
|
|
|
152
157
|
var _this4 = this;
|
|
153
158
|
if (!this.flushInterval) {
|
|
154
159
|
this.flushInterval = setTimeout(function () {
|
|
155
|
-
|
|
160
|
+
_this4.flush()["catch"](function (error) {
|
|
161
|
+
// eslint-disable-next-line no-console
|
|
162
|
+
console.error('Could not flush log messages with timer: ', error);
|
|
163
|
+
});
|
|
156
164
|
}, this.timeFrequency * 1000);
|
|
157
165
|
}
|
|
158
166
|
}
|
package/lib/urls.js
CHANGED
|
@@ -15,6 +15,9 @@ var Urls = /*#__PURE__*/function () {
|
|
|
15
15
|
(0, _createClass2["default"])(Urls, [{
|
|
16
16
|
key: "root",
|
|
17
17
|
value: function root() {
|
|
18
|
+
if (!this.app.appPath) {
|
|
19
|
+
throw new Error('Backendless API is not configured, make sure you run Backendless.initApp(...) ' + 'before the operation');
|
|
20
|
+
}
|
|
18
21
|
return this.app.appPath;
|
|
19
22
|
}
|
|
20
23
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -278,7 +278,11 @@ class Backendless {
|
|
|
278
278
|
return this.domain + this.apiURI
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
|
|
281
|
+
if (this.appId && this.apiKey) {
|
|
282
|
+
return [this.serverURL, this.appId, this.apiKey].join('/')
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
return null
|
|
282
286
|
}
|
|
283
287
|
|
|
284
288
|
set appPath(appPath) {
|
package/src/logging/index.js
CHANGED
|
@@ -78,17 +78,20 @@ export default class Logging {
|
|
|
78
78
|
|
|
79
79
|
this.messages = []
|
|
80
80
|
|
|
81
|
-
this.flushRequest =
|
|
82
|
-
.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
81
|
+
this.flushRequest = Promise.resolve()
|
|
82
|
+
.then(() => {
|
|
83
|
+
return this.app.request
|
|
84
|
+
.put({
|
|
85
|
+
url : this.app.urls.logging(),
|
|
86
|
+
data: messages
|
|
87
|
+
})
|
|
88
|
+
.catch(error => {
|
|
89
|
+
this.messages = [...messages, ...this.messages]
|
|
90
|
+
|
|
91
|
+
this.checkMessagesLimit()
|
|
92
|
+
|
|
93
|
+
throw error
|
|
94
|
+
})
|
|
92
95
|
})
|
|
93
96
|
.finally(() => delete this.flushRequest)
|
|
94
97
|
}
|
|
@@ -116,6 +119,10 @@ export default class Logging {
|
|
|
116
119
|
this.checkMessagesLenTimer = setTimeout(() => {
|
|
117
120
|
if (this.messages.length >= this.numOfMessages) {
|
|
118
121
|
this.flush()
|
|
122
|
+
.catch(error => {
|
|
123
|
+
// eslint-disable-next-line no-console
|
|
124
|
+
console.error('Could not flush log messages immediately: ', error)
|
|
125
|
+
})
|
|
119
126
|
} else {
|
|
120
127
|
this.startFlushInterval()
|
|
121
128
|
}
|
|
@@ -130,7 +137,13 @@ export default class Logging {
|
|
|
130
137
|
|
|
131
138
|
startFlushInterval() {
|
|
132
139
|
if (!this.flushInterval) {
|
|
133
|
-
this.flushInterval = setTimeout(() =>
|
|
140
|
+
this.flushInterval = setTimeout(() => {
|
|
141
|
+
this.flush()
|
|
142
|
+
.catch(error => {
|
|
143
|
+
// eslint-disable-next-line no-console
|
|
144
|
+
console.error('Could not flush log messages with timer: ', error)
|
|
145
|
+
})
|
|
146
|
+
}, this.timeFrequency * 1000)
|
|
134
147
|
}
|
|
135
148
|
}
|
|
136
149
|
|
package/src/urls.js
CHANGED