@acodeninja/persist 3.0.0-next.18 → 3.0.0-next.19
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/README.md +2 -1
- package/package.json +1 -1
- package/src/Connection.js +6 -4
package/README.md
CHANGED
@@ -53,6 +53,7 @@ class Person extends Persist.Model {
|
|
53
53
|
|
54
54
|
```javascript
|
55
55
|
import Persist from '@acodeninja/persist';
|
56
|
+
import {S3Client} from "@aws-sdk/client-s3";
|
56
57
|
import S3StorageEngine from '@acodeninja/persist/storage/s3';
|
57
58
|
|
58
59
|
const engine = new S3StorageEngine({
|
@@ -75,7 +76,7 @@ await connection.put(person);
|
|
75
76
|
## Find out more
|
76
77
|
|
77
78
|
- [Defining Models](./docs/defining-models.md)
|
78
|
-
- [Model Property Types](./docs/model-properties)
|
79
|
+
- [Model Property Types](./docs/model-properties.md)
|
79
80
|
- [Models as Properties](./docs/models-as-properties.md)
|
80
81
|
- [Structured Queries](./docs/structured-queries.md)
|
81
82
|
- [Search Queries](./docs/search-queries.md)
|
package/package.json
CHANGED
package/src/Connection.js
CHANGED
@@ -272,7 +272,7 @@ export default class Connection {
|
|
272
272
|
if (!Object.keys(this.#models).includes(modelToProcess.constructor.name))
|
273
273
|
throw new ModelNotRegisteredConnectionError(modelToProcess, this.#storage);
|
274
274
|
|
275
|
-
const currentModel = modelCache[
|
275
|
+
const currentModel = modelCache[modelToProcess.id] ?? await this.get(modelToProcess.id);
|
276
276
|
modelCache[currentModel.id] = currentModel;
|
277
277
|
|
278
278
|
if (!modelsToDelete.includes(currentModel.id)) modelsToDelete.push(currentModel.id);
|
@@ -458,9 +458,11 @@ export default class Connection {
|
|
458
458
|
}
|
459
459
|
}
|
460
460
|
} catch (error) {
|
461
|
-
|
462
|
-
|
463
|
-
|
461
|
+
await Promise.all(
|
462
|
+
transactions
|
463
|
+
.filter(t => t.committed && t.original)
|
464
|
+
.map(t => this.#storage.putModel(t.original)),
|
465
|
+
);
|
464
466
|
|
465
467
|
throw new CommitFailedTransactionError(transactions, error);
|
466
468
|
}
|