anchordb 0.2.0 → 1.0.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.
package/CHANGELOG.md CHANGED
@@ -5,7 +5,88 @@ All notable changes to the `anchordb` packages.
5
5
  This project follows [semantic versioning](https://semver.org/). While the version is `0.x`, minor
6
6
  releases may contain breaking changes.
7
7
 
8
- ## 0.1.0 — unreleased
8
+ ## 1.0.0
9
+
10
+ **Versioning changes with this release.** The major version now tracks the React / Angular major the
11
+ packages are built against: React 18 stays on the `0.x` line, React 19 begins at `1.x`. Projects on
12
+ React 18 remain on 0.2.1, preserved on the
13
+ [`release/0.x-react18`](https://github.com/knnadeera/anchordb/tree/release/0.x-react18) branch.
14
+
15
+ ### One install, ready to use
16
+
17
+ `npm install anchordb-react` now brings the database, the SQLite driver and the crypto polyfill —
18
+ and `createAnchorDB({ name })` needs no adapter wiring. `npm install anchordb-angular` does the
19
+ same, with `provideAnchorIonic` choosing Capacitor SQLite on a device and IndexedDB under
20
+ `ionic serve`.
21
+
22
+ - `anchordb-react` gains `createAnchorDB`, and depends on `expo-sqlite` and
23
+ `react-native-get-random-values`
24
+ - `anchordb-angular` gains `ionicAdapter` and `provideAnchorIonic`, and depends on
25
+ `@capacitor/core` and `@capacitor-community/sqlite`
26
+
27
+ ### Breaking
28
+
29
+ - **`anchordb-react` is now React Native only.** It imports `react-native-get-random-values`, which
30
+ imports React Native internals, so a React web build fails. Browser apps use `anchordb` directly
31
+ with `anchordb/storage/indexeddb`, which is unchanged.
32
+ - **React 19 is required** by `anchordb-react`, since `expo-sqlite` pulls React Native.
33
+
34
+ ### Fixed
35
+
36
+ - **Subpath imports were unusable under `moduleResolution: Node10`.** Neither `anchordb` nor
37
+ `anchordb-sync-server` declared `typesVersions`, so `anchordb/storage/expo-sqlite` and friends
38
+ resolved to nothing for any consumer on classic resolution — and broke this repo's own CommonJS
39
+ build. Every `node10` result in are-the-types-wrong is now green where most were previously
40
+ failing.
41
+ - **The `ExpoDatabase` interface did not match the real `expo-sqlite`.** `params` was declared
42
+ optional where the driver requires it, and typed `unknown[]` where SQLite accepts only five bind
43
+ types. The actual module was therefore not assignable to the interface, so every TypeScript user
44
+ following the documented usage got an error. Caught by typechecking against the real package for
45
+ the first time.
46
+ - **`sideEffects: false` on `anchordb-react`** would have let a bundler tree-shake away the crypto
47
+ polyfill, making the first `ObjectId` throw. It now names the built entries.
48
+
49
+ ## 0.2.1
50
+
51
+ Documentation and discoverability only — no code changes.
52
+
53
+ - Every package README now carries a **The AnchorDB family** table, so someone landing on
54
+ `anchordb-react` from an npm search can see the other four and what each is for.
55
+ - npm keywords added to `anchordb-react`, `anchordb-angular`, `anchordb-sync-server` and
56
+ `anchordb-relay`, which had none and so did not surface in npm search at all. `anchordb` gained
57
+ aggregation, schema and document-database terms.
58
+ - Corrected stale `0.1.0` version claims in three READMEs.
59
+
60
+ ## 0.2.0 — first published release
61
+
62
+ Published as the unscoped `anchordb` family. The `@anchor` scope was never available: it needs an
63
+ npm organization, so the packages took unscoped names instead.
64
+
65
+ ### Added
66
+
67
+ - **Bulk writes on the inspector protocol** — `updateMany` and `deleteMany`, behind a new
68
+ `documents:bulk` capability, routed through the ordinary Model API so a bulk write from Anchor
69
+ Lens validates, stamps and queues exactly like an app write. An empty filter is refused unless
70
+ explicitly acknowledged.
71
+ - **CSV export and import** (`toCsv`, `fromCsv`, `detectImportFormat`), matching
72
+ `mongoexport --type=csv`. Values are cast through the collection schema on import.
73
+ - **A `filter` option on export**, for exporting query results rather than a whole collection.
74
+ - **A `default` Extended JSON mode**, alongside `relaxed` and `canonical`.
75
+ - **A MongoDB bridge** (`MongoBridgeClient` here, `MongoBridge` in `anchordb-relay`), so Lens can
76
+ pull collections from a real MongoDB or push a device into one.
77
+
78
+ ### Fixed
79
+
80
+ - **`modifiedCount` could never be 0.** `updatedAt` and the version key were stamped before the
81
+ change comparison, so every matched document counted as modified and a no-op still bumped the
82
+ timestamp. A no-op update is now matched but not modified, and writes nothing — which also stops a
83
+ bulk update over 10,000 documents queueing 10,000 mutations when only a few hundred changed.
84
+ - **`MongooseStore` was never exported** from `anchordb-sync-server`, so it was absent from the
85
+ published types and unreachable by anyone following the README.
86
+
87
+ ## 0.1.0 — never published
88
+
89
+ The initial implementation. Superseded by 0.2.0 before anything reached npm.
9
90
 
10
91
  First release. Five packages, published together.
11
92
 
package/README.md CHANGED
@@ -110,7 +110,7 @@ Extended JSON has three modes, matching the ones MongoDB Compass offers: `canoni
110
110
 
111
111
  ## Status
112
112
 
113
- **0.2.0 — early, and 0.x means breaking changes are expected.**
113
+ **1.0.0 — early, and 0.x means breaking changes are expected.**
114
114
 
115
115
  **631 tests across 17 files.** Implemented and covered: the local database, Mongoose-shaped schema
116
116
  and validation, decorators, indexes with real `E11000` enforcement, the lazy query builder,
@@ -155,6 +155,23 @@ Documented rather than silently absent: discriminators, `refPath`, transactions/
155
155
  server-side change streams, text/`2dsphere`/hashed indexes, collation, and the
156
156
  `$graphLookup`/`$geoNear`/`$search`/`$merge`/`$out`/`$unionWith` aggregation stages.
157
157
 
158
+ ## The AnchorDB family
159
+
160
+ Five packages. **Only `anchordb` is required** — the rest exist so that an offline-only app never
161
+ has to download Express, and an Express server never has to download React.
162
+
163
+ | Package | What it is | Runs where |
164
+ | --- | --- | --- |
165
+ | **`anchordb`** *(this package)* | The database — schema, models, queries, aggregation, optional sync | phone · browser · Node |
166
+ | [`anchordb-react`](https://www.npmjs.com/package/anchordb-react) | React and React Native hooks | the device |
167
+ | [`anchordb-angular`](https://www.npmjs.com/package/anchordb-angular) | Angular / Ionic module, DI and RxJS observables | the device |
168
+ | [`anchordb-sync-server`](https://www.npmjs.com/package/anchordb-sync-server) | Server half of sync — Express, NestJS, Next.js | your backend |
169
+ | [`anchordb-relay`](https://www.npmjs.com/package/anchordb-relay) | Dev relay for the Anchor Lens inspector | your laptop |
170
+
171
+ Each one needs a different third-party framework as a peer dependency, and npm resolves those per
172
+ package rather than per import — which is why they are not one package. Full reasoning and API
173
+ reference: [github.com/knnadeera/anchordb](https://github.com/knnadeera/anchordb).
174
+
158
175
  ## License
159
176
 
160
177
  MIT
@@ -28,13 +28,15 @@ import { SqlAdapterBase, type SqlDriver } from "./sql-base.js";
28
28
  export interface ExpoSQLiteModule {
29
29
  openDatabaseAsync(name: string, options?: Record<string, unknown>): Promise<ExpoDatabase>;
30
30
  }
31
+ /** What SQLite can bind to a placeholder. Mirrors expo-sqlite's own `SQLiteBindValue`. */
32
+ export type ExpoBindValue = string | number | boolean | null | Uint8Array | ArrayBuffer;
31
33
  export interface ExpoDatabase {
32
34
  execAsync(source: string): Promise<void>;
33
- runAsync(source: string, params?: unknown[]): Promise<{
35
+ runAsync(source: string, params: ExpoBindValue[]): Promise<{
34
36
  changes: number;
35
37
  lastInsertRowId: number;
36
38
  }>;
37
- getAllAsync<T>(source: string, params?: unknown[]): Promise<T[]>;
39
+ getAllAsync<T>(source: string, params: ExpoBindValue[]): Promise<T[]>;
38
40
  withExclusiveTransactionAsync(task: (tx: ExpoDatabase) => Promise<void>): Promise<void>;
39
41
  closeAsync(): Promise<void>;
40
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"expo-sqlite.d.ts","sourceRoot":"","sources":["../../../../src/storage/adapters/expo-sqlite.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC3F;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC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Aa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,UAAU,GAAG,WAAW,CAAC;AAExF,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAOzC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzG,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IACtE,6BAA6B,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxF,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,wBAAwB;IACvC,yCAAyC;IACzC,MAAM,EAAE,gBAAgB,CAAC;IACzB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,iBAAkB,SAAQ,cAAc;IACnD,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,OAAO,EAAE,wBAAwB;cAa7B,YAAY,IAAI,OAAO,CAAC,SAAS,CAAC;CAoCnD"}
@@ -23,6 +23,8 @@ class ExpoSqliteAdapter extends sql_base_ts_1.SqlAdapterBase {
23
23
  let inTransaction = false;
24
24
  return {
25
25
  name: "expo-sqlite",
26
+ // The SqlDriver contract is `unknown[]` because it is shared by every SQL adapter. The
27
+ // narrowing to SQLite's bind types happens here, at the boundary, and only here.
26
28
  run: async (sql, params = []) => {
27
29
  await db.runAsync(sql, params);
28
30
  },
@@ -1 +1 @@
1
- {"version":3,"file":"expo-sqlite.js","sourceRoot":"","sources":["../../../../src/storage/adapters/expo-sqlite.ts"],"names":[],"mappings":";;;AAAA,oDAAyD;AACzD,+CAA+D;AAiD/D,MAAa,iBAAkB,SAAQ,4BAAc;IAKnD,YAAY,OAAiC;QAC3C,KAAK,CAAC,OAAO,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC;QAL3B,SAAI,GAAG,aAAa,CAAC;QAM5B,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC;YACvC,MAAM,IAAI,6BAAiB,CACzB,kDAAkD;gBAChD,iEAAiE;gBACjE,sCAAsC,CACzC,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,GAAG,OAAO,CAAC,MAAM,IAAI,QAAQ,KAAK,CAAC;IACzE,CAAC;IAES,KAAK,CAAC,YAAY;QAC1B,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC9D,6FAA6F;QAC7F,6DAA6D;QAC7D,MAAM,EAAE,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAAC;QAEjD,IAAI,aAAa,GAAG,KAAK,CAAC;QAE1B,OAAO;YACL,IAAI,EAAE,aAAa;YACnB,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,GAAG,EAAE,EAAE,EAAE;gBAC9B,MAAM,EAAE,CAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;YACjC,CAAC;YACD,GAAG,EAAE,KAAK,EAAK,GAAW,EAAE,SAAoB,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,CAAI,GAAG,EAAE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;CACF;AAtDD,8CAsDC"}
@@ -28,13 +28,15 @@ import { SqlAdapterBase, type SqlDriver } from "./sql-base.js";
28
28
  export interface ExpoSQLiteModule {
29
29
  openDatabaseAsync(name: string, options?: Record<string, unknown>): Promise<ExpoDatabase>;
30
30
  }
31
+ /** What SQLite can bind to a placeholder. Mirrors expo-sqlite's own `SQLiteBindValue`. */
32
+ export type ExpoBindValue = string | number | boolean | null | Uint8Array | ArrayBuffer;
31
33
  export interface ExpoDatabase {
32
34
  execAsync(source: string): Promise<void>;
33
- runAsync(source: string, params?: unknown[]): Promise<{
35
+ runAsync(source: string, params: ExpoBindValue[]): Promise<{
34
36
  changes: number;
35
37
  lastInsertRowId: number;
36
38
  }>;
37
- getAllAsync<T>(source: string, params?: unknown[]): Promise<T[]>;
39
+ getAllAsync<T>(source: string, params: ExpoBindValue[]): Promise<T[]>;
38
40
  withExclusiveTransactionAsync(task: (tx: ExpoDatabase) => Promise<void>): Promise<void>;
39
41
  closeAsync(): Promise<void>;
40
42
  }
@@ -1 +1 @@
1
- {"version":3,"file":"expo-sqlite.d.ts","sourceRoot":"","sources":["../../../../src/storage/adapters/expo-sqlite.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC3F;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QA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WAAW,CAAC;AAExF,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAOzC,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzG,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;IACtE,6BAA6B,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxF,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,wBAAwB;IACvC,yCAAyC;IACzC,MAAM,EAAE,gBAAgB,CAAC;IACzB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,iBAAkB,SAAQ,cAAc;IACnD,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,OAAO,EAAE,wBAAwB;cAa7B,YAAY,IAAI,OAAO,CAAC,SAAS,CAAC;CAoCnD"}
@@ -20,6 +20,8 @@ export class ExpoSqliteAdapter extends SqlAdapterBase {
20
20
  let inTransaction = false;
21
21
  return {
22
22
  name: "expo-sqlite",
23
+ // The SqlDriver contract is `unknown[]` because it is shared by every SQL adapter. The
24
+ // narrowing to SQLite's bind types happens here, at the boundary, and only here.
23
25
  run: async (sql, params = []) => {
24
26
  await db.runAsync(sql, params);
25
27
  },
@@ -1 +1 @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E,CAAC,EAAE,CAAC,UAAU,EAAE;SACnC,CAAC;IACJ,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anchordb",
3
- "version": "0.2.0",
3
+ "version": "1.0.0",
4
4
  "description": "MongoDB + Mongoose for mobile apps. Offline-first local database with optional sync.",
5
5
  "keywords": [
6
6
  "mongodb",
@@ -12,9 +12,16 @@
12
12
  "ionic",
13
13
  "capacitor",
14
14
  "sqlite",
15
+ "indexeddb",
15
16
  "sync",
16
17
  "objectid",
17
- "database"
18
+ "database",
19
+ "nosql",
20
+ "document-database",
21
+ "embedded-database",
22
+ "mobile-database",
23
+ "aggregation",
24
+ "schema"
18
25
  ],
19
26
  "license": "MIT",
20
27
  "type": "module",
@@ -159,5 +166,33 @@
159
166
  ],
160
167
  "profile": "node16"
161
168
  },
162
- "author": "Nisala Nadeera <knnadeera@gmail.com>"
169
+ "author": "Nisala Nadeera <knnadeera@gmail.com>",
170
+ "typesVersions": {
171
+ "*": {
172
+ "decorators": [
173
+ "./dist/esm/decorators/index.d.ts"
174
+ ],
175
+ "storage/node-sqlite": [
176
+ "./dist/esm/storage/adapters/node-sqlite.d.ts"
177
+ ],
178
+ "sync": [
179
+ "./dist/esm/sync/attach.d.ts"
180
+ ],
181
+ "inspector": [
182
+ "./dist/esm/inspector/agent.d.ts"
183
+ ],
184
+ "storage/expo-sqlite": [
185
+ "./dist/esm/storage/adapters/expo-sqlite.d.ts"
186
+ ],
187
+ "storage/capacitor-sqlite": [
188
+ "./dist/esm/storage/adapters/capacitor-sqlite.d.ts"
189
+ ],
190
+ "storage/indexeddb": [
191
+ "./dist/esm/storage/adapters/indexeddb.d.ts"
192
+ ],
193
+ "storage/memory": [
194
+ "./dist/esm/storage/adapters/memory.d.ts"
195
+ ]
196
+ }
197
+ }
163
198
  }