shopify-app-js 0.0.1-security → 1.0.1
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.
Potentially problematic release.
This version of shopify-app-js might be problematic. Click here for more details.
- package/.changeset/README.md +8 -0
- package/.changeset/config.json +14 -0
- package/.changeset/flat-clouds-camp.md +5 -0
- package/.eslintrc.js +36 -0
- package/.github/CODEOWNERS +1 -0
- package/.github/ISSUE_TEMPLATE/BUG_REPORT.md +36 -0
- package/.github/ISSUE_TEMPLATE/ENHANCEMENT.md +9 -0
- package/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md +9 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +34 -0
- package/.github/dependabot.yml +9 -0
- package/.github/workflows/changelog.yml +30 -0
- package/.github/workflows/ci.yml +22 -0
- package/.github/workflows/cla.yml +22 -0
- package/.github/workflows/close-waiting-for-response-issues.yml +20 -0
- package/.github/workflows/main-release.yml +36 -0
- package/.github/workflows/markdown_link_check.yml +14 -0
- package/.github/workflows/markdown_link_checker_config.json +9 -0
- package/.github/workflows/publish-experimental-build.yml +30 -0
- package/.github/workflows/release-candidate.yml +35 -0
- package/.github/workflows/remove-labels-on-activity.yml +16 -0
- package/.github/workflows/stale.yml +26 -0
- package/.prettierignore +5 -0
- package/.prettierrc +1 -0
- package/CODE_OF_CONDUCT.md +46 -0
- package/CONTRIBUTING.md +39 -0
- package/LICENSE.md +9 -0
- package/README.md +62 -3
- package/RELEASING.md +142 -0
- package/loom.config.ts +115 -0
- package/package.json +44 -3
- package/packages/.prettierrc +1 -0
- package/packages/shopify-app-express/CHANGELOG.md +316 -0
- package/packages/shopify-app-express/LICENSE.md +9 -0
- package/packages/shopify-app-express/README.md +93 -0
- package/packages/shopify-app-express/docs/reference/README.md +3 -0
- package/packages/shopify-app-express/docs/reference/auth.md +76 -0
- package/packages/shopify-app-express/docs/reference/cspHeaders.md +24 -0
- package/packages/shopify-app-express/docs/reference/ensureInstalledOnShop.md +17 -0
- package/packages/shopify-app-express/docs/reference/migrating-app-v6-api-lib-to-express-lib.md +345 -0
- package/packages/shopify-app-express/docs/reference/processWebhooks.md +67 -0
- package/packages/shopify-app-express/docs/reference/redirectOutOfApp.md +77 -0
- package/packages/shopify-app-express/docs/reference/redirectToShopifyOrAppRoot.md +20 -0
- package/packages/shopify-app-express/docs/reference/shopifyApp.md +148 -0
- package/packages/shopify-app-express/docs/reference/validateAuthenticatedSession.md +30 -0
- package/packages/shopify-app-express/loom.config.ts +27 -0
- package/packages/shopify-app-express/package.json +54 -0
- package/packages/shopify-app-express/src/__tests__/index.test.ts +100 -0
- package/packages/shopify-app-express/src/__tests__/integration/oauth.test.ts +445 -0
- package/packages/shopify-app-express/src/__tests__/integration/responses.ts +135 -0
- package/packages/shopify-app-express/src/__tests__/integration/types.ts +22 -0
- package/packages/shopify-app-express/src/__tests__/integration/utils.ts +68 -0
- package/packages/shopify-app-express/src/__tests__/integration/webhooks.test.ts +208 -0
- package/packages/shopify-app-express/src/__tests__/redirect-to-auth.test.ts +103 -0
- package/packages/shopify-app-express/src/__tests__/setup-jest.ts +8 -0
- package/packages/shopify-app-express/src/__tests__/test-helper.ts +204 -0
- package/packages/shopify-app-express/src/app-installations.ts +42 -0
- package/packages/shopify-app-express/src/auth/__tests__/auth.test.ts +303 -0
- package/packages/shopify-app-express/src/auth/auth-callback.ts +131 -0
- package/packages/shopify-app-express/src/auth/index.ts +32 -0
- package/packages/shopify-app-express/src/auth/types.ts +13 -0
- package/packages/shopify-app-express/src/config-types.ts +38 -0
- package/packages/shopify-app-express/src/error.ts +8 -0
- package/packages/shopify-app-express/src/index.ts +171 -0
- package/packages/shopify-app-express/src/middlewares/__tests__/csp-headers.test.ts +69 -0
- package/packages/shopify-app-express/src/middlewares/__tests__/ensure-installed-on-shop.test.ts +193 -0
- package/packages/shopify-app-express/src/middlewares/__tests__/redirect-to-shopify-or-app-root.test.ts +59 -0
- package/packages/shopify-app-express/src/middlewares/__tests__/validate-authenticated-session.test.ts +319 -0
- package/packages/shopify-app-express/src/middlewares/csp-headers.ts +31 -0
- package/packages/shopify-app-express/src/middlewares/ensure-installed-on-shop.ts +176 -0
- package/packages/shopify-app-express/src/middlewares/has-valid-access-token.ts +25 -0
- package/packages/shopify-app-express/src/middlewares/index.ts +15 -0
- package/packages/shopify-app-express/src/middlewares/redirect-to-shopify-or-app-root.ts +39 -0
- package/packages/shopify-app-express/src/middlewares/types.ts +6 -0
- package/packages/shopify-app-express/src/middlewares/validate-authenticated-session.ts +142 -0
- package/packages/shopify-app-express/src/redirect-out-of-app.ts +80 -0
- package/packages/shopify-app-express/src/redirect-to-auth.ts +70 -0
- package/packages/shopify-app-express/src/types.ts +26 -0
- package/packages/shopify-app-express/src/version.ts +1 -0
- package/packages/shopify-app-express/src/webhooks/__tests__/process.test.ts +138 -0
- package/packages/shopify-app-express/src/webhooks/index.ts +54 -0
- package/packages/shopify-app-express/src/webhooks/process.ts +22 -0
- package/packages/shopify-app-express/src/webhooks/types.ts +24 -0
- package/packages/shopify-app-express/tsconfig.json +10 -0
- package/packages/shopify-app-remix/.eslintrc.js +3 -0
- package/packages/shopify-app-remix/CHANGELOG.md +569 -0
- package/packages/shopify-app-remix/LICENSE.md +9 -0
- package/packages/shopify-app-remix/README.md +223 -0
- package/packages/shopify-app-remix/docs/build-docs.sh +11 -0
- package/packages/shopify-app-remix/docs/generated/generated_docs_data.json +18650 -0
- package/packages/shopify-app-remix/docs/generated/generated_static_pages.json +540 -0
- package/packages/shopify-app-remix/docs/staticPages/admin.doc.ts +130 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/guides/admin/auth-cors.example.tsx +11 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/guides/admin/auth.example.tsx +19 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/guides/admin/graphql.example.tsx +29 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/guides/admin/headers.example.tsx +10 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/guides/admin/rest-resources.example.tsx +9 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/guides/admin/rest.example.tsx +17 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/guides/future-flags/config.example.ts +8 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/guides/future-flags/unstable.example.ts +9 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/guides/graphql-types/.graphqlrc.ts +16 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/guides/graphql-types/install.npm.example.sh +2 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/guides/graphql-types/install.pnpm.example.sh +2 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/guides/graphql-types/install.yarn.example.sh +2 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/guides/graphql-types/package.json +5 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/guides/graphql-types/run.npm.example.sh +1 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/guides/graphql-types/run.pnpm.example.sh +1 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/guides/graphql-types/run.yarn.example.sh +1 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/guides/webhooks/config.example.ts +19 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/guides/webhooks/endpoint.example.ts +24 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/index/app-provider.example.ts +30 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/index/boundaries.example.ts +9 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/index/create.npm.example.sh +1 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/index/create.pnpm.example.sh +1 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/index/create.yarn.example.sh +1 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/index/embedded-app-auth-strategy-config.example.ts +10 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/index/entry-server.example.ts +12 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/index/install.npm.example.sh +1 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/index/install.pnpm.example.sh +1 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/index/install.yarn.example.sh +1 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/index/shopify-app.example.ts +14 -0
- package/packages/shopify-app-remix/docs/staticPages/examples/index/splat-route.example.ts +11 -0
- package/packages/shopify-app-remix/docs/staticPages/future-flags.doc.ts +94 -0
- package/packages/shopify-app-remix/docs/staticPages/graphql-types.doc.ts +148 -0
- package/packages/shopify-app-remix/docs/staticPages/index.doc.ts +227 -0
- package/packages/shopify-app-remix/docs/staticPages/webhooks.doc.ts +64 -0
- package/packages/shopify-app-remix/docs/tsconfig.docs.json +9 -0
- package/packages/shopify-app-remix/docs/typeOverride.json +1 -0
- package/packages/shopify-app-remix/docs/upcoming_changes.md +153 -0
- package/packages/shopify-app-remix/loom.config.ts +57 -0
- package/packages/shopify-app-remix/package.json +93 -0
- package/packages/shopify-app-remix/src/react/.eslintrc.js +16 -0
- package/packages/shopify-app-remix/src/react/__tests__/test-helper.ts +22 -0
- package/packages/shopify-app-remix/src/react/components/AppProvider/AppProvider.doc.ts +34 -0
- package/packages/shopify-app-remix/src/react/components/AppProvider/AppProvider.tsx +121 -0
- package/packages/shopify-app-remix/src/react/components/AppProvider/__tests__/AppProvider.test.tsx +68 -0
- package/packages/shopify-app-remix/src/react/components/AppProvider/index.ts +1 -0
- package/packages/shopify-app-remix/src/react/components/RemixPolarisLink.tsx +14 -0
- package/packages/shopify-app-remix/src/react/components/index.ts +1 -0
- package/packages/shopify-app-remix/src/react/const.ts +2 -0
- package/packages/shopify-app-remix/src/react/index.ts +1 -0
- package/packages/shopify-app-remix/src/server/.eslintrc.js +16 -0
- package/packages/shopify-app-remix/src/server/__test-helpers/__tests__/request-mock.test.ts +171 -0
- package/packages/shopify-app-remix/src/server/__test-helpers/const.ts +11 -0
- package/packages/shopify-app-remix/src/server/__test-helpers/expect-admin-api-client.ts +119 -0
- package/packages/shopify-app-remix/src/server/__test-helpers/expect-begin-auth-redirect.ts +22 -0
- package/packages/shopify-app-remix/src/server/__test-helpers/expect-document-request-headers.ts +25 -0
- package/packages/shopify-app-remix/src/server/__test-helpers/expect-exit-iframe.ts +37 -0
- package/packages/shopify-app-remix/src/server/__test-helpers/expect-login-redirect.ts +8 -0
- package/packages/shopify-app-remix/src/server/__test-helpers/expect-storefront-api-client.ts +50 -0
- package/packages/shopify-app-remix/src/server/__test-helpers/get-hmac.ts +10 -0
- package/packages/shopify-app-remix/src/server/__test-helpers/get-jwt.ts +31 -0
- package/packages/shopify-app-remix/src/server/__test-helpers/get-thrown-response.ts +17 -0
- package/packages/shopify-app-remix/src/server/__test-helpers/index.ts +14 -0
- package/packages/shopify-app-remix/src/server/__test-helpers/request-mock.ts +169 -0
- package/packages/shopify-app-remix/src/server/__test-helpers/setup-valid-session.ts +45 -0
- package/packages/shopify-app-remix/src/server/__test-helpers/sign-request-cookie.ts +21 -0
- package/packages/shopify-app-remix/src/server/__test-helpers/test-config.ts +112 -0
- package/packages/shopify-app-remix/src/server/__tests__/override-logger.test.ts +101 -0
- package/packages/shopify-app-remix/src/server/__tests__/shopify-app.test.ts +119 -0
- package/packages/shopify-app-remix/src/server/adapters/__tests__/node-app-bridge-url.test.ts +18 -0
- package/packages/shopify-app-remix/src/server/adapters/__tests__/node.test.ts +28 -0
- package/packages/shopify-app-remix/src/server/adapters/node/__tests__/setup-jest.ts +10 -0
- package/packages/shopify-app-remix/src/server/adapters/node/index.ts +20 -0
- package/packages/shopify-app-remix/src/server/adapters/vercel/__tests__/setup-jest.ts +12 -0
- package/packages/shopify-app-remix/src/server/adapters/vercel/index.ts +13 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/__tests__/admin-client.test.ts +181 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/__tests__/doc-request-path.test.ts +151 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/__tests__/exit-i-frame-path.test.ts +99 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/__tests__/patch-session-token-path.test.ts +58 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/__tests__/reject-bot.test.ts +23 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/__tests__/respond-to-options.test.ts +50 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/__tests__/session-token-header-path.test.ts +91 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/authenticate.admin.doc.ts +37 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/authenticate.ts +201 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/billing/__tests__/cancel.test.ts +258 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/billing/__tests__/check.test.ts +254 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/billing/__tests__/mock-responses.ts +65 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/billing/__tests__/request.test.ts +373 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/billing/__tests__/require.test.ts +316 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/billing/authenticate.admin.billing.doc.ts +28 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/billing/cancel.ts +37 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/billing/check.ts +38 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/billing/index.ts +4 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/billing/request.ts +101 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/billing/require.ts +56 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/billing/types.ts +383 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/helpers/__tests__/redirect.test.ts +313 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/helpers/__tests__/validate-redirect-url.test.ts +84 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/helpers/begin-auth.ts +17 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/helpers/create-admin-api-context.ts +22 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/helpers/ensure-app-is-embedded-if-required.ts +18 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/helpers/ensure-session-token-search-param-if-required.ts +25 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/helpers/handle-client-error.ts +43 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/helpers/index.ts +14 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/helpers/redirect-to-auth-page.ts +28 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/helpers/redirect-to-bounce-page.ts +23 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/helpers/redirect-to-shopify-or-app-root.ts +21 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/helpers/redirect-with-app-bridge-headers.ts +13 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/helpers/redirect-with-exitiframe.ts +28 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/helpers/redirect.ts +83 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/helpers/render-app-bridge.ts +46 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/helpers/trigger-after-auth-hook.ts +28 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/helpers/validate-redirect-url.ts +67 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/helpers/validate-shop-and-host-params.ts +28 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/strategies/__tests__/auth-code-flow/admin-client.test.ts +222 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/strategies/__tests__/auth-code-flow/auth-callback-path.test.ts +395 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/strategies/__tests__/auth-code-flow/auth-path.test.ts +83 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/strategies/__tests__/auth-code-flow/authenticate.test.ts +183 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/strategies/__tests__/auth-code-flow/ensure-installed-on-shop.test.ts +234 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/strategies/__tests__/auth-code-flow/session-token-header-path.test.ts +79 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/strategies/__tests__/token-exchange/admin-client.test.ts +189 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/strategies/__tests__/token-exchange/authenticate.test.ts +310 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/strategies/auth-code-flow.ts +333 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/strategies/token-exchange.ts +169 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/strategies/types.ts +29 -0
- package/packages/shopify-app-remix/src/server/authenticate/admin/types.ts +199 -0
- package/packages/shopify-app-remix/src/server/authenticate/const.ts +15 -0
- package/packages/shopify-app-remix/src/server/authenticate/flow/__tests__/authenticate.test.ts +142 -0
- package/packages/shopify-app-remix/src/server/authenticate/flow/authenticate.flow.doc.ts +34 -0
- package/packages/shopify-app-remix/src/server/authenticate/flow/authenticate.ts +71 -0
- package/packages/shopify-app-remix/src/server/authenticate/flow/types.ts +90 -0
- package/packages/shopify-app-remix/src/server/authenticate/helpers/__tests__/add-response-headers.test.ts +25 -0
- package/packages/shopify-app-remix/src/server/authenticate/helpers/__tests__/app-bridge-url.test.ts +21 -0
- package/packages/shopify-app-remix/src/server/authenticate/helpers/__tests__/idempotent-promise-handler.test.ts +104 -0
- package/packages/shopify-app-remix/src/server/authenticate/helpers/add-response-headers.ts +43 -0
- package/packages/shopify-app-remix/src/server/authenticate/helpers/app-bridge-url.ts +10 -0
- package/packages/shopify-app-remix/src/server/authenticate/helpers/ensure-cors-headers.ts +38 -0
- package/packages/shopify-app-remix/src/server/authenticate/helpers/get-session-token-header.ts +11 -0
- package/packages/shopify-app-remix/src/server/authenticate/helpers/idempotent-promise-handler.ts +45 -0
- package/packages/shopify-app-remix/src/server/authenticate/helpers/index.ts +8 -0
- package/packages/shopify-app-remix/src/server/authenticate/helpers/reject-bot-request.ts +13 -0
- package/packages/shopify-app-remix/src/server/authenticate/helpers/respond-to-invalid-session-token.ts +29 -0
- package/packages/shopify-app-remix/src/server/authenticate/helpers/respond-to-options-request.ts +26 -0
- package/packages/shopify-app-remix/src/server/authenticate/helpers/validate-session-token.ts +32 -0
- package/packages/shopify-app-remix/src/server/authenticate/login/__tests__/login.test.ts +157 -0
- package/packages/shopify-app-remix/src/server/authenticate/login/login.ts +53 -0
- package/packages/shopify-app-remix/src/server/authenticate/public/__tests__/factory.test.ts +224 -0
- package/packages/shopify-app-remix/src/server/authenticate/public/appProxy/__tests__/authenticate.test.ts +282 -0
- package/packages/shopify-app-remix/src/server/authenticate/public/appProxy/authenticate.public.app-proxy.doc.ts +36 -0
- package/packages/shopify-app-remix/src/server/authenticate/public/appProxy/authenticate.ts +90 -0
- package/packages/shopify-app-remix/src/server/authenticate/public/appProxy/types.ts +164 -0
- package/packages/shopify-app-remix/src/server/authenticate/public/checkout/__tests__/authenticate.test.ts +142 -0
- package/packages/shopify-app-remix/src/server/authenticate/public/checkout/authenticate.public.checkout.doc.ts +23 -0
- package/packages/shopify-app-remix/src/server/authenticate/public/checkout/authenticate.ts +45 -0
- package/packages/shopify-app-remix/src/server/authenticate/public/checkout/types.ts +65 -0
- package/packages/shopify-app-remix/src/server/authenticate/public/factory.ts +49 -0
- package/packages/shopify-app-remix/src/server/authenticate/public/index.ts +1 -0
- package/packages/shopify-app-remix/src/server/authenticate/public/types.ts +77 -0
- package/packages/shopify-app-remix/src/server/authenticate/webhooks/__tests__/authenticate.test.ts +207 -0
- package/packages/shopify-app-remix/src/server/authenticate/webhooks/__tests__/mock-responses.ts +45 -0
- package/packages/shopify-app-remix/src/server/authenticate/webhooks/__tests__/register.test.ts +210 -0
- package/packages/shopify-app-remix/src/server/authenticate/webhooks/authenticate.ts +113 -0
- package/packages/shopify-app-remix/src/server/authenticate/webhooks/authenticate.webhooks.doc.ts +28 -0
- package/packages/shopify-app-remix/src/server/authenticate/webhooks/index.ts +1 -0
- package/packages/shopify-app-remix/src/server/authenticate/webhooks/register.ts +48 -0
- package/packages/shopify-app-remix/src/server/authenticate/webhooks/types.ts +246 -0
- package/packages/shopify-app-remix/src/server/boundary/__tests__/error.test.tsx +36 -0
- package/packages/shopify-app-remix/src/server/boundary/__tests__/headers.test.ts +66 -0
- package/packages/shopify-app-remix/src/server/boundary/error.tsx +14 -0
- package/packages/shopify-app-remix/src/server/boundary/headers.ts +15 -0
- package/packages/shopify-app-remix/src/server/boundary/index.ts +39 -0
- package/packages/shopify-app-remix/src/server/boundary/types.ts +4 -0
- package/packages/shopify-app-remix/src/server/clients/admin/authenticate.admin.api.doc.ts +34 -0
- package/packages/shopify-app-remix/src/server/clients/admin/factory.ts +30 -0
- package/packages/shopify-app-remix/src/server/clients/admin/graphql.ts +39 -0
- package/packages/shopify-app-remix/src/server/clients/admin/index.ts +2 -0
- package/packages/shopify-app-remix/src/server/clients/admin/rest.ts +157 -0
- package/packages/shopify-app-remix/src/server/clients/admin/types.ts +178 -0
- package/packages/shopify-app-remix/src/server/clients/index.ts +2 -0
- package/packages/shopify-app-remix/src/server/clients/storefront/authenticate.storefront.api.doc.ts +34 -0
- package/packages/shopify-app-remix/src/server/clients/storefront/factory.ts +32 -0
- package/packages/shopify-app-remix/src/server/clients/storefront/index.ts +2 -0
- package/packages/shopify-app-remix/src/server/clients/storefront/types.ts +31 -0
- package/packages/shopify-app-remix/src/server/clients/types.ts +27 -0
- package/packages/shopify-app-remix/src/server/config-types.ts +293 -0
- package/packages/shopify-app-remix/src/server/errors.ts +3 -0
- package/packages/shopify-app-remix/src/server/future/flags.ts +57 -0
- package/packages/shopify-app-remix/src/server/index.ts +20 -0
- package/packages/shopify-app-remix/src/server/override-logger.ts +42 -0
- package/packages/shopify-app-remix/src/server/shopify-app.doc.ts +45 -0
- package/packages/shopify-app-remix/src/server/shopify-app.ts +198 -0
- package/packages/shopify-app-remix/src/server/types.ts +509 -0
- package/packages/shopify-app-remix/src/server/unauthenticated/admin/__tests__/factory.test.ts +30 -0
- package/packages/shopify-app-remix/src/server/unauthenticated/admin/factory.ts +29 -0
- package/packages/shopify-app-remix/src/server/unauthenticated/admin/index.ts +1 -0
- package/packages/shopify-app-remix/src/server/unauthenticated/admin/types.ts +117 -0
- package/packages/shopify-app-remix/src/server/unauthenticated/admin/unauthenticated.admin.doc.ts +40 -0
- package/packages/shopify-app-remix/src/server/unauthenticated/helpers/get-offline-session.ts +13 -0
- package/packages/shopify-app-remix/src/server/unauthenticated/helpers/index.ts +1 -0
- package/packages/shopify-app-remix/src/server/unauthenticated/storefront/__tests__/factory.test.ts +30 -0
- package/packages/shopify-app-remix/src/server/unauthenticated/storefront/factory.ts +28 -0
- package/packages/shopify-app-remix/src/server/unauthenticated/storefront/index.ts +1 -0
- package/packages/shopify-app-remix/src/server/unauthenticated/storefront/types.ts +39 -0
- package/packages/shopify-app-remix/src/server/unauthenticated/storefront/unauthenticated.storefront.doc.ts +40 -0
- package/packages/shopify-app-remix/src/server/unauthenticated/types.ts +68 -0
- package/packages/shopify-app-remix/src/server/version.ts +1 -0
- package/packages/shopify-app-remix/tsconfig.json +11 -0
- package/packages/shopify-app-session-storage/CHANGELOG.md +149 -0
- package/packages/shopify-app-session-storage/LICENSE.md +9 -0
- package/packages/shopify-app-session-storage/README.md +5 -0
- package/packages/shopify-app-session-storage/implementing-session-storage.md +214 -0
- package/packages/shopify-app-session-storage/loom.config.ts +45 -0
- package/packages/shopify-app-session-storage/package.json +44 -0
- package/packages/shopify-app-session-storage/src/__tests__/setup-jest.ts +8 -0
- package/packages/shopify-app-session-storage/src/abstract-migration-engine.ts +53 -0
- package/packages/shopify-app-session-storage/src/index.ts +3 -0
- package/packages/shopify-app-session-storage/src/rdbms-session-storage-migrator.ts +59 -0
- package/packages/shopify-app-session-storage/src/types.ts +174 -0
- package/packages/shopify-app-session-storage/tsconfig.json +10 -0
- package/packages/shopify-app-session-storage-dynamodb/CHANGELOG.md +150 -0
- package/packages/shopify-app-session-storage-dynamodb/LICENSE.md +9 -0
- package/packages/shopify-app-session-storage-dynamodb/README.md +75 -0
- package/packages/shopify-app-session-storage-dynamodb/loom.config.ts +27 -0
- package/packages/shopify-app-session-storage-dynamodb/package.json +51 -0
- package/packages/shopify-app-session-storage-dynamodb/src/__tests__/dynamodb.test.ts +93 -0
- package/packages/shopify-app-session-storage-dynamodb/src/__tests__/setup-jest.ts +8 -0
- package/packages/shopify-app-session-storage-dynamodb/src/dynamodb.ts +126 -0
- package/packages/shopify-app-session-storage-dynamodb/tsconfig.json +10 -0
- package/packages/shopify-app-session-storage-kv/CHANGELOG.md +204 -0
- package/packages/shopify-app-session-storage-kv/LICENSE.md +9 -0
- package/packages/shopify-app-session-storage-kv/README.md +41 -0
- package/packages/shopify-app-session-storage-kv/loom.config.ts +27 -0
- package/packages/shopify-app-session-storage-kv/package.json +52 -0
- package/packages/shopify-app-session-storage-kv/src/__tests__/kv-namespace-dummy-worker.ts +8 -0
- package/packages/shopify-app-session-storage-kv/src/__tests__/kv.test.ts +22 -0
- package/packages/shopify-app-session-storage-kv/src/__tests__/setup-jest.ts +8 -0
- package/packages/shopify-app-session-storage-kv/src/kv.ts +87 -0
- package/packages/shopify-app-session-storage-kv/tsconfig.json +11 -0
- package/packages/shopify-app-session-storage-memory/CHANGELOG.md +190 -0
- package/packages/shopify-app-session-storage-memory/LICENSE.md +9 -0
- package/packages/shopify-app-session-storage-memory/README.md +19 -0
- package/packages/shopify-app-session-storage-memory/loom.config.ts +27 -0
- package/packages/shopify-app-session-storage-memory/package.json +46 -0
- package/packages/shopify-app-session-storage-memory/src/__tests__/memory.test.ts +12 -0
- package/packages/shopify-app-session-storage-memory/src/__tests__/setup-jest.ts +8 -0
- package/packages/shopify-app-session-storage-memory/src/memory.ts +34 -0
- package/packages/shopify-app-session-storage-memory/tsconfig.json +10 -0
- package/packages/shopify-app-session-storage-mongodb/CHANGELOG.md +208 -0
- package/packages/shopify-app-session-storage-mongodb/LICENSE.md +9 -0
- package/packages/shopify-app-session-storage-mongodb/README.md +30 -0
- package/packages/shopify-app-session-storage-mongodb/loom.config.ts +27 -0
- package/packages/shopify-app-session-storage-mongodb/package.json +49 -0
- package/packages/shopify-app-session-storage-mongodb/src/__tests__/mongodb.test.ts +54 -0
- package/packages/shopify-app-session-storage-mongodb/src/__tests__/setup-jest.ts +8 -0
- package/packages/shopify-app-session-storage-mongodb/src/mongodb.ts +120 -0
- package/packages/shopify-app-session-storage-mongodb/tsconfig.json +10 -0
- package/packages/shopify-app-session-storage-mysql/CHANGELOG.md +220 -0
- package/packages/shopify-app-session-storage-mysql/LICENSE.md +9 -0
- package/packages/shopify-app-session-storage-mysql/README.md +41 -0
- package/packages/shopify-app-session-storage-mysql/loom.config.ts +27 -0
- package/packages/shopify-app-session-storage-mysql/package.json +50 -0
- package/packages/shopify-app-session-storage-mysql/src/__tests__/mysql.test.ts +137 -0
- package/packages/shopify-app-session-storage-mysql/src/__tests__/setup-jest.ts +8 -0
- package/packages/shopify-app-session-storage-mysql/src/migrations.ts +18 -0
- package/packages/shopify-app-session-storage-mysql/src/mysql-connection.ts +108 -0
- package/packages/shopify-app-session-storage-mysql/src/mysql-migrator.ts +53 -0
- package/packages/shopify-app-session-storage-mysql/src/mysql.ts +178 -0
- package/packages/shopify-app-session-storage-mysql/tsconfig.json +10 -0
- package/packages/shopify-app-session-storage-postgresql/CHANGELOG.md +210 -0
- package/packages/shopify-app-session-storage-postgresql/LICENSE.md +9 -0
- package/packages/shopify-app-session-storage-postgresql/README.md +39 -0
- package/packages/shopify-app-session-storage-postgresql/loom.config.ts +27 -0
- package/packages/shopify-app-session-storage-postgresql/package.json +52 -0
- package/packages/shopify-app-session-storage-postgresql/src/__tests__/migrate-to-case-sensitivity.test.ts +344 -0
- package/packages/shopify-app-session-storage-postgresql/src/__tests__/postgresql.test.ts +136 -0
- package/packages/shopify-app-session-storage-postgresql/src/__tests__/setup-jest.ts +8 -0
- package/packages/shopify-app-session-storage-postgresql/src/migrations.ts +70 -0
- package/packages/shopify-app-session-storage-postgresql/src/postgres-connection.ts +94 -0
- package/packages/shopify-app-session-storage-postgresql/src/postgres-migrator.ts +27 -0
- package/packages/shopify-app-session-storage-postgresql/src/postgresql.ts +178 -0
- package/packages/shopify-app-session-storage-postgresql/tsconfig.json +10 -0
- package/packages/shopify-app-session-storage-prisma/CHANGELOG.md +148 -0
- package/packages/shopify-app-session-storage-prisma/LICENSE.md +9 -0
- package/packages/shopify-app-session-storage-prisma/README.md +68 -0
- package/packages/shopify-app-session-storage-prisma/loom.config.ts +27 -0
- package/packages/shopify-app-session-storage-prisma/package.json +51 -0
- package/packages/shopify-app-session-storage-prisma/prisma/migrations/20230425184828_init/migration.sql +11 -0
- package/packages/shopify-app-session-storage-prisma/prisma/migrations/20230906155758_mySession/migration.sql +11 -0
- package/packages/shopify-app-session-storage-prisma/prisma/migrations/migration_lock.toml +3 -0
- package/packages/shopify-app-session-storage-prisma/prisma/schema.prisma +30 -0
- package/packages/shopify-app-session-storage-prisma/src/__tests__/prisma.test.ts +66 -0
- package/packages/shopify-app-session-storage-prisma/src/__tests__/setup-jest.ts +8 -0
- package/packages/shopify-app-session-storage-prisma/src/prisma.ts +145 -0
- package/packages/shopify-app-session-storage-prisma/tsconfig.json +10 -0
- package/packages/shopify-app-session-storage-redis/CHANGELOG.md +200 -0
- package/packages/shopify-app-session-storage-redis/LICENSE.md +9 -0
- package/packages/shopify-app-session-storage-redis/README.md +38 -0
- package/packages/shopify-app-session-storage-redis/loom.config.ts +27 -0
- package/packages/shopify-app-session-storage-redis/package.json +50 -0
- package/packages/shopify-app-session-storage-redis/src/__tests__/migration-test-data.ts +46 -0
- package/packages/shopify-app-session-storage-redis/src/__tests__/redis.conf +2 -0
- package/packages/shopify-app-session-storage-redis/src/__tests__/redis.test.ts +236 -0
- package/packages/shopify-app-session-storage-redis/src/__tests__/setup-jest.ts +8 -0
- package/packages/shopify-app-session-storage-redis/src/migrations.ts +36 -0
- package/packages/shopify-app-session-storage-redis/src/redis-connection.ts +64 -0
- package/packages/shopify-app-session-storage-redis/src/redis-migrator.ts +58 -0
- package/packages/shopify-app-session-storage-redis/src/redis.ts +167 -0
- package/packages/shopify-app-session-storage-redis/tsconfig.json +10 -0
- package/packages/shopify-app-session-storage-sqlite/CHANGELOG.md +202 -0
- package/packages/shopify-app-session-storage-sqlite/LICENSE.md +9 -0
- package/packages/shopify-app-session-storage-sqlite/README.md +25 -0
- package/packages/shopify-app-session-storage-sqlite/loom.config.ts +27 -0
- package/packages/shopify-app-session-storage-sqlite/package.json +51 -0
- package/packages/shopify-app-session-storage-sqlite/src/__tests__/setup-jest.ts +8 -0
- package/packages/shopify-app-session-storage-sqlite/src/__tests__/sqlite.test.ts +44 -0
- package/packages/shopify-app-session-storage-sqlite/src/migrations.ts +54 -0
- package/packages/shopify-app-session-storage-sqlite/src/sqlite-connection.ts +80 -0
- package/packages/shopify-app-session-storage-sqlite/src/sqlite-migrator.ts +34 -0
- package/packages/shopify-app-session-storage-sqlite/src/sqlite.ts +147 -0
- package/packages/shopify-app-session-storage-sqlite/tsconfig.json +10 -0
- package/packages/shopify-app-session-storage-test-utils/CHANGELOG.md +185 -0
- package/packages/shopify-app-session-storage-test-utils/LICENSE.md +9 -0
- package/packages/shopify-app-session-storage-test-utils/loom.config.ts +27 -0
- package/packages/shopify-app-session-storage-test-utils/package.json +48 -0
- package/packages/shopify-app-session-storage-test-utils/src/__tests__/session-test-utils.test.ts +273 -0
- package/packages/shopify-app-session-storage-test-utils/src/battery-of-tests.ts +250 -0
- package/packages/shopify-app-session-storage-test-utils/src/index.ts +2 -0
- package/packages/shopify-app-session-storage-test-utils/src/session-test-utils.ts +24 -0
- package/packages/shopify-app-session-storage-test-utils/src/utils.ts +71 -0
- package/packages/shopify-app-session-storage-test-utils/tsconfig.json +10 -0
- package/tests/setup/build.js +1 -0
- package/tests/setup/setup-jest.ts +8 -0
- package/tsconfig.base.json +41 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import {Session, ShopifyRestResources} from '@shopify/shopify-api';
|
|
2
|
+
import {AdminOperations} from '@shopify/admin-api-client';
|
|
3
|
+
|
|
4
|
+
import {BasicParams} from '../../types';
|
|
5
|
+
import {GraphQLClient} from '../types';
|
|
6
|
+
|
|
7
|
+
import type {RestClientWithResources} from './rest';
|
|
8
|
+
|
|
9
|
+
export interface AdminClientOptions {
|
|
10
|
+
params: BasicParams;
|
|
11
|
+
session: Session;
|
|
12
|
+
handleClientError?: HandleAdminClientError;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type HandleAdminClientError = (arg: {
|
|
16
|
+
error: any;
|
|
17
|
+
params: BasicParams;
|
|
18
|
+
session: Session;
|
|
19
|
+
}) => Promise<void>;
|
|
20
|
+
|
|
21
|
+
export interface AdminApiContext<
|
|
22
|
+
Resources extends ShopifyRestResources = ShopifyRestResources,
|
|
23
|
+
> {
|
|
24
|
+
/**
|
|
25
|
+
* Methods for interacting with the Shopify Admin REST API
|
|
26
|
+
*
|
|
27
|
+
* 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.
|
|
28
|
+
*
|
|
29
|
+
* {@link https://shopify.dev/docs/api/admin-rest}
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* <caption>Using REST resources.</caption>
|
|
33
|
+
* <description>Getting the number of orders in a store using REST resources. Visit the [Admin REST API references](/docs/api/admin-rest) for examples on using each resource. </description>
|
|
34
|
+
*
|
|
35
|
+
* ```ts
|
|
36
|
+
* // /app/routes/**\/*.ts
|
|
37
|
+
* import { LoaderFunctionArgs, json } from "@remix-run/node";
|
|
38
|
+
* import { authenticate } from "../shopify.server";
|
|
39
|
+
*
|
|
40
|
+
* export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|
41
|
+
* const { admin, session } = await authenticate.admin(request);
|
|
42
|
+
* return json(admin.rest.resources.Order.count({ session }));
|
|
43
|
+
* };
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
*
|
|
47
|
+
* ```ts
|
|
48
|
+
* // /app/shopify.server.ts
|
|
49
|
+
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
50
|
+
* import { restResources } from "@shopify/shopify-api/rest/admin/2023-07";
|
|
51
|
+
*
|
|
52
|
+
* const shopify = shopifyApp({
|
|
53
|
+
* restResources,
|
|
54
|
+
* // ...etc
|
|
55
|
+
* });
|
|
56
|
+
* export default shopify;
|
|
57
|
+
* export const authenticate = shopify.authenticate;
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* <caption>Performing a GET request to the REST API.</caption>
|
|
63
|
+
* <description>Use `admin.rest.get` to make custom requests to make a request to to the `customer/count` endpoint</description>
|
|
64
|
+
*
|
|
65
|
+
* ```ts
|
|
66
|
+
* // /app/routes/**\/*.ts
|
|
67
|
+
* import { LoaderFunctionArgs, json } from "@remix-run/node";
|
|
68
|
+
* import { authenticate } from "../shopify.server";
|
|
69
|
+
*
|
|
70
|
+
* export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|
71
|
+
* const { admin, session } = await authenticate.admin(request);
|
|
72
|
+
* const response = await admin.rest.get({ path: "/customers/count.json" });
|
|
73
|
+
* const customers = await response.json();
|
|
74
|
+
* return json({ customers });
|
|
75
|
+
* };
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* ```ts
|
|
79
|
+
* // /app/shopify.server.ts
|
|
80
|
+
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
81
|
+
* import { restResources } from "@shopify/shopify-api/rest/admin/2023-04";
|
|
82
|
+
*
|
|
83
|
+
* const shopify = shopifyApp({
|
|
84
|
+
* restResources,
|
|
85
|
+
* // ...etc
|
|
86
|
+
* });
|
|
87
|
+
* export default shopify;
|
|
88
|
+
* export const authenticate = shopify.authenticate;
|
|
89
|
+
* ```
|
|
90
|
+
* @example
|
|
91
|
+
* <caption>Performing a POST request to the REST API.</caption>
|
|
92
|
+
* <description>Use `admin.rest.post` to make custom requests to make a request to to the `customers.json` endpoint to send a welcome email</description>
|
|
93
|
+
* ```ts
|
|
94
|
+
* // /app/routes/**\/*.ts
|
|
95
|
+
* import { LoaderFunctionArgs, json } from "@remix-run/node";
|
|
96
|
+
* import { authenticate } from "../shopify.server";
|
|
97
|
+
*
|
|
98
|
+
* export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|
99
|
+
* const { admin, session } = await authenticate.admin(request);
|
|
100
|
+
* const response = admin.rest.post({
|
|
101
|
+
* path: "customers/7392136888625/send_invite.json",
|
|
102
|
+
* body: {
|
|
103
|
+
* customer_invite: {
|
|
104
|
+
* to: "new_test_email@shopify.com",
|
|
105
|
+
* from: "j.limited@example.com",
|
|
106
|
+
* bcc: ["j.limited@example.com"],
|
|
107
|
+
* subject: "Welcome to my new shop",
|
|
108
|
+
* custom_message: "My awesome new store",
|
|
109
|
+
* },
|
|
110
|
+
* },
|
|
111
|
+
* });
|
|
112
|
+
* const customerInvite = await response.json();
|
|
113
|
+
* return json({ customerInvite });
|
|
114
|
+
* };
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* ```ts
|
|
118
|
+
* // /app/shopify.server.ts
|
|
119
|
+
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
120
|
+
* import { restResources } from "@shopify/shopify-api/rest/admin/2023-04";
|
|
121
|
+
*
|
|
122
|
+
* const shopify = shopifyApp({
|
|
123
|
+
* restResources,
|
|
124
|
+
* // ...etc
|
|
125
|
+
* });
|
|
126
|
+
* export default shopify;
|
|
127
|
+
* export const authenticate = shopify.authenticate;
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
rest: RestClientWithResources<Resources>;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Methods for interacting with the Shopify Admin GraphQL API
|
|
134
|
+
*
|
|
135
|
+
* {@link https://shopify.dev/docs/api/admin-graphql}
|
|
136
|
+
* {@link https://github.com/Shopify/shopify-api-js/blob/main/packages/shopify-api/docs/reference/clients/Graphql.md}
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* <caption>Querying the GraphQL API.</caption>
|
|
140
|
+
* <description>Use `admin.graphql` to make query / mutation requests.</description>
|
|
141
|
+
* ```ts
|
|
142
|
+
* import { ActionFunctionArgs } from "@remix-run/node";
|
|
143
|
+
* import { authenticate } from "../shopify.server";
|
|
144
|
+
*
|
|
145
|
+
* export async function action({ request }: ActionFunctionArgs) {
|
|
146
|
+
* const { admin } = await authenticate.admin(request);
|
|
147
|
+
*
|
|
148
|
+
* const response = await admin.graphql(
|
|
149
|
+
* `#graphql
|
|
150
|
+
* mutation populateProduct($input: ProductInput!) {
|
|
151
|
+
* productCreate(input: $input) {
|
|
152
|
+
* product {
|
|
153
|
+
* id
|
|
154
|
+
* }
|
|
155
|
+
* }
|
|
156
|
+
* }`,
|
|
157
|
+
* { variables: { input: { title: "Product Name" } } }
|
|
158
|
+
* );
|
|
159
|
+
*
|
|
160
|
+
* const productData = await response.json();
|
|
161
|
+
* return json({ data: productData.data });
|
|
162
|
+
* }
|
|
163
|
+
* ```
|
|
164
|
+
*
|
|
165
|
+
* ```ts
|
|
166
|
+
* // /app/shopify.server.ts
|
|
167
|
+
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
168
|
+
*
|
|
169
|
+
* const shopify = shopifyApp({
|
|
170
|
+
* restResources,
|
|
171
|
+
* // ...etc
|
|
172
|
+
* });
|
|
173
|
+
* export default shopify;
|
|
174
|
+
* export const unauthenticated = shopify.unauthenticated;
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
graphql: GraphQLClient<AdminOperations>;
|
|
178
|
+
}
|
package/packages/shopify-app-remix/src/server/clients/storefront/authenticate.storefront.api.doc.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs';
|
|
2
|
+
|
|
3
|
+
const data: ReferenceEntityTemplateSchema = {
|
|
4
|
+
name: 'Storefront API',
|
|
5
|
+
description:
|
|
6
|
+
'Contains objects used to interact with the Storefront API.' +
|
|
7
|
+
'\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).',
|
|
8
|
+
category: 'APIs',
|
|
9
|
+
type: 'object',
|
|
10
|
+
isVisualComponent: false,
|
|
11
|
+
definitions: [
|
|
12
|
+
{
|
|
13
|
+
title: 'storefront',
|
|
14
|
+
description:
|
|
15
|
+
'Provides utilities that apps can use to make requests to the Storefront API.',
|
|
16
|
+
type: 'StorefrontContext',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
jsDocTypeExamples: ['StorefrontContext'],
|
|
20
|
+
related: [
|
|
21
|
+
{
|
|
22
|
+
name: 'App proxy context',
|
|
23
|
+
subtitle: 'Authenticate requests from Shopify app proxies.',
|
|
24
|
+
url: '/docs/api/shopify-app-remix/authenticate/public/app-proxy',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'Unauthenticated context',
|
|
28
|
+
subtitle: 'Interact with the Storefront API on non-Shopify requests.',
|
|
29
|
+
url: '/docs/api/shopify-app-remix/unauthenticated/unauthenticated-storefront',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default data;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {Session} from '@shopify/shopify-api';
|
|
2
|
+
|
|
3
|
+
import {BasicParams} from '../../types';
|
|
4
|
+
|
|
5
|
+
import type {StorefrontContext} from '.';
|
|
6
|
+
|
|
7
|
+
export function storefrontClientFactory({
|
|
8
|
+
params,
|
|
9
|
+
session,
|
|
10
|
+
}: {
|
|
11
|
+
params: BasicParams;
|
|
12
|
+
session: Session;
|
|
13
|
+
}): StorefrontContext {
|
|
14
|
+
const {api} = params;
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
graphql: async (query, options = {}) => {
|
|
18
|
+
const client = new api.clients.Storefront({
|
|
19
|
+
session,
|
|
20
|
+
apiVersion: options.apiVersion,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const apiResponse = await client.request(query, {
|
|
24
|
+
variables: options?.variables,
|
|
25
|
+
retries: options?.tries ? options.tries - 1 : 0,
|
|
26
|
+
headers: options?.headers,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return new Response(JSON.stringify(apiResponse));
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {StorefrontOperations} from '@shopify/storefront-api-client';
|
|
2
|
+
|
|
3
|
+
import {GraphQLClient} from '../types';
|
|
4
|
+
|
|
5
|
+
export interface StorefrontContext {
|
|
6
|
+
/**
|
|
7
|
+
* Method for interacting with the Shopify Storefront GraphQL API
|
|
8
|
+
*
|
|
9
|
+
* If you're getting incorrect type hints in the Shopify template, follow [these instructions](https://github.com/Shopify/shopify-app-template-remix/tree/main#incorrect-graphql-hints).
|
|
10
|
+
*
|
|
11
|
+
* {@link https://shopify.dev/docs/api/storefront}
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <caption>Querying the GraphQL API.</caption>
|
|
15
|
+
* <description>Use `storefront.graphql` to make query / mutation requests.</description>
|
|
16
|
+
* ```ts
|
|
17
|
+
* // app/routes/**\/.ts
|
|
18
|
+
* import { json } from "@remix-run/node";
|
|
19
|
+
* import { authenticate } from "../shopify.server";
|
|
20
|
+
*
|
|
21
|
+
* export async function action({ request }: ActionFunctionArgs) {
|
|
22
|
+
* const { storefront } = await authenticate.public.appProxy(request);
|
|
23
|
+
*
|
|
24
|
+
* const response = await storefront.graphql(`{blogs(first: 10) { edges { node { id } } } }`);
|
|
25
|
+
*
|
|
26
|
+
* return json(await response.json());
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
graphql: GraphQLClient<StorefrontOperations>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AllOperations,
|
|
3
|
+
ReturnData,
|
|
4
|
+
FetchResponseBody,
|
|
5
|
+
ApiClientRequestOptions,
|
|
6
|
+
ResponseWithType,
|
|
7
|
+
} from '@shopify/admin-api-client';
|
|
8
|
+
import {ApiVersion} from '@shopify/shopify-api';
|
|
9
|
+
|
|
10
|
+
export interface GraphQLQueryOptions<
|
|
11
|
+
Operation extends keyof Operations,
|
|
12
|
+
Operations extends AllOperations,
|
|
13
|
+
> {
|
|
14
|
+
variables?: ApiClientRequestOptions<Operation, Operations>['variables'];
|
|
15
|
+
apiVersion?: ApiVersion;
|
|
16
|
+
headers?: Record<string, any>;
|
|
17
|
+
tries?: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type GraphQLClient<Operations extends AllOperations> = <
|
|
21
|
+
Operation extends keyof Operations,
|
|
22
|
+
>(
|
|
23
|
+
query: Operation,
|
|
24
|
+
options?: GraphQLQueryOptions<Operation, Operations>,
|
|
25
|
+
) => Promise<
|
|
26
|
+
ResponseWithType<FetchResponseBody<ReturnData<Operation, Operations>>>
|
|
27
|
+
>;
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConfigParams as ApiConfigArg,
|
|
3
|
+
ConfigInterface as ApiConfig,
|
|
4
|
+
ShopifyRestResources,
|
|
5
|
+
Session,
|
|
6
|
+
ApiVersion,
|
|
7
|
+
WebhookHandler,
|
|
8
|
+
} from '@shopify/shopify-api';
|
|
9
|
+
import {SessionStorage} from '@shopify/shopify-app-session-storage';
|
|
10
|
+
|
|
11
|
+
import type {
|
|
12
|
+
ApiFutureFlags,
|
|
13
|
+
FutureFlagOptions,
|
|
14
|
+
FutureFlags,
|
|
15
|
+
} from './future/flags';
|
|
16
|
+
import type {AppDistribution} from './types';
|
|
17
|
+
import type {AdminApiContext} from './clients';
|
|
18
|
+
import {IdempotentPromiseHandler} from './authenticate/helpers/idempotent-promise-handler';
|
|
19
|
+
|
|
20
|
+
export interface AppConfigArg<
|
|
21
|
+
Resources extends ShopifyRestResources = ShopifyRestResources,
|
|
22
|
+
Storage extends SessionStorage = SessionStorage,
|
|
23
|
+
Future extends FutureFlagOptions = FutureFlagOptions,
|
|
24
|
+
> extends Omit<
|
|
25
|
+
ApiConfigArg<Resources, ApiFutureFlags<Future>>,
|
|
26
|
+
| 'hostName'
|
|
27
|
+
| 'hostScheme'
|
|
28
|
+
| 'isEmbeddedApp'
|
|
29
|
+
| 'apiVersion'
|
|
30
|
+
| 'isCustomStoreApp'
|
|
31
|
+
| 'future'
|
|
32
|
+
> {
|
|
33
|
+
/**
|
|
34
|
+
* The URL your app is running on.
|
|
35
|
+
*
|
|
36
|
+
* The `@shopify/cli` provides this URL as `process.env.SHOPIFY_APP_URL`. For development this is probably a tunnel URL that points to your local machine. If this is a production app, this is your production URL.
|
|
37
|
+
*/
|
|
38
|
+
appUrl: string;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* An adaptor for storing sessions in your database of choice.
|
|
42
|
+
*
|
|
43
|
+
* Shopify provides multiple session storage adaptors and you can create your own.
|
|
44
|
+
*
|
|
45
|
+
* {@link https://github.com/Shopify/shopify-app-js/blob/main/README.md#session-storage-options}
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* <caption>Storing sessions with Prisma.</caption>
|
|
49
|
+
* <description>Add the `@shopify/shopify-app-session-storage-prisma` package to use the Prisma session storage.</description>
|
|
50
|
+
* ```ts
|
|
51
|
+
* import { shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
52
|
+
* import { PrismaSessionStorage } from "@shopify/shopify-app-session-storage-prisma";
|
|
53
|
+
*
|
|
54
|
+
* import prisma from "~/db.server";
|
|
55
|
+
*
|
|
56
|
+
* const shopify = shopifyApp({
|
|
57
|
+
* // ... etc
|
|
58
|
+
* sessionStorage: new PrismaSessionStorage(prisma),
|
|
59
|
+
* });
|
|
60
|
+
* export default shopify;
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
sessionStorage: Storage;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Whether your app use online or offline tokens.
|
|
67
|
+
*
|
|
68
|
+
* If your app uses online tokens, then both online and offline tokens will be saved to your database. This ensures your app can perform background jobs.
|
|
69
|
+
*
|
|
70
|
+
* {@link https://shopify.dev/docs/apps/auth/oauth/access-modes}
|
|
71
|
+
*
|
|
72
|
+
* @defaultValue `false`
|
|
73
|
+
*/
|
|
74
|
+
useOnlineTokens?: boolean;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The config for the webhook topics your app would like to subscribe to.
|
|
78
|
+
*
|
|
79
|
+
* {@link https://shopify.dev/docs/apps/webhooks}
|
|
80
|
+
*
|
|
81
|
+
* This can be in used in conjunction with the afterAuth hook to register webhook topics when a user installs your app. Or you can use this function in other processes such as background jobs.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* <caption>Registering for a webhook when a merchant uninstalls your app.</caption>
|
|
85
|
+
* ```ts
|
|
86
|
+
* // /app/shopify.server.ts
|
|
87
|
+
* import { DeliveryMethod, shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
88
|
+
*
|
|
89
|
+
* const shopify = shopifyApp({
|
|
90
|
+
* webhooks: {
|
|
91
|
+
* APP_UNINSTALLED: {
|
|
92
|
+
* deliveryMethod: DeliveryMethod.Http,
|
|
93
|
+
* callbackUrl: "/webhooks",
|
|
94
|
+
* },
|
|
95
|
+
* },
|
|
96
|
+
* hooks: {
|
|
97
|
+
* afterAuth: async ({ session }) => {
|
|
98
|
+
* shopify.registerWebhooks({ session });
|
|
99
|
+
* }
|
|
100
|
+
* },
|
|
101
|
+
* // ...etc
|
|
102
|
+
* });
|
|
103
|
+
* export default shopify;
|
|
104
|
+
* export const authenticate = shopify.authenticate;
|
|
105
|
+
*
|
|
106
|
+
* // /app/routes/webhooks.jsx
|
|
107
|
+
* import { ActionFunctionArgs } from "@remix-run/node";
|
|
108
|
+
*
|
|
109
|
+
* import { authenticate } from "../shopify.server";
|
|
110
|
+
* import db from "../db.server";
|
|
111
|
+
*
|
|
112
|
+
* export const action = async ({ request }: ActionFunctionArgs) => {
|
|
113
|
+
* const { topic, shop } = await authenticate.webhook(request);
|
|
114
|
+
*
|
|
115
|
+
* switch (topic) {
|
|
116
|
+
* case "APP_UNINSTALLED":
|
|
117
|
+
* await db.session.deleteMany({ where: { shop } });
|
|
118
|
+
* break;
|
|
119
|
+
* case "CUSTOMERS_DATA_REQUEST":
|
|
120
|
+
* case "CUSTOMERS_REDACT":
|
|
121
|
+
* case "SHOP_REDACT":
|
|
122
|
+
* default:
|
|
123
|
+
* throw new Response("Unhandled webhook topic", { status: 404 });
|
|
124
|
+
* }
|
|
125
|
+
* throw new Response();
|
|
126
|
+
* };
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
webhooks?: WebhookConfig;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Functions to call at key places during your apps lifecycle.
|
|
133
|
+
*
|
|
134
|
+
* These functions are called in the context of the request that triggered them. This means you can access the session.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* <caption>Seeding your database custom data when a merchant installs your app.</caption>
|
|
138
|
+
* ```ts
|
|
139
|
+
* import { DeliveryMethod, shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
140
|
+
* import { seedStoreData } from "~/db/seeds"
|
|
141
|
+
*
|
|
142
|
+
* const shopify = shopifyApp({
|
|
143
|
+
* hooks: {
|
|
144
|
+
* afterAuth: async ({ session }) => {
|
|
145
|
+
* seedStoreData({session})
|
|
146
|
+
* }
|
|
147
|
+
* },
|
|
148
|
+
* // ...etc
|
|
149
|
+
* });
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
hooks?: HooksConfig;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Does your app render embedded inside the Shopify Admin or on its own.
|
|
156
|
+
*
|
|
157
|
+
* Unless you have very specific needs, this should be true.
|
|
158
|
+
*
|
|
159
|
+
* @defaultValue `true`
|
|
160
|
+
*/
|
|
161
|
+
isEmbeddedApp?: boolean;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* How your app is distributed. Default is `AppDistribution.AppStore`.
|
|
165
|
+
*
|
|
166
|
+
* {@link https://shopify.dev/docs/apps/distribution}
|
|
167
|
+
*/
|
|
168
|
+
distribution?: AppDistribution;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* What version of Shopify's Admin API's would you like to use.
|
|
172
|
+
*
|
|
173
|
+
* {@link https://shopify.dev/docs/api/}
|
|
174
|
+
*
|
|
175
|
+
* @defaultValue `LATEST_API_VERSION` from `@shopify/shopify-app-remix`
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* <caption>Using the latest API Version (Recommended)</caption>
|
|
179
|
+
* ```ts
|
|
180
|
+
* import { LATEST_API_VERSION, shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
181
|
+
*
|
|
182
|
+
* const shopify = shopifyApp({
|
|
183
|
+
* // ...etc
|
|
184
|
+
* apiVersion: LATEST_API_VERSION,
|
|
185
|
+
* });
|
|
186
|
+
* ```
|
|
187
|
+
*/
|
|
188
|
+
apiVersion?: ApiVersion;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* A path that Shopify can reserve for auth related endpoints.
|
|
192
|
+
*
|
|
193
|
+
* This must match a $ route in your Remix app. That route must export a loader function that calls `shopify.authenticate.admin(request)`.
|
|
194
|
+
*
|
|
195
|
+
* @default `"/auth"`
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* <caption>Using the latest API Version (Recommended)</caption>
|
|
199
|
+
* ```ts
|
|
200
|
+
* // /app/shopify.server.ts
|
|
201
|
+
* import { LATEST_API_VERSION, shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
202
|
+
*
|
|
203
|
+
* const shopify = shopifyApp({
|
|
204
|
+
* // ...etc
|
|
205
|
+
* apiVersion: LATEST_API_VERSION,
|
|
206
|
+
* });
|
|
207
|
+
* export default shopify;
|
|
208
|
+
* export const authenticate = shopify.authenticate;
|
|
209
|
+
*
|
|
210
|
+
* // /app/routes/auth/$.jsx
|
|
211
|
+
* import { LoaderFunctionArgs } from "@remix-run/node";
|
|
212
|
+
* import { authenticate } from "../../shopify.server";
|
|
213
|
+
*
|
|
214
|
+
* export async function loader({ request }: LoaderFunctionArgs) {
|
|
215
|
+
* await authenticate.admin(request);
|
|
216
|
+
*
|
|
217
|
+
* return null
|
|
218
|
+
* }
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
authPathPrefix?: string;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Features that will be introduced in future releases of this package.
|
|
225
|
+
*
|
|
226
|
+
* You can opt in to these features by setting the corresponding flags. By doing so, you can prepare for future
|
|
227
|
+
* releases in advance and provide feedback on the new features.
|
|
228
|
+
*/
|
|
229
|
+
future?: Future;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface AppConfig<Storage extends SessionStorage = SessionStorage>
|
|
233
|
+
extends Omit<ApiConfig, 'future'> {
|
|
234
|
+
canUseLoginForm: boolean;
|
|
235
|
+
appUrl: string;
|
|
236
|
+
auth: AuthConfig;
|
|
237
|
+
sessionStorage: Storage;
|
|
238
|
+
useOnlineTokens: boolean;
|
|
239
|
+
hooks: HooksConfig;
|
|
240
|
+
future: FutureFlags;
|
|
241
|
+
idempotentPromiseHandler: IdempotentPromiseHandler;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export interface AuthConfig {
|
|
245
|
+
path: string;
|
|
246
|
+
callbackPath: string;
|
|
247
|
+
exitIframePath: string;
|
|
248
|
+
patchSessionTokenPath: string;
|
|
249
|
+
loginPath: string;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export type WebhookConfig = Record<string, WebhookHandler | WebhookHandler[]>;
|
|
253
|
+
|
|
254
|
+
interface HooksConfig {
|
|
255
|
+
/**
|
|
256
|
+
* A function to call after a merchant installs your app
|
|
257
|
+
*
|
|
258
|
+
* @param context - An object with context about the request that triggered the hook.
|
|
259
|
+
* @param context.session - The session of the merchant that installed your app. This is the output of sessionStorage.loadSession in case people want to load their own.
|
|
260
|
+
* @param context.admin - An object with access to the Shopify Admin API's.
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* <caption>Registering webhooks and seeding data when a merchant installs your app.</caption>
|
|
264
|
+
* ```ts
|
|
265
|
+
* import { DeliveryMethod, shopifyApp } from "@shopify/shopify-app-remix/server";
|
|
266
|
+
* import { seedStoreData } from "~/db/seeds"
|
|
267
|
+
*
|
|
268
|
+
* const shopify = shopifyApp({
|
|
269
|
+
* hooks: {
|
|
270
|
+
* afterAuth: async ({ session }) => {
|
|
271
|
+
* shopify.registerWebhooks({ session });
|
|
272
|
+
* seedStoreData({session})
|
|
273
|
+
* }
|
|
274
|
+
* },
|
|
275
|
+
* webhooks: {
|
|
276
|
+
* APP_UNINSTALLED: {
|
|
277
|
+
* deliveryMethod: DeliveryMethod.Http,
|
|
278
|
+
* callbackUrl: "/webhooks",
|
|
279
|
+
* },
|
|
280
|
+
* },
|
|
281
|
+
* // ...etc
|
|
282
|
+
* });
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
afterAuth?: (options: AfterAuthOptions) => void | Promise<void>;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export interface AfterAuthOptions<
|
|
289
|
+
R extends ShopifyRestResources = ShopifyRestResources,
|
|
290
|
+
> {
|
|
291
|
+
session: Session;
|
|
292
|
+
admin: AdminApiContext<R>;
|
|
293
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// When adding new flags, you should also add them to the `TEST_FUTURE_FLAGS` object in `test-config.ts` to ensure that
|
|
2
|
+
|
|
3
|
+
import type {ConfigParams, ShopifyRestResources} from '@shopify/shopify-api';
|
|
4
|
+
|
|
5
|
+
// it doesn't cause regressions.
|
|
6
|
+
export interface FutureFlags {
|
|
7
|
+
/**
|
|
8
|
+
* When enabled, returns the same `admin` context (`AdminApiContext`) from `authenticate.webhook` that is returned from `authenticate.admin`.
|
|
9
|
+
*
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
v3_webhookAdminContext?: boolean;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* When enabled authenticate.public() will not work. Use authenticate.public.checkout() instead.
|
|
16
|
+
*
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
v3_authenticatePublic?: boolean;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* When enabled allows you to pass billing plans with line items when creating a new app subscriptions.
|
|
23
|
+
*/
|
|
24
|
+
v3_lineItemBilling?: boolean;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* When enabled, embedded apps will fetch access tokens via [token exchange](https://shopify.dev/docs/apps/auth/get-access-tokens/token-exchange).
|
|
28
|
+
* This assumes the app has scopes declared for [Shopify managing installation](https://shopify.dev/docs/apps/auth/installation#shopify-managed-installation).
|
|
29
|
+
*
|
|
30
|
+
* Learn more about this [new embedded app auth strategy](https://shopify.dev/docs/api/shopify-app-remix#embedded-auth-strategy).
|
|
31
|
+
*
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
unstable_newEmbeddedAuthStrategy?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// When adding new flags, use this format:
|
|
38
|
+
// vX_myFutureFlag: Future extends FutureFlags ? Future['vX_myFutureFlag'] : false;
|
|
39
|
+
export interface ApiFutureFlags<Future extends FutureFlagOptions> {
|
|
40
|
+
v10_lineItemBilling: Future extends FutureFlags
|
|
41
|
+
? Future['v3_lineItemBilling']
|
|
42
|
+
: false;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type ApiConfigWithFutureFlags<Future extends FutureFlagOptions> =
|
|
46
|
+
ConfigParams<ShopifyRestResources, ApiFutureFlags<Future>>;
|
|
47
|
+
|
|
48
|
+
export type FutureFlagOptions = FutureFlags | undefined;
|
|
49
|
+
|
|
50
|
+
export type FeatureEnabled<
|
|
51
|
+
Future extends FutureFlagOptions,
|
|
52
|
+
Flag extends keyof FutureFlags,
|
|
53
|
+
> = Future extends FutureFlags
|
|
54
|
+
? Future[Flag] extends true
|
|
55
|
+
? true
|
|
56
|
+
: false
|
|
57
|
+
: false;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import '@shopify/shopify-api/adapters/web-api';
|
|
2
|
+
import {setAbstractRuntimeString} from '@shopify/shopify-api/runtime';
|
|
3
|
+
|
|
4
|
+
setAbstractRuntimeString(() => {
|
|
5
|
+
return `Remix`;
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
LATEST_API_VERSION,
|
|
10
|
+
LogSeverity,
|
|
11
|
+
DeliveryMethod,
|
|
12
|
+
BillingInterval,
|
|
13
|
+
ApiVersion,
|
|
14
|
+
} from '@shopify/shopify-api';
|
|
15
|
+
|
|
16
|
+
export type {ShopifyApp, LoginError} from './types';
|
|
17
|
+
export {LoginErrorType, AppDistribution} from './types';
|
|
18
|
+
export {boundary} from './boundary';
|
|
19
|
+
export {shopifyApp} from './shopify-app';
|
|
20
|
+
export * from './errors';
|