@datarails-ai/dr-appspace-cli 0.12.71 → 0.12.73
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.js +142 -8
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import { fileURLToPath as fileURLToPath6 } from "url";
|
|
|
13
13
|
// package.json
|
|
14
14
|
var package_default = {
|
|
15
15
|
name: "@datarails-ai/dr-appspace-cli",
|
|
16
|
-
version: "0.12.
|
|
16
|
+
version: "0.12.73",
|
|
17
17
|
description: "Datarails App Space CLI \u2014 build, try, push and publish App Space apps",
|
|
18
18
|
type: "module",
|
|
19
19
|
engines: {
|
|
@@ -57,7 +57,7 @@ var package_default = {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
// src/buildInfo.ts
|
|
60
|
-
var BUILD_TIME = "2026-11-
|
|
60
|
+
var BUILD_TIME = "2026-11-08T21:34:21.669Z";
|
|
61
61
|
function formatBuildTime(iso) {
|
|
62
62
|
if (iso === "") return "";
|
|
63
63
|
const d = new Date(iso);
|
|
@@ -5825,9 +5825,9 @@ var MAX_IDENTIFIER_BYTES = 63;
|
|
|
5825
5825
|
var CONTROL_PROPS = ["type", "min", "max", "step", "value", "name", "placeholder", "checked", "pattern"];
|
|
5826
5826
|
var SHELF = /^vendor\/([A-Za-z0-9_.-]+)@([^/]+)\/(.+)$/;
|
|
5827
5827
|
var UI_KIT = /^(ui-kit)\/([^/]+)\/(.+)$/;
|
|
5828
|
-
var TABLE_CALL = /ctx\s*\.\s*data\s*\.\s*table\s*\(\s*(['"])([A-Za-z_][\w]*)\1/g;
|
|
5829
|
-
var TABLE_LOCAL = /^[ \t]*([A-Za-z_]\w*)\s*=\s*ctx\s*\.\s*data\s*\.\s*table\s*\(/gm;
|
|
5830
|
-
var TABLE_INLINE = "ctx\\s*\\.\\s*data\\s*\\.\\s*table\\s*\\([^()]*\\)";
|
|
5828
|
+
var TABLE_CALL = /ctx\s*\.\s*(?:data|app\s*\.\s*tables)\s*\.\s*table\s*\(\s*(['"])([A-Za-z_][\w]*)\1/g;
|
|
5829
|
+
var TABLE_LOCAL = /^[ \t]*([A-Za-z_]\w*)\s*=\s*ctx\s*\.\s*(?:data|app\s*\.\s*tables)\s*\.\s*table\s*\(/gm;
|
|
5830
|
+
var TABLE_INLINE = "ctx\\s*\\.\\s*(?:data|app\\s*\\.\\s*tables)\\s*\\.\\s*table\\s*\\([^()]*\\)";
|
|
5831
5831
|
var DATA_VERBS = ["insert", "update", "delete", "query", "aggregate", "get", "file_bytes", "history"];
|
|
5832
5832
|
var CTX_ROLE = /\bctx\s*\.\s*role\b|getattr\s*\(\s*ctx\s*,\s*['"]role['"]/;
|
|
5833
5833
|
var LIBRARY_IMPORT = /^[ \t]*from[ \t]+([A-Za-z_][\w.]*widget_library)[ \t]+import[ \t]/m;
|
|
@@ -28012,9 +28012,9 @@ var PLATFORM_TABLES3 = { _events: ["at", "action", "handler", "actor", "summary"
|
|
|
28012
28012
|
var CONTROL_PROPS2 = ["type", "min", "max", "step", "value", "name", "placeholder", "checked", "pattern"];
|
|
28013
28013
|
var SHELF2 = /^vendor\/([A-Za-z0-9_.-]+)@([^/]+)\/(.+)$/;
|
|
28014
28014
|
var UI_KIT3 = /^(ui-kit)\/([^/]+)\/(.+)$/;
|
|
28015
|
-
var TABLE_CALL2 = /ctx\s*\.\s*data\s*\.\s*table\s*\(\s*(['"])([A-Za-z_][\w]*)\1/g;
|
|
28016
|
-
var TABLE_LOCAL2 = /^[ \t]*([A-Za-z_]\w*)\s*=\s*ctx\s*\.\s*data\s*\.\s*table\s*\(/gm;
|
|
28017
|
-
var TABLE_INLINE2 = "ctx\\s*\\.\\s*data\\s*\\.\\s*table\\s*\\([^()]*\\)";
|
|
28015
|
+
var TABLE_CALL2 = /ctx\s*\.\s*(?:data|app\s*\.\s*tables)\s*\.\s*table\s*\(\s*(['"])([A-Za-z_][\w]*)\1/g;
|
|
28016
|
+
var TABLE_LOCAL2 = /^[ \t]*([A-Za-z_]\w*)\s*=\s*ctx\s*\.\s*(?:data|app\s*\.\s*tables)\s*\.\s*table\s*\(/gm;
|
|
28017
|
+
var TABLE_INLINE2 = "ctx\\s*\\.\\s*(?:data|app\\s*\\.\\s*tables)\\s*\\.\\s*table\\s*\\([^()]*\\)";
|
|
28018
28018
|
var DATA_VERBS2 = ["insert", "update", "delete", "query", "aggregate", "get", "file_bytes", "history"];
|
|
28019
28019
|
var CTX_ROLE2 = /\bctx\s*\.\s*role\b|getattr\s*\(\s*ctx\s*,\s*['"]role['"]/;
|
|
28020
28020
|
var LIBRARY_IMPORT2 = /^[ \t]*from[ \t]+([A-Za-z_][\w.]*widget_library)[ \t]+import[ \t]/m;
|
|
@@ -42397,6 +42397,139 @@ ${METRIC_ADVICE}
|
|
|
42397
42397
|
);
|
|
42398
42398
|
}
|
|
42399
42399
|
|
|
42400
|
+
// src/commands/appspace/secrets.ts
|
|
42401
|
+
var SECRET_NAME_RE = /^[a-z][a-z0-9_]{0,63}$/;
|
|
42402
|
+
function promptHidden(label, input, output) {
|
|
42403
|
+
return new Promise((resolve17, reject) => {
|
|
42404
|
+
let value = "";
|
|
42405
|
+
output.write(label);
|
|
42406
|
+
input.setRawMode?.(true);
|
|
42407
|
+
input.setEncoding?.("utf8");
|
|
42408
|
+
input.resume();
|
|
42409
|
+
const finish2 = (err) => {
|
|
42410
|
+
input.removeListener("data", onData);
|
|
42411
|
+
input.setRawMode?.(false);
|
|
42412
|
+
input.pause();
|
|
42413
|
+
output.write("\n");
|
|
42414
|
+
if (err !== null) reject(err);
|
|
42415
|
+
else resolve17(value);
|
|
42416
|
+
};
|
|
42417
|
+
const onData = (chunk) => {
|
|
42418
|
+
for (const ch of String(chunk)) {
|
|
42419
|
+
if (ch === "\r" || ch === "\n") return finish2(null);
|
|
42420
|
+
if (ch === "" || ch === "" && value === "") {
|
|
42421
|
+
return finish2(new Error("cancelled"));
|
|
42422
|
+
}
|
|
42423
|
+
if (ch === "\x7F" || ch === "\b") value = value.slice(0, -1);
|
|
42424
|
+
else if (ch >= " ") value += ch;
|
|
42425
|
+
}
|
|
42426
|
+
};
|
|
42427
|
+
input.on("data", onData);
|
|
42428
|
+
});
|
|
42429
|
+
}
|
|
42430
|
+
var MAX_VALUE_BYTES = 8 * 1024;
|
|
42431
|
+
async function readPiped(input) {
|
|
42432
|
+
const chunks = [];
|
|
42433
|
+
let size2 = 0;
|
|
42434
|
+
for await (const chunk of input) {
|
|
42435
|
+
const buf = typeof chunk === "string" ? Buffer.from(chunk) : chunk;
|
|
42436
|
+
size2 += buf.length;
|
|
42437
|
+
if (size2 > MAX_VALUE_BYTES + 2) {
|
|
42438
|
+
throw new Error(`value is longer than ${MAX_VALUE_BYTES} bytes: nothing was stored`);
|
|
42439
|
+
}
|
|
42440
|
+
chunks.push(buf);
|
|
42441
|
+
}
|
|
42442
|
+
return Buffer.concat(chunks).toString("utf8").replace(/\r?\n$/, "");
|
|
42443
|
+
}
|
|
42444
|
+
async function readSecretValue(name, input = process.stdin, output = process.stderr) {
|
|
42445
|
+
const value = input.isTTY === true ? await promptHidden(`Value for ${name} (not shown): `, input, output) : await readPiped(input);
|
|
42446
|
+
if (value === "") throw new Error("no value given: nothing was stored");
|
|
42447
|
+
return value;
|
|
42448
|
+
}
|
|
42449
|
+
function checkName2(name) {
|
|
42450
|
+
if (!SECRET_NAME_RE.test(name)) {
|
|
42451
|
+
throw new Error(
|
|
42452
|
+
`bad secret name "${name}": 1 to 64 characters, lower-case letters, digits and "_", starting with a letter`
|
|
42453
|
+
);
|
|
42454
|
+
}
|
|
42455
|
+
}
|
|
42456
|
+
function secretPath(appId, name) {
|
|
42457
|
+
const base = `/apps/${encodeURIComponent(appId)}/secrets`;
|
|
42458
|
+
return name === void 0 ? base : `${base}/${encodeURIComponent(name)}`;
|
|
42459
|
+
}
|
|
42460
|
+
function registerSecretsCommand(parent) {
|
|
42461
|
+
const group = parent.command("secrets").description(
|
|
42462
|
+
"Manage an app's secrets (Owner only). The platform sends them for the app; no command shows a value."
|
|
42463
|
+
);
|
|
42464
|
+
withJsonOption(
|
|
42465
|
+
withServerOptions(
|
|
42466
|
+
group.command("set <app-id> <name>").description(
|
|
42467
|
+
"Set a secret. The value comes from a hidden prompt, or from stdin when it is piped."
|
|
42468
|
+
).allowExcessArguments(false)
|
|
42469
|
+
)
|
|
42470
|
+
).action(async (appId, name, opts) => {
|
|
42471
|
+
checkName2(name);
|
|
42472
|
+
const value = await readSecretValue(name);
|
|
42473
|
+
const client = await connect(opts);
|
|
42474
|
+
try {
|
|
42475
|
+
const res = await client.request(secretPath(appId, name), {
|
|
42476
|
+
method: "PUT",
|
|
42477
|
+
body: { value }
|
|
42478
|
+
});
|
|
42479
|
+
if (opts.json === true) {
|
|
42480
|
+
printJson(res);
|
|
42481
|
+
return;
|
|
42482
|
+
}
|
|
42483
|
+
process.stdout.write(`Set ${res.name} for ${appId}.
|
|
42484
|
+
`);
|
|
42485
|
+
} finally {
|
|
42486
|
+
client.cleanup();
|
|
42487
|
+
}
|
|
42488
|
+
});
|
|
42489
|
+
withJsonOption(
|
|
42490
|
+
withServerOptions(
|
|
42491
|
+
group.command("list <app-id>").description("List an app's secret names, who set each, and when.")
|
|
42492
|
+
)
|
|
42493
|
+
).action(async (appId, opts) => {
|
|
42494
|
+
const client = await connect(opts);
|
|
42495
|
+
try {
|
|
42496
|
+
const res = await client.request(secretPath(appId));
|
|
42497
|
+
if (opts.json === true) {
|
|
42498
|
+
printJson(res.secrets);
|
|
42499
|
+
return;
|
|
42500
|
+
}
|
|
42501
|
+
if (res.secrets.length === 0) {
|
|
42502
|
+
process.stdout.write(`No secrets set for ${appId}.
|
|
42503
|
+
`);
|
|
42504
|
+
return;
|
|
42505
|
+
}
|
|
42506
|
+
for (const s of res.secrets) {
|
|
42507
|
+
process.stdout.write(`${s.name} set by ${s.set_by} at ${s.set_at ?? "?"}
|
|
42508
|
+
`);
|
|
42509
|
+
}
|
|
42510
|
+
} finally {
|
|
42511
|
+
client.cleanup();
|
|
42512
|
+
}
|
|
42513
|
+
});
|
|
42514
|
+
withJsonOption(
|
|
42515
|
+
withServerOptions(group.command("remove <app-id> <name>").description("Remove a secret."))
|
|
42516
|
+
).action(async (appId, name, opts) => {
|
|
42517
|
+
checkName2(name);
|
|
42518
|
+
const client = await connect(opts);
|
|
42519
|
+
try {
|
|
42520
|
+
const res = await client.request(secretPath(appId, name), { method: "DELETE" });
|
|
42521
|
+
if (opts.json === true) {
|
|
42522
|
+
printJson(res);
|
|
42523
|
+
return;
|
|
42524
|
+
}
|
|
42525
|
+
process.stdout.write(`Removed ${name} from ${appId}.
|
|
42526
|
+
`);
|
|
42527
|
+
} finally {
|
|
42528
|
+
client.cleanup();
|
|
42529
|
+
}
|
|
42530
|
+
});
|
|
42531
|
+
}
|
|
42532
|
+
|
|
42400
42533
|
// src/commands/appspace/tables.ts
|
|
42401
42534
|
function renderTables(rows2) {
|
|
42402
42535
|
if (rows2.length === 0) return "No app owns a table you can see.\n";
|
|
@@ -42480,6 +42613,7 @@ function registerAppSpaceCommand(root) {
|
|
|
42480
42613
|
registerShipCommand(cmd);
|
|
42481
42614
|
registerEjectCommand(cmd);
|
|
42482
42615
|
registerPublishCommands(cmd);
|
|
42616
|
+
registerSecretsCommand(cmd);
|
|
42483
42617
|
}
|
|
42484
42618
|
|
|
42485
42619
|
// src/commands/update.ts
|