@procedures/sqlite 0.8.0 → 0.8.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.
- package/CHANGELOG.md +29 -0
- package/README.md +2 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/storage.d.ts +24 -1
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +35 -1
- package/dist/storage.js.map +1 -1
- package/package.json +5 -5
- package/src/storage.ts +51 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @procedures/sqlite
|
|
2
2
|
|
|
3
|
+
## 0.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1aa9ef7: The collection storages get a JSON query language with a query policy, change batches and patches in one step, and the sync of `@procedures/store` runs on the service clock and backoff (server stack CLI-20, CLI-14, CLI-13, CLI-34).
|
|
8
|
+
|
|
9
|
+
- The query language is in the core, in the new entry `@procedures/client/query`, which imports nothing else. It is the one copy (CLI-34). `@procedures/collections` now depends on `@procedures/client` for it, and exports the same names again.
|
|
10
|
+
- The selector is JSON: a subset of the query selectors of MongoDB. `queryEntries()` is the reference, and `selectorProblems()`, `queryOptionsProblems()`, `compileSelector()`, `matchesSelector()` and `compareStorageValues()` are exported.
|
|
11
|
+
- A query policy (`StorageQueryPolicy`) limits the operators, the length and the flags of a `$regex`, the clauses and the depth of a selector, the lists of `$in`, `$nin` and `$all`, and the limit. The default policy does not permit `$regex`. A pattern that repeats a repetition, for example `(a+)+`, is always an error.
|
|
12
|
+
- `CollectionStorage` of `@procedures/collections` has the optional `query(selector, { sort, skip, limit }, policy)`, `observe(observer)` and `patch(id, fields)`. A caller tests for each one. A storage without them still follows the contract.
|
|
13
|
+
- `observe()` gives one batch of `set`, `delete` and `clear` changes for each write that changes the storage, before the write resolves. The write methods take `{ origin }`, and each change has it.
|
|
14
|
+
- `patch()` takes a JSON Merge Patch (RFC 7386), or the operations `{ $set, $unset }`, which can set `null` and nested field paths. A patch that mixes the two forms is an error. `applyPatch()`, `mergePatch()` and `patchProblems()` are exported.
|
|
15
|
+
- `InMemoryStorage` has the three methods, and the options `queryPolicy` and `onObserverError`. `StorageListeners` is the set of listeners that the storages share.
|
|
16
|
+
- The contract suite of `@procedures/collections/testing` tests the selectors against `queryEntries()`, with fixed and random selectors, the refusal of `$regex` by default, and, with `createWithQueryPolicy`, the opt-in of `$regex` and each limit of a policy. It also tests the two forms of a patch, the patches at the same time, and the batches with their origins.
|
|
17
|
+
- The core collection procedures have `collections.<name>.find` (it reads) and `collections.<name>.patch` (it reads and writes, idempotent). `find` refuses a selector or a limit that the policy does not permit with `VALIDATION_ERROR` and the reason, and a `find` without a limit gets at most `DEFAULT_FIND_LIMIT` (1000) items. It gives the selector and the policy to `query()` of the storage, or runs it on the entries. `patch` uses `patch()` of the storage, or a read and a write, one patch of an id at a time.
|
|
18
|
+
- `createCollectionProcedures(name, { queryPolicy })` and `ProcedureServer.registerCollectionProcedures(name, { queryPolicy })` take the policy of the host.
|
|
19
|
+
- The `CollectionStorage` of the core has the same optional methods and the write options. Its new types are exported from the root, `./browser` and `./procedures`.
|
|
20
|
+
- `ApiStorage` has `query()` (the procedure `find`, or the entries of an older server) and `patch()` (the procedure `patch`). Its option `queryPolicy` adds limits of the client.
|
|
21
|
+
- `ApiStorage` waits `backoffDelay` of `@mark1russell7/service/backoff` between its tries, with full jitter, on the option `clock`. The timeout uses the clock too. The new options are `retryFactor`, `maxRetryDelay`, `retryJitter`, `clock` and `random`. An error with `retryAfterMs` gets at least that wait.
|
|
22
|
+
- `HybridStorage` has `query()` and the option `queryPolicy`. Its timers run on the option `clock`, and the delay after a failure grows with the option `backoff`. `getStatus()` and `onStatus()` give the state of the sync and its failures. The storage writes nothing to the console.
|
|
23
|
+
- `SyncedProcedureRegistry` takes the option `clock` for its auto-sync. Its status has the failures of the auto-sync and of the write-through writes, and `onStatus()` sends them.
|
|
24
|
+
- `SqliteStorage` has `query()`, `patch()` and the option `queryPolicy`. A patch runs in one transaction.
|
|
25
|
+
- `@procedures/store` depends on `@mark1russell7/service`, and `@procedures/collections` depends on `@procedures/client`.
|
|
26
|
+
- Updated dependencies [2d3f235]
|
|
27
|
+
- Updated dependencies [1aa9ef7]
|
|
28
|
+
- Updated dependencies [2523b1b]
|
|
29
|
+
- Updated dependencies [c559b00]
|
|
30
|
+
- @procedures/client@0.8.1
|
|
31
|
+
|
|
3
32
|
## 0.8.0
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -545,6 +545,8 @@ The engine `sqljs` writes the whole file at each write, so its write time grows
|
|
|
545
545
|
- A read gives a new copy of the item.
|
|
546
546
|
- `getIds()` gives the ids in the order of the items, and it does not read the values. A full sync of `HybridStorage` uses it.
|
|
547
547
|
- The order of the items is the order of the first write of each id, as in a `Map`.
|
|
548
|
+
- `query(selector, { sort, skip, limit })` runs a JSON selector of `@procedures/client/query` on the rows of one read. The procedure `collections.<name>.find` uses it. The option `queryPolicy` limits the calls without a policy, and the default policy does not permit `$regex`.
|
|
549
|
+
- `patch(id, fields)` changes the item in one transaction: a JSON Merge Patch, or the operations `$set` and `$unset`. Two processes that patch one item at the same time keep the fields of each.
|
|
548
550
|
|
|
549
551
|
### The change log and the versions
|
|
550
552
|
|