Compare commits
35 Commits
jazz-react
...
usecostate
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
849c2b9ffc | ||
|
|
56860d406b | ||
|
|
357d1b4c8d | ||
|
|
4373e290fe | ||
|
|
037ed4d59d | ||
|
|
4fcc8edc70 | ||
|
|
0f8ba9966b | ||
|
|
91fa2e092a | ||
|
|
ff52d6df3e | ||
|
|
a539b9e26b | ||
|
|
f3129a7914 | ||
|
|
d349b794e1 | ||
|
|
fad14dcff6 | ||
|
|
b99f13c948 | ||
|
|
e7cb337a24 | ||
|
|
85c9a432c3 | ||
|
|
c28d1c331c | ||
|
|
474ea89b81 | ||
|
|
4772309fb6 | ||
|
|
1501510cfc | ||
|
|
eda1588907 | ||
|
|
b14e0bfe24 | ||
|
|
87aa43b46b | ||
|
|
b93ce9fb7e | ||
|
|
a7d83e1c10 | ||
|
|
76a693da15 | ||
|
|
07feedd641 | ||
|
|
6a8ce1e32d | ||
|
|
10a4b0e888 | ||
|
|
3c973c84ce | ||
|
|
21e74998e8 | ||
|
|
a2e9ae4731 | ||
|
|
0514a7e64b | ||
|
|
b063cccdfc | ||
|
|
d89d2978ff |
5
.changeset/empty-points-crash.md
Normal file
5
.changeset/empty-points-crash.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"jazz-react-core": patch
|
||||
---
|
||||
|
||||
Fix useCoState stale data
|
||||
5
.changeset/selfish-guests-promise.md
Normal file
5
.changeset/selfish-guests-promise.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"create-jazz-app": patch
|
||||
---
|
||||
|
||||
Added Cursor docs to create-jazz-app
|
||||
4
.github/workflows/pre-release.yml
vendored
4
.github/workflows/pre-release.yml
vendored
@@ -1,7 +1,7 @@
|
||||
name: Pre-Publish tagged Pull Requests
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
types: [opened, synchronize, reopened, labeled]
|
||||
|
||||
jobs:
|
||||
pre-release:
|
||||
@@ -99,4 +99,4 @@ jobs:
|
||||
);
|
||||
await logPublishInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
30
biome.json
30
biome.json
@@ -12,7 +12,9 @@
|
||||
"**/ios/**",
|
||||
"**/android/**",
|
||||
"packages/jazz-svelte/**",
|
||||
"examples/*svelte*/**"
|
||||
"examples/*svelte*/**",
|
||||
"homepage/homepage/**",
|
||||
"**/package.json"
|
||||
]
|
||||
},
|
||||
"formatter": {
|
||||
@@ -42,15 +44,6 @@
|
||||
}
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"include": ["**/package.json"],
|
||||
"linter": {
|
||||
"enabled": false
|
||||
},
|
||||
"formatter": {
|
||||
"enabled": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"include": ["packages/**/src/**"],
|
||||
"linter": {
|
||||
@@ -61,21 +54,24 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"include": ["packages/**/src/tests/**", "packages/**/src/test/**"],
|
||||
"include": ["packages/cojson-storage*/**", "cojson-transport-ws/**"],
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"correctness": {
|
||||
"useImportExtensions": "off"
|
||||
}
|
||||
"recommended": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"include": ["packages/cojson-storage-indexeddb/**"],
|
||||
"include": ["packages/**/src/tests/**"],
|
||||
"linter": {
|
||||
"enabled": true,
|
||||
"rules": {
|
||||
"recommended": true,
|
||||
"correctness": {
|
||||
"useImportExtensions": "off"
|
||||
},
|
||||
"style": {
|
||||
"noNonNullAssertion": "off"
|
||||
},
|
||||
"suspicious": {
|
||||
"noExplicitAny": "info"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# chat-rn-clerk
|
||||
|
||||
## 1.0.78
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-react-native@0.10.13
|
||||
- jazz-react-native-auth-clerk@0.10.13
|
||||
- jazz-react-native-media-images@0.10.13
|
||||
|
||||
## 1.0.77
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import "../global.css";
|
||||
import { ClerkLoaded, ClerkProvider } from "@clerk/clerk-expo";
|
||||
import { secureStore } from "@clerk/clerk-expo/secure-store";
|
||||
import { useFonts } from "expo-font";
|
||||
import { Slot } from "expo-router";
|
||||
import * as SplashScreen from "expo-splash-screen";
|
||||
@@ -33,7 +34,11 @@ export default function RootLayout() {
|
||||
}
|
||||
|
||||
return (
|
||||
<ClerkProvider tokenCache={tokenCache} publishableKey={publishableKey}>
|
||||
<ClerkProvider
|
||||
tokenCache={tokenCache}
|
||||
publishableKey={publishableKey}
|
||||
__experimental_resourceCache={secureStore}
|
||||
>
|
||||
<ClerkLoaded>
|
||||
<JazzAndAuth>
|
||||
<Slot />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "chat-rn-clerk",
|
||||
"main": "index.js",
|
||||
"version": "1.0.77",
|
||||
"version": "1.0.78",
|
||||
"scripts": {
|
||||
"build": "expo export -p ios",
|
||||
"start": "expo start",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# chat-rn
|
||||
|
||||
## 1.0.74
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-react-native@0.10.13
|
||||
|
||||
## 1.0.73
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "chat-rn",
|
||||
"version": "1.0.73",
|
||||
"version": "1.0.74",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "expo export -p ios",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# chat-vue
|
||||
|
||||
## 0.0.60
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-browser@0.10.13
|
||||
- jazz-vue@0.10.13
|
||||
|
||||
## 0.0.59
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "chat-vue",
|
||||
"version": "0.0.59",
|
||||
"version": "0.0.60",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-example-chat
|
||||
|
||||
## 0.0.156
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-browser-media-images@0.10.13
|
||||
- jazz-react@0.10.13
|
||||
|
||||
## 0.0.155
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-chat",
|
||||
"private": true,
|
||||
"version": "0.0.155",
|
||||
"version": "0.0.156",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# minimal-auth-clerk
|
||||
|
||||
## 0.0.55
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-react@0.10.13
|
||||
- jazz-react-auth-clerk@0.10.13
|
||||
|
||||
## 0.0.54
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "clerk",
|
||||
"private": true,
|
||||
"version": "0.0.54",
|
||||
"version": "0.0.55",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -13,7 +13,7 @@
|
||||
"dependencies": {
|
||||
"@clerk/clerk-react": "^5.4.1",
|
||||
"jazz-react": "workspace:*",
|
||||
"jazz-react-auth-clerk": "workspace:0.10.12",
|
||||
"jazz-react-auth-clerk": "workspace:0.10.13",
|
||||
"jazz-tools": "workspace:*",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# file-share-svelte
|
||||
|
||||
## 0.0.40
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-svelte@0.10.13
|
||||
|
||||
## 0.0.39
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "file-share-svelte",
|
||||
"version": "0.0.39",
|
||||
"version": "0.0.40",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# form
|
||||
|
||||
## 0.0.51
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-browser-media-images@0.10.13
|
||||
- jazz-react@0.10.13
|
||||
|
||||
## 0.0.50
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "form",
|
||||
"private": true,
|
||||
"version": "0.0.50",
|
||||
"version": "0.0.51",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# image-upload
|
||||
|
||||
## 0.0.53
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-browser-media-images@0.10.13
|
||||
- jazz-react@0.10.13
|
||||
|
||||
## 0.0.52
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "image-upload",
|
||||
"private": true,
|
||||
"version": "0.0.52",
|
||||
"version": "0.0.53",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-example-musicplayer
|
||||
|
||||
## 0.0.77
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-inspector@0.10.10
|
||||
- jazz-react@0.10.13
|
||||
|
||||
## 0.0.76
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-music-player",
|
||||
"private": true,
|
||||
"version": "0.0.76",
|
||||
"version": "0.0.77",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -22,8 +22,8 @@
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"jazz-inspector": "workspace:*",
|
||||
"jazz-react": "workspace:0.10.12",
|
||||
"jazz-tools": "workspace:0.10.12",
|
||||
"jazz-react": "workspace:0.10.13",
|
||||
"jazz-tools": "workspace:0.10.13",
|
||||
"lucide-react": "^0.274.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# organization
|
||||
|
||||
## 0.0.49
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-react@0.10.13
|
||||
|
||||
## 0.0.48
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "organization",
|
||||
"private": true,
|
||||
"version": "0.0.48",
|
||||
"version": "0.0.49",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# passkey-svelte
|
||||
|
||||
## 0.0.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-svelte@0.10.13
|
||||
|
||||
## 0.0.43
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "passkey-svelte",
|
||||
"version": "0.0.43",
|
||||
"version": "0.0.44",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# minimal-auth-passkey
|
||||
|
||||
## 0.0.54
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-react@0.10.13
|
||||
|
||||
## 0.0.53
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "passkey",
|
||||
"private": true,
|
||||
"version": "0.0.53",
|
||||
"version": "0.0.54",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# passphrase
|
||||
|
||||
## 0.0.51
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-react@0.10.13
|
||||
|
||||
## 0.0.50
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "passphrase",
|
||||
"private": true,
|
||||
"version": "0.0.50",
|
||||
"version": "0.0.51",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -66,3 +66,72 @@ main {
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.auth-container {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #f3f4f6;
|
||||
}
|
||||
|
||||
.auth-card {
|
||||
background-color: white;
|
||||
padding: 2rem;
|
||||
border-radius: 0.5rem;
|
||||
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px
|
||||
rgba(0, 0, 0, 0.06);
|
||||
width: 28rem;
|
||||
}
|
||||
|
||||
.auth-button-primary,
|
||||
.auth-button-secondary {
|
||||
width: 100%;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 0.25rem;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.auth-button-primary {
|
||||
background-color: black;
|
||||
color: white;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.auth-button-secondary {
|
||||
background-color: white;
|
||||
color: black;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.auth-heading {
|
||||
color: black;
|
||||
font-size: 1.5rem;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.auth-textarea {
|
||||
width: 100%;
|
||||
padding: 0.5rem;
|
||||
border: 1px solid #d1d5db;
|
||||
border-radius: 0.25rem;
|
||||
margin-bottom: 1rem;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.auth-description {
|
||||
font-size: 0.875rem;
|
||||
color: #4b5563;
|
||||
text-align: center;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.auth-button-group {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,142 @@
|
||||
import { JazzProvider, PassphraseAuthBasicUI } from "jazz-react";
|
||||
import { StrictMode } from "react";
|
||||
import { JazzProvider, usePassphraseAuth } from "jazz-react";
|
||||
import { StrictMode, useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import App from "./App.tsx";
|
||||
import "./index.css";
|
||||
import { wordlist } from "./wordlist.ts";
|
||||
|
||||
function PassphraseAuthBasicUI(props: {
|
||||
appName: string;
|
||||
wordlist: string[];
|
||||
children?: React.ReactNode;
|
||||
}) {
|
||||
const auth = usePassphraseAuth({
|
||||
wordlist: props.wordlist,
|
||||
});
|
||||
|
||||
const [step, setStep] = useState<"initial" | "create" | "login">("initial");
|
||||
const [loginPassphrase, setLoginPassphrase] = useState("");
|
||||
const [isCopied, setIsCopied] = useState(false);
|
||||
const [currentPassphrase, setCurrentPassphrase] = useState(() =>
|
||||
auth.generateRandomPassphrase(),
|
||||
);
|
||||
|
||||
if (auth.state === "signedIn") {
|
||||
return props.children ?? null;
|
||||
}
|
||||
|
||||
const handleCreateAccount = async () => {
|
||||
setStep("create");
|
||||
};
|
||||
|
||||
const handleLogin = () => {
|
||||
setStep("login");
|
||||
};
|
||||
|
||||
const handleReroll = () => {
|
||||
const newPassphrase = auth.generateRandomPassphrase();
|
||||
setCurrentPassphrase(newPassphrase);
|
||||
setIsCopied(false);
|
||||
};
|
||||
|
||||
const handleBack = () => {
|
||||
setStep("initial");
|
||||
setLoginPassphrase("");
|
||||
};
|
||||
|
||||
const handleCopy = async () => {
|
||||
await navigator.clipboard.writeText(auth.passphrase);
|
||||
setIsCopied(true);
|
||||
};
|
||||
|
||||
const handleLoginSubmit = async () => {
|
||||
await auth.logIn(loginPassphrase);
|
||||
setStep("initial");
|
||||
setLoginPassphrase("");
|
||||
};
|
||||
|
||||
const handleNext = async () => {
|
||||
await auth.registerNewAccount(currentPassphrase, "My Account");
|
||||
setStep("initial");
|
||||
setLoginPassphrase("");
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="auth-container">
|
||||
<div className="auth-card">
|
||||
{step === "initial" && (
|
||||
<div>
|
||||
<h1 className="auth-heading">{props.appName}</h1>
|
||||
<button
|
||||
onClick={handleCreateAccount}
|
||||
className="auth-button-primary"
|
||||
>
|
||||
Create new account
|
||||
</button>
|
||||
<button onClick={handleLogin} className="auth-button-secondary">
|
||||
Log in
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{step === "create" && (
|
||||
<>
|
||||
<h1 className="auth-heading">Your Passphrase</h1>
|
||||
<p className="auth-description">
|
||||
Please copy and store this passphrase somewhere safe. You'll need
|
||||
it to log in.
|
||||
</p>
|
||||
<textarea
|
||||
readOnly
|
||||
value={currentPassphrase}
|
||||
className="auth-textarea"
|
||||
rows={5}
|
||||
/>
|
||||
<button onClick={handleCopy} className="auth-button-primary">
|
||||
{isCopied ? "Copied!" : "Copy"}
|
||||
</button>
|
||||
<div className="auth-button-group">
|
||||
<button onClick={handleBack} className="auth-button-secondary">
|
||||
Back
|
||||
</button>
|
||||
<button onClick={handleReroll} className="auth-button-secondary">
|
||||
Generate New Passphrase
|
||||
</button>
|
||||
<button onClick={handleNext} className="auth-button-primary">
|
||||
Register
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
{step === "login" && (
|
||||
<div>
|
||||
<h1 className="auth-heading">Log In</h1>
|
||||
<textarea
|
||||
value={loginPassphrase}
|
||||
onChange={(e) => setLoginPassphrase(e.target.value)}
|
||||
placeholder="Enter your passphrase"
|
||||
className="auth-textarea"
|
||||
rows={5}
|
||||
/>
|
||||
<div className="auth-button-group">
|
||||
<button onClick={handleBack} className="auth-button-secondary">
|
||||
Back
|
||||
</button>
|
||||
<button
|
||||
onClick={handleLoginSubmit}
|
||||
className="auth-button-primary"
|
||||
>
|
||||
Log In
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function JazzAndAuth({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<JazzProvider
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# jazz-password-manager
|
||||
|
||||
## 0.0.75
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-react@0.10.13
|
||||
|
||||
## 0.0.74
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-password-manager",
|
||||
"private": true,
|
||||
"version": "0.0.74",
|
||||
"version": "0.0.75",
|
||||
"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.10.12",
|
||||
"jazz-tools": "workspace:0.10.12",
|
||||
"jazz-react": "workspace:0.10.13",
|
||||
"jazz-tools": "workspace:0.10.13",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-hook-form": "^7.41.5",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-example-pets
|
||||
|
||||
## 0.0.173
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-browser-media-images@0.10.13
|
||||
- jazz-react@0.10.13
|
||||
|
||||
## 0.0.172
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-pets",
|
||||
"private": true,
|
||||
"version": "0.0.172",
|
||||
"version": "0.0.173",
|
||||
"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.10.12",
|
||||
"jazz-react": "workspace:0.10.12",
|
||||
"jazz-tools": "workspace:0.10.12",
|
||||
"jazz-browser-media-images": "workspace:0.10.13",
|
||||
"jazz-react": "workspace:0.10.13",
|
||||
"jazz-tools": "workspace:0.10.13",
|
||||
"lucide-react": "^0.274.0",
|
||||
"qrcode": "^1.5.3",
|
||||
"react": "^18.3.1",
|
||||
@@ -41,7 +41,7 @@
|
||||
"@vitejs/plugin-react-swc": "^3.3.2",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"is-ci": "^3.0.1",
|
||||
"jazz-run": "workspace:0.10.12",
|
||||
"jazz-run": "workspace:0.10.13",
|
||||
"postcss": "^8.4.27",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"typescript": "~5.6.2",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# reactions
|
||||
|
||||
## 0.0.53
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-browser-media-images@0.10.13
|
||||
- jazz-react@0.10.13
|
||||
|
||||
## 0.0.52
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "reactions",
|
||||
"private": true,
|
||||
"version": "0.0.52",
|
||||
"version": "0.0.53",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# todo-vue
|
||||
|
||||
## 0.0.58
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-browser@0.10.13
|
||||
- jazz-vue@0.10.13
|
||||
|
||||
## 0.0.57
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "todo-vue",
|
||||
"version": "0.0.57",
|
||||
"version": "0.0.58",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# jazz-example-todo
|
||||
|
||||
## 0.0.172
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-react@0.10.13
|
||||
|
||||
## 0.0.171
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-todo",
|
||||
"private": true,
|
||||
"version": "0.0.171",
|
||||
"version": "0.0.172",
|
||||
"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.10.12",
|
||||
"jazz-tools": "workspace:0.10.12",
|
||||
"jazz-react": "workspace:0.10.13",
|
||||
"jazz-tools": "workspace:0.10.13",
|
||||
"lucide-react": "^0.274.0",
|
||||
"qrcode": "^1.5.3",
|
||||
"react": "^18.3.1",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# version-history
|
||||
|
||||
## 0.0.50
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-react@0.10.13
|
||||
|
||||
## 0.0.49
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "version-history",
|
||||
"private": true,
|
||||
"version": "0.0.49",
|
||||
"version": "0.0.50",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -211,7 +211,7 @@ The clerk provider is not built into `jazz-react` and needs the `jazz-react-auth
|
||||
</ContentByFramework>
|
||||
|
||||
<ContentByFramework framework="react-native">
|
||||
The clerk provider is not built into `jazz-react-native` and needs the `jazz-react-native-auth-clerk` package to be installed.
|
||||
The clerk provider is not built into `jazz-react-native` and needs the `jazz-react-native-auth-clerk` package to be installed. Note the `__experimental_resourceCache` option. This helps render Clerk components when offline.
|
||||
</ContentByFramework>
|
||||
|
||||
After installing the package you can use the `JazzProviderWithClerk` component to wrap your app:
|
||||
@@ -249,6 +249,7 @@ createRoot(document.getElementById("root")!).render(
|
||||
<CodeGroup>
|
||||
```tsx
|
||||
import { JazzProviderWithClerk } from "jazz-react-native-auth-clerk";
|
||||
import { secureStore } from "@clerk/clerk-expo/secure-store";
|
||||
|
||||
function JazzAndAuth({ children }: { children: React.ReactNode }) {
|
||||
const clerk = useClerk();
|
||||
@@ -275,7 +276,11 @@ export default function RootLayout() {
|
||||
}
|
||||
|
||||
return (
|
||||
<ClerkProvider tokenCache={tokenCache} publishableKey={publishableKey}>
|
||||
<ClerkProvider
|
||||
tokenCache={tokenCache}
|
||||
publishableKey={publishableKey}
|
||||
__experimental_resourceCache={secureStore}
|
||||
>
|
||||
<ClerkLoaded>
|
||||
<JazzAndAuth>
|
||||
<Slot />
|
||||
@@ -380,7 +385,7 @@ export async function onAnonymousAccountDiscarded(
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
To see how this works in reality we suggest you to try
|
||||
To see how this works in reality we suggest you to try
|
||||
to upload a song in the [music player demo](https://music-demo.jazz.tools/) and then
|
||||
try to log in with an existing account.
|
||||
|
||||
|
||||
@@ -442,11 +442,11 @@ All we have to do is create a new group to own each new issue and add "everyone"
|
||||
import { useState } from "react"; // old
|
||||
import { Issue } from "./schema"; // old
|
||||
import { IssueComponent } from "./components/Issue.tsx"; // old
|
||||
import { useCoState } from "jazz-react"; // old
|
||||
import { useAccount, useCoState } from "jazz-react";
|
||||
import { ID, Group } from "jazz-tools"
|
||||
// old
|
||||
function App() { // old
|
||||
const { me } = useAccount(); // old
|
||||
const { me } = useAccount();
|
||||
const [issueID, setIssueID] = useState<ID<Issue> | undefined>(// old
|
||||
(window.location.search?.replace("?issue=", "") || undefined) as ID<Issue> | undefined,// old
|
||||
); // old
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { type DB as DatabaseT } from "@op-engineering/op-sqlite";
|
||||
import {
|
||||
import type { DB as DatabaseT } from "@op-engineering/op-sqlite";
|
||||
import type {
|
||||
CojsonInternalTypes,
|
||||
type OutgoingSyncQueue,
|
||||
OutgoingSyncQueue,
|
||||
RawCoID,
|
||||
SessionID,
|
||||
} from "cojson";
|
||||
@@ -29,14 +29,25 @@ export class SQLiteClient implements DBClientInterface {
|
||||
|
||||
if (!rows || rows.length === 0) return;
|
||||
|
||||
const coValueRow = rows[0] as any & { rowID: number };
|
||||
type DbCoValueRow = {
|
||||
id: string;
|
||||
header: string;
|
||||
rowID: number;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
|
||||
const coValueRow = rows[0] as DbCoValueRow;
|
||||
try {
|
||||
const parsedHeader =
|
||||
coValueRow?.header &&
|
||||
(JSON.parse(coValueRow.header) as CojsonInternalTypes.CoValueHeader);
|
||||
coValueRow?.header && coValueRow.header.trim() !== ""
|
||||
? (JSON.parse(coValueRow.header) as CojsonInternalTypes.CoValueHeader)
|
||||
: undefined;
|
||||
|
||||
if (!parsedHeader) return undefined;
|
||||
|
||||
return {
|
||||
...coValueRow,
|
||||
id: coValueId,
|
||||
header: parsedHeader,
|
||||
};
|
||||
} catch (e) {
|
||||
@@ -76,10 +87,13 @@ export class SQLiteClient implements DBClientInterface {
|
||||
if (!rows || rows.length === 0) return [];
|
||||
|
||||
try {
|
||||
return rows.map((row: any) => ({
|
||||
...row,
|
||||
tx: JSON.parse(row.tx) as CojsonInternalTypes.Transaction,
|
||||
}));
|
||||
return rows.map((row) => {
|
||||
const rowData = row as { ses: number; idx: number; tx: string };
|
||||
return {
|
||||
...rowData,
|
||||
tx: JSON.parse(rowData.tx) as CojsonInternalTypes.Transaction,
|
||||
};
|
||||
});
|
||||
} catch (e) {
|
||||
console.warn("Invalid JSON in transaction", e);
|
||||
return [];
|
||||
@@ -126,7 +140,7 @@ export class SQLiteClient implements DBClientInterface {
|
||||
sessionUpdate.sessionID,
|
||||
sessionUpdate.lastIdx,
|
||||
sessionUpdate.lastSignature,
|
||||
sessionUpdate.bytesSinceLastSignature!,
|
||||
sessionUpdate.bytesSinceLastSignature ?? 0,
|
||||
],
|
||||
);
|
||||
return rows[0]?.rowID as number;
|
||||
|
||||
@@ -113,7 +113,7 @@ export class SQLiteReactNative {
|
||||
);
|
||||
|
||||
await db.execute(
|
||||
`CREATE INDEX IF NOT EXISTS sessionsByCoValue ON sessions (coValue);`,
|
||||
"CREATE INDEX IF NOT EXISTS sessionsByCoValue ON sessions (coValue);",
|
||||
);
|
||||
|
||||
await db.execute(
|
||||
@@ -125,7 +125,7 @@ export class SQLiteReactNative {
|
||||
);
|
||||
|
||||
await db.execute(
|
||||
`CREATE INDEX IF NOT EXISTS coValuesByID ON coValues (id);`,
|
||||
"CREATE INDEX IF NOT EXISTS coValuesByID ON coValues (id);",
|
||||
);
|
||||
|
||||
await db.execute("PRAGMA user_version = 1");
|
||||
@@ -142,7 +142,7 @@ export class SQLiteReactNative {
|
||||
);
|
||||
|
||||
await db.execute(
|
||||
`ALTER TABLE sessions ADD COLUMN bytesSinceLastSignature INTEGER;`,
|
||||
"ALTER TABLE sessions ADD COLUMN bytesSinceLastSignature INTEGER;",
|
||||
);
|
||||
|
||||
await db.execute("PRAGMA user_version = 3");
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
import { Database as DatabaseT } from "better-sqlite3";
|
||||
import type { Database as DatabaseT } from "better-sqlite3";
|
||||
import {
|
||||
CojsonInternalTypes,
|
||||
OutgoingSyncQueue,
|
||||
SessionID,
|
||||
type CojsonInternalTypes,
|
||||
type OutgoingSyncQueue,
|
||||
type SessionID,
|
||||
logger,
|
||||
} from "cojson";
|
||||
import RawCoID = CojsonInternalTypes.RawCoID;
|
||||
import Signature = CojsonInternalTypes.Signature;
|
||||
import Transaction = CojsonInternalTypes.Transaction;
|
||||
import {
|
||||
import type {
|
||||
DBClientInterface,
|
||||
SessionRow,
|
||||
SignatureAfterRow,
|
||||
@@ -17,6 +14,10 @@ import {
|
||||
TransactionRow,
|
||||
} from "cojson-storage";
|
||||
|
||||
type RawCoID = CojsonInternalTypes.RawCoID;
|
||||
type Signature = CojsonInternalTypes.Signature;
|
||||
type Transaction = CojsonInternalTypes.Transaction;
|
||||
|
||||
export type RawCoValueRow = {
|
||||
id: CojsonInternalTypes.RawCoID;
|
||||
header: string;
|
||||
@@ -43,7 +44,7 @@ export class SQLiteClient implements DBClientInterface {
|
||||
|
||||
getCoValue(coValueId: RawCoID): StoredCoValueRow | undefined {
|
||||
const coValueRow = this.db
|
||||
.prepare(`SELECT * FROM coValues WHERE id = ?`)
|
||||
.prepare("SELECT * FROM coValues WHERE id = ?")
|
||||
.get(coValueId) as RawCoValueRow & { rowID: number };
|
||||
|
||||
if (!coValueRow) return;
|
||||
@@ -58,7 +59,7 @@ export class SQLiteClient implements DBClientInterface {
|
||||
};
|
||||
} catch (e) {
|
||||
const headerValue = coValueRow?.header ?? "";
|
||||
logger.warn("Invalid JSON in header: " + headerValue, {
|
||||
logger.warn(`Invalid JSON in header: ${headerValue}`, {
|
||||
id: coValueId,
|
||||
});
|
||||
return;
|
||||
@@ -67,7 +68,7 @@ export class SQLiteClient implements DBClientInterface {
|
||||
|
||||
getCoValueSessions(coValueRowId: number): StoredSessionRow[] {
|
||||
return this.db
|
||||
.prepare<number>(`SELECT * FROM sessions WHERE coValue = ?`)
|
||||
.prepare<number>("SELECT * FROM sessions WHERE coValue = ?")
|
||||
.all(coValueRowId) as StoredSessionRow[];
|
||||
}
|
||||
|
||||
@@ -77,7 +78,7 @@ export class SQLiteClient implements DBClientInterface {
|
||||
): StoredSessionRow | undefined {
|
||||
return this.db
|
||||
.prepare<[number, string]>(
|
||||
`SELECT * FROM sessions WHERE coValue = ? AND sessionID = ?`,
|
||||
"SELECT * FROM sessions WHERE coValue = ? AND sessionID = ?",
|
||||
)
|
||||
.get(coValueRowId, sessionID) as StoredSessionRow | undefined;
|
||||
}
|
||||
@@ -88,7 +89,7 @@ export class SQLiteClient implements DBClientInterface {
|
||||
): TransactionRow[] {
|
||||
const txs = this.db
|
||||
.prepare<[number, number]>(
|
||||
`SELECT * FROM transactions WHERE ses = ? AND idx >= ?`,
|
||||
"SELECT * FROM transactions WHERE ses = ? AND idx >= ?",
|
||||
)
|
||||
.all(sessionRowId, firstNewTxIdx) as RawTransactionRow[];
|
||||
|
||||
@@ -109,7 +110,7 @@ export class SQLiteClient implements DBClientInterface {
|
||||
): SignatureAfterRow[] {
|
||||
return this.db
|
||||
.prepare<[number, number]>(
|
||||
`SELECT * FROM signatureAfter WHERE ses = ? AND idx >= ?`,
|
||||
"SELECT * FROM signatureAfter WHERE ses = ? AND idx >= ?",
|
||||
)
|
||||
.all(sessionRowId, firstNewTxIdx) as SignatureAfterRow[];
|
||||
}
|
||||
@@ -117,7 +118,7 @@ export class SQLiteClient implements DBClientInterface {
|
||||
addCoValue(msg: CojsonInternalTypes.NewContentMessage): number {
|
||||
return this.db
|
||||
.prepare<[CojsonInternalTypes.RawCoID, string]>(
|
||||
`INSERT INTO coValues (id, header) VALUES (?, ?)`,
|
||||
"INSERT INTO coValues (id, header) VALUES (?, ?)",
|
||||
)
|
||||
.run(msg.id, JSON.stringify(msg.header)).lastInsertRowid as number;
|
||||
}
|
||||
@@ -153,7 +154,7 @@ export class SQLiteClient implements DBClientInterface {
|
||||
) {
|
||||
this.db
|
||||
.prepare<[number, number, string]>(
|
||||
`INSERT INTO transactions (ses, idx, tx) VALUES (?, ?, ?)`,
|
||||
"INSERT INTO transactions (ses, idx, tx) VALUES (?, ?, ?)",
|
||||
)
|
||||
.run(sessionRowID, nextIdx, JSON.stringify(newTransaction));
|
||||
}
|
||||
@@ -165,12 +166,13 @@ export class SQLiteClient implements DBClientInterface {
|
||||
}: { sessionRowID: number; idx: number; signature: Signature }) {
|
||||
this.db
|
||||
.prepare<[number, number, string]>(
|
||||
`INSERT INTO signatureAfter (ses, idx, signature) VALUES (?, ?, ?)`,
|
||||
"INSERT INTO signatureAfter (ses, idx, signature) VALUES (?, ?, ?)",
|
||||
)
|
||||
.run(sessionRowID, idx, signature);
|
||||
}
|
||||
|
||||
transaction(operationsCallback: () => unknown) {
|
||||
this.db.transaction(operationsCallback)();
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import Database, { Database as DatabaseT } from "better-sqlite3";
|
||||
import Database, { type Database as DatabaseT } from "better-sqlite3";
|
||||
import {
|
||||
IncomingSyncStream,
|
||||
OutgoingSyncQueue,
|
||||
Peer,
|
||||
type IncomingSyncStream,
|
||||
type OutgoingSyncQueue,
|
||||
type Peer,
|
||||
cojsonInternals,
|
||||
logger,
|
||||
} from "cojson";
|
||||
import { SyncManager, TransactionRow } from "cojson-storage";
|
||||
import { SyncManager, type TransactionRow } from "cojson-storage";
|
||||
import { SQLiteClient } from "./sqliteClient.js";
|
||||
|
||||
export class SQLiteNode {
|
||||
@@ -46,7 +46,7 @@ export class SQLiteNode {
|
||||
msg,
|
||||
(k, v) =>
|
||||
k === "changes" || k === "encryptedChanges"
|
||||
? v.slice(0, 20) + "..."
|
||||
? `${v.slice(0, 20)}...`
|
||||
: v,
|
||||
)}`,
|
||||
);
|
||||
@@ -117,7 +117,7 @@ export class SQLiteNode {
|
||||
).run();
|
||||
|
||||
db.prepare(
|
||||
`CREATE INDEX IF NOT EXISTS sessionsByCoValue ON sessions (coValue);`,
|
||||
"CREATE INDEX IF NOT EXISTS sessionsByCoValue ON sessions (coValue);",
|
||||
).run();
|
||||
|
||||
db.prepare(
|
||||
@@ -129,7 +129,7 @@ export class SQLiteNode {
|
||||
).run();
|
||||
|
||||
db.prepare(
|
||||
`CREATE INDEX IF NOT EXISTS coValuesByID ON coValues (id);`,
|
||||
"CREATE INDEX IF NOT EXISTS coValuesByID ON coValues (id);",
|
||||
).run();
|
||||
|
||||
db.pragma("user_version = 1");
|
||||
@@ -138,17 +138,17 @@ export class SQLiteNode {
|
||||
if (oldVersion <= 1) {
|
||||
// fix embarrassing off-by-one error for transaction indices
|
||||
const txs = db
|
||||
.prepare(`SELECT * FROM transactions`)
|
||||
.prepare("SELECT * FROM transactions")
|
||||
.all() as TransactionRow[];
|
||||
|
||||
for (const tx of txs) {
|
||||
db.prepare(`DELETE FROM transactions WHERE ses = ? AND idx = ?`).run(
|
||||
db.prepare("DELETE FROM transactions WHERE ses = ? AND idx = ?").run(
|
||||
tx.ses,
|
||||
tx.idx,
|
||||
);
|
||||
tx.idx -= 1;
|
||||
db.prepare(
|
||||
`INSERT INTO transactions (ses, idx, tx) VALUES (?, ?, ?)`,
|
||||
"INSERT INTO transactions (ses, idx, tx) VALUES (?, ?, ?)",
|
||||
).run(tx.ses, tx.idx, tx.tx);
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ export class SQLiteNode {
|
||||
).run();
|
||||
|
||||
db.prepare(
|
||||
`ALTER TABLE sessions ADD COLUMN bytesSinceLastSignature INTEGER;`,
|
||||
"ALTER TABLE sessions ADD COLUMN bytesSinceLastSignature INTEGER;",
|
||||
).run();
|
||||
|
||||
db.pragma("user_version = 3");
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import {
|
||||
CojsonInternalTypes,
|
||||
MAX_RECOMMENDED_TX_SIZE,
|
||||
OutgoingSyncQueue,
|
||||
SessionID,
|
||||
SyncMessage,
|
||||
type OutgoingSyncQueue,
|
||||
type SessionID,
|
||||
type SyncMessage,
|
||||
cojsonInternals,
|
||||
emptyKnownState,
|
||||
logger,
|
||||
} from "cojson";
|
||||
import { collectNewTxs, getDependedOnCoValues } from "./syncUtils.js";
|
||||
import { DBClientInterface, StoredSessionRow } from "./types.js";
|
||||
import type { DBClientInterface, StoredSessionRow } from "./types.js";
|
||||
import NewContentMessage = CojsonInternalTypes.NewContentMessage;
|
||||
import KnownStateMessage = CojsonInternalTypes.KnownStateMessage;
|
||||
import RawCoID = CojsonInternalTypes.RawCoID;
|
||||
@@ -82,12 +82,15 @@ export class SyncManager {
|
||||
|
||||
// reverse it to send the top level id the last in the order
|
||||
const collectedMessages = Object.values(outputMessages).reverse();
|
||||
collectedMessages.forEach(({ knownMessage, contentMessages }) => {
|
||||
for (const { knownMessage, contentMessages } of collectedMessages) {
|
||||
this.sendStateMessage(knownMessage);
|
||||
|
||||
contentMessages?.length &&
|
||||
contentMessages.forEach((msg) => this.sendStateMessage(msg));
|
||||
});
|
||||
if (contentMessages?.length) {
|
||||
for (const msg of contentMessages) {
|
||||
this.sendStateMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async collectCoValueData(
|
||||
@@ -106,7 +109,9 @@ export class SyncManager {
|
||||
action: "known",
|
||||
...emptyKnownState(peerKnownState.id),
|
||||
};
|
||||
asDependencyOf && (emptyKnownMessage.asDependencyOf = asDependencyOf);
|
||||
if (asDependencyOf) {
|
||||
emptyKnownMessage.asDependencyOf = asDependencyOf;
|
||||
}
|
||||
messageMap[peerKnownState.id] = { knownMessage: emptyKnownMessage };
|
||||
return messageMap;
|
||||
}
|
||||
@@ -153,7 +158,9 @@ export class SyncManager {
|
||||
action: "known",
|
||||
...newCoValueKnownState,
|
||||
};
|
||||
asDependencyOf && (knownMessage.asDependencyOf = asDependencyOf);
|
||||
if (asDependencyOf) {
|
||||
knownMessage.asDependencyOf = asDependencyOf;
|
||||
}
|
||||
messageMap[newCoValueKnownState.id] = {
|
||||
knownMessage: knownMessage,
|
||||
contentMessages: newContentMessages,
|
||||
@@ -272,11 +279,13 @@ export class SyncManager {
|
||||
|
||||
const nextIdx = sessionRow?.lastIdx || 0;
|
||||
|
||||
if (!msg.new[sessionID]) throw new Error("Session ID not found");
|
||||
|
||||
const sessionUpdate = {
|
||||
coValue: storedCoValueRowID,
|
||||
sessionID,
|
||||
lastIdx: newLastIdx,
|
||||
lastSignature: msg.new[sessionID]!.lastSignature,
|
||||
lastSignature: msg.new[sessionID].lastSignature,
|
||||
bytesSinceLastSignature: newBytesSinceLastSignature,
|
||||
};
|
||||
|
||||
@@ -289,7 +298,7 @@ export class SyncManager {
|
||||
await this.dbClient.addSignatureAfter({
|
||||
sessionRowID,
|
||||
idx: newLastIdx - 1,
|
||||
signature: msg.new[sessionID]!.lastSignature,
|
||||
signature: msg.new[sessionID].lastSignature,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -306,7 +315,11 @@ export class SyncManager {
|
||||
|
||||
handleDone(_msg: CojsonInternalTypes.DoneMessage) {}
|
||||
|
||||
async sendStateMessage(msg: any): Promise<unknown> {
|
||||
async sendStateMessage(
|
||||
msg:
|
||||
| CojsonInternalTypes.KnownStateMessage
|
||||
| CojsonInternalTypes.NewContentMessage,
|
||||
): Promise<unknown> {
|
||||
return this.toLocalNode
|
||||
.push(msg)
|
||||
.catch((e) =>
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import {
|
||||
CojsonInternalTypes,
|
||||
JsonValue,
|
||||
SessionID,
|
||||
Stringified,
|
||||
type CojsonInternalTypes,
|
||||
type JsonValue,
|
||||
type SessionID,
|
||||
type Stringified,
|
||||
cojsonInternals,
|
||||
} from "cojson";
|
||||
import { StoredCoValueRow, StoredSessionRow, TransactionRow } from "./types.js";
|
||||
import type {
|
||||
StoredCoValueRow,
|
||||
StoredSessionRow,
|
||||
TransactionRow,
|
||||
} from "./types.js";
|
||||
|
||||
export function collectNewTxs({
|
||||
newTxsInSession,
|
||||
@@ -19,19 +23,17 @@ export function collectNewTxs({
|
||||
firstNewTxIdx: number;
|
||||
}) {
|
||||
for (const tx of newTxsInSession) {
|
||||
let sessionEntry =
|
||||
newContentMessages[newContentMessages.length - 1]!.new[
|
||||
sessionRow.sessionID
|
||||
];
|
||||
const lastMessage = newContentMessages[newContentMessages.length - 1];
|
||||
if (!lastMessage) return;
|
||||
|
||||
let sessionEntry = lastMessage.new[sessionRow.sessionID];
|
||||
if (!sessionEntry) {
|
||||
sessionEntry = {
|
||||
after: firstNewTxIdx,
|
||||
lastSignature: "WILL_BE_REPLACED" as CojsonInternalTypes.Signature,
|
||||
newTransactions: [],
|
||||
};
|
||||
newContentMessages[newContentMessages.length - 1]!.new[
|
||||
sessionRow.sessionID
|
||||
] = sessionEntry;
|
||||
lastMessage.new[sessionRow.sessionID] = sessionEntry;
|
||||
}
|
||||
|
||||
sessionEntry.newTransactions.push(tx.tx);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {
|
||||
Mocked,
|
||||
type Mocked,
|
||||
afterEach,
|
||||
beforeEach,
|
||||
describe,
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
vi,
|
||||
} from "vitest";
|
||||
|
||||
import {
|
||||
import type {
|
||||
CojsonInternalTypes,
|
||||
OutgoingSyncQueue,
|
||||
SessionID,
|
||||
@@ -16,11 +16,12 @@ import {
|
||||
} from "cojson";
|
||||
import { SyncManager } from "../syncManager.js";
|
||||
import { getDependedOnCoValues } from "../syncUtils.js";
|
||||
import { DBClientInterface } from "../types.js";
|
||||
import type { DBClientInterface } from "../types.js";
|
||||
import { fixtures } from "./fixtureMessages.js";
|
||||
import RawCoID = CojsonInternalTypes.RawCoID;
|
||||
import NewContentMessage = CojsonInternalTypes.NewContentMessage;
|
||||
|
||||
type RawCoID = CojsonInternalTypes.RawCoID;
|
||||
type NewContentMessage = CojsonInternalTypes.NewContentMessage;
|
||||
type Transaction = CojsonInternalTypes.Transaction;
|
||||
vi.mock("../syncUtils");
|
||||
|
||||
const coValueIdToLoad = "co_zKwG8NyfZ8GXqcjDHY4NS3SbU2m";
|
||||
@@ -40,7 +41,7 @@ const incomingContentMessage = fixtures[coValueIdToLoad].getContent({
|
||||
|
||||
describe("DB sync manager", () => {
|
||||
let syncManager: SyncManager;
|
||||
let queue: OutgoingSyncQueue = {} as unknown as OutgoingSyncQueue;
|
||||
const queue: OutgoingSyncQueue = {} as unknown as OutgoingSyncQueue;
|
||||
|
||||
const DBClient = vi.fn();
|
||||
DBClient.prototype.getCoValue = vi.fn();
|
||||
@@ -154,11 +155,11 @@ describe("DB sync manager", () => {
|
||||
header: true,
|
||||
id: coValueIdToLoad,
|
||||
sessions: sessionsData.reduce(
|
||||
(acc, sessionRow) => ({
|
||||
...acc,
|
||||
[sessionRow.sessionID]: sessionRow.lastIdx,
|
||||
}),
|
||||
{},
|
||||
(acc, sessionRow) => {
|
||||
acc[sessionRow.sessionID] = sessionRow.lastIdx;
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, number>,
|
||||
),
|
||||
});
|
||||
|
||||
@@ -167,15 +168,22 @@ describe("DB sync manager", () => {
|
||||
header: coValueHeader,
|
||||
id: coValueIdToLoad,
|
||||
new: sessionsData.reduce(
|
||||
(acc, sessionRow) => ({
|
||||
...acc,
|
||||
[sessionRow.sessionID]: {
|
||||
(acc, sessionRow) => {
|
||||
acc[sessionRow.sessionID] = {
|
||||
after: expect.any(Number),
|
||||
lastSignature: expect.any(String),
|
||||
newTransactions: expect.any(Array),
|
||||
},
|
||||
}),
|
||||
{},
|
||||
};
|
||||
return acc;
|
||||
},
|
||||
{} as Record<
|
||||
string,
|
||||
{
|
||||
after: number;
|
||||
lastSignature: string;
|
||||
newTransactions: Transaction[];
|
||||
}
|
||||
>,
|
||||
),
|
||||
priority: 0,
|
||||
});
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { CojsonInternalTypes, SessionID } from "cojson";
|
||||
import RawCoID = CojsonInternalTypes.RawCoID;
|
||||
import Transaction = CojsonInternalTypes.Transaction;
|
||||
import Signature = CojsonInternalTypes.Signature;
|
||||
import type { CojsonInternalTypes, SessionID } from "cojson";
|
||||
|
||||
type RawCoID = CojsonInternalTypes.RawCoID;
|
||||
type Transaction = CojsonInternalTypes.Transaction;
|
||||
type Signature = CojsonInternalTypes.Signature;
|
||||
|
||||
export type CoValueRow = {
|
||||
id: CojsonInternalTypes.RawCoID;
|
||||
@@ -72,7 +73,7 @@ export interface DBClientInterface {
|
||||
sessionRowID: number,
|
||||
idx: number,
|
||||
newTransaction: Transaction,
|
||||
): Promise<number> | void | unknown;
|
||||
): Promise<number> | undefined | unknown;
|
||||
|
||||
addSignatureAfter({
|
||||
sessionRowID,
|
||||
@@ -82,7 +83,7 @@ export interface DBClientInterface {
|
||||
sessionRowID: number;
|
||||
idx: number;
|
||||
signature: Signature;
|
||||
}): Promise<number> | void | unknown;
|
||||
}): Promise<number> | undefined | unknown;
|
||||
|
||||
transaction(callback: () => unknown): Promise<unknown> | void;
|
||||
transaction(callback: () => unknown): Promise<unknown> | undefined;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { SyncMessage } from "cojson";
|
||||
import type { SyncMessage } from "cojson";
|
||||
import { addMessageToBacklog } from "./serialization.js";
|
||||
|
||||
export const MAX_OUTGOING_MESSAGES_CHUNK_BYTES = 25_000;
|
||||
|
||||
export class BatchedOutgoingMessages {
|
||||
private backlog: string = "";
|
||||
private backlog = "";
|
||||
private timeout: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
constructor(private send: (messages: string) => void) {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Peer, logger } from "cojson";
|
||||
import { type Peer, logger } from "cojson";
|
||||
import { createWebSocketPeer } from "./createWebSocketPeer.js";
|
||||
|
||||
export class WebSocketPeerWithReconnection {
|
||||
@@ -61,7 +61,7 @@ export class WebSocketPeerWithReconnection {
|
||||
const timeout = this.reconnectionTimeout * this.reconnectionAttempts;
|
||||
|
||||
logger.debug(
|
||||
"Websocket disconnected, trying to reconnect in " + timeout + "ms",
|
||||
`Websocket disconnected, trying to reconnect in ${timeout}ms`,
|
||||
);
|
||||
|
||||
await this.waitForOnline(timeout);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import {
|
||||
DisconnectedError,
|
||||
Peer,
|
||||
PingTimeoutError,
|
||||
SyncMessage,
|
||||
type DisconnectedError,
|
||||
type Peer,
|
||||
type PingTimeoutError,
|
||||
type SyncMessage,
|
||||
cojsonInternals,
|
||||
logger,
|
||||
} from "cojson";
|
||||
import { BatchedOutgoingMessages } from "./BatchedOutgoingMessages.js";
|
||||
import { deserializeMessages, getErrorMessage } from "./serialization.js";
|
||||
import { AnyWebSocket } from "./types.js";
|
||||
import type { AnyWebSocket } from "./types.js";
|
||||
|
||||
export const BUFFER_LIMIT = 100_000;
|
||||
export const BUFFER_LIMIT_POLLING_INTERVAL = 10;
|
||||
@@ -52,7 +52,7 @@ function waitForWebSocketOpen(websocket: AnyWebSocket) {
|
||||
if (websocket.readyState === 1) {
|
||||
resolve();
|
||||
} else {
|
||||
websocket.addEventListener("open", resolve, { once: true });
|
||||
websocket.addEventListener("open", () => resolve(), { once: true });
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -144,6 +144,8 @@ export function createWebSocketPeer({
|
||||
}
|
||||
|
||||
websocket.addEventListener("close", handleClose);
|
||||
// TODO (#1537): Remove this any once the WebSocket error event type is fixed
|
||||
// biome-ignore lint/suspicious/noExplicitAny: WebSocket error event type
|
||||
websocket.addEventListener("error" as any, (err) => {
|
||||
if (err.message) {
|
||||
logger.warn(err.message);
|
||||
@@ -174,7 +176,7 @@ export function createWebSocketPeer({
|
||||
|
||||
if (!result.ok) {
|
||||
logger.warn(
|
||||
"Error while deserializing messages: " + getErrorMessage(result.error),
|
||||
`Error while deserializing messages: ${getErrorMessage(result.error)}`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -227,7 +229,7 @@ export function createWebSocketPeer({
|
||||
},
|
||||
{ once: true },
|
||||
);
|
||||
} else if (websocket.readyState == 1) {
|
||||
} else if (websocket.readyState === 1) {
|
||||
websocket.close();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { SyncMessage, logger } from "cojson";
|
||||
import { PingMsg } from "./types.js";
|
||||
import { type SyncMessage, logger } from "cojson";
|
||||
import type { PingMsg } from "./types.js";
|
||||
|
||||
export function getErrorMessage(error: unknown) {
|
||||
return error instanceof Error ? error.message : "Unknown error";
|
||||
@@ -28,7 +28,7 @@ export function deserializeMessages(messages: unknown) {
|
||||
| PingMsg[],
|
||||
} as const;
|
||||
} catch (e) {
|
||||
logger.error("Error while deserializing messages: " + getErrorMessage(e));
|
||||
logger.error(`Error while deserializing messages: ${getErrorMessage(e)}`);
|
||||
return {
|
||||
ok: false,
|
||||
error: e,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { SyncMessage } from "cojson";
|
||||
import { CojsonInternalTypes } from "cojson";
|
||||
import type { SyncMessage } from "cojson";
|
||||
import type { CojsonInternalTypes } from "cojson";
|
||||
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
|
||||
import {
|
||||
BatchedOutgoingMessages,
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { SyncMessage } from "cojson";
|
||||
import type { SyncMessage } from "cojson";
|
||||
import type { Channel } from "queueueue";
|
||||
import { Mocked, describe, expect, test, vi } from "vitest";
|
||||
import { type Mocked, describe, expect, test, vi } from "vitest";
|
||||
import { MAX_OUTGOING_MESSAGES_CHUNK_BYTES } from "../BatchedOutgoingMessages.js";
|
||||
import {
|
||||
BUFFER_LIMIT,
|
||||
BUFFER_LIMIT_POLLING_INTERVAL,
|
||||
CreateWebSocketPeerOpts,
|
||||
type CreateWebSocketPeerOpts,
|
||||
createWebSocketPeer,
|
||||
} from "../createWebSocketPeer.js";
|
||||
import { AnyWebSocket } from "../types.js";
|
||||
import type { AnyWebSocket } from "../types.js";
|
||||
|
||||
function setup(opts: Partial<CreateWebSocketPeerOpts> = {}) {
|
||||
const listeners = new Map<string, (event: MessageEvent) => void>();
|
||||
@@ -472,6 +472,7 @@ describe("createWebSocketPeer", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// biome-ignore lint/suspicious/noConfusingVoidType: Test helper
|
||||
function waitFor(callback: () => boolean | void) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
const checkPassed = () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createServer } from "http";
|
||||
import { createServer } from "node:http";
|
||||
import { ControlledAgent, LocalNode } from "cojson";
|
||||
import { WasmCrypto } from "cojson/crypto/WasmCrypto";
|
||||
import { WebSocket, WebSocketServer } from "ws";
|
||||
import { type WebSocket, WebSocketServer } from "ws";
|
||||
import { createWebSocketPeer } from "../createWebSocketPeer";
|
||||
|
||||
export const startSyncServer = async (port?: number) => {
|
||||
@@ -75,16 +75,18 @@ export const startSyncServer = async (port?: number) => {
|
||||
|
||||
server.listen(port ?? 0);
|
||||
|
||||
port = (server.address() as { port: number }).port;
|
||||
const syncServer = `ws://localhost:${port}`;
|
||||
const actualPort = (server.address() as { port: number }).port;
|
||||
const syncServer = `ws://localhost:${actualPort}`;
|
||||
|
||||
return {
|
||||
close: () => {
|
||||
connections.forEach((ws) => ws.close());
|
||||
for (const ws of connections) {
|
||||
ws.close();
|
||||
}
|
||||
server.close();
|
||||
},
|
||||
syncServer,
|
||||
port,
|
||||
port: actualPort,
|
||||
localNode,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// biome-ignore lint/suspicious/noConfusingVoidType: Test helper
|
||||
export function waitFor(callback: () => boolean | void) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
const checkPassed = () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export interface WebsocketEvents {
|
||||
close: { code: number; reason: string };
|
||||
message: { data: unknown };
|
||||
open: void;
|
||||
open: unknown;
|
||||
}
|
||||
|
||||
export interface PingMsg {
|
||||
|
||||
@@ -155,7 +155,7 @@ test("New transactions in a group correctly update owned values, including subsc
|
||||
|
||||
map.subscribe(listener);
|
||||
|
||||
expect(listener.mock.calls[0][0].get("hello")).toBe("world");
|
||||
expect(listener.mock.calls[0]?.[0].get("hello")).toBe("world");
|
||||
|
||||
const resignationThatWeJustLearnedAbout = {
|
||||
privacy: "trusting",
|
||||
@@ -192,7 +192,7 @@ test("New transactions in a group correctly update owned values, including subsc
|
||||
expect(manuallyAdddedTxSuccess).toBe(true);
|
||||
|
||||
expect(listener.mock.calls.length).toBe(2);
|
||||
expect(listener.mock.calls[1][0].get("hello")).toBe(undefined);
|
||||
expect(listener.mock.calls[1]?.[0].get("hello")).toBe(undefined);
|
||||
|
||||
expect(map.core.getValidSortedTransactions().length).toBe(0);
|
||||
});
|
||||
|
||||
@@ -12,5 +12,5 @@
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"include": ["./src/**/*.ts"],
|
||||
"exclude": ["./node_modules", "./src/tests"]
|
||||
"exclude": ["./node_modules"]
|
||||
}
|
||||
|
||||
@@ -249,6 +249,56 @@ module.exports = withNativeWind(config, { input: "./src/global.css" });
|
||||
}
|
||||
}
|
||||
|
||||
// Step 5: Clone cursor-docs
|
||||
const docsSpinner = ora({
|
||||
text: chalk.blue(`Adding .cursor directory...`),
|
||||
spinner: "dots",
|
||||
}).start();
|
||||
|
||||
try {
|
||||
// Create a temporary directory for cursor-docs
|
||||
const tempDocsDir = `${projectName}-cursor-docs-temp`;
|
||||
const emitter = degit("garden-co/jazz/packages/cursor-docs", {
|
||||
cache: false,
|
||||
force: true,
|
||||
verbose: true,
|
||||
});
|
||||
|
||||
// Clone cursor-docs to temp directory
|
||||
await emitter.clone(tempDocsDir);
|
||||
|
||||
// Copy only the .cursor directory to project root
|
||||
const cursorDirSource = `${tempDocsDir}/.cursor`;
|
||||
const cursorDirTarget = `${projectName}/.cursor`;
|
||||
|
||||
if (fs.existsSync(cursorDirSource)) {
|
||||
fs.cpSync(cursorDirSource, cursorDirTarget, { recursive: true });
|
||||
docsSpinner.succeed(chalk.green(".cursor directory added successfully"));
|
||||
} else {
|
||||
docsSpinner.fail(chalk.red(".cursor directory not found in cursor-docs"));
|
||||
}
|
||||
|
||||
// Clean up temp directory
|
||||
fs.rmSync(tempDocsDir, { recursive: true, force: true });
|
||||
} catch (error) {
|
||||
docsSpinner.fail(chalk.red("Failed to add .cursor directory"));
|
||||
throw error;
|
||||
}
|
||||
|
||||
// Step 6: Git init
|
||||
const gitSpinner = ora({
|
||||
text: chalk.blue("Initializing git repository..."),
|
||||
spinner: "dots",
|
||||
}).start();
|
||||
|
||||
try {
|
||||
execSync(`cd "${projectName}" && git init`, { stdio: "pipe" });
|
||||
gitSpinner.succeed(chalk.green("Git repository initialized"));
|
||||
} catch (error) {
|
||||
gitSpinner.fail(chalk.red("Failed to initialize git repository"));
|
||||
throw error;
|
||||
}
|
||||
|
||||
// Final success message
|
||||
console.log("\n" + chalk.green.bold("✨ Project setup completed! ✨\n"));
|
||||
console.log(chalk.cyan("To get started:"));
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# jazz-browser-media-images
|
||||
|
||||
## 0.10.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-browser@0.10.13
|
||||
|
||||
## 0.10.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "jazz-auth-clerk",
|
||||
"version": "0.10.12",
|
||||
"version": "0.10.13",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cojson": "workspace:0.10.8",
|
||||
"jazz-browser": "workspace:0.10.12",
|
||||
"jazz-tools": "workspace:0.10.12"
|
||||
"jazz-browser": "workspace:0.10.13",
|
||||
"jazz-tools": "workspace:0.10.13"
|
||||
},
|
||||
"scripts": {
|
||||
"format-and-lint": "biome check .",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# jazz-browser-media-images
|
||||
|
||||
## 0.10.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-browser@0.10.13
|
||||
|
||||
## 0.10.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-browser-media-images",
|
||||
"version": "0.10.12",
|
||||
"version": "0.10.13",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
@@ -8,8 +8,8 @@
|
||||
"dependencies": {
|
||||
"@types/image-blob-reduce": "^4.1.1",
|
||||
"image-blob-reduce": "^4.1.0",
|
||||
"jazz-browser": "workspace:0.10.12",
|
||||
"jazz-tools": "workspace:0.10.12",
|
||||
"jazz-browser": "workspace:0.10.13",
|
||||
"jazz-tools": "workspace:0.10.13",
|
||||
"pica": "^9.0.1",
|
||||
"typescript": "~5.6.2"
|
||||
},
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# jazz-browser
|
||||
|
||||
## 0.10.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
|
||||
## 0.10.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-browser",
|
||||
"version": "0.10.12",
|
||||
"version": "0.10.13",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# jazz-inspector
|
||||
|
||||
## 0.10.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-react-core@0.10.10
|
||||
|
||||
## 0.10.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-inspector",
|
||||
"version": "0.10.9",
|
||||
"version": "0.10.10",
|
||||
"type": "module",
|
||||
"main": "./dist/app.js",
|
||||
"types": "./dist/app.d.ts",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# jazz-autosub
|
||||
|
||||
## 0.10.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
|
||||
## 0.10.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"types": "src/index.ts",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"version": "0.10.12",
|
||||
"version": "0.10.13",
|
||||
"dependencies": {
|
||||
"cojson": "workspace:*",
|
||||
"cojson-transport-ws": "workspace:*",
|
||||
|
||||
@@ -5,7 +5,7 @@ import { createWorkerAccount } from "jazz-run/createWorkerAccount";
|
||||
import { startSyncServer } from "jazz-run/startSyncServer";
|
||||
import { CoMap, co } from "jazz-tools";
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { startWorker } from "../index";
|
||||
import { startWorker } from "../index.js";
|
||||
|
||||
class TestMap extends CoMap {
|
||||
value = co.string;
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
co,
|
||||
} from "jazz-tools";
|
||||
import { describe, expect, onTestFinished, test } from "vitest";
|
||||
import { startWorker } from "../index";
|
||||
import { startWorker } from "../index.js";
|
||||
|
||||
async function setup<Acc extends Account>(AccountSchema?: AccountClass<Acc>) {
|
||||
const { server, port } = await setupSyncServer();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createWebSocketPeer } from "cojson-transport-ws";
|
||||
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
|
||||
import { webSocketWithReconnection } from "../webSocketWithReconnection";
|
||||
import { webSocketWithReconnection } from "../webSocketWithReconnection.js";
|
||||
|
||||
// Mock dependencies
|
||||
vi.mock("cojson-transport-ws", () => ({
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# jazz-browser-media-images
|
||||
|
||||
## 0.10.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-auth-clerk@0.10.13
|
||||
- jazz-browser@0.10.13
|
||||
- jazz-react@0.10.13
|
||||
|
||||
## 0.10.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-react-auth-clerk",
|
||||
"version": "0.10.12",
|
||||
"version": "0.10.13",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.tsx",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# jazz-react-core
|
||||
|
||||
## 0.10.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
|
||||
## 0.10.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-react-core",
|
||||
"version": "0.10.9",
|
||||
"version": "0.10.10",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
|
||||
@@ -29,6 +29,7 @@ export function usePassphraseAuth({
|
||||
return new PassphraseAuth(
|
||||
context.node.crypto,
|
||||
context.authenticate,
|
||||
context.register,
|
||||
authSecretStorage,
|
||||
wordlist,
|
||||
);
|
||||
@@ -50,6 +51,8 @@ export function usePassphraseAuth({
|
||||
state: isAuthenticated ? "signedIn" : "anonymous",
|
||||
logIn: authMethod.logIn,
|
||||
signUp: authMethod.signUp,
|
||||
registerNewAccount: authMethod.registerNewAccount,
|
||||
generateRandomPassphrase: authMethod.generateRandomPassphrase,
|
||||
passphrase,
|
||||
} as const;
|
||||
}
|
||||
|
||||
@@ -135,7 +135,14 @@ export function useCoState<V extends CoValue, D>(
|
||||
() => observable.getCurrentValue(),
|
||||
);
|
||||
|
||||
return value;
|
||||
return React.useMemo(() => {
|
||||
if (!id) {
|
||||
observable.reset();
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return value;
|
||||
}, [id, value]);
|
||||
}
|
||||
|
||||
export function createUseAccountHooks<Acc extends Account>() {
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-react-native-auth-clerk
|
||||
|
||||
## 0.10.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-auth-clerk@0.10.13
|
||||
- jazz-react-native@0.10.13
|
||||
|
||||
## 0.10.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-react-native-auth-clerk",
|
||||
"version": "0.10.12",
|
||||
"version": "0.10.13",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.tsx",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# jazz-browser-media-images
|
||||
|
||||
## 0.10.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
|
||||
## 0.10.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-react-native-media-images",
|
||||
"version": "0.10.12",
|
||||
"version": "0.10.13",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# jazz-browser
|
||||
|
||||
## 0.10.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-react-core@0.10.10
|
||||
|
||||
## 0.10.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-react-native",
|
||||
"version": "0.10.12",
|
||||
"version": "0.10.13",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-react
|
||||
|
||||
## 0.10.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-browser@0.10.13
|
||||
- jazz-react-core@0.10.10
|
||||
|
||||
## 0.10.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-react",
|
||||
"version": "0.10.12",
|
||||
"version": "0.10.13",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
@@ -18,9 +18,9 @@
|
||||
"dependencies": {
|
||||
"@scure/bip39": "^1.3.0",
|
||||
"cojson": "workspace:0.10.8",
|
||||
"jazz-browser": "workspace:0.10.12",
|
||||
"jazz-browser": "workspace:0.10.13",
|
||||
"jazz-react-core": "workspace:*",
|
||||
"jazz-tools": "workspace:0.10.12"
|
||||
"jazz-tools": "workspace:0.10.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/dom": "^10.4.0",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# jazz-run
|
||||
|
||||
## 0.10.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
|
||||
## 0.10.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"bin": "./dist/index.js",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"version": "0.10.12",
|
||||
"version": "0.10.13",
|
||||
"exports": {
|
||||
"./startSyncServer": {
|
||||
"import": "./dist/startSyncServer.js",
|
||||
@@ -32,7 +32,7 @@
|
||||
"cojson-storage-sqlite": "workspace:0.10.8",
|
||||
"cojson-transport-ws": "workspace:0.10.8",
|
||||
"effect": "^3.6.5",
|
||||
"jazz-tools": "workspace:0.10.12",
|
||||
"jazz-tools": "workspace:0.10.13",
|
||||
"ws": "^8.14.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# jazz-svelte
|
||||
|
||||
## 0.10.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [07feedd]
|
||||
- jazz-tools@0.10.13
|
||||
- jazz-browser@0.10.13
|
||||
|
||||
## 0.10.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-svelte",
|
||||
"version": "0.10.12",
|
||||
"version": "0.10.13",
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build && npm run package",
|
||||
|
||||
@@ -14,6 +14,7 @@ export function usePassphraseAuth({
|
||||
const auth = new PassphraseAuth(
|
||||
context.current.node.crypto,
|
||||
context.current.authenticate,
|
||||
context.current.register,
|
||||
authSecretStorage,
|
||||
wordlist
|
||||
);
|
||||
@@ -35,6 +36,8 @@ export function usePassphraseAuth({
|
||||
return {
|
||||
logIn: auth.logIn,
|
||||
signUp: auth.signUp,
|
||||
registerNewAccount: auth.registerNewAccount,
|
||||
generateRandomPassphrase: auth.generateRandomPassphrase,
|
||||
get passphrase() {
|
||||
return passphrase;
|
||||
},
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# jazz-tools
|
||||
|
||||
## 0.10.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 07feedd: Add registerNewUser and generateRandomPassphrase methods to PasskeyAuth and accept the username param on the signUp function
|
||||
|
||||
## 0.10.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user