@tstdl/base 0.83.9 → 0.83.11
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/.eslintrc.cjs +24 -35
- package/authentication/authentication.api.d.ts +28 -41
- package/authentication/client/api.client.d.ts +2 -1
- package/authentication/client/authentication.service.d.ts +3 -3
- package/authentication/client/authentication.service.js +16 -16
- package/authentication/client/http-client.middleware.d.ts +1 -1
- package/authentication/models/token.model.d.ts +3 -3
- package/authentication/server/authentication.api-controller.d.ts +1 -1
- package/authentication/server/authentication.service.d.ts +2 -2
- package/authentication/server/helper.d.ts +4 -4
- package/container/decorators.d.ts +3 -3
- package/package.json +3 -3
- package/text/localization.service.d.ts +1 -1
- package/types.d.ts +12 -9
package/.eslintrc.cjs
CHANGED
|
@@ -68,7 +68,7 @@ module.exports = {
|
|
|
68
68
|
'import/no-duplicates': ['warn', { 'prefer-inline': true }],
|
|
69
69
|
'import/no-cycle': ['off', { ignoreExternal: true }],
|
|
70
70
|
'import/no-self-import': ['error'],
|
|
71
|
-
'import/no-extraneous-dependencies': ['
|
|
71
|
+
'import/no-extraneous-dependencies': ['off', { devDependencies: false, includeTypes: true }],
|
|
72
72
|
'import/no-empty-named-blocks': ['error'],
|
|
73
73
|
'import/no-mutable-exports': ['error'],
|
|
74
74
|
'import/no-nodejs-modules': ['error'],
|
|
@@ -211,70 +211,59 @@ module.exports = {
|
|
|
211
211
|
|
|
212
212
|
'field',
|
|
213
213
|
|
|
214
|
-
// Getters
|
|
214
|
+
// Getters / Setters
|
|
215
215
|
'#private-static-get',
|
|
216
|
-
'private-static-get',
|
|
217
|
-
'protected-static-get',
|
|
218
|
-
'public-static-get',
|
|
219
|
-
|
|
220
|
-
/*
|
|
221
|
-
'private-decorated-get',
|
|
222
|
-
'protected-decorated-get',
|
|
223
|
-
'public-decorated-get',
|
|
224
|
-
*/
|
|
225
|
-
|
|
226
|
-
'#private-instance-get',
|
|
227
|
-
'private-instance-get',
|
|
228
|
-
'protected-instance-get',
|
|
229
|
-
'public-instance-get',
|
|
230
|
-
|
|
231
|
-
'protected-abstract-get',
|
|
232
|
-
'public-abstract-get',
|
|
233
|
-
|
|
234
|
-
'#private-get',
|
|
235
|
-
'private-get',
|
|
236
|
-
'protected-get',
|
|
237
|
-
'public-get',
|
|
238
|
-
|
|
239
|
-
'static-get',
|
|
240
|
-
'instance-get',
|
|
241
|
-
'abstract-get',
|
|
242
|
-
|
|
243
|
-
// 'decorated-get',
|
|
244
|
-
|
|
245
|
-
'get',
|
|
246
|
-
|
|
247
|
-
// Setters
|
|
248
216
|
'#private-static-set',
|
|
217
|
+
'private-static-get',
|
|
249
218
|
'private-static-set',
|
|
219
|
+
'protected-static-get',
|
|
250
220
|
'protected-static-set',
|
|
221
|
+
'public-static-get',
|
|
251
222
|
'public-static-set',
|
|
252
223
|
|
|
253
224
|
/*
|
|
225
|
+
'private-decorated-get',
|
|
254
226
|
'private-decorated-set',
|
|
227
|
+
'protected-decorated-get',
|
|
255
228
|
'protected-decorated-set',
|
|
229
|
+
'public-decorated-get',
|
|
256
230
|
'public-decorated-set',
|
|
257
231
|
*/
|
|
258
232
|
|
|
233
|
+
'#private-instance-get',
|
|
259
234
|
'#private-instance-set',
|
|
235
|
+
'private-instance-get',
|
|
260
236
|
'private-instance-set',
|
|
237
|
+
'protected-instance-get',
|
|
261
238
|
'protected-instance-set',
|
|
239
|
+
'public-instance-get',
|
|
262
240
|
'public-instance-set',
|
|
263
241
|
|
|
242
|
+
'protected-abstract-get',
|
|
264
243
|
'protected-abstract-set',
|
|
244
|
+
'public-abstract-get',
|
|
265
245
|
'public-abstract-set',
|
|
266
246
|
|
|
247
|
+
'#private-get',
|
|
267
248
|
'#private-set',
|
|
249
|
+
'private-get',
|
|
268
250
|
'private-set',
|
|
251
|
+
'protected-get',
|
|
269
252
|
'protected-set',
|
|
253
|
+
'public-get',
|
|
270
254
|
'public-set',
|
|
271
255
|
|
|
256
|
+
'static-get',
|
|
272
257
|
'static-set',
|
|
258
|
+
'instance-get',
|
|
273
259
|
'instance-set',
|
|
260
|
+
'abstract-get',
|
|
274
261
|
'abstract-set',
|
|
275
262
|
|
|
276
|
-
|
|
263
|
+
'decorated-get',
|
|
264
|
+
'decorated-set',
|
|
277
265
|
|
|
266
|
+
'get',
|
|
278
267
|
'set',
|
|
279
268
|
|
|
280
269
|
// Static initialization
|
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
import type { ApiDefinition } from '../api/types.js';
|
|
2
2
|
import type { SchemaTestable } from '../schema/schema.js';
|
|
3
|
-
import type { ObjectSchemaOrType } from '../schema/types/types.js';
|
|
3
|
+
import type { ObjectSchema, ObjectSchemaOrType } from '../schema/types/types.js';
|
|
4
4
|
import type { Record } from '../types.js';
|
|
5
|
+
import type { TokenPayload } from './index.js';
|
|
5
6
|
import { SecretCheckResult } from './models/secret-check-result.model.js';
|
|
6
7
|
import { TokenPayloadBase } from './models/token-payload-base.model.js';
|
|
7
8
|
export declare const dontWaitForValidToken: unique symbol;
|
|
8
|
-
type GetAuthenticationApiEndpointsDefinition<AdditionalTokenPayload = Record<never>, AuthenticationData = void> = typeof getAuthenticationApiEndpointsDefinition<AdditionalTokenPayload, AuthenticationData>;
|
|
9
|
-
type AuthenticationApiEndpointsDefinition<AdditionalTokenPayload = Record<never>, AuthenticationData = void> = ReturnType<GetAuthenticationApiEndpointsDefinition<AdditionalTokenPayload, AuthenticationData>>;
|
|
10
|
-
export type AuthenticationApiDefinition<AdditionalTokenPayload = Record<never>, AuthenticationData = void> = ApiDefinition<string, AuthenticationApiEndpointsDefinition<AdditionalTokenPayload, AuthenticationData>>;
|
|
9
|
+
type GetAuthenticationApiEndpointsDefinition<AdditionalTokenPayload extends Record = Record<never>, AuthenticationData = void> = typeof getAuthenticationApiEndpointsDefinition<AdditionalTokenPayload, AuthenticationData>;
|
|
10
|
+
type AuthenticationApiEndpointsDefinition<AdditionalTokenPayload extends Record = Record<never>, AuthenticationData = void> = ReturnType<GetAuthenticationApiEndpointsDefinition<AdditionalTokenPayload, AuthenticationData>>;
|
|
11
|
+
export type AuthenticationApiDefinition<AdditionalTokenPayload extends Record = Record<never>, AuthenticationData = void> = ApiDefinition<string, AuthenticationApiEndpointsDefinition<AdditionalTokenPayload, AuthenticationData>>;
|
|
11
12
|
export declare const authenticationApiDefinition: {
|
|
12
13
|
resource: string;
|
|
13
14
|
endpoints: {
|
|
14
15
|
token: {
|
|
15
16
|
resource: string;
|
|
16
17
|
method: "POST";
|
|
17
|
-
parameters:
|
|
18
|
+
parameters: ObjectSchema<{
|
|
18
19
|
subject: string;
|
|
19
20
|
secret: string;
|
|
20
21
|
data: unknown;
|
|
21
22
|
}>;
|
|
22
|
-
result:
|
|
23
|
-
jti: string;
|
|
24
|
-
iat: number;
|
|
25
|
-
exp: number;
|
|
26
|
-
refreshTokenExp: number;
|
|
27
|
-
sessionId: string;
|
|
28
|
-
subject: string;
|
|
29
|
-
}>;
|
|
23
|
+
result: ObjectSchema<TokenPayloadBase>;
|
|
30
24
|
credentials: true;
|
|
31
25
|
data: {
|
|
32
26
|
[dontWaitForValidToken]: boolean;
|
|
@@ -35,17 +29,10 @@ export declare const authenticationApiDefinition: {
|
|
|
35
29
|
refresh: {
|
|
36
30
|
resource: string;
|
|
37
31
|
method: "POST";
|
|
38
|
-
parameters:
|
|
32
|
+
parameters: ObjectSchema<{
|
|
39
33
|
data: unknown;
|
|
40
34
|
}>;
|
|
41
|
-
result:
|
|
42
|
-
jti: string;
|
|
43
|
-
iat: number;
|
|
44
|
-
exp: number;
|
|
45
|
-
refreshTokenExp: number;
|
|
46
|
-
sessionId: string;
|
|
47
|
-
subject: string;
|
|
48
|
-
}>;
|
|
35
|
+
result: ObjectSchema<TokenPayloadBase>;
|
|
49
36
|
credentials: true;
|
|
50
37
|
data: {
|
|
51
38
|
[dontWaitForValidToken]: boolean;
|
|
@@ -63,7 +50,7 @@ export declare const authenticationApiDefinition: {
|
|
|
63
50
|
initResetSecret: {
|
|
64
51
|
resource: string;
|
|
65
52
|
method: "POST";
|
|
66
|
-
parameters:
|
|
53
|
+
parameters: ObjectSchema<{
|
|
67
54
|
subject: string;
|
|
68
55
|
}>;
|
|
69
56
|
result: import("../schema/types/types.js").ValueSchema<"ok">;
|
|
@@ -71,7 +58,7 @@ export declare const authenticationApiDefinition: {
|
|
|
71
58
|
resetSecret: {
|
|
72
59
|
resource: string;
|
|
73
60
|
method: "POST";
|
|
74
|
-
parameters:
|
|
61
|
+
parameters: ObjectSchema<{
|
|
75
62
|
token: string;
|
|
76
63
|
newSecret: string;
|
|
77
64
|
}>;
|
|
@@ -80,7 +67,7 @@ export declare const authenticationApiDefinition: {
|
|
|
80
67
|
checkSecret: {
|
|
81
68
|
resource: string;
|
|
82
69
|
method: "POST";
|
|
83
|
-
parameters:
|
|
70
|
+
parameters: ObjectSchema<{
|
|
84
71
|
secret: string;
|
|
85
72
|
}>;
|
|
86
73
|
result: typeof SecretCheckResult;
|
|
@@ -91,18 +78,18 @@ export declare const authenticationApiDefinition: {
|
|
|
91
78
|
};
|
|
92
79
|
};
|
|
93
80
|
};
|
|
94
|
-
export declare function getAuthenticationApiDefinition<AdditionalTokenPayload, AuthenticationData, AdditionalEndpoints>(additionalTokenPayloadSchema: ObjectSchemaOrType<AdditionalTokenPayload>, authenticationDataSchema: SchemaTestable<AuthenticationData>, resource?: string, additionalEndpoints?: AdditionalEndpoints): {
|
|
81
|
+
export declare function getAuthenticationApiDefinition<AdditionalTokenPayload extends Record, AuthenticationData, AdditionalEndpoints>(additionalTokenPayloadSchema: ObjectSchemaOrType<AdditionalTokenPayload>, authenticationDataSchema: SchemaTestable<AuthenticationData>, resource?: string, additionalEndpoints?: AdditionalEndpoints): {
|
|
95
82
|
resource: string;
|
|
96
83
|
endpoints: {
|
|
97
84
|
token: {
|
|
98
85
|
resource: string;
|
|
99
86
|
method: "POST";
|
|
100
|
-
parameters:
|
|
87
|
+
parameters: ObjectSchema<{
|
|
101
88
|
subject: string;
|
|
102
89
|
secret: string;
|
|
103
90
|
data: AuthenticationData;
|
|
104
91
|
}>;
|
|
105
|
-
result:
|
|
92
|
+
result: ObjectSchema<TokenPayload<AdditionalTokenPayload>>;
|
|
106
93
|
credentials: true;
|
|
107
94
|
data: {
|
|
108
95
|
[dontWaitForValidToken]: boolean;
|
|
@@ -111,10 +98,10 @@ export declare function getAuthenticationApiDefinition<AdditionalTokenPayload, A
|
|
|
111
98
|
refresh: {
|
|
112
99
|
resource: string;
|
|
113
100
|
method: "POST";
|
|
114
|
-
parameters:
|
|
101
|
+
parameters: ObjectSchema<{
|
|
115
102
|
data: AuthenticationData;
|
|
116
103
|
}>;
|
|
117
|
-
result:
|
|
104
|
+
result: ObjectSchema<TokenPayload<AdditionalTokenPayload>>;
|
|
118
105
|
credentials: true;
|
|
119
106
|
data: {
|
|
120
107
|
[dontWaitForValidToken]: boolean;
|
|
@@ -132,7 +119,7 @@ export declare function getAuthenticationApiDefinition<AdditionalTokenPayload, A
|
|
|
132
119
|
initResetSecret: {
|
|
133
120
|
resource: string;
|
|
134
121
|
method: "POST";
|
|
135
|
-
parameters:
|
|
122
|
+
parameters: ObjectSchema<{
|
|
136
123
|
subject: string;
|
|
137
124
|
}>;
|
|
138
125
|
result: import("../schema/types/types.js").ValueSchema<"ok">;
|
|
@@ -140,7 +127,7 @@ export declare function getAuthenticationApiDefinition<AdditionalTokenPayload, A
|
|
|
140
127
|
resetSecret: {
|
|
141
128
|
resource: string;
|
|
142
129
|
method: "POST";
|
|
143
|
-
parameters:
|
|
130
|
+
parameters: ObjectSchema<{
|
|
144
131
|
token: string;
|
|
145
132
|
newSecret: string;
|
|
146
133
|
}>;
|
|
@@ -149,7 +136,7 @@ export declare function getAuthenticationApiDefinition<AdditionalTokenPayload, A
|
|
|
149
136
|
checkSecret: {
|
|
150
137
|
resource: string;
|
|
151
138
|
method: "POST";
|
|
152
|
-
parameters:
|
|
139
|
+
parameters: ObjectSchema<{
|
|
153
140
|
secret: string;
|
|
154
141
|
}>;
|
|
155
142
|
result: typeof SecretCheckResult;
|
|
@@ -160,16 +147,16 @@ export declare function getAuthenticationApiDefinition<AdditionalTokenPayload, A
|
|
|
160
147
|
};
|
|
161
148
|
};
|
|
162
149
|
};
|
|
163
|
-
export declare function getAuthenticationApiEndpointsDefinition<AdditionalTokenPayload, AuthenticationData>(additionalTokenPayloadSchema: ObjectSchemaOrType<AdditionalTokenPayload>, authenticationDataSchema: SchemaTestable<AuthenticationData>): {
|
|
150
|
+
export declare function getAuthenticationApiEndpointsDefinition<AdditionalTokenPayload extends Record, AuthenticationData>(additionalTokenPayloadSchema: ObjectSchemaOrType<AdditionalTokenPayload>, authenticationDataSchema: SchemaTestable<AuthenticationData>): {
|
|
164
151
|
token: {
|
|
165
152
|
resource: string;
|
|
166
153
|
method: "POST";
|
|
167
|
-
parameters:
|
|
154
|
+
parameters: ObjectSchema<{
|
|
168
155
|
subject: string;
|
|
169
156
|
secret: string;
|
|
170
157
|
data: AuthenticationData;
|
|
171
158
|
}>;
|
|
172
|
-
result:
|
|
159
|
+
result: ObjectSchema<TokenPayload<AdditionalTokenPayload>>;
|
|
173
160
|
credentials: true;
|
|
174
161
|
data: {
|
|
175
162
|
[dontWaitForValidToken]: boolean;
|
|
@@ -178,10 +165,10 @@ export declare function getAuthenticationApiEndpointsDefinition<AdditionalTokenP
|
|
|
178
165
|
refresh: {
|
|
179
166
|
resource: string;
|
|
180
167
|
method: "POST";
|
|
181
|
-
parameters:
|
|
168
|
+
parameters: ObjectSchema<{
|
|
182
169
|
data: AuthenticationData;
|
|
183
170
|
}>;
|
|
184
|
-
result:
|
|
171
|
+
result: ObjectSchema<TokenPayload<AdditionalTokenPayload>>;
|
|
185
172
|
credentials: true;
|
|
186
173
|
data: {
|
|
187
174
|
[dontWaitForValidToken]: boolean;
|
|
@@ -199,7 +186,7 @@ export declare function getAuthenticationApiEndpointsDefinition<AdditionalTokenP
|
|
|
199
186
|
initResetSecret: {
|
|
200
187
|
resource: string;
|
|
201
188
|
method: "POST";
|
|
202
|
-
parameters:
|
|
189
|
+
parameters: ObjectSchema<{
|
|
203
190
|
subject: string;
|
|
204
191
|
}>;
|
|
205
192
|
result: import("../schema/types/types.js").ValueSchema<"ok">;
|
|
@@ -207,7 +194,7 @@ export declare function getAuthenticationApiEndpointsDefinition<AdditionalTokenP
|
|
|
207
194
|
resetSecret: {
|
|
208
195
|
resource: string;
|
|
209
196
|
method: "POST";
|
|
210
|
-
parameters:
|
|
197
|
+
parameters: ObjectSchema<{
|
|
211
198
|
token: string;
|
|
212
199
|
newSecret: string;
|
|
213
200
|
}>;
|
|
@@ -216,7 +203,7 @@ export declare function getAuthenticationApiEndpointsDefinition<AdditionalTokenP
|
|
|
216
203
|
checkSecret: {
|
|
217
204
|
resource: string;
|
|
218
205
|
method: "POST";
|
|
219
|
-
parameters:
|
|
206
|
+
parameters: ObjectSchema<{
|
|
220
207
|
secret: string;
|
|
221
208
|
}>;
|
|
222
209
|
result: typeof SecretCheckResult;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ApiClient } from '../../api/client/index.js';
|
|
2
2
|
import type { SchemaTestable } from '../../schema/schema.js';
|
|
3
3
|
import type { ObjectSchemaOrType } from '../../schema/types/types.js';
|
|
4
|
+
import type { Record } from '../../types.js';
|
|
4
5
|
import type { AuthenticationApiDefinition } from '../authentication.api.js';
|
|
5
|
-
export declare function getAuthenticationApiClient<AdditionalTokenPayload, AuthenticationData>(additionalTokenPayloadSchema: ObjectSchemaOrType<AdditionalTokenPayload>, authenticationDataSchema: SchemaTestable<AuthenticationData>): ApiClient<AuthenticationApiDefinition<AdditionalTokenPayload, AuthenticationData>>;
|
|
6
|
+
export declare function getAuthenticationApiClient<AdditionalTokenPayload extends Record, AuthenticationData>(additionalTokenPayloadSchema: ObjectSchemaOrType<AdditionalTokenPayload>, authenticationDataSchema: SchemaTestable<AuthenticationData>): ApiClient<AuthenticationApiDefinition<AdditionalTokenPayload, AuthenticationData>>;
|
|
6
7
|
declare const defaultAuthenticationApiClient: ApiClient<AuthenticationApiDefinition<{}, unknown>>;
|
|
7
8
|
export declare class AuthenticationApiClient extends defaultAuthenticationApiClient {
|
|
8
9
|
}
|
|
@@ -10,7 +10,7 @@ import type { Record } from '../../types.js';
|
|
|
10
10
|
import type { Observable } from 'rxjs';
|
|
11
11
|
import type { AuthenticationApiDefinition } from '../authentication.api.js';
|
|
12
12
|
import type { SecretCheckResult, TokenPayload } from '../models/index.js';
|
|
13
|
-
export declare class AuthenticationService<AdditionalTokenPayload = Record<never>, AuthenticationData = void> implements AfterResolve, AsyncDisposable {
|
|
13
|
+
export declare class AuthenticationService<AdditionalTokenPayload extends Record = Record<never>, AuthenticationData = void> implements AfterResolve, AsyncDisposable {
|
|
14
14
|
private readonly client;
|
|
15
15
|
private readonly errorSubject;
|
|
16
16
|
private readonly tokenSubject;
|
|
@@ -20,8 +20,6 @@ export declare class AuthenticationService<AdditionalTokenPayload = Record<never
|
|
|
20
20
|
private readonly refreshLock;
|
|
21
21
|
private readonly logger;
|
|
22
22
|
private readonly disposeToken;
|
|
23
|
-
private set authenticationData(value);
|
|
24
|
-
private get authenticationData();
|
|
25
23
|
readonly error$: Observable<Error>;
|
|
26
24
|
readonly token$: Observable<TokenPayload<AdditionalTokenPayload> | undefined>;
|
|
27
25
|
readonly definedToken$: Observable<TokenPayload<AdditionalTokenPayload>>;
|
|
@@ -32,6 +30,8 @@ export declare class AuthenticationService<AdditionalTokenPayload = Record<never
|
|
|
32
30
|
readonly definedSessionId$: Observable<string>;
|
|
33
31
|
readonly isLoggedIn$: Observable<boolean>;
|
|
34
32
|
readonly loggedOut$: Observable<void>;
|
|
33
|
+
private get authenticationData();
|
|
34
|
+
private set authenticationData(value);
|
|
35
35
|
get isLoggedIn(): boolean;
|
|
36
36
|
get token(): TokenPayload<AdditionalTokenPayload> | undefined;
|
|
37
37
|
get definedToken(): TokenPayload<AdditionalTokenPayload>;
|
|
@@ -69,22 +69,6 @@ let AuthenticationService = class AuthenticationService2 {
|
|
|
69
69
|
refreshLock;
|
|
70
70
|
logger;
|
|
71
71
|
disposeToken;
|
|
72
|
-
set authenticationData(data) {
|
|
73
|
-
if ((0, import_type_guards.isUndefined)(data)) {
|
|
74
|
-
localStorage.removeItem(authenticationDataStorageKey);
|
|
75
|
-
} else {
|
|
76
|
-
const json = JSON.stringify(data);
|
|
77
|
-
localStorage.setItem(authenticationDataStorageKey, json);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
get authenticationData() {
|
|
81
|
-
try {
|
|
82
|
-
const data = localStorage.getItem(authenticationDataStorageKey);
|
|
83
|
-
return (0, import_type_guards.isNull)(data) ? void 0 : JSON.parse(data);
|
|
84
|
-
} catch {
|
|
85
|
-
return void 0;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
72
|
error$;
|
|
89
73
|
token$;
|
|
90
74
|
definedToken$;
|
|
@@ -95,6 +79,22 @@ let AuthenticationService = class AuthenticationService2 {
|
|
|
95
79
|
definedSessionId$;
|
|
96
80
|
isLoggedIn$;
|
|
97
81
|
loggedOut$;
|
|
82
|
+
get authenticationData() {
|
|
83
|
+
try {
|
|
84
|
+
const data = localStorage.getItem(authenticationDataStorageKey);
|
|
85
|
+
return (0, import_type_guards.isNull)(data) ? void 0 : JSON.parse(data);
|
|
86
|
+
} catch {
|
|
87
|
+
return void 0;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
set authenticationData(data) {
|
|
91
|
+
if ((0, import_type_guards.isUndefined)(data)) {
|
|
92
|
+
localStorage.removeItem(authenticationDataStorageKey);
|
|
93
|
+
} else {
|
|
94
|
+
const json = JSON.stringify(data);
|
|
95
|
+
localStorage.setItem(authenticationDataStorageKey, json);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
98
|
get isLoggedIn() {
|
|
99
99
|
return (0, import_type_guards.isDefined)(this.tokenSubject.value);
|
|
100
100
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HttpClientMiddleware } from '../../http/client/http-client.js';
|
|
2
2
|
import { AuthenticationService } from './authentication.service.js';
|
|
3
3
|
export type AuthenticationServiceProvider = () => (AuthenticationService<any, any> | Promise<AuthenticationService<any, any>>);
|
|
4
|
-
export declare const defaultAuthenticationServiceProvider: () => Promise<AuthenticationService<
|
|
4
|
+
export declare const defaultAuthenticationServiceProvider: () => Promise<AuthenticationService<import("../../types.js").Record, unknown>>;
|
|
5
5
|
export declare function waitForAuthenticationCredentialsMiddleware(authenticationService?: AuthenticationService | AuthenticationServiceProvider): HttpClientMiddleware;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Record } from '../../types.js';
|
|
2
2
|
import type { JwtToken, JwtTokenHeader } from '../../utils/jwt.js';
|
|
3
|
-
import type { TokenPayloadBase } from '
|
|
3
|
+
import type { TokenPayloadBase } from './token-payload-base.model.js';
|
|
4
4
|
export type TokenHeader = {
|
|
5
5
|
v: number;
|
|
6
6
|
};
|
|
7
|
-
export type Token<AdditionalTokenPayload = Record<never>> = JwtToken<TokenPayload<AdditionalTokenPayload>, JwtTokenHeader<TokenHeader>>;
|
|
8
|
-
export type TokenPayload<T = Record<never>> = T & TokenPayloadBase;
|
|
7
|
+
export type Token<AdditionalTokenPayload extends Record = Record<never>> = JwtToken<TokenPayload<AdditionalTokenPayload>, JwtTokenHeader<TokenHeader>>;
|
|
8
|
+
export type TokenPayload<T extends Record = Record<never>> = T & TokenPayloadBase;
|
|
9
9
|
export type RefreshToken = JwtToken<{
|
|
10
10
|
/** expiration timestamp in seconds */
|
|
11
11
|
exp: number;
|
|
@@ -2,7 +2,7 @@ import type { ApiController, ApiRequestContext, ApiServerResult } from '../../ap
|
|
|
2
2
|
import type { Record } from '../../types.js';
|
|
3
3
|
import type { AuthenticationApiDefinition } from '../authentication.api.js';
|
|
4
4
|
import { AuthenticationService } from './authentication.service.js';
|
|
5
|
-
export declare class AuthenticationApiController<AdditionalTokenPayload = Record<never>, AuthenticationData = void> implements ApiController<AuthenticationApiDefinition<AdditionalTokenPayload, AuthenticationData>> {
|
|
5
|
+
export declare class AuthenticationApiController<AdditionalTokenPayload extends Record = Record<never>, AuthenticationData = void> implements ApiController<AuthenticationApiDefinition<AdditionalTokenPayload, AuthenticationData>> {
|
|
6
6
|
readonly authenticationService: AuthenticationService<AdditionalTokenPayload, AuthenticationData>;
|
|
7
7
|
constructor(authenticationService: AuthenticationService<AdditionalTokenPayload, AuthenticationData>);
|
|
8
8
|
token({ parameters }: ApiRequestContext<AuthenticationApiDefinition<AdditionalTokenPayload, AuthenticationData>, 'token'>): Promise<ApiServerResult<AuthenticationApiDefinition<AdditionalTokenPayload, AuthenticationData>, 'token'>>;
|
|
@@ -34,12 +34,12 @@ export type AuthenticationResult = {
|
|
|
34
34
|
success: false;
|
|
35
35
|
subject?: undefined;
|
|
36
36
|
};
|
|
37
|
-
export type TokenResult<AdditionalTokenPayload = Record<never>> = {
|
|
37
|
+
export type TokenResult<AdditionalTokenPayload extends Record = Record<never>> = {
|
|
38
38
|
token: string;
|
|
39
39
|
jsonToken: Token<AdditionalTokenPayload>;
|
|
40
40
|
refreshToken: string;
|
|
41
41
|
};
|
|
42
|
-
export declare class AuthenticationService<AdditionalTokenPayload = Record<never>, AuthenticationData = void> implements AfterResolve {
|
|
42
|
+
export declare class AuthenticationService<AdditionalTokenPayload extends Record = Record<never>, AuthenticationData = void> implements AfterResolve {
|
|
43
43
|
private readonly credentialsRepository;
|
|
44
44
|
private readonly sessionRepository;
|
|
45
45
|
private readonly authenticationSecretRequirementsValidator;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HttpServerRequest } from '../../http/server/index.js';
|
|
2
2
|
import type { Record } from '../../types.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { RefreshToken, SecretResetToken, Token } from '../models/index.js';
|
|
4
4
|
/**
|
|
5
5
|
*
|
|
6
6
|
* @param request
|
|
@@ -8,8 +8,8 @@ import type { SecretResetToken, RefreshToken, Token } from '../models/index.js';
|
|
|
8
8
|
* @returns token string
|
|
9
9
|
*/
|
|
10
10
|
export declare function tryGetAuthorizationTokenStringFromRequest(request: HttpServerRequest, cookieName?: string, forceCookie?: boolean): string | undefined;
|
|
11
|
-
export declare function tryGetTokenFromRequest<AdditionalTokenPayload = Record<never>>(request: HttpServerRequest, tokenVersion: number, secret: string | BinaryData): Promise<Token<AdditionalTokenPayload> | undefined>;
|
|
12
|
-
export declare function getTokenFromRequest<AdditionalTokenPayload = Record<never>>(request: HttpServerRequest, tokenVersion: number, secret: string | BinaryData): Promise<Token<AdditionalTokenPayload>>;
|
|
13
|
-
export declare function getTokenFromString<AdditionalTokenPayload = Record<never>>(tokenString: string, tokenVersion: number, secret: string | BinaryData): Promise<Token<AdditionalTokenPayload>>;
|
|
11
|
+
export declare function tryGetTokenFromRequest<AdditionalTokenPayload extends Record = Record<never>>(request: HttpServerRequest, tokenVersion: number, secret: string | BinaryData): Promise<Token<AdditionalTokenPayload> | undefined>;
|
|
12
|
+
export declare function getTokenFromRequest<AdditionalTokenPayload extends Record = Record<never>>(request: HttpServerRequest, tokenVersion: number, secret: string | BinaryData): Promise<Token<AdditionalTokenPayload>>;
|
|
13
|
+
export declare function getTokenFromString<AdditionalTokenPayload extends Record = Record<never>>(tokenString: string, tokenVersion: number, secret: string | BinaryData): Promise<Token<AdditionalTokenPayload>>;
|
|
14
14
|
export declare function getRefreshTokenFromString(tokenString: string, secret: string | BinaryData): Promise<RefreshToken>;
|
|
15
15
|
export declare function getSecretResetTokenFromString(tokenString: string, secret: string | BinaryData): Promise<SecretResetToken>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Decorator } from '../reflection/index.js';
|
|
2
|
-
import type { Constructor, OneOrMany, Simplify,
|
|
3
|
-
import type {
|
|
2
|
+
import type { Constructor, OneOrMany, Simplify, TypedOmit } from '../types.js';
|
|
3
|
+
import type { RegistrationOptions } from './container.js';
|
|
4
4
|
import type { Provider } from './provider.js';
|
|
5
5
|
import type { InjectionToken } from './token.js';
|
|
6
6
|
import type { ArgumentProvider, ForwardRefInjectionToken, Mapper } from './types.js';
|
|
@@ -32,7 +32,7 @@ export declare function singleton<T = any, A = any>(options?: InjectableOptionsW
|
|
|
32
32
|
* registers the class in the global container with scoped lifecycle. Decorated class is not modified in any way
|
|
33
33
|
* @param options registration options
|
|
34
34
|
*/
|
|
35
|
-
export declare function scoped<T = any, A = any>(lifecycle:
|
|
35
|
+
export declare function scoped<T = any, A = any>(lifecycle: 'resolution', options?: InjectableOptionsWithoutLifecycle<T, A>): ClassDecorator;
|
|
36
36
|
/**
|
|
37
37
|
* sets the token used to resolve the parameter
|
|
38
38
|
* @param token token used for resolving
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.83.
|
|
3
|
+
"version": "0.83.11",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"luxon": "^3.3",
|
|
22
22
|
"reflect-metadata": "^0.1",
|
|
23
23
|
"rxjs": "^7.8",
|
|
24
|
-
"type-fest": "^
|
|
24
|
+
"type-fest": "^3.7"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/chroma-js": "2.4",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"nodemailer": "^6.9",
|
|
60
60
|
"preact": "^10.13",
|
|
61
61
|
"preact-render-to-string": "^5.2",
|
|
62
|
-
"puppeteer": "^19.
|
|
62
|
+
"puppeteer": "^19.8",
|
|
63
63
|
"undici": "^5.21",
|
|
64
64
|
"urlpattern-polyfill": "^6.0"
|
|
65
65
|
},
|
|
@@ -47,7 +47,7 @@ export declare function localizationData<T>(data: LocalizationData<T>): Localiza
|
|
|
47
47
|
* @param localization
|
|
48
48
|
* @returns
|
|
49
49
|
*/
|
|
50
|
-
export declare function getLocalizationKeys<T extends Localization
|
|
50
|
+
export declare function getLocalizationKeys<T extends Localization>(_localization?: T): ProxyLocalizationKeys<T['keys']>;
|
|
51
51
|
export declare const autoEnumerationLocalization: typeof _autoEnumerationLocalization;
|
|
52
52
|
export declare class LocalizationService {
|
|
53
53
|
private readonly logger;
|
package/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UnionToIntersection } from 'type-fest';
|
|
1
|
+
import type { Except, UnionToIntersection } from 'type-fest';
|
|
2
2
|
export type ObjectLiteral = {};
|
|
3
3
|
export type PrimitiveTypeMap = {
|
|
4
4
|
'string': string;
|
|
@@ -47,7 +47,7 @@ export type EnumerationKey<T extends EnumerationObject = EnumerationObject> = Ex
|
|
|
47
47
|
export type EnumerationMap<T extends EnumerationObject = EnumerationObject> = SimplifyObject<{
|
|
48
48
|
[P in EnumerationKey<T>]: (T[P] extends number ? (`${T[P]}` extends `${infer U extends number}` ? U : never) : `${T[P]}`) | T[P];
|
|
49
49
|
}>;
|
|
50
|
-
export type EnumerationValue<T extends Enumeration = Enumeration> = T extends EnumerationObject ?
|
|
50
|
+
export type EnumerationValue<T extends Enumeration = Enumeration> = T extends EnumerationObject ? SimplifyDeep<EnumerationMap<T>[keyof EnumerationMap<T>]> : T extends EnumerationArray ? T[number] : never;
|
|
51
51
|
export type EnumerationEntry<T extends EnumerationObject = EnumerationObject> = {
|
|
52
52
|
[P in EnumerationKey<T>]: [P, EnumerationMap<T>[P]];
|
|
53
53
|
}[EnumerationKey<T>];
|
|
@@ -113,16 +113,19 @@ export type OmitBy<T, V> = Omit<T, {
|
|
|
113
113
|
*/
|
|
114
114
|
export type Optionalize<T extends object> = OmitBy<T, undefined> & Partial<PickBy<T, undefined>>;
|
|
115
115
|
export type SimplifiedOptionalize<T extends object> = Simplify<Optionalize<T>>;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
*/
|
|
119
|
-
export type Simplify<T> = T extends (Primitive | Function | Date | RegExp) ? T : T extends (infer AT)[] ? Simplify<AT>[] : T extends readonly (infer AT)[] ? readonly Simplify<AT>[] : T extends Record ? SimplifyObject<T> : T;
|
|
120
|
-
/**
|
|
121
|
-
* remove type information on object
|
|
122
|
-
*/
|
|
116
|
+
export type Merge<T1, T2> = SimplifyObject<Except<T1, Extract<keyof T1, keyof T2>> & T2>;
|
|
117
|
+
export type Simplify<T> = T extends BuiltIn ? T : T extends readonly any[] ? SimplifyArray<T> : T extends Record ? SimplifyObject<T> : T;
|
|
123
118
|
export type SimplifyObject<T extends Record> = {
|
|
124
119
|
[K in keyof T]: T[K];
|
|
125
120
|
} & {};
|
|
121
|
+
export type SimplifyArray<T extends readonly any[]> = {
|
|
122
|
+
[I in keyof T]: Simplify<T[I]>;
|
|
123
|
+
};
|
|
124
|
+
export type SimplifyDeep<T> = T extends BuiltIn ? T : T extends readonly any[] ? {
|
|
125
|
+
[I in keyof T]: SimplifyDeep<T[I]>;
|
|
126
|
+
} : T extends Record ? {
|
|
127
|
+
[K in keyof T]: SimplifyDeep<T[K]>;
|
|
128
|
+
} & {} : T;
|
|
126
129
|
export type UnionToTuple<T, Tuple extends any[] = []> = UnionToIntersection<T extends any ? () => T : never> extends () => infer R ? UnionToTuple<Exclude<T, R>, [R, ...Tuple]> : Tuple;
|
|
127
130
|
export type UndefinableObject<T extends Record> = {
|
|
128
131
|
[K in keyof T]: T[K] | undefined;
|