@opengis/fastify-table 1.4.56 → 1.4.58

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/index.js CHANGED
@@ -4,6 +4,7 @@ import { existsSync, readdirSync, readFileSync } from 'node:fs';
4
4
  import { fileURLToPath } from 'node:url';
5
5
 
6
6
  import fp from 'fastify-plugin';
7
+ import proxy from '@fastify/http-proxy';
7
8
 
8
9
  import config from './config.js';
9
10
 
@@ -114,6 +115,18 @@ async function plugin(fastify, opt) {
114
115
  });
115
116
  }
116
117
 
118
+ config.proxy?.forEach?.(el => {
119
+ fastify.register(proxy, {
120
+ upstream: el.target,
121
+ prefix: el.source,
122
+ http2: false,
123
+ preHandler: async (req) => {
124
+ req.headers.uid = req.session?.passport?.user?.uid;
125
+ Object.keys(el.headers || {})?.forEach(item => req.headers[item] = el.headers[item]);
126
+ },
127
+ });
128
+ });
129
+
117
130
  if (config.dblist) {
118
131
  dblistRoutes(fastify, opt);
119
132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "1.4.56",
3
+ "version": "1.4.58",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [
@@ -59,4 +59,4 @@
59
59
  },
60
60
  "author": "Softpro",
61
61
  "license": "ISC"
62
- }
62
+ }
@@ -9,12 +9,17 @@ async function format(d, key, data) {
9
9
  return await handlebars.compile(key)(data);
10
10
  }
11
11
 
12
+ // metaFormat array of objects with id, text, color etc.
13
+ if (Array.isArray(d) && d?.[0]?.text) {
14
+ return d.map(({ text }) => text).join(', ');
15
+ }
16
+
12
17
  return d;
13
18
  }
14
19
  export default async function descriptionList(data, opt) {
15
20
  const { hash } = opt;
16
21
 
17
- // no data
22
+ // no datad.
18
23
  if (hash.nodata && !data) {
19
24
  const noDataText = typeof hash.nodata === 'string' ? hash.nodata : '<div class="bg-gray-200 text-center p-6 rounded-xl"><h3 class="text-lg font-semibold">Інформація відсутня</h3></div>';
20
25
  return noDataText;
@@ -18,7 +18,7 @@ export default function unflattenObject(flatObj) {
18
18
  nestedObj[part] = flatObj[key]; // fallback to original value if parsing fails
19
19
  }
20
20
  }
21
- else if (['true', 'false'].includes(flatObj[key]) || !isNaN(flatObj[key])) {
21
+ else if (['true', 'false'].includes(flatObj[key]) || (!isNaN(flatObj[key]) && key !== 'auth.uid')) {
22
22
  try {
23
23
  nestedObj[part] = JSON.parse(flatObj[key]);
24
24
  }