@allourthings/core 0.1.11 → 1.0.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/README.md +35 -9
- package/allourthings-core.darwin-arm64.node +0 -0
- package/allourthings-core.darwin-x64.node +0 -0
- package/allourthings-core.linux-x64-gnu.node +0 -0
- package/allourthings-core.win32-x64-msvc.node +0 -0
- package/index.d.ts +8 -2
- package/index.js +18 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
# allourthings-core
|
|
2
2
|
|
|
3
|
-
Rust storage library for [AllOurThings](https://allourthings.io) — an AI-powered
|
|
3
|
+
Rust storage library for [AllOurThings](https://allourthings.io) — an AI-powered inventory system.
|
|
4
4
|
|
|
5
|
-
Shared across clients via platform-specific bindings:
|
|
6
|
-
|
|
7
|
-
| Consumer | Distribution |
|
|
8
|
-
|---|---|
|
|
9
|
-
| MCP server (Node.js) | npm — `@allourthings/core` |
|
|
10
|
-
| iOS app | Swift Package Manager — binary XCFramework |
|
|
11
|
-
| Android app *(planned)* | crates.io — `allourthings-core` |
|
|
12
5
|
|
|
13
6
|
## Storage format
|
|
14
7
|
|
|
@@ -18,7 +11,40 @@ Each item is a directory containing a single JSON file:
|
|
|
18
11
|
<data-dir>/items/<slug>-<id>/item.json
|
|
19
12
|
```
|
|
20
13
|
|
|
21
|
-
|
|
14
|
+
The directory name is `<slug>-<id>` where `<slug>` is a URL-safe lowercase version of the item name (max 50 chars) and `<id>` is an 8-character lowercase hex string.
|
|
15
|
+
|
|
16
|
+
Required fields: `id`, `name`, `created_at`, `updated_at`. Well-known optional fields include `category`, `subcategory`, `tags`, and `attachments`. Any additional fields are preserved and round-trip without modification.
|
|
17
|
+
|
|
18
|
+
Attachment files (PDFs, images, etc.) are stored alongside `item.json` in the same directory.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Query cache
|
|
22
|
+
|
|
23
|
+
`CatalogStore` supports an optional SQLite query cache for efficient filtering.
|
|
24
|
+
|
|
25
|
+
The cache is write-through — every mutation (`add_item`, `update_item`, `delete_item`, and the attachment operations) updates the cache immediately. Call `refresh()` to sync changes written externally (e.g. by another process or a mobile app), and `rebuild_cache()` to fully repopulate from disk if the cache becomes corrupt.
|
|
26
|
+
|
|
27
|
+
| Platform | Default location |
|
|
28
|
+
|---|---|
|
|
29
|
+
| macOS | `~/Library/Caches/allourthings/<hash>/` |
|
|
30
|
+
| Windows | `%LOCALAPPDATA%\allourthings\<hash>\` |
|
|
31
|
+
| Linux | `~/.cache/allourthings/<hash>/` |
|
|
32
|
+
|
|
33
|
+
The `<hash>` is a SHA-256 of the data directory path, so multiple vaults each get their own isolated cache.
|
|
34
|
+
|
|
35
|
+
The cache schema indexes `category`, `subcategory`, and `tags` for SQL filtering, and stores the full item as a JSON blob for everything else. All three are optional on any item — items missing them are stored and returned normally, they just won't appear when those specific filters are applied. Keeping the indexed columns to only those actually queried means new well-known fields can be added without any schema migration.
|
|
36
|
+
|
|
37
|
+
## Running tests
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
cargo test
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
This runs two test suites:
|
|
44
|
+
|
|
45
|
+
- **Unit tests** (in `src/`) — cover the item schema, slug generation, ID generation, storage CRUD, attachments, and cache write-through behaviour
|
|
46
|
+
- **Conformance tests** (`tests/conformance.rs`) — assert against the shared fixtures in `test-fixtures/catalog/`. These define the canonical storage format that all AllOurThings clients (MCP server, iOS app, etc.) must honour
|
|
47
|
+
|
|
22
48
|
|
|
23
49
|
## License
|
|
24
50
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
/** Filter options for listItems, exposed as a plain JS object. */
|
|
7
7
|
export interface JsListFilter {
|
|
8
8
|
category?: string
|
|
9
|
-
|
|
9
|
+
subcategory?: string
|
|
10
10
|
tags?: Array<string>
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
@@ -17,11 +17,17 @@ export interface JsListFilter {
|
|
|
17
17
|
* blocking the event loop (operations are fast local filesystem I/O).
|
|
18
18
|
*/
|
|
19
19
|
export declare class JsCatalogStore {
|
|
20
|
-
constructor(dataDir: string)
|
|
20
|
+
constructor(dataDir: string, cacheDir?: string | undefined | null)
|
|
21
|
+
refresh(): NapiResult
|
|
22
|
+
rebuildCache(): NapiResult
|
|
21
23
|
addItem(newItem: any): NapiResult
|
|
22
24
|
getItem(idOrName: string): NapiResult
|
|
23
25
|
listItems(filter?: JsListFilter | undefined | null): NapiResult
|
|
24
26
|
updateItem(id: string, updates: any): NapiResult
|
|
25
27
|
deleteItem(id: string): NapiResult
|
|
26
28
|
searchItems(query: string): NapiResult
|
|
29
|
+
getItemFields(): NapiResult
|
|
30
|
+
addAttachment(itemId: string, filename: string, kind: string, data: Buffer, label?: string | undefined | null): NapiResult
|
|
31
|
+
getAttachment(itemId: string, filename: string): NapiResult
|
|
32
|
+
deleteAttachment(itemId: string, filename: string): NapiResult
|
|
27
33
|
}
|
package/index.js
CHANGED
|
@@ -37,7 +37,7 @@ switch (platform) {
|
|
|
37
37
|
if (localFileExisted) {
|
|
38
38
|
nativeBinding = require('./allourthings-core.android-arm64.node')
|
|
39
39
|
} else {
|
|
40
|
-
nativeBinding = require('allourthings
|
|
40
|
+
nativeBinding = require('@allourthings/core-android-arm64')
|
|
41
41
|
}
|
|
42
42
|
} catch (e) {
|
|
43
43
|
loadError = e
|
|
@@ -49,7 +49,7 @@ switch (platform) {
|
|
|
49
49
|
if (localFileExisted) {
|
|
50
50
|
nativeBinding = require('./allourthings-core.android-arm-eabi.node')
|
|
51
51
|
} else {
|
|
52
|
-
nativeBinding = require('allourthings
|
|
52
|
+
nativeBinding = require('@allourthings/core-android-arm-eabi')
|
|
53
53
|
}
|
|
54
54
|
} catch (e) {
|
|
55
55
|
loadError = e
|
|
@@ -69,7 +69,7 @@ switch (platform) {
|
|
|
69
69
|
if (localFileExisted) {
|
|
70
70
|
nativeBinding = require('./allourthings-core.win32-x64-msvc.node')
|
|
71
71
|
} else {
|
|
72
|
-
nativeBinding = require('allourthings
|
|
72
|
+
nativeBinding = require('@allourthings/core-win32-x64-msvc')
|
|
73
73
|
}
|
|
74
74
|
} catch (e) {
|
|
75
75
|
loadError = e
|
|
@@ -83,7 +83,7 @@ switch (platform) {
|
|
|
83
83
|
if (localFileExisted) {
|
|
84
84
|
nativeBinding = require('./allourthings-core.win32-ia32-msvc.node')
|
|
85
85
|
} else {
|
|
86
|
-
nativeBinding = require('allourthings
|
|
86
|
+
nativeBinding = require('@allourthings/core-win32-ia32-msvc')
|
|
87
87
|
}
|
|
88
88
|
} catch (e) {
|
|
89
89
|
loadError = e
|
|
@@ -97,7 +97,7 @@ switch (platform) {
|
|
|
97
97
|
if (localFileExisted) {
|
|
98
98
|
nativeBinding = require('./allourthings-core.win32-arm64-msvc.node')
|
|
99
99
|
} else {
|
|
100
|
-
nativeBinding = require('allourthings
|
|
100
|
+
nativeBinding = require('@allourthings/core-win32-arm64-msvc')
|
|
101
101
|
}
|
|
102
102
|
} catch (e) {
|
|
103
103
|
loadError = e
|
|
@@ -113,7 +113,7 @@ switch (platform) {
|
|
|
113
113
|
if (localFileExisted) {
|
|
114
114
|
nativeBinding = require('./allourthings-core.darwin-universal.node')
|
|
115
115
|
} else {
|
|
116
|
-
nativeBinding = require('allourthings
|
|
116
|
+
nativeBinding = require('@allourthings/core-darwin-universal')
|
|
117
117
|
}
|
|
118
118
|
break
|
|
119
119
|
} catch {}
|
|
@@ -124,7 +124,7 @@ switch (platform) {
|
|
|
124
124
|
if (localFileExisted) {
|
|
125
125
|
nativeBinding = require('./allourthings-core.darwin-x64.node')
|
|
126
126
|
} else {
|
|
127
|
-
nativeBinding = require('allourthings
|
|
127
|
+
nativeBinding = require('@allourthings/core-darwin-x64')
|
|
128
128
|
}
|
|
129
129
|
} catch (e) {
|
|
130
130
|
loadError = e
|
|
@@ -138,7 +138,7 @@ switch (platform) {
|
|
|
138
138
|
if (localFileExisted) {
|
|
139
139
|
nativeBinding = require('./allourthings-core.darwin-arm64.node')
|
|
140
140
|
} else {
|
|
141
|
-
nativeBinding = require('allourthings
|
|
141
|
+
nativeBinding = require('@allourthings/core-darwin-arm64')
|
|
142
142
|
}
|
|
143
143
|
} catch (e) {
|
|
144
144
|
loadError = e
|
|
@@ -157,7 +157,7 @@ switch (platform) {
|
|
|
157
157
|
if (localFileExisted) {
|
|
158
158
|
nativeBinding = require('./allourthings-core.freebsd-x64.node')
|
|
159
159
|
} else {
|
|
160
|
-
nativeBinding = require('allourthings
|
|
160
|
+
nativeBinding = require('@allourthings/core-freebsd-x64')
|
|
161
161
|
}
|
|
162
162
|
} catch (e) {
|
|
163
163
|
loadError = e
|
|
@@ -174,7 +174,7 @@ switch (platform) {
|
|
|
174
174
|
if (localFileExisted) {
|
|
175
175
|
nativeBinding = require('./allourthings-core.linux-x64-musl.node')
|
|
176
176
|
} else {
|
|
177
|
-
nativeBinding = require('allourthings
|
|
177
|
+
nativeBinding = require('@allourthings/core-linux-x64-musl')
|
|
178
178
|
}
|
|
179
179
|
} catch (e) {
|
|
180
180
|
loadError = e
|
|
@@ -187,7 +187,7 @@ switch (platform) {
|
|
|
187
187
|
if (localFileExisted) {
|
|
188
188
|
nativeBinding = require('./allourthings-core.linux-x64-gnu.node')
|
|
189
189
|
} else {
|
|
190
|
-
nativeBinding = require('allourthings
|
|
190
|
+
nativeBinding = require('@allourthings/core-linux-x64-gnu')
|
|
191
191
|
}
|
|
192
192
|
} catch (e) {
|
|
193
193
|
loadError = e
|
|
@@ -203,7 +203,7 @@ switch (platform) {
|
|
|
203
203
|
if (localFileExisted) {
|
|
204
204
|
nativeBinding = require('./allourthings-core.linux-arm64-musl.node')
|
|
205
205
|
} else {
|
|
206
|
-
nativeBinding = require('allourthings
|
|
206
|
+
nativeBinding = require('@allourthings/core-linux-arm64-musl')
|
|
207
207
|
}
|
|
208
208
|
} catch (e) {
|
|
209
209
|
loadError = e
|
|
@@ -216,7 +216,7 @@ switch (platform) {
|
|
|
216
216
|
if (localFileExisted) {
|
|
217
217
|
nativeBinding = require('./allourthings-core.linux-arm64-gnu.node')
|
|
218
218
|
} else {
|
|
219
|
-
nativeBinding = require('allourthings
|
|
219
|
+
nativeBinding = require('@allourthings/core-linux-arm64-gnu')
|
|
220
220
|
}
|
|
221
221
|
} catch (e) {
|
|
222
222
|
loadError = e
|
|
@@ -232,7 +232,7 @@ switch (platform) {
|
|
|
232
232
|
if (localFileExisted) {
|
|
233
233
|
nativeBinding = require('./allourthings-core.linux-arm-musleabihf.node')
|
|
234
234
|
} else {
|
|
235
|
-
nativeBinding = require('allourthings
|
|
235
|
+
nativeBinding = require('@allourthings/core-linux-arm-musleabihf')
|
|
236
236
|
}
|
|
237
237
|
} catch (e) {
|
|
238
238
|
loadError = e
|
|
@@ -245,7 +245,7 @@ switch (platform) {
|
|
|
245
245
|
if (localFileExisted) {
|
|
246
246
|
nativeBinding = require('./allourthings-core.linux-arm-gnueabihf.node')
|
|
247
247
|
} else {
|
|
248
|
-
nativeBinding = require('allourthings
|
|
248
|
+
nativeBinding = require('@allourthings/core-linux-arm-gnueabihf')
|
|
249
249
|
}
|
|
250
250
|
} catch (e) {
|
|
251
251
|
loadError = e
|
|
@@ -261,7 +261,7 @@ switch (platform) {
|
|
|
261
261
|
if (localFileExisted) {
|
|
262
262
|
nativeBinding = require('./allourthings-core.linux-riscv64-musl.node')
|
|
263
263
|
} else {
|
|
264
|
-
nativeBinding = require('allourthings
|
|
264
|
+
nativeBinding = require('@allourthings/core-linux-riscv64-musl')
|
|
265
265
|
}
|
|
266
266
|
} catch (e) {
|
|
267
267
|
loadError = e
|
|
@@ -274,7 +274,7 @@ switch (platform) {
|
|
|
274
274
|
if (localFileExisted) {
|
|
275
275
|
nativeBinding = require('./allourthings-core.linux-riscv64-gnu.node')
|
|
276
276
|
} else {
|
|
277
|
-
nativeBinding = require('allourthings
|
|
277
|
+
nativeBinding = require('@allourthings/core-linux-riscv64-gnu')
|
|
278
278
|
}
|
|
279
279
|
} catch (e) {
|
|
280
280
|
loadError = e
|
|
@@ -289,7 +289,7 @@ switch (platform) {
|
|
|
289
289
|
if (localFileExisted) {
|
|
290
290
|
nativeBinding = require('./allourthings-core.linux-s390x-gnu.node')
|
|
291
291
|
} else {
|
|
292
|
-
nativeBinding = require('allourthings
|
|
292
|
+
nativeBinding = require('@allourthings/core-linux-s390x-gnu')
|
|
293
293
|
}
|
|
294
294
|
} catch (e) {
|
|
295
295
|
loadError = e
|