@feathersjs/client 4.5.15 → 4.5.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/primus.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
- } // Internet Explorer and Edge do not support colors.
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
- } // Is webkit? http://stackoverflow.com/a/16459606/376773
67
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
68
-
67
+ }
69
68
 
70
- return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
71
- typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
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 || // Double check webkit in userAgent just in case we are in a worker
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'); // The final "%c" is somewhat tricky, because there could be other
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) {// Swallow
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) {// Swallow
153
+ } catch (error) {
154
+ // Swallow
156
155
  // XXX (@Qix-) should we be logging these?
157
- } // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
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) {// Swallow
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
- var self = debug; // Set `diff` timestamp
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
- } // Apply any `formatters` transformations
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); // Now we need to remove `args[index]` since it's inlined in the `format`
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
- }); // Apply env-specific formatting (colors, etc.)
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
- }); // Env-specific initialization logic for debug instances
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
  /***/ }),
@@ -513,18 +482,16 @@ module.exports = __webpack_require__(/*! @feathersjs/primus-client */ "../primus
513
482
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
514
483
 
515
484
  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); }
516
-
517
485
  var debug = __webpack_require__(/*! debug */ "../../node_modules/debug/src/browser.js")('@feathersjs/errors');
518
-
519
486
  function FeathersError(msg, name, code, className, data) {
520
487
  msg = msg || 'Error';
521
488
  var errors;
522
489
  var message;
523
490
  var newData;
524
-
525
491
  if (msg instanceof Error) {
526
- message = msg.message || 'Error'; // NOTE (EK): This is typically to handle validation errors
492
+ message = msg.message || 'Error';
527
493
 
494
+ // NOTE (EK): This is typically to handle validation errors
528
495
  if (msg.errors) {
529
496
  errors = msg.errors;
530
497
  }
@@ -536,13 +503,11 @@ function FeathersError(msg, name, code, className, data) {
536
503
  // message is just a string
537
504
  message = msg;
538
505
  }
539
-
540
506
  if (data) {
541
507
  // NOTE(EK): To make sure that we are not messing
542
508
  // with immutable data, just make a copy.
543
509
  // https://github.com/feathersjs/errors/issues/19
544
510
  newData = JSON.parse(JSON.stringify(data));
545
-
546
511
  if (newData.errors) {
547
512
  errors = newData.errors;
548
513
  delete newData.errors;
@@ -552,11 +517,11 @@ function FeathersError(msg, name, code, className, data) {
552
517
  // For example: when cloning arrays this property
553
518
  errors = JSON.parse(JSON.stringify(data.errors));
554
519
  }
555
- } // NOTE (EK): Babel doesn't support this so
520
+ }
521
+
522
+ // NOTE (EK): Babel doesn't support this so
556
523
  // we have to pass in the class name manually.
557
524
  // this.name = this.constructor.name;
558
-
559
-
560
525
  this.type = 'FeathersError';
561
526
  this.name = name;
562
527
  this.message = message;
@@ -566,22 +531,20 @@ function FeathersError(msg, name, code, className, data) {
566
531
  this.errors = errors || {};
567
532
  debug("".concat(this.name, "(").concat(this.code, "): ").concat(this.message));
568
533
  debug(this.errors);
569
-
570
534
  if (Error.captureStackTrace) {
571
535
  Error.captureStackTrace(this, FeathersError);
572
536
  } else {
573
537
  this.stack = new Error().stack;
574
538
  }
575
539
  }
576
-
577
540
  function inheritsFrom(Child, Parent) {
578
541
  Child.prototype = Object.create(Parent.prototype);
579
542
  Child.prototype.constructor = Child;
580
543
  }
544
+ inheritsFrom(FeathersError, Error);
581
545
 
582
- inheritsFrom(FeathersError, Error); // NOTE (EK): A little hack to get around `message` not
546
+ // NOTE (EK): A little hack to get around `message` not
583
547
  // being included in the default toJSON call.
584
-
585
548
  Object.defineProperty(FeathersError.prototype, 'toJSON', {
586
549
  value: function value() {
587
550
  return {
@@ -593,108 +556,108 @@ Object.defineProperty(FeathersError.prototype, 'toJSON', {
593
556
  errors: this.errors
594
557
  };
595
558
  }
596
- }); // 400 - Bad Request
559
+ });
597
560
 
561
+ // 400 - Bad Request
598
562
  function BadRequest(message, data) {
599
563
  FeathersError.call(this, message, 'BadRequest', 400, 'bad-request', data);
600
564
  }
565
+ inheritsFrom(BadRequest, FeathersError);
601
566
 
602
- inheritsFrom(BadRequest, FeathersError); // 401 - Not Authenticated
603
-
567
+ // 401 - Not Authenticated
604
568
  function NotAuthenticated(message, data) {
605
569
  FeathersError.call(this, message, 'NotAuthenticated', 401, 'not-authenticated', data);
606
570
  }
571
+ inheritsFrom(NotAuthenticated, FeathersError);
607
572
 
608
- inheritsFrom(NotAuthenticated, FeathersError); // 402 - Payment Error
609
-
573
+ // 402 - Payment Error
610
574
  function PaymentError(message, data) {
611
575
  FeathersError.call(this, message, 'PaymentError', 402, 'payment-error', data);
612
576
  }
577
+ inheritsFrom(PaymentError, FeathersError);
613
578
 
614
- inheritsFrom(PaymentError, FeathersError); // 403 - Forbidden
615
-
579
+ // 403 - Forbidden
616
580
  function Forbidden(message, data) {
617
581
  FeathersError.call(this, message, 'Forbidden', 403, 'forbidden', data);
618
582
  }
583
+ inheritsFrom(Forbidden, FeathersError);
619
584
 
620
- inheritsFrom(Forbidden, FeathersError); // 404 - Not Found
621
-
585
+ // 404 - Not Found
622
586
  function NotFound(message, data) {
623
587
  FeathersError.call(this, message, 'NotFound', 404, 'not-found', data);
624
588
  }
589
+ inheritsFrom(NotFound, FeathersError);
625
590
 
626
- inheritsFrom(NotFound, FeathersError); // 405 - Method Not Allowed
627
-
591
+ // 405 - Method Not Allowed
628
592
  function MethodNotAllowed(message, data) {
629
593
  FeathersError.call(this, message, 'MethodNotAllowed', 405, 'method-not-allowed', data);
630
594
  }
595
+ inheritsFrom(MethodNotAllowed, FeathersError);
631
596
 
632
- inheritsFrom(MethodNotAllowed, FeathersError); // 406 - Not Acceptable
633
-
597
+ // 406 - Not Acceptable
634
598
  function NotAcceptable(message, data) {
635
599
  FeathersError.call(this, message, 'NotAcceptable', 406, 'not-acceptable', data);
636
600
  }
601
+ inheritsFrom(NotAcceptable, FeathersError);
637
602
 
638
- inheritsFrom(NotAcceptable, FeathersError); // 408 - Timeout
639
-
603
+ // 408 - Timeout
640
604
  function Timeout(message, data) {
641
605
  FeathersError.call(this, message, 'Timeout', 408, 'timeout', data);
642
606
  }
607
+ inheritsFrom(Timeout, FeathersError);
643
608
 
644
- inheritsFrom(Timeout, FeathersError); // 409 - Conflict
645
-
609
+ // 409 - Conflict
646
610
  function Conflict(message, data) {
647
611
  FeathersError.call(this, message, 'Conflict', 409, 'conflict', data);
648
612
  }
613
+ inheritsFrom(Conflict, FeathersError);
649
614
 
650
- inheritsFrom(Conflict, FeathersError); // 410 - Gone
651
-
615
+ // 410 - Gone
652
616
  function Gone(message, data) {
653
617
  FeathersError(this, message, 'Gone', 410, 'gone', data);
654
618
  }
619
+ inheritsFrom(Gone, FeathersError);
655
620
 
656
- inheritsFrom(Gone, FeathersError); // 411 - Length Required
657
-
621
+ // 411 - Length Required
658
622
  function LengthRequired(message, data) {
659
623
  FeathersError.call(this, message, 'LengthRequired', 411, 'length-required', data);
660
624
  }
625
+ inheritsFrom(LengthRequired, FeathersError);
661
626
 
662
- inheritsFrom(LengthRequired, FeathersError); // 422 Unprocessable
663
-
627
+ // 422 Unprocessable
664
628
  function Unprocessable(message, data) {
665
629
  FeathersError.call(this, message, 'Unprocessable', 422, 'unprocessable', data);
666
630
  }
631
+ inheritsFrom(Unprocessable, FeathersError);
667
632
 
668
- inheritsFrom(Unprocessable, FeathersError); // 429 Too Many Requests
669
-
633
+ // 429 Too Many Requests
670
634
  function TooManyRequests(message, data) {
671
635
  FeathersError.call(this, message, 'TooManyRequests', 429, 'too-many-requests', data);
672
636
  }
637
+ inheritsFrom(TooManyRequests, FeathersError);
673
638
 
674
- inheritsFrom(TooManyRequests, FeathersError); // 500 - General Error
675
-
639
+ // 500 - General Error
676
640
  function GeneralError(message, data) {
677
641
  FeathersError.call(this, message, 'GeneralError', 500, 'general-error', data);
678
642
  }
643
+ inheritsFrom(GeneralError, FeathersError);
679
644
 
680
- inheritsFrom(GeneralError, FeathersError); // 501 - Not Implemented
681
-
645
+ // 501 - Not Implemented
682
646
  function NotImplemented(message, data) {
683
647
  FeathersError.call(this, message, 'NotImplemented', 501, 'not-implemented', data);
684
648
  }
649
+ inheritsFrom(NotImplemented, FeathersError);
685
650
 
686
- inheritsFrom(NotImplemented, FeathersError); // 502 - Bad Gateway
687
-
651
+ // 502 - Bad Gateway
688
652
  function BadGateway(message, data) {
689
653
  FeathersError.call(this, message, 'BadGateway', 502, 'bad-gateway', data);
690
654
  }
655
+ inheritsFrom(BadGateway, FeathersError);
691
656
 
692
- inheritsFrom(BadGateway, FeathersError); // 503 - Unavailable
693
-
657
+ // 503 - Unavailable
694
658
  function Unavailable(message, data) {
695
659
  FeathersError.call(this, message, 'Unavailable', 503, 'unavailable', data);
696
660
  }
697
-
698
661
  inheritsFrom(Unavailable, FeathersError);
699
662
  var errors = {
700
663
  FeathersError: FeathersError,
@@ -733,22 +696,17 @@ var errors = {
733
696
  502: BadGateway,
734
697
  503: Unavailable
735
698
  };
736
-
737
699
  function convert(error) {
738
700
  if (!error) {
739
701
  return error;
740
702
  }
741
-
742
703
  var FeathersError = errors[error.name];
743
704
  var result = FeathersError ? new FeathersError(error.message, error.data) : new Error(error.message || error);
744
-
745
705
  if (_typeof(error) === 'object') {
746
706
  Object.assign(result, error);
747
707
  }
748
-
749
708
  return result;
750
709
  }
751
-
752
710
  module.exports = Object.assign({
753
711
  convert: convert
754
712
  }, errors);
@@ -762,12 +720,10 @@ module.exports = Object.assign({
762
720
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
763
721
 
764
722
  var Service = __webpack_require__(/*! @feathersjs/transport-commons/client */ "../transport-commons/client.js");
765
-
766
723
  function primusClient(connection, options) {
767
724
  if (!connection) {
768
725
  throw new Error('Primus connection needs to be provided');
769
726
  }
770
-
771
727
  var defaultService = function defaultService(name) {
772
728
  return new Service(Object.assign({}, options, {
773
729
  name: name,
@@ -775,21 +731,17 @@ function primusClient(connection, options) {
775
731
  method: 'send'
776
732
  }));
777
733
  };
778
-
779
734
  var initialize = function initialize(app) {
780
735
  if (typeof app.defaultService === 'function') {
781
736
  throw new Error('Only one default client provider can be configured');
782
737
  }
783
-
784
738
  app.primus = connection;
785
739
  app.defaultService = defaultService;
786
740
  };
787
-
788
741
  initialize.Service = Service;
789
742
  initialize.service = defaultService;
790
743
  return initialize;
791
744
  }
792
-
793
745
  module.exports = primusClient;
794
746
  module.exports["default"] = primusClient;
795
747
 
@@ -814,70 +766,56 @@ module.exports = __webpack_require__(/*! ./lib/client */ "../transport-commons/l
814
766
  "use strict";
815
767
 
816
768
 
769
+ 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); }
817
770
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
818
-
819
- 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); } }
820
-
771
+ 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); } }
821
772
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
822
-
773
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
774
+ 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); }
823
775
  var __importDefault = this && this.__importDefault || function (mod) {
824
776
  return mod && mod.__esModule ? mod : {
825
777
  "default": mod
826
778
  };
827
779
  };
