@arrowsphere/api-client 3.39.0 → 3.40.0-rc-jpb.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/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
3
3
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
4
4
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## [3.40.0] - 2023-06-20
7
+
8
+ ### Changed
9
+
10
+ - Refactor find products by query
11
+ - Add find one priceBand by query
12
+ - Add find one product by query
13
+ - Add fetch promotions
14
+
6
15
  ## [3.39.0] - 2023-06-20
7
16
 
8
17
  ### Changed
@@ -1,6 +1,6 @@
1
1
  import { AbstractGraphQLClient } from '../abstractGraphQLClient';
2
- import { GetProductsType } from './types/catalogGraphQLTypes';
3
- import { CatalogQuery } from './types/catalogGraphQLQueries';
2
+ import { GetPriceBandType, GetProductsType, GetProductType } from './types/catalogGraphQLTypes';
3
+ import { CatalogQueries, CatalogQuery } from './types/catalogGraphQLQueries';
4
4
  export declare class CatalogGraphQLClient extends AbstractGraphQLClient {
5
5
  /**
6
6
  * The base path of the API
@@ -11,5 +11,12 @@ export declare class CatalogGraphQLClient extends AbstractGraphQLClient {
11
11
  */
12
12
  private GRAPHQL;
13
13
  find(request: string): Promise<GetProductsType>;
14
+ /**
15
+ * @deprecated
16
+ * Prefer using findProductsByQuery instead.
17
+ */
14
18
  findByQuery(query: CatalogQuery): Promise<GetProductsType | null>;
19
+ findProductsByQuery(query: Pick<CatalogQueries, 'getProducts'>): Promise<GetProductsType | null>;
20
+ findOneProductByQuery(query: Pick<CatalogQueries, 'product'>): Promise<GetProductType | null>;
21
+ findOnePriceBandByQuery(query: Pick<CatalogQueries, 'priceBand'>): Promise<GetPriceBandType | null>;
15
22
  }
@@ -18,6 +18,10 @@ class CatalogGraphQLClient extends abstractGraphQLClient_1.AbstractGraphQLClient
18
18
  this.path = this.GRAPHQL;
19
19
  return await this.post(request);
20
20
  }
21
+ /**
22
+ * @deprecated
23
+ * Prefer using findProductsByQuery instead.
24
+ */
21
25
  async findByQuery(query) {
22
26
  const queryStr = this.stringifyQuery(query);
23
27
  try {
@@ -32,6 +36,50 @@ class CatalogGraphQLClient extends abstractGraphQLClient_1.AbstractGraphQLClient
32
36
  }
33
37
  return null;
34
38
  }
39
+ async findProductsByQuery(query) {
40
+ const queryStr = this.stringifyQuery(query);
41
+ try {
42
+ return await this.find(queryStr);
43
+ }
44
+ catch (error) {
45
+ const exception = this.mapToPublicApiException(error);
46
+ const { mustRetry } = await this.handleError(exception);
47
+ if (mustRetry) {
48
+ return await this.find(queryStr);
49
+ }
50
+ }
51
+ return null;
52
+ }
53
+ async findOneProductByQuery(query) {
54
+ this.path = this.GRAPHQL;
55
+ const queryStr = this.stringifyQuery(query);
56
+ try {
57
+ return await this.post(queryStr);
58
+ }
59
+ catch (error) {
60
+ const exception = this.mapToPublicApiException(error);
61
+ const { mustRetry } = await this.handleError(exception);
62
+ if (mustRetry) {
63
+ return await this.post(queryStr);
64
+ }
65
+ }
66
+ return null;
67
+ }
68
+ async findOnePriceBandByQuery(query) {
69
+ this.path = this.GRAPHQL;
70
+ const queryStr = this.stringifyQuery(query);
71
+ try {
72
+ return await this.post(queryStr);
73
+ }
74
+ catch (error) {
75
+ const exception = this.mapToPublicApiException(error);
76
+ const { mustRetry } = await this.handleError(exception);
77
+ if (mustRetry) {
78
+ return await this.post(queryStr);
79
+ }
80
+ }
81
+ return null;
82
+ }
35
83
  }
36
84
  exports.CatalogGraphQLClient = CatalogGraphQLClient;
37
85
  //# sourceMappingURL=catalogGraphQLClient.js.map
