@shopify/shopify-app-remix 1.2.0 → 1.3.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.
Files changed (171) hide show
  1. package/README.md +6 -6
  2. package/build/cjs/react/components/AppProvider/AppProvider.js +35 -4
  3. package/build/cjs/server/authenticate/admin/billing/request.js +4 -2
  4. package/build/cjs/server/authenticate/public/appProxy/authenticate.js +7 -1
  5. package/build/cjs/server/boundary/index.js +6 -6
  6. package/build/cjs/server/clients/storefront/factory.js +35 -0
  7. package/build/cjs/server/shopify-app.js +7 -5
  8. package/build/cjs/server/types.js +1 -1
  9. package/build/cjs/server/unauthenticated/admin/factory.js +2 -2
  10. package/build/cjs/server/unauthenticated/helpers/get-offline-session.js +14 -0
  11. package/build/cjs/server/unauthenticated/storefront/factory.js +25 -0
  12. package/build/cjs/server/version.js +1 -1
  13. package/build/ts/react/components/AppProvider/AppProvider.d.ts +48 -8
  14. package/build/ts/react/components/AppProvider/AppProvider.d.ts.map +1 -1
  15. package/build/ts/react/components/AppProvider/AppProvider.doc.d.ts +4 -0
  16. package/build/ts/react/components/AppProvider/AppProvider.doc.d.ts.map +1 -0
  17. package/build/ts/react/components/AppProvider/AppProvider.doc.js +34 -0
  18. package/build/ts/react/components/AppProvider/AppProvider.doc.js.map +1 -0
  19. package/build/ts/react/components/AppProvider/AppProvider.js +35 -3
  20. package/build/ts/react/components/AppProvider/AppProvider.js.map +1 -1
  21. package/build/ts/server/__test-helpers/expect-admin-api-client.d.ts +1 -1
  22. package/build/ts/server/__test-helpers/expect-admin-api-client.d.ts.map +1 -1
  23. package/build/ts/server/__test-helpers/expect-storefront-api-client.d.ts +8 -0
  24. package/build/ts/server/__test-helpers/expect-storefront-api-client.d.ts.map +1 -0
  25. package/build/ts/server/__test-helpers/expect-storefront-api-client.js +57 -0
  26. package/build/ts/server/__test-helpers/expect-storefront-api-client.js.map +1 -0
  27. package/build/ts/server/__test-helpers/index.d.ts +1 -0
  28. package/build/ts/server/__test-helpers/index.d.ts.map +1 -1
  29. package/build/ts/server/__test-helpers/index.js +1 -0
  30. package/build/ts/server/__test-helpers/index.js.map +1 -1
  31. package/build/ts/server/authenticate/admin/authenticate.admin.doc.d.ts +4 -0
  32. package/build/ts/server/authenticate/admin/authenticate.admin.doc.d.ts.map +1 -0
  33. package/build/ts/server/authenticate/admin/authenticate.admin.doc.js +35 -0
  34. package/build/ts/server/authenticate/admin/authenticate.admin.doc.js.map +1 -0
  35. package/build/ts/server/authenticate/admin/authenticate.d.ts.map +1 -1
  36. package/build/ts/server/authenticate/admin/authenticate.js.map +1 -1
  37. package/build/ts/server/authenticate/admin/billing/authenticate.admin.billing.doc.d.ts +4 -0
  38. package/build/ts/server/authenticate/admin/billing/authenticate.admin.billing.doc.d.ts.map +1 -0
  39. package/build/ts/server/authenticate/admin/billing/authenticate.admin.billing.doc.js +26 -0
  40. package/build/ts/server/authenticate/admin/billing/authenticate.admin.billing.doc.js.map +1 -0
  41. package/build/ts/server/authenticate/admin/billing/request.d.ts +1 -1
  42. package/build/ts/server/authenticate/admin/billing/request.d.ts.map +1 -1
  43. package/build/ts/server/authenticate/admin/billing/request.js +2 -8
  44. package/build/ts/server/authenticate/admin/billing/request.js.map +1 -1
  45. package/build/ts/server/authenticate/admin/billing/types.d.ts +63 -55
  46. package/build/ts/server/authenticate/admin/billing/types.d.ts.map +1 -1
  47. package/build/ts/server/authenticate/admin/types.d.ts +66 -30
  48. package/build/ts/server/authenticate/admin/types.d.ts.map +1 -1
  49. package/build/ts/server/authenticate/helpers/add-response-headers.d.ts +2 -1
  50. package/build/ts/server/authenticate/helpers/add-response-headers.d.ts.map +1 -1
  51. package/build/ts/server/authenticate/helpers/add-response-headers.js.map +1 -1
  52. package/build/ts/server/authenticate/public/appProxy/authenticate.js +4 -2
  53. package/build/ts/server/authenticate/public/appProxy/authenticate.js.map +1 -1
  54. package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.d.ts +4 -0
  55. package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.d.ts.map +1 -0
  56. package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.js +32 -0
  57. package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.js.map +1 -0
  58. package/build/ts/server/authenticate/public/appProxy/types.d.ts +67 -11
  59. package/build/ts/server/authenticate/public/appProxy/types.d.ts.map +1 -1
  60. package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.d.ts +4 -0
  61. package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.d.ts.map +1 -0
  62. package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.js +21 -0
  63. package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.js.map +1 -0
  64. package/build/ts/server/authenticate/public/checkout/types.d.ts +15 -13
  65. package/build/ts/server/authenticate/public/checkout/types.d.ts.map +1 -1
  66. package/build/ts/server/authenticate/public/types.d.ts +19 -17
  67. package/build/ts/server/authenticate/public/types.d.ts.map +1 -1
  68. package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.d.ts +4 -0
  69. package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.d.ts.map +1 -0
  70. package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.js +20 -0
  71. package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.js.map +1 -0
  72. package/build/ts/server/authenticate/webhooks/types.d.ts +103 -0
  73. package/build/ts/server/authenticate/webhooks/types.d.ts.map +1 -1
  74. package/build/ts/server/boundary/index.d.ts +6 -6
  75. package/build/ts/server/boundary/index.js +6 -6
  76. package/build/ts/server/clients/admin/authenticate.admin.api.doc.d.ts +4 -0
  77. package/build/ts/server/clients/admin/authenticate.admin.api.doc.d.ts.map +1 -0
  78. package/build/ts/server/clients/admin/authenticate.admin.api.doc.js +32 -0
  79. package/build/ts/server/clients/admin/authenticate.admin.api.doc.js.map +1 -0
  80. package/build/ts/server/clients/admin/factory.d.ts +1 -1
  81. package/build/ts/server/clients/admin/factory.d.ts.map +1 -1
  82. package/build/ts/server/clients/admin/factory.js.map +1 -1
  83. package/build/ts/server/clients/admin/graphql.d.ts +3 -15
  84. package/build/ts/server/clients/admin/graphql.d.ts.map +1 -1
  85. package/build/ts/server/clients/admin/graphql.js.map +1 -1
  86. package/build/ts/server/clients/admin/index.d.ts +1 -0
  87. package/build/ts/server/clients/admin/index.d.ts.map +1 -1
  88. package/build/ts/server/clients/admin/index.js +1 -0
  89. package/build/ts/server/clients/admin/index.js.map +1 -1
  90. package/build/ts/server/clients/admin/rest.d.ts +1 -1
  91. package/build/ts/server/clients/admin/rest.d.ts.map +1 -1
  92. package/build/ts/server/clients/admin/types.d.ts +105 -1
  93. package/build/ts/server/clients/admin/types.d.ts.map +1 -1
  94. package/build/ts/server/clients/index.d.ts +3 -0
  95. package/build/ts/server/clients/index.d.ts.map +1 -0
  96. package/build/ts/server/clients/index.js +6 -0
  97. package/build/ts/server/clients/index.js.map +1 -0
  98. package/build/ts/server/clients/storefront/authenticate.storefront.api.doc.d.ts +4 -0
  99. package/build/ts/server/clients/storefront/authenticate.storefront.api.doc.d.ts.map +1 -0
  100. package/build/ts/server/clients/storefront/authenticate.storefront.api.doc.js +32 -0
  101. package/build/ts/server/clients/storefront/authenticate.storefront.api.doc.js.map +1 -0
  102. package/build/ts/server/clients/storefront/factory.d.ts +8 -0
  103. package/build/ts/server/clients/storefront/factory.d.ts.map +1 -0
  104. package/build/ts/server/clients/storefront/factory.js +39 -0
  105. package/build/ts/server/clients/storefront/factory.js.map +1 -0
  106. package/build/ts/server/clients/storefront/index.d.ts +3 -0
  107. package/build/ts/server/clients/storefront/index.d.ts.map +1 -0
  108. package/build/ts/server/clients/storefront/index.js +6 -0
  109. package/build/ts/server/clients/storefront/index.js.map +1 -0
  110. package/build/ts/server/clients/storefront/types.d.ts +29 -0
  111. package/build/ts/server/clients/storefront/types.d.ts.map +1 -0
  112. package/build/ts/server/clients/storefront/types.js +3 -0
  113. package/build/ts/server/clients/storefront/types.js.map +1 -0
  114. package/build/ts/server/clients/types.d.ts +15 -0
  115. package/build/ts/server/clients/types.d.ts.map +1 -0
  116. package/build/ts/server/clients/types.js +3 -0
  117. package/build/ts/server/clients/types.js.map +1 -0
  118. package/build/ts/server/config-types.d.ts +26 -117
  119. package/build/ts/server/config-types.d.ts.map +1 -1
  120. package/build/ts/server/shopify-app.d.ts +3 -3
  121. package/build/ts/server/shopify-app.d.ts.map +1 -1
  122. package/build/ts/server/shopify-app.doc.d.ts +4 -0
  123. package/build/ts/server/shopify-app.doc.d.ts.map +1 -0
  124. package/build/ts/server/shopify-app.doc.js +36 -0
  125. package/build/ts/server/shopify-app.doc.js.map +1 -0
  126. package/build/ts/server/shopify-app.js +6 -4
  127. package/build/ts/server/shopify-app.js.map +1 -1
  128. package/build/ts/server/types.d.ts +200 -168
  129. package/build/ts/server/types.d.ts.map +1 -1
  130. package/build/ts/server/types.js.map +1 -1
  131. package/build/ts/server/unauthenticated/admin/factory.d.ts.map +1 -1
  132. package/build/ts/server/unauthenticated/admin/factory.js +3 -4
  133. package/build/ts/server/unauthenticated/admin/factory.js.map +1 -1
  134. package/build/ts/server/unauthenticated/admin/types.d.ts +9 -7
  135. package/build/ts/server/unauthenticated/admin/types.d.ts.map +1 -1
  136. package/build/ts/server/unauthenticated/admin/unauthenticated.admin.doc.d.ts +4 -0
  137. package/build/ts/server/unauthenticated/admin/unauthenticated.admin.doc.d.ts.map +1 -0
  138. package/build/ts/server/unauthenticated/admin/unauthenticated.admin.doc.js +29 -0
  139. package/build/ts/server/unauthenticated/admin/unauthenticated.admin.doc.js.map +1 -0
  140. package/build/ts/server/unauthenticated/helpers/get-offline-session.d.ts +4 -0
  141. package/build/ts/server/unauthenticated/helpers/get-offline-session.d.ts.map +1 -0
  142. package/build/ts/server/unauthenticated/helpers/get-offline-session.js +22 -0
  143. package/build/ts/server/unauthenticated/helpers/get-offline-session.js.map +1 -0
  144. package/build/ts/server/unauthenticated/helpers/index.d.ts +2 -0
  145. package/build/ts/server/unauthenticated/helpers/index.d.ts.map +1 -0
  146. package/build/ts/server/unauthenticated/helpers/index.js +5 -0
  147. package/build/ts/server/unauthenticated/helpers/index.js.map +1 -0
  148. package/build/ts/server/unauthenticated/storefront/factory.d.ts +4 -0
  149. package/build/ts/server/unauthenticated/storefront/factory.d.ts.map +1 -0
  150. package/build/ts/server/unauthenticated/storefront/factory.js +29 -0
  151. package/build/ts/server/unauthenticated/storefront/factory.js.map +1 -0
  152. package/build/ts/server/unauthenticated/storefront/index.d.ts +2 -0
  153. package/build/ts/server/unauthenticated/storefront/index.d.ts.map +1 -0
  154. package/build/ts/server/unauthenticated/storefront/index.js +5 -0
  155. package/build/ts/server/unauthenticated/storefront/index.js.map +1 -0
  156. package/build/ts/server/unauthenticated/storefront/types.d.ts +34 -0
  157. package/build/ts/server/unauthenticated/storefront/types.d.ts.map +1 -0
  158. package/build/ts/server/unauthenticated/storefront/types.js +3 -0
  159. package/build/ts/server/unauthenticated/storefront/types.js.map +1 -0
  160. package/build/ts/server/unauthenticated/storefront/unauthenticated.storefront.doc.d.ts +4 -0
  161. package/build/ts/server/unauthenticated/storefront/unauthenticated.storefront.doc.d.ts.map +1 -0
  162. package/build/ts/server/unauthenticated/storefront/unauthenticated.storefront.doc.js +29 -0
  163. package/build/ts/server/unauthenticated/storefront/unauthenticated.storefront.doc.js.map +1 -0
  164. package/build/ts/server/unauthenticated/types.d.ts +66 -0
  165. package/build/ts/server/unauthenticated/types.d.ts.map +1 -0
  166. package/build/ts/server/unauthenticated/types.js +3 -0
  167. package/build/ts/server/unauthenticated/types.js.map +1 -0
  168. package/build/ts/server/version.d.ts +1 -1
  169. package/build/ts/server/version.js +1 -1
  170. package/build/tsconfig.tsbuildinfo +1 -1
  171. package/package.json +9 -4
