Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ yarn-error.log
codegen/handlebars-extensions.js
codegen/hooks.js
openapi.json
npm-debug.log
npm-debug.log
specs/
15 changes: 15 additions & 0 deletions MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ The objective of this guide is to document the breaking changes and updates requ

`Order<MyOrderXp>` still types only the order `xp`. `Category<MyCategoryXp>` is unchanged. `ListPageWithFacets<Product>` is unchanged. Its second parameter is now a `ListFacet`, so facet `xp` is declared as `ListPageWithFacets<Product, ListFacet<MyFacetXp>>`.

## version 12.x.x to version 13.x.x
* `ApiClient.ClientSecret` is removed.
* `SecurityProfile.IsExternalRoleGroup` is removed.
* A buyer product's `PriceSchedule` is a `BuyerPriceSchedule`, not a `PriceSchedule`. `PriceSchedule` remains the seller price schedule. `BuyerPriceSchedule` uses `BuyerPriceBreak`s and may include a `Discount`.

Before:
```typescript
const schedule: PriceSchedule | undefined = buyerProduct.PriceSchedule
```

After:
```typescript
const schedule: BuyerPriceSchedule | undefined = buyerProduct.PriceSchedule
```

## version 11.x.x to version 12.x.x
* The `URL` and `SharedKey` properties have been removed from the `MessageSender` model, and `DeliveryConfigID` is now required. Configuration must be provided via a `DeliveryConfig` (managed through the new `DeliveryConfigurations` service) using either a `MailchimpConfig` or `MessageSenderConfig` delivery target. See the [updated Message Senders KB article](https://ordercloud.io/knowledge-base/message-senders#configuration-options) for more details.

Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The OrderCloud SDK for Javascript is a modern client library for building soluti
- [👬 Impersonation](#-impersonation)
- [Configuration](#configuration)
- [Handling Errors 🐛](#handling-errors-)
- [Interceptors](#interceptors)
- [Request and response hooks](#request-and-response-hooks)
- [Cancelling Requests](#cancelling-requests)
- [Async/Await](#asyncawait)
- [Typescript Support](#typescript-support)
Expand Down Expand Up @@ -252,18 +252,20 @@ Products.Get('my-product')

## Request and response hooks

`Configuration.Set` accepts `onRequest` and `onResponse`. Use them to log, rewrite, or retry a call. `onRequest` returns the request that will be sent. `onResponse` runs before the SDK returns data or throws `OrderCloudError`.
`onRequest` and `onResponse` replace axios interceptors. Set them once with `Configuration.Set`. `onRequest` runs before the call is sent and returns the request to send. `onResponse` runs after the body is read and before the SDK returns data or throws `OrderCloudError`.

The request has `url`, `method`, `headers`, `body`, and `signal`. The response has `data`, `status`, `statusText`, `headers`, and `request`.

```javascript
import { Configuration } from 'ordercloud-javascript-sdk';

Configuration.Set({
onRequest(request) {
console.log(request.method, request.url)
request.headers['X-Request-Id'] = 'abc'
return request
},
onResponse(response) {
console.log(response.status)
console.log(response.status, response.request.url)
return response
},
})
Expand Down
35 changes: 0 additions & 35 deletions specs/001-remove-axios/checklists/requirements.md

This file was deleted.

173 changes: 0 additions & 173 deletions specs/001-remove-axios/spec.md

This file was deleted.

Loading