@xezzon/zeroweb-sdk 0.9.0 → 0.10.0

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.
Files changed (71) hide show
  1. package/LICENSE +127 -0
  2. package/README.md +1 -1
  3. package/dist/{typings/admin → admin}/app.d.ts +1 -1
  4. package/dist/{typings/admin → admin}/authn.d.ts +1 -1
  5. package/dist/{typings/admin → admin}/authz.d.ts +3 -3
  6. package/dist/{typings/admin → admin}/crypto.d.ts +1 -1
  7. package/dist/{typings/admin → admin}/dict.d.ts +1 -1
  8. package/dist/{typings/admin → admin}/index.d.ts +1 -1
  9. package/dist/{typings/admin → admin}/role.d.ts +1 -1
  10. package/dist/{typings/admin → admin}/setting.d.ts +1 -1
  11. package/dist/{typings/admin → admin}/user.d.ts +27 -3
  12. package/dist/{typings/dev → dev}/index.d.ts +1 -1
  13. package/dist/{typings/dev → dev}/locale.d.ts +3 -3
  14. package/dist/{typings/file → file}/attachment.d.ts +18 -2
  15. package/dist/{typings/file → file}/index.d.ts +9 -4
  16. package/dist/{typings/file → file}/upload.d.ts +6 -2
  17. package/dist/index.cjs +731 -0
  18. package/dist/{typings/index.d.ts → index.d.ts} +3 -3
  19. package/dist/index.mjs +644 -0
  20. package/dist/{typings/interceptors.d.ts → interceptors.d.ts} +2 -2
  21. package/dist/{typings/metadata → metadata}/index.d.ts +1 -1
  22. package/dist/{typings/open → open}/index.d.ts +1 -1
  23. package/dist/{typings/open → open}/openapi.d.ts +1 -1
  24. package/dist/{typings/open → open}/subscription.d.ts +13 -7
  25. package/dist/{typings/open → open}/third_party_app.d.ts +13 -1
  26. package/dist/{typings/types.d.ts → types.d.ts} +1 -1
  27. package/package.json +20 -21
  28. package/dist/cjs/admin/app.js +0 -26
  29. package/dist/cjs/admin/authn.js +0 -25
  30. package/dist/cjs/admin/authz.js +0 -41
  31. package/dist/cjs/admin/crypto.js +0 -9
  32. package/dist/cjs/admin/dict.js +0 -36
  33. package/dist/cjs/admin/index.js +0 -58
  34. package/dist/cjs/admin/role.js +0 -21
  35. package/dist/cjs/admin/setting.js +0 -31
  36. package/dist/cjs/admin/user.js +0 -14
  37. package/dist/cjs/dev/index.js +0 -23
  38. package/dist/cjs/dev/locale.js +0 -58
  39. package/dist/cjs/file/attachment.js +0 -69
  40. package/dist/cjs/file/index.js +0 -40
  41. package/dist/cjs/file/upload.js +0 -111
  42. package/dist/cjs/index.js +0 -27
  43. package/dist/cjs/interceptors.js +0 -44
  44. package/dist/cjs/metadata/index.js +0 -83
  45. package/dist/cjs/open/index.js +0 -38
  46. package/dist/cjs/open/openapi.js +0 -42
  47. package/dist/cjs/open/subscription.js +0 -39
  48. package/dist/cjs/open/third_party_app.js +0 -49
  49. package/dist/cjs/types.js +0 -10
  50. package/dist/esm/admin/app.js +0 -24
  51. package/dist/esm/admin/authn.js +0 -23
  52. package/dist/esm/admin/authz.js +0 -39
  53. package/dist/esm/admin/crypto.js +0 -7
  54. package/dist/esm/admin/dict.js +0 -34
  55. package/dist/esm/admin/index.js +0 -53
  56. package/dist/esm/admin/role.js +0 -19
  57. package/dist/esm/admin/setting.js +0 -29
  58. package/dist/esm/admin/user.js +0 -12
  59. package/dist/esm/dev/index.js +0 -18
  60. package/dist/esm/dev/locale.js +0 -56
  61. package/dist/esm/file/attachment.js +0 -66
  62. package/dist/esm/file/index.js +0 -33
  63. package/dist/esm/file/upload.js +0 -104
  64. package/dist/esm/index.js +0 -7
  65. package/dist/esm/interceptors.js +0 -40
  66. package/dist/esm/metadata/index.js +0 -77
  67. package/dist/esm/open/index.js +0 -30
  68. package/dist/esm/open/openapi.js +0 -39
  69. package/dist/esm/open/subscription.js +0 -36
  70. package/dist/esm/open/third_party_app.js +0 -46
  71. package/dist/esm/types.js +0 -7
