Skip to content

Commit

Permalink
add auth to hot reload
Browse files Browse the repository at this point in the history
  • Loading branch information
prostgles committed Nov 24, 2024
1 parent 4970784 commit da282da
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
1 change: 0 additions & 1 deletion lib/Auth/AuthTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ export type Auth<S = void, SUser extends SessionUser = SessionUser> = {
*/
getUser: (sid: string | undefined, dbo: DBOFullyTyped<S>, db: DB, client: AuthClientRequest & LoginClientInfo) => Awaitable<AuthResult<SUser>>;

register?: (params: AnyObject, dbo: DBOFullyTyped<S>, db: DB) => Awaitable<BasicSession> | BasicSession;
login?: (params: AnyObject, dbo: DBOFullyTyped<S>, db: DB, client: LoginClientInfo) => Awaitable<BasicSession> | BasicSession;
logout?: (sid: string | undefined, dbo: DBOFullyTyped<S>, db: DB) => Awaitable<any>;

Expand Down
7 changes: 6 additions & 1 deletion lib/initProstgles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export type InitResult = {
* Generated database public schema TS types for all tables and views
*/
getTSSchema: () => string;
update: (newOpts: Pick<ProstglesInitOptions, "fileTable" | "restApi" | "tableConfig" | "schema">) => Promise<void>;
update: (newOpts: Pick<ProstglesInitOptions, "fileTable" | "restApi" | "tableConfig" | "schema" | "auth">) => Promise<void>;
restart: () => Promise<InitResult>;
}

Expand Down Expand Up @@ -179,6 +179,11 @@ export const initProstgles = async function(this: Prostgles, onReady: OnReadyCal
await this.initTableConfig({ type: "prgl.update" });
await this.refreshDBO();
}
if("auth" in newOpts){
this.authHandler?.destroy();
this.authHandler = new AuthHandler(this as any);
await this.authHandler.init();
}
if(!isEmpty(newOpts)){
await this.init(onReady, { type: "prgl.update"});
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prostgles-server",
"version": "4.2.135",
"version": "4.2.136",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion tests/server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit da282da

Please sign in to comment.