@feathersjs/client 4.5.15 → 4.5.16
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/CHANGELOG.md +8 -0
- package/dist/authentication.js +166 -363
- package/dist/authentication.js.map +1 -1
- package/dist/authentication.min.js +1 -1
- package/dist/core.js +177 -320
- package/dist/core.js.map +1 -1
- package/dist/core.min.js +1 -1
- package/dist/feathers.js +351 -778
- package/dist/feathers.js.map +1 -1
- package/dist/feathers.min.js +1 -1
- package/dist/primus.js +105 -178
- package/dist/primus.js.map +1 -1
- package/dist/primus.min.js +1 -1
- package/dist/rest.js +223 -486
- package/dist/rest.js.map +1 -1
- package/dist/rest.min.js +1 -1
- package/dist/socketio.js +105 -180
- package/dist/socketio.js.map +1 -1
- package/dist/socketio.min.js +1 -1
- package/package.json +12 -12
package/dist/authentication.js
CHANGED
|
@@ -22,12 +22,12 @@ return /******/ (function() { // webpackBootstrap
|
|
|
22
22
|
/**
|
|
23
23
|
* This is the web browser implementation of `debug()`.
|
|
24
24
|
*/
|
|
25
|
+
|
|
25
26
|
exports.formatArgs = formatArgs;
|
|
26
27
|
exports.save = save;
|
|
27
28
|
exports.load = load;
|
|
28
29
|
exports.useColors = useColors;
|
|
29
30
|
exports.storage = localstorage();
|
|
30
|
-
|
|
31
31
|
exports.destroy = function () {
|
|
32
32
|
var warned = false;
|
|
33
33
|
return function () {
|
|
@@ -37,12 +37,13 @@ exports.destroy = function () {
|
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
}();
|
|
40
|
+
|
|
40
41
|
/**
|
|
41
42
|
* Colors.
|
|
42
43
|
*/
|
|
43
44
|
|
|
44
|
-
|
|
45
45
|
exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
|
|
46
|
+
|
|
46
47
|
/**
|
|
47
48
|
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
48
49
|
* and the Firebug extension (any Firefox version) are known
|
|
@@ -50,57 +51,57 @@ exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066F
|
|
|
50
51
|
*
|
|
51
52
|
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
52
53
|
*/
|
|
53
|
-
// eslint-disable-next-line complexity
|
|
54
54
|
|
|
55
|
+
// eslint-disable-next-line complexity
|
|
55
56
|
function useColors() {
|
|
56
57
|
// NB: In an Electron preload script, document will be defined but not fully
|
|
57
58
|
// initialized. Since we know we're in Chrome, we'll just detect this case
|
|
58
59
|
// explicitly
|
|
59
60
|
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
60
61
|
return true;
|
|
61
|
-
}
|
|
62
|
-
|
|
62
|
+
}
|
|
63
63
|
|
|
64
|
+
// Internet Explorer and Edge do not support colors.
|
|
64
65
|
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
65
66
|
return false;
|
|
66
|
-
}
|
|
67
|
-
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
68
|
-
|
|
67
|
+
}
|
|
69
68
|
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
|
70
|
+
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
71
|
+
return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance ||
|
|
72
|
+
// Is firebug? http://stackoverflow.com/a/398120/376773
|
|
73
|
+
typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) ||
|
|
74
|
+
// Is firefox >= v31?
|
|
72
75
|
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
73
|
-
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 ||
|
|
76
|
+
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 ||
|
|
77
|
+
// Double check webkit in userAgent just in case we are in a worker
|
|
74
78
|
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
75
79
|
}
|
|
80
|
+
|
|
76
81
|
/**
|
|
77
82
|
* Colorize log arguments if enabled.
|
|
78
83
|
*
|
|
79
84
|
* @api public
|
|
80
85
|
*/
|
|
81
86
|
|
|
82
|
-
|
|
83
87
|
function formatArgs(args) {
|
|
84
88
|
args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
|
|
85
|
-
|
|
86
89
|
if (!this.useColors) {
|
|
87
90
|
return;
|
|
88
91
|
}
|
|
89
|
-
|
|
90
92
|
var c = 'color: ' + this.color;
|
|
91
|
-
args.splice(1, 0, c, 'color: inherit');
|
|
93
|
+
args.splice(1, 0, c, 'color: inherit');
|
|
94
|
+
|
|
95
|
+
// The final "%c" is somewhat tricky, because there could be other
|
|
92
96
|
// arguments passed either before or after the %c, so we need to
|
|
93
97
|
// figure out the correct index to insert the CSS into
|
|
94
|
-
|
|
95
98
|
var index = 0;
|
|
96
99
|
var lastC = 0;
|
|
97
100
|
args[0].replace(/%[a-zA-Z%]/g, function (match) {
|
|
98
101
|
if (match === '%%') {
|
|
99
102
|
return;
|
|
100
103
|
}
|
|
101
|
-
|
|
102
104
|
index++;
|
|
103
|
-
|
|
104
105
|
if (match === '%c') {
|
|
105
106
|
// We only are interested in the *last* %c
|
|
106
107
|
// (the user may have provided their own)
|
|
@@ -109,6 +110,7 @@ function formatArgs(args) {
|
|
|
109
110
|
});
|
|
110
111
|
args.splice(lastC, 0, c);
|
|
111
112
|
}
|
|
113
|
+
|
|
112
114
|
/**
|
|
113
115
|
* Invokes `console.debug()` when available.
|
|
114
116
|
* No-op when `console.debug` is not a "function".
|
|
@@ -117,17 +119,14 @@ function formatArgs(args) {
|
|
|
117
119
|
*
|
|
118
120
|
* @api public
|
|
119
121
|
*/
|
|
120
|
-
|
|
121
|
-
|
|
122
122
|
exports.log = console.debug || console.log || function () {};
|
|
123
|
+
|
|
123
124
|
/**
|
|
124
125
|
* Save `namespaces`.
|
|
125
126
|
*
|
|
126
127
|
* @param {String} namespaces
|
|
127
128
|
* @api private
|
|
128
129
|
*/
|
|
129
|
-
|
|
130
|
-
|
|
131
130
|
function save(namespaces) {
|
|
132
131
|
try {
|
|
133
132
|
if (namespaces) {
|
|
@@ -135,34 +134,34 @@ function save(namespaces) {
|
|
|
135
134
|
} else {
|
|
136
135
|
exports.storage.removeItem('debug');
|
|
137
136
|
}
|
|
138
|
-
} catch (error) {
|
|
137
|
+
} catch (error) {
|
|
138
|
+
// Swallow
|
|
139
139
|
// XXX (@Qix-) should we be logging these?
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
+
|
|
142
143
|
/**
|
|
143
144
|
* Load `namespaces`.
|
|
144
145
|
*
|
|
145
146
|
* @return {String} returns the previously persisted debug modes
|
|
146
147
|
* @api private
|
|
147
148
|
*/
|
|
148
|
-
|
|
149
|
-
|
|
150
149
|
function load() {
|
|
151
150
|
var r;
|
|
152
|
-
|
|
153
151
|
try {
|
|
154
152
|
r = exports.storage.getItem('debug');
|
|
155
|
-
} catch (error) {
|
|
153
|
+
} catch (error) {
|
|
154
|
+
// Swallow
|
|
156
155
|
// XXX (@Qix-) should we be logging these?
|
|
157
|
-
}
|
|
158
|
-
|
|
156
|
+
}
|
|
159
157
|
|
|
158
|
+
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|
160
159
|
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
|
161
160
|
r = process.env.DEBUG;
|
|
162
161
|
}
|
|
163
|
-
|
|
164
162
|
return r;
|
|
165
163
|
}
|
|
164
|
+
|
|
166
165
|
/**
|
|
167
166
|
* Localstorage attempts to return the localstorage.
|
|
168
167
|
*
|
|
@@ -174,19 +173,19 @@ function load() {
|
|
|
174
173
|
* @api private
|
|
175
174
|
*/
|
|
176
175
|
|
|
177
|
-
|
|
178
176
|
function localstorage() {
|
|
179
177
|
try {
|
|
180
178
|
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
|
181
179
|
// The Browser also has localStorage in the global context.
|
|
182
180
|
return localStorage;
|
|
183
|
-
} catch (error) {
|
|
181
|
+
} catch (error) {
|
|
182
|
+
// Swallow
|
|
184
183
|
// XXX (@Qix-) should we be logging these?
|
|
185
184
|
}
|
|
186
185
|
}
|
|
187
|
-
|
|
188
186
|
module.exports = __webpack_require__(/*! ./common */ "../../node_modules/debug/src/common.js")(exports);
|
|
189
187
|
var formatters = module.exports.formatters;
|
|
188
|
+
|
|
190
189
|
/**
|
|
191
190
|
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
192
191
|
*/
|
|
@@ -208,21 +207,16 @@ formatters.j = function (v) {
|
|
|
208
207
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
209
208
|
|
|
210
209
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
211
|
-
|
|
212
210
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
213
|
-
|
|
214
211
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
215
|
-
|
|
216
212
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
217
|
-
|
|
218
213
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
219
|
-
|
|
220
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
221
|
-
|
|
214
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
222
215
|
/**
|
|
223
216
|
* This is the common logic for both the Node.js and web browser
|
|
224
217
|
* implementations of `debug()`.
|
|
225
218
|
*/
|
|
219
|
+
|
|
226
220
|
function setup(env) {
|
|
227
221
|
createDebug.debug = createDebug;
|
|
228
222
|
createDebug.default = createDebug;
|
|
@@ -235,29 +229,29 @@ function setup(env) {
|
|
|
235
229
|
Object.keys(env).forEach(function (key) {
|
|
236
230
|
createDebug[key] = env[key];
|
|
237
231
|
});
|
|
232
|
+
|
|
238
233
|
/**
|
|
239
234
|
* The currently active debug mode names, and names to skip.
|
|
240
235
|
*/
|
|
241
236
|
|
|
242
237
|
createDebug.names = [];
|
|
243
238
|
createDebug.skips = [];
|
|
239
|
+
|
|
244
240
|
/**
|
|
245
241
|
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
246
242
|
*
|
|
247
243
|
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
248
244
|
*/
|
|
249
|
-
|
|
250
245
|
createDebug.formatters = {};
|
|
246
|
+
|
|
251
247
|
/**
|
|
252
248
|
* Selects a color for a debug namespace
|
|
253
249
|
* @param {String} namespace The namespace string for the debug instance to be colored
|
|
254
250
|
* @return {Number|String} An ANSI color code for the given namespace
|
|
255
251
|
* @api private
|
|
256
252
|
*/
|
|
257
|
-
|
|
258
253
|
function selectColor(namespace) {
|
|
259
254
|
var hash = 0;
|
|
260
|
-
|
|
261
255
|
for (var i = 0; i < namespace.length; i++) {
|
|
262
256
|
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
263
257
|
hash |= 0; // Convert to 32bit integer
|
|
@@ -265,8 +259,8 @@ function setup(env) {
|
|
|
265
259
|
|
|
266
260
|
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
267
261
|
}
|
|
268
|
-
|
|
269
262
|
createDebug.selectColor = selectColor;
|
|
263
|
+
|
|
270
264
|
/**
|
|
271
265
|
* Create a debugger with the given `namespace`.
|
|
272
266
|
*
|
|
@@ -274,25 +268,22 @@ function setup(env) {
|
|
|
274
268
|
* @return {Function}
|
|
275
269
|
* @api public
|
|
276
270
|
*/
|
|
277
|
-
|
|
278
271
|
function createDebug(namespace) {
|
|
279
272
|
var prevTime;
|
|
280
273
|
var enableOverride = null;
|
|
281
274
|
var namespacesCache;
|
|
282
275
|
var enabledCache;
|
|
283
|
-
|
|
284
276
|
function debug() {
|
|
285
277
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
286
278
|
args[_key] = arguments[_key];
|
|
287
279
|
}
|
|
288
|
-
|
|
289
280
|
// Disabled?
|
|
290
281
|
if (!debug.enabled) {
|
|
291
282
|
return;
|
|
292
283
|
}
|
|
284
|
+
var self = debug;
|
|
293
285
|
|
|
294
|
-
|
|
295
|
-
|
|
286
|
+
// Set `diff` timestamp
|
|
296
287
|
var curr = Number(new Date());
|
|
297
288
|
var ms = curr - (prevTime || curr);
|
|
298
289
|
self.diff = ms;
|
|
@@ -300,39 +291,36 @@ function setup(env) {
|
|
|
300
291
|
self.curr = curr;
|
|
301
292
|
prevTime = curr;
|
|
302
293
|
args[0] = createDebug.coerce(args[0]);
|
|
303
|
-
|
|
304
294
|
if (typeof args[0] !== 'string') {
|
|
305
295
|
// Anything else let's inspect with %O
|
|
306
296
|
args.unshift('%O');
|
|
307
|
-
}
|
|
308
|
-
|
|
297
|
+
}
|
|
309
298
|
|
|
299
|
+
// Apply any `formatters` transformations
|
|
310
300
|
var index = 0;
|
|
311
301
|
args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
|
|
312
302
|
// If we encounter an escaped % then don't increase the array index
|
|
313
303
|
if (match === '%%') {
|
|
314
304
|
return '%';
|
|
315
305
|
}
|
|
316
|
-
|
|
317
306
|
index++;
|
|
318
307
|
var formatter = createDebug.formatters[format];
|
|
319
|
-
|
|
320
308
|
if (typeof formatter === 'function') {
|
|
321
309
|
var val = args[index];
|
|
322
|
-
match = formatter.call(self, val);
|
|
310
|
+
match = formatter.call(self, val);
|
|
323
311
|
|
|
312
|
+
// Now we need to remove `args[index]` since it's inlined in the `format`
|
|
324
313
|
args.splice(index, 1);
|
|
325
314
|
index--;
|
|
326
315
|
}
|
|
327
|
-
|
|
328
316
|
return match;
|
|
329
|
-
});
|
|
317
|
+
});
|
|
330
318
|
|
|
319
|
+
// Apply env-specific formatting (colors, etc.)
|
|
331
320
|
createDebug.formatArgs.call(self, args);
|
|
332
321
|
var logFn = self.log || createDebug.log;
|
|
333
322
|
logFn.apply(self, args);
|
|
334
323
|
}
|
|
335
|
-
|
|
336
324
|
debug.namespace = namespace;
|
|
337
325
|
debug.useColors = createDebug.useColors();
|
|
338
326
|
debug.color = createDebug.selectColor(namespace);
|
|
@@ -346,31 +334,29 @@ function setup(env) {
|
|
|
346
334
|
if (enableOverride !== null) {
|
|
347
335
|
return enableOverride;
|
|
348
336
|
}
|
|
349
|
-
|
|
350
337
|
if (namespacesCache !== createDebug.namespaces) {
|
|
351
338
|
namespacesCache = createDebug.namespaces;
|
|
352
339
|
enabledCache = createDebug.enabled(namespace);
|
|
353
340
|
}
|
|
354
|
-
|
|
355
341
|
return enabledCache;
|
|
356
342
|
},
|
|
357
343
|
set: function set(v) {
|
|
358
344
|
enableOverride = v;
|
|
359
345
|
}
|
|
360
|
-
});
|
|
346
|
+
});
|
|
361
347
|
|
|
348
|
+
// Env-specific initialization logic for debug instances
|
|
362
349
|
if (typeof createDebug.init === 'function') {
|
|
363
350
|
createDebug.init(debug);
|
|
364
351
|
}
|
|
365
|
-
|
|
366
352
|
return debug;
|
|
367
353
|
}
|
|
368
|
-
|
|
369
354
|
function extend(namespace, delimiter) {
|
|
370
355
|
var newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
|
371
356
|
newDebug.log = this.log;
|
|
372
357
|
return newDebug;
|
|
373
358
|
}
|
|
359
|
+
|
|
374
360
|
/**
|
|
375
361
|
* Enables a debug mode by namespaces. This can include modes
|
|
376
362
|
* separated by a colon and wildcards.
|
|
@@ -378,8 +364,6 @@ function setup(env) {
|
|
|
378
364
|
* @param {String} namespaces
|
|
379
365
|
* @api public
|
|
380
366
|
*/
|
|
381
|
-
|
|
382
|
-
|
|
383
367
|
function enable(namespaces) {
|
|
384
368
|
createDebug.save(namespaces);
|
|
385
369
|
createDebug.namespaces = namespaces;
|
|
@@ -388,15 +372,12 @@ function setup(env) {
|
|
|
388
372
|
var i;
|
|
389
373
|
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
390
374
|
var len = split.length;
|
|
391
|
-
|
|
392
375
|
for (i = 0; i < len; i++) {
|
|
393
376
|
if (!split[i]) {
|
|
394
377
|
// ignore empty strings
|
|
395
378
|
continue;
|
|
396
379
|
}
|
|
397
|
-
|
|
398
380
|
namespaces = split[i].replace(/\*/g, '.*?');
|
|
399
|
-
|
|
400
381
|
if (namespaces[0] === '-') {
|
|
401
382
|
createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
|
|
402
383
|
} else {
|
|
@@ -404,14 +385,13 @@ function setup(env) {
|
|
|
404
385
|
}
|
|
405
386
|
}
|
|
406
387
|
}
|
|
388
|
+
|
|
407
389
|
/**
|
|
408
390
|
* Disable debug output.
|
|
409
391
|
*
|
|
410
392
|
* @return {String} namespaces
|
|
411
393
|
* @api public
|
|
412
394
|
*/
|
|
413
|
-
|
|
414
|
-
|
|
415
395
|
function disable() {
|
|
416
396
|
var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) {
|
|
417
397
|
return '-' + namespace;
|
|
@@ -419,6 +399,7 @@ function setup(env) {
|
|
|
419
399
|
createDebug.enable('');
|
|
420
400
|
return namespaces;
|
|
421
401
|
}
|
|
402
|
+
|
|
422
403
|
/**
|
|
423
404
|
* Returns true if the given mode name is enabled, false otherwise.
|
|
424
405
|
*
|
|
@@ -426,30 +407,25 @@ function setup(env) {
|
|
|
426
407
|
* @return {Boolean}
|
|
427
408
|
* @api public
|
|
428
409
|
*/
|
|
429
|
-
|
|
430
|
-
|
|
431
410
|
function enabled(name) {
|
|
432
411
|
if (name[name.length - 1] === '*') {
|
|
433
412
|
return true;
|
|
434
413
|
}
|
|
435
|
-
|
|
436
414
|
var i;
|
|
437
415
|
var len;
|
|
438
|
-
|
|
439
416
|
for (i = 0, len = createDebug.skips.length; i < len; i++) {
|
|
440
417
|
if (createDebug.skips[i].test(name)) {
|
|
441
418
|
return false;
|
|
442
419
|
}
|
|
443
420
|
}
|
|
444
|
-
|
|
445
421
|
for (i = 0, len = createDebug.names.length; i < len; i++) {
|
|
446
422
|
if (createDebug.names[i].test(name)) {
|
|
447
423
|
return true;
|
|
448
424
|
}
|
|
449
425
|
}
|
|
450
|
-
|
|
451
426
|
return false;
|
|
452
427
|
}
|
|
428
|
+
|
|
453
429
|
/**
|
|
454
430
|
* Convert regexp to namespace
|
|
455
431
|
*
|
|
@@ -457,11 +433,10 @@ function setup(env) {
|
|
|
457
433
|
* @return {String} namespace
|
|
458
434
|
* @api private
|
|
459
435
|
*/
|
|
460
|
-
|
|
461
|
-
|
|
462
436
|
function toNamespace(regexp) {
|
|
463
437
|
return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, '*');
|
|
464
438
|
}
|
|
439
|
+
|
|
465
440
|
/**
|
|
466
441
|
* Coerce `val`.
|
|
467
442
|
*
|
|
@@ -469,29 +444,23 @@ function setup(env) {
|
|
|
469
444
|
* @return {Mixed}
|
|
470
445
|
* @api private
|
|
471
446
|
*/
|
|
472
|
-
|
|
473
|
-
|
|
474
447
|
function coerce(val) {
|
|
475
448
|
if (val instanceof Error) {
|
|
476
449
|
return val.stack || val.message;
|
|
477
450
|
}
|
|
478
|
-
|
|
479
451
|
return val;
|
|
480
452
|
}
|
|
453
|
+
|
|
481
454
|
/**
|
|
482
455
|
* XXX DO NOT USE. This is a temporary stub function.
|
|
483
456
|
* XXX It WILL be removed in the next major release.
|
|
484
457
|
*/
|
|
485
|
-
|
|
486
|
-
|
|
487
458
|
function destroy() {
|
|
488
459
|
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
489
460
|
}
|
|
490
|
-
|
|
491
461
|
createDebug.enable(createDebug.load());
|
|
492
462
|
return createDebug;
|
|
493
463
|
}
|
|
494
|
-
|
|
495
464
|
module.exports = setup;
|
|
496
465
|
|
|
497
466
|
/***/ }),
|
|
@@ -505,63 +474,47 @@ module.exports = setup;
|
|
|
505
474
|
"use strict";
|
|
506
475
|
|
|
507
476
|
|
|
477
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
508
478
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
509
|
-
|
|
510
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
511
|
-
|
|
479
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
512
480
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
513
|
-
|
|
481
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
482
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
514
483
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
515
|
-
|
|
516
484
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
517
|
-
|
|
518
485
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
519
|
-
|
|
520
|
-
function
|
|
521
|
-
|
|
522
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
523
|
-
|
|
486
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
487
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
524
488
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
525
|
-
|
|
526
489
|
Object.defineProperty(exports, "__esModule", ({
|
|
527
490
|
value: true
|
|
528
491
|
}));
|
|
529
492
|
exports.AuthenticationClient = void 0;
|
|
530
|
-
|
|
531
493
|
var errors_1 = __webpack_require__(/*! @feathersjs/errors */ "../errors/lib/index.js");
|
|
532
|
-
|
|
533
494
|
var storage_1 = __webpack_require__(/*! ./storage */ "../authentication-client/lib/storage.js");
|
|
534
|
-
|
|
535
495
|
var getMatch = function getMatch(location, key) {
|
|
536
496
|
var regex = new RegExp("(?:&?)".concat(key, "=([^&]*)"));
|
|
537
497
|
var match = location.hash ? location.hash.match(regex) : null;
|
|
538
|
-
|
|
539
498
|
if (match !== null) {
|
|
540
499
|
var _match = _slicedToArray(match, 2),
|
|
541
|
-
|
|
542
|
-
|
|
500
|
+
value = _match[1];
|
|
543
501
|
return [value, regex];
|
|
544
502
|
}
|
|
545
|
-
|
|
546
503
|
return [null, regex];
|
|
547
504
|
};
|
|
548
|
-
|
|
549
505
|
var AuthenticationClient = /*#__PURE__*/function () {
|
|
550
506
|
function AuthenticationClient(app, options) {
|
|
551
507
|
_classCallCheck(this, AuthenticationClient);
|
|
552
|
-
|
|
553
508
|
var socket = app.io || app.primus;
|
|
554
509
|
var storage = new storage_1.StorageWrapper(app.get('storage') || options.storage);
|
|
555
510
|
this.app = app;
|
|
556
511
|
this.options = options;
|
|
557
512
|
this.authenticated = false;
|
|
558
513
|
this.app.set('storage', storage);
|
|
559
|
-
|
|
560
514
|
if (socket) {
|
|
561
515
|
this.handleSocket(socket);
|
|
562
516
|
}
|
|
563
517
|
}
|
|
564
|
-
|
|
565
518
|
_createClass(AuthenticationClient, [{
|
|
566
519
|
key: "service",
|
|
567
520
|
get: function get() {
|
|
@@ -576,7 +529,6 @@ var AuthenticationClient = /*#__PURE__*/function () {
|
|
|
576
529
|
key: "handleSocket",
|
|
577
530
|
value: function handleSocket(socket) {
|
|
578
531
|
var _this = this;
|
|
579
|
-
|
|
580
532
|
// Connection events happen on every reconnect
|
|
581
533
|
var connected = this.app.io ? 'connect' : 'open';
|
|
582
534
|
var disconnected = this.app.io ? 'disconnect' : 'disconnection';
|
|
@@ -585,13 +537,13 @@ var AuthenticationClient = /*#__PURE__*/function () {
|
|
|
585
537
|
return socket.once(connected, function (data) {
|
|
586
538
|
return resolve(data);
|
|
587
539
|
});
|
|
588
|
-
})
|
|
540
|
+
})
|
|
541
|
+
// Only reconnect when `reAuthenticate()` or `authenticate()`
|
|
589
542
|
// has been called explicitly first
|
|
590
543
|
// Force reauthentication with the server
|
|
591
544
|
.then(function () {
|
|
592
545
|
return _this.authenticated ? _this.reAuthenticate(true) : null;
|
|
593
546
|
});
|
|
594
|
-
|
|
595
547
|
_this.app.set('authentication', authPromise);
|
|
596
548
|
});
|
|
597
549
|
}
|
|
@@ -599,25 +551,21 @@ var AuthenticationClient = /*#__PURE__*/function () {
|
|
|
599
551
|
key: "getFromLocation",
|
|
600
552
|
value: function getFromLocation(location) {
|
|
601
553
|
var _getMatch = getMatch(location, this.options.locationKey),
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
554
|
+
_getMatch2 = _slicedToArray(_getMatch, 2),
|
|
555
|
+
accessToken = _getMatch2[0],
|
|
556
|
+
tokenRegex = _getMatch2[1];
|
|
606
557
|
if (accessToken !== null) {
|
|
607
558
|
location.hash = location.hash.replace(tokenRegex, '');
|
|
608
559
|
return Promise.resolve(accessToken);
|
|
609
560
|
}
|
|
610
|
-
|
|
611
561
|
var _getMatch3 = getMatch(location, this.options.locationErrorKey),
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
562
|
+
_getMatch4 = _slicedToArray(_getMatch3, 2),
|
|
563
|
+
message = _getMatch4[0],
|
|
564
|
+
errorRegex = _getMatch4[1];
|
|
616
565
|
if (message !== null) {
|
|
617
566
|
location.hash = location.hash.replace(errorRegex, '');
|
|
618
567
|
return Promise.reject(new errors_1.NotAuthenticated(decodeURIComponent(message)));
|
|
619
568
|
}
|
|
620
|
-
|
|
621
569
|
return Promise.resolve(null);
|
|
622
570
|
}
|
|
623
571
|
}, {
|
|
@@ -629,12 +577,10 @@ var AuthenticationClient = /*#__PURE__*/function () {
|
|
|
629
577
|
key: "getAccessToken",
|
|
630
578
|
value: function getAccessToken() {
|
|
631
579
|
var _this2 = this;
|
|
632
|
-
|
|
633
580
|
return this.storage.getItem(this.options.storageKey).then(function (accessToken) {
|
|
634
581
|
if (!accessToken && typeof window !== 'undefined' && window.location) {
|
|
635
582
|
return _this2.getFromLocation(window.location);
|
|
636
583
|
}
|
|
637
|
-
|
|
638
584
|
return accessToken || null;
|
|
639
585
|
});
|
|
640
586
|
}
|
|
@@ -654,7 +600,6 @@ var AuthenticationClient = /*#__PURE__*/function () {
|
|
|
654
600
|
key: "handleError",
|
|
655
601
|
value: function handleError(error, type) {
|
|
656
602
|
var _this3 = this;
|
|
657
|
-
|
|
658
603
|
if (error.code === 401 || error.code === 403) {
|
|
659
604
|
var promise = this.removeAccessToken().then(function () {
|
|
660
605
|
return _this3.reset();
|
|
@@ -663,52 +608,42 @@ var AuthenticationClient = /*#__PURE__*/function () {
|
|
|
663
608
|
return Promise.reject(error);
|
|
664
609
|
});
|
|
665
610
|
}
|
|
666
|
-
|
|
667
611
|
return Promise.reject(error);
|
|
668
612
|
}
|
|
669
613
|
}, {
|
|
670
614
|
key: "reAuthenticate",
|
|
671
615
|
value: function reAuthenticate() {
|
|
672
616
|
var _this4 = this;
|
|
673
|
-
|
|
674
617
|
var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
675
618
|
var strategy = arguments.length > 1 ? arguments[1] : undefined;
|
|
676
619
|
// Either returns the authentication state or
|
|
677
620
|
// tries to re-authenticate with the stored JWT and strategy
|
|
678
621
|
var authPromise = this.app.get('authentication');
|
|
679
|
-
|
|
680
622
|
if (!authPromise || force === true) {
|
|
681
623
|
return this.getAccessToken().then(function (accessToken) {
|
|
682
624
|
if (!accessToken) {
|
|
683
625
|
throw new errors_1.NotAuthenticated('No accessToken found in storage');
|
|
684
626
|
}
|
|
685
|
-
|
|
686
627
|
return _this4.authenticate({
|
|
687
628
|
strategy: strategy || _this4.options.jwtStrategy,
|
|
688
629
|
accessToken: accessToken
|
|
689
630
|
});
|
|
690
631
|
});
|
|
691
632
|
}
|
|
692
|
-
|
|
693
633
|
return authPromise;
|
|
694
634
|
}
|
|
695
635
|
}, {
|
|
696
636
|
key: "authenticate",
|
|
697
637
|
value: function authenticate(authentication, params) {
|
|
698
638
|
var _this5 = this;
|
|
699
|
-
|
|
700
639
|
if (!authentication) {
|
|
701
640
|
return this.reAuthenticate();
|
|
702
641
|
}
|
|
703
|
-
|
|
704
642
|
var promise = this.service.create(authentication, params).then(function (authResult) {
|
|
705
643
|
var accessToken = authResult.accessToken;
|
|
706
644
|
_this5.authenticated = true;
|
|
707
|
-
|
|
708
645
|
_this5.app.emit('login', authResult);
|
|
709
|
-
|
|
710
646
|
_this5.app.emit('authenticated', authResult);
|
|
711
|
-
|
|
712
647
|
return _this5.setAccessToken(accessToken).then(function () {
|
|
713
648
|
return authResult;
|
|
714
649
|
});
|
|
@@ -722,14 +657,12 @@ var AuthenticationClient = /*#__PURE__*/function () {
|
|
|
722
657
|
key: "logout",
|
|
723
658
|
value: function logout() {
|
|
724
659
|
var _this6 = this;
|
|
725
|
-
|
|
726
660
|
return Promise.resolve(this.app.get('authentication')).then(function () {
|
|
727
661
|
return _this6.service.remove(null).then(function (authResult) {
|
|
728
662
|
return _this6.removeAccessToken().then(function () {
|
|
729
663
|
return _this6.reset();
|
|
730
664
|
}).then(function () {
|
|
731
665
|
_this6.app.emit('logout', authResult);
|
|
732
|
-
|
|
733
666
|
return authResult;
|
|
734
667
|
});
|
|
735
668
|
});
|
|
@@ -738,10 +671,8 @@ var AuthenticationClient = /*#__PURE__*/function () {
|
|
|
738
671
|
});
|
|
739
672
|
}
|
|
740
673
|
}]);
|
|
741
|
-
|
|
742
674
|
return AuthenticationClient;
|
|
743
675
|
}();
|
|
744
|
-
|
|
745
676
|
exports.AuthenticationClient = AuthenticationClient;
|
|
746
677
|
|
|
747
678
|
/***/ }),
|
|
@@ -759,31 +690,25 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
759
690
|
value: true
|
|
760
691
|
}));
|
|
761
692
|
exports.authentication = void 0;
|
|
762
|
-
|
|
763
693
|
var commons_1 = __webpack_require__(/*! @feathersjs/commons */ "../commons/lib/index.js");
|
|
764
|
-
|
|
765
694
|
var authentication = function authentication() {
|
|
766
695
|
return function (context) {
|
|
767
696
|
var app = context.app,
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
697
|
+
params = context.params,
|
|
698
|
+
path = context.path,
|
|
699
|
+
method = context.method,
|
|
700
|
+
service = context.app.authentication;
|
|
773
701
|
if ((0, commons_1.stripSlashes)(service.options.path) === path && method === 'create') {
|
|
774
702
|
return context;
|
|
775
703
|
}
|
|
776
|
-
|
|
777
704
|
return Promise.resolve(app.get('authentication')).then(function (authResult) {
|
|
778
705
|
if (authResult) {
|
|
779
706
|
context.params = Object.assign({}, authResult, params);
|
|
780
707
|
}
|
|
781
|
-
|
|
782
708
|
return context;
|
|
783
709
|
});
|
|
784
710
|
};
|
|
785
711
|
};
|
|
786
|
-
|
|
787
712
|
exports.authentication = authentication;
|
|
788
713
|
|
|
789
714
|
/***/ }),
|
|
@@ -801,18 +726,14 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
801
726
|
value: true
|
|
802
727
|
}));
|
|
803
728
|
exports.populateHeader = exports.authentication = void 0;
|
|
804
|
-
|
|
805
729
|
var authentication_1 = __webpack_require__(/*! ./authentication */ "../authentication-client/lib/hooks/authentication.js");
|
|
806
|
-
|
|
807
730
|
Object.defineProperty(exports, "authentication", ({
|
|
808
731
|
enumerable: true,
|
|
809
732
|
get: function get() {
|
|
810
733
|
return authentication_1.authentication;
|
|
811
734
|
}
|
|
812
735
|
}));
|
|
813
|
-
|
|
814
736
|
var populate_header_1 = __webpack_require__(/*! ./populate-header */ "../authentication-client/lib/hooks/populate-header.js");
|
|
815
|
-
|
|
816
737
|
Object.defineProperty(exports, "populateHeader", ({
|
|
817
738
|
enumerable: true,
|
|
818
739
|
get: function get() {
|
|
@@ -831,31 +752,30 @@ Object.defineProperty(exports, "populateHeader", ({
|
|
|
831
752
|
"use strict";
|
|
832
753
|
|
|
833
754
|
|
|
834
|
-
function
|
|
835
|
-
|
|
755
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
756
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
757
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
758
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
836
759
|
Object.defineProperty(exports, "__esModule", ({
|
|
837
760
|
value: true
|
|
838
761
|
}));
|
|
839
762
|
exports.populateHeader = void 0;
|
|
840
|
-
|
|
841
763
|
var populateHeader = function populateHeader() {
|
|
842
764
|
return function (context) {
|
|
843
765
|
var app = context.app,
|
|
844
|
-
|
|
845
|
-
var authentication = app.authentication;
|
|
846
|
-
|
|
766
|
+
accessToken = context.params.accessToken;
|
|
767
|
+
var authentication = app.authentication;
|
|
768
|
+
// Set REST header if necessary
|
|
847
769
|
if (app.rest && accessToken) {
|
|
848
770
|
var _authentication$optio = authentication.options,
|
|
849
|
-
|
|
850
|
-
|
|
771
|
+
scheme = _authentication$optio.scheme,
|
|
772
|
+
header = _authentication$optio.header;
|
|
851
773
|
var authHeader = "".concat(scheme, " ").concat(accessToken);
|
|
852
774
|
context.params.headers = Object.assign({}, _defineProperty({}, header, authHeader), context.params.headers);
|
|
853
775
|
}
|
|
854
|
-
|
|
855
776
|
return context;
|
|
856
777
|
};
|
|
857
778
|
};
|
|
858
|
-
|
|
859
779
|
exports.populateHeader = populateHeader;
|
|
860
780
|
|
|
861
781
|
/***/ }),
|
|
@@ -872,7 +792,6 @@ exports.populateHeader = populateHeader;
|
|
|
872
792
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
873
793
|
if (k2 === undefined) k2 = k;
|
|
874
794
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
875
|
-
|
|
876
795
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
877
796
|
desc = {
|
|
878
797
|
enumerable: true,
|
|
@@ -881,13 +800,11 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
|
|
|
881
800
|
}
|
|
882
801
|
};
|
|
883
802
|
}
|
|
884
|
-
|
|
885
803
|
Object.defineProperty(o, k2, desc);
|
|
886
804
|
} : function (o, m, k, k2) {
|
|
887
805
|
if (k2 === undefined) k2 = k;
|
|
888
806
|
o[k2] = m[k];
|
|
889
807
|
});
|
|
890
|
-
|
|
891
808
|
var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
|
892
809
|
Object.defineProperty(o, "default", {
|
|
893
810
|
enumerable: true,
|
|
@@ -896,54 +813,39 @@ var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? fun
|
|
|
896
813
|
} : function (o, v) {
|
|
897
814
|
o["default"] = v;
|
|
898
815
|
});
|
|
899
|
-
|
|
900
816
|
var __importStar = this && this.__importStar || function (mod) {
|
|
901
817
|
if (mod && mod.__esModule) return mod;
|
|
902
818
|
var result = {};
|
|
903
|
-
if (mod != null) for (var k in mod)
|
|
904
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
905
|
-
}
|
|
906
|
-
|
|
819
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
907
820
|
__setModuleDefault(result, mod);
|
|
908
|
-
|
|
909
821
|
return result;
|
|
910
822
|
};
|
|
911
|
-
|
|
912
823
|
Object.defineProperty(exports, "__esModule", ({
|
|
913
824
|
value: true
|
|
914
825
|
}));
|
|
915
826
|
exports.defaults = exports.defaultStorage = exports.hooks = exports.MemoryStorage = exports.AuthenticationClient = exports.getDefaultStorage = void 0;
|
|
916
|
-
|
|
917
827
|
var core_1 = __webpack_require__(/*! ./core */ "../authentication-client/lib/core.js");
|
|
918
|
-
|
|
919
828
|
Object.defineProperty(exports, "AuthenticationClient", ({
|
|
920
829
|
enumerable: true,
|
|
921
830
|
get: function get() {
|
|
922
831
|
return core_1.AuthenticationClient;
|
|
923
832
|
}
|
|
924
833
|
}));
|
|
925
|
-
|
|
926
834
|
var hooks = __importStar(__webpack_require__(/*! ./hooks */ "../authentication-client/lib/hooks/index.js"));
|
|
927
|
-
|
|
928
835
|
exports.hooks = hooks;
|
|
929
|
-
|
|
930
836
|
var storage_1 = __webpack_require__(/*! ./storage */ "../authentication-client/lib/storage.js");
|
|
931
|
-
|
|
932
837
|
Object.defineProperty(exports, "MemoryStorage", ({
|
|
933
838
|
enumerable: true,
|
|
934
839
|
get: function get() {
|
|
935
840
|
return storage_1.MemoryStorage;
|
|
936
841
|
}
|
|
937
842
|
}));
|
|
938
|
-
|
|
939
843
|
var getDefaultStorage = function getDefaultStorage() {
|
|
940
844
|
try {
|
|
941
845
|
return new storage_1.StorageWrapper(window.localStorage);
|
|
942
846
|
} catch (error) {}
|
|
943
|
-
|
|
944
847
|
return new storage_1.MemoryStorage();
|
|
945
848
|
};
|
|
946
|
-
|
|
947
849
|
exports.getDefaultStorage = getDefaultStorage;
|
|
948
850
|
exports.defaultStorage = (0, exports.getDefaultStorage)();
|
|
949
851
|
exports.defaults = {
|
|
@@ -957,10 +859,8 @@ exports.defaults = {
|
|
|
957
859
|
Authentication: core_1.AuthenticationClient,
|
|
958
860
|
storage: exports.defaultStorage
|
|
959
861
|
};
|
|
960
|
-
|
|
961
862
|
var init = function init() {
|
|
962
863
|
var _options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
963
|
-
|
|
964
864
|
var options = Object.assign({}, exports.defaults, _options);
|
|
965
865
|
var Authentication = options.Authentication;
|
|
966
866
|
return function (app) {
|
|
@@ -976,9 +876,7 @@ var init = function init() {
|
|
|
976
876
|
});
|
|
977
877
|
};
|
|
978
878
|
};
|
|
979
|
-
|
|
980
879
|
exports["default"] = init;
|
|
981
|
-
|
|
982
880
|
if (true) {
|
|
983
881
|
module.exports = Object.assign(init, module.exports);
|
|
984
882
|
}
|
|
@@ -994,24 +892,21 @@ if (true) {
|
|
|
994
892
|
"use strict";
|
|
995
893
|
|
|
996
894
|
|
|
895
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
997
896
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
998
|
-
|
|
999
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
1000
|
-
|
|
897
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
1001
898
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
1002
|
-
|
|
899
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
900
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1003
901
|
Object.defineProperty(exports, "__esModule", ({
|
|
1004
902
|
value: true
|
|
1005
903
|
}));
|
|
1006
904
|
exports.StorageWrapper = exports.MemoryStorage = void 0;
|
|
1007
|
-
|
|
1008
905
|
var MemoryStorage = /*#__PURE__*/function () {
|
|
1009
906
|
function MemoryStorage() {
|
|
1010
907
|
_classCallCheck(this, MemoryStorage);
|
|
1011
|
-
|
|
1012
908
|
this.store = {};
|
|
1013
909
|
}
|
|
1014
|
-
|
|
1015
910
|
_createClass(MemoryStorage, [{
|
|
1016
911
|
key: "getItem",
|
|
1017
912
|
value: function getItem(key) {
|
|
@@ -1030,19 +925,14 @@ var MemoryStorage = /*#__PURE__*/function () {
|
|
|
1030
925
|
return Promise.resolve(value);
|
|
1031
926
|
}
|
|
1032
927
|
}]);
|
|
1033
|
-
|
|
1034
928
|
return MemoryStorage;
|
|
1035
929
|
}();
|
|
1036
|
-
|
|
1037
930
|
exports.MemoryStorage = MemoryStorage;
|
|
1038
|
-
|
|
1039
931
|
var StorageWrapper = /*#__PURE__*/function () {
|
|
1040
932
|
function StorageWrapper(storage) {
|
|
1041
933
|
_classCallCheck(this, StorageWrapper);
|
|
1042
|
-
|
|
1043
934
|
this.storage = storage;
|
|
1044
935
|
}
|
|
1045
|
-
|
|
1046
936
|
_createClass(StorageWrapper, [{
|
|
1047
937
|
key: "getItem",
|
|
1048
938
|
value: function getItem(key) {
|
|
@@ -1059,10 +949,8 @@ var StorageWrapper = /*#__PURE__*/function () {
|
|
|
1059
949
|
return Promise.resolve(this.storage.removeItem(key));
|
|
1060
950
|
}
|
|
1061
951
|
}]);
|
|
1062
|
-
|
|
1063
952
|
return StorageWrapper;
|
|
1064
953
|
}();
|
|
1065
|
-
|
|
1066
954
|
exports.StorageWrapper = StorageWrapper;
|
|
1067
955
|
|
|
1068
956
|
/***/ }),
|
|
@@ -1087,19 +975,15 @@ module.exports = __webpack_require__(/*! @feathersjs/authentication-client */ ".
|
|
|
1087
975
|
|
|
1088
976
|
|
|
1089
977
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
1090
|
-
|
|
1091
978
|
Object.defineProperty(exports, "__esModule", ({
|
|
1092
979
|
value: true
|
|
1093
980
|
}));
|
|
1094
981
|
exports.enableHooks = exports.processHooks = exports.getHooks = exports.isHookObject = exports.convertHookData = exports.makeArguments = exports.defaultMakeArguments = exports.createHookObject = exports.ACTIVATE_HOOKS = void 0;
|
|
1095
|
-
|
|
1096
982
|
var utils_1 = __webpack_require__(/*! ./utils */ "../commons/lib/utils.js");
|
|
1097
|
-
|
|
1098
983
|
var _utils_1$_ = utils_1._,
|
|
1099
|
-
|
|
1100
|
-
|
|
984
|
+
each = _utils_1$_.each,
|
|
985
|
+
pick = _utils_1$_.pick;
|
|
1101
986
|
exports.ACTIVATE_HOOKS = (0, utils_1.createSymbol)('__feathersActivateHooks');
|
|
1102
|
-
|
|
1103
987
|
function createHookObject(method) {
|
|
1104
988
|
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1105
989
|
var hook = {};
|
|
@@ -1110,70 +994,55 @@ function createHookObject(method) {
|
|
|
1110
994
|
});
|
|
1111
995
|
return Object.assign(hook, data, {
|
|
1112
996
|
method: method,
|
|
1113
|
-
|
|
1114
997
|
// A dynamic getter that returns the path of the service
|
|
1115
998
|
get path() {
|
|
1116
999
|
var app = data.app,
|
|
1117
|
-
|
|
1118
|
-
|
|
1000
|
+
service = data.service;
|
|
1119
1001
|
if (!service || !app || !app.services) {
|
|
1120
1002
|
return null;
|
|
1121
1003
|
}
|
|
1122
|
-
|
|
1123
1004
|
return Object.keys(app.services).find(function (path) {
|
|
1124
1005
|
return app.services[path] === service;
|
|
1125
1006
|
});
|
|
1126
1007
|
}
|
|
1127
|
-
|
|
1128
1008
|
});
|
|
1129
1009
|
}
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1010
|
+
exports.createHookObject = createHookObject;
|
|
1011
|
+
// Fallback used by `makeArguments` which usually won't be used
|
|
1133
1012
|
function defaultMakeArguments(hook) {
|
|
1134
1013
|
var result = [];
|
|
1135
|
-
|
|
1136
1014
|
if (typeof hook.id !== 'undefined') {
|
|
1137
1015
|
result.push(hook.id);
|
|
1138
1016
|
}
|
|
1139
|
-
|
|
1140
1017
|
if (hook.data) {
|
|
1141
1018
|
result.push(hook.data);
|
|
1142
1019
|
}
|
|
1143
|
-
|
|
1144
1020
|
result.push(hook.params || {});
|
|
1145
1021
|
return result;
|
|
1146
1022
|
}
|
|
1147
|
-
|
|
1148
|
-
|
|
1023
|
+
exports.defaultMakeArguments = defaultMakeArguments;
|
|
1024
|
+
// Turns a hook object back into a list of arguments
|
|
1149
1025
|
// to call a service method with
|
|
1150
|
-
|
|
1151
1026
|
function makeArguments(hook) {
|
|
1152
1027
|
switch (hook.method) {
|
|
1153
1028
|
case 'find':
|
|
1154
1029
|
return [hook.params];
|
|
1155
|
-
|
|
1156
1030
|
case 'get':
|
|
1157
1031
|
case 'remove':
|
|
1158
1032
|
return [hook.id, hook.params];
|
|
1159
|
-
|
|
1160
1033
|
case 'update':
|
|
1161
1034
|
case 'patch':
|
|
1162
1035
|
return [hook.id, hook.data, hook.params];
|
|
1163
|
-
|
|
1164
1036
|
case 'create':
|
|
1165
1037
|
return [hook.data, hook.params];
|
|
1166
1038
|
}
|
|
1167
|
-
|
|
1168
1039
|
return defaultMakeArguments(hook);
|
|
1169
1040
|
}
|
|
1170
|
-
|
|
1171
|
-
|
|
1041
|
+
exports.makeArguments = makeArguments;
|
|
1042
|
+
// Converts different hook registration formats into the
|
|
1172
1043
|
// same internal format
|
|
1173
|
-
|
|
1174
1044
|
function convertHookData(obj) {
|
|
1175
1045
|
var hook = {};
|
|
1176
|
-
|
|
1177
1046
|
if (Array.isArray(obj)) {
|
|
1178
1047
|
hook = {
|
|
1179
1048
|
all: obj
|
|
@@ -1187,41 +1056,32 @@ function convertHookData(obj) {
|
|
|
1187
1056
|
hook[key] = !Array.isArray(value) ? [value] : value;
|
|
1188
1057
|
});
|
|
1189
1058
|
}
|
|
1190
|
-
|
|
1191
1059
|
return hook;
|
|
1192
1060
|
}
|
|
1193
|
-
|
|
1194
|
-
|
|
1061
|
+
exports.convertHookData = convertHookData;
|
|
1062
|
+
// Duck-checks a given object to be a hook object
|
|
1195
1063
|
// A valid hook object has `type` and `method`
|
|
1196
|
-
|
|
1197
1064
|
function isHookObject(hookObject) {
|
|
1198
1065
|
return _typeof(hookObject) === 'object' && typeof hookObject.method === 'string' && typeof hookObject.type === 'string';
|
|
1199
1066
|
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1067
|
+
exports.isHookObject = isHookObject;
|
|
1068
|
+
// Returns all service and application hooks combined
|
|
1202
1069
|
// for a given method and type `appLast` sets if the hooks
|
|
1203
1070
|
// from `app` should be added last (or first by default)
|
|
1204
|
-
|
|
1205
1071
|
function getHooks(app, service, type, method) {
|
|
1206
1072
|
var appLast = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
1207
1073
|
var appHooks = app.__hooks[type][method] || [];
|
|
1208
1074
|
var serviceHooks = service.__hooks[type][method] || [];
|
|
1209
|
-
|
|
1210
1075
|
if (appLast) {
|
|
1211
1076
|
// Run hooks in the order of service -> app -> finally
|
|
1212
1077
|
return serviceHooks.concat(appHooks);
|
|
1213
1078
|
}
|
|
1214
|
-
|
|
1215
1079
|
return appHooks.concat(serviceHooks);
|
|
1216
1080
|
}
|
|
1217
|
-
|
|
1218
1081
|
exports.getHooks = getHooks;
|
|
1219
|
-
|
|
1220
1082
|
function processHooks(hooks, initialHookObject) {
|
|
1221
1083
|
var _this = this;
|
|
1222
|
-
|
|
1223
1084
|
var hookObject = initialHookObject;
|
|
1224
|
-
|
|
1225
1085
|
var updateCurrentHook = function updateCurrentHook(current) {
|
|
1226
1086
|
// Either use the returned hook object or the current
|
|
1227
1087
|
// hook object from the chain if the hook returned undefined
|
|
@@ -1229,18 +1089,15 @@ function processHooks(hooks, initialHookObject) {
|
|
|
1229
1089
|
if (!isHookObject(current)) {
|
|
1230
1090
|
throw new Error("".concat(hookObject.type, " hook for '").concat(hookObject.method, "' method returned invalid hook object"));
|
|
1231
1091
|
}
|
|
1232
|
-
|
|
1233
1092
|
hookObject = current;
|
|
1234
1093
|
}
|
|
1235
|
-
|
|
1236
1094
|
return hookObject;
|
|
1237
|
-
};
|
|
1238
|
-
|
|
1239
|
-
|
|
1095
|
+
};
|
|
1096
|
+
// Go through all hooks and chain them into our promise
|
|
1240
1097
|
var promise = hooks.reduce(function (current, fn) {
|
|
1241
1098
|
// @ts-ignore
|
|
1242
|
-
var hook = fn.bind(_this);
|
|
1243
|
-
|
|
1099
|
+
var hook = fn.bind(_this);
|
|
1100
|
+
// Use the returned hook object or the old one
|
|
1244
1101
|
return current.then(function (currentHook) {
|
|
1245
1102
|
return hook(currentHook);
|
|
1246
1103
|
}).then(updateCurrentHook);
|
|
@@ -1253,20 +1110,18 @@ function processHooks(hooks, initialHookObject) {
|
|
|
1253
1110
|
throw error;
|
|
1254
1111
|
});
|
|
1255
1112
|
}
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1113
|
+
exports.processHooks = processHooks;
|
|
1114
|
+
// Add `.hooks` functionality to an object
|
|
1259
1115
|
function enableHooks(obj, methods, types) {
|
|
1260
1116
|
if (typeof obj.hooks === 'function') {
|
|
1261
1117
|
return obj;
|
|
1262
1118
|
}
|
|
1263
|
-
|
|
1264
1119
|
var hookData = {};
|
|
1265
1120
|
types.forEach(function (type) {
|
|
1266
1121
|
// Initialize properties where hook functions are stored
|
|
1267
1122
|
hookData[type] = {};
|
|
1268
|
-
});
|
|
1269
|
-
|
|
1123
|
+
});
|
|
1124
|
+
// Add non-enumerable `__hooks` property to the object
|
|
1270
1125
|
Object.defineProperty(obj, '__hooks', {
|
|
1271
1126
|
configurable: true,
|
|
1272
1127
|
value: hookData,
|
|
@@ -1275,13 +1130,11 @@ function enableHooks(obj, methods, types) {
|
|
|
1275
1130
|
return Object.assign(obj, {
|
|
1276
1131
|
hooks: function hooks(allHooks) {
|
|
1277
1132
|
var _this2 = this;
|
|
1278
|
-
|
|
1279
1133
|
each(allHooks, function (current, type) {
|
|
1280
1134
|
// @ts-ignore
|
|
1281
1135
|
if (!_this2.__hooks[type]) {
|
|
1282
1136
|
throw new Error("'".concat(type, "' is not a valid hook type"));
|
|
1283
1137
|
}
|
|
1284
|
-
|
|
1285
1138
|
var hooks = convertHookData(current);
|
|
1286
1139
|
each(hooks, function (_value, method) {
|
|
1287
1140
|
if (method !== 'all' && methods.indexOf(method) === -1) {
|
|
@@ -1291,11 +1144,9 @@ function enableHooks(obj, methods, types) {
|
|
|
1291
1144
|
methods.forEach(function (method) {
|
|
1292
1145
|
// @ts-ignore
|
|
1293
1146
|
var myHooks = _this2.__hooks[type][method] || (_this2.__hooks[type][method] = []);
|
|
1294
|
-
|
|
1295
1147
|
if (hooks.all) {
|
|
1296
1148
|
myHooks.push.apply(myHooks, hooks.all);
|
|
1297
1149
|
}
|
|
1298
|
-
|
|
1299
1150
|
if (hooks[method]) {
|
|
1300
1151
|
myHooks.push.apply(myHooks, hooks[method]);
|
|
1301
1152
|
}
|
|
@@ -1305,7 +1156,6 @@ function enableHooks(obj, methods, types) {
|
|
|
1305
1156
|
}
|
|
1306
1157
|
});
|
|
1307
1158
|
}
|
|
1308
|
-
|
|
1309
1159
|
exports.enableHooks = enableHooks;
|
|
1310
1160
|
|
|
1311
1161
|
/***/ }),
|
|
@@ -1322,7 +1172,6 @@ exports.enableHooks = enableHooks;
|
|
|
1322
1172
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
1323
1173
|
if (k2 === undefined) k2 = k;
|
|
1324
1174
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1325
|
-
|
|
1326
1175
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1327
1176
|
desc = {
|
|
1328
1177
|
enumerable: true,
|
|
@@ -1331,13 +1180,11 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
|
|
|
1331
1180
|
}
|
|
1332
1181
|
};
|
|
1333
1182
|
}
|
|
1334
|
-
|
|
1335
1183
|
Object.defineProperty(o, k2, desc);
|
|
1336
1184
|
} : function (o, m, k, k2) {
|
|
1337
1185
|
if (k2 === undefined) k2 = k;
|
|
1338
1186
|
o[k2] = m[k];
|
|
1339
1187
|
});
|
|
1340
|
-
|
|
1341
1188
|
var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
|
1342
1189
|
Object.defineProperty(o, "default", {
|
|
1343
1190
|
enumerable: true,
|
|
@@ -1346,34 +1193,22 @@ var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? fun
|
|
|
1346
1193
|
} : function (o, v) {
|
|
1347
1194
|
o["default"] = v;
|
|
1348
1195
|
});
|
|
1349
|
-
|
|
1350
1196
|
var __importStar = this && this.__importStar || function (mod) {
|
|
1351
1197
|
if (mod && mod.__esModule) return mod;
|
|
1352
1198
|
var result = {};
|
|
1353
|
-
if (mod != null) for (var k in mod)
|
|
1354
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1199
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
1357
1200
|
__setModuleDefault(result, mod);
|
|
1358
|
-
|
|
1359
1201
|
return result;
|
|
1360
1202
|
};
|
|
1361
|
-
|
|
1362
1203
|
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
1363
|
-
for (var p in m)
|
|
1364
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1365
|
-
}
|
|
1204
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1366
1205
|
};
|
|
1367
|
-
|
|
1368
1206
|
Object.defineProperty(exports, "__esModule", ({
|
|
1369
1207
|
value: true
|
|
1370
1208
|
}));
|
|
1371
1209
|
exports.hooks = void 0;
|
|
1372
|
-
|
|
1373
1210
|
var hookUtils = __importStar(__webpack_require__(/*! ./hooks */ "../commons/lib/hooks.js"));
|
|
1374
|
-
|
|
1375
1211
|
__exportStar(__webpack_require__(/*! ./utils */ "../commons/lib/utils.js"), exports);
|
|
1376
|
-
|
|
1377
1212
|
exports.hooks = hookUtils;
|
|
1378
1213
|
|
|
1379
1214
|
/***/ }),
|
|
@@ -1387,33 +1222,26 @@ exports.hooks = hookUtils;
|
|
|
1387
1222
|
"use strict";
|
|
1388
1223
|
|
|
1389
1224
|
|
|
1390
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1391
|
-
|
|
1225
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1226
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
1227
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1392
1228
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
1393
|
-
|
|
1394
1229
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
1395
|
-
|
|
1396
1230
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1397
|
-
|
|
1398
1231
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
1399
|
-
|
|
1400
|
-
function
|
|
1401
|
-
|
|
1402
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
1403
|
-
|
|
1232
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
1233
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
1404
1234
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1405
|
-
|
|
1406
1235
|
Object.defineProperty(exports, "__esModule", ({
|
|
1407
1236
|
value: true
|
|
1408
1237
|
}));
|
|
1409
|
-
exports.createSymbol = exports.makeUrl = exports.isPromise = exports._ = exports.stripSlashes = void 0;
|
|
1410
|
-
|
|
1238
|
+
exports.createSymbol = exports.makeUrl = exports.isPromise = exports._ = exports.stripSlashes = void 0;
|
|
1239
|
+
// Removes all leading and trailing slashes from a path
|
|
1411
1240
|
function stripSlashes(name) {
|
|
1412
1241
|
return name.replace(/^(\/+)|(\/+)$/g, '');
|
|
1413
1242
|
}
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1243
|
+
exports.stripSlashes = stripSlashes;
|
|
1244
|
+
// A set of lodash-y utility functions that use ES6
|
|
1417
1245
|
exports._ = {
|
|
1418
1246
|
each: function each(obj, callback) {
|
|
1419
1247
|
if (obj && typeof obj.forEach === 'function') {
|
|
@@ -1429,9 +1257,8 @@ exports._ = {
|
|
|
1429
1257
|
return [value[key], key];
|
|
1430
1258
|
}).some(function (_ref) {
|
|
1431
1259
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1260
|
+
val = _ref2[0],
|
|
1261
|
+
key = _ref2[1];
|
|
1435
1262
|
return callback(val, key);
|
|
1436
1263
|
});
|
|
1437
1264
|
},
|
|
@@ -1440,9 +1267,8 @@ exports._ = {
|
|
|
1440
1267
|
return [value[key], key];
|
|
1441
1268
|
}).every(function (_ref3) {
|
|
1442
1269
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1270
|
+
val = _ref4[0],
|
|
1271
|
+
key = _ref4[1];
|
|
1446
1272
|
return callback(val, key);
|
|
1447
1273
|
});
|
|
1448
1274
|
},
|
|
@@ -1472,16 +1298,13 @@ exports._ = {
|
|
|
1472
1298
|
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1473
1299
|
rest[_key - 1] = arguments[_key];
|
|
1474
1300
|
}
|
|
1475
|
-
|
|
1476
1301
|
return Object.assign.apply(Object, [first].concat(rest));
|
|
1477
1302
|
},
|
|
1478
1303
|
omit: function omit(obj) {
|
|
1479
1304
|
var result = exports._.extend({}, obj);
|
|
1480
|
-
|
|
1481
1305
|
for (var _len2 = arguments.length, keys = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
1482
1306
|
keys[_key2 - 1] = arguments[_key2];
|
|
1483
1307
|
}
|
|
1484
|
-
|
|
1485
1308
|
keys.forEach(function (key) {
|
|
1486
1309
|
return delete result[key];
|
|
1487
1310
|
});
|
|
@@ -1491,12 +1314,10 @@ exports._ = {
|
|
|
1491
1314
|
for (var _len3 = arguments.length, keys = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
1492
1315
|
keys[_key3 - 1] = arguments[_key3];
|
|
1493
1316
|
}
|
|
1494
|
-
|
|
1495
1317
|
return keys.reduce(function (result, key) {
|
|
1496
1318
|
if (source[key] !== undefined) {
|
|
1497
1319
|
result[key] = source[key];
|
|
1498
1320
|
}
|
|
1499
|
-
|
|
1500
1321
|
return result;
|
|
1501
1322
|
}, {});
|
|
1502
1323
|
},
|
|
@@ -1508,24 +1329,20 @@ exports._ = {
|
|
|
1508
1329
|
if (!target[key]) {
|
|
1509
1330
|
Object.assign(target, _defineProperty({}, key, {}));
|
|
1510
1331
|
}
|
|
1511
|
-
|
|
1512
1332
|
exports._.merge(target[key], source[key]);
|
|
1513
1333
|
} else {
|
|
1514
1334
|
Object.assign(target, _defineProperty({}, key, source[key]));
|
|
1515
1335
|
}
|
|
1516
1336
|
});
|
|
1517
1337
|
}
|
|
1518
|
-
|
|
1519
1338
|
return target;
|
|
1520
1339
|
}
|
|
1521
|
-
};
|
|
1522
|
-
|
|
1340
|
+
};
|
|
1341
|
+
// Duck-checks if an object looks like a promise
|
|
1523
1342
|
function isPromise(result) {
|
|
1524
1343
|
return exports._.isObject(result) && typeof result.then === 'function';
|
|
1525
1344
|
}
|
|
1526
|
-
|
|
1527
1345
|
exports.isPromise = isPromise;
|
|
1528
|
-
|
|
1529
1346
|
function makeUrl(path) {
|
|
1530
1347
|
var app = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1531
1348
|
var get = typeof app.get === 'function' ? app.get.bind(app) : function () {};
|
|
@@ -1537,13 +1354,10 @@ function makeUrl(path) {
|
|
|
1537
1354
|
path = path || '';
|
|
1538
1355
|
return "".concat(protocol, "://").concat(host).concat(port, "/").concat(exports.stripSlashes(path));
|
|
1539
1356
|
}
|
|
1540
|
-
|
|
1541
1357
|
exports.makeUrl = makeUrl;
|
|
1542
|
-
|
|
1543
1358
|
function createSymbol(name) {
|
|
1544
1359
|
return typeof Symbol !== 'undefined' ? Symbol(name) : name;
|
|
1545
1360
|
}
|
|
1546
|
-
|
|
1547
1361
|
exports.createSymbol = createSymbol;
|
|
1548
1362
|
|
|
1549
1363
|
/***/ }),
|
|
@@ -1555,18 +1369,16 @@ exports.createSymbol = createSymbol;
|
|
|
1555
1369
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
1556
1370
|
|
|
1557
1371
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
1558
|
-
|
|
1559
1372
|
var debug = __webpack_require__(/*! debug */ "../../node_modules/debug/src/browser.js")('@feathersjs/errors');
|
|
1560
|
-
|
|
1561
1373
|
function FeathersError(msg, name, code, className, data) {
|
|
1562
1374
|
msg = msg || 'Error';
|
|
1563
1375
|
var errors;
|
|
1564
1376
|
var message;
|
|
1565
1377
|
var newData;
|
|
1566
|
-
|
|
1567
1378
|
if (msg instanceof Error) {
|
|
1568
|
-
message = msg.message || 'Error';
|
|
1379
|
+
message = msg.message || 'Error';
|
|
1569
1380
|
|
|
1381
|
+
// NOTE (EK): This is typically to handle validation errors
|
|
1570
1382
|
if (msg.errors) {
|
|
1571
1383
|
errors = msg.errors;
|
|
1572
1384
|
}
|
|
@@ -1578,13 +1390,11 @@ function FeathersError(msg, name, code, className, data) {
|
|
|
1578
1390
|
// message is just a string
|
|
1579
1391
|
message = msg;
|
|
1580
1392
|
}
|
|
1581
|
-
|
|
1582
1393
|
if (data) {
|
|
1583
1394
|
// NOTE(EK): To make sure that we are not messing
|
|
1584
1395
|
// with immutable data, just make a copy.
|
|
1585
1396
|
// https://github.com/feathersjs/errors/issues/19
|
|
1586
1397
|
newData = JSON.parse(JSON.stringify(data));
|
|
1587
|
-
|
|
1588
1398
|
if (newData.errors) {
|
|
1589
1399
|
errors = newData.errors;
|
|
1590
1400
|
delete newData.errors;
|
|
@@ -1594,11 +1404,11 @@ function FeathersError(msg, name, code, className, data) {
|
|
|
1594
1404
|
// For example: when cloning arrays this property
|
|
1595
1405
|
errors = JSON.parse(JSON.stringify(data.errors));
|
|
1596
1406
|
}
|
|
1597
|
-
}
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
// NOTE (EK): Babel doesn't support this so
|
|
1598
1410
|
// we have to pass in the class name manually.
|
|
1599
1411
|
// this.name = this.constructor.name;
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
1412
|
this.type = 'FeathersError';
|
|
1603
1413
|
this.name = name;
|
|
1604
1414
|
this.message = message;
|
|
@@ -1608,22 +1418,20 @@ function FeathersError(msg, name, code, className, data) {
|
|
|
1608
1418
|
this.errors = errors || {};
|
|
1609
1419
|
debug("".concat(this.name, "(").concat(this.code, "): ").concat(this.message));
|
|
1610
1420
|
debug(this.errors);
|
|
1611
|
-
|
|
1612
1421
|
if (Error.captureStackTrace) {
|
|
1613
1422
|
Error.captureStackTrace(this, FeathersError);
|
|
1614
1423
|
} else {
|
|
1615
1424
|
this.stack = new Error().stack;
|
|
1616
1425
|
}
|
|
1617
1426
|
}
|
|
1618
|
-
|
|
1619
1427
|
function inheritsFrom(Child, Parent) {
|
|
1620
1428
|
Child.prototype = Object.create(Parent.prototype);
|
|
1621
1429
|
Child.prototype.constructor = Child;
|
|
1622
1430
|
}
|
|
1431
|
+
inheritsFrom(FeathersError, Error);
|
|
1623
1432
|
|
|
1624
|
-
|
|
1433
|
+
// NOTE (EK): A little hack to get around `message` not
|
|
1625
1434
|
// being included in the default toJSON call.
|
|
1626
|
-
|
|
1627
1435
|
Object.defineProperty(FeathersError.prototype, 'toJSON', {
|
|
1628
1436
|
value: function value() {
|
|
1629
1437
|
return {
|
|
@@ -1635,108 +1443,108 @@ Object.defineProperty(FeathersError.prototype, 'toJSON', {
|
|
|
1635
1443
|
errors: this.errors
|
|
1636
1444
|
};
|
|
1637
1445
|
}
|
|
1638
|
-
});
|
|
1446
|
+
});
|
|
1639
1447
|
|
|
1448
|
+
// 400 - Bad Request
|
|
1640
1449
|
function BadRequest(message, data) {
|
|
1641
1450
|
FeathersError.call(this, message, 'BadRequest', 400, 'bad-request', data);
|
|
1642
1451
|
}
|
|
1452
|
+
inheritsFrom(BadRequest, FeathersError);
|
|
1643
1453
|
|
|
1644
|
-
|
|
1645
|
-
|
|
1454
|
+
// 401 - Not Authenticated
|
|
1646
1455
|
function NotAuthenticated(message, data) {
|
|
1647
1456
|
FeathersError.call(this, message, 'NotAuthenticated', 401, 'not-authenticated', data);
|
|
1648
1457
|
}
|
|
1458
|
+
inheritsFrom(NotAuthenticated, FeathersError);
|
|
1649
1459
|
|
|
1650
|
-
|
|
1651
|
-
|
|
1460
|
+
// 402 - Payment Error
|
|
1652
1461
|
function PaymentError(message, data) {
|
|
1653
1462
|
FeathersError.call(this, message, 'PaymentError', 402, 'payment-error', data);
|
|
1654
1463
|
}
|
|
1464
|
+
inheritsFrom(PaymentError, FeathersError);
|
|
1655
1465
|
|
|
1656
|
-
|
|
1657
|
-
|
|
1466
|
+
// 403 - Forbidden
|
|
1658
1467
|
function Forbidden(message, data) {
|
|
1659
1468
|
FeathersError.call(this, message, 'Forbidden', 403, 'forbidden', data);
|
|
1660
1469
|
}
|
|
1470
|
+
inheritsFrom(Forbidden, FeathersError);
|
|
1661
1471
|
|
|
1662
|
-
|
|
1663
|
-
|
|
1472
|
+
// 404 - Not Found
|
|
1664
1473
|
function NotFound(message, data) {
|
|
1665
1474
|
FeathersError.call(this, message, 'NotFound', 404, 'not-found', data);
|
|
1666
1475
|
}
|
|
1476
|
+
inheritsFrom(NotFound, FeathersError);
|
|
1667
1477
|
|
|
1668
|
-
|
|
1669
|
-
|
|
1478
|
+
// 405 - Method Not Allowed
|
|
1670
1479
|
function MethodNotAllowed(message, data) {
|
|
1671
1480
|
FeathersError.call(this, message, 'MethodNotAllowed', 405, 'method-not-allowed', data);
|
|
1672
1481
|
}
|
|
1482
|
+
inheritsFrom(MethodNotAllowed, FeathersError);
|
|
1673
1483
|
|
|
1674
|
-
|
|
1675
|
-
|
|
1484
|
+
// 406 - Not Acceptable
|
|
1676
1485
|
function NotAcceptable(message, data) {
|
|
1677
1486
|
FeathersError.call(this, message, 'NotAcceptable', 406, 'not-acceptable', data);
|
|
1678
1487
|
}
|
|
1488
|
+
inheritsFrom(NotAcceptable, FeathersError);
|
|
1679
1489
|
|
|
1680
|
-
|
|
1681
|
-
|
|
1490
|
+
// 408 - Timeout
|
|
1682
1491
|
function Timeout(message, data) {
|
|
1683
1492
|
FeathersError.call(this, message, 'Timeout', 408, 'timeout', data);
|
|
1684
1493
|
}
|
|
1494
|
+
inheritsFrom(Timeout, FeathersError);
|
|
1685
1495
|
|
|
1686
|
-
|
|
1687
|
-
|
|
1496
|
+
// 409 - Conflict
|
|
1688
1497
|
function Conflict(message, data) {
|
|
1689
1498
|
FeathersError.call(this, message, 'Conflict', 409, 'conflict', data);
|
|
1690
1499
|
}
|
|
1500
|
+
inheritsFrom(Conflict, FeathersError);
|
|
1691
1501
|
|
|
1692
|
-
|
|
1693
|
-
|
|
1502
|
+
// 410 - Gone
|
|
1694
1503
|
function Gone(message, data) {
|
|
1695
1504
|
FeathersError(this, message, 'Gone', 410, 'gone', data);
|
|
1696
1505
|
}
|
|
1506
|
+
inheritsFrom(Gone, FeathersError);
|
|
1697
1507
|
|
|
1698
|
-
|
|
1699
|
-
|
|
1508
|
+
// 411 - Length Required
|
|
1700
1509
|
function LengthRequired(message, data) {
|
|
1701
1510
|
FeathersError.call(this, message, 'LengthRequired', 411, 'length-required', data);
|
|
1702
1511
|
}
|
|
1512
|
+
inheritsFrom(LengthRequired, FeathersError);
|
|
1703
1513
|
|
|
1704
|
-
|
|
1705
|
-
|
|
1514
|
+
// 422 Unprocessable
|
|
1706
1515
|
function Unprocessable(message, data) {
|
|
1707
1516
|
FeathersError.call(this, message, 'Unprocessable', 422, 'unprocessable', data);
|
|
1708
1517
|
}
|
|
1518
|
+
inheritsFrom(Unprocessable, FeathersError);
|
|
1709
1519
|
|
|
1710
|
-
|
|
1711
|
-
|
|
1520
|
+
// 429 Too Many Requests
|
|
1712
1521
|
function TooManyRequests(message, data) {
|
|
1713
1522
|
FeathersError.call(this, message, 'TooManyRequests', 429, 'too-many-requests', data);
|
|
1714
1523
|
}
|
|
1524
|
+
inheritsFrom(TooManyRequests, FeathersError);
|
|
1715
1525
|
|
|
1716
|
-
|
|
1717
|
-
|
|
1526
|
+
// 500 - General Error
|
|
1718
1527
|
function GeneralError(message, data) {
|
|
1719
1528
|
FeathersError.call(this, message, 'GeneralError', 500, 'general-error', data);
|
|
1720
1529
|
}
|
|
1530
|
+
inheritsFrom(GeneralError, FeathersError);
|
|
1721
1531
|
|
|
1722
|
-
|
|
1723
|
-
|
|
1532
|
+
// 501 - Not Implemented
|
|
1724
1533
|
function NotImplemented(message, data) {
|
|
1725
1534
|
FeathersError.call(this, message, 'NotImplemented', 501, 'not-implemented', data);
|
|
1726
1535
|
}
|
|
1536
|
+
inheritsFrom(NotImplemented, FeathersError);
|
|
1727
1537
|
|
|
1728
|
-
|
|
1729
|
-
|
|
1538
|
+
// 502 - Bad Gateway
|
|
1730
1539
|
function BadGateway(message, data) {
|
|
1731
1540
|
FeathersError.call(this, message, 'BadGateway', 502, 'bad-gateway', data);
|
|
1732
1541
|
}
|
|
1542
|
+
inheritsFrom(BadGateway, FeathersError);
|
|
1733
1543
|
|
|
1734
|
-
|
|
1735
|
-
|
|
1544
|
+
// 503 - Unavailable
|
|
1736
1545
|
function Unavailable(message, data) {
|
|
1737
1546
|
FeathersError.call(this, message, 'Unavailable', 503, 'unavailable', data);
|
|
1738
1547
|
}
|
|
1739
|
-
|
|
1740
1548
|
inheritsFrom(Unavailable, FeathersError);
|
|
1741
1549
|
var errors = {
|
|
1742
1550
|
FeathersError: FeathersError,
|
|
@@ -1775,22 +1583,17 @@ var errors = {
|
|
|
1775
1583
|
502: BadGateway,
|
|
1776
1584
|
503: Unavailable
|
|
1777
1585
|
};
|
|
1778
|
-
|
|
1779
1586
|
function convert(error) {
|
|
1780
1587
|
if (!error) {
|
|
1781
1588
|
return error;
|
|
1782
1589
|
}
|
|
1783
|
-
|
|
1784
1590
|
var FeathersError = errors[error.name];
|
|
1785
1591
|
var result = FeathersError ? new FeathersError(error.message, error.data) : new Error(error.message || error);
|
|
1786
|
-
|
|
1787
1592
|
if (_typeof(error) === 'object') {
|
|
1788
1593
|
Object.assign(result, error);
|
|
1789
1594
|
}
|
|
1790
|
-
|
|
1791
1595
|
return result;
|
|
1792
1596
|
}
|
|
1793
|
-
|
|
1794
1597
|
module.exports = Object.assign({
|
|
1795
1598
|
convert: convert
|
|
1796
1599
|
}, errors);
|