@chipmobilesdk/rn-local-db 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@chipmobilesdk/rn-local-db",
3
- "version": "0.1.0",
4
- "private": false,
5
- "license": "UNLICENSED",
6
- "main": "src/index.ts",
3
+ "version": "0.1.1",
4
+ "private": false,
5
+ "license": "UNLICENSED",
6
+ "main": "src/index.ts",
7
7
  "types": "src/index.ts",
8
8
  "exports": {
9
9
  ".": {
@@ -31,6 +31,7 @@
31
31
  "src/scope",
32
32
  "src/sqlite",
33
33
  "src/testing",
34
+ "skills",
34
35
  "README.md",
35
36
  "CHANGELOG.md"
36
37
  ],
@@ -54,8 +55,8 @@
54
55
  "engines": {
55
56
  "node": ">=22.11.0"
56
57
  },
57
- "publishConfig": {
58
- "access": "public",
59
- "registry": "https://registry.npmjs.org/"
60
- }
61
- }
58
+ "publishConfig": {
59
+ "access": "public",
60
+ "registry": "https://registry.npmjs.org/"
61
+ }
62
+ }
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: sdk-rn-local-db
3
+ description: "Offline SQLite storage via @chipmobilesdk/rn-local-db: schemas, scoped data, queries, transactions, migrations, attachments, encryption. Use when persisting data locally, writing a migration, or handling sign-out data retention."
4
+ metadata:
5
+ package: "@chipmobilesdk/rn-local-db"
6
+ packageVersion: "0.1.0"
7
+ user-invocable: true
8
+ disable-model-invocation: false
9
+ ---
10
+
11
+ # @chipmobilesdk/rn-local-db
12
+
13
+ Local-first SQLite persistence with a scope model, declarative schemas, typed queries,
14
+ migrations, attachments and optional encryption.
15
+
16
+ ## Use this when
17
+
18
+ - Persisting any app data on device
19
+ - Declaring or changing a schema, or writing a migration
20
+ - Deciding what happens to data at sign-out
21
+ - Storing files/attachments alongside records
22
+ - Enabling encryption or answering a backup/privacy question
23
+
24
+ ## Read before writing any code
25
+
26
+ Two concepts cause most of the bugs in this package. Do not skip them:
27
+
28
+ 1. **The scope model** — data belongs to a scope, and getting the scope wrong leaks
29
+ data between users or loses it on sign-out.
30
+ 2. **The four value conditions** — this package distinguishes more record states than
31
+ "set" vs "null". Handling only two of them produces silent data loss.
32
+
33
+ Read `## The scope model` and `## Records and the four value conditions` in the README
34
+ before designing a schema.
35
+
36
+ ## Sign-out is not deletion
37
+
38
+ The README has a dedicated section (`## Deletion, and why sign-out is not deletion`).
39
+ Treat any "clear data on logout" requirement as a design question answered by that
40
+ section, not by deleting the database file.
41
+
42
+ ## Public API
43
+
44
+ `setDiagnosticLogger`, `Budgets`, and types `DiagnosticLogger`, `DiagnosticCode` are
45
+ exported from the root. The schema, query, migration, scope, crypto and attachment
46
+ surfaces are large — enumerate them from
47
+ `node_modules/@chipmobilesdk/rn-local-db/src/index.ts` when needed rather than guessing.
48
+
49
+ ## Where the detail lives
50
+
51
+ `node_modules/@chipmobilesdk/rn-local-db/README.md` is ~700 lines. Read one section:
52
+
53
+ | Need | Section |
54
+ |---|---|
55
+ | Install and native setup | `## Install` |
56
+ | Data ownership / sign-out | `## The scope model`, `## Deletion, and why sign-out is not deletion` |
57
+ | Defining tables | `## Declaring a schema` |
58
+ | Null vs missing vs unset | `## Records and the four value conditions` |
59
+ | Reading data | `## Queries` |
60
+ | Atomic writes | `## Transactions and batches` |
61
+ | Schema change | `## Migrations` |
62
+ | Files and blobs | `## Attachments` |
63
+ | Encryption at rest | `## Encryption` |
64
+ | iOS/Android backup behaviour | `## Backup posture` |
65
+
66
+ Start from `## Contents` if you are unsure which section applies.