vona-module-a-jwt 5.0.13 → 5.0.14
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/dist/.metadata/index.d.ts +33 -34
- package/dist/index.js +58 -58
- package/package.json +1 -1
|
@@ -1,44 +1,27 @@
|
|
|
1
|
-
import type { BeanScopeUtil, TypeModuleConfig } from 'vona';
|
|
2
1
|
import type { TypeEntityOptionsFields } from 'vona-module-a-openapi';
|
|
3
|
-
/** bean: end */
|
|
4
|
-
/** bean: begin */
|
|
5
|
-
import type { BeanJwt } from '../bean/bean.jwt.ts';
|
|
6
|
-
import type { config } from '../config/config.ts';
|
|
7
|
-
import type { IDtoOptionsJwtToken } from '../dto/jwtToken.ts';
|
|
8
|
-
/** dto: end */
|
|
9
|
-
/** dto: begin */
|
|
10
|
-
import type { DtoJwtToken } from '../dto/jwtToken.ts';
|
|
11
|
-
/** service: end */
|
|
12
|
-
/** service: begin */
|
|
13
|
-
import type { ServiceJwtClient } from '../service/jwtClient.ts';
|
|
14
|
-
import type { ServiceJwtExtract } from '../service/jwtExtract.ts';
|
|
15
|
-
/** config: end */
|
|
16
|
-
/** scope: begin */
|
|
17
|
-
import { BeanScopeBase } from 'vona';
|
|
18
|
-
import 'vona';
|
|
19
|
-
/** service: end */
|
|
20
|
-
/** service: begin */
|
|
21
|
-
import 'vona';
|
|
22
|
-
import 'vona';
|
|
23
|
-
import 'vona';
|
|
24
|
-
import 'vona';
|
|
25
|
-
import 'vona';
|
|
26
2
|
/** bean: begin */
|
|
27
3
|
export * from '../bean/bean.jwt.ts';
|
|
4
|
+
import 'vona';
|
|
28
5
|
declare module 'vona' {
|
|
29
6
|
}
|
|
30
7
|
declare module 'vona-module-a-jwt' {
|
|
31
8
|
interface BeanJwt {
|
|
32
9
|
}
|
|
33
10
|
}
|
|
11
|
+
/** bean: end */
|
|
12
|
+
/** bean: begin */
|
|
13
|
+
import type { BeanJwt } from '../bean/bean.jwt.ts';
|
|
14
|
+
import 'vona';
|
|
34
15
|
declare module 'vona' {
|
|
35
16
|
interface IBeanRecordGlobal {
|
|
36
|
-
jwt: BeanJwt;
|
|
17
|
+
'jwt': BeanJwt;
|
|
37
18
|
}
|
|
38
19
|
}
|
|
39
|
-
/**
|
|
40
|
-
/**
|
|
41
|
-
export * from '../
|
|
20
|
+
/** bean: end */
|
|
21
|
+
/** dto: begin */
|
|
22
|
+
export * from '../dto/jwtToken.ts';
|
|
23
|
+
import type { IDtoOptionsJwtToken } from '../dto/jwtToken.ts';
|
|
24
|
+
import 'vona';
|
|
42
25
|
declare module 'vona-module-a-web' {
|
|
43
26
|
interface IDtoRecord {
|
|
44
27
|
'a-jwt:jwtToken': Omit<IDtoOptionsJwtToken, '_fieldsMore_'>;
|
|
@@ -46,17 +29,19 @@ declare module 'vona-module-a-web' {
|
|
|
46
29
|
}
|
|
47
30
|
declare module 'vona-module-a-jwt' {
|
|
48
31
|
}
|
|
32
|
+
/** dto: end */
|
|
33
|
+
/** dto: begin */
|
|
34
|
+
import type { DtoJwtToken } from '../dto/jwtToken.ts';
|
|
49
35
|
declare module 'vona-module-a-jwt' {
|
|
50
36
|
interface IDtoOptionsJwtToken {
|
|
51
37
|
fields?: TypeEntityOptionsFields<DtoJwtToken, IDtoOptionsJwtToken['_fieldsMore_']>;
|
|
52
38
|
}
|
|
53
39
|
}
|
|
54
|
-
/** bean: end */
|
|
55
|
-
/** dto: begin */
|
|
56
|
-
export * from '../dto/jwtToken.ts';
|
|
57
40
|
/** dto: end */
|
|
58
41
|
/** service: begin */
|
|
59
42
|
export * from '../service/jwtClient.ts';
|
|
43
|
+
export * from '../service/jwtExtract.ts';
|
|
44
|
+
import 'vona';
|
|
60
45
|
declare module 'vona-module-a-web' {
|
|
61
46
|
interface IServiceRecord {
|
|
62
47
|
'a-jwt:jwtClient': never;
|
|
@@ -69,17 +54,30 @@ declare module 'vona-module-a-jwt' {
|
|
|
69
54
|
interface ServiceJwtExtract {
|
|
70
55
|
}
|
|
71
56
|
}
|
|
57
|
+
/** service: end */
|
|
58
|
+
/** service: begin */
|
|
59
|
+
import type { ServiceJwtClient } from '../service/jwtClient.ts';
|
|
60
|
+
import type { ServiceJwtExtract } from '../service/jwtExtract.ts';
|
|
72
61
|
export interface IModuleService {
|
|
73
|
-
jwtClient: ServiceJwtClient;
|
|
74
|
-
jwtExtract: ServiceJwtExtract;
|
|
62
|
+
'jwtClient': ServiceJwtClient;
|
|
63
|
+
'jwtExtract': ServiceJwtExtract;
|
|
75
64
|
}
|
|
65
|
+
/** service: end */
|
|
66
|
+
/** service: begin */
|
|
67
|
+
import 'vona';
|
|
76
68
|
declare module 'vona' {
|
|
77
69
|
interface IBeanRecordGeneral {
|
|
78
70
|
'a-jwt.service.jwtClient': ServiceJwtClient;
|
|
79
71
|
'a-jwt.service.jwtExtract': ServiceJwtExtract;
|
|
80
72
|
}
|
|
81
73
|
}
|
|
82
|
-
|
|
74
|
+
/** service: end */
|
|
75
|
+
/** config: begin */
|
|
76
|
+
export * from '../config/config.ts';
|
|
77
|
+
import type { config } from '../config/config.ts';
|
|
78
|
+
/** config: end */
|
|
79
|
+
/** scope: begin */
|
|
80
|
+
import { BeanScopeBase, type BeanScopeUtil, type TypeModuleConfig } from 'vona';
|
|
83
81
|
export declare class ScopeModuleAJwt extends BeanScopeBase {
|
|
84
82
|
}
|
|
85
83
|
export interface ScopeModuleAJwt {
|
|
@@ -87,6 +85,7 @@ export interface ScopeModuleAJwt {
|
|
|
87
85
|
config: TypeModuleConfig<typeof config>;
|
|
88
86
|
service: IModuleService;
|
|
89
87
|
}
|
|
88
|
+
import 'vona';
|
|
90
89
|
declare module 'vona' {
|
|
91
90
|
interface IBeanScopeRecord {
|
|
92
91
|
'a-jwt': ScopeModuleAJwt;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BeanInfo, BeanBase, deepExtend, cast, BeanScopeBase } from 'vona';
|
|
2
|
-
import { Bean, Scope } from 'vona-module-a-bean';
|
|
3
2
|
import ms from 'ms';
|
|
3
|
+
import { Bean, Scope } from 'vona-module-a-bean';
|
|
4
4
|
import jwt from 'jsonwebtoken';
|
|
5
5
|
import { Service, Dto } from 'vona-module-a-web';
|
|
6
6
|
import { Api } from 'vona-module-a-openapi';
|
|
@@ -122,63 +122,6 @@ let BeanJwt = (_dec$3 = Bean(), _dec2$3 = BeanInfo({
|
|
|
122
122
|
}
|
|
123
123
|
}) || _class$3) || _class$3);
|
|
124
124
|
|
|
125
|
-
function config(app) {
|
|
126
|
-
return {
|
|
127
|
-
field: {
|
|
128
|
-
payload: {
|
|
129
|
-
client: 'client',
|
|
130
|
-
path: 'path',
|
|
131
|
-
data: 'data'
|
|
132
|
-
},
|
|
133
|
-
extract: {
|
|
134
|
-
header: '',
|
|
135
|
-
headerAuth: 'authorization',
|
|
136
|
-
headerAuthScheme: 'bearer',
|
|
137
|
-
query: 'auth_token',
|
|
138
|
-
cookie: 'token'
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
tempToken: {
|
|
142
|
-
signOptions: {
|
|
143
|
-
expiresIn: 10 * 60
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
default: {
|
|
147
|
-
secret: undefined,
|
|
148
|
-
signOptions: {
|
|
149
|
-
issuer: app.meta.env.APP_NAME
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
clients: {
|
|
153
|
-
access: {
|
|
154
|
-
signOptions: {
|
|
155
|
-
expiresIn: 2 * 60 * 60
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
refresh: {
|
|
159
|
-
signOptions: {
|
|
160
|
-
expiresIn: 7 * 24 * 60 * 60
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
oauth: {
|
|
164
|
-
signOptions: {
|
|
165
|
-
expiresIn: 5 * 60
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
oauthstate: {
|
|
169
|
-
signOptions: {
|
|
170
|
-
expiresIn: 5 * 60
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
code: {
|
|
174
|
-
signOptions: {
|
|
175
|
-
expiresIn: 3 * 60
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
|
|
182
125
|
function _applyDecoratedDescriptor(i, e, r, n, l) {
|
|
183
126
|
var a = {};
|
|
184
127
|
return Object.keys(n).forEach(function (i) {
|
|
@@ -261,6 +204,63 @@ let ServiceJwtExtract = (_dec$1 = Service(), _dec2$1 = BeanInfo({
|
|
|
261
204
|
}
|
|
262
205
|
}) || _class$1) || _class$1);
|
|
263
206
|
|
|
207
|
+
function config(app) {
|
|
208
|
+
return {
|
|
209
|
+
field: {
|
|
210
|
+
payload: {
|
|
211
|
+
client: 'client',
|
|
212
|
+
path: 'path',
|
|
213
|
+
data: 'data'
|
|
214
|
+
},
|
|
215
|
+
extract: {
|
|
216
|
+
header: '',
|
|
217
|
+
headerAuth: 'authorization',
|
|
218
|
+
headerAuthScheme: 'bearer',
|
|
219
|
+
query: 'auth_token',
|
|
220
|
+
cookie: 'token'
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
tempToken: {
|
|
224
|
+
signOptions: {
|
|
225
|
+
expiresIn: 10 * 60
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
default: {
|
|
229
|
+
secret: undefined,
|
|
230
|
+
signOptions: {
|
|
231
|
+
issuer: app.meta.env.APP_NAME
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
clients: {
|
|
235
|
+
access: {
|
|
236
|
+
signOptions: {
|
|
237
|
+
expiresIn: 2 * 60 * 60
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
refresh: {
|
|
241
|
+
signOptions: {
|
|
242
|
+
expiresIn: 7 * 24 * 60 * 60
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
oauth: {
|
|
246
|
+
signOptions: {
|
|
247
|
+
expiresIn: 5 * 60
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
oauthstate: {
|
|
251
|
+
signOptions: {
|
|
252
|
+
expiresIn: 5 * 60
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
code: {
|
|
256
|
+
signOptions: {
|
|
257
|
+
expiresIn: 3 * 60
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
|
|
264
264
|
var _dec, _dec2, _class;
|
|
265
265
|
let ScopeModuleAJwt = (_dec = Scope(), _dec2 = BeanInfo({
|
|
266
266
|
module: "a-jwt"
|