web-core-tcm 0.0.38 → 0.0.39

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.
@@ -3,375 +3,273 @@ import { $$userConfigMap, alovaInstance } from './index';
3
3
  import { default as apiDefinitions } from './apiDefinitions';
4
4
  type CollapsedAlova = typeof alovaInstance;
5
5
  type UserMethodConfigMap = typeof $$userConfigMap;
6
-
7
- type Alova2MethodConfig<Responded> =
8
- CollapsedAlova extends Alova<
9
- AlovaGenerics<
10
- any,
11
- any,
12
- infer RequestConfig,
13
- infer Response,
14
- infer ResponseHeader,
15
- infer L1Cache,
16
- infer L2Cache,
17
- infer SE
18
- >
19
- >
20
- ? Omit<
21
- AlovaMethodCreateConfig<
22
- AlovaGenerics<
23
- Responded,
24
- any,
25
- RequestConfig,
26
- Response,
27
- ResponseHeader,
28
- L1Cache,
29
- L2Cache,
30
- SE
31
- >,
32
- any,
33
- Responded
34
- >,
35
- 'params'
36
- >
37
- : never;
38
-
39
- // Extract the return type of transform function that define in $$userConfigMap, if it not exists, use the default type.
40
- type ExtractUserDefinedTransformed<
41
- DefinitionKey extends keyof typeof apiDefinitions,
42
- Default,
43
- > = DefinitionKey extends keyof UserMethodConfigMap
44
- ? UserMethodConfigMap[DefinitionKey]['transform'] extends (...args: any[]) => any
45
- ? Awaited<ReturnType<UserMethodConfigMap[DefinitionKey]['transform']>>
46
- : Default
47
- : Default;
48
- type Alova2Method<
49
- Responded,
50
- DefinitionKey extends keyof typeof apiDefinitions,
51
- CurrentConfig extends Alova2MethodConfig<any>,
52
- > =
53
- CollapsedAlova extends Alova<
54
- AlovaGenerics<
55
- any,
56
- any,
57
- infer RequestConfig,
58
- infer Response,
59
- infer ResponseHeader,
60
- infer L1Cache,
61
- infer L2Cache,
62
- infer SE
63
- >
64
- >
65
- ? Method<
66
- AlovaGenerics<
67
- CurrentConfig extends undefined
68
- ? ExtractUserDefinedTransformed<DefinitionKey, Responded>
69
- : CurrentConfig['transform'] extends (...args: any[]) => any
70
- ? Awaited<ReturnType<CurrentConfig['transform']>>
71
- : ExtractUserDefinedTransformed<DefinitionKey, Responded>,
72
- any,
73
- RequestConfig,
74
- Response,
75
- ResponseHeader,
76
- L1Cache,
77
- L2Cache,
78
- SE
79
- >
80
- >
81
- : never;
82
-
6
+ type Alova2MethodConfig<Responded> = CollapsedAlova extends Alova<AlovaGenerics<any, any, infer RequestConfig, infer Response, infer ResponseHeader, infer L1Cache, infer L2Cache, infer SE>> ? Omit<AlovaMethodCreateConfig<AlovaGenerics<Responded, any, RequestConfig, Response, ResponseHeader, L1Cache, L2Cache, SE>, any, Responded>, 'params'> : never;
7
+ type ExtractUserDefinedTransformed<DefinitionKey extends keyof typeof apiDefinitions, Default> = DefinitionKey extends keyof UserMethodConfigMap ? UserMethodConfigMap[DefinitionKey]['transform'] extends (...args: any[]) => any ? Awaited<ReturnType<UserMethodConfigMap[DefinitionKey]['transform']>> : Default : Default;
8
+ type Alova2Method<Responded, DefinitionKey extends keyof typeof apiDefinitions, CurrentConfig extends Alova2MethodConfig<any>> = CollapsedAlova extends Alova<AlovaGenerics<any, any, infer RequestConfig, infer Response, infer ResponseHeader, infer L1Cache, infer L2Cache, infer SE>> ? Method<AlovaGenerics<CurrentConfig extends undefined ? ExtractUserDefinedTransformed<DefinitionKey, Responded> : CurrentConfig['transform'] extends (...args: any[]) => any ? Awaited<ReturnType<CurrentConfig['transform']>> : ExtractUserDefinedTransformed<DefinitionKey, Responded>, any, RequestConfig, Response, ResponseHeader, L1Cache, L2Cache, SE>> : never;
83
9
  export interface GetTokenRequest {
84
- type?: string;
85
- uid?: string;
86
- token?: string;
10
+ type?: string;
11
+ uid?: string;
12
+ token?: string;
87
13
  }
