@nxgt/janus 0.24.0 → 0.25.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.
- package/README.md +24 -10
- package/dist/auth/outage.d.ts +2 -2
- package/dist/auth/port/assert-stores.d.ts.map +1 -1
- package/dist/auth/port/memory/tokens.d.ts.map +1 -1
- package/dist/auth/port/types/stores.d.ts +2 -0
- package/dist/auth/port/types/stores.d.ts.map +1 -1
- package/dist/auth/port/types/tokens.d.ts +12 -0
- package/dist/auth/port/types/tokens.d.ts.map +1 -1
- package/dist/auth/sessions/collect-expired.d.ts +14 -0
- package/dist/auth/sessions/collect-expired.d.ts.map +1 -0
- package/dist/auth/sessions/shared-api.d.ts +1 -1
- package/dist/auth/sessions/shared-api.d.ts.map +1 -1
- package/dist/auth/types/janus.d.ts +4 -3
- package/dist/auth/types/janus.d.ts.map +1 -1
- package/dist/chunks/{index-6bjfv4xv.js → index-q3w3vr69.js} +13 -3
- package/dist/chunks/{index-6bjfv4xv.js.map → index-q3w3vr69.js.map} +3 -3
- package/dist/chunks/{index-cntabs9d.js → index-rpp0bw6e.js} +2 -2
- package/dist/chunks/{index-kppkcbn5.js → index-spwh8b9z.js} +2 -5
- package/dist/chunks/{index-kppkcbn5.js.map → index-spwh8b9z.js.map} +2 -2
- package/dist/chunks/{index-4khsm7mw.js → index-y9b327j8.js} +18 -18
- package/dist/chunks/{index-4khsm7mw.js.map → index-y9b327j8.js.map} +5 -5
- package/dist/conformance/cases/outage.d.ts.map +1 -1
- package/dist/conformance/cases/tokens/deletion.d.ts.map +1 -1
- package/dist/conformance/describe.d.ts +1 -0
- package/dist/conformance/describe.d.ts.map +1 -1
- package/dist/conformance/index.js +39 -5
- package/dist/conformance/index.js.map +5 -5
- package/dist/conformance/types.d.ts +1 -1
- package/dist/conformance/types.d.ts.map +1 -1
- package/dist/index.js +19 -9
- package/dist/index.js.map +7 -6
- package/dist/permissions/index.js +3 -3
- package/docs/guide/adapters.md +40 -3
- package/docs/guide/email-flows.md +2 -2
- package/docs/guide/errors.md +1 -1
- package/docs/guide/passwords.md +7 -10
- package/docs/guide/sessions.md +15 -4
- package/docs/roadmap.md +8 -8
- package/docs/troubleshooting.md +6 -6
- package/package.json +1 -1
- /package/dist/chunks/{index-cntabs9d.js.map → index-rpp0bw6e.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -7,13 +7,13 @@ import {
|
|
|
7
7
|
MAX_PAGE_SIZE2,
|
|
8
8
|
pageLimit2,
|
|
9
9
|
invalidCursor2
|
|
10
|
-
} from "./chunks/index-
|
|
10
|
+
} from "./chunks/index-y9b327j8.js";
|
|
11
11
|
import {
|
|
12
12
|
mintId2,
|
|
13
13
|
isId2,
|
|
14
14
|
mintedAt2,
|
|
15
15
|
createMemoryStores2
|
|
16
|
-
} from "./chunks/index-
|
|
16
|
+
} from "./chunks/index-q3w3vr69.js";
|
|
17
17
|
import {
|
|
18
18
|
JanusError2,
|
|
19
19
|
UserInvalidError2,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
formatTuple2,
|
|
40
40
|
parseTuple2,
|
|
41
41
|
parseSubject2
|
|
42
|
-
} from "./chunks/index-
|
|
42
|
+
} from "./chunks/index-spwh8b9z.js";
|
|
43
43
|
|
|
44
44
|
// src/auth/hashers.ts
|
|
45
45
|
import { randomBytes, scrypt, timingSafeEqual } from "node:crypto";
|
|
@@ -794,6 +794,7 @@ function assertStores(stores, where) {
|
|
|
794
794
|
const slots = stores;
|
|
795
795
|
return {
|
|
796
796
|
collectExpired: optional(slots, "sessions", "deleteExpiredSessions", where),
|
|
797
|
+
collectExpiredTokens: optional(slots, "tokens", "deleteExpiredTokens", where),
|
|
797
798
|
findUsers: optional(slots, "users", "findUsers", where)
|
|
798
799
|
};
|
|
799
800
|
}
|
|
@@ -1023,6 +1024,19 @@ function renewalDue(type, session, now) {
|
|
|
1023
1024
|
return type.renewAfterMs !== null && type.lifespanMs - (session.expiresAt.getTime() - now) >= type.renewAfterMs;
|
|
1024
1025
|
}
|
|
1025
1026
|
|
|
1027
|
+
// src/auth/sessions/collect-expired.ts
|
|
1028
|
+
async function collectExpired(context) {
|
|
1029
|
+
const { store, clock, capabilities } = context;
|
|
1030
|
+
const sessions = capabilities.collectExpired ? store.sessions.deleteExpiredSessions : undefined;
|
|
1031
|
+
const tokens = capabilities.collectExpiredTokens ? store.tokens.deleteExpiredTokens : undefined;
|
|
1032
|
+
if (sessions === undefined && tokens === undefined) {
|
|
1033
|
+
throw new UnsupportedError2("collectExpired: store.sessions does not implement deleteExpiredSessions, nor store.tokens deleteExpiredTokens — their stores expire records on their own, or implement the methods", { slot: "sessions", operation: "deleteExpiredSessions" });
|
|
1034
|
+
}
|
|
1035
|
+
const before = clock.now();
|
|
1036
|
+
const collected = sessions === undefined ? 0 : await sessions(before);
|
|
1037
|
+
return collected + (tokens === undefined ? 0 : await tokens(before));
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1026
1040
|
// src/auth/sessions/cookie.ts
|
|
1027
1041
|
function cookieOf(context) {
|
|
1028
1042
|
const { name, domain, path, sameSite, secure } = context.config.cookie;
|
|
@@ -1071,11 +1085,7 @@ function sharedApi(context) {
|
|
|
1071
1085
|
},
|
|
1072
1086
|
cookie: cookieOf(context),
|
|
1073
1087
|
async collectExpired() {
|
|
1074
|
-
|
|
1075
|
-
if (!context.capabilities.collectExpired || collect === undefined) {
|
|
1076
|
-
throw new UnsupportedError2("collectExpired: store.sessions does not implement deleteExpiredSessions — its store expires sessions on its own, or implement the method", { slot: "sessions", operation: "deleteExpiredSessions" });
|
|
1077
|
-
}
|
|
1078
|
-
return collect(clock.now());
|
|
1088
|
+
return collectExpired(context);
|
|
1079
1089
|
},
|
|
1080
1090
|
types: [...config.types.keys()]
|
|
1081
1091
|
};
|
|
@@ -2864,5 +2874,5 @@ export {
|
|
|
2864
2874
|
systemClock
|
|
2865
2875
|
};
|
|
2866
2876
|
|
|
2867
|
-
//# debugId=
|
|
2877
|
+
//# debugId=D10ED7160A09120864756E2164756E21
|
|
2868
2878
|
//# sourceMappingURL=index.js.map
|