@haakco/hostingctl 1.0.696 → 1.0.699
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/main.js +50 -9
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
- package/platform/darwin-arm64/hostingctl +0 -0
- package/platform/darwin-x64/hostingctl +0 -0
- package/platform/linux-arm64/hostingctl +0 -0
- package/platform/linux-x64/hostingctl +0 -0
- package/platform/windows-x64/hostingctl.exe +0 -0
package/dist/main.js
CHANGED
|
@@ -45098,6 +45098,10 @@ var hostingSeedScopeEnum = {
|
|
|
45098
45098
|
platform: "platform",
|
|
45099
45099
|
company: "company"
|
|
45100
45100
|
};
|
|
45101
|
+
var storeHostingStorageBucketRequestContentFormatEnum = {
|
|
45102
|
+
native: "native",
|
|
45103
|
+
rclone_crypt: "rclone_crypt"
|
|
45104
|
+
};
|
|
45101
45105
|
//#endregion
|
|
45102
45106
|
//#region src/commands/billing-writes.ts
|
|
45103
45107
|
/**
|
|
@@ -76994,8 +76998,9 @@ var STORAGE_USAGE = [
|
|
|
76994
76998
|
" [--confirm]",
|
|
76995
76999
|
" hostingctl storage add --company <slug> --name <name> --size <gib>",
|
|
76996
77000
|
" [--mode package] [--purchase-key <uuid>]",
|
|
77001
|
+
" [--content-format native|rclone_crypt]",
|
|
76997
77002
|
" hostingctl storage add --company <slug> --name <name> --mode allocated --size <gb>",
|
|
76998
|
-
" --quote-file <quote.json>",
|
|
77003
|
+
" --quote-file <quote.json> [--content-format native|rclone_crypt]",
|
|
76999
77004
|
" hostingctl storage add --company <slug> --name <name> --mode native",
|
|
77000
77005
|
" hostingctl storage grow <bucket-uuid> --company <slug> --size <gb>",
|
|
77001
77006
|
" --quote-file <quote.json>",
|
|
@@ -77052,6 +77057,9 @@ var STORAGE_USAGE = [
|
|
|
77052
77057
|
" --mode allocated or --quote-file explicitly selects paid capacity in 10 GB blocks.",
|
|
77053
77058
|
" A package refusal never buys capacity automatically: review a quote to buy more.",
|
|
77054
77059
|
" --mode native instead pays for usage without reserving capacity.",
|
|
77060
|
+
" --content-format declares how the bucket stores its bytes: native, or rclone_crypt",
|
|
77061
|
+
" for encrypted content and names read through the platform's crypt mount. It is set at",
|
|
77062
|
+
" purchase and never changed, and a usage-billed purchase refuses it.",
|
|
77055
77063
|
" grow Buy more capacity for a bucket at a reviewed price. Capacity is never reduced here.",
|
|
77056
77064
|
" resize Reduce purchased capacity; --size 0 removes it when assigned package storage covers usage.",
|
|
77057
77065
|
" subscription Assign included package storage in whole GiB, without an additional storage purchase.",
|
|
@@ -77118,6 +77126,11 @@ var STORAGE_METADATA = {
|
|
|
77118
77126
|
takesValue: true,
|
|
77119
77127
|
description: "Purchased capacity in 10 GB blocks. Resize also accepts zero if package storage covers usage; subscription assigns whole GiB and accepts zero to release it."
|
|
77120
77128
|
},
|
|
77129
|
+
{
|
|
77130
|
+
name: "--content-format",
|
|
77131
|
+
takesValue: true,
|
|
77132
|
+
description: "How a purchased bucket stores its bytes: native, or rclone_crypt for encrypted content and names read through the platform's crypt mount. Declared at purchase and never changed; refused on a usage-billed purchase."
|
|
77133
|
+
},
|
|
77121
77134
|
{
|
|
77122
77135
|
name: "--prefix",
|
|
77123
77136
|
takesValue: true,
|
|
@@ -77317,6 +77330,20 @@ function requiredSizeGb(context) {
|
|
|
77317
77330
|
if (size === null) throw new UsageError(`--size is required, in whole GB.\n\n${STORAGE_USAGE}`);
|
|
77318
77331
|
return size;
|
|
77319
77332
|
}
|
|
77333
|
+
/**
|
|
77334
|
+
* The content format a purchase declares, or null when it declares none.
|
|
77335
|
+
*
|
|
77336
|
+
* The spellings are the generated request enum's own, so a value the API would refuse is refused here first. The
|
|
77337
|
+
* format is part of what is bought and cannot be changed afterwards, which is why it is a purchase argument rather
|
|
77338
|
+
* than something a later write sets.
|
|
77339
|
+
*/
|
|
77340
|
+
function requestedContentFormat(context) {
|
|
77341
|
+
if (!context.flags.has("--content-format")) return null;
|
|
77342
|
+
const format = trimmedFlag(context, "--content-format");
|
|
77343
|
+
const known = Object.values(storeHostingStorageBucketRequestContentFormatEnum);
|
|
77344
|
+
if (!known.includes(format)) throw new UsageError(`--content-format is ${known.join(" or ")} (got "${format}").\n\n${STORAGE_USAGE}`);
|
|
77345
|
+
return format;
|
|
77346
|
+
}
|
|
77320
77347
|
/** The environment a binding is for, which every binding write needs. */
|
|
77321
77348
|
function requiredEnvironment(context) {
|
|
77322
77349
|
const environmentUuid = trimmedFlag(context, "--environment");
|
|
@@ -78599,12 +78626,14 @@ async function add$1(context, tail) {
|
|
|
78599
78626
|
refuseExtra(tail);
|
|
78600
78627
|
const name = requiredName(context);
|
|
78601
78628
|
const company = await requireCompany(context.flags);
|
|
78629
|
+
const contentFormat = requestedContentFormat(context);
|
|
78602
78630
|
const mode = trimmedFlag(context, "--mode");
|
|
78603
78631
|
if (mode === "package" || mode === "" && trimmedFlag(context, "--quote-file") === "") {
|
|
78604
78632
|
if (trimmedFlag(context, "--quote-file") !== "") throw new UsageError("A purchase funded by the package's included storage confirms no price, so --quote-file does not apply to it.");
|
|
78605
|
-
return await packagePurchase(context, name, company, requiredSizeGb(context));
|
|
78633
|
+
return await packagePurchase(context, name, company, requiredSizeGb(context), contentFormat);
|
|
78606
78634
|
}
|
|
78607
78635
|
if (requestedMode(context) === "native") {
|
|
78636
|
+
if (contentFormat !== null) throw new UsageError(`A purchase that pays for what it stores is read through the native S3 endpoint, which cannot read encrypted content and names, so --content-format does not apply to it.\n\n${STORAGE_USAGE}`);
|
|
78608
78637
|
refusePricedFlags(context, "A purchase that pays for what it stores");
|
|
78609
78638
|
return await confirmableWrite(context, nativePurchaseDescription(company, name), async () => {
|
|
78610
78639
|
return {
|
|
@@ -78621,13 +78650,14 @@ async function add$1(context, tail) {
|
|
|
78621
78650
|
bucketUuid: null
|
|
78622
78651
|
};
|
|
78623
78652
|
const reviewed = await reviewedQuote(context, company, target);
|
|
78624
|
-
return await confirmableWrite(context, purchaseDescription(company, name, target, reviewed), async () => {
|
|
78653
|
+
return await confirmableWrite(context, [purchaseDescription(company, name, target, reviewed), ...formatLines(contentFormat)].join("\n"), async () => {
|
|
78625
78654
|
return {
|
|
78626
78655
|
kind: "bucket",
|
|
78627
78656
|
bucket: (await hostingStorageStore({
|
|
78628
78657
|
path: { company },
|
|
78629
78658
|
body: {
|
|
78630
78659
|
name,
|
|
78660
|
+
...contentFormat === null ? {} : { contentFormat },
|
|
78631
78661
|
quote: confirmedQuote(reviewed?.quote ?? null, company, target, name)
|
|
78632
78662
|
}
|
|
78633
78663
|
})).data
|
|
@@ -78653,9 +78683,9 @@ async function grow(context, tail) {
|
|
|
78653
78683
|
});
|
|
78654
78684
|
}
|
|
78655
78685
|
/** A bucket funded by included package storage: nothing is priced and no additional charge is created. */
|
|
78656
|
-
async function packagePurchase(context, name, company, gigabytes) {
|
|
78686
|
+
async function packagePurchase(context, name, company, gigabytes, contentFormat) {
|
|
78657
78687
|
const purchaseKey = trimmedFlag(context, "--purchase-key") || crypto.randomUUID();
|
|
78658
|
-
return await confirmableWrite(context, `Buy bucket ${name} (${company}) funded by ${String(gigabytes)} GiB of the storage the package already includes: nothing is priced, no additional charge is created, and no capacity is bought. Retries carry --purchase-key ${purchaseKey} so the same bucket comes back instead of reserving the same GiB twice.`, async () => {
|
|
78688
|
+
return await confirmableWrite(context, [`Buy bucket ${name} (${company}) funded by ${String(gigabytes)} GiB of the storage the package already includes: nothing is priced, no additional charge is created, and no capacity is bought. Retries carry --purchase-key ${purchaseKey} so the same bucket comes back instead of reserving the same GiB twice.`, ...formatLines(contentFormat)].join("\n"), async () => {
|
|
78659
78689
|
return {
|
|
78660
78690
|
kind: "bucket",
|
|
78661
78691
|
bucket: (await hostingStorageStorePackage({
|
|
@@ -78663,12 +78693,23 @@ async function packagePurchase(context, name, company, gigabytes) {
|
|
|
78663
78693
|
body: {
|
|
78664
78694
|
name,
|
|
78665
78695
|
purchaseKey,
|
|
78666
|
-
gigabytes
|
|
78696
|
+
gigabytes,
|
|
78697
|
+
...contentFormat === null ? {} : { contentFormat }
|
|
78667
78698
|
}
|
|
78668
78699
|
})).data
|
|
78669
78700
|
};
|
|
78670
78701
|
});
|
|
78671
78702
|
}
|
|
78703
|
+
/**
|
|
78704
|
+
* What the purchase says about the format it declared, when it declared one.
|
|
78705
|
+
*
|
|
78706
|
+
* A confirmed purchase describes the bucket it is about to buy before it sends anything, and how those bytes are
|
|
78707
|
+
* stored is part of what is bought: the format cannot be changed afterwards, so it is stated rather than assumed.
|
|
78708
|
+
*/
|
|
78709
|
+
function formatLines(contentFormat) {
|
|
78710
|
+
if (contentFormat === null) return [];
|
|
78711
|
+
return [`Its bytes are stored as ${contentFormat === "rclone_crypt" ? "rclone crypt content, whose bytes and names are encrypted, so it is read only through the platform's crypt mount" : "native objects, read directly through the S3 endpoint or a managed mount"}. The format is declared at purchase and cannot be changed afterwards.`];
|
|
78712
|
+
}
|
|
78672
78713
|
//#endregion
|
|
78673
78714
|
//#region src/commands/storage-writes.ts
|
|
78674
78715
|
/**
|
|
@@ -79919,7 +79960,7 @@ function writeUpdateState(state, env = process.env) {
|
|
|
79919
79960
|
}
|
|
79920
79961
|
//#endregion
|
|
79921
79962
|
//#region src/version.ts
|
|
79922
|
-
var VERSION = "1.0.
|
|
79963
|
+
var VERSION = "1.0.699";
|
|
79923
79964
|
//#endregion
|
|
79924
79965
|
//#region src/commands/update.ts
|
|
79925
79966
|
/**
|
|
@@ -79994,7 +80035,7 @@ var update = {
|
|
|
79994
80035
|
}, process.env);
|
|
79995
80036
|
return {
|
|
79996
80037
|
...known,
|
|
79997
|
-
current: after ?? "1.0.
|
|
80038
|
+
current: after ?? "1.0.699",
|
|
79998
80039
|
latest: after ?? latest,
|
|
79999
80040
|
upToDate: after !== null && (latest === null || !isNewerVersion(latest, after)),
|
|
80000
80041
|
action: "run",
|
|
@@ -80276,7 +80317,7 @@ async function printUpdateNotice(options) {
|
|
|
80276
80317
|
}, env, { waitMs: NOTICE_LOCK_WAIT_MS });
|
|
80277
80318
|
} catch {}
|
|
80278
80319
|
if (latest === null) return;
|
|
80279
|
-
if (!isNewerVersion(latest, "1.0.
|
|
80320
|
+
if (!isNewerVersion(latest, "1.0.699")) return;
|
|
80280
80321
|
process.stderr.write(`A newer hostingctl is published: ${latest} (this copy is ${VERSION}). Run \`hostingctl update\` to update.\n`);
|
|
80281
80322
|
}
|
|
80282
80323
|
/** Whether an environment variable is set to something, which is how CI and the opt-out are read. */
|