@opengis/fastify-table 2.5.28 → 2.5.29
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":"logChanges.d.ts","sourceRoot":"","sources":["../../../../../../server/plugins/crud/funcs/utils/logChanges.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"logChanges.d.ts","sourceRoot":"","sources":["../../../../../../server/plugins/crud/funcs/utils/logChanges.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,2BAA2B,CAAC;AA4D5D,wBAA8B,UAAU,CAAC,EACvC,EAAE,EACF,KAAK,EAAE,MAAM,EACb,SAAS,EACT,OAAO,EACP,EAAE,EACF,IAAI,EACJ,GAAO,EACP,IAAI,GACL,EAAE;IACD,EAAE,EAAE,UAAU,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;CACd;;;;;;;;;;;;;;;;;;;;UAoNA"}
|
|
@@ -39,6 +39,12 @@ function getValue(val, tableName) {
|
|
|
39
39
|
if (["crm.files"].includes(tableName)) {
|
|
40
40
|
return typeof val === "object" ? JSON.stringify(val) : val;
|
|
41
41
|
}
|
|
42
|
+
if ((process.env.LOG_TABLE_CHANGES_JSON === "true" ||
|
|
43
|
+
config.LOG_TABLE_CHANGES_JSON) &&
|
|
44
|
+
val &&
|
|
45
|
+
typeof val === "object") {
|
|
46
|
+
return JSON.stringify(val);
|
|
47
|
+
}
|
|
42
48
|
return typeof val === "object"
|
|
43
49
|
? null
|
|
44
50
|
: val?.toString?.()?.substring?.(0, logLength);
|
|
@@ -112,23 +118,22 @@ export default async function logChanges({ pg, table: table1, tokenData, referer
|
|
|
112
118
|
[curr.name]: pg?.pgType?.[curr.dataTypeID],
|
|
113
119
|
}), {});
|
|
114
120
|
if (type !== "DELETE") {
|
|
115
|
-
Object.keys(row || {})
|
|
121
|
+
const newObj2 = Object.keys(row || {})
|
|
116
122
|
.filter((key) => !systemColumns.includes(key))
|
|
117
|
-
.reduce((acc, curr) => {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
});
|
|
123
|
+
.reduce((acc, curr) => ({
|
|
124
|
+
...acc,
|
|
125
|
+
[titles[curr] || curr]: columnTypes[curr] === "geometry"
|
|
126
|
+
? {}
|
|
127
|
+
: {
|
|
128
|
+
value: getValue(row[curr], table),
|
|
129
|
+
hash: typeof row[curr] === "boolean" || row[curr]
|
|
130
|
+
? createHash("md5")
|
|
131
|
+
.update(JSON.stringify(row[curr]))
|
|
132
|
+
.digest("hex")
|
|
133
|
+
: null,
|
|
134
|
+
},
|
|
135
|
+
}), {});
|
|
136
|
+
Object.assign(newObj1, newObj2);
|
|
132
137
|
}
|
|
133
138
|
await Promise.all(Object.keys(row || {})
|
|
134
139
|
.filter((key) => row[key] && columnTypes[key] === "geometry")
|
|
@@ -192,7 +197,7 @@ export default async function logChanges({ pg, table: table1, tokenData, referer
|
|
|
192
197
|
};
|
|
193
198
|
}
|
|
194
199
|
catch (err) {
|
|
195
|
-
console.error("logChanges error", type, table, id, data, err.toString());
|
|
200
|
+
console.error("logChanges error", type, table, id, data, err.toString(), err.stack);
|
|
196
201
|
return {
|
|
197
202
|
error: err.toString(),
|
|
198
203
|
entity_type: table,
|
package/dist/test.setup.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { beforeEach, afterEach, afterAll } from "vitest";
|
|
2
2
|
import { build, teardown } from "./helper.js";
|
|
3
|
+
const timeoutMs = process.platform === "win32" ? 500000 : 5000;
|
|
3
4
|
beforeEach(async () => {
|
|
4
5
|
if (process.env.trace === "true")
|
|
5
6
|
console.log("build after each bun test start...");
|
|
6
7
|
await build();
|
|
7
8
|
if (process.env.trace === "true")
|
|
8
9
|
console.log("build after each bun test finished");
|
|
9
|
-
});
|
|
10
|
+
}, timeoutMs);
|
|
10
11
|
afterEach(async () => {
|
|
11
12
|
if (process.env.trace === "true")
|
|
12
13
|
console.log("teardown after each bun test start...");
|
|
13
14
|
// await teardown();
|
|
14
15
|
if (process.env.trace === "true")
|
|
15
16
|
console.log("teardown after each bun test finished");
|
|
16
|
-
});
|
|
17
|
+
}, timeoutMs);
|
|
17
18
|
afterAll(async () => {
|
|
18
19
|
console.log("teardown after all bun test start...");
|
|
19
20
|
await teardown();
|