@shopify/shopify-api 6.0.0 → 6.0.2

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.
Files changed (79) hide show
  1. package/CHANGELOG.md +16 -2
  2. package/README.md +16 -47
  3. package/docs/reference/README.md +18 -0
  4. package/docs/reference/auth/README.md +14 -0
  5. package/docs/reference/billing/README.md +14 -0
  6. package/docs/reference/clients/README.md +12 -0
  7. package/docs/reference/session/README.md +11 -0
  8. package/docs/reference/utils/README.md +12 -0
  9. package/docs/reference/webhooks/README.md +13 -0
  10. package/lib/auth/decode-host.d.ts +2 -0
  11. package/lib/auth/decode-host.d.ts.map +1 -0
  12. package/lib/auth/decode-host.js +12 -0
  13. package/lib/auth/decode-host.js.map +1 -0
  14. package/lib/auth/get-embedded-app-url.d.ts.map +1 -1
  15. package/lib/auth/get-embedded-app-url.js +2 -5
  16. package/lib/auth/get-embedded-app-url.js.map +1 -1
  17. package/lib/auth/index.d.ts +1 -1
  18. package/lib/auth/oauth/oauth.d.ts +1 -1
  19. package/lib/auth/oauth/oauth.d.ts.map +1 -1
  20. package/lib/auth/oauth/oauth.js +26 -36
  21. package/lib/auth/oauth/oauth.js.map +1 -1
  22. package/lib/auth/oauth/types.d.ts +1 -1
  23. package/lib/auth/oauth/types.d.ts.map +1 -1
  24. package/lib/deprecated-v5-types.d.ts +59 -0
  25. package/lib/deprecated-v5-types.d.ts.map +1 -0
  26. package/lib/deprecated-v5-types.js +3 -0
  27. package/lib/deprecated-v5-types.js.map +1 -0
  28. package/lib/index.d.ts +2 -0
  29. package/lib/index.d.ts.map +1 -1
  30. package/lib/index.js +4 -1
  31. package/lib/index.js.map +1 -1
  32. package/lib/session/session.d.ts.map +1 -1
  33. package/lib/session/session.js +4 -0
  34. package/lib/session/session.js.map +1 -1
  35. package/lib/types.d.ts +3 -2
  36. package/lib/types.d.ts.map +1 -1
  37. package/lib/types.js +3 -2
  38. package/lib/types.js.map +1 -1
  39. package/lib/utils/shop-validator.d.ts +1 -1
  40. package/lib/utils/shop-validator.d.ts.map +1 -1
  41. package/lib/utils/shop-validator.js +9 -2
  42. package/lib/utils/shop-validator.js.map +1 -1
  43. package/lib/version.d.ts +1 -1
  44. package/lib/version.js +1 -1
  45. package/lib/webhooks/process.d.ts.map +1 -1
  46. package/lib/webhooks/process.js +45 -31
  47. package/lib/webhooks/process.js.map +1 -1
  48. package/lib/webhooks/types.d.ts +1 -1
  49. package/lib/webhooks/types.d.ts.map +1 -1
  50. package/lib/webhooks/types.js.map +1 -1
  51. package/package.json +1 -1
  52. package/rest/admin/2022-01/assigned_fulfillment_order.d.ts.map +1 -1
  53. package/rest/admin/2022-01/assigned_fulfillment_order.js +2 -2
  54. package/rest/admin/2022-01/assigned_fulfillment_order.js.map +1 -1
  55. package/rest/admin/2022-01/customer.d.ts +5 -1
  56. package/rest/admin/2022-01/customer.d.ts.map +1 -1
  57. package/rest/admin/2022-01/customer.js +5 -5
  58. package/rest/admin/2022-01/customer.js.map +1 -1
  59. package/rest/admin/2022-04/assigned_fulfillment_order.d.ts.map +1 -1
  60. package/rest/admin/2022-04/assigned_fulfillment_order.js +2 -2
  61. package/rest/admin/2022-04/assigned_fulfillment_order.js.map +1 -1
  62. package/rest/admin/2022-04/customer.d.ts +5 -1
  63. package/rest/admin/2022-04/customer.d.ts.map +1 -1
  64. package/rest/admin/2022-04/customer.js +5 -5
  65. package/rest/admin/2022-04/customer.js.map +1 -1
  66. package/rest/admin/2022-07/assigned_fulfillment_order.d.ts.map +1 -1
  67. package/rest/admin/2022-07/assigned_fulfillment_order.js +2 -2
  68. package/rest/admin/2022-07/assigned_fulfillment_order.js.map +1 -1
  69. package/rest/admin/2022-07/customer.d.ts +5 -1
  70. package/rest/admin/2022-07/customer.d.ts.map +1 -1
  71. package/rest/admin/2022-07/customer.js +5 -5
  72. package/rest/admin/2022-07/customer.js.map +1 -1
  73. package/rest/admin/2022-10/assigned_fulfillment_order.d.ts.map +1 -1
  74. package/rest/admin/2022-10/assigned_fulfillment_order.js +2 -2
  75. package/rest/admin/2022-10/assigned_fulfillment_order.js.map +1 -1
  76. package/rest/admin/2022-10/customer.d.ts +5 -1
  77. package/rest/admin/2022-10/customer.d.ts.map +1 -1
  78. package/rest/admin/2022-10/customer.js +5 -5
  79. package/rest/admin/2022-10/customer.js.map +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,20 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## [6.0.2] - 2022-12-08
