-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4660 from Shopify/catlee/theme_files_get
Port fetchThemeAssets / fetchChecksums to graphQL
- Loading branch information
Showing
17 changed files
with
698 additions
and
164 deletions.
There are no files selected for viewing
193 changes: 193 additions & 0 deletions
193
packages/cli-kit/src/cli/api/graphql/admin/generated/get_theme_file_bodies.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
/* eslint-disable @typescript-eslint/consistent-type-definitions */ | ||
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: string} | ||
}[] | ||
userErrors: {filename: string; code: Types.OnlineStoreThemeFileResultType}[] | ||
pageInfo: {hasNextPage: boolean; endCursor?: string | null} | ||
} | null | ||
} | null | ||
} | ||
|
||
export const GetThemeFileBodies = { | ||
kind: 'Document', | ||
definitions: [ | ||
{ | ||
kind: 'OperationDefinition', | ||
operation: 'query', | ||
name: {kind: 'Name', value: 'getThemeFileBodies'}, | ||
variableDefinitions: [ | ||
{ | ||
kind: 'VariableDefinition', | ||
variable: {kind: 'Variable', name: {kind: 'Name', value: 'id'}}, | ||
type: {kind: 'NonNullType', type: {kind: 'NamedType', name: {kind: 'Name', value: 'ID'}}}, | ||
}, | ||
{ | ||
kind: 'VariableDefinition', | ||
variable: {kind: 'Variable', name: {kind: 'Name', value: 'after'}}, | ||
type: {kind: 'NamedType', name: {kind: 'Name', value: 'String'}}, | ||
}, | ||
{ | ||
kind: 'VariableDefinition', | ||
variable: {kind: 'Variable', name: {kind: 'Name', value: 'filenames'}}, | ||
type: { | ||
kind: 'ListType', | ||
type: {kind: 'NonNullType', type: {kind: 'NamedType', name: {kind: 'Name', value: 'String'}}}, | ||
}, | ||
}, | ||
], | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{ | ||
kind: 'Field', | ||
name: {kind: 'Name', value: 'theme'}, | ||
arguments: [ | ||
{ | ||
kind: 'Argument', | ||
name: {kind: 'Name', value: 'id'}, | ||
value: {kind: 'Variable', name: {kind: 'Name', value: 'id'}}, | ||
}, | ||
], | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{ | ||
kind: 'Field', | ||
name: {kind: 'Name', value: 'files'}, | ||
arguments: [ | ||
{kind: 'Argument', name: {kind: 'Name', value: 'first'}, value: {kind: 'IntValue', value: '250'}}, | ||
{ | ||
kind: 'Argument', | ||
name: {kind: 'Name', value: 'after'}, | ||
value: {kind: 'Variable', name: {kind: 'Name', value: 'after'}}, | ||
}, | ||
{ | ||
kind: 'Argument', | ||
name: {kind: 'Name', value: 'filenames'}, | ||
value: {kind: 'Variable', name: {kind: 'Name', value: 'filenames'}}, | ||
}, | ||
], | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{ | ||
kind: 'Field', | ||
name: {kind: 'Name', value: 'nodes'}, | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{kind: 'Field', name: {kind: 'Name', value: 'filename'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: 'size'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: 'checksumMd5'}}, | ||
{ | ||
kind: 'Field', | ||
name: {kind: 'Name', value: 'body'}, | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
{ | ||
kind: 'InlineFragment', | ||
typeCondition: { | ||
kind: 'NamedType', | ||
name: {kind: 'Name', value: 'OnlineStoreThemeFileBodyText'}, | ||
}, | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{kind: 'Field', name: {kind: 'Name', value: 'content'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
], | ||
}, | ||
}, | ||
{ | ||
kind: 'InlineFragment', | ||
typeCondition: { | ||
kind: 'NamedType', | ||
name: {kind: 'Name', value: 'OnlineStoreThemeFileBodyBase64'}, | ||
}, | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{kind: 'Field', name: {kind: 'Name', value: 'contentBase64'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
], | ||
}, | ||
}, | ||
{ | ||
kind: 'InlineFragment', | ||
typeCondition: { | ||
kind: 'NamedType', | ||
name: {kind: 'Name', value: 'OnlineStoreThemeFileBodyUrl'}, | ||
}, | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{kind: 'Field', name: {kind: 'Name', value: 'url'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
], | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
{kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
], | ||
}, | ||
}, | ||
{ | ||
kind: 'Field', | ||
name: {kind: 'Name', value: 'userErrors'}, | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{kind: 'Field', name: {kind: 'Name', value: 'filename'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: 'code'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
], | ||
}, | ||
}, | ||
{ | ||
kind: 'Field', | ||
name: {kind: 'Name', value: 'pageInfo'}, | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{kind: 'Field', name: {kind: 'Name', value: 'hasNextPage'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: 'endCursor'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
], | ||
}, | ||
}, | ||
{kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
], | ||
}, | ||
}, | ||
{kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
], | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
} as unknown as DocumentNode<GetThemeFileBodiesQuery, GetThemeFileBodiesQueryVariables> |
119 changes: 119 additions & 0 deletions
119
packages/cli-kit/src/cli/api/graphql/admin/generated/get_theme_file_checksums.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/* eslint-disable @typescript-eslint/consistent-type-definitions */ | ||
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 const GetThemeFileChecksums = { | ||
kind: 'Document', | ||
definitions: [ | ||
{ | ||
kind: 'OperationDefinition', | ||
operation: 'query', | ||
name: {kind: 'Name', value: 'getThemeFileChecksums'}, | ||
variableDefinitions: [ | ||
{ | ||
kind: 'VariableDefinition', | ||
variable: {kind: 'Variable', name: {kind: 'Name', value: 'id'}}, | ||
type: {kind: 'NonNullType', type: {kind: 'NamedType', name: {kind: 'Name', value: 'ID'}}}, | ||
}, | ||
{ | ||
kind: 'VariableDefinition', | ||
variable: {kind: 'Variable', name: {kind: 'Name', value: 'after'}}, | ||
type: {kind: 'NamedType', name: {kind: 'Name', value: 'String'}}, | ||
}, | ||
], | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{ | ||
kind: 'Field', | ||
name: {kind: 'Name', value: 'theme'}, | ||
arguments: [ | ||
{ | ||
kind: 'Argument', | ||
name: {kind: 'Name', value: 'id'}, | ||
value: {kind: 'Variable', name: {kind: 'Name', value: 'id'}}, | ||
}, | ||
], | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{ | ||
kind: 'Field', | ||
name: {kind: 'Name', value: 'files'}, | ||
arguments: [ | ||
{kind: 'Argument', name: {kind: 'Name', value: 'first'}, value: {kind: 'IntValue', value: '250'}}, | ||
{ | ||
kind: 'Argument', | ||
name: {kind: 'Name', value: 'after'}, | ||
value: {kind: 'Variable', name: {kind: 'Name', value: 'after'}}, | ||
}, | ||
], | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{ | ||
kind: 'Field', | ||
name: {kind: 'Name', value: 'nodes'}, | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{kind: 'Field', name: {kind: 'Name', value: 'filename'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: 'size'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: 'checksumMd5'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
], | ||
}, | ||
}, | ||
{ | ||
kind: 'Field', | ||
name: {kind: 'Name', value: 'userErrors'}, | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{kind: 'Field', name: {kind: 'Name', value: 'filename'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: 'code'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
], | ||
}, | ||
}, | ||
{ | ||
kind: 'Field', | ||
name: {kind: 'Name', value: 'pageInfo'}, | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{kind: 'Field', name: {kind: 'Name', value: 'hasNextPage'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: 'endCursor'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
], | ||
}, | ||
}, | ||
{kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
], | ||
}, | ||
}, | ||
{kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
], | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
} as unknown as DocumentNode<GetThemeFileChecksumsQuery, GetThemeFileChecksumsQueryVariables> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/cli-kit/src/cli/api/graphql/admin/queries/get_theme_file_bodies.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
query getThemeFileBodies($id: ID!, $after: String, $filenames: [String!]) { | ||
theme(id: $id) { | ||
files(first: 250, after: $after, filenames: $filenames) { | ||
nodes { | ||
filename | ||
size | ||
checksumMd5 | ||
body { | ||
__typename | ||
... on OnlineStoreThemeFileBodyText { content } | ||
... on OnlineStoreThemeFileBodyBase64 { contentBase64 } | ||
... on OnlineStoreThemeFileBodyUrl { url } | ||
} | ||
} | ||
userErrors { | ||
filename | ||
code | ||
} | ||
pageInfo { | ||
hasNextPage | ||
endCursor | ||
} | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
packages/cli-kit/src/cli/api/graphql/admin/queries/get_theme_file_checksums.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
query getThemeFileChecksums($id: ID!, $after: String) { | ||
theme(id: $id) { | ||
files(first: 250, after: $after) { | ||
nodes { | ||
filename | ||
size | ||
checksumMd5 | ||
} | ||
userErrors { | ||
filename | ||
code | ||
} | ||
pageInfo { | ||
hasNextPage | ||
endCursor | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.