@sdslatam/clients v0.0.29
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/clientsAvailable Clients
| Client Name | Implemented Methods | Observations |
|---|---|---|
| CatalogClient | getProductsAndSkus, getSkuById, changeNotification, createSeller, getSellerList, getSellerById, getSkuContext, getCategoryById, getBrandById | This client is to be used on the current account and all subaccounts without AppKey and AppToken authentication |
| CrossCatalogClient | getProductsAndSkus, getSkuById, changeNotification, createSeller, getSellerList, getSellerById, getSkuContext, getCategoryById, getBrandById | This client is to be used in another account and require AppKey and AppToken authentication |
| CheckoutClient | getOrderFormConfiguration, setOrderFormConfiguration, setSingleCustomData | This client is to be used on the current account and all subaccounts without AppKey and AppToken Authentication |
| CrossCheckoutClient | getOrderFormConfiguration, setOrderFormConfiguration, setSingleCustomData | This client is to be used in another account and require AppKey and AppToken authentication |
| OMSClient | listOrders, userLastOrder, getOrdersFromUser, getOrders, orderNotification, cancelOrder | This client is to be used on the current account and all subaccounts without AppKey and AppToken Authentication |
| CrossOMSClient | listOrders, userLastOrder, getOrdersFromUser, getOrders, orderNotification, cancelOrder | This client is to be used in another account and require AppKey and AppToken authentication |
| OMS Proxy | orders, orderFormId, customData, register | You 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.jsonfile.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
- Install this package on the
node/folder of your VTEX IO app:yarn add @sdslatam/clients
Clients
- Import the individual Client on your app's Clients configuration (
node/clients/index.ts):import { CatalogClient } from '@sdslatam/clients' - Add a new getter on the
Clientsclass with the imported Client:public get catalogClient() { return this.getOrSet('catalogClient', CatalogClient) } - 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/apiversion is the same in both IO service and@sdslatam/clients; - Run
yarn && yarn install-peersin package; - Run
yarn build && yarn unlink && yarn linkin package; - Delete
node_modulesinside your service application (this step is not obligatory but might fix some issues); - Run
yarn unlink @sdslatam/clients && yarn link @sdslatam/clients && yarnin 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:
- Merge the Pull Request on the develop branch, after having your changes approved.
- The pipeline will generate a release branch and publish a beta version in NPM register.
- Install the beta version with
yarn add @sdslatam/clients@beta. - Test the library.
- A pipeline with manual step will be generated to publish the stable version to NPM and merge to Main and Develop Branchs.
- 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
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago