@wayai/cli 0.3.323 → 0.3.324
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 +20 -99
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6244,15 +6244,11 @@ var init_chunk_IPXBFWUU = __esm({
|
|
|
6244
6244
|
});
|
|
6245
6245
|
|
|
6246
6246
|
// ../../packages/core/dist/chunk-AYLAGFAD.js
|
|
6247
|
-
var
|
|
6247
|
+
var BASE_CREDENTIAL_NAME_MAX, BASE_CREDENTIAL_NAME_PATTERN, BASE_CREDENTIAL_NAME_CHARSET, baseCredentialNameSchema;
|
|
6248
6248
|
var init_chunk_AYLAGFAD = __esm({
|
|
6249
6249
|
"../../packages/core/dist/chunk-AYLAGFAD.js"() {
|
|
6250
6250
|
"use strict";
|
|
6251
6251
|
init_zod();
|
|
6252
|
-
BASE_CREDENTIAL_MANAGED_BY = {
|
|
6253
|
-
DIRECT: "direct",
|
|
6254
|
-
ORG_LINK: "org-link"
|
|
6255
|
-
};
|
|
6256
6252
|
BASE_CREDENTIAL_NAME_MAX = 100;
|
|
6257
6253
|
BASE_CREDENTIAL_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:@+~=-]*$/;
|
|
6258
6254
|
BASE_CREDENTIAL_NAME_CHARSET = "letters, digits and '. _ : @ + ~ = -', starting with a letter or digit";
|
|
@@ -43395,33 +43391,8 @@ var init_providers = __esm({
|
|
|
43395
43391
|
|
|
43396
43392
|
// src/data/commands/credentials.ts
|
|
43397
43393
|
import { Command as Command6 } from "commander";
|
|
43398
|
-
import { readFileSync as readFileSync21 } from "fs";
|
|
43399
43394
|
function withValueSourceOptions(cmd, what) {
|
|
43400
|
-
return cmd.option(
|
|
43401
|
-
"--file <path>",
|
|
43402
|
-
`Read ${what} from a file and base64-encode it (certificates, keystores, service-account JSON)`
|
|
43403
|
-
).option("--value-stdin", `Read ${what} from stdin (recommended for CI)`).option("--value-prompt", `Prompt for ${what}, masked`);
|
|
43404
|
-
}
|
|
43405
|
-
async function resolveValue(opts, label3) {
|
|
43406
|
-
if (opts.file !== void 0) {
|
|
43407
|
-
if (opts.valueStdin || opts.valuePrompt) {
|
|
43408
|
-
throw expected("--file cannot be combined with --value-stdin or --value-prompt \u2014 pass one.");
|
|
43409
|
-
}
|
|
43410
|
-
try {
|
|
43411
|
-
return readFileSync21(opts.file).toString("base64");
|
|
43412
|
-
} catch (e) {
|
|
43413
|
-
throw expected(`--file ${opts.file}: ${e instanceof Error ? e.message : "could not be read"}`);
|
|
43414
|
-
}
|
|
43415
|
-
}
|
|
43416
|
-
return readSecret(
|
|
43417
|
-
{
|
|
43418
|
-
stdin: opts.valueStdin,
|
|
43419
|
-
prompt: opts.valuePrompt,
|
|
43420
|
-
stdinFlag: "--value-stdin",
|
|
43421
|
-
promptHint: "--value-prompt"
|
|
43422
|
-
},
|
|
43423
|
-
label3
|
|
43424
|
-
);
|
|
43395
|
+
return cmd.option("--file <path>", `Read ${what} from a file (unavailable for now)`).option("--value-stdin", `Read ${what} from stdin (unavailable for now)`).option("--value-prompt", `Prompt for ${what}, masked (unavailable for now)`);
|
|
43425
43396
|
}
|
|
43426
43397
|
function credentialPath(base, id) {
|
|
43427
43398
|
const root = `/v1/${pathSegment(base, "base id")}/credentials`;
|
|
@@ -43432,28 +43403,10 @@ function buildBasesCredentialsCommand() {
|
|
|
43432
43403
|
new Command6("credentials").description("Manage a base's integration credentials")
|
|
43433
43404
|
);
|
|
43434
43405
|
withValueSourceOptions(
|
|
43435
|
-
credentials.command("create").description("Store a credential on this base
|
|
43436
|
-
"--expires-at <date>",
|
|
43437
|
-
"Expiry as ISO-8601 (e.g. 2027-01-01T00:00:00Z) \u2014 informational; nothing is auto-disabled"
|
|
43438
|
-
).option(
|
|
43439
|
-
"--no-sync-to-production",
|
|
43440
|
-
"Do not publish this credential on promote \u2014 production owns its own value"
|
|
43441
|
-
),
|
|
43406
|
+
credentials.command("create").description("Store a credential on this base \u2014 unavailable for now").option("--name <name>", "Credential name").option("--content-type <mime>", "MIME type of the value").option("--expires-at <date>", "Expiry as ISO-8601").option("--no-sync-to-production", "Do not publish this credential on promote (unavailable for now)"),
|
|
43442
43407
|
"the credential value"
|
|
43443
|
-
).action(
|
|
43444
|
-
|
|
43445
|
-
const body = {
|
|
43446
|
-
name: opts.name,
|
|
43447
|
-
value: await resolveValue(opts, "Credential value")
|
|
43448
|
-
};
|
|
43449
|
-
if (opts.contentType) body.content_type = opts.contentType;
|
|
43450
|
-
if (opts.expiresAt) body.expires_at = opts.expiresAt;
|
|
43451
|
-
if (opts.syncToProduction === false) body.sync_to_production = false;
|
|
43452
|
-
const client = await createDataClient();
|
|
43453
|
-
printOutput(
|
|
43454
|
-
await client.request("POST", credentialPath(base), body),
|
|
43455
|
-
outputFormat(this)
|
|
43456
|
-
);
|
|
43408
|
+
).action(() => {
|
|
43409
|
+
throw expected(STORAGE_UNAVAILABLE);
|
|
43457
43410
|
});
|
|
43458
43411
|
credentials.command("list").description("List this base's credentials (values are never returned)").action(async function() {
|
|
43459
43412
|
const base = requireBase(this);
|
|
@@ -43472,42 +43425,13 @@ function buildBasesCredentialsCommand() {
|
|
|
43472
43425
|
);
|
|
43473
43426
|
});
|
|
43474
43427
|
withValueSourceOptions(
|
|
43475
|
-
credentials.command("rotate <id>").description("Install a new
|
|
43428
|
+
credentials.command("rotate <id>").description("Install a new value \u2014 unavailable for now").option("--expires-at <date>", "Set the rotated credential's new expiry (ISO-8601)"),
|
|
43476
43429
|
"the new credential value"
|
|
43477
|
-
).action(
|
|
43478
|
-
|
|
43479
|
-
const client = await createDataClient();
|
|
43480
|
-
const existing = await client.request(
|
|
43481
|
-
"GET",
|
|
43482
|
-
credentialPath(base, id)
|
|
43483
|
-
);
|
|
43484
|
-
if (existing?.managed_by === BASE_CREDENTIAL_MANAGED_BY.ORG_LINK) {
|
|
43485
|
-
throw expected(
|
|
43486
|
-
`"${existing.name ?? id}" mirrors an organization credential, and linking organization credentials into bases is retired. Create a direct credential under another name, and point the references at it; deleting the organization credential removes this row.`
|
|
43487
|
-
);
|
|
43488
|
-
}
|
|
43489
|
-
const body = { value: await resolveValue(opts, "New credential value") };
|
|
43490
|
-
if (opts.expiresAt) body.expires_at = opts.expiresAt;
|
|
43491
|
-
printOutput(
|
|
43492
|
-
await client.request(
|
|
43493
|
-
"POST",
|
|
43494
|
-
`${credentialPath(base, id)}/rotate`,
|
|
43495
|
-
body
|
|
43496
|
-
),
|
|
43497
|
-
outputFormat(this)
|
|
43498
|
-
);
|
|
43430
|
+
).action(() => {
|
|
43431
|
+
throw expected(STORAGE_UNAVAILABLE);
|
|
43499
43432
|
});
|
|
43500
|
-
credentials.command("set-sync <id>").description(
|
|
43501
|
-
"
|
|
43502
|
-
).option("--no-sync-to-production", "Do not publish this credential on promote").action(async function(id, opts) {
|
|
43503
|
-
const base = requireBase(this);
|
|
43504
|
-
const client = await createDataClient();
|
|
43505
|
-
printOutput(
|
|
43506
|
-
await client.request("PUT", credentialPath(base, id), {
|
|
43507
|
-
sync_to_production: opts.syncToProduction
|
|
43508
|
-
}),
|
|
43509
|
-
outputFormat(this)
|
|
43510
|
-
);
|
|
43433
|
+
credentials.command("set-sync <id>").description("Set the promote-time publish flag \u2014 unavailable for now: promotion carries no credential").option("--no-sync-to-production", "Do not publish this credential on promote (unavailable for now)").action(() => {
|
|
43434
|
+
throw expected("Promotion carries no base credential for now, so the publish flag has no effect. Nothing was changed.");
|
|
43511
43435
|
});
|
|
43512
43436
|
credentials.command("delete <id>").description("Delete a direct credential").option("-y, --yes", "Skip confirmation prompt").action(async function(id, opts) {
|
|
43513
43437
|
const base = requireBase(this);
|
|
@@ -43526,6 +43450,7 @@ function buildBasesCredentialsCommand() {
|
|
|
43526
43450
|
});
|
|
43527
43451
|
return credentials;
|
|
43528
43452
|
}
|
|
43453
|
+
var STORAGE_UNAVAILABLE;
|
|
43529
43454
|
var init_credentials = __esm({
|
|
43530
43455
|
"src/data/commands/credentials.ts"() {
|
|
43531
43456
|
"use strict";
|
|
@@ -43534,13 +43459,13 @@ var init_credentials = __esm({
|
|
|
43534
43459
|
init_helpers();
|
|
43535
43460
|
init_utils();
|
|
43536
43461
|
init_expected();
|
|
43537
|
-
|
|
43462
|
+
STORAGE_UNAVAILABLE = "Storing a base credential is unavailable for now: a base's secrets are to be kept in the credentials vault, which does not hold them yet. Nothing was read or stored.";
|
|
43538
43463
|
}
|
|
43539
43464
|
});
|
|
43540
43465
|
|
|
43541
43466
|
// src/data/commands/sql.ts
|
|
43542
43467
|
import { Command as Command7 } from "commander";
|
|
43543
|
-
import { readFileSync as
|
|
43468
|
+
import { readFileSync as readFileSync21 } from "fs";
|
|
43544
43469
|
function buildBasesSqlCommand() {
|
|
43545
43470
|
return withBaseOption(new Command7("sql")).description("Execute a read-only SQL query against base data").argument("[query]", "SQL query (SELECT only)").option("--file <path>", "Read SQL from a file instead of the argument").option(
|
|
43546
43471
|
"--param <kv...>",
|
|
@@ -43550,7 +43475,7 @@ function buildBasesSqlCommand() {
|
|
|
43550
43475
|
let query;
|
|
43551
43476
|
if (opts.file) {
|
|
43552
43477
|
try {
|
|
43553
|
-
query =
|
|
43478
|
+
query = readFileSync21(opts.file, "utf-8").trim();
|
|
43554
43479
|
} catch (e) {
|
|
43555
43480
|
throw expected(`--file ${opts.file}: ${e instanceof Error ? e.message : "could not be read"}`);
|
|
43556
43481
|
}
|
|
@@ -44064,16 +43989,12 @@ function buildBasesCommand() {
|
|
|
44064
43989
|
printOutput(data, outputFormat(this));
|
|
44065
43990
|
const warnings = data?.source_credential_warnings ?? [];
|
|
44066
43991
|
if (warnings.length > 0) {
|
|
44067
|
-
console.warn(
|
|
44068
|
-
"\nINLINE external-source secrets are NOT carried over by promotion \u2014 set these on production before the source will work:"
|
|
44069
|
-
);
|
|
43992
|
+
console.warn("\nSources with an INLINE secret that production will lack:");
|
|
44070
43993
|
for (const w of warnings) console.warn(` - ${sanitizeTerminalText(w.message)}`);
|
|
44071
43994
|
}
|
|
44072
43995
|
const unresolved = data?.unresolved_credentials ?? [];
|
|
44073
43996
|
if (unresolved.length > 0) {
|
|
44074
|
-
console.warn(
|
|
44075
|
-
"\nReferenced credentials production will still lack after this promotion:"
|
|
44076
|
-
);
|
|
43997
|
+
console.warn("\nReferenced credentials production lacks:");
|
|
44077
43998
|
for (const w of unresolved) console.warn(` - ${sanitizeTerminalText(w.message)}`);
|
|
44078
43999
|
}
|
|
44079
44000
|
});
|
|
@@ -44230,7 +44151,7 @@ var init_file_types = __esm({
|
|
|
44230
44151
|
|
|
44231
44152
|
// src/data/commands/files.ts
|
|
44232
44153
|
import { Command as Command11 } from "commander";
|
|
44233
|
-
import { readFileSync as
|
|
44154
|
+
import { readFileSync as readFileSync22, writeFileSync as writeFileSync11 } from "fs";
|
|
44234
44155
|
import { basename as basename29 } from "path";
|
|
44235
44156
|
function renderFileDiff(fileType, filePath3, from, to, d) {
|
|
44236
44157
|
console.log(sanitizeTerminalText(`${fileType}/${filePath3}: v${from} \u2192 v${to}`));
|
|
@@ -44287,7 +44208,7 @@ function buildFilesCommand() {
|
|
|
44287
44208
|
label: opts.label,
|
|
44288
44209
|
metadata: opts.metadata === void 0 ? void 0 : parseData(opts.metadata, "--metadata")
|
|
44289
44210
|
});
|
|
44290
|
-
const body =
|
|
44211
|
+
const body = readFileSync22(opts.file);
|
|
44291
44212
|
const client = await createDataClient();
|
|
44292
44213
|
printOutput(
|
|
44293
44214
|
await client.upload(
|
|
@@ -45376,7 +45297,7 @@ init_errors3();
|
|
|
45376
45297
|
init_mask_secrets();
|
|
45377
45298
|
init_utils();
|
|
45378
45299
|
init_registry();
|
|
45379
|
-
import { readFileSync as
|
|
45300
|
+
import { readFileSync as readFileSync23 } from "fs";
|
|
45380
45301
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
45381
45302
|
import { dirname as dirname16, join as join39 } from "path";
|
|
45382
45303
|
|
|
@@ -45534,7 +45455,7 @@ Run \`wayai admin skill install\` to update.`);
|
|
|
45534
45455
|
|
|
45535
45456
|
// src/index.ts
|
|
45536
45457
|
var __dirname = dirname16(fileURLToPath2(import.meta.url));
|
|
45537
|
-
var pkg = JSON.parse(
|
|
45458
|
+
var pkg = JSON.parse(readFileSync23(join39(__dirname, "..", "package.json"), "utf-8"));
|
|
45538
45459
|
var [, , command, ...args] = process.argv;
|
|
45539
45460
|
var isBackgroundRefresh = command === REFRESH_COMMAND;
|
|
45540
45461
|
if (!isBackgroundRefresh) initSentry(command, pkg.version);
|