Skip to content

Commit 3a5f9e6

Browse files
committed
reverting to using a full flag so it gets automatically included in monorail payload args field
1 parent 4a55871 commit 3a5f9e6

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
@@ -1191,6 +1191,15 @@
11911191
"isOptional": true,
11921192
"environmentValue": "SHOPIFY_FLAG_VERBOSE"
11931193
},
1194+
{
1195+
"filePath": "docs-shopify.dev/commands/interfaces/app-function-run.interface.ts",
1196+
"syntaxKind": "PropertySignature",
1197+
"name": "-b, --invoked-by <value>",
1198+
"value": "string",
1199+
"description": "The client that invoked this command.",
1200+
"isOptional": true,
1201+
"environmentValue": "SHOPIFY_FLAG_INVOKED_BY"
1202+
},
11941203
{
11951204
"filePath": "docs-shopify.dev/commands/interfaces/app-function-run.interface.ts",
11961205
"syntaxKind": "PropertySignature",
@@ -1228,7 +1237,7 @@
12281237
"environmentValue": "SHOPIFY_FLAG_JSON"
12291238
}
12301239
],
1231-
"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}"
1240+
"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}"
12321241
}
12331242
}
12341243
}

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
@@ -381,19 +381,20 @@ Run a function locally for testing.
381381

382382
```
383383
USAGE
384-
$ shopify app function run [--client-id <value> | -c <value>] [-e <value>] [-i <value>] [-j] [--no-color] [--path
385-
<value>] [--reset | ] [--verbose]
386-
387-
FLAGS
388-
-c, --config=<value> The name of the app configuration.
389-
-e, --export=<value> Name of the WebAssembly export to invoke.
390-
-i, --input=<value> The input JSON to pass to the function. If omitted, standard input is used.
391-
-j, --json Output the result as JSON.
392-
--client-id=<value> The Client ID of your app.
393-
--no-color Disable color output.
394-
--path=<value> The path to your function directory.
395-
--reset Reset all your settings.
396-
--verbose Increase the verbosity of the output.
384+
$ shopify app function run [--client-id <value> | -c <value>] [-e <value>] [-i <value>] [-b <value>] [-j]
385+
[--no-color] [--path <value>] [--reset | ] [--verbose]
386+
387+
FLAGS
388+
-b, --invoked-by=<value> The client that invoked this command.
389+
-c, --config=<value> The name of the app configuration.
390+
-e, --export=<value> Name of the WebAssembly export to invoke.
391+
-i, --input=<value> The input JSON to pass to the function. If omitted, standard input is used.
392+
-j, --json Output the result as JSON.
393+
--client-id=<value> The Client ID of your app.
394+
--no-color Disable color output.
395+
--path=<value> The path to your function directory.
396+
--reset Reset all your settings.
397+
--verbose Increase the verbosity of the output.
397398
398399
DESCRIPTION
399400
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
@@ -1091,6 +1091,15 @@
10911091
"name": "input",
10921092
"type": "option"
10931093
},
1094+
"invoked-by": {
1095+
"char": "b",
1096+
"description": "The client that invoked this command.",
1097+
"env": "SHOPIFY_FLAG_INVOKED_BY",
1098+
"hasDynamicHelp": false,
1099+
"multiple": false,
1100+
"name": "invoked-by",
1101+
"type": "option"
1102+
},
10941103
"json": {
10951104
"allowNo": false,
10961105
"char": "j",

0 commit comments

Comments
 (0)