web-core-tcm 0.0.38 → 0.0.40

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,441 +3,341 @@ 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 UserState {
84
- id?: string;
85
- name?: string;
86
- phoneNumber?: string;
87
- identityNumber?: string;
88
- gender?: string;
89
- createdTimestamp?: string;
90
- updatedTimestamp?: string;
10
+ id?: string;
11
+ name?: string;
12
+ phoneNumber?: string;
13
+ identityNumber?: string;
14
+ gender?: string;
15
+ createdTimestamp?: string;
16
+ updatedTimestamp?: string;
91
17
  }
92
18
  export interface PhoneVerifyRequest {
93
- phoneNumber?: string;
94
- code?: string;
95
- id?: string;
19
+ phoneNumber?: string;
20
+ code?: string;
21
+ id?: string;
96
22
  }
97
23
  export interface UserGetResponse {
98
- status?: number;
99
- user?: UserState;
24
+ status?: number;
25
+ user?: UserState;
100
26
  }
101
27
  export interface UserPutResponse {
102
- status?: number;
103
- user?: UserState;
28
+ status?: number;
29
+ user?: UserState;
104
30
  }
105
31
  export interface PhoneVerifyResponse {
106
- status?: number;
107
- token?: string;
108
- users?: UserState[];
109
- message?: string;
32
+ status?: number;
33
+ token?: string;
34
+ users?: UserState[];
35
+ message?: string;
110
36
  }
111
37
  export interface Model {
112
- bizId?: string;
113
- outId?: string;
114
- requestId?: string;
115
- verifyCode?: string;
38
+ bizId?: string;
39
+ outId?: string;
40
+ requestId?: string;
41
+ verifyCode?: string;
116
42
  }
117
43
  export interface SendSmsVerifyCodeResponseBody {
118
- accessDeniedDetail?: string;
119
- code?: string;
120
- message?: string;
121
- model?: Model;
122
- success?: boolean;
44
+ accessDeniedDetail?: string;
45
+ code?: string;
46
+ message?: string;
47
+ model?: Model;
48
+ success?: boolean;
123
49
  }
124
50
  export interface SendSmsVerifyCodeResponse {
125
- headers?: Record<string, string>;
126
- statusCode?: number;
127
- body?: SendSmsVerifyCodeResponseBody;
51
+ headers?: Record<string, string>;
52
+ statusCode?: number;
53
+ body?: SendSmsVerifyCodeResponseBody;
128
54
  }
129
55
  export interface TokenInfo {
130
- accessToken?: string;
131
- jwtToken?: string;
56
+ accessToken?: string;
57
+ jwtToken?: string;
132
58
  }
133
59
  export interface GetAuthTokenResponseBody {
134
- code?: string;
135
- message?: string;
136
- requestId?: string;
137
- tokenInfo?: TokenInfo;
60
+ code?: string;
61
+ message?: string;
62
+ requestId?: string;
63
+ tokenInfo?: TokenInfo;
138
64
  }
139
65
  export interface GetAuthTokenResponse {
140
- headers?: Record<string, string>;
141
- statusCode?: number;
142
- body?: GetAuthTokenResponseBody;
66
+ headers?: Record<string, string>;
67
+ statusCode?: number;
68
+ body?: GetAuthTokenResponseBody;
143
69
  }
144
70
  export interface GetClientResponse {
145
- status?: number;
146
- clientDescription?: string;
71
+ status?: number;
72
+ clientDescription?: string;
147
73
  }
148
74
  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;
