@envmanager-cli/cli 0.1.7 → 0.1.8
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/bin/envmanager.js +14 -9
- package/dist/bin/envmanager.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/envmanager.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
// src/bin/envmanager.ts
|
|
4
4
|
import { Command as Command15 } from "commander";
|
|
5
|
+
import { readFileSync as readFileSync10 } from "fs";
|
|
6
|
+
import { dirname as dirname3, resolve as resolve9 } from "path";
|
|
7
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
5
8
|
|
|
6
9
|
// src/commands/login.ts
|
|
7
10
|
import { Command } from "commander";
|
|
@@ -88,7 +91,7 @@ function escapeHtml(str) {
|
|
|
88
91
|
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
89
92
|
}
|
|
90
93
|
async function startCallbackServer(expectedState, port = 8976) {
|
|
91
|
-
return new Promise((
|
|
94
|
+
return new Promise((resolve10, reject) => {
|
|
92
95
|
const timeout = setTimeout(() => {
|
|
93
96
|
server.close();
|
|
94
97
|
reject(new Error("Authentication timed out after 5 minutes"));
|
|
@@ -161,9 +164,9 @@ async function startCallbackServer(expectedState, port = 8976) {
|
|
|
161
164
|
clearTimeout(timeout);
|
|
162
165
|
server.close();
|
|
163
166
|
if (apiKey) {
|
|
164
|
-
|
|
167
|
+
resolve10({ apiKey });
|
|
165
168
|
} else {
|
|
166
|
-
|
|
169
|
+
resolve10({
|
|
167
170
|
accessToken,
|
|
168
171
|
refreshToken,
|
|
169
172
|
expiresIn: parseInt(expiresIn || "3600", 10)
|
|
@@ -1512,11 +1515,11 @@ async function subscribeToVariableChanges(environmentId, onEvent, onStatus) {
|
|
|
1512
1515
|
onStatus?.("connected");
|
|
1513
1516
|
}
|
|
1514
1517
|
});
|
|
1515
|
-
const subscription = await new Promise((
|
|
1518
|
+
const subscription = await new Promise((resolve10, reject) => {
|
|
1516
1519
|
channel.subscribe(async (status, err) => {
|
|
1517
1520
|
if (status === "SUBSCRIBED") {
|
|
1518
1521
|
onStatus?.("connected");
|
|
1519
|
-
|
|
1522
|
+
resolve10({
|
|
1520
1523
|
channel,
|
|
1521
1524
|
environmentId,
|
|
1522
1525
|
unsubscribe: async () => {
|
|
@@ -2991,9 +2994,9 @@ import { fileURLToPath } from "url";
|
|
|
2991
2994
|
import { dirname as dirname2, resolve as resolve8 } from "path";
|
|
2992
2995
|
function getCliVersion() {
|
|
2993
2996
|
try {
|
|
2994
|
-
const
|
|
2995
|
-
const
|
|
2996
|
-
return
|
|
2997
|
+
const __dirname3 = dirname2(fileURLToPath(import.meta.url));
|
|
2998
|
+
const pkg2 = JSON.parse(readFileSync9(resolve8(__dirname3, "../../package.json"), "utf-8"));
|
|
2999
|
+
return pkg2.version || "unknown";
|
|
2997
3000
|
} catch {
|
|
2998
3001
|
return "unknown";
|
|
2999
3002
|
}
|
|
@@ -3085,8 +3088,10 @@ var debugCommand = new Command14("debug").description("Collect diagnostic info f
|
|
|
3085
3088
|
});
|
|
3086
3089
|
|
|
3087
3090
|
// src/bin/envmanager.ts
|
|
3091
|
+
var __dirname2 = dirname3(fileURLToPath2(import.meta.url));
|
|
3092
|
+
var pkg = JSON.parse(readFileSync10(resolve9(__dirname2, "../../package.json"), "utf-8"));
|
|
3088
3093
|
var program = new Command15();
|
|
3089
|
-
program.name("envmanager").description("CLI for EnvManager - secure environment variable management").version(
|
|
3094
|
+
program.name("envmanager").description("CLI for EnvManager - secure environment variable management").version(pkg.version);
|
|
3090
3095
|
program.addCommand(loginCommand);
|
|
3091
3096
|
program.addCommand(logoutCommand);
|
|
3092
3097
|
program.addCommand(whoamiCommand);
|