@opengis/fastify-table 2.0.127 → 2.0.128
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/server/routes/table/functions/getData.d.ts +2 -1
- package/dist/server/routes/table/functions/getData.d.ts.map +1 -1
- package/dist/server/routes/table/functions/getData.js +8 -6
- package/dist/server/routes/util/controllers/dependencies.d.ts +2 -0
- package/dist/server/routes/util/controllers/dependencies.d.ts.map +1 -0
- package/dist/server/routes/util/controllers/dependencies.js +13 -0
- package/dist/server/routes/util/index.d.ts.map +1 -1
- package/dist/server/routes/util/index.js +2 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FastifyReply } from "fastify";
|
|
2
2
|
import type { ExtendedPG } from "../../../types/core.js";
|
|
3
|
-
export default function dataAPI({ pg, params, table, id, headers, query, user, contextQuery, sufix, filterList, actions: actionsParam, columns: columnsParam, }: {
|
|
3
|
+
export default function dataAPI({ pg, params, table, id, headers, query, user, contextQuery, sufix, filterList, actions: actionsParam, accessQuery: accessQueryParam, columns: columnsParam, }: {
|
|
4
4
|
pg?: ExtendedPG;
|
|
5
5
|
params?: {
|
|
6
6
|
id?: string;
|
|
@@ -16,6 +16,7 @@ export default function dataAPI({ pg, params, table, id, headers, query, user, c
|
|
|
16
16
|
sufix?: boolean;
|
|
17
17
|
filterList?: any[];
|
|
18
18
|
actions?: string[];
|
|
19
|
+
accessQuery?: string;
|
|
19
20
|
columns?: string[];
|
|
20
21
|
}, reply1?: FastifyReply, called?: any): Promise<any>;
|
|
21
22
|
//# sourceMappingURL=getData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getData.d.ts","sourceRoot":"","sources":["../../../../../server/routes/table/functions/getData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AA4EzD,wBAA8B,OAAO,CACnC,EACE,EAAqB,EACrB,MAAM,EACN,KAAK,EACL,EAAE,EACF,OAAY,EACZ,KAAU,EACV,IAAS,EACT,YAAY,EACZ,KAAY,EACZ,UAAU,EACV,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,YAAY,GACtB,EAAE;IACD,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB,MAAM,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,EACD,MAAM,CAAC,EAAE,YAAY,EACrB,MAAM,CAAC,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"getData.d.ts","sourceRoot":"","sources":["../../../../../server/routes/table/functions/getData.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AA4EzD,wBAA8B,OAAO,CACnC,EACE,EAAqB,EACrB,MAAM,EACN,KAAK,EACL,EAAE,EACF,OAAY,EACZ,KAAU,EACV,IAAS,EACT,YAAY,EACZ,KAAY,EACZ,UAAU,EACV,OAAO,EAAE,YAAY,EACrB,WAAW,EAAE,gBAAgB,EAC7B,OAAO,EAAE,YAAY,GACtB,EAAE;IACD,EAAE,CAAC,EAAE,UAAU,CAAC;IAChB,MAAM,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,EACD,MAAM,CAAC,EAAE,YAAY,EACrB,MAAM,CAAC,EAAE,GAAG,gBAo0Bb"}
|
|
@@ -52,7 +52,7 @@ function getOrder(queryOrder, queryDesc, defaultOrder, columnList, iscalled = fa
|
|
|
52
52
|
const checkInline = {};
|
|
53
53
|
const maxLimit = 100;
|
|
54
54
|
const defaultLimit = 20;
|
|
55
|
-
export default async function dataAPI({ pg = pgClients.client, params, table, id, headers = {}, query = {}, user = {}, contextQuery, sufix = true, filterList, actions: actionsParam, columns: columnsParam, }, reply1, called) {
|
|
55
|
+
export default async function dataAPI({ pg = pgClients.client, params, table, id, headers = {}, query = {}, user = {}, contextQuery, sufix = true, filterList, actions: actionsParam, accessQuery: accessQueryParam, columns: columnsParam, }, reply1, called) {
|
|
56
56
|
const time = Date.now();
|
|
57
57
|
const timeArr = [Date.now()];
|
|
58
58
|
const { uid } = user;
|
|
@@ -127,11 +127,13 @@ export default async function dataAPI({ pg = pgClients.client, params, table, id
|
|
|
127
127
|
return reply.status(404).send("template not found");
|
|
128
128
|
}
|
|
129
129
|
const objectId = tokenData?.id || hookData?.id || params?.id || id;
|
|
130
|
-
const { actions = [], query: accessQuery } =
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
130
|
+
const { actions = [], query: accessQuery } = actionsParam
|
|
131
|
+
? { actions: actionsParam, query: accessQueryParam || "1=1" }
|
|
132
|
+
: (await getAccess({
|
|
133
|
+
table: templateName,
|
|
134
|
+
id: objectId,
|
|
135
|
+
user,
|
|
136
|
+
}, pg));
|
|
135
137
|
const body = loadTable || hookData || tokenData;
|
|
136
138
|
const { table: table1, columns = [], sql, cardSql, form, meta, sqlColumns, public: ispublic, editable = false, } = loadTable || hookData || tokenData || params || { table };
|
|
137
139
|
if (!ispublic && !user?.uid && !called) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependencies.d.ts","sourceRoot":"","sources":["../../../../../server/routes/util/controllers/dependencies.ts"],"names":[],"mappings":"AAQA,wBAA8B,iBAAiB,CAAC,GAAG,EAAE,GAAG,eAUvD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
const pkgPath = path.join(process.cwd(), "package.json");
|
|
6
|
+
const json = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
7
|
+
export default async function dumpInstalledDeps(app) {
|
|
8
|
+
return Object.keys({
|
|
9
|
+
...json.dependencies,
|
|
10
|
+
...(json.devDependencies || {}),
|
|
11
|
+
...(json.peerDependencies || {}),
|
|
12
|
+
}).reduce((acc, curr) => Object.assign(acc, { [curr]: require(`${curr}/package.json`).version }), {});
|
|
13
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/routes/util/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/routes/util/index.ts"],"names":[],"mappings":"AASA,iBAAS,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,GAAE,GAAQ,QA2BtC;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -3,6 +3,7 @@ import nextId from "./controllers/next.id.js";
|
|
|
3
3
|
import statusMonitor from "./controllers/status.monitor.js";
|
|
4
4
|
import userTokens from "./controllers/user.tokens.js";
|
|
5
5
|
import codeGenerator from "./controllers/code.generator.js";
|
|
6
|
+
import dependencies from "./controllers/dependencies.js";
|
|
6
7
|
function plugin(app, opt = {}) {
|
|
7
8
|
app.get("/next-id", { config: { policy: "L0" } }, nextId);
|
|
8
9
|
app.get("/status-monitor", { config: { role: "admin" } }, statusMonitor);
|
|
@@ -13,5 +14,6 @@ function plugin(app, opt = {}) {
|
|
|
13
14
|
sessionId: req.session?.sessionId,
|
|
14
15
|
}));
|
|
15
16
|
app.get("/config", { config: { policy: "L0" /*role: "admin"*/ } }, apiConfig);
|
|
17
|
+
app.get("/dependencies", { config: { policy: "L1", role: "admin" } }, dependencies);
|
|
16
18
|
}
|
|
17
19
|
export default plugin;
|