Skip to content

Add the Business Platform GraphQL data-access layer for store info#7756

Merged
amcaplan merged 1 commit into
mainfrom
ariel/store-graphql-layer
Jun 10, 2026
Merged

Add the Business Platform GraphQL data-access layer for store info#7756
amcaplan merged 1 commit into
mainfrom
ariel/store-graphql-layer

Conversation

@amcaplan

@amcaplan amcaplan commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

📚 Part of the store info stack — review/merge bottom-up:
#7753 gid codec → #7754 url helpers → #7755 shared --store flag → #7756 (this)#7660 store info

WHY are these changes introduced?

store info reads store metadata from two Business Platform schemas (Destinations + Organizations). This PR adds the typed GraphQL data-access layer for that — codegen wiring plus the queries and their generated types — separately from the service/command logic that consumes it (#7660). Splitting it keeps the feature PR focused on behavior, and lets the typed-client layer be reviewed on its own (these queries fetch exactly these fields).

Note: this can't be split any finer. graphql-codegen hard-fails when a configured project matches zero query documents, so the codegen config and the .graphql queries are an atomic unit; and the generated .ts must be committed alongside the queries or CI's codegen-check sees drift. So the whole layer travels together.

WHAT is this pull request doing?

  • graphql.config.ts — registers storeBusinessPlatformDestinations and storeBusinessPlatformOrganizations codegen projects.
  • packages/store/project.jsongraphql-codegen nx targets (generate → postfix → eslint-format), mirroring the other packages.
  • bin/get-graphql-schemas.js + .gitignore — fetch and ignore the store copies of the BP destinations/organizations schemas.
  • packages/store/package.json (+@graphql-typed-document-node/core) and the lockfile entry.
  • package.json — knip config for the store workspace: ignore the generated files and the @graphql-typed-document-node/core dep (only ever type-imported by generated code, so knip can't see it as used), matching the permanent blocks app/organizations/cli-kit already carry.
  • Three queries — store-info-destinations, store-info-owning-org (BP Destinations), store-info-shop (BP Organizations) — and their generated *.ts + types.d.ts.

Nothing imports the generated documents yet (the services land in #7660), so there's no user-facing surface and no changeset. The generated output is reproducible: nx graphql-codegen store regenerates it byte-for-byte; knip passes (the block above covers the not-yet-consumed artifacts).

How to test your changes?

  • bin/get-graphql-schemas.js to fetch schemas, then pnpm nx graphql-codegen store --skip-nx-cache — regenerates the committed generated/*.ts with zero diff.
  • pnpm nx run-many --target=type-check,build --projects=store — the generated layer compiles.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows) — codegen runs in CI; sed -i "" postfix matches the repo's existing macOS-oriented targets
  • I've considered possible documentation changes — no command surface yet
  • I've considered analytics changes to measure impact — none
  • The change is user-facing — N/A, no command consumes this yet; no changeset

@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label Jun 8, 2026
@amcaplan amcaplan force-pushed the ariel/store-graphql-layer branch from f60666b to f36a34f Compare June 8, 2026 16:03
@amcaplan amcaplan marked this pull request as ready for review June 8, 2026 18:51
@amcaplan amcaplan requested a review from a team as a code owner June 8, 2026 18:51
@amcaplan amcaplan force-pushed the ariel/store-graphql-layer branch from f36a34f to 73fbe9b Compare June 9, 2026 18:26
@amcaplan amcaplan force-pushed the ariel/store-flags branch from 505bb03 to caa73ce Compare June 9, 2026 18:26
Wire up GraphQL codegen for the store package's two Business Platform
schemas and add the typed queries the `store info` command needs:

- graphql.config.ts: register the storeBusinessPlatformDestinations and
  storeBusinessPlatformOrganizations codegen projects
- packages/store/project.json: graphql-codegen nx targets (generate →
  postfix → eslint-format)
- bin/get-graphql-schemas.js + .gitignore: fetch and ignore the store
  copies of the destinations/organizations schemas
- packages/store/package.json: @graphql-typed-document-node/core for the
  generated typed-document-node output
- package.json: knip config for the store workspace — ignore the generated
  files and the @graphql-typed-document-node/core dep (only type-imported by
  generated code), matching app/organizations/cli-kit
- queries (destinations, owning-org, shop) and their generated types

This is the typed client layer only; the services and command that
consume it land separately. No user-facing surface on its own.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@amcaplan amcaplan force-pushed the ariel/store-graphql-layer branch from 73fbe9b to 6b71f98 Compare June 9, 2026 20:19
@amcaplan amcaplan force-pushed the ariel/store-flags branch from caa73ce to a7adece Compare June 9, 2026 20:19
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

packages/cli-kit/dist/public/common/gid.d.ts
/**
 * Extracts the trailing numeric id from a plain GraphQL global id like
 * `gid://shopify/Product/123`.
 *
 * @param gid - A plain GraphQL global id string.
 * @returns The trailing numeric id, or undefined when the string does not end with `/<digits>`.
 */
export declare function numericIdFromGid(gid: string): string | undefined;
/**
 * Decodes a base64-encoded GraphQL global id (for example, the form
 * Business Platform APIs return) and returns the trailing numeric id.
 *
 * @param gid - A base64-encoded GraphQL global id.
 * @returns The trailing numeric id, or undefined when the decoded string does not end with `/<digits>`.
 */
export declare function numericIdFromEncodedGid(gid: string): string | undefined;
/**
 * Encodes a plain GraphQL global id (`gid://...`) as base64, which is the
 * form some Business Platform endpoints require.
 *
 * @param gid - A plain GraphQL global id string to encode.
 * @returns The base64-encoded gid.
 */
export declare function encodeGid(gid: string): string;

Existing type declarations

packages/cli-kit/dist/public/common/url.d.ts
@@ -12,4 +12,20 @@ export declare function isValidURL(url: string): boolean;
  * @param url - The string to parse into a URL.
  * @returns A URL object if the parsing is successful, undefined otherwise.
  */
-export declare function safeParseURL(url: string): URL | undefined;
\ No newline at end of file
+export declare function safeParseURL(url: string): URL | undefined;
+/**
+ * Extracts the lowercased hostname from a URL-shaped string. Tolerates
+ * bare hosts (without a scheme) and inputs that come back from APIs as
+ * either  or .
+ *
+ * @param value - A URL or bare host string, possibly null/undefined.
+ * @returns The lowercased hostname, or undefined when the input is empty.
+ */
+export declare function extractHost(value: string | null | undefined): string | undefined;
+/**
+ * Extracts the subdomain handle from a  URL or host.
+ *
+ * @param value - A URL or host string, possibly null/undefined.
+ * @returns The myshopify subdomain handle, or undefined when the input isn't a  URL.
+ */
+export declare function extractMyshopifyHandle(value: string | null | undefined): string | undefined;
\ No newline at end of file

Base automatically changed from ariel/store-flags to main June 10, 2026 12:52
@amcaplan amcaplan added this pull request to the merge queue Jun 10, 2026
Merged via the queue into main with commit 41a8392 Jun 10, 2026
26 of 51 checks passed
@amcaplan amcaplan deleted the ariel/store-graphql-layer branch June 10, 2026 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants