Compare commits
14 Commits
fix/loggin
...
skipverify
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fca6a0bfc2 | ||
|
|
36d3be25a1 | ||
|
|
99e731d6f8 | ||
|
|
0027bc73b5 | ||
|
|
2304412c20 | ||
|
|
b697b91f1d | ||
|
|
6694dbc53f | ||
|
|
af9eb02d46 | ||
|
|
4e8c70f8d9 | ||
|
|
fa41f8eec2 | ||
|
|
60e35eab71 | ||
|
|
80f563e4f0 | ||
|
|
c321d99ec6 | ||
|
|
135fa2d164 |
5
.changeset/fast-chicken-build.md
Normal file
5
.changeset/fast-chicken-build.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"cojson": patch
|
||||
---
|
||||
|
||||
skip verify step when creating a new local transaction
|
||||
5
.changeset/mean-ghosts-hunt.md
Normal file
5
.changeset/mean-ghosts-hunt.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"jazz-run": patch
|
||||
---
|
||||
|
||||
Fix the --json option on the account create command
|
||||
5
.changeset/odd-numbers-mix.md
Normal file
5
.changeset/odd-numbers-mix.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"jazz-tools": patch
|
||||
---
|
||||
|
||||
Add a bundle step to not expose the circular deps to the lib consumers
|
||||
5
.changeset/ten-toes-cross.md
Normal file
5
.changeset/ten-toes-cross.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"jazz-tools": patch
|
||||
---
|
||||
|
||||
Reduce the amount of circular deps
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
"cojson": patch
|
||||
---
|
||||
|
||||
Add an internal API to disable the permission errors logs
|
||||
@@ -1,5 +1,13 @@
|
||||
# jazz-example-book-shelf
|
||||
|
||||
## 0.1.34
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
- jazz-browser-media-images@0.8.44
|
||||
|
||||
## 0.1.33
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-example-book-shelf",
|
||||
"version": "0.1.33",
|
||||
"version": "0.1.34",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
@@ -11,9 +11,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"clsx": "^2.0.0",
|
||||
"jazz-browser-media-images": "workspace:0.8.41",
|
||||
"jazz-react": "workspace:0.8.41",
|
||||
"jazz-tools": "workspace:0.8.41",
|
||||
"jazz-browser-media-images": "workspace:0.8.44",
|
||||
"jazz-react": "workspace:0.8.44",
|
||||
"jazz-tools": "workspace:0.8.44",
|
||||
"next": "14.2.5",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# chat-rn-clerk
|
||||
|
||||
## 1.0.34
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react-native@0.8.44
|
||||
- jazz-react-native-auth-clerk@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
- jazz-react-native-media-images@0.8.44
|
||||
|
||||
## 1.0.33
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "chat-rn-clerk",
|
||||
"main": "index.js",
|
||||
"version": "1.0.33",
|
||||
"version": "1.0.34",
|
||||
"scripts": {
|
||||
"build": "expo export -p ios",
|
||||
"start": "expo start",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# chat-rn
|
||||
|
||||
## 1.0.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react-native@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
|
||||
## 1.0.30
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "chat-rn",
|
||||
"version": "1.0.30",
|
||||
"version": "1.0.31",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "expo export -p ios",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# chat-vue
|
||||
|
||||
## 0.0.25
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
- jazz-vue@0.8.44
|
||||
|
||||
## 0.0.24
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "chat-vue",
|
||||
"version": "0.0.24",
|
||||
"version": "0.0.25",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# jazz-example-chat
|
||||
|
||||
## 0.0.120
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5d20c81]
|
||||
- cojson@0.8.44
|
||||
- jazz-react@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
- jazz-browser-media-images@0.8.44
|
||||
|
||||
## 0.0.119
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-chat",
|
||||
"private": true,
|
||||
"version": "0.0.119",
|
||||
"version": "0.0.120",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -18,11 +18,11 @@
|
||||
"@radix-ui/react-toast": "^1.1.4",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"cojson": "workspace:0.8.41",
|
||||
"cojson": "workspace:0.8.44",
|
||||
"hash-slash": "workspace:0.2.1",
|
||||
"jazz-browser-media-images": "workspace:0.8.41",
|
||||
"jazz-react": "workspace:0.8.41",
|
||||
"jazz-tools": "workspace:0.8.41",
|
||||
"jazz-browser-media-images": "workspace:0.8.44",
|
||||
"jazz-react": "workspace:0.8.44",
|
||||
"jazz-tools": "workspace:0.8.44",
|
||||
"lucide-react": "^0.274.0",
|
||||
"qrcode": "^1.5.3",
|
||||
"react": "^18.3.1",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# minimal-auth-clerk
|
||||
|
||||
## 0.0.19
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.44
|
||||
- jazz-react-auth-clerk@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
|
||||
## 0.0.18
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "clerk",
|
||||
"private": true,
|
||||
"version": "0.0.18",
|
||||
"version": "0.0.19",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -13,7 +13,7 @@
|
||||
"dependencies": {
|
||||
"@clerk/clerk-react": "^5.4.1",
|
||||
"jazz-react": "workspace:*",
|
||||
"jazz-react-auth-clerk": "workspace:0.8.41",
|
||||
"jazz-react-auth-clerk": "workspace:0.8.44",
|
||||
"jazz-tools": "workspace:*",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# file-share-svelte
|
||||
|
||||
## 0.0.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-tools@0.8.44
|
||||
- jazz-svelte@0.8.44
|
||||
|
||||
## 0.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "file-share-svelte",
|
||||
"version": "0.0.4",
|
||||
"version": "0.0.5",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# form
|
||||
|
||||
## 0.0.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
- jazz-browser-media-images@0.8.44
|
||||
|
||||
## 0.0.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "form",
|
||||
"private": true,
|
||||
"version": "0.0.14",
|
||||
"version": "0.0.15",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# image-upload
|
||||
|
||||
## 0.0.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
- jazz-browser-media-images@0.8.44
|
||||
|
||||
## 0.0.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "image-upload",
|
||||
"private": true,
|
||||
"version": "0.0.16",
|
||||
"version": "0.0.17",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# jazz-example-inspector
|
||||
|
||||
## 0.0.88
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5d20c81]
|
||||
- cojson@0.8.44
|
||||
- cojson-transport-ws@0.8.44
|
||||
|
||||
## 0.0.87
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-inspector",
|
||||
"private": true,
|
||||
"version": "0.0.87",
|
||||
"version": "0.0.88",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -16,8 +16,8 @@
|
||||
"@radix-ui/react-toast": "^1.1.4",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"cojson": "workspace:0.8.41",
|
||||
"cojson-transport-ws": "workspace:0.8.41",
|
||||
"cojson": "workspace:0.8.44",
|
||||
"cojson-transport-ws": "workspace:0.8.44",
|
||||
"hash-slash": "workspace:0.2.1",
|
||||
"lucide-react": "^0.274.0",
|
||||
"qrcode": "^1.5.3",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# jazz-example-musicplayer
|
||||
|
||||
## 0.0.40
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
|
||||
## 0.0.39
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-music-player",
|
||||
"private": true,
|
||||
"version": "0.0.39",
|
||||
"version": "0.0.40",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -18,8 +18,8 @@
|
||||
"@radix-ui/react-toast": "^1.1.4",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"jazz-react": "workspace:0.8.41",
|
||||
"jazz-tools": "workspace:0.8.41",
|
||||
"jazz-react": "workspace:0.8.44",
|
||||
"jazz-tools": "workspace:0.8.44",
|
||||
"lucide-react": "^0.274.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# jazz-example-onboarding
|
||||
|
||||
## 0.0.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
- jazz-browser-media-images@0.8.44
|
||||
|
||||
## 0.0.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-onboarding",
|
||||
"private": true,
|
||||
"version": "0.0.20",
|
||||
"version": "0.0.21",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# passkey-svelte
|
||||
|
||||
## 0.0.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-svelte@0.8.44
|
||||
|
||||
## 0.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "passkey-svelte",
|
||||
"version": "0.0.8",
|
||||
"version": "0.0.9",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# minimal-auth-passkey
|
||||
|
||||
## 0.0.18
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
|
||||
## 0.0.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "passkey",
|
||||
"private": true,
|
||||
"version": "0.0.17",
|
||||
"version": "0.0.18",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# jazz-password-manager
|
||||
|
||||
## 0.0.39
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
|
||||
## 0.0.38
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-password-manager",
|
||||
"private": true,
|
||||
"version": "0.0.38",
|
||||
"version": "0.0.39",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -12,8 +12,8 @@
|
||||
"clean-install": "rm -rf node_modules pnpm-lock.yaml && pnpm install"
|
||||
},
|
||||
"dependencies": {
|
||||
"jazz-react": "workspace:0.8.41",
|
||||
"jazz-tools": "workspace:0.8.41",
|
||||
"jazz-react": "workspace:0.8.44",
|
||||
"jazz-tools": "workspace:0.8.44",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-hook-form": "^7.41.5",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# jazz-example-pets
|
||||
|
||||
## 0.0.137
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
- jazz-browser-media-images@0.8.44
|
||||
|
||||
## 0.0.136
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-pets",
|
||||
"private": true,
|
||||
"version": "0.0.136",
|
||||
"version": "0.0.137",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -19,9 +19,9 @@
|
||||
"@radix-ui/react-toast": "^1.1.4",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"jazz-browser-media-images": "workspace:0.8.41",
|
||||
"jazz-react": "workspace:0.8.41",
|
||||
"jazz-tools": "workspace:0.8.41",
|
||||
"jazz-browser-media-images": "workspace:0.8.44",
|
||||
"jazz-react": "workspace:0.8.44",
|
||||
"jazz-tools": "workspace:0.8.44",
|
||||
"lucide-react": "^0.274.0",
|
||||
"qrcode": "^1.5.3",
|
||||
"react": "^18.3.1",
|
||||
@@ -41,7 +41,7 @@
|
||||
"@vitejs/plugin-react-swc": "^3.3.2",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"is-ci": "^3.0.1",
|
||||
"jazz-run": "workspace:0.8.41",
|
||||
"jazz-run": "workspace:0.8.44",
|
||||
"postcss": "^8.4.27",
|
||||
"tailwindcss": "^3.4.9",
|
||||
"typescript": "~5.6.2",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# reactions
|
||||
|
||||
## 0.0.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
- jazz-browser-media-images@0.8.44
|
||||
|
||||
## 0.0.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "reactions",
|
||||
"private": true,
|
||||
"version": "0.0.16",
|
||||
"version": "0.0.17",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# todo-vue
|
||||
|
||||
## 0.0.23
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
- jazz-vue@0.8.44
|
||||
|
||||
## 0.0.22
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "todo-vue",
|
||||
"version": "0.0.22",
|
||||
"version": "0.0.23",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# jazz-example-todo
|
||||
|
||||
## 0.0.136
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
|
||||
## 0.0.135
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-todo",
|
||||
"private": true,
|
||||
"version": "0.0.135",
|
||||
"version": "0.0.136",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -16,8 +16,8 @@
|
||||
"@radix-ui/react-toast": "^1.1.4",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"jazz-react": "workspace:0.8.41",
|
||||
"jazz-tools": "workspace:0.8.41",
|
||||
"jazz-react": "workspace:0.8.44",
|
||||
"jazz-tools": "workspace:0.8.44",
|
||||
"lucide-react": "^0.274.0",
|
||||
"qrcode": "^1.5.3",
|
||||
"react": "^18.3.1",
|
||||
|
||||
@@ -91,7 +91,7 @@ add their `Account` manually.
|
||||
|
||||
### Adding users through invite links
|
||||
|
||||
Here's how you can generate an [invite link](/docs/groups/sharing#invite-links).
|
||||
Here's how you can generate an [invite link](/docs/groups/sharing#invites).
|
||||
|
||||
When the user accepts the invite, add the `Organization` to the user's `organizations` list.
|
||||
|
||||
|
||||
@@ -1,8 +1,32 @@
|
||||
import { CodeGroup } from "@/components/forMdx";
|
||||
|
||||
# Groups as permission scopes
|
||||
|
||||
Every CoValue has an owner, which can be a `Group` or an `Account`.
|
||||
|
||||
You can use a `Group` to grant access to a CoValue to multiple users. These users can
|
||||
have different roles, such as "writer", "reader" or "admin".
|
||||
|
||||
...more docs coming soon
|
||||
|
||||
## Adding Group Members by ID
|
||||
## Creating a Group
|
||||
|
||||
Here's how you can create a `Group`.
|
||||
|
||||
<CodeGroup>
|
||||
```tsx
|
||||
import { Group } from "jazz-tools";
|
||||
|
||||
const group = Group.create({ owner: me });
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
The `Group` itself is a CoValue, and whoever owns it is the initial admin.
|
||||
|
||||
You typically add members using [public sharing](/docs/groups/sharing#public-sharing) or [invites](/docs/groups/sharing#invites).
|
||||
But if you already know their ID, you can add them directly (see below).
|
||||
|
||||
## Adding group members by ID
|
||||
|
||||
You can add group members by ID by using `Account.load` and `Group.addMember`.
|
||||
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
import { ContentByFramework, CodeGroup } from '@/components/forMdx'
|
||||
|
||||
# Public sharing and invites
|
||||
|
||||
...more docs coming soon
|
||||
|
||||
## Public sharing
|
||||
|
||||
You can share CoValues publicly by setting the `owner` to a `Group`, and granting
|
||||
access to "everyone".
|
||||
|
||||
<CodeGroup>
|
||||
```ts
|
||||
const group = Group.create({ owner: me });
|
||||
group.addMember("everyone", "writer"); // *highlight*
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
This is done in the [chat example](https://github.com/garden-co/jazz/tree/main/examples/chat) where anyone can join the chat, and send messages.
|
||||
|
||||
You can also [add members by Account ID](/docs/groups/intro#adding-group-members-by-id).
|
||||
|
||||
## Invites
|
||||
|
||||
You can grant users access to a CoValue by sending them an invite link.
|
||||
|
||||
This is used in the [pet example](https://github.com/garden-co/jazz/tree/main/examples/pets)
|
||||
and the [todo example](https://github.com/garden-co/jazz/tree/main/examples/todo).
|
||||
|
||||
<ContentByFramework framework="react">
|
||||
<CodeGroup>
|
||||
```ts
|
||||
import { createInviteLink } from "jazz-react";
|
||||
|
||||
createInviteLink(organization, "writer"); // or reader, or admin
|
||||
```
|
||||
</CodeGroup>
|
||||
</ContentByFramework>
|
||||
|
||||
<ContentByFramework framework="react-native">
|
||||
<CodeGroup>
|
||||
```ts
|
||||
import { createInviteLink } from "jazz-react-native";
|
||||
|
||||
createInviteLink(organization, "writer"); // or reader, or admin
|
||||
```
|
||||
</CodeGroup>
|
||||
</ContentByFramework>
|
||||
|
||||
<ContentByFramework framework="vue">
|
||||
<CodeGroup>
|
||||
```ts
|
||||
import { createInviteLink } from "jazz-vue";
|
||||
|
||||
createInviteLink(organization, "writer"); // or reader, or admin
|
||||
```
|
||||
</CodeGroup>
|
||||
</ContentByFramework>
|
||||
|
||||
<ContentByFramework framework="svelte">
|
||||
<CodeGroup>
|
||||
```ts
|
||||
import { createInviteLink } from "jazz-browser";
|
||||
|
||||
createInviteLink(organization, "writer"); // or reader, or admin
|
||||
```
|
||||
</CodeGroup>
|
||||
</ContentByFramework>
|
||||
|
||||
It generates a URL that looks like `.../invite/[CoValue ID]/[inviteSecret]`
|
||||
|
||||
In your app, you need to handle this route, and let the user accept the invitation,
|
||||
as done [here](https://github.com/garden-co/jazz/tree/main/examples/pets/src/2_main.tsx).
|
||||
|
||||
<CodeGroup>
|
||||
```ts
|
||||
useAcceptInvite({
|
||||
invitedObjectSchema: PetPost,
|
||||
onAccept: (petPostID) => navigate("/pet/" + petPostID),
|
||||
});
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
`useAcceptInvite` is exported from your Jazz app.
|
||||
|
||||
<ContentByFramework framework="react">
|
||||
<CodeGroup>
|
||||
```ts
|
||||
const Jazz = createJazzReactApp();
|
||||
export const { useAcceptInvite } = Jazz;
|
||||
```
|
||||
</CodeGroup>
|
||||
</ContentByFramework>
|
||||
|
||||
<ContentByFramework framework="react-native">
|
||||
<CodeGroup>
|
||||
```ts
|
||||
const Jazz = createJazzReactNativeApp();
|
||||
export const { useAcceptInvite } = Jazz;
|
||||
```
|
||||
</CodeGroup>
|
||||
</ContentByFramework>
|
||||
|
||||
<ContentByFramework framework="vue">
|
||||
<CodeGroup>
|
||||
```ts
|
||||
const Jazz = createJazzVueApp();
|
||||
export const { useAcceptInvite } = Jazz;
|
||||
```
|
||||
</CodeGroup>
|
||||
</ContentByFramework>
|
||||
|
||||
<ContentByFramework framework="svelte">
|
||||
<CodeGroup>
|
||||
```ts
|
||||
const Jazz = createJazzApp();
|
||||
export const { useAcceptInvite } = Jazz;
|
||||
```
|
||||
</CodeGroup>
|
||||
</ContentByFramework>
|
||||
|
||||
...more docs coming soon
|
||||
@@ -101,9 +101,9 @@ export const docNavigationItems = [
|
||||
done: 10,
|
||||
},
|
||||
{
|
||||
name: "Public sharing & Invites",
|
||||
name: "Public sharing & invites",
|
||||
href: "/docs/groups/sharing",
|
||||
done: 0,
|
||||
done: 10,
|
||||
},
|
||||
{
|
||||
name: "Group inheritance",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# cojson-storage-indexeddb
|
||||
|
||||
## 0.8.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5d20c81]
|
||||
- cojson@0.8.44
|
||||
- cojson-storage@0.8.44
|
||||
|
||||
## 0.8.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cojson-storage-indexeddb",
|
||||
"version": "0.8.41",
|
||||
"version": "0.8.44",
|
||||
"main": "dist/index.js",
|
||||
"type": "module",
|
||||
"types": "src/index.ts",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# cojson-storage-sqlite
|
||||
|
||||
## 0.8.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5d20c81]
|
||||
- cojson@0.8.44
|
||||
- cojson-storage@0.8.44
|
||||
|
||||
## 0.8.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "cojson-storage-sqlite",
|
||||
"type": "module",
|
||||
"version": "0.8.41",
|
||||
"version": "0.8.44",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"better-sqlite3": "^11.7.0",
|
||||
"cojson": "workspace:0.8.41",
|
||||
"cojson": "workspace:0.8.44",
|
||||
"cojson-storage": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# cojson-storage
|
||||
|
||||
## 0.8.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5d20c81]
|
||||
- cojson@0.8.44
|
||||
|
||||
## 0.8.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cojson-storage",
|
||||
"version": "0.8.41",
|
||||
"version": "0.8.44",
|
||||
"main": "dist/index.js",
|
||||
"type": "module",
|
||||
"types": "src/index.ts",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# cojson-transport-nodejs-ws
|
||||
|
||||
## 0.8.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5d20c81]
|
||||
- cojson@0.8.44
|
||||
|
||||
## 0.8.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "cojson-transport-ws",
|
||||
"type": "module",
|
||||
"version": "0.8.41",
|
||||
"version": "0.8.44",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cojson": "workspace:0.8.41",
|
||||
"cojson": "workspace:0.8.44",
|
||||
"typescript": "~5.6.2"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# cojson
|
||||
|
||||
## 0.8.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 5d20c81: Add an internal API to disable the permission errors logs
|
||||
|
||||
## 0.8.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
},
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"version": "0.8.41",
|
||||
"version": "0.8.44",
|
||||
"devDependencies": {
|
||||
"@opentelemetry/sdk-metrics": "^1.29.0",
|
||||
"@types/jest": "^29.5.3",
|
||||
|
||||
@@ -202,6 +202,7 @@ export class CoValueCore {
|
||||
newTransactions: Transaction[],
|
||||
givenExpectedNewHash: Hash | undefined,
|
||||
newSignature: Signature,
|
||||
skipVerify: boolean = false,
|
||||
): Result<true, TryAddTransactionsError> {
|
||||
return this.node
|
||||
.resolveAccountAgent(
|
||||
@@ -231,8 +232,10 @@ export class CoValueCore {
|
||||
} satisfies InvalidHashError);
|
||||
}
|
||||
|
||||
// const beforeVerify = performance.now();
|
||||
if (!this.crypto.verify(newSignature, expectedNewHash, signerID)) {
|
||||
if (
|
||||
skipVerify !== true &&
|
||||
!this.crypto.verify(newSignature, expectedNewHash, signerID)
|
||||
) {
|
||||
return err({
|
||||
type: "InvalidSignature",
|
||||
id: this.id,
|
||||
@@ -600,6 +603,7 @@ export class CoValueCore {
|
||||
[transaction],
|
||||
expectedNewHash,
|
||||
signature,
|
||||
true,
|
||||
)._unsafeUnwrap({ withStackTrace: true });
|
||||
|
||||
if (success) {
|
||||
|
||||
@@ -115,6 +115,19 @@ async function scaffoldProject({
|
||||
try {
|
||||
execSync(`cd ${projectName} && npx expo prebuild`, { stdio: "pipe" });
|
||||
execSync(`cd ${projectName} && npx pod-install`, { stdio: "pipe" });
|
||||
|
||||
// Update metro.config.js
|
||||
const metroConfigPath = `${projectName}/metro.config.js`;
|
||||
const metroConfig = `
|
||||
const { getDefaultConfig } = require("expo/metro-config");
|
||||
const { withNativeWind } = require("nativewind/metro");
|
||||
|
||||
const config = getDefaultConfig(__dirname);
|
||||
|
||||
module.exports = withNativeWind(config, { input: "./src/global.css" });
|
||||
`;
|
||||
fs.writeFileSync(metroConfigPath, metroConfig);
|
||||
|
||||
rnSpinner.succeed(chalk.green("React Native setup completed"));
|
||||
} catch (error) {
|
||||
rnSpinner.fail(chalk.red("Failed to setup React Native"));
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-browser-media-images
|
||||
|
||||
## 0.8.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5d20c81]
|
||||
- cojson@0.8.44
|
||||
- jazz-browser@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
|
||||
## 0.8.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "jazz-browser-auth-clerk",
|
||||
"version": "0.8.41",
|
||||
"version": "0.8.44",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cojson": "workspace:0.8.41",
|
||||
"jazz-browser": "workspace:0.8.41",
|
||||
"jazz-tools": "workspace:0.8.41"
|
||||
"cojson": "workspace:0.8.44",
|
||||
"jazz-browser": "workspace:0.8.44",
|
||||
"jazz-tools": "workspace:0.8.44"
|
||||
},
|
||||
"scripts": {
|
||||
"format-and-lint": "biome check .",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# jazz-browser-media-images
|
||||
|
||||
## 0.8.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
|
||||
## 0.8.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-browser-media-images",
|
||||
"version": "0.8.41",
|
||||
"version": "0.8.44",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
@@ -8,8 +8,8 @@
|
||||
"dependencies": {
|
||||
"@types/image-blob-reduce": "^4.1.1",
|
||||
"image-blob-reduce": "^4.1.0",
|
||||
"jazz-browser": "workspace:0.8.41",
|
||||
"jazz-tools": "workspace:0.8.41",
|
||||
"jazz-browser": "workspace:0.8.44",
|
||||
"jazz-tools": "workspace:0.8.44",
|
||||
"pica": "^9.0.1",
|
||||
"typescript": "~5.6.2"
|
||||
},
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# jazz-browser
|
||||
|
||||
## 0.8.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5d20c81]
|
||||
- cojson@0.8.44
|
||||
- cojson-storage-indexeddb@0.8.44
|
||||
- cojson-transport-ws@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
|
||||
## 0.8.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
{
|
||||
"name": "jazz-browser",
|
||||
"version": "0.8.41",
|
||||
"version": "0.8.44",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@scure/bip39": "^1.3.0",
|
||||
"cojson": "workspace:0.8.41",
|
||||
"cojson-storage-indexeddb": "workspace:0.8.41",
|
||||
"cojson-transport-ws": "workspace:0.8.41",
|
||||
"jazz-tools": "workspace:0.8.41",
|
||||
"cojson": "workspace:0.8.44",
|
||||
"cojson-storage-indexeddb": "workspace:0.8.44",
|
||||
"cojson-transport-ws": "workspace:0.8.44",
|
||||
"jazz-tools": "workspace:0.8.44",
|
||||
"typescript": "~5.6.2"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-autosub
|
||||
|
||||
## 0.8.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5d20c81]
|
||||
- cojson@0.8.44
|
||||
- cojson-transport-ws@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
|
||||
## 0.8.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
"types": "src/index.ts",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"version": "0.8.41",
|
||||
"version": "0.8.44",
|
||||
"dependencies": {
|
||||
"cojson": "workspace:0.8.41",
|
||||
"cojson-transport-ws": "workspace:0.8.41",
|
||||
"jazz-tools": "workspace:0.8.41",
|
||||
"cojson": "workspace:0.8.44",
|
||||
"cojson-transport-ws": "workspace:0.8.44",
|
||||
"jazz-tools": "workspace:0.8.44",
|
||||
"ws": "^8.14.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import { Peer } from "cojson";
|
||||
import { createWebSocketPeer } from "cojson-transport-ws";
|
||||
import { createWorkerAccount } from "jazz-run/createWorkerAccount";
|
||||
import { startSyncServer } from "jazz-run/startSyncServer";
|
||||
import { CoMap, Group, co } from "jazz-tools";
|
||||
import { describe, expect, onTestFinished, test, vi } from "vitest";
|
||||
import { WebSocket } from "ws";
|
||||
import { CoMap, Group, InboxSender, co } from "jazz-tools";
|
||||
import { describe, expect, onTestFinished, test } from "vitest";
|
||||
import { startWorker } from "../index";
|
||||
import { waitFor } from "./utils";
|
||||
|
||||
async function setup() {
|
||||
const { server, port } = await setupSyncServer();
|
||||
@@ -34,13 +32,13 @@ async function setupSyncServer(defaultPort = "0") {
|
||||
}
|
||||
|
||||
async function setupWorker(syncServer: string) {
|
||||
const { accountId, agentSecret } = await createWorkerAccount({
|
||||
const { accountID, agentSecret } = await createWorkerAccount({
|
||||
name: "test-worker",
|
||||
peer: syncServer,
|
||||
});
|
||||
|
||||
return startWorker({
|
||||
accountID: accountId,
|
||||
accountID: accountID,
|
||||
accountSecret: agentSecret,
|
||||
syncServer,
|
||||
});
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# jazz-browser-media-images
|
||||
|
||||
## 0.8.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5d20c81]
|
||||
- cojson@0.8.44
|
||||
- jazz-browser-auth-clerk@0.8.44
|
||||
- jazz-react@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
|
||||
## 0.8.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "jazz-react-auth-clerk",
|
||||
"version": "0.8.41",
|
||||
"version": "0.8.44",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.tsx",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cojson": "workspace:0.8.41",
|
||||
"jazz-browser-auth-clerk": "workspace:0.8.41",
|
||||
"jazz-react": "workspace:0.8.41",
|
||||
"jazz-tools": "workspace:0.8.41"
|
||||
"cojson": "workspace:0.8.44",
|
||||
"jazz-browser-auth-clerk": "workspace:0.8.44",
|
||||
"jazz-react": "workspace:0.8.44",
|
||||
"jazz-tools": "workspace:0.8.44"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^18.2.0"
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-react-native-auth-clerk
|
||||
|
||||
## 0.8.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5d20c81]
|
||||
- cojson@0.8.44
|
||||
- jazz-react-native@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
|
||||
## 0.8.43
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-react-native-auth-clerk",
|
||||
"version": "0.8.43",
|
||||
"version": "0.8.44",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# jazz-browser-media-images
|
||||
|
||||
## 0.8.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-tools@0.8.44
|
||||
|
||||
## 0.8.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-react-native-media-images",
|
||||
"version": "0.8.41",
|
||||
"version": "0.8.44",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-browser
|
||||
|
||||
## 0.8.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5d20c81]
|
||||
- cojson@0.8.44
|
||||
- cojson-transport-ws@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
|
||||
## 0.8.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-react-native",
|
||||
"version": "0.8.41",
|
||||
"version": "0.8.44",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-react
|
||||
|
||||
## 0.8.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5d20c81]
|
||||
- cojson@0.8.44
|
||||
- jazz-browser@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
|
||||
## 0.8.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "jazz-react",
|
||||
"version": "0.8.41",
|
||||
"version": "0.8.44",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@scure/bip39": "^1.3.0",
|
||||
"cojson": "workspace:0.8.41",
|
||||
"jazz-browser": "workspace:0.8.41",
|
||||
"jazz-tools": "workspace:0.8.41"
|
||||
"cojson": "workspace:0.8.44",
|
||||
"jazz-browser": "workspace:0.8.44",
|
||||
"jazz-tools": "workspace:0.8.44"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.3.12",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# jazz-run
|
||||
|
||||
## 0.8.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5d20c81]
|
||||
- cojson@0.8.44
|
||||
- cojson-storage-sqlite@0.8.44
|
||||
- cojson-transport-ws@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
|
||||
## 0.8.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"bin": "./dist/index.js",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"version": "0.8.41",
|
||||
"version": "0.8.44",
|
||||
"exports": {
|
||||
"./startSyncServer": {
|
||||
"import": "./dist/startSyncServer.js",
|
||||
@@ -28,11 +28,11 @@
|
||||
"@effect/printer-ansi": "^0.34.5",
|
||||
"@effect/schema": "^0.71.1",
|
||||
"@effect/typeclass": "^0.25.5",
|
||||
"cojson": "workspace:0.8.41",
|
||||
"cojson-storage-sqlite": "workspace:0.8.41",
|
||||
"cojson-transport-ws": "workspace:0.8.41",
|
||||
"cojson": "workspace:0.8.44",
|
||||
"cojson-storage-sqlite": "workspace:0.8.44",
|
||||
"cojson-transport-ws": "workspace:0.8.44",
|
||||
"effect": "^3.6.5",
|
||||
"jazz-tools": "workspace:0.8.41",
|
||||
"jazz-tools": "workspace:0.8.44",
|
||||
"ws": "^8.14.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -27,19 +27,10 @@ export const createWorkerAccount = async ({
|
||||
throw new Error("account is not a controlled account");
|
||||
}
|
||||
|
||||
const accountCoValue = account._raw.core;
|
||||
const accountProfileCoValue = account.profile!._raw.core;
|
||||
const syncManager = account._raw.core.node.syncManager;
|
||||
|
||||
await Promise.all([
|
||||
syncManager.syncCoValue(accountCoValue),
|
||||
syncManager.syncCoValue(accountProfileCoValue),
|
||||
]);
|
||||
|
||||
await account.waitForAllCoValuesSync({ timeout: 4_000 });
|
||||
|
||||
return {
|
||||
accountId: account.id,
|
||||
accountID: account.id,
|
||||
agentSecret: account._raw.agentSecret,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -19,15 +19,15 @@ const createAccountCommand = Command.make(
|
||||
{ name: nameOption, peer: peerOption, json: jsonOption },
|
||||
({ name, peer, json }) => {
|
||||
return Effect.gen(function* () {
|
||||
const { accountId, agentSecret } = yield* Effect.promise(() =>
|
||||
const { accountID, agentSecret } = yield* Effect.promise(() =>
|
||||
createWorkerAccount({ name, peer }),
|
||||
);
|
||||
|
||||
if (json) {
|
||||
Console.log(JSON.stringify({ accountId, agentSecret }));
|
||||
yield* Console.log(JSON.stringify({ accountID, agentSecret }));
|
||||
} else {
|
||||
yield* Console.log(`# Credentials for Jazz account "${name}":
|
||||
JAZZ_WORKER_ACCOUNT=${accountId}
|
||||
JAZZ_WORKER_ACCOUNT=${accountID}
|
||||
JAZZ_WORKER_SECRET=${agentSecret}
|
||||
`);
|
||||
}
|
||||
|
||||
@@ -25,12 +25,12 @@ describe("createWorkerAccount - integration tests", () => {
|
||||
throw new Error("Server address is not an object");
|
||||
}
|
||||
|
||||
const { accountId, agentSecret } = await createWorkerAccount({
|
||||
const { accountID, agentSecret } = await createWorkerAccount({
|
||||
name: "test",
|
||||
peer: `ws://localhost:${address.port}`,
|
||||
});
|
||||
|
||||
expect(accountId).toBeDefined();
|
||||
expect(accountID).toBeDefined();
|
||||
expect(agentSecret).toBeDefined();
|
||||
|
||||
const peer = createWebSocketPeer({
|
||||
@@ -46,16 +46,16 @@ describe("createWorkerAccount - integration tests", () => {
|
||||
crypto,
|
||||
});
|
||||
|
||||
expect(await node.load(accountId as any)).not.toBe("unavailable");
|
||||
expect(await node.load(accountID as any)).not.toBe("unavailable");
|
||||
});
|
||||
|
||||
it("should create a worker account using the Jazz cloud", async () => {
|
||||
const { accountId, agentSecret } = await createWorkerAccount({
|
||||
const { accountID, agentSecret } = await createWorkerAccount({
|
||||
name: "test",
|
||||
peer: `wss://cloud.jazz.tools`,
|
||||
});
|
||||
|
||||
expect(accountId).toBeDefined();
|
||||
expect(accountID).toBeDefined();
|
||||
expect(agentSecret).toBeDefined();
|
||||
|
||||
const peer = createWebSocketPeer({
|
||||
@@ -71,6 +71,6 @@ describe("createWorkerAccount - integration tests", () => {
|
||||
crypto,
|
||||
});
|
||||
|
||||
expect(await node.load(accountId as any)).not.toBe("unavailable");
|
||||
expect(await node.load(accountID as any)).not.toBe("unavailable");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# jazz-svelte
|
||||
|
||||
## 0.8.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.8.44
|
||||
- jazz-tools@0.8.44
|
||||
|
||||
## 0.8.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-svelte",
|
||||
"version": "0.8.41",
|
||||
"version": "0.8.44",
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build && npm run package",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# jazz-tools
|
||||
|
||||
## 0.8.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [5d20c81]
|
||||
- cojson@0.8.44
|
||||
|
||||
## 0.8.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -6,37 +6,34 @@
|
||||
"react-native": "dist/native/index.native.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"react-native": "./dist/native/index.native.js",
|
||||
"react-native": "./dist/index.native.js",
|
||||
"types": "./src/index.web.ts",
|
||||
"default": "./dist/web/index.web.js"
|
||||
"default": "./dist/index.web.js"
|
||||
},
|
||||
"./native": {
|
||||
"react-native": "./dist/native/index.native.js",
|
||||
"react-native": "./dist/index.native.js",
|
||||
"types": "./src/index.native.ts",
|
||||
"default": "./dist/native/index.native.js"
|
||||
"default": "./dist/index.native.js"
|
||||
},
|
||||
"./src/*": "./src/*"
|
||||
},
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"version": "0.8.41",
|
||||
"version": "0.8.44",
|
||||
"dependencies": {
|
||||
"cojson": "workspace:*",
|
||||
"fast-check": "^3.17.2"
|
||||
"cojson": "workspace:*"
|
||||
},
|
||||
"scripts": {
|
||||
"format-and-lint": "biome check .",
|
||||
"format-and-lint:fix": "biome check . --write",
|
||||
"dev:web": "tsc --sourceMap --watch --outDir dist/web -p tsconfig.web.json",
|
||||
"dev:native": "tsc --sourceMap --watch --outDir dist/native -p tsconfig.native.json",
|
||||
"dev": "tsup --watch",
|
||||
"test": "vitest --run --root ../../ --project jazz-tools",
|
||||
"test:watch": "vitest --watch --root ../../ --project jazz-tools",
|
||||
"build:web": "tsc --sourceMap --outDir dist/web -p tsconfig.web.json",
|
||||
"build:native": "tsc --sourceMap --outDir dist/native -p tsconfig.native.json",
|
||||
"build": "rm -rf ./dist && pnpm run build:web && pnpm run build:native",
|
||||
"build": "tsup",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tsup": "^8.3.5",
|
||||
"typescript": "~5.6.2",
|
||||
"vitest": "1.5.3"
|
||||
},
|
||||
|
||||
@@ -14,16 +14,13 @@ import {
|
||||
} from "cojson";
|
||||
import {
|
||||
AnonymousJazzAgent,
|
||||
CoMap,
|
||||
type CoValue,
|
||||
CoValueBase,
|
||||
CoValueClass,
|
||||
DeeplyLoaded,
|
||||
DepthsIn,
|
||||
Group,
|
||||
ID,
|
||||
MembersSym,
|
||||
Profile,
|
||||
Ref,
|
||||
type RefEncoded,
|
||||
RefIfCoValue,
|
||||
@@ -37,6 +34,10 @@ import {
|
||||
subscriptionsScopes,
|
||||
} from "../internal.js";
|
||||
import { coValuesCache } from "../lib/cache.js";
|
||||
import { type CoMap } from "./coMap.js";
|
||||
import { type Group } from "./group.js";
|
||||
import { Profile } from "./profile.js";
|
||||
import { RegisteredSchemas } from "./registeredSchemas.js";
|
||||
|
||||
/** @category Identity & Permissions */
|
||||
export class Account extends CoValueBase implements CoValue {
|
||||
@@ -59,7 +60,7 @@ export class Account extends CoValueBase implements CoValue {
|
||||
optional: false,
|
||||
} satisfies RefEncoded<Profile>,
|
||||
root: {
|
||||
ref: () => CoMap,
|
||||
ref: () => RegisteredSchemas["CoMap"],
|
||||
optional: true,
|
||||
} satisfies RefEncoded<CoMap>,
|
||||
};
|
||||
@@ -239,7 +240,7 @@ export class Account extends CoValueBase implements CoValue {
|
||||
creationProps?: { name: string },
|
||||
): void | Promise<void> {
|
||||
if (creationProps) {
|
||||
const profileGroup = Group.create({ owner: this });
|
||||
const profileGroup = RegisteredSchemas["Group"].create({ owner: this });
|
||||
profileGroup.addMember("everyone", "reader");
|
||||
this.profile = Profile.create(
|
||||
{ name: creationProps.name },
|
||||
@@ -388,3 +389,5 @@ export function isControlledAccount(account: Account): account is Account & {
|
||||
export type AccountClass<Acc extends Account> = CoValueClass<Acc> & {
|
||||
fromNode: (typeof Account)["fromNode"];
|
||||
};
|
||||
|
||||
RegisteredSchemas["Account"] = Account;
|
||||
|
||||
@@ -16,7 +16,6 @@ import type {
|
||||
CoValueClass,
|
||||
DeeplyLoaded,
|
||||
DepthsIn,
|
||||
Group,
|
||||
ID,
|
||||
IfCo,
|
||||
Schema,
|
||||
@@ -24,7 +23,6 @@ import type {
|
||||
UnCo,
|
||||
} from "../internal.js";
|
||||
import {
|
||||
Account,
|
||||
CoValueBase,
|
||||
ItemsSym,
|
||||
Ref,
|
||||
@@ -37,6 +35,9 @@ import {
|
||||
subscribeToCoValue,
|
||||
subscribeToExistingCoValue,
|
||||
} from "../internal.js";
|
||||
import { type Account } from "./account.js";
|
||||
import { type Group } from "./group.js";
|
||||
import { RegisteredSchemas } from "./registeredSchemas.js";
|
||||
|
||||
/** @deprecated Use CoFeedEntry instead */
|
||||
export type CoStreamEntry<Item> = CoFeedEntry<Item>;
|
||||
@@ -436,7 +437,7 @@ function entryFromRawEntry<Item>(
|
||||
return (
|
||||
accountID &&
|
||||
new Ref<Account>(accountID as unknown as ID<Account>, loadedAs, {
|
||||
ref: Account,
|
||||
ref: RegisteredSchemas["Account"],
|
||||
optional: false,
|
||||
})?.accessFrom(
|
||||
accessFrom,
|
||||
|
||||
@@ -13,9 +13,7 @@ import type {
|
||||
UnCo,
|
||||
} from "../internal.js";
|
||||
import {
|
||||
Account,
|
||||
AnonymousJazzAgent,
|
||||
Group,
|
||||
ItemsSym,
|
||||
Ref,
|
||||
SchemaInit,
|
||||
@@ -30,6 +28,9 @@ import {
|
||||
subscriptionsScopes,
|
||||
} from "../internal.js";
|
||||
import { coValuesCache } from "../lib/cache.js";
|
||||
import { type Account } from "./account.js";
|
||||
import { type Group } from "./group.js";
|
||||
import { RegisteredSchemas } from "./registeredSchemas.js";
|
||||
|
||||
/**
|
||||
* CoLists are collaborative versions of plain arrays.
|
||||
@@ -108,8 +109,8 @@ export class CoList<Item = any> extends Array<Item> implements CoValue {
|
||||
/** @category Collaboration */
|
||||
get _owner(): Account | Group {
|
||||
return this._raw.group instanceof RawAccount
|
||||
? Account.fromRaw(this._raw.group)
|
||||
: Group.fromRaw(this._raw.group);
|
||||
? RegisteredSchemas["Account"].fromRaw(this._raw.group)
|
||||
: RegisteredSchemas["Group"].fromRaw(this._raw.group);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -162,7 +163,9 @@ export class CoList<Item = any> extends Array<Item> implements CoValue {
|
||||
const rawAccount = this._raw.core.node.account;
|
||||
|
||||
if (rawAccount instanceof RawAccount) {
|
||||
return coValuesCache.get(rawAccount, () => Account.fromRaw(rawAccount));
|
||||
return coValuesCache.get(rawAccount, () =>
|
||||
RegisteredSchemas["Account"].fromRaw(rawAccount),
|
||||
);
|
||||
}
|
||||
|
||||
return new AnonymousJazzAgent(this._raw.core.node);
|
||||
|
||||
@@ -13,7 +13,6 @@ import type {
|
||||
CoValueClass,
|
||||
DeeplyLoaded,
|
||||
DepthsIn,
|
||||
Group,
|
||||
ID,
|
||||
IfCo,
|
||||
RefEncoded,
|
||||
@@ -22,7 +21,6 @@ import type {
|
||||
co,
|
||||
} from "../internal.js";
|
||||
import {
|
||||
Account,
|
||||
CoValueBase,
|
||||
ItemsSym,
|
||||
Ref,
|
||||
@@ -36,6 +34,9 @@ import {
|
||||
subscribeToExistingCoValue,
|
||||
subscriptionsScopes,
|
||||
} from "../internal.js";
|
||||
import { type Account } from "./account.js";
|
||||
import { type Group } from "./group.js";
|
||||
import { RegisteredSchemas } from "./registeredSchemas.js";
|
||||
|
||||
type CoMapEdit<V> = {
|
||||
value?: V;
|
||||
@@ -178,7 +179,7 @@ export class CoMap extends CoValueBase implements CoValue {
|
||||
by:
|
||||
rawEdit.by &&
|
||||
new Ref<Account>(rawEdit.by as ID<Account>, target._loadedAs, {
|
||||
ref: Account,
|
||||
ref: RegisteredSchemas["Account"],
|
||||
optional: false,
|
||||
}).accessFrom(target, "_edits." + key + ".by"),
|
||||
madeAt: rawEdit.at,
|
||||
@@ -742,3 +743,5 @@ const CoMapProxyHandler: ProxyHandler<CoMap> = {
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
RegisteredSchemas["CoMap"] = CoMap;
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
import { SessionID } from "cojson";
|
||||
import {
|
||||
Account,
|
||||
CoFeed,
|
||||
CoFeedEntry,
|
||||
CoList,
|
||||
ItemsSym,
|
||||
Ref,
|
||||
RefEncoded,
|
||||
UnCo,
|
||||
} from "../internal.js";
|
||||
import { CoKeys, CoMap } from "./coMap.js";
|
||||
import { CoValue, ID } from "./interfaces.js";
|
||||
import { ItemsSym, type Ref, RefEncoded, UnCo } from "../internal.js";
|
||||
import { type Account } from "./account.js";
|
||||
import { type CoFeed, CoFeedEntry } from "./coFeed.js";
|
||||
import { type CoList } from "./coList.js";
|
||||
import { type CoKeys, type CoMap } from "./coMap.js";
|
||||
import { type CoValue, type ID } from "./interfaces.js";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export function fulfillsDepth(depth: any, value: CoValue): boolean {
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { CoMap, FileStream, co, subscriptionsScopes } from "../../internal.js";
|
||||
import { co, subscriptionsScopes } from "../../internal.js";
|
||||
import { FileStream } from "../coFeed.js";
|
||||
import { CoMap } from "../coMap.js";
|
||||
|
||||
/** @category Media */
|
||||
export class ImageDefinition extends CoMap {
|
||||
|
||||
@@ -9,24 +9,19 @@ import type {
|
||||
Schema,
|
||||
} from "../internal.js";
|
||||
import {
|
||||
Account,
|
||||
AccountAndGroupProxyHandler,
|
||||
CoMap,
|
||||
CoValueBase,
|
||||
MembersSym,
|
||||
Ref,
|
||||
co,
|
||||
ensureCoValueLoaded,
|
||||
isControlledAccount,
|
||||
loadCoValue,
|
||||
subscribeToCoValue,
|
||||
subscribeToExistingCoValue,
|
||||
} from "../internal.js";
|
||||
|
||||
/** @category Identity & Permissions */
|
||||
export class Profile extends CoMap {
|
||||
name = co.string;
|
||||
}
|
||||
import { AccountAndGroupProxyHandler, isControlledAccount } from "./account.js";
|
||||
import { type Account } from "./account.js";
|
||||
import { type CoMap } from "./coMap.js";
|
||||
import { type Profile } from "./profile.js";
|
||||
import { RegisteredSchemas } from "./registeredSchemas.js";
|
||||
|
||||
/** @category Identity & Permissions */
|
||||
export class Group extends CoValueBase implements CoValue {
|
||||
@@ -51,7 +46,7 @@ export class Group extends CoValueBase implements CoValue {
|
||||
profile: "json" satisfies Schema,
|
||||
root: "json" satisfies Schema,
|
||||
[MembersSym]: {
|
||||
ref: () => Account,
|
||||
ref: () => RegisteredSchemas["Account"],
|
||||
optional: false,
|
||||
} satisfies RefEncoded<Account>,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
@@ -229,3 +224,5 @@ export class Group extends CoValueBase implements CoValue {
|
||||
return this._raw.core.waitForSync(options);
|
||||
}
|
||||
}
|
||||
|
||||
RegisteredSchemas["Group"] = Group;
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
import type { CojsonInternalTypes, RawCoValue } from "cojson";
|
||||
import { RawAccount } from "cojson";
|
||||
import { AnonymousJazzAgent } from "../implementation/anonymousJazzAgent.js";
|
||||
import type { DeeplyLoaded, DepthsIn } from "../internal.js";
|
||||
import {
|
||||
Account,
|
||||
AnonymousJazzAgent,
|
||||
Group,
|
||||
Ref,
|
||||
SubscriptionScope,
|
||||
inspect,
|
||||
subscriptionsScopes,
|
||||
} from "../internal.js";
|
||||
import { coValuesCache } from "../lib/cache.js";
|
||||
import { type Account } from "./account.js";
|
||||
import { fulfillsDepth } from "./deepLoading.js";
|
||||
import { type Group } from "./group.js";
|
||||
import { RegisteredSchemas } from "./registeredSchemas.js";
|
||||
|
||||
/** @category Abstract interfaces */
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
@@ -85,8 +86,8 @@ export class CoValueBase implements CoValue {
|
||||
get _owner(): Account | Group {
|
||||
const owner =
|
||||
this._raw.group instanceof RawAccount
|
||||
? Account.fromRaw(this._raw.group)
|
||||
: Group.fromRaw(this._raw.group);
|
||||
? RegisteredSchemas["Account"].fromRaw(this._raw.group)
|
||||
: RegisteredSchemas["Group"].fromRaw(this._raw.group);
|
||||
|
||||
const subScope = subscriptionsScopes.get(this);
|
||||
if (subScope) {
|
||||
@@ -102,7 +103,9 @@ export class CoValueBase implements CoValue {
|
||||
const rawAccount = this._raw.core.node.account;
|
||||
|
||||
if (rawAccount instanceof RawAccount) {
|
||||
return coValuesCache.get(rawAccount, () => Account.fromRaw(rawAccount));
|
||||
return coValuesCache.get(rawAccount, () =>
|
||||
RegisteredSchemas["Account"].fromRaw(rawAccount),
|
||||
);
|
||||
}
|
||||
|
||||
return new AnonymousJazzAgent(this._raw.core.node);
|
||||
|
||||
7
packages/jazz-tools/src/coValues/profile.ts
Normal file
7
packages/jazz-tools/src/coValues/profile.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { co } from "../internal.js";
|
||||
import { CoMap } from "./coMap.js";
|
||||
|
||||
/** @category Identity & Permissions */
|
||||
export class Profile extends CoMap {
|
||||
name = co.string;
|
||||
}
|
||||
12
packages/jazz-tools/src/coValues/registeredSchemas.ts
Normal file
12
packages/jazz-tools/src/coValues/registeredSchemas.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { Account } from "./account.js";
|
||||
import type { CoMap } from "./coMap.js";
|
||||
import type { Group } from "./group.js";
|
||||
|
||||
/**
|
||||
* Regisering schemas into this Record to avoid circular dependencies.
|
||||
*/
|
||||
export const RegisteredSchemas = {} as {
|
||||
Account: typeof Account;
|
||||
Group: typeof Group;
|
||||
CoMap: typeof CoMap;
|
||||
};
|
||||
@@ -14,23 +14,24 @@ export { Encoders, co } from "./internal.js";
|
||||
|
||||
export {
|
||||
Account,
|
||||
isControlledAccount,
|
||||
type AccountClass,
|
||||
} from "./coValues/account.js";
|
||||
export { Group } from "./coValues/group.js";
|
||||
export {
|
||||
CoStream,
|
||||
CoFeed,
|
||||
FileStream,
|
||||
BinaryCoStream,
|
||||
CoList,
|
||||
CoMap,
|
||||
CoFeed,
|
||||
CoStream,
|
||||
CoValueBase,
|
||||
Group,
|
||||
ImageDefinition,
|
||||
Profile,
|
||||
isControlledAccount,
|
||||
SchemaUnion,
|
||||
type AccountClass,
|
||||
type CoMapInit,
|
||||
type CoValueClass,
|
||||
} from "./internal.js";
|
||||
export type { DeeplyLoaded, DepthsIn } from "./internal.js";
|
||||
} from "./coValues/coFeed.js";
|
||||
export { CoList } from "./coValues/coList.js";
|
||||
export { CoMap, type CoMapInit } from "./coValues/coMap.js";
|
||||
export { CoValueBase } from "./coValues/interfaces.js";
|
||||
export { ImageDefinition } from "./coValues/extensions/imageDef.js";
|
||||
export { Profile } from "./coValues/profile.js";
|
||||
export { SchemaUnion } from "./coValues/schemaUnion.js";
|
||||
|
||||
export type { CoValueClass, DeeplyLoaded, DepthsIn } from "./internal.js";
|
||||
|
||||
export {
|
||||
createCoValueObservable,
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import { LocalNode } from "cojson";
|
||||
|
||||
export class AnonymousJazzAgent {
|
||||
_type = "Anonymous" as const;
|
||||
constructor(public node: LocalNode) {}
|
||||
}
|
||||
@@ -9,7 +9,10 @@ import {
|
||||
RawAccountID,
|
||||
SessionID,
|
||||
} from "cojson";
|
||||
import { Account, AccountClass, ID } from "../internal.js";
|
||||
import { type Account, type AccountClass } from "../coValues/account.js";
|
||||
import { RegisteredSchemas } from "../coValues/registeredSchemas.js";
|
||||
import type { ID } from "../internal.js";
|
||||
import { AnonymousJazzAgent } from "./anonymousJazzAgent.js";
|
||||
|
||||
export type Credentials = {
|
||||
accountID: ID<Account>;
|
||||
@@ -136,7 +139,8 @@ export async function createJazzContext<Acc extends Account>(
|
||||
|
||||
const { auth, sessionProvider, peersToLoadFrom, crypto } = options;
|
||||
const AccountSchema =
|
||||
options.AccountSchema ?? (Account as unknown as AccountClass<Acc>);
|
||||
options.AccountSchema ??
|
||||
(RegisteredSchemas["Account"] as unknown as AccountClass<Acc>);
|
||||
let authResult: AuthResult;
|
||||
try {
|
||||
authResult = await auth.start(crypto);
|
||||
@@ -243,11 +247,6 @@ export async function createJazzContext<Acc extends Account>(
|
||||
}
|
||||
}
|
||||
|
||||
export class AnonymousJazzAgent {
|
||||
_type = "Anonymous" as const;
|
||||
constructor(public node: LocalNode) {}
|
||||
}
|
||||
|
||||
export async function createAnonymousJazzContext({
|
||||
peersToLoadFrom,
|
||||
crypto,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user