828
-
829
780
  Object.defineProperty(exports, "__esModule", ({
830
781
  value: true
831
782
  }));
832
783
  exports.Service = void 0;
833
-
834
784
  var debug_1 = __importDefault(__webpack_require__(/*! debug */ "../../node_modules/debug/src/browser.js"));
835
-
836
785
  var errors_1 = __webpack_require__(/*! @feathersjs/errors */ "../errors/lib/index.js");
837
-
838
786
  var debug = (0, debug_1.default)('@feathersjs/transport-commons/client');
839
787
  var namespacedEmitterMethods = ['addListener', 'emit', 'listenerCount', 'listeners', 'on', 'once', 'prependListener', 'prependOnceListener', 'removeAllListeners', 'removeListener'];
840
788
  var otherEmitterMethods = ['eventNames', 'getMaxListeners', 'setMaxListeners'];
841
-
842
789
  var addEmitterMethods = function addEmitterMethods(service) {
843
790
  otherEmitterMethods.forEach(function (method) {
844
791
  service[method] = function () {
845
792
  var _this$connection;
846
-
847
793
  if (typeof this.connection[method] !== 'function') {
848
794
  throw new Error("Can not call '".concat(method, "' on the client service connection"));
849
795
  }
850
-
851
796
  return (_this$connection = this.connection)[method].apply(_this$connection, arguments);
852
797
  };
853
- }); // Methods that should add the namespace (service path)
854
-
798
+ });
799
+ // Methods that should add the namespace (service path)
855
800
  namespacedEmitterMethods.forEach(function (method) {
856
801
  service[method] = function (name) {
857
802
  var _this$connection2;
858
-
859
803
  if (typeof this.connection[method] !== 'function') {
860
804
  throw new Error("Can not call '".concat(method, "' on the client service connection"));
861
805
  }
862
-
863
806
  var eventName = "".concat(this.path, " ").concat(name);
864
807
  debug("Calling emitter method ".concat(method, " with ") + "namespaced event '".concat(eventName, "'"));
865
-
866
808
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
867
809
  args[_key - 1] = arguments[_key];
868
810
  }
869
-
870
811
  var result = (_this$connection2 = this.connection)[method].apply(_this$connection2, [eventName].concat(args));
871
-
872
812
  return result === this.connection ? this : result;
873
813
  };
874
814
  });
