@bringg/dashboard-sdk 9.71.1 → 9.73.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23416,7 +23416,7 @@ var lodash_1 = __webpack_require__(96486);
23416
23416
  var BringgException_1 = __webpack_require__(43605);
23417
23417
  var Logger_1 = __importDefault(__webpack_require__(55860));
23418
23418
  var abort_1 = __webpack_require__(34179);
23419
- var version = '9.71.1';
23419
+ var version = '9.73.0';
23420
23420
  function logErrorResponse(response) {
23421
23421
  var data = response.data, status = response.status;
23422
23422
  try {
@@ -28829,6 +28829,21 @@ var TemplatesEntity = /** @class */ (function (_super) {
28829
28829
  });
28830
28830
  });
28831
28831
  };
28832
+ TemplatesEntity.prototype.receipt = function (payload) {
28833
+ return __awaiter(this, void 0, void 0, function () {
28834
+ return __generator(this, function (_a) {
28835
+ switch (_a.label) {
28836
+ case 0: return [4 /*yield*/, this.service.routeGenerator
28837
+ .post(Templates_consts_1.Routes.RECEIPT)
28838
+ .withPayload(payload)
28839
+ .withResponseType('text')
28840
+ .setException('failed to receipt print order template')
28841
+ .invoke()];
28842
+ case 1: return [2 /*return*/, _a.sent()];
28843
+ }
28844
+ });
28845
+ });
28846
+ };
28832
28847
  return TemplatesEntity;
28833
28848
  }(Entity_1.default));
28834
28849
  exports["default"] = TemplatesEntity;
@@ -28849,7 +28864,8 @@ exports.Routes = {
28849
28864
  TEMPLATES: "".concat(baseRoute, "/templates"),
28850
28865
  TEMPLATE: "".concat(baseRoute, "/templates/{:id}"),
28851
28866
  SEND_TEST_EMAIL: "".concat(baseRoute, "/send-email/test"),
28852
- PREVIEW: "".concat(baseRoute, "/print-order/preview")
28867
+ PREVIEW: "".concat(baseRoute, "/print-order/preview"),
28868
+ RECEIPT: "".concat(baseRoute, "/print-order/receipt")
28853
28869
  };
28854
28870
  //# sourceMappingURL=Templates.consts.js.map
28855
28871
 
@@ -28893,6 +28909,9 @@ var TemplatesApi = /** @class */ (function () {
28893
28909
  TemplatesApi.prototype.preview = function (payload) {
28894
28910
  return this.templatesEntity.preview(payload);
28895
28911
  };
28912
+ TemplatesApi.prototype.receipt = function (payload) {
28913
+ return this.templatesEntity.receipt(payload);
28914
+ };
28896
28915
  return TemplatesApi;
28897
28916
  }());
28898
28917
  exports["default"] = TemplatesApi;
@@ -32673,7 +32692,8 @@ exports.Routes = {
32673
32692
  IMPORT_VEHICLES_CSV: '/vehicles/import_from_csv',
32674
32693
  GET_CSV_UPLOAD_FIELDS: '/vehicles/csv_upload_fields',
32675
32694
  BATCH_UPDATE: '/vehicles/batch_update',
32676
- PAGED_VEHICLES: '/vehicles/get_all_v2'
32695
+ PAGED_VEHICLES: '/vehicles/get_all_v2',
32696
+ BATCH_GET: '/vehicles/batch_get'
32677
32697
  };
