@nxgt/janus-mongo 0.4.1 → 0.4.3

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 +22 -1
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -34,9 +34,10 @@ export const access = permissions({ model, store: mongo.relations });
34
34
 
35
35
  ```sh
36
36
  bun add @nxgt/janus-mongo @nxgt/janus @nxgt/mongo mongodb zod
37
+ bun add -d typescript
37
38
  ```
38
39
 
39
- Every peer is required: `@nxgt/janus`, `@nxgt/mongo` (`>=0.17 <1`), `mongodb`
40
+ Every peer is required: `@nxgt/janus`, `@nxgt/mongo` (`>=0.17.0 <1`), `mongodb`
40
41
  (7), `zod` (4.6.5 or later, which `@nxgt/mongo` defines collections with) and `typescript`
41
42
  (6). `@nxgt/janus` is a **peer**, never a dependency: this package defines no
42
43
  error class and throws the peer's own, so `instanceof StoreFailure` holds in
@@ -136,3 +137,23 @@ spend the same one.
136
137
  - [Guides](docs/README.md) — wiring the stores, syncing the collections
137
138
  - [Troubleshooting](docs/troubleshooting.md) — by the error message you see
138
139
  - [Roadmap](docs/roadmap.md) — what is next, and what is not planned
140
+
141
+ ## Type safety, counted
142
+
143
+ Eleven plausible mistakes are refused by the compiler, each with a
144
+ `@ts-expect-error` case in `test/types/adapter.ts`:
145
+ - a connection string instead of a database;
146
+ - `@nxgt/mongo`'s connection instead of its `db`, to `createMongoAdapter`;
147
+ - the driver's `MongoClient` instead of one of its databases;
148
+ - `@nxgt/mongo`'s connection instead of its `db`, to `syncMongoAdapter`;
149
+ - the same, to `syncMongoRelations`;
150
+ - the promise `connectMongo` answers, not awaited;
151
+ - a sync option in the wrong case: `dryrun` for `dryRun`;
152
+ - the whole adapter as `janus()`'s `store`, instead of spreading it;
153
+ - the relation store as `janus()`'s `store`;
154
+ - the whole adapter as `permissions()`'s `store`, instead of `mongo.relations`;
155
+ - the identity stores as `permissions()`'s `store`.
156
+
157
+ ## Licence
158
+
159
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxgt/janus-mongo",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "The MongoDB adapter for @nxgt/janus: users, sessions, one-time tokens and permission tuples",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -48,7 +48,7 @@
48
48
  ]
49
49
  },
50
50
  "devDependencies": {
51
- "@nxgt/janus": "^0.8.0",
51
+ "@nxgt/janus": "^0.8.6",
52
52
  "@nxgt/mongo": "^0.17.1",
53
53
  "@types/bun": "^1.4.2",
54
54
  "mongodb": "^7.6.0",
@@ -56,7 +56,7 @@
56
56
  "zod": "^4.6.5"
57
57
  },
58
58
  "peerDependencies": {
59
- "@nxgt/janus": "^0.8.0",
59
+ "@nxgt/janus": "^0.8.6",
60
60
  "@nxgt/mongo": ">=0.17.0 <1",
61
61
  "mongodb": ">=7.0.0 <8",
62
62
  "typescript": "^6.0.3",