75
+ interface oauthApi {
76
+ userStateRestful: {
77
+ /**
78
+ * ---
79
+ *
80
+ * [GET]
81
+ *
82
+ * **path:** /互联/服务/用户
83
+ *
84
+ * ---
85
+ *
86
+ * **Response**
87
+ * ```ts
88
+ * type Response = {
89
+ * status?: number
90
+ * user?: {
91
+ * id?: string
92
+ * name?: string
93
+ * phoneNumber?: string
94
+ * identityNumber?: string
95
+ * gender?: string
96
+ * createdTimestamp?: string
97
+ * updatedTimestamp?: string
98
+ * }
99
+ * }
100
+ * ```
101
+ */
102
+ getUserState<Config extends Alova2MethodConfig<UserGetResponse>>(config?: Config): Alova2Method<UserGetResponse, 'userStateRestful.getUserState', Config>;
103
+ /**
104
+ * ---
105
+ *
106
+ * [PUT]
107
+ *
108
+ * **path:** /互联/服务/用户
109
+ *
110
+ * ---
111
+ *
112
+ * **RequestBody**
113
+ * ```ts
114
+ * type RequestBody = {
115
+ * id?: string
116
+ * name?: string
117
+ * phoneNumber?: string
118
+ * identityNumber?: string
119
+ * gender?: string
120
+ * createdTimestamp?: string
121
+ * updatedTimestamp?: string
122
+ * }
123
+ * ```
124
+ *
125
+ * ---
126
+ *
127
+ * **Response**
128
+ * ```ts
129
+ * type Response = {
130
+ * status?: number
131
+ * user?: {
132
+ * id?: string
133
+ * name?: string
134
+ * phoneNumber?: string
135
+ * identityNumber?: string
136
+ * gender?: string
137
+ * createdTimestamp?: string
138
+ * updatedTimestamp?: string
139
+ * }
140
+ * }
141
+ * ```
142
+ */
143
+ putUserState<Config extends Alova2MethodConfig<UserPutResponse> & {
144
+ data: UserState;
145
+ }>(config: Config): Alova2Method<UserPutResponse, 'userStateRestful.putUserState', Config>;
146
+ };
147
+ phoneVerifyRestful: {
148
+ /**
149
+ * ---
150
+ *
151
+ * [POST]
152
+ *
153
+ * **path:** /互联/服务/电话/验证短信
154
+ *
155
+ * ---
156
+ *
157
+ * **RequestBody**
158
+ * ```ts
159
+ * type RequestBody = {
160
+ * phoneNumber?: string
161
+ * code?: string
162
+ * id?: string
163
+ * }
164
+ * ```
165
+ *
166
+ * ---
167
+ *
168
+ * **Response**
169
+ * ```ts
170
+ * type Response = {
171
+ * status?: number
172
+ * token?: string
173
+ * // [items] start
174
+ * // [items] end
175
+ * users?: Array<{
176
+ * id?: string
177
+ * name?: string
178
+ * phoneNumber?: string
179
+ * identityNumber?: string
180
+ * gender?: string
181
+ * createdTimestamp?: string
182
+ * updatedTimestamp?: string
183
+ * }>
184
+ * message?: string
185
+ * }
186
+ * ```
187
+ */
188
+ verifySMSCode<Config extends Alova2MethodConfig<PhoneVerifyResponse> & {
189
+ data: PhoneVerifyRequest;
190
+ }>(config: Config): Alova2Method<PhoneVerifyResponse, 'phoneVerifyRestful.verifySMSCode', Config>;
191
+ /**
192
+ * ---
193
+ *
194
+ * [GET]
195
+ *
196
+ * **path:** /互联/服务/电话/发送短信
197
+ *
198
+ * ---
199
+ *
200
+ * **Query Parameters**
201
+ * ```ts
202
+ * type QueryParameters = {
203
+ * phoneNumber: string
204
+ * }
205
+ * ```
206
+ *
207
+ * ---
208
+ *
209
+ * **Response**
210
+ * ```ts
211
+ * type Response = {
212
+ * headers?: Record<string, string>
213
+ * statusCode?: number
214
+ * body?: {
215
+ * accessDeniedDetail?: string
216
+ * code?: string
217
+ * message?: string
218
+ * model?: {
219
+ * bizId?: string
220
+ * outId?: string
221
+ * requestId?: string
222
+ * verifyCode?: string
223
+ * }
224
+ * success?: boolean
225
+ * }
226
+ * }
227
+ * ```
228
+ */
229
+ sendSMSCode<Config extends Alova2MethodConfig<SendSmsVerifyCodeResponse> & {
230
+ params: {
231
+ phoneNumber: string;
232
+ };
233
+ }>(config: Config): Alova2Method<SendSmsVerifyCodeResponse, 'phoneVerifyRestful.sendSMSCode', Config>;
234
+ /**
235
+ * ---
236
+ *
237
+ * [GET]
238
+ *
239
+ * **path:** /互联/服务/电话/令牌认证
240
+ *
241
+ * ---
242
+ *
243
+ * **Query Parameters**
244
+ * ```ts
245
+ * type QueryParameters = {
246
+ * bizType: number
247
+ * }
248
+ * ```
249
+ *
250
+ * ---
251
+ *
252
+ * **Response**
253
+ * ```ts
254
+ * type Response = {
255
+ * headers?: Record<string, string>
256
+ * statusCode?: number
257
+ * body?: {
258
+ * code?: string
259
+ * message?: string
260
+ * requestId?: string
261
+ * tokenInfo?: {
262
+ * accessToken?: string
263
+ * jwtToken?: string
264
+ * }
265
+ * }
266
+ * }
267
+ * ```
268
+ */
269
+ authToken<Config extends Alova2MethodConfig<GetAuthTokenResponse> & {
270
+ params: {
271
+ bizType: number;
272
+ };
273
+ }>(config: Config): Alova2Method<GetAuthTokenResponse, 'phoneVerifyRestful.authToken', Config>;
274
+ };
275
+ authorizationRestful: {
276
+ /**
277
+ * ---
278
+ *
279
+ * [GET]
280
+ *
281
+ * **path:** /互联/服务/授权/许可
282
+ *
283
+ * ---
284
+ *
285
+ * **Query Parameters**
286
+ * ```ts
287
+ * type QueryParameters = {
288
+ * client_id: string
289
+ * scope: string
290
+ * state: string
291
+ * }
292
+ * ```
293
+ *
294
+ * ---
295
+ *
296
+ * **Response**
297
+ * ```ts
298
+ * type Response = string
299
+ * ```
300
+ */
301
+ consent<Config extends Alova2MethodConfig<string> & {
302
+ params: {
303
+ client_id: string;
304
+ scope: string;
305
+ state: string;
306
+ };
307
+ }>(config: Config): Alova2Method<string, 'authorizationRestful.consent', Config>;
308
+ /**
309
+ * ---
310
+ *
311
+ * [GET]
312
+ *
313
+ * **path:** /互联/服务/授权/客户端介绍
314
+ *
315
+ * ---
316
+ *
317
+ * **Query Parameters**
318
+ * ```ts
319
+ * type QueryParameters = {
320
+ * client_id: string
321
+ * }
322
+ * ```
323
+ *
324
+ * ---
325
+ *
326
+ * **Response**
327
+ * ```ts
328
+ * type Response = {
329
+ * status?: number
330
+ * clientDescription?: string
331
+ * }
332
+ * ```
333
+ */
334
+ getClientDescription<Config extends Alova2MethodConfig<GetClientResponse> & {
335
+ params: {
336
+ client_id: string;
337
+ };
338
+ }>(config: Config): Alova2Method<GetClientResponse, 'authorizationRestful.getClientDescription', Config>;
339
+ };
340
+ }
341
+ var oauthApi: oauthApi;
443
342
  }
343
+ export {};