@shopify/shopify-app-remix 2.6.0 → 2.7.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/build/cjs/server/authenticate/fulfillment-service/authenticate.js +70 -0
- package/build/cjs/server/future/flags.js +28 -0
- package/build/cjs/server/shopify-app.js +8 -3
- package/build/cjs/server/types.js +0 -4
- package/build/cjs/server/version.js +1 -1
- package/build/ts/server/authenticate/admin/authenticate.admin.doc.d.ts.map +1 -1
- package/build/ts/server/authenticate/admin/authenticate.admin.doc.js +13 -0
- package/build/ts/server/authenticate/admin/authenticate.admin.doc.js.map +1 -1
- package/build/ts/server/authenticate/admin/types.d.ts +27 -27
- package/build/ts/server/authenticate/flow/authenticate.flow.doc.d.ts.map +1 -1
- package/build/ts/server/authenticate/flow/authenticate.flow.doc.js +13 -0
- package/build/ts/server/authenticate/flow/authenticate.flow.doc.js.map +1 -1
- package/build/ts/server/authenticate/flow/types.d.ts +4 -4
- package/build/ts/server/authenticate/fulfillment-service/authenticate.d.ts +5 -0
- package/build/ts/server/authenticate/fulfillment-service/authenticate.d.ts.map +1 -0
- package/build/ts/server/authenticate/fulfillment-service/authenticate.fulfillment-service.doc.d.ts +4 -0
- package/build/ts/server/authenticate/fulfillment-service/authenticate.fulfillment-service.doc.d.ts.map +1 -0
- package/build/ts/server/authenticate/fulfillment-service/authenticate.fulfillment-service.doc.js +46 -0
- package/build/ts/server/authenticate/fulfillment-service/authenticate.fulfillment-service.doc.js.map +1 -0
- package/build/ts/server/authenticate/fulfillment-service/authenticate.js +73 -0
- package/build/ts/server/authenticate/fulfillment-service/authenticate.js.map +1 -0
- package/build/ts/server/authenticate/fulfillment-service/types.d.ts +109 -0
- package/build/ts/server/authenticate/fulfillment-service/types.d.ts.map +1 -0
- package/build/ts/server/authenticate/fulfillment-service/types.js +3 -0
- package/build/ts/server/authenticate/fulfillment-service/types.js.map +1 -0
- package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.d.ts.map +1 -1
- package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.js +19 -0
- package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.js.map +1 -1
- package/build/ts/server/authenticate/public/appProxy/types.d.ts +23 -5
- package/build/ts/server/authenticate/public/appProxy/types.d.ts.map +1 -1
- package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.d.ts.map +1 -1
- package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.js +18 -0
- package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.js.map +1 -1
- package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.d.ts.map +1 -1
- package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.js +13 -0
- package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.js.map +1 -1
- package/build/ts/server/authenticate/webhooks/types.d.ts +13 -14
- package/build/ts/server/authenticate/webhooks/types.d.ts.map +1 -1
- package/build/ts/server/clients/admin/types.d.ts +85 -14
- package/build/ts/server/clients/admin/types.d.ts.map +1 -1
- package/build/ts/server/clients/storefront/types.d.ts +47 -0
- package/build/ts/server/clients/storefront/types.d.ts.map +1 -1
- package/build/ts/server/clients/types.d.ts +14 -1
- package/build/ts/server/clients/types.d.ts.map +1 -1
- package/build/ts/server/future/flags.d.ts +3 -1
- package/build/ts/server/future/flags.d.ts.map +1 -1
- package/build/ts/server/future/flags.js +20 -0
- package/build/ts/server/future/flags.js.map +1 -1
- package/build/ts/server/shopify-app.d.ts +1 -1
- package/build/ts/server/shopify-app.d.ts.map +1 -1
- package/build/ts/server/shopify-app.js +5 -1
- package/build/ts/server/shopify-app.js.map +1 -1
- package/build/ts/server/types.d.ts +35 -6
- package/build/ts/server/types.d.ts.map +1 -1
- package/build/ts/server/types.js.map +1 -1
- package/build/ts/server/version.d.ts +1 -1
- package/build/ts/server/version.js +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var shopifyApi = require('@shopify/shopify-api');
|
|
6
|
+
var factory = require('../../clients/admin/factory.js');
|
|
7
|
+
|
|
8
|
+
function authenticateFulfillmentServiceFactory(params) {
|
|
9
|
+
const {
|
|
10
|
+
api,
|
|
11
|
+
config,
|
|
12
|
+
logger
|
|
13
|
+
} = params;
|
|
14
|
+
return async function authenticate(request) {
|
|
15
|
+
logger.info('Authenticating fulfillment service request');
|
|
16
|
+
if (request.method !== 'POST') {
|
|
17
|
+
logger.debug('Received a non-POST request for fulfillment service. Only POST requests are allowed.', {
|
|
18
|
+
url: request.url,
|
|
19
|
+
method: request.method
|
|
20
|
+
});
|
|
21
|
+
throw new Response(undefined, {
|
|
22
|
+
status: 405,
|
|
23
|
+
statusText: 'Method not allowed'
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const rawBody = await request.text();
|
|
27
|
+
const result = await api.fulfillmentService.validate({
|
|
28
|
+
rawBody,
|
|
29
|
+
rawRequest: request
|
|
30
|
+
});
|
|
31
|
+
if (!result.valid) {
|
|
32
|
+
logger.error('Received an invalid fulfillment service request', {
|
|
33
|
+
reason: result.reason
|
|
34
|
+
});
|
|
35
|
+
throw new Response(undefined, {
|
|
36
|
+
status: 400,
|
|
37
|
+
statusText: 'Bad Request'
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const payload = JSON.parse(rawBody);
|
|
41
|
+
const shop = request.headers.get(shopifyApi.ShopifyHeader.Domain) || '';
|
|
42
|
+
logger.debug('Fulfillment service request is valid, looking for an offline session', {
|
|
43
|
+
shop
|
|
44
|
+
});
|
|
45
|
+
const sessionId = api.session.getOfflineId(shop);
|
|
46
|
+
const session = await config.sessionStorage.loadSession(sessionId);
|
|
47
|
+
if (!session) {
|
|
48
|
+
logger.info('Fulfillment service request could not find session', {
|
|
49
|
+
shop
|
|
50
|
+
});
|
|
51
|
+
throw new Response(undefined, {
|
|
52
|
+
status: 400,
|
|
53
|
+
statusText: 'Bad Request'
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
logger.debug('Found a session for the fulfillment service request', {
|
|
57
|
+
shop
|
|
58
|
+
});
|
|
59
|
+
return {
|
|
60
|
+
session,
|
|
61
|
+
payload,
|
|
62
|
+
admin: factory.adminClientFactory({
|
|
63
|
+
params,
|
|
64
|
+
session
|
|
65
|
+
})
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
exports.authenticateFulfillmentServiceFactory = authenticateFulfillmentServiceFactory;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
// When adding new flags, you should also add them to the `TEST_FUTURE_FLAGS` object in `test-config.ts` to ensure that
|
|
6
|
+
|
|
7
|
+
// it doesn't cause regressions.
|
|
8
|
+
|
|
9
|
+
// When adding new flags, use this format:
|
|
10
|
+
// vX_myFutureFlag: Future extends FutureFlags ? Future['vX_myFutureFlag'] : false;
|
|
11
|
+
|
|
12
|
+
function logDisabledFutureFlags(config, logger) {
|
|
13
|
+
const logFlag = (flag, message) => logger.info(`Future flag ${flag} is disabled.\n\n ${message}\n`);
|
|
14
|
+
if (!config.future.v3_authenticatePublic) {
|
|
15
|
+
logFlag('v3_authenticatePublic', 'Enable this flag to allow appProxy and checkout in `shopify.authenticate.public`.');
|
|
16
|
+
}
|
|
17
|
+
if (!config.future.v3_lineItemBilling) {
|
|
18
|
+
logFlag('v3_lineItemBilling', 'Enable this flag to allow billing plans with multiple line items.');
|
|
19
|
+
}
|
|
20
|
+
if (!config.future.v3_webhookAdminContext) {
|
|
21
|
+
logFlag('v3_webhookAdminContext', 'Enable this flag to use the standard Admin context when calling `shopify.authenticate.webhook`.');
|
|
22
|
+
}
|
|
23
|
+
if (!config.future.unstable_newEmbeddedAuthStrategy) {
|
|
24
|
+
logFlag('unstable_newEmbeddedAuthStrategy', 'Enable this to use OAuth token exchange instead of auth code to generate API access tokens.' + '\n Your app must be using Shopify managed install: https://shopify.dev/docs/apps/auth/installation');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
exports.logDisabledFutureFlags = logDisabledFutureFlags;
|
|
@@ -8,7 +8,7 @@ var types = require('./types.js');
|
|
|
8
8
|
var version = require('./version.js');
|
|
9
9
|
var register = require('./authenticate/webhooks/register.js');
|
|
10
10
|
var authenticate = require('./authenticate/admin/authenticate.js');
|
|
11
|
-
var authenticate$
|
|
11
|
+
var authenticate$3 = require('./authenticate/webhooks/authenticate.js');
|
|
12
12
|
var overrideLogger = require('./override-logger.js');
|
|
13
13
|
var addResponseHeaders = require('./authenticate/helpers/add-response-headers.js');
|
|
14
14
|
require('isbot');
|
|
@@ -21,6 +21,8 @@ var authCodeFlow = require('./authenticate/admin/strategies/auth-code-flow.js');
|
|
|
21
21
|
var tokenExchange = require('./authenticate/admin/strategies/token-exchange.js');
|
|
22
22
|
var idempotentPromiseHandler = require('./authenticate/helpers/idempotent-promise-handler.js');
|
|
23
23
|
var authenticate$1 = require('./authenticate/flow/authenticate.js');
|
|
24
|
+
var authenticate$2 = require('./authenticate/fulfillment-service/authenticate.js');
|
|
25
|
+
var flags = require('./future/flags.js');
|
|
24
26
|
|
|
25
27
|
/**
|
|
26
28
|
* Creates an object your app will use to interact with Shopify.
|
|
@@ -67,7 +69,8 @@ function shopifyApp(appConfig) {
|
|
|
67
69
|
admin: authStrategy,
|
|
68
70
|
flow: authenticate$1.authenticateFlowFactory(params),
|
|
69
71
|
public: factory.authenticatePublicFactory(params),
|
|
70
|
-
|
|
72
|
+
fulfillmentService: authenticate$2.authenticateFulfillmentServiceFactory(params),
|
|
73
|
+
webhook: authenticate$3.authenticateWebhookFactory(params)
|
|
71
74
|
},
|
|
72
75
|
unauthenticated: {
|
|
73
76
|
admin: factory$1.unauthenticatedAdminContextFactory(params),
|
|
@@ -77,6 +80,7 @@ function shopifyApp(appConfig) {
|
|
|
77
80
|
if (isAppStoreApp(shopify, appConfig) || isSingleMerchantApp(shopify, appConfig)) {
|
|
78
81
|
shopify.login = login.loginFactory(params);
|
|
79
82
|
}
|
|
83
|
+
flags.logDisabledFutureFlags(config, logger);
|
|
80
84
|
return shopify;
|
|
81
85
|
}
|
|
82
86
|
function isAppStoreApp(_shopify, config) {
|
|
@@ -114,7 +118,8 @@ function deriveApi(appConfig) {
|
|
|
114
118
|
isCustomStoreApp: appConfig.distribution === types.AppDistribution.ShopifyAdmin,
|
|
115
119
|
future: {
|
|
116
120
|
v10_lineItemBilling: (_appConfig$future = appConfig.future) === null || _appConfig$future === void 0 ? void 0 : _appConfig$future.v3_lineItemBilling
|
|
117
|
-
}
|
|
121
|
+
},
|
|
122
|
+
_logDisabledFutureFlags: false
|
|
118
123
|
});
|
|
119
124
|
}
|
|
120
125
|
function deriveConfig(appConfig, apiConfig) {
|
|
@@ -10,10 +10,6 @@ let AppDistribution = /*#__PURE__*/function (AppDistribution) {
|
|
|
10
10
|
AppDistribution["ShopifyAdmin"] = "shopify_admin";
|
|
11
11
|
return AppDistribution;
|
|
12
12
|
}({});
|
|
13
|
-
|
|
14
|
-
// This can't be a type because it would reference itself
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
|
|
16
|
-
|
|
17
13
|
let LoginErrorType = /*#__PURE__*/function (LoginErrorType) {
|
|
18
14
|
LoginErrorType["MissingShop"] = "MISSING_SHOP";
|
|
19
15
|
LoginErrorType["InvalidShop"] = "INVALID_SHOP";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.admin.doc.d.ts","sourceRoot":"","sources":["../../../../../src/server/authenticate/admin/authenticate.admin.doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"authenticate.admin.doc.d.ts","sourceRoot":"","sources":["../../../../../src/server/authenticate/admin/authenticate.admin.doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,6BA6CX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -13,6 +13,19 @@ var data = {
|
|
|
13
13
|
type: 'AuthenticateAdmin',
|
|
14
14
|
},
|
|
15
15
|
],
|
|
16
|
+
defaultExample: {
|
|
17
|
+
description: 'Authenticate, run API mutation, and redirect',
|
|
18
|
+
codeblock: {
|
|
19
|
+
title: 'Authenticate, run API mutation, and redirect',
|
|
20
|
+
tabs: [
|
|
21
|
+
{
|
|
22
|
+
title: '/app/routes/**.ts',
|
|
23
|
+
language: 'typescript',
|
|
24
|
+
code: './authenticate.admin.doc.example.ts',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
16
29
|
jsDocTypeExamples: [
|
|
17
30
|
'EmbeddedAdminContext',
|
|
18
31
|
'AdminApiContext',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.admin.doc.js","sourceRoot":"","sources":["../../../../../src/server/authenticate/admin/authenticate.admin.doc.ts"],"names":[],"mappings":";;AAEA,IAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,OAAO;IACb,WAAW,EACT,wLAAwL;IAC1L,QAAQ,EAAE,cAAc;IACxB,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,KAAK;IACxB,WAAW,EAAE;QACX;YACE,KAAK,EAAE,oBAAoB;YAC3B,WAAW,EACT,4IAA4I;YAC9I,IAAI,EAAE,mBAAmB;SAC1B;KACF;IACD,iBAAiB,EAAE;QACjB,sBAAsB;QACtB,iBAAiB;QACjB,gBAAgB;KACjB;IACD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,aAAa;YACnB,QAAQ,EAAE,8BAA8B;YACxC,GAAG,EAAE,4CAA4C;SAClD;QACD;YACE,IAAI,EAAE,iBAAiB;YACvB,QAAQ,EAAE,kDAAkD;YAC5D,GAAG,EAAE,0CAA0C;SAChD;KACF;CACF,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
|
1
|
+
{"version":3,"file":"authenticate.admin.doc.js","sourceRoot":"","sources":["../../../../../src/server/authenticate/admin/authenticate.admin.doc.ts"],"names":[],"mappings":";;AAEA,IAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,OAAO;IACb,WAAW,EACT,wLAAwL;IAC1L,QAAQ,EAAE,cAAc;IACxB,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,KAAK;IACxB,WAAW,EAAE;QACX;YACE,KAAK,EAAE,oBAAoB;YAC3B,WAAW,EACT,4IAA4I;YAC9I,IAAI,EAAE,mBAAmB;SAC1B;KACF;IACD,cAAc,EAAE;QACd,WAAW,EAAE,8CAA8C;QAC3D,SAAS,EAAE;YACT,KAAK,EAAE,8CAA8C;YACrD,IAAI,EAAE;gBACJ;oBACE,KAAK,EAAE,mBAAmB;oBAC1B,QAAQ,EAAE,YAAY;oBACtB,IAAI,EAAE,qCAAqC;iBAC5C;aACF;SACF;KACF;IACD,iBAAiB,EAAE;QACjB,sBAAsB;QACtB,iBAAiB;QACjB,gBAAgB;KACjB;IACD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,aAAa;YACnB,QAAQ,EAAE,8BAA8B;YACxC,GAAG,EAAE,4CAA4C;SAClD;QACD;YACE,IAAI,EAAE,iBAAiB;YACvB,QAAQ,EAAE,kDAAkD;YAC5D,GAAG,EAAE,0CAA0C;SAChD;KACF;CACF,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
|
@@ -16,16 +16,6 @@ interface AdminContextInternal<Config extends AppConfigArg, Resources extends Sh
|
|
|
16
16
|
* <caption>Using offline sessions.</caption>
|
|
17
17
|
* <description>Get your app's shop-specific data using an offline session.</description>
|
|
18
18
|
* ```ts
|
|
19
|
-
* // shopify.server.ts
|
|
20
|
-
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
21
|
-
*
|
|
22
|
-
* const shopify = shopifyApp({
|
|
23
|
-
* // ...etc
|
|
24
|
-
* });
|
|
25
|
-
* export default shopify;
|
|
26
|
-
* export const authenticate = shopify.authenticate;
|
|
27
|
-
* ```
|
|
28
|
-
* ```ts
|
|
29
19
|
* // /app/routes/**\/*.ts
|
|
30
20
|
* import { LoaderFunctionArgs, json } from "@remix-run/node";
|
|
31
21
|
* import { authenticate } from "../shopify.server";
|
|
@@ -36,21 +26,20 @@ interface AdminContextInternal<Config extends AppConfigArg, Resources extends Sh
|
|
|
36
26
|
* return json(await getMyAppData({shop: session.shop));
|
|
37
27
|
* };
|
|
38
28
|
* ```
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* <caption>Using online sessions.</caption>
|
|
42
|
-
* <description>Get your app's user-specific data using an online session.</description>
|
|
43
29
|
* ```ts
|
|
44
30
|
* // shopify.server.ts
|
|
45
31
|
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
46
32
|
*
|
|
47
33
|
* const shopify = shopifyApp({
|
|
48
34
|
* // ...etc
|
|
49
|
-
* useOnlineTokens: true,
|
|
50
35
|
* });
|
|
51
36
|
* export default shopify;
|
|
52
37
|
* export const authenticate = shopify.authenticate;
|
|
53
38
|
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* <caption>Using online sessions.</caption>
|
|
42
|
+
* <description>Get your app's user-specific data using an online session.</description>
|
|
54
43
|
* ```ts
|
|
55
44
|
* // /app/routes/**\/*.ts
|
|
56
45
|
* import { LoaderFunctionArgs, json } from "@remix-run/node";
|
|
@@ -62,6 +51,17 @@ interface AdminContextInternal<Config extends AppConfigArg, Resources extends Sh
|
|
|
62
51
|
* return json(await getMyAppData({user: session.onlineAccessInfo!.id}));
|
|
63
52
|
* };
|
|
64
53
|
* ```
|
|
54
|
+
* ```ts
|
|
55
|
+
* // shopify.server.ts
|
|
56
|
+
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
57
|
+
*
|
|
58
|
+
* const shopify = shopifyApp({
|
|
59
|
+
* // ...etc
|
|
60
|
+
* useOnlineTokens: true,
|
|
61
|
+
* });
|
|
62
|
+
* export default shopify;
|
|
63
|
+
* export const authenticate = shopify.authenticate;
|
|
64
|
+
* ```
|
|
65
65
|
*/
|
|
66
66
|
session: Session;
|
|
67
67
|
/**
|
|
@@ -106,29 +106,29 @@ export interface EmbeddedAdminContext<Config extends AppConfigArg, Resources ext
|
|
|
106
106
|
* <caption>Using the decoded session token.</caption>
|
|
107
107
|
* <description>Get user-specific data using the `sessionToken` object.</description>
|
|
108
108
|
* ```ts
|
|
109
|
-
* // shopify.server.ts
|
|
110
|
-
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
111
|
-
*
|
|
112
|
-
* const shopify = shopifyApp({
|
|
113
|
-
* // ...etc
|
|
114
|
-
* useOnlineTokens: true,
|
|
115
|
-
* });
|
|
116
|
-
* export default shopify;
|
|
117
|
-
* export const authenticate = shopify.authenticate;
|
|
118
|
-
* ```
|
|
119
|
-
* ```ts
|
|
120
109
|
* // /app/routes/**\/*.ts
|
|
121
110
|
* import { LoaderFunctionArgs, json } from "@remix-run/node";
|
|
122
111
|
* import { authenticate } from "../shopify.server";
|
|
123
112
|
* import { getMyAppData } from "~/db/model.server";
|
|
124
113
|
*
|
|
125
114
|
* export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|
126
|
-
* const { sessionToken } = await authenticate.
|
|
115
|
+
* const { sessionToken } = await authenticate.admin(
|
|
127
116
|
* request
|
|
128
117
|
* );
|
|
129
118
|
* return json(await getMyAppData({user: sessionToken.sub}));
|
|
130
119
|
* };
|
|
131
120
|
* ```
|
|
121
|
+
* ```ts
|
|
122
|
+
* // shopify.server.ts
|
|
123
|
+
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
124
|
+
*
|
|
125
|
+
* const shopify = shopifyApp({
|
|
126
|
+
* // ...etc
|
|
127
|
+
* useOnlineTokens: true,
|
|
128
|
+
* });
|
|
129
|
+
* export default shopify;
|
|
130
|
+
* export const authenticate = shopify.authenticate;
|
|
131
|
+
* ```
|
|
132
132
|
*/
|
|
133
133
|
sessionToken: JwtPayload;
|
|
134
134
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.flow.doc.d.ts","sourceRoot":"","sources":["../../../../../src/server/authenticate/flow/authenticate.flow.doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"authenticate.flow.doc.d.ts","sourceRoot":"","sources":["../../../../../src/server/authenticate/flow/authenticate.flow.doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,6BA0CX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -14,6 +14,19 @@ var data = {
|
|
|
14
14
|
type: 'AuthenticateFlow',
|
|
15
15
|
},
|
|
16
16
|
],
|
|
17
|
+
defaultExample: {
|
|
18
|
+
description: 'Handle a flow action call',
|
|
19
|
+
codeblock: {
|
|
20
|
+
title: 'Set a metafield on a customer after a flow call',
|
|
21
|
+
tabs: [
|
|
22
|
+
{
|
|
23
|
+
title: '/app/routes/**.ts',
|
|
24
|
+
language: 'typescript',
|
|
25
|
+
code: './authenticate.flow.doc.example.ts',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
17
30
|
jsDocTypeExamples: ['FlowContext'],
|
|
18
31
|
related: [
|
|
19
32
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.flow.doc.js","sourceRoot":"","sources":["../../../../../src/server/authenticate/flow/authenticate.flow.doc.ts"],"names":[],"mappings":";;AAEA,IAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,MAAM;IACZ,WAAW,EACT,2DAA2D;QAC3D,8GAA8G;IAChH,QAAQ,EAAE,cAAc;IACxB,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,KAAK;IACxB,WAAW,EAAE;QACX;YACE,KAAK,EAAE,mBAAmB;YAC1B,WAAW,EAAE,wDAAwD;YACrE,IAAI,EAAE,kBAAkB;SACzB;KACF;IACD,iBAAiB,EAAE,CAAC,aAAa,CAAC;IAClC,OAAO,EAAE;QACP;YACE,IAAI,EAAE,mBAAmB;YACzB,QAAQ,EAAE,8BAA8B;YACxC,GAAG,EAAE,4CAA4C;SAClD;QACD;YACE,IAAI,EAAE,uBAAuB;YAC7B,QAAQ,EAAE,6BAA6B;YACvC,GAAG,EAAE,mCAAmC;YACxC,IAAI,EAAE,SAAS;SAChB;KACF;CACF,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
|
1
|
+
{"version":3,"file":"authenticate.flow.doc.js","sourceRoot":"","sources":["../../../../../src/server/authenticate/flow/authenticate.flow.doc.ts"],"names":[],"mappings":";;AAEA,IAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,MAAM;IACZ,WAAW,EACT,2DAA2D;QAC3D,8GAA8G;IAChH,QAAQ,EAAE,cAAc;IACxB,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,KAAK;IACxB,WAAW,EAAE;QACX;YACE,KAAK,EAAE,mBAAmB;YAC1B,WAAW,EAAE,wDAAwD;YACrE,IAAI,EAAE,kBAAkB;SACzB;KACF;IACD,cAAc,EAAE;QACd,WAAW,EAAE,2BAA2B;QACxC,SAAS,EAAE;YACT,KAAK,EAAE,iDAAiD;YACxD,IAAI,EAAE;gBACJ;oBACE,KAAK,EAAE,mBAAmB;oBAC1B,QAAQ,EAAE,YAAY;oBACtB,IAAI,EAAE,oCAAoC;iBAC3C;aACF;SACF;KACF;IACD,iBAAiB,EAAE,CAAC,aAAa,CAAC;IAClC,OAAO,EAAE;QACP;YACE,IAAI,EAAE,mBAAmB;YACzB,QAAQ,EAAE,8BAA8B;YACxC,GAAG,EAAE,4CAA4C;SAClD;QACD;YACE,IAAI,EAAE,uBAAuB;YAC7B,QAAQ,EAAE,6BAA6B;YACvC,GAAG,EAAE,mCAAmC;YACxC,IAAI,EAAE,SAAS;SAChB;KACF;CACF,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
|
@@ -11,10 +11,10 @@ export interface FlowContext<Resources extends ShopifyRestResources = ShopifyRes
|
|
|
11
11
|
* <description>Use the session associated with this request to use REST resources.</description>
|
|
12
12
|
* ```ts
|
|
13
13
|
* // /app/routes/flow.tsx
|
|
14
|
-
* import {
|
|
14
|
+
* import { ActionFunctionArgs } from "@remix-run/node";
|
|
15
15
|
* import { authenticate } from "../shopify.server";
|
|
16
16
|
*
|
|
17
|
-
* export const action
|
|
17
|
+
* export const action = async ({ request }: ActionFunctionArgs) => {
|
|
18
18
|
* const { session, admin } = await authenticate.flow(request);
|
|
19
19
|
*
|
|
20
20
|
* const products = await admin?.rest.resources.Product.all({ session });
|
|
@@ -33,10 +33,10 @@ export interface FlowContext<Resources extends ShopifyRestResources = ShopifyRes
|
|
|
33
33
|
* <description>Get the request's POST payload.</description>
|
|
34
34
|
* ```ts
|
|
35
35
|
* // /app/routes/flow.tsx
|
|
36
|
-
* import {
|
|
36
|
+
* import { ActionFunctionArgs } from "@remix-run/node";
|
|
37
37
|
* import { authenticate } from "../shopify.server";
|
|
38
38
|
*
|
|
39
|
-
* export const action
|
|
39
|
+
* export const action = async ({ request }: ActionFunctionArgs) => {
|
|
40
40
|
* const { payload } = await authenticate.flow(request);
|
|
41
41
|
* return new Response();
|
|
42
42
|
* };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ShopifyRestResources } from '@shopify/shopify-api';
|
|
2
|
+
import { BasicParams } from '../../types';
|
|
3
|
+
import type { AuthenticateFulfillmentService } from './types';
|
|
4
|
+
export declare function authenticateFulfillmentServiceFactory<Resources extends ShopifyRestResources = ShopifyRestResources>(params: BasicParams): AuthenticateFulfillmentService<Resources>;
|
|
5
|
+
//# sourceMappingURL=authenticate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../../../../src/server/authenticate/fulfillment-service/authenticate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAgB,MAAM,sBAAsB,CAAC;AAGzE,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAExC,OAAO,KAAK,EACV,8BAA8B,EAE/B,MAAM,SAAS,CAAC;AAEjB,wBAAgB,qCAAqC,CACnD,SAAS,SAAS,oBAAoB,GAAG,oBAAoB,EAC7D,MAAM,EAAE,WAAW,GAAG,8BAA8B,CAAC,SAAS,CAAC,CAqEhE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticate.fulfillment-service.doc.d.ts","sourceRoot":"","sources":["../../../../../src/server/authenticate/fulfillment-service/authenticate.fulfillment-service.doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,6BA2CX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
package/build/ts/server/authenticate/fulfillment-service/authenticate.fulfillment-service.doc.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var data = {
|
|
4
|
+
name: 'Fulfillment Service',
|
|
5
|
+
description: 'Contains functions for verifying fulfillment service requests.' +
|
|
6
|
+
'\n\nSee the [fulfillment service documentation](https://shopify.dev/docs/apps/fulfillment/fulfillment-service-apps) for more information.',
|
|
7
|
+
category: 'Authenticate',
|
|
8
|
+
type: 'object',
|
|
9
|
+
isVisualComponent: false,
|
|
10
|
+
definitions: [
|
|
11
|
+
{
|
|
12
|
+
title: 'authenticate.fulfillmentService',
|
|
13
|
+
description: 'Verifies requests coming from Shopify to fulfillment service apps',
|
|
14
|
+
type: 'AuthenticateFulfillmentService',
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
defaultExample: {
|
|
18
|
+
description: 'Handle a fulfillment service notification call',
|
|
19
|
+
codeblock: {
|
|
20
|
+
title: 'Consume a fulfillment service notification request',
|
|
21
|
+
tabs: [
|
|
22
|
+
{
|
|
23
|
+
title: '/app/routes/**.ts',
|
|
24
|
+
language: 'typescript',
|
|
25
|
+
code: './authenticate.fulfillment-service.doc.example.ts',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
jsDocTypeExamples: ['FulfillmentServiceContext'],
|
|
31
|
+
related: [
|
|
32
|
+
{
|
|
33
|
+
name: 'Admin API context',
|
|
34
|
+
subtitle: 'Interact with the Admin API.',
|
|
35
|
+
url: '/docs/api/shopify-app-remix/apis/admin-api',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'Manage Fulfillments',
|
|
39
|
+
subtitle: 'Receive fulfillment requests and cancellations.',
|
|
40
|
+
url: '/docs/apps/fulfillment/fulfillment-service-apps/manage-fulfillments',
|
|
41
|
+
type: 'shopify',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
exports.default = data;
|
|
46
|
+
//# sourceMappingURL=authenticate.fulfillment-service.doc.js.map
|
package/build/ts/server/authenticate/fulfillment-service/authenticate.fulfillment-service.doc.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticate.fulfillment-service.doc.js","sourceRoot":"","sources":["../../../../../src/server/authenticate/fulfillment-service/authenticate.fulfillment-service.doc.ts"],"names":[],"mappings":";;AAEA,IAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EACT,gEAAgE;QAChE,2IAA2I;IAC7I,QAAQ,EAAE,cAAc;IACxB,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,KAAK;IACxB,WAAW,EAAE;QACX;YACE,KAAK,EAAE,iCAAiC;YACxC,WAAW,EACT,mEAAmE;YACrE,IAAI,EAAE,gCAAgC;SACvC;KACF;IACD,cAAc,EAAE;QACd,WAAW,EAAE,gDAAgD;QAC7D,SAAS,EAAE;YACT,KAAK,EAAE,oDAAoD;YAC3D,IAAI,EAAE;gBACJ;oBACE,KAAK,EAAE,mBAAmB;oBAC1B,QAAQ,EAAE,YAAY;oBACtB,IAAI,EAAE,mDAAmD;iBAC1D;aACF;SACF;KACF;IACD,iBAAiB,EAAE,CAAC,2BAA2B,CAAC;IAChD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,mBAAmB;YACzB,QAAQ,EAAE,8BAA8B;YACxC,GAAG,EAAE,4CAA4C;SAClD;QACD;YACE,IAAI,EAAE,qBAAqB;YAC3B,QAAQ,EAAE,iDAAiD;YAC3D,GAAG,EAAE,qEAAqE;YAC1E,IAAI,EAAE,SAAS;SAChB;KACF;CACF,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.authenticateFulfillmentServiceFactory = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var shopify_api_1 = require("@shopify/shopify-api");
|
|
6
|
+
var admin_1 = require("../../clients/admin");
|
|
7
|
+
function authenticateFulfillmentServiceFactory(params) {
|
|
8
|
+
var api = params.api, config = params.config, logger = params.logger;
|
|
9
|
+
return function authenticate(request) {
|
|
10
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
11
|
+
var rawBody, result, payload, shop, sessionId, session;
|
|
12
|
+
return tslib_1.__generator(this, function (_a) {
|
|
13
|
+
switch (_a.label) {
|
|
14
|
+
case 0:
|
|
15
|
+
logger.info('Authenticating fulfillment service request');
|
|
16
|
+
if (request.method !== 'POST') {
|
|
17
|
+
logger.debug('Received a non-POST request for fulfillment service. Only POST requests are allowed.', { url: request.url, method: request.method });
|
|
18
|
+
throw new Response(undefined, {
|
|
19
|
+
status: 405,
|
|
20
|
+
statusText: 'Method not allowed',
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return [4 /*yield*/, request.text()];
|
|
24
|
+
case 1:
|
|
25
|
+
rawBody = _a.sent();
|
|
26
|
+
return [4 /*yield*/, api.fulfillmentService.validate({
|
|
27
|
+
rawBody: rawBody,
|
|
28
|
+
rawRequest: request,
|
|
29
|
+
})];
|
|
30
|
+
case 2:
|
|
31
|
+
result = _a.sent();
|
|
32
|
+
if (!result.valid) {
|
|
33
|
+
logger.error('Received an invalid fulfillment service request', {
|
|
34
|
+
reason: result.reason,
|
|
35
|
+
});
|
|
36
|
+
throw new Response(undefined, {
|
|
37
|
+
status: 400,
|
|
38
|
+
statusText: 'Bad Request',
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
payload = JSON.parse(rawBody);
|
|
42
|
+
shop = request.headers.get(shopify_api_1.ShopifyHeader.Domain) || '';
|
|
43
|
+
logger.debug('Fulfillment service request is valid, looking for an offline session', {
|
|
44
|
+
shop: shop,
|
|
45
|
+
});
|
|
46
|
+
sessionId = api.session.getOfflineId(shop);
|
|
47
|
+
return [4 /*yield*/, config.sessionStorage.loadSession(sessionId)];
|
|
48
|
+
case 3:
|
|
49
|
+
session = _a.sent();
|
|
50
|
+
if (!session) {
|
|
51
|
+
logger.info('Fulfillment service request could not find session', {
|
|
52
|
+
shop: shop,
|
|
53
|
+
});
|
|
54
|
+
throw new Response(undefined, {
|
|
55
|
+
status: 400,
|
|
56
|
+
statusText: 'Bad Request',
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
logger.debug('Found a session for the fulfillment service request', {
|
|
60
|
+
shop: shop,
|
|
61
|
+
});
|
|
62
|
+
return [2 /*return*/, {
|
|
63
|
+
session: session,
|
|
64
|
+
payload: payload,
|
|
65
|
+
admin: (0, admin_1.adminClientFactory)({ params: params, session: session }),
|
|
66
|
+
}];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
exports.authenticateFulfillmentServiceFactory = authenticateFulfillmentServiceFactory;
|
|
73
|
+
//# sourceMappingURL=authenticate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authenticate.js","sourceRoot":"","sources":["../../../../../src/server/authenticate/fulfillment-service/authenticate.ts"],"names":[],"mappings":";;;;AAAA,oDAAyE;AAEzE,6CAAuD;AAQvD,SAAgB,qCAAqC,CAEnD,MAAmB;IACZ,IAAA,GAAG,GAAoB,MAAM,IAA1B,EAAE,MAAM,GAAY,MAAM,OAAlB,EAAE,MAAM,GAAI,MAAM,OAAV,CAAW;IAErC,OAAO,SAAe,YAAY,CAChC,OAAgB;;;;;;wBAEhB,MAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;wBAE1D,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;4BAC9B,MAAM,CAAC,KAAK,CACV,sFAAsF,EACtF,EAAC,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAC,CAC3C,CAAC;4BACF,MAAM,IAAI,QAAQ,CAAC,SAAS,EAAE;gCAC5B,MAAM,EAAE,GAAG;gCACX,UAAU,EAAE,oBAAoB;6BACjC,CAAC,CAAC;wBACL,CAAC;wBAEe,qBAAM,OAAO,CAAC,IAAI,EAAE,EAAA;;wBAA9B,OAAO,GAAG,SAAoB;wBACrB,qBAAM,GAAG,CAAC,kBAAkB,CAAC,QAAQ,CAAC;gCACnD,OAAO,SAAA;gCACP,UAAU,EAAE,OAAO;6BACpB,CAAC,EAAA;;wBAHI,MAAM,GAAG,SAGb;wBAEF,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;4BAClB,MAAM,CAAC,KAAK,CAAC,iDAAiD,EAAE;gCAC9D,MAAM,EAAE,MAAM,CAAC,MAAM;6BACtB,CAAC,CAAC;4BAEH,MAAM,IAAI,QAAQ,CAAC,SAAS,EAAE;gCAC5B,MAAM,EAAE,GAAG;gCACX,UAAU,EAAE,aAAa;6BAC1B,CAAC,CAAC;wBACL,CAAC;wBAEK,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;wBAC9B,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,2BAAa,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;wBAE7D,MAAM,CAAC,KAAK,CACV,sEAAsE,EACtE;4BACE,IAAI,MAAA;yBACL,CACF,CAAC;wBAEI,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;wBACjC,qBAAM,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,SAAS,CAAC,EAAA;;wBAA5D,OAAO,GAAG,SAAkD;wBAElE,IAAI,CAAC,OAAO,EAAE,CAAC;4BACb,MAAM,CAAC,IAAI,CAAC,oDAAoD,EAAE;gCAChE,IAAI,MAAA;6BACL,CAAC,CAAC;4BACH,MAAM,IAAI,QAAQ,CAAC,SAAS,EAAE;gCAC5B,MAAM,EAAE,GAAG;gCACX,UAAU,EAAE,aAAa;6BAC1B,CAAC,CAAC;wBACL,CAAC;wBAED,MAAM,CAAC,KAAK,CAAC,qDAAqD,EAAE;4BAClE,IAAI,MAAA;yBACL,CAAC,CAAC;wBAEH,sBAAO;gCACL,OAAO,SAAA;gCACP,OAAO,SAAA;gCACP,KAAK,EAAE,IAAA,0BAAkB,EAAY,EAAC,MAAM,QAAA,EAAE,OAAO,SAAA,EAAC,CAAC;6BACxD,EAAC;;;;KACH,CAAC;AACJ,CAAC;AAvED,sFAuEC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Session, ShopifyRestResources } from '@shopify/shopify-api';
|
|
2
|
+
import type { AdminApiContext } from '../../clients';
|
|
3
|
+
export interface FulfillmentServiceContext<Resources extends ShopifyRestResources = ShopifyRestResources> {
|
|
4
|
+
/**
|
|
5
|
+
* A session with an offline token for the shop.
|
|
6
|
+
*
|
|
7
|
+
* Returned only if there is a session for the shop.
|
|
8
|
+
* @example
|
|
9
|
+
* <caption>Shopify session for the fulfillment service notification request.</caption>
|
|
10
|
+
* <description>Use the session associated with this request to use REST resources.</description>
|
|
11
|
+
* ```ts
|
|
12
|
+
* // /app/routes/fulfillment_service_notification.tsx
|
|
13
|
+
* import { ActionFunctionArgs } from "@remix-run/node";
|
|
14
|
+
* import { authenticate } from "../shopify.server";
|
|
15
|
+
*
|
|
16
|
+
* export const action = async ({ request }: ActionFunctionArgs) => {
|
|
17
|
+
* const { session, admin } = await authenticate.fulfillmentService(request);
|
|
18
|
+
*
|
|
19
|
+
* const products = await admin?.rest.resources.Product.all({ session });
|
|
20
|
+
* // Use products
|
|
21
|
+
*
|
|
22
|
+
* return new Response();
|
|
23
|
+
* };
|
|
24
|
+
* ```
|
|
25
|
+
* */
|
|
26
|
+
session: Session;
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* An admin context for the fulfillment service request.
|
|
30
|
+
*
|
|
31
|
+
* Returned only if there is a session for the shop.
|
|
32
|
+
* @example
|
|
33
|
+
* <caption>Shopify session for the fulfillment service request.</caption>
|
|
34
|
+
* <description>Use the session associated with this request to use the Admin GraphQL API </description>
|
|
35
|
+
* ```ts
|
|
36
|
+
* // /app/routes/fulfillment_order_notification.ts
|
|
37
|
+
* import { ActionFunctionArgs } from "@remix-run/node";
|
|
38
|
+
* import { authenticate } from "../shopify.server";
|
|
39
|
+
*
|
|
40
|
+
* export async function action({ request }: ActionFunctionArgs) {
|
|
41
|
+
* const { admin } = await authenticate.fulfillmentService(request);
|
|
42
|
+
* const response = await admin?.graphql(
|
|
43
|
+
* `#graphql
|
|
44
|
+
* query {
|
|
45
|
+
* shop {
|
|
46
|
+
* assignedFulfillmentOrders(first: 10, assignmentStatus: FULFILLMENT_REQUESTED) {
|
|
47
|
+
* edges {
|
|
48
|
+
* node {
|
|
49
|
+
* id
|
|
50
|
+
* destination {
|
|
51
|
+
* firstName
|
|
52
|
+
* lastName
|
|
53
|
+
* }
|
|
54
|
+
* lineItems(first: 10) {
|
|
55
|
+
* edges {
|
|
56
|
+
* node {
|
|
57
|
+
* id
|
|
58
|
+
* productTitle
|
|
59
|
+
* sku
|
|
60
|
+
* remainingQuantity
|
|
61
|
+
* }
|
|
62
|
+
* }
|
|
63
|
+
* }
|
|
64
|
+
* merchantRequests(first: 10, kind: FULFILLMENT_REQUEST) {
|
|
65
|
+
* edges {
|
|
66
|
+
* node {
|
|
67
|
+
* message
|
|
68
|
+
* }
|
|
69
|
+
* }
|
|
70
|
+
* }
|
|
71
|
+
* }
|
|
72
|
+
* }
|
|
73
|
+
* }
|
|
74
|
+
* }
|
|
75
|
+
* }`);
|
|
76
|
+
*
|
|
77
|
+
* const fulfillments = await response.json();
|
|
78
|
+
* return json({ data: fulfillments.data });
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
admin: AdminApiContext<Resources>;
|
|
83
|
+
/**
|
|
84
|
+
* The payload from the fulfillment service request.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* <caption>Fulfillment service request payload.</caption>
|
|
88
|
+
* <description>Get the request's POST payload.</description>
|
|
89
|
+
* ```ts
|
|
90
|
+
* /app/routes/fulfillment_order_notification.ts
|
|
91
|
+
* import { ActionFunction } from "@remix-run/node";
|
|
92
|
+
* import { authenticate } from "../shopify.server";
|
|
93
|
+
*
|
|
94
|
+
* export const action: ActionFunction = async ({ request }) => {
|
|
95
|
+
* const { payload } = await authenticate.fulfillmentService(request);
|
|
96
|
+
* if(payload.kind === 'FULFILLMENT_REQUEST') {
|
|
97
|
+
* // handle fulfillment request
|
|
98
|
+
* } else if (payload.kind === 'CANCELLATION_REQUEST') {
|
|
99
|
+
* // handle cancellation request
|
|
100
|
+
* };
|
|
101
|
+
* return new Response();
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
payload: Record<string, any> & {
|
|
105
|
+
kind: string;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
export type AuthenticateFulfillmentService<Resources extends ShopifyRestResources = ShopifyRestResources> = (request: Request) => Promise<FulfillmentServiceContext<Resources>>;
|
|
109
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/server/authenticate/fulfillment-service/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAEnE,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAEnD,MAAM,WAAW,yBAAyB,CACxC,SAAS,SAAS,oBAAoB,GAAG,oBAAoB;IAE7D;;;;;;;;;;;;;;;;;;;;;SAqBK;IACL,OAAO,EAAE,OAAO,CAAC;IACjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsDG;IACH,KAAK,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IAElC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;QAC7B,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED,MAAM,MAAM,8BAA8B,CACxC,SAAS,SAAS,oBAAoB,GAAG,oBAAoB,IAC3D,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,yBAAyB,CAAC,SAAS,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/server/authenticate/fulfillment-service/types.ts"],"names":[],"mappings":""}
|
package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.public.app-proxy.doc.d.ts","sourceRoot":"","sources":["../../../../../../src/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"authenticate.public.app-proxy.doc.d.ts","sourceRoot":"","sources":["../../../../../../src/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,6BAkDX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|