@shopify/shopify-app-remix 1.0.4 → 1.2.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 +19 -23
- package/build/cjs/react/components/AppProvider/AppProvider.js +67 -0
- package/build/cjs/react/components/RemixPolarisLink.js +22 -0
- package/build/cjs/react/const.js +7 -0
- package/build/cjs/react/index.js +9 -0
- package/build/cjs/{adapters → server/adapters}/node/index.js +1 -3
- package/build/cjs/{auth → server/authenticate}/admin/authenticate.js +39 -94
- package/build/cjs/{billing → server/authenticate/admin/billing}/cancel.js +1 -2
- package/build/cjs/{billing → server/authenticate/admin/billing}/request.js +2 -3
- package/build/cjs/{billing → server/authenticate/admin/billing}/require.js +1 -2
- package/build/cjs/server/authenticate/admin/helpers/handle-client-error.js +39 -0
- package/build/cjs/{auth → server/authenticate/admin}/helpers/redirect-to-auth-page.js +6 -1
- package/build/cjs/{auth → server/authenticate/admin}/helpers/redirect-with-app-bridge-headers.js +2 -6
- package/build/cjs/server/authenticate/admin/helpers/redirect.js +67 -0
- package/build/cjs/server/authenticate/admin/helpers/render-app-bridge.js +30 -0
- package/build/cjs/{auth → server/authenticate}/helpers/ensure-cors-headers.js +3 -2
- package/build/cjs/{auth → server/authenticate}/helpers/respond-to-options-request.js +2 -2
- package/build/cjs/{auth → server/authenticate}/helpers/validate-session-token.js +6 -2
- package/build/cjs/{auth → server/authenticate}/login/login.js +1 -1
- package/build/cjs/server/authenticate/public/appProxy/authenticate.js +82 -0
- package/build/cjs/server/authenticate/public/checkout/authenticate.js +38 -0
- package/build/cjs/server/authenticate/public/factory.js +22 -0
- package/build/cjs/{boundary → server/boundary}/error.js +7 -1
- package/build/cjs/server/boundary/index.js +44 -0
- package/build/cjs/server/clients/admin/factory.js +27 -0
- package/build/cjs/{auth/admin/graphql-client.js → server/clients/admin/graphql.js} +10 -18
- package/build/cjs/{auth/admin/rest-client.js → server/clients/admin/rest.js} +54 -33
- package/build/cjs/server/index.js +39 -0
- package/build/cjs/{index.js → server/shopify-app.js} +13 -76
- package/build/cjs/server/unauthenticated/admin/factory.js +25 -0
- package/build/cjs/{version.js → server/version.js} +1 -1
- package/build/ts/react/components/AppProvider/AppProvider.d.ts +50 -0
- package/build/ts/react/components/AppProvider/AppProvider.d.ts.map +1 -0
- package/build/ts/react/components/AppProvider/AppProvider.js +44 -0
- package/build/ts/react/components/AppProvider/AppProvider.js.map +1 -0
- package/build/ts/react/components/AppProvider/index.d.ts +2 -0
- package/build/ts/react/components/AppProvider/index.d.ts.map +1 -0
- package/build/ts/react/components/AppProvider/index.js +5 -0
- package/build/ts/react/components/AppProvider/index.js.map +1 -0
- package/build/ts/react/components/RemixPolarisLink.d.ts +3 -0
- package/build/ts/react/components/RemixPolarisLink.d.ts.map +1 -0
- package/build/ts/react/components/RemixPolarisLink.js +12 -0
- package/build/ts/react/components/RemixPolarisLink.js.map +1 -0
- package/build/ts/react/components/index.d.ts +2 -0
- package/build/ts/react/components/index.d.ts.map +1 -0
- package/build/ts/react/components/index.js +5 -0
- package/build/ts/react/components/index.js.map +1 -0
- package/build/ts/react/const.d.ts +2 -0
- package/build/ts/react/const.d.ts.map +1 -0
- package/build/ts/react/const.js +5 -0
- package/build/ts/react/const.js.map +1 -0
- package/build/ts/react/index.d.ts +2 -0
- package/build/ts/react/index.d.ts.map +1 -0
- package/build/ts/react/index.js +5 -0
- package/build/ts/react/index.js.map +1 -0
- package/build/ts/server/__test-helpers/const.d.ts +9 -0
- package/build/ts/server/__test-helpers/const.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/const.js +13 -0
- package/build/ts/server/__test-helpers/const.js.map +1 -0
- package/build/ts/server/__test-helpers/expect-admin-api-client.d.ts +8 -0
- package/build/ts/server/__test-helpers/expect-admin-api-client.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/expect-admin-api-client.js +165 -0
- package/build/ts/server/__test-helpers/expect-admin-api-client.js.map +1 -0
- package/build/ts/server/__test-helpers/expect-begin-auth-redirect.d.ts +3 -0
- package/build/ts/server/__test-helpers/expect-begin-auth-redirect.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/expect-begin-auth-redirect.js +16 -0
- package/build/ts/server/__test-helpers/expect-begin-auth-redirect.js.map +1 -0
- package/build/ts/server/__test-helpers/expect-document-request-headers.d.ts +2 -0
- package/build/ts/server/__test-helpers/expect-document-request-headers.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/expect-document-request-headers.js +18 -0
- package/build/ts/server/__test-helpers/expect-document-request-headers.js.map +1 -0
- package/build/ts/server/__test-helpers/expect-exit-iframe.d.ts +8 -0
- package/build/ts/server/__test-helpers/expect-exit-iframe.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/expect-exit-iframe.js +17 -0
- package/build/ts/server/__test-helpers/expect-exit-iframe.js.map +1 -0
- package/build/ts/server/__test-helpers/expect-login-redirect.d.ts +2 -0
- package/build/ts/server/__test-helpers/expect-login-redirect.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/expect-login-redirect.js +11 -0
- package/build/ts/server/__test-helpers/expect-login-redirect.js.map +1 -0
- package/build/ts/server/__test-helpers/get-hmac.d.ts +2 -0
- package/build/ts/server/__test-helpers/get-hmac.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/get-hmac.js +14 -0
- package/build/ts/server/__test-helpers/get-hmac.js.map +1 -0
- package/build/ts/server/__test-helpers/get-jwt.d.ts +8 -0
- package/build/ts/server/__test-helpers/get-jwt.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/get-jwt.js +17 -0
- package/build/ts/server/__test-helpers/get-jwt.js.map +1 -0
- package/build/ts/server/__test-helpers/get-thrown-response.d.ts +2 -0
- package/build/ts/server/__test-helpers/get-thrown-response.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/get-thrown-response.js +28 -0
- package/build/ts/server/__test-helpers/get-thrown-response.js.map +1 -0
- package/build/ts/server/__test-helpers/index.d.ts +16 -0
- package/build/ts/server/__test-helpers/index.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/index.js +19 -0
- package/build/ts/server/__test-helpers/index.js.map +1 -0
- package/build/ts/server/__test-helpers/request-mock.d.ts +10 -0
- package/build/ts/server/__test-helpers/request-mock.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/request-mock.js +192 -0
- package/build/ts/server/__test-helpers/request-mock.js.map +1 -0
- package/build/ts/server/__test-helpers/setup-valid-session.d.ts +4 -0
- package/build/ts/server/__test-helpers/setup-valid-session.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/setup-valid-session.js +45 -0
- package/build/ts/server/__test-helpers/setup-valid-session.js.map +1 -0
- package/build/ts/server/__test-helpers/sign-request-cookie.d.ts +6 -0
- package/build/ts/server/__test-helpers/sign-request-cookie.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/sign-request-cookie.js +14 -0
- package/build/ts/server/__test-helpers/sign-request-cookie.js.map +1 -0
- package/build/ts/server/__test-helpers/test-config.d.ts +6 -0
- package/build/ts/server/__test-helpers/test-config.d.ts.map +1 -0
- package/build/ts/server/__test-helpers/test-config.js +16 -0
- package/build/ts/server/__test-helpers/test-config.js.map +1 -0
- package/build/ts/server/adapters/node/index.d.ts.map +1 -0
- package/build/ts/{adapters → server/adapters}/node/index.js +1 -1
- package/build/ts/server/adapters/node/index.js.map +1 -0
- package/build/ts/{auth → server/authenticate}/admin/authenticate.d.ts +0 -2
- package/build/ts/server/authenticate/admin/authenticate.d.ts.map +1 -0
- package/build/ts/{auth → server/authenticate}/admin/authenticate.js +31 -78
- package/build/ts/server/authenticate/admin/authenticate.js.map +1 -0
- package/build/ts/{billing → server/authenticate/admin/billing}/cancel.d.ts +1 -1
- package/build/ts/server/authenticate/admin/billing/cancel.d.ts.map +1 -0
- package/build/ts/{billing → server/authenticate/admin/billing}/cancel.js +1 -1
- package/build/ts/server/authenticate/admin/billing/cancel.js.map +1 -0
- package/build/ts/server/authenticate/admin/billing/index.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/billing/index.js.map +1 -0
- package/build/ts/{billing → server/authenticate/admin/billing}/request.d.ts +2 -2
- package/build/ts/server/authenticate/admin/billing/request.d.ts.map +1 -0
- package/build/ts/{billing → server/authenticate/admin/billing}/request.js +2 -3
- package/build/ts/server/authenticate/admin/billing/request.js.map +1 -0
- package/build/ts/{billing → server/authenticate/admin/billing}/require.d.ts +2 -2
- package/build/ts/server/authenticate/admin/billing/require.d.ts.map +1 -0
- package/build/ts/{billing → server/authenticate/admin/billing}/require.js +1 -1
- package/build/ts/server/authenticate/admin/billing/require.js.map +1 -0
- package/build/ts/{billing → server/authenticate/admin/billing}/types.d.ts +1 -1
- package/build/ts/server/authenticate/admin/billing/types.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/billing/types.js.map +1 -0
- package/build/ts/{auth → server/authenticate/admin}/helpers/begin-auth.d.ts +1 -1
- package/build/ts/server/authenticate/admin/helpers/begin-auth.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/begin-auth.js.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/handle-client-error.d.ts +7 -0
- package/build/ts/server/authenticate/admin/helpers/handle-client-error.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/handle-client-error.js +41 -0
- package/build/ts/server/authenticate/admin/helpers/handle-client-error.js.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/index.d.ts +8 -0
- package/build/ts/server/authenticate/admin/helpers/index.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/index.js +11 -0
- package/build/ts/server/authenticate/admin/helpers/index.js.map +1 -0
- package/build/ts/{auth → server/authenticate/admin}/helpers/redirect-to-auth-page.d.ts +1 -1
- package/build/ts/server/authenticate/admin/helpers/redirect-to-auth-page.d.ts.map +1 -0
- package/build/ts/{auth → server/authenticate/admin}/helpers/redirect-to-auth-page.js +5 -2
- package/build/ts/server/authenticate/admin/helpers/redirect-to-auth-page.js.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/redirect-with-app-bridge-headers.d.ts +3 -0
- package/build/ts/server/authenticate/admin/helpers/redirect-with-app-bridge-headers.d.ts.map +1 -0
- package/build/ts/{auth → server/authenticate/admin}/helpers/redirect-with-app-bridge-headers.js +2 -4
- package/build/ts/server/authenticate/admin/helpers/redirect-with-app-bridge-headers.js.map +1 -0
- package/build/ts/{auth → server/authenticate/admin}/helpers/redirect-with-exitiframe.d.ts +1 -1
- package/build/ts/server/authenticate/admin/helpers/redirect-with-exitiframe.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/redirect-with-exitiframe.js.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/redirect.d.ts +9 -0
- package/build/ts/server/authenticate/admin/helpers/redirect.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/redirect.js +64 -0
- package/build/ts/server/authenticate/admin/helpers/redirect.js.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/render-app-bridge.d.ts +8 -0
- package/build/ts/server/authenticate/admin/helpers/render-app-bridge.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/helpers/render-app-bridge.js +22 -0
- package/build/ts/server/authenticate/admin/helpers/render-app-bridge.js.map +1 -0
- package/build/ts/{auth → server/authenticate}/admin/types.d.ts +22 -2
- package/build/ts/server/authenticate/admin/types.d.ts.map +1 -0
- package/build/ts/server/authenticate/admin/types.js.map +1 -0
- package/build/ts/server/authenticate/const.d.ts.map +1 -0
- package/build/ts/server/authenticate/const.js.map +1 -0
- package/build/ts/server/authenticate/helpers/add-response-headers.d.ts.map +1 -0
- package/build/ts/server/authenticate/helpers/add-response-headers.js.map +1 -0
- package/build/ts/server/authenticate/helpers/app-bridge-url.d.ts.map +1 -0
- package/build/ts/server/authenticate/helpers/app-bridge-url.js.map +1 -0
- package/build/ts/{auth → server/authenticate}/helpers/ensure-cors-headers.d.ts +1 -1
- package/build/ts/server/authenticate/helpers/ensure-cors-headers.d.ts.map +1 -0
- package/build/ts/{auth → server/authenticate}/helpers/ensure-cors-headers.js +8 -2
- package/build/ts/server/authenticate/helpers/ensure-cors-headers.js.map +1 -0
- package/build/ts/server/authenticate/helpers/get-session-token-header.d.ts.map +1 -0
- package/build/ts/server/authenticate/helpers/get-session-token-header.js.map +1 -0
- package/build/ts/{auth → server/authenticate}/helpers/index.d.ts +0 -4
- package/build/ts/server/authenticate/helpers/index.d.ts.map +1 -0
- package/build/ts/{auth → server/authenticate}/helpers/index.js +0 -4
- package/build/ts/server/authenticate/helpers/index.js.map +1 -0
- package/build/ts/server/authenticate/helpers/reject-bot-request.d.ts.map +1 -0
- package/build/ts/server/authenticate/helpers/reject-bot-request.js.map +1 -0
- package/build/ts/server/authenticate/helpers/respond-to-options-request.d.ts +3 -0
- package/build/ts/server/authenticate/helpers/respond-to-options-request.d.ts.map +1 -0
- package/build/ts/{auth → server/authenticate}/helpers/respond-to-options-request.js +2 -2
- package/build/ts/server/authenticate/helpers/respond-to-options-request.js.map +1 -0
- package/build/ts/server/authenticate/helpers/validate-session-token.d.ts +8 -0
- package/build/ts/server/authenticate/helpers/validate-session-token.d.ts.map +1 -0
- package/build/ts/{auth → server/authenticate}/helpers/validate-session-token.js +11 -8
- package/build/ts/server/authenticate/helpers/validate-session-token.js.map +1 -0
- package/build/ts/server/authenticate/login/login.d.ts.map +1 -0
- package/build/ts/{auth → server/authenticate}/login/login.js +3 -1
- package/build/ts/server/authenticate/login/login.js.map +1 -0
- package/build/ts/server/authenticate/public/appProxy/authenticate.d.ts +5 -0
- package/build/ts/server/authenticate/public/appProxy/authenticate.d.ts.map +1 -0
- package/build/ts/server/authenticate/public/appProxy/authenticate.js +79 -0
- package/build/ts/server/authenticate/public/appProxy/authenticate.js.map +1 -0
- package/build/ts/server/authenticate/public/appProxy/types.d.ts +70 -0
- package/build/ts/server/authenticate/public/appProxy/types.d.ts.map +1 -0
- package/build/ts/server/authenticate/public/appProxy/types.js.map +1 -0
- package/build/ts/server/authenticate/public/checkout/authenticate.d.ts +4 -0
- package/build/ts/server/authenticate/public/checkout/authenticate.d.ts.map +1 -0
- package/build/ts/server/authenticate/public/checkout/authenticate.js +42 -0
- package/build/ts/server/authenticate/public/checkout/authenticate.js.map +1 -0
- package/build/ts/{auth/public → server/authenticate/public/checkout}/types.d.ts +13 -7
- package/build/ts/server/authenticate/public/checkout/types.d.ts.map +1 -0
- package/build/ts/server/authenticate/public/checkout/types.js.map +1 -0
- package/build/ts/server/authenticate/public/factory.d.ts +5 -0
- package/build/ts/server/authenticate/public/factory.d.ts.map +1 -0
- package/build/ts/server/authenticate/public/factory.js +18 -0
- package/build/ts/server/authenticate/public/factory.js.map +1 -0
- package/build/ts/server/authenticate/public/index.d.ts +2 -0
- package/build/ts/server/authenticate/public/index.d.ts.map +1 -0
- package/build/ts/server/authenticate/public/index.js +5 -0
- package/build/ts/server/authenticate/public/index.js.map +1 -0
- package/build/ts/server/authenticate/public/types.d.ts +61 -0
- package/build/ts/server/authenticate/public/types.d.ts.map +1 -0
- package/build/ts/server/authenticate/public/types.js.map +1 -0
- package/build/ts/server/authenticate/webhooks/authenticate.d.ts.map +1 -0
- package/build/ts/server/authenticate/webhooks/authenticate.js.map +1 -0
- package/build/ts/server/authenticate/webhooks/index.d.ts.map +1 -0
- package/build/ts/server/authenticate/webhooks/index.js.map +1 -0
- package/build/ts/server/authenticate/webhooks/register.d.ts.map +1 -0
- package/build/ts/server/authenticate/webhooks/register.js.map +1 -0
- package/build/ts/server/authenticate/webhooks/types.d.ts.map +1 -0
- package/build/ts/server/authenticate/webhooks/types.js +3 -0
- package/build/ts/server/authenticate/webhooks/types.js.map +1 -0
- package/build/ts/server/boundary/error.d.ts +2 -0
- package/build/ts/server/boundary/error.d.ts.map +1 -0
- package/build/ts/{boundary → server/boundary}/error.js +2 -1
- package/build/ts/server/boundary/error.js.map +1 -0
- package/build/ts/server/boundary/headers.d.ts.map +1 -0
- package/build/ts/server/boundary/headers.js.map +1 -0
- package/build/ts/server/boundary/index.d.ts +38 -0
- package/build/ts/server/boundary/index.d.ts.map +1 -0
- package/build/ts/server/boundary/index.js +41 -0
- package/build/ts/server/boundary/index.js.map +1 -0
- package/build/ts/server/boundary/types.d.ts.map +1 -0
- package/build/ts/server/boundary/types.js +3 -0
- package/build/ts/{auth/admin → server/boundary}/types.js.map +1 -1
- package/build/ts/server/clients/admin/factory.d.ts +11 -0
- package/build/ts/server/clients/admin/factory.d.ts.map +1 -0
- package/build/ts/server/clients/admin/factory.js +18 -0
- package/build/ts/server/clients/admin/factory.js.map +1 -0
- package/build/ts/server/clients/admin/graphql.d.ts +17 -0
- package/build/ts/server/clients/admin/graphql.d.ts.map +1 -0
- package/build/ts/{auth/admin/graphql-client.js → server/clients/admin/graphql.js} +9 -14
- package/build/ts/server/clients/admin/graphql.js.map +1 -0
- package/build/ts/server/clients/admin/index.d.ts +2 -0
- package/build/ts/server/clients/admin/index.d.ts.map +1 -0
- package/build/ts/server/clients/admin/index.js +5 -0
- package/build/ts/server/clients/admin/index.js.map +1 -0
- package/build/ts/{auth/admin/rest-client.d.ts → server/clients/admin/rest.d.ts} +10 -13
- package/build/ts/server/clients/admin/rest.d.ts.map +1 -0
- package/build/ts/{auth/admin/rest-client.js → server/clients/admin/rest.js} +56 -25
- package/build/ts/server/clients/admin/rest.js.map +1 -0
- package/build/ts/server/clients/admin/types.d.ts +13 -0
- package/build/ts/server/clients/admin/types.d.ts.map +1 -0
- package/build/ts/server/clients/admin/types.js +3 -0
- package/build/ts/server/clients/admin/types.js.map +1 -0
- package/build/ts/{config-types.d.ts → server/config-types.d.ts} +3 -3
- package/build/ts/server/config-types.d.ts.map +1 -0
- package/build/ts/server/config-types.js.map +1 -0
- package/build/ts/server/index.d.ts +7 -0
- package/build/ts/server/index.d.ts.map +1 -0
- package/build/ts/server/index.js +22 -0
- package/build/ts/server/index.js.map +1 -0
- package/build/ts/server/override-logger.d.ts.map +1 -0
- package/build/ts/server/override-logger.js.map +1 -0
- package/build/ts/server/shopify-app.d.ts +27 -0
- package/build/ts/server/shopify-app.d.ts.map +1 -0
- package/build/ts/{index.js → server/shopify-app.js} +13 -59
- package/build/ts/server/shopify-app.js.map +1 -0
- package/build/ts/{types.d.ts → server/types.d.ts} +45 -13
- package/build/ts/server/types.d.ts.map +1 -0
- package/build/ts/server/types.js.map +1 -0
- package/build/ts/server/unauthenticated/admin/factory.d.ts +5 -0
- package/build/ts/server/unauthenticated/admin/factory.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/admin/factory.js +30 -0
- package/build/ts/server/unauthenticated/admin/factory.js.map +1 -0
- package/build/ts/server/unauthenticated/admin/index.d.ts +2 -0
- package/build/ts/server/unauthenticated/admin/index.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/admin/index.js +5 -0
- package/build/ts/server/unauthenticated/admin/index.js.map +1 -0
- package/build/ts/server/unauthenticated/admin/types.d.ts +32 -0
- package/build/ts/server/unauthenticated/admin/types.d.ts.map +1 -0
- package/build/ts/server/unauthenticated/admin/types.js +3 -0
- package/build/ts/server/unauthenticated/admin/types.js.map +1 -0
- package/build/ts/server/version.d.ts +2 -0
- package/build/ts/server/version.d.ts.map +1 -0
- package/build/ts/{version.js → server/version.js} +1 -1
- package/build/ts/server/version.js.map +1 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +34 -10
- package/build/cjs/auth/helpers/handle-client-error.js +0 -37
- package/build/cjs/auth/public/authenticate.js +0 -36
- package/build/ts/adapters/node/index.d.ts.map +0 -1
- package/build/ts/adapters/node/index.js.map +0 -1
- package/build/ts/auth/admin/authenticate.d.ts.map +0 -1
- package/build/ts/auth/admin/authenticate.js.map +0 -1
- package/build/ts/auth/admin/graphql-client.d.ts +0 -22
- package/build/ts/auth/admin/graphql-client.d.ts.map +0 -1
- package/build/ts/auth/admin/graphql-client.js.map +0 -1
- package/build/ts/auth/admin/rest-client.d.ts.map +0 -1
- package/build/ts/auth/admin/rest-client.js.map +0 -1
- package/build/ts/auth/admin/types.d.ts.map +0 -1
- package/build/ts/auth/const.d.ts.map +0 -1
- package/build/ts/auth/const.js.map +0 -1
- package/build/ts/auth/helpers/add-response-headers.d.ts.map +0 -1
- package/build/ts/auth/helpers/add-response-headers.js.map +0 -1
- package/build/ts/auth/helpers/app-bridge-url.d.ts.map +0 -1
- package/build/ts/auth/helpers/app-bridge-url.js.map +0 -1
- package/build/ts/auth/helpers/begin-auth.d.ts.map +0 -1
- package/build/ts/auth/helpers/begin-auth.js.map +0 -1
- package/build/ts/auth/helpers/ensure-cors-headers.d.ts.map +0 -1
- package/build/ts/auth/helpers/ensure-cors-headers.js.map +0 -1
- package/build/ts/auth/helpers/get-session-token-header.d.ts.map +0 -1
- package/build/ts/auth/helpers/get-session-token-header.js.map +0 -1
- package/build/ts/auth/helpers/handle-client-error.d.ts +0 -11
- package/build/ts/auth/helpers/handle-client-error.d.ts.map +0 -1
- package/build/ts/auth/helpers/handle-client-error.js +0 -40
- package/build/ts/auth/helpers/handle-client-error.js.map +0 -1
- package/build/ts/auth/helpers/index.d.ts.map +0 -1
- package/build/ts/auth/helpers/index.js.map +0 -1
- package/build/ts/auth/helpers/redirect-to-auth-page.d.ts.map +0 -1
- package/build/ts/auth/helpers/redirect-to-auth-page.js.map +0 -1
- package/build/ts/auth/helpers/redirect-with-app-bridge-headers.d.ts +0 -4
- package/build/ts/auth/helpers/redirect-with-app-bridge-headers.d.ts.map +0 -1
- package/build/ts/auth/helpers/redirect-with-app-bridge-headers.js.map +0 -1
- package/build/ts/auth/helpers/redirect-with-exitiframe.d.ts.map +0 -1
- package/build/ts/auth/helpers/redirect-with-exitiframe.js.map +0 -1
- package/build/ts/auth/helpers/reject-bot-request.d.ts.map +0 -1
- package/build/ts/auth/helpers/reject-bot-request.js.map +0 -1
- package/build/ts/auth/helpers/respond-to-options-request.d.ts +0 -3
- package/build/ts/auth/helpers/respond-to-options-request.d.ts.map +0 -1
- package/build/ts/auth/helpers/respond-to-options-request.js.map +0 -1
- package/build/ts/auth/helpers/validate-session-token.d.ts +0 -4
- package/build/ts/auth/helpers/validate-session-token.d.ts.map +0 -1
- package/build/ts/auth/helpers/validate-session-token.js.map +0 -1
- package/build/ts/auth/login/login.d.ts.map +0 -1
- package/build/ts/auth/login/login.js.map +0 -1
- package/build/ts/auth/public/authenticate.d.ts +0 -4
- package/build/ts/auth/public/authenticate.d.ts.map +0 -1
- package/build/ts/auth/public/authenticate.js +0 -37
- package/build/ts/auth/public/authenticate.js.map +0 -1
- package/build/ts/auth/public/types.d.ts.map +0 -1
- package/build/ts/auth/public/types.js.map +0 -1
- package/build/ts/auth/webhooks/authenticate.d.ts.map +0 -1
- package/build/ts/auth/webhooks/authenticate.js.map +0 -1
- package/build/ts/auth/webhooks/index.d.ts.map +0 -1
- package/build/ts/auth/webhooks/index.js.map +0 -1
- package/build/ts/auth/webhooks/register.d.ts.map +0 -1
- package/build/ts/auth/webhooks/register.js.map +0 -1
- package/build/ts/auth/webhooks/types.d.ts.map +0 -1
- package/build/ts/auth/webhooks/types.js.map +0 -1
- package/build/ts/billing/cancel.d.ts.map +0 -1
- package/build/ts/billing/cancel.js.map +0 -1
- package/build/ts/billing/index.d.ts.map +0 -1
- package/build/ts/billing/index.js.map +0 -1
- package/build/ts/billing/request.d.ts.map +0 -1
- package/build/ts/billing/request.js.map +0 -1
- package/build/ts/billing/require.d.ts.map +0 -1
- package/build/ts/billing/require.js.map +0 -1
- package/build/ts/billing/types.d.ts.map +0 -1
- package/build/ts/billing/types.js.map +0 -1
- package/build/ts/boundary/error.d.ts +0 -2
- package/build/ts/boundary/error.d.ts.map +0 -1
- package/build/ts/boundary/error.js.map +0 -1
- package/build/ts/boundary/headers.d.ts.map +0 -1
- package/build/ts/boundary/headers.js.map +0 -1
- package/build/ts/boundary/types.d.ts.map +0 -1
- package/build/ts/boundary/types.js.map +0 -1
- package/build/ts/config-types.d.ts.map +0 -1
- package/build/ts/config-types.js.map +0 -1
- package/build/ts/index.d.ts +0 -67
- package/build/ts/index.d.ts.map +0 -1
- package/build/ts/index.js.map +0 -1
- package/build/ts/override-logger.d.ts.map +0 -1
- package/build/ts/override-logger.js.map +0 -1
- package/build/ts/types.d.ts.map +0 -1
- package/build/ts/types.js.map +0 -1
- package/build/ts/version.d.ts +0 -2
- package/build/ts/version.d.ts.map +0 -1
- package/build/ts/version.js.map +0 -1
- /package/build/cjs/{auth → server/authenticate/admin}/helpers/begin-auth.js +0 -0
- /package/build/cjs/{auth → server/authenticate/admin}/helpers/redirect-with-exitiframe.js +0 -0
- /package/build/cjs/{auth → server/authenticate}/const.js +0 -0
- /package/build/cjs/{auth → server/authenticate}/helpers/add-response-headers.js +0 -0
- /package/build/cjs/{auth → server/authenticate}/helpers/app-bridge-url.js +0 -0
- /package/build/cjs/{auth → server/authenticate}/helpers/get-session-token-header.js +0 -0
- /package/build/cjs/{auth → server/authenticate}/helpers/reject-bot-request.js +0 -0
- /package/build/cjs/{auth → server/authenticate}/webhooks/authenticate.js +0 -0
- /package/build/cjs/{auth → server/authenticate}/webhooks/register.js +0 -0
- /package/build/cjs/{boundary → server/boundary}/headers.js +0 -0
- /package/build/cjs/{override-logger.js → server/override-logger.js} +0 -0
- /package/build/cjs/{types.js → server/types.js} +0 -0
- /package/build/ts/{adapters → server/adapters}/node/index.d.ts +0 -0
- /package/build/ts/{billing → server/authenticate/admin/billing}/index.d.ts +0 -0
- /package/build/ts/{billing → server/authenticate/admin/billing}/index.js +0 -0
- /package/build/ts/{auth/admin → server/authenticate/admin/billing}/types.js +0 -0
- /package/build/ts/{auth → server/authenticate/admin}/helpers/begin-auth.js +0 -0
- /package/build/ts/{auth → server/authenticate/admin}/helpers/redirect-with-exitiframe.js +0 -0
- /package/build/ts/{auth/public → server/authenticate/admin}/types.js +0 -0
- /package/build/ts/{auth → server/authenticate}/const.d.ts +0 -0
- /package/build/ts/{auth → server/authenticate}/const.js +0 -0
- /package/build/ts/{auth → server/authenticate}/helpers/add-response-headers.d.ts +0 -0
- /package/build/ts/{auth → server/authenticate}/helpers/add-response-headers.js +0 -0
- /package/build/ts/{auth → server/authenticate}/helpers/app-bridge-url.d.ts +0 -0
- /package/build/ts/{auth → server/authenticate}/helpers/app-bridge-url.js +0 -0
- /package/build/ts/{auth → server/authenticate}/helpers/get-session-token-header.d.ts +0 -0
- /package/build/ts/{auth → server/authenticate}/helpers/get-session-token-header.js +0 -0
- /package/build/ts/{auth → server/authenticate}/helpers/reject-bot-request.d.ts +0 -0
- /package/build/ts/{auth → server/authenticate}/helpers/reject-bot-request.js +0 -0
- /package/build/ts/{auth → server/authenticate}/login/login.d.ts +0 -0
- /package/build/ts/{auth/webhooks → server/authenticate/public/appProxy}/types.js +0 -0
- /package/build/ts/{billing → server/authenticate/public/checkout}/types.js +0 -0
- /package/build/ts/{boundary → server/authenticate/public}/types.js +0 -0
- /package/build/ts/{auth → server/authenticate}/webhooks/authenticate.d.ts +0 -0
- /package/build/ts/{auth → server/authenticate}/webhooks/authenticate.js +0 -0
- /package/build/ts/{auth → server/authenticate}/webhooks/index.d.ts +0 -0
- /package/build/ts/{auth → server/authenticate}/webhooks/index.js +0 -0
- /package/build/ts/{auth → server/authenticate}/webhooks/register.d.ts +0 -0
- /package/build/ts/{auth → server/authenticate}/webhooks/register.js +0 -0
- /package/build/ts/{auth → server/authenticate}/webhooks/types.d.ts +0 -0
- /package/build/ts/{boundary → server/boundary}/headers.d.ts +0 -0
- /package/build/ts/{boundary → server/boundary}/headers.js +0 -0
- /package/build/ts/{boundary → server/boundary}/types.d.ts +0 -0
- /package/build/ts/{config-types.js → server/config-types.js} +0 -0
- /package/build/ts/{override-logger.d.ts → server/override-logger.d.ts} +0 -0
- /package/build/ts/{override-logger.js → server/override-logger.js} +0 -0
- /package/build/ts/{types.js → server/types.js} +0 -0
|
@@ -1,13 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.restClientFactory = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
|
|
5
|
+
function restClientFactory(_a) {
|
|
6
|
+
var params = _a.params, handleClientError = _a.handleClientError, session = _a.session;
|
|
7
|
+
var api = params.api;
|
|
8
|
+
var client = new RemixRestClient({
|
|
9
|
+
params: params,
|
|
10
|
+
handleClientError: handleClientError,
|
|
11
|
+
session: session,
|
|
12
|
+
});
|
|
13
|
+
if (api.rest) {
|
|
14
|
+
client.resources = {};
|
|
15
|
+
var RestResourceClient_1 = restResourceClientFactory({
|
|
16
|
+
params: params,
|
|
17
|
+
handleClientError: handleClientError,
|
|
18
|
+
session: session,
|
|
19
|
+
});
|
|
20
|
+
Object.entries(api.rest).forEach(function (_a) {
|
|
21
|
+
var _b = tslib_1.__read(_a, 2), name = _b[0], resource = _b[1];
|
|
22
|
+
var RemixResource = /** @class */ (function (_super) {
|
|
23
|
+
tslib_1.__extends(RemixResource, _super);
|
|
24
|
+
function RemixResource() {
|
|
25
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
26
|
+
}
|
|
27
|
+
RemixResource.Client = RestResourceClient_1;
|
|
28
|
+
return RemixResource;
|
|
29
|
+
}(resource));
|
|
30
|
+
Reflect.defineProperty(RemixResource, 'name', {
|
|
31
|
+
value: name,
|
|
32
|
+
});
|
|
33
|
+
Reflect.set(client.resources, name, RemixResource);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return client;
|
|
37
|
+
}
|
|
38
|
+
exports.restClientFactory = restClientFactory;
|
|
6
39
|
var RemixRestClient = /** @class */ (function () {
|
|
7
40
|
function RemixRestClient(_a) {
|
|
8
|
-
var params = _a.params,
|
|
41
|
+
var params = _a.params, session = _a.session, handleClientError = _a.handleClientError;
|
|
9
42
|
this.params = params;
|
|
10
|
-
this.
|
|
43
|
+
this.handleClientError = handleClientError;
|
|
11
44
|
this.session = session;
|
|
12
45
|
}
|
|
13
46
|
/**
|
|
@@ -62,7 +95,7 @@ var RemixRestClient = /** @class */ (function () {
|
|
|
62
95
|
originalRequest = Reflect.get(originalClient, 'request');
|
|
63
96
|
_a.label = 1;
|
|
64
97
|
case 1:
|
|
65
|
-
_a.trys.push([1, 3, ,
|
|
98
|
+
_a.trys.push([1, 3, , 7]);
|
|
66
99
|
return [4 /*yield*/, originalRequest.call(originalClient, params)];
|
|
67
100
|
case 2:
|
|
68
101
|
apiResponse = _a.sent();
|
|
@@ -73,31 +106,32 @@ var RemixRestClient = /** @class */ (function () {
|
|
|
73
106
|
})];
|
|
74
107
|
case 3:
|
|
75
108
|
error_1 = _a.sent();
|
|
76
|
-
return [
|
|
77
|
-
|
|
78
|
-
request: this.request,
|
|
79
|
-
shop: this.session.shop,
|
|
109
|
+
if (!this.handleClientError) return [3 /*break*/, 5];
|
|
110
|
+
return [4 /*yield*/, this.handleClientError({
|
|
80
111
|
error: error_1,
|
|
112
|
+
session: this.session,
|
|
113
|
+
params: this.params,
|
|
81
114
|
})];
|
|
82
115
|
case 4: throw _a.sent();
|
|
83
|
-
case 5:
|
|
116
|
+
case 5: throw new Error(error_1);
|
|
117
|
+
case 6: return [3 /*break*/, 7];
|
|
118
|
+
case 7: return [2 /*return*/];
|
|
84
119
|
}
|
|
85
120
|
});
|
|
86
121
|
});
|
|
87
122
|
};
|
|
88
123
|
return RemixRestClient;
|
|
89
124
|
}());
|
|
90
|
-
exports.RemixRestClient = RemixRestClient;
|
|
91
125
|
function restResourceClientFactory(_a) {
|
|
92
|
-
var params = _a.params,
|
|
93
|
-
var api = params.api
|
|
126
|
+
var params = _a.params, handleClientError = _a.handleClientError, session = _a.session;
|
|
127
|
+
var api = params.api;
|
|
94
128
|
var ApiClient = api.clients.Rest;
|
|
95
129
|
return /** @class */ (function (_super) {
|
|
96
130
|
tslib_1.__extends(RestResourceClient, _super);
|
|
97
131
|
function RestResourceClient() {
|
|
98
132
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
99
133
|
}
|
|
100
|
-
RestResourceClient.prototype.request = function (
|
|
134
|
+
RestResourceClient.prototype.request = function (requestParams) {
|
|
101
135
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
102
136
|
var originalClient, originalRequest, error_2;
|
|
103
137
|
return tslib_1.__generator(this, function (_a) {
|
|
@@ -107,22 +141,20 @@ function restResourceClientFactory(_a) {
|
|
|
107
141
|
originalRequest = Reflect.get(originalClient, 'request');
|
|
108
142
|
_a.label = 1;
|
|
109
143
|
case 1:
|
|
110
|
-
_a.trys.push([1, 3, ,
|
|
111
|
-
return [4 /*yield*/, originalRequest.call(originalClient,
|
|
144
|
+
_a.trys.push([1, 3, , 7]);
|
|
145
|
+
return [4 /*yield*/, originalRequest.call(originalClient, requestParams)];
|
|
112
146
|
case 2:
|
|
113
147
|
// We just call through to the API library client, and handle the error response here, so that data parsing
|
|
114
148
|
// behaves the same way.
|
|
115
149
|
return [2 /*return*/, _a.sent()];
|
|
116
150
|
case 3:
|
|
117
151
|
error_2 = _a.sent();
|
|
118
|
-
return [
|
|
119
|
-
|
|
120
|
-
request: request,
|
|
121
|
-
shop: session.shop,
|
|
122
|
-
error: error_2,
|
|
123
|
-
})];
|
|
152
|
+
if (!handleClientError) return [3 /*break*/, 5];
|
|
153
|
+
return [4 /*yield*/, handleClientError({ error: error_2, params: params, session: session })];
|
|
124
154
|
case 4: throw _a.sent();
|
|
125
|
-
case 5:
|
|
155
|
+
case 5: throw new Error(error_2);
|
|
156
|
+
case 6: return [3 /*break*/, 7];
|
|
157
|
+
case 7: return [2 /*return*/];
|
|
126
158
|
}
|
|
127
159
|
});
|
|
128
160
|
});
|
|
@@ -130,5 +162,4 @@ function restResourceClientFactory(_a) {
|
|
|
130
162
|
return RestResourceClient;
|
|
131
163
|
}(ApiClient));
|
|
132
164
|
}
|
|
133
|
-
|
|
134
|
-
//# sourceMappingURL=rest-client.js.map
|
|
165
|
+
//# sourceMappingURL=rest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rest.js","sourceRoot":"","sources":["../../../../../src/server/clients/admin/rest.ts"],"names":[],"mappings":";;;;AAgBA,SAAgB,iBAAiB,CAE/B,EAImB;QAHnB,MAAM,YAAA,EACN,iBAAiB,uBAAA,EACj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AI,KAAK,CAAC,OAAK,CAAC,CAAC;;;;;;KAEjC;IACH,sBAAC;AAAD,CAAC,AA3ED,IA2EC;AAED,SAAS,yBAAyB,CAAC,EAId;QAHnB,MAAM,YAAA,EACN,iBAAiB,uBAAA,EACjB,OAAO,aAAA;IAEA,IAAA,GAAG,GAAI,MAAM,IAAV,CAAW;IAErB,IAAM,SAAS,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC;IACnC;QAAwC,8CAAS;QAA1C;;QAeP,CAAC;QAdiB,oCAAO,GAAvB,UAAwB,aAA4B;;;;;;4BAC5C,cAAc,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,EAAC,OAAO,SAAA,EAAC,CAAC,CAAC;4BACjD,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;;;;4BAKtD,qBAAM,eAAe,CAAC,IAAI,CAAC,cAAc,EAAE,aAAa,CAAC,EAAA;;wBAFhE,2GAA2G;wBAC3G,wBAAwB;wBACxB,sBAAO,SAAyD,EAAC;;;iCAE7D,iBAAiB,EAAjB,wBAAiB;4BACb,qBAAM,iBAAiB,CAAC,EAAC,KAAK,SAAA,EAAE,MAAM,QAAA,EAAE,OAAO,SAAA,EAAC,CAAC,EAAA;gCAAvD,MAAM,SAAiD,CAAC;gCACnD,MAAM,IAAI,KAAK,CAAC,OAAK,CAAC,CAAC;;;;;;SAEjC;QACH,yBAAC;IAAD,CAAC,AAfM,CAAiC,SAAS,GAe/C;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Session } from '@shopify/shopify-api';
|
|
2
|
+
import { BasicParams } from '../../types';
|
|
3
|
+
export interface AdminClientOptions {
|
|
4
|
+
params: BasicParams;
|
|
5
|
+
session: Session;
|
|
6
|
+
handleClientError?: HandleAdminClientError;
|
|
7
|
+
}
|
|
8
|
+
export type HandleAdminClientError = (arg: {
|
|
9
|
+
error: any;
|
|
10
|
+
params: BasicParams;
|
|
11
|
+
session: Session;
|
|
12
|
+
}) => Promise<void>;
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/server/clients/admin/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ConfigParams as ApiConfigArg, ConfigInterface as ApiConfig, ShopifyRestResources, Session, ApiVersion, WebhookHandler } from '@shopify/shopify-api';
|
|
2
2
|
import { SessionStorage } from '@shopify/shopify-app-session-storage';
|
|
3
|
-
import type { GraphqlQueryFunction } from './auth/admin/graphql-client';
|
|
4
|
-
import type { RemixRestClient } from './auth/admin/rest-client';
|
|
5
3
|
import { AppDistribution } from './types';
|
|
4
|
+
import { RestClientWithResources } from './clients/admin/rest';
|
|
5
|
+
import { GraphqlQueryFunction } from './clients/admin/graphql';
|
|
6
6
|
export interface AppConfigArg<Resources extends ShopifyRestResources = ShopifyRestResources, Storage extends SessionStorage = SessionStorage> extends Omit<ApiConfigArg<Resources>, 'hostName' | 'hostScheme' | 'isEmbeddedApp' | 'apiVersion' | 'isCustomStoreApp'> {
|
|
7
7
|
/**
|
|
8
8
|
* The URL your app is running on.
|
|
@@ -296,7 +296,7 @@ export interface AdminApiContext<Resources extends ShopifyRestResources = Shopif
|
|
|
296
296
|
* };
|
|
297
297
|
* ```
|
|
298
298
|
*/
|
|
299
|
-
rest:
|
|
299
|
+
rest: RestClientWithResources<Resources>;
|
|
300
300
|
/**
|
|
301
301
|
* Methods for interacting with the Shopify Admin GraphQL API
|
|
302
302
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-types.d.ts","sourceRoot":"","sources":["../../../src/server/config-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,IAAI,YAAY,EAC5B,eAAe,IAAI,SAAS,EAC5B,oBAAoB,EACpB,OAAO,EACP,UAAU,EACV,cAAc,EACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC;AAEpE,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AACxC,OAAO,EAAC,uBAAuB,EAAC,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAC;AAE7D,MAAM,WAAW,YAAY,CAC3B,SAAS,SAAS,oBAAoB,GAAG,oBAAoB,EAC7D,OAAO,SAAS,cAAc,GAAG,cAAc,CAC/C,SAAQ,IAAI,CACV,YAAY,CAAC,SAAS,CAAC,EACrB,UAAU,GACV,YAAY,GACZ,eAAe,GACf,YAAY,GACZ,kBAAkB,CACrB;IACD;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;;;;;;;;;;;;;;;;OAmBG;IACH,cAAc,EAAE,OAAO,CAAC;IAExB;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoDG;IACH,QAAQ,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AAe,CAC9B,SAAS,SAAS,oBAAoB,GAAG,oBAAoB;IAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwDG;IACH,IAAI,EAAE,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,OAAO,EAAE,oBAAoB,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-types.js","sourceRoot":"","sources":["../../../src/server/config-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import '@shopify/shopify-api/adapters/web-api';
|
|
2
|
+
export { LATEST_API_VERSION, LogSeverity, DeliveryMethod, BillingInterval, ApiVersion, } from '@shopify/shopify-api';
|
|
3
|
+
export type { ShopifyApp, LoginError } from './types';
|
|
4
|
+
export { LoginErrorType, AppDistribution } from './types';
|
|
5
|
+
export { boundary } from './boundary';
|
|
6
|
+
export { shopifyApp } from './shopify-app';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,uCAAuC,CAAC;AAO/C,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,eAAe,EACf,UAAU,GACX,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAC,UAAU,EAAE,UAAU,EAAC,MAAM,SAAS,CAAC;AACpD,OAAO,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,SAAS,CAAC;AACxD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shopifyApp = exports.boundary = exports.AppDistribution = exports.LoginErrorType = exports.ApiVersion = exports.BillingInterval = exports.DeliveryMethod = exports.LogSeverity = exports.LATEST_API_VERSION = void 0;
|
|
4
|
+
require("@shopify/shopify-api/adapters/web-api");
|
|
5
|
+
var runtime_1 = require("@shopify/shopify-api/runtime");
|
|
6
|
+
(0, runtime_1.setAbstractRuntimeString)(function () {
|
|
7
|
+
return "Remix";
|
|
8
|
+
});
|
|
9
|
+
var shopify_api_1 = require("@shopify/shopify-api");
|
|
10
|
+
Object.defineProperty(exports, "LATEST_API_VERSION", { enumerable: true, get: function () { return shopify_api_1.LATEST_API_VERSION; } });
|
|
11
|
+
Object.defineProperty(exports, "LogSeverity", { enumerable: true, get: function () { return shopify_api_1.LogSeverity; } });
|
|
12
|
+
Object.defineProperty(exports, "DeliveryMethod", { enumerable: true, get: function () { return shopify_api_1.DeliveryMethod; } });
|
|
13
|
+
Object.defineProperty(exports, "BillingInterval", { enumerable: true, get: function () { return shopify_api_1.BillingInterval; } });
|
|
14
|
+
Object.defineProperty(exports, "ApiVersion", { enumerable: true, get: function () { return shopify_api_1.ApiVersion; } });
|
|
15
|
+
var types_1 = require("./types");
|
|
16
|
+
Object.defineProperty(exports, "LoginErrorType", { enumerable: true, get: function () { return types_1.LoginErrorType; } });
|
|
17
|
+
Object.defineProperty(exports, "AppDistribution", { enumerable: true, get: function () { return types_1.AppDistribution; } });
|
|
18
|
+
var boundary_1 = require("./boundary");
|
|
19
|
+
Object.defineProperty(exports, "boundary", { enumerable: true, get: function () { return boundary_1.boundary; } });
|
|
20
|
+
var shopify_app_1 = require("./shopify-app");
|
|
21
|
+
Object.defineProperty(exports, "shopifyApp", { enumerable: true, get: function () { return shopify_app_1.shopifyApp; } });
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,wDAAsE;AAEtE,IAAA,kCAAwB,EAAC;IACvB,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC,CAAC;AAEH,oDAM8B;AAL5B,iHAAA,kBAAkB,OAAA;AAClB,0GAAA,WAAW,OAAA;AACX,6GAAA,cAAc,OAAA;AACd,8GAAA,eAAe,OAAA;AACf,yGAAA,UAAU,OAAA;AAIZ,iCAAwD;AAAhD,uGAAA,cAAc,OAAA;AAAE,wGAAA,eAAe,OAAA;AACvC,uCAAoC;AAA5B,oGAAA,QAAQ,OAAA;AAChB,6CAAyC;AAAjC,yGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"override-logger.d.ts","sourceRoot":"","sources":["../../../src/server/override-logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAOrE,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAiC3E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"override-logger.js","sourceRoot":"","sources":["../../../src/server/override-logger.ts"],"names":[],"mappings":";;;;AAAA,0DAA4B;AAC5B,oDAAqE;AAErE,qCAAwD;AAExD,+CAA+C;AAC/C,mGAAmG;AACnG,mFAAmF;AACnF,SAAgB,cAAc,CAAC,MAAyB;IACtD,IAAM,WAAW,GAAG,EAAC,OAAO,EAAE,aAAa,EAAC,CAAC;IAE7C,IAAM,eAAe,GAAiC,UACpD,OAAO,EACP,OAAY;QAAZ,wBAAA,EAAA,YAAY;QACT,OAAA,MAAM,CAAC,OAAO,CAAC,OAAO,wCAAM,WAAW,GAAK,OAAO,EAAE;IAArD,CAAqD,CAAC;IAE3D,SAAS,UAAU,CAAC,eAA6C;QAC/D,OAAO,UAAU,OAAe,EAAE,OAAe;YAC/C,IAAI,gBAAM,CAAC,GAAG,CAAC,uCAA6B,EAAE,OAAO,CAAC,EAAE;gBACtD,MAAM,IAAI,oCAAsB,CAC9B,4CAAqC,OAAO,CAAE,CAC/C,CAAC;aACH;YAED,OAAO,eAAe,CAAC,wBAAiB,OAAO,eAAK,OAAO,CAAE,CAAC,CAAC;QACjE,CAAC,CAAC;IACJ,CAAC;IAED,6CACK,MAAM,KACT,GAAG,EAAE,UAAC,QAAQ,EAAE,OAAO,EAAE,OAAY;YAAZ,wBAAA,EAAA,YAAY;YACnC,OAAA,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,wCAAM,WAAW,GAAK,OAAO,EAAE;QAA3D,CAA2D,EAC7D,KAAK,EAAE,UAAC,OAAO,EAAE,OAAY;YAAZ,wBAAA,EAAA,YAAY;YAC3B,OAAA,MAAM,CAAC,KAAK,CAAC,OAAO,wCAAM,WAAW,GAAK,OAAO,EAAE;QAAnD,CAAmD,EACrD,IAAI,EAAE,UAAC,OAAO,EAAE,OAAY;YAAZ,wBAAA,EAAA,YAAY;YAC1B,OAAA,MAAM,CAAC,IAAI,CAAC,OAAO,wCAAM,WAAW,GAAK,OAAO,EAAE;QAAlD,CAAkD,EACpD,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,UAAC,OAAO,EAAE,OAAY;YAAZ,wBAAA,EAAA,YAAY;YAC3B,OAAA,MAAM,CAAC,KAAK,CAAC,OAAO,wCAAM,WAAW,GAAK,OAAO,EAAE;QAAnD,CAAmD,EACrD,UAAU,EAAE,UAAU,CAAC,eAAe,CAAC,IACvC;AACJ,CAAC;AAjCD,wCAiCC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import '@shopify/shopify-api/adapters/web-api';
|
|
2
|
+
import { ShopifyRestResources } from '@shopify/shopify-api';
|
|
3
|
+
import { SessionStorage } from '@shopify/shopify-app-session-storage';
|
|
4
|
+
import { type AppConfigArg } from './config-types';
|
|
5
|
+
import { type ShopifyApp } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* Creates an object your app will use to interact with Shopify.
|
|
8
|
+
*
|
|
9
|
+
* @param appConfig Configuration options for your shopify app. For example, the scopes your app needs.
|
|
10
|
+
* @returns `ShopifyApp` An object constructed using your appConfig. It has methods for interacting with Shopify.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* The minimum viable configuration
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { shopifyApp } from "@shopify/shopify-app-remix";
|
|
16
|
+
*
|
|
17
|
+
* const shopify = shopifyApp({
|
|
18
|
+
* apiKey: process.env.SHOPIFY_API_KEY!,
|
|
19
|
+
* apiSecretKey: process.env.SHOPIFY_API_SECRET!,
|
|
20
|
+
* scopes: process.env.SCOPES?.split(",")!,
|
|
21
|
+
* appUrl: process.env.SHOPIFY_APP_URL!,
|
|
22
|
+
* });
|
|
23
|
+
* export default shopify;
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function shopifyApp<Config extends AppConfigArg<Resources, Storage>, Resources extends ShopifyRestResources, Storage extends SessionStorage>(appConfig: Config): ShopifyApp<Config>;
|
|
27
|
+
//# sourceMappingURL=shopify-app.d.ts.map
|
|
@@ -0,0 +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,EAML,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;AAWjB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CACxB,MAAM,SAAS,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,EAC/C,SAAS,SAAS,oBAAoB,EACtC,OAAO,SAAS,cAAc,EAC9B,SAAS,EAAE,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAwCvC"}
|
|
@@ -1,33 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.shopifyApp = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
require("@shopify/shopify-api/adapters/web-api");
|
|
6
6
|
var shopify_api_1 = require("@shopify/shopify-api");
|
|
7
|
-
var runtime_1 = require("@shopify/shopify-api/runtime");
|
|
8
7
|
var types_1 = require("./types");
|
|
9
8
|
var version_1 = require("./version");
|
|
10
|
-
var webhooks_1 = require("./
|
|
11
|
-
var authenticate_1 = require("./
|
|
12
|
-
var authenticate_2 = require("./
|
|
13
|
-
var authenticate_3 = require("./auth/public/authenticate");
|
|
9
|
+
var webhooks_1 = require("./authenticate/webhooks");
|
|
10
|
+
var authenticate_1 = require("./authenticate/admin/authenticate");
|
|
11
|
+
var authenticate_2 = require("./authenticate/webhooks/authenticate");
|
|
14
12
|
var override_logger_1 = require("./override-logger");
|
|
15
|
-
var helpers_1 = require("./
|
|
16
|
-
var login_1 = require("./
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var types_2 = require("./types");
|
|
20
|
-
Object.defineProperty(exports, "LoginErrorType", { enumerable: true, get: function () { return types_2.LoginErrorType; } });
|
|
21
|
-
Object.defineProperty(exports, "AppDistribution", { enumerable: true, get: function () { return types_2.AppDistribution; } });
|
|
22
|
-
var shopify_api_2 = require("@shopify/shopify-api");
|
|
23
|
-
Object.defineProperty(exports, "LATEST_API_VERSION", { enumerable: true, get: function () { return shopify_api_2.LATEST_API_VERSION; } });
|
|
24
|
-
Object.defineProperty(exports, "LogSeverity", { enumerable: true, get: function () { return shopify_api_2.LogSeverity; } });
|
|
25
|
-
Object.defineProperty(exports, "DeliveryMethod", { enumerable: true, get: function () { return shopify_api_2.DeliveryMethod; } });
|
|
26
|
-
Object.defineProperty(exports, "BillingInterval", { enumerable: true, get: function () { return shopify_api_2.BillingInterval; } });
|
|
27
|
-
Object.defineProperty(exports, "ApiVersion", { enumerable: true, get: function () { return shopify_api_2.ApiVersion; } });
|
|
28
|
-
(0, runtime_1.setAbstractRuntimeString)(function () {
|
|
29
|
-
return "Remix";
|
|
30
|
-
});
|
|
13
|
+
var helpers_1 = require("./authenticate/helpers");
|
|
14
|
+
var login_1 = require("./authenticate/login/login");
|
|
15
|
+
var admin_1 = require("./unauthenticated/admin");
|
|
16
|
+
var public_1 = require("./authenticate/public");
|
|
31
17
|
/**
|
|
32
18
|
* Creates an object your app will use to interact with Shopify.
|
|
33
19
|
*
|
|
@@ -63,9 +49,12 @@ function shopifyApp(appConfig) {
|
|
|
63
49
|
registerWebhooks: (0, webhooks_1.registerWebhooksFactory)(params),
|
|
64
50
|
authenticate: {
|
|
65
51
|
admin: oauth.authenticateAdmin.bind(oauth),
|
|
66
|
-
public: (0,
|
|
52
|
+
public: (0, public_1.authenticatePublicFactory)(params),
|
|
67
53
|
webhook: (0, authenticate_2.authenticateWebhookFactory)(params),
|
|
68
54
|
},
|
|
55
|
+
unauthenticated: {
|
|
56
|
+
admin: (0, admin_1.unauthenticatedAdminContextFactory)(params),
|
|
57
|
+
},
|
|
69
58
|
};
|
|
70
59
|
if (isAppStoreApp(shopify, appConfig) ||
|
|
71
60
|
isSingleMerchantApp(shopify, appConfig)) {
|
|
@@ -74,41 +63,6 @@ function shopifyApp(appConfig) {
|
|
|
74
63
|
return shopify;
|
|
75
64
|
}
|
|
76
65
|
exports.shopifyApp = shopifyApp;
|
|
77
|
-
/**
|
|
78
|
-
* A collection of functions that handle the necessary code for error boundaries in routes using authenticate.admin.
|
|
79
|
-
*/
|
|
80
|
-
exports.boundary = {
|
|
81
|
-
/**
|
|
82
|
-
* A function that handles errors or thrown responses.
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* Catching errors in a route
|
|
86
|
-
* ```ts
|
|
87
|
-
* // app/routes/admin/widgets.ts
|
|
88
|
-
* import { boundary } from "@shopify/shopify-app-remix";
|
|
89
|
-
*
|
|
90
|
-
* export function ErrorBoundary() {
|
|
91
|
-
* return boundary.error(useRouteError());
|
|
92
|
-
* }
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
error: error_1.errorBoundary,
|
|
96
|
-
/**
|
|
97
|
-
* A function that sets the appropriate document repsonse headers.
|
|
98
|
-
*
|
|
99
|
-
* @example
|
|
100
|
-
* Catching errors in a route
|
|
101
|
-
* ```ts
|
|
102
|
-
* // app/routes/admin/widgets.ts
|
|
103
|
-
* import { boundary } from "@shopify/shopify-app-remix";
|
|
104
|
-
*
|
|
105
|
-
* export const headers = (headersArgs) => {
|
|
106
|
-
* return boundary.headers(headersArgs);
|
|
107
|
-
* };
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
|
-
headers: headers_1.headersBoundary,
|
|
111
|
-
};
|
|
112
66
|
function isAppStoreApp(_shopify, config) {
|
|
113
67
|
return config.distribution === types_1.AppDistribution.AppStore;
|
|
114
68
|
}
|
|
@@ -152,4 +106,4 @@ function deriveConfig(appConfig, apiConfig) {
|
|
|
152
106
|
loginPath: "".concat(authPathPrefix, "/login"),
|
|
153
107
|
} });
|
|
154
108
|
}
|
|
155
|
-
//# sourceMappingURL=
|
|
109
|
+
//# sourceMappingURL=shopify-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shopify-app.js","sourceRoot":"","sources":["../../../src/server/shopify-app.ts"],"names":[],"mappings":";;;;AAAA,iDAA+C;AAC/C,oDAQ8B;AAI9B,iCASiB;AACjB,qCAAwD;AACxD,oDAAgE;AAChE,kEAA+D;AAC/D,qEAAgF;AAChF,qDAAiD;AACjD,kDAAyE;AACzE,oDAAwD;AACxD,iDAA2E;AAC3E,gDAAgE;AAEhE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,UAAU,CAIxB,SAAiB;IACjB,IAAM,GAAG,GAAG,SAAS,CAA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oB;;IAEpB,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE;QAC7B,MAAM,IAAI,0BAAY,CACpB,gJAAgJ,CACjJ,CAAC;KACH;IAED,IAAM,cAAc,GAAG,SAAS,CAAC,cAAc,IAAI,OAAO,CAAC;IAC3D,SAAS,CAAC,YAAY,GAAG,MAAA,SAAS,CAAC,YAAY,mCAAI,uBAAe,CAAC,QAAQ,CAAC;IAE5E,8DACK,SAAS,GACT,SAAS,KACZ,eAAe,EAAE,SAAS,CAAC,YAAY,KAAK,uBAAe,CAAC,YAAY,EACxE,eAAe,EAAE,MAAA,SAAS,CAAC,eAAe,mCAAI,KAAK,EACnD,KAAK,EAAE,MAAA,SAAS,CAAC,KAAK,mCAAI,EAAE,EAC5B,cAAc,EAAE,SAAS,CAAC,cAAyB,EACnD,IAAI,EAAE;YACJ,IAAI,EAAE,cAAc;YACpB,YAAY,EAAE,UAAG,cAAc,cAAW;YAC1C,qBAAqB,EAAE,UAAG,cAAc,mBAAgB;YACxD,cAAc,EAAE,UAAG,cAAc,iBAAc;YAC/C,SAAS,EAAE,UAAG,cAAc,WAAQ;SACrC,IACD;AACJ,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { RegisterReturn, Shopify, ShopifyRestResources } from '@shopify/shopify-api';
|
|
2
2
|
import { SessionStorage } from '@shopify/shopify-app-session-storage';
|
|
3
3
|
import type { AppConfig, AppConfigArg } from './config-types';
|
|
4
|
-
import type { AdminContext } from './
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
4
|
+
import type { AdminContext } from './authenticate/admin/types';
|
|
5
|
+
import type { RegisterWebhooksOptions, WebhookContext, WebhookContextWithSession } from './authenticate/webhooks/types';
|
|
6
|
+
import type { UnauthenticatedAdminContext } from './unauthenticated/admin/types';
|
|
7
|
+
import type { AuthenticatePublic } from './authenticate/public/types';
|
|
7
8
|
export interface BasicParams {
|
|
8
9
|
api: Shopify;
|
|
9
10
|
config: AppConfig;
|
|
@@ -32,8 +33,8 @@ export interface LoginError {
|
|
|
32
33
|
type Login = (request: Request) => Promise<LoginError | never>;
|
|
33
34
|
type AddDocumentResponseHeaders = (request: Request, headers: Headers) => void;
|
|
34
35
|
type AuthenticateAdmin<Config extends AppConfigArg, Resources extends ShopifyRestResources = ShopifyRestResources> = (request: Request) => Promise<AdminContext<Config, Resources>>;
|
|
35
|
-
type AuthenticatePublic = (request: Request) => Promise<PublicContext>;
|
|
36
36
|
type AuthenticateWebhook<Resources extends ShopifyRestResources = ShopifyRestResources, Topics = string | number | symbol> = (request: Request) => Promise<WebhookContext<Topics> | WebhookContextWithSession<Topics, Resources>>;
|
|
37
|
+
type UnauthenticatedAdmin<Resources extends ShopifyRestResources> = (shop: string) => Promise<UnauthenticatedAdminContext<Resources>>;
|
|
37
38
|
type RestResourcesType<Config extends AppConfigArg> = Config['restResources'] extends ShopifyRestResources ? Config['restResources'] : ShopifyRestResources;
|
|
38
39
|
type SessionStorageType<Config extends AppConfigArg> = Config['sessionStorage'] extends SessionStorage ? Config['sessionStorage'] : SessionStorage;
|
|
39
40
|
export interface ShopifyAppBase<Config extends AppConfigArg> {
|
|
@@ -137,9 +138,6 @@ export interface ShopifyAppBase<Config extends AppConfigArg> {
|
|
|
137
138
|
*
|
|
138
139
|
* If there is no session for the Request, this will redirect the merchant to correct auth flows.
|
|
139
140
|
*
|
|
140
|
-
* @param request `Request` The incoming request to authenticate
|
|
141
|
-
* @returns `Promise<AdminContext<Config, Resources>>` An authenticated admin context
|
|
142
|
-
*
|
|
143
141
|
* @example
|
|
144
142
|
* Registering webhooks and seeding data when a merchant installs your app.
|
|
145
143
|
* ```ts
|
|
@@ -171,9 +169,6 @@ export interface ShopifyAppBase<Config extends AppConfigArg> {
|
|
|
171
169
|
*
|
|
172
170
|
* An example of when to use this is a request from a checkout extension.
|
|
173
171
|
*
|
|
174
|
-
* @param request `Request` The incoming request to authenticate
|
|
175
|
-
* @returns `Promise<PublicContext>` An authenticated public context
|
|
176
|
-
*
|
|
177
172
|
* @example
|
|
178
173
|
* Authenticating a request from a checkout extension
|
|
179
174
|
*
|
|
@@ -194,9 +189,6 @@ export interface ShopifyAppBase<Config extends AppConfigArg> {
|
|
|
194
189
|
/**
|
|
195
190
|
* Authenticate a Shopify webhook request, get back an authenticated admin context and details on the webhook request
|
|
196
191
|
*
|
|
197
|
-
* @param request `Request` The incoming request to authenticate
|
|
198
|
-
* @returns `Promise<PublicContext>` An authenticated public context
|
|
199
|
-
*
|
|
200
192
|
* @example
|
|
201
193
|
* Authenticating a webhook request
|
|
202
194
|
*
|
|
@@ -251,6 +243,46 @@ export interface ShopifyAppBase<Config extends AppConfigArg> {
|
|
|
251
243
|
*/
|
|
252
244
|
webhook: AuthenticateWebhook<RestResourcesType<Config>, keyof Config['webhooks'] | MandatoryTopics>;
|
|
253
245
|
};
|
|
246
|
+
/**
|
|
247
|
+
* Methods for getting Contexts from requests that do not originate from Shopify
|
|
248
|
+
*
|
|
249
|
+
*/
|
|
250
|
+
unauthenticated: {
|
|
251
|
+
/**
|
|
252
|
+
* Get an admin context by passing a shop
|
|
253
|
+
*
|
|
254
|
+
* **Warning** This should only be used for Requests that do not originate from Shopify.
|
|
255
|
+
* You must do your own authentication before using this method.
|
|
256
|
+
* This method throws an error if there is no session for the shop.
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* Responding to a request from an external service not controlled by Shopify.
|
|
260
|
+
* ```ts
|
|
261
|
+
* // app/shopify.server.ts
|
|
262
|
+
* import { LATEST_API_VERSION, shopifyApp } from "@shopify/shopify-app-remix";
|
|
263
|
+
* import { restResources } from "@shopify/shopify-api/rest/admin/2023-04";
|
|
264
|
+
*
|
|
265
|
+
* const shopify = shopifyApp({
|
|
266
|
+
* restResources,
|
|
267
|
+
* // ...etc
|
|
268
|
+
* });
|
|
269
|
+
* export default shopify;
|
|
270
|
+
*
|
|
271
|
+
* // app/routes/**\/*.jsx
|
|
272
|
+
* import { LoaderArgs, json } from "@remix-run/node";
|
|
273
|
+
* import { authenticateExternal } from "~/helpers/authenticate"
|
|
274
|
+
* import shopify from "../../shopify.server";
|
|
275
|
+
*
|
|
276
|
+
* export async function loader({ request }: LoaderArgs) {
|
|
277
|
+
* const shop = await authenticateExternal(request)
|
|
278
|
+
* const {admin} = await shopify.unauthenticated.admin(shop);
|
|
279
|
+
*
|
|
280
|
+
* return json(await admin.rest.resources.Product.count({ session }));
|
|
281
|
+
* }
|
|
282
|
+
* ```
|
|
283
|
+
*/
|
|
284
|
+
admin: UnauthenticatedAdmin<RestResourcesType<Config>>;
|
|
285
|
+
};
|
|
254
286
|
}
|
|
255
287
|
interface ShopifyAppLogin {
|
|
256
288
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/server/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,OAAO,EACP,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC;AAEpE,OAAO,KAAK,EAAC,SAAS,EAAE,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EACV,uBAAuB,EACvB,cAAc,EACd,yBAAyB,EAC1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAC/E,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAEpE,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC3B;AAED,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,UAAU,GACV,SAAS,CAAC;AAId,oBAAY,eAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoDG;IACH,KAAK,EAAE,KAAK,CAAC;CACd;AAED,MAAM,MAAM,QAAQ,CAAC,MAAM,SAAS,YAAY,IAAI,cAAc,CAAC,MAAM,CAAC,CAAC;AAC3E,MAAM,MAAM,iBAAiB,CAAC,MAAM,SAAS,YAAY,IACvD,cAAc,CAAC,MAAM,CAAC,GAAG,eAAe,CAAC;AAC3C,MAAM,MAAM,WAAW,CAAC,MAAM,SAAS,YAAY,IAAI,cAAc,CAAC,MAAM,CAAC,GAC3E,eAAe,CAAC;AAElB;;;;GAIG;AACH,MAAM,MAAM,UAAU,CAAC,MAAM,SAAS,YAAY,IAChD,MAAM,CAAC,cAAc,CAAC,SAAS,eAAe,CAAC,YAAY,GACvD,QAAQ,CAAC,MAAM,CAAC,GAChB,MAAM,CAAC,cAAc,CAAC,SAAS,eAAe,CAAC,cAAc,GAC7D,iBAAiB,CAAC,MAAM,CAAC,GACzB,MAAM,CAAC,cAAc,CAAC,SAAS,eAAe,CAAC,QAAQ,GACvD,WAAW,CAAC,MAAM,CAAC,GACnB,WAAW,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/server/types.ts"],"names":[],"mappings":";;;AA+BA,+CAA+C;AAC/C,sFAAsF;AACtF,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,yCAAsB,CAAA;IACtB,qDAAkC,CAAA;IAClC,iDAA8B,CAAA;AAChC,CAAC,EAJW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAI1B;AAiBD,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,8CAA4B,CAAA;IAC5B,8CAA4B,CAAA;AAC9B,CAAC,EAHW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAGzB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ShopifyRestResources } from '@shopify/shopify-api';
|
|
2
|
+
import { BasicParams } from '../../types';
|
|
3
|
+
import { UnauthenticatedAdminContext } from './types';
|
|
4
|
+
export declare function unauthenticatedAdminContextFactory<Resources extends ShopifyRestResources>(params: BasicParams): (shop: string) => Promise<UnauthenticatedAdminContext<Resources>>;
|
|
5
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../../src/server/unauthenticated/admin/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAExE,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAGxC,OAAO,EAAC,2BAA2B,EAAC,MAAM,SAAS,CAAC;AAEpD,wBAAgB,kCAAkC,CAChD,SAAS,SAAS,oBAAoB,EACtC,MAAM,EAAE,WAAW,UAEX,MAAM,KACX,QAAQ,4BAA4B,SAAS,CAAC,CAAC,CAiBnD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unauthenticatedAdminContextFactory = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var shopify_api_1 = require("@shopify/shopify-api");
|
|
6
|
+
var admin_1 = require("../../clients/admin");
|
|
7
|
+
function unauthenticatedAdminContextFactory(params) {
|
|
8
|
+
var _this = this;
|
|
9
|
+
return function (shop) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
10
|
+
var offlineSessionId, session;
|
|
11
|
+
return tslib_1.__generator(this, function (_a) {
|
|
12
|
+
switch (_a.label) {
|
|
13
|
+
case 0:
|
|
14
|
+
offlineSessionId = params.api.session.getOfflineId(shop);
|
|
15
|
+
return [4 /*yield*/, params.config.sessionStorage.loadSession(offlineSessionId)];
|
|
16
|
+
case 1:
|
|
17
|
+
session = _a.sent();
|
|
18
|
+
if (!session) {
|
|
19
|
+
throw new shopify_api_1.ShopifyError("Could not find a session for shop ".concat(shop, " when creating unauthenticated admin context"));
|
|
20
|
+
}
|
|
21
|
+
return [2 /*return*/, {
|
|
22
|
+
session: session,
|
|
23
|
+
admin: (0, admin_1.adminClientFactory)({ params: params, session: session }),
|
|
24
|
+
}];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}); };
|
|
28
|
+
}
|
|
29
|
+
exports.unauthenticatedAdminContextFactory = unauthenticatedAdminContextFactory;
|
|
30
|
+
//# sourceMappingURL=factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../../../src/server/unauthenticated/admin/factory.ts"],"names":[],"mappings":";;;;AAAA,oDAAwE;AAGxE,6CAAuD;AAIvD,SAAgB,kCAAkC,CAEhD,MAAmB;IAFrB,iBAsBC;IAnBC,OAAO,UACL,IAAY;;;;;oBAEN,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;oBAC/C,qBAAM,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,CAC5D,gBAAgB,CACjB,EAAA;;oBAFK,OAAO,GAAG,SAEf;oBAED,IAAI,CAAC,OAAO,EAAE;wBACZ,MAAM,IAAI,0BAAY,CACpB,4CAAqC,IAAI,iDAA8C,CACxF,CAAC;qBACH;oBAED,sBAAO;4BACL,OAAO,SAAA;4BACP,KAAK,EAAE,IAAA,0BAAkB,EAAY,EAAC,MAAM,QAAA,EAAE,OAAO,SAAA,EAAC,CAAC;yBACxD,EAAC;;;SACH,CAAC;AACJ,CAAC;AAtBD,gFAsBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/server/unauthenticated/admin/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/server/unauthenticated/admin/index.ts"],"names":[],"mappings":";;;AAAA,oDAA0B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Session, ShopifyRestResources } from '@shopify/shopify-api';
|
|
2
|
+
import type { AdminApiContext } from '../../config-types';
|
|
3
|
+
export interface UnauthenticatedAdminContext<Resources extends ShopifyRestResources> {
|
|
4
|
+
/**
|
|
5
|
+
* The session for the given shop.
|
|
6
|
+
*
|
|
7
|
+
* This comes from the session storage which `shopifyApp` uses to store sessions in your database of choice.
|
|
8
|
+
*
|
|
9
|
+
* This will always be an offline session. You can use to get shop specific data.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* Getting your app's shop specific widget data using a session
|
|
13
|
+
* ```ts
|
|
14
|
+
* // app/routes/**\/.ts
|
|
15
|
+
* import { LoaderArgs, json } from "@remix-run/node";
|
|
16
|
+
* import { unauthenticated } from "../shopify.server";
|
|
17
|
+
* import { getWidgets } from "~/db/widgets.server";
|
|
18
|
+
*
|
|
19
|
+
* export const loader = async ({ request }: LoaderArgs) => {
|
|
20
|
+
* const shop = getShopFromExternalRequest(request);
|
|
21
|
+
* const { session } = await unauthenticated.admin(shop);
|
|
22
|
+
* return json(await getWidgets({shop: session.shop));
|
|
23
|
+
* };
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
session: Session;
|
|
27
|
+
/**
|
|
28
|
+
* Methods for interacting with the Shopify GraphQL / REST Admin APIs for the given store.
|
|
29
|
+
*/
|
|
30
|
+
admin: AdminApiContext<Resources>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/server/unauthenticated/admin/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,oBAAoB,EAAC,MAAM,sBAAsB,CAAC;AAEnE,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AAExD,MAAM,WAAW,2BAA2B,CAC1C,SAAS,SAAS,oBAAoB;IAEtC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,KAAK,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/server/unauthenticated/admin/types.ts"],"names":[],"mappings":""}
|