@vectorplane/ctrl-cli 0.1.1 → 0.1.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 CHANGED
@@ -25,6 +25,7 @@ vp sync
25
25
  - abre o navegador para autenticação
26
26
  - conclui o login com callback local seguro
27
27
  - salva a sessão localmente
28
+ - em ambientes remotos ou isolados, o loopback local pode exigir um fluxo alternativo
28
29
 
29
30
  ### `vp sync`
30
31
 
@@ -72,3 +73,7 @@ vp sync
72
73
  - tokens nunca são enviados por query string
73
74
  - o callback valida o `state`
74
75
  - a sessão fica no diretório do usuário
76
+
77
+ ## Notas de fluxo
78
+
79
+ O plano de endurecimento do login local está em [docs/cli-auth-hardening-phases.md](/home/developer/Documentos/Projetos/vectorplane-ctrl-cli/docs/cli-auth-hardening-phases.md).
@@ -12,8 +12,8 @@ export const SNAPSHOTS_DIRECTORY_NAME = "snapshots";
12
12
  export const DEFAULT_PROFILE_NAME = "default";
13
13
  export const DEFAULT_PROFILE = {
14
14
  name: DEFAULT_PROFILE_NAME,
15
- apiBaseUrl: "https://api.vectorplane.io",
16
- appBaseUrl: "https://app.vectorplane.io",
15
+ apiBaseUrl: "https://proxy-pn.vectorplane.ai",
16
+ appBaseUrl: "https://app.vectorplane.ai",
17
17
  workspace: null,
18
18
  orgId: null,
19
19
  environment: "production",
@@ -4,6 +4,8 @@ export async function createCallbackServer(host, port, callbackPath, expectedSta
4
4
  let resolveCallback = null;
5
5
  let rejectCallback = null;
6
6
  let settled = false;
7
+ let pendingResult = null;
8
+ let pendingError = null;
7
9
  const server = http.createServer((request, response) => {
8
10
  try {
9
11
  const url = new URL(request.url ?? "/", `http://${host}:${port}`);
@@ -36,7 +38,9 @@ export async function createCallbackServer(host, port, callbackPath, expectedSta
36
38
  response.end("<html><body><p>VectorPlane: autenticação recebida. Você já pode voltar ao terminal.</p></body></html>");
37
39
  if (!settled) {
38
40
  settled = true;
39
- resolveCallback?.({ code, state });
41
+ const result = { code, state };
42
+ pendingResult = result;
43
+ resolveCallback?.(result);
40
44
  }
41
45
  }
42
46
  catch (error) {
@@ -44,6 +48,7 @@ export async function createCallbackServer(host, port, callbackPath, expectedSta
44
48
  response.end("VectorPlane callback error.");
45
49
  if (!settled) {
46
50
  settled = true;
51
+ pendingError = error;
47
52
  rejectCallback?.(error);
48
53
  }
49
54
  }
@@ -65,6 +70,14 @@ export async function createCallbackServer(host, port, callbackPath, expectedSta
65
70
  return new Promise((resolve, reject) => {
66
71
  resolveCallback = resolve;
67
72
  rejectCallback = reject;
73
+ if (pendingError) {
74
+ reject(pendingError);
75
+ return;
76
+ }
77
+ if (pendingResult) {
78
+ resolve(pendingResult);
79
+ return;
80
+ }
68
81
  const timer = setTimeout(() => {
69
82
  if (!settled) {
70
83
  settled = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectorplane/ctrl-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Official VectorPlane CLI.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",