@longvansoftware/service-js-client 1.20.9 → 2.1.1
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/auth/mutations.d.ts +19 -17
- package/dist/src/graphql/auth/mutations.js +13 -1
- package/dist/src/graphql/auth/queries.d.ts +10 -8
- package/dist/src/graphql/auth/queries.js +23 -3
- package/dist/src/graphql/orderGraphQL/mutations.d.ts +6 -4
- package/dist/src/graphql/orderGraphQL/mutations.js +11 -1
- package/dist/src/graphql/orderGraphQL/queries.d.ts +1 -0
- package/dist/src/graphql/orderGraphQL/queries.js +11 -1
- package/dist/src/graphql/user/queries.d.ts +19 -17
- package/dist/src/graphql/user/queries.js +12 -1
- package/dist/src/lib/auth/index.d.ts +3 -1
- package/dist/src/lib/auth/index.js +40 -3
- package/dist/src/lib/orderGraphQL/index.d.ts +2 -0
- package/dist/src/lib/orderGraphQL/index.js +39 -0
- package/dist/src/lib/service.d.ts +14 -0
- package/dist/src/lib/service.js +101 -0
- package/dist/src/lib/user/index.d.ts +1 -0
- package/dist/src/lib/user/index.js +19 -3
- 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
|
@@ -1,17 +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
|
|
1
|
+
import { DocumentNode } from "graphql";
|
|
2
|
+
export declare const LOGIN_MUTATION: DocumentNode;
|
|
3
|
+
export declare const REGISTER_MUTATION: DocumentNode;
|
|
4
|
+
export declare const SEND_SMS_VERIFY_CODE_MUTATION: DocumentNode;
|
|
5
|
+
export declare const VERIFY_CODE_MUTATION: DocumentNode;
|
|
6
|
+
export declare const RESET_PASSWORD_MUTATION: DocumentNode;
|
|
7
|
+
export declare const UPDATE_INFO_MUTATION: DocumentNode;
|
|
8
|
+
export declare const UPDATE_PASSWORD_MUTATION: DocumentNode;
|
|
9
|
+
export declare const LOGIN_v2: DocumentNode;
|
|
10
|
+
export declare const CREATE_RESET_KEY: DocumentNode;
|
|
11
|
+
export declare const CHECK_RESET_KEY: DocumentNode;
|
|
12
|
+
export declare const UPDATE_PROFILE: DocumentNode;
|
|
13
|
+
export declare const CREATE_USER_DETAIL: DocumentNode;
|
|
14
|
+
export declare const LINKING_USER_LOGIN_AND_USER_DETAIL: DocumentNode;
|
|
15
|
+
export declare const SEND_OTP: DocumentNode;
|
|
16
|
+
export declare const VALIDATE_OTP: DocumentNode;
|
|
17
|
+
export declare const CREATE_USER_LOGIN: DocumentNode;
|
|
18
|
+
export declare const CREATE_USER_DETAIL_WITHOUT_USER_LOGIN: DocumentNode;
|
|
19
|
+
export declare const GET_PARTY_DETAIL_BY_PHONE: (fields?: string[]) => DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CREATE_USER_DETAIL_WITHOUT_USER_LOGIN = exports.CREATE_USER_LOGIN = exports.VALIDATE_OTP = exports.SEND_OTP = exports.LINKING_USER_LOGIN_AND_USER_DETAIL = exports.CREATE_USER_DETAIL = exports.UPDATE_PROFILE = exports.CHECK_RESET_KEY = exports.CREATE_RESET_KEY = exports.LOGIN_v2 = exports.UPDATE_PASSWORD_MUTATION = exports.UPDATE_INFO_MUTATION = exports.RESET_PASSWORD_MUTATION = exports.VERIFY_CODE_MUTATION = exports.SEND_SMS_VERIFY_CODE_MUTATION = exports.REGISTER_MUTATION = exports.LOGIN_MUTATION = void 0;
|
|
3
|
+
exports.GET_PARTY_DETAIL_BY_PHONE = exports.CREATE_USER_DETAIL_WITHOUT_USER_LOGIN = exports.CREATE_USER_LOGIN = exports.VALIDATE_OTP = exports.SEND_OTP = exports.LINKING_USER_LOGIN_AND_USER_DETAIL = exports.CREATE_USER_DETAIL = exports.UPDATE_PROFILE = exports.CHECK_RESET_KEY = exports.CREATE_RESET_KEY = exports.LOGIN_v2 = exports.UPDATE_PASSWORD_MUTATION = exports.UPDATE_INFO_MUTATION = exports.RESET_PASSWORD_MUTATION = exports.VERIFY_CODE_MUTATION = exports.SEND_SMS_VERIFY_CODE_MUTATION = exports.REGISTER_MUTATION = exports.LOGIN_MUTATION = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.LOGIN_MUTATION = (0, graphql_tag_1.gql) `
|
|
6
6
|
mutation Login($loginRequest: LoginRequest!) {
|
|
@@ -238,3 +238,15 @@ exports.CREATE_USER_DETAIL_WITHOUT_USER_LOGIN = (0, graphql_tag_1.gql) `
|
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
`;
|
|
241
|
+
const GET_PARTY_DETAIL_BY_PHONE = (fields = []) => {
|
|
242
|
+
const fieldStr = fields.join("\n ");
|
|
243
|
+
const hasFields = fields.length > 0;
|
|
244
|
+
return (0, graphql_tag_1.gql) `
|
|
245
|
+
query createPartyDetail($name: String!, $phone: String!, $orgId: String!, $createdBy: String!, $source: String) {
|
|
246
|
+
createPartyDetail(name: $name ,phone: $phone, orgId: $orgId, createdBy: $createdBy, source: $source) {
|
|
247
|
+
${hasFields ? `${fieldStr}` : ""}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
`;
|
|
251
|
+
};
|
|
252
|
+
exports.GET_PARTY_DETAIL_BY_PHONE = GET_PARTY_DETAIL_BY_PHONE;
|
|
@@ -1,8 +1,10 @@
|
|
|
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
|
|
1
|
+
import { DocumentNode } from "graphql";
|
|
2
|
+
export declare const GET_USER_DETAIL: DocumentNode;
|
|
3
|
+
export declare const GET_USER_LOGIN_BY_TOKEN: DocumentNode;
|
|
4
|
+
export declare const GET_USER_LOGIN_BY_USER_LOGIN_ID: DocumentNode;
|
|
5
|
+
export declare const CHECK_USERNAME_EXISTED: DocumentNode;
|
|
6
|
+
export declare const GET_USER_LOGIN_BY_PARTY_ID: DocumentNode;
|
|
7
|
+
export declare const GET_PHONE_BY_PARTYID: DocumentNode;
|
|
8
|
+
export declare const GET_EMAIL_BY_PARTYID: DocumentNode;
|
|
9
|
+
export declare const GET_ACCESS_TOKEN_BY_OTP: DocumentNode;
|
|
10
|
+
export declare const GET_PARTY_DETAIL_BY_PHONE: (fields?: string[]) => DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_ACCESS_TOKEN_BY_OTP = exports.GET_EMAIL_BY_PARTYID = exports.GET_PHONE_BY_PARTYID = exports.GET_USER_LOGIN_BY_PARTY_ID = exports.CHECK_USERNAME_EXISTED = exports.GET_USER_LOGIN_BY_USER_LOGIN_ID = exports.GET_USER_LOGIN_BY_TOKEN = exports.GET_USER_DETAIL = void 0;
|
|
3
|
+
exports.GET_PARTY_DETAIL_BY_PHONE = exports.GET_ACCESS_TOKEN_BY_OTP = exports.GET_EMAIL_BY_PARTYID = exports.GET_PHONE_BY_PARTYID = exports.GET_USER_LOGIN_BY_PARTY_ID = exports.CHECK_USERNAME_EXISTED = exports.GET_USER_LOGIN_BY_USER_LOGIN_ID = exports.GET_USER_LOGIN_BY_TOKEN = exports.GET_USER_DETAIL = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.GET_USER_DETAIL = (0, graphql_tag_1.gql) `
|
|
6
6
|
query GetUserDetail($orgId: String!, $accessToken: String!) {
|
|
@@ -74,7 +74,27 @@ exports.GET_EMAIL_BY_PARTYID = (0, graphql_tag_1.gql) `
|
|
|
74
74
|
}
|
|
75
75
|
`;
|
|
76
76
|
exports.GET_ACCESS_TOKEN_BY_OTP = (0, graphql_tag_1.gql) `
|
|
77
|
-
query GetAccessTokenByOTP(
|
|
78
|
-
|
|
77
|
+
query GetAccessTokenByOTP(
|
|
78
|
+
$otpCode: String!
|
|
79
|
+
$phone: String!
|
|
80
|
+
$channelType: String
|
|
81
|
+
) {
|
|
82
|
+
getAccessTokenByOTP(
|
|
83
|
+
otpCode: $otpCode
|
|
84
|
+
phone: $phone
|
|
85
|
+
channelType: $channelType
|
|
86
|
+
)
|
|
79
87
|
}
|
|
80
88
|
`;
|
|
89
|
+
const GET_PARTY_DETAIL_BY_PHONE = (fields = []) => {
|
|
90
|
+
const fieldStr = fields.join("\n ");
|
|
91
|
+
const hasFields = fields.length > 0;
|
|
92
|
+
return (0, graphql_tag_1.gql) `
|
|
93
|
+
query GetPartyDetailByPhone($phone: String!, $orgId: String!) {
|
|
94
|
+
getPartyDetailByPhone(phone: $phone, orgId: $orgId) {
|
|
95
|
+
${hasFields ? `${fieldStr}` : ""}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
`;
|
|
99
|
+
};
|
|
100
|
+
exports.GET_PARTY_DETAIL_BY_PHONE = GET_PARTY_DETAIL_BY_PHONE;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
1
|
+
import { DocumentNode } from "graphql";
|
|
2
|
+
export declare const CREATE_ORDER: DocumentNode;
|
|
3
|
+
export declare const UPDATE_QUANTITY_V2: DocumentNode;
|
|
4
|
+
export declare const ADD_TO_CART: DocumentNode;
|
|
5
|
+
export declare const REMOVE_PRODUCT_OPTION_ORDER_LINE_ITEM: DocumentNode;
|
|
6
|
+
export declare const ADD_ITEM_INTO_ORDER_BY_PRODUCT_JSON_RESOURCE: (fields?: string[]) => DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.REMOVE_PRODUCT_OPTION_ORDER_LINE_ITEM = exports.ADD_TO_CART = exports.UPDATE_QUANTITY_V2 = exports.CREATE_ORDER = void 0;
|
|
3
|
+
exports.ADD_ITEM_INTO_ORDER_BY_PRODUCT_JSON_RESOURCE = exports.REMOVE_PRODUCT_OPTION_ORDER_LINE_ITEM = exports.ADD_TO_CART = exports.UPDATE_QUANTITY_V2 = exports.CREATE_ORDER = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.CREATE_ORDER = (0, graphql_tag_1.gql) `
|
|
6
6
|
mutation CreateOrder($input: CreateOrderInput!) {
|
|
@@ -360,3 +360,13 @@ exports.REMOVE_PRODUCT_OPTION_ORDER_LINE_ITEM = (0, graphql_tag_1.gql) `
|
|
|
360
360
|
)
|
|
361
361
|
}
|
|
362
362
|
`;
|
|
363
|
+
const ADD_ITEM_INTO_ORDER_BY_PRODUCT_JSON_RESOURCE = (fields = []) => {
|
|
364
|
+
const fieldStr = fields.join("\n ");
|
|
365
|
+
const hasFields = fields.length > 0;
|
|
366
|
+
return (0, graphql_tag_1.gql) `
|
|
367
|
+
mutation AddItemIntoOrderByProductJsonResource($partnerId: String!, $serviceId: String!, $orderId: String!, $itemInput: ItemInput!, $durationQuantity: Int!, $durationUnit: String!, $actorId: String!) {
|
|
368
|
+
addItemIntoOrderByProductJsonResource(partnerId: $partnerId, serviceId: $serviceId, orderId: $orderId, itemInput: $itemInput, durationQuantity: $durationQuantity, durationUnit: $durationUnit, actorId: $actorId) ${hasFields ? `{ ${fieldStr} }` : ""}
|
|
369
|
+
}
|
|
370
|
+
`;
|
|
371
|
+
};
|
|
372
|
+
exports.ADD_ITEM_INTO_ORDER_BY_PRODUCT_JSON_RESOURCE = ADD_ITEM_INTO_ORDER_BY_PRODUCT_JSON_RESOURCE;
|
|
@@ -6,3 +6,4 @@ export declare const GET_ORDER_LINE_ITEM_BY_SERVICE_ID: DocumentNode;
|
|
|
6
6
|
export declare const GET_ORDER_BY_SERVICE_ID: DocumentNode;
|
|
7
7
|
export declare const FIND_ORDER_BY_OWNER_PARTYID: DocumentNode;
|
|
8
8
|
export declare const CALC_EXCHANGE_PRICE_EXTEND_RESOURCE_DETAIL_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
9
|
+
export declare const SEARCH_ORDER_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CALC_EXCHANGE_PRICE_EXTEND_RESOURCE_DETAIL_DYNAMIC = exports.FIND_ORDER_BY_OWNER_PARTYID = exports.GET_ORDER_BY_SERVICE_ID = exports.GET_ORDER_LINE_ITEM_BY_SERVICE_ID = exports.GET_QUANTITY_ORDER_LINEITEMS = exports.GET_ORDER_DETAIL_DYNAMIC = exports.GET_ORDER_DETAIL = void 0;
|
|
3
|
+
exports.SEARCH_ORDER_DYNAMIC = exports.CALC_EXCHANGE_PRICE_EXTEND_RESOURCE_DETAIL_DYNAMIC = exports.FIND_ORDER_BY_OWNER_PARTYID = exports.GET_ORDER_BY_SERVICE_ID = exports.GET_ORDER_LINE_ITEM_BY_SERVICE_ID = exports.GET_QUANTITY_ORDER_LINEITEMS = exports.GET_ORDER_DETAIL_DYNAMIC = exports.GET_ORDER_DETAIL = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.GET_ORDER_DETAIL = (0, graphql_tag_1.gql) `
|
|
6
6
|
query getOrderDetail($orderId: String!) {
|
|
@@ -458,3 +458,13 @@ const CALC_EXCHANGE_PRICE_EXTEND_RESOURCE_DETAIL_DYNAMIC = (fields = []) => {
|
|
|
458
458
|
`;
|
|
459
459
|
};
|
|
460
460
|
exports.CALC_EXCHANGE_PRICE_EXTEND_RESOURCE_DETAIL_DYNAMIC = CALC_EXCHANGE_PRICE_EXTEND_RESOURCE_DETAIL_DYNAMIC;
|
|
461
|
+
const SEARCH_ORDER_DYNAMIC = (fields = []) => {
|
|
462
|
+
const fieldStr = fields.join("\n ");
|
|
463
|
+
const hasFields = fields.length > 0;
|
|
464
|
+
return (0, graphql_tag_1.gql) `
|
|
465
|
+
query searchOrder($filter: OrderFilter) {
|
|
466
|
+
searchOrder(filter: $filter) ${hasFields ? `{ ${fieldStr} }` : ""}
|
|
467
|
+
}
|
|
468
|
+
`;
|
|
469
|
+
};
|
|
470
|
+
exports.SEARCH_ORDER_DYNAMIC = SEARCH_ORDER_DYNAMIC;
|
|
@@ -1,17 +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
|
|
1
|
+
import { DocumentNode } from "graphql";
|
|
2
|
+
export declare const GET_PERSON_BY_IDS_QUERY: DocumentNode;
|
|
3
|
+
export declare const SEARCH_COMPANY: DocumentNode;
|
|
4
|
+
export declare const GET_CUSTOMER_BY_ID: DocumentNode;
|
|
5
|
+
export declare const SEARCH_CUSTOMER: DocumentNode;
|
|
6
|
+
export declare const SEARCH_EMPLOYEES: DocumentNode;
|
|
7
|
+
export declare const GET_POSTIONS_BY_EMPLOYEES_ID: DocumentNode;
|
|
8
|
+
export declare const GET_STORE_CHANEL_IDS_BY_EMPLOYESS_ID: DocumentNode;
|
|
9
|
+
export declare const GET_EMPLOYEES_BY_STORE_CHANEL_ID: DocumentNode;
|
|
10
|
+
export declare const GET_COMPANY_BY_CONTACT_INFO_ID: DocumentNode;
|
|
11
|
+
export declare const GET_CONTACT_INFOS_BY_COMPANY_ID: DocumentNode;
|
|
12
|
+
export declare const GET_PROVINCES: DocumentNode;
|
|
13
|
+
export declare const GET_DISTRICTS: DocumentNode;
|
|
14
|
+
export declare const GET_WARDS: DocumentNode;
|
|
15
|
+
export declare const GET_WARDS_BY_PROVINCE_ID: DocumentNode;
|
|
16
|
+
export declare const GET_VAT_INFOR_BY_OWNER_PARTY_ID: DocumentNode;
|
|
17
|
+
export declare const GET_TEAM_BY_USER_ID: DocumentNode;
|
|
18
|
+
export declare const GET_USERS_BY_TEAM_ID: DocumentNode;
|
|
19
|
+
export declare const GET_CUSTOMER_BY_ID_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_USERS_BY_TEAM_ID = exports.GET_TEAM_BY_USER_ID = exports.GET_VAT_INFOR_BY_OWNER_PARTY_ID = exports.GET_WARDS_BY_PROVINCE_ID = exports.GET_WARDS = exports.GET_DISTRICTS = exports.GET_PROVINCES = exports.GET_CONTACT_INFOS_BY_COMPANY_ID = exports.GET_COMPANY_BY_CONTACT_INFO_ID = exports.GET_EMPLOYEES_BY_STORE_CHANEL_ID = exports.GET_STORE_CHANEL_IDS_BY_EMPLOYESS_ID = exports.GET_POSTIONS_BY_EMPLOYEES_ID = exports.SEARCH_EMPLOYEES = exports.SEARCH_CUSTOMER = exports.GET_CUSTOMER_BY_ID = exports.SEARCH_COMPANY = exports.GET_PERSON_BY_IDS_QUERY = void 0;
|
|
3
|
+
exports.GET_CUSTOMER_BY_ID_DYNAMIC = exports.GET_USERS_BY_TEAM_ID = exports.GET_TEAM_BY_USER_ID = exports.GET_VAT_INFOR_BY_OWNER_PARTY_ID = exports.GET_WARDS_BY_PROVINCE_ID = exports.GET_WARDS = exports.GET_DISTRICTS = exports.GET_PROVINCES = exports.GET_CONTACT_INFOS_BY_COMPANY_ID = exports.GET_COMPANY_BY_CONTACT_INFO_ID = exports.GET_EMPLOYEES_BY_STORE_CHANEL_ID = exports.GET_STORE_CHANEL_IDS_BY_EMPLOYESS_ID = exports.GET_POSTIONS_BY_EMPLOYEES_ID = exports.SEARCH_EMPLOYEES = exports.SEARCH_CUSTOMER = exports.GET_CUSTOMER_BY_ID = exports.SEARCH_COMPANY = exports.GET_PERSON_BY_IDS_QUERY = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.GET_PERSON_BY_IDS_QUERY = (0, graphql_tag_1.gql) `
|
|
6
6
|
query GetPersonByIds($partyIds: [String!]!) {
|
|
@@ -331,3 +331,14 @@ exports.GET_USERS_BY_TEAM_ID = (0, graphql_tag_1.gql) `
|
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
`;
|
|
334
|
+
const GET_CUSTOMER_BY_ID_DYNAMIC = (fields = []) => {
|
|
335
|
+
const fieldStr = fields.join("\n ");
|
|
336
|
+
const hasFields = fields.length > 0;
|
|
337
|
+
return (0, graphql_tag_1.gql) `query GetCustomerById($id: String!) {
|
|
338
|
+
getCustomerById(id: $id) {
|
|
339
|
+
${hasFields ? `${fieldStr}` : ""}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
`;
|
|
343
|
+
};
|
|
344
|
+
exports.GET_CUSTOMER_BY_ID_DYNAMIC = GET_CUSTOMER_BY_ID_DYNAMIC;
|
|
@@ -32,7 +32,7 @@ export declare class AuthService extends Service {
|
|
|
32
32
|
getUserLoginByToken(accessToken: string): Promise<any>;
|
|
33
33
|
updateProfile(userLoginId: string, name: string, phone: string, email: string): Promise<any>;
|
|
34
34
|
createUserDetail(userLoginId: string): Promise<any>;
|
|
35
|
-
updateInfo(accessToken: string, updateUserRequest: UpdateInfoRequest[
|
|
35
|
+
updateInfo(accessToken: string, updateUserRequest: UpdateInfoRequest["updateUserRequest"], type: string, password: string | null): Promise<any>;
|
|
36
36
|
linkingUserLoginAndUserDetail(userLoginId: string, partyId: string): Promise<any>;
|
|
37
37
|
getUserLoginByUserLoginId(userLoginId: string): Promise<any>;
|
|
38
38
|
checkUsernameExisted(username: string): Promise<any>;
|
|
@@ -44,4 +44,6 @@ export declare class AuthService extends Service {
|
|
|
44
44
|
createUserDetailWithoutUserLogin(name: string, phone: string, email: string): Promise<any>;
|
|
45
45
|
getPhoneByPartyId(partyId: string): Promise<any>;
|
|
46
46
|
getEmailByPartyId(partyId: string): Promise<any>;
|
|
47
|
+
getPartyDetailByPhone(phone: string, fields: string[]): Promise<any>;
|
|
48
|
+
createPartyDetail(name: string, phone: string, createdBy: string, source: string, fields: string[]): Promise<any>;
|
|
47
49
|
}
|
|
@@ -276,7 +276,7 @@ class AuthService extends serviceSDK_1.Service {
|
|
|
276
276
|
const variables = {
|
|
277
277
|
orgId: this.orgId,
|
|
278
278
|
phone,
|
|
279
|
-
channelType
|
|
279
|
+
channelType,
|
|
280
280
|
};
|
|
281
281
|
try {
|
|
282
282
|
const response = yield this.graphqlMutation(mutation, variables);
|
|
@@ -294,7 +294,7 @@ class AuthService extends serviceSDK_1.Service {
|
|
|
294
294
|
const variables = {
|
|
295
295
|
otpCode,
|
|
296
296
|
phone,
|
|
297
|
-
channelType
|
|
297
|
+
channelType,
|
|
298
298
|
};
|
|
299
299
|
try {
|
|
300
300
|
const response = yield this.graphqlMutation(mutation, variables);
|
|
@@ -312,7 +312,7 @@ class AuthService extends serviceSDK_1.Service {
|
|
|
312
312
|
const variables = {
|
|
313
313
|
otpCode,
|
|
314
314
|
phone,
|
|
315
|
-
channelType
|
|
315
|
+
channelType,
|
|
316
316
|
};
|
|
317
317
|
try {
|
|
318
318
|
const response = yield this.graphqlMutation(mutation, variables);
|
|
@@ -391,5 +391,42 @@ class AuthService extends serviceSDK_1.Service {
|
|
|
391
391
|
}
|
|
392
392
|
});
|
|
393
393
|
}
|
|
394
|
+
getPartyDetailByPhone(phone, fields) {
|
|
395
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
396
|
+
const query = (0, queries_1.GET_PARTY_DETAIL_BY_PHONE)(fields);
|
|
397
|
+
const variables = {
|
|
398
|
+
phone,
|
|
399
|
+
orgId: this.orgId,
|
|
400
|
+
};
|
|
401
|
+
try {
|
|
402
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
403
|
+
return response.getPartyDetailByPhone;
|
|
404
|
+
}
|
|
405
|
+
catch (error) {
|
|
406
|
+
console.log(`Error in getPartyDetailByPhone: ${error}`);
|
|
407
|
+
throw error;
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
createPartyDetail(name, phone, createdBy, source, fields) {
|
|
412
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
413
|
+
const mutation = (0, queries_1.GET_PARTY_DETAIL_BY_PHONE)(fields);
|
|
414
|
+
const variables = {
|
|
415
|
+
name,
|
|
416
|
+
phone,
|
|
417
|
+
orgId: this.orgId,
|
|
418
|
+
createdBy,
|
|
419
|
+
source,
|
|
420
|
+
};
|
|
421
|
+
try {
|
|
422
|
+
const response = yield this.graphqlQuery(mutation, variables);
|
|
423
|
+
return response.createPartyDetail;
|
|
424
|
+
}
|
|
425
|
+
catch (error) {
|
|
426
|
+
console.log(`Error in createPartyDetail: ${error}`);
|
|
427
|
+
throw error;
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
}
|
|
394
431
|
}
|
|
395
432
|
exports.AuthService = AuthService;
|
|
@@ -14,4 +14,6 @@ export declare class OrderGraphQLService extends Service {
|
|
|
14
14
|
removeProductOptionOrderLineItem(orderLineItemId: string, optionId: string, updateBy: string): Promise<any>;
|
|
15
15
|
findOrderByOwnerPartyId(ownerPartyId: string): Promise<any>;
|
|
16
16
|
calcExchangePriceExtendResourceDetail(serviceId: string, productBaseIdNew: string, durationQuantity: string, durationUnit: string, fields: string[]): Promise<any>;
|
|
17
|
+
searchOrderDynamic(params: any, fields: string[]): Promise<any>;
|
|
18
|
+
addItemIntoOrderByProductJsonResource(serviceId: string, orderId: string, itemInput: any, durationQuantity: number, durationUnit: string, actorId: string, fields: string[]): Promise<any>;
|
|
17
19
|
}
|
|
@@ -209,5 +209,44 @@ class OrderGraphQLService extends serviceSDK_1.Service {
|
|
|
209
209
|
}
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
|
+
searchOrderDynamic(params, fields) {
|
|
213
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
214
|
+
console.log("🚀 ~ OrderGraphQLService ~ searchOrderDynamic ~ params:", params);
|
|
215
|
+
const query = (0, queries_1.SEARCH_ORDER_DYNAMIC)(fields);
|
|
216
|
+
const variables = {
|
|
217
|
+
filter: params,
|
|
218
|
+
};
|
|
219
|
+
try {
|
|
220
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
|
221
|
+
return response.searchOrder;
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
console.log(`Error in searchOrderDynamic: ${error}`);
|
|
225
|
+
throw error;
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
addItemIntoOrderByProductJsonResource(serviceId, orderId, itemInput, durationQuantity, durationUnit, actorId, fields) {
|
|
230
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
231
|
+
const mutation = (0, mutations_1.ADD_ITEM_INTO_ORDER_BY_PRODUCT_JSON_RESOURCE)(fields);
|
|
232
|
+
const variables = {
|
|
233
|
+
partnerId: this.orgId,
|
|
234
|
+
serviceId,
|
|
235
|
+
orderId,
|
|
236
|
+
itemInput,
|
|
237
|
+
durationQuantity,
|
|
238
|
+
durationUnit,
|
|
239
|
+
actorId,
|
|
240
|
+
};
|
|
241
|
+
try {
|
|
242
|
+
const response = yield this.graphqlMutationV2(mutation, variables);
|
|
243
|
+
return response.addItemIntoOrderByProductJsonResource;
|
|
244
|
+
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
console.log(`Error in addItemIntoOrderByProductJsonResource: ${error}`);
|
|
247
|
+
throw error;
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
212
251
|
}
|
|
213
252
|
exports.OrderGraphQLService = OrderGraphQLService;
|
|
@@ -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;
|
|
@@ -33,4 +33,5 @@ export declare class UserService extends Service {
|
|
|
33
33
|
addUserToTeam(teamId: string, userId: string, createdBy: string): Promise<any>;
|
|
34
34
|
removeUserFromTeam(teamId: string, userId: string, deletedBy: string): Promise<any>;
|
|
35
35
|
updateTeamName(teamId: string, name: string, updatedBy: string): Promise<any>;
|
|
36
|
+
getCustomerByIdDynamic(id: string, fields: string[]): Promise<any>;
|
|
36
37
|
}
|
|
@@ -305,7 +305,7 @@ class UserService extends serviceSDK_1.Service {
|
|
|
305
305
|
return __awaiter(this, void 0, void 0, function* () {
|
|
306
306
|
const query = queries_1.GET_PROVINCES;
|
|
307
307
|
const variables = {
|
|
308
|
-
version
|
|
308
|
+
version,
|
|
309
309
|
};
|
|
310
310
|
try {
|
|
311
311
|
const response = yield this.graphqlQueryV2(query, variables);
|
|
@@ -338,7 +338,7 @@ class UserService extends serviceSDK_1.Service {
|
|
|
338
338
|
const query = queries_1.GET_WARDS;
|
|
339
339
|
const variables = {
|
|
340
340
|
districtId,
|
|
341
|
-
version
|
|
341
|
+
version,
|
|
342
342
|
};
|
|
343
343
|
try {
|
|
344
344
|
const response = yield this.graphqlQueryV2(query, variables);
|
|
@@ -354,7 +354,7 @@ class UserService extends serviceSDK_1.Service {
|
|
|
354
354
|
return __awaiter(this, void 0, void 0, function* () {
|
|
355
355
|
const query = queries_1.GET_WARDS_BY_PROVINCE_ID;
|
|
356
356
|
const variables = {
|
|
357
|
-
provinceId
|
|
357
|
+
provinceId,
|
|
358
358
|
};
|
|
359
359
|
try {
|
|
360
360
|
const response = yield this.graphqlQueryV2(query, variables);
|
|
@@ -541,5 +541,21 @@ class UserService extends serviceSDK_1.Service {
|
|
|
541
541
|
}
|
|
542
542
|
});
|
|
543
543
|
}
|
|
544
|
+
getCustomerByIdDynamic(id, fields) {
|
|
545
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
546
|
+
const query = (0, queries_1.GET_CUSTOMER_BY_ID_DYNAMIC)(fields);
|
|
547
|
+
const variables = {
|
|
548
|
+
id,
|
|
549
|
+
};
|
|
550
|
+
try {
|
|
551
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
|
552
|
+
return response.getCustomerById;
|
|
553
|
+
}
|
|
554
|
+
catch (error) {
|
|
555
|
+
console.log(`Error in getCustomerById: ${error}`);
|
|
556
|
+
throw error;
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
}
|
|
544
560
|
}
|
|
545
561
|
exports.UserService = UserService;
|
|
@@ -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;
|