Skip to content

Commit 58585e0

Browse files
committed
reverting to using a full flag so it gets automatically included in monorail payload args field
1 parent fe35d01 commit 58585e0

File tree

6 files changed

+44
-24
lines changed

6 files changed

+44
-24
lines changed

docs-shopify.dev/commands/interfaces/app-function-run.interface.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ export interface appfunctionrun {
2424
*/
2525
'-i, --input <value>'?: string
2626

27+
/**
28+
* The client that invoked this command.
29+
* @environment SHOPIFY_FLAG_INVOKED_BY
30+
*/
31+
'-b, --invoked-by <value>'?: string
32+
2733
/**
2834
* Output the result as JSON.
2935
* @environment SHOPIFY_FLAG_JSON

docs-shopify.dev/generated/generated_docs_data.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1292,6 +1292,15 @@
12921292
"isOptional": true,
12931293
"environmentValue": "SHOPIFY_FLAG_VERBOSE"
12941294
},
1295+
{
1296+
"filePath": "docs-shopify.dev/commands/interfaces/app-function-run.interface.ts",
1297+
"syntaxKind": "PropertySignature",
1298+
"name": "-b, --invoked-by <value>",
1299+
"value": "string",
1300+
"description": "The client that invoked this command.",
1301+
"isOptional": true,
1302+
"environmentValue": "SHOPIFY_FLAG_INVOKED_BY"
1303+
},
12951304
{
12961305
"filePath": "docs-shopify.dev/commands/interfaces/app-function-run.interface.ts",
12971306
"syntaxKind": "PropertySignature",
@@ -1329,7 +1338,7 @@
13291338
"environmentValue": "SHOPIFY_FLAG_JSON"
13301339
}
13311340
],
1332-
"value": "export interface appfunctionrun {\n /**\n * The Client ID of your app.\n * @environment SHOPIFY_FLAG_CLIENT_ID\n */\n '--client-id <value>'?: string\n\n /**\n * The name of the app configuration.\n * @environment SHOPIFY_FLAG_APP_CONFIG\n */\n '-c, --config <value>'?: string\n\n /**\n * Name of the WebAssembly export to invoke.\n * @environment SHOPIFY_FLAG_EXPORT\n */\n '-e, --export <value>'?: string\n\n /**\n * The input JSON to pass to the function. If omitted, standard input is used.\n * @environment SHOPIFY_FLAG_INPUT\n */\n '-i, --input <value>'?: string\n\n /**\n * Output the result as JSON.\n * @environment SHOPIFY_FLAG_JSON\n */\n '-j, --json'?: ''\n\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * The path to your function directory.\n * @environment SHOPIFY_FLAG_PATH\n */\n '--path <value>'?: string\n\n /**\n * Reset all your settings.\n * @environment SHOPIFY_FLAG_RESET\n */\n '--reset'?: ''\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n}"
1341+
"value": "export interface appfunctionrun {\n /**\n * The Client ID of your app.\n * @environment SHOPIFY_FLAG_CLIENT_ID\n */\n '--client-id <value>'?: string\n\n /**\n * The name of the app configuration.\n * @environment SHOPIFY_FLAG_APP_CONFIG\n */\n '-c, --config <value>'?: string\n\n /**\n * Name of the WebAssembly export to invoke.\n * @environment SHOPIFY_FLAG_EXPORT\n */\n '-e, --export <value>'?: string\n\n /**\n * The input JSON to pass to the function. If omitted, standard input is used.\n * @environment SHOPIFY_FLAG_INPUT\n */\n '-i, --input <value>'?: string\n\n /**\n * The client that invoked this command.\n * @environment SHOPIFY_FLAG_INVOKED_BY\n */\n '-b, --invoked-by <value>'?: string\n\n /**\n * Output the result as JSON.\n * @environment SHOPIFY_FLAG_JSON\n */\n '-j, --json'?: ''\n\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * The path to your function directory.\n * @environment SHOPIFY_FLAG_PATH\n */\n '--path <value>'?: string\n\n /**\n * Reset all your settings.\n * @environment SHOPIFY_FLAG_RESET\n */\n '--reset'?: ''\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n}"
13331342
}
13341343
}
13351344
}

