@ctil/gql 1.0.19 → 1.0.21
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/README.md +269 -269
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/{fp.esm-VY6KF7TP.js → fp.esm-QIG5OYFT.js} +3 -1
- package/dist/{fp.esm-VY6KF7TP.js.map → fp.esm-QIG5OYFT.js.map} +1 -1
- package/dist/index.cjs +554 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +337 -56
- package/dist/index.d.ts +337 -56
- package/dist/index.js +488 -15
- package/dist/index.js.map +1 -1
- package/package.json +53 -53
package/dist/index.d.ts
CHANGED
|
@@ -101,6 +101,7 @@ declare class CCRequest {
|
|
|
101
101
|
/** 构建初始 headers */
|
|
102
102
|
private buildHeaders;
|
|
103
103
|
setToken(token: string): void;
|
|
104
|
+
getToken(): string;
|
|
104
105
|
removeToken(): void;
|
|
105
106
|
setLoginInfo(loginInfo: UserToken, remember?: boolean): void;
|
|
106
107
|
/** 加载登录信息(仅负责加载,不负责刷新) */
|
|
@@ -109,8 +110,11 @@ declare class CCRequest {
|
|
|
109
110
|
getLoginInfo(): UserToken | null;
|
|
110
111
|
removeLoginInfo(): void;
|
|
111
112
|
setEndpoint(endpoint: string): void;
|
|
113
|
+
getEndpoint(): string | undefined;
|
|
112
114
|
setHeader(key: string, value: string): void;
|
|
115
|
+
getHeader(key: string): string;
|
|
113
116
|
setHeaders(headers: Record<string, string>): void;
|
|
117
|
+
getHeaders(): Record<string, string>;
|
|
114
118
|
removeHeader(key: string): void;
|
|
115
119
|
clearHeaders(): void;
|
|
116
120
|
/** 无感刷新 token */
|
|
@@ -126,9 +130,15 @@ declare function getClient(): CCRequest;
|
|
|
126
130
|
declare const useInterceptor: (interceptor: RequestInterceptor) => void;
|
|
127
131
|
declare const setToken: (token: string) => void;
|
|
128
132
|
declare const removeToken: () => void;
|
|
133
|
+
declare const getToken: () => string;
|
|
134
|
+
declare const getLoginInfo: () => UserToken | null;
|
|
135
|
+
declare const getLoginRoles: () => string[] | undefined;
|
|
129
136
|
declare const setEndpoint: (endpoint: string) => void;
|
|
137
|
+
declare const getEndpoint: () => string | undefined;
|
|
130
138
|
declare const setHeader: (key: string, value: string) => void;
|
|
131
139
|
declare const setHeaders: (headers: Record<string, string>) => void;
|
|
140
|
+
declare const getHeaders: () => Record<string, string>;
|
|
141
|
+
declare const getHeader: (key: string) => string;
|
|
132
142
|
declare const removeHeader: (key: string) => void;
|
|
133
143
|
declare const clearHeaders: () => void;
|
|
134
144
|
|
|
@@ -168,61 +178,6 @@ declare function generateOperationName(entityName: string, original: string): st
|
|
|
168
178
|
declare function toPascalCase(str: string): string;
|
|
169
179
|
declare function buildCommonResultSelection(dataFields?: FieldInput[]): string;
|
|
170
180
|
|
|
171
|
-
declare const rateLimitConfig: {
|
|
172
|
-
defaultRules: {
|
|
173
|
-
query: {
|
|
174
|
-
max: number;
|
|
175
|
-
window: number;
|
|
176
|
-
debounce: number;
|
|
177
|
-
};
|
|
178
|
-
mutation: {
|
|
179
|
-
max: number;
|
|
180
|
-
window: number;
|
|
181
|
-
debounce: number;
|
|
182
|
-
};
|
|
183
|
-
};
|
|
184
|
-
custom: {
|
|
185
|
-
login: {
|
|
186
|
-
max: number;
|
|
187
|
-
window: number;
|
|
188
|
-
debounce: number;
|
|
189
|
-
};
|
|
190
|
-
refreshToken: {
|
|
191
|
-
max: number;
|
|
192
|
-
window: number;
|
|
193
|
-
debounce: number;
|
|
194
|
-
};
|
|
195
|
-
};
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
declare function setRateLimitConfig(newConfig: typeof rateLimitConfig): void;
|
|
199
|
-
declare function getRateLimitConfig(): {
|
|
200
|
-
defaultRules: {
|
|
201
|
-
query: {
|
|
202
|
-
max: number;
|
|
203
|
-
window: number;
|
|
204
|
-
debounce: number;
|
|
205
|
-
};
|
|
206
|
-
mutation: {
|
|
207
|
-
max: number;
|
|
208
|
-
window: number;
|
|
209
|
-
debounce: number;
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
custom: {
|
|
213
|
-
login: {
|
|
214
|
-
max: number;
|
|
215
|
-
window: number;
|
|
216
|
-
debounce: number;
|
|
217
|
-
};
|
|
218
|
-
refreshToken: {
|
|
219
|
-
max: number;
|
|
220
|
-
window: number;
|
|
221
|
-
debounce: number;
|
|
222
|
-
};
|
|
223
|
-
};
|
|
224
|
-
};
|
|
225
|
-
|
|
226
181
|
interface QueryInput {
|
|
227
182
|
operationName: string;
|
|
228
183
|
fields?: FieldInput[];
|
|
@@ -263,6 +218,25 @@ interface AggregateFieldInput {
|
|
|
263
218
|
max?: string[];
|
|
264
219
|
min?: string[];
|
|
265
220
|
}
|
|
221
|
+
/** 生成完整 query,包括变量定义 */
|
|
222
|
+
declare function buildGraphQLQueryList(input: QueryInput): {
|
|
223
|
+
query: string;
|
|
224
|
+
variables: Record<string, any> | undefined;
|
|
225
|
+
};
|
|
226
|
+
/** 生成按 ID 查询的 GraphQL query(固定主键参数名为 id) */
|
|
227
|
+
declare function buildGraphQLQueryByIdFixed(queryByIdInput: QueryByIdInput): {
|
|
228
|
+
query: string;
|
|
229
|
+
variables: Record<string, any>;
|
|
230
|
+
};
|
|
231
|
+
/** 生成分页查询的输入 */
|
|
232
|
+
declare function buildGraphQLQueryPageList(input: QueryPageListInput): {
|
|
233
|
+
query: string;
|
|
234
|
+
variables: Record<string, any> | undefined;
|
|
235
|
+
};
|
|
236
|
+
declare function buildGraphQLQueryAggregate(input: QueryAggregateInput): {
|
|
237
|
+
query: string;
|
|
238
|
+
variables: Record<string, any> | undefined;
|
|
239
|
+
};
|
|
266
240
|
|
|
267
241
|
interface InsertOneInput {
|
|
268
242
|
operationName: string;
|
|
@@ -308,17 +282,64 @@ interface DeleteInput {
|
|
|
308
282
|
where: WhereInput;
|
|
309
283
|
variables?: Record<string, any>;
|
|
310
284
|
}
|
|
285
|
+
type MutationField = {
|
|
286
|
+
affected_rows?: boolean;
|
|
287
|
+
returning?: FieldInput[];
|
|
288
|
+
};
|
|
289
|
+
/** 生成单个插入的 GraphQL mutation */
|
|
290
|
+
declare function buildGraphQLMutationInsertOne(input: InsertOneInput): {
|
|
291
|
+
query: string;
|
|
292
|
+
variables: Record<string, any>;
|
|
293
|
+
};
|
|
294
|
+
/** 生成批量插入的 GraphQL mutation */
|
|
295
|
+
declare function buildGraphQLMutationBatchInsert(input: BatchInsertInput): {
|
|
296
|
+
query: string;
|
|
297
|
+
variables: Record<string, any>;
|
|
298
|
+
};
|
|
299
|
+
/** 生成根据条件更新的 GraphQL mutation */
|
|
300
|
+
declare function buildGraphQLMutationUpdate(input: UpdateInput): {
|
|
301
|
+
query: string;
|
|
302
|
+
variables: Record<string, any>;
|
|
303
|
+
};
|
|
304
|
+
/** 生成批量更新的 GraphQL mutation(根据 ID) */
|
|
305
|
+
declare function buildGraphQLMutationBatchUpdate(input: BatchUpdateInput): {
|
|
306
|
+
query: string;
|
|
307
|
+
variables: Record<string, any>;
|
|
308
|
+
};
|
|
309
|
+
/** 生成根据主键更新的 GraphQL mutation */
|
|
310
|
+
declare function buildGraphQLMutationUpdateByPk(input: UpdateByPkInput): {
|
|
311
|
+
query: string;
|
|
312
|
+
variables: Record<string, any>;
|
|
313
|
+
};
|
|
314
|
+
/** 生成根据主键删除的 GraphQL mutation */
|
|
315
|
+
declare function buildGraphQLMutationDeleteById(input: DeleteByIdInput): {
|
|
316
|
+
query: string;
|
|
317
|
+
variables: Record<string, any>;
|
|
318
|
+
};
|
|
319
|
+
/** 生成根据条件删除的 GraphQL mutation */
|
|
320
|
+
declare function buildGraphQLMutationDelete(input: DeleteInput): {
|
|
321
|
+
query: string;
|
|
322
|
+
variables: Record<string, any>;
|
|
323
|
+
};
|
|
311
324
|
|
|
312
325
|
interface SendCodeInput {
|
|
313
326
|
phone: string;
|
|
314
327
|
dataFields?: FieldInput[];
|
|
315
328
|
variables?: Record<string, any>;
|
|
316
329
|
}
|
|
330
|
+
declare function buildGraphQLMutationSendCode(input: SendCodeInput): {
|
|
331
|
+
query: string;
|
|
332
|
+
variables: Record<string, any>;
|
|
333
|
+
};
|
|
317
334
|
interface VerifyCodeInput {
|
|
318
335
|
code: string;
|
|
319
336
|
phone: string;
|
|
320
337
|
variables?: Record<string, any>;
|
|
321
338
|
}
|
|
339
|
+
declare function buildGraphQLMutationVerifyCode(input: VerifyCodeInput): {
|
|
340
|
+
query: string;
|
|
341
|
+
variables: Record<string, any>;
|
|
342
|
+
};
|
|
322
343
|
|
|
323
344
|
interface LoginInput {
|
|
324
345
|
account: string;
|
|
@@ -327,25 +348,49 @@ interface LoginInput {
|
|
|
327
348
|
variables?: Record<string, any>;
|
|
328
349
|
remember?: boolean;
|
|
329
350
|
}
|
|
351
|
+
declare function buildGraphQLMutationLogin(input: LoginInput): {
|
|
352
|
+
query: string;
|
|
353
|
+
variables: Record<string, any>;
|
|
354
|
+
};
|
|
330
355
|
interface RegisterUserInput {
|
|
331
356
|
user: Record<string, any>;
|
|
332
357
|
fields: FieldInput[];
|
|
333
358
|
variables?: Record<string, any>;
|
|
334
359
|
}
|
|
360
|
+
declare function buildGraphQLMutationRegisterUser(input: RegisterUserInput): {
|
|
361
|
+
query: string;
|
|
362
|
+
variables: Record<string, any>;
|
|
363
|
+
};
|
|
335
364
|
interface LogoutInput {
|
|
336
365
|
dataFields?: FieldInput[];
|
|
337
366
|
variables?: Record<string, any>;
|
|
338
367
|
}
|
|
368
|
+
declare function buildGraphQLMutationLogout(input?: LogoutInput): {
|
|
369
|
+
query: string;
|
|
370
|
+
variables: Record<string, any>;
|
|
371
|
+
};
|
|
372
|
+
declare function buildGraphQLMutationLogoutAllDevices(input?: LogoutInput): {
|
|
373
|
+
query: string;
|
|
374
|
+
variables: Record<string, any>;
|
|
375
|
+
};
|
|
339
376
|
interface LogoutDeviceInput {
|
|
340
377
|
deviceId: string;
|
|
341
378
|
dataFields?: FieldInput[];
|
|
342
379
|
variables?: Record<string, any>;
|
|
343
380
|
}
|
|
381
|
+
declare function buildGraphQLMutationLogoutDevice(input: LogoutDeviceInput): {
|
|
382
|
+
query: string;
|
|
383
|
+
variables: Record<string, any>;
|
|
384
|
+
};
|
|
344
385
|
interface RefreshTokenInput {
|
|
345
386
|
refreshToken: string;
|
|
346
387
|
variables?: Record<string, any>;
|
|
347
388
|
remember?: boolean;
|
|
348
389
|
}
|
|
390
|
+
declare function buildGraphQLMutationRefreshToken(input: RefreshTokenInput): {
|
|
391
|
+
query: string;
|
|
392
|
+
variables: Record<string, any>;
|
|
393
|
+
};
|
|
349
394
|
|
|
350
395
|
interface FilePreview {
|
|
351
396
|
/** 资源ID,主键 */
|
|
@@ -359,6 +404,171 @@ interface FilePreview {
|
|
|
359
404
|
/** 文件地址 */
|
|
360
405
|
url: string;
|
|
361
406
|
}
|
|
407
|
+
interface PresignedUrlResult {
|
|
408
|
+
/** 上传预签名 URL(PUT/POST) */
|
|
409
|
+
uploadUrl: string;
|
|
410
|
+
/** 下载预签名 URL(可选,如果是 private 文件) */
|
|
411
|
+
downloadUrl?: string;
|
|
412
|
+
/** OSS 文件路径 */
|
|
413
|
+
objectKey: string;
|
|
414
|
+
/** 上传 URL 过期时间 */
|
|
415
|
+
expireAt?: string | Date;
|
|
416
|
+
/** Content-Type */
|
|
417
|
+
contentType?: string;
|
|
418
|
+
/** 原始文件名 */
|
|
419
|
+
originalFileName?: string;
|
|
420
|
+
/** resourceId,后台可能返回,便于直接绑定到实体 */
|
|
421
|
+
resourceId?: number | null;
|
|
422
|
+
/** 上传时需要设置的 HTTP Header */
|
|
423
|
+
uploadHeaders?: UploadHeaders;
|
|
424
|
+
}
|
|
425
|
+
interface UploadHeaders {
|
|
426
|
+
/** 文件 MD5,Base64 编码 */
|
|
427
|
+
contentMD5?: string;
|
|
428
|
+
/** 文件 Content-Type */
|
|
429
|
+
contentType?: string;
|
|
430
|
+
/** 文件 ACL: PRIVATE / PUBLIC_READ */
|
|
431
|
+
x_oss_object_acl?: string;
|
|
432
|
+
/** 请求时间戳(秒) */
|
|
433
|
+
date?: string;
|
|
434
|
+
}
|
|
435
|
+
interface UploadPresignedUrlInput {
|
|
436
|
+
/** 文件 base64 MD5 值,用于去重 */
|
|
437
|
+
fileMd5Base64: string;
|
|
438
|
+
/** 文件后缀,例如 "jpg", "png" */
|
|
439
|
+
fileSuffix: string;
|
|
440
|
+
/** 用户上传的原始文件名 */
|
|
441
|
+
originalFileName: string;
|
|
442
|
+
/** 一级目录,例如 "avatars" */
|
|
443
|
+
folder?: string;
|
|
444
|
+
/** 文件大小,单位字节 */
|
|
445
|
+
fileSize: number;
|
|
446
|
+
/** 文件访问权限: "private" | "public_read",默认 private */
|
|
447
|
+
acl?: 'private' | 'public_read';
|
|
448
|
+
}
|
|
449
|
+
declare function buildGraphQLUploadPresignedUrl(input: UploadPresignedUrlInput): {
|
|
450
|
+
query: string;
|
|
451
|
+
variables: Record<string, any>;
|
|
452
|
+
};
|
|
453
|
+
declare function buildGraphQLGetFilePreview(resourceId: number | string): {
|
|
454
|
+
query: string;
|
|
455
|
+
variables: Record<string, any>;
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
type index_AggregateFieldInput = AggregateFieldInput;
|
|
459
|
+
type index_BatchInsertInput = BatchInsertInput;
|
|
460
|
+
type index_BatchUpdateInput = BatchUpdateInput;
|
|
461
|
+
type index_DeleteByIdInput = DeleteByIdInput;
|
|
462
|
+
type index_DeleteInput = DeleteInput;
|
|
463
|
+
type index_FieldInput = FieldInput;
|
|
464
|
+
type index_FieldNode = FieldNode;
|
|
465
|
+
type index_FilePreview = FilePreview;
|
|
466
|
+
type index_InsertOneInput = InsertOneInput;
|
|
467
|
+
type index_LoginInput = LoginInput;
|
|
468
|
+
type index_LogoutDeviceInput = LogoutDeviceInput;
|
|
469
|
+
type index_LogoutInput = LogoutInput;
|
|
470
|
+
type index_MutationField = MutationField;
|
|
471
|
+
type index_PresignedUrlResult = PresignedUrlResult;
|
|
472
|
+
type index_QueryAggregateInput = QueryAggregateInput;
|
|
473
|
+
type index_QueryByIdInput = QueryByIdInput;
|
|
474
|
+
type index_QueryInput = QueryInput;
|
|
475
|
+
type index_QueryPageListInput = QueryPageListInput;
|
|
476
|
+
type index_RefreshTokenInput = RefreshTokenInput;
|
|
477
|
+
type index_RegisterUserInput = RegisterUserInput;
|
|
478
|
+
type index_SendCodeInput = SendCodeInput;
|
|
479
|
+
type index_UpdateByPkInput = UpdateByPkInput;
|
|
480
|
+
type index_UpdateInput = UpdateInput;
|
|
481
|
+
type index_UploadHeaders = UploadHeaders;
|
|
482
|
+
type index_UploadPresignedUrlInput = UploadPresignedUrlInput;
|
|
483
|
+
type index_VerifyCodeInput = VerifyCodeInput;
|
|
484
|
+
type index_WhereInput = WhereInput;
|
|
485
|
+
declare const index_buildCommonResultSelection: typeof buildCommonResultSelection;
|
|
486
|
+
declare const index_buildDataValue: typeof buildDataValue;
|
|
487
|
+
declare const index_buildFields: typeof buildFields;
|
|
488
|
+
declare const index_buildGraphQLGetFilePreview: typeof buildGraphQLGetFilePreview;
|
|
489
|
+
declare const index_buildGraphQLMutationBatchInsert: typeof buildGraphQLMutationBatchInsert;
|
|
490
|
+
declare const index_buildGraphQLMutationBatchUpdate: typeof buildGraphQLMutationBatchUpdate;
|
|
491
|
+
declare const index_buildGraphQLMutationDelete: typeof buildGraphQLMutationDelete;
|
|
492
|
+
declare const index_buildGraphQLMutationDeleteById: typeof buildGraphQLMutationDeleteById;
|
|
493
|
+
declare const index_buildGraphQLMutationInsertOne: typeof buildGraphQLMutationInsertOne;
|
|
494
|
+
declare const index_buildGraphQLMutationLogin: typeof buildGraphQLMutationLogin;
|
|
495
|
+
declare const index_buildGraphQLMutationLogout: typeof buildGraphQLMutationLogout;
|
|
496
|
+
declare const index_buildGraphQLMutationLogoutAllDevices: typeof buildGraphQLMutationLogoutAllDevices;
|
|
497
|
+
declare const index_buildGraphQLMutationLogoutDevice: typeof buildGraphQLMutationLogoutDevice;
|
|
498
|
+
declare const index_buildGraphQLMutationRefreshToken: typeof buildGraphQLMutationRefreshToken;
|
|
499
|
+
declare const index_buildGraphQLMutationRegisterUser: typeof buildGraphQLMutationRegisterUser;
|
|
500
|
+
declare const index_buildGraphQLMutationSendCode: typeof buildGraphQLMutationSendCode;
|
|
501
|
+
declare const index_buildGraphQLMutationUpdate: typeof buildGraphQLMutationUpdate;
|
|
502
|
+
declare const index_buildGraphQLMutationUpdateByPk: typeof buildGraphQLMutationUpdateByPk;
|
|
503
|
+
declare const index_buildGraphQLMutationVerifyCode: typeof buildGraphQLMutationVerifyCode;
|
|
504
|
+
declare const index_buildGraphQLQueryAggregate: typeof buildGraphQLQueryAggregate;
|
|
505
|
+
declare const index_buildGraphQLQueryByIdFixed: typeof buildGraphQLQueryByIdFixed;
|
|
506
|
+
declare const index_buildGraphQLQueryList: typeof buildGraphQLQueryList;
|
|
507
|
+
declare const index_buildGraphQLQueryPageList: typeof buildGraphQLQueryPageList;
|
|
508
|
+
declare const index_buildGraphQLUploadPresignedUrl: typeof buildGraphQLUploadPresignedUrl;
|
|
509
|
+
declare const index_buildMutationFields: typeof buildMutationFields;
|
|
510
|
+
declare const index_buildWhere: typeof buildWhere;
|
|
511
|
+
declare const index_formatGraphQLValue: typeof formatGraphQLValue;
|
|
512
|
+
declare const index_generateOperationName: typeof generateOperationName;
|
|
513
|
+
declare const index_toPascalCase: typeof toPascalCase;
|
|
514
|
+
declare namespace index {
|
|
515
|
+
export { type index_AggregateFieldInput as AggregateFieldInput, type index_BatchInsertInput as BatchInsertInput, type index_BatchUpdateInput as BatchUpdateInput, type index_DeleteByIdInput as DeleteByIdInput, type index_DeleteInput as DeleteInput, type index_FieldInput as FieldInput, type index_FieldNode as FieldNode, type index_FilePreview as FilePreview, type index_InsertOneInput as InsertOneInput, type index_LoginInput as LoginInput, type index_LogoutDeviceInput as LogoutDeviceInput, type index_LogoutInput as LogoutInput, type index_MutationField as MutationField, type index_PresignedUrlResult as PresignedUrlResult, type index_QueryAggregateInput as QueryAggregateInput, type index_QueryByIdInput as QueryByIdInput, type index_QueryInput as QueryInput, type index_QueryPageListInput as QueryPageListInput, type index_RefreshTokenInput as RefreshTokenInput, type index_RegisterUserInput as RegisterUserInput, type index_SendCodeInput as SendCodeInput, type index_UpdateByPkInput as UpdateByPkInput, type index_UpdateInput as UpdateInput, type index_UploadHeaders as UploadHeaders, type index_UploadPresignedUrlInput as UploadPresignedUrlInput, type index_VerifyCodeInput as VerifyCodeInput, type index_WhereInput as WhereInput, index_buildCommonResultSelection as buildCommonResultSelection, index_buildDataValue as buildDataValue, index_buildFields as buildFields, index_buildGraphQLGetFilePreview as buildGraphQLGetFilePreview, index_buildGraphQLMutationBatchInsert as buildGraphQLMutationBatchInsert, index_buildGraphQLMutationBatchUpdate as buildGraphQLMutationBatchUpdate, index_buildGraphQLMutationDelete as buildGraphQLMutationDelete, index_buildGraphQLMutationDeleteById as buildGraphQLMutationDeleteById, index_buildGraphQLMutationInsertOne as buildGraphQLMutationInsertOne, index_buildGraphQLMutationLogin as buildGraphQLMutationLogin, index_buildGraphQLMutationLogout as buildGraphQLMutationLogout, index_buildGraphQLMutationLogoutAllDevices as buildGraphQLMutationLogoutAllDevices, index_buildGraphQLMutationLogoutDevice as buildGraphQLMutationLogoutDevice, index_buildGraphQLMutationRefreshToken as buildGraphQLMutationRefreshToken, index_buildGraphQLMutationRegisterUser as buildGraphQLMutationRegisterUser, index_buildGraphQLMutationSendCode as buildGraphQLMutationSendCode, index_buildGraphQLMutationUpdate as buildGraphQLMutationUpdate, index_buildGraphQLMutationUpdateByPk as buildGraphQLMutationUpdateByPk, index_buildGraphQLMutationVerifyCode as buildGraphQLMutationVerifyCode, index_buildGraphQLQueryAggregate as buildGraphQLQueryAggregate, index_buildGraphQLQueryByIdFixed as buildGraphQLQueryByIdFixed, index_buildGraphQLQueryList as buildGraphQLQueryList, index_buildGraphQLQueryPageList as buildGraphQLQueryPageList, index_buildGraphQLUploadPresignedUrl as buildGraphQLUploadPresignedUrl, index_buildMutationFields as buildMutationFields, index_buildWhere as buildWhere, index_formatGraphQLValue as formatGraphQLValue, index_generateOperationName as generateOperationName, index_toPascalCase as toPascalCase };
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
declare const rateLimitConfig: {
|
|
519
|
+
defaultRules: {
|
|
520
|
+
query: {
|
|
521
|
+
max: number;
|
|
522
|
+
window: number;
|
|
523
|
+
debounce: number;
|
|
524
|
+
};
|
|
525
|
+
mutation: {
|
|
526
|
+
max: number;
|
|
527
|
+
window: number;
|
|
528
|
+
debounce: number;
|
|
529
|
+
};
|
|
530
|
+
};
|
|
531
|
+
custom: {
|
|
532
|
+
login: {
|
|
533
|
+
max: number;
|
|
534
|
+
window: number;
|
|
535
|
+
debounce: number;
|
|
536
|
+
};
|
|
537
|
+
refreshToken: {
|
|
538
|
+
max: number;
|
|
539
|
+
window: number;
|
|
540
|
+
debounce: number;
|
|
541
|
+
};
|
|
542
|
+
};
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
declare function setRateLimitConfig(newConfig: typeof rateLimitConfig): void;
|
|
546
|
+
declare function getRateLimitConfig(): {
|
|
547
|
+
defaultRules: {
|
|
548
|
+
query: {
|
|
549
|
+
max: number;
|
|
550
|
+
window: number;
|
|
551
|
+
debounce: number;
|
|
552
|
+
};
|
|
553
|
+
mutation: {
|
|
554
|
+
max: number;
|
|
555
|
+
window: number;
|
|
556
|
+
debounce: number;
|
|
557
|
+
};
|
|
558
|
+
};
|
|
559
|
+
custom: {
|
|
560
|
+
login: {
|
|
561
|
+
max: number;
|
|
562
|
+
window: number;
|
|
563
|
+
debounce: number;
|
|
564
|
+
};
|
|
565
|
+
refreshToken: {
|
|
566
|
+
max: number;
|
|
567
|
+
window: number;
|
|
568
|
+
debounce: number;
|
|
569
|
+
};
|
|
570
|
+
};
|
|
571
|
+
};
|
|
362
572
|
|
|
363
573
|
declare const auth: {
|
|
364
574
|
login<T = requestResult<UserToken>>(input: LoginInput): Promise<T>;
|
|
@@ -444,4 +654,75 @@ declare function getBrowserDeviceInfo(): Promise<DeviceInfo>;
|
|
|
444
654
|
/** 跨平台获取设备信息 */
|
|
445
655
|
declare function getDeviceInfo(): Promise<DeviceInfo>;
|
|
446
656
|
|
|
447
|
-
|
|
657
|
+
declare function formatDate(date: Date | string, format?: string): string;
|
|
658
|
+
declare function getStartOfDay(date?: Date): Date;
|
|
659
|
+
declare function getEndOfDay(date?: Date): Date;
|
|
660
|
+
declare function getStartOfWeek(date?: Date): Date;
|
|
661
|
+
declare function getEndOfWeek(date?: Date): Date;
|
|
662
|
+
declare function getStartOfMonth(date?: Date): Date;
|
|
663
|
+
declare function getEndOfMonth(date?: Date): Date;
|
|
664
|
+
declare function isLeapYear(year: number): boolean;
|
|
665
|
+
declare function diffDays(date1: Date, date2: Date): number;
|
|
666
|
+
declare function addDays(date: Date, n: number): Date;
|
|
667
|
+
declare function secondsToTime(sec: number): string;
|
|
668
|
+
declare function fromNow(date: Date | string): string;
|
|
669
|
+
|
|
670
|
+
declare function deepClone<T>(obj: T): T;
|
|
671
|
+
declare function merge<T, U>(obj1: T, obj2: U): T & U;
|
|
672
|
+
declare function isEmptyObject(obj: object): boolean;
|
|
673
|
+
declare function pick<T extends object, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
|
|
674
|
+
declare function omit<T extends object, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
|
|
675
|
+
declare function get(obj: any, path: string, def?: any): any;
|
|
676
|
+
declare function set(obj: any, path: string, value: any): any;
|
|
677
|
+
declare function isEqual(a: any, b: any): boolean;
|
|
678
|
+
declare function flatten(obj: any, prefix?: string, res?: Record<string, any>): Record<string, any>;
|
|
679
|
+
declare function unflatten(obj: Record<string, any>): any;
|
|
680
|
+
|
|
681
|
+
declare function unique<T>(arr: T[]): T[];
|
|
682
|
+
declare function intersection<T>(arr1: T[], arr2: T[]): T[];
|
|
683
|
+
declare function union<T>(arr1: T[], arr2: T[]): T[];
|
|
684
|
+
declare function groupBy<T, K extends keyof T>(arr: T[], key: K): Record<string, T[]>;
|
|
685
|
+
declare function difference<T>(arr1: T[], arr2: T[]): T[];
|
|
686
|
+
|
|
687
|
+
declare function formatMoney(num: number | string): string;
|
|
688
|
+
declare function add(a: number, b: number): number;
|
|
689
|
+
declare function subtract(a: number, b: number): number;
|
|
690
|
+
declare function multiply(a: number, b: number): number;
|
|
691
|
+
declare function divide(a: number, b: number): number;
|
|
692
|
+
declare function roundWithPrecision(num: number, precision?: number): number;
|
|
693
|
+
declare function randomInt(min: number, max: number): number;
|
|
694
|
+
declare function toFixed(num: number, precision?: number): string;
|
|
695
|
+
declare function toPercent(num: number, total: number, precision?: number): string;
|
|
696
|
+
declare function toNonExponential(num: number): string;
|
|
697
|
+
declare function inRange(num: number, min: number, max: number): boolean;
|
|
698
|
+
declare function toNumber(val: any): number;
|
|
699
|
+
declare function ceil(num: number): number;
|
|
700
|
+
declare function floor(num: number): number;
|
|
701
|
+
declare function round(num: number): number;
|
|
702
|
+
|
|
703
|
+
declare function toSnakeCase(str: string): string;
|
|
704
|
+
declare function capitalize(str: string): string;
|
|
705
|
+
declare function truncate(str: string, length: number, suffix?: string): string;
|
|
706
|
+
declare function removeAllSpace(str: string): string;
|
|
707
|
+
declare function trim(str: string): string;
|
|
708
|
+
declare function toCamelCase(str: string): string;
|
|
709
|
+
declare function kebabToCamel(str: string): string;
|
|
710
|
+
declare function uncapitalize(str: string): string;
|
|
711
|
+
declare function reverse(str: string): string;
|
|
712
|
+
declare function isNumeric(str: string): boolean;
|
|
713
|
+
declare function isEmail(str: string): boolean;
|
|
714
|
+
declare function countSubstr(str: string, sub: string): number;
|
|
715
|
+
declare function randomString(len?: number): string;
|
|
716
|
+
|
|
717
|
+
declare function base64Encode(input: string): string;
|
|
718
|
+
declare function base64Decode(input: string): string;
|
|
719
|
+
declare function hashCode(str: string): number;
|
|
720
|
+
declare function md5(str: string): string;
|
|
721
|
+
declare function simpleSHA1(str: string): string;
|
|
722
|
+
|
|
723
|
+
declare function getExtName(filename: string): string;
|
|
724
|
+
declare function formatSize(bytes: number): string;
|
|
725
|
+
declare function fileToBase64(file: File | Blob): Promise<string>;
|
|
726
|
+
declare function base64ToFile(dataurl: string, filename: string, mimeType?: string): File;
|
|
727
|
+
|
|
728
|
+
export { type AggregateFieldInput, type BatchInsertInput, type BatchUpdateInput, type DeleteByIdInput, type DeleteInput, type DeviceInfo, type FieldInput, type FieldNode, type InsertOneInput, type LoginInput, type LogoutDeviceInput, type LogoutInput, type QueryAggregateInput, type QueryByIdInput, type QueryInput, type QueryPageListInput, type RefreshTokenInput, type RegisterUserInput, type RequestConfig, type RequestInterceptor, type SendCodeInput, type UpdateByPkInput, type UpdateInput, type UserToken, type VerifyCodeInput, type WhereInput, add, addDays, auth, base64Decode, base64Encode, base64ToFile, capitalize, ceil, clearHeaders, countSubstr, deepClone, diffDays, difference, divide, fileToBase64, flatten, floor, formatDate, formatMoney, formatSize, fromNow, get, getBrowserDeviceInfo, getClient, getDeviceInfo, getEndOfDay, getEndOfMonth, getEndOfWeek, getEndpoint, getExtName, getHeader, getHeaders, getLoginInfo, getLoginRoles, getRateLimitConfig, getStartOfDay, getStartOfMonth, getStartOfWeek, getToken, gql, index as gqlBuilder, groupBy, hashCode, inRange, initGraphQLClient, intersection, isEmail, isEmptyObject, isEqual, isLeapYear, isNumeric, kebabToCamel, md5, merge, multiply, mutation, omit, oss, pick, query, randomInt, randomString, type rateLimitConfig$1 as rateLimitConfig, removeAllSpace, removeHeader, removeToken, type requestResult, reverse, round, roundWithPrecision, secondsToTime, set, setEndpoint, setHeader, setHeaders, setRateLimitConfig, setToken, simpleSHA1, sms, subtract, toCamelCase, toFixed, toNonExponential, toNumber, toPercent, toSnakeCase, trim, truncate, uncapitalize, unflatten, union, unique, useInterceptor };
|