@xano/cli 0.0.95-beta.13 → 0.0.95-beta.15

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.
@@ -57,39 +57,14 @@ Unit tests for tenant my-tenant:
57
57
  if (!workspaceId) {
58
58
  this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
59
59
  }
60
- // Resolve tenant to get its workspace
61
- const tenantUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${encodeURIComponent(flags.tenant)}`;
62
- let tenantWorkspaceId;
63
- try {
64
- const tenantResponse = await this.verboseFetch(tenantUrl, {
65
- headers: {
66
- accept: 'application/json',
67
- Authorization: `Bearer ${profile.access_token}`,
68
- },
69
- method: 'GET',
70
- }, flags.verbose, profile.access_token);
71
- if (!tenantResponse.ok) {
72
- const errorText = await tenantResponse.text();
73
- this.error(`Failed to find tenant '${flags.tenant}': ${tenantResponse.status}\n${errorText}`);
74
- }
75
- const tenant = (await tenantResponse.json());
76
- tenantWorkspaceId = String(tenant.workspace?.id || workspaceId);
77
- }
78
- catch (error) {
79
- if (error instanceof Error) {
80
- this.error(`Failed to resolve tenant: ${error.message}`);
81
- }
82
- else {
83
- this.error(`Failed to resolve tenant: ${String(error)}`);
84
- }
85
- }
60
+ const tenantName = encodeURIComponent(flags.tenant);
86
61
  const params = new URLSearchParams();
87
62
  params.set('per_page', '10000');
88
63
  if (flags.branch)
89
64
  params.set('branch', flags.branch);
90
65
  if (flags['obj-type'])
91
66
  params.set('obj_type', flags['obj-type']);
92
- const apiUrl = `${profile.instance_origin}/api:meta/workspace/${tenantWorkspaceId}/unit_test?${params}`;
67
+ const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/unit_test?${params}`;
93
68
  try {
94
69
  const response = await this.verboseFetch(apiUrl, {
95
70
  headers: {
@@ -53,33 +53,8 @@ Result: PASS
53
53
  if (!workspaceId) {
54
54
  this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
55
55
  }
56
- // Resolve tenant to get its workspace
57
- const tenantUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${encodeURIComponent(flags.tenant)}`;
58
- let tenantWorkspaceId;
59
- try {
60
- const tenantResponse = await this.verboseFetch(tenantUrl, {
61
- headers: {
62
- accept: 'application/json',
63
- Authorization: `Bearer ${profile.access_token}`,
64
- },
65
- method: 'GET',
66
- }, flags.verbose, profile.access_token);
67
- if (!tenantResponse.ok) {
68
- const errorText = await tenantResponse.text();
69
- this.error(`Failed to find tenant '${flags.tenant}': ${tenantResponse.status}\n${errorText}`);
70
- }
71
- const tenant = (await tenantResponse.json());
72
- tenantWorkspaceId = String(tenant.workspace?.id || workspaceId);
73
- }
74
- catch (error) {
75
- if (error instanceof Error) {
76
- this.error(`Failed to resolve tenant: ${error.message}`);
77
- }
78
- else {
79
- this.error(`Failed to resolve tenant: ${String(error)}`);
80
- }
81
- }
82
- const apiUrl = `${profile.instance_origin}/api:meta/workspace/${tenantWorkspaceId}/unit_test/${encodeURIComponent(args.unit_test_id)}/run`;
56
+ const tenantName = encodeURIComponent(flags.tenant);
57
+ const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/unit_test/${encodeURIComponent(args.unit_test_id)}/run`;
83
58
  try {
84
59
  if (flags.output === 'summary') {
85
60
  this.log(`Running unit test ${args.unit_test_id}...`);
@@ -62,33 +62,8 @@ Results: 4 passed, 1 failed
62
62
  if (!workspaceId) {
63
63
  this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
64
64
  }
65
- // Resolve tenant to get its workspace
66
- const tenantUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${encodeURIComponent(flags.tenant)}`;
67
- let tenantWorkspaceId;
68
- try {
69
- const tenantResponse = await this.verboseFetch(tenantUrl, {
70
- headers: {
71
- accept: 'application/json',
72
- Authorization: `Bearer ${profile.access_token}`,
73
- },
74
- method: 'GET',
75
- }, flags.verbose, profile.access_token);
76
- if (!tenantResponse.ok) {
77
- const errorText = await tenantResponse.text();
78
- this.error(`Failed to find tenant '${flags.tenant}': ${tenantResponse.status}\n${errorText}`);
79
- }
80
- const tenant = (await tenantResponse.json());
81
- tenantWorkspaceId = String(tenant.workspace?.id || workspaceId);
82
- }
83
- catch (error) {
84
- if (error instanceof Error) {
85
- this.error(`Failed to resolve tenant: ${error.message}`);
86
- }
87
- else {
88
- this.error(`Failed to resolve tenant: ${String(error)}`);
89
- }
90
- }
91
- const baseUrl = `${profile.instance_origin}/api:meta/workspace/${tenantWorkspaceId}/unit_test`;
65
+ const tenantName = encodeURIComponent(flags.tenant);
66
+ const baseUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/unit_test`;
92
67
  try {
93
68
  const listParams = new URLSearchParams();
94
69
  listParams.set('per_page', '10000');
@@ -52,33 +52,8 @@ Deleted workflow test 42
52
52
  if (!workspaceId) {
53
53
  this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
54
54
  }
55
- // Resolve tenant to get its workspace
56
- const tenantUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${encodeURIComponent(flags.tenant)}`;
57
- let tenantWorkspaceId;
58
- try {
59
- const tenantResponse = await this.verboseFetch(tenantUrl, {
60
- headers: {
61
- accept: 'application/json',
62
- Authorization: `Bearer ${profile.access_token}`,
63
- },
64
- method: 'GET',
65
- }, flags.verbose, profile.access_token);
66
- if (!tenantResponse.ok) {
67
- const errorText = await tenantResponse.text();
68
- this.error(`Failed to find tenant '${flags.tenant}': ${tenantResponse.status}\n${errorText}`);
69
- }
70
- const tenant = (await tenantResponse.json());
71
- tenantWorkspaceId = String(tenant.workspace?.id || workspaceId);
72
- }
73
- catch (error) {
74
- if (error instanceof Error) {
75
- this.error(`Failed to resolve tenant: ${error.message}`);
76
- }
77
- else {
78
- this.error(`Failed to resolve tenant: ${String(error)}`);
79
- }
80
- }
81
- const apiUrl = `${profile.instance_origin}/api:meta/workspace/${tenantWorkspaceId}/workflow_test/${args.workflow_test_id}`;
55
+ const tenantName = encodeURIComponent(flags.tenant);
56
+ const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/workflow_test/${args.workflow_test_id}`;
82
57
  try {
83
58
  const response = await this.verboseFetch(apiUrl, {
84
59
  headers: {
@@ -52,37 +52,12 @@ Workflow tests for tenant my-tenant:
52
52
  if (!workspaceId) {
53
53
  this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
54
54
  }
55
- // Resolve tenant to get its workspace
56
- const tenantUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${encodeURIComponent(flags.tenant)}`;
57
- let tenantWorkspaceId;
58
- try {
59
- const tenantResponse = await this.verboseFetch(tenantUrl, {
60
- headers: {
61
- accept: 'application/json',
62
- Authorization: `Bearer ${profile.access_token}`,
63
- },
64
- method: 'GET',
65
- }, flags.verbose, profile.access_token);
66
- if (!tenantResponse.ok) {
67
- const errorText = await tenantResponse.text();
68
- this.error(`Failed to find tenant '${flags.tenant}': ${tenantResponse.status}\n${errorText}`);
69
- }
70
- const tenant = (await tenantResponse.json());
71
- tenantWorkspaceId = String(tenant.workspace?.id || workspaceId);
72
- }
73
- catch (error) {
74
- if (error instanceof Error) {
75
- this.error(`Failed to resolve tenant: ${error.message}`);
76
- }
77
- else {
78
- this.error(`Failed to resolve tenant: ${String(error)}`);
79
- }
80
- }
55
+ const tenantName = encodeURIComponent(flags.tenant);
81
56
  const params = new URLSearchParams();
82
57
  params.set('per_page', '10000');
83
58
  if (flags.branch)
84
59
  params.set('branch', flags.branch);
85
- const apiUrl = `${profile.instance_origin}/api:meta/workspace/${tenantWorkspaceId}/workflow_test?${params}`;
60
+ const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/workflow_test?${params}`;
86
61
  try {
87
62
  const response = await this.verboseFetch(apiUrl, {
88
63
  headers: {
@@ -53,33 +53,8 @@ Result: PASS (0.25s)
53
53
  if (!workspaceId) {
54
54
  this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
55
55
  }
56
- // Resolve tenant to get its workspace
57
- const tenantUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${encodeURIComponent(flags.tenant)}`;
58
- let tenantWorkspaceId;
59
- try {
60
- const tenantResponse = await this.verboseFetch(tenantUrl, {
61
- headers: {
62
- accept: 'application/json',
63
- Authorization: `Bearer ${profile.access_token}`,
64
- },
65
- method: 'GET',
66
- }, flags.verbose, profile.access_token);
67
- if (!tenantResponse.ok) {
68
- const errorText = await tenantResponse.text();
69
- this.error(`Failed to find tenant '${flags.tenant}': ${tenantResponse.status}\n${errorText}`);
70
- }
71
- const tenant = (await tenantResponse.json());
72
- tenantWorkspaceId = String(tenant.workspace?.id || workspaceId);
73
- }
74
- catch (error) {
75
- if (error instanceof Error) {
76
- this.error(`Failed to resolve tenant: ${error.message}`);
77
- }
78
- else {
79
- this.error(`Failed to resolve tenant: ${String(error)}`);
80
- }
81
- }
82
- const apiUrl = `${profile.instance_origin}/api:meta/workspace/${tenantWorkspaceId}/workflow_test/${args.workflow_test_id}/run`;
56
+ const tenantName = encodeURIComponent(flags.tenant);
57
+ const apiUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/workflow_test/${args.workflow_test_id}/run`;
83
58
  try {
84
59
  if (flags.output === 'summary') {
85
60
  this.log(`Running workflow test ${args.workflow_test_id}...`);
@@ -57,33 +57,8 @@ Results: 2 passed, 1 failed
57
57
  if (!workspaceId) {
58
58
  this.error('No workspace ID provided. Use --workspace flag or set one in your profile.');
59
59
  }
60
- // Resolve tenant to get its workspace
61
- const tenantUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${encodeURIComponent(flags.tenant)}`;
62
- let tenantWorkspaceId;
63
- try {
64
- const tenantResponse = await this.verboseFetch(tenantUrl, {
65
- headers: {
66
- accept: 'application/json',
67
- Authorization: `Bearer ${profile.access_token}`,
68
- },
69
- method: 'GET',
70
- }, flags.verbose, profile.access_token);
71
- if (!tenantResponse.ok) {
72
- const errorText = await tenantResponse.text();
73
- this.error(`Failed to find tenant '${flags.tenant}': ${tenantResponse.status}\n${errorText}`);
74
- }
75
- const tenant = (await tenantResponse.json());
76
- tenantWorkspaceId = String(tenant.workspace?.id || workspaceId);
77
- }
78
- catch (error) {
79
- if (error instanceof Error) {
80
- this.error(`Failed to resolve tenant: ${error.message}`);
81
- }
82
- else {
83
- this.error(`Failed to resolve tenant: ${String(error)}`);
84
- }
85
- }
86
- const baseUrl = `${profile.instance_origin}/api:meta/workspace/${tenantWorkspaceId}/workflow_test`;
60
+ const tenantName = encodeURIComponent(flags.tenant);
61
+ const baseUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/workflow_test`;
87
62
  try {
88
63
  const listParams = new URLSearchParams();
89
64
  listParams.set('per_page', '10000');