@cubejs-client/ws-transport 1.0.12 → 1.0.14

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.
@@ -164,19 +164,19 @@
164
164
  return call$2.apply(call$2, arguments);
165
165
  };
166
166
 
167
- var $propertyIsEnumerable = {}.propertyIsEnumerable;
167
+ var $propertyIsEnumerable$1 = {}.propertyIsEnumerable;
168
168
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
169
169
  var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor;
170
170
 
171
171
  // Nashorn ~ JDK8 bug
172
- var NASHORN_BUG = getOwnPropertyDescriptor$2 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
172
+ var NASHORN_BUG = getOwnPropertyDescriptor$2 && !$propertyIsEnumerable$1.call({ 1: 2 }, 1);
173
173
 
174
174
  // `Object.prototype.propertyIsEnumerable` method implementation
175
175
  // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
176
176
  var f$6 = NASHORN_BUG ? function propertyIsEnumerable(V) {
177
177
  var descriptor = getOwnPropertyDescriptor$2(this, V);
178
178
  return !!descriptor && descriptor.enumerable;
179
- } : $propertyIsEnumerable;
179
+ } : $propertyIsEnumerable$1;
180
180
 
181
181
  var objectPropertyIsEnumerable = {
182
182
  f: f$6
@@ -201,24 +201,24 @@
201
201
  };
202
202
  };
203
203
 
204
- var toString$1 = functionUncurryThis({}.toString);
204
+ var toString$2 = functionUncurryThis({}.toString);
205
205
  var stringSlice = functionUncurryThis(''.slice);
206
206
 
207
207
  var classofRaw = function (it) {
208
- return stringSlice(toString$1(it), 8, -1);
208
+ return stringSlice(toString$2(it), 8, -1);
209
209
  };
210
210
 
211
- var $Object$3 = Object;
211
+ var $Object$4 = Object;
212
212
  var split = functionUncurryThis(''.split);
213
213
 
214
214
  // fallback for non-array-like ES3 and non-enumerable old V8 strings
215
215
  var indexedObject = fails(function () {
216
216
  // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
217
217
  // eslint-disable-next-line no-prototype-builtins -- safe
218
- return !$Object$3('z').propertyIsEnumerable(0);
218
+ return !$Object$4('z').propertyIsEnumerable(0);
219
219
  }) ? function (it) {
220
- return classofRaw(it) === 'String' ? split(it, '') : $Object$3(it);
221
- } : $Object$3;
220
+ return classofRaw(it) === 'String' ? split(it, '') : $Object$4(it);
221
+ } : $Object$4;
222
222
 
223
223
  // we can't use just `it == null` since of `document.all` special case
224
224
  // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
@@ -314,7 +314,7 @@
314
314
 
315
315
 
316
316
 
317
- var $String$3 = global$1.String;
317
+ var $String$4 = global$1.String;
318
318
 
319
319
  // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
320
320
  var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails(function () {
@@ -323,7 +323,7 @@
323
323
  // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
324
324
  // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
325
325
  // of course, fail.
326
- return !$String$3(symbol) || !(Object(symbol) instanceof Symbol) ||
326
+ return !$String$4(symbol) || !(Object(symbol) instanceof Symbol) ||
327
327
  // Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
328
328
  !Symbol.sham && engineV8Version && engineV8Version < 41;
329
329
  });
@@ -335,20 +335,20 @@
335
335
  && !Symbol.sham
336
336
  && typeof Symbol.iterator == 'symbol';
337
337
 
338
- var $Object$2 = Object;
338
+ var $Object$3 = Object;
339
339
 
340
340
  var isSymbol = useSymbolAsUid ? function (it) {
341
341
  return typeof it == 'symbol';
342
342
  } : function (it) {
343
343
  var $Symbol = getBuiltIn('Symbol');
344
- return isCallable($Symbol) && objectIsPrototypeOf($Symbol.prototype, $Object$2(it));
344
+ return isCallable($Symbol) && objectIsPrototypeOf($Symbol.prototype, $Object$3(it));
345
345
  };
346
346
 
347
- var $String$2 = String;
347
+ var $String$3 = String;
348
348
 
349
349
  var tryToString = function (argument) {
350
350
  try {
351
- return $String$2(argument);
351
+ return $String$3(argument);
352
352
  } catch (error) {
353
353
  return 'Object';
354
354
  }
@@ -412,12 +412,12 @@
412
412
  });
413
413
  });
414
414
 
415
- var $Object$1 = Object;
415
+ var $Object$2 = Object;
416
416
 
417
417
  // `ToObject` abstract operation
