@@ -4,6 +4,12 @@ import {linkedAppContext} from '../../services/app-context.js'
44import { storeContext } from '../../services/store-context.js'
55import { executeBulkOperation } from '../../services/bulk-operations/execute-bulk-operation.js'
66import { globalFlags } from '@shopify/cli-kit/node/cli'
7+ < << << << HEAD
8+ === === =
9+ import { renderSuccess , renderInfo , renderWarning } from '@shopify/cli-kit/node/ui'
10+ import { outputContent , outputToken } from '@shopify/cli-kit/node/output'
11+ import { parse , getOperationAST } from 'graphql'
12+ > >>> >>> 3e577 c18f0 ( implement mutation support for BulkOps CLI command )
713
814export default class Execute extends AppLinkedCommand {
915 static summary = 'Execute bulk operations.'
@@ -34,11 +40,31 @@ export default class Execute extends AppLinkedCommand {
3440 forceReselectStore : flags . reset ,
3541 } )
3642
43+ << < < < << HEAD
3744 await executeBulkOperation ( {
3845 app : appContextResult . app ,
3946 storeFqdn : store . shopDomain ,
4047 query : flags . query ,
4148 } )
49+ === = ===
50+ const operationType = getOperationAST ( parse ( flags . query ) ) ?. operation
51+
52+ renderInfo ( {
53+ headline : `Starting bulk operation ${ operationType } .` ,
54+ body : `App: ${ appContextResult . app . name } \nStore: ${ store . shopDomain } ` ,
55+ } )
56+
57+ let bulkOperationResponse
58+ if ( operationType === 'query' ) {
59+ bulkOperationResponse = await runBulkOperationQuery ( {
60+ storeFqdn : store . shopDomain ,
61+ query : flags . query ,
62+ } )
63+ }
64+ else if ( operationType === 'mutation' ) {
65+ // TODO: implement mutation support
66+ }
67+ >>> > >>> 3e577 c18f0 ( implement mutation support for BulkOps CLI command )
4268
4369 return { app : appContextResult . app }
4470 }
0 commit comments