@shopify/shopify-api 6.0.0-rc9 → 6.0.0
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/CHANGELOG.md +78 -70
- package/README.md +1 -0
- package/adapters/__e2etests__/test_apps/test-cf-worker-app.js +1 -1
- package/adapters/__e2etests__/test_apps/test-cf-worker-app.js.map +1 -1
- package/adapters/__e2etests__/test_apps/test-node-app.js +1 -1
- package/adapters/__e2etests__/test_apps/test-node-app.js.map +1 -1
- package/lib/auth/get-embedded-app-url.d.ts +2 -2
- package/lib/auth/get-embedded-app-url.d.ts.map +1 -1
- package/lib/auth/get-embedded-app-url.js +7 -7
- package/lib/auth/get-embedded-app-url.js.map +1 -1
- package/lib/auth/index.d.ts.map +1 -1
- package/lib/auth/index.js +4 -4
- package/lib/auth/index.js.map +1 -1
- package/lib/auth/oauth/oauth.d.ts +2 -2
- package/lib/auth/oauth/oauth.d.ts.map +1 -1
- package/lib/auth/oauth/oauth.js +11 -11
- package/lib/auth/oauth/oauth.js.map +1 -1
- package/lib/base-types.d.ts +0 -1
- package/lib/base-types.d.ts.map +1 -1
- package/lib/billing/check.d.ts +1 -1
- package/lib/billing/check.d.ts.map +1 -1
- package/lib/billing/check.js +4 -4
- package/lib/billing/check.js.map +1 -1
- package/lib/billing/index.js +2 -2
- package/lib/billing/index.js.map +1 -1
- package/lib/billing/request.d.ts +1 -1
- package/lib/billing/request.d.ts.map +1 -1
- package/lib/billing/request.js +84 -25
- package/lib/billing/request.js.map +1 -1
- package/lib/billing/types.d.ts +7 -1
- package/lib/billing/types.d.ts.map +1 -1
- package/lib/clients/graphql/graphql_client.d.ts +2 -2
- package/lib/clients/graphql/graphql_client.d.ts.map +1 -1
- package/lib/clients/graphql/graphql_client.js +4 -4
- package/lib/clients/graphql/graphql_client.js.map +1 -1
- package/lib/clients/graphql/graphql_proxy.d.ts +1 -1
- package/lib/clients/graphql/graphql_proxy.d.ts.map +1 -1
- package/lib/clients/graphql/graphql_proxy.js +4 -4
- package/lib/clients/graphql/graphql_proxy.js.map +1 -1
- package/lib/clients/graphql/storefront_client.d.ts +2 -2
- package/lib/clients/graphql/storefront_client.d.ts.map +1 -1
- package/lib/clients/graphql/storefront_client.js +4 -4
- package/lib/clients/graphql/storefront_client.js.map +1 -1
- package/lib/clients/http_client/http_client.d.ts +1 -1
- package/lib/clients/http_client/http_client.d.ts.map +1 -1
- package/lib/clients/http_client/http_client.js +3 -3
- package/lib/clients/http_client/http_client.js.map +1 -1
- package/lib/clients/index.d.ts +2 -2
- package/lib/clients/index.d.ts.map +1 -1
- package/lib/clients/index.js +8 -8
- package/lib/clients/index.js.map +1 -1
- package/lib/clients/rest/rest_client.d.ts +2 -2
- package/lib/clients/rest/rest_client.d.ts.map +1 -1
- package/lib/clients/rest/rest_client.js +3 -3
- package/lib/clients/rest/rest_client.js.map +1 -1
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +1 -0
- package/lib/config.js.map +1 -1
- package/lib/error.d.ts +2 -0
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js +9 -1
- package/lib/error.js.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/logger/index.d.ts +3 -1
- package/lib/logger/index.d.ts.map +1 -1
- package/lib/logger/index.js +22 -6
- package/lib/logger/index.js.map +1 -1
- package/lib/logger/log.d.ts +1 -1
- package/lib/logger/log.d.ts.map +1 -1
- package/lib/logger/log.js +3 -3
- package/lib/logger/log.js.map +1 -1
- package/lib/session/decode-session-token.d.ts +1 -1
- package/lib/session/decode-session-token.d.ts.map +1 -1
- package/lib/session/decode-session-token.js +3 -3
- package/lib/session/decode-session-token.js.map +1 -1
- package/lib/session/index.js +3 -3
- package/lib/session/index.js.map +1 -1
- package/lib/session/session-utils.d.ts +3 -3
- package/lib/session/session-utils.d.ts.map +1 -1
- package/lib/session/session-utils.js +12 -12
- package/lib/session/session-utils.js.map +1 -1
- package/lib/session/session.d.ts +2 -2
- package/lib/session/session.d.ts.map +1 -1
- package/lib/session/session.js +2 -5
- package/lib/session/session.js.map +1 -1
- package/lib/setup-jest.d.ts.map +1 -1
- package/lib/setup-jest.js +11 -0
- package/lib/setup-jest.js.map +1 -1
- package/lib/types.d.ts +4 -2
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -1
- package/lib/utils/hmac-validator.d.ts +2 -2
- package/lib/utils/hmac-validator.d.ts.map +1 -1
- package/lib/utils/hmac-validator.js +6 -6
- package/lib/utils/hmac-validator.js.map +1 -1
- package/lib/utils/index.js +4 -4
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/shop-validator.d.ts +2 -2
- package/lib/utils/shop-validator.d.ts.map +1 -1
- package/lib/utils/shop-validator.js +5 -5
- package/lib/utils/shop-validator.js.map +1 -1
- package/lib/utils/version-compatible.d.ts +1 -1
- package/lib/utils/version-compatible.d.ts.map +1 -1
- package/lib/utils/version-compatible.js +3 -3
- package/lib/utils/version-compatible.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.d.ts.map +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/lib/webhooks/index.d.ts.map +1 -1
- package/lib/webhooks/index.js +6 -6
- package/lib/webhooks/index.js.map +1 -1
- package/lib/webhooks/process.d.ts +1 -1
- package/lib/webhooks/process.d.ts.map +1 -1
- package/lib/webhooks/process.js +20 -13
- package/lib/webhooks/process.js.map +1 -1
- package/lib/webhooks/register.d.ts +1 -1
- package/lib/webhooks/register.d.ts.map +1 -1
- package/lib/webhooks/register.js +7 -7
- package/lib/webhooks/register.js.map +1 -1
- package/lib/webhooks/registry.d.ts +4 -4
- package/lib/webhooks/registry.d.ts.map +1 -1
- package/lib/webhooks/registry.js +9 -9
- package/lib/webhooks/registry.js.map +1 -1
- package/lib/webhooks/types.d.ts +1 -1
- package/lib/webhooks/types.d.ts.map +1 -1
- package/lib/webhooks/types.js.map +1 -1
- package/package.json +14 -10
package/CHANGELOG.md
CHANGED
|
@@ -7,46 +7,54 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
|
7
7
|
|
|
8
8
|
## Unreleased
|
|
9
9
|
|
|
10
|
-
## [6.0.0
|
|
10
|
+
## [6.0.0] - 2022-12-06
|
|
11
11
|
|
|
12
|
-
- ⚠️ [Breaking]
|
|
12
|
+
- ⚠️ [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.
|
|
13
|
+
|
|
14
|
+
## [5.3.0] - 2022-12-05
|
|
15
|
+
|
|
16
|
+
- [Minor] Pass webhook id to handlers [#606](https://github.com/Shopify/shopify-api-js/pull/606)
|
|
17
|
+
|
|
18
|
+
## [5.2.0] - 2022-10-04
|
|
19
|
+
|
|
20
|
+
- Added support for the `2022-10` API version [#535](https://github.com/Shopify/shopify-api-js/pull/535)
|
|
13
21
|
|
|
14
22
|
## [5.1.0] - 2022-09-19
|
|
15
23
|
|
|
16
|
-
- Increased tolerance for expired JWT session tokens from 5s to 10s [#462](https://github.com/Shopify/shopify-api-
|
|
17
|
-
- Add support for billing to the library [#449](https://github.com/Shopify/shopify-api-
|
|
18
|
-
- Allow dynamically typing the body of REST and GraphQL request responses, so callers don't need to cast it [#447](https://github.com/Shopify/shopify-api-
|
|
19
|
-
- Rather than create a temporary session in order to store a session id in a cookie for the OAuth transaction, we can store the `state` in the cookie instead, that can then be compared against the `state` provided by Shopify in the callback. [#438](https://github.com/Shopify/shopify-api-
|
|
24
|
+
- Increased tolerance for expired JWT session tokens from 5s to 10s [#462](https://github.com/Shopify/shopify-api-js/pull/462)
|
|
25
|
+
- Add support for billing to the library [#449](https://github.com/Shopify/shopify-api-js/pull/449)
|
|
26
|
+
- Allow dynamically typing the body of REST and GraphQL request responses, so callers don't need to cast it [#447](https://github.com/Shopify/shopify-api-js/pull/447)
|
|
27
|
+
- Rather than create a temporary session in order to store a session id in a cookie for the OAuth transaction, we can store the `state` in the cookie instead, that can then be compared against the `state` provided by Shopify in the callback. [#438](https://github.com/Shopify/shopify-api-js/pull/438)
|
|
20
28
|
|
|
21
29
|
## [5.0.1] - 2022-08-03
|
|
22
30
|
|
|
23
|
-
- Make `sanitizeHost` validation more flexible [#446](https://github.com/Shopify/shopify-api-
|
|
31
|
+
- Make `sanitizeHost` validation more flexible [#446](https://github.com/Shopify/shopify-api-js/pull/446)
|
|
24
32
|
|
|
25
33
|
## [5.0.0] - 2022-07-28
|
|
26
34
|
|
|
27
|
-
- ⚠️ [Breaking] If a response from a GraphQL query contains an `errors` attribute, `GraphqlClient` will now throw a `GraphqlQueryError`. The caller can check the `error.response` attribute to see what was returned from the GraphQL API. [#431](https://github.com/Shopify/shopify-api-
|
|
28
|
-
- ⚠️ [Breaking] Add utils functions to sanitize shops and hosts, and remove the `validateShop` utils function [#434](https://github.com/Shopify/shopify-api-
|
|
29
|
-
- Allow passing in options for the Redis client used by the session storage strategy [#430](https://github.com/Shopify/shopify-api-
|
|
30
|
-
- Fix User-Agent header sent in PUT / POST requests [#435](https://github.com/Shopify/shopify-api-
|
|
35
|
+
- ⚠️ [Breaking] If a response from a GraphQL query contains an `errors` attribute, `GraphqlClient` will now throw a `GraphqlQueryError`. The caller can check the `error.response` attribute to see what was returned from the GraphQL API. [#431](https://github.com/Shopify/shopify-api-js/pull/431)
|
|
36
|
+
- ⚠️ [Breaking] Add utils functions to sanitize shops and hosts, and remove the `validateShop` utils function [#434](https://github.com/Shopify/shopify-api-js/pull/434)
|
|
37
|
+
- Allow passing in options for the Redis client used by the session storage strategy [#430](https://github.com/Shopify/shopify-api-js/pull/430)
|
|
38
|
+
- Fix User-Agent header sent in PUT / POST requests [#435](https://github.com/Shopify/shopify-api-js/pull/435)
|
|
31
39
|
|
|
32
40
|
## [4.2.0] - 2022-07-20
|
|
33
41
|
|
|
34
|
-
- Return a 401 instead of 403 when webhooks fail validation [#425](https://github.com/Shopify/shopify-api-
|
|
35
|
-
- Add optional new methods `deleteSession` and `findSessionsByShop` to `SessionStorage`, with the corresponding implementations for the various session storage adapters [#418](https://github.com/Shopify/shopify-api-
|
|
36
|
-
- Include subset of query body in API deprecation logs [#426](https://github.com/Shopify/shopify-api-
|
|
42
|
+
- Return a 401 instead of 403 when webhooks fail validation [#425](https://github.com/Shopify/shopify-api-js/pull/425)
|
|
43
|
+
- Add optional new methods `deleteSession` and `findSessionsByShop` to `SessionStorage`, with the corresponding implementations for the various session storage adapters [#418](https://github.com/Shopify/shopify-api-js/pull/418)
|
|
44
|
+
- Include subset of query body in API deprecation logs [#426](https://github.com/Shopify/shopify-api-js/pull/426)
|
|
37
45
|
|
|
38
46
|
## [4.1.0] - 2022-07-14
|
|
39
47
|
|
|
40
|
-
- Add new method to construct the host app URL [#419](https://github.com/Shopify/shopify-api-
|
|
48
|
+
- Add new method to construct the host app URL [#419](https://github.com/Shopify/shopify-api-js/pull/419)
|
|
41
49
|
|
|
42
50
|
## [4.0.0] - 2022-07-04
|
|
43
51
|
|
|
44
|
-
- ⚠️ [Breaking] Add REST resources for July 2022 API version, add `LATEST_API_VERSION` constant, remove support and REST resources for July 2021 (`2021-07`) API version [#415](https://github.com/Shopify/shopify-api-
|
|
45
|
-
- Add support for July 2022 API version [#409](https://github.com/Shopify/shopify-api-
|
|
52
|
+
- ⚠️ [Breaking] Add REST resources for July 2022 API version, add `LATEST_API_VERSION` constant, remove support and REST resources for July 2021 (`2021-07`) API version [#415](https://github.com/Shopify/shopify-api-js/pull/415)
|
|
53
|
+
- Add support for July 2022 API version [#409](https://github.com/Shopify/shopify-api-js/pull/409)
|
|
46
54
|
|
|
47
55
|
### Fixes
|
|
48
56
|
|
|
49
|
-
- Fix a bug where the PostgreSQL session storage always attempted to create the sessions table [#413](https://github.com/Shopify/shopify-api-
|
|
57
|
+
- Fix a bug where the PostgreSQL session storage always attempted to create the sessions table [#413](https://github.com/Shopify/shopify-api-js/pull/413)
|
|
50
58
|
|
|
51
59
|
## [3.1.3] - 2022-06-08
|
|
52
60
|
|
|
@@ -62,19 +70,19 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
|
62
70
|
|
|
63
71
|
### Fixes
|
|
64
72
|
|
|
65
|
-
- Properly parse a non-json HTTP response [#257](https://github.com/Shopify/shopify-api-
|
|
73
|
+
- Properly parse a non-json HTTP response [#257](https://github.com/Shopify/shopify-api-js/issues/257)
|
|
66
74
|
- Don’t create a SQLite DB file if the SQLite storage is not used.
|
|
67
75
|
|
|
68
76
|
## [3.1.0] - 2022-05-16
|
|
69
77
|
|
|
70
78
|
### Added
|
|
71
79
|
|
|
72
|
-
- Support for specifying the URI scheme of the host [#385](https://github.com/Shopify/shopify-api-
|
|
80
|
+
- Support for specifying the URI scheme of the host [#385](https://github.com/Shopify/shopify-api-js/pull/385)
|
|
73
81
|
- Add optional `saving` parameter to `serialize` of `Base` class - default is `false` and will include read-only attributes in returned object; `true` used for `save` when committing via API to Shopify.
|
|
74
82
|
|
|
75
83
|
### Fixed
|
|
76
84
|
|
|
77
|
-
- Fixes [#363](https://github.com/Shopify/shopify-api-
|
|
85
|
+
- Fixes [#363](https://github.com/Shopify/shopify-api-js/issues/363)
|
|
78
86
|
- Webhooks `register` now checks for any attempt to register a GDPR topic (not done via API but by Partner Dashboard), provides an error message in response
|
|
79
87
|
- For topics that don't exist, `register` checks the response from the initial API call for an `errors` field and returns accordingly
|
|
80
88
|
|
|
@@ -82,22 +90,22 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
|
82
90
|
|
|
83
91
|
### Added
|
|
84
92
|
|
|
85
|
-
- Allow REST resources to configure a deny list of attributes to be excluded when saving [#355](https://github.com/Shopify/shopify-api-
|
|
93
|
+
- Allow REST resources to configure a deny list of attributes to be excluded when saving [#355](https://github.com/Shopify/shopify-api-js/pull/355)
|
|
86
94
|
|
|
87
95
|
## [3.0.0] - 2022-04-04
|
|
88
96
|
|
|
89
97
|
### Added
|
|
90
98
|
|
|
91
|
-
- ⚠️ [Breaking] Removing API version `2021-04` [#343](https://github.com/Shopify/shopify-api-
|
|
99
|
+
- ⚠️ [Breaking] Removing API version `2021-04` [#343](https://github.com/Shopify/shopify-api-js/pull/343)
|
|
92
100
|
- ⚠️ [Breaking] The `HttpResponseError` error and its flavours (all returned from HTTP requests) have been slightly altered:
|
|
93
101
|
- They now take in a hash of values, and will always include the response code, body (as a string if the response is not JSON), and headers
|
|
94
102
|
- All response fields are now contained within a `response` object, to make it easier to access them
|
|
95
|
-
- ⚠️ [Breaking] Update supported Admin API versions [#310](https://github.com/Shopify/shopify-api-
|
|
96
|
-
- Allow full paths in REST requests [#301](https://github.com/Shopify/shopify-api-
|
|
103
|
+
- ⚠️ [Breaking] Update supported Admin API versions [#310](https://github.com/Shopify/shopify-api-js/pull/310)
|
|
104
|
+
- Allow full paths in REST requests [#301](https://github.com/Shopify/shopify-api-js/pull/301)
|
|
97
105
|
|
|
98
106
|
### Fixed
|
|
99
107
|
|
|
100
|
-
- ⚠️ [Breaking] Stop responding to the request in the GraphQL Proxy function, returning Shopify's response instead [#312](https://github.com/Shopify/shopify-api-
|
|
108
|
+
- ⚠️ [Breaking] Stop responding to the request in the GraphQL Proxy function, returning Shopify's response instead [#312](https://github.com/Shopify/shopify-api-js/pull/312)
|
|
101
109
|
|
|
102
110
|
The examples below are in [express](https://expressjs.com/); you will now need to handle the response yourself.
|
|
103
111
|
|
|
@@ -122,76 +130,76 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
|
122
130
|
|
|
123
131
|
### Added
|
|
124
132
|
|
|
125
|
-
- Add support for January 2022 API version [#285](https://github.com/Shopify/shopify-api-
|
|
133
|
+
- Add support for January 2022 API version [#285](https://github.com/Shopify/shopify-api-js/pull/285)
|
|
126
134
|
|
|
127
135
|
## [2.0.0] - 2021-10-28
|
|
128
136
|
|
|
129
137
|
### Added
|
|
130
138
|
|
|
131
|
-
- Add a 5 second `clockTolerance` to fix `jwt not active` error [#227](https://github.com/Shopify/shopify-api-
|
|
132
|
-
- ⚠️ [Breaking] Change default for OAuth.beginAuth to online sessions [#203](https://github.com/Shopify/shopify-api-
|
|
133
|
-
- see [oauth.md](https://github.com/Shopify/shopify-api-
|
|
134
|
-
- ⚠️ [Breaking] Return and delete session in `validateAuthCallback` [#217](https://github.com/Shopify/shopify-api-
|
|
135
|
-
- see [oauth.md](https://github.com/Shopify/shopify-api-
|
|
136
|
-
- ⚠️ [Breaking] Extract `addHandler` and `getHandler` methods for webhooks out of `register` [#205](https://github.com/Shopify/shopify-api-
|
|
137
|
-
- ⚠️ [Breaking] Sessions no longer default to `false` for `isOnline` [#169](https://github.com/Shopify/shopify-api-
|
|
138
|
-
- Required `Session` arguments must be passed to the constructor [#169](https://github.com/Shopify/shopify-api-
|
|
139
|
-
- Allow `undefined` in `AuthScopes` [#169](https://github.com/Shopify/shopify-api-
|
|
139
|
+
- Add a 5 second `clockTolerance` to fix `jwt not active` error [#227](https://github.com/Shopify/shopify-api-js/pull/227)
|
|
140
|
+
- ⚠️ [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
|
|
142
|
+
- ⚠️ [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
|
|
144
|
+
- ⚠️ [Breaking] Extract `addHandler` and `getHandler` methods for webhooks out of `register` [#205](https://github.com/Shopify/shopify-api-js/pull/205)
|
|
145
|
+
- ⚠️ [Breaking] Sessions no longer default to `false` for `isOnline` [#169](https://github.com/Shopify/shopify-api-js/pull/169)
|
|
146
|
+
- Required `Session` arguments must be passed to the constructor [#169](https://github.com/Shopify/shopify-api-js/pull/169)
|
|
147
|
+
- Allow `undefined` in `AuthScopes` [#169](https://github.com/Shopify/shopify-api-js/pull/169)
|
|
140
148
|
|
|
141
149
|
## [1.4.3] - 2021-10-22
|
|
142
150
|
|
|
143
151
|
### Fixed
|
|
144
152
|
|
|
145
|
-
- Fixed the HTTP client error messages to expand objects [#252](https://github.com/Shopify/shopify-api-
|
|
153
|
+
- Fixed the HTTP client error messages to expand objects [#252](https://github.com/Shopify/shopify-api-js/pull/252)
|
|
146
154
|
|
|
147
155
|
## [1.4.2] - 2021-10-20
|
|
148
156
|
|
|
149
|
-
- Added `October21` to `ApiVersion` [#247](https://github.com/Shopify/shopify-api-
|
|
157
|
+
- Added `October21` to `ApiVersion` [#247](https://github.com/Shopify/shopify-api-js/pull/247)
|
|
150
158
|
|
|
151
159
|
## [1.4.1] - 2021-06-11
|
|
152
160
|
|
|
153
|
-
- Don't include extra params when calculating local hmac [#196](https://github.com/Shopify/shopify-api-
|
|
161
|
+
- Don't include extra params when calculating local hmac [#196](https://github.com/Shopify/shopify-api-js/pull/196)
|
|
154
162
|
|
|
155
163
|
## [1.4.0] - 2021-05-21
|
|
156
164
|
|
|
157
165
|
### Added
|
|
158
166
|
|
|
159
|
-
- Add support for registering Google Pub/Sub webhooks [#181](https://github.com/Shopify/shopify-api-
|
|
160
|
-
- Added `July21` to `ApiVersion` [#181](https://github.com/Shopify/shopify-api-
|
|
167
|
+
- Add support for registering Google Pub/Sub webhooks [#181](https://github.com/Shopify/shopify-api-js/pull/181)
|
|
168
|
+
- Added `July21` to `ApiVersion` [#181](https://github.com/Shopify/shopify-api-js/pull/181)
|
|
161
169
|
|
|
162
170
|
## [1.3.0] - 2021-05-12
|
|
163
171
|
|
|
164
172
|
### Added
|
|
165
173
|
|
|
166
174
|
- Added Storefront API client under `Shopify.Clients.Storefront`
|
|
167
|
-
- Add `isActive()` method to `Session` class to check if session is active, replace `Session` with `SessionInterface` when used as a type [#153](https://github.com/Shopify/shopify-api-
|
|
175
|
+
- Add `isActive()` method to `Session` class to check if session is active, replace `Session` with `SessionInterface` when used as a type [#153](https://github.com/Shopify/shopify-api-js/pull/153)
|
|
168
176
|
|
|
169
177
|
## [1.2.1] - 2021-03-26
|
|
170
178
|
|
|
171
179
|
### Added
|
|
172
180
|
|
|
173
|
-
- Added `April21` to `ApiVersion` [#149](https://github.com/Shopify/shopify-api-
|
|
181
|
+
- Added `April21` to `ApiVersion` [#149](https://github.com/Shopify/shopify-api-js/pull/149)
|
|
174
182
|
|
|
175
183
|
## [1.2.0] - 2021-03-16
|
|
176
184
|
|
|
177
185
|
### Added
|
|
178
186
|
|
|
179
|
-
- Allow plain objects to be returned from the `loadCallback` on `CustomSessionStorage` [#126](https://github.com/Shopify/shopify-api-
|
|
180
|
-
- Documentation and example code for `CustomSessionStorage` [#129](https://github.com/Shopify/shopify-api-
|
|
187
|
+
- Allow plain objects to be returned from the `loadCallback` on `CustomSessionStorage` [#126](https://github.com/Shopify/shopify-api-js/pull/126)
|
|
188
|
+
- Documentation and example code for `CustomSessionStorage` [#129](https://github.com/Shopify/shopify-api-js/pull/129)
|
|
181
189
|
|
|
182
190
|
### Fixed
|
|
183
191
|
|
|
184
|
-
- Throw a different error for a missing cookie upon OAuth return [#131](https://github.com/Shopify/shopify-api-
|
|
185
|
-
- Improved documentation for GraphQL and Rest Clients. [#123](https://github.com/Shopify/shopify-api-
|
|
186
|
-
- Made Docs directory more browseable in GitHub. [#136](https://github.com/Shopify/shopify-api-
|
|
187
|
-
- Make sure `CustomSessionStorage` converts the `expires` field from a string to `Date`. [#132](https://github.com/Shopify/shopify-api-
|
|
188
|
-
- Made `limit` optional for get-requests with query [#135](https://github.com/Shopify/shopify-api-
|
|
192
|
+
- Throw a different error for a missing cookie upon OAuth return [#131](https://github.com/Shopify/shopify-api-js/pull/131)
|
|
193
|
+
- Improved documentation for GraphQL and Rest Clients. [#123](https://github.com/Shopify/shopify-api-js/pull/123)
|
|
194
|
+
- Made Docs directory more browseable in GitHub. [#136](https://github.com/Shopify/shopify-api-js/pull/136)
|
|
195
|
+
- Make sure `CustomSessionStorage` converts the `expires` field from a string to `Date`. [#132](https://github.com/Shopify/shopify-api-js/pull/132)
|
|
196
|
+
- Made `limit` optional for get-requests with query [#135](https://github.com/Shopify/shopify-api-js/pull/135)
|
|
189
197
|
|
|
190
198
|
## [1.1.0] - 2021-03-02
|
|
191
199
|
|
|
192
200
|
- Minor text/doc changes
|
|
193
|
-
- Added `2021-01` API version to enum. [#117](https://github.com/Shopify/shopify-api-
|
|
194
|
-
- Allow retrieving offline sessions using `loadCurrentSession`. [#119](https://github.com/Shopify/shopify-api-
|
|
201
|
+
- Added `2021-01` API version to enum. [#117](https://github.com/Shopify/shopify-api-js/pull/117)
|
|
202
|
+
- Allow retrieving offline sessions using `loadCurrentSession`. [#119](https://github.com/Shopify/shopify-api-js/pull/119)
|
|
195
203
|
|
|
196
204
|
## [1.0.0]
|
|
197
205
|
|
|
@@ -201,56 +209,56 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
|
201
209
|
|
|
202
210
|
### Added
|
|
203
211
|
|
|
204
|
-
- Added `AuthScopes` value object to allow apps to easily check whether scopes have been updated. [#110](https://github.com/Shopify/shopify-api-
|
|
212
|
+
- Added `AuthScopes` value object to allow apps to easily check whether scopes have been updated. [#110](https://github.com/Shopify/shopify-api-js/pull/110)
|
|
205
213
|
|
|
206
214
|
### Fixed
|
|
207
215
|
|
|
208
|
-
- GraphQL Proxy attempts to parse the request body as JSON before passing it to the client. [#106](https://github.com/Shopify/shopify-api-
|
|
216
|
+
- GraphQL Proxy attempts to parse the request body as JSON before passing it to the client. [#106](https://github.com/Shopify/shopify-api-js/pull/106)
|
|
209
217
|
|
|
210
218
|
## [0.4.0] - 2021-02-10
|
|
211
219
|
|
|
212
220
|
### Added
|
|
213
221
|
|
|
214
|
-
- Webhooks types are now exported outside the library [#91](https://github.com/Shopify/shopify-api-
|
|
215
|
-
- Added support for private apps [#99](https://github.com/Shopify/shopify-api-
|
|
216
|
-
- `USER_AGENT_PREFIX` added to Context, to add agent to all requests [#101](https://github.com/Shopify/shopify-api-
|
|
217
|
-
- Add link to tutorial on how to rotate credentials if neccesary [#107](https://github.com/Shopify/shopify-api-
|
|
222
|
+
- Webhooks types are now exported outside the library [#91](https://github.com/Shopify/shopify-api-js/pull/91)
|
|
223
|
+
- Added support for private apps [#99](https://github.com/Shopify/shopify-api-js/pull/99)
|
|
224
|
+
- `USER_AGENT_PREFIX` added to Context, to add agent to all requests [#101](https://github.com/Shopify/shopify-api-js/pull/101)
|
|
225
|
+
- Add link to tutorial on how to rotate credentials if neccesary [#107](https://github.com/Shopify/shopify-api-js/pull/107)
|
|
218
226
|
|
|
219
227
|
### Fixed
|
|
220
228
|
|
|
221
|
-
- Export `withSession` utility method [#96](https://github.com/Shopify/shopify-api-
|
|
222
|
-
- GraphQL Client appropriately handles queries with variables [#97](https://github.com/Shopify/shopify-api-
|
|
223
|
-
- Use cryptographically random bytes to generate nonce [#98](https://github.com/Shopify/shopify-api-
|
|
224
|
-
- Stop using `SameSite=none` cookies for OAuth, using `lax` instead [#100](https://github.com/Shopify/shopify-api-
|
|
229
|
+
- Export `withSession` utility method [#96](https://github.com/Shopify/shopify-api-js/pull/96)
|
|
230
|
+
- GraphQL Client appropriately handles queries with variables [#97](https://github.com/Shopify/shopify-api-js/pull/97)
|
|
231
|
+
- Use cryptographically random bytes to generate nonce [#98](https://github.com/Shopify/shopify-api-js/pull/98)
|
|
232
|
+
- Stop using `SameSite=none` cookies for OAuth, using `lax` instead [#100](https://github.com/Shopify/shopify-api-js/pull/100)
|
|
225
233
|
|
|
226
234
|
## [0.3.1] - 2021-02-03
|
|
227
235
|
|
|
228
236
|
### Fixed
|
|
229
237
|
|
|
230
|
-
- Fixed an issue when deleting the current session for embedded apps [#88](https://github.com/Shopify/shopify-api-
|
|
238
|
+
- Fixed an issue when deleting the current session for embedded apps [#88](https://github.com/Shopify/shopify-api-js/pull/88)
|
|
231
239
|
|
|
232
240
|
## [0.3.0] - 2021-01-27
|
|
233
241
|
|
|
234
242
|
### Added
|
|
235
243
|
|
|
236
|
-
- Add `withSession` utility method [#83](https://github.com/Shopify/shopify-api-
|
|
244
|
+
- Add `withSession` utility method [#83](https://github.com/Shopify/shopify-api-js/pull/83)
|
|
237
245
|
|
|
238
246
|
### Fixed
|
|
239
247
|
|
|
240
|
-
- Refactor library public interface [#87](https://github.com/Shopify/shopify-api-
|
|
241
|
-
- Check if a webhook is registered before calling Shopify [#82](https://github.com/Shopify/shopify-api-
|
|
248
|
+
- Refactor library public interface [#87](https://github.com/Shopify/shopify-api-js/pull/87)
|
|
249
|
+
- Check if a webhook is registered before calling Shopify [#82](https://github.com/Shopify/shopify-api-js/pull/82)
|
|
242
250
|
|
|
243
251
|
## [0.2.2] - 2021-01-14
|
|
244
252
|
|
|
245
253
|
### Fixed
|
|
246
254
|
|
|
247
|
-
- Ensure that the OAuth session expiration matches the cookie expiration [#72](https://github.com/Shopify/shopify-api-
|
|
255
|
+
- Ensure that the OAuth session expiration matches the cookie expiration [#72](https://github.com/Shopify/shopify-api-js/pull/72) / [#73](https://github.com/Shopify/shopify-api-js/pull/73)
|
|
248
256
|
|
|
249
257
|
## [0.2.0] - 2021-01-13
|
|
250
258
|
|
|
251
|
-
- Preserve the OAuth cookie session for a few seconds so SPA can perform their initial load using it [#70](https://github.com/Shopify/shopify-api-
|
|
252
|
-
- Session fetches now return `undefined` when a session is not available [#64](https://github.com/Shopify/shopify-api-
|
|
253
|
-
- Add `deleteCurrentSession` utils method [#60](https://github.com/Shopify/shopify-api-
|
|
259
|
+
- Preserve the OAuth cookie session for a few seconds so SPA can perform their initial load using it [#70](https://github.com/Shopify/shopify-api-js/pull/70)
|
|
260
|
+
- Session fetches now return `undefined` when a session is not available [#64](https://github.com/Shopify/shopify-api-js/pull/64)
|
|
261
|
+
- Add `deleteCurrentSession` utils method [#60](https://github.com/Shopify/shopify-api-js/pull/60)
|
|
254
262
|
|
|
255
263
|
## [0.1.0] - 2020-12-17
|
|
256
264
|
|
package/README.md
CHANGED
|
@@ -137,6 +137,7 @@ These are all the configuration values `shopifyApi` supports.
|
|
|
137
137
|
- [Process a Webhook](docs/usage/webhooks.md#process-a-webhook)
|
|
138
138
|
- [Billing](docs/usage/billing.md)
|
|
139
139
|
- [Adding custom runtimes](docs/usage/runtimes.md)
|
|
140
|
+
- [Customizing logging configuration](docs/usage/logger.md)
|
|
140
141
|
|
|
141
142
|
## Migrating to v6
|
|
142
143
|
|
|
@@ -8,7 +8,7 @@ var utils_1 = require("../utils");
|
|
|
8
8
|
var RED = '\x1b[31m';
|
|
9
9
|
var GREEN = '\x1b[32m';
|
|
10
10
|
var RESET = '\x1b[39m';
|
|
11
|
-
var HttpClient = (0, http_client_1.
|
|
11
|
+
var HttpClient = (0, http_client_1.httpClientClass)(utils_1.config, 'http');
|
|
12
12
|
var defaultRetryTimer = HttpClient.RETRY_WAIT_TIME;
|
|
13
13
|
var testCount = 0;
|
|
14
14
|
function params(testRequest) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-cf-worker-app.js","sourceRoot":"","sources":["test-cf-worker-app.ts"],"names":[],"mappings":";;;AAAA,2BAAyB;AAOzB,
|
|
1
|
+
{"version":3,"file":"test-cf-worker-app.js","sourceRoot":"","sources":["test-cf-worker-app.ts"],"names":[],"mappings":";;;AAAA,2BAAyB;AAOzB,4EAA6E;AAC7E,kCAA8C;AAG9C,iCAAiC;AACjC,IAAM,GAAG,GAAG,UAAU,CAAC;AACvB,IAAM,KAAK,GAAG,UAAU,CAAC;AACzB,IAAM,KAAK,GAAG,UAAU,CAAC;AAEzB,IAAM,UAAU,GAAG,IAAA,6BAAe,EAAC,cAAM,EAAE,MAAM,CAAC,CAAC;AAEnD,IAAM,iBAAiB,GAAG,UAAU,CAAC,eAAe,CAAC;AACrD,IAAI,SAAS,GAAG,CAAC,CAAC;AAElB,SAAS,MAAM,CACb,WAAwB;IAExB,OAAO;QACL,IAAI,EAAE,WAAW,CAA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GAAG,SACvB,UAAU,SAAG,KAAK,qBAAW,IAAI,CAAC,SAAS,CAC5C,iBAAe,EACf,SAAS,EACT,CAAC,CACF,OAAI,CACN,CAAC;wBAEF,IAAI,UAAU,EAAE;4BACd,sBAAO,IAAI,QAAQ,CAAC,cAAc,EAAE,EAAC,MAAM,EAAE,GAAG,EAAC,CAAC,EAAC;yBACpD;6BAAM;4BACL,sBAAO,IAAI,QAAQ,CAAC,iBAAe,EAAE;oCACnC,MAAM,EAAE,GAAG;oCACX,OAAO,EAAE;wCACP,cAAc,EAAE,kBAAkB;qCACnC;iCACF,CAAC,EAAC;yBACJ;;6BAED,sBAAO,IAAI,QAAQ,CAAC,QAAQ,EAAE,EAAC,MAAM,EAAE,GAAG,EAAC,CAAC,EAAC;;;;;KAEhD;CACF,CAAC"}
|
|
@@ -9,7 +9,7 @@ var utils_1 = require("../utils");
|
|
|
9
9
|
var RED = '\x1b[31m';
|
|
10
10
|
var GREEN = '\x1b[32m';
|
|
11
11
|
var RESET = '\x1b[39m';
|
|
12
|
-
var HttpClient = (0, http_client_1.
|
|
12
|
+
var HttpClient = (0, http_client_1.httpClientClass)(utils_1.config, 'http');
|
|
13
13
|
/* eslint-disable no-process-env */
|
|
14
14
|
var apiServerPort = parseInt(process.env.HTTP_SERVER_PORT || '3000', 10);
|
|
15
15
|
var appPort = parseInt(process.env.PORT || '8787', 10);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-node-app.js","sourceRoot":"","sources":["test-node-app.ts"],"names":[],"mappings":";;;AAAA,6BAAmE;AAEnE,sBAAoB;AAGpB,
|
|
1
|
+
{"version":3,"file":"test-node-app.js","sourceRoot":"","sources":["test-node-app.ts"],"names":[],"mappings":";;;AAAA,6BAAmE;AAEnE,sBAAoB;AAGpB,4EAA6E;AAC7E,kCAA8C;AAG9C,iCAAiC;AACjC,IAAM,GAAG,GAAG,UAAU,CAAC;AACvB,IAAM,KAAK,GAAG,UAAU,CAAC;AACzB,IAAM,K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C;AACL,CAAC;AAED,SAAS,MAAM,CAAC,OAAY;IAC1B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,SAAS,sBAAsB,CAAC,IAAY;IAC1C,wEAAwE;IACvE,UAAiD,CAAC,eAAe,GAAG,IAAI,CAAC;AAC5E,CAAC;AAED,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC7B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;AAE9B,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;IACrB,OAAO,CAAC,GAAG,CAAC,wBAAiB,OAAO,CAAE,CAAC,CAAC;AAC1C,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConfigInterface } from '../base-types';
|
|
2
2
|
import { GetEmbeddedAppUrlParams } from './types';
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
3
|
+
export declare function getEmbeddedAppUrl(config: ConfigInterface): ({ ...adapterArgs }: GetEmbeddedAppUrlParams) => Promise<string>;
|
|
4
|
+
export declare function buildEmbeddedAppUrl(config: ConfigInterface): (host: string) => string;
|
|
5
5
|
//# sourceMappingURL=get-embedded-app-url.d.ts.map
|
|
@@ -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,
|
|
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,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.buildEmbeddedAppUrl = exports.getEmbeddedAppUrl = void 0;
|
|
4
4
|
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
|
-
function
|
|
8
|
+
function getEmbeddedAppUrl(config) {
|
|
9
9
|
var _this = this;
|
|
10
10
|
return function (_a) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
11
11
|
var request, url, host;
|
|
@@ -26,15 +26,15 @@ function createGetEmbeddedAppUrl(config) {
|
|
|
26
26
|
if (typeof host !== 'string') {
|
|
27
27
|
throw new ShopifyErrors.InvalidRequestError('Request does not contain a host query parameter');
|
|
28
28
|
}
|
|
29
|
-
return [2 /*return*/,
|
|
29
|
+
return [2 /*return*/, buildEmbeddedAppUrl(config)(host)];
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
}); };
|
|
33
33
|
}
|
|
34
|
-
exports.
|
|
35
|
-
function
|
|
34
|
+
exports.getEmbeddedAppUrl = getEmbeddedAppUrl;
|
|
35
|
+
function buildEmbeddedAppUrl(config) {
|
|
36
36
|
return function (host) {
|
|
37
|
-
(0, shop_validator_1.
|
|
37
|
+
(0, shop_validator_1.sanitizeHost)(config)(host, true);
|
|
38
38
|
// eslint-disable-next-line no-warning-comments
|
|
39
39
|
// TODO Remove the Buffer.from call when dropping Node 14 support
|
|
40
40
|
var decodedHost = typeof atob === 'undefined'
|
|
@@ -43,5 +43,5 @@ function createBuildEmbeddedAppUrl(config) {
|
|
|
43
43
|
return "https://".concat(decodedHost, "/apps/").concat(config.apiKey);
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
exports.
|
|
46
|
+
exports.buildEmbeddedAppUrl = buildEmbeddedAppUrl;
|
|
47
47
|
//# sourceMappingURL=get-embedded-app-url.js.map
|
|
@@ -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,
|
|
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,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;QAEjC,+CAA+C;QAC/C,iEAAiE;QACjE,IAAM,WAAW,GACf,OAAO,IAAI,KAAK,WAAW;YACzB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,QAAQ,EAAE;YACxC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEjB,OAAO,kBAAW,WAAW,mBAAS,MAAM,CAAC,MAAM,CAAE,CAAC;IACxD,CAAC,CAAC;AACJ,CAAC;AAbD,kDAaC"}
|
package/lib/auth/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAG9C,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AACpC,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAG9C,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AACpC,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAGjD,wBAAgB,WAAW,CAAC,MAAM,EAAE,eAAe;;;;;;;EASlD;AAED,oBAAY,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
package/lib/auth/index.js
CHANGED
|
@@ -7,12 +7,12 @@ var safe_compare_1 = require("./oauth/safe-compare");
|
|
|
7
7
|
var get_embedded_app_url_1 = require("./get-embedded-app-url");
|
|
8
8
|
function shopifyAuth(config) {
|
|
9
9
|
return {
|
|
10
|
-
begin: (0, oauth_1.
|
|
11
|
-
callback: (0, oauth_1.
|
|
10
|
+
begin: (0, oauth_1.begin)(config),
|
|
11
|
+
callback: (0, oauth_1.callback)(config),
|
|
12
12
|
nonce: nonce_1.nonce,
|
|
13
13
|
safeCompare: safe_compare_1.safeCompare,
|
|
14
|
-
getEmbeddedAppUrl: (0, get_embedded_app_url_1.
|
|
15
|
-
buildEmbeddedAppUrl: (0, get_embedded_app_url_1.
|
|
14
|
+
getEmbeddedAppUrl: (0, get_embedded_app_url_1.getEmbeddedAppUrl)(config),
|
|
15
|
+
buildEmbeddedAppUrl: (0, get_embedded_app_url_1.buildEmbeddedAppUrl)(config),
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
exports.shopifyAuth = shopifyAuth;
|
package/lib/auth/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAEA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAEA,uCAA8C;AAC9C,uCAAoC;AACpC,qDAAiD;AACjD,+DAA8E;AAE9E,SAAgB,WAAW,CAAC,MAAuB;IACjD,OAAO;QACL,KAAK,EAAE,IAAA,aAAK,EAAC,MAAM,CAAC;QACpB,QAAQ,EAAE,IAAA,gBAAQ,EAAC,MAAM,CAAC;QAC1B,KAAK,eAAA;QACL,WAAW,4BAAA;QACX,iBAAiB,EAAE,IAAA,wCAAiB,EAAC,MAAM,CAAC;QAC5C,mBAAmB,EAAE,IAAA,0CAAmB,EAAC,MAAM,CAAC;KACjD,CAAC;AACJ,CAAC;AATD,kCASC"}
|
|
@@ -6,6 +6,6 @@ export interface CallbackResponse<T = AdapterHeaders> {
|
|
|
6
6
|
headers: T;
|
|
7
7
|
session: Session;
|
|
8
8
|
}
|
|
9
|
-
export declare function
|
|
10
|
-
export declare function
|
|
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>>;
|
|
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;
|
|
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"}
|
package/lib/auth/oauth/oauth.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.callback = exports.begin = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var uuid_1 = require("uuid");
|
|
6
6
|
var processed_query_1 = tslib_1.__importDefault(require("../../utils/processed-query"));
|
|
@@ -16,7 +16,7 @@ var logger_1 = require("../../logger");
|
|
|
16
16
|
var types_2 = require("./types");
|
|
17
17
|
var nonce_1 = require("./nonce");
|
|
18
18
|
var safe_compare_1 = require("./safe-compare");
|
|
19
|
-
function
|
|
19
|
+
function begin(config) {
|
|
20
20
|
var _this = this;
|
|
21
21
|
return function (_a) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
22
22
|
var log, cleanShop, request, cookies, state, query, processedQuery, redirectUrl, response;
|
|
@@ -27,7 +27,7 @@ function createBegin(config) {
|
|
|
27
27
|
throwIfPrivateApp(config.isPrivateApp, 'Cannot perform OAuth for private apps');
|
|
28
28
|
log = (0, logger_1.logger)(config);
|
|
29
29
|
log.info('Beginning OAuth', { shop: shop, isOnline: isOnline, callbackPath: callbackPath });
|
|
30
|
-
cleanShop = (0, shop_validator_1.
|
|
30
|
+
cleanShop = (0, shop_validator_1.sanitizeShop)(config)(shop, true);
|
|
31
31
|
return [4 /*yield*/, (0, http_1.abstractConvertRequest)(adapterArgs)];
|
|
32
32
|
case 1:
|
|
33
33
|
request = _b.sent();
|
|
@@ -65,8 +65,8 @@ function createBegin(config) {
|
|
|
65
65
|
});
|
|
66
66
|
}); };
|
|
67
67
|
}
|
|
68
|
-
exports.
|
|
69
|
-
function
|
|
68
|
+
exports.begin = begin;
|
|
69
|
+
function callback(config) {
|
|
70
70
|
return function callback(_a) {
|
|
71
71
|
var isOnline = _a.isOnline, adapterArgs = tslib_1.__rest(_a, ["isOnline"]);
|
|
72
72
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
@@ -120,8 +120,8 @@ function createCallback(config) {
|
|
|
120
120
|
type: types_1.DataType.JSON,
|
|
121
121
|
data: body,
|
|
122
122
|
};
|
|
123
|
-
cleanShop = (0, shop_validator_1.
|
|
124
|
-
HttpClient = (0, http_client_1.
|
|
123
|
+
cleanShop = (0, shop_validator_1.sanitizeShop)(config)(query.get('shop'), true);
|
|
124
|
+
HttpClient = (0, http_client_1.httpClientClass)(config);
|
|
125
125
|
client = new HttpClient({ domain: cleanShop });
|
|
126
126
|
return [4 /*yield*/, client.post(postParams)];
|
|
127
127
|
case 4:
|
|
@@ -154,13 +154,13 @@ function createCallback(config) {
|
|
|
154
154
|
});
|
|
155
155
|
};
|
|
156
156
|
}
|
|
157
|
-
exports.
|
|
157
|
+
exports.callback = callback;
|
|
158
158
|
function validQuery(_a) {
|
|
159
159
|
var config = _a.config, query = _a.query, stateFromCookie = _a.stateFromCookie;
|
|
160
160
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
161
161
|
return tslib_1.__generator(this, function (_b) {
|
|
162
162
|
switch (_b.label) {
|
|
163
|
-
case 0: return [4 /*yield*/, (0, hmac_validator_1.
|
|
163
|
+
case 0: return [4 /*yield*/, (0, hmac_validator_1.validateHmac)(config)(query)];
|
|
164
164
|
case 1: return [2 /*return*/, ((_b.sent()) &&
|
|
165
165
|
(0, safe_compare_1.safeCompare)(query.state, stateFromCookie))];
|
|
166
166
|
}
|
|
@@ -185,7 +185,7 @@ function createSession(_a) {
|
|
|
185
185
|
var access_token = responseBody.access_token, scope = responseBody.scope, rest = tslib_1.__rest(responseBody, ["access_token", "scope"]);
|
|
186
186
|
var sessionExpiration = new Date(Date.now() + responseBody.expires_in * 1000);
|
|
187
187
|
if (config.isEmbeddedApp) {
|
|
188
|
-
sessionId = (0, session_utils_1.
|
|
188
|
+
sessionId = (0, session_utils_1.getJwtSessionId)(config)(shop, "".concat(rest.associated_user.id));
|
|
189
189
|
}
|
|
190
190
|
else {
|
|
191
191
|
sessionId = (0, uuid_1.v4)();
|
|
@@ -204,7 +204,7 @@ function createSession(_a) {
|
|
|
204
204
|
else {
|
|
205
205
|
var responseBody = postResponse.body;
|
|
206
206
|
return new session_1.Session({
|
|
207
|
-
id: (0, session_utils_1.
|
|
207
|
+
id: (0, session_utils_1.getOfflineId)(config)(shop),
|
|
208
208
|
shop: shop,
|
|
209
209
|
state: stateFromCookie,
|
|
210
210
|
isOnline: isOnline,
|