Skip to content
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
7 changes: 7 additions & 0 deletions bin/get-graphql-schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ const schemas = [
localPath: './packages/app/src/cli/api/graphql/bulk-operations/admin_schema.graphql',
usesLfs: true,
},
{
owner: 'shop',
repo: 'world',
pathToFile: 'areas/core/shopify/db/graphql/admin_schema_unstable_public.graphql',
localPath: './packages/app/src/cli/api/graphql/admin/admin_schema.graphql',
usesLfs: true,
},
]


Expand Down
1 change: 1 addition & 0 deletions graphql.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,6 @@ export default {
bulkOperations: projectFactory('bulk-operations', 'admin_schema.graphql'),
webhooks: projectFactory('webhooks', 'webhooks_schema.graphql'),
functions: projectFactory('functions', 'functions_cli_schema.graphql', 'app'),
adminAsApp: projectFactory('admin', 'admin_schema.graphql'),
},
}
26 changes: 21 additions & 5 deletions packages/app/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
"{projectRoot}/src/cli/api/graphql/app-management/generated/**/*.ts",
"{projectRoot}/src/cli/api/graphql/webhooks/generated/**/*.ts",
"{projectRoot}/src/cli/api/graphql/functions/generated/**/*.ts",
"{projectRoot}/src/cli/api/graphql/bulk-operations/generated/**/*.ts"
"{projectRoot}/src/cli/api/graphql/bulk-operations/generated/**/*.ts",
"{projectRoot}/src/cli/api/graphql/admin/generated/**/*.ts"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we just replace all these with something like this?
"{projectRoot}/src/cli/api/graphql/**/generated/**/*.ts"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good shout. But let me add as a separate piece of stack -- there could be good reason, nx has its idiosyncrasies.

],
"options": {
"commands": [
Expand All @@ -70,7 +71,8 @@
"pnpm eslint 'src/cli/api/graphql/app-management/generated/**/*.{ts,tsx}' --fix",
"pnpm eslint 'src/cli/api/graphql/webhooks/generated/**/*.{ts,tsx}' --fix",
"pnpm eslint 'src/cli/api/graphql/functions/generated/**/*.{ts,tsx}' --fix",
"pnpm eslint 'src/cli/api/graphql/bulk-operations/generated/**/*.{ts,tsx}' --fix"
"pnpm eslint 'src/cli/api/graphql/bulk-operations/generated/**/*.{ts,tsx}' --fix",
"pnpm eslint 'src/cli/api/graphql/admin/generated/**/*.{ts,tsx}' --fix"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

],
"cwd": "packages/app"
}
Expand Down Expand Up @@ -163,6 +165,17 @@
"cwd": "{workspaceRoot}"
}
},
"graphql-codegen:generate:admin-as-app": {
"executor": "nx:run-commands",
"inputs": ["{workspaceRoot}/graphql.config.ts", "{projectRoot}/src/cli/api/graphql/admin/**/*.graphql"],
"outputs": ["{projectRoot}/src/cli/api/graphql/admin/generated/**/*.ts"],
"options": {
"commands": [
"pnpm exec graphql-codegen --project=adminAsApp"
],
"cwd": "{workspaceRoot}"
}
},
"graphql-codegen:postfix": {
"executor": "nx:run-commands",
"dependsOn": [
Expand All @@ -173,7 +186,8 @@
"graphql-codegen:generate:app-management",
"graphql-codegen:generate:webhooks",
"graphql-codegen:generate:functions",
"graphql-codegen:generate:bulk-operations"
"graphql-codegen:generate:bulk-operations",
"graphql-codegen:generate:admin-as-app"
],
"inputs": [{ "dependentTasksOutputFiles": "**/*.ts" }],
"outputs": [
Expand All @@ -184,7 +198,8 @@
"{projectRoot}/src/cli/api/graphql/app-management/generated/**/*.ts",
"{projectRoot}/src/cli/api/graphql/webhooks/generated/**/*.ts",
"{projectRoot}/src/cli/api/graphql/functions/generated/**/*.ts",
"{projectRoot}/src/cli/api/graphql/bulk-operations/generated/**/*.ts"
"{projectRoot}/src/cli/api/graphql/bulk-operations/generated/**/*.ts",
"{projectRoot}/src/cli/api/graphql/admin/generated/**/*.ts"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

],
"options": {
"commands": [
Expand All @@ -195,7 +210,8 @@
"find ./packages/app/src/cli/api/graphql/app-management/generated/ -type f -name '*.ts' -exec sh -c 'sed -i \"\" \"s|import \\* as Types from '\\''./types'\\'';|import \\* as Types from '\\''./types.js'\\'';|g; s|export const \\([A-Za-z0-9_]*\\)Document =|export const \\1 =|g\" \"$0\"' {} \\;",
"find ./packages/app/src/cli/api/graphql/webhooks/generated/ -type f -name '*.ts' -exec sh -c 'sed -i \"\" \"s|import \\* as Types from '\\''./types'\\'';|import \\* as Types from '\\''./types.js'\\'';|g; s|export const \\([A-Za-z0-9_]*\\)Document =|export const \\1 =|g\" \"$0\"' {} \\;",
"find ./packages/app/src/cli/api/graphql/functions/generated/ -type f -name '*.ts' -exec sh -c 'sed -i \"\" \"s|import \\* as Types from '\\''./types'\\'';|import \\* as Types from '\\''./types.js'\\'';|g; s|export const \\([A-Za-z0-9_]*\\)Document =|export const \\1 =|g\" \"$0\"' {} \\;",
"find ./packages/app/src/cli/api/graphql/bulk-operations/generated/ -type f -name '*.ts' -exec sh -c 'sed -i \"\" \"s|import \\* as Types from '\\''./types'\\'';|import \\* as Types from '\\''./types.js'\\'';|g; s|export const \\([A-Za-z0-9_]*\\)Document =|export const \\1 =|g\" \"$0\"' {} \\;"
"find ./packages/app/src/cli/api/graphql/bulk-operations/generated/ -type f -name '*.ts' -exec sh -c 'sed -i \"\" \"s|import \\* as Types from '\\''./types'\\'';|import \\* as Types from '\\''./types.js'\\'';|g; s|export const \\([A-Za-z0-9_]*\\)Document =|export const \\1 =|g\" \"$0\"' {} \\;",
"find ./packages/app/src/cli/api/graphql/admin/generated/ -type f -name '*.ts' -exec sh -c 'sed -i \"\" \"s|import \\* as Types from '\\''./types'\\'';|import \\* as Types from '\\''./types.js'\\'';|g; s|export const \\([A-Za-z0-9_]*\\)Document =|export const \\1 =|g\" \"$0\"' {} \\;"
],
"cwd": "{workspaceRoot}"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
/* 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 MetafieldForImportFragment = {
key: string
name: string
namespace: string
description?: string | null
type: {category: string; name: string}
access: {
admin?: Types.MetafieldAdminAccess | null
storefront?: Types.MetafieldStorefrontAccess | null
customerAccount: Types.MetafieldCustomerAccountAccess
}
capabilities: {adminFilterable: {enabled: boolean}}
validations: {name: string; value?: string | null}[]
}

export type MetafieldDefinitionsQueryVariables = Types.Exact<{
ownerType: Types.MetafieldOwnerType
after?: Types.InputMaybe<Types.Scalars['String']['input']>
}>

export type MetafieldDefinitionsQuery = {
metafieldDefinitions: {
pageInfo: {hasNextPage: boolean; endCursor?: string | null}
nodes: {
key: string
name: string
namespace: string
description?: string | null
type: {category: string; name: string}
access: {
admin?: Types.MetafieldAdminAccess | null
storefront?: Types.MetafieldStorefrontAccess | null
customerAccount: Types.MetafieldCustomerAccountAccess
}
capabilities: {adminFilterable: {enabled: boolean}}
validations: {name: string; value?: string | null}[]
}[]
}
}

export const MetafieldForImportFragmentDoc = {
kind: 'Document',
definitions: [
{
kind: 'FragmentDefinition',
name: {kind: 'Name', value: 'MetafieldForImport'},
typeCondition: {kind: 'NamedType', name: {kind: 'Name', value: 'MetafieldDefinition'}},
selectionSet: {
kind: 'SelectionSet',
selections: [
{kind: 'Field', name: {kind: 'Name', value: 'key'}},
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
{kind: 'Field', name: {kind: 'Name', value: 'namespace'}},
{kind: 'Field', name: {kind: 'Name', value: 'description'}},
{
kind: 'Field',
name: {kind: 'Name', value: 'type'},
selectionSet: {
kind: 'SelectionSet',
selections: [
{kind: 'Field', name: {kind: 'Name', value: 'category'}},
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
],
},
},
{
kind: 'Field',
name: {kind: 'Name', value: 'access'},
selectionSet: {
kind: 'SelectionSet',
selections: [
{kind: 'Field', name: {kind: 'Name', value: 'admin'}},
{kind: 'Field', name: {kind: 'Name', value: 'storefront'}},
{kind: 'Field', name: {kind: 'Name', value: 'customerAccount'}},
],
},
},
{
kind: 'Field',
name: {kind: 'Name', value: 'capabilities'},
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: {kind: 'Name', value: 'adminFilterable'},
selectionSet: {
kind: 'SelectionSet',
selections: [{kind: 'Field', name: {kind: 'Name', value: 'enabled'}}],
},
},
],
},
},
{
kind: 'Field',
name: {kind: 'Name', value: 'validations'},
selectionSet: {
kind: 'SelectionSet',
selections: [
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
{kind: 'Field', name: {kind: 'Name', value: 'value'}},
],
},
},
],
},
},
],
} as unknown as DocumentNode<MetafieldForImportFragment, unknown>
export const MetafieldDefinitions = {
kind: 'Document',
definitions: [
{
kind: 'OperationDefinition',
operation: 'query',
name: {kind: 'Name', value: 'metafieldDefinitions'},
variableDefinitions: [
{
kind: 'VariableDefinition',
variable: {kind: 'Variable', name: {kind: 'Name', value: 'ownerType'}},
type: {kind: 'NonNullType', type: {kind: 'NamedType', name: {kind: 'Name', value: 'MetafieldOwnerType'}}},
},
{
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: 'metafieldDefinitions'},
arguments: [
{
kind: 'Argument',
name: {kind: 'Name', value: 'ownerType'},
value: {kind: 'Variable', name: {kind: 'Name', value: 'ownerType'}},
},
{kind: 'Argument', name: {kind: 'Name', value: 'first'}, value: {kind: 'IntValue', value: '30'}},
{
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: '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: 'nodes'},
selectionSet: {
kind: 'SelectionSet',
selections: [
{kind: 'FragmentSpread', name: {kind: 'Name', value: 'MetafieldForImport'}},
{kind: 'Field', name: {kind: 'Name', value: '__typename'}},
],
},
},
{kind: 'Field', name: {kind: 'Name', value: '__typename'}},
],
},
},
],
},
},
{
kind: 'FragmentDefinition',
name: {kind: 'Name', value: 'MetafieldForImport'},
typeCondition: {kind: 'NamedType', name: {kind: 'Name', value: 'MetafieldDefinition'}},
selectionSet: {
kind: 'SelectionSet',
selections: [
{kind: 'Field', name: {kind: 'Name', value: 'key'}},
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
{kind: 'Field', name: {kind: 'Name', value: 'namespace'}},
{kind: 'Field', name: {kind: 'Name', value: 'description'}},
{
kind: 'Field',
name: {kind: 'Name', value: 'type'},
selectionSet: {
kind: 'SelectionSet',
selections: [
{kind: 'Field', name: {kind: 'Name', value: 'category'}},
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
],
},
},
{
kind: 'Field',
name: {kind: 'Name', value: 'access'},
selectionSet: {
kind: 'SelectionSet',
selections: [
{kind: 'Field', name: {kind: 'Name', value: 'admin'}},
{kind: 'Field', name: {kind: 'Name', value: 'storefront'}},
{kind: 'Field', name: {kind: 'Name', value: 'customerAccount'}},
],
},
},
{
kind: 'Field',
name: {kind: 'Name', value: 'capabilities'},
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: {kind: 'Name', value: 'adminFilterable'},
selectionSet: {
kind: 'SelectionSet',
selections: [{kind: 'Field', name: {kind: 'Name', value: 'enabled'}}],
},
},
],
},
},
{
kind: 'Field',
name: {kind: 'Name', value: 'validations'},
selectionSet: {
kind: 'SelectionSet',
selections: [
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
{kind: 'Field', name: {kind: 'Name', value: 'value'}},
],
},
},
],
},
},
],
} as unknown as DocumentNode<MetafieldDefinitionsQuery, MetafieldDefinitionsQueryVariables>
Loading
Loading