@opengis/fastify-table 1.2.37 → 1.2.38

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "1.2.37",
3
+ "version": "1.2.38",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [
@@ -1,5 +1,5 @@
1
1
  import {
2
- config, getPG, getTemplate, getSelectMeta, getMeta, applyHook,
2
+ config, getPG, getTemplate, getSelectMeta, getMeta, applyHook, getSelectVal,
3
3
  } from '../../../../utils.js';
4
4
 
5
5
  const limit = 50;
@@ -151,6 +151,15 @@ export default async function suggest(req) {
151
151
  const ids = dataNew.map((el) => el.id);
152
152
  const data = dataNew.concat((/* dataNew1 || */[]).filter((el) => !ids?.includes(el.id)));
153
153
 
154
+ if (query.cls) {
155
+ const clsData = await getSelectVal({
156
+ pg,
157
+ name: query.cls,
158
+ values: data.map((el) => el.id),
159
+ });
160
+ data.forEach(el => Object.assign(el, { text: clsData?.[el.id || ''] || el.id }));
161
+ }
162
+
154
163
  const message = {
155
164
  time: Date.now() - time,
156
165
  limit: Math.min(query.limit || meta.limit || limit, limit),