@naisys/supervisor-database 3.0.0-beta.4 → 3.0.0-beta.5
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/dbConfig.js +2 -2
- package/dist/generated/prisma/browser.js +4 -4
- package/dist/generated/prisma/client.js +5 -5
- package/dist/generated/prisma/commonInputTypes.js +1 -1
- package/dist/generated/prisma/enums.js +12 -12
- package/dist/generated/prisma/internal/class.js +36 -28
- package/dist/generated/prisma/internal/prismaNamespace.js +42 -39
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.js +34 -34
- package/dist/index.js +17 -2
- package/dist/migrationHelper.js +5 -5
- package/dist/prismaClient.js +12 -12
- package/dist/sessionService.js +135 -139
- package/package.json +6 -4
- package/dist/dbConfig.d.ts +0 -5
- package/dist/generated/prisma/browser.d.ts +0 -25
- package/dist/generated/prisma/client.d.ts +0 -44
- package/dist/generated/prisma/commonInputTypes.d.ts +0 -341
- package/dist/generated/prisma/enums.d.ts +0 -11
- package/dist/generated/prisma/internal/class.d.ts +0 -164
- package/dist/generated/prisma/internal/prismaNamespace.d.ts +0 -775
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts +0 -82
- package/dist/generated/prisma/models/SchemaVersion.d.ts +0 -984
- package/dist/generated/prisma/models/Session.d.ts +0 -1212
- package/dist/generated/prisma/models/User.d.ts +0 -1546
- package/dist/generated/prisma/models/UserPermission.d.ts +0 -1354
- package/dist/generated/prisma/models.d.ts +0 -6
- package/dist/index.d.ts +0 -8
- package/dist/migrationHelper.d.ts +0 -2
- package/dist/prismaClient.d.ts +0 -7
- package/dist/sessionService.d.ts +0 -88
package/dist/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { SUPERVISOR_DB_VERSION, supervisorDbPath, supervisorDbUrl, } from "./dbConfig.js";
|
|
2
|
-
export { createPrismaClient } from "./prismaClient.js";
|
|
3
|
-
export { deploySupervisorMigrations } from "./migrationHelper.js";
|
|
4
|
-
export type { AuthResult, EnsureSuperAdminResult, SessionUser, } from "./sessionService.js";
|
|
5
|
-
export { authenticateAndCreateSession, createSupervisorDatabaseClient, deleteSession, ensureSuperAdmin, findSession, findUserByApiKey, handleResetPassword, lookupUsername, resetPassword, updateUserPassword, } from "./sessionService.js";
|
|
6
|
-
export * from "./generated/prisma/client.js";
|
|
7
|
-
export { PrismaClient } from "./generated/prisma/client.js";
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/prismaClient.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create a Prisma client with a dynamic database path
|
|
3
|
-
* @param databasePath - Absolute path to the SQLite database file
|
|
4
|
-
* @returns Configured PrismaClient instance
|
|
5
|
-
*/
|
|
6
|
-
export declare function createPrismaClient(databasePath: string): Promise<import("./generated/prisma/internal/class.js").PrismaClient<never, import("./generated/prisma/internal/prismaNamespace.js").GlobalOmitConfig | undefined, import("@prisma/client/runtime/client").DefaultArgs>>;
|
|
7
|
-
//# sourceMappingURL=prismaClient.d.ts.map
|
package/dist/sessionService.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
export interface SessionUser {
|
|
2
|
-
userId: number;
|
|
3
|
-
username: string;
|
|
4
|
-
passwordHash: string;
|
|
5
|
-
uuid: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Initialize supervisor sessions by connecting to supervisor.db.
|
|
9
|
-
* Idempotent — returns early if already initialized.
|
|
10
|
-
* No-ops gracefully if NAISYS_FOLDER is unset or the database doesn't exist.
|
|
11
|
-
*/
|
|
12
|
-
export declare function createSupervisorDatabaseClient(): Promise<boolean>;
|
|
13
|
-
/**
|
|
14
|
-
* Find a session user by session token hash. Returns null if not found or expired.
|
|
15
|
-
*/
|
|
16
|
-
export declare function findSession(tokenHash: string): Promise<SessionUser | null>;
|
|
17
|
-
/**
|
|
18
|
-
* Look up a session user by username.
|
|
19
|
-
*/
|
|
20
|
-
export declare function lookupUsername(username: string): Promise<SessionUser | null>;
|
|
21
|
-
/**
|
|
22
|
-
* Find a supervisor user by API key. Returns null if not found or DB not initialized.
|
|
23
|
-
*/
|
|
24
|
-
export declare function findUserByApiKey(apiKey: string): Promise<{
|
|
25
|
-
uuid: string;
|
|
26
|
-
username: string;
|
|
27
|
-
} | null>;
|
|
28
|
-
export interface AuthResult {
|
|
29
|
-
token: string;
|
|
30
|
-
user: SessionUser;
|
|
31
|
-
expiresAt: Date;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Authenticate a user by username/password and create a session.
|
|
35
|
-
* Returns null if credentials are invalid or DB is not initialized.
|
|
36
|
-
*/
|
|
37
|
-
export declare function authenticateAndCreateSession(username: string, password: string): Promise<AuthResult | null>;
|
|
38
|
-
/**
|
|
39
|
-
* Update a user's password hash. No-op if not initialized.
|
|
40
|
-
*/
|
|
41
|
-
export declare function updateUserPassword(username: string, passwordHash: string): Promise<void>;
|
|
42
|
-
/**
|
|
43
|
-
* Delete a session by token hash.
|
|
44
|
-
*/
|
|
45
|
-
export declare function deleteSession(tokenHash: string): Promise<void>;
|
|
46
|
-
export interface EnsureSuperAdminResult {
|
|
47
|
-
/** Whether the superadmin was newly created */
|
|
48
|
-
created: boolean;
|
|
49
|
-
/** The generated password (only set when created) */
|
|
50
|
-
generatedPassword?: string;
|
|
51
|
-
/** The superadmin user info */
|
|
52
|
-
user: {
|
|
53
|
-
uuid: string;
|
|
54
|
-
username: string;
|
|
55
|
-
passwordHash: string;
|
|
56
|
-
apiKey: string | null;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Ensure a "superadmin" user exists in the supervisor database.
|
|
61
|
-
* If already exists, returns it as-is. Otherwise creates with generated credentials.
|
|
62
|
-
*/
|
|
63
|
-
export declare function ensureSuperAdmin(): Promise<EnsureSuperAdminResult>;
|
|
64
|
-
/**
|
|
65
|
-
* CLI entry point for --reset-password. Initializes supervisor sessions,
|
|
66
|
-
* then runs the interactive password reset.
|
|
67
|
-
*/
|
|
68
|
-
export declare function handleResetPassword(options: {
|
|
69
|
-
findLocalUser: (username: string) => Promise<{
|
|
70
|
-
id: number;
|
|
71
|
-
username: string;
|
|
72
|
-
uuid: string;
|
|
73
|
-
} | null>;
|
|
74
|
-
updateLocalPassword: (userId: number, passwordHash: string) => Promise<void>;
|
|
75
|
-
username?: string;
|
|
76
|
-
password?: string;
|
|
77
|
-
}): Promise<void>;
|
|
78
|
-
/**
|
|
79
|
-
* CLI to reset a user's password. Updates both local DB (via callbacks) and
|
|
80
|
-
* the supervisor DB. If username/password are provided, skips interactive
|
|
81
|
-
* prompts.
|
|
82
|
-
*/
|
|
83
|
-
export declare function resetPassword(findLocalUser: (username: string) => Promise<{
|
|
84
|
-
id: number;
|
|
85
|
-
username: string;
|
|
86
|
-
uuid: string;
|
|
87
|
-
} | null>, updateLocalPassword: (userId: number, passwordHash: string) => Promise<void>, usernameArg?: string, passwordArg?: string): Promise<void>;
|
|
88
|
-
//# sourceMappingURL=sessionService.d.ts.map
|