From 928f8305ff2639454a466534c9d0e56ff2259c18 Mon Sep 17 00:00:00 2001 From: prostgles Date: Sun, 24 Nov 2024 22:04:53 +0200 Subject: [PATCH] fix auth providers --- lib/initProstgles.ts | 14 +++++++++----- package-lock.json | 4 ++-- package.json | 2 +- tests/server/package-lock.json | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/initProstgles.ts b/lib/initProstgles.ts index 632cb767..a2de9805 100644 --- a/lib/initProstgles.ts +++ b/lib/initProstgles.ts @@ -1,6 +1,6 @@ import * as pgPromise from "pg-promise"; import pg from "pg-promise/typescript/pg-subset"; -import { isEmpty } from "prostgles-types"; +import { getKeys, isEmpty } from "prostgles-types"; import { AuthHandler } from "./Auth/AuthHandler"; import { DBEventsManager } from "./DBEventsManager"; import { DBOFullyTyped } from "./DBSchemaBuilder"; @@ -58,6 +58,7 @@ export type InitResult = { getTSSchema: () => string; update: (newOpts: UpdateableOptions) => Promise; restart: () => Promise; + options: ProstglesInitOptions; } export const initProstgles = async function(this: Prostgles, onReady: OnReadyCallbackBasic, reason: OnInitReason): Promise { @@ -165,22 +166,25 @@ export const initProstgles = async function(this: Prostgles, onReady: OnReadyCal pgp, io: this.opts.io, getTSSchema: this.getTSFileContent, + options: this.opts, update: async (newOpts) => { + + getKeys(newOpts).forEach(k => { + //@ts-ignore + this.opts[k] = newOpts[k]; + }); + if("fileTable" in newOpts){ - this.opts.fileTable = newOpts.fileTable; await this.initFileTable(); } if("restApi" in newOpts){ - this.opts.restApi = newOpts.restApi; await this.initRestApi(); } if("tableConfig" in newOpts){ - this.opts.tableConfig = newOpts.tableConfig; await this.initTableConfig({ type: "prgl.update", newOpts }); await this.refreshDBO(); } if("schema" in newOpts){ - this.opts.schema = newOpts.schema; await this.initTableConfig({ type: "prgl.update", newOpts }); await this.refreshDBO(); } diff --git a/package-lock.json b/package-lock.json index e022d545..db067629 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "prostgles-server", - "version": "4.2.138", + "version": "4.2.139", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "prostgles-server", - "version": "4.2.138", + "version": "4.2.139", "license": "MIT", "dependencies": { "body-parser": "^1.20.3", diff --git a/package.json b/package.json index 52db54d0..f14a5f55 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prostgles-server", - "version": "4.2.138", + "version": "4.2.139", "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 2e6b3402..da705186 100644 --- a/tests/server/package-lock.json +++ b/tests/server/package-lock.json @@ -21,7 +21,7 @@ }, "../..": { "name": "prostgles-server", - "version": "4.2.138", + "version": "4.2.139", "license": "MIT", "dependencies": { "body-parser": "^1.20.3",