Skip to content
Merged
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
@@ -1,13 +1,13 @@
import {appFlags, bulkOperationFlags} from '../../flags.js'
import AppLinkedCommand, {AppLinkedCommandOutput} from '../../utilities/app-linked-command.js'
import {linkedAppContext} from '../../services/app-context.js'
import {storeContext} from '../../services/store-context.js'
import {executeBulkOperation} from '../../services/bulk-operations/execute-bulk-operation.js'
import {appFlags, bulkOperationFlags} from '../../../flags.js'
import AppLinkedCommand, {AppLinkedCommandOutput} from '../../../utilities/app-linked-command.js'
import {linkedAppContext} from '../../../services/app-context.js'
import {storeContext} from '../../../services/store-context.js'
import {executeBulkOperation} from '../../../services/bulk-operations/execute-bulk-operation.js'
import {globalFlags} from '@shopify/cli-kit/node/cli'
import {readStdinString} from '@shopify/cli-kit/node/system'
import {AbortError} from '@shopify/cli-kit/node/error'

export default class Execute extends AppLinkedCommand {
export default class BulkExecute extends AppLinkedCommand {
static summary = 'Execute bulk operations.'

static description = 'Execute bulk operations against the Shopify Admin API.'
Expand All @@ -21,13 +21,13 @@ export default class Execute extends AppLinkedCommand {
}

async run(): Promise<AppLinkedCommandOutput> {
const {flags} = await this.parse(Execute)
const {flags} = await this.parse(BulkExecute)

const query = flags.query ?? (await readStdinString())
if (!query) {
throw new AbortError(
'No query provided. Use the --query flag or pipe input via stdin.',
'Example: echo "query { ... }" | shopify app execute',
'Example: echo "query { ... }" | shopify app bulk execute',
)
}

Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Logs from './commands/app/logs.js'
import Sources from './commands/app/app-logs/sources.js'
import EnvPull from './commands/app/env/pull.js'
import EnvShow from './commands/app/env/show.js'
import Execute from './commands/app/execute.js'
import Execute from './commands/app/bulk/execute.js'
import FunctionBuild from './commands/app/function/build.js'
import FunctionReplay from './commands/app/function/replay.js'
import FunctionRun from './commands/app/function/run.js'
Expand Down Expand Up @@ -53,7 +53,7 @@ export const commands: {[key: string]: typeof AppLinkedCommand | typeof AppUnlin
'app:config:pull': ConfigPull,
'app:env:pull': EnvPull,
'app:env:show': EnvShow,
'app:execute': Execute,
'app:bulk:execute': Execute,
'app:generate:schema': GenerateSchema,
'app:function:build': FunctionBuild,
'app:function:replay': FunctionReplay,
Expand Down
270 changes: 135 additions & 135 deletions packages/cli/oclif.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,141 @@
"strict": true,
"summary": "Build the app, including extensions."
},
"app:bulk:execute": {
"aliases": [
],
"args": {
},
"customPluginName": "@shopify/app",
"description": "Execute bulk operations against the Shopify Admin API.",
"flags": {
"client-id": {
"description": "The Client ID of your app.",
"env": "SHOPIFY_FLAG_CLIENT_ID",
"exclusive": [
"config"
],
"hasDynamicHelp": false,
"hidden": false,
"multiple": false,
"name": "client-id",
"type": "option"
},
"config": {
"char": "c",
"description": "The name of the app configuration.",
"env": "SHOPIFY_FLAG_APP_CONFIG",
"hasDynamicHelp": false,
"hidden": false,
"multiple": false,
"name": "config",
"type": "option"
},
"no-color": {
"allowNo": false,
"description": "Disable color output.",
"env": "SHOPIFY_FLAG_NO_COLOR",
"hidden": false,
"name": "no-color",
"type": "boolean"
},
"output-file": {
"description": "The file path where results should be written. If not specified, results will be written to STDOUT.",
"env": "SHOPIFY_FLAG_OUTPUT_FILE",
"hasDynamicHelp": false,
"multiple": false,
"name": "output-file",
"type": "option"
},
"path": {
"description": "The path to your app directory.",
"env": "SHOPIFY_FLAG_PATH",
"hasDynamicHelp": false,
"multiple": false,
"name": "path",
"noCacheDefault": true,
"type": "option"
},
"query": {
"char": "q",
"description": "The GraphQL query or mutation to run as a bulk operation. If omitted, reads from standard input.",
"env": "SHOPIFY_FLAG_QUERY",
"hasDynamicHelp": false,
"multiple": false,
"name": "query",
"required": false,
"type": "option"
},
"reset": {
"allowNo": false,
"description": "Reset all your settings.",
"env": "SHOPIFY_FLAG_RESET",
"exclusive": [
"config"
],
"hidden": false,
"name": "reset",
"type": "boolean"
},
"store": {
"char": "s",
"description": "The store domain. Must be an existing dev store.",
"env": "SHOPIFY_FLAG_STORE",
"hasDynamicHelp": false,
"multiple": false,
"name": "store",
"type": "option"
},
"variable-file": {
"description": "Path to a file containing GraphQL variables in JSONL format (one JSON object per line). Can't be used with --variables.",
"env": "SHOPIFY_FLAG_VARIABLE_FILE",
"exclusive": [
"variables"
],
"hasDynamicHelp": false,
"multiple": false,
"name": "variable-file",
"type": "option"
},
"variables": {
"char": "v",
"description": "The values for any GraphQL variables in your mutation, in JSON format. Can be specified multiple times.",
"env": "SHOPIFY_FLAG_VARIABLES",
"exclusive": [
"variable-file"
],
"hasDynamicHelp": false,
"multiple": true,
"name": "variables",
"type": "option"
},
"verbose": {
"allowNo": false,
"description": "Increase the verbosity of the output.",
"env": "SHOPIFY_FLAG_VERBOSE",
"hidden": false,
"name": "verbose",
"type": "boolean"
},
"watch": {
"allowNo": false,
"description": "Wait for bulk operation results before exiting.",
"env": "SHOPIFY_FLAG_WATCH",
"name": "watch",
"type": "boolean"
}
},
"hasDynamicHelp": false,
"hidden": true,
"hiddenAliases": [
],
"id": "app:bulk:execute",
"pluginAlias": "@shopify/cli",
"pluginName": "@shopify/cli",
"pluginType": "core",
"strict": true,
"summary": "Execute bulk operations."
},
"app:bulk:status": {
"aliases": [
],
Expand Down Expand Up @@ -981,141 +1116,6 @@
"strict": true,
"summary": "Display app and extensions environment variables."
},
"app:execute": {
"aliases": [
],
"args": {
},
"customPluginName": "@shopify/app",
"description": "Execute bulk operations against the Shopify Admin API.",
"flags": {
"client-id": {
"description": "The Client ID of your app.",
"env": "SHOPIFY_FLAG_CLIENT_ID",
"exclusive": [
"config"
],
"hasDynamicHelp": false,
"hidden": false,
"multiple": false,
"name": "client-id",
"type": "option"
},
"config": {
"char": "c",
"description": "The name of the app configuration.",
"env": "SHOPIFY_FLAG_APP_CONFIG",
"hasDynamicHelp": false,
"hidden": false,
"multiple": false,
"name": "config",
"type": "option"
},
"no-color": {
"allowNo": false,
"description": "Disable color output.",
"env": "SHOPIFY_FLAG_NO_COLOR",
"hidden": false,
"name": "no-color",
"type": "boolean"
},
"output-file": {
"description": "The file path where results should be written. If not specified, results will be written to STDOUT.",
"env": "SHOPIFY_FLAG_OUTPUT_FILE",
"hasDynamicHelp": false,
"multiple": false,
"name": "output-file",
"type": "option"
},
"path": {
"description": "The path to your app directory.",
"env": "SHOPIFY_FLAG_PATH",
"hasDynamicHelp": false,
"multiple": false,
"name": "path",
"noCacheDefault": true,
"type": "option"
},
"query": {
"char": "q",
"description": "The GraphQL query or mutation to run as a bulk operation. If omitted, reads from standard input.",
"env": "SHOPIFY_FLAG_QUERY",
"hasDynamicHelp": false,
"multiple": false,
"name": "query",
"required": false,
"type": "option"
},
"reset": {
"allowNo": false,
"description": "Reset all your settings.",
"env": "SHOPIFY_FLAG_RESET",
"exclusive": [
"config"
],
"hidden": false,
"name": "reset",
"type": "boolean"
},
"store": {
"char": "s",
"description": "The store domain. Must be an existing dev store.",
"env": "SHOPIFY_FLAG_STORE",
"hasDynamicHelp": false,
"multiple": false,
"name": "store",
"type": "option"
},
"variable-file": {
"description": "Path to a file containing GraphQL variables in JSONL format (one JSON object per line). Can't be used with --variables.",
"env": "SHOPIFY_FLAG_VARIABLE_FILE",
"exclusive": [
"variables"
],
"hasDynamicHelp": false,
"multiple": false,
"name": "variable-file",
"type": "option"
},
"variables": {
"char": "v",
"description": "The values for any GraphQL variables in your mutation, in JSON format. Can be specified multiple times.",
"env": "SHOPIFY_FLAG_VARIABLES",
"exclusive": [
"variable-file"
],
"hasDynamicHelp": false,
"multiple": true,
"name": "variables",
"type": "option"
},
"verbose": {
"allowNo": false,
"description": "Increase the verbosity of the output.",
"env": "SHOPIFY_FLAG_VERBOSE",
"hidden": false,
"name": "verbose",
"type": "boolean"
},
"watch": {
"allowNo": false,
"description": "Wait for bulk operation results before exiting.",
"env": "SHOPIFY_FLAG_WATCH",
"name": "watch",
"type": "boolean"
}
},
"hasDynamicHelp": false,
"hidden": true,
"hiddenAliases": [
],
"id": "app:execute",
"pluginAlias": "@shopify/cli",
"pluginName": "@shopify/cli",
"pluginType": "core",
"strict": true,
"summary": "Execute bulk operations."
},
"app:function:build": {
"aliases": [
],
Expand Down