web-core-tcm 0.0.29 → 0.0.30

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.
@@ -0,0 +1,377 @@
1
+ import { Alova, AlovaMethodCreateConfig, AlovaGenerics, Method } from 'alova';
2
+ import { $$userConfigMap, alovaInstance } from './index';
3
+ import { default as apiDefinitions } from './apiDefinitions';
4
+ type CollapsedAlova = typeof alovaInstance;
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
+
83
+ export interface GetTokenRequest {
84
+ type?: string;
85
+ uid?: string;
86
+ token?: string;
87
+ }
88
+ 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;
97
+ }
98
+ 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;
110
+ }
111
+ 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;
120
+ }
121
+ export interface GetTokenResponse {
122
+ status?: number;
123
+ token?: string;
124
+ doctors?: DoctorState[];
125
+ patients?: PatientState[];
126
+ scientist?: ScientistState[];
127
+ }
128
+ export interface AuthorizationState {
129
+ requestDefinition?: string;
130
+ policyDefinition?: string;
131
+ policyEffect?: string;
132
+ matchers?: string;
133
+ policies?: string;
134
+ }
135
+ export interface ResourceAuthorizationState {
136
+ resourceId?: string;
137
+ authorizationStates?: AuthorizationState[];
138
+ ownerId?: string;
139
+ }
140
+ export interface RoleAuthorizationState {
141
+ role?: string;
142
+ authorizationStates?: AuthorizationState[];
143
+ }
144
+ export interface UserAuthorizationState {
145
+ userId?: string;
146
+ authorizationStates?: AuthorizationState[];
147
+ }
148
+ 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;
377
+ }