backendless 6.7.1 → 7.0.0
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 +20992 -23948
- package/dist/backendless.js.map +1 -1
- package/dist/backendless.min.js +2 -2
- package/es/bl/constants.js +0 -2
- package/es/bl/custom-services.js +40 -65
- package/es/bl/events.js +30 -52
- package/es/bl/index.js +3 -9
- package/es/cache/index.js +125 -189
- package/es/commerce/index.js +78 -119
- package/es/counters/counter.js +0 -8
- package/es/counters/index.js +171 -258
- package/es/data/data-query-builder.js +2 -39
- package/es/data/geo/geo-constructor.js +5 -26
- package/es/data/geo/geo-json-parser.js +0 -7
- package/es/data/geo/geometry.js +4 -13
- package/es/data/geo/linestring.js +4 -21
- package/es/data/geo/point.js +4 -22
- package/es/data/geo/polygon.js +4 -30
- package/es/data/geo/spatial-reference-system.js +1 -7
- package/es/data/geo/wkt-parser.js +0 -10
- package/es/data/geo/wkt-to-geojson.js +4 -44
- package/es/data/group-query-builder.js +0 -23
- package/es/data/index.js +17 -54
- package/es/data/json-update-builder.js +0 -18
- package/es/data/load-relations-query-builder.js +0 -16
- package/es/data/persmission.js +0 -16
- package/es/data/rt-handlers.js +1 -46
- package/es/data/store.js +314 -518
- package/es/decorators/deprecated.js +2 -5
- package/es/decorators/index.js +0 -2
- package/es/device/index.js +3 -8
- package/es/expression.js +0 -8
- package/es/files/index.js +354 -493
- package/es/files/persmission.js +0 -15
- package/es/files/utils.js +32 -55
- package/es/hive/index.js +1 -13
- package/es/hive/stores/base-store.js +14 -50
- package/es/hive/stores/index.js +0 -10
- package/es/hive/stores/key-value.js +4 -37
- package/es/hive/stores/list.js +0 -32
- package/es/hive/stores/map.js +0 -34
- package/es/hive/stores/set.js +0 -29
- package/es/hive/stores/sorted-set.js +19 -94
- package/es/hive/utils.js +0 -2
- package/es/index.js +53 -72
- package/es/local-cache/index.js +0 -10
- package/es/local-cache/local-storage.js +1 -9
- package/es/local-cache/virtual-storage.js +0 -6
- package/es/logging/index.js +48 -49
- package/es/logging/logger.js +33 -12
- package/es/management/data.js +0 -8
- package/es/management/index.js +3 -7
- package/es/messaging/channel/index.js +0 -27
- package/es/messaging/helpers/body-parts.js +3 -6
- package/es/messaging/helpers/delivery-options.js +3 -6
- package/es/messaging/helpers/email-envelope.js +13 -25
- package/es/messaging/helpers/index.js +10 -16
- package/es/messaging/helpers/publish-options.js +3 -6
- package/es/messaging/index.js +213 -317
- package/es/persmission.js +7 -16
- package/es/request/index.js +2 -16
- package/es/rso/connection.js +3 -34
- package/es/rso/index.js +0 -7
- package/es/rt.js +21 -52
- package/es/unit-of-work/constants.js +1 -1
- package/es/unit-of-work/index.js +27 -145
- package/es/unit-of-work/json-adapter.js +14 -35
- package/es/unit-of-work/op-result-value-reference.js +1 -11
- package/es/unit-of-work/op-result.js +2 -13
- package/es/urls.js +23 -15
- package/es/user-agent.js +0 -7
- package/es/users/index.js +345 -552
- package/es/users/roles.js +79 -128
- package/es/users/social/container.js +0 -16
- package/es/users/social/index.js +166 -250
- package/es/users/user.js +2 -9
- package/es/users/utils.js +0 -3
- package/es/utils.js +0 -17
- package/lib/bl/constants.js +0 -2
- package/lib/bl/custom-services.js +40 -65
- package/lib/bl/events.js +30 -52
- package/lib/bl/index.js +3 -9
- package/lib/cache/index.js +125 -189
- package/lib/commerce/index.js +78 -119
- package/lib/counters/counter.js +0 -8
- package/lib/counters/index.js +171 -258
- package/lib/data/data-query-builder.js +2 -39
- package/lib/data/geo/geo-constructor.js +5 -26
- package/lib/data/geo/geo-json-parser.js +0 -7
- package/lib/data/geo/geometry.js +4 -13
- package/lib/data/geo/linestring.js +4 -21
- package/lib/data/geo/point.js +4 -22
- package/lib/data/geo/polygon.js +4 -30
- package/lib/data/geo/spatial-reference-system.js +1 -7
- package/lib/data/geo/wkt-parser.js +0 -10
- package/lib/data/geo/wkt-to-geojson.js +4 -44
- package/lib/data/group-query-builder.js +0 -23
- package/lib/data/index.js +17 -54
- package/lib/data/json-update-builder.js +0 -18
- package/lib/data/load-relations-query-builder.js +0 -16
- package/lib/data/persmission.js +0 -16
- package/lib/data/rt-handlers.js +1 -46
- package/lib/data/store.js +314 -518
- package/lib/decorators/deprecated.js +2 -5
- package/lib/decorators/index.js +0 -2
- package/lib/device/index.js +3 -8
- package/lib/expression.js +0 -8
- package/lib/files/index.js +354 -493
- package/lib/files/persmission.js +0 -15
- package/lib/files/utils.js +32 -55
- package/lib/hive/index.js +1 -13
- package/lib/hive/stores/base-store.js +14 -50
- package/lib/hive/stores/index.js +0 -10
- package/lib/hive/stores/key-value.js +4 -37
- package/lib/hive/stores/list.js +0 -32
- package/lib/hive/stores/map.js +0 -34
- package/lib/hive/stores/set.js +0 -29
- package/lib/hive/stores/sorted-set.js +19 -94
- package/lib/hive/utils.js +0 -2
- package/lib/index.js +53 -72
- package/lib/local-cache/index.js +0 -10
- package/lib/local-cache/local-storage.js +1 -9
- package/lib/local-cache/virtual-storage.js +0 -6
- package/lib/logging/index.js +48 -49
- package/lib/logging/logger.js +33 -12
- package/lib/management/data.js +0 -8
- package/lib/management/index.js +3 -7
- package/lib/messaging/channel/index.js +0 -27
- package/lib/messaging/helpers/body-parts.js +3 -6
- package/lib/messaging/helpers/delivery-options.js +3 -6
- package/lib/messaging/helpers/email-envelope.js +13 -25
- package/lib/messaging/helpers/index.js +10 -16
- package/lib/messaging/helpers/publish-options.js +3 -6
- package/lib/messaging/index.js +213 -317
- package/lib/persmission.js +7 -16
- package/lib/request/index.js +2 -16
- package/lib/rso/connection.js +3 -34
- package/lib/rso/index.js +0 -7
- package/lib/rt.js +21 -52
- package/lib/unit-of-work/constants.js +1 -1
- package/lib/unit-of-work/index.js +27 -145
- package/lib/unit-of-work/json-adapter.js +14 -35
- package/lib/unit-of-work/op-result-value-reference.js +1 -11
- package/lib/unit-of-work/op-result.js +2 -13
- package/lib/urls.js +23 -15
- package/lib/user-agent.js +0 -7
- package/lib/users/index.js +345 -552
- package/lib/users/roles.js +79 -128
- package/lib/users/social/container.js +0 -16
- package/lib/users/social/index.js +166 -250
- package/lib/users/user.js +2 -9
- package/lib/users/utils.js +0 -3
- package/lib/utils.js +0 -17
- package/package.json +16 -16
- package/src/files/utils.js +1 -1
- package/src/index.js +5 -0
- package/src/logging/index.js +24 -0
- package/src/logging/logger.js +35 -6
- package/src/urls.js +4 -0
package/lib/utils.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
-
|
|
12
9
|
var Utils = {
|
|
13
10
|
isBrowser: isBrowser(),
|
|
14
11
|
isLocalStorageSupported: isLocalStorageSupported(),
|
|
@@ -17,67 +14,55 @@ var Utils = {
|
|
|
17
14
|
if (Array.isArray(value)) {
|
|
18
15
|
return value;
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
if (typeof value === 'undefined') {
|
|
22
18
|
return [];
|
|
23
19
|
}
|
|
24
|
-
|
|
25
20
|
return [value];
|
|
26
21
|
},
|
|
27
22
|
isCustomClassInstance: function isCustomClassInstance(item) {
|
|
28
23
|
if (!item || (0, _typeof2["default"])(item) !== 'object' || Array.isArray(item)) {
|
|
29
24
|
return false;
|
|
30
25
|
}
|
|
31
|
-
|
|
32
26
|
return item.constructor !== Object;
|
|
33
27
|
},
|
|
34
28
|
getClassName: function getClassName(obj) {
|
|
35
29
|
if (obj && obj.className) {
|
|
36
30
|
return obj.className;
|
|
37
31
|
}
|
|
38
|
-
|
|
39
32
|
if (typeof obj === 'function') {
|
|
40
33
|
if (obj.name) {
|
|
41
34
|
return obj.name;
|
|
42
35
|
}
|
|
43
36
|
}
|
|
44
|
-
|
|
45
37
|
if (obj && (0, _typeof2["default"])(obj) === 'object' && !Array.isArray(obj)) {
|
|
46
38
|
if (obj.___class) {
|
|
47
39
|
return obj.___class;
|
|
48
40
|
}
|
|
49
|
-
|
|
50
41
|
if (obj.constructor !== Object) {
|
|
51
42
|
return Utils.getClassName(obj.constructor);
|
|
52
43
|
}
|
|
53
44
|
}
|
|
54
|
-
|
|
55
45
|
return null;
|
|
56
46
|
},
|
|
57
47
|
uuid: function uuid() {
|
|
58
48
|
var chr4 = function chr4() {
|
|
59
49
|
return Math.random().toString(16).slice(-4).toUpperCase();
|
|
60
50
|
};
|
|
61
|
-
|
|
62
51
|
var chr8 = function chr8() {
|
|
63
52
|
return "".concat(chr4()).concat(chr4());
|
|
64
53
|
};
|
|
65
|
-
|
|
66
54
|
var chr12 = function chr12() {
|
|
67
55
|
return "".concat(chr4()).concat(chr4()).concat(chr4());
|
|
68
56
|
};
|
|
69
|
-
|
|
70
57
|
return "".concat(chr8(), "-").concat(chr4(), "-").concat(chr4(), "-").concat(chr4(), "-").concat(chr12());
|
|
71
58
|
},
|
|
72
59
|
isObject: function isObject(obj) {
|
|
73
60
|
return obj != null && obj.constructor.name === 'Object';
|
|
74
61
|
}
|
|
75
62
|
};
|
|
76
|
-
|
|
77
63
|
function isBrowser() {
|
|
78
64
|
return (typeof self === "undefined" ? "undefined" : (0, _typeof2["default"])(self)) === 'object' && self.self === self && (typeof window === "undefined" ? "undefined" : (0, _typeof2["default"])(window)) === 'object' && window === self;
|
|
79
65
|
}
|
|
80
|
-
|
|
81
66
|
function isLocalStorageSupported() {
|
|
82
67
|
try {
|
|
83
68
|
if (isBrowser() && window.localStorage) {
|
|
@@ -86,9 +71,7 @@ function isLocalStorageSupported() {
|
|
|
86
71
|
return true;
|
|
87
72
|
}
|
|
88
73
|
} catch (e) {}
|
|
89
|
-
|
|
90
74
|
return false;
|
|
91
75
|
}
|
|
92
|
-
|
|
93
76
|
var _default = Utils;
|
|
94
77
|
exports["default"] = _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "backendless",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Backendless JavaScript SDK for Node.js and the browser",
|
|
5
5
|
"browser": "dist/backendless.js",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib",
|
|
29
29
|
"build:es": "cross-env BABEL_ENV=es babel src --out-dir es",
|
|
30
30
|
"build:umd": "cross-env BABEL_ENV=commonjs NODE_ENV=development webpack",
|
|
31
|
-
"build:umd:min": "cross-env BABEL_ENV=commonjs NODE_ENV=production webpack
|
|
31
|
+
"build:umd:min": "cross-env BABEL_ENV=commonjs NODE_ENV=production webpack --mode production",
|
|
32
32
|
"bannerize": "bannerize ./dist/*.js --banner=./banner.ejs",
|
|
33
33
|
"prepare": "npm run build && npm run bannerize"
|
|
34
34
|
},
|
|
@@ -50,23 +50,23 @@
|
|
|
50
50
|
"author": "info@backendless.com",
|
|
51
51
|
"license": "ISC",
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@babel/cli": "^7.
|
|
54
|
-
"@babel/core": "^7.
|
|
55
|
-
"@babel/plugin-proposal-class-properties": "^7.
|
|
56
|
-
"@babel/plugin-proposal-decorators": "^7.
|
|
57
|
-
"@babel/plugin-transform-object-assign": "^7.
|
|
58
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
53
|
+
"@babel/cli": "^7.21.5",
|
|
54
|
+
"@babel/core": "^7.21.5",
|
|
55
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
56
|
+
"@babel/plugin-proposal-decorators": "^7.21.0",
|
|
57
|
+
"@babel/plugin-transform-object-assign": "^7.18.6",
|
|
58
|
+
"@babel/plugin-transform-runtime": "^7.21.4",
|
|
59
59
|
"@babel/polyfill": "^7.12.1",
|
|
60
|
-
"@babel/preset-env": "^7.
|
|
61
|
-
"@babel/register": "^7.
|
|
60
|
+
"@babel/preset-env": "^7.21.5",
|
|
61
|
+
"@babel/register": "^7.21.0",
|
|
62
62
|
"@types/chai": "^4.2.18",
|
|
63
63
|
"@types/mocha": "^8.2.2",
|
|
64
64
|
"@types/node": "^14.17.3",
|
|
65
65
|
"babel-eslint": "^10.1.0",
|
|
66
|
-
"babel-loader": "^
|
|
66
|
+
"babel-loader": "^9.1.2",
|
|
67
67
|
"babel-plugin-istanbul": "^6.0.0",
|
|
68
68
|
"babelify": "^10.0.0",
|
|
69
|
-
"backendless-console-sdk": "^2.
|
|
69
|
+
"backendless-console-sdk": "^2.21.1",
|
|
70
70
|
"bannerize": "^1.1.4",
|
|
71
71
|
"browserify": "^17.0.0",
|
|
72
72
|
"chai": "^4.3.4",
|
|
@@ -86,12 +86,12 @@
|
|
|
86
86
|
"typescript": "^4.5.4",
|
|
87
87
|
"watch": "^1.0.2",
|
|
88
88
|
"watchify": "^4.0.0",
|
|
89
|
-
"webpack": "^
|
|
90
|
-
"webpack-cli": "^
|
|
89
|
+
"webpack": "^5.81.0",
|
|
90
|
+
"webpack-cli": "^5.0.2"
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
|
-
"@babel/runtime": "^7.
|
|
94
|
-
"backendless-request": "^0.4.
|
|
93
|
+
"@babel/runtime": "^7.21.5",
|
|
94
|
+
"backendless-request": "^0.4.3",
|
|
95
95
|
"backendless-rt-client": "0.2.0"
|
|
96
96
|
}
|
|
97
97
|
}
|
package/src/files/utils.js
CHANGED
|
@@ -67,7 +67,7 @@ const FilesUtils = {
|
|
|
67
67
|
},
|
|
68
68
|
|
|
69
69
|
async toBase64(content) {
|
|
70
|
-
if (typeof Blob !== 'undefined') {
|
|
70
|
+
if (typeof Blob !== 'undefined' && typeof FileReader !== 'undefined') {
|
|
71
71
|
if (!(content instanceof Blob)) {
|
|
72
72
|
content = new Blob([content], { type: '' })
|
|
73
73
|
}
|
package/src/index.js
CHANGED
|
@@ -146,8 +146,11 @@ class Backendless {
|
|
|
146
146
|
|
|
147
147
|
app.__removeService('LocalCache')
|
|
148
148
|
|
|
149
|
+
const loggingConfig = Object.assign({ loadLevels: true, defaultLevel: 'all', levels: {} }, config.logging)
|
|
150
|
+
|
|
149
151
|
if (app.__hasService('Logging')) {
|
|
150
152
|
app.Logging.reset()
|
|
153
|
+
app.Logging.setConfig(loggingConfig)
|
|
151
154
|
}
|
|
152
155
|
|
|
153
156
|
if (app.__hasService('Users')) {
|
|
@@ -156,6 +159,8 @@ class Backendless {
|
|
|
156
159
|
|
|
157
160
|
delete this.__device
|
|
158
161
|
|
|
162
|
+
app.loggingConfig = loggingConfig
|
|
163
|
+
|
|
159
164
|
return app
|
|
160
165
|
}
|
|
161
166
|
|
package/src/logging/index.js
CHANGED
|
@@ -6,6 +6,16 @@ export default class Logging {
|
|
|
6
6
|
this.app = app
|
|
7
7
|
|
|
8
8
|
this.reset()
|
|
9
|
+
|
|
10
|
+
this.setConfig(app.loggingConfig)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
setConfig(config) {
|
|
14
|
+
this.config = config
|
|
15
|
+
|
|
16
|
+
if (config.loadLevels) {
|
|
17
|
+
this.loadLoggingLevels()
|
|
18
|
+
}
|
|
9
19
|
}
|
|
10
20
|
|
|
11
21
|
reset() {
|
|
@@ -16,6 +26,20 @@ export default class Logging {
|
|
|
16
26
|
this.messagesLimit = 100
|
|
17
27
|
}
|
|
18
28
|
|
|
29
|
+
loadLoggingLevels() {
|
|
30
|
+
this.app.request
|
|
31
|
+
.get({ url: this.app.urls.loggingLevels() })
|
|
32
|
+
.then(loggers => {
|
|
33
|
+
loggers.forEach(logger => {
|
|
34
|
+
this.config.levels[logger.name] = logger.level
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
.catch(error => {
|
|
38
|
+
// eslint-disable-next-line no-console
|
|
39
|
+
console.error('Could not load logging levels: ', error)
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
19
43
|
getLogger(loggerName) {
|
|
20
44
|
if (!loggerName || typeof loggerName !== 'string') {
|
|
21
45
|
throw new Error('Logger Name must be provided and must be a string.')
|
package/src/logging/logger.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
const LogLevelPriorities = {
|
|
2
|
+
off : 0,
|
|
3
|
+
fatal: 1,
|
|
4
|
+
error: 2,
|
|
5
|
+
warn : 3,
|
|
6
|
+
info : 4,
|
|
7
|
+
debug: 5,
|
|
8
|
+
trace: 6,
|
|
9
|
+
all : 6,
|
|
10
|
+
}
|
|
11
|
+
|
|
1
12
|
export default class Logger {
|
|
2
13
|
|
|
3
14
|
constructor(name, logging) {
|
|
@@ -6,26 +17,44 @@ export default class Logger {
|
|
|
6
17
|
}
|
|
7
18
|
|
|
8
19
|
debug(message) {
|
|
9
|
-
return this.
|
|
20
|
+
return this.log('DEBUG', message)
|
|
10
21
|
}
|
|
11
22
|
|
|
12
23
|
info(message) {
|
|
13
|
-
return this.
|
|
24
|
+
return this.log('INFO', message)
|
|
14
25
|
}
|
|
15
26
|
|
|
16
27
|
warn(message, exception) {
|
|
17
|
-
return this.
|
|
28
|
+
return this.log('WARN', message, exception)
|
|
18
29
|
}
|
|
19
30
|
|
|
20
31
|
error(message, exception) {
|
|
21
|
-
return this.
|
|
32
|
+
return this.log('ERROR', message, exception)
|
|
22
33
|
}
|
|
23
34
|
|
|
24
35
|
fatal(message, exception) {
|
|
25
|
-
return this.
|
|
36
|
+
return this.log('FATAL', message, exception)
|
|
26
37
|
}
|
|
27
38
|
|
|
28
39
|
trace(message) {
|
|
29
|
-
return this.
|
|
40
|
+
return this.log('TRACE', message)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
log(level, message, exception) {
|
|
44
|
+
if (this.min(level)) {
|
|
45
|
+
return this.logging.push(this.name, level, message, exception)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
min(level) {
|
|
50
|
+
const configuredLevel = this.logging.config.levels[this.name]
|
|
51
|
+
|
|
52
|
+
if (!configuredLevel) {
|
|
53
|
+
const { defaultLevel } = this.logging.config
|
|
54
|
+
|
|
55
|
+
return LogLevelPriorities[defaultLevel.toLowerCase()] >= LogLevelPriorities[level.toLowerCase()]
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return LogLevelPriorities[configuredLevel.toLowerCase()] >= LogLevelPriorities[level.toLowerCase()]
|
|
30
59
|
}
|
|
31
60
|
}
|