@owlmeans/mongo-resource 0.1.18-rc.42 → 0.1.18-rc.44

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 (77) hide show
  1. package/README.md +14 -14
  2. package/agent-meta/manifest.json +2 -2
  3. package/agent-meta/skills/mongo-resource/SKILL.md +13 -13
  4. package/build/declarations/types.d.ts +12 -0
  5. package/build/declarations/types.d.ts.map +1 -0
  6. package/build/declarations/types.js +2 -0
  7. package/build/declarations/types.js.map +1 -0
  8. package/build/declarations.d.ts +4 -3
  9. package/build/declarations.d.ts.map +1 -1
  10. package/build/declarations.js +23 -15
  11. package/build/declarations.js.map +1 -1
  12. package/build/index.d.ts +3 -0
  13. package/build/index.d.ts.map +1 -1
  14. package/build/index.js.map +1 -1
  15. package/build/resource.d.ts.map +1 -1
  16. package/build/resource.js +22 -22
  17. package/build/resource.js.map +1 -1
  18. package/build/utils/criteria/types.d.ts +27 -0
  19. package/build/utils/criteria/types.d.ts.map +1 -0
  20. package/build/utils/criteria/types.js +2 -0
  21. package/build/utils/criteria/types.js.map +1 -0
  22. package/build/utils/criteria.d.ts +5 -20
  23. package/build/utils/criteria.d.ts.map +1 -1
  24. package/build/utils/criteria.js +109 -120
  25. package/build/utils/criteria.js.map +1 -1
  26. package/build/utils/indexes/types.d.ts +19 -0
  27. package/build/utils/indexes/types.d.ts.map +1 -0
  28. package/build/utils/indexes/types.js +2 -0
  29. package/build/utils/indexes/types.js.map +1 -0
  30. package/build/utils/indexes.d.ts +3 -14
  31. package/build/utils/indexes.d.ts.map +1 -1
  32. package/build/utils/indexes.js +40 -45
  33. package/build/utils/indexes.js.map +1 -1
  34. package/build/utils/life-cycle/types.d.ts +36 -0
  35. package/build/utils/life-cycle/types.d.ts.map +1 -0
  36. package/build/utils/life-cycle/types.js +2 -0
  37. package/build/utils/life-cycle/types.js.map +1 -0
  38. package/build/utils/life-cycle.d.ts +3 -30
  39. package/build/utils/life-cycle.d.ts.map +1 -1
  40. package/build/utils/life-cycle.js +94 -113
  41. package/build/utils/life-cycle.js.map +1 -1
  42. package/build/utils/refs/types.d.ts +78 -0
  43. package/build/utils/refs/types.d.ts.map +1 -0
  44. package/build/utils/refs/types.js +2 -0
  45. package/build/utils/refs/types.js.map +1 -0
  46. package/build/utils/refs.d.ts +13 -69
  47. package/build/utils/refs.d.ts.map +1 -1
  48. package/build/utils/refs.js +112 -150
  49. package/build/utils/refs.js.map +1 -1
  50. package/build/utils/schema/types.d.ts +16 -0
  51. package/build/utils/schema/types.d.ts.map +1 -0
  52. package/build/utils/schema/types.js +2 -0
  53. package/build/utils/schema/types.js.map +1 -0
  54. package/build/utils/schema.d.ts +3 -11
  55. package/build/utils/schema.d.ts.map +1 -1
  56. package/build/utils/schema.js +86 -88
  57. package/build/utils/schema.js.map +1 -1
  58. package/package.json +6 -6
  59. package/src/declarations/types.ts +12 -0
  60. package/src/declarations.ts +26 -14
  61. package/src/index.ts +3 -0
  62. package/src/resource.ts +23 -25
  63. package/src/utils/criteria/types.ts +28 -0
  64. package/src/utils/criteria.ts +118 -123
  65. package/src/utils/indexes/types.ts +20 -0
  66. package/src/utils/indexes.ts +41 -43
  67. package/src/utils/life-cycle/types.ts +39 -0
  68. package/src/utils/life-cycle.ts +117 -133
  69. package/src/utils/refs/types.ts +79 -0
  70. package/src/utils/refs.ts +144 -175
  71. package/src/utils/schema/types.ts +17 -0
  72. package/src/utils/schema.ts +92 -91
  73. package/tests/context.ts +3 -3
  74. package/tests/criteria.spec.ts +3 -1
  75. package/tests/crud.spec.ts +2 -2
  76. package/tests/indexes.spec.ts +3 -1
  77. package/tests/refs.spec.ts +5 -3
package/README.md CHANGED
@@ -12,7 +12,7 @@ Client-side records go in [`@owlmeans/state`](../state).
12
12
  ## Installation
13
13
 
14
14
  ```bash
15
- bun add @owlmeans/mongo-resource@^0.1.18-rc.42
15
+ bun add @owlmeans/mongo-resource@^0.1.18-rc.44
16
16
  ```
17
17
 
18
18
  `mongodb` and `ajv` are peer dependencies. The connection service comes from
@@ -78,7 +78,7 @@ await projects.update({ ...created, title: 'Renamed' }) // rep
78
78
  await projects.purge({ entityId, status: 'archived' }) // refuses empty criteria
