layero 0.11.15 → 0.11.17
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/commands/data-api.js +21 -6
- package/dist/next-action.js +8 -0
- package/package.json +1 -1
|
@@ -125,6 +125,9 @@ function keyRow(k) {
|
|
|
125
125
|
expires_at: k.expires_at ?? null,
|
|
126
126
|
in_build: Boolean(k.in_build),
|
|
127
127
|
service: Boolean(k.is_service),
|
|
128
|
+
// Публичный ключ не секрет (он в бандле сайта) — отдаём значением, чтобы не
|
|
129
|
+
// выпускать новый ради уже существующего (T-20261026-9, п. 5).
|
|
130
|
+
value: k.is_public ? (k.value ?? null) : null,
|
|
128
131
|
};
|
|
129
132
|
}
|
|
130
133
|
export async function dataKeysListCmd(opts) {
|
|
@@ -147,7 +150,8 @@ export async function dataKeysListCmd(opts) {
|
|
|
147
150
|
console.log(`${chalk.bold(`${k.prefix}…`)} ${kind} ${k.label ?? ""} ${marks.join(" ")}\n` +
|
|
148
151
|
chalk.dim(` срок: ${k.expires_at ? `до ${day(k.expires_at)}` : "без срока"}` +
|
|
149
152
|
` · последний вызов: ${k.last_used_at ? day(k.last_used_at) : "не было"}` +
|
|
150
|
-
` · ${k.id}`)
|
|
153
|
+
` · ${k.id}`) +
|
|
154
|
+
(k.value ? `\n ${k.value}` : ""));
|
|
151
155
|
}
|
|
152
156
|
}
|
|
153
157
|
export async function dataKeysIssueCmd(opts) {
|
|
@@ -495,6 +499,8 @@ export async function dataEnableCmd(opts) {
|
|
|
495
499
|
org,
|
|
496
500
|
database: ref,
|
|
497
501
|
slug: res.slug,
|
|
502
|
+
url: res.url ?? null,
|
|
503
|
+
url_note: res.url_note ?? null,
|
|
498
504
|
public_key: publicKey,
|
|
499
505
|
secret_key: secretKey,
|
|
500
506
|
// Что маскировать (T-20261026-6): секретный ключ показывается один раз.
|
|
@@ -503,9 +509,10 @@ export async function dataEnableCmd(opts) {
|
|
|
503
509
|
// Итог включения словами: какие таблицы открыты, какие без RLS закрыты.
|
|
504
510
|
warnings: res.warnings ?? [],
|
|
505
511
|
...(publicKey || secretKey
|
|
506
|
-
? { next_action:
|
|
507
|
-
|
|
508
|
-
|
|
512
|
+
? { next_action: (secretKey
|
|
513
|
+
? "секретный ключ показан один раз — сохраните его сейчас, платформа его не хранит. "
|
|
514
|
+
: "") +
|
|
515
|
+
`Публичный ключ можно получить снова: layero data keys list --db ${shellArg(ref)}` }
|
|
509
516
|
: {}),
|
|
510
517
|
});
|
|
511
518
|
return;
|
|
@@ -516,6 +523,11 @@ export async function dataEnableCmd(opts) {
|
|
|
516
523
|
? `${chalk.green("✓")} Data API переприменён у базы «${db.name}»\n` +
|
|
517
524
|
chalk.yellow(" Выданные права на таблицы сохранились, права по умолчанию — как в Supabase")
|
|
518
525
|
: `${chalk.green("✓")} Data API включён у базы «${db.name}»`);
|
|
526
|
+
if (res.url) {
|
|
527
|
+
console.log(`\n адрес API: ${res.url}`);
|
|
528
|
+
if (res.url_note)
|
|
529
|
+
console.log(chalk.dim(` ${res.url_note}`));
|
|
530
|
+
}
|
|
519
531
|
for (const w of res.warnings ?? [])
|
|
520
532
|
console.log(chalk.yellow(`\n ⚠ ${w}`));
|
|
521
533
|
if (publicKey)
|
|
@@ -542,7 +554,9 @@ export function registerDataApiCommands(data, program) {
|
|
|
542
554
|
.option("--org <slug>", "organization (default: your only one, otherwise your personal organization)");
|
|
543
555
|
const json = (opts) => ({ ...opts, json: program.opts().json });
|
|
544
556
|
const keys = data.command("keys").description("Data API keys: list, issue, revoke.");
|
|
545
|
-
withDb(keys
|
|
557
|
+
withDb(keys
|
|
558
|
+
.command("list")
|
|
559
|
+
.description("The database's keys: prefix, expiry, last call; the public key's value too (it is not a secret)."))
|
|
546
560
|
.action(async (opts) => dataKeysListCmd(json(opts)));
|
|
547
561
|
withDb(keys
|
|
548
562
|
.command("issue")
|
|
@@ -586,7 +600,8 @@ export function registerDataApiCommands(data, program) {
|
|
|
586
600
|
"\nWithout --yes outside a terminal the command shows the SQL, changes nothing and exits with an error.")).action(async (object, opts) => dataGrantCmd(object, json(opts)));
|
|
587
601
|
withDb(data
|
|
588
602
|
.command("enable")
|
|
589
|
-
.description("Enable the Data API for a database: sets up the api schema and roles, issues a public key.
|
|
603
|
+
.description("Enable the Data API for a database: sets up the api schema and roles, issues a public key. " +
|
|
604
|
+
"As in Supabase, new tables, sequences and functions in public are open to the API roles; rows are decided by RLS.")
|
|
590
605
|
.option("--with-secret", "also issue a secret key for the server")
|
|
591
606
|
.option("--repair", "re-apply the roles and the api schema for a database whose Data API is already enabled; table grants are kept, default privileges for new tables are removed")
|
|
592
607
|
.option("-y, --yes", "do not ask for confirmation for --repair")).action(async (opts) => dataEnableCmd(json(opts)));
|
package/dist/next-action.js
CHANGED
|
@@ -19,6 +19,14 @@ export function nextActionFor(status, message) {
|
|
|
19
19
|
[/relation .* does not exist|таблиц[аы] .* не найден/,
|
|
20
20
|
"таблицы нет: проверьте имя и схему — SELECT schemaname, tablename FROM pg_tables " +
|
|
21
21
|
"WHERE schemaname NOT IN ('pg_catalog', 'information_schema')"],
|
|
22
|
+
// 🚨 Схемы входа и файлов раскладывает платформа (T-20261026-16, п. 1): созданная
|
|
23
|
+
// руками `auth` помешает включению входа. Эти правила — раньше общего про схему.
|
|
24
|
+
[/schema "auth" does not exist|function auth\.\w+\(.*\) does not exist|схема auth .*после включения входа/,
|
|
25
|
+
"схему auth создаёт включение входа — попросите владельца базы включить его в панели: " +
|
|
26
|
+
"Базы данных → эта база → Авторизация. Не создавайте схему auth руками: это помешает включению"],
|
|
27
|
+
[/schema "storage" does not exist|function storage\.\w+\(.*\) does not exist/,
|
|
28
|
+
"схему storage создаёт включение файлов — попросите владельца базы включить их в панели: " +
|
|
29
|
+
"Базы данных → эта база → Файлы. Не создавайте схему storage руками"],
|
|
22
30
|
[/schema .* does not exist/,
|
|
23
31
|
"схемы нет: создайте её (CREATE SCHEMA …) или уберите имя схемы из запроса"],
|
|
24
32
|
[/permission denied/,
|
package/package.json
CHANGED