@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
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
/** Replace one resource directory only after its replacement is fully written. */
|
|
4
|
+
export function replaceWorkspaceResourceDirectory(root, directory, populate) {
|
|
5
|
+
const resolvedRoot = path.resolve(root);
|
|
6
|
+
const resolvedDirectory = path.resolve(directory);
|
|
7
|
+
const relative = path.relative(resolvedRoot, resolvedDirectory);
|
|
8
|
+
if (!relative || relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
|
|
9
|
+
throw new Error(`Resource directory must be inside workspace root: ${directory}`);
|
|
10
|
+
}
|
|
11
|
+
// Never replace a symlink or write through a symlink in the selected path.
|
|
12
|
+
for (let current = resolvedDirectory;; current = path.dirname(current)) {
|
|
13
|
+
if (fs.lstatSync(current, { throwIfNoEntry: false })?.isSymbolicLink()) {
|
|
14
|
+
throw new Error(`Cannot replace a resource through a symbolic link: ${current}`);
|
|
15
|
+
}
|
|
16
|
+
if (current === resolvedRoot) {
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const parent = path.dirname(resolvedDirectory);
|
|
21
|
+
fs.mkdirSync(parent, { recursive: true });
|
|
22
|
+
const transaction = fs.mkdtempSync(path.join(parent, '.revo-pull-'));
|
|
23
|
+
const staged = path.join(transaction, 'new');
|
|
24
|
+
const backup = path.join(transaction, 'previous');
|
|
25
|
+
fs.mkdirSync(staged);
|
|
26
|
+
let backedUp = false;
|
|
27
|
+
let installed = false;
|
|
28
|
+
try {
|
|
29
|
+
populate(staged);
|
|
30
|
+
if (fs.existsSync(resolvedDirectory)) {
|
|
31
|
+
fs.renameSync(resolvedDirectory, backup);
|
|
32
|
+
backedUp = true;
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
fs.renameSync(staged, resolvedDirectory);
|
|
36
|
+
installed = true;
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
if (backedUp) {
|
|
40
|
+
fs.renameSync(backup, resolvedDirectory);
|
|
41
|
+
backedUp = false;
|
|
42
|
+
}
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
// Keep the backup if restoring the original directory itself failed.
|
|
48
|
+
if (installed || !backedUp) {
|
|
49
|
+
fs.rmSync(transaction, { recursive: true, force: true });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@revoengine/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "CLI package for the RevoEngine Platform API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -9,11 +9,13 @@
|
|
|
9
9
|
"revoengine": "dist/bin/revo.js"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build": "tsc -p tsconfig.build.json",
|
|
13
|
-
"
|
|
12
|
+
"build": "npm run clean && tsc -p tsconfig.build.json",
|
|
13
|
+
"clean": "node --input-type=module -e \"import fs from 'node:fs'; fs.rmSync('dist', { recursive: true, force: true });\"",
|
|
14
|
+
"check": "node --input-type=module -e \"await import('./src/config.ts'); await import('./src/legacy.ts'); await import('./src/http-trace.ts'); await import('./src/client.ts'); await import('./src/component-lock.ts'); await import('./src/diff-details.ts'); await import('./src/resource-metadata.ts'); await import('./src/tracked-resources.ts'); await import('./src/resource-inventory.ts'); await import('./src/metadata-backfill.ts'); await import('./src/workspace-component.ts'); await import('./src/workspace-resource.ts'); await import('./src/database-table-artifacts.ts'); await import('./src/project.ts'); await import('./src/prompt.ts'); await import('./src/runtime-view.ts'); await import('./src/spinner.ts'); await import('./src/types.ts'); await import('./src/utils.ts'); await import('./src/resource-syncs/util.ts'); await import('./src/resource-syncs/database-table-sync.ts'); await import('./src/resource-syncs/database-view-sync.ts'); await import('./src/resource-syncs/endpoint-sync.ts'); await import('./src/resource-syncs/group-sync.ts'); await import('./src/resource-syncs/role-group-sync.ts'); await import('./src/resource-syncs/job-template-sync.ts'); await import('./src/resource-syncs/schedule-sync.ts'); await import('./src/resource-syncs/event-sync.ts'); await import('./src/migration.ts'); await import('./src/workspace-diff.ts'); await import('./src/sync-output.ts'); await import('./src/ui.ts'); await import('./src/update-notifier.ts'); await import('./src/env-sync.ts'); await import('./src/commands/auth.ts'); await import('./src/commands/component.ts'); await import('./src/commands/database-tables.ts'); await import('./src/commands/database-views.ts'); await import('./src/commands/endpoints.ts'); await import('./src/commands/env.ts'); await import('./src/commands/events.ts'); await import('./src/commands/groups.ts'); await import('./src/commands/info.ts'); await import('./src/commands/job-templates.ts'); await import('./src/commands/metadata.ts'); await import('./src/commands/migrate.ts'); await import('./src/commands/request.ts'); await import('./src/commands/role-groups.ts'); await import('./src/commands/search.ts'); await import('./src/commands/schedules.ts'); await import('./src/commands/terminal-service.ts'); await import('./src/commands/terminal-browser.ts'); await import('./src/commands/terminal-image.ts'); await import('./src/commands/terminal-sandbox.ts'); await import('./src/commands/terminal-patch.ts'); await import('./src/commands/terminal-patch-worker.ts'); await import('./src/commands/terminal.ts'); await import('./src/cli.ts'); await import('./src/index.ts'); await import('./bin/revo.ts'); await import('./scripts/dev.ts')\"",
|
|
14
15
|
"dev": "node ./scripts/dev.ts",
|
|
15
16
|
"prepack": "npm run build",
|
|
16
|
-
"test": "node --test ./test/*.test.ts"
|
|
17
|
+
"test": "node --test ./test/*.test.ts",
|
|
18
|
+
"postinstall": "playwright-core install --only-shell chromium"
|
|
17
19
|
},
|
|
18
20
|
"files": [
|
|
19
21
|
"dist/",
|
|
@@ -27,6 +29,12 @@
|
|
|
27
29
|
"license": "MIT",
|
|
28
30
|
"devDependencies": {
|
|
29
31
|
"@types/node": "^25.5.0",
|
|
32
|
+
"@types/ws": "^8.18.1",
|
|
30
33
|
"typescript": "^6.0.3"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"ws": "^8.19.0",
|
|
37
|
+
"node-pty": "^1.0.0",
|
|
38
|
+
"playwright-core": "1.63.0"
|
|
31
39
|
}
|
|
32
40
|
}
|