shipbob-node-sdk 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -43,7 +43,7 @@ SHIPBOB_API_TOKEN=<redacted>
43
43
  - :heavy_check_mark: Cancel single Order by Order ID: api.cancelSingleOrderByOrderId()
44
44
  - :x: Get Order Store Json
45
45
  - :x: Save the Store Order Json (The JSON that represent the order on the Third Party Source)
46
- - :x: Get one Shipment by Order Id and Shipment Id
46
+ - :heavy_check_mark: Get one Shipment by Order Id and Shipment Id: `api.getOneShipmentByOrderIdAndShipmentId(...)`
47
47
  - :x: Cancel one Shipment by Order Id and Shipment Id
48
48
  - :x: Get one Shipment's status timeline by Order Id and Shipment Id
49
49
  - :question: Get all Shipments for Order
@@ -57,37 +57,41 @@ SHIPBOB_API_TOKEN=<redacted>
57
57
  - :heavy_check_mark: Get shipping methods: api.getShippingMethods()
58
58
 
59
59
  ## Shipments
60
- - :question: Get one Shipment by Shipment Id (webhooks are enough?)
61
- - :question: Update a Shipment (marked with tracking information uploaded to a third-party system where the order originated)
60
+ Turns out the webhooks aren't reliable, so polling is needed to get shipment information.
61
+ 1. `order_shipped` webhook can fire without tracking details
62
+ 2. `shipment_delivered` webhook may not be sent. Additionally, exceptions (return to sender) have no webhook.
63
+
64
+ - :heavy_check_mark: Get one Shipment by Shipment Id: `api.getOneShipment()`
65
+ - :x: Update a Shipment (marked with tracking information uploaded to a third-party system where the order originated)
62
66
  - :question: Cancel one Shipment by Shipment Id
63
67
  - :x: Cancel multiple Shipments by Shipment Id
64
68
  - :x: Get one Shipment's status timeline by Shipment Id
65
69
  - :x: Get logs for one Shipment by Shipment Id
66
- - :question: Get shipping methods (hard-code shipping methods?)
70
+ - :heavy_check_mark: Get shipping methods: `api.getShippingMethods()`
67
71
 
68
72
  ## Products 1.0
69
- - :heavy_check_mark: Get multiple products: api.getProducts1_0(...)
70
- - :heavy_check_mark: Add a single product to the store: api.createProduct1_0(...)
73
+ - :heavy_check_mark: Get multiple products: `api.getProducts1_0(...)`
74
+ - :heavy_check_mark: Add a single product to the store: `api.createProduct1_0(...)`
71
75
  - :x: Modify a single product (using 2.0 for additional properties)
72
76
  - :x: Add multiple products to the store
73
77
 
74
78
  ## Products 2.0
75
79
  These are not documented on the site yet:
76
- - :heavy_check_mark: Get multiple products: api.getProducts2_0(...)
77
- - :heavy_check_mark: Add a single product to the store: api.createProduct2_0(...)
78
- - :heavy_check_mark: Modify a single product: api.updateProducts2_0(...)
80
+ - :heavy_check_mark: Get multiple products: `api.getProducts2_0(...)`
81
+ - :heavy_check_mark: Add a single product to the store: `api.createProduct2_0(...)`
82
+ - :heavy_check_mark: Modify a single product: `api.updateProducts2_0(...)`
79
83
  - :x: Add multiple products to the store
80
84
 
81
85
  ## Products Experimental
82
86
  Kindly note as it's experimental subject to change/removal :skull:
83
- - :heavy_check_mark: Get multiple products: api.getProductsExperimental(...)
84
- - :heavy_check_mark: Add a single product to the store: api.createProductExperimental(...)
85
- - :heavy_check_mark: Modify a single product: api.updateProductsExperimental(...)
87
+ - :heavy_check_mark: Get multiple products: `api.getProductsExperimental(...)`
88
+ - :heavy_check_mark: Add a single product to the store: `api.createProductExperimental(...)`
89
+ - :heavy_check_mark: Modify a single product: `api.updateProductsExperimental(...)`
86
90
  - :x: Add multiple products to the store
87
91
 
88
92
  ## Inventory
89
93
  - [ ] Get an inventory item
90
- - :heavy_check_mark: List inventory items: api.listInventory(...)
94
+ - :heavy_check_mark: List inventory items: `api.listInventory(...)`
91
95
  - :x: Get a list of inventory items by product id (we don't know product_id)
92
96
 
93
97
  ## Channels
@@ -102,11 +106,11 @@ Kindly note as it's experimental subject to change/removal :skull:
102
106
  - :question: Get One Return's status history
103
107
 
104
108
  ## Receiving
105
- - :heavy_check_mark: Get Fulfillment Centers: api.getFulfillmentCenters()
106
- - :heavy_check_mark: Get Warehouse Receiving Order: api.getWarehouseReceivingOrder(...)
107
- - :heavy_check_mark: Get Warehouse Receiving Order Boxes: api.getWarehouseReceivingOrderBoxes(...)
109
+ - :heavy_check_mark: Get Fulfillment Centers: `api.getFulfillmentCenters()`
110
+ - :heavy_check_mark: Get Warehouse Receiving Order: `api.getWarehouseReceivingOrder(...)`
111
+ - :heavy_check_mark: Get Warehouse Receiving Order Boxes: `api.getWarehouseReceivingOrderBoxes(...)`
108
112
  - :x: Get Multiple Warehouse Receiving Orders (using receiving-extended instead)
109
- - :heavy_check_mark: Create Warehouse Receiving Order: api.createWarehouseReceivingOrder(...)
113
+ - :heavy_check_mark: Create Warehouse Receiving Order: `api.createWarehouseReceivingOrder(...)`
110
114
  - :x: Get Warehouse Receiving Order Box Labels
111
115
  - :x: Cancel Warehouse Receiving Order (could be done manually, if needed?)
112
116
  - :x: 5 x DEPRECATED '/1.0/receiving
@@ -117,22 +121,26 @@ Kindly note as it's experimental subject to change/removal :skull:
117
121
  - Cancel Warehouse Receiving Order
118
122
 
119
123
  ## Receiving-Extended (not in API docs)
120
- - :heavy_check_mark: Get Receiving Extended: api.getReceivingExtended(...) (will include this in a recipe that uses SetExternalSync)
124
+ - :heavy_check_mark: Get Receiving Extended: `api.getReceivingExtended(...)` (will include this in a recipe that uses SetExternalSync)
121
125
 
122
126
  ## Receiving Experimental
123
127
  Kindly note as it's experimental subject to change/removal :skull:
124
128
 
125
129
  I'll try to share a recipe for using this for marking completed WROs.
126
- - :heavy_check_mark: Receiving Set External Sync: api.experimentalReceivingSetExternalSync(...)
130
+ - :heavy_check_mark: Receiving Set External Sync: `api.experimentalReceivingSetExternalSync(...)`
127
131
 
128
132
  ## Webhooks
129
133
  - :heavy_check_mark: Get Webhooks: api.getWebhooks()
130
- - :heavy_check_mark: Create a new webhook subscription: api.registerWebhookSubscription(...)
131
- - :heavy_check_mark: Delete an existing webhook subscription: api.unregisterWebhookSubscription(...)
134
+ - :heavy_check_mark: Create a new webhook subscription: `api.registerWebhookSubscription(...)`
135
+ - :heavy_check_mark: Delete an existing webhook subscription: `api.unregisterWebhookSubscription(...)`
132
136
 
133
137
  ## Locations
134
138
  - :x: Get locations
135
139
 
140
+ ## follow URIs
141
+ This is not part of the API, but instead allows you to follow URI's returned in the API (see tests for examples)
142
+ - :heavy_check_mark: Retrive a path from a provided resource ie: header `next-page`: `api.getPath<T>(response.headers['next-page'])`
143
+
136
144
  # Building locally
137
145
  For making changes to this library locally - use `yarn link` to test out the changes easily. This is useful if you would like to contribute.
138
146
 
@@ -207,4 +215,19 @@ for (const event of events) {
207
215
  }
208
216
  ```
209
217
 
210
- You can publish that as an event or push to a queue and it will act as a "webhook".
218
+ You can publish that as an event or push to a queue and it will act as a "webhook".
219
+
220
+ # OAuth
221
+ There is no S2S (server-to-server) oAuth. User intervention is required. There are only helper methods to help with that.
222
+ - `oAuthGetConnectUrl()` direct an end user to follow the generated URL. Use 'offline_access' as part of scope to get a refresh token.
223
+ - `oAuthGetAccessToken()` call this with the `code` query string fragment `https://yourname.ngrok.io/#code=...&id_token=...` the redirect_uri (and your client Id and secret from ShipBob App)
224
+ - `oAuthRefreshAccessToken()` call this with the last `refresh_token` you received, otherwise the same as `oAuthGetAccessToken()` without `code`.
225
+
226
+ The method to get/refresh access token both return `access_token`, so you provide that to `createShipBobApi(...)` with your application name.
227
+ Then you can use the same as a PAT (Personal Access Token).
228
+
229
+ # Polling Orders for tracking
230
+ 1. Poll GET 1.0/order?HasTracking=true&IsTrackingUploaded=false&startDate=03-25-2025
231
+ 2. Iterate through each order (and each shipment)
232
+ 3. Sync the tracking back to your platform
233
+ 4. Mark the order as shipped using this endpoint (https://developer.shipbob.com/api-docs/#tag/Orders/paths/~11.0~1shipment~1%7BshipmentId%7D/put). Or, you can mark it as shipped using the bulk mark as shipped endpoint (https://developer.shipbob.com/api-docs/#tag/Orders/paths/~11.0~1shipment~1:bulkUpdateTrackingUpload/post).
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { AddProductResponse, CancelOrderResponse, ExperimentalPagedResult, FulfillmentCenter, GetInventory1_0Result, GetOrdersQueryStrings, GetProduct1_0Result, GetProduct2_0Response, GetProductExperimentalResponse, GetProductQueryStrings, GetProducts1_0QueryString, ListInventoryQueryStrings, Order, PlaceOrderRequest, SetExternalSyncResponse, ShippingMethod, SimulateShipmentRequest, SimulateShipmentResponse, SimulationResponse, VariantRequestProduct2_0, VariantRequestProductExperimental, WarehouseReceivingOrderBoxesResponse, WarehouseReceivingOrderRequest, WarehouseReceivingOrderResponse, Webhook } from './types';
1
+ import { AddProductResponse, CancelOrderResponse, Channel, CreateOptions, ExperimentalPagedResult, FulfillmentCenter, GetInventory1_0Result, GetOrdersQueryStrings, GetProduct1_0Result, GetProduct2_0Response, GetProductExperimentalResponse, GetProductQueryStrings, GetProducts1_0QueryString, ListInventoryQueryStrings, Order, OrderShipment, PlaceOrderRequest, SetExternalSyncResponse, ShippingMethod, SimulateShipmentRequest, SimulateShipmentResponse, SimulationResponse, VariantRequestProduct2_0, VariantRequestProductExperimental, WarehouseReceivingOrderBoxesResponse, WarehouseReceivingOrderRequest, WarehouseReceivingOrderResponse, Webhook } from './types';
2
2
  export * from './types';
3
+ export * from './oAuth';
3
4
  export type Nullable<T> = T | null;
4
5
  export type Credentials = {
5
6
  token: string;
@@ -37,30 +38,36 @@ export type DataResponse<T> = ({
37
38
  retryAfter: Nullable<number>;
38
39
  };
39
40
  };
40
- export type CreateOptions = {
41
- /**
42
- * console.log HTTP traffic (http verb + endpoint)
43
- */
44
- logTraffic: boolean;
45
- };
46
41
  /**
47
- * Create API with PAT (personal access token) - defaults to sandbox endpoints and "SMA" channel.
48
- *
49
- * NOTE: We used token based auth, so did not need to implement the other auth mechanism(s).
42
+ * Create API with PAT (personal access token) or oAuth (access token).
50
43
  *
51
44
  * TODO: Consider adding global parameters like timeout (or per method). Some endpoints are slower than others.
45
+ * TODO: Consider allowing channel selection to occur based on an available scope. ie: `fulfillments_write` instead of only application name.
52
46
  *
53
- * @param personalAccessToken passing *undefined* or empty string has a guar clause that will throw
47
+ * @param token Personal Access Token for `connectionType` "PAT". Otherwise an OAuth token when `connectinoType` is 'OAuth
54
48
  * @param apiBaseUrl must pass "api.shipbob.com" otherwise sandbox will be used.
55
- * @param channelApplicationName will default to SMA account, otherwise provide your application_name here
49
+ * @param channelPredicateOrApplicationName will default to choosing "SMA" application_name, otherwise provide your own application_name here (ie: for oAuth use the name of your App)
56
50
  * @param options defaults to not logging traffic
57
51
  */
58
- export declare const createShipBobApi: (personalAccessToken: string | undefined, apiBaseUrl?: string, channelApplicationName?: string, options?: CreateOptions) => Promise<{
52
+ export declare const createShipBobApi: (token: string | undefined, apiBaseUrl?: string, channelPredicateOrApplicationName?: string | ((channels: Channel[]) => Channel | undefined), options?: CreateOptions) => Promise<{
53
+ readonly sendingChannelIds: boolean;
54
+ sendChannelId: boolean;
55
+ /**
56
+ * Useful to retrive cursor paths (ie: next) or header 'next-page'. You should call like:
57
+ *
58
+ * `api.getPath<ExperimentalPagedResult<GetProductExperimentalResponse>>('/Product?cursor=H4sIAAA...')`
59
+ *
60
+ * NOTE: can be called without typings. ie: `api.getPath('/Product?cursor=H4sIAAA...')`
61
+ * @param path full path with leading slash
62
+ * @returns response with expected typings you can provide.
63
+ */
64
+ getPath: <T>(path: string) => Promise<DataResponse<T>>;
65
+ getChannels: () => Promise<DataResponse<Channel>>;
59
66
  /**
60
67
  * Gets by *their* product id
61
68
  */
62
69
  getProductById: (productId: number) => Promise<DataResponse<GetProduct1_0Result>>;
63
- getProducts1_0: (query: GetProducts1_0QueryString) => Promise<DataResponse<GetProduct1_0Result[]>>;
70
+ getProducts1_0: (query?: GetProducts1_0QueryString) => Promise<DataResponse<GetProduct1_0Result[]>>;
64
71
  /**
65
72
  * NOTE: you need to use the headers (part of this client response) to page the results.
66
73
  * page-number='1'
@@ -83,11 +90,11 @@ export declare const createShipBobApi: (personalAccessToken: string | undefined,
83
90
  * Example: /product?sku=any:shirt-a,shirt-b,shirt-c Find products that match any of these SKUs
84
91
  * Example: /product?onHandQuantity=gt:0 Find products where OnHandQty greater than 0
85
92
  */
86
- getProducts2_0: (query: GetProductQueryStrings) => Promise<DataResponse<GetProduct2_0Response[]>>;
93
+ getProducts2_0: (query?: GetProductQueryStrings) => Promise<DataResponse<GetProduct2_0Response[]>>;
87
94
  /**
88
95
  * Note sure how this is different from /2.0/product. Only notable difference is "barcodes" type from string to object.
89
96
  */
90
- getProductsExperimental: (query: Partial<GetProductQueryStrings>) => Promise<DataResponse<ExperimentalPagedResult<GetProductExperimentalResponse>>>;
97
+ getProductsExperimental: (query?: Partial<GetProductQueryStrings>) => Promise<DataResponse<ExperimentalPagedResult<GetProductExperimentalResponse>>>;
91
98
  createProduct1_0: (product: {
92
99
  reference_id: string;
93
100
  sku: string;
@@ -113,7 +120,15 @@ export declare const createShipBobApi: (personalAccessToken: string | undefined,
113
120
  /**
114
121
  * Look in the returned headers to get paging information.
115
122
  */
116
- getOrders: (query: Partial<GetOrdersQueryStrings>) => Promise<DataResponse<Order[]>>;
123
+ getOrders: (query?: Partial<GetOrdersQueryStrings>) => Promise<DataResponse<Order[]>>;
124
+ /**
125
+ * Get one Shipment by Order Id and Shipment Id
126
+ */
127
+ getOneShipmentByOrderIdAndShipmentId: (orderId: number, shipmentId: number) => Promise<DataResponse<OrderShipment>>;
128
+ /**
129
+ * Get one Shipment by Shipment Id
130
+ */
131
+ getOneShipment: (shipmentId: number) => Promise<DataResponse<OrderShipment>>;
117
132
  /**
118
133
  * NOTE: After you place an order it is not immediately available on the "getOrders" endpoint.
119
134
  * You are best off using the returned result. ShipBob suggests 5 seconds as permitted delay time.
@@ -136,15 +151,16 @@ export declare const createShipBobApi: (personalAccessToken: string | undefined,
136
151
  * @param sendChannelId defaults `true`. Not providing channel id will (I think) subscribe to all channels. You need to match when unsubscribing.
137
152
  * @returns
138
153
  */
139
- registerWebhookSubscription: (webhook: Omit<Webhook, "id" | "created_at">, sendChannelId?: boolean) => Promise<DataResponse<Webhook>>;
154
+ registerWebhookSubscription: (webhook: Omit<Webhook, "id" | "created_at">) => Promise<DataResponse<Webhook>>;
140
155
  /**
141
156
  * Can generate 500 response with data: "The wait operation timed out." If so, check your channel id (or lack thereof) matches the subscription registration.
142
157
  *
158
+ * NOTE: make sure the API is configured to send or not send the same as when you registered the webhook.
159
+ *
143
160
  * @param id channelId from getWebhooks()
144
- * @param sendChannelId defaults `true`. You need to match this with when you subscribed. There's no way to see this anywhere.
145
161
  * @returns
146
162
  */
147
- unregisterWebhookSubscription: (id: number, sendChannelId?: boolean) => Promise<DataResponse<Webhook>>;
163
+ unregisterWebhookSubscription: (id: number) => Promise<DataResponse<Webhook>>;
148
164
  getFulfillmentCenters: () => Promise<DataResponse<FulfillmentCenter[]>>;
149
165
  createWarehouseReceivingOrder: (request: WarehouseReceivingOrderRequest) => Promise<DataResponse<WarehouseReceivingOrderResponse>>;
150
166
  getWarehouseReceivingOrder: (orderId: number) => Promise<DataResponse<WarehouseReceivingOrderResponse>>;
package/dist/index.js CHANGED
@@ -18,6 +18,7 @@ exports.createShipBobApi = void 0;
18
18
  /* eslint-disable @typescript-eslint/consistent-type-definitions */
19
19
  const node_url_1 = require("node:url"); // WHATWG
20
20
  __exportStar(require("./types"), exports);
21
+ __exportStar(require("./oAuth"), exports);
21
22
  // Products
22
23
  const PATH_1_0_CHANNEL = '/1.0/channel';
23
24
  const PATH_1_0_PRODUCT = '/1.0/product';
@@ -26,6 +27,8 @@ const PATH_EXPERIMENTAL_PRODUCT = '/experimental/product';
26
27
  // Orders
27
28
  const PATH_1_0_ORDER = '/1.0/order';
28
29
  const PATH_1_0_SHIPPINGMETHOD = '/1.0/shippingmethod';
30
+ // Shipments
31
+ const PATH_1_0_SHIPMENT = '/1.0/shipment';
29
32
  /**
30
33
  * Warehouse Receiving Order
31
34
  */
@@ -42,26 +45,30 @@ const PATH_1_0_INVENTORY = '/1.0/inventory';
42
45
  const PATH_1_0_FULFILLMENT_CENTER = '/1.0/fulfillmentCenter';
43
46
  const PATH_1_0_WEBHOOK = '/1.0/webhook';
44
47
  const PATH_2_0_SIMULATE = '/2.0/simulate';
48
+ // single-merchant application
49
+ const DEFAULT_CHANNEL_APPLICATION_NAME = 'SMA';
45
50
  /**
46
- * Create API with PAT (personal access token) - defaults to sandbox endpoints and "SMA" channel.
47
- *
48
- * NOTE: We used token based auth, so did not need to implement the other auth mechanism(s).
51
+ * Create API with PAT (personal access token) or oAuth (access token).
49
52
  *
50
53
  * TODO: Consider adding global parameters like timeout (or per method). Some endpoints are slower than others.
54
+ * TODO: Consider allowing channel selection to occur based on an available scope. ie: `fulfillments_write` instead of only application name.
51
55
  *
52
- * @param personalAccessToken passing *undefined* or empty string has a guar clause that will throw
56
+ * @param token Personal Access Token for `connectionType` "PAT". Otherwise an OAuth token when `connectinoType` is 'OAuth
53
57
  * @param apiBaseUrl must pass "api.shipbob.com" otherwise sandbox will be used.
54
- * @param channelApplicationName will default to SMA account, otherwise provide your application_name here
58
+ * @param channelPredicateOrApplicationName will default to choosing "SMA" application_name, otherwise provide your own application_name here (ie: for oAuth use the name of your App)
55
59
  * @param options defaults to not logging traffic
56
60
  */
57
- const createShipBobApi = async (personalAccessToken, apiBaseUrl = 'sandbox-api.shipbob.com', channelApplicationName = 'SMA', options = {
61
+ const createShipBobApi = async (token, apiBaseUrl = 'sandbox-api.shipbob.com', channelPredicateOrApplicationName = DEFAULT_CHANNEL_APPLICATION_NAME, options = {
58
62
  logTraffic: false,
59
63
  }) => {
60
- if (personalAccessToken === undefined || personalAccessToken === '') {
64
+ if (token === undefined || token === '') {
61
65
  throw new Error('Cannot create a ShipBob API without a PAT');
62
66
  }
63
67
  const credentials = {
64
- token: personalAccessToken,
68
+ token,
69
+ };
70
+ const apiConfiguration = {
71
+ sendChannelId: options.sendChannelId !== false,
65
72
  };
66
73
  const REMAINING_CALLS = 'x-remaining-calls'; // in sliding window
67
74
  const RETRY_AFTER_SECONDS = 'x-retry-after'; // seconds to wait for rate-limiting
@@ -128,22 +135,29 @@ const createShipBobApi = async (personalAccessToken, apiBaseUrl = 'sandbox-api.s
128
135
  rateLimit,
129
136
  };
130
137
  };
131
- const getHeaders = (credentials, sendChannelId) => {
138
+ const getHeaders = (credentials) => {
132
139
  const headers = {
133
140
  Authorization: `Bearer ${credentials.token}`,
134
141
  'Content-Type': 'application/json',
135
142
  Accept: 'application/json',
136
143
  'User-Agent': 'shipbob-node-sdk',
137
144
  };
138
- if (credentials.channelId && sendChannelId !== false) {
145
+ if (credentials.channelId && apiConfiguration.sendChannelId !== false) {
139
146
  headers['shipbob_channel_id'] = credentials.channelId.toString();
140
147
  }
148
+ if (options.logTraffic === true) {
149
+ const headersToLog = Object.keys(headers).reduce((prev, cur) => {
150
+ prev.push(cur === 'Authorization' ? `${cur}:Bearer <redacted>` : `${cur}:${headers[cur]}`);
151
+ return prev;
152
+ }, []);
153
+ console.log(` > Headers: ${JSON.stringify(headersToLog.join(','))}`);
154
+ }
141
155
  return headers;
142
156
  };
143
157
  /**
144
158
  * Will GET using our PAT and SAM channel
145
159
  */
146
- const httpGet = async (credentials, path, query, sendChannelId = true) => {
160
+ const httpGet = async (credentials, path, query) => {
147
161
  const url = new node_url_1.URL(`https://${apiBaseUrl}${path}`);
148
162
  if (query) {
149
163
  for (const param of Object.keys(query)) {
@@ -160,32 +174,32 @@ const createShipBobApi = async (personalAccessToken, apiBaseUrl = 'sandbox-api.s
160
174
  // NOTE: both replacements are needed for above to work
161
175
  url.search = url.search.replace(/%2C/g, ',').replace(/%3A/g, ':'); //;
162
176
  }
163
- if (options.logTraffic) {
164
- console.log(` > GET: ${url.href}`);
165
- }
166
177
  const opts = {
167
178
  method: 'GET',
168
- headers: getHeaders(credentials, sendChannelId),
179
+ headers: getHeaders(credentials),
169
180
  };
181
+ if (options.logTraffic) {
182
+ console.log(` > GET: ${url.href}`);
183
+ }
170
184
  const res = await fetch(url.href, opts);
171
185
  return getResult(res);
172
186
  };
173
187
  /**
174
188
  * Will default POST to Shipbob a request as JSON. Can be used for any type of request
175
189
  */
176
- const httpData = async (credentials, data, path, method = 'POST', sendChannelId = true) => {
190
+ const httpData = async (credentials, data, path, method = 'POST') => {
177
191
  if (credentials.channelId === undefined) {
178
192
  throw new Error('Channel ID missing');
179
193
  }
180
194
  const url = new node_url_1.URL(`https://${apiBaseUrl}${path}`);
181
- if (options.logTraffic) {
182
- console.log(` > ${method} ${url.href}`);
183
- }
184
195
  const opts = {
185
196
  method,
186
- headers: getHeaders(credentials, sendChannelId),
197
+ headers: getHeaders(credentials),
187
198
  body: data !== undefined ? JSON.stringify(data) : undefined,
188
199
  };
200
+ if (options.logTraffic) {
201
+ console.log(` > ${method} ${url.href}`);
202
+ }
189
203
  const res = await fetch(url.href, opts);
190
204
  return getResult(res);
191
205
  };
@@ -193,12 +207,38 @@ const createShipBobApi = async (personalAccessToken, apiBaseUrl = 'sandbox-api.s
193
207
  if (!channelsResponse.success) {
194
208
  throw new Error(` > GET /1.0/channel -> ${channelsResponse.statusCode} '${channelsResponse.data}'`);
195
209
  }
196
- const smaChannel = channelsResponse.data.find((c) => c.application_name === channelApplicationName);
197
- if (smaChannel === undefined) {
198
- throw new Error(`Did not find SMA channel {${channelsResponse.data.map((c) => c.application_name).join(',')}}`);
210
+ const selectedChannel = typeof channelPredicateOrApplicationName === 'string'
211
+ ? channelsResponse.data.find((c) => c.application_name === channelPredicateOrApplicationName)
212
+ : channelPredicateOrApplicationName(channelsResponse.data);
213
+ if (selectedChannel === undefined) {
214
+ throw new Error(`Did not find channel. Available application names: {${channelsResponse.data.map((c) => c.application_name).join(',')}}`);
215
+ }
216
+ if (options.logTraffic) {
217
+ console.log(` > Found channel id: ${selectedChannel.id} with application name: '${selectedChannel.application_name}'`);
199
218
  }
200
- credentials.channelId = smaChannel.id;
219
+ credentials.channelId = selectedChannel.id;
201
220
  return {
221
+ get sendingChannelIds() {
222
+ return apiConfiguration.sendChannelId;
223
+ },
224
+ set sendChannelId(value) {
225
+ apiConfiguration.sendChannelId = value;
226
+ },
227
+ /**
228
+ * Useful to retrive cursor paths (ie: next) or header 'next-page'. You should call like:
229
+ *
230
+ * `api.getPath<ExperimentalPagedResult<GetProductExperimentalResponse>>('/Product?cursor=H4sIAAA...')`
231
+ *
232
+ * NOTE: can be called without typings. ie: `api.getPath('/Product?cursor=H4sIAAA...')`
233
+ * @param path full path with leading slash
234
+ * @returns response with expected typings you can provide.
235
+ */
236
+ getPath: async (path) => {
237
+ return await httpGet(credentials, path);
238
+ },
239
+ getChannels: async () => {
240
+ return await httpGet(credentials, PATH_1_0_CHANNEL);
241
+ },
202
242
  /**
203
243
  * Gets by *their* product id
204
244
  */
@@ -269,6 +309,20 @@ const createShipBobApi = async (personalAccessToken, apiBaseUrl = 'sandbox-api.s
269
309
  getOrders: async (query) => {
270
310
  return await httpGet(credentials, PATH_1_0_ORDER, query);
271
311
  },
312
+ /**
313
+ * Get one Shipment by Order Id and Shipment Id
314
+ */
315
+ getOneShipmentByOrderIdAndShipmentId: async (orderId, shipmentId) => {
316
+ const path = `${PATH_1_0_ORDER}/${orderId}/shipment/${shipmentId}`;
317
+ return await httpGet(credentials, path);
318
+ },
319
+ /**
320
+ * Get one Shipment by Shipment Id
321
+ */
322
+ getOneShipment: async (shipmentId) => {
323
+ const path = `${PATH_1_0_SHIPMENT}/${shipmentId}`;
324
+ return await httpGet(credentials, path);
325
+ },
272
326
  /**
273
327
  * NOTE: After you place an order it is not immediately available on the "getOrders" endpoint.
274
328
  * You are best off using the returned result. ShipBob suggests 5 seconds as permitted delay time.
@@ -299,18 +353,19 @@ const createShipBobApi = async (personalAccessToken, apiBaseUrl = 'sandbox-api.s
299
353
  * @param sendChannelId defaults `true`. Not providing channel id will (I think) subscribe to all channels. You need to match when unsubscribing.
300
354
  * @returns
301
355
  */
302
- registerWebhookSubscription: async (webhook, sendChannelId = true) => {
303
- return await httpData(credentials, webhook, PATH_1_0_WEBHOOK, undefined, sendChannelId);
356
+ registerWebhookSubscription: async (webhook) => {
357
+ return await httpData(credentials, webhook, PATH_1_0_WEBHOOK, undefined);
304
358
  },
305
359
  /**
306
360
  * Can generate 500 response with data: "The wait operation timed out." If so, check your channel id (or lack thereof) matches the subscription registration.
307
361
  *
362
+ * NOTE: make sure the API is configured to send or not send the same as when you registered the webhook.
363
+ *
308
364
  * @param id channelId from getWebhooks()
309
- * @param sendChannelId defaults `true`. You need to match this with when you subscribed. There's no way to see this anywhere.
310
365
  * @returns
311
366
  */
312
- unregisterWebhookSubscription: async (id, sendChannelId = true) => {
313
- return await httpData(credentials, undefined, `${PATH_1_0_WEBHOOK}/${id}`, 'DELETE', sendChannelId);
367
+ unregisterWebhookSubscription: async (id) => {
368
+ return await httpData(credentials, undefined, `${PATH_1_0_WEBHOOK}/${id}`, 'DELETE');
314
369
  },
315
370
  getFulfillmentCenters: async () => {
316
371
  return await httpGet(credentials, PATH_1_0_FULFILLMENT_CENTER);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,mEAAmE;AACnE,uCAA+B,CAAC,SAAS;AA8BzC,0CAAwB;AA8CxB,WAAW;AACX,MAAM,gBAAgB,GAAG,cAAc,CAAC;AACxC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AACxC,MAAM,gBAAgB,GAAG,cAAc,CAAC;AACxC,MAAM,yBAAyB,GAAG,uBAAuB,CAAC;AAE1D,SAAS;AACT,MAAM,cAAc,GAAG,YAAY,CAAC;AACpC,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AACtD;;GAEG;AACH,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAC5C;;GAEG;AACH,MAAM,2BAA2B,GAAG,yBAAyB,CAAC;AAC9D;;GAEG;AACH,MAAM,2BAA2B,GAAG,yBAAyB,CAAC;AAE9D,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAC5C,MAAM,2BAA2B,GAAG,wBAAwB,CAAC;AAC7D,MAAM,gBAAgB,GAAG,cAAc,CAAC;AACxC,MAA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OAAO,EAAE,GAAG,iBAAiB,WAAW,CAAC,CAAC;QACzG,CAAC;QACD;;;;;WAKG;QACH,mBAAmB,EAAE,KAAK,EAAE,YAAoB,EAAE,EAAE;YAClD,OAAO,MAAM,OAAO,CAAqB,WAAW,EAAE,GAAG,iBAAiB,WAAW,YAAY,EAAE,CAAC,CAAC;QACvG,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AA9cW,QAAA,gBAAgB,oBA8c3B"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * The oAuth files are separate. You would use them to make standalone calls.
3
+ * The `access_token` provided from these calls is provided to `createShipBobApi` with the App name (see tests for usage)
4
+ */
5
+ import { AuthorizeParametersAPI } from './types';
6
+ /**
7
+ * Step 1
8
+ * ------
9
+ * ShipBob’s current OAuth implementation utilizes the Authorization Code Flow, which requires user interaction for authentication.
10
+ * This design supports applications where end-users are expected to log in and authorize access.
11
+ *
12
+ * ShipBob doesn't support Client Credentials Flow, which allows server-to-server (S2S) authentication using only the client_id and client_secret.
13
+ * However, ShipBob does not currently support this flow.
14
+ *
15
+ * - Access tokens are valid for 1 hour.
16
+ * - Refresh tokens are valid for 30 days if not used.
17
+ *
18
+ * NOTE: that's why this method return a URL. It's where you will send an end-user to authorize access.
19
+ * NOTE: make sure to request 'offline_access', if you want the refresh token.
20
+ * NOTE: the authorization code provided is good only for 2 minutes
21
+ *
22
+ * @param query
23
+ * @param options
24
+ * @returns
25
+ */
26
+ export declare const oAuthGetConnectUrl: (query: AuthorizeParametersAPI) => string;
27
+ export type ConnectToken = {
28
+ /**
29
+ * What is this for?
30
+ */
31
+ id_token: string;
32
+ /**
33
+ * To access the API
34
+ */
35
+ access_token: string;
36
+ expires_in: 3600;
37
+ token_type: 'Bearer';
38
+ /**
39
+ * Use this to refresh your token (good for 30 days)
40
+ *
41
+ * NOTE: this is only supplied if you have requested the scope "offline_access"
42
+ */
43
+ refresh_token?: string;
44
+ /**
45
+ * space separated list of scopes that were approved by end user
46
+ */
47
+ scope: string;
48
+ } | {
49
+ /**
50
+ * ie: 'invalid_grant'
51
+ */
52
+ error: string;
53
+ };
54
+ export type ConnectTokenResponse = {
55
+ /**
56
+ * Don't let this mislead you. Still check the payload for 'error' (just means the request succeeded).
57
+ */
58
+ success: true;
59
+ payload: ConnectToken;
60
+ } | {
61
+ success: false;
62
+ text: string;
63
+ };
64
+ /**
65
+ * Step 2
66
+ *
67
+ * @param redirectUri not sure why this is needed
68
+ * @param client_id from your ShipBob app
69
+ * @param client_secret from your ShipBob app (only available at time of creation)
70
+ * @param code provided in the callback from step 1
71
+ */
72
+ export declare const oAuthGetAccessToken: (redirectUri: string, clientId: string, clientSecret: string, code: string) => Promise<ConnectTokenResponse>;
73
+ /**
74
+ * Step 3+
75
+ * -------
76
+ *
77
+ * 1) User first authenticates `oAuthGetAccessToken`
78
+ * - access token: ABC
79
+ * - refresh token: 123
80
+ * 2) Refresh token: use refresh token 123 to request new token
81
+ * - access token: DEF
82
+ * - refresh token: 456
83
+ * 3) Refresh token: use refresh token 456 to request new tokens
84
+ * - access token: GHI
85
+ * - refresh token: 789
86
+ *
87
+ * @param redirectUri not sure why this is needed
88
+ * @param clientId from your ShipBob app
89
+ * @param clientSecret from your ShipBob app (only available at time of creation)
90
+ * @param refreshToken token provided from last authorization
91
+ * @returns
92
+ */
93
+ export declare const oAuthRefreshAccessToken: (redirectUri: string, clientId: string, clientSecret: string, refreshToken: string) => Promise<ConnectTokenResponse>;
package/dist/oAuth.js ADDED
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.oAuthRefreshAccessToken = exports.oAuthGetAccessToken = exports.oAuthGetConnectUrl = void 0;
4
+ /**
5
+ * Step 1
6
+ * ------
7
+ * ShipBob’s current OAuth implementation utilizes the Authorization Code Flow, which requires user interaction for authentication.
8
+ * This design supports applications where end-users are expected to log in and authorize access.
9
+ *
10
+ * ShipBob doesn't support Client Credentials Flow, which allows server-to-server (S2S) authentication using only the client_id and client_secret.
11
+ * However, ShipBob does not currently support this flow.
12
+ *
13
+ * - Access tokens are valid for 1 hour.
14
+ * - Refresh tokens are valid for 30 days if not used.
15
+ *
16
+ * NOTE: that's why this method return a URL. It's where you will send an end-user to authorize access.
17
+ * NOTE: make sure to request 'offline_access', if you want the refresh token.
18
+ * NOTE: the authorization code provided is good only for 2 minutes
19
+ *
20
+ * @param query
21
+ * @param options
22
+ * @returns
23
+ */
24
+ const oAuthGetConnectUrl = (query /* | AuthorizeParametersWeb */) => {
25
+ const url = new URL('https://auth.shipbob.com/connect/authorize');
26
+ if (query.client_id === undefined) {
27
+ throw new Error('You must have at least a client_id to authorize oAuth');
28
+ }
29
+ for (const param of Object.keys(query)) {
30
+ // the number[] is probably wrong
31
+ const authParam = param;
32
+ if (query[authParam] === undefined) {
33
+ continue;
34
+ }
35
+ const val = authParam === 'scope' // Array.isArray(...)
36
+ ? query[authParam].join(' ')
37
+ : // : typeof query[authParam] === 'string' ? query[authParam] : query[authParam].toString();
38
+ query[authParam];
39
+ url.searchParams.set(param, val);
40
+ }
41
+ // ie: put a breakpoint here and copy(url.href)
42
+ return url.href;
43
+ };
44
+ exports.oAuthGetConnectUrl = oAuthGetConnectUrl;
45
+ /**
46
+ * Step 2
47
+ *
48
+ * @param redirectUri not sure why this is needed
49
+ * @param client_id from your ShipBob app
50
+ * @param client_secret from your ShipBob app (only available at time of creation)
51
+ * @param code provided in the callback from step 1
52
+ */
53
+ const oAuthGetAccessToken = async (redirectUri, clientId, clientSecret, code) => {
54
+ const response = await fetch('https://auth.shipbob.com/connect/token', {
55
+ method: 'POST',
56
+ headers: {
57
+ 'content-type': 'application/x-www-form-urlencoded',
58
+ },
59
+ body: new URLSearchParams({
60
+ redirect_uri: redirectUri,
61
+ client_id: clientId,
62
+ client_secret: clientSecret,
63
+ code,
64
+ grant_type: 'authorization_code',
65
+ }),
66
+ });
67
+ const contentType = response.headers.get('content-type');
68
+ if (contentType?.startsWith('application/json')) {
69
+ return {
70
+ success: true,
71
+ payload: (await response.json()),
72
+ };
73
+ }
74
+ else {
75
+ return {
76
+ success: false,
77
+ text: await response.text(),
78
+ };
79
+ }
80
+ };
81
+ exports.oAuthGetAccessToken = oAuthGetAccessToken;
82
+ /**
83
+ * Step 3+
84
+ * -------
85
+ *
86
+ * 1) User first authenticates `oAuthGetAccessToken`
87
+ * - access token: ABC
88
+ * - refresh token: 123
89
+ * 2) Refresh token: use refresh token 123 to request new token
90
+ * - access token: DEF
91
+ * - refresh token: 456
92
+ * 3) Refresh token: use refresh token 456 to request new tokens
93
+ * - access token: GHI
94
+ * - refresh token: 789
95
+ *
96
+ * @param redirectUri not sure why this is needed
97
+ * @param clientId from your ShipBob app
98
+ * @param clientSecret from your ShipBob app (only available at time of creation)
99
+ * @param refreshToken token provided from last authorization
100
+ * @returns
101
+ */
102
+ const oAuthRefreshAccessToken = async (redirectUri, clientId, clientSecret, refreshToken) => {
103
+ const response = await fetch('https://auth.shipbob.com/connect/token', {
104
+ method: 'POST',
105
+ headers: {
106
+ 'content-type': 'application/x-www-form-urlencoded',
107
+ },
108
+ body: new URLSearchParams({
109
+ redirect_uri: redirectUri,
110
+ client_id: clientId,
111
+ client_secret: clientSecret,
112
+ refresh_token: refreshToken,
113
+ grant_type: 'refresh_token',
114
+ }),
115
+ });
116
+ const contentType = response.headers.get('content-type');
117
+ if (contentType?.startsWith('application/json')) {
118
+ return {
119
+ success: true,
120
+ payload: (await response.json()),
121
+ };
122
+ }
123
+ else {
124
+ return {
125
+ success: false,
126
+ text: await response.text(),
127
+ };
128
+ }
129
+ };
130
+ exports.oAuthRefreshAccessToken = oAuthRefreshAccessToken;
131
+ //# sourceMappingURL=oAuth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oAuth.js","sourceRoot":"","sources":["../src/oAuth.ts"],"names":[],"mappings":";;;AAMA;;;;;;;;;;;;;;;;;;;GAmBG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAA6B,CAAC,8BAA8B,EAAE,EAAE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CAAC;AAhCW,QAAA,uBAAuB,2BAgClC"}
package/dist/types.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import type { Nullable } from '.';
2
- export type ChannelsResponse = {
2
+ export type Channel = {
3
3
  id: number;
4
4
  name: string;
5
5
  application_name: string;
6
6
  scopes: string[];
7
- }[];
7
+ };
8
8
  export type Address = {
9
9
  /**
10
10
  * First line of the address
@@ -1259,6 +1259,11 @@ export type ListInventoryQueryStrings = {
1259
1259
  Limit: number;
1260
1260
  IsActive: boolean;
1261
1261
  IsDigital: boolean;
1262
+ /**
1263
+ * ShipBob recommends sending only 150/request
1264
+ *
1265
+ * NOTE: if you pass ie: 250 IDs then you will get 404s from shipbob.
1266
+ */
1262
1267
  IDs: number[];
1263
1268
  /**
1264
1269
  * Sort will default to ascending order for each field. To sort in descending order please pass a "-" in front of the field name. For example, Sort=-onHand,name will sort by onHand descending
@@ -1432,3 +1437,66 @@ export type WebhookResponsesByTopic = {
1432
1437
  status: 'Cancelled';
1433
1438
  };
1434
1439
  };
1440
+ /**
1441
+ * OAuth types here
1442
+ */
1443
+ export type CreateOptions = {
1444
+ /**
1445
+ * console.log HTTP traffic (http verb + endpoint)
1446
+ */
1447
+ logTraffic?: boolean;
1448
+ /**
1449
+ * Setup if the API sends the channel. You can alter/check this on the API object after API builder creation.
1450
+ */
1451
+ sendChannelId?: boolean;
1452
+ };
1453
+ export type AuthScopesWeb = 'openid' | 'profile' | 'email' | 'read' | 'write' | 'offline_access' | 'inboundManagement_read' | 'fulfillments_read' | 'orders_read' | 'orders_write' | 'orderstateapi_read' | 'receiving_read' | 'receiving_write' | 'returns_read' | 'returns_write' | 'addressValidation' | 'labeling_read' | 'shipment_tracking_read' | 'labeling_write' | 'inventory_read' | 'inventory_write' | 'channels_read' | 'locations_read' | 'locations_write' | 'workOrders_read' | 'workOrders_write' | 'powerBIconfig_read' | 'products_read' | 'pricing_read' | 'fulfillment_customization_write' | 'fulfillment_customization_read' | 'cartbob_write' | 'cartbob_read' | 'onboarding_read' | 'onboarding_write' | 'inventoryallocation_read' | 'internal_integrations_read' | 'internal_integrations_write' | 'internal_fulfillments_write' | 'fba_read' | 'fba_write' | 'pricing_write' | 'token_management' | 'products_write' | 'b2bpacking_read' | 'b2bpacking_write' | 'membership_read' | 'membership_write' | 'useraccounts_read' | 'useraccounts_write' | 'shippingservice_read' | 'inventory_views_read' | 'inventory_views_write';
1454
+ /**
1455
+ * These are the scopes granted by generated OAuth clients
1456
+ */
1457
+ export type AuthScopesAPI = 'orders_read' | 'orders_write' | 'products_read' | 'products_write' | 'fulfillments_read' | 'inventory_read' | 'channels_read' | 'receiving_read' | 'receiving_write' | 'returns_read' | 'returns_write' | 'webhooks_read' | 'webhooks_write' | 'locations_read' | 'offline_access';
1458
+ export type AuthorizeParametersCommon<T extends AuthScopesWeb | AuthScopesAPI> = {
1459
+ /**
1460
+ * Client id provided by site registration.
1461
+ */
1462
+ client_id: string;
1463
+ /**
1464
+ * The callback URI ShipBob will call after the user responds to the request for consent. Must match one of the provided values from site registration
1465
+ *
1466
+ * Your application must implement a GET endpoint callback to understand the URI fragment parameters `error`, `state`, `code`, `scope`
1467
+ */
1468
+ redirect_uri: string;
1469
+ /**
1470
+ * One or more scopes granted by step 1, space-separated.
1471
+ *
1472
+ * NOTE: if you want to take advantage of refresh tokens (aka offline access mode) you must additionally request the “offline_access” scope.
1473
+ */
1474
+ scope: T[];
1475
+ /**
1476
+ * Application-provided string to help prevent replay attacks. Echoed back to the application in the callback for validation.
1477
+ */
1478
+ state?: string;
1479
+ };
1480
+ /**
1481
+ * NOTE: These parameters must be URL encoded, particularly redirect_uri
1482
+ */
1483
+ export type AuthorizeParametersAPI = {
1484
+ /**
1485
+ * If you include this query parameter with value form_post then we will make a POST request to your callback URL, instead of including the data as a fragment.
1486
+ */
1487
+ response_mode?: 'form_post';
1488
+ /**
1489
+ * A random string you can send and we will send it back within the token, to prevent replay attacks, code substitutions, etc.
1490
+ */
1491
+ nonce?: string;
1492
+ /**
1493
+ * Name of the integration for this particular user. We recommend that you know the user’s store name on your platform. If not provided, the user will be prompted to provide their name or choose one from a drop-down of options.
1494
+ */
1495
+ integration_name?: string;
1496
+ } & AuthorizeParametersCommon<AuthScopesAPI>;
1497
+ export type AuthorizeParametersWeb = {
1498
+ response_type?: 'code';
1499
+ code_challenge: string;
1500
+ code_challenge_method: 'S256';
1501
+ shipbob_response_mode?: 'query';
1502
+ } & AuthorizeParametersCommon<AuthScopesWeb>;
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AA+lCA,IAAY,oBAWX;AAXD,WAAY,oBAAoB;IAC9B,wBAAwB;IACxB,qFAAqB,CAAA;IACrB,qEAAW,CAAA;IACX,6EAAiB,CAAA;IACjB,iGAA2B,CAAA;IAC3B,qEAAa,CAAA;IACb,yEAAe,CAAA;IACf,2EAAgB,CAAA;IAChB,uLAAsE,CAAA;IACtE,iGAA2B,CAAA;AAC7B,CAAC,EAXW,oBAAoB,oCAApB,oBAAoB,QAW/B;AAED,IAAY,iBAWX;AAXD,WAAY,iBAAiB;IAC3B,uDAAS,CAAA;IACT,2EAAmB,CAAA;IACnB,uEAAiB,CAAA;IACjB,cAAc;IACd,uEAAiB,CAAA;IACjB,qEAAgB,CAAA;IAChB,iEAAc,CAAA;IACd,2FAA2B,CAAA;IAC3B,yFAA0B,CAAA;IAC1B,sFAAyB,CAAA;AAC3B,CAAC,EAXW,iBAAiB,iCAAjB,iBAAiB,QAW5B;AAED;;;;GAIG;AACH,IAAY,YAaX;AAbD,WAAY,YAAY;IACtB;;OAEG;IACH,qDAAW,CAAA;IACX;;OAEG;IACH,2DAAc,CAAA;IACd;;OAEG;IACH,qDAAW,CAAA;AACb,CAAC,EAbW,YAAY,4BAAZ,YAAY,QAavB;AA6TD;;;;GAIG;AACH,IAAY,YA8BX;AA9BD,WAAY,YAAY;IACtB;;;;OAIG;IACH,8CAA8B,CAAA;I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AAA;AAC1C,CAAC,EA9BW,YAAY,4BAAZ,YAAY,QA8BvB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shipbob-node-sdk",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "ShipBob API node SDK",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",