0.0.29 • Published 5 months ago

@sdslatam/clients v0.0.29

Weekly downloads
-
License
-
Repository
bitbucket
Last release
5 months ago

This exports Clients and Typescript typings to help you connecting a VTEX IO application with VTEX Core Commerce modules on Node.js services.

Installing

yarn add @sdslatam/clients

Available Clients

Client NameImplemented MethodsObservations
CatalogClientgetProductsAndSkus, getSkuById, changeNotification, createSeller, getSellerList, getSellerById, getSkuContext, getCategoryById, getBrandByIdThis client is to be used on the current account and all subaccounts without AppKey and AppToken authentication
CrossCatalogClientgetProductsAndSkus, getSkuById, changeNotification, createSeller, getSellerList, getSellerById, getSkuContext, getCategoryById, getBrandByIdThis client is to be used in another account and require AppKey and AppToken authentication
CheckoutClientgetOrderFormConfiguration, setOrderFormConfiguration, setSingleCustomDataThis client is to be used on the current account and all subaccounts without AppKey and AppToken Authentication
CrossCheckoutClientgetOrderFormConfiguration, setOrderFormConfiguration, setSingleCustomDataThis client is to be used in another account and require AppKey and AppToken authentication
OMSClientlistOrders, userLastOrder, getOrdersFromUser, getOrders, orderNotification, cancelOrderThis client is to be used on the current account and all subaccounts without AppKey and AppToken Authentication
CrossOMSClientlistOrders, userLastOrder, getOrdersFromUser, getOrders, orderNotification, cancelOrderThis client is to be used in another account and require AppKey and AppToken authentication
OMS Proxyorders, orderFormId, customData, registerYou will have to declare a dependency and a policy on your app. You can check out this document.

Note: Some of the methods might need some policies to be inserted on your application's manifest.json file.

Master Data Builder: There are two versions of Master Data Builder version 1.x and 2.x both can be used. Version 2.x presents a new feature to create schemas more intelligently, avoiding their excessive creation. To use version 2.x, it is important to make this explicit in the app's Manifest and pass the new major parameter in the masterDataFor function (e.g. masterDataFor('books', undefined, 2))

How to use

  1. Install this package on the node/ folder of your VTEX IO app:
    yarn add @sdslatam/clients

Clients

  1. Import the individual Client on your app's Clients configuration (node/clients/index.ts):
    import { CatalogClient } from '@sdslatam/clients'
  2. Add a new getter on the Clients class with the imported Client:
      public get catalogClient() {
        return this.getOrSet('catalogClient', CatalogClient)
      }
  3. Now, you can use the available client's on the app's resolver functions!
    ctx.clients.catalogClient.getSkuById(...)

Authorization

Every Client method excepts CrossClients should accept an option authMethod parameter that declares which token will be used on that HTTP call. By default, the request will use the authToken of the app.

Here are the available options for that parameter: | Option | Description | |-------------|--------------------------------------------------| | AUTHTOKEN | Use the current app's token (default)_ | | STORE_TOKEN | Use the current authenticated store user's token | | ADMIN_TOKEN | Use the current authenticated admin user's token |

API Reference

To discover and learn more about VTEX Core Commerce APIs, read VTEX Developer Portal.

Develop

In order to test your new feature or fix using vtex link (command used for linking a service application in IO, for example), follow these steps:

  • Guarantee that @vtex/api version is the same in both IO service and @sdslatam/clients;
  • Run yarn && yarn install-peers in package;
  • Run yarn build && yarn unlink && yarn link in package;
  • Delete node_modules inside your service application (this step is not obligatory but might fix some issues);
  • Run yarn unlink @sdslatam/clients && yarn link @sdslatam/clients && yarn in your repository;
  • Make sure to use the same version of @vtex/api (6.x) in the target project
  • Now you can link your service application with vtex link.
  • Test and generate a PR to develop.

Releasing

We have a Bitbucket Pipeline configured to release the package on NPM for every Release tag pushed into the repository. So, in order to have this project published:

  1. Merge the Pull Request on the develop branch, after having your changes approved.
  2. The pipeline will generate a release branch and publish a beta version in NPM register.
  3. Install the beta version with yarn add @sdslatam/clients@beta.
  4. Test the library.
  5. A pipeline with manual step will be generated to publish the stable version to NPM and merge to Main and Develop Branchs.
  6. Install the stable version on your project.

Obs.: Don't forget to unlink the local project with yarn unlink @sdslatam/clients

šŸ¤ Colaboradores

Agradecemos Ć s seguintes pessoas que contribuĆ­ram para este projeto:

  • Gustavo Dinis Viana
  • Yuri Silva
0.0.29

5 months ago

0.0.28

6 months ago

0.0.27

6 months ago

0.0.26

6 months ago

0.0.25

6 months ago

0.0.24

8 months ago

0.0.23

8 months ago

0.0.22

8 months ago

0.0.21

8 months ago

0.0.20

8 months ago

0.0.19

8 months ago

0.0.18

8 months ago

0.0.17

8 months ago

0.0.16

9 months ago

0.0.15

9 months ago

0.0.14

9 months ago

0.0.13

10 months ago

0.0.13-beta.5

10 months ago

0.0.13-beta.4

10 months ago

0.0.13-beta.3

10 months ago

0.0.13-beta.2

10 months ago

0.0.13-beta.1

10 months ago

0.0.13-beta.0

10 months ago

0.0.12

10 months ago

0.0.11

10 months ago

0.0.10

10 months ago

0.0.9

10 months ago

0.0.8

10 months ago

0.0.8-0

10 months ago

0.0.7

10 months ago