run402 1.13.2 → 1.13.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/lib/projects.mjs +7 -0
- package/package.json +1 -1
package/lib/projects.mjs
CHANGED
|
@@ -11,6 +11,7 @@ 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
|
|
@@ -108,6 +109,11 @@ async function info(projectId) {
|
|
|
108
109
|
}, null, 2));
|
|
109
110
|
}
|
|
110
111
|
|
|
112
|
+
async function keys(projectId) {
|
|
113
|
+
const p = findProject(projectId);
|
|
114
|
+
console.log(JSON.stringify({ project_id: projectId, anon_key: p.anon_key, service_key: p.service_key }, null, 2));
|
|
115
|
+
}
|
|
116
|
+
|
|
111
117
|
async function sqlCmd(projectId, query) {
|
|
112
118
|
const p = findProject(projectId);
|
|
113
119
|
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 +191,7 @@ export async function run(sub, args) {
|
|
|
185
191
|
case "use": await use(args[0]); break;
|
|
186
192
|
case "list": await list(); break;
|
|
187
193
|
case "info": await info(args[0]); break;
|
|
194
|
+
case "keys": await keys(args[0]); break;
|
|
188
195
|
case "sql": await sqlCmd(args[0], args[1]); break;
|
|
189
196
|
case "rest": await rest(args[0], args[1], args[2]); break;
|
|
190
197
|
case "usage": await usage(args[0]); break;
|
package/package.json
CHANGED