Compare commits
6 Commits
jazz-tools
...
jazz-tools
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac3c2df474 | ||
|
|
681f973d4b | ||
|
|
338be7622f | ||
|
|
1227047b03 | ||
|
|
9afde8d0be | ||
|
|
c2ca1feba0 |
@@ -1,5 +1,16 @@
|
||||
# chat-rn-clerk
|
||||
|
||||
## 1.0.58
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-react-native@0.9.17
|
||||
- jazz-react-native-auth-clerk@0.9.17
|
||||
- jazz-react-native-media-images@0.9.17
|
||||
|
||||
## 1.0.57
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "chat-rn-clerk",
|
||||
"main": "index.js",
|
||||
"version": "1.0.57",
|
||||
"version": "1.0.58",
|
||||
"scripts": {
|
||||
"build": "expo export -p ios",
|
||||
"start": "expo start",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# chat-rn
|
||||
|
||||
## 1.0.55
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-react-native@0.9.17
|
||||
|
||||
## 1.0.54
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "chat-rn",
|
||||
"version": "1.0.54",
|
||||
"version": "1.0.55",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "expo export -p ios",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# chat-vue
|
||||
|
||||
## 0.0.42
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-browser@0.9.17
|
||||
- jazz-vue@0.9.17
|
||||
|
||||
## 0.0.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "chat-vue",
|
||||
"version": "0.0.41",
|
||||
"version": "0.0.42",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# jazz-example-chat
|
||||
|
||||
## 0.0.138
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-browser-media-images@0.9.17
|
||||
- jazz-react@0.9.17
|
||||
|
||||
## 0.0.137
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-chat",
|
||||
"private": true,
|
||||
"version": "0.0.137",
|
||||
"version": "0.0.138",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# minimal-auth-clerk
|
||||
|
||||
## 0.0.37
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-react@0.9.17
|
||||
- jazz-react-auth-clerk@0.9.17
|
||||
|
||||
## 0.0.36
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "clerk",
|
||||
"private": true,
|
||||
"version": "0.0.36",
|
||||
"version": "0.0.37",
|
||||
"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.9.16",
|
||||
"jazz-react-auth-clerk": "workspace:0.9.17",
|
||||
"jazz-tools": "workspace:*",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1"
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# file-share-svelte
|
||||
|
||||
## 0.0.22
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-svelte@0.9.17
|
||||
|
||||
## 0.0.21
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "file-share-svelte",
|
||||
"version": "0.0.21",
|
||||
"version": "0.0.22",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# form
|
||||
|
||||
## 0.0.33
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-browser-media-images@0.9.17
|
||||
- jazz-react@0.9.17
|
||||
|
||||
## 0.0.32
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "form",
|
||||
"private": true,
|
||||
"version": "0.0.32",
|
||||
"version": "0.0.33",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# image-upload
|
||||
|
||||
## 0.0.35
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-browser-media-images@0.9.17
|
||||
- jazz-react@0.9.17
|
||||
|
||||
## 0.0.34
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "image-upload",
|
||||
"private": true,
|
||||
"version": "0.0.34",
|
||||
"version": "0.0.35",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# jazz-example-musicplayer
|
||||
|
||||
## 0.0.58
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-inspector@0.9.17
|
||||
- jazz-react@0.9.17
|
||||
|
||||
## 0.0.57
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-music-player",
|
||||
"private": true,
|
||||
"version": "0.0.57",
|
||||
"version": "0.0.58",
|
||||
"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.9.16",
|
||||
"jazz-tools": "workspace:0.9.16",
|
||||
"jazz-react": "workspace:0.9.17",
|
||||
"jazz-tools": "workspace:0.9.17",
|
||||
"jazz-inspector": "workspace:*",
|
||||
"lucide-react": "^0.274.0",
|
||||
"react": "^18.3.1",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# jazz-example-onboarding
|
||||
|
||||
## 0.0.39
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-browser-media-images@0.9.17
|
||||
- jazz-react@0.9.17
|
||||
|
||||
## 0.0.38
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-onboarding",
|
||||
"private": true,
|
||||
"version": "0.0.38",
|
||||
"version": "0.0.39",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# organization
|
||||
|
||||
## 0.0.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-react@0.9.17
|
||||
|
||||
## 0.0.30
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "organization",
|
||||
"private": true,
|
||||
"version": "0.0.30",
|
||||
"version": "0.0.31",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# passkey-svelte
|
||||
|
||||
## 0.0.26
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- jazz-svelte@0.9.17
|
||||
|
||||
## 0.0.25
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "passkey-svelte",
|
||||
"version": "0.0.25",
|
||||
"version": "0.0.26",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# minimal-auth-passkey
|
||||
|
||||
## 0.0.36
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-react@0.9.17
|
||||
|
||||
## 0.0.35
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "passkey",
|
||||
"private": true,
|
||||
"version": "0.0.35",
|
||||
"version": "0.0.36",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-password-manager
|
||||
|
||||
## 0.0.57
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-react@0.9.17
|
||||
|
||||
## 0.0.56
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-password-manager",
|
||||
"private": true,
|
||||
"version": "0.0.56",
|
||||
"version": "0.0.57",
|
||||
"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.9.16",
|
||||
"jazz-tools": "workspace:0.9.16",
|
||||
"jazz-react": "workspace:0.9.17",
|
||||
"jazz-tools": "workspace:0.9.17",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-hook-form": "^7.41.5",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# jazz-example-pets
|
||||
|
||||
## 0.0.155
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-browser-media-images@0.9.17
|
||||
- jazz-react@0.9.17
|
||||
|
||||
## 0.0.154
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-pets",
|
||||
"private": true,
|
||||
"version": "0.0.154",
|
||||
"version": "0.0.155",
|
||||
"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.9.16",
|
||||
"jazz-react": "workspace:0.9.16",
|
||||
"jazz-tools": "workspace:0.9.16",
|
||||
"jazz-browser-media-images": "workspace:0.9.17",
|
||||
"jazz-react": "workspace:0.9.17",
|
||||
"jazz-tools": "workspace:0.9.17",
|
||||
"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.9.16",
|
||||
"jazz-run": "workspace:0.9.17",
|
||||
"postcss": "^8.4.27",
|
||||
"tailwindcss": "^3.4.15",
|
||||
"typescript": "~5.6.2",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# reactions
|
||||
|
||||
## 0.0.35
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-browser-media-images@0.9.17
|
||||
- jazz-react@0.9.17
|
||||
|
||||
## 0.0.34
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "reactions",
|
||||
"private": true,
|
||||
"version": "0.0.34",
|
||||
"version": "0.0.35",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# todo-vue
|
||||
|
||||
## 0.0.40
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-browser@0.9.17
|
||||
- jazz-vue@0.9.17
|
||||
|
||||
## 0.0.39
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "todo-vue",
|
||||
"version": "0.0.39",
|
||||
"version": "0.0.40",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-example-todo
|
||||
|
||||
## 0.0.154
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-react@0.9.17
|
||||
|
||||
## 0.0.153
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-example-todo",
|
||||
"private": true,
|
||||
"version": "0.0.153",
|
||||
"version": "0.0.154",
|
||||
"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.9.16",
|
||||
"jazz-tools": "workspace:0.9.16",
|
||||
"jazz-react": "workspace:0.9.17",
|
||||
"jazz-tools": "workspace:0.9.17",
|
||||
"lucide-react": "^0.274.0",
|
||||
"qrcode": "^1.5.3",
|
||||
"react": "^18.3.1",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# version-history
|
||||
|
||||
## 0.0.32
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-react@0.9.17
|
||||
|
||||
## 0.0.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "version-history",
|
||||
"private": true,
|
||||
"version": "0.0.31",
|
||||
"version": "0.0.32",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -38,7 +38,7 @@ import {
|
||||
} from "./ids.js";
|
||||
import { Stringified, parseJSON, stableStringify } from "./jsonStringify.js";
|
||||
import { LocalNode } from "./localNode.js";
|
||||
import type { Role } from "./permissions.js";
|
||||
import type { AccountRole, Role } from "./permissions.js";
|
||||
import { Channel, connectedPeers } from "./streamUtils.js";
|
||||
import { accountOrAgentIDfromSessionID } from "./typeUtils/accountOrAgentIDfromSessionID.js";
|
||||
import { expectGroup } from "./typeUtils/expectGroup.js";
|
||||
@@ -158,6 +158,7 @@ export type {
|
||||
Stringified,
|
||||
CoStreamItem,
|
||||
OpID,
|
||||
AccountRole,
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-browser-media-images
|
||||
|
||||
## 0.9.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-browser@0.9.17
|
||||
|
||||
## 0.9.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "jazz-browser-auth-clerk",
|
||||
"version": "0.9.16",
|
||||
"version": "0.9.17",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cojson": "workspace:0.9.13",
|
||||
"jazz-browser": "workspace:0.9.16",
|
||||
"jazz-tools": "workspace:0.9.16"
|
||||
"jazz-browser": "workspace:0.9.17",
|
||||
"jazz-tools": "workspace:0.9.17"
|
||||
},
|
||||
"scripts": {
|
||||
"format-and-lint": "biome check .",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-browser-media-images
|
||||
|
||||
## 0.9.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-browser@0.9.17
|
||||
|
||||
## 0.9.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-browser-media-images",
|
||||
"version": "0.9.16",
|
||||
"version": "0.9.17",
|
||||
"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.9.16",
|
||||
"jazz-tools": "workspace:0.9.16",
|
||||
"jazz-browser": "workspace:0.9.17",
|
||||
"jazz-tools": "workspace:0.9.17",
|
||||
"pica": "^9.0.1",
|
||||
"typescript": "~5.6.2"
|
||||
},
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# jazz-browser
|
||||
|
||||
## 0.9.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
|
||||
## 0.9.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-browser",
|
||||
"version": "0.9.16",
|
||||
"version": "0.9.17",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
@@ -10,7 +10,7 @@
|
||||
"cojson": "workspace:0.9.13",
|
||||
"cojson-storage-indexeddb": "workspace:0.9.13",
|
||||
"cojson-transport-ws": "workspace:0.9.13",
|
||||
"jazz-tools": "workspace:0.9.16",
|
||||
"jazz-tools": "workspace:0.9.17",
|
||||
"typescript": "~5.6.2"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -12,7 +12,8 @@ import {
|
||||
InviteSecret,
|
||||
SessionID,
|
||||
WasmCrypto,
|
||||
cojsonInternals,
|
||||
createInviteLink as baseCreateInviteLink,
|
||||
consumeInviteLink,
|
||||
createJazzContext,
|
||||
} from "jazz-tools";
|
||||
import { OPFSFilesystem } from "./OPFSFilesystem.js";
|
||||
@@ -212,68 +213,19 @@ export function createInviteLink<C extends CoValue>(
|
||||
valueHint,
|
||||
}: { baseURL?: string; valueHint?: string } = {},
|
||||
): string {
|
||||
const coValueCore = value._raw.core;
|
||||
let currentCoValue = coValueCore;
|
||||
|
||||
while (currentCoValue.header.ruleset.type === "ownedByGroup") {
|
||||
currentCoValue = currentCoValue.getGroup().core;
|
||||
}
|
||||
|
||||
const { ruleset, meta } = currentCoValue.header;
|
||||
|
||||
if (ruleset.type !== "group" || meta?.type === "account") {
|
||||
throw new Error("Can't create invite link for object without group");
|
||||
}
|
||||
|
||||
const group = cojsonInternals.expectGroup(currentCoValue.getCurrentContent());
|
||||
const inviteSecret = group.createInvite(role);
|
||||
|
||||
return `${baseURL}#/invite/${valueHint ? valueHint + "/" : ""}${
|
||||
value.id
|
||||
}/${inviteSecret}`;
|
||||
return baseCreateInviteLink(value, role, baseURL, valueHint);
|
||||
}
|
||||
|
||||
/** @category Invite Links */
|
||||
export function parseInviteLink<C extends CoValue>(
|
||||
inviteURL: string,
|
||||
):
|
||||
| {
|
||||
valueID: ID<C>;
|
||||
valueHint?: string;
|
||||
inviteSecret: InviteSecret;
|
||||
}
|
||||
| undefined {
|
||||
const url = new URL(inviteURL);
|
||||
const parts = url.hash.split("/");
|
||||
|
||||
let valueHint: string | undefined;
|
||||
let valueID: ID<C> | undefined;
|
||||
let inviteSecret: InviteSecret | undefined;
|
||||
|
||||
if (parts[0] === "#" && parts[1] === "invite") {
|
||||
if (parts.length === 5) {
|
||||
valueHint = parts[2];
|
||||
valueID = parts[3] as ID<C>;
|
||||
inviteSecret = parts[4] as InviteSecret;
|
||||
} else if (parts.length === 4) {
|
||||
valueID = parts[2] as ID<C>;
|
||||
inviteSecret = parts[3] as InviteSecret;
|
||||
}
|
||||
|
||||
if (!valueID || !inviteSecret) {
|
||||
return undefined;
|
||||
}
|
||||
return { valueID, inviteSecret, valueHint };
|
||||
}
|
||||
}
|
||||
export { parseInviteLink } from "jazz-tools";
|
||||
|
||||
/** @category Invite Links */
|
||||
export function consumeInviteLinkFromWindowLocation<V extends CoValue>({
|
||||
export async function consumeInviteLinkFromWindowLocation<V extends CoValue>({
|
||||
as,
|
||||
forValueHint,
|
||||
invitedObjectSchema,
|
||||
}: {
|
||||
as: Account;
|
||||
as?: Account;
|
||||
forValueHint?: string;
|
||||
invitedObjectSchema: CoValueClass<V>;
|
||||
}): Promise<
|
||||
@@ -284,22 +236,20 @@ export function consumeInviteLinkFromWindowLocation<V extends CoValue>({
|
||||
}
|
||||
| undefined
|
||||
> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const result = parseInviteLink<V>(window.location.href);
|
||||
|
||||
if (result && result.valueHint === forValueHint) {
|
||||
as.acceptInvite(result.valueID, result.inviteSecret, invitedObjectSchema)
|
||||
.then(() => {
|
||||
resolve(result);
|
||||
window.history.replaceState(
|
||||
{},
|
||||
"",
|
||||
window.location.href.replace(/#.*$/, ""),
|
||||
);
|
||||
})
|
||||
.catch(reject);
|
||||
} else {
|
||||
resolve(undefined);
|
||||
}
|
||||
const result = await consumeInviteLink({
|
||||
inviteURL: window.location.href,
|
||||
as,
|
||||
forValueHint,
|
||||
invitedObjectSchema,
|
||||
});
|
||||
|
||||
if (result) {
|
||||
window.history.replaceState(
|
||||
{},
|
||||
"",
|
||||
window.location.href.replace(/#.*$/, ""),
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-inspector
|
||||
|
||||
## 0.9.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-react-core@0.8.58
|
||||
|
||||
## 0.9.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-inspector",
|
||||
"version": "0.9.16",
|
||||
"version": "0.9.17",
|
||||
"type": "module",
|
||||
"main": "./dist/jazz-inspector.js",
|
||||
"types": "./src/app.tsx",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# jazz-autosub
|
||||
|
||||
## 0.9.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
|
||||
## 0.9.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
"types": "src/index.ts",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"version": "0.9.16",
|
||||
"version": "0.9.17",
|
||||
"dependencies": {
|
||||
"cojson": "workspace:0.9.13",
|
||||
"cojson-transport-ws": "workspace:0.9.13",
|
||||
"jazz-tools": "workspace:0.9.16",
|
||||
"jazz-tools": "workspace:0.9.17",
|
||||
"ws": "^8.14.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# jazz-browser-media-images
|
||||
|
||||
## 0.9.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-browser-auth-clerk@0.9.17
|
||||
- jazz-react@0.9.17
|
||||
|
||||
## 0.9.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
{
|
||||
"name": "jazz-react-auth-clerk",
|
||||
"version": "0.9.16",
|
||||
"version": "0.9.17",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.tsx",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cojson": "workspace:0.9.13",
|
||||
"jazz-browser-auth-clerk": "workspace:0.9.16",
|
||||
"jazz-react": "workspace:0.9.16",
|
||||
"jazz-tools": "workspace:0.9.16"
|
||||
"jazz-browser-auth-clerk": "workspace:0.9.17",
|
||||
"jazz-react": "workspace:0.9.17",
|
||||
"jazz-tools": "workspace:0.9.17"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^18.2.0"
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# jazz-react-core
|
||||
|
||||
## 0.8.58
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
|
||||
## 0.8.57
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-react-core",
|
||||
"version": "0.8.57",
|
||||
"version": "0.8.58",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-react-native-auth-clerk
|
||||
|
||||
## 0.9.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-react-native@0.9.17
|
||||
|
||||
## 0.9.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-react-native-auth-clerk",
|
||||
"version": "0.9.16",
|
||||
"version": "0.9.17",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# jazz-browser-media-images
|
||||
|
||||
## 0.9.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
|
||||
## 0.9.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-react-native-media-images",
|
||||
"version": "0.9.16",
|
||||
"version": "0.9.17",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-browser
|
||||
|
||||
## 0.9.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-react-core@0.8.58
|
||||
|
||||
## 0.9.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-react-native",
|
||||
"version": "0.9.16",
|
||||
"version": "0.9.17",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
"module": "./dist/index.js",
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { useEffect } from "react";
|
||||
|
||||
import { createUseAccountHooks, useJazzContext } from "jazz-react-core";
|
||||
import { CoValue, CoValueClass, ID } from "jazz-tools";
|
||||
import { CoValue, CoValueClass, ID, parseInviteLink } from "jazz-tools";
|
||||
import { Linking } from "react-native";
|
||||
import { parseInviteLink } from "./platform.js";
|
||||
import { RegisteredAccount } from "./provider.js";
|
||||
|
||||
export { useCoState, experimental_useInboxSender } from "jazz-react-core";
|
||||
|
||||
@@ -4,4 +4,5 @@ export * from "./storage/kv-store-context.js";
|
||||
export * from "./hooks.js";
|
||||
export * from "./media.js";
|
||||
|
||||
export { parseInviteLink, createInviteLink, setupKvStore } from "./platform.js";
|
||||
export { parseInviteLink } from "jazz-tools";
|
||||
export { createInviteLink, setupKvStore } from "./platform.js";
|
||||
|
||||
@@ -8,9 +8,8 @@ import {
|
||||
CoValueClass,
|
||||
CryptoProvider,
|
||||
ID,
|
||||
InviteSecret,
|
||||
SessionID,
|
||||
cojsonInternals,
|
||||
createInviteLink as baseCreateInviteLink,
|
||||
createJazzContext,
|
||||
} from "jazz-tools";
|
||||
|
||||
@@ -155,58 +154,7 @@ export function createInviteLink<C extends CoValue>(
|
||||
role: "reader" | "writer" | "admin",
|
||||
{ baseURL, valueHint }: { baseURL?: string; valueHint?: string } = {},
|
||||
): string {
|
||||
const coValueCore = value._raw.core;
|
||||
let currentCoValue = coValueCore;
|
||||
|
||||
while (currentCoValue.header.ruleset.type === "ownedByGroup") {
|
||||
currentCoValue = currentCoValue.getGroup().core;
|
||||
}
|
||||
|
||||
if (currentCoValue.header.ruleset.type !== "group") {
|
||||
throw new Error("Can't create invite link for object without group");
|
||||
}
|
||||
|
||||
const group = cojsonInternals.expectGroup(currentCoValue.getCurrentContent());
|
||||
const inviteSecret = group.createInvite(role);
|
||||
|
||||
return `${baseURL}/invite/${valueHint ? valueHint + "/" : ""}${
|
||||
value.id
|
||||
}/${inviteSecret}`;
|
||||
}
|
||||
|
||||
/** @category Invite Links */
|
||||
// TODO: copied from jazz-browser, should be shared
|
||||
export function parseInviteLink<C extends CoValue>(
|
||||
inviteURL: string,
|
||||
):
|
||||
| {
|
||||
valueID: ID<C>;
|
||||
valueHint?: string;
|
||||
inviteSecret: InviteSecret;
|
||||
}
|
||||
| undefined {
|
||||
const url = new URL(inviteURL);
|
||||
const parts = url.hash.split("/");
|
||||
|
||||
let valueHint: string | undefined;
|
||||
let valueID: ID<C> | undefined;
|
||||
let inviteSecret: InviteSecret | undefined;
|
||||
|
||||
if (parts[0] === "#" && parts[1] === "invite") {
|
||||
if (parts.length === 5) {
|
||||
valueHint = parts[2];
|
||||
valueID = parts[3] as ID<C>;
|
||||
inviteSecret = parts[4] as InviteSecret;
|
||||
} else if (parts.length === 4) {
|
||||
valueID = parts[2] as ID<C>;
|
||||
inviteSecret = parts[3] as InviteSecret;
|
||||
}
|
||||
|
||||
if (!valueID || !inviteSecret) {
|
||||
return undefined;
|
||||
}
|
||||
return { valueID, inviteSecret, valueHint };
|
||||
}
|
||||
return baseCreateInviteLink(value, role, baseURL ?? "", valueHint);
|
||||
}
|
||||
|
||||
export function setupKvStore(kvStore = new ExpoSecureStoreAdapter()) {
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# jazz-react
|
||||
|
||||
## 0.9.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-browser@0.9.17
|
||||
- jazz-react-core@0.8.58
|
||||
|
||||
## 0.9.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-react",
|
||||
"version": "0.9.16",
|
||||
"version": "0.9.17",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
@@ -18,8 +18,8 @@
|
||||
"dependencies": {
|
||||
"@scure/bip39": "^1.3.0",
|
||||
"cojson": "workspace:0.9.13",
|
||||
"jazz-browser": "workspace:0.9.16",
|
||||
"jazz-tools": "workspace:0.9.16",
|
||||
"jazz-browser": "workspace:0.9.17",
|
||||
"jazz-tools": "workspace:0.9.17",
|
||||
"jazz-react-core": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# jazz-run
|
||||
|
||||
## 0.9.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
|
||||
## 0.9.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"bin": "./dist/index.js",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"version": "0.9.16",
|
||||
"version": "0.9.17",
|
||||
"exports": {
|
||||
"./startSyncServer": {
|
||||
"import": "./dist/startSyncServer.js",
|
||||
@@ -32,7 +32,7 @@
|
||||
"cojson-storage-sqlite": "workspace:0.9.13",
|
||||
"cojson-transport-ws": "workspace:0.9.13",
|
||||
"effect": "^3.6.5",
|
||||
"jazz-tools": "workspace:0.9.16",
|
||||
"jazz-tools": "workspace:0.9.17",
|
||||
"ws": "^8.14.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-svelte
|
||||
|
||||
## 0.9.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-browser@0.9.17
|
||||
|
||||
## 0.9.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-svelte",
|
||||
"version": "0.9.16",
|
||||
"version": "0.9.17",
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build && npm run package",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# jazz-tools
|
||||
|
||||
## 0.9.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- c2ca1fe: Add cross-platform invite API
|
||||
- 1227047: Improve typescript types for group.addMember
|
||||
|
||||
## 0.9.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
},
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"version": "0.9.16",
|
||||
"version": "0.9.17",
|
||||
"dependencies": {
|
||||
"cojson": "workspace:*"
|
||||
},
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
import type { Everyone, RawAccountID, RawGroup, Role } from "cojson";
|
||||
import type {
|
||||
AccountRole,
|
||||
Everyone,
|
||||
RawAccountID,
|
||||
RawGroup,
|
||||
Role,
|
||||
} from "cojson";
|
||||
import type {
|
||||
CoValue,
|
||||
CoValueClass,
|
||||
@@ -133,7 +139,9 @@ export class Group extends CoValueBase implements CoValue {
|
||||
return this._raw.myRole();
|
||||
}
|
||||
|
||||
addMember(member: Everyone | Account, role: Role) {
|
||||
addMember(member: Everyone, role: "writer" | "reader"): Group;
|
||||
addMember(member: Account, role: AccountRole): Group;
|
||||
addMember(member: Everyone | Account, role: AccountRole) {
|
||||
this._raw.addMember(member === "everyone" ? member : member._raw, role);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,12 @@ export {
|
||||
subscribeToCoValue,
|
||||
} from "./internal.js";
|
||||
|
||||
export {
|
||||
createInviteLink,
|
||||
parseInviteLink,
|
||||
consumeInviteLink,
|
||||
} from "./implementation/invites.js";
|
||||
|
||||
export {
|
||||
AnonymousJazzAgent,
|
||||
createAnonymousJazzContext,
|
||||
|
||||
99
packages/jazz-tools/src/implementation/invites.ts
Normal file
99
packages/jazz-tools/src/implementation/invites.ts
Normal file
@@ -0,0 +1,99 @@
|
||||
import { type InviteSecret, cojsonInternals } from "cojson";
|
||||
import { Account } from "../coValues/account.js";
|
||||
import type { CoValue, CoValueClass, ID } from "../internal.js";
|
||||
|
||||
/** @category Invite Links */
|
||||
export function createInviteLink<C extends CoValue>(
|
||||
value: C,
|
||||
role: "reader" | "writer" | "admin" | "writeOnly",
|
||||
baseURL: string,
|
||||
valueHint?: string,
|
||||
): string {
|
||||
const coValueCore = value._raw.core;
|
||||
let currentCoValue = coValueCore;
|
||||
|
||||
while (currentCoValue.header.ruleset.type === "ownedByGroup") {
|
||||
currentCoValue = currentCoValue.getGroup().core;
|
||||
}
|
||||
|
||||
const { ruleset, meta } = currentCoValue.header;
|
||||
|
||||
if (ruleset.type !== "group" || meta?.type === "account") {
|
||||
throw new Error("Can't create invite link for object without group");
|
||||
}
|
||||
|
||||
const group = cojsonInternals.expectGroup(currentCoValue.getCurrentContent());
|
||||
const inviteSecret = group.createInvite(role);
|
||||
|
||||
return `${baseURL}#/invite/${valueHint ? valueHint + "/" : ""}${
|
||||
value.id
|
||||
}/${inviteSecret}`;
|
||||
}
|
||||
|
||||
/** @category Invite Links */
|
||||
export function parseInviteLink<C extends CoValue>(
|
||||
inviteURL: string,
|
||||
):
|
||||
| {
|
||||
valueID: ID<C>;
|
||||
valueHint?: string;
|
||||
inviteSecret: InviteSecret;
|
||||
}
|
||||
| undefined {
|
||||
const url = new URL(inviteURL);
|
||||
const parts = url.hash.split("/");
|
||||
|
||||
let valueHint: string | undefined;
|
||||
let valueID: ID<C> | undefined;
|
||||
let inviteSecret: InviteSecret | undefined;
|
||||
|
||||
if (parts[0] === "#" && parts[1] === "invite") {
|
||||
if (parts.length === 5) {
|
||||
valueHint = parts[2];
|
||||
valueID = parts[3] as ID<C>;
|
||||
inviteSecret = parts[4] as InviteSecret;
|
||||
} else if (parts.length === 4) {
|
||||
valueID = parts[2] as ID<C>;
|
||||
inviteSecret = parts[3] as InviteSecret;
|
||||
}
|
||||
|
||||
if (!valueID || !inviteSecret) {
|
||||
return undefined;
|
||||
}
|
||||
return { valueID, inviteSecret, valueHint };
|
||||
}
|
||||
}
|
||||
|
||||
/** @category Invite Links */
|
||||
export function consumeInviteLink<V extends CoValue>({
|
||||
inviteURL,
|
||||
as = Account.getMe(),
|
||||
forValueHint,
|
||||
invitedObjectSchema,
|
||||
}: {
|
||||
inviteURL: string;
|
||||
as?: Account;
|
||||
forValueHint?: string;
|
||||
invitedObjectSchema: CoValueClass<V>;
|
||||
}): Promise<
|
||||
| {
|
||||
valueID: ID<V>;
|
||||
valueHint?: string;
|
||||
inviteSecret: InviteSecret;
|
||||
}
|
||||
| undefined
|
||||
> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const result = parseInviteLink<V>(inviteURL);
|
||||
|
||||
if (result && result.valueHint === forValueHint) {
|
||||
as.acceptInvite(result.valueID, result.inviteSecret, invitedObjectSchema)
|
||||
.then(() => {
|
||||
resolve(result);
|
||||
})
|
||||
.catch(reject);
|
||||
} else {
|
||||
resolve(undefined);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,10 +1,17 @@
|
||||
import { WasmCrypto } from "cojson";
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { beforeEach, describe, expect, test } from "vitest";
|
||||
import { Account, CoMap, Group, Profile, co } from "../exports.js";
|
||||
import { createJazzTestAccount } from "../testing.js";
|
||||
import { setupTwoNodes } from "./utils.js";
|
||||
|
||||
const Crypto = await WasmCrypto.create();
|
||||
|
||||
beforeEach(async () => {
|
||||
await createJazzTestAccount({
|
||||
isCurrentActiveAccount: true,
|
||||
});
|
||||
});
|
||||
|
||||
describe("Custom accounts and groups", async () => {
|
||||
class CustomProfile extends Profile {
|
||||
name = co.string;
|
||||
@@ -180,4 +187,61 @@ describe("Group inheritance", () => {
|
||||
|
||||
expect(loadedGroup).not.toBe("unavailable");
|
||||
});
|
||||
|
||||
test("everyone is valid only for reader and writer roles", () => {
|
||||
const group = Group.create();
|
||||
group.addMember("everyone", "reader");
|
||||
|
||||
expect(group.members).toContainEqual({
|
||||
id: "everyone",
|
||||
role: "reader",
|
||||
account: undefined,
|
||||
ref: undefined,
|
||||
});
|
||||
|
||||
group.addMember("everyone", "writer");
|
||||
|
||||
expect(group.members).toContainEqual({
|
||||
id: "everyone",
|
||||
role: "writer",
|
||||
account: undefined,
|
||||
ref: undefined,
|
||||
});
|
||||
|
||||
// @ts-expect-error - admin is not a valid role for everyone
|
||||
expect(() => group.addMember("everyone", "admin")).toThrow();
|
||||
|
||||
expect(group.members).toContainEqual({
|
||||
id: "everyone",
|
||||
role: "writer",
|
||||
account: undefined,
|
||||
ref: undefined,
|
||||
});
|
||||
|
||||
// @ts-expect-error - writeOnly is not a valid role for everyone
|
||||
expect(() => group.addMember("everyone", "writeOnly")).toThrow();
|
||||
|
||||
expect(group.members).toContainEqual({
|
||||
id: "everyone",
|
||||
role: "writer",
|
||||
account: undefined,
|
||||
ref: undefined,
|
||||
});
|
||||
});
|
||||
|
||||
test("typescript should show an error when adding a member with a non-account role", async () => {
|
||||
const account = await createJazzTestAccount({});
|
||||
|
||||
const group = Group.create();
|
||||
|
||||
// @ts-expect-error - Even though readerInvite is a valid role for an account, we don't allow it to not create confusion when using the intellisense
|
||||
group.addMember(account, "readerInvite");
|
||||
|
||||
expect(group.members).toContainEqual(
|
||||
expect.objectContaining({
|
||||
id: account.id,
|
||||
role: "readerInvite",
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
85
packages/jazz-tools/src/tests/invites.test.ts
Normal file
85
packages/jazz-tools/src/tests/invites.test.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
import { beforeEach, describe, expect, test } from "vitest";
|
||||
import { Account, Group } from "../exports";
|
||||
import {
|
||||
consumeInviteLink,
|
||||
createInviteLink,
|
||||
parseInviteLink,
|
||||
} from "../implementation/invites";
|
||||
import { createJazzTestAccount, setupJazzTestSync } from "../testing";
|
||||
|
||||
describe("Invite Links", () => {
|
||||
let account: Account;
|
||||
let group: Group;
|
||||
const baseURL = "https://example.com";
|
||||
|
||||
beforeEach(async () => {
|
||||
await setupJazzTestSync(); // Required to sync the invite between accounts
|
||||
account = await createJazzTestAccount({
|
||||
isCurrentActiveAccount: true,
|
||||
});
|
||||
group = Group.create({ owner: account });
|
||||
});
|
||||
|
||||
test("createInviteLink generates correct format", () => {
|
||||
const inviteLink = createInviteLink(group, "writer", baseURL);
|
||||
|
||||
expect(inviteLink).toMatch(
|
||||
new RegExp(`^${baseURL}#/invite/${group.id}/[A-Za-z0-9_-]+$`),
|
||||
);
|
||||
});
|
||||
|
||||
test("createInviteLink with valueHint", () => {
|
||||
const inviteLink = createInviteLink(group, "writer", baseURL, "myGroup");
|
||||
|
||||
expect(inviteLink).toMatch(
|
||||
new RegExp(`^${baseURL}#/invite/myGroup/${group.id}/[A-Za-z0-9_-]+$`),
|
||||
);
|
||||
});
|
||||
|
||||
test("parseInviteLink correctly parses valid link", () => {
|
||||
const inviteLink = createInviteLink(group, "writer", baseURL, "myGroup");
|
||||
const result = parseInviteLink(inviteLink);
|
||||
|
||||
expect(result).toBeDefined();
|
||||
expect(result?.valueID).toBe(group.id);
|
||||
expect(result?.valueHint).toBe("myGroup");
|
||||
expect(result?.inviteSecret).toBeDefined();
|
||||
});
|
||||
|
||||
test("parseInviteLink returns undefined for invalid link", () => {
|
||||
const invalidLink = "https://example.com/not-an-invite";
|
||||
const result = parseInviteLink(invalidLink);
|
||||
|
||||
expect(result).toBeUndefined();
|
||||
});
|
||||
|
||||
test("consumeInviteLink accepts valid invite", async () => {
|
||||
const inviteLink = createInviteLink(group, "writer", baseURL, "myGroup");
|
||||
const newAccount = await createJazzTestAccount();
|
||||
|
||||
const result = await consumeInviteLink({
|
||||
inviteURL: inviteLink,
|
||||
as: newAccount,
|
||||
forValueHint: "myGroup",
|
||||
invitedObjectSchema: Group,
|
||||
});
|
||||
|
||||
expect(result).toBeDefined();
|
||||
expect(result?.valueID).toBe(group.id);
|
||||
expect(result?.valueHint).toBe("myGroup");
|
||||
});
|
||||
|
||||
test("consumeInviteLink returns undefined for mismatched valueHint", async () => {
|
||||
const inviteLink = createInviteLink(group, "writer", baseURL, "myGroup");
|
||||
const newAccount = await createJazzTestAccount();
|
||||
|
||||
const result = await consumeInviteLink({
|
||||
inviteURL: inviteLink,
|
||||
as: newAccount,
|
||||
forValueHint: "wrongHint",
|
||||
invitedObjectSchema: Group,
|
||||
});
|
||||
|
||||
expect(result).toBeUndefined();
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-react
|
||||
|
||||
## 0.9.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-browser@0.9.17
|
||||
|
||||
## 0.9.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "jazz-vue",
|
||||
"version": "0.9.16",
|
||||
"version": "0.9.17",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"types": "src/index.ts",
|
||||
|
||||
46
pnpm-lock.yaml
generated
46
pnpm-lock.yaml
generated
@@ -453,7 +453,7 @@ importers:
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/jazz-react
|
||||
jazz-react-auth-clerk:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../../packages/jazz-react-auth-clerk
|
||||
jazz-tools:
|
||||
specifier: workspace:*
|
||||
@@ -770,10 +770,10 @@ importers:
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/jazz-inspector
|
||||
jazz-react:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../../packages/jazz-react
|
||||
jazz-tools:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../../packages/jazz-tools
|
||||
lucide-react:
|
||||
specifier: ^0.274.0
|
||||
@@ -1027,10 +1027,10 @@ importers:
|
||||
examples/password-manager:
|
||||
dependencies:
|
||||
jazz-react:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../../packages/jazz-react
|
||||
jazz-tools:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../../packages/jazz-tools
|
||||
react:
|
||||
specifier: 18.3.1
|
||||
@@ -1091,13 +1091,13 @@ importers:
|
||||
specifier: ^2.0.0
|
||||
version: 2.1.1
|
||||
jazz-browser-media-images:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../../packages/jazz-browser-media-images
|
||||
jazz-react:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../../packages/jazz-react
|
||||
jazz-tools:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../../packages/jazz-tools
|
||||
lucide-react:
|
||||
specifier: ^0.274.0
|
||||
@@ -1152,7 +1152,7 @@ importers:
|
||||
specifier: ^3.0.1
|
||||
version: 3.0.1
|
||||
jazz-run:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../../packages/jazz-run
|
||||
postcss:
|
||||
specifier: ^8.4.27
|
||||
@@ -1231,10 +1231,10 @@ importers:
|
||||
specifier: ^2.0.0
|
||||
version: 2.1.1
|
||||
jazz-react:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../../packages/jazz-react
|
||||
jazz-tools:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../../packages/jazz-tools
|
||||
lucide-react:
|
||||
specifier: ^0.274.0
|
||||
@@ -1589,7 +1589,7 @@ importers:
|
||||
specifier: workspace:0.9.13
|
||||
version: link:../cojson-transport-ws
|
||||
jazz-tools:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../jazz-tools
|
||||
typescript:
|
||||
specifier: ~5.6.2
|
||||
@@ -1601,10 +1601,10 @@ importers:
|
||||
specifier: workspace:0.9.13
|
||||
version: link:../cojson
|
||||
jazz-browser:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../jazz-browser
|
||||
jazz-tools:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../jazz-tools
|
||||
devDependencies:
|
||||
typescript:
|
||||
@@ -1620,10 +1620,10 @@ importers:
|
||||
specifier: ^4.1.0
|
||||
version: 4.1.0
|
||||
jazz-browser:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../jazz-browser
|
||||
jazz-tools:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../jazz-tools
|
||||
pica:
|
||||
specifier: ^9.0.1
|
||||
@@ -1679,7 +1679,7 @@ importers:
|
||||
specifier: workspace:0.9.13
|
||||
version: link:../cojson-transport-ws
|
||||
jazz-tools:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../jazz-tools
|
||||
ws:
|
||||
specifier: ^8.14.2
|
||||
@@ -1704,13 +1704,13 @@ importers:
|
||||
specifier: workspace:0.9.13
|
||||
version: link:../cojson
|
||||
jazz-browser:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../jazz-browser
|
||||
jazz-react-core:
|
||||
specifier: workspace:*
|
||||
version: link:../jazz-react-core
|
||||
jazz-tools:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../jazz-tools
|
||||
devDependencies:
|
||||
'@testing-library/dom':
|
||||
@@ -1741,13 +1741,13 @@ importers:
|
||||
specifier: workspace:0.9.13
|
||||
version: link:../cojson
|
||||
jazz-browser-auth-clerk:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../jazz-browser-auth-clerk
|
||||
jazz-react:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../jazz-react
|
||||
jazz-tools:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../jazz-tools
|
||||
react:
|
||||
specifier: 18.3.1
|
||||
@@ -1896,7 +1896,7 @@ importers:
|
||||
specifier: ^3.6.5
|
||||
version: 3.11.9
|
||||
jazz-tools:
|
||||
specifier: workspace:0.9.16
|
||||
specifier: workspace:0.9.17
|
||||
version: link:../jazz-tools
|
||||
ws:
|
||||
specifier: ^8.14.2
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# jazz-tailwind-demo-auth-starter
|
||||
|
||||
## 0.0.32
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [c2ca1fe]
|
||||
- Updated dependencies [1227047]
|
||||
- jazz-tools@0.9.17
|
||||
- jazz-react@0.9.17
|
||||
|
||||
## 0.0.31
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jazz-tailwind-demo-auth-starter",
|
||||
"private": true,
|
||||
"version": "0.0.31",
|
||||
"version": "0.0.32",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
Reference in New Issue
Block a user