@owlmeans/resource 0.1.18-rc.7 → 0.1.18-rc.8

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 CHANGED
@@ -4,10 +4,14 @@ Abstract CRUD interface and types for all data persistence in OwlMeans applicati
4
4
 
5
5
  ## Overview
6
6
 
7
- - `Resource<T>` interface: `get`, `load`, `list`, `save`, `create`, `update`, `delete`, `pick`
7
+ - `Resource<T>` interface: `get`, `load`, `list`, `count`, `create`, `update`, `save`, `delete`,
8
+ `take`, `purge`
8
9
  - `ResourceRecord` base type (`{ id?: string }`) that all stored records extend
9
10
  - `ResourceMaker<R, T>` factory signature used by `makeMongoResource`, `createStateResource`, etc.
10
- - `ListResult<T>`, `ListOptions`, `ListPager` for paginated queries
11
+ - `Criteria<T>` and `Sort<T>` — one query language every backend speaks — plus `ListOptions<T>`,
12
+ `ListQuery<T>` and `ListResult<T>`
13
+ - Optional capabilities a backend composes in: `PubSubResource`, `WatchableResource`,
14
+ `StreamResource`, `LockableResource`, `MigratableResource`
11
15
  - Error classes: `ResourceError`, `UnknownRecordError`, `RecordExists`
12
16
 
13
17
  ## Installation
@@ -31,7 +35,7 @@ interface ProjectRecord extends ResourceRecord {
31
35
  }
32
36
 
33
37
  export const makeProjectResource: ResourceMaker<ProjectRecord> = (dbAlias, serviceAlias) => {
34
- return makeMongoResource<ProjectRecord>('project', dbAlias, serviceAlias, makeProjectResource)
38
+ return makeMongoResource<ProjectRecord>('project', dbAlias, serviceAlias, 'projects')
35
39
  }
36
40
  ```
37
41
 
@@ -41,31 +45,75 @@ Use resource methods in a handler:
41
45
  import { UnknownRecordError } from '@owlmeans/resource'
42
46
  import type { ListResult } from '@owlmeans/resource'
43
47
 
44
- // Get or throw
48
+ // Get or throw — by id, or by whatever set of fields identifies the record
45
49
  const project = await ctx.project().get(projectId)
50
+ const byName = await ctx.project().get({ entityId, alias: 'main' })
46
51
 
47
52
  // Load (returns null if not found)
48
53
  const story = await ctx.story().load(storyId)
49
54
 
50
- // List with criteria and pagination
51
- const result: ListResult<ProjectRecord> = await ctx.project().list({
52
- criteria: { entityId: req.auth!.entityId },
53
- pager: { page: 0, size: 20 }
54
- })
55
+ // List with criteria, sorting and paging
56
+ const result: ListResult<ProjectRecord> = await ctx.project().list(
57
+ { entityId, alias: ['main', 'staging'] },
58
+ { sort: [{ field: 'createdAt', order: 'desc' }], page: 0, size: 20 }
59
+ )
55
60
  ```
56
61
 
57
62
  ## API
58
63
 
59
64
  ### `Resource<T>` methods
60
65
 
