@spinajs/session-provider-db 2.0.180 → 2.0.182

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,11 +1,11 @@
1
- declare const sessionDb: {
2
- rbac: {
3
- session: {
4
- db: {
5
- cleanupInterval: number;
6
- };
7
- };
8
- };
9
- };
10
- export default sessionDb;
1
+ declare const sessionDb: {
2
+ rbac: {
3
+ session: {
4
+ db: {
5
+ cleanupInterval: number;
6
+ };
7
+ };
8
+ };
9
+ };
10
+ export default sessionDb;
11
11
  //# sourceMappingURL=session-db.d.ts.map
@@ -1,13 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const sessionDb = {
4
- rbac: {
5
- session: {
6
- db: {
7
- cleanupInterval: 10 * 60 * 1000,
8
- },
9
- },
10
- },
11
- };
12
- exports.default = sessionDb;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sessionDb = {
4
+ rbac: {
5
+ session: {
6
+ db: {
7
+ cleanupInterval: 10 * 60 * 1000,
8
+ },
9
+ },
10
+ },
11
+ };
12
+ exports.default = sessionDb;
13
13
  //# sourceMappingURL=session-db.js.map
@@ -1,16 +1,16 @@
1
- import { SessionProvider, Session, ISession } from '@spinajs/rbac';
2
- import { Log } from '@spinajs/log';
3
- export * from './models/DbSession.js';
4
- export * from './migrations/UserSessionDBSqlMigration_2022_06_28_01_01_01.js';
5
- export declare class DbSessionStore extends SessionProvider {
6
- protected Log: Log;
7
- protected CleanupInterval: any;
8
- protected DefaultExpirationTime: number;
9
- resolve(): Promise<void>;
10
- restore(sessionId: string): Promise<Session>;
11
- delete(sessionId: string): Promise<void>;
12
- save(sessionOrId: string | ISession, data?: object): Promise<void>;
13
- touch(session: ISession): Promise<void>;
14
- truncate(): Promise<void>;
15
- }
1
+ import { SessionProvider, Session, ISession } from '@spinajs/rbac';
2
+ import { Log } from '@spinajs/log';
3
+ export * from './models/DbSession.js';
4
+ export * from './migrations/UserSessionDBSqlMigration_2022_06_28_01_01_01.js';
5
+ export declare class DbSessionStore extends SessionProvider {
6
+ protected Log: Log;
7
+ protected CleanupInterval: any;
8
+ protected DefaultExpirationTime: number;
9
+ resolve(): Promise<void>;
10
+ restore(sessionId: string): Promise<Session>;
11
+ delete(sessionId: string): Promise<void>;
12
+ save(sessionOrId: string | ISession, data?: object): Promise<void>;
13
+ touch(session: ISession): Promise<void>;
14
+ truncate(): Promise<void>;
15
+ }
16
16
  //# sourceMappingURL=index.d.ts.map
