@xnestjs/redisess 1.12.2 → 1.13.0

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": "@xnestjs/redisess",
3
- "version": "1.12.2",
3
+ "version": "1.13.0",
4
4
  "description": "NestJS extension library for redisess",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -13,48 +13,34 @@
13
13
  "peerDependencies": {
14
14
  "@nestjs/common": "^10.0.0 || ^11.0.0",
15
15
  "@nestjs/core": "^10.0.0 || ^11.0.0",
16
- "ioredis": "^5.8.2",
16
+ "ioredis": "^5.9.2",
17
17
  "redisess": "^2.6.1"
18
18
  },
19
19
  "type": "module",
20
+ "module": "./index.js",
21
+ "types": "./index.d.ts",
20
22
  "exports": {
21
23
  ".": {
22
- "import": {
23
- "types": "./types/index.d.ts",
24
- "default": "./esm/index.js"
25
- },
26
- "require": {
27
- "types": "./types/index.d.cts",
28
- "default": "./cjs/index.js"
29
- },
30
- "default": "./esm/index.js"
24
+ "types": "./index.d.ts",
25
+ "default": "./index.js"
31
26
  },
32
27
  "./package.json": "./package.json"
33
28
  },
34
- "main": "./cjs/index.js",
35
- "module": "./esm/index.js",
36
- "types": "./types/index.d.ts",
29
+ "engines": {
30
+ "node": ">=20.0"
31
+ },
37
32
  "repository": {
38
33
  "registry": "https://github.com/panates/xnestjs.git",
39
34
  "directory": "packages/redisess"
40
35
  },
41
- "engines": {
42
- "node": ">=16.0",
43
- "npm": ">=7.0.0"
44
- },
45
- "files": [
46
- "bin/",
47
- "cjs/",
48
- "esm/",
49
- "types/",
50
- "LICENSE",
51
- "README.md"
52
- ],
53
36
  "keywords": [
54
37
  "nestjs",
55
38
  "redisess",
56
39
  "session",
57
40
  "manager",
58
41
  "redis"
59
- ]
42
+ ],
43
+ "publishConfig": {
44
+ "access": "public"
45
+ }
60
46
  }
@@ -9,6 +9,7 @@ import { REDISESS_MODULE_ID, REDISESS_SESSION_OPTIONS } from './constants.js';
9
9
  import { getRedisessConfig } from './get-redisess-config.js';
10
10
  const CLIENT_TOKEN = Symbol('CLIENT_TOKEN');
