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,443 @@
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 UserState {
84
+ id?: string;
85
+ name?: string;
86
+ phoneNumber?: string;
87
+ identityNumber?: string;
88
+ gender?: string;
89
+ createdTimestamp?: string;
90
+ updatedTimestamp?: string;
91
+ }
92
+ export interface PhoneVerifyRequest {
93
+ phoneNumber?: string;
94
+ code?: string;
95
+ id?: string;
96
+ }
97
+ export interface UserGetResponse {
98
+ status?: number;
99
+ user?: UserState;
100
+ }
101
+ export interface UserPutResponse {
102
+ status?: number;
103
+ user?: UserState;
104
+ }
105
+ export interface PhoneVerifyResponse {
106
+ status?: number;
107
+ token?: string;
108
+ users?: UserState[];
109
+ message?: string;
110
+ }
111
+ export interface Model {
112
+ bizId?: string;
113
+ outId?: string;
114
+ requestId?: string;
115
+ verifyCode?: string;
116
+ }
117
+ export interface SendSmsVerifyCodeResponseBody {
118
+ accessDeniedDetail?: string;
119
+ code?: string;
120
+ message?: string;
121
+ model?: Model;
122
+ success?: boolean;
123
+ }
124
+ export interface SendSmsVerifyCodeResponse {
125
+ headers?: Record<string, string>;
126
+ statusCode?: number;
127
+ body?: SendSmsVerifyCodeResponseBody;
128
+ }
129
+ export interface TokenInfo {
130
+ accessToken?: string;
131
+ jwtToken?: string;
132
+ }
133
+ export interface GetAuthTokenResponseBody {
134
+ code?: string;
135
+ message?: string;
136
+ requestId?: string;
137
+ tokenInfo?: TokenInfo;
138
+ }
139
+ export interface GetAuthTokenResponse {
140
+ headers?: Record<string, string>;
141
+ statusCode?: number;
142
+ body?: GetAuthTokenResponseBody;
143
+ }
144
+ export interface GetClientResponse {
145
+ status?: number;
146
+ clientDescription?: string;
147
+ }
148
+ declare global {
149
+ interface oauthApi {
150
+ userStateRestful: {
151
+ /**
152
+ * ---
153
+ *
154
+ * [GET]
155
+ *
156
+ * **path:** /互联/服务/用户
157
+ *
158
+ * ---
159
+ *
160
+ * **Response**
161
+ * ```ts
162
+ * type Response = {
163
+ * status?: number
164
+ * user?: {
165
+ * id?: string
166
+ * name?: string
167
+ * phoneNumber?: string
168
+ * identityNumber?: string
169
+ * gender?: string
170
+ * createdTimestamp?: string
171
+ * updatedTimestamp?: string
172
+ * }
173
+ * }
174
+ * ```
175
+ */
176
+ getUserState<Config extends Alova2MethodConfig<UserGetResponse>>(
177
+ config?: Config,
178
+ ): Alova2Method<UserGetResponse, 'userStateRestful.getUserState', Config>;
179
+ /**
180
+ * ---
181
+ *
182
+ * [PUT]
183
+ *
184
+ * **path:** /互联/服务/用户
185
+ *
186
+ * ---
187
+ *
188
+ * **RequestBody**
189
+ * ```ts
190
+ * type RequestBody = {
191
+ * id?: string
192
+ * name?: string
193
+ * phoneNumber?: string
194
+ * identityNumber?: string
195
+ * gender?: string
196
+ * createdTimestamp?: string
197
+ * updatedTimestamp?: string
198
+ * }
199
+ * ```
200
+ *
201
+ * ---
202
+ *
203
+ * **Response**
204
+ * ```ts
205
+ * type Response = {
206
+ * status?: number
207
+ * user?: {
208
+ * id?: string
209
+ * name?: string
210
+ * phoneNumber?: string
211
+ * identityNumber?: string
212
+ * gender?: string
213
+ * createdTimestamp?: string
214
+ * updatedTimestamp?: string
215
+ * }
216
+ * }
217
+ * ```
218
+ */
219
+ putUserState<
220
+ Config extends Alova2MethodConfig<UserPutResponse> & {
221
+ data: UserState;
222
+ },
223
+ >(
224
+ config: Config,
225
+ ): Alova2Method<UserPutResponse, 'userStateRestful.putUserState', Config>;
226
+ };
227
+ phoneVerifyRestful: {
228
+ /**
229
+ * ---
230
+ *
231
+ * [POST]
232
+ *
233
+ * **path:** /互联/服务/电话/验证短信
234
+ *
235
+ * ---
236
+ *
237
+ * **RequestBody**
238
+ * ```ts
239
+ * type RequestBody = {
240
+ * phoneNumber?: string
241
+ * code?: string
242
+ * id?: string
243
+ * }
244
+ * ```
245
+ *
246
+ * ---
247
+ *
248
+ * **Response**
249
+ * ```ts
250
+ * type Response = {
251
+ * status?: number
252
+ * token?: string
253
+ * // [items] start
254
+ * // [items] end
255
+ * users?: Array<{
256
+ * id?: string
257
+ * name?: string
258
+ * phoneNumber?: string
259
+ * identityNumber?: string
260
+ * gender?: string
261
+ * createdTimestamp?: string
262
+ * updatedTimestamp?: string
263
+ * }>
264
+ * message?: string
265
+ * }
266
+ * ```
267
+ */
268
+ verifySMSCode<
269
+ Config extends Alova2MethodConfig<PhoneVerifyResponse> & {
270
+ data: PhoneVerifyRequest;
271
+ },
272
+ >(
273
+ config: Config,
274
+ ): Alova2Method<PhoneVerifyResponse, 'phoneVerifyRestful.verifySMSCode', Config>;
275
+ /**
276
+ * ---
277
+ *
278
+ * [GET]
279
+ *
280
+ * **path:** /互联/服务/电话/发送短信
281
+ *
282
+ * ---
283
+ *
284
+ * **Query Parameters**
285
+ * ```ts
286
+ * type QueryParameters = {
287
+ * phoneNumber: string
288
+ * }
289
+ * ```
290
+ *
291
+ * ---
292
+ *
293
+ * **Response**
294
+ * ```ts
295
+ * type Response = {
296
+ * headers?: Record<string, string>
297
+ * statusCode?: number
298
+ * body?: {
299
+ * accessDeniedDetail?: string
300
+ * code?: string
301
+ * message?: string
302
+ * model?: {
303
+ * bizId?: string
304
+ * outId?: string
305
+ * requestId?: string
306
+ * verifyCode?: string
307
+ * }
308
+ * success?: boolean
309
+ * }
310
+ * }
311
+ * ```
312
+ */
313
+ sendSMSCode<
314
+ Config extends Alova2MethodConfig<SendSmsVerifyCodeResponse> & {
315
+ params: {
316
+ phoneNumber: string;
317
+ };
318
+ },
319
+ >(
320
+ config: Config,
321
+ ): Alova2Method<SendSmsVerifyCodeResponse, 'phoneVerifyRestful.sendSMSCode', Config>;
322
+ /**
323
+ * ---
324
+ *
325
+ * [GET]
326
+ *
327
+ * **path:** /互联/服务/电话/令牌认证
328
+ *
329
+ * ---
330
+ *
331
+ * **Query Parameters**
332
+ * ```ts
333
+ * type QueryParameters = {
334
+ * bizType: number
335
+ * }
336
+ * ```
337
+ *
338
+ * ---
339
+ *
340
+ * **Response**
341
+ * ```ts
342
+ * type Response = {
343
+ * headers?: Record<string, string>
344
+ * statusCode?: number
345
+ * body?: {
346
+ * code?: string
347
+ * message?: string
348
+ * requestId?: string
349
+ * tokenInfo?: {
350
+ * accessToken?: string
351
+ * jwtToken?: string
352
+ * }
353
+ * }
354
+ * }
355
+ * ```
356
+ */
357
+ authToken<
358
+ Config extends Alova2MethodConfig<GetAuthTokenResponse> & {
359
+ params: {
360
+ bizType: number;
361
+ };
362
+ },
363
+ >(
364
+ config: Config,
365
+ ): Alova2Method<GetAuthTokenResponse, 'phoneVerifyRestful.authToken', Config>;
366
+ };
367
+ authorizationRestful: {
368
+ /**
369
+ * ---
370
+ *
371
+ * [GET]
372
+ *
373
+ * **path:** /互联/服务/授权/许可
374
+ *
375
+ * ---
376
+ *
377
+ * **Query Parameters**
378
+ * ```ts
379
+ * type QueryParameters = {
380
+ * client_id: string
381
+ * scope: string
382
+ * state: string
383
+ * }
384
+ * ```
385
+ *
386
+ * ---
387
+ *
388
+ * **Response**
389
+ * ```ts
390
+ * type Response = string
391
+ * ```
392
+ */
393
+ consent<
394
+ Config extends Alova2MethodConfig<string> & {
395
+ params: {
396
+ client_id: string;
397
+ scope: string;
398
+ state: string;
399
+ };
400
+ },
401
+ >(
402
+ config: Config,
403
+ ): Alova2Method<string, 'authorizationRestful.consent', Config>;
404
+ /**
405
+ * ---
406
+ *
407
+ * [GET]
408
+ *
409
+ * **path:** /互联/服务/授权/客户端介绍
410
+ *
411
+ * ---
412
+ *
413
+ * **Query Parameters**
414
+ * ```ts
415
+ * type QueryParameters = {
416
+ * client_id: string
417
+ * }
418
+ * ```
419
+ *
420
+ * ---
421
+ *
422
+ * **Response**
423
+ * ```ts
424
+ * type Response = {
425
+ * status?: number
426
+ * clientDescription?: string
427
+ * }
428
+ * ```
429
+ */
430
+ getClientDescription<
431
+ Config extends Alova2MethodConfig<GetClientResponse> & {
432
+ params: {
433
+ client_id: string;
434
+ };
435
+ },
436
+ >(
437
+ config: Config,
438
+ ): Alova2Method<GetClientResponse, 'authorizationRestful.getClientDescription', Config>;
439
+ };
440
+ }
441
+
442
+ var oauthApi: oauthApi;
443
+ }