http-air 1.2.1 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EventsServer = void 0;
4
- const nanoid_1 = require("nanoid");
4
+ const crypto_1 = require("crypto");
5
5
  const json_stream_1 = require("../shared/json-stream");
6
6
  const stream_constants_1 = require("../shared/stream-constants");
7
7
  class EventsServer {
8
- serverId = (0, nanoid_1.nanoid)();
8
+ serverId = (0, crypto_1.randomBytes)(16).toString('base64url');
9
9
  responsesMap = new Map();
10
10
  messageQueueMap = new Map();
11
11
  drainingSet = new Set();
@@ -89,7 +89,7 @@ class EventsServer {
89
89
  handleConnect(req, res) {
90
90
  let sessionId = req.getHeader(stream_constants_1.SESSION_ID_KEY).trim();
91
91
  if (!sessionId.startsWith(stream_constants_1.SESSION_ID_PREFIX)) {
92
- sessionId = stream_constants_1.SESSION_ID_PREFIX + (0, nanoid_1.nanoid)(80);
92
+ sessionId = stream_constants_1.SESSION_ID_PREFIX + (0, crypto_1.randomBytes)(60).toString('base64url');
93
93
  }
94
94
  const oldRes = this.responsesMap.get(sessionId);
95
95
  if (oldRes) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "http-air",
3
- "version": "1.2.1",
3
+ "version": "1.3.2",
4
4
  "description": "HTTP library for batched RPC calls and real-time server-push over a single endpoint.",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/yosbelms/http-air",
@@ -23,7 +23,6 @@
23
23
  "author": "",
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
- "nanoid": "^5.1.7",
27
26
  "p-defer": "^3.0.0",
28
27
  "p-retry": "^4.6.2"
29
28
  },