Skip to content

Commit

Permalink
Merge pull request #4918 from Shopify/identify-app-by-api-key
Browse files Browse the repository at this point in the history
Allow identifying apps by API key, not ID
  • Loading branch information
amcaplan authored Dec 17, 2024
2 parents 3c13412 + 5258c52 commit a15cffc
Show file tree
Hide file tree
Showing 26 changed files with 417 additions and 207 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
/* eslint-disable @typescript-eslint/consistent-type-definitions */
import * as Types from './types.js'
import {JsonMapType} from '@shopify/cli-kit/node/toml'

import {TypedDocumentNode as DocumentNode} from '@graphql-typed-document-node/core'

export type ActiveAppReleaseFromApiKeyQueryVariables = Types.Exact<{
apiKey: Types.Scalars['String']['input']
}>

export type ActiveAppReleaseFromApiKeyQuery = {
app: {
id: string
key: string
activeRoot: {clientCredentials: {secrets: {key: string}[]}}
activeRelease: {
id: string
version: {
name: string
appModules: {
uuid: string
userIdentifier: string
handle: string
config: JsonMapType
specification: {identifier: string; externalIdentifier: string; name: string}
}[]
}
}
}
}

export const ActiveAppReleaseFromApiKey = {
kind: 'Document',
definitions: [
{
kind: 'OperationDefinition',
operation: 'query',
name: {kind: 'Name', value: 'ActiveAppReleaseFromApiKey'},
variableDefinitions: [
{
kind: 'VariableDefinition',
variable: {kind: 'Variable', name: {kind: 'Name', value: 'apiKey'}},
type: {kind: 'NonNullType', type: {kind: 'NamedType', name: {kind: 'Name', value: 'String'}}},
},
],
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
alias: {kind: 'Name', value: 'app'},
name: {kind: 'Name', value: 'appByKey'},
arguments: [
{
kind: 'Argument',
name: {kind: 'Name', value: 'key'},
value: {kind: 'Variable', name: {kind: 'Name', value: 'apiKey'}},
},
],
selectionSet: {
kind: 'SelectionSet',
selections: [
{kind: 'FragmentSpread', name: {kind: 'Name', value: 'AppVersionInfo'}},
{kind: 'Field', name: {kind: 'Name', value: '__typename'}},
],
},
},
],
},
},
{
kind: 'FragmentDefinition',
name: {kind: 'Name', value: 'ReleasedAppModule'},
typeCondition: {kind: 'NamedType', name: {kind: 'Name', value: 'AppModule'}},
selectionSet: {
kind: 'SelectionSet',
selections: [
{kind: 'Field', name: {kind: 'Name', value: 'uuid'}},
{kind: 'Field', name: {kind: 'Name', value: 'userIdentifier'}},
{kind: 'Field', name: {kind: 'Name', value: 'handle'}},
{kind: 'Field', name: {kind: 'Name', value: 'config'}},
{
kind: 'Field',
name: {kind: 'Name', value: 'specification'},
selectionSet: {
kind: 'SelectionSet',
selections: [
{kind: 'Field', name: {kind: 'Name', value: 'identifier'}},
{kind: 'Field', name: {kind: 'Name', value: 'externalIdentifier'}},
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
],
},
},
],
},
},
{
kind: 'FragmentDefinition',
name: {kind: 'Name', value: 'AppVersionInfo'},
typeCondition: {kind: 'NamedType', name: {kind: 'Name', value: 'App'}},
selectionSet: {
kind: 'SelectionSet',
selections: [
{kind: 'Field', name: {kind: 'Name', value: 'id'}},
{kind: 'Field', name: {kind: 'Name', value: 'key'}},
{
kind: 'Field',
name: {kind: 'Name', value: 'activeRoot'},
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: {kind: 'Name', value: 'clientCredentials'},
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: {kind: 'Name', value: 'secrets'},
selectionSet: {
kind: 'SelectionSet',
selections: [{kind: 'Field', name: {kind: 'Name', value: 'key'}}],
},
},
],
},
},
],
},
},
{
kind: 'Field',
name: {kind: 'Name', value: 'activeRelease'},
selectionSet: {
kind: 'SelectionSet',
selections: [
{kind: 'Field', name: {kind: 'Name', value: 'id'}},
{
kind: 'Field',
name: {kind: 'Name', value: 'version'},
selectionSet: {
kind: 'SelectionSet',
selections: [
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
{
kind: 'Field',
name: {kind: 'Name', value: 'appModules'},
selectionSet: {
kind: 'SelectionSet',
selections: [{kind: 'FragmentSpread', name: {kind: 'Name', value: 'ReleasedAppModule'}}],
},
},
],
},
},
],
},
},
],
},
},
],
} as unknown as DocumentNode<ActiveAppReleaseFromApiKeyQuery, ActiveAppReleaseFromApiKeyQueryVariables>
Loading

0 comments on commit a15cffc

Please sign in to comment.