@@ -0,0 +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,6BAeX,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var data = {
4
+ name: 'Webhook',
5
+ description: 'Contains functions for verifying Shopify webhooks.',
6
+ category: 'Authenticate',
7
+ type: 'object',
8
+ isVisualComponent: false,
9
+ definitions: [
10
+ {
11
+ title: 'authenticate.webhook',
12
+ description: 'Verifies requests coming from Shopify webhooks.',
13
+ type: 'AuthenticateWebhook',
14
+ },
15
+ ],
16
+ jsDocTypeExamples: ['WebhookContextWithSession'],
17
+ related: [],
18
+ };
19
+ exports.default = data;
20
+ //# sourceMappingURL=authenticate.webhooks.doc.js.map
@@ -0,0 +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,EAAE,oDAAoD;IACjE,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,EAAE;CACZ,CAAC;AAEF,kBAAe,IAAI,CAAC"}
@@ -1,13 +1,103 @@
1
1
  import { Session, Shopify, ShopifyRestResources } from '@shopify/shopify-api';
2
2
  import type { JSONValue } from '../../types';
3
3
  export interface RegisterWebhooksOptions {
4
+ /**
5
+ * The Shopify session used to register webhooks using the Admin API.
6
+ */
4
7
  session: Session;
5
8
  }