11
11
  let RedisessCoreModule = RedisessCoreModule_1 = class RedisessCoreModule {
12
+ sessionManager;
12
13
  /**
13
14
  * Configures and returns a dynamic module
14
15
  */
@@ -46,6 +47,7 @@ let RedisessCoreModule = RedisessCoreModule_1 = class RedisessCoreModule {
46
47
  static _createDynamicModule(opts, metadata) {
47
48
  const token = opts.token ?? SessionManager;
48
49
  const providers = [
50
+ ...(metadata.providers ?? []),
49
51
  {
50
52
  provide: token,
51
53
  inject: [REDISESS_SESSION_OPTIONS],
@@ -66,18 +68,16 @@ let RedisessCoreModule = RedisessCoreModule_1 = class RedisessCoreModule {
66
68
  ? new Logger(opts.logger)
67
69
  : opts.logger,
68
70
  },
71
+ {
72
+ provide: REDISESS_MODULE_ID,
73
+ useValue: crypto.randomUUID(),
74
+ },
69
75
  ];
70
76
  return {
77
+ global: opts.global,
71
78
  module: RedisessCoreModule_1,
72
79
  ...metadata,
73
- providers: [
74
- ...(metadata.providers ?? []),
75
- ...providers,
76
- {
77
- provide: REDISESS_MODULE_ID,
78
- useValue: crypto.randomUUID(),
79
- },
80
- ],
80
+ providers,
81
81
  exports: [REDISESS_SESSION_OPTIONS, token, ...(metadata.exports ?? [])],
82
82
  };
83
83
  }
package/cjs/constants.js DELETED
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.REDISESS_MODULE_ID = exports.REDISESS_SESSION_OPTIONS = void 0;
4
- exports.REDISESS_SESSION_OPTIONS = Symbol('REDISESS_SESSION_OPTIONS');
5
- exports.REDISESS_MODULE_ID = Symbol('REDISESS_MODULE_ID');
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRedisessConfig = getRedisessConfig;
4
- const tslib_1 = require("tslib");
5
- const node_process_1 = tslib_1.__importDefault(require("node:process"));
6
- const objects_1 = require("@jsopen/objects");
7
- const putil_varhelpers_1 = require("putil-varhelpers");
8
- function getRedisessConfig(moduleOptions, prefix = 'SESSION_') {
9
- const options = (0, objects_1.clone)(moduleOptions);
10
- const env = node_process_1.default.env;
11
- options.namespace = options.namespace ?? env[prefix + 'NAMESPACE'];
12
- options.ttl = options.ttl ?? (0, putil_varhelpers_1.toInt)(env[prefix + 'TTL']);
13
- options.wipeInterval =
14
- options.wipeInterval ?? (0, putil_varhelpers_1.toInt)(env[prefix + 'WIPE_INTERVAL']) ?? 5000;
15
- return options;
16
- }
package/cjs/index.js DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./constants.js"), exports);
5
- tslib_1.__exportStar(require("./get-redisess-config.js"), exports);
6
- tslib_1.__exportStar(require("./redisess.module.js"), exports);
7
- tslib_1.__exportStar(require("./types.js"), exports);
8
- tslib_1.__exportStar(require("redisess"), exports);
package/cjs/package.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,102 +0,0 @@
1
- "use strict";
2
- var RedisessCoreModule_1;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.RedisessCoreModule = void 0;
5
- const tslib_1 = require("tslib");
6
- const assert = tslib_1.__importStar(require("node:assert"));
7
- const objects_1 = require("@jsopen/objects");
8
- const common_1 = require("@nestjs/common");
9
- const crypto = tslib_1.__importStar(require("crypto"));
10
- const redisess_1 = require("redisess");
11
- const constants_js_1 = require("./constants.js");
12
- const get_redisess_config_js_1 = require("./get-redisess-config.js");
13
- const CLIENT_TOKEN = Symbol('CLIENT_TOKEN');
14
- let RedisessCoreModule = RedisessCoreModule_1 = class RedisessCoreModule {
15
- /**
16
- * Configures and returns a dynamic module
17
- */
18
- static forRoot(moduleOptions) {
19
- const redisessOptions = (0, get_redisess_config_js_1.getRedisessConfig)(moduleOptions.useValue || {}, moduleOptions.envPrefix);
20
- return this._createDynamicModule(moduleOptions, {
21
- global: moduleOptions.global,
22
- providers: [
23
- {
24
- provide: constants_js_1.REDISESS_SESSION_OPTIONS,
25
- useValue: redisessOptions,
26
- },
27
- ],
28
- });
29
- }
30
- /**
31
- * Configures and returns an async dynamic module
32
- */
33
- static forRootAsync(asyncOptions) {
34
- assert.ok(asyncOptions.useFactory, 'useFactory is required');
35
- return this._createDynamicModule(asyncOptions, {
36
- global: asyncOptions.global,
37
- providers: [
38
- {
39
- provide: constants_js_1.REDISESS_SESSION_OPTIONS,
40
- inject: asyncOptions.inject,
41
- useFactory: async (...args) => {
42
- const opts = await asyncOptions.useFactory(...args);
43
- return (0, get_redisess_config_js_1.getRedisessConfig)(opts, asyncOptions.envPrefix);
44
- },
45
- },
46
- ],
47
- });
48
- }
49
- static _createDynamicModule(opts, metadata) {
50
- const token = opts.token ?? redisess_1.SessionManager;
51
- const providers = [
52
- {
53
- provide: token,
54
- inject: [constants_js_1.REDISESS_SESSION_OPTIONS],
55
- useFactory: async (sessionOptions) => {
56
- const redisessOptions = (0, objects_1.omit)(sessionOptions, [
57
- 'client',
58
- ]);
59
- return new redisess_1.SessionManager(sessionOptions.client, redisessOptions);
60
- },
61
- },
62
- {
63
- provide: CLIENT_TOKEN,
64
- useExisting: token,
65
- },
66
- {
67
- provide: common_1.Logger,
68
- useValue: typeof opts.logger === 'string'
69
- ? new common_1.Logger(opts.logger)
70
- : opts.logger,
71
- },
72
- ];
73
- return {
74
- module: RedisessCoreModule_1,
75
- ...metadata,
76
- providers: [
77
- ...(metadata.providers ?? []),
78
- ...providers,
79
- {
80
- provide: constants_js_1.REDISESS_MODULE_ID,
81
- useValue: crypto.randomUUID(),
82
- },
83
- ],
84
- exports: [constants_js_1.REDISESS_SESSION_OPTIONS, token, ...(metadata.exports ?? [])],
85
- };
86
- }
87
- /**
88
- *
89
- * @constructor
90
- */
91
- constructor(sessionManager) {
92
- this.sessionManager = sessionManager;
93
- }
94
- async onApplicationShutdown() {
95
- this.sessionManager.quit();
96
- }
97
- };
98
- exports.RedisessCoreModule = RedisessCoreModule;
99
- exports.RedisessCoreModule = RedisessCoreModule = RedisessCoreModule_1 = tslib_1.__decorate([
100
- tslib_1.__param(0, (0, common_1.Inject)(CLIENT_TOKEN)),
101
- tslib_1.__metadata("design:paramtypes", [redisess_1.SessionManager])
102
- ], RedisessCoreModule);
@@ -1,25 +0,0 @@
1
- "use strict";
2
- var RedisessModule_1;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.RedisessModule = void 0;
5
- const tslib_1 = require("tslib");
6
- const common_1 = require("@nestjs/common");
7
- const redisess_core_module_js_1 = require("./redisess-core.module.js");
8
- let RedisessModule = RedisessModule_1 = class RedisessModule {
9
- static forRoot(options) {
10
- return {
11
- module: RedisessModule_1,
12
- imports: [redisess_core_module_js_1.RedisessCoreModule.forRoot(options)],
13
- };
14
- }
15
- static forRootAsync(options) {
16
- return {
17
- module: RedisessModule_1,
18
- imports: [redisess_core_module_js_1.RedisessCoreModule.forRootAsync(options)],
19
- };
20
- }
21
- };
22
- exports.RedisessModule = RedisessModule;
23
- exports.RedisessModule = RedisessModule = RedisessModule_1 = tslib_1.__decorate([
24
- (0, common_1.Module)({})
25
- ], RedisessModule);
package/cjs/types.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/esm/package.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
package/types/index.d.cts DELETED
@@ -1,5 +0,0 @@
1
- export * from './constants.js';
2
- export * from './get-redisess-config.js';
3
- export * from './redisess.module.js';
4
- export * from './types.js';
5
- export * from 'redisess';
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes