@longvansoftware/service-js-client 1.20.2 → 1.20.4
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/config/config.d.ts +0 -4
- package/dist/config/config.js +0 -6
- package/dist/src/graphql/cloud/queries.d.ts +19 -21
- package/dist/src/graphql/cloud/queries.js +1 -13
- package/dist/src/graphql/crm_camping/queries.d.ts +0 -1
- package/dist/src/graphql/crm_camping/queries.js +1 -25
- package/dist/src/graphql/storage_s3/mutations.d.ts +0 -3
- package/dist/src/graphql/storage_s3/mutations.js +1 -65
- package/dist/src/graphql/storage_s3/queries.d.ts +0 -1
- package/dist/src/graphql/storage_s3/queries.js +3 -15
- package/dist/src/lib/SDK.d.ts +0 -6
- package/dist/src/lib/SDK.js +0 -8
- package/dist/src/lib/cloud/index.d.ts +0 -1
- package/dist/src/lib/cloud/index.js +0 -16
- package/dist/src/lib/crm_camping/index.d.ts +0 -1
- package/dist/src/lib/crm_camping/index.js +0 -17
- 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 +2 -7
- package/dist/src/lib/storage_s3/index.js +2 -96
- package/dist/src/types/storage_s3.d.ts +0 -4
- 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
package/dist/config/config.d.ts
CHANGED
|
@@ -19,8 +19,6 @@ export declare const environmentEndpoints: {
|
|
|
19
19
|
cloud_rest: string;
|
|
20
20
|
accounting_service: string;
|
|
21
21
|
quicklab_service: string;
|
|
22
|
-
remote_access_service: string;
|
|
23
|
-
storage_s3: string;
|
|
24
22
|
};
|
|
25
23
|
live: {
|
|
26
24
|
product: string;
|
|
@@ -42,7 +40,5 @@ export declare const environmentEndpoints: {
|
|
|
42
40
|
cloud_rest: string;
|
|
43
41
|
accounting_service: string;
|
|
44
42
|
quicklab_service: string;
|
|
45
|
-
remote_access_service: string;
|
|
46
|
-
storage_s3: string;
|
|
47
43
|
};
|
|
48
44
|
};
|
package/dist/config/config.js
CHANGED
|
@@ -22,9 +22,6 @@ exports.environmentEndpoints = {
|
|
|
22
22
|
cloud_rest: "https://api-gateway.dev.longvan.vn/cloud-service-api/v1",
|
|
23
23
|
accounting_service: "https://api-gateway.dev.longvan.vn/accounting-service/graphql/",
|
|
24
24
|
quicklab_service: "https://portal.dev.longvan.vn/quicklab-api/graphql",
|
|
25
|
-
remote_access_service: "https://api-gateway.dev.longvan.vn/remote-access-service/graphql",
|
|
26
|
-
// storage_s3: "https://portal.dev.longvan.vn/storage-s3-api/graphql",
|
|
27
|
-
storage_s3: "https://storage-s3-api.dev.longvan.vn/storage-s3-api/graphql",
|
|
28
25
|
},
|
|
29
26
|
live: {
|
|
30
27
|
product: "https://product-service.longvan.vn/product-service/graphql",
|
|
@@ -46,8 +43,5 @@ exports.environmentEndpoints = {
|
|
|
46
43
|
cloud_rest: "https://api-gateway.longvan.vn/cloud-service-api/v1",
|
|
47
44
|
accounting_service: "https://api-gateway.longvan.vn/accounting-service/graphql/",
|
|
48
45
|
quicklab_service: "https://portal.longvan.vn/quicklab-api/graphql",
|
|
49
|
-
remote_access_service: "https://api-gateway.longvan.vn/remote-access-service/graphql",
|
|
50
|
-
// storage_s3: "https://portal.longvan.vn/storage-s3-api/graphql",
|
|
51
|
-
storage_s3: "https://storage-s3-api.longvan.vn/storage-s3-api/graphql",
|
|
52
46
|
},
|
|
53
47
|
};
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const SEARCH_ACTIONS: DocumentNode;
|
|
21
|
-
export declare const GET_ELASTIC_CLOUD_RESOURCE: DocumentNode;
|
|
1
|
+
export declare const CHECK_DOMAIN_NAME_AVAILABLE: import("graphql").DocumentNode;
|
|
2
|
+
export declare const CHECK_DOMAIN_NAME_AVAILAVLE_VNNIC: import("graphql").DocumentNode;
|
|
3
|
+
export declare const GET_WHOIS_DOMAIN_INFO: import("graphql").DocumentNode;
|
|
4
|
+
export declare const SERVICE_DETAIL: import("graphql").DocumentNode;
|
|
5
|
+
export declare const GET_MAIL_RESOURCE: import("graphql").DocumentNode;
|
|
6
|
+
export declare const GET_USER_MAIL_HOSTING: import("graphql").DocumentNode;
|
|
7
|
+
export declare const SERVICE_TYPE: import("graphql").DocumentNode;
|
|
8
|
+
export declare const SEARCH_SERVICE: import("graphql").DocumentNode;
|
|
9
|
+
export declare const GET_PRODUCTS_OF_SERVICE: import("graphql").DocumentNode;
|
|
10
|
+
export declare const GET_IPS_OF_SERVICE: import("graphql").DocumentNode;
|
|
11
|
+
export declare const GET_SERVICES_BY_ORDER_ID: import("graphql").DocumentNode;
|
|
12
|
+
export declare const GET_SERVICE_TYPE_LIST: import("graphql").DocumentNode;
|
|
13
|
+
export declare const GET_DOMAIN_CONTACTS: import("graphql").DocumentNode;
|
|
14
|
+
export declare const GET_OWNERS_BY_CUSTOMER_ID: import("graphql").DocumentNode;
|
|
15
|
+
export declare const GET_CONTACTS_BY_OWNER_ID: import("graphql").DocumentNode;
|
|
16
|
+
export declare const GET_DOMAIN_SUPPLIER: import("graphql").DocumentNode;
|
|
17
|
+
export declare const CHECK_DOMAIN_EXIST: import("graphql").DocumentNode;
|
|
18
|
+
export declare const SEARCH_ACTIONS: import("graphql").DocumentNode;
|
|
19
|
+
export declare const GET_ELASTIC_CLOUD_RESOURCE: import("graphql").DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_ELASTIC_CLOUD_RESOURCE = exports.SEARCH_ACTIONS = exports.CHECK_DOMAIN_EXIST = exports.GET_DOMAIN_SUPPLIER = exports.GET_CONTACTS_BY_OWNER_ID = exports.GET_OWNERS_BY_CUSTOMER_ID = exports.GET_DOMAIN_CONTACTS = exports.GET_SERVICE_TYPE_LIST = exports.GET_SERVICES_BY_ORDER_ID = exports.GET_IPS_OF_SERVICE = exports.GET_PRODUCTS_OF_SERVICE = exports.SEARCH_SERVICE = exports.SERVICE_TYPE = exports.GET_USER_MAIL_HOSTING = exports.GET_MAIL_RESOURCE = exports.
|
|
3
|
+
exports.GET_ELASTIC_CLOUD_RESOURCE = exports.SEARCH_ACTIONS = exports.CHECK_DOMAIN_EXIST = exports.GET_DOMAIN_SUPPLIER = exports.GET_CONTACTS_BY_OWNER_ID = exports.GET_OWNERS_BY_CUSTOMER_ID = exports.GET_DOMAIN_CONTACTS = exports.GET_SERVICE_TYPE_LIST = exports.GET_SERVICES_BY_ORDER_ID = exports.GET_IPS_OF_SERVICE = exports.GET_PRODUCTS_OF_SERVICE = exports.SEARCH_SERVICE = exports.SERVICE_TYPE = exports.GET_USER_MAIL_HOSTING = exports.GET_MAIL_RESOURCE = exports.SERVICE_DETAIL = exports.GET_WHOIS_DOMAIN_INFO = exports.CHECK_DOMAIN_NAME_AVAILAVLE_VNNIC = exports.CHECK_DOMAIN_NAME_AVAILABLE = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.CHECK_DOMAIN_NAME_AVAILABLE = (0, graphql_tag_1.gql) `
|
|
6
6
|
query CheckDomainNameAvailable($domainName: String!) {
|
|
@@ -94,18 +94,6 @@ exports.SERVICE_DETAIL = (0, graphql_tag_1.gql) `
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
`;
|
|
97
|
-
const SERVICE_DETAIL_DYNAMIC = (fields = []) => {
|
|
98
|
-
const fieldStr = fields.join('\n ');
|
|
99
|
-
const hasFields = fields.length > 0;
|
|
100
|
-
return (0, graphql_tag_1.gql) `
|
|
101
|
-
query ServiceDetail($serviceId: String) {
|
|
102
|
-
serviceDetail(serviceId: $serviceId) {
|
|
103
|
-
${hasFields ? `${fieldStr}` : ''}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
`;
|
|
107
|
-
};
|
|
108
|
-
exports.SERVICE_DETAIL_DYNAMIC = SERVICE_DETAIL_DYNAMIC;
|
|
109
97
|
exports.GET_MAIL_RESOURCE = (0, graphql_tag_1.gql) `
|
|
110
98
|
query GetMailResource($serviceId: String!) {
|
|
111
99
|
getMailResource(serviceId: $serviceId) {
|
|
@@ -8,4 +8,3 @@ 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.
|
|
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;
|
|
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,27 +361,3 @@ 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
|
-
`;
|
|
@@ -15,9 +15,6 @@ export declare const REMOVE_FILE: (fields?: string[]) => DocumentNode;
|
|
|
15
15
|
export declare const UPDATE_ACL_PERMISSION_BUCKET: (fields?: string[]) => DocumentNode;
|
|
16
16
|
export declare const UPDATE_BUCKET_VERSIONING: (fields?: string[]) => DocumentNode;
|
|
17
17
|
export declare const RESTORE_FILE_TRASH: (fields?: string[]) => DocumentNode;
|
|
18
|
-
export declare const REMOVE_FILE_TRASH: (fields?: string[]) => DocumentNode;
|
|
19
|
-
export declare const RESTORE_FILE_OTHER_VERSION: (fields?: string[]) => DocumentNode;
|
|
20
|
-
export declare const REMOVE_FILE_OTHER_VERSION: (fields?: string[]) => DocumentNode;
|
|
21
18
|
export declare const ADD_S3_DOMAIN: (fields?: string[]) => DocumentNode;
|
|
22
19
|
export declare const REMOVE_S3_DOMAIN: (fields?: string[]) => DocumentNode;
|
|
23
20
|
export declare const ADD_CORS_BUCKET: (fields?: string[]) => DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.REMOVE_CORS_BUCKET = exports.UPDATE_CORS_BUCKET = exports.ADD_CORS_BUCKET = exports.REMOVE_S3_DOMAIN = exports.ADD_S3_DOMAIN = exports.
|
|
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 ');
|
|
@@ -333,70 +333,6 @@ const RESTORE_FILE_TRASH = (fields = []) => {
|
|
|
333
333
|
`;
|
|
334
334
|
};
|
|
335
335
|
exports.RESTORE_FILE_TRASH = RESTORE_FILE_TRASH;
|
|
336
|
-
const REMOVE_FILE_TRASH = (fields = []) => {
|
|
337
|
-
const fieldStr = fields.join('\n ');
|
|
338
|
-
const hasFields = fields.length > 0;
|
|
339
|
-
return (0, graphql_tag_1.gql) `
|
|
340
|
-
mutation RemoveFileTrash(
|
|
341
|
-
$s3UserId: String!,
|
|
342
|
-
$bucketId: String!,
|
|
343
|
-
$files: [FileTrashInput!]!
|
|
344
|
-
) {
|
|
345
|
-
removeFileTrash(
|
|
346
|
-
s3UserId: $s3UserId,
|
|
347
|
-
bucketId: $bucketId,
|
|
348
|
-
files: $files
|
|
349
|
-
) {
|
|
350
|
-
${hasFields ? `${fieldStr}` : ''}
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
`;
|
|
354
|
-
};
|
|
355
|
-
exports.REMOVE_FILE_TRASH = REMOVE_FILE_TRASH;
|
|
356
|
-
const RESTORE_FILE_OTHER_VERSION = (fields = []) => {
|
|
357
|
-
const fieldStr = fields.join('\n ');
|
|
358
|
-
const hasFields = fields.length > 0;
|
|
359
|
-
return (0, graphql_tag_1.gql) `
|
|
360
|
-
mutation RestoreFileOtherVersion(
|
|
361
|
-
$s3UserId: String!,
|
|
362
|
-
$bucketId: String!,
|
|
363
|
-
$key: String!,
|
|
364
|
-
$versionId: String!
|
|
365
|
-
) {
|
|
366
|
-
restoreFileOtherVersion(
|
|
367
|
-
s3UserId: $s3UserId,
|
|
368
|
-
bucketId: $bucketId,
|
|
369
|
-
key: $key,
|
|
370
|
-
versionId: $versionId
|
|
371
|
-
) {
|
|
372
|
-
${hasFields ? `${fieldStr}` : ''}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
`;
|
|
376
|
-
};
|
|
377
|
-
exports.RESTORE_FILE_OTHER_VERSION = RESTORE_FILE_OTHER_VERSION;
|
|
378
|
-
const REMOVE_FILE_OTHER_VERSION = (fields = []) => {
|
|
379
|
-
const fieldStr = fields.join('\n ');
|
|
380
|
-
const hasFields = fields.length > 0;
|
|
381
|
-
return (0, graphql_tag_1.gql) `
|
|
382
|
-
mutation RemoveFileOtherVersion(
|
|
383
|
-
$s3UserId: String!,
|
|
384
|
-
$bucketId: String!,
|
|
385
|
-
$key: String!,
|
|
386
|
-
$versionId: String!
|
|
387
|
-
) {
|
|
388
|
-
removeFileOtherVersion(
|
|
389
|
-
s3UserId: $s3UserId,
|
|
390
|
-
bucketId: $bucketId,
|
|
391
|
-
key: $key,
|
|
392
|
-
versionId: $versionId
|
|
393
|
-
) {
|
|
394
|
-
${hasFields ? `${fieldStr}` : ''}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
`;
|
|
398
|
-
};
|
|
399
|
-
exports.REMOVE_FILE_OTHER_VERSION = REMOVE_FILE_OTHER_VERSION;
|
|
400
336
|
const ADD_S3_DOMAIN = (fields = []) => {
|
|
401
337
|
const fieldStr = fields.join('\n ');
|
|
402
338
|
const hasFields = fields.length > 0;
|
|
@@ -5,5 +5,4 @@ export declare const GET_LIST_OBJECT: (fields?: string[]) => DocumentNode;
|
|
|
5
5
|
export declare const GET_LIST_FILE_TRASH: (fields?: string[]) => DocumentNode;
|
|
6
6
|
export declare const GET_LIST_S3_DOMAIN_BY_S3_USER_ID: (fields?: string[]) => DocumentNode;
|
|
7
7
|
export declare const GET_LIST_CORS_BY_S3_USER_ID: (fields?: string[]) => DocumentNode;
|
|
8
|
-
export declare const GET_LIST_FILE_OTHER_VERSION: (fields?: string[]) => DocumentNode;
|
|
9
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.CHART_IN_YEAR = exports.
|
|
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 ');
|
|
@@ -74,24 +74,12 @@ const GET_LIST_CORS_BY_S3_USER_ID = (fields = []) => {
|
|
|
74
74
|
`;
|
|
75
75
|
};
|
|
76
76
|
exports.GET_LIST_CORS_BY_S3_USER_ID = GET_LIST_CORS_BY_S3_USER_ID;
|
|
77
|
-
const GET_LIST_FILE_OTHER_VERSION = (fields = []) => {
|
|
78
|
-
const fieldStr = fields.join('\n ');
|
|
79
|
-
const hasFields = fields.length > 0;
|
|
80
|
-
return (0, graphql_tag_1.gql) `
|
|
81
|
-
query GetListFileOtherVersion($s3UserId: String!, $bucketId: String!, $key: String) {
|
|
82
|
-
getListFileOtherVersion(s3UserId: $s3UserId, bucketId: $bucketId, key: $key) {
|
|
83
|
-
${hasFields ? `${fieldStr}` : ''}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
`;
|
|
87
|
-
};
|
|
88
|
-
exports.GET_LIST_FILE_OTHER_VERSION = GET_LIST_FILE_OTHER_VERSION;
|
|
89
77
|
const CHART_IN_YEAR = (fields = []) => {
|
|
90
78
|
const fieldStr = fields.join('\n ');
|
|
91
79
|
const hasFields = fields.length > 0;
|
|
92
80
|
return (0, graphql_tag_1.gql) `
|
|
93
|
-
query ChartInYear($s3UserId: String!, $year: Int
|
|
94
|
-
chartInYear(s3UserId: $s3UserId, year: $year
|
|
81
|
+
query ChartInYear($s3UserId: String!, $year: Int!) {
|
|
82
|
+
chartInYear(s3UserId: $s3UserId, year: $year) {
|
|
95
83
|
${hasFields ? `${fieldStr}` : ''}
|
|
96
84
|
}
|
|
97
85
|
}
|
package/dist/src/lib/SDK.d.ts
CHANGED
|
@@ -17,8 +17,6 @@ import { CloudRestService } from "./cloud_rest";
|
|
|
17
17
|
import { OrderCloudRestService } from "./order_cloud_rest";
|
|
18
18
|
import { AccountingService } from "./accounting_service";
|
|
19
19
|
import { QuicklabService } from "./quicklab_service";
|
|
20
|
-
import { RemoteAccessService } from "./remote_access_service";
|
|
21
|
-
import { StorageS3Service } from "./storage_s3";
|
|
22
20
|
export interface Endpoints {
|
|
23
21
|
product: string;
|
|
24
22
|
crm: string;
|
|
@@ -39,8 +37,6 @@ export interface Endpoints {
|
|
|
39
37
|
order_cloud_rest: string;
|
|
40
38
|
accounting_service: string;
|
|
41
39
|
quicklab_service: string;
|
|
42
|
-
remote_access_service: string;
|
|
43
|
-
storage_s3: string;
|
|
44
40
|
}
|
|
45
41
|
export declare class SDK {
|
|
46
42
|
orgId: string;
|
|
@@ -66,8 +62,6 @@ export declare class SDK {
|
|
|
66
62
|
order_cloud_rest: OrderCloudRestService;
|
|
67
63
|
accounting_service: AccountingService;
|
|
68
64
|
quicklab_service: QuicklabService;
|
|
69
|
-
remote_access_service: RemoteAccessService;
|
|
70
|
-
storage_s3: StorageS3Service;
|
|
71
65
|
token: string | null;
|
|
72
66
|
private endpoints;
|
|
73
67
|
constructor(orgId: string, storeId: string, storefrontAccessToken: string, environment: string);
|
package/dist/src/lib/SDK.js
CHANGED
|
@@ -23,8 +23,6 @@ const cloud_rest_1 = require("./cloud_rest");
|
|
|
23
23
|
const order_cloud_rest_1 = require("./order_cloud_rest");
|
|
24
24
|
const accounting_service_1 = require("./accounting_service");
|
|
25
25
|
const quicklab_service_1 = require("./quicklab_service");
|
|
26
|
-
const remote_access_service_1 = require("./remote_access_service");
|
|
27
|
-
const storage_s3_1 = require("./storage_s3");
|
|
28
26
|
class SDK {
|
|
29
27
|
constructor(orgId, storeId, storefrontAccessToken, environment) {
|
|
30
28
|
this.orgId = orgId;
|
|
@@ -58,8 +56,6 @@ class SDK {
|
|
|
58
56
|
this.order_cloud_rest = new order_cloud_rest_1.OrderCloudRestService(this.endpoints.order_cloud_rest, orgId, storeId);
|
|
59
57
|
this.accounting_service = new accounting_service_1.AccountingService(this.endpoints.accounting_service, orgId, storeId);
|
|
60
58
|
this.quicklab_service = new quicklab_service_1.QuicklabService(this.endpoints.quicklab_service, orgId, storeId);
|
|
61
|
-
this.remote_access_service = new remote_access_service_1.RemoteAccessService(this.endpoints.remote_access_service, orgId, storeId);
|
|
62
|
-
this.storage_s3 = new storage_s3_1.StorageS3Service(this.endpoints.storage_s3, orgId, storeId);
|
|
63
59
|
// Initialize other services here
|
|
64
60
|
}
|
|
65
61
|
setToken(token) {
|
|
@@ -84,8 +80,6 @@ class SDK {
|
|
|
84
80
|
this.order_cloud_rest.setToken(token);
|
|
85
81
|
this.accounting_service.setToken(token);
|
|
86
82
|
this.quicklab_service.setToken(token);
|
|
87
|
-
this.remote_access_service.setToken(token);
|
|
88
|
-
this.storage_s3.setToken(token);
|
|
89
83
|
// Set token for other services here
|
|
90
84
|
}
|
|
91
85
|
// các module export từ serviceSDK.ts set storeId vào serviceSDK.ts
|
|
@@ -112,8 +106,6 @@ class SDK {
|
|
|
112
106
|
this.order_cloud_rest = new order_cloud_rest_1.OrderCloudRestService(this.endpoints.order_cloud_rest, this.orgId, storeId);
|
|
113
107
|
this.accounting_service = new accounting_service_1.AccountingService(this.endpoints.accounting_service, this.orgId, storeId);
|
|
114
108
|
this.quicklab_service = new quicklab_service_1.QuicklabService(this.endpoints.quicklab_service, this.orgId, storeId);
|
|
115
|
-
this.remote_access_service = new remote_access_service_1.RemoteAccessService(this.endpoints.remote_access_service, this.orgId, storeId);
|
|
116
|
-
this.storage_s3 = new storage_s3_1.StorageS3Service(this.endpoints.storage_s3, this.orgId, storeId);
|
|
117
109
|
}
|
|
118
110
|
}
|
|
119
111
|
exports.SDK = SDK;
|
|
@@ -11,7 +11,6 @@ export declare class CloudService extends Service {
|
|
|
11
11
|
setToken(token: string): void;
|
|
12
12
|
setStoreId(storeId: string): void;
|
|
13
13
|
serviceDetail(serviceId: string): Promise<any>;
|
|
14
|
-
serviceDetailDynamic(serviceId: string, fields: string[]): Promise<any>;
|
|
15
14
|
updateServiceCompleted(serviceId: string, handleBy: string): Promise<any>;
|
|
16
15
|
updateServiceNew(serviceId: string, handleBy: string): Promise<any>;
|
|
17
16
|
updateServiceReadyDeploy(serviceId: string, handleBy: string): Promise<any>;
|
|
@@ -45,22 +45,6 @@ class CloudService extends serviceSDK_1.Service {
|
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
serviceDetailDynamic(serviceId, fields) {
|
|
49
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
const query = (0, queries_1.SERVICE_DETAIL_DYNAMIC)(fields);
|
|
51
|
-
const variables = {
|
|
52
|
-
serviceId,
|
|
53
|
-
};
|
|
54
|
-
try {
|
|
55
|
-
const response = yield this.graphqlQueryV2(query, variables);
|
|
56
|
-
return response.serviceDetail;
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
console.log(`Error in serviceDetailDynamic: ${error}`);
|
|
60
|
-
throw error;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
48
|
updateServiceCompleted(serviceId, handleBy) {
|
|
65
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
50
|
const mutation = mutations_1.UPDATE_SERVICE_COMPLETED;
|
|
@@ -15,5 +15,4 @@ 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>;
|
|
19
18
|
}
|
|
@@ -258,22 +258,5 @@ 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
|
-
}
|
|
278
261
|
}
|
|
279
262
|
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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FileInfoInput
|
|
1
|
+
import { FileInfoInput } from '../../types/storage_s3';
|
|
2
2
|
import { Service } from '../serviceSDK';
|
|
3
3
|
export declare class StorageS3Service extends Service {
|
|
4
4
|
constructor(endpoint: string, orgId: string, storeId: string);
|
|
@@ -21,8 +21,6 @@ export declare class StorageS3Service extends Service {
|
|
|
21
21
|
updateAclPermissionBucket(s3UserId: string, bucketId: string, isPublic: boolean, updateBy: string, fields: string[]): Promise<any>;
|
|
22
22
|
updateBucketVersioning(s3UserId: string, bucketId: string, isOn: boolean, updateBy: string, fields: string[]): Promise<any>;
|
|
23
23
|
getListFileTrash(s3UserId: string, bucketId: string, fields: string[]): Promise<any>;
|
|
24
|
-
restoreFileTrash(s3UserId: string, bucketId: string, key: string, versionId: string, fields: string[]): Promise<any>;
|
|
25
|
-
removeFileTrash(s3UserId: string, bucketId: string, files: [FileTrashInput], fields: string[]): Promise<any>;
|
|
26
24
|
getListS3DomainByS3UserId(s3UserId: string, fields: string[]): Promise<any>;
|
|
27
25
|
addS3Domain(s3UserId: string, domain: string, byUser: string, fields: string[]): Promise<any>;
|
|
28
26
|
removeS3Domain(s3UserId: string, domainId: string, byUser: string, fields: string[]): Promise<any>;
|
|
@@ -30,8 +28,5 @@ export declare class StorageS3Service extends Service {
|
|
|
30
28
|
addCorsBucket(s3UserId: string, bucketId: string, allowedMethods: string[], allowedOrigins: string[], allowedHeaders: string[], exposeHeaders: string[], maxAgeSeconds: number, updateBy: string, fields: string[]): Promise<any>;
|
|
31
29
|
updateCorsBucket(s3UserId: string, bucketId: string, corsId: string, allowedMethods: string[], allowedOrigins: string[], allowedHeaders: string[], exposeHeaders: string[], maxAgeSeconds: number, updateBy: string, fields: string[]): Promise<any>;
|
|
32
30
|
removeCorsBucket(s3UserId: string, bucketId: string, corsId: string, updateBy: string, fields: string[]): Promise<any>;
|
|
33
|
-
|
|
34
|
-
restoreFileOtherVersion(s3UserId: string, bucketId: string, key: string, versionId: string, fields: string[]): Promise<any>;
|
|
35
|
-
removeFileOtherVersion(s3UserId: string, bucketId: string, key: string, versionId: string, fields: string[]): Promise<any>;
|
|
36
|
-
chartInYear(s3UserId: string, year: number, month: number, fields: string[]): Promise<any>;
|
|
31
|
+
chartInYear(s3UserId: string, year: number, fields: string[]): Promise<any>;
|
|
37
32
|
}
|
|
@@ -367,43 +367,6 @@ class StorageS3Service extends serviceSDK_1.Service {
|
|
|
367
367
|
}
|
|
368
368
|
});
|
|
369
369
|
}
|
|
370
|
-
restoreFileTrash(s3UserId, bucketId, key, versionId, fields) {
|
|
371
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
372
|
-
const mutation = (0, mutations_1.RESTORE_FILE_TRASH)(fields);
|
|
373
|
-
const variables = {
|
|
374
|
-
s3UserId,
|
|
375
|
-
bucketId,
|
|
376
|
-
key,
|
|
377
|
-
versionId
|
|
378
|
-
};
|
|
379
|
-
try {
|
|
380
|
-
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
381
|
-
return response.restoreFileTrash;
|
|
382
|
-
}
|
|
383
|
-
catch (error) {
|
|
384
|
-
console.log(`Error in restoreFileTrash: ${error}`);
|
|
385
|
-
throw error;
|
|
386
|
-
}
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
removeFileTrash(s3UserId, bucketId, files, fields) {
|
|
390
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
391
|
-
const mutation = (0, mutations_1.REMOVE_FILE_TRASH)(fields);
|
|
392
|
-
const variables = {
|
|
393
|
-
s3UserId,
|
|
394
|
-
bucketId,
|
|
395
|
-
files
|
|
396
|
-
};
|
|
397
|
-
try {
|
|
398
|
-
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
399
|
-
return response.removeFileTrash;
|
|
400
|
-
}
|
|
401
|
-
catch (error) {
|
|
402
|
-
console.log(`Error in removeFileTrash: ${error}`);
|
|
403
|
-
throw error;
|
|
404
|
-
}
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
370
|
getListS3DomainByS3UserId(s3UserId, fields) {
|
|
408
371
|
return __awaiter(this, void 0, void 0, function* () {
|
|
409
372
|
const query = (0, queries_1.GET_LIST_S3_DOMAIN_BY_S3_USER_ID)(fields);
|
|
@@ -539,69 +502,12 @@ class StorageS3Service extends serviceSDK_1.Service {
|
|
|
539
502
|
}
|
|
540
503
|
});
|
|
541
504
|
}
|
|
542
|
-
|
|
543
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
544
|
-
const query = (0, queries_1.GET_LIST_FILE_OTHER_VERSION)(fields);
|
|
545
|
-
const variables = {
|
|
546
|
-
s3UserId,
|
|
547
|
-
bucketId,
|
|
548
|
-
key,
|
|
549
|
-
};
|
|
550
|
-
try {
|
|
551
|
-
const response = yield this.graphqlQueryV2(query, variables);
|
|
552
|
-
return response.getListFileOtherVersion;
|
|
553
|
-
}
|
|
554
|
-
catch (error) {
|
|
555
|
-
console.log(`Error in getListFileOtherVersion: ${error}`);
|
|
556
|
-
throw error;
|
|
557
|
-
}
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
restoreFileOtherVersion(s3UserId, bucketId, key, versionId, fields) {
|
|
561
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
562
|
-
const mutation = (0, mutations_1.RESTORE_FILE_OTHER_VERSION)(fields);
|
|
563
|
-
const variables = {
|
|
564
|
-
s3UserId,
|
|
565
|
-
bucketId,
|
|
566
|
-
key,
|
|
567
|
-
versionId
|
|
568
|
-
};
|
|
569
|
-
try {
|
|
570
|
-
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
571
|
-
return response.restoreFileOtherVersion;
|
|
572
|
-
}
|
|
573
|
-
catch (error) {
|
|
574
|
-
console.log(`Error in restoreFileOtherVersion: ${error}`);
|
|
575
|
-
throw error;
|
|
576
|
-
}
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
removeFileOtherVersion(s3UserId, bucketId, key, versionId, fields) {
|
|
580
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
581
|
-
const mutation = (0, mutations_1.REMOVE_FILE_OTHER_VERSION)(fields);
|
|
582
|
-
const variables = {
|
|
583
|
-
s3UserId,
|
|
584
|
-
bucketId,
|
|
585
|
-
key,
|
|
586
|
-
versionId
|
|
587
|
-
};
|
|
588
|
-
try {
|
|
589
|
-
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
590
|
-
return response.removeFileOtherVersion;
|
|
591
|
-
}
|
|
592
|
-
catch (error) {
|
|
593
|
-
console.log(`Error in removeFileOtherVersion: ${error}`);
|
|
594
|
-
throw error;
|
|
595
|
-
}
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
chartInYear(s3UserId, year, month, fields) {
|
|
505
|
+
chartInYear(s3UserId, year, fields) {
|
|
599
506
|
return __awaiter(this, void 0, void 0, function* () {
|
|
600
507
|
const query = (0, queries_1.CHART_IN_YEAR)(fields);
|
|
601
508
|
const variables = {
|
|
602
509
|
s3UserId,
|
|
603
|
-
year
|
|
604
|
-
month
|
|
510
|
+
year
|
|
605
511
|
};
|
|
606
512
|
try {
|
|
607
513
|
const response = yield this.graphqlQueryV2(query, variables);
|
|
@@ -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;
|