6
9
  interface Context<Topics = string | number | symbol> {
10
+ /**
11
+ * The API version used for the webhook.
12
+ *
13
+ * @example
14
+ * <caption>Webhook API version.</caption>
15
+ * <description>Get the API version used for webhook request.</description>
16
+ * ```
17
+ * import { ActionFunction } from "@remix-run/node";
18
+ * import { authenticate } from "../shopify.server";
19
+ *
20
+ * export const action: ActionFunction = async ({ request }) => {
21
+ * const { apiVersion } = await authenticate.webhook(request);
22
+ * return new Response();
23
+ * };
24
+ * ```
25
+ */
7
26
  apiVersion: string;
27
+ /**
28
+ * The shop where the webhook was triggered.
29
+ *
30
+ * @example
31
+ * <caption>Webhook shop.</caption>
32
+ * <description>Get the shop that triggered a webhook.</description>
33
+ * ```
34
+ * import { ActionFunction } from "@remix-run/node";
35
+ * import { authenticate } from "../shopify.server";
36
+ *
37
+ * export const action: ActionFunction = async ({ request }) => {
38
+ * const { shop } = await authenticate.webhook(request);
39
+ * return new Response();
40
+ * };
41
+ * ```
42
+ */
8
43
  shop: string;
44
+ /**
45
+ * The topic of the webhook.
46
+ *
47
+ * @example
48
+ * <caption>Webhook topic.</caption>
49
+ * <description>Get the event topic for the webhook.</description>
50
+ * ```
51
+ * import { ActionFunction } from "@remix-run/node";
52
+ * import { authenticate } from "../shopify.server";
53
+ *
54
+ * export const action: ActionFunction = async ({ request }) => {
55
+ * const { topic } = await authenticate.webhook(request);
56
+ *
57
+ * switch (topic) {
58
+ * case "APP_UNINSTALLED":
59
+ * // Do something when the app is uninstalled.
60
+ * break;
61
+ * }
62
+ *
63
+ * return new Response();
64
+ * };
65
+ * ```
66
+ */
9
67
  topic: Topics;
68
+ /**
69
+ * A unique ID for the webhook. Useful to keep track of which events your app has already processed.
70
+ *
71
+ * @example
72
+ * <caption>Webhook ID.</caption>
73
+ * <description>Get the webhook ID.</description>
74
+ * ```
75
+ * import { ActionFunction } from "@remix-run/node";
76
+ * import { authenticate } from "../shopify.server";
77
+ *
78
+ * export const action: ActionFunction = async ({ request }) => {
79
+ * const { webhookId } = await authenticate.webhook(request);
80
+ * return new Response();
81
+ * };
82
+ * ```
83
+ */
10
84
  webhookId: string;
85
+ /**
86
+ * The payload from the webhook request.
87
+ *
88
+ * @example
89
+ * <caption>Webhook payload.</caption>
90
+ * <description>Get the request's POST payload.</description>
91
+ * ```
92
+ * import { ActionFunction } from "@remix-run/node";
93
+ * import { authenticate } from "../shopify.server";
94
+ *
95
+ * export const action: ActionFunction = async ({ request }) => {
96
+ * const { payload } = await authenticate.webhook(request);
97
+ * return new Response();
98
+ * };
99
+ * ```
100
+ */
11
101
  payload: JSONValue;
12
102
  }
13
103
  export interface WebhookContext<Topics = string | number | symbol> extends Context<Topics> {
@@ -15,11 +105,24 @@ export interface WebhookContext<Topics = string | number | symbol> extends Conte
15
105
  admin: undefined;
16
106
  }
17
107
  export interface WebhookContextWithSession<Topics = string | number | symbol, Resources extends ShopifyRestResources = any> extends Context<Topics> {
108
+ /**
109
+ * A session with an offline token for the shop.
110
+ *
111
+ * Returned only if there is a session for the shop.
112
+ */
18
113
  session: Session;
114
+ /**
115
+ * An admin context for the webhook.
116
+ *
117
+ * Returned only if there is a session for the shop.
118
+ */
19
119
  admin: {
120
+ /** A REST client. */
20
121
  rest: InstanceType<Shopify['clients']['Rest']> & Resources;
122
+ /** A GraphQL client. */
21
123
  graphql: InstanceType<Shopify['clients']['Graphql']>;
22
124
  };
23
125
  }
126
+ export type AuthenticateWebhook<Resources extends ShopifyRestResources = ShopifyRestResources, Topics = string | number | symbol> = (request: Request) => Promise<WebhookContext<Topics> | WebhookContextWithSession<Topics, Resources>>;
24
127
  export {};
25
128
  //# sourceMappingURL=types.d.ts.map
@@ -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,SAAS,EAAC,MAAM,aAAa,CAAC;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example
11
- * Catching errors in a route
11
+ * <caption>Catching errors in a route</caption>
12
12
  * ```ts
13
- * // app/routes/admin/widgets.ts
14
- * import { boundary } from "@shopify/shopify-app-remix";
13
+ * // /app/routes/admin/widgets.ts
14
+ * import { boundary } from "@shopify/shopify-app-remix/server";
15
15
  *
16
16
  * export function ErrorBoundary() {
17
17
  * return boundary.error(useRouteError());
@@ -23,10 +23,10 @@ export declare const boundary: {
23
23
  * A function that sets the appropriate document repsonse headers.
24
24
  *
25
25
  * @example
26
- * Catching errors in a route
26
+ * <caption>Catching errors in a route</caption>
27
27
  * ```ts
28
- * // app/routes/admin/widgets.ts
29
- * import { boundary } from "@shopify/shopify-app-remix";
28
+ * // /app/routes/admin/widgets.ts
29
+ * import { boundary } from "@shopify/shopify-app-remix/server";
30
30
  *
31
31
  * export const headers = (headersArgs) => {
32
32
  * return boundary.headers(headersArgs);
@@ -11,10 +11,10 @@ exports.boundary = {
11
11
  * A function that handles errors or thrown responses.
12
12
  *
13
13
  * @example
14
- * Catching errors in a route
14
+ * <caption>Catching errors in a route</caption>
15
15
  * ```ts
16
- * // app/routes/admin/widgets.ts
17
- * import { boundary } from "@shopify/shopify-app-remix";
16
+ * // /app/routes/admin/widgets.ts
17
+ * import { boundary } from "@shopify/shopify-app-remix/server";
18
18
  *
19
19
  * export function ErrorBoundary() {
20
20
  * return boundary.error(useRouteError());
@@ -26,10 +26,10 @@ exports.boundary = {
26
26
  * A function that sets the appropriate document repsonse headers.
27
27
  *
28
28
  * @example
29
- * Catching errors in a route
29
+ * <caption>Catching errors in a route</caption>
30
30
  * ```ts
31
- * // app/routes/admin/widgets.ts
32
- * import { boundary } from "@shopify/shopify-app-remix";
31
+ * // /app/routes/admin/widgets.ts
32
+ * import { boundary } from "@shopify/shopify-app-remix/server";
33
33
  *
34
34
  * export const headers = (headersArgs) => {
35
35
  * return boundary.headers(headersArgs);
@@ -0,0 +1,4 @@
1
+ import { ReferenceEntityTemplateSchema } from '@shopify/generate-docs';
2
+ declare const data: ReferenceEntityTemplateSchema;
3
+ export default data;
4
+ //# sourceMappingURL=authenticate.admin.api.doc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticate.admin.api.doc.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/admin/authenticate.admin.api.doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,6BA6BX,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var data = {
4
+ name: 'Admin API',
5
+ description: 'Contains objects used to interact with the Admin API.' +
6
+ '\n\nThis object is returned as part of different contexts, such as [`admin`](/docs/api/shopify-app-remix/authenticate/admin), [`unauthenticated.admin`](/docs/api/shopify-app-remix/unauthenticated/unauthenticated-admin), and [`webhook`](/docs/api/shopify-app-remix/authenticate/webhook).',
7
+ category: 'APIs',
8
+ type: 'object',
9
+ isVisualComponent: false,
10
+ definitions: [
11
+ {
12
+ title: 'admin',
13
+ description: 'Provides utilities that apps can use to make requests to the Admin API.',
14
+ type: 'AdminApiContext',
15
+ },
16
+ ],
17
+ jsDocTypeExamples: ['AdminApiContext'],
18
+ related: [
19
+ {
20
+ name: 'Authenticated context',
21
+ subtitle: 'Authenticate requests from Shopify Admin.',
22
+ url: '/docs/api/shopify-app-remix/authenticate/admin',
23
+ },
24
+ {
25
+ name: 'Unauthenticated context',
26
+ subtitle: 'Interact with the Admin API on non-Shopify requests.',
27
+ url: '/docs/api/shopify-app-remix/unauthenticated/unauthenticated-admin',
28
+ },
29
+ ],
30
+ };
31
+ exports.default = data;
32
+ //# sourceMappingURL=authenticate.admin.api.doc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticate.admin.api.doc.js","sourceRoot":"","sources":["../../../../../src/server/clients/admin/authenticate.admin.api.doc.ts"],"names":[],"mappings":";;AAEA,IAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,WAAW;IACjB,WAAW,EACT,uDAAuD;QACvD,gSAAgS;IAClS,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,KAAK;IACxB,WAAW,EAAE;QACX;YACE,KAAK,EAAE,OAAO;YACd,WAAW,EACT,yEAAyE;YAC3E,IAAI,EAAE,iBAAiB;SACxB;KACF;IACD,iBAAiB,EAAE,CAAC,iBAAiB,CAAC;IACtC,OAAO,EAAE;QACP;YACE,IAAI,EAAE,uBAAuB;YAC7B,QAAQ,EAAE,2CAA2C;YACrD,GAAG,EAAE,gDAAgD;SACtD;QACD;YACE,IAAI,EAAE,yBAAyB;YAC/B,QAAQ,EAAE,sDAAsD;YAChE,GAAG,EAAE,mEAAmE;SACzE;KACF;CACF,CAAC;AAEF,kBAAe,IAAI,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { Session, ShopifyRestResources } from '@shopify/shopify-api';
2
- import { AdminApiContext } from '../../config-types';
3
2
  import { BasicParams } from '../../types';
3
+ import type { AdminApiContext } from './types';
4
4
  interface RestClientOptions {
5
5
  params: BasicParams;
6
6
  session: Session;
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/admin/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAKxC,UAAU,iBAAiB;IACzB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD;AACD,wBAAgB,kBAAkB,CAChC,SAAS,SAAS,oBAAoB,GAAG,oBAAoB,EAC7D,EACA,MAAM,EACN,iBAAiB,EACjB,OAAO,GACR,EAAE,iBAAiB,GAAG,eAAe,CAAC,SAAS,CAAC,CAShD"}
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/admin/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAIxC,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAE7C,UAAU,iBAAiB;IACzB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACnD;AAED,wBAAgB,kBAAkB,CAChC,SAAS,SAAS,oBAAoB,GAAG,oBAAoB,EAC7D,EACA,MAAM,EACN,iBAAiB,EACjB,OAAO,GACR,EAAE,iBAAiB,GAAG,eAAe,CAAC,SAAS,CAAC,CAShD"}
@@ -1 +1 @@
1
- {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../../../src/server/clients/admin/factory.ts"],"names":[],"mappings":";;;AAKA,qCAA+C;AAC/C,+BAAyC;AAOzC,SAAgB,kBAAkB,CAEhC,EAIkB;QAHlB,MAAM,YAAA,EACN,iBAAiB,uBAAA,EACjB,OAAO,aAAA;IAEP,OAAO;QACL,IAAI,EAAE,IAAA,wBAAiB,EAAY;YACjC,MAAM,QAAA;YACN,OAAO,SAAA;YACP,iBAAiB,mBAAA;SAClB,CAAC;QACF,OAAO,EAAE,IAAA,8BAAoB,EAAC,EAAC,MAAM,QAAA,EAAE,OAAO,SAAA,EAAE,iBAAiB,mBAAA,EAAC,CAAC;KACpE,CAAC;AACJ,CAAC;AAfD,gDAeC"}
1
+ {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../../../src/server/clients/admin/factory.ts"],"names":[],"mappings":";;;AAIA,qCAA+C;AAC/C,+BAAyC;AASzC,SAAgB,kBAAkB,CAEhC,EAIkB;QAHlB,MAAM,YAAA,EACN,iBAAiB,uBAAA,EACjB,OAAO,aAAA;IAEP,OAAO;QACL,IAAI,EAAE,IAAA,wBAAiB,EAAY;YACjC,MAAM,QAAA;YACN,OAAO,SAAA;YACP,iBAAiB,mBAAA;SAClB,CAAC;QACF,OAAO,EAAE,IAAA,8BAAoB,EAAC,EAAC,MAAM,QAAA,EAAE,OAAO,SAAA,EAAE,iBAAiB,mBAAA,EAAC,CAAC;KACpE,CAAC;AACJ,CAAC;AAfD,gDAeC"}
@@ -1,17 +1,5 @@
1
- import { ApiVersion } from '@shopify/shopify-api';
1
+ import { GraphQLClient, GraphQLQueryOptions } from '../types';
2
2
  import { AdminClientOptions } from './types';
3
- interface QueryVariables {
4
- [key: string]: any;
5
- }
6
- interface QueryOptions {
7
- variables?: QueryVariables;
8
- apiVersion?: ApiVersion;
9
- headers?: {
10
- [key: string]: any;
11
- };
12
- tries?: number;
13
- }
14
- export type GraphqlQueryFunction = (query: string, options?: QueryOptions) => Promise<Response>;
15
- export declare function graphqlClientFactory({ params, handleClientError, session, }: AdminClientOptions): (query: string, options?: QueryOptions) => Promise<Response>;
16
- export {};
3
+ export type GraphqlQueryFunction = (query: string, options?: GraphQLQueryOptions) => Promise<Response>;
4
+ export declare function graphqlClientFactory({ params, handleClientError, session, }: AdminClientOptions): GraphQLClient;
17
5
  //# sourceMappingURL=graphql.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/admin/graphql.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAGhD,OAAO,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAC;AAE3C,UAAU,cAAc;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,UAAU,YAAY;IACpB,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,OAAO,CAAC,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,oBAAoB,GAAG,CACjC,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,YAAY,KACnB,OAAO,CAAC,QAAQ,CAAC,CAAC;AAMvB,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,EACN,iBAAiB,EACjB,OAAO,GACR,EAAE,kBAAkB,WACgB,MAAM,YAAY,YAAY,uBAyBlE"}
1
+ {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/admin/graphql.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAE,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAE5D,OAAO,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAC;AAE3C,MAAM,MAAM,oBAAoB,GAAG,CACjC,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,mBAAmB,KAC1B,OAAO,CAAC,QAAQ,CAAC,CAAC;AAMvB,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,EACN,iBAAiB,EACjB,OAAO,GACR,EAAE,kBAAkB,GAAG,aAAa,CA0BpC"}
@@ -1 +1 @@
1
- {"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../../../../src/server/clients/admin/graphql.ts"],"names":[],"mappings":";;;;AACA,wDAAyD;AAoBzD,+CAA+C;AAC/C,uHAAuH;AACvH,wHAAwH;AACxH,wBAAwB;AACxB,SAAgB,oBAAoB,CAAC,EAIhB;QAHnB,MAAM,YAAA,EACN,iBAAiB,uBAAA,EACjB,OAAO,aAAA;IAEP,OAAO,SAAe,KAAK,CAAC,KAAa,EAAE,OAAsB;;;;;;wBACzD,MAAM,GAAG,IAAI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OAAO,CAAC,OAAO,CAAC;4BAC5C,OAAO,SAAA;4BACP,UAAU,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU;yBAChC,CAAC,CAAC;;;;wBAImB,qBAAM,MAAM,CAAC,KAAK,CAAC;gCACrC,IAAI,EAAE,EAAC,KAAK,OAAA,EAAE,SAAS,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,EAAC;gCAC5C,KAAK,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK;gCACrB,YAAY,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO;6BAC/B,CAAC,EAAA;;wBAJI,WAAW,GAAG,SAIlB;wBAEF,sBAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;gCACpD,OAAO,EAAE,IAAA,qBAAW,EAAC,WAAW,CAAC,OAAO,CAAC;6BAC1C,CAAC,EAAC;;;6BAEC,iBAAiB,EAAjB,wBAAiB;wBACb,qBAAM,iBAAiB,CAAC,EAAC,KAAK,SAAA,EAAE,MAAM,QAAA,EAAE,OAAO,SAAA,EAAC,CAAC,EAAA;4BAAvD,MAAM,SAAiD,CAAC;4BAG1D,MAAM,OAAK,CAAC;;;;;KAEf,CAAC;AACJ,CAAC;AA9BD,oDA8BC"}
@@ -1,2 +1,3 @@
1
1
  export * from './factory';
2
+ export * from './types';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/admin/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/admin/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
@@ -2,4 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./factory"), exports);
5
+ tslib_1.__exportStar(require("./types"), exports);
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/server/clients/admin/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/server/clients/admin/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B;AAC1B,kDAAwB"}
@@ -1,5 +1,5 @@
1
1
  import { DeleteRequestParams, GetRequestParams, PostRequestParams, PutRequestParams, RequestParams, Session, ShopifyRestResources } from '@shopify/shopify-api';
2
- import { AdminClientOptions } from './types';
2
+ import type { AdminClientOptions } from './types';
3
3
  export type RestClientWithResources<Resources extends ShopifyRestResources> = RemixRestClient & {
4
4
  resources: Resources;
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"rest.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/admin/rest.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,OAAO,EAEP,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAC;AAE3C,MAAM,MAAM,uBAAuB,CAAC,SAAS,SAAS,oBAAoB,IACxE,eAAe,GAAG;IAAC,SAAS,EAAE,SAAS,CAAA;CAAC,CAAC;AAE3C,wBAAgB,iBAAiB,CAC/B,SAAS,SAAS,oBAAoB,GAAG,oBAAoB,EAC7D,EACA,MAAM,EACN,iBAAiB,EACjB,OAAO,GACR,EAAE,kBAAkB,GAAG,uBAAuB,CAAC,SAAS,CAAC,CA+BzD;AAED,cAAM,eAAe;IACZ,OAAO,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,iBA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AAC,MAAM,EAAE,gBAAgB;IAOzC;;OAEG;IACU,MAAM,CAAC,MAAM,EAAE,mBAAmB;cAO/B,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC;CAwBtE"}
@@ -1,5 +1,7 @@
1
- import { Session } from '@shopify/shopify-api';
1
+ import { Session, ShopifyRestResources } from '@shopify/shopify-api';
2
2
  import { BasicParams } from '../../types';
3
+ import { GraphQLClient } from '../types';
4
+ import type { RestClientWithResources } from './rest';
3
5
  export interface AdminClientOptions {
4
6
  params: BasicParams;
5
7
  session: Session;
@@ -10,4 +12,106 @@ export type HandleAdminClientError = (arg: {
10
12
  params: BasicParams;
11
13
  session: Session;
12
14
  }) => Promise<void>;
15
+ export interface AdminApiContext<Resources extends ShopifyRestResources = ShopifyRestResources> {
16
+ /**
17
+ * Methods for interacting with the Shopify Admin REST API
18
+ *
19
+ * There are methods for interacting with individual REST resources. You can also make `GET`, `POST`, `PUT` and `DELETE` requests should the REST resources not meet your needs.
20
+ *
21
+ * {@link https://shopify.dev/docs/api/admin-rest}
22
+ *
23
+ * @example
24
+ * <caption>Using REST resources.</caption>
25
+ * <description>Getting the number of orders in a store using REST resources.</description>
26
+ *
27
+ * ```ts
28
+ * // /app/shopify.server.ts
29
+ * import { shopifyApp } from "@shopify/shopify-app-remix/server";
30
+ * import { restResources } from "@shopify/shopify-api/rest/admin/2023-07";
31
+ *
32
+ * const shopify = shopifyApp({
33
+ * restResources,
34
+ * // ...etc
35
+ * });
36
+ * export default shopify;
37
+ * export const authenticate = shopify.authenticate;
38
+ * ```
39
+ *
40
+ * ```ts
41
+ * // /app/routes/**\/*.ts
42
+ * import { LoaderArgs, json } from "@remix-run/node";
43
+ * import { authenticate } from "../shopify.server";
44
+ *
45
+ * export const loader = async ({ request }: LoaderArgs) => {
46
+ * const { admin, session } = await authenticate.admin(request);
47
+ * return json(admin.rest.resources.Order.count({ session }));
48
+ * };
49
+ * ```
50
+ *
51
+ * @example
52
+ * <caption>Performing a GET request to the REST API.</caption>
53
+ * <description>Use `admin.rest.<method>` to make custom requests to the API.</description>
54
+ *
55
+ * ```ts
56
+ * // /app/shopify.server.ts
57
+ * import { shopifyApp } from "@shopify/shopify-app-remix/server";
58
+ * import { restResources } from "@shopify/shopify-api/rest/admin/2023-04";
59
+ *
60
+ * const shopify = shopifyApp({
61
+ * restResources,
62
+ * // ...etc
63
+ * });
64
+ * export default shopify;
65
+ * export const authenticate = shopify.authenticate;
66
+ * ```
67
+ *
68
+ * ```ts
69
+ * // /app/routes/**\/*.ts
70
+ * import { LoaderArgs, json } from "@remix-run/node";
71
+ * import { authenticate } from "../shopify.server";
72
+ *
73
+ * export const loader = async ({ request }: LoaderArgs) => {
74
+ * const { admin, session } = await authenticate.admin(request);
75
+ * const response = await admin.rest.get({ path: "/customers/count.json" });
76
+ * const customers = await response.json();
77
+ * return json({ customers });
78
+ * };
79
+ * ```
80
+ */
81
+ rest: RestClientWithResources<Resources>;
82
+ /**
83
+ * Methods for interacting with the Shopify Admin GraphQL API
84
+ *
85
+ * {@link https://shopify.dev/docs/api/admin-graphql}
86
+ * {@link https://github.com/Shopify/shopify-api-js/blob/main/docs/reference/clients/Graphql.md}
87
+ *
88
+ * @example
89
+ * <caption>Querying the GraphQL API.</caption>
90
+ * <description>Use `admin.graphql` to make query / mutation requests.</description>
91
+ * ```ts
92
+ * import { ActionArgs } from "@remix-run/node";
93
+ * import { authenticate } from "../shopify.server";
94
+ *
95
+ * export async function action({ request }: ActionArgs) {
96
+ * const { admin } = await authenticate.admin(request);
97
+ *
98
+ * const response = await admin.graphql(
99
+ * `#graphql
100
+ * mutation populateProduct($input: ProductInput!) {
101
+ * productCreate(input: $input) {
102
+ * product {
103
+ * id
104
+ * }
105
+ * }
106
+ * }`,
107
+ * { variables: { input: { title: "Product Name" } } }
108
+ * );
109
+ *
110
+ * const productData = await response.json();
111
+ * return json({ data: productData.data });
112
+ * }
113
+ * ```
114
+ */
115
+ graphql: GraphQLClient;
116
+ }
13
117
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/admin/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAE7C,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAExC,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;CAC5C;AAED,MAAM,MAAM,sBAAsB,GAAG,CAAC,GAAG,EAAE;IACzC,KAAK,EAAE,GAAG,CAAC;IACX,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/admin/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAEnE,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAEvC,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAEpD,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;CAC5C;AAED,MAAM,MAAM,sBAAsB,GAAG,CAAC,GAAG,EAAE;IACzC,KAAK,EAAE,GAAG,CAAC;IACX,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgEG;IACH,IAAI,EAAE,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,OAAO,EAAE,aAAa,CAAC;CACxB"}
@@ -0,0 +1,3 @@
1
+ export * from './admin';
2
+ export * from './storefront';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/clients/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./admin"), exports);
5
+ tslib_1.__exportStar(require("./storefront"), exports);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/server/clients/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,uDAA6B"}
@@ -0,0 +1,4 @@
1
+ import { ReferenceEntityTemplateSchema } from '@shopify/generate-docs';
2
+ declare const data: ReferenceEntityTemplateSchema;
3
+ export default data;
4
+ //# sourceMappingURL=authenticate.storefront.api.doc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticate.storefront.api.doc.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/storefront/authenticate.storefront.api.doc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,wBAAwB,CAAC;AAErE,QAAA,MAAM,IAAI,EAAE,6BA6BX,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var data = {
4
+ name: 'Storefront API',
5
+ description: 'Contains objects used to interact with the Storefront API.' +
6
+ '\n\nThis object is returned as part of different contexts, such as [`appProxy`](/docs/api/shopify-app-remix/authenticate/public/app-proxy), and [`unauthenticated.storefront`](/docs/api/shopify-app-remix/unauthenticated/unauthenticated-storefront).',
7
+ category: 'APIs',
8
+ type: 'object',
9
+ isVisualComponent: false,
10
+ definitions: [
11
+ {
12
+ title: 'storefront',
13
+ description: 'Provides utilities that apps can use to make requests to the Storefront API.',
14
+ type: 'StorefrontContext',
15
+ },
16
+ ],
17
+ jsDocTypeExamples: ['StorefrontContext'],
18
+ related: [
19
+ {
20
+ name: 'App proxy context',
21
+ subtitle: 'Authenticate requests from Shopify app proxies.',
22
+ url: '/docs/api/shopify-app-remix/authenticate/public/app-proxy',
23
+ },
24
+ {
25
+ name: 'Unauthenticated context',
26
+ subtitle: 'Interact with the Storefront API on non-Shopify requests.',
27
+ url: '/docs/api/shopify-app-remix/unauthenticated/unauthenticated-storefront',
28
+ },
29
+ ],
30
+ };
31
+ exports.default = data;
32
+ //# sourceMappingURL=authenticate.storefront.api.doc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticate.storefront.api.doc.js","sourceRoot":"","sources":["../../../../../src/server/clients/storefront/authenticate.storefront.api.doc.ts"],"names":[],"mappings":";;AAEA,IAAM,IAAI,GAAkC;IAC1C,IAAI,EAAE,gBAAgB;IACtB,WAAW,EACT,4DAA4D;QAC5D,yPAAyP;IAC3P,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,QAAQ;IACd,iBAAiB,EAAE,KAAK;IACxB,WAAW,EAAE;QACX;YACE,KAAK,EAAE,YAAY;YACnB,WAAW,EACT,8EAA8E;YAChF,IAAI,EAAE,mBAAmB;SAC1B;KACF;IACD,iBAAiB,EAAE,CAAC,mBAAmB,CAAC;IACxC,OAAO,EAAE;QACP;YACE,IAAI,EAAE,mBAAmB;YACzB,QAAQ,EAAE,iDAAiD;YAC3D,GAAG,EAAE,2DAA2D;SACjE;QACD;YACE,IAAI,EAAE,yBAAyB;YAC/B,QAAQ,EAAE,2DAA2D;YACrE,GAAG,EAAE,wEAAwE;SAC9E;KACF;CACF,CAAC;AAEF,kBAAe,IAAI,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { Session } from '@shopify/shopify-api';
2
+ import { BasicParams } from '../../types';
3
+ import type { StorefrontContext } from '.';
4
+ export declare function storefrontClientFactory({ params, session, }: {
5
+ params: BasicParams;
6
+ session: Session;
7
+ }): StorefrontContext;
8
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/storefront/factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAE7C,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAExC,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,GAAG,CAAC;AAEzC,wBAAgB,uBAAuB,CAAC,EACtC,MAAM,EACN,OAAO,GACR,EAAE;IACD,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB,GAAG,iBAAiB,CAqBpB"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.storefrontClientFactory = void 0;
4
+ var tslib_1 = require("tslib");
5
+ var runtime_1 = require("@shopify/shopify-api/runtime");
6
+ function storefrontClientFactory(_a) {
7
+ var _this = this;
8
+ var params = _a.params, session = _a.session;
9
+ var api = params.api;
10
+ return {
11
+ graphql: function (query, options) {
12
+ if (options === void 0) { options = {}; }
13
+ return tslib_1.__awaiter(_this, void 0, void 0, function () {
14
+ var client, apiResponse;
15
+ return tslib_1.__generator(this, function (_a) {
16
+ switch (_a.label) {
17
+ case 0:
18
+ client = new api.clients.Storefront({
19
+ session: session,
20
+ apiVersion: options.apiVersion,
21
+ });
22
+ return [4 /*yield*/, client.query({
23
+ data: { query: query, variables: options === null || options === void 0 ? void 0 : options.variables },
24
+ tries: options.tries,
25
+ extraHeaders: options.headers,
26
+ })];
27
+ case 1:
28
+ apiResponse = _a.sent();
29
+ return [2 /*return*/, new Response(JSON.stringify(apiResponse.body), {
30
+ headers: (0, runtime_1.flatHeaders)(apiResponse.headers),
31
+ })];
32
+ }
33
+ });
34
+ });
35
+ },
36
+ };
37
+ }
38
+ exports.storefrontClientFactory = storefrontClientFactory;
39
+ //# sourceMappingURL=factory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../../../src/server/clients/storefront/factory.ts"],"names":[],"mappings":";;;;AAAA,wDAAyD;AAOzD,SAAgB,uBAAuB,CAAC,EAMvC;IAND,iBA2BC;QA1BC,MAAM,YAAA,EACN,OAAO,aAAA;IAKA,IAAA,GAAG,GAAI,MAAM,IAAV,CAAW;IAErB,OAAO;QACL,OAAO,EAAE,UAAO,KAAK,EAAE,OAAY;YAAZ,wBAAA,EAAA,YAAY;;;;;;4BAC3B,MAAM,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC;gCACxC,OAAO,SAAA;gCACP,UAAU,EAAE,OAAO,CAAC,UAAU;6BAC/B,CAAC,CAAC;4BAEiB,qBAAM,MAAM,CAAC,KAAK,CAAC;oCACrC,IAAI,EAAE,EAAC,KAAK,OAAA,EAAE,SAAS,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS,EAAC;oCAC5C,KAAK,EAAE,OAAO,CAAC,KAAK;oCACpB,YAAY,EAAE,OAAO,CAAC,OAAO;iCAC9B,CAAC,EAAA;;4BAJI,WAAW,GAAG,SAIlB;4BAEF,sBAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;oCACpD,OAAO,EAAE,IAAA,qBAAW,EAAC,WAAW,CAAC,OAAO,CAAC;iCAC1C,CAAC,EAAC;;;;SACJ;KACF,CAAC;AACJ,CAAC;AA3BD,0DA2BC"}
@@ -0,0 +1,3 @@
1
+ export * from './factory';
2
+ export * from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/server/clients/storefront/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}