@opengis/fastify-table 2.5.33 → 2.5.35

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.
@@ -1 +1 @@
1
- {"version":3,"file":"inspectContent.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/file/utils/inspectContent.ts"],"names":[],"mappings":"AAwCA,wBAA8B,cAAc,CAC1C,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,MAAM;;;;GA+B1B"}
1
+ {"version":3,"file":"inspectContent.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/file/utils/inspectContent.ts"],"names":[],"mappings":"AA+CA,wBAA8B,cAAc,CAC1C,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,MAAM;;;;GAwC1B"}
@@ -1,6 +1,12 @@
1
1
  import { fileTypeFromBuffer } from "file-type";
2
2
  import { BadRequestError } from "../../../../errors.js";
3
3
  import applyHook from "../../hook/applyHook.js";
4
+ // Office 97–2003 (.doc/.xls/.ppt) share CFB magic; file-type reports them as "cfb"
5
+ const cfbOfficeMimes = {
6
+ doc: "application/msword",
7
+ xls: "application/vnd.ms-excel",
8
+ ppt: "application/vnd.ms-powerpoint",
9
+ };
4
10
  const handlers = {
5
11
  pdf: (buffer) => {
6
12
  const head = buffer.subarray(0, 1024).toString("latin1");
@@ -53,6 +59,14 @@ export default async function inspectContent(buffer, expectedExtension) {
53
59
  const { ext: ext2, mime: mime2 } = (await handlers[expectedExtension](buffer)) || {};
54
60
  return { ext: ext2, mime: mime2, isValid: ext2 === expectedExtension };
55
61
  }
62
+ // ? .doc/.xls/.ppt are CFB containers — file-type returns "cfb", not the office ext
63
+ if (ext === "cfb" && cfbOfficeMimes[expectedExtension]) {
64
+ return {
65
+ ext: expectedExtension,
66
+ mime: cfbOfficeMimes[expectedExtension],
67
+ isValid: true,
68
+ };
69
+ }
56
70
  // ? simple xml, pdf are recognized via file-type
57
71
  return { ext, mime, isValid: ext === expectedExtension };
58
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/plugins/logger/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAgC,MAAM,SAAS,CAAC;AAqE7E,iBAAS,YAAY,CAAC,OAAO,EAAE,eAAe,QA+C7C;AACD,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/plugins/logger/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAgC,MAAM,SAAS,CAAC;AAqE7E,iBAAS,YAAY,CAAC,OAAO,EAAE,eAAe,QAmD7C;AACD,eAAe,YAAY,CAAC"}
@@ -71,7 +71,9 @@ function loggerPlugin(fastify) {
71
71
  if (error.statusCode && logWarningCodes.includes(error.statusCode)) {
72
72
  logger.warn(error, request);
73
73
  }
74
- if (process.env.trace === "true") {
74
+ if (process.env.trace === "true" ||
75
+ process.env.NODE_ENV === "test" ||
76
+ process.env.VITEST) {
75
77
  console.error({
76
78
  msg: error.message,
77
79
  where: error.where,
@@ -1 +1 @@
1
- {"version":3,"file":"getMeta.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/pg/funcs/getMeta.ts"],"names":[],"mappings":"AAMA,wBAA8B,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,gBAmG5D"}
1
+ {"version":3,"file":"getMeta.d.ts","sourceRoot":"","sources":["../../../../../server/plugins/pg/funcs/getMeta.ts"],"names":[],"mappings":"AAMA,wBAA8B,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,gBA0G5D"}
@@ -11,8 +11,11 @@ export default async function getMeta(opt, nocache) {
11
11
  if (!pg.pk || nocache) {
12
12
  await init(pg);
13
13
  }
14
- const tableOriginal = opt?.table || opt;
15
- const [schemaName, tableName] = tableOriginal?.replace?.(/"/g, "").split(".");
14
+ const tableOriginal = opt?.table || (typeof opt === "string" ? opt : undefined);
15
+ if (!tableOriginal) {
16
+ throw BadRequestError("not enough params: table");
17
+ }
18
+ const [schemaName, tableName] = tableOriginal?.replace?.(/"/g, "")?.split?.(".") || [];
16
19
  const tableSafe = `${schemaName}."${tableName}"`;
17
20
  const tableUnsafe = `${schemaName}.${tableName}`;
18
21
  if (pg?.options?.database &&
@@ -74,7 +74,7 @@ const suggestSchema = {
74
74
  parent: { type: "string", pattern: "^([\\d\\w_.-]+)$" },
75
75
  sel: { type: "string", pattern: "^([\\d\\w_.-]+)$" },
76
76
  name: { type: "string", pattern: "^([\\d\\w_.-]+)$" },
77
- key: { type: "string", pattern: "^([\\d\\w_.-]+)$" },
77
+ key: { type: "string", pattern: "^([А-Яа-яҐґЄєІіЇї\\d\\w\\s_.-]+)$" },
78
78
  val: { type: "string", pattern: "([\\d\\w]+)$" },
79
79
  sql: { type: "number" },
80
80
  count: { type: "number" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "2.5.33",
3
+ "version": "2.5.35",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [