diff --git a/lib/Auth/AuthTypes.ts b/lib/Auth/AuthTypes.ts index debc1c9d..3449b617 100644 --- a/lib/Auth/AuthTypes.ts +++ b/lib/Auth/AuthTypes.ts @@ -234,7 +234,6 @@ export type Auth = { */ getUser: (sid: string | undefined, dbo: DBOFullyTyped, db: DB, client: AuthClientRequest & LoginClientInfo) => Awaitable>; - register?: (params: AnyObject, dbo: DBOFullyTyped, db: DB) => Awaitable | BasicSession; login?: (params: AnyObject, dbo: DBOFullyTyped, db: DB, client: LoginClientInfo) => Awaitable | BasicSession; logout?: (sid: string | undefined, dbo: DBOFullyTyped, db: DB) => Awaitable; diff --git a/lib/initProstgles.ts b/lib/initProstgles.ts index 1f49d372..de406a3b 100644 --- a/lib/initProstgles.ts +++ b/lib/initProstgles.ts @@ -51,7 +51,7 @@ export type InitResult = { * Generated database public schema TS types for all tables and views */ getTSSchema: () => string; - update: (newOpts: Pick) => Promise; + update: (newOpts: Pick) => Promise; restart: () => Promise; } @@ -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"}); } diff --git a/package-lock.json b/package-lock.json index fb69a633..34b302f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "prostgles-server", - "version": "4.2.135", + "version": "4.2.136", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "prostgles-server", - "version": "4.2.135", + "version": "4.2.136", "license": "MIT", "dependencies": { "body-parser": "^1.20.3", diff --git a/package.json b/package.json index a0e61196..b66b207e 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/tests/server/package-lock.json b/tests/server/package-lock.json index a3187fb9..45ea36fd 100644 --- a/tests/server/package-lock.json +++ b/tests/server/package-lock.json @@ -21,7 +21,7 @@ }, "../..": { "name": "prostgles-server", - "version": "4.2.135", + "version": "4.2.136", "license": "MIT", "dependencies": { "body-parser": "^1.20.3",