commet 0.6.0 → 0.7.0
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/dist/index.js +16 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -135,7 +135,13 @@ var import_commander2 = require("commander");
|
|
|
135
135
|
var import_ora = __toESM(require("ora"));
|
|
136
136
|
|
|
137
137
|
// src/utils/api.ts
|
|
138
|
-
function
|
|
138
|
+
function getWebBaseURL(environment) {
|
|
139
|
+
if (environment === "production") {
|
|
140
|
+
return "https://billing.commet.co";
|
|
141
|
+
}
|
|
142
|
+
return "https://sandbox.commet.co";
|
|
143
|
+
}
|
|
144
|
+
function getApiBaseURL(environment) {
|
|
139
145
|
if (environment === "production") {
|
|
140
146
|
return "https://api.commet.co";
|
|
141
147
|
}
|
|
@@ -247,9 +253,9 @@ var linkCommand = new import_commander2.Command("link").description("Link this p
|
|
|
247
253
|
console.log(import_chalk3.default.red("\u2717 Could not load authentication"));
|
|
248
254
|
return;
|
|
249
255
|
}
|
|
250
|
-
const baseURL =
|
|
256
|
+
const baseURL = getApiBaseURL(auth.environment);
|
|
251
257
|
const result = await apiRequest(
|
|
252
|
-
`${baseURL}/
|
|
258
|
+
`${baseURL}/cli/organizations`
|
|
253
259
|
);
|
|
254
260
|
if (result.error || !result.data) {
|
|
255
261
|
spinner.fail("Failed to fetch organizations");
|
|
@@ -333,9 +339,9 @@ var listCommand = new import_commander3.Command("list").description("List event
|
|
|
333
339
|
return;
|
|
334
340
|
}
|
|
335
341
|
const spinner = (0, import_ora2.default)(`Fetching ${type}...`).start();
|
|
336
|
-
const baseURL =
|
|
342
|
+
const baseURL = getApiBaseURL(projectConfig.environment);
|
|
337
343
|
const result = await apiRequest(
|
|
338
|
-
`${baseURL}/
|
|
344
|
+
`${baseURL}/cli/types?orgId=${projectConfig.orgId}`
|
|
339
345
|
);
|
|
340
346
|
if (result.error || !result.data) {
|
|
341
347
|
spinner.fail(`Failed to fetch ${type}`);
|
|
@@ -427,7 +433,7 @@ var loginCommand = new import_commander4.Command("login").description("Authentic
|
|
|
427
433
|
return;
|
|
428
434
|
}
|
|
429
435
|
const spinner = (0, import_ora3.default)("Initiating login flow...").start();
|
|
430
|
-
const baseURL =
|
|
436
|
+
const baseURL = getWebBaseURL(environment);
|
|
431
437
|
try {
|
|
432
438
|
const deviceResponse = await fetch(`${baseURL}/api/auth/device/code`, {
|
|
433
439
|
method: "POST",
|
|
@@ -700,9 +706,9 @@ var pullCommand = new import_commander6.Command("pull").description("Pull type d
|
|
|
700
706
|
return;
|
|
701
707
|
}
|
|
702
708
|
const spinner = (0, import_ora4.default)("Fetching type definitions...").start();
|
|
703
|
-
const baseURL =
|
|
709
|
+
const baseURL = getApiBaseURL(projectConfig.environment);
|
|
704
710
|
const result = await apiRequest(
|
|
705
|
-
`${baseURL}/
|
|
711
|
+
`${baseURL}/cli/types?orgId=${projectConfig.orgId}`
|
|
706
712
|
);
|
|
707
713
|
if (result.error || !result.data) {
|
|
708
714
|
spinner.fail("Failed to fetch types");
|
|
@@ -791,9 +797,9 @@ var switchCommand = new import_commander7.Command("switch").description("Switch
|
|
|
791
797
|
console.log(import_chalk8.default.red("\u2717 Could not load authentication"));
|
|
792
798
|
return;
|
|
793
799
|
}
|
|
794
|
-
const baseURL =
|
|
800
|
+
const baseURL = getApiBaseURL(auth.environment);
|
|
795
801
|
const result = await apiRequest(
|
|
796
|
-
`${baseURL}/
|
|
802
|
+
`${baseURL}/cli/organizations`
|
|
797
803
|
);
|
|
798
804
|
if (result.error || !result.data) {
|
|
799
805
|
spinner.fail("Failed to fetch organizations");
|