Compare commits

...

87 Commits

Author SHA1 Message Date
Anselm Eickhoff
cf5c636fdd Merge pull request #795 from garden-co/changeset-release/main
Version Packages
2024-11-20 10:56:19 +00:00
github-actions[bot]
3f04b75418 Version Packages 2024-11-20 10:55:28 +00:00
Anselm Eickhoff
6a7047f862 Merge pull request #814 from garden-co/benjamin-jazz-506
Add minimal Clerk example
2024-11-20 10:54:29 +00:00
Benjamin S. Leveritt
640559c56f Chore: update pnpm lock 2024-11-20 10:35:22 +00:00
Anselm Eickhoff
9ef6264ff3 Merge pull request #798 from garden-co/JAZZ-498-schema-union-of
SchemaUnion.Of() implementation
2024-11-20 10:31:06 +00:00
Benjamin S. Leveritt
2ac09180a5 Add formatter/linter 2024-11-20 10:07:49 +00:00
Benjamin S. Leveritt
588129b311 Update readme 2024-11-20 09:19:13 +00:00
Benjamin S. Leveritt
0c95d4af0b Add clerk integration 2024-11-20 09:17:20 +00:00
Benjamin S. Leveritt
807846ae79 Add initial minimal app 2024-11-20 08:09:51 +00:00
Anselm
b92b17340e Export SchemaUnion from package 2024-11-19 14:48:11 +00:00
Anselm Eickhoff
0f3d239500 Merge pull request #804 from gardencmp/trishalim-jazz-453
Use sentence case for headings
2024-11-19 12:33:03 +00:00
pax-k
eec30fbcdf fix: SchemaUnion docs 2024-11-19 13:49:27 +02:00
Anselm Eickhoff
f382656d77 Merge pull request #780 from gardencmp/fix/peer-state-delete-on-close
fix(SyncManager): add flag to delete peers on close
2024-11-19 11:45:35 +00:00
Anselm Eickhoff
4d8a6400e0 Merge pull request #759 from gardencmp/gudorsi-jazz-418
feat: retry unavailable coValues
2024-11-19 11:43:12 +00:00
pax
cf5bd53dbb Update .changeset/warm-readers-invite.md
Co-authored-by: Guido D'Orsi <gu.dorsi@gmail.com>
2024-11-19 13:05:19 +02:00
Anselm Eickhoff
66a30e8041 Merge pull request #801 from gardencmp/fuzzyobject-jazz-504
Rename BinaryCoStream to FileStream
2024-11-19 11:02:32 +00:00
Anselm Eickhoff
a4d2f2dd26 Merge pull request #800 from gardencmp/trishalim-jazz-490
Move API reference to top level menu
2024-11-19 10:59:52 +00:00
Guido D'Orsi
5724735a95 chore(sync): improve comment on the unavailable logic 2024-11-19 10:30:07 +01:00
Trisha Lim
5f9c018106 Use sentence case in Jazz Cloud 2024-11-18 20:07:21 +00:00
Trisha Lim
24c018f1f2 Use sentence case in docs 2024-11-18 20:02:38 +00:00
Guido D'Orsi
6f745be39a chore: changeset 2024-11-18 20:53:58 +01:00
Guido D'Orsi
29703797cf chore(retry): remove the retryUnavailableCoValues flag 2024-11-18 20:53:00 +01:00
Marina Orlova
2241ad4089 rename folder back to e2e/BinaryCoStream 2024-11-18 20:07:39 +01:00
Trisha Lim
aed769f7b3 Update Marina's links 2024-11-18 18:47:51 +00:00
Marina Orlova
d348c2d021 Add changeset 2024-11-18 19:05:57 +01:00
Marina Orlova
e5f68904ed Rename BinaryCoStream to FileStream 2024-11-18 19:03:42 +01:00
Trisha Lim
0aebbdc2fc Fix placement of sticky bar 2024-11-18 17:07:58 +00:00
Trisha Lim
665a099013 Fix TOC placement 2024-11-18 17:07:58 +00:00
Trisha Lim
c70131aece Change references to api reference route 2024-11-18 17:07:56 +00:00
Trisha Lim
d78f590712 Reuse docs layout 2024-11-18 17:07:39 +00:00
Trisha Lim
7033ae968f Move API reference to top level menu 2024-11-18 17:07:39 +00:00
Guido D'Orsi
124bf670a2 chore: changeset 2024-11-18 17:52:15 +01:00
pax-k
f4acb91d51 fix: ignore type error 2024-11-18 18:52:05 +02:00
pax-k
47a5047ec8 chore: pnpm lock 2024-11-18 18:51:51 +02:00
pax-k
877596f389 chore: added typedoc for SchemaUnion 2024-11-18 18:44:34 +02:00
Marina Orlova
6902b5bb91 Add changeset for Rename CoStream to CoFeed 2024-11-18 17:38:17 +01:00
pax-k
e914f11d9e fix: export schemaUnion 2024-11-18 18:37:54 +02:00
pax-k
1a0cd3df7f chore: changeset 2024-11-18 18:33:58 +02:00
pax-k
d9a78739a5 feat: implemented SchemaUnion.Of() 2024-11-18 18:33:29 +02:00
Anselm Eickhoff
756528e18e Merge pull request #790 from gardencmp/trishalim-jazz-474
Fix: page reloads when clicking a link inside mdx
2024-11-18 15:12:11 +00:00
Anselm Eickhoff
466e587fba Merge pull request #794 from gardencmp/benjamin-jazz-502
PassphraseAuth - Move saving credentials into `saveCredentials`
2024-11-18 15:11:35 +00:00
Anselm Eickhoff
22caae870d Merge pull request #789 from gardencmp/docs/getting-started
Rewrite docs introduction
2024-11-18 15:10:59 +00:00
Anselm Eickhoff
435fc0c917 Merge pull request #768 from gardencmp/fuzzyobject-jazz-491
Enhance onboarding test - add page context
2024-11-18 15:05:52 +00:00
Anselm Eickhoff
3dfce294d4 Merge pull request #777 from gardencmp/benjamin-jazz-481
Fix readme for jazz-react-auth-clerk
2024-11-18 15:05:18 +00:00
Anselm Eickhoff
90be185094 Merge pull request #784 from gardencmp/vscode-settings
chore: remove .vscode/settings.json and add it to .gitignore
2024-11-18 15:04:46 +00:00
Anselm Eickhoff
9eac8633b5 Merge pull request #792 from gardencmp/benjamin-jazz-495
Fix PasskeyAuth forgetting authentication on reload
2024-11-18 15:04:30 +00:00
Anselm Eickhoff
007c462362 Merge pull request #783 from gardencmp/benjamin-jazz-497
Tweak 'Docs coming soon' copy
2024-11-18 15:03:41 +00:00
Benjamin S. Leveritt
e442bb820b Add changeset 2024-11-18 14:35:58 +00:00
Benjamin S. Leveritt
3f7235c6f7 Moves saving credentials into saveCredentials
To match other implementations
2024-11-18 14:21:43 +00:00
Benjamin S. Leveritt
56d94bd8cd Add saveCredentials on successful login 2024-11-18 13:55:29 +00:00
Anselm Eickhoff
cb937c4335 Merge pull request #757 from gardencmp/fuzzyobject-jazz-460
Rename CoStream to CoFeed
2024-11-18 13:45:14 +00:00
Trisha Lim
b4e31657a0 Fix typo 2024-11-18 12:36:39 +00:00
Trisha Lim
f6bf75890a fix: page reloads when clicking a link inside mdx 2024-11-18 12:16:37 +00:00
Trisha Lim
5bb1ad4c42 Move vue up the nav 2024-11-18 12:05:45 +00:00
Trisha Lim
3ed74b6b1d Write intro in react guide 2024-11-18 12:00:34 +00:00
Trisha Lim
823a343fe1 Rewrite docs intro page 2024-11-18 11:56:29 +00:00
Guido D'Orsi
5b3c3fff7b chore: remove .vscode/settings.json and add it to .gitignore 2024-11-18 11:46:43 +01:00
Benjamin S. Leveritt
e3f1c49fdd Tweak copy 2024-11-18 10:10:50 +00:00
Guido D'Orsi
42765020e5 fix(SyncManager): add flag to delete peers on close 2024-11-18 10:35:38 +01:00
Benjamin S. Leveritt
6cc7a905f8 Fix readme 2024-11-18 09:06:42 +00:00
Guido D'Orsi
75753f1d37 chore(CoValueState): simplify the dispatch action 2024-11-18 01:22:46 +01:00
Guido D'Orsi
6c113e7bf0 chore(CoValueState): improve comments 2024-11-18 01:12:22 +01:00
Guido D'Orsi
53a74e1b7d Merge pull request #775 from gardencmp/feature/-co-value-store
chore(LocalNode): move the coValues states management in a CoValueStore
2024-11-18 00:35:26 +01:00
Guido D'Orsi
c63b538251 chore(LocalNode): move the coValues states management in a CoValueStore 2024-11-18 00:34:44 +01:00
Guido D'Orsi
f8c3b495e0 chore(CoValueState): improve the internal state transition management 2024-11-18 00:19:31 +01:00
Guido D'Orsi
a05d90dc6b chore(CoValueState): remove resolution property because unused 2024-11-18 00:02:13 +01:00
Guido D'Orsi
307e7fcd3c fix(coValueState): keep the value consistent with the current state 2024-11-17 23:57:40 +01:00
Guido D'Orsi
d0ff589447 fix(found-in-peer): always set the state to available 2024-11-17 16:01:20 +01:00
Guido D'Orsi
f6cb4f1225 chore(sync): improve the noElegiblePeers handling in handleKnownState 2024-11-17 15:28:18 +01:00
Guido D'Orsi
1141a23a37 chore(CoValueState): move all the state updates in the dispatch function 2024-11-17 15:01:17 +01:00
Guido D'Orsi
05497d5f77 perf(loadFromPeers): exit early if the value is resolved in between retries 2024-11-16 20:43:28 +01:00
Guido D'Orsi
bb126009c8 fix(coValueState): check if the coValue has become available in between of the retries 2024-11-16 19:28:57 +01:00
Guido D'Orsi
cee7beb02a chore(sync): add a comment on the not-found logic 2024-11-16 15:11:16 +01:00
Guido D'Orsi
5f12e31a80 test(onboarding): increase the waiting to 3s 2024-11-16 14:52:38 +01:00
Guido D'Orsi
5f96a6fef2 choe(onboarding): remove the local sync logic from the playwright config and support peer override in the app 2024-11-16 14:39:52 +01:00
Guido D'Orsi
08db39ef2f test(onboarding): move the timeout waiting before the invite navigation 2024-11-16 14:38:53 +01:00
Guido D'Orsi
67029e00c7 test: add the unavailable retry e2e test 2024-11-16 13:19:06 +01:00
Marina Orlova
2b520e938e Take out acceptInvite 2024-11-16 13:16:31 +01:00
Marina Orlova
63568273db Take out acceptInvite 2024-11-16 13:12:29 +01:00
Marina Orlova
16702702c8 fix onboarding test - add context 2024-11-16 13:12:29 +01:00
Guido D'Orsi
cab4f1f89c chore: remove the waitForCoValue workaround from the example apps 2024-11-16 12:51:05 +01:00
Guido D'Orsi
45df82ed16 feat: retry unavailable coValues 2024-11-16 12:46:40 +01:00
Guido D'Orsi
6610aea708 Merge pull request #761 from gardencmp/changeset-release/main
Version Packages
2024-11-15 20:30:51 +01:00
github-actions[bot]
f6b6c01852 Version Packages 2024-11-15 18:40:37 +00:00
Trisha Lim
63f9aa6b97 fix: active route styling on docs 2024-11-15 18:39:20 +00:00
Marina Orlova
b38f902d70 Add backward-compatible aliases for CoFeed* 2024-11-14 22:30:58 +01:00
Marina Orlova
a6085094a7 Rename CoStream -> CoFeed in jazz-tools 2024-11-14 18:57:44 +01:00
161 changed files with 2875 additions and 884 deletions

