prostgles-server 4.2.188 → 4.2.190
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/Auth/AuthHandler.d.ts +2 -0
- package/dist/Auth/AuthHandler.d.ts.map +1 -1
- package/dist/Auth/AuthHandler.js +25 -21
- package/dist/Auth/AuthHandler.js.map +1 -1
- package/dist/Auth/AuthTypes.d.ts +5 -14
- package/dist/Auth/AuthTypes.d.ts.map +1 -1
- package/dist/Auth/endpoints/getRegisterRequestHandler.d.ts +1 -1
- package/dist/Auth/endpoints/getRegisterRequestHandler.d.ts.map +1 -1
- package/dist/Auth/endpoints/getRegisterRequestHandler.js +4 -1
- package/dist/Auth/endpoints/getRegisterRequestHandler.js.map +1 -1
- package/dist/DBSchemaBuilder.d.ts +2 -2
- package/dist/DBSchemaBuilder.d.ts.map +1 -1
- package/dist/DBSchemaBuilder.js +5 -18
- package/dist/DBSchemaBuilder.js.map +1 -1
- package/dist/PublishParser/PublishParser.d.ts +4 -4
- package/dist/PublishParser/PublishParser.d.ts.map +1 -1
- package/dist/PublishParser/PublishParser.js +1 -3
- package/dist/PublishParser/PublishParser.js.map +1 -1
- package/dist/PublishParser/getSchemaFromPublish.js +1 -1
- package/dist/PublishParser/getSchemaFromPublish.js.map +1 -1
- package/dist/PublishParser/getTableRulesWithoutFileTable.d.ts.map +1 -1
- package/dist/PublishParser/getTableRulesWithoutFileTable.js +2 -5
- package/dist/PublishParser/getTableRulesWithoutFileTable.js.map +1 -1
- package/dist/PublishParser/publishTypesAndUtils.d.ts +2 -1
- package/dist/PublishParser/publishTypesAndUtils.d.ts.map +1 -1
- package/dist/PublishParser/publishTypesAndUtils.js.map +1 -1
- package/lib/Auth/AuthHandler.ts +25 -26
- package/lib/Auth/AuthTypes.ts +6 -7
- package/lib/Auth/endpoints/getRegisterRequestHandler.ts +7 -2
- package/lib/DBSchemaBuilder.ts +28 -66
- package/lib/PublishParser/PublishParser.ts +8 -5
- package/lib/PublishParser/getSchemaFromPublish.ts +1 -1
- package/lib/PublishParser/getTableRulesWithoutFileTable.ts +2 -5
- package/lib/PublishParser/publishTypesAndUtils.ts +24 -69
- package/package.json +2 -2
- package/tsconfig.json +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publishTypesAndUtils.d.ts","sourceRoot":"","sources":["../../lib/PublishParser/publishTypesAndUtils.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"publishTypesAndUtils.d.ts","sourceRoot":"","sources":["../../lib/PublishParser/publishTypesAndUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAgB,MAAM,iBAAiB,CAAC;AACxF,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EACL,gBAAgB,EAChB,MAAM,EACN,WAAW,EACX,YAAY,EACZ,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,EAAE,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,SAAS,WAAW,GAAG,WAAW,IAAI,CAC9E,MAAM,EAAE,aAAa,CAAC,CAAC,EAAE,KAAK,CAAC,KAC5B;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAAC;AAE3E,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAE1C,KAAK,OAAO,GAAG;IACb,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,OAAO,CAAC,EAAE,GAAG,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,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","sourceRoot":"","sources":["../../lib/PublishParser/publishTypesAndUtils.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"publishTypesAndUtils.js","sourceRoot":"","sources":["../../lib/PublishParser/publishTypesAndUtils.ts"],"names":[],"mappings":";;;AAAA,qDAAwF;AAgC3E,QAAA,eAAe,GAAG;IAC7B;QACE,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,QAAQ;QACjB,OAAO,EAAE,8BAAY,CAAC,UAAU;QAChC,SAAS,EAAE,IAAI;QACf,cAAc,EAAE,EAAE;QAClB,UAAU,EAAE,KAAK;QACjB,IAAI,EAAE,qCAAqC;KAC5C;IACD;QACE,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,QAAQ;QACjB,OAAO,EAAE,8BAAY,CAAC,OAAO;QAC7B,SAAS,EAAE,IAAI;QACf,cAAc,EAAE,EAAE;QAClB,UAAU,EAAE,KAAK;QACjB,IAAI,EAAE,qCAAqC;KAC5C;IACD;QACE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,QAAQ;QACjB,OAAO,EAAE,8BAAY,CAAC,MAAM;QAC5B,SAAS,EAAc,EAAE,MAAM,EAAE,GAAG,EAAE;QACtC,UAAU,EAAE,IAAI;QAChB,cAAc,EAAE;YACd,WAAW,EAAE,CAAC;YACd,MAAM,EAAE,CAAC;YACT,UAAU,EAAE,CAAC;YACb,YAAY,EAAE,CAAC;YACf,WAAW,EAAE,CAAC;YACd,eAAe,EAAE,CAAC;YAClB,QAAQ,EAAE,CAAC;YACX,oBAAoB,EAAE,CAAC;SACc;QACvC,IAAI,EAAE,6DAA6D;KACpE;IACD;QACE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,QAAQ;QACjB,OAAO,EAAE,8BAAY,CAAC,MAAM;QAC5B,SAAS,EAAc;YACrB,MAAM,EAAE,GAAG;YACX,YAAY,EAAE,GAAG;YACjB,eAAe,EAAE,GAAG;SACrB;QACD,UAAU,EAAE,IAAI;QAChB,cAA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SACwB;QACrC,IAAI,EAAE,uEAAuE;KAC9E;IACD;QACE,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,QAAQ;QACjB,OAAO,EAAE,8BAAY,CAAC,SAAS;QAC/B,SAAS,EAAiB,EAAE,QAAQ,EAAE,CAAC,EAAE;QACzC,UAAU,EAAE,KAAK;QACjB,cAAc,EAAE,EAAE,QAAQ,EAAE,CAAC,EAA2C;QACxE,IAAI,EAAE,kHAAkH;KACzH;CACO,CAAC"}
|
package/lib/Auth/AuthHandler.ts
CHANGED
|
@@ -24,6 +24,7 @@ import { setupAuthRoutes } from "./setupAuthRoutes";
|
|
|
24
24
|
import { getClientRequestIPsInfo } from "./utils/getClientRequestIPsInfo";
|
|
25
25
|
import { getReturnUrl } from "./utils/getReturnUrl";
|
|
26
26
|
|
|
27
|
+
export { getClientRequestIPsInfo };
|
|
27
28
|
export const HTTP_FAIL_CODES = {
|
|
28
29
|
UNAUTHORIZED: 401,
|
|
29
30
|
NOT_FOUND: 404,
|
|
@@ -229,33 +230,27 @@ export class AuthHandler {
|
|
|
229
230
|
return this.throttledFunc(async () => {
|
|
230
231
|
const result = await this.opts.login?.(params, this.dbo as DBOFullyTyped, this.db, client);
|
|
231
232
|
|
|
232
|
-
const withServerError = (msg: string): LoginResponse => ({
|
|
233
|
-
response: {
|
|
234
|
-
success: false,
|
|
235
|
-
code: "something-went-wrong",
|
|
236
|
-
message: msg,
|
|
237
|
-
},
|
|
238
|
-
});
|
|
239
233
|
if (!result) {
|
|
240
|
-
return
|
|
241
|
-
"Bad login result type. \nExpecting: undefined | null | { sid: string; expires: number }"
|
|
242
|
-
);
|
|
234
|
+
return "server-error";
|
|
243
235
|
}
|
|
244
|
-
if (result
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
236
|
+
if (typeof result === "string") return result;
|
|
237
|
+
|
|
238
|
+
const { sid, expires } = result.session;
|
|
239
|
+
if (!sid) {
|
|
240
|
+
// return withServerError("Invalid sid");
|
|
241
|
+
return "server-error";
|
|
242
|
+
}
|
|
243
|
+
if (sid && (typeof sid !== "string" || typeof expires !== "number")) {
|
|
244
|
+
// return withServerError(
|
|
245
|
+
// "Bad login result type. \nExpecting: undefined | null | { sid: string; expires: number }"
|
|
246
|
+
// );
|
|
247
|
+
return "server-error";
|
|
248
|
+
}
|
|
249
|
+
if (expires < Date.now()) {
|
|
250
|
+
// return withServerError(
|
|
251
|
+
// "auth.login() is returning an expired session. Can only login with a session.expires greater than Date.now()"
|
|
252
|
+
// );
|
|
253
|
+
return "server-error";
|
|
259
254
|
}
|
|
260
255
|
|
|
261
256
|
return result;
|
|
@@ -268,10 +263,14 @@ export class AuthHandler {
|
|
|
268
263
|
loginParams: LoginParams
|
|
269
264
|
) => {
|
|
270
265
|
const start = Date.now();
|
|
271
|
-
const
|
|
266
|
+
const errCodeOrSession = await this.loginThrottledAndValidate(
|
|
272
267
|
loginParams,
|
|
273
268
|
getClientRequestIPsInfo({ httpReq: req })
|
|
274
269
|
);
|
|
270
|
+
const loginResponse =
|
|
271
|
+
typeof errCodeOrSession === "string" ?
|
|
272
|
+
{ session: undefined, response: { success: false, code: errCodeOrSession } }
|
|
273
|
+
: errCodeOrSession;
|
|
275
274
|
await this.prostgles.opts.onLog?.({
|
|
276
275
|
type: "auth",
|
|
277
276
|
command: "login",
|
package/lib/Auth/AuthTypes.ts
CHANGED
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
AuthResponse,
|
|
19
19
|
UserLike,
|
|
20
20
|
AuthRequest,
|
|
21
|
+
AuthFailure,
|
|
21
22
|
} from "prostgles-types";
|
|
22
23
|
import { DBOFullyTyped } from "../DBSchemaBuilder";
|
|
23
24
|
import { PRGLIOSocket } from "../DboBuilder/DboBuilderTypes";
|
|
@@ -97,11 +98,11 @@ export type Email = {
|
|
|
97
98
|
type EmailWithoutTo = Omit<Email, "to">;
|
|
98
99
|
|
|
99
100
|
type MagicLinkAuthResponse =
|
|
100
|
-
|
|
|
101
|
+
| AuthResponse.MagicLinkAuthFailure["code"]
|
|
101
102
|
| { response: AuthResponse.MagicLinkAuthSuccess; email: EmailWithoutTo };
|
|
102
103
|
|
|
103
104
|
type PasswordRegisterResponse =
|
|
104
|
-
|
|
|
105
|
+
| AuthResponse.PasswordRegisterFailure["code"]
|
|
105
106
|
| { response: AuthResponse.PasswordRegisterSuccess; email: EmailWithoutTo };
|
|
106
107
|
|
|
107
108
|
export type EmailProvider =
|
|
@@ -144,7 +145,7 @@ export type EmailProvider =
|
|
|
144
145
|
confirmationCode: string;
|
|
145
146
|
clientInfo: LoginClientInfo;
|
|
146
147
|
req: ExpressReq;
|
|
147
|
-
}) =>
|
|
148
|
+
}) => Awaitable<AuthFailure["code"] | AuthResponse.AuthSuccess>;
|
|
148
149
|
};
|
|
149
150
|
|
|
150
151
|
export type AuthProviderUserData =
|
|
@@ -308,10 +309,8 @@ export type LoginResponse =
|
|
|
308
309
|
session: BasicSession;
|
|
309
310
|
response?: AuthResponse.PasswordLoginSuccess | AuthResponse.MagicLinkAuthSuccess;
|
|
310
311
|
}
|
|
311
|
-
|
|
|
312
|
-
|
|
313
|
-
response: AuthResponse.PasswordLoginFailure | AuthResponse.MagicLinkAuthFailure;
|
|
314
|
-
};
|
|
312
|
+
| AuthResponse.PasswordLoginFailure["code"]
|
|
313
|
+
| AuthResponse.MagicLinkAuthFailure["code"];
|
|
315
314
|
|
|
316
315
|
export type LoginParams =
|
|
317
316
|
| ({ type: "username" } & AuthRequest.LoginData)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Request, Response } from "express";
|
|
2
2
|
import { AuthResponse } from "prostgles-types";
|
|
3
3
|
import { AUTH_ROUTES_AND_PARAMS, HTTP_FAIL_CODES } from "../AuthHandler";
|
|
4
4
|
import type { AuthRegistrationConfig } from "../AuthTypes";
|
|
@@ -42,7 +42,7 @@ export const getRegisterRequestHandler = ({
|
|
|
42
42
|
try {
|
|
43
43
|
const { httpReq, ...clientInfo } = getClientRequestIPsInfo({ httpReq: req });
|
|
44
44
|
const { smtp } = emailAuthConfig;
|
|
45
|
-
const
|
|
45
|
+
const errCodeOrResult =
|
|
46
46
|
emailAuthConfig.signupType === "withPassword" ?
|
|
47
47
|
await emailAuthConfig.onRegister({
|
|
48
48
|
email: username,
|
|
@@ -57,6 +57,11 @@ export const getRegisterRequestHandler = ({
|
|
|
57
57
|
clientInfo,
|
|
58
58
|
req: httpReq,
|
|
59
59
|
});
|
|
60
|
+
|
|
61
|
+
const registrationResult =
|
|
62
|
+
typeof errCodeOrResult === "string" ?
|
|
63
|
+
{ email: undefined, response: { success: false as const, code: errCodeOrResult } }
|
|
64
|
+
: errCodeOrResult;
|
|
60
65
|
if (!registrationResult.email) {
|
|
61
66
|
return sendResponse(registrationResult.response);
|
|
62
67
|
}
|
package/lib/DBSchemaBuilder.ts
CHANGED
|
@@ -10,11 +10,7 @@ import {
|
|
|
10
10
|
} from "prostgles-types";
|
|
11
11
|
import prostgles from ".";
|
|
12
12
|
import { Auth } from "./Auth/AuthTypes";
|
|
13
|
-
import {
|
|
14
|
-
DboBuilder,
|
|
15
|
-
escapeTSNames,
|
|
16
|
-
postgresToTsType,
|
|
17
|
-
} from "./DboBuilder/DboBuilder";
|
|
13
|
+
import { DboBuilder, escapeTSNames, postgresToTsType } from "./DboBuilder/DboBuilder";
|
|
18
14
|
import {
|
|
19
15
|
PublishAllOrNothing,
|
|
20
16
|
PublishParams,
|
|
@@ -22,28 +18,14 @@ import {
|
|
|
22
18
|
PublishViewRule,
|
|
23
19
|
} from "./PublishParser/PublishParser";
|
|
24
20
|
import { getJSONBSchemaTSTypes } from "./JSONBValidation/validation";
|
|
25
|
-
import {
|
|
26
|
-
DBHandlerServer,
|
|
27
|
-
TableSchemaColumn,
|
|
28
|
-
TX,
|
|
29
|
-
} from "./DboBuilder/DboBuilderTypes";
|
|
21
|
+
import { DBHandlerServer, TableSchemaColumn, TX } from "./DboBuilder/DboBuilderTypes";
|
|
30
22
|
|
|
31
23
|
export const getDBSchema = (dboBuilder: DboBuilder): string => {
|
|
32
24
|
const tables: string[] = [];
|
|
33
25
|
|
|
34
|
-
const getColTypeForDBSchema = (
|
|
35
|
-
udt_name: TableSchemaColumn["udt_name"],
|
|
36
|
-
): string => {
|
|
26
|
+
const getColTypeForDBSchema = (udt_name: TableSchemaColumn["udt_name"]): string => {
|
|
37
27
|
if (udt_name === "interval") {
|
|
38
|
-
const units = [
|
|
39
|
-
"years",
|
|
40
|
-
"months",
|
|
41
|
-
"days",
|
|
42
|
-
"hours",
|
|
43
|
-
"minutes",
|
|
44
|
-
"seconds",
|
|
45
|
-
"milliseconds",
|
|
46
|
-
];
|
|
28
|
+
const units = ["years", "months", "days", "hours", "minutes", "seconds", "milliseconds"];
|
|
47
29
|
|
|
48
30
|
return `{ ${units.map((u) => `${u}?: number;`).join(" ")} }`;
|
|
49
31
|
}
|
|
@@ -56,23 +38,13 @@ export const getDBSchema = (dboBuilder: DboBuilder): string => {
|
|
|
56
38
|
?.slice(0)
|
|
57
39
|
.sort((a, b) => a.name.localeCompare(b.name))
|
|
58
40
|
.forEach((tov) => {
|
|
59
|
-
const cols = tov.columns
|
|
60
|
-
.slice(0)
|
|
61
|
-
.sort((a, b) => a.name.localeCompare(b.name));
|
|
41
|
+
const cols = tov.columns.slice(0).sort((a, b) => a.name.localeCompare(b.name));
|
|
62
42
|
const getColType = (c: (typeof cols)[number]) => {
|
|
63
43
|
let type: string =
|
|
64
|
-
(c.is_nullable ? "null | " : "") +
|
|
65
|
-
|
|
66
|
-
";";
|
|
67
|
-
const colConf = dboBuilder.prostgles.tableConfigurator?.getColumnConfig(
|
|
68
|
-
tov.name,
|
|
69
|
-
c.name,
|
|
70
|
-
);
|
|
44
|
+
(c.is_nullable ? "null | " : "") + getColTypeForDBSchema(c.udt_name) + ";";
|
|
45
|
+
const colConf = dboBuilder.prostgles.tableConfigurator?.getColumnConfig(tov.name, c.name);
|
|
71
46
|
if (colConf) {
|
|
72
|
-
if (
|
|
73
|
-
isObject(colConf) &&
|
|
74
|
-
(colConf.jsonbSchema || colConf.jsonbSchemaType)
|
|
75
|
-
) {
|
|
47
|
+
if (isObject(colConf) && (colConf.jsonbSchema || colConf.jsonbSchemaType)) {
|
|
76
48
|
const schema: JSONB.JSONBSchema = colConf.jsonbSchema || {
|
|
77
49
|
...colConf,
|
|
78
50
|
type: colConf.jsonbSchemaType,
|
|
@@ -82,13 +54,11 @@ export const getDBSchema = (dboBuilder: DboBuilder): string => {
|
|
|
82
54
|
schema,
|
|
83
55
|
{ nullable: colConf.nullable },
|
|
84
56
|
" ",
|
|
85
|
-
dboBuilder.tablesOrViews ?? []
|
|
57
|
+
dboBuilder.tablesOrViews ?? []
|
|
86
58
|
);
|
|
87
59
|
} else if (isObject(colConf) && "enum" in colConf) {
|
|
88
60
|
if (!colConf.enum) throw "colConf.enum missing";
|
|
89
|
-
const types = colConf.enum.map((t) =>
|
|
90
|
-
typeof t === "number" ? t : JSON.stringify(t),
|
|
91
|
-
);
|
|
61
|
+
const types = colConf.enum.map((t) => (typeof t === "number" ? t : JSON.stringify(t)));
|
|
92
62
|
if (colConf.nullable) {
|
|
93
63
|
types.unshift("null");
|
|
94
64
|
}
|
|
@@ -110,7 +80,7 @@ export const getDBSchema = (dboBuilder: DboBuilder): string => {
|
|
|
110
80
|
columns: {${cols
|
|
111
81
|
.map(
|
|
112
82
|
(c) => `
|
|
113
|
-
${getColType(c)}
|
|
83
|
+
${getColType(c)}`
|
|
114
84
|
)
|
|
115
85
|
.join("")}
|
|
116
86
|
};
|
|
@@ -132,11 +102,12 @@ type ServerTableHandler<
|
|
|
132
102
|
Schema extends DBSchema | void = void,
|
|
133
103
|
> = TableHandler<T, Schema> & { is_view: boolean };
|
|
134
104
|
|
|
135
|
-
export type DBTableHandlersFromSchema<Schema = void> =
|
|
136
|
-
?
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
105
|
+
export type DBTableHandlersFromSchema<Schema = void> =
|
|
106
|
+
Schema extends DBSchema ?
|
|
107
|
+
{
|
|
108
|
+
[tov_name in keyof Schema]: Schema[tov_name]["is_view"] extends true ?
|
|
109
|
+
ServerViewHandler<Schema[tov_name]["columns"], Schema>
|
|
110
|
+
: ServerTableHandler<Schema[tov_name]["columns"], Schema>;
|
|
140
111
|
}
|
|
141
112
|
: Record<string, Partial<ServerTableHandler>>;
|
|
142
113
|
|
|
@@ -147,29 +118,20 @@ export type DBHandlerServerExtra<
|
|
|
147
118
|
sql: SQLHandler;
|
|
148
119
|
} & Partial<DbJoinMaker> &
|
|
149
120
|
(WithTransactions extends true ? { tx: TX<TH> } : Record<string, never>);
|
|
150
|
-
|
|
151
|
-
// DBTableHandlersFromSchema<Schema> & DBHandlerServerExtra<DBTableHandlersFromSchema<Schema>>
|
|
152
|
-
// ) :
|
|
153
|
-
// DBHandlerServer;
|
|
121
|
+
|
|
154
122
|
export type DBOFullyTyped<Schema = void> = DBTableHandlersFromSchema<Schema> &
|
|
155
123
|
DBHandlerServerExtra<DBTableHandlersFromSchema<Schema>>;
|
|
156
124
|
|
|
157
|
-
export type PublishFullyTyped<Schema = void> =
|
|
158
|
-
?
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
:
|
|
168
|
-
| PublishAllOrNothing
|
|
169
|
-
| Record<
|
|
170
|
-
string,
|
|
171
|
-
PublishViewRule | PublishTableRule | PublishAllOrNothing
|
|
172
|
-
>;
|
|
125
|
+
export type PublishFullyTyped<Schema = void> =
|
|
126
|
+
Schema extends DBSchema ?
|
|
127
|
+
{
|
|
128
|
+
[tov_name in keyof Partial<Schema>]:
|
|
129
|
+
| PublishAllOrNothing
|
|
130
|
+
| (Schema[tov_name]["is_view"] extends true ?
|
|
131
|
+
PublishViewRule<Schema[tov_name]["columns"], Schema>
|
|
132
|
+
: PublishTableRule<Schema[tov_name]["columns"], Schema>);
|
|
133
|
+
}
|
|
134
|
+
: Record<string, PublishViewRule | PublishTableRule | PublishAllOrNothing>;
|
|
173
135
|
|
|
174
136
|
/** Type checks */
|
|
175
137
|
() => {
|
|
@@ -16,9 +16,11 @@ import {
|
|
|
16
16
|
RULE_TO_METHODS,
|
|
17
17
|
TableRule,
|
|
18
18
|
} from "./publishTypesAndUtils";
|
|
19
|
+
import { ProstglesInitOptions } from "../ProstglesTypes";
|
|
20
|
+
import { PublishFullyTyped } from "../DBSchemaBuilder";
|
|
19
21
|
|
|
20
22
|
export class PublishParser {
|
|
21
|
-
publish:
|
|
23
|
+
publish: ProstglesInitOptions["publish"];
|
|
22
24
|
publishMethods?: PublishMethods<void, SessionUser> | undefined;
|
|
23
25
|
publishRawSQL?: any;
|
|
24
26
|
dbo: DBHandlerServer;
|
|
@@ -86,10 +88,11 @@ export class PublishParser {
|
|
|
86
88
|
|
|
87
89
|
/**
|
|
88
90
|
* Parses the first level of publish. (If false then nothing if * then all tables and views)
|
|
89
|
-
* @param socket
|
|
90
|
-
* @param user
|
|
91
91
|
*/
|
|
92
|
-
async getPublish(
|
|
92
|
+
async getPublish(
|
|
93
|
+
localParams: LocalParams,
|
|
94
|
+
clientInfo?: AuthResult
|
|
95
|
+
): Promise<PublishFullyTyped | undefined> {
|
|
93
96
|
const publishParams = await this.getPublishParams(localParams, clientInfo);
|
|
94
97
|
const _publish = await applyParamsIfFunc(this.publish, publishParams);
|
|
95
98
|
|
|
@@ -101,7 +104,7 @@ export class PublishParser {
|
|
|
101
104
|
return publish;
|
|
102
105
|
}
|
|
103
106
|
|
|
104
|
-
return _publish;
|
|
107
|
+
return _publish || undefined;
|
|
105
108
|
}
|
|
106
109
|
async getValidatedRequestRuleWusr({
|
|
107
110
|
tableName,
|
|
@@ -49,7 +49,7 @@ export async function getSchemaFromPublish(
|
|
|
49
49
|
throw err;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
if (Object.keys(_publish).length) {
|
|
52
|
+
if (_publish && Object.keys(_publish).length) {
|
|
53
53
|
let txKey = "tx";
|
|
54
54
|
if (!this.prostgles.opts.transactions) txKey = "";
|
|
55
55
|
if (typeof this.prostgles.opts.transactions === "string")
|
|
@@ -22,14 +22,11 @@ export async function getTableRulesWithoutFileTable(
|
|
|
22
22
|
): Promise<ParsedPublishTable | undefined> {
|
|
23
23
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
24
24
|
if (!localParams || !tableName)
|
|
25
|
-
throw
|
|
26
|
-
stack: ["getTableRules()"],
|
|
27
|
-
message: "publish OR socket OR dbo OR tableName are missing",
|
|
28
|
-
};
|
|
25
|
+
throw new Error("publish OR socket OR dbo OR tableName are missing");
|
|
29
26
|
|
|
30
27
|
const _publish = overridenPublish ?? (await this.getPublish(localParams, clientInfo));
|
|
31
28
|
|
|
32
|
-
const raw_table_rules = _publish[tableName];
|
|
29
|
+
const raw_table_rules = _publish?.[tableName];
|
|
33
30
|
if (
|
|
34
31
|
!raw_table_rules ||
|
|
35
32
|
(isObject(raw_table_rules) && Object.values(raw_table_rules).every((v) => !v))
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AnyObject,
|
|
3
|
-
DBSchema,
|
|
4
|
-
FullFilter,
|
|
5
|
-
Method,
|
|
6
|
-
RULE_METHODS,
|
|
7
|
-
} from "prostgles-types";
|
|
1
|
+
import { AnyObject, DBSchema, FullFilter, Method, RULE_METHODS } from "prostgles-types";
|
|
8
2
|
import type { DBOFullyTyped, PublishFullyTyped } from "../DBSchemaBuilder";
|
|
9
3
|
import {
|
|
10
4
|
CommonTableRules,
|
|
@@ -15,11 +9,8 @@ import {
|
|
|
15
9
|
} from "../DboBuilder/DboBuilder";
|
|
16
10
|
import { DB, DBHandlerServer } from "../Prostgles";
|
|
17
11
|
|
|
18
|
-
export type PublishMethods<
|
|
19
|
-
S
|
|
20
|
-
SUser extends SessionUser = SessionUser,
|
|
21
|
-
> = (
|
|
22
|
-
params: PublishParams<S, SUser>,
|
|
12
|
+
export type PublishMethods<S = void, SUser extends SessionUser = SessionUser> = (
|
|
13
|
+
params: PublishParams<S, SUser>
|
|
23
14
|
) => { [key: string]: Method } | Promise<{ [key: string]: Method } | null>;
|
|
24
15
|
|
|
25
16
|
export type Awaitable<T> = T | Promise<T>;
|
|
@@ -171,10 +162,7 @@ export type DeleteRequestData = {
|
|
|
171
162
|
filter: object;
|
|
172
163
|
returning: FieldFilter;
|
|
173
164
|
};
|
|
174
|
-
export type UpdateRequestDataOne<
|
|
175
|
-
R extends AnyObject,
|
|
176
|
-
S extends DBSchema | void = void,
|
|
177
|
-
> = {
|
|
165
|
+
export type UpdateRequestDataOne<R extends AnyObject, S extends DBSchema | void = void> = {
|
|
178
166
|
filter: FullFilter<R, S>;
|
|
179
167
|
data: Partial<R>;
|
|
180
168
|
returning: FieldFilter<R>;
|
|
@@ -195,42 +183,28 @@ export type ValidateRowArgs<R = AnyObject, DBX = DBHandlerServer> = {
|
|
|
195
183
|
dbx: DBX;
|
|
196
184
|
localParams: LocalParams;
|
|
197
185
|
};
|
|
198
|
-
export type ValidateUpdateRowArgs<
|
|
199
|
-
U = Partial<AnyObject>,
|
|
200
|
-
F = Filter,
|
|
201
|
-
DBX = DBHandlerServer,
|
|
202
|
-
> = {
|
|
186
|
+
export type ValidateUpdateRowArgs<U = Partial<AnyObject>, F = Filter, DBX = DBHandlerServer> = {
|
|
203
187
|
update: U;
|
|
204
188
|
filter: F;
|
|
205
189
|
dbx: DBX;
|
|
206
190
|
localParams: LocalParams;
|
|
207
191
|
};
|
|
208
192
|
export type ValidateRow<R extends AnyObject = AnyObject, S = void> = (
|
|
209
|
-
args: ValidateRowArgs<R, DBOFullyTyped<S
|
|
193
|
+
args: ValidateRowArgs<R, DBOFullyTyped<S>>
|
|
210
194
|
) => R | Promise<R>;
|
|
211
195
|
export type PostValidateRow<R extends AnyObject = AnyObject, S = void> = (
|
|
212
|
-
args: ValidateRowArgs<R, DBOFullyTyped<S
|
|
213
|
-
) => void | Promise<void>;
|
|
214
|
-
export type PostValidateRowBasic = (
|
|
215
|
-
args: ValidateRowArgs,
|
|
196
|
+
args: ValidateRowArgs<R, DBOFullyTyped<S>>
|
|
216
197
|
) => void | Promise<void>;
|
|
217
|
-
export type
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
R extends AnyObject = AnyObject,
|
|
222
|
-
S extends DBSchema | void = void,
|
|
223
|
-
> = (
|
|
224
|
-
args: ValidateUpdateRowArgs<Partial<R>, FullFilter<R, S>, DBOFullyTyped<S>>,
|
|
198
|
+
export type PostValidateRowBasic = (args: ValidateRowArgs) => void | Promise<void>;
|
|
199
|
+
export type ValidateRowBasic = (args: ValidateRowArgs) => AnyObject | Promise<AnyObject>;
|
|
200
|
+
export type ValidateUpdateRow<R extends AnyObject = AnyObject, S extends DBSchema | void = void> = (
|
|
201
|
+
args: ValidateUpdateRowArgs<Partial<R>, FullFilter<R, S>, DBOFullyTyped<S>>
|
|
225
202
|
) => Partial<R> | Promise<Partial<R>>;
|
|
226
203
|
export type ValidateUpdateRowBasic = (
|
|
227
|
-
args: ValidateUpdateRowArgs
|
|
204
|
+
args: ValidateUpdateRowArgs
|
|
228
205
|
) => AnyObject | Promise<AnyObject>;
|
|
229
206
|
|
|
230
|
-
export type SelectRule<
|
|
231
|
-
Cols extends AnyObject = AnyObject,
|
|
232
|
-
S extends DBSchema | void = void,
|
|
233
|
-
> = {
|
|
207
|
+
export type SelectRule<Cols extends AnyObject = AnyObject, S extends DBSchema | void = void> = {
|
|
234
208
|
/**
|
|
235
209
|
* Fields allowed to be selected.
|
|
236
210
|
* Tip: Use false to exclude field
|
|
@@ -261,9 +235,7 @@ export type SelectRule<
|
|
|
261
235
|
/**
|
|
262
236
|
* Validation logic to check/update data for each request
|
|
263
237
|
*/
|
|
264
|
-
validate?(
|
|
265
|
-
args: SelectRequestData,
|
|
266
|
-
): SelectRequestData | Promise<SelectRequestData>;
|
|
238
|
+
validate?(args: SelectRequestData): SelectRequestData | Promise<SelectRequestData>;
|
|
267
239
|
};
|
|
268
240
|
|
|
269
241
|
export type CommonInsertUpdateRule<
|
|
@@ -311,9 +283,7 @@ export type InsertRule<
|
|
|
311
283
|
* Validation logic to check/update data after the insert.
|
|
312
284
|
* Happens in the same transaction so upon throwing an error the record will be deleted (not committed)
|
|
313
285
|
*/
|
|
314
|
-
postValidate?: S extends DBSchema
|
|
315
|
-
? PostValidateRow<Required<Cols>, S>
|
|
316
|
-
: PostValidateRowBasic;
|
|
286
|
+
postValidate?: S extends DBSchema ? PostValidateRow<Required<Cols>, S> : PostValidateRowBasic;
|
|
317
287
|
|
|
318
288
|
/**
|
|
319
289
|
* If defined then only nested inserts from these tables are allowed
|
|
@@ -365,23 +335,16 @@ export type UpdateRule<
|
|
|
365
335
|
/**
|
|
366
336
|
* Validation logic to check/update data for each request
|
|
367
337
|
*/
|
|
368
|
-
validate?: S extends DBSchema
|
|
369
|
-
? ValidateUpdateRow<Cols, S>
|
|
370
|
-
: ValidateUpdateRowBasic;
|
|
338
|
+
validate?: S extends DBSchema ? ValidateUpdateRow<Cols, S> : ValidateUpdateRowBasic;
|
|
371
339
|
|
|
372
340
|
/**
|
|
373
341
|
* Validation logic to check/update data after the insert.
|
|
374
342
|
* Happens in the same transaction so upon throwing an error the record will be deleted (not committed)
|
|
375
343
|
*/
|
|
376
|
-
postValidate?: S extends DBSchema
|
|
377
|
-
? PostValidateRow<Required<Cols>, S>
|
|
378
|
-
: PostValidateRowBasic;
|
|
344
|
+
postValidate?: S extends DBSchema ? PostValidateRow<Required<Cols>, S> : PostValidateRowBasic;
|
|
379
345
|
};
|
|
380
346
|
|
|
381
|
-
export type DeleteRule<
|
|
382
|
-
Cols extends AnyObject = AnyObject,
|
|
383
|
-
S extends DBSchema | void = void,
|
|
384
|
-
> = {
|
|
347
|
+
export type DeleteRule<Cols extends AnyObject = AnyObject, S extends DBSchema | void = void> = {
|
|
385
348
|
/**
|
|
386
349
|
* Filter added to every query (e.g. user_id) to restrict access
|
|
387
350
|
*/
|
|
@@ -448,10 +411,7 @@ export type TableRule<
|
|
|
448
411
|
sync?: SyncRule<RowType>;
|
|
449
412
|
subscribe?: SubscribeRule;
|
|
450
413
|
};
|
|
451
|
-
export type PublishViewRule<
|
|
452
|
-
Col extends AnyObject = AnyObject,
|
|
453
|
-
S extends DBSchema | void = void,
|
|
454
|
-
> = {
|
|
414
|
+
export type PublishViewRule<Col extends AnyObject = AnyObject, S extends DBSchema | void = void> = {
|
|
455
415
|
select?: SelectRule<Col, S> | PublishAllOrNothing;
|
|
456
416
|
getColumns?: PublishAllOrNothing;
|
|
457
417
|
getInfo?: PublishAllOrNothing;
|
|
@@ -495,19 +455,14 @@ export type PublishParams<S = void, SUser extends SessionUser = SessionUser> = {
|
|
|
495
455
|
export type RequestParams = { dbo?: DBHandlerServer; socket?: any };
|
|
496
456
|
export type PublishAllOrNothing = boolean | "*" | null;
|
|
497
457
|
export type PublishObject = {
|
|
498
|
-
[table_name: string]:
|
|
499
|
-
| PublishTableRule
|
|
500
|
-
| PublishViewRule
|
|
501
|
-
| PublishAllOrNothing;
|
|
458
|
+
[table_name: string]: PublishTableRule | PublishViewRule | PublishAllOrNothing;
|
|
502
459
|
};
|
|
503
460
|
export type ParsedPublishTables = {
|
|
504
461
|
[table_name: string]: ParsedPublishTable;
|
|
505
462
|
};
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
463
|
+
|
|
464
|
+
type PublishAllOrNothingRoot = Exclude<PublishAllOrNothing, boolean>;
|
|
465
|
+
export type PublishedResult<Schema = void> = PublishAllOrNothingRoot | PublishFullyTyped<Schema>;
|
|
509
466
|
export type Publish<Schema = void, SUser extends SessionUser = SessionUser> =
|
|
510
467
|
| PublishedResult<Schema>
|
|
511
|
-
| ((
|
|
512
|
-
params: PublishParams<Schema, SUser>,
|
|
513
|
-
) => Awaitable<PublishedResult<Schema>>);
|
|
468
|
+
| ((params: PublishParams<Schema, SUser>) => Awaitable<PublishedResult<Schema>>);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prostgles-server",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.190",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"pg": "^8.11.5",
|
|
56
56
|
"pg-cursor": "^2.11.0",
|
|
57
57
|
"pg-promise": "^11.9.1",
|
|
58
|
-
"prostgles-types": "^4.0.
|
|
58
|
+
"prostgles-types": "^4.0.130"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/express": "^4.17.21",
|