@opengis/fastify-table 2.5.10 → 2.5.13

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.
@@ -33,7 +33,7 @@ export default async function getMeta(opt, nocache) {
33
33
  if (!tlist.includes(tableUnsafe)) {
34
34
  throw BadRequestError(`table not found: ${tableOriginal}`);
35
35
  }
36
- const relkinds = tableRows.reduce((acc, curr) => Object.assign(acc, { [curr.name]: curr.relkind }), {});
36
+ const relkinds = tableRows.reduce((acc, curr) => Object.assign(acc, { [curr.name.replace(/"/g, "")]: curr.relkind }), {});
37
37
  const fields = await pg
38
38
  .query(`select * from ${tableSafe} limit 0`)
39
39
  .then((r) => r.fields || []);
@@ -63,7 +63,7 @@ export default async function getMeta(opt, nocache) {
63
63
  pk,
64
64
  columns: fields,
65
65
  geom: geomAttr?.name,
66
- view: ["v", "m"].includes(relkinds?.[tableSafe]),
66
+ view: ["v", "m"].includes(relkinds[tableUnsafe]),
67
67
  };
68
68
  if (!data[pg.options.database]) {
69
69
  data[pg.options.database] = {};
@@ -370,7 +370,7 @@ export default async function dataAPI({ pg = pgClients.client, params, table, id
370
370
  args.push(uid || "");
371
371
  Object.assign(idx, { uid: Object.keys(idx).length + 1 });
372
372
  }
373
- const q = q1.replace(/{{uid}}/g, `$${idx.uid}`);
373
+ const q = q1.replace(/'{{uid}}'/g, `$${idx.uid}`);
374
374
  if (config.trace)
375
375
  console.log(q);
376
376
  if (query?.sql === "1") {
@@ -463,7 +463,7 @@ export default async function dataAPI({ pg = pgClients.client, params, table, id
463
463
  .join("") || ""} from ${viewSql ? `(${viewSql})` : table1} t ${sqlTable})t
464
464
  where ${[loadTable?.query, tokenData?.query, accessQuery, contextQuery]
465
465
  .filter(Boolean)
466
- .join(" and ") || "true"} `.replace(/{{uid}}/g, `$${idx1.uid}`);
466
+ .join(" and ") || "true"} `.replace(/'{{uid}}'/g, `$${idx1.uid}`);
467
467
  if (query?.sql === "2") {
468
468
  return qCount;
469
469
  }
@@ -32,8 +32,8 @@ const tableSchema = {
32
32
  page: { type: "number", minimum: 1 },
33
33
  // filter: { type: 'string', pattern: '^([\\w\\d_-]+)=([А-Яа-яҐґЄєІіЇї\\d\\w\\s\\/\\[\\]\\(\\)\\{\\}\\|,.!?;:—_=-@%#$&^*+=`~]+)$' },
34
34
  // search: { type: 'string', pattern: '^([А-Яа-яҐґЄєІіЇї\\d\\w\\s\\/\\[\\]\\(\\)\\{\\}\\|,.!?;:—_=-@%#$&^*+=`~]+)$' },
35
- order: { type: "string", pattern: "^([\\d\\w_.-]+)$" },
36
- desc: { type: "string", pattern: "^(\\d+)$" },
35
+ order: { type: "string", pattern: "^$|^[\\d\\w_.-]+$" },
36
+ desc: { type: "string", pattern: "^$|^(\\d+)$" },
37
37
  // state: { type: 'string', pattern: '^([\\d\\w._-]+)$' },
38
38
  // custom: { type: 'string', pattern: '^([\\d\\w._-]+)$' },
39
39
  bbox: { type: "string", pattern: "^([\\d\\s,.-]+)$" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "2.5.10",
3
+ "version": "2.5.13",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [