@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
|
@@ -16,6 +16,19 @@ var data = {
|
|
|
16
16
|
type: 'AuthenticateAppProxy',
|
|
17
17
|
},
|
|
18
18
|
],
|
|
19
|
+
defaultExample: {
|
|
20
|
+
description: 'Authenticate and fetch product information',
|
|
21
|
+
codeblock: {
|
|
22
|
+
title: 'Authenticate and fetch product information',
|
|
23
|
+
tabs: [
|
|
24
|
+
{
|
|
25
|
+
title: '/app/routes/**.ts',
|
|
26
|
+
language: 'typescript',
|
|
27
|
+
code: './authenticate.public.app-proxy.doc.example.ts',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
19
32
|
jsDocTypeExamples: ['AppProxyContextWithSession'],
|
|
20
33
|
related: [
|
|
21
34
|
{
|
|
@@ -28,6 +41,12 @@ var data = {
|
|
|
28
41
|
subtitle: 'Interact with the Storefront API.',
|
|
29
42
|
url: '/docs/api/shopify-app-remix/apis/storefront-api',
|
|
30
43
|
},
|
|
44
|
+
{
|
|
45
|
+
name: 'Liquid reference',
|
|
46
|
+
subtitle: "Use the shop's theme to render a template.",
|
|
47
|
+
url: '/docs/api/liquid',
|
|
48
|
+
type: 'liquid',
|
|
49
|
+
},
|
|
31
50
|
],
|
|
32
51
|
};
|
|
33
52
|
exports.default = data;
|
package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.public.app-proxy.doc.js","sourceRoot":"","sources":["../../../../../../src/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.ts"],"names":[],"mappings":";;AAEA,IAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,WAAW;IACjB,WAAW,EACT,yHAAyH;QACzH,8IAA8I;QAC9I,kIAAkI;IACpI,QAAQ,EAAE,cAAc;IACxB,WAAW,EAAE,QAAQ;IACrB,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,KAAK;IACxB,WAAW,EAAE;QACX;YACE,KAAK,EAAE,8BAA8B;YACrC,WAAW,EACT,oEAAoE;YACtE,IAAI,EAAE,sBAAsB;SAC7B;KACF;IACD,iBAAiB,EAAE,CAAC,4BAA4B,CAAC;IACjD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,mBAAmB;YACzB,QAAQ,EAAE,8BAA8B;YACxC,GAAG,EAAE,4CAA4C;SAClD;QACD;YACE,IAAI,EAAE,wBAAwB;YAC9B,QAAQ,EAAE,mCAAmC;YAC7C,GAAG,EAAE,iDAAiD;SACvD;KACF;CACF,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
|
1
|
+
{"version":3,"file":"authenticate.public.app-proxy.doc.js","sourceRoot":"","sources":["../../../../../../src/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.ts"],"names":[],"mappings":";;AAEA,IAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,WAAW;IACjB,WAAW,EACT,yHAAyH;QACzH,8IAA8I;QAC9I,kIAAkI;IACpI,QAAQ,EAAE,cAAc;IACxB,WAAW,EAAE,QAAQ;IACrB,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,KAAK;IACxB,WAAW,EAAE;QACX;YACE,KAAK,EAAE,8BAA8B;YACrC,WAAW,EACT,oEAAoE;YACtE,IAAI,EAAE,sBAAsB;SAC7B;KACF;IACD,cAAc,EAAE;QACd,WAAW,EAAE,4CAA4C;QACzD,SAAS,EAAE;YACT,KAAK,EAAE,4CAA4C;YACnD,IAAI,EAAE;gBACJ;oBACE,KAAK,EAAE,mBAAmB;oBAC1B,QAAQ,EAAE,YAAY;oBACtB,IAAI,EAAE,gDAAgD;iBACvD;aACF;SACF;KACF;IACD,iBAAiB,EAAE,CAAC,4BAA4B,CAAC;IACjD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,mBAAmB;YACzB,QAAQ,EAAE,8BAA8B;YACxC,GAAG,EAAE,4CAA4C;SAClD;QACD;YACE,IAAI,EAAE,wBAAwB;YAC9B,QAAQ,EAAE,mCAAmC;YAC7C,GAAG,EAAE,iDAAiD;SACvD;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,QAAQ,EAAE,4CAA4C;YACtD,GAAG,EAAE,kBAAkB;YACvB,IAAI,EAAE,QAAQ;SACf;KACF;CACF,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
|
@@ -14,7 +14,7 @@ interface Context {
|
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
16
|
* <caption>Rendering liquid content.</caption>
|
|
17
|
-
* <description>Use the `liquid` helper to render a `Response` with Liquid content using the shop's theme.</description>
|
|
17
|
+
* <description>Use the `liquid` helper to render a `Response` with Liquid content using the shop's theme. See the [Liquid reference](https://shopify.dev/docs/api/liquid) for all the features it enables.</description>
|
|
18
18
|
* ```ts
|
|
19
19
|
* // app/routes/**\/.ts
|
|
20
20
|
* import {authenticate} from "~/shopify.server"
|
|
@@ -82,10 +82,13 @@ export interface AppProxyContextWithSession<Resources extends ShopifyRestResourc
|
|
|
82
82
|
*
|
|
83
83
|
* export const loader = async ({ request }) => {
|
|
84
84
|
* // Get the session for the shop that initiated the request to the app proxy.
|
|
85
|
-
* const { session } =
|
|
85
|
+
* const { session } =
|
|
86
|
+
* await authenticate.public.appProxy(request);
|
|
86
87
|
*
|
|
87
88
|
* // Use the session data to make to queries to your database or additional requests.
|
|
88
|
-
* return json(
|
|
89
|
+
* return json(
|
|
90
|
+
* await getMyAppModelData({shop: session.shop})
|
|
91
|
+
* );
|
|
89
92
|
* };
|
|
90
93
|
* ```
|
|
91
94
|
*/
|
|
@@ -113,7 +116,11 @@ export interface AppProxyContextWithSession<Resources extends ShopifyRestResourc
|
|
|
113
116
|
* }
|
|
114
117
|
* }
|
|
115
118
|
* }`,
|
|
116
|
-
* {
|
|
119
|
+
* {
|
|
120
|
+
* variables: {
|
|
121
|
+
* input: { title: "Product Name" }
|
|
122
|
+
* }
|
|
123
|
+
* }
|
|
117
124
|
* );
|
|
118
125
|
*
|
|
119
126
|
* const productData = await response.json();
|
|
@@ -136,7 +143,18 @@ export interface AppProxyContextWithSession<Resources extends ShopifyRestResourc
|
|
|
136
143
|
* export async function action({ request }: ActionFunctionArgs) {
|
|
137
144
|
* const { storefront } = await authenticate.public.appProxy(request);
|
|
138
145
|
*
|
|
139
|
-
* const response = await storefront.graphql(
|
|
146
|
+
* const response = await storefront.graphql(
|
|
147
|
+
* `#graphql
|
|
148
|
+
* query blogIds {
|
|
149
|
+
* blogs(first: 10) {
|
|
150
|
+
* edges {
|
|
151
|
+
* node {
|
|
152
|
+
* id
|
|
153
|
+
* }
|
|
154
|
+
* }
|
|
155
|
+
* }
|
|
156
|
+
* }`
|
|
157
|
+
* );
|
|
140
158
|
*
|
|
141
159
|
* return json(await response.json());
|
|
142
160
|
* }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/server/authenticate/public/appProxy/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAC,eAAe,EAAE,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAEpE,MAAM,MAAM,oBAAoB,GAAG,CACjC,OAAO,EAAE,OAAO,KACb,OAAO,CAAC,eAAe,GAAG,0BAA0B,CAAC,CAAC;AAE3D,UAAU,OAAO;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,sBAAsB,GAAG,CACnC,IAAI,EAAE,MAAM,EACZ,cAAc,CAAC,EAAE,MAAM,GAAG,CAAC,YAAY,GAAG,OAAO,CAAC,KAC/C,QAAQ,CAAC;AAEd,UAAU,OAAO;IACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,MAAM,EAAE,sBAAsB,CAAC;CAChC;AAED,MAAM,WAAW,eAAgB,SAAQ,OAAO;IAC9C;;;;OAIG;IACH,OAAO,EAAE,SAAS,CAAC;IAEnB;;;OAGG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;;OAGG;IACH,UAAU,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,WAAW,0BAA0B,CACzC,SAAS,SAAS,oBAAoB,GAAG,oBAAoB,CAC7D,SAAQ,OAAO;IACf
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/server/authenticate/public/appProxy/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAC,eAAe,EAAE,iBAAiB,EAAC,MAAM,kBAAkB,CAAC;AAEpE,MAAM,MAAM,oBAAoB,GAAG,CACjC,OAAO,EAAE,OAAO,KACb,OAAO,CAAC,eAAe,GAAG,0BAA0B,CAAC,CAAC;AAE3D,UAAU,OAAO;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,sBAAsB,GAAG,CACnC,IAAI,EAAE,MAAM,EACZ,cAAc,CAAC,EAAE,MAAM,GAAG,CAAC,YAAY,GAAG,OAAO,CAAC,KAC/C,QAAQ,CAAC;AAEd,UAAU,OAAO;IACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,MAAM,EAAE,sBAAsB,CAAC;CAChC;AAED,MAAM,WAAW,eAAgB,SAAQ,OAAO;IAC9C;;;;OAIG;IACH,OAAO,EAAE,SAAS,CAAC;IAEnB;;;OAGG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;;OAGG;IACH,UAAU,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,WAAW,0BAA0B,CACzC,SAAS,SAAS,oBAAoB,GAAG,oBAAoB,CAC7D,SAAQ,OAAO;IACf;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkCG;IACH,KAAK,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,UAAU,EAAE,iBAAiB,CAAC;CAC/B"}
|
package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.public.checkout.doc.d.ts","sourceRoot":"","sources":["../../../../../../src/server/authenticate/public/checkout/authenticate.public.checkout.doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"authenticate.public.checkout.doc.d.ts","sourceRoot":"","sources":["../../../../../../src/server/authenticate/public/checkout/authenticate.public.checkout.doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,6BAoCX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -14,6 +14,24 @@ var data = {
|
|
|
14
14
|
type: 'AuthenticateCheckout',
|
|
15
15
|
},
|
|
16
16
|
],
|
|
17
|
+
defaultExample: {
|
|
18
|
+
description: 'Authenticate and return offers for the shop',
|
|
19
|
+
codeblock: {
|
|
20
|
+
title: 'Authenticate and return offers for the shop',
|
|
21
|
+
tabs: [
|
|
22
|
+
{
|
|
23
|
+
title: '/app/routes/**.ts',
|
|
24
|
+
language: 'typescript',
|
|
25
|
+
code: './authenticate.public.checkout.doc.example.ts',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
title: '/app/offers.server.ts',
|
|
29
|
+
language: 'typescript',
|
|
30
|
+
code: './authenticate.public.checkout.doc.example.offers.ts',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
17
35
|
jsDocTypeExamples: ['CheckoutContext'],
|
|
18
36
|
related: [],
|
|
19
37
|
};
|
package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.public.checkout.doc.js","sourceRoot":"","sources":["../../../../../../src/server/authenticate/public/checkout/authenticate.public.checkout.doc.ts"],"names":[],"mappings":";;AAEA,IAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,UAAU;IAChB,WAAW,EACT,wKAAwK;IAC1K,QAAQ,EAAE,cAAc;IACxB,WAAW,EAAE,QAAQ;IACrB,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,KAAK;IACxB,WAAW,EAAE;QACX;YACE,KAAK,EAAE,8BAA8B;YACrC,WAAW,EACT,iEAAiE;YACnE,IAAI,EAAE,sBAAsB;SAC7B;KACF;IACD,iBAAiB,EAAE,CAAC,iBAAiB,CAAC;IACtC,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
|
1
|
+
{"version":3,"file":"authenticate.public.checkout.doc.js","sourceRoot":"","sources":["../../../../../../src/server/authenticate/public/checkout/authenticate.public.checkout.doc.ts"],"names":[],"mappings":";;AAEA,IAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,UAAU;IAChB,WAAW,EACT,wKAAwK;IAC1K,QAAQ,EAAE,cAAc;IACxB,WAAW,EAAE,QAAQ;IACrB,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,KAAK;IACxB,WAAW,EAAE;QACX;YACE,KAAK,EAAE,8BAA8B;YACrC,WAAW,EACT,iEAAiE;YACnE,IAAI,EAAE,sBAAsB;SAC7B;KACF;IACD,cAAc,EAAE;QACd,WAAW,EAAE,6CAA6C;QAC1D,SAAS,EAAE;YACT,KAAK,EAAE,6CAA6C;YACpD,IAAI,EAAE;gBACJ;oBACE,KAAK,EAAE,mBAAmB;oBAC1B,QAAQ,EAAE,YAAY;oBACtB,IAAI,EAAE,+CAA+C;iBACtD;gBACD;oBACE,KAAK,EAAE,uBAAuB;oBAC9B,QAAQ,EAAE,YAAY;oBACtB,IAAI,EAAE,sDAAsD;iBAC7D;aACF;SACF;KACF;IACD,iBAAiB,EAAE,CAAC,iBAAiB,CAAC;IACtC,OAAO,EAAE,EAAE;CACZ,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.webhooks.doc.d.ts","sourceRoot":"","sources":["../../../../../src/server/authenticate/webhooks/authenticate.webhooks.doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"authenticate.webhooks.doc.d.ts","sourceRoot":"","sources":["../../../../../src/server/authenticate/webhooks/authenticate.webhooks.doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,6BAoCX,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -14,6 +14,19 @@ var data = {
|
|
|
14
14
|
type: 'AuthenticateWebhook',
|
|
15
15
|
},
|
|
16
16
|
],
|
|
17
|
+
defaultExample: {
|
|
18
|
+
description: 'Update a metafield when a product is updated',
|
|
19
|
+
codeblock: {
|
|
20
|
+
title: 'Update a metafield when a product is updated',
|
|
21
|
+
tabs: [
|
|
22
|
+
{
|
|
23
|
+
title: '/app/routes/**.ts',
|
|
24
|
+
language: 'typescript',
|
|
25
|
+
code: './authenticate.webhooks.doc.example.ts',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
17
30
|
jsDocTypeExamples: ['WebhookContextWithSession'],
|
|
18
31
|
related: [
|
|
19
32
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.webhooks.doc.js","sourceRoot":"","sources":["../../../../../src/server/authenticate/webhooks/authenticate.webhooks.doc.ts"],"names":[],"mappings":";;AAEA,IAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,SAAS;IACf,WAAW,EACT,oDAAoD;QACpD,4NAA4N;IAC9N,QAAQ,EAAE,cAAc;IACxB,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,KAAK;IACxB,WAAW,EAAE;QACX;YACE,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EAAE,iDAAiD;YAC9D,IAAI,EAAE,qBAAqB;SAC5B;KACF;IACD,iBAAiB,EAAE,CAAC,2BAA2B,CAAC;IAChD,OAAO,EAAE;QACP;YACE,IAAI,EAAE,mBAAmB;YACzB,QAAQ,EAAE,8BAA8B;YACxC,GAAG,EAAE,4CAA4C;SAClD;KACF;CACF,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
|
1
|
+
{"version":3,"file":"authenticate.webhooks.doc.js","sourceRoot":"","sources":["../../../../../src/server/authenticate/webhooks/authenticate.webhooks.doc.ts"],"names":[],"mappings":";;AAEA,IAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,SAAS;IACf,WAAW,EACT,oDAAoD;QACpD,4NAA4N;IAC9N,QAAQ,EAAE,cAAc;IACxB,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,KAAK;IACxB,WAAW,EAAE;QACX;YACE,KAAK,EAAE,sBAAsB;YAC7B,WAAW,EAAE,iDAAiD;YAC9D,IAAI,EAAE,qBAAqB;SAC5B;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,wCAAwC;iBAC/C;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;KACF;CACF,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Session, Shopify, ShopifyRestResources } from '@shopify/shopify-api';
|
|
2
|
-
import type { JSONValue } from '../../types';
|
|
3
2
|
import type { AdminApiContext } from '../../clients';
|
|
4
3
|
import type { FeatureEnabled, FutureFlagOptions } from '../../future/flags';
|
|
5
4
|
export interface RegisterWebhooksOptions {
|
|
@@ -17,10 +16,10 @@ interface Context<Topics = string | number | symbol> {
|
|
|
17
16
|
* <description>Get the API version used for webhook request.</description>
|
|
18
17
|
* ```ts
|
|
19
18
|
* // /app/routes/webhooks.tsx
|
|
20
|
-
* import {
|
|
19
|
+
* import { ActionFunctionArgs } from "@remix-run/node";
|
|
21
20
|
* import { authenticate } from "../shopify.server";
|
|
22
21
|
*
|
|
23
|
-
* export const action
|
|
22
|
+
* export const action = async ({ request }: ActionFunctionArgs) => {
|
|
24
23
|
* const { apiVersion } = await authenticate.webhook(request);
|
|
25
24
|
* return new Response();
|
|
26
25
|
* };
|
|
@@ -35,10 +34,10 @@ interface Context<Topics = string | number | symbol> {
|
|
|
35
34
|
* <description>Get the shop that triggered a webhook.</description>
|
|
36
35
|
* ```ts
|
|
37
36
|
* // /app/routes/webhooks.tsx
|
|
38
|
-
* import {
|
|
37
|
+
* import { ActionFunctionArgs } from "@remix-run/node";
|
|
39
38
|
* import { authenticate } from "../shopify.server";
|
|
40
39
|
*
|
|
41
|
-
* export const action
|
|
40
|
+
* export const action = async ({ request }: ActionFunctionArgs) => {
|
|
42
41
|
* const { shop } = await authenticate.webhook(request);
|
|
43
42
|
* return new Response();
|
|
44
43
|
* };
|
|
@@ -53,10 +52,10 @@ interface Context<Topics = string | number | symbol> {
|
|
|
53
52
|
* <description>Get the event topic for the webhook.</description>
|
|
54
53
|
* ```ts
|
|
55
54
|
* // /app/routes/webhooks.tsx
|
|
56
|
-
* import {
|
|
55
|
+
* import { ActionFunctionArgs } from "@remix-run/node";
|
|
57
56
|
* import { authenticate } from "../shopify.server";
|
|
58
57
|
*
|
|
59
|
-
* export const action
|
|
58
|
+
* export const action = async ({ request }: ActionFunctionArgs) => {
|
|
60
59
|
* const { topic } = await authenticate.webhook(request);
|
|
61
60
|
*
|
|
62
61
|
* switch (topic) {
|
|
@@ -78,10 +77,10 @@ interface Context<Topics = string | number | symbol> {
|
|
|
78
77
|
* <description>Get the webhook ID.</description>
|
|
79
78
|
* ```ts
|
|
80
79
|
* // /app/routes/webhooks.tsx
|
|
81
|
-
* import {
|
|
80
|
+
* import { ActionFunctionArgs } from "@remix-run/node";
|
|
82
81
|
* import { authenticate } from "../shopify.server";
|
|
83
82
|
*
|
|
84
|
-
* export const action
|
|
83
|
+
* export const action = async ({ request }: ActionFunctionArgs) => {
|
|
85
84
|
* const { webhookId } = await authenticate.webhook(request);
|
|
86
85
|
* return new Response();
|
|
87
86
|
* };
|
|
@@ -96,16 +95,16 @@ interface Context<Topics = string | number | symbol> {
|
|
|
96
95
|
* <description>Get the request's POST payload.</description>
|
|
97
96
|
* ```ts
|
|
98
97
|
* // /app/routes/webhooks.tsx
|
|
99
|
-
* import {
|
|
98
|
+
* import { ActionFunctionArgs } from "@remix-run/node";
|
|
100
99
|
* import { authenticate } from "../shopify.server";
|
|
101
100
|
*
|
|
102
|
-
* export const action
|
|
101
|
+
* export const action = async ({ request }: ActionFunctionArgs) => {
|
|
103
102
|
* const { payload } = await authenticate.webhook(request);
|
|
104
103
|
* return new Response();
|
|
105
104
|
* };
|
|
106
105
|
* ```
|
|
107
106
|
*/
|
|
108
|
-
payload:
|
|
107
|
+
payload: Record<string, any>;
|
|
109
108
|
/**
|
|
110
109
|
* The sub-topic of the webhook. This is only available for certain webhooks.
|
|
111
110
|
*
|
|
@@ -114,10 +113,10 @@ interface Context<Topics = string | number | symbol> {
|
|
|
114
113
|
* <description>Get the webhook sub-topic.</description>
|
|
115
114
|
* ```ts
|
|
116
115
|
* // /app/routes/webhooks.tsx
|
|
117
|
-
* import {
|
|
116
|
+
* import { ActionFunctionArgs } from "@remix-run/node";
|
|
118
117
|
* import { authenticate } from "../shopify.server";
|
|
119
118
|
*
|
|
120
|
-
* export const action
|
|
119
|
+
* export const action = async ({ request }: ActionFunctionArgs) => {
|
|
121
120
|
* const { subTopic } = await authenticate.webhook(request);
|
|
122
121
|
* return new Response();
|
|
123
122
|
* };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/server/authenticate/webhooks/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAE5E,OAAO,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/server/authenticate/webhooks/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAE5E,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAC,cAAc,EAAE,iBAAiB,EAAC,MAAM,oBAAoB,CAAC;AAE1E,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,UAAU,OAAO,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM;IACjD;;;;;;;;;;;;;;;;OAgBG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;;;;;;;;;;;OAgBG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE7B;;;;;;;;;;;;;;;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GACpC,yBAAyB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;AAEzD,MAAM,MAAM,mBAAmB,CAC7B,MAAM,SAAS,iBAAiB,EAChC,SAAS,SAAS,oBAAoB,EACtC,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,IAC/B,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -31,12 +31,17 @@ export interface AdminApiContext<Resources extends ShopifyRestResources = Shopif
|
|
|
31
31
|
* import { authenticate } from "../shopify.server";
|
|
32
32
|
*
|
|
33
33
|
* export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|
34
|
-
* const {
|
|
35
|
-
*
|
|
34
|
+
* const {
|
|
35
|
+
* admin,
|
|
36
|
+
* session,
|
|
37
|
+
* } = await authenticate.admin(request);
|
|
38
|
+
*
|
|
39
|
+
* return json(
|
|
40
|
+
* admin.rest.resources.Order.count({ session }),
|
|
41
|
+
* );
|
|
36
42
|
* };
|
|
37
43
|
* ```
|
|
38
44
|
*
|
|
39
|
-
*
|
|
40
45
|
* ```ts
|
|
41
46
|
* // /app/shopify.server.ts
|
|
42
47
|
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
@@ -50,7 +55,6 @@ export interface AdminApiContext<Resources extends ShopifyRestResources = Shopif
|
|
|
50
55
|
* export const authenticate = shopify.authenticate;
|
|
51
56
|
* ```
|
|
52
57
|
*
|
|
53
|
-
*
|
|
54
58
|
* @example
|
|
55
59
|
* <caption>Performing a GET request to the REST API.</caption>
|
|
56
60
|
* <description>Use `admin.rest.get` to make custom requests to make a request to to the `customer/count` endpoint</description>
|
|
@@ -61,9 +65,16 @@ export interface AdminApiContext<Resources extends ShopifyRestResources = Shopif
|
|
|
61
65
|
* import { authenticate } from "../shopify.server";
|
|
62
66
|
*
|
|
63
67
|
* export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|
64
|
-
* const {
|
|
65
|
-
*
|
|
68
|
+
* const {
|
|
69
|
+
* admin,
|
|
70
|
+
* session,
|
|
71
|
+
* } = await authenticate.admin(request);
|
|
72
|
+
*
|
|
73
|
+
* const response = await admin.rest.get({
|
|
74
|
+
* path: "/customers/count.json",
|
|
75
|
+
* });
|
|
66
76
|
* const customers = await response.json();
|
|
77
|
+
*
|
|
67
78
|
* return json({ customers });
|
|
68
79
|
* };
|
|
69
80
|
* ```
|
|
@@ -80,6 +91,7 @@ export interface AdminApiContext<Resources extends ShopifyRestResources = Shopif
|
|
|
80
91
|
* export default shopify;
|
|
81
92
|
* export const authenticate = shopify.authenticate;
|
|
82
93
|
* ```
|
|
94
|
+
*
|
|
83
95
|
* @example
|
|
84
96
|
* <caption>Performing a POST request to the REST API.</caption>
|
|
85
97
|
* <description>Use `admin.rest.post` to make custom requests to make a request to to the `customers.json` endpoint to send a welcome email</description>
|
|
@@ -89,7 +101,11 @@ export interface AdminApiContext<Resources extends ShopifyRestResources = Shopif
|
|
|
89
101
|
* import { authenticate } from "../shopify.server";
|
|
90
102
|
*
|
|
91
103
|
* export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|
92
|
-
* const {
|
|
104
|
+
* const {
|
|
105
|
+
* admin,
|
|
106
|
+
* session,
|
|
107
|
+
* } = await authenticate.admin(request);
|
|
108
|
+
*
|
|
93
109
|
* const response = admin.rest.post({
|
|
94
110
|
* path: "customers/7392136888625/send_invite.json",
|
|
95
111
|
* body: {
|
|
@@ -101,7 +117,8 @@ export interface AdminApiContext<Resources extends ShopifyRestResources = Shopif
|
|
|
101
117
|
* custom_message: "My awesome new store",
|
|
102
118
|
* },
|
|
103
119
|
* },
|
|
104
|
-
*
|
|
120
|
+
* });
|
|
121
|
+
*
|
|
105
122
|
* const customerInvite = await response.json();
|
|
106
123
|
* return json({ customerInvite });
|
|
107
124
|
* };
|
|
@@ -131,10 +148,11 @@ export interface AdminApiContext<Resources extends ShopifyRestResources = Shopif
|
|
|
131
148
|
* <caption>Querying the GraphQL API.</caption>
|
|
132
149
|
* <description>Use `admin.graphql` to make query / mutation requests.</description>
|
|
133
150
|
* ```ts
|
|
151
|
+
* // /app/routes/**\/*.ts
|
|
134
152
|
* import { ActionFunctionArgs } from "@remix-run/node";
|
|
135
153
|
* import { authenticate } from "../shopify.server";
|
|
136
154
|
*
|
|
137
|
-
* export async
|
|
155
|
+
* export const action = async ({ request }: ActionFunctionArgs) => {
|
|
138
156
|
* const { admin } = await authenticate.admin(request);
|
|
139
157
|
*
|
|
140
158
|
* const response = await admin.graphql(
|
|
@@ -146,11 +164,17 @@ export interface AdminApiContext<Resources extends ShopifyRestResources = Shopif
|
|
|
146
164
|
* }
|
|
147
165
|
* }
|
|
148
166
|
* }`,
|
|
149
|
-
* {
|
|
167
|
+
* {
|
|
168
|
+
* variables: {
|
|
169
|
+
* input: { title: "Product Name" },
|
|
170
|
+
* },
|
|
171
|
+
* },
|
|
150
172
|
* );
|
|
151
173
|
*
|
|
152
174
|
* const productData = await response.json();
|
|
153
|
-
* return json({
|
|
175
|
+
* return json({
|
|
176
|
+
* productId: productData.data?.productCreate?.product?.id,
|
|
177
|
+
* });
|
|
154
178
|
* }
|
|
155
179
|
* ```
|
|
156
180
|
*
|
|
@@ -159,11 +183,58 @@ export interface AdminApiContext<Resources extends ShopifyRestResources = Shopif
|
|
|
159
183
|
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
160
184
|
*
|
|
161
185
|
* const shopify = shopifyApp({
|
|
162
|
-
*
|
|
163
|
-
* // ...etc
|
|
186
|
+
* // ...
|
|
164
187
|
* });
|
|
165
188
|
* export default shopify;
|
|
166
|
-
* export const
|
|
189
|
+
* export const authenticate = shopify.authenticate;
|
|
190
|
+
* ```
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* <caption>Handling GraphQL errors.</caption>
|
|
194
|
+
* <description>Catch `GraphqlQueryError` errors to see error messages from the API.</description>
|
|
195
|
+
* ```ts
|
|
196
|
+
* // /app/routes/**\/*.ts
|
|
197
|
+
* import { ActionFunctionArgs } from "@remix-run/node";
|
|
198
|
+
* import { authenticate } from "../shopify.server";
|
|
199
|
+
*
|
|
200
|
+
* export const action = async ({ request }: ActionFunctionArgs) => {
|
|
201
|
+
* const { admin } = await authenticate.admin(request);
|
|
202
|
+
*
|
|
203
|
+
* try {
|
|
204
|
+
* const response = await admin.graphql(
|
|
205
|
+
* `#graphql
|
|
206
|
+
* query incorrectQuery {
|
|
207
|
+
* products(first: 10) {
|
|
208
|
+
* nodes {
|
|
209
|
+
* not_a_field
|
|
210
|
+
* }
|
|
211
|
+
* }
|
|
212
|
+
* }`,
|
|
213
|
+
* );
|
|
214
|
+
*
|
|
215
|
+
* return json({ data: await response.json() });
|
|
216
|
+
* } catch (error) {
|
|
217
|
+
* if (error instanceof GraphqlQueryError) {
|
|
218
|
+
* // error.body.errors:
|
|
219
|
+
* // { graphQLErrors: [
|
|
220
|
+
* // { message: "Field 'not_a_field' doesn't exist on type 'Product'" }
|
|
221
|
+
* // ] }
|
|
222
|
+
* return json({ errors: error.body?.errors }, { status: 500 });
|
|
223
|
+
* }
|
|
224
|
+
* return json({ message: "An error occurred" }, { status: 500 });
|
|
225
|
+
* }
|
|
226
|
+
* }
|
|
227
|
+
* ```
|
|
228
|
+
*
|
|
229
|
+
* ```ts
|
|
230
|
+
* // /app/shopify.server.ts
|
|
231
|
+
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
232
|
+
*
|
|
233
|
+
* const shopify = shopifyApp({
|
|
234
|
+
* // ...
|
|
235
|
+
* });
|
|
236
|
+
* export default shopify;
|
|
237
|
+
* export const authenticate = shopify.authenticate;
|
|
167
238
|
* ```
|
|
168
239
|
*/
|
|
169
240
|
graphql: GraphQLClient<AdminOperations>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/admin/types.ts"],"names":[],"mappings":"AAAA,OAA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MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAEpB,MAAM,WAAW,eAAe,CAC9B,SAAS,SAAS,oBAAoB,GAAG,oBAAoB;IAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0HG;IACH,IAAI,EAAE,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAkGG;IACH,OAAO,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;CACzC"}
|
|
@@ -24,6 +24,53 @@ export interface StorefrontContext {
|
|
|
24
24
|
* return json(await response.json());
|
|
25
25
|
* }
|
|
26
26
|
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* <caption>Handling GraphQL errors.</caption>
|
|
30
|
+
* <description>Catch `GraphqlQueryError` errors to see error messages from the API.</description>
|
|
31
|
+
* ```ts
|
|
32
|
+
* // /app/routes/**\/*.ts
|
|
33
|
+
* import { ActionFunctionArgs } from "@remix-run/node";
|
|
34
|
+
* import { authenticate } from "../shopify.server";
|
|
35
|
+
*
|
|
36
|
+
* export const action = async ({ request }: ActionFunctionArgs) => {
|
|
37
|
+
* const { storefront } = await authenticate.public.appProxy(request);
|
|
38
|
+
*
|
|
39
|
+
* try {
|
|
40
|
+
* const response = await storefront.graphql(
|
|
41
|
+
* `#graphql
|
|
42
|
+
* query incorrectQuery {
|
|
43
|
+
* products(first: 10) {
|
|
44
|
+
* nodes {
|
|
45
|
+
* not_a_field
|
|
46
|
+
* }
|
|
47
|
+
* }
|
|
48
|
+
* }`,
|
|
49
|
+
* );
|
|
50
|
+
*
|
|
51
|
+
* return json({ data: await response.json() });
|
|
52
|
+
* } catch (error) {
|
|
53
|
+
* if (error instanceof GraphqlQueryError) {
|
|
54
|
+
* // { errors: { graphQLErrors: [
|
|
55
|
+
* // { message: "Field 'not_a_field' doesn't exist on type 'Product'" }
|
|
56
|
+
* // ] } }
|
|
57
|
+
* return json({ errors: error.body?.errors }, { status: 500 });
|
|
58
|
+
* }
|
|
59
|
+
* return json({ message: "An error occurred" }, { status: 500 });
|
|
60
|
+
* }
|
|
61
|
+
* }
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* ```ts
|
|
65
|
+
* // /app/shopify.server.ts
|
|
66
|
+
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
67
|
+
*
|
|
68
|
+
* const shopify = shopifyApp({
|
|
69
|
+
* // ...
|
|
70
|
+
* });
|
|
71
|
+
* export default shopify;
|
|
72
|
+
* export const authenticate = shopify.authenticate;
|
|
73
|
+
* ```
|
|
27
74
|
*/
|
|
28
75
|
graphql: GraphQLClient<StorefrontOperations>;
|
|
29
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/storefront/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAEvC,MAAM,WAAW,iBAAiB;IAChC
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/storefront/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAEvC,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsEG;IACH,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CAC9C"}
|
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import type { AllOperations, ReturnData, FetchResponseBody, ApiClientRequestOptions, ResponseWithType } from '@shopify/admin-api-client';
|
|
2
2
|
import { ApiVersion } from '@shopify/shopify-api';
|
|
3
3
|
export interface GraphQLQueryOptions<Operation extends keyof Operations, Operations extends AllOperations> {
|
|
4
|
+
/**
|
|
5
|
+
* The variables to pass to the operation.
|
|
6
|
+
*/
|
|
4
7
|
variables?: ApiClientRequestOptions<Operation, Operations>['variables'];
|
|
8
|
+
/**
|
|
9
|
+
* The version of the API to use for the request.
|
|
10
|
+
*/
|
|
5
11
|
apiVersion?: ApiVersion;
|
|
12
|
+
/**
|
|
13
|
+
* Additional headers to include in the request.
|
|
14
|
+
*/
|
|
6
15
|
headers?: Record<string, any>;
|
|
16
|
+
/**
|
|
17
|
+
* The total number of times to try the request if it fails.
|
|
18
|
+
*/
|
|
7
19
|
tries?: number;
|
|
8
20
|
}
|
|
9
|
-
export type
|
|
21
|
+
export type GraphQLResponse<Operation extends keyof Operations, Operations extends AllOperations> = ResponseWithType<FetchResponseBody<ReturnData<Operation, Operations>>>;
|
|
22
|
+
export type GraphQLClient<Operations extends AllOperations> = <Operation extends keyof Operations>(query: Operation, options?: GraphQLQueryOptions<Operation, Operations>) => Promise<GraphQLResponse<Operation, Operations>>;
|
|
10
23
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/server/clients/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAEhD,MAAM,WAAW,mBAAmB,CAClC,SAAS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AAE3E,MAAM,MAAM,aAAa,CAAC,UAAU,SAAS,aAAa,IAAI,CAC5D,SAAS,SAAS,MAAM,UAAU,EAElC,KAAK,EAAE,SAAS,EAChB,OAAO,CAAC,EAAE,mBAAmB,CAAC,SAAS,EAAE,UAAU,CAAC,KACjD,OAAO,CAAC,eAAe,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { ConfigParams, ShopifyRestResources } from '@shopify/shopify-api';
|
|
1
|
+
import type { ConfigParams, Shopify, ShopifyRestResources } from '@shopify/shopify-api';
|
|
2
|
+
import { AppConfig } from '../config-types';
|
|
2
3
|
export interface FutureFlags {
|
|
3
4
|
/**
|
|
4
5
|
* When enabled, returns the same `admin` context (`AdminApiContext`) from `authenticate.webhook` that is returned from `authenticate.admin`.
|
|
@@ -32,4 +33,5 @@ export interface ApiFutureFlags<Future extends FutureFlagOptions> {
|
|
|
32
33
|
export type ApiConfigWithFutureFlags<Future extends FutureFlagOptions> = ConfigParams<ShopifyRestResources, ApiFutureFlags<Future>>;
|
|
33
34
|
export type FutureFlagOptions = FutureFlags | undefined;
|
|
34
35
|
export type FeatureEnabled<Future extends FutureFlagOptions, Flag extends keyof FutureFlags> = Future extends FutureFlags ? Future[Flag] extends true ? true : false : false;
|
|
36
|
+
export declare function logDisabledFutureFlags(config: AppConfig, logger: Shopify['logger']): void;
|
|
35
37
|
//# sourceMappingURL=flags.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../../../src/server/future/flags.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../../../src/server/future/flags.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EACZ,OAAO,EACP,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAG1C,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;;;;OAOG;IACH,gCAAgC,CAAC,EAAE,OAAO,CAAC;CAC5C;AAID,MAAM,WAAW,cAAc,CAAC,MAAM,SAAS,iBAAiB;IAC9D,mBAAmB,EAAE,MAAM,SAAS,WAAW,GAC3C,MAAM,CAAC,oBAAoB,CAAC,GAC5B,KAAK,CAAC;CACX;AAED,MAAM,MAAM,wBAAwB,CAAC,MAAM,SAAS,iBAAiB,IACnE,YAAY,CAAC,oBAAoB,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;AAE7D,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,SAAS,CAAC;AAExD,MAAM,MAAM,cAAc,CACxB,MAAM,SAAS,iBAAiB,EAChC,IAAI,SAAS,MAAM,WAAW,IAC5B,MAAM,SAAS,WAAW,GAC1B,MAAM,CAAC,IAAI,CAAC,SAAS,IAAI,GACvB,IAAI,GACJ,KAAK,GACP,KAAK,CAAC;AAEV,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,QAiC1B"}
|
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// When adding new flags, you should also add them to the `TEST_FUTURE_FLAGS` object in `test-config.ts` to ensure that
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.logDisabledFutureFlags = void 0;
|
|
5
|
+
function logDisabledFutureFlags(config, logger) {
|
|
6
|
+
var logFlag = function (flag, message) {
|
|
7
|
+
return logger.info("Future flag ".concat(flag, " is disabled.\n\n ").concat(message, "\n"));
|
|
8
|
+
};
|
|
9
|
+
if (!config.future.v3_authenticatePublic) {
|
|
10
|
+
logFlag('v3_authenticatePublic', 'Enable this flag to allow appProxy and checkout in `shopify.authenticate.public`.');
|
|
11
|
+
}
|
|
12
|
+
if (!config.future.v3_lineItemBilling) {
|
|
13
|
+
logFlag('v3_lineItemBilling', 'Enable this flag to allow billing plans with multiple line items.');
|
|
14
|
+
}
|
|
15
|
+
if (!config.future.v3_webhookAdminContext) {
|
|
16
|
+
logFlag('v3_webhookAdminContext', 'Enable this flag to use the standard Admin context when calling `shopify.authenticate.webhook`.');
|
|
17
|
+
}
|
|
18
|
+
if (!config.future.unstable_newEmbeddedAuthStrategy) {
|
|
19
|
+
logFlag('unstable_newEmbeddedAuthStrategy', 'Enable this to use OAuth token exchange instead of auth code to generate API access tokens.' +
|
|
20
|
+
'\n Your app must be using Shopify managed install: https://shopify.dev/docs/apps/auth/installation');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.logDisabledFutureFlags = logDisabledFutureFlags;
|
|
4
24
|
//# sourceMappingURL=flags.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../../../../src/server/future/flags.ts"],"names":[],"mappings":";AAAA,uHAAuH"}
|
|
1
|
+
{"version":3,"file":"flags.js","sourceRoot":"","sources":["../../../../src/server/future/flags.ts"],"names":[],"mappings":";AAAA,uHAAuH;;;AAgEvH,SAAgB,sBAAsB,CACpC,MAAiB,EACjB,MAAyB;IAEzB,IAAM,OAAO,GAAG,UAAC,IAAY,EAAE,OAAe;QAC5C,OAAA,MAAM,CAAC,IAAI,CAAC,sBAAe,IAAI,gCAAsB,OAAO,OAAI,CAAC;IAAjE,CAAiE,CAAC;IAEpE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC;QACzC,OAAO,CACL,uBAAuB,EACvB,mFAAmF,CACpF,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC;QACtC,OAAO,CACL,oBAAoB,EACpB,mEAAmE,CACpE,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC;QAC1C,OAAO,CACL,wBAAwB,EACxB,iGAAiG,CAClG,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,gCAAgC,EAAE,CAAC;QACpD,OAAO,CACL,kCAAkC,EAClC,6FAA6F;YAC3F,qGAAqG,CACxG,CAAC;IACJ,CAAC;AACH,CAAC;AAnCD,wDAmCC"}
|
|
@@ -25,5 +25,5 @@ import { FutureFlagOptions } from './future/flags';
|
|
|
25
25
|
* export default shopify;
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
export declare function shopifyApp<Config extends AppConfigArg<Resources, Storage, Future>, Resources extends ShopifyRestResources, Storage extends SessionStorage, Future extends FutureFlagOptions = Config['future']>(appConfig: Config): ShopifyApp<Config>;
|
|
28
|
+
export declare function shopifyApp<Config extends AppConfigArg<Resources, Storage, Future>, Resources extends ShopifyRestResources, Storage extends SessionStorage, Future extends FutureFlagOptions = Config['future']>(appConfig: Readonly<Config>): ShopifyApp<Config>;
|
|
29
29
|
//# sourceMappingURL=shopify-app.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shopify-app.d.ts","sourceRoot":"","sources":["../../../src/server/shopify-app.ts"],"names":[],"mappings":"AAAA,OAAO,uCAAuC,CAAC;AAC/C,OAAO,EAIL,oBAAoB,EAErB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC;AAEpE,OAAO,EAAiB,KAAK,YAAY,EAAC,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAIL,KAAK,UAAU,EAKhB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"shopify-app.d.ts","sourceRoot":"","sources":["../../../src/server/shopify-app.ts"],"names":[],"mappings":"AAAA,OAAO,uCAAuC,CAAC;AAC/C,OAAO,EAIL,oBAAoB,EAErB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC;AAEpE,OAAO,EAAiB,KAAK,YAAY,EAAC,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAIL,KAAK,UAAU,EAKhB,MAAM,SAAS,CAAC;AAgBjB,OAAO,EAAC,iBAAiB,EAAyB,MAAM,gBAAgB,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,UAAU,CACxB,MAAM,SAAS,YAAY,CAAC,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC,EACvD,SAAS,SAAS,oBAAoB,EACtC,OAAO,SAAS,cAAc,EAC9B,MAAM,SAAS,iBAAiB,GAAG,MAAM,CAAC,QAAQ,CAAC,EACnD,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,CAqDjD"}
|