32678
32698
  var VehicleEntity = /** @class */ (function (_super) {
32679
32699
  __extends(VehicleEntity, _super);
@@ -32912,7 +32932,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
32912
32932
  return (mod && mod.__esModule) ? mod : { "default": mod };
32913
32933
  };
32914
32934
  Object.defineProperty(exports, "__esModule", ({ value: true }));
32935
+ var types_1 = __webpack_require__(63127);
32936
+ var lodash_1 = __webpack_require__(96486);
32915
32937
  var storable_realtime_subscriptions_1 = __importDefault(__webpack_require__(1227));
32938
+ var data_entity_1 = __webpack_require__(91083);
32916
32939
  var data_store_1 = __importDefault(__webpack_require__(73135));
32917
32940
  var storable_data_service_1 = __importDefault(__webpack_require__(45297));
32918
32941
  var Vehicle_consts_1 = __webpack_require__(84010);
@@ -32940,6 +32963,73 @@ var VehiclesApi = /** @class */ (function () {
32940
32963
  var _this = this;
32941
32964
  return this.storableDataService.loadAll('loadAllByTeam', function () { return _this.vehiclesService.loadAllByTeam(teamId); }, __assign(__assign({}, options), { groupType: Vehicle_consts_1.VehicleGroup.Team, groupValue: teamId }));
32942
32965
  };
32966
+ VehiclesApi.prototype.loadMany = function (ids, options) {
32967
+ if (options === void 0) { options = data_entity_1.DEFAULT_OPTIONS; }
32968
+ return __awaiter(this, void 0, void 0, function () {
32969
+ var optionsWithDefaults, chunkSize;
32970
+ var _this = this;
32971
+ return __generator(this, function (_a) {
32972
+ optionsWithDefaults = (0, lodash_1.defaults)({}, options, __assign(__assign({}, data_entity_1.DEFAULT_OPTIONS), { chunkSize: 500 }));
32973
+ chunkSize = optionsWithDefaults.chunkSize;
32974
+ return [2 /*return*/, this.storableDataService.loadMany('batchGet', function (idsToLoad) {
32975
+ if (idsToLoad.length === 0) {
32976
+ return Promise.resolve([]);
32977
+ }
32978
+ return _this.vehiclesService.loadMany(idsToLoad, chunkSize, {
32979
+ signal: optionsWithDefaults.signal
32980
+ });
32981
+ }, ids, optionsWithDefaults)];
32982
+ });
32983
+ });
32984
+ };
32985
+ // When requesting by team_ids we don't know how many results will be returned
32986
+ // If all pages requested from the API result in a very big array which is set to the store within one sync operation
32987
+ // This may choke the main thread.
32988
+ // Request / set to the store page by page and let the consumer decide if it loads the next page.
32989
+ VehiclesApi.prototype.loadAllByTeamsPaged = function (teamIds, options) {
32990
+ var _a;
32991
+ return __awaiter(this, void 0, void 0, function () {
32992
+ var optionsWithDefaults, shouldUseCache, isFirstPageRequest, teamsIdsToLoad, response;
32993
+ var _this = this;
32994
+ return __generator(this, function (_b) {
32995
+ switch (_b.label) {
32996
+ case 0:
32997
+ optionsWithDefaults = (0, lodash_1.defaults)(options, { useCache: true });
32998
+ shouldUseCache = Boolean(optionsWithDefaults.useCache);
32999
+ isFirstPageRequest = (0, lodash_1.isNil)(optionsWithDefaults.cursor);
33000
+ teamsIdsToLoad = shouldUseCache && isFirstPageRequest
33001
+ ? teamIds.filter(function (teamId) { return !_this.vehiclesStore.isGroupInitialized(Vehicle_consts_1.VehicleGroup.Team, teamId); })
33002
+ : teamIds;
33003
+ if (isFirstPageRequest && teamsIdsToLoad.length === 0) {
33004
+ return [2 /*return*/, {
33005
+ next_page_cursor: null,
33006
+ vehicles: this.vehiclesStore.getGroup(Vehicle_consts_1.VehicleGroup.Team, teamIds)
33007
+ }];
33008
+ }
33009
+ return [4 /*yield*/, this.vehiclesService.loadAllByTeamsPaged({
33010
+ team_ids: teamsIdsToLoad,
33011
+ cursor: optionsWithDefaults.cursor,
33012
+ limit: optionsWithDefaults.chunkSize,
33013
+ page_action: types_1.KeysetPaginationPageAction.NEXT_ONLY
33014
+ }, {
33015
+ signal: optionsWithDefaults.signal
33016
+ })];
33017
+ case 1:
33018
+ response = _b.sent();
33019
+ if ((_a = response.vehicles) === null || _a === void 0 ? void 0 : _a.length) {
33020
+ this.storableDataService.updateManyInStores(response.vehicles, 'loadAllByTeamsPaged');
33021
+ }
33022
+ if (!response.next_page_cursor) {
33023
+ this.vehiclesStore.setGroupInitialized(Vehicle_consts_1.VehicleGroup.Team, teamsIdsToLoad);
33024
+ }
33025
+ return [2 /*return*/, {
33026
+ next_page_cursor: response.next_page_cursor,
33027
+ vehicles: response.vehicles.map(function (vehicle) { return _this.vehiclesStore.get(vehicle.id); })
33028
+ }];
33029
+ }
33030
+ });
33031
+ });
33032
+ };
32943
33033
  VehiclesApi.prototype.delete = function (id) {
32944
33034
  var _this = this;
32945
33035
  return this.storableDataService.delete('delete', function () { return _this.vehiclesService.delete(id); }, id);
@@ -33089,6 +33179,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
33089
33179
  return (mod && mod.__esModule) ? mod : { "default": mod };
33090
33180
  };
33091
33181
  Object.defineProperty(exports, "__esModule", ({ value: true }));
33182
+ var types_1 = __webpack_require__(63127);
33092
33183
  var CrudService_1 = __importDefault(__webpack_require__(14809));
33093
33184
  var VehicleEntity_1 = __webpack_require__(84752);
33094
33185
  var Vehicle_consts_1 = __webpack_require__(84010);
@@ -33185,6 +33276,26 @@ var VehiclesService = /** @class */ (function () {
33185
33276
  });
33186
33277
  });
