@revoengine/cli 1.0.11 → 1.0.13
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 +275 -479
- package/dist/src/cli.js +71 -5
- package/dist/src/client.d.ts +28 -12
- package/dist/src/client.js +234 -66
- package/dist/src/commands/component.d.ts +67 -0
- package/dist/src/commands/component.js +299 -27
- package/dist/src/commands/database-tables.d.ts +2 -0
- package/dist/src/commands/{database-schemas.js → database-tables.js} +21 -40
- package/dist/src/commands/database-views.js +21 -18
- package/dist/src/commands/endpoints.js +26 -16
- package/dist/src/commands/events.js +18 -20
- package/dist/src/commands/groups.js +13 -22
- package/dist/src/commands/index.d.ts +2 -1
- package/dist/src/commands/index.js +2 -1
- package/dist/src/commands/job-templates.js +21 -15
- package/dist/src/commands/metadata.js +58 -15
- package/dist/src/commands/migrate.d.ts +6 -0
- package/dist/src/commands/migrate.js +658 -0
- package/dist/src/commands/project.js +4 -4
- package/dist/src/commands/role-groups.js +14 -25
- package/dist/src/commands/schedules.js +19 -20
- package/dist/src/commands/terminal-browser.d.ts +16 -0
- package/dist/src/commands/terminal-browser.js +92 -0
- package/dist/src/commands/terminal-image.d.ts +7 -0
- package/dist/src/commands/terminal-image.js +40 -0
- package/dist/src/commands/terminal-patch-worker.d.ts +1 -0
- package/dist/src/commands/terminal-patch-worker.js +24 -0
- package/dist/src/commands/terminal-patch.d.ts +2 -0
- package/dist/src/commands/terminal-patch.js +156 -0
- package/dist/src/commands/terminal-sandbox.d.ts +8 -0
- package/dist/src/commands/terminal-sandbox.js +87 -0
- package/dist/src/commands/terminal-service.js +2 -2
- package/dist/src/commands/terminal.d.ts +31 -4
- package/dist/src/commands/terminal.js +360 -45
- package/dist/src/component-lock.d.ts +12 -2
- package/dist/src/component-lock.js +60 -1
- package/dist/src/diff-details.d.ts +8 -0
- package/dist/src/diff-details.js +152 -0
- package/dist/src/env-sync.js +8 -6
- package/dist/src/http-trace.d.ts +94 -0
- package/dist/src/http-trace.js +226 -0
- package/dist/src/metadata-backfill.d.ts +5 -4
- package/dist/src/metadata-backfill.js +82 -158
- package/dist/src/migration.d.ts +141 -0
- package/dist/src/migration.js +1632 -0
- package/dist/src/resource-inventory.d.ts +28 -0
- package/dist/src/resource-inventory.js +85 -0
- package/dist/src/resource-syncs/{database-schema-sync.d.ts → database-table-sync.d.ts} +13 -3
- package/dist/src/resource-syncs/{database-schema-sync.js → database-table-sync.js} +147 -62
- package/dist/src/resource-syncs/database-view-sync.d.ts +24 -2
- package/dist/src/resource-syncs/database-view-sync.js +156 -68
- package/dist/src/resource-syncs/endpoint-sync.d.ts +27 -0
- package/dist/src/resource-syncs/endpoint-sync.js +362 -82
- package/dist/src/resource-syncs/event-sync.d.ts +27 -0
- package/dist/src/resource-syncs/event-sync.js +123 -26
- package/dist/src/resource-syncs/group-sync.d.ts +7 -0
- package/dist/src/resource-syncs/group-sync.js +60 -14
- package/dist/src/resource-syncs/job-template-sync.d.ts +21 -0
- package/dist/src/resource-syncs/job-template-sync.js +91 -30
- package/dist/src/resource-syncs/role-group-sync.d.ts +7 -0
- package/dist/src/resource-syncs/role-group-sync.js +47 -9
- package/dist/src/resource-syncs/schedule-sync.d.ts +30 -1
- package/dist/src/resource-syncs/schedule-sync.js +114 -20
- package/dist/src/resource-syncs/util.d.ts +3 -0
- package/dist/src/resource-syncs/util.js +8 -6
- package/dist/src/resource-target.d.ts +11 -0
- package/dist/src/resource-target.js +48 -0
- package/dist/src/sync-output.d.ts +29 -1
- package/dist/src/sync-output.js +139 -2
- package/dist/src/tracked-resources.d.ts +1 -1
- package/dist/src/tracked-resources.js +8 -6
- package/dist/src/types.d.ts +3 -0
- package/dist/src/ui.js +18 -9
- package/dist/src/utils.d.ts +2 -0
- package/dist/src/utils.js +17 -0
- package/dist/src/workspace-diff.d.ts +25 -0
- package/dist/src/workspace-diff.js +75 -0
- package/package.json +9 -6
- package/dist/src/commands/database-schemas.d.ts +0 -2
- /package/dist/src/{database-schema-artifacts.d.ts → database-table-artifacts.d.ts} +0 -0
- /package/dist/src/{database-schema-artifacts.js → database-table-artifacts.js} +0 -0
package/dist/src/cli.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { realpathSync } from 'node:fs';
|
|
2
2
|
import { pathToFileURL } from 'node:url';
|
|
3
3
|
import { RevoClient } from "./client.js";
|
|
4
|
+
import { readComponentLock } from "./component-lock.js";
|
|
4
5
|
import { getActiveEnvironmentName } from "./config.js";
|
|
5
|
-
import { handleAuthCommand, handleComponentCommand,
|
|
6
|
+
import { handleAuthCommand, handleComponentCommand, handleDatabaseTablesCommand, handleDatabaseViewsCommand, handleDeployCommand, handleDiffCommand, handleEndpointsCommand, handleEnvCommand, handleEventsCommand, handleGroupsCommand, handleInfoCommand, handleJobTemplatesCommand, handleMetadataCommand, handleMigrateCommand, handlePlanCommand, handlePullCommand, handleProjectCommand, handleRequestCommand, handleRoleGroupsCommand, handleSearchCommand, handleSchedulesCommand, handleTerminalCommand, } from "./commands/index.js";
|
|
7
|
+
import { createHttpTraceSession, finalizeHttpTraceSession, withHttpTraceSession, } from "./http-trace.js";
|
|
8
|
+
import { resolveProjectRoot } from "./project.js";
|
|
6
9
|
import { buildRuntimeViewModel } from "./runtime-view.js";
|
|
7
10
|
import { renderHelp, renderOverview } from "./ui.js";
|
|
8
11
|
import { maybeNotifyUpdateAvailable } from "./update-notifier.js";
|
|
@@ -171,8 +174,22 @@ function createContext(args) {
|
|
|
171
174
|
function printHelp() {
|
|
172
175
|
print(renderHelp(packageVersion));
|
|
173
176
|
}
|
|
174
|
-
|
|
175
|
-
const
|
|
177
|
+
function configuredHttpTrace(args) {
|
|
178
|
+
const projectRoot = resolveProjectRoot(process.cwd());
|
|
179
|
+
if (!projectRoot) {
|
|
180
|
+
return undefined;
|
|
181
|
+
}
|
|
182
|
+
const lock = readComponentLock(projectRoot);
|
|
183
|
+
if (lock.diagnostics?.httpTrace?.enabled !== true) {
|
|
184
|
+
return undefined;
|
|
185
|
+
}
|
|
186
|
+
const command = args._[0] || 'overview';
|
|
187
|
+
return createHttpTraceSession(projectRoot, {
|
|
188
|
+
command,
|
|
189
|
+
...(args['dry-run'] === true || args['dry-run'] === 'true' ? { dryRun: true } : {}),
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
async function runMain(args, argv) {
|
|
176
193
|
await maybeNotifyUpdateAvailable({
|
|
177
194
|
args,
|
|
178
195
|
currentVersion: packageVersion,
|
|
@@ -215,14 +232,30 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
215
232
|
await handleComponentCommand(context);
|
|
216
233
|
return;
|
|
217
234
|
}
|
|
218
|
-
if (command === 'database-schemas') {
|
|
219
|
-
await
|
|
235
|
+
if (command === 'database-tables' || command === 'database-schemas') {
|
|
236
|
+
await handleDatabaseTablesCommand(context);
|
|
220
237
|
return;
|
|
221
238
|
}
|
|
222
239
|
if (command === 'database-views') {
|
|
223
240
|
await handleDatabaseViewsCommand(context);
|
|
224
241
|
return;
|
|
225
242
|
}
|
|
243
|
+
if (command === 'pull') {
|
|
244
|
+
await handlePullCommand(context);
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
if (command === 'diff') {
|
|
248
|
+
await handleDiffCommand(context);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
if (command === 'plan') {
|
|
252
|
+
await handlePlanCommand(context);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (command === 'deploy') {
|
|
256
|
+
await handleDeployCommand(context);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
226
259
|
if (command === 'endpoints') {
|
|
227
260
|
await handleEndpointsCommand(context);
|
|
228
261
|
return;
|
|
@@ -239,6 +272,10 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
239
272
|
await handleMetadataCommand(context);
|
|
240
273
|
return;
|
|
241
274
|
}
|
|
275
|
+
if (command === 'migrate') {
|
|
276
|
+
await handleMigrateCommand(context);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
242
279
|
if (command === 'job-templates') {
|
|
243
280
|
await handleJobTemplatesCommand(context);
|
|
244
281
|
return;
|
|
@@ -269,6 +306,35 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
269
306
|
}
|
|
270
307
|
throw new Error(`Unknown command: ${command}`);
|
|
271
308
|
}
|
|
309
|
+
export async function main(argv = process.argv.slice(2)) {
|
|
310
|
+
const args = parseArgs(argv);
|
|
311
|
+
const trace = configuredHttpTrace(args);
|
|
312
|
+
if (!trace) {
|
|
313
|
+
await runMain(args, argv);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
let failure;
|
|
317
|
+
try {
|
|
318
|
+
await withHttpTraceSession(trace, () => runMain(args, argv));
|
|
319
|
+
}
|
|
320
|
+
catch (error) {
|
|
321
|
+
failure = error;
|
|
322
|
+
}
|
|
323
|
+
try {
|
|
324
|
+
const tracePath = await finalizeHttpTraceSession(trace, failure ? 'failed' : 'succeeded', failure);
|
|
325
|
+
process.stderr.write(`HTTP trace: ${tracePath}\n`);
|
|
326
|
+
}
|
|
327
|
+
catch (traceError) {
|
|
328
|
+
if (!failure) {
|
|
329
|
+
throw traceError;
|
|
330
|
+
}
|
|
331
|
+
const message = traceError instanceof Error ? traceError.message : String(traceError);
|
|
332
|
+
process.stderr.write(`Warning: failed to write HTTP trace: ${message}\n`);
|
|
333
|
+
}
|
|
334
|
+
if (failure) {
|
|
335
|
+
throw failure;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
272
338
|
if (isDirectExecution()) {
|
|
273
339
|
main().catch((error) => {
|
|
274
340
|
printError(error);
|
package/dist/src/client.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export type RequestOptions = {
|
|
|
9
9
|
timeoutMs?: number;
|
|
10
10
|
/** Explicitly trusted service endpoint, such as the sandbox URL returned by /me. */
|
|
11
11
|
allowExternalOrigin?: boolean;
|
|
12
|
+
maxRetries?: number;
|
|
13
|
+
retryDelayMs?: number;
|
|
12
14
|
};
|
|
13
15
|
export type PaginatedListRequest = {
|
|
14
16
|
path?: string;
|
|
@@ -36,6 +38,7 @@ export type DatabaseSchemaMetadataWritePayload = {
|
|
|
36
38
|
metadata: Record<string, unknown>;
|
|
37
39
|
};
|
|
38
40
|
export type DatabaseSchemaUpdatePayload = Omit<DatabaseSchemaMetadataWritePayload, 'metadata'> & {
|
|
41
|
+
name?: string;
|
|
39
42
|
metadata?: Record<string, unknown>;
|
|
40
43
|
category?: string;
|
|
41
44
|
desc?: string;
|
|
@@ -50,7 +53,7 @@ export type DatabaseSchemaCreatePayload = {
|
|
|
50
53
|
partition?: Record<string, unknown>;
|
|
51
54
|
parent?: string;
|
|
52
55
|
audit?: false;
|
|
53
|
-
restricted?:
|
|
56
|
+
restricted?: boolean;
|
|
54
57
|
};
|
|
55
58
|
export type DatabaseViewPreviewPayload = ({
|
|
56
59
|
definitionMode: 'STRUCTURED';
|
|
@@ -59,9 +62,9 @@ export type DatabaseViewPreviewPayload = ({
|
|
|
59
62
|
definitionMode: 'RAW_SQL';
|
|
60
63
|
rawQuery: string;
|
|
61
64
|
}) & {
|
|
62
|
-
take: 0;
|
|
63
|
-
output
|
|
64
|
-
take: 0;
|
|
65
|
+
take: 0 | 1;
|
|
66
|
+
output?: {
|
|
67
|
+
take: 0 | 1;
|
|
65
68
|
count: false;
|
|
66
69
|
};
|
|
67
70
|
};
|
|
@@ -156,6 +159,7 @@ export type EventMetadataWritePayload = {
|
|
|
156
159
|
metadata: Record<string, unknown>;
|
|
157
160
|
};
|
|
158
161
|
export type EventWritePayload = EventMetadataWritePayload & {
|
|
162
|
+
custom?: boolean;
|
|
159
163
|
name?: string;
|
|
160
164
|
category?: string | null;
|
|
161
165
|
desc?: string;
|
|
@@ -168,6 +172,7 @@ export type EventWritePayload = EventMetadataWritePayload & {
|
|
|
168
172
|
export type EventCreatePayload = Omit<EventWritePayload, 'version'> & {
|
|
169
173
|
name: string;
|
|
170
174
|
active: boolean;
|
|
175
|
+
custom: boolean;
|
|
171
176
|
type: string;
|
|
172
177
|
targetType: string;
|
|
173
178
|
targetId: string;
|
|
@@ -270,6 +275,7 @@ export type ClientOptions = {
|
|
|
270
275
|
instance?: string;
|
|
271
276
|
token?: string;
|
|
272
277
|
envName?: string;
|
|
278
|
+
environmentName?: string;
|
|
273
279
|
production?: true;
|
|
274
280
|
fetch?: typeof fetch;
|
|
275
281
|
confirmProductionWrite?: (details: {
|
|
@@ -278,6 +284,8 @@ export type ClientOptions = {
|
|
|
278
284
|
path: string;
|
|
279
285
|
}) => Promise<boolean>;
|
|
280
286
|
trustedServiceOrigins?: string[];
|
|
287
|
+
maxRetries?: number;
|
|
288
|
+
retryDelayMs?: number;
|
|
281
289
|
};
|
|
282
290
|
export type ApiResponse<T = unknown> = {
|
|
283
291
|
status: number;
|
|
@@ -291,6 +299,11 @@ export declare class ApiError extends Error {
|
|
|
291
299
|
headers?: Headers;
|
|
292
300
|
constructor(status: number, message: string, data: unknown, headers?: Headers);
|
|
293
301
|
}
|
|
302
|
+
export declare class RequestTimeoutError extends Error {
|
|
303
|
+
readonly timeoutMs: number;
|
|
304
|
+
readonly path: string;
|
|
305
|
+
constructor(timeoutMs: number, path: string);
|
|
306
|
+
}
|
|
294
307
|
export declare class AuthenticationError extends ApiError {
|
|
295
308
|
constructor(status: number, message: string, data: unknown, headers?: Headers);
|
|
296
309
|
}
|
|
@@ -307,10 +320,13 @@ export declare class RevoClient {
|
|
|
307
320
|
instance: string;
|
|
308
321
|
token: string;
|
|
309
322
|
production: boolean;
|
|
323
|
+
environmentName: string;
|
|
310
324
|
fetchImpl: typeof fetch | undefined;
|
|
311
325
|
private productionWriteConfirmed;
|
|
312
326
|
private confirmProductionWrite;
|
|
313
327
|
private trustedServiceOrigins;
|
|
328
|
+
private maxRetries;
|
|
329
|
+
private retryDelayMs;
|
|
314
330
|
constructor(options?: ClientOptions);
|
|
315
331
|
get authHeader(): string;
|
|
316
332
|
get authValidationKey(): string;
|
|
@@ -349,7 +365,7 @@ export declare class RevoClient {
|
|
|
349
365
|
updateDatabaseSchema(databaseId: string, body: DatabaseSchemaUpdatePayload): Promise<DatabaseSchemaResponse>;
|
|
350
366
|
deleteDatabaseSchema(databaseId: string): Promise<unknown>;
|
|
351
367
|
listAllDatabaseViews(): Promise<DatabaseViewRecord[]>;
|
|
352
|
-
getDatabaseView(databaseViewId: string): Promise<DatabaseViewRecord | {
|
|
368
|
+
getDatabaseView(databaseViewId: string, options?: Pick<RequestOptions, 'timeoutMs' | 'maxRetries'>): Promise<DatabaseViewRecord | {
|
|
353
369
|
data: DatabaseViewRecord;
|
|
354
370
|
}>;
|
|
355
371
|
listAllDatabaseViewsForSync(): Promise<DatabaseViewRecord[]>;
|
|
@@ -364,7 +380,7 @@ export declare class RevoClient {
|
|
|
364
380
|
endpoints: EndpointRecord[];
|
|
365
381
|
discoveredTotal: number | null;
|
|
366
382
|
}>;
|
|
367
|
-
getEndpoint(endpointId: string): Promise<EndpointRecord>;
|
|
383
|
+
getEndpoint(endpointId: string, options?: Pick<RequestOptions, 'timeoutMs'>): Promise<EndpointRecord>;
|
|
368
384
|
createEndpoint(body: EndpointCreatePayload): Promise<EndpointRecord>;
|
|
369
385
|
updateEndpoint(endpointId: string, body: EndpointWritePayload): Promise<EndpointRecord>;
|
|
370
386
|
activateEndpoint(endpointId: string): Promise<void>;
|
|
@@ -380,7 +396,7 @@ export declare class RevoClient {
|
|
|
380
396
|
components: Record<string, unknown>[];
|
|
381
397
|
discoveredTotal: number | null;
|
|
382
398
|
}>;
|
|
383
|
-
getComponent(componentId: string): Promise<unknown>;
|
|
399
|
+
getComponent(componentId: string, options?: Pick<RequestOptions, 'timeoutMs'>): Promise<unknown>;
|
|
384
400
|
createComponent(body: unknown): Promise<unknown>;
|
|
385
401
|
updateComponent(componentId: string, body: unknown): Promise<unknown>;
|
|
386
402
|
deleteComponent(componentId: string): Promise<ApiResponse<unknown>>;
|
|
@@ -389,19 +405,19 @@ export declare class RevoClient {
|
|
|
389
405
|
roleGroups: RoleGroupRecord[];
|
|
390
406
|
discoveredTotal: number | null;
|
|
391
407
|
}>;
|
|
392
|
-
getRoleGroup(roleGroupId: string): Promise<RoleGroupResponse>;
|
|
408
|
+
getRoleGroup(roleGroupId: string, options?: Pick<RequestOptions, 'timeoutMs' | 'maxRetries'>): Promise<RoleGroupResponse>;
|
|
393
409
|
listGroups(options?: GroupListRequest): Promise<unknown>;
|
|
394
410
|
listAllGroups(): Promise<{
|
|
395
411
|
groups: GroupRecord[];
|
|
396
412
|
discoveredTotal: number | null;
|
|
397
413
|
}>;
|
|
398
|
-
getGroup(groupId: string): Promise<GroupResponse>;
|
|
414
|
+
getGroup(groupId: string, options?: Pick<RequestOptions, 'timeoutMs' | 'maxRetries'>): Promise<GroupResponse>;
|
|
399
415
|
listJobTemplates(options?: JobTemplateListRequest): Promise<unknown>;
|
|
400
416
|
listAllJobTemplates(): Promise<{
|
|
401
417
|
jobTemplates: JobTemplateRecord[];
|
|
402
418
|
discoveredTotal: number | null;
|
|
403
419
|
}>;
|
|
404
|
-
getJobTemplate(jobTemplateId: string): Promise<JobTemplateResponse>;
|
|
420
|
+
getJobTemplate(jobTemplateId: string, options?: Pick<RequestOptions, 'timeoutMs' | 'maxRetries'>): Promise<JobTemplateResponse>;
|
|
405
421
|
createJobTemplate(body: JobTemplateCreatePayload): Promise<JobTemplateResponse>;
|
|
406
422
|
updateJobTemplate(jobTemplateId: string, body: JobTemplateUpdatePayload): Promise<JobTemplateResponse>;
|
|
407
423
|
listSchedules(options?: ScheduleListRequest): Promise<unknown>;
|
|
@@ -409,7 +425,7 @@ export declare class RevoClient {
|
|
|
409
425
|
schedules: ScheduleRecord[];
|
|
410
426
|
discoveredTotal: number | null;
|
|
411
427
|
}>;
|
|
412
|
-
getSchedule(scheduleId: string): Promise<ScheduleResponse>;
|
|
428
|
+
getSchedule(scheduleId: string, options?: Pick<RequestOptions, 'timeoutMs' | 'maxRetries'>): Promise<ScheduleResponse>;
|
|
413
429
|
createSchedule(body: ScheduleCreatePayload): Promise<ScheduleResponse>;
|
|
414
430
|
updateSchedule(scheduleId: string, body: ScheduleWritePayload): Promise<ScheduleResponse>;
|
|
415
431
|
activateSchedule(scheduleId: string): Promise<unknown>;
|
|
@@ -418,7 +434,7 @@ export declare class RevoClient {
|
|
|
418
434
|
events: EventRecord[];
|
|
419
435
|
discoveredTotal: number | null;
|
|
420
436
|
}>;
|
|
421
|
-
getEvent(eventId: string): Promise<EventResponse>;
|
|
437
|
+
getEvent(eventId: string, options?: Pick<RequestOptions, 'timeoutMs' | 'maxRetries'>): Promise<EventResponse>;
|
|
422
438
|
createEvent(body: EventCreatePayload): Promise<EventResponse>;
|
|
423
439
|
updateEvent(eventId: string, body: EventWritePayload): Promise<EventResponse>;
|
|
424
440
|
activateEvent(eventId: string): Promise<unknown>;
|