@@ -0,0 +1,7 @@
1
+ import { PriceBandType, ProductType } from './catalogGraphQLTypes';
2
+ export declare type FindOneProductQueryOutput = {
3
+ product: ProductType;
4
+ };
5
+ export declare type FindOnePriceBandQueryOutput = {
6
+ priceBand: PriceBandType;
7
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=FindOneProductQueryOutput.js.map
@@ -1,12 +1,31 @@
1
- import { QueryArguments } from './queryArguments';
2
- import { FiltersSchema, PaginationSchema, ProductSchema } from './catalogGraphQLSchemas';
1
+ import { QueryPriceBandArguments, QueryProductArguments } from './queryProductArguments';
2
+ import { FiltersSchema, PaginationSchema, PriceBandSchema, ProductSchema } from './catalogGraphQLSchemas';
3
+ import { Merge } from 'type-fest';
4
+ /**
5
+ * @deprecated
6
+ * Prefer using CatalogQueries instead.
7
+ */
3
8
  export declare type CatalogQuery = {
4
9
  getProducts: GetPaginatedProductsQuery;
5
10
  };
11
+ /**
12
+ * Represent the Catalog Schema of Public API
13
+ */
14
+ export declare type CatalogQueries = {
15
+ getProducts?: GetPaginatedProductsQuery;
16
+ priceBand?: GetPriceBandQuery;
17
+ product?: GetProductQuery;
18
+ };
6
19
  export declare type GetPaginatedProductsQuery = {
7
- __args: QueryArguments;
20
+ __args: QueryProductArguments;
8
21
  filters?: FiltersSchema;
9
22
  pagination?: PaginationSchema;
10
23
  products?: ProductSchema;
11
24
  topOffers?: ProductSchema;
12
25
  };
26
+ export declare type GetProductQuery = Merge<{
27
+ __args: QueryProductArguments;
28
+ }, ProductSchema>;
29
+ export declare type GetPriceBandQuery = Merge<{
30
+ __args: QueryPriceBandArguments;
31
+ }, PriceBandSchema>;
@@ -1,9 +1,10 @@
1
- import { AttributeType, FiltersType, IdentifiersType, PaginationType, PriceBandType, PricesType, ProductType, RelatedOfferType } from './catalogGraphQLTypes';
1
+ import { AttributeType, FiltersType, IdentifiersType, PaginationType, PriceBandType, PricesType, ProductType, PromotionType, RelatedOfferType } from './catalogGraphQLTypes';
2
2
  import { Merge, Schema } from 'type-fest';
3
3
  export declare type PaginationSchema = Schema<PaginationType, boolean>;
4
4
  export declare type FiltersSchema = Schema<FiltersType, boolean>;
5
5
  declare type IdentifiersSchema = Schema<IdentifiersType, boolean>;
6
6
  declare type RelatedOfferSchema = Schema<RelatedOfferType, boolean>;
7
+ declare type PromotionSchema = Schema<PromotionType, boolean>;
7
8
  /**
8
9
  * Field of type array are not handled by Schema, they must be overwritten
9
10
  */
@@ -13,6 +14,7 @@ declare type MissingFieldsOfProductSchema = {
13
14
  conversionOfferPrimaries?: IdentifiersSchema;
14
15
  relatedOffers?: RelatedOfferSchema;
15
16
  priceBand?: PriceBandSchema;
17
+ promotions?: PromotionSchema;
16
18
  };
17
19
  export declare type ProductSchema = Merge<Schema<ProductType, boolean>, MissingFieldsOfProductSchema>;
18
20
  declare type AttributeSchema = Schema<AttributeType, boolean>;
@@ -20,7 +22,7 @@ declare type AttributeSchema = Schema<AttributeType, boolean>;
20
22
  * Field of type array are not handled by Schema, they must be overwritten
21
23
  */
22
24
  declare type MissingFieldsOfPriceBandSchema = {
23
- attributes?: Array<AttributeSchema>;
25
+ attributes?: AttributeSchema;
24
26
  };
25
27
  /**
26
28
  * No type corresponding
@@ -1,6 +1,12 @@
1
1
  export declare type GetProductsType = {
2
2
  getProducts?: PaginatedProductsType;
3
3
  };
4
+ export declare type GetProductType = {
5
+ product?: ProductType;
6
+ };
7
+ export declare type GetPriceBandType = {
8
+ priceBand?: PriceBandType;
9
+ };
4
10
  export declare type PaginatedProductsType = {
5
11
  filters?: Array<FiltersType>;
6
12
  pagination?: PaginationType;
@@ -40,6 +46,7 @@ export declare type ProductType = {
40
46
  baseOfferPrimaries?: Array<IdentifiersType>;
41
47
  assets?: AssetsType;
42
48
  environmentAvailability?: string;
49
+ promotions?: Array<PromotionType>;
43
50
  marketplace?: string;
44
51
  isEnabled?: boolean;
45
52
  isTrial?: boolean;
@@ -153,6 +160,8 @@ export declare type PriceBandType = {
153
160
  prices?: PricesType;
154
161
  saleConstraints?: PriceBandSaleConstraintsType;
155
162
  uom?: UomType;
163
+ promotionPrices?: PromotionPricesType;
164
+ vendor?: VendorType;
156
165
  };
157
166
  export declare type PriceBandActionFlagsType = {
158
167
  canBeCancelled?: boolean;
@@ -171,10 +180,10 @@ export declare type BillingType = {
171
180
  type?: string;
172
181
  };
173
182
  export declare type DynamicAttributesType = {
174
- diskSize?: string;
175
- ram?: string;
176
183
  region?: string;
177
184
  vCpu?: string;
185
+ ram?: string;
186
+ diskSize?: string;
178
187
  reservationsAutofitGroup?: string;
179
188
  acu?: string;
180
189
  marketSegment?: string;
@@ -200,6 +209,7 @@ export declare type PricesType = {
200
209
  buy?: string;
201
210
  sell?: string;
202
211
  public?: string;
212
+ vendorPricingSource?: VendorPricingSourceType;
203
213
  };
204
214
  export declare type PriceBandSaleConstraintsType = {
205
215
  availableDate?: string;
@@ -222,3 +232,32 @@ export declare type OfferResellersType = {
222
232
  export declare type ResellerType = {
223
233
  xspRef?: string;
224
234
  };
235
+ export declare type PromotionPricesType = {
236
+ promotionId?: string;
237
+ prices?: PricesType;
238
+ };
239
+ export declare type VendorPricingSourceType = {
240
+ currency?: string;
241
+ changeRate?: number;
242
+ prices?: PricesType;
243
+ };
244
+ export declare type PromotionType = {
245
+ promotionId?: string;
246
+ vendorSku?: string;
247
+ marketplace?: string;
248
+ name?: string;
249
+ description?: string;
250
+ isAutoApplicable?: boolean;
251
+ startDate?: string;
252
+ endDate?: string;
253
+ promotionType?: string;
254
+ pricingType?: string;
255
+ pricingValue?: number;
256
+ billing?: BillingType;
257
+ minQuantity?: number;
258
+ maxQuantity?: number;
259
+ currency?: string;
260
+ applicableUntil?: string;
261
+ applicableFor?: number;
262
+ checkEligibility?: boolean;
263
+ };
@@ -1,14 +1,35 @@
1
1
  /**
2
2
  * For field __args
3
3
  */
4
- export declare type QueryArguments = {
4
+ export declare type QueryProductArguments = {
5
5
  paginate?: PaginateArgument;
6
6
  searchBody: SearchBodyArgument;
7
7
  };
8
+ /**
9
+ * For field __args
10
+ */
11
+ export declare type QueryPriceBandArguments = {
12
+ paginate?: PaginateArgument;
13
+ searchBody: SearchBodyPriceBandsArgument;
14
+ };
8
15
  export declare type PaginateArgument = {
9
16
  page: number;
10
17
  perPage: number;
11
18
  };
19
+ export declare type SearchBodyPriceBandsArgument = {
20
+ keywords?: string;
21
+ filters?: SearchFilterArgument[];
22
+ exclusionFilters?: SearchFilterArgument[];
23
+ sort?: SortArgument;
24
+ highlight?: boolean;
25
+ aggregatorFilter?: string[];
26
+ marketplace?: string;
27
+ resellerRef?: string;
28
+ endCustomerRef?: string;
29
+ restricted?: boolean;
30
+ getFamilies?: boolean;
31
+ quantity?: number;
32
+ };
12
33
  export declare type SearchBodyArgument = {
13
34
  aggregatorFilter?: string[];
14
35
  endCustomerRef?: string;
@@ -7,4 +7,4 @@ var OperatorArgument;
7
7
  OperatorArgument["AND"] = "AND";
8
8
  OperatorArgument["BETWEEN"] = "BETWEEN";
9
9
  })(OperatorArgument = exports.OperatorArgument || (exports.OperatorArgument = {}));
10
- //# sourceMappingURL=queryArguments.js.map
10
+ //# sourceMappingURL=queryProductArguments.js.map
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/ArrowSphere/nodejs-api-client.git"
6
6
  },
7
- "version": "3.39.0",
7
+ "version": "3.40.0-rc-jpb.1",
8
8
  "description": "Node.js client for ArrowSphere's public API",
9
9
  "main": "build/index.js",
10
10
  "types": "build/index.d.ts",