61
- - `get(id, field?, opts?)` — fetch by ID; throws `UnknownRecordError` if missing
62
- - `load(id, field?, opts?)` — fetch by ID; returns `null` if missing
63
- - `list(criteria?, opts?)` — paginated list; returns `ListResult<T>`
64
- - `create(record, opts?)` — insert; throws `RecordExists` if already exists
65
- - `save(record, opts?)` — upsert by ID
66
- - `update(record, opts?)` — update; throws `UnknownRecordError` if missing
67
- - `delete(id, opts?)` — remove; returns the deleted record or `null`
68
- - `pick(id, opts?)` — **delete and return** the record; throws `UnknownRecordError` if missing. Never use it for read-only checks
66
+ Every read takes either an id or a criteria object, so fetching one record by several fields is a
67
+ single call rather than a list whose first element is taken.
68
+
69
+ - `get(id)` / `get(where, { sort })` — fetch one; throws `UnknownRecordError` if missing
70
+ - `load(id)` / `load(where, { sort })` — fetch one; returns `null` if missing
71
+ - `list(where?, { sort, page, size })` — returns `ListResult<T>`
72
+ - `count(where?)` — how many records the criteria match
73
+ - `create(record, { ttl })` — insert; throws `RecordExists` if already exists
74
+ - `update(record, { ttl })` — replaces the whole record; throws `UnknownRecordError` if missing
75
+ - `save(record, { ttl })` — creates when the record carries no id, replaces otherwise
76
+ - `delete(id)` — remove; returns the deleted record or `null`
77
+ - `take(id)` — **delete and return** the record; throws `UnknownRecordError` if missing. Never use it
78
+ for read-only checks
79
+ - `purge(where)` — bulk delete; refuses an empty criteria object rather than emptying the resource
80
+
81
+ `ttl` is seconds from now or the instant to expire at; backends without expiry refuse it.
82
+
83
+ ### `Criteria<T>`
84
+
85
+ Keys are the record's own fields, so a typo is a compile error; a dotted key reaches into a nested
86
+ value or a jsonb column and stays open.
87
+
88
+ - A bare value is equality, a bare **array** is "any of these", `null` asks for the absence of a
89
+ value, and `undefined` is **skipped** — an untouched filter must never empty a list
90
+ - Operators: `$eq` `$ne` `$gt` `$gte` `$lt` `$lte` `$in` `$nin` `$exists` `$null` `$like` `$ilike`
91
+ `$regex` `$startsWith` `$endsWith` `$between` `$contains` `$contained` `$overlaps`
92
+ - Composition: `$and`, `$or`, `$not`
93
+
94
+ ```typescript
95
+ await ctx.project().list({
96
+ status: ['active', 'paused'],
97
+ archivedAt: null,
98
+ 'meta.tier': { $in: ['gold', 'silver'] },
99
+ $or: [{ ownerId }, { shared: true }]
100
+ })
101
+ ```
102
+
103
+ ### `Sort<T>`
104
+
105
+ A bare field name sorts ascending; `{ field, order: 'asc' | 'desc' }` states it explicitly. `sort`
106
+ takes a list, applied left to right.
107
+
108
+ ### `ListResult<T>` and paging
109
+
110
+ `list()` answers `{ items, total, page?, size? }`.
111
+
112
+ Paging is opt-in per call and each backend decides what an unasked-for page means. Mongo and
113
+ Postgres cap an unbounded read at **100** records when no `size` is given; Redis and the in-memory
114
+ stores (state, static, client and config resources) return everything. `size: 0` means **no limit**
115
+ everywhere. Asking for a `page` without a `size` on an unpaged backend throws
116
+ `UnsupportedArgumentError('page-without-size')`.
69
117
 
70
118
  ### `ResourceMaker<R, T>`
71
119
 
@@ -75,14 +123,40 @@ interface ResourceMaker<R extends ResourceRecord, T extends Resource<R> = Resour
75
123
  }
76
124
  ```
77
125
 
126
+ ### Optional capabilities
127
+
128
+ A backend composes in only what it can honour; the base `Resource<T>` contract stays small.
129
+
130
+ - `PubSubResource<T>` — `publish(value, channel?)`, `subscribe(handler, { channel?, once?, ttl? })`
131
+ - `WatchableResource<T>` — `watch(id, handler, opts?)`, following ONE record
132
+ - `StreamResource<T>` — `stream(key, value)` and `consume(key, { group?, consumer?, block? })`
133
+ - `LockableResource<T>` — `lock(record, fields?)` / `unlock(record, fields?)` for field level
134
+ encryption at rest
135
+ - `MigratableResource<Tx, Self>` — see below
136
+
137
+ ### In-memory query engine
138
+
139
+ The same criteria and sorting, evaluated over plain arrays. Every in-memory store uses these, and so
140
+ can application code that has already loaded its records:
141
+
142
+ - `matchCriteria(record, where)` — does one record satisfy the criteria
143
+ - `filterRecords(records, where)` / `sortRecords(records, sort)`
144
+ - `firstMatch(records, where, opts?)` — the `load(where)` semantics
145
+ - `applyQuery(records, query)` — filter, sort and page in one step, answering a `ListResult`
146
+
147
+ ### Database naming
148
+
149
+ `dbName()` answers `config.schema ?? config.alias ?? service.alias` — the database (or schema) a
150
+ resource reads and writes.
151
+
78
152
  ### Migration framework
79
153
 
80
154
  Storage-agnostic and optional — a backend that supports code migrations (mongo, postgres)
81
- extends `MigratableResource<Tx>`; backends with nothing to migrate simply don't (the same way
155
+ extends `MigratableResource<Tx, Self>`; backends with nothing to migrate simply don't (the same way
82
156
  pub/sub is an optional capability of redis resources). Migrations run **automatically during
83
157
  resource initialization** (app setup) — registering one is all an app ever does.
84
158
 
85
- - `MigratableResource<Tx>` — `migration(name, apply, stage?): this` + `migrations()`
159
+ - `MigratableResource<Tx, Self>` — `migration(name, apply, stage?): Self` + `migrations()`
86
160
  - `createMigrationRegistry<Tx>()` — per-alias ledger of registered migrations; declaration
87
161
  order is application order; identical re-registration is a no-op, a changed body under a
88
162
  used name throws `MigrationConflict`
@@ -97,8 +171,8 @@ resource initialization** (app setup) — registering one is all an app ever doe
97
171
 
98
172
  ### Helpers
99
173
 
100
- - `prepareListOptions(defPageSize, criteria?, opts?)` — normalize list criteria + pager
101
174
  - `filterObject(obj, keep?)` — strip null/undefined fields from a record before saving
175
+ - `createListSchema(schema)` — the AJV schema for a `ListResult` of the given record schema
102
176
  - `createDbService(alias, override, init?)` — base plumbing for `ResourceDbService` implementations
103
177
 
104
178
  ### Error Classes
@@ -106,15 +180,20 @@ resource initialization** (app setup) — registering one is all an app ever doe
106
180
  - `ResourceError` — base resource error
107
181
  - `UnknownRecordError` — record not found (has `.id` getter)
108
182
  - `RecordExists` — duplicate record on `create`
183
+ - `RecordUpdateFailed` — a write reached the backend but changed nothing
109
184
  - `MisshapedRecord` — invalid record structure
185
+ - `UnsupportedArgumentError` — an argument this backend cannot honour, e.g. `page-without-size`
186
+ - `UnsupportedMethodError` — a method this backend does not implement
110
187
  - `MigrationError` — a migration body threw; initialization aborts
111
188
  - `MigrationConflict` — an already applied migration's body changed, or a name was redeclared with a different body
112
189
 
113
190
  ## Related Packages
114
191
 
115
192
  - [`@owlmeans/mongo-resource`](../mongo-resource) — MongoDB implementation
193
+ - [`@owlmeans/postgres-resource`](../postgres-resource) — PostgreSQL implementation
116
194
  - [`@owlmeans/redis-resource`](../redis-resource) — Redis implementation
117
- - [`@owlmeans/state`](../state) — in-memory implementation for client state
195
+ - [`@owlmeans/static-resource`](../static-resource) — in-memory implementation over config records
196
+ - [`@owlmeans/state`](../state) — the client store, with live subscriptions
118
197
 
119
198
  <!-- owlmeans:agent-guidance:start -->
120
199
  ## Agent guidance
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/resource",
4
- "version": "0.1.18-rc.7",
5
- "generatedAt": "2026-08-24T21:14:00.098Z",
4
+ "version": "0.1.18-rc.8",
5
+ "generatedAt": "2026-09-01T16:28:56.985Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -8,20 +8,25 @@ user-invocable: false
8
8
  # @owlmeans/resource
9
9
 
10
10
  **Layer:** Core
11
- **Install:** `"@owlmeans/resource": "^0.1.18-rc.7"` in `dependencies`
11
+ **Install:** `"@owlmeans/resource": "^0.1.18-rc.8"` in `dependencies`
12
12
 
13
13
  ## Key Exports
14
14
 
15
15
  | Export | Description |
16
16
  |--------|-------------|
17
- | `Resource<T>` | Generic resource contract: `get`/`load`/`list`/`save`/`create`/`update`/`delete`/`pick`. `list(criteria?, opts?)` paginates through `opts.pager: { page, size, sort }` — there is no `limit`. |
18
- | `MigratableResource<Tx>` | **Optional migration capability** — `migration(name, apply, stage?)` (chainable) + `migrations()`. Optional the way pub/sub is on redis resources: mongo and postgres extend it, backends with nothing to migrate don't. |
17
+ | `Resource<T>` | Generic resource contract: `get`/`load`/`list`/`count`/`create`/`update`/`save`/`delete`/`take`/`purge`. Reads take **an id or a criteria object**; `list(where?, opts?)` takes `{ page, size, sort }` flat in the second argument. |
18
+ | `Criteria<T>`, `FieldCriteria<V>`, `FieldOperators<V>` | The query language, typed by the record — a mistyped field is a compile error. |
19
+ | `Sort<T>`, `SortField<T>`, `FirstOptions<T>`, `ListOptions<T>`, `ListQuery<T>`, `ListResult<T>` | Ordering, the read options, the one-object form an API carries over the wire, and the answer shape `{ items, total, page?, size? }`. |
20
+ | `WriteOptions`, `Ttl` | `{ ttl }` on `create`/`update`/`save`; seconds from now, or the instant to expire at. Backends without expiry refuse it. |
21
+ | `matchCriteria`, `filterRecords`, `sortRecords`, `firstMatch`, `applyQuery` | The shared in-memory engine — one criteria object means the same thing in a browser store as it does in SQL. |
22
+ | `PubSubResource<T>`, `WatchableResource<T>`, `StreamResource<T>`, `LockableResource<T>` | **Optional capabilities**, composed into a concrete resource interface alongside `Resource<T>`. |
23
+ | `MigratableResource<Tx, Self>` | **Optional migration capability** — `migration(name, apply, stage?)` (chainable) + `migrations()`. Optional the way pub/sub is on redis resources: mongo and postgres extend it, backends with nothing to migrate don't. |
19
24
  | `Migration`, `MigrationRegistry`, `MigrationStore`, `MigrationReport`, `MigrationRunOptions` | The framework's contracts. `MigrationStore` is the *migration register* a database implements to track applied migrations (`ensure`/`applied`/`baseline`/`run`). |
20
25
  | `createMigrationRegistry<Tx>()` | Storage-agnostic ledger of code-registered migrations per alias. Declaration order = application order; re-registering an identical body is a no-op, a changed body under a used name throws `MigrationConflict`. |
21
26
  | `runMigrations(alias, registry, store, opts?)` | Apply one stage's pending migrations through a store. `baseline: true` records instead of running (fresh structures); `strictChecksum` (default on) rejects edited applied bodies. |
22
27
  | `MigrationStage` | `Pre` (before structure reconciliation — renames, casts, rescues) / `Post` (after — backfills into new structure). |
23
- | `createDbService` | Base for `ResourceDbService` implementations (config/alias/name/client plumbing). |
24
- | `prepareListOptions`, `filterObject`, `createListSchema` | List/criteria helpers. |
28
+ | `createDbService` | Base for `ResourceDbService` implementations (config/alias/name/client plumbing). `dbName()` is `config.schema ?? config.alias ?? service.alias`. |
29
+ | `filterObject`, `createListSchema` | Drop null properties; the AJV schema for a `ListResult<T>` envelope. |
25
30
  | Errors | `ResourceError`, `UnknownRecordError`, `MisshapedRecord`, `RecordExists`, `RecordUpdateFailed`, `UnsupportedArgumentError`, `UnsupportedMethodError`, `MigrationError`, `MigrationConflict`. |
26
31
  | `DbConfig`, `Config`, `Context` | Database config (`cfg.dbs`) types. |
27
32
 
@@ -35,17 +40,18 @@ A resource is a typed CRUD-over-records abstraction. Concrete implementations co
35
40
  ```typescript
36
41
  import type { Resource } from '@owlmeans/resource'
37
42
 
38
- interface Project { id: string; name: string; entityId: string }
43
+ interface Project { id: string; name: string; entityId: string; createdAt: Date }
39
44
  const projects = ctx.resource<Resource<Project>>('projects')
40
- const { items } = await projects.list({ entityId: 'abc' })
41
-
42
- // Pagination and sort ride under `pager` in the SECOND argument — there is NO `limit`,
43
- // and neither `page` nor `size` exists at the top level of either argument:
44
- const page2 = await projects.list(
45
- { entityId: 'abc' },
46
- { pager: { page: 1, size: 20, sort: ['createdAt'] } }
47
- )
48
- // page2.pager echoes { page, size, total } for building pagination UI.
45
+
46
+ // A read is addressed by an id OR by criteria — fetching one record by several fields is a
47
+ // single call, never a list whose first element is taken.
48
+ const project = await projects.get('abc123')
49
+ const newest = await projects.load({ entityId: 'abc' }, { sort: [{ field: 'createdAt', order: 'desc' }] })
50
+
51
+ // Paging and sort are FLAT in the second argument.
52
+ const page2 = await projects.list({ entityId: 'abc' }, { page: 1, size: 20, sort: ['createdAt'] })
53
+ page2.items // the window
54
+ page2.total // every record the criteria match, not just this page
49
55
  ```
50
56
 
51
57
  ### Calling the CRUD surface
@@ -57,23 +63,101 @@ A **write** takes the record as its only data argument, and the id travels insid
57
63
  | Call | Signature | Notes |
58
64
  |---|---|---|
59
65
  | `create(record, opts?)` | `Partial<T> → T` | throws `RecordExists`; implementations may refuse a caller-supplied id |
60
- | `save(record, opts?)` | `Partial<T> → T` | create-or-replace |
66
+ | `save(record, opts?)` | `Partial<T> → T` | creates when the record carries no id, replaces otherwise |
61
67
  | `update(record, opts?)` | `Partial<T> → T` | replaces the whole record; throws `UnknownRecordError` |
62
68
 
63
- A **read** takes the id first, plus an optional field to look it up by (`opts` is that field name,
64
- or `{ field, ttl }`):
69
+ A **read** is addressed either by an id or by a criteria object. The id overload takes nothing
70
+ else; the criteria overload takes `{ sort }` to say which match is "the" one:
65
71
 
66
72
  | Call | Signature | Notes |
67
73
  |---|---|---|
68
- | `load(id, field?, opts?)` | `string → T \| null` | the miss-tolerant read |
69
- | `get(id, field?, opts?)` | `string → T` | throws `UnknownRecordError` instead of returning `null` |
70
- | `list(criteria?, opts?)` | `→ { items, pager }` | |
71
- | `delete(id \| record, opts?)` | `→ T \| null` | returns what it removed |
72
- | `pick(id \| record, opts?)` | `→ T` | **also deletes** — it is `delete` that throws on a miss, never a read |
74
+ | `load(id)` / `load(where, { sort })` | `→ T \| null` | the miss-tolerant read |
75
+ | `get(id)` / `get(where, { sort })` | `→ T` | throws `UnknownRecordError` instead of returning `null` |
76
+ | `list(where?, { page, size, sort })` | `→ { items, total, page?, size? }` | `total` counts every match, not the window |
77
+ | `count(where?)` | `→ number` | the same question without carrying the records back |
78
+ | `delete(id)` | `→ T \| null` | returns what it removed |
79
+ | `take(id)` | `→ T` | **deletes the record it returns.** It is a `delete` that throws `UnknownRecordError` on a miss, never a read — never reach for it to fetch something |
80
+ | `purge(where)` | `→ number` | bulk delete; refuses an empty criteria object rather than emptying the resource |
73
81
 
74
82
  Every method returns the record(s) themselves, never a driver result object — there is no
75
83
  `rowsAffected`/`rowCount` anywhere on this contract.
76
84
 
85
+ ### The criteria language
86
+
87
+ `Criteria<T>` is keyed by the record's own fields, so a typo is a compile error. A dotted key
88
+ reaches into a nested value (or a jsonb column) and stays open.
89
+
90
+ | Written as | Means |
91
+ |---|---|
92
+ | `{ status: 'open' }` | equality |
93
+ | `{ status: ['open', 'done'] }` | **any of these** — a bare array is never exact-array equality (that is `{ $eq: [...] }`) |
94
+ | `{ archivedAt: null }` | the absence of a value |
95
+ | `{ status: undefined }` | **skipped** — an untouched filter must never empty a list |
96
+ | `{ 'profile.city': 'Kraków' }` | reach into a nested value or a jsonb column |
97
+
98
+ Operators go in an object under the field: `$eq $ne $gt $gte $lt $lte $in $nin $exists $null
99
+ $like $ilike $regex $startsWith $endsWith $between $contains $contained $overlaps`. Branches
100
+ combine with `$and` / `$or` / `$not`, each taking criteria of the same shape.
101
+
102
+ ```typescript
103
+ await projects.list({
104
+ entityId: 'abc',
105
+ createdAt: { $gte: since },
106
+ $or: [{ name: { $ilike: 'owl%' } }, { tags: { $overlaps: ['pinned'] } }]
107
+ })
108
+ ```
109
+
110
+ Every backend answers the same object the same way — that is the point of the vocabulary. An
111
+ operator a store cannot express raises `UnsupportedArgumentError` rather than being quietly
112
+ dropped.
113
+
114
+ `Sort<T>` is a bare field name (ascending) or `{ field, order: 'asc' | 'desc' }`, and `sort` takes
115
+ a list of them. An absent value sorts last ascending, everywhere.
116
+
117
+ ### Paging is a property of the backend
118
+
119
+ `ListResult<T>` is `{ items, total, page?, size? }` — `total` always counts every match. Whether a
120
+ missing `size` means "everything" depends on what the store can afford:
121
+
122
+ | Backend | `list(where)` with no `size` |
123
+ |---|---|
124
+ | mongo, postgres | a page of `DEFAULT_PAGE_SIZE` (100) — an unbounded read of a growing table is an incident waiting to happen |
125
+ | redis, static, client-resource, config, state | every match — answering the criteria already read the whole namespace, so an implied window would only hide records without saving work |
126
+
127
+ `size: 0` means **no limit** on every backend — the explicit, greppable way to ask for a whole
128
+ result set. `page` without `size` against an unpaged backend throws
129
+ `UnsupportedArgumentError('page-without-size')`: there is no implied default to take a window of.
130
+
131
+ ### The shared in-memory engine
132
+
133
+ Every store without a query engine of its own — redis after its SCAN, the client and static
134
+ stores, state — filters through the same helpers, so a criteria object written for an endpoint
135
+ selects the same records when a screen applies it locally:
136
+
137
+ | Helper | Answers |
138
+ |---|---|
139
+ | `matchCriteria(record, where)` | does this one record match |
140
+ | `filterRecords(records, where)` | every match, in insertion order |
141
+ | `sortRecords(records, sort)` | a sorted copy |
142
+ | `firstMatch(records, where, { sort })` | the record `load(where)` / `get(where)` return |
143
+ | `applyQuery(records, where, opts)` | the whole `ListResult` — filter, sort and page in one call |
144
+
145
+ Reach for them when implementing a backend, and when narrowing a list already in hand rather than
146
+ going back to the store.
147
+
148
+ ### Optional capabilities
149
+
150
+ A concrete resource interface composes the capabilities its backend actually has beside
151
+ `Resource<T>`; a consumer types the **resource** once and gets exactly those methods.
152
+
153
+ | Interface | Surface |
154
+ |---|---|
155
+ | `PubSubResource<T>` | `publish(value, channel?)` · `subscribe(handler, { channel?, once?, ttl? })` |
156
+ | `WatchableResource<T>` | `watch(id, handler, { once?, ttl? })` — changes to ONE record |
157
+ | `StreamResource<T>` | `stream(key, value)` · `consume(key, { group?, consumer?, block? })` |
158
+ | `LockableResource<T>` | `lock`/`unlock` — field level encryption at rest |
159
+ | `MigratableResource<Tx, Self>` | `migration(name, apply, stage?)` · `migrations()` |
160
+
77
161
  ## The migration framework
78
162
 
79
163
  Migrations are **automatic on app setup**: a backend runs them inside the resource's
@@ -86,8 +170,9 @@ Adding migration support to a new database backend:
86
170
  1. Extend the concrete resource interface with `MigratableResource<YourTx>` and design the
87
171
  `Tx` façade a migration receives.
88
172
  2. Keep registrations in a **module-scope declaration keyed by alias** (see either
89
- implementation's `declarations.ts`) — `reinitializeContext` rebuilds resource objects, and
90
- a registry lost to a rebuild silently loses data transformations.
173
+ implementation's `declarations.ts`) — a maker that runs more than once for the same alias
174
+ (a custom maker, a test) then re-declares the same entries and loses nothing, where a
175
+ registry held on the resource object would silently lose data transformations.
91
176
  3. Implement `MigrationStore` over a durable ledger when the database can store one
92
177
  (`_owlmeans_migrations` in both mongo and postgres); a store-less backend may run
93
178
  migrations unconditionally if its bodies are self-checking.
@@ -1 +1 @@
1
- {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE5D;;;;;;;;;;;GAWG;AACH,oBAAY,cAAc;IACxB,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,cAAc,UAAU,cAAc,CAAC,CAAC,CAAC,KAAG,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CA6CjH,CAAA"}
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAE5D;;;;;;;;;;;GAWG;AACH,oBAAY,cAAc;IACxB,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,cAAc,EAAE,QAAQ,cAAc,CAAC,CAAC,CAAC,KAAG,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAsBjH,CAAA"}
package/build/consts.js CHANGED
@@ -31,34 +31,11 @@ export const createListSchema = (schema) => ({
31
31
  additionalProperties: false,
32
32
  }
33
33
  },
34
- pager: {
35
- type: 'object',
36
- properties: {
37
- sort: {
38
- type: 'array',
39
- items: {
40
- oneOf: [
41
- { type: 'string' },
42
- {
43
- type: 'array', items: [
44
- { type: 'string' },
45
- { type: 'boolean', nullable: true }
46
- ], minItems: 1, maxItems: 2
47
- }
48
- ]
49
- },
50
- nullable: true
51
- },
52
- page: { type: 'number', nullable: true },
53
- size: { type: 'number', nullable: true },
54
- total: { type: 'number', nullable: true }
55
- },
56
- required: [],
57
- nullable: true,
58
- additionalProperties: false,
59
- }
34
+ total: { type: 'number' },
35
+ page: { type: 'number', nullable: true },
36
+ size: { type: 'number', nullable: true }
60
37
  },
61
- required: ['items'],
38
+ required: ['items', 'total'],
62
39
  additionalProperties: false,
63
40
  });
64
41
  //# sourceMappingURL=consts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,+BAAa,CAAA;AACf,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAA2B,MAAyB,EAAiC,EAAE,CAAC,CAAC;IACvH,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,KAAK,EAAE;YACL,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,GAAG,MAAM;gBACT,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE;oBACtC,GAAG,MAAM,CAAC,UAAU;iBACrB;gBACD,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;gBACrE,oBAAoB,EAAE,KAAK;aAC5B;SACF;QACD,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE;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AC,CAAA;AAC/C,cAAc,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAA;AACrD,cAAc,CAAC,kBAAkB,CAAC,wBAAwB,CAAC,CAAA;AAC3D,cAAc,CAAC,kBAAkB,CAAC,sBAAsB,CAAC,CAAA;AACzD,cAAc,CAAC,kBAAkB,CAAC,cAAc,CAAC,CAAA;AACjD,cAAc,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,CAAA"}
package/build/helper.d.ts CHANGED
@@ -1,4 +1,2 @@
1
- import type { ListCriteria, ListOptions } from './types.js';
2
- export declare const prepareListOptions: (defPageSize?: number, criteria?: ListOptions | ListCriteria, opts?: ListOptions) => ListOptions;
3
1
  export declare const filterObject: <T extends {}>(obj: T, keep?: string[]) => T;
4
2
  //# sourceMappingURL=helper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAa,MAAM,YAAY,CAAA;AAEtE,eAAO,MAAM,kBAAkB,iBAAiB,MAAM,aAAkB,WAAW,GAAG,YAAY,SAAS,WAAW,KAAG,WAwBxH,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,MAAM,EAAE,KAAG,CAMxD,CAAA"}
1
+ {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,EAAE,EAAE,KAAK,CAAC,EAAE,OAAO,MAAM,EAAE,KAAG,CAMxD,CAAA"}
package/build/helper.js CHANGED
@@ -1,27 +1,3 @@
1
- export const prepareListOptions = (defPageSize = 10, criteria, opts) => {
2
- if (opts == null) {
3
- if (criteria == null) {
4
- criteria = {};
5
- opts = {};
6
- }
7
- else if ('criteria' in criteria || 'pager' in criteria) {
8
- /**
9
- * Both keys have to be read off the original object before it's reassigned —
10
- * reading `pager` after narrowing to `.criteria` silently drops the pager.
11
- */
12
- const options = criteria;
13
- opts = { pager: options.pager };
14
- criteria = (options.criteria ?? {});
15
- }
16
- }
17
- const size = (opts?.pager?.size ?? defPageSize);
18
- const pager = {
19
- sort: opts?.pager?.sort,
20
- page: opts?.pager?.page ?? 0,
21
- size, total: 0
22
- };
23
- return { criteria: criteria, pager };
24
- };
25
1
  export const filterObject = (obj, keep) => Object.entries(obj).reduce((obj, [key, value]) => {
26
2
  if (value == null && !keep?.includes(key)) {
27
3
  return obj;
@@ -1 +1 @@
1
- {"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,WAAW,GAAW,EAAE,EAAE,QAAqC,EAAE,IAAkB,EAAe,EAAE;IACrI,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACjB,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;YACrB,QAAQ,GAAG,EAAE,CAAA;YACb,IAAI,GAAG,EAAE,CAAA;QACX,CAAC;aAAM,IAAI,UAAU,IAAI,QAAQ,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;YACzD;;;eAGG;YACH,MAAM,OAAO,GAAG,QAAuB,CAAA;YACvC,IAAI,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAA;YAC/B,QAAQ,GAAG,CAAC,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAiB,CAAA;QACrD,CAAC;IACH,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,IAAI,WAAW,CAAC,CAAA;IAC/C,MAAM,KAAK,GAAc;QACvB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI;QACvB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,IAAI,CAAC;QAC5B,IAAI,EAAE,KAAK,EAAE,CAAC;KACf,CAAA;IAED,OAAO,EAAE,QAAQ,EAAE,QAAwB,EAAE,KAAK,EAAE,CAAA;AACtD,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAe,GAAM,EAAE,IAAe,EAAK,EAAE,CACvE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;IAC/C,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1C,OAAO,GAAG,CAAA;IACZ,CAAC;IACD,OAAO,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAA;AACjC,CAAC,EAAE,EAAO,CAAC,CAAA"}
1
+ {"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,CAAe,GAAM,EAAE,IAAe,EAAK,EAAE,CACvE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;IAC/C,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC1C,OAAO,GAAG,CAAA;IACZ,CAAC;IACD,OAAO,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAA;AACjC,CAAC,EAAE,EAAO,CAAC,CAAA"}
package/build/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './errors.js';
2
2
  export * from './consts.js';
3
3
  export * from './service.js';
4
4
  export * from './helper.js';
5
+ export * from './utils/query.js';
5
6
  export * from './migration.js';
6
7
  export type * from './types.js';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,mBAAmB,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,mBAAmB,YAAY,CAAA"}
package/build/index.js CHANGED
@@ -2,5 +2,6 @@ export * from './errors.js';
2
2
  export * from './consts.js';
3
3
  export * from './service.js';
4
4
  export * from './helper.js';
5
+ export * from './utils/query.js';
5
6
  export * from './migration.js';
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../src/migration.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACC,iBAAiB,EAAE,eAAe,EAAE,mBAAmB,EAAE,cAAc,EACnF,MAAM,YAAY,CAAA;AAqBnB;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,EAAE,GAAG,OAAO,OAAK,iBAAiB,CAAC,EAAE,CA+B5E,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,GAAU,EAAE,GAAG,OAAO,SACvC,MAAM,YACH,iBAAiB,CAAC,EAAE,CAAC,SACxB,cAAc,CAAC,EAAE,CAAC,SAClB,mBAAmB,KACzB,OAAO,CAAC,eAAe,CAqDzB,CAAA"}
1
+ {"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../src/migration.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACC,iBAAiB,EAAE,eAAe,EAAE,mBAAmB,EAAE,cAAc,EACnF,MAAM,YAAY,CAAA;AAqBnB;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,EAAE,GAAG,OAAO,OAAK,iBAAiB,CAAC,EAAE,CA+B5E,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,GAAU,EAAE,GAAG,OAAO,EAC9C,OAAO,MAAM,EACb,UAAU,iBAAiB,CAAC,EAAE,CAAC,EAC/B,OAAO,cAAc,CAAC,EAAE,CAAC,EACzB,OAAO,mBAAmB,KACzB,OAAO,CAAC,eAAe,CAqDzB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,EAA6B,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAG9E,eAAO,MAAM,eAAe,GAC1B,EAAE,EAAE,MAAM,EAAE,OAAO,SAAS,iBAAiB,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,iBAAiB,CAAC,EAAE,EAAE,MAAM,CAAC,SAClF,MAAM,YAAY,OAAO,CAAC,OAAO,CAAC,SAAS,UAAU,CAAC,OAAO,CAAC,KAAG,OAqFzE,CAAA"}
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,KAAK,EAA6B,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAG9E,eAAO,MAAM,eAAe,GAC1B,EAAE,EAAE,MAAM,EAAE,OAAO,SAAS,iBAAiB,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,iBAAiB,CAAC,EAAE,EAAE,MAAM,CAAC,EACzF,OAAO,MAAM,EAAE,UAAU,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,UAAU,CAAC,OAAO,CAAC,KAAG,OAqFzE,CAAA"}