418
418
  // https://tc39.es/ecma262/#sec-toobject
419
419
  var toObject = function (argument) {
420
- return $Object$1(requireObjectCoercible(argument));
420
+ return $Object$2(requireObjectCoercible(argument));
421
421
  };
422
422
 
423
423
  var hasOwnProperty = functionUncurryThis({}.hasOwnProperty);
@@ -431,10 +431,10 @@
431
431
 
432
432
  var id = 0;
433
433
  var postfix = Math.random();
434
- var toString = functionUncurryThis(1.0.toString);
434
+ var toString$1 = functionUncurryThis(1.0.toString);
435
435
 
436
436
  var uid = function (key) {
437
- return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36);
437
+ return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$1(++id + postfix, 36);
438
438
  };
439
439
 
440
440
  var Symbol$1 = global$1.Symbol;
@@ -519,13 +519,13 @@
519
519
  }).prototype !== 42;
520
520
  });
521
521
 
522
- var $String$1 = String;
522
+ var $String$2 = String;
523
523
  var $TypeError$8 = TypeError;
524
524
 
525
525
  // `Assert: Type(argument) is Object`
526
526
  var anObject = function (argument) {
527
527
  if (isObject(argument)) return argument;
528
- throw new $TypeError$8($String$1(argument) + ' is not an object');
528
+ throw new $TypeError$8($String$2(argument) + ' is not an object');
529
529
  };
530
530
 
531
531
  var $TypeError$7 = TypeError;
@@ -802,7 +802,7 @@
802
802
  };
803
803
 
804
804
  // `Array.prototype.{ indexOf, includes }` methods implementation
805
- var createMethod$1 = function (IS_INCLUDES) {
805
+ var createMethod$2 = function (IS_INCLUDES) {
806
806
  return function ($this, el, fromIndex) {
807
807
  var O = toIndexedObject($this);
808
808
  var length = lengthOfArrayLike(O);
@@ -824,26 +824,26 @@
824
824
  var arrayIncludes = {
825
825
  // `Array.prototype.includes` method
826
826
  // https://tc39.es/ecma262/#sec-array.prototype.includes
827
- includes: createMethod$1(true),
827
+ includes: createMethod$2(true),
828
828
  // `Array.prototype.indexOf` method
829
829
  // https://tc39.es/ecma262/#sec-array.prototype.indexof
830
- indexOf: createMethod$1(false)
830
+ indexOf: createMethod$2(false)
831
831
  };
832
832
 
833
833
  var indexOf = arrayIncludes.indexOf;
834
834
 
835
835
 
836
- var push$1 = functionUncurryThis([].push);
836
+ var push$2 = functionUncurryThis([].push);
837
837
 
838
838
  var objectKeysInternal = function (object, names) {
839
839
  var O = toIndexedObject(object);
840
840
  var i = 0;
841
841
  var result = [];
842
842
  var key;
843
- for (key in O) !hasOwnProperty_1(hiddenKeys$1, key) && hasOwnProperty_1(O, key) && push$1(result, key);
843
+ for (key in O) !hasOwnProperty_1(hiddenKeys$1, key) && hasOwnProperty_1(O, key) && push$2(result, key);
844
844
  // Don't enum bug & hidden keys
845
845
  while (names.length > i) if (hasOwnProperty_1(O, key = names[i++])) {
846
- ~indexOf(result, key) || push$1(result, key);
846
+ ~indexOf(result, key) || push$2(result, key);
847
847
  }
848
848
  return result;
849
849
  };
@@ -1006,7 +1006,7 @@
1006
1006
  var toStringTagSupport = String(test) === '[object z]';
1007
1007
 
1008
1008
  var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
1009
- var $Object = Object;
1009
+ var $Object$1 = Object;
1010
1010
 
1011
1011
  // ES3 wrong here
1012
1012
  var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) === 'Arguments';
@@ -1023,7 +1023,7 @@
1023
1023
  var O, tag, result;
1024
1024
  return it === undefined ? 'Undefined' : it === null ? 'Null'
1025
1025
  // @@toStringTag case
1026
- : typeof (tag = tryGet(O = $Object(it), TO_STRING_TAG$1)) == 'string' ? tag
1026
+ : typeof (tag = tryGet(O = $Object$1(it), TO_STRING_TAG$1)) == 'string' ? tag
1027
1027
  // builtinTag case
1028
1028
  : CORRECT_ARGUMENTS ? classofRaw(O)
1029
1029
  // ES3 arguments fallback
@@ -1100,10 +1100,10 @@
1100
1100
  return new (arraySpeciesConstructor(originalArray))(length === 0 ? 0 : length);
1101
1101
  };
1102
1102
 
1103
- var push = functionUncurryThis([].push);
1103
+ var push$1 = functionUncurryThis([].push);
1104
1104
 
1105
1105
  // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
1106
- var createMethod = function (TYPE) {
1106
+ var createMethod$1 = function (TYPE) {
1107
1107
  var IS_MAP = TYPE === 1;
1108
1108
  var IS_FILTER = TYPE === 2;
1109
1109
  var IS_SOME = TYPE === 3;
@@ -1129,10 +1129,10 @@
1129
1129
  case 3: return true; // some
1130
1130
  case 5: return value; // find
1131
1131
  case 6: return index; // findIndex
1132
- case 2: push(target, value); // filter
1132
+ case 2: push$1(target, value); // filter
1133
1133
  } else switch (TYPE) {
1134
1134
  case 4: return false; // every
1135
- case 7: push(target, value); // filterReject
1135
+ case 7: push$1(target, value); // filterReject
1136
1136
  }
1137
1137
  }
1138
1138
  }
