Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Latest commit

 

History

History
124 lines (91 loc) · 4.16 KB

File metadata and controls

124 lines (91 loc) · 4.16 KB

Migration Guide

The objective of this guide is to document the breaking changes and updates required to migrate from one major version to the next.

version 0.x.x to version 1.x.x

  • The minimum compatible typescript version is now 3.5

  • The OcPasswordResetService service has been renamed to OcForgottenPasswordService.

    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 string

    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 })
    }
  • searchOn and sortBy now require types Searchable<T> and Sortable<T>. Each resolve to an array of string literals specific to that list operation. For example Searchable<'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 ListPage model that takes a type parameter for the item. Any premium search list that has facets should use ListPageWithFacets

    Before:

    const orderList: ListOrder
    const ccList: ListCreditCard

    After:

    const orderList: ListPage<Order>
    const ccList: ListPage<CreditCard>
  • Configuration used to take basePath and baseAuthPath. 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.io

    Before:

    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'
    })),