@xano/cli 1.3.1-beta.0 → 1.3.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -475,6 +475,7 @@ xano function run <name> --json @payload.json --data env=staging # base payloa
475
475
  echo '{"email":"jo@x.com"}' | xano function run <name> --stdin -o json | jq .result
476
476
  xano function run <name> --branch dev --logs # run on a branch, show execution logs
477
477
  xano function run <name> --datasource test # run against the 'test' data source
478
+ xano function run <name> --tenant my-tenant # run on a tenant instead of the workspace
478
479
  ```
479
480
 
480
481
  `function create` and `function edit` save a function on the live branch through the publish policy gate. When
@@ -497,6 +498,9 @@ Input flexibility for `function run` (assembled into one JSON `input` object):
497
498
  to run against `live`; an unknown label is rejected by the server with
498
499
  `Invalid data source.`
499
500
 
501
+ `-t/--tenant <name>` runs the function on that tenant
502
+ (`/workspace/{id}/tenant/{name}/function/run`) instead of the workspace.
503
+
500
504
  Merge order is JSON base first, then `--data` overrides. Missing required inputs are
501
505
  prompted for on an interactive terminal; in a non-TTY (CI) context the command fails
502
506
  listing them. Output defaults to the raw `result` (`-o json`); the exit code is non-zero
@@ -15,6 +15,7 @@ export default class FunctionRun extends BaseCommand {
15
15
  'no-input-check': import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
16
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
17
17
  stdin: import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
+ tenant: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
19
  workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
20
  config: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
21
  profile: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -19,6 +19,8 @@ export default class FunctionRun extends BaseCommand {
19
19
  `$ xano function:run calcScore --branch dev --logs`,
20
20
  `$ xano function:run calcScore --datasource test
21
21
  # Runs against the 'test' data source instead of 'live'`,
22
+ `$ xano function:run calcScore --tenant my-tenant
23
+ # Runs the function on the tenant instead of the workspace`,
22
24
  ];
23
25
  static flags = {
24
26
  ...BaseCommand.baseFlags,
@@ -70,6 +72,11 @@ export default class FunctionRun extends BaseCommand {
70
72
  exclusive: ['json'],
71
73
  required: false,
72
74
  }),
75
+ tenant: Flags.string({
76
+ char: 't',
77
+ description: 'Tenant name to run the function on (defaults to the workspace)',
78
+ required: false,
79
+ }),
73
80
  workspace: Flags.string({
74
81
  char: 'w',
75
82
  description: 'Workspace ID (optional if set in profile)',
@@ -107,8 +114,9 @@ export default class FunctionRun extends BaseCommand {
107
114
  input = await this.promptForMissing(input, missingRequired);
108
115
  }
109
116
  }
110
- // 3) Execute via the meta run endpoint.
111
- const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/function/run`;
117
+ // 3) Execute via the meta run endpoint, scoped to the tenant when one is given.
118
+ const tenantPath = flags.tenant ? `/tenant/${encodeURIComponent(flags.tenant)}` : '';
119
+ const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}${tenantPath}/function/run`;
112
120
  const body = { input, name: functionName };
113
121
  if (branch)
114
122
  body.branch = branch;