@sprucelabs/postgres-data-store 3.0.8 → 3.1.1
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.
|
@@ -23,6 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const crypto_1 = require("crypto");
|
|
26
27
|
const data_stores_1 = require("@sprucelabs/data-stores");
|
|
27
28
|
const schema_1 = require("@sprucelabs/schema");
|
|
28
29
|
const pg_1 = require("pg");
|
|
@@ -38,7 +39,9 @@ class PostgresDatabase {
|
|
|
38
39
|
throw new Error('Method not implemented.');
|
|
39
40
|
}
|
|
40
41
|
generateId() {
|
|
41
|
-
return
|
|
42
|
+
return process.env.POSTGRES_ID_FORMAT === 'uuid'
|
|
43
|
+
? (0, crypto_1.randomUUID)()
|
|
44
|
+
: `${this.idCount++}`;
|
|
42
45
|
}
|
|
43
46
|
async update(collection, query, updates) {
|
|
44
47
|
const { sql, values } = this.queries.update(collection, query, updates, false);
|
|
@@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
import { randomUUID } from 'crypto';
|
|
10
11
|
import { DataStoresError, } from '@sprucelabs/data-stores';
|
|
11
12
|
import { assertOptions } from '@sprucelabs/schema';
|
|
12
13
|
import { Client } from 'pg';
|
|
@@ -22,7 +23,9 @@ export default class PostgresDatabase {
|
|
|
22
23
|
throw new Error('Method not implemented.');
|
|
23
24
|
}
|
|
24
25
|
generateId() {
|
|
25
|
-
return
|
|
26
|
+
return process.env.POSTGRES_ID_FORMAT === 'uuid'
|
|
27
|
+
? randomUUID()
|
|
28
|
+
: `${this.idCount++}`;
|
|
26
29
|
}
|
|
27
30
|
update(collection, query, updates) {
|
|
28
31
|
return __awaiter(this, void 0, void 0, function* () {
|
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"sprucebot",
|
|
23
23
|
"sprucelabs"
|
|
24
24
|
],
|
|
25
|
-
"version": "3.
|
|
25
|
+
"version": "3.1.1",
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build.ci": "yarn build.tsc && yarn build.resolve-paths && yarn lint",
|
|
28
28
|
"build.dev": "yarn build.tsc --sourceMap ; yarn resolve-paths.lint",
|
|
@@ -51,18 +51,18 @@
|
|
|
51
51
|
"watch.tsc": "tsc -w"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@sprucelabs/data-stores": "^23.0.
|
|
55
|
-
"@sprucelabs/schema": "^28.6.
|
|
54
|
+
"@sprucelabs/data-stores": "^23.0.6",
|
|
55
|
+
"@sprucelabs/schema": "^28.6.4",
|
|
56
56
|
"pg": "^8.10.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@sprucelabs/esm-postbuild": "^4.0.
|
|
60
|
-
"@sprucelabs/jest-json-reporter": "^7.0.
|
|
61
|
-
"@sprucelabs/resolve-path-aliases": "^1.1.
|
|
59
|
+
"@sprucelabs/esm-postbuild": "^4.0.5",
|
|
60
|
+
"@sprucelabs/jest-json-reporter": "^7.0.21",
|
|
61
|
+
"@sprucelabs/resolve-path-aliases": "^1.1.206",
|
|
62
62
|
"@sprucelabs/semantic-release": "^4.0.8",
|
|
63
63
|
"@sprucelabs/spruce-test-fixtures": "^52.8.0",
|
|
64
|
-
"@sprucelabs/test": "^7.7.
|
|
65
|
-
"@sprucelabs/test-utils": "^3.4.
|
|
64
|
+
"@sprucelabs/test": "^7.7.436",
|
|
65
|
+
"@sprucelabs/test-utils": "^3.4.33",
|
|
66
66
|
"@types/node": "^18.14.0",
|
|
67
67
|
"@types/pg": "^8.6.6",
|
|
68
68
|
"chokidar-cli": "^3.0.0",
|