@neetru/cli 2.28.7 → 2.28.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/CHANGELOG.md +44 -0
- package/README.md +23 -0
- package/dist/commands/admin/oidc-login.js +6 -3
- package/dist/commands/admin/oidc-login.js.map +1 -1
- package/dist/commands/admin/sdk-credential.js +11 -6
- package/dist/commands/admin/sdk-credential.js.map +1 -1
- package/dist/commands/agent-release.js +14 -27
- package/dist/commands/agent-release.js.map +1 -1
- package/dist/commands/ai-models.js +9 -4
- package/dist/commands/ai-models.js.map +1 -1
- package/dist/commands/archive.js +9 -2
- package/dist/commands/archive.js.map +1 -1
- package/dist/commands/auth.js +17 -2
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/autocomplete.d.ts +1 -1
- package/dist/commands/autocomplete.js +2 -0
- package/dist/commands/autocomplete.js.map +1 -1
- package/dist/commands/chat-menu.js +20 -6
- package/dist/commands/chat-menu.js.map +1 -1
- package/dist/commands/chat.d.ts +14 -0
- package/dist/commands/chat.js +32 -4
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/config.js +7 -0
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/db-move.d.ts +204 -0
- package/dist/commands/db-move.js +890 -0
- package/dist/commands/db-move.js.map +1 -0
- package/dist/commands/db.d.ts +14 -3
- package/dist/commands/db.js +102 -67
- package/dist/commands/db.js.map +1 -1
- package/dist/commands/deploy.js +13 -1
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev-up.d.ts +5 -0
- package/dist/commands/dev-up.js +29 -4
- package/dist/commands/dev-up.js.map +1 -1
- package/dist/commands/domains.js +48 -36
- package/dist/commands/domains.js.map +1 -1
- package/dist/commands/init.d.ts +0 -8
- package/dist/commands/init.js +14 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/logs.js +18 -21
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/mobile.d.ts +26 -0
- package/dist/commands/mobile.js +344 -0
- package/dist/commands/mobile.js.map +1 -0
- package/dist/commands/ops.d.ts +3 -0
- package/dist/commands/ops.js +21 -0
- package/dist/commands/ops.js.map +1 -1
- package/dist/commands/promote.js +13 -32
- package/dist/commands/promote.js.map +1 -1
- package/dist/commands/schema.d.ts +4 -0
- package/dist/commands/schema.js +25 -16
- package/dist/commands/schema.js.map +1 -1
- package/dist/commands/smoke.d.ts +123 -0
- package/dist/commands/smoke.js +529 -0
- package/dist/commands/smoke.js.map +1 -0
- package/dist/commands/vm-memory.d.ts +53 -0
- package/dist/commands/vm-memory.js +307 -0
- package/dist/commands/vm-memory.js.map +1 -0
- package/dist/commands/webhooks.d.ts +2 -0
- package/dist/commands/webhooks.js +7 -0
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/index.js +351 -15
- package/dist/index.js.map +1 -1
- package/dist/lib/mobile-local/index.d.ts +7 -0
- package/dist/lib/mobile-local/index.js +7 -0
- package/dist/lib/mobile-local/index.js.map +1 -0
- package/dist/lib/mobile-local/mobile-json.d.ts +57 -0
- package/dist/lib/mobile-local/mobile-json.js +169 -0
- package/dist/lib/mobile-local/mobile-json.js.map +1 -0
- package/dist/lib/product-config.d.ts +5 -0
- package/dist/lib/product-config.js +37 -0
- package/dist/lib/product-config.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
export type RelocationState = 'planning' | 'provisioning_target' | 'replicating' | 'verifying_target' | 'quiescing_source' | 'final_sync' | 'cutover' | 'observing' | 'draining_source' | 'done' | 'resume_source' | 'rolling_back' | 'rolling_back_post' | 'rolled_back' | 'needs_attention' | 'failed';
|
|
2
|
+
/** Ordem "pra frente" do caminho feliz — usada só pra exibir progresso. */
|
|
3
|
+
export declare const FORWARD_STATES: RelocationState[];
|
|
4
|
+
/** Estados terminais de SUCESSO (o único ponto onde "movido" pode ser dito). */
|
|
5
|
+
export declare const TERMINAL_SUCCESS: ReadonlySet<RelocationState>;
|
|
6
|
+
/** Estados terminais de FALHA/rollback (produto seguiu/voltou pra origem). */
|
|
7
|
+
export declare const TERMINAL_FAILURE: ReadonlySet<RelocationState>;
|
|
8
|
+
/**
|
|
9
|
+
* Estado terminal de HALT fail-closed (iteração 2). O Core PARA a máquina aqui
|
|
10
|
+
* quando detecta drift de ledger ou um destroy recusado por INV-DESTROY. NÃO é
|
|
11
|
+
* sucesso nem "voltou pra origem" — é "parou e precisa de gente", e o dado NÃO
|
|
12
|
+
* foi destruído (fail-closed). Poll NUNCA pode tratar isto como `running` (senão
|
|
13
|
+
* ficaria pendurado até o timeout).
|
|
14
|
+
*/
|
|
15
|
+
export declare const TERMINAL_ATTENTION: ReadonlySet<RelocationState>;
|
|
16
|
+
/**
|
|
17
|
+
* Estados em que o cutover PODE já ter trocado o ledger pro destino (o "vivo"
|
|
18
|
+
* pode estar no destino). `cutover` entra aqui por ser AMBÍGUO — durante ele a
|
|
19
|
+
* troca do ledger pode ou não ter acontecido; tratamos como pós por segurança
|
|
20
|
+
* (mensagem cuidadosa, nunca afirmar "ledger intocado"). Usado pelo `abort`
|
|
21
|
+
* pra escolher a mensagem correta (pré vs pós-cutover).
|
|
22
|
+
*/
|
|
23
|
+
export declare const POST_CUTOVER_STATES: ReadonlySet<RelocationState>;
|
|
24
|
+
/** True se o estado já pode ter o ledger apontando pro destino (pós-cutover). */
|
|
25
|
+
export declare function isPostCutoverState(s: RelocationState): boolean;
|
|
26
|
+
/** Rótulos PT-BR de cada estado da máquina (progresso ostensivo). */
|
|
27
|
+
export declare const STATE_LABELS: Record<RelocationState, string>;
|
|
28
|
+
export interface VerifyReport {
|
|
29
|
+
tables?: Array<{
|
|
30
|
+
name: string;
|
|
31
|
+
srcRows: number;
|
|
32
|
+
dstRows: number;
|
|
33
|
+
ok: boolean;
|
|
34
|
+
}>;
|
|
35
|
+
checksumOk?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** Doc de migração como o Core devolve no GET de status. */
|
|
38
|
+
export interface RelocationMigration {
|
|
39
|
+
id: string;
|
|
40
|
+
state: RelocationState;
|
|
41
|
+
dbId: string;
|
|
42
|
+
productId?: string;
|
|
43
|
+
engine?: string;
|
|
44
|
+
sourceServerId: string;
|
|
45
|
+
targetServerId: string;
|
|
46
|
+
manualCutover?: boolean;
|
|
47
|
+
healthGatePassedAt?: string | null;
|
|
48
|
+
observeOkAt?: string | null;
|
|
49
|
+
verifyReport?: VerifyReport | null;
|
|
50
|
+
previousServerId?: string | null;
|
|
51
|
+
/** Iteração 2: cutover atômico registrou a troca de ledger. */
|
|
52
|
+
cutoverCommitted?: boolean;
|
|
53
|
+
cutoverAt?: string | null;
|
|
54
|
+
/**
|
|
55
|
+
* Iteração 2: onde o LEDGER (`product_databases/{dbId}`) aponta AGORA — a única
|
|
56
|
+
* verdade de quem é o "vivo". O CLI NUNCA infere a posição do dado do `state`;
|
|
57
|
+
* lê daqui. Ausente = o Core não expôs; o CLI cai pra source/target conforme
|
|
58
|
+
* o estado, mas nunca afirma segurança sem confirmação terminal.
|
|
59
|
+
*/
|
|
60
|
+
live?: {
|
|
61
|
+
serverId?: string | null;
|
|
62
|
+
endpoint?: string | null;
|
|
63
|
+
} | null;
|
|
64
|
+
reason?: string;
|
|
65
|
+
lastError?: {
|
|
66
|
+
code: string;
|
|
67
|
+
message: string;
|
|
68
|
+
at?: string;
|
|
69
|
+
} | null;
|
|
70
|
+
updatedAt?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Resposta do POST .../abort (iteração 2). O Core deriva tudo do doc+ledger e
|
|
74
|
+
* responde de forma idempotente. `dataSafe` é a afirmação AUTORITATIVA do Core
|
|
75
|
+
* de que nenhum dado vivo foi/será destruído; `live.serverId` é pra onde o
|
|
76
|
+
* ledger aponta. O CLI só afirma segurança quando ISTO confirma — nunca por
|
|
77
|
+
* conta própria.
|
|
78
|
+
*/
|
|
79
|
+
export interface RelocateAbortResponse {
|
|
80
|
+
ok: boolean;
|
|
81
|
+
state: RelocationState;
|
|
82
|
+
live?: {
|
|
83
|
+
serverId?: string | null;
|
|
84
|
+
} | null;
|
|
85
|
+
dataSafe?: boolean;
|
|
86
|
+
}
|
|
87
|
+
export type RelocationPhase = 'running' | 'success' | 'failure' | 'await_confirm' | 'attention';
|
|
88
|
+
/**
|
|
89
|
+
* Classifica o estado de uma migração numa das FASES que o CLI trata.
|
|
90
|
+
* `await_confirm`: manual-cutover pausado em `verifying_target` com o health-gate
|
|
91
|
+
* já verde — o Core está esperando `db move confirm`.
|
|
92
|
+
* `attention`: HALT fail-closed (`needs_attention`) — parou, precisa de gente,
|
|
93
|
+
* nada destruído. É TERMINAL para o poll (não pode ser confundido com `running`).
|
|
94
|
+
*
|
|
95
|
+
* Função pura — não toca rede/relógio. É o coração testável do driver de watch.
|
|
96
|
+
*/
|
|
97
|
+
export declare function classifyRelocation(m: RelocationMigration): {
|
|
98
|
+
phase: RelocationPhase;
|
|
99
|
+
label: string;
|
|
100
|
+
};
|
|
101
|
+
/** Linhas humanas do verifyReport (contagem por tabela origem vs destino). */
|
|
102
|
+
export declare function formatVerifyReportLines(report?: VerifyReport | null): string[];
|
|
103
|
+
/** Valida o teto duro de quiesce (guardrail INV-1). Retorna erro ou null. */
|
|
104
|
+
export declare function validateMaxQuiesceMs(raw?: string | number): {
|
|
105
|
+
value: number;
|
|
106
|
+
error?: string;
|
|
107
|
+
};
|
|
108
|
+
declare const VALID_STRATEGIES: readonly ["snapshot_quiesce", "logical_stream"];
|
|
109
|
+
export type ReplicationStrategy = (typeof VALID_STRATEGIES)[number];
|
|
110
|
+
export type AbortOutcome = 'reverted_safe' | 'needs_attention' | 'failed' | 'pending';
|
|
111
|
+
/**
|
|
112
|
+
* Classifica o desfecho TERMINAL de um abort a partir do doc de migração.
|
|
113
|
+
*
|
|
114
|
+
* REGRA DE SEGURANÇA (iteração 2): o CLI só pode afirmar "nenhum dado perdido"
|
|
115
|
+
* quando o Core CONFIRMA um estado terminal + o ledger aponta pra um servidor
|
|
116
|
+
* que tem os dados. Nunca infere segurança do `state` sozinho, nunca antes do
|
|
117
|
+
* terminal. Um abort que para em `needs_attention` NÃO é "tudo certo" — é HALT
|
|
118
|
+
* (nada destruído, mas precisa de gente); afirmar all-clear ali seria mentir.
|
|
119
|
+
*
|
|
120
|
+
* Função pura — é o núcleo testável do relatório de abort.
|
|
121
|
+
*/
|
|
122
|
+
export declare function classifyAbortTerminal(m: RelocationMigration): {
|
|
123
|
+
outcome: AbortOutcome;
|
|
124
|
+
/** O CLI PODE afirmar que os dados vivos estão seguros/intactos? */
|
|
125
|
+
dataSafe: boolean;
|
|
126
|
+
/** Onde o ledger aponta agora (a única verdade de quem é o vivo). */
|
|
127
|
+
liveServerId?: string;
|
|
128
|
+
};
|
|
129
|
+
export interface DbMoveStartOptions {
|
|
130
|
+
/** Slug (ou id) do produto cujo banco será movido. */
|
|
131
|
+
product?: string;
|
|
132
|
+
/** dbId explícito (pdb_…) — dispensa a resolução por produto. */
|
|
133
|
+
db?: string;
|
|
134
|
+
/** Ambiente pra desambiguar quando o produto tem >1 banco. */
|
|
135
|
+
env?: string;
|
|
136
|
+
/** VM destino (serverId) — obrigatório. */
|
|
137
|
+
to?: string;
|
|
138
|
+
/** Motivo (vai pro audit). Obrigatório fora de --dry-run. */
|
|
139
|
+
reason?: string;
|
|
140
|
+
strategy?: string;
|
|
141
|
+
manualCutover?: boolean;
|
|
142
|
+
maxQuiesceMs?: string;
|
|
143
|
+
dryRun?: boolean;
|
|
144
|
+
/** Acompanha a máquina de estados até um estado terminal (default true). */
|
|
145
|
+
watch?: boolean;
|
|
146
|
+
yes?: boolean;
|
|
147
|
+
mfaToken?: string;
|
|
148
|
+
json?: boolean;
|
|
149
|
+
/** Somente testes: intervalo entre polls (ms). Default 4000. */
|
|
150
|
+
pollIntervalMs?: number;
|
|
151
|
+
/** Somente testes: teto do wall-clock do poll (ms). Default 30min. */
|
|
152
|
+
pollTimeoutMs?: number;
|
|
153
|
+
}
|
|
154
|
+
export declare function runDbMoveStart(opts: DbMoveStartOptions): Promise<void>;
|
|
155
|
+
/**
|
|
156
|
+
* Acompanha a máquina de estados até um estado terminal (done/rolled_back/failed)
|
|
157
|
+
* ou até a pausa de manual-cutover. Reporta SUCESSO só em `done`.
|
|
158
|
+
* Usado por `runDbMoveStart` (com --watch) e por `runDbMoveConfirm`.
|
|
159
|
+
*/
|
|
160
|
+
export declare function pollRelocation(migrationId: string, opts: {
|
|
161
|
+
json?: boolean;
|
|
162
|
+
pollIntervalMs?: number;
|
|
163
|
+
pollTimeoutMs?: number;
|
|
164
|
+
}): Promise<void>;
|
|
165
|
+
export declare function runDbMoveStatus(migrationId: string, opts?: {
|
|
166
|
+
json?: boolean;
|
|
167
|
+
}): Promise<void>;
|
|
168
|
+
export declare function runDbMoveConfirm(migrationId: string, opts?: {
|
|
169
|
+
mfa?: string;
|
|
170
|
+
json?: boolean;
|
|
171
|
+
watch?: boolean;
|
|
172
|
+
pollIntervalMs?: number;
|
|
173
|
+
pollTimeoutMs?: number;
|
|
174
|
+
}): Promise<void>;
|
|
175
|
+
export declare function runDbMoveAbort(migrationId: string, opts?: {
|
|
176
|
+
reason?: string;
|
|
177
|
+
yes?: boolean;
|
|
178
|
+
mfaToken?: string;
|
|
179
|
+
json?: boolean;
|
|
180
|
+
watch?: boolean;
|
|
181
|
+
pollIntervalMs?: number;
|
|
182
|
+
pollTimeoutMs?: number;
|
|
183
|
+
}): Promise<void>;
|
|
184
|
+
/**
|
|
185
|
+
* Descomissiona (dropa) a ORIGEM de uma relocação JÁ concluída. É o ÚNICO caminho
|
|
186
|
+
* que destrói a origem, e por design é SEPARADO, explícito, gated por MFA e —
|
|
187
|
+
* client-side — recusado se o ledger ainda NÃO aponta pro destino (i.e., o move
|
|
188
|
+
* não terminou / foi revertido). Isto é o espelho-CLI da INV-DESTROY: nunca pedir
|
|
189
|
+
* o drop de um servidor que o ledger diz ser o vivo. O Core é a autoridade final
|
|
190
|
+
* (re-checa live==target + grace + INV-DESTROY), mas falhamos cedo e claro.
|
|
191
|
+
*/
|
|
192
|
+
export declare function runDbMoveDecommission(migrationId: string, opts?: {
|
|
193
|
+
reason?: string;
|
|
194
|
+
yes?: boolean;
|
|
195
|
+
mfaToken?: string;
|
|
196
|
+
json?: boolean;
|
|
197
|
+
}): Promise<void>;
|
|
198
|
+
export declare function runDbWhere(opts?: {
|
|
199
|
+
product?: string;
|
|
200
|
+
db?: string;
|
|
201
|
+
env?: string;
|
|
202
|
+
json?: boolean;
|
|
203
|
+
}): Promise<void>;
|
|
204
|
+
export {};
|