@spinajs/session-provider-db 2.0.46 → 2.0.51

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 CHANGED
@@ -1,11 +1,11 @@
1
- # `session-provider-db`
2
-
3
- > TODO: description
4
-
5
- ## Usage
6
-
7
- ```
8
- const sessionProviderDb = require('session-provider-db');
9
-
10
- // TODO: DEMONSTRATE API
11
- ```
1
+ # `session-provider-db`
2
+
3
+ > TODO: description
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ const sessionProviderDb = require('session-provider-db');
9
+
10
+ // TODO: DEMONSTRATE API
11
+ ```
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=session-db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-db.d.ts","sourceRoot":"","sources":["../../src/config/session-db.ts"],"names":[],"mappings":""}
@@ -7,4 +7,5 @@ module.exports = {
7
7
  },
8
8
  },
9
9
  };
10
+ export {};
10
11
  //# sourceMappingURL=session-db.js.map
package/lib/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { SessionProvider, Session, ISession } from '@spinajs/rbac';
2
2
  import { Log } from '@spinajs/log';
3
- export * from './models/DbSession';
4
- export * from './migrations/UserSessionDBSqlMigration_2022_06_28_01_01_01';
3
+ export * from './models/DbSession.js';
4
+ export * from './migrations/UserSessionDBSqlMigration_2022_06_28_01_01_01.js';
5
5
  export declare class DbSessionStore extends SessionProvider {
6
6
  protected Log: Log;
7
7
  protected CleanupInterval: any;
@@ -13,3 +13,4 @@ export declare class DbSessionStore extends SessionProvider {
13
13
  touch(session: ISession): Promise<void>;
14
14
  truncate(): Promise<void>;
15
15
  }
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EAAU,GAAG,EAAE,MAAM,cAAc,CAAC;AAQ3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,+DAA+D,CAAC;AAE9E,qBACa,cAAe,SAAQ,eAAe;IAEjD,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC;IAKnB,SAAS,CAAC,eAAe,EAAE,GAAG,CAAC;IAG/B,SAAS,CAAC,qBAAqB,EAAE,MAAM,CAAC;IAE3B,OAAO;IAQP,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAuB5C,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIxC,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,QAAQ,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BlE,KAAK,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAKvC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGvC"}
package/lib/index.js CHANGED
@@ -1,62 +1,42 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
1
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
14
2
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15
3
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
16
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
17
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18
6
  };
19
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
- };
22
7
  var __metadata = (this && this.__metadata) || function (k, v) {
23
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
24
9
  };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.DbSessionStore = void 0;
30
- const rbac_1 = require("@spinajs/rbac");
31
- const di_1 = require("@spinajs/di");
32
- const log_1 = require("@spinajs/log");
33
- const DbSession_1 = require("./models/DbSession");
34
- const orm_1 = require("@spinajs/orm");
35
- const util_1 = require("@spinajs/util");
36
- const configuration_1 = require("@spinajs/configuration");
37
- const luxon_1 = require("luxon");
38
- const lodash_1 = __importDefault(require("lodash"));
39
- __exportStar(require("./models/DbSession"), exports);
40
- __exportStar(require("./migrations/UserSessionDBSqlMigration_2022_06_28_01_01_01"), exports);
41
- let DbSessionStore = class DbSessionStore extends rbac_1.SessionProvider {
10
+ import { SessionProvider, Session } from '@spinajs/rbac';
11
+ import { Injectable } from '@spinajs/di';
12
+ import { Logger, Log } from '@spinajs/log';
13
+ import { DbSession } from './models/DbSession.js';
14
+ import { InsertBehaviour } from '@spinajs/orm';
15
+ import { replacer } from '@spinajs/util';
16
+ import { Config } from '@spinajs/configuration';
17
+ import { DateTime } from 'luxon';
18
+ import _ from 'lodash';
19
+ export * from './models/DbSession.js';
20
+ export * from './migrations/UserSessionDBSqlMigration_2022_06_28_01_01_01.js';
21
+ let DbSessionStore = class DbSessionStore extends SessionProvider {
42
22
  async resolve() {
43
23
  setInterval(async () => {
44
- const c = await DbSession_1.DbSession.destroy().where('Expiration', '<=', luxon_1.DateTime.now());
24
+ const c = await DbSession.destroy().where('Expiration', '<=', DateTime.now());
45
25
  this.Log.info(`Cleaned up expired session, count: ${c}`);
46
26
  }, this.CleanupInterval);
47
27
  }
48
28
  async restore(sessionId) {
49
- const session = await DbSession_1.DbSession.where({
29
+ const session = await DbSession.where({
50
30
  SessionId: sessionId,
51
31
  }).first();
52
32
  if (!session) {
53
33
  return null;
54
34
  }
55
- if (session.Expiration < luxon_1.DateTime.now()) {
35
+ if (session.Expiration < DateTime.now()) {
56
36
  return null;
57
37
  }
58
38
  const sData = JSON.parse(session.Data);
59
- return new rbac_1.Session({
39
+ return new Session({
60
40
  SessionId: session.SessionId,
61
41
  Creation: session.CreatedAt,
62
42
  Data: new Map(Object.entries(sData)),
@@ -64,14 +44,14 @@ let DbSessionStore = class DbSessionStore extends rbac_1.SessionProvider {
64
44
  });
65
45
  }
66
46
  async delete(sessionId) {
67
- await DbSession_1.DbSession.destroy(sessionId);
47
+ await DbSession.destroy(sessionId);
68
48
  }
69
49
  async save(sessionOrId, data) {
70
50
  let sId = '';
71
51
  let sData = null;
72
- let sCreationTime = luxon_1.DateTime.now();
73
- let sExpirationTime = luxon_1.DateTime.now().plus({ minutes: this.DefaultExpirationTime });
74
- if (lodash_1.default.isString(sessionOrId)) {
52
+ let sCreationTime = DateTime.now();
53
+ let sExpirationTime = DateTime.now().plus({ minutes: this.DefaultExpirationTime });
54
+ if (_.isString(sessionOrId)) {
75
55
  sId = sessionOrId;
76
56
  sData = data;
77
57
  }
@@ -81,39 +61,39 @@ let DbSessionStore = class DbSessionStore extends rbac_1.SessionProvider {
81
61
  sCreationTime = sessionOrId.Creation;
82
62
  sExpirationTime = sessionOrId.Expiration;
83
63
  }
84
- const session = new DbSession_1.DbSession({
64
+ const session = new DbSession({
85
65
  SessionId: sId,
86
66
  CreatedAt: sCreationTime,
87
67
  Expiration: sExpirationTime,
88
- Data: JSON.stringify(sData, util_1.replacer),
68
+ Data: JSON.stringify(sData, replacer),
89
69
  });
90
- await session.insert(orm_1.InsertBehaviour.InsertOrUpdate);
70
+ await session.insert(InsertBehaviour.InsertOrUpdate);
91
71
  }
92
72
  async touch(session) {
93
- await DbSession_1.DbSession.update({
73
+ await DbSession.update({
94
74
  Expiration: session.Expiration,
95
75
  }).where('SessionId', session.SessionId);
96
76
  }
97
77
  async truncate() {
98
- await DbSession_1.DbSession.truncate();
78
+ await DbSession.truncate();
99
79
  }
100
80
  };
101
81
  __decorate([
102
- (0, log_1.Logger)('db-session-store'),
103
- __metadata("design:type", log_1.Log)
82
+ Logger('db-session-store'),
83
+ __metadata("design:type", Log)
104
84
  ], DbSessionStore.prototype, "Log", void 0);
105
85
  __decorate([
106
- (0, configuration_1.Config)('rbac.session.db.cleanupInteval', {
86
+ Config('rbac.session.db.cleanupInteval', {
107
87
  defaultValue: 100000,
108
88
  }),
109
89
  __metadata("design:type", Object)
110
90
  ], DbSessionStore.prototype, "CleanupInterval", void 0);
111
91
  __decorate([
112
- (0, configuration_1.Config)('rbac.session.expiration'),
92
+ Config('rbac.session.expiration'),
113
93
  __metadata("design:type", Number)
114
94
  ], DbSessionStore.prototype, "DefaultExpirationTime", void 0);
115
95
  DbSessionStore = __decorate([
116
- (0, di_1.Injectable)(rbac_1.SessionProvider)
96
+ Injectable(SessionProvider)
117
97
  ], DbSessionStore);
118
- exports.DbSessionStore = DbSessionStore;
98
+ export { DbSessionStore };
119
99
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAmE;AACnE,oCAAyC;AACzC,sCAA2C;AAC3C,kDAA+C;AAC/C,sCAA+C;AAC/C,wCAAyC;AACzC,0DAAgD;AAChD,iCAAiC;AACjC,oDAAuB;AAEvB,qDAAmC;AACnC,6FAA2E;AAG3E,IAAa,cAAc,GAA3B,MA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AC,UAAU,CAAC;SAC1C;QAED,MAAM,OAAO,GAAG,IAAI,SAAS,CAAC;YAC5B,SAAS,EAAE,GAAG;YACd,SAAS,EAAE,aAAa;YACxB,UAAU,EAAE,eAAe;YAC3B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC;SACtC,CAAC,CAAC;QAEH,MAAM,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,KAAK,CAAC,OAAiB;QAClC,MAAM,SAAS,CAAC,MAAM,CAAC;YACrB,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;IACM,KAAK,CAAC,QAAQ;QACnB,MAAM,SAAS,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;CACF,CAAA;AAhFC;IAAC,MAAM,CAAC,kBAAkB,CAAC;8BACZ,GAAG;2CAAC;AAEnB;IAAC,MAAM,CAAC,gCAAgC,EAAE;QACxC,YAAY,EAAE,MAAM;KACrB,CAAC;;uDAC6B;AAE/B;IAAC,MAAM,CAAC,yBAAyB,CAAC;;6DACM;AAV7B,cAAc;IAD1B,UAAU,CAAC,eAAe,CAAC;GACf,cAAc,CAiF1B;SAjFY,cAAc"}
@@ -3,3 +3,4 @@ export declare class UserSessionDBSqlMigration_2022_06_28_01_01_01 extends OrmMi
3
3
  up(connection: OrmDriver): Promise<void>;
4
4
  down(_: OrmDriver): Promise<void>;
5
5
  }
6
+ //# sourceMappingURL=UserSessionDBSqlMigration_2022_06_28_01_01_01.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserSessionDBSqlMigration_2022_06_28_01_01_01.d.ts","sourceRoot":"","sources":["../../src/migrations/UserSessionDBSqlMigration_2022_06_28_01_01_01.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAElE,qBACa,6CAA8C,SAAQ,YAAY;IAChE,EAAE,CAAC,UAAU,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAaxC,IAAI,CAAC,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;CAC/C"}
@@ -1,14 +1,11 @@
1
- "use strict";
2
1
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
2
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
3
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
6
  };
8
- Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.UserSessionDBSqlMigration_2022_06_28_01_01_01 = void 0;
10
- const orm_1 = require("@spinajs/orm");
11
- let UserSessionDBSqlMigration_2022_06_28_01_01_01 = class UserSessionDBSqlMigration_2022_06_28_01_01_01 extends orm_1.OrmMigration {
7
+ import { Migration, OrmMigration } from '@spinajs/orm';
8
+ let UserSessionDBSqlMigration_2022_06_28_01_01_01 = class UserSessionDBSqlMigration_2022_06_28_01_01_01 extends OrmMigration {
12
9
  async up(connection) {
13
10
  await connection.schema().createTable('user_sessions', (table) => {
14
11
  table.string('SessionId', 36).primaryKey().notNull();
@@ -23,7 +20,7 @@ let UserSessionDBSqlMigration_2022_06_28_01_01_01 = class UserSessionDBSqlMigrat
23
20
  async down(_) { }
24
21
  };
25
22
  UserSessionDBSqlMigration_2022_06_28_01_01_01 = __decorate([
26
- (0, orm_1.Migration)('session-provider-connection')
23
+ Migration('session-provider-connection')
27
24
  ], UserSessionDBSqlMigration_2022_06_28_01_01_01);
28
- exports.UserSessionDBSqlMigration_2022_06_28_01_01_01 = UserSessionDBSqlMigration_2022_06_28_01_01_01;
25
+ export { UserSessionDBSqlMigration_2022_06_28_01_01_01 };
29
26
  //# sourceMappingURL=UserSessionDBSqlMigration_2022_06_28_01_01_01.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserSessionDBSqlMigration_2022_06_28_01_01_01.js","sourceRoot":"","sources":["../../src/migrations/UserSessionDBSqlMigration_2022_06_28_01_01_01.ts"],"names":[],"mappings":";;;;;;;;;AAAA,sCAAkE;AAGlE,IAAa,6CAA6C,GAA1D,MAAa,6CAA8C,SAAQ,kBAAY;IACtE,KAAK,CAAC,EAAE,CAAC,UAAqB;QACnC,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;YAC/D,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,CAAC;YACrD,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACzB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;QAC/B,CAAC,CAAC,CAAC;QAEH,gGAAgG;QAChG,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACtH,CAAC;IAED,qCAAqC;IAC9B,KAAK,CAAC,IAAI,CAAC,CAAY,IAAkB,CAAC;CAClD,CAAA;AAfY,6CAA6C;IADzD,IAAA,eAAS,EAAC,6BAA6B,CAAC;GAC5B,6CAA6C,CAezD;AAfY,sGAA6C"}
1
+ {"version":3,"file":"UserSessionDBSqlMigration_2022_06_28_01_01_01.js","sourceRoot":"","sources":["../../src/migrations/UserSessionDBSqlMigration_2022_06_28_01_01_01.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAa,MAAM,cAAc,CAAC;AAG3D,IAAM,6CAA6C,GAAnD,MAAM,6CAA8C,SAAQ,YAAY;IACtE,KAAK,CAAC,EAAE,CAAC,UAAqB;QACnC,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;YAC/D,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,CAAC;YACrD,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,CAAC;YAClC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACzB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,CAAC;QAC/B,CAAC,CAAC,CAAC;QAEH,gGAAgG;QAChG,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACtH,CAAC;IAED,qCAAqC;IAC9B,KAAK,CAAC,IAAI,CAAC,CAAY,IAAkB,CAAC;CAClD,CAAA;AAfY,6CAA6C;IADzD,SAAS,CAAC,6BAA6B,CAAC;GAC5B,6CAA6C,CAezD;SAfY,6CAA6C"}
@@ -6,3 +6,4 @@ export declare class DbSession extends ModelBase {
6
6
  Expiration: DateTime;
7
7
  Data: string;
8
8
  }
9
+ //# sourceMappingURL=DbSession.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DbSession.d.ts","sourceRoot":"","sources":["../../src/models/DbSession.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAyD,MAAM,cAAc,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,qBAEa,SAAU,SAAQ,SAAS;IAE/B,SAAS,EAAE,MAAM,CAAC;IAGlB,SAAS,EAAE,QAAQ,CAAC;IAGpB,UAAU,EAAE,QAAQ,CAAC;IAErB,IAAI,EAAE,MAAM,CAAC;CACrB"}
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
2
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
3
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -8,27 +7,25 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
7
  var __metadata = (this && this.__metadata) || function (k, v) {
9
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
9
  };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.DbSession = void 0;
13
- const orm_1 = require("@spinajs/orm");
14
- const luxon_1 = require("luxon");
15
- let DbSession = class DbSession extends orm_1.ModelBase {
10
+ import { ModelBase, Primary, Connection, Model, CreatedAt, DateTime as DT } from '@spinajs/orm';
11
+ import { DateTime } from 'luxon';
12
+ let DbSession = class DbSession extends ModelBase {
16
13
  };
17
14
  __decorate([
18
- (0, orm_1.Primary)(),
15
+ Primary(),
19
16
  __metadata("design:type", String)
20
17
  ], DbSession.prototype, "SessionId", void 0);
21
18
  __decorate([
22
- (0, orm_1.CreatedAt)(),
23
- __metadata("design:type", luxon_1.DateTime)
19
+ CreatedAt(),
20
+ __metadata("design:type", DateTime)
24
21
  ], DbSession.prototype, "CreatedAt", void 0);
25
22
  __decorate([
26
- (0, orm_1.DateTime)(),
27
- __metadata("design:type", luxon_1.DateTime)
23
+ DT(),
24
+ __metadata("design:type", DateTime)
28
25
  ], DbSession.prototype, "Expiration", void 0);
29
26
  DbSession = __decorate([
30
- (0, orm_1.Connection)('session-provider-connection'),
31
- (0, orm_1.Model)('user_sessions')
27
+ Connection('session-provider-connection'),
28
+ Model('user_sessions')
32
29
  ], DbSession);
33
- exports.DbSession = DbSession;
30
+ export { DbSession };
34
31
  //# sourceMappingURL=DbSession.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DbSession.js","sourceRoot":"","sources":["../../src/models/DbSession.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAAgG;AAChG,iCAAiC;AAGjC,IAAa,SAAS,GAAtB,MAAa,SAAU,SAAQ,eAAS;CAWvC,CAAA;AATC;IADC,IAAA,aAAO,GAAE;;4CACe;AAGzB;IADC,IAAA,eAAS,GAAE;8BACM,gBAAQ;4CAAC;AAG3B;IADC,IAAA,cAAE,GAAE;8BACc,gBAAQ;6CAAC;AARjB,SAAS;IAFrB,IAAA,gBAAU,EAAC,6BAA6B,CAAC;IACzC,IAAA,WAAK,EAAC,eAAe,CAAC;GACV,SAAS,CAWrB;AAXY,8BAAS"}
1
+ {"version":3,"file":"DbSession.js","sourceRoot":"","sources":["../../src/models/DbSession.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,cAAc,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG1B,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,SAAS;CAWvC,CAAA;AAVC;IAAC,OAAO,EAAE;;4CACe;AAEzB;IAAC,SAAS,EAAE;8BACM,QAAQ;4CAAC;AAE3B;IAAC,EAAE,EAAE;8BACc,QAAQ;6CAAC;AARjB,SAAS;IAFrB,UAAU,CAAC,6BAA6B,CAAC;IACzC,KAAK,CAAC,eAAe,CAAC;GACV,SAAS,CAWrB;SAXY,SAAS"}
package/package.json CHANGED
@@ -1,54 +1,58 @@
1
- {
2
- "name": "@spinajs/session-provider-db",
3
- "version": "2.0.46",
4
- "description": "Simple session provider based on relational db. Usefull for testing or small projects",
5
- "main": "lib/index.js",
6
- "private": false,
7
- "scripts": {
8
- "build": "npm run clean && npm run compile",
9
- "compile": "tsc -p tsconfig.build.json",
10
- "clean": "",
11
- "test": "ts-mocha -p tsconfig.json test/**/*.test.ts",
12
- "coverage": "nyc npm run test",
13
- "build-docs": "rimraf docs && typedoc --options typedoc.json src/",
14
- "prepare": "npm run build",
15
- "format": "prettier --write \"src/**/*.ts\"",
16
- "lint": "eslint -c .eslintrc.js --ext .ts src --fix",
17
- "prepublishOnly": "npm test && npm run lint",
18
- "preversion": "npm run lint",
19
- "version": "npm run format && git add -A src",
20
- "postversion": "git push && git push --tags"
21
- },
22
- "files": [
23
- "lib/**/*"
24
- ],
25
- "types": "lib",
26
- "repository": {
27
- "type": "git",
28
- "url": "git+https://github.com/spinajs/main.git"
29
- },
30
- "keywords": [
31
- "spinajs",
32
- "rbac"
33
- ],
34
- "author": "SpinaJS <spinajs@coderush.pl> (https://github.com/spinajs/main)",
35
- "license": "MIT",
36
- "bugs": {
37
- "url": "https://github.com/spinajs/main/issues"
38
- },
39
- "homepage": "https://github.com/spinajs/main#readme",
40
- "dependencies": {
41
- "@spinajs/configuration": "^2.0.46",
42
- "@spinajs/di": "^2.0.46",
43
- "@spinajs/exceptions": "^2.0.39",
44
- "@spinajs/log": "^2.0.46",
45
- "@spinajs/orm": "^2.0.46",
46
- "@spinajs/rbac": "^2.0.46",
47
- "@spinajs/reflection": "^2.0.46",
48
- "luxon": "^2.4.0"
49
- },
50
- "devDependencies": {
51
- "@spinajs/orm-sqlite": "^2.0.46"
52
- },
53
- "gitHead": "bd560afd6c9a156071102cc6b4f36115b5498e9d"
54
- }
1
+ {
2
+ "name": "@spinajs/session-provider-db",
3
+ "version": "2.0.51",
4
+ "description": "Simple session provider based on relational db. Usefull for testing or small projects",
5
+ "exports": "./lib/index.js",
6
+ "type": "module",
7
+ "private": false,
8
+ "engines": {
9
+ "node": ">=16.11"
10
+ },
11
+ "scripts": {
12
+ "build": "npm run clean && npm run compile",
13
+ "compile": "tsc -b tsconfig.json",
14
+ "rimraf": "./node_modules/rimraf/bin.js",
15
+ "clean": "rimraf lib/ && rimraf tsconfig.tsbuildinfo",
16
+ "test": "ts-mocha -p tsconfig.json test/**/*.test.ts",
17
+ "coverage": "nyc npm run test",
18
+ "build-docs": "rimraf docs && typedoc --options typedoc.json src/",
19
+ "format": "prettier --write \"src/**/*.ts\"",
20
+ "lint": "eslint -c .eslintrc.cjs --ext .ts src --fix",
21
+ "preversion": "npm run lint",
22
+ "version": "npm run format && git add -A src"
23
+
24
+ },
25
+ "files": [
26
+ "lib/**/*"
27
+ ],
28
+ "types": "lib",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/spinajs/main.git"
32
+ },
33
+ "keywords": [
34
+ "spinajs",
35
+ "rbac"
36
+ ],
37
+ "author": "SpinaJS <spinajs@coderush.pl> (https://github.com/spinajs/main)",
38
+ "license": "MIT",
39
+ "bugs": {
40
+ "url": "https://github.com/spinajs/main/issues"
41
+ },
42
+ "homepage": "https://github.com/spinajs/main#readme",
43
+ "dependencies": {
44
+ "@spinajs/configuration": "^2.0.46",
45
+ "@spinajs/di": "^2.0.46",
46
+ "@spinajs/exceptions": "^2.0.39",
47
+ "@spinajs/log": "^2.0.46",
48
+ "@spinajs/orm": "^2.0.46",
49
+ "@spinajs/rbac": "^2.0.46",
50
+ "@spinajs/reflection": "^2.0.46",
51
+ "@spinajs/util": "^2.0.46",
52
+ "luxon": "^3.2.1"
53
+ },
54
+ "devDependencies": {
55
+ "@spinajs/orm-sqlite": "^2.0.46"
56
+ },
57
+ "gitHead": "002dc553b0ffffd72193d0121ac425a4083bc9ee"
58
+ }