79
79
  ```
80
80
 
81
- `entityId` here is the organization's stable record id, taken from `requireEntityKey(req)` in the
81
+ `entityId` here is the organization's stable record id, taken from `makeEntityScope(req).requireEntityKey()` in the
82
82
  handler, never from the token. Only `entitySlug` travels on the wire.
83
83
 
84
84
  ### References, compound indexes and a domain method
@@ -135,10 +135,10 @@ idempotent: without transactions an interrupted body can run again.
135
135
  ### Raw driver access with converted references
136
136
 
137
137
  ```ts
138
- import { marshalReference } from '@owlmeans/mongo-resource'
138
+ import { mongoRefHelper } from '@owlmeans/mongo-resource'
139
139
 
140
140
  await projects.collection.updateOne(
141
- { _id: marshalReference('id', projectId) as never, jobSequence },
141
+ { _id: mongoRefHelper.marshalReference('id', projectId) as never, jobSequence },
142
142
  { $inc: { jobSequence: 1 }, $set: { updatedAt: new Date() } }
143
143
  )
144
144
  ```
@@ -242,15 +242,15 @@ database, so each database tracks its own.
242
242
  | `MongoDbService` | type | Connection service contract implemented by `@owlmeans/mongo` |
243
243
  | `MongoTx` | type | Façade handed to migration bodies: `db`, `collection`, `use(alias)`, `ref(alias)` |
244
244
  | `MongoReference`, `MongoRefOptions` | type | A declared reference and the `reference()` options (`resource`, `noIndex`) |
245
- | `criteriaToFilter(criteria, refs)` | function | `Criteria<T>` to a Mongo filter, with references converted |
246
- | `sortToMongo(sort)` | function | `Sort<T>[]` to a Mongo sort document (`id` becomes `_id`) |
247
- | `marshalReference(field, value)` | function | String id(s) to `ObjectId` for a write; throws `MisshapedRecord` on non-ids |
248
- | `demarshalReference(value)`, `demarshalRefs(record, refs)` | function | `ObjectId` back to strings for one value or a whole document |
249
- | `marshalCriteria(filter, refs)`, `identityCriteria(field, id, refs)` | function | Convert a Mongo filter's id-addressed values; build a single-record lookup |
250
- | `isObjectIdHex(value)` | function | Strict 24-hex test used by the conversion layer |
251
- | `convertReferenceField`, `makeRefMigration`, `reconcileReferences`, `refMigrationName` | function | The system reference migration and its boot-time probe |
245
+ | `mongoCriteriaHelper` (`MongoCriteriaHelper`) | helper | `.criteriaToFilter(criteria, refs)` — `Criteria<T>` to a Mongo filter, with references converted; `.sortToMongo(sort)` — `Sort<T>[]` to a Mongo sort document (`id` becomes `_id`) |
246
+ | `mongoRefHelper` (`MongoRefHelper`) | helper | The reference conversion layer, members below |
247
+ | `mongoRefHelper.marshalReference(field, value)` | member | String id(s) to `ObjectId` for a write; throws `MisshapedRecord` on non-ids |
248
+ | `mongoRefHelper.demarshalReference(value)`, `.demarshalRefs(record, refs)` | member | `ObjectId` back to strings for one value or a whole document |
249
+ | `mongoRefHelper.marshalCriteria(filter, refs)`, `.identityCriteria(field, id, refs)` | member | Convert a Mongo filter's id-addressed values; build a single-record lookup |
250
+ | `mongoRefHelper.isObjectIdHex(value)` | member | Strict 24-hex test used by the conversion layer |
251
+ | `mongoRefHelper.convertReferenceField`, `.reconcileReferences`, `.refMigrationName`; `makeRefMigration` | member / function | The system reference migration and its boot-time probe |
252
252
  | `makeMongoTx`, `makeMongoMigrationStore` | function | The migration façade and the ledger implementation |
253
- | `getDeclaration(alias)`, `resetDeclarations(alias?)`, `MongoDeclaration` | function / type | Module-scope per-alias declarations; `resetDeclarations` is the testing seam |
253
+ | `mongoDeclarationHelper` (`MongoDeclarationHelper`), `MongoDeclaration` | helper / type | Module-scope per-alias declarations: `.getDeclaration(alias)`, and `.resetDeclarations(alias?)` — the testing seam |
254
254
  | `getSchemaSecureFeilds(schema)` | function | The `secure: true` properties `lock`/`unlock` use when no fields are named |
255
255
  | `DEFAULT_DB_ALIAS` | const | `'mongo'` |
256
256
  | `DEFAULT_PAGE_SIZE` | const | `100` |
@@ -275,7 +275,7 @@ database, so each database tracks its own.
275
275
  - **Expecting `update` to merge.** It replaces the whole document. Pass every field that must survive.
276
276
  - **Reading "everything" with `list(where)`.** It stops at 100. Ask with `{ size: 0 }`, or page.
277
277
  - **Raw `resource.collection` calls with string ids.** They match nothing against `ObjectId`
278
- fields. Use `marshalReference`.
278
+ fields. Use `mongoRefHelper.marshalReference`.
279
279
  - **Passing `{ ttl }`.** It is refused. Expiring records belong in Redis.
280
280
 
281
281
  ## Related packages
@@ -294,7 +294,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
294
294
  your project's skill store (`.agents/skills/`):
295
295
 
296
296
  ```sh
