@shopify/shopify-app-remix 1.2.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -284
- package/build/cjs/react/components/AppProvider/AppProvider.js +35 -4
- package/build/cjs/server/authenticate/admin/billing/request.js +4 -2
- package/build/cjs/server/authenticate/public/appProxy/authenticate.js +7 -1
- package/build/cjs/server/authenticate/public/factory.js +1 -1
- package/build/cjs/server/authenticate/webhooks/authenticate.js +38 -20
- package/build/cjs/server/boundary/index.js +6 -6
- package/build/cjs/server/clients/storefront/factory.js +35 -0
- package/build/cjs/server/shopify-app.js +11 -9
- package/build/cjs/server/types.js +1 -1
- package/build/cjs/server/unauthenticated/admin/factory.js +2 -2
- package/build/cjs/server/unauthenticated/helpers/get-offline-session.js +14 -0
- package/build/cjs/server/unauthenticated/storefront/factory.js +25 -0
- package/build/cjs/server/version.js +1 -1
- package/build/ts/react/components/AppProvider/AppProvider.d.ts +48 -8
- package/build/ts/react/components/AppProvider/AppProvider.d.ts.map +1 -1
- package/build/ts/react/components/AppProvider/AppProvider.doc.d.ts +4 -0
- package/build/ts/react/components/AppProvider/AppProvider.doc.d.ts.map +1 -0
- package/build/ts/react/components/AppProvider/AppProvider.doc.js +34 -0
- package/build/ts/react/components/AppProvider/AppProvider.doc.js.map +1 -0
- package/build/ts/react/components/AppProvider/AppProvider.js +35 -3
- package/build/ts/react/components/AppProvider/AppProvider.js.map +1 -1
- package/build/ts/server/__test-helpers/expect-admin-api-client.d.ts +1 -1
- package/build/ts/server/__test-helpers/expect-admin-api-client.d.ts.map +1 -1
- package/build/ts/server/__test-helpers/expect-storefront-api-client.d.ts +8 -0
- package/build/ts/server/__test-helpers/expect-storefront-api-client.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/expect-storefront-api-client.js +57 -0
- package/build/ts/server/__test-helpers/expect-storefront-api-client.js.map +1 -0
- package/build/ts/server/__test-helpers/index.d.ts +1 -0
- package/build/ts/server/__test-helpers/index.d.ts.map +1 -1
- package/build/ts/server/__test-helpers/index.js +1 -0
- package/build/ts/server/__test-helpers/index.js.map +1 -1
- package/build/ts/server/__test-helpers/test-config.d.ts +9 -4
- package/build/ts/server/__test-helpers/test-config.d.ts.map +1 -1
- package/build/ts/server/__test-helpers/test-config.js +2 -2
- package/build/ts/server/__test-helpers/test-config.js.map +1 -1
- package/build/ts/server/authenticate/admin/authenticate.admin.doc.d.ts +4 -0
- package/build/ts/server/authenticate/admin/authenticate.admin.doc.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/authenticate.admin.doc.js +35 -0
- package/build/ts/server/authenticate/admin/authenticate.admin.doc.js.map +1 -0
- package/build/ts/server/authenticate/admin/authenticate.d.ts.map +1 -1
- package/build/ts/server/authenticate/admin/authenticate.js.map +1 -1
- package/build/ts/server/authenticate/admin/billing/authenticate.admin.billing.doc.d.ts +4 -0
- package/build/ts/server/authenticate/admin/billing/authenticate.admin.billing.doc.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/billing/authenticate.admin.billing.doc.js +26 -0
- package/build/ts/server/authenticate/admin/billing/authenticate.admin.billing.doc.js.map +1 -0
- package/build/ts/server/authenticate/admin/billing/request.d.ts +1 -1
- package/build/ts/server/authenticate/admin/billing/request.d.ts.map +1 -1
- package/build/ts/server/authenticate/admin/billing/request.js +2 -8
- package/build/ts/server/authenticate/admin/billing/request.js.map +1 -1
- package/build/ts/server/authenticate/admin/billing/types.d.ts +71 -63
- package/build/ts/server/authenticate/admin/billing/types.d.ts.map +1 -1
- package/build/ts/server/authenticate/admin/types.d.ts +76 -40
- package/build/ts/server/authenticate/admin/types.d.ts.map +1 -1
- package/build/ts/server/authenticate/helpers/add-response-headers.d.ts +2 -1
- package/build/ts/server/authenticate/helpers/add-response-headers.d.ts.map +1 -1
- package/build/ts/server/authenticate/helpers/add-response-headers.js.map +1 -1
- package/build/ts/server/authenticate/public/appProxy/authenticate.d.ts.map +1 -1
- package/build/ts/server/authenticate/public/appProxy/authenticate.js +4 -2
- package/build/ts/server/authenticate/public/appProxy/authenticate.js.map +1 -1
- package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.d.ts +4 -0
- package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.d.ts.map +1 -0
- package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.js +32 -0
- package/build/ts/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.js.map +1 -0
- package/build/ts/server/authenticate/public/appProxy/types.d.ts +64 -8
- 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 +4 -0
- package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.d.ts.map +1 -0
- package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.js +21 -0
- package/build/ts/server/authenticate/public/checkout/authenticate.public.checkout.doc.js.map +1 -0
- package/build/ts/server/authenticate/public/checkout/types.d.ts +19 -17
- package/build/ts/server/authenticate/public/checkout/types.d.ts.map +1 -1
- package/build/ts/server/authenticate/public/factory.js +1 -1
- package/build/ts/server/authenticate/public/types.d.ts +23 -21
- package/build/ts/server/authenticate/public/types.d.ts.map +1 -1
- package/build/ts/server/authenticate/webhooks/authenticate.d.ts +3 -2
- package/build/ts/server/authenticate/webhooks/authenticate.d.ts.map +1 -1
- package/build/ts/server/authenticate/webhooks/authenticate.js +31 -19
- package/build/ts/server/authenticate/webhooks/authenticate.js.map +1 -1
- package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.d.ts +4 -0
- package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.d.ts.map +1 -0
- package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.js +27 -0
- package/build/ts/server/authenticate/webhooks/authenticate.webhooks.doc.js.map +1 -0
- package/build/ts/server/authenticate/webhooks/types.d.ts +170 -6
- package/build/ts/server/authenticate/webhooks/types.d.ts.map +1 -1
- package/build/ts/server/boundary/index.d.ts +6 -6
- package/build/ts/server/boundary/index.js +6 -6
- package/build/ts/server/clients/admin/authenticate.admin.api.doc.d.ts +4 -0
- package/build/ts/server/clients/admin/authenticate.admin.api.doc.d.ts.map +1 -0
- package/build/ts/server/clients/admin/authenticate.admin.api.doc.js +32 -0
- package/build/ts/server/clients/admin/authenticate.admin.api.doc.js.map +1 -0
- package/build/ts/server/clients/admin/factory.d.ts +1 -1
- package/build/ts/server/clients/admin/factory.d.ts.map +1 -1
- package/build/ts/server/clients/admin/factory.js.map +1 -1
- package/build/ts/server/clients/admin/graphql.d.ts +3 -15
- package/build/ts/server/clients/admin/graphql.d.ts.map +1 -1
- package/build/ts/server/clients/admin/graphql.js.map +1 -1
- package/build/ts/server/clients/admin/index.d.ts +1 -0
- package/build/ts/server/clients/admin/index.d.ts.map +1 -1
- package/build/ts/server/clients/admin/index.js +1 -0
- package/build/ts/server/clients/admin/index.js.map +1 -1
- package/build/ts/server/clients/admin/rest.d.ts +1 -1
- package/build/ts/server/clients/admin/rest.d.ts.map +1 -1
- package/build/ts/server/clients/admin/types.d.ts +105 -1
- package/build/ts/server/clients/admin/types.d.ts.map +1 -1
- package/build/ts/server/clients/index.d.ts +3 -0
- package/build/ts/server/clients/index.d.ts.map +1 -0
- package/build/ts/server/clients/index.js +6 -0
- package/build/ts/server/clients/index.js.map +1 -0
- package/build/ts/server/clients/storefront/authenticate.storefront.api.doc.d.ts +4 -0
- package/build/ts/server/clients/storefront/authenticate.storefront.api.doc.d.ts.map +1 -0
- package/build/ts/server/clients/storefront/authenticate.storefront.api.doc.js +32 -0
- package/build/ts/server/clients/storefront/authenticate.storefront.api.doc.js.map +1 -0
- package/build/ts/server/clients/storefront/factory.d.ts +8 -0
- package/build/ts/server/clients/storefront/factory.d.ts.map +1 -0
- package/build/ts/server/clients/storefront/factory.js +39 -0
- package/build/ts/server/clients/storefront/factory.js.map +1 -0
- package/build/ts/server/clients/storefront/index.d.ts +3 -0
- package/build/ts/server/clients/storefront/index.d.ts.map +1 -0
- package/build/ts/server/clients/storefront/index.js +6 -0
- package/build/ts/server/clients/storefront/index.js.map +1 -0
- package/build/ts/server/clients/storefront/types.d.ts +29 -0
- package/build/ts/server/clients/storefront/types.d.ts.map +1 -0
- package/build/ts/server/clients/storefront/types.js +3 -0
- package/build/ts/server/clients/storefront/types.js.map +1 -0
- package/build/ts/server/clients/types.d.ts +15 -0
- package/build/ts/server/clients/types.d.ts.map +1 -0
- package/build/ts/server/clients/types.js +3 -0
- package/build/ts/server/clients/types.js.map +1 -0
- package/build/ts/server/config-types.d.ts +39 -121
- package/build/ts/server/config-types.d.ts.map +1 -1
- package/build/ts/server/future/flags.d.ts +11 -0
- package/build/ts/server/future/flags.d.ts.map +1 -0
- package/build/ts/server/future/flags.js +3 -0
- package/build/ts/server/future/flags.js.map +1 -0
- package/build/ts/server/shopify-app.d.ts +3 -3
- package/build/ts/server/shopify-app.d.ts.map +1 -1
- package/build/ts/server/shopify-app.doc.d.ts +4 -0
- package/build/ts/server/shopify-app.doc.d.ts.map +1 -0
- package/build/ts/server/shopify-app.doc.js +42 -0
- package/build/ts/server/shopify-app.doc.js.map +1 -0
- package/build/ts/server/shopify-app.js +9 -8
- package/build/ts/server/shopify-app.js.map +1 -1
- package/build/ts/server/types.d.ts +202 -170
- package/build/ts/server/types.d.ts.map +1 -1
- package/build/ts/server/types.js.map +1 -1
- package/build/ts/server/unauthenticated/admin/factory.d.ts.map +1 -1
- package/build/ts/server/unauthenticated/admin/factory.js +3 -4
- package/build/ts/server/unauthenticated/admin/factory.js.map +1 -1
- package/build/ts/server/unauthenticated/admin/types.d.ts +11 -9
- package/build/ts/server/unauthenticated/admin/types.d.ts.map +1 -1
- package/build/ts/server/unauthenticated/admin/unauthenticated.admin.doc.d.ts +4 -0
- package/build/ts/server/unauthenticated/admin/unauthenticated.admin.doc.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/admin/unauthenticated.admin.doc.js +29 -0
- package/build/ts/server/unauthenticated/admin/unauthenticated.admin.doc.js.map +1 -0
- package/build/ts/server/unauthenticated/helpers/get-offline-session.d.ts +4 -0
- package/build/ts/server/unauthenticated/helpers/get-offline-session.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/helpers/get-offline-session.js +22 -0
- package/build/ts/server/unauthenticated/helpers/get-offline-session.js.map +1 -0
- package/build/ts/server/unauthenticated/helpers/index.d.ts +2 -0
- package/build/ts/server/unauthenticated/helpers/index.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/helpers/index.js +5 -0
- package/build/ts/server/unauthenticated/helpers/index.js.map +1 -0
- package/build/ts/server/unauthenticated/storefront/factory.d.ts +4 -0
- package/build/ts/server/unauthenticated/storefront/factory.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/storefront/factory.js +29 -0
- package/build/ts/server/unauthenticated/storefront/factory.js.map +1 -0
- package/build/ts/server/unauthenticated/storefront/index.d.ts +2 -0
- package/build/ts/server/unauthenticated/storefront/index.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/storefront/index.js +5 -0
- package/build/ts/server/unauthenticated/storefront/index.js.map +1 -0
- package/build/ts/server/unauthenticated/storefront/types.d.ts +34 -0
- package/build/ts/server/unauthenticated/storefront/types.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/storefront/types.js +3 -0
- package/build/ts/server/unauthenticated/storefront/types.js.map +1 -0
- package/build/ts/server/unauthenticated/storefront/unauthenticated.storefront.doc.d.ts +4 -0
- package/build/ts/server/unauthenticated/storefront/unauthenticated.storefront.doc.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/storefront/unauthenticated.storefront.doc.js +29 -0
- package/build/ts/server/unauthenticated/storefront/unauthenticated.storefront.doc.js.map +1 -0
- package/build/ts/server/unauthenticated/types.d.ts +66 -0
- package/build/ts/server/unauthenticated/types.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/types.js +3 -0
- package/build/ts/server/unauthenticated/types.js.map +1 -0
- package/build/ts/server/version.d.ts +1 -1
- package/build/ts/server/version.js +1 -1
- package/package.json +11 -6
- package/build/tsconfig.tsbuildinfo +0 -1
|
@@ -1,25 +1,189 @@
|
|
|
1
1
|
import { Session, Shopify, ShopifyRestResources } from '@shopify/shopify-api';
|
|
2
2
|
import type { JSONValue } from '../../types';
|
|
3
|
+
import type { AdminApiContext } from '../../clients';
|
|
4
|
+
import type { FeatureEnabled, FutureFlagOptions } from '../../future/flags';
|
|
3
5
|
export interface RegisterWebhooksOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The Shopify session used to register webhooks using the Admin API.
|
|
8
|
+
*/
|
|
4
9
|
session: Session;
|
|
5
10
|
}
|
|
6
11
|
interface Context<Topics = string | number | symbol> {
|
|
12
|
+
/**
|
|
13
|
+
* The API version used for the webhook.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <caption>Webhook API version.</caption>
|
|
17
|
+
* <description>Get the API version used for webhook request.</description>
|
|
18
|
+
* ```
|
|
19
|
+
* import { ActionFunction } from "@remix-run/node";
|
|
20
|
+
* import { authenticate } from "../shopify.server";
|
|
21
|
+
*
|
|
22
|
+
* export const action: ActionFunction = async ({ request }) => {
|
|
23
|
+
* const { apiVersion } = await authenticate.webhook(request);
|
|
24
|
+
* return new Response();
|
|
25
|
+
* };
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
7
28
|
apiVersion: string;
|
|
29
|
+
/**
|
|
30
|
+
* The shop where the webhook was triggered.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* <caption>Webhook shop.</caption>
|
|
34
|
+
* <description>Get the shop that triggered a webhook.</description>
|
|
35
|
+
* ```
|
|
36
|
+
* import { ActionFunction } from "@remix-run/node";
|
|
37
|
+
* import { authenticate } from "../shopify.server";
|
|
38
|
+
*
|
|
39
|
+
* export const action: ActionFunction = async ({ request }) => {
|
|
40
|
+
* const { shop } = await authenticate.webhook(request);
|
|
41
|
+
* return new Response();
|
|
42
|
+
* };
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
8
45
|
shop: string;
|
|
46
|
+
/**
|
|
47
|
+
* The topic of the webhook.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* <caption>Webhook topic.</caption>
|
|
51
|
+
* <description>Get the event topic for the webhook.</description>
|
|
52
|
+
* ```
|
|
53
|
+
* import { ActionFunction } from "@remix-run/node";
|
|
54
|
+
* import { authenticate } from "../shopify.server";
|
|
55
|
+
*
|
|
56
|
+
* export const action: ActionFunction = async ({ request }) => {
|
|
57
|
+
* const { topic } = await authenticate.webhook(request);
|
|
58
|
+
*
|
|
59
|
+
* switch (topic) {
|
|
60
|
+
* case "APP_UNINSTALLED":
|
|
61
|
+
* // Do something when the app is uninstalled.
|
|
62
|
+
* break;
|
|
63
|
+
* }
|
|
64
|
+
*
|
|
65
|
+
* return new Response();
|
|
66
|
+
* };
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
9
69
|
topic: Topics;
|
|
70
|
+
/**
|
|
71
|
+
* A unique ID for the webhook. Useful to keep track of which events your app has already processed.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* <caption>Webhook ID.</caption>
|
|
75
|
+
* <description>Get the webhook ID.</description>
|
|
76
|
+
* ```
|
|
77
|
+
* import { ActionFunction } from "@remix-run/node";
|
|
78
|
+
* import { authenticate } from "../shopify.server";
|
|
79
|
+
*
|
|
80
|
+
* export const action: ActionFunction = async ({ request }) => {
|
|
81
|
+
* const { webhookId } = await authenticate.webhook(request);
|
|
82
|
+
* return new Response();
|
|
83
|
+
* };
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
10
86
|
webhookId: string;
|
|
87
|
+
/**
|
|
88
|
+
* The payload from the webhook request.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* <caption>Webhook payload.</caption>
|
|
92
|
+
* <description>Get the request's POST payload.</description>
|
|
93
|
+
* ```
|
|
94
|
+
* import { ActionFunction } from "@remix-run/node";
|
|
95
|
+
* import { authenticate } from "../shopify.server";
|
|
96
|
+
*
|
|
97
|
+
* export const action: ActionFunction = async ({ request }) => {
|
|
98
|
+
* const { payload } = await authenticate.webhook(request);
|
|
99
|
+
* return new Response();
|
|
100
|
+
* };
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
11
103
|
payload: JSONValue;
|
|
12
104
|
}
|
|
13
|
-
export interface
|
|
105
|
+
export interface WebhookContextWithoutSession<Topics = string | number | symbol> extends Context<Topics> {
|
|
14
106
|
session: undefined;
|
|
15
107
|
admin: undefined;
|
|
16
108
|
}
|
|
17
|
-
export interface
|
|
109
|
+
export interface LegacyWebhookAdminApiContext<Resources extends ShopifyRestResources> {
|
|
110
|
+
/** A REST client. */
|
|
111
|
+
rest: InstanceType<Shopify['clients']['Rest']> & Resources;
|
|
112
|
+
/** A GraphQL client. */
|
|
113
|
+
graphql: InstanceType<Shopify['clients']['Graphql']>;
|
|
114
|
+
}
|
|
115
|
+
export type WebhookAdminContext<Future extends FutureFlagOptions, Resources extends ShopifyRestResources> = FeatureEnabled<Future, 'v3_webhookAdminContext'> extends true ? AdminApiContext<Resources> : LegacyWebhookAdminApiContext<Resources>;
|
|
116
|
+
export interface WebhookContextWithSession<Future extends FutureFlagOptions, Resources extends ShopifyRestResources, Topics = string | number | symbol> extends Context<Topics> {
|
|
117
|
+
/**
|
|
118
|
+
* A session with an offline token for the shop.
|
|
119
|
+
*
|
|
120
|
+
* Returned only if there is a session for the shop.
|
|
121
|
+
*/
|
|
18
122
|
session: Session;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
123
|
+
/**
|
|
124
|
+
* An admin context for the webhook.
|
|
125
|
+
*
|
|
126
|
+
* Returned only if there is a session for the shop.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* <caption>[V3] Webhook admin context.</caption>
|
|
130
|
+
* <description>With the `v3_webhookAdminContext` future flag enabled, use the `admin` object in the context to interact with the Admin API.</description>
|
|
131
|
+
* ```ts
|
|
132
|
+
* import { ActionFunctionArgs } from "@remix-run/node";
|
|
133
|
+
* import { authenticate } from "../shopify.server";
|
|
134
|
+
*
|
|
135
|
+
* export async function action({ request }: ActionFunctionArgs) {
|
|
136
|
+
* const { admin } = await authenticate.webhook(request);
|
|
137
|
+
*
|
|
138
|
+
* const response = await admin?.graphql(
|
|
139
|
+
* `#graphql
|
|
140
|
+
* mutation populateProduct($input: ProductInput!) {
|
|
141
|
+
* productCreate(input: $input) {
|
|
142
|
+
* product {
|
|
143
|
+
* id
|
|
144
|
+
* }
|
|
145
|
+
* }
|
|
146
|
+
* }`,
|
|
147
|
+
* { variables: { input: { title: "Product Name" } } }
|
|
148
|
+
* );
|
|
149
|
+
*
|
|
150
|
+
* const productData = await response.json();
|
|
151
|
+
* return json({ data: productData.data });
|
|
152
|
+
* }
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* <caption>Webhook admin context.</caption>
|
|
157
|
+
* <description>Use the `admin` object in the context to interact with the Admin API. This format will be removed in V3 of the package.</description>
|
|
158
|
+
* ```ts
|
|
159
|
+
* import { json, ActionFunctionArgs } from "@remix-run/node";
|
|
160
|
+
* import { authenticate } from "../shopify.server";
|
|
161
|
+
*
|
|
162
|
+
* export async function action({ request }: ActionFunctionArgs) {
|
|
163
|
+
* const { admin } = await authenticate.webhook(request);
|
|
164
|
+
*
|
|
165
|
+
* const response = await admin?.graphql.query<any>({
|
|
166
|
+
* data: {
|
|
167
|
+
* query: `#graphql
|
|
168
|
+
* mutation populateProduct($input: ProductInput!) {
|
|
169
|
+
* productCreate(input: $input) {
|
|
170
|
+
* product {
|
|
171
|
+
* id
|
|
172
|
+
* }
|
|
173
|
+
* }
|
|
174
|
+
* }`,
|
|
175
|
+
* variables: { input: { title: "Product Name" } },
|
|
176
|
+
* },
|
|
177
|
+
* });
|
|
178
|
+
*
|
|
179
|
+
* const productData = response?.body.data;
|
|
180
|
+
* return json({ data: productData.data });
|
|
181
|
+
* }
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
admin: WebhookAdminContext<Future, Resources>;
|
|
23
185
|
}
|
|
186
|
+
export type WebhookContext<Future extends FutureFlagOptions, Resources extends ShopifyRestResources, Topics = string | number | symbol> = WebhookContextWithoutSession<Topics> | WebhookContextWithSession<Future, Resources, Topics>;
|
|
187
|
+
export type AuthenticateWebhook<Future extends FutureFlagOptions, Resources extends ShopifyRestResources, Topics = string | number | symbol> = (request: Request) => Promise<WebhookContext<Future, Resources, Topics>>;
|
|
24
188
|
export {};
|
|
25
189
|
//# 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;
|
|
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;AAC3C,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;;;;;;;;;;;;;;;OAeG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;;;;;;OAeG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;;;;;;;;;OAeG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,EAAE,SAAS,CAAC;CACpB;AAED,MAAM,WAAW,4BAA4B,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAC7E,SAAQ,OAAO,CAAC,MAAM,CAAC;IACvB,OAAO,EAAE,SAAS,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,4BAA4B,CAC3C,SAAS,SAAS,oBAAoB;IAEtC,qBAAqB;IACrB,IAAI,EAAE,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;IAC3D,wBAAwB;IACxB,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;CACtD;AAED,MAAM,MAAM,mBAAmB,CAC7B,MAAM,SAAS,iBAAiB,EAChC,SAAS,SAAS,oBAAoB,IACpC,cAAc,CAAC,MAAM,EAAE,wBAAwB,CAAC,SAAS,IAAI,GAC7D,eAAe,CAAC,SAAS,CAAC,GAC1B,4BAA4B,CAAC,SAAS,CAAC,CAAC;AAE5C,MAAM,WAAW,yBAAyB,CACxC,MAAM,SAAS,iBAAiB,EAChC,SAAS,SAAS,oBAAoB,EACtC,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CACjC,SAAQ,OAAO,CAAC,MAAM,CAAC;IACvB;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4DG;IACH,KAAK,EAAE,mBAAmB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CAC/C;AAED,MAAM,MAAM,cAAc,CACxB,MAAM,SAAS,iBAAiB,EAChC,SAAS,SAAS,oBAAoB,EACtC,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,IAE/B,4BAA4B,CAAC,MAAM,CAAC,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"}
|
|
@@ -8,10 +8,10 @@ export declare const boundary: {
|
|
|
8
8
|
* A function that handles errors or thrown responses.
|
|
9
9
|
*
|
|
10
10
|
* @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 @@
|
|
|
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,
|
|
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":";;;
|
|
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 {
|
|
1
|
+
import { GraphQLClient, GraphQLQueryOptions } from '../types';
|
|
2
2
|
import { AdminClientOptions } from './types';
|
|
3
|
-
|
|
4
|
-
|
|
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":"
|
|
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":";;;;
|
|
1
|
+
{"version":3,"file":"graphql.js","sourceRoot":"","sources":["../../../../../src/server/clients/admin/graphql.ts"],"names":[],"mappings":";;;;AAAA,wDAAyD;AAWzD,+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,KAAK,EAAE,OAAO;;;;;;wBAClC,MAAM,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,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 +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"}
|
|
@@ -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;
|
|
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,KAAK,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAC;AAEhD,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,iBAAiB,CAA0C;gBAEvD,EAAC,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAC,EAAE,kBAAkB;IAMpE;;OAEG;IACU,GAAG,CAAC,MAAM,EAAE,gBAAgB;IAOzC;;OAEG;IACU,IAAI,CAAC,MAAM,EAAE,iBAAiB;IAO3C;;OAEG;IACU,GAAG,CAAC,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 { LoaderFunctionArgs, json } from "@remix-run/node";
|
|
43
|
+
* import { authenticate } from "../shopify.server";
|
|
44
|
+
*
|
|
45
|
+
* export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|
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 { LoaderFunctionArgs, json } from "@remix-run/node";
|
|
71
|
+
* import { authenticate } from "../shopify.server";
|
|
72
|
+
*
|
|
73
|
+
* export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|
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/packages/shopify-api/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 { ActionFunctionArgs } from "@remix-run/node";
|
|
93
|
+
* import { authenticate } from "../shopify.server";
|
|
94
|
+
*
|
|
95
|
+
* export async function action({ request }: ActionFunctionArgs) {
|
|
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;
|
|
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 @@
|
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/server/clients/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,uDAA6B"}
|
|
@@ -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"}
|