Skip to content

Extract @shopify/organizations package#7331

Open
amcaplan wants to merge 2 commits intomainfrom
ariel/extract-organizations-package
Open

Extract @shopify/organizations package#7331
amcaplan wants to merge 2 commits intomainfrom
ariel/extract-organizations-package

Conversation

@amcaplan
Copy link
Copy Markdown
Contributor

@amcaplan amcaplan commented Apr 16, 2026

Summary

  • Creates a new @shopify/organizations package with org listing and selection utilities
  • Calls the Business Platform Destinations API directly for organization fetching
  • Includes fetchOrganizations (with base64 GID decoding), selectOrganizationPrompt (auto-selects single org), and selectOrg helper
  • Sets up GraphQL codegen pipeline for the package
  • Wires as dependency of @shopify/store

Stack: PR 2 of 3 — depends on #7330, #7332 adds store create dev

Test plan

  • pnpm nx build organizations passes
  • pnpm nx type-check organizations passes
  • cd packages/organizations && pnpm vitest run — 10/10 tests pass
  • cd packages/store && pnpm vitest run — no regressions

🤖 Generated with Claude Code

@amcaplan amcaplan mentioned this pull request Apr 16, 2026
5 tasks
@amcaplan amcaplan force-pushed the ariel/extract-organizations-package branch 2 times, most recently from db9717d to c5cf362 Compare April 16, 2026 15:48
@amcaplan amcaplan force-pushed the ariel/extract-store-package branch from 7e01abd to acc94a4 Compare April 16, 2026 15:48
@amcaplan amcaplan force-pushed the ariel/extract-organizations-package branch 8 times, most recently from 603ab33 to 4ef8ece Compare April 16, 2026 21:12
@github-actions
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

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/private/node/session.d.ts
@@ -63,14 +63,14 @@ export interface OAuthSession {
 }
 type AuthMethod = 'partners_token' | 'device_auth' | 'theme_access_token' | 'custom_app_token' | 'none';
 /**
- * Retrieves a stable user identifier for analytics, or  if none applies.
+ * Retrieves the user ID from the current session or returns 'unknown' if not found.
  *
- * Evaluation order:
- * 1. If an app automation token or theme token is used, returns a deterministic UUID
- *    derived from that secret.
- * 2. Otherwise, if  was called (e.g. after OAuth), returns that value.
- * 3. Otherwise, if a persisted CLI session id is available, returns it.
- * 4. Otherwise returns .
+ * This function performs the following steps:
+ * 1. Checks for a cached user ID in memory (obtained in the current run).
+ * 2. Attempts to fetch it from the local storage (from a previous auth session).
+ * 3. Checks if a custom token was used (either as a theme password or partners token).
+ * 4. If a custom token is present in the environment, generates a UUID and uses it as userId.
+ * 5. If after all this we don't have a userId, then reports as 'unknown'.
  *
  * @returns A Promise that resolves to the user ID as a string.
  */
packages/cli-kit/dist/public/node/ui.d.ts
@@ -328,6 +328,7 @@ interface RenderTasksOptions {
 /**
  * Runs async tasks and displays their progress to the console.
  * @example
+ * ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  * Installing dependencies ...
  */
 export declare function renderTasks<TContext>(tasks: Task<TContext>[], { renderOptions, noProgressBar }?: RenderTasksOptions): Promise<TContext>;
@@ -345,6 +346,7 @@ export interface RenderSingleTaskOptions<T> {
  * @param options.renderOptions - Optional render configuration
  * @returns The result of the task
  * @example
+ * ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  * Loading app ...
  */
 export declare function renderSingleTask<T>({ title, task, onAbort, renderOptions, }: RenderSingleTaskOptions<T>): Promise<T>;

Copy link
Copy Markdown
Contributor Author

amcaplan commented Apr 16, 2026

@amcaplan amcaplan force-pushed the ariel/extract-organizations-package branch from 4ef8ece to 8810eb4 Compare April 16, 2026 21:23
@amcaplan amcaplan force-pushed the ariel/extract-store-package branch from acc94a4 to 81fd9c2 Compare April 16, 2026 21:23
@amcaplan amcaplan marked this pull request as ready for review April 16, 2026 21:31
@amcaplan amcaplan requested review from a team as code owners April 16, 2026 21:31
@amcaplan amcaplan force-pushed the ariel/extract-organizations-package branch from 8810eb4 to d5fe541 Compare April 17, 2026 09:19
@amcaplan amcaplan force-pushed the ariel/extract-store-package branch from 81fd9c2 to 9a6b6b8 Compare April 17, 2026 09:19
amcaplan and others added 2 commits April 17, 2026 12:51
Move existing store:auth and store:execute commands and their services
into a dedicated @shopify/store package, following the same pattern as
@shopify/theme. This prepares the store namespace for new commands like
store create dev.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… utilities

Creates a standalone package for organization fetching and selection,
calling the Business Platform Destinations API directly. Includes
GraphQL codegen pipeline, fetchOrganizations (with GID decoding),
selectOrganizationPrompt (auto-select for single org, duplicate name
disambiguation), and selectOrg helper.

Wires packages/app to use @Shopify/organizations for org fetching
in AppManagementClient.organizations() and for the org selection
prompt, eliminating duplicated Destinations API and prompt logic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@amcaplan amcaplan force-pushed the ariel/extract-organizations-package branch from d5fe541 to ee242f3 Compare April 17, 2026 09:51
Base automatically changed from ariel/extract-store-package to main April 17, 2026 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant