@opengis/fastify-table 1.2.81 → 1.2.82

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.81",
3
+ "version": "1.2.82",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [
@@ -1,6 +1,7 @@
1
1
  import getPG from '../../pg/funcs/getPG.js';
2
2
  import getMeta from '../../pg/funcs/getMeta.js';
3
3
  import getRedis from '../../redis/funcs/getRedis.js';
4
+ import pgClients from '../../pg/pgClients.js';
4
5
 
5
6
  import extraData from '../../extra/extraData.js';
6
7
  import logChanges from './utils/logChanges.js';
@@ -11,6 +12,16 @@ export default async function dataDelete({
11
12
  table, tokenData, referer, id, pg: pg1, uid,
12
13
  }) {
13
14
  const pg = pg1 || getPG({ name: 'client' });
15
+
16
+ // pg client single transaction support
17
+ if (!pg.pk) {
18
+ pg.options = pgClients.client?.options;
19
+ pg.tlist = pgClients.client?.tlist;
20
+ pg.pgType = pgClients.client?.pgType;
21
+ pg.relkinds = pgClients.client?.relkinds;
22
+ pg.pk = pgClients.client?.pk;
23
+ }
24
+
14
25
  const { pk } = await getMeta({ pg, table });
15
26
  const table1 = table.replace(/"/g, '');
16
27
  if (!pg.tlist?.includes(table1)) return 'table not exist';
@@ -1,6 +1,7 @@
1
1
  import getPG from '../../pg/funcs/getPG.js';
2
2
  import getMeta from '../../pg/funcs/getMeta.js';
3
3
  import getRedis from '../../redis/funcs/getRedis.js';
4
+ import pgClients from '../../pg/pgClients.js';
4
5
 
5
6
  import logChanges from './utils/logChanges.js';
6
7
  import extraData from '../../extra/extraData.js';
@@ -11,6 +12,16 @@ export default async function dataInsert({
11
12
  id, table, tokenData, referer, data, pg: pg1, uid,
12
13
  }) {
13
14
  const pg = pg1 || getPG({ name: 'client' });
15
+
16
+ // pg client single transaction support
17
+ if (!pg.pk) {
18
+ pg.options = pgClients.client?.options;
19
+ pg.tlist = pgClients.client?.tlist;
20
+ pg.pgType = pgClients.client?.pgType;
21
+ pg.relkinds = pgClients.client?.relkinds;
22
+ pg.pk = pgClients.client?.pk;
23
+ }
24
+
14
25
  if (!data) return null;
15
26
  const { columns } = await getMeta({ pg, table });
16
27
  if (!columns) return null;
@@ -1,6 +1,7 @@
1
1
  import getPG from '../../pg/funcs/getPG.js';
2
2
  import getMeta from '../../pg/funcs/getMeta.js';
3
3
  import getRedis from '../../redis/funcs/getRedis.js';
4
+ import pgClients from '../../pg/pgClients.js';
4
5
 
5
6
  import extraData from '../../extra/extraData.js';
6
7
  import logChanges from './utils/logChanges.js';
@@ -24,6 +25,16 @@ export default async function dataUpdate({
24
25
  if (!data || !table || !id) return null;
25
26
 
26
27
  const pg = pg1 || getPG({ name: 'client' });
28
+
29
+ // pg client single transaction support
30
+ if (!pg.pk) {
31
+ pg.options = pgClients.client?.options;
32
+ pg.tlist = pgClients.client?.tlist;
33
+ pg.pgType = pgClients.client?.pgType;
34
+ pg.relkinds = pgClients.client?.relkinds;
35
+ pg.pk = pgClients.client?.pk;
36
+ }
37
+
27
38
  const { columns, pk } = await getMeta({ pg, table });
28
39
 
29
40
  const names = columns?.map((el) => el.name);