@elevasis/sdk 0.8.2 → 0.8.3
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/dist/cli.cjs +42 -1
- package/dist/templates.js +1 -0
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -43883,7 +43883,7 @@ function wrapAction(commandName, fn) {
|
|
|
43883
43883
|
// package.json
|
|
43884
43884
|
var package_default = {
|
|
43885
43885
|
name: "@elevasis/sdk",
|
|
43886
|
-
version: "0.8.
|
|
43886
|
+
version: "0.8.3",
|
|
43887
43887
|
description: "SDK for building Elevasis organization resources",
|
|
43888
43888
|
type: "module",
|
|
43889
43889
|
bin: {
|
|
@@ -45633,6 +45633,7 @@ Use \`pnpm exec elevasis-sdk\` for runtime commands (resolves the locally instal
|
|
|
45633
45633
|
- \`pnpm exec elevasis-sdk exec <resource-id> --input '{...}'\` -- run a resource synchronously
|
|
45634
45634
|
- \`pnpm exec elevasis-sdk exec <resource-id> --input '{...}' --async\` -- run async, returns execution ID
|
|
45635
45635
|
- \`pnpm exec elevasis-sdk execution <resource-id> <execution-id>\` -- inspect execution detail
|
|
45636
|
+
- \`pnpm exec elevasis-sdk rename <old-id> --to <new-id> [--execute]\` -- rename a resource ID across platform tables (dry run by default)
|
|
45636
45637
|
|
|
45637
45638
|
Organization is derived from your API key -- no org prefix needed in the resource ID.
|
|
45638
45639
|
For full CLI reference: \`reference/cli.mdx\`
|
|
@@ -48438,6 +48439,44 @@ function registerCredsCommand(program3) {
|
|
|
48438
48439
|
}));
|
|
48439
48440
|
}
|
|
48440
48441
|
|
|
48442
|
+
// src/cli/commands/rename.ts
|
|
48443
|
+
function registerRenameCommand(program3) {
|
|
48444
|
+
program3.command("rename <oldResourceId>").description("Rename a resource ID across all platform tables (dry run by default)").requiredOption("--to <newResourceId>", "New resource ID").option("--execute", "Apply the rename (default: dry run preview only)").option("--api-url <url>", "API URL").action(
|
|
48445
|
+
wrapAction("rename", async (oldResourceId, options2) => {
|
|
48446
|
+
const apiUrl = resolveApiUrl(options2.apiUrl);
|
|
48447
|
+
const dryRun = !options2.execute;
|
|
48448
|
+
const spinner = ora(dryRun ? "Checking affected rows..." : "Renaming resource...").start();
|
|
48449
|
+
const data = await apiPost(
|
|
48450
|
+
"/api/external/resources/rename",
|
|
48451
|
+
{ oldResourceId, newResourceId: options2.to, dryRun },
|
|
48452
|
+
apiUrl
|
|
48453
|
+
);
|
|
48454
|
+
spinner.stop();
|
|
48455
|
+
if (dryRun) {
|
|
48456
|
+
console.log(source_default.yellow("\nResource Rename Preview (DRY RUN)"));
|
|
48457
|
+
console.log(` ${source_default.dim(oldResourceId)} ${source_default.gray("\u2192")} ${source_default.bold(options2.to)}`);
|
|
48458
|
+
console.log();
|
|
48459
|
+
console.log(" Tables affected:");
|
|
48460
|
+
const entries = Object.entries(data.changes);
|
|
48461
|
+
const maxLen = Math.max(...entries.map(([t]) => t.length));
|
|
48462
|
+
for (const [table, count] of entries) {
|
|
48463
|
+
const label = `${table}:`.padEnd(maxLen + 1);
|
|
48464
|
+
const word = count === 1 ? "row" : "rows";
|
|
48465
|
+
console.log(` ${source_default.gray(label)} ${source_default.white(String(count))} ${word}`);
|
|
48466
|
+
}
|
|
48467
|
+
console.log();
|
|
48468
|
+
console.log(` Total: ${source_default.bold(String(data.totalRowsAffected))} rows would be updated`);
|
|
48469
|
+
console.log();
|
|
48470
|
+
console.log(source_default.gray(" Pass --execute to apply this rename."));
|
|
48471
|
+
} else {
|
|
48472
|
+
console.log(source_default.green("\nResource Renamed Successfully!"));
|
|
48473
|
+
console.log(` ${source_default.dim(oldResourceId)} ${source_default.gray("\u2192")} ${source_default.bold(options2.to)}`);
|
|
48474
|
+
console.log(` ${data.totalRowsAffected} rows updated across ${Object.keys(data.changes).length} tables`);
|
|
48475
|
+
}
|
|
48476
|
+
})
|
|
48477
|
+
);
|
|
48478
|
+
}
|
|
48479
|
+
|
|
48441
48480
|
// src/cli/index.ts
|
|
48442
48481
|
(0, import_dotenv.config)({ path: (0, import_path5.resolve)(process.cwd(), ".env"), override: true });
|
|
48443
48482
|
var program2 = new Command();
|
|
@@ -48453,6 +48492,7 @@ Commands:
|
|
|
48453
48492
|
elevasis-sdk executions <resourceId> List execution history
|
|
48454
48493
|
elevasis-sdk execution <resourceId> <id> Get execution details
|
|
48455
48494
|
elevasis-sdk deployments List deployments
|
|
48495
|
+
elevasis-sdk rename <id> --to <newId> Rename resource across platform tables
|
|
48456
48496
|
elevasis-sdk update Update workspace scaffold to latest template
|
|
48457
48497
|
elevasis-sdk init [directory] Scaffold a new workspace
|
|
48458
48498
|
|
|
@@ -48469,6 +48509,7 @@ registerDeploymentsCommand(program2);
|
|
|
48469
48509
|
registerInitCommand(program2);
|
|
48470
48510
|
registerUpdateCommand(program2);
|
|
48471
48511
|
registerCredsCommand(program2);
|
|
48512
|
+
registerRenameCommand(program2);
|
|
48472
48513
|
program2.parse();
|
|
48473
48514
|
/*! Bundled license information:
|
|
48474
48515
|
|
package/dist/templates.js
CHANGED
|
@@ -274,6 +274,7 @@ Use \`pnpm exec elevasis-sdk\` for runtime commands (resolves the locally instal
|
|
|
274
274
|
- \`pnpm exec elevasis-sdk exec <resource-id> --input '{...}'\` -- run a resource synchronously
|
|
275
275
|
- \`pnpm exec elevasis-sdk exec <resource-id> --input '{...}' --async\` -- run async, returns execution ID
|
|
276
276
|
- \`pnpm exec elevasis-sdk execution <resource-id> <execution-id>\` -- inspect execution detail
|
|
277
|
+
- \`pnpm exec elevasis-sdk rename <old-id> --to <new-id> [--execute]\` -- rename a resource ID across platform tables (dry run by default)
|
|
277
278
|
|
|
278
279
|
Organization is derived from your API key -- no org prefix needed in the resource ID.
|
|
279
280
|
For full CLI reference: \`reference/cli.mdx\`
|