use-vibes 2.2.12 → 2.2.13-dev.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 +67 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -31,6 +31,73 @@ import { base64ToFile } from "use-vibes";
|
|
|
31
31
|
const imageFile = base64ToFile(imageResponse.data[0].b64_json, "my-image.png");
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
+
## Standalone Fireproof (Node.js / Wrangler)
|
|
35
|
+
|
|
36
|
+
`use-vibes` exposes a standalone `fireproof()` factory for non-React contexts
|
|
37
|
+
— Node scripts, Wrangler workers, anywhere you need to read/write Fireproof
|
|
38
|
+
documents without the React hooks or the in-iframe postMessage bridge.
|
|
39
|
+
|
|
40
|
+
The bare form Just Works if you've authenticated this device with the CLI:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npx vibes-diy login
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
import { fireproof } from "use-vibes";
|
|
48
|
+
|
|
49
|
+
const db = fireproof("todos");
|
|
50
|
+
|
|
51
|
+
const ok = await db.put({ text: "hello" });
|
|
52
|
+
const doc = await db.get(ok.id);
|
|
53
|
+
const { docs } = await db.query("type", { key: "todo" });
|
|
54
|
+
|
|
55
|
+
db.subscribe((changes) => {
|
|
56
|
+
console.log("changed:", changes);
|
|
57
|
+
}, true);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### How defaults resolve
|
|
61
|
+
|
|
62
|
+
| Field | Default source (when omitted) |
|
|
63
|
+
| ---------- | ----------------------------------------------------------------------------------- |
|
|
64
|
+
| `apiUrl` | env `VIBES_DIY_API_URL`, then `https://vibes.diy/api` |
|
|
65
|
+
| `appSlug` | env `VIBES_APP_SLUG`, then `basename(process.cwd())` |
|
|
66
|
+
| `getToken` | local device-id cert from the Fireproof keybag (populated by `npx vibes-diy login`) |
|
|
67
|
+
| `userSlug` | lazy — looked up from your `defaultUserSlug` user setting on first request |
|
|
68
|
+
|
|
69
|
+
### Explicit overrides
|
|
70
|
+
|
|
71
|
+
For Wrangler / CI / service-account contexts where the CLI flow doesn't apply:
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
import { fireproof, type FireproofOpts } from "use-vibes";
|
|
75
|
+
|
|
76
|
+
const db = fireproof("todos", {
|
|
77
|
+
apiUrl: "https://vibes.diy/api",
|
|
78
|
+
appSlug: "my-app",
|
|
79
|
+
userSlug: "alice", // optional — auto-derived from token otherwise
|
|
80
|
+
getToken: async () => ({
|
|
81
|
+
isOk: () => true,
|
|
82
|
+
Ok: () => ({ type: "device-id", token: myToken }),
|
|
83
|
+
// …a real @adviser/cement Result
|
|
84
|
+
}),
|
|
85
|
+
});
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Caching semantics
|
|
89
|
+
|
|
90
|
+
Calling `fireproof(name)` repeatedly is the supported pattern:
|
|
91
|
+
|
|
92
|
+
- `fireproof("a") === fireproof("a")` — same name returns the same database instance.
|
|
93
|
+
- `fireproof("a")` and `fireproof("b")` are distinct, but **share one WebSocket connection and one resolved userSlug**.
|
|
94
|
+
- **First call's opts win.** If you need to talk to multiple `(apiUrl, appSlug)` pairs in one process, drop the sugar and construct `VibesDiyApi` + `FireflyApiAdapter` + `FireflyDatabase` directly.
|
|
95
|
+
|
|
96
|
+
### v1 limitations
|
|
97
|
+
|
|
98
|
+
- File uploads (docs with a `_files` field of `File`/`Blob` entries) are **not yet supported** — `db.put({_files: {...}})` will throw. Pure-doc workflows work end-to-end.
|
|
99
|
+
- Inside a vibe iframe the import is rewritten to `@vibes.diy/vibe-runtime`, which has its own `fireproof("name")` form that uses the postMessage bridge instead. You don't need this Node factory in iframe code.
|
|
100
|
+
|
|
34
101
|
## Core Features
|
|
35
102
|
|
|
36
103
|
### Interactive Image Generation
|
package/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useFireproof, fireproof, ImgFile, toCloud, type Fireproof, callAI, callAi, type CallAI, useVibes, type UseVibesOptions, type UseVibesResult, type VibeDocument, generateInstallId, useMobile, } from "@vibes.diy/use-vibes-base";
|
|
1
|
+
export { useFireproof, fireproof, type FireproofOpts, ImgFile, toCloud, type Fireproof, callAI, callAi, type CallAI, useVibes, type UseVibesOptions, type UseVibesResult, type VibeDocument, useViewer, type UseViewerResult, generateInstallId, useMobile, } from "@vibes.diy/use-vibes-base";
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { useFireproof, fireproof, ImgFile, toCloud, callAI, callAi, useVibes, generateInstallId, useMobile, } from "@vibes.diy/use-vibes-base";
|
|
1
|
+
export { useFireproof, fireproof, ImgFile, toCloud, callAI, callAi, useVibes, useViewer, generateInstallId, useMobile, } from "@vibes.diy/use-vibes-base";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../jsr/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,YAAY,EACZ,SAAS,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../jsr/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,YAAY,EACZ,SAAS,EAET,OAAO,EACP,OAAO,EAIP,MAAM,EACN,MAAM,EAIN,QAAQ,EAMR,SAAS,EAIT,iBAAiB,EAGjB,SAAS,GACV,MAAM,2BAA2B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-vibes",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.13-dev.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"description": "Transform any DOM element into an AI-powered micro-app",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@fireproof/core-types-base": "~0.24.19",
|
|
30
30
|
"@fireproof/core-types-protocols-cloud": "~0.24.19",
|
|
31
31
|
"@fireproof/use-fireproof": "~0.24.19",
|
|
32
|
-
"@vibes.diy/use-vibes-base": "^2.2.
|
|
32
|
+
"@vibes.diy/use-vibes-base": "^2.2.13-dev.1"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": ">=19.1.0"
|