@vibesdotdev/storage 0.0.1 → 0.0.2
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 +12 -65
- package/package.json +9 -10
- package/SPEC.md +0 -60
package/README.md
CHANGED
|
@@ -1,75 +1,22 @@
|
|
|
1
1
|
# @vibesdotdev/storage
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
runtime kinds, the `StorageManifest<T>` base, and the sync/policy/record
|
|
5
|
-
abstractions. Adapters live in sibling packages and register themselves.
|
|
3
|
+
Storage manifests, record contracts, and runtime descriptors for Vibes data adapters.
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
This package is part of the public Vibes framework package set. The source repository is private while the public repository split is being prepared, so package documentation is published on the Vibes docs site.
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
## Install
|
|
10
8
|
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export const sessions = createStorageManifest({
|
|
16
|
-
id: 'auth.sessions',
|
|
17
|
-
namespace: 'auth',
|
|
18
|
-
schema: z.object({
|
|
19
|
-
id: z.string(),
|
|
20
|
-
userId: z.string(),
|
|
21
|
-
expiresAt: z.string().datetime(),
|
|
22
|
-
}),
|
|
23
|
-
adapters: ['localdb', 'cloud-api'],
|
|
24
|
-
});
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### Load + save through the runtime
|
|
28
|
-
|
|
29
|
-
```ts
|
|
30
|
-
import { StorageManifest } from '@vibesdotdev/storage';
|
|
31
|
-
|
|
32
|
-
const sessions = new StorageManifest('auth.sessions');
|
|
33
|
-
await sessions.put({ id: 's1', userId: 'u1', expiresAt: '2026-12-31T00:00:00Z' });
|
|
34
|
-
const session = await sessions.get('s1');
|
|
9
|
+
```sh
|
|
10
|
+
bun add @vibesdotdev/storage
|
|
11
|
+
# or
|
|
12
|
+
npm install @vibesdotdev/storage
|
|
35
13
|
```
|
|
36
14
|
|
|
37
|
-
|
|
38
|
-
cloud-side) based on scope. Feature code never branches on hardware.
|
|
39
|
-
|
|
40
|
-
### Sync (local-first)
|
|
41
|
-
|
|
42
|
-
When sync is enabled in runtime config, consumer writes mirror to the cloud
|
|
43
|
-
adapter via `cloud-sync.consumer`. Sync state is tracked in a separate
|
|
44
|
-
manifest so divergent writes are reconciled rather than silently merged.
|
|
45
|
-
|
|
46
|
-
## Adapters
|
|
15
|
+
## Documentation
|
|
47
16
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
- [`@vibesdotdev/storage-adapter-memory`](../storage-adapter-memory/) — tests/ephemeral
|
|
52
|
-
- [`@vibesdotdev/storage-adapter-json`](../storage-adapter-json/) — local file-backed
|
|
53
|
-
- [`@vibesdotdev/storage-adapter-localdb`](../storage-adapter-localdb/) — SQLite (Bun)
|
|
54
|
-
- [`@vibesdotdev/storage-adapter-cloud-api`](../storage-adapter-cloud-api/) — hosted
|
|
55
|
-
- [`@vibesdotdev/storage-adapter-drizzle`](../storage-adapter-drizzle/) — SQL via Drizzle
|
|
56
|
-
- External integrations (SharePoint, etc.) → [`platform`](../platform/SPEC.md)
|
|
57
|
-
|
|
58
|
-
## CLI
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
vibes storage list
|
|
62
|
-
vibes storage status
|
|
63
|
-
vibes storage sync run
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## Test
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
bun run test
|
|
70
|
-
```
|
|
17
|
+
- Package guide: https://docs.vibes.dev/packages/storage
|
|
18
|
+
- Vibes docs: https://docs.vibes.dev
|
|
71
19
|
|
|
72
|
-
##
|
|
20
|
+
## License
|
|
73
21
|
|
|
74
|
-
|
|
75
|
-
- [runtime](../runtime/SPEC.md), [config](../config/SPEC.md)
|
|
22
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibesdotdev/storage",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -190,17 +190,12 @@
|
|
|
190
190
|
"registry": "https://registry.npmjs.org",
|
|
191
191
|
"access": "public"
|
|
192
192
|
},
|
|
193
|
-
"repository": {
|
|
194
|
-
"type": "git",
|
|
195
|
-
"url": "git+https://github.com/vibesdotdev/monorepo.git",
|
|
196
|
-
"directory": "packages/storage"
|
|
197
|
-
},
|
|
198
193
|
"peerDependencies": {
|
|
199
|
-
"@vibesdotdev/runtime": "0.0.
|
|
194
|
+
"@vibesdotdev/runtime": "0.0.2"
|
|
200
195
|
},
|
|
201
196
|
"dependencies": {
|
|
202
|
-
"@vibesdotdev/logging": "0.0.
|
|
203
|
-
"@vibesdotdev/runtime-plugin-types": "0.0.
|
|
197
|
+
"@vibesdotdev/logging": "0.0.2",
|
|
198
|
+
"@vibesdotdev/runtime-plugin-types": "0.0.2",
|
|
204
199
|
"zod": "^4.3.6"
|
|
205
200
|
},
|
|
206
201
|
"scripts": {
|
|
@@ -216,7 +211,6 @@
|
|
|
216
211
|
"src",
|
|
217
212
|
"bin",
|
|
218
213
|
"README.md",
|
|
219
|
-
"SPEC.md",
|
|
220
214
|
"LICENSE",
|
|
221
215
|
"!src/**/__tests__/**",
|
|
222
216
|
"!src/**/__stubs__/**",
|
|
@@ -237,5 +231,10 @@
|
|
|
237
231
|
],
|
|
238
232
|
"vibes": {
|
|
239
233
|
"visibility": "public-framework"
|
|
234
|
+
},
|
|
235
|
+
"description": "Storage manifests, record contracts, and runtime descriptors for Vibes data adapters.",
|
|
236
|
+
"homepage": "https://docs.vibes.dev/packages/storage",
|
|
237
|
+
"bugs": {
|
|
238
|
+
"url": "https://docs.vibes.dev/packages/storage#support"
|
|
240
239
|
}
|
|
241
240
|
}
|
package/SPEC.md
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# @vibesdotdev/storage
|
|
2
|
-
|
|
3
|
-
Runtime-resolved persistence. Universal core: defines the kinds, manifest base, sync/policy/record abstractions. Adapters live in sibling packages and register themselves.
|
|
4
|
-
|
|
5
|
-
## Owns
|
|
6
|
-
|
|
7
|
-
- **Runtime kinds:**
|
|
8
|
-
- `storage/adapter` — storage backends (impls live in sibling adapter packages). Descriptors carry a coarse-grained `capabilities: ('list'|'read'|'write'|'browse')[]` array (default `['read','write']`); adapters declaring `'browse'` implement `listDrives() → StorageDrive[]` + `list(driveId, path) → StorageEntry[]`.
|
|
9
|
-
- `storage/manifest` — storable data type definitions; default impl `StorageManifest`
|
|
10
|
-
- `storage/record` — single-table CRUD with relations, indexes, FTS, migrations, computed fields, hierarchy, and side effects
|
|
11
|
-
- `storage/sync-bridge` — declarative runtime-kind ↔ cloud-CRUD sync wiring (server/CLI only; no default impl)
|
|
12
|
-
- **`StorageManifest<T>`** (`./manifest`): base manifest, source-policy, cloud-sync handoff (`cloud-sync.consumer` — universal; uses runtime to resolve cloud adapter)
|
|
13
|
-
- **Interfaces** (`./interfaces`): adapter, document-store, key-value, repository, record, schema, and `StorageConsumerFs` TS contracts. `StorageAdapterInterface` declares optional `listDrives()` and `list(driveId, path)` methods for `browse`-capable adapters.
|
|
14
|
-
- **Schemas** (`./schemas`): Zod schemas for adapter / manifest / record / schema / sync-bridge descriptors, plus the rich record-descriptor surface (relations, indexes, FTS, migrations, computed fields, hierarchy, side effects) and the multi-table `StorageSchemaDescriptor`. Also exports `StorageEntrySchema`, `StorageDriveSchema`, and `StorageCapabilitySchema` for use by browse-capable adapters and consumers.
|
|
15
|
-
- **Client surface** (`./client`): `listBrowsableStorageAdapters()` — synchronous helper that queries the runtime for every `storage/adapter` descriptor with `'browse'` in `capabilities`. Consumed by picker UIs (AI model sources, knowledge corpora, etc.). Does not load implementations.
|
|
16
|
-
- **Record events** (`./record/events`): `storage.record.afterCreate`, `storage.record.afterUpdate`, `storage.record.afterDelete` — registered as descriptors by the plugin
|
|
17
|
-
- **Sync** (`./sync`): sync-bridge, record-sync-bridge, cloud-pull, sync-manifest, sync-state, resolve-sync-target — all runtime-resolved, no adapter imports
|
|
18
|
-
- **Policy** (`./policy`): storage policy / overrides / persistence / context / types, plus `storage-policy.context.descriptor` (universal descriptor) and `storage-policy.context.server` (server-side loader; registered via plugin `onRegister`)
|
|
19
|
-
- **Record** (`./record`): base record class (`StorageRecord`), events, extensions
|
|
20
|
-
- **Resolver** (`./resolver/storage-backed-resolver`): resolves arbitrary kinds whose data lives in either a `storage/manifest` or a `config/manifest`
|
|
21
|
-
- **Bridge** (`./bridge`): `storage-kind-bridge` + `bridgeStorageKinds` helper that hydrates feature kinds from their backing storage manifests
|
|
22
|
-
- **CLI** (`./cli`): `vibes storage` and `vibes storage sync` groups; commands `storage list`, `storage sync pull`, `storage sync push`, `storage sync status`, `storage sync resolve` — all query the runtime, never import adapters
|
|
23
|
-
- **TUI** (`./tui`): `storage.explorer` (`tui/app`) and `storage.open` (`tui/command`) — registered conditionally by plugin `onRegister` when the `tui/*` kinds are loaded
|
|
24
|
-
- **Daemon commands** (`./daemon/commands`): storage RPC verbs `sync.status`, `sync.trigger`, `sync.resolve` using runtime-plugin types, self-contained implementations
|
|
25
|
-
- **Paths** (`./paths`): canonical storage path resolution (string-only, no FS)
|
|
26
|
-
- **Plugin** (`./storage.plugin` = `./plugin`): registers the four runtime kinds, the CLI groups + commands, and the record-event descriptors. `onRegister` additionally wires the storage-policy context loader and (when `tui/app` / `tui/command` are present) the TUI explorer + open implementations.
|
|
27
|
-
|
|
28
|
-
## Does not own
|
|
29
|
-
|
|
30
|
-
- **Adapter implementations.** Each adapter is its own package: [`storage-adapter-json`](../storage-adapter-json/), [`storage-adapter-localdb`](../storage-adapter-localdb/), [`storage-adapter-memory`](../storage-adapter-memory/), [`storage-adapter-cloud-api`](../storage-adapter-cloud-api/), [`storage-adapter-drizzle`](../storage-adapter-drizzle/). They each register `storage/adapter` descriptors when imported.
|
|
31
|
-
- **External-integration adapters** (SharePoint, etc.) → the owning integration package (e.g. [`integrations-microsoft`](../integrations-microsoft/SPEC.md) registers the `sharepoint` adapter alongside the Microsoft 365 integration providers).
|
|
32
|
-
- **Server DB connection helper.** Lives in [`storage-adapter-drizzle`](../storage-adapter-drizzle/SPEC.md) (`./db` subpath), co-located with the Drizzle persistence factory.
|
|
33
|
-
- **Encryption primitive** → [`config/services`](../config/SPEC.md). Encrypted adapters consume it.
|
|
34
|
-
- **Configuration modeling** → [`config`](../config/SPEC.md).
|
|
35
|
-
- **Domain-specific manifests** (chat history, AI artifacts, knowledge sources, account tables, etc.). Each owning module declares its own `storage/manifest` descriptors.
|
|
36
|
-
- **Module-level client** (`runtime/client`). Storage is consumed via `StorageManifest<T>` instances and runtime kind resolution directly.
|
|
37
|
-
|
|
38
|
-
## Hard rules
|
|
39
|
-
|
|
40
|
-
- **The core package is universal.** No Node/Bun/SQL/HTTP imports in core. Anything that breaks browser or Cloudflare bundles belongs in an adapter package.
|
|
41
|
-
- **All persistence goes through `StorageManifest<T>`.** No direct adapter calls in features.
|
|
42
|
-
- **Adapter selection is runtime-resolved.** Manifests declare allowed adapters; runtime picks one via scope (`hardware`, `qualifiers: { storage }`). Features do not branch on `isCloud`/`connectionMode`.
|
|
43
|
-
- **Local-first writes can mirror to cloud** when sync is enabled. Sync state is tracked separately; do not silently merge divergent writes.
|
|
44
|
-
- **Adapter package contract:** each `storage-adapter-{name}` package exports a plugin that registers a `storage/adapter` descriptor + impl. Apps load the adapter packages their scope can support. The core never imports adapter packages.
|
|
45
|
-
- **CLI / TUI / daemon descriptors here query the runtime; they do not import adapters.**
|
|
46
|
-
|
|
47
|
-
## Public entrypoints
|
|
48
|
-
|
|
49
|
-
Canonical entrypoints: `.`, `./manifest`, `./manifest/*`, `./interfaces`, `./interfaces/record`, `./interfaces/schema`, `./interfaces/*`, `./schemas`, `./schemas/record`, `./schemas/schema`, `./schemas/*`, `./sync`, `./sync/*`, `./record`, `./record/base`, `./record/*`, `./bridge`, `./bridge/types`, `./client`, `./client/*`, `./resolver/*`, `./cli/*`, `./tui/*`, `./daemon/commands/*`, `./paths`, `./plugin` (= `./storage.plugin`).
|
|
50
|
-
|
|
51
|
-
## Verification
|
|
52
|
-
|
|
53
|
-
`bun run test` from package root (runs `test:isolated` + `test:main`). Covers manifest base, sync state + bridge, policy, record, resolver, schemas, interfaces, and TUI descriptors. Adapter-specific tests live in each adapter package.
|
|
54
|
-
|
|
55
|
-
## Links
|
|
56
|
-
|
|
57
|
-
- [runtime/SPEC.md](../runtime/SPEC.md)
|
|
58
|
-
- [config/SPEC.md](../config/SPEC.md)
|
|
59
|
-
- [storage-adapter-drizzle](../storage-adapter-drizzle/)
|
|
60
|
-
- [platform/SPEC.md](../platform/SPEC.md)
|