@@ -1,10 +1,10 @@
1
- export { default as ZerowebMetadataClient, MenuType, ServiceType, } from './metadata';
1
+ export { default as ZerowebMetadataClient, MenuType, ServiceType } from './metadata';
2
2
  export type * from './metadata';
3
3
  export { default as ZerowebAdminClient } from './admin';
4
4
  export type * from './admin';
5
- export { default as ZerowebOpenClient, OpenapiStatus, SubscriptionStatus, } from './open';
5
+ export { default as ZerowebOpenClient, OpenapiStatus, SubscriptionStatus } from './open';
6
6
  export type * from './open';
7
- export { default as ZerowebFileClient, FileProvider, AttachmentStatus, } from './file';
7
+ export { default as ZerowebFileClient, checksum, FileProvider, AttachmentStatus } from './file';
8
8
  export type * from './file';
9
9
  export { default as ZerowebDevClient } from './dev';
10
10
  export type * from './dev';
package/dist/index.mjs ADDED
@@ -0,0 +1,644 @@
1
+ import axios from "axios";
2
+ import crypto_js from "crypto-js";
3
+ import { crc32 } from "js-crc";
4
+ var types_ErrorSource = /*#__PURE__*/ function(ErrorSource) {
5
+ ErrorSource[ErrorSource["NETWORK"] = 1] = "NETWORK";
6
+ ErrorSource[ErrorSource["INFRA"] = 2] = "INFRA";
7
+ ErrorSource[ErrorSource["INTERNAL"] = 3] = "INTERNAL";
8
+ ErrorSource[ErrorSource["BAD_REQUEST"] = 4] = "BAD_REQUEST";
9
+ return ErrorSource;
10
+ }({});
11
+ const ERROR_CODE_HEADER = 'x-error-code';
12
+ const ErrorCodeEnum = {
13
+ ARGUMENT_INVALID: 'C0005'
14
+ };
15
+ function zerowebErrorHandler(error) {
16
+ const response = error.response;
17
+ if (!response) {
18
+ error.source = types_ErrorSource.NETWORK;
19
+ return Promise.reject(error);
20
+ }
21
+ const errorCode = response.headers[ERROR_CODE_HEADER];
22
+ if (!errorCode) {
23
+ error.source = types_ErrorSource.INFRA;
24
+ return Promise.reject(error);
25
+ }
26
+ error.errorCode = errorCode;
27
+ const responseBody = response.data;
28
+ if (response.status >= 500) {
29
+ error.source = types_ErrorSource.INTERNAL;
30
+ error.message = responseBody.message;
31
+ return Promise.reject(error);
32
+ }
33
+ error.source = types_ErrorSource.BAD_REQUEST;
34
+ if (errorCode !== ErrorCodeEnum.ARGUMENT_INVALID) error.notification = responseBody.message;
35
+ error.parameters = responseBody.parameters;
36
+ error.details = responseBody.details;
37
+ return Promise.reject(error);
38
+ }
39
+ var metadata_ServiceType = /*#__PURE__*/ function(ServiceType) {
40
+ ServiceType["CLIENT"] = "CLIENT";
41
+ ServiceType["SERVER"] = "SERVER";
42
+ return ServiceType;
43
+ }({});
44
+ var metadata_MenuType = /*#__PURE__*/ function(MenuType) {
45
+ MenuType["ROUTE"] = "ROUTE";
46
+ MenuType["EXTERNAL_LINK"] = "EXTERNAL_LINK";
47
+ MenuType["EMBEDDED"] = "EMBEDDED";
48
+ MenuType["PERMISSION"] = "PERMISSION";
49
+ MenuType["GROUP_PERMISSION"] = "GROUP_PERMISSION";
50
+ return MenuType;
51
+ }({});
52
+ const metadata = (config)=>{
53
+ const instance = axios.create(config);
54
+ const interceptors = instance.interceptors;
55
+ interceptors.response.use(null, zerowebErrorHandler);
56
+ return {
57
+ interceptors,
58
+ loadServiceInfo () {
59
+ return instance.request({
60
+ url: '/metadata/info.json',
61
+ method: 'GET'
62
+ });
63
+ },
64
+ loadResourceInfo () {
65
+ return instance.request({
66
+ url: '/metadata/menu.json',
67
+ method: 'GET'
68
+ });
69
+ }
70
+ };
71
+ };
72
+ const admin_app = (client)=>({
73
+ addApp: (app)=>client.request({
74
+ url: '/app',
75
+ method: 'POST',
76
+ data: app
77
+ }),
78
+ listApp: ()=>client.request({
79
+ url: '/app',
80
+ method: 'GET'
81
+ }),
82
+ queryAppById: (id)=>client.request({
83
+ url: `/app/${id}`,
84
+ method: 'GET'
85
+ }),
86
+ updateApp: (app)=>client.request({
87
+ url: '/app',
88
+ method: 'PUT',
89
+ data: app
90
+ }),
91
+ deleteApp: (id)=>client.request({
92
+ url: `/app/${id}`,
93
+ method: 'DELETE'
94
+ })
95
+ });
96
+ const authn = (client)=>({
97
+ basicLogin: (user)=>client.request({
98
+ url: '/auth/login/basic',
99
+ method: 'POST',
100
+ auth: {
101
+ username: user.username,
102
+ password: user.password
103
+ },
104
+ data: user
105
+ }),
106
+ self: ()=>client.request({
107
+ url: '/auth/self',
108
+ method: 'GET'
109
+ }),
110
+ token: ()=>client.request({
111
+ url: '/auth/token',
112
+ method: 'GET'
113
+ }),
114
+ logout: ()=>client.request({
115
+ url: '/auth/logout',
116
+ method: 'PUT'
117
+ })
118
+ });
119
+ const authz = (client)=>({
120
+ queryUserByRole: (roleId)=>client.request({
121
+ url: `/auth/role/${roleId}/user`,
122
+ method: 'GET'
123
+ }),
124
+ bindUserToRole: (roleUsers)=>client.request({
125
+ url: '/auth/role/-/user',
126
+ method: 'PUT',
127
+ data: roleUsers
128
+ }),
129
+ releaseRoleUser: (roleUsers)=>client.request({
130
+ url: '/auth/role/-/user',
131
+ method: 'DELETE',
132
+ data: roleUsers
133
+ }),
134
+ queryPermissionByRole: (roleId)=>client.request({
135
+ url: `/auth/role/${roleId}/permission`,
136
+ method: 'GET'
137
+ }),
138
+ bindPermissionToRole: (rolePermissions)=>client.request({
139
+ url: '/auth/role/-/permission',
140
+ method: 'PUT',
141
+ data: rolePermissions
142
+ }),
143
+ releaseRolePermission: (rolePermissions)=>client.request({
144
+ url: '/auth/role/-/permission',
145
+ method: 'DELETE',
146
+ data: rolePermissions
147
+ }),
148
+ queryRoleByUser: (userId)=>client.request({
149
+ url: `/auth/user/${userId}/role`,
150
+ method: 'GET'
151
+ }),
152
+ queryRoleByPermission: (permission)=>client.request({
153
+ url: '/auth/permission/-/role',
154
+ method: 'GET',
155
+ params: {
156
+ permission
157
+ }
158
+ })
159
+ });
160
+ const admin_crypto = ({ request })=>({
161
+ passwordStrength: (password, { username })=>request({
162
+ url: '/password-strength',
163
+ method: 'GET',
164
+ params: {
165
+ password,
166
+ username
167
+ }
168
+ })
169
+ });
170
+ const admin_dict = (client)=>({
171
+ addDict: (dict)=>client.request({
172
+ url: '/dict',
173
+ method: 'POST',
174
+ data: dict
175
+ }),
176
+ getDictTagList: (odata)=>client.request({
177
+ url: '/dict',
178
+ method: 'GET',
179
+ params: odata
180
+ }),
181
+ getDictTreeByTag: (tag)=>client.request({
182
+ url: `/dict/tag/${tag}`,
183
+ method: 'GET'
184
+ }),
185
+ modifyDict: (dict)=>client.request({
186
+ url: '/dict',
187
+ method: 'PUT',
188
+ data: dict
189
+ }),
190
+ updateDictStatus: (ids, enabled)=>client.request({
191
+ url: '/dict/update-status',
192
+ method: 'PUT',
193
+ params: {
194
+ enabled
195
+ },
196
+ data: ids
197
+ }),
198
+ removeDict: (ids)=>client.request({
199
+ url: '/dict',
200
+ method: 'DELETE',
201
+ data: ids
202
+ })
203
+ });
204
+ const admin_role = (client)=>({
205
+ addRole: (role)=>client.request({
206
+ url: '/role',
207
+ method: 'POST',
208
+ data: role
209
+ }),
210
+ listAllRole: ()=>client.request({
211
+ url: '/role',
212
+ method: 'GET'
213
+ }),
214
+ deleteRole: (id)=>client.request({
215
+ url: `/role/${id}`,
216
+ method: 'DELETE'
217
+ }),
218
+ listMyRole: ()=>client.request({
219
+ url: '/role/mine',
220
+ method: 'GET'
221
+ })
222
+ });
223
+ const admin_setting = (client)=>({
224
+ addSetting: (setting)=>client.request({
225
+ url: '/setting',
226
+ method: 'POST',
227
+ data: setting
228
+ }),
229
+ listSetting: ()=>client.request({
230
+ url: '/setting',
231
+ method: 'GET'
232
+ }),
233
+ querySettingByCode: (code)=>client.request({
234
+ url: `/setting/${code}`,
235
+ method: 'GET'
236
+ }),
237
+ updateSchema: (setting)=>client.request({
238
+ url: '/setting/schema',
239
+ method: 'PUT',
240
+ data: setting
241
+ }),
242
+ updateValue: (setting)=>client.request({
243
+ url: '/setting/value',
244
+ method: 'PUT',
245
+ data: setting
246
+ }),
247
+ deleteSetting: (id)=>client.request({
248
+ url: `/setting/${id}`,
249
+ method: 'DELETE'
250
+ })
251
+ });
252
+ const admin_user = ({ request })=>({
253
+ register: (user)=>request({
254
+ url: '/user/register',
255
+ method: 'POST',
256
+ data: user
257
+ }),
258
+ getMyInfo: ()=>request({
259
+ url: '/user/me',
260
+ method: 'GET'
261
+ }),
262
+ queryUserList: (odata)=>request({
263
+ url: '/user',
264
+ method: 'GET',
265
+ params: odata
266
+ }),
267
+ queryUserById: (id)=>request({
268
+ url: `/user/${id}`,
269
+ method: 'GET'
270
+ })
271
+ });
272
+ const admin = (config)=>{
273
+ const instance = axios.create(config);
274
+ const interceptors = instance.interceptors;
275
+ interceptors.response.use(null, zerowebErrorHandler);
276
+ return {
277
+ interceptors,
278
+ app: admin_app(instance),
279
+ authn: authn(instance),
280
+ authz: authz(instance),
281
+ crypto: admin_crypto(instance),
282
+ dict: admin_dict(instance),
283
+ role: admin_role(instance),
284
+ setting: admin_setting(instance),
285
+ user: admin_user(instance)
286
+ };
287
+ };
288
+ var openapi_OpenapiStatus = /*#__PURE__*/ function(OpenapiStatus) {
289
+ OpenapiStatus["DRAFT"] = "DRAFT";
290
+ OpenapiStatus["PUBLISHED"] = "PUBLISHED";
291
+ return OpenapiStatus;
292
+ }({});
293
+ const open_openapi = (client)=>({
294
+ addOpenapi: (openapi)=>client.request({
295
+ url: '/openapi',
296
+ method: 'POST',
297
+ data: openapi
298
+ }),
299
+ getOpenapiList: (odata)=>client.request({
300
+ url: '/openapi',
301
+ method: 'GET',
302
+ params: odata
303
+ }),
304
+ modifyOpenapi: (openapi)=>client.request({
305
+ url: '/openapi',
306
+ method: 'PUT',
307
+ data: openapi
308
+ }),
309
+ publishOpenapi: (id)=>client.request({
310
+ url: `/openapi/${id}/publish`,
311
+ method: 'PUT'
312
+ }),
313
+ deleteOpenapi: (id)=>client.request({
314
+ url: `/openapi/${id}`,
315
+ method: 'DELETE'
316
+ })
317
+ });
318
+ const BASE_URL = '/third-party-app';
319
+ const third_party_app = (client)=>({
320
+ addThirdPartyApp: (thirdPartyApp)=>client.request({
321
+ url: `${BASE_URL}`,
322
+ method: 'POST',
323
+ data: thirdPartyApp
324
+ }),
325
+ listMyThirdPartyApp: (odata)=>client.request({
326
+ url: `${BASE_URL}/mine`,
327
+ method: 'GET',
328
+ params: odata
329
+ }),
330
+ queryThirdPartyAppById: (id)=>client.request({
331
+ url: `${BASE_URL}/${id}`,
332
+ method: 'GET'
333
+ }),
334
+ listThirdPartyApp: (odata)=>client.request({
335
+ url: `${BASE_URL}`,
336
+ method: 'GET',
337
+ params: odata
338
+ }),
339
+ rollAccessSecret: (id)=>client.request({
340
+ url: `${BASE_URL}/${id}/roll`,
341
+ method: 'PATCH'
342
+ }),
343
+ inviteMember: (appId, timeout)=>client.request({
344
+ url: `/third-party-app/${appId}/member`,
345
+ method: 'POST',
346
+ params: {
347
+ timeout
348
+ }
349
+ }),
350
+ inviteParticularMember: (appId, userId, timeout)=>client.request({
351
+ url: `/third-party-app/${appId}/member`,
352
+ method: 'POST',
353
+ params: {
354
+ userId,
355
+ timeout
356
+ }
357
+ }),
358
+ addThirdPartyAppMember: (token)=>client.request({
359
+ url: "/third-party-app/-/member",
360
+ method: 'PUT',
361
+ params: {
362
+ token
363
+ }
364
+ }),
365
+ listThirdPartyAppMember: (appId)=>client.request({
366
+ url: `/third-party-app/${appId}/member`,
367
+ method: 'GET'
368
+ }),
369
+ moveOwnerShip: (appId, userId)=>client.request({
370
+ url: `/third-party-app/${appId}/owner`,
371
+ method: 'PATCH',
372
+ params: {
373
+ userId
374
+ }
375
+ }),
376
+ deleteMember: (appId, memberId)=>client.request({
377
+ url: `/third-party-app/${appId}/member/${memberId}`,
378
+ method: 'DELETE'
379
+ })
380
+ });
381
+ const subscription_BASE_URL = "/subscription";
382
+ var subscription_SubscriptionStatus = /*#__PURE__*/ function(SubscriptionStatus) {
383
+ SubscriptionStatus["NONE"] = "NONE";
384
+ SubscriptionStatus["AUDITING"] = "AUDITING";
385
+ SubscriptionStatus["SUBSCRIBED"] = "SUBSCRIBED";
386
+ return SubscriptionStatus;
387
+ }({});
388
+ const open_subscription = (client)=>({
389
+ subscribe: (subscription)=>client.request({
390
+ url: `${subscription_BASE_URL}`,
391
+ method: 'POST',
392
+ data: subscription
393
+ }),
394
+ listSubscription: (appId)=>client.request({
395
+ url: `${subscription_BASE_URL}`,
396
+ method: 'GET',
397
+ params: {
398
+ appId
399
+ }
400
+ }),
401
+ listSubscriptionWithOpenapi: (appId, odata)=>client.request({
402
+ url: `${BASE_URL}/${appId}/subscription`,
403
+ method: 'GET',
404
+ params: odata
405
+ }),
406
+ auditSubscription: (id)=>client.request({
407
+ url: `${subscription_BASE_URL}/${id}/audit`,
408
+ method: 'PUT'
409
+ })
410
+ });
411
+ const src_open = (config)=>{
412
+ const instance = axios.create(config);
413
+ const interceptors = instance.interceptors;
414
+ interceptors.response.use(null, zerowebErrorHandler);
415
+ return {
416
+ interceptors: instance.interceptors,
417
+ openapi: open_openapi(instance),
418
+ subscription: open_subscription(instance),
419
+ thirdPartyApp: third_party_app(instance)
420
+ };
421
+ };
422
+ async function upload_checksum(file) {
423
+ if (file.checksum && file.crc) return file;
424
+ return file.arrayBuffer().then((arrayBuffer)=>Promise.all([
425
+ Promise.resolve().then(()=>crypto_js.SHA256(crypto_js.lib.WordArray.create(arrayBuffer)).toString(crypto_js.enc.Base64)).then((checksum)=>{
426
+ file.checksum = checksum;
427
+ }),
428
+ Promise.resolve().then(()=>crypto_js.enc.Base64.stringify(crypto_js.enc.Hex.parse(crc32.hex(arrayBuffer)))).then((crc)=>{
429
+ file.crc = crc;
430
+ })
431
+ ])).then(()=>file);
432
+ }
433
+ function upload(client, attachmentApi) {
434
+ return async (file, uploadInfo)=>file.arrayBuffer().then((arrayBuffer)=>{
435
+ const partCount = uploadInfo.partCount;
436
+ const partSize = uploadInfo.partSize;
437
+ const parts = [];
438
+ for(let index = 0; index < partCount - 1; index++){
439
+ const content = arrayBuffer.slice(index * partSize, (index + 1) * partSize);
440
+ const crc = crypto_js.enc.Base64.stringify(crypto_js.enc.Hex.parse(crc32.hex(content)));
441
+ parts.push({
442
+ content,
443
+ crc
444
+ });
445
+ }
446
+ const content = arrayBuffer.slice((partCount - 1) * partSize, file.size);
447
+ const crc = crypto_js.enc.Base64.stringify(crypto_js.enc.Hex.parse(crc32.hex(content)));
448
+ parts.push({
449
+ content,
450
+ crc
451
+ });
452
+ return parts;
453
+ }).then((parts)=>Promise.all(parts.map(async (part, index)=>Promise.resolve().then(()=>{
454
+ if (uploadInfo.partCount > 1) return attachmentApi.getMultipartUploadEndpoint(uploadInfo.id, index + 1, part.crc);
455
+ return attachmentApi.getUploadEndpoint(uploadInfo.id);
456
+ }).then((response)=>response.data).then(async ({ endpoint })=>{
457
+ if (!endpoint) return;
458
+ const partChecksum = crypto_js.SHA256(crypto_js.lib.WordArray.create(part.content)).toString(crypto_js.enc.Base64);
459
+ let headers;
460
+ headers = uploadInfo.partCount > 1 ? {
461
+ 'x-amz-sdk-checksum-algorithm': 'CRC32',
462
+ 'x-amz-checksum-crc32': part.crc
463
+ } : {
464
+ 'x-amz-sdk-checksum-algorithm': 'SHA256',
465
+ 'x-amz-checksum-sha256': partChecksum,
466
+ 'x-amz-meta-id': uploadInfo.id,
467
+ 'x-amz-meta-filename': file.name,
468
+ 'Content-Type': file.type
469
+ };
470
+ return client.request({
471
+ url: endpoint,
472
+ method: 'PUT',
473
+ data: part.content,
474
+ headers: headers
475
+ });
476
+ })))).then(()=>attachmentApi.finishUpload(uploadInfo.id));
477
+ }
478
+ function resolveDownloadUrl(attachmentApi, baseURL = '') {
479
+ return async (attachment)=>attachmentApi.getDownloadEndpoint(attachment.id).then((response)=>response.data).then(({ endpoint, filename })=>({
480
+ endpoint: attachment.provider === file_FileProvider.FS ? `${baseURL}${endpoint}` : endpoint,
481
+ filename
482
+ }));
483
+ }
484
+ var attachment_AttachmentStatus = /*#__PURE__*/ function(AttachmentStatus) {
485
+ AttachmentStatus["UPLOADING"] = "UPLOADING";
486
+ AttachmentStatus["DONE"] = "DONE";
487
+ return AttachmentStatus;
488
+ }({});
489
+ const file_attachment = (client)=>({
490
+ addAttachment: async (file, bizType, bizId)=>{
491
+ await upload_checksum(file);
492
+ const req = {
493
+ name: file.name,
494
+ checksum: file.checksum,
495
+ size: file.size,
496
+ type: file.type,
497
+ bizType,
498
+ bizId
499
+ };
500
+ return client.request({
501
+ url: '/attachment',
502
+ method: 'POST',
503
+ data: req,
504
+ params: {
505
+ crc: file.crc
506
+ }
507
+ });
508
+ },
509
+ getUploadInfo: (id, checksum, fileSize)=>client.request({
510
+ url: `/attachment/${id}/resume`,
511
+ method: 'GET',
512
+ params: {
513
+ checksum,
514
+ fileSize
515
+ }
516
+ }),
517
+ getUploadEndpoint: (id)=>client.request({
518
+ url: `/attachment/${id}/endpoint/upload`,
519
+ method: 'GET',
520
+ params: {
521
+ partNumber: 0
522
+ }
523
+ }),
524
+ getMultipartUploadEndpoint: (id, partNumber, crc)=>client.request({
525
+ url: `/attachment/${id}/endpoint/upload`,
526
+ method: 'GET',
527
+ params: {
528
+ partNumber,
529
+ crc
530
+ }
531
+ }),
532
+ finishUpload: (id)=>client.request({
533
+ url: `/attachment/${id}/status/done`,
534
+ method: 'PUT'
535
+ }),
536
+ queryAttachmentByBiz: (bizType, bizId)=>client.request({
537
+ url: "/attachment/list",
538
+ method: 'GET',
539
+ params: {
540
+ bizType,
541
+ bizId
542
+ }
543
+ }),
544
+ queryById: (id)=>client.request({
545
+ url: `/attachment/${id}`,
546
+ method: 'GET'
547
+ }),
548
+ getDownloadEndpoint: (id)=>client.request({
549
+ url: `/attachment/${id}/endpoint/download`,
550
+ method: 'GET'
551
+ }),
552
+ deleteAttachment: (id)=>client.request({
553
+ url: `/attachment/${id}`,
554
+ method: 'DELETE'
555
+ }),
556
+ queryPage: (odata)=>client.request({
557
+ url: '/attachment/page',
558
+ method: 'GET',
559
+ params: odata
560
+ })
561
+ });
562
+ const src_file = (config)=>{
563
+ const instance = axios.create(config);
564
+ const interceptors = instance.interceptors;
565
+ interceptors.response.use(null, zerowebErrorHandler);
566
+ const attachmentApi = file_attachment(instance);
567
+ return {
568
+ interceptors,
569
+ attachment: attachmentApi,
570
+ upload: upload(instance, attachmentApi),
571
+ resolveDownloadUrl: resolveDownloadUrl(attachmentApi, config.baseURL)
572
+ };
573
+ };
574
+ var file_FileProvider = /*#__PURE__*/ function(FileProvider) {
575
+ FileProvider["FS"] = "FS";
576
+ FileProvider["S3"] = "S3";
577
+ return FileProvider;
578
+ }({});
579
+ const locale = (client)=>({
580
+ addLanguage: (language)=>client.request({
581
+ url: '/language',
582
+ method: 'POST',
583
+ data: language
584
+ }),
585
+ queryLanguageList: ()=>client.request({
586
+ url: '/language',
587
+ method: 'GET'
588
+ }),
589
+ updateLanguage: (language)=>client.request({
590
+ url: '/language',
591
+ method: 'PUT',
592
+ data: language
593
+ }),
594
+ deleteLanguage: (id)=>client.request({
595
+ url: `/language/${id}`,
596
+ method: 'DELETE'
597
+ }),
598
+ addI18nMessage: (i18nMessage)=>client.request({
599
+ url: '/i18n',
600
+ method: 'POST',
601
+ data: i18nMessage
602
+ }),
603
+ listI18nNamespace: ()=>client.request({
604
+ url: '/i18n',
605
+ method: 'GET'
606
+ }),
607
+ queryI18nMessageList: (namespace, odata)=>client.request({
608
+ url: `/i18n/${namespace}`,
609
+ method: 'GET',
610
+ params: odata
611
+ }),
612
+ updateI18nMessage: (i18nMessage)=>client.request({
613
+ url: '/i18n',
614
+ method: 'PUT',
615
+ data: i18nMessage
616
+ }),
617
+ deleteI18nMessage: (id)=>client.request({
618
+ url: `/i18n/${id}`,
619
+ method: 'DELETE'
620
+ }),
621
+ queryTranslation: (namespace, messageKey)=>client.request({
622
+ url: `/i18n/${namespace}/${messageKey}`,
623
+ method: 'GET'
624
+ }),
625
+ upsertTranslation: (translation)=>client.request({
626
+ url: '/locale',
627
+ method: 'PUT',
628
+ data: translation
629
+ }),
630
+ loadTranslation: (language, namespace)=>client.request({
631
+ url: `/locale/${language}/${namespace}`,
632
+ method: 'GET'
633
+ })
634
+ });
635
+ const dev = (config)=>{
636
+ const instance = axios.create(config);
637
+ const interceptors = instance.interceptors;
638
+ interceptors.response.use(null, zerowebErrorHandler);
639
+ return {
640
+ interceptors,
641
+ locale: locale(instance)
642
+ };
643
+ };
644
+ export { ErrorCodeEnum, admin as ZerowebAdminClient, attachment_AttachmentStatus as AttachmentStatus, dev as ZerowebDevClient, file_FileProvider as FileProvider, metadata as ZerowebMetadataClient, metadata_MenuType as MenuType, metadata_ServiceType as ServiceType, openapi_OpenapiStatus as OpenapiStatus, src_file as ZerowebFileClient, src_open as ZerowebOpenClient, subscription_SubscriptionStatus as SubscriptionStatus, types_ErrorSource as ErrorSource, upload_checksum as checksum, zerowebErrorHandler };
@@ -1,5 +1,5 @@
1
- import type { AxiosError } from "axios";
2
- import type { ErrorResult, StructuredError } from "./types";
1
+ import type { AxiosError } from 'axios';
2
+ import type { ErrorResult, StructuredError } from './types';
3
3
  export declare const ErrorCodeEnum: {
4
4
  ARGUMENT_INVALID: string;
5
5
  };
@@ -1,4 +1,4 @@
1
- import type { InstanceConfig } from "../types";
1
+ import type { InstanceConfig } from '../types';
2
2
  /**
3
3
  * 服务类型
4
4
  */
@@ -1,4 +1,4 @@
1
- import type { InstanceConfig } from "../types";
1
+ import type { InstanceConfig } from '../types';
2
2
  declare const _default: (config: InstanceConfig) => {
3
3
  /**
4
4
  * 拦截器方法
@@ -1,4 +1,4 @@
1
- import type { HttpClient, Id, OData, Page, PResponse } from "../types";
1
+ import type { HttpClient, Id, OData, Page, PResponse } from '../types';
2
2
  /**
3
3
  * 对外接口状态
4
4
  */