33187
33278
  };
33279
+ VehiclesService.prototype.loadMany = function (ids, limit, commonOptions) {
33280
+ return __awaiter(this, void 0, void 0, function () {
33281
+ return __generator(this, function (_a) {
33282
+ switch (_a.label) {
33283
+ case 0: return [4 /*yield*/, this.service.routeGenerator
33284
+ .post(VehicleEntity_1.Routes.BATCH_GET)
33285
+ .withPayload({
33286
+ ids: ids,
33287
+ limit: limit,
33288
+ page_action: types_1.KeysetPaginationPageAction.NEXT_ONLY
33289
+ })
33290
+ .withCommonOptions(commonOptions)
33291
+ .withExtractor(Vehicle_consts_1.vehiclesExtractor)
33292
+ .setException("failed to load vehicles for ids ".concat(ids.join(',')))
33293
+ .invoke()];
33294
+ case 1: return [2 /*return*/, _a.sent()];
33295
+ }
33296
+ });
33297
+ });
33298
+ };
33188
33299
  VehiclesService.prototype.getCsvUploadFields = function () {
33189
33300
  return __awaiter(this, void 0, void 0, function () {
33190
33301
  return __generator(this, function (_a) {
@@ -33227,9 +33338,6 @@ var VehiclesService = /** @class */ (function () {
33227
33338
  });
33228
33339
  });
33229
33340
  };
33230
- /**
33231
- * @deprecated The method should not be used. Backend is not merged.
33232
- */
33233
33341
  VehiclesService.prototype.loadPagedVehicles = function (cursor, filters, limit, page_action) {
33234
33342
  return __awaiter(this, void 0, void 0, function () {
33235
33343
  return __generator(this, function (_a) {
@@ -33243,6 +33351,22 @@ var VehiclesService = /** @class */ (function () {
33243
33351
  });
33244
33352
  });
33245
33353
  };
33354
+ VehiclesService.prototype.loadAllByTeamsPaged = function (payload, commonOptions) {
33355
+ return __awaiter(this, void 0, void 0, function () {
33356
+ return __generator(this, function (_a) {
33357
+ switch (_a.label) {
33358
+ case 0: return [4 /*yield*/, this.service.routeGenerator
33359
+ .post(VehicleEntity_1.Routes.BATCH_GET)
33360
+ .withPayload(payload)
33361
+ .withCommonOptions(commonOptions)
33362
+ .withExtractor(function (response) { return response; })
33363
+ .setException("failed to load vehicles for teams ".concat(payload.team_ids.join(',')))
33364
+ .invoke()];
33365
+ case 1: return [2 /*return*/, _a.sent()];
33366
+ }
33367
+ });
33368
+ });
33369
+ };
33246
33370
  return VehiclesService;
33247
33371
  }());
33248
33372
  exports["default"] = VehiclesService;
@@ -110609,7 +110733,7 @@ const parseqs_js_1 = __webpack_require__(75754);
110609
110733
  const parseuri_js_1 = __webpack_require__(75222);
110610
110734
  const debug_1 = __importDefault(__webpack_require__(11227)); // debug()
110611
110735
  const component_emitter_1 = __webpack_require__(95260);
110612
- const engine_io_parser_1 = __webpack_require__(75908);
110736
+ const engine_io_parser_1 = __webpack_require__(77857);
110613
110737
  const websocket_constructor_js_1 = __webpack_require__(45552);
110614
110738
  const debug = (0, debug_1.default)("engine.io-client:socket"); // debug()
110615
110739
  class Socket extends component_emitter_1.Emitter {
@@ -111237,7 +111361,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
111237
111361
  };
111238
111362
  Object.defineProperty(exports, "__esModule", ({ value: true }));
111239
111363
  exports.Transport = void 0;
111240
- const engine_io_parser_1 = __webpack_require__(75908);
111364
+ const engine_io_parser_1 = __webpack_require__(77857);
111241
111365
  const component_emitter_1 = __webpack_require__(95260);
111242
111366
  const util_js_1 = __webpack_require__(89622);
111243
111367
  const debug_1 = __importDefault(__webpack_require__(11227)); // debug()
@@ -111418,7 +111542,7 @@ exports.Request = exports.Polling = void 0;
111418
111542
  const transport_js_1 = __webpack_require__(29870);
111419
111543
  const debug_1 = __importDefault(__webpack_require__(11227)); // debug()
111420
111544
  const yeast_js_1 = __webpack_require__(68726);
111421
- const engine_io_parser_1 = __webpack_require__(75908);
111545
+ const engine_io_parser_1 = __webpack_require__(77857);
111422
111546
  const xmlhttprequest_js_1 = __webpack_require__(26666);
111423
111547
  const component_emitter_1 = __webpack_require__(95260);
111424
111548
  const util_js_1 = __webpack_require__(89622);
@@ -111866,7 +111990,7 @@ const yeast_js_1 = __webpack_require__(68726);
111866
111990
  const util_js_1 = __webpack_require__(89622);
111867
111991
  const websocket_constructor_js_1 = __webpack_require__(45552);
111868
111992
  const debug_1 = __importDefault(__webpack_require__(11227)); // debug()
111869
- const engine_io_parser_1 = __webpack_require__(75908);
111993
+ const engine_io_parser_1 = __webpack_require__(77857);
111870
111994
  const debug = (0, debug_1.default)("engine.io-client:websocket"); // debug()
111871
111995
  // detect ReactNative environment
111872
111996
  const isReactNative = typeof navigator !== "undefined" &&
@@ -112033,7 +112157,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
112033
112157
  exports.WT = void 0;
112034
112158
  const transport_js_1 = __webpack_require__(29870);
112035
112159
  const websocket_constructor_js_1 = __webpack_require__(45552);
112036
- const engine_io_parser_1 = __webpack_require__(75908);
112160
+ const engine_io_parser_1 = __webpack_require__(77857);
112037
112161
  const debug_1 = __importDefault(__webpack_require__(11227)); // debug()
112038
112162
  const debug = (0, debug_1.default)("engine.io-client:webtransport"); // debug()
112039
112163
  class WT extends transport_js_1.Transport {
@@ -112213,7 +112337,7 @@ function utf8Length(str) {
112213
112337
 
112214
112338
  /***/ }),
112215
112339
 
112216
- /***/ 859:
112340
+ /***/ 83087:
112217
112341
  /***/ ((__unused_webpack_module, exports) => {
112218
112342
 
112219
112343
  "use strict";
@@ -112231,7 +112355,7 @@ PACKET_TYPES["upgrade"] = "5";
112231
112355
  PACKET_TYPES["noop"] = "6";
112232
112356
  const PACKET_TYPES_REVERSE = Object.create(null);
112233
112357
  exports.PACKET_TYPES_REVERSE = PACKET_TYPES_REVERSE;
112234
- Object.keys(PACKET_TYPES).forEach(key => {
112358
+ Object.keys(PACKET_TYPES).forEach((key) => {
112235
112359
  PACKET_TYPES_REVERSE[PACKET_TYPES[key]] = key;
112236
112360
  });
112237
112361
  const ERROR_PACKET = { type: "error", data: "parser error" };
@@ -112240,7 +112364,7 @@ exports.ERROR_PACKET = ERROR_PACKET;
112240
112364
 
112241
112365
  /***/ }),
112242
112366
 
112243
- /***/ 15848:
112367
+ /***/ 82469:
112244
112368
  /***/ ((__unused_webpack_module, exports) => {
112245
112369
 
112246
112370
  "use strict";
@@ -112296,28 +112420,28 @@ exports.decode = decode;
112296
112420
 
112297
112421
  /***/ }),
112298
112422
 
112299
- /***/ 82150:
112423
+ /***/ 17572:
112300
112424
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
112301
112425
 
112302
112426
  "use strict";
112303
112427
 
112304
112428
  Object.defineProperty(exports, "__esModule", ({ value: true }));
112305
112429
  exports.decodePacket = void 0;
112306
- const commons_js_1 = __webpack_require__(859);
112307
- const base64_arraybuffer_js_1 = __webpack_require__(15848);
112430
+ const commons_js_1 = __webpack_require__(83087);
112431
+ const base64_arraybuffer_js_1 = __webpack_require__(82469);
112308
112432
  const withNativeArrayBuffer = typeof ArrayBuffer === "function";
112309
112433
  const decodePacket = (encodedPacket, binaryType) => {
112310
112434
  if (typeof encodedPacket !== "string") {
112311
112435
  return {
112312
112436
  type: "message",
112313
- data: mapBinary(encodedPacket, binaryType)
112437
+ data: mapBinary(encodedPacket, binaryType),
112314
112438
  };
112315
112439
  }
112316
112440
  const type = encodedPacket.charAt(0);
112317
112441
  if (type === "b") {
112318
112442
  return {
112319
112443
  type: "message",
112320
- data: decodeBase64Packet(encodedPacket.substring(1), binaryType)
112444
+ data: decodeBase64Packet(encodedPacket.substring(1), binaryType),
112321
112445
  };
112322
112446
  }
112323
112447
  const packetType = commons_js_1.PACKET_TYPES_REVERSE[type];
@@ -112327,10 +112451,10 @@ const decodePacket = (encodedPacket, binaryType) => {
112327
112451
  return encodedPacket.length > 1
112328
112452
  ? {
112329
112453
  type: commons_js_1.PACKET_TYPES_REVERSE[type],
112330
- data: encodedPacket.substring(1)
112454
+ data: encodedPacket.substring(1),
112331
112455
  }
112332
112456
  : {
112333
- type: commons_js_1.PACKET_TYPES_REVERSE[type]
112457
+ type: commons_js_1.PACKET_TYPES_REVERSE[type],
112334
112458
  };
112335
112459
  };
112336
112460
  exports.decodePacket = decodePacket;
@@ -112370,20 +112494,21 @@ const mapBinary = (data, binaryType) => {
112370
112494
 
112371
112495
  /***/ }),
112372
112496
 
112373
- /***/ 72809:
112497
+ /***/ 83908:
112374
112498
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
112375
112499
 
112376
112500
  "use strict";
112377
112501
 
112378
112502
  Object.defineProperty(exports, "__esModule", ({ value: true }));
112379
- exports.encodePacket = exports.encodePacketToBinary = void 0;
112380
- const commons_js_1 = __webpack_require__(859);
112503
+ exports.encodePacket = void 0;
112504
+ exports.encodePacketToBinary = encodePacketToBinary;
112505
+ const commons_js_1 = __webpack_require__(83087);
112381
112506
  const withNativeBlob = typeof Blob === "function" ||
112382
112507
  (typeof Blob !== "undefined" &&
112383
112508
  Object.prototype.toString.call(Blob) === "[object BlobConstructor]");
112384
112509
  const withNativeArrayBuffer = typeof ArrayBuffer === "function";
112385
112510
  // ArrayBuffer.isView method is not defined in IE10
112386
- const isView = obj => {
112511
+ const isView = (obj) => {
112387
112512
  return typeof ArrayBuffer.isView === "function"
112388
112513
  ? ArrayBuffer.isView(obj)
112389
112514
  : obj && obj.buffer instanceof ArrayBuffer;
@@ -112432,39 +112557,37 @@ function toArray(data) {
112432
112557
  let TEXT_ENCODER;
112433
112558
  function encodePacketToBinary(packet, callback) {
112434
112559
  if (withNativeBlob && packet.data instanceof Blob) {
112435
- return packet.data
112436
- .arrayBuffer()
112437
- .then(toArray)
112438
- .then(callback);
112560
+ return packet.data.arrayBuffer().then(toArray).then(callback);
112439
112561
  }
112440
112562
  else if (withNativeArrayBuffer &&
112441
112563
  (packet.data instanceof ArrayBuffer || isView(packet.data))) {
112442
112564
  return callback(toArray(packet.data));
112443
112565
  }
112444
- encodePacket(packet, false, encoded => {
112566
+ encodePacket(packet, false, (encoded) => {
112445
112567
  if (!TEXT_ENCODER) {
112446
112568
  TEXT_ENCODER = new TextEncoder();
112447
112569
  }
112448
112570
  callback(TEXT_ENCODER.encode(encoded));
112449
112571
  });
112450
112572
  }
112451
- exports.encodePacketToBinary = encodePacketToBinary;
112452
112573
 
112453
112574
 
112454
112575
  /***/ }),
112455
112576
 
112456
- /***/ 75908:
112577
+ /***/ 77857:
112457
112578
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
112458
112579
 
112459
112580
  "use strict";
112460
112581
 
112461
112582
  Object.defineProperty(exports, "__esModule", ({ value: true }));
112462
- exports.decodePayload = exports.decodePacket = exports.encodePayload = exports.encodePacket = exports.protocol = exports.createPacketDecoderStream = exports.createPacketEncoderStream = void 0;
112463
- const encodePacket_js_1 = __webpack_require__(72809);
112583
+ exports.decodePayload = exports.decodePacket = exports.encodePayload = exports.encodePacket = exports.protocol = void 0;
112584
+ exports.createPacketEncoderStream = createPacketEncoderStream;
112585
+ exports.createPacketDecoderStream = createPacketDecoderStream;
112586
+ const encodePacket_js_1 = __webpack_require__(83908);
112464
112587
  Object.defineProperty(exports, "encodePacket", ({ enumerable: true, get: function () { return encodePacket_js_1.encodePacket; } }));
112465
- const decodePacket_js_1 = __webpack_require__(82150);
112588
+ const decodePacket_js_1 = __webpack_require__(17572);
112466
112589
  Object.defineProperty(exports, "decodePacket", ({ enumerable: true, get: function () { return decodePacket_js_1.decodePacket; } }));
112467
- const commons_js_1 = __webpack_require__(859);
112590
+ const commons_js_1 = __webpack_require__(83087);
112468
112591
  const SEPARATOR = String.fromCharCode(30); // see https://en.wikipedia.org/wiki/Delimiter#ASCII_delimited_text
112469
112592
  const encodePayload = (packets, callback) => {
112470
112593
  // some packets may be added to the array while encoding, so the initial length must be saved
@@ -112473,7 +112596,7 @@ const encodePayload = (packets, callback) => {
112473
112596
  let count = 0;
112474
112597
  packets.forEach((packet, i) => {
112475
112598
  // force base64 encoding for binary packets
112476
- (0, encodePacket_js_1.encodePacket)(packet, false, encodedPacket => {
112599
+ (0, encodePacket_js_1.encodePacket)(packet, false, (encodedPacket) => {
112477
112600
  encodedPackets[i] = encodedPacket;
112478
112601
  if (++count === length) {
112479
112602
  callback(encodedPackets.join(SEPARATOR));
@@ -112498,7 +112621,7 @@ exports.decodePayload = decodePayload;
112498
112621
  function createPacketEncoderStream() {
112499
112622
  return new TransformStream({
112500
112623
  transform(packet, controller) {
112501
- (0, encodePacket_js_1.encodePacketToBinary)(packet, encodedPacket => {
112624
+ (0, encodePacket_js_1.encodePacketToBinary)(packet, (encodedPacket) => {
112502
112625
  const payloadLength = encodedPacket.length;
112503
112626
  let header;
112504
112627
  // inspired by the WebSocket format: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_servers#decoding_payload_length
@@ -112525,10 +112648,9 @@ function createPacketEncoderStream() {
112525
112648
  controller.enqueue(header);
112526
112649
  controller.enqueue(encodedPacket);
112527
112650
  });
112528
- }
112651
+ },
112529
112652
  });
112530
112653
  }
112531
- exports.createPacketEncoderStream = createPacketEncoderStream;
112532
112654
  let TEXT_DECODER;
112533
112655
  function totalLength(chunks) {
112534
112656
  return chunks.reduce((acc, chunk) => acc + chunk.length, 0);
@@ -112556,14 +112678,14 @@ function createPacketDecoderStream(maxPayload, binaryType) {
112556
112678
  TEXT_DECODER = new TextDecoder();
112557
112679
  }
112558
112680
  const chunks = [];
112559
- let state = 0 /* READ_HEADER */;
112681
+ let state = 0 /* State.READ_HEADER */;
112560
112682
  let expectedLength = -1;
112561
112683
  let isBinary = false;
112562
112684
  return new TransformStream({
112563
112685
  transform(chunk, controller) {
112564
112686
  chunks.push(chunk);
112565
112687
  while (true) {
112566
- if (state === 0 /* READ_HEADER */) {
112688
+ if (state === 0 /* State.READ_HEADER */) {
112567
112689
  if (totalLength(chunks) < 1) {
112568
112690
  break;
112569
112691
  }
@@ -112571,24 +112693,24 @@ function createPacketDecoderStream(maxPayload, binaryType) {
112571
112693
  isBinary = (header[0] & 0x80) === 0x80;
112572
112694
  expectedLength = header[0] & 0x7f;
112573
112695
  if (expectedLength < 126) {
112574
- state = 3 /* READ_PAYLOAD */;
112696
+ state = 3 /* State.READ_PAYLOAD */;
112575
112697
  }
112576
112698
  else if (expectedLength === 126) {
112577
- state = 1 /* READ_EXTENDED_LENGTH_16 */;
112699
+ state = 1 /* State.READ_EXTENDED_LENGTH_16 */;
112578
112700
  }
112579
112701
  else {
112580
- state = 2 /* READ_EXTENDED_LENGTH_64 */;
112702
+ state = 2 /* State.READ_EXTENDED_LENGTH_64 */;
112581
112703
  }
112582
112704
  }
112583
- else if (state === 1 /* READ_EXTENDED_LENGTH_16 */) {
112705
+ else if (state === 1 /* State.READ_EXTENDED_LENGTH_16 */) {
112584
112706
  if (totalLength(chunks) < 2) {
112585
112707
  break;
112586
112708
  }
112587
112709
  const headerArray = concatChunks(chunks, 2);
112588
112710
  expectedLength = new DataView(headerArray.buffer, headerArray.byteOffset, headerArray.length).getUint16(0);
112589
- state = 3 /* READ_PAYLOAD */;
112711
+ state = 3 /* State.READ_PAYLOAD */;
112590
112712
  }
112591
- else if (state === 2 /* READ_EXTENDED_LENGTH_64 */) {
112713
+ else if (state === 2 /* State.READ_EXTENDED_LENGTH_64 */) {
112592
112714
  if (totalLength(chunks) < 8) {
112593
112715
  break;
112594
112716
  }
@@ -112601,7 +112723,7 @@ function createPacketDecoderStream(maxPayload, binaryType) {
112601
112723
  break;
112602
112724
  }
112603
112725
  expectedLength = n * Math.pow(2, 32) + view.getUint32(4);
112604
- state = 3 /* READ_PAYLOAD */;
112726
+ state = 3 /* State.READ_PAYLOAD */;
112605
112727
  }
112606
112728
  else {
112607
112729
  if (totalLength(chunks) < expectedLength) {
@@ -112609,17 +112731,16 @@ function createPacketDecoderStream(maxPayload, binaryType) {
112609
112731
  }
112610
112732
  const data = concatChunks(chunks, expectedLength);
112611
112733
  controller.enqueue((0, decodePacket_js_1.decodePacket)(isBinary ? data : TEXT_DECODER.decode(data), binaryType));
112612
- state = 0 /* READ_HEADER */;
112734
+ state = 0 /* State.READ_HEADER */;
112613
112735
  }
112614
112736
  if (expectedLength === 0 || expectedLength > maxPayload) {
112615
112737
  controller.enqueue(commons_js_1.ERROR_PACKET);
112616
112738
  break;
112617
112739
  }
112618
112740
  }
112619
- }
112741
+ },
112620
112742
  });
112621
112743
  }
112622
- exports.createPacketDecoderStream = createPacketDecoderStream;
112623
112744
  exports.protocol = 4;
112624
112745
 
112625
112746