@xano/cli 1.3.1 → 1.3.3
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 +2 -2
- package/dist/commands/function/run/index.js +11 -5
- package/oclif.manifest.json +2981 -2981
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -387,8 +387,8 @@ Input flexibility for `function run` (assembled into one JSON `input` object):
|
|
|
387
387
|
to run against `live`; an unknown label is rejected by the server with
|
|
388
388
|
`Invalid data source.`
|
|
389
389
|
|
|
390
|
-
`-t/--tenant <name>` runs the function on that tenant
|
|
391
|
-
|
|
390
|
+
`-t/--tenant <name>` runs the function on that tenant instead of the workspace by sending
|
|
391
|
+
the `X-Tenant` header (also used when reading the function's declared inputs).
|
|
392
392
|
|
|
393
393
|
Merge order is JSON base first, then `--data` overrides. Missing required inputs are
|
|
394
394
|
prompted for on an interactive terminal; in a non-TTY (CI) context the command fails
|
|
@@ -103,6 +103,7 @@ export default class FunctionRun extends BaseCommand {
|
|
|
103
103
|
branch,
|
|
104
104
|
name: functionName,
|
|
105
105
|
profile,
|
|
106
|
+
tenant: flags.tenant,
|
|
106
107
|
verbose: flags.verbose,
|
|
107
108
|
workspaceId,
|
|
108
109
|
});
|
|
@@ -114,9 +115,8 @@ export default class FunctionRun extends BaseCommand {
|
|
|
114
115
|
input = await this.promptForMissing(input, missingRequired);
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
|
-
// 3) Execute via the meta run endpoint
|
|
118
|
-
const
|
|
119
|
-
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}${tenantPath}/function/run`;
|
|
118
|
+
// 3) Execute via the meta run endpoint.
|
|
119
|
+
const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/function/run`;
|
|
120
120
|
const body = { input, name: functionName };
|
|
121
121
|
if (branch)
|
|
122
122
|
body.branch = branch;
|
|
@@ -132,6 +132,9 @@ export default class FunctionRun extends BaseCommand {
|
|
|
132
132
|
const dataSource = flags.datasource?.trim();
|
|
133
133
|
if (dataSource)
|
|
134
134
|
headers['X-Data-Source'] = dataSource;
|
|
135
|
+
// X-Tenant runs the function on that tenant instead of the workspace.
|
|
136
|
+
if (flags.tenant)
|
|
137
|
+
headers['X-Tenant'] = flags.tenant;
|
|
135
138
|
const response = await this.verboseFetch(apiUrl, {
|
|
136
139
|
body: JSON.stringify(body),
|
|
137
140
|
headers,
|
|
@@ -174,13 +177,16 @@ export default class FunctionRun extends BaseCommand {
|
|
|
174
177
|
* transient introspection problem never blocks an otherwise-valid run.
|
|
175
178
|
*/
|
|
176
179
|
async fetchFunctionByName(opts) {
|
|
177
|
-
const { branch, name, profile, verbose, workspaceId } = opts;
|
|
180
|
+
const { branch, name, profile, tenant, verbose, workspaceId } = opts;
|
|
178
181
|
const params = new URLSearchParams({ per_page: '100', search: name });
|
|
179
182
|
if (branch)
|
|
180
183
|
params.set('branch', branch);
|
|
181
184
|
const url = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/function?${params.toString()}`;
|
|
185
|
+
const headers = { accept: 'application/json', Authorization: `Bearer ${profile.access_token}` };
|
|
186
|
+
if (tenant)
|
|
187
|
+
headers['X-Tenant'] = tenant;
|
|
182
188
|
try {
|
|
183
|
-
const response = await this.verboseFetch(url, { headers
|
|
189
|
+
const response = await this.verboseFetch(url, { headers, method: 'GET' }, verbose, profile.access_token);
|
|
184
190
|
if (!response.ok)
|
|
185
191
|
return undefined;
|
|
186
192
|
const page = (await response.json());
|