@arrowsphere/api-client 3.33.0 → 3.34.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.
@@ -1,5 +1,5 @@
1
1
  import { AbstractGraphQLClient } from '../abstractGraphQLClient';
2
- import { GetProductsType } from './types/catalogGraphQLTypes';
2
+ import { GetProductsType, GetProductType } from './types/catalogGraphQLTypes';
3
3
  import { CatalogQuery } from './types/catalogGraphQLQueries';
4
4
  export declare class CatalogGraphQLClient extends AbstractGraphQLClient {
5
5
  /**
@@ -11,5 +11,6 @@ export declare class CatalogGraphQLClient extends AbstractGraphQLClient {
11
11
  */
12
12
  private GRAPHQL;
13
13
  find(request: string): Promise<GetProductsType>;
14
- findByQuery(query: CatalogQuery): Promise<GetProductsType | null>;
14
+ findByQuery(query: Pick<CatalogQuery, 'getProducts'>): Promise<GetProductsType | null>;
15
+ findOneByQuery(query: Pick<CatalogQuery, 'product'>): Promise<GetProductType | null>;
15
16
  }
@@ -32,6 +32,21 @@ class CatalogGraphQLClient extends abstractGraphQLClient_1.AbstractGraphQLClient
32
32
  }
33
33
  return null;
34
34
  }
35
+ async findOneByQuery(query) {
36
+ this.path = this.GRAPHQL;
37
+ const queryStr = this.stringifyQuery(query);
38
+ try {
39
+ return await this.post(queryStr);
40
+ }
41
+ catch (error) {
42
+ const exception = this.mapToPublicApiException(error);
43
+ const { mustRetry } = await this.handleError(exception);
44
+ if (mustRetry) {
45
+ return await this.post(queryStr);
46
+ }
47
+ }
48
+ return null;
49
+ }
35
50
  }
36
51
  exports.CatalogGraphQLClient = CatalogGraphQLClient;
37
52
  //# sourceMappingURL=catalogGraphQLClient.js.map
@@ -0,0 +1,4 @@
1
+ import { ProductType } from './catalogGraphQLTypes';
2
+ export declare type FindOneProductQueryOutput = {
3
+ product: ProductType;
4
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=FindOneProductQueryOutput.js.map
@@ -1,7 +1,12 @@
1
1
  import { QueryArguments } from './queryArguments';
2
2
  import { FiltersSchema, PaginationSchema, ProductSchema } from './catalogGraphQLSchemas';
3
+ import { Merge } from 'type-fest';
4
+ /**
5
+ * Represent the Catalog Schema of Public API
6
+ */
3
7
  export declare type CatalogQuery = {
4
- getProducts: GetPaginatedProductsQuery;
8
+ getProducts?: GetPaginatedProductsQuery;
9
+ product?: GetProductQuery;
5
10
  };
6
11
  export declare type GetPaginatedProductsQuery = {
7
12
  __args: QueryArguments;
@@ -10,3 +15,6 @@ export declare type GetPaginatedProductsQuery = {
10
15
  products?: ProductSchema;
11
16
  topOffers?: ProductSchema;
12
17
  };
18
+ export declare type GetProductQuery = Merge<{
19
+ __args: QueryArguments;
20
+ }, ProductSchema>;
@@ -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,9 @@
1
1
  export declare type GetProductsType = {
2
2
  getProducts?: PaginatedProductsType;
3
3
  };
4
+ export declare type GetProductType = {
5
+ product?: ProductType;
6
+ };
4
7
  export declare type PaginatedProductsType = {
5
8
  filters?: Array<FiltersType>;
6
9
  pagination?: PaginationType;
@@ -40,6 +43,7 @@ export declare type ProductType = {
40
43
  baseOfferPrimaries?: Array<IdentifiersType>;
41
44
  assets?: AssetsType;
42
45
  environmentAvailability?: string;
46
+ promotions?: Array<PromotionType>;
43
47
  marketplace?: string;
44
48
  isEnabled?: boolean;
45
49
  isTrial?: boolean;
@@ -153,6 +157,8 @@ export declare type PriceBandType = {
153
157
  prices?: PricesType;
154
158
  saleConstraints?: PriceBandSaleConstraintsType;
155
159
  uom?: UomType;
160
+ promotionPrices?: PromotionPricesType;
161
+ vendor?: VendorType;
156
162
  };
157
163
  export declare type PriceBandActionFlagsType = {
158
164
  canBeCancelled?: boolean;
@@ -200,6 +206,7 @@ export declare type PricesType = {
200
206
  buy?: string;
201
207
  sell?: string;
202
208
  public?: string;
209
+ vendorPricingSource?: VendorPricingSourceType;
203
210
  };
204
211
  export declare type PriceBandSaleConstraintsType = {
205
212
  availableDate?: string;
@@ -222,3 +229,32 @@ export declare type OfferResellersType = {
222
229
  export declare type ResellerType = {
223
230
  xspRef?: string;
224
231
  };
232
+ export declare type PromotionPricesType = {
233
+ promotionId?: string;
234
+ prices?: PricesType;
235
+ };
236
+ export declare type VendorPricingSourceType = {
237
+ currency?: string;
238
+ changeRate?: number;
239
+ prices?: PricesType;
240
+ };
241
+ export declare type PromotionType = {
242
+ promotionId?: string;
243
+ vendorSku?: string;
244
+ marketplace?: string;
245
+ name?: string;
246
+ description?: string;
247
+ isAutoApplicable?: boolean;
248
+ startDate?: string;
249
+ endDate?: string;
250
+ promotionType?: string;
251
+ pricingType?: string;
252
+ pricingValue?: number;
253
+ billing?: BillingType;
254
+ minQuantity?: number;
255
+ maxQuantity?: number;
256
+ currency?: string;
257
+ applicableUntil?: string;
258
+ applicableFor?: number;
259
+ checkEligibility?: boolean;
260
+ };
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.33.0",
7
+ "version": "3.34.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",