-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port fetchThemeAssets / fetchChecksums to graphQL #4660
base: main
Are you sure you want to change the base?
Conversation
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success1903 tests passing in 865 suites. Report generated by 🧪jest coverage report action from a274728 |
25dadfa
to
dc7e4ed
Compare
We detected some changes at either packages/*/src or packages/cli-kit/assets/cli-ruby/** and there are no updates in the .changeset. |
dc7e4ed
to
a1a337c
Compare
Differences in type declarationsWe 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:
New type declarationspackages/cli-kit/dist/cli/api/graphql/admin/generated/get_theme_file_bodies.d.tsimport * as Types from './types.js';
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
export type GetThemeFileBodiesQueryVariables = Types.Exact<{
id: Types.Scalars['ID']['input'];
after?: Types.InputMaybe<Types.Scalars['String']['input']>;
filenames?: Types.InputMaybe<Types.Scalars['String']['input'][] | Types.Scalars['String']['input']>;
}>;
export type GetThemeFileBodiesQuery = {
theme?: {
files?: {
nodes: {
filename: string;
size: unknown;
checksumMd5?: string | null;
body: {
__typename: 'OnlineStoreThemeFileBodyBase64';
contentBase64: string;
} | {
__typename: 'OnlineStoreThemeFileBodyText';
content: string;
} | {
__typename: 'OnlineStoreThemeFileBodyUrl';
url: string;
};
}[];
userErrors: {
filename: string;
code: Types.OnlineStoreThemeFileResultType;
}[];
pageInfo: {
hasNextPage: boolean;
endCursor?: string | null;
};
} | null;
} | null;
};
export declare const GetThemeFileBodies: DocumentNode<GetThemeFileBodiesQuery, Types.Exact<{
id: Types.Scalars['ID']['input'];
after?: Types.InputMaybe<string> | undefined;
filenames?: Types.InputMaybe<string | string[]> | undefined;
}>>;
packages/cli-kit/dist/cli/api/graphql/admin/generated/get_theme_file_checksums.d.tsimport * as Types from './types.js';
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
export type GetThemeFileChecksumsQueryVariables = Types.Exact<{
id: Types.Scalars['ID']['input'];
after?: Types.InputMaybe<Types.Scalars['String']['input']>;
}>;
export type GetThemeFileChecksumsQuery = {
theme?: {
files?: {
nodes: {
filename: string;
size: unknown;
checksumMd5?: string | null;
}[];
userErrors: {
filename: string;
code: Types.OnlineStoreThemeFileResultType;
}[];
pageInfo: {
hasNextPage: boolean;
endCursor?: string | null;
};
} | null;
} | null;
};
export declare const GetThemeFileChecksums: DocumentNode<GetThemeFileChecksumsQuery, Types.Exact<{
id: Types.Scalars['ID']['input'];
after?: Types.InputMaybe<string> | undefined;
}>>;
Existing type declarationspackages/cli-kit/dist/public/node/themes/api.d.ts@@ -5,7 +5,7 @@ export type AssetParams = Pick<ThemeAsset, 'key'> & Partial<Pick<ThemeAsset, 'va
export declare function fetchTheme(id: number, session: AdminSession): Promise<Theme | undefined>;
export declare function fetchThemes(session: AdminSession): Promise<Theme[]>;
export declare function createTheme(params: ThemeParams, session: AdminSession): Promise<Theme | undefined>;
-export declare function fetchThemeAsset(id: number, key: Key, session: AdminSession): Promise<ThemeAsset | undefined>;
+export declare function fetchThemeAssets(id: number, filenames: Key[], session: AdminSession): Promise<ThemeAsset[]>;
export declare function deleteThemeAsset(id: number, key: Key, session: AdminSession): Promise<boolean>;
export declare function bulkUploadThemeAssets(id: number, assets: AssetParams[], session: AdminSession): Promise<Result[]>;
export declare function fetchChecksums(id: number, session: AdminSession): Promise<Checksum[]>;
|
WHY are these changes introduced?
Migrate off the REST Assets API and use graphQL instead.
WHAT is this pull request doing?
This PR adjusts the
fetchThemeAsset
andfetchChecksums
method to use theOnlineStoreTheme.files
field.Where appropriate I've also updated callers to fetch multiple assets at once with
fetchThemeAssets
.How to test your changes?
p shopify theme pull ...
should fetch all the files from your theme to a local directory.Measuring impact
How do we know this change was effective? Please choose one:
Checklist