packages/app/src/cli/commands/app/function/run.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {globalFlags, jsonFlag} from '@shopify/cli-kit/node/cli'
77
import {Flags} from '@oclif/core'
88
import {renderAutocompletePrompt, isTTY} from '@shopify/cli-kit/node/ui'
99
import {outputDebug} from '@shopify/cli-kit/node/output'
10-
import {addPublicMetadata} from '@shopify/cli-kit/node/metadata'
1110

1211
const DEFAULT_FUNCTION_EXPORT = '_start'
1312

@@ -34,19 +33,16 @@ export default class FunctionRun extends AppUnlinkedCommand {
3433
description: 'Name of the WebAssembly export to invoke.',
3534
env: 'SHOPIFY_FLAG_EXPORT',
3635
}),
36+
'invoked-by': Flags.string({
37+
char: 'b',
38+
description: 'The client that invoked this command.',
39+
env: 'SHOPIFY_FLAG_INVOKED_BY',
40+
}),
3741
}
3842

3943
public async run(): Promise<AppUnlinkedCommandOutput> {
4044
const {flags} = await this.parse(FunctionRun)
4145

42-
// Track which client invoked this command
43-
const invokedBy = process.env.INVOKED_BY
44-
if (invokedBy) {
45-
await addPublicMetadata(() => ({
46-
cmd_all_invoked_by: invokedBy,
47-
}))
48-
}
49-
5046
let functionExport = DEFAULT_FUNCTION_EXPORT
5147

5248
const app = await localAppContext({

packages/cli-kit/src/public/node/monorail.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export interface Schemas {
5757
cmd_all_exit?: Optional<string>
5858
cmd_all_force?: Optional<boolean>
5959
cmd_all_last_graphql_request_id?: Optional<string>
60-
cmd_all_invoked_by?: Optional<string>
6160

6261
cmd_all_timing_network_ms?: Optional<number>
6362
cmd_all_timing_prompts_ms?: Optional<number>

packages/cli/README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -414,19 +414,20 @@ Run a function locally for testing.
414414

415415
```
416416
USAGE
417-
$ shopify app function run [--client-id <value> | -c <value>] [-e <value>] [-i <value>] [-j] [--no-color] [--path
418-
<value>] [--reset | ] [--verbose]
419-
420-
FLAGS
421-
-c, --config=<value> The name of the app configuration.
422-
-e, --export=<value> Name of the WebAssembly export to invoke.
423-
-i, --input=<value> The input JSON to pass to the function. If omitted, standard input is used.
424-
-j, --json Output the result as JSON.
425-
--client-id=<value> The Client ID of your app.
426-
--no-color Disable color output.
427-
--path=<value> The path to your function directory.
428-
--reset Reset all your settings.
429-
--verbose Increase the verbosity of the output.
417+
$ shopify app function run [--client-id <value> | -c <value>] [-e <value>] [-i <value>] [-b <value>] [-j]
418+
[--no-color] [--path <value>] [--reset | ] [--verbose]
419+
420+
FLAGS
421+
-b, --invoked-by=<value> The client that invoked this command.
422+
-c, --config=<value> The name of the app configuration.
423+
-e, --export=<value> Name of the WebAssembly export to invoke.
424+
-i, --input=<value> The input JSON to pass to the function. If omitted, standard input is used.
425+
-j, --json Output the result as JSON.
426+
--client-id=<value> The Client ID of your app.
427+
--no-color Disable color output.
428+
--path=<value> The path to your function directory.
429+
--reset Reset all your settings.
430+
--verbose Increase the verbosity of the output.
430431
431432
DESCRIPTION
432433
Run a function locally for testing.

packages/cli/oclif.manifest.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,15 @@
11311131
"name": "input",
11321132
"type": "option"
11331133
},
1134+
"invoked-by": {
1135+
"char": "b",
1136+
"description": "The client that invoked this command.",
1137+
"env": "SHOPIFY_FLAG_INVOKED_BY",
1138+
"hasDynamicHelp": false,
1139+
"multiple": false,
1140+
"name": "invoked-by",
1141+
"type": "option"
1142+
},
11341143
"json": {
11351144
"allowNo": false,
11361145
"char": "j",

0 commit comments

Comments
 (0)