neon 8.0.3 → 8.0.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.
@@ -1,14 +1,21 @@
1
1
  import { t as __exportAll } from "../_chunks/rolldown-runtime-8H4AJuhK.js";
2
+ import { readContextFile } from "../context.js";
2
3
  import { writer } from "../writer.js";
4
+ import chalk from "chalk";
3
5
  //#region src/commands/orgs.ts
4
6
  var orgs_exports = /* @__PURE__ */ __exportAll({
5
7
  aliases: () => aliases,
6
8
  builder: () => builder,
7
9
  command: () => command,
8
10
  describe: () => describe,
9
- handler: () => handler
11
+ handler: () => handler,
12
+ planName: () => planName
10
13
  });
11
- const ORG_FIELDS = ["id", "name"];
14
+ const ORG_FIELDS = [
15
+ "id",
16
+ "name",
17
+ "plan"
18
+ ];
12
19
  const command = "orgs";
13
20
  const describe = "Manage organizations";
14
21
  const aliases = ["org"];
@@ -23,12 +30,23 @@ const handler = (args) => {
23
30
  const list = async (props) => {
24
31
  const out = writer(props);
25
32
  const { data: { organizations } } = await props.apiClient.getCurrentUserOrganizations();
33
+ const current = readContextFile(props.contextFile).orgId;
26
34
  out.write(organizations, {
27
35
  fields: ORG_FIELDS,
28
36
  title: "Organizations",
29
- emptyMessage: "You are not a member of any organization."
37
+ emptyMessage: "You are not a member of any organization.",
38
+ renderColumns: {
39
+ plan: (org) => planName(org.plan),
40
+ name: (org) => org.id === current ? `${chalk.green("[current]")} ${org.name}` : org.name
41
+ }
30
42
  });
31
43
  out.end();
32
44
  };
45
+ const ACRONYMS = {
46
+ aws: "AWS",
47
+ pg: "PG"
48
+ };
49
+ /** `free_v3` -> `Free`, `aws_marketplace` -> `AWS Marketplace`; JSON/YAML keep the API id. */
50
+ const planName = (plan) => (plan ?? "").replace(/_v\d+$/, "").split("_").filter(Boolean).map((word) => ACRONYMS[word] ?? word[0].toUpperCase() + word.slice(1)).join(" ");
33
51
  //#endregion
34
- export { aliases, builder, command, describe, handler, orgs_exports as t };
52
+ export { aliases, builder, command, describe, handler, planName, orgs_exports as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neon",
3
- "version": "8.0.3",
3
+ "version": "8.0.4",
4
4
  "description": "CLI tool for Neon, the cloud backend primitives built around Lakebase Postgres",
5
5
  "keywords": [
6
6
  "neon",