cli icon indicating copy to clipboard operation
cli copied to clipboard

Catlee/admin gql

Open catlee opened this issue 1 year ago • 3 comments

WHY are these changes introduced?

Fixes #0000

WHAT is this pull request doing?

How to test your changes?

Post-release steps

Measuring impact

How do we know this change was effective? Please choose one:

  • [ ] n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • [ ] Existing analytics will cater for this addition
  • [ ] PR includes analytics changes to measure impact

Checklist

  • [ ] I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • [ ] I've considered possible documentation changes

catlee avatar Sep 27 '24 21:09 catlee

Thanks for your contribution!

Depending on what you are working on, you may want to request a review from a Shopify team:

  • Themes: @shopify/advanced-edits
  • UI extensions: @shopify/ui-extensions-cli
    • Checkout UI extensions: @shopify/checkout-ui-extensions-api-stewardship
  • Hydrogen: @shopify/hydrogen
  • Other: @shopify/app-inner-loop

github-actions[bot] avatar Sep 27 '24 21:09 github-actions[bot]

Unused types (18)

Filename types
packages/cli-kit/src/cli/api/graphql/admin/generated/public_api_versions.ts PublicApiVersionsQueryVariables
PublicApiVersionsQuery
packages/cli-kit/src/cli/api/graphql/admin/generated/get_theme_file_checksums.ts GetThemeFileChecksumsQueryVariables
GetThemeFileChecksumsQuery
packages/cli-kit/src/cli/api/graphql/admin/generated/get_themes.ts GetThemesQueryVariables
GetThemesQuery
packages/cli-kit/src/cli/api/graphql/admin/generated/upsert_theme_file_bodies.ts UpsertThemeFileBodiesMutationVariables
UpsertThemeFileBodiesMutation
packages/cli-kit/src/cli/api/graphql/admin/generated/get_theme.ts GetThemeQueryVariables
GetThemeQuery
packages/cli-kit/src/cli/api/graphql/admin/generated/get_theme_file_bodies.ts GetThemeFileBodiesQueryVariables
GetThemeFileBodiesQuery
packages/cli-kit/src/cli/api/graphql/admin/generated/theme_update.ts ThemeUpdateMutationVariables
ThemeUpdateMutation
packages/cli-kit/src/cli/api/graphql/admin/generated/theme_delete.ts ThemeDeleteMutationVariables
ThemeDeleteMutation
packages/cli-kit/src/cli/api/graphql/admin/generated/theme_files_delete.ts ThemeFilesDeleteMutationVariables
ThemeFilesDeleteMutation

github-actions[bot] avatar Sep 27 '24 21:09 github-actions[bot]

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/cli/api/graphql/admin/generated/get_theme.d.ts
import * as Types from './types.js';
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
export type GetThemeQueryVariables = Types.Exact<{
    id: Types.Scalars['ID']['input'];
}>;
export type GetThemeQuery = {
    theme?: {
        id: string;
        name: string;
        role: Types.ThemeRole;
    } | null;
};
export declare const GetTheme: DocumentNode<GetThemeQuery, Types.Exact<{
    id: Types.Scalars['ID']['input'];
}>>;

packages/cli-kit/dist/cli/api/graphql/admin/generated/get_theme_file_bodies.d.ts
import * 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: unknown;
                };
            }[];
            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.ts
import * 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;
}>>;

packages/cli-kit/dist/cli/api/graphql/admin/generated/get_themes.d.ts
import * as Types from './types.js';
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
export type GetThemesQueryVariables = Types.Exact<{
    after?: Types.InputMaybe<Types.Scalars['String']['input']>;
}>;
export type GetThemesQuery = {
    themes?: {
        nodes: {
            id: string;
            name: string;
            role: Types.ThemeRole;
        }[];
        pageInfo: {
            hasNextPage: boolean;
            endCursor?: string | null;
        };
    } | null;
};
export declare const GetThemes: DocumentNode<GetThemesQuery, Types.Exact<{
    after?: Types.InputMaybe<string> | undefined;
}>>;

packages/cli-kit/dist/cli/api/graphql/admin/generated/public_api_versions.d.ts
import * as Types from './types.js';
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
export type PublicApiVersionsQueryVariables = Types.Exact<{
    [key: string]: never;
}>;
export type PublicApiVersionsQuery = {
    publicApiVersions: {
        handle: string;
        supported: boolean;
    }[];
};
export declare const PublicApiVersions: DocumentNode<PublicApiVersionsQuery, Types.Exact<{
    [key: string]: never;
}>>;

packages/cli-kit/dist/cli/api/graphql/admin/generated/theme_delete.d.ts
import * as Types from './types.js';
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
export type ThemeDeleteMutationVariables = Types.Exact<{
    id: Types.Scalars['ID']['input'];
}>;
export type ThemeDeleteMutation = {
    themeDelete?: {
        deletedThemeId?: string | null;
        userErrors: {
            field?: string[] | null;
            message: string;
        }[];
    } | null;
};
export declare const ThemeDelete: DocumentNode<ThemeDeleteMutation, Types.Exact<{
    id: Types.Scalars['ID']['input'];
}>>;

