@travetto/auth-session 7.0.0-rc.2 → 7.0.0-rc.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/auth-session",
3
- "version": "7.0.0-rc.2",
3
+ "version": "7.0.0-rc.4",
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.2",
29
- "@travetto/config": "^7.0.0-rc.2",
30
- "@travetto/model": "^7.0.0-rc.2"
28
+ "@travetto/auth": "^7.0.0-rc.4",
29
+ "@travetto/config": "^7.0.0-rc.4",
30
+ "@travetto/model": "^7.0.0-rc.4"
31
31
  },
32
32
  "peerDependencies": {
33
- "@travetto/test": "^7.0.0-rc.2"
33
+ "@travetto/test": "^7.0.0-rc.4"
34
34
  },
35
35
  "peerDependenciesMeta": {
36
36
  "@travetto/test": {
package/src/model.ts CHANGED
@@ -6,7 +6,7 @@ import { Text } from '@travetto/schema';
6
6
  */
7
7
  export const SessionModelSymbol = Symbol.for('@travetto/auth-session:model');
8
8
 
9
- @Model({ autoCreate: false })
9
+ @Model({ autoCreate: 'production' })
10
10
  export class SessionEntry {
11
11
  id: string;
12
12
  @Text()
package/src/service.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Injectable, Inject } from '@travetto/di';
2
- import { Runtime, Util } from '@travetto/runtime';
3
- import { ModelExpirySupport, NotFoundError, ModelStorageUtil } from '@travetto/model';
2
+ import { JSONUtil } from '@travetto/runtime';
3
+ import { ModelExpirySupport, NotFoundError } from '@travetto/model';
4
4
  import { AuthContext, AuthService } from '@travetto/auth';
5
5
 
6
6
  import { Session } from './session.ts';
@@ -28,15 +28,6 @@ export class SessionService {
28
28
  this.#modelService = service;
29
29
  }
30
30
 
31
- /**
32
- * Initialize service if none defined
33
- */
34
- async postConstruct(): Promise<void> {
35
- if (ModelStorageUtil.isSupported(this.#modelService) && Runtime.dynamic) {
36
- await this.#modelService.createModel?.(SessionEntry);
37
- }
38
- }
39
-
40
31
  /**
41
32
  * Load session by id
42
33
  * @returns Session if valid
@@ -47,7 +38,7 @@ export class SessionService {
47
38
 
48
39
  const session = new Session({
49
40
  ...record,
50
- data: Util.decodeSafeJSON(record.data)
41
+ data: JSONUtil.parseBase64(record.data)
51
42
  });
52
43
 
53
44
  // Validate session
@@ -89,7 +80,7 @@ export class SessionService {
89
80
  if (session.action === 'create' || session.isChanged()) {
90
81
  await this.#modelService.upsert(SessionEntry, SessionEntry.from({
91
82
  ...session,
92
- data: Util.encodeSafeJSON(session.data)
83
+ data: JSONUtil.stringifyBase64(session.data)
93
84
  }));
94
85
  }
95
86
  // If destroying