88
14
  export interface DoctorState {
89
- id?: string;
90
- name?: string;
91
- createdTimestamp?: number;
92
- updatedTimestamp?: number;
93
- gender?: string;
94
- identityNumber?: string;
95
- phoneNumber?: string;
96
- birthdate?: string;
15
+ id?: string;
16
+ name?: string;
17
+ createdTimestamp?: number;
18
+ updatedTimestamp?: number;
19
+ gender?: string;
20
+ identityNumber?: string;
21
+ phoneNumber?: string;
22
+ birthdate?: string;
97
23
  }
98
24
  export interface PatientState {
99
- id?: string;
100
- doctorId?: string;
101
- name?: string;
102
- createdTimestamp?: number;
103
- updatedTimestamp?: number;
104
- identity?: string;
105
- gender?: string;
106
- phoneNumber?: string;
107
- birthdate?: string;
108
- tags?: string;
109
- mainSymptom?: string;
25
+ id?: string;
26
+ doctorId?: string;
27
+ name?: string;
28
+ createdTimestamp?: number;
29
+ updatedTimestamp?: number;
30
+ identity?: string;
31
+ gender?: string;
32
+ phoneNumber?: string;
33
+ birthdate?: string;
34
+ tags?: string;
35
+ mainSymptom?: string;
110
36
  }
111
37
  export interface ScientistState {
112
- id?: string;
113
- name?: string;
114
- createdTimestamp?: number;
115
- updatedTimestamp?: number;
116
- identityNumber?: string;
117
- gender?: string;
118
- phoneNumber?: string;
119
- birthdate?: string;
38
+ id?: string;
39
+ name?: string;
40
+ createdTimestamp?: number;
41
+ updatedTimestamp?: number;
42
+ identityNumber?: string;
43
+ gender?: string;
44
+ phoneNumber?: string;
45
+ birthdate?: string;
120
46
  }
121
47
  export interface GetTokenResponse {
122
- status?: number;
123
- token?: string;
124
- doctors?: DoctorState[];
125
- patients?: PatientState[];
126
- scientist?: ScientistState[];
48
+ status?: number;
49
+ token?: string;
50
+ doctors?: DoctorState[];
51
+ patients?: PatientState[];
52
+ scientist?: ScientistState[];
127
53
  }
128
54
  export interface AuthorizationState {
129
- requestDefinition?: string;
130
- policyDefinition?: string;
131
- policyEffect?: string;
132
- matchers?: string;
133
- policies?: string;
55
+ requestDefinition?: string;
56
+ policyDefinition?: string;
57
+ policyEffect?: string;
58
+ matchers?: string;
59
+ policies?: string;
134
60
  }
135
61
  export interface ResourceAuthorizationState {
136
- resourceId?: string;
137
- authorizationStates?: AuthorizationState[];
138
- ownerId?: string;
62
+ resourceId?: string;
63
+ authorizationStates?: AuthorizationState[];
64
+ ownerId?: string;
139
65
  }
140
66
  export interface RoleAuthorizationState {
141
- role?: string;
142
- authorizationStates?: AuthorizationState[];
67
+ role?: string;
68
+ authorizationStates?: AuthorizationState[];
143
69
  }
144
70
  export interface UserAuthorizationState {
145
- userId?: string;
146
- authorizationStates?: AuthorizationState[];
71
+ userId?: string;
72
+ authorizationStates?: AuthorizationState[];
147
73
  }
