@rebasepro/cli 0.9.1-canary.e3f810f → 0.9.1-canary.ed943fa
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.
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { createRebaseClient } from "@rebasepro/client";
|
|
2
|
-
/** Default hosted control plane (the Rebase Cloud console origin). */
|
|
3
|
-
export declare const DEFAULT_CLOUD_URL = "https://app.rebase.pro";
|
|
4
2
|
/** Project-local link file: <project>/.rebase/cloud.json */
|
|
5
3
|
export declare function projectLinkPath(cwd?: string): string;
|
|
6
|
-
/** Host that a bare `rebase cloud` command should target, if any. */
|
|
7
|
-
export declare function currentContextUrl(): string | undefined;
|
|
8
4
|
/** Persist the active organization id for a host. */
|
|
9
5
|
export declare function setContextOrg(url: string, org: string | undefined): void;
|
|
10
6
|
export declare function getContextOrg(url: string): string | undefined;
|
|
@@ -104,8 +100,6 @@ export declare function initOutputMode(rawArgs: string[]): boolean;
|
|
|
104
100
|
export declare function isJsonMode(): boolean;
|
|
105
101
|
/** Force the mode (tests only — production latches it via `initOutputMode`). */
|
|
106
102
|
export declare function setJsonModeForTest(value: boolean): void;
|
|
107
|
-
/** Write one JSON value to stdout, followed by a newline. */
|
|
108
|
-
export declare function printJson(value: unknown): void;
|
|
109
103
|
/**
|
|
110
104
|
* The one output primitive every new command uses: in JSON mode emit `json`
|
|
111
105
|
* (and nothing else); otherwise run `human`. Keeping the two behind a single
|
|
@@ -19,7 +19,6 @@ export interface DeploymentRow {
|
|
|
19
19
|
gitCommitHash?: string;
|
|
20
20
|
gitCommitMessage?: string;
|
|
21
21
|
}
|
|
22
|
-
export declare function deploymentImage(dep: DeploymentRow): string | null;
|
|
23
22
|
/**
|
|
24
23
|
* The backend's rule EXACTLY: a rollback is honoured only for a successful
|
|
25
24
|
* deploy that recorded an image. Any other row 409s `deploy_not_rollbackable`.
|
package/dist/index.es.js
CHANGED
|
@@ -5228,6 +5228,10 @@ async function webhooksCommand(subcommand, rawArgs) {
|
|
|
5228
5228
|
}
|
|
5229
5229
|
}
|
|
5230
5230
|
async function storageCommand(rawArgs) {
|
|
5231
|
+
const action = rawArgs[2];
|
|
5232
|
+
if (action === "create") return storageCreateCommand(rawArgs);
|
|
5233
|
+
if (action === "attach") return storageAttachCommand(rawArgs);
|
|
5234
|
+
if (action === "--help" || action === "help") return printStorageHelp();
|
|
5231
5235
|
const { client } = await requireClient(rawArgs);
|
|
5232
5236
|
const projectId = await requireProject(rawArgs, client);
|
|
5233
5237
|
try {
|
|
@@ -5252,6 +5256,107 @@ async function storageCommand(rawArgs) {
|
|
|
5252
5256
|
reportError(e, "Failed to list storage");
|
|
5253
5257
|
}
|
|
5254
5258
|
}
|
|
5259
|
+
function printStorageHelp() {
|
|
5260
|
+
console.log("");
|
|
5261
|
+
console.log(chalk.bold(" rebase cloud storage"));
|
|
5262
|
+
console.log("");
|
|
5263
|
+
console.log(" " + chalk.blue.bold("storage") + " List this project's storage");
|
|
5264
|
+
console.log(" " + chalk.blue.bold("storage create") + " Provision platform-managed storage");
|
|
5265
|
+
console.log(" " + chalk.blue.bold("storage attach") + " Attach your own S3-compatible bucket");
|
|
5266
|
+
console.log("");
|
|
5267
|
+
console.log(chalk.gray(" attach options:"));
|
|
5268
|
+
console.log(chalk.gray(" --bucket <name> Bucket name (required)"));
|
|
5269
|
+
console.log(chalk.gray(" --access-key-id <id> Access key ID (required)"));
|
|
5270
|
+
console.log(chalk.gray(" --secret-access-key <s> Secret access key (required)"));
|
|
5271
|
+
console.log(chalk.gray(" --endpoint <url> S3 endpoint; omit for AWS"));
|
|
5272
|
+
console.log(chalk.gray(" --region <region> Region"));
|
|
5273
|
+
console.log(chalk.gray(" --force-path-style Required by MinIO and some gateways"));
|
|
5274
|
+
console.log("");
|
|
5275
|
+
console.log(chalk.gray(" Without either, a tenant falls back to the container filesystem and"));
|
|
5276
|
+
console.log(chalk.gray(" loses uploaded files on its next restart."));
|
|
5277
|
+
console.log("");
|
|
5278
|
+
}
|
|
5279
|
+
async function storageCreateCommand(rawArgs) {
|
|
5280
|
+
const { client } = await requireClient(rawArgs);
|
|
5281
|
+
const projectId = await requireProject(rawArgs, client);
|
|
5282
|
+
try {
|
|
5283
|
+
console.log("");
|
|
5284
|
+
console.log(chalk.gray(" Provisioning managed storage — this creates a bucket and its credentials..."));
|
|
5285
|
+
const res = await client.functions.invoke(`storage-provision/${encodeURIComponent(projectId)}`, void 0, { method: "POST" });
|
|
5286
|
+
const info = res.data ?? res.data;
|
|
5287
|
+
success(`Managed storage provisioned for ${displayProjectRef(rawArgs)}.`);
|
|
5288
|
+
keyValues([
|
|
5289
|
+
["Bucket", info.bucketName],
|
|
5290
|
+
["Region", info.region],
|
|
5291
|
+
["Endpoint", info.endpoint],
|
|
5292
|
+
["Access key", info.accessKeyId]
|
|
5293
|
+
]);
|
|
5294
|
+
console.log("");
|
|
5295
|
+
console.log(chalk.gray(" The secret key is stored encrypted and injected at deploy time; it is not displayed."));
|
|
5296
|
+
console.log(chalk.gray(" Redeploy for the tenant to pick it up: ") + chalk.bold("rebase cloud deploy"));
|
|
5297
|
+
console.log("");
|
|
5298
|
+
} catch (e) {
|
|
5299
|
+
reportError(e, "Failed to provision managed storage");
|
|
5300
|
+
}
|
|
5301
|
+
}
|
|
5302
|
+
async function storageAttachCommand(rawArgs) {
|
|
5303
|
+
const parsed = arg({
|
|
5304
|
+
"--bucket": String,
|
|
5305
|
+
"--access-key-id": String,
|
|
5306
|
+
"--secret-access-key": String,
|
|
5307
|
+
"--endpoint": String,
|
|
5308
|
+
"--region": String,
|
|
5309
|
+
"--force-path-style": Boolean
|
|
5310
|
+
}, {
|
|
5311
|
+
argv: rawArgs.slice(3),
|
|
5312
|
+
permissive: true
|
|
5313
|
+
});
|
|
5314
|
+
const bucket = parsed["--bucket"];
|
|
5315
|
+
const accessKeyId = parsed["--access-key-id"];
|
|
5316
|
+
const secretAccessKey = parsed["--secret-access-key"];
|
|
5317
|
+
const missing = [
|
|
5318
|
+
!bucket && "--bucket",
|
|
5319
|
+
!accessKeyId && "--access-key-id",
|
|
5320
|
+
!secretAccessKey && "--secret-access-key"
|
|
5321
|
+
].filter(Boolean);
|
|
5322
|
+
if (missing.length > 0) fail(`Missing ${missing.join(", ")}.`, "A bucket without credentials cannot be used, and would be stored as though it could. Run `rebase cloud storage --help` for the full list.");
|
|
5323
|
+
const { client } = await requireClient(rawArgs);
|
|
5324
|
+
const projectId = await requireProject(rawArgs, client);
|
|
5325
|
+
try {
|
|
5326
|
+
const existing = (await client.data.collection("storages").find({
|
|
5327
|
+
where: { project: ["==", projectId] },
|
|
5328
|
+
limit: 1
|
|
5329
|
+
})).data[0];
|
|
5330
|
+
const row = {
|
|
5331
|
+
project: projectId,
|
|
5332
|
+
type: "byos",
|
|
5333
|
+
status: "active",
|
|
5334
|
+
s3Bucket: bucket,
|
|
5335
|
+
s3AccessKeyId: accessKeyId,
|
|
5336
|
+
s3SecretAccessKey: secretAccessKey,
|
|
5337
|
+
bucketName: bucket
|
|
5338
|
+
};
|
|
5339
|
+
if (parsed["--endpoint"]) row.s3Endpoint = parsed["--endpoint"];
|
|
5340
|
+
if (parsed["--region"]) {
|
|
5341
|
+
row.s3Region = parsed["--region"];
|
|
5342
|
+
row.region = parsed["--region"];
|
|
5343
|
+
}
|
|
5344
|
+
if (parsed["--force-path-style"]) row.s3ForcePathStyle = true;
|
|
5345
|
+
if (existing?.id) await client.data.collection("storages").update(String(existing.id), row);
|
|
5346
|
+
else await client.data.collection("storages").create(row);
|
|
5347
|
+
success(`Storage attached to ${displayProjectRef(rawArgs)}.`);
|
|
5348
|
+
keyValues([
|
|
5349
|
+
["Bucket", bucket],
|
|
5350
|
+
["Endpoint", parsed["--endpoint"] ?? "AWS S3"],
|
|
5351
|
+
["Region", parsed["--region"] ?? "(default)"]
|
|
5352
|
+
]);
|
|
5353
|
+
console.log("");
|
|
5354
|
+
console.log(chalk.gray(" Redeploy for the tenant to pick it up: ") + chalk.bold("rebase cloud deploy"));
|
|
5355
|
+
console.log("");
|
|
5356
|
+
} catch (e) {
|
|
5357
|
+
reportError(e, "Failed to attach storage");
|
|
5358
|
+
}
|
|
5359
|
+
}
|
|
5255
5360
|
async function clustersCommand(rawArgs) {
|
|
5256
5361
|
const { client } = await requireClient(rawArgs);
|
|
5257
5362
|
try {
|
|
@@ -5572,6 +5677,8 @@ ${chalk.green.bold("Databases")}
|
|
|
5572
5677
|
${chalk.green.bold("Other resources")}
|
|
5573
5678
|
${chalk.blue.bold("webhooks list|create|delete")}
|
|
5574
5679
|
${chalk.blue.bold("storage")} List storage buckets
|
|
5680
|
+
${chalk.blue.bold("storage create")} Provision platform-managed storage
|
|
5681
|
+
${chalk.blue.bold("storage attach")} Attach your own S3-compatible bucket
|
|
5575
5682
|
${chalk.blue.bold("clusters")} List compute clusters
|
|
5576
5683
|
${chalk.blue.bold("billing setup")} Attach a card to the org ${chalk.gray("(one-time, opens browser)")}
|
|
5577
5684
|
${chalk.blue.bold("billing")} Show billing account + card on file
|