backendless 6.7.0 → 6.7.1-dev.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/backendless.d.ts +5 -0
- package/dist/backendless.js +20966 -23929
- 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 +316 -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 +29 -0
- 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 +51 -71
- 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 +21 -46
- package/es/logging/logger.js +0 -6
- 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 +18 -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 +316 -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 +29 -0
- 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 +51 -71
- 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 +21 -46
- package/lib/logging/logger.js +0 -6
- 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 +18 -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/data/store.js +3 -1
- package/src/expression.js +16 -0
- package/src/files/utils.js +1 -1
- package/src/index.js +5 -0
|
@@ -1,53 +1,39 @@
|
|
|
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 _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
12
|
var _user = _interopRequireDefault(require("../user"));
|
|
19
|
-
|
|
20
13
|
var _container = require("./container");
|
|
21
|
-
|
|
22
14
|
var UsersSocial = /*#__PURE__*/function () {
|
|
23
15
|
function UsersSocial(users) {
|
|
24
16
|
(0, _classCallCheck2["default"])(this, UsersSocial);
|
|
25
17
|
this.users = users;
|
|
26
18
|
this.app = users.app;
|
|
27
19
|
}
|
|
28
|
-
|
|
29
20
|
(0, _createClass2["default"])(UsersSocial, [{
|
|
30
21
|
key: "loginWithFacebook",
|
|
31
22
|
value: function () {
|
|
32
23
|
var _loginWithFacebook = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(fieldsMapping, permissions, stayLoggedIn) {
|
|
33
24
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
34
|
-
while (1) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
case "end":
|
|
41
|
-
return _context.stop();
|
|
42
|
-
}
|
|
25
|
+
while (1) switch (_context.prev = _context.next) {
|
|
26
|
+
case 0:
|
|
27
|
+
return _context.abrupt("return", this.loginWithContainer('facebook', fieldsMapping, permissions, null, stayLoggedIn));
|
|
28
|
+
case 1:
|
|
29
|
+
case "end":
|
|
30
|
+
return _context.stop();
|
|
43
31
|
}
|
|
44
32
|
}, _callee, this);
|
|
45
33
|
}));
|
|
46
|
-
|
|
47
34
|
function loginWithFacebook(_x, _x2, _x3) {
|
|
48
35
|
return _loginWithFacebook.apply(this, arguments);
|
|
49
36
|
}
|
|
50
|
-
|
|
51
37
|
return loginWithFacebook;
|
|
52
38
|
}()
|
|
53
39
|
}, {
|
|
@@ -55,23 +41,18 @@ var UsersSocial = /*#__PURE__*/function () {
|
|
|
55
41
|
value: function () {
|
|
56
42
|
var _loginWithGooglePlus = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(fieldsMapping, permissions, container, stayLoggedIn) {
|
|
57
43
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
58
|
-
while (1) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
case "end":
|
|
65
|
-
return _context2.stop();
|
|
66
|
-
}
|
|
44
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
45
|
+
case 0:
|
|
46
|
+
return _context2.abrupt("return", this.loginWithContainer('googleplus', fieldsMapping, permissions, container, stayLoggedIn));
|
|
47
|
+
case 1:
|
|
48
|
+
case "end":
|
|
49
|
+
return _context2.stop();
|
|
67
50
|
}
|
|
68
51
|
}, _callee2, this);
|
|
69
52
|
}));
|
|
70
|
-
|
|
71
53
|
function loginWithGooglePlus(_x4, _x5, _x6, _x7) {
|
|
72
54
|
return _loginWithGooglePlus.apply(this, arguments);
|
|
73
55
|
}
|
|
74
|
-
|
|
75
56
|
return loginWithGooglePlus;
|
|
76
57
|
}()
|
|
77
58
|
}, {
|
|
@@ -79,23 +60,18 @@ var UsersSocial = /*#__PURE__*/function () {
|
|
|
79
60
|
value: function () {
|
|
80
61
|
var _loginWithTwitter = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(fieldsMapping, stayLoggedIn) {
|
|
81
62
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
82
|
-
while (1) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
case "end":
|
|
89
|
-
return _context3.stop();
|
|
90
|
-
}
|
|
63
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
64
|
+
case 0:
|
|
65
|
+
return _context3.abrupt("return", this.loginWithContainer('twitter', fieldsMapping, null, null, stayLoggedIn));
|
|
66
|
+
case 1:
|
|
67
|
+
case "end":
|
|
68
|
+
return _context3.stop();
|
|
91
69
|
}
|
|
92
70
|
}, _callee3, this);
|
|
93
71
|
}));
|
|
94
|
-
|
|
95
72
|
function loginWithTwitter(_x8, _x9) {
|
|
96
73
|
return _loginWithTwitter.apply(this, arguments);
|
|
97
74
|
}
|
|
98
|
-
|
|
99
75
|
return loginWithTwitter;
|
|
100
76
|
}()
|
|
101
77
|
}, {
|
|
@@ -103,23 +79,18 @@ var UsersSocial = /*#__PURE__*/function () {
|
|
|
103
79
|
value: function () {
|
|
104
80
|
var _loginWithFacebookSdk = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(accessToken, fieldsMapping, stayLoggedIn) {
|
|
105
81
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
106
|
-
while (1) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
case "end":
|
|
113
|
-
return _context4.stop();
|
|
114
|
-
}
|
|
82
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
83
|
+
case 0:
|
|
84
|
+
return _context4.abrupt("return", this.sendWithAccessToken('facebook', accessToken, fieldsMapping, stayLoggedIn));
|
|
85
|
+
case 1:
|
|
86
|
+
case "end":
|
|
87
|
+
return _context4.stop();
|
|
115
88
|
}
|
|
116
89
|
}, _callee4, this);
|
|
117
90
|
}));
|
|
118
|
-
|
|
119
91
|
function loginWithFacebookSdk(_x10, _x11, _x12) {
|
|
120
92
|
return _loginWithFacebookSdk.apply(this, arguments);
|
|
121
93
|
}
|
|
122
|
-
|
|
123
94
|
return loginWithFacebookSdk;
|
|
124
95
|
}()
|
|
125
96
|
}, {
|
|
@@ -127,23 +98,18 @@ var UsersSocial = /*#__PURE__*/function () {
|
|
|
127
98
|
value: function () {
|
|
128
99
|
var _loginWithGooglePlusSdk = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(accessToken, fieldsMapping, stayLoggedIn) {
|
|
129
100
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
130
|
-
while (1) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
case "end":
|
|
137
|
-
return _context5.stop();
|
|
138
|
-
}
|
|
101
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
102
|
+
case 0:
|
|
103
|
+
return _context5.abrupt("return", this.sendWithAccessToken('googleplus', accessToken, fieldsMapping, stayLoggedIn));
|
|
104
|
+
case 1:
|
|
105
|
+
case "end":
|
|
106
|
+
return _context5.stop();
|
|
139
107
|
}
|
|
140
108
|
}, _callee5, this);
|
|
141
109
|
}));
|
|
142
|
-
|
|
143
110
|
function loginWithGooglePlusSdk(_x13, _x14, _x15) {
|
|
144
111
|
return _loginWithGooglePlusSdk.apply(this, arguments);
|
|
145
112
|
}
|
|
146
|
-
|
|
147
113
|
return loginWithGooglePlusSdk;
|
|
148
114
|
}()
|
|
149
115
|
}, {
|
|
@@ -151,46 +117,37 @@ var UsersSocial = /*#__PURE__*/function () {
|
|
|
151
117
|
value: function () {
|
|
152
118
|
var _sendWithAccessToken = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(socialType, accessToken, fieldsMapping, stayLoggedIn) {
|
|
153
119
|
var _this = this;
|
|
154
|
-
|
|
155
120
|
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
156
|
-
while (1) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
121
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
122
|
+
case 0:
|
|
123
|
+
if (!(!accessToken || typeof accessToken !== 'string')) {
|
|
124
|
+
_context6.next = 2;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
throw new Error('"accessToken" must be non empty string.');
|
|
128
|
+
case 2:
|
|
129
|
+
if (typeof fieldsMapping === 'boolean') {
|
|
130
|
+
stayLoggedIn = fieldsMapping;
|
|
131
|
+
fieldsMapping = undefined;
|
|
132
|
+
}
|
|
133
|
+
return _context6.abrupt("return", this.app.request.post({
|
|
134
|
+
url: this.app.urls.userSocialLogin(socialType),
|
|
135
|
+
data: {
|
|
136
|
+
accessToken: accessToken,
|
|
137
|
+
fieldsMapping: fieldsMapping
|
|
162
138
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
fieldsMapping = undefined;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return _context6.abrupt("return", this.app.request.post({
|
|
173
|
-
url: this.app.urls.userSocialLogin(socialType),
|
|
174
|
-
data: {
|
|
175
|
-
accessToken: accessToken,
|
|
176
|
-
fieldsMapping: fieldsMapping
|
|
177
|
-
}
|
|
178
|
-
}).then(function (data) {
|
|
179
|
-
return _this.users.setCurrentUser(data, stayLoggedIn);
|
|
180
|
-
}));
|
|
181
|
-
|
|
182
|
-
case 4:
|
|
183
|
-
case "end":
|
|
184
|
-
return _context6.stop();
|
|
185
|
-
}
|
|
139
|
+
}).then(function (data) {
|
|
140
|
+
return _this.users.setCurrentUser(data, stayLoggedIn);
|
|
141
|
+
}));
|
|
142
|
+
case 4:
|
|
143
|
+
case "end":
|
|
144
|
+
return _context6.stop();
|
|
186
145
|
}
|
|
187
146
|
}, _callee6, this);
|
|
188
147
|
}));
|
|
189
|
-
|
|
190
148
|
function sendWithAccessToken(_x16, _x17, _x18, _x19) {
|
|
191
149
|
return _sendWithAccessToken.apply(this, arguments);
|
|
192
150
|
}
|
|
193
|
-
|
|
194
151
|
return sendWithAccessToken;
|
|
195
152
|
}()
|
|
196
153
|
}, {
|
|
@@ -198,62 +155,51 @@ var UsersSocial = /*#__PURE__*/function () {
|
|
|
198
155
|
value: function () {
|
|
199
156
|
var _loginWithContainer = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(socialType, fieldsMapping, permissions, container, stayLoggedIn) {
|
|
200
157
|
var _this2 = this;
|
|
201
|
-
|
|
202
158
|
var socialContainer, resolveContainer;
|
|
203
159
|
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
204
|
-
while (1) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
if (
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
reject(new Error(result.fault));
|
|
217
|
-
} else {
|
|
218
|
-
resolve(result);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
removeWindowEventListener('message', window, onMessage);
|
|
222
|
-
socialContainer.closeContainer();
|
|
160
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
161
|
+
case 0:
|
|
162
|
+
socialContainer = new _container.SocialContainer(socialType, container);
|
|
163
|
+
resolveContainer = function resolveContainer() {
|
|
164
|
+
return new Promise(function (resolve, reject) {
|
|
165
|
+
var onMessage = function onMessage(event) {
|
|
166
|
+
if (event.origin === _this2.app.serverURL) {
|
|
167
|
+
var result = JSON.parse(event.data);
|
|
168
|
+
if (result.fault) {
|
|
169
|
+
reject(new Error(result.fault));
|
|
170
|
+
} else {
|
|
171
|
+
resolve(result);
|
|
223
172
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
173
|
+
removeWindowEventListener('message', window, onMessage);
|
|
174
|
+
socialContainer.closeContainer();
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
addWindowEventListener('message', window, onMessage);
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
return _context7.abrupt("return", this.app.request.post({
|
|
181
|
+
url: this.app.urls.userSocialOAuth(socialType),
|
|
182
|
+
data: {
|
|
183
|
+
fieldsMapping: fieldsMapping || {},
|
|
184
|
+
permissions: permissions || []
|
|
185
|
+
}
|
|
186
|
+
}).then(function (authUrl) {
|
|
187
|
+
return socialContainer.doAuthorizationActivity(authUrl);
|
|
188
|
+
})["catch"](function (error) {
|
|
189
|
+
socialContainer.closeContainer();
|
|
190
|
+
throw error;
|
|
191
|
+
}).then(resolveContainer).then(function (data) {
|
|
192
|
+
return _this2.users.setCurrentUser(data, stayLoggedIn);
|
|
193
|
+
}));
|
|
194
|
+
case 3:
|
|
195
|
+
case "end":
|
|
196
|
+
return _context7.stop();
|
|
249
197
|
}
|
|
250
198
|
}, _callee7, this);
|
|
251
199
|
}));
|
|
252
|
-
|
|
253
200
|
function loginWithContainer(_x20, _x21, _x22, _x23, _x24) {
|
|
254
201
|
return _loginWithContainer.apply(this, arguments);
|
|
255
202
|
}
|
|
256
|
-
|
|
257
203
|
return loginWithContainer;
|
|
258
204
|
}()
|
|
259
205
|
}, {
|
|
@@ -261,61 +207,49 @@ var UsersSocial = /*#__PURE__*/function () {
|
|
|
261
207
|
value: function () {
|
|
262
208
|
var _loginWithOauth = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(providerCode, accessToken, guestUser, fieldsMapping, stayLoggedIn) {
|
|
263
209
|
var _this3 = this;
|
|
264
|
-
|
|
265
210
|
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
266
|
-
while (1) {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
211
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
212
|
+
case 0:
|
|
213
|
+
if (!(!providerCode || typeof providerCode !== 'string')) {
|
|
214
|
+
_context8.next = 2;
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
throw new Error('"providerCode" must be non empty string.');
|
|
218
|
+
case 2:
|
|
219
|
+
if (!(!accessToken || typeof accessToken !== 'string')) {
|
|
220
|
+
_context8.next = 4;
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
throw new Error('"accessToken" must be non empty string.');
|
|
224
|
+
case 4:
|
|
225
|
+
if (guestUser && !(guestUser instanceof _user["default"])) {
|
|
226
|
+
stayLoggedIn = fieldsMapping;
|
|
227
|
+
fieldsMapping = guestUser;
|
|
228
|
+
guestUser = undefined;
|
|
229
|
+
}
|
|
230
|
+
if (typeof fieldsMapping === 'boolean') {
|
|
231
|
+
stayLoggedIn = fieldsMapping;
|
|
232
|
+
fieldsMapping = undefined;
|
|
233
|
+
}
|
|
234
|
+
return _context8.abrupt("return", this.app.request.post({
|
|
235
|
+
url: this.app.urls.userOAuthLogin(providerCode),
|
|
236
|
+
data: {
|
|
237
|
+
accessToken: accessToken,
|
|
238
|
+
fieldsMapping: fieldsMapping,
|
|
239
|
+
guestUser: guestUser
|
|
272
240
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
break;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
throw new Error('"accessToken" must be non empty string.');
|
|
283
|
-
|
|
284
|
-
case 4:
|
|
285
|
-
if (guestUser && !(guestUser instanceof _user["default"])) {
|
|
286
|
-
stayLoggedIn = fieldsMapping;
|
|
287
|
-
fieldsMapping = guestUser;
|
|
288
|
-
guestUser = undefined;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
if (typeof fieldsMapping === 'boolean') {
|
|
292
|
-
stayLoggedIn = fieldsMapping;
|
|
293
|
-
fieldsMapping = undefined;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
return _context8.abrupt("return", this.app.request.post({
|
|
297
|
-
url: this.app.urls.userOAuthLogin(providerCode),
|
|
298
|
-
data: {
|
|
299
|
-
accessToken: accessToken,
|
|
300
|
-
fieldsMapping: fieldsMapping,
|
|
301
|
-
guestUser: guestUser
|
|
302
|
-
}
|
|
303
|
-
}).then(function (data) {
|
|
304
|
-
return _this3.users.setCurrentUser(data, stayLoggedIn);
|
|
305
|
-
}));
|
|
306
|
-
|
|
307
|
-
case 7:
|
|
308
|
-
case "end":
|
|
309
|
-
return _context8.stop();
|
|
310
|
-
}
|
|
241
|
+
}).then(function (data) {
|
|
242
|
+
return _this3.users.setCurrentUser(data, stayLoggedIn);
|
|
243
|
+
}));
|
|
244
|
+
case 7:
|
|
245
|
+
case "end":
|
|
246
|
+
return _context8.stop();
|
|
311
247
|
}
|
|
312
248
|
}, _callee8, this);
|
|
313
249
|
}));
|
|
314
|
-
|
|
315
250
|
function loginWithOauth2(_x25, _x26, _x27, _x28, _x29) {
|
|
316
251
|
return _loginWithOauth.apply(this, arguments);
|
|
317
252
|
}
|
|
318
|
-
|
|
319
253
|
return loginWithOauth2;
|
|
320
254
|
}()
|
|
321
255
|
}, {
|
|
@@ -323,78 +257,62 @@ var UsersSocial = /*#__PURE__*/function () {
|
|
|
323
257
|
value: function () {
|
|
324
258
|
var _loginWithOauth2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(providerCode, accessToken, accessTokenSecret, guestUser, fieldsMapping, stayLoggedIn) {
|
|
325
259
|
var _this4 = this;
|
|
326
|
-
|
|
327
260
|
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
328
|
-
while (1) {
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
261
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
262
|
+
case 0:
|
|
263
|
+
if (!(!providerCode || typeof providerCode !== 'string')) {
|
|
264
|
+
_context9.next = 2;
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
throw new Error('"providerCode" must be non empty string.');
|
|
268
|
+
case 2:
|
|
269
|
+
if (!(!accessToken || typeof accessToken !== 'string')) {
|
|
270
|
+
_context9.next = 4;
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
throw new Error('"accessToken" must be non empty string.');
|
|
274
|
+
case 4:
|
|
275
|
+
if (!(!accessTokenSecret || typeof accessTokenSecret !== 'string')) {
|
|
276
|
+
_context9.next = 6;
|
|
277
|
+
break;
|
|
278
|
+
}
|
|
279
|
+
throw new Error('"accessTokenSecret" must be non empty string.');
|
|
280
|
+
case 6:
|
|
281
|
+
if (guestUser && !(guestUser instanceof _user["default"])) {
|
|
282
|
+
stayLoggedIn = fieldsMapping;
|
|
283
|
+
fieldsMapping = guestUser;
|
|
284
|
+
guestUser = undefined;
|
|
285
|
+
}
|
|
286
|
+
if (typeof fieldsMapping === 'boolean') {
|
|
287
|
+
stayLoggedIn = fieldsMapping;
|
|
288
|
+
fieldsMapping = undefined;
|
|
289
|
+
}
|
|
290
|
+
return _context9.abrupt("return", this.app.request.post({
|
|
291
|
+
url: this.app.urls.userOAuthLogin(providerCode),
|
|
292
|
+
data: {
|
|
293
|
+
accessToken: accessToken,
|
|
294
|
+
accessTokenSecret: accessTokenSecret,
|
|
295
|
+
fieldsMapping: fieldsMapping,
|
|
296
|
+
guestUser: guestUser
|
|
334
297
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
break;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
throw new Error('"accessToken" must be non empty string.');
|
|
345
|
-
|
|
346
|
-
case 4:
|
|
347
|
-
if (!(!accessTokenSecret || typeof accessTokenSecret !== 'string')) {
|
|
348
|
-
_context9.next = 6;
|
|
349
|
-
break;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
throw new Error('"accessTokenSecret" must be non empty string.');
|
|
353
|
-
|
|
354
|
-
case 6:
|
|
355
|
-
if (guestUser && !(guestUser instanceof _user["default"])) {
|
|
356
|
-
stayLoggedIn = fieldsMapping;
|
|
357
|
-
fieldsMapping = guestUser;
|
|
358
|
-
guestUser = undefined;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
if (typeof fieldsMapping === 'boolean') {
|
|
362
|
-
stayLoggedIn = fieldsMapping;
|
|
363
|
-
fieldsMapping = undefined;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
return _context9.abrupt("return", this.app.request.post({
|
|
367
|
-
url: this.app.urls.userOAuthLogin(providerCode),
|
|
368
|
-
data: {
|
|
369
|
-
accessToken: accessToken,
|
|
370
|
-
accessTokenSecret: accessTokenSecret,
|
|
371
|
-
fieldsMapping: fieldsMapping,
|
|
372
|
-
guestUser: guestUser
|
|
373
|
-
}
|
|
374
|
-
}).then(function (data) {
|
|
375
|
-
return _this4.users.setCurrentUser(data, stayLoggedIn);
|
|
376
|
-
}));
|
|
377
|
-
|
|
378
|
-
case 9:
|
|
379
|
-
case "end":
|
|
380
|
-
return _context9.stop();
|
|
381
|
-
}
|
|
298
|
+
}).then(function (data) {
|
|
299
|
+
return _this4.users.setCurrentUser(data, stayLoggedIn);
|
|
300
|
+
}));
|
|
301
|
+
case 9:
|
|
302
|
+
case "end":
|
|
303
|
+
return _context9.stop();
|
|
382
304
|
}
|
|
383
305
|
}, _callee9, this);
|
|
384
306
|
}));
|
|
385
|
-
|
|
386
307
|
function loginWithOauth1(_x30, _x31, _x32, _x33, _x34, _x35) {
|
|
387
308
|
return _loginWithOauth2.apply(this, arguments);
|
|
388
309
|
}
|
|
389
|
-
|
|
390
310
|
return loginWithOauth1;
|
|
391
311
|
}()
|
|
392
312
|
}]);
|
|
393
313
|
return UsersSocial;
|
|
394
314
|
}();
|
|
395
|
-
|
|
396
315
|
exports["default"] = UsersSocial;
|
|
397
|
-
|
|
398
316
|
function addWindowEventListener(event, elem, callback) {
|
|
399
317
|
if (elem.addEventListener) {
|
|
400
318
|
elem.addEventListener(event, callback, false);
|
|
@@ -404,13 +322,11 @@ function addWindowEventListener(event, elem, callback) {
|
|
|
404
322
|
elem[event] = callback;
|
|
405
323
|
}
|
|
406
324
|
}
|
|
407
|
-
|
|
408
325
|
function removeWindowEventListener(event, elem, callback) {
|
|
409
326
|
if (elem.removeEventListener) {
|
|
410
327
|
elem.removeEventListener(event, callback, false);
|
|
411
328
|
} else if (elem.detachEvent) {
|
|
412
329
|
elem.detachEvent('on' + event, callback);
|
|
413
330
|
}
|
|
414
|
-
|
|
415
331
|
elem[event] = null;
|
|
416
332
|
}
|
package/lib/users/user.js
CHANGED
|
@@ -1,29 +1,24 @@
|
|
|
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 _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
10
|
var User = /*#__PURE__*/function () {
|
|
15
11
|
function User(user) {
|
|
16
12
|
var _this = this;
|
|
17
|
-
|
|
18
13
|
(0, _classCallCheck2["default"])(this, User);
|
|
19
14
|
user = user || {};
|
|
20
15
|
Object.keys(user).map(function (userProp) {
|
|
21
16
|
_this[userProp] = user[userProp];
|
|
22
|
-
});
|
|
17
|
+
});
|
|
23
18
|
|
|
19
|
+
//TODO: must be moved
|
|
24
20
|
this.___class = User.className;
|
|
25
21
|
}
|
|
26
|
-
|
|
27
22
|
(0, _createClass2["default"])(User, null, [{
|
|
28
23
|
key: "className",
|
|
29
24
|
get: function get() {
|
|
@@ -32,7 +27,5 @@ var User = /*#__PURE__*/function () {
|
|
|
32
27
|
}]);
|
|
33
28
|
return User;
|
|
34
29
|
}(); //TODO: must be removed
|
|
35
|
-
|
|
36
|
-
|
|
37
30
|
exports["default"] = User;
|
|
38
31
|
User.prototype.___class = User.className;
|
package/lib/users/utils.js
CHANGED
|
@@ -9,15 +9,12 @@ var UsersUtils = {
|
|
|
9
9
|
if (typeof navigator === 'undefined') {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
12
|
var language = '';
|
|
14
|
-
|
|
15
13
|
if (navigator.languages && navigator.languages.length) {
|
|
16
14
|
language = navigator.languages[0];
|
|
17
15
|
} else {
|
|
18
16
|
language = navigator.userLanguage || navigator.language || navigator.browserLanguage || navigator.systemLanguage || '';
|
|
19
17
|
}
|
|
20
|
-
|
|
21
18
|
return language.slice(0, 2).toLowerCase();
|
|
22
19
|
}
|
|
23
20
|
};
|