View File

@@ -1,5 +0,0 @@
---
"jazz-browser": patch
---
Reuse the crypto instance between OPFS and the jazz context

View File

@@ -1,5 +0,0 @@
---
"cojson-storage-indexeddb": patch
---
Set up a unique peer id for the indexeddb storage

View File

@@ -1,7 +0,0 @@
---
"chat-vue": patch
"todo-vue": patch
"jazz-vue": patch
---
fix useCoState reactivity

View File

@@ -1,5 +0,0 @@
---
"jazz-react": patch
---
Trigger invite accept on hashchange

4
.gitignore vendored
View File

@@ -15,4 +15,6 @@ coverage
# Playwright
test-results
.husky
.husky
.vscode/settings.json

View File

@@ -1,3 +0,0 @@
{
"editor.defaultFormatter": "biomejs.biome"
}

View File

@@ -1,5 +1,25 @@
# @jazz-e2e/binarycostream
## 0.0.101
### Patch Changes
- Updated dependencies [6f745be]
- Updated dependencies [d348c2d]
- Updated dependencies [124bf67]
- Updated dependencies [6902b5b]
- Updated dependencies [1a0cd3d]
- cojson@0.8.23
- jazz-tools@0.8.23
- jazz-react@0.8.23
## 0.0.100
### Patch Changes
- Updated dependencies [59cc64d]
- jazz-react@0.8.22
## 0.0.99
### Patch Changes

View File

@@ -5,7 +5,7 @@
<link rel="icon" type="image/png" href="/jazz-logo.png" />
<link rel="stylesheet" href="/src/index.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Jazz BinaryCoStream Tests</title>
<title>Jazz FileStream Tests</title>
</head>
<body>
<div id="root"></div>

View File

@@ -1,7 +1,7 @@
{
"name": "@jazz-e2e/binarycostream",
"name": "@jazz-e2e/filestream",
"private": true,
"version": "0.0.99",
"version": "0.0.101",
"type": "module",
"scripts": {
"dev": "vite",
@@ -13,11 +13,11 @@
"test:ui": "playwright test --ui"
},
"dependencies": {
"cojson": "workspace:0.8.21",
"cojson": "workspace:0.8.23",
"hash-slash": "workspace:0.2.1",
"is-ci": "^3.0.1",
"jazz-react": "workspace:0.8.21",
"jazz-tools": "workspace:0.8.21",
"jazz-react": "workspace:0.8.23",
"jazz-tools": "workspace:0.8.23",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},

View File

@@ -1,21 +1,18 @@
import { Account, BinaryCoStream, ID } from "jazz-tools";
import { Account, FileStream, ID } from "jazz-tools";
import { useEffect } from "react";
import { useAccount, useCoState } from "./jazz";
import { waitForCoValue } from "./lib/waitForCoValue";
import { UploadedFile } from "./schema";
async function getUploadedFile(me: Account, uploadedFileId: ID<UploadedFile>) {
const uploadedFile = await waitForCoValue(
UploadedFile,
uploadedFileId,
me,
Boolean,
{},
);
const uploadedFile = await UploadedFile.load(uploadedFileId, me, {});
if (!uploadedFile) {
throw new Error("Uploaded file not found");
}
uploadedFile.coMapDownloaded = true;
await BinaryCoStream.loadAsBlob(uploadedFile._refs.file.id, me);
await FileStream.loadAsBlob(uploadedFile._refs.file.id, me);
return uploadedFile;
}

View File

@@ -1,4 +1,4 @@
import { Account, BinaryCoStream, Group } from "jazz-tools";
import { Account, FileStream, Group } from "jazz-tools";
import { UploadedFile } from "../schema";
export async function generateTestFile(me: Account, bytes: number) {
@@ -8,7 +8,7 @@ export async function generateTestFile(me: Account, bytes: number) {
const ownership = { owner: group };
const testFile = UploadedFile.create(
{
file: await BinaryCoStream.createFromBlob(
file: await FileStream.createFromBlob(
new Blob(["1".repeat(bytes)], { type: "image/png" }),
ownership,
),

View File

@@ -1,7 +1,7 @@
import { BinaryCoStream, CoMap, co } from "jazz-tools";
import { CoMap, FileStream, co } from "jazz-tools";
export class UploadedFile extends CoMap {
file = co.ref(BinaryCoStream);
file = co.ref(FileStream);
syncCompleted = co.boolean;
coMapDownloaded = co.boolean;
}

View File

@@ -1,5 +1,25 @@
# @jazz-e2e/covalues
## 0.0.100
### Patch Changes
- Updated dependencies [6f745be]
- Updated dependencies [d348c2d]
- Updated dependencies [124bf67]
- Updated dependencies [6902b5b]
- Updated dependencies [1a0cd3d]
- cojson@0.8.23
- jazz-tools@0.8.23
- jazz-react@0.8.23
## 0.0.99
### Patch Changes
- Updated dependencies [59cc64d]
- jazz-react@0.8.22
## 0.0.98
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "@jazz-e2e/covalues",
"private": true,
"version": "0.0.98",
"version": "0.0.100",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -3,6 +3,7 @@ import ReactDOM from "react-dom/client";
import { RouterProvider, createBrowserRouter } from "react-router-dom";
import { AuthAndJazz } from "./jazz";
import { ResumeSyncState } from "./pages/ResumeSyncState";
import { RetryUnavailable } from "./pages/RetryUnavailable";
import { TestInput } from "./pages/TestInput";
const router = createBrowserRouter([
@@ -14,6 +15,10 @@ const router = createBrowserRouter([
path: "/resume-sync",
element: <ResumeSyncState />,
},
{
path: "/retry-unavailable",
element: <RetryUnavailable />,
},
{
path: "/",
element: <TestInput />,

View File

@@ -0,0 +1,46 @@
import { CoMap, Group, ID, co } from "jazz-tools";
import { useEffect, useState } from "react";
import { useAccount, useCoState } from "../jazz";
export class RetryUnavailableCoMap extends CoMap {
value = co.string;
}
function getIdParam() {
const url = new URL(window.location.href);
return (url.searchParams.get("id") as ID<RetryUnavailableCoMap>) ?? undefined;
}
export function RetryUnavailable() {
const [id, setId] = useState(getIdParam);
const coMap = useCoState(RetryUnavailableCoMap, id);
const { me } = useAccount();
useEffect(() => {
if (id) {
const url = new URL(window.location.href);
url.searchParams.set("id", id);
history.pushState({}, "", url.toString());
}
}, [id]);
const createCoMap = () => {
if (!me || id) return;
const group = Group.create({ owner: me });
group.addMember("everyone", "writer");
setId(
RetryUnavailableCoMap.create({ value: "Hello!" }, { owner: group }).id,
);
};
return (
<div>
<h1>Retry Unavailable</h1>
<p data-testid="id">{coMap?.id}</p>
<button onClick={createCoMap}>Create a new value!</button>
</div>
);
}

View File

@@ -0,0 +1,34 @@
import { setTimeout } from "node:timers/promises";
import { expect, test } from "@playwright/test";
test.describe("Retry unavailable states", () => {
test("should retry unavailable values", async ({ page, browser }) => {
const context = page.context();
await page.goto("/retry-unavailable?userName=SuperMario");
await context.setOffline(true);
await page.getByRole("button", { name: "Create a new value!" }).click();
const id = await page.getByTestId("id").textContent();
// Create a new incognito instance and try to load the coValue
const newUserPage = await (await browser.newContext()).newPage();
await newUserPage.goto(`/retry-unavailable?userName=Luigi&id=${id}`);
await expect(newUserPage.getByTestId("id")).toBeInViewport({
timeout: 20_000,
});
// Make the load fail at least twice
await setTimeout(1000);
// Go back online, the value should be uploaded
await context.setOffline(false);
await expect(newUserPage.getByTestId("id")).toHaveText(id ?? "", {
timeout: 20_000,
});
});
});

View File

@@ -1,5 +1,24 @@
# jazz-example-book-shelf
## 0.1.16
### Patch Changes
- Updated dependencies [d348c2d]
- Updated dependencies [6902b5b]
- Updated dependencies [1a0cd3d]
- jazz-tools@0.8.23
- jazz-react@0.8.23
- jazz-browser-media-images@0.8.23
## 0.1.15
### Patch Changes
- Updated dependencies [59cc64d]
- jazz-react@0.8.22
- jazz-browser-media-images@0.8.22
## 0.1.14
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "jazz-example-book-shelf",
"version": "0.1.14",
"version": "0.1.16",
"private": true,
"scripts": {
"dev": "next dev",
@@ -11,9 +11,9 @@
},
"dependencies": {
"clsx": "^2.0.0",
"jazz-browser-media-images": "workspace:0.8.21",
"jazz-react": "workspace:0.8.21",
"jazz-tools": "workspace:0.8.21",
"jazz-browser-media-images": "workspace:0.8.23",
"jazz-react": "workspace:0.8.23",
"jazz-tools": "workspace:0.8.23",
"next": "14.2.5",
"react": "^18.2.0",
"react-dom": "^18.2.0"

View File

@@ -1,5 +1,27 @@
# jazz-example-chat
## 0.0.100
### Patch Changes
- Updated dependencies [6f745be]
- Updated dependencies [d348c2d]
- Updated dependencies [124bf67]
- Updated dependencies [6902b5b]
- Updated dependencies [1a0cd3d]
- cojson@0.8.23
- jazz-tools@0.8.23
- jazz-react@0.8.23
- jazz-react-auth-clerk@0.8.23
## 0.0.99
### Patch Changes
- Updated dependencies [59cc64d]
- jazz-react@0.8.22
- jazz-react-auth-clerk@0.8.22
## 0.0.98
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-chat-clerk",
"private": true,
"version": "0.0.98",
"version": "0.0.100",
"type": "module",
"scripts": {
"dev": "vite",
@@ -17,11 +17,11 @@
"@radix-ui/react-toast": "^1.1.4",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"cojson": "workspace:0.8.21",
"cojson": "workspace:0.8.23",
"hash-slash": "workspace:0.2.1",
"jazz-react": "workspace:0.8.21",
"jazz-react-auth-clerk": "workspace:0.8.21",
"jazz-tools": "workspace:0.8.21",
"jazz-react": "workspace:0.8.23",
"jazz-react-auth-clerk": "workspace:0.8.23",
"jazz-tools": "workspace:0.8.23",
"lucide-react": "^0.274.0",
"qrcode": "^1.5.3",
"react": "^18.2.0",

View File

@@ -1,5 +1,23 @@
# chat-rn-clerk
## 1.0.16
### Patch Changes
- Updated dependencies [d348c2d]
- Updated dependencies [6902b5b]
- Updated dependencies [1a0cd3d]
- jazz-tools@0.8.23
- jazz-react-auth-clerk@0.8.23
- jazz-react-native@0.8.23
- jazz-react-native-media-images@0.8.18
## 1.0.15
### Patch Changes
- jazz-react-auth-clerk@0.8.22
## 1.0.14
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "chat-rn-clerk",
"main": "index.js",
"version": "1.0.14",
"version": "1.0.16",
"scripts": {
"build": "expo export -p ios",
"start": "expo start",

View File

@@ -1,5 +1,15 @@
# chat-rn
## 1.0.17
### Patch Changes
- Updated dependencies [d348c2d]
- Updated dependencies [6902b5b]
- Updated dependencies [1a0cd3d]
- jazz-tools@0.8.23
- jazz-react-native@0.8.23
## 1.0.16
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "chat-rn",
"version": "1.0.16",
"version": "1.0.17",
"main": "index.js",
"scripts": {
"build": "expo export -p ios",

View File

@@ -1,5 +1,27 @@
# chat-vue
## 0.0.8
### Patch Changes
- Updated dependencies [d348c2d]
- Updated dependencies [e442bb8]
- Updated dependencies [6902b5b]
- Updated dependencies [1a0cd3d]
- jazz-tools@0.8.23
- jazz-browser@0.8.23
- jazz-vue@0.8.13
## 0.0.7
### Patch Changes
- a734530: fix useCoState reactivity
- Updated dependencies [f6bc8af]
- Updated dependencies [a734530]
- jazz-browser@0.8.22
- jazz-vue@0.8.12
## 0.0.6
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "chat-vue",
"version": "0.0.6",
"version": "0.0.8",
"private": true,
"type": "module",
"scripts": {

View File

@@ -1,5 +1,25 @@
# jazz-example-chat
## 0.0.102
### Patch Changes
- Updated dependencies [6f745be]
- Updated dependencies [d348c2d]
- Updated dependencies [124bf67]
- Updated dependencies [6902b5b]
- Updated dependencies [1a0cd3d]
- cojson@0.8.23
- jazz-tools@0.8.23
- jazz-react@0.8.23
## 0.0.101
### Patch Changes
- Updated dependencies [59cc64d]
- jazz-react@0.8.22
## 0.0.100
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-chat",
"private": true,
"version": "0.0.100",
"version": "0.0.102",
"type": "module",
"scripts": {
"dev": "vite",
@@ -18,10 +18,10 @@
"@radix-ui/react-toast": "^1.1.4",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"cojson": "workspace:0.8.21",
"cojson": "workspace:0.8.23",
"hash-slash": "workspace:0.2.1",
"jazz-react": "workspace:0.8.21",
"jazz-tools": "workspace:0.8.21",
"jazz-react": "workspace:0.8.23",
"jazz-tools": "workspace:0.8.23",
"lucide-react": "^0.274.0",
"qrcode": "^1.5.3",
"react": "^18.2.0",

View File

@@ -1,5 +1,14 @@
# jazz-example-inspector
## 0.0.74
### Patch Changes
- Updated dependencies [6f745be]
- Updated dependencies [124bf67]
- cojson@0.8.23
- cojson-transport-ws@0.8.23
## 0.0.73
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-inspector",
"private": true,
"version": "0.0.73",
"version": "0.0.74",
"type": "module",
"scripts": {
"dev": "vite",
@@ -16,8 +16,8 @@
"@radix-ui/react-toast": "^1.1.4",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"cojson": "workspace:0.8.21",
"cojson-transport-ws": "workspace:0.8.21",
"cojson": "workspace:0.8.23",
"cojson-transport-ws": "workspace:0.8.23",
"hash-slash": "workspace:0.2.1",
"lucide-react": "^0.274.0",
"qrcode": "^1.5.3",

View File

@@ -0,0 +1 @@
VITE_CLERK_PUBLISHABLE_KEY=pk_test_ZXZpZGVudC1kYW5lLTg5LmNsZXJrLmFjY291bnRzLmRldiQ

24
examples/minimal-auth-clerk/.gitignore vendored Normal file
View File

@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@@ -0,0 +1,12 @@
# minimal-auth-clerk
## 0.0.1
### Patch Changes
- Updated dependencies [d348c2d]
- Updated dependencies [6902b5b]
- Updated dependencies [1a0cd3d]
- jazz-tools@0.8.23
- jazz-react@0.8.23
- jazz-react-auth-clerk@0.8.23

View File

@@ -0,0 +1,3 @@
# Minimal Jazz Auth Clerk Example
This is a minimal example of how to use Clerk authentication with Jazz.

View File

@@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Minimal Auth Clerk Example | Jazz</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

View File

@@ -0,0 +1,30 @@
{
"name": "minimal-auth-clerk",
"private": true,
"version": "0.0.1",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"preview": "vite preview",
"format-and-lint": "biome check .",
"format-and-lint:fix": "biome check . --write"
},
"dependencies": {
"@clerk/clerk-react": "^5.4.1",
"jazz-tools": "workspace:*",
"jazz-react": "workspace:*",
"jazz-react-auth-clerk": "workspace:0.8.23",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.3",
"globals": "^15.11.0",
"typescript": "~5.6.2",
"vite": "^5.4.10"
}
}

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,42 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
transition: filter 300ms;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}
@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}
.card {
padding: 2em;
}
.read-the-docs {
color: #888;
}

View File

@@ -0,0 +1,16 @@
import "./App.css";
import { useAccount } from "./main";
function App() {
const { me, logOut } = useAccount();
return (
<>
<h1>You're logged in</h1>
<p>Welcome back, {me?.profile?.name}</p>
<button onClick={() => logOut()}>Logout</button>
</>
);
}
export default App;

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -0,0 +1,68 @@
:root {
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
line-height: 1.5;
font-weight: 400;
color-scheme: light dark;
color: rgba(255, 255, 255, 0.87);
background-color: #242424;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a {
font-weight: 500;
color: #646cff;
text-decoration: inherit;
}
a:hover {
color: #535bf2;
}
body {
margin: 0;
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
}
h1 {
font-size: 3.2em;
line-height: 1.1;
}
button {
border-radius: 8px;
border: 1px solid transparent;
padding: 0.6em 1.2em;
font-size: 1em;
font-weight: 500;
font-family: inherit;
background-color: #1a1a1a;
cursor: pointer;
transition: border-color 0.25s;
}
button:hover {
border-color: #646cff;
}
button:focus,
button:focus-visible {
outline: 4px auto -webkit-focus-ring-color;
}
@media (prefers-color-scheme: light) {
:root {
color: #213547;
background-color: #ffffff;
}
a:hover {
color: #747bff;
}
button {
background-color: #f9f9f9;
}
}

View File

@@ -0,0 +1,50 @@
import { ClerkProvider, SignInButton, useClerk } from "@clerk/clerk-react";
import { createJazzReactApp } from "jazz-react";
import { useJazzClerkAuth } from "jazz-react-auth-clerk";
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import App from "./App.tsx";
import "./index.css";
// Import your publishable key
const PUBLISHABLE_KEY = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY;
if (!PUBLISHABLE_KEY) {
throw new Error("Add your Clerk publishable key to the .env.local file");
}
const Jazz = createJazzReactApp();
export const { useAccount, useCoState } = Jazz;
function JazzAndAuth({ children }: { children: React.ReactNode }) {
const clerk = useClerk();
const [auth, state] = useJazzClerkAuth(clerk);
return (
<>
{state?.errors?.map((error) => (
<div key={error}>{error}</div>
))}
{clerk.user && auth ? (
<Jazz.Provider
auth={auth}
peer="wss://cloud.jazz.tools/?key=minimal-auth-clerk-example@gcmp.io"
>
{children}
</Jazz.Provider>
) : (
<SignInButton />
)}
</>
);
}
createRoot(document.getElementById("root")!).render(
<StrictMode>
<ClerkProvider publishableKey={PUBLISHABLE_KEY} afterSignOutUrl="/">
<JazzAndAuth>
<App />
</JazzAndAuth>
</ClerkProvider>
</StrictMode>,
);

View File

@@ -0,0 +1 @@
/// <reference types="vite/client" />

View File

@@ -0,0 +1,24 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2020",
"useDefineForClassFields": true,
"lib": ["ES2023", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
"moduleResolution": "Bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["src"]
}

View File

@@ -0,0 +1,7 @@
{
"files": [],
"references": [
{ "path": "./tsconfig.app.json" },
{ "path": "./tsconfig.node.json" }
]
}

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2022",
"lib": ["ES2023"],
"module": "ESNext",
"skipLibCheck": true,
"moduleResolution": "Bundler",
"allowImportingTsExtensions": true,
"isolatedModules": true,
"moduleDetection": "force",
"noEmit": true,
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["vite.config.ts"]
}

View File

@@ -0,0 +1,7 @@
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
});

View File

@@ -1,5 +1,22 @@
# jazz-example-musicplayer
## 0.0.22
### Patch Changes
- Updated dependencies [d348c2d]
- Updated dependencies [6902b5b]
- Updated dependencies [1a0cd3d]
- jazz-tools@0.8.23
- jazz-react@0.8.23
## 0.0.21
### Patch Changes
- Updated dependencies [59cc64d]
- jazz-react@0.8.22
## 0.0.20
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-music-player",
"private": true,
"version": "0.0.20",
"version": "0.0.22",
"type": "module",
"scripts": {
"dev": "vite",
@@ -18,8 +18,8 @@
"@radix-ui/react-toast": "^1.1.4",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"jazz-react": "workspace:0.8.21",
"jazz-tools": "workspace:0.8.21",
"jazz-react": "workspace:0.8.23",
"jazz-tools": "workspace:0.8.23",
"lucide-react": "^0.274.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",

View File

@@ -1,11 +1,4 @@
import {
Account,
BinaryCoStream,
CoList,
CoMap,
Profile,
co,
} from "jazz-tools";
import { Account, CoList, CoMap, FileStream, Profile, co } from "jazz-tools";
/** Walkthrough: Defining the data model with CoJSON
*
@@ -36,12 +29,12 @@ export class MusicTrack extends CoMap {
sourceTrack = co.optional.ref(MusicTrack);
/**
* In Jazz you can files using BinaryCoStream.
* In Jazz you can upload files using FileStream.
*
* As for any other coValue the music files we put inside BinaryCoStream
* As for any other coValue the music files we put inside FileStream
* is available offline and end-to-end encrypted 😉
*/
file = co.ref(BinaryCoStream);
file = co.ref(FileStream);
waveform = co.ref(MusicTrackWaveform);
}

View File

@@ -1,5 +1,5 @@
import { getAudioFileData } from "@/lib/audio/getAudioFileData";
import { BinaryCoStream, Group } from "jazz-tools";
import { FileStream, Group } from "jazz-tools";
import {
ListOfTracks,
MusicTrack,
@@ -35,14 +35,14 @@ export async function uploadMusicTracks(
for (const file of files) {
const data = await getAudioFileData(file);
// We transform the file blob into a BinaryCoStream
// We transform the file blob into a FileStream
// making it a collaborative value that is encrypted, easy
// to share across devices and users and available offline!
const binaryCoStream = await BinaryCoStream.createFromBlob(file, ownership);
const fileStream = await FileStream.createFromBlob(file, ownership);
const musicTrack = MusicTrack.create(
{
file: binaryCoStream,
file: fileStream,
duration: data.duration,
waveform: MusicTrackWaveform.create({ data: data.waveform }, ownership),
title: file.name,
@@ -98,7 +98,7 @@ export async function addTrackToPlaylist(
* won't need to clone values to have this kind of sharing granularity
*/
const ownership = { owner: playlist._owner };
const blob = await BinaryCoStream.loadAsBlob(track._refs.file.id, account);
const blob = await FileStream.loadAsBlob(track._refs.file.id, account);
const waveform = await MusicTrackWaveform.load(
track._refs.waveform.id,
account,
@@ -109,7 +109,7 @@ export async function addTrackToPlaylist(
const trackClone = MusicTrack.create(
{
file: await BinaryCoStream.createFromBlob(blob, ownership),
file: await FileStream.createFromBlob(blob, ownership),
duration: track.duration,
waveform: MusicTrackWaveform.create({ data: waveform.data }, ownership),
title: track.title,

View File

@@ -1,7 +1,7 @@
import { MusicTrack, Playlist } from "@/1_schema";
import { usePlayMedia } from "@/lib/audio/usePlayMedia";
import { usePlayState } from "@/lib/audio/usePlayState";
import { BinaryCoStream, ID } from "jazz-tools";
import { FileStream, ID } from "jazz-tools";
import { useRef, useState } from "react";
import { useAccount } from "./2_main";
import { updateActivePlaylist, updateActiveTrack } from "./4_actions";
@@ -27,7 +27,7 @@ export function useMediaPlayer() {
setLoading(track.id);
const file = await BinaryCoStream.loadAsBlob(track._refs.file.id, me);
const file = await FileStream.loadAsBlob(track._refs.file.id, me);
if (!file) {
setLoading(null);

View File

@@ -0,0 +1,20 @@
# jazz-example-onboarding
## 0.0.3
### Patch Changes
- Updated dependencies [d348c2d]
- Updated dependencies [6902b5b]
- Updated dependencies [1a0cd3d]
- jazz-tools@0.8.23
- jazz-react@0.8.23
- jazz-browser-media-images@0.8.23
## 0.0.2
### Patch Changes
- Updated dependencies [59cc64d]
- jazz-react@0.8.22
- jazz-browser-media-images@0.8.22

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-onboarding",
"private": true,
"version": "0.0.1",
"version": "0.0.3",
"type": "module",
"scripts": {
"dev": "vite",

View File

@@ -20,7 +20,7 @@ export default defineConfig({
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: "http://localhost:5173/?peer=ws://localhost:1234",
baseURL: "http://localhost:5173/",
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
@@ -42,10 +42,5 @@ export default defineConfig({
url: "http://localhost:5173/",
reuseExistingServer: !isCI,
},
{
command: "pnpm sync --in-memory --port 1234",
url: "http://localhost:1234/health",
reuseExistingServer: !isCI,
},
],
});

View File

@@ -1,5 +1,5 @@
import { Button } from "@/components/Button.tsx";
import { useAccount, useCoState } from "@/main.tsx";
import { useAcceptInvite, useAccount, useCoState } from "@/main.tsx";
import { EmployeeList } from "@/pages/EmployeeList.tsx";
import { EmployeeOnboading } from "@/pages/EmployeeOnboarding.tsx";
import { NewEmployee } from "@/pages/NewEmployee.tsx";
@@ -8,7 +8,7 @@ import { ID } from "jazz-tools";
import { useEffect } from "react";
import {
RouterProvider,
createBrowserRouter,
createHashRouter,
useNavigate,
useParams,
} from "react-router-dom";
@@ -36,11 +36,24 @@ function ImportEmployee({
return <div>Importing Employee ${employeeCoId} ...</div>;
}
function AcceptInvite() {
const navigate = useNavigate();
useAcceptInvite({
invitedObjectSchema: CoEmployee,
onAccept: (employeeCoId) => {
navigate(`/import/${employeeCoId}`);
},
});
return <p>Accepting invite...</p>;
}
function App() {
const { me, logOut } = useAccount();
const employeeCoListId = me.profile?._refs.employees.id;
const router = createBrowserRouter([
const router = createHashRouter([
{
path: "/",
element: <EmployeeList employeeListCoId={employeeCoListId} />,
@@ -57,6 +70,10 @@ function App() {
path: "/import/:employeeCoId",
element: <ImportEmployee employeeListCoId={employeeCoListId} />,
},
{
path: "/invite/*",
element: <AcceptInvite />,
},
]);
return (

View File

@@ -10,15 +10,17 @@ const Jazz = createJazzReactApp({
});
export const { useAccount, useCoState, useAcceptInvite } = Jazz;
const peer =
(new URL(window.location.href).searchParams.get(
"peer",
) as `ws://${string}`) ??
"wss://cloud.jazz.tools/?key=onboarding-example-jazz@gcmp.io";
function JazzAndAuth({ children }: { children: React.ReactNode }) {
const [auth, authState] = useDemoAuth();
return (
<>
<Jazz.Provider
auth={auth}
// replace `you@example.com` with your email as a temporary API key
peer="wss://cloud.jazz.tools/?key=you@example.com"
>
<Jazz.Provider auth={auth} peer={peer}>
{children}
</Jazz.Provider>
{authState.state !== "signedIn" && (

View File

@@ -2,13 +2,12 @@ import { Button } from "@/components/Button.tsx";
import { NavigateBack } from "@/components/NavigateBack.tsx";
import { Stack } from "@/components/Stack.tsx";
import { TextInput } from "@/components/TextInput.tsx";
import { useAcceptInvite, useCoState } from "@/main.tsx";
import { useCoState } from "@/main.tsx";
import { createImage } from "jazz-browser-media-images";
import { ProgressiveImg, createInviteLink } from "jazz-react";
import { CoMap, ID } from "jazz-tools";
import { ChangeEvent, ReactNode, useCallback } from "react";
import { useParams } from "react-router";
import { useNavigate } from "react-router-dom";
import {
CoDocUploadStep,
CoEmployee,
@@ -173,17 +172,9 @@ const ConfirmationCard = ({
export function EmployeeOnboading() {
const { employeeCoId } = useParams();
const navigate = useNavigate();
const employee = useCoState(CoEmployee, employeeCoId as ID<CoEmployee>, {});
useAcceptInvite({
invitedObjectSchema: CoEmployee,
onAccept: (employeeCoId) => {
navigate(`/import/${employeeCoId}`);
},
});
const handleInviteLinkCreation = useCallback(
(role: "reader" | "writer") => {
if (!employee) return;

View File

@@ -1,4 +1,11 @@
import { Page, expect, test } from "@playwright/test";
import {
Browser,
BrowserContext,
Page,
chromium,
expect,
test,
} from "@playwright/test";
import { EmployeeOnboardingPage } from "./pages/EmployeeOnboardingPage";
import { HomePage } from "./pages/HomePage";
import { LoginPage } from "./pages/LoginPage";
@@ -29,60 +36,82 @@ const login = async ({
};
test.describe("Admin onboarding flow", () => {
test("Create and delete flow", async ({ page }) => {
await login({ page, userName: "HR specialist" });
let browser: Browser;
let adminContext: BrowserContext;
let writerContext: BrowserContext;
const homePage = new HomePage(page);
await homePage.createEmployee("Paul");
await homePage.createEmployee("Sean");
await homePage.expectEmployee(["Sean", "admin"]);
await homePage.expectEmployee(["Paul", "admin"]);
await homePage.deleteEmployee("Sean");
await homePage.expectEmployeeDeleted("Sean");
test.beforeAll(async () => {
browser = await chromium.launch();
adminContext = await browser.newContext();
writerContext = await browser.newContext();
});
test("Onboard flow", async ({ page }) => {
test.afterAll(async () => {
await adminContext.close();
await writerContext.close();
await browser.close();
});
test("Create and delete flow", async () => {
const adminPage = await adminContext.newPage();
await login({ page: adminPage, userName: "HR specialist" });
const adminHomePage = new HomePage(adminPage);
await adminHomePage.createEmployee("Paul");
await adminHomePage.createEmployee("Sean");
await adminHomePage.expectEmployee(["Sean", "admin"]);
await adminHomePage.expectEmployee(["Paul", "admin"]);
await adminHomePage.deleteEmployee("Sean");
await adminHomePage.expectEmployeeDeleted("Sean");
await adminPage.close();
});
test("Onboard flow", async () => {
const adminPage = await adminContext.newPage();
const writerPage = await writerContext.newPage();
const adminUser = "HR specialist";
const writerUser = "Invitee";
await login({ page, userName: adminUser });
await login({ page: adminPage, userName: adminUser });
await login({ page: writerPage, userName: writerUser });
const homePage = new HomePage(page);
await homePage.createEmployee("Paul");
await homePage.expectEmployee(["Paul", "admin"]);
await homePage.navigateToEmployeeOnboardingPage("Paul");
const onboardingPage = new EmployeeOnboardingPage(page);
const adminHomePage = new HomePage(adminPage);
await adminHomePage.createEmployee("Paul");
await adminHomePage.expectEmployee(["Paul", "admin"]);
await adminHomePage.navigateToEmployeeOnboardingPage("Paul");
const adminOnboardingPage = new EmployeeOnboardingPage(adminPage);
// create invitation
const invitation = await onboardingPage.getShareLink();
await onboardingPage.logout();
const invitation = await adminOnboardingPage.getShareLink();
// Wait for the invitation to be synced
await writerPage.waitForTimeout(3000);
//fill out by invitee (writer)
await login({ page, userName: writerUser });
await page.goto(invitation);
await page.waitForTimeout(1000);
await homePage.expectEmployee(["Paul", "write"]);
await homePage.navigateToEmployeeOnboardingPage("Paul");
await onboardingPage.expectEmployeeName("Paul");
await onboardingPage.fillPersonalDetailsCardAndSave(
await writerPage.goto(invitation);
const writerHomePage = new HomePage(writerPage);
await writerHomePage.expectEmployee(["Paul", "write"]);
await writerHomePage.navigateToEmployeeOnboardingPage("Paul");
const writerOnboardingPage = new EmployeeOnboardingPage(writerPage);
await writerOnboardingPage.expectEmployeeName("Paul");
await writerOnboardingPage.fillPersonalDetailsCardAndSave(
"123-45-6789",
"123 Elm Street",
);
await onboardingPage.fillUploadCardAndSave(
await writerOnboardingPage.fillUploadCardAndSave(
"./public/jazz-logo-low-res.jpg",
);
// invitee cannot confirm the onboarding completion
expect(onboardingPage.finalConfirmationButton.isDisabled()).toBeTruthy();
expect(
writerOnboardingPage.finalConfirmationButton.isDisabled(),
).toBeTruthy();
// final confirmation step by admin
await onboardingPage.logout();
await login({ page, userName: adminUser, loginAs: true });
await homePage.expectEmployee(["Paul", "admin"]);
await homePage.navigateToEmployeeOnboardingPage("Paul");
await scrollToBottom(page);
await onboardingPage.finalConfirmationButton.click();
await onboardingPage.backButton.click();
await homePage.expectOnboardingCompleteForEmployee("Paul");
await scrollToBottom(adminPage);
await adminOnboardingPage.finalConfirmationButton.click();
await adminOnboardingPage.backButton.click();
await adminHomePage.expectOnboardingCompleteForEmployee("Paul");
});
});

View File

@@ -1,5 +1,22 @@
# jazz-password-manager
## 0.0.21
### Patch Changes
- Updated dependencies [d348c2d]
- Updated dependencies [6902b5b]
- Updated dependencies [1a0cd3d]
- jazz-tools@0.8.23
- jazz-react@0.8.23
## 0.0.20
### Patch Changes
- Updated dependencies [59cc64d]
- jazz-react@0.8.22
## 0.0.19
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-password-manager",
"private": true,
"version": "0.0.19",
"version": "0.0.21",
"type": "module",
"scripts": {
"dev": "vite",
@@ -12,8 +12,8 @@
"clean-install": "rm -rf node_modules pnpm-lock.yaml && pnpm install"
},
"dependencies": {
"jazz-react": "workspace:0.8.21",
"jazz-tools": "workspace:0.8.21",
"jazz-react": "workspace:0.8.23",
"jazz-tools": "workspace:0.8.23",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.41.5",

View File

@@ -7,7 +7,6 @@ import {
PasswordList,
PasswordManagerAccount,
} from "./1_schema";
import { waitForCoValue } from "./lib/waitForCoValue";
import { PasswordItemFormValues } from "./types";
export const saveItem = (item: CoMapInit<PasswordItem>): PasswordItem => {
@@ -61,14 +60,16 @@ export async function addSharedFolder(
me: PasswordManagerAccount,
) {
const [sharedFolder, account] = await Promise.all([
await waitForCoValue(Folder, sharedFolderId, me, Boolean, {}),
await waitForCoValue(PasswordManagerAccount, me.id, me, Boolean, {
Folder.load(sharedFolderId, me, {}),
PasswordManagerAccount.load(me.id, me, {
root: {
folders: [],
},
}),
]);
if (!sharedFolder || !account) return;
if (!account.root?.folders) return;
const found = account.root.folders.some((f) => f?.id === sharedFolder.id);

View File

@@ -1,39 +0,0 @@
import {
Account,
CoValue,
CoValueClass,
DepthsIn,
ID,
subscribeToCoValue,
} from "jazz-tools";
export function waitForCoValue<T extends CoValue>(
coMap: CoValueClass<T>,
valueId: ID<T>,
account: Account,
predicate: (value: T) => boolean,
depth: DepthsIn<T>,
) {
return new Promise<T>((resolve) => {
function subscribe() {
const unsubscribe = subscribeToCoValue(
coMap,
valueId,
account,
depth,
(value) => {
if (predicate(value)) {
resolve(value);
unsubscribe();
}
},
() => {
unsubscribe();
setTimeout(subscribe, 100);
},
);
}
subscribe();
});
}

View File

@@ -1,5 +1,24 @@
# jazz-example-pets
## 0.0.119
### Patch Changes
- Updated dependencies [d348c2d]
- Updated dependencies [6902b5b]
- Updated dependencies [1a0cd3d]
- jazz-tools@0.8.23
- jazz-react@0.8.23
- jazz-browser-media-images@0.8.23
## 0.0.118
### Patch Changes
- Updated dependencies [59cc64d]
- jazz-react@0.8.22
- jazz-browser-media-images@0.8.22
## 0.0.117
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-pets",
"private": true,
"version": "0.0.117",
"version": "0.0.119",
"type": "module",
"scripts": {
"dev": "vite",
@@ -19,9 +19,9 @@
"@radix-ui/react-toast": "^1.1.4",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"jazz-browser-media-images": "workspace:0.8.21",
"jazz-react": "workspace:0.8.21",
"jazz-tools": "workspace:0.8.21",
"jazz-browser-media-images": "workspace:0.8.23",
"jazz-react": "workspace:0.8.23",
"jazz-tools": "workspace:0.8.23",
"lucide-react": "^0.274.0",
"qrcode": "^1.5.3",
"react": "^18.2.0",
@@ -41,7 +41,7 @@
"@vitejs/plugin-react-swc": "^3.3.2",
"autoprefixer": "^10.4.14",
"is-ci": "^3.0.1",
"jazz-run": "workspace:0.8.21",
"jazz-run": "workspace:0.8.23",
"postcss": "^8.4.27",
"tailwindcss": "3.3.2",
"typescript": "^5.3.3",

View File

@@ -1,8 +1,8 @@
import {
Account,
CoFeed,
CoList,
CoMap,
CoStream,
ImageDefinition,
Profile,
co,
@@ -25,7 +25,7 @@ export const ReactionTypes = [
] as const;
export type ReactionType = (typeof ReactionTypes)[number];
export class PetReactions extends CoStream.Of(co.json<ReactionType>()) {}
export class PetReactions extends CoFeed.Of(co.json<ReactionType>()) {}
export class PetPost extends CoMap {
name = co.string;

View File

@@ -0,0 +1,23 @@
# todo-vue
## 0.0.6
### Patch Changes
- Updated dependencies [d348c2d]
- Updated dependencies [e442bb8]
- Updated dependencies [6902b5b]
- Updated dependencies [1a0cd3d]
- jazz-tools@0.8.23
- jazz-browser@0.8.23
- jazz-vue@0.8.13
## 0.0.5
### Patch Changes
- a734530: fix useCoState reactivity
- Updated dependencies [f6bc8af]
- Updated dependencies [a734530]
- jazz-browser@0.8.22
- jazz-vue@0.8.12

View File

@@ -1,6 +1,6 @@
{
"name": "todo-vue",
"version": "0.0.4",
"version": "0.0.6",
"private": true,
"type": "module",
"scripts": {

View File

@@ -1,5 +1,22 @@
# jazz-example-todo
## 0.0.118
### Patch Changes
- Updated dependencies [d348c2d]
- Updated dependencies [6902b5b]
- Updated dependencies [1a0cd3d]
- jazz-tools@0.8.23
- jazz-react@0.8.23
## 0.0.117
### Patch Changes
- Updated dependencies [59cc64d]
- jazz-react@0.8.22
## 0.0.116
### Patch Changes

View File

@@ -1,7 +1,7 @@
{
"name": "jazz-example-todo",
"private": true,
"version": "0.0.116",
"version": "0.0.118",
"type": "module",
"scripts": {
"dev": "vite",
@@ -16,8 +16,8 @@
"@radix-ui/react-toast": "^1.1.4",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"jazz-react": "workspace:0.8.21",
"jazz-tools": "workspace:0.8.21",
"jazz-react": "workspace:0.8.23",
"jazz-tools": "workspace:0.8.23",
"lucide-react": "^0.274.0",
"qrcode": "^1.5.3",
"react": "^18.2.0",

View File

@@ -35,7 +35,7 @@ export function Button(props: ButtonProps) {
const classNames = clsx(
className,
"inline-flex items-center gap-2 rounded-lg text-center transition-colors",
"inline-flex items-center justify-center gap-2 rounded-lg text-center transition-colors",
sizeClasses[size],
variantClasses[variant],
disabled && "opacity-50 cursor-not-allowed pointer-events-none",

View File

@@ -1,7 +1,6 @@
import {
SiBluesky,
SiGithub,
SiGitlab,
SiLinkedin,
SiX,
} from "@icons-pack/react-simple-icons";
@@ -16,7 +15,6 @@ interface TeamMember {
location: string;
x?: string;
github?: string;
gitlab?: string;
website?: string;
linkedin?: string;
bluesky?: string;
@@ -67,9 +65,8 @@ const team: Array<TeamMember> = [
name: "Marina Orlova",
titles: ["Full-Stack Dev"],
location: "Tarragona, Spain ",
gitlab: "marinaorlova",
linkedin: "marina-orlova-52a34394",
// github: "marinoska",
github: "marinoska",
image: "marina.jpeg",
},
];
@@ -146,13 +143,6 @@ function Person({ person }: { person: TeamMember }) {
label="Bluesky profile"
/>
)}
{person.gitlab && (
<SocialLink
link={`https://gitlab.com/${person.gitlab}`}
icon={SiGitlab}
label="Gitlab profile"
/>
)}
{person.linkedin && (
<SocialLink
link={`https://www.linkedin.com/in/${person.linkedin}`}

View File

@@ -0,0 +1,21 @@
import { ApiNav } from "@/components/docs/ApiNav";
import DocsLayout from "@/components/docs/DocsLayout";
import { Prose } from "gcmp-design-system/src/app/components/molecules/Prose";
export const metadata = {
title: "API reference",
description:
"API references for packages like jazz-tools, jazz-react, and more.",
};
export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
return (
<DocsLayout nav={<ApiNav />}>
<Prose className="py-8">{children}</Prose>
</DocsLayout>
);
}

View File

@@ -3,6 +3,8 @@ import { clsx } from "clsx";
import { MessageCircleQuestionIcon, PackageIcon } from "lucide-react";
import Link from "next/link";
import { DocNav } from "@/components/docs/nav";
const CardHeading = ({
children,
className,
@@ -60,7 +62,7 @@ export default function Page() {
{packages.map(({ name, description }) => (
<Link
className="not-prose block"
href={`/docs/api-reference/${name}`}
href={`/api-reference/${name}`}
key={name}
>
<Card className="border shadow-sm">

View File

@@ -1,4 +1,4 @@
#### Jazz Cloud + Data Backup Node.
#### Jazz Cloud + Data Backup Node
<p className="no-prose text-base">
Connect your users to Jazz Cloud for all its benefits, but also run and

View File

@@ -1,4 +1,4 @@
#### Jazz Cloud + DIY Cloud.
#### Jazz Cloud + DIY Cloud
<p className="no-prose text-base">
Connect your users to Jazz Cloud, or your own nodes as a lower-performance

View File

@@ -1,5 +1,5 @@
#### Completely DIY Cloud.
#### Completely DIY Cloud
<p className="no-prose text-base">
Build your own network of sync and storage nodes. Handle
devops,networking, security and backups yourself.
</p>
</p>

View File

@@ -32,7 +32,7 @@ export default function Cloud() {
<div className="container">
<GappedGrid>
<GridCard>
<H3>Optimal cloud routing.</H3>
<H3>Optimal cloud routing</H3>
<P>
Get ultra-low latency between any group of users with our
@@ -68,7 +68,7 @@ export default function Cloud() {
<div className="container space-y-16">
<div>
<SectionHeader
title="Global Footprint"
title="Global footprint"
slogan="We're rapidly expanding our network of sync & storage nodes. This is our current coverage."
/>
<GappedGrid>
@@ -131,7 +131,7 @@ export default function Cloud() {
<div>
<SectionHeader
title="Custom Deployment Scenarios"
title="Custom deployment scenarios"
slogan="You can rely on Jazz Cloud. But you don't have to."
/>
<P>

View File

@@ -1,9 +1,7 @@
# The documentation for this feature is not yet available
# Documentation coming soon
Grayed out pages on the sidebar indicate that the documentation is not yet available.
Grayed out pages on our sidebar indicate that documentation for this feature is still in progress. We're excited to bring you comprehensive guides and tutorials as soon as possible.
This feature has already been released, but the documentation is still a work in progress.
If you don't find what you're looking for, [please ask for help in the Discord](https://discord.gg/utDMjHYg42).
We have a whole team of developers who are ready to help you get started.
This feature has already been released, and we're working hard to provide top-notch support. In the meantime, if you have any questions or need assistance, please don't hesitate to reach out to us on [Discord](https://discord.gg/utDMjHYg42).
We would love to help you get started.

View File

@@ -1,14 +1,9 @@
import { Prose } from "gcmp-design-system/src/app/components/molecules/Prose";
export const metadata = {
title: "Docs",
description: "Jazz Guide & Docs.",
};
export default function DocsLayout({
children,
}: {
children: React.ReactNode;
}) {
return <Prose className="py-6 overflow-x-hidden lg:flex-1">{children}</Prose>;
return <Prose className="overflow-x-hidden lg:flex-1 py-8">{children}</Prose>;
}

View File

@@ -0,0 +1,44 @@
import { HeroHeader } from "gcmp-design-system/src/app/components/molecules/HeroHeader";
import { JazzLogo } from 'gcmp-design-system/src/app/components/atoms/logos/JazzLogo';
<div className="not-prose">
<h1 className="sr-only">Getting started</h1>
<HeroHeader
title={<>Learn some <JazzLogo className="h-[1.3em] relative -top-0.5 inline-block -ml-[0.1em] -mr-[0.1em]"/></>}
slogan=""
pt={false}
/>
</div>
Welcome to the Jazz documentation!
The Jazz docs are currently heavily work in progress, sorry about that!
## Quickstart
To get started, set up Jazz in your project. Here's how you can do that on your framework of choice:
- [React](/docs/project-setup/react)
- [Next.js](/docs/project-setup/next)
- [React Native](/docs/project-setup/react-native)
- [Vue](/docs/project-setup/vue)
Or you can follow this [React step-by-step guide](/docs/guide) where we walk you through building an issue tracker app.
## Example apps
You can also find [example apps](/examples) with code most similar to what you want to build. These apps
make use of different features such as auth, file upload, and more.
## Sync and storage
Sync and persist your data by setting up a [sync and storage infrastructure](/docs/sync-and-storage) using Jazz Cloud, or do it yourself.
## Collaborative values
Learn how to structure your data using [collaborative values](/docs/schemas/covalues).
## Get support
If you have any questions or need assistance, please don't hesitate to reach out to us on [Discord](https://discord.gg/utDMjHYg42).
We would love to help you get started.

View File

@@ -1,55 +0,0 @@
import { Prose } from "gcmp-design-system/src/app/components/molecules/Prose";
export default function Page() {
return (
<Prose>
<h1>Welcome to the Jazz documentation.</h1>
<p>
The Jazz docs are currently heavily work in progress, sorry about that!
</p>
<p>The best ways to get started are:</p>
<ul>
<li>
Quickstart (work in progress)
<ol>
<li>
<a href="/docs/sync-and-storage">Sync & Storage Setup</a>
</li>
<li>
<a href="/docs/project-setup/react">React Project Setup</a>
</li>
<li>
<a href="/docs/schemas/covalues">
CoValue Basics & Schema Definition
</a>
</li>
<li>
<span className="opacity-50">Creating Covalues</span>
</li>
<li>
<span className="opacity-50">Using Covalues</span>
</li>
</ol>
</li>
<li>
The step-by-step <a href="/docs/guide">Guide</a> (work in progress)
</li>
</ul>
<p>Also make sure to:</p>
<ul>
<li>
Find an <a href="/examples">example app with code</a> most similar to
what you want to build
</li>
<li>
Check out the <a href="/docs/api-reference">API Reference</a> (work in
progress)
</li>
</ul>
<p>
And the best way to get help is to join the{" "}
<a href="https://discord.gg/utDMjHYg42">Discord</a>!
</p>
</Prose>
);
}

View File

@@ -1,28 +1,13 @@
import { HeroHeader } from "gcmp-design-system/src/app/components/molecules/HeroHeader";
import { CodeGroup } from "@/components/forMdx";
import { JazzLogo } from 'gcmp-design-system/src/app/components/atoms/logos/JazzLogo'
<div className="not-prose">
<HeroHeader
title={<>Learn some <JazzLogo className="h-[1.3em] relative -top-0.5 inline-block -ml-[0.1em] -mr-[0.1em]"/></>}
slogan="Build an issue tracker with distributed state."
pt={false}
/>
</div>
# React guide
## About this guide
This is a step-by-step tutorial where we'll build an issue tracker app using React.
You might notice that right now, this guide is the only form of documentation there is for Jazz.
Over time, we're hoping to introduce independent doc sections for every concept in Jazz, but right now this works as:
You'll learn how to set up a Jazz app, use Jazz Cloud for sync and storage, create and manipulate data using
Collaborative Values (CoValues), build a UI and subscribe to changes, set permissions, and send invites.
- a quickstart guide
- a reference for the concepts in Jazz (ordered from simple & most important to more advanced)
- a tutorial that makes you build a full app (that you can use as a base)
Plus, if you get stuck or you have questions, [ask us on Discord](https://discord.gg/utDMjHYg42)
and we'll know exactly where you're at.
## Project Setup
## Project setup
1. Create a project called "circular" from a generic Vite starter template:
@@ -490,7 +475,7 @@ This works because we load the issue as the same account that created it and own
But how can we share an Issue with someone else?
### Simple Public Sharing
### Simple public sharing
We'll learn more about access control in "Groups & Permissions", but for now let's build a super simple way of sharing an Issue by just making it publicly readable & writable.
@@ -545,7 +530,7 @@ export default App; // old
This concludes our intro to the essence of CoValues. Hopefully you're starting to have a feeling for how CoValues behave and how they're magically available everywhere.
## Refs & Auto-Subscribe
## Refs & auto-subscribe
Now let's have a look at how to compose CoValues into more complex structures and build a whole app around them.
@@ -682,7 +667,7 @@ Two things to note here:
- We only need to use `useCoState` on the Project, and the nested `ListOfIssues` and each `Issue` will be **automatically loaded and subscribed to when we access them.**
- However, because either the `Project`, `ListOfIssues`, or each `Issue` might not be loaded yet, we have to check for them being defined.
### Precise Loading Depths
### Precise loading depths
The load-and-subscribe-on-access is a convenient way to have your rendering drive data loading (including in nested components!) and lets you quickly chuck UIs together without worrying too much about the shape of all data you'll need.
@@ -732,12 +717,12 @@ The loading-depth spec `{ issues: [{}] }` means "in `Project`, load `issues` and
{/* TODO: explain about not loaded vs not set/defined and `_refs` basics */}
## Groups & Permissions
## Groups & permissions
We've seen briefly how we can use Groups to give everyone access to a Project,
and how we can use `{ owner: me }` to make something private to the current user.
### Groups / Accounts as Permission Scopes
### Groups / Accounts as permission scopes
This gives us a hint of how permissions work in Jazz: **every CoValue has an owner,
and the access rights on that CoValue are determined by its owner.**
@@ -748,7 +733,7 @@ and the access rights on that CoValue are determined by its owner.**
- `"writer"`s can read and write to CoValues belonging to the Group.
- `"admin"`s can read and write to CoValues belonging to the Group *and can add and remove other members from the Group itself.*
### Creating Invites
### Creating invites
There is also an abstraction for creating *invitations to join a Group* (with a specific role) that you can use
to add people without having to know their Account ID.
@@ -850,7 +835,7 @@ export function ProjectComponent({ projectID }: { projectID: ID<Project> }) {//
```
</CodeGroup>
### Consuming Invites
### Consuming invites
<div className="text-amber-500 mt-52">
🚧 OH NO - This is as far as we've written the Guide. 🚧
</div>

View File

@@ -13,7 +13,7 @@ export default async function Page({ params }: { params: { slug: string[] } }) {
return (
<>
<Prose className="overflow-x-hidden lg:flex-1 pt-6">
<Prose className="overflow-x-hidden lg:flex-1 py-8">
<Content />
</Prose>
{tableOfContents && <TableOfContents items={tableOfContents as Toc} />}

View File

@@ -16,7 +16,7 @@ Tested with:
## Setup
### Create a New Project
### Create a new project
(skip this step if you already have one)
@@ -43,7 +43,7 @@ Tested with:
```
</CodeGroup>
### Fix Incompatible Dependencies
### Fix incompatible dependencies
<CodeGroup>
```bash
@@ -61,7 +61,7 @@ Tested with:
### Configure Metro
#### Regular Repositories
#### Regular repositories
If you are not working within a monorepo, create a new file metro.config.js in the root of your project with the following content:
@@ -118,7 +118,7 @@ For monorepos, use the following metro.config.js:
```
</CodeGroup>
### Additional Monorepo Configuration (for pnpm users)
### Additional monorepo configuration (for pnpm users)
- Add node-linker=hoisted to the root .npmrc (create this file if it doesnt exist).
- Add the following to the root package.json:
@@ -139,7 +139,7 @@ For monorepos, use the following metro.config.js:
For more information, refer to [this](https://github.com/byCedric/expo-monorepo-example#pnpm-workarounds) Expo monorepo example.
### Add Polyfills
### Add polyfills
Create a file `polyfills.js` at the project root with the following content:
@@ -203,7 +203,7 @@ Create a file `jazz.tsx` with the following contents:
You can optionally pass a custom `kvStore` and `AccountSchema` to `createJazzRNApp()`, otherwise, it defaults to `ExpoSecureStoreAdapter` and `Account`.
### Choosing an Auth Method
### Choosing an auth method
Refer to the Jazz + React Native demo projects for implementing authentication:
@@ -238,7 +238,7 @@ To work with images in Jazz, import the `createImage` function from [`jazz-react
For a complete implementation, please refer to [this](https://github.com/gardencmp/jazz/blob/main/examples/pets/src/3_NewPetPostForm.tsx) demo.
### Running Your App
### Running your app
<CodeGroup>
```bash

View File

@@ -1,12 +1,12 @@
import { CodeGroup } from "@/components/forMdx";
# Node.JS / Server Workers
# Node.JS / server workers
The main detail to understand when using Jazz server-side is that Server Workers have Jazz `Accounts`, just like normal users do.
This lets you share CoValues with Server Workers, having precise access control by adding the Worker to `Groups` with specific roles just like you would with other users.
## Generating Credentials
## Generating credentials
Server Workers typically have static credentials, consisting of a public Account ID and a private Account Secret.
@@ -21,13 +21,13 @@ npx jazz-run account create --name "My Server Worker"
The name will be put in the public profile of the Server Worker's `Account`, which can be helpful when inspecting metadata of CoValue edits that the Server Worker has done.
## Storing & Providing Credentials
## Storing & providing credentials
Server Worker credentials are typically stored and provided as environmental variables.
**Take extra care with the Account Secret &mdash; handle it like any other secret environment variable such as a DB password.**
## Starting a Server Worker
## Starting a server worker
You can use `startWorker` from `jazz-nodejs` to start a Server Worker. Similarly to setting up a client-side Jazz context, it:
@@ -53,7 +53,7 @@ const { worker } = await startWorker({
- load/subscribe to CoValues: `MyCoValue.subscribe(id, worker, {...})`
- create CoValues & Groups `const val = MyCoValue.create({...}, { owner: worker })`
## Using CoValues instead of Requests
## Using CoValues instead of requests
Just like traditional backend functions, you can use Server Workers to do useful stuff (computations, calls to third-party APIs etc.) and put the results back into CoValues, which subscribed clients automatically get notified about.
@@ -62,4 +62,4 @@ What's less clear is how you can trigger this work to happen.
- One option is to define traditional HTTP API handlers that use the Jazz Worker internally. This is helpful if you need to mutate Jazz state in response to HTTP requests such as for webhooks or non-Jazz API clients
- The other option is to have the Jazz Worker subscribe to CoValues which they will then collaborate on with clients.
- A common pattern is to implement a state machine represented by a CoValue, where the client will do some state transitions (such as `draft -> ready`), which the worker will notice and then do some work in response, feeding the result back in a further state transition (such as `ready -> success & data`, or `ready -> failure & error details`).
- This way, client and worker don't have to explicitly know about each other or communicate directly, but can rely on Jazz as a communication mechanism - with computation progressing in a distributed manner wherever and whenever possible.
- This way, client and worker don't have to explicitly know about each other or communicate directly, but can rely on Jazz as a communication mechanism - with computation progressing in a distributed manner wherever and whenever possible.

View File

@@ -1,6 +1,6 @@
import { CodeGroup } from "@/components/forMdx";
# VueJS Demo Todo App Guide
# VueJS demo todo app guide
This guide provides step-by-step instructions for setting up and running a Jazz-powered Todo application using VueJS.
@@ -10,7 +10,7 @@ See the full example [here](https://github.com/gardencmp/jazz/tree/main/examples
## Setup
### Create a New App
### Create a new app
Run the following command to create a new VueJS application:
@@ -30,7 +30,7 @@ Run the following command to create a new VueJS application:
```
</CodeGroup>
### Install Dependencies
### Install dependencies
Run the following command to install Jazz libraries:

View File

@@ -13,7 +13,7 @@ As their name suggests, they are inherently collaborative, meaning **multiple us
CoValues mostly model JSON with CoMaps and CoLists, but also offer CoStreams for simple per-user value streams, and also let you represent binary data with BinaryCoStreams.
## Schemas as Your App's First Step
## Schemas as your app's first step
Under the hood, CoValues are as dynamic and flexible as JSON itself, but the way you use them in Jazz is by defining fixed schemas to describe the shape of data in your app.
@@ -62,4 +62,4 @@ Before we look at the different types of CoValues, let's learn what we can put *
### Refs
### Computed fields, methods & constructors
### Computed fields, methods & constructors

View File

@@ -1,4 +1,4 @@
# Sync and Storage
# Sync and storage
## Using Jazz Cloud
@@ -9,11 +9,11 @@ Jazz Cloud will
- safely persist CoValues on redundant storage nodes with additional backups
- make use of geographically distributed cache nodes for low latency
### Free Public Alpha
### Free public alpha
- Jazz Cloud is free during the public alpha, with no strict usage limits
- We plan to keep a free tier, so you'll always be able to get started with zero setup
- See [Jazz Cloud Pricing](https://jazz.tools/cloud#pricing) for more details
- See [Jazz Cloud pricing](/cloud#pricing) for more details
- ⚠️ Please use a valid email address as your API key.
Your full sync server URL should look something like

View File

@@ -1,27 +1,20 @@
import DocsLayout from "@/components/docs/DocsLayout";
import { DocNav } from "@/components/docs/nav";
import { clsx } from "clsx";
export const metadata = {
title: "Docs",
description: "Jazz Guide & Docs.",
title: "Documentation",
description: "Jazz guide and documentation.",
};
export default function DocsLayout({
export default function Layout({
children,
}: {
children: React.ReactNode;
}) {
return (
<div className="container relative grid grid-cols-12 gap-5">
<DocNav className="py-6" />
<div
className={clsx(
"col-span-12 md:col-span-8 lg:col-span-9",
"flex justify-center lg:gap-5",
)}
>
{children}
</div>
</div>
<DocsLayout nav={<DocNav />}>
<div className="flex justify-center lg:gap-5">{children}</div>
</DocsLayout>
);
}

View File

@@ -8,7 +8,6 @@ import { JazzFooter } from "@/components/footer";
import { JazzNav } from "@/components/nav";
import { Analytics } from "@vercel/analytics/react";
import { SpeedInsights } from "@vercel/speed-insights/next";
import { clsx } from "clsx";
import { ThemeProvider } from "gcmp-design-system/src/app/components/molecules/ThemeProvider";
// If loading a variable font, you don't need to specify the font weight

View File

@@ -27,9 +27,9 @@ export function SideNavItem({
className={clsx(
classes,
href &&
"hover:text-black dark:hover:text-stone-200 transition-colors hover:transition-none",
"hover:text-stone-900 dark:hover:text-stone-200 transition-colors hover:transition-none",
{
"text-black": path === href,
"text-stone-900 dark:text-white": path === href,
},
)}
>

View File

@@ -0,0 +1,74 @@
import { SideNav } from "@/components/SideNav";
import { SideNavHeader } from "@/components/SideNavHeader";
import { SideNavItem } from "@/components/SideNavItem";
import { docNavigationItems } from "@/lib/docNavigationItems";
import { packages } from "@/lib/packages";
import { clsx } from "clsx";
import { ChevronRight, PackageIcon } from "lucide-react";
import Link from "next/link";
import { twMerge } from "tailwind-merge";
import { requestProject } from "./requestProject";
export function ApiNav({ className }: { className?: string }) {
return (
<div className={clsx(className, "text-sm space-y-5")}>
<SideNavHeader href="/api-reference">API Reference</SideNavHeader>
<ul className="space-y-5">
{packages.map(({ name }) => (
<li key={name}>
<PackageNavItem package={name} />
</li>
))}
</ul>
</div>
);
}
export async function PackageNavItem({
package: packageName,
}: {
package: string;
}) {
let project = await requestProject(packageName as any);
return (
<>
<SideNavItem
className="mb-1 flex gap-2 items-center"
href={`/api-reference/${packageName}`}
>
<PackageIcon size={15} strokeWidth={1.5} />
{packageName}
</SideNavItem>
{project.categories?.map((category) => {
return (
<details
key={category.title}
open={category.title !== "Other"}
className="group ml-1.5 border-l"
>
<summary className="pl-[13px] py-1 cursor-pointer flex gap-2 items-center justify-between hover:text-stone-800 dark:hover:text-stone-200 [&::-webkit-details-marker]:hidden">
{category.title}
<ChevronRight className="w-4 h-4 text-stone-300 group-open:rotate-90 transition-transform dark:text-stone-800" />
</summary>
<div className="pl-6">
{category.children.map(
(child, i, children) =>
(i == 0 || child.name !== children[i - 1]!.name) && (
<Link
key={child.id}
className="block py-0.5 text-ellipsis overflow-hidden font-mono hover:text-stone-800 dark:hover:text-stone-200"
href={`/api-reference/${packageName}#${child.name}`}
>
{child.name}
</Link>
),
)}
</div>
</details>
);
})}
</>
);
}

View File

@@ -0,0 +1,25 @@
import { clsx } from "clsx";
export default function DocsLayout({
children,
nav,
}: {
children: React.ReactNode;
nav?: React.ReactNode;
}) {
return (
<div className="container relative grid grid-cols-12 gap-5">
<div
className={clsx(
"py-8",
"pr-3 md:col-span-4 lg:col-span-3",
"sticky align-start top-[65px] h-[calc(100vh-65px)] overflow-y-auto overflow-x-hidden",
"hidden md:block",
)}
>
{nav}
</div>
<div className="col-span-12 md:col-span-8 lg:col-span-9">{children}</div>
</div>
);
}

View File

@@ -27,7 +27,7 @@ export function TableOfContents({
return (
<div
className={clsx(
"pl-3 py-6 text-sm sticky align-start top-[4.75rem] w-[16rem] h-[calc(100vh-108px)] overflow-y-auto overflow-x-hidden hidden lg:block",
"pl-3 py-6 text-sm sticky align-start top-[65px] w-[16rem] h-[calc(100vh-65px)] overflow-y-auto overflow-x-hidden hidden lg:block",
className,
)}
>

View File

@@ -1,86 +1,12 @@
import { SideNav } from "@/components/SideNav";
import { SideNavHeader } from "@/components/SideNavHeader";
import { SideNavItem } from "@/components/SideNavItem";
import { docNavigationItems } from "@/lib/docNavigationItems";
import { packages } from "@/lib/packages";
import { clsx } from "clsx";
import { ChevronRight, PackageIcon } from "lucide-react";
import Link from "next/link";
import { twMerge } from "tailwind-merge";
import { requestProject } from "./requestProject";
export function DocNav({ className }: { className?: string }) {
return (
<SideNav
items={docNavigationItems}
className={clsx(
twMerge(
"pr-3 md:col-span-4 lg:col-span-3",
"sticky align-start top-[4.75rem] h-[calc(100vh-108px)] overflow-y-auto overflow-x-hidden",
"hidden md:block",
className,
),
)}
>
<div>
<SideNavHeader href="/docs/api-reference">API Reference</SideNavHeader>
<ul className="space-y-8">
{packages.map(({ name }) => (
<li key={name}>
<PackageNavItem package={name} />
</li>
))}
</ul>
</div>
<SideNav items={docNavigationItems} className={clsx(className)}>
<SideNavHeader href="/api-reference">API Reference</SideNavHeader>
</SideNav>
);
}
export async function PackageNavItem({
package: packageName,
}: {
package: string;
}) {
let project = await requestProject(packageName as any);
return (
<>
<SideNavItem
className="mb-1 flex gap-2 items-center"
href={`/docs/api-reference/${packageName}`}
>
<PackageIcon size={15} strokeWidth={1.5} />
{packageName}
</SideNavItem>
{project.categories?.map((category) => {
return (
<details
key={category.title}
open={category.title !== "Other"}
className="group ml-1.5 border-l"
>
<summary className="pl-[13px] py-1 cursor-pointer flex gap-2 items-center justify-between hover:text-stone-800 dark:hover:text-stone-200 [&::-webkit-details-marker]:hidden">
{category.title}
<ChevronRight className="w-4 h-4 text-stone-300 group-open:rotate-90 transition-transform dark:text-stone-800" />
</summary>
<div className="pl-6">
{category.children.map(
(child, i, children) =>
(i == 0 || child.name !== children[i - 1]!.name) && (
<Link
key={child.id}
className="block py-0.5 text-ellipsis overflow-hidden font-mono hover:text-stone-800 dark:hover:text-stone-200"
href={`/docs/api-reference/${packageName}#${child.name}`}
>
{child.name}
</Link>
),
)}
</div>
</details>
);
})}
</>
);
}

View File

@@ -73,7 +73,7 @@ export function ClassOrInterface({
<div className="relative not-prose">
<div
id={name}
className="peer sticky top-0 mt-4 md:mt-0 md:top-[2rem] md:pt-[2.5rem] bg-white dark:bg-stone-950 z-20"
className="peer sticky top-0 mt-4 md:top-[65px] md:pt-8 bg-white dark:bg-stone-950 z-20"
>
<Link
href={"#" + name}

View File

@@ -35,7 +35,7 @@ export function JazzNav() {
/>
),
title: "API reference",
href: "/docs/api-reference",
href: "/api-reference",
description:
"API references for packages like jazz-tools, jazz-react, and more.",
},

Some files were not shown because too many files have changed in this diff Show More