@theholocron/neon-client 1.58.0-alpha.3 → 1.58.0-alpha.8

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.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import "@theholocron/http-client";
2
2
  import { ErrorSink, Logger } from "@theholocron/observability/core";
3
+ /** Options for `createNeonClient`. */
3
4
  interface NeonClientOptions {
4
5
  /** Neon API key. */
5
6
  token: string;
@@ -12,48 +13,80 @@ interface NeonClientOptions {
12
13
  /** Reports transport failures and unexpected 5xx. Defaults to a no-op. */
13
14
  errors?: ErrorSink;
14
15
  }
16
+ /** A Neon branch of a project, as the Neon API returns it. */
15
17
  interface NeonBranch {
18
+ /** The branch id, such as `br-...`. */
16
19
  id: string;
20
+ /** The branch name. */
17
21
  name: string;
22
+ /** The id of the branch this one was created from; `undefined` for a root branch. */
18
23
  parent_id?: string;
24
+ /** When the branch was created, as an ISO 8601 timestamp. */
19
25
  created_at: string;
20
26
  }
27
+ /** The response of listing a project's branches. */
21
28
  interface NeonBranchesResponse {
29
+ /** The project's branches. */
22
30
  branches: NeonBranch[];
23
31
  }
32
+ /** The response of creating a branch. */
24
33
  interface NeonBranchResponse {
34
+ /** The branch that was created. */
25
35
  branch: NeonBranch;
26
36
  }
37
+ /** What to create a branch with. */
27
38
  interface CreateNeonBranchInput {
39
+ /** The name of the new branch. */
28
40
  name: string;
41
+ /** The id of the branch to create it from; left out, no parent is sent. */
29
42
  parent_id?: string;
43
+ /** Compute endpoints to create with the branch, each read-write or read-only; left out, none are sent. */
30
44
  endpoints?: Array<{
31
45
  type: "read_write" | "read_only";
32
46
  }>;
33
47
  }
48
+ /** Which branch, database and role to build a connection URI for. */
34
49
  interface NeonConnectionUriParams {
50
+ /** The id of the branch to connect to. */
35
51
  branch_id: string;
52
+ /** The name of the database to connect to. */
36
53
  database_name: string;
54
+ /** The name of the role to connect as. */
37
55
  role_name: string;
56
+ /** Whether to ask for the pooled connection string: `"true"` or `"false"`; left out, the parameter is not sent. */
38
57
  pooled?: "true" | "false";
39
58
  }
59
+ /** The response of asking for a connection URI. */
40
60
  interface NeonConnectionUriResponse {
61
+ /** The Postgres connection URI. */
41
62
  uri: string;
42
63
  }
64
+ /** A database on a Neon branch. */
43
65
  interface NeonDatabase {
66
+ /** The database's numeric id. */
44
67
  id: number;
68
+ /** The database name. */
45
69
  name: string;
70
+ /** The name of the role that owns the database. */
46
71
  owner_name: string;
47
72
  }
73
+ /** The response of listing a branch's databases. */
48
74
  interface NeonDatabasesResponse {
75
+ /** The branch's databases. */
49
76
  databases: NeonDatabase[];
50
77
  }
78
+ /** The user the Neon API key belongs to; every field is optional because the API may omit it. */
51
79
  interface NeonMe {
80
+ /** The user's id. */
52
81
  id?: string;
82
+ /** The user's email address. */
53
83
  email?: string;
84
+ /** The user's display name. */
54
85
  name?: string;
86
+ /** The user's login. */
55
87
  login?: string;
56
88
  }
89
+ /** Creates a Neon API client with `branches`, `connection`, `databases` and `users` groups, all sharing one REST client. */
57
90
  export declare function createNeonClient(opts: NeonClientOptions): {
58
91
  branches: {
59
92
  list: (projectId: string) => Promise<NeonBranchesResponse>;
@@ -72,5 +105,6 @@ export declare function createNeonClient(opts: NeonClientOptions): {
72
105
  me: () => Promise<NeonMe>;
73
106
  };
74
107
  };
108
+ /** The client `createNeonClient` returns. */
75
109
  export type NeonClient = ReturnType<typeof createNeonClient>;
76
110
  export type { CreateNeonBranchInput, NeonBranch, NeonBranchResponse, NeonBranchesResponse, NeonClientOptions, NeonConnectionUriParams, NeonConnectionUriResponse, NeonDatabase, NeonDatabasesResponse, NeonMe };
package/dist/index.mjs CHANGED
@@ -58,6 +58,7 @@ function createNeonRestClient(opts) {
58
58
  });
59
59
  }
60
60
  // src/index.ts
61
+ /** Creates a Neon API client with `branches`, `connection`, `databases` and `users` groups, all sharing one REST client. */
61
62
  function createNeonClient(opts) {
62
63
  const rest = createNeonRestClient(opts);
63
64
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/neon-client",
3
- "version": "1.58.0-alpha.3",
3
+ "version": "1.58.0-alpha.8",
4
4
  "description": "A TypeScript client for the Neon API",
5
5
  "keywords": [
6
6
  "neon",
@@ -32,23 +32,23 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@theholocron/http-client": "^1.58.0-alpha.3",
36
- "@theholocron/observability": "^0.6.1-alpha.1"
35
+ "@theholocron/observability": "^0.7.0-alpha.1",
36
+ "@theholocron/http-client": "^1.58.0-alpha.8"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "^26",
40
40
  "@vitest/coverage-v8": "^5.0.5",
41
- "@vitest/eslint-plugin": "^1.6.27",
42
- "eslint": "^10.8.1",
43
- "eslint-plugin-n": "^18.3.0",
44
- "globals": "^17.11.0",
45
- "tsdown": "^0.23.3",
41
+ "@vitest/eslint-plugin": "^1.6.28",
42
+ "eslint": "^10.14.0",
43
+ "eslint-plugin-n": "^18.5.0",
44
+ "globals": "^17.14.0",
45
+ "tsdown": "^0.23.4",
46
46
  "typescript": "^5.9.3",
47
47
  "vitest": "^5.0.5",
48
- "@theholocron/eslint-config": "^8.9.0-alpha.3",
49
- "@theholocron/tsconfig": "^8.9.0-alpha.3",
50
- "@theholocron/vitest-config": "^8.9.0-alpha.3",
51
- "@theholocron/tsdown-config": "^8.9.0-alpha.3"
48
+ "@theholocron/eslint-config": "^8.9.0-alpha.8",
49
+ "@theholocron/tsconfig": "^8.9.0-alpha.8",
50
+ "@theholocron/vitest-config": "^8.9.0-alpha.8",
51
+ "@theholocron/tsdown-config": "^8.9.0-alpha.8"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=22.0.0"
@@ -57,10 +57,10 @@
57
57
  "access": "public"
58
58
  },
59
59
  "scripts": {
60
- "delivery.build": "tsdown && node ../scripts/check-bundle-size.mjs",
61
- "sourceQuality.staticAnalysis": "eslint .",
60
+ "build": "tsdown && node ../scripts/check-bundle-size.mjs",
61
+ "lint:code": "eslint .",
62
+ "test:unit": "vitest run --coverage",
62
63
  "test:watch": "vitest",
63
- "verification.typeSafety": "tsc --noEmit",
64
- "verification.unitTests": "vitest run"
64
+ "typecheck": "tsc --noEmit"
65
65
  }
66
66
  }