Compare commits
72 Commits
create-jaz
...
jazz-run@0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99e88d3497 | ||
|
|
f09ce70d3c | ||
|
|
7d62e2735f | ||
|
|
5863badbb0 | ||
|
|
56d26222e7 | ||
|
|
bd34084104 | ||
|
|
f5e6fe927d | ||
|
|
93c49639c2 | ||
|
|
909165d813 | ||
|
|
6bee742b65 | ||
|
|
23486d01b9 | ||
|
|
b761d5a730 | ||
|
|
9181e74fc8 | ||
|
|
5e83864f41 | ||
|
|
789cf66de2 | ||
|
|
de5f2d6d5b | ||
|
|
4aa377dea7 | ||
|
|
efbf3d84ac | ||
|
|
b90393b43e | ||
|
|
31ae73fe0e | ||
|
|
7a5adfc4dc | ||
|
|
850e264912 | ||
|
|
aa81779ad8 | ||
|
|
72c97c0835 | ||
|
|
12809a6733 | ||
|
|
c55aeff98e | ||
|
|
16b76e401c | ||
|
|
d2470efd6f | ||
|
|
1a97b1b77c | ||
|
|
adde5b78f3 | ||
|
|
06fd3a3686 | ||
|
|
d231b6ae2a | ||
|
|
f76274c19a | ||
|
|
e471fc5d23 | ||
|
|
cb1b602255 | ||
|
|
a728dbf632 | ||
|
|
84d06d180a | ||
|
|
342e4d9f5e | ||
|
|
8eb92471ae | ||
|
|
e5b93871f7 | ||
|
|
896aeb571d | ||
|
|
3a9797ce75 | ||
|
|
b2f14c0339 | ||
|
|
2d7b4b6c82 | ||
|
|
68369c16da | ||
|
|
f002110c28 | ||
|
|
466c5f695a | ||
|
|
b6a70228ea | ||
|
|
ac32c432da | ||
|
|
066ac6bf98 | ||
|
|
ccfa7d9943 | ||
|
|
90c76a01a6 | ||
|
|
807b52cccf | ||
|
|
fb7c6c6bbf | ||
|
|
12e619b990 | ||
|
|
aba2f8110c | ||
|
|
862e3fc7ed | ||
|
|
51fc92759a | ||
|
|
c8fac3381d | ||
|
|
9723090f91 | ||
|
|
4783e08c69 | ||
|
|
34959ff0ec | ||
|
|
bec9be84d5 | ||
|
|
277ee9d7e4 | ||
|
|
314518a87f | ||
|
|
c280fa11c3 | ||
|
|
929f5785a8 | ||
|
|
9ae92c19ab | ||
|
|
599bb7355e | ||
|
|
ad76a2f44f | ||
|
|
3a3ad44f13 | ||
|
|
db01bfb0a8 |
@@ -1,5 +1,36 @@
|
|||||||
# chat-rn-clerk
|
# chat-rn-clerk
|
||||||
|
|
||||||
|
## 1.0.52
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react-native@0.9.11
|
||||||
|
- jazz-react-native-auth-clerk@0.9.11
|
||||||
|
- jazz-tools@0.9.11
|
||||||
|
- jazz-react-native-media-images@0.9.11
|
||||||
|
|
||||||
|
## 1.0.51
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- f76274c: Fix image handling in react-native
|
||||||
|
- Updated dependencies [f76274c]
|
||||||
|
- Updated dependencies [5e83864]
|
||||||
|
- jazz-react-native@0.9.10
|
||||||
|
- jazz-tools@0.9.10
|
||||||
|
- jazz-react-native-auth-clerk@0.9.10
|
||||||
|
- jazz-react-native-media-images@0.9.10
|
||||||
|
|
||||||
|
## 1.0.50
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- jazz-tools@0.9.9
|
||||||
|
- jazz-react-native@0.9.9
|
||||||
|
- jazz-react-native-auth-clerk@0.9.9
|
||||||
|
- jazz-react-native-media-images@0.9.9
|
||||||
|
|
||||||
## 1.0.49
|
## 1.0.49
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -37,7 +37,13 @@
|
|||||||
],
|
],
|
||||||
"expo-secure-store",
|
"expo-secure-store",
|
||||||
"expo-font",
|
"expo-font",
|
||||||
"expo-router"
|
"expo-router",
|
||||||
|
[
|
||||||
|
"expo-image-picker",
|
||||||
|
{
|
||||||
|
"photosPermission": "The app accesses your photos to let you share them with your friends."
|
||||||
|
}
|
||||||
|
]
|
||||||
],
|
],
|
||||||
"extra": {
|
"extra": {
|
||||||
"eas": {
|
"eas": {
|
||||||
|
|||||||
@@ -2,8 +2,11 @@ import { Chat, Message } from "@/src/schema";
|
|||||||
import { useNavigation } from "@react-navigation/native";
|
import { useNavigation } from "@react-navigation/native";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
import * as Clipboard from "expo-clipboard";
|
import * as Clipboard from "expo-clipboard";
|
||||||
|
import * as ImagePicker from "expo-image-picker";
|
||||||
import { useLocalSearchParams } from "expo-router";
|
import { useLocalSearchParams } from "expo-router";
|
||||||
import { useAccount, useCoState } from "jazz-react-native";
|
import { useAccount, useCoState } from "jazz-react-native";
|
||||||
|
import { ProgressiveImg } from "jazz-react-native";
|
||||||
|
import { createImage } from "jazz-react-native-media-images";
|
||||||
import { Group, ID } from "jazz-tools";
|
import { Group, ID } from "jazz-tools";
|
||||||
import { useEffect, useLayoutEffect, useState } from "react";
|
import { useEffect, useLayoutEffect, useState } from "react";
|
||||||
import React, {
|
import React, {
|
||||||
@@ -16,6 +19,8 @@ import React, {
|
|||||||
KeyboardAvoidingView,
|
KeyboardAvoidingView,
|
||||||
TextInput,
|
TextInput,
|
||||||
Button,
|
Button,
|
||||||
|
Image,
|
||||||
|
ActivityIndicator,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
|
|
||||||
export default function Conversation() {
|
export default function Conversation() {
|
||||||
@@ -25,6 +30,7 @@ export default function Conversation() {
|
|||||||
const [message, setMessage] = useState("");
|
const [message, setMessage] = useState("");
|
||||||
const loadedChat = useCoState(Chat, chat?.id, [{}]);
|
const loadedChat = useCoState(Chat, chat?.id, [{}]);
|
||||||
const navigation = useNavigation();
|
const navigation = useNavigation();
|
||||||
|
const [isUploading, setIsUploading] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (chat) return;
|
if (chat) return;
|
||||||
@@ -81,6 +87,32 @@ export default function Conversation() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleImageUpload = async () => {
|
||||||
|
try {
|
||||||
|
const result = await ImagePicker.launchImageLibraryAsync({
|
||||||
|
mediaTypes: ImagePicker.MediaTypeOptions.Images,
|
||||||
|
base64: true,
|
||||||
|
quality: 0.7,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!result.canceled && result.assets[0].base64 && chat) {
|
||||||
|
setIsUploading(true);
|
||||||
|
const base64Uri = `data:image/jpeg;base64,${result.assets[0].base64}`;
|
||||||
|
|
||||||
|
const image = await createImage(base64Uri, {
|
||||||
|
owner: chat._owner,
|
||||||
|
maxSize: 2048,
|
||||||
|
});
|
||||||
|
|
||||||
|
chat.push(Message.create({ text: "", image }, { owner: chat._owner }));
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
Alert.alert("Error", "Failed to upload image");
|
||||||
|
} finally {
|
||||||
|
setIsUploading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const renderMessageItem = ({ item }: { item: Message }) => {
|
const renderMessageItem = ({ item }: { item: Message }) => {
|
||||||
const isMe = item._edits.text.by?.isMe;
|
const isMe = item._edits.text.by?.isMe;
|
||||||
return (
|
return (
|
||||||
@@ -106,14 +138,27 @@ export default function Conversation() {
|
|||||||
isMe ? "flex-row" : "flex-row",
|
isMe ? "flex-row" : "flex-row",
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Text
|
{item.image && (
|
||||||
className={clsx(
|
<ProgressiveImg image={item.image} maxWidth={1024}>
|
||||||
!isMe ? "text-black" : "text-gray-200",
|
{({ src, res, originalSize }) => (
|
||||||
`text-md max-w-[85%]`,
|
<Image
|
||||||
)}
|
source={{ uri: src }}
|
||||||
>
|
className="w-48 h-48 rounded-lg mb-2"
|
||||||
{item.text}
|
resizeMode="cover"
|
||||||
</Text>
|
/>
|
||||||
|
)}
|
||||||
|
</ProgressiveImg>
|
||||||
|
)}
|
||||||
|
{item.text && (
|
||||||
|
<Text
|
||||||
|
className={clsx(
|
||||||
|
!isMe ? "text-black" : "text-gray-200",
|
||||||
|
`text-md max-w-[85%]`,
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{item.text}
|
||||||
|
</Text>
|
||||||
|
)}
|
||||||
<Text
|
<Text
|
||||||
className={clsx(
|
className={clsx(
|
||||||
"text-[10px] text-right ml-2",
|
"text-[10px] text-right ml-2",
|
||||||
@@ -147,6 +192,17 @@ export default function Conversation() {
|
|||||||
className="p-3 bg-white border-t border-gray-300"
|
className="p-3 bg-white border-t border-gray-300"
|
||||||
>
|
>
|
||||||
<SafeAreaView className="flex-row items-center gap-2">
|
<SafeAreaView className="flex-row items-center gap-2">
|
||||||
|
<TouchableOpacity
|
||||||
|
onPress={handleImageUpload}
|
||||||
|
disabled={isUploading}
|
||||||
|
className="h-10 w-10 items-center justify-center"
|
||||||
|
>
|
||||||
|
{isUploading ? (
|
||||||
|
<ActivityIndicator size="small" color="#0000ff" />
|
||||||
|
) : (
|
||||||
|
<Text className="text-2xl">🖼️</Text>
|
||||||
|
)}
|
||||||
|
</TouchableOpacity>
|
||||||
<TextInput
|
<TextInput
|
||||||
className="flex-1 rounded-full h-10 px-4 bg-gray-100 border border-gray-300 focus:border-blue-500 focus:bg-white"
|
className="flex-1 rounded-full h-10 px-4 bg-gray-100 border border-gray-300 focus:border-blue-500 focus:bg-white"
|
||||||
value={message}
|
value={message}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "chat-rn-clerk",
|
"name": "chat-rn-clerk",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"version": "1.0.49",
|
"version": "1.0.52",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "expo export -p ios",
|
"build": "expo export -p ios",
|
||||||
"start": "expo start",
|
"start": "expo start",
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
"expo-dev-client": "~5.0.5",
|
"expo-dev-client": "~5.0.5",
|
||||||
"expo-file-system": "^18.0.4",
|
"expo-file-system": "^18.0.4",
|
||||||
"expo-font": "~13.0.1",
|
"expo-font": "~13.0.1",
|
||||||
|
"expo-image-picker": "~16.0.4",
|
||||||
"expo-linking": "~7.0.3",
|
"expo-linking": "~7.0.3",
|
||||||
"expo-router": "~4.0.11",
|
"expo-router": "~4.0.11",
|
||||||
"expo-secure-store": "~14.0.0",
|
"expo-secure-store": "~14.0.0",
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { CoList, CoMap, co } from "jazz-tools";
|
import { CoList, CoMap, ImageDefinition, co } from "jazz-tools";
|
||||||
|
|
||||||
export class Message extends CoMap {
|
export class Message extends CoMap {
|
||||||
text = co.string;
|
text = co.string;
|
||||||
|
image = co.optional.ref(ImageDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Chat extends CoList.Of(co.ref(Message)) {}
|
export class Chat extends CoList.Of(co.ref(Message)) {}
|
||||||
|
|||||||
@@ -1,5 +1,29 @@
|
|||||||
# chat-rn
|
# chat-rn
|
||||||
|
|
||||||
|
## 1.0.49
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react-native@0.9.11
|
||||||
|
- jazz-tools@0.9.11
|
||||||
|
|
||||||
|
## 1.0.48
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [f76274c]
|
||||||
|
- Updated dependencies [5e83864]
|
||||||
|
- jazz-react-native@0.9.10
|
||||||
|
- jazz-tools@0.9.10
|
||||||
|
|
||||||
|
## 1.0.47
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- jazz-tools@0.9.9
|
||||||
|
- jazz-react-native@0.9.9
|
||||||
|
|
||||||
## 1.0.46
|
## 1.0.46
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "chat-rn",
|
"name": "chat-rn",
|
||||||
"version": "1.0.46",
|
"version": "1.0.49",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "expo export -p ios",
|
"build": "expo export -p ios",
|
||||||
|
|||||||
@@ -1,5 +1,31 @@
|
|||||||
# chat-vue
|
# chat-vue
|
||||||
|
|
||||||
|
## 0.0.36
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser@0.9.11
|
||||||
|
- jazz-tools@0.9.11
|
||||||
|
- jazz-vue@0.9.11
|
||||||
|
|
||||||
|
## 0.0.35
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [5e83864]
|
||||||
|
- jazz-tools@0.9.10
|
||||||
|
- jazz-browser@0.9.10
|
||||||
|
- jazz-vue@0.9.10
|
||||||
|
|
||||||
|
## 0.0.34
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- jazz-tools@0.9.9
|
||||||
|
- jazz-browser@0.9.9
|
||||||
|
- jazz-vue@0.9.9
|
||||||
|
|
||||||
## 0.0.33
|
## 0.0.33
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,29 +1,59 @@
|
|||||||
# Chat example with Jazz and Vue
|
# Chat example with Jazz and Vue
|
||||||
|
|
||||||
## Installing & running the example locally
|
## Getting started
|
||||||
|
|
||||||
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
|
You can either
|
||||||
|
1. Clone the jazz repository, and run the app within the monorepo.
|
||||||
|
2. Or create a new Jazz project using this example as a template.
|
||||||
|
|
||||||
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
|
|
||||||
|
### Using the example as a template
|
||||||
|
|
||||||
|
Create a new Jazz project, and use this example as a template.
|
||||||
```bash
|
```bash
|
||||||
npx degit gardencmp/jazz jazz
|
npm create jazz-app@latest --example chat-vue --project-name chat-vue
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```bash
|
||||||
|
npx create-jazz-app@latest --example chat-vue --project-name chat-vue
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to the todo-vue example directory:
|
Go to the new project directory.
|
||||||
```bash
|
```bash
|
||||||
cd jazz/examples/chat-vue
|
cd chat-vue
|
||||||
```
|
```
|
||||||
|
|
||||||
Install and build dependencies:
|
Run the dev server.
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using the monorepo
|
||||||
|
|
||||||
|
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
|
||||||
|
|
||||||
|
Clone the jazz repository.
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/garden-co/jazz.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Install and build dependencies.
|
||||||
```bash
|
```bash
|
||||||
pnpm i && npx turbo build
|
pnpm i && npx turbo build
|
||||||
```
|
```
|
||||||
|
|
||||||
Start the dev server:
|
Go to the example directory.
|
||||||
|
```bash
|
||||||
|
cd jazz/examples/chat-vue/
|
||||||
|
```
|
||||||
|
|
||||||
|
Start the dev server.
|
||||||
```bash
|
```bash
|
||||||
pnpm dev
|
pnpm dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
|
||||||
|
|
||||||
## Questions / problems / feedback
|
## Questions / problems / feedback
|
||||||
|
|
||||||
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "chat-vue",
|
"name": "chat-vue",
|
||||||
"version": "0.0.33",
|
"version": "0.0.36",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,5 +1,32 @@
|
|||||||
# jazz-example-chat
|
# jazz-example-chat
|
||||||
|
|
||||||
|
## 0.0.132
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.9.11
|
||||||
|
- jazz-tools@0.9.11
|
||||||
|
- jazz-browser-media-images@0.9.11
|
||||||
|
|
||||||
|
## 0.0.131
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- f76274c: Fix image handling in react-native
|
||||||
|
- Updated dependencies [5e83864]
|
||||||
|
- jazz-react@0.9.10
|
||||||
|
- jazz-tools@0.9.10
|
||||||
|
- jazz-browser-media-images@0.9.10
|
||||||
|
|
||||||
|
## 0.0.130
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- jazz-tools@0.9.9
|
||||||
|
- jazz-browser-media-images@0.9.9
|
||||||
|
- jazz-react@0.9.9
|
||||||
|
|
||||||
## 0.0.129
|
## 0.0.129
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -2,30 +2,60 @@
|
|||||||
|
|
||||||
Live version: [https://chat.jazz.tools](https://chat.jazz.tools)
|
Live version: [https://chat.jazz.tools](https://chat.jazz.tools)
|
||||||
|
|
||||||
## Installing & running the example locally
|
## Getting started
|
||||||
|
|
||||||
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
|
You can either
|
||||||
|
1. Clone the jazz repository, and run the app within the monorepo.
|
||||||
|
2. Or create a new Jazz project using this example as a template.
|
||||||
|
|
||||||
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
|
|
||||||
|
### Using the example as a template
|
||||||
|
|
||||||
|
Create a new Jazz project, and use this example as a template.
|
||||||
```bash
|
```bash
|
||||||
npx degit gardencmp/jazz jazz
|
npm create jazz-app@latest --example chat --project-name chat
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```bash
|
||||||
|
npx create-jazz-app@latest --example chat --project-name chat
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to the chat example directory:
|
Go to the new project directory.
|
||||||
```bash
|
```bash
|
||||||
cd jazz/examples/chat
|
cd chat
|
||||||
```
|
```
|
||||||
|
|
||||||
Install and build dependencies:
|
Run the dev server.
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using the monorepo
|
||||||
|
|
||||||
|
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
|
||||||
|
|
||||||
|
Clone the jazz repository.
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/garden-co/jazz.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Install and build dependencies.
|
||||||
```bash
|
```bash
|
||||||
pnpm i && npx turbo build
|
pnpm i && npx turbo build
|
||||||
```
|
```
|
||||||
|
|
||||||
Start the dev server:
|
Go to the example directory.
|
||||||
|
```bash
|
||||||
|
cd jazz/examples/chat/
|
||||||
|
```
|
||||||
|
|
||||||
|
Start the dev server.
|
||||||
```bash
|
```bash
|
||||||
pnpm dev
|
pnpm dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
|
||||||
|
|
||||||
## Questions / problems / feedback
|
## Questions / problems / feedback
|
||||||
|
|
||||||
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jazz-example-chat",
|
"name": "jazz-example-chat",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.129",
|
"version": "0.0.132",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export function ChatScreen(props: { chatID: ID<Chat> }) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
createImage(file).then((image) => {
|
createImage(file, { owner: chat._owner }).then((image) => {
|
||||||
chat.push(Message.create({ text: file.name, image: image }, chat._owner));
|
chat.push(Message.create({ text: file.name, image: image }, chat._owner));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,31 @@
|
|||||||
# minimal-auth-clerk
|
# minimal-auth-clerk
|
||||||
|
|
||||||
|
## 0.0.31
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.9.11
|
||||||
|
- jazz-react-auth-clerk@0.9.11
|
||||||
|
- jazz-tools@0.9.11
|
||||||
|
|
||||||
|
## 0.0.30
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [5e83864]
|
||||||
|
- jazz-react@0.9.10
|
||||||
|
- jazz-tools@0.9.10
|
||||||
|
- jazz-react-auth-clerk@0.9.10
|
||||||
|
|
||||||
|
## 0.0.29
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- jazz-tools@0.9.9
|
||||||
|
- jazz-react@0.9.9
|
||||||
|
- jazz-react-auth-clerk@0.9.9
|
||||||
|
|
||||||
## 0.0.28
|
## 0.0.28
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -4,30 +4,60 @@ This is an example of how to use clerk authentication with Jazz.
|
|||||||
|
|
||||||
Live version: https://clerk-demo.jazz.tools
|
Live version: https://clerk-demo.jazz.tools
|
||||||
|
|
||||||
## Installing & running the example locally
|
## Getting started
|
||||||
|
|
||||||
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
|
You can either
|
||||||
|
1. Clone the jazz repository, and run the app within the monorepo.
|
||||||
|
2. Or create a new Jazz project using this example as a template.
|
||||||
|
|
||||||
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
|
|
||||||
|
### Using the example as a template
|
||||||
|
|
||||||
|
Create a new Jazz project, and use this example as a template.
|
||||||
```bash
|
```bash
|
||||||
npx degit gardencmp/jazz jazz
|
npm create jazz-app@latest --start clerk --project-name clerk
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```bash
|
||||||
|
npx create-jazz-app@latest --start clerk --project-name clerk
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to the clerk example directory:
|
Go to the new project directory.
|
||||||
```bash
|
```bash
|
||||||
cd jazz/examples/clerk
|
cd clerk
|
||||||
```
|
```
|
||||||
|
|
||||||
Install and build dependencies:
|
Run the dev server.
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using the monorepo
|
||||||
|
|
||||||
|
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
|
||||||
|
|
||||||
|
Clone the jazz repository.
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/garden-co/jazz.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Install and build dependencies.
|
||||||
```bash
|
```bash
|
||||||
pnpm i && npx turbo build
|
pnpm i && npx turbo build
|
||||||
```
|
```
|
||||||
|
|
||||||
Start the dev server:
|
Go to the example directory.
|
||||||
|
```bash
|
||||||
|
cd jazz/examples/clerk/
|
||||||
|
```
|
||||||
|
|
||||||
|
Start the dev server.
|
||||||
```bash
|
```bash
|
||||||
pnpm dev
|
pnpm dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
|
||||||
|
|
||||||
## Questions / problems / feedback
|
## Questions / problems / feedback
|
||||||
|
|
||||||
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "clerk",
|
"name": "clerk",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.28",
|
"version": "0.0.31",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@clerk/clerk-react": "^5.4.1",
|
"@clerk/clerk-react": "^5.4.1",
|
||||||
"jazz-react": "workspace:*",
|
"jazz-react": "workspace:*",
|
||||||
"jazz-react-auth-clerk": "workspace:0.9.8",
|
"jazz-react-auth-clerk": "workspace:0.9.11",
|
||||||
"jazz-tools": "workspace:*",
|
"jazz-tools": "workspace:*",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1"
|
"react-dom": "^18.3.1"
|
||||||
|
|||||||
@@ -1,5 +1,28 @@
|
|||||||
# file-share-svelte
|
# file-share-svelte
|
||||||
|
|
||||||
|
## 0.0.16
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-svelte@0.9.11
|
||||||
|
- jazz-tools@0.9.11
|
||||||
|
|
||||||
|
## 0.0.15
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [5e83864]
|
||||||
|
- jazz-tools@0.9.10
|
||||||
|
- jazz-svelte@0.9.10
|
||||||
|
|
||||||
|
## 0.0.14
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- jazz-tools@0.9.9
|
||||||
|
- jazz-svelte@0.9.9
|
||||||
|
|
||||||
## 0.0.13
|
## 0.0.13
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "file-share-svelte",
|
"name": "file-share-svelte",
|
||||||
"version": "0.0.13",
|
"version": "0.0.16",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,5 +1,31 @@
|
|||||||
# form
|
# form
|
||||||
|
|
||||||
|
## 0.0.27
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.9.11
|
||||||
|
- jazz-tools@0.9.11
|
||||||
|
- jazz-browser-media-images@0.9.11
|
||||||
|
|
||||||
|
## 0.0.26
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [5e83864]
|
||||||
|
- jazz-react@0.9.10
|
||||||
|
- jazz-tools@0.9.10
|
||||||
|
- jazz-browser-media-images@0.9.10
|
||||||
|
|
||||||
|
## 0.0.25
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- jazz-tools@0.9.9
|
||||||
|
- jazz-browser-media-images@0.9.9
|
||||||
|
- jazz-react@0.9.9
|
||||||
|
|
||||||
## 0.0.24
|
## 0.0.24
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -17,30 +17,60 @@ converting it into a `BubbleTeaOrder`.
|
|||||||
|
|
||||||
[See the full guide here.](https://jazz.tools/docs/react/design-patterns/form)
|
[See the full guide here.](https://jazz.tools/docs/react/design-patterns/form)
|
||||||
|
|
||||||
## Installing & running the example locally
|
## Getting started
|
||||||
|
|
||||||
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
|
You can either
|
||||||
|
1. Clone the jazz repository, and run the app within the monorepo.
|
||||||
|
2. Or create a new Jazz project using this example as a template.
|
||||||
|
|
||||||
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
|
|
||||||
|
### Using the example as a template
|
||||||
|
|
||||||
|
Create a new Jazz project, and use this example as a template.
|
||||||
```bash
|
```bash
|
||||||
npx degit gardencmp/jazz jazz
|
npm create jazz-app@latest --start form --project-name form
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```bash
|
||||||
|
npx create-jazz-app@latest --start form --project-name form
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to the form example directory:
|
Go to the new project directory.
|
||||||
```bash
|
```bash
|
||||||
cd jazz/examples/form
|
cd form
|
||||||
```
|
```
|
||||||
|
|
||||||
Install and build dependencies:
|
Run the dev server.
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using the monorepo
|
||||||
|
|
||||||
|
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
|
||||||
|
|
||||||
|
Clone the jazz repository.
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/garden-co/jazz.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Install and build dependencies.
|
||||||
```bash
|
```bash
|
||||||
pnpm i && npx turbo build
|
pnpm i && npx turbo build
|
||||||
```
|
```
|
||||||
|
|
||||||
Start the dev server:
|
Go to the example directory.
|
||||||
|
```bash
|
||||||
|
cd jazz/examples/form/
|
||||||
|
```
|
||||||
|
|
||||||
|
Start the dev server.
|
||||||
```bash
|
```bash
|
||||||
pnpm dev
|
pnpm dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
|
||||||
|
|
||||||
## Questions / problems / feedback
|
## Questions / problems / feedback
|
||||||
|
|
||||||
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "form",
|
"name": "form",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.24",
|
"version": "0.0.27",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -1,5 +1,31 @@
|
|||||||
# image-upload
|
# image-upload
|
||||||
|
|
||||||
|
## 0.0.29
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.9.11
|
||||||
|
- jazz-tools@0.9.11
|
||||||
|
- jazz-browser-media-images@0.9.11
|
||||||
|
|
||||||
|
## 0.0.28
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [5e83864]
|
||||||
|
- jazz-react@0.9.10
|
||||||
|
- jazz-tools@0.9.10
|
||||||
|
- jazz-browser-media-images@0.9.10
|
||||||
|
|
||||||
|
## 0.0.27
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- jazz-tools@0.9.9
|
||||||
|
- jazz-browser-media-images@0.9.9
|
||||||
|
- jazz-react@0.9.9
|
||||||
|
|
||||||
## 0.0.26
|
## 0.0.26
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -4,30 +4,60 @@ This is an example of how to upload and render images with Jazz.
|
|||||||
|
|
||||||
Live version: https://image-upload-demo.jazz.tools
|
Live version: https://image-upload-demo.jazz.tools
|
||||||
|
|
||||||
## Installing & running the example locally
|
## Getting started
|
||||||
|
|
||||||
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
|
You can either
|
||||||
|
1. Clone the jazz repository, and run the app within the monorepo.
|
||||||
|
2. Or create a new Jazz project using this example as a template.
|
||||||
|
|
||||||
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
|
|
||||||
|
### Using the example as a template
|
||||||
|
|
||||||
|
Create a new Jazz project, and use this example as a template.
|
||||||
```bash
|
```bash
|
||||||
npx degit gardencmp/jazz jazz
|
npm create jazz-app@latest --example image-upload --project-name image-upload
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```bash
|
||||||
|
npx create-jazz-app@latest --example image-upload --project-name image-upload
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to the image-upload example directory:
|
Go to the new project directory.
|
||||||
```bash
|
```bash
|
||||||
cd jazz/examples/image-upload
|
cd image-upload
|
||||||
```
|
```
|
||||||
|
|
||||||
Install and build dependencies:
|
Run the dev server.
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using the monorepo
|
||||||
|
|
||||||
|
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
|
||||||
|
|
||||||
|
Clone the jazz repository.
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/garden-co/jazz.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Install and build dependencies.
|
||||||
```bash
|
```bash
|
||||||
pnpm i && npx turbo build
|
pnpm i && npx turbo build
|
||||||
```
|
```
|
||||||
|
|
||||||
Start the dev server:
|
Go to the example directory.
|
||||||
|
```bash
|
||||||
|
cd jazz/examples/image-upload/
|
||||||
|
```
|
||||||
|
|
||||||
|
Start the dev server.
|
||||||
```bash
|
```bash
|
||||||
pnpm dev
|
pnpm dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
|
||||||
|
|
||||||
## Questions / problems / feedback
|
## Questions / problems / feedback
|
||||||
|
|
||||||
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "image-upload",
|
"name": "image-upload",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.26",
|
"version": "0.0.29",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -1,5 +1,30 @@
|
|||||||
# jazz-example-inspector
|
# jazz-example-inspector
|
||||||
|
|
||||||
|
## 0.0.96
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [efbf3d8]
|
||||||
|
- Updated dependencies [5863bad]
|
||||||
|
- cojson@0.9.11
|
||||||
|
- cojson-transport-ws@0.9.11
|
||||||
|
|
||||||
|
## 0.0.95
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [4aa377d]
|
||||||
|
- cojson@0.9.10
|
||||||
|
- cojson-transport-ws@0.9.10
|
||||||
|
|
||||||
|
## 0.0.94
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- cojson@0.9.9
|
||||||
|
- cojson-transport-ws@0.9.9
|
||||||
|
|
||||||
## 0.0.93
|
## 0.0.93
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jazz-inspector",
|
"name": "jazz-inspector-app",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.93",
|
"version": "0.0.96",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -16,8 +16,8 @@
|
|||||||
"@radix-ui/react-toast": "^1.1.4",
|
"@radix-ui/react-toast": "^1.1.4",
|
||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
"clsx": "^2.0.0",
|
"clsx": "^2.0.0",
|
||||||
"cojson": "workspace:0.9.0",
|
"cojson": "workspace:0.9.11",
|
||||||
"cojson-transport-ws": "workspace:0.9.0",
|
"cojson-transport-ws": "workspace:0.9.11",
|
||||||
"hash-slash": "workspace:0.2.1",
|
"hash-slash": "workspace:0.2.1",
|
||||||
"lucide-react": "^0.274.0",
|
"lucide-react": "^0.274.0",
|
||||||
"qrcode": "^1.5.3",
|
"qrcode": "^1.5.3",
|
||||||
|
|||||||
@@ -1,5 +1,29 @@
|
|||||||
# jazz-example-musicplayer
|
# jazz-example-musicplayer
|
||||||
|
|
||||||
|
## 0.0.52
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-inspector@0.9.11
|
||||||
|
- jazz-react@0.9.11
|
||||||
|
- jazz-tools@0.9.11
|
||||||
|
|
||||||
|
## 0.0.51
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [5e83864]
|
||||||
|
- jazz-react@0.9.10
|
||||||
|
- jazz-tools@0.9.10
|
||||||
|
|
||||||
|
## 0.0.50
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- jazz-tools@0.9.9
|
||||||
|
- jazz-react@0.9.9
|
||||||
|
|
||||||
## 0.0.49
|
## 0.0.49
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -2,30 +2,60 @@
|
|||||||
|
|
||||||
Live version: https://music-demo.jazz.tools
|
Live version: https://music-demo.jazz.tools
|
||||||
|
|
||||||
## Installing & running the example locally
|
## Getting started
|
||||||
|
|
||||||
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
|
You can either
|
||||||
|
1. Clone the jazz repository, and run the app within the monorepo.
|
||||||
|
2. Or create a new Jazz project using this example as a template.
|
||||||
|
|
||||||
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
|
|
||||||
|
### Using the example as a template
|
||||||
|
|
||||||
|
Create a new Jazz project, and use this example as a template.
|
||||||
```bash
|
```bash
|
||||||
npx degit gardencmp/jazz jazz
|
npm create jazz-app@latest --example music-player --project-name music-player
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```bash
|
||||||
|
npx create-jazz-app@latest --example music-player --project-name music-player
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to the music-player example directory:
|
Go to the new project directory.
|
||||||
```bash
|
```bash
|
||||||
cd jazz/examples/music-player
|
cd music-player
|
||||||
```
|
```
|
||||||
|
|
||||||
Install and build dependencies:
|
Run the dev server.
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using the monorepo
|
||||||
|
|
||||||
|
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
|
||||||
|
|
||||||
|
Clone the jazz repository.
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/garden-co/jazz.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Install and build dependencies.
|
||||||
```bash
|
```bash
|
||||||
pnpm i && npx turbo build
|
pnpm i && npx turbo build
|
||||||
```
|
```
|
||||||
|
|
||||||
Start the dev server:
|
Go to the example directory.
|
||||||
|
```bash
|
||||||
|
cd jazz/examples/music-player/
|
||||||
|
```
|
||||||
|
|
||||||
|
Start the dev server.
|
||||||
```bash
|
```bash
|
||||||
pnpm dev
|
pnpm dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
|
||||||
|
|
||||||
## Questions / problems / feedback
|
## Questions / problems / feedback
|
||||||
|
|
||||||
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jazz-example-music-player",
|
"name": "jazz-example-music-player",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.49",
|
"version": "0.0.52",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -18,8 +18,9 @@
|
|||||||
"@radix-ui/react-toast": "^1.1.4",
|
"@radix-ui/react-toast": "^1.1.4",
|
||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
"clsx": "^2.0.0",
|
"clsx": "^2.0.0",
|
||||||
"jazz-react": "workspace:0.9.8",
|
"jazz-react": "workspace:0.9.11",
|
||||||
"jazz-tools": "workspace:0.9.8",
|
"jazz-tools": "workspace:0.9.11",
|
||||||
|
"jazz-inspector": "workspace:*",
|
||||||
"lucide-react": "^0.274.0",
|
"lucide-react": "^0.274.0",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { Toaster } from "@/components/ui/toaster";
|
import { Toaster } from "@/components/ui/toaster";
|
||||||
|
import { JazzInspector } from "jazz-inspector";
|
||||||
/* eslint-disable react-refresh/only-export-components */
|
/* eslint-disable react-refresh/only-export-components */
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import ReactDOM from "react-dom/client";
|
import ReactDOM from "react-dom/client";
|
||||||
@@ -71,6 +72,7 @@ function JazzAndAuth({ children }: { children: React.ReactNode }) {
|
|||||||
AccountSchema={MusicaAccount}
|
AccountSchema={MusicaAccount}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
<JazzInspector />
|
||||||
</JazzProvider>
|
</JazzProvider>
|
||||||
<DemoAuthBasicUI appName="Jazz Music Player" state={state} />
|
<DemoAuthBasicUI appName="Jazz Music Player" state={state} />
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,5 +1,31 @@
|
|||||||
# jazz-example-onboarding
|
# jazz-example-onboarding
|
||||||
|
|
||||||
|
## 0.0.33
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.9.11
|
||||||
|
- jazz-tools@0.9.11
|
||||||
|
- jazz-browser-media-images@0.9.11
|
||||||
|
|
||||||
|
## 0.0.32
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [5e83864]
|
||||||
|
- jazz-react@0.9.10
|
||||||
|
- jazz-tools@0.9.10
|
||||||
|
- jazz-browser-media-images@0.9.10
|
||||||
|
|
||||||
|
## 0.0.31
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- jazz-tools@0.9.9
|
||||||
|
- jazz-browser-media-images@0.9.9
|
||||||
|
- jazz-react@0.9.9
|
||||||
|
|
||||||
## 0.0.30
|
## 0.0.30
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,29 +1,58 @@
|
|||||||
# Onboarding example with Jazz and React
|
# Onboarding example with Jazz and React
|
||||||
|
|
||||||
## Installing & running the example locally
|
## Getting started
|
||||||
|
|
||||||
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
|
You can either
|
||||||
|
1. Clone the jazz repository, and run the app within the monorepo.
|
||||||
|
2. Or create a new Jazz project using this example as a template.
|
||||||
|
|
||||||
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
|
|
||||||
|
### Using the example as a template
|
||||||
|
|
||||||
|
Create a new Jazz project, and use this example as a template.
|
||||||
```bash
|
```bash
|
||||||
npx degit gardencmp/jazz jazz
|
npm create jazz-app@latest --example onboarding --project-name onboarding
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```bash
|
||||||
|
npx create-jazz-app@latest --example onboarding --project-name onboarding
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to the onboarding example directory:
|
Go to the new project directory.
|
||||||
```bash
|
```bash
|
||||||
cd jazz/examples/onboarding
|
cd onboarding
|
||||||
```
|
```
|
||||||
|
|
||||||
Install and build dependencies:
|
Run the dev server.
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using the monorepo
|
||||||
|
|
||||||
|
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
|
||||||
|
|
||||||
|
Clone the jazz repository.
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/garden-co/jazz.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Install and build dependencies.
|
||||||
```bash
|
```bash
|
||||||
pnpm i && npx turbo build
|
pnpm i && npx turbo build
|
||||||
```
|
```
|
||||||
|
|
||||||
Start the dev server:
|
Go to the example directory.
|
||||||
|
```bash
|
||||||
|
cd jazz/examples/onboarding/
|
||||||
|
```
|
||||||
|
|
||||||
|
Start the dev server.
|
||||||
```bash
|
```bash
|
||||||
pnpm dev
|
pnpm dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
|
||||||
## Questions / problems / feedback
|
## Questions / problems / feedback
|
||||||
|
|
||||||
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jazz-example-onboarding",
|
"name": "jazz-example-onboarding",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.30",
|
"version": "0.0.33",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -1,5 +1,28 @@
|
|||||||
# organization
|
# organization
|
||||||
|
|
||||||
|
## 0.0.25
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.9.11
|
||||||
|
- jazz-tools@0.9.11
|
||||||
|
|
||||||
|
## 0.0.24
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [5e83864]
|
||||||
|
- jazz-react@0.9.10
|
||||||
|
- jazz-tools@0.9.10
|
||||||
|
|
||||||
|
## 0.0.23
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- jazz-tools@0.9.9
|
||||||
|
- jazz-react@0.9.9
|
||||||
|
|
||||||
## 0.0.22
|
## 0.0.22
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -5,30 +5,60 @@ Different apps have different names for this concept, such as "teams" or "worksp
|
|||||||
|
|
||||||
Refer to the [documentation](https://jazz.tools/docs/react/design-patterns/organization) for more information.
|
Refer to the [documentation](https://jazz.tools/docs/react/design-patterns/organization) for more information.
|
||||||
|
|
||||||
## Installing & running the example locally
|
## Getting started
|
||||||
|
|
||||||
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
|
You can either
|
||||||
|
1. Clone the jazz repository, and run the app within the monorepo.
|
||||||
|
2. Or create a new Jazz project using this example as a template.
|
||||||
|
|
||||||
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
|
|
||||||
|
### Using the example as a template
|
||||||
|
|
||||||
|
Create a new Jazz project, and use this example as a template.
|
||||||
```bash
|
```bash
|
||||||
npx degit gardencmp/jazz jazz
|
npm create jazz-app@latest --example organization --project-name organization
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```bash
|
||||||
|
npx create-jazz-app@latest --example organization --project-name organization
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to the organization example directory:
|
Go to the new project directory.
|
||||||
```bash
|
```bash
|
||||||
cd jazz/examples/organization
|
cd organization
|
||||||
```
|
```
|
||||||
|
|
||||||
Install and build dependencies:
|
Run the dev server.
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using the monorepo
|
||||||
|
|
||||||
|
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
|
||||||
|
|
||||||
|
Clone the jazz repository.
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/garden-co/jazz.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Install and build dependencies.
|
||||||
```bash
|
```bash
|
||||||
pnpm i && npx turbo build
|
pnpm i && npx turbo build
|
||||||
```
|
```
|
||||||
|
|
||||||
Start the dev server:
|
Go to the example directory.
|
||||||
|
```bash
|
||||||
|
cd jazz/examples/organization/
|
||||||
|
```
|
||||||
|
|
||||||
|
Start the dev server.
|
||||||
```bash
|
```bash
|
||||||
pnpm dev
|
pnpm dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
|
||||||
|
|
||||||
## Questions / problems / feedback
|
## Questions / problems / feedback
|
||||||
|
|
||||||
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "organization",
|
"name": "organization",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.22",
|
"version": "0.0.25",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -1,5 +1,23 @@
|
|||||||
# passkey-svelte
|
# passkey-svelte
|
||||||
|
|
||||||
|
## 0.0.20
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-svelte@0.9.11
|
||||||
|
|
||||||
|
## 0.0.19
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-svelte@0.9.10
|
||||||
|
|
||||||
|
## 0.0.18
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-svelte@0.9.9
|
||||||
|
|
||||||
## 0.0.17
|
## 0.0.17
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -10,34 +10,59 @@ This example showcases how to:
|
|||||||
- Manage authentication state
|
- Manage authentication state
|
||||||
- Implement secure login/logout flows
|
- Implement secure login/logout flows
|
||||||
|
|
||||||
## Getting Started
|
## Getting started
|
||||||
|
|
||||||
1. Clone the repository:
|
You can either
|
||||||
|
1. Clone the jazz repository, and run the app within the monorepo.
|
||||||
|
2. Or create a new Jazz project using this example as a template.
|
||||||
|
|
||||||
```sh
|
|
||||||
|
### Using the example as a template
|
||||||
|
|
||||||
|
Create a new Jazz project, and use this example as a template.
|
||||||
|
```bash
|
||||||
|
npm create jazz-app@latest --example passkey-svelte --project-name passkey-svelte
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```bash
|
||||||
|
npx create-jazz-app@latest --example passkey-svelte --project-name passkey-svelte
|
||||||
|
```
|
||||||
|
|
||||||
|
Go to the new project directory.
|
||||||
|
```bash
|
||||||
|
cd passkey-svelte
|
||||||
|
```
|
||||||
|
|
||||||
|
Run the dev server.
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using the monorepo
|
||||||
|
|
||||||
|
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
|
||||||
|
|
||||||
|
Clone the jazz repository.
|
||||||
|
```bash
|
||||||
git clone https://github.com/garden-co/jazz.git
|
git clone https://github.com/garden-co/jazz.git
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Navigate to the example directory:
|
Install and build dependencies.
|
||||||
|
```bash
|
||||||
```sh
|
pnpm i && npx turbo build
|
||||||
cd examples/passkey-svelte
|
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Install dependencies:
|
Go to the example directory.
|
||||||
|
```bash
|
||||||
```sh
|
cd jazz/examples/passkey-svelte/
|
||||||
pnpm install
|
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Start the development server:
|
Start the dev server.
|
||||||
|
```bash
|
||||||
```sh
|
|
||||||
pnpm dev
|
pnpm dev
|
||||||
```
|
```
|
||||||
|
|
||||||
5. Open your browser and visit [http://localhost:5173](http://localhost:5173)
|
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
|
||||||
|
|
||||||
|
|
||||||
## Learn More
|
## Learn More
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "passkey-svelte",
|
"name": "passkey-svelte",
|
||||||
"version": "0.0.17",
|
"version": "0.0.20",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,5 +1,28 @@
|
|||||||
# minimal-auth-passkey
|
# minimal-auth-passkey
|
||||||
|
|
||||||
|
## 0.0.30
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.9.11
|
||||||
|
- jazz-tools@0.9.11
|
||||||
|
|
||||||
|
## 0.0.29
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [5e83864]
|
||||||
|
- jazz-react@0.9.10
|
||||||
|
- jazz-tools@0.9.10
|
||||||
|
|
||||||
|
## 0.0.28
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- jazz-tools@0.9.9
|
||||||
|
- jazz-react@0.9.9
|
||||||
|
|
||||||
## 0.0.27
|
## 0.0.27
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -4,30 +4,59 @@ This is an example of how to use passkey authentication with Jazz.
|
|||||||
|
|
||||||
Live version: https://passkey-demo.jazz.tools
|
Live version: https://passkey-demo.jazz.tools
|
||||||
|
|
||||||
## Installing & running the example locally
|
## Getting started
|
||||||
|
|
||||||
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
|
You can either
|
||||||
|
1. Clone the jazz repository, and run the app within the monorepo.
|
||||||
|
2. Or create a new Jazz project using this example as a template.
|
||||||
|
|
||||||
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
|
|
||||||
|
### Using the example as a template
|
||||||
|
|
||||||
|
Create a new Jazz project, and use this example as a template.
|
||||||
```bash
|
```bash
|
||||||
npx degit gardencmp/jazz jazz
|
npm create jazz-app@latest --example passkey --project-name passkey
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```bash
|
||||||
|
npx create-jazz-app@latest --example passkey --project-name passkey
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to the passkey example directory:
|
Go to the new project directory.
|
||||||
```bash
|
```bash
|
||||||
cd jazz/examples/passkey
|
cd passkey
|
||||||
```
|
```
|
||||||
|
|
||||||
Install and build dependencies:
|
Run the dev server.
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using the monorepo
|
||||||
|
|
||||||
|
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
|
||||||
|
|
||||||
|
Clone the jazz repository.
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/garden-co/jazz.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Install and build dependencies.
|
||||||
```bash
|
```bash
|
||||||
pnpm i && npx turbo build
|
pnpm i && npx turbo build
|
||||||
```
|
```
|
||||||
|
|
||||||
Start the dev server:
|
Go to the example directory.
|
||||||
|
```bash
|
||||||
|
cd jazz/examples/passkey/
|
||||||
|
```
|
||||||
|
|
||||||
|
Start the dev server.
|
||||||
```bash
|
```bash
|
||||||
pnpm dev
|
pnpm dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
|
||||||
## Questions / problems / feedback
|
## Questions / problems / feedback
|
||||||
|
|
||||||
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "passkey",
|
"name": "passkey",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.27",
|
"version": "0.0.30",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -1,5 +1,28 @@
|
|||||||
# jazz-password-manager
|
# jazz-password-manager
|
||||||
|
|
||||||
|
## 0.0.51
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.9.11
|
||||||
|
- jazz-tools@0.9.11
|
||||||
|
|
||||||
|
## 0.0.50
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [5e83864]
|
||||||
|
- jazz-react@0.9.10
|
||||||
|
- jazz-tools@0.9.10
|
||||||
|
|
||||||
|
## 0.0.49
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- jazz-tools@0.9.9
|
||||||
|
- jazz-react@0.9.9
|
||||||
|
|
||||||
## 0.0.48
|
## 0.0.48
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -4,30 +4,60 @@ Live version: https://passwords-demo.jazz.tools
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Installing & running the example locally
|
## Getting started
|
||||||
|
|
||||||
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
|
You can either
|
||||||
|
1. Clone the jazz repository, and run the app within the monorepo.
|
||||||
|
2. Or create a new Jazz project using this example as a template.
|
||||||
|
|
||||||
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
|
|
||||||
|
### Using the example as a template
|
||||||
|
|
||||||
|
Create a new Jazz project, and use this example as a template.
|
||||||
```bash
|
```bash
|
||||||
npx degit gardencmp/jazz jazz
|
npm create jazz-app@latest --example password-manager --project-name password-manager
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```bash
|
||||||
|
npx create-jazz-app@latest --example password-manager --project-name password-manager
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to the password-manager example directory:
|
Go to the new project directory.
|
||||||
```bash
|
```bash
|
||||||
cd jazz/examples/password-manager
|
cd password-manager
|
||||||
```
|
```
|
||||||
|
|
||||||
Install and build dependencies:
|
Run the dev server.
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using the monorepo
|
||||||
|
|
||||||
|
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
|
||||||
|
|
||||||
|
Clone the jazz repository.
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/garden-co/jazz.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Install and build dependencies.
|
||||||
```bash
|
```bash
|
||||||
pnpm i && npx turbo build
|
pnpm i && npx turbo build
|
||||||
```
|
```
|
||||||
|
|
||||||
Start the dev server:
|
Go to the example directory.
|
||||||
|
```bash
|
||||||
|
cd jazz/examples/password-manager/
|
||||||
|
```
|
||||||
|
|
||||||
|
Start the dev server.
|
||||||
```bash
|
```bash
|
||||||
pnpm dev
|
pnpm dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
|
||||||
|
|
||||||
## Structure
|
## Structure
|
||||||
|
|
||||||
- [`src/components`](./src/components/): UI components
|
- [`src/components`](./src/components/): UI components
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jazz-password-manager",
|
"name": "jazz-password-manager",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.48",
|
"version": "0.0.51",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -12,8 +12,8 @@
|
|||||||
"clean-install": "rm -rf node_modules pnpm-lock.yaml && pnpm install"
|
"clean-install": "rm -rf node_modules pnpm-lock.yaml && pnpm install"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jazz-react": "workspace:0.9.8",
|
"jazz-react": "workspace:0.9.11",
|
||||||
"jazz-tools": "workspace:0.9.8",
|
"jazz-tools": "workspace:0.9.11",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^18.3.1",
|
||||||
"react-hook-form": "^7.41.5",
|
"react-hook-form": "^7.41.5",
|
||||||
|
|||||||
@@ -1,5 +1,31 @@
|
|||||||
# jazz-example-pets
|
# jazz-example-pets
|
||||||
|
|
||||||
|
## 0.0.149
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.9.11
|
||||||
|
- jazz-tools@0.9.11
|
||||||
|
- jazz-browser-media-images@0.9.11
|
||||||
|
|
||||||
|
## 0.0.148
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [5e83864]
|
||||||
|
- jazz-react@0.9.10
|
||||||
|
- jazz-tools@0.9.10
|
||||||
|
- jazz-browser-media-images@0.9.10
|
||||||
|
|
||||||
|
## 0.0.147
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- jazz-tools@0.9.9
|
||||||
|
- jazz-browser-media-images@0.9.9
|
||||||
|
- jazz-react@0.9.9
|
||||||
|
|
||||||
## 0.0.146
|
## 0.0.146
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -2,30 +2,59 @@
|
|||||||
|
|
||||||
Live version: https://pets-demo.jazz.tools/
|
Live version: https://pets-demo.jazz.tools/
|
||||||
|
|
||||||
## Installing & running the example locally
|
## Getting started
|
||||||
|
|
||||||
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
|
You can either
|
||||||
|
1. Clone the jazz repository, and run the app within the monorepo.
|
||||||
|
2. Or create a new Jazz project using this example as a template.
|
||||||
|
|
||||||
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
|
|
||||||
|
### Using the example as a template
|
||||||
|
|
||||||
|
Create a new Jazz project, and use this example as a template.
|
||||||
```bash
|
```bash
|
||||||
npx degit gardencmp/jazz jazz
|
npm create jazz-app@latest --example pets --project-name pets
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```bash
|
||||||
|
npx create-jazz-app@latest --example pets --project-name pets
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to the pets example directory:
|
Go to the new project directory.
|
||||||
```bash
|
```bash
|
||||||
cd jazz/examples/pets
|
cd pets
|
||||||
```
|
```
|
||||||
|
|
||||||
Install and build dependencies:
|
Run the dev server.
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using the monorepo
|
||||||
|
|
||||||
|
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
|
||||||
|
|
||||||
|
Clone the jazz repository.
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/garden-co/jazz.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Install and build dependencies.
|
||||||
```bash
|
```bash
|
||||||
pnpm i && npx turbo build
|
pnpm i && npx turbo build
|
||||||
```
|
```
|
||||||
|
|
||||||
Start the dev server:
|
Go to the example directory.
|
||||||
|
```bash
|
||||||
|
cd jazz/examples/pets/
|
||||||
|
```
|
||||||
|
|
||||||
|
Start the dev server.
|
||||||
```bash
|
```bash
|
||||||
pnpm dev
|
pnpm dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
|
||||||
|
|
||||||
## Questions / problems / feedback
|
## Questions / problems / feedback
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jazz-example-pets",
|
"name": "jazz-example-pets",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.146",
|
"version": "0.0.149",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -19,9 +19,9 @@
|
|||||||
"@radix-ui/react-toast": "^1.1.4",
|
"@radix-ui/react-toast": "^1.1.4",
|
||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
"clsx": "^2.0.0",
|
"clsx": "^2.0.0",
|
||||||
"jazz-browser-media-images": "workspace:0.9.8",
|
"jazz-browser-media-images": "workspace:0.9.11",
|
||||||
"jazz-react": "workspace:0.9.8",
|
"jazz-react": "workspace:0.9.11",
|
||||||
"jazz-tools": "workspace:0.9.8",
|
"jazz-tools": "workspace:0.9.11",
|
||||||
"lucide-react": "^0.274.0",
|
"lucide-react": "^0.274.0",
|
||||||
"qrcode": "^1.5.3",
|
"qrcode": "^1.5.3",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
"@vitejs/plugin-react-swc": "^3.3.2",
|
"@vitejs/plugin-react-swc": "^3.3.2",
|
||||||
"autoprefixer": "^10.4.20",
|
"autoprefixer": "^10.4.20",
|
||||||
"is-ci": "^3.0.1",
|
"is-ci": "^3.0.1",
|
||||||
"jazz-run": "workspace:0.9.8",
|
"jazz-run": "workspace:0.9.11",
|
||||||
"postcss": "^8.4.27",
|
"postcss": "^8.4.27",
|
||||||
"tailwindcss": "^3.4.15",
|
"tailwindcss": "^3.4.15",
|
||||||
"typescript": "~5.6.2",
|
"typescript": "~5.6.2",
|
||||||
|
|||||||
@@ -1,5 +1,31 @@
|
|||||||
# reactions
|
# reactions
|
||||||
|
|
||||||
|
## 0.0.29
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.9.11
|
||||||
|
- jazz-tools@0.9.11
|
||||||
|
- jazz-browser-media-images@0.9.11
|
||||||
|
|
||||||
|
## 0.0.28
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [5e83864]
|
||||||
|
- jazz-react@0.9.10
|
||||||
|
- jazz-tools@0.9.10
|
||||||
|
- jazz-browser-media-images@0.9.10
|
||||||
|
|
||||||
|
## 0.0.27
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- jazz-tools@0.9.9
|
||||||
|
- jazz-browser-media-images@0.9.9
|
||||||
|
- jazz-react@0.9.9
|
||||||
|
|
||||||
## 0.0.26
|
## 0.0.26
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -2,30 +2,60 @@
|
|||||||
|
|
||||||
Live version: [https://reactions-demo.jazz.tools](https://reactions-demo.jazz.tools)
|
Live version: [https://reactions-demo.jazz.tools](https://reactions-demo.jazz.tools)
|
||||||
|
|
||||||
## Installing & running the example locally
|
## Getting started
|
||||||
|
|
||||||
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
|
You can either
|
||||||
|
1. Clone the jazz repository, and run the app within the monorepo.
|
||||||
|
2. Or create a new Jazz project using this example as a template.
|
||||||
|
|
||||||
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
|
|
||||||
|
### Using the example as a template
|
||||||
|
|
||||||
|
Create a new Jazz project, and use this example as a template.
|
||||||
```bash
|
```bash
|
||||||
npx degit gardencmp/jazz jazz
|
npm create jazz-app@latest --example reactions --project-name reactions
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```bash
|
||||||
|
npx create-jazz-app@latest --example reactions --project-name reactions
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to the reactions example directory:
|
Go to the new project directory.
|
||||||
```bash
|
```bash
|
||||||
cd jazz/examples/reactions
|
cd reactions
|
||||||
```
|
```
|
||||||
|
|
||||||
Install and build dependencies:
|
Run the dev server.
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using the monorepo
|
||||||
|
|
||||||
|
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
|
||||||
|
|
||||||
|
Clone the jazz repository.
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/garden-co/jazz.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Install and build dependencies.
|
||||||
```bash
|
```bash
|
||||||
pnpm i && npx turbo build
|
pnpm i && npx turbo build
|
||||||
```
|
```
|
||||||
|
|
||||||
Start the dev server:
|
Go to the example directory.
|
||||||
|
```bash
|
||||||
|
cd jazz/examples/reactions/
|
||||||
|
```
|
||||||
|
|
||||||
|
Start the dev server.
|
||||||
```bash
|
```bash
|
||||||
pnpm dev
|
pnpm dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
|
||||||
|
|
||||||
## Questions / problems / feedback
|
## Questions / problems / feedback
|
||||||
|
|
||||||
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "reactions",
|
"name": "reactions",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.26",
|
"version": "0.0.29",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -1,5 +1,31 @@
|
|||||||
# todo-vue
|
# todo-vue
|
||||||
|
|
||||||
|
## 0.0.34
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-browser@0.9.11
|
||||||
|
- jazz-tools@0.9.11
|
||||||
|
- jazz-vue@0.9.11
|
||||||
|
|
||||||
|
## 0.0.33
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [5e83864]
|
||||||
|
- jazz-tools@0.9.10
|
||||||
|
- jazz-browser@0.9.10
|
||||||
|
- jazz-vue@0.9.10
|
||||||
|
|
||||||
|
## 0.0.32
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- jazz-tools@0.9.9
|
||||||
|
- jazz-browser@0.9.9
|
||||||
|
- jazz-vue@0.9.9
|
||||||
|
|
||||||
## 0.0.31
|
## 0.0.31
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,29 +1,59 @@
|
|||||||
# Todo list example with Jazz and Vue
|
# Todo list example with Jazz and Vue
|
||||||
|
|
||||||
## Installing & running the example locally
|
## Getting started
|
||||||
|
|
||||||
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
|
You can either
|
||||||
|
1. Clone the jazz repository, and run the app within the monorepo.
|
||||||
|
2. Or create a new Jazz project using this example as a template.
|
||||||
|
|
||||||
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
|
|
||||||
|
### Using the example as a template
|
||||||
|
|
||||||
|
Create a new Jazz project, and use this example as a template.
|
||||||
```bash
|
```bash
|
||||||
npx degit gardencmp/jazz jazz
|
npm create jazz-app@latest --example todo-vue --project-name todo-vue
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```bash
|
||||||
|
npx create-jazz-app@latest --example todo-vue --project-name todo-vue
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to the todo-vue example directory:
|
Go to the new project directory.
|
||||||
```bash
|
```bash
|
||||||
cd jazz/examples/todo-vue
|
cd todo-vue
|
||||||
```
|
```
|
||||||
|
|
||||||
Install and build dependencies:
|
Run the dev server.
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using the monorepo
|
||||||
|
|
||||||
|
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
|
||||||
|
|
||||||
|
Clone the jazz repository.
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/garden-co/jazz.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Install and build dependencies.
|
||||||
```bash
|
```bash
|
||||||
pnpm i && npx turbo build
|
pnpm i && npx turbo build
|
||||||
```
|
```
|
||||||
|
|
||||||
Start the dev server:
|
Go to the example directory.
|
||||||
|
```bash
|
||||||
|
cd jazz/examples/todo-vue/
|
||||||
|
```
|
||||||
|
|
||||||
|
Start the dev server.
|
||||||
```bash
|
```bash
|
||||||
pnpm dev
|
pnpm dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
|
||||||
|
|
||||||
## Questions / problems / feedback
|
## Questions / problems / feedback
|
||||||
|
|
||||||
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "todo-vue",
|
"name": "todo-vue",
|
||||||
"version": "0.0.31",
|
"version": "0.0.34",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,5 +1,28 @@
|
|||||||
# jazz-example-todo
|
# jazz-example-todo
|
||||||
|
|
||||||
|
## 0.0.148
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.9.11
|
||||||
|
- jazz-tools@0.9.11
|
||||||
|
|
||||||
|
## 0.0.147
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [5e83864]
|
||||||
|
- jazz-react@0.9.10
|
||||||
|
- jazz-tools@0.9.10
|
||||||
|
|
||||||
|
## 0.0.146
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- jazz-tools@0.9.9
|
||||||
|
- jazz-react@0.9.9
|
||||||
|
|
||||||
## 0.0.145
|
## 0.0.145
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -2,30 +2,60 @@
|
|||||||
|
|
||||||
Live version: https://todo-demo.jazz.tools/
|
Live version: https://todo-demo.jazz.tools/
|
||||||
|
|
||||||
## Installing & running the example locally
|
## Getting started
|
||||||
|
|
||||||
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
|
You can either
|
||||||
|
1. Clone the jazz repository, and run the app within the monorepo.
|
||||||
|
2. Or create a new Jazz project using this example as a template.
|
||||||
|
|
||||||
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
|
|
||||||
|
### Using the example as a template
|
||||||
|
|
||||||
|
Create a new Jazz project, and use this example as a template.
|
||||||
```bash
|
```bash
|
||||||
npx degit gardencmp/jazz jazz
|
npm create jazz-app@latest --example todo --project-name todo
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```bash
|
||||||
|
npx create-jazz-app@latest --example todo --project-name todo
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to the todo example directory:
|
Go to the new project directory.
|
||||||
```bash
|
```bash
|
||||||
cd jazz/examples/todo
|
cd todo
|
||||||
```
|
```
|
||||||
|
|
||||||
Install and build dependencies:
|
Run the dev server.
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using the monorepo
|
||||||
|
|
||||||
|
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
|
||||||
|
|
||||||
|
Clone the jazz repository.
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/garden-co/jazz.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Install and build dependencies.
|
||||||
```bash
|
```bash
|
||||||
pnpm i && npx turbo build
|
pnpm i && npx turbo build
|
||||||
```
|
```
|
||||||
|
|
||||||
Start the dev server:
|
Go to the example directory.
|
||||||
|
```bash
|
||||||
|
cd jazz/examples/todo/
|
||||||
|
```
|
||||||
|
|
||||||
|
Start the dev server.
|
||||||
```bash
|
```bash
|
||||||
pnpm dev
|
pnpm dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
|
||||||
|
|
||||||
## Structure
|
## Structure
|
||||||
|
|
||||||
- [`src/basicComponents`](./src/basicComponents): simple components to build the UI, unrelated to Jazz (uses [shadcn/ui](https://ui.shadcn.com))
|
- [`src/basicComponents`](./src/basicComponents): simple components to build the UI, unrelated to Jazz (uses [shadcn/ui](https://ui.shadcn.com))
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "jazz-example-todo",
|
"name": "jazz-example-todo",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.145",
|
"version": "0.0.148",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
@@ -16,8 +16,8 @@
|
|||||||
"@radix-ui/react-toast": "^1.1.4",
|
"@radix-ui/react-toast": "^1.1.4",
|
||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
"clsx": "^2.0.0",
|
"clsx": "^2.0.0",
|
||||||
"jazz-react": "workspace:0.9.8",
|
"jazz-react": "workspace:0.9.11",
|
||||||
"jazz-tools": "workspace:0.9.8",
|
"jazz-tools": "workspace:0.9.11",
|
||||||
"lucide-react": "^0.274.0",
|
"lucide-react": "^0.274.0",
|
||||||
"qrcode": "^1.5.3",
|
"qrcode": "^1.5.3",
|
||||||
"react": "^18.3.1",
|
"react": "^18.3.1",
|
||||||
|
|||||||
@@ -1,5 +1,28 @@
|
|||||||
# version-history
|
# version-history
|
||||||
|
|
||||||
|
## 0.0.26
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- jazz-react@0.9.11
|
||||||
|
- jazz-tools@0.9.11
|
||||||
|
|
||||||
|
## 0.0.25
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [5e83864]
|
||||||
|
- jazz-react@0.9.10
|
||||||
|
- jazz-tools@0.9.10
|
||||||
|
|
||||||
|
## 0.0.24
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- jazz-tools@0.9.9
|
||||||
|
- jazz-react@0.9.9
|
||||||
|
|
||||||
## 0.0.23
|
## 0.0.23
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -2,30 +2,60 @@
|
|||||||
|
|
||||||
A minimal example showing how to use Jazz's built-in version history to show and restore changes.
|
A minimal example showing how to use Jazz's built-in version history to show and restore changes.
|
||||||
|
|
||||||
## Installing & running the example locally
|
## Getting started
|
||||||
|
|
||||||
(This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation))
|
You can either
|
||||||
|
1. Clone the jazz repository, and run the app within the monorepo.
|
||||||
|
2. Or create a new Jazz project using this example as a template.
|
||||||
|
|
||||||
Start by downloading the [jazz repository](https://github.com/garden-co/jazz):
|
|
||||||
|
### Using the example as a template
|
||||||
|
|
||||||
|
Create a new Jazz project, and use this example as a template.
|
||||||
```bash
|
```bash
|
||||||
npx degit gardencmp/jazz jazz
|
npm create jazz-app@latest --example version-history --project-name version-history
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```bash
|
||||||
|
npx create-jazz-app@latest --example version-history --project-name version-history
|
||||||
```
|
```
|
||||||
|
|
||||||
Go to the version-history example directory:
|
Go to the new project directory.
|
||||||
```bash
|
```bash
|
||||||
cd jazz/examples/version-history
|
cd version-history
|
||||||
```
|
```
|
||||||
|
|
||||||
Install and build dependencies:
|
Run the dev server.
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using the monorepo
|
||||||
|
|
||||||
|
This requires `pnpm` to be installed, see [https://pnpm.io/installation](https://pnpm.io/installation).
|
||||||
|
|
||||||
|
Clone the jazz repository.
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/garden-co/jazz.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Install and build dependencies.
|
||||||
```bash
|
```bash
|
||||||
pnpm i && npx turbo build
|
pnpm i && npx turbo build
|
||||||
```
|
```
|
||||||
|
|
||||||
Start the dev server:
|
Go to the example directory.
|
||||||
|
```bash
|
||||||
|
cd jazz/examples/version-history/
|
||||||
|
```
|
||||||
|
|
||||||
|
Start the dev server.
|
||||||
```bash
|
```bash
|
||||||
pnpm dev
|
pnpm dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
|
||||||
|
|
||||||
## Questions / problems / feedback
|
## Questions / problems / feedback
|
||||||
|
|
||||||
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
If you have feedback, let us know on [Discord](https://discord.gg/utDMjHYg42) or open an issue or PR to fix something that seems wrong.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "version-history",
|
"name": "version-history",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.23",
|
"version": "0.0.26",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -61,14 +61,6 @@ const team: Array<TeamMember> = [
|
|||||||
location: "Portsmouth, UK ",
|
location: "Portsmouth, UK ",
|
||||||
github: "bensleveritt",
|
github: "bensleveritt",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: "Marina Orlova",
|
|
||||||
titles: ["Full-Stack Dev"],
|
|
||||||
location: "Tarragona, Spain ",
|
|
||||||
linkedin: "marina-orlova-52a34394",
|
|
||||||
github: "marinoska",
|
|
||||||
image: "marina.jpeg",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: "Giordano Ricci",
|
name: "Giordano Ricci",
|
||||||
titles: ["Full-Stack Dev", "DevOps"],
|
titles: ["Full-Stack Dev", "DevOps"],
|
||||||
|
|||||||
@@ -240,24 +240,77 @@ In the demos, you'll find details on:
|
|||||||
|
|
||||||
### Working with Images
|
### Working with Images
|
||||||
|
|
||||||
To work with images in Jazz, import the `createImage` function from [`jazz-react-native-media-images`](https://github.com/garden-co/jazz/tree/main/packages/jazz-react-native-media-images).
|
Jazz provides a complete solution for handling images in React Native, including uploading, processing, and displaying them. Here's how to work with images:
|
||||||
|
|
||||||
|
#### Uploading Images
|
||||||
|
|
||||||
|
To upload images, use the `createImage` function from `jazz-react-native-media-images`. This function handles image processing and creates an `ImageDefinition` that can be stored in your Jazz covalues:
|
||||||
|
|
||||||
<CodeGroup>
|
<CodeGroup>
|
||||||
```tsx
|
```tsx
|
||||||
import { createImage } from "jazz-react-native-media-images";
|
import { createImage } from "jazz-react-native-media-images";
|
||||||
|
import * as ImagePicker from 'expo-image-picker';
|
||||||
|
|
||||||
const base64ImageDataURI = "data:image/png;base64,...";
|
// Example: Image upload from device library
|
||||||
|
const handleImageUpload = async () => {
|
||||||
|
try {
|
||||||
|
const result = await ImagePicker.launchImageLibraryAsync({
|
||||||
|
mediaTypes: ImagePicker.MediaTypeOptions.Images,
|
||||||
|
base64: true, // Important: We need base64 data
|
||||||
|
quality: 0.7,
|
||||||
|
});
|
||||||
|
|
||||||
const image = await createImage(base64ImageDataURI, {
|
if (!result.canceled && result.assets[0].base64) {
|
||||||
owner: newPetPost._owner,
|
const base64Uri = `data:image/jpeg;base64,${result.assets[0].base64}`;
|
||||||
maxSize: 2048, // optional: specify maximum image size
|
|
||||||
});
|
|
||||||
|
|
||||||
someCovalue.image = image;
|
const image = await createImage(base64Uri, {
|
||||||
|
owner: someCovalue._owner, // Set appropriate owner
|
||||||
|
maxSize: 2048, // Optional: limit maximum image size
|
||||||
|
});
|
||||||
|
|
||||||
|
// Store the image in your covalue
|
||||||
|
someCovalue.image = image;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to upload image:', error);
|
||||||
|
}
|
||||||
|
};
|
||||||
```
|
```
|
||||||
</CodeGroup>
|
</CodeGroup>
|
||||||
|
|
||||||
For a complete implementation, please refer to [this](https://github.com/garden-co/jazz/blob/main/examples/pets/src/3_NewPetPostForm.tsx) demo.
|
#### Displaying Images
|
||||||
|
|
||||||
|
To display images, use the `ProgressiveImg` component from `jazz-react-native`. This component handles both images uploaded from React Native and desktop browsers:
|
||||||
|
|
||||||
|
<CodeGroup>
|
||||||
|
```tsx
|
||||||
|
import { ProgressiveImg } from "jazz-react-native";
|
||||||
|
import { Image } from "react-native";
|
||||||
|
|
||||||
|
// Inside your render function:
|
||||||
|
<ProgressiveImg image={someCovalue.image} maxWidth={1024}>
|
||||||
|
{({ src, res, originalSize }) => (
|
||||||
|
<Image
|
||||||
|
source={{ uri: src }}
|
||||||
|
style={{
|
||||||
|
width: 300, // Adjust size as needed
|
||||||
|
height: 300,
|
||||||
|
borderRadius: 8,
|
||||||
|
}}
|
||||||
|
resizeMode="cover"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</ProgressiveImg>
|
||||||
|
```
|
||||||
|
</CodeGroup>
|
||||||
|
|
||||||
|
The `ProgressiveImg` component:
|
||||||
|
- Automatically handles different image formats
|
||||||
|
- Provides progressive loading with placeholder images
|
||||||
|
- Supports different resolutions based on the `maxWidth` prop
|
||||||
|
- Works seamlessly with React Native's `Image` component
|
||||||
|
|
||||||
|
For a complete implementation example, see the [Chat Example](https://github.com/garden-co/jazz/blob/main/examples/chat-rn-clerk/app/chat/[chatId].tsx).
|
||||||
|
|
||||||
### Running your app
|
### Running your app
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
import { ContentByFramework, CodeGroup } from '@/components/forMdx'
|
||||||
|
|
||||||
|
export const metadata = { title: "Upgrade to Jazz 0.9.0" };
|
||||||
|
|
||||||
|
# Jazz 0.9.8 - Without me!
|
||||||
|
|
||||||
|
<h2 className="not-prose text-sm text-stone-600 dark:text-stone-400 mb-5 pb-2 border-b">
|
||||||
|
14 January 2025
|
||||||
|
</h2>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
We have simplified the API to make the "me" value always optional!
|
||||||
|
|
||||||
|
This removes the need of using `useAccount` like the 90% of the time!
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<CodeGroup>
|
||||||
|
{/* prettier-ignore */}
|
||||||
|
```ts
|
||||||
|
import { useState } from "react";
|
||||||
|
import { Issue } from "./schema";
|
||||||
|
import { IssueComponent } from "./components/Issue.tsx";
|
||||||
|
function App() {
|
||||||
|
const [issue, setIssue] = useState<Issue>();
|
||||||
|
|
||||||
|
const createIssue = () => {
|
||||||
|
setIssue(Issue.create(
|
||||||
|
{
|
||||||
|
title: "Buy terrarium",
|
||||||
|
description: "Make sure it's big enough for 10 snails.",
|
||||||
|
estimate: 5,
|
||||||
|
status: "backlog",
|
||||||
|
}, // The owner defaults now to a group managed by the current user!
|
||||||
|
));
|
||||||
|
};
|
||||||
|
|
||||||
|
if (issue) {
|
||||||
|
return <IssueComponent issue={issue} />;
|
||||||
|
} else {
|
||||||
|
return <button onClick={createIssue}>Create Issue</button>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
</CodeGroup>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
This also applies to the load API:
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<CodeGroup>
|
||||||
|
{/* prettier-ignore */}
|
||||||
|
```ts
|
||||||
|
const issue = Issue.load(issueId, {})
|
||||||
|
```
|
||||||
|
</CodeGroup>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
And `Group.create`:
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<CodeGroup>
|
||||||
|
{/* prettier-ignore */}
|
||||||
|
```tsx
|
||||||
|
const group = Group.create()
|
||||||
|
const sharedIssue = Issue.create(payload, group)
|
||||||
|
group.addMember('everyone', 'reader')
|
||||||
|
```
|
||||||
|
</CodeGroup>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
Everything is backward compatible, so no upgrade steps are required.
|
||||||
|
|
||||||
|
With this Jazz API becomes way more lean and more is coming!
|
||||||
|
</div>
|
||||||
@@ -7,9 +7,18 @@ The Jazz docs are currently heavily work in progress, sorry about that!
|
|||||||
## Quickstart
|
## Quickstart
|
||||||
|
|
||||||
Run the following command to create a new Jazz project from one of our example apps:
|
Run the following command to create a new Jazz project from one of our example apps:
|
||||||
|
|
||||||
<CodeGroup>
|
<CodeGroup>
|
||||||
```sh
|
```sh
|
||||||
npx create-jazz-app
|
npm create jazz-app@latest
|
||||||
|
```
|
||||||
|
</CodeGroup>
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
<CodeGroup>
|
||||||
|
```sh
|
||||||
|
npx create-jazz-app@latest
|
||||||
```
|
```
|
||||||
</CodeGroup>
|
</CodeGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ export function DocNav({ className }: { className?: string }) {
|
|||||||
return {
|
return {
|
||||||
...headerItem,
|
...headerItem,
|
||||||
items: headerItem.items
|
items: headerItem.items
|
||||||
.filter((item) => !item.framework || item.framework === framework)
|
.filter(
|
||||||
|
(item) => !("framework" in item) || item.framework === framework,
|
||||||
|
)
|
||||||
.map((item) => {
|
.map((item) => {
|
||||||
if (!item.href?.startsWith("/docs")) return item;
|
if (!item.href?.startsWith("/docs")) return item;
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,11 @@ import { Application } from "typedoc";
|
|||||||
for (const { packageName, entryPoint, tsconfig, typedocOptions } of [
|
for (const { packageName, entryPoint, tsconfig, typedocOptions } of [
|
||||||
{
|
{
|
||||||
packageName: "jazz-tools",
|
packageName: "jazz-tools",
|
||||||
entryPoint: "index.web.ts",
|
entryPoint: "exports.ts",
|
||||||
tsconfig: "tsconfig.web.json",
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
packageName: "jazz-react",
|
packageName: "jazz-react",
|
||||||
entryPoint: "index.tsx",
|
entryPoint: "index.ts",
|
||||||
typedocOptions: {
|
typedocOptions: {
|
||||||
skipErrorChecking: true, // TODO: remove this. Temporary workaround
|
skipErrorChecking: true, // TODO: remove this. Temporary workaround
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -50,16 +50,27 @@ export const docNavigationItems = [
|
|||||||
href: "/docs/project-setup/server-side",
|
href: "/docs/project-setup/server-side",
|
||||||
done: 80,
|
done: 80,
|
||||||
},
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Updates",
|
||||||
|
items: [
|
||||||
{
|
{
|
||||||
// upgrade guides
|
// upgrade guides
|
||||||
name: "Enable local persistence",
|
name: "Jazz 0.9.8 - Without me!",
|
||||||
|
href: "/docs/upgrade/0-9-8",
|
||||||
|
done: 100,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// upgrade guides
|
||||||
|
name: "Jazz 0.9.2 - Local persistence on React Native",
|
||||||
href: "/docs/upgrade/react-native-local-persistence",
|
href: "/docs/upgrade/react-native-local-persistence",
|
||||||
done: 100,
|
done: 100,
|
||||||
framework: "react-native",
|
framework: "react-native",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// upgrade guides
|
// upgrade guides
|
||||||
name: "Upgrade to Jazz 0.9.0",
|
name: "Jazz 0.9.0 - Upgrade guide",
|
||||||
href: "/docs/upgrade/0-9-0",
|
href: "/docs/upgrade/0-9-0",
|
||||||
done: 100,
|
done: 100,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,30 @@
|
|||||||
# cojson-storage-indexeddb
|
# cojson-storage-indexeddb
|
||||||
|
|
||||||
|
## 0.9.11
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [efbf3d8]
|
||||||
|
- Updated dependencies [5863bad]
|
||||||
|
- cojson@0.9.11
|
||||||
|
- cojson-storage@0.9.11
|
||||||
|
|
||||||
|
## 0.9.10
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [4aa377d]
|
||||||
|
- cojson@0.9.10
|
||||||
|
- cojson-storage@0.9.10
|
||||||
|
|
||||||
|
## 0.9.9
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- cojson@0.9.9
|
||||||
|
- cojson-storage@0.9.9
|
||||||
|
|
||||||
## 0.9.0
|
## 0.9.0
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cojson-storage-indexeddb",
|
"name": "cojson-storage-indexeddb",
|
||||||
"version": "0.9.0",
|
"version": "0.9.11",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "src/index.ts",
|
"types": "src/index.ts",
|
||||||
|
|||||||
@@ -1,5 +1,30 @@
|
|||||||
# cojson-storage-sqlite
|
# cojson-storage-sqlite
|
||||||
|
|
||||||
|
## 0.8.54
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [efbf3d8]
|
||||||
|
- Updated dependencies [5863bad]
|
||||||
|
- cojson@0.9.11
|
||||||
|
- cojson-storage@0.9.11
|
||||||
|
|
||||||
|
## 0.8.53
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [4aa377d]
|
||||||
|
- cojson@0.9.10
|
||||||
|
- cojson-storage@0.9.10
|
||||||
|
|
||||||
|
## 0.8.52
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- cojson@0.9.9
|
||||||
|
- cojson-storage@0.9.9
|
||||||
|
|
||||||
## 0.8.51
|
## 0.8.51
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "cojson-storage-rn-sqlite",
|
"name": "cojson-storage-rn-sqlite",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.8.51",
|
"version": "0.8.54",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "src/index.ts",
|
"types": "src/index.ts",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
@@ -1,5 +1,31 @@
|
|||||||
# cojson-storage-sqlite
|
# cojson-storage-sqlite
|
||||||
|
|
||||||
|
## 0.9.11
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 5863bad: Wrap all the console logs with a logger class to make possible to customize the logger
|
||||||
|
- Updated dependencies [efbf3d8]
|
||||||
|
- Updated dependencies [5863bad]
|
||||||
|
- cojson@0.9.11
|
||||||
|
- cojson-storage@0.9.11
|
||||||
|
|
||||||
|
## 0.9.10
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [4aa377d]
|
||||||
|
- cojson@0.9.10
|
||||||
|
- cojson-storage@0.9.10
|
||||||
|
|
||||||
|
## 0.9.9
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- cojson@0.9.9
|
||||||
|
- cojson-storage@0.9.9
|
||||||
|
|
||||||
## 0.9.0
|
## 0.9.0
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "cojson-storage-sqlite",
|
"name": "cojson-storage-sqlite",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.9.0",
|
"version": "0.9.11",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "src/index.ts",
|
"types": "src/index.ts",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"better-sqlite3": "^11.7.0",
|
"better-sqlite3": "^11.7.0",
|
||||||
"cojson": "workspace:0.9.0",
|
"cojson": "workspace:0.9.11",
|
||||||
"cojson-storage": "workspace:*"
|
"cojson-storage": "workspace:*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
import { Database as DatabaseT } from "better-sqlite3";
|
import { Database as DatabaseT } from "better-sqlite3";
|
||||||
import { CojsonInternalTypes, OutgoingSyncQueue, SessionID } from "cojson";
|
import {
|
||||||
|
CojsonInternalTypes,
|
||||||
|
OutgoingSyncQueue,
|
||||||
|
SessionID,
|
||||||
|
logger,
|
||||||
|
} from "cojson";
|
||||||
import RawCoID = CojsonInternalTypes.RawCoID;
|
import RawCoID = CojsonInternalTypes.RawCoID;
|
||||||
import Signature = CojsonInternalTypes.Signature;
|
import Signature = CojsonInternalTypes.Signature;
|
||||||
import Transaction = CojsonInternalTypes.Transaction;
|
import Transaction = CojsonInternalTypes.Transaction;
|
||||||
@@ -48,7 +53,7 @@ export class SQLiteClient implements DBClientInterface {
|
|||||||
header: parsedHeader,
|
header: parsedHeader,
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn(coValueId, "Invalid JSON in header", e, coValueRow?.header);
|
logger.warn(coValueId, "Invalid JSON in header", e, coValueRow?.header);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,7 +80,7 @@ export class SQLiteClient implements DBClientInterface {
|
|||||||
tx: JSON.parse(transactionRow.tx) as Transaction,
|
tx: JSON.parse(transactionRow.tx) as Transaction,
|
||||||
}));
|
}));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn("Invalid JSON in transaction", e);
|
logger.warn("Invalid JSON in transaction", e);
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import {
|
|||||||
OutgoingSyncQueue,
|
OutgoingSyncQueue,
|
||||||
Peer,
|
Peer,
|
||||||
cojsonInternals,
|
cojsonInternals,
|
||||||
|
logger,
|
||||||
} from "cojson";
|
} from "cojson";
|
||||||
import { SyncManager, TransactionRow } from "cojson-storage";
|
import { SyncManager, TransactionRow } from "cojson-storage";
|
||||||
import { SQLiteClient } from "./sqliteClient.js";
|
import { SQLiteClient } from "./sqliteClient.js";
|
||||||
@@ -40,25 +41,23 @@ export class SQLiteNode {
|
|||||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(
|
logger.error(
|
||||||
new Error(
|
`Error reading from localNode, handling msg\n\n${JSON.stringify(
|
||||||
`Error reading from localNode, handling msg\n\n${JSON.stringify(
|
msg,
|
||||||
msg,
|
(k, v) =>
|
||||||
(k, v) =>
|
k === "changes" || k === "encryptedChanges"
|
||||||
k === "changes" || k === "encryptedChanges"
|
? v.slice(0, 20) + "..."
|
||||||
? v.slice(0, 20) + "..."
|
: v,
|
||||||
: v,
|
)}`,
|
||||||
)}`,
|
e,
|
||||||
{ cause: e },
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
processMessages().catch((e) =>
|
processMessages().catch((e) =>
|
||||||
console.error("Error in processMessages in sqlite", e),
|
logger.error("Error in processMessages in sqlite", e),
|
||||||
);
|
);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static async asPeer({
|
static async asPeer({
|
||||||
@@ -97,10 +96,7 @@ export class SQLiteNode {
|
|||||||
db.pragma("user_version") as [{ user_version: number }]
|
db.pragma("user_version") as [{ user_version: number }]
|
||||||
)[0].user_version as number;
|
)[0].user_version as number;
|
||||||
|
|
||||||
console.log("DB version", oldVersion);
|
|
||||||
|
|
||||||
if (oldVersion === 0) {
|
if (oldVersion === 0) {
|
||||||
console.log("Migration 0 -> 1: Basic schema");
|
|
||||||
db.prepare(
|
db.prepare(
|
||||||
`CREATE TABLE IF NOT EXISTS transactions (
|
`CREATE TABLE IF NOT EXISTS transactions (
|
||||||
ses INTEGER,
|
ses INTEGER,
|
||||||
@@ -138,15 +134,10 @@ export class SQLiteNode {
|
|||||||
).run();
|
).run();
|
||||||
|
|
||||||
db.pragma("user_version = 1");
|
db.pragma("user_version = 1");
|
||||||
console.log("Migration 0 -> 1: Basic schema - done");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldVersion <= 1) {
|
if (oldVersion <= 1) {
|
||||||
// fix embarrassing off-by-one error for transaction indices
|
// fix embarrassing off-by-one error for transaction indices
|
||||||
console.log(
|
|
||||||
"Migration 1 -> 2: Fix off-by-one error for transaction indices",
|
|
||||||
);
|
|
||||||
|
|
||||||
const txs = db
|
const txs = db
|
||||||
.prepare(`SELECT * FROM transactions`)
|
.prepare(`SELECT * FROM transactions`)
|
||||||
.all() as TransactionRow[];
|
.all() as TransactionRow[];
|
||||||
@@ -163,14 +154,9 @@ export class SQLiteNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
db.pragma("user_version = 2");
|
db.pragma("user_version = 2");
|
||||||
console.log(
|
|
||||||
"Migration 1 -> 2: Fix off-by-one error for transaction indices - done",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldVersion <= 2) {
|
if (oldVersion <= 2) {
|
||||||
console.log("Migration 2 -> 3: Add signatureAfter");
|
|
||||||
|
|
||||||
db.prepare(
|
db.prepare(
|
||||||
`CREATE TABLE IF NOT EXISTS signatureAfter (
|
`CREATE TABLE IF NOT EXISTS signatureAfter (
|
||||||
ses INTEGER,
|
ses INTEGER,
|
||||||
@@ -185,7 +171,6 @@ export class SQLiteNode {
|
|||||||
).run();
|
).run();
|
||||||
|
|
||||||
db.pragma("user_version = 3");
|
db.pragma("user_version = 3");
|
||||||
console.log("Migration 2 -> 3: Add signatureAfter - done!!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new SQLiteNode(db, fromLocalNode, toLocalNode);
|
return new SQLiteNode(db, fromLocalNode, toLocalNode);
|
||||||
|
|||||||
@@ -1,5 +1,28 @@
|
|||||||
# cojson-storage
|
# cojson-storage
|
||||||
|
|
||||||
|
## 0.9.11
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 5863bad: Wrap all the console logs with a logger class to make possible to customize the logger
|
||||||
|
- Updated dependencies [efbf3d8]
|
||||||
|
- Updated dependencies [5863bad]
|
||||||
|
- cojson@0.9.11
|
||||||
|
|
||||||
|
## 0.9.10
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [4aa377d]
|
||||||
|
- cojson@0.9.10
|
||||||
|
|
||||||
|
## 0.9.9
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- cojson@0.9.9
|
||||||
|
|
||||||
## 0.9.0
|
## 0.9.0
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cojson-storage",
|
"name": "cojson-storage",
|
||||||
"version": "0.9.0",
|
"version": "0.9.11",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"types": "src/index.ts",
|
"types": "src/index.ts",
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
SyncMessage,
|
SyncMessage,
|
||||||
cojsonInternals,
|
cojsonInternals,
|
||||||
emptyKnownState,
|
emptyKnownState,
|
||||||
|
logger,
|
||||||
} from "cojson";
|
} from "cojson";
|
||||||
import { collectNewTxs, getDependedOnCoValues } from "./syncUtils.js";
|
import { collectNewTxs, getDependedOnCoValues } from "./syncUtils.js";
|
||||||
import { DBClientInterface, StoredSessionRow } from "./types.js";
|
import { DBClientInterface, StoredSessionRow } from "./types.js";
|
||||||
@@ -314,7 +315,7 @@ export class SyncManager {
|
|||||||
return this.toLocalNode
|
return this.toLocalNode
|
||||||
.push(msg)
|
.push(msg)
|
||||||
.catch((e) =>
|
.catch((e) =>
|
||||||
console.error(`Error sending ${msg.action} state, id ${msg.id}`, e),
|
logger.error(`Error sending ${msg.action} state, id ${msg.id}`, e),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,28 @@
|
|||||||
# cojson-transport-nodejs-ws
|
# cojson-transport-nodejs-ws
|
||||||
|
|
||||||
|
## 0.9.11
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 5863bad: Wrap all the console logs with a logger class to make possible to customize the logger
|
||||||
|
- Updated dependencies [efbf3d8]
|
||||||
|
- Updated dependencies [5863bad]
|
||||||
|
- cojson@0.9.11
|
||||||
|
|
||||||
|
## 0.9.10
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [4aa377d]
|
||||||
|
- cojson@0.9.10
|
||||||
|
|
||||||
|
## 0.9.9
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [8eb9247]
|
||||||
|
- cojson@0.9.9
|
||||||
|
|
||||||
## 0.9.0
|
## 0.9.0
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "cojson-transport-ws",
|
"name": "cojson-transport-ws",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.9.0",
|
"version": "0.9.11",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "src/index.ts",
|
"types": "src/index.ts",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cojson": "workspace:0.9.0",
|
"cojson": "workspace:0.9.11",
|
||||||
"typescript": "~5.6.2"
|
"typescript": "~5.6.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import {
|
|||||||
PingTimeoutError,
|
PingTimeoutError,
|
||||||
SyncMessage,
|
SyncMessage,
|
||||||
cojsonInternals,
|
cojsonInternals,
|
||||||
|
logger,
|
||||||
} from "cojson";
|
} from "cojson";
|
||||||
import { BatchedOutgoingMessages } from "./BatchedOutgoingMessages.js";
|
import { BatchedOutgoingMessages } from "./BatchedOutgoingMessages.js";
|
||||||
import { deserializeMessages } from "./serialization.js";
|
import { deserializeMessages } from "./serialization.js";
|
||||||
@@ -136,7 +137,7 @@ export function createWebSocketPeer({
|
|||||||
function handleClose() {
|
function handleClose() {
|
||||||
incoming
|
incoming
|
||||||
.push("Disconnected")
|
.push("Disconnected")
|
||||||
.catch((e) => console.error("Error while pushing disconnect msg", e));
|
.catch((e) => logger.error("Error while pushing disconnect msg", e));
|
||||||
emitClosedEvent();
|
emitClosedEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +146,7 @@ export function createWebSocketPeer({
|
|||||||
const pingTimeout = createPingTimeoutListener(expectPings, () => {
|
const pingTimeout = createPingTimeoutListener(expectPings, () => {
|
||||||
incoming
|
incoming
|
||||||
.push("PingTimeout")
|
.push("PingTimeout")
|
||||||
.catch((e) => console.error("Error while pushing ping timeout", e));
|
.catch((e) => logger.error("Error while pushing ping timeout", e));
|
||||||
emitClosedEvent();
|
emitClosedEvent();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -156,14 +157,13 @@ export function createWebSocketPeer({
|
|||||||
|
|
||||||
function handleIncomingMsg(event: { data: unknown }) {
|
function handleIncomingMsg(event: { data: unknown }) {
|
||||||
if (event.data === "") {
|
if (event.data === "") {
|
||||||
console.log("client", id, "sent empty message");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = deserializeMessages(event.data);
|
const result = deserializeMessages(event.data);
|
||||||
|
|
||||||
if (!result.ok) {
|
if (!result.ok) {
|
||||||
console.error(
|
logger.warn(
|
||||||
"Error while deserializing messages",
|
"Error while deserializing messages",
|
||||||
event.data,
|
event.data,
|
||||||
result.error,
|
result.error,
|
||||||
@@ -184,7 +184,7 @@ export function createWebSocketPeer({
|
|||||||
if (msg && "action" in msg) {
|
if (msg && "action" in msg) {
|
||||||
incoming
|
incoming
|
||||||
.push(msg)
|
.push(msg)
|
||||||
.catch((e) => console.error("Error while pushing incoming msg", e));
|
.catch((e) => logger.error("Error while pushing incoming msg", e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,7 +197,6 @@ export function createWebSocketPeer({
|
|||||||
outgoing: {
|
outgoing: {
|
||||||
push: outgoingMessages.sendMessage,
|
push: outgoingMessages.sendMessage,
|
||||||
close() {
|
close() {
|
||||||
console.log("Trying to close", id, websocket.readyState);
|
|
||||||
outgoingMessages.close();
|
outgoingMessages.close();
|
||||||
|
|
||||||
websocket.removeEventListener("message", handleIncomingMsg);
|
websocket.removeEventListener("message", handleIncomingMsg);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { SyncMessage } from "cojson";
|
import { SyncMessage, logger } from "cojson";
|
||||||
import { PingMsg } from "./types.js";
|
import { PingMsg } from "./types.js";
|
||||||
|
|
||||||
export function addMessageToBacklog(backlog: string, message: SyncMessage) {
|
export function addMessageToBacklog(backlog: string, message: SyncMessage) {
|
||||||
@@ -24,7 +24,7 @@ export function deserializeMessages(messages: unknown) {
|
|||||||
| PingMsg[],
|
| PingMsg[],
|
||||||
} as const;
|
} as const;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Error while deserializing messages", e);
|
logger.error("Error while deserializing messages", e);
|
||||||
return {
|
return {
|
||||||
ok: false,
|
ok: false,
|
||||||
error: e,
|
error: e,
|
||||||
|
|||||||
@@ -1,5 +1,24 @@
|
|||||||
# cojson
|
# cojson
|
||||||
|
|
||||||
|
## 0.9.11
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- efbf3d8: Optimize queue management
|
||||||
|
- 5863bad: Wrap all the console logs with a logger class to make possible to customize the logger
|
||||||
|
|
||||||
|
## 0.9.10
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 4aa377d: Handle unkown coValue content type and optimize content access
|
||||||
|
|
||||||
|
## 0.9.9
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 8eb9247: Add CoPlainText and CoRichText covalues
|
||||||
|
|
||||||
## 0.9.0
|
## 0.9.0
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "0.9.0",
|
"version": "0.9.11",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@opentelemetry/sdk-metrics": "^1.29.0",
|
"@opentelemetry/sdk-metrics": "^1.29.0",
|
||||||
"@types/jest": "^29.5.3",
|
"@types/jest": "^29.5.3",
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
} from "./PriorityBasedMessageQueue.js";
|
} from "./PriorityBasedMessageQueue.js";
|
||||||
import { TryAddTransactionsError } from "./coValueCore.js";
|
import { TryAddTransactionsError } from "./coValueCore.js";
|
||||||
import { RawCoID } from "./ids.js";
|
import { RawCoID } from "./ids.js";
|
||||||
|
import { logger } from "./logger.js";
|
||||||
import { CO_VALUE_PRIORITY } from "./priority.js";
|
import { CO_VALUE_PRIORITY } from "./priority.js";
|
||||||
import { Peer, SyncMessage } from "./sync.js";
|
import { Peer, SyncMessage } from "./sync.js";
|
||||||
|
|
||||||
@@ -92,7 +93,7 @@ export class PeerState {
|
|||||||
|
|
||||||
this.processing = true;
|
this.processing = true;
|
||||||
|
|
||||||
let entry: QueueEntry | undefined;
|
let entry: QueueEntry<SyncMessage> | undefined;
|
||||||
while ((entry = this.queue.pull())) {
|
while ((entry = this.queue.pull())) {
|
||||||
// Awaiting the push to send one message at a time
|
// Awaiting the push to send one message at a time
|
||||||
// This way when the peer is "under pressure" we can enqueue all
|
// This way when the peer is "under pressure" we can enqueue all
|
||||||
@@ -129,7 +130,7 @@ export class PeerState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private closeQueue() {
|
private closeQueue() {
|
||||||
let entry: QueueEntry | undefined;
|
let entry: QueueEntry<SyncMessage> | undefined;
|
||||||
while ((entry = this.queue.pull())) {
|
while ((entry = this.queue.pull())) {
|
||||||
// Using resolve here to avoid unnecessary noise in the logs
|
// Using resolve here to avoid unnecessary noise in the logs
|
||||||
entry.resolve();
|
entry.resolve();
|
||||||
@@ -137,7 +138,7 @@ export class PeerState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gracefulShutdown() {
|
gracefulShutdown() {
|
||||||
console.debug("Gracefully closing", this.id);
|
logger.debug("Gracefully closing", this.id);
|
||||||
this.closeQueue();
|
this.closeQueue();
|
||||||
this.peer.outgoing.close();
|
this.peer.outgoing.close();
|
||||||
this.closed = true;
|
this.closed = true;
|
||||||
|
|||||||
@@ -18,11 +18,12 @@ function promiseWithResolvers<R>() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export type QueueEntry = {
|
export type QueueEntry<V> = {
|
||||||
msg: SyncMessage;
|
msg: V;
|
||||||
promise: Promise<void>;
|
promise: Promise<void>;
|
||||||
resolve: () => void;
|
resolve: () => void;
|
||||||
reject: (_: unknown) => void;
|
reject: (_: unknown) => void;
|
||||||
|
next: QueueEntry<V> | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,10 +34,68 @@ type Tuple<T, N extends number, A extends unknown[] = []> = A extends {
|
|||||||
}
|
}
|
||||||
? A
|
? A
|
||||||
: Tuple<T, N, [...A, T]>;
|
: Tuple<T, N, [...A, T]>;
|
||||||
type QueueTuple = Tuple<QueueEntry[], 8>;
|
type QueueTuple = Tuple<Queue<SyncMessage>, 8>;
|
||||||
|
|
||||||
|
class Queue<V> {
|
||||||
|
head: QueueEntry<V> | undefined = undefined;
|
||||||
|
tail: QueueEntry<V> | undefined = undefined;
|
||||||
|
|
||||||
|
push(msg: V) {
|
||||||
|
const { promise, resolve, reject } = promiseWithResolvers<void>();
|
||||||
|
const entry: QueueEntry<V> = {
|
||||||
|
msg,
|
||||||
|
promise,
|
||||||
|
resolve,
|
||||||
|
reject,
|
||||||
|
next: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (this.head === undefined) {
|
||||||
|
this.head = entry;
|
||||||
|
} else {
|
||||||
|
if (this.tail === undefined) {
|
||||||
|
throw new Error("Tail is null but head is not");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.tail.next = entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.tail = entry;
|
||||||
|
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
pull() {
|
||||||
|
const entry = this.head;
|
||||||
|
|
||||||
|
if (entry) {
|
||||||
|
this.head = entry.next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.head === undefined) {
|
||||||
|
this.tail = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
return entry;
|
||||||
|
}
|
||||||
|
|
||||||
|
isNonEmpty() {
|
||||||
|
return this.head !== undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class PriorityBasedMessageQueue {
|
export class PriorityBasedMessageQueue {
|
||||||
private queues: QueueTuple = [[], [], [], [], [], [], [], []];
|
private queues: QueueTuple = [
|
||||||
|
new Queue(),
|
||||||
|
new Queue(),
|
||||||
|
new Queue(),
|
||||||
|
new Queue(),
|
||||||
|
new Queue(),
|
||||||
|
new Queue(),
|
||||||
|
new Queue(),
|
||||||
|
new Queue(),
|
||||||
|
];
|
||||||
|
|
||||||
queueSizeCounter = metrics
|
queueSizeCounter = metrics
|
||||||
.getMeter("cojson")
|
.getMeter("cojson")
|
||||||
.createUpDownCounter("jazz.messagequeue.size", {
|
.createUpDownCounter("jazz.messagequeue.size", {
|
||||||
@@ -52,22 +111,19 @@ export class PriorityBasedMessageQueue {
|
|||||||
constructor(private defaultPriority: CoValuePriority) {}
|
constructor(private defaultPriority: CoValuePriority) {}
|
||||||
|
|
||||||
public push(msg: SyncMessage) {
|
public push(msg: SyncMessage) {
|
||||||
const { promise, resolve, reject } = promiseWithResolvers<void>();
|
|
||||||
const entry: QueueEntry = { msg, promise, resolve, reject };
|
|
||||||
|
|
||||||
const priority = "priority" in msg ? msg.priority : this.defaultPriority;
|
const priority = "priority" in msg ? msg.priority : this.defaultPriority;
|
||||||
|
|
||||||
this.getQueue(priority).push(entry);
|
const entry = this.getQueue(priority).push(msg);
|
||||||
|
|
||||||
this.queueSizeCounter.add(1, {
|
this.queueSizeCounter.add(1, {
|
||||||
priority,
|
priority,
|
||||||
});
|
});
|
||||||
|
|
||||||
return promise;
|
return entry.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
public pull() {
|
public pull() {
|
||||||
const priority = this.queues.findIndex((queue) => queue.length > 0);
|
const priority = this.queues.findIndex((queue) => queue.isNonEmpty());
|
||||||
|
|
||||||
if (priority === -1) {
|
if (priority === -1) {
|
||||||
return;
|
return;
|
||||||
@@ -77,6 +133,6 @@ export class PriorityBasedMessageQueue {
|
|||||||
priority,
|
priority,
|
||||||
});
|
});
|
||||||
|
|
||||||
return this.queues[priority]?.shift();
|
return this.queues[priority]?.pull();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,12 +43,7 @@ export function bytesToBase64url(bytes: Uint8Array) {
|
|||||||
let base64 = decoder.decode(new Uint8Array(encoded.buffer, 0, n));
|
let base64 = decoder.decode(new Uint8Array(encoded.buffer, 0, n));
|
||||||
if (k === 1) base64 += "==";
|
if (k === 1) base64 += "==";
|
||||||
if (k === 2) base64 += "=";
|
if (k === 2) base64 += "=";
|
||||||
// const after = performance.now();
|
|
||||||
// console.log(
|
|
||||||
// "bytesToBase64url bandwidth in MB/s for length",
|
|
||||||
// (1000 * bytes.length / (after - before)) / (1024 * 1024),
|
|
||||||
// bytes.length
|
|
||||||
// );
|
|
||||||
return base64;
|
return base64;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,12 +35,50 @@ export interface RawCoValue {
|
|||||||
subscribe(listener: (coValue: this) => void): () => void;
|
subscribe(listener: (coValue: this) => void): () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class RawUnknownCoValue implements RawCoValue {
|
||||||
|
id: CoID<this>;
|
||||||
|
core: CoValueCore;
|
||||||
|
|
||||||
|
constructor(core: CoValueCore) {
|
||||||
|
this.id = core.id as CoID<this>;
|
||||||
|
this.core = core;
|
||||||
|
}
|
||||||
|
|
||||||
|
get type() {
|
||||||
|
return this.core.header.type;
|
||||||
|
}
|
||||||
|
|
||||||
|
get headerMeta() {
|
||||||
|
return this.core.header.meta as JsonObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @category 6. Meta */
|
||||||
|
get group(): RawGroup {
|
||||||
|
return this.core.getGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
toJSON() {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
atTime() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
subscribe(listener: (value: this) => void): () => void {
|
||||||
|
return this.core.subscribe((content) => {
|
||||||
|
listener(content as this);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export type AnyRawCoValue =
|
export type AnyRawCoValue =
|
||||||
| RawCoMap
|
| RawCoMap
|
||||||
| RawGroup
|
| RawGroup
|
||||||
| RawAccount
|
| RawAccount
|
||||||
| Profile
|
| Profile
|
||||||
| RawCoList
|
| RawCoList
|
||||||
|
| RawCoPlainText
|
||||||
| RawCoStream
|
| RawCoStream
|
||||||
| RawBinaryCoStream;
|
| RawBinaryCoStream;
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import {
|
|||||||
import { Stringified, parseJSON, stableStringify } from "./jsonStringify.js";
|
import { Stringified, parseJSON, stableStringify } from "./jsonStringify.js";
|
||||||
import { JsonObject, JsonValue } from "./jsonValue.js";
|
import { JsonObject, JsonValue } from "./jsonValue.js";
|
||||||
import { LocalNode, ResolveAccountAgentError } from "./localNode.js";
|
import { LocalNode, ResolveAccountAgentError } from "./localNode.js";
|
||||||
|
import { logger } from "./logger.js";
|
||||||
import {
|
import {
|
||||||
PermissionsDef as RulesetDef,
|
PermissionsDef as RulesetDef,
|
||||||
determineValidTransactions,
|
determineValidTransactions,
|
||||||
@@ -126,10 +127,7 @@ export class CoValueCore {
|
|||||||
.expectCoValueLoaded(header.ruleset.group)
|
.expectCoValueLoaded(header.ruleset.group)
|
||||||
.subscribe((_groupUpdate) => {
|
.subscribe((_groupUpdate) => {
|
||||||
this._cachedContent = undefined;
|
this._cachedContent = undefined;
|
||||||
const newContent = this.getCurrentContent();
|
this.notifyUpdate("immediate");
|
||||||
for (const listener of this.listeners) {
|
|
||||||
listener(newContent);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -212,16 +210,10 @@ export class CoValueCore {
|
|||||||
.andThen((agent) => {
|
.andThen((agent) => {
|
||||||
const signerID = this.crypto.getAgentSignerID(agent);
|
const signerID = this.crypto.getAgentSignerID(agent);
|
||||||
|
|
||||||
// const beforeHash = performance.now();
|
|
||||||
const { expectedNewHash, newStreamingHash } = this.expectedNewHashAfter(
|
const { expectedNewHash, newStreamingHash } = this.expectedNewHashAfter(
|
||||||
sessionID,
|
sessionID,
|
||||||
newTransactions,
|
newTransactions,
|
||||||
);
|
);
|
||||||
// const afterHash = performance.now();
|
|
||||||
// console.log(
|
|
||||||
// "Hashing took",
|
|
||||||
// afterHash - beforeHash
|
|
||||||
// );
|
|
||||||
|
|
||||||
if (givenExpectedNewHash && givenExpectedNewHash !== expectedNewHash) {
|
if (givenExpectedNewHash && givenExpectedNewHash !== expectedNewHash) {
|
||||||
return err({
|
return err({
|
||||||
@@ -244,11 +236,6 @@ export class CoValueCore {
|
|||||||
signerID,
|
signerID,
|
||||||
} satisfies InvalidSignatureError);
|
} satisfies InvalidSignatureError);
|
||||||
}
|
}
|
||||||
// const afterVerify = performance.now();
|
|
||||||
// console.log(
|
|
||||||
// "Verify took",
|
|
||||||
// afterVerify - beforeVerify
|
|
||||||
// );
|
|
||||||
|
|
||||||
this.doAddTransactions(
|
this.doAddTransactions(
|
||||||
sessionID,
|
sessionID,
|
||||||
@@ -263,138 +250,6 @@ export class CoValueCore {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/*tryAddTransactionsAsync(
|
|
||||||
sessionID: SessionID,
|
|
||||||
newTransactions: Transaction[],
|
|
||||||
givenExpectedNewHash: Hash | undefined,
|
|
||||||
newSignature: Signature,
|
|
||||||
): ResultAsync<true, TryAddTransactionsError> {
|
|
||||||
const currentAsyncAddTransaction = this._currentAsyncAddTransaction;
|
|
||||||
let maybeAwaitPrevious:
|
|
||||||
| ResultAsync<void, TryAddTransactionsError>
|
|
||||||
| undefined;
|
|
||||||
let thisDone = () => {};
|
|
||||||
|
|
||||||
if (currentAsyncAddTransaction) {
|
|
||||||
// eslint-disable-next-line neverthrow/must-use-result
|
|
||||||
maybeAwaitPrevious = ResultAsync.fromSafePromise(
|
|
||||||
currentAsyncAddTransaction,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
// eslint-disable-next-line neverthrow/must-use-result
|
|
||||||
maybeAwaitPrevious = ResultAsync.fromSafePromise(Promise.resolve());
|
|
||||||
this._currentAsyncAddTransaction = new Promise((resolve) => {
|
|
||||||
thisDone = resolve;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return maybeAwaitPrevious
|
|
||||||
.andThen((_previousDone) =>
|
|
||||||
this.node
|
|
||||||
.resolveAccountAgentAsync(
|
|
||||||
accountOrAgentIDfromSessionID(sessionID),
|
|
||||||
"Expected to know signer of transaction",
|
|
||||||
)
|
|
||||||
.andThen((agent) => {
|
|
||||||
const signerID = this.crypto.getAgentSignerID(agent);
|
|
||||||
|
|
||||||
const nTxBefore =
|
|
||||||
this.sessionLogs.get(sessionID)?.transactions
|
|
||||||
.length ?? 0;
|
|
||||||
|
|
||||||
// const beforeHash = performance.now();
|
|
||||||
return ResultAsync.fromSafePromise(
|
|
||||||
this.expectedNewHashAfterAsync(
|
|
||||||
sessionID,
|
|
||||||
newTransactions,
|
|
||||||
),
|
|
||||||
).andThen(({ expectedNewHash, newStreamingHash }) => {
|
|
||||||
// const afterHash = performance.now();
|
|
||||||
// console.log(
|
|
||||||
// "Hashing took",
|
|
||||||
// afterHash - beforeHash
|
|
||||||
// );
|
|
||||||
|
|
||||||
const nTxAfter =
|
|
||||||
this.sessionLogs.get(sessionID)?.transactions
|
|
||||||
.length ?? 0;
|
|
||||||
|
|
||||||
if (nTxAfter !== nTxBefore) {
|
|
||||||
const newTransactionLengthBefore =
|
|
||||||
newTransactions.length;
|
|
||||||
newTransactions = newTransactions.slice(
|
|
||||||
nTxAfter - nTxBefore,
|
|
||||||
);
|
|
||||||
console.warn(
|
|
||||||
"Transactions changed while async hashing",
|
|
||||||
{
|
|
||||||
nTxBefore,
|
|
||||||
nTxAfter,
|
|
||||||
newTransactionLengthBefore,
|
|
||||||
remainingNewTransactions:
|
|
||||||
newTransactions.length,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
givenExpectedNewHash &&
|
|
||||||
givenExpectedNewHash !== expectedNewHash
|
|
||||||
) {
|
|
||||||
return err({
|
|
||||||
type: "InvalidHash",
|
|
||||||
id: this.id,
|
|
||||||
expectedNewHash,
|
|
||||||
givenExpectedNewHash,
|
|
||||||
} satisfies InvalidHashError);
|
|
||||||
}
|
|
||||||
|
|
||||||
performance.mark("verifyStart" + this.id);
|
|
||||||
if (
|
|
||||||
!this.crypto.verify(
|
|
||||||
newSignature,
|
|
||||||
expectedNewHash,
|
|
||||||
signerID,
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
return err({
|
|
||||||
type: "InvalidSignature",
|
|
||||||
id: this.id,
|
|
||||||
newSignature,
|
|
||||||
sessionID,
|
|
||||||
signerID,
|
|
||||||
} satisfies InvalidSignatureError);
|
|
||||||
}
|
|
||||||
performance.mark("verifyEnd" + this.id);
|
|
||||||
performance.measure(
|
|
||||||
"verify" + this.id,
|
|
||||||
"verifyStart" + this.id,
|
|
||||||
"verifyEnd" + this.id,
|
|
||||||
);
|
|
||||||
|
|
||||||
this.doAddTransactions(
|
|
||||||
sessionID,
|
|
||||||
newTransactions,
|
|
||||||
newSignature,
|
|
||||||
expectedNewHash,
|
|
||||||
newStreamingHash,
|
|
||||||
"deferred",
|
|
||||||
);
|
|
||||||
|
|
||||||
return ok(true as const);
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
.map((trueResult) => {
|
|
||||||
thisDone();
|
|
||||||
return trueResult;
|
|
||||||
})
|
|
||||||
.mapErr((err) => {
|
|
||||||
thisDone();
|
|
||||||
return err;
|
|
||||||
});
|
|
||||||
}*/
|
|
||||||
|
|
||||||
private doAddTransactions(
|
private doAddTransactions(
|
||||||
sessionID: SessionID,
|
sessionID: SessionID,
|
||||||
newTransactions: Transaction[],
|
newTransactions: Transaction[],
|
||||||
@@ -432,12 +287,6 @@ export class CoValueCore {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (sizeOfTxsSinceLastInbetweenSignature > MAX_RECOMMENDED_TX_SIZE) {
|
if (sizeOfTxsSinceLastInbetweenSignature > MAX_RECOMMENDED_TX_SIZE) {
|
||||||
// console.log(
|
|
||||||
// "Saving inbetween signature for tx ",
|
|
||||||
// sessionID,
|
|
||||||
// transactions.length - 1,
|
|
||||||
// sizeOfTxsSinceLastInbetweenSignature
|
|
||||||
// );
|
|
||||||
signatureAfter[transactions.length - 1] = newSignature;
|
signatureAfter[transactions.length - 1] = newSignature;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,34 +312,40 @@ export class CoValueCore {
|
|||||||
this._cachedDependentOn = undefined;
|
this._cachedDependentOn = undefined;
|
||||||
this._cachedNewContentSinceEmpty = undefined;
|
this._cachedNewContentSinceEmpty = undefined;
|
||||||
|
|
||||||
if (this.listeners.size > 0) {
|
this.notifyUpdate(notifyMode);
|
||||||
if (notifyMode === "immediate") {
|
|
||||||
const content = this.getCurrentContent();
|
|
||||||
for (const listener of this.listeners) {
|
|
||||||
listener(content);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!this.nextDeferredNotify) {
|
|
||||||
this.nextDeferredNotify = new Promise((resolve) => {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.nextDeferredNotify = undefined;
|
|
||||||
this.deferredUpdates = 0;
|
|
||||||
const content = this.getCurrentContent();
|
|
||||||
for (const listener of this.listeners) {
|
|
||||||
listener(content);
|
|
||||||
}
|
|
||||||
resolve();
|
|
||||||
}, 0);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.deferredUpdates++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
deferredUpdates = 0;
|
deferredUpdates = 0;
|
||||||
nextDeferredNotify: Promise<void> | undefined;
|
nextDeferredNotify: Promise<void> | undefined;
|
||||||
|
|
||||||
|
notifyUpdate(notifyMode: "immediate" | "deferred") {
|
||||||
|
if (this.listeners.size === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (notifyMode === "immediate") {
|
||||||
|
const content = this.getCurrentContent();
|
||||||
|
for (const listener of this.listeners) {
|
||||||
|
listener(content);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!this.nextDeferredNotify) {
|
||||||
|
this.nextDeferredNotify = new Promise((resolve) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.nextDeferredNotify = undefined;
|
||||||
|
this.deferredUpdates = 0;
|
||||||
|
const content = this.getCurrentContent();
|
||||||
|
for (const listener of this.listeners) {
|
||||||
|
listener(content);
|
||||||
|
}
|
||||||
|
resolve();
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.deferredUpdates++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
subscribe(listener: (content?: RawCoValue) => void): () => void {
|
subscribe(listener: (content?: RawCoValue) => void): () => void {
|
||||||
this.listeners.add(listener);
|
this.listeners.add(listener);
|
||||||
listener(this.getCurrentContent());
|
listener(this.getCurrentContent());
|
||||||
@@ -531,7 +386,6 @@ export class CoValueCore {
|
|||||||
streamingHash.update(transaction);
|
streamingHash.update(transaction);
|
||||||
const after = performance.now();
|
const after = performance.now();
|
||||||
if (after - before > 1) {
|
if (after - before > 1) {
|
||||||
// console.log("Hashing blocked for", after - before);
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||||
before = performance.now();
|
before = performance.now();
|
||||||
}
|
}
|
||||||
@@ -680,7 +534,7 @@ export class CoValueCore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!decryptedChanges) {
|
if (!decryptedChanges) {
|
||||||
console.error("Failed to decrypt transaction despite having key");
|
logger.error("Failed to decrypt transaction despite having key");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -825,7 +679,7 @@ export class CoValueCore {
|
|||||||
if (secret) {
|
if (secret) {
|
||||||
return secret as KeySecret;
|
return secret as KeySecret;
|
||||||
} else {
|
} else {
|
||||||
console.error(
|
logger.warn(
|
||||||
`Encrypting ${encryptingKeyID} key didn't decrypt ${keyID}`,
|
`Encrypting ${encryptingKeyID} key didn't decrypt ${keyID}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -865,7 +719,7 @@ export class CoValueCore {
|
|||||||
if (secret) {
|
if (secret) {
|
||||||
return secret as KeySecret;
|
return secret as KeySecret;
|
||||||
} else {
|
} else {
|
||||||
console.error(
|
logger.warn(
|
||||||
`Encrypting parent ${parentKey.id} key didn't decrypt ${keyID}`,
|
`Encrypting parent ${parentKey.id} key didn't decrypt ${keyID}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { PeerState } from "./PeerState.js";
|
import { PeerState } from "./PeerState.js";
|
||||||
import { CoValueCore } from "./coValueCore.js";
|
import { CoValueCore } from "./coValueCore.js";
|
||||||
import { RawCoID } from "./ids.js";
|
import { RawCoID } from "./ids.js";
|
||||||
|
import { logger } from "./logger.js";
|
||||||
import { PeerID } from "./sync.js";
|
import { PeerID } from "./sync.js";
|
||||||
|
|
||||||
export const CO_VALUE_LOADING_MAX_RETRIES = 5;
|
export const CO_VALUE_LOADING_MAX_RETRIES = 5;
|
||||||
@@ -282,7 +283,7 @@ async function loadCoValueFromPeers(
|
|||||||
...coValueEntry.state.coValue.knownState(),
|
...coValueEntry.state.coValue.knownState(),
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(`Failed to push load message to peer ${peer.id}`, err);
|
logger.warn(`Failed to push load message to peer ${peer.id}`, err);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
/**
|
/**
|
||||||
@@ -296,14 +297,14 @@ async function loadCoValueFromPeers(
|
|||||||
sessions: {},
|
sessions: {},
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(`Failed to push load message to peer ${peer.id}`, err);
|
logger.warn(`Failed to push load message to peer ${peer.id}`, err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (coValueEntry.state.type === "loading") {
|
if (coValueEntry.state.type === "loading") {
|
||||||
const timeout = setTimeout(() => {
|
const timeout = setTimeout(() => {
|
||||||
if (coValueEntry.state.type === "loading") {
|
if (coValueEntry.state.type === "loading") {
|
||||||
console.error("Failed to load coValue from peer", peer.id);
|
logger.warn("Failed to load coValue from peer", peer.id);
|
||||||
coValueEntry.dispatch({
|
coValueEntry.dispatch({
|
||||||
type: "not-found-in-peer",
|
type: "not-found-in-peer",
|
||||||
peerId: peer.id,
|
peerId: peer.id,
|
||||||
@@ -356,7 +357,7 @@ function sleep(ms: number) {
|
|||||||
function getPeersWithoutErrors(peers: PeerState[], coValueId: RawCoID) {
|
function getPeersWithoutErrors(peers: PeerState[], coValueId: RawCoID) {
|
||||||
return peers.filter((p) => {
|
return peers.filter((p) => {
|
||||||
if (p.erroredCoValues.has(coValueId)) {
|
if (p.erroredCoValues.has(coValueId)) {
|
||||||
console.error(
|
logger.warn(
|
||||||
`Skipping load on errored coValue ${coValueId} from peer ${p.id}`,
|
`Skipping load on errored coValue ${coValueId} from peer ${p.id}`,
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import {
|
|||||||
import { AgentID } from "../ids.js";
|
import { AgentID } from "../ids.js";
|
||||||
import { JsonObject } from "../jsonValue.js";
|
import { JsonObject } from "../jsonValue.js";
|
||||||
import { LocalNode } from "../localNode.js";
|
import { LocalNode } from "../localNode.js";
|
||||||
|
import { logger } from "../logger.js";
|
||||||
import type { AccountRole } from "../permissions.js";
|
import type { AccountRole } from "../permissions.js";
|
||||||
import { RawCoMap } from "./coMap.js";
|
import { RawCoMap } from "./coMap.js";
|
||||||
import { InviteSecret, RawGroup } from "./group.js";
|
import { InviteSecret, RawGroup } from "./group.js";
|
||||||
@@ -59,7 +60,7 @@ export class RawAccount<
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (agents.length !== 1) {
|
if (agents.length !== 1) {
|
||||||
console.warn("Account has " + agents.length + " agents", this.id);
|
logger.warn("Account has " + agents.length + " agents", this.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._cachedCurrentAgentID = agents[0];
|
this._cachedCurrentAgentID = agents[0];
|
||||||
|
|||||||
@@ -133,10 +133,6 @@ export class RawCoListView<
|
|||||||
change.before.txIndex
|
change.before.txIndex
|
||||||
]?.[change.before.changeIdx];
|
]?.[change.before.changeIdx];
|
||||||
if (!beforeEntry) {
|
if (!beforeEntry) {
|
||||||
// console.error(
|
|
||||||
// "Insertion before missing op " +
|
|
||||||
// change.before
|
|
||||||
// );
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
beforeEntry.predecessors.splice(0, 0, {
|
beforeEntry.predecessors.splice(0, 0, {
|
||||||
@@ -156,9 +152,6 @@ export class RawCoListView<
|
|||||||
change.after.txIndex
|
change.after.txIndex
|
||||||
]?.[change.after.changeIdx];
|
]?.[change.after.changeIdx];
|
||||||
if (!afterEntry) {
|
if (!afterEntry) {
|
||||||
// console.error(
|
|
||||||
// "Insertion after missing op " + change.after
|
|
||||||
// );
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
afterEntry.successors.push({
|
afterEntry.successors.push({
|
||||||
|
|||||||
@@ -1,11 +1,6 @@
|
|||||||
import { CoValueCore } from "../coValueCore.js";
|
import { CoValueCore } from "../coValueCore.js";
|
||||||
import { JsonObject } from "../jsonValue.js";
|
import { JsonObject } from "../jsonValue.js";
|
||||||
import {
|
import { DeletionOpPayload, OpID, RawCoList } from "./coList.js";
|
||||||
DeletionOpPayload,
|
|
||||||
InsertionOpPayload,
|
|
||||||
OpID,
|
|
||||||
RawCoList,
|
|
||||||
} from "./coList.js";
|
|
||||||
|
|
||||||
export type StringifiedOpID = string & { __stringifiedOpID: true };
|
export type StringifiedOpID = string & { __stringifiedOpID: true };
|
||||||
|
|
||||||
@@ -88,33 +83,22 @@ export class RawCoPlainText<
|
|||||||
text: string,
|
text: string,
|
||||||
privacy: "private" | "trusting" = "private",
|
privacy: "private" | "trusting" = "private",
|
||||||
) {
|
) {
|
||||||
const ops: InsertionOpPayload<string>[] = [];
|
const graphemes = [...this._segmenter.segment(text)].map((g) => g.segment);
|
||||||
let prevOpId: OpID | "start" | undefined = this.mapping.opIDbeforeIdx[idx];
|
|
||||||
if (!prevOpId) {
|
if (idx === 0) {
|
||||||
if (idx === 0) {
|
// For insertions at start, just prepend each character, in reverse
|
||||||
prevOpId = "start";
|
for (const grapheme of graphemes.reverse()) {
|
||||||
} else {
|
this.prepend(grapheme, 0, privacy);
|
||||||
throw new Error("Invalid idx");
|
}
|
||||||
|
} else {
|
||||||
|
// For other insertions, use append after the specified index
|
||||||
|
// We append in forward order to maintain the text order
|
||||||
|
let after = idx - 1;
|
||||||
|
for (const grapheme of graphemes) {
|
||||||
|
this.append(grapheme, after, privacy);
|
||||||
|
after++; // Move the insertion point forward for each grapheme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const nextTxId = this.core.nextTransactionID();
|
|
||||||
let changeIdx = 0;
|
|
||||||
for (const grapheme of this._segmenter.segment(text)) {
|
|
||||||
ops.push({
|
|
||||||
op: "app",
|
|
||||||
value: grapheme.segment,
|
|
||||||
after: prevOpId,
|
|
||||||
});
|
|
||||||
prevOpId = {
|
|
||||||
sessionID: nextTxId.sessionID,
|
|
||||||
txIndex: nextTxId.txIndex,
|
|
||||||
changeIdx,
|
|
||||||
};
|
|
||||||
changeIdx++;
|
|
||||||
}
|
|
||||||
this.core.makeTransaction(ops, privacy);
|
|
||||||
|
|
||||||
this.rebuildFromCore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteRange(
|
deleteRange(
|
||||||
@@ -131,7 +115,6 @@ export class RawCoPlainText<
|
|||||||
op: "del",
|
op: "del",
|
||||||
insertion,
|
insertion,
|
||||||
});
|
});
|
||||||
console.log("deleting idx", idx);
|
|
||||||
let nextIdx = idx + 1;
|
let nextIdx = idx + 1;
|
||||||
while (!this.mapping.opIDbeforeIdx[nextIdx] && nextIdx < to) {
|
while (!this.mapping.opIDbeforeIdx[nextIdx] && nextIdx < to) {
|
||||||
nextIdx++;
|
nextIdx++;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { CoID, RawCoValue } from "../coValue.js";
|
|||||||
import { CoValueCore } from "../coValueCore.js";
|
import { CoValueCore } from "../coValueCore.js";
|
||||||
import { AgentID, SessionID, TransactionID } from "../ids.js";
|
import { AgentID, SessionID, TransactionID } from "../ids.js";
|
||||||
import { JsonObject, JsonValue } from "../jsonValue.js";
|
import { JsonObject, JsonValue } from "../jsonValue.js";
|
||||||
|
import { logger } from "../logger.js";
|
||||||
import { CoValueKnownState } from "../sync.js";
|
import { CoValueKnownState } from "../sync.js";
|
||||||
import { accountOrAgentIDfromSessionID } from "../typeUtils/accountOrAgentIDfromSessionID.js";
|
import { accountOrAgentIDfromSessionID } from "../typeUtils/accountOrAgentIDfromSessionID.js";
|
||||||
import { isAccountID } from "../typeUtils/isAccountID.js";
|
import { isAccountID } from "../typeUtils/isAccountID.js";
|
||||||
@@ -309,7 +310,7 @@ export class RawBinaryCoStreamView<
|
|||||||
const start = items[0];
|
const start = items[0];
|
||||||
|
|
||||||
if (start?.type !== "start") {
|
if (start?.type !== "start") {
|
||||||
console.error("Invalid binary stream start", start);
|
logger.error("Invalid binary stream start", start);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,7 +329,7 @@ export class RawBinaryCoStreamView<
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (item.type !== "chunk") {
|
if (item.type !== "chunk") {
|
||||||
console.error("Invalid binary stream chunk", item);
|
logger.error("Invalid binary stream chunk", item);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,7 +383,6 @@ export class RawBinaryCoStream<
|
|||||||
chunk: Uint8Array,
|
chunk: Uint8Array,
|
||||||
privacy: "private" | "trusting" = "private",
|
privacy: "private" | "trusting" = "private",
|
||||||
): void {
|
): void {
|
||||||
// const before = performance.now();
|
|
||||||
this.push(
|
this.push(
|
||||||
{
|
{
|
||||||
type: "chunk",
|
type: "chunk",
|
||||||
@@ -391,11 +391,6 @@ export class RawBinaryCoStream<
|
|||||||
privacy,
|
privacy,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
// const after = performance.now();
|
|
||||||
// console.log(
|
|
||||||
// "pushBinaryStreamChunk bandwidth in MB/s",
|
|
||||||
// (1000 * chunk.length) / (after - before) / (1024 * 1024)
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
endBinaryStream(privacy: "private" | "trusting" = "private") {
|
endBinaryStream(privacy: "private" | "trusting" = "private") {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
isParentGroupReference,
|
isParentGroupReference,
|
||||||
} from "../ids.js";
|
} from "../ids.js";
|
||||||
import { JsonObject } from "../jsonValue.js";
|
import { JsonObject } from "../jsonValue.js";
|
||||||
|
import { logger } from "../logger.js";
|
||||||
import { AccountRole, Role } from "../permissions.js";
|
import { AccountRole, Role } from "../permissions.js";
|
||||||
import { expectGroup } from "../typeUtils/expectGroup.js";
|
import { expectGroup } from "../typeUtils/expectGroup.js";
|
||||||
import {
|
import {
|
||||||
@@ -153,7 +154,7 @@ export class RawGroup<
|
|||||||
child.state.type === "unavailable"
|
child.state.type === "unavailable"
|
||||||
) {
|
) {
|
||||||
child.loadFromPeers(peers).catch(() => {
|
child.loadFromPeers(peers).catch(() => {
|
||||||
console.error(`Failed to load child group ${id}`);
|
logger.error(`Failed to load child group ${id}`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,7 +322,7 @@ export class RawGroup<
|
|||||||
const secret = this.core.getReadKey(keyID);
|
const secret = this.core.getReadKey(keyID);
|
||||||
|
|
||||||
if (!secret) {
|
if (!secret) {
|
||||||
console.error("Can't find key", keyID);
|
logger.error("Can't find key", keyID);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -701,8 +702,8 @@ export class RawGroup<
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new `CoList` within this group, with the specified specialized
|
* Creates a new `CoPlainText` within this group, with the specified specialized
|
||||||
* `CoList` type `L` and optional static metadata.
|
* `CoPlainText` type `T` and optional static metadata.
|
||||||
*
|
*
|
||||||
* @category 3. Value creation
|
* @category 3. Value creation
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { RawUnknownCoValue } from "./coValue.js";
|
||||||
import type { CoValueCore } from "./coValueCore.js";
|
import type { CoValueCore } from "./coValueCore.js";
|
||||||
import { RawAccount, RawControlledAccount } from "./coValues/account.js";
|
import { RawAccount, RawControlledAccount } from "./coValues/account.js";
|
||||||
import { RawCoList } from "./coValues/coList.js";
|
import { RawCoList } from "./coValues/coList.js";
|
||||||
@@ -38,6 +39,6 @@ export function coreToCoValue(
|
|||||||
return new RawCoStream(core);
|
return new RawCoStream(core);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Unknown coValue type ${core.header.type}`);
|
return new RawUnknownCoValue(core);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { base64URLtoBytes, bytesToBase64url } from "../base64url.js";
|
|||||||
import { RawCoID, TransactionID } from "../ids.js";
|
import { RawCoID, TransactionID } from "../ids.js";
|
||||||
import { Stringified, stableStringify } from "../jsonStringify.js";
|
import { Stringified, stableStringify } from "../jsonStringify.js";
|
||||||
import { JsonValue } from "../jsonValue.js";
|
import { JsonValue } from "../jsonValue.js";
|
||||||
|
import { logger } from "../logger.js";
|
||||||
import {
|
import {
|
||||||
CryptoProvider,
|
CryptoProvider,
|
||||||
Encrypted,
|
Encrypted,
|
||||||
@@ -192,7 +193,7 @@ export class PureJSCrypto extends CryptoProvider<Blake3State> {
|
|||||||
try {
|
try {
|
||||||
return JSON.parse(textDecoder.decode(plaintext));
|
return JSON.parse(textDecoder.decode(plaintext));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Failed to decrypt/parse sealed message", e);
|
logger.error("Failed to decrypt/parse sealed message", e);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import { base64URLtoBytes, bytesToBase64url } from "../base64url.js";
|
|||||||
import { RawCoID, TransactionID } from "../ids.js";
|
import { RawCoID, TransactionID } from "../ids.js";
|
||||||
import { Stringified, stableStringify } from "../jsonStringify.js";
|
import { Stringified, stableStringify } from "../jsonStringify.js";
|
||||||
import { JsonValue } from "../jsonValue.js";
|
import { JsonValue } from "../jsonValue.js";
|
||||||
|
import { logger } from "../logger.js";
|
||||||
import {
|
import {
|
||||||
CryptoProvider,
|
CryptoProvider,
|
||||||
Encrypted,
|
Encrypted,
|
||||||
@@ -240,7 +241,7 @@ export class WasmCrypto extends CryptoProvider<Uint8Array> {
|
|||||||
try {
|
try {
|
||||||
return JSON.parse(textDecoder.decode(plaintext));
|
return JSON.parse(textDecoder.decode(plaintext));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Failed to decrypt/parse sealed message", e);
|
logger.error("Failed to decrypt/parse sealed message", e);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { AgentID, RawCoID, TransactionID } from "../ids.js";
|
|||||||
import { SessionID } from "../ids.js";
|
import { SessionID } from "../ids.js";
|
||||||
import { Stringified, parseJSON, stableStringify } from "../jsonStringify.js";
|
import { Stringified, parseJSON, stableStringify } from "../jsonStringify.js";
|
||||||
import { JsonValue } from "../jsonValue.js";
|
import { JsonValue } from "../jsonValue.js";
|
||||||
|
import { logger } from "../logger.js";
|
||||||
|
|
||||||
export type SignerSecret = `signerSecret_z${string}`;
|
export type SignerSecret = `signerSecret_z${string}`;
|
||||||
export type SignerID = `signer_z${string}`;
|
export type SignerID = `signer_z${string}`;
|
||||||
@@ -159,7 +160,7 @@ export abstract class CryptoProvider<Blake3State = any> {
|
|||||||
try {
|
try {
|
||||||
return parseJSON(this.decryptRaw(encrypted, keySecret, nOnceMaterial));
|
return parseJSON(this.decryptRaw(encrypted, keySecret, nOnceMaterial));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("Decryption error", e);
|
logger.error("Decryption error", e);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -305,10 +306,7 @@ export class StreamingHash {
|
|||||||
|
|
||||||
update(value: JsonValue): Uint8Array {
|
update(value: JsonValue): Uint8Array {
|
||||||
const encoded = textEncoder.encode(stableStringify(value));
|
const encoded = textEncoder.encode(stableStringify(value));
|
||||||
// const before = performance.now();
|
|
||||||
this.state = this.crypto.blake3IncrementalUpdate(this.state, encoded);
|
this.state = this.crypto.blake3IncrementalUpdate(this.state, encoded);
|
||||||
// const after = performance.now();
|
|
||||||
// console.log(`Hashing throughput in MB/s`, 1000 * (encoded.length / (after - before)) / (1024 * 1024));
|
|
||||||
return encoded;
|
return encoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user