@shopify/shopify-api 4.2.0 → 5.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 +11 -4
- package/dist/auth/oauth/oauth.d.ts.map +1 -1
- package/dist/auth/oauth/oauth.js +7 -5
- package/dist/auth/session/storage/custom.d.ts.map +1 -1
- package/dist/auth/session/storage/custom.js +5 -2
- package/dist/auth/session/storage/memory.d.ts.map +1 -1
- package/dist/auth/session/storage/memory.js +4 -2
- package/dist/auth/session/storage/mongodb.d.ts.map +1 -1
- package/dist/auth/session/storage/mongodb.js +4 -2
- package/dist/auth/session/storage/mysql.d.ts.map +1 -1
- package/dist/auth/session/storage/mysql.js +4 -2
- package/dist/auth/session/storage/postgresql.d.ts.map +1 -1
- package/dist/auth/session/storage/postgresql.js +4 -2
- package/dist/auth/session/storage/redis.d.ts +2 -1
- package/dist/auth/session/storage/redis.d.ts.map +1 -1
- package/dist/auth/session/storage/redis.js +5 -5
- package/dist/auth/session/storage/sqlite.d.ts.map +1 -1
- package/dist/auth/session/storage/sqlite.js +6 -3
- package/dist/base-types.d.ts +1 -0
- package/dist/base-types.d.ts.map +1 -1
- package/dist/clients/graphql/graphql_client.d.ts.map +1 -1
- package/dist/clients/graphql/graphql_client.js +25 -14
- package/dist/clients/http_client/http_client.js +1 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +3 -0
- package/dist/error.d.ts +13 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +20 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/utils/delete-offline-session.d.ts.map +1 -1
- package/dist/utils/delete-offline-session.js +4 -2
- package/dist/utils/get-embedded-app-url.d.ts.map +1 -1
- package/dist/utils/get-embedded-app-url.js +2 -1
- package/dist/utils/index.d.ts +3 -2
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -2
- package/dist/utils/load-offline-session.d.ts.map +1 -1
- package/dist/utils/load-offline-session.js +4 -2
- package/dist/utils/setup-jest.d.ts.map +1 -1
- package/dist/utils/setup-jest.js +1 -0
- package/dist/utils/shop-validator.d.ts +12 -3
- package/dist/utils/shop-validator.d.ts.map +1 -1
- package/dist/utils/shop-validator.js +39 -7
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/webhooks/registry.d.ts.map +1 -1
- package/dist/webhooks/registry.js +21 -18
- package/package.json +1 -1
- package/dist/__tests__/fake-resource-with-custom-prefix.d.ts +0 -21
- package/dist/__tests__/fake-resource-with-custom-prefix.d.ts.map +0 -1
- package/dist/__tests__/fake-resource-with-custom-prefix.js +0 -46
- package/dist/__tests__/fake-resource.d.ts +0 -41
- package/dist/__tests__/fake-resource.d.ts.map +0 -1
- package/dist/__tests__/fake-resource.js +0 -122
- package/dist/auth/session/storage/__tests__/battery-of-tests.d.ts +0 -3
- package/dist/auth/session/storage/__tests__/battery-of-tests.d.ts.map +0 -1
- package/dist/auth/session/storage/__tests__/battery-of-tests.js +0 -315
- package/dist/auth/session/storage/__tests__/session-test-utils.d.ts +0 -3
- package/dist/auth/session/storage/__tests__/session-test-utils.d.ts.map +0 -1
- package/dist/auth/session/storage/__tests__/session-test-utils.js +0 -46
- package/dist/auth/session/storage/__tests__/utils.d.ts +0 -10
- package/dist/auth/session/storage/__tests__/utils.d.ts.map +0 -1
- package/dist/auth/session/storage/__tests__/utils.js +0 -87
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
4
|
var ShopifyErrors = tslib_1.__importStar(require("../error"));
|
|
5
5
|
var context_1 = require("../context");
|
|
6
|
+
var shop_validator_1 = require("./shop-validator");
|
|
6
7
|
/**
|
|
7
8
|
* Helper method to get the host URL for the app.
|
|
8
9
|
*
|
|
@@ -17,7 +18,7 @@ function getEmbeddedAppUrl(request) {
|
|
|
17
18
|
}
|
|
18
19
|
var url = new URL(request.url, "https://".concat(request.headers.host));
|
|
19
20
|
var host = url.searchParams.get('host');
|
|
20
|
-
if (typeof host !== 'string') {
|
|
21
|
+
if (typeof host !== 'string' || !(0, shop_validator_1.sanitizeHost)(host)) {
|
|
21
22
|
throw new ShopifyErrors.InvalidRequestError('Request does not contain a host query parameter');
|
|
22
23
|
}
|
|
23
24
|
var decodedHost = Buffer.from(host, 'base64').toString();
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import graphqlProxy from './graphql_proxy';
|
|
|
8
8
|
import safeCompare from './safe-compare';
|
|
9
9
|
import storeSession from './store-session';
|
|
10
10
|
import validateHmac from './hmac-validator';
|
|
11
|
-
import
|
|
11
|
+
import { sanitizeShop, sanitizeHost } from './shop-validator';
|
|
12
12
|
import versionCompatible from './version-compatible';
|
|
13
13
|
import withSession from './with-session';
|
|
14
14
|
import getEmbeddedAppUrl from './get-embedded-app-url';
|
|
@@ -23,7 +23,8 @@ declare const ShopifyUtils: {
|
|
|
23
23
|
safeCompare: typeof safeCompare;
|
|
24
24
|
storeSession: typeof storeSession;
|
|
25
25
|
validateHmac: typeof validateHmac;
|
|
26
|
-
|
|
26
|
+
sanitizeShop: typeof sanitizeShop;
|
|
27
|
+
sanitizeHost: typeof sanitizeHost;
|
|
27
28
|
versionCompatible: typeof versionCompatible;
|
|
28
29
|
withSession: typeof withSession;
|
|
29
30
|
getEmbeddedAppUrl: typeof getEmbeddedAppUrl;
|
|
@@ -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;
|
|
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,EAAC,YAAY,EAAE,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAC5D,OAAO,iBAAiB,MAAM,sBAAsB,CAAC;AACrD,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AAEvD,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;CAgBjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -11,7 +11,7 @@ var graphql_proxy_1 = tslib_1.__importDefault(require("./graphql_proxy"));
|
|
|
11
11
|
var safe_compare_1 = tslib_1.__importDefault(require("./safe-compare"));
|
|
12
12
|
var store_session_1 = tslib_1.__importDefault(require("./store-session"));
|
|
13
13
|
var hmac_validator_1 = tslib_1.__importDefault(require("./hmac-validator"));
|
|
14
|
-
var shop_validator_1 =
|
|
14
|
+
var shop_validator_1 = 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
17
|
var get_embedded_app_url_1 = tslib_1.__importDefault(require("./get-embedded-app-url"));
|
|
@@ -26,7 +26,8 @@ var ShopifyUtils = {
|
|
|
26
26
|
safeCompare: safe_compare_1.default,
|
|
27
27
|
storeSession: store_session_1.default,
|
|
28
28
|
validateHmac: hmac_validator_1.default,
|
|
29
|
-
|
|
29
|
+
sanitizeShop: shop_validator_1.sanitizeShop,
|
|
30
|
+
sanitizeHost: shop_validator_1.sanitizeHost,
|
|
30
31
|
versionCompatible: version_compatible_1.default,
|
|
31
32
|
withSession: with_session_1.default,
|
|
32
33
|
getEmbeddedAppUrl: get_embedded_app_url_1.default,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-offline-session.d.ts","sourceRoot":"","sources":["../../src/utils/load-offline-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"load-offline-session.d.ts","sourceRoot":"","sources":["../../src/utils/load-offline-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,yBAAyB,CAAC;AAMhD;;;;;;;GAOG;AACH,wBAA8B,kBAAkB,CAC9C,IAAI,EAAE,MAAM,EACZ,cAAc,UAAQ,GACrB,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAmB9B"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
4
|
var context_1 = require("../context");
|
|
5
5
|
var oauth_1 = tslib_1.__importDefault(require("../auth/oauth"));
|
|
6
|
+
var shop_validator_1 = require("./shop-validator");
|
|
6
7
|
/**
|
|
7
8
|
* Helper method for quickly loading offline sessions by shop url.
|
|
8
9
|
* By default, returns undefined if there is no session, or the session found is expired.
|
|
@@ -14,12 +15,13 @@ var oauth_1 = tslib_1.__importDefault(require("../auth/oauth"));
|
|
|
14
15
|
function loadOfflineSession(shop, includeExpired) {
|
|
15
16
|
if (includeExpired === void 0) { includeExpired = false; }
|
|
16
17
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
17
|
-
var sessionId, session, now;
|
|
18
|
+
var cleanShop, sessionId, session, now;
|
|
18
19
|
return tslib_1.__generator(this, function (_a) {
|
|
19
20
|
switch (_a.label) {
|
|
20
21
|
case 0:
|
|
21
22
|
context_1.Context.throwIfUninitialized();
|
|
22
|
-
|
|
23
|
+
cleanShop = (0, shop_validator_1.sanitizeShop)(shop, true);
|
|
24
|
+
sessionId = oauth_1.default.getOfflineSessionId(cleanShop);
|
|
23
25
|
return [4 /*yield*/, context_1.Context.SESSION_STORAGE.loadSession(sessionId)];
|
|
24
26
|
case 1:
|
|
25
27
|
session = _a.sent();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-jest.d.ts","sourceRoot":"","sources":["../../src/utils/setup-jest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup-jest.d.ts","sourceRoot":"","sources":["../../src/utils/setup-jest.ts"],"names":[],"mappings":"AAuCA,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,IAAI,CAAC;QAEb,UAAU,QAAQ,CAAC,CAAC;YAClB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CAAC;YAC7D,sBAAsB,IAAI,CAAC,CAAC;SAC7B;KAEF;CACF"}
|
package/dist/utils/setup-jest.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Validates
|
|
2
|
+
* Validates and sanitizes shop domain urls. If Context.CUSTOM_SHOP_DOMAINS is set, shops ending in those domains are
|
|
3
|
+
* allowed. Accepts myshopify.com and myshopify.io by default.
|
|
3
4
|
*
|
|
4
|
-
* @param shop Shop url: {shop}.
|
|
5
|
+
* @param shop Shop url: {shop}.{domain}
|
|
6
|
+
* @param throwOnInvalid Whether to raise an exception if the shop is invalid
|
|
5
7
|
*/
|
|
6
|
-
export
|
|
8
|
+
export declare function sanitizeShop(shop: string, throwOnInvalid?: boolean): string | null;
|
|
9
|
+
/**
|
|
10
|
+
* Validates and sanitizes Shopify host arguments.
|
|
11
|
+
*
|
|
12
|
+
* @param host Host address
|
|
13
|
+
* @param throwOnInvalid Whether to raise an exception if the host is invalid
|
|
14
|
+
*/
|
|
15
|
+
export declare function sanitizeHost(host: string, throwOnInvalid?: boolean): string | null;
|
|
7
16
|
//# sourceMappingURL=shop-validator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shop-validator.d.ts","sourceRoot":"","sources":["../../src/utils/shop-validator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shop-validator.d.ts","sourceRoot":"","sources":["../../src/utils/shop-validator.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,cAAc,UAAQ,GACrB,MAAM,GAAG,IAAI,CAoBf;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,cAAc,UAAQ,GACrB,MAAM,GAAG,IAAI,CAUf"}
|
|
@@ -1,13 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sanitizeHost = exports.sanitizeShop = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var error_1 = require("../error");
|
|
6
|
+
var context_1 = require("../context");
|
|
3
7
|
/**
|
|
4
|
-
* Validates
|
|
8
|
+
* Validates and sanitizes shop domain urls. If Context.CUSTOM_SHOP_DOMAINS is set, shops ending in those domains are
|
|
9
|
+
* allowed. Accepts myshopify.com and myshopify.io by default.
|
|
5
10
|
*
|
|
6
|
-
* @param shop Shop url: {shop}.
|
|
11
|
+
* @param shop Shop url: {shop}.{domain}
|
|
12
|
+
* @param throwOnInvalid Whether to raise an exception if the shop is invalid
|
|
7
13
|
*/
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
14
|
+
function sanitizeShop(shop, throwOnInvalid) {
|
|
15
|
+
if (throwOnInvalid === void 0) { throwOnInvalid = false; }
|
|
16
|
+
var domainsRegex = ['myshopify\\.com', 'myshopify\\.io'];
|
|
17
|
+
if (context_1.Context.CUSTOM_SHOP_DOMAINS) {
|
|
18
|
+
domainsRegex.push.apply(domainsRegex, tslib_1.__spreadArray([], tslib_1.__read(context_1.Context.CUSTOM_SHOP_DOMAINS.map(function (regex) {
|
|
19
|
+
return typeof regex === 'string' ? regex : regex.source;
|
|
20
|
+
})), false));
|
|
21
|
+
}
|
|
22
|
+
var shopUrlRegex = new RegExp("^[a-zA-Z0-9][a-zA-Z0-9-_]*\\.(".concat(domainsRegex.join('|'), ")[/]*$"));
|
|
23
|
+
var sanitizedShop = shopUrlRegex.test(shop) ? shop : null;
|
|
24
|
+
if (!sanitizedShop && throwOnInvalid) {
|
|
25
|
+
throw new error_1.InvalidShopError('Received invalid shop argument');
|
|
26
|
+
}
|
|
27
|
+
return sanitizedShop;
|
|
12
28
|
}
|
|
13
|
-
exports.
|
|
29
|
+
exports.sanitizeShop = sanitizeShop;
|
|
30
|
+
/**
|
|
31
|
+
* Validates and sanitizes Shopify host arguments.
|
|
32
|
+
*
|
|
33
|
+
* @param host Host address
|
|
34
|
+
* @param throwOnInvalid Whether to raise an exception if the host is invalid
|
|
35
|
+
*/
|
|
36
|
+
function sanitizeHost(host, throwOnInvalid) {
|
|
37
|
+
if (throwOnInvalid === void 0) { throwOnInvalid = false; }
|
|
38
|
+
var base64regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
39
|
+
var sanitizedHost = base64regex.test(host) ? host : null;
|
|
40
|
+
if (!sanitizedHost && throwOnInvalid) {
|
|
41
|
+
throw new error_1.InvalidHostError('Received invalid host argument');
|
|
42
|
+
}
|
|
43
|
+
return sanitizedHost;
|
|
44
|
+
}
|
|
45
|
+
exports.sanitizeHost = sanitizeHost;
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SHOPIFY_API_LIBRARY_VERSION = "
|
|
1
|
+
export declare const SHOPIFY_API_LIBRARY_VERSION = "5.0.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/webhooks/registry.ts"],"names":[],"mappings":";AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AAUxB,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EACd,oBAAoB,EAEpB,wBAAwB,EACzB,MAAM,SAAS,CAAC;AAEjB,UAAU,gBAAgB;IACxB,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB,CAAC;CACvC;AAED,UAAU,iBAAiB;IACzB,eAAe,EAAE;QAAC,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB,CAAA;KAAC,CAAC;IAEzD;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAE/D;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAE9C;;;;OAIG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAAC;IAEvD;;OAEG;IACH,SAAS,IAAI,MAAM,EAAE,CAAC;IAEtB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE5D;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAExE;;;;;OAKG;IACH,OAAO,CACL,OAAO,EAAE,IAAI,CAAC,eAAe,EAC7B,QAAQ,EAAE,IAAI,CAAC,cAAc,GAC5B,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACtC;AAiCD,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAuB9C;AAED,iBAAS,UAAU,CACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,GAAE,cAAoC,EACpD,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAmDR;AAED,QAAA,MAAM,UAAU,EAAE,MAAM,EAIvB,CAAC;AAEF,QAAA,MAAM,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/webhooks/registry.ts"],"names":[],"mappings":";AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AAUxB,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EACd,oBAAoB,EAEpB,wBAAwB,EACzB,MAAM,SAAS,CAAC;AAEjB,UAAU,gBAAgB;IACxB,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB,CAAC;CACvC;AAED,UAAU,iBAAiB;IACzB,eAAe,EAAE;QAAC,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB,CAAA;KAAC,CAAC;IAEzD;;;;;OAKG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAE/D;;;;OAIG;IACH,WAAW,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAE9C;;;;OAIG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAAC;IAEvD;;OAEG;IACH,SAAS,IAAI,MAAM,EAAE,CAAC;IAEtB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE5D;;;;OAIG;IACH,WAAW,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAExE;;;;;OAKG;IACH,OAAO,CACL,OAAO,EAAE,IAAI,CAAC,eAAe,EAC7B,QAAQ,EAAE,IAAI,CAAC,cAAc,GAC5B,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACtC;AAiCD,iBAAS,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAuB9C;AAED,iBAAS,UAAU,CACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,GAAE,cAAoC,EACpD,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,CAmDR;AAED,QAAA,MAAM,UAAU,EAAE,MAAM,EAIvB,CAAC;AAEF,QAAA,MAAM,gBAAgB,EAAE,iBA4PvB,CAAC;AAEF,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,UAAU,GACX,CAAC"}
|
|
@@ -107,7 +107,7 @@ var WebhooksRegistry = {
|
|
|
107
107
|
register: function (_a) {
|
|
108
108
|
var path = _a.path, topic = _a.topic, accessToken = _a.accessToken, shop = _a.shop, _b = _a.deliveryMethod, deliveryMethod = _b === void 0 ? types_1.DeliveryMethod.Http : _b;
|
|
109
109
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
110
|
-
var registerReturn, client, address, checkResult, webhookId, mustRegister, node, endpointAddress, result;
|
|
110
|
+
var registerReturn, client, address, checkResult, error_1, result, webhookId, mustRegister, node, endpointAddress, result;
|
|
111
111
|
return tslib_1.__generator(this, function (_c) {
|
|
112
112
|
switch (_c.label) {
|
|
113
113
|
case 0:
|
|
@@ -130,19 +130,22 @@ var WebhooksRegistry = {
|
|
|
130
130
|
address = deliveryMethod === types_1.DeliveryMethod.Http
|
|
131
131
|
? "".concat(context_1.Context.HOST_SCHEME, "://").concat(context_1.Context.HOST_NAME).concat(path)
|
|
132
132
|
: path;
|
|
133
|
+
_c.label = 1;
|
|
134
|
+
case 1:
|
|
135
|
+
_c.trys.push([1, 3, , 4]);
|
|
133
136
|
return [4 /*yield*/, client.query({
|
|
134
137
|
data: buildCheckQuery(topic),
|
|
135
138
|
})];
|
|
136
|
-
case
|
|
139
|
+
case 2:
|
|
137
140
|
checkResult = (_c.sent());
|
|
141
|
+
return [3 /*break*/, 4];
|
|
142
|
+
case 3:
|
|
143
|
+
error_1 = _c.sent();
|
|
144
|
+
result = error_1 instanceof ShopifyErrors.GraphqlQueryError ? error_1.response : {};
|
|
145
|
+
registerReturn[topic] = { success: false, result: result };
|
|
146
|
+
return [2 /*return*/, registerReturn];
|
|
147
|
+
case 4:
|
|
138
148
|
mustRegister = true;
|
|
139
|
-
if ('errors' in checkResult.body) {
|
|
140
|
-
registerReturn[topic] = {
|
|
141
|
-
success: false,
|
|
142
|
-
result: checkResult.body,
|
|
143
|
-
};
|
|
144
|
-
return [2 /*return*/, registerReturn];
|
|
145
|
-
}
|
|
146
149
|
if (checkResult.body.data.webhookSubscriptions.edges.length) {
|
|
147
150
|
node = checkResult.body.data.webhookSubscriptions.edges[0].node;
|
|
148
151
|
endpointAddress = '';
|
|
@@ -157,24 +160,24 @@ var WebhooksRegistry = {
|
|
|
157
160
|
mustRegister = false;
|
|
158
161
|
}
|
|
159
162
|
}
|
|
160
|
-
if (!mustRegister) return [3 /*break*/,
|
|
163
|
+
if (!mustRegister) return [3 /*break*/, 6];
|
|
161
164
|
return [4 /*yield*/, client.query({
|
|
162
165
|
data: buildQuery(topic, address, deliveryMethod, webhookId),
|
|
163
166
|
})];
|
|
164
|
-
case
|
|
167
|
+
case 5:
|
|
165
168
|
result = _c.sent();
|
|
166
169
|
registerReturn[topic] = {
|
|
167
170
|
success: isSuccess(result.body, deliveryMethod, webhookId),
|
|
168
171
|
result: result.body,
|
|
169
172
|
};
|
|
170
|
-
return [3 /*break*/,
|
|
171
|
-
case
|
|
173
|
+
return [3 /*break*/, 7];
|
|
174
|
+
case 6:
|
|
172
175
|
registerReturn[topic] = {
|
|
173
176
|
success: true,
|
|
174
177
|
result: {},
|
|
175
178
|
};
|
|
176
|
-
_c.label =
|
|
177
|
-
case
|
|
179
|
+
_c.label = 7;
|
|
180
|
+
case 7: return [2 /*return*/, registerReturn];
|
|
178
181
|
}
|
|
179
182
|
});
|
|
180
183
|
});
|
|
@@ -242,7 +245,7 @@ var WebhooksRegistry = {
|
|
|
242
245
|
reqBody += chunk;
|
|
243
246
|
});
|
|
244
247
|
request.on('end', function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
245
|
-
var hmac, topic, domain, missingHeaders, statusCode, responseError, headers, generatedHash, graphqlTopic, webhookEntry,
|
|
248
|
+
var hmac, topic, domain, missingHeaders, statusCode, responseError, headers, generatedHash, graphqlTopic, webhookEntry, error_2;
|
|
246
249
|
return tslib_1.__generator(this, function (_a) {
|
|
247
250
|
switch (_a.label) {
|
|
248
251
|
case 0:
|
|
@@ -299,9 +302,9 @@ var WebhooksRegistry = {
|
|
|
299
302
|
statusCode = network_1.StatusCode.Ok;
|
|
300
303
|
return [3 /*break*/, 4];
|
|
301
304
|
case 3:
|
|
302
|
-
|
|
305
|
+
error_2 = _a.sent();
|
|
303
306
|
statusCode = network_1.StatusCode.InternalServerError;
|
|
304
|
-
responseError =
|
|
307
|
+
responseError = error_2;
|
|
305
308
|
return [3 /*break*/, 4];
|
|
306
309
|
case 4: return [3 /*break*/, 6];
|
|
307
310
|
case 5:
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import Base, { ResourcePath } from '../base-rest-resource';
|
|
2
|
-
import { SessionInterface } from '../auth/session/types';
|
|
3
|
-
import { ApiVersion } from '../base-types';
|
|
4
|
-
interface FakeResourceWithCustomPrefixFindArgs {
|
|
5
|
-
session: SessionInterface;
|
|
6
|
-
id: string | number;
|
|
7
|
-
}
|
|
8
|
-
export default class FakeResourceWithCustomPrefix extends Base {
|
|
9
|
-
static API_VERSION: ApiVersion;
|
|
10
|
-
protected static NAME: string;
|
|
11
|
-
protected static PLURAL_NAME: string;
|
|
12
|
-
protected static CUSTOM_PREFIX: string;
|
|
13
|
-
protected static HAS_ONE: {};
|
|
14
|
-
protected static HAS_MANY: {};
|
|
15
|
-
protected static PATHS: ResourcePath[];
|
|
16
|
-
static find: ({ session, id, }: FakeResourceWithCustomPrefixFindArgs) => Promise<FakeResourceWithCustomPrefix | null>;
|
|
17
|
-
id?: number | string | null;
|
|
18
|
-
attribute?: string | null;
|
|
19
|
-
}
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=fake-resource-with-custom-prefix.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fake-resource-with-custom-prefix.d.ts","sourceRoot":"","sources":["../../src/__tests__/fake-resource-with-custom-prefix.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAEzC,UAAU,oCAAoC;IAC5C,OAAO,EAAE,gBAAgB,CAAC;IAC1B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,OAAO,4BAA6B,SAAQ,IAAI;IAC5D,OAAc,WAAW,aAAuB;IAChD,SAAS,CAAC,MAAM,CAAC,IAAI,SAAsC;IAC3D,SAAS,CAAC,MAAM,CAAC,WAAW,SAAwC;IACpE,SAAS,CAAC,MAAM,CAAC,aAAa,SAA0B;IAExD,SAAS,CAAC,MAAM,CAAC,OAAO,KAAM;IAC9B,SAAS,CAAC,MAAM,CAAC,QAAQ,KAAM;IAE/B,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,CAOpC;IAEF,OAAc,IAAI,qBAGf,oCAAoC,KAAG,QAAQ,4BAA4B,GAAG,IAAI,CAAC,CAMpF;IAEF,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
|
-
var base_rest_resource_1 = tslib_1.__importDefault(require("../base-rest-resource"));
|
|
5
|
-
var base_types_1 = require("../base-types");
|
|
6
|
-
var FakeResourceWithCustomPrefix = /** @class */ (function (_super) {
|
|
7
|
-
tslib_1.__extends(FakeResourceWithCustomPrefix, _super);
|
|
8
|
-
function FakeResourceWithCustomPrefix() {
|
|
9
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
10
|
-
}
|
|
11
|
-
var _a;
|
|
12
|
-
_a = FakeResourceWithCustomPrefix;
|
|
13
|
-
FakeResourceWithCustomPrefix.API_VERSION = base_types_1.ApiVersion.Unstable;
|
|
14
|
-
FakeResourceWithCustomPrefix.NAME = 'fake_resource_with_custom_prefix';
|
|
15
|
-
FakeResourceWithCustomPrefix.PLURAL_NAME = 'fake_resource_with_custom_prefixes';
|
|
16
|
-
FakeResourceWithCustomPrefix.CUSTOM_PREFIX = '/admin/custom_prefix';
|
|
17
|
-
FakeResourceWithCustomPrefix.HAS_ONE = {};
|
|
18
|
-
FakeResourceWithCustomPrefix.HAS_MANY = {};
|
|
19
|
-
FakeResourceWithCustomPrefix.PATHS = [
|
|
20
|
-
{
|
|
21
|
-
http_method: 'get',
|
|
22
|
-
operation: 'get',
|
|
23
|
-
ids: ['id'],
|
|
24
|
-
path: 'fake_resource_with_custom_prefix/<id>.json',
|
|
25
|
-
},
|
|
26
|
-
];
|
|
27
|
-
FakeResourceWithCustomPrefix.find = function (_b) {
|
|
28
|
-
var session = _b.session, id = _b.id;
|
|
29
|
-
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
30
|
-
var result;
|
|
31
|
-
return tslib_1.__generator(_a, function (_c) {
|
|
32
|
-
switch (_c.label) {
|
|
33
|
-
case 0: return [4 /*yield*/, FakeResourceWithCustomPrefix.baseFind({
|
|
34
|
-
session: session,
|
|
35
|
-
urlIds: { id: id },
|
|
36
|
-
})];
|
|
37
|
-
case 1:
|
|
38
|
-
result = _c.sent();
|
|
39
|
-
return [2 /*return*/, result ? result[0] : null];
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
return FakeResourceWithCustomPrefix;
|
|
45
|
-
}(base_rest_resource_1.default));
|
|
46
|
-
exports.default = FakeResourceWithCustomPrefix;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import Base, { ParamSet, ResourcePath } from '../base-rest-resource';
|
|
2
|
-
import { SessionInterface } from '../auth/session/types';
|
|
3
|
-
import { ApiVersion } from '../base-types';
|
|
4
|
-
interface FakeResourceFindArgs {
|
|
5
|
-
params?: ParamSet;
|
|
6
|
-
session: SessionInterface;
|
|
7
|
-
id: number;
|
|
8
|
-
other_resource_id?: number | null;
|
|
9
|
-
}
|
|
10
|
-
interface FakeResourceAllArgs {
|
|
11
|
-
params?: ParamSet;
|
|
12
|
-
session: SessionInterface;
|
|
13
|
-
}
|
|
14
|
-
interface FakeResourceCustomArgs {
|
|
15
|
-
session: SessionInterface;
|
|
16
|
-
id: number;
|
|
17
|
-
other_resource_id: number;
|
|
18
|
-
}
|
|
19
|
-
export default class FakeResource extends Base {
|
|
20
|
-
static API_VERSION: ApiVersion;
|
|
21
|
-
protected static NAME: string;
|
|
22
|
-
protected static PLURAL_NAME: string;
|
|
23
|
-
protected static READ_ONLY_ATTRIBUTES: string[];
|
|
24
|
-
protected static HAS_ONE: {
|
|
25
|
-
has_one_attribute: typeof FakeResource;
|
|
26
|
-
};
|
|
27
|
-
protected static HAS_MANY: {
|
|
28
|
-
has_many_attribute: typeof FakeResource;
|
|
29
|
-
};
|
|
30
|
-
protected static PATHS: ResourcePath[];
|
|
31
|
-
static find: ({ session, params, id, other_resource_id, ...otherArgs }: FakeResourceFindArgs) => Promise<FakeResource | null>;
|
|
32
|
-
static all: ({ session, params, }: FakeResourceAllArgs) => Promise<FakeResource[]>;
|
|
33
|
-
static custom: ({ session, id, other_resource_id, }: FakeResourceCustomArgs) => Promise<Body>;
|
|
34
|
-
id?: number | string | null;
|
|
35
|
-
attribute?: string | null;
|
|
36
|
-
has_one_attribute?: FakeResource | null;
|
|
37
|
-
has_many_attribute?: FakeResource[] | null;
|
|
38
|
-
other_resource_id?: number | null;
|
|
39
|
-
}
|
|
40
|
-
export {};
|
|
41
|
-
//# sourceMappingURL=fake-resource.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fake-resource.d.ts","sourceRoot":"","sources":["../../src/__tests__/fake-resource.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,EAAE,EAAC,QAAQ,EAAE,YAAY,EAAC,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AAEzC,UAAU,oBAAoB;IAC5B,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,UAAU,mBAAmB;IAC3B,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAED,UAAU,sBAAsB;IAC9B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,IAAI;IAC5C,OAAc,WAAW,aAAuB;IAChD,SAAS,CAAC,MAAM,CAAC,IAAI,SAAmB;IACxC,SAAS,CAAC,MAAM,CAAC,WAAW,SAAoB;IAEhD,SAAS,CAAC,MAAM,CAAC,oBAAoB,EAAE,MAAM,EAAE,CAA4B;IAE3E,SAAS,CAAC,MAAM,CAAC,OAAO;;MAEtB;IAEF,SAAS,CAAC,MAAM,CAAC,QAAQ;;MAEvB;IAEF,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,YAAY,EAAE,CAiDpC;IAEF,OAAc,IAAI,6DAMf,oBAAoB,KAAG,QAAQ,YAAY,GAAG,IAAI,CAAC,CAOpD;IAEF,OAAc,GAAG,yBAGd,mBAAmB,KAAG,QAAQ,YAAY,EAAE,CAAC,CAM9C;IAEF,OAAc,MAAM,wCAIjB,sBAAsB,KAAG,QAAQ,IAAI,CAAC,CASvC;IAEF,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,iBAAiB,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IACxC,kBAAkB,CAAC,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAC3C,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC"}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var tslib_1 = require("tslib");
|
|
4
|
-
var base_rest_resource_1 = tslib_1.__importDefault(require("../base-rest-resource"));
|
|
5
|
-
var base_types_1 = require("../base-types");
|
|
6
|
-
var FakeResource = /** @class */ (function (_super) {
|
|
7
|
-
tslib_1.__extends(FakeResource, _super);
|
|
8
|
-
function FakeResource() {
|
|
9
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
10
|
-
}
|
|
11
|
-
var _a;
|
|
12
|
-
_a = FakeResource;
|
|
13
|
-
FakeResource.API_VERSION = base_types_1.ApiVersion.Unstable;
|
|
14
|
-
FakeResource.NAME = 'fake_resource';
|
|
15
|
-
FakeResource.PLURAL_NAME = 'fake_resources';
|
|
16
|
-
FakeResource.READ_ONLY_ATTRIBUTES = ['unsaveable_attribute'];
|
|
17
|
-
FakeResource.HAS_ONE = {
|
|
18
|
-
has_one_attribute: FakeResource,
|
|
19
|
-
};
|
|
20
|
-
FakeResource.HAS_MANY = {
|
|
21
|
-
has_many_attribute: FakeResource,
|
|
22
|
-
};
|
|
23
|
-
FakeResource.PATHS = [
|
|
24
|
-
{
|
|
25
|
-
http_method: 'get',
|
|
26
|
-
operation: 'get',
|
|
27
|
-
ids: ['id'],
|
|
28
|
-
path: 'fake_resources/<id>.json',
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
http_method: 'get',
|
|
32
|
-
operation: 'get',
|
|
33
|
-
ids: [],
|
|
34
|
-
path: 'fake_resources.json',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
http_method: 'post',
|
|
38
|
-
operation: 'post',
|
|
39
|
-
ids: [],
|
|
40
|
-
path: 'fake_resources.json',
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
http_method: 'put',
|
|
44
|
-
operation: 'put',
|
|
45
|
-
ids: ['id'],
|
|
46
|
-
path: 'fake_resources/<id>.json',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
http_method: 'delete',
|
|
50
|
-
operation: 'delete',
|
|
51
|
-
ids: ['id'],
|
|
52
|
-
path: 'fake_resources/<id>.json',
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
http_method: 'get',
|
|
56
|
-
operation: 'get',
|
|
57
|
-
ids: ['id', 'other_resource_id'],
|
|
58
|
-
path: 'other_resources/<other_resource_id>/fake_resources/<id>.json',
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
http_method: 'get',
|
|
62
|
-
operation: 'custom',
|
|
63
|
-
ids: ['id', 'other_resource_id'],
|
|
64
|
-
path: 'other_resources/<other_resource_id>/fake_resources/<id>/custom.json',
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
http_method: 'delete',
|
|
68
|
-
operation: 'delete',
|
|
69
|
-
ids: ['id', 'other_resource_id'],
|
|
70
|
-
path: 'other_resources/<other_resource_id>/fake_resources/<id>.json',
|
|
71
|
-
},
|
|
72
|
-
];
|
|
73
|
-
FakeResource.find = function (_b) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
74
|
-
var result;
|
|
75
|
-
var session = _b.session, params = _b.params, id = _b.id, _c = _b.other_resource_id, other_resource_id = _c === void 0 ? null : _c, otherArgs = tslib_1.__rest(_b, ["session", "params", "id", "other_resource_id"]);
|
|
76
|
-
return tslib_1.__generator(_a, function (_d) {
|
|
77
|
-
switch (_d.label) {
|
|
78
|
-
case 0: return [4 /*yield*/, FakeResource.baseFind({
|
|
79
|
-
session: session,
|
|
80
|
-
urlIds: { id: id, other_resource_id: other_resource_id },
|
|
81
|
-
params: tslib_1.__assign(tslib_1.__assign({}, params), otherArgs),
|
|
82
|
-
})];
|
|
83
|
-
case 1:
|
|
84
|
-
result = _d.sent();
|
|
85
|
-
return [2 /*return*/, result ? result[0] : null];
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}); };
|
|
89
|
-
FakeResource.all = function (_b) {
|
|
90
|
-
var session = _b.session, params = _b.params;
|
|
91
|
-
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
92
|
-
return tslib_1.__generator(_a, function (_c) {
|
|
93
|
-
return [2 /*return*/, FakeResource.baseFind({
|
|
94
|
-
session: session,
|
|
95
|
-
params: params,
|
|
96
|
-
urlIds: {},
|
|
97
|
-
})];
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
};
|
|
101
|
-
FakeResource.custom = function (_b) {
|
|
102
|
-
var session = _b.session, id = _b.id, other_resource_id = _b.other_resource_id;
|
|
103
|
-
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
104
|
-
var response;
|
|
105
|
-
return tslib_1.__generator(_a, function (_c) {
|
|
106
|
-
switch (_c.label) {
|
|
107
|
-
case 0: return [4 /*yield*/, FakeResource.request({
|
|
108
|
-
http_method: 'get',
|
|
109
|
-
operation: 'custom',
|
|
110
|
-
session: session,
|
|
111
|
-
urlIds: { id: id, other_resource_id: other_resource_id },
|
|
112
|
-
})];
|
|
113
|
-
case 1:
|
|
114
|
-
response = _c.sent();
|
|
115
|
-
return [2 /*return*/, response.body];
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
return FakeResource;
|
|
121
|
-
}(base_rest_resource_1.default));
|
|
122
|
-
exports.default = FakeResource;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"battery-of-tests.d.ts","sourceRoot":"","sources":["../../../../../src/auth/session/storage/__tests__/battery-of-tests.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAKrD,wBAAgB,cAAc,CAAC,cAAc,EAAE,MAAM,OAAO,CAAC,cAAc,CAAC,QA6J3E"}
|