148
74
  declare global {
149
- interface authorizeApi {
150
- oAuthRestful: {
151
- /**
152
- * ---
153
- *
154
- * [POST]
155
- *
156
- * **path:** /授权/服务/令牌
157
- *
158
- * ---
159
- *
160
- * **RequestBody**
161
- * ```ts
162
- * type RequestBody = {
163
- * type?: string
164
- * uid?: string
165
- * token?: string
166
- * }
167
- * ```
168
- *
169
- * ---
170
- *
171
- * **Response**
172
- * ```ts
173
- * type Response = {
174
- * status?: number
175
- * token?: string
176
- * // [items] start
177
- * // [items] end
178
- * doctors?: Array<{
179
- * id?: string
180
- * name?: string
181
- * createdTimestamp?: number
182
- * updatedTimestamp?: number
183
- * gender?: string
184
- * identityNumber?: string
185
- * phoneNumber?: string
186
- * birthdate?: string
187
- * }>
188
- * // [items] start
189
- * // [items] end
190
- * patients?: Array<{
191
- * id?: string
192
- * doctorId?: string
193
- * name?: string
194
- * createdTimestamp?: number
195
- * updatedTimestamp?: number
196
- * identity?: string
197
- * gender?: string
198
- * phoneNumber?: string
199
- * birthdate?: string
200
- * tags?: string
201
- * mainSymptom?: string
202
- * }>
203
- * // [items] start
204
- * // [items] end
205
- * scientist?: Array<{
206
- * id?: string
207
- * name?: string
208
- * createdTimestamp?: number
209
- * updatedTimestamp?: number
210
- * identityNumber?: string
211
- * gender?: string
212
- * phoneNumber?: string
213
- * birthdate?: string
214
- * }>
215
- * }
216
- * ```
217
- */
218
- getToken<
219
- Config extends Alova2MethodConfig<GetTokenResponse> & {
220
- data: GetTokenRequest;
221
- },
222
- >(
223
- config: Config,
224
- ): Alova2Method<GetTokenResponse, 'oAuthRestful.getToken', Config>;
225
- };
226
- resourceAuthorizationRestful: {
227
- /**
228
- * ---
229
- *
230
- * [GET]
231
- *
232
- * **path:** /授权/服务/资源/{id}
233
- *
234
- * ---
235
- *
236
- * **Path Parameters**
237
- * ```ts
238
- * type PathParameters = {
239
- * id: string
240
- * }
241
- * ```
242
- *
243
- * ---
244
- *
245
- * **Response**
246
- * ```ts
247
- * type Response = {
248
- * resourceId?: string
249
- * // [items] start
250
- * // [items] end
251
- * authorizationStates?: Array<{
252
- * requestDefinition?: string
253
- * policyDefinition?: string
254
- * policyEffect?: string
255
- * matchers?: string
256
- * policies?: string
257
- * }>
258
- * ownerId?: string
259
- * }
260
- * ```
261
- */
262
- getResourceAuthorizationState<
263
- Config extends Alova2MethodConfig<ResourceAuthorizationState> & {
264
- pathParams: {
265
- id: string;
266
- };
267
- },
268
- >(
269
- config: Config,
270
- ): Alova2Method<
271
- ResourceAuthorizationState,
272
- 'resourceAuthorizationRestful.getResourceAuthorizationState',
273
- Config
274
- >;
275
- };
276
- roleAuthorizationRestful: {
277
- /**
278
- * ---
279
- *
280
- * [GET]
281
- *
282
- * **path:** /授权/服务/角色/{role}
283
- *
284
- * ---
285
- *
286
- * **Path Parameters**
287
- * ```ts
288
- * type PathParameters = {
289
- * role: string
290
- * }
291
- * ```
292
- *
293
- * ---
294
- *
295
- * **Response**
296
- * ```ts
297
- * type Response = {
298
- * role?: string
299
- * // [items] start
300
- * // [items] end
301
- * authorizationStates?: Array<{
302
- * requestDefinition?: string
303
- * policyDefinition?: string
304
- * policyEffect?: string
305
- * matchers?: string
306
- * policies?: string
307
- * }>
308
- * }
309
- * ```
310
- */
311
- getRoleAuthorizationState<
312
- Config extends Alova2MethodConfig<RoleAuthorizationState> & {
313
- pathParams: {
314
- role: string;
315
- };
316
- },
317
- >(
318
- config: Config,
319
- ): Alova2Method<
320
- RoleAuthorizationState,
321
- 'roleAuthorizationRestful.getRoleAuthorizationState',
322
- Config
323
- >;
324
- };
325
- userAuthorizationRestful: {
326
- /**
327
- * ---
328
- *
329
- * [GET]
330
- *
331
- * **path:** /授权/服务/用户/{userId}
332
- *
333
- * ---
334
- *
335
- * **Path Parameters**
336
- * ```ts
337
- * type PathParameters = {
338
- * userId: string
339
- * }
340
- * ```
341
- *
342
- * ---
343
- *
344
- * **Response**
345
- * ```ts
346
- * type Response = {
347
- * userId?: string
348
- * // [items] start
349
- * // [items] end
350
- * authorizationStates?: Array<{
351
- * requestDefinition?: string
352
- * policyDefinition?: string
353
- * policyEffect?: string
354
- * matchers?: string
355
- * policies?: string
356
- * }>
357
- * }
358
- * ```
359
- */
360
- getUserAuthorizationState<
361
- Config extends Alova2MethodConfig<UserAuthorizationState> & {
362
- pathParams: {
363
- userId: string;
364
- };
365
- },
366
- >(
367
- config: Config,
368
- ): Alova2Method<
369
- UserAuthorizationState,
370
- 'userAuthorizationRestful.getUserAuthorizationState',
371
- Config
372
- >;
373
- };
374
- }
375
-
376
- var authorizeApi: authorizeApi;
75
+ interface authorizeApi {
76
+ oAuthRestful: {
77
+ /**
78
+ * ---
79
+ *
80
+ * [POST]
81
+ *
82
+ * **path:** /授权/服务/令牌
83
+ *
84
+ * ---
85
+ *
86
+ * **RequestBody**
87
+ * ```ts
88
+ * type RequestBody = {
89
+ * type?: string
90
+ * uid?: string
91
+ * token?: string
92
+ * }
93
+ * ```
94
+ *
95
+ * ---
96
+ *
97
+ * **Response**
98
+ * ```ts
99
+ * type Response = {
100
+ * status?: number
101
+ * token?: string
102
+ * // [items] start
103
+ * // [items] end
104
+ * doctors?: Array<{
105
+ * id?: string
106
+ * name?: string
107
+ * createdTimestamp?: number
108
+ * updatedTimestamp?: number
109
+ * gender?: string
110
+ * identityNumber?: string
111
+ * phoneNumber?: string
112
+ * birthdate?: string
113
+ * }>
114
+ * // [items] start
115
+ * // [items] end
116
+ * patients?: Array<{
117
+ * id?: string
118
+ * doctorId?: string
119
+ * name?: string
120
+ * createdTimestamp?: number
121
+ * updatedTimestamp?: number
122
+ * identity?: string
123
+ * gender?: string
124
+ * phoneNumber?: string
125
+ * birthdate?: string
126
+ * tags?: string
127
+ * mainSymptom?: string
128
+ * }>
129
+ * // [items] start
130
+ * // [items] end
131
+ * scientist?: Array<{
132
+ * id?: string
133
+ * name?: string
134
+ * createdTimestamp?: number
135
+ * updatedTimestamp?: number
136
+ * identityNumber?: string
137
+ * gender?: string
138
+ * phoneNumber?: string
139
+ * birthdate?: string
140
+ * }>
141
+ * }
142
+ * ```
143
+ */
144
+ getToken<Config extends Alova2MethodConfig<GetTokenResponse> & {
145
+ data: GetTokenRequest;
146
+ }>(config: Config): Alova2Method<GetTokenResponse, 'oAuthRestful.getToken', Config>;
147
+ };
148
+ resourceAuthorizationRestful: {
149
+ /**
150
+ * ---
151
+ *
152
+ * [GET]
153
+ *
154
+ * **path:** /授权/服务/资源/{id}
155
+ *
156
+ * ---
157
+ *
158
+ * **Path Parameters**
159
+ * ```ts
160
+ * type PathParameters = {
161
+ * id: string
162
+ * }
163
+ * ```
164
+ *
165
+ * ---
166
+ *
167
+ * **Response**
168
+ * ```ts
169
+ * type Response = {
170
+ * resourceId?: string
171
+ * // [items] start
172
+ * // [items] end
173
+ * authorizationStates?: Array<{
174
+ * requestDefinition?: string
175
+ * policyDefinition?: string
176
+ * policyEffect?: string
177
+ * matchers?: string
178
+ * policies?: string
179
+ * }>
180
+ * ownerId?: string
181
+ * }
182
+ * ```
183
+ */
184
+ getResourceAuthorizationState<Config extends Alova2MethodConfig<ResourceAuthorizationState> & {
185
+ pathParams: {
186
+ id: string;
187
+ };
188
+ }>(config: Config): Alova2Method<ResourceAuthorizationState, 'resourceAuthorizationRestful.getResourceAuthorizationState', Config>;
189
+ };
190
+ roleAuthorizationRestful: {
191
+ /**
192
+ * ---
193
+ *
194
+ * [GET]
195
+ *
196
+ * **path:** /授权/服务/角色/{role}
197
+ *
198
+ * ---
199
+ *
200
+ * **Path Parameters**
201
+ * ```ts
202
+ * type PathParameters = {
203
+ * role: string
204
+ * }
205
+ * ```
206
+ *
207
+ * ---
208
+ *
209
+ * **Response**
210
+ * ```ts
211
+ * type Response = {
212
+ * role?: string
213
+ * // [items] start
214
+ * // [items] end
215
+ * authorizationStates?: Array<{
216
+ * requestDefinition?: string
217
+ * policyDefinition?: string
218
+ * policyEffect?: string
219
+ * matchers?: string
220
+ * policies?: string
221
+ * }>
222
+ * }
223
+ * ```
224
+ */
225
+ getRoleAuthorizationState<Config extends Alova2MethodConfig<RoleAuthorizationState> & {
226
+ pathParams: {
227
+ role: string;
228
+ };
229
+ }>(config: Config): Alova2Method<RoleAuthorizationState, 'roleAuthorizationRestful.getRoleAuthorizationState', Config>;
230
+ };
231
+ userAuthorizationRestful: {
232
+ /**
233
+ * ---
234
+ *
235
+ * [GET]
236
+ *
237
+ * **path:** /授权/服务/用户/{userId}
238
+ *
239
+ * ---
240
+ *
241
+ * **Path Parameters**
242
+ * ```ts
243
+ * type PathParameters = {
244
+ * userId: string
245
+ * }
246
+ * ```
247
+ *
248
+ * ---
249
+ *
250
+ * **Response**
251
+ * ```ts
252
+ * type Response = {
253
+ * userId?: string
254
+ * // [items] start
255
+ * // [items] end
256
+ * authorizationStates?: Array<{
257
+ * requestDefinition?: string
258
+ * policyDefinition?: string
259
+ * policyEffect?: string
260
+ * matchers?: string
261
+ * policies?: string
262
+ * }>
263
+ * }
264
+ * ```
265
+ */
266
+ getUserAuthorizationState<Config extends Alova2MethodConfig<UserAuthorizationState> & {
267
+ pathParams: {
268
+ userId: string;
269
+ };
270
+ }>(config: Config): Alova2Method<UserAuthorizationState, 'userAuthorizationRestful.getUserAuthorizationState', Config>;
271
+ };
272
+ }
273
+ var authorizeApi: authorizeApi;
377
274
  }
275
+ export {};
@@ -1,4 +1,4 @@
1
1
  import { Authorization } from '../../authorization';
2
2
  export declare class AlovaAuthorization extends Authorization {
3
- static getToken(type?: string, uid?: string, token?: string): Promise<import('../globals').GetTokenResponse>;
3
+ static getToken(type?: string, uid?: string, token?: string): Promise<import('..').GetTokenResponse>;
4
4
  }
@@ -3,3 +3,4 @@ export declare const $$userConfigMap: {};
3
3
  declare const Apis: authorizeApi;
4
4
  export default Apis;
5
5
  export * from './implement';
6
+ export * from './globals';