@longvansoftware/service-js-client 1.16.3 → 1.16.5
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/cloud/mutations.d.ts +23 -20
- package/dist/src/graphql/cloud/mutations.js +55 -1
- package/dist/src/graphql/crm/queries.d.ts +17 -14
- package/dist/src/graphql/crm/queries.js +37 -1
- package/dist/src/graphql/product/queries.d.ts +1 -0
- package/dist/src/graphql/product/queries.js +14 -1
- package/dist/src/lib/cloud/index.d.ts +2 -0
- package/dist/src/lib/cloud/index.js +38 -0
- package/dist/src/lib/crm/index.d.ts +2 -0
- package/dist/src/lib/crm/index.js +34 -0
- package/dist/src/lib/product/index.d.ts +1 -0
- package/dist/src/lib/product/index.js +16 -0
- package/package.json +1 -1
- package/dist/src/lib/service.d.ts +0 -14
- package/dist/src/lib/service.js +0 -101
- package/dist/src/utils/build-field-string.d.ts +0 -1
- package/dist/src/utils/build-field-string.js +0 -16
@@ -1,20 +1,23 @@
|
|
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
|
1
|
+
import { DocumentNode } from "graphql";
|
2
|
+
export declare const GET_DOMAIN_INFO: DocumentNode;
|
3
|
+
export declare const CHECK_LIST_DOMAIN_NAME: DocumentNode;
|
4
|
+
export declare const CHECK_DOMAIN_NAME: DocumentNode;
|
5
|
+
export declare const CHANGE_SERVICE_NAME: DocumentNode;
|
6
|
+
export declare const CREATE_USER_MAIL_HOSTING: DocumentNode;
|
7
|
+
export declare const DELETE_USER_MAIL_HOSTING: DocumentNode;
|
8
|
+
export declare const UPDATE_DOMAIN_NAME: DocumentNode;
|
9
|
+
export declare const UPDATE_USER_NAME: DocumentNode;
|
10
|
+
export declare const UPDATE_PASSWORD: DocumentNode;
|
11
|
+
export declare const UPDATE_USER_PASSWORD: DocumentNode;
|
12
|
+
export declare const UPDATE_DNS: DocumentNode;
|
13
|
+
export declare const CREATE_DOMAIN_CONTACT: DocumentNode;
|
14
|
+
export declare const GET_ORDER_CHANGE_RESOURCE_TERM: DocumentNode;
|
15
|
+
export declare const CREATE_ACTION_CHANGE_IP_OF_SERVICE: DocumentNode;
|
16
|
+
export declare const UPDATE_ACTION_STATUS: DocumentNode;
|
17
|
+
export declare const UPDATE_ACTION_CUSTOM_ATTRIBUTE: DocumentNode;
|
18
|
+
export declare const UPDATE_SERVICE_COMPLETED: DocumentNode;
|
19
|
+
export declare const UPDATE_SERVICE_NEW: DocumentNode;
|
20
|
+
export declare const UPDATE_SERVICE_READY_DEPLOY: DocumentNode;
|
21
|
+
export declare const UPDATE_URL_PUBLIC: DocumentNode;
|
22
|
+
export declare const CHECK_ENTERPRISE_BY_TAX_CODE_DYNAMIC: (fields?: string[]) => DocumentNode;
|
23
|
+
export declare const CHECK_BUSINESS_BY_TAX_CODE_DYNAMIC: (fields?: string[]) => DocumentNode;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.UPDATE_URL_PUBLIC = exports.UPDATE_SERVICE_READY_DEPLOY = exports.UPDATE_SERVICE_NEW = exports.UPDATE_SERVICE_COMPLETED = exports.UPDATE_ACTION_CUSTOM_ATTRIBUTE = exports.UPDATE_ACTION_STATUS = exports.CREATE_ACTION_CHANGE_IP_OF_SERVICE = exports.GET_ORDER_CHANGE_RESOURCE_TERM = exports.CREATE_DOMAIN_CONTACT = exports.UPDATE_DNS = exports.UPDATE_USER_PASSWORD = exports.UPDATE_PASSWORD = exports.UPDATE_USER_NAME = exports.UPDATE_DOMAIN_NAME = exports.DELETE_USER_MAIL_HOSTING = exports.CREATE_USER_MAIL_HOSTING = exports.CHANGE_SERVICE_NAME = exports.CHECK_DOMAIN_NAME = exports.CHECK_LIST_DOMAIN_NAME = exports.GET_DOMAIN_INFO = void 0;
|
3
|
+
exports.CHECK_BUSINESS_BY_TAX_CODE_DYNAMIC = exports.CHECK_ENTERPRISE_BY_TAX_CODE_DYNAMIC = exports.UPDATE_URL_PUBLIC = exports.UPDATE_SERVICE_READY_DEPLOY = exports.UPDATE_SERVICE_NEW = exports.UPDATE_SERVICE_COMPLETED = exports.UPDATE_ACTION_CUSTOM_ATTRIBUTE = exports.UPDATE_ACTION_STATUS = exports.CREATE_ACTION_CHANGE_IP_OF_SERVICE = exports.GET_ORDER_CHANGE_RESOURCE_TERM = exports.CREATE_DOMAIN_CONTACT = exports.UPDATE_DNS = exports.UPDATE_USER_PASSWORD = exports.UPDATE_PASSWORD = exports.UPDATE_USER_NAME = exports.UPDATE_DOMAIN_NAME = exports.DELETE_USER_MAIL_HOSTING = exports.CREATE_USER_MAIL_HOSTING = exports.CHANGE_SERVICE_NAME = exports.CHECK_DOMAIN_NAME = exports.CHECK_LIST_DOMAIN_NAME = exports.GET_DOMAIN_INFO = void 0;
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
5
5
|
exports.GET_DOMAIN_INFO = (0, graphql_tag_1.gql) `
|
6
6
|
mutation GetDomainInfo($domainName: String!) {
|
@@ -304,3 +304,57 @@ exports.UPDATE_URL_PUBLIC = (0, graphql_tag_1.gql) `
|
|
304
304
|
)
|
305
305
|
}
|
306
306
|
`;
|
307
|
+
const CHECK_ENTERPRISE_BY_TAX_CODE_DYNAMIC = (fields = []) => {
|
308
|
+
const fieldStr = fields.join("\n ");
|
309
|
+
const hasFields = fields.length > 0;
|
310
|
+
return (0, graphql_tag_1.gql) `
|
311
|
+
mutation CheckEnterpriseByTaxCode(
|
312
|
+
$domainName: String!
|
313
|
+
$taxCode: String!
|
314
|
+
$checkPromotion: Boolean!
|
315
|
+
$domainResumeId: String
|
316
|
+
) {
|
317
|
+
checkEnterpriseByTaxCode(
|
318
|
+
domainName: $domainName
|
319
|
+
taxCode: $taxCode
|
320
|
+
checkPromotion: $checkPromotion
|
321
|
+
domainResumeId: $domainResumeId
|
322
|
+
) {
|
323
|
+
success
|
324
|
+
message
|
325
|
+
promotionCode
|
326
|
+
data {
|
327
|
+
${hasFields ? `${fieldStr}` : ""}
|
328
|
+
}
|
329
|
+
}
|
330
|
+
}
|
331
|
+
`;
|
332
|
+
};
|
333
|
+
exports.CHECK_ENTERPRISE_BY_TAX_CODE_DYNAMIC = CHECK_ENTERPRISE_BY_TAX_CODE_DYNAMIC;
|
334
|
+
const CHECK_BUSINESS_BY_TAX_CODE_DYNAMIC = (fields = []) => {
|
335
|
+
const fieldStr = fields.join("\n ");
|
336
|
+
const hasFields = fields.length > 0;
|
337
|
+
return (0, graphql_tag_1.gql) `
|
338
|
+
mutation CheckBusinessByTaxCode(
|
339
|
+
$domainName: String!
|
340
|
+
$taxCode: String!
|
341
|
+
$checkPromotion: Boolean!
|
342
|
+
$domainResumeId: String
|
343
|
+
) {
|
344
|
+
checkBusinessByTaxCode(
|
345
|
+
domainName: $domainName
|
346
|
+
taxCode: $taxCode
|
347
|
+
checkPromotion: $checkPromotion
|
348
|
+
domainResumeId: $domainResumeId
|
349
|
+
) {
|
350
|
+
success
|
351
|
+
message
|
352
|
+
promotionCode
|
353
|
+
data {
|
354
|
+
${hasFields ? `${fieldStr}` : ""}
|
355
|
+
}
|
356
|
+
}
|
357
|
+
}
|
358
|
+
`;
|
359
|
+
};
|
360
|
+
exports.CHECK_BUSINESS_BY_TAX_CODE_DYNAMIC = CHECK_BUSINESS_BY_TAX_CODE_DYNAMIC;
|
@@ -1,14 +1,17 @@
|
|
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
|
1
|
+
import { DocumentNode } from "graphql";
|
2
|
+
export declare const GET_LIST_OPPORTUNITY_QUERY: DocumentNode;
|
3
|
+
export declare const GET_LIST_TODO: DocumentNode;
|
4
|
+
export declare const GET_LIST_WORK_EFFORT_TYPE: DocumentNode;
|
5
|
+
export declare const GET_LIST_TICKET: DocumentNode;
|
6
|
+
export declare const GET_LIST_TICKET_DYNAMIC: (fields?: string[]) => DocumentNode;
|
7
|
+
export declare const GET_TICKET_BY_ID: DocumentNode;
|
8
|
+
export declare const GET_LIST_TICKET_BY_ID_DYNAMIC: (fields?: string[]) => DocumentNode;
|
9
|
+
export declare const GET_ATTACHMENT_BY_WORK_EFFORT_ID: DocumentNode;
|
10
|
+
export declare const GET_LIST_COMMENT: DocumentNode;
|
11
|
+
export declare const GET_RESUME_ID_BY_RESOURCE: DocumentNode;
|
12
|
+
export declare const GET_RESUME_CONTACT: DocumentNode;
|
13
|
+
export declare const GET_REUSME_BY_CUSTOMER_ID: DocumentNode;
|
14
|
+
export declare const GET_RESUME_DOMAIN_BY_SERVICE_ID: DocumentNode;
|
15
|
+
export declare const GET_COLLEGES_BY_PROVINCE_ID: DocumentNode;
|
16
|
+
export declare const GET_RELATED_RESOURCE_BY_RESOURCE_TYPE: DocumentNode;
|
17
|
+
export declare const GET_RESUME_INFO_BY_CUSTOMER_ID: DocumentNode;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.GET_RESUME_INFO_BY_CUSTOMER_ID = exports.GET_RELATED_RESOURCE_BY_RESOURCE_TYPE = exports.GET_COLLEGES_BY_PROVINCE_ID = exports.GET_RESUME_DOMAIN_BY_SERVICE_ID = exports.GET_REUSME_BY_CUSTOMER_ID = exports.GET_RESUME_CONTACT = exports.GET_RESUME_ID_BY_RESOURCE = exports.GET_LIST_COMMENT = exports.GET_ATTACHMENT_BY_WORK_EFFORT_ID = exports.GET_TICKET_BY_ID = exports.GET_LIST_TICKET = exports.GET_LIST_WORK_EFFORT_TYPE = exports.GET_LIST_TODO = exports.GET_LIST_OPPORTUNITY_QUERY = void 0;
|
3
|
+
exports.GET_RESUME_INFO_BY_CUSTOMER_ID = exports.GET_RELATED_RESOURCE_BY_RESOURCE_TYPE = exports.GET_COLLEGES_BY_PROVINCE_ID = exports.GET_RESUME_DOMAIN_BY_SERVICE_ID = exports.GET_REUSME_BY_CUSTOMER_ID = exports.GET_RESUME_CONTACT = exports.GET_RESUME_ID_BY_RESOURCE = exports.GET_LIST_COMMENT = exports.GET_ATTACHMENT_BY_WORK_EFFORT_ID = exports.GET_LIST_TICKET_BY_ID_DYNAMIC = exports.GET_TICKET_BY_ID = exports.GET_LIST_TICKET_DYNAMIC = exports.GET_LIST_TICKET = exports.GET_LIST_WORK_EFFORT_TYPE = exports.GET_LIST_TODO = exports.GET_LIST_OPPORTUNITY_QUERY = void 0;
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
5
5
|
exports.GET_LIST_OPPORTUNITY_QUERY = (0, graphql_tag_1.gql) `
|
6
6
|
query GetListOpportunity(
|
@@ -198,6 +198,30 @@ exports.GET_LIST_TICKET = (0, graphql_tag_1.gql) `
|
|
198
198
|
}
|
199
199
|
}
|
200
200
|
`;
|
201
|
+
const GET_LIST_TICKET_DYNAMIC = (fields = []) => {
|
202
|
+
const fieldStr = fields.join("\n ");
|
203
|
+
const hasFields = fields.length > 0;
|
204
|
+
return (0, graphql_tag_1.gql) `
|
205
|
+
query GetListTicket(
|
206
|
+
$partyId: String!
|
207
|
+
$performerId: String!
|
208
|
+
$getTicketRequest: GetTicketRequest!
|
209
|
+
) {
|
210
|
+
getListTicket(
|
211
|
+
partyId: $partyId
|
212
|
+
performerId: $performerId
|
213
|
+
getTicketRequest: $getTicketRequest
|
214
|
+
)
|
215
|
+
{
|
216
|
+
total
|
217
|
+
data {
|
218
|
+
${hasFields ? `${fieldStr}` : ""}
|
219
|
+
}
|
220
|
+
}
|
221
|
+
}
|
222
|
+
`;
|
223
|
+
};
|
224
|
+
exports.GET_LIST_TICKET_DYNAMIC = GET_LIST_TICKET_DYNAMIC;
|
201
225
|
exports.GET_TICKET_BY_ID = (0, graphql_tag_1.gql) `
|
202
226
|
query GetTicketById($ticketId: String!) {
|
203
227
|
getTicketById(ticketId: $ticketId) {
|
@@ -226,6 +250,18 @@ exports.GET_TICKET_BY_ID = (0, graphql_tag_1.gql) `
|
|
226
250
|
}
|
227
251
|
}
|
228
252
|
`;
|
253
|
+
const GET_LIST_TICKET_BY_ID_DYNAMIC = (fields = []) => {
|
254
|
+
const fieldStr = fields.join("\n ");
|
255
|
+
const hasFields = fields.length > 0;
|
256
|
+
return (0, graphql_tag_1.gql) `
|
257
|
+
query GetTicketById($ticketId: String!) {
|
258
|
+
getTicketById(ticketId: $ticketId) {
|
259
|
+
${hasFields ? `${fieldStr}` : ""}
|
260
|
+
}
|
261
|
+
}
|
262
|
+
`;
|
263
|
+
};
|
264
|
+
exports.GET_LIST_TICKET_BY_ID_DYNAMIC = GET_LIST_TICKET_BY_ID_DYNAMIC;
|
229
265
|
exports.GET_ATTACHMENT_BY_WORK_EFFORT_ID = (0, graphql_tag_1.gql) `
|
230
266
|
query GetAttachmentByWorkEffortId(
|
231
267
|
$partyId: String!
|
@@ -23,3 +23,4 @@ export declare const GET_LIST_PRICE: DocumentNode;
|
|
23
23
|
export declare const GET_TAGS: DocumentNode;
|
24
24
|
export declare const GET_TAGS_BY_CATEGORY: DocumentNode;
|
25
25
|
export declare const GET_LIST_PRODUCTS_CONFIG_DYNAMIC: (fields?: string[]) => DocumentNode;
|
26
|
+
export declare const GET_CATEGORIES: DocumentNode;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.GET_LIST_PRODUCTS_CONFIG_DYNAMIC = exports.GET_TAGS_BY_CATEGORY = exports.GET_TAGS = exports.GET_LIST_PRICE = exports.GET_DETAIL_STORES = exports.GET_RELATED_INFOR = exports.GET_PRODUCT_VARIANT_BY_ID_QUERY_DYNAMIC = exports.GET_PRODUCT_VARIANT_BY_ID = exports.GET_RESOURCE_BY_PRODUCT = exports.GET_HANDLE_BY_SERVICETYPE = exports.GET_PRODUCTS_DYNAMIC = exports.GET_PRODUCTS = exports.GET_POLICY = exports.GET_PRODUCT_OPTION = exports.GET_BRAND_DETAIL_QUERY = exports.GET_BRANDS_BY_CATEGORY_QUERY = exports.GET_BRANDS_QUERY = exports.GET_CATEGORY_BY_ID_QUERY = exports.GET_CATEGORY_BY_HANDLE_QUERY = exports.GET_CATEGORIES_QUERY = exports.GET_SIMPLE_PRODUCTS_QUERY = exports.GET_PRODUCT_BY_SLUG_QUERY = exports.GET_PRODUCT_BY_ID_QUERY_DYNAMIC = exports.GET_PRODUCT_BY_ID_QUERY = void 0;
|
3
|
+
exports.GET_CATEGORIES = exports.GET_LIST_PRODUCTS_CONFIG_DYNAMIC = exports.GET_TAGS_BY_CATEGORY = exports.GET_TAGS = exports.GET_LIST_PRICE = exports.GET_DETAIL_STORES = exports.GET_RELATED_INFOR = exports.GET_PRODUCT_VARIANT_BY_ID_QUERY_DYNAMIC = exports.GET_PRODUCT_VARIANT_BY_ID = exports.GET_RESOURCE_BY_PRODUCT = exports.GET_HANDLE_BY_SERVICETYPE = exports.GET_PRODUCTS_DYNAMIC = exports.GET_PRODUCTS = exports.GET_POLICY = exports.GET_PRODUCT_OPTION = exports.GET_BRAND_DETAIL_QUERY = exports.GET_BRANDS_BY_CATEGORY_QUERY = exports.GET_BRANDS_QUERY = exports.GET_CATEGORY_BY_ID_QUERY = exports.GET_CATEGORY_BY_HANDLE_QUERY = exports.GET_CATEGORIES_QUERY = exports.GET_SIMPLE_PRODUCTS_QUERY = exports.GET_PRODUCT_BY_SLUG_QUERY = exports.GET_PRODUCT_BY_ID_QUERY_DYNAMIC = exports.GET_PRODUCT_BY_ID_QUERY = void 0;
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
5
5
|
// export const GET_PRODUCT_BY_ID_QUERY = gql`
|
6
6
|
// query GetProductById(
|
@@ -1036,3 +1036,16 @@ const GET_LIST_PRODUCTS_CONFIG_DYNAMIC = (fields = []) => {
|
|
1036
1036
|
`;
|
1037
1037
|
};
|
1038
1038
|
exports.GET_LIST_PRODUCTS_CONFIG_DYNAMIC = GET_LIST_PRODUCTS_CONFIG_DYNAMIC;
|
1039
|
+
exports.GET_CATEGORIES = (0, graphql_tag_1.gql) `
|
1040
|
+
query GetCategories($partnerId: String!, $storeChannel: String!) {
|
1041
|
+
getCategories(partnerId: $partnerId, storeChannel: $storeChannel) {
|
1042
|
+
id
|
1043
|
+
title
|
1044
|
+
image
|
1045
|
+
icon
|
1046
|
+
parentId
|
1047
|
+
level
|
1048
|
+
handle
|
1049
|
+
}
|
1050
|
+
}
|
1051
|
+
`;
|
@@ -43,6 +43,8 @@ export declare class CloudService extends Service {
|
|
43
43
|
getDomainInfo(domainName: string): Promise<any>;
|
44
44
|
getDomainSupplier(serviceId: string): Promise<any>;
|
45
45
|
checkDomainExist(domainName: string): Promise<any>;
|
46
|
+
checkEnterpriseByTaxCodeDynamic(domainName: string, taxCode: string, checkPromotion: boolean, domainResumeId: string | null, fields: string[]): Promise<any>;
|
47
|
+
checkBusinessByTaxCodeDynamic(domainName: string, taxCode: string, checkPromotion: boolean, domainResumeId: string | null, fields: string[]): Promise<any>;
|
46
48
|
getOrderChangeResourceTerm(serviceId: string, createdBy: string): Promise<any>;
|
47
49
|
searchActions(parameter: any): Promise<any>;
|
48
50
|
createActionChangeIpOfService(action: any, byUser: string): Promise<any>;
|
@@ -591,6 +591,44 @@ class CloudService extends serviceSDK_1.Service {
|
|
591
591
|
}
|
592
592
|
});
|
593
593
|
}
|
594
|
+
checkEnterpriseByTaxCodeDynamic(domainName, taxCode, checkPromotion, domainResumeId, fields) {
|
595
|
+
return __awaiter(this, void 0, void 0, function* () {
|
596
|
+
const mutation = (0, mutations_1.CHECK_ENTERPRISE_BY_TAX_CODE_DYNAMIC)(fields);
|
597
|
+
const variables = {
|
598
|
+
domainName,
|
599
|
+
taxCode,
|
600
|
+
checkPromotion,
|
601
|
+
domainResumeId
|
602
|
+
};
|
603
|
+
try {
|
604
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
605
|
+
return response.checkEnterpriseByTaxCode;
|
606
|
+
}
|
607
|
+
catch (error) {
|
608
|
+
console.log(`Error in checkEnterpriseByTaxCodeDynamic: ${error}`);
|
609
|
+
throw error;
|
610
|
+
}
|
611
|
+
});
|
612
|
+
}
|
613
|
+
checkBusinessByTaxCodeDynamic(domainName, taxCode, checkPromotion, domainResumeId, fields) {
|
614
|
+
return __awaiter(this, void 0, void 0, function* () {
|
615
|
+
const mutation = (0, mutations_1.CHECK_BUSINESS_BY_TAX_CODE_DYNAMIC)(fields);
|
616
|
+
const variables = {
|
617
|
+
domainName,
|
618
|
+
taxCode,
|
619
|
+
checkPromotion,
|
620
|
+
domainResumeId
|
621
|
+
};
|
622
|
+
try {
|
623
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
624
|
+
return response.checkBusinessByTaxCode;
|
625
|
+
}
|
626
|
+
catch (error) {
|
627
|
+
console.log(`Error in checkBusinessByTaxCodeDynamic: ${error}`);
|
628
|
+
throw error;
|
629
|
+
}
|
630
|
+
});
|
631
|
+
}
|
594
632
|
getOrderChangeResourceTerm(serviceId, createdBy) {
|
595
633
|
return __awaiter(this, void 0, void 0, function* () {
|
596
634
|
const mutation = mutations_1.GET_ORDER_CHANGE_RESOURCE_TERM;
|
@@ -14,8 +14,10 @@ export declare class CrmService extends Service {
|
|
14
14
|
updateWorkEffortStatus(performerId: string, workEffortId: string, source: string, status: string): Promise<any>;
|
15
15
|
addAttachmentForWorkEffort(performerId: string, workEffortId: string, attachments: [{}]): Promise<any>;
|
16
16
|
getListTicket(performerId: string, getTicketRequest: getTicketRequest): Promise<any>;
|
17
|
+
getListTicketDynamic(performerId: string, getTicketRequest: getTicketRequest, fields: string[]): Promise<any>;
|
17
18
|
addTicket(performerId: string, addTicketRequest: AddTicketRequest, addAttachmentRequest: [AddAttachmentRequest]): Promise<any>;
|
18
19
|
getTicketById(ticketId: string): Promise<any>;
|
20
|
+
getTicketByIdDynamic(ticketId: string, fields: string[]): Promise<any>;
|
19
21
|
getAttachmentByWorkEffortId(workEffortIds: [string]): Promise<any>;
|
20
22
|
getListComment(getCommentRequest: GetCommentRequest): Promise<any>;
|
21
23
|
addComment(params: any): Promise<any>;
|
@@ -205,6 +205,24 @@ class CrmService extends serviceSDK_1.Service {
|
|
205
205
|
}
|
206
206
|
});
|
207
207
|
}
|
208
|
+
getListTicketDynamic(performerId, getTicketRequest, fields) {
|
209
|
+
return __awaiter(this, void 0, void 0, function* () {
|
210
|
+
const query = (0, queries_1.GET_LIST_TICKET_DYNAMIC)(fields);
|
211
|
+
const variables = {
|
212
|
+
partyId: this.orgId,
|
213
|
+
performerId,
|
214
|
+
getTicketRequest,
|
215
|
+
};
|
216
|
+
try {
|
217
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
218
|
+
return response.getListTicket;
|
219
|
+
}
|
220
|
+
catch (error) {
|
221
|
+
console.log(`Error fetching get getListTicketDynamic method: ${error}`);
|
222
|
+
throw error;
|
223
|
+
}
|
224
|
+
});
|
225
|
+
}
|
208
226
|
addTicket(performerId, addTicketRequest, addAttachmentRequest) {
|
209
227
|
return __awaiter(this, void 0, void 0, function* () {
|
210
228
|
const mutation = mutations_1.ADD_TICKED;
|
@@ -240,6 +258,22 @@ class CrmService extends serviceSDK_1.Service {
|
|
240
258
|
}
|
241
259
|
});
|
242
260
|
}
|
261
|
+
getTicketByIdDynamic(ticketId, fields) {
|
262
|
+
return __awaiter(this, void 0, void 0, function* () {
|
263
|
+
const query = (0, queries_1.GET_LIST_TICKET_BY_ID_DYNAMIC)(fields);
|
264
|
+
const variables = {
|
265
|
+
ticketId,
|
266
|
+
};
|
267
|
+
try {
|
268
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
269
|
+
return response.getTicketById;
|
270
|
+
}
|
271
|
+
catch (error) {
|
272
|
+
console.log(`Error in getTicketByIdDynamic: ${error}`);
|
273
|
+
throw error;
|
274
|
+
}
|
275
|
+
});
|
276
|
+
}
|
243
277
|
getAttachmentByWorkEffortId(workEffortIds) {
|
244
278
|
return __awaiter(this, void 0, void 0, function* () {
|
245
279
|
const query = queries_1.GET_ATTACHMENT_BY_WORK_EFFORT_ID;
|
@@ -50,4 +50,5 @@ export declare class ProductService extends Service {
|
|
50
50
|
getTags(storeId: string): Promise<any>;
|
51
51
|
getTagsByCategory(categoryId: string, storeId: string): Promise<any>;
|
52
52
|
getListProductConfigDynamic(productId: string, store: string, fields: string[]): Promise<any>;
|
53
|
+
getCategories(): Promise<any>;
|
53
54
|
}
|
@@ -353,5 +353,21 @@ class ProductService extends serviceSDK_1.Service {
|
|
353
353
|
}
|
354
354
|
});
|
355
355
|
}
|
356
|
+
getCategories() {
|
357
|
+
return __awaiter(this, void 0, void 0, function* () {
|
358
|
+
const query = queries_1.GET_CATEGORIES;
|
359
|
+
const variables = {
|
360
|
+
partnerId: this.orgId,
|
361
|
+
storeChannel: this.storeId,
|
362
|
+
};
|
363
|
+
try {
|
364
|
+
const response = yield this.graphqlQuery(query, variables);
|
365
|
+
return response.getCategories;
|
366
|
+
}
|
367
|
+
catch (error) {
|
368
|
+
throw error;
|
369
|
+
}
|
370
|
+
});
|
371
|
+
}
|
356
372
|
}
|
357
373
|
exports.ProductService = ProductService;
|
package/package.json
CHANGED
@@ -1,14 +0,0 @@
|
|
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
|
-
}
|
package/dist/src/lib/service.js
DELETED
@@ -1,101 +0,0 @@
|
|
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 +0,0 @@
|
|
1
|
-
export declare function buildFieldString(fields: (string | Record<string, any>)[], indent?: number): string;
|
@@ -1,16 +0,0 @@
|
|
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;
|