@longvansoftware/service-js-client 2.2.8 → 2.2.9

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.
@@ -21,3 +21,4 @@ export declare const UPDATE_SERVICE_READY_DEPLOY: DocumentNode;
21
21
  export declare const UPDATE_URL_PUBLIC: DocumentNode;
22
22
  export declare const CHECK_ENTERPRISE_BY_TAX_CODE_DYNAMIC: (fields?: string[]) => DocumentNode;
23
23
  export declare const CHECK_BUSINESS_BY_TAX_CODE_DYNAMIC: (fields?: string[]) => DocumentNode;
24
+ export declare const CONVERT_PRODUCT_RESOURCE_OUTPUTS_TO_PRODUCT_JSON_LIST: (fields?: string[]) => DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
3
+ exports.CONVERT_PRODUCT_RESOURCE_OUTPUTS_TO_PRODUCT_JSON_LIST = 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!) {
@@ -358,3 +358,19 @@ const CHECK_BUSINESS_BY_TAX_CODE_DYNAMIC = (fields = []) => {
358
358
  `;
359
359
  };
360
360
  exports.CHECK_BUSINESS_BY_TAX_CODE_DYNAMIC = CHECK_BUSINESS_BY_TAX_CODE_DYNAMIC;
361
+ const CONVERT_PRODUCT_RESOURCE_OUTPUTS_TO_PRODUCT_JSON_LIST = (fields = []) => {
362
+ const fieldStr = fields.join("\n ");
363
+ const hasFields = fields.length > 0;
364
+ return (0, graphql_tag_1.gql) `
365
+ mutation convertProductResourceOutputsToProductJsonList(
366
+ $productResourceInput: ProductResourceInput!
367
+ ) {
368
+ convertProductResourceOutputsToProductJsonList(
369
+ productResourceInput: $productResourceInput
370
+ ) {
371
+ ${hasFields ? `${fieldStr}` : ""}
372
+ }
373
+ }
374
+ `;
375
+ };
376
+ exports.CONVERT_PRODUCT_RESOURCE_OUTPUTS_TO_PRODUCT_JSON_LIST = CONVERT_PRODUCT_RESOURCE_OUTPUTS_TO_PRODUCT_JSON_LIST;
@@ -1,6 +1,7 @@
1
1
  import { DocumentNode } from "graphql";
2
2
  export declare const GET_PRODUCT_BY_ID_QUERY: DocumentNode;
3
3
  export declare const GET_PRODUCT_BY_ID_QUERY_DYNAMIC: (fields?: string[]) => DocumentNode;
4
+ export declare const GET_SIMPLE_PRODUCT_BY_ID_QUERY_DYNAMIC: (fields?: string[]) => DocumentNode;
4
5
  export declare const GET_PRODUCT_BY_SLUG_QUERY: DocumentNode;
5
6
  export declare const GET_SIMPLE_PRODUCTS_QUERY: DocumentNode;
6
7
  export declare const GET_CATEGORIES_QUERY: DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_PRODUCTS_FEATURE_TYPE_DYNAMIC = exports.GET_PRODUCT_RELATED_TO_ARTICLE = exports.GET_SIMPLE_PRODUCTS_DYNAMIC = exports.GET_PRICE_MENUS = 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;
3
+ exports.GET_PRODUCTS_FEATURE_TYPE_DYNAMIC = exports.GET_PRODUCT_RELATED_TO_ARTICLE = exports.GET_SIMPLE_PRODUCTS_DYNAMIC = exports.GET_PRICE_MENUS = 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_SIMPLE_PRODUCT_BY_ID_QUERY_DYNAMIC = 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(
@@ -210,6 +210,24 @@ const GET_PRODUCT_BY_ID_QUERY_DYNAMIC = (fields = []) => {
210
210
  `;
211
211
  };
212
212
  exports.GET_PRODUCT_BY_ID_QUERY_DYNAMIC = GET_PRODUCT_BY_ID_QUERY_DYNAMIC;
213
+ const GET_SIMPLE_PRODUCT_BY_ID_QUERY_DYNAMIC = (fields = []) => {
214
+ const fieldStr = fields.join("\n ");
215
+ const hasFields = fields.length > 0;
216
+ return (0, graphql_tag_1.gql) `
217
+ query GetSimpleProductById(
218
+ $partnerId: String!
219
+ $storeChannel: String!
220
+ $productId: String!
221
+ ) {
222
+ getSimpleProductById(
223
+ partnerId: $partnerId
224
+ storeChannel: $storeChannel
225
+ productId: $productId
226
+ ) ${hasFields ? `{ ${fieldStr} }` : ""}
227
+ }
228
+ `;
229
+ };
230
+ exports.GET_SIMPLE_PRODUCT_BY_ID_QUERY_DYNAMIC = GET_SIMPLE_PRODUCT_BY_ID_QUERY_DYNAMIC;
213
231
  exports.GET_PRODUCT_BY_SLUG_QUERY = (0, graphql_tag_1.gql) `
214
232
  query GetProductByHandle(
215
233
  $partnerId: String!
@@ -290,7 +308,7 @@ exports.GET_SIMPLE_PRODUCTS_QUERY = (0, graphql_tag_1.gql) `
290
308
  query getSimpleProducts(
291
309
  $partnerId: String!
292
310
  $storeChannel: String!
293
- $hash: String
311
+ $group: String
294
312
  $category: String
295
313
  $product: String
296
314
  $sku: String
@@ -315,7 +333,7 @@ exports.GET_SIMPLE_PRODUCTS_QUERY = (0, graphql_tag_1.gql) `
315
333
  getSimpleProducts(
316
334
  partnerId: $partnerId
317
335
  storeChannel: $storeChannel
318
- hash: $hash
336
+ group: $group
319
337
  category: $category
320
338
  product: $product
321
339
  sku: $sku
@@ -1115,10 +1133,10 @@ const GET_SIMPLE_PRODUCTS_DYNAMIC = (fields = []) => {
1115
1133
  const fieldStr = fields.join("\n ");
1116
1134
  const hasFields = fields.length > 0;
1117
1135
  return (0, graphql_tag_1.gql) `
1118
- query getSimpleProducts(
1136
+ query GetSimpleProducts(
1119
1137
  $partnerId: String!
1120
1138
  $storeChannel: String!
1121
- $hash: String
1139
+ $group: String
1122
1140
  $category: String
1123
1141
  $product: String
1124
1142
  $sku: String
@@ -1143,7 +1161,7 @@ const GET_SIMPLE_PRODUCTS_DYNAMIC = (fields = []) => {
1143
1161
  getSimpleProducts(
1144
1162
  partnerId: $partnerId
1145
1163
  storeChannel: $storeChannel
1146
- hash: $hash
1164
+ group: $group
1147
1165
  category: $category
1148
1166
  product: $product
1149
1167
  sku: $sku
@@ -53,4 +53,5 @@ export declare class CloudService extends Service {
53
53
  updateActionCustomAttribute(actionId: string, attrName: string, attrValue: string, byUser: string): Promise<any>;
54
54
  getElasticCloudResource(serviceId: string): Promise<any>;
55
55
  searchServiceDynamic(filter: Filter, fields: string[]): Promise<any>;
56
+ convertProductResourceOutputsToProductJsonList(productResourceInput: any, fields: string[]): Promise<any>;
56
57
  }
@@ -766,5 +766,24 @@ class CloudService extends serviceSDK_1.Service {
766
766
  }
767
767
  });
768
768
  }
769
+ convertProductResourceOutputsToProductJsonList(productResourceInput, fields) {
770
+ return __awaiter(this, void 0, void 0, function* () {
771
+ const query = (0, mutations_1.CONVERT_PRODUCT_RESOURCE_OUTPUTS_TO_PRODUCT_JSON_LIST)(fields);
772
+ const variables = {
773
+ productResourceInput: {
774
+ productId: productResourceInput === null || productResourceInput === void 0 ? void 0 : productResourceInput.productId,
775
+ resources: productResourceInput === null || productResourceInput === void 0 ? void 0 : productResourceInput.resources,
776
+ }
777
+ };
778
+ try {
779
+ const response = yield this.graphqlQueryV2(query, variables);
780
+ return response.convertProductResourceOutputsToProductJsonList;
781
+ }
782
+ catch (error) {
783
+ console.log(`Error in convertProductResourceOutputsToProductJsonList: ${error}`);
784
+ throw error;
785
+ }
786
+ });
787
+ }
769
788
  }
770
789
  exports.CloudService = CloudService;
@@ -287,7 +287,7 @@ class OrderGraphQLService extends serviceSDK_1.Service {
287
287
  }
288
288
  calculateResourceChangePrice(productIds, quantity, unit, storeId, fields) {
289
289
  return __awaiter(this, void 0, void 0, function* () {
290
- const query = (0, queries_1.SEARCH_ORDER_DYNAMIC)(fields);
290
+ const query = (0, queries_1.CALCULATE_RESOURCE_CHANGE_PRICE)(fields);
291
291
  const variables = {
292
292
  partnerId: this.orgId,
293
293
  storeId: storeId ? storeId : this.storeId,
@@ -22,6 +22,7 @@ export declare class ProductService extends Service {
22
22
  */
23
23
  getProductById(productId: string, store: string): Promise<any>;
24
24
  getProductByIdDynamic(productId: string, store: string, fields: string[]): Promise<any>;
25
+ getSimpleProductByIdDynamic(productId: string, store: string, fields: string[]): Promise<any>;
25
26
  /**
26
27
  * Retrieves a product by its slug.
27
28
  * @param slug - The slug of the product.
@@ -70,6 +70,24 @@ class ProductService extends serviceSDK_1.Service {
70
70
  }
71
71
  });
72
72
  }
73
+ getSimpleProductByIdDynamic(productId, store, fields) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ const query = (0, queries_1.GET_SIMPLE_PRODUCT_BY_ID_QUERY_DYNAMIC)(fields);
76
+ const variables = {
77
+ partnerId: this.orgId,
78
+ storeChannel: store ? store : this.storeId,
79
+ productId,
80
+ };
81
+ try {
82
+ const response = yield this.graphqlQuery(query, variables);
83
+ return response.getSimpleProductById;
84
+ }
85
+ catch (error) {
86
+ console.log(`Error fetching simple product by ID: ${error}`);
87
+ throw error;
88
+ }
89
+ });
90
+ }
73
91
  /**
74
92
  * Retrieves a product by its slug.
75
93
  * @param slug - The slug of the product.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "2.2.8",
3
+ "version": "2.2.9",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [