@sprucelabs/postgres-data-store 5.1.84 → 5.1.85
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.
|
@@ -28,8 +28,8 @@ export default class PostgresDatabase {
|
|
|
28
28
|
: `${this.idCount++}`;
|
|
29
29
|
}
|
|
30
30
|
update(collection, query, updates) {
|
|
31
|
-
var _a;
|
|
32
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
var _a;
|
|
33
33
|
const { sql, values } = this.queries.update(collection, query, updates, false);
|
|
34
34
|
const results = yield this.client.query({
|
|
35
35
|
text: sql,
|
|
@@ -93,15 +93,15 @@ export default class PostgresDatabase {
|
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
95
|
findOne(collection, query, options) {
|
|
96
|
-
var _a;
|
|
97
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
var _a;
|
|
98
98
|
const results = yield this.find(collection, query, Object.assign(Object.assign({}, options), { limit: 1 }));
|
|
99
99
|
return (_a = results[0]) !== null && _a !== void 0 ? _a : null;
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
delete(collection, query) {
|
|
103
|
-
var _a;
|
|
104
103
|
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
var _a;
|
|
105
105
|
const { sql, values } = this.queries.delete(collection, query);
|
|
106
106
|
const results = yield this.client.query({
|
|
107
107
|
text: sql,
|
|
@@ -160,8 +160,8 @@ export default class PostgresDatabase {
|
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
deleteOne(collection, query) {
|
|
163
|
-
var _a;
|
|
164
163
|
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
var _a;
|
|
165
165
|
if (!query.id) {
|
|
166
166
|
const match = yield this.findOne(collection, query, {
|
|
167
167
|
includeFields: ['id'],
|
|
@@ -230,8 +230,8 @@ export default class PostgresDatabase {
|
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
232
|
connect() {
|
|
233
|
-
var _a, _b, _c;
|
|
234
233
|
return __awaiter(this, void 0, void 0, function* () {
|
|
234
|
+
var _a, _b, _c;
|
|
235
235
|
this.client = new Client({
|
|
236
236
|
connectionString: this.connectionString,
|
|
237
237
|
});
|
|
@@ -347,8 +347,8 @@ export default class PostgresDatabase {
|
|
|
347
347
|
});
|
|
348
348
|
}
|
|
349
349
|
executeCreateIndex(collection, fields, isUnique) {
|
|
350
|
-
var _a, _b;
|
|
351
350
|
return __awaiter(this, void 0, void 0, function* () {
|
|
351
|
+
var _a, _b;
|
|
352
352
|
const indexName = this.generateIndexName(collection, fields);
|
|
353
353
|
const keys = this.generateKeyExpressions(fields);
|
|
354
354
|
const query = `CREATE ${isUnique ? `UNIQUE` : ''} INDEX ${indexName} ON "${collection}" (${keys})`;
|
|
@@ -412,8 +412,8 @@ export default class PostgresDatabase {
|
|
|
412
412
|
return result;
|
|
413
413
|
}
|
|
414
414
|
query(query, params) {
|
|
415
|
-
var _a;
|
|
416
415
|
return __awaiter(this, void 0, void 0, function* () {
|
|
416
|
+
var _a;
|
|
417
417
|
const results = yield this.client.query({
|
|
418
418
|
text: query,
|
|
419
419
|
values: params,
|
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"sprucebot",
|
|
23
23
|
"sprucelabs"
|
|
24
24
|
],
|
|
25
|
-
"version": "5.1.
|
|
25
|
+
"version": "5.1.85",
|
|
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",
|
|
@@ -52,17 +52,17 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@sprucelabs/data-stores": "^26.4.36",
|
|
55
|
-
"@sprucelabs/schema": "^29.4.
|
|
55
|
+
"@sprucelabs/schema": "^29.4.11",
|
|
56
56
|
"pg": "^8.11.3"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@sprucelabs/esm-postbuild": "^5.0.
|
|
60
|
-
"@sprucelabs/jest-json-reporter": "^7.0.
|
|
59
|
+
"@sprucelabs/esm-postbuild": "^5.0.162",
|
|
60
|
+
"@sprucelabs/jest-json-reporter": "^7.0.174",
|
|
61
61
|
"@sprucelabs/resolve-path-aliases": "^1.1.283",
|
|
62
62
|
"@sprucelabs/semantic-release": "^4.0.8",
|
|
63
63
|
"@sprucelabs/spruce-test-fixtures": "^52.8.0",
|
|
64
64
|
"@sprucelabs/test": "^8.0.41",
|
|
65
|
-
"@sprucelabs/test-utils": "^4.0.
|
|
65
|
+
"@sprucelabs/test-utils": "^4.0.109",
|
|
66
66
|
"@types/node": "^18.14.0",
|
|
67
67
|
"@types/pg": "^8.11.2",
|
|
68
68
|
"chokidar-cli": "^3.0.0",
|