Compare commits
12 Commits
jazz-brows
...
jazz-tools
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
829ab08873 | ||
|
|
2c9b08a080 | ||
|
|
48bda8854f | ||
|
|
96ed9adf59 | ||
|
|
5e4905ca99 | ||
|
|
1d4949b70c | ||
|
|
7dacfd03f9 | ||
|
|
bd4191520e | ||
|
|
e3dfb1b06e | ||
|
|
7de210f225 | ||
|
|
1676ff852a | ||
|
|
e14e61f7d9 |
@@ -15,6 +15,7 @@
|
||||
"jazz-browser-media-images",
|
||||
"jazz-expo",
|
||||
"jazz-inspector",
|
||||
"jazz-inspector-element",
|
||||
"jazz-nodejs",
|
||||
"jazz-react",
|
||||
"jazz-react-core",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# chat-rn-expo-clerk
|
||||
|
||||
## 1.0.113
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
- jazz-react-native-media-images@0.13.21
|
||||
|
||||
## 1.0.112
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "chat-rn-expo-clerk",
|
||||
"main": "index.js",
|
||||
"version": "1.0.112",
|
||||
"version": "1.0.113",
|
||||
"scripts": {
|
||||
"build": "expo export -p ios",
|
||||
"start": "expo start",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# chat-rn-expo
|
||||
|
||||
## 1.0.100
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-expo@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 1.0.99
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "chat-rn-expo",
|
||||
"version": "1.0.99",
|
||||
"version": "1.0.100",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "expo export -p ios",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# chat-rn
|
||||
|
||||
## 1.0.108
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e14e61f]
|
||||
- cojson@0.13.21
|
||||
- cojson-transport-ws@0.13.21
|
||||
- jazz-react-native@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 1.0.107
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "chat-rn",
|
||||
"version": "1.0.107",
|
||||
"version": "1.0.108",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"android": "react-native run-android",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# chat-vue
|
||||
|
||||
## 0.0.92
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
- jazz-vue@0.13.21
|
||||
|
||||
## 0.0.91
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "chat-vue",
|
||||
"version": "0.0.91",
|
||||
"version": "0.0.92",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-example-chat
|
||||
|
||||
## 0.0.190
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [7de210f]
|
||||
- jazz-inspector@0.13.21
|
||||
- jazz-react@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.189
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-chat",
|
||||
"private": true,
|
||||
"version": "0.0.189",
|
||||
"version": "0.0.190",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# minimal-auth-clerk
|
||||
|
||||
## 0.0.89
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.21
|
||||
- jazz-react-auth-clerk@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.88
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "clerk",
|
||||
"private": true,
|
||||
"version": "0.0.88",
|
||||
"version": "0.0.89",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# file-share-svelte
|
||||
|
||||
## 0.0.72
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-inspector-element@0.13.21
|
||||
- jazz-svelte@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.71
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "file-share-svelte",
|
||||
"version": "0.0.71",
|
||||
"version": "0.0.72",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
@@ -39,6 +39,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@tailwindcss/typography": "^0.5.15",
|
||||
"jazz-inspector-element": "workspace:*",
|
||||
"jazz-svelte": "workspace:*",
|
||||
"jazz-tools": "workspace:*",
|
||||
"lucide-svelte": "^0.463.0",
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { JazzProvider } from 'jazz-svelte';
|
||||
import { PasskeyAuthBasicUI, usePasskeyAuth } from 'jazz-svelte';
|
||||
import "jazz-inspector-element"
|
||||
import { PasskeyAuthBasicUI } from 'jazz-svelte';
|
||||
import { Toaster } from 'svelte-sonner';
|
||||
import '../app.css';
|
||||
import { FileShareAccount } from '$lib/schema';
|
||||
@@ -29,6 +30,7 @@
|
||||
peer: `wss://cloud.jazz.tools/?key=${apiKey}`,
|
||||
}}
|
||||
>
|
||||
<jazz-inspector></jazz-inspector>
|
||||
<PasskeyAuthBasicUI appName="File Share">
|
||||
<div class="min-h-screen bg-gray-100">
|
||||
{@render children()}
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-tailwind-demo-auth-starter
|
||||
|
||||
## 0.0.29
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [7de210f]
|
||||
- jazz-inspector@0.13.21
|
||||
- jazz-react@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.28
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "filestream",
|
||||
"private": true,
|
||||
"version": "0.0.28",
|
||||
"version": "0.0.29",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# form
|
||||
|
||||
## 0.1.30
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.1.29
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "form",
|
||||
"private": true,
|
||||
"version": "0.1.29",
|
||||
"version": "0.1.30",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# image-upload
|
||||
|
||||
## 0.0.86
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.85
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "image-upload",
|
||||
"private": true,
|
||||
"version": "0.0.85",
|
||||
"version": "0.0.86",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# jazz-example-inspector
|
||||
|
||||
## 0.0.140
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [7de210f]
|
||||
- Updated dependencies [e14e61f]
|
||||
- jazz-inspector@0.13.21
|
||||
- cojson@0.13.21
|
||||
- cojson-transport-ws@0.13.21
|
||||
|
||||
## 0.0.139
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-inspector-app",
|
||||
"private": true,
|
||||
"version": "0.0.139",
|
||||
"version": "0.0.140",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# multi-cursors
|
||||
|
||||
## 0.0.82
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.81
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "multi-cursors",
|
||||
"private": true,
|
||||
"version": "0.0.81",
|
||||
"version": "0.0.82",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# multiauth
|
||||
|
||||
## 0.0.30
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.21
|
||||
- jazz-react-auth-clerk@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.29
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "multiauth",
|
||||
"private": true,
|
||||
"version": "0.0.29",
|
||||
"version": "0.0.30",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-example-musicplayer
|
||||
|
||||
## 0.0.111
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [7de210f]
|
||||
- jazz-inspector@0.13.21
|
||||
- jazz-react@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.110
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-music-player",
|
||||
"private": true,
|
||||
"version": "0.0.110",
|
||||
"version": "0.0.111",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# organization
|
||||
|
||||
## 0.0.82
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.81
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "organization",
|
||||
"private": true,
|
||||
"version": "0.0.81",
|
||||
"version": "0.0.82",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# passkey-svelte
|
||||
|
||||
## 0.0.76
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-svelte@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.75
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "passkey-svelte",
|
||||
"version": "0.0.75",
|
||||
"version": "0.0.76",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# minimal-auth-passkey
|
||||
|
||||
## 0.0.87
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.86
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "passkey",
|
||||
"private": true,
|
||||
"version": "0.0.86",
|
||||
"version": "0.0.87",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# passphrase
|
||||
|
||||
## 0.0.84
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.83
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "passphrase",
|
||||
"private": true,
|
||||
"version": "0.0.83",
|
||||
"version": "0.0.84",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# jazz-password-manager
|
||||
|
||||
## 0.0.108
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.107
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-password-manager",
|
||||
"private": true,
|
||||
"version": "0.0.107",
|
||||
"version": "0.0.108",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# jazz-example-pets
|
||||
|
||||
## 0.0.206
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.205
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-pets",
|
||||
"private": true,
|
||||
"version": "0.0.205",
|
||||
"version": "0.0.206",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# reactions
|
||||
|
||||
## 0.0.86
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.85
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "reactions",
|
||||
"private": true,
|
||||
"version": "0.0.85",
|
||||
"version": "0.0.86",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# richtext
|
||||
|
||||
## 0.0.76
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
- jazz-richtext-prosemirror@0.1.10
|
||||
|
||||
## 0.0.75
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "richtext",
|
||||
"private": true,
|
||||
"version": "0.0.75",
|
||||
"version": "0.0.76",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# todo-vue
|
||||
|
||||
## 0.0.90
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
- jazz-vue@0.13.21
|
||||
|
||||
## 0.0.89
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "todo-vue",
|
||||
"version": "0.0.89",
|
||||
"version": "0.0.90",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# jazz-example-todo
|
||||
|
||||
## 0.0.205
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-react@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.204
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-todo",
|
||||
"private": true,
|
||||
"version": "0.0.204",
|
||||
"version": "0.0.205",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# version-history
|
||||
|
||||
## 0.0.84
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [7de210f]
|
||||
- jazz-inspector@0.13.21
|
||||
- jazz-react@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.0.83
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "version-history",
|
||||
"private": true,
|
||||
"version": "0.0.83",
|
||||
"version": "0.0.84",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# cojson-storage-indexeddb
|
||||
|
||||
## 0.13.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e14e61f]
|
||||
- cojson@0.13.21
|
||||
- cojson-storage@0.13.21
|
||||
|
||||
## 0.13.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cojson-storage-indexeddb",
|
||||
"version": "0.13.20",
|
||||
"version": "0.13.21",
|
||||
"main": "dist/index.js",
|
||||
"type": "module",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# cojson-storage-sqlite
|
||||
|
||||
## 0.13.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e14e61f]
|
||||
- cojson@0.13.21
|
||||
- cojson-storage@0.13.21
|
||||
|
||||
## 0.13.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "cojson-storage-sqlite",
|
||||
"type": "module",
|
||||
"version": "0.13.20",
|
||||
"version": "0.13.21",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"better-sqlite3": "^11.7.0",
|
||||
"cojson": "workspace:0.13.20",
|
||||
"cojson": "workspace:0.13.21",
|
||||
"cojson-storage": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# cojson-storage
|
||||
|
||||
## 0.13.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e14e61f]
|
||||
- cojson@0.13.21
|
||||
|
||||
## 0.13.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cojson-storage",
|
||||
"version": "0.13.20",
|
||||
"version": "0.13.21",
|
||||
"main": "dist/index.js",
|
||||
"type": "module",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# cojson-transport-nodejs-ws
|
||||
|
||||
## 0.13.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e14e61f]
|
||||
- cojson@0.13.21
|
||||
|
||||
## 0.13.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "cojson-transport-ws",
|
||||
"type": "module",
|
||||
"version": "0.13.20",
|
||||
"version": "0.13.21",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# cojson
|
||||
|
||||
## 0.13.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- e14e61f: Optimized the acceptInvite flow
|
||||
|
||||
## 0.13.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
},
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"version": "0.13.20",
|
||||
"version": "0.13.21",
|
||||
"devDependencies": {
|
||||
"@opentelemetry/sdk-metrics": "^2.0.0",
|
||||
"typescript": "catalog:"
|
||||
|
||||
@@ -311,14 +311,10 @@ export class CoValueCore {
|
||||
}
|
||||
}
|
||||
|
||||
contentInClonedNodeWithDifferentAccount(
|
||||
controlledAccountOrAgent: ControlledAccountOrAgent,
|
||||
): RawCoValue {
|
||||
const newNode = this.node.cloneWithDifferentAccount(
|
||||
controlledAccountOrAgent,
|
||||
);
|
||||
|
||||
return newNode.expectCoValueLoaded(this.id).getCurrentContent();
|
||||
contentInClonedNodeWithDifferentAccount(account: ControlledAccountOrAgent) {
|
||||
return this.node
|
||||
.loadCoValueAsDifferentAgent(this.id, account.agentSecret, account.id)
|
||||
.getCurrentContent();
|
||||
}
|
||||
|
||||
knownState(): CoValueKnownState {
|
||||
|
||||
@@ -433,32 +433,44 @@ export class LocalNode {
|
||||
groupOrOwnedValueID: CoID<T>,
|
||||
inviteSecret: InviteSecret,
|
||||
): Promise<void> {
|
||||
const groupOrOwnedValue = await this.load(groupOrOwnedValueID);
|
||||
const value = await this.load(groupOrOwnedValueID);
|
||||
|
||||
if (groupOrOwnedValue === "unavailable") {
|
||||
if (value === "unavailable") {
|
||||
throw new Error(
|
||||
"Trying to accept invite: Group/owned value unavailable from all peers",
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
groupOrOwnedValue.core.verified.header.ruleset.type === "ownedByGroup"
|
||||
) {
|
||||
return this.acceptInvite(
|
||||
groupOrOwnedValue.core.verified.header.ruleset.group as CoID<RawGroup>,
|
||||
inviteSecret,
|
||||
);
|
||||
} else if (
|
||||
groupOrOwnedValue.core.verified.header.ruleset.type !== "group"
|
||||
) {
|
||||
throw new Error("Can only accept invites to groups");
|
||||
const ruleset = value.core.verified.header.ruleset;
|
||||
|
||||
let group: RawGroup;
|
||||
|
||||
if (ruleset.type === "unsafeAllowAll") {
|
||||
throw new Error("Can only accept invites to values owned by groups");
|
||||
}
|
||||
|
||||
const group = expectGroup(groupOrOwnedValue);
|
||||
if (ruleset.type === "ownedByGroup") {
|
||||
const owner = await this.load(ruleset.group as CoID<RawGroup>);
|
||||
|
||||
if (owner === "unavailable") {
|
||||
throw new Error(
|
||||
"Trying to accept invite: CoValue owner unavailable from all peers",
|
||||
);
|
||||
}
|
||||
|
||||
group = expectGroup(owner);
|
||||
} else {
|
||||
group = expectGroup(value);
|
||||
}
|
||||
|
||||
if (group.core.verified.header.meta?.type === "account") {
|
||||
throw new Error("Can't accept invites to values owned by accounts");
|
||||
}
|
||||
|
||||
const inviteAgentSecret = this.crypto.agentSecretFromSecretSeed(
|
||||
secretSeedFromInviteSecret(inviteSecret),
|
||||
);
|
||||
|
||||
const inviteAgentID = this.crypto.getAgentID(inviteAgentSecret);
|
||||
|
||||
const inviteRole = await new Promise((resolve, reject) => {
|
||||
@@ -493,9 +505,10 @@ export class LocalNode {
|
||||
}
|
||||
|
||||
const groupAsInvite = expectGroup(
|
||||
group.core.contentInClonedNodeWithDifferentAccount(
|
||||
new ControlledAgent(inviteAgentSecret, this.crypto),
|
||||
),
|
||||
this.loadCoValueAsDifferentAgent(
|
||||
group.id,
|
||||
inviteAgentSecret,
|
||||
).getCurrentContent(),
|
||||
);
|
||||
|
||||
groupAsInvite.addMemberInternal(
|
||||
@@ -524,7 +537,7 @@ export class LocalNode {
|
||||
|
||||
if (!coValue.isAvailable()) {
|
||||
throw new Error(
|
||||
`${expectation ? expectation + ": " : ""}CoValue ${id} not yet loaded. Current state: ${JSON.stringify(coValue)}`,
|
||||
`${expectation ? expectation + ": " : ""}CoValue ${id} not yet loaded.`,
|
||||
);
|
||||
}
|
||||
return coValue;
|
||||
@@ -621,46 +634,56 @@ export class LocalNode {
|
||||
return group;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
cloneWithDifferentAccount(
|
||||
controlledAccountOrAgent: ControlledAccountOrAgent,
|
||||
): LocalNode {
|
||||
loadCoValueAsDifferentAgent(
|
||||
id: RawCoID,
|
||||
secret: AgentSecret,
|
||||
accountId?: RawAccountID | AgentID,
|
||||
) {
|
||||
const agent = new ControlledAgent(secret, this.crypto);
|
||||
|
||||
const newNode = new LocalNode(
|
||||
controlledAccountOrAgent.agentSecret,
|
||||
this.crypto.newRandomSessionID(controlledAccountOrAgent.id),
|
||||
secret,
|
||||
this.crypto.newRandomSessionID(accountId || agent.id),
|
||||
this.crypto,
|
||||
);
|
||||
|
||||
newNode.cloneVerifiedStateFrom(this);
|
||||
newNode.cloneVerifiedStateFrom(this, id);
|
||||
|
||||
return newNode;
|
||||
return newNode.expectCoValueLoaded(id);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
cloneVerifiedStateFrom(otherNode: LocalNode) {
|
||||
const coValuesToCopy = Array.from(otherNode.coValues.entries());
|
||||
cloneVerifiedStateFrom(otherNode: LocalNode, id: RawCoID) {
|
||||
const coValuesIdsToCopy = [id];
|
||||
|
||||
while (coValuesToCopy.length > 0) {
|
||||
const [coValueID, coValue] = coValuesToCopy[coValuesToCopy.length - 1]!;
|
||||
// Scan all the dependencies and add them to the list
|
||||
for (let i = 0; i < coValuesIdsToCopy.length; i++) {
|
||||
const coValueID = coValuesIdsToCopy[i]!;
|
||||
const coValue = otherNode.getCoValue(coValueID);
|
||||
|
||||
if (!coValue.isAvailable()) {
|
||||
coValuesToCopy.pop();
|
||||
continue;
|
||||
} else {
|
||||
const allDepsCopied = coValue
|
||||
.getDependedOnCoValues()
|
||||
.every((dep) => this.coValues.get(dep)?.isAvailable());
|
||||
|
||||
if (!allDepsCopied) {
|
||||
// move to end of queue
|
||||
coValuesToCopy.unshift(coValuesToCopy.pop()!);
|
||||
continue;
|
||||
}
|
||||
|
||||
this.putCoValue(coValueID, coValue.verified);
|
||||
|
||||
coValuesToCopy.pop();
|
||||
}
|
||||
|
||||
for (const dep of coValue.getDependedOnCoValues()) {
|
||||
coValuesIdsToCopy.push(dep);
|
||||
}
|
||||
}
|
||||
|
||||
// Copy the coValue all the dependencies by following the dependency order
|
||||
while (coValuesIdsToCopy.length > 0) {
|
||||
const coValueID = coValuesIdsToCopy.pop()!;
|
||||
const coValue = otherNode.getCoValue(coValueID);
|
||||
|
||||
if (!coValue.isAvailable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.coValues.get(coValueID)?.isAvailable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
this.putCoValue(coValueID, coValue.verified);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -512,7 +512,6 @@ test("Admins can set group read key and then use it to create private transactio
|
||||
const { node, groupCore, admin } = newGroup();
|
||||
|
||||
const reader1 = createAccountInNode(node);
|
||||
|
||||
const reader2 = createAccountInNode(node);
|
||||
|
||||
const { secret: readKey, id: readKeyID } = Crypto.newRandomKeySecret();
|
||||
@@ -583,6 +582,9 @@ test("Admins can set group read key and then use it to create private transactio
|
||||
childObject.contentInClonedNodeWithDifferentAccount(reader2),
|
||||
);
|
||||
|
||||
// Need to copy the account coValue to the new node to be able to read the readKey
|
||||
childObjectAsReader2.core.node.cloneVerifiedStateFrom(node, reader2.id);
|
||||
|
||||
expect(childObjectAsReader2.core.getCurrentReadKey().secret).toEqual(readKey);
|
||||
expect(childObjectAsReader2.get("foo")).toEqual("bar");
|
||||
});
|
||||
@@ -1113,9 +1115,10 @@ test("Admins can create an adminInvite, which can add an admin (high-level)", as
|
||||
const invitedAdminSecret = Crypto.newRandomAgentSecret();
|
||||
const invitedAdminID = Crypto.getAgentID(invitedAdminSecret);
|
||||
|
||||
const nodeAsInvitedAdmin = node.cloneWithDifferentAccount(
|
||||
new ControlledAgent(invitedAdminSecret, Crypto),
|
||||
);
|
||||
const nodeAsInvitedAdmin = node.loadCoValueAsDifferentAgent(
|
||||
group.id,
|
||||
invitedAdminSecret,
|
||||
).node;
|
||||
|
||||
await nodeAsInvitedAdmin.acceptInvite(group.id, inviteSecret);
|
||||
|
||||
@@ -1219,9 +1222,10 @@ test("Admins can create a writerInvite, which can add a writer (high-level)", as
|
||||
const invitedWriterSecret = Crypto.newRandomAgentSecret();
|
||||
const invitedWriterID = Crypto.getAgentID(invitedWriterSecret);
|
||||
|
||||
const nodeAsInvitedWriter = node.cloneWithDifferentAccount(
|
||||
new ControlledAgent(invitedWriterSecret, Crypto),
|
||||
);
|
||||
const nodeAsInvitedWriter = node.loadCoValueAsDifferentAgent(
|
||||
group.id,
|
||||
invitedWriterSecret,
|
||||
).node;
|
||||
|
||||
await nodeAsInvitedWriter.acceptInvite(group.id, inviteSecret);
|
||||
|
||||
@@ -1308,9 +1312,10 @@ test("Admins can create a readerInvite, which can add a reader (high-level)", as
|
||||
const invitedReaderSecret = Crypto.newRandomAgentSecret();
|
||||
const invitedReaderID = Crypto.getAgentID(invitedReaderSecret);
|
||||
|
||||
const nodeAsInvitedReader = node.cloneWithDifferentAccount(
|
||||
new ControlledAgent(invitedReaderSecret, Crypto),
|
||||
);
|
||||
const nodeAsInvitedReader = node.loadCoValueAsDifferentAgent(
|
||||
group.id,
|
||||
invitedReaderSecret,
|
||||
).node;
|
||||
|
||||
await nodeAsInvitedReader.acceptInvite(group.id, inviteSecret);
|
||||
|
||||
|
||||
163
packages/cojson/src/tests/sync.invite.test.ts
Normal file
163
packages/cojson/src/tests/sync.invite.test.ts
Normal file
@@ -0,0 +1,163 @@
|
||||
import { beforeEach, describe, expect, test } from "vitest";
|
||||
|
||||
import { expectList, expectMap } from "../coValue";
|
||||
import { WasmCrypto } from "../crypto/WasmCrypto";
|
||||
import {
|
||||
SyncMessagesLog,
|
||||
loadCoValueOrFail,
|
||||
setupTestNode,
|
||||
waitFor,
|
||||
} from "./testUtils";
|
||||
|
||||
const Crypto = await WasmCrypto.create();
|
||||
let jazzCloud = setupTestNode({ isSyncServer: true });
|
||||
|
||||
beforeEach(async () => {
|
||||
SyncMessagesLog.clear();
|
||||
jazzCloud = setupTestNode({ isSyncServer: true });
|
||||
});
|
||||
|
||||
describe("invitations sync", () => {
|
||||
test("invite a client to a group", async () => {
|
||||
const client = setupTestNode();
|
||||
client.connectToSyncServer({
|
||||
ourName: "invite-provider",
|
||||
});
|
||||
const client2 = setupTestNode();
|
||||
client2.connectToSyncServer({
|
||||
ourName: "invite-consumer",
|
||||
});
|
||||
|
||||
const group = client.node.createGroup();
|
||||
const map = group.createMap();
|
||||
map.set("hello", "world");
|
||||
|
||||
await map.core.waitForSync();
|
||||
|
||||
const invite = group.createInvite("reader");
|
||||
|
||||
await group.core.waitForSync();
|
||||
SyncMessagesLog.clear();
|
||||
|
||||
await client2.node.acceptInvite(map.id, invite);
|
||||
|
||||
const mapOnClient2 = await loadCoValueOrFail(client2.node, map.id);
|
||||
expect(mapOnClient2.get("hello")).toEqual("world");
|
||||
|
||||
expect(
|
||||
SyncMessagesLog.getMessages({
|
||||
Group: group.core,
|
||||
Map: map.core,
|
||||
}),
|
||||
).toMatchInlineSnapshot(`
|
||||
[
|
||||
"invite-consumer -> server | LOAD Map sessions: empty",
|
||||
"server -> invite-consumer | CONTENT Group header: true new: After: 0 New: 5",
|
||||
"invite-consumer -> server | KNOWN Group sessions: header/5",
|
||||
"server -> invite-consumer | CONTENT Map header: true new: After: 0 New: 1",
|
||||
"invite-consumer -> server | KNOWN Map sessions: header/1",
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
||||
test("invite a client to a group with parents", async () => {
|
||||
const client = setupTestNode();
|
||||
client.connectToSyncServer({
|
||||
ourName: "invite-provider",
|
||||
});
|
||||
const client2 = setupTestNode();
|
||||
client2.connectToSyncServer({
|
||||
ourName: "invite-consumer",
|
||||
});
|
||||
|
||||
const parentGroup = client.node.createGroup();
|
||||
const group = client.node.createGroup();
|
||||
|
||||
group.extend(parentGroup);
|
||||
const map = group.createMap();
|
||||
map.set("hello", "world");
|
||||
|
||||
await map.core.waitForSync();
|
||||
|
||||
const invite = group.createInvite("reader");
|
||||
|
||||
await group.core.waitForSync();
|
||||
SyncMessagesLog.clear();
|
||||
|
||||
await client2.node.acceptInvite(map.id, invite);
|
||||
|
||||
const mapOnClient2 = await loadCoValueOrFail(client2.node, map.id);
|
||||
expect(mapOnClient2.get("hello")).toEqual("world");
|
||||
|
||||
expect(
|
||||
SyncMessagesLog.getMessages({
|
||||
Group: group.core,
|
||||
ParentGroup: parentGroup.core,
|
||||
Map: map.core,
|
||||
}),
|
||||
).toMatchInlineSnapshot(`
|
||||
[
|
||||
"invite-consumer -> server | LOAD Map sessions: empty",
|
||||
"server -> invite-consumer | CONTENT ParentGroup header: true new: After: 0 New: 4",
|
||||
"invite-consumer -> server | KNOWN ParentGroup sessions: header/4",
|
||||
"server -> invite-consumer | CONTENT Group header: true new: After: 0 New: 7",
|
||||
"invite-consumer -> server | KNOWN Group sessions: header/7",
|
||||
"server -> invite-consumer | CONTENT Map header: true new: After: 0 New: 1",
|
||||
"invite-consumer -> server | KNOWN Map sessions: header/1",
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
||||
test("invite a client to a parent group", async () => {
|
||||
const client = setupTestNode();
|
||||
client.connectToSyncServer({
|
||||
ourName: "invite-provider",
|
||||
});
|
||||
const client2 = setupTestNode();
|
||||
client2.connectToSyncServer({
|
||||
ourName: "invite-consumer",
|
||||
});
|
||||
|
||||
const parentGroup = client.node.createGroup();
|
||||
const group = client.node.createGroup();
|
||||
|
||||
group.extend(parentGroup);
|
||||
const map = group.createMap();
|
||||
map.set("hello", "world");
|
||||
|
||||
await map.core.waitForSync();
|
||||
|
||||
const invite = parentGroup.createInvite("reader");
|
||||
|
||||
await parentGroup.core.waitForSync();
|
||||
SyncMessagesLog.clear();
|
||||
|
||||
await client2.node.acceptInvite(parentGroup.id, invite);
|
||||
|
||||
const mapOnClient2 = await loadCoValueOrFail(client2.node, map.id);
|
||||
expect(mapOnClient2.get("hello")).toEqual("world");
|
||||
|
||||
expect(
|
||||
SyncMessagesLog.getMessages({
|
||||
Group: group.core,
|
||||
ParentGroup: parentGroup.core,
|
||||
Map: map.core,
|
||||
}),
|
||||
).toMatchInlineSnapshot(`
|
||||
[
|
||||
"invite-consumer -> server | LOAD ParentGroup sessions: empty",
|
||||
"server -> invite-consumer | CONTENT ParentGroup header: true new: After: 0 New: 6",
|
||||
"invite-consumer -> server | KNOWN ParentGroup sessions: header/6",
|
||||
"invite-consumer -> server | LOAD Map sessions: empty",
|
||||
"server -> invite-consumer | CONTENT Group header: true new: After: 0 New: 5",
|
||||
"invite-consumer -> server | KNOWN Group sessions: header/5",
|
||||
"server -> invite-consumer | CONTENT Map header: true new: After: 0 New: 1",
|
||||
"invite-consumer -> server | CONTENT ParentGroup header: false new: After: 0 New: 2",
|
||||
"server -> invite-consumer | KNOWN ParentGroup sessions: header/8",
|
||||
"server -> invite-provider | CONTENT ParentGroup header: false new: After: 0 New: 2",
|
||||
"invite-consumer -> server | KNOWN Map sessions: header/1",
|
||||
"invite-provider -> server | KNOWN ParentGroup sessions: header/8",
|
||||
]
|
||||
`);
|
||||
});
|
||||
});
|
||||
@@ -1,9 +0,0 @@
|
||||
export function parseError(e: unknown): {
|
||||
message: string | null;
|
||||
stack: string | null;
|
||||
} {
|
||||
return {
|
||||
message: e instanceof Error ? e.message : null,
|
||||
stack: e instanceof Error ? (e.stack ?? null) : null,
|
||||
};
|
||||
}
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-auth-clerk
|
||||
|
||||
## 0.13.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e14e61f]
|
||||
- cojson@0.13.21
|
||||
- jazz-browser@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.13.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "jazz-auth-clerk",
|
||||
"version": "0.13.20",
|
||||
"version": "0.13.21",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cojson": "workspace:0.13.20",
|
||||
"jazz-browser": "workspace:0.13.20",
|
||||
"jazz-tools": "workspace:0.13.20"
|
||||
"cojson": "workspace:0.13.21",
|
||||
"jazz-browser": "workspace:0.13.21",
|
||||
"jazz-tools": "workspace:0.13.21"
|
||||
},
|
||||
"scripts": {
|
||||
"format-and-lint": "biome check .",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# jazz-browser-media-images
|
||||
|
||||
## 0.13.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-browser@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.13.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-browser-media-images",
|
||||
"version": "0.13.20",
|
||||
"version": "0.13.21",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
@@ -8,8 +8,8 @@
|
||||
"dependencies": {
|
||||
"@types/image-blob-reduce": "^4.1.1",
|
||||
"image-blob-reduce": "^4.1.0",
|
||||
"jazz-browser": "workspace:0.13.20",
|
||||
"jazz-tools": "workspace:0.13.20",
|
||||
"jazz-browser": "workspace:0.13.21",
|
||||
"jazz-tools": "workspace:0.13.21",
|
||||
"pica": "^9.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# jazz-browser
|
||||
|
||||
## 0.13.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e14e61f]
|
||||
- cojson@0.13.21
|
||||
- cojson-storage-indexeddb@0.13.21
|
||||
- cojson-transport-ws@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.13.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-browser",
|
||||
"version": "0.13.20",
|
||||
"version": "0.13.21",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# jazz-browser
|
||||
|
||||
## 0.13.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e14e61f]
|
||||
- cojson@0.13.21
|
||||
- cojson-transport-ws@0.13.21
|
||||
- jazz-auth-clerk@0.13.21
|
||||
- jazz-react-core@0.13.21
|
||||
- jazz-react-native-core@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.13.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-expo",
|
||||
"version": "0.13.20",
|
||||
"version": "0.13.21",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
26
packages/jazz-inspector-element/.gitignore
vendored
Normal file
26
packages/jazz-inspector-element/.gitignore
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
sync-db/
|
||||
9
packages/jazz-inspector-element/CHANGELOG.md
Normal file
9
packages/jazz-inspector-element/CHANGELOG.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# jazz-inspector-element
|
||||
|
||||
## 0.13.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [7de210f]
|
||||
- jazz-inspector@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
31
packages/jazz-inspector-element/README.md
Normal file
31
packages/jazz-inspector-element/README.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Jazz Inspector Element
|
||||
|
||||
A custom element that renders the Jazz Inspector component for inspecting Jazz accounts and CoValues.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
npm install jazz-inspector-element
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
By default jazz-inspector-element relies on `Account.getMe()` to link itself to the Jazz context, so it's enough to mount the html element in a page with a loaded Jazz app:
|
||||
|
||||
```ts
|
||||
import "jazz-inspector-element"
|
||||
|
||||
document.body.appendChild(document.createElement("jazz-inspector"))
|
||||
```
|
||||
|
||||
OR
|
||||
|
||||
```ts
|
||||
import "jazz-inspector-element" // somewhere in your app modules
|
||||
```
|
||||
|
||||
and
|
||||
|
||||
```html
|
||||
<jazz-inspector />
|
||||
```
|
||||
32
packages/jazz-inspector-element/package.json
Normal file
32
packages/jazz-inspector-element/package.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "jazz-inspector-element",
|
||||
"version": "0.13.21",
|
||||
"type": "module",
|
||||
"main": "./dist/main.js",
|
||||
"types": "./dist/main.d.ts",
|
||||
"files": [
|
||||
"dist/**",
|
||||
"src"
|
||||
],
|
||||
"scripts": {
|
||||
"dev": "rm -rf ./dist && tsc --emitDeclarationOnly --watch & vite build --watch",
|
||||
"build": "rm -rf ./dist && tsc --sourceMap --declaration --outDir dist",
|
||||
"format-and-lint": "biome check .",
|
||||
"format-and-lint:fix": "biome check . --write",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"jazz-inspector": "workspace:*",
|
||||
"jazz-tools": "workspace:*",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.3.12",
|
||||
"@types/react-dom": "^18.3.1",
|
||||
"@vitejs/plugin-react-swc": "^3.3.2",
|
||||
"rollup-plugin-node-externals": "^8.0.0",
|
||||
"typescript": "catalog:",
|
||||
"vite": "catalog:"
|
||||
}
|
||||
}
|
||||
63
packages/jazz-inspector-element/src/element.tsx
Normal file
63
packages/jazz-inspector-element/src/element.tsx
Normal file
@@ -0,0 +1,63 @@
|
||||
import { JazzInspectorInternal } from "jazz-inspector";
|
||||
import { Account } from "jazz-tools";
|
||||
import { createRoot } from "react-dom/client";
|
||||
|
||||
export class JazzInspectorElement extends HTMLElement {
|
||||
private root: ReturnType<typeof createRoot> | null = null;
|
||||
|
||||
account: Account | null = null;
|
||||
|
||||
private interval: ReturnType<typeof setInterval> | undefined;
|
||||
|
||||
loadAccount() {
|
||||
try {
|
||||
const value = Account.getMe();
|
||||
|
||||
if (value !== this.account) {
|
||||
this.account = value;
|
||||
this.render();
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
|
||||
startAccountPolling() {
|
||||
if (this.interval) return;
|
||||
|
||||
this.loadAccount();
|
||||
|
||||
this.interval = setInterval(() => {
|
||||
this.loadAccount();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
stopAccountPolling() {
|
||||
if (this.interval) clearInterval(this.interval);
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
this.root = createRoot(this);
|
||||
this.startAccountPolling();
|
||||
this.render();
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
this.root?.unmount();
|
||||
this.root = null;
|
||||
this.stopAccountPolling();
|
||||
}
|
||||
|
||||
private render() {
|
||||
if (!this.account) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.root?.render(
|
||||
<JazzInspectorInternal
|
||||
localNode={this.account._raw.core.node}
|
||||
accountId={this.account._raw.id}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
customElements.define("jazz-inspector", JazzInspectorElement);
|
||||
3
packages/jazz-inspector-element/src/main.ts
Normal file
3
packages/jazz-inspector-element/src/main.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
|
||||
import("./element.js");
|
||||
}
|
||||
1
packages/jazz-inspector-element/src/vite-env.d.ts
vendored
Normal file
1
packages/jazz-inspector-element/src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/// <reference types="vite/client" />
|
||||
29
packages/jazz-inspector-element/tsconfig.json
Normal file
29
packages/jazz-inspector-element/tsconfig.json
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"useDefineForClassFields": true,
|
||||
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "react-jsx",
|
||||
|
||||
/* Linting */
|
||||
"strict": true,
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
},
|
||||
"declaration": true,
|
||||
"declarationDir": "./dist"
|
||||
},
|
||||
"include": ["src"],
|
||||
"references": [{ "path": "./tsconfig.node.json" }]
|
||||
}
|
||||
10
packages/jazz-inspector-element/tsconfig.node.json
Normal file
10
packages/jazz-inspector-element/tsconfig.node.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"skipLibCheck": true,
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"include": ["vite.config.ts"]
|
||||
}
|
||||
23
packages/jazz-inspector-element/vite.config.ts
Normal file
23
packages/jazz-inspector-element/vite.config.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import path from "path";
|
||||
import react from "@vitejs/plugin-react-swc";
|
||||
import depsExternal from "rollup-plugin-node-externals";
|
||||
import { defineConfig } from "vite";
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react(), depsExternal()],
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(__dirname, "./src"),
|
||||
},
|
||||
},
|
||||
build: {
|
||||
lib: {
|
||||
entry: path.resolve(__dirname, "src/app.tsx"),
|
||||
name: "JazzInspector",
|
||||
// the proper extensions will be added
|
||||
fileName: "app",
|
||||
formats: ["es"],
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -1,5 +1,15 @@
|
||||
# jazz-inspector
|
||||
|
||||
## 0.13.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 7de210f: Export JazzInspectorInternal component to be used for jazz-inspector-element
|
||||
- Updated dependencies [e14e61f]
|
||||
- cojson@0.13.21
|
||||
- jazz-react-core@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.13.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-inspector",
|
||||
"version": "0.13.20",
|
||||
"version": "0.13.21",
|
||||
"type": "module",
|
||||
"main": "./dist/app.js",
|
||||
"types": "./dist/app.d.ts",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
|
||||
export { JazzInspector } from "./viewer/new-app.js";
|
||||
export { JazzInspector, JazzInspectorInternal } from "./viewer/new-app.js";
|
||||
export { PageStack } from "./viewer/page-stack.js";
|
||||
export { Breadcrumbs } from "./viewer/breadcrumbs.js";
|
||||
export { AccountOrGroupText } from "./viewer/account-or-group-text.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CoID, RawCoValue } from "cojson";
|
||||
import { CoID, LocalNode, RawAccount, RawCoValue } from "cojson";
|
||||
import { styled } from "goober";
|
||||
import { useAccount } from "jazz-react-core";
|
||||
import { useJazzContext } from "jazz-react-core";
|
||||
import React, { useState } from "react";
|
||||
import { Button } from "../ui/button.js";
|
||||
import { Input } from "../ui/input.js";
|
||||
@@ -8,6 +8,7 @@ import { Breadcrumbs } from "./breadcrumbs.js";
|
||||
import { PageStack } from "./page-stack.js";
|
||||
import { usePagePath } from "./use-page-path.js";
|
||||
|
||||
import { Account } from "jazz-tools";
|
||||
import { GlobalStyles } from "../ui/global-styles.js";
|
||||
import { Heading } from "../ui/heading.js";
|
||||
import { InspectorButton, type Position } from "./inpsector-button.js";
|
||||
@@ -59,15 +60,34 @@ const OrText = styled("p")`
|
||||
`;
|
||||
|
||||
export function JazzInspector({ position = "right" }: { position?: Position }) {
|
||||
const context = useJazzContext<Account>();
|
||||
const localNode = context.node;
|
||||
const me = "me" in context ? context.me : undefined;
|
||||
|
||||
if (process.env.NODE_ENV !== "development") return null;
|
||||
|
||||
return (
|
||||
<JazzInspectorInternal
|
||||
position={position}
|
||||
localNode={localNode}
|
||||
accountId={me?._raw.id}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export function JazzInspectorInternal({
|
||||
position = "right",
|
||||
localNode,
|
||||
accountId,
|
||||
}: {
|
||||
position?: Position;
|
||||
localNode?: LocalNode;
|
||||
accountId?: CoID<RawAccount>;
|
||||
}) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [coValueId, setCoValueId] = useState<CoID<RawCoValue> | "">("");
|
||||
const { path, addPages, goToIndex, goBack, setPage } = usePagePath();
|
||||
|
||||
const { me } = useAccount();
|
||||
const localNode = me._raw.core.node;
|
||||
|
||||
if (process.env.NODE_ENV !== "development") return;
|
||||
|
||||
const handleCoValueIdSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
if (coValueId) {
|
||||
@@ -127,17 +147,21 @@ export function JazzInspector({ position = "right" }: { position?: Position }) {
|
||||
Inspect CoValue
|
||||
</Button>
|
||||
|
||||
<OrText>or</OrText>
|
||||
{accountId && (
|
||||
<>
|
||||
<OrText>or</OrText>
|
||||
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => {
|
||||
setCoValueId(me._raw.id);
|
||||
setPage(me._raw.id);
|
||||
}}
|
||||
>
|
||||
Inspect my account
|
||||
</Button>
|
||||
<Button
|
||||
variant="secondary"
|
||||
onClick={() => {
|
||||
setCoValueId(accountId);
|
||||
setPage(accountId);
|
||||
}}
|
||||
>
|
||||
Inspect my account
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</InitialForm>
|
||||
)}
|
||||
</PageStack>
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-autosub
|
||||
|
||||
## 0.13.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e14e61f]
|
||||
- cojson@0.13.21
|
||||
- cojson-transport-ws@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.13.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"types": "dist/index.d.ts",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"version": "0.13.20",
|
||||
"version": "0.13.21",
|
||||
"dependencies": {
|
||||
"cojson": "workspace:*",
|
||||
"cojson-transport-ws": "workspace:*",
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# jazz-browser-media-images
|
||||
|
||||
## 0.13.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e14e61f]
|
||||
- cojson@0.13.21
|
||||
- jazz-auth-clerk@0.13.21
|
||||
- jazz-browser@0.13.21
|
||||
- jazz-react@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.13.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-react-auth-clerk",
|
||||
"version": "0.13.20",
|
||||
"version": "0.13.21",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# jazz-react-core
|
||||
|
||||
## 0.13.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e14e61f]
|
||||
- cojson@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.13.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-react-core",
|
||||
"version": "0.13.20",
|
||||
"version": "0.13.21",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# jazz-browser
|
||||
|
||||
## 0.13.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e14e61f]
|
||||
- cojson@0.13.21
|
||||
- cojson-storage@0.13.21
|
||||
- cojson-transport-ws@0.13.21
|
||||
- jazz-react-core@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.13.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-react-native-core",
|
||||
"type": "module",
|
||||
"version": "0.13.20",
|
||||
"version": "0.13.21",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# jazz-browser-media-images
|
||||
|
||||
## 0.13.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.13.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-react-native-media-images",
|
||||
"version": "0.13.20",
|
||||
"version": "0.13.21",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# jazz-browser
|
||||
|
||||
## 0.13.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [e14e61f]
|
||||
- cojson@0.13.21
|
||||
- cojson-storage@0.13.21
|
||||
- jazz-react-native-core@0.13.21
|
||||
- jazz-tools@0.13.21
|
||||
|
||||
## 0.13.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user