Skip to content
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

Merged
merged 1 commit into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
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>
17 changes: 17 additions & 0 deletions packages/cli-kit/src/cli/api/graphql/admin/generated/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,23 @@ export type Scalars = {
UtcOffset: {input: any; output: any}
}

/** Type of a theme file operation result. */
export type OnlineStoreThemeFileResultType =
/** Operation was malformed or invalid. */
| 'BAD_REQUEST'
/** Operation faced a conflict with the current state of the file. */
| 'CONFLICT'
/** Operation encountered an error. */
| 'ERROR'
/** Operation file could not be found. */
| 'NOT_FOUND'
/** Operation was successful. */
| 'SUCCESS'
/** Operation timed out. */
| 'TIMEOUT'
/** Operation could not be processed due to issues with input data. */
| 'UNPROCESSABLE_ENTITY'

/** The input fields for Theme attributes to update. */
export type OnlineStoreThemeInput = {
/** The new name of the theme. */
Expand Down
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
}
}
}
}
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
}
}
}
}
Loading
Loading