@@ -1143,28 +1143,28 @@
1143
1143
  var arrayIteration = {
1144
1144
  // `Array.prototype.forEach` method
1145
1145
  // https://tc39.es/ecma262/#sec-array.prototype.foreach
1146
- forEach: createMethod(0),
1146
+ forEach: createMethod$1(0),
1147
1147
  // `Array.prototype.map` method
1148
1148
  // https://tc39.es/ecma262/#sec-array.prototype.map
1149
- map: createMethod(1),
1149
+ map: createMethod$1(1),
1150
1150
  // `Array.prototype.filter` method
1151
1151
  // https://tc39.es/ecma262/#sec-array.prototype.filter
1152
- filter: createMethod(2),
1152
+ filter: createMethod$1(2),
1153
1153
  // `Array.prototype.some` method
1154
1154
  // https://tc39.es/ecma262/#sec-array.prototype.some
1155
- some: createMethod(3),
1155
+ some: createMethod$1(3),
1156
1156
  // `Array.prototype.every` method
1157
1157
  // https://tc39.es/ecma262/#sec-array.prototype.every
1158
- every: createMethod(4),
1158
+ every: createMethod$1(4),
1159
1159
  // `Array.prototype.find` method
1160
1160
  // https://tc39.es/ecma262/#sec-array.prototype.find
1161
- find: createMethod(5),
1161
+ find: createMethod$1(5),
1162
1162
  // `Array.prototype.findIndex` method
1163
1163
  // https://tc39.es/ecma262/#sec-array.prototype.findIndex
1164
- findIndex: createMethod(6),
1164
+ findIndex: createMethod$1(6),
1165
1165
  // `Array.prototype.filterReject` method
1166
1166
  // https://github.com/tc39/proposal-array-filtering
1167
- filterReject: createMethod(7)
1167
+ filterReject: createMethod$1(7)
1168
1168
  };
1169
1169
 
1170
1170
  var arrayMethodIsStrict = function (METHOD_NAME, argument) {
@@ -1273,14 +1273,14 @@
1273
1273
 
1274
1274
  var DatePrototype = Date.prototype;
1275
1275
  var INVALID_DATE = 'Invalid Date';
1276
- var TO_STRING = 'toString';
1277
- var nativeDateToString = functionUncurryThis(DatePrototype[TO_STRING]);
1276
+ var TO_STRING$1 = 'toString';
1277
+ var nativeDateToString = functionUncurryThis(DatePrototype[TO_STRING$1]);
1278
1278
  var thisTimeValue = functionUncurryThis(DatePrototype.getTime);
1279
1279
 
1280
1280
  // `Date.prototype.toString` method
1281
1281
  // https://tc39.es/ecma262/#sec-date.prototype.tostring
1282
1282
  if (String(new Date(NaN)) !== INVALID_DATE) {
1283
- defineBuiltIn(DatePrototype, TO_STRING, function toString() {
1283
+ defineBuiltIn(DatePrototype, TO_STRING$1, function toString() {
1284
1284
  var value = thisTimeValue(this);
1285
1285
  // eslint-disable-next-line no-self-compare -- NaN check
1286
1286
  return value === value ? nativeDateToString(this) : INVALID_DATE;
@@ -1313,12 +1313,12 @@
1313
1313
  } catch (error) { /* empty */ }
1314
1314
  };
1315
1315
 
1316
- var $String = String;
1316
+ var $String$1 = String;
1317
1317
  var $TypeError$6 = TypeError;
1318
1318
 
1319
1319
  var aPossiblePrototype = function (argument) {
1320
1320
  if (typeof argument == 'object' || isCallable(argument)) return argument;
1321
- throw new $TypeError$6("Can't set " + $String(argument) + ' as a prototype');
1321
+ throw new $TypeError$6("Can't set " + $String$1(argument) + ' as a prototype');
1322
1322
  };
1323
1323
 
1324
1324
  /* eslint-disable no-proto -- safe */
@@ -2252,6 +2252,63 @@
2252
2252
  }
2253
2253
  });
2254
2254
 
2255
+ var $String = String;
2256
+
2257
+ var toString = function (argument) {
2258
+ if (classof(argument) === 'Symbol') throw new TypeError('Cannot convert a Symbol value to a string');
2259
+ return $String(argument);
2260
+ };
2261
+
2262
+ // `RegExp.prototype.flags` getter implementation
2263
+ // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
2264
+ var regexpFlags = function () {
2265
+ var that = anObject(this);
2266
+ var result = '';
2267
+ if (that.hasIndices) result += 'd';
2268
+ if (that.global) result += 'g';
2269
+ if (that.ignoreCase) result += 'i';
2270
+ if (that.multiline) result += 'm';
2271
+ if (that.dotAll) result += 's';
2272
+ if (that.unicode) result += 'u';
2273
+ if (that.unicodeSets) result += 'v';
2274
+ if (that.sticky) result += 'y';
2275
+ return result;
2276
+ };
2277
+
2278
+ var RegExpPrototype$1 = RegExp.prototype;
2279
+
2280
+ var regexpGetFlags = function (R) {
2281
+ var flags = R.flags;
2282
+ return flags === undefined && !('flags' in RegExpPrototype$1) && !hasOwnProperty_1(R, 'flags') && objectIsPrototypeOf(RegExpPrototype$1, R)
2283
+ ? functionCall(regexpFlags, R) : flags;
2284
+ };
2285
+
2286
+ var PROPER_FUNCTION_NAME = functionName.PROPER;
2287
+
2288
+
2289
+
2290
+
2291
+
2292
+
2293
+ var TO_STRING = 'toString';
2294
+ var RegExpPrototype = RegExp.prototype;
2295
+ var nativeToString = RegExpPrototype[TO_STRING];
2296
+
2297
+ var NOT_GENERIC = fails(function () { return nativeToString.call({ source: 'a', flags: 'b' }) !== '/a/b'; });
2298
+ // FF44- RegExp#toString has a wrong name
2299
+ var INCORRECT_NAME = PROPER_FUNCTION_NAME && nativeToString.name !== TO_STRING;
2300
+
2301
+ // `RegExp.prototype.toString` method
2302
+ // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
2303
+ if (NOT_GENERIC || INCORRECT_NAME) {
2304
+ defineBuiltIn(RegExp.prototype, TO_STRING, function toString$1() {
2305
+ var R = anObject(this);
2306
+ var pattern = toString(R.source);
2307
+ var flags = toString(regexpGetFlags(R));
2308
+ return '/' + pattern + '/' + flags;
2309
+ }, { unsafe: true });
2310
+ }
2311
+
2255
2312
  /* global Bun -- Bun case */
2256
2313
  var engineIsBun = typeof Bun == 'function' && Bun && typeof Bun.version == 'string';
2257
2314
 
@@ -2294,6 +2351,82 @@
2294
2351
  setTimeout: setTimeout$1
2295
2352
  });
2296
2353
 
