Skip to content

Commit 717e83b

Browse files
authored
Merge pull request #6185 from Shopify/07-21-add_org_id_as_variable_in_some_queries
Add organization_id to the variables of some queries/mutations
2 parents c9ecb60 + aac30ee commit 717e83b

File tree

11 files changed

+86
-21
lines changed

11 files changed

+86
-21
lines changed

packages/app/src/cli/api/graphql/app-management/generated/active-app-release-from-api-key.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export type ActiveAppReleaseFromApiKeyQuery = {
1212
app: {
1313
id: string
1414
key: string
15+
organizationId: string
1516
activeRoot: {clientCredentials: {secrets: {key: string}[]}}
1617
activeRelease: {
1718
id: string
@@ -104,6 +105,7 @@ export const ActiveAppReleaseFromApiKey = {
104105
selections: [
105106
{kind: 'Field', name: {kind: 'Name', value: 'id'}},
106107
{kind: 'Field', name: {kind: 'Name', value: 'key'}},
108+
{kind: 'Field', name: {kind: 'Name', value: 'organizationId'}},
107109
{
108110
kind: 'Field',
109111
name: {kind: 'Name', value: 'activeRoot'},

packages/app/src/cli/api/graphql/app-management/generated/active-app-release.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export type ActiveAppReleaseQuery = {
1212
app: {
1313
id: string
1414
key: string
15+
organizationId: string
1516
activeRoot: {clientCredentials: {secrets: {key: string}[]}}
1617
activeRelease: {
1718
id: string
@@ -32,6 +33,7 @@ export type ActiveAppReleaseQuery = {
3233
export type AppVersionInfoFragment = {
3334
id: string
3435
key: string
36+
organizationId: string
3537
activeRoot: {clientCredentials: {secrets: {key: string}[]}}
3638
activeRelease: {
3739
id: string
@@ -100,6 +102,7 @@ export const AppVersionInfoFragmentDoc = {
100102
selections: [
101103
{kind: 'Field', name: {kind: 'Name', value: 'id'}},
102104
{kind: 'Field', name: {kind: 'Name', value: 'key'}},
105+
{kind: 'Field', name: {kind: 'Name', value: 'organizationId'}},
103106
{
104107
kind: 'Field',
105108
name: {kind: 'Name', value: 'activeRoot'},
@@ -260,6 +263,7 @@ export const ActiveAppRelease = {
260263
selections: [
261264
{kind: 'Field', name: {kind: 'Name', value: 'id'}},
262265
{kind: 'Field', name: {kind: 'Name', value: 'key'}},
266+
{kind: 'Field', name: {kind: 'Name', value: 'organizationId'}},
263267
{
264268
kind: 'Field',
265269
name: {kind: 'Name', value: 'activeRoot'},

packages/app/src/cli/api/graphql/app-management/generated/create-app.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {TypedDocumentNode as DocumentNode} from '@graphql-typed-document-node/co
66

77
export type CreateAppMutationVariables = Types.Exact<{
88
initialVersion: Types.AppVersionInput
9+
organizationId: Types.Scalars['ID']['input']
910
}>
1011

1112
export type CreateAppMutation = {
@@ -28,6 +29,11 @@ export const CreateApp = {
2829
variable: {kind: 'Variable', name: {kind: 'Name', value: 'initialVersion'}},
2930
type: {kind: 'NonNullType', type: {kind: 'NamedType', name: {kind: 'Name', value: 'AppVersionInput'}}},
3031
},
32+
{
33+
kind: 'VariableDefinition',
34+
variable: {kind: 'Variable', name: {kind: 'Name', value: 'organizationId'}},
35+
type: {kind: 'NonNullType', type: {kind: 'NamedType', name: {kind: 'Name', value: 'ID'}}},
36+
},
3137
],
3238
selectionSet: {
3339
kind: 'SelectionSet',
@@ -41,6 +47,11 @@ export const CreateApp = {
4147
name: {kind: 'Name', value: 'initialVersion'},
4248
value: {kind: 'Variable', name: {kind: 'Name', value: 'initialVersion'}},
4349
},
50+
{
51+
kind: 'Argument',
52+
name: {kind: 'Name', value: 'organizationId'},
53+
value: {kind: 'Variable', name: {kind: 'Name', value: 'organizationId'}},
54+
},
4455
],
4556
selectionSet: {
4657
kind: 'SelectionSet',

packages/app/src/cli/api/graphql/app-management/generated/create-asset-url.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {TypedDocumentNode as DocumentNode} from '@graphql-typed-document-node/co
55

66
export type CreateAssetUrlMutationVariables = Types.Exact<{
77
sourceExtension: Types.SourceExtension
8+
organizationId: Types.Scalars['ID']['input']
89
}>
910

1011
export type CreateAssetUrlMutation = {
@@ -27,6 +28,11 @@ export const CreateAssetUrl = {
2728
variable: {kind: 'Variable', name: {kind: 'Name', value: 'sourceExtension'}},
2829
type: {kind: 'NonNullType', type: {kind: 'NamedType', name: {kind: 'Name', value: 'SourceExtension'}}},
2930
},
31+
{
32+
kind: 'VariableDefinition',
33+
variable: {kind: 'Variable', name: {kind: 'Name', value: 'organizationId'}},
34+
type: {kind: 'NonNullType', type: {kind: 'NamedType', name: {kind: 'Name', value: 'ID'}}},
35+
},
3036
],
3137
selectionSet: {
3238
kind: 'SelectionSet',
@@ -40,6 +46,11 @@ export const CreateAssetUrl = {
4046
name: {kind: 'Name', value: 'sourceExtension'},
4147
value: {kind: 'Variable', name: {kind: 'Name', value: 'sourceExtension'}},
4248
},
49+
{
50+
kind: 'Argument',
51+
name: {kind: 'Name', value: 'organizationId'},
52+
value: {kind: 'Variable', name: {kind: 'Name', value: 'organizationId'}},
53+
},
4354
],
4455
selectionSet: {
4556
kind: 'SelectionSet',

packages/app/src/cli/api/graphql/app-management/generated/specifications.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import * as Types from './types.js'
33

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

6-
export type FetchSpecificationsQueryVariables = Types.Exact<{[key: string]: never}>
6+
export type FetchSpecificationsQueryVariables = Types.Exact<{
7+
organizationId: Types.Scalars['ID']['input']
8+
}>
79

810
export type FetchSpecificationsQuery = {
911
specifications: {
@@ -25,12 +27,26 @@ export const FetchSpecifications = {
2527
kind: 'OperationDefinition',
2628
operation: 'query',
2729
name: {kind: 'Name', value: 'fetchSpecifications'},
30+
variableDefinitions: [
31+
{
32+
kind: 'VariableDefinition',
33+
variable: {kind: 'Variable', name: {kind: 'Name', value: 'organizationId'}},
34+
type: {kind: 'NonNullType', type: {kind: 'NamedType', name: {kind: 'Name', value: 'ID'}}},
35+
},
36+
],
2837
selectionSet: {
2938
kind: 'SelectionSet',
3039
selections: [
3140
{
3241
kind: 'Field',
3342
name: {kind: 'Name', value: 'specifications'},
43+
arguments: [
44+
{
45+
kind: 'Argument',
46+
name: {kind: 'Name', value: 'organizationId'},
47+
value: {kind: 'Variable', name: {kind: 'Name', value: 'organizationId'}},
48+
},
49+
],
3450
selectionSet: {
3551
kind: 'SelectionSet',
3652
selections: [

packages/app/src/cli/api/graphql/app-management/queries/active-app-release.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ query activeAppRelease($appId: ID!) {
77
fragment AppVersionInfo on App {
88
id
99
key
10+
organizationId
1011
activeRoot {
1112
clientCredentials {
1213
secrets {

packages/app/src/cli/api/graphql/app-management/queries/create-app.graphql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
mutation CreateApp($initialVersion: AppVersionInput!) {
2-
appCreate(initialVersion: $initialVersion) {
1+
mutation CreateApp($initialVersion: AppVersionInput!, $organizationId: ID!) {
2+
appCreate(initialVersion: $initialVersion, organizationId: $organizationId) {
33
app {
44
id
55
key

packages/app/src/cli/api/graphql/app-management/queries/create-asset-url.graphql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
mutation CreateAssetURL($sourceExtension: SourceExtension!) {
2-
appRequestSourceUploadUrl(sourceExtension: $sourceExtension) {
1+
mutation CreateAssetURL($sourceExtension: SourceExtension!, $organizationId: ID!) {
2+
appRequestSourceUploadUrl(sourceExtension: $sourceExtension, organizationId: $organizationId) {
33
sourceUploadUrl
44
userErrors {
55
field

packages/app/src/cli/api/graphql/app-management/queries/specifications.graphql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
query fetchSpecifications {
2-
specifications {
1+
query fetchSpecifications($organizationId: ID!) {
2+
specifications(organizationId: $organizationId) {
33
name
44
identifier
55
externalIdentifier

packages/app/src/cli/utilities/developer-platform-client/app-management-client.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
GatedExtensionTemplate,
44
allowedTemplates,
55
diffAppModules,
6-
encodedGidFromOrganizationId,
6+
encodedGidFromOrganizationIdForBP,
77
encodedGidFromShopId,
88
versionDeepLink,
99
} from './app-management-client.js'
@@ -151,7 +151,7 @@ describe('templateSpecifications', () => {
151151
vi.mocked(fetch).mockImplementation(mockedFetch)
152152
const mockedFetchFlagsResponse: OrganizationBetaFlagsQuerySchema = {
153153
organization: {
154-
id: encodedGidFromOrganizationId(orgApp.organizationId),
154+
id: encodedGidFromOrganizationIdForBP(orgApp.organizationId),
155155
flag_allowedFlag: true,
156156
},
157157
}
@@ -178,7 +178,7 @@ describe('templateSpecifications', () => {
178178
vi.mocked(fetch).mockImplementation(mockedFetch)
179179
const mockedFetchFlagsResponse: OrganizationBetaFlagsQuerySchema = {
180180
organization: {
181-
id: encodedGidFromOrganizationId(orgApp.organizationId),
181+
id: encodedGidFromOrganizationIdForBP(orgApp.organizationId),
182182
flag_allowedFlag: true,
183183
flag_notAllowedFlag: false,
184184
},
@@ -203,7 +203,7 @@ describe('templateSpecifications', () => {
203203
}`,
204204
token: 'business-platform-token',
205205
organizationId: orgApp.organizationId,
206-
variables: {organizationId: encodedGidFromOrganizationId(orgApp.organizationId)},
206+
variables: {organizationId: encodedGidFromOrganizationIdForBP(orgApp.organizationId)},
207207
unauthorizedHandler: {
208208
type: 'token_refresh',
209209
handler: expect.any(Function),
@@ -227,7 +227,7 @@ describe('templateSpecifications', () => {
227227
vi.mocked(fetch).mockImplementation(mockedFetch)
228228
const mockedFetchFlagsResponse: OrganizationBetaFlagsQuerySchema = {
229229
organization: {
230-
id: encodedGidFromOrganizationId(orgApp.organizationId),
230+
id: encodedGidFromOrganizationIdForBP(orgApp.organizationId),
231231
flag_allowedFlag: true,
232232
},
233233
}
@@ -417,6 +417,7 @@ describe('createApp', () => {
417417
query: CreateApp,
418418
token: 'token',
419419
variables: {
420+
organizationId: 'gid://shopify/Organization/1',
420421
initialVersion: {
421422
source: {
422423
name: 'app-name',
@@ -506,6 +507,7 @@ describe('createApp', () => {
506507
query: CreateApp,
507508
token: 'token',
508509
variables: {
510+
organizationId: 'gid://shopify/Organization/1',
509511
initialVersion: {
510512
source: {
511513
name: 'app-name',

0 commit comments

Comments
 (0)