prostgles-server 4.2.369 → 4.2.371

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.
Files changed (70) hide show
  1. package/dist/Auth/AuthHandler.d.ts +20 -4
  2. package/dist/Auth/AuthHandler.d.ts.map +1 -1
  3. package/dist/Auth/AuthHandler.js +24 -9
  4. package/dist/Auth/AuthHandler.js.map +1 -1
  5. package/dist/Auth/AuthTypes.d.ts +7 -2
  6. package/dist/Auth/AuthTypes.d.ts.map +1 -1
  7. package/dist/Auth/AuthTypes.js +3 -3
  8. package/dist/Auth/AuthTypes.js.map +1 -1
  9. package/dist/Auth/endpoints/setCatchAllRequestHandler.d.ts.map +1 -1
  10. package/dist/Auth/endpoints/setCatchAllRequestHandler.js +5 -4
  11. package/dist/Auth/endpoints/setCatchAllRequestHandler.js.map +1 -1
  12. package/dist/Auth/endpoints/setLoginRequestHandler.d.ts +1 -1
  13. package/dist/Auth/endpoints/setLoginRequestHandler.d.ts.map +1 -1
  14. package/dist/Auth/endpoints/setLoginRequestHandler.js +1 -1
  15. package/dist/Auth/endpoints/setLoginRequestHandler.js.map +1 -1
  16. package/dist/Auth/endpoints/setLogoutRequestHandler.d.ts.map +1 -1
  17. package/dist/Auth/endpoints/setLogoutRequestHandler.js +1 -2
  18. package/dist/Auth/endpoints/setLogoutRequestHandler.js.map +1 -1
  19. package/dist/Auth/endpoints/setMagicLinkOrOTPRequestHandler.d.ts.map +1 -1
  20. package/dist/Auth/endpoints/setMagicLinkOrOTPRequestHandler.js +4 -4
  21. package/dist/Auth/endpoints/setMagicLinkOrOTPRequestHandler.js.map +1 -1
  22. package/dist/Auth/endpoints/setOAuthRequestHandlers.js +2 -2
  23. package/dist/Auth/endpoints/setOAuthRequestHandlers.js.map +1 -1
  24. package/dist/Auth/endpoints/setRegisterRequestHandler.d.ts +2 -3
  25. package/dist/Auth/endpoints/setRegisterRequestHandler.d.ts.map +1 -1
  26. package/dist/Auth/endpoints/setRegisterRequestHandler.js +8 -4
  27. package/dist/Auth/endpoints/setRegisterRequestHandler.js.map +1 -1
  28. package/dist/Auth/getClientAuth.d.ts +1 -1
  29. package/dist/Auth/getClientAuth.d.ts.map +1 -1
  30. package/dist/Auth/getClientAuth.js +4 -6
  31. package/dist/Auth/getClientAuth.js.map +1 -1
  32. package/dist/Auth/login.d.ts.map +1 -1
  33. package/dist/Auth/login.js +6 -1
  34. package/dist/Auth/login.js.map +1 -1
  35. package/dist/Auth/setupAuthRoutes.d.ts.map +1 -1
  36. package/dist/Auth/setupAuthRoutes.js +1 -1
  37. package/dist/Auth/setupAuthRoutes.js.map +1 -1
  38. package/dist/Auth/utils/getReturnUrl.d.ts.map +1 -1
  39. package/dist/Auth/utils/getReturnUrl.js +3 -4
  40. package/dist/Auth/utils/getReturnUrl.js.map +1 -1
  41. package/dist/Auth/utils/setCookieAndGoToReturnURLIFSet.d.ts.map +1 -1
  42. package/dist/Auth/utils/setCookieAndGoToReturnURLIFSet.js +2 -3
  43. package/dist/Auth/utils/setCookieAndGoToReturnURLIFSet.js.map +1 -1
  44. package/dist/DboBuilder/ViewHandler/ViewHandler.d.ts +1 -1
  45. package/dist/Filtering.d.ts +2 -2
  46. package/dist/PublishParser/publishTypesAndUtils.d.ts.map +1 -1
  47. package/dist/PublishParser/publishTypesAndUtils.js.map +1 -1
  48. package/dist/WebsocketAPI/getClientHandlers.d.ts +3 -3
  49. package/dist/WebsocketAPI/getClientHandlers.d.ts.map +1 -1
  50. package/dist/WebsocketAPI/getClientHandlers.js.map +1 -1
  51. package/dist/runClientRequest.d.ts.map +1 -1
  52. package/dist/runClientRequest.js +2 -1
  53. package/dist/runClientRequest.js.map +1 -1
  54. package/lib/Auth/AuthHandler.ts +29 -9
  55. package/lib/Auth/AuthTypes.ts +19 -6
  56. package/lib/Auth/endpoints/setCatchAllRequestHandler.ts +6 -7
  57. package/lib/Auth/endpoints/setLoginRequestHandler.ts +5 -5
  58. package/lib/Auth/endpoints/setLogoutRequestHandler.ts +2 -3
  59. package/lib/Auth/endpoints/setMagicLinkOrOTPRequestHandler.ts +7 -13
  60. package/lib/Auth/endpoints/setOAuthRequestHandlers.ts +3 -3
  61. package/lib/Auth/endpoints/setRegisterRequestHandler.ts +12 -7
  62. package/lib/Auth/getClientAuth.ts +9 -19
  63. package/lib/Auth/login.ts +10 -4
  64. package/lib/Auth/setupAuthRoutes.ts +2 -2
  65. package/lib/Auth/utils/getReturnUrl.ts +4 -5
  66. package/lib/Auth/utils/setCookieAndGoToReturnURLIFSet.ts +3 -11
  67. package/lib/PublishParser/publishTypesAndUtils.ts +12 -7
  68. package/lib/WebsocketAPI/getClientHandlers.ts +5 -5
  69. package/lib/runClientRequest.ts +10 -2
  70. package/package.json +1 -1