875
815
  };
876
-
877
816
  var Service = /*#__PURE__*/function () {
878
817
  function Service(options) {
879
818
  _classCallCheck(this, Service);
880
-
881
819
  this.events = options.events;
882
820
  this.path = options.name;
883
821
  this.connection = options.connection;
@@ -885,19 +823,15 @@ var Service = /*#__PURE__*/function () {
885
823
  this.timeout = options.timeout || 5000;
886
824
  addEmitterMethods(this);
887
825
  }
888
-
889
826
  _createClass(Service, [{
890
827
  key: "send",
891
828
  value: function send(method) {
892
829
  var _this = this;
893
-
894
830
  for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
895
831
  args[_key2 - 1] = arguments[_key2];
896
832
  }
897
-
898
833
  return new Promise(function (resolve, reject) {
899
834
  var _this$connection3;
900
-
901
835
  var timeoutId = setTimeout(function () {
902
836
  return reject(new errors_1.Timeout("Timeout of ".concat(_this.timeout, "ms exceeded calling ").concat(method, " on ").concat(_this.path), {
903
837
  timeout: _this.timeout,
@@ -912,7 +846,6 @@ var Service = /*#__PURE__*/function () {
912
846
  return error ? reject(error) : resolve(data);
913
847
  });
914
848
  debug("Sending socket.".concat(_this.method), args);
915
-
916
849
  (_this$connection3 = _this.connection)[_this.method].apply(_this$connection3, args);
917
850
  });
918
851
  }
@@ -951,36 +884,30 @@ var Service = /*#__PURE__*/function () {
951
884
  value: function remove(id) {
952
885
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
953
886
  return this.send('remove', id, params.query || {});
954
- } // `off` is actually not part of the Node event emitter spec
887
+ }
888
+ // `off` is actually not part of the Node event emitter spec
955
889
  // but we are adding it since everybody is expecting it because
956
890
  // of the emitter-component Socket.io is using
957
-
958
891
  }, {
959
892
  key: "off",
960
893
  value: function off(name) {
961
894
  for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
962
895
  args[_key3 - 1] = arguments[_key3];
963
896
  }
964
-
965
897
  if (typeof this.connection.off === 'function') {
966
898
  var _this$connection4;
967
-
968
899
  var result = (_this$connection4 = this.connection).off.apply(_this$connection4, ["".concat(this.path, " ").concat(name)].concat(args));
969
-
970
900
  return result === this.connection ? this : result;
971
901
  } else if (args.length === 0) {
972
902
  // @ts-ignore
973
903
  return this.removeAllListeners(name);
974
- } // @ts-ignore
975
-
976
-
904
+ }
905
+ // @ts-ignore
977
906
  return this.removeListener.apply(this, [name].concat(args));
978
907
  }
979
908
  }]);
980
-
981
909
  return Service;
982
910
  }();
983
-
984
911
  exports.Service = Service;
985
912
 
986
913
  /***/ }),