@longvansoftware/service-js-client 1.19.4 → 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/crm_camping/queries.d.ts +1 -0
- package/dist/src/graphql/crm_camping/queries.js +25 -1
- 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/crm_camping/index.d.ts +1 -0
- package/dist/src/lib/crm_camping/index.js +17 -0
- package/dist/src/lib/service.d.ts +14 -0
- package/dist/src/lib/service.js +101 -0
- package/dist/src/lib/storage_s3/index.d.ts +10 -1
- package/dist/src/lib/storage_s3/index.js +181 -8
- package/dist/src/utils/build-field-string.d.ts +1 -0
- package/dist/src/utils/build-field-string.js +16 -0
- package/package.json +1 -1
|
@@ -8,3 +8,4 @@ export declare const GET_NUMBER_OF_TICKET_EVALUATION: import("graphql").Document
|
|
|
8
8
|
export declare const SEARCH_PRODUCT_GIFT_PROMOTION_RESPONSE: import("graphql").DocumentNode;
|
|
9
9
|
export declare const GET_VOUCHERS_V2: import("graphql").DocumentNode;
|
|
10
10
|
export declare const SEARCH_CAMPAIGN: import("graphql").DocumentNode;
|
|
11
|
+
export declare const GET_CONDITION_BY_ORGID_CAMPAIGN_ACTIONIDS: import("graphql").DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SEARCH_CAMPAIGN = exports.GET_VOUCHERS_V2 = exports.SEARCH_PRODUCT_GIFT_PROMOTION_RESPONSE = exports.GET_NUMBER_OF_TICKET_EVALUATION = exports.GET_URL_EVALUATION = exports.GET_AVERAGE_RATING = exports.GET_VOUCHERS = exports.SUGGEST_VOUCHER = exports.GET_CAMPAIGN_ACTION_BY_ID = exports.SEARCH_PRODUCT_QUANTITY_PROMOTION_ACTION = void 0;
|
|
3
|
+
exports.GET_CONDITION_BY_ORGID_CAMPAIGN_ACTIONIDS = exports.SEARCH_CAMPAIGN = exports.GET_VOUCHERS_V2 = exports.SEARCH_PRODUCT_GIFT_PROMOTION_RESPONSE = exports.GET_NUMBER_OF_TICKET_EVALUATION = exports.GET_URL_EVALUATION = exports.GET_AVERAGE_RATING = exports.GET_VOUCHERS = exports.SUGGEST_VOUCHER = exports.GET_CAMPAIGN_ACTION_BY_ID = exports.SEARCH_PRODUCT_QUANTITY_PROMOTION_ACTION = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.SEARCH_PRODUCT_QUANTITY_PROMOTION_ACTION = (0, graphql_tag_1.gql) `
|
|
6
6
|
query SearchProductQuantityPromotionAction(
|
|
@@ -361,3 +361,27 @@ exports.SEARCH_CAMPAIGN = (0, graphql_tag_1.gql) `
|
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
363
|
`;
|
|
364
|
+
exports.GET_CONDITION_BY_ORGID_CAMPAIGN_ACTIONIDS = (0, graphql_tag_1.gql) `
|
|
365
|
+
query GetConditionByOrgIdCampaignActionIds(
|
|
366
|
+
$orgId: String!
|
|
367
|
+
$campaignActionIds: [String]!
|
|
368
|
+
) {
|
|
369
|
+
getConditionByOrgIdCampaignActionIds(
|
|
370
|
+
orgId: $orgId
|
|
371
|
+
campaignActionIds: $campaignActionIds
|
|
372
|
+
) {
|
|
373
|
+
partyId
|
|
374
|
+
campaignActionId
|
|
375
|
+
type
|
|
376
|
+
minimumSpend
|
|
377
|
+
maximumSpend
|
|
378
|
+
description
|
|
379
|
+
newCustomer
|
|
380
|
+
id
|
|
381
|
+
createdStamp
|
|
382
|
+
updatedStamp
|
|
383
|
+
updatedBy
|
|
384
|
+
createdBy
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
`;
|
|
@@ -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,4 +15,5 @@ export declare class CrmCampingService extends Service {
|
|
|
15
15
|
addProductGiftPromotion(orderId: string, updatedBy: string, addData: any): Promise<any>;
|
|
16
16
|
searchVouchersV2(searchVoucherRequest: any): Promise<any>;
|
|
17
17
|
searchCampaign(searchCampaignRequest: any): Promise<any>;
|
|
18
|
+
getConditionByOrgIdCampaignActionIds(campaignActionIds: [string]): Promise<any>;
|
|
18
19
|
}
|
|
@@ -258,5 +258,22 @@ class CrmCampingService extends serviceSDK_1.Service {
|
|
|
258
258
|
}
|
|
259
259
|
});
|
|
260
260
|
}
|
|
261
|
+
getConditionByOrgIdCampaignActionIds(campaignActionIds) {
|
|
262
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
263
|
+
const query = queries_1.GET_CONDITION_BY_ORGID_CAMPAIGN_ACTIONIDS;
|
|
264
|
+
const variables = {
|
|
265
|
+
orgId: this.orgId,
|
|
266
|
+
campaignActionIds,
|
|
267
|
+
};
|
|
268
|
+
try {
|
|
269
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
270
|
+
return response.getConditionByOrgIdCampaignActionIds;
|
|
271
|
+
}
|
|
272
|
+
catch (error) {
|
|
273
|
+
console.log(`Error fetching getConditionByOrgIdCampaignActionIds: ${error}`);
|
|
274
|
+
throw error;
|
|
275
|
+
}
|
|
276
|
+
});
|
|
277
|
+
}
|
|
261
278
|
}
|
|
262
279
|
exports.CrmCampingService = CrmCampingService;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ApolloClient, NormalizedCacheObject } from "@apollo/client";
|
|
2
|
+
import { DocumentNode } from "graphql";
|
|
3
|
+
export declare class Service {
|
|
4
|
+
protected token: string | null;
|
|
5
|
+
protected client: ApolloClient<NormalizedCacheObject>;
|
|
6
|
+
protected orgId: string;
|
|
7
|
+
protected storeId: string;
|
|
8
|
+
protected endpoint: string;
|
|
9
|
+
constructor(endpoint: string, orgId: string, storeId: string);
|
|
10
|
+
setToken(token: string): void;
|
|
11
|
+
protected graphqlQuery(query: DocumentNode, variables: any): Promise<any>;
|
|
12
|
+
protected graphqlMutation(mutation: DocumentNode, variables: any): Promise<any>;
|
|
13
|
+
protected restApiCallWithToken(path: string, method: "GET" | "POST" | "PUT" | "DELETE", data?: any, headers?: any): Promise<any>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/service.ts
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.Service = void 0;
|
|
17
|
+
const client_1 = require("@apollo/client");
|
|
18
|
+
const axios_1 = __importDefault(require("axios"));
|
|
19
|
+
class Service {
|
|
20
|
+
constructor(endpoint, orgId, storeId) {
|
|
21
|
+
this.token = null;
|
|
22
|
+
this.client = new client_1.ApolloClient({
|
|
23
|
+
uri: endpoint,
|
|
24
|
+
cache: new client_1.InMemoryCache(),
|
|
25
|
+
defaultOptions: {
|
|
26
|
+
query: {
|
|
27
|
+
fetchPolicy: "network-only",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
this.orgId = orgId;
|
|
32
|
+
this.storeId = storeId;
|
|
33
|
+
this.endpoint = endpoint;
|
|
34
|
+
}
|
|
35
|
+
setToken(token) {
|
|
36
|
+
this.token = token;
|
|
37
|
+
}
|
|
38
|
+
// setOrgId(orgId: string) {
|
|
39
|
+
// this.orgId = orgId;
|
|
40
|
+
// }
|
|
41
|
+
graphqlQuery(query, variables) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
try {
|
|
44
|
+
const { data, errors } = yield this.client.query({
|
|
45
|
+
query: (0, client_1.gql) `
|
|
46
|
+
${query}
|
|
47
|
+
`,
|
|
48
|
+
variables,
|
|
49
|
+
});
|
|
50
|
+
if (errors) {
|
|
51
|
+
throw new Error(`GraphQL error! errors: ${errors}`);
|
|
52
|
+
}
|
|
53
|
+
return data;
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
console.log(`Error in graphqlQuery: ${error}`);
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
graphqlMutation(mutation, variables) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
try {
|
|
64
|
+
const { data, errors } = yield this.client.mutate({
|
|
65
|
+
mutation: (0, client_1.gql) `
|
|
66
|
+
${mutation}
|
|
67
|
+
`,
|
|
68
|
+
variables,
|
|
69
|
+
});
|
|
70
|
+
if (errors) {
|
|
71
|
+
throw new Error(`GraphQL error! errors: ${errors}`);
|
|
72
|
+
}
|
|
73
|
+
return data;
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.log(`Error in graphqlMutation: ${error}`);
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
restApiCallWithToken(path, method, data, headers) {
|
|
82
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
try {
|
|
84
|
+
const modifiedHeaders = Object.assign(Object.assign({}, headers), { "Partner-Id": this.orgId, "X-Ecomos-Access-Token": this.token });
|
|
85
|
+
console.log("🚀 ~ Service ~ modifiedHeaders:", modifiedHeaders);
|
|
86
|
+
const response = yield (0, axios_1.default)({
|
|
87
|
+
url: this.endpoint + path,
|
|
88
|
+
method,
|
|
89
|
+
data,
|
|
90
|
+
headers: modifiedHeaders,
|
|
91
|
+
});
|
|
92
|
+
return response.data;
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
console.log(`Error in restApiCallWithToken: ${error}`);
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.Service = Service;
|
|
@@ -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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function buildFieldString(fields: (string | Record<string, any>)[], indent?: number): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildFieldString = void 0;
|
|
4
|
+
function buildFieldString(fields, indent = 6) {
|
|
5
|
+
const space = " ".repeat(indent);
|
|
6
|
+
return fields
|
|
7
|
+
.map((field) => {
|
|
8
|
+
if (typeof field === "string")
|
|
9
|
+
return `${space}${field}`;
|
|
10
|
+
const [key, value] = Object.entries(field)[0];
|
|
11
|
+
const nested = buildFieldString(value, indent + 2);
|
|
12
|
+
return `${space}${key} {\n${nested}\n${space}}`;
|
|
13
|
+
})
|
|
14
|
+
.join("\n");
|
|
15
|
+
}
|
|
16
|
+
exports.buildFieldString = buildFieldString;
|