@jayfong/x-server 1.28.0 → 1.29.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/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [1.29.0](https://github.com/jfWorks/x-server/compare/v1.28.2...v1.29.0) (2022-05-19)
6
+
7
+
8
+ ### Features
9
+
10
+ * jwt sign support ttl ([2e2958f](https://github.com/jfWorks/x-server/commit/2e2958f564b779838a9ca13a1b8cebc4e2a9bb59))
11
+
12
+ ### [1.28.2](https://github.com/jfWorks/x-server/compare/v1.28.1...v1.28.2) (2022-05-16)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * rhel-openssl-1.1.x ([c2a752a](https://github.com/jfWorks/x-server/commit/c2a752a2c06e8a1e37c3c72154d5f21d801de8a2))
18
+
19
+ ### [1.28.1](https://github.com/jfWorks/x-server/compare/v1.28.0...v1.28.1) (2022-05-16)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * rhel-openssl-1.1.x ([38bbf2f](https://github.com/jfWorks/x-server/commit/38bbf2ff3b1b22eaf37eebb7bca5bc95ee8c90a0))
25
+
5
26
  ## [1.28.0](https://github.com/jfWorks/x-server/compare/v1.27.4...v1.28.0) (2022-05-15)
6
27
 
7
28
 
@@ -123,12 +123,12 @@ class BuildUtil {
123
123
  const prismaSchemaFile = _nodePath.default.join(options.cwd, 'src/db/schema.prisma');
124
124
 
125
125
  if (await _fsExtra.default.pathExists(prismaSchemaFile)) {
126
- // 下载 centos (rhel-openssl-1.0.x) 的可执行文件
126
+ // 下载 centos (rhel-openssl-1.0.x,rhel-openssl-1.1.x) 的可执行文件
127
127
  await (0, _execa.default)('tbify', ['node', require.resolve('@prisma/engines/download/index.js')], {
128
128
  env: {
129
129
  // https://www.prisma.io/docs/reference/api-reference/environment-variables-reference#prisma_cli_binary_targets
130
130
  // https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#binarytargets-options
131
- PRISMA_CLI_BINARY_TARGETS: `${_os.default.platform() === 'darwin' ? 'darwin' : 'windows'},rhel-openssl-1.0.x`
131
+ PRISMA_CLI_BINARY_TARGETS: `${_os.default.platform() === 'darwin' ? 'darwin' : 'windows'},rhel-openssl-1.0.x,rhel-openssl-1.1.x`
132
132
  }
133
133
  });
134
134
 
@@ -136,6 +136,7 @@ class BuildUtil {
136
136
 
137
137
  await _fsExtra.default.copyFile(prismaSchemaFile, distPrismaSchemaFile);
138
138
  await _fsExtra.default.copyFile(require.resolve('@prisma/engines/libquery_engine-rhel-openssl-1.0.x.so.node'), _nodePath.default.join(distDir, 'libquery_engine-rhel-openssl-1.0.x.so.node'));
139
+ await _fsExtra.default.copyFile(require.resolve('@prisma/engines/libquery_engine-rhel-openssl-1.1.x.so.node'), _nodePath.default.join(distDir, 'libquery_engine-rhel-openssl-1.1.x.so.node'));
139
140
  } // 写入 pkg
140
141
 
141
142
 
@@ -17,9 +17,9 @@ class JwtService {
17
17
  this.serviceName = 'jwt';
18
18
  }
19
19
 
20
- sign(payload) {
20
+ sign(payload, ttl = this.options.ttl) {
21
21
  return _jsonwebtoken.default.sign(payload, this.options.secret, {
22
- expiresIn: (0, _date.ms)(this.options.ttl, true)
22
+ expiresIn: (0, _date.ms)(ttl, true)
23
23
  });
24
24
  }
25
25
 
@@ -99,17 +99,18 @@ export class BuildUtil {
99
99
  const prismaSchemaFile = path.join(options.cwd, 'src/db/schema.prisma');
100
100
 
101
101
  if (await fs.pathExists(prismaSchemaFile)) {
102
- // 下载 centos (rhel-openssl-1.0.x) 的可执行文件
102
+ // 下载 centos (rhel-openssl-1.0.x,rhel-openssl-1.1.x) 的可执行文件
103
103
  await execa('tbify', ['node', require.resolve('@prisma/engines/download/index.js')], {
104
104
  env: {
105
105
  // https://www.prisma.io/docs/reference/api-reference/environment-variables-reference#prisma_cli_binary_targets
106
106
  // https://www.prisma.io/docs/reference/api-reference/prisma-schema-reference#binarytargets-options
107
- PRISMA_CLI_BINARY_TARGETS: `${os.platform() === 'darwin' ? 'darwin' : 'windows'},rhel-openssl-1.0.x`
107
+ PRISMA_CLI_BINARY_TARGETS: `${os.platform() === 'darwin' ? 'darwin' : 'windows'},rhel-openssl-1.0.x,rhel-openssl-1.1.x`
108
108
  }
109
109
  });
110
110
  const distPrismaSchemaFile = path.join(distDir, 'schema.prisma');
111
111
  await fs.copyFile(prismaSchemaFile, distPrismaSchemaFile);
112
112
  await fs.copyFile(require.resolve('@prisma/engines/libquery_engine-rhel-openssl-1.0.x.so.node'), path.join(distDir, 'libquery_engine-rhel-openssl-1.0.x.so.node'));
113
+ await fs.copyFile(require.resolve('@prisma/engines/libquery_engine-rhel-openssl-1.1.x.so.node'), path.join(distDir, 'libquery_engine-rhel-openssl-1.1.x.so.node'));
113
114
  } // 写入 pkg
114
115
 
115
116
 
@@ -10,7 +10,7 @@ export declare class JwtService implements BaseService {
10
10
  private options;
11
11
  serviceName: string;
12
12
  constructor(options: JwtServiceOptions);
13
- sign<T extends Record<string, any>>(payload: T): string;
13
+ sign<T extends Record<string, any>>(payload: T, ttl?: MsValue): string;
14
14
  verify<T extends Record<string, any>>(token: string): Promise<T>;
15
15
  verifyFromHttpHeaders<T extends Record<string, any>>(headers: IncomingHttpHeaders): Promise<T>;
16
16
  }
@@ -7,9 +7,9 @@ export class JwtService {
7
7
  this.serviceName = 'jwt';
8
8
  }
9
9
 
10
- sign(payload) {
10
+ sign(payload, ttl = this.options.ttl) {
11
11
  return jwt.sign(payload, this.options.secret, {
12
- expiresIn: ms(this.options.ttl, true)
12
+ expiresIn: ms(ttl, true)
13
13
  });
14
14
  }
15
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "1.28.0",
3
+ "version": "1.29.0",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",