11
+
12
+ - [Patch] Raise an `InvalidSession` if `Session.fromPropertyArray` receive an object that is not an array
13
+ - [Patch] Validate content of host parameter using sanitizeShop regex [#634](https://github.com/Shopify/shopify-api-js/pull/634)
14
+ - [Patch] Use the GraphQL format of webhook topics in the error message [#626](https://github.com/Shopify/shopify-api-js/pull/626)
15
+ - [Patch] Export deprecation notices for v5 main interface [#639](https://github.com/Shopify/shopify-api-js/pull/639)
16
+ - [Patch] Fixed an issue when parsing the response body in the AssignedFulfillmentOrder REST resource [#644](https://github.com/Shopify/shopify-api-js/pull/644)
17
+
18
+ ## [6.0.1] - 2022-12-08
19
+
20
+ - [Patch] Auto-detect session type in auth callback, deprecate `isOnline` argument [#628](https://github.com/Shopify/shopify-api-js/pull/628)
21
+ - [Patch] Removed callback URL path check from webhook processing [#629](https://github.com/Shopify/shopify-api-js/pull/629)
22
+ - [Patch] Pass api version to webhook handlers [#630](https://github.com/Shopify/shopify-api-js/pull/630)
23
+
10
24
  ## [6.0.0] - 2022-12-06
11
25
 
12
26
  - ⚠️ [Breaking] Major overhaul of `Shopify/shopify-api-node`, which is a complete breaking change across all surfaces of the library. See the [migration guide](./docs/migrating-to-v6.md) for instructions on how to update your app.
@@ -138,9 +152,9 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
138
152
 
139
153
  - Add a 5 second `clockTolerance` to fix `jwt not active` error [#227](https://github.com/Shopify/shopify-api-js/pull/227)
140
154
  - ⚠️ [Breaking] Change default for OAuth.beginAuth to online sessions [#203](https://github.com/Shopify/shopify-api-js/pull/203)
141
- - see [oauth.md](https://github.com/Shopify/shopify-api-js/blob/main/docs/usage/oauth.md) for updated docs
155
+ - see [oauth.md](./docs/guides/oauth.md) for updated docs
142
156
  - ⚠️ [Breaking] Return and delete session in `validateAuthCallback` [#217](https://github.com/Shopify/shopify-api-js/pull/217)
143
- - see [oauth.md](https://github.com/Shopify/shopify-api-js/blob/main/docs/usage/oauth.md) for updated usage
157
+ - see [oauth.md](./docs/guides/oauth.md) for updated usage
144
158
  - ⚠️ [Breaking] Extract `addHandler` and `getHandler` methods for webhooks out of `register` [#205](https://github.com/Shopify/shopify-api-js/pull/205)
145
159
  - ⚠️ [Breaking] Sessions no longer default to `false` for `isOnline` [#169](https://github.com/Shopify/shopify-api-js/pull/169)
146
160
  - Required `Session` arguments must be passed to the constructor [#169](https://github.com/Shopify/shopify-api-js/pull/169)
package/README.md CHANGED
@@ -63,7 +63,7 @@ Next, configure the library - you'll need some values in advance:
63
63
  - Your app's API secret from Partners dashboard
64
64
  - The [scopes](https://shopify.dev/api/usage/access-scopes) you need for your app
65
65
 
66
- Call `shopifyApi` to create your library object before setting up your app itself:
66
+ Call `shopifyApi` ([see reference](./docs/reference/shopifyApi.md)) to create your library object before setting up your app itself:
67
67
 
68
68
  ```ts
69
69
  import '@shopify/shopify-api/adapters/node';
@@ -85,59 +85,28 @@ const app = express();
85
85
  ### Next steps
86
86
 
87
87
  Once you configure your app, you can use this package to access the Shopify APIs.
88
- See the specific documentation in the [Features section](#features) for instructions on how to get API access tokens and use them to query the APIs.
88
+ See the [reference documentation](./docs/reference/README.md) for details on all the methods provided by this package.
89
+
90
+ See the specific documentation in the [Guides section](#guides) for high-level instructions on how to get API access tokens and use them to query the APIs.
89
91
 
90
92
  As a general rule, apps will want to interact with the Admin API to fetch / submit data to Shopify.
91
93
  To do that, apps will need to:
92
94
 
93
- 1. Create an Admin API access token by going through [the OAuth flow](docs/usage/oauth.md).
95
+ 1. Create an Admin API access token by going through [the OAuth flow](docs/guides/oauth.md).
94
96
  1. Set up its own endpoints to:
95
- 1. [Fetch the current session](docs/usage/oauth.md#using-sessions) created in the OAuth process.
96
- 1. Create a [REST](docs/usage/rest.md) or [GraphQL](docs/usage/graphql.md) API client.
97
+ 1. [Fetch the current session](docs/guides/oauth.md#using-sessions) created in the OAuth process.
98
+ 1. Create a [REST](docs/reference/clients/Rest.md) or [GraphQL](docs/reference/clients/Graphql.md) API client.
97
99
  1. Use the client to query the appropriate [Admin API](https://shopify.dev/api/admin).
98
100
 
99
- ### Configurations
100
-
101
- These are all the configuration values `shopifyApi` supports.
102
-
103
- | Value | Type | Required | Default | Description |
104
- | ------------------------------- | ------------------------ | :------: | :-------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
105
- | apiKey | `string` | Yes | - | API key from Partners Dashboard |
106
- | apiSecretKey | `string` | Yes | - | API secret from Partners Dashboard |
107
- | scopes | `string[] \| AuthScopes` | Yes | - | [App scopes](https://shopify.dev/api/usage/access-scopes) |
108
- | hostName | `string` | Yes | - | App host name in the format `my-host-name.com`. Do **not** include the scheme or leading or trailing slashes |
109
- | hostScheme | `"https" \| "http"` | No | `"https"` | The scheme for your app's public URL |
110
- | apiVersion | `ApiVersion` | No | `LATEST_API_VERSION` | API version your app will be querying. E.g. `ApiVersion.January20` |
111
- | isEmbeddedApp | `boolean` | No | `true` | Whether your app will run within the Shopify Admin |
112
- | isPrivateApp | `boolean` | No | `false` | Whether you are building a private app for a store |
113
- | userAgentPrefix | `string` | No | `undefined` | Any prefix you wish to include in the `User-Agent` for requests made by the library |
114
- | privateAppStorefrontAccessToken | `string` | No | `undefined` | Fixed Storefront API access token for private apps |
115
- | customShopDomains | `(RegExp \| string)[]` | No | `undefined` | Use this if you need to allow values other than `myshopify.com` |
116
- | billing | `BillingConfig` | No | `undefined` | Billing configurations. [See documentation](docs/usage/billing.md) for full description |
117
- | restResources | `ShopifyRestResources` | No | - | Mounts the given REST resources onto the object. Must use the same version as `apiVersion`. Learn more about [using REST resources](docs/usage/rest.md#using-rest-resources) |
118
- | logger | `{[key: string]: any}` | No | - | Tweaks the behaviour of the package's internal logging to make it easier to debug applications |
119
- | &nbsp;&nbsp;logger.log | `AsyncFunction` | No | `() => Promise<void>` | Async callback function used for logging, which takes in a `LogSeverity` value and a formatted `message`. Defaults to using `console` calls matching the severity parameter |
120
- | &nbsp;&nbsp;logger.level | `LogSeverity` | No | `LogSeverity.Info` | Minimum severity for which to trigger the log function |
121
- | &nbsp;&nbsp;logger.httpRequests | `boolean` | No | `false` | Whether to log **ALL** HTTP requests made by the package. Only works if `level` is `Debug` |
122
- | &nbsp;&nbsp;logger.timestamps | `boolean` | No | `false` | Whether to add the current timestamp to every log call |
123
-
124
- ## Features
125
-
126
- - [OAuth](docs/usage/oauth.md)
127
- - [Start endpoint](docs/usage/oauth.md#start-endpoint)
128
- - [Callback endpoint](docs/usage/oauth.md#callback-endpoint)
129
- - [Using sessions](docs/usage/oauth.md#using-sessions)
130
- - [Detecting scope changes](docs/usage/oauth.md#detecting-scope-changes)
131
- - [REST Admin API client](docs/usage/rest.md)
132
- - [Using REST resources](docs/usage/rest.md#using-rest-resources)
133
- - [GraphQL Admin API client](docs/usage/graphql.md)
134
- - [GraphqL Storefront API client](docs/usage/storefront.md)
135
- - [Webhooks](docs/usage/webhooks.md)
136
- - [Register a Webhook](docs/usage/webhooks.md#register-a-webhook)
137
- - [Process a Webhook](docs/usage/webhooks.md#process-a-webhook)
138
- - [Billing](docs/usage/billing.md)
139
- - [Adding custom runtimes](docs/usage/runtimes.md)
140
- - [Customizing logging configuration](docs/usage/logger.md)
101
+ ## Guides
102
+
103
+ - [Performing OAuth](docs/guides/oauth.md)
104
+ - [Storing sessions](docs/guides/session-storage.md)
105
+ - [Setting up webhooks](docs/guides/webhooks.md)
106
+ - [Using REST resources](docs/guides/rest-resources.md)
107
+ - [Configuring Billing](docs/guides/billing.md)
108
+ - [Adding custom runtimes](docs/guides/runtimes.md)
109
+ - [Customizing logging configuration](docs/guides/logger.md)
141
110
 
142
111
  ## Migrating to v6
143
112
 
@@ -0,0 +1,18 @@
1
+ # Library reference
2
+
3
+ This section of the documentation provides thorough details on the parameters and response formats for each of the main components exported by the library.
4
+
5
+ ## [shopifyApi](./shopifyApi.md)
6
+
7
+ | Property | Description |
8
+ | ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
9
+ | config | The options used to set up the object, containing the parameters of this function. |
10
+ | [auth](./auth/README.md) | Object containing functions to authenticate with Shopify APIs. |
11
+ | [clients](./clients/README.md) | Object containing clients to access Shopify APIs. |
12
+ | [session](./session/README.md) | Object containing functions to manage Shopify sessions. |
13
+ | [webhooks](./webhooks/README.md) | Object containing functions to configure and handle Shopify webhooks. |
14
+ | [billing](./billing/README.md) | Object containing functions to enable apps to bill merchants. |
15
+ | [utils](./utils/README.md) | Object containing general functions to help build apps. |
16
+ | [rest](../guides/rest-resources.md) | Object containing OO representations of the Admin REST API. See the [API reference documentation](https://shopify.dev/api/admin-rest) for details. |
17
+
18
+ [Back to main page](../../README.md)
@@ -0,0 +1,14 @@
1
+ # shopify.auth
2
+
3
+ This object contains functions used to authenticate apps, and redirect users to Shopify.
4
+
5
+ | Property | Description |
6
+ | ----------------------------------------------- | ------------------------------------------------------------------------------------------------- |
7
+ | [begin](./begin.md) | Redirect the user to Shopify to request authorization for the app. |
8
+ | [callback](./callback.md) | Receive Shopify's callback after the user approves the app installation. |
9
+ | [nonce](./nonce.md) | Generates a random string of characters to be used as the state value for OAuth. |
10
+ | [safeCompare](./safeCompare.md) | Compares two strings or arrays in a way that's safe against timing attacks. |
11
+ | [getEmbeddedAppUrl](./getEmbeddedAppUrl.md) | Builds a URL to redirect the user back to the right Shopify surface based on the current request. |
12
+ | [buildEmbeddedAppUrl](./buildEmbeddedAppUrl.md) | Constructs the appropriate Shopify URL to redirect to. |
13
+
14
+ [Back to shopifyApi](../shopifyApi.md)
@@ -0,0 +1,14 @@
1
+ # shopify.billing
2
+
3
+ This object contains functions used to create and check billing charges with Shopify, based on the plans defined in the [`billing`](../shopifyApi.md#billing) configuration.
4
+
5
+ Learn more about [how billing on Shopify works](https://shopify.dev/apps/billing).
6
+
7
+ > **Note**: this package uses the GraphQL Admin API to look for and/or request payments, which means an app must go through OAuth before it can charge merchants.
8
+
9
+ | Property | Description |
10
+ | ----------------------- | --------------------------------------------------------------- |
11
+ | [check](./check.md) | Checks if the current shop has paid for any of the given plans. |
12
+ | [request](./request.md) | Requests a new payment for the given payment plan. |
13
+
14
+ [Back to shopifyApi](../shopifyApi.md)
@@ -0,0 +1,12 @@
1
+ # shopify.clients
2
+
3
+ This object contains functions used to authenticate apps, and redirect users to Shopify.
4
+
5
+ | Property | Description |
6
+ | --------------------------------- | ---------------------------------------------------------------------------------------------------- |
7
+ | [Rest](./Rest.md) | Class that can interact with the [Shopify Admin REST API](https://shopify.dev/api/admin-rest). |
8
+ | [Graphql](./Graphql.md) | Class that can interact with the [Shopify Admin GraphQL API](https://shopify.dev/api/admin-graphql). |
9
+ | [Storefront](./Storefront.md) | Class that can interact with the [Shopify Storefront API](https://shopify.dev/api/storefront). |
10
+ | [graphqlProxy](./graphqlProxy.md) | Creates a proxy that forwards requests to the GraphQL API and returns the response from Shopify. |
11
+
12
+ [Back to shopifyApi](../shopifyApi.md)
@@ -0,0 +1,11 @@
1
+ # shopify.session
2
+
3
+ This object contains functions used to authenticate apps, and redirect users to Shopify.
4
+
5
+ | Property | Description |
6
+ | --------------------------------------------- | --------------------------------------------------------------------------------------------------- |
7
+ | [getCurrentId](./getCurrentId.md) | Extracts a Shopify session id for the current request when there is user interaction with the app. |
8
+ | [getOfflineId](./getOfflineId.md) | Builds the session id for the given shop, for background tasks that don't involve user interaction. |
9
+ | [decodeSessionToken](./decodeSessionToken.md) | Extracts and validates the session token JWT from App Bridge requests. |
10
+
11
+ [Back to shopifyApi](../shopifyApi.md)
@@ -0,0 +1,12 @@
1
+ # shopify.utils
2
+
3
+ This object contains generic helper functions that might simplify app code.
4
+
5
+ | Property | Description |
6
+ | ------------------------------------------- | ------------------------------------------------------------------------------------ |
7
+ | [sanitizeShop](./sanitizeShop.md) | Validates and sanitizes Shopify shop domains to make user input safer. |
8
+ | [sanitizeHost](./sanitizeHost.md) | Validates and sanitizes the `host` argument from Shopify for embedded apps. |
9
+ | [validateHmac](./validateHmac.md) | Validates the HMAC signature in requests from Shopify. |
10
+ | [versionCompatible](./versionCompatible.md) | Checks whether the given API version is compatible with the current library version. |
11
+
12
+ [Back to shopifyApi](../shopifyApi.md)
@@ -0,0 +1,13 @@
1
+ # shopify.webhooks
2
+
3
+ This object contains functions used to configure, register and process webhooks.
4
+
5
+ | Property | Description |
6
+ | ------------------------------------- | ------------------------------------------------------ |
7
+ | [addHandlers](./addHandlers.md) | Add handlers to the webhook registry. |
8
+ | [getTopicsAdded](./getTopicsAdded.md) | Fetch the topics that have been added to the registry. |
9
+ | [getHandlers](./getHandlers.md) | Get the configured handlers for the given topic. |
10
+ | [register](./register.md) | Register the configured handlers with Shopify. |
11
+ | [process](./process.md) | Validate and process a webhook request from Shopify. |
12
+
13
+ [Back to shopifyApi](../shopifyApi.md)
@@ -0,0 +1,2 @@
1
+ export declare function decodeHost(host: string): string;
2
+ //# sourceMappingURL=decode-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decode-host.d.ts","sourceRoot":"","sources":["decode-host.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM/C"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decodeHost = void 0;
4
+ function decodeHost(host) {
5
+ // eslint-disable-next-line no-warning-comments
6
+ // TODO Remove the Buffer.from call when dropping Node 14 support
7
+ return typeof atob === 'undefined'
8
+ ? Buffer.from(host, 'base64').toString()
9
+ : atob(host);
10
+ }
11
+ exports.decodeHost = decodeHost;
12
+ //# sourceMappingURL=decode-host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decode-host.js","sourceRoot":"","sources":["decode-host.ts"],"names":[],"mappings":";;;AAAA,SAAgB,UAAU,CAAC,IAAY;IACrC,+CAA+C;IAC/C,iEAAiE;IACjE,OAAO,OAAO,IAAI,KAAK,WAAW;QAChC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE;QACxC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC;AAND,gCAMC"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-embedded-app-url.d.ts","sourceRoot":"","sources":["get-embedded-app-url.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAI9C,OAAO,EAAC,uBAAuB,EAAC,MAAM,SAAS,CAAC;AAEhD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,wBACvB,uBAAuB,KAAG,QAAQ,MAAM,CAAC,CA0B1E;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,UAC3C,MAAM,KAAG,MAAM,CAY9B"}
1
+ {"version":3,"file":"get-embedded-app-url.d.ts","sourceRoot":"","sources":["get-embedded-app-url.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAK9C,OAAO,EAAC,uBAAuB,EAAC,MAAM,SAAS,CAAC;AAEhD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,wBACvB,uBAAuB,KAAG,QAAQ,MAAM,CAAC,CA0B1E;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,UAC3C,MAAM,KAAG,MAAM,CAM9B"}
@@ -5,6 +5,7 @@ var tslib_1 = require("tslib");
5
5
  var ShopifyErrors = tslib_1.__importStar(require("../error"));
6
6
  var http_1 = require("../../runtime/http");
7
7
  var shop_validator_1 = require("../utils/shop-validator");
8
+ var decode_host_1 = require("./decode-host");
8
9
  function getEmbeddedAppUrl(config) {
9
10
  var _this = this;
10
11
  return function (_a) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
@@ -35,11 +36,7 @@ exports.getEmbeddedAppUrl = getEmbeddedAppUrl;
35
36
  function buildEmbeddedAppUrl(config) {
36
37
  return function (host) {
37
38
  (0, shop_validator_1.sanitizeHost)(config)(host, true);
38
- // eslint-disable-next-line no-warning-comments
39
- // TODO Remove the Buffer.from call when dropping Node 14 support
40
- var decodedHost = typeof atob === 'undefined'
41
- ? Buffer.from(host, 'base64').toString()
42
- : atob(host);
39
+ var decodedHost = (0, decode_host_1.decodeHost)(host);
43
40
  return "https://".concat(decodedHost, "/apps/").concat(config.apiKey);
44
41
  };
45
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"get-embedded-app-url.js","sourceRoot":"","sources":["get-embedded-app-url.ts"],"names":[],"mappings":";;;;AAAA,8DAA0C;AAE1C,2CAA0D;AAC1D,0DAAqD;AAIrD,SAAgB,iBAAiB,CAAC,MAAuB;IAAzD,iBA2BC;IA1BC,OAAO,UAAO,EAAyC;;YAArC,WAAW,sBAAf,EAAgB,CAAD;;;wBACX,qBAAM,IAAA,6BAAsB,EAAC,WAAW,CAAC,EAAA;;oBAAnD,OAAO,GAAG,SAAyC;oBAEzD,IAAI,CAAC,OAAO,EAAE;wBACZ,MAAM,IAAI,aAAa,CAAC,uBAAuB,CAC7C,sDAAsD,CACvD,CAAC;qBACH;oBAED,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;wBAChB,MAAM,IAAI,aAAa,CAAC,mBAAmB,CACzC,gCAAgC,CACjC,CAAC;qBACH;oBAEK,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,kBAAW,OAAO,CAAC,OAAO,CAAC,IAAI,CAAE,CAAC,CAAC;oBAC9D,IAAI,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CA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CAAgC,CACjC,CAAC;qBACH;oBAEK,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,kBAAW,OAAO,CAAC,OAAO,CAAC,IAAI,CAAE,CAAC,CAAC;oBAC9D,IAAI,GAAG,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;oBAE1C,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;wBAC5B,MAAM,IAAI,aAAa,CAAC,mBAAmB,CACzC,iDAAiD,CAClD,CAAC;qBACH;oBAED,sBAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAC;;;SAC1C,CAAC;AACJ,CAAC;AA3BD,8CA2BC;AAED,SAAgB,mBAAmB,CAAC,MAAuB;IACzD,OAAO,UAAC,IAAY;QAClB,IAAA,6BAAY,EAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACjC,IAAM,WAAW,GAAG,IAAA,wBAAU,EAAC,IAAI,CAAC,CAAC;QAErC,OAAO,kBAAW,WAAW,mBAAS,MAAM,CAAC,MAAM,CAAE,CAAC;IACxD,CAAC,CAAC;AACJ,CAAC;AAPD,kDAOC"}
@@ -3,7 +3,7 @@ import { nonce } from './oauth/nonce';
3
3
  import { safeCompare } from './oauth/safe-compare';
4
4
  export declare function shopifyAuth(config: ConfigInterface): {
5
5
  begin: ({ shop, callbackPath, isOnline, ...adapterArgs }: import("./types").BeginParams) => Promise<any>;
6
- callback: <T = any>({ isOnline, ...adapterArgs }: import("./types").CallbackParams) => Promise<import("./oauth/oauth").CallbackResponse<T>>;
6
+ callback: <T = any>({ isOnline: isOnlineParam, ...adapterArgs }: import("./types").CallbackParams) => Promise<import("./oauth/oauth").CallbackResponse<T>>;
7
7
  nonce: typeof nonce;
8
8
  safeCompare: typeof safeCompare;
9
9
  getEmbeddedAppUrl: ({ ...adapterArgs }: import("./types").GetEmbeddedAppUrlParams) => Promise<string>;
@@ -7,5 +7,5 @@ export interface CallbackResponse<T = AdapterHeaders> {
7
7
  session: Session;
8
8
  }
9
9
  export declare function begin(config: ConfigInterface): ({ shop, callbackPath, isOnline, ...adapterArgs }: BeginParams) => Promise<AdapterResponse>;
10
- export declare function callback(config: ConfigInterface): <T = any>({ isOnline, ...adapterArgs }: CallbackParams) => Promise<CallbackResponse<T>>;
10
+ export declare function callback(config: ConfigInterface): <T = any>({ isOnline: isOnlineParam, ...adapterArgs }: CallbackParams) => Promise<CallbackResponse<T>>;
11
11
  //# sourceMappingURL=oauth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["oauth.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAIjD,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAI9C,OAAO,EAIL,eAAe,EACf,cAAc,EAGf,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAGL,WAAW,EACX,cAAc,EAKf,MAAM,SAAS,CAAC;AAIjB,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,cAAc;IAClD,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,KAAK,CAAC,MAAM,EAAE,eAAe,sDAMxC,WAAW,KAAG,QAAQ,eAAe,CAAC,CAkD1C;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,eAAe,2CAI3C,cAAc,kCA2FlB"}
1
+ {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["oauth.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAIjD,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAI9C,OAAO,EAIL,eAAe,EACf,cAAc,EAGf,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAGL,WAAW,EACX,cAAc,EAKf,MAAM,SAAS,CAAC;AAIjB,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,cAAc;IAClD,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,KAAK,CAAC,MAAM,EAAE,eAAe,sDAMxC,WAAW,KAAG,QAAQ,eAAe,CAAC,CAkD1C;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,eAAe,0DAI3C,cAAc,kCAyFlB"}
@@ -68,48 +68,46 @@ function begin(config) {
68
68
  exports.begin = begin;
69
69
  function callback(config) {
70
70
  return function callback(_a) {
71
- var isOnline = _a.isOnline, adapterArgs = tslib_1.__rest(_a, ["isOnline"]);
71
+ var isOnlineParam = _a.isOnline, adapterArgs = tslib_1.__rest(_a, ["isOnline"]);
72
72
  return tslib_1.__awaiter(this, void 0, void 0, function () {
73
- var request, query, shop, log, cookies, stateFromCookie, authQuery, body, postParams, cleanShop, HttpClient, client, postResponse, session;
73
+ var log, request, query, shop, cookies, stateFromCookie, authQuery, body, postParams, cleanShop, HttpClient, client, postResponse, session;
74
74
  var _b;
75
75
  return tslib_1.__generator(this, function (_c) {
76
76
  switch (_c.label) {
77
77
  case 0:
78
78
  throwIfPrivateApp(config.isPrivateApp, 'Cannot perform OAuth for private apps');
79
- return [4 /*yield*/, (0, http_1.abstractConvertRequest)(adapterArgs)];
79
+ log = (0, logger_1.logger)(config);
80
+ if (!(isOnlineParam !== undefined)) return [3 /*break*/, 2];
81
+ return [4 /*yield*/, log.deprecated('7.0.0', 'The isOnline param is no longer required for auth callback')];
80
82
  case 1:
83
+ _c.sent();
84
+ _c.label = 2;
85
+ case 2: return [4 /*yield*/, (0, http_1.abstractConvertRequest)(adapterArgs)];
86
+ case 3:
81
87
  request = _c.sent();
82
88
  query = new URL(request.url, "".concat(config.hostScheme, "://").concat(config.hostName)).searchParams;
83
89
  shop = query.get('shop');
84
- log = (0, logger_1.logger)(config);
85
- log.info('Completing OAuth', { shop: shop, isOnline: isOnline });
90
+ log.info('Completing OAuth', { shop: shop });
86
91
  cookies = new http_1.Cookies(request, {}, {
87
92
  keys: [config.apiSecretKey],
88
93
  secure: true,
89
94
  });
90
95
  return [4 /*yield*/, cookies.getAndVerify(types_2.STATE_COOKIE_NAME)];
91
- case 2:
96
+ case 4:
92
97
  stateFromCookie = _c.sent();
93
98
  cookies.deleteCookie(types_2.STATE_COOKIE_NAME);
94
99
  if (!stateFromCookie) {
95
- log.error('Could not find OAuth cookie', { shop: shop, isOnline: isOnline });
100
+ log.error('Could not find OAuth cookie', { shop: shop });
96
101
  throw new ShopifyErrors.CookieNotFound("Cannot complete OAuth process. Could not find an OAuth cookie for shop url: ".concat(shop));
97
102
  }
98
103
  authQuery = Object.fromEntries(query.entries());
99
104
  return [4 /*yield*/, validQuery({ config: config, query: authQuery, stateFromCookie: stateFromCookie })];
100
- case 3:
105
+ case 5:
101
106
  if (!(_c.sent())) {
102
- log.error('Invalid OAuth callback', {
103
- shop: shop,
104
- isOnline: isOnline,
105
- stateFromCookie: stateFromCookie,
106
- });
107
+ log.error('Invalid OAuth callback', { shop: shop, stateFromCookie: stateFromCookie });
107
108
  throw new ShopifyErrors.InvalidOAuthError('Invalid OAuth callback.');
108
109
  }
109
- log.debug('OAuth request is valid, requesting access token', {
110
- shop: shop,
111
- isOnline: isOnline,
112
- });
110
+ log.debug('OAuth request is valid, requesting access token', { shop: shop });
113
111
  body = {
114
112
  client_id: config.apiKey,
115
113
  client_secret: config.apiSecretKey,
@@ -124,29 +122,27 @@ function callback(config) {
124
122
  HttpClient = (0, http_client_1.httpClientClass)(config);
125
123
  client = new HttpClient({ domain: cleanShop });
126
124
  return [4 /*yield*/, client.post(postParams)];
127
- case 4:
125
+ case 6:
128
126
  postResponse = _c.sent();
129
- log.info('Received access token, creating session', { shop: shop, isOnline: isOnline });
130
127
  session = createSession({
131
128
  postResponse: postResponse,
132
129
  shop: cleanShop,
133
130
  stateFromCookie: stateFromCookie,
134
- isOnline: isOnline,
135
131
  config: config,
136
132
  });
137
- if (!!config.isEmbeddedApp) return [3 /*break*/, 6];
133
+ if (!!config.isEmbeddedApp) return [3 /*break*/, 8];
138
134
  return [4 /*yield*/, cookies.setAndSign(types_2.SESSION_COOKIE_NAME, session.id, {
139
135
  expires: session.expires,
140
136
  sameSite: 'lax',
141
137
  secure: true,
142
138
  })];
143
- case 5:
139
+ case 7:
144
140
  _c.sent();
145
- _c.label = 6;
146
- case 6:
141
+ _c.label = 8;
142
+ case 8:
147
143
  _b = {};
148
144
  return [4 /*yield*/, (0, http_1.abstractConvertHeaders)(cookies.response.headers, adapterArgs)];
149
- case 7: return [2 /*return*/, (_b.headers = (_c.sent()),
145
+ case 9: return [2 /*return*/, (_b.headers = (_c.sent()),
150
146
  _b.session = session,
151
147
  _b)];
152
148
  }
@@ -168,17 +164,11 @@ function validQuery(_a) {
168
164
  });
169
165
  }
170
166
  function createSession(_a) {
171
- var config = _a.config, postResponse = _a.postResponse, shop = _a.shop, stateFromCookie = _a.stateFromCookie, isOnline = _a.isOnline;
172
- if (!isOnline &&
173
- postResponse.body.associated_user) {
174
- throw new ShopifyErrors.InvalidOAuthError('Attempted to complete offline OAuth flow, but received an online token response. This is likely because ' +
175
- "you're not setting the isOnline parameter consistently between begin() and callback()");
176
- }
177
- if (isOnline &&
178
- !postResponse.body.associated_user) {
179
- throw new ShopifyErrors.InvalidOAuthError('Attempted to complete online OAuth flow, but received an offline token response. This is likely because ' +
180
- "you're not setting the isOnline parameter consistently between begin() and callback()");
181
- }
167
+ var config = _a.config, postResponse = _a.postResponse, shop = _a.shop, stateFromCookie = _a.stateFromCookie;
168
+ var associatedUser = postResponse.body
169
+ .associated_user;
170
+ var isOnline = Boolean(associatedUser);
171
+ (0, logger_1.logger)(config).info('Creating new session', { shop: shop, isOnline: isOnline });
182
172
  if (isOnline) {
183
173
  var sessionId = void 0;
184
174
  var responseBody = postResponse.body;
@@ -1 +1 @@
1
- {"version":3,"file":"oauth.js","sourceRoot":"","sources":["oauth.ts"],"names":[],"mappings":";;;;AAAA,6BAAk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AK,EAAE,eAAe;YACtB,QAAQ,UAAA;YACR,WAAW,EAAE,YAAY;YACzB,KAAK,OAAA;YACL,OAAO,EAAE,iBAAiB;YAC1B,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;KACJ;SAAM;QACL,IAAM,YAAY,GAAG,YAAY,CAAC,IAA2B,CAAC;QAC9D,OAAO,IAAI,iBAAO,CAAC;YACjB,EAAE,EAAE,IAAA,4BAAY,EAAC,MAAM,CAAC,CAAC,IAAI,CAAC;YAC9B,IAAI,MAAA;YACJ,KAAK,EAAE,eAAe;YACtB,QAAQ,UAAA;YACR,WAAW,EAAE,YAAY,CAAC,YAAY;YACtC,KAAK,EAAE,YAAY,CAAC,KAAK;SAC1B,CAAC,CAAC;KACJ;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,YAAqB,EAAE,OAAe;IAC/D,IAAI,YAAY,EAAE;QAChB,MAAM,IAAI,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;KAClD;AACH,CAAC"}
@@ -11,7 +11,7 @@ export interface BeginParams extends AdapterArgs {
11
11
  isOnline: boolean;
12
12
  }
13
13
  export interface CallbackParams extends AdapterArgs {
14
- isOnline: boolean;
14
+ isOnline?: boolean;
15
15
  }
16
16
  export interface AccessTokenResponse {
17
17
  access_token: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,6BAA6B,CAAC;AAExD,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AACzD,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,MAAM,WAAW,SAAS;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAY,SAAQ,WAAW;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;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M,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE;QACf,EAAE,EAAE,MAAM,CAAC;QACX,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,cAAc,EAAE,OAAO,CAAC;QACxB,aAAa,EAAE,OAAO,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,EAAE,OAAO,CAAC;KACvB,CAAC;CACH;AAED,MAAM,WAAW,oBACf,SAAQ,mBAAmB,EACzB,gBAAgB;CAAG"}
@@ -0,0 +1,59 @@
1
+ export interface DeprecatedV5Types {
2
+ /**
3
+ * @deprecated
4
+ * `Shopify.Context` is now `Shopify.config` and its API has changed.
5
+ *
6
+ * @see https://github.com/Shopify/shopify-api-js/blob/main/docs/migrating-to-v6.md
7
+ */
8
+ Context?: never;
9
+ /**
10
+ * @deprecated
11
+ * `Shopify.Auth` is now `Shopify.auth` and its API has changed.
12
+ *
13
+ * @see https://github.com/Shopify/shopify-api-js/blob/main/docs/migrating-to-v6.md#changes-to-authentication-functions
14
+ */
15
+ Auth?: never;
16
+ /**
17
+ * @deprecated
18
+ * `Shopify.Billing` is now `Shopify.billing` and its API has changed.
19
+ *
20
+ * @see https://github.com/Shopify/shopify-api-js/blob/main/docs/migrating-to-v6.md#billing
21
+ */
22
+ Billing?: never;
23
+ /**
24
+ * @deprecated
25
+ * `Shopify.Session` is now `Shopify.session` and its API has changed.
26
+ *
27
+ * @see https://github.com/Shopify/shopify-api-js/blob/main/docs/migrating-to-v6.md#changes-to-session-and-sessionstorage
28
+ */
29
+ Session?: never;
30
+ /**
31
+ * @deprecated
32
+ * `Shopify.Clients` is now `Shopify.clients` and its API has changed.
33
+ *
34
+ * @see https://github.com/Shopify/shopify-api-js/blob/main/docs/migrating-to-v6.md#changes-to-api-clients
35
+ */
36
+ Clients?: never;
37
+ /**
38
+ * @deprecated
39
+ * `Shopify.Utils` is now `Shopify.utils` and its API has changed.
40
+ *
41
+ * @see https://github.com/Shopify/shopify-api-js/blob/main/docs/migrating-to-v6.md#utility-functions
42
+ */
43
+ Utils?: never;
44
+ /**
45
+ * @deprecated
46
+ * `Shopify.Webhooks` is now `Shopify.webhooks` and its API has changed.
47
+ *
48
+ * @see https://github.com/Shopify/shopify-api-js/blob/main/docs/migrating-to-v6.md#changes-to-webhook-functions
49
+ */
50
+ Webhooks?: never;
51
+ /**
52
+ * @deprecated
53
+ * `Shopify.Errors` was deprecated, error classes are now exported directly from the package.
54
+ *
55
+ * @see https://github.com/Shopify/shopify-api-js/blob/main/docs/migrating-to-v6.md#simplified-namespace-for-errors
56
+ */
57
+ Errors?: never;
58
+ }
59
+ //# sourceMappingURL=deprecated-v5-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecated-v5-types.d.ts","sourceRoot":"","sources":["deprecated-v5-types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC;IAEhB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC;IAEb;;;;;OAKG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC;IAEhB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC;IAEhB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC;IAEhB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC;IAEjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=deprecated-v5-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deprecated-v5-types.js","sourceRoot":"","sources":["deprecated-v5-types.ts"],"names":[],"mappings":""}
package/lib/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ShopifyRestResources } from '../rest/types';
2
+ import { DeprecatedV5Types } from './deprecated-v5-types';
2
3
  import { ConfigParams, ConfigInterface } from './base-types';
3
4
  import { ShopifyClients } from './clients';
4
5
  import { ShopifyAuth } from './auth';
@@ -15,6 +16,7 @@ export * from './base-types';
15
16
  export * from './session/types';
16
17
  export * from './auth/types';
17
18
  export * from './webhooks/types';
19
+ export declare const Shopify: DeprecatedV5Types;
18
20
  export interface Shopify<T extends ShopifyRestResources = ShopifyRestResources> {
19
21
  config: ConfigInterface;
20
22
  clients: ShopifyClients;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAC,YAAY,EAAE,eAAe,EAAC,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAgB,cAAc,EAAC,MAAM,WAAW,CAAC;AACxD,OAAO,EAAc,WAAW,EAAC,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAiB,cAAc,EAAC,MAAM,WAAW,CAAC;AACzD,OAAO,EAAe,YAAY,EAAC,MAAM,SAAS,CAAC;AACnD,OAAO,EAAkB,eAAe,EAAC,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAiB,cAAc,EAAC,MAAM,WAAW,CAAC;AACzD,OAAO,EAAS,aAAa,EAAC,MAAM,UAAU,CAAC;AAE/C,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAElC,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AAEjC,MAAM,WAAW,OAAO,CACtB,CAAC,SAA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EAAE,iBAAsB,CAAC;AAE7C,MAAM,WAAW,OAAO,CACtB,CAAC,SAAS,oBAAoB,GAAG,oBAAoB;IAErD,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,EAAE,cAAc,CAAC;IACxB,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,cAAc,CAAC;IACxB,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,EAAE,CAAC,CAAC;CACT;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,oBAAoB,EACvD,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,GACtB,OAAO,CAAC,CAAC,CAAC,CAyBZ"}
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shopifyApi = void 0;
3
+ exports.shopifyApi = exports.Shopify = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var load_rest_resources_1 = require("../rest/load-rest-resources");
6
6
  var config_1 = require("./config");
@@ -19,6 +19,9 @@ tslib_1.__exportStar(require("./base-types"), exports);
19
19
  tslib_1.__exportStar(require("./session/types"), exports);
20
20
  tslib_1.__exportStar(require("./auth/types"), exports);
21
21
  tslib_1.__exportStar(require("./webhooks/types"), exports);
22
+ // Temporarily export the deprecated v5 types as a Shopify object (as opposed to the type above) to help folks find
23
+ // the migration guide.
24
+ exports.Shopify = {};
22
25
  function shopifyApi(config) {
23
26
  var restResources = config.restResources, libConfig = tslib_1.__rest(config, ["restResources"]);
24
27
  var validatedConfig = (0, config_1.validateConfig)(libConfig);