@longvansoftware/service-js-client 2.1.0 → 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.
@@ -1,17 +1,19 @@
1
- export declare const LOGIN_MUTATION: import("graphql").DocumentNode;
2
- export declare const REGISTER_MUTATION: import("graphql").DocumentNode;
3
- export declare const SEND_SMS_VERIFY_CODE_MUTATION: import("graphql").DocumentNode;
4
- export declare const VERIFY_CODE_MUTATION: import("graphql").DocumentNode;
5
- export declare const RESET_PASSWORD_MUTATION: import("graphql").DocumentNode;
6
- export declare const UPDATE_INFO_MUTATION: import("graphql").DocumentNode;
7
- export declare const UPDATE_PASSWORD_MUTATION: import("graphql").DocumentNode;
8
- export declare const LOGIN_v2: import("graphql").DocumentNode;
9
- export declare const CREATE_RESET_KEY: import("graphql").DocumentNode;
10
- export declare const CHECK_RESET_KEY: import("graphql").DocumentNode;
11
- export declare const UPDATE_PROFILE: import("graphql").DocumentNode;
12
- export declare const CREATE_USER_DETAIL: import("graphql").DocumentNode;
13
- export declare const LINKING_USER_LOGIN_AND_USER_DETAIL: import("graphql").DocumentNode;
14
- export declare const SEND_OTP: import("graphql").DocumentNode;
15
- export declare const VALIDATE_OTP: import("graphql").DocumentNode;
16
- export declare const CREATE_USER_LOGIN: import("graphql").DocumentNode;
17
- export declare const CREATE_USER_DETAIL_WITHOUT_USER_LOGIN: import("graphql").DocumentNode;
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
- export declare const GET_USER_DETAIL: import("graphql").DocumentNode;
2
- export declare const GET_USER_LOGIN_BY_TOKEN: import("graphql").DocumentNode;
3
- export declare const GET_USER_LOGIN_BY_USER_LOGIN_ID: import("graphql").DocumentNode;
4
- export declare const CHECK_USERNAME_EXISTED: import("graphql").DocumentNode;
5
- export declare const GET_USER_LOGIN_BY_PARTY_ID: import("graphql").DocumentNode;
6
- export declare const GET_PHONE_BY_PARTYID: import("graphql").DocumentNode;
7
- export declare const GET_EMAIL_BY_PARTYID: import("graphql").DocumentNode;
8
- export declare const GET_ACCESS_TOKEN_BY_OTP: import("graphql").DocumentNode;
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($otpCode: String!, $phone: String!, $channelType: String) {
78
- getAccessTokenByOTP(otpCode: $otpCode, phone: $phone, channelType: $channelType)
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
- export declare const CREATE_ORDER: import("graphql").DocumentNode;
2
- export declare const UPDATE_QUANTITY_V2: import("graphql").DocumentNode;
3
- export declare const ADD_TO_CART: import("graphql").DocumentNode;
4
- export declare const REMOVE_PRODUCT_OPTION_ORDER_LINE_ITEM: import("graphql").DocumentNode;
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;
@@ -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['updateUserRequest'], type: string, password: string | null): Promise<any>;
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;
@@ -15,4 +15,5 @@ export declare class OrderGraphQLService extends Service {
15
15
  findOrderByOwnerPartyId(ownerPartyId: string): Promise<any>;
16
16
  calcExchangePriceExtendResourceDetail(serviceId: string, productBaseIdNew: string, durationQuantity: string, durationUnit: string, fields: string[]): Promise<any>;
17
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>;
18
19
  }
@@ -226,5 +226,27 @@ class OrderGraphQLService extends serviceSDK_1.Service {
226
226
  }
227
227
  });
228
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
+ }
229
251
  }
230
252
  exports.OrderGraphQLService = OrderGraphQLService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [