diff --git a/.eslintrc.json b/.eslintrc.json index 58cc882..ec2ce14 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -5,7 +5,8 @@ }, "extends": [ "airbnb-base", - "plugin:jest/recommended" + "plugin:jest/recommended", + "plugin:prettier/recommended" ], "parser": "@typescript-eslint/parser", "parserOptions": { diff --git a/README.md b/README.md index 124ecfb..af0b131 100644 --- a/README.md +++ b/README.md @@ -90,8 +90,9 @@ OMS | :white_check_mark: | Logistics | :white_check_mark: | Pricing | :white_check_mark: | Master Data (V2) | :white_check_mark: (*) Attachments API pending | +Catalog | :white_check_mark: | +Search | Comming soon... | Antifraud Provider | :x: | -Catalog | Comming soon... | Checkout | :x: | CMS | :x: | Customer Credit | :x: | @@ -102,7 +103,6 @@ License Manager | :x: | Payment Provider Protocol | :x: | Payments Gateway | :x: | Rates and Benefits | :x: | -Search | :x: | Session Manager | :x: | Subscriptions (V2) | :x: | Suggestions | :x: | diff --git a/babel.config.js b/babel.config.js index b7f846c..73322d8 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,13 +1,13 @@ module.exports = { presets: [ [ - '@babel/preset-env', + "@babel/preset-env", { targets: { node: 8, }, }, ], - '@babel/preset-typescript', + "@babel/preset-typescript", ], }; diff --git a/jest.config.js b/jest.config.js index e72e1b0..34a5a11 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,5 +1,5 @@ module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', + preset: "ts-jest", + testEnvironment: "node", verbose: true, }; diff --git a/package.json b/package.json index ef9e3a5..d7aa4cc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@onreadydesa/vtex-node-sdk", - "version": "1.3.0-alpha", + "version": "1.4.0-alpha", "description": "VTEX Node SDK, built 100% with Typescript and 0 dependencies!", "author": "Onready", "private": false, @@ -19,28 +19,42 @@ "keywords": [ "vtex", "vtex-sdk", - "vtex-node-sdk" + "vtex-node-sdk", + "onready", + "vtex-api", + "sdk-node-vtex", + "typescript", + "api-vtex", + "sdk-vtex", + "node", + "vtex-node", + "node-vtex", + "node-vtex-sdk" ], "scripts": { "build": "rimraf dist && tsc", "test": "jest", - "lint": "eslint ." + "lint": "eslint \"./src/**/*.ts\"", + "prepublishOnly": "yarn lint && yarn test && yarn build" }, "devDependencies": { "@babel/core": "7.10.3", "@babel/preset-env": "7.10.3", "@babel/preset-typescript": "7.10.1", - "@types/jest": "26.0.0", - "@types/node": "14.0.13", - "@typescript-eslint/eslint-plugin": "3.3.0", - "@typescript-eslint/parser": "3.3.0", - "babel-jest": "26.0.1", - "eslint": "7.3.0", + "@types/jest": "26.0.3", + "@types/node": "14.0.14", + "@typescript-eslint/eslint-plugin": "3.4.0", + "@typescript-eslint/parser": "3.4.0", + "babel-jest": "26.1.0", + "eslint": "7.3.1", "eslint-config-airbnb-base": "14.2.0", + "eslint-config-prettier": "6.11.0", "eslint-plugin-import": "2.21.2", - "eslint-plugin-jest": "23.16.0", - "jest": "26.0.1", + "eslint-plugin-jest": "23.17.1", + "eslint-plugin-prettier": "3.1.4", + "jest": "26.1.0", "nock": "12.0.3", + "prettier": "2.0.5", "rimraf": "3.0.2", "ts-jest": "26.1.1", "typescript": "3.9.5" diff --git a/src/VTEX.ts b/src/VTEX.ts index 619c753..15f21a0 100644 --- a/src/VTEX.ts +++ b/src/VTEX.ts @@ -1,23 +1,28 @@ -import { VtexCredentials } from './VtexCredentials'; -import { VtexHttpClient } from './utils/VtexHttpClient'; -import { OMS } from './modules/OMS'; -import { Logistics } from './modules/logistics'; -import { Pricing } from './modules/pricing'; -import { MasterData } from './modules/master-data/v2'; +import { VtexCredentials } from "./VtexCredentials"; +import { VtexHttpClient } from "./utils/VtexHttpClient"; +import { OMS } from "./modules/OMS"; +import { Logistics } from "./modules/logistics"; +import { Pricing } from "./modules/pricing"; +import { MasterData } from "./modules/master-data/v2"; +import { Catalog } from "./modules/catalog"; export class VTEX { private static buildErrorMessage(paramName: string): string { return `Param ${paramName} is required`; } - private static validate(store: string, appKey: string, appToken: string): void { + private static validate( + store: string, + appKey: string, + appToken: string + ): void { let errorMessage = null; if (!store) { - errorMessage = VTEX.buildErrorMessage('store'); + errorMessage = VTEX.buildErrorMessage("store"); } else if (!appKey) { - errorMessage = VTEX.buildErrorMessage('appKey'); + errorMessage = VTEX.buildErrorMessage("appKey"); } else if (!appToken) { - errorMessage = VTEX.buildErrorMessage('appToken'); + errorMessage = VTEX.buildErrorMessage("appToken"); } if (errorMessage) { throw new Error(errorMessage); @@ -44,16 +49,29 @@ export class VTEX { */ readonly masterData: MasterData; + /** + * Catalog Module + */ + readonly catalog: Catalog; + /** * @param {string} store * @param {string} appKey * @param {string} appToken * @param {string} environment Default: 'stable' */ - constructor(store: string, appKey: string, appToken: string, environment: string = 'stable') { + constructor( + store: string, + appKey: string, + appToken: string, + environment: string = "stable" + ) { VTEX.validate(store, appKey, appToken); const vtexCredentials: VtexCredentials = new VtexCredentials( - store, appKey, appToken, environment, + store, + appKey, + appToken, + environment ); const vtexHttpClient: VtexHttpClient = new VtexHttpClient(vtexCredentials); @@ -62,5 +80,6 @@ export class VTEX { this.logistics = new Logistics(vtexHttpClient); this.pricing = new Pricing(vtexHttpClient); this.masterData = new MasterData(vtexHttpClient); + this.catalog = new Catalog(vtexHttpClient); } } diff --git a/src/VtexCredentials.ts b/src/VtexCredentials.ts index 52e5741..23a70c8 100644 --- a/src/VtexCredentials.ts +++ b/src/VtexCredentials.ts @@ -12,7 +12,12 @@ export class VtexCredentials { * @param {string} appKey * @param {string} appToken */ - constructor(store: string, appKey: string, appToken: string, environment: string) { + constructor( + store: string, + appKey: string, + appToken: string, + environment: string + ) { this.store = store; this.appKey = appKey; this.appToken = appToken; diff --git a/src/index.ts b/src/index.ts index 2698843..24190eb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1 +1 @@ -export * from './VTEX'; +export * from "./VTEX"; diff --git a/src/modules/AbstractApi.ts b/src/modules/AbstractApi.ts index f21d3d0..3754082 100644 --- a/src/modules/AbstractApi.ts +++ b/src/modules/AbstractApi.ts @@ -1,15 +1,15 @@ -import { VtexHttpClient } from '../utils/VtexHttpClient'; +import { VtexHttpClient } from "../utils/VtexHttpClient"; export abstract class AbstractApi { protected readonly vtexHttpClient: VtexHttpClient; protected readonly HTTP_METHODS = { - GET: 'GET', - POST: 'POST', - PUT: 'PUT', - DELETE: 'DELETE', - PATCH: 'PATCH', - } + GET: "GET", + POST: "POST", + PUT: "PUT", + DELETE: "DELETE", + PATCH: "PATCH", + }; constructor(vtexHttpClient: VtexHttpClient) { this.vtexHttpClient = vtexHttpClient; diff --git a/src/modules/OMS/OMS.ts b/src/modules/OMS/OMS.ts index d0de38e..a4f96c1 100644 --- a/src/modules/OMS/OMS.ts +++ b/src/modules/OMS/OMS.ts @@ -1,12 +1,12 @@ -import { VtexHttpClient } from '../../utils/VtexHttpClient'; -import { Orders } from './apis/orders'; -import { Invoice } from './apis/invoice'; -import { Tracking } from './apis/tracking'; -import { Payment } from './apis/payment'; -import { Feed } from './apis/feed/v3'; -import { OrderHook } from './apis/order-hook'; -import { ExportOrderReport } from './apis/export-order-report'; -import { UserOrders } from './apis/user-orders'; +import { VtexHttpClient } from "../../utils/VtexHttpClient"; +import { Orders } from "./apis/orders"; +import { Invoice } from "./apis/invoice"; +import { Tracking } from "./apis/tracking"; +import { Payment } from "./apis/payment"; +import { Feed } from "./apis/feed/v3"; +import { OrderHook } from "./apis/order-hook"; +import { ExportOrderReport } from "./apis/export-order-report"; +import { UserOrders } from "./apis/user-orders"; export class OMS { /** diff --git a/src/modules/OMS/apis/export-order-report/ExportOrderReport.ts b/src/modules/OMS/apis/export-order-report/ExportOrderReport.ts index bbb6d07..07c157c 100644 --- a/src/modules/OMS/apis/export-order-report/ExportOrderReport.ts +++ b/src/modules/OMS/apis/export-order-report/ExportOrderReport.ts @@ -1,15 +1,16 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; -import { ExportOrderReportResponseItem } from './responses/ExportOrderReportResponseItem'; +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { ExportOrderReportResponseItem } from "./responses/ExportOrderReportResponseItem"; export class ExportOrderReport extends AbstractApi { - private static readonly BASE_PATH: string = '/api/oms/pvt/admin/reports'; + private static readonly BASE_PATH: string = "/api/oms/pvt/admin/reports"; /** * @param {string} status 'inprogress' | 'completed' */ - exportOrderReport(status: string) - : Promise>> { + exportOrderReport( + status: string + ): Promise>> { const path = `${ExportOrderReport.BASE_PATH}/${status}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } diff --git a/src/modules/OMS/apis/export-order-report/index.ts b/src/modules/OMS/apis/export-order-report/index.ts index 986f4de..b62c36e 100644 --- a/src/modules/OMS/apis/export-order-report/index.ts +++ b/src/modules/OMS/apis/export-order-report/index.ts @@ -1 +1 @@ -export * from './ExportOrderReport'; +export * from "./ExportOrderReport"; diff --git a/src/modules/OMS/apis/feed/v3/Feed.ts b/src/modules/OMS/apis/feed/v3/Feed.ts index 7df2561..223c223 100644 --- a/src/modules/OMS/apis/feed/v3/Feed.ts +++ b/src/modules/OMS/apis/feed/v3/Feed.ts @@ -1,19 +1,20 @@ -import { AbstractApi } from '../../../../AbstractApi'; -import { VtexHttpResponse } from '../../../../../utils/VtexHttpResponse'; -import { RetrieveFeedOrderStatusResponse } from './responses/RetrieveFeedOrderStatusResponse'; -import { CommitItemFeedOrderStatusRequest } from './requests/CommitItemFeedOrderStatusRequest'; -import { UpdateFeedConfigurationRequest } from './requests/UpdateFeedConfigurationRequest'; -import { RetrieveFeedConfigurationResponse } from './responses/RetrieveFeedConfigurationResponse'; +import { AbstractApi } from "../../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../../utils/VtexHttpResponse"; +import { RetrieveFeedOrderStatusResponse } from "./responses/RetrieveFeedOrderStatusResponse"; +import { CommitItemFeedOrderStatusRequest } from "./requests/CommitItemFeedOrderStatusRequest"; +import { UpdateFeedConfigurationRequest } from "./requests/UpdateFeedConfigurationRequest"; +import { RetrieveFeedConfigurationResponse } from "./responses/RetrieveFeedConfigurationResponse"; export class Feed extends AbstractApi { - private static readonly BASE_PATH: string = '/api/orders/feed'; + private static readonly BASE_PATH: string = "/api/orders/feed"; /** * Lists feed order events. * @param {number} maxlot */ - retrieveFeedOrderStatus(maxlot: number) - : Promise>> { + retrieveFeedOrderStatus( + maxlot: number + ): Promise>> { const path = `${Feed.BASE_PATH}?maxlot=${maxlot}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } @@ -22,23 +23,37 @@ export class Feed extends AbstractApi { * Acknowledges an item's feed order status. * @param {CommitItemFeedOrderStatusRequest} events */ - commitItemFeedOrderStatus(events: CommitItemFeedOrderStatusRequest): Promise { - return this.vtexHttpClient.performRequest(Feed.BASE_PATH, this.HTTP_METHODS.POST, events); + commitItemFeedOrderStatus( + events: CommitItemFeedOrderStatusRequest + ): Promise { + return this.vtexHttpClient.performRequest( + Feed.BASE_PATH, + this.HTTP_METHODS.POST, + events + ); } /** * Configures the filter rule applied to Feed V3. * @param {UpdateFeedConfigurationRequest} feedConfig */ - updateFeedConfiguration(feedConfig: UpdateFeedConfigurationRequest): Promise { + updateFeedConfiguration( + feedConfig: UpdateFeedConfigurationRequest + ): Promise { const path = `${Feed.BASE_PATH}/config`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST, feedConfig); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + feedConfig + ); } /** * Lists a given Feed's configuration details. */ - retrieveFeedConfiguration(): Promise> { + retrieveFeedConfiguration(): Promise< + VtexHttpResponse + > { const path = `${Feed.BASE_PATH}/config`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } diff --git a/src/modules/OMS/apis/feed/v3/index.ts b/src/modules/OMS/apis/feed/v3/index.ts index 5ae1dae..75b8a9a 100644 --- a/src/modules/OMS/apis/feed/v3/index.ts +++ b/src/modules/OMS/apis/feed/v3/index.ts @@ -1 +1 @@ -export * from './Feed'; +export * from "./Feed"; diff --git a/src/modules/OMS/apis/invoice/Invoice.ts b/src/modules/OMS/apis/invoice/Invoice.ts index ee801d0..86551d0 100644 --- a/src/modules/OMS/apis/invoice/Invoice.ts +++ b/src/modules/OMS/apis/invoice/Invoice.ts @@ -1,12 +1,13 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { OrderInvoiceNotificationRequest } from './requests/OrderInvoiceNotificationRequest'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; -import { OrderInvoiceNotificationResponse } from './responses/OrderInvoiceNotificationResponse'; -import { SendTrackingNumberRequest } from './requests/SendTrackingNumberRequest'; -import { SendTrackingNumberResponse } from './responses/SendTrackingNumberResponse'; +import { AbstractApi } from "../../../AbstractApi"; +import { OrderInvoiceNotificationRequest } from "./requests/OrderInvoiceNotificationRequest"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { OrderInvoiceNotificationResponse } from "./responses/OrderInvoiceNotificationResponse"; +import { SendTrackingNumberRequest } from "./requests/SendTrackingNumberRequest"; +import { SendTrackingNumberResponse } from "./responses/SendTrackingNumberResponse"; export class Invoice extends AbstractApi { - private static readonly BASE_PATH: string = '/api/oms/pvt/orders/{orderId}/invoice'; + private static readonly BASE_PATH: string = + "/api/oms/pvt/orders/{orderId}/invoice"; /** * Sends Order invoice notifications. @@ -17,10 +18,16 @@ export class Invoice extends AbstractApi { * @param {string} orderId * @param {OrderInvoiceNotificationRequest} invoiceData */ - orderInvoiceNotification(orderId: string, invoiceData: OrderInvoiceNotificationRequest) - : Promise> { - const path = Invoice.BASE_PATH.replace('{orderId}', orderId); - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST, invoiceData); + orderInvoiceNotification( + orderId: string, + invoiceData: OrderInvoiceNotificationRequest + ): Promise> { + const path = Invoice.BASE_PATH.replace("{orderId}", orderId); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + invoiceData + ); } /** @@ -29,10 +36,18 @@ export class Invoice extends AbstractApi { * @param {string} invoiceNumber * @param {SendTrackingNumberRequest} trackingData */ - sendTrackingNumber(orderId: string, invoiceNumber: string, - trackingData: SendTrackingNumberRequest) - : Promise> { - const path = Invoice.BASE_PATH.replace('{orderId}', orderId).concat(`/${invoiceNumber}`); - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PATCH, trackingData); + sendTrackingNumber( + orderId: string, + invoiceNumber: string, + trackingData: SendTrackingNumberRequest + ): Promise> { + const path = Invoice.BASE_PATH.replace("{orderId}", orderId).concat( + `/${invoiceNumber}` + ); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PATCH, + trackingData + ); } } diff --git a/src/modules/OMS/apis/invoice/index.ts b/src/modules/OMS/apis/invoice/index.ts index b5a4c36..cf9eadb 100644 --- a/src/modules/OMS/apis/invoice/index.ts +++ b/src/modules/OMS/apis/invoice/index.ts @@ -1 +1 @@ -export * from './Invoice'; +export * from "./Invoice"; diff --git a/src/modules/OMS/apis/order-hook/OrderHook.ts b/src/modules/OMS/apis/order-hook/OrderHook.ts index e75bc34..655d89d 100644 --- a/src/modules/OMS/apis/order-hook/OrderHook.ts +++ b/src/modules/OMS/apis/order-hook/OrderHook.ts @@ -1,24 +1,31 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { CreateOrUpdateHookConfigurationRequest } from './requests/CreateOrUpdateHookConfigurationRequest'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; +import { AbstractApi } from "../../../AbstractApi"; +import { CreateOrUpdateHookConfigurationRequest } from "./requests/CreateOrUpdateHookConfigurationRequest"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; export class OrderHook extends AbstractApi { - private static readonly BASE_PATH: string = '/api/orders/hook/config'; + private static readonly BASE_PATH: string = "/api/orders/hook/config"; /** * Configure filter rules to Order Hook * @param {CreateOrUpdateHookConfigurationRequest} hookConfiguration */ - createOrUpdateHookConfiguration(hookConfiguration: CreateOrUpdateHookConfigurationRequest) - : Promise { - return this.vtexHttpClient - .performRequest(OrderHook.BASE_PATH, this.HTTP_METHODS.POST, hookConfiguration); + createOrUpdateHookConfiguration( + hookConfiguration: CreateOrUpdateHookConfigurationRequest + ): Promise { + return this.vtexHttpClient.performRequest( + OrderHook.BASE_PATH, + this.HTTP_METHODS.POST, + hookConfiguration + ); } /** * Deletes Hook configuration. */ deleteHookConfiguration(): Promise { - return this.vtexHttpClient.performRequest(OrderHook.BASE_PATH, this.HTTP_METHODS.DELETE); + return this.vtexHttpClient.performRequest( + OrderHook.BASE_PATH, + this.HTTP_METHODS.DELETE + ); } } diff --git a/src/modules/OMS/apis/order-hook/index.ts b/src/modules/OMS/apis/order-hook/index.ts index e80a7a8..d983c59 100644 --- a/src/modules/OMS/apis/order-hook/index.ts +++ b/src/modules/OMS/apis/order-hook/index.ts @@ -1 +1 @@ -export * from './OrderHook'; +export * from "./OrderHook"; diff --git a/src/modules/OMS/apis/orders/Orders.ts b/src/modules/OMS/apis/orders/Orders.ts index 1adc949..e34cc55 100644 --- a/src/modules/OMS/apis/orders/Orders.ts +++ b/src/modules/OMS/apis/orders/Orders.ts @@ -1,14 +1,14 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; -import { OrderChangeRequest } from './requests/OrderChangeRequest'; -import { OrderChangeResponse } from './responses/OrderChangeResponse'; -import { GetOrderResponse } from './responses/GetOrderResponse'; -import { ListOrdersResponse } from './responses/ListOrdersResponse'; -import { AddLogInOrderRequest } from './requests/AddLogInOrderRequest'; -import { ListOrderAttachmentResponse } from './responses/ListOrderAttachmentResponse'; +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { OrderChangeRequest } from "./requests/OrderChangeRequest"; +import { OrderChangeResponse } from "./responses/OrderChangeResponse"; +import { GetOrderResponse } from "./responses/GetOrderResponse"; +import { ListOrdersResponse } from "./responses/ListOrdersResponse"; +import { AddLogInOrderRequest } from "./requests/AddLogInOrderRequest"; +import { ListOrderAttachmentResponse } from "./responses/ListOrderAttachmentResponse"; export class Orders extends AbstractApi { - private static readonly BASE_PATH: string = '/api/oms/pvt/orders'; + private static readonly BASE_PATH: string = "/api/oms/pvt/orders"; /** * Lists order details by searching through order ID. @@ -53,10 +53,16 @@ export class Orders extends AbstractApi { * @param {string} orderId * @param {OrderChangeRequest} orderChange */ - registerChangeOnOrder(orderId: string, orderChange: OrderChangeRequest) - : Promise> { + registerChangeOnOrder( + orderId: string, + orderChange: OrderChangeRequest + ): Promise> { const path = `${Orders.BASE_PATH}/${orderId}/changes`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST, orderChange); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + orderChange + ); } /** @@ -64,9 +70,16 @@ export class Orders extends AbstractApi { * @param {string} orderId * @param {AddLogInOrderRequest} log */ - addLogInOrder(orderId: string, log: AddLogInOrderRequest): Promise { + addLogInOrder( + orderId: string, + log: AddLogInOrderRequest + ): Promise { const path = `${Orders.BASE_PATH}/${orderId}/interactions`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST, log); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + log + ); } /** @@ -74,8 +87,10 @@ export class Orders extends AbstractApi { * @param {string} orderId * @param {string} attachmentName */ - listOrderAttachment(orderId: string, attachmentName: string) - : Promise> { + listOrderAttachment( + orderId: string, + attachmentName: string + ): Promise> { const path = `${Orders.BASE_PATH}/${orderId}/message-attachment?attachmentName=${attachmentName}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } diff --git a/src/modules/OMS/apis/orders/index.ts b/src/modules/OMS/apis/orders/index.ts index 12f280e..7312f02 100644 --- a/src/modules/OMS/apis/orders/index.ts +++ b/src/modules/OMS/apis/orders/index.ts @@ -1 +1 @@ -export * from './Orders'; +export * from "./Orders"; diff --git a/src/modules/OMS/apis/orders/requests/OrderChangeRequest.ts b/src/modules/OMS/apis/orders/requests/OrderChangeRequest.ts index ae2b3f3..79dfc8c 100644 --- a/src/modules/OMS/apis/orders/requests/OrderChangeRequest.ts +++ b/src/modules/OMS/apis/orders/requests/OrderChangeRequest.ts @@ -8,6 +8,6 @@ export interface OrderChangeRequest { reason?: string; discountValue?: number; incrementValue?: number; - itemsRemoved?: Array - itemsAdded?: Array + itemsRemoved?: Array; + itemsAdded?: Array; } diff --git a/src/modules/OMS/apis/orders/responses/GetOrderResponse.ts b/src/modules/OMS/apis/orders/responses/GetOrderResponse.ts index 961c2aa..42c3cc3 100644 --- a/src/modules/OMS/apis/orders/responses/GetOrderResponse.ts +++ b/src/modules/OMS/apis/orders/responses/GetOrderResponse.ts @@ -142,7 +142,7 @@ interface ShippingData { address?: Address; logisticsInfo?: Array; trackingHints?: string; - selectedAddresses?: Array + selectedAddresses?: Array; } interface Transaction { diff --git a/src/modules/OMS/apis/payment/Payment.ts b/src/modules/OMS/apis/payment/Payment.ts index 615e662..b22a7ed 100644 --- a/src/modules/OMS/apis/payment/Payment.ts +++ b/src/modules/OMS/apis/payment/Payment.ts @@ -1,17 +1,21 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; -import { RetrievePaymentTransactionResponse } from './responses/RetrievePaymentTransactionResponse'; +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { RetrievePaymentTransactionResponse } from "./responses/RetrievePaymentTransactionResponse"; export class Payment extends AbstractApi { - private static readonly BASE_PATH: string = '/api/oms/pvt/orders/{orderId}' + private static readonly BASE_PATH: string = "/api/oms/pvt/orders/{orderId}"; /** * Retrieve transaction details by order ID. * @param {string} orderId */ - retrievePaymentTransaction(orderId: string) - : Promise> { - const path = `${Payment.BASE_PATH.replace('{orderId}', orderId)}/payment-transaction`; + retrievePaymentTransaction( + orderId: string + ): Promise> { + const path = `${Payment.BASE_PATH.replace( + "{orderId}", + orderId + )}/payment-transaction`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } @@ -20,8 +24,14 @@ export class Payment extends AbstractApi { * @param {string} orderId * @param {string} paymentId */ - sendPaymentNotification(orderId: string, paymentId: string): Promise { - const path = `${Payment.BASE_PATH.replace('{orderId}', orderId)}/payments/${paymentId}/payment-notification`; + sendPaymentNotification( + orderId: string, + paymentId: string + ): Promise { + const path = `${Payment.BASE_PATH.replace( + "{orderId}", + orderId + )}/payments/${paymentId}/payment-notification`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST); } } diff --git a/src/modules/OMS/apis/payment/index.ts b/src/modules/OMS/apis/payment/index.ts index a07ed8e..04125a2 100644 --- a/src/modules/OMS/apis/payment/index.ts +++ b/src/modules/OMS/apis/payment/index.ts @@ -1 +1 @@ -export * from './Payment'; +export * from "./Payment"; diff --git a/src/modules/OMS/apis/tracking/Tracking.ts b/src/modules/OMS/apis/tracking/Tracking.ts index 004bf7e..5c6fff3 100644 --- a/src/modules/OMS/apis/tracking/Tracking.ts +++ b/src/modules/OMS/apis/tracking/Tracking.ts @@ -1,7 +1,7 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { UpdateOrderTrackingStatusRequest } from './requests/UpdateOrderTrackingStatusRequest'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; -import { UpdateOrderTrackingStatusResponse } from './responses/UpdateOrderTrackingStatusResponse'; +import { AbstractApi } from "../../../AbstractApi"; +import { UpdateOrderTrackingStatusRequest } from "./requests/UpdateOrderTrackingStatusRequest"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { UpdateOrderTrackingStatusResponse } from "./responses/UpdateOrderTrackingStatusResponse"; export class Tracking extends AbstractApi { /** @@ -10,10 +10,16 @@ export class Tracking extends AbstractApi { * @param {string} invoiceNumber * @param {UpdateOrderTrackingStatusRequest} trackingData */ - updateOrderTrackingStatus(orderId: string, invoiceNumber: string, - trackingData: UpdateOrderTrackingStatusRequest) - : Promise> { + updateOrderTrackingStatus( + orderId: string, + invoiceNumber: string, + trackingData: UpdateOrderTrackingStatusRequest + ): Promise> { const path = `/api/oms/pvt/orders/${orderId}/invoice/${invoiceNumber}/tracking`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PUT, trackingData); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + trackingData + ); } } diff --git a/src/modules/OMS/apis/tracking/index.ts b/src/modules/OMS/apis/tracking/index.ts index b1f6b21..5a77bfc 100644 --- a/src/modules/OMS/apis/tracking/index.ts +++ b/src/modules/OMS/apis/tracking/index.ts @@ -1 +1 @@ -export * from './Tracking'; +export * from "./Tracking"; diff --git a/src/modules/OMS/apis/user-orders/UserOrders.ts b/src/modules/OMS/apis/user-orders/UserOrders.ts index 126e9e2..9f1431e 100644 --- a/src/modules/OMS/apis/user-orders/UserOrders.ts +++ b/src/modules/OMS/apis/user-orders/UserOrders.ts @@ -1,10 +1,10 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; -import { RetrieveUserOrdersResponse } from './responses/RetrieveUserOrdersResponse'; -import { GetOrderResponse } from '../orders/responses/GetOrderResponse'; +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { RetrieveUserOrdersResponse } from "./responses/RetrieveUserOrdersResponse"; +import { GetOrderResponse } from "../orders/responses/GetOrderResponse"; export class UserOrders extends AbstractApi { - private static readonly BASE_PATH: string = '/api/oms/user/orders'; + private static readonly BASE_PATH: string = "/api/oms/user/orders"; /** * Lists all orders from a given client, filtering by their email. @@ -12,8 +12,11 @@ export class UserOrders extends AbstractApi { * @param {number} page * @param {number} perPage */ - retrieveUserOrders(clientEmail: string, page: number, perPage: number) - : Promise> { + retrieveUserOrders( + clientEmail: string, + page: number, + perPage: number + ): Promise> { const path = `${UserOrders.BASE_PATH}?clientEmail=${clientEmail}&page=${page}&per_page=${perPage}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } @@ -23,8 +26,10 @@ export class UserOrders extends AbstractApi { * @param {string} orderId * @param {string} clientEmail */ - retrieveUserOrderDetails(orderId: string, clientEmail: string) - : Promise> { + retrieveUserOrderDetails( + orderId: string, + clientEmail: string + ): Promise> { const path = `${UserOrders.BASE_PATH}/${orderId}?clientEmail=${clientEmail}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } diff --git a/src/modules/OMS/apis/user-orders/index.ts b/src/modules/OMS/apis/user-orders/index.ts index 60fc401..91b433d 100644 --- a/src/modules/OMS/apis/user-orders/index.ts +++ b/src/modules/OMS/apis/user-orders/index.ts @@ -1 +1 @@ -export * from './UserOrders'; +export * from "./UserOrders"; diff --git a/src/modules/OMS/index.ts b/src/modules/OMS/index.ts index a09cadf..b4630c2 100644 --- a/src/modules/OMS/index.ts +++ b/src/modules/OMS/index.ts @@ -1 +1 @@ -export * from './OMS'; +export * from "./OMS"; diff --git a/src/modules/catalog/Catalog.ts b/src/modules/catalog/Catalog.ts new file mode 100644 index 0000000..b3a4dec --- /dev/null +++ b/src/modules/catalog/Catalog.ts @@ -0,0 +1,97 @@ +import { VtexHttpClient } from "../../utils/VtexHttpClient"; +import { SKUService } from "./apis/sku-service/SKUService"; +import { CategoryAndBrand } from "./apis/category-and-brand"; +import { Attachment } from "./apis/attachment"; +import { Product } from "./apis/product"; +import { TradePolicy } from "./apis/trade-policy"; +import { SKU } from "./apis/sku"; +import { Specification } from "./apis/specification"; +import { Collection } from "./apis/collection"; +import { Subcollection } from "./apis/subcollection"; +import { Supplier } from "./apis/supplier"; +import { SalesChannel } from "./apis/sales-channel"; +import { Seller } from "./apis/seller"; +import { Others } from "./apis/others"; + +export class Catalog { + /** + * SKU Service API + */ + readonly skuService: SKUService; + + /** + * Category and Brand API + */ + readonly categoryAndBrand: CategoryAndBrand; + + /** + * Attachment API + */ + readonly attachment: Attachment; + + /** + * Product API + */ + readonly product: Product; + + /** + * Trade Policy API + */ + readonly tradePolicy: TradePolicy; + + /** + * SKU API + */ + readonly sku: SKU; + + /** + * Specification API + */ + readonly specification: Specification; + + /** + * Collection API + */ + readonly collection: Collection; + + /** + * Subcollection API + */ + readonly subcollection: Subcollection; + + /** + * Supplier API + */ + readonly supplier: Supplier; + + /** + * Sales Channel API + */ + readonly salesChannel: SalesChannel; + + /** + * Seller Channel API + */ + readonly seller: Seller; + + /** + * Other Catalog API's + */ + readonly others: Others; + + constructor(vtexHttpClient: VtexHttpClient) { + this.skuService = new SKUService(vtexHttpClient); + this.categoryAndBrand = new CategoryAndBrand(vtexHttpClient); + this.attachment = new Attachment(vtexHttpClient); + this.product = new Product(vtexHttpClient); + this.tradePolicy = new TradePolicy(vtexHttpClient); + this.sku = new SKU(vtexHttpClient); + this.specification = new Specification(vtexHttpClient); + this.collection = new Collection(vtexHttpClient); + this.subcollection = new Subcollection(vtexHttpClient); + this.supplier = new Supplier(vtexHttpClient); + this.salesChannel = new SalesChannel(vtexHttpClient); + this.seller = new Seller(vtexHttpClient); + this.others = new Others(vtexHttpClient); + } +} diff --git a/src/modules/catalog/apis/attachment/Attachment.ts b/src/modules/catalog/apis/attachment/Attachment.ts new file mode 100644 index 0000000..27a4397 --- /dev/null +++ b/src/modules/catalog/apis/attachment/Attachment.ts @@ -0,0 +1,59 @@ +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { GetAttachmentResponse } from "./responses/GetAttachmentResponse"; +import { UpdateAttachmentRequest } from "./requests/UpdateAttachmentRequest"; + +export class Attachment extends AbstractApi { + private static readonly BASE_PATH: string = "/api/catalog/pvt/attachment"; + + /** + * Gets information about a registered attachment + * @param {string} attachmentId + */ + getAttachment( + attachmentId: string + ): Promise> { + const path = `${Attachment.BASE_PATH}/${attachmentId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Updates a previously existing SKU attachment with new information + * @param {string} attachmentId + * @param {UpdateAttachmentRequest} attachmentData + */ + updateAttachment( + attachmentId: string, + attachmentData: UpdateAttachmentRequest + ): Promise> { + const path = `${Attachment.BASE_PATH}/${attachmentId}`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + attachmentData + ); + } + + /** + * Deletes a previously existing SKU attachment + * @param {string} attachmentId + */ + deleteAttachment(attachmentId: string): Promise { + const path = `${Attachment.BASE_PATH}/${attachmentId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Creates a new SKU attachment from scratch + * @param {UpdateAttachmentRequest} attachmentData + */ + createAttachment( + attachmentData: UpdateAttachmentRequest + ): Promise> { + return this.vtexHttpClient.performRequest( + Attachment.BASE_PATH, + this.HTTP_METHODS.POST, + attachmentData + ); + } +} diff --git a/src/modules/catalog/apis/attachment/index.ts b/src/modules/catalog/apis/attachment/index.ts new file mode 100644 index 0000000..fa320b2 --- /dev/null +++ b/src/modules/catalog/apis/attachment/index.ts @@ -0,0 +1 @@ +export * from "./Attachment"; diff --git a/src/modules/catalog/apis/attachment/requests/UpdateAttachmentRequest.ts b/src/modules/catalog/apis/attachment/requests/UpdateAttachmentRequest.ts new file mode 100644 index 0000000..cd1b5b6 --- /dev/null +++ b/src/modules/catalog/apis/attachment/requests/UpdateAttachmentRequest.ts @@ -0,0 +1,9 @@ +export interface UpdateAttachmentRequest { + Name?: string; + IsActive?: boolean; + IsRequired?: boolean; + Domains?: Array; + FieldName?: string; + MaxCaracters?: string; + DomainValues?: string; +} diff --git a/src/modules/catalog/apis/attachment/responses/GetAttachmentResponse.ts b/src/modules/catalog/apis/attachment/responses/GetAttachmentResponse.ts new file mode 100644 index 0000000..6fb69c8 --- /dev/null +++ b/src/modules/catalog/apis/attachment/responses/GetAttachmentResponse.ts @@ -0,0 +1,10 @@ +export interface GetAttachmentResponse { + Id?: number; + Name?: string; + IsActive?: boolean; + IsRequired?: boolean; + Domains?: Array; + FieldName?: string; + MaxCaracters?: string; + DomainValues?: string; +} diff --git a/src/modules/catalog/apis/category-and-brand/CategoryAndBrand.ts b/src/modules/catalog/apis/category-and-brand/CategoryAndBrand.ts new file mode 100644 index 0000000..4f3bbd2 --- /dev/null +++ b/src/modules/catalog/apis/category-and-brand/CategoryAndBrand.ts @@ -0,0 +1,127 @@ +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { GetCategoryTreeResponseItem } from "./responses/GetCategoryTreeResponseItem"; +import { GetCategoryByIdResponse } from "./responses/GetCategoryByIdResponse"; +import { UpdateCategoryRequest } from "./requests/UpdateCategoryRequest"; +import { GetBrandResponse } from "./responses/GetBrandResponse"; +import { UpdateBrandRequest } from "./requests/UpdateBrandRequest"; + +export class CategoryAndBrand extends AbstractApi { + private static readonly BASE_PATH: string = "/api/catalog"; + + /** + * Retrieves the Category Tree of your store. + * Get all the category levels registered in the Catalog or define the level + * up to which you want to get. + * @param {number} categoryLevels + */ + getCategoryTree( + categoryLevels?: number + ): Promise>> { + const path = `${CategoryAndBrand.BASE_PATH}_system/pub/category/tree/${ + categoryLevels || "" + }`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Retrieves general information about a Category + * @param {number} categoryId + */ + getCategoryById( + categoryId: number + ): Promise> { + const path = `${CategoryAndBrand.BASE_PATH}/pvt/category/${categoryId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Updates a previously existing Category + * @param {number} categoryId + * @param {UpdateCategoryRequest} data + */ + updateCategory( + categoryId: number, + data: UpdateCategoryRequest + ): Promise> { + const path = `${CategoryAndBrand.BASE_PATH}/pvt/category/${categoryId}`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + data + ); + } + + /** + * Creates a new Category from scratch + * @param {UpdateCategoryRequest} data + */ + createCategory( + data: UpdateCategoryRequest + ): Promise> { + const path = `${CategoryAndBrand.BASE_PATH}/pvt/category`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + data + ); + } + + /** + * Retrieves all Brands registered in the store's Catalog. + */ + getBrandList(): Promise>> { + const path = `${CategoryAndBrand.BASE_PATH}_system/pvt/brand/list`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Retrieves a specific Brand by its ID. + * @param {string} brandId + */ + getBrand(brandId: string): Promise> { + const path = `${CategoryAndBrand.BASE_PATH}_system/pvt/brand/${brandId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Updates a previously existing Brand + * @param {string} brandId + * @param {UpdateBrandRequest} brandData + */ + updateBrand( + brandId: string, + brandData: UpdateBrandRequest + ): Promise> { + const path = `${CategoryAndBrand.BASE_PATH}/pvt/brand/${brandId}`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + brandData + ); + } + + /** + * Deletes an existing Brand + * @param {string} brandId + */ + deleteBrand(brandId: string): Promise { + const path = `${CategoryAndBrand.BASE_PATH}/pvt/brand/${brandId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Creates a new Brand from scratch + * @param {UpdateBrandRequest} brandData + */ + createBrand( + brandData: UpdateBrandRequest + ): Promise> { + const path = `${CategoryAndBrand.BASE_PATH}/pvt/brand`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + brandData + ); + } +} diff --git a/src/modules/catalog/apis/category-and-brand/index.ts b/src/modules/catalog/apis/category-and-brand/index.ts new file mode 100644 index 0000000..f4af1aa --- /dev/null +++ b/src/modules/catalog/apis/category-and-brand/index.ts @@ -0,0 +1 @@ +export * from "./CategoryAndBrand"; diff --git a/src/modules/catalog/apis/category-and-brand/requests/UpdateBrandRequest.ts b/src/modules/catalog/apis/category-and-brand/requests/UpdateBrandRequest.ts new file mode 100644 index 0000000..0a61fd6 --- /dev/null +++ b/src/modules/catalog/apis/category-and-brand/requests/UpdateBrandRequest.ts @@ -0,0 +1,13 @@ +export interface UpdateBrandRequest { + Id?: number; + Name?: string; + Text?: string; + Keywords?: string; + SiteTitle?: string; + Active?: boolean; + MenuHome?: boolean; + AdWordsRemarketingCode?: string; + LomadeeCampaignCode?: string; + Score?: number; + LinkId?: string; +} diff --git a/src/modules/catalog/apis/category-and-brand/requests/UpdateCategoryRequest.ts b/src/modules/catalog/apis/category-and-brand/requests/UpdateCategoryRequest.ts new file mode 100644 index 0000000..34e0cfa --- /dev/null +++ b/src/modules/catalog/apis/category-and-brand/requests/UpdateCategoryRequest.ts @@ -0,0 +1,16 @@ +export interface UpdateCategoryRequest { + Name?: string; + FatherCategoryId?: number; + Title?: string; + Description?: string; + Keywords?: string; + IsActive?: boolean; + LomadeeCampaignCode?: string; + AdWordsRemarketingCode?: string; + ShowInStoreFront?: boolean; + ShowBrandFilter?: boolean; + ActiveStoreFrontLink?: boolean; + GlobalCategoryId?: number; + StockKeepingUnitSelectionMode?: string; + Score?: number; +} diff --git a/src/modules/catalog/apis/category-and-brand/responses/GetBrandResponse.ts b/src/modules/catalog/apis/category-and-brand/responses/GetBrandResponse.ts new file mode 100644 index 0000000..d227f93 --- /dev/null +++ b/src/modules/catalog/apis/category-and-brand/responses/GetBrandResponse.ts @@ -0,0 +1,8 @@ +export interface GetBrandResponse { + id?: number; + name?: string; + imageUrl?: string; + isActive?: boolean; + title?: string; + metaTagDescription?: string; +} diff --git a/src/modules/catalog/apis/category-and-brand/responses/GetCategoryByIdResponse.ts b/src/modules/catalog/apis/category-and-brand/responses/GetCategoryByIdResponse.ts new file mode 100644 index 0000000..58de56b --- /dev/null +++ b/src/modules/catalog/apis/category-and-brand/responses/GetCategoryByIdResponse.ts @@ -0,0 +1,19 @@ +export interface GetCategoryByIdResponse { + Id?: number; + Name?: string; + FatherCategoryId?: number; + Title?: string; + Description?: string; + Keywords?: string; + IsActive?: boolean; + LomadeeCampaignCode?: string; + AdWordsRemarketingCode?: string; + ShowInStoreFront?: boolean; + ShowBrandFilter?: boolean; + ActiveStoreFrontLink?: boolean; + GlobalCategoryId?: number; + StockKeepingUnitSelectionMode?: string; + Score?: number; + LinkId?: string; + HasChildren?: boolean; +} diff --git a/src/modules/catalog/apis/category-and-brand/responses/GetCategoryTreeResponseItem.ts b/src/modules/catalog/apis/category-and-brand/responses/GetCategoryTreeResponseItem.ts new file mode 100644 index 0000000..7f2d4b5 --- /dev/null +++ b/src/modules/catalog/apis/category-and-brand/responses/GetCategoryTreeResponseItem.ts @@ -0,0 +1,9 @@ +export interface GetCategoryTreeResponseItem { + id?: number; + name?: string; + hasChildren?: boolean; + url?: string; + children?: Array; + Title?: string; + MetaTagDescription?: string; +} diff --git a/src/modules/catalog/apis/collection/Collection.ts b/src/modules/catalog/apis/collection/Collection.ts new file mode 100644 index 0000000..721bab8 --- /dev/null +++ b/src/modules/catalog/apis/collection/Collection.ts @@ -0,0 +1,59 @@ +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { GetCollectionResponse } from "./responses/GetCollectionResponse"; +import { UpdateCollectionRequest } from "./requests/UpdateCollectionRequest"; + +export class Collection extends AbstractApi { + private static readonly BASE_PATH: string = "/api/catalog/pvt/collection"; + + /** + * Gets general information of a Collection + * @param {number} collectionId + */ + getCollection( + collectionId: number + ): Promise> { + const path = `${Collection.BASE_PATH}/${collectionId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Updates a previously Collection + * @param {number} collectionId + * @param {UpdateCollectionRequest} collectionData + */ + updateCollection( + collectionId: number, + collectionData: UpdateCollectionRequest + ): Promise> { + const path = `${Collection.BASE_PATH}/${collectionId}`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + collectionData + ); + } + + /** + * Deletes a previously existing Collection + * @param {number} collectionId + */ + deleteCollection(collectionId: number): Promise { + const path = `${Collection.BASE_PATH}/${collectionId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Creates a new Collection + * @param {UpdateCollectionRequest} collectionData + */ + createCollection( + collectionData: UpdateCollectionRequest + ): Promise> { + return this.vtexHttpClient.performRequest( + Collection.BASE_PATH, + this.HTTP_METHODS.POST, + collectionData + ); + } +} diff --git a/src/modules/catalog/apis/collection/index.ts b/src/modules/catalog/apis/collection/index.ts new file mode 100644 index 0000000..cbb3f0f --- /dev/null +++ b/src/modules/catalog/apis/collection/index.ts @@ -0,0 +1 @@ +export * from "./Collection"; diff --git a/src/modules/catalog/apis/collection/requests/UpdateCollectionRequest.ts b/src/modules/catalog/apis/collection/requests/UpdateCollectionRequest.ts new file mode 100644 index 0000000..251547c --- /dev/null +++ b/src/modules/catalog/apis/collection/requests/UpdateCollectionRequest.ts @@ -0,0 +1,7 @@ +export interface UpdateCollectionRequest { + Name?: string; + Searchable?: boolean; + Highlight?: boolean; + DateFrom?: string; + DateTo?: string; +} diff --git a/src/modules/catalog/apis/collection/responses/GetCollectionResponse.ts b/src/modules/catalog/apis/collection/responses/GetCollectionResponse.ts new file mode 100644 index 0000000..564f708 --- /dev/null +++ b/src/modules/catalog/apis/collection/responses/GetCollectionResponse.ts @@ -0,0 +1,7 @@ +import { UpdateCollectionRequest } from "../requests/UpdateCollectionRequest"; + +export interface GetCollectionResponse extends UpdateCollectionRequest { + Id?: number; + Description?: string; + TotalProducts?: number; +} diff --git a/src/modules/catalog/apis/others/Others.ts b/src/modules/catalog/apis/others/Others.ts new file mode 100644 index 0000000..b099b9a --- /dev/null +++ b/src/modules/catalog/apis/others/Others.ts @@ -0,0 +1,24 @@ +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; + +export class Others extends AbstractApi { + private static readonly BASE_PATH: string = "/api/catalog_system/pvt"; + + /** + * Notify a change in SKU Seller to VTEX + * @param {string} stockKeepingUnitId + */ + changeNotification(stockKeepingUnitId: string): Promise { + const path = `${Others.BASE_PATH}/skuseller/changenotification/${stockKeepingUnitId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Retrieve details of Product Indexed Info + * @param {string} productId + */ + getIndexedInfo(productId: string): Promise { + const path = `${Others.BASE_PATH}products/GetIndexedInfo/${productId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } +} diff --git a/src/modules/catalog/apis/others/index.ts b/src/modules/catalog/apis/others/index.ts new file mode 100644 index 0000000..b283743 --- /dev/null +++ b/src/modules/catalog/apis/others/index.ts @@ -0,0 +1 @@ +export * from "./Others"; diff --git a/src/modules/catalog/apis/product/Product.ts b/src/modules/catalog/apis/product/Product.ts new file mode 100644 index 0000000..e304438 --- /dev/null +++ b/src/modules/catalog/apis/product/Product.ts @@ -0,0 +1,197 @@ +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { GetProductByIdResponse } from "./responses/GetProductByIdResponse"; +import { UpdateProductRequest } from "./requests/UpdateProductRequest"; +import { GetProductVariationsResponse } from "./responses/GetProductVariationsResponse"; +import { GetProductSpecificationResponseItem } from "./responses/GetProductSpecificationResponseItem"; +import { CreateProductSpecificationRequest } from "./requests/CreateProductSpecificationRequest"; +import { CreateProductSpecificationResponse } from "./responses/CreateProductSpecificationResponse"; +import { CreateSimilarProductCategoryResponse } from "./responses/CreateSimilarProductCategoryResponse"; + +export class Product extends AbstractApi { + private static readonly BASE_PATH: string = "/api/catalog"; + + /** + * Retrieves the IDs of all products and SKUs from a specific category by this category's ID. + * @param {number} categoryId + * @param {number} from + * @param {number} to + */ + getProductAndSkuIds( + categoryId: number, + from: number, + to: number + ): Promise { + const path = `${Product.BASE_PATH}_system/pvt/products/GetProductAndSkuIds?categoryId=${categoryId}&_from=${from}&_to=${to}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Retrieves a specific product by its ID. + * @param {string} productId + */ + getProductById( + productId: string + ): Promise> { + const path = `${Product.BASE_PATH}/pvt/product/${productId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Updates an existent Product + * @param {string} productId + * @param {UpdateProductRequest} productData + */ + updateProduct( + productId: string, + productData: UpdateProductRequest + ): Promise> { + const path = `${Product.BASE_PATH}/pvt/product/${productId}`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + productData + ); + } + + /** + * Retrieves a specific product by its Reference ID. + * @param {string} refId + */ + getProductByRefId( + refId: string + ): Promise> { + const path = `${Product.BASE_PATH}_system/pvt/products/productgetbyrefid/${refId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Retrieves data about the product and all SKUs related to it by the product's ID. + * @param {string} productId + */ + getProductVariations( + productId: string + ): Promise> { + const path = `${Product.BASE_PATH}_system/pub/products/variations/${productId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Retrieves the review rate of a product by this product's ID. + * @param {string} productId + */ + getProductReviewDate(productId: string): Promise { + const path = `/api/addon/pvt/review/GetProductRate/${productId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Creates a new Product from scratch + * @param {UpdateProductRequest} productData + */ + createProduct( + productData: UpdateProductRequest + ): Promise> { + const path = `${Product.BASE_PATH}/pvt/product`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + productData + ); + } + + /** + * Retrieves all specifications of a product by the product's ID. + * @param {string} productId + */ + getProductSpecification( + productId: string + ): Promise>> { + const path = `${Product.BASE_PATH}_system/pvt/products/${productId}/specification`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Updates the value of a product specification by the product's ID. + * The ID or name can be used to identify what product specification will be updated. + * Specification fields must be previously created in your Catalog. + * @param {string} productId + * @param {Array} productSpecificationData + */ + updateProductSpecification( + productId: string, + productSpecificationData: Array + ): Promise>> { + const path = `${Product.BASE_PATH}_system/pvt/products/${productId}/specification`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + productSpecificationData + ); + } + + /** + * Creates a new Product Specification based on a previously defined Field + * @param {string} productId + * @param {CreateProductSpecificationRequest} productSpecificationData + */ + createProductSpecification( + productId: string, + productSpecificationData: CreateProductSpecificationRequest + ): Promise> { + const path = `${Product.BASE_PATH}/pvt/product/${productId}/specification`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + productSpecificationData + ); + } + + /** + * Deletes all Product Specifications + * @param {string} productId + */ + deleteAllProductSpecification(productId: string): Promise { + const path = `${Product.BASE_PATH}/pvt/product/${productId}/specification`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Deletes a specific Product Specification + * @param {string} productId + * @param {string} specificationId + */ + deleteProductSpecification( + productId: string, + specificationId: string + ): Promise { + const path = `${Product.BASE_PATH}/pvt/product/${productId}/specification/${specificationId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Creates a Similar Category to a Product + * @param {string} productId + * @param {string} categoryId + */ + createSimilarProductCategory( + productId: string, + categoryId: string + ): Promise> { + const path = `${Product.BASE_PATH}/pvt/product/${productId}/similarcategory/${categoryId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST); + } + + /** + * Deletes a Similar Category from a Product + * @param {string} productId + * @param {string} categoryId + */ + deleteSimilarProductCategory( + productId: string, + categoryId: string + ): Promise { + const path = `${Product.BASE_PATH}/pvt/product/${productId}/similarcategory/${categoryId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } +} diff --git a/src/modules/catalog/apis/product/index.ts b/src/modules/catalog/apis/product/index.ts new file mode 100644 index 0000000..b405045 --- /dev/null +++ b/src/modules/catalog/apis/product/index.ts @@ -0,0 +1 @@ +export * from "./Product"; diff --git a/src/modules/catalog/apis/product/requests/CreateProductSpecificationRequest.ts b/src/modules/catalog/apis/product/requests/CreateProductSpecificationRequest.ts new file mode 100644 index 0000000..b1398c1 --- /dev/null +++ b/src/modules/catalog/apis/product/requests/CreateProductSpecificationRequest.ts @@ -0,0 +1,5 @@ +export interface CreateProductSpecificationRequest { + FieldId?: number; + FieldValueId?: number; + Text?: string; +} diff --git a/src/modules/catalog/apis/product/requests/UpdateProductRequest.ts b/src/modules/catalog/apis/product/requests/UpdateProductRequest.ts new file mode 100644 index 0000000..5960125 --- /dev/null +++ b/src/modules/catalog/apis/product/requests/UpdateProductRequest.ts @@ -0,0 +1,22 @@ +export interface UpdateProductRequest { + Name?: string; + DepartmentId?: number; + CategoryId?: number; + BrandId?: number; + LinkId?: string; + RefId?: string; + IsVisible?: boolean; + Description?: string; + DescriptionShort?: string; + ReleaseDate?: string; + KeyWords?: string; + Title?: string; + IsActive?: boolean; + TaxCode?: string; + MetaTagDescription?: string; + SupplierId?: number; + ShowWithoutStock?: boolean; + ListStoreId?: Array; + AdWordsRemarketingCode?: string; + LomadeeCampaignCode?: string; +} diff --git a/src/modules/catalog/apis/product/responses/CreateProductSpecificationResponse.ts b/src/modules/catalog/apis/product/responses/CreateProductSpecificationResponse.ts new file mode 100644 index 0000000..ecfd7b0 --- /dev/null +++ b/src/modules/catalog/apis/product/responses/CreateProductSpecificationResponse.ts @@ -0,0 +1,6 @@ +export interface CreateProductSpecificationResponse { + Id?: number; + FieldId?: number; + FieldValueId?: number; + Text?: string; +} diff --git a/src/modules/catalog/apis/product/responses/CreateSimilarProductCategoryResponse.ts b/src/modules/catalog/apis/product/responses/CreateSimilarProductCategoryResponse.ts new file mode 100644 index 0000000..4b27f52 --- /dev/null +++ b/src/modules/catalog/apis/product/responses/CreateSimilarProductCategoryResponse.ts @@ -0,0 +1,4 @@ +export interface CreateSimilarProductCategoryResponse { + ProductId?: number; + StoreId?: number; +} diff --git a/src/modules/catalog/apis/product/responses/GetProductByIdResponse.ts b/src/modules/catalog/apis/product/responses/GetProductByIdResponse.ts new file mode 100644 index 0000000..5626832 --- /dev/null +++ b/src/modules/catalog/apis/product/responses/GetProductByIdResponse.ts @@ -0,0 +1,23 @@ +export interface GetProductByIdResponse { + Id?: number; + Name?: string; + DepartmentId?: number; + CategoryId?: number; + BrandId?: number; + LinkId?: string; + RefId?: string; + IsVisible?: boolean; + Description?: string; + DescriptionShort?: string; + ReleaseDate?: string; + KeyWords?: string; + Title?: string; + IsActive?: boolean; + TaxCode?: string; + MetaTagDescription?: string; + SupplierId?: number; + ShowWithoutStock?: boolean; + ListStoreId?: Array; + AdWordsRemarketingCode?: string; + LomadeeCampaignCode?: string; +} diff --git a/src/modules/catalog/apis/product/responses/GetProductSpecificationResponseItem.ts b/src/modules/catalog/apis/product/responses/GetProductSpecificationResponseItem.ts new file mode 100644 index 0000000..826f828 --- /dev/null +++ b/src/modules/catalog/apis/product/responses/GetProductSpecificationResponseItem.ts @@ -0,0 +1,5 @@ +export interface GetProductSpecificationResponseItem { + Value?: Array; + Id?: number; + Name?: number; +} diff --git a/src/modules/catalog/apis/product/responses/GetProductVariationsResponse.ts b/src/modules/catalog/apis/product/responses/GetProductVariationsResponse.ts new file mode 100644 index 0000000..f88a57c --- /dev/null +++ b/src/modules/catalog/apis/product/responses/GetProductVariationsResponse.ts @@ -0,0 +1,43 @@ +interface Measures { + cubicweight?: number; + height?: number; + length?: number; + weight?: number; + width?: number; +} + +interface Sku { + sku?: number; + skuname?: string; + dimensions?: any; + available?: boolean; + availablequantity?: number; + cacheVersionUsedToCallCheckout?: string; + listPriceFormated?: string; + listPrice?: number; + taxFormated?: string; + taxAsInt?: number; + bestPriceFormated?: string; + bestPrice?: number; + installments?: number; + installmentsValue?: number; + installmentsInsterestRate?: number; + image?: string; + sellerId?: string; + seller?: string; + measures?: Measures; + unitMultiplier?: number; + rewardValue?: number; +} + +export interface GetProductVariationsResponse { + productId?: number; + name?: string; + salesChannel?: number; + available?: boolean; + displayMode?: number; + dimensions?: string; + dimensionsInputType?: string; + dimensionsMap?: boolean; + skus?: Array; +} diff --git a/src/modules/catalog/apis/sales-channel/SalesChannel.ts b/src/modules/catalog/apis/sales-channel/SalesChannel.ts new file mode 100644 index 0000000..e445e97 --- /dev/null +++ b/src/modules/catalog/apis/sales-channel/SalesChannel.ts @@ -0,0 +1,28 @@ +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { GetSalesChannelListResponseItem } from "./responses/GetSalesChannelListResponseItem"; + +export class SalesChannel extends AbstractApi { + private static readonly BASE_PATH: string = "/api/catalog_system"; + + /** + * Retrieves a list with details about the store's sales channels. + */ + getSalesChannelList(): Promise< + VtexHttpResponse> + > { + const path = `${SalesChannel.BASE_PATH}/pvt/saleschannel/list`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Retrieves a specific sales channel by its ID. + * @param {string} salesChannelId + */ + getSalesChannelById( + salesChannelId: string + ): Promise> { + const path = `${SalesChannel.BASE_PATH}/pub/saleschannel/${salesChannelId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } +} diff --git a/src/modules/catalog/apis/sales-channel/index.ts b/src/modules/catalog/apis/sales-channel/index.ts new file mode 100644 index 0000000..2c59417 --- /dev/null +++ b/src/modules/catalog/apis/sales-channel/index.ts @@ -0,0 +1 @@ +export * from "./SalesChannel"; diff --git a/src/modules/catalog/apis/sales-channel/responses/GetSalesChannelListResponseItem.ts b/src/modules/catalog/apis/sales-channel/responses/GetSalesChannelListResponseItem.ts new file mode 100644 index 0000000..5fd816b --- /dev/null +++ b/src/modules/catalog/apis/sales-channel/responses/GetSalesChannelListResponseItem.ts @@ -0,0 +1,24 @@ +interface CurrencyFormatInfo { + CurrencyDecimalDigits?: number; + CurrencyDecimalSeparator?: string; + CurrencyGroupSeparator?: string; + CurrencyGroupSize?: string; + StartsWithCurrencySymbol?: boolean; +} + +export interface GetSalesChannelListResponseItem { + Id?: number; + Name?: string; + IsActive?: boolean; + ProductClusterId?: number; + CountryCode?: string; + CultureInfo?: string; + TimeZone?: string; + CurrencyCode?: string; + CurrencySymbol?: string; + CurrencyLocale?: number; + CurrencyFormatInfo?: CurrencyFormatInfo; + Origin?: string; + Position?: number; + ConditionRule?: number; +} diff --git a/src/modules/catalog/apis/seller/Seller.ts b/src/modules/catalog/apis/seller/Seller.ts new file mode 100644 index 0000000..94c5aca --- /dev/null +++ b/src/modules/catalog/apis/seller/Seller.ts @@ -0,0 +1,89 @@ +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { GetSellerByIdResponse } from "./responses/GetSellerByIdResponse"; + +export class Seller extends AbstractApi { + private static readonly BASE_PATH: string = "/api/catalog_system/pvt"; + + /** + * Retrieves the seller's details by its ID. + * @param {string} sellerId + */ + getSellerById( + sellerId: string + ): Promise> { + const path = `${Seller.BASE_PATH}/seller/${sellerId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Creates a new seller. + * @param {string} sellerId + * @param {CreateSellerRequest} sellerData + */ + createSeller( + sellerId: string, + sellerData: GetSellerByIdResponse + ): Promise { + const path = `${Seller.BASE_PATH}/seller/${sellerId}`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + sellerData + ); + } + + /** + * Updates a seller. + * @param {string} sellerId + * @param {CreateSellerRequest} sellerData + */ + updateSeller( + sellerId: string, + sellerData: GetSellerByIdResponse + ): Promise { + const path = `${Seller.BASE_PATH}/seller/${sellerId}`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + sellerData + ); + } + + /** + * Retrieves the seller's details by its ID. + * @param {string} params Example: sc=1&sellerType=1&isBetterScope=false + */ + getSellerList( + params?: string + ): Promise>> { + const path = `${Seller.BASE_PATH}/seller/list?${params || ""}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Retrieves the details of a seller's SKU by its ID. + * @param {string} sellerId + * @param {string} sellerSkuId + */ + getSKUSeller( + sellerId: string, + sellerSkuId: string + ): Promise { + const path = `${Seller.BASE_PATH}/skuseller/${sellerId}/${sellerSkuId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Remove the Seller SKU binding + * @param {string} sellerId + * @param {string} sellerSkuId + */ + deleteSKUSellerAssociation( + sellerId: string, + sellerSkuId: string + ): Promise { + const path = `${Seller.BASE_PATH}/skuseller/${sellerId}/${sellerSkuId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } +} diff --git a/src/modules/catalog/apis/seller/index.ts b/src/modules/catalog/apis/seller/index.ts new file mode 100644 index 0000000..49e2d1a --- /dev/null +++ b/src/modules/catalog/apis/seller/index.ts @@ -0,0 +1 @@ +export * from "./Seller"; diff --git a/src/modules/catalog/apis/seller/responses/GetSKUSellerResponse.ts b/src/modules/catalog/apis/seller/responses/GetSKUSellerResponse.ts new file mode 100644 index 0000000..2b414b7 --- /dev/null +++ b/src/modules/catalog/apis/seller/responses/GetSKUSellerResponse.ts @@ -0,0 +1,11 @@ +export interface GetSKUSellerResponse { + IsPersisted?: boolean; + IsRemoved?: boolean; + SkuSellerId?: number; + SellerId?: string; + StockKeepingUnitId?: number; + SellerStockKeepingUnitId?: string; + IsActive?: boolean; + UpdateDate?: string; + RequestedUpdateDate?: string; +} diff --git a/src/modules/catalog/apis/seller/responses/GetSellerByIdResponse.ts b/src/modules/catalog/apis/seller/responses/GetSellerByIdResponse.ts new file mode 100644 index 0000000..665098c --- /dev/null +++ b/src/modules/catalog/apis/seller/responses/GetSellerByIdResponse.ts @@ -0,0 +1,26 @@ +export interface GetSellerByIdResponse { + SellerId?: number; + Name?: string; + Email?: string; + Description?: string; + ExchangeReturnPolicy?: string; + DeliveryPolicy?: string; + UseHybridPaymentOptions?: boolean; + UserName?: string; + Password?: string; + SecutityPrivacyPolicy?: string; + CNPJ?: string; + CSCIdentification?: string; + ArchiveId?: number; + UrlLogo?: string; + ProductCommissionPercentage?: number; + FreightCommissionPercentage?: number; + CategoryCommissionPercentage?: number; + FulfillmentEndpoint?: string; + CatalogSystemEndpoint?: string; + IsActive?: boolean; + FulfillmentSellerId?: string; + SellerType?: number; + IsBetterScope?: boolean; + Category?: string; +} diff --git a/src/modules/catalog/apis/sku-service/SKUService.ts b/src/modules/catalog/apis/sku-service/SKUService.ts new file mode 100644 index 0000000..964f54f --- /dev/null +++ b/src/modules/catalog/apis/sku-service/SKUService.ts @@ -0,0 +1,187 @@ +import { AbstractApi } from "../../../AbstractApi"; +import { UpdateSKUServiceRequest } from "./requests/UpdateSKUServiceRequest"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { UpdateSKUServiceResponse } from "./responses/UpdateSKUServiceResponse"; +import { AssociateSKUServiceRequest } from "./requests/AssociateSKUServiceRequest"; +import { AssociateSKUServiceResponse } from "./responses/AssociateSKUServiceResponse"; +import { AssociateSKUServiceAttachmentRequest } from "./requests/AssociateSKUServiceAttachmentRequest"; +import { AssociateSKUServiceAttachmentResponse } from "./responses/AssociateSKUServiceAttachmentResponse"; +import { UpdateSKUServiceValueRequest } from "./requests/UpdateSKUServiceValueRequest"; +import { UpdateSKUServiceValueResponse } from "./responses/UpdateSKUServiceValueResponse"; +import { UpdateSKUServiceTypeRequest } from "./requests/UpdateSKUServiceTypeRequest"; +import { UpdateSKUServiceTypeResponse } from "./responses/UpdateSKUServiceTypeResponse"; + +export class SKUService extends AbstractApi { + private static readonly BASE_PATH: string = "/api/catalog/pvt/skuservice"; + + /** + * Updates an SKU Service from an SKU + * @param {number} skuServiceId + * @param {UpdateSKUServiceRequest} data + */ + updateSKUService( + skuServiceId: number, + data: UpdateSKUServiceRequest + ): Promise> { + const path = `${SKUService.BASE_PATH}/${skuServiceId}`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + data + ); + } + + /** + * Dissociates an SKU Service from an SKU + * @param {number} skuServiceId + */ + dissociateSKUService(skuServiceId: number): Promise { + const path = `${SKUService.BASE_PATH}/${skuServiceId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Associates an SKU Service to an SKU + * @param {AssociateSKUServiceRequest} data + */ + associateSKUService( + data: AssociateSKUServiceRequest + ): Promise> { + return this.vtexHttpClient.performRequest( + SKUService.BASE_PATH, + this.HTTP_METHODS.POST, + data + ); + } + + /** + * typeattachment/skuServiceTypeAttachmentId + * @param {number} skuServiceTypeAttachmentId + */ + dissociateAttachmentFromSKUServiceType( + skuServiceTypeAttachmentId: number + ): Promise { + const path = `${SKUService.BASE_PATH}typeattachment/${skuServiceTypeAttachmentId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Associates an Attachment for an existing SKU Service Type + * @param {AssociateSKUServiceAttachmentRequest} data + */ + associateSKUServiceAttachment( + data: AssociateSKUServiceAttachmentRequest + ): Promise> { + const path = `${SKUService.BASE_PATH}typeattachment`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + data + ); + } + + /** + * Dissociates an Attachment by its Attachment ID or SKU Service Type ID from an SKU Service Type + * @param {number} attachmentId + * @param {number} skuServiceTypeId + */ + dissociateAttachmentByAttachmentIDorSKUServiceTypeID( + attachmentId?: number, + skuServiceTypeId?: number + ): Promise { + let params = "?"; + if (attachmentId) { + params += `attachmentId=${attachmentId}`; + } + if (attachmentId && skuServiceTypeId) { + params += "&"; + } + if (skuServiceTypeId) { + params += `skuServiceTypeId=${skuServiceTypeId}`; + } + const path = `${SKUService.BASE_PATH}typeattachment${params}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Updates an existing SKU Service Value + * @param {number} skuServiceValueId + * @param {UpdateSKUServiceValueRequest} data + */ + updateSKUServiceValue( + skuServiceValueId: number, + data: UpdateSKUServiceValueRequest + ): Promise> { + const path = `${SKUService.BASE_PATH}value/${skuServiceValueId}`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + data + ); + } + + /** + * Deletes an existing SKU Service Value + * @param {number} skuServiceValueId + */ + deleteSKUServiceValue(skuServiceValueId: number): Promise { + const path = `${SKUService.BASE_PATH}value/${skuServiceValueId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Creates an SKU Service Value for an existing SKU Service Type + * @param {UpdateSKUServiceValueRequest} data + */ + createSKUServiceValue( + data: UpdateSKUServiceValueRequest + ): Promise> { + const path = `${SKUService.BASE_PATH}value`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + data + ); + } + + /** + * Updates an existing SKU Service Type + * @param {number} skuServiceTypeId + * @param {UpdateSKUServiceTypeRequest} data + */ + updateSKUServiceType( + skuServiceTypeId: number, + data: UpdateSKUServiceTypeRequest + ): Promise> { + const path = `${SKUService.BASE_PATH}type/${skuServiceTypeId}`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + data + ); + } + + /** + * Deletes an existing SKU Service Type + * @param {number} skuServiceTypeId + */ + deleteSKUServiceType(skuServiceTypeId: number): Promise { + const path = `${SKUService.BASE_PATH}type/${skuServiceTypeId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Creates an SKU Service Type from scratch + * @param {UpdateSKUServiceTypeRequest} data + */ + createSKUServiceType( + data: UpdateSKUServiceTypeRequest + ): Promise> { + const path = `${SKUService.BASE_PATH}type`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + data + ); + } +} diff --git a/src/modules/catalog/apis/sku-service/requests/AssociateSKUServiceAttachmentRequest.ts b/src/modules/catalog/apis/sku-service/requests/AssociateSKUServiceAttachmentRequest.ts new file mode 100644 index 0000000..708c966 --- /dev/null +++ b/src/modules/catalog/apis/sku-service/requests/AssociateSKUServiceAttachmentRequest.ts @@ -0,0 +1,4 @@ +export interface AssociateSKUServiceAttachmentRequest { + AttachmentId?: number; + SkuServiceTypeId?: number; +} diff --git a/src/modules/catalog/apis/sku-service/requests/AssociateSKUServiceRequest.ts b/src/modules/catalog/apis/sku-service/requests/AssociateSKUServiceRequest.ts new file mode 100644 index 0000000..b4d1739 --- /dev/null +++ b/src/modules/catalog/apis/sku-service/requests/AssociateSKUServiceRequest.ts @@ -0,0 +1,8 @@ +export interface AssociateSKUServiceRequest { + SkuServiceTypeId?: number; + SkuServiceValueId?: number; + SkuId?: number; + Name?: string; + Text?: string; + IsActive?: boolean; +} diff --git a/src/modules/catalog/apis/sku-service/requests/UpdateSKUServiceRequest.ts b/src/modules/catalog/apis/sku-service/requests/UpdateSKUServiceRequest.ts new file mode 100644 index 0000000..70a3b42 --- /dev/null +++ b/src/modules/catalog/apis/sku-service/requests/UpdateSKUServiceRequest.ts @@ -0,0 +1,8 @@ +export interface UpdateSKUServiceRequest { + SkuServiceTypeId?: number; + SkuServiceValueId?: number; + SkuId?: number; + Name?: string; + Text?: string; + IsActive?: boolean; +} diff --git a/src/modules/catalog/apis/sku-service/requests/UpdateSKUServiceTypeRequest.ts b/src/modules/catalog/apis/sku-service/requests/UpdateSKUServiceTypeRequest.ts new file mode 100644 index 0000000..524ce9f --- /dev/null +++ b/src/modules/catalog/apis/sku-service/requests/UpdateSKUServiceTypeRequest.ts @@ -0,0 +1,9 @@ +export interface UpdateSKUServiceTypeRequest { + Name?: string; + IsActive?: boolean; + ShowOnCartFront?: boolean; + ShowOnAttachmentFront?: boolean; + ShowOnFileUpload?: boolean; + IsGiftCard?: boolean; + IsRequired?: boolean; +} diff --git a/src/modules/catalog/apis/sku-service/requests/UpdateSKUServiceValueRequest.ts b/src/modules/catalog/apis/sku-service/requests/UpdateSKUServiceValueRequest.ts new file mode 100644 index 0000000..6a78b96 --- /dev/null +++ b/src/modules/catalog/apis/sku-service/requests/UpdateSKUServiceValueRequest.ts @@ -0,0 +1,6 @@ +export interface UpdateSKUServiceValueRequest { + SkuServiceTypeId?: number; + Name?: string; + Value?: number; + Cost?: number; +} diff --git a/src/modules/catalog/apis/sku-service/responses/AssociateSKUServiceAttachmentResponse.ts b/src/modules/catalog/apis/sku-service/responses/AssociateSKUServiceAttachmentResponse.ts new file mode 100644 index 0000000..11bf0c4 --- /dev/null +++ b/src/modules/catalog/apis/sku-service/responses/AssociateSKUServiceAttachmentResponse.ts @@ -0,0 +1,5 @@ +export interface AssociateSKUServiceAttachmentResponse { + Id?: number; + AttachmentId?: number; + SkuServiceTypeId?: number; +} diff --git a/src/modules/catalog/apis/sku-service/responses/AssociateSKUServiceResponse.ts b/src/modules/catalog/apis/sku-service/responses/AssociateSKUServiceResponse.ts new file mode 100644 index 0000000..d55d1a7 --- /dev/null +++ b/src/modules/catalog/apis/sku-service/responses/AssociateSKUServiceResponse.ts @@ -0,0 +1,9 @@ +export interface AssociateSKUServiceResponse { + Id?: string; + SkuServiceTypeId?: number; + SkuServiceValueId?: number; + SkuId?: number; + Name?: string; + Text?: string; + IsActive?: boolean; +} diff --git a/src/modules/catalog/apis/sku-service/responses/UpdateSKUServiceResponse.ts b/src/modules/catalog/apis/sku-service/responses/UpdateSKUServiceResponse.ts new file mode 100644 index 0000000..8825c30 --- /dev/null +++ b/src/modules/catalog/apis/sku-service/responses/UpdateSKUServiceResponse.ts @@ -0,0 +1,9 @@ +export interface UpdateSKUServiceResponse { + Id?: number; + SkuServiceTypeId?: number; + SkuServiceValueId?: number; + SkuId?: number; + Name?: string; + Text?: string; + IsActive?: boolean; +} diff --git a/src/modules/catalog/apis/sku-service/responses/UpdateSKUServiceTypeResponse.ts b/src/modules/catalog/apis/sku-service/responses/UpdateSKUServiceTypeResponse.ts new file mode 100644 index 0000000..b03e189 --- /dev/null +++ b/src/modules/catalog/apis/sku-service/responses/UpdateSKUServiceTypeResponse.ts @@ -0,0 +1,10 @@ +export interface UpdateSKUServiceTypeResponse { + Id?: number; + Name?: string; + IsActive?: boolean; + ShowOnCartFront?: boolean; + ShowOnAttachmentFront?: boolean; + ShowOnFileUpload?: boolean; + IsGiftCard?: boolean; + IsRequired?: boolean; +} diff --git a/src/modules/catalog/apis/sku-service/responses/UpdateSKUServiceValueResponse.ts b/src/modules/catalog/apis/sku-service/responses/UpdateSKUServiceValueResponse.ts new file mode 100644 index 0000000..3795b52 --- /dev/null +++ b/src/modules/catalog/apis/sku-service/responses/UpdateSKUServiceValueResponse.ts @@ -0,0 +1,7 @@ +export interface UpdateSKUServiceValueResponse { + Id?: number; + SkuServiceTypeId?: number; + Name?: string; + Value?: number; + Cost?: number; +} diff --git a/src/modules/catalog/apis/sku/SKU.ts b/src/modules/catalog/apis/sku/SKU.ts new file mode 100644 index 0000000..72f5fa5 --- /dev/null +++ b/src/modules/catalog/apis/sku/SKU.ts @@ -0,0 +1,476 @@ +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { GetSKUResponse } from "./responses/GetSKUResponse"; +import { GetSKUByRefIdResponse } from "./responses/GetSKUByRefIdResponse"; +import { CreateSKURequest } from "./requests/CreateSKURequest"; +import { CreateSKUResponse } from "./responses/CreateSKUResponse"; +import { GetSKUListByProductIdResponseItem } from "./responses/GetSKUListByProductIdResponseItem"; +import { GetSKUFileResponseItem } from "./responses/GetSKUFileResponseItem"; +import { CreateSKUFileRequest } from "./requests/CreateSKUFileRequest"; +import { GetSKUKitResponse } from "./responses/GetSKUKitResponse"; +import { CreateSKUKitRequest } from "./requests/CreateSKUKitRequest"; +import { GetSKUSpecificationsResponseItem } from "./responses/GetSKUSpecificationsResponseItem"; +import { CreateSKUSpecificationRequest } from "./requests/CreateSKUSpecificationRequest"; +import { UpdateSKURequest } from "./requests/UpdateSKURequest"; +import { AssociateSKUAttachmentRequest } from "./requests/AssociateSKUAttachmentRequest"; +import { AssociateSKUAttachmentResponse } from "./responses/AssociateSKUAttachmentResponse"; +import { CreateSKUComplementRequest } from "./requests/CreateSKUComplementRequest"; +import { CreateSKUComplementResponse } from "./responses/CreateSKUComplementResponse"; +import { AssociateAttachmentsToSKURequest } from "./requests/AssociateAttachmentsToSKURequest"; +import { AssociateAttachmentsToSKUResponse } from "./responses/AssociateAttachmentsToSKUResponse"; + +export class SKU extends AbstractApi { + private static readonly BASE_PATH: string = "/api/catalog"; + + /** + * Retrieves the IDs of all SKUs in the store. Presents the result with page size and pagination. + * @param {number} page + * @param {number} pageSize + */ + listAllSKUIds( + page: number, + pageSize: number + ): Promise>> { + const path = `${SKU.BASE_PATH}_system/pvt/sku/stockkeepingunitids?page=${page}&pagesize=${pageSize}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Retrieves a specific SKU by its ID. + * @param {string} skuId + */ + getSKU(skuId: string): Promise> { + const path = `${SKU.BASE_PATH}_system/pvt/sku/stockkeepingunitbyid/${skuId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Retrieves information about a specific SKU by its RefId + * @param {string} refId + */ + getSKUByRefId( + refId: string + ): Promise> { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit?refId=${refId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Creates a new SKU from scratch + * @param {CreateSKURequest} skuData + */ + createSKU( + skuData: CreateSKURequest + ): Promise> { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + skuData + ); + } + + /** + * Retrieves an SKU ID by the SKU's Reference ID. + * @param {string} refId + */ + getSkuIdByRefId(refId: string): Promise { + const path = `${SKU.BASE_PATH}_system/pvt/sku/stockkeepingunitidbyrefid/${refId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Retrieves an SKU by its Alternate ID. + * @param {string} alternateId + */ + getSKUByAlternateId( + alternateId: string + ): Promise> { + const path = `${SKU.BASE_PATH}_system/pvt/sku/stockkeepingunitbyalternateId/${alternateId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Retrieves an SKU by its EAN ID. + * @param {string} ean + */ + getSKUByEAN(ean: string): Promise> { + const path = `${SKU.BASE_PATH}_system/pvt/sku/stockkeepingunitbyean/${ean}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Retrieves the EAN of the SKU + * @param {string} skuId + */ + getEANBySKUId(skuId: string): Promise>> { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/ean`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Deletes all EANs values of an SKU + * @param {string} skuId + */ + deleteAllSkuEAN(skuId: string): Promise { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/ean`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Retrieves a list with the SKUs related to a product by the product's ID. + * @param {string} productId + */ + getSKUListByProductId( + productId: string + ): Promise>> { + const path = `${SKU.BASE_PATH}_system/pvt/sku/stockkeepingunitByProductId/${productId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Gets general information about all Files inside the SKU + * @param {string} skuId + */ + getSKUFile( + skuId: string + ): Promise>> { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/file`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Creates a new Image on an SKU based on its URL + * @param {string} skuId + * @param {CreateSKUFileRequest} skuFileData + */ + createSKUFile( + skuId: string, + skuFileData: CreateSKUFileRequest + ): Promise> { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/file`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + skuFileData + ); + } + + /** + * Deletes all SKU Image Files + * @param {string} skuId + */ + deleteAllSKUFile(skuId: string): Promise { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/file`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Retrieves general information about the components of an SKU Kit by SKU ID or Parent SKU ID + * @param {string} skuId + * @param {string} parentSkuId + */ + getSKUKitBySkuIDOrParentSkuId( + skuId?: string, + parentSkuId?: string + ): Promise> { + let params = "?"; + if (skuId) { + params += `skuId=${skuId}`; + } + if (skuId && parentSkuId) { + params += "&"; + } + if (parentSkuId) { + params += `parentSkuId=${parentSkuId}`; + } + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunitkit${params}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Creates new component to a specific Kit + * @param {CreateSKUKitRequest} skuKitData + */ + createSKUKit( + skuKitData: CreateSKUKitRequest + ): Promise> { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunitkit`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + skuKitData + ); + } + + /** + * Deletes all Kit’s components based on the Parent SKU ID or deletes + * a specific Kit’s component based on the SKU ID + * @param {string} skuId + * @param {string} parentSkuId + */ + deleteSKUKitBySkuIDOrParentSkuId( + skuId?: string, + parentSkuId?: string + ): Promise { + let params = "?"; + if (skuId) { + params += `skuId=${skuId}`; + } + if (skuId && parentSkuId) { + params += "&"; + } + if (parentSkuId) { + params += `parentSkuId=${parentSkuId}`; + } + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunitkit${params}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Retrieves general information about an SKU Specification + * @param {string} skuId + */ + getSKUSpecifications( + skuId: string + ): Promise>> { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/specification`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Creates a new Specification on a previously existing SKU + * @param {string} skuId + * @param {CreateSKUSpecificationRequest} skuSpecificationData + */ + createSKUSpecification( + skuId: string, + skuSpecificationData: CreateSKUSpecificationRequest + ): Promise> { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/specification`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + skuSpecificationData + ); + } + + /** + * Deletes all Product Specifications + * @param {string} skuId + */ + deleteAllSKUSpecifications(skuId: string): Promise { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/specification`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Receives a list of Reference IDs and returns the same list with the corresponding SKU IDs. + * @param {Array} refIdList + */ + retrieveSkuIdListByRefIdList( + refIdList: Array + ): Promise { + const path = `${SKU.BASE_PATH}_system/pub/sku/stockkeepingunitidsbyrefids`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + refIdList + ); + } + + /** + * Updates an existing SKU + * @param {string} skuId + * @param {UpdateSKURequest} skuData + */ + updateSKU( + skuId: string, + skuData: UpdateSKURequest + ): Promise> { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + skuData + ); + } + + /** + * Associates an existing SKU to an existing Attachment + * @param {AssociateSKUAttachmentRequest} skuAttachmentData + */ + associateSKUAttachment( + skuAttachmentData: AssociateSKUAttachmentRequest + ): Promise> { + const path = `${SKU.BASE_PATH}/pvt/skuattachment`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + skuAttachmentData + ); + } + + /** + * Deletes an association of an SKU to an Attachment by its Sku ID + * @param {string} skuId + */ + deleteSKUAttachmentBySkuId(skuId: string): Promise { + const path = `${SKU.BASE_PATH}/pvt/skuattachment?skuId=${skuId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Updates a new Image on an SKU based on its URL + * @param {string} skuId + * @param {string} skuFileId + * @param {CreateSKUFileRequest} skuFileData + */ + updateSKUFile( + skuId: string, + skuFileId: string, + skuFileData: CreateSKUFileRequest + ): Promise> { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/file/${skuFileId}`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + skuFileData + ); + } + + /** + * Deletes a specific SKU Image File + * @param {string} skuId + * @param {string} skuFileId + */ + deleteSKUImageByFileId( + skuId: string, + skuFileId: string + ): Promise { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/file/${skuFileId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Creates a new SKU Complement on a Parent SKU + * @param {CreateSKUComplementRequest} skuComplementData + */ + createSKUComplement( + skuComplementData: CreateSKUComplementRequest + ): Promise> { + const path = `${SKU.BASE_PATH}/pvt/skucomplement`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + skuComplementData + ); + } + + /** + * Deletes an association of an SKU to an Attachment by its Attachment ID + * @param {string} attachmentId + */ + deleteSKUAttachmentByAttachmentId( + attachmentId: string + ): Promise { + const path = `${SKU.BASE_PATH}/pvt/skuattachment/${attachmentId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Deletes a previously existing Complement of an SKU by SkuId + * @param {string} skuComplementId + */ + deleteSKUComplementBySkuId( + skuComplementId: string + ): Promise { + const path = `${SKU.BASE_PATH}/pvt/skucomplement/${skuComplementId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Amplifies a cart data by associating attachments to SKUs. + * This request removes existing SKU attachment associations and recreates + * the associations with the attachments being sent. + * @param {AssociateAttachmentsToSKURequest} attachmentsData + */ + associateAttachmentsToSKU( + attachmentsData: AssociateAttachmentsToSKURequest + ): Promise> { + const path = `${SKU.BASE_PATH}_system/pvt/sku/associateattachments`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + attachmentsData + ); + } + + /** + * Creates or updates the EAN value of an SKU + * @param {string} skuId + * @param {string} ean + */ + createSkuEAN(skuId: string, ean: string): Promise { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/ean/${ean}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST); + } + + /** + * Deletes the EAN value of an SKU + * @param {string} skuId + * @param {string} ean + */ + deleteSkuEAN(skuId: string, ean: string): Promise { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/ean/${ean}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Retrieves general information about a component of a Kit + * @param {string} kitId + */ + getSKUKit(kitId: string): Promise> { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunitkit/${kitId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Deletes a specific Kit’s component based on its Kit ID + * @param {string} kitId + */ + deleteSKUKitByKitId(kitId: string): Promise { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunitkit/${kitId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Deletes a specific SKU Specification + * @param {string} skuId + * @param {string} specificationId + */ + deleteSKUSpecification( + skuId: string, + specificationId: string + ): Promise { + const path = `${SKU.BASE_PATH}/pvt/stockkeepingunit/${skuId}/specification/${specificationId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Deletes a previously existing Complement of an SKU + * @param {string} skuAttachmentId + * @param {string} skuAttachmentData + */ + deleteSKUComplement( + skuAttachmentId: string, + skuAttachmentData: CreateSKUComplementRequest + ): Promise { + const path = `${SKU.BASE_PATH}/pvt/skuattachment/${skuAttachmentId}`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.DELETE, + skuAttachmentData + ); + } +} diff --git a/src/modules/catalog/apis/sku/index.ts b/src/modules/catalog/apis/sku/index.ts new file mode 100644 index 0000000..8282a34 --- /dev/null +++ b/src/modules/catalog/apis/sku/index.ts @@ -0,0 +1 @@ +export * from "./SKU"; diff --git a/src/modules/catalog/apis/sku/requests/AssociateAttachmentsToSKURequest.ts b/src/modules/catalog/apis/sku/requests/AssociateAttachmentsToSKURequest.ts new file mode 100644 index 0000000..d012fa5 --- /dev/null +++ b/src/modules/catalog/apis/sku/requests/AssociateAttachmentsToSKURequest.ts @@ -0,0 +1,4 @@ +export interface AssociateAttachmentsToSKURequest { + SkuId?: Array; + AttachmentNames?: Array; +} diff --git a/src/modules/catalog/apis/sku/requests/AssociateSKUAttachmentRequest.ts b/src/modules/catalog/apis/sku/requests/AssociateSKUAttachmentRequest.ts new file mode 100644 index 0000000..9b36473 --- /dev/null +++ b/src/modules/catalog/apis/sku/requests/AssociateSKUAttachmentRequest.ts @@ -0,0 +1,4 @@ +export interface AssociateSKUAttachmentRequest { + AttachmentId?: number; + SkuId?: number; +} diff --git a/src/modules/catalog/apis/sku/requests/CreateSKUComplementRequest.ts b/src/modules/catalog/apis/sku/requests/CreateSKUComplementRequest.ts new file mode 100644 index 0000000..af41597 --- /dev/null +++ b/src/modules/catalog/apis/sku/requests/CreateSKUComplementRequest.ts @@ -0,0 +1,5 @@ +export interface CreateSKUComplementRequest { + ParentSkuId?: number; + SkuId?: number; + ComplementTypeId?: number; +} diff --git a/src/modules/catalog/apis/sku/requests/CreateSKUFileRequest.ts b/src/modules/catalog/apis/sku/requests/CreateSKUFileRequest.ts new file mode 100644 index 0000000..3fd9e69 --- /dev/null +++ b/src/modules/catalog/apis/sku/requests/CreateSKUFileRequest.ts @@ -0,0 +1,7 @@ +export interface CreateSKUFileRequest { + IsMain?: boolean; + Label?: string; + Name?: string; + Text?: string; + Url?: string; +} diff --git a/src/modules/catalog/apis/sku/requests/CreateSKUKitRequest.ts b/src/modules/catalog/apis/sku/requests/CreateSKUKitRequest.ts new file mode 100644 index 0000000..5c7bcf5 --- /dev/null +++ b/src/modules/catalog/apis/sku/requests/CreateSKUKitRequest.ts @@ -0,0 +1,6 @@ +export interface CreateSKUKitRequest { + StockKeepingUnitParent?: number; + StockKeepingUnitId?: number; + Quantity?: number; + UnitPrice?: number; +} diff --git a/src/modules/catalog/apis/sku/requests/CreateSKURequest.ts b/src/modules/catalog/apis/sku/requests/CreateSKURequest.ts new file mode 100644 index 0000000..bf96eaa --- /dev/null +++ b/src/modules/catalog/apis/sku/requests/CreateSKURequest.ts @@ -0,0 +1,25 @@ +export interface CreateSKURequest { + ProductId?: number; + IsActive?: boolean; + Name?: string; + RefId?: string; + PackagedHeight?: number; + PackagedLength?: number; + PackagedWidth?: number; + PackagedWeightKg?: number; + Height?: number; + Length?: number; + Width?: number; + WeightKg?: number; + CubicWeight?: number; + IsKit?: boolean; + CreationDate?: string; + RewardValue?: number; + EstimatedDateArrival?: string; + ManufacturerCode?: string; + CommercialConditionId?: number; + MeasurementUnit?: string; + UnitMultiplier?: number; + ModalType?: string; + KitItensSellApart?: boolean; +} diff --git a/src/modules/catalog/apis/sku/requests/CreateSKUSpecificationRequest.ts b/src/modules/catalog/apis/sku/requests/CreateSKUSpecificationRequest.ts new file mode 100644 index 0000000..f687e81 --- /dev/null +++ b/src/modules/catalog/apis/sku/requests/CreateSKUSpecificationRequest.ts @@ -0,0 +1,4 @@ +export interface CreateSKUSpecificationRequest { + FieldId?: number; + FieldValueId?: number; +} diff --git a/src/modules/catalog/apis/sku/requests/UpdateSKURequest.ts b/src/modules/catalog/apis/sku/requests/UpdateSKURequest.ts new file mode 100644 index 0000000..c828c4b --- /dev/null +++ b/src/modules/catalog/apis/sku/requests/UpdateSKURequest.ts @@ -0,0 +1,5 @@ +import { CreateSKURequest } from "./CreateSKURequest"; + +export interface UpdateSKURequest extends CreateSKURequest { + Id?: number; +} diff --git a/src/modules/catalog/apis/sku/responses/AssociateAttachmentsToSKUResponse.ts b/src/modules/catalog/apis/sku/responses/AssociateAttachmentsToSKUResponse.ts new file mode 100644 index 0000000..d687b86 --- /dev/null +++ b/src/modules/catalog/apis/sku/responses/AssociateAttachmentsToSKUResponse.ts @@ -0,0 +1,4 @@ +export interface AssociateAttachmentsToSKUResponse { + StatusCode?: number; + StatusDescription?: any; +} diff --git a/src/modules/catalog/apis/sku/responses/AssociateSKUAttachmentResponse.ts b/src/modules/catalog/apis/sku/responses/AssociateSKUAttachmentResponse.ts new file mode 100644 index 0000000..cddbce9 --- /dev/null +++ b/src/modules/catalog/apis/sku/responses/AssociateSKUAttachmentResponse.ts @@ -0,0 +1,6 @@ +import { AssociateSKUAttachmentRequest } from "../requests/AssociateSKUAttachmentRequest"; + +export interface AssociateSKUAttachmentResponse + extends AssociateSKUAttachmentRequest { + Id?: number; +} diff --git a/src/modules/catalog/apis/sku/responses/CreateSKUComplementResponse.ts b/src/modules/catalog/apis/sku/responses/CreateSKUComplementResponse.ts new file mode 100644 index 0000000..989fd19 --- /dev/null +++ b/src/modules/catalog/apis/sku/responses/CreateSKUComplementResponse.ts @@ -0,0 +1,6 @@ +import { CreateSKUComplementRequest } from "../requests/CreateSKUComplementRequest"; + +export interface CreateSKUComplementResponse + extends CreateSKUComplementRequest { + Id?: number; +} diff --git a/src/modules/catalog/apis/sku/responses/CreateSKUResponse.ts b/src/modules/catalog/apis/sku/responses/CreateSKUResponse.ts new file mode 100644 index 0000000..f508413 --- /dev/null +++ b/src/modules/catalog/apis/sku/responses/CreateSKUResponse.ts @@ -0,0 +1,5 @@ +import { CreateSKURequest } from "../requests/CreateSKURequest"; + +export interface CreateSKUResponse extends CreateSKURequest { + Id?: number; +} diff --git a/src/modules/catalog/apis/sku/responses/GetSKUByRefIdResponse.ts b/src/modules/catalog/apis/sku/responses/GetSKUByRefIdResponse.ts new file mode 100644 index 0000000..96b656f --- /dev/null +++ b/src/modules/catalog/apis/sku/responses/GetSKUByRefIdResponse.ts @@ -0,0 +1,27 @@ +export interface GetSKUByRefIdResponse { + Id?: number; + ProductId?: number; + IsActive?: boolean; + Name?: string; + RefId?: string; + PackagedHeight?: number; + PackagedLength?: number; + PackagedWidth?: number; + PackagedWeightKg?: number; + Height?: number; + Length?: number; + Width?: number; + WeightKg?: number; + CubicWeight?: number; + IsKit?: boolean; + CreationDate?: string; + RewardValue?: number; + EstimatedDateArrival?: string; + ManufacturerCode?: string; + CommercialConditionId?: number; + MeasurementUnit?: string; + UnitMultiplier?: number; + ModalType?: string; + KitItensSellApart?: boolean; + Videos?: string; +} diff --git a/src/modules/catalog/apis/sku/responses/GetSKUFileResponseItem.ts b/src/modules/catalog/apis/sku/responses/GetSKUFileResponseItem.ts new file mode 100644 index 0000000..2eff795 --- /dev/null +++ b/src/modules/catalog/apis/sku/responses/GetSKUFileResponseItem.ts @@ -0,0 +1,7 @@ +export interface GetSKUFileResponseItem { + Id?: number; + SkuId?: number; + Name?: string; + IsMain?: boolean; + Label?: string; +} diff --git a/src/modules/catalog/apis/sku/responses/GetSKUKitResponse.ts b/src/modules/catalog/apis/sku/responses/GetSKUKitResponse.ts new file mode 100644 index 0000000..ea1fc84 --- /dev/null +++ b/src/modules/catalog/apis/sku/responses/GetSKUKitResponse.ts @@ -0,0 +1,7 @@ +export interface GetSKUKitResponse { + Id?: number; + StockKeepingUnitParent?: number; + StockKeepingUnitId?: number; + Quantity?: number; + UnitPrice?: number; +} diff --git a/src/modules/catalog/apis/sku/responses/GetSKUListByProductIdResponseItem.ts b/src/modules/catalog/apis/sku/responses/GetSKUListByProductIdResponseItem.ts new file mode 100644 index 0000000..cf34da8 --- /dev/null +++ b/src/modules/catalog/apis/sku/responses/GetSKUListByProductIdResponseItem.ts @@ -0,0 +1,42 @@ +export interface GetSKUListByProductIdResponseItem { + IsPersisted?: boolean; + IsRemoved?: boolean; + Id?: number; + ProductId?: number; + IsActive?: boolean; + Name?: string; + Height?: number; + RealHeight?: number; + Width?: number; + RealWidth?: number; + Length?: number; + RealLength?: number; + WeightKg?: number; + RealWeightKg?: number; + ModalId?: string; + RefId?: string; + CubicWeight?: number; + IsKit?: boolean; + IsDynamicKit?: boolean; + InternalNote?: string; + DateUpdated?: string; + RewardValue?: number; + CommercialConditionId?: number; + EstimatedDateArrival?: string; + FlagKitItensSellApart?: boolean; + ManufacturerCode?: string; + ReferenceStockKeepingUnitId?: number; + Position?: number; + EditionSkuId?: number; + ApprovedAdminId?: number; + EditionAdminId?: number; + ActivateIfPossible?: boolean; + SupplierCode?: string; + MeasurementUnit?: number; + UnitMultiplier?: number; + IsInventoried?: boolean; + IsTransported?: boolean; + IsGiftCardRecharge?: boolean; + ModalType?: string; + IsKitOptimized?: boolean; +} diff --git a/src/modules/catalog/apis/sku/responses/GetSKUResponse.ts b/src/modules/catalog/apis/sku/responses/GetSKUResponse.ts new file mode 100644 index 0000000..22e2682 --- /dev/null +++ b/src/modules/catalog/apis/sku/responses/GetSKUResponse.ts @@ -0,0 +1,109 @@ +interface Dimension { + cubicweight?: number; + height?: number; + length?: number; + weight?: number; + width?: number; +} + +interface RealDimension { + realCubicweight?: number; + realHeight?: number; + realLength?: number; + realWeight?: number; + realWidth?: number; +} + +interface Field { + FieldName?: string; + MaxCaracters?: string; + DomainValues?: string; +} + +interface Attachment { + Id?: number; + Name?: string; + Keys?: Array; + Fields?: Array; + IsActive?: boolean; + IsRequired?: boolean; +} + +interface SkuSeller { + SellerId?: string; + StockKeepingUnitId?: number; + SellerStockKeepingUnitId?: string; + IsActive?: boolean; + FreightCommissionPercentage?: number; + ProductCommissionPercentage?: number; +} + +interface Image { + ImageUrl?: string; + ImageName?: string; + FileId?: number; +} + +interface SkuSpecification { + FieldId?: number; + FieldName?: string; + FieldValueIds?: Array; + FieldValues?: Array; +} + +interface ProductSpecification { + FieldId?: number; + FieldName?: string; + FieldValueIds?: Array; + FieldValues?: Array; +} + +interface AlternateId { + Ean?: string; + RefId?: string; +} + +export interface GetSKUResponse { + Id?: number; + ProductId?: number; + NameComplete?: string; + ProductName?: string; + ProductDescription?: string; + SkuName?: string; + IsActive?: boolean; + IsTransported?: boolean; + IsInventoried?: boolean; + IsGiftCardRecharge?: boolean; + ImageUrl?: string; + DetailUrl?: string; + CSCIdentification?: string; + BrandId?: string; + BrandName?: string; + Dimension?: Dimension; + RealDimension?: RealDimension; + ManufacturerCode?: string; + IsKit?: boolean; + KitItems?: Array; + Services?: Array; + Categories?: Array; + Attachments?: Array; + Collections?: Array; + SkuSellers?: Array; + SalesChannels?: Array; + Images?: Array; + SkuSpecifications?: Array; + ProductSpecifications?: Array; + ProductClustersIds?: string; + ProductCategoryIds?: string; + ProductGlobalCategoryId?: string; + ProductCategories?: any; + CommercialConditionId?: number; + RewardValue?: number; + AlternateIds?: Array; + AlternateIdValues?: Array; + EstimatedDateArrival?: string; + MeasurementUnit?: string; + UnitMultiplier?: number; + InformationSource?: string; + ModalType?: string; +} diff --git a/src/modules/catalog/apis/sku/responses/GetSKUSpecificationsResponseItem.ts b/src/modules/catalog/apis/sku/responses/GetSKUSpecificationsResponseItem.ts new file mode 100644 index 0000000..f4aff49 --- /dev/null +++ b/src/modules/catalog/apis/sku/responses/GetSKUSpecificationsResponseItem.ts @@ -0,0 +1,7 @@ +export interface GetSKUSpecificationsResponseItem { + Id?: number; + SkuId?: number; + FieldId?: number; + FieldValueId?: number; + Text?: string; +} diff --git a/src/modules/catalog/apis/specification/Specification.ts b/src/modules/catalog/apis/specification/Specification.ts new file mode 100644 index 0000000..e9c75d9 --- /dev/null +++ b/src/modules/catalog/apis/specification/Specification.ts @@ -0,0 +1,308 @@ +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { GetSpecificationNonStructuredResponse } from "./responses/GetSpecificationNonStructuredResponse"; +import { CreateSpecificationsFieldRequest } from "./requests/CreateSpecificationsFieldRequest"; +import { CreateSpecificationGroupRequest } from "./requests/CreateSpecificationGroupRequest"; +import { CreateSpecificationGroupResponse } from "./responses/CreateSpecificationGroupResponse"; +import { UpdateSpecificationGroupRequest } from "./requests/UpdateSpecificationGroupRequest"; +import { CreateSpecificationValueRequest } from "./requests/CreateSpecificationValueRequest"; +import { GetSpecificationValueResponse } from "./responses/GetSpecificationValueResponse"; +import { GetSpecificationsByCategoryIdResponseItem } from "./responses/GetSpecificationsByCategoryIdResponseItem"; +import { GetSpecificationFieldValueResponse } from "./responses/GetSpecificationFieldValueResponse"; +import { GetSpecificationsValuesByFieldIdResponseItem } from "./responses/GetSpecificationsValuesByFieldIdResponseItem"; +import { UpdateSpecificationRequest } from "./requests/UpdateSpecificationRequest"; + +export class Specification extends AbstractApi { + private static readonly BASE_PATH: string = "/api/catalog"; + + /** + * Gets general information about unmapped Specifications of a Seller SKU in a Marketplace by its unique ID + * @param {number} skuId + */ + getSpecificationNonStructuredBySkuId( + skuId: number + ): Promise> { + const path = `${Specification.BASE_PATH}/pvt/specification/nonstructured/${skuId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Deletes unmapped Specifications of a Seller SKU in a Marketplace by its unique ID + * @param {number} skuId + */ + deleteSpecificationNonStructuredBySkuId( + skuId: number + ): Promise { + const path = `${Specification.BASE_PATH}/pvt/specification/nonstructured/${skuId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Creates a specification field in a category. + * @param {CreateSpecificationsFieldRequest} specificationFieldData + */ + createSpecificationsField( + specificationFieldData: CreateSpecificationsFieldRequest + ): Promise> { + const path = `${Specification.BASE_PATH}_system/pvt/specification/field`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + specificationFieldData + ); + } + + /** + * Updates a specification field in a category. + * @param {CreateSpecificationsFieldRequest} specificationFieldData + */ + updateSpecificationsField( + specificationFieldData: CreateSpecificationsFieldRequest + ): Promise> { + const path = `${Specification.BASE_PATH}_system/pvt/specification/field`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + specificationFieldData + ); + } + + /** + * Create a specification group. + * @param {CreateSpecificationGroupRequest} specificationGroupData + */ + createSpecificationGroup( + specificationGroupData: CreateSpecificationGroupRequest + ): Promise> { + const path = `${Specification.BASE_PATH}_system/pvt/specification/group`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + specificationGroupData + ); + } + + /** + * Update a specification group + * @param {UpdateSpecificationGroupRequest} specificationGroupData + */ + updateSpecificationGroup( + specificationGroupData: UpdateSpecificationGroupRequest + ): Promise> { + const path = `${Specification.BASE_PATH}_system/pvt/specification/group`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + specificationGroupData + ); + } + + /** + * Creates a new Specification Value for a Category + * @param {CreateSpecificationValueRequest} specificationValueData + */ + createSpecificationValue( + specificationValueData: CreateSpecificationValueRequest + ): Promise> { + const path = `${Specification.BASE_PATH}/pvt/specificationvalue`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + specificationValueData + ); + } + + /** + * Creates a specification field value by the specification field's ID. + * @param {CreateSpecificationValueRequest} specificationFieldValueData + */ + createSpecificationFieldValue( + specificationFieldValueData: CreateSpecificationValueRequest + ): Promise> { + const path = `${Specification.BASE_PATH}_system/pvt/specification/fieldValue`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + specificationFieldValueData + ); + } + + /** + * CUpdates a specification field value by the specification field's ID. + * @param {CreateSpecificationValueRequest} specificationFieldValueData + */ + updateSpecificationFieldValue( + specificationFieldValueData: CreateSpecificationValueRequest + ): Promise { + const path = `${Specification.BASE_PATH}_system/pvt/specification/fieldValue`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + specificationFieldValueData + ); + } + + /** + * Gets general information about unmapped Specifications of a Seller SKU in a Marketplace + * @param {number} id + */ + getSpecificationNonStructured( + id: number + ): Promise> { + const path = `${Specification.BASE_PATH}/pvt/specification/nonstructured/${id}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Deletes unmapped Specifications of a Seller SKU in a Marketplace by its unique ID + * @param {number} id + */ + deleteSpecificationNonStructured(id: number): Promise { + const path = `${Specification.BASE_PATH}/pvt/specification/nonstructured/${id}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Retrieves general information about a Specification Value + * @param {number} specificationValueId + */ + getSpecificationValue( + specificationValueId: number + ): Promise> { + const path = `${Specification.BASE_PATH}/pvt/specificationvalue/${specificationValueId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * + * @param {number} specificationValueId + * @param {CreateSpecificationValueRequest} specificationValueData + */ + updateSpecificationValue( + specificationValueId: number, + specificationValueData: CreateSpecificationValueRequest + ): Promise> { + const path = `${Specification.BASE_PATH}/pvt/specificationvalue/${specificationValueId}`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + specificationValueData + ); + } + + /** + * Gets all specifications from a category by its ID. + * @param {number} categoryId + */ + getSpecificationsByCategoryId( + categoryId: number + ): Promise< + VtexHttpResponse> + > { + const path = `${Specification.BASE_PATH}_system/pub/specification/field/listByCategoryId/${categoryId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Retrieves details from a specification field by this field's ID. + * @param {number} fieldId + */ + getSpecificationsField( + fieldId: number + ): Promise> { + const path = `${Specification.BASE_PATH}_system/pub/specification/fieldGet/${fieldId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Retrieves details from a specification field's value by this value's ID. + * @param {number} fieldValueId + */ + getSpecificationsFieldValue( + fieldValueId: number + ): Promise> { + const path = `${Specification.BASE_PATH}_system/pub/specification/fieldValue/${fieldValueId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Retrieves details from a specification group by the ID of this group. + * @param {number} groupId + */ + getSpecificationsGroup( + groupId: number + ): Promise> { + const path = `${Specification.BASE_PATH}_system/pub/specification/groupGet/${groupId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Lists all specifications including the current category and the level zero specifications + * from a category by its ID. + * @param {number} categoryId + */ + getSpecificationsTreeByCategoryId( + categoryId: number + ): Promise< + VtexHttpResponse> + > { + const path = `${Specification.BASE_PATH}_system/pub/specification/field/listTreeByCategoryId/${categoryId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Gets a list of all specification values from a Specification Field by this field's ID. + * @param {number} fieldId + */ + getSpecificationsValuesByFieldId( + fieldId: number + ): Promise< + VtexHttpResponse> + > { + const path = `${Specification.BASE_PATH}_system/pub/specification/fieldvalue/${fieldId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Retrieves a list of specification groups by the category ID. + * @param {number} categoryId + */ + listSpecificationsGroupByCategory( + categoryId: number + ): Promise>> { + const path = `${Specification.BASE_PATH}_system/pvt/specification/groupbycategory/${categoryId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Updates a Product or SKU Specification + * @param {number} specificationId + * @param {UpdateSpecificationRequest} specificationData + */ + updateSpecification( + specificationId: number, + specificationData: UpdateSpecificationRequest + ): Promise> { + const path = `${Specification.BASE_PATH}/pvt/specification/${specificationId}`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + specificationData + ); + } + + /** + * Creates a new Product or SKU Specification + * @param {UpdateSpecificationRequest} specificationData + */ + createSpecification( + specificationData: UpdateSpecificationRequest + ): Promise> { + const path = `${Specification.BASE_PATH}/pvt/specification`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + specificationData + ); + } +} diff --git a/src/modules/catalog/apis/specification/index.ts b/src/modules/catalog/apis/specification/index.ts new file mode 100644 index 0000000..bbfb449 --- /dev/null +++ b/src/modules/catalog/apis/specification/index.ts @@ -0,0 +1 @@ +export * from "./Specification"; diff --git a/src/modules/catalog/apis/specification/requests/CreateSpecificationGroupRequest.ts b/src/modules/catalog/apis/specification/requests/CreateSpecificationGroupRequest.ts new file mode 100644 index 0000000..ded7e78 --- /dev/null +++ b/src/modules/catalog/apis/specification/requests/CreateSpecificationGroupRequest.ts @@ -0,0 +1,4 @@ +export interface CreateSpecificationGroupRequest { + CategoryId?: number; + Name?: string; +} diff --git a/src/modules/catalog/apis/specification/requests/CreateSpecificationValueRequest.ts b/src/modules/catalog/apis/specification/requests/CreateSpecificationValueRequest.ts new file mode 100644 index 0000000..8403ba6 --- /dev/null +++ b/src/modules/catalog/apis/specification/requests/CreateSpecificationValueRequest.ts @@ -0,0 +1,7 @@ +export interface CreateSpecificationValueRequest { + FieldId?: number; + Name?: string; + Text?: string; + IsActive?: boolean; + Position?: number; +} diff --git a/src/modules/catalog/apis/specification/requests/CreateSpecificationsFieldRequest.ts b/src/modules/catalog/apis/specification/requests/CreateSpecificationsFieldRequest.ts new file mode 100644 index 0000000..66c8ebe --- /dev/null +++ b/src/modules/catalog/apis/specification/requests/CreateSpecificationsFieldRequest.ts @@ -0,0 +1,20 @@ +export interface CreateSpecificationsFieldRequest { + Name?: string; + CategoryId?: number; + FieldId?: number; + IsActive?: boolean; + IsRequired?: boolean; + FieldTypeId?: number; + FieldValueId?: number; + Description?: string; + IsStockKeepingUnit?: boolean; + IsFilter?: boolean; + IsOnProductDetails?: boolean; + Position?: number; + IsWizard?: boolean; + IsTopMenuLinkActive?: boolean; + IsSideMenuLinkActive?: boolean; + DefaultValue?: string; + FieldGroupId?: number; + FieldGroupName?: string; +} diff --git a/src/modules/catalog/apis/specification/requests/UpdateSpecificationGroupRequest.ts b/src/modules/catalog/apis/specification/requests/UpdateSpecificationGroupRequest.ts new file mode 100644 index 0000000..cfa2f27 --- /dev/null +++ b/src/modules/catalog/apis/specification/requests/UpdateSpecificationGroupRequest.ts @@ -0,0 +1,4 @@ +export interface UpdateSpecificationGroupRequest { + Id?: number; + Name?: string; +} diff --git a/src/modules/catalog/apis/specification/requests/UpdateSpecificationRequest.ts b/src/modules/catalog/apis/specification/requests/UpdateSpecificationRequest.ts new file mode 100644 index 0000000..959be25 --- /dev/null +++ b/src/modules/catalog/apis/specification/requests/UpdateSpecificationRequest.ts @@ -0,0 +1,17 @@ +export interface UpdateSpecificationRequest { + FieldTypeId?: number; + CategoryId?: number; + FieldGroupId?: number; + Name?: string; + Description?: string; + Position?: number; + IsFilter?: boolean; + IsRequired?: boolean; + IsOnProductDetails?: boolean; + IsStockKeepingUnit?: boolean; + IsWizard?: boolean; + IsActive?: boolean; + IsTopMenuLinkActive?: boolean; + IsSideMenuLinkActive?: boolean; + DefaultValue?: string; +} diff --git a/src/modules/catalog/apis/specification/responses/CreateSpecificationGroupResponse.ts b/src/modules/catalog/apis/specification/responses/CreateSpecificationGroupResponse.ts new file mode 100644 index 0000000..5708f25 --- /dev/null +++ b/src/modules/catalog/apis/specification/responses/CreateSpecificationGroupResponse.ts @@ -0,0 +1,7 @@ +import { CreateSpecificationGroupRequest } from "../requests/CreateSpecificationGroupRequest"; + +export interface CreateSpecificationGroupResponse + extends CreateSpecificationGroupRequest { + Id?: number; + Position?: number; +} diff --git a/src/modules/catalog/apis/specification/responses/GetSpecificationFieldValueResponse.ts b/src/modules/catalog/apis/specification/responses/GetSpecificationFieldValueResponse.ts new file mode 100644 index 0000000..2684d89 --- /dev/null +++ b/src/modules/catalog/apis/specification/responses/GetSpecificationFieldValueResponse.ts @@ -0,0 +1,8 @@ +export interface GetSpecificationFieldValueResponse { + FieldValueId?: number; + FieldId?: number; + Name?: string; + Text?: string; + IsActive?: boolean; + Position?: number; +} diff --git a/src/modules/catalog/apis/specification/responses/GetSpecificationNonStructuredResponse.ts b/src/modules/catalog/apis/specification/responses/GetSpecificationNonStructuredResponse.ts new file mode 100644 index 0000000..9112dfc --- /dev/null +++ b/src/modules/catalog/apis/specification/responses/GetSpecificationNonStructuredResponse.ts @@ -0,0 +1,6 @@ +export interface GetSpecificationNonStructuredResponse { + Id?: number; + SkuId?: number; + SpecificationName?: string; + SpecificationValue?: string; +} diff --git a/src/modules/catalog/apis/specification/responses/GetSpecificationValueResponse.ts b/src/modules/catalog/apis/specification/responses/GetSpecificationValueResponse.ts new file mode 100644 index 0000000..6a6852b --- /dev/null +++ b/src/modules/catalog/apis/specification/responses/GetSpecificationValueResponse.ts @@ -0,0 +1,6 @@ +import { UpdateSpecificationRequest } from "../requests/UpdateSpecificationRequest"; + +export interface GetSpecificationValueResponse + extends UpdateSpecificationRequest { + Id?: number; +} diff --git a/src/modules/catalog/apis/specification/responses/GetSpecificationsByCategoryIdResponseItem.ts b/src/modules/catalog/apis/specification/responses/GetSpecificationsByCategoryIdResponseItem.ts new file mode 100644 index 0000000..b2cb69e --- /dev/null +++ b/src/modules/catalog/apis/specification/responses/GetSpecificationsByCategoryIdResponseItem.ts @@ -0,0 +1,7 @@ +export interface GetSpecificationsByCategoryIdResponseItem { + Name?: string; + CategoryId?: number; + FieldId?: number; + IsActive?: boolean; + IsStockKeepingUnit?: boolean; +} diff --git a/src/modules/catalog/apis/specification/responses/GetSpecificationsValuesByFieldIdResponseItem.ts b/src/modules/catalog/apis/specification/responses/GetSpecificationsValuesByFieldIdResponseItem.ts new file mode 100644 index 0000000..3c31957 --- /dev/null +++ b/src/modules/catalog/apis/specification/responses/GetSpecificationsValuesByFieldIdResponseItem.ts @@ -0,0 +1,6 @@ +export interface GetSpecificationsValuesByFieldIdResponseItem { + FieldValueId?: number; + Value?: string; + IsActive?: boolean; + Position?: number; +} diff --git a/src/modules/catalog/apis/subcollection/Subcollection.ts b/src/modules/catalog/apis/subcollection/Subcollection.ts new file mode 100644 index 0000000..fa6a0f5 --- /dev/null +++ b/src/modules/catalog/apis/subcollection/Subcollection.ts @@ -0,0 +1,183 @@ +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { GetSubcollectionResponse } from "./responses/GetSubcollectionResponse"; +import { GetSubcollectionSKUResponse } from "./responses/GetSubcollectionSKUResponse"; +import { CreateCategorySubcollectionRequest } from "./requests/CreateCategorySubcollectionRequest"; +import { CreateCategorySubcollectionResponse } from "./responses/CreateCategorySubcollectionResponse"; +import { CreateBrandSubcollectionRequest } from "./requests/CreateBrandSubcollectionRequest"; +import { CreateBrandSubcollectionResponse } from "./responses/CreateBrandSubcollectionResponse"; +import { CreateSKUSubcollectionRequest } from "./requests/CreateSKUSubcollectionRequest"; +import { CreateSKUSubcollectionResponse } from "./responses/CreateSKUSubcollectionResponse"; +import { CreateSubcollectionRequest } from "./requests/CreateSubcollectionRequest"; + +export class Subcollection extends AbstractApi { + private static readonly BASE_PATH: string = "/api/catalog/pvt"; + + /** + * Retrieves all Subcollections by its Collection ID + * @param {number} collectionId + */ + getSubcollectionByCollectionId( + collectionId: number + ): Promise>> { + const path = `${Subcollection.BASE_PATH}/collection/${collectionId}/subcollection`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Retrieves all SKUs from a Subcollection + * @param {number} subcollectionId + * @param {number} page + * @param {number} size + */ + getSubcollectionSKU( + subcollectionId: number, + page: number, + size: number + ): Promise> { + const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}/stockkeepingunit?page=${page}&size=${size}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Creates a single Category in a SubCollection + * @param {number} subcollectionId + * @param {CreateCategorySubcollectionRequest} categorySubcollectionData + */ + createCategorySubcollection( + subcollectionId: number, + categorySubcollectionData: CreateCategorySubcollectionRequest + ): Promise> { + const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}/category`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + categorySubcollectionData + ); + } + + /** + * Deletes a Category from a SubCollection + * @param {number} subcollectionId + * @param {number} categoryId + */ + deleteCategorySubcollection( + subcollectionId: number, + categoryId: number + ): Promise { + const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}/category/${categoryId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Deletes a Brand from a SubCollection + * @param {number} subcollectionId + * @param {number} brandId + */ + deleteBrandSubcollection( + subcollectionId: number, + brandId: number + ): Promise { + const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}/brand/${brandId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Creates a single Brand in a SubCollection + * @param {number} subcollectionId + * @param {CreateBrandSubcollectionRequest} brandSubcollectionData + */ + createBrandSubcollection( + subcollectionId: number, + brandSubcollectionData: CreateBrandSubcollectionRequest + ): Promise> { + const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}/brand`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + brandSubcollectionData + ); + } + + /** + * Deletes an SKU from a SubCollection + * @param {number} subcollectionId + * @param {number} skuId + */ + deleteSKUSubcollection( + subcollectionId: number, + skuId: number + ): Promise { + const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}/stockkeepingunit/${skuId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * + * @param {number} subcollectionId + * @param {CreateSKUSubcollectionRequest} skuSubcollectionData + */ + createSKUSubcollection( + subcollectionId: number, + skuSubcollectionData: CreateSKUSubcollectionRequest + ): Promise> { + const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}/stockkeepingunit`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + skuSubcollectionData + ); + } + + /** + * Creates a new SubCollection inclusion or exclusion under a Collection + * @param {CreateSubcollectionRequest} subcollectionData + */ + createSubcollection( + subcollectionData: CreateSubcollectionRequest + ): Promise> { + const path = `${Subcollection.BASE_PATH}/subcollection`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + subcollectionData + ); + } + + /** + * Gets information about a SubCollection + * @param {number} subcollectionId + */ + getSubcollection( + subcollectionId: number + ): Promise> { + const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Updates a previously SubCollection + * @param {number} subcollectionId + * @param {CreateSubcollectionRequest} subcollectionData + */ + updateSubcollection( + subcollectionId: number, + subcollectionData: CreateSubcollectionRequest + ): Promise> { + const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + subcollectionData + ); + } + + /** + * Deletes a previously SubCollection + * @param {number} subcollectionId + */ + deleteSubcollection(subcollectionId: number): Promise { + const path = `${Subcollection.BASE_PATH}/subcollection/${subcollectionId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } +} diff --git a/src/modules/catalog/apis/subcollection/index.ts b/src/modules/catalog/apis/subcollection/index.ts new file mode 100644 index 0000000..993ce24 --- /dev/null +++ b/src/modules/catalog/apis/subcollection/index.ts @@ -0,0 +1 @@ +export * from "./SubCollection"; diff --git a/src/modules/catalog/apis/subcollection/requests/CreateBrandSubcollectionRequest.ts b/src/modules/catalog/apis/subcollection/requests/CreateBrandSubcollectionRequest.ts new file mode 100644 index 0000000..0930672 --- /dev/null +++ b/src/modules/catalog/apis/subcollection/requests/CreateBrandSubcollectionRequest.ts @@ -0,0 +1,3 @@ +export interface CreateBrandSubcollectionRequest { + BrandId?: number; +} diff --git a/src/modules/catalog/apis/subcollection/requests/CreateCategorySubcollectionRequest.ts b/src/modules/catalog/apis/subcollection/requests/CreateCategorySubcollectionRequest.ts new file mode 100644 index 0000000..64a285a --- /dev/null +++ b/src/modules/catalog/apis/subcollection/requests/CreateCategorySubcollectionRequest.ts @@ -0,0 +1,3 @@ +export interface CreateCategorySubcollectionRequest { + CategoryId?: number; +} diff --git a/src/modules/catalog/apis/subcollection/requests/CreateSKUSubcollectionRequest.ts b/src/modules/catalog/apis/subcollection/requests/CreateSKUSubcollectionRequest.ts new file mode 100644 index 0000000..bc225bc --- /dev/null +++ b/src/modules/catalog/apis/subcollection/requests/CreateSKUSubcollectionRequest.ts @@ -0,0 +1,3 @@ +export interface CreateSKUSubcollectionRequest { + SkuId?: number; +} diff --git a/src/modules/catalog/apis/subcollection/requests/CreateSubcollectionRequest.ts b/src/modules/catalog/apis/subcollection/requests/CreateSubcollectionRequest.ts new file mode 100644 index 0000000..4440afd --- /dev/null +++ b/src/modules/catalog/apis/subcollection/requests/CreateSubcollectionRequest.ts @@ -0,0 +1,7 @@ +export interface CreateSubcollectionRequest { + CollectionId?: number; + Name?: string; + Type?: string; + PreSale?: boolean; + Release?: boolean; +} diff --git a/src/modules/catalog/apis/subcollection/responses/CreateBrandSubcollectionResponse.ts b/src/modules/catalog/apis/subcollection/responses/CreateBrandSubcollectionResponse.ts new file mode 100644 index 0000000..a23a3b9 --- /dev/null +++ b/src/modules/catalog/apis/subcollection/responses/CreateBrandSubcollectionResponse.ts @@ -0,0 +1,6 @@ +import { CreateBrandSubcollectionRequest } from "../requests/CreateBrandSubcollectionRequest"; + +export interface CreateBrandSubcollectionResponse + extends CreateBrandSubcollectionRequest { + SubCollectionId?: number; +} diff --git a/src/modules/catalog/apis/subcollection/responses/CreateCategorySubcollectionResponse.ts b/src/modules/catalog/apis/subcollection/responses/CreateCategorySubcollectionResponse.ts new file mode 100644 index 0000000..7574033 --- /dev/null +++ b/src/modules/catalog/apis/subcollection/responses/CreateCategorySubcollectionResponse.ts @@ -0,0 +1,6 @@ +import { CreateCategorySubcollectionRequest } from "../requests/CreateCategorySubcollectionRequest"; + +export interface CreateCategorySubcollectionResponse + extends CreateCategorySubcollectionRequest { + SubCollectionId?: number; +} diff --git a/src/modules/catalog/apis/subcollection/responses/CreateSKUSubcollectionResponse.ts b/src/modules/catalog/apis/subcollection/responses/CreateSKUSubcollectionResponse.ts new file mode 100644 index 0000000..04b1594 --- /dev/null +++ b/src/modules/catalog/apis/subcollection/responses/CreateSKUSubcollectionResponse.ts @@ -0,0 +1,6 @@ +import { CreateSKUSubcollectionRequest } from "../requests/CreateSKUSubcollectionRequest"; + +export interface CreateSKUSubcollectionResponse + extends CreateSKUSubcollectionRequest { + SubCollectionId?: number; +} diff --git a/src/modules/catalog/apis/subcollection/responses/GetSubcollectionResponse.ts b/src/modules/catalog/apis/subcollection/responses/GetSubcollectionResponse.ts new file mode 100644 index 0000000..1b332df --- /dev/null +++ b/src/modules/catalog/apis/subcollection/responses/GetSubcollectionResponse.ts @@ -0,0 +1,5 @@ +import { CreateSubcollectionRequest } from "../requests/CreateSubcollectionRequest"; + +export interface GetSubcollectionResponse extends CreateSubcollectionRequest { + Id?: number; +} diff --git a/src/modules/catalog/apis/subcollection/responses/GetSubcollectionSKUResponse.ts b/src/modules/catalog/apis/subcollection/responses/GetSubcollectionSKUResponse.ts new file mode 100644 index 0000000..11e4ec9 --- /dev/null +++ b/src/modules/catalog/apis/subcollection/responses/GetSubcollectionSKUResponse.ts @@ -0,0 +1,12 @@ +interface DataItem { + SubCollectionId?: number; + SkuId?: number; +} + +export interface GetSubcollectionSKUResponse { + Page?: number; + Size?: number; + TotalRows?: number; + TotalPage?: number; + Data?: Array; +} diff --git a/src/modules/catalog/apis/supplier/Supplier.ts b/src/modules/catalog/apis/supplier/Supplier.ts new file mode 100644 index 0000000..b42d193 --- /dev/null +++ b/src/modules/catalog/apis/supplier/Supplier.ts @@ -0,0 +1,48 @@ +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { UpdateSupplierRequest } from "./requests/UpdateSupplierRequest"; +import { UpdateSupplierResponse } from "./responses/UpdateSupplierResponse"; + +export class Supplier extends AbstractApi { + private static readonly BASE_PATH: string = "/api/catalog/pvt/supplier"; + + /** + * Updates general information of an existing Supplier + * @param {number} supplierId + * @param {UpdateSupplierRequest} supplierData + */ + updateSupplier( + supplierId: number, + supplierData: UpdateSupplierRequest + ): Promise> { + const path = `${Supplier.BASE_PATH}/${supplierId}`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + supplierData + ); + } + + /** + * Deletes an existing Supplier + * @param {number} supplierId + */ + deleteSupplier(supplierId: number): Promise { + const path = `${Supplier.BASE_PATH}/${supplierId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } + + /** + * Creates a new Supplier from scratch + * @param {UpdateSupplierRequest} supplierData + */ + createSupplier( + supplierData: UpdateSupplierRequest + ): Promise> { + return this.vtexHttpClient.performRequest( + Supplier.BASE_PATH, + this.HTTP_METHODS.POST, + supplierData + ); + } +} diff --git a/src/modules/catalog/apis/supplier/index.ts b/src/modules/catalog/apis/supplier/index.ts new file mode 100644 index 0000000..b695dc6 --- /dev/null +++ b/src/modules/catalog/apis/supplier/index.ts @@ -0,0 +1 @@ +export * from "./Supplier"; diff --git a/src/modules/catalog/apis/supplier/requests/UpdateSupplierRequest.ts b/src/modules/catalog/apis/supplier/requests/UpdateSupplierRequest.ts new file mode 100644 index 0000000..1a66fde --- /dev/null +++ b/src/modules/catalog/apis/supplier/requests/UpdateSupplierRequest.ts @@ -0,0 +1,11 @@ +export interface UpdateSupplierRequest { + Name?: string; + CorporateName?: string; + StateInscription?: string; + Cnpj?: string; + Phone?: string; + CellPhone?: string; + CorportePhone?: string; + Email?: string; + IsActive?: boolean; +} diff --git a/src/modules/catalog/apis/supplier/responses/UpdateSupplierResponse.ts b/src/modules/catalog/apis/supplier/responses/UpdateSupplierResponse.ts new file mode 100644 index 0000000..31e18dc --- /dev/null +++ b/src/modules/catalog/apis/supplier/responses/UpdateSupplierResponse.ts @@ -0,0 +1,5 @@ +import { UpdateSupplierRequest } from "../requests/UpdateSupplierRequest"; + +export interface UpdateSupplierResponse extends UpdateSupplierRequest { + Id?: number; +} diff --git a/src/modules/catalog/apis/trade-policy/TradePolicy.ts b/src/modules/catalog/apis/trade-policy/TradePolicy.ts new file mode 100644 index 0000000..9ad6e84 --- /dev/null +++ b/src/modules/catalog/apis/trade-policy/TradePolicy.ts @@ -0,0 +1,41 @@ +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; + +export class TradePolicy extends AbstractApi { + private static readonly BASE_PATH: string = "/api/catalog/pvt/product"; + + /** + * Retrieves a Trade Policy associated to a Product by its ID + * @param {string} productId + */ + getTradePolicyByProductId(productId: string): Promise { + const path = `${TradePolicy.BASE_PATH}/${productId}/salespolicy`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); + } + + /** + * Associates a existing Trade Policy with a Product + * @param {string} productId + * @param {string} tradePolicyId + */ + createProductToTradePolicy( + productId: string, + tradePolicyId: string + ): Promise { + const path = `${TradePolicy.BASE_PATH}/${productId}/salespolicy/${tradePolicyId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST); + } + + /** + * Disassociates a Trade Policy to a Product + * @param {string} productId + * @param {string} tradePolicyId + */ + deleteProductToTradePolicy( + productId: string, + tradePolicyId: string + ): Promise { + const path = `${TradePolicy.BASE_PATH}/${productId}/salespolicy/${tradePolicyId}`; + return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); + } +} diff --git a/src/modules/catalog/apis/trade-policy/index.ts b/src/modules/catalog/apis/trade-policy/index.ts new file mode 100644 index 0000000..84e6bb7 --- /dev/null +++ b/src/modules/catalog/apis/trade-policy/index.ts @@ -0,0 +1 @@ +export * from "./TradePolicy"; diff --git a/src/modules/catalog/index.ts b/src/modules/catalog/index.ts new file mode 100644 index 0000000..e3cc3ba --- /dev/null +++ b/src/modules/catalog/index.ts @@ -0,0 +1 @@ +export * from "./Catalog"; diff --git a/src/modules/logistics/Logistics.ts b/src/modules/logistics/Logistics.ts index 0665fb5..69ebf4d 100644 --- a/src/modules/logistics/Logistics.ts +++ b/src/modules/logistics/Logistics.ts @@ -1,14 +1,14 @@ -import { VtexHttpClient } from '../../utils/VtexHttpClient'; -import { ShippingPolicies } from './apis/shipping-policies'; -import { Carriers } from './apis/carriers'; -import { Docks } from './apis/docks'; -import { Warehouses } from './apis/warehouses'; -import { Inventory } from './apis/inventory'; -import { Holidays } from './apis/holidays'; -import { Reservations } from './apis/reservations'; -import { SLA } from './apis/SLA'; -import { PickupPoints } from './apis/pickup-points'; -import { Polygons } from './apis/polygons'; +import { VtexHttpClient } from "../../utils/VtexHttpClient"; +import { ShippingPolicies } from "./apis/shipping-policies"; +import { Carriers } from "./apis/carriers"; +import { Docks } from "./apis/docks"; +import { Warehouses } from "./apis/warehouses"; +import { Inventory } from "./apis/inventory"; +import { Holidays } from "./apis/holidays"; +import { Reservations } from "./apis/reservations"; +import { SLA } from "./apis/SLA"; +import { PickupPoints } from "./apis/pickup-points"; +import { Polygons } from "./apis/polygons"; export class Logistics { /** diff --git a/src/modules/logistics/apis/SLA/SLA.ts b/src/modules/logistics/apis/SLA/SLA.ts index b6aafb4..dd4b18d 100644 --- a/src/modules/logistics/apis/SLA/SLA.ts +++ b/src/modules/logistics/apis/SLA/SLA.ts @@ -1,16 +1,20 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { CalculateSLARequestItem } from './requests/CalculateSLARequestItem'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; -import { CalculateSLAResponseItem } from './responses/CalculateSLAResponseItem'; +import { AbstractApi } from "../../../AbstractApi"; +import { CalculateSLARequestItem } from "./requests/CalculateSLARequestItem"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { CalculateSLAResponseItem } from "./responses/CalculateSLAResponseItem"; export class SLA extends AbstractApi { /** * Used by checkout to calculate Service Level Agreement. * @param {Array} data */ - calculateSLA(data: Array) - : Promise>>> { - return this.vtexHttpClient - .performRequest('/api/logistics/pvt/shipping/calculate', this.HTTP_METHODS.POST, data); + calculateSLA( + data: Array + ): Promise>>> { + return this.vtexHttpClient.performRequest( + "/api/logistics/pvt/shipping/calculate", + this.HTTP_METHODS.POST, + data + ); } } diff --git a/src/modules/logistics/apis/SLA/index.ts b/src/modules/logistics/apis/SLA/index.ts index 456ba76..5a1b5eb 100644 --- a/src/modules/logistics/apis/SLA/index.ts +++ b/src/modules/logistics/apis/SLA/index.ts @@ -1 +1 @@ -export * from './SLA'; +export * from "./SLA"; diff --git a/src/modules/logistics/apis/carriers/Carriers.ts b/src/modules/logistics/apis/carriers/Carriers.ts index e343071..9adf1ee 100644 --- a/src/modules/logistics/apis/carriers/Carriers.ts +++ b/src/modules/logistics/apis/carriers/Carriers.ts @@ -1,26 +1,35 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; -import { CreateOrUpdateCarrierRequest } from './requests/CreateOrUpdateCarrierRequest'; -import { ListAllCarriersResponseItem } from './responses/ListAllCarriersResponse'; -import { CreateOrUpdateFreightValuesRequestItem } from './requests/CreateOrUpdateFreightValuesRequestItem'; -import { ListFreightValuesResponseItem } from './responses/ListFreightValuesResponseItem'; +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { CreateOrUpdateCarrierRequest } from "./requests/CreateOrUpdateCarrierRequest"; +import { ListAllCarriersResponseItem } from "./responses/ListAllCarriersResponse"; +import { CreateOrUpdateFreightValuesRequestItem } from "./requests/CreateOrUpdateFreightValuesRequestItem"; +import { ListFreightValuesResponseItem } from "./responses/ListFreightValuesResponseItem"; export class Carriers extends AbstractApi { - private static readonly BASE_PATH: string = '/api/logistics/pvt/configuration'; + private static readonly BASE_PATH: string = + "/api/logistics/pvt/configuration"; /** * Creates or updates carriers in your store * @param {CreateOrUpdateCarrierRequest} carrierData */ - createOrUpdateCarrier(carrierData: CreateOrUpdateCarrierRequest): Promise { + createOrUpdateCarrier( + carrierData: CreateOrUpdateCarrierRequest + ): Promise { const path = `${Carriers.BASE_PATH}/carriers`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST, carrierData); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + carrierData + ); } /** * Get information about all carriers in your store. */ - listAllCarriers(): Promise>> { + listAllCarriers(): Promise< + VtexHttpResponse> + > { const path = `${Carriers.BASE_PATH}/carriers`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } @@ -29,7 +38,9 @@ export class Carriers extends AbstractApi { * Lists information about your store's carriers by searching through the Carrier's ID. * @param {string} carrierId */ - listCarrierByid(carrierId: string): Promise> { + listCarrierByid( + carrierId: string + ): Promise> { const path = `${Carriers.BASE_PATH}/carriers/${carrierId}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } @@ -48,10 +59,16 @@ export class Carriers extends AbstractApi { * @param {string} carrierId * @param {Array} freightValues */ - createOrUpdateFreightValues(carrierId: string, - freightValues: Array): Promise { + createOrUpdateFreightValues( + carrierId: string, + freightValues: Array + ): Promise { const path = `${Carriers.BASE_PATH}/freights/${carrierId}/values/update`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST, freightValues); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + freightValues + ); } /** @@ -59,8 +76,10 @@ export class Carriers extends AbstractApi { * @param {string} carrierId * @param {string} cep */ - listFreightValues(carrierId: string, cep: string) - : Promise>> { + listFreightValues( + carrierId: string, + cep: string + ): Promise>> { const path = `${Carriers.BASE_PATH}/freights/${carrierId}/${cep}/values`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } @@ -79,10 +98,17 @@ export class Carriers extends AbstractApi { * @param {string} carrierId * @param {string} deliveryWindow */ - addBlockedDeliveryWindows(carrierId: string, deliveryWindow: string): Promise { + addBlockedDeliveryWindows( + carrierId: string, + deliveryWindow: string + ): Promise { const path = `${Carriers.BASE_PATH}/carriers/${carrierId}/adddayofweekblocked`; const body = `"${deliveryWindow}"`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST, body); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + body + ); } /** @@ -90,11 +116,17 @@ export class Carriers extends AbstractApi { * @param {string} carrierId * @param {string} deliveryWindow */ - removeBlockedDeliveryWindows(carrierId: string, deliveryWindow: string) - : Promise { + removeBlockedDeliveryWindows( + carrierId: string, + deliveryWindow: string + ): Promise { const path = `${Carriers.BASE_PATH}/carriers/${carrierId}/removedayofweekblocked`; const body = `"${deliveryWindow}"`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST, body); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + body + ); } /** diff --git a/src/modules/logistics/apis/carriers/index.ts b/src/modules/logistics/apis/carriers/index.ts index c06d681..d10eb73 100644 --- a/src/modules/logistics/apis/carriers/index.ts +++ b/src/modules/logistics/apis/carriers/index.ts @@ -1 +1 @@ -export * from './Carriers'; +export * from "./Carriers"; diff --git a/src/modules/logistics/apis/docks/Docks.ts b/src/modules/logistics/apis/docks/Docks.ts index 705dd86..5c6b5a2 100644 --- a/src/modules/logistics/apis/docks/Docks.ts +++ b/src/modules/logistics/apis/docks/Docks.ts @@ -1,30 +1,42 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { CreateOrUpdateDockRequest } from './requests/CreateOrUpdateDockRequest'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; +import { AbstractApi } from "../../../AbstractApi"; +import { CreateOrUpdateDockRequest } from "./requests/CreateOrUpdateDockRequest"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; export class Docks extends AbstractApi { - private static readonly BASE_PATH: string = '/api/logistics/pvt/configuration/docks'; + private static readonly BASE_PATH: string = + "/api/logistics/pvt/configuration/docks"; /** * Creates or updates docks to be used in your logistic operation. * @param {CreateOrUpdateDockRequest} dock */ - createOrUpdateDock(dock: CreateOrUpdateDockRequest): Promise { - return this.vtexHttpClient.performRequest(Docks.BASE_PATH, this.HTTP_METHODS.POST, dock); + createOrUpdateDock( + dock: CreateOrUpdateDockRequest + ): Promise { + return this.vtexHttpClient.performRequest( + Docks.BASE_PATH, + this.HTTP_METHODS.POST, + dock + ); } /** * Informs a list of all docks. */ listAllDocks(): Promise>> { - return this.vtexHttpClient.performRequest(Docks.BASE_PATH, this.HTTP_METHODS.GET); + return this.vtexHttpClient.performRequest( + Docks.BASE_PATH, + this.HTTP_METHODS.GET + ); } /** * Informs a given dock's information, searching by dock ID. * @param {string} dockId */ - listDockById(dockId: string): Promise> { + listDockById( + dockId: string + ): Promise> { const path = `${Docks.BASE_PATH}/${dockId}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } diff --git a/src/modules/logistics/apis/docks/index.ts b/src/modules/logistics/apis/docks/index.ts index 079331c..fb8dba7 100644 --- a/src/modules/logistics/apis/docks/index.ts +++ b/src/modules/logistics/apis/docks/index.ts @@ -1 +1 @@ -export * from './Docks'; +export * from "./Docks"; diff --git a/src/modules/logistics/apis/holidays/Holidays.ts b/src/modules/logistics/apis/holidays/Holidays.ts index 29e4ba6..d2757ba 100644 --- a/src/modules/logistics/apis/holidays/Holidays.ts +++ b/src/modules/logistics/apis/holidays/Holidays.ts @@ -1,19 +1,26 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { CreateOrUpdateHolidayRequest } from './requests/CreateOrUpdateHolidayRequest'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; +import { AbstractApi } from "../../../AbstractApi"; +import { CreateOrUpdateHolidayRequest } from "./requests/CreateOrUpdateHolidayRequest"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; export class Holidays extends AbstractApi { - private static readonly BASE_PATH: string = '/api/logistics/pvt/configuration/holidays'; + private static readonly BASE_PATH: string = + "/api/logistics/pvt/configuration/holidays"; /** * Creates or updates holidays through holiday ID. * @param {string} holidayId * @param {string} holidayData */ - createOrUpdateHoliday(holidayId: string, holidayData: CreateOrUpdateHolidayRequest) - : Promise { + createOrUpdateHoliday( + holidayId: string, + holidayData: CreateOrUpdateHolidayRequest + ): Promise { const path = `${Holidays.BASE_PATH}/${holidayId}`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PUT, holidayData); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + holidayData + ); } /** @@ -38,6 +45,9 @@ export class Holidays extends AbstractApi { * Lists information of all holidays. */ listAllHolidays(): Promise { - return this.vtexHttpClient.performRequest(Holidays.BASE_PATH, this.HTTP_METHODS.GET); + return this.vtexHttpClient.performRequest( + Holidays.BASE_PATH, + this.HTTP_METHODS.GET + ); } } diff --git a/src/modules/logistics/apis/holidays/index.ts b/src/modules/logistics/apis/holidays/index.ts index 8f7ef59..39eeaba 100644 --- a/src/modules/logistics/apis/holidays/index.ts +++ b/src/modules/logistics/apis/holidays/index.ts @@ -1 +1 @@ -export * from './Holidays'; +export * from "./Holidays"; diff --git a/src/modules/logistics/apis/inventory/Inventory.ts b/src/modules/logistics/apis/inventory/Inventory.ts index 88e0273..043146d 100644 --- a/src/modules/logistics/apis/inventory/Inventory.ts +++ b/src/modules/logistics/apis/inventory/Inventory.ts @@ -1,17 +1,19 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; -import { ListInventoryBySkuResponse } from './responses/ListInventoryBySkuResponse'; -import { ListInventoryWithDispatchedReservationsResponse } from './responses/ListInventoryWithDispatchedReservationsResponse'; -import { UpdateInventoryBySkuAndWarehouseRequest } from './requests/UpdateInventoryBySkuAndWarehouseRequest'; +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { ListInventoryBySkuResponse } from "./responses/ListInventoryBySkuResponse"; +import { ListInventoryWithDispatchedReservationsResponse } from "./responses/ListInventoryWithDispatchedReservationsResponse"; +import { UpdateInventoryBySkuAndWarehouseRequest } from "./requests/UpdateInventoryBySkuAndWarehouseRequest"; export class Inventory extends AbstractApi { - private static readonly BASE_PATH: string = '/api/logistics/pvt/inventory'; + private static readonly BASE_PATH: string = "/api/logistics/pvt/inventory"; /** * Lists your store's inventory by SKU ID * @param {string} skuId */ - listInventoryBySku(skuId: string): Promise> { + listInventoryBySku( + skuId: string + ): Promise> { const path = `${Inventory.BASE_PATH}/skus/${skuId}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } @@ -21,7 +23,10 @@ export class Inventory extends AbstractApi { * @param {string} skuId * @param {string} warehouseId */ - listInventoryPerWarehouse(skuId: string, warehouseId: string): Promise { + listInventoryPerWarehouse( + skuId: string, + warehouseId: string + ): Promise { const path = `${Inventory.BASE_PATH}/items/${skuId}/warehouses/${warehouseId}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } @@ -31,7 +36,10 @@ export class Inventory extends AbstractApi { * @param {string} skuId * @param {string} dockId */ - listInventoryPerDock(skuId: string, dockId: string): Promise { + listInventoryPerDock( + skuId: string, + dockId: string + ): Promise { const path = `${Inventory.BASE_PATH}/items/${skuId}/docks/${dockId}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } @@ -42,8 +50,11 @@ export class Inventory extends AbstractApi { * @param {string} dockId * @param {string} warehouseId */ - listInventoryPerDockAndWarehouse(skuId: string, dockId: string, warehouseId: string) - : Promise { + listInventoryPerDockAndWarehouse( + skuId: string, + dockId: string, + warehouseId: string + ): Promise { const path = `${Inventory.BASE_PATH}/items/${skuId}/docks/${dockId}/warehouses/${warehouseId}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } @@ -56,8 +67,12 @@ export class Inventory extends AbstractApi { * @param {string} itemId * @param {string} warehouseId */ - listInventoryWithDispatchedReservations(itemId: string, warehouseId: string) - : Promise> { + listInventoryWithDispatchedReservations( + itemId: string, + warehouseId: string + ): Promise< + VtexHttpResponse + > { const path = `${Inventory.BASE_PATH}/items/${itemId}/warehouses/${warehouseId}/dispatched`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } @@ -68,9 +83,16 @@ export class Inventory extends AbstractApi { * @param {string} warehouseId * @param {UpdateInventoryBySkuAndWarehouseRequest} inventoryData */ - updateInventoryBySkuAndWarehouse(skuId: string, warehouseId: string, - inventoryData: UpdateInventoryBySkuAndWarehouseRequest): Promise { + updateInventoryBySkuAndWarehouse( + skuId: string, + warehouseId: string, + inventoryData: UpdateInventoryBySkuAndWarehouseRequest + ): Promise { const path = `${Inventory.BASE_PATH}/skus/${skuId}/warehouses/${warehouseId}/dispatched`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PUT, inventoryData); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + inventoryData + ); } } diff --git a/src/modules/logistics/apis/inventory/index.ts b/src/modules/logistics/apis/inventory/index.ts index 4f98980..1ba1871 100644 --- a/src/modules/logistics/apis/inventory/index.ts +++ b/src/modules/logistics/apis/inventory/index.ts @@ -1 +1 @@ -export * from './Inventory'; +export * from "./Inventory"; diff --git a/src/modules/logistics/apis/pickup-points/PickupPoints.ts b/src/modules/logistics/apis/pickup-points/PickupPoints.ts index 82efb7f..d460848 100644 --- a/src/modules/logistics/apis/pickup-points/PickupPoints.ts +++ b/src/modules/logistics/apis/pickup-points/PickupPoints.ts @@ -1,28 +1,35 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { CreateOrUpdatePickupPointRequest } from './requests/CreateOrUpdatePickupPointRequest'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; +import { AbstractApi } from "../../../AbstractApi"; +import { CreateOrUpdatePickupPointRequest } from "./requests/CreateOrUpdatePickupPointRequest"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; export class PickupPoints extends AbstractApi { - private static readonly BASE_PATH: string = '/api/logistics/pvt/configuration/pickuppoints'; + private static readonly BASE_PATH: string = + "/api/logistics/pvt/configuration/pickuppoints"; /** * Creates or updates pickup points in your store by Pickup Point ID. * @param {string} pickupPointId * @param {CreateOrUpdatePickupPointRequest} pickupPointData */ - createOrUpdatePickupPoint(pickupPointId: string, - pickupPointData: CreateOrUpdatePickupPointRequest) - : Promise> { + createOrUpdatePickupPoint( + pickupPointId: string, + pickupPointData: CreateOrUpdatePickupPointRequest + ): Promise> { const path = `${PickupPoints.BASE_PATH}/${pickupPointId}`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PUT, pickupPointData); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + pickupPointData + ); } /** * Lists your store's pickup points while searching by ID. * @param {string} pickupPointId */ - listPickupPointById(pickupPointId: string) - : Promise> { + listPickupPointById( + pickupPointId: string + ): Promise> { const path = `${PickupPoints.BASE_PATH}/${pickupPointId}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } diff --git a/src/modules/logistics/apis/pickup-points/index.ts b/src/modules/logistics/apis/pickup-points/index.ts index 3ba301f..06d4358 100644 --- a/src/modules/logistics/apis/pickup-points/index.ts +++ b/src/modules/logistics/apis/pickup-points/index.ts @@ -1 +1 @@ -export * from './PickupPoints'; +export * from "./PickupPoints"; diff --git a/src/modules/logistics/apis/polygons/Polygons.ts b/src/modules/logistics/apis/polygons/Polygons.ts index 5054d9d..73ee14d 100644 --- a/src/modules/logistics/apis/polygons/Polygons.ts +++ b/src/modules/logistics/apis/polygons/Polygons.ts @@ -1,9 +1,10 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; -import { CreateOrUpdatePolygonRequest } from './requests/CreateOrUpdatePolygonRequest'; +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { CreateOrUpdatePolygonRequest } from "./requests/CreateOrUpdatePolygonRequest"; export class Polygons extends AbstractApi { - private static readonly BASE_PATH: string = '/api/logistics/pvt/configuration/geoshape'; + private static readonly BASE_PATH: string = + "/api/logistics/pvt/configuration/geoshape"; /** * Lists stored polygons. @@ -19,9 +20,14 @@ export class Polygons extends AbstractApi { * Creates or updates your store's polygons by geoshape coordinates and polygon name. * @param {CreateOrUpdatePolygonRequest} polygonData */ - createOrUpdatePolygon(polygonData: CreateOrUpdatePolygonRequest): Promise { - return this.vtexHttpClient - .performRequest(Polygons.BASE_PATH, this.HTTP_METHODS.PUT, polygonData); + createOrUpdatePolygon( + polygonData: CreateOrUpdatePolygonRequest + ): Promise { + return this.vtexHttpClient.performRequest( + Polygons.BASE_PATH, + this.HTTP_METHODS.PUT, + polygonData + ); } /** diff --git a/src/modules/logistics/apis/polygons/index.ts b/src/modules/logistics/apis/polygons/index.ts index 1eedf7b..024dc93 100644 --- a/src/modules/logistics/apis/polygons/index.ts +++ b/src/modules/logistics/apis/polygons/index.ts @@ -1 +1 @@ -export * from './Polygons'; +export * from "./Polygons"; diff --git a/src/modules/logistics/apis/polygons/requests/CreateOrUpdatePolygonRequest.ts b/src/modules/logistics/apis/polygons/requests/CreateOrUpdatePolygonRequest.ts index f84e863..cfa4963 100644 --- a/src/modules/logistics/apis/polygons/requests/CreateOrUpdatePolygonRequest.ts +++ b/src/modules/logistics/apis/polygons/requests/CreateOrUpdatePolygonRequest.ts @@ -1,5 +1,5 @@ interface GeoShape { - coordinates?: Array>> + coordinates?: Array>>; } export interface CreateOrUpdatePolygonRequest { diff --git a/src/modules/logistics/apis/reservations/Reservations.ts b/src/modules/logistics/apis/reservations/Reservations.ts index 36679fd..acec67f 100644 --- a/src/modules/logistics/apis/reservations/Reservations.ts +++ b/src/modules/logistics/apis/reservations/Reservations.ts @@ -1,26 +1,33 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { CreateReservationRequest } from './requests/CreateReservationRequest'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; -import { CreateReservationResponse } from './responses/CreateReservationResponse'; +import { AbstractApi } from "../../../AbstractApi"; +import { CreateReservationRequest } from "./requests/CreateReservationRequest"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { CreateReservationResponse } from "./responses/CreateReservationResponse"; export class Reservations extends AbstractApi { - private static readonly BASE_PATH: string = '/api/logistics/pvt/inventory/reservations'; + private static readonly BASE_PATH: string = + "/api/logistics/pvt/inventory/reservations"; /** * Creates reservation * @param {CreateReservationRequest} reservation */ - createReservation(reservation: CreateReservationRequest) - : Promise> { - return this.vtexHttpClient - .performRequest(Reservations.BASE_PATH, this.HTTP_METHODS.POST, reservation); + createReservation( + reservation: CreateReservationRequest + ): Promise> { + return this.vtexHttpClient.performRequest( + Reservations.BASE_PATH, + this.HTTP_METHODS.POST, + reservation + ); } /** * Lists reservation's information by ID. * @param {string} reservationId */ - listReservationById(reservationId: string): Promise> { + listReservationById( + reservationId: string + ): Promise> { const path = `${Reservations.BASE_PATH}/${reservationId}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } @@ -57,7 +64,10 @@ export class Reservations extends AbstractApi { * @param {string} warehouseId * @param {string} skuId */ - listReservationByWarehouseAndSku(warehouseId: string, skuId: string): Promise { + listReservationByWarehouseAndSku( + warehouseId: string, + skuId: string + ): Promise { const path = `${Reservations.BASE_PATH}/${warehouseId}/${skuId}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } diff --git a/src/modules/logistics/apis/reservations/index.ts b/src/modules/logistics/apis/reservations/index.ts index 2bf648a..815794a 100644 --- a/src/modules/logistics/apis/reservations/index.ts +++ b/src/modules/logistics/apis/reservations/index.ts @@ -1 +1 @@ -export * from './Reservations'; +export * from "./Reservations"; diff --git a/src/modules/logistics/apis/shipping-policies/ShippingPolicies.ts b/src/modules/logistics/apis/shipping-policies/ShippingPolicies.ts index c140616..5af1e50 100644 --- a/src/modules/logistics/apis/shipping-policies/ShippingPolicies.ts +++ b/src/modules/logistics/apis/shipping-policies/ShippingPolicies.ts @@ -1,10 +1,11 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; -import { CreateShippingPolicyRequest } from './requests/CreateShippingPolicyRequest'; -import { UpdateShippingPolicyRequest } from './requests/UpdateShippingPolicyRequest'; +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { CreateShippingPolicyRequest } from "./requests/CreateShippingPolicyRequest"; +import { UpdateShippingPolicyRequest } from "./requests/UpdateShippingPolicyRequest"; export class ShippingPolicies extends AbstractApi { - private static readonly BASE_PATH: string = '/api/logistics/pvt/shipping-policies'; + private static readonly BASE_PATH: string = + "/api/logistics/pvt/shipping-policies"; /** * Lists existing shipping policies from carriers in your store, searching by their IDs. @@ -28,16 +29,24 @@ export class ShippingPolicies extends AbstractApi { * Lists existing shipping policies from carriers in your store. */ listShippingPolicies(): Promise { - return this.vtexHttpClient.performRequest(ShippingPolicies.BASE_PATH, this.HTTP_METHODS.GET); + return this.vtexHttpClient.performRequest( + ShippingPolicies.BASE_PATH, + this.HTTP_METHODS.GET + ); } /** * Creates new shipping policies from carriers in your store. * @param {CreateShippingPolicyRequest} shippingPolicy */ - createShippingPolicy(shippingPolicy: CreateShippingPolicyRequest): Promise { - return this.vtexHttpClient - .performRequest(ShippingPolicies.BASE_PATH, this.HTTP_METHODS.POST, shippingPolicy); + createShippingPolicy( + shippingPolicy: CreateShippingPolicyRequest + ): Promise { + return this.vtexHttpClient.performRequest( + ShippingPolicies.BASE_PATH, + this.HTTP_METHODS.POST, + shippingPolicy + ); } /** @@ -45,9 +54,15 @@ export class ShippingPolicies extends AbstractApi { * @param {string} id * @param {UpdateShippingPolicyRequest} shippingPolicy */ - updateShippingPolicy(id: string, shippingPolicy: UpdateShippingPolicyRequest) - : Promise { + updateShippingPolicy( + id: string, + shippingPolicy: UpdateShippingPolicyRequest + ): Promise { const path = `${ShippingPolicies.BASE_PATH}/${id}`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PUT, shippingPolicy); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + shippingPolicy + ); } } diff --git a/src/modules/logistics/apis/shipping-policies/index.ts b/src/modules/logistics/apis/shipping-policies/index.ts index 0123996..1e99c68 100644 --- a/src/modules/logistics/apis/shipping-policies/index.ts +++ b/src/modules/logistics/apis/shipping-policies/index.ts @@ -1 +1 @@ -export * from './ShippingPolicies'; +export * from "./ShippingPolicies"; diff --git a/src/modules/logistics/apis/warehouses/Warehouses.ts b/src/modules/logistics/apis/warehouses/Warehouses.ts index 8fc3837..a187691 100644 --- a/src/modules/logistics/apis/warehouses/Warehouses.ts +++ b/src/modules/logistics/apis/warehouses/Warehouses.ts @@ -1,32 +1,45 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { CreateOrUpdateWarehouseRequest } from './requests/CreateOrUpdateWarehouseRequest'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; -import { ListAllWarehousesResponseItem } from './responses/ListAllWarehousesResponseItem'; +import { AbstractApi } from "../../../AbstractApi"; +import { CreateOrUpdateWarehouseRequest } from "./requests/CreateOrUpdateWarehouseRequest"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { ListAllWarehousesResponseItem } from "./responses/ListAllWarehousesResponseItem"; export class Warehouses extends AbstractApi { - private static readonly BASE_PATH: string = '/api/logistics/pvt/configuration/warehouses'; + private static readonly BASE_PATH: string = + "/api/logistics/pvt/configuration/warehouses"; /** * Creates or updates your store's warehouses * @param {CreateOrUpdateWarehouseRequest} warehouse */ - createOrUpdateWarehouse(warehouse: CreateOrUpdateWarehouseRequest): Promise { - return this.vtexHttpClient - .performRequest(Warehouses.BASE_PATH, this.HTTP_METHODS.POST, warehouse); + createOrUpdateWarehouse( + warehouse: CreateOrUpdateWarehouseRequest + ): Promise { + return this.vtexHttpClient.performRequest( + Warehouses.BASE_PATH, + this.HTTP_METHODS.POST, + warehouse + ); } /** * Lists information about all warehouses set up in your store. */ - listAllWarehouses(): Promise>> { - return this.vtexHttpClient.performRequest(Warehouses.BASE_PATH, this.HTTP_METHODS.GET); + listAllWarehouses(): Promise< + VtexHttpResponse> + > { + return this.vtexHttpClient.performRequest( + Warehouses.BASE_PATH, + this.HTTP_METHODS.GET + ); } /** * Lists the information of a given warehouse, searching by warehouse ID. * @param {string} warehouseId */ - listWarehouseById(warehouseId: string): Promise> { + listWarehouseById( + warehouseId: string + ): Promise> { const path = `${Warehouses.BASE_PATH}/${warehouseId}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } diff --git a/src/modules/logistics/apis/warehouses/index.ts b/src/modules/logistics/apis/warehouses/index.ts index c7688ed..0c172f4 100644 --- a/src/modules/logistics/apis/warehouses/index.ts +++ b/src/modules/logistics/apis/warehouses/index.ts @@ -1 +1 @@ -export * from './Warehouses'; +export * from "./Warehouses"; diff --git a/src/modules/logistics/index.ts b/src/modules/logistics/index.ts index 5ccc9de..8ae905c 100644 --- a/src/modules/logistics/index.ts +++ b/src/modules/logistics/index.ts @@ -1 +1 @@ -export * from './Logistics'; +export * from "./Logistics"; diff --git a/src/modules/master-data/v2/MasterData.ts b/src/modules/master-data/v2/MasterData.ts index a17b20e..fc86650 100644 --- a/src/modules/master-data/v2/MasterData.ts +++ b/src/modules/master-data/v2/MasterData.ts @@ -1,11 +1,11 @@ -import { VtexHttpClient } from '../../../utils/VtexHttpClient'; -import { Documents } from './apis/documents'; -import { Search } from './apis/search'; -import { Scroll } from './apis/scroll'; -import { Schemas } from './apis/schemas'; -import { Indices } from './apis/indices'; -import { Clusters } from './apis/clusters'; -import { Versions } from './apis/versions'; +import { VtexHttpClient } from "../../../utils/VtexHttpClient"; +import { Documents } from "./apis/documents"; +import { Search } from "./apis/search"; +import { Scroll } from "./apis/scroll"; +import { Schemas } from "./apis/schemas"; +import { Indices } from "./apis/indices"; +import { Clusters } from "./apis/clusters"; +import { Versions } from "./apis/versions"; export class MasterData { /** diff --git a/src/modules/master-data/v2/apis/clusters/Clusters.ts b/src/modules/master-data/v2/apis/clusters/Clusters.ts index b5a175c..c99ca81 100644 --- a/src/modules/master-data/v2/apis/clusters/Clusters.ts +++ b/src/modules/master-data/v2/apis/clusters/Clusters.ts @@ -1,6 +1,6 @@ -import { AbstractApi } from '../../../../AbstractApi'; -import { VtexHttpResponse } from '../../../../../utils/VtexHttpResponse'; -import { ValidateDocumentByClustersRequestItem } from './requests/ValidateDocumentByClustersRequestItem'; +import { AbstractApi } from "../../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../../utils/VtexHttpResponse"; +import { ValidateDocumentByClustersRequestItem } from "./requests/ValidateDocumentByClustersRequestItem"; export class Clusters extends AbstractApi { /** @@ -9,12 +9,15 @@ export class Clusters extends AbstractApi { * @param {string} id * @param {Array} rules */ - validateDocumentByClusters(dataEntityName: string, id: string, - rules: Array): Promise { + validateDocumentByClusters( + dataEntityName: string, + id: string, + rules: Array + ): Promise { return this.vtexHttpClient.performRequest( `/api/dataentities/${dataEntityName}/documents/${id}/clusters`, this.HTTP_METHODS.POST, - rules, + rules ); } } diff --git a/src/modules/master-data/v2/apis/clusters/index.ts b/src/modules/master-data/v2/apis/clusters/index.ts index 148d503..4aa1bbd 100644 --- a/src/modules/master-data/v2/apis/clusters/index.ts +++ b/src/modules/master-data/v2/apis/clusters/index.ts @@ -1 +1 @@ -export * from './Clusters'; +export * from "./Clusters"; diff --git a/src/modules/master-data/v2/apis/documents/Documents.ts b/src/modules/master-data/v2/apis/documents/Documents.ts index fac07e4..d3b9bda 100644 --- a/src/modules/master-data/v2/apis/documents/Documents.ts +++ b/src/modules/master-data/v2/apis/documents/Documents.ts @@ -1,10 +1,10 @@ -import { AbstractApi } from '../../../../AbstractApi'; -import { VtexHttpResponse } from '../../../../../utils/VtexHttpResponse'; -import { CreateNewDocumentResponse } from './responses/CreateNewDocumentResponse'; -import { GetDocumentResponse } from './responses/GetDocumentResponse'; +import { AbstractApi } from "../../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../../utils/VtexHttpResponse"; +import { CreateNewDocumentResponse } from "./responses/CreateNewDocumentResponse"; +import { GetDocumentResponse } from "./responses/GetDocumentResponse"; export class Documents extends AbstractApi { - private static readonly BASE_PATH: string = '/api/dataentities'; + private static readonly BASE_PATH: string = "/api/dataentities"; /** * @@ -12,10 +12,19 @@ export class Documents extends AbstractApi { * @param {any} documentData * @param {string} params Example: _schema=schema1 */ - createNewDocument(dataEntityName: string, documentData: any, params?: string) - : Promise> { - const path = `${Documents.BASE_PATH}/${dataEntityName}/documents?${params}`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST, documentData); + createNewDocument( + dataEntityName: string, + documentData: any, + params?: string + ): Promise> { + const path = `${Documents.BASE_PATH}/${dataEntityName}/documents?${ + params || "" + }`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + documentData + ); } /** @@ -24,10 +33,19 @@ export class Documents extends AbstractApi { * @param {any} documentData * @param {string} params Example: _schema=schema1 */ - createOrUpdateEntireDocument(dataEntityName: string, documentData: any, params?: string) - : Promise { - const path = `${Documents.BASE_PATH}/${dataEntityName}/documents?${params}`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PUT, documentData); + createOrUpdateEntireDocument( + dataEntityName: string, + documentData: any, + params?: string + ): Promise { + const path = `${Documents.BASE_PATH}/${dataEntityName}/documents?${ + params || "" + }`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + documentData + ); } /** @@ -36,10 +54,19 @@ export class Documents extends AbstractApi { * @param {any} documentData * @param {string} params Example: _schema=schema1 */ - createOrUpdatePartialDocument(dataEntityName: string, documentData: any, params?: string) - : Promise { - const path = `${Documents.BASE_PATH}/${dataEntityName}/documents?${params}`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PATCH, documentData); + createOrUpdatePartialDocument( + dataEntityName: string, + documentData: any, + params?: string + ): Promise { + const path = `${Documents.BASE_PATH}/${dataEntityName}/documents?${ + params || "" + }`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PATCH, + documentData + ); } /** @@ -48,9 +75,14 @@ export class Documents extends AbstractApi { * @param {string} id * @param {string} params Example: _schema=schema1&_where=where-statement */ - getDocument(dataEntityName: string, id: string, params?: string) - : Promise> { - const path = `${Documents.BASE_PATH}/${dataEntityName}/documents/${id}?${params}`; + getDocument( + dataEntityName: string, + id: string, + params?: string + ): Promise> { + const path = `${Documents.BASE_PATH}/${dataEntityName}/documents/${id}?${ + params || "" + }`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } @@ -61,10 +93,20 @@ export class Documents extends AbstractApi { * @param {any} documentData * @param {string} params Example: _schema=schema1&_where=where-statement */ - updateEntireDocument(dataEntityName: string, id: string, documentData: any, params?: string) - : Promise { - const path = `${Documents.BASE_PATH}/${dataEntityName}/documents/${id}?${params}`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PUT, documentData); + updateEntireDocument( + dataEntityName: string, + id: string, + documentData: any, + params?: string + ): Promise { + const path = `${Documents.BASE_PATH}/${dataEntityName}/documents/${id}?${ + params || "" + }`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + documentData + ); } /** @@ -74,10 +116,20 @@ export class Documents extends AbstractApi { * @param {any} documentData * @param {string} params Example: _schema=schema1&_where=where-statement */ - updatePartialDocument(dataEntityName: string, id: string, documentData: any, params?: string) - : Promise { - const path = `${Documents.BASE_PATH}/${dataEntityName}/documents/${id}?${params}`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PATCH, documentData); + updatePartialDocument( + dataEntityName: string, + id: string, + documentData: any, + params?: string + ): Promise { + const path = `${Documents.BASE_PATH}/${dataEntityName}/documents/${id}?${ + params || "" + }`; + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PATCH, + documentData + ); } /** @@ -85,7 +137,10 @@ export class Documents extends AbstractApi { * @param {string} dataEntityName * @param {string} id */ - deleteDocument(dataEntityName: string, id: string): Promise { + deleteDocument( + dataEntityName: string, + id: string + ): Promise { const path = `${Documents.BASE_PATH}/${dataEntityName}/documents/${id}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); } diff --git a/src/modules/master-data/v2/apis/documents/index.ts b/src/modules/master-data/v2/apis/documents/index.ts index da1ce4a..cb43253 100644 --- a/src/modules/master-data/v2/apis/documents/index.ts +++ b/src/modules/master-data/v2/apis/documents/index.ts @@ -1 +1 @@ -export * from './Documents'; +export * from "./Documents"; diff --git a/src/modules/master-data/v2/apis/indices/Indices.ts b/src/modules/master-data/v2/apis/indices/Indices.ts index 2691770..630e3e4 100644 --- a/src/modules/master-data/v2/apis/indices/Indices.ts +++ b/src/modules/master-data/v2/apis/indices/Indices.ts @@ -1,9 +1,9 @@ -import { AbstractApi } from '../../../../AbstractApi'; -import { VtexHttpResponse } from '../../../../../utils/VtexHttpResponse'; -import { PutIndicesRequest } from './requests/PutIndicesRequest'; +import { AbstractApi } from "../../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../../utils/VtexHttpResponse"; +import { PutIndicesRequest } from "./requests/PutIndicesRequest"; export class Indices extends AbstractApi { - private static readonly BASE_PATH: string = '/api/dataentities'; + private static readonly BASE_PATH: string = "/api/dataentities"; /** * Return the list of indices by data entity. @@ -19,9 +19,16 @@ export class Indices extends AbstractApi { * @param {string} dataEntityName * @param {PutIndicesRequest} indexData */ - putIndices(dataEntityName: string, indiceData: PutIndicesRequest): Promise { + putIndices( + dataEntityName: string, + indiceData: PutIndicesRequest + ): Promise { const path = `${Indices.BASE_PATH}/${dataEntityName}/indices`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PUT, indiceData); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + indiceData + ); } /** @@ -29,7 +36,10 @@ export class Indices extends AbstractApi { * @param {string} dataEntityName * @param {string} indiceName */ - getIndiceByName(dataEntityName: string, indiceName: string): Promise { + getIndiceByName( + dataEntityName: string, + indiceName: string + ): Promise { const path = `${Indices.BASE_PATH}/${dataEntityName}/indices/${indiceName}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } diff --git a/src/modules/master-data/v2/apis/indices/index.ts b/src/modules/master-data/v2/apis/indices/index.ts index 088506f..bee77b3 100644 --- a/src/modules/master-data/v2/apis/indices/index.ts +++ b/src/modules/master-data/v2/apis/indices/index.ts @@ -1 +1 @@ -export * from './Indices'; +export * from "./Indices"; diff --git a/src/modules/master-data/v2/apis/schemas/Schemas.ts b/src/modules/master-data/v2/apis/schemas/Schemas.ts index 0032102..0da981a 100644 --- a/src/modules/master-data/v2/apis/schemas/Schemas.ts +++ b/src/modules/master-data/v2/apis/schemas/Schemas.ts @@ -1,8 +1,8 @@ -import { AbstractApi } from '../../../../AbstractApi'; -import { VtexHttpResponse } from '../../../../../utils/VtexHttpResponse'; +import { AbstractApi } from "../../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../../utils/VtexHttpResponse"; export class Schemas extends AbstractApi { - private static readonly BASE_PATH: string = '/api/dataentities'; + private static readonly BASE_PATH: string = "/api/dataentities"; /** * Return the schemas saved. @@ -18,7 +18,10 @@ export class Schemas extends AbstractApi { * @param {string} dataEntityName * @param {string} schemaName */ - getSchemaByName(dataEntityName: string, schemaName: string): Promise { + getSchemaByName( + dataEntityName: string, + schemaName: string + ): Promise { const path = `${Schemas.BASE_PATH}/${dataEntityName}/schemas/${schemaName}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } @@ -29,9 +32,16 @@ export class Schemas extends AbstractApi { * @param {string} schemaName * @param {any} schemaData */ - saveSchemaByName(dataEntityName: string, schemaName: string, schemaData: any) - : Promise { + saveSchemaByName( + dataEntityName: string, + schemaName: string, + schemaData: any + ): Promise { const path = `${Schemas.BASE_PATH}/${dataEntityName}/schemas/${schemaName}`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PUT, schemaData); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + schemaData + ); } } diff --git a/src/modules/master-data/v2/apis/schemas/index.ts b/src/modules/master-data/v2/apis/schemas/index.ts index 459ce26..235b685 100644 --- a/src/modules/master-data/v2/apis/schemas/index.ts +++ b/src/modules/master-data/v2/apis/schemas/index.ts @@ -1 +1 @@ -export * from './Schemas'; +export * from "./Schemas"; diff --git a/src/modules/master-data/v2/apis/scroll/Scroll.ts b/src/modules/master-data/v2/apis/scroll/Scroll.ts index c4b7cfc..f0d2a1f 100644 --- a/src/modules/master-data/v2/apis/scroll/Scroll.ts +++ b/src/modules/master-data/v2/apis/scroll/Scroll.ts @@ -1,4 +1,4 @@ -import { AbstractApi } from '../../../../AbstractApi'; +import { AbstractApi } from "../../../../AbstractApi"; export class Scroll extends AbstractApi { /** @@ -8,7 +8,8 @@ export class Scroll extends AbstractApi { */ scrollDocuments(dataEntityName: string, params?: string) { return this.vtexHttpClient.performRequest( - `/api/dataentities/${dataEntityName}/scroll?${params}`, this.HTTP_METHODS.GET, + `/api/dataentities/${dataEntityName}/scroll?${params || ""}`, + this.HTTP_METHODS.GET ); } } diff --git a/src/modules/master-data/v2/apis/scroll/index.ts b/src/modules/master-data/v2/apis/scroll/index.ts index 2b89663..b2ea37b 100644 --- a/src/modules/master-data/v2/apis/scroll/index.ts +++ b/src/modules/master-data/v2/apis/scroll/index.ts @@ -1 +1 @@ -export * from './Scroll'; +export * from "./Scroll"; diff --git a/src/modules/master-data/v2/apis/search/Search.ts b/src/modules/master-data/v2/apis/search/Search.ts index 900175c..856e12c 100644 --- a/src/modules/master-data/v2/apis/search/Search.ts +++ b/src/modules/master-data/v2/apis/search/Search.ts @@ -1,6 +1,6 @@ -import { AbstractApi } from '../../../../AbstractApi'; -import { VtexHttpResponse } from '../../../../../utils/VtexHttpResponse'; -import { RestRange } from './requests/RestRange'; +import { AbstractApi } from "../../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../../utils/VtexHttpResponse"; +import { RestRange } from "./requests/RestRange"; export class Search extends AbstractApi { /** @@ -9,14 +9,19 @@ export class Search extends AbstractApi { * @param {RestRange} range * @param {string} params Example: _schema=schema1&_where=where-statement */ - searchDocuments(dataEntityName: string, range?: RestRange, params?: string) - : Promise { - const headers = range ? { 'REST-Range': `resources=${range.from}-${range.to}` } : null; + searchDocuments( + dataEntityName: string, + range?: RestRange, + params?: string + ): Promise { + const headers = range + ? { "REST-Range": `resources=${range.from}-${range.to}` } + : null; return this.vtexHttpClient.performRequest( - `/api/dataentities/${dataEntityName}/search?${params}`, + `/api/dataentities/${dataEntityName}/search?${params || ""}`, this.HTTP_METHODS.GET, null, - headers, + headers ); } } diff --git a/src/modules/master-data/v2/apis/search/index.ts b/src/modules/master-data/v2/apis/search/index.ts index addd533..f3cfe1b 100644 --- a/src/modules/master-data/v2/apis/search/index.ts +++ b/src/modules/master-data/v2/apis/search/index.ts @@ -1 +1 @@ -export * from './Search'; +export * from "./Search"; diff --git a/src/modules/master-data/v2/apis/versions/Versions.ts b/src/modules/master-data/v2/apis/versions/Versions.ts index 6b6bb62..ebb278a 100644 --- a/src/modules/master-data/v2/apis/versions/Versions.ts +++ b/src/modules/master-data/v2/apis/versions/Versions.ts @@ -1,19 +1,21 @@ -import { AbstractApi } from '../../../../AbstractApi'; -import { VtexHttpResponse } from '../../../../../utils/VtexHttpResponse'; -import { ListVersionsResponseItem } from './responses/ListVersionsResponseItem'; -import { GetVersionResponse } from './responses/GetVersionResponse'; -import { PutVersionResponse } from './responses/PutVersionResponse'; +import { AbstractApi } from "../../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../../utils/VtexHttpResponse"; +import { ListVersionsResponseItem } from "./responses/ListVersionsResponseItem"; +import { GetVersionResponse } from "./responses/GetVersionResponse"; +import { PutVersionResponse } from "./responses/PutVersionResponse"; export class Versions extends AbstractApi { - private static readonly BASE_PATH: string = '/api/dataentities'; + private static readonly BASE_PATH: string = "/api/dataentities"; /** * Allows to list the versions of a document. * @param {string} dataEntityName * @param {string} id */ - listVersions(dataEntityName: string, id: string) - : Promise>> { + listVersions( + dataEntityName: string, + id: string + ): Promise>> { const path = `${Versions.BASE_PATH}/${dataEntityName}/documents/${id}/versions`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } @@ -24,8 +26,11 @@ export class Versions extends AbstractApi { * @param {string} id * @param {string} versionId */ - getVersion(dataEntityName: string, id: string, versionId: string) - : Promise> { + getVersion( + dataEntityName: string, + id: string, + versionId: string + ): Promise> { const path = `${Versions.BASE_PATH}/${dataEntityName}/documents/${id}/versions/${versionId}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } @@ -36,8 +41,11 @@ export class Versions extends AbstractApi { * @param {string} id * @param {string} versionId */ - putVersion(dataEntityName: string, id: string, versionId: string) - : Promise> { + putVersion( + dataEntityName: string, + id: string, + versionId: string + ): Promise> { const path = `${Versions.BASE_PATH}/${dataEntityName}/documents/${id}/versions/${versionId}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PUT); } diff --git a/src/modules/master-data/v2/apis/versions/index.ts b/src/modules/master-data/v2/apis/versions/index.ts index 958a80b..3029a04 100644 --- a/src/modules/master-data/v2/apis/versions/index.ts +++ b/src/modules/master-data/v2/apis/versions/index.ts @@ -1 +1 @@ -export * from './Versions'; +export * from "./Versions"; diff --git a/src/modules/master-data/v2/index.ts b/src/modules/master-data/v2/index.ts index 272177a..bae7d20 100644 --- a/src/modules/master-data/v2/index.ts +++ b/src/modules/master-data/v2/index.ts @@ -1 +1 @@ -export * from './MasterData'; +export * from "./MasterData"; diff --git a/src/modules/pricing/Pricing.ts b/src/modules/pricing/Pricing.ts index 6593dcb..a12e0f2 100644 --- a/src/modules/pricing/Pricing.ts +++ b/src/modules/pricing/Pricing.ts @@ -1,13 +1,13 @@ -import { VtexHttpClient } from '../../utils/VtexHttpClient'; -import { PriceTables } from './apis/price-tables'; -import { PricesAndFixedPrices } from './apis/prices-and-fixed-prices'; -import { PricingConfig } from './apis/pricing-config'; +import { VtexHttpClient } from "../../utils/VtexHttpClient"; +import { PriceTables } from "./apis/price-tables"; +import { PricesAndFixedPrices } from "./apis/prices-and-fixed-prices"; +import { PricingConfig } from "./apis/pricing-config"; export class Pricing { /** * Price Tables API */ - readonly priceTables: PriceTables + readonly priceTables: PriceTables; /** * Prices and Fixed Prices API diff --git a/src/modules/pricing/apis/price-tables/PriceTables.ts b/src/modules/pricing/apis/price-tables/PriceTables.ts index d4875d4..e0642e7 100644 --- a/src/modules/pricing/apis/price-tables/PriceTables.ts +++ b/src/modules/pricing/apis/price-tables/PriceTables.ts @@ -1,24 +1,31 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; -import { GetRulesForPriceTableResponse } from './responses/GetRulesForPriceTableResponse'; +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { GetRulesForPriceTableResponse } from "./responses/GetRulesForPriceTableResponse"; export class PriceTables extends AbstractApi { - private static readonly BASE_PATH: string = '/api/pricing/pipeline/catalog/'; + private static readonly BASE_PATH: string = "/api/pricing/pipeline/catalog/"; /** * This method will create the rules from a specific Price Table * @param {any} data */ - createRulesForPriceTable(data: GetRulesForPriceTableResponse): Promise { - return this.vtexHttpClient.performRequest(PriceTables.BASE_PATH, this.HTTP_METHODS.POST, data); + createRulesForPriceTable( + data: GetRulesForPriceTableResponse + ): Promise { + return this.vtexHttpClient.performRequest( + PriceTables.BASE_PATH, + this.HTTP_METHODS.POST, + data + ); } /** * This method will retrieve the rules from a specific Price Table. * @param {string} priceTableId */ - getRulesForPriceTable(priceTableId: string) - : Promise> { + getRulesForPriceTable( + priceTableId: string + ): Promise> { const path = `${PriceTables.BASE_PATH}/${priceTableId}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } @@ -30,9 +37,15 @@ export class PriceTables extends AbstractApi { * @param {string} priceTableId * @param {GetRulesForPriceTableResponse} data */ - updateRulesForPriceTable(priceTableId: string, data: GetRulesForPriceTableResponse) - : Promise { + updateRulesForPriceTable( + priceTableId: string, + data: GetRulesForPriceTableResponse + ): Promise { const path = `${PriceTables.BASE_PATH}/${priceTableId}`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PUT, data); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + data + ); } } diff --git a/src/modules/pricing/apis/price-tables/index.ts b/src/modules/pricing/apis/price-tables/index.ts index d92496e..bb4b297 100644 --- a/src/modules/pricing/apis/price-tables/index.ts +++ b/src/modules/pricing/apis/price-tables/index.ts @@ -1 +1 @@ -export * from './PriceTables'; +export * from "./PriceTables"; diff --git a/src/modules/pricing/apis/prices-and-fixed-prices/PricesAndFixedPrices.ts b/src/modules/pricing/apis/prices-and-fixed-prices/PricesAndFixedPrices.ts index 19700af..dbcbe6b 100644 --- a/src/modules/pricing/apis/prices-and-fixed-prices/PricesAndFixedPrices.ts +++ b/src/modules/pricing/apis/prices-and-fixed-prices/PricesAndFixedPrices.ts @@ -1,10 +1,10 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; -import { GetPriceResponse, FixedPrice } from './responses/GetPriceResponse'; -import { GetComputedPriceByPriceTableResponse } from './responses/GetComputedPriceByPriceTableResponse'; +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { GetPriceResponse, FixedPrice } from "./responses/GetPriceResponse"; +import { GetComputedPriceByPriceTableResponse } from "./responses/GetComputedPriceByPriceTableResponse"; export class PricesAndFixedPrices extends AbstractApi { - private static readonly BASE_PATH: string = '/api/pricing/prices/'; + private static readonly BASE_PATH: string = "/api/pricing/prices/"; /** * Retrieves price data by SKU Id It is possible that on the property fixedPrices @@ -34,10 +34,16 @@ export class PricesAndFixedPrices extends AbstractApi { * @param {string} skuId * @param {GetPriceResponse} priceData */ - createOrEditPriceOrFixedPrice(skuId: string, priceData: GetPriceResponse) - : Promise { + createOrEditPriceOrFixedPrice( + skuId: string, + priceData: GetPriceResponse + ): Promise { const path = `${PricesAndFixedPrices.BASE_PATH}/${skuId}`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.PUT, priceData); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.PUT, + priceData + ); } /** @@ -57,10 +63,17 @@ export class PricesAndFixedPrices extends AbstractApi { * @param {string} priceTableId * @param {Array} fixedPrices */ - createOrEditFixedPricesOnPriceTable(skuId: string, priceTableId: string, - fixedPrices: Array): Promise { + createOrEditFixedPricesOnPriceTable( + skuId: string, + priceTableId: string, + fixedPrices: Array + ): Promise { const path = `${PricesAndFixedPrices.BASE_PATH}/${skuId}/fixed/${priceTableId}`; - return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.POST, fixedPrices); + return this.vtexHttpClient.performRequest( + path, + this.HTTP_METHODS.POST, + fixedPrices + ); } /** @@ -68,8 +81,10 @@ export class PricesAndFixedPrices extends AbstractApi { * @param {string} skuId * @param {string} priceTableId */ - getFixedPricesOnPriceTable(skuId: string, priceTableId: string) - : Promise>> { + getFixedPricesOnPriceTable( + skuId: string, + priceTableId: string + ): Promise>> { const path = `${PricesAndFixedPrices.BASE_PATH}/${skuId}/fixed/${priceTableId}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } @@ -79,7 +94,10 @@ export class PricesAndFixedPrices extends AbstractApi { * @param {string} skuId * @param {string} priceTableId */ - deleteFixedPricesOnPriceTable(skuId: string, priceTableId: string): Promise { + deleteFixedPricesOnPriceTable( + skuId: string, + priceTableId: string + ): Promise { const path = `${PricesAndFixedPrices.BASE_PATH}/${skuId}/fixed/${priceTableId}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.DELETE); } @@ -90,8 +108,11 @@ export class PricesAndFixedPrices extends AbstractApi { * @param {string} priceTableId * @param {string} params Example: categoryIds=1&brandId=1&quantity=2 */ - getComputedPriceByPriceTable(skuId: string, priceTableId: string, params: string) - : Promise> { + getComputedPriceByPriceTable( + skuId: string, + priceTableId: string, + params: string + ): Promise> { const path = `${PricesAndFixedPrices.BASE_PATH}/${skuId}/computed/${priceTableId}?${params}`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } diff --git a/src/modules/pricing/apis/prices-and-fixed-prices/index.ts b/src/modules/pricing/apis/prices-and-fixed-prices/index.ts index c11076f..967ec42 100644 --- a/src/modules/pricing/apis/prices-and-fixed-prices/index.ts +++ b/src/modules/pricing/apis/prices-and-fixed-prices/index.ts @@ -1 +1 @@ -export * from './PricesAndFixedPrices'; +export * from "./PricesAndFixedPrices"; diff --git a/src/modules/pricing/apis/prices-and-fixed-prices/responses/GetPriceResponse.ts b/src/modules/pricing/apis/prices-and-fixed-prices/responses/GetPriceResponse.ts index 497356f..ddba82f 100644 --- a/src/modules/pricing/apis/prices-and-fixed-prices/responses/GetPriceResponse.ts +++ b/src/modules/pricing/apis/prices-and-fixed-prices/responses/GetPriceResponse.ts @@ -8,7 +8,7 @@ export interface FixedPrice { value?: number; listPrice?: string; minQuantity?: number; - dateRange?: DateRange + dateRange?: DateRange; } export interface GetPriceResponse { diff --git a/src/modules/pricing/apis/pricing-config/PricingConfig.ts b/src/modules/pricing/apis/pricing-config/PricingConfig.ts index 991dfe8..1e62a9c 100644 --- a/src/modules/pricing/apis/pricing-config/PricingConfig.ts +++ b/src/modules/pricing/apis/pricing-config/PricingConfig.ts @@ -1,10 +1,10 @@ -import { AbstractApi } from '../../../AbstractApi'; -import { VtexHttpResponse } from '../../../../utils/VtexHttpResponse'; -import { GetPricingConfigResponse } from './responses/GetPricingConfigResponse'; -import { GetPricingV2ActiveStatusResponse } from './responses/GetPricingV2ActiveStatusResponse'; +import { AbstractApi } from "../../../AbstractApi"; +import { VtexHttpResponse } from "../../../../utils/VtexHttpResponse"; +import { GetPricingConfigResponse } from "./responses/GetPricingConfigResponse"; +import { GetPricingV2ActiveStatusResponse } from "./responses/GetPricingV2ActiveStatusResponse"; export class PricingConfig extends AbstractApi { - private static readonly BASE_PATH: string = '/api/pricing'; + private static readonly BASE_PATH: string = "/api/pricing"; /** * Retrieves Pricing Module Configuration @@ -17,7 +17,9 @@ export class PricingConfig extends AbstractApi { /** * Gets Pricing v2 Active Status */ - getPricingV2ActiveStatus(): Promise> { + getPricingV2ActiveStatus(): Promise< + VtexHttpResponse + > { const path = `${PricingConfig.BASE_PATH}/migration`; return this.vtexHttpClient.performRequest(path, this.HTTP_METHODS.GET); } diff --git a/src/modules/pricing/apis/pricing-config/index.ts b/src/modules/pricing/apis/pricing-config/index.ts index 5ba71b2..703ffb7 100644 --- a/src/modules/pricing/apis/pricing-config/index.ts +++ b/src/modules/pricing/apis/pricing-config/index.ts @@ -1 +1 @@ -export * from './PricingConfig'; +export * from "./PricingConfig"; diff --git a/src/modules/pricing/index.ts b/src/modules/pricing/index.ts index 344d831..3f9f3e2 100644 --- a/src/modules/pricing/index.ts +++ b/src/modules/pricing/index.ts @@ -1 +1 @@ -export * from './Pricing'; +export * from "./Pricing"; diff --git a/src/utils/VtexHttpClient.ts b/src/utils/VtexHttpClient.ts index 63d91d1..5f4db0d 100644 --- a/src/utils/VtexHttpClient.ts +++ b/src/utils/VtexHttpClient.ts @@ -1,7 +1,7 @@ -import * as https from 'https'; -import { ClientRequest, IncomingMessage } from 'http'; -import { VtexCredentials } from '../VtexCredentials'; -import { VtexHttpResponse } from './VtexHttpResponse'; +import * as https from "https"; +import { ClientRequest, IncomingMessage } from "http"; +import { VtexCredentials } from "../VtexCredentials"; +import { VtexHttpResponse } from "./VtexHttpResponse"; export class VtexHttpClient { private readonly defaultRequestOptions: https.RequestOptions; @@ -14,10 +14,10 @@ export class VtexHttpClient { hostname: `${vtexCredentials.store}.vtexcommerce${vtexCredentials.environment}.com.br`, port: 443, headers: { - 'Content-Type': 'application/json', - Accept: 'application/json', - 'X-VTEX-API-AppKey': vtexCredentials.appKey, - 'X-VTEX-API-AppToken': vtexCredentials.appToken, + "Content-Type": "application/json", + Accept: "application/json", + "X-VTEX-API-AppKey": vtexCredentials.appKey, + "X-VTEX-API-AppToken": vtexCredentials.appToken, }, }; } @@ -28,11 +28,18 @@ export class VtexHttpClient { * @param {any} body * @param {any} additionalHeaders */ - performRequest(path: string, method: string, body?: any, additionalHeaders?: any) - : Promise { + performRequest( + path: string, + method: string, + body?: any, + additionalHeaders?: any + ): Promise { const defaultRequestOptions = { ...this.defaultRequestOptions }; if (additionalHeaders) { - defaultRequestOptions.headers = { ...defaultRequestOptions.headers, ...additionalHeaders }; + defaultRequestOptions.headers = { + ...defaultRequestOptions.headers, + ...additionalHeaders, + }; } return new Promise((resolve, reject) => { const requestOptions: https.RequestOptions = { @@ -40,40 +47,44 @@ export class VtexHttpClient { path, method, }; - const request: ClientRequest = https.request(requestOptions, (response: IncomingMessage) => { - let responseBody: string = ''; + const request: ClientRequest = https.request( + requestOptions, + (response: IncomingMessage) => { + let responseBody: string = ""; - response.on('data', (chunk) => { - responseBody += chunk; - }); + response.on("data", (chunk) => { + responseBody += chunk; + }); - response.on('end', () => { - if (response.statusCode) { - let jsonResponse; - try { - jsonResponse = JSON.parse(responseBody); - } catch (error) { - jsonResponse = null; - } - const vtexHttpResponse: VtexHttpResponse = new VtexHttpResponse( - response.statusCode, jsonResponse, - ); - if (response.statusCode < 400) { - resolve(vtexHttpResponse); + response.on("end", () => { + if (response.statusCode) { + let jsonResponse; + try { + jsonResponse = JSON.parse(responseBody); + } catch (error) { + jsonResponse = null; + } + const vtexHttpResponse: VtexHttpResponse = new VtexHttpResponse( + response.statusCode, + jsonResponse + ); + if (response.statusCode < 400) { + resolve(vtexHttpResponse); + } else { + reject(vtexHttpResponse); + } } else { - reject(vtexHttpResponse); + reject(new Error("Request failed")); } - } else { - reject(new Error('Request failed')); - } - }); - }); + }); + } + ); - request.on('error', (error) => reject(error)); + request.on("error", (error) => reject(error)); if (body) { let bodyString: string; - if (typeof body === 'string') { + if (typeof body === "string") { bodyString = body; } else { bodyString = JSON.stringify(body); diff --git a/test/VTEX.test.ts b/test/VTEX.test.ts index d1d08aa..dc31343 100644 --- a/test/VTEX.test.ts +++ b/test/VTEX.test.ts @@ -1,65 +1,84 @@ -import { VTEX } from '../src/VTEX'; +import { VTEX } from "../src/VTEX"; -describe('VTEX tests', () => { - const store: string = 'store'; - const appKey: string = 'appKey'; - const appSecret: string = 'appSecret'; +describe("VTEX tests", () => { + const store: string = "store"; + const appKey: string = "appKey"; + const appSecret: string = "appSecret"; - test('Create instance, with all params, creates the instance', () => new Promise((done) => { - const instance = new VTEX(store, appKey, appSecret); + test("Create instance, with all params, creates the instance", () => + new Promise((done) => { + const instance = new VTEX(store, appKey, appSecret); - expect(instance).not.toBe(null); + expect(instance).not.toBe(null); - expect(instance.oms).not.toBe(null); - expect(instance.oms.orders).not.toBe(null); - expect(instance.oms.invoice).not.toBe(null); - expect(instance.oms.tracking).not.toBe(null); - expect(instance.oms.payment).not.toBe(null); - expect(instance.oms.feed).not.toBe(null); - expect(instance.oms.orderHook).not.toBe(null); - expect(instance.oms.exportOrderReport).not.toBe(null); - expect(instance.oms.userOrders).not.toBe(null); + expect(instance.oms).not.toBe(null); + expect(instance.oms.orders).not.toBe(null); + expect(instance.oms.invoice).not.toBe(null); + expect(instance.oms.tracking).not.toBe(null); + expect(instance.oms.payment).not.toBe(null); + expect(instance.oms.feed).not.toBe(null); + expect(instance.oms.orderHook).not.toBe(null); + expect(instance.oms.exportOrderReport).not.toBe(null); + expect(instance.oms.userOrders).not.toBe(null); - expect(instance.logistics).not.toBe(null); - expect(instance.logistics.shippingPolicies).not.toBe(null); - expect(instance.logistics.carriers).not.toBe(null); - expect(instance.logistics.docks).not.toBe(null); - expect(instance.logistics.warehouses).not.toBe(null); - expect(instance.logistics.inventory).not.toBe(null); - expect(instance.logistics.holidays).not.toBe(null); - expect(instance.logistics.reservations).not.toBe(null); - expect(instance.logistics.sla).not.toBe(null); - expect(instance.logistics.pickupPoints).not.toBe(null); - expect(instance.logistics.polygons).not.toBe(null); + expect(instance.logistics).not.toBe(null); + expect(instance.logistics.shippingPolicies).not.toBe(null); + expect(instance.logistics.carriers).not.toBe(null); + expect(instance.logistics.docks).not.toBe(null); + expect(instance.logistics.warehouses).not.toBe(null); + expect(instance.logistics.inventory).not.toBe(null); + expect(instance.logistics.holidays).not.toBe(null); + expect(instance.logistics.reservations).not.toBe(null); + expect(instance.logistics.sla).not.toBe(null); + expect(instance.logistics.pickupPoints).not.toBe(null); + expect(instance.logistics.polygons).not.toBe(null); - expect(instance.pricing).not.toBe(null); - expect(instance.pricing.priceTables).not.toBe(null); - expect(instance.pricing.pricesAndFixedPrices).not.toBe(null); - expect(instance.pricing.pricingConfig).not.toBe(null); + expect(instance.pricing).not.toBe(null); + expect(instance.pricing.priceTables).not.toBe(null); + expect(instance.pricing.pricesAndFixedPrices).not.toBe(null); + expect(instance.pricing.pricingConfig).not.toBe(null); - expect(instance.masterData).not.toBe(null); - expect(instance.masterData.documents).not.toBe(null); - expect(instance.masterData.search).not.toBe(null); - expect(instance.masterData.scroll).not.toBe(null); - expect(instance.masterData.schemas).not.toBe(null); - expect(instance.masterData.indices).not.toBe(null); - expect(instance.masterData.clusters).not.toBe(null); - expect(instance.masterData.versions).not.toBe(null); - done(); - })); + expect(instance.masterData).not.toBe(null); + expect(instance.masterData.documents).not.toBe(null); + expect(instance.masterData.search).not.toBe(null); + expect(instance.masterData.scroll).not.toBe(null); + expect(instance.masterData.schemas).not.toBe(null); + expect(instance.masterData.indices).not.toBe(null); + expect(instance.masterData.clusters).not.toBe(null); + expect(instance.masterData.versions).not.toBe(null); - test('Create instance, with empty store, throws Error', () => new Promise((done) => { - expect(() => new VTEX('', appKey, appSecret)).toThrowError(); - done(); - })); + expect(instance.catalog).not.toBe(null); + expect(instance.catalog.skuService).not.toBe(null); + expect(instance.catalog.categoryAndBrand).not.toBe(null); + expect(instance.catalog.attachment).not.toBe(null); + expect(instance.catalog.product).not.toBe(null); + expect(instance.catalog.tradePolicy).not.toBe(null); + expect(instance.catalog.sku).not.toBe(null); + expect(instance.catalog.specification).not.toBe(null); + expect(instance.catalog.collection).not.toBe(null); + expect(instance.catalog.subcollection).not.toBe(null); + expect(instance.catalog.supplier).not.toBe(null); + expect(instance.catalog.salesChannel).not.toBe(null); + expect(instance.catalog.seller).not.toBe(null); + expect(instance.catalog.others).not.toBe(null); + done(); + })); - test('Create instance, with empty appKey, throws Error', () => new Promise((done) => { - expect(() => new VTEX(store, '', appSecret)).toThrowError(); - done(); - })); + test("Create instance, with empty store, throws Error", () => + new Promise((done) => { + expect(() => new VTEX("", appKey, appSecret)).toThrowError(); + done(); + })); - test('Create instance, with empty appToken, throws Error', () => new Promise((done) => { - expect(() => new VTEX(store, appKey, '')).toThrowError(); - done(); - })); + test("Create instance, with empty appKey, throws Error", () => + new Promise((done) => { + expect(() => new VTEX(store, "", appSecret)).toThrowError(); + done(); + })); + + test("Create instance, with empty appToken, throws Error", () => + new Promise((done) => { + expect(() => new VTEX(store, appKey, "")).toThrowError(); + done(); + })); }); diff --git a/test/VtexHttpClient.test.ts b/test/VtexHttpClient.test.ts index d0f7d9a..d1cbd00 100644 --- a/test/VtexHttpClient.test.ts +++ b/test/VtexHttpClient.test.ts @@ -1,15 +1,20 @@ -import * as nock from 'nock'; -import { resolve } from 'path'; -import { readFileSync } from 'fs'; -import { VtexHttpClient } from '../src/utils/VtexHttpClient'; -import { VtexCredentials } from '../src/VtexCredentials'; +import * as nock from "nock"; +import { resolve } from "path"; +import { readFileSync } from "fs"; +import { VtexHttpClient } from "../src/utils/VtexHttpClient"; +import { VtexCredentials } from "../src/VtexCredentials"; -describe('VTEXHttpClient tests', () => { - const vtexCredentials: VtexCredentials = new VtexCredentials('test', 'appKey', 'appSecret', 'stable'); +describe("VTEXHttpClient tests", () => { + const vtexCredentials: VtexCredentials = new VtexCredentials( + "test", + "appKey", + "appSecret", + "stable" + ); const vtexHttpClient = new VtexHttpClient(vtexCredentials); - const BASE_URL: string = 'https://test.vtexcommercestable.com.br'; + const BASE_URL: string = "https://test.vtexcommercestable.com.br"; const DEFAULT_RESPONSE_HEADERS: any = { - 'Content-Type': 'application/json', + "Content-Type": "application/json", }; const getFilepath = (filepath: string) => resolve(__dirname, `./${filepath}`); @@ -19,71 +24,95 @@ describe('VTEXHttpClient tests', () => { done(); }); - test('performRequest, with get method, performs the request', () => new Promise((done) => { - const path: string = '/api/oms/pvt/orders'; - const method: string = 'GET'; - const scope: nock.Scope = nock(BASE_URL) - .get(path) - .matchHeader('X-VTEX-API-AppKey', vtexCredentials.appKey) - .matchHeader('X-VTEX-API-AppToken', vtexCredentials.appToken) - .replyWithFile(200, getFilepath('vtexResponses/listOrders.json'), DEFAULT_RESPONSE_HEADERS); + test("performRequest, with get method, performs the request", () => + new Promise((done) => { + const path: string = "/api/oms/pvt/orders"; + const method: string = "GET"; + const scope: nock.Scope = nock(BASE_URL) + .get(path) + .matchHeader("X-VTEX-API-AppKey", vtexCredentials.appKey) + .matchHeader("X-VTEX-API-AppToken", vtexCredentials.appToken) + .replyWithFile( + 200, + getFilepath("vtexResponses/listOrders.json"), + DEFAULT_RESPONSE_HEADERS + ); - vtexHttpClient.performRequest(path, method).then(() => { - expect(scope.isDone()).toBe(true); - done(); - }); - })); + vtexHttpClient.performRequest(path, method).then(() => { + expect(scope.isDone()).toBe(true); + done(); + }); + })); - test('performRequest, with post method with body, performs the request', () => new Promise((done) => { - const path: string = '/api/oms/pvt/orders/orderId/changes'; - const method: string = 'POST'; - const requestBody: any = JSON.parse(readFileSync(getFilepath('vtexRequests/registerChangeOnOrder.json'), 'utf-8')); - const scope: nock.Scope = nock(BASE_URL) - .post(path, requestBody) - .matchHeader('X-VTEX-API-AppKey', vtexCredentials.appKey) - .matchHeader('X-VTEX-API-AppToken', vtexCredentials.appToken) - .reply(200); + test("performRequest, with post method with body, performs the request", () => + new Promise((done) => { + const path: string = "/api/oms/pvt/orders/orderId/changes"; + const method: string = "POST"; + const requestBody: any = JSON.parse( + readFileSync( + getFilepath("vtexRequests/registerChangeOnOrder.json"), + "utf-8" + ) + ); + const scope: nock.Scope = nock(BASE_URL) + .post(path, requestBody) + .matchHeader("X-VTEX-API-AppKey", vtexCredentials.appKey) + .matchHeader("X-VTEX-API-AppToken", vtexCredentials.appToken) + .reply(200); - vtexHttpClient.performRequest(path, method, requestBody).then(() => { - expect(scope.isDone()).toBe(true); - done(); - }); - })); + vtexHttpClient.performRequest(path, method, requestBody).then(() => { + expect(scope.isDone()).toBe(true); + done(); + }); + })); - test('performRequest, with post method with body and additional headers, performs the request', - () => new Promise((done) => { - const path: string = '/api/oms/pvt/orders/orderId/changes'; - const method: string = 'POST'; - const requestBody: any = JSON.parse(readFileSync(getFilepath('vtexRequests/registerChangeOnOrder.json'), 'utf-8')); + test("performRequest, with post method with body and additional headers, performs the request", () => + new Promise((done) => { + const path: string = "/api/oms/pvt/orders/orderId/changes"; + const method: string = "POST"; + const requestBody: any = JSON.parse( + readFileSync( + getFilepath("vtexRequests/registerChangeOnOrder.json"), + "utf-8" + ) + ); const additionalHeaders = { - 'Rest-Range': '0-100', + "Rest-Range": "0-100", }; const scope: nock.Scope = nock(BASE_URL) .post(path, requestBody) - .matchHeader('X-VTEX-API-AppKey', vtexCredentials.appKey) - .matchHeader('X-VTEX-API-AppToken', vtexCredentials.appToken) - .matchHeader('Rest-Range', '0-100') + .matchHeader("X-VTEX-API-AppKey", vtexCredentials.appKey) + .matchHeader("X-VTEX-API-AppToken", vtexCredentials.appToken) + .matchHeader("Rest-Range", "0-100") .reply(200); - vtexHttpClient.performRequest(path, method, requestBody, additionalHeaders).then(() => { + vtexHttpClient + .performRequest(path, method, requestBody, additionalHeaders) + .then(() => { + expect(scope.isDone()).toBe(true); + done(); + }); + })); + + test("performRequest, with post method with body that returns 400, performs the request", () => + new Promise((done) => { + const path: string = "/api/oms/pvt/orders/orderId/changes"; + const method: string = "POST"; + const requestBody: any = JSON.parse( + readFileSync( + getFilepath("vtexRequests/registerChangeOnOrder.json"), + "utf-8" + ) + ); + const scope: nock.Scope = nock(BASE_URL) + .post(path, requestBody) + .matchHeader("X-VTEX-API-AppKey", vtexCredentials.appKey) + .matchHeader("X-VTEX-API-AppToken", vtexCredentials.appToken) + .reply(400); + + vtexHttpClient.performRequest(path, method, requestBody).catch(() => { expect(scope.isDone()).toBe(true); done(); }); })); - - test('performRequest, with post method with body that returns 400, performs the request', () => new Promise((done) => { - const path: string = '/api/oms/pvt/orders/orderId/changes'; - const method: string = 'POST'; - const requestBody: any = JSON.parse(readFileSync(getFilepath('vtexRequests/registerChangeOnOrder.json'), 'utf-8')); - const scope: nock.Scope = nock(BASE_URL) - .post(path, requestBody) - .matchHeader('X-VTEX-API-AppKey', vtexCredentials.appKey) - .matchHeader('X-VTEX-API-AppToken', vtexCredentials.appToken) - .reply(400); - - vtexHttpClient.performRequest(path, method, requestBody).catch(() => { - expect(scope.isDone()).toBe(true); - done(); - }); - })); }); diff --git a/yarn.lock b/yarn.lock index 4ff5e7a..7bbae0f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1002,103 +1002,103 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd" integrity sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw== -"@jest/console@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-26.0.1.tgz#62b3b2fa8990f3cbffbef695c42ae9ddbc8f4b39" - integrity sha512-9t1KUe/93coV1rBSxMmBAOIK3/HVpwxArCA1CxskKyRiv6o8J70V8C/V3OJminVCTa2M0hQI9AWRd5wxu2dAHw== +"@jest/console@^26.1.0": + version "26.1.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-26.1.0.tgz#f67c89e4f4d04dbcf7b052aed5ab9c74f915b954" + integrity sha512-+0lpTHMd/8pJp+Nd4lyip+/Iyf2dZJvcCqrlkeZQoQid+JlThA4M9vxHtheyrQ99jJTMQam+es4BcvZ5W5cC3A== dependencies: - "@jest/types" "^26.0.1" + "@jest/types" "^26.1.0" chalk "^4.0.0" - jest-message-util "^26.0.1" - jest-util "^26.0.1" + jest-message-util "^26.1.0" + jest-util "^26.1.0" slash "^3.0.0" -"@jest/core@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-26.0.1.tgz#aa538d52497dfab56735efb00e506be83d841fae" - integrity sha512-Xq3eqYnxsG9SjDC+WLeIgf7/8KU6rddBxH+SCt18gEpOhAGYC/Mq+YbtlNcIdwjnnT+wDseXSbU0e5X84Y4jTQ== +"@jest/core@^26.1.0": + version "26.1.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-26.1.0.tgz#4580555b522de412a7998b3938c851e4f9da1c18" + integrity sha512-zyizYmDJOOVke4OO/De//aiv8b07OwZzL2cfsvWF3q9YssfpcKfcnZAwDY8f+A76xXSMMYe8i/f/LPocLlByfw== dependencies: - "@jest/console" "^26.0.1" - "@jest/reporters" "^26.0.1" - "@jest/test-result" "^26.0.1" - "@jest/transform" "^26.0.1" - "@jest/types" "^26.0.1" + "@jest/console" "^26.1.0" + "@jest/reporters" "^26.1.0" + "@jest/test-result" "^26.1.0" + "@jest/transform" "^26.1.0" + "@jest/types" "^26.1.0" ansi-escapes "^4.2.1" chalk "^4.0.0" exit "^0.1.2" graceful-fs "^4.2.4" - jest-changed-files "^26.0.1" - jest-config "^26.0.1" - jest-haste-map "^26.0.1" - jest-message-util "^26.0.1" + jest-changed-files "^26.1.0" + jest-config "^26.1.0" + jest-haste-map "^26.1.0" + jest-message-util "^26.1.0" jest-regex-util "^26.0.0" - jest-resolve "^26.0.1" - jest-resolve-dependencies "^26.0.1" - jest-runner "^26.0.1" - jest-runtime "^26.0.1" - jest-snapshot "^26.0.1" - jest-util "^26.0.1" - jest-validate "^26.0.1" - jest-watcher "^26.0.1" + jest-resolve "^26.1.0" + jest-resolve-dependencies "^26.1.0" + jest-runner "^26.1.0" + jest-runtime "^26.1.0" + jest-snapshot "^26.1.0" + jest-util "^26.1.0" + jest-validate "^26.1.0" + jest-watcher "^26.1.0" micromatch "^4.0.2" p-each-series "^2.1.0" rimraf "^3.0.0" slash "^3.0.0" strip-ansi "^6.0.0" -"@jest/environment@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-26.0.1.tgz#82f519bba71959be9b483675ee89de8c8f72a5c8" - integrity sha512-xBDxPe8/nx251u0VJ2dFAFz2H23Y98qdIaNwnMK6dFQr05jc+Ne/2np73lOAx+5mSBO/yuQldRrQOf6hP1h92g== +"@jest/environment@^26.1.0": + version "26.1.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-26.1.0.tgz#378853bcdd1c2443b4555ab908cfbabb851e96da" + integrity sha512-86+DNcGongbX7ai/KE/S3/NcUVZfrwvFzOOWX/W+OOTvTds7j07LtC+MgGydH5c8Ri3uIrvdmVgd1xFD5zt/xA== dependencies: - "@jest/fake-timers" "^26.0.1" - "@jest/types" "^26.0.1" - jest-mock "^26.0.1" + "@jest/fake-timers" "^26.1.0" + "@jest/types" "^26.1.0" + jest-mock "^26.1.0" -"@jest/fake-timers@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-26.0.1.tgz#f7aeff13b9f387e9d0cac9a8de3bba538d19d796" - integrity sha512-Oj/kCBnTKhm7CR+OJSjZty6N1bRDr9pgiYQr4wY221azLz5PHi08x/U+9+QpceAYOWheauLP8MhtSVFrqXQfhg== +"@jest/fake-timers@^26.1.0": + version "26.1.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-26.1.0.tgz#9a76b7a94c351cdbc0ad53e5a748789f819a65fe" + integrity sha512-Y5F3kBVWxhau3TJ825iuWy++BAuQzK/xEa+wD9vDH3RytW9f2DbMVodfUQC54rZDX3POqdxCgcKdgcOL0rYUpA== dependencies: - "@jest/types" "^26.0.1" + "@jest/types" "^26.1.0" "@sinonjs/fake-timers" "^6.0.1" - jest-message-util "^26.0.1" - jest-mock "^26.0.1" - jest-util "^26.0.1" + jest-message-util "^26.1.0" + jest-mock "^26.1.0" + jest-util "^26.1.0" -"@jest/globals@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-26.0.1.tgz#3f67b508a7ce62b6e6efc536f3d18ec9deb19a9c" - integrity sha512-iuucxOYB7BRCvT+TYBzUqUNuxFX1hqaR6G6IcGgEqkJ5x4htNKo1r7jk1ji9Zj8ZMiMw0oB5NaA7k5Tx6MVssA== +"@jest/globals@^26.1.0": + version "26.1.0" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-26.1.0.tgz#6cc5d7cbb79b76b120f2403d7d755693cf063ab1" + integrity sha512-MKiHPNaT+ZoG85oMaYUmGHEqu98y3WO2yeIDJrs2sJqHhYOy3Z6F7F/luzFomRQ8SQ1wEkmahFAz2291Iv8EAw== dependencies: - "@jest/environment" "^26.0.1" - "@jest/types" "^26.0.1" - expect "^26.0.1" + "@jest/environment" "^26.1.0" + "@jest/types" "^26.1.0" + expect "^26.1.0" -"@jest/reporters@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-26.0.1.tgz#14ae00e7a93e498cec35b0c00ab21c375d9b078f" - integrity sha512-NWWy9KwRtE1iyG/m7huiFVF9YsYv/e+mbflKRV84WDoJfBqUrNRyDbL/vFxQcYLl8IRqI4P3MgPn386x76Gf2g== +"@jest/reporters@^26.1.0": + version "26.1.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-26.1.0.tgz#08952e90c90282e14ff49e927bdf1873617dae78" + integrity sha512-SVAysur9FOIojJbF4wLP0TybmqwDkdnFxHSPzHMMIYyBtldCW9gG+Q5xWjpMFyErDiwlRuPyMSJSU64A67Pazg== dependencies: "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^26.0.1" - "@jest/test-result" "^26.0.1" - "@jest/transform" "^26.0.1" - "@jest/types" "^26.0.1" + "@jest/console" "^26.1.0" + "@jest/test-result" "^26.1.0" + "@jest/transform" "^26.1.0" + "@jest/types" "^26.1.0" chalk "^4.0.0" collect-v8-coverage "^1.0.0" exit "^0.1.2" glob "^7.1.2" graceful-fs "^4.2.4" istanbul-lib-coverage "^3.0.0" - istanbul-lib-instrument "^4.0.0" + istanbul-lib-instrument "^4.0.3" istanbul-lib-report "^3.0.0" istanbul-lib-source-maps "^4.0.0" istanbul-reports "^3.0.2" - jest-haste-map "^26.0.1" - jest-resolve "^26.0.1" - jest-util "^26.0.1" - jest-worker "^26.0.0" + jest-haste-map "^26.1.0" + jest-resolve "^26.1.0" + jest-util "^26.1.0" + jest-worker "^26.1.0" slash "^3.0.0" source-map "^0.6.0" string-length "^4.0.1" @@ -1107,51 +1107,51 @@ optionalDependencies: node-notifier "^7.0.0" -"@jest/source-map@^26.0.0": - version "26.0.0" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-26.0.0.tgz#fd7706484a7d3faf7792ae29783933bbf48a4749" - integrity sha512-S2Z+Aj/7KOSU2TfW0dyzBze7xr95bkm5YXNUqqCek+HE0VbNNSNzrRwfIi5lf7wvzDTSS0/ib8XQ1krFNyYgbQ== +"@jest/source-map@^26.1.0": + version "26.1.0" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-26.1.0.tgz#a6a020d00e7d9478f4b690167c5e8b77e63adb26" + integrity sha512-XYRPYx4eEVX15cMT9mstnO7hkHP3krNtKfxUYd8L7gbtia8JvZZ6bMzSwa6IQJENbudTwKMw5R1BePRD+bkEmA== dependencies: callsites "^3.0.0" graceful-fs "^4.2.4" source-map "^0.6.0" -"@jest/test-result@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-26.0.1.tgz#1ffdc1ba4bc289919e54b9414b74c9c2f7b2b718" - integrity sha512-oKwHvOI73ICSYRPe8WwyYPTtiuOAkLSbY8/MfWF3qDEd/sa8EDyZzin3BaXTqufir/O/Gzea4E8Zl14XU4Mlyg== +"@jest/test-result@^26.1.0": + version "26.1.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-26.1.0.tgz#a93fa15b21ad3c7ceb21c2b4c35be2e407d8e971" + integrity sha512-Xz44mhXph93EYMA8aYDz+75mFbarTV/d/x0yMdI3tfSRs/vh4CqSxgzVmCps1fPkHDCtn0tU8IH9iCKgGeGpfw== dependencies: - "@jest/console" "^26.0.1" - "@jest/types" "^26.0.1" + "@jest/console" "^26.1.0" + "@jest/types" "^26.1.0" "@types/istanbul-lib-coverage" "^2.0.0" collect-v8-coverage "^1.0.0" -"@jest/test-sequencer@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-26.0.1.tgz#b0563424728f3fe9e75d1442b9ae4c11da73f090" - integrity sha512-ssga8XlwfP8YjbDcmVhwNlrmblddMfgUeAkWIXts1V22equp2GMIHxm7cyeD5Q/B0ZgKPK/tngt45sH99yLLGg== +"@jest/test-sequencer@^26.1.0": + version "26.1.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-26.1.0.tgz#41a6fc8b850c3f33f48288ea9ea517c047e7f14e" + integrity sha512-Z/hcK+rTq56E6sBwMoQhSRDVjqrGtj1y14e2bIgcowARaIE1SgOanwx6gvY4Q9gTKMoZQXbXvptji+q5GYxa6Q== dependencies: - "@jest/test-result" "^26.0.1" + "@jest/test-result" "^26.1.0" graceful-fs "^4.2.4" - jest-haste-map "^26.0.1" - jest-runner "^26.0.1" - jest-runtime "^26.0.1" + jest-haste-map "^26.1.0" + jest-runner "^26.1.0" + jest-runtime "^26.1.0" -"@jest/transform@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-26.0.1.tgz#0e3ecbb34a11cd4b2080ed0a9c4856cf0ceb0639" - integrity sha512-pPRkVkAQ91drKGbzCfDOoHN838+FSbYaEAvBXvKuWeeRRUD8FjwXkqfUNUZL6Ke48aA/1cqq/Ni7kVMCoqagWA== +"@jest/transform@^26.1.0": + version "26.1.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-26.1.0.tgz#697f48898c2a2787c9b4cb71d09d7e617464e509" + integrity sha512-ICPm6sUXmZJieq45ix28k0s+d/z2E8CHDsq+WwtWI6kW8m7I8kPqarSEcUN86entHQ570ZBRci5OWaKL0wlAWw== dependencies: "@babel/core" "^7.1.0" - "@jest/types" "^26.0.1" + "@jest/types" "^26.1.0" babel-plugin-istanbul "^6.0.0" chalk "^4.0.0" convert-source-map "^1.4.0" fast-json-stable-stringify "^2.0.0" graceful-fs "^4.2.4" - jest-haste-map "^26.0.1" + jest-haste-map "^26.1.0" jest-regex-util "^26.0.0" - jest-util "^26.0.1" + jest-util "^26.1.0" micromatch "^4.0.2" pirates "^4.0.1" slash "^3.0.0" @@ -1168,10 +1168,10 @@ "@types/yargs" "^15.0.0" chalk "^3.0.0" -"@jest/types@^26.0.1": - version "26.0.1" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.0.1.tgz#b78333fbd113fa7aec8d39de24f88de8686dac67" - integrity sha512-IbtjvqI9+eS1qFnOIEL7ggWmT+iK/U+Vde9cGWtYb/b6XgKb3X44ZAe/z9YZzoAAZ/E92m0DqrilF934IGNnQA== +"@jest/types@^26.1.0": + version "26.1.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-26.1.0.tgz#f8afaaaeeb23b5cad49dd1f7779689941dcb6057" + integrity sha512-GXigDDsp6ZlNMhXQDeuy/iYCDsRIHJabWtDzvnn36+aqFfG14JmFV0e/iXxY4SP9vbXSiPNOWdehU5MeqrYHBQ== dependencies: "@types/istanbul-lib-coverage" "^2.0.0" "@types/istanbul-reports" "^1.1.1" @@ -1192,6 +1192,17 @@ dependencies: "@sinonjs/commons" "^1.7.0" +"@types/babel__core@^7.0.0": + version "7.1.9" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.9.tgz#77e59d438522a6fb898fa43dc3455c6e72f3963d" + integrity sha512-sY2RsIJ5rpER1u3/aQ8OFSI7qGIy8o1NEEbgb2UaJcvOtXOMpd39ko723NBpjQFg9SIX7TXtjejZVGeIMLhoOw== + dependencies: + "@babel/parser" "^7.1.0" + "@babel/types" "^7.0.0" + "@types/babel__generator" "*" + "@types/babel__template" "*" + "@types/babel__traverse" "*" + "@types/babel__core@^7.1.7": version "7.1.8" resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.8.tgz#057f725aca3641f49fc11c7a87a9de5ec588a5d7" @@ -1262,10 +1273,10 @@ "@types/istanbul-lib-coverage" "*" "@types/istanbul-lib-report" "*" -"@types/jest@26.0.0": - version "26.0.0" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.0.tgz#a6d7573dffa9c68cbbdf38f2e0de26f159e11134" - integrity sha512-/yeMsH9HQ1RLORlXAwoLXe8S98xxvhNtUz3yrgrwbaxYjT+6SFPZZRksmRKRA6L5vsUtSHeN71viDOTTyYAD+g== +"@types/jest@26.0.3": + version "26.0.3" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.3.tgz#79534e0e94857171c0edc596db0ebe7cb7863251" + integrity sha512-v89ga1clpVL/Y1+YI0eIu1VMW+KU7Xl8PhylVtDKVWaSUHBHYPLXMQGBdrpHewaKoTvlXkksbYqPgz8b4cmRZg== dependencies: jest-diff "^25.2.1" pretty-format "^25.2.1" @@ -1280,11 +1291,16 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= -"@types/node@*", "@types/node@14.0.13": +"@types/node@*": version "14.0.13" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.13.tgz#ee1128e881b874c371374c1f72201893616417c9" integrity sha512-rouEWBImiRaSJsVA+ITTFM6ZxibuAlTuNOCyxVbwreu6k6+ujs7DfnU9o+PShFhET78pMBl3eH+AGSI5eOTkPA== +"@types/node@14.0.14": + version "14.0.14" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.14.tgz#24a0b5959f16ac141aeb0c5b3cd7a15b7c64cbce" + integrity sha512-syUgf67ZQpaJj01/tRTknkMNoBBLWJOBODF0Zm4NrXmiSuxjymFrxnTu1QVYRubhVkRcZLYZG8STTwJRdVm/WQ== + "@types/normalize-package-data@^2.4.0": version "2.4.0" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" @@ -1312,24 +1328,25 @@ dependencies: "@types/yargs-parser" "*" -"@typescript-eslint/eslint-plugin@3.3.0": - version "3.3.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.3.0.tgz#89518e5c5209a349bde161c3489b0ec187ae5d37" - integrity sha512-Ybx/wU75Tazz6nU2d7nN6ll0B98odoiYLXwcuwS5WSttGzK46t0n7TPRQ4ozwcTv82UY6TQoIvI+sJfTzqK9dQ== +"@typescript-eslint/eslint-plugin@3.4.0": + version "3.4.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.4.0.tgz#8378062e6be8a1d049259bdbcf27ce5dfbeee62b" + integrity sha512-wfkpiqaEVhZIuQRmudDszc01jC/YR7gMSxa6ulhggAe/Hs0KVIuo9wzvFiDbG3JD5pRFQoqnf4m7REDsUvBnMQ== dependencies: - "@typescript-eslint/experimental-utils" "3.3.0" + "@typescript-eslint/experimental-utils" "3.4.0" + debug "^4.1.1" functional-red-black-tree "^1.0.1" regexpp "^3.0.0" semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@3.3.0": - version "3.3.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.3.0.tgz#d72a946e056a83d4edf97f3411cceb639b0b8c87" - integrity sha512-d4pGIAbu/tYsrPrdHCQ5xfadJGvlkUxbeBB56nO/VGmEDi/sKmfa5fGty5t5veL1OyJBrUmSiRn1R1qfVDydrg== +"@typescript-eslint/experimental-utils@3.4.0": + version "3.4.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-3.4.0.tgz#8a44dfc6fb7f1d071937b390fe27608ebda122b8" + integrity sha512-rHPOjL43lOH1Opte4+dhC0a/+ks+8gOBwxXnyrZ/K4OTAChpSjP76fbI8Cglj7V5GouwVAGaK+xVwzqTyE/TPw== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/typescript-estree" "3.3.0" + "@typescript-eslint/typescript-estree" "3.4.0" eslint-scope "^5.0.0" eslint-utils "^2.0.0" @@ -1343,14 +1360,14 @@ eslint-scope "^5.0.0" eslint-utils "^2.0.0" -"@typescript-eslint/parser@3.3.0": - version "3.3.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-3.3.0.tgz#fcae40012ded822aa8b2739a1a03a4e3c5bbb7bb" - integrity sha512-a7S0Sqn/+RpOOWTcaLw6RD4obsharzxmgMfdK24l364VxuBODXjuJM7ImCkSXEN7oz52aiZbXSbc76+2EsE91w== +"@typescript-eslint/parser@3.4.0": + version "3.4.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-3.4.0.tgz#fe52b68c5cb3bba3f5d875bd17adb70420d49d8d" + integrity sha512-ZUGI/de44L5x87uX5zM14UYcbn79HSXUR+kzcqU42gH0AgpdB/TjuJy3m4ezI7Q/jk3wTQd755mxSDLhQP79KA== dependencies: "@types/eslint-visitor-keys" "^1.0.0" - "@typescript-eslint/experimental-utils" "3.3.0" - "@typescript-eslint/typescript-estree" "3.3.0" + "@typescript-eslint/experimental-utils" "3.4.0" + "@typescript-eslint/typescript-estree" "3.4.0" eslint-visitor-keys "^1.1.0" "@typescript-eslint/typescript-estree@2.34.0": @@ -1366,10 +1383,10 @@ semver "^7.3.2" tsutils "^3.17.1" -"@typescript-eslint/typescript-estree@3.3.0": - version "3.3.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.3.0.tgz#841ffed25c29b0049ebffb4c2071268a34558a2a" - integrity sha512-3SqxylENltEvJsjjMSDCUx/edZNSC7wAqifUU1Ywp//0OWEZwMZJfecJud9XxJ/40rAKEbJMKBOQzeOjrLJFzQ== +"@typescript-eslint/typescript-estree@3.4.0": + version "3.4.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-3.4.0.tgz#6a787eb70b48969e4cd1ea67b057083f96dfee29" + integrity sha512-zKwLiybtt4uJb4mkG5q2t6+W7BuYx2IISiDNV+IY68VfoGwErDx/RfVI7SWL4gnZ2t1A1ytQQwZ+YOJbHHJ2rw== dependencies: debug "^4.1.1" eslint-visitor-keys "^1.1.0" @@ -1556,16 +1573,16 @@ aws4@^1.8.0: resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.10.0.tgz#a17b3a8ea811060e74d47d306122400ad4497ae2" integrity sha512-3YDiu347mtVtjpyV3u5kVqQLP242c06zwDOgpeRnybmXlYYsLbtTrUBUm8i8srONt+FWobl5aibnU1030PeeuA== -babel-jest@26.0.1, babel-jest@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-26.0.1.tgz#450139ce4b6c17174b136425bda91885c397bc46" - integrity sha512-Z4GGmSNQ8pX3WS1O+6v3fo41YItJJZsVxG5gIQ+HuB/iuAQBJxMTHTwz292vuYws1LnHfwSRgoqI+nxdy/pcvw== +babel-jest@26.1.0, babel-jest@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-26.1.0.tgz#b20751185fc7569a0f135730584044d1cb934328" + integrity sha512-Nkqgtfe7j6PxLO6TnCQQlkMm8wdTdnIF8xrdpooHCuD5hXRzVEPbPneTJKknH5Dsv3L8ip9unHDAp48YQ54Dkg== dependencies: - "@jest/transform" "^26.0.1" - "@jest/types" "^26.0.1" + "@jest/transform" "^26.1.0" + "@jest/types" "^26.1.0" "@types/babel__core" "^7.1.7" babel-plugin-istanbul "^6.0.0" - babel-preset-jest "^26.0.0" + babel-preset-jest "^26.1.0" chalk "^4.0.0" graceful-fs "^4.2.4" slash "^3.0.0" @@ -1588,13 +1605,14 @@ babel-plugin-istanbul@^6.0.0: istanbul-lib-instrument "^4.0.0" test-exclude "^6.0.0" -babel-plugin-jest-hoist@^26.0.0: - version "26.0.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-26.0.0.tgz#fd1d35f95cf8849fc65cb01b5e58aedd710b34a8" - integrity sha512-+AuoehOrjt9irZL7DOt2+4ZaTM6dlu1s5TTS46JBa0/qem4dy7VNW3tMb96qeEqcIh20LD73TVNtmVEeymTG7w== +babel-plugin-jest-hoist@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-26.1.0.tgz#c6a774da08247a28285620a64dfadbd05dd5233a" + integrity sha512-qhqLVkkSlqmC83bdMhM8WW4Z9tB+JkjqAqlbbohS9sJLT5Ha2vfzuKqg5yenXrAjOPG2YC0WiXdH3a9PvB+YYw== dependencies: "@babel/template" "^7.3.3" "@babel/types" "^7.3.3" + "@types/babel__core" "^7.0.0" "@types/babel__traverse" "^7.0.6" babel-preset-current-node-syntax@^0.1.2: @@ -1613,12 +1631,12 @@ babel-preset-current-node-syntax@^0.1.2: "@babel/plugin-syntax-optional-catch-binding" "^7.8.3" "@babel/plugin-syntax-optional-chaining" "^7.8.3" -babel-preset-jest@^26.0.0: - version "26.0.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-26.0.0.tgz#1eac82f513ad36c4db2e9263d7c485c825b1faa6" - integrity sha512-9ce+DatAa31DpR4Uir8g4Ahxs5K4W4L8refzt+qHWQANb6LhGcAEfIFgLUwk67oya2cCUd6t4eUMtO/z64ocNw== +babel-preset-jest@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-26.1.0.tgz#612f714e5b457394acfd863793c564cbcdb7d1c1" + integrity sha512-na9qCqFksknlEj5iSdw1ehMVR06LCCTkZLGKeEtxDDdhg8xpUF09m29Kvh1pRbZ07h7AQ5ttLYUwpXL4tO6w7w== dependencies: - babel-plugin-jest-hoist "^26.0.0" + babel-plugin-jest-hoist "^26.1.0" babel-preset-current-node-syntax "^0.1.2" balanced-match@^1.0.0: @@ -2170,6 +2188,13 @@ eslint-config-airbnb-base@14.2.0: object.assign "^4.1.0" object.entries "^1.1.2" +eslint-config-prettier@6.11.0: + version "6.11.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz#f6d2238c1290d01c859a8b5c1f7d352a0b0da8b1" + integrity sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA== + dependencies: + get-stdin "^6.0.0" + eslint-import-resolver-node@^0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.3.tgz#dbaa52b6b2816b50bc6711af75422de808e98404" @@ -2205,13 +2230,20 @@ eslint-plugin-import@2.21.2: resolve "^1.17.0" tsconfig-paths "^3.9.0" -eslint-plugin-jest@23.16.0: - version "23.16.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-23.16.0.tgz#fada00f765b5e32a1fb10a7490f75ebf673133b3" - integrity sha512-51KcQup31S2NBm+Yqg3rxZIPETd+wZ/gU2rb034RpdXLcZYsa2+uwubqbbDAYIpQw3m+wywF/A56OMEouBY/wA== +eslint-plugin-jest@23.17.1: + version "23.17.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-23.17.1.tgz#c0f39ba78e0f33b7ee1ce4ec92b773e39026ea3f" + integrity sha512-/o36fw67qNbJGWbSBIBMfseMsNP/d88WUHAGHCi1xFwsNB3XXZGdvxbOw49j3iQz6MCW/yw8OeOsuQhi6mM5ZA== dependencies: "@typescript-eslint/experimental-utils" "^2.5.0" +eslint-plugin-prettier@3.1.4: + version "3.1.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.4.tgz#168ab43154e2ea57db992a2cd097c828171f75c2" + integrity sha512-jZDa8z76klRqo+TdGDTFJSavwbnWK2ZpqGKNZ+VvweMW516pDUMmQ2koXvxEE4JhzNvTv+radye/bWGBmA6jmg== + dependencies: + prettier-linter-helpers "^1.0.0" + eslint-scope@^5.0.0, eslint-scope@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.0.tgz#d0f971dfe59c69e0cada684b23d49dbf82600ce5" @@ -2232,10 +2264,10 @@ eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.2.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.2.0.tgz#74415ac884874495f78ec2a97349525344c981fa" integrity sha512-WFb4ihckKil6hu3Dp798xdzSfddwKKU3+nGniKF6HfeW6OLd2OUDEPP7TcHtB5+QXOKg2s6B2DaMPE1Nn/kxKQ== -eslint@7.3.0: - version "7.3.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.3.0.tgz#f9f1fc3dc1227985d0db88769f2bbac7b4b875d7" - integrity sha512-dJMVXwfU5PT1cj2Nv2VPPrKahKTGdX+5Dh0Q3YuKt+Y2UhdL2YbzsVaBMyG9HC0tBismlv/r1+eZqs6SMIV38Q== +eslint@7.3.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.3.1.tgz#76392bd7e44468d046149ba128d1566c59acbe19" + integrity sha512-cQC/xj9bhWUcyi/RuMbRtC3I0eW8MH0jhRELSvpKYkWep3C6YZ2OkvcvJVUeO6gcunABmzptbXBuDoXsjHmfTA== dependencies: "@babel/code-frame" "^7.0.0" ajv "^6.10.0" @@ -2368,16 +2400,16 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" -expect@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/expect/-/expect-26.0.1.tgz#18697b9611a7e2725e20ba3ceadda49bc9865421" - integrity sha512-QcCy4nygHeqmbw564YxNbHTJlXh47dVID2BUP52cZFpLU9zHViMFK6h07cC1wf7GYCTIigTdAXhVua8Yl1FkKg== +expect@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-26.1.0.tgz#8c62e31d0f8d5a8ebb186ee81473d15dd2fbf7c8" + integrity sha512-QbH4LZXDsno9AACrN9eM0zfnby9G+OsdNgZUohjg/P0mLy1O+/bzTAJGT6VSIjVCe8yKM6SzEl/ckEOFBT7Vnw== dependencies: - "@jest/types" "^26.0.1" + "@jest/types" "^26.1.0" ansi-styles "^4.0.0" jest-get-type "^26.0.0" - jest-matcher-utils "^26.0.1" - jest-message-util "^26.0.1" + jest-matcher-utils "^26.1.0" + jest-message-util "^26.1.0" jest-regex-util "^26.0.0" extend-shallow@^2.0.1: @@ -2429,6 +2461,11 @@ fast-deep-equal@^3.1.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-diff@^1.1.2: + version "1.2.0" + resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" + integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w== + fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" @@ -2560,6 +2597,11 @@ get-package-type@^0.1.0: resolved "https://registry.yarnpkg.com/get-package-type/-/get-package-type-0.1.0.tgz#8de2d803cff44df3bc6c456e6668b36c3926e11a" integrity sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q== +get-stdin@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" + integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== + get-stream@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" @@ -3001,7 +3043,7 @@ istanbul-lib-coverage@^3.0.0: resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz#f5944a37c70b550b02a78a5c3b2055b280cec8ec" integrity sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg== -istanbul-lib-instrument@^4.0.0: +istanbul-lib-instrument@^4.0.0, istanbul-lib-instrument@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz#873c6fff897450118222774696a3f28902d77c1d" integrity sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ== @@ -3037,57 +3079,57 @@ istanbul-reports@^3.0.2: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" -jest-changed-files@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-26.0.1.tgz#1334630c6a1ad75784120f39c3aa9278e59f349f" - integrity sha512-q8LP9Sint17HaE2LjxQXL+oYWW/WeeXMPE2+Op9X3mY8IEGFVc14xRxFjUuXUbcPAlDLhtWdIEt59GdQbn76Hw== +jest-changed-files@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-26.1.0.tgz#de66b0f30453bca2aff98e9400f75905da495305" + integrity sha512-HS5MIJp3B8t0NRKGMCZkcDUZo36mVRvrDETl81aqljT1S9tqiHRSpyoOvWg9ZilzZG9TDisDNaN1IXm54fLRZw== dependencies: - "@jest/types" "^26.0.1" + "@jest/types" "^26.1.0" execa "^4.0.0" throat "^5.0.0" -jest-cli@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-26.0.1.tgz#3a42399a4cbc96a519b99ad069a117d955570cac" - integrity sha512-pFLfSOBcbG9iOZWaMK4Een+tTxi/Wcm34geqZEqrst9cZDkTQ1LZ2CnBrTlHWuYAiTMFr0EQeK52ScyFU8wK+w== +jest-cli@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-26.1.0.tgz#eb9ec8a18cf3b6aa556d9deaa9e24be12b43ad87" + integrity sha512-Imumvjgi3rU7stq6SJ1JUEMaV5aAgJYXIs0jPqdUnF47N/Tk83EXfmtvNKQ+SnFVI6t6mDOvfM3aA9Sg6kQPSw== dependencies: - "@jest/core" "^26.0.1" - "@jest/test-result" "^26.0.1" - "@jest/types" "^26.0.1" + "@jest/core" "^26.1.0" + "@jest/test-result" "^26.1.0" + "@jest/types" "^26.1.0" chalk "^4.0.0" exit "^0.1.2" graceful-fs "^4.2.4" import-local "^3.0.2" is-ci "^2.0.0" - jest-config "^26.0.1" - jest-util "^26.0.1" - jest-validate "^26.0.1" + jest-config "^26.1.0" + jest-util "^26.1.0" + jest-validate "^26.1.0" prompts "^2.0.1" yargs "^15.3.1" -jest-config@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-26.0.1.tgz#096a3d4150afadf719d1fab00e9a6fb2d6d67507" - integrity sha512-9mWKx2L1LFgOXlDsC4YSeavnblN6A4CPfXFiobq+YYLaBMymA/SczN7xYTSmLaEYHZOcB98UdoN4m5uNt6tztg== +jest-config@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-26.1.0.tgz#9074f7539acc185e0113ad6d22ed589c16a37a73" + integrity sha512-ONTGeoMbAwGCdq4WuKkMcdMoyfs5CLzHEkzFOlVvcDXufZSaIWh/OXMLa2fwKXiOaFcqEw8qFr4VOKJQfn4CVw== dependencies: "@babel/core" "^7.1.0" - "@jest/test-sequencer" "^26.0.1" - "@jest/types" "^26.0.1" - babel-jest "^26.0.1" + "@jest/test-sequencer" "^26.1.0" + "@jest/types" "^26.1.0" + babel-jest "^26.1.0" chalk "^4.0.0" deepmerge "^4.2.2" glob "^7.1.1" graceful-fs "^4.2.4" - jest-environment-jsdom "^26.0.1" - jest-environment-node "^26.0.1" + jest-environment-jsdom "^26.1.0" + jest-environment-node "^26.1.0" jest-get-type "^26.0.0" - jest-jasmine2 "^26.0.1" + jest-jasmine2 "^26.1.0" jest-regex-util "^26.0.0" - jest-resolve "^26.0.1" - jest-util "^26.0.1" - jest-validate "^26.0.1" + jest-resolve "^26.1.0" + jest-util "^26.1.0" + jest-validate "^26.1.0" micromatch "^4.0.2" - pretty-format "^26.0.1" + pretty-format "^26.1.0" jest-diff@^25.2.1: version "25.5.0" @@ -3099,15 +3141,15 @@ jest-diff@^25.2.1: jest-get-type "^25.2.6" pretty-format "^25.5.0" -jest-diff@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.0.1.tgz#c44ab3cdd5977d466de69c46929e0e57f89aa1de" - integrity sha512-odTcHyl5X+U+QsczJmOjWw5tPvww+y9Yim5xzqxVl/R1j4z71+fHW4g8qu1ugMmKdFdxw+AtQgs5mupPnzcIBQ== +jest-diff@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-26.1.0.tgz#00a549bdc936c9691eb4dc25d1fbd78bf456abb2" + integrity sha512-GZpIcom339y0OXznsEKjtkfKxNdg7bVbEofK8Q6MnevTIiR1jNhDWKhRX6X0SDXJlwn3dy59nZ1z55fLkAqPWg== dependencies: chalk "^4.0.0" diff-sequences "^26.0.0" jest-get-type "^26.0.0" - pretty-format "^26.0.1" + pretty-format "^26.1.0" jest-docblock@^26.0.0: version "26.0.0" @@ -3116,39 +3158,39 @@ jest-docblock@^26.0.0: dependencies: detect-newline "^3.0.0" -jest-each@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-26.0.1.tgz#633083061619302fc90dd8f58350f9d77d67be04" - integrity sha512-OTgJlwXCAR8NIWaXFL5DBbeS4QIYPuNASkzSwMCJO+ywo9BEa6TqkaSWsfR7VdbMLdgYJqSfQcIyjJCNwl5n4Q== +jest-each@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-26.1.0.tgz#e35449875009a22d74d1bda183b306db20f286f7" + integrity sha512-lYiSo4Igr81q6QRsVQq9LIkJW0hZcKxkIkHzNeTMPENYYDw/W/Raq28iJ0sLlNFYz2qxxeLnc5K2gQoFYlu2bA== dependencies: - "@jest/types" "^26.0.1" + "@jest/types" "^26.1.0" chalk "^4.0.0" jest-get-type "^26.0.0" - jest-util "^26.0.1" - pretty-format "^26.0.1" - -jest-environment-jsdom@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-26.0.1.tgz#217690852e5bdd7c846a4e3b50c8ffd441dfd249" - integrity sha512-u88NJa3aptz2Xix2pFhihRBAatwZHWwSiRLBDBQE1cdJvDjPvv7ZGA0NQBxWwDDn7D0g1uHqxM8aGgfA9Bx49g== - dependencies: - "@jest/environment" "^26.0.1" - "@jest/fake-timers" "^26.0.1" - "@jest/types" "^26.0.1" - jest-mock "^26.0.1" - jest-util "^26.0.1" + jest-util "^26.1.0" + pretty-format "^26.1.0" + +jest-environment-jsdom@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-26.1.0.tgz#9dc7313ffe1b59761dad1fedb76e2503e5d37c5b" + integrity sha512-dWfiJ+spunVAwzXbdVqPH1LbuJW/kDL+FyqgA5YzquisHqTi0g9hquKif9xKm7c1bKBj6wbmJuDkeMCnxZEpUw== + dependencies: + "@jest/environment" "^26.1.0" + "@jest/fake-timers" "^26.1.0" + "@jest/types" "^26.1.0" + jest-mock "^26.1.0" + jest-util "^26.1.0" jsdom "^16.2.2" -jest-environment-node@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-26.0.1.tgz#584a9ff623124ff6eeb49e0131b5f7612b310b13" - integrity sha512-4FRBWcSn5yVo0KtNav7+5NH5Z/tEgDLp7VRQVS5tCouWORxj+nI+1tOLutM07Zb2Qi7ja+HEDoOUkjBSWZg/IQ== +jest-environment-node@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-26.1.0.tgz#8bb387b3eefb132eab7826f9a808e4e05618960b" + integrity sha512-DNm5x1aQH0iRAe9UYAkZenuzuJ69VKzDCAYISFHQ5i9e+2Tbeu2ONGY7YStubCLH8a1wdKBgqScYw85+ySxqxg== dependencies: - "@jest/environment" "^26.0.1" - "@jest/fake-timers" "^26.0.1" - "@jest/types" "^26.0.1" - jest-mock "^26.0.1" - jest-util "^26.0.1" + "@jest/environment" "^26.1.0" + "@jest/fake-timers" "^26.1.0" + "@jest/types" "^26.1.0" + jest-mock "^26.1.0" + jest-util "^26.1.0" jest-get-type@^25.2.6: version "25.2.6" @@ -3160,19 +3202,19 @@ jest-get-type@^26.0.0: resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-26.0.0.tgz#381e986a718998dbfafcd5ec05934be538db4039" integrity sha512-zRc1OAPnnws1EVfykXOj19zo2EMw5Hi6HLbFCSjpuJiXtOWAYIjNsHVSbpQ8bDX7L5BGYGI8m+HmKdjHYFF0kg== -jest-haste-map@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-26.0.1.tgz#40dcc03c43ac94d25b8618075804d09cd5d49de7" - integrity sha512-J9kBl/EdjmDsvyv7CiyKY5+DsTvVOScenprz/fGqfLg/pm1gdjbwwQ98nW0t+OIt+f+5nAVaElvn/6wP5KO7KA== +jest-haste-map@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-26.1.0.tgz#ef31209be73f09b0d9445e7d213e1b53d0d1476a" + integrity sha512-WeBS54xCIz9twzkEdm6+vJBXgRBQfdbbXD0dk8lJh7gLihopABlJmIQFdWSDDtuDe4PRiObsjZSUjbJ1uhWEpA== dependencies: - "@jest/types" "^26.0.1" + "@jest/types" "^26.1.0" "@types/graceful-fs" "^4.1.2" anymatch "^3.0.3" fb-watchman "^2.0.0" graceful-fs "^4.2.4" - jest-serializer "^26.0.0" - jest-util "^26.0.1" - jest-worker "^26.0.0" + jest-serializer "^26.1.0" + jest-util "^26.1.0" + jest-worker "^26.1.0" micromatch "^4.0.2" sane "^4.0.3" walker "^1.0.7" @@ -3180,54 +3222,54 @@ jest-haste-map@^26.0.1: optionalDependencies: fsevents "^2.1.2" -jest-jasmine2@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-26.0.1.tgz#947c40ee816636ba23112af3206d6fa7b23c1c1c" - integrity sha512-ILaRyiWxiXOJ+RWTKupzQWwnPaeXPIoLS5uW41h18varJzd9/7I0QJGqg69fhTT1ev9JpSSo9QtalriUN0oqOg== +jest-jasmine2@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-26.1.0.tgz#4dfe349b2b2d3c6b3a27c024fd4cb57ac0ed4b6f" + integrity sha512-1IPtoDKOAG+MeBrKvvuxxGPJb35MTTRSDglNdWWCndCB3TIVzbLThRBkwH9P081vXLgiJHZY8Bz3yzFS803xqQ== dependencies: "@babel/traverse" "^7.1.0" - "@jest/environment" "^26.0.1" - "@jest/source-map" "^26.0.0" - "@jest/test-result" "^26.0.1" - "@jest/types" "^26.0.1" + "@jest/environment" "^26.1.0" + "@jest/source-map" "^26.1.0" + "@jest/test-result" "^26.1.0" + "@jest/types" "^26.1.0" chalk "^4.0.0" co "^4.6.0" - expect "^26.0.1" + expect "^26.1.0" is-generator-fn "^2.0.0" - jest-each "^26.0.1" - jest-matcher-utils "^26.0.1" - jest-message-util "^26.0.1" - jest-runtime "^26.0.1" - jest-snapshot "^26.0.1" - jest-util "^26.0.1" - pretty-format "^26.0.1" + jest-each "^26.1.0" + jest-matcher-utils "^26.1.0" + jest-message-util "^26.1.0" + jest-runtime "^26.1.0" + jest-snapshot "^26.1.0" + jest-util "^26.1.0" + pretty-format "^26.1.0" throat "^5.0.0" -jest-leak-detector@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-26.0.1.tgz#79b19ab3f41170e0a78eb8fa754a116d3447fb8c" - integrity sha512-93FR8tJhaYIWrWsbmVN1pQ9ZNlbgRpfvrnw5LmgLRX0ckOJ8ut/I35CL7awi2ecq6Ca4lL59bEK9hr7nqoHWPA== +jest-leak-detector@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-26.1.0.tgz#039c3a07ebcd8adfa984b6ac015752c35792e0a6" + integrity sha512-dsMnKF+4BVOZwvQDlgn3MG+Ns4JuLv8jNvXH56bgqrrboyCbI1rQg6EI5rs+8IYagVcfVP2yZFKfWNZy0rK0Hw== dependencies: jest-get-type "^26.0.0" - pretty-format "^26.0.1" + pretty-format "^26.1.0" -jest-matcher-utils@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-26.0.1.tgz#12e1fc386fe4f14678f4cc8dbd5ba75a58092911" - integrity sha512-PUMlsLth0Azen8Q2WFTwnSkGh2JZ8FYuwijC8NR47vXKpsrKmA1wWvgcj1CquuVfcYiDEdj985u5Wmg7COEARw== +jest-matcher-utils@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-26.1.0.tgz#cf75a41bd413dda784f022de5a65a2a5c73a5c92" + integrity sha512-PW9JtItbYvES/xLn5mYxjMd+Rk+/kIt88EfH3N7w9KeOrHWaHrdYPnVHndGbsFGRJ2d5gKtwggCvkqbFDoouQA== dependencies: chalk "^4.0.0" - jest-diff "^26.0.1" + jest-diff "^26.1.0" jest-get-type "^26.0.0" - pretty-format "^26.0.1" + pretty-format "^26.1.0" -jest-message-util@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-26.0.1.tgz#07af1b42fc450b4cc8e90e4c9cef11b33ce9b0ac" - integrity sha512-CbK8uQREZ8umUfo8+zgIfEt+W7HAHjQCoRaNs4WxKGhAYBGwEyvxuK81FXa7VeB9pwDEXeeKOB2qcsNVCAvB7Q== +jest-message-util@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-26.1.0.tgz#52573fbb8f5cea443c4d1747804d7a238a3e233c" + integrity sha512-dY0+UlldiAJwNDJ08SF0HdF32g9PkbF2NRK/+2iMPU40O6q+iSn1lgog/u0UH8ksWoPv0+gNq8cjhYO2MFtT0g== dependencies: "@babel/code-frame" "^7.0.0" - "@jest/types" "^26.0.1" + "@jest/types" "^26.1.0" "@types/stack-utils" "^1.0.1" chalk "^4.0.0" graceful-fs "^4.2.4" @@ -3235,12 +3277,12 @@ jest-message-util@^26.0.1: slash "^3.0.0" stack-utils "^2.0.2" -jest-mock@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-26.0.1.tgz#7fd1517ed4955397cf1620a771dc2d61fad8fd40" - integrity sha512-MpYTBqycuPYSY6xKJognV7Ja46/TeRbAZept987Zp+tuJvMN0YBWyyhG9mXyYQaU3SBI0TUlSaO5L3p49agw7Q== +jest-mock@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-26.1.0.tgz#80d8286da1f05a345fbad1bfd6fa49a899465d3d" + integrity sha512-1Rm8EIJ3ZFA8yCIie92UbxZWj9SuVmUGcyhLHyAhY6WI3NIct38nVcfOPWhJteqSn8V8e3xOMha9Ojfazfpovw== dependencies: - "@jest/types" "^26.0.1" + "@jest/types" "^26.1.0" jest-pnp-resolver@^1.2.1: version "1.2.1" @@ -3252,165 +3294,165 @@ jest-regex-util@^26.0.0: resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-26.0.0.tgz#d25e7184b36e39fd466c3bc41be0971e821fee28" integrity sha512-Gv3ZIs/nA48/Zvjrl34bf+oD76JHiGDUxNOVgUjh3j890sblXryjY4rss71fPtD/njchl6PSE2hIhvyWa1eT0A== -jest-resolve-dependencies@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-26.0.1.tgz#607ba7ccc32151d185a477cff45bf33bce417f0b" - integrity sha512-9d5/RS/ft0vB/qy7jct/qAhzJsr6fRQJyGAFigK3XD4hf9kIbEH5gks4t4Z7kyMRhowU6HWm/o8ILqhaHdSqLw== +jest-resolve-dependencies@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-26.1.0.tgz#1ce36472f864a5dadf7dc82fa158e1c77955691b" + integrity sha512-fQVEPHHQ1JjHRDxzlLU/buuQ9om+hqW6Vo928aa4b4yvq4ZHBtRSDsLdKQLuCqn5CkTVpYZ7ARh2fbA8WkRE6g== dependencies: - "@jest/types" "^26.0.1" + "@jest/types" "^26.1.0" jest-regex-util "^26.0.0" - jest-snapshot "^26.0.1" + jest-snapshot "^26.1.0" -jest-resolve@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-26.0.1.tgz#21d1ee06f9ea270a343a8893051aeed940cde736" - integrity sha512-6jWxk0IKZkPIVTvq6s72RH735P8f9eCJW3IM5CX/SJFeKq1p2cZx0U49wf/SdMlhaB/anann5J2nCJj6HrbezQ== +jest-resolve@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-26.1.0.tgz#a530eaa302b1f6fa0479079d1561dd69abc00e68" + integrity sha512-KsY1JV9FeVgEmwIISbZZN83RNGJ1CC+XUCikf/ZWJBX/tO4a4NvA21YixokhdR9UnmPKKAC4LafVixJBrwlmfg== dependencies: - "@jest/types" "^26.0.1" + "@jest/types" "^26.1.0" chalk "^4.0.0" graceful-fs "^4.2.4" jest-pnp-resolver "^1.2.1" - jest-util "^26.0.1" + jest-util "^26.1.0" read-pkg-up "^7.0.1" resolve "^1.17.0" slash "^3.0.0" -jest-runner@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-26.0.1.tgz#ea03584b7ae4bacfb7e533d680a575a49ae35d50" - integrity sha512-CApm0g81b49Znm4cZekYQK67zY7kkB4umOlI2Dx5CwKAzdgw75EN+ozBHRvxBzwo1ZLYZ07TFxkaPm+1t4d8jA== +jest-runner@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-26.1.0.tgz#457f7fc522afe46ca6db1dccf19f87f500b3288d" + integrity sha512-elvP7y0fVDREnfqit0zAxiXkDRSw6dgCkzPCf1XvIMnSDZ8yogmSKJf192dpOgnUVykmQXwYYJnCx641uLTgcw== dependencies: - "@jest/console" "^26.0.1" - "@jest/environment" "^26.0.1" - "@jest/test-result" "^26.0.1" - "@jest/types" "^26.0.1" + "@jest/console" "^26.1.0" + "@jest/environment" "^26.1.0" + "@jest/test-result" "^26.1.0" + "@jest/types" "^26.1.0" chalk "^4.0.0" exit "^0.1.2" graceful-fs "^4.2.4" - jest-config "^26.0.1" + jest-config "^26.1.0" jest-docblock "^26.0.0" - jest-haste-map "^26.0.1" - jest-jasmine2 "^26.0.1" - jest-leak-detector "^26.0.1" - jest-message-util "^26.0.1" - jest-resolve "^26.0.1" - jest-runtime "^26.0.1" - jest-util "^26.0.1" - jest-worker "^26.0.0" + jest-haste-map "^26.1.0" + jest-jasmine2 "^26.1.0" + jest-leak-detector "^26.1.0" + jest-message-util "^26.1.0" + jest-resolve "^26.1.0" + jest-runtime "^26.1.0" + jest-util "^26.1.0" + jest-worker "^26.1.0" source-map-support "^0.5.6" throat "^5.0.0" -jest-runtime@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-26.0.1.tgz#a121a6321235987d294168e282d52b364d7d3f89" - integrity sha512-Ci2QhYFmANg5qaXWf78T2Pfo6GtmIBn2rRaLnklRyEucmPccmCKvS9JPljcmtVamsdMmkyNkVFb9pBTD6si9Lw== - dependencies: - "@jest/console" "^26.0.1" - "@jest/environment" "^26.0.1" - "@jest/fake-timers" "^26.0.1" - "@jest/globals" "^26.0.1" - "@jest/source-map" "^26.0.0" - "@jest/test-result" "^26.0.1" - "@jest/transform" "^26.0.1" - "@jest/types" "^26.0.1" +jest-runtime@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-26.1.0.tgz#45a37af42115f123ed5c51f126c05502da2469cb" + integrity sha512-1qiYN+EZLmG1QV2wdEBRf+Ci8i3VSfIYLF02U18PiUDrMbhfpN/EAMMkJtT02jgJUoaEOpHAIXG6zS3QRMzRmA== + dependencies: + "@jest/console" "^26.1.0" + "@jest/environment" "^26.1.0" + "@jest/fake-timers" "^26.1.0" + "@jest/globals" "^26.1.0" + "@jest/source-map" "^26.1.0" + "@jest/test-result" "^26.1.0" + "@jest/transform" "^26.1.0" + "@jest/types" "^26.1.0" "@types/yargs" "^15.0.0" chalk "^4.0.0" collect-v8-coverage "^1.0.0" exit "^0.1.2" glob "^7.1.3" graceful-fs "^4.2.4" - jest-config "^26.0.1" - jest-haste-map "^26.0.1" - jest-message-util "^26.0.1" - jest-mock "^26.0.1" + jest-config "^26.1.0" + jest-haste-map "^26.1.0" + jest-message-util "^26.1.0" + jest-mock "^26.1.0" jest-regex-util "^26.0.0" - jest-resolve "^26.0.1" - jest-snapshot "^26.0.1" - jest-util "^26.0.1" - jest-validate "^26.0.1" + jest-resolve "^26.1.0" + jest-snapshot "^26.1.0" + jest-util "^26.1.0" + jest-validate "^26.1.0" slash "^3.0.0" strip-bom "^4.0.0" yargs "^15.3.1" -jest-serializer@^26.0.0: - version "26.0.0" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-26.0.0.tgz#f6c521ddb976943b93e662c0d4d79245abec72a3" - integrity sha512-sQGXLdEGWFAE4wIJ2ZaIDb+ikETlUirEOBsLXdoBbeLhTHkZUJwgk3+M8eyFizhM6le43PDCCKPA1hzkSDo4cQ== +jest-serializer@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-26.1.0.tgz#72a394531fc9b08e173dc7d297440ac610d95022" + integrity sha512-eqZOQG/0+MHmr25b2Z86g7+Kzd5dG9dhCiUoyUNJPgiqi38DqbDEOlHcNijyfZoj74soGBohKBZuJFS18YTJ5w== dependencies: graceful-fs "^4.2.4" -jest-snapshot@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-26.0.1.tgz#1baa942bd83d47b837a84af7fcf5fd4a236da399" - integrity sha512-jxd+cF7+LL+a80qh6TAnTLUZHyQoWwEHSUFJjkw35u3Gx+BZUNuXhYvDqHXr62UQPnWo2P6fvQlLjsU93UKyxA== +jest-snapshot@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-26.1.0.tgz#c36ed1e0334bd7bd2fe5ad07e93a364ead7e1349" + integrity sha512-YhSbU7eMTVQO/iRbNs8j0mKRxGp4plo7sJ3GzOQ0IYjvsBiwg0T1o0zGQAYepza7lYHuPTrG5J2yDd0CE2YxSw== dependencies: "@babel/types" "^7.0.0" - "@jest/types" "^26.0.1" + "@jest/types" "^26.1.0" "@types/prettier" "^2.0.0" chalk "^4.0.0" - expect "^26.0.1" + expect "^26.1.0" graceful-fs "^4.2.4" - jest-diff "^26.0.1" + jest-diff "^26.1.0" jest-get-type "^26.0.0" - jest-matcher-utils "^26.0.1" - jest-message-util "^26.0.1" - jest-resolve "^26.0.1" - make-dir "^3.0.0" + jest-haste-map "^26.1.0" + jest-matcher-utils "^26.1.0" + jest-message-util "^26.1.0" + jest-resolve "^26.1.0" natural-compare "^1.4.0" - pretty-format "^26.0.1" + pretty-format "^26.1.0" semver "^7.3.2" -jest-util@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.0.1.tgz#72c4c51177b695fdd795ca072a6f94e3d7cef00a" - integrity sha512-byQ3n7ad1BO/WyFkYvlWQHTsomB6GIewBh8tlGtusiylAlaxQ1UpS0XYH0ngOyhZuHVLN79Qvl6/pMiDMSSG1g== +jest-util@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-26.1.0.tgz#80e85d4ba820decacf41a691c2042d5276e5d8d8" + integrity sha512-rNMOwFQevljfNGvbzNQAxdmXQ+NawW/J72dmddsK0E8vgxXCMtwQ/EH0BiWEIxh0hhMcTsxwAxINt7Lh46Uzbg== dependencies: - "@jest/types" "^26.0.1" + "@jest/types" "^26.1.0" chalk "^4.0.0" graceful-fs "^4.2.4" is-ci "^2.0.0" - make-dir "^3.0.0" + micromatch "^4.0.2" -jest-validate@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-26.0.1.tgz#a62987e1da5b7f724130f904725e22f4e5b2e23c" - integrity sha512-u0xRc+rbmov/VqXnX3DlkxD74rHI/CfS5xaV2VpeaVySjbb1JioNVOyly5b56q2l9ZKe7bVG5qWmjfctkQb0bA== +jest-validate@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-26.1.0.tgz#942c85ad3d60f78250c488a7f85d8f11a29788e7" + integrity sha512-WPApOOnXsiwhZtmkDsxnpye+XLb/tUISP+H6cHjfUIXvlG+eKwP+isnivsxlHCPaO9Q5wvbhloIBkdF3qUn+Nw== dependencies: - "@jest/types" "^26.0.1" + "@jest/types" "^26.1.0" camelcase "^6.0.0" chalk "^4.0.0" jest-get-type "^26.0.0" leven "^3.1.0" - pretty-format "^26.0.1" + pretty-format "^26.1.0" -jest-watcher@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-26.0.1.tgz#5b5e3ebbdf10c240e22a98af66d645631afda770" - integrity sha512-pdZPydsS8475f89kGswaNsN3rhP6lnC3/QDCppP7bg1L9JQz7oU9Mb/5xPETk1RHDCWeqmVC47M4K5RR7ejxFw== +jest-watcher@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-26.1.0.tgz#99812a0cd931f0cb3d153180426135ab83e4d8f2" + integrity sha512-ffEOhJl2EvAIki613oPsSG11usqnGUzIiK7MMX6hE4422aXOcVEG3ySCTDFLn1+LZNXGPE8tuJxhp8OBJ1pgzQ== dependencies: - "@jest/test-result" "^26.0.1" - "@jest/types" "^26.0.1" + "@jest/test-result" "^26.1.0" + "@jest/types" "^26.1.0" ansi-escapes "^4.2.1" chalk "^4.0.0" - jest-util "^26.0.1" + jest-util "^26.1.0" string-length "^4.0.1" -jest-worker@^26.0.0: - version "26.0.0" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.0.0.tgz#4920c7714f0a96c6412464718d0c58a3df3fb066" - integrity sha512-pPaYa2+JnwmiZjK9x7p9BoZht+47ecFCDFA/CJxspHzeDvQcfVBLWzCiWyo+EGrSiQMWZtCFo9iSvMZnAAo8vw== +jest-worker@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.1.0.tgz#65d5641af74e08ccd561c240e7db61284f82f33d" + integrity sha512-Z9P5pZ6UC+kakMbNJn+tA2RdVdNX5WH1x+5UCBZ9MxIK24pjYtFt96fK+UwBTrjLYm232g1xz0L3eTh51OW+yQ== dependencies: merge-stream "^2.0.0" supports-color "^7.0.0" -jest@26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/jest/-/jest-26.0.1.tgz#5c51a2e58dff7525b65f169721767173bf832694" - integrity sha512-29Q54kn5Bm7ZGKIuH2JRmnKl85YRigp0o0asTc6Sb6l2ch1DCXIeZTLLFy9ultJvhkTqbswF5DEx4+RlkmCxWg== +jest@26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-26.1.0.tgz#2f3aa7bcffb9bfd025473f83bbbf46a3af026263" + integrity sha512-LIti8jppw5BcQvmNJe4w2g1N/3V68HUfAv9zDVm7v+VAtQulGhH0LnmmiVkbNE4M4I43Bj2fXPiBGKt26k9tHw== dependencies: - "@jest/core" "^26.0.1" + "@jest/core" "^26.1.0" import-local "^3.0.2" - jest-cli "^26.0.1" + jest-cli "^26.1.0" "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" @@ -4139,6 +4181,18 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= +prettier-linter-helpers@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b" + integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w== + dependencies: + fast-diff "^1.1.2" + +prettier@2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4" + integrity sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg== + pretty-format@^25.2.1, pretty-format@^25.5.0: version "25.5.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-25.5.0.tgz#7873c1d774f682c34b8d48b6743a2bf2ac55791a" @@ -4149,12 +4203,12 @@ pretty-format@^25.2.1, pretty-format@^25.5.0: ansi-styles "^4.0.0" react-is "^16.12.0" -pretty-format@^26.0.1: - version "26.0.1" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.0.1.tgz#a4fe54fe428ad2fd3413ca6bbd1ec8c2e277e197" - integrity sha512-SWxz6MbupT3ZSlL0Po4WF/KujhQaVehijR2blyRDCzk9e45EaYMVhMBn49fnRuHxtkSpXTes1GxNpVmH86Bxfw== +pretty-format@^26.1.0: + version "26.1.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-26.1.0.tgz#272b9cd1f1a924ab5d443dc224899d7a65cb96ec" + integrity sha512-GmeO1PEYdM+non4BKCj+XsPJjFOJIPnsLewqhDVoqY1xo0yNmDas7tC2XwpMrRAHR3MaE2hPo37deX5OisJ2Wg== dependencies: - "@jest/types" "^26.0.1" + "@jest/types" "^26.1.0" ansi-regex "^5.0.0" ansi-styles "^4.0.0" react-is "^16.12.0"