@opengis/fastify-table 2.0.44 → 2.0.45

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":"formatValue.d.ts","sourceRoot":"","sources":["../../../../../../../server/plugins/table/funcs/getFilterSQL/util/formatValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAK/D,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,EAAE,EACF,KAAK,EACL,MAAW,EACX,IAAI,EACJ,KAAK,EACL,UAAU,EACV,GAAO,EACP,QAAQ,GACT,EAAE;IACD,EAAE,EAAE,UAAU,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,OAyLA"}
1
+ {"version":3,"file":"formatValue.d.ts","sourceRoot":"","sources":["../../../../../../../server/plugins/table/funcs/getFilterSQL/util/formatValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAe/D,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,EAAE,EACF,KAAK,EACL,MAAW,EACX,IAAI,EACJ,KAAK,EACL,UAAU,EACV,GAAO,EACP,QAAQ,GACT,EAAE;IACD,EAAE,EAAE,UAAU,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB,OAmLA"}
@@ -1,5 +1,14 @@
1
1
  import applyHookSync from "../../../../hook/applyHookSync.js";
2
2
  import getRangeQuery from "./getRangeQuery.js";
3
+ const selectFilterTypes = [
4
+ "check",
5
+ "autocomplete",
6
+ "tags",
7
+ "avatar",
8
+ "radio",
9
+ "select",
10
+ "button",
11
+ ];
3
12
  export default function formatValue({ pg, table, filter = {}, name, value, dataTypeID, uid = 1, optimize, }) {
4
13
  const { extra, sql, select, strict, options /* default: defaultValue, */ } = filter;
5
14
  const pk = pg?.pk && table ? pg.pk[table] : undefined;
@@ -33,7 +42,7 @@ export default function formatValue({ pg, table, filter = {}, name, value, dataT
33
42
  !value ||
34
43
  (!dataTypeID && !extra && !sql && !options) ||
35
44
  extra?.input?.toLowerCase?.() === "datatable" ||
36
- (!["check", "autocomplete", "tags", "avatar", "radio"].includes(filterType) &&
45
+ (!selectFilterTypes.includes(filterType) &&
37
46
  options?.find?.((el) => el?.sql))) {
38
47
  return {};
39
48
  }
@@ -105,11 +114,11 @@ export default function formatValue({ pg, table, filter = {}, name, value, dataT
105
114
  return { op: "between", query };
106
115
  }
107
116
  /* select query - from admin.cls / filter options */
108
- if (["check", "autocomplete", "tags", "avatar", "radio", "select"].includes(filterType)) {
117
+ if (selectFilterTypes.includes(filterType)) {
109
118
  // multiple checks with predefined query
110
119
  if (options?.find?.((el) => el?.sql)) {
111
120
  const query = options
112
- .filter((el) => value.split(",").includes(el.id))
121
+ .filter((el) => value.split(",").includes(el.id?.toString?.()))
113
122
  .map((el) => el.sql || "false")
114
123
  .join(" and ") || "false";
115
124
  return { op: "=", query };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "2.0.44",
3
+ "version": "2.0.45",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [