@shopify/shopify-api 4.0.0 → 4.1.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 +62 -54
- package/dist/auth/session/storage/postgresql.js +4 -4
- package/dist/error.d.ts +2 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +9 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/utils/get-embedded-app-url.d.ts +9 -0
- package/dist/utils/get-embedded-app-url.d.ts.map +1 -0
- package/dist/utils/get-embedded-app-url.js +26 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -7,10 +7,18 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
|
7
7
|
|
|
8
8
|
## Unreleased
|
|
9
9
|
|
|
10
|
+
## [4.1.0] - 2022-07-14
|
|
11
|
+
|
|
12
|
+
- Add new method to construct the host app URL [#419](https://github.com/Shopify/shopify-api-node/pull/419)
|
|
13
|
+
|
|
10
14
|
## [4.0.0] - 2022-07-04
|
|
11
15
|
|
|
12
|
-
- ⚠️ [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-node
|
|
13
|
-
- Add support for July 2022 API version [#409](https://github.com/Shopify/shopify-node
|
|
16
|
+
- ⚠️ [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-node/pull/415)
|
|
17
|
+
- Add support for July 2022 API version [#409](https://github.com/Shopify/shopify-api-node/pull/409)
|
|
18
|
+
|
|
19
|
+
### Fixes
|
|
20
|
+
|
|
21
|
+
- Fix a bug where the PostgreSQL session storage always attempted to create the sessions table [#413](https://github.com/Shopify/shopify-api-node/pull/413)
|
|
14
22
|
|
|
15
23
|
## [3.1.3] - 2022-06-08
|
|
16
24
|
|
|
@@ -23,18 +31,18 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
|
23
31
|
- Store user id and expiration date of online tokens
|
|
24
32
|
|
|
25
33
|
### Fixes
|
|
26
|
-
- Properly parse a non-json HTTP response [#257](https://github.com/Shopify/shopify-node
|
|
34
|
+
- Properly parse a non-json HTTP response [#257](https://github.com/Shopify/shopify-api-node/issues/257)
|
|
27
35
|
- Don’t create a SQLite DB file if the SQLite storage is not used.
|
|
28
36
|
|
|
29
37
|
|
|
30
38
|
## [3.1.0] - 2022-05-16
|
|
31
39
|
|
|
32
40
|
### Added
|
|
33
|
-
- Support for specifying the URI scheme of the host [#385](https://github.com/Shopify/shopify-node
|
|
41
|
+
- Support for specifying the URI scheme of the host [#385](https://github.com/Shopify/shopify-api-node/pull/385)
|
|
34
42
|
- 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.
|
|
35
43
|
|
|
36
44
|
### Fixed
|
|
37
|
-
- Fixes [#363](https://github.com/Shopify/shopify-node
|
|
45
|
+
- Fixes [#363](https://github.com/Shopify/shopify-api-node/issues/363)
|
|
38
46
|
- 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
|
|
39
47
|
- For topics that don't exist, `register` checks the response from the initial API call for an `errors` field and returns accordingly
|
|
40
48
|
|
|
@@ -42,22 +50,22 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
|
42
50
|
|
|
43
51
|
### Added
|
|
44
52
|
|
|
45
|
-
- Allow REST resources to configure a deny list of attributes to be excluded when saving [#355](https://github.com/Shopify/shopify-node
|
|
53
|
+
- Allow REST resources to configure a deny list of attributes to be excluded when saving [#355](https://github.com/Shopify/shopify-api-node/pull/355)
|
|
46
54
|
|
|
47
55
|
## [3.0.0] - 2022-04-04
|
|
48
56
|
|
|
49
57
|
### Added
|
|
50
58
|
|
|
51
|
-
- ⚠️ [Breaking] Removing API version `2021-04` [#343](https://github.com/Shopify/shopify-node
|
|
59
|
+
- ⚠️ [Breaking] Removing API version `2021-04` [#343](https://github.com/Shopify/shopify-api-node/pull/343)
|
|
52
60
|
- ⚠️ [Breaking] The `HttpResponseError` error and its flavours (all returned from HTTP requests) have been slightly altered:
|
|
53
61
|
- 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
|
|
54
62
|
- All response fields are now contained within a `response` object, to make it easier to access them
|
|
55
|
-
- ⚠️ [Breaking] Update supported Admin API versions [#310](https://github.com/Shopify/shopify-node
|
|
56
|
-
- Allow full paths in REST requests [#301](https://github.com/Shopify/shopify-node
|
|
63
|
+
- ⚠️ [Breaking] Update supported Admin API versions [#310](https://github.com/Shopify/shopify-api-node/pull/310)
|
|
64
|
+
- Allow full paths in REST requests [#301](https://github.com/Shopify/shopify-api-node/pull/301)
|
|
57
65
|
|
|
58
66
|
### Fixed
|
|
59
67
|
|
|
60
|
-
- ⚠️ [Breaking] Stop responding to the request in the GraphQL Proxy function, returning Shopify's response instead [#312](https://github.com/Shopify/shopify-node
|
|
68
|
+
- ⚠️ [Breaking] Stop responding to the request in the GraphQL Proxy function, returning Shopify's response instead [#312](https://github.com/Shopify/shopify-api-node/pull/312)
|
|
61
69
|
|
|
62
70
|
The examples below are in [express](https://expressjs.com/); you will now need to handle the response yourself.
|
|
63
71
|
|
|
@@ -82,76 +90,76 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
|
82
90
|
|
|
83
91
|
### Added
|
|
84
92
|
|
|
85
|
-
- Add support for January 2022 API version [#285](https://github.com/Shopify/shopify-node
|
|
93
|
+
- Add support for January 2022 API version [#285](https://github.com/Shopify/shopify-api-node/pull/285)
|
|
86
94
|
|
|
87
95
|
## [2.0.0] - 2021-10-28
|
|
88
96
|
|
|
89
97
|
### Added
|
|
90
98
|
|
|
91
|
-
- Add a 5 second `clockTolerance` to fix `jwt not active` error [#227](https://github.com/Shopify/shopify-node
|
|
92
|
-
- [Breaking] Change default for OAuth.beginAuth to online sessions [#203](https://github.com/Shopify/shopify-node
|
|
93
|
-
- see [oauth.md](https://github.com/Shopify/shopify-node
|
|
94
|
-
- [Breaking] Return and delete session in `validateAuthCallback` [#217](https://github.com/Shopify/shopify-node
|
|
95
|
-
- see [oauth.md](https://github.com/Shopify/shopify-node
|
|
96
|
-
- [Breaking] Extract `addHandler` and `getHandler` methods for webhooks out of `register` [#205](https://github.com/Shopify/shopify-node
|
|
97
|
-
- [Breaking] Sessions no longer default to `false` for `isOnline` [#169](https://github.com/Shopify/shopify-node
|
|
98
|
-
- Required `Session` arguments must be passed to the constructor [#169](https://github.com/Shopify/shopify-node
|
|
99
|
-
- Allow `undefined` in `AuthScopes` [#169](https://github.com/Shopify/shopify-node
|
|
99
|
+
- Add a 5 second `clockTolerance` to fix `jwt not active` error [#227](https://github.com/Shopify/shopify-api-node/pull/227)
|
|
100
|
+
- [Breaking] Change default for OAuth.beginAuth to online sessions [#203](https://github.com/Shopify/shopify-api-node/pull/203)
|
|
101
|
+
- see [oauth.md](https://github.com/Shopify/shopify-api-node/blob/main/docs/usage/oauth.md) for updated docs
|
|
102
|
+
- [Breaking] Return and delete session in `validateAuthCallback` [#217](https://github.com/Shopify/shopify-api-node/pull/217)
|
|
103
|
+
- see [oauth.md](https://github.com/Shopify/shopify-api-node/blob/main/docs/usage/oauth.md) for updated usage
|
|
104
|
+
- [Breaking] Extract `addHandler` and `getHandler` methods for webhooks out of `register` [#205](https://github.com/Shopify/shopify-api-node/pull/205)
|
|
105
|
+
- [Breaking] Sessions no longer default to `false` for `isOnline` [#169](https://github.com/Shopify/shopify-api-node/pull/169)
|
|
106
|
+
- Required `Session` arguments must be passed to the constructor [#169](https://github.com/Shopify/shopify-api-node/pull/169)
|
|
107
|
+
- Allow `undefined` in `AuthScopes` [#169](https://github.com/Shopify/shopify-api-node/pull/169)
|
|
100
108
|
|
|
101
109
|
## [1.4.3] - 2021-10-22
|
|
102
110
|
|
|
103
111
|
### Fixed
|
|
104
112
|
|
|
105
|
-
- Fixed the HTTP client error messages to expand objects [#252](https://github.com/Shopify/shopify-node
|
|
113
|
+
- Fixed the HTTP client error messages to expand objects [#252](https://github.com/Shopify/shopify-api-node/pull/252)
|
|
106
114
|
|
|
107
115
|
## [1.4.2] - 2021-10-20
|
|
108
116
|
|
|
109
|
-
- Added `October21` to `ApiVersion` [#247](https://github.com/Shopify/shopify-node
|
|
117
|
+
- Added `October21` to `ApiVersion` [#247](https://github.com/Shopify/shopify-api-node/pull/247)
|
|
110
118
|
|
|
111
119
|
## [1.4.1] - 2021-06-11
|
|
112
120
|
|
|
113
|
-
- Don't include extra params when calculating local hmac [#196](https://github.com/Shopify/shopify-node
|
|
121
|
+
- Don't include extra params when calculating local hmac [#196](https://github.com/Shopify/shopify-api-node/pull/196)
|
|
114
122
|
|
|
115
123
|
## [1.4.0] - 2021-05-21
|
|
116
124
|
|
|
117
125
|
### Added
|
|
118
126
|
|
|
119
|
-
- Add support for registering Google Pub/Sub webhooks [#181](https://github.com/Shopify/shopify-node
|
|
120
|
-
- Added `July21` to `ApiVersion` [#181](https://github.com/Shopify/shopify-node
|
|
127
|
+
- Add support for registering Google Pub/Sub webhooks [#181](https://github.com/Shopify/shopify-api-node/pull/181)
|
|
128
|
+
- Added `July21` to `ApiVersion` [#181](https://github.com/Shopify/shopify-api-node/pull/181)
|
|
121
129
|
|
|
122
130
|
## [1.3.0] - 2021-05-12
|
|
123
131
|
|
|
124
132
|
### Added
|
|
125
133
|
|
|
126
134
|
- Added Storefront API client under `Shopify.Clients.Storefront`
|
|
127
|
-
- 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-node
|
|
135
|
+
- 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-node/pull/153)
|
|
128
136
|
|
|
129
137
|
## [1.2.1] - 2021-03-26
|
|
130
138
|
|
|
131
139
|
### Added
|
|
132
140
|
|
|
133
|
-
- Added `April21` to `ApiVersion` [#149](https://github.com/Shopify/shopify-node
|
|
141
|
+
- Added `April21` to `ApiVersion` [#149](https://github.com/Shopify/shopify-api-node/pull/149)
|
|
134
142
|
|
|
135
143
|
## [1.2.0] - 2021-03-16
|
|
136
144
|
|
|
137
145
|
### Added
|
|
138
146
|
|
|
139
|
-
- Allow plain objects to be returned from the `loadCallback` on `CustomSessionStorage` [#126](https://github.com/
|
|
140
|
-
- Documentation and example code for `CustomSessionStorage` [#129](https://github.com/
|
|
147
|
+
- Allow plain objects to be returned from the `loadCallback` on `CustomSessionStorage` [#126](https://github.com/Shopify/shopify-api-node/pull/126)
|
|
148
|
+
- Documentation and example code for `CustomSessionStorage` [#129](https://github.com/Shopify/shopify-api-node/pull/129)
|
|
141
149
|
|
|
142
150
|
### Fixed
|
|
143
151
|
|
|
144
|
-
- Throw a different error for a missing cookie upon OAuth return [#131](https://github.com/
|
|
145
|
-
- Improved documentation for GraphQL and Rest Clients. [#123](https://github.com/Shopify/shopify-node
|
|
146
|
-
- Made Docs directory more browseable in GitHub. [#136](https://github.com/Shopify/shopify-node
|
|
147
|
-
- Make sure `CustomSessionStorage` converts the `expires` field from a string to `Date`. [#132](https://github.com/Shopify/shopify-node
|
|
148
|
-
- Made `limit` optional for get-requests with query [#135](https://github.com/Shopify/shopify-node
|
|
152
|
+
- Throw a different error for a missing cookie upon OAuth return [#131](https://github.com/Shopify/shopify-api-node/pull/131)
|
|
153
|
+
- Improved documentation for GraphQL and Rest Clients. [#123](https://github.com/Shopify/shopify-api-node/pull/123)
|
|
154
|
+
- Made Docs directory more browseable in GitHub. [#136](https://github.com/Shopify/shopify-api-node/pull/136)
|
|
155
|
+
- Make sure `CustomSessionStorage` converts the `expires` field from a string to `Date`. [#132](https://github.com/Shopify/shopify-api-node/pull/132)
|
|
156
|
+
- Made `limit` optional for get-requests with query [#135](https://github.com/Shopify/shopify-api-node/pull/135)
|
|
149
157
|
|
|
150
158
|
## [1.1.0] - 2021-03-02
|
|
151
159
|
|
|
152
160
|
- Minor text/doc changes
|
|
153
|
-
- Added `2021-01` API version to enum. [#117](https://github.com/
|
|
154
|
-
- Allow retrieving offline sessions using `loadCurrentSession`. [#119](https://github.com/
|
|
161
|
+
- Added `2021-01` API version to enum. [#117](https://github.com/Shopify/shopify-api-node/pull/117)
|
|
162
|
+
- Allow retrieving offline sessions using `loadCurrentSession`. [#119](https://github.com/Shopify/shopify-api-node/pull/119)
|
|
155
163
|
|
|
156
164
|
## [1.0.0]
|
|
157
165
|
|
|
@@ -161,56 +169,56 @@ and adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
|
161
169
|
|
|
162
170
|
### Added
|
|
163
171
|
|
|
164
|
-
- Added `AuthScopes` value object to allow apps to easily check whether scopes have been updated. [#110](https://github.com/
|
|
172
|
+
- Added `AuthScopes` value object to allow apps to easily check whether scopes have been updated. [#110](https://github.com/Shopify/shopify-api-node/pull/110)
|
|
165
173
|
|
|
166
174
|
### Fixed
|
|
167
175
|
|
|
168
|
-
- GraphQL Proxy attempts to parse the request body as JSON before passing it to the client. [#106](https://github.com/
|
|
176
|
+
- GraphQL Proxy attempts to parse the request body as JSON before passing it to the client. [#106](https://github.com/Shopify/shopify-api-node/pull/106)
|
|
169
177
|
|
|
170
178
|
## [0.4.0] - 2021-02-10
|
|
171
179
|
|
|
172
180
|
### Added
|
|
173
181
|
|
|
174
|
-
- Webhooks types are now exported outside the library [#91](https://github.com/
|
|
175
|
-
- Added support for private apps [#99](https://github.com/Shopify/shopify-node
|
|
176
|
-
- `USER_AGENT_PREFIX` added to Context, to add agent to all requests [#101](https://github.com/Shopify/shopify-node
|
|
177
|
-
- Add link to tutorial on how to rotate credentials if neccesary [#107](https://github.com/Shopify/shopify-node
|
|
182
|
+
- Webhooks types are now exported outside the library [#91](https://github.com/Shopify/shopify-api-node/pull/91)
|
|
183
|
+
- Added support for private apps [#99](https://github.com/Shopify/shopify-api-node/pull/99)
|
|
184
|
+
- `USER_AGENT_PREFIX` added to Context, to add agent to all requests [#101](https://github.com/Shopify/shopify-api-node/pull/101)
|
|
185
|
+
- Add link to tutorial on how to rotate credentials if neccesary [#107](https://github.com/Shopify/shopify-api-node/pull/107)
|
|
178
186
|
|
|
179
187
|
### Fixed
|
|
180
188
|
|
|
181
|
-
- Export `withSession` utility method [#96](https://github.com/Shopify/shopify-node
|
|
182
|
-
- GraphQL Client appropriately handles queries with variables [#97](https://github.com/Shopify/shopify-node
|
|
183
|
-
- Use cryptographically random bytes to generate nonce [#98](https://github.com/Shopify/shopify-node
|
|
184
|
-
- Stop using `SameSite=none` cookies for OAuth, using `lax` instead [#100](https://github.com/Shopify/shopify-node
|
|
189
|
+
- Export `withSession` utility method [#96](https://github.com/Shopify/shopify-api-node/pull/96)
|
|
190
|
+
- GraphQL Client appropriately handles queries with variables [#97](https://github.com/Shopify/shopify-api-node/pull/97)
|
|
191
|
+
- Use cryptographically random bytes to generate nonce [#98](https://github.com/Shopify/shopify-api-node/pull/98)
|
|
192
|
+
- Stop using `SameSite=none` cookies for OAuth, using `lax` instead [#100](https://github.com/Shopify/shopify-api-node/pull/100)
|
|
185
193
|
|
|
186
194
|
## [0.3.1] - 2021-02-03
|
|
187
195
|
|
|
188
196
|
### Fixed
|
|
189
197
|
|
|
190
|
-
- Fixed an issue when deleting the current session for embedded apps [#88](https://github.com/
|
|
198
|
+
- Fixed an issue when deleting the current session for embedded apps [#88](https://github.com/Shopify/shopify-api-node/pull/88)
|
|
191
199
|
|
|
192
200
|
## [0.3.0] - 2021-01-27
|
|
193
201
|
|
|
194
202
|
### Added
|
|
195
203
|
|
|
196
|
-
- Add `withSession` utility method [#83](https://github.com/
|
|
204
|
+
- Add `withSession` utility method [#83](https://github.com/Shopify/shopify-api-node/pull/83)
|
|
197
205
|
|
|
198
206
|
### Fixed
|
|
199
207
|
|
|
200
|
-
- Refactor library public interface [#87](https://github.com/
|
|
201
|
-
- Check if a webhook is registered before calling Shopify [#82](https://github.com/
|
|
208
|
+
- Refactor library public interface [#87](https://github.com/Shopify/shopify-api-node/pull/87)
|
|
209
|
+
- Check if a webhook is registered before calling Shopify [#82](https://github.com/Shopify/shopify-api-node/pull/82)
|
|
202
210
|
|
|
203
211
|
## [0.2.2] - 2021-01-14
|
|
204
212
|
|
|
205
213
|
### Fixed
|
|
206
214
|
|
|
207
|
-
- Ensure that the OAuth session expiration matches the cookie expiration [#72](https://github.com/
|
|
215
|
+
- Ensure that the OAuth session expiration matches the cookie expiration [#72](https://github.com/Shopify/shopify-api-node/pull/72) / [#73](https://github.com/Shopify/shopify-api-node/pull/73)
|
|
208
216
|
|
|
209
217
|
## [0.2.0] - 2021-01-13
|
|
210
218
|
|
|
211
|
-
- Preserve the OAuth cookie session for a few seconds so SPA can perform their initial load using it [#70](https://github.com/
|
|
212
|
-
- Session fetches now return `undefined` when a session is not available [#64](https://github.com/
|
|
213
|
-
- Add `deleteCurrentSession` utils method [#60](https://github.com/
|
|
219
|
+
- 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-node/pull/70)
|
|
220
|
+
- Session fetches now return `undefined` when a session is not available [#64](https://github.com/Shopify/shopify-api-node/pull/64)
|
|
221
|
+
- Add `deleteCurrentSession` utils method [#60](https://github.com/Shopify/shopify-api-node/pull/60)
|
|
214
222
|
|
|
215
223
|
## [0.1.0] - 2020-12-17
|
|
216
224
|
|
|
@@ -121,14 +121,14 @@ var PostgreSQLSessionStorage = /** @class */ (function () {
|
|
|
121
121
|
};
|
|
122
122
|
PostgreSQLSessionStorage.prototype.hasSessionTable = function () {
|
|
123
123
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
124
|
-
var query,
|
|
125
|
-
return tslib_1.__generator(this, function (
|
|
126
|
-
switch (
|
|
124
|
+
var query, rows;
|
|
125
|
+
return tslib_1.__generator(this, function (_a) {
|
|
126
|
+
switch (_a.label) {
|
|
127
127
|
case 0:
|
|
128
128
|
query = "\n SELECT * FROM pg_catalog.pg_tables WHERE tablename = $1\n ";
|
|
129
129
|
return [4 /*yield*/, this.query(query, [this.options.sessionTableName])];
|
|
130
130
|
case 1:
|
|
131
|
-
|
|
131
|
+
rows = _a.sent();
|
|
132
132
|
return [2 /*return*/, Array.isArray(rows) && rows.length === 1];
|
|
133
133
|
}
|
|
134
134
|
});
|
package/dist/error.d.ts
CHANGED
|
@@ -68,5 +68,7 @@ export declare class MissingRequiredArgument extends ShopifyError {
|
|
|
68
68
|
}
|
|
69
69
|
export declare class UnsupportedClientType extends ShopifyError {
|
|
70
70
|
}
|
|
71
|
+
export declare class InvalidRequestError extends ShopifyError {
|
|
72
|
+
}
|
|
71
73
|
export {};
|
|
72
74
|
//# sourceMappingURL=error.d.ts.map
|
package/dist/error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAa,SAAQ,KAAK;gBACzB,GAAG,IAAI,EAAE,GAAG;CAIzB;AAED,qBAAa,gBAAiB,SAAQ,YAAY;CAAG;AACrD,qBAAa,gBAAiB,SAAQ,YAAY;CAAG;AACrD,qBAAa,eAAgB,SAAQ,YAAY;CAAG;AACpD,qBAAa,oBAAqB,SAAQ,YAAY;CAAG;AAEzD,qBAAa,gBAAiB,SAAQ,YAAY;CAAG;AACrD,qBAAa,yBAA0B,SAAQ,YAAY;CAAG;AAC9D,qBAAa,eAAgB,SAAQ,YAAY;CAAG;AAEpD,qBAAa,gBAAiB,SAAQ,YAAY;CAAG;AACrD,qBAAa,mBAAoB,SAAQ,YAAY;CAAG;AAExD,UAAU,gBAAgB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CA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AQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC;gBAExB,EAAC,UAAU,EAAE,GAAG,MAAM,EAAC,EAAE,yBAAyB;CAItE;AAED,qBAAa,iBAAkB,SAAQ,YAAY;CAAG;AAEtD,qBAAa,iBAAkB,SAAQ,YAAY;CAAG;AACtD,qBAAa,eAAgB,SAAQ,YAAY;CAAG;AACpD,qBAAa,cAAe,SAAQ,YAAY;CAAG;AACnD,qBAAa,cAAe,SAAQ,YAAY;CAAG;AAEnD,qBAAa,mBAAoB,SAAQ,YAAY;CAAG;AACxD,qBAAa,mBAAoB,SAAQ,YAAY;CAAG;AAExD,qBAAa,uBAAwB,SAAQ,YAAY;CAAG;AAC5D,qBAAa,qBAAsB,SAAQ,YAAY;CAAG;AAE1D,qBAAa,mBAAoB,SAAQ,YAAY;CAAG"}
|
package/dist/error.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UnsupportedClientType = exports.MissingRequiredArgument = exports.SessionStorageError = exports.InvalidWebhookError = exports.InvalidSession = exports.CookieNotFound = exports.SessionNotFound = exports.InvalidOAuthError = exports.RestResourceError = exports.HttpThrottlingError = exports.HttpInternalError = exports.HttpRetriableError = exports.HttpResponseError = exports.HttpMaxRetriesError = exports.HttpRequestError = exports.PrivateAppError = exports.UninitializedContextError = exports.SafeCompareError = exports.MissingJwtTokenError = exports.InvalidJwtError = exports.InvalidShopError = exports.InvalidHmacError = exports.ShopifyError = void 0;
|
|
3
|
+
exports.InvalidRequestError = exports.UnsupportedClientType = exports.MissingRequiredArgument = exports.SessionStorageError = exports.InvalidWebhookError = exports.InvalidSession = exports.CookieNotFound = exports.SessionNotFound = exports.InvalidOAuthError = exports.RestResourceError = exports.HttpThrottlingError = exports.HttpInternalError = exports.HttpRetriableError = exports.HttpResponseError = exports.HttpMaxRetriesError = exports.HttpRequestError = exports.PrivateAppError = exports.UninitializedContextError = exports.SafeCompareError = exports.MissingJwtTokenError = exports.InvalidJwtError = exports.InvalidShopError = exports.InvalidHmacError = exports.ShopifyError = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var ShopifyError = /** @class */ (function (_super) {
|
|
6
6
|
tslib_1.__extends(ShopifyError, _super);
|
|
@@ -205,3 +205,11 @@ var UnsupportedClientType = /** @class */ (function (_super) {
|
|
|
205
205
|
return UnsupportedClientType;
|
|
206
206
|
}(ShopifyError));
|
|
207
207
|
exports.UnsupportedClientType = UnsupportedClientType;
|
|
208
|
+
var InvalidRequestError = /** @class */ (function (_super) {
|
|
209
|
+
tslib_1.__extends(InvalidRequestError, _super);
|
|
210
|
+
function InvalidRequestError() {
|
|
211
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
212
|
+
}
|
|
213
|
+
return InvalidRequestError;
|
|
214
|
+
}(ShopifyError));
|
|
215
|
+
exports.InvalidRequestError = InvalidRequestError;
|
package/dist/index.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export declare const Shopify: {
|
|
|
40
40
|
validateShop: typeof import("./utils/shop-validator").default;
|
|
41
41
|
versionCompatible: typeof import("./utils/version-compatible").default;
|
|
42
42
|
withSession: typeof import("./utils/with-session").default;
|
|
43
|
+
getEmbeddedAppUrl: typeof import("./utils/get-embedded-app-url").default;
|
|
43
44
|
};
|
|
44
45
|
Webhooks: {
|
|
45
46
|
Registry: import("./webhooks/registry").RegistryInterface;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,aAAa,MAAM,SAAS,CAAC;AAOzC,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,aAAa,MAAM,SAAS,CAAC;AAOzC,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQnB,CAAC;AAEF,eAAe,OAAO,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import http from 'http';
|
|
3
|
+
/**
|
|
4
|
+
* Helper method to get the host URL for the app.
|
|
5
|
+
*
|
|
6
|
+
* @param request Current HTTP request
|
|
7
|
+
*/
|
|
8
|
+
export default function getEmbeddedAppUrl(request: http.IncomingMessage): string;
|
|
9
|
+
//# sourceMappingURL=get-embedded-app-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-embedded-app-url.d.ts","sourceRoot":"","sources":["../../src/utils/get-embedded-app-url.ts"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAKxB;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,OAAO,EAAE,IAAI,CAAC,eAAe,GAC5B,MAAM,CAyBR"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var ShopifyErrors = tslib_1.__importStar(require("../error"));
|
|
5
|
+
var context_1 = require("../context");
|
|
6
|
+
/**
|
|
7
|
+
* Helper method to get the host URL for the app.
|
|
8
|
+
*
|
|
9
|
+
* @param request Current HTTP request
|
|
10
|
+
*/
|
|
11
|
+
function getEmbeddedAppUrl(request) {
|
|
12
|
+
if (!request) {
|
|
13
|
+
throw new ShopifyErrors.MissingRequiredArgument('getEmbeddedAppUrl requires a request object argument');
|
|
14
|
+
}
|
|
15
|
+
if (!request.url) {
|
|
16
|
+
throw new ShopifyErrors.InvalidRequestError('Request does not contain a URL');
|
|
17
|
+
}
|
|
18
|
+
var url = new URL(request.url, "https://".concat(request.headers.host));
|
|
19
|
+
var host = url.searchParams.get('host');
|
|
20
|
+
if (typeof host !== 'string') {
|
|
21
|
+
throw new ShopifyErrors.InvalidRequestError('Request does not contain a host query parameter');
|
|
22
|
+
}
|
|
23
|
+
var decodedHost = Buffer.from(host, 'base64').toString();
|
|
24
|
+
return "https://".concat(decodedHost, "/apps/").concat(context_1.Context.API_KEY);
|
|
25
|
+
}
|
|
26
|
+
exports.default = getEmbeddedAppUrl;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import validateHmac from './hmac-validator';
|
|
|
11
11
|
import validateShop from './shop-validator';
|
|
12
12
|
import versionCompatible from './version-compatible';
|
|
13
13
|
import withSession from './with-session';
|
|
14
|
+
import getEmbeddedAppUrl from './get-embedded-app-url';
|
|
14
15
|
declare const ShopifyUtils: {
|
|
15
16
|
decodeSessionToken: typeof decodeSessionToken;
|
|
16
17
|
deleteCurrentSession: typeof deleteCurrentSession;
|
|
@@ -25,6 +26,7 @@ declare const ShopifyUtils: {
|
|
|
25
26
|
validateShop: typeof validateShop;
|
|
26
27
|
versionCompatible: typeof versionCompatible;
|
|
27
28
|
withSession: typeof withSession;
|
|
29
|
+
getEmbeddedAppUrl: typeof getEmbeddedAppUrl;
|
|
28
30
|
};
|
|
29
31
|
export default ShopifyUtils;
|
|
30
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,wBAAwB,CAAC;AACxD,OAAO,oBAAoB,MAAM,0BAA0B,CAAC;AAC5D,OAAO,oBAAoB,MAAM,0BAA0B,CAAC;AAC5D,OAAO,kBAAkB,MAAM,wBAAwB,CAAC;AACxD,OAAO,kBAAkB,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,iBAAiB,MAAM,sBAAsB,CAAC;AACrD,OAAO,WAAW,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,MAAM,wBAAwB,CAAC;AACxD,OAAO,oBAAoB,MAAM,0BAA0B,CAAC;AAC5D,OAAO,oBAAoB,MAAM,0BAA0B,CAAC;AAC5D,OAAO,kBAAkB,MAAM,wBAAwB,CAAC;AACxD,OAAO,kBAAkB,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,iBAAiB,MAAM,sBAAsB,CAAC;AACrD,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAEvD,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;CAejB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var hmac_validator_1 = tslib_1.__importDefault(require("./hmac-validator"));
|
|
|
14
14
|
var shop_validator_1 = tslib_1.__importDefault(require("./shop-validator"));
|
|
15
15
|
var version_compatible_1 = tslib_1.__importDefault(require("./version-compatible"));
|
|
16
16
|
var with_session_1 = tslib_1.__importDefault(require("./with-session"));
|
|
17
|
+
var get_embedded_app_url_1 = tslib_1.__importDefault(require("./get-embedded-app-url"));
|
|
17
18
|
var ShopifyUtils = {
|
|
18
19
|
decodeSessionToken: decode_session_token_1.default,
|
|
19
20
|
deleteCurrentSession: delete_current_session_1.default,
|
|
@@ -28,5 +29,6 @@ var ShopifyUtils = {
|
|
|
28
29
|
validateShop: shop_validator_1.default,
|
|
29
30
|
versionCompatible: version_compatible_1.default,
|
|
30
31
|
withSession: with_session_1.default,
|
|
32
|
+
getEmbeddedAppUrl: get_embedded_app_url_1.default,
|
|
31
33
|
};
|
|
32
34
|
exports.default = ShopifyUtils;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SHOPIFY_API_LIBRARY_VERSION = "4.
|
|
1
|
+
export declare const SHOPIFY_API_LIBRARY_VERSION = "4.1.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopify/shopify-api",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Shopify API Library for Node - accelerate development with support for authentication, graphql proxy, webhooks",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
24
|
-
"url": "git+https://github.com/Shopify/shopify-node
|
|
24
|
+
"url": "git+https://github.com/Shopify/shopify-api-node.git"
|
|
25
25
|
},
|
|
26
26
|
"bugs": {
|
|
27
|
-
"url": "https://github.com/Shopify/shopify-node
|
|
27
|
+
"url": "https://github.com/Shopify/shopify-api-node/issues"
|
|
28
28
|
},
|
|
29
|
-
"homepage": "https://github.com/Shopify/shopify-node
|
|
29
|
+
"homepage": "https://github.com/Shopify/shopify-api-node",
|
|
30
30
|
"author": "Shopify Inc.",
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"keywords": [
|