jazz-tools 2.0.0-beta.0 → 2.0.0-beta.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 +73 -73
- package/dist/backend/inspector-ui/11.js +2 -2
- package/dist/backend/inspector-ui/12.js +2 -2
- package/dist/backend/inspector-ui/13.js +2 -2
- package/dist/backend/inspector-ui/14.js +2 -2
- package/dist/backend/inspector-ui/20.js +1 -1
- package/dist/backend/inspector-ui-files.js +4 -4
- package/dist/backend/vercel-store.d.ts.map +1 -1
- package/dist/backend/vercel-store.js +2 -1
- package/dist/backend/vercel-store.js.map +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/{index-DUKUt96e.js → index-hYDvY1xo.js} +3 -3
- package/dist/dev/inspector-overlay/embedded/assets/{jazz-broker-worker-C_mr9Omd.js → jazz-broker-worker-Ul47m6zU.js} +2 -2
- package/dist/dev/inspector-overlay/embedded/assets/{jazz_wasm-BOvbCHn3.js → jazz_wasm-zkCtl8wp.js} +1 -1
- package/dist/dev/inspector-overlay/embedded/assets/{jazz_wasm_bg-BG8gazqt.wasm → jazz_wasm_bg-xKxGDG9o.wasm} +0 -0
- package/dist/dev/inspector-overlay/embedded/embedded.html +1 -1
- package/dist/runtime/native-artifact-fingerprint-napi.d.ts +1 -1
- package/dist/runtime/native-artifact-fingerprint-napi.js +1 -1
- package/dist/runtime/native-artifact-fingerprint-napi.js.map +1 -1
- package/dist/runtime/native-artifact-fingerprint-wasm.d.ts +1 -1
- package/dist/runtime/native-artifact-fingerprint-wasm.js +1 -1
- package/dist/runtime/native-artifact-fingerprint-wasm.js.map +1 -1
- package/dist/runtime/native-artifact-fingerprints.d.ts +2 -2
- package/dist/worker/jazz-broker-worker.js +2 -2
- package/dist/worker/jazz_wasm_bg.wasm +0 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,6 +2,79 @@
|
|
|
2
2
|
|
|
3
3
|
TypeScript SDK, framework bindings, and CLI tools for **Jazz 2**.
|
|
4
4
|
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx jazz-tools generate # check jazz.app.json / jazz.permissions.json, write jazz.generated.ts
|
|
9
|
+
npx jazz-tools migrations create --name <name> # record a schema change
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Supported binary targets
|
|
13
|
+
|
|
14
|
+
- macOS arm64
|
|
15
|
+
- macOS x64
|
|
16
|
+
- Linux x64
|
|
17
|
+
- Linux arm64
|
|
18
|
+
|
|
19
|
+
If your platform is not supported in the npm package, install with Cargo from source.
|
|
20
|
+
|
|
21
|
+
## React Native boundary
|
|
22
|
+
|
|
23
|
+
The `jazz-tools/react-native` entry point requires a matching installed
|
|
24
|
+
`jazz-rn` native artifact. Persistent databases use native account admission
|
|
25
|
+
or a platform-issued `nativeRelay` capability. Storage is owned by the native
|
|
26
|
+
runtime; there is no JavaScript SQLite driver option. Explicit memory mode is
|
|
27
|
+
not supported by the React Native entrypoint.
|
|
28
|
+
|
|
29
|
+
## Relations
|
|
30
|
+
|
|
31
|
+
Relations are declared explicitly in a table's `relations` in `jazz.app.json`.
|
|
32
|
+
Store row IDs in `uuid` columns (or `{ "array": "uuid" }`), name a forward
|
|
33
|
+
relation with `{ "rel": "<table>", "column": "<column>" }`, and name a reverse
|
|
34
|
+
traversal with `{ "reverse": "<table>", "relation": "<forward relation>" }`.
|
|
35
|
+
There is no suffix convention and no automatic reverse relation: a UUID column
|
|
36
|
+
without a relation declaration stays an ordinary UUID column. See
|
|
37
|
+
[Defining tables](https://jazz.tools/docs/schemas/defining-tables) for the full rules.
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"format": 1,
|
|
42
|
+
"tables": {
|
|
43
|
+
"people": {
|
|
44
|
+
"columns": { "name": "string" },
|
|
45
|
+
"relations": { "records": { "reverse": "records", "relation": "people" } }
|
|
46
|
+
},
|
|
47
|
+
"records": {
|
|
48
|
+
"columns": { "personIds": { "array": "uuid" }, "addressId": "uuid?" },
|
|
49
|
+
"relations": {
|
|
50
|
+
"people": { "rel": "people", "column": "personIds" },
|
|
51
|
+
"address": { "rel": "people", "column": "addressId" }
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import type { RowOf } from "jazz-tools";
|
|
60
|
+
import { app } from "./jazz.generated";
|
|
61
|
+
|
|
62
|
+
export const recordsWithPeople = app.records.include({ people: true, address: true });
|
|
63
|
+
export type RecordWithPeople = RowOf<typeof recordsWithPeople>;
|
|
64
|
+
// people: Array<{ id: string; name: string }>
|
|
65
|
+
// address: { id: string; name: string } | null
|
|
66
|
+
|
|
67
|
+
export const peopleWithRecords = app.people.include({ records: true });
|
|
68
|
+
export const relatedPeople = app.records.hopTo("people");
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`RowOf` preserves scalar/array cardinality. `.requireIncludes()` refines a
|
|
72
|
+
non-nullable scalar reference's included row from `Row | null` to `Row` and
|
|
73
|
+
requires its match; nullable references such as `address` stay nullable. Required
|
|
74
|
+
array includes require all referenced matches and remain arrays. Reverse includes
|
|
75
|
+
remain arrays. Relation names come straight from `jazz.app.json`, through the
|
|
76
|
+
bindings `jazz-tools generate` writes; `generate --check` in CI catches stale ones.
|
|
77
|
+
|
|
5
78
|
## Jazz Classic API errors
|
|
6
79
|
|
|
7
80
|
Jazz 2 is a local-first relational database with tables, queries, and row-level
|
|
@@ -77,76 +150,3 @@ bindings respectively.
|
|
|
77
150
|
These diagnostics apply when using the installed Jazz 2 package. They cannot
|
|
78
151
|
intercept separate legacy packages such as `jazz-vue`, `jazz-svelte` or
|
|
79
152
|
`jazz-react` that bring their own Classic dependencies.
|
|
80
|
-
|
|
81
|
-
## Usage
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
npx jazz-tools generate # check jazz.app.json / jazz.permissions.json, write jazz.generated.ts
|
|
85
|
-
npx jazz-tools migrations create --name <name> # record a schema change
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
## Supported binary targets
|
|
89
|
-
|
|
90
|
-
- macOS arm64
|
|
91
|
-
- macOS x64
|
|
92
|
-
- Linux x64
|
|
93
|
-
- Linux arm64
|
|
94
|
-
|
|
95
|
-
If your platform is not supported in the npm package, install with Cargo from source.
|
|
96
|
-
|
|
97
|
-
## React Native boundary
|
|
98
|
-
|
|
99
|
-
The `jazz-tools/react-native` entry point requires a matching installed
|
|
100
|
-
`jazz-rn` native artifact. Persistent databases use native account admission
|
|
101
|
-
or a platform-issued `nativeRelay` capability. Storage is owned by the native
|
|
102
|
-
runtime; there is no JavaScript SQLite driver option. Explicit memory mode is
|
|
103
|
-
not supported by the React Native entrypoint.
|
|
104
|
-
|
|
105
|
-
## Relations
|
|
106
|
-
|
|
107
|
-
Relations are declared explicitly in a table's `relations` in `jazz.app.json`.
|
|
108
|
-
Store row IDs in `uuid` columns (or `{ "array": "uuid" }`), name a forward
|
|
109
|
-
relation with `{ "rel": "<table>", "column": "<column>" }`, and name a reverse
|
|
110
|
-
traversal with `{ "reverse": "<table>", "relation": "<forward relation>" }`.
|
|
111
|
-
There is no suffix convention and no automatic reverse relation: a UUID column
|
|
112
|
-
without a relation declaration stays an ordinary UUID column. See
|
|
113
|
-
[Defining tables](https://jazz.tools/docs/schemas/defining-tables) for the full rules.
|
|
114
|
-
|
|
115
|
-
```json
|
|
116
|
-
{
|
|
117
|
-
"format": 1,
|
|
118
|
-
"tables": {
|
|
119
|
-
"people": {
|
|
120
|
-
"columns": { "name": "string" },
|
|
121
|
-
"relations": { "records": { "reverse": "records", "relation": "people" } }
|
|
122
|
-
},
|
|
123
|
-
"records": {
|
|
124
|
-
"columns": { "personIds": { "array": "uuid" }, "addressId": "uuid?" },
|
|
125
|
-
"relations": {
|
|
126
|
-
"people": { "rel": "people", "column": "personIds" },
|
|
127
|
-
"address": { "rel": "people", "column": "addressId" }
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
```ts
|
|
135
|
-
import type { RowOf } from "jazz-tools";
|
|
136
|
-
import { app } from "./jazz.generated";
|
|
137
|
-
|
|
138
|
-
export const recordsWithPeople = app.records.include({ people: true, address: true });
|
|
139
|
-
export type RecordWithPeople = RowOf<typeof recordsWithPeople>;
|
|
140
|
-
// people: Array<{ id: string; name: string }>
|
|
141
|
-
// address: { id: string; name: string } | null
|
|
142
|
-
|
|
143
|
-
export const peopleWithRecords = app.people.include({ records: true });
|
|
144
|
-
export const relatedPeople = app.records.hopTo("people");
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
`RowOf` preserves scalar/array cardinality. `.requireIncludes()` refines a
|
|
148
|
-
non-nullable scalar reference's included row from `Row | null` to `Row` and
|
|
149
|
-
requires its match; nullable references such as `address` stay nullable. Required
|
|
150
|
-
array includes require all referenced matches and remain arrays. Reverse includes
|
|
151
|
-
remain arrays. Relation names come straight from `jazz.app.json`, through the
|
|
152
|
-
bindings `jazz-tools generate` writes; `generate --check` in CI catches stale ones.
|