package/lib/cjs/index.js CHANGED
@@ -1,119 +1,119 @@
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
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
14
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
16
- 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
- return c > 3 && r && Object.defineProperty(target, key, r), r;
18
- };
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
- var __metadata = (this && this.__metadata) || function (k, v) {
23
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
24
- };
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_js_1 = require("./models/DbSession.js");
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.js"), exports);
40
- __exportStar(require("./migrations/UserSessionDBSqlMigration_2022_06_28_01_01_01.js"), exports);
41
- let DbSessionStore = class DbSessionStore extends rbac_1.SessionProvider {
42
- async resolve() {
43
- setInterval(async () => {
44
- const c = await DbSession_js_1.DbSession.destroy().where('Expiration', '<=', luxon_1.DateTime.now());
45
- this.Log.info(`Cleaned up expired session, count: ${c.RowsAffected}`);
46
- }, this.CleanupInterval);
47
- }
48
- async restore(sessionId) {
49
- const session = await DbSession_js_1.DbSession.where({
50
- SessionId: sessionId,
51
- }).first();
52
- if (!session) {
53
- return null;
54
- }
55
- if (session.Expiration < luxon_1.DateTime.now()) {
56
- return null;
57
- }
58
- const sData = JSON.parse(session.Data);
59
- return new rbac_1.Session({
60
- SessionId: session.SessionId,
61
- Creation: session.CreatedAt,
62
- Data: new Map(Object.entries(sData)),
63
- Expiration: session.Expiration,
64
- });
65
- }
66
- async delete(sessionId) {
67
- await DbSession_js_1.DbSession.destroy(sessionId);
68
- }
69
- async save(sessionOrId, data) {
70
- let sId = '';
71
- 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)) {
75
- sId = sessionOrId;
76
- sData = data;
77
- }
78
- else {
79
- sId = sessionOrId.SessionId;
80
- sData = Object.fromEntries(sessionOrId.Data);
81
- sCreationTime = sessionOrId.Creation;
82
- sExpirationTime = sessionOrId.Expiration;
83
- }
84
- const session = new DbSession_js_1.DbSession({
85
- SessionId: sId,
86
- CreatedAt: sCreationTime,
87
- Expiration: sExpirationTime,
88
- Data: JSON.stringify(sData, util_1.replacer),
89
- });
90
- await session.insert(orm_1.InsertBehaviour.InsertOrUpdate);
91
- }
92
- async touch(session) {
93
- await DbSession_js_1.DbSession.update({
94
- Expiration: session.Expiration,
95
- }).where('SessionId', session.SessionId);
96
- }
97
- async truncate() {
98
- await DbSession_js_1.DbSession.truncate();
99
- }
100
- };
101
- __decorate([
102
- (0, log_1.Logger)('db-session-store'),
103
- __metadata("design:type", log_1.Log)
104
- ], DbSessionStore.prototype, "Log", void 0);
105
- __decorate([
106
- (0, configuration_1.Config)('rbac.session.db.cleanupInteval', {
107
- defaultValue: 100000,
108
- }),
109
- __metadata("design:type", Object)
110
- ], DbSessionStore.prototype, "CleanupInterval", void 0);
111
- __decorate([
112
- (0, configuration_1.Config)('rbac.session.expiration'),
113
- __metadata("design:type", Number)
114
- ], DbSessionStore.prototype, "DefaultExpirationTime", void 0);
115
- DbSessionStore = __decorate([
116
- (0, di_1.Injectable)(rbac_1.SessionProvider)
117
- ], DbSessionStore);
118
- exports.DbSessionStore = DbSessionStore;
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
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
14
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
15
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
16
+ 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
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
18
+ };
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
+ var __metadata = (this && this.__metadata) || function (k, v) {
23
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
24
+ };
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_js_1 = require("./models/DbSession.js");
34
+ const orm_1 = require("@spinajs/orm");
35
+ const configuration_1 = require("@spinajs/configuration");
36
+ const luxon_1 = require("luxon");
37
+ const lodash_1 = __importDefault(require("lodash"));
38
+ const util_1 = require("@spinajs/util");
39
+ __exportStar(require("./models/DbSession.js"), exports);
40
+ __exportStar(require("./migrations/UserSessionDBSqlMigration_2022_06_28_01_01_01.js"), exports);
41
+ let DbSessionStore = class DbSessionStore extends rbac_1.SessionProvider {
42
+ async resolve() {
43
+ setInterval(async () => {
44
+ const c = await DbSession_js_1.DbSession.destroy().where('Expiration', '<=', luxon_1.DateTime.now());
45
+ this.Log.info(`Cleaned up expired session, count: ${c.RowsAffected}`);
46
+ }, this.CleanupInterval);
47
+ }
48
+ async restore(sessionId) {
49
+ const session = await DbSession_js_1.DbSession.where({
50
+ SessionId: sessionId,
51
+ }).first();
52
+ if (!session) {
53
+ return null;
54
+ }
55
+ if (session.Expiration < luxon_1.DateTime.now()) {
56
+ return null;
57
+ }
58
+ const sData = JSON.parse(session.Data);
59
+ return new rbac_1.Session({
60
+ SessionId: session.SessionId,
61
+ Creation: session.CreatedAt,
62
+ Data: new Map(Object.entries(sData)),
63
+ Expiration: session.Expiration,
64
+ });
65
+ }
66
+ async delete(sessionId) {
67
+ await DbSession_js_1.DbSession.destroy(sessionId);
68
+ }
69
+ async save(sessionOrId, data) {
70
+ let sId = '';
71
+ 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)) {
75
+ sId = sessionOrId;
76
+ sData = data;
77
+ }
78
+ else {
79
+ sId = sessionOrId.SessionId;
80
+ sData = Object.fromEntries(sessionOrId.Data);
81
+ sCreationTime = sessionOrId.Creation;
82
+ sExpirationTime = sessionOrId.Expiration;
83
+ }
84
+ const session = new DbSession_js_1.DbSession({
85
+ SessionId: sId,
86
+ CreatedAt: sCreationTime,
87
+ Expiration: sExpirationTime,
88
+ Data: JSON.stringify(sData, util_1.replacer),
89
+ });
90
+ await session.insert(orm_1.InsertBehaviour.InsertOrUpdate);
91
+ }
92
+ async touch(session) {
93
+ await DbSession_js_1.DbSession.update({
94
+ Expiration: session.Expiration,
95
+ }).where('SessionId', session.SessionId);
96
+ }
97
+ async truncate() {
98
+ await DbSession_js_1.DbSession.truncate();
99
+ }
100
+ };
101
+ exports.DbSessionStore = DbSessionStore;
102
+ __decorate([
103
+ (0, log_1.Logger)('db-session-store'),
104
+ __metadata("design:type", log_1.Log)
105
+ ], DbSessionStore.prototype, "Log", void 0);
106
+ __decorate([
107
+ (0, configuration_1.Config)('rbac.session.db.cleanupInteval', {
108
+ defaultValue: 100000,
109
+ }),
110
+ __metadata("design:type", Object)
111
+ ], DbSessionStore.prototype, "CleanupInterval", void 0);
112
+ __decorate([
113
+ (0, configuration_1.Config)('rbac.session.expiration'),
114
+ __metadata("design:type", Number)
115
+ ], DbSessionStore.prototype, "DefaultExpirationTime", void 0);
116
+ exports.DbSessionStore = DbSessionStore = __decorate([
117
+ (0, di_1.Injectable)(rbac_1.SessionProvider)
118
+ ], DbSessionStore);
119
119
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAmE;AACnE,oCAAyC;AACzC,sCAA2C;AAC3C,wDAAkD;AAClD,sCAA+C;AAC/C,wCAAyC;AACzC,0DAAgD;AAChD,iCAAiC;AACjC,oDAAuB;AAEvB,wDAAsC;AACtC,gGAA8E;AAGvE,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,sBAAe;IAY1C,KAAK,CAAC,OAAO;QAClB,WAAW,CAAC,KAAK,IAAI,EAAE;YACrB,MAAM,CAAC,GAAG,MAAM,wBAAS,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE,IAAI,EAAE,gBAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;YAE9E,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC,YAAY,EAAE,CAAC,CAAC;QACxE,CAAC,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,SAAiB;QACpC,MAAM,OAAO,GAAG,MAAM,wBAAS,CAAC,KAAK,CAAC;YACpC,SAAS,EAAE,SAAS;SACrB,CAAC,CAAC,KAAK,EAAE,CAAC;QAEX,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,IAAI,CAAC;SACb;QAED,IAAI,OAAO,CAAC,UAAU,GAAG,gBAAQ,CAAC,GAAG,EAAE,EAAE;YACvC,OAAO,IAAI,CAAC;SACb;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO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GAAG,IAAI,CAAC;SACd;aAAM;YACL,GAAG,GAAG,WAAW,CAAC,SAAS,CAAC;YAC5B,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YAC7C,aAAa,GAAG,WAAW,CAAC,QAAQ,CAAC;YACrC,eAAe,GAAG,WAAW,CAAC,UAAU,CAAC;SAC1C;QAED,MAAM,OAAO,GAAG,IAAI,wBAAS,CAAC;YAC5B,SAAS,EAAE,GAAG;YACd,SAAS,EAAE,aAAa;YACxB,UAAU,EAAE,eAAe;YAC3B,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,eAAQ,CAAC;SACtC,CAAC,CAAC;QAEH,MAAM,OAAO,CAAC,MAAM,CAAC,qBAAe,CAAC,cAAc,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,KAAK,CAAC,OAAiB;QAClC,MAAM,wBAAS,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,wBAAS,CAAC,QAAQ,EAAE,CAAC;IAC7B,CAAC;CACF,CAAA;AAjFY,wCAAc;AAEf;IADT,IAAA,YAAM,EAAC,kBAAkB,CAAC;8BACZ,SAAG;2CAAC;AAKT;IAHT,IAAA,sBAAM,EAAC,gCAAgC,EAAE;QACxC,YAAY,EAAE,MAAM;KACrB,CAAC;;uDAC6B;AAGrB;IADT,IAAA,sBAAM,EAAC,yBAAyB,CAAC;;6DACM;yBAV7B,cAAc;IAD1B,IAAA,eAAU,EAAC,sBAAe,CAAC;GACf,cAAc,CAiF1B"}
@@ -1,6 +1,6 @@
1
- import { OrmMigration, OrmDriver } from '@spinajs/orm';
2
- export declare class UserSessionDBSqlMigration_2022_06_28_01_01_01 extends OrmMigration {
3
- up(connection: OrmDriver): Promise<void>;
4
- down(_: OrmDriver): Promise<void>;
5
- }
1
+ import { OrmMigration, OrmDriver } from '@spinajs/orm';
2
+ export declare class UserSessionDBSqlMigration_2022_06_28_01_01_01 extends OrmMigration {
3
+ up(connection: OrmDriver): Promise<void>;
4
+ down(_: OrmDriver): Promise<void>;
5
+ }
6
6
  //# sourceMappingURL=UserSessionDBSqlMigration_2022_06_28_01_01_01.d.ts.map
@@ -1,29 +1,29 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- 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
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
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 {
12
- async up(connection) {
13
- await connection.schema().createTable('user_sessions', (table) => {
14
- table.string('SessionId', 36).primaryKey().notNull();
15
- table.date('CreatedAt').notNull();
16
- table.date('Expiration');
17
- table.text('Data').notNull();
18
- });
19
- // create index explicit, otherwise sqlite driver cannot extract unique index from sqlite_master
20
- await connection.index().table('user_sessions').name('session_id_user_session_idx').columns(['SessionId']).unique();
21
- }
22
- // tslint:disable-next-line: no-empty
23
- async down(_) { }
24
- };
25
- UserSessionDBSqlMigration_2022_06_28_01_01_01 = __decorate([
26
- (0, orm_1.Migration)('session-provider-connection')
27
- ], UserSessionDBSqlMigration_2022_06_28_01_01_01);
28
- exports.UserSessionDBSqlMigration_2022_06_28_01_01_01 = UserSessionDBSqlMigration_2022_06_28_01_01_01;
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
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 {
12
+ async up(connection) {
13
+ await connection.schema().createTable('user_sessions', (table) => {
14
+ table.string('SessionId', 36).primaryKey().notNull();
15
+ table.date('CreatedAt').notNull();
16
+ table.date('Expiration');
17
+ table.text('Data').notNull();
18
+ });
19
+ // create index explicit, otherwise sqlite driver cannot extract unique index from sqlite_master
20
+ await connection.index().table('user_sessions').name('session_id_user_session_idx').columns(['SessionId']).unique();
21
+ }
22
+ // tslint:disable-next-line: no-empty
23
+ async down(_) { }
24
+ };
25
+ exports.UserSessionDBSqlMigration_2022_06_28_01_01_01 = UserSessionDBSqlMigration_2022_06_28_01_01_01;
26
+ exports.UserSessionDBSqlMigration_2022_06_28_01_01_01 = UserSessionDBSqlMigration_2022_06_28_01_01_01 = __decorate([
27
+ (0, orm_1.Migration)('session-provider-connection')
28
+ ], UserSessionDBSqlMigration_2022_06_28_01_01_01);
29
29
  //# 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;AAG3D,IAAM,6CAA6C,GAAnD,MAAM,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,sCAAkE;AAG3D,IAAM,6CAA6C,GAAnD,MAAM,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,sGAA6C;wDAA7C,6CAA6C;IADzD,IAAA,eAAS,EAAC,6BAA6B,CAAC;GAC5B,6CAA6C,CAezD"}
@@ -1,9 +1,9 @@
1
- import { ModelBase } from '@spinajs/orm';
2
- import { DateTime } from 'luxon';
3
- export declare class DbSession extends ModelBase {
4
- SessionId: string;
5
- CreatedAt: DateTime;
6
- Expiration: DateTime;
7
- Data: string;
8
- }
1
+ import { ModelBase } from '@spinajs/orm';
2
+ import { DateTime } from 'luxon';
3
+ export declare class DbSession extends ModelBase {
4
+ SessionId: string;
5
+ CreatedAt: DateTime;
6
+ Expiration: DateTime;
7
+ Data: string;
8
+ }
9
9
  //# sourceMappingURL=DbSession.d.ts.map
@@ -1,34 +1,34 @@
1
- "use strict";
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- 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
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- var __metadata = (this && this.__metadata) || function (k, v) {
9
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
- };
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 {
16
- };
17
- __decorate([
18
- (0, orm_1.Primary)(),
19
- __metadata("design:type", String)
20
- ], DbSession.prototype, "SessionId", void 0);
21
- __decorate([
22
- (0, orm_1.CreatedAt)(),
23
- __metadata("design:type", luxon_1.DateTime)
24
- ], DbSession.prototype, "CreatedAt", void 0);
25
- __decorate([
26
- (0, orm_1.DateTime)(),
27
- __metadata("design:type", luxon_1.DateTime)
28
- ], DbSession.prototype, "Expiration", void 0);
29
- DbSession = __decorate([
30
- (0, orm_1.Connection)('session-provider-connection'),
31
- (0, orm_1.Model)('user_sessions')
32
- ], DbSession);
33
- exports.DbSession = DbSession;
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
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 {
16
+ };
17
+ exports.DbSession = DbSession;
18
+ __decorate([
19
+ (0, orm_1.Primary)(),
20
+ __metadata("design:type", String)
21
+ ], DbSession.prototype, "SessionId", void 0);
22
+ __decorate([
23
+ (0, orm_1.CreatedAt)(),
24
+ __metadata("design:type", luxon_1.DateTime)
25
+ ], DbSession.prototype, "CreatedAt", void 0);
26
+ __decorate([
27
+ (0, orm_1.DateTime)(),
28
+ __metadata("design:type", luxon_1.DateTime)
29
+ ], DbSession.prototype, "Expiration", void 0);
30
+ exports.DbSession = DbSession = __decorate([
31
+ (0, orm_1.Connection)('session-provider-connection'),
32
+ (0, orm_1.Model)('user_sessions')
33
+ ], DbSession);
34
34
  //# sourceMappingURL=DbSession.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DbSession.js","sourceRoot":"","sources":["../../../src/models/DbSession.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sCAAgG;AAChG,iCAAiC;AAG1B,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,eAAS;CAWvC,CAAA;AAVC;IAAC,IAAA,aAAO,GAAE;;4CACe;AAEzB;IAAC,IAAA,eAAS,GAAE;8BACM,gBAAQ;4CAAC;AAE3B;IAAC,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,sCAAgG;AAChG,iCAAiC;AAG1B,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,eAAS;CAWvC,CAAA;AAXY,8BAAS;AAEb;IADN,IAAA,aAAO,GAAE;;4CACe;AAGlB;IADN,IAAA,eAAS,GAAE;8BACM,gBAAQ;4CAAC;AAGpB;IADN,IAAA,cAAE,GAAE;8BACc,gBAAQ;6CAAC;oBARjB,SAAS;IAFrB,IAAA,gBAAU,EAAC,6BAA6B,CAAC;IACzC,IAAA,WAAK,EAAC,eAAe,CAAC;GACV,SAAS,CAWrB"}
@@ -1,11 +1,11 @@
1
- declare const sessionDb: {
2
- rbac: {
3
- session: {
4
- db: {
5
- cleanupInterval: number;
6
- };
7
- };
8
- };
9
- };
10
- export default sessionDb;
1
+ declare const sessionDb: {
2
+ rbac: {
3
+ session: {
4
+ db: {
5
+ cleanupInterval: number;
6
+ };
7
+ };
8
+ };
9
+ };
10
+ export default sessionDb;
11
11
  //# sourceMappingURL=session-db.d.ts.map
@@ -1,11 +1,11 @@
1
- const sessionDb = {
2
- rbac: {
3
- session: {
4
- db: {
5
- cleanupInterval: 10 * 60 * 1000,
6
- },
7
- },
8
- },
9
- };
10
- export default sessionDb;
1
+ const sessionDb = {
2
+ rbac: {
3
+ session: {
4
+ db: {
5
+ cleanupInterval: 10 * 60 * 1000,
6
+ },
7
+ },
8
+ },
9
+ };
10
+ export default sessionDb;
11
11
  //# sourceMappingURL=session-db.js.map
@@ -1,16 +1,16 @@
1
- import { SessionProvider, Session, ISession } from '@spinajs/rbac';
2
- import { Log } from '@spinajs/log';
3
- export * from './models/DbSession.js';
4
- export * from './migrations/UserSessionDBSqlMigration_2022_06_28_01_01_01.js';
5
- export declare class DbSessionStore extends SessionProvider {
6
- protected Log: Log;
7
- protected CleanupInterval: any;
8
- protected DefaultExpirationTime: number;
9
- resolve(): Promise<void>;
10
- restore(sessionId: string): Promise<Session>;
11
- delete(sessionId: string): Promise<void>;
12
- save(sessionOrId: string | ISession, data?: object): Promise<void>;
13
- touch(session: ISession): Promise<void>;
14
- truncate(): Promise<void>;
15
- }
1
+ import { SessionProvider, Session, ISession } from '@spinajs/rbac';
2
+ import { Log } from '@spinajs/log';
3
+ export * from './models/DbSession.js';
4
+ export * from './migrations/UserSessionDBSqlMigration_2022_06_28_01_01_01.js';
5
+ export declare class DbSessionStore extends SessionProvider {
6
+ protected Log: Log;
7
+ protected CleanupInterval: any;
8
+ protected DefaultExpirationTime: number;
9
+ resolve(): Promise<void>;
10
+ restore(sessionId: string): Promise<Session>;
11
+ delete(sessionId: string): Promise<void>;
12
+ save(sessionOrId: string | ISession, data?: object): Promise<void>;
13
+ touch(session: ISession): Promise<void>;
14
+ truncate(): Promise<void>;
15
+ }
16
16
  //# sourceMappingURL=index.d.ts.map