@travetto/auth-session 7.0.0-rc.1 → 7.0.0-rc.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.
- package/package.json +5 -5
- package/src/context.ts +4 -4
- package/src/service.ts +7 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/auth-session",
|
|
3
|
-
"version": "7.0.0-rc.
|
|
3
|
+
"version": "7.0.0-rc.2",
|
|
4
4
|
"description": "Session provider for the travetto auth module.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"auth",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"directory": "module/auth-session"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@travetto/auth": "^7.0.0-rc.
|
|
29
|
-
"@travetto/config": "^7.0.0-rc.
|
|
30
|
-
"@travetto/model": "^7.0.0-rc.
|
|
28
|
+
"@travetto/auth": "^7.0.0-rc.2",
|
|
29
|
+
"@travetto/config": "^7.0.0-rc.2",
|
|
30
|
+
"@travetto/model": "^7.0.0-rc.2"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@travetto/test": "^7.0.0-rc.
|
|
33
|
+
"@travetto/test": "^7.0.0-rc.2"
|
|
34
34
|
},
|
|
35
35
|
"peerDependenciesMeta": {
|
|
36
36
|
"@travetto/test": {
|
package/src/context.ts
CHANGED
|
@@ -38,11 +38,11 @@ export class SessionContext {
|
|
|
38
38
|
get(createIfMissing: true): Session;
|
|
39
39
|
get(): Session | undefined;
|
|
40
40
|
get(createIfMissing?: boolean): Session | undefined {
|
|
41
|
-
let
|
|
42
|
-
if (!
|
|
43
|
-
this.set(
|
|
41
|
+
let value = this.#value.get();
|
|
42
|
+
if (!value && createIfMissing) {
|
|
43
|
+
this.set(value = this.#create());
|
|
44
44
|
}
|
|
45
|
-
return
|
|
45
|
+
return value;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/**
|
package/src/service.ts
CHANGED
|
@@ -57,9 +57,9 @@ export class SessionService {
|
|
|
57
57
|
} else {
|
|
58
58
|
return session;
|
|
59
59
|
}
|
|
60
|
-
} catch (
|
|
61
|
-
if (!(
|
|
62
|
-
throw
|
|
60
|
+
} catch (error) {
|
|
61
|
+
if (!(error instanceof NotFoundError)) {
|
|
62
|
+
throw error; // If not a not found error, throw
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -78,12 +78,12 @@ export class SessionService {
|
|
|
78
78
|
// Ensure latest expiry information before persisting
|
|
79
79
|
await this.authService.manageExpiry(this.authContext.principal);
|
|
80
80
|
|
|
81
|
-
const
|
|
81
|
+
const principal = this.authContext.principal;
|
|
82
82
|
|
|
83
83
|
// If not destroying, write to response, and store
|
|
84
|
-
if (
|
|
85
|
-
session.expiresAt =
|
|
86
|
-
session.issuedAt =
|
|
84
|
+
if (principal && session.action !== 'destroy') {
|
|
85
|
+
session.expiresAt = principal.expiresAt;
|
|
86
|
+
session.issuedAt = principal.issuedAt!;
|
|
87
87
|
|
|
88
88
|
// If expiration time has changed, send new session information
|
|
89
89
|
if (session.action === 'create' || session.isChanged()) {
|