oneclient 0.1.2 → 0.1.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/index.js +22 -9
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { readFile, stat } from "node:fs/promises";
|
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import { createInterface } from "node:readline/promises";
|
|
7
7
|
import { Command } from "commander";
|
|
8
|
-
import { createClient } from "@oneclient/sdk";
|
|
8
|
+
import { createClient, creditsToMicros, OneClientError, } from "@oneclient/sdk";
|
|
9
9
|
import { deploymentWaitTimeout, waitForDeployment } from "./deployment-wait.js";
|
|
10
10
|
import { createArtifact } from "./artifact-create.js";
|
|
11
11
|
import { clearDeveloperCredentials, readDeveloperCredentials, writeDeveloperCredentials, } from "./credentials.js";
|
|
@@ -19,7 +19,7 @@ const program = new Command();
|
|
|
19
19
|
program
|
|
20
20
|
.name("oneclient")
|
|
21
21
|
.description("Deploy and manage OneClient projects")
|
|
22
|
-
.version("0.1.
|
|
22
|
+
.version("0.1.3")
|
|
23
23
|
.option("--api-url <url>", "Control or environment API URL", process.env.ONECLIENT_API_URL)
|
|
24
24
|
.option("--organization <id>", "Organization ID", process.env.ONECLIENT_ORGANIZATION_ID)
|
|
25
25
|
.option("--json", "Print stable JSON for scripts and agents", false)
|
|
@@ -276,14 +276,14 @@ program
|
|
|
276
276
|
.action(async () => print(await organizationSessionClient().then((api) => api.billing.subscriptionCheckout()), "Subscription checkout"));
|
|
277
277
|
program
|
|
278
278
|
.command("billing:topup")
|
|
279
|
-
.description("Create a prepaid credit Checkout session")
|
|
280
|
-
.requiredOption("--
|
|
279
|
+
.description("Create a prepaid OneClient credit-pack Checkout session")
|
|
280
|
+
.requiredOption("--credits <amount>", "OneClient credits; available packs start at 2,500")
|
|
281
281
|
.action(async (options) => {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
const amountMicros =
|
|
286
|
-
print(await organizationSessionClient().then((api) => api.billing.topupCheckout(amountMicros)), "Credit checkout");
|
|
282
|
+
if (!/^[1-9][0-9]*$/.test(options.credits) || BigInt(options.credits) < 2500n) {
|
|
283
|
+
throw new Error("credits must be a whole number of at least 2,500");
|
|
284
|
+
}
|
|
285
|
+
const amountMicros = creditsToMicros(options.credits);
|
|
286
|
+
print(await organizationSessionClient().then((api) => api.billing.topupCheckout(amountMicros)), "Credit-pack checkout");
|
|
287
287
|
});
|
|
288
288
|
program
|
|
289
289
|
.command("domain:list")
|
|
@@ -553,6 +553,19 @@ program
|
|
|
553
553
|
process.stdout.write(logs.endsWith("\n") ? logs : `${logs}\n`);
|
|
554
554
|
});
|
|
555
555
|
program.parseAsync().catch((error) => {
|
|
556
|
+
if (program.opts().json && error instanceof OneClientError) {
|
|
557
|
+
process.stderr.write(`${JSON.stringify({
|
|
558
|
+
error: {
|
|
559
|
+
code: error.code,
|
|
560
|
+
message: error.message,
|
|
561
|
+
requestId: error.requestId,
|
|
562
|
+
status: error.status,
|
|
563
|
+
...(error.details ? { details: error.details } : {}),
|
|
564
|
+
},
|
|
565
|
+
})}\n`);
|
|
566
|
+
process.exitCode = 1;
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
556
569
|
const message = error instanceof Error ? error.message : String(error);
|
|
557
570
|
process.stderr.write(`${statusLine("error", message, colorEnabled())}\n`);
|
|
558
571
|
process.exitCode = 1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oneclient",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "One package for the complete OneClient TypeScript SDK and developer CLI.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"homepage": "https://one-client.com",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"commander": "15.0.0",
|
|
40
40
|
"tar": "7.5.22",
|
|
41
|
-
"@oneclient/
|
|
42
|
-
"@oneclient/
|
|
41
|
+
"@oneclient/sdk": "0.1.1",
|
|
42
|
+
"@oneclient/contracts": "0.1.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "26.4.0",
|