@theholocron/holocron-plugin-neon 5.0.0-alpha.26 → 5.0.0-alpha.260
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 +14 -34
- package/dist/index.mjs +17 -16
- package/package.json +21 -19
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { AuthError, ConnectionStringOptions, ResolveTokenInput, Storage, StorageBranch } from "@theholocron/cli";
|
|
1
|
+
import { AuthError, ConnectionStringOptions, ResolveTokenInput, Storage, StorageBranch, VerifyTokenFailure, VerifyTokenResult, VerifyTokenResult as VerifyTokenResult$1, VerifyTokenSuccess } from "@theholocron/cli";
|
|
2
2
|
import { NeonClient, NeonClient as NeonClient$1, NeonClientOptions, createNeonClient } from "@theholocron/neon-client";
|
|
3
|
-
|
|
4
|
-
declare const resolveToken: (input?: ResolveTokenInput) => string;
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/capabilities/storage.d.ts
|
|
3
|
+
export declare const resolveToken: (input?: ResolveTokenInput) => string;
|
|
7
4
|
interface StorageOptions {
|
|
8
5
|
projectId: string;
|
|
9
6
|
}
|
|
10
|
-
declare class NeonStorage implements Storage {
|
|
7
|
+
export declare class NeonStorage implements Storage {
|
|
11
8
|
private readonly client;
|
|
12
9
|
private readonly opts;
|
|
13
10
|
readonly key: "storage";
|
|
@@ -35,31 +32,12 @@ declare class NeonStorage implements Storage {
|
|
|
35
32
|
*/
|
|
36
33
|
private firstDatabase;
|
|
37
34
|
}
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region src/verify-token.d.ts
|
|
40
|
-
/**
|
|
41
|
-
* `verifyToken` — plugin-level export used by `holocron auth set` +
|
|
42
|
-
* `holocron auth check`. Hits Neon's `/users/me` endpoint and
|
|
43
|
-
* translates the response into the normalized `VerifyTokenResult`
|
|
44
|
-
* shape.
|
|
45
|
-
*/
|
|
46
|
-
interface VerifyTokenSuccess {
|
|
47
|
-
ok: true;
|
|
48
|
-
subject: string;
|
|
49
|
-
}
|
|
50
|
-
interface VerifyTokenFailure {
|
|
51
|
-
ok: false;
|
|
52
|
-
message: string;
|
|
53
|
-
}
|
|
54
|
-
type VerifyTokenResult = VerifyTokenSuccess | VerifyTokenFailure;
|
|
55
35
|
interface VerifyTokenOptions {
|
|
56
36
|
baseUrl?: string;
|
|
57
37
|
fetch?: typeof fetch;
|
|
58
38
|
}
|
|
59
|
-
declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult>;
|
|
60
|
-
|
|
61
|
-
//#region src/index.d.ts
|
|
62
|
-
interface NeonPluginOptions extends ResolveTokenInput {
|
|
39
|
+
export declare function verifyToken(token: string, opts?: VerifyTokenOptions): Promise<VerifyTokenResult$1>;
|
|
40
|
+
export interface NeonPluginOptions extends ResolveTokenInput {
|
|
63
41
|
/** Neon project id this plugin is bound to. Required. */
|
|
64
42
|
projectId: string;
|
|
65
43
|
/** Override base URL for tests. */
|
|
@@ -67,14 +45,17 @@ interface NeonPluginOptions extends ResolveTokenInput {
|
|
|
67
45
|
/** Override `fetch` for tests. */
|
|
68
46
|
fetch?: typeof fetch;
|
|
69
47
|
}
|
|
70
|
-
interface PluginContext {
|
|
48
|
+
export interface PluginContext {
|
|
71
49
|
options: NeonPluginOptions;
|
|
72
50
|
client: () => NeonClient;
|
|
73
51
|
}
|
|
74
|
-
declare function createContext(options: NeonPluginOptions): PluginContext;
|
|
75
|
-
declare function storage(ctx: PluginContext): Storage;
|
|
76
|
-
declare function createPlugin(options: NeonPluginOptions): {
|
|
52
|
+
export declare function createContext(options: NeonPluginOptions): PluginContext;
|
|
53
|
+
export declare function storage(ctx: PluginContext): Storage;
|
|
54
|
+
export declare function createPlugin(options: NeonPluginOptions): {
|
|
77
55
|
name: string;
|
|
56
|
+
probes: {
|
|
57
|
+
connection: import("@theholocron/cli").Probe;
|
|
58
|
+
};
|
|
78
59
|
capabilities: {
|
|
79
60
|
storage: () => Storage;
|
|
80
61
|
};
|
|
@@ -85,6 +66,5 @@ declare function createPlugin(options: NeonPluginOptions): {
|
|
|
85
66
|
* at https://console.neon.tech/app/settings/api-keys where API keys
|
|
86
67
|
* are minted.
|
|
87
68
|
*/
|
|
88
|
-
declare const AUTH_HINT: string;
|
|
89
|
-
|
|
90
|
-
export { AUTH_HINT, AuthError, type NeonClient, type NeonClientOptions, NeonPluginOptions, NeonStorage, PluginContext, type ResolveTokenInput, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createContext, createNeonClient, createPlugin, resolveToken, storage, verifyToken };
|
|
69
|
+
export declare const AUTH_HINT: string;
|
|
70
|
+
export { AuthError, type NeonClient, type NeonClientOptions, type ResolveTokenInput, type VerifyTokenFailure, type VerifyTokenResult, type VerifyTokenSuccess, createNeonClient };
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { AuthError, ProviderApiError, createResolveToken } from "@theholocron/cli";
|
|
1
|
+
import { AuthError, ProviderApiError, connectionProbe, createResolveToken } from "@theholocron/cli";
|
|
2
2
|
import { createNeonClient } from "@theholocron/neon-client";
|
|
3
|
-
|
|
3
|
+
import { errorMessage } from "@theholocron/misc-utils";
|
|
4
|
+
// src/auth.ts
|
|
4
5
|
const resolveToken = createResolveToken({
|
|
5
6
|
envName: "HOLOCRON_NEON_API_KEY",
|
|
6
7
|
vendorEnvName: "NEON_API_KEY",
|
|
7
8
|
keyringService: "neon",
|
|
8
9
|
errorMessage: "no Neon API key found. Pass --token <KEY>, set HOLOCRON_NEON_API_KEY / NEON_API_KEY, or run: holocron auth set neon <KEY>"
|
|
9
10
|
});
|
|
10
|
-
|
|
11
|
-
//#region src/capabilities/storage.ts
|
|
11
|
+
// src/capabilities/storage.ts
|
|
12
12
|
var NeonStorage = class {
|
|
13
13
|
client;
|
|
14
14
|
opts;
|
|
@@ -71,14 +71,7 @@ function mapBranch(raw) {
|
|
|
71
71
|
createdAt: raw.created_at
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
//#region src/verify-token.ts
|
|
76
|
-
/**
|
|
77
|
-
* `verifyToken` — plugin-level export used by `holocron auth set` +
|
|
78
|
-
* `holocron auth check`. Hits Neon's `/users/me` endpoint and
|
|
79
|
-
* translates the response into the normalized `VerifyTokenResult`
|
|
80
|
-
* shape.
|
|
81
|
-
*/
|
|
74
|
+
// src/verify-token.ts
|
|
82
75
|
async function verifyToken(token, opts = {}) {
|
|
83
76
|
const client = createNeonClient({
|
|
84
77
|
token,
|
|
@@ -94,12 +87,11 @@ async function verifyToken(token, opts = {}) {
|
|
|
94
87
|
} catch (err) {
|
|
95
88
|
return {
|
|
96
89
|
ok: false,
|
|
97
|
-
message:
|
|
90
|
+
message: errorMessage(err)
|
|
98
91
|
};
|
|
99
92
|
}
|
|
100
93
|
}
|
|
101
|
-
|
|
102
|
-
//#region src/index.ts
|
|
94
|
+
// src/index.ts
|
|
103
95
|
function createContext(options) {
|
|
104
96
|
if (!options.projectId) throw new Error("@theholocron/holocron-plugin-neon requires `projectId` in options");
|
|
105
97
|
let client;
|
|
@@ -119,6 +111,16 @@ function createPlugin(options) {
|
|
|
119
111
|
const ctx = createContext(options);
|
|
120
112
|
return {
|
|
121
113
|
name: "@theholocron/holocron-plugin-neon",
|
|
114
|
+
probes: { connection: connectionProbe({
|
|
115
|
+
provider: "Neon",
|
|
116
|
+
url: options.baseUrl ?? "https://console.neon.tech",
|
|
117
|
+
fetch: options.fetch,
|
|
118
|
+
token: () => resolveToken(options),
|
|
119
|
+
verify: (token) => verifyToken(token, {
|
|
120
|
+
baseUrl: options.baseUrl,
|
|
121
|
+
fetch: options.fetch
|
|
122
|
+
})
|
|
123
|
+
}) },
|
|
122
124
|
capabilities: { storage: () => storage(ctx) }
|
|
123
125
|
};
|
|
124
126
|
}
|
|
@@ -129,5 +131,4 @@ function createPlugin(options) {
|
|
|
129
131
|
* are minted.
|
|
130
132
|
*/
|
|
131
133
|
const AUTH_HINT = "generate a Neon API key at https://console.neon.tech/app/settings/api-keys, then run: holocron auth set neon <KEY>";
|
|
132
|
-
//#endregion
|
|
133
134
|
export { AUTH_HINT, AuthError, NeonStorage, createContext, createNeonClient, createPlugin, resolveToken, storage, verifyToken };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/holocron-plugin-neon",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.260",
|
|
4
4
|
"description": "Holocron plugin for Neon. Implements the storage capability against Neon's REST API — branch ops, connection strings, extensions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"holocron",
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
"plugin",
|
|
9
9
|
"storage"
|
|
10
10
|
],
|
|
11
|
-
"homepage": "https://github.com/theholocron/holocron/tree/main/
|
|
11
|
+
"homepage": "https://github.com/theholocron/holocron/tree/main/plugins/holocron-plugin-neon#readme",
|
|
12
12
|
"bugs": "https://github.com/theholocron/holocron/issues",
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
15
15
|
"url": "git+https://github.com/theholocron/holocron.git",
|
|
16
|
-
"directory": "
|
|
16
|
+
"directory": "plugins/holocron-plugin-neon"
|
|
17
17
|
},
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"author": "Newton Koumantzelis",
|
|
@@ -30,27 +30,29 @@
|
|
|
30
30
|
"dist"
|
|
31
31
|
],
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@theholocron/eslint-config": "^8.0.0",
|
|
34
|
-
"@theholocron/http-client": "^1.22.0",
|
|
35
|
-
"@theholocron/neon-client": "^1.22.0",
|
|
36
|
-
"@theholocron/tsconfig": "^8.0.0",
|
|
37
|
-
"@theholocron/tsdown-config": "^8.0.0",
|
|
38
|
-
"@theholocron/vitest-config": "^8.0.0",
|
|
39
33
|
"@types/node": "^26",
|
|
40
|
-
"@vitest/coverage-v8": "^
|
|
34
|
+
"@vitest/coverage-v8": "^5.0.5",
|
|
41
35
|
"@vitest/eslint-plugin": "^1.6.27",
|
|
42
36
|
"eslint": "^10.8.1",
|
|
43
37
|
"eslint-plugin-n": "^18.3.0",
|
|
44
38
|
"globals": "^17.11.0",
|
|
45
|
-
"tsdown": "^0.
|
|
46
|
-
"tsx": "4.23.
|
|
39
|
+
"tsdown": "^0.23.3",
|
|
40
|
+
"tsx": "4.23.15",
|
|
47
41
|
"typescript": "^5.9.3",
|
|
48
|
-
"vitest": "^
|
|
49
|
-
"@theholocron/
|
|
42
|
+
"vitest": "^5.0.5",
|
|
43
|
+
"@theholocron/http-client": "^1.57.1-alpha.2",
|
|
44
|
+
"@theholocron/cli": "5.0.0-alpha.260",
|
|
45
|
+
"@theholocron/neon-client": "^1.57.1-alpha.2",
|
|
46
|
+
"@theholocron/misc-utils": "^1.16.1-alpha.1",
|
|
47
|
+
"@theholocron/tsdown-config": "^8.9.0-alpha.3",
|
|
48
|
+
"@theholocron/tsconfig": "^8.9.0-alpha.3",
|
|
49
|
+
"@theholocron/vitest-config": "^8.9.0-alpha.3",
|
|
50
|
+
"@theholocron/eslint-config": "^8.9.0-alpha.3"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
|
-
"@theholocron/
|
|
53
|
-
"@theholocron/
|
|
53
|
+
"@theholocron/misc-utils": "^1.16.0",
|
|
54
|
+
"@theholocron/neon-client": "^1.43.1",
|
|
55
|
+
"@theholocron/cli": "5.0.0-alpha.260"
|
|
54
56
|
},
|
|
55
57
|
"peerDependenciesMeta": {
|
|
56
58
|
"@theholocron/neon-client": {}
|
|
@@ -63,10 +65,10 @@
|
|
|
63
65
|
},
|
|
64
66
|
"scripts": {
|
|
65
67
|
"delivery.build": "tsdown",
|
|
66
|
-
"sourceQuality.staticAnalysis": "
|
|
68
|
+
"sourceQuality.staticAnalysis": "eslint .",
|
|
67
69
|
"test:watch": "vitest",
|
|
68
70
|
"validate": "tsx scripts/validate.mjs",
|
|
69
|
-
"verification.typeSafety": "
|
|
70
|
-
"verification.unitTests": "
|
|
71
|
+
"verification.typeSafety": "tsc --noEmit",
|
|
72
|
+
"verification.unitTests": "vitest run"
|
|
71
73
|
}
|
|
72
74
|
}
|