@xano/cli 0.0.82-beta.0 → 0.0.82-beta.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.
@@ -6,6 +6,7 @@ export default class TenantDeployPlatform extends BaseCommand {
6
6
  static description: string;
7
7
  static examples: string[];
8
8
  static flags: {
9
+ license: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
10
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
11
  platform_id: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
11
12
  workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -17,9 +17,15 @@ export default class TenantDeployPlatform extends BaseCommand {
17
17
  Deployed platform 5 to tenant: My Tenant (my-tenant)
18
18
  `,
19
19
  `$ xano tenant deploy_platform t1234-abcd-xyz1 --platform_id 5 -o json`,
20
+ `$ xano tenant deploy_platform t1234-abcd-xyz1 --platform_id 5 --license ./license.yaml`,
20
21
  ];
21
22
  static flags = {
22
23
  ...BaseCommand.baseFlags,
24
+ license: Flags.string({
25
+ char: 'l',
26
+ description: 'Path to a license override file to apply after deploy',
27
+ required: false,
28
+ }),
23
29
  output: Flags.string({
24
30
  char: 'o',
25
31
  default: 'summary',
@@ -76,6 +82,28 @@ Deployed platform 5 to tenant: My Tenant (my-tenant)
76
82
  this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
77
83
  }
78
84
  const tenant = (await response.json());
85
+ // Apply license override if provided
86
+ if (flags.license) {
87
+ const licensePath = path.resolve(flags.license);
88
+ if (!fs.existsSync(licensePath)) {
89
+ this.error(`License file not found: ${licensePath}`);
90
+ }
91
+ const licenseValue = fs.readFileSync(licensePath, 'utf8');
92
+ const licenseUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/license`;
93
+ const licenseResponse = await this.verboseFetch(licenseUrl, {
94
+ body: JSON.stringify({ value: licenseValue }),
95
+ headers: {
96
+ accept: 'application/json',
97
+ Authorization: `Bearer ${profile.access_token}`,
98
+ 'Content-Type': 'application/json',
99
+ },
100
+ method: 'POST',
101
+ }, flags.verbose, profile.access_token);
102
+ if (!licenseResponse.ok) {
103
+ const errorText = await licenseResponse.text();
104
+ this.error(`License override failed with status ${licenseResponse.status}: ${licenseResponse.statusText}\n${errorText}`);
105
+ }
106
+ }
79
107
  if (flags.output === 'json') {
80
108
  this.log(JSON.stringify(tenant, null, 2));
81
109
  }
@@ -86,6 +114,8 @@ Deployed platform 5 to tenant: My Tenant (my-tenant)
86
114
  this.log(` State: ${tenant.state}`);
87
115
  if (tenant.platform?.name)
88
116
  this.log(` Platform: ${tenant.platform.name}`);
117
+ if (flags.license)
118
+ this.log(` License: applied`);
89
119
  this.log(` Time: ${elapsed}s`);
90
120
  }
91
121
  }
