@opengis/fastify-table 1.0.89 → 1.0.90

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.
Files changed (49) hide show
  1. package/Changelog.md +4 -0
  2. package/crud/controllers/deleteCrud.js +19 -19
  3. package/crud/controllers/insert.js +54 -54
  4. package/crud/controllers/update.js +59 -59
  5. package/crud/funcs/dataInsert.js +24 -24
  6. package/crud/funcs/dataUpdate.js +24 -24
  7. package/crud/funcs/getAccess.js +53 -53
  8. package/crud/funcs/getOpt.js +10 -10
  9. package/crud/funcs/setOpt.js +16 -16
  10. package/helper.js +28 -28
  11. package/index.js +97 -97
  12. package/notification/controllers/userNotifications.js +19 -19
  13. package/notification/funcs/addNotification.js +8 -8
  14. package/package.json +1 -1
  15. package/pg/pgClients.js +20 -20
  16. package/policy/funcs/checkPolicy.js +83 -83
  17. package/policy/funcs/sqlInjection.js +33 -33
  18. package/policy/index.js +14 -14
  19. package/redis/client.js +8 -8
  20. package/redis/funcs/redisClients.js +2 -2
  21. package/redis/index.js +19 -19
  22. package/server/migrations/0.sql +78 -78
  23. package/server/templates/form/test.dataset.form.json +411 -411
  24. package/server/templates/table/test.dataset.table.json +28 -28
  25. package/server/templates/table/test.gis.map.table.json +44 -44
  26. package/table/controllers/data.js +103 -103
  27. package/table/controllers/suggest.js +79 -79
  28. package/table/controllers/table.js +49 -49
  29. package/table/controllers/utils/gisIRColumn.js +68 -68
  30. package/table/funcs/getFilterSQL/index.js +75 -75
  31. package/table/funcs/getFilterSQL/util/formatValue.js +142 -142
  32. package/table/funcs/getFilterSQL/util/getCustomQuery.js +13 -13
  33. package/table/funcs/getFilterSQL/util/getFilterQuery.js +73 -73
  34. package/table/funcs/getFilterSQL/util/getOptimizedQuery.js +12 -12
  35. package/table/funcs/getFilterSQL/util/getTableSql.js +34 -34
  36. package/table/funcs/metaFormat/getSelectVal.js +20 -20
  37. package/table/funcs/metaFormat/index.js +28 -28
  38. package/test/api/crud.test.js +88 -88
  39. package/test/api/table.test.js +89 -89
  40. package/util/controllers/logger.file.js +90 -0
  41. package/util/controllers/status.monitor.js +8 -8
  42. package/util/controllers/utils/checkUserAccess.js +19 -0
  43. package/util/controllers/utils/getRootDir.js +21 -0
  44. package/util/index.js +23 -21
  45. package/widget/controllers/utils/historyFormat.js +76 -76
  46. package/widget/controllers/utils/obj2db.js +13 -13
  47. package/widget/controllers/widget.del.js +44 -44
  48. package/widget/controllers/widget.get.js +96 -96
  49. package/widget/controllers/widget.set.js +70 -70
@@ -1,78 +1,78 @@
1
- -- fix error if function exists and return type not text i.e bigint
2
-
3
- do $$
4
-
5
- declare
6
- m record;
7
- _pk text;
8
- _tables json;
9
- _returnType text;
10
-
11
- begin
12
-
13
- select format_type(p.prorettype, null) as return_type
14
- from pg_proc p
15
- where p.proname = 'next_id'
16
- and p.pronamespace = 'public'::regnamespace into _returnType;
17
-
18
- if (_returnType != 'text') then
19
- raise notice 'default reassign start: % -> text', _returnType;
20
-
21
- CREATE EXTENSION if not exists "uuid-ossp";
22
-
23
- SELECT json_object_agg(a.attrelid::regclass, a.attname)
24
- FROM pg_catalog.pg_attribute a
25
- LEFT JOIN pg_catalog.pg_attrdef d ON (a.attrelid, a.attnum) = (d.adrelid, d.adnum)
26
- WHERE NOT a.attisdropped -- no dropped (dead) columns
27
- AND a.attnum > 0 -- no system columns
28
- AND pg_get_expr(d.adbin, d.adrelid) = 'next_id()' into _tables;
29
-
30
- FOR m in (select json_object_keys(_tables) as table) loop
31
- _pk = _tables->>m.table;
32
- raise notice 'drop default: %,%', m.table, _pk;
33
- EXECUTE('alter table '|| m.table || ' alter column ' || _pk || ' set default null;');
34
- end loop;
35
-
36
- DROP FUNCTION IF EXISTS next_id();
37
-
38
- CREATE EXTENSION if not exists "uuid-ossp";
39
-
40
- CREATE OR REPLACE FUNCTION next_id()
41
- RETURNS text AS
42
- $BODY$
43
- DECLARE
44
-
45
- BEGIN
46
- return replace(uuid_generate_v4()::text, '-', '');
47
- END;
48
- $BODY$
49
- LANGUAGE plpgsql VOLATILE
50
- COST 100;
51
-
52
- FOR m in (select json_object_keys(_tables) as table) loop
53
- _pk = _tables->>m.table;
54
- raise notice 'reassign default: %, %', m.table, _pk;
55
- EXECUTE('alter table '|| m.table || ' alter column ' || _pk || ' set default next_id();');
56
- end loop;
57
-
58
- raise notice 'reassign default finish: %', _tables;
59
-
60
- else
61
- raise notice 'skip default reassign';
62
-
63
- CREATE EXTENSION if not exists "uuid-ossp";
64
-
65
- CREATE OR REPLACE FUNCTION next_id()
66
- RETURNS text AS
67
- $BODY$
68
- DECLARE
69
-
70
- BEGIN
71
- return replace(uuid_generate_v4()::text, '-', '');
72
- END;
73
- $BODY$
74
- LANGUAGE plpgsql VOLATILE
75
- COST 100;
76
- end if;
77
-
78
- end $$
1
+ -- fix error if function exists and return type not text i.e bigint
2
+
3
+ do $$
4
+
5
+ declare
6
+ m record;
7
+ _pk text;
8
+ _tables json;
9
+ _returnType text;
10
+
11
+ begin
12
+
13
+ select format_type(p.prorettype, null) as return_type
14
+ from pg_proc p
15
+ where p.proname = 'next_id'
16
+ and p.pronamespace = 'public'::regnamespace into _returnType;
17
+
18
+ if (_returnType != 'text') then
19
+ raise notice 'default reassign start: % -> text', _returnType;
20
+
21
+ CREATE EXTENSION if not exists "uuid-ossp";
22
+
23
+ SELECT json_object_agg(a.attrelid::regclass, a.attname)
24
+ FROM pg_catalog.pg_attribute a
25
+ LEFT JOIN pg_catalog.pg_attrdef d ON (a.attrelid, a.attnum) = (d.adrelid, d.adnum)
26
+ WHERE NOT a.attisdropped -- no dropped (dead) columns
27
+ AND a.attnum > 0 -- no system columns
28
+ AND pg_get_expr(d.adbin, d.adrelid) = 'next_id()' into _tables;
29
+
30
+ FOR m in (select json_object_keys(_tables) as table) loop
31
+ _pk = _tables->>m.table;
32
+ raise notice 'drop default: %,%', m.table, _pk;
33
+ EXECUTE('alter table '|| m.table || ' alter column ' || _pk || ' set default null;');
34
+ end loop;
35
+
36
+ DROP FUNCTION IF EXISTS next_id();
37
+
38
+ CREATE EXTENSION if not exists "uuid-ossp";
39
+
40
+ CREATE OR REPLACE FUNCTION next_id()
41
+ RETURNS text AS
42
+ $BODY$
43
+ DECLARE
44
+
45
+ BEGIN
46
+ return replace(uuid_generate_v4()::text, '-', '');
47
+ END;
48
+ $BODY$
49
+ LANGUAGE plpgsql VOLATILE
50
+ COST 100;
51
+
52
+ FOR m in (select json_object_keys(_tables) as table) loop
53
+ _pk = _tables->>m.table;
54
+ raise notice 'reassign default: %, %', m.table, _pk;
55
+ EXECUTE('alter table '|| m.table || ' alter column ' || _pk || ' set default next_id();');
56
+ end loop;
57
+
58
+ raise notice 'reassign default finish: %', _tables;
59
+
60
+ else
61
+ raise notice 'skip default reassign';
62
+
63
+ CREATE EXTENSION if not exists "uuid-ossp";
64
+
65
+ CREATE OR REPLACE FUNCTION next_id()
66
+ RETURNS text AS
67
+ $BODY$
68
+ DECLARE
69
+
70
+ BEGIN
71
+ return replace(uuid_generate_v4()::text, '-', '');
72
+ END;
73
+ $BODY$
74
+ LANGUAGE plpgsql VOLATILE
75
+ COST 100;
76
+ end if;
77
+
78
+ end $$