@revoengine/cli 1.0.10 → 1.0.12
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 +314 -239
- package/dist/src/cli.js +126 -9
- package/dist/src/client.d.ts +373 -6
- package/dist/src/client.js +1005 -53
- package/dist/src/commands/auth.js +4 -2
- package/dist/src/commands/component.d.ts +67 -0
- package/dist/src/commands/component.js +555 -164
- package/dist/src/commands/database-tables.d.ts +2 -0
- package/dist/src/commands/database-tables.js +169 -0
- package/dist/src/commands/database-views.d.ts +2 -0
- package/dist/src/commands/database-views.js +126 -0
- package/dist/src/commands/endpoints.js +124 -0
- package/dist/src/commands/env.js +44 -24
- package/dist/src/commands/events.d.ts +2 -0
- package/dist/src/commands/events.js +144 -0
- package/dist/src/commands/groups.d.ts +2 -0
- package/dist/src/commands/groups.js +160 -0
- package/dist/src/commands/index.d.ts +9 -0
- package/dist/src/commands/index.js +9 -0
- package/dist/src/commands/job-templates.d.ts +2 -0
- package/dist/src/commands/job-templates.js +107 -0
- package/dist/src/commands/metadata.js +75 -10
- package/dist/src/commands/migrate.d.ts +6 -0
- package/dist/src/commands/migrate.js +658 -0
- package/dist/src/commands/project.js +10 -3
- package/dist/src/commands/role-groups.d.ts +2 -0
- package/dist/src/commands/role-groups.js +141 -0
- package/dist/src/commands/schedules.d.ts +2 -0
- package/dist/src/commands/schedules.js +140 -0
- 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.d.ts +38 -0
- package/dist/src/commands/terminal-service.js +210 -0
- package/dist/src/commands/terminal.d.ts +49 -0
- package/dist/src/commands/terminal.js +826 -0
- package/dist/src/component-lock.d.ts +111 -3
- package/dist/src/component-lock.js +363 -15
- package/dist/src/config.d.ts +10 -2
- package/dist/src/config.js +49 -14
- package/dist/src/database-table-artifacts.d.ts +7 -0
- package/dist/src/database-table-artifacts.js +8 -0
- package/dist/src/diff-details.d.ts +8 -0
- package/dist/src/diff-details.js +152 -0
- package/dist/src/env-sync.d.ts +0 -3
- package/dist/src/env-sync.js +11 -25
- package/dist/src/http-trace.d.ts +94 -0
- package/dist/src/http-trace.js +226 -0
- package/dist/src/metadata-backfill.d.ts +18 -7
- package/dist/src/metadata-backfill.js +1002 -27
- package/dist/src/migration.d.ts +141 -0
- package/dist/src/migration.js +1632 -0
- package/dist/src/project.d.ts +2 -0
- package/dist/src/project.js +4 -17
- package/dist/src/prompt.js +10 -18
- package/dist/src/resource-inventory.d.ts +28 -0
- package/dist/src/resource-inventory.js +85 -0
- package/dist/src/resource-metadata.d.ts +1 -0
- package/dist/src/resource-metadata.js +3 -0
- package/dist/src/resource-syncs/database-table-sync.d.ts +127 -0
- package/dist/src/resource-syncs/database-table-sync.js +2374 -0
- package/dist/src/resource-syncs/database-view-sync.d.ts +146 -0
- package/dist/src/resource-syncs/database-view-sync.js +1405 -0
- package/dist/src/resource-syncs/endpoint-sync.d.ts +123 -0
- package/dist/src/resource-syncs/endpoint-sync.js +1563 -0
- package/dist/src/resource-syncs/event-sync.d.ts +126 -0
- package/dist/src/resource-syncs/event-sync.js +1046 -0
- package/dist/src/resource-syncs/group-sync.d.ts +93 -0
- package/dist/src/resource-syncs/group-sync.js +928 -0
- package/dist/src/resource-syncs/job-template-sync.d.ts +106 -0
- package/dist/src/resource-syncs/job-template-sync.js +843 -0
- package/dist/src/resource-syncs/role-group-sync.d.ts +90 -0
- package/dist/src/resource-syncs/role-group-sync.js +635 -0
- package/dist/src/resource-syncs/schedule-sync.d.ts +140 -0
- package/dist/src/resource-syncs/schedule-sync.js +1396 -0
- package/dist/src/resource-syncs/util.d.ts +22 -0
- package/dist/src/resource-syncs/util.js +118 -0
- package/dist/src/resource-target.d.ts +11 -0
- package/dist/src/resource-target.js +48 -0
- package/dist/src/runtime-view.d.ts +1 -0
- package/dist/src/runtime-view.js +6 -1
- package/dist/src/sync-output.d.ts +66 -0
- package/dist/src/sync-output.js +268 -0
- package/dist/src/tracked-resources.d.ts +1 -1
- package/dist/src/tracked-resources.js +28 -2
- package/dist/src/types.d.ts +227 -0
- package/dist/src/ui.d.ts +3 -0
- package/dist/src/ui.js +76 -18
- package/dist/src/utils.d.ts +4 -0
- package/dist/src/utils.js +81 -0
- package/dist/src/workspace-component.d.ts +2 -0
- package/dist/src/workspace-component.js +34 -0
- package/dist/src/workspace-diff.d.ts +25 -0
- package/dist/src/workspace-diff.js +75 -0
- package/dist/src/workspace-resource.d.ts +2 -0
- package/dist/src/workspace-resource.js +52 -0
- package/package.json +12 -4
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 {
|
|
5
|
-
import {
|
|
4
|
+
import { readComponentLock } from "./component-lock.js";
|
|
5
|
+
import { getActiveEnvironmentName } from "./config.js";
|
|
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";
|
|
@@ -136,30 +139,57 @@ function printError(error) {
|
|
|
136
139
|
process.stderr.write(`${danger('Error:')} ${message}\n`);
|
|
137
140
|
}
|
|
138
141
|
function resolveClient(args) {
|
|
139
|
-
|
|
142
|
+
return new RevoClient({
|
|
140
143
|
baseUrl: typeof args.url === 'string' ? args.url : typeof args.baseUrl === 'string' ? args.baseUrl : undefined,
|
|
141
144
|
instance: typeof args.instance === 'string' ? args.instance : typeof args.i === 'string' ? args.i : undefined,
|
|
142
145
|
token: typeof args.token === 'string' ? args.token : typeof args.t === 'string' ? args.t : undefined,
|
|
146
|
+
envName: typeof args.env === 'string' ? args.env : undefined,
|
|
143
147
|
});
|
|
144
|
-
return new RevoClient(runtime);
|
|
145
148
|
}
|
|
146
149
|
function createContext(args) {
|
|
147
|
-
|
|
150
|
+
if (args.project !== undefined && args.env !== undefined) {
|
|
151
|
+
throw new Error('Use either --project or --env, not both.');
|
|
152
|
+
}
|
|
153
|
+
if (args.project !== undefined && (typeof args.project !== 'string' || !args.project.trim())) {
|
|
154
|
+
throw new Error('--project requires a saved project name.');
|
|
155
|
+
}
|
|
156
|
+
const active = getActiveEnvironmentName();
|
|
157
|
+
const selectedProject = args.project === undefined ? args.env : args.project;
|
|
158
|
+
const effectiveArgs = selectedProject === undefined && active !== 'default'
|
|
159
|
+
? { ...args, env: active }
|
|
160
|
+
: args.project !== undefined ? { ...args, env: selectedProject } : args;
|
|
161
|
+
const client = resolveClient(effectiveArgs);
|
|
148
162
|
return {
|
|
149
|
-
args,
|
|
163
|
+
args: effectiveArgs,
|
|
150
164
|
client,
|
|
165
|
+
componentEnvironment: typeof effectiveArgs.env === 'string' ? effectiveArgs.env : undefined,
|
|
151
166
|
cwd: process.cwd(),
|
|
152
167
|
packageVersion,
|
|
153
168
|
print,
|
|
154
169
|
println,
|
|
155
170
|
error: (message) => printError(new Error(message)),
|
|
171
|
+
warn: (message) => process.stderr.write(`Warning: ${message}\n`),
|
|
156
172
|
};
|
|
157
173
|
}
|
|
158
174
|
function printHelp() {
|
|
159
175
|
print(renderHelp(packageVersion));
|
|
160
176
|
}
|
|
161
|
-
|
|
162
|
-
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) {
|
|
163
193
|
await maybeNotifyUpdateAvailable({
|
|
164
194
|
args,
|
|
165
195
|
currentVersion: packageVersion,
|
|
@@ -188,22 +218,68 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
188
218
|
await handleAuthCommand(context);
|
|
189
219
|
return;
|
|
190
220
|
}
|
|
221
|
+
if (command === 'terminal') {
|
|
222
|
+
const terminalIndex = argv.indexOf('terminal');
|
|
223
|
+
const terminalArgs = argv.slice(terminalIndex + 1);
|
|
224
|
+
const action = args._[1] || 'help';
|
|
225
|
+
const actionIndex = terminalArgs.indexOf(action);
|
|
226
|
+
if (actionIndex >= 0)
|
|
227
|
+
terminalArgs.splice(actionIndex, 1);
|
|
228
|
+
await handleTerminalCommand([action, ...argv.slice(0, terminalIndex), ...terminalArgs]);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
191
231
|
if (command === 'component') {
|
|
192
232
|
await handleComponentCommand(context);
|
|
193
233
|
return;
|
|
194
234
|
}
|
|
235
|
+
if (command === 'database-tables' || command === 'database-schemas') {
|
|
236
|
+
await handleDatabaseTablesCommand(context);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
if (command === 'database-views') {
|
|
240
|
+
await handleDatabaseViewsCommand(context);
|
|
241
|
+
return;
|
|
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
|
+
}
|
|
195
259
|
if (command === 'endpoints') {
|
|
196
260
|
await handleEndpointsCommand(context);
|
|
197
261
|
return;
|
|
198
262
|
}
|
|
199
|
-
if (command === 'env') {
|
|
263
|
+
if (command === 'projects' || command === 'env') {
|
|
200
264
|
await handleEnvCommand(context);
|
|
201
265
|
return;
|
|
202
266
|
}
|
|
267
|
+
if (command === 'events') {
|
|
268
|
+
await handleEventsCommand(context);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
203
271
|
if (command === 'metadata') {
|
|
204
272
|
await handleMetadataCommand(context);
|
|
205
273
|
return;
|
|
206
274
|
}
|
|
275
|
+
if (command === 'migrate') {
|
|
276
|
+
await handleMigrateCommand(context);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (command === 'job-templates') {
|
|
280
|
+
await handleJobTemplatesCommand(context);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
207
283
|
if (command === 'project') {
|
|
208
284
|
await handleProjectCommand(context);
|
|
209
285
|
return;
|
|
@@ -216,8 +292,49 @@ export async function main(argv = process.argv.slice(2)) {
|
|
|
216
292
|
await handleRequestCommand(context);
|
|
217
293
|
return;
|
|
218
294
|
}
|
|
295
|
+
if (command === 'role-groups') {
|
|
296
|
+
await handleRoleGroupsCommand(context);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (command === 'groups') {
|
|
300
|
+
await handleGroupsCommand(context);
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
if (command === 'schedules') {
|
|
304
|
+
await handleSchedulesCommand(context);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
219
307
|
throw new Error(`Unknown command: ${command}`);
|
|
220
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
|
+
}
|
|
221
338
|
if (isDirectExecution()) {
|
|
222
339
|
main().catch((error) => {
|
|
223
340
|
printError(error);
|
package/dist/src/client.d.ts
CHANGED
|
@@ -1,14 +1,271 @@
|
|
|
1
|
+
import type { ComponentRecord, DatabaseSchemaRecord, DatabaseViewRecord, EndpointRecord, EventRecord, GroupRecord, JobTemplateRecord, RoleGroupRecord, ScheduleRecord } from './types.ts';
|
|
1
2
|
export type RequestOptions = {
|
|
2
3
|
query?: Record<string, unknown>;
|
|
3
4
|
body?: unknown;
|
|
4
5
|
headers?: HeadersInit;
|
|
5
6
|
authGuard?: boolean;
|
|
6
7
|
spinnerLabel?: string;
|
|
8
|
+
productionWrite?: boolean;
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
/** Explicitly trusted service endpoint, such as the sandbox URL returned by /me. */
|
|
11
|
+
allowExternalOrigin?: boolean;
|
|
12
|
+
maxRetries?: number;
|
|
13
|
+
retryDelayMs?: number;
|
|
7
14
|
};
|
|
8
|
-
export type
|
|
15
|
+
export type PaginatedListRequest = {
|
|
9
16
|
path?: string;
|
|
10
17
|
query?: Record<string, unknown>;
|
|
11
18
|
};
|
|
19
|
+
export type ComponentListRequest = PaginatedListRequest;
|
|
20
|
+
export type DatabaseSchemaListRequest = PaginatedListRequest;
|
|
21
|
+
export type DatabaseSchemaResponse = DatabaseSchemaRecord | {
|
|
22
|
+
data: DatabaseSchemaRecord;
|
|
23
|
+
};
|
|
24
|
+
export type DatabaseSchemaStatsRecord = {
|
|
25
|
+
databaseId: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
type?: string;
|
|
28
|
+
size: {
|
|
29
|
+
total: number;
|
|
30
|
+
table: number;
|
|
31
|
+
indexes: number;
|
|
32
|
+
relations: number;
|
|
33
|
+
audit: number;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export type DatabaseSchemaMetadataWritePayload = {
|
|
37
|
+
version: number;
|
|
38
|
+
metadata: Record<string, unknown>;
|
|
39
|
+
};
|
|
40
|
+
export type DatabaseSchemaUpdatePayload = Omit<DatabaseSchemaMetadataWritePayload, 'metadata'> & {
|
|
41
|
+
name?: string;
|
|
42
|
+
metadata?: Record<string, unknown>;
|
|
43
|
+
category?: string;
|
|
44
|
+
desc?: string;
|
|
45
|
+
definition?: Record<string, unknown>[];
|
|
46
|
+
};
|
|
47
|
+
export type DatabaseSchemaCreatePayload = {
|
|
48
|
+
name: string;
|
|
49
|
+
category?: string | null;
|
|
50
|
+
desc?: string;
|
|
51
|
+
metadata: Record<string, unknown>;
|
|
52
|
+
definition?: Record<string, unknown>[];
|
|
53
|
+
partition?: Record<string, unknown>;
|
|
54
|
+
parent?: string;
|
|
55
|
+
audit?: false;
|
|
56
|
+
restricted?: boolean;
|
|
57
|
+
};
|
|
58
|
+
export type DatabaseViewPreviewPayload = ({
|
|
59
|
+
definitionMode: 'STRUCTURED';
|
|
60
|
+
request: Record<string, unknown>;
|
|
61
|
+
} | {
|
|
62
|
+
definitionMode: 'RAW_SQL';
|
|
63
|
+
rawQuery: string;
|
|
64
|
+
}) & {
|
|
65
|
+
take: 0 | 1;
|
|
66
|
+
output?: {
|
|
67
|
+
take: 0 | 1;
|
|
68
|
+
count: false;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export type DatabaseViewCreatePayload = {
|
|
72
|
+
name: string;
|
|
73
|
+
category?: string | null;
|
|
74
|
+
desc?: string;
|
|
75
|
+
metadata: Record<string, unknown>;
|
|
76
|
+
type: 'VIEW' | 'MATERIALIZED_VIEW';
|
|
77
|
+
restricted: true;
|
|
78
|
+
users: [];
|
|
79
|
+
groups: [];
|
|
80
|
+
uniqueKey?: string[];
|
|
81
|
+
indexes?: Array<{
|
|
82
|
+
columns: Array<{
|
|
83
|
+
name: string;
|
|
84
|
+
}>;
|
|
85
|
+
unique?: boolean;
|
|
86
|
+
}>;
|
|
87
|
+
} & ({
|
|
88
|
+
definitionMode: 'STRUCTURED';
|
|
89
|
+
request: Record<string, unknown>;
|
|
90
|
+
} | {
|
|
91
|
+
definitionMode: 'RAW_SQL';
|
|
92
|
+
rawQuery: string;
|
|
93
|
+
});
|
|
94
|
+
export type DatabaseViewUpdatePayload = {
|
|
95
|
+
name: string;
|
|
96
|
+
category?: string | null;
|
|
97
|
+
desc?: string | null;
|
|
98
|
+
metadata: Record<string, unknown>;
|
|
99
|
+
type: 'VIEW' | 'MATERIALIZED_VIEW';
|
|
100
|
+
restricted: boolean;
|
|
101
|
+
users: string[];
|
|
102
|
+
groups: string[];
|
|
103
|
+
version: number;
|
|
104
|
+
uniqueKey?: string[];
|
|
105
|
+
indexes?: Array<{
|
|
106
|
+
name?: string;
|
|
107
|
+
columns: Array<{
|
|
108
|
+
name: string;
|
|
109
|
+
}>;
|
|
110
|
+
unique?: boolean;
|
|
111
|
+
[key: string]: unknown;
|
|
112
|
+
}>;
|
|
113
|
+
} & ({
|
|
114
|
+
definitionMode: 'STRUCTURED';
|
|
115
|
+
request: Record<string, unknown>;
|
|
116
|
+
} | {
|
|
117
|
+
definitionMode: 'RAW_SQL';
|
|
118
|
+
rawQuery: string;
|
|
119
|
+
});
|
|
120
|
+
export type EndpointListRequest = ComponentListRequest;
|
|
121
|
+
export type EndpointWritePayload = {
|
|
122
|
+
version: number;
|
|
123
|
+
metadata: Record<string, unknown>;
|
|
124
|
+
name?: string;
|
|
125
|
+
category?: string | null;
|
|
126
|
+
desc?: string;
|
|
127
|
+
componentId?: string | null;
|
|
128
|
+
componentVersion?: number | null;
|
|
129
|
+
timeout?: number;
|
|
130
|
+
path?: string;
|
|
131
|
+
method?: string;
|
|
132
|
+
options?: Record<string, unknown> | null;
|
|
133
|
+
};
|
|
134
|
+
export type EndpointCreatePayload = Omit<EndpointWritePayload, 'version'> & {
|
|
135
|
+
name: string;
|
|
136
|
+
active: boolean;
|
|
137
|
+
path: string;
|
|
138
|
+
method: string;
|
|
139
|
+
};
|
|
140
|
+
export type RoleGroupListRequest = {
|
|
141
|
+
path?: string;
|
|
142
|
+
query?: Record<string, unknown>;
|
|
143
|
+
};
|
|
144
|
+
export type GroupListRequest = ComponentListRequest;
|
|
145
|
+
export type JobTemplateListRequest = ComponentListRequest;
|
|
146
|
+
export type JobTemplateResponse = JobTemplateRecord | {
|
|
147
|
+
data: JobTemplateRecord;
|
|
148
|
+
};
|
|
149
|
+
export type ScheduleListRequest = ComponentListRequest;
|
|
150
|
+
export type ScheduleResponse = ScheduleRecord | {
|
|
151
|
+
data: ScheduleRecord;
|
|
152
|
+
};
|
|
153
|
+
export type EventListRequest = ComponentListRequest;
|
|
154
|
+
export type EventResponse = EventRecord | {
|
|
155
|
+
data: EventRecord;
|
|
156
|
+
};
|
|
157
|
+
export type EventMetadataWritePayload = {
|
|
158
|
+
version: number;
|
|
159
|
+
metadata: Record<string, unknown>;
|
|
160
|
+
};
|
|
161
|
+
export type EventWritePayload = EventMetadataWritePayload & {
|
|
162
|
+
custom?: boolean;
|
|
163
|
+
name?: string;
|
|
164
|
+
category?: string | null;
|
|
165
|
+
desc?: string;
|
|
166
|
+
type?: string;
|
|
167
|
+
targetType?: string;
|
|
168
|
+
targetId?: string;
|
|
169
|
+
filter?: Record<string, unknown> | null;
|
|
170
|
+
[key: string]: unknown;
|
|
171
|
+
};
|
|
172
|
+
export type EventCreatePayload = Omit<EventWritePayload, 'version'> & {
|
|
173
|
+
name: string;
|
|
174
|
+
active: boolean;
|
|
175
|
+
custom: boolean;
|
|
176
|
+
type: string;
|
|
177
|
+
targetType: string;
|
|
178
|
+
targetId: string;
|
|
179
|
+
};
|
|
180
|
+
export type EventListAllOptions = {
|
|
181
|
+
includeDeleted?: boolean;
|
|
182
|
+
};
|
|
183
|
+
export type ScheduleWritePayload = {
|
|
184
|
+
version: number;
|
|
185
|
+
metadata: Record<string, unknown>;
|
|
186
|
+
name?: string;
|
|
187
|
+
category?: string | null;
|
|
188
|
+
desc?: string;
|
|
189
|
+
cron?: string;
|
|
190
|
+
timezone?: string;
|
|
191
|
+
targetType?: string;
|
|
192
|
+
targetId?: string;
|
|
193
|
+
targetVersion?: number | null;
|
|
194
|
+
targetConfig?: Record<string, unknown> | null;
|
|
195
|
+
};
|
|
196
|
+
export type ScheduleCreatePayload = {
|
|
197
|
+
name: string;
|
|
198
|
+
category?: string | null;
|
|
199
|
+
active: boolean;
|
|
200
|
+
desc?: string;
|
|
201
|
+
metadata: Record<string, unknown>;
|
|
202
|
+
cron: string;
|
|
203
|
+
timezone: string;
|
|
204
|
+
targetType: string;
|
|
205
|
+
targetId: string;
|
|
206
|
+
targetVersion?: number | null;
|
|
207
|
+
targetConfig?: Record<string, unknown> | null;
|
|
208
|
+
};
|
|
209
|
+
export type JobTemplateUpdatePayload = {
|
|
210
|
+
version: number;
|
|
211
|
+
name?: string;
|
|
212
|
+
category?: string | null;
|
|
213
|
+
desc?: string;
|
|
214
|
+
metadata?: Record<string, unknown>;
|
|
215
|
+
componentId?: string;
|
|
216
|
+
timeout?: number | null;
|
|
217
|
+
options?: unknown;
|
|
218
|
+
inputs?: unknown;
|
|
219
|
+
};
|
|
220
|
+
export type JobTemplateCreatePayload = {
|
|
221
|
+
name: string;
|
|
222
|
+
category?: string | null;
|
|
223
|
+
desc?: string;
|
|
224
|
+
metadata: Record<string, unknown>;
|
|
225
|
+
componentId: string;
|
|
226
|
+
timeout?: number;
|
|
227
|
+
options?: unknown;
|
|
228
|
+
inputs?: unknown;
|
|
229
|
+
};
|
|
230
|
+
export type RoleGroupResponse = RoleGroupRecord | {
|
|
231
|
+
data: RoleGroupRecord;
|
|
232
|
+
};
|
|
233
|
+
export type GroupResponse = GroupRecord | {
|
|
234
|
+
data: GroupRecord;
|
|
235
|
+
};
|
|
236
|
+
export type GroupWritePayload = {
|
|
237
|
+
version: number;
|
|
238
|
+
metadata: Record<string, unknown>;
|
|
239
|
+
name?: string;
|
|
240
|
+
category?: string | null;
|
|
241
|
+
desc?: string;
|
|
242
|
+
ownerId?: string;
|
|
243
|
+
ownerType?: 'GROUP';
|
|
244
|
+
};
|
|
245
|
+
export type GroupCreatePayload = Omit<GroupWritePayload, 'version'> & {
|
|
246
|
+
name: string;
|
|
247
|
+
ownerId: string;
|
|
248
|
+
ownerType: 'GROUP';
|
|
249
|
+
members: string[];
|
|
250
|
+
};
|
|
251
|
+
export type RoleGroupWritePayload = {
|
|
252
|
+
name?: string;
|
|
253
|
+
category?: string | null;
|
|
254
|
+
desc?: string;
|
|
255
|
+
metadata: Record<string, unknown>;
|
|
256
|
+
version?: number;
|
|
257
|
+
};
|
|
258
|
+
export type RoleGroupCreatePayload = RoleGroupWritePayload & {
|
|
259
|
+
name: string;
|
|
260
|
+
roles: string[];
|
|
261
|
+
};
|
|
262
|
+
export type SystemRoleRecord = {
|
|
263
|
+
roleKey?: string;
|
|
264
|
+
key?: string;
|
|
265
|
+
name?: string;
|
|
266
|
+
code?: string;
|
|
267
|
+
[key: string]: unknown;
|
|
268
|
+
};
|
|
12
269
|
export type DebugStreamEvent = {
|
|
13
270
|
event: string;
|
|
14
271
|
data: unknown;
|
|
@@ -18,7 +275,17 @@ export type ClientOptions = {
|
|
|
18
275
|
instance?: string;
|
|
19
276
|
token?: string;
|
|
20
277
|
envName?: string;
|
|
278
|
+
environmentName?: string;
|
|
279
|
+
production?: true;
|
|
21
280
|
fetch?: typeof fetch;
|
|
281
|
+
confirmProductionWrite?: (details: {
|
|
282
|
+
baseUrl: string;
|
|
283
|
+
method: string;
|
|
284
|
+
path: string;
|
|
285
|
+
}) => Promise<boolean>;
|
|
286
|
+
trustedServiceOrigins?: string[];
|
|
287
|
+
maxRetries?: number;
|
|
288
|
+
retryDelayMs?: number;
|
|
22
289
|
};
|
|
23
290
|
export type ApiResponse<T = unknown> = {
|
|
24
291
|
status: number;
|
|
@@ -29,14 +296,20 @@ export type ApiResponse<T = unknown> = {
|
|
|
29
296
|
export declare class ApiError extends Error {
|
|
30
297
|
status: number;
|
|
31
298
|
data: unknown;
|
|
32
|
-
|
|
299
|
+
headers?: Headers;
|
|
300
|
+
constructor(status: number, message: string, data: unknown, headers?: Headers);
|
|
301
|
+
}
|
|
302
|
+
export declare class RequestTimeoutError extends Error {
|
|
303
|
+
readonly timeoutMs: number;
|
|
304
|
+
readonly path: string;
|
|
305
|
+
constructor(timeoutMs: number, path: string);
|
|
33
306
|
}
|
|
34
307
|
export declare class AuthenticationError extends ApiError {
|
|
35
|
-
constructor(status: number, message: string, data: unknown);
|
|
308
|
+
constructor(status: number, message: string, data: unknown, headers?: Headers);
|
|
36
309
|
}
|
|
37
310
|
export declare class PermissionDeniedError extends ApiError {
|
|
38
311
|
path: string;
|
|
39
|
-
constructor(path: string, message: string, data: unknown);
|
|
312
|
+
constructor(path: string, message: string, data: unknown, headers?: Headers);
|
|
40
313
|
}
|
|
41
314
|
declare const COMPONENT_LIST_PAGE_SIZE = 200;
|
|
42
315
|
declare function buildUrl(baseUrl: string, requestPath: string, query?: Record<string, unknown>): URL;
|
|
@@ -46,7 +319,14 @@ export declare class RevoClient {
|
|
|
46
319
|
baseUrl: string;
|
|
47
320
|
instance: string;
|
|
48
321
|
token: string;
|
|
322
|
+
production: boolean;
|
|
323
|
+
environmentName: string;
|
|
49
324
|
fetchImpl: typeof fetch | undefined;
|
|
325
|
+
private productionWriteConfirmed;
|
|
326
|
+
private confirmProductionWrite;
|
|
327
|
+
private trustedServiceOrigins;
|
|
328
|
+
private maxRetries;
|
|
329
|
+
private retryDelayMs;
|
|
50
330
|
constructor(options?: ClientOptions);
|
|
51
331
|
get authHeader(): string;
|
|
52
332
|
get authValidationKey(): string;
|
|
@@ -63,11 +343,50 @@ export declare class RevoClient {
|
|
|
63
343
|
profile: unknown;
|
|
64
344
|
}>;
|
|
65
345
|
request(method: string, path: string, options?: RequestOptions): Promise<ApiResponse>;
|
|
346
|
+
private assertProductionWriteConfirmed;
|
|
66
347
|
requestData<T = unknown>(method: string, path: string, options?: RequestOptions): Promise<T>;
|
|
67
348
|
me(options?: {
|
|
68
349
|
force?: boolean;
|
|
69
350
|
}): Promise<unknown>;
|
|
70
|
-
listEndpoints(): Promise<unknown>;
|
|
351
|
+
listEndpoints(options?: EndpointListRequest): Promise<unknown>;
|
|
352
|
+
listDatabaseSchemas(options?: DatabaseSchemaListRequest): Promise<unknown>;
|
|
353
|
+
listAllDatabaseSchemas(options?: {
|
|
354
|
+
projection?: 'thin' | 'pull';
|
|
355
|
+
skipPartitions?: boolean;
|
|
356
|
+
}): Promise<{
|
|
357
|
+
databases: DatabaseSchemaRecord[];
|
|
358
|
+
discoveredTotal: number | null;
|
|
359
|
+
}>;
|
|
360
|
+
findActiveDatabaseSchemasByField(field: string, value: unknown, path?: Array<string | number>): Promise<DatabaseSchemaRecord[]>;
|
|
361
|
+
getDatabaseSchemaStats(): Promise<DatabaseSchemaStatsRecord[]>;
|
|
362
|
+
getDatabaseSchema(databaseId: string): Promise<DatabaseSchemaResponse>;
|
|
363
|
+
createDatabaseSchema(body: DatabaseSchemaCreatePayload): Promise<DatabaseSchemaResponse>;
|
|
364
|
+
updateDatabaseSchemaMetadata(databaseId: string, body: DatabaseSchemaMetadataWritePayload): Promise<DatabaseSchemaResponse>;
|
|
365
|
+
updateDatabaseSchema(databaseId: string, body: DatabaseSchemaUpdatePayload): Promise<DatabaseSchemaResponse>;
|
|
366
|
+
deleteDatabaseSchema(databaseId: string): Promise<unknown>;
|
|
367
|
+
listAllDatabaseViews(): Promise<DatabaseViewRecord[]>;
|
|
368
|
+
getDatabaseView(databaseViewId: string, options?: Pick<RequestOptions, 'timeoutMs' | 'maxRetries'>): Promise<DatabaseViewRecord | {
|
|
369
|
+
data: DatabaseViewRecord;
|
|
370
|
+
}>;
|
|
371
|
+
listAllDatabaseViewsForSync(): Promise<DatabaseViewRecord[]>;
|
|
372
|
+
previewDatabaseView(body: DatabaseViewPreviewPayload): Promise<unknown>;
|
|
373
|
+
createDatabaseView(body: DatabaseViewCreatePayload): Promise<DatabaseViewRecord | {
|
|
374
|
+
data: DatabaseViewRecord;
|
|
375
|
+
}>;
|
|
376
|
+
updateDatabaseView(databaseViewId: string, body: DatabaseViewUpdatePayload): Promise<DatabaseViewRecord | {
|
|
377
|
+
data: DatabaseViewRecord;
|
|
378
|
+
}>;
|
|
379
|
+
listAllEndpoints(): Promise<{
|
|
380
|
+
endpoints: EndpointRecord[];
|
|
381
|
+
discoveredTotal: number | null;
|
|
382
|
+
}>;
|
|
383
|
+
getEndpoint(endpointId: string, options?: Pick<RequestOptions, 'timeoutMs'>): Promise<EndpointRecord>;
|
|
384
|
+
createEndpoint(body: EndpointCreatePayload): Promise<EndpointRecord>;
|
|
385
|
+
updateEndpoint(endpointId: string, body: EndpointWritePayload): Promise<EndpointRecord>;
|
|
386
|
+
activateEndpoint(endpointId: string): Promise<void>;
|
|
387
|
+
disableEndpoint(endpointId: string): Promise<void>;
|
|
388
|
+
restoreEndpoint(endpointId: string): Promise<void>;
|
|
389
|
+
getComponentSnapshotVersion(componentId: string, version: number): Promise<ComponentRecord>;
|
|
71
390
|
getEditorTypes(requestPath?: string): Promise<unknown>;
|
|
72
391
|
debugComponent(requestPath: string, body: unknown): Promise<unknown>;
|
|
73
392
|
debugComponentStream(requestPath: string, body: unknown): AsyncGenerator<DebugStreamEvent>;
|
|
@@ -77,10 +396,58 @@ export declare class RevoClient {
|
|
|
77
396
|
components: Record<string, unknown>[];
|
|
78
397
|
discoveredTotal: number | null;
|
|
79
398
|
}>;
|
|
80
|
-
getComponent(componentId: string): Promise<unknown>;
|
|
399
|
+
getComponent(componentId: string, options?: Pick<RequestOptions, 'timeoutMs'>): Promise<unknown>;
|
|
81
400
|
createComponent(body: unknown): Promise<unknown>;
|
|
82
401
|
updateComponent(componentId: string, body: unknown): Promise<unknown>;
|
|
83
402
|
deleteComponent(componentId: string): Promise<ApiResponse<unknown>>;
|
|
403
|
+
listRoleGroups(options?: RoleGroupListRequest): Promise<unknown>;
|
|
404
|
+
listAllRoleGroups(): Promise<{
|
|
405
|
+
roleGroups: RoleGroupRecord[];
|
|
406
|
+
discoveredTotal: number | null;
|
|
407
|
+
}>;
|
|
408
|
+
getRoleGroup(roleGroupId: string, options?: Pick<RequestOptions, 'timeoutMs' | 'maxRetries'>): Promise<RoleGroupResponse>;
|
|
409
|
+
listGroups(options?: GroupListRequest): Promise<unknown>;
|
|
410
|
+
listAllGroups(): Promise<{
|
|
411
|
+
groups: GroupRecord[];
|
|
412
|
+
discoveredTotal: number | null;
|
|
413
|
+
}>;
|
|
414
|
+
getGroup(groupId: string, options?: Pick<RequestOptions, 'timeoutMs' | 'maxRetries'>): Promise<GroupResponse>;
|
|
415
|
+
listJobTemplates(options?: JobTemplateListRequest): Promise<unknown>;
|
|
416
|
+
listAllJobTemplates(): Promise<{
|
|
417
|
+
jobTemplates: JobTemplateRecord[];
|
|
418
|
+
discoveredTotal: number | null;
|
|
419
|
+
}>;
|
|
420
|
+
getJobTemplate(jobTemplateId: string, options?: Pick<RequestOptions, 'timeoutMs' | 'maxRetries'>): Promise<JobTemplateResponse>;
|
|
421
|
+
createJobTemplate(body: JobTemplateCreatePayload): Promise<JobTemplateResponse>;
|
|
422
|
+
updateJobTemplate(jobTemplateId: string, body: JobTemplateUpdatePayload): Promise<JobTemplateResponse>;
|
|
423
|
+
listSchedules(options?: ScheduleListRequest): Promise<unknown>;
|
|
424
|
+
listAllSchedules(): Promise<{
|
|
425
|
+
schedules: ScheduleRecord[];
|
|
426
|
+
discoveredTotal: number | null;
|
|
427
|
+
}>;
|
|
428
|
+
getSchedule(scheduleId: string, options?: Pick<RequestOptions, 'timeoutMs' | 'maxRetries'>): Promise<ScheduleResponse>;
|
|
429
|
+
createSchedule(body: ScheduleCreatePayload): Promise<ScheduleResponse>;
|
|
430
|
+
updateSchedule(scheduleId: string, body: ScheduleWritePayload): Promise<ScheduleResponse>;
|
|
431
|
+
activateSchedule(scheduleId: string): Promise<unknown>;
|
|
432
|
+
listEvents(options?: EventListRequest): Promise<unknown>;
|
|
433
|
+
listAllEvents({ includeDeleted }?: EventListAllOptions): Promise<{
|
|
434
|
+
events: EventRecord[];
|
|
435
|
+
discoveredTotal: number | null;
|
|
436
|
+
}>;
|
|
437
|
+
getEvent(eventId: string, options?: Pick<RequestOptions, 'timeoutMs' | 'maxRetries'>): Promise<EventResponse>;
|
|
438
|
+
createEvent(body: EventCreatePayload): Promise<EventResponse>;
|
|
439
|
+
updateEvent(eventId: string, body: EventWritePayload): Promise<EventResponse>;
|
|
440
|
+
activateEvent(eventId: string): Promise<unknown>;
|
|
441
|
+
disableEvent(eventId: string): Promise<unknown>;
|
|
442
|
+
createRoleGroup(body: RoleGroupCreatePayload): Promise<RoleGroupResponse>;
|
|
443
|
+
updateRoleGroup(roleGroupId: string, body: RoleGroupWritePayload): Promise<RoleGroupResponse>;
|
|
444
|
+
updateGroup(groupId: string, body: GroupWritePayload): Promise<GroupResponse>;
|
|
445
|
+
createGroup(body: GroupCreatePayload): Promise<GroupResponse>;
|
|
446
|
+
addRoleGroupRole(roleGroupId: string, roleKey: string): Promise<unknown>;
|
|
447
|
+
removeRoleGroupRole(roleGroupId: string, roleKey: string): Promise<unknown>;
|
|
448
|
+
deleteRoleGroup(roleGroupId: string): Promise<ApiResponse<unknown>>;
|
|
449
|
+
listSystemRoles(): Promise<unknown>;
|
|
450
|
+
listAllSystemRoles(): Promise<SystemRoleRecord[]>;
|
|
84
451
|
saveComponentElements(componentId: string, body: unknown): Promise<ApiResponse<unknown>>;
|
|
85
452
|
}
|
|
86
453
|
export { COMPONENT_LIST_PAGE_SIZE };
|