297
- npx @owlmeans/agent-skills@^0.1.18-rc.48
297
+ npx @owlmeans/agent-skills@^0.1.18-rc.52
298
298
  ```
299
299
 
300
300
  The embedded files are version-matched to this package release. Do not edit them
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/mongo-resource",
4
- "version": "0.1.18-rc.42",
5
- "generatedAt": "2026-10-05T08:32:19.102Z",
4
+ "version": "0.1.18-rc.44",
5
+ "generatedAt": "2026-10-08T21:27:54.294Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -8,7 +8,7 @@ user-invocable: false
8
8
  # @owlmeans/mongo-resource
9
9
 
10
10
  **Layer:** Infra
11
- **Install:** `"@owlmeans/mongo-resource": "^0.1.18-rc.42"` in `dependencies` (peers `mongodb`, `ajv`)
11
+ **Install:** `"@owlmeans/mongo-resource": "^0.1.18-rc.44"` in `dependencies` (peers `mongodb`, `ajv`)
12
12
 
13
13
  The Mongo counterpart of [[postgres-resource]]. A collection has no structure of its own, so
14
14
  here the resource layer owns the *validator* (`$jsonSchema` from the AJV schema), the indexes,
@@ -23,11 +23,11 @@ reference**.
23
23
  | `MongoResource<T>` | `Resource<T>` + `collection`, `db()`/`client()`, `index`/`indexes`, `reference`/`references`, `migration`/`migrations` (the shared `MigratableResource` capability), `lock`/`unlock`, `getDefaults`, and the `dbAlias`/`serviceAlias` it was registered against. Anything naming a collection on another resource's behalf reads *that* resource's `dbAlias`, since two resources in one database can carry different `resourcePrefix`es. |
24
24
  | `MongoDbService`, `MongoTx` | Service contract implemented by `@owlmeans/mongo`; the façade handed to migrations (`db`, `collection`, `use(alias)`, `ref(alias)`). |
25
25
  | `MongoReference`, `MongoRefOptions` | A declared ObjectId reference and the `reference()` options (`resource`, `noIndex`). |
26
- | `marshalReference`, `demarshalReference`, `demarshalRefs`, `marshalCriteria`, `identityCriteria`, `isObjectIdHex` | The conversion layer — reuse these wherever raw driver access bypasses the resource. |
27
- | `criteriaToFilter`, `sortToMongo` | `Criteria<T>` → a mongo filter (references converted, every shared operator rewritten into a mongo expression) and `Sort<T>` → a mongo sort spec. |
28
- | `convertReferenceField`, `makeRefMigration`, `reconcileReferences`, `refMigrationName` | The system reference migration's machinery. |
26
+ | `mongoRefHelper` — `marshalReference`, `demarshalReference`, `demarshalRefs`, `marshalCriteria`, `identityCriteria`, `isObjectIdHex` | The conversion layer — reuse these wherever raw driver access bypasses the resource. |
27
+ | `mongoCriteriaHelper` — `criteriaToFilter`, `sortToMongo` | `Criteria<T>` → a mongo filter (references converted, every shared operator rewritten into a mongo expression) and `Sort<T>` → a mongo sort spec. |
28
+ | `makeRefMigration`; `mongoRefHelper` — `convertReferenceField`, `reconcileReferences`, `refMigrationName` | The system reference migration's machinery. |
29
29
  | `makeMongoTx`, `makeMongoMigrationStore` | The migration store (ledger) implementation. |
30
- | `getDeclaration`, `resetDeclarations`, `MongoDeclaration` | Module-scope migration/reference declarations, keyed by alias; `resetDeclarations(alias?)` is the testing seam. |
30
+ | `mongoDeclarationHelper` — `getDeclaration`, `resetDeclarations`; `MongoDeclaration` | Module-scope migration/reference declarations, keyed by alias; `mongoDeclarationHelper.resetDeclarations(alias?)` is the testing seam. |
31
31
  | `getSchemaSecureFeilds` | The `secure: true` schema properties `lock`/`unlock` operate on when the caller names no fields. |
32
32
  | `DEFAULT_DB_ALIAS`, `DEFAULT_PAGE_SIZE`, `DEF_MIGRATIONS_COLLECTION`, `DEF_MIGRATION_WAIT`, `DEF_MIGRATION_POLL`, `MONGO_DUPLICATE_KEY` | Constants. |
33
33
 
@@ -92,8 +92,8 @@ drift (restored backup, legacy writer), logging a warning. Both paths run with
92
92
  do).
93
93
 
94
94
  The `@1` in the name is the body's version. The body is shared by every field, so its checksum
95
- never distinguishes them — **any semantic edit to `convertReferenceField` must bump the
96
- version suffix** in `refMigrationName`, or every already-applied ledger raises
95
+ never distinguishes them — **any semantic edit to `mongoRefHelper.convertReferenceField` must
96
+ bump the version suffix** in `refMigrationName`, or every already-applied ledger raises
97
97
  `MigrationConflict` at boot.
98
98
 
99
99
  ### What is NOT a reference — do not declare these
@@ -114,9 +114,9 @@ trace what the writer actually assigns.
114
114
 
115
115
  ### Raw driver access bypasses all of this
116
116
 
117
- `resource.collection.find/aggregate/findOneAndUpdate` see `ObjectId`s. Marshal filter values
118
- with `marshalReference(field, value)` and convert read-back documents' reference fields (and
119
- `_id`) to strings by hand — or better, stay on the resource API.
117
+ `resource.collection.find/aggregate/findOneAndUpdate` see `ObjectId`s. Marshal filter values with
118
+ `mongoRefHelper.marshalReference(field, value)` and convert read-back documents' reference fields
119
+ (and `_id`) to strings by hand — or better, stay on the resource API.
120
120
 
121
121
  ## Migrations
122
122
 
@@ -193,9 +193,9 @@ page while lifting the limit contradicts itself and raises
193
193
 
194
194
  ## Criteria against a collection
195
195
 
196
- `criteriaToFilter` rewrites the shared vocabulary ([[resource]]) into mongo expressions so one
197
- criteria object selects the same records here as it does in SQL and in memory. Two rewrites are
198
- worth knowing:
196
+ `mongoCriteriaHelper.criteriaToFilter` rewrites the shared vocabulary ([[resource]]) into mongo
197
+ expressions so one criteria object selects the same records here as it does in SQL and in memory.
198
+ Two rewrites are worth knowing:
199
199
 
200
200
  - **`$exists` and `$null` compare against `null`**, not mongo's own `$exists`. The shared question
201
201
  is whether a field *has a value*, which the other stores answer as `IS NULL` / `value == null`;
@@ -0,0 +1,12 @@
1
+ import type { MongoDeclaration } from '../types.js';
2
+ /**
3
+ * The per-alias declaration store every mongo resource maker reads and extends — migrations and
4
+ * declared references, keyed by resource alias.
5
+ */
6
+ export interface MongoDeclarationHelper {
7
+ /** The declaration of an alias, created empty on first use. */
8
+ getDeclaration: (alias: string) => MongoDeclaration;
9
+ /** Testing seam — drops every declaration so a spec can redeclare a resource from scratch. */
10
+ resetDeclarations: (alias?: string) => void;
11
+ }
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/declarations/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAEnD;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,+DAA+D;IAC/D,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,gBAAgB,CAAA;IACnD,8FAA8F;IAC9F,iBAAiB,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CAC5C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/declarations/types.ts"],"names":[],"mappings":""}
@@ -1,5 +1,6 @@
1
- import type { MongoDeclaration } from './types.js';
2
- export declare const getDeclaration: (alias: string) => MongoDeclaration;
3
- /** Testing seam — drops every declaration so a spec can redeclare a resource from scratch. */
1
+ import type { MongoDeclarationHelper } from './declarations/types.js';
2
+ export declare const createMongoDeclarationHelper: () => MongoDeclarationHelper;
3
+ export declare const mongoDeclarationHelper: MongoDeclarationHelper;
4
+ /** @deprecated compat:factory-refactor — use `mongoDeclarationHelper.resetDeclarations(…)` */
4
5
  export declare const resetDeclarations: (alias?: string) => void;
5
6
  //# sourceMappingURL=declarations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"declarations.d.ts","sourceRoot":"","sources":["../src/declarations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAW,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAa3D,eAAO,MAAM,cAAc,UAAW,MAAM,KAAG,gBAQ9C,CAAA;AAED,8FAA8F;AAC9F,eAAO,MAAM,iBAAiB,WAAY,MAAM,KAAG,IAOlD,CAAA"}
1
+ {"version":3,"file":"declarations.d.ts","sourceRoot":"","sources":["../src/declarations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAiBrE,eAAO,MAAM,4BAA4B,QAAO,sBAqB/C,CAAA;AAED,eAAO,MAAM,sBAAsB,wBAAiC,CAAA;AAEpE,8FAA8F;AAC9F,eAAO,MAAM,iBAAiB,WAAY,MAAM,KAAG,IAAuD,CAAA"}
@@ -7,22 +7,30 @@ import { createMigrationRegistry } from '@owlmeans/resource';
7
7
  * that a no-op: every run reads and extends the same registry, so nothing a caller declared
8
8
  * by chaining onto an earlier resource object is lost. Losing a migration is silent — the
9
9
  * data transformation simply never runs — which is why the store cannot live on the object.
10
+ *
11
+ * Process-wide for the same reason: it stays outside the factory, so every helper built from it
12
+ * reads the one store.
10
13
  */
11
14
  const declarations = new Map();
12
- export const getDeclaration = (alias) => {
13
- let declaration = declarations.get(alias);
14
- if (declaration == null) {
15
- declaration = { migrations: createMigrationRegistry(), references: new Map() };
16
- declarations.set(alias, declaration);
17
- }
18
- return declaration;
19
- };
20
- /** Testing seam — drops every declaration so a spec can redeclare a resource from scratch. */
21
- export const resetDeclarations = (alias) => {
22
- if (alias == null) {
23
- declarations.clear();
24
- return;
25
- }
26
- declarations.delete(alias);
15
+ export const createMongoDeclarationHelper = () => {
16
+ const getDeclaration = (alias) => {
17
+ let declaration = declarations.get(alias);
18
+ if (declaration == null) {
19
+ declaration = { migrations: createMigrationRegistry(), references: new Map() };
20
+ declarations.set(alias, declaration);
21
+ }
22
+ return declaration;
23
+ };
24
+ const resetDeclarations = (alias) => {
25
+ if (alias == null) {
26
+ declarations.clear();
27
+ return;
28
+ }
29
+ declarations.delete(alias);
30
+ };
31
+ return { getDeclaration, resetDeclarations };
27
32
  };
33
+ export const mongoDeclarationHelper = createMongoDeclarationHelper();
34
+ /** @deprecated compat:factory-refactor — use `mongoDeclarationHelper.resetDeclarations(…)` */
35
+ export const resetDeclarations = (alias) => mongoDeclarationHelper.resetDeclarations(alias);
28
36
  //# sourceMappingURL=declarations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"declarations.js","sourceRoot":"","sources":["../src/declarations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAI5D;;;;;;;;GAQG;AACH,MAAM,YAAY,GAAkC,IAAI,GAAG,EAAE,CAAA;AAE7D,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAoB,EAAE;IAChE,IAAI,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACzC,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;QACxB,WAAW,GAAG,EAAE,UAAU,EAAE,uBAAuB,EAAW,EAAE,UAAU,EAAE,IAAI,GAAG,EAAE,EAAE,CAAA;QACvF,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;IACtC,CAAC;IAED,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAED,8FAA8F;AAC9F,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAc,EAAQ,EAAE;IACxD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,YAAY,CAAC,KAAK,EAAE,CAAA;QAEpB,OAAM;IACR,CAAC;IACD,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC5B,CAAC,CAAA"}
1
+ {"version":3,"file":"declarations.js","sourceRoot":"","sources":["../src/declarations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAK5D;;;;;;;;;;;GAWG;AACH,MAAM,YAAY,GAAkC,IAAI,GAAG,EAAE,CAAA;AAE7D,MAAM,CAAC,MAAM,4BAA4B,GAAG,GAA2B,EAAE;IACvE,MAAM,cAAc,GAAG,CAAC,KAAa,EAAoB,EAAE;QACzD,IAAI,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACzC,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;YACxB,WAAW,GAAG,EAAE,UAAU,EAAE,uBAAuB,EAAW,EAAE,UAAU,EAAE,IAAI,GAAG,EAAE,EAAE,CAAA;YACvF,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;QACtC,CAAC;QAED,OAAO,WAAW,CAAA;IACpB,CAAC,CAAA;IAED,MAAM,iBAAiB,GAAG,CAAC,KAAc,EAAQ,EAAE;QACjD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAClB,YAAY,CAAC,KAAK,EAAE,CAAA;YAEpB,OAAM;QACR,CAAC;QACD,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAC5B,CAAC,CAAA;IAED,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,CAAA;AAC9C,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,4BAA4B,EAAE,CAAA;AAEpE,8FAA8F;AAC9F,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAc,EAAQ,EAAE,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAA"}
package/build/index.d.ts CHANGED
@@ -1,9 +1,12 @@
1
1
  export type * from './types.js';
2
2
  export * from './consts.js';
3
3
  export * from './declarations.js';
4
+ export type * from './declarations/types.js';
4
5
  export * from './utils/migrations.js';
5
6
  export * from './utils/refs.js';
7
+ export type * from './utils/refs/types.js';
6
8
  export * from './utils/criteria.js';
9
+ export type * from './utils/criteria/types.js';
7
10
  export * from './resource.js';
8
11
  export * from './helper.js';
9
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,mBAAmB,yBAAyB,CAAA;AAC5C,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,mBAAmB,uBAAuB,CAAA;AAC1C,cAAc,qBAAqB,CAAA;AACnC,mBAAmB,2BAA2B,CAAA;AAC9C,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AAEjC,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAE/B,cAAc,qBAAqB,CAAA;AAEnC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuF,KAAK,cAAc,EAAsH,MAAM,oBAAoB,CAAA;AACjQ,OAAO,KAAK,EAAmD,aAAa,EAAW,MAAM,YAAY,CAAA;AAazG,eAAO,MAAM,iBAAiB,GAC5B,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,SAEhE,MAAM,YAAW,MAAM,iBAAmC,MAAM,mBACtD,MAAM,KACtB,CAsRF,CAAA"}
1
+ {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuF,KAAK,cAAc,EAAsH,MAAM,oBAAoB,CAAA;AACjQ,OAAO,KAAK,EAAmD,aAAa,EAAW,MAAM,YAAY,CAAA;AAWzG,eAAO,MAAM,iBAAiB,GAC5B,CAAC,SAAS,cAAc,EAAE,CAAC,SAAS,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,SAEhE,MAAM,YAAW,MAAM,iBAAmC,MAAM,mBACtD,MAAM,KACtB,CAsRF,CAAA"}
package/build/resource.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { appendContextual, assertContext } from '@owlmeans/context';
2
2
  import { DEFAULT_DB_ALIAS, DEFAULT_PAGE_SIZE } from './consts.js';
3
3
  import { MigrationStage, MisshapedRecord, RecordExists, UnknownRecordError, UnsupportedArgumentError, RecordUpdateFailed } from '@owlmeans/resource';
4
- import { initializeCollection } from './utils/life-cycle.js';
5
- import { getDeclaration } from './declarations.js';
4
+ import { makeMongoLifeCycleUtils } from './utils/life-cycle.js';
5
+ import { mongoDeclarationHelper } from './declarations.js';
6
6
  import { ObjectId } from 'mongodb';
7
7
  import { getSchemaSecureFeilds } from './helper.js';
8
- import { criteriaToFilter, sortToMongo } from './utils/criteria.js';
9
- import { demarshalRefs, identityCriteria, makeRefMigration, marshalReference, refMigrationName } from './utils/refs.js';
8
+ import { mongoCriteriaHelper } from './utils/criteria.js';
9
+ import { makeRefMigration, mongoRefHelper } from './utils/refs.js';
10
10
  export const makeMongoResource = (alias, dbAlias = DEFAULT_DB_ALIAS, serviceAlias = DEFAULT_DB_ALIAS, collectionName) => {
11
11
  const location = `mongo-resource:${alias}`;
12
12
  /**
@@ -14,11 +14,11 @@ export const makeMongoResource = (alias, dbAlias = DEFAULT_DB_ALIAS, serviceAlia
14
14
  * declarations live at module scope keyed by alias, so a second maker run for the
15
15
  * same alias sees everything already declared for it.
16
16
  */
17
- const refs = () => getDeclaration(alias).references;
17
+ const refs = () => mongoDeclarationHelper.getDeclaration(alias).references;
18
18
  const demarshal = (record) => {
19
19
  record.id = record._id instanceof ObjectId ? record._id.toString() : record._id;
20
20
  delete record._id;
21
- return demarshalRefs(record, refs());
21
+ return mongoRefHelper.demarshalRefs(record, refs());
22
22
  };
23
23
  /**
24
24
  * A read addressed either way. An id is matched tolerantly: a string that is not a mongo id
@@ -26,14 +26,14 @@ export const makeMongoResource = (alias, dbAlias = DEFAULT_DB_ALIAS, serviceAlia
26
26
  * that only asked whether the record exists.
27
27
  */
28
28
  const filterOf = (idOrWhere) => typeof idOrWhere === 'string'
29
- ? identityCriteria('id', idOrWhere, refs())
30
- : criteriaToFilter(idOrWhere, refs());
29
+ ? mongoRefHelper.identityCriteria('id', idOrWhere, refs())
30
+ : mongoCriteriaHelper.criteriaToFilter(idOrWhere, refs());
31
31
  /**
32
32
  * The single implementation both overloads of `load` and `get` stand on — an id and a
33
33
  * criteria object differ only in how the filter is built.
34
34
  */
35
35
  const loadOne = async (idOrWhere, opts) => {
36
- const sort = sortToMongo(opts?.sort);
36
+ const sort = mongoCriteriaHelper.sortToMongo(opts?.sort);
37
37
  const record = await resource.collection.findOne(filterOf(idOrWhere), sort != null ? { sort } : {});
38
38
  return record != null ? demarshal(record) : null;
39
39
  };
@@ -47,7 +47,7 @@ export const makeMongoResource = (alias, dbAlias = DEFAULT_DB_ALIAS, serviceAlia
47
47
  }),
48
48
  load: loadOne,
49
49
  list: async (where, opts) => {
50
- const filter = criteriaToFilter(where, refs());
50
+ const filter = mongoCriteriaHelper.criteriaToFilter(where, refs());
51
51
  const total = await resource.collection.countDocuments(filter);
52
52
  /** `size: 0` is the explicit ask for everything; an omitted size pages by default. */
53
53
  const size = opts?.size ?? DEFAULT_PAGE_SIZE;
@@ -60,7 +60,7 @@ export const makeMongoResource = (alias, dbAlias = DEFAULT_DB_ALIAS, serviceAlia
60
60
  return size > 0 ? { items: [], total, page, size } : { items: [], total };
61
61
  }
62
62
  let cursor = resource.collection.find(filter);
63
- const sort = sortToMongo(opts?.sort);
63
+ const sort = mongoCriteriaHelper.sortToMongo(opts?.sort);
64
64
  if (sort != null) {
65
65
  cursor = cursor.sort(sort);
66
66
  }
@@ -70,7 +70,7 @@ export const makeMongoResource = (alias, dbAlias = DEFAULT_DB_ALIAS, serviceAlia
70
70
  const items = (await cursor.toArray()).map(item => demarshal({ ...item }));
71
71
  return size > 0 ? { items, total, page, size } : { items, total };
72
72
  },
73
- count: async (where) => await resource.collection.countDocuments(criteriaToFilter(where, refs())),
73
+ count: async (where) => await resource.collection.countDocuments(mongoCriteriaHelper.criteriaToFilter(where, refs())),
74
74
  update: async (record, opts) => {
75
75
  if (opts?.ttl != null) {
76
76
  throw new UnsupportedArgumentError('ttl');
@@ -87,7 +87,7 @@ export const makeMongoResource = (alias, dbAlias = DEFAULT_DB_ALIAS, serviceAlia
87
87
  * document already carries — so the whole record is replaced without touching its key.
88
88
  */
89
89
  delete replace.id;
90
- const result = await resource.collection.replaceOne(identityCriteria('id', original.id, refs()), _prepareValues(replace, resource.schema, refs()));
90
+ const result = await resource.collection.replaceOne(mongoRefHelper.identityCriteria('id', original.id, refs()), _prepareValues(replace, resource.schema, refs()));
91
91
  if (!result.acknowledged) {
92
92
  throw new RecordUpdateFailed(`id:${id}`);
93
93
  }
@@ -129,7 +129,7 @@ export const makeMongoResource = (alias, dbAlias = DEFAULT_DB_ALIAS, serviceAlia
129
129
  },
130
130
  /** Atomic: the record is handed back by the very operation that removed it. */
131
131
  delete: async (id) => {
132
- const record = await resource.collection.findOneAndDelete(identityCriteria('id', id, refs()));
132
+ const record = await resource.collection.findOneAndDelete(mongoRefHelper.identityCriteria('id', id, refs()));
133
133
  return record != null ? demarshal(record) : null;
134
134
  },
135
135
  take: async (id) => {
@@ -140,7 +140,7 @@ export const makeMongoResource = (alias, dbAlias = DEFAULT_DB_ALIAS, serviceAlia
140
140
  return record;
141
141
  },
142
142
  purge: async (where) => {
143
- const filter = criteriaToFilter(where, refs());
143
+ const filter = mongoCriteriaHelper.criteriaToFilter(where, refs());
144
144
  if (Object.keys(filter).length < 1) {
145
145
  /** An empty filter here would empty the collection. */
146
146
  throw new UnsupportedArgumentError('purge:no-criteria');
@@ -188,12 +188,12 @@ export const makeMongoResource = (alias, dbAlias = DEFAULT_DB_ALIAS, serviceAlia
188
188
  return resource;
189
189
  }),
190
190
  migration: ((name, apply, stage) => {
191
- getDeclaration(alias).migrations.register(name, apply, stage);
191
+ mongoDeclarationHelper.getDeclaration(alias).migrations.register(name, apply, stage);
192
192
  return resource;
193
193
  }),
194
- migrations: () => getDeclaration(alias).migrations,
194
+ migrations: () => mongoDeclarationHelper.getDeclaration(alias).migrations,
195
195
  reference: ((field, opts) => {
196
- const declaration = getDeclaration(alias);
196
+ const declaration = mongoDeclarationHelper.getDeclaration(alias);
197
197
  const options = typeof opts === 'string' ? { resource: opts } : opts ?? {};
198
198
  declaration.references.set(field, { field, resource: options.resource, noIndex: options.noIndex });
199
199
  /**
@@ -201,10 +201,10 @@ export const makeMongoResource = (alias, dbAlias = DEFAULT_DB_ALIAS, serviceAlia
201
201
  * here rather than at init so it precedes migrations the app declares after its
202
202
  * `reference()` calls — the field's type contract is the foundation those build on.
203
203
  */
204
- declaration.migrations.register(refMigrationName(field), makeRefMigration(field), MigrationStage.Pre);
204
+ declaration.migrations.register(mongoRefHelper.refMigrationName(field), makeRefMigration(field), MigrationStage.Pre);
205
205
  return resource;
206
206
  }),
207
- references: () => [...getDeclaration(alias).references.values()]
207
+ references: () => [...mongoDeclarationHelper.getDeclaration(alias).references.values()]
208
208
  });
209
209
  // Explicit collection name override (decoupled from the registration alias, which may
210
210
  // contain characters that aren't valid in a collection name).
@@ -219,7 +219,7 @@ export const makeMongoResource = (alias, dbAlias = DEFAULT_DB_ALIAS, serviceAlia
219
219
  await mongo.ready();
220
220
  const db = await mongo.db(dbAlias);
221
221
  const config = mongo.config(dbAlias);
222
- resource.collection = await initializeCollection(db, config, resource, context);
222
+ resource.collection = await makeMongoLifeCycleUtils(db).initializeCollection(config, resource, context);
223
223
  };
224
224
  return resource;
225
225
  };
@@ -230,7 +230,7 @@ const _prepareValues = (obj, schema, refs) => {
230
230
  * undo the conversion.
231
231
  */
232
232
  if (refs != null && refs.size > 0) {
233
- obj = Object.fromEntries(Object.entries(obj).map(([key, value]) => refs.has(key) ? [key, marshalReference(key, value)] : [key, value]));
233
+ obj = Object.fromEntries(Object.entries(obj).map(([key, value]) => refs.has(key) ? [key, mongoRefHelper.marshalReference(key, value)] : [key, value]));
234
234
  }
235
235
  // @TODO Validate keys from additional properties in the root
236
236
  return schema != null ? Object.fromEntries(Object.entries(obj).map(([key, value]) => {
@@ -1 +1 @@
1
- {"version":3,"file":"resource.js","sourceRoot":"","sources":["../src/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACnE,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,EAAE,cAAc,EAA+G,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAEjQ,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAqE,MAAM,SAAS,CAAA;AAErG,OAAO,EA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,EAAE,MAA0B,EAAE,EAAE;IACtE,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;QAC/C,OAAO,cAAc,CAAC,KAAY,EAAE,MAA6B,CAAC,CAAA;IACpE,CAAC;IACD,IAAI,MAAM,EAAE,IAAI,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAC/C,OAAO,GAAG,KAAK,EAAE,CAAA;IACnB,CAAC;IACD,IAAI,MAAM,EAAE,IAAI,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAC/C,OAAO,CAAC,KAAK,CAAA;IACf,CAAC;IACD,IAAI,MAAM,EAAE,IAAI,KAAK,SAAS,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAChD,OAAO,CAAC,CAAC,KAAK,CAAA;IAChB,CAAC;IACD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,OAAO,KAAK,CAAA;IACd,CAAC;IAED,kEAAkE;IAClE,OAAO,GAAG,KAAK,EAAE,CAAA;AACnB,CAAC,CAAA"}
@@ -0,0 +1,27 @@
1
+ import type { Criteria, Sort } from '@owlmeans/resource';
2
+ import type { Document } from 'mongodb';
3
+ import type { MongoReference } from '../../types.js';
4
+ /** The portable criteria and sort vocabulary, as the documents a collection takes. */
5
+ export interface MongoCriteriaHelper {
6
+ /**
7
+ * Translate `Criteria<T>` into the filter a collection takes.
8
+ *
9
+ * Two passes: the shared operator vocabulary becomes mongo expressions, then
10
+ * `mongoRefHelper.marshalCriteria` converts the values addressed at `_id` or at a declared
11
+ * reference into `ObjectId`s and maps the `id` alias onto `_id`. Both halves are needed — a
12
+ * criteria object carries string ids and portable operators, a collection stores neither.
13
+ *
14
+ * An empty result is an empty filter, which matches everything. Callers that must not act on
15
+ * "everything" — `purge` — check for it themselves.
16
+ *
17
+ * @throws {UnsupportedArgumentError}
18
+ */
19
+ criteriaToFilter: (criteria: Criteria<any> | undefined, refs: Map<string, MongoReference>) => Document;
20
+ /**
21
+ * Translate `Sort<T>[]` into a mongo sort document. A bare field name is ascending, and `id`
22
+ * addresses `_id` — documents never store an `id` field, so sorting by the name records carry
23
+ * would silently order by nothing.
24
+ */
25
+ sortToMongo: (sort?: Sort<any>[]) => Document | undefined;
26
+ }
27
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/utils/criteria/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,sFAAsF;AACtF,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;;;;OAYG;IACH,gBAAgB,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,SAAS,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,KAAK,QAAQ,CAAA;IACtG;;;;OAIG;IACH,WAAW,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,QAAQ,GAAG,SAAS,CAAA;CAC1D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/utils/criteria/types.ts"],"names":[],"mappings":""}
@@ -1,24 +1,9 @@
1
- import { type Criteria, type Sort } from '@owlmeans/resource';
1
+ import { type Criteria } from '@owlmeans/resource';
2
2
  import type { Document } from 'mongodb';
3
3
  import type { MongoReference } from '../types.js';
4
- /**
5
- * Translate `Criteria<T>` into the filter a collection takes.
6
- *
7
- * Two passes: the shared operator vocabulary becomes mongo expressions, then
8
- * {@link marshalCriteria} converts the values addressed at `_id` or at a declared reference
9
- * into `ObjectId`s and maps the `id` alias onto `_id`. Both halves are needed — a criteria
10
- * object carries string ids and portable operators, a collection stores neither.
11
- *
12
- * An empty result is an empty filter, which matches everything. Callers that must not act on
13
- * "everything" — `purge` — check for it themselves.
14
- *
15
- * @throws {UnsupportedArgumentError}
16
- */
4
+ import type { MongoCriteriaHelper } from './criteria/types.js';
5
+ export declare const createMongoCriteriaHelper: () => MongoCriteriaHelper;
6
+ export declare const mongoCriteriaHelper: MongoCriteriaHelper;
7
+ /** @deprecated compat:factory-refactor — use `mongoCriteriaHelper.criteriaToFilter(…)` */
17
8
  export declare const criteriaToFilter: (criteria: Criteria<any> | undefined, refs: Map<string, MongoReference>) => Document;
18
- /**
19
- * Translate `Sort<T>[]` into a mongo sort document. A bare field name is ascending, and `id`
20
- * addresses `_id` — documents never store an `id` field, so sorting by the name records carry
21
- * would silently order by nothing.
22
- */
23
- export declare const sortToMongo: (sort?: Sort<any>[]) => Document | undefined;
24
9
  //# sourceMappingURL=criteria.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"criteria.d.ts","sourceRoot":"","sources":["../../src/utils/criteria.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACvF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAkMjD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gBAAgB,aACjB,QAAQ,CAAC,GAAG,CAAC,GAAG,SAAS,QAAQ,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,KACrE,QAOF,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,UAAW,IAAI,CAAC,GAAG,CAAC,EAAE,KAAG,QAAQ,GAAG,SAa3D,CAAA"}
1
+ {"version":3,"file":"criteria.d.ts","sourceRoot":"","sources":["../../src/utils/criteria.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,QAAQ,EAAa,MAAM,oBAAoB,CAAA;AACvF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAsF9D,eAAO,MAAM,yBAAyB,QAAO,mBAwI5C,CAAA;AAED,eAAO,MAAM,mBAAmB,qBAA8B,CAAA;AAE9D,0FAA0F;AAC1F,eAAO,MAAM,gBAAgB,aAAc,QAAQ,CAAC,GAAG,CAAC,GAAG,SAAS,QAAQ,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,KAAG,QACpD,CAAA"}