@opengis/fastify-table 2.0.142 → 2.0.143

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.
@@ -59,7 +59,7 @@ export default async function dataDelete({ table: table1, tokenData, referer, id
59
59
  type: "DELETE",
60
60
  });
61
61
  if (config.redis) {
62
- rclient.incr(`pg:${table}:crud`);
62
+ rclient.incr(`pg:${client.options?.database}:${table}:crud`);
63
63
  }
64
64
  if (!isClient) {
65
65
  await client.query("commit;");
@@ -106,7 +106,7 @@ export default async function dataInsert({ id, table: table1, referer, data, pg:
106
106
  type: "INSERT",
107
107
  });
108
108
  if (config.redis && rclient?.status !== "end") {
109
- rclient.incr(`pg:${table}:crud`);
109
+ rclient.incr(`pg:${client.options?.database}:${table}:crud`);
110
110
  }
111
111
  if (!isClient) {
112
112
  await client.query("commit;");
@@ -172,7 +172,7 @@ export default async function dataUpdate({ table: table1, tokenData, referer, id
172
172
  type: "UPDATE",
173
173
  });
174
174
  if (config.redis && rclient?.status !== "end") {
175
- rclient.incr(`pg:${table}:crud`);
175
+ rclient.incr(`pg:${client.options?.database}:${table}:crud`);
176
176
  }
177
177
  if (!isClient) {
178
178
  await client.query("commit;");
@@ -120,7 +120,7 @@ export default async function dataUpsert({ id, table: table1, referer, data, pg:
120
120
  type: "UPSERT",
121
121
  });
122
122
  if (config.redis) {
123
- rclient.incr(`pg:${table}:crud`);
123
+ rclient.incr(`pg:${client.options?.database}:${table}:crud`);
124
124
  }
125
125
  if (!isClient) {
126
126
  await client.query("commit;");
@@ -145,11 +145,11 @@ async function init(client) {
145
145
  return data;
146
146
  }
147
147
  // CRUD table state
148
- const keyCacheTable = `pg:${table}:crud`;
148
+ const keyCacheTable = `pg:${client?.database}:${table}:crud`;
149
149
  const crudInc = table && config.redis ? (await rclient.get(keyCacheTable)) || 0 : 0;
150
150
  //
151
151
  const hash = createHash("sha1")
152
- .update([q, JSON.stringify(args)].join())
152
+ .update([q, client?.database, JSON.stringify(args)].join())
153
153
  .digest("base64");
154
154
  const keyCache = `pg:${hash}:${crudInc}`;
155
155
  const cacheData = config.redis ? await rclient.get(keyCache) : null;
@@ -1 +1 @@
1
- {"version":3,"file":"getSelectVal.d.ts","sourceRoot":"","sources":["../../../../../../server/plugins/table/funcs/metaFormat/getSelectVal.ts"],"names":[],"mappings":"AAaA,wBAA8B,YAAY,CAAC,EACzC,EAAqB,EACrB,IAAI,EACJ,MAAM,EAAE,YAAY,EACpB,EAAU,GACX,EAAE,GAAG,gBA6GL"}
1
+ {"version":3,"file":"getSelectVal.d.ts","sourceRoot":"","sources":["../../../../../../server/plugins/table/funcs/metaFormat/getSelectVal.ts"],"names":[],"mappings":"AAaA,wBAA8B,YAAY,CAAC,EACzC,EAAqB,EACrB,IAAI,EACJ,MAAM,EAAE,YAAY,EACpB,EAAU,GACX,EAAE,GAAG,gBA+GL"}
@@ -38,7 +38,9 @@ export default async function getSelectVal({ pg = pgClients.client, name, values
38
38
  ?.split?.(" from ")
39
39
  ?.filter?.((el) => /^[a-z0-9_]+\.[a-z0-9_]+/.test(el))
40
40
  ?.map?.((el) => el.split(/[ )]/)[0])?.[0];
41
- const crudInc = table && config.redis ? (await rclient.get(`pg:${table}:crud`)) || 0 : 0;
41
+ const crudInc = table && config.redis
42
+ ? (await rclient.get(`pg:${pg.options?.database}:${table}:crud`)) || 0
43
+ : 0;
42
44
  const key = `select:${name}:${crudInc}`;
43
45
  const cache = values?.length && config.redis && !config.disableCache
44
46
  ? (await rclient.hmget(key, values)).reduce((p, el, i) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "2.0.142",
3
+ "version": "2.0.143",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [