@asaidimu/utils-database 3.0.0 → 3.1.0

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.
Files changed (2) hide show
  1. package/README.md +16 -13
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -83,7 +83,7 @@ const db = await DatabaseConnection(
83
83
  enableTelemetry: true,
84
84
  predicates: {}, // custom validation predicates (optional)
85
85
  },
86
- createIndexedDbStore
86
+ createIndexedDbStore,
87
87
  );
88
88
  ```
89
89
 
@@ -171,7 +171,7 @@ await db.migrateCollection(
171
171
  },
172
172
  description: "Add active flag",
173
173
  },
174
- 100 // batch size (optional)
174
+ 100, // batch size (optional)
175
175
  );
176
176
  ```
177
177
 
@@ -199,7 +199,9 @@ const unsubDoc = doc.subscribe("document:update", (event) => {
199
199
 
200
200
  // Telemetry (when enableTelemetry: true)
201
201
  db.subscribe("telemetry", (event) => {
202
- console.log(`${event.method} took ${event.metadata.performance.durationMs}ms`);
202
+ console.log(
203
+ `${event.method} took ${event.metadata.performance.durationMs}ms`,
204
+ );
203
205
  });
204
206
  ```
205
207
 
@@ -291,10 +293,10 @@ For migrations: `migrateCollection` streams documents from the store, passes the
291
293
 
292
294
  ### Available Scripts
293
295
 
294
- | Command | Description |
295
- | ----------------- | -------------------------------------------------- |
296
- | `npm test` | Run tests once (Vitest) |
297
- | `npm run test:watch` | Run tests in watch mode |
296
+ | Command | Description |
297
+ | ---------------------- | ------------------------------------------------- |
298
+ | `npm test` | Run tests once (Vitest) |
299
+ | `npm run test:watch` | Run tests in watch mode |
298
300
  | `npm run test:browser` | Run tests in a real browser (Vitest browser mode) |
299
301
 
300
302
  ### Testing
@@ -323,12 +325,12 @@ Use the [GitHub issue tracker](https://github.com/asaidimu/erp-utils/issues) to
323
325
 
324
326
  ### Troubleshooting
325
327
 
326
- | Error | Likely cause & solution |
327
- | --------------------------------- | --------------------------------------------------------- |
328
- | `SCHEMA_NOT_FOUND` | The collection was not created. Call `createCollection` first. |
329
- | `CONFLICT` | Another operation updated the document. Re‑fetch and retry. |
330
- | `TRANSACTION_FAILED` | One of the batched writes failed. Check individual operations. |
331
- | `INVALID_DATA` | The document does not match the schema. Review validation errors. |
328
+ | Error | Likely cause & solution |
329
+ | -------------------- | ----------------------------------------------------------------- |
330
+ | `SCHEMA_NOT_FOUND` | The collection was not created. Call `createCollection` first. |
331
+ | `CONFLICT` | Another operation updated the document. Re‑fetch and retry. |
332
+ | `TRANSACTION_FAILED` | One of the batched writes failed. Check individual operations. |
333
+ | `INVALID_DATA` | The document does not match the schema. Review validation errors. |
332
334
 
333
335
  ### FAQ
334
336
 
@@ -355,6 +357,7 @@ This project is licensed under the **MIT License**. See the [LICENSE](https://gi
355
357
  ### Acknowledgments
356
358
 
357
359
  Built with ❤️ using:
360
+
358
361
  - [`@asaidimu/anansi`](https://github.com/asaidimu/anansi) – schema validation and migrations.
359
362
  - [`@standard-schema/spec`](https://github.com/standard-schema/standard-schema) – Standard Schema interoperability.
360
363
  - [`uuid`](https://github.com/uuidjs/uuid) – for v7 UUIDs.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asaidimu/utils-database",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "A collection of database utilities.",
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",