run402 1.13.2 → 1.13.4

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.
Files changed (2) hide show
  1. package/lib/projects.mjs +10 -2
  2. package/package.json +1 -1
package/lib/projects.mjs CHANGED
@@ -11,13 +11,14 @@ Subcommands:
11
11
  use <id> Set the active project (used as default for other commands)
12
12
  list List all your projects (IDs, URLs, active marker)
13
13
  info <id> Show project details: REST URL, keys
14
+ keys <id> Print anon_key and service_key as JSON
14
15
  sql <id> "<query>" Run a SQL query against a project's Postgres DB
15
16
  rest <id> <table> [params] Query a table via the REST API (PostgREST)
16
17
  usage <id> Show compute/storage usage for a project
17
18
  schema <id> Inspect the database schema
18
19
  rls <id> <template> <tables_json> Apply Row-Level Security policies
19
- delete <id> Delete a project and remove it from local state${process.env.RUN402_ADMIN ? `
20
- pin <id> [admin] Pin a project (prevents expiry/GC)` : ""}
20
+ delete <id> Delete a project and remove it from local state
21
+ pin <id> Pin a project (prevents expiry/GC)
21
22
 
22
23
  Examples:
23
24
  run402 projects quote
@@ -31,6 +32,7 @@ Examples:
31
32
  run402 projects usage abc123
32
33
  run402 projects schema abc123
33
34
  run402 projects rls abc123 public_read '[{"table":"posts"}]'
35
+ run402 projects keys abc123
34
36
  run402 projects delete abc123
35
37
 
36
38
  Notes:
@@ -108,6 +110,11 @@ async function info(projectId) {
108
110
  }, null, 2));
109
111
  }
110
112
 
113
+ async function keys(projectId) {
114
+ const p = findProject(projectId);
115
+ console.log(JSON.stringify({ project_id: projectId, anon_key: p.anon_key, service_key: p.service_key }, null, 2));
116
+ }
117
+
111
118
  async function sqlCmd(projectId, query) {
112
119
  const p = findProject(projectId);
113
120
  const res = await fetch(`${API}/projects/v1/admin/${projectId}/sql`, { method: "POST", headers: { "Authorization": `Bearer ${p.service_key}`, "Content-Type": "text/plain" }, body: query });
@@ -185,6 +192,7 @@ export async function run(sub, args) {
185
192
  case "use": await use(args[0]); break;
186
193
  case "list": await list(); break;
187
194
  case "info": await info(args[0]); break;
195
+ case "keys": await keys(args[0]); break;
188
196
  case "sql": await sqlCmd(args[0], args[1]); break;
189
197
  case "rest": await rest(args[0], args[1], args[2]); break;
190
198
  case "usage": await usage(args[0]); break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "run402",
3
- "version": "1.13.2",
3
+ "version": "1.13.4",
4
4
  "description": "CLI for Run402 — provision Postgres databases, deploy static sites, generate images, and manage wallets via x402 micropayments.",
5
5
  "type": "module",
6
6
  "bin": {