@opengis/fastify-table 1.1.82 → 1.1.84

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/README.md CHANGED
@@ -1,26 +1,26 @@
1
- # fastify-table
2
-
3
- [![NPM version](https://img.shields.io/npm/v/@opengis/fastify-table)](https://www.npmjs.com/package/@opengis/fastify-table)
4
- [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)
5
-
6
- It standardizes the entire form building process, while taking care of everything from rendering to validation and processing:
7
-
8
- - pg
9
- - redis
10
- - crud
11
-
12
- ## Install
13
-
14
- ```bash
15
- npm i @opengis/fastify-table
16
- ```
17
-
18
- ## Usage
19
-
20
- ```js
21
- fastify.register(import('@opengis/fastify-table'), config);
22
- ```
23
-
24
- ## Documenation
25
-
26
- For a detailed understanding fastify-table, its features, and how to use them, refer to our [Documentation](https://apidocs.softpro.ua/gis.storage/).
1
+ # fastify-table
2
+
3
+ [![NPM version](https://img.shields.io/npm/v/@opengis/fastify-table)](https://www.npmjs.com/package/@opengis/fastify-table)
4
+ [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)
5
+
6
+ It standardizes the entire form building process, while taking care of everything from rendering to validation and processing:
7
+
8
+ - pg
9
+ - redis
10
+ - crud
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ npm i @opengis/fastify-table
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ ```js
21
+ fastify.register(import('@opengis/fastify-table'), config);
22
+ ```
23
+
24
+ ## Documenation
25
+
26
+ For a detailed understanding fastify-table, its features, and how to use them, refer to our [Documentation](https://apidocs.softpro.ua/gis.storage/).
package/config.js CHANGED
@@ -1,10 +1,10 @@
1
- import fs from 'fs';
2
-
3
- const fileName = ['config.json', '/data/local/config.json'].find(el => (fs.existsSync(el) ? el : null));
4
- const config = fileName ? JSON.parse(fs.readFileSync(fileName)) : {};
5
-
6
- Object.assign(config, {
7
- allTemplates: config?.allTemplates || {},
8
- });
9
-
10
- export default config;
1
+ import fs from 'fs';
2
+
3
+ const fileName = ['config.json', '/data/local/config.json'].find(el => (fs.existsSync(el) ? el : null));
4
+ const config = fileName ? JSON.parse(fs.readFileSync(fileName)) : {};
5
+
6
+ Object.assign(config, {
7
+ allTemplates: config?.allTemplates || {},
8
+ });
9
+
10
+ export default config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "1.1.82",
3
+ "version": "1.1.84",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "main": "index.js",
@@ -62,9 +62,15 @@ alter table admin.routes DROP CONSTRAINT if exists admin_route_id_pkey cascade;
62
62
  alter table admin.routes DROP constraint if exists admin_route_menu_id_fkey cascade;
63
63
  alter table admin.routes DROP constraint if exists admin_route_alias_query_unique cascade;
64
64
 
65
- alter table admin.routes add column if not exists route_id text NOT NULL default next_id();
66
- alter table admin.routes add column if not exists alias text NOT NULL;
67
- alter table admin.routes add column if not exists table_name text NOT NULL;
65
+ alter table admin.routes add column if not exists route_id text;
66
+ alter table admin.routes alter column route_id set not null;
67
+ alter table admin.routes alter column route_id set default next_id();
68
+ alter table admin.routes add column if not exists alias text;
69
+ alter table admin.routes alter column alias drop not null;
70
+ -- alter table admin.routes alter column alias set not null;
71
+ alter table admin.routes add column if not exists table_name text;
72
+ alter table admin.routes alter column table_name drop not null;
73
+ -- alter table admin.routes alter column table_name set not null;
68
74
  alter table admin.routes add column if not exists query text;
69
75
  alter table admin.routes add column if not exists actions text[];
70
76
  alter table admin.routes add column if not exists access text;
@@ -75,7 +81,10 @@ alter table admin.routes add column if not exists uid text;
75
81
  alter table admin.routes add column if not exists editor_id text;
76
82
  alter table admin.routes add column if not exists editor_date timestamp without time zone;
77
83
  alter table admin.routes add column if not exists cdate timestamp without time zone DEFAULT now();
78
- alter table admin.routes add column if not exists enabled boolean NOT NULL DEFAULT true;
84
+ alter table admin.routes alter column cdate set DEFAULT now();
85
+ alter table admin.routes add column if not exists enabled boolean;
86
+ alter table admin.routes alter column enabled set NOT NULL;
87
+ alter table admin.routes alter column enabled set DEFAULT true;
79
88
 
80
89
  alter table admin.routes add CONSTRAINT admin_route_id_pkey PRIMARY KEY (route_id);
81
90
  alter table admin.routes add constraint admin_route_menu_id_fkey FOREIGN KEY (menu_id) REFERENCES admin.menu(menu_id);
@@ -133,16 +133,16 @@ function formatValue({
133
133
 
134
134
  if (['~', '='].includes(operator)) {
135
135
  const operator1 = (filterType === 'text' && (filter?.id || filter?.name) && operator === '=' ? '~' : operator);
136
- const match = operator1 === '=' ? `='${value}'` : `ilike '%${value}%'`;
136
+ const match = (operator1 === '=' || filterType === 'autocomplete') ? `='${value}'` : `ilike '%${value}%'`;
137
137
  if (extra && pk) {
138
138
  const query = data && sql
139
- ? `${pk} in (select object_id from crm.extra_data where property_key='${name}' and value_text in ( ( with q(id,name) as (${sql}) select id from q where name ${match})))`
139
+ ? `${pk} in (select object_id from crm.extra_data where property_key='${name}' and value_text in ( ( with q(id,name) as (${sql}) select id from q where ${filterType === 'autocomplete' ? 'id' : 'name'} ${match})))`
140
140
  : `${pk} in (select object_id from crm.extra_data where property_key='${name}' and value_text ${match})`;
141
141
  return { op: 'ilike', query, extra };
142
142
  }
143
143
 
144
144
  const query = filter?.data && filter?.sql
145
- ? `${filter?.name || filter?.id} in ( ( with q(id,name) as (${filter?.sql}) select id from q where name::text ${match}) )` // filter with cls
145
+ ? `${filter?.name || filter?.id} in ( ( with q(id,name) as (${filter?.sql}) select id from q where ${filterType === 'autocomplete' ? 'id' : 'name'}::text ${match}) )` // filter with cls
146
146
  : `${name}::text ${match}`; // simple filter
147
147
  // console.log(query);
148
148
  return { op: 'ilike', query };