11import { runBulkOperationQuery } from './run-query.js'
22import { runBulkOperationMutation } from './run-mutation.js'
3- < << << << HEAD
4- import { AppLinkedInterface } from '../../models/app/app.js'
5- import { renderSuccess , renderInfo , renderWarning } from '@shopify/cli-kit/node/ui'
6- import { outputContent , outputToken } from '@shopify/cli-kit/node/output'
7- import { ensureAuthenticatedAdmin } from '@shopify/cli-kit/node/session'
8- import { AbortError } from '@shopify/cli-kit/node/error'
9- import { parse } from 'graphql'
10-
11- = === ===
123import { formatBulkOperationStatus } from './format-bulk-operation-status.js'
134import {
145 GetBulkOperationById ,
@@ -20,6 +11,7 @@ import {ensureAuthenticatedAdmin} from '@shopify/cli-kit/node/session'
2011import { outputContent , outputToken } from '@shopify/cli-kit/node/output'
2112import { adminRequestDoc } from '@shopify/cli-kit/node/api/admin'
2213import { sleep } from '@shopify/cli-kit/node/system'
14+ import { AbortError } from '@shopify/cli-kit/node/error'
2315import { parse } from 'graphql'
2416
2517const TERMINAL_STATUSES = [ 'COMPLETED' , 'FAILED' , 'CANCELED' , 'EXPIRED' ]
@@ -30,24 +22,16 @@ type BulkOperation = NonNullable<GetBulkOperationByIdQuery['bulkOperation']> & {
3022 objectCount : unknown
3123}
3224
33- > >>> >>> f9d62c9956 ( move back from tsx to ts )
3425interface ExecuteBulkOperationInput {
3526 app : AppLinkedInterface
3627 storeFqdn : string
3728 query : string
3829 variables ?: string [ ]
39- << < < < << HEAD
40- }
41-
42- export async function executeBulkOperation ( input : ExecuteBulkOperationInput ) : Promise < void > {
43- const { app, storeFqdn, query, variables} = input
44- === = ===
4530 watch ?: boolean
4631}
4732
4833export async function executeBulkOperation ( input : ExecuteBulkOperationInput ) : Promise < void > {
4934 const { app, storeFqdn, query, variables, watch = false } = input
50- >>> > >>> f9d62c9956 ( move back from tsx to ts )
5135
5236 renderInfo ( {
5337 headline : 'Starting bulk operation.' ,
@@ -56,7 +40,6 @@ export async function executeBulkOperation(input: ExecuteBulkOperationInput): Pr
5640
5741 const adminSession = await ensureAuthenticatedAdmin ( storeFqdn )
5842
59- << < < < << HEAD
6043 const operationIsMutation = isMutation ( query )
6144 if ( ! operationIsMutation && variables ) {
6245 throw new AbortError (
@@ -65,9 +48,6 @@ export async function executeBulkOperation(input: ExecuteBulkOperationInput): Pr
6548 }
6649
6750 const bulkOperationResponse = operationIsMutation
68- === = ===
69- const bulkOperationResponse = isMutation ( query )
70- >>> > >>> f9d62c9956 ( move back from tsx to ts )
7151 ? await runBulkOperationMutation ( { adminSession, query, variables} )
7252 : await runBulkOperationQuery ( { adminSession, query} )
7353
@@ -87,31 +67,6 @@ export async function executeBulkOperation(input: ExecuteBulkOperationInput): Pr
8767
8868 const result = bulkOperationResponse ?. bulkOperation
8969 if ( result ) {
90- < < < << << HEAD
91- const infoSections = [
92- {
93- title : 'Bulk Operation Created' ,
94- body : [
95- {
96- list : {
97- items : [
98- outputContent `ID: ${outputToken . cyan ( result . id ) } `. value ,
99- outputContent `Status: ${outputToken . yellow ( result . status ) } `. value ,
100- outputContent `Created: ${outputToken . gray ( String ( result . createdAt ) ) } `.value,
101- ],
102- },
103- },
104- ],
105- },
106- ]
107-
108- renderInfo({customSections: infoSections})
109-
110- renderSuccess({
111- headline: 'Bulk operation started successfully!',
112- body: 'Congrats!',
113- })
114- =======
11570 if ( watch ) {
11671 const finalOperation = await renderSingleTask < BulkOperation > ( {
11772 title : outputContent `Starting bulk operation...` ,
@@ -187,7 +142,6 @@ export async function executeBulkOperation(input: ExecuteBulkOperationInput): Pr
187142 body : 'Congrats!' ,
188143 } )
189144 }
190- >>> >>> > f9d62c9956 ( move back from tsx to ts )
191145 }
192146}
193147
0 commit comments