The objective of this guide is to document the breaking changes and updates required to migrate from one major version to the next.
-
The minimum compatible typescript version is now 3.5
-
The
OcPasswordResetServiceservice has been renamed toOcForgottenPasswordService.Before:
const resetRequest = { ClientID: 'my-client-id', Email: 'test@test.com', Username: 'test' } this.OcPasswordResetService.SendVerificationCode(resetRequest)
After:
const resetRequest = { ClientID: 'my-client-id', Email: 'test@test.com', Username: 'test' } this.OcForgottenPasswordService.SendVerificationCode(resetRequest)
-
Models previously were defined such that all properties were required. Now, properties are only required if the Create/Update operation requires them. Please see understanding ordercloud's models for more information.
-
The following types now require specific case-sensitive string literals instead of simply type
stringApiRoleApprovalStatusCommerceRoleMessageTypeOrderDirectionOrderStatusPartyTypePaymentPriceMarkupTypeUserOrderMoveOption
Before:
OcOrderService.List('incoming') // case insensitive
After:
OcOrderService.List('Incoming') // case sensitive
This may also change how you need to define wrapper functions
Before:
function OrderListWrapper(orderDirection: string) { return this.OcProductService.List({ orderDirection: orderDirection }) }
After:
// where OrderDirection is a model that can be imported function OrderListWrapper(orderDirection: OrderDirection) { return this.OcProductService.List({ orderDirection: orderDirection }) }
-
searchOnandsortBynow require typesSearchable<T>andSortable<T>. Each resolve to an array of string literals specific to that list operation. For exampleSearchable<'Orders.List'>resolves to("ID" | "FromCompanyID" | "ToCompanyID" | "Comments")[].Before:
this.OcOrders.List('Incoming', {searchOn: 'ID,FromCompanyID', sortBy: 'ID,ToCompanyID'})
After:
this.OcOrders.List('Incoming', {searchOn: ['ID', 'FromCompanyID'], sortBy: ['ID', 'ToCompanyID']})
-
List models have been replaced with a generic
ListPagemodel that takes a type parameter for the item. Any premium search list that has facets should useListPageWithFacetsBefore:
const orderList: ListOrder const ccList: ListCreditCard
After:
const orderList: ListPage<Order> const ccList: ListPage<CreditCard>
-
Configuration used to take
basePathandbaseAuthPath. These were two separate values because our auth server had a different url (https://auth.ordercloud.io) than our main api server (https://api.ordercloud.io). That is no longer true, they are now both served from https://api.ordercloud.ioBefore:
OrderCloudModule.forRoot(() => new Configuration({ basePath: 'https://api.ordercloud.io/v1', authPath: 'https://auth.ordercloud.io/oauth/token' })),
After:
OrderCloudModule.forRoot(() => new Configuration({ baseApiUrl: 'https://api.ordercloud.io' })),