From 83eb4b976fe9c5187eeccc391158054f758076e0 Mon Sep 17 00:00:00 2001 From: Benjamin Toby Date: Sun, 28 Dec 2025 18:41:03 +0100 Subject: [PATCH] Updates --- dist/package-shared/api-paths/utils/checks.d.ts | 2 +- dist/package-shared/api-paths/utils/checks.js | 6 +++++- dist/package-shared/types/index.d.ts | 2 ++ package-shared/api-paths/utils/checks.ts | 5 +++++ package-shared/types/index.ts | 2 ++ package.json | 2 +- 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dist/package-shared/api-paths/utils/checks.d.ts b/dist/package-shared/api-paths/utils/checks.d.ts index a938e31..2125e00 100644 --- a/dist/package-shared/api-paths/utils/checks.d.ts +++ b/dist/package-shared/api-paths/utils/checks.d.ts @@ -3,6 +3,6 @@ export default function checks({ table, allowedTables, query, body, method, getMiddleware, postMiddleware, putMiddleware, deleteMiddleware, crudMiddleware, }: APIPathsCrudParams): Promise, "query" | "body"> & { +}>({ table, allowedTables, query, body, method, getMiddleware, postMiddleware, putMiddleware, deleteMiddleware, crudMiddleware, targetId, }: APIPathsCrudParams): Promise, "query" | "body"> & { allowedTable: APIPathsParamsAllowedTable; }>; diff --git a/dist/package-shared/api-paths/utils/checks.js b/dist/package-shared/api-paths/utils/checks.js index 01d57da..dd7ae7b 100644 --- a/dist/package-shared/api-paths/utils/checks.js +++ b/dist/package-shared/api-paths/utils/checks.js @@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = checks; const lodash_1 = __importDefault(require("lodash")); function checks(_a) { - return __awaiter(this, arguments, void 0, function* ({ table, allowedTables, query, body, method, getMiddleware, postMiddleware, putMiddleware, deleteMiddleware, crudMiddleware, }) { + return __awaiter(this, arguments, void 0, function* ({ table, allowedTables, query, body, method, getMiddleware, postMiddleware, putMiddleware, deleteMiddleware, crudMiddleware, targetId, }) { var _b, _c, _d, _e; const allowedTable = allowedTables.find((tbl) => tbl.table == table); if (!allowedTable) { @@ -85,6 +85,7 @@ function checks(_a) { newQuery = yield getMiddleware({ query: newQuery || {}, table, + targetId, }); } if (method !== "GET" && crudMiddleware) { @@ -92,6 +93,7 @@ function checks(_a) { body: newBody || {}, query: newQuery || {}, table, + targetId, }); newBody = lodash_1.default.merge(newBody, middRes); } @@ -100,6 +102,7 @@ function checks(_a) { body: newBody || {}, query: newQuery || {}, table, + targetId, }); newBody = lodash_1.default.merge(newBody, middRes); } @@ -108,6 +111,7 @@ function checks(_a) { body: newBody || {}, query: newQuery || {}, table, + targetId, }); newBody = lodash_1.default.merge(newBody, middRes); } diff --git a/dist/package-shared/types/index.d.ts b/dist/package-shared/types/index.d.ts index a4fece4..ced962c 100644 --- a/dist/package-shared/types/index.d.ts +++ b/dist/package-shared/types/index.d.ts @@ -2250,6 +2250,7 @@ export type APIPathsParamsGetMiddleware = (params: { query: APIPathsQuery; table: string; + targetId?: number | string; }) => Promise>; export type APIPathsParamsCrudMiddleware; query: DsqlCrudQueryObject; table: K; + targetId?: number | string; }) => Promise | undefined>; export type APIPathsParamsAllowedTable = { table: string; diff --git a/package-shared/api-paths/utils/checks.ts b/package-shared/api-paths/utils/checks.ts index 5e2365c..70249da 100644 --- a/package-shared/api-paths/utils/checks.ts +++ b/package-shared/api-paths/utils/checks.ts @@ -18,6 +18,7 @@ export default async function checks< putMiddleware, deleteMiddleware, crudMiddleware, + targetId, }: APIPathsCrudParams): Promise< Pick, "query" | "body"> & { allowedTable: APIPathsParamsAllowedTable; @@ -126,6 +127,7 @@ export default async function checks< newQuery = await getMiddleware({ query: newQuery || ({} as any), table, + targetId, }); } @@ -134,6 +136,7 @@ export default async function checks< body: newBody || ({} as any), query: newQuery || {}, table, + targetId, }); newBody = _.merge(newBody, middRes); @@ -144,6 +147,7 @@ export default async function checks< body: newBody || ({} as any), query: newQuery || {}, table, + targetId, }); newBody = _.merge(newBody, middRes); @@ -154,6 +158,7 @@ export default async function checks< body: newBody || ({} as any), query: newQuery || {}, table, + targetId, }); newBody = _.merge(newBody, middRes); diff --git a/package-shared/types/index.ts b/package-shared/types/index.ts index 75f83b5..ef16b03 100644 --- a/package-shared/types/index.ts +++ b/package-shared/types/index.ts @@ -2915,6 +2915,7 @@ export type APIPathsParamsGetMiddleware< > = (params: { query: APIPathsQuery; table: string; + targetId?: number | string; }) => Promise>; export type APIPathsParamsCrudMiddleware< @@ -2924,6 +2925,7 @@ export type APIPathsParamsCrudMiddleware< body: APIPathsBody; query: DsqlCrudQueryObject; table: K; + targetId?: number | string; }) => Promise | undefined>; export type APIPathsParamsAllowedTable = { diff --git a/package.json b/package.json index b447570..decc670 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@moduletrace/datasquirel", - "version": "5.6.7", + "version": "5.6.8", "description": "Cloud-based SQL data management tool", "main": "dist/index.js", "bin": {