2354
+ var correctPrototypeGetter = !fails(function () {
2355
+ function F() { /* empty */ }
2356
+ F.prototype.constructor = null;
2357
+ // eslint-disable-next-line es/no-object-getprototypeof -- required for testing
2358
+ return Object.getPrototypeOf(new F()) !== F.prototype;
2359
+ });
2360
+
2361
+ var IE_PROTO$1 = sharedKey('IE_PROTO');
2362
+ var $Object = Object;
2363
+ var ObjectPrototype = $Object.prototype;
2364
+
2365
+ // `Object.getPrototypeOf` method
2366
+ // https://tc39.es/ecma262/#sec-object.getprototypeof
2367
+ // eslint-disable-next-line es/no-object-getprototypeof -- safe
2368
+ var objectGetPrototypeOf = correctPrototypeGetter ? $Object.getPrototypeOf : function (O) {
2369
+ var object = toObject(O);
2370
+ if (hasOwnProperty_1(object, IE_PROTO$1)) return object[IE_PROTO$1];
2371
+ var constructor = object.constructor;
2372
+ if (isCallable(constructor) && object instanceof constructor) {
2373
+ return constructor.prototype;
2374
+ } return object instanceof $Object ? ObjectPrototype : null;
2375
+ };
2376
+
2377
+ var $propertyIsEnumerable = objectPropertyIsEnumerable.f;
2378
+
2379
+ var propertyIsEnumerable = functionUncurryThis($propertyIsEnumerable);
2380
+ var push = functionUncurryThis([].push);
2381
+
2382
+ // in some IE versions, `propertyIsEnumerable` returns incorrect result on integer keys
2383
+ // of `null` prototype objects
2384
+ var IE_BUG = descriptors && fails(function () {
2385
+ // eslint-disable-next-line es/no-object-create -- safe
2386
+ var O = Object.create(null);
2387
+ O[2] = 2;
2388
+ return !propertyIsEnumerable(O, 2);
2389
+ });
2390
+
2391
+ // `Object.{ entries, values }` methods implementation
2392
+ var createMethod = function (TO_ENTRIES) {
2393
+ return function (it) {
2394
+ var O = toIndexedObject(it);
2395
+ var keys = objectKeys(O);
2396
+ var IE_WORKAROUND = IE_BUG && objectGetPrototypeOf(O) === null;
2397
+ var length = keys.length;
2398
+ var i = 0;
2399
+ var result = [];
2400
+ var key;
2401
+ while (length > i) {
2402
+ key = keys[i++];
2403
+ if (!descriptors || (IE_WORKAROUND ? key in O : propertyIsEnumerable(O, key))) {
2404
+ push(result, TO_ENTRIES ? [key, O[key]] : O[key]);
2405
+ }
2406
+ }
2407
+ return result;
2408
+ };
2409
+ };
2410
+
2411
+ var objectToArray = {
2412
+ // `Object.entries` method
2413
+ // https://tc39.es/ecma262/#sec-object.entries
2414
+ entries: createMethod(true),
2415
+ // `Object.values` method
2416
+ // https://tc39.es/ecma262/#sec-object.values
2417
+ values: createMethod(false)
2418
+ };
2419
+
2420
+ var $values = objectToArray.values;
2421
+
2422
+ // `Object.values` method
2423
+ // https://tc39.es/ecma262/#sec-object.values
2424
+ _export({ target: 'Object', stat: true }, {
2425
+ values: function values(O) {
2426
+ return $values(O);
2427
+ }
2428
+ });
2429
+
2297
2430
  // `Object.defineProperties` method
2298
2431
  // https://tc39.es/ecma262/#sec-object.defineproperties
2299
2432
  // eslint-disable-next-line es/no-object-defineproperties -- safe
@@ -3409,7 +3542,7 @@
3409
3542
  };
3410
3543
  ws.onmessage = function (event) {
3411
3544
  ws.lastMessageTimestamp = new Date();
3412
- var message = JSON.parse(event.data);
3545
+ var message = JSON.parse(event.data.toString());
3413
3546
  if (message.handshake) {
3414
3547
  ws.reconcile();
3415
3548
  ws.reconcileTimer = setInterval(function () {
@@ -3423,7 +3556,7 @@
3423
3556
  }
3424
3557
  ws.sendQueue();
3425
3558
  };
3426
- ws.onclose = function () {
3559
+ ws.onclose = function (event) {
3427
3560
  if (ws && ws.readyState !== browser.CLOSED && ws.readyState !== browser.CLOSING) {
3428
3561
  ws.close();
3429
3562
  }
@@ -3433,6 +3566,23 @@
3433
3566
  }
3434
3567
  if (_this.ws === ws) {
3435
3568
  _this.ws = null;
3569
+
3570
+ // Close code 1009: Message Too Big. Server rejects messages exceeding maxPayload
3571
+ // without decoding. Retrying would cause an infinite loop, so we notify subscribers
3572
+ // and clear subscriptions instead.
3573
+ if ((event === null || event === void 0 ? void 0 : event.code) === 1009) {
3574
+ var error = new WebSocketTransportResult({
3575
+ status: 413,
3576
+ message: {
3577
+ error: (event === null || event === void 0 ? void 0 : event.reason) || 'WebSocket message too big'
3578
+ }
3579
+ });
3580
+ Object.values(_this.messageIdToSubscription).forEach(function (sub) {
3581
+ sub.callback(error);
3582
+ });
3583
+ _this.messageIdToSubscription = {};
3584
+ return;
3585
+ }
3436
3586
  if (Object.keys(_this.messageIdToSubscription).length) {
3437
3587
  _this.initSocket();
3438
3588
  }