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