@@ -6,6 +6,7 @@ export default class TenantDeployRelease extends BaseCommand {
6
6
  static description: string;
7
7
  static examples: string[];
8
8
  static flags: {
9
+ license: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
10
  output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
11
  release: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
12
  workspace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -17,9 +17,15 @@ export default class TenantDeployRelease extends BaseCommand {
17
17
  Deployed release "v1.0" to tenant: My Tenant (my-tenant)
18
18
  `,
19
19
  `$ xano tenant deploy_release t1234-abcd-xyz1 --release v1.0 -o json`,
20
+ `$ xano tenant deploy_release t1234-abcd-xyz1 --release v1.0 --license ./license.yaml`,
20
21
  ];
21
22
  static flags = {
22
23
  ...BaseCommand.baseFlags,
24
+ license: Flags.string({
25
+ char: 'l',
26
+ description: 'Path to a license override file to apply after deploy',
27
+ required: false,
28
+ }),
23
29
  output: Flags.string({
24
30
  char: 'o',
25
31
  default: 'summary',
@@ -77,6 +83,28 @@ Deployed release "v1.0" to tenant: My Tenant (my-tenant)
77
83
  this.error(`API request failed with status ${response.status}: ${response.statusText}\n${errorText}`);
78
84
  }
79
85
  const tenant = (await response.json());
86
+ // Apply license override if provided
87
+ if (flags.license) {
88
+ const licensePath = path.resolve(flags.license);
89
+ if (!fs.existsSync(licensePath)) {
90
+ this.error(`License file not found: ${licensePath}`);
91
+ }
92
+ const licenseValue = fs.readFileSync(licensePath, 'utf8');
93
+ const licenseUrl = `${profile.instance_origin}/api:meta/workspace/${workspaceId}/tenant/${tenantName}/license`;
94
+ const licenseResponse = await this.verboseFetch(licenseUrl, {
95
+ body: JSON.stringify({ value: licenseValue }),
96
+ headers: {
97
+ accept: 'application/json',
98
+ Authorization: `Bearer ${profile.access_token}`,
99
+ 'Content-Type': 'application/json',
100
+ },
101
+ method: 'POST',
102
+ }, flags.verbose, profile.access_token);
103
+ if (!licenseResponse.ok) {
104
+ const errorText = await licenseResponse.text();
105
+ this.error(`License override failed with status ${licenseResponse.status}: ${licenseResponse.statusText}\n${errorText}`);
106
+ }
107
+ }
80
108
  if (flags.output === 'json') {
81
109
  this.log(JSON.stringify(tenant, null, 2));
82
110
  }
@@ -87,6 +115,8 @@ Deployed release "v1.0" to tenant: My Tenant (my-tenant)
87
115
  this.log(` State: ${tenant.state}`);
88
116
  if (tenant.release?.name)
89
117
  this.log(` Release: ${tenant.release.name}`);
118
+ if (flags.license)
119
+ this.log(` License: applied`);
90
120
  this.log(` Time: ${elapsed}s`);
91
121
  }
92
122
  }
@@ -87,9 +87,10 @@ Tenant: My Tenant (my-tenant)
87
87
  this.log(` Custom Domain: ${tenant.domain}`);
88
88
  if (tenant.cluster?.name)
89
89
  this.log(` Cluster: ${tenant.cluster.name}`);
90
- const release = typeof tenant.release === 'string' ? tenant.release : tenant.release?.name;
91
- if (release)
92
- this.log(` Release: ${release}`);
90
+ const releaseName = typeof tenant.release === 'string' ? tenant.release : tenant.release?.name;
91
+ const releaseId = typeof tenant.release === 'object' ? tenant.release?.id : undefined;
92
+ if (releaseName)
93
+ this.log(` Release: ${releaseName} (ID: ${releaseId})`);
93
94
  if (tenant.platform?.name)
94
95
  this.log(` Platform: ${tenant.platform.name}`);
95
96
  if (tenant.version !== undefined)
@@ -96,9 +96,10 @@ Tenants in workspace 5:
96
96
  this.log(` - ${tenant.display || tenant.name} (${tenant.name})${state}${license}${ephemeral}`);
97
97
  if (tenant.cluster?.name)
98
98
  this.log(` Cluster: ${tenant.cluster.name}`);
99
- const release = typeof tenant.release === 'string' ? tenant.release : tenant.release?.name;
100
- if (release)
101
- this.log(` Release: ${release}`);
99
+ const releaseName = typeof tenant.release === 'string' ? tenant.release : tenant.release?.name;
100
+ const releaseId = typeof tenant.release === 'object' ? tenant.release?.id : undefined;
101
+ if (releaseName)
102
+ this.log(` Release: ${releaseName} (ID: ${releaseId})`);
102
103
  if (tenant.platform?.name)
103
104
  this.log(` Platform: ${tenant.platform.name}`);
104
105
  }