backendless 6.3.6 → 6.3.9
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/backendless.d.ts +2 -0
- package/dist/backendless.js +86 -19
- package/dist/backendless.js.map +1 -1
- package/dist/backendless.min.js +3 -3
- package/es/data/index.js +26 -0
- package/es/data/store.js +10 -5
- package/es/urls.js +5 -0
- package/lib/data/index.js +26 -0
- package/lib/data/store.js +10 -5
- package/lib/urls.js +5 -0
- package/package.json +2 -2
- package/src/data/index.js +6 -0
- package/src/data/store.js +5 -0
- package/src/urls.js +4 -0
package/backendless.d.ts
CHANGED
|
@@ -269,6 +269,8 @@ declare module Backendless {
|
|
|
269
269
|
|
|
270
270
|
function describe(model: string | Object | Function): Promise<Object>;
|
|
271
271
|
|
|
272
|
+
function getTableNameById(tableId: string): Promise<string>;
|
|
273
|
+
|
|
272
274
|
function mapTableToClass(tableName: string, clientClass: Function): void;
|
|
273
275
|
function mapTableToClass(clientClass: Function): void;
|
|
274
276
|
}
|
package/dist/backendless.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* ********************************************************************************************************************
|
|
3
|
-
* Backendless SDK for JavaScript. Version: 6.3.
|
|
3
|
+
* Backendless SDK for JavaScript. Version: 6.3.9
|
|
4
4
|
*
|
|
5
|
-
* Copyright 2012-
|
|
5
|
+
* Copyright 2012-2022 BACKENDLESS.COM. All Rights Reserved.
|
|
6
6
|
*
|
|
7
7
|
* NOTICE: All information contained herein is, and remains the property of Backendless.com and its suppliers,
|
|
8
8
|
* if any. The intellectual and technical concepts contained herein are proprietary to Backendless.com and its
|
|
@@ -1193,23 +1193,34 @@ function parseHeaders(headersString) {
|
|
|
1193
1193
|
return parsed;
|
|
1194
1194
|
}
|
|
1195
1195
|
|
|
1196
|
-
var sendXmlHttpRequest = function sendXmlHttpRequest(path, method, headers, body) {
|
|
1196
|
+
var sendXmlHttpRequest = function sendXmlHttpRequest(path, method, headers, body, encoding, timeout) {
|
|
1197
1197
|
return new Promise(function sendRequest(resolve, reject) {
|
|
1198
1198
|
var request = new Request.XMLHttpRequest();
|
|
1199
1199
|
|
|
1200
|
+
request.timeout = timeout;
|
|
1201
|
+
|
|
1202
|
+
if (!encoding) {
|
|
1203
|
+
request.responseType = 'arraybuffer';
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1200
1206
|
request.open(method.toUpperCase(), path, true);
|
|
1201
1207
|
|
|
1202
1208
|
request.onload = function handleLoadEvent() {
|
|
1203
1209
|
var headers = parseHeaders(request.getAllResponseHeaders());
|
|
1204
1210
|
var _request = request,
|
|
1205
1211
|
status = _request.status,
|
|
1206
|
-
statusText = _request.statusText
|
|
1207
|
-
response = _request.response,
|
|
1208
|
-
responseText = _request.responseText;
|
|
1212
|
+
statusText = _request.statusText;
|
|
1209
1213
|
|
|
1210
|
-
var body = response || responseText;
|
|
1211
1214
|
|
|
1212
|
-
|
|
1215
|
+
var result = { status: status, statusText: statusText, headers: headers };
|
|
1216
|
+
|
|
1217
|
+
if (encoding === 'utf8') {
|
|
1218
|
+
result.body = request.response || request.responseText;
|
|
1219
|
+
} else if (request.response) {
|
|
1220
|
+
result.body = new Uint8Array(request.response);
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
resolve(result);
|
|
1213
1224
|
|
|
1214
1225
|
request = null;
|
|
1215
1226
|
};
|
|
@@ -1234,7 +1245,7 @@ var sendXmlHttpRequest = function sendXmlHttpRequest(path, method, headers, body
|
|
|
1234
1245
|
});
|
|
1235
1246
|
};
|
|
1236
1247
|
|
|
1237
|
-
var sendNodeAPIRequest = function sendNodeAPIRequest(path, method, headers, body, encoding) {
|
|
1248
|
+
var sendNodeAPIRequest = function sendNodeAPIRequest(path, method, headers, body, encoding, timeout) {
|
|
1238
1249
|
return new Promise(function (resolve, reject) {
|
|
1239
1250
|
var u = __webpack_require__(7).parse(path);
|
|
1240
1251
|
var form = (0, _utils.isFormData)(body) && body;
|
|
@@ -1243,9 +1254,10 @@ var sendNodeAPIRequest = function sendNodeAPIRequest(path, method, headers, body
|
|
|
1243
1254
|
var options = {
|
|
1244
1255
|
host: u.hostname,
|
|
1245
1256
|
port: u.port || (https ? 443 : 80),
|
|
1246
|
-
method: method,
|
|
1247
1257
|
path: u.path,
|
|
1248
|
-
|
|
1258
|
+
method: method,
|
|
1259
|
+
headers: headers,
|
|
1260
|
+
timeout: timeout
|
|
1249
1261
|
};
|
|
1250
1262
|
|
|
1251
1263
|
var _send = function _send() {
|
|
@@ -1291,6 +1303,10 @@ var sendNodeAPIRequest = function sendNodeAPIRequest(path, method, headers, body
|
|
|
1291
1303
|
|
|
1292
1304
|
req.on('error', reject);
|
|
1293
1305
|
|
|
1306
|
+
req.on('timeout', function () {
|
|
1307
|
+
req.destroy(new Error('Connection aborted due to timeout'));
|
|
1308
|
+
});
|
|
1309
|
+
|
|
1294
1310
|
if (body) {
|
|
1295
1311
|
if ((0, _utils.isStream)(body)) {
|
|
1296
1312
|
body.pipe(req);
|
|
@@ -1361,6 +1377,7 @@ var Request = function (_EventEmitter) {
|
|
|
1361
1377
|
_this2.headers = {};
|
|
1362
1378
|
_this2.queryParams = {};
|
|
1363
1379
|
_this2.encoding = 'utf8';
|
|
1380
|
+
_this2.timeout = 0;
|
|
1364
1381
|
return _this2;
|
|
1365
1382
|
}
|
|
1366
1383
|
|
|
@@ -1537,6 +1554,20 @@ var Request = function (_EventEmitter) {
|
|
|
1537
1554
|
return this;
|
|
1538
1555
|
}
|
|
1539
1556
|
|
|
1557
|
+
/**
|
|
1558
|
+
* A number specifying request timeout in milliseconds.
|
|
1559
|
+
* @param {Number} ms
|
|
1560
|
+
* @returns {Request}
|
|
1561
|
+
*/
|
|
1562
|
+
|
|
1563
|
+
}, {
|
|
1564
|
+
key: 'setTimeout',
|
|
1565
|
+
value: function setTimeout(ms) {
|
|
1566
|
+
this.timeout = ms;
|
|
1567
|
+
|
|
1568
|
+
return this;
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1540
1571
|
/**
|
|
1541
1572
|
* Sends the requst
|
|
1542
1573
|
*
|
|
@@ -1608,7 +1639,7 @@ var Request = function (_EventEmitter) {
|
|
|
1608
1639
|
console.log(this.method.toUpperCase(), decodeURIComponent(path), body, this.headers);
|
|
1609
1640
|
}
|
|
1610
1641
|
|
|
1611
|
-
var request = Request.send(path, this.method.toUpperCase(), this.headers, body, this.encoding).then(parseBody).then(checkStatus).then(unwrapBody).then(cacheResponse).then(flushCache);
|
|
1642
|
+
var request = Request.send(path, this.method.toUpperCase(), this.headers, body, this.encoding, this.timeout).then(parseBody).then(checkStatus).then(unwrapBody).then(cacheResponse).then(flushCache);
|
|
1612
1643
|
|
|
1613
1644
|
request.then(function (result) {
|
|
1614
1645
|
_this4.emit(RESPONSE_EVENT, result);
|
|
@@ -1662,10 +1693,10 @@ Object.defineProperty(Request, 'FormData', {
|
|
|
1662
1693
|
|
|
1663
1694
|
Request.XMLHttpRequest = typeof XMLHttpRequest !== 'undefined' ? XMLHttpRequest : undefined;
|
|
1664
1695
|
|
|
1665
|
-
Request.send = function (path, method, headers, body, encoding) {
|
|
1696
|
+
Request.send = function (path, method, headers, body, encoding, timeout) {
|
|
1666
1697
|
var sender = typeof Request.XMLHttpRequest !== 'undefined' ? sendXmlHttpRequest : sendNodeAPIRequest;
|
|
1667
1698
|
|
|
1668
|
-
return sender(path, method, headers, body, encoding);
|
|
1699
|
+
return sender(path, method, headers, body, encoding, timeout);
|
|
1669
1700
|
};
|
|
1670
1701
|
|
|
1671
1702
|
Request.verbose = false;
|
|
@@ -15098,6 +15129,32 @@ var Data = /*#__PURE__*/function () {
|
|
|
15098
15129
|
|
|
15099
15130
|
return describe;
|
|
15100
15131
|
}()
|
|
15132
|
+
}, {
|
|
15133
|
+
key: "getTableNameById",
|
|
15134
|
+
value: function () {
|
|
15135
|
+
var _getTableNameById = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(tableId) {
|
|
15136
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
15137
|
+
while (1) {
|
|
15138
|
+
switch (_context2.prev = _context2.next) {
|
|
15139
|
+
case 0:
|
|
15140
|
+
return _context2.abrupt("return", this.app.request.get({
|
|
15141
|
+
url: this.app.urls.dataTableNameById(tableId)
|
|
15142
|
+
}));
|
|
15143
|
+
|
|
15144
|
+
case 1:
|
|
15145
|
+
case "end":
|
|
15146
|
+
return _context2.stop();
|
|
15147
|
+
}
|
|
15148
|
+
}
|
|
15149
|
+
}, _callee2, this);
|
|
15150
|
+
}));
|
|
15151
|
+
|
|
15152
|
+
function getTableNameById(_x2) {
|
|
15153
|
+
return _getTableNameById.apply(this, arguments);
|
|
15154
|
+
}
|
|
15155
|
+
|
|
15156
|
+
return getTableNameById;
|
|
15157
|
+
}()
|
|
15101
15158
|
}, {
|
|
15102
15159
|
key: "mapTableToClass",
|
|
15103
15160
|
value: function mapTableToClass(tableName, clientClass) {
|
|
@@ -16164,7 +16221,7 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
16164
16221
|
|
|
16165
16222
|
case 5:
|
|
16166
16223
|
result = _context7.sent;
|
|
16167
|
-
_context7.next =
|
|
16224
|
+
_context7.next = 14;
|
|
16168
16225
|
break;
|
|
16169
16226
|
|
|
16170
16227
|
case 8:
|
|
@@ -16176,19 +16233,24 @@ var DataStore = /*#__PURE__*/function () {
|
|
|
16176
16233
|
throw new Error('Object Id must be provided and must be a string or an object of primary keys.');
|
|
16177
16234
|
|
|
16178
16235
|
case 10:
|
|
16179
|
-
|
|
16236
|
+
if (query) {
|
|
16237
|
+
query.pageSize = null;
|
|
16238
|
+
query.offset = null;
|
|
16239
|
+
}
|
|
16240
|
+
|
|
16241
|
+
_context7.next = 13;
|
|
16180
16242
|
return this.app.request.get({
|
|
16181
16243
|
url: this.app.urls.dataTableObject(this.className, objectId),
|
|
16182
16244
|
queryString: _dataQueryBuilder["default"].toQueryString(query)
|
|
16183
16245
|
});
|
|
16184
16246
|
|
|
16185
|
-
case
|
|
16247
|
+
case 13:
|
|
16186
16248
|
result = _context7.sent;
|
|
16187
16249
|
|
|
16188
|
-
case
|
|
16250
|
+
case 14:
|
|
16189
16251
|
return _context7.abrupt("return", this.parseResponse(result));
|
|
16190
16252
|
|
|
16191
|
-
case
|
|
16253
|
+
case 15:
|
|
16192
16254
|
case "end":
|
|
16193
16255
|
return _context7.stop();
|
|
16194
16256
|
}
|
|
@@ -22031,6 +22093,11 @@ var Urls = /*#__PURE__*/function () {
|
|
|
22031
22093
|
value: function dataObjectPermission(tableName, permissionType, objectId) {
|
|
22032
22094
|
return "".concat(this.dataTable(tableName), "/permissions/").concat(permissionType, "/").concat(objectId);
|
|
22033
22095
|
}
|
|
22096
|
+
}, {
|
|
22097
|
+
key: "dataTableNameById",
|
|
22098
|
+
value: function dataTableNameById(tableId) {
|
|
22099
|
+
return "".concat(this.data(), "/").concat(tableId, "/table-name");
|
|
22100
|
+
}
|
|
22034
22101
|
}, {
|
|
22035
22102
|
key: "transactions",
|
|
22036
22103
|
value: function transactions() {
|