@shopify/shopify-api 3.0.1 → 3.1.3
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 +25 -1
- package/dist/__tests__/fake-resource-with-custom-prefix.d.ts.map +1 -1
- package/dist/__tests__/fake-resource-with-custom-prefix.js +7 -5
- package/dist/__tests__/fake-resource.d.ts.map +1 -1
- package/dist/__tests__/fake-resource.js +15 -13
- package/dist/auth/oauth/oauth.d.ts.map +1 -1
- package/dist/auth/oauth/oauth.js +11 -11
- package/dist/auth/scopes/index.js +5 -5
- package/dist/auth/session/index.d.ts +11 -1
- package/dist/auth/session/index.d.ts.map +1 -1
- package/dist/auth/session/index.js +16 -1
- package/dist/auth/session/session-utils.d.ts +8 -0
- package/dist/auth/session/session-utils.d.ts.map +1 -0
- package/dist/auth/session/session-utils.js +116 -0
- package/dist/auth/session/storage/__tests__/battery-of-tests.d.ts +3 -0
- package/dist/auth/session/storage/__tests__/battery-of-tests.d.ts.map +1 -0
- package/dist/auth/session/storage/__tests__/battery-of-tests.js +191 -0
- package/dist/auth/session/storage/__tests__/utils.d.ts +10 -0
- package/dist/auth/session/storage/__tests__/utils.d.ts.map +1 -0
- package/dist/auth/session/storage/__tests__/utils.js +87 -0
- package/dist/auth/session/storage/custom.js +4 -4
- package/dist/auth/session/storage/mongodb.d.ts +23 -0
- package/dist/auth/session/storage/mongodb.d.ts.map +1 -0
- package/dist/auth/session/storage/mongodb.js +150 -0
- package/dist/auth/session/storage/mysql.d.ts +22 -0
- package/dist/auth/session/storage/mysql.d.ts.map +1 -0
- package/dist/auth/session/storage/mysql.js +154 -0
- package/dist/auth/session/storage/postgresql.d.ts +24 -0
- package/dist/auth/session/storage/postgresql.d.ts.map +1 -0
- package/dist/auth/session/storage/postgresql.js +172 -0
- package/dist/auth/session/storage/redis.d.ts +20 -0
- package/dist/auth/session/storage/redis.d.ts.map +1 -0
- package/dist/auth/session/storage/redis.js +105 -0
- package/dist/auth/session/storage/sqlite.d.ts +19 -0
- package/dist/auth/session/storage/sqlite.d.ts.map +1 -0
- package/dist/auth/session/storage/sqlite.js +128 -0
- package/dist/base-rest-resource.d.ts +2 -1
- package/dist/base-rest-resource.d.ts.map +1 -1
- package/dist/base-rest-resource.js +29 -19
- package/dist/base-types.d.ts +1 -0
- package/dist/base-types.d.ts.map +1 -1
- package/dist/clients/graphql/graphql_client.js +1 -1
- package/dist/clients/http_client/http_client.d.ts +1 -2
- package/dist/clients/http_client/http_client.d.ts.map +1 -1
- package/dist/clients/http_client/http_client.js +100 -99
- package/dist/clients/rest/rest_client.js +5 -3
- package/dist/context.d.ts +1 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +13 -5
- package/dist/error.js +4 -3
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/rest-resources/2021-07/index.js +2 -0
- package/dist/rest-resources/2021-10/index.js +2 -0
- package/dist/rest-resources/2022-01/index.js +2 -0
- package/dist/rest-resources/2022-04/index.js +2 -0
- package/dist/utils/decode-session-token.js +1 -1
- package/dist/utils/graphql_proxy.js +1 -1
- package/dist/utils/hmac-validator.js +2 -5
- package/dist/utils/processed-query.js +3 -3
- package/dist/utils/safe-compare.d.ts.map +1 -1
- package/dist/utils/safe-compare.js +17 -15
- package/dist/utils/setup-jest.d.ts.map +1 -1
- package/dist/utils/setup-jest.js +4 -3
- package/dist/utils/with-session.js +3 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/webhooks/registry.d.ts +2 -1
- package/dist/webhooks/registry.d.ts.map +1 -1
- package/dist/webhooks/registry.js +39 -13
- package/package.json +12 -4
|
@@ -42,7 +42,7 @@ var Base = /** @class */ (function () {
|
|
|
42
42
|
var client, path, cleanParams, key;
|
|
43
43
|
return tslib_1.__generator(this, function (_b) {
|
|
44
44
|
if (context_1.Context.API_VERSION !== this.API_VERSION) {
|
|
45
|
-
throw new error_1.RestResourceError("Current Context.API_VERSION '"
|
|
45
|
+
throw new error_1.RestResourceError("Current Context.API_VERSION '".concat(context_1.Context.API_VERSION, "' does not match resource version ").concat(this.API_VERSION));
|
|
46
46
|
}
|
|
47
47
|
client = new rest_1.RestClient(session.shop, session.accessToken);
|
|
48
48
|
path = this.getPath({ http_method: http_method, operation: operation, urlIds: urlIds, entity: entity });
|
|
@@ -74,7 +74,7 @@ var Base = /** @class */ (function () {
|
|
|
74
74
|
case 'delete':
|
|
75
75
|
return [2 /*return*/, client.delete({ path: path, query: cleanParams })];
|
|
76
76
|
default:
|
|
77
|
-
throw new Error("Unrecognized HTTP method \""
|
|
77
|
+
throw new Error("Unrecognized HTTP method \"".concat(http_method, "\""));
|
|
78
78
|
}
|
|
79
79
|
return [2 /*return*/];
|
|
80
80
|
});
|
|
@@ -114,13 +114,13 @@ var Base = /** @class */ (function () {
|
|
|
114
114
|
specificity = path.ids.length;
|
|
115
115
|
match = path.path.replace(/(<([^>]+)>)/g,
|
|
116
116
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
117
|
-
function (_m1, _m2, id) { return ""
|
|
117
|
+
function (_m1, _m2, id) { return "".concat(pathUrlIds[id]); });
|
|
118
118
|
});
|
|
119
119
|
if (!match) {
|
|
120
120
|
throw new error_1.RestResourceError('Could not find a path for request');
|
|
121
121
|
}
|
|
122
122
|
if (this.CUSTOM_PREFIX) {
|
|
123
|
-
return this.CUSTOM_PREFIX
|
|
123
|
+
return "".concat(this.CUSTOM_PREFIX, "/").concat(match);
|
|
124
124
|
}
|
|
125
125
|
else {
|
|
126
126
|
return match;
|
|
@@ -148,26 +148,26 @@ var Base = /** @class */ (function () {
|
|
|
148
148
|
return instance;
|
|
149
149
|
};
|
|
150
150
|
Base.prototype.save = function (_a) {
|
|
151
|
-
var _b =
|
|
151
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.update, update = _c === void 0 ? false : _c;
|
|
152
152
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
153
|
-
var
|
|
154
|
-
var
|
|
155
|
-
return tslib_1.__generator(this, function (
|
|
156
|
-
switch (
|
|
153
|
+
var _d, PRIMARY_KEY, NAME, method, data, response, body;
|
|
154
|
+
var _e;
|
|
155
|
+
return tslib_1.__generator(this, function (_f) {
|
|
156
|
+
switch (_f.label) {
|
|
157
157
|
case 0:
|
|
158
|
-
|
|
158
|
+
_d = this.resource(), PRIMARY_KEY = _d.PRIMARY_KEY, NAME = _d.NAME;
|
|
159
159
|
method = this[PRIMARY_KEY] ? 'put' : 'post';
|
|
160
|
-
data = this.serialize();
|
|
160
|
+
data = this.serialize(true);
|
|
161
161
|
return [4 /*yield*/, this.resource().request({
|
|
162
162
|
http_method: method,
|
|
163
163
|
operation: method,
|
|
164
164
|
session: this.session,
|
|
165
165
|
urlIds: {},
|
|
166
|
-
body: (
|
|
166
|
+
body: (_e = {}, _e[this.resource().getJsonBodyName()] = data, _e),
|
|
167
167
|
entity: this,
|
|
168
168
|
})];
|
|
169
169
|
case 1:
|
|
170
|
-
response =
|
|
170
|
+
response = _f.sent();
|
|
171
171
|
body = response.body[NAME];
|
|
172
172
|
if (update && body) {
|
|
173
173
|
this.setData(body);
|
|
@@ -207,21 +207,24 @@ var Base = /** @class */ (function () {
|
|
|
207
207
|
});
|
|
208
208
|
});
|
|
209
209
|
};
|
|
210
|
-
Base.prototype.serialize = function () {
|
|
210
|
+
Base.prototype.serialize = function (saving) {
|
|
211
|
+
var _this = this;
|
|
212
|
+
if (saving === void 0) { saving = false; }
|
|
211
213
|
var _a = this.resource(), HAS_MANY = _a.HAS_MANY, HAS_ONE = _a.HAS_ONE, READ_ONLY_ATTRIBUTES = _a.READ_ONLY_ATTRIBUTES;
|
|
212
214
|
return Object.entries(this).reduce(function (acc, _a) {
|
|
213
215
|
var _b = tslib_1.__read(_a, 2), attribute = _b[0], value = _b[1];
|
|
214
|
-
if (
|
|
215
|
-
|
|
216
|
+
if (saving &&
|
|
217
|
+
(['session'].includes(attribute) ||
|
|
218
|
+
READ_ONLY_ATTRIBUTES.includes(attribute))) {
|
|
216
219
|
return acc;
|
|
217
220
|
}
|
|
218
221
|
if (attribute in HAS_MANY && value) {
|
|
219
222
|
acc[attribute] = value.reduce(function (attrAcc, entry) {
|
|
220
|
-
return attrAcc.concat(
|
|
223
|
+
return attrAcc.concat(_this.serializeSubAttribute(entry, saving));
|
|
221
224
|
}, []);
|
|
222
225
|
}
|
|
223
|
-
else if (attribute in HAS_ONE && value
|
|
224
|
-
acc[attribute] =
|
|
226
|
+
else if (attribute in HAS_ONE && value) {
|
|
227
|
+
acc[attribute] = _this.serializeSubAttribute(value, saving);
|
|
225
228
|
}
|
|
226
229
|
else {
|
|
227
230
|
acc[attribute] = value;
|
|
@@ -256,6 +259,13 @@ var Base = /** @class */ (function () {
|
|
|
256
259
|
Base.prototype.resource = function () {
|
|
257
260
|
return this.constructor;
|
|
258
261
|
};
|
|
262
|
+
Base.prototype.serializeSubAttribute = function (attribute, saving) {
|
|
263
|
+
return attribute.serialize
|
|
264
|
+
? attribute.serialize(saving)
|
|
265
|
+
: this.resource()
|
|
266
|
+
.createInstance(this.session, attribute)
|
|
267
|
+
.serialize(saving);
|
|
268
|
+
};
|
|
259
269
|
Base.NAME = '';
|
|
260
270
|
Base.PLURAL_NAME = '';
|
|
261
271
|
Base.PRIMARY_KEY = 'id';
|
package/dist/base-types.d.ts
CHANGED
package/dist/base-types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-types.d.ts","sourceRoot":"","sources":["../src/base-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,cAAc,EAAC,MAAM,gCAAgC,CAAC;AAE9D,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,UAAU,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mCAAmC,CAAC,EAAE,MAAM,CAAC;CAC9C;AAED,oBAAY,UAAU;IACpB,MAAM,YAAY;IAClB,SAAS,YAAY;IACrB,SAAS,YAAY;IACrB,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAED,oBAAY,aAAa;IACvB,WAAW,2BAA2B;IACtC,qBAAqB,sCAAsC;IAC3D,IAAI,0BAA0B;IAC9B,KAAK,oBAAoB;IACzB,MAAM,0BAA0B;CACjC"}
|
|
1
|
+
{"version":3,"file":"base-types.d.ts","sourceRoot":"","sources":["../src/base-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,cAAc,EAAC,MAAM,gCAAgC,CAAC;AAE9D,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,UAAU,CAAC;IACxB,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mCAAmC,CAAC,EAAE,MAAM,CAAC;CAC9C;AAED,oBAAY,UAAU;IACpB,MAAM,YAAY;IAClB,SAAS,YAAY;IACrB,SAAS,YAAY;IACrB,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB;AAED,oBAAY,aAAa;IACvB,WAAW,2BAA2B;IACtC,qBAAqB,sCAAsC;IAC3D,IAAI,0BAA0B;IAC9B,KAAK,oBAAoB;IACzB,MAAM,0BAA0B;CACjC"}
|
|
@@ -28,7 +28,7 @@ var GraphqlClient = /** @class */ (function () {
|
|
|
28
28
|
}
|
|
29
29
|
accessTokenHeader = this.getAccessTokenHeader();
|
|
30
30
|
params.extraHeaders = tslib_1.__assign((_a = {}, _a[accessTokenHeader.header] = accessTokenHeader.value, _a), params.extraHeaders);
|
|
31
|
-
path = this.baseApiPath
|
|
31
|
+
path = "".concat(this.baseApiPath, "/").concat(context_1.Context.API_VERSION, "/graphql.json");
|
|
32
32
|
if (typeof params.data === 'object') {
|
|
33
33
|
dataType = types_1.DataType.JSON;
|
|
34
34
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DeleteRequestParams, GetRequestParams, PostRequestParams, PutRequestParams, RequestParams, RequestReturn } from './types';
|
|
2
|
-
declare class HttpClient {
|
|
2
|
+
export declare class HttpClient {
|
|
3
3
|
private domain;
|
|
4
4
|
static readonly RETRY_WAIT_TIME = 1000;
|
|
5
5
|
static readonly DEPRECATION_ALERT_DELAY = 300000;
|
|
@@ -25,5 +25,4 @@ declare class HttpClient {
|
|
|
25
25
|
protected getRequestPath(path: string): string;
|
|
26
26
|
private doRequest;
|
|
27
27
|
}
|
|
28
|
-
export { HttpClient };
|
|
29
28
|
//# sourceMappingURL=http_client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http_client.d.ts","sourceRoot":"","sources":["../../../src/clients/http_client/http_client.ts"],"names":[],"mappings":"AAYA,OAAO,EAEL,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB,
|
|
1
|
+
{"version":3,"file":"http_client.d.ts","sourceRoot":"","sources":["../../../src/clients/http_client/http_client.ts"],"names":[],"mappings":"AAYA,OAAO,EAEL,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB,qBAAa,UAAU;IAOF,OAAO,CAAC,MAAM;IALjC,MAAM,CAAC,QAAQ,CAAC,eAAe,QAAQ;IAEvC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,UAAU;IACjD,OAAO,CAAC,mBAAmB,CAA+B;gBAE/B,MAAM,EAAE,MAAM;IAIzC;;OAEG;IACU,GAAG,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IAIlE;;OAEG;IACU,IAAI,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC;IAIpE;;OAEG;IACU,GAAG,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IAIlE;;OAEG;IACU,MAAM,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,aAAa,CAAC;cAIxD,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IA0GtE,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;YAIhC,SAAS;CA6GxB"}
|
|
@@ -73,19 +73,19 @@ var HttpClient = /** @class */ (function () {
|
|
|
73
73
|
case 0:
|
|
74
74
|
maxTries = params.tries ? params.tries : 1;
|
|
75
75
|
if (maxTries <= 0) {
|
|
76
|
-
throw new ShopifyErrors.HttpRequestError("Number of tries must be >= 0, got "
|
|
76
|
+
throw new ShopifyErrors.HttpRequestError("Number of tries must be >= 0, got ".concat(maxTries));
|
|
77
77
|
}
|
|
78
|
-
userAgent = "Shopify API Library v"
|
|
78
|
+
userAgent = "Shopify API Library v".concat(version_1.SHOPIFY_API_LIBRARY_VERSION, " | Node ").concat(process.version);
|
|
79
79
|
if (context_1.Context.USER_AGENT_PREFIX) {
|
|
80
|
-
userAgent = context_1.Context.USER_AGENT_PREFIX
|
|
80
|
+
userAgent = "".concat(context_1.Context.USER_AGENT_PREFIX, " | ").concat(userAgent);
|
|
81
81
|
}
|
|
82
82
|
if (params.extraHeaders) {
|
|
83
83
|
if (params.extraHeaders['user-agent']) {
|
|
84
|
-
userAgent = params.extraHeaders['user-agent']
|
|
84
|
+
userAgent = "".concat(params.extraHeaders['user-agent'], " | ").concat(userAgent);
|
|
85
85
|
delete params.extraHeaders['user-agent'];
|
|
86
86
|
}
|
|
87
87
|
else if (params.extraHeaders['User-Agent']) {
|
|
88
|
-
userAgent = params.extraHeaders['User-Agent']
|
|
88
|
+
userAgent = "".concat(params.extraHeaders['User-Agent'], " | ").concat(userAgent);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
headers = tslib_1.__assign(tslib_1.__assign({}, params.extraHeaders), { 'User-Agent': userAgent });
|
|
@@ -110,7 +110,7 @@ var HttpClient = /** @class */ (function () {
|
|
|
110
110
|
headers = tslib_1.__assign({ 'Content-Type': type, 'Content-Length': Buffer.byteLength(body) }, params.extraHeaders);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
url = "https://"
|
|
113
|
+
url = "https://".concat(this.domain).concat(this.getRequestPath(params.path)).concat(processed_query_1.default.stringify(params.query));
|
|
114
114
|
options = {
|
|
115
115
|
method: params.method.toString(),
|
|
116
116
|
headers: headers,
|
|
@@ -142,7 +142,7 @@ var HttpClient = /** @class */ (function () {
|
|
|
142
142
|
case 6:
|
|
143
143
|
// We're set to multiple tries but ran out
|
|
144
144
|
if (maxTries > 1) {
|
|
145
|
-
throw new ShopifyErrors.HttpMaxRetriesError("Exceeded maximum retry count of "
|
|
145
|
+
throw new ShopifyErrors.HttpMaxRetriesError("Exceeded maximum retry count of ".concat(maxTries, ". Last message: ").concat(error_1.message));
|
|
146
146
|
}
|
|
147
147
|
_b.label = 7;
|
|
148
148
|
case 7:
|
|
@@ -158,109 +158,110 @@ var HttpClient = /** @class */ (function () {
|
|
|
158
158
|
});
|
|
159
159
|
};
|
|
160
160
|
HttpClient.prototype.getRequestPath = function (path) {
|
|
161
|
-
return "/"
|
|
161
|
+
return "/".concat(path.replace(/^\//, ''));
|
|
162
162
|
};
|
|
163
163
|
HttpClient.prototype.doRequest = function (url, options) {
|
|
164
164
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
165
|
-
var
|
|
165
|
+
var response, body, deprecation, depHash, stack, log, errorMessages, errorMessage, headers, code, statusText, retryAfter, error_2;
|
|
166
166
|
return tslib_1.__generator(this, function (_a) {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
return
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
else {
|
|
199
|
-
console.warn('API Deprecation Notice:', deprecation);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return [2 /*return*/, {
|
|
204
|
-
body: body,
|
|
205
|
-
headers: response.headers,
|
|
206
|
-
}];
|
|
167
|
+
switch (_a.label) {
|
|
168
|
+
case 0:
|
|
169
|
+
_a.trys.push([0, 3, , 4]);
|
|
170
|
+
return [4 /*yield*/, (0, node_fetch_1.default)(url, options)];
|
|
171
|
+
case 1:
|
|
172
|
+
response = _a.sent();
|
|
173
|
+
return [4 /*yield*/, response.json().catch(function () { return ({}); })];
|
|
174
|
+
case 2:
|
|
175
|
+
body = _a.sent();
|
|
176
|
+
if (response.ok) {
|
|
177
|
+
if (response.headers &&
|
|
178
|
+
response.headers.has('X-Shopify-API-Deprecated-Reason')) {
|
|
179
|
+
deprecation = {
|
|
180
|
+
message: response.headers.get('X-Shopify-API-Deprecated-Reason'),
|
|
181
|
+
path: url,
|
|
182
|
+
};
|
|
183
|
+
depHash = crypto_1.default
|
|
184
|
+
.createHash('md5')
|
|
185
|
+
.update(JSON.stringify(deprecation))
|
|
186
|
+
.digest('hex');
|
|
187
|
+
if (!Object.keys(this.LOGGED_DEPRECATIONS).includes(depHash) ||
|
|
188
|
+
Date.now() - this.LOGGED_DEPRECATIONS[depHash] >=
|
|
189
|
+
HttpClient.DEPRECATION_ALERT_DELAY) {
|
|
190
|
+
this.LOGGED_DEPRECATIONS[depHash] = Date.now();
|
|
191
|
+
if (context_1.Context.LOG_FILE) {
|
|
192
|
+
stack = new Error().stack;
|
|
193
|
+
log = "API Deprecation Notice ".concat(new Date().toLocaleString(), " : ").concat(JSON.stringify(deprecation), "\n Stack Trace: ").concat(stack, "\n");
|
|
194
|
+
fs_1.default.writeFileSync(context_1.Context.LOG_FILE, log, {
|
|
195
|
+
flag: 'a',
|
|
196
|
+
encoding: 'utf-8',
|
|
197
|
+
});
|
|
207
198
|
}
|
|
208
199
|
else {
|
|
209
|
-
|
|
210
|
-
if (body.errors) {
|
|
211
|
-
errorMessages.push(JSON.stringify(body.errors, null, 2));
|
|
212
|
-
}
|
|
213
|
-
if (response.headers && response.headers.get('x-request-id')) {
|
|
214
|
-
errorMessages.push("If you report this error, please include this id: " + response.headers.get('x-request-id'));
|
|
215
|
-
}
|
|
216
|
-
errorMessage = errorMessages.length
|
|
217
|
-
? ":\n" + errorMessages.join('\n')
|
|
218
|
-
: '';
|
|
219
|
-
headers = response.headers.raw();
|
|
220
|
-
code = response.status;
|
|
221
|
-
statusText = response.statusText;
|
|
222
|
-
switch (true) {
|
|
223
|
-
case response.status === network_1.StatusCode.TooManyRequests: {
|
|
224
|
-
retryAfter = response.headers.get('Retry-After');
|
|
225
|
-
throw new ShopifyErrors.HttpThrottlingError({
|
|
226
|
-
message: "Shopify is throttling requests" + errorMessage,
|
|
227
|
-
code: code,
|
|
228
|
-
statusText: statusText,
|
|
229
|
-
body: body,
|
|
230
|
-
headers: headers,
|
|
231
|
-
retryAfter: retryAfter ? parseFloat(retryAfter) : undefined,
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
case response.status >= network_1.StatusCode.InternalServerError:
|
|
235
|
-
throw new ShopifyErrors.HttpInternalError({
|
|
236
|
-
message: "Shopify internal error" + errorMessage,
|
|
237
|
-
code: code,
|
|
238
|
-
statusText: statusText,
|
|
239
|
-
body: body,
|
|
240
|
-
headers: headers,
|
|
241
|
-
});
|
|
242
|
-
default:
|
|
243
|
-
throw new ShopifyErrors.HttpResponseError({
|
|
244
|
-
message: "Received an error response (" + response.status + " " + response.statusText + ") from Shopify" + errorMessage,
|
|
245
|
-
code: code,
|
|
246
|
-
statusText: statusText,
|
|
247
|
-
body: body,
|
|
248
|
-
headers: headers,
|
|
249
|
-
});
|
|
250
|
-
}
|
|
200
|
+
console.warn('API Deprecation Notice:', deprecation);
|
|
251
201
|
}
|
|
252
|
-
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return [2 /*return*/, {
|
|
205
|
+
body: body,
|
|
206
|
+
headers: response.headers,
|
|
207
|
+
}];
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
errorMessages = [];
|
|
211
|
+
if (body.errors) {
|
|
212
|
+
errorMessages.push(JSON.stringify(body.errors, null, 2));
|
|
213
|
+
}
|
|
214
|
+
if (response.headers && response.headers.get('x-request-id')) {
|
|
215
|
+
errorMessages.push("If you report this error, please include this id: ".concat(response.headers.get('x-request-id')));
|
|
216
|
+
}
|
|
217
|
+
errorMessage = errorMessages.length
|
|
218
|
+
? ":\n".concat(errorMessages.join('\n'))
|
|
219
|
+
: '';
|
|
220
|
+
headers = response.headers.raw();
|
|
221
|
+
code = response.status;
|
|
222
|
+
statusText = response.statusText;
|
|
223
|
+
switch (true) {
|
|
224
|
+
case response.status === network_1.StatusCode.TooManyRequests: {
|
|
225
|
+
retryAfter = response.headers.get('Retry-After');
|
|
226
|
+
throw new ShopifyErrors.HttpThrottlingError({
|
|
227
|
+
message: "Shopify is throttling requests".concat(errorMessage),
|
|
228
|
+
code: code,
|
|
229
|
+
statusText: statusText,
|
|
230
|
+
body: body,
|
|
231
|
+
headers: headers,
|
|
232
|
+
retryAfter: retryAfter ? parseFloat(retryAfter) : undefined,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
case response.status >= network_1.StatusCode.InternalServerError:
|
|
236
|
+
throw new ShopifyErrors.HttpInternalError({
|
|
237
|
+
message: "Shopify internal error".concat(errorMessage),
|
|
238
|
+
code: code,
|
|
239
|
+
statusText: statusText,
|
|
240
|
+
body: body,
|
|
241
|
+
headers: headers,
|
|
242
|
+
});
|
|
243
|
+
default:
|
|
244
|
+
throw new ShopifyErrors.HttpResponseError({
|
|
245
|
+
message: "Received an error response (".concat(response.status, " ").concat(response.statusText, ") from Shopify").concat(errorMessage),
|
|
246
|
+
code: code,
|
|
247
|
+
statusText: statusText,
|
|
248
|
+
body: body,
|
|
249
|
+
headers: headers,
|
|
250
|
+
});
|
|
253
251
|
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
252
|
+
}
|
|
253
|
+
return [3 /*break*/, 4];
|
|
254
|
+
case 3:
|
|
255
|
+
error_2 = _a.sent();
|
|
256
|
+
if (error_2 instanceof ShopifyErrors.ShopifyError) {
|
|
257
|
+
throw error_2;
|
|
259
258
|
}
|
|
260
259
|
else {
|
|
261
|
-
throw new ShopifyErrors.HttpRequestError("Failed to make Shopify HTTP request: "
|
|
260
|
+
throw new ShopifyErrors.HttpRequestError("Failed to make Shopify HTTP request: ".concat(error_2));
|
|
262
261
|
}
|
|
263
|
-
|
|
262
|
+
return [3 /*break*/, 4];
|
|
263
|
+
case 4: return [2 /*return*/];
|
|
264
|
+
}
|
|
264
265
|
});
|
|
265
266
|
});
|
|
266
267
|
};
|
|
@@ -34,7 +34,9 @@ var RestClient = /** @class */ (function (_super) {
|
|
|
34
34
|
link = ret.headers.get('link');
|
|
35
35
|
if (link !== undefined) {
|
|
36
36
|
pageInfo = {
|
|
37
|
-
limit: ((_a = params.query) === null || _a === void 0 ? void 0 : _a.limit)
|
|
37
|
+
limit: ((_a = params.query) === null || _a === void 0 ? void 0 : _a.limit)
|
|
38
|
+
? (_b = params.query) === null || _b === void 0 ? void 0 : _b.limit.toString()
|
|
39
|
+
: RestClient.DEFAULT_LIMIT,
|
|
38
40
|
};
|
|
39
41
|
if (link) {
|
|
40
42
|
links = link.split(', ');
|
|
@@ -84,10 +86,10 @@ var RestClient = /** @class */ (function (_super) {
|
|
|
84
86
|
RestClient.prototype.getRequestPath = function (path) {
|
|
85
87
|
var cleanPath = _super.prototype.getRequestPath.call(this, path);
|
|
86
88
|
if (cleanPath.startsWith('/admin')) {
|
|
87
|
-
return cleanPath.replace(/\.json$/, '')
|
|
89
|
+
return "".concat(cleanPath.replace(/\.json$/, ''), ".json");
|
|
88
90
|
}
|
|
89
91
|
else {
|
|
90
|
-
return "/admin/api/"
|
|
92
|
+
return "/admin/api/".concat(context_1.Context.API_VERSION).concat(cleanPath.replace(/\.json$/, ''), ".json");
|
|
91
93
|
}
|
|
92
94
|
};
|
|
93
95
|
RestClient.prototype.buildRequestParams = function (newPageUrl) {
|
package/dist/context.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { SessionStorage } from './auth/session/session_storage';
|
|
|
2
2
|
import { ContextParams } from './base-types';
|
|
3
3
|
import { AuthScopes } from './auth/scopes';
|
|
4
4
|
interface ContextInterface extends ContextParams {
|
|
5
|
+
HOST_SCHEME: string;
|
|
5
6
|
SESSION_STORAGE: SessionStorage;
|
|
6
7
|
SCOPES: AuthScopes;
|
|
7
8
|
/**
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,cAAc,EAAC,MAAM,gCAAgC,CAAC;AAE9D,OAAO,EAAa,aAAa,EAAC,MAAM,cAAc,CAAC;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAEzC,UAAU,gBAAiB,SAAQ,aAAa;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,cAAc,CAAC;IAChC,MAAM,EAAE,UAAU,CAAC;IAEnB;;;;OAIG;IACH,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAAC;IAExC;;OAEG;IACH,oBAAoB,IAAI,IAAI,GAAG,KAAK,CAAC;IAErC;;OAEG;IACH,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,KAAK,CAAC;CAClD;AAOD,QAAA,MAAM,OAAO,EAAE,gBAqFd,CAAC;AAEF,OAAO,EAAC,OAAO,EAAE,gBAAgB,EAAC,CAAC"}
|
package/dist/context.js
CHANGED
|
@@ -2,20 +2,26 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Context = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
+
var path_1 = tslib_1.__importDefault(require("path"));
|
|
5
6
|
var ShopifyErrors = tslib_1.__importStar(require("./error"));
|
|
6
|
-
var
|
|
7
|
+
var sqlite_1 = require("./auth/session/storage/sqlite");
|
|
7
8
|
var base_types_1 = require("./base-types");
|
|
8
9
|
var scopes_1 = require("./auth/scopes");
|
|
10
|
+
var dbFile = path_1.default.join(require.main ? path_1.default.dirname(require.main.filename) : process.cwd(), 'database.sqlite');
|
|
9
11
|
var Context = {
|
|
10
12
|
API_KEY: '',
|
|
11
13
|
API_SECRET_KEY: '',
|
|
12
14
|
SCOPES: new scopes_1.AuthScopes([]),
|
|
13
15
|
HOST_NAME: '',
|
|
16
|
+
HOST_SCHEME: 'https',
|
|
14
17
|
API_VERSION: base_types_1.ApiVersion.Unstable,
|
|
15
18
|
IS_EMBEDDED_APP: true,
|
|
16
19
|
IS_PRIVATE_APP: false,
|
|
17
|
-
SESSION_STORAGE
|
|
20
|
+
// TS hack as SESSION_STORAGE is guaranteed to be set
|
|
21
|
+
// to a correct value in `initialize()`.
|
|
22
|
+
SESSION_STORAGE: null,
|
|
18
23
|
initialize: function (params) {
|
|
24
|
+
var _a;
|
|
19
25
|
var scopes;
|
|
20
26
|
if (params.SCOPES instanceof scopes_1.AuthScopes) {
|
|
21
27
|
scopes = params.SCOPES;
|
|
@@ -38,7 +44,7 @@ var Context = {
|
|
|
38
44
|
missing.push('HOST_NAME');
|
|
39
45
|
}
|
|
40
46
|
if (missing.length) {
|
|
41
|
-
throw new ShopifyErrors.ShopifyError("Cannot initialize Shopify API Library. Missing values for: "
|
|
47
|
+
throw new ShopifyErrors.ShopifyError("Cannot initialize Shopify API Library. Missing values for: ".concat(missing.join(', ')));
|
|
42
48
|
}
|
|
43
49
|
this.API_KEY = params.API_KEY;
|
|
44
50
|
this.API_SECRET_KEY = params.API_SECRET_KEY;
|
|
@@ -47,8 +53,10 @@ var Context = {
|
|
|
47
53
|
this.API_VERSION = params.API_VERSION;
|
|
48
54
|
this.IS_EMBEDDED_APP = params.IS_EMBEDDED_APP;
|
|
49
55
|
this.IS_PRIVATE_APP = params.IS_PRIVATE_APP;
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
this.SESSION_STORAGE =
|
|
57
|
+
(_a = params.SESSION_STORAGE) !== null && _a !== void 0 ? _a : new sqlite_1.SQLiteSessionStorage(dbFile);
|
|
58
|
+
if (params.HOST_SCHEME) {
|
|
59
|
+
this.HOST_SCHEME = params.HOST_SCHEME;
|
|
52
60
|
}
|
|
53
61
|
if (params.USER_AGENT_PREFIX) {
|
|
54
62
|
this.USER_AGENT_PREFIX = params.USER_AGENT_PREFIX;
|
package/dist/error.js
CHANGED
|
@@ -5,12 +5,12 @@ var tslib_1 = require("tslib");
|
|
|
5
5
|
var ShopifyError = /** @class */ (function (_super) {
|
|
6
6
|
tslib_1.__extends(ShopifyError, _super);
|
|
7
7
|
function ShopifyError() {
|
|
8
|
-
var _newTarget = this.constructor;
|
|
9
8
|
var args = [];
|
|
10
9
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
11
10
|
args[_i] = arguments[_i];
|
|
12
11
|
}
|
|
13
|
-
var
|
|
12
|
+
var _newTarget = this.constructor;
|
|
13
|
+
var _this = _super.apply(this, tslib_1.__spreadArray([], tslib_1.__read(args), false)) || this;
|
|
14
14
|
Object.setPrototypeOf(_this, _newTarget.prototype);
|
|
15
15
|
return _this;
|
|
16
16
|
}
|
|
@@ -124,8 +124,9 @@ exports.HttpInternalError = HttpInternalError;
|
|
|
124
124
|
var HttpThrottlingError = /** @class */ (function (_super) {
|
|
125
125
|
tslib_1.__extends(HttpThrottlingError, _super);
|
|
126
126
|
function HttpThrottlingError(_a) {
|
|
127
|
+
var _this = this;
|
|
127
128
|
var retryAfter = _a.retryAfter, params = tslib_1.__rest(_a, ["retryAfter"]);
|
|
128
|
-
|
|
129
|
+
_this = _super.call(this, params) || this;
|
|
129
130
|
_this.response.retryAfter = retryAfter;
|
|
130
131
|
return _this;
|
|
131
132
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,11 @@ export declare const Shopify: {
|
|
|
15
15
|
Session: typeof import("./auth/session/session").Session;
|
|
16
16
|
MemorySessionStorage: typeof import("./auth/session").MemorySessionStorage;
|
|
17
17
|
CustomSessionStorage: typeof import("./auth/session").CustomSessionStorage;
|
|
18
|
+
MySQLSessionStorage: typeof import("./auth/session").MySQLSessionStorage;
|
|
19
|
+
MongoDBSessionStorage: typeof import("./auth/session").MongoDBSessionStorage;
|
|
20
|
+
PostgreSQLSessionStorage: typeof import("./auth/session").PostgreSQLSessionStorage;
|
|
21
|
+
RedisSessionStorage: typeof import("./auth/session").RedisSessionStorage;
|
|
22
|
+
SQLiteSessionStorage: typeof import("./auth/session").SQLiteSessionStorage;
|
|
18
23
|
};
|
|
19
24
|
Clients: {
|
|
20
25
|
Rest: typeof import("./clients/rest/rest_client").RestClient;
|
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"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaymentTransaction = exports.PaymentGateway = exports.Payment = exports.Page = exports.OrderRisk = exports.Order = exports.MobilePlatformApplication = exports.Metafield = exports.MarketingEvent = exports.LocationsForMove = exports.Location = exports.InventoryLevel = exports.InventoryItem = exports.Image = exports.GiftCardAdjustment = exports.GiftCard = exports.FulfillmentService = exports.FulfillmentRequest = exports.FulfillmentOrder = exports.FulfillmentEvent = exports.Fulfillment = exports.Event = exports.DraftOrder = exports.Dispute = exports.DiscountCode = exports.DeprecatedApiCall = exports.CustomerSavedSearch = exports.CustomerAddress = exports.Customer = exports.CustomCollection = exports.Currency = exports.Country = exports.Comment = exports.CollectionListing = exports.Collection = exports.Collect = exports.Checkout = exports.CarrierService = exports.CancellationRequest = exports.Blog = exports.Balance = exports.AssignedFulfillmentOrder = exports.Asset = exports.Article = exports.ApplicationCredit = exports.ApplicationCharge = exports.ApplePayCertificate = exports.AndroidPayKey = exports.AccessScope = exports.AbandonedCheckout = void 0;
|
|
4
|
+
exports.Webhook = exports.Variant = exports.User = exports.UsageCharge = exports.Transaction = exports.Theme = exports.TenderTransaction = exports.StorefrontAccessToken = exports.SmartCollection = exports.Shop = exports.ShippingZone = exports.ScriptTag = exports.ResourceFeedback = exports.Report = exports.Refund = exports.Redirect = exports.RecurringApplicationCharge = exports.Province = exports.ProductResourceFeedback = exports.ProductListing = exports.Product = exports.PriceRule = exports.Policy = exports.Payout = void 0;
|
|
3
5
|
var abandoned_checkout_1 = require("./abandoned_checkout");
|
|
4
6
|
Object.defineProperty(exports, "AbandonedCheckout", { enumerable: true, get: function () { return abandoned_checkout_1.AbandonedCheckout; } });
|
|
5
7
|
var access_scope_1 = require("./access_scope");
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaymentTransaction = exports.PaymentGateway = exports.Payment = exports.Page = exports.OrderRisk = exports.Order = exports.MobilePlatformApplication = exports.Metafield = exports.MarketingEvent = exports.LocationsForMove = exports.Location = exports.InventoryLevel = exports.InventoryItem = exports.Image = exports.GiftCardAdjustment = exports.GiftCard = exports.FulfillmentService = exports.FulfillmentRequest = exports.FulfillmentOrder = exports.FulfillmentEvent = exports.Fulfillment = exports.Event = exports.DraftOrder = exports.Dispute = exports.DiscountCode = exports.DeprecatedApiCall = exports.CustomerSavedSearch = exports.CustomerAddress = exports.Customer = exports.CustomCollection = exports.Currency = exports.Country = exports.Comment = exports.CollectionListing = exports.Collection = exports.Collect = exports.Checkout = exports.CarrierService = exports.CancellationRequest = exports.Blog = exports.Balance = exports.AssignedFulfillmentOrder = exports.Asset = exports.Article = exports.ApplicationCredit = exports.ApplicationCharge = exports.ApplePayCertificate = exports.AndroidPayKey = exports.AccessScope = exports.AbandonedCheckout = void 0;
|
|
4
|
+
exports.Webhook = exports.Variant = exports.User = exports.UsageCharge = exports.Transaction = exports.Theme = exports.TenderTransaction = exports.StorefrontAccessToken = exports.SmartCollection = exports.Shop = exports.ShippingZone = exports.ScriptTag = exports.ResourceFeedback = exports.Report = exports.Refund = exports.Redirect = exports.RecurringApplicationCharge = exports.Province = exports.ProductResourceFeedback = exports.ProductListing = exports.Product = exports.PriceRule = exports.Policy = exports.Payout = void 0;
|
|
3
5
|
var abandoned_checkout_1 = require("./abandoned_checkout");
|
|
4
6
|
Object.defineProperty(exports, "AbandonedCheckout", { enumerable: true, get: function () { return abandoned_checkout_1.AbandonedCheckout; } });
|
|
5
7
|
var access_scope_1 = require("./access_scope");
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaymentTransaction = exports.PaymentGateway = exports.Payment = exports.Page = exports.OrderRisk = exports.Order = exports.MobilePlatformApplication = exports.Metafield = exports.MarketingEvent = exports.LocationsForMove = exports.Location = exports.InventoryLevel = exports.InventoryItem = exports.Image = exports.GiftCardAdjustment = exports.GiftCard = exports.FulfillmentService = exports.FulfillmentRequest = exports.FulfillmentOrder = exports.FulfillmentEvent = exports.Fulfillment = exports.Event = exports.DraftOrder = exports.Dispute = exports.DiscountCode = exports.DeprecatedApiCall = exports.CustomerSavedSearch = exports.CustomerAddress = exports.Customer = exports.CustomCollection = exports.Currency = exports.Country = exports.Comment = exports.CollectionListing = exports.Collection = exports.Collect = exports.Checkout = exports.CarrierService = exports.CancellationRequest = exports.Blog = exports.Balance = exports.AssignedFulfillmentOrder = exports.Asset = exports.Article = exports.ApplicationCredit = exports.ApplicationCharge = exports.ApplePayCertificate = exports.AndroidPayKey = exports.AccessScope = exports.AbandonedCheckout = void 0;
|
|
4
|
+
exports.Webhook = exports.Variant = exports.User = exports.UsageCharge = exports.Transaction = exports.Theme = exports.TenderTransaction = exports.StorefrontAccessToken = exports.SmartCollection = exports.Shop = exports.ShippingZone = exports.ScriptTag = exports.ResourceFeedback = exports.Report = exports.Refund = exports.Redirect = exports.RecurringApplicationCharge = exports.Province = exports.ProductResourceFeedback = exports.ProductListing = exports.Product = exports.PriceRule = exports.Policy = exports.Payout = void 0;
|
|
3
5
|
var abandoned_checkout_1 = require("./abandoned_checkout");
|
|
4
6
|
Object.defineProperty(exports, "AbandonedCheckout", { enumerable: true, get: function () { return abandoned_checkout_1.AbandonedCheckout; } });
|
|
5
7
|
var access_scope_1 = require("./access_scope");
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaymentTransaction = exports.PaymentGateway = exports.Payment = exports.Page = exports.OrderRisk = exports.Order = exports.MobilePlatformApplication = exports.Metafield = exports.MarketingEvent = exports.LocationsForMove = exports.Location = exports.InventoryLevel = exports.InventoryItem = exports.Image = exports.GiftCardAdjustment = exports.GiftCard = exports.FulfillmentService = exports.FulfillmentRequest = exports.FulfillmentOrder = exports.FulfillmentEvent = exports.Fulfillment = exports.Event = exports.DraftOrder = exports.Dispute = exports.DiscountCode = exports.DeprecatedApiCall = exports.CustomerSavedSearch = exports.CustomerAddress = exports.Customer = exports.CustomCollection = exports.Currency = exports.Country = exports.Comment = exports.CollectionListing = exports.Collection = exports.Collect = exports.Checkout = exports.CarrierService = exports.CancellationRequest = exports.Blog = exports.Balance = exports.AssignedFulfillmentOrder = exports.Asset = exports.Article = exports.ApplicationCredit = exports.ApplicationCharge = exports.ApplePayCertificate = exports.AndroidPayKey = exports.AccessScope = exports.AbandonedCheckout = void 0;
|
|
4
|
+
exports.Webhook = exports.Variant = exports.User = exports.UsageCharge = exports.Transaction = exports.Theme = exports.TenderTransaction = exports.StorefrontAccessToken = exports.SmartCollection = exports.Shop = exports.ShippingZone = exports.ScriptTag = exports.ResourceFeedback = exports.Report = exports.Refund = exports.Redirect = exports.RecurringApplicationCharge = exports.Province = exports.ProductResourceFeedback = exports.ProductListing = exports.Product = exports.PriceRule = exports.Policy = exports.Payout = void 0;
|
|
3
5
|
var abandoned_checkout_1 = require("./abandoned_checkout");
|
|
4
6
|
Object.defineProperty(exports, "AbandonedCheckout", { enumerable: true, get: function () { return abandoned_checkout_1.AbandonedCheckout; } });
|
|
5
7
|
var access_scope_1 = require("./access_scope");
|
|
@@ -20,7 +20,7 @@ function decodeSessionToken(token) {
|
|
|
20
20
|
});
|
|
21
21
|
}
|
|
22
22
|
catch (error) {
|
|
23
|
-
throw new ShopifyErrors.InvalidJwtError("Failed to parse session token '"
|
|
23
|
+
throw new ShopifyErrors.InvalidJwtError("Failed to parse session token '".concat(token, "': ").concat(error.message));
|
|
24
24
|
}
|
|
25
25
|
// The exp and nbf fields are validated by the JWT library
|
|
26
26
|
if (payload.aud !== context_1.Context.API_KEY) {
|
|
@@ -10,7 +10,7 @@ function graphqlProxy(userReq, userRes) {
|
|
|
10
10
|
var _this = this;
|
|
11
11
|
return tslib_1.__generator(this, function (_a) {
|
|
12
12
|
switch (_a.label) {
|
|
13
|
-
case 0: return [4 /*yield*/, load_current_session_1.default(userReq, userRes)];
|
|
13
|
+
case 0: return [4 /*yield*/, (0, load_current_session_1.default)(userReq, userRes)];
|
|
14
14
|
case 1:
|
|
15
15
|
session = _a.sent();
|
|
16
16
|
if (!session) {
|