packages/cli-kit/dist/cli/api/graphql/admin/generated/theme_files_delete.d.ts
import * as Types from './types.js';
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
export type ThemeFilesDeleteMutationVariables = Types.Exact<{
    themeId: Types.Scalars['ID']['input'];
    files: Types.Scalars['String']['input'][] | Types.Scalars['String']['input'];
}>;
export type ThemeFilesDeleteMutation = {
    themeFilesDelete?: {
        deletedThemeFiles?: {
            filename: string;
        }[] | null;
        userErrors: {
            filename?: string | null;
            code?: Types.OnlineStoreThemeFilesUserErrorsCode | null;
            message: string;
        }[];
    } | null;
};
export declare const ThemeFilesDelete: DocumentNode<ThemeFilesDeleteMutation, Types.Exact<{
    themeId: Types.Scalars['ID']['input'];
    files: Types.Scalars['String']['input'][] | Types.Scalars['String']['input'];
}>>;

packages/cli-kit/dist/cli/api/graphql/admin/generated/theme_update.d.ts
import * as Types from './types.js';
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
export type ThemeUpdateMutationVariables = Types.Exact<{
    id: Types.Scalars['ID']['input'];
    name: Types.Scalars['String']['input'];
}>;
export type ThemeUpdateMutation = {
    themeUpdate?: {
        theme?: {
            id: string;
            name: string;
            role: Types.ThemeRole;
        } | null;
    } | null;
};
export declare const ThemeUpdate: DocumentNode<ThemeUpdateMutation, Types.Exact<{
    id: Types.Scalars['ID']['input'];
    name: Types.Scalars['String']['input'];
}>>;

packages/cli-kit/dist/cli/api/graphql/admin/generated/upsert_theme_file_bodies.d.ts
import * as Types from './types.js';
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
export type UpsertThemeFileBodiesMutationVariables = Types.Exact<{
    id: Types.Scalars['ID']['input'];
    files: Types.OnlineStoreThemeFilesUpsertFileInput[] | Types.OnlineStoreThemeFilesUpsertFileInput;
}>;
export type UpsertThemeFileBodiesMutation = {
    themeFilesUpsert?: {
        job?: {
            id: string;
        } | null;
        upsertedThemeFiles?: {
            filename: string;
        }[] | null;
        userErrors: {
            code?: Types.OnlineStoreThemeFilesUserErrorsCode | null;
            filename?: string | null;
            message: string;
        }[];
    } | null;
};
export declare const UpsertThemeFileBodies: DocumentNode<UpsertThemeFileBodiesMutation, Types.Exact<{
    id: Types.Scalars['ID']['input'];
    files: Types.OnlineStoreThemeFilesUpsertFileInput[] | Types.OnlineStoreThemeFilesUpsertFileInput;
}>>;

Existing type declarations

packages/cli-kit/dist/public/node/api/admin.d.ts
@@ -1,5 +1,7 @@
 import { GraphQLVariables } from './graphql.js';
 import { AdminSession } from '../session.js';
+import { Variables } from 'graphql-request';
+import { TypedDocumentNode } from '@graphql-typed-document-node/core';
 /**
  * Executes a GraphQL query against the Admin API.
  *
@@ -9,6 +11,16 @@ import { AdminSession } from '../session.js';
  * @returns The response of the query of generic type <T>.
  */
 export declare function adminRequest<T>(query: string, session: AdminSession, variables?: GraphQLVariables): Promise<T>;
+/**
+ * Executes a GraphQL query against the Admin API. Uses typed documents.
+ *
+ * @param query - GraphQL query to execute.
+ * @param session - Shopify admin session including token and Store FQDN.
+ * @param variables - GraphQL variables to pass to the query.
+ * @param version - API version.
+ * @returns The response of the query of generic type <TResult>.
+ */
+export declare function adminRequestDoc<TResult, TVariables extends Variables>(query: TypedDocumentNode<TResult, TVariables>, session: AdminSession, variables?: TVariables, version?: string): Promise<TResult>;
 /**
  * GraphQL query to retrieve all supported API versions.
  *

packages/cli-kit/dist/public/node/themes/api.d.ts
@@ -1,22 +1,14 @@
-import { AdminSession } from '@shopify/cli-kit/node/session';
-import { Result, Checksum, Key, Theme, ThemeAsset } from '@shopify/cli-kit/node/themes/types';
+import { Result, Checksum, Key, Theme, ThemeAsset } from './types.js';
+import { AdminSession } from '../session.js';
 export type ThemeParams = Partial<Pick<Theme, 'name' | 'role' | 'processing' | 'src'>>;
 export type AssetParams = Pick<ThemeAsset, 'key'> & Partial<Pick<ThemeAsset, 'value' | 'attachment'>>;
 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 deleteThemeAsset(id: number, key: Key, session: AdminSession): Promise<boolean>;
+export declare function fetchThemeAssets(id: number, filenames: Key[], session: AdminSession): Promise<ThemeAsset[]>;
+export declare function deleteThemeAssets(id: number, keys: 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[]>;
-interface UpgradeThemeOptions {
-    fromTheme: number;
-    toTheme: number;
-    script?: string;
-    session: AdminSession;
-}
-export declare function upgradeTheme(upgradeOptions: UpgradeThemeOptions): Promise<Theme | undefined>;
 export declare function updateTheme(id: number, params: ThemeParams, session: AdminSession): Promise<Theme | undefined>;
 export declare function publishTheme(id: number, session: AdminSession): Promise<Theme | undefined>;
-export declare function deleteTheme(id: number, session: AdminSession): Promise<Theme | undefined>;
-export {};
\ No newline at end of file
+export declare function deleteTheme(id: number, session: AdminSession): Promise<boolean | undefined>;
\ No newline at end of file

github-actions[bot] avatar Oct 09 '24 17:10 github-actions[bot]

This PR seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.

github-actions[bot] avatar Nov 16 '24 03:11 github-actions[bot]