@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 +11 -11
- package/lib/config/session-db.d.ts +2 -0
- package/lib/config/session-db.d.ts.map +1 -0
- package/lib/config/session-db.js +1 -0
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +31 -51
- package/lib/index.js.map +1 -1
- package/lib/migrations/UserSessionDBSqlMigration_2022_06_28_01_01_01.d.ts +1 -0
- package/lib/migrations/UserSessionDBSqlMigration_2022_06_28_01_01_01.d.ts.map +1 -0
- package/lib/migrations/UserSessionDBSqlMigration_2022_06_28_01_01_01.js +4 -7
- package/lib/migrations/UserSessionDBSqlMigration_2022_06_28_01_01_01.js.map +1 -1
- package/lib/models/DbSession.d.ts +1 -0
- package/lib/models/DbSession.d.ts.map +1 -0
- package/lib/models/DbSession.js +11 -14
- package/lib/models/DbSession.js.map +1 -1
- package/package.json +58 -54
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 @@
|
|
|
1
|
+
{"version":3,"file":"session-db.d.ts","sourceRoot":"","sources":["../../src/config/session-db.ts"],"names":[],"mappings":""}
|
package/lib/config/session-db.js
CHANGED
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
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
|
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
|
|
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 <
|
|
35
|
+
if (session.Expiration < DateTime.now()) {
|
|
56
36
|
return null;
|
|
57
37
|
}
|
|
58
38
|
const sData = JSON.parse(session.Data);
|
|
59
|
-
return new
|
|
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
|
|
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 =
|
|
73
|
-
let sExpirationTime =
|
|
74
|
-
if (
|
|
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
|
|
64
|
+
const session = new DbSession({
|
|
85
65
|
SessionId: sId,
|
|
86
66
|
CreatedAt: sCreationTime,
|
|
87
67
|
Expiration: sExpirationTime,
|
|
88
|
-
Data: JSON.stringify(sData,
|
|
68
|
+
Data: JSON.stringify(sData, replacer),
|
|
89
69
|
});
|
|
90
|
-
await session.insert(
|
|
70
|
+
await session.insert(InsertBehaviour.InsertOrUpdate);
|
|
91
71
|
}
|
|
92
72
|
async touch(session) {
|
|
93
|
-
await
|
|
73
|
+
await DbSession.update({
|
|
94
74
|
Expiration: session.Expiration,
|
|
95
75
|
}).where('SessionId', session.SessionId);
|
|
96
76
|
}
|
|
97
77
|
async truncate() {
|
|
98
|
-
await
|
|
78
|
+
await DbSession.truncate();
|
|
99
79
|
}
|
|
100
80
|
};
|
|
101
81
|
__decorate([
|
|
102
|
-
|
|
103
|
-
__metadata("design:type",
|
|
82
|
+
Logger('db-session-store'),
|
|
83
|
+
__metadata("design:type", Log)
|
|
104
84
|
], DbSessionStore.prototype, "Log", void 0);
|
|
105
85
|
__decorate([
|
|
106
|
-
|
|
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
|
-
|
|
92
|
+
Config('rbac.session.expiration'),
|
|
113
93
|
__metadata("design:type", Number)
|
|
114
94
|
], DbSessionStore.prototype, "DefaultExpirationTime", void 0);
|
|
115
95
|
DbSessionStore = __decorate([
|
|
116
|
-
|
|
96
|
+
Injectable(SessionProvider)
|
|
117
97
|
], DbSessionStore);
|
|
118
|
-
|
|
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":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAY,MAAM,eAAe,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAA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AAQ,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"}
|
|
@@ -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
|
-
|
|
9
|
-
|
|
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
|
-
|
|
23
|
+
Migration('session-provider-connection')
|
|
27
24
|
], UserSessionDBSqlMigration_2022_06_28_01_01_01);
|
|
28
|
-
|
|
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":"
|
|
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"}
|
|
@@ -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"}
|
package/lib/models/DbSession.js
CHANGED
|
@@ -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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
15
|
+
Primary(),
|
|
19
16
|
__metadata("design:type", String)
|
|
20
17
|
], DbSession.prototype, "SessionId", void 0);
|
|
21
18
|
__decorate([
|
|
22
|
-
|
|
23
|
-
__metadata("design:type",
|
|
19
|
+
CreatedAt(),
|
|
20
|
+
__metadata("design:type", DateTime)
|
|
24
21
|
], DbSession.prototype, "CreatedAt", void 0);
|
|
25
22
|
__decorate([
|
|
26
|
-
(
|
|
27
|
-
__metadata("design:type",
|
|
23
|
+
DT(),
|
|
24
|
+
__metadata("design:type", DateTime)
|
|
28
25
|
], DbSession.prototype, "Expiration", void 0);
|
|
29
26
|
DbSession = __decorate([
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
Connection('session-provider-connection'),
|
|
28
|
+
Model('user_sessions')
|
|
32
29
|
], DbSession);
|
|
33
|
-
|
|
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":"
|
|
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.
|
|
4
|
-
"description": "Simple session provider based on relational db. Usefull for testing or small projects",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"spinajs"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"@spinajs/
|
|
45
|
-
"@spinajs/
|
|
46
|
-
"@spinajs/
|
|
47
|
-
"@spinajs/
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"@spinajs/
|
|
52
|
-
|
|
53
|
-
|
|
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
|
+
}
|