@vite-hub/auth 0.1.0 → 0.3.1
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/README.md +333 -49
- package/dist/abilities-DfAnFYwG.d.ts +93 -0
- package/dist/abilities.d.ts +2 -0
- package/dist/abilities.js +43 -0
- package/dist/ability-error-CqgBrBfR.js +91 -0
- package/dist/ability-error-DcgChwCN.d.ts +34 -0
- package/dist/admin-claim-code-CDipqeAU.js +22 -0
- package/dist/agent.d.ts +5 -5
- package/dist/agent.js +17 -9
- package/dist/application-path-DuTpfGFj.js +62 -0
- package/dist/auth-instance-CR6b1W80.js +1168 -0
- package/dist/bun-sqlite.d.ts +8 -0
- package/dist/cli-ubYJpAL_.d.ts +163 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +47 -7
- package/dist/console-runtime-DTopBP-x.d.ts +71 -0
- package/dist/console-runtime-J9_Vx9pT.js +1166 -0
- package/dist/console-runtime.d.ts +3 -3
- package/dist/console-runtime.js +2 -819
- package/dist/console.d.ts +215 -3
- package/dist/console.js +1 -1
- package/dist/database-options-BRNef9oy.js +29 -0
- package/dist/database-schema-options-ENuRMduM.js +12 -0
- package/dist/database.d.ts +12 -0
- package/dist/database.js +45 -0
- package/dist/definition-CqQMcDEK.js +280 -0
- package/dist/error-diagnostics-C8XtVz0i.js +138 -0
- package/dist/{events-P7mI4IQb.js → events-ByzenEVj.js} +122 -4
- package/dist/forward.d.ts +50 -0
- package/dist/forward.js +120 -0
- package/dist/host-declarations.d.ts +2 -1
- package/dist/index.d.ts +24 -3
- package/dist/index.js +3 -102
- package/dist/internal/server.d.ts +5 -0
- package/dist/internal/server.js +858 -0
- package/dist/invariant-D8_xBqmZ.js +22 -0
- package/dist/mcp.d.ts +187 -0
- package/dist/mcp.js +353 -0
- package/dist/members-D9lfaEO_.js +533 -0
- package/dist/nuxt-bridge-Cl988STZ.js +44 -0
- package/dist/nuxt.d.ts +13 -5
- package/dist/nuxt.js +90 -13
- package/dist/object-Da1zyPCR.js +11 -0
- package/dist/page-tools-shared-l4eyj53D.js +19 -0
- package/dist/presets.js +1 -1
- package/dist/request-z6DHHmrb.js +47 -0
- package/dist/runtime/console.d.ts +3 -7
- package/dist/runtime/console.js +4 -42
- package/dist/runtime/empty-abilities.d.ts +5 -0
- package/dist/runtime/empty-abilities.js +4 -0
- package/dist/runtime/empty-client.d.ts +6 -0
- package/dist/runtime/empty-client.js +5 -0
- package/dist/runtime/empty-definition.d.ts +1 -1
- package/dist/runtime/nuxt.js +1 -1
- package/dist/runtime/server.d.ts +2 -0
- package/dist/runtime/server.js +77 -0
- package/dist/runtime/vue-nuxt.d.ts +3 -2
- package/dist/runtime/vue-nuxt.js +157 -5
- package/dist/runtime-state-ojQCzKOc.js +25 -0
- package/dist/schema.d.ts +137 -0
- package/dist/schema.js +147 -0
- package/dist/server-C0qnKN2W.d.ts +143 -0
- package/dist/server-bQGzVQ--.d.ts +41 -0
- package/dist/server.d.ts +3 -2
- package/dist/server.js +3 -3
- package/dist/session-cookies-BbH3UR2m.js +227 -0
- package/dist/{set-cookie-2as_DbHe.js → set-cookie-C8NOhdRE.js} +27 -12
- package/dist/{shared-DnpgYiLF.js → shared-BwcdRGxD.js} +2 -5
- package/dist/table-specs-8gq_FCaq.js +771 -0
- package/dist/table-specs-DbXyaXWs.d.ts +842 -0
- package/dist/test.d.ts +26 -0
- package/dist/test.js +25 -0
- package/dist/{events-BkmK2dFY.d.ts → types-CNaeH2Fd.d.ts} +240 -157
- package/dist/vite-CV400XXY.js +1556 -0
- package/dist/vite.d.ts +138 -20
- package/dist/vite.js +2 -2
- package/dist/vue.d.ts +330 -21
- package/dist/vue.js +583 -36
- package/package.json +84 -15
- package/dist/application-path-C290OAIs.js +0 -18
- package/dist/cli-mgXvsBtA.d.ts +0 -85
- package/dist/console-B7eERmGv.d.ts +0 -180
- package/dist/console-runtime-bZQtnX2Y.d.ts +0 -39
- package/dist/error-diagnostics-CL0yjHiM.js +0 -79
- package/dist/events-config-CjcFOhTE.js +0 -177
- package/dist/inspect-DPtsW8dB.d.ts +0 -36
- package/dist/server-B7LU19dS.js +0 -1730
- package/dist/server-CTD_JAww.d.ts +0 -77
- package/dist/vite-COWkwxsj.js +0 -990
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/auth",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Better Auth-powered authentication primitives and Vite integration for ViteHub.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"auth",
|
|
@@ -30,6 +30,14 @@
|
|
|
30
30
|
"sideEffects": false,
|
|
31
31
|
"types": "./dist/index.d.ts",
|
|
32
32
|
"imports": {
|
|
33
|
+
"#vitehub/auth/abilities": {
|
|
34
|
+
"types": "./dist/runtime/empty-abilities.d.ts",
|
|
35
|
+
"default": "./dist/runtime/empty-abilities.js"
|
|
36
|
+
},
|
|
37
|
+
"#vitehub/auth/client": {
|
|
38
|
+
"types": "./dist/runtime/empty-client.d.ts",
|
|
39
|
+
"default": "./dist/runtime/empty-client.js"
|
|
40
|
+
},
|
|
33
41
|
"#vitehub/auth/definition": {
|
|
34
42
|
"types": "./dist/runtime/empty-definition.d.ts",
|
|
35
43
|
"default": "./dist/runtime/empty-definition.js"
|
|
@@ -41,6 +49,11 @@
|
|
|
41
49
|
"import": "./dist/index.js",
|
|
42
50
|
"default": "./dist/index.js"
|
|
43
51
|
},
|
|
52
|
+
"./abilities": {
|
|
53
|
+
"types": "./dist/abilities.d.ts",
|
|
54
|
+
"import": "./dist/abilities.js",
|
|
55
|
+
"default": "./dist/abilities.js"
|
|
56
|
+
},
|
|
44
57
|
"./agent": {
|
|
45
58
|
"types": "./dist/agent.d.ts",
|
|
46
59
|
"import": "./dist/agent.js",
|
|
@@ -61,6 +74,26 @@
|
|
|
61
74
|
"import": "./dist/console-runtime.js",
|
|
62
75
|
"default": "./dist/console-runtime.js"
|
|
63
76
|
},
|
|
77
|
+
"./database": {
|
|
78
|
+
"types": "./dist/database.d.ts",
|
|
79
|
+
"import": "./dist/database.js",
|
|
80
|
+
"default": "./dist/database.js"
|
|
81
|
+
},
|
|
82
|
+
"./forward": {
|
|
83
|
+
"types": "./dist/forward.d.ts",
|
|
84
|
+
"import": "./dist/forward.js",
|
|
85
|
+
"default": "./dist/forward.js"
|
|
86
|
+
},
|
|
87
|
+
"./internal/server": {
|
|
88
|
+
"types": "./dist/internal/server.d.ts",
|
|
89
|
+
"import": "./dist/internal/server.js",
|
|
90
|
+
"default": "./dist/internal/server.js"
|
|
91
|
+
},
|
|
92
|
+
"./mcp": {
|
|
93
|
+
"types": "./dist/mcp.d.ts",
|
|
94
|
+
"import": "./dist/mcp.js",
|
|
95
|
+
"default": "./dist/mcp.js"
|
|
96
|
+
},
|
|
64
97
|
"./nuxt": {
|
|
65
98
|
"types": "./dist/nuxt.d.ts",
|
|
66
99
|
"import": "./dist/nuxt.js",
|
|
@@ -76,11 +109,26 @@
|
|
|
76
109
|
"import": "./dist/runtime/console.js",
|
|
77
110
|
"default": "./dist/runtime/console.js"
|
|
78
111
|
},
|
|
112
|
+
"./runtime/server": {
|
|
113
|
+
"types": "./dist/runtime/server.d.ts",
|
|
114
|
+
"import": "./dist/runtime/server.js",
|
|
115
|
+
"default": "./dist/runtime/server.js"
|
|
116
|
+
},
|
|
117
|
+
"./schema": {
|
|
118
|
+
"types": "./dist/schema.d.ts",
|
|
119
|
+
"import": "./dist/schema.js",
|
|
120
|
+
"default": "./dist/schema.js"
|
|
121
|
+
},
|
|
79
122
|
"./server": {
|
|
80
123
|
"types": "./dist/server.d.ts",
|
|
81
124
|
"import": "./dist/server.js",
|
|
82
125
|
"default": "./dist/server.js"
|
|
83
126
|
},
|
|
127
|
+
"./test": {
|
|
128
|
+
"types": "./dist/test.d.ts",
|
|
129
|
+
"import": "./dist/test.js",
|
|
130
|
+
"default": "./dist/test.js"
|
|
131
|
+
},
|
|
84
132
|
"./vite": {
|
|
85
133
|
"types": "./dist/vite.d.ts",
|
|
86
134
|
"import": "./dist/vite.js",
|
|
@@ -94,44 +142,65 @@
|
|
|
94
142
|
"./package.json": "./package.json"
|
|
95
143
|
},
|
|
96
144
|
"dependencies": {
|
|
97
|
-
"@
|
|
145
|
+
"@noble/hashes": "^2.2.0",
|
|
98
146
|
"@types/node": "^24.19.1",
|
|
99
|
-
"@vite-hub/env": "0.1
|
|
100
|
-
"@vite-hub/runtime": "0.1
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"nostics": "1.
|
|
147
|
+
"@vite-hub/env": "0.3.1",
|
|
148
|
+
"@vite-hub/runtime": "0.3.1",
|
|
149
|
+
"@vite-hub/web-container": "0.3.1",
|
|
150
|
+
"better-auth": "^1.7.15",
|
|
151
|
+
"h3": "^2.0.8",
|
|
152
|
+
"nostics": "1.4.0",
|
|
153
|
+
"rou3": "^1.0.0",
|
|
105
154
|
"valibot": "^1.5.0"
|
|
106
155
|
},
|
|
107
156
|
"devDependencies": {
|
|
157
|
+
"@better-auth/api-key": "1.7.15",
|
|
158
|
+
"@better-auth/oauth-provider": "^1.7.15",
|
|
159
|
+
"@better-auth/passkey": "1.7.15",
|
|
160
|
+
"@better-auth/stripe": "1.7.15",
|
|
161
|
+
"@cloudflare/workers-types": "^5.20261016.1",
|
|
108
162
|
"@types/json-schema": "^7.0.15",
|
|
109
163
|
"@types/mdast": "^4.0.4",
|
|
110
164
|
"@types/node": "^24.19.1",
|
|
111
|
-
"@vite-hub/agent": "0.1
|
|
165
|
+
"@vite-hub/agent": "0.3.1",
|
|
166
|
+
"@vite-hub/database": "0.3.1",
|
|
167
|
+
"@vite-hub/internal": "0.0.1",
|
|
168
|
+
"bun-types": "^1.4.3",
|
|
112
169
|
"happy-dom": "20.14.5",
|
|
113
170
|
"miniflare": "4.20260730.0",
|
|
171
|
+
"nitro": "^3.0.261103-rc",
|
|
114
172
|
"publint": "^0.3.25",
|
|
173
|
+
"stripe": "23.1.0",
|
|
115
174
|
"typescript": "^6.0.3",
|
|
116
175
|
"undici": "8.12.2",
|
|
117
176
|
"vite": "^8.2.2",
|
|
118
177
|
"vite-plus": "^0.3.3",
|
|
119
178
|
"vitest": "^4.1.11",
|
|
120
179
|
"vue": "3.5.44",
|
|
121
|
-
"
|
|
122
|
-
"
|
|
180
|
+
"drizzle-kit": "1.0.0-rc.5",
|
|
181
|
+
"drizzle-orm": "1.0.0-rc.5"
|
|
123
182
|
},
|
|
124
183
|
"peerDependencies": {
|
|
184
|
+
"@better-auth/oauth-provider": "^1.7.15",
|
|
125
185
|
"@types/json-schema": "^7.0.15",
|
|
126
186
|
"@types/mdast": "^4.0.4",
|
|
127
|
-
"@vite-hub/agent": "0.1
|
|
187
|
+
"@vite-hub/agent": "0.3.1",
|
|
188
|
+
"@vite-hub/database": "0.3.1",
|
|
189
|
+
"nitro": "3.0.261102-rc || ^3.0.261103-rc",
|
|
128
190
|
"vite": ">=8.0.0",
|
|
129
|
-
"vue": "3.5.
|
|
191
|
+
"vue": "^3.5.0",
|
|
192
|
+
"drizzle-orm": "1.0.0-rc.5 || ^1.0.0"
|
|
130
193
|
},
|
|
131
194
|
"peerDependenciesMeta": {
|
|
195
|
+
"@better-auth/oauth-provider": {
|
|
196
|
+
"optional": true
|
|
197
|
+
},
|
|
132
198
|
"@vite-hub/agent": {
|
|
133
199
|
"optional": true
|
|
134
200
|
},
|
|
201
|
+
"@vite-hub/database": {
|
|
202
|
+
"optional": true
|
|
203
|
+
},
|
|
135
204
|
"vite": {
|
|
136
205
|
"optional": true
|
|
137
206
|
},
|
|
@@ -140,12 +209,12 @@
|
|
|
140
209
|
}
|
|
141
210
|
},
|
|
142
211
|
"engines": {
|
|
143
|
-
"node": ">=
|
|
212
|
+
"node": ">=22.18.0"
|
|
144
213
|
},
|
|
145
214
|
"scripts": {
|
|
146
215
|
"build": "vp pack",
|
|
147
216
|
"dev": "vp pack --watch",
|
|
148
217
|
"typecheck": "vp run --cache -t @vite-hub/auth#build && node ../../test/package-typecheck.mjs --noEmit -p ./tsconfig.json",
|
|
149
|
-
"test": "vp run -t @vite-hub/auth#build && vp test"
|
|
218
|
+
"test": "vp run --cache -t @vite-hub/auth#build && vp test"
|
|
150
219
|
}
|
|
151
220
|
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
//#region src/application-path.ts
|
|
2
|
-
/** Return the application base path without a trailing slash, or an empty string at the root. */
|
|
3
|
-
function authApplicationBasePath() {
|
|
4
|
-
const segments = (typeof __VITEHUB_AUTH_APP_BASE_URL__ === "undefined" ? "/" : __VITEHUB_AUTH_APP_BASE_URL__).split("/").filter(Boolean);
|
|
5
|
-
return segments.length ? `/${segments.join("/")}` : "";
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Prefix an application path, such as the Auth Base Path, with the application base path.
|
|
9
|
-
* A path that already starts with the base path is returned unchanged, so a caller such as Console Auth
|
|
10
|
-
* that mounts its own paths below the base path is not prefixed twice.
|
|
11
|
-
*/
|
|
12
|
-
function resolveAuthMountPath(path) {
|
|
13
|
-
const base = authApplicationBasePath();
|
|
14
|
-
if (!base || path === base || path.startsWith(`${base}/`)) return path;
|
|
15
|
-
return `${base}${path}`;
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
export { resolveAuthMountPath as t };
|
package/dist/cli-mgXvsBtA.d.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import "nostics";
|
|
2
|
-
//#region ../internal/src/provision.d.ts
|
|
3
|
-
type ProvisionProvider = "cloudflare" | "vercel";
|
|
4
|
-
interface ProvisionLogger {
|
|
5
|
-
log: (message: string) => void;
|
|
6
|
-
warn: (message: string) => void;
|
|
7
|
-
}
|
|
8
|
-
interface ProvisionContext {
|
|
9
|
-
env: Record<string, string | undefined>;
|
|
10
|
-
fetch: typeof globalThis.fetch;
|
|
11
|
-
logger: ProvisionLogger;
|
|
12
|
-
markPlanUnchecked?: () => void;
|
|
13
|
-
}
|
|
14
|
-
interface ProvisionState {
|
|
15
|
-
cloudflare?: Record<string, Record<string, string>>;
|
|
16
|
-
vercel?: Record<string, Record<string, string>>;
|
|
17
|
-
}
|
|
18
|
-
interface ProvisionResult {
|
|
19
|
-
ids?: ProvisionState;
|
|
20
|
-
}
|
|
21
|
-
interface ProvisionAction {
|
|
22
|
-
kind: string;
|
|
23
|
-
name: string;
|
|
24
|
-
exists: boolean;
|
|
25
|
-
pending?: boolean;
|
|
26
|
-
apply: () => Promise<ProvisionResult>;
|
|
27
|
-
}
|
|
28
|
-
interface ProvisionStep {
|
|
29
|
-
id: string;
|
|
30
|
-
provider: ProvisionProvider;
|
|
31
|
-
plan: (context: ProvisionContext) => Promise<ProvisionAction[]>;
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
//#region ../internal/src/cli.d.ts
|
|
35
|
-
interface ViteHubCliStreams {
|
|
36
|
-
stderr: {
|
|
37
|
-
write: (chunk: string | Uint8Array, encoding?: BufferEncoding | StdoutWriteCallback, callback?: StdoutWriteCallback) => unknown;
|
|
38
|
-
};
|
|
39
|
-
stdout: {
|
|
40
|
-
write: (chunk: string | Uint8Array) => unknown;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
interface ViteHubCliSpawnResult {
|
|
44
|
-
exitCode: number | null;
|
|
45
|
-
signal?: NodeJS.Signals | null;
|
|
46
|
-
}
|
|
47
|
-
interface ViteHubCliSpawnOptions {
|
|
48
|
-
cwd?: string;
|
|
49
|
-
env?: NodeJS.ProcessEnv;
|
|
50
|
-
stderr?: "inherit" | "pipe";
|
|
51
|
-
stdout?: "inherit" | "pipe";
|
|
52
|
-
}
|
|
53
|
-
type ViteHubCliSpawn = (command: string, args: string[], options?: ViteHubCliSpawnOptions) => Promise<ViteHubCliSpawnResult>;
|
|
54
|
-
interface ViteHubCliContext extends ViteHubCliStreams {
|
|
55
|
-
cwd: string;
|
|
56
|
-
env: NodeJS.ProcessEnv;
|
|
57
|
-
/** Replaces `fetch` for commands that call a running app, so tests need no server. */
|
|
58
|
-
fetch?: typeof fetch;
|
|
59
|
-
rootDir: string;
|
|
60
|
-
spawn: ViteHubCliSpawn;
|
|
61
|
-
}
|
|
62
|
-
interface ViteHubCliFeature {
|
|
63
|
-
description?: string;
|
|
64
|
-
name: string;
|
|
65
|
-
run: (args: string[], context: ViteHubCliContext) => Promise<number | void> | number | void;
|
|
66
|
-
usage?: string;
|
|
67
|
-
}
|
|
68
|
-
interface ViteHubCliCommandNamespace {
|
|
69
|
-
/** The feature that `vitehub <name>` runs when no feature is named. */
|
|
70
|
-
defaultFeature?: string;
|
|
71
|
-
description?: string;
|
|
72
|
-
features: ViteHubCliFeature[];
|
|
73
|
-
name: string;
|
|
74
|
-
}
|
|
75
|
-
interface ViteHubCliContributor {
|
|
76
|
-
namespaces: ViteHubCliCommandNamespace[];
|
|
77
|
-
provision?: ProvisionStep[];
|
|
78
|
-
}
|
|
79
|
-
type ViteHubCliContributorFactory = () => ViteHubCliContributor | undefined | Promise<ViteHubCliContributor | undefined>;
|
|
80
|
-
interface ViteHubCliPluginMetadata {
|
|
81
|
-
cli?: ViteHubCliContributor | ViteHubCliContributorFactory;
|
|
82
|
-
}
|
|
83
|
-
type StdoutWriteCallback = (error?: Error | null) => void;
|
|
84
|
-
//#endregion
|
|
85
|
-
export { ViteHubCliPluginMetadata as n, ViteHubCliContributor as t };
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import { t as ViteHubDefinitionField } from "./inspect-DPtsW8dB.js";
|
|
2
|
-
//#region ../internal/src/console.d.ts
|
|
3
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
4
|
-
/** Lists discovered Definitions in a sidebar and shows the selected Definition's fields. */
|
|
5
|
-
interface ViteHubConsoleDefinitionCatalogView {
|
|
6
|
-
kind: "definition-catalog";
|
|
7
|
-
/** States which runtime data this catalog does not include. */
|
|
8
|
-
notice: string;
|
|
9
|
-
}
|
|
10
|
-
interface ViteHubConsoleRecordColumn {
|
|
11
|
-
/** Key in `ViteHubConsoleRecord.cells`. */
|
|
12
|
-
key: string;
|
|
13
|
-
label: string;
|
|
14
|
-
}
|
|
15
|
-
/** Shows records in a table and the selected record's fields in a detail panel. */
|
|
16
|
-
interface ViteHubConsoleRecordTableView {
|
|
17
|
-
columns: readonly ViteHubConsoleRecordColumn[];
|
|
18
|
-
kind: "record-table";
|
|
19
|
-
/** States the source and limits of the records. */
|
|
20
|
-
notice: string;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Lists the collections and documents of an owner runtime and edits them with owner actions: a form generated from each
|
|
24
|
-
* collection's JSON Schema, a Markdown body, save, publish, and revision history.
|
|
25
|
-
*/
|
|
26
|
-
interface ViteHubConsoleDocumentEditorView {
|
|
27
|
-
kind: "document-editor";
|
|
28
|
-
/** States where documents are stored and what the editor does not do. */
|
|
29
|
-
notice: string;
|
|
30
|
-
}
|
|
31
|
-
interface ViteHubConsoleOperationColumn {
|
|
32
|
-
/** Dot path into each item of the result, such as `author.name` or `messages.0.body`. */
|
|
33
|
-
key: string;
|
|
34
|
-
label: string;
|
|
35
|
-
/** `datetime` shows a time in milliseconds since the epoch as a date. `excerpt` cuts a long text. */
|
|
36
|
-
format?: "datetime" | "excerpt";
|
|
37
|
-
}
|
|
38
|
-
/** A chip above the list. Choosing it merges `input` into the operation input. The first chip is the default. */
|
|
39
|
-
interface ViteHubConsoleOperationFilter {
|
|
40
|
-
id: string;
|
|
41
|
-
label: string;
|
|
42
|
-
input: Readonly<Record<string, unknown>>;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Lists the items that an operation returns, called over the Console RPC with the signed-in Console user. The operation
|
|
46
|
-
* checks the access of that user for each item, so the view shows only what the user may read. `operation` must return an
|
|
47
|
-
* array of objects with an `id`. A failure of the operation, with its `fix`, shows where the list would be.
|
|
48
|
-
*/
|
|
49
|
-
interface ViteHubConsoleOperationView {
|
|
50
|
-
columns: readonly ViteHubConsoleOperationColumn[];
|
|
51
|
-
filters?: readonly ViteHubConsoleOperationFilter[];
|
|
52
|
-
kind: "operation-view";
|
|
53
|
-
/**
|
|
54
|
-
* Makes each row a link: `{path}` placeholders take values from the item and are URL-encoded, and `{path:path}` takes an
|
|
55
|
-
* app path and encodes each segment (a value that is not an app path, such as `//evil.com/x`, gives no link). Rows where
|
|
56
|
-
* `when.path` is not `when.equals` get none.
|
|
57
|
-
*/
|
|
58
|
-
link?: {
|
|
59
|
-
label?: string;
|
|
60
|
-
template: string;
|
|
61
|
-
when?: {
|
|
62
|
-
equals: string;
|
|
63
|
-
path: string;
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
notice: string;
|
|
67
|
-
/** Operation name, such as `comments.list`. */
|
|
68
|
-
operation: string;
|
|
69
|
-
/** Fetch every page with `limit` and a `before` object whose keys read these dot paths from the last item. */
|
|
70
|
-
pagination?: {
|
|
71
|
-
limit: number;
|
|
72
|
-
cursor: Readonly<Record<string, string>>;
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
interface ViteHubConsoleAuthView {
|
|
76
|
-
kind: "auth-management";
|
|
77
|
-
notice: string;
|
|
78
|
-
}
|
|
79
|
-
interface ViteHubConsoleAuthSection extends ViteHubConsoleSectionDescriptor<ViteHubConsoleAuthView> {}
|
|
80
|
-
type ViteHubConsoleSectionView = ViteHubConsoleOperationView | ViteHubConsoleAuthView | ViteHubConsoleDefinitionCatalogView | ViteHubConsoleRecordTableView | ViteHubConsoleDocumentEditorView;
|
|
81
|
-
/**
|
|
82
|
-
* The overview of a document editor section: document counts by state, the changes that wait for a publish, recent
|
|
83
|
-
* activity, and a New button per collection. It reads the owner `overview` action.
|
|
84
|
-
*/
|
|
85
|
-
interface ViteHubConsoleDocumentDashboardView {
|
|
86
|
-
kind: "document-dashboard";
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* The media library of a document editor section: folders, uploads, alt text, focal points, and crops of the Blob Store
|
|
90
|
-
* that `blob.serve` serves. The owner decides who may use it with `mediaAccess`, and finds the documents that use a file
|
|
91
|
-
* with `references`. The page needs the Blob section, so declare it with `requires: ["blob"]`.
|
|
92
|
-
*/
|
|
93
|
-
interface ViteHubConsoleMediaLibraryView {
|
|
94
|
-
kind: "media-library";
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* The singletons of a document editor section, such as site settings: one row per singleton that opens it in the
|
|
98
|
-
* editor. Singletons appear here instead of among the collections, and the Console hides the page when the section has
|
|
99
|
-
* none.
|
|
100
|
-
*/
|
|
101
|
-
interface ViteHubConsoleDocumentSettingsView {
|
|
102
|
-
kind: "document-settings";
|
|
103
|
-
}
|
|
104
|
-
/** A view that the Console UI in `vite-hub` renders for a section page. */
|
|
105
|
-
type ViteHubConsoleSectionPageView = ViteHubConsoleDocumentDashboardView | ViteHubConsoleDocumentSettingsView | ViteHubConsoleMediaLibraryView;
|
|
106
|
-
/**
|
|
107
|
-
* A page of a section next to its main view, such as the Content dashboard or media library. The section sidebar lists
|
|
108
|
-
* the pages, and each page has its own URL:
|
|
109
|
-
*
|
|
110
|
-
* - `/_vitehub/<section>` serves the `index` page, or the main view when the section has none.
|
|
111
|
-
* - `/_vitehub/<section>/-/<page>` serves every other page. The `-` segment keeps page URLs apart from the main view's
|
|
112
|
-
* own segments, such as a collection name.
|
|
113
|
-
*
|
|
114
|
-
* Pages share the access of their section: `console.authorize` that allows the section allows every page of it.
|
|
115
|
-
*/
|
|
116
|
-
interface ViteHubConsoleSectionPage {
|
|
117
|
-
/** Lowercase route segment, for example `media`. */
|
|
118
|
-
id: string;
|
|
119
|
-
/** Display name, for example `Media`. */
|
|
120
|
-
label: string;
|
|
121
|
-
/** Iconify class name, for example `i-lucide-image`. */
|
|
122
|
-
icon: string;
|
|
123
|
-
view: ViteHubConsoleSectionPageView;
|
|
124
|
-
/**
|
|
125
|
-
* Serve this page at the section root. At most one page sets it, and `/_vitehub/<section>/-/<id>` then redirects to
|
|
126
|
-
* the root.
|
|
127
|
-
*/
|
|
128
|
-
index?: boolean;
|
|
129
|
-
/**
|
|
130
|
-
* Sidebar heading, for example `Assets`. Pages without a group lead the sidebar, above the main view's navigation.
|
|
131
|
-
* Grouped pages follow it, in the order their group first appears.
|
|
132
|
-
*/
|
|
133
|
-
group?: string;
|
|
134
|
-
/** Section ids that the project must enable, such as `["blob"]`. The Console leaves the page out otherwise. */
|
|
135
|
-
requires?: readonly string[];
|
|
136
|
-
}
|
|
137
|
-
/** One entry of a record's activity, such as a comment in a thread. `at` is an ISO 8601 timestamp. */
|
|
138
|
-
interface ViteHubConsoleRecordActivity {
|
|
139
|
-
author: string;
|
|
140
|
-
at: string;
|
|
141
|
-
text: string;
|
|
142
|
-
}
|
|
143
|
-
/** One serializable record row. Values are display strings. Do not put credentials in records. */
|
|
144
|
-
interface ViteHubConsoleRecord {
|
|
145
|
-
cells: Readonly<Record<string, string>>;
|
|
146
|
-
fields: readonly ViteHubDefinitionField[];
|
|
147
|
-
id: string;
|
|
148
|
-
/** The Console can run this record when it represents a runnable Schedule Definition. */
|
|
149
|
-
runnable?: boolean;
|
|
150
|
-
/**
|
|
151
|
-
* Where the record lives in the app, such as the page of a comment thread. `href` is an app path that starts with one
|
|
152
|
-
* `/`, or an `https:` URL. The Console opens it in a new tab.
|
|
153
|
-
*/
|
|
154
|
-
link?: {
|
|
155
|
-
href: string;
|
|
156
|
-
label: string;
|
|
157
|
-
};
|
|
158
|
-
/** Entries in time order, such as the comments of a thread. The Console shows them as a conversation. */
|
|
159
|
-
activity?: readonly ViteHubConsoleRecordActivity[];
|
|
160
|
-
}
|
|
161
|
-
/** Serializable description of a Console section. The Console UI in `vite-hub` renders the view. */
|
|
162
|
-
interface ViteHubConsoleSectionDescriptor<TView extends ViteHubConsoleSectionView = ViteHubConsoleSectionView> {
|
|
163
|
-
description: string;
|
|
164
|
-
/**
|
|
165
|
-
* Iconify class name, for example `i-lucide-inbox`. The Console draws with Lucide; `ph` also resolves. The
|
|
166
|
-
* Console build bundles the icon of every section in the `vite-hub` Console registry and fails if it cannot resolve one.
|
|
167
|
-
*/
|
|
168
|
-
icon: string;
|
|
169
|
-
/** Lowercase route segment, for example `queues`. The Console serves the section at `/_vitehub/<id>`. */
|
|
170
|
-
id: string;
|
|
171
|
-
/** Plural display name, for example `Queues`. */
|
|
172
|
-
label: string;
|
|
173
|
-
view: TView;
|
|
174
|
-
/** Pages next to the main view, in sidebar order. Only document editor sections render pages today. */
|
|
175
|
-
pages?: readonly ViteHubConsoleSectionPage[];
|
|
176
|
-
}
|
|
177
|
-
/** Reads runtime records in the server runtime. It runs on each Console request, never in the browser. */
|
|
178
|
-
type ViteHubConsoleRuntimeRecordReader = () => MaybePromise<readonly ViteHubConsoleRecord[]>;
|
|
179
|
-
//#endregion
|
|
180
|
-
export { ViteHubConsoleRuntimeRecordReader as n, ViteHubConsoleAuthSection as t };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { At as AuthConsoleOverview, Ct as AuthConsoleHostOptions, Dt as AuthConsoleOptions, Et as AuthConsoleMutation, Ft as AuthConsoleUser, It as AuthConsoleUserDetail, Nt as AuthConsoleQuery, Ot as AuthConsoleOrganization, Pt as AuthConsoleSession, Tt as AuthConsoleList, bt as AuthConsoleField, dt as AuthConsoleActivity, ft as AuthConsoleActivityQuery, gt as AuthConsoleDescription, kt as AuthConsoleOrganizationDetail, pt as AuthConsoleAgent, u as AuthEventStore } from "./events-BkmK2dFY.js";
|
|
2
|
-
import { Result } from "@vite-hub/runtime";
|
|
3
|
-
import { BetterAuthOptions, DBAdapter } from "better-auth";
|
|
4
|
-
//#region src/console-runtime.d.ts
|
|
5
|
-
interface AuthConsole {
|
|
6
|
-
describe(request?: Request): Promise<Result<AuthConsoleDescription, AuthConsoleErrorCode>>;
|
|
7
|
-
overview(): Promise<Result<AuthConsoleOverview, AuthConsoleErrorCode>>;
|
|
8
|
-
activity(query?: AuthConsoleActivityQuery): Promise<Result<AuthConsoleActivity, AuthConsoleErrorCode>>;
|
|
9
|
-
users(query?: AuthConsoleQuery): Promise<Result<AuthConsoleList<AuthConsoleUser>, AuthConsoleErrorCode>>;
|
|
10
|
-
/** With `request`, the impersonation target check also counts the `impersonate-admins` permission of its session. */
|
|
11
|
-
user(id: string, request?: Request): Promise<Result<AuthConsoleUserDetail, AuthConsoleErrorCode>>;
|
|
12
|
-
sessions(query?: AuthConsoleQuery): Promise<Result<AuthConsoleList<AuthConsoleSession>, AuthConsoleErrorCode>>;
|
|
13
|
-
organizations(query?: AuthConsoleQuery): Promise<Result<AuthConsoleList<AuthConsoleOrganization>, AuthConsoleErrorCode>>;
|
|
14
|
-
organization(id: string, query?: AuthConsoleQuery): Promise<Result<AuthConsoleOrganizationDetail, AuthConsoleErrorCode>>;
|
|
15
|
-
agents(query?: AuthConsoleQuery): Promise<Result<AuthConsoleList<AuthConsoleAgent>, AuthConsoleErrorCode>>;
|
|
16
|
-
execute(input: AuthConsoleMutation, request: Request): Promise<Result<Response, AuthConsoleErrorCode>>;
|
|
17
|
-
/** End the impersonation of the request's app session and restore the administrator's session cookies. */
|
|
18
|
-
stopImpersonating(request: Request): Promise<Result<Response, AuthConsoleErrorCode>>;
|
|
19
|
-
}
|
|
20
|
-
type ConsoleAdapter = Pick<DBAdapter, "findMany" | "findOne" | "count">;
|
|
21
|
-
type AuthConsoleErrorCode = "AUTH_CONSOLE_INVALID_REQUEST" | "AUTH_CONSOLE_FORBIDDEN" | "AUTH_CONSOLE_NOT_FOUND" | "AUTH_CONSOLE_UNAVAILABLE" | "AUTH_CONSOLE_PROVIDER_FAILED";
|
|
22
|
-
/** Only additional fields that Better Auth allows in output reach the Console. */
|
|
23
|
-
declare function describeAuthConsoleFields(options: BetterAuthOptions, policy?: AuthConsoleOptions): AuthConsoleField[];
|
|
24
|
-
/**
|
|
25
|
-
* Read and manage the app's Better Auth data from trusted server code. HTTP hosts must check access before calling it.
|
|
26
|
-
* Writes require a real Better Auth session and pass through its plugin APIs. No adapter writes are used here.
|
|
27
|
-
* Impersonation stays off unless `host.impersonation` is `true`.
|
|
28
|
-
*/
|
|
29
|
-
declare function createAuthConsole(auth: {
|
|
30
|
-
api: object;
|
|
31
|
-
$context: Promise<{
|
|
32
|
-
adapter: ConsoleAdapter;
|
|
33
|
-
options: BetterAuthOptions;
|
|
34
|
-
}>;
|
|
35
|
-
}, policy?: AuthConsoleOptions, events?: AuthEventStore, host?: AuthConsoleHostOptions): AuthConsole;
|
|
36
|
-
/** A short device label. The full user agent is never returned to the browser. */
|
|
37
|
-
declare function authConsoleDevice(userAgent: string): string;
|
|
38
|
-
//#endregion
|
|
39
|
-
export { describeAuthConsoleFields as a, createAuthConsole as i, AuthConsoleErrorCode as n, authConsoleDevice as r, AuthConsole as t };
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { defineDiagnostics } from "nostics";
|
|
2
|
-
//#region src/error-diagnostics.ts
|
|
3
|
-
const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
|
|
4
|
-
const authErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
5
|
-
docsBase: () => "https://vitehub.dev/docs/reference/diagnostics",
|
|
6
|
-
codes: {
|
|
7
|
-
AUTH_R0001: dynamicError,
|
|
8
|
-
AUTH_R0002: dynamicError,
|
|
9
|
-
AUTH_C0001: dynamicError,
|
|
10
|
-
AUTH_C0002: dynamicError,
|
|
11
|
-
AUTH_C0003: dynamicError,
|
|
12
|
-
AUTH_C0004: dynamicError,
|
|
13
|
-
AUTH_C0005: dynamicError,
|
|
14
|
-
AUTH_C0006: dynamicError,
|
|
15
|
-
AUTH_C0007: dynamicError,
|
|
16
|
-
AUTH_C0008: dynamicError,
|
|
17
|
-
AUTH_C0009: dynamicError,
|
|
18
|
-
AUTH_C0010: dynamicError,
|
|
19
|
-
AUTH_C0011: dynamicError,
|
|
20
|
-
AUTH_C0012: dynamicError,
|
|
21
|
-
AUTH_C0013: dynamicError,
|
|
22
|
-
AUTH_C0014: dynamicError,
|
|
23
|
-
AUTH_C0015: dynamicError,
|
|
24
|
-
AUTH_C0016: dynamicError,
|
|
25
|
-
AUTH_C0017: dynamicError,
|
|
26
|
-
AUTH_C0018: dynamicError,
|
|
27
|
-
AUTH_C0019: dynamicError,
|
|
28
|
-
AUTH_C0020: dynamicError,
|
|
29
|
-
AUTH_C0021: dynamicError,
|
|
30
|
-
AUTH_C0022: dynamicError,
|
|
31
|
-
AUTH_C0023: dynamicError,
|
|
32
|
-
AUTH_C0024: dynamicError,
|
|
33
|
-
AUTH_C0025: dynamicError,
|
|
34
|
-
AUTH_C0026: dynamicError,
|
|
35
|
-
AUTH_C0027: dynamicError,
|
|
36
|
-
AUTH_C0028: dynamicError,
|
|
37
|
-
AUTH_C0029: dynamicError,
|
|
38
|
-
AUTH_C0030: dynamicError,
|
|
39
|
-
AUTH_C0031: dynamicError,
|
|
40
|
-
AUTH_C0032: dynamicError,
|
|
41
|
-
AUTH_C0033: dynamicError,
|
|
42
|
-
AUTH_C0034: dynamicError,
|
|
43
|
-
AUTH_C0035: dynamicError,
|
|
44
|
-
AUTH_C0036: dynamicError,
|
|
45
|
-
AUTH_C0037: dynamicError,
|
|
46
|
-
AUTH_C0038: dynamicError,
|
|
47
|
-
AUTH_C0039: dynamicError,
|
|
48
|
-
AUTH_C0040: dynamicError,
|
|
49
|
-
AUTH_C0041: dynamicError,
|
|
50
|
-
AUTH_C0042: dynamicError,
|
|
51
|
-
AUTH_C0043: dynamicError,
|
|
52
|
-
AUTH_C0044: dynamicError,
|
|
53
|
-
AUTH_C0045: dynamicError,
|
|
54
|
-
AUTH_C0046: dynamicError,
|
|
55
|
-
AUTH_C0047: dynamicError,
|
|
56
|
-
AUTH_C0048: dynamicError,
|
|
57
|
-
AUTH_C0049: dynamicError,
|
|
58
|
-
AUTH_C0050: dynamicError,
|
|
59
|
-
AUTH_R0018: dynamicError,
|
|
60
|
-
AUTH_R0003: dynamicError,
|
|
61
|
-
AUTH_R0004: dynamicError,
|
|
62
|
-
AUTH_B0001: dynamicError,
|
|
63
|
-
AUTH_R0005: dynamicError,
|
|
64
|
-
AUTH_R0006: dynamicError,
|
|
65
|
-
AUTH_R0007: dynamicError,
|
|
66
|
-
AUTH_R0008: dynamicError,
|
|
67
|
-
AUTH_R0009: dynamicError,
|
|
68
|
-
AUTH_R0010: dynamicError,
|
|
69
|
-
AUTH_R0011: dynamicError,
|
|
70
|
-
AUTH_R0012: dynamicError,
|
|
71
|
-
AUTH_R0013: dynamicError,
|
|
72
|
-
AUTH_R0014: dynamicError,
|
|
73
|
-
AUTH_R0015: dynamicError,
|
|
74
|
-
AUTH_R0016: dynamicError,
|
|
75
|
-
AUTH_R0017: dynamicError
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
//#endregion
|
|
79
|
-
export { authErrorDiagnostics as t };
|