@hardlydifficult/websocket 1.0.8 → 1.0.10

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 +1 @@
1
- {"version":3,"file":"tokenRefresh.d.ts","sourceRoot":"","sources":["../src/tokenRefresh.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,MAAM,CAQR"}
1
+ {"version":3,"file":"tokenRefresh.d.ts","sourceRoot":"","sources":["../src/tokenRefresh.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAChB,MAAM,CAQR"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.calculateTokenRefreshTime = calculateTokenRefreshTime;
4
+ const date_time_1 = require("@hardlydifficult/date-time");
4
5
  /**
5
6
  * Calculate when to schedule proactive token refresh. Uses the later of:
6
7
  *
@@ -19,7 +20,7 @@ exports.calculateTokenRefreshTime = calculateTokenRefreshTime;
19
20
  */
20
21
  function calculateTokenRefreshTime(issuedAt, expiresAt) {
21
22
  const lifetimeMs = expiresAt - issuedAt;
22
- const twoMinutesMs = 2 * 60 * 1000;
23
+ const twoMinutesMs = 2 * date_time_1.MILLISECONDS_PER_MINUTE;
23
24
  const halfLifetime = issuedAt + Math.floor(lifetimeMs / 2);
24
25
  const twoMinutesBefore = expiresAt - twoMinutesMs;
25
26
  return Math.max(halfLifetime, twoMinutesBefore);
@@ -1 +1 @@
1
- {"version":3,"file":"tokenRefresh.js","sourceRoot":"","sources":["../src/tokenRefresh.ts"],"names":[],"mappings":";;AAgBA,8DAWC;AA3BD;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,yBAAyB,CACvC,QAAgB,EAChB,SAAiB;IAEjB,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;IACxC,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;IAEnC,MAAM,YAAY,GAAG,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;IAC3D,MAAM,gBAAgB,GAAG,SAAS,GAAG,YAAY,CAAC;IAElD,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;AAClD,CAAC"}
1
+ {"version":3,"file":"tokenRefresh.js","sourceRoot":"","sources":["../src/tokenRefresh.ts"],"names":[],"mappings":";;AAkBA,8DAWC;AA7BD,0DAAqE;AAErE;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,yBAAyB,CACvC,QAAgB,EAChB,SAAiB;IAEjB,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;IACxC,MAAM,YAAY,GAAG,CAAC,GAAG,mCAAuB,CAAC;IAEjD,MAAM,YAAY,GAAG,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;IAC3D,MAAM,gBAAgB,GAAG,SAAS,GAAG,YAAY,CAAC;IAElD,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;AAClD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardlydifficult/websocket",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -15,6 +15,7 @@
15
15
  "clean": "rm -rf dist"
16
16
  },
17
17
  "dependencies": {
18
+ "@hardlydifficult/date-time": "1.0.15",
18
19
  "ws": "8.19.0"
19
20
  },
20
21
  "devDependencies": {
@@ -31,7 +32,8 @@
31
32
  ".": {
32
33
  "types": "./dist/index.d.ts",
33
34
  "import": "./dist/index.js",
34
- "require": "./dist/index.js"
35
+ "require": "./dist/index.js",
36
+ "default": "./dist/index.js"
35
37
  }
36
38
  }
37
39
  }