@longvansoftware/service-js-client 1.19.5 → 1.19.6
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/dist/src/graphql/storage_s3/mutations.d.ts +6 -0
- package/dist/src/graphql/storage_s3/mutations.js +161 -9
- package/dist/src/graphql/storage_s3/queries.d.ts +3 -0
- package/dist/src/graphql/storage_s3/queries.js +37 -1
- package/dist/src/lib/storage_s3/index.d.ts +10 -1
- package/dist/src/lib/storage_s3/index.js +181 -8
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DocumentNode } from 'graphql';
|
|
2
2
|
export declare const CREATE_BUCKET: (fields?: string[]) => DocumentNode;
|
|
3
|
+
export declare const RENAME_BUCKET: (fields?: string[]) => DocumentNode;
|
|
3
4
|
export declare const DELETE_BUCKET: (fields?: string[]) => DocumentNode;
|
|
4
5
|
export declare const CREATE_FOLDER: (fields?: string[]) => DocumentNode;
|
|
5
6
|
export declare const REMOVE_FOLDER: (fields?: string[]) => DocumentNode;
|
|
@@ -14,3 +15,8 @@ export declare const REMOVE_FILE: (fields?: string[]) => DocumentNode;
|
|
|
14
15
|
export declare const UPDATE_ACL_PERMISSION_BUCKET: (fields?: string[]) => DocumentNode;
|
|
15
16
|
export declare const UPDATE_BUCKET_VERSIONING: (fields?: string[]) => DocumentNode;
|
|
16
17
|
export declare const RESTORE_FILE_TRASH: (fields?: string[]) => DocumentNode;
|
|
18
|
+
export declare const ADD_S3_DOMAIN: (fields?: string[]) => DocumentNode;
|
|
19
|
+
export declare const REMOVE_S3_DOMAIN: (fields?: string[]) => DocumentNode;
|
|
20
|
+
export declare const ADD_CORS_BUCKET: (fields?: string[]) => DocumentNode;
|
|
21
|
+
export declare const UPDATE_CORS_BUCKET: (fields?: string[]) => DocumentNode;
|
|
22
|
+
export declare const REMOVE_CORS_BUCKET: (fields?: string[]) => DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RESTORE_FILE_TRASH = exports.UPDATE_BUCKET_VERSIONING = exports.UPDATE_ACL_PERMISSION_BUCKET = exports.REMOVE_FILE = exports.MOVE_FILE = exports.COPY_FILE = exports.SHARE_LINK_FILE_BY_TIME = exports.SHARE_LINK_FILE_BY_TIME_DYNAMIC = exports.RENAME_FILE = exports.UPDATE_ACL_PERMISSION_FILE = exports.UPLOAD_FOLDER = exports.REMOVE_FOLDER = exports.CREATE_FOLDER = exports.DELETE_BUCKET = exports.CREATE_BUCKET = void 0;
|
|
3
|
+
exports.REMOVE_CORS_BUCKET = exports.UPDATE_CORS_BUCKET = exports.ADD_CORS_BUCKET = exports.REMOVE_S3_DOMAIN = exports.ADD_S3_DOMAIN = exports.RESTORE_FILE_TRASH = exports.UPDATE_BUCKET_VERSIONING = exports.UPDATE_ACL_PERMISSION_BUCKET = exports.REMOVE_FILE = exports.MOVE_FILE = exports.COPY_FILE = exports.SHARE_LINK_FILE_BY_TIME = exports.SHARE_LINK_FILE_BY_TIME_DYNAMIC = exports.RENAME_FILE = exports.UPDATE_ACL_PERMISSION_FILE = exports.UPLOAD_FOLDER = exports.REMOVE_FOLDER = exports.CREATE_FOLDER = exports.DELETE_BUCKET = exports.RENAME_BUCKET = exports.CREATE_BUCKET = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
const CREATE_BUCKET = (fields = []) => {
|
|
6
6
|
const fieldStr = fields.join('\n ');
|
|
@@ -9,14 +9,20 @@ const CREATE_BUCKET = (fields = []) => {
|
|
|
9
9
|
mutation CreateBucket(
|
|
10
10
|
$s3UserId: String!,
|
|
11
11
|
$bucketName: String!,
|
|
12
|
+
$internalId: String,
|
|
13
|
+
$randomInternalId: Boolean!,
|
|
12
14
|
$enableObjectLock: Boolean!,
|
|
13
|
-
$enableBucketVersioning: Boolean
|
|
15
|
+
$enableBucketVersioning: Boolean!,
|
|
16
|
+
$byUser: String!
|
|
14
17
|
) {
|
|
15
18
|
createBucket(
|
|
16
19
|
s3UserId: $s3UserId,
|
|
17
20
|
bucketName: $bucketName,
|
|
21
|
+
internalId: $internalId,
|
|
22
|
+
randomInternalId: $randomInternalId,
|
|
18
23
|
enableObjectLock: $enableObjectLock,
|
|
19
|
-
enableBucketVersioning: $enableBucketVersioning
|
|
24
|
+
enableBucketVersioning: $enableBucketVersioning,
|
|
25
|
+
byUser: $byUser
|
|
20
26
|
) {
|
|
21
27
|
${hasFields ? `${fieldStr}` : ''}
|
|
22
28
|
}
|
|
@@ -24,6 +30,26 @@ const CREATE_BUCKET = (fields = []) => {
|
|
|
24
30
|
`;
|
|
25
31
|
};
|
|
26
32
|
exports.CREATE_BUCKET = CREATE_BUCKET;
|
|
33
|
+
const RENAME_BUCKET = (fields = []) => {
|
|
34
|
+
const fieldStr = fields.join('\n ');
|
|
35
|
+
const hasFields = fields.length > 0;
|
|
36
|
+
return (0, graphql_tag_1.gql) `
|
|
37
|
+
mutation RenameBucket(
|
|
38
|
+
$bucketId: String!,
|
|
39
|
+
$bucketName: String!,
|
|
40
|
+
$updateBy: String!
|
|
41
|
+
) {
|
|
42
|
+
renameBucket(
|
|
43
|
+
bucketId: $bucketId,
|
|
44
|
+
bucketName: $bucketName,
|
|
45
|
+
updateBy: $updateBy
|
|
46
|
+
) {
|
|
47
|
+
${hasFields ? `${fieldStr}` : ''}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
};
|
|
52
|
+
exports.RENAME_BUCKET = RENAME_BUCKET;
|
|
27
53
|
const DELETE_BUCKET = (fields = []) => {
|
|
28
54
|
const fieldStr = fields.join('\n ');
|
|
29
55
|
const hasFields = fields.length > 0;
|
|
@@ -49,12 +75,14 @@ const CREATE_FOLDER = (fields = []) => {
|
|
|
49
75
|
mutation CreateFolder(
|
|
50
76
|
$s3UserId: String!,
|
|
51
77
|
$bucketId: String!,
|
|
52
|
-
$folderName: String
|
|
78
|
+
$folderName: String!,
|
|
79
|
+
$key: String
|
|
53
80
|
) {
|
|
54
81
|
createFolder(
|
|
55
82
|
s3UserId: $s3UserId,
|
|
56
83
|
bucketId: $bucketId,
|
|
57
|
-
folderName: $folderName
|
|
84
|
+
folderName: $folderName,
|
|
85
|
+
key: $key
|
|
58
86
|
) {
|
|
59
87
|
${hasFields ? `${fieldStr}` : ''}
|
|
60
88
|
}
|
|
@@ -290,14 +318,14 @@ const RESTORE_FILE_TRASH = (fields = []) => {
|
|
|
290
318
|
mutation RestoreFileTrash(
|
|
291
319
|
$s3UserId: String!,
|
|
292
320
|
$bucketId: String!,
|
|
293
|
-
$key: String
|
|
294
|
-
$versionId: String
|
|
321
|
+
$key: String!,
|
|
322
|
+
$versionId: String!
|
|
295
323
|
) {
|
|
296
324
|
restoreFileTrash(
|
|
297
325
|
s3UserId: $s3UserId,
|
|
298
326
|
bucketId: $bucketId,
|
|
299
|
-
key: $key
|
|
300
|
-
versionId: $versionId
|
|
327
|
+
key: $key,
|
|
328
|
+
versionId: $versionId
|
|
301
329
|
) {
|
|
302
330
|
${hasFields ? `${fieldStr}` : ''}
|
|
303
331
|
}
|
|
@@ -305,3 +333,127 @@ const RESTORE_FILE_TRASH = (fields = []) => {
|
|
|
305
333
|
`;
|
|
306
334
|
};
|
|
307
335
|
exports.RESTORE_FILE_TRASH = RESTORE_FILE_TRASH;
|
|
336
|
+
const ADD_S3_DOMAIN = (fields = []) => {
|
|
337
|
+
const fieldStr = fields.join('\n ');
|
|
338
|
+
const hasFields = fields.length > 0;
|
|
339
|
+
return (0, graphql_tag_1.gql) `
|
|
340
|
+
mutation AddS3Domain(
|
|
341
|
+
$s3UserId: String!,
|
|
342
|
+
$domain: String!,
|
|
343
|
+
$byUser: String!
|
|
344
|
+
) {
|
|
345
|
+
addS3Domain(
|
|
346
|
+
s3UserId: $s3UserId,
|
|
347
|
+
domain: $domain,
|
|
348
|
+
byUser: $byUser
|
|
349
|
+
) {
|
|
350
|
+
${hasFields ? `${fieldStr}` : ''}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
`;
|
|
354
|
+
};
|
|
355
|
+
exports.ADD_S3_DOMAIN = ADD_S3_DOMAIN;
|
|
356
|
+
const REMOVE_S3_DOMAIN = (fields = []) => {
|
|
357
|
+
const fieldStr = fields.join('\n ');
|
|
358
|
+
const hasFields = fields.length > 0;
|
|
359
|
+
return (0, graphql_tag_1.gql) `
|
|
360
|
+
mutation RemoveS3Domain(
|
|
361
|
+
$s3UserId: String!,
|
|
362
|
+
$domainId: String!,
|
|
363
|
+
$byUser: String!
|
|
364
|
+
) {
|
|
365
|
+
removeS3Domain(
|
|
366
|
+
s3UserId: $s3UserId,
|
|
367
|
+
domainId: $domainId,
|
|
368
|
+
byUser: $byUser,
|
|
369
|
+
) {
|
|
370
|
+
${hasFields ? `${fieldStr}` : ''}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
`;
|
|
374
|
+
};
|
|
375
|
+
exports.REMOVE_S3_DOMAIN = REMOVE_S3_DOMAIN;
|
|
376
|
+
const ADD_CORS_BUCKET = (fields = []) => {
|
|
377
|
+
const fieldStr = fields.join('\n ');
|
|
378
|
+
const hasFields = fields.length > 0;
|
|
379
|
+
return (0, graphql_tag_1.gql) `
|
|
380
|
+
mutation AddCorsBucket(
|
|
381
|
+
$s3UserId: String!,
|
|
382
|
+
$bucketId: String!,
|
|
383
|
+
$allowedMethods: [String],
|
|
384
|
+
$allowedOrigins: [String],
|
|
385
|
+
$allowedHeaders: [String],
|
|
386
|
+
$exposeHeaders: [String],
|
|
387
|
+
$maxAgeSeconds: Int,
|
|
388
|
+
$updateBy: String!
|
|
389
|
+
) {
|
|
390
|
+
addCorsBucket(
|
|
391
|
+
s3UserId: $s3UserId,
|
|
392
|
+
bucketId: $bucketId,
|
|
393
|
+
allowedMethods: $allowedMethods,
|
|
394
|
+
allowedOrigins: $allowedOrigins,
|
|
395
|
+
allowedHeaders: $allowedHeaders,
|
|
396
|
+
exposeHeaders: $exposeHeaders,
|
|
397
|
+
maxAgeSeconds: $maxAgeSeconds,
|
|
398
|
+
updateBy: $updateBy
|
|
399
|
+
) {
|
|
400
|
+
${hasFields ? `${fieldStr}` : ''}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
`;
|
|
404
|
+
};
|
|
405
|
+
exports.ADD_CORS_BUCKET = ADD_CORS_BUCKET;
|
|
406
|
+
const UPDATE_CORS_BUCKET = (fields = []) => {
|
|
407
|
+
const fieldStr = fields.join('\n ');
|
|
408
|
+
const hasFields = fields.length > 0;
|
|
409
|
+
return (0, graphql_tag_1.gql) `
|
|
410
|
+
mutation UpdateCorsBucket(
|
|
411
|
+
$s3UserId: String!,
|
|
412
|
+
$bucketId: String!,
|
|
413
|
+
$allowedMethods: [String],
|
|
414
|
+
$allowedOrigins: [String],
|
|
415
|
+
$allowedHeaders: [String],
|
|
416
|
+
$exposeHeaders: [String],
|
|
417
|
+
$maxAgeSeconds: Int,
|
|
418
|
+
$corsId: String!,
|
|
419
|
+
$updateBy: String!
|
|
420
|
+
) {
|
|
421
|
+
updateCorsBucket(
|
|
422
|
+
s3UserId: $s3UserId,
|
|
423
|
+
bucketId: $bucketId,
|
|
424
|
+
allowedMethods: $allowedMethods,
|
|
425
|
+
allowedOrigins: $allowedOrigins,
|
|
426
|
+
allowedHeaders: $allowedHeaders,
|
|
427
|
+
exposeHeaders: $exposeHeaders,
|
|
428
|
+
maxAgeSeconds: $maxAgeSeconds,
|
|
429
|
+
corsId: $corsId,
|
|
430
|
+
updateBy: $updateBy
|
|
431
|
+
) {
|
|
432
|
+
${hasFields ? `${fieldStr}` : ''}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
`;
|
|
436
|
+
};
|
|
437
|
+
exports.UPDATE_CORS_BUCKET = UPDATE_CORS_BUCKET;
|
|
438
|
+
const REMOVE_CORS_BUCKET = (fields = []) => {
|
|
439
|
+
const fieldStr = fields.join('\n ');
|
|
440
|
+
const hasFields = fields.length > 0;
|
|
441
|
+
return (0, graphql_tag_1.gql) `
|
|
442
|
+
mutation RemoveCorsBucket(
|
|
443
|
+
$s3UserId: String!,
|
|
444
|
+
$bucketId: String!,
|
|
445
|
+
$corsId: String!,
|
|
446
|
+
$updateBy: String!
|
|
447
|
+
) {
|
|
448
|
+
removeCorsBucket(
|
|
449
|
+
s3UserId: $s3UserId,
|
|
450
|
+
bucketId: $bucketId,
|
|
451
|
+
corsId: $corsId,
|
|
452
|
+
updateBy: $updateBy,
|
|
453
|
+
) {
|
|
454
|
+
${hasFields ? `${fieldStr}` : ''}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
`;
|
|
458
|
+
};
|
|
459
|
+
exports.REMOVE_CORS_BUCKET = REMOVE_CORS_BUCKET;
|
|
@@ -3,3 +3,6 @@ export declare const GET_LIST_S3_USER_BY_SERVICE_ID: (fields?: string[]) => Docu
|
|
|
3
3
|
export declare const GET_LIST_BUCKET_BY_S3_USER_ID: (fields?: string[]) => DocumentNode;
|
|
4
4
|
export declare const GET_LIST_OBJECT: (fields?: string[]) => DocumentNode;
|
|
5
5
|
export declare const GET_LIST_FILE_TRASH: (fields?: string[]) => DocumentNode;
|
|
6
|
+
export declare const GET_LIST_S3_DOMAIN_BY_S3_USER_ID: (fields?: string[]) => DocumentNode;
|
|
7
|
+
export declare const GET_LIST_CORS_BY_S3_USER_ID: (fields?: string[]) => DocumentNode;
|
|
8
|
+
export declare const CHART_IN_YEAR: (fields?: string[]) => DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_LIST_FILE_TRASH = exports.GET_LIST_OBJECT = exports.GET_LIST_BUCKET_BY_S3_USER_ID = exports.GET_LIST_S3_USER_BY_SERVICE_ID = void 0;
|
|
3
|
+
exports.CHART_IN_YEAR = exports.GET_LIST_CORS_BY_S3_USER_ID = exports.GET_LIST_S3_DOMAIN_BY_S3_USER_ID = exports.GET_LIST_FILE_TRASH = exports.GET_LIST_OBJECT = exports.GET_LIST_BUCKET_BY_S3_USER_ID = exports.GET_LIST_S3_USER_BY_SERVICE_ID = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
const GET_LIST_S3_USER_BY_SERVICE_ID = (fields = []) => {
|
|
6
6
|
const fieldStr = fields.join('\n ');
|
|
@@ -50,3 +50,39 @@ const GET_LIST_FILE_TRASH = (fields = []) => {
|
|
|
50
50
|
`;
|
|
51
51
|
};
|
|
52
52
|
exports.GET_LIST_FILE_TRASH = GET_LIST_FILE_TRASH;
|
|
53
|
+
const GET_LIST_S3_DOMAIN_BY_S3_USER_ID = (fields = []) => {
|
|
54
|
+
const fieldStr = fields.join('\n ');
|
|
55
|
+
const hasFields = fields.length > 0;
|
|
56
|
+
return (0, graphql_tag_1.gql) `
|
|
57
|
+
query GetListS3DomainByS3UserId($s3UserId: String!) {
|
|
58
|
+
getListS3DomainByS3UserId(s3UserId: $s3UserId) {
|
|
59
|
+
${hasFields ? `${fieldStr}` : ''}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
`;
|
|
63
|
+
};
|
|
64
|
+
exports.GET_LIST_S3_DOMAIN_BY_S3_USER_ID = GET_LIST_S3_DOMAIN_BY_S3_USER_ID;
|
|
65
|
+
const GET_LIST_CORS_BY_S3_USER_ID = (fields = []) => {
|
|
66
|
+
const fieldStr = fields.join('\n ');
|
|
67
|
+
const hasFields = fields.length > 0;
|
|
68
|
+
return (0, graphql_tag_1.gql) `
|
|
69
|
+
query GetListCorsByS3UserId($s3UserId: String!, $bucketId: String!) {
|
|
70
|
+
getListCorsByS3UserId(s3UserId: $s3UserId, bucketId: $bucketId) {
|
|
71
|
+
${hasFields ? `${fieldStr}` : ''}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
`;
|
|
75
|
+
};
|
|
76
|
+
exports.GET_LIST_CORS_BY_S3_USER_ID = GET_LIST_CORS_BY_S3_USER_ID;
|
|
77
|
+
const CHART_IN_YEAR = (fields = []) => {
|
|
78
|
+
const fieldStr = fields.join('\n ');
|
|
79
|
+
const hasFields = fields.length > 0;
|
|
80
|
+
return (0, graphql_tag_1.gql) `
|
|
81
|
+
query ChartInYear($s3UserId: String!, $year: Int!) {
|
|
82
|
+
chartInYear(s3UserId: $s3UserId, year: $year) {
|
|
83
|
+
${hasFields ? `${fieldStr}` : ''}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
`;
|
|
87
|
+
};
|
|
88
|
+
exports.CHART_IN_YEAR = CHART_IN_YEAR;
|
|
@@ -15,9 +15,18 @@ export declare class StorageS3Service extends Service {
|
|
|
15
15
|
removeFile(s3UserId: string, bucketId: string, keys: string[], fields: string[]): Promise<any>;
|
|
16
16
|
createFolder(s3UserId: string, bucketId: string, folderName: string, key: string, fields: string[]): Promise<any>;
|
|
17
17
|
removeFolder(s3UserId: string, bucketId: string, key: string, fields: string[]): Promise<any>;
|
|
18
|
-
createBucket(s3UserId: string, bucketName: string, enableObjectLock: boolean, enableBucketVersioning: boolean, fields: string[]): Promise<any>;
|
|
18
|
+
createBucket(s3UserId: string, bucketName: string, internalId: string, randomInternalId: boolean, enableObjectLock: boolean, enableBucketVersioning: boolean, byUser: string, fields: string[]): Promise<any>;
|
|
19
|
+
renameBucket(bucketId: string, bucketName: string, updateBy: string, fields: string[]): Promise<any>;
|
|
19
20
|
deleteBucket(bucketId: string, updateBy: string, fields: string[]): Promise<any>;
|
|
20
21
|
updateAclPermissionBucket(s3UserId: string, bucketId: string, isPublic: boolean, updateBy: string, fields: string[]): Promise<any>;
|
|
21
22
|
updateBucketVersioning(s3UserId: string, bucketId: string, isOn: boolean, updateBy: string, fields: string[]): Promise<any>;
|
|
22
23
|
getListFileTrash(s3UserId: string, bucketId: string, fields: string[]): Promise<any>;
|
|
24
|
+
getListS3DomainByS3UserId(s3UserId: string, fields: string[]): Promise<any>;
|
|
25
|
+
addS3Domain(s3UserId: string, domain: string, byUser: string, fields: string[]): Promise<any>;
|
|
26
|
+
removeS3Domain(s3UserId: string, domainId: string, byUser: string, fields: string[]): Promise<any>;
|
|
27
|
+
getListCorsByS3UserId(s3UserId: string, bucketId: string, fields: string[]): Promise<any>;
|
|
28
|
+
addCorsBucket(s3UserId: string, bucketId: string, allowedMethods: string[], allowedOrigins: string[], allowedHeaders: string[], exposeHeaders: string[], maxAgeSeconds: number, updateBy: string, fields: string[]): Promise<any>;
|
|
29
|
+
updateCorsBucket(s3UserId: string, bucketId: string, corsId: string, allowedMethods: string[], allowedOrigins: string[], allowedHeaders: string[], exposeHeaders: string[], maxAgeSeconds: number, updateBy: string, fields: string[]): Promise<any>;
|
|
30
|
+
removeCorsBucket(s3UserId: string, bucketId: string, corsId: string, updateBy: string, fields: string[]): Promise<any>;
|
|
31
|
+
chartInYear(s3UserId: string, year: number, fields: string[]): Promise<any>;
|
|
23
32
|
}
|
|
@@ -76,7 +76,7 @@ class StorageS3Service extends serviceSDK_1.Service {
|
|
|
76
76
|
fileInfo,
|
|
77
77
|
basePrefix,
|
|
78
78
|
};
|
|
79
|
-
console.log(
|
|
79
|
+
console.log('variables', variables);
|
|
80
80
|
try {
|
|
81
81
|
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
82
82
|
return response.uploadFolder;
|
|
@@ -225,7 +225,7 @@ class StorageS3Service extends serviceSDK_1.Service {
|
|
|
225
225
|
s3UserId,
|
|
226
226
|
bucketId,
|
|
227
227
|
folderName,
|
|
228
|
-
key
|
|
228
|
+
key,
|
|
229
229
|
};
|
|
230
230
|
try {
|
|
231
231
|
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
@@ -255,14 +255,17 @@ class StorageS3Service extends serviceSDK_1.Service {
|
|
|
255
255
|
}
|
|
256
256
|
});
|
|
257
257
|
}
|
|
258
|
-
createBucket(s3UserId, bucketName, enableObjectLock, enableBucketVersioning, fields) {
|
|
258
|
+
createBucket(s3UserId, bucketName, internalId, randomInternalId, enableObjectLock, enableBucketVersioning, byUser, fields) {
|
|
259
259
|
return __awaiter(this, void 0, void 0, function* () {
|
|
260
260
|
const mutation = (0, mutations_1.CREATE_BUCKET)(fields);
|
|
261
261
|
const variables = {
|
|
262
262
|
s3UserId,
|
|
263
263
|
bucketName,
|
|
264
|
+
internalId,
|
|
265
|
+
randomInternalId,
|
|
264
266
|
enableObjectLock,
|
|
265
|
-
enableBucketVersioning
|
|
267
|
+
enableBucketVersioning,
|
|
268
|
+
byUser,
|
|
266
269
|
};
|
|
267
270
|
try {
|
|
268
271
|
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
@@ -274,12 +277,30 @@ class StorageS3Service extends serviceSDK_1.Service {
|
|
|
274
277
|
}
|
|
275
278
|
});
|
|
276
279
|
}
|
|
280
|
+
renameBucket(bucketId, bucketName, updateBy, fields) {
|
|
281
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
282
|
+
const mutation = (0, mutations_1.RENAME_BUCKET)(fields);
|
|
283
|
+
const variables = {
|
|
284
|
+
bucketId,
|
|
285
|
+
bucketName,
|
|
286
|
+
updateBy
|
|
287
|
+
};
|
|
288
|
+
try {
|
|
289
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
290
|
+
return response.renameBucket;
|
|
291
|
+
}
|
|
292
|
+
catch (error) {
|
|
293
|
+
console.log(`Error in renameBucket: ${error}`);
|
|
294
|
+
throw error;
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}
|
|
277
298
|
deleteBucket(bucketId, updateBy, fields) {
|
|
278
299
|
return __awaiter(this, void 0, void 0, function* () {
|
|
279
300
|
const mutation = (0, mutations_1.DELETE_BUCKET)(fields);
|
|
280
301
|
const variables = {
|
|
281
302
|
bucketId,
|
|
282
|
-
updateBy
|
|
303
|
+
updateBy,
|
|
283
304
|
};
|
|
284
305
|
try {
|
|
285
306
|
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
@@ -298,7 +319,7 @@ class StorageS3Service extends serviceSDK_1.Service {
|
|
|
298
319
|
s3UserId,
|
|
299
320
|
bucketId,
|
|
300
321
|
isPublic,
|
|
301
|
-
updateBy
|
|
322
|
+
updateBy,
|
|
302
323
|
};
|
|
303
324
|
try {
|
|
304
325
|
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
@@ -317,7 +338,7 @@ class StorageS3Service extends serviceSDK_1.Service {
|
|
|
317
338
|
s3UserId,
|
|
318
339
|
bucketId,
|
|
319
340
|
isOn,
|
|
320
|
-
updateBy
|
|
341
|
+
updateBy,
|
|
321
342
|
};
|
|
322
343
|
try {
|
|
323
344
|
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
@@ -334,7 +355,7 @@ class StorageS3Service extends serviceSDK_1.Service {
|
|
|
334
355
|
const query = (0, queries_1.GET_LIST_FILE_TRASH)(fields);
|
|
335
356
|
const variables = {
|
|
336
357
|
s3UserId,
|
|
337
|
-
bucketId
|
|
358
|
+
bucketId,
|
|
338
359
|
};
|
|
339
360
|
try {
|
|
340
361
|
const response = yield this.graphqlQueryV2(query, variables);
|
|
@@ -346,5 +367,157 @@ class StorageS3Service extends serviceSDK_1.Service {
|
|
|
346
367
|
}
|
|
347
368
|
});
|
|
348
369
|
}
|
|
370
|
+
getListS3DomainByS3UserId(s3UserId, fields) {
|
|
371
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
372
|
+
const query = (0, queries_1.GET_LIST_S3_DOMAIN_BY_S3_USER_ID)(fields);
|
|
373
|
+
const variables = {
|
|
374
|
+
s3UserId,
|
|
375
|
+
};
|
|
376
|
+
try {
|
|
377
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
|
378
|
+
return response.getListS3DomainByS3UserId;
|
|
379
|
+
}
|
|
380
|
+
catch (error) {
|
|
381
|
+
console.log(`Error in getListS3DomainByS3UserId: ${error}`);
|
|
382
|
+
throw error;
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
addS3Domain(s3UserId, domain, byUser, fields) {
|
|
387
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
388
|
+
const query = (0, mutations_1.ADD_S3_DOMAIN)(fields);
|
|
389
|
+
const variables = {
|
|
390
|
+
s3UserId,
|
|
391
|
+
domain,
|
|
392
|
+
byUser,
|
|
393
|
+
};
|
|
394
|
+
try {
|
|
395
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
|
396
|
+
return response.addS3Domain;
|
|
397
|
+
}
|
|
398
|
+
catch (error) {
|
|
399
|
+
console.log(`Error in addS3Domain: ${error}`);
|
|
400
|
+
throw error;
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
removeS3Domain(s3UserId, domainId, byUser, fields) {
|
|
405
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
406
|
+
const query = (0, mutations_1.REMOVE_S3_DOMAIN)(fields);
|
|
407
|
+
const variables = {
|
|
408
|
+
s3UserId,
|
|
409
|
+
domainId,
|
|
410
|
+
byUser,
|
|
411
|
+
};
|
|
412
|
+
try {
|
|
413
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
|
414
|
+
return response.removeS3Domain;
|
|
415
|
+
}
|
|
416
|
+
catch (error) {
|
|
417
|
+
console.log(`Error in removeS3Domain: ${error}`);
|
|
418
|
+
throw error;
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
getListCorsByS3UserId(s3UserId, bucketId, fields) {
|
|
423
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
424
|
+
const query = (0, queries_1.GET_LIST_CORS_BY_S3_USER_ID)(fields);
|
|
425
|
+
const variables = {
|
|
426
|
+
s3UserId,
|
|
427
|
+
bucketId,
|
|
428
|
+
};
|
|
429
|
+
try {
|
|
430
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
|
431
|
+
return response.getListCorsByS3UserId;
|
|
432
|
+
}
|
|
433
|
+
catch (error) {
|
|
434
|
+
console.log(`Error in getListCorsByS3UserId: ${error}`);
|
|
435
|
+
throw error;
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
addCorsBucket(s3UserId, bucketId, allowedMethods, allowedOrigins, allowedHeaders, exposeHeaders, maxAgeSeconds, updateBy, fields) {
|
|
440
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
441
|
+
const query = (0, mutations_1.ADD_CORS_BUCKET)(fields);
|
|
442
|
+
const variables = {
|
|
443
|
+
s3UserId,
|
|
444
|
+
bucketId,
|
|
445
|
+
allowedMethods,
|
|
446
|
+
allowedOrigins,
|
|
447
|
+
allowedHeaders,
|
|
448
|
+
exposeHeaders,
|
|
449
|
+
maxAgeSeconds,
|
|
450
|
+
updateBy,
|
|
451
|
+
};
|
|
452
|
+
try {
|
|
453
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
|
454
|
+
return response.addCorsBucket;
|
|
455
|
+
}
|
|
456
|
+
catch (error) {
|
|
457
|
+
console.log(`Error in addCorsBucket: ${error}`);
|
|
458
|
+
throw error;
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
updateCorsBucket(s3UserId, bucketId, corsId, allowedMethods, allowedOrigins, allowedHeaders, exposeHeaders, maxAgeSeconds, updateBy, fields) {
|
|
463
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
464
|
+
const query = (0, mutations_1.UPDATE_CORS_BUCKET)(fields);
|
|
465
|
+
const variables = {
|
|
466
|
+
s3UserId,
|
|
467
|
+
bucketId,
|
|
468
|
+
corsId,
|
|
469
|
+
allowedMethods,
|
|
470
|
+
allowedOrigins,
|
|
471
|
+
allowedHeaders,
|
|
472
|
+
exposeHeaders,
|
|
473
|
+
maxAgeSeconds,
|
|
474
|
+
updateBy,
|
|
475
|
+
};
|
|
476
|
+
try {
|
|
477
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
|
478
|
+
return response.updateCorsBucket;
|
|
479
|
+
}
|
|
480
|
+
catch (error) {
|
|
481
|
+
console.log(`Error in updateCorsBucket: ${error}`);
|
|
482
|
+
throw error;
|
|
483
|
+
}
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
removeCorsBucket(s3UserId, bucketId, corsId, updateBy, fields) {
|
|
487
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
488
|
+
const query = (0, mutations_1.REMOVE_CORS_BUCKET)(fields);
|
|
489
|
+
const variables = {
|
|
490
|
+
s3UserId,
|
|
491
|
+
bucketId,
|
|
492
|
+
corsId,
|
|
493
|
+
updateBy,
|
|
494
|
+
};
|
|
495
|
+
try {
|
|
496
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
|
497
|
+
return response.removeCorsBucket;
|
|
498
|
+
}
|
|
499
|
+
catch (error) {
|
|
500
|
+
console.log(`Error in removeCorsBucket: ${error}`);
|
|
501
|
+
throw error;
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
chartInYear(s3UserId, year, fields) {
|
|
506
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
507
|
+
const query = (0, queries_1.CHART_IN_YEAR)(fields);
|
|
508
|
+
const variables = {
|
|
509
|
+
s3UserId,
|
|
510
|
+
year
|
|
511
|
+
};
|
|
512
|
+
try {
|
|
513
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
|
514
|
+
return response.chartInYear;
|
|
515
|
+
}
|
|
516
|
+
catch (error) {
|
|
517
|
+
console.log(`Error in chartInYear: ${error}`);
|
|
518
|
+
throw error;
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
}
|
|
349
522
|
}
|
|
350
523
|
exports.StorageS3Service = StorageS3Service;
|