@shopify/shopify-api 5.0.0 → 5.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 +11 -0
- package/README.md +1 -0
- package/dist/auth/oauth/oauth.d.ts +2 -0
- package/dist/auth/oauth/oauth.d.ts.map +1 -1
- package/dist/auth/oauth/oauth.js +120 -95
- package/dist/auth/session/storage/redis.d.ts +1 -0
- package/dist/auth/session/storage/redis.d.ts.map +1 -1
- package/dist/auth/session/storage/redis.js +3 -0
- package/dist/base-types.d.ts +2 -0
- package/dist/base-types.d.ts.map +1 -1
- package/dist/billing/check.d.ts +12 -0
- package/dist/billing/check.d.ts.map +1 -0
- package/dist/billing/check.js +34 -0
- package/dist/billing/has_active_payment.d.ts +3 -0
- package/dist/billing/has_active_payment.d.ts.map +1 -0
- package/dist/billing/has_active_payment.js +91 -0
- package/dist/billing/index.d.ts +7 -0
- package/dist/billing/index.d.ts.map +1 -0
- package/dist/billing/index.js +9 -0
- package/dist/billing/is_recurring.d.ts +2 -0
- package/dist/billing/is_recurring.d.ts.map +1 -0
- package/dist/billing/is_recurring.js +20 -0
- package/dist/billing/request_payment.d.ts +3 -0
- package/dist/billing/request_payment.d.ts.map +1 -0
- package/dist/billing/request_payment.js +134 -0
- package/dist/billing/types.d.ts +57 -0
- package/dist/billing/types.d.ts.map +1 -0
- package/dist/billing/types.js +9 -0
- package/dist/clients/graphql/graphql_client.d.ts +1 -1
- package/dist/clients/graphql/graphql_client.d.ts.map +1 -1
- package/dist/clients/http_client/http_client.d.ts +5 -5
- package/dist/clients/http_client/http_client.d.ts.map +1 -1
- package/dist/clients/http_client/types.d.ts +2 -2
- package/dist/clients/http_client/types.d.ts.map +1 -1
- package/dist/clients/rest/rest_client.d.ts +1 -1
- package/dist/clients/rest/rest_client.d.ts.map +1 -1
- package/dist/clients/rest/rest_client.js +1 -1
- package/dist/clients/rest/types.d.ts +1 -1
- package/dist/clients/rest/types.d.ts.map +1 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +3 -0
- package/dist/error.d.ts +7 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +13 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/utils/decode-session-token.js +1 -1
- package/dist/utils/get-embedded-app-url.d.ts +1 -0
- package/dist/utils/get-embedded-app-url.d.ts.map +1 -1
- package/dist/utils/get-embedded-app-url.js +8 -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.map +1 -1
- package/dist/utils/shop-validator.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/webhooks/registry.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.requestPayment = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var graphql_1 = require("../clients/graphql");
|
|
6
|
+
var context_1 = require("../context");
|
|
7
|
+
var error_1 = require("../error");
|
|
8
|
+
var get_embedded_app_url_1 = require("../utils/get-embedded-app-url");
|
|
9
|
+
var is_recurring_1 = require("./is_recurring");
|
|
10
|
+
function requestPayment(session, isTest) {
|
|
11
|
+
var _a;
|
|
12
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
13
|
+
var returnUrl, data, mutationResponse, mutationResponse;
|
|
14
|
+
return tslib_1.__generator(this, function (_b) {
|
|
15
|
+
switch (_b.label) {
|
|
16
|
+
case 0:
|
|
17
|
+
returnUrl = (0, get_embedded_app_url_1.buildEmbeddedAppUrl)(Buffer.from("".concat(session.shop, "/admin")).toString('base64'));
|
|
18
|
+
if (!(0, is_recurring_1.isRecurring)()) return [3 /*break*/, 2];
|
|
19
|
+
return [4 /*yield*/, requestRecurringPayment(session, returnUrl, isTest)];
|
|
20
|
+
case 1:
|
|
21
|
+
mutationResponse = _b.sent();
|
|
22
|
+
data = mutationResponse.data.appSubscriptionCreate;
|
|
23
|
+
return [3 /*break*/, 4];
|
|
24
|
+
case 2: return [4 /*yield*/, requestSinglePayment(session, returnUrl, isTest)];
|
|
25
|
+
case 3:
|
|
26
|
+
mutationResponse = _b.sent();
|
|
27
|
+
data = mutationResponse.data.appPurchaseOneTimeCreate;
|
|
28
|
+
_b.label = 4;
|
|
29
|
+
case 4:
|
|
30
|
+
if ((_a = data.userErrors) === null || _a === void 0 ? void 0 : _a.length) {
|
|
31
|
+
throw new error_1.BillingError({
|
|
32
|
+
message: 'Error while billing the store',
|
|
33
|
+
errorData: data.userErrors,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return [2 /*return*/, data.confirmationUrl];
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
exports.requestPayment = requestPayment;
|
|
42
|
+
function requestRecurringPayment(session, returnUrl, isTest) {
|
|
43
|
+
var _a;
|
|
44
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
45
|
+
var client, mutationResponse;
|
|
46
|
+
return tslib_1.__generator(this, function (_b) {
|
|
47
|
+
switch (_b.label) {
|
|
48
|
+
case 0:
|
|
49
|
+
if (!context_1.Context.BILLING) {
|
|
50
|
+
throw new error_1.BillingError({
|
|
51
|
+
message: 'Attempted to request recurring payment without billing configs',
|
|
52
|
+
errorData: [],
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
client = new graphql_1.GraphqlClient(session.shop, session.accessToken);
|
|
56
|
+
return [4 /*yield*/, client.query({
|
|
57
|
+
data: {
|
|
58
|
+
query: RECURRING_PURCHASE_MUTATION,
|
|
59
|
+
variables: {
|
|
60
|
+
name: context_1.Context.BILLING.chargeName,
|
|
61
|
+
lineItems: [
|
|
62
|
+
{
|
|
63
|
+
plan: {
|
|
64
|
+
appRecurringPricingDetails: {
|
|
65
|
+
interval: context_1.Context.BILLING.interval,
|
|
66
|
+
price: {
|
|
67
|
+
amount: context_1.Context.BILLING.amount,
|
|
68
|
+
currencyCode: context_1.Context.BILLING.currencyCode,
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
returnUrl: returnUrl,
|
|
75
|
+
test: isTest,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
})];
|
|
79
|
+
case 1:
|
|
80
|
+
mutationResponse = _b.sent();
|
|
81
|
+
if ((_a = mutationResponse.body.errors) === null || _a === void 0 ? void 0 : _a.length) {
|
|
82
|
+
throw new error_1.BillingError({
|
|
83
|
+
message: 'Error while billing the store',
|
|
84
|
+
errorData: mutationResponse.body.errors,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return [2 /*return*/, mutationResponse.body];
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function requestSinglePayment(session, returnUrl, isTest) {
|
|
93
|
+
var _a;
|
|
94
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
95
|
+
var client, mutationResponse;
|
|
96
|
+
return tslib_1.__generator(this, function (_b) {
|
|
97
|
+
switch (_b.label) {
|
|
98
|
+
case 0:
|
|
99
|
+
if (!context_1.Context.BILLING) {
|
|
100
|
+
throw new error_1.BillingError({
|
|
101
|
+
message: 'Attempted to request single payment without billing configs',
|
|
102
|
+
errorData: [],
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
client = new graphql_1.GraphqlClient(session.shop, session.accessToken);
|
|
106
|
+
return [4 /*yield*/, client.query({
|
|
107
|
+
data: {
|
|
108
|
+
query: ONE_TIME_PURCHASE_MUTATION,
|
|
109
|
+
variables: {
|
|
110
|
+
name: context_1.Context.BILLING.chargeName,
|
|
111
|
+
price: {
|
|
112
|
+
amount: context_1.Context.BILLING.amount,
|
|
113
|
+
currencyCode: context_1.Context.BILLING.currencyCode,
|
|
114
|
+
},
|
|
115
|
+
returnUrl: returnUrl,
|
|
116
|
+
test: isTest,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
})];
|
|
120
|
+
case 1:
|
|
121
|
+
mutationResponse = _b.sent();
|
|
122
|
+
if ((_a = mutationResponse.body.errors) === null || _a === void 0 ? void 0 : _a.length) {
|
|
123
|
+
throw new error_1.BillingError({
|
|
124
|
+
message: 'Error while billing the store',
|
|
125
|
+
errorData: mutationResponse.body.errors,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return [2 /*return*/, mutationResponse.body];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
var RECURRING_PURCHASE_MUTATION = "\n mutation test(\n $name: String!\n $lineItems: [AppSubscriptionLineItemInput!]!\n $returnUrl: URL!\n $test: Boolean\n ) {\n appSubscriptionCreate(\n name: $name\n lineItems: $lineItems\n returnUrl: $returnUrl\n test: $test\n ) {\n confirmationUrl\n userErrors {\n field\n message\n }\n }\n }\n";
|
|
134
|
+
var ONE_TIME_PURCHASE_MUTATION = "\n mutation test(\n $name: String!\n $price: MoneyInput!\n $returnUrl: URL!\n $test: Boolean\n ) {\n appPurchaseOneTimeCreate(\n name: $name\n price: $price\n returnUrl: $returnUrl\n test: $test\n ) {\n confirmationUrl\n userErrors {\n field\n message\n }\n }\n }\n";
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare enum BillingInterval {
|
|
2
|
+
OneTime = "ONE_TIME",
|
|
3
|
+
Every30Days = "EVERY_30_DAYS",
|
|
4
|
+
Annual = "ANNUAL"
|
|
5
|
+
}
|
|
6
|
+
export interface BillingSettings {
|
|
7
|
+
chargeName: string;
|
|
8
|
+
amount: number;
|
|
9
|
+
currencyCode: string;
|
|
10
|
+
interval: BillingInterval;
|
|
11
|
+
}
|
|
12
|
+
export interface ActiveSubscription {
|
|
13
|
+
name: string;
|
|
14
|
+
test: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface ActiveSubscriptions {
|
|
17
|
+
activeSubscriptions: ActiveSubscription[];
|
|
18
|
+
}
|
|
19
|
+
export interface OneTimePurchase {
|
|
20
|
+
name: string;
|
|
21
|
+
test: boolean;
|
|
22
|
+
status: string;
|
|
23
|
+
}
|
|
24
|
+
export interface OneTimePurchases {
|
|
25
|
+
oneTimePurchases: {
|
|
26
|
+
edges: {
|
|
27
|
+
node: OneTimePurchase;
|
|
28
|
+
}[];
|
|
29
|
+
pageInfo: {
|
|
30
|
+
endCursor: string;
|
|
31
|
+
hasNextPage: boolean;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export interface CurrentAppInstallations<T> {
|
|
36
|
+
userErrors: string[];
|
|
37
|
+
data: {
|
|
38
|
+
currentAppInstallation: T;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface RequestResponse {
|
|
42
|
+
userErrors: string[];
|
|
43
|
+
confirmationUrl: string;
|
|
44
|
+
}
|
|
45
|
+
export interface RecurringPaymentResponse {
|
|
46
|
+
data: {
|
|
47
|
+
appSubscriptionCreate: RequestResponse;
|
|
48
|
+
};
|
|
49
|
+
errors?: string[];
|
|
50
|
+
}
|
|
51
|
+
export interface SinglePaymentResponse {
|
|
52
|
+
data: {
|
|
53
|
+
appPurchaseOneTimeCreate: RequestResponse;
|
|
54
|
+
};
|
|
55
|
+
errors?: string[];
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/billing/types.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,OAAO,aAAa;IACpB,WAAW,kBAAkB;IAC7B,MAAM,WAAW;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,UAA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ingInterval = void 0;
|
|
4
|
+
var BillingInterval;
|
|
5
|
+
(function (BillingInterval) {
|
|
6
|
+
BillingInterval["OneTime"] = "ONE_TIME";
|
|
7
|
+
BillingInterval["Every30Days"] = "EVERY_30_DAYS";
|
|
8
|
+
BillingInterval["Annual"] = "ANNUAL";
|
|
9
|
+
})(BillingInterval = exports.BillingInterval || (exports.BillingInterval = {}));
|
|
@@ -10,7 +10,7 @@ export declare class GraphqlClient {
|
|
|
10
10
|
protected baseApiPath: string;
|
|
11
11
|
private readonly client;
|
|
12
12
|
constructor(domain: string, accessToken?: string | undefined);
|
|
13
|
-
query(params: GraphqlParams): Promise<RequestReturn
|
|
13
|
+
query<T = unknown>(params: GraphqlParams): Promise<RequestReturn<T>>;
|
|
14
14
|
protected getAccessTokenHeader(): AccessTokenHeader;
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=graphql_client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql_client.d.ts","sourceRoot":"","sources":["../../../src/clients/graphql/graphql_client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAW,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAG7D,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AAEtC,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,aAAa;IAKZ,QAAQ,CAAC,MAAM,EAAE,MAAM;IAAE,QAAQ,CAAC,WAAW,CAAC;IAJ1D,SAAS,CAAC,WAAW,SAAgB;IAErC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;gBAEf,MAAM,EAAE,MAAM,EAAW,WAAW,CAAC,oBAAQ;IAU5D,KAAK,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"graphql_client.d.ts","sourceRoot":"","sources":["../../../src/clients/graphql/graphql_client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAW,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAG7D,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AAEtC,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,aAAa;IAKZ,QAAQ,CAAC,MAAM,EAAE,MAAM;IAAE,QAAQ,CAAC,WAAW,CAAC;IAJ1D,SAAS,CAAC,WAAW,SAAgB;IAErC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;gBAEf,MAAM,EAAE,MAAM,EAAW,WAAW,CAAC,oBAAQ;IAU5D,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAgC1E,SAAS,CAAC,oBAAoB,IAAI,iBAAiB;CAQpD"}
|
|
@@ -8,20 +8,20 @@ export declare class HttpClient {
|
|
|
8
8
|
/**
|
|
9
9
|
* Performs a GET request on the given path.
|
|
10
10
|
*/
|
|
11
|
-
get(params: GetRequestParams): Promise<RequestReturn
|
|
11
|
+
get<T = unknown>(params: GetRequestParams): Promise<RequestReturn<T>>;
|
|
12
12
|
/**
|
|
13
13
|
* Performs a POST request on the given path.
|
|
14
14
|
*/
|
|
15
|
-
post(params: PostRequestParams): Promise<RequestReturn
|
|
15
|
+
post<T = unknown>(params: PostRequestParams): Promise<RequestReturn<T>>;
|
|
16
16
|
/**
|
|
17
17
|
* Performs a PUT request on the given path.
|
|
18
18
|
*/
|
|
19
|
-
put(params: PutRequestParams): Promise<RequestReturn
|
|
19
|
+
put<T = unknown>(params: PutRequestParams): Promise<RequestReturn<T>>;
|
|
20
20
|
/**
|
|
21
21
|
* Performs a DELETE request on the given path.
|
|
22
22
|
*/
|
|
23
|
-
delete(params: DeleteRequestParams): Promise<RequestReturn
|
|
24
|
-
protected request(params: RequestParams): Promise<RequestReturn
|
|
23
|
+
delete<T = unknown>(params: DeleteRequestParams): Promise<RequestReturn<T>>;
|
|
24
|
+
protected request<T = unknown>(params: RequestParams): Promise<RequestReturn<T>>;
|
|
25
25
|
protected getRequestPath(path: string): string;
|
|
26
26
|
private doRequest;
|
|
27
27
|
}
|
|
@@ -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;AAQjB,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,
|
|
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;AAQjB,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,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,gBAAgB;IAItD;;OAEG;IACU,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,iBAAiB;IAIxD;;OAEG;IACU,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,gBAAgB;IAItD;;OAEG;IACU,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,mBAAmB;cAI5C,OAAO,CAAC,CAAC,GAAG,OAAO,EACjC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IA0G5B,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;YAIhC,SAAS;CAqHxB"}
|
|
@@ -34,8 +34,8 @@ export declare type DeleteRequestParams = GetRequestParams;
|
|
|
34
34
|
export declare type RequestParams = (GetRequestParams | PostRequestParams) & {
|
|
35
35
|
method: Method;
|
|
36
36
|
};
|
|
37
|
-
export interface RequestReturn {
|
|
38
|
-
body:
|
|
37
|
+
export interface RequestReturn<T = unknown> {
|
|
38
|
+
body: T;
|
|
39
39
|
headers: Headers;
|
|
40
40
|
}
|
|
41
41
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/clients/http_client/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AAEnC,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;CAChC;AAED,oBAAY,QAAQ;IAClB,IAAI,qBAAqB;IACzB,OAAO,wBAAwB;IAC/B,UAAU,sCAAsC;CACjD;AAED,oBAAY,WAAW,GACnB,MAAM,GACN,MAAM,GACN,MAAM,EAAE,GACR,MAAM,EAAE,GACR;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAA;CAAC,CAAC;AAEjC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,IAAI,CAAC,E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AChB,IAAI,CAAC,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAC,GAAG,MAAM,CAAC;IACzC,KAAK,CAAC,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAA;KAAC,CAAC;IACrC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,oBAAY,iBAAiB,GAAG,gBAAgB,GAAG;IACjD,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAC,GAAG,MAAM,CAAC;CACzC,CAAC;AAEF,oBAAY,gBAAgB,GAAG,iBAAiB,CAAC;AAEjD,oBAAY,mBAAmB,GAAG,gBAAgB,CAAC;AAEnD,oBAAY,aAAa,GAAG,CAAC,gBAAgB,GAAG,iBAAiB,CAAC,GAAG;IACnE,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,OAAO;IACxC,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -6,7 +6,7 @@ declare class RestClient extends HttpClient {
|
|
|
6
6
|
private static LINK_HEADER_REGEXP;
|
|
7
7
|
private static DEFAULT_LIMIT;
|
|
8
8
|
constructor(domain: string, accessToken?: string | undefined);
|
|
9
|
-
protected request(params: RequestParams): Promise<RestRequestReturn
|
|
9
|
+
protected request<T = unknown>(params: RequestParams): Promise<RestRequestReturn<T>>;
|
|
10
10
|
protected getRequestPath(path: string): string;
|
|
11
11
|
private buildRequestParams;
|
|
12
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rest_client.d.ts","sourceRoot":"","sources":["../../../src/clients/rest/rest_client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAC,aAAa,EAAmB,MAAM,sBAAsB,CAAC;AAGrE,OAAO,EAAC,iBAAiB,EAAW,MAAM,SAAS,CAAC;AAEpD,cAAM,UAAW,SAAQ,UAAU;IAIE,QAAQ,CAAC,WAAW,CAAC;IAHxD,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAA8B;IAC/D,OAAO,CAAC,MAAM,CAAC,aAAa,CAAQ;gBAEjB,MAAM,EAAE,MAAM,EAAW,WAAW,CAAC,oBAAQ;cAUhD,OAAO,CAAC,MAAM,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"rest_client.d.ts","sourceRoot":"","sources":["../../../src/clients/rest/rest_client.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAC,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAC,aAAa,EAAmB,MAAM,sBAAsB,CAAC;AAGrE,OAAO,EAAC,iBAAiB,EAAW,MAAM,SAAS,CAAC;AAEpD,cAAM,UAAW,SAAQ,UAAU;IAIE,QAAQ,CAAC,WAAW,CAAC;IAHxD,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAA8B;IAC/D,OAAO,CAAC,MAAM,CAAC,aAAa,CAAQ;gBAEjB,MAAM,EAAE,MAAM,EAAW,WAAW,CAAC,oBAAQ;cAUhD,OAAO,CAAC,CAAC,GAAG,OAAO,EACjC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAyDhC,SAAS,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAY9C,OAAO,CAAC,kBAAkB;CAa3B;AAED,OAAO,EAAC,UAAU,EAAC,CAAC"}
|
|
@@ -30,7 +30,7 @@ var RestClient = /** @class */ (function (_super) {
|
|
|
30
30
|
: this.accessToken, _c), params.extraHeaders);
|
|
31
31
|
return [4 /*yield*/, _super.prototype.request.call(this, params)];
|
|
32
32
|
case 1:
|
|
33
|
-
ret =
|
|
33
|
+
ret = _e.sent();
|
|
34
34
|
link = ret.headers.get('link');
|
|
35
35
|
if (link !== undefined) {
|
|
36
36
|
pageInfo = {
|
|
@@ -7,7 +7,7 @@ export interface PageInfo {
|
|
|
7
7
|
prevPage?: GetRequestParams;
|
|
8
8
|
nextPage?: GetRequestParams;
|
|
9
9
|
}
|
|
10
|
-
export declare type RestRequestReturn = RequestReturn & {
|
|
10
|
+
export declare type RestRequestReturn<T = unknown> = RequestReturn<T> & {
|
|
11
11
|
pageInfo?: PageInfo;
|
|
12
12
|
};
|
|
13
13
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/clients/rest/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAErE,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7B;AAED,oBAAY,iBAAiB,GAAG,aAAa,GAAG;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/clients/rest/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,sBAAsB,CAAC;AAErE,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;CAC7B;AAED,oBAAY,iBAAiB,CAAC,CAAC,GAAG,OAAO,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG;IAC9D,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC"}
|
package/dist/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,gBA6Fd,CAAC;AAEF,OAAO,EAAC,OAAO,EAAE,gBAAgB,EAAC,CAAC"}
|
package/dist/context.js
CHANGED
|
@@ -71,6 +71,9 @@ var Context = {
|
|
|
71
71
|
if (params.CUSTOM_SHOP_DOMAINS) {
|
|
72
72
|
this.CUSTOM_SHOP_DOMAINS = params.CUSTOM_SHOP_DOMAINS;
|
|
73
73
|
}
|
|
74
|
+
if (params.BILLING) {
|
|
75
|
+
this.BILLING = params.BILLING;
|
|
76
|
+
}
|
|
74
77
|
},
|
|
75
78
|
throwIfUninitialized: function () {
|
|
76
79
|
if (!this.API_KEY || this.API_KEY.length === 0) {
|
package/dist/error.d.ts
CHANGED
|
@@ -83,5 +83,12 @@ export declare class UnsupportedClientType extends ShopifyError {
|
|
|
83
83
|
}
|
|
84
84
|
export declare class InvalidRequestError extends ShopifyError {
|
|
85
85
|
}
|
|
86
|
+
export declare class BillingError extends ShopifyError {
|
|
87
|
+
readonly errorData: any;
|
|
88
|
+
constructor({ message, errorData }: {
|
|
89
|
+
message: string;
|
|
90
|
+
errorData: any;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
86
93
|
export {};
|
|
87
94
|
//# 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,gBAAiB,SAAQ,YAAY;CAAG;AACrD,qBAAa,eAAgB,SAAQ,YAAY;CAAG;AACpD,qBAAa,oBA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nD,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;AAExD,qBAAa,YAAa,SAAQ,YAAY;IAC5C,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC;gBAEL,EAAC,OAAO,EAAE,SAAS,EAAC,EAAE;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,GAAG,CAAA;KAAC;CAM3E"}
|
package/dist/error.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InvalidRequestError = exports.UnsupportedClientType = exports.MissingRequiredArgument = exports.SessionStorageError = exports.InvalidWebhookError = exports.InvalidSession = exports.CookieNotFound = exports.SessionNotFound = exports.InvalidOAuthError = exports.GraphqlQueryError = 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.InvalidHostError = exports.InvalidShopError = exports.InvalidHmacError = exports.ShopifyError = void 0;
|
|
3
|
+
exports.BillingError = exports.InvalidRequestError = exports.UnsupportedClientType = exports.MissingRequiredArgument = exports.SessionStorageError = exports.InvalidWebhookError = exports.InvalidSession = exports.CookieNotFound = exports.SessionNotFound = exports.InvalidOAuthError = exports.GraphqlQueryError = 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.InvalidHostError = 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);
|
|
@@ -232,3 +232,15 @@ var InvalidRequestError = /** @class */ (function (_super) {
|
|
|
232
232
|
return InvalidRequestError;
|
|
233
233
|
}(ShopifyError));
|
|
234
234
|
exports.InvalidRequestError = InvalidRequestError;
|
|
235
|
+
var BillingError = /** @class */ (function (_super) {
|
|
236
|
+
tslib_1.__extends(BillingError, _super);
|
|
237
|
+
function BillingError(_a) {
|
|
238
|
+
var message = _a.message, errorData = _a.errorData;
|
|
239
|
+
var _this = _super.call(this, message) || this;
|
|
240
|
+
_this.message = message;
|
|
241
|
+
_this.errorData = errorData;
|
|
242
|
+
return _this;
|
|
243
|
+
}
|
|
244
|
+
return BillingError;
|
|
245
|
+
}(ShopifyError));
|
|
246
|
+
exports.BillingError = BillingError;
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare const Shopify: {
|
|
|
4
4
|
Context: import("./context").ContextInterface;
|
|
5
5
|
Auth: {
|
|
6
6
|
SESSION_COOKIE_NAME: string;
|
|
7
|
+
STATE_COOKIE_NAME: string;
|
|
7
8
|
beginAuth(request: import("http").IncomingMessage, response: import("http").ServerResponse, shop: string, redirectPath: string, isOnline?: boolean): Promise<string>;
|
|
8
9
|
validateAuthCallback(request: import("http").IncomingMessage, response: import("http").ServerResponse, query: import("./types").AuthQuery): Promise<import("./types").SessionInterface>;
|
|
9
10
|
getCookieSessionId(request: import("http").IncomingMessage, response: import("http").ServerResponse): string | undefined;
|
|
@@ -11,6 +12,9 @@ export declare const Shopify: {
|
|
|
11
12
|
getOfflineSessionId(shop: string): string;
|
|
12
13
|
getCurrentSessionId(request: import("http").IncomingMessage, response: import("http").ServerResponse, isOnline?: boolean): string | undefined;
|
|
13
14
|
};
|
|
15
|
+
Billing: {
|
|
16
|
+
check: typeof import("./billing/check").check;
|
|
17
|
+
};
|
|
14
18
|
Session: {
|
|
15
19
|
Session: typeof import("./auth/session/session").Session;
|
|
16
20
|
MemorySessionStorage: typeof import("./auth/session").MemorySessionStorage;
|
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;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,aAAa,MAAM,SAAS,CAAC;AAQzC,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASnB,CAAC;AAEF,eAAe,OAAO,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ var tslib_1 = require("tslib");
|
|
|
5
5
|
var context_1 = require("./context");
|
|
6
6
|
var ShopifyErrors = tslib_1.__importStar(require("./error"));
|
|
7
7
|
var oauth_1 = tslib_1.__importDefault(require("./auth/oauth"));
|
|
8
|
+
var billing_1 = tslib_1.__importDefault(require("./billing"));
|
|
8
9
|
var session_1 = tslib_1.__importDefault(require("./auth/session"));
|
|
9
10
|
var clients_1 = tslib_1.__importDefault(require("./clients"));
|
|
10
11
|
var utils_1 = tslib_1.__importDefault(require("./utils"));
|
|
@@ -12,6 +13,7 @@ var webhooks_1 = tslib_1.__importDefault(require("./webhooks"));
|
|
|
12
13
|
exports.Shopify = {
|
|
13
14
|
Context: context_1.Context,
|
|
14
15
|
Auth: oauth_1.default,
|
|
16
|
+
Billing: billing_1.default,
|
|
15
17
|
Session: session_1.default,
|
|
16
18
|
Clients: clients_1.default,
|
|
17
19
|
Utils: utils_1.default,
|
package/dist/types.d.ts
CHANGED
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./base-types"), exports);
|
|
5
5
|
tslib_1.__exportStar(require("./auth/types"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./billing/types"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./clients/types"), exports);
|
|
7
8
|
tslib_1.__exportStar(require("./utils/types"), exports);
|
|
8
9
|
tslib_1.__exportStar(require("./webhooks/types"), exports);
|
|
@@ -5,7 +5,7 @@ var tslib_1 = require("tslib");
|
|
|
5
5
|
var jsonwebtoken_1 = tslib_1.__importDefault(require("jsonwebtoken"));
|
|
6
6
|
var context_1 = require("../context");
|
|
7
7
|
var ShopifyErrors = tslib_1.__importStar(require("../error"));
|
|
8
|
-
var JWT_PERMITTED_CLOCK_TOLERANCE =
|
|
8
|
+
var JWT_PERMITTED_CLOCK_TOLERANCE = 10;
|
|
9
9
|
/**
|
|
10
10
|
* Decodes the given session token, and extracts the session information from it
|
|
11
11
|
*
|
|
@@ -6,4 +6,5 @@ import http from 'http';
|
|
|
6
6
|
* @param request Current HTTP request
|
|
7
7
|
*/
|
|
8
8
|
export default function getEmbeddedAppUrl(request: http.IncomingMessage): string;
|
|
9
|
+
export declare function buildEmbeddedAppUrl(host: string): string;
|
|
9
10
|
//# sourceMappingURL=get-embedded-app-url.d.ts.map
|
|
@@ -1 +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;AAOxB;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,OAAO,EAAE,IAAI,CAAC,eAAe,GAC5B,MAAM,
|
|
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;AAOxB;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CACvC,OAAO,EAAE,IAAI,CAAC,eAAe,GAC5B,MAAM,CAuBR;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMxD"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildEmbeddedAppUrl = void 0;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
5
|
var ShopifyErrors = tslib_1.__importStar(require("../error"));
|
|
5
6
|
var context_1 = require("../context");
|
|
@@ -18,10 +19,15 @@ function getEmbeddedAppUrl(request) {
|
|
|
18
19
|
}
|
|
19
20
|
var url = new URL(request.url, "https://".concat(request.headers.host));
|
|
20
21
|
var host = url.searchParams.get('host');
|
|
21
|
-
if (typeof host !== 'string'
|
|
22
|
+
if (typeof host !== 'string') {
|
|
22
23
|
throw new ShopifyErrors.InvalidRequestError('Request does not contain a host query parameter');
|
|
23
24
|
}
|
|
25
|
+
return buildEmbeddedAppUrl(host);
|
|
26
|
+
}
|
|
27
|
+
exports.default = getEmbeddedAppUrl;
|
|
28
|
+
function buildEmbeddedAppUrl(host) {
|
|
29
|
+
(0, shop_validator_1.sanitizeHost)(host, true);
|
|
24
30
|
var decodedHost = Buffer.from(host, 'base64').toString();
|
|
25
31
|
return "https://".concat(decodedHost, "/apps/").concat(context_1.Context.API_KEY);
|
|
26
32
|
}
|
|
27
|
-
exports.
|
|
33
|
+
exports.buildEmbeddedAppUrl = buildEmbeddedAppUrl;
|
|
@@ -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":"AAwCA,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 +1 @@
|
|
|
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,
|
|
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,CASf"}
|
|
@@ -35,7 +35,7 @@ exports.sanitizeShop = sanitizeShop;
|
|
|
35
35
|
*/
|
|
36
36
|
function sanitizeHost(host, throwOnInvalid) {
|
|
37
37
|
if (throwOnInvalid === void 0) { throwOnInvalid = false; }
|
|
38
|
-
var base64regex = /^
|
|
38
|
+
var base64regex = /^[0-9a-zA-Z+/]+={0,2}$/;
|
|
39
39
|
var sanitizedHost = base64regex.test(host) ? host : null;
|
|
40
40
|
if (!sanitizedHost && throwOnInvalid) {
|
|
41
41
|
throw new error_1.InvalidHostError('Received invalid host argument');
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SHOPIFY_API_LIBRARY_VERSION = "5.
|
|
1
|
+
export declare const SHOPIFY_API_LIBRARY_VERSION = "5.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": "5.
|
|
3
|
+
"version": "5.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",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"mysql2": "^2.3.3",
|
|
55
55
|
"node-fetch": "^2.6.1",
|
|
56
56
|
"pg": "^8.7.3",
|
|
57
|
-
"redis": "^4.0
|
|
57
|
+
"redis": "^4.1.0",
|
|
58
58
|
"sqlite3": "^5.0.8",
|
|
59
59
|
"tslib": "^2.0.3",
|
|
60
60
|
"uuid": "^8.3.1"
|