Skip to content
Open
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,119 @@
/* eslint-disable @typescript-eslint/consistent-type-definitions, @typescript-eslint/no-duplicate-type-constituents */
import * as Types from './types.js'

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

export type FetchStoreByDomainQueryVariables = Types.Exact<{
domain?: Types.InputMaybe<Types.Scalars['String']['input']>
}>

export type FetchStoreByDomainQuery = {
organization?: {
id: string
name: string
accessibleShops?: {
edges: {
node: {
id: string
externalId?: string | null
name: string
storeType?: Types.Store | null
primaryDomain?: string | null
shortName?: string | null
url?: string | null
}
}[]
} | null
currentUser?: {organizationPermissions: string[]} | {organizationPermissions: string[]} | null
} | null
}

export const FetchStoreByDomain = {
kind: 'Document',
definitions: [
{
kind: 'OperationDefinition',
operation: 'query',
name: {kind: 'Name', value: 'FetchStoreByDomain'},
variableDefinitions: [
{
kind: 'VariableDefinition',
variable: {kind: 'Variable', name: {kind: 'Name', value: 'domain'}},
type: {kind: 'NamedType', name: {kind: 'Name', value: 'String'}},
},
],
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: {kind: 'Name', value: 'organization'},
selectionSet: {
kind: 'SelectionSet',
selections: [
{kind: 'Field', name: {kind: 'Name', value: 'id'}},
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
{
kind: 'Field',
name: {kind: 'Name', value: 'accessibleShops'},
arguments: [
{
kind: 'Argument',
name: {kind: 'Name', value: 'search'},
value: {kind: 'Variable', name: {kind: 'Name', value: 'domain'}},
},
],
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: {kind: 'Name', value: 'edges'},
selectionSet: {
kind: 'SelectionSet',
selections: [
{
kind: 'Field',
name: {kind: 'Name', value: 'node'},
selectionSet: {
kind: 'SelectionSet',
selections: [
{kind: 'Field', name: {kind: 'Name', value: 'id'}},
{kind: 'Field', name: {kind: 'Name', value: 'externalId'}},
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
{kind: 'Field', name: {kind: 'Name', value: 'storeType'}},
{kind: 'Field', name: {kind: 'Name', value: 'primaryDomain'}},
{kind: 'Field', name: {kind: 'Name', value: 'shortName'}},
{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: '__typename'}},
],
},
},
{
kind: 'Field',
name: {kind: 'Name', value: 'currentUser'},
selectionSet: {
kind: 'SelectionSet',
selections: [
{kind: 'Field', name: {kind: 'Name', value: 'organizationPermissions'}},
{kind: 'Field', name: {kind: 'Name', value: '__typename'}},
],
},
},
{kind: 'Field', name: {kind: 'Name', value: '__typename'}},
],
},
},
],
},
},
],
} as unknown as DocumentNode<FetchStoreByDomainQuery, FetchStoreByDomainQueryVariables>
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
query FetchDevStoreByDomain($domain: String) {
organization {
id
name
accessibleShops(filters: {field: STORE_TYPE, operator: EQUALS, value: "app_development"}, search: $domain) {
edges {
node {
id
externalId
name
storeType
primaryDomain
shortName
url
}
query FetchDevStoreByDomain($domain: String) {
organization {
id
name
accessibleShops(filters: {field: STORE_TYPE, operator: EQUALS, value: "app_development"}, search: $domain) {
edges {
node {
id
externalId
name
storeType
primaryDomain
shortName
url
}
}
currentUser {
organizationPermissions
}
}
currentUser {
organizationPermissions
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
query FetchStoreByDomain($domain: String) {
organization {
id
name
accessibleShops(search: $domain) {
edges {
node {
id
externalId
name
storeType
primaryDomain
shortName
url
}
}
}
currentUser {
organizationPermissions
}
}
}
2 changes: 1 addition & 1 deletion packages/app/src/cli/commands/app/bulk/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default class BulkExecute extends AppLinkedCommand {
await executeBulkOperation({
organization: appContextResult.organization,
remoteApp: appContextResult.remoteApp,
storeFqdn: store.shopDomain,
store,
query,
variables: flags.variables,
variableFile: flags['variable-file'],
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/cli/commands/app/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class Execute extends AppLinkedCommand {
await executeOperation({
organization: appContextResult.organization,
remoteApp: appContextResult.remoteApp,
storeFqdn: store.shopDomain,
store,
query,
variables: flags.variables,
variableFile: flags['variable-file'],
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/cli/models/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,5 @@ export interface OrganizationStore {
transferDisabled: boolean
convertableToPartnerTest: boolean
provisionable: boolean
storeType?: string
}
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,19 @@ describe('getBulkOperationStatus', () => {
)
})

test('uses resolved API version in admin request', async () => {
vi.mocked(resolveApiVersion).mockResolvedValue('test-api-version')
vi.mocked(adminRequestDoc).mockResolvedValue(mockBulkOperation({status: 'RUNNING'}))

await getBulkOperationStatus({organization: mockOrganization, storeFqdn, operationId, remoteApp})

expect(adminRequestDoc).toHaveBeenCalledWith(
expect.objectContaining({
version: 'test-api-version',
}),
)
})

describe('time formatting', () => {
test('uses "Started" for running operations', async () => {
vi.mocked(adminRequestDoc).mockResolvedValue(mockBulkOperation({status: 'RUNNING'}))
Expand Down Expand Up @@ -386,4 +399,17 @@ describe('listBulkOperations', () => {
}),
)
})

test('uses resolved API version in admin request', async () => {
vi.mocked(resolveApiVersion).mockResolvedValue('test-api-version')
vi.mocked(adminRequestDoc).mockResolvedValue(mockBulkOperationsList([]))

await listBulkOperations({organization: mockOrganization, storeFqdn, remoteApp})

expect(adminRequestDoc).toHaveBeenCalledWith(
expect.objectContaining({
version: 'test-api-version',
}),
)
})
})
Loading
Loading