@@ -1,18 +1,12 @@
1
1
  import type e from "express";
2
2
  import { type Response } from "express";
3
+ import type { AuthResponse } from "prostgles-types";
3
4
  import type { DBOFullyTyped } from "../../DBSchemaBuilder/DBSchemaBuilder";
4
- import type {
5
- AuthHandler} from "../AuthHandler";
6
- import {
7
- AUTH_ROUTES_AND_PARAMS,
8
- getClientRequestIPsInfo,
9
- HTTP_FAIL_CODES,
10
- HTTP_SUCCESS_CODES,
11
- } from "../AuthHandler";
5
+ import type { AuthHandler } from "../AuthHandler";
6
+ import { getClientRequestIPsInfo, HTTP_FAIL_CODES, HTTP_SUCCESS_CODES } from "../AuthHandler";
12
7
  import type { ExpressReq, LoginSignupConfig, MagicLinkOrOTPData, SessionUser } from "../AuthTypes";
13
8
  import { throttledAuthCall } from "../utils/throttledReject";
14
9
  import type { LoginResponse } from "./setLoginRequestHandler";
15
- import type { AuthResponse } from "prostgles-types";
16
10
 
17
11
  type MagicLinkResponseHandler = Response<
18
12
  | LoginResponse
@@ -56,24 +50,24 @@ export function setMagicLinkOrOTPRequestHandler(
56
50
  }
57
51
  };
58
52
 
59
- app.get(AUTH_ROUTES_AND_PARAMS.magicLinkWithId, (req, res: MagicLinkResponseHandler) => {
53
+ app.get(this.authRoutes.magicLinkWithId, (req, res: MagicLinkResponseHandler) => {
60
54
  const { id } = req.params;
61
55
 
62
56
  if (typeof id !== "string" || !id) {
63
- res
57
+ return res
64
58
  .status(HTTP_FAIL_CODES.BAD_REQUEST)
65
59
  .json({ success: false, code: "invalid-magic-link", message: "Invalid magic link" });
66
60
  }
67
61
  return handler(req, res, { type: "magic-link", id, returnToken: false });
68
62
  });
69
63
 
70
- app.get(AUTH_ROUTES_AND_PARAMS.magicLinks, (req, res: MagicLinkResponseHandler) => {
64
+ app.get(this.authRoutes.magicLinks, (req, res: MagicLinkResponseHandler) => {
71
65
  const data = parseMagicLinkOrOTPData(res, req.query);
72
66
  if (!data) return;
73
67
  return handler(req, res, data);
74
68
  });
75
69
 
76
- app.post(AUTH_ROUTES_AND_PARAMS.magicLinks, (req, res: MagicLinkResponseHandler) => {
70
+ app.post(this.authRoutes.magicLinks, (req, res: MagicLinkResponseHandler) => {
77
71
  const data = parseMagicLinkOrOTPData(res, req.body);
78
72
  if (!data) return;
79
73
  return handler(req, res, data);
@@ -8,7 +8,7 @@ import { getObjectEntries, isEmpty } from "prostgles-types";
8
8
  import { getErrorAsObject } from "../../DboBuilder/dboBuilderUtils";
9
9
  import type { DBOFullyTyped } from "../../DBSchemaBuilder/DBSchemaBuilder";
10
10
  import type { AuthHandler } from "../AuthHandler";
11
- import { AUTH_ROUTES_AND_PARAMS, HTTP_FAIL_CODES } from "../AuthHandler";
11
+ import { HTTP_FAIL_CODES } from "../AuthHandler";
12
12
  import type { AuthProviderUserData, LoginWithOAuthConfig } from "../AuthTypes";
13
13
  import { getClientRequestIPsInfo } from "../utils/getClientRequestIPsInfo";
14
14
  import { upsertNamedExpressMiddleware } from "../utils/upsertNamedExpressMiddleware";
@@ -40,7 +40,7 @@ export function setOAuthRequestHandlers(
40
40
  : providerName === "facebook" ? FacebookStrategy
41
41
  : providerName === "customOAuth" ? OAuth2Strategy
42
42
  : MicrosoftStrategy;
43
- const callbackPath = `${AUTH_ROUTES_AND_PARAMS.loginWithProvider}/${providerName}/callback`;
43
+ const callbackPath = `${this.authRoutes.loginWithProvider}/${providerName}/callback`;
44
44
  passport.use(
45
45
  new (strategy as typeof GoogleStrategy)(
46
46
  {
@@ -54,7 +54,7 @@ export function setOAuthRequestHandlers(
54
54
  )
55
55
  );
56
56
 
57
- const authPath = `${AUTH_ROUTES_AND_PARAMS.loginWithProvider}/${providerName}`;
57
+ const authPath = `${this.authRoutes.loginWithProvider}/${providerName}`;
58
58
  app.get(authPath, passport.authenticate(providerName, authOpts ?? {}));
59
59
 
60
60
  app.get(callbackPath, async (req, res: LoginResponseHandler) => {
@@ -1,7 +1,7 @@
1
- import type { Request, Response } from "express";
2
1
  import type e from "express";
2
+ import type { Request, Response } from "express";
3
3
  import type { AuthResponse } from "prostgles-types";
4
- import { AUTH_ROUTES_AND_PARAMS, HTTP_FAIL_CODES } from "../AuthHandler";
4
+ import { HTTP_FAIL_CODES, type AuthHandler } from "../AuthHandler";
5
5
  import { getMagicLinkUrl, type SignupWithEmail } from "../AuthTypes";
6
6
  import { getClientRequestIPsInfo } from "../utils/getClientRequestIPsInfo";
7
7
  import { parseLoginData } from "./setLoginRequestHandler";
@@ -14,10 +14,11 @@ type ReturnType =
14
14
 
15
15
  type RegisterResponseHandler = Response<ReturnType>;
16
16
 
17
- export const setRegisterRequestHandler = (
17
+ export function setRegisterRequestHandler(
18
+ this: AuthHandler,
18
19
  { onRegister, minPasswordLength = 8, requirePassword }: SignupWithEmail,
19
20
  app: e.Express
20
- ) => {
21
+ ) {
21
22
  const registerRequestHandler = async (req: Request, res: RegisterResponseHandler) => {
22
23
  const [error, data] = parseLoginData(req.body);
23
24
  if (error || !data) {
@@ -51,7 +52,11 @@ export const setRegisterRequestHandler = (
51
52
  email: username,
52
53
  password,
53
54
  getConfirmationUrl: ({ code, websiteUrl }) =>
54
- getMagicLinkUrl(websiteUrl, { type: "otp", code, email: username, returnToken: false }),
55
+ getMagicLinkUrl({
56
+ loginSignupConfig: this.opts.loginSignupConfig,
57
+ websiteUrl,
58
+ data: { type: "otp", code, email: username, returnToken: false },
59
+ }),
55
60
  clientInfo,
56
61
  req,
57
62
  });
@@ -66,5 +71,5 @@ export const setRegisterRequestHandler = (
66
71
  }
67
72
  };
68
73
 
69
- app.post(AUTH_ROUTES_AND_PARAMS.emailRegistration, registerRequestHandler);
70
- };
74
+ app.post(this.authRoutes.emailRegistration, registerRequestHandler);
75
+ }
@@ -1,22 +1,12 @@
1
1
  import type {
2
2
  AuthGuardLocation,
3
3
  AuthGuardLocationResponse,
4
- AuthSocketSchema} from "prostgles-types";
5
- import {
6
- CHANNELS,
7
- getObjectEntries,
8
- isEmpty,
9
- isObject,
4
+ AuthSocketSchema,
10
5
  } from "prostgles-types";
11
- import type {
12
- AuthClientRequest,
13
- LoginWithOAuthConfig,
14
- AuthResultWithSID} from "./AuthTypes";
15
- import {
16
- type AuthResult,
17
- } from "./AuthTypes";
6
+ import { CHANNELS, getObjectEntries, isEmpty, isObject } from "prostgles-types";
18
7
  import type { AuthHandler } from "./AuthHandler";
19
- import { AUTH_ROUTES_AND_PARAMS } from "./AuthHandler";
8
+ import type { AuthClientRequest, AuthConfig, AuthResultWithSID } from "./AuthTypes";
9
+ import { type AuthResult } from "./AuthTypes";
20
10
 
21
11
  export async function getClientAuth(
22
12
  this: AuthHandler,
@@ -89,11 +79,10 @@ export async function getClientAuth(
89
79
  return userData;
90
80
  }
91
81
  const auth: AuthSocketSchema = {
92
- //@ts-ignore
93
- providers: getOAuthProviders(loginWithOAuth),
82
+ providers: getOAuthProviders(this, loginWithOAuth),
94
83
  signupWithEmailAndPassword: signupWithEmail && {
95
84
  minPasswordLength: signupWithEmail.minPasswordLength ?? 8,
96
- url: AUTH_ROUTES_AND_PARAMS.emailRegistration,
85
+ url: this.authRoutes.emailRegistration,
97
86
  },
98
87
  preferredLogin: userData.preferredLogin,
99
88
  user: userData.clientUser,
@@ -104,7 +93,8 @@ export async function getClientAuth(
104
93
  }
105
94
 
106
95
  const getOAuthProviders = (
107
- loginWithOAuth: LoginWithOAuthConfig<any> | undefined
96
+ authHandler: AuthHandler,
97
+ loginWithOAuth: NonNullable<AuthConfig["loginSignupConfig"]>["loginWithOAuth"]
108
98
  ): AuthSocketSchema["providers"] | undefined => {
109
99
  if (!loginWithOAuth) return undefined;
110
100
  const { OAuthProviders } = loginWithOAuth;
@@ -114,7 +104,7 @@ const getOAuthProviders = (
114
104
  getObjectEntries(OAuthProviders).forEach(([providerName, config]) => {
115
105
  if (config?.clientID) {
116
106
  result[providerName] = {
117
- url: `${AUTH_ROUTES_AND_PARAMS.loginWithProvider}/${providerName}`,
107
+ url: `${authHandler.authRoutes.loginWithProvider}/${providerName}`,
118
108
  ...(providerName === "customOAuth" && {
119
109
  displayName: OAuthProviders.customOAuth?.displayName,
120
110
  displayIconPath: OAuthProviders.customOAuth?.displayIconPath,
package/lib/Auth/login.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import type { DBOFullyTyped } from "../DBSchemaBuilder/DBSchemaBuilder";
2
- import type { AuthHandler} from "./AuthHandler";
2
+ import type { AuthHandler } from "./AuthHandler";
3
3
  import { getClientRequestIPsInfo, HTTP_FAIL_CODES } from "./AuthHandler";
4
- import type { ExpressReq, LoginParams} from "./AuthTypes";
5
- import { type BasicSession } from "./AuthTypes";
4
+ import type { ExpressReq, LoginParams } from "./AuthTypes";
5
+ import { getMagicLinkUrl, type BasicSession } from "./AuthTypes";
6
6
  import type { LoginResponseHandler } from "./endpoints/setLoginRequestHandler";
7
7
  import { throttledAuthCall } from "./utils/throttledReject";
8
8
 
@@ -25,7 +25,13 @@ export async function login(
25
25
  loginParams,
26
26
  this.dbo as DBOFullyTyped,
27
27
  this.db,
28
- getClientRequestIPsInfo({ httpReq: req })
28
+ getClientRequestIPsInfo({ httpReq: req }),
29
+ (data, websiteUrl) =>
30
+ getMagicLinkUrl({
31
+ loginSignupConfig: this.opts.loginSignupConfig,
32
+ websiteUrl,
33
+ data,
34
+ })
29
35
  );
30
36
 
31
37
  if (typeof result === "string" || !result.session) {
@@ -1,5 +1,5 @@
1
1
  import type { RequestHandler } from "express";
2
- import type { AuthHandler} from "./AuthHandler";
2
+ import type { AuthHandler } from "./AuthHandler";
3
3
  import { getClientRequestIPsInfo } from "./AuthHandler";
4
4
  import { setCatchAllRequestHandler } from "./endpoints/setCatchAllRequestHandler";
5
5
  import { setLoginRequestHandler } from "./endpoints/setLoginRequestHandler";
@@ -31,7 +31,7 @@ export function setupAuthRoutes(this: AuthHandler) {
31
31
  }
32
32
 
33
33
  if (signupWithEmail) {
34
- setRegisterRequestHandler(signupWithEmail, app);
34
+ setRegisterRequestHandler.bind(this)(signupWithEmail, app);
35
35
  }
36
36
 
37
37
  if (loginWithOAuth) {
@@ -1,13 +1,12 @@
1
- import { AUTH_ROUTES_AND_PARAMS } from "../AuthHandler";
1
+ import { AUTH_RETURN_URL_PARAM_NAME } from "../AuthHandler";
2
2
  import type { ExpressReq } from "../AuthTypes";
3
3
  import { getSafeReturnURL } from "./getSafeReturnURL";
4
4
 
5
5
  export const getReturnUrl = (req: ExpressReq) => {
6
- const { returnUrlParamName } = AUTH_ROUTES_AND_PARAMS;
7
- if (req.query[returnUrlParamName]) {
8
- const returnURL = decodeURIComponent(req.query[returnUrlParamName] as string);
6
+ if (req.query[AUTH_RETURN_URL_PARAM_NAME]) {
7
+ const returnURL = decodeURIComponent(req.query[AUTH_RETURN_URL_PARAM_NAME] as string);
9
8
 
10
- return getSafeReturnURL(returnURL, returnUrlParamName);
9
+ return getSafeReturnURL(returnURL, AUTH_RETURN_URL_PARAM_NAME);
11
10
  }
12
11
  return null;
13
12
  };
@@ -1,4 +1,4 @@
1
- import { AUTH_ROUTES_AND_PARAMS, HTTP_FAIL_CODES, type AuthHandler } from "../AuthHandler";
1
+ import { AUTH_RETURN_URL_PARAM_NAME, HTTP_FAIL_CODES, type AuthHandler } from "../AuthHandler";
2
2
  import type { ExpressReq } from "../AuthTypes";
3
3
  import type { LoginResponseHandler } from "../endpoints/setLoginRequestHandler";
4
4
  import { getBasicSessionErrorCode } from "../login";
@@ -63,16 +63,8 @@ export function setCookieAndGoToReturnURLIFSet(
63
63
  if (safeReturnUrl) {
64
64
  return res.redirect(safeReturnUrl);
65
65
  }
66
- const safeOriginalUrl = getSafeReturnURL(
67
- req.originalUrl,
68
- AUTH_ROUTES_AND_PARAMS.returnUrlParamName
69
- );
70
- if (
71
- safeOriginalUrl &&
72
- ![AUTH_ROUTES_AND_PARAMS.magicLinks].some((authRoute) =>
73
- matchesRoute(authRoute, safeOriginalUrl)
74
- )
75
- ) {
66
+ const safeOriginalUrl = getSafeReturnURL(req.originalUrl, AUTH_RETURN_URL_PARAM_NAME);
67
+ if (safeOriginalUrl && !matchesRoute(this.authRoutes.magicLinks, safeOriginalUrl)) {
76
68
  return res.redirect(safeOriginalUrl);
77
69
  }
78
70
  return res.redirect("/");
@@ -1,9 +1,11 @@
1
- import {
2
- RULE_METHODS,
3
- type MethodFullDef,
4
- } from "prostgles-types";
1
+ import { RULE_METHODS, type MethodFullDef } from "prostgles-types";
5
2
  import type { DBOFullyTyped, PublishFullyTyped } from "../DBSchemaBuilder/DBSchemaBuilder";
6
- import type { CommonTableRules, Filter, LocalParams, TableOrViewInfo } from "../DboBuilder/DboBuilder";
3
+ import type {
4
+ CommonTableRules,
5
+ Filter,
6
+ LocalParams,
7
+ TableOrViewInfo,
8
+ } from "../DboBuilder/DboBuilder";
7
9
  import type { DB, DBHandlerServer } from "../Prostgles";
8
10
 
9
11
  export type PublishMethods<S = void, SUser extends SessionUser = SessionUser> = (
@@ -143,12 +145,15 @@ export const RULE_TO_METHODS = [
143
145
  },
144
146
  ] as const;
145
147
 
146
- import type { FieldFilter, SelectParams ,
148
+ import type {
149
+ FieldFilter,
150
+ SelectParams,
147
151
  AnyObject,
148
152
  DBSchema,
149
153
  FullFilter,
150
154
  Method,
151
- TableInfo} from "prostgles-types";
155
+ TableInfo,
156
+ } from "prostgles-types";
152
157
  import type { AuthClientRequest, SessionUser } from "../Auth/AuthTypes";
153
158
  import type { TableSchemaColumn } from "../DboBuilder/DboBuilderTypes";
154
159
  import type { ClientHandlers } from "../WebsocketAPI/getClientHandlers";
@@ -14,14 +14,15 @@ import { runClientMethod, runClientRequest, runClientSqlRequest } from "../runCl
14
14
  import { getClientSchema } from "./getClientSchema";
15
15
  import type { PermissionScope } from "../PublishParser/publishTypesAndUtils";
16
16
 
17
+ export type ClientHandlers<S = void> = {
18
+ clientDb: DBOFullyTyped<S, false>;
19
+ clientMethods: Record<string, Method>;
20
+ };
17
21
  export const getClientHandlers = async <S = void>(
18
22
  prostgles: Prostgles,
19
23
  clientReq: AuthClientRequest,
20
24
  scope: PermissionScope | undefined
21
- ): Promise<{
22
- clientDb: DBOFullyTyped<S, false>;
23
- clientMethods: Record<string, Method>;
24
- }> => {
25
+ ): Promise<ClientHandlers> => {
25
26
  const clientSchema =
26
27
  clientReq.socket?.prostgles ?? (await getClientSchema.bind(prostgles)(clientReq, scope));
27
28
  const sql: SQLHandler | undefined = ((query: string, params?: unknown, options?: SQLOptions) =>
@@ -82,7 +83,6 @@ export const getClientHandlers = async <S = void>(
82
83
 
83
84
  return { clientDb, clientMethods };
84
85
  };
85
- export type ClientHandlers<S = void> = Awaited<ReturnType<typeof getClientHandlers<S>>>;
86
86
 
87
87
  const viewMethods = getKeys({
88
88
  count: 1,
@@ -11,7 +11,11 @@ import type { TableHandler as TableHandlerServer } from "./DboBuilder/TableHandl
11
11
  import { parseFieldFilter } from "./DboBuilder/ViewHandler/parseFieldFilter";
12
12
  import { canRunSQL } from "./DboBuilder/runSQL";
13
13
  import type { Prostgles } from "./Prostgles";
14
- import type { ParsedTableRule } from "./PublishParser/publishTypesAndUtils";
14
+ import type {
15
+ Awaitable,
16
+ ParsedTableRule,
17
+ PublishParams,
18
+ } from "./PublishParser/publishTypesAndUtils";
15
19
  import { type PermissionScope } from "./PublishParser/publishTypesAndUtils";
16
20
 
17
21
  const TABLE_METHODS = {
@@ -162,7 +166,11 @@ export const clientCanRunSqlRequest = async function (
162
166
  throw "authHandler missing";
163
167
  }
164
168
  const publishParams = await this.publishParser?.getPublishParams(clientReq, undefined);
165
- const allowedToRunSQL = publishParams && (await this.opts.publishRawSQL?.(publishParams));
169
+ const allowedToRunSQL =
170
+ publishParams &&
171
+ (await (
172
+ this.opts.publishRawSQL as undefined | ((params: PublishParams) => Awaitable<boolean | "*">)
173
+ )?.(publishParams));
166
174
  return allowedToRunSQL === true || allowedToRunSQL === "*";
167
175
  };
168
176
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prostgles-server",
3
- "version": "4.2.369",
3
+ "version": "4.2.371",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",