jazz-tools 0.18.24 → 0.18.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.svelte-kit/__package__/Provider.svelte +2 -0
- package/.svelte-kit/__package__/Provider.svelte.d.ts.map +1 -1
- package/.turbo/turbo-build.log +49 -49
- package/CHANGELOG.md +24 -0
- package/dist/browser/index.js +9 -9
- package/dist/browser/index.js.map +1 -1
- package/dist/{chunk-BOMSRY5H.js → chunk-M2HGBOXS.js} +2 -2
- package/dist/chunk-M2HGBOXS.js.map +1 -0
- package/dist/{chunk-W7JT3QUN.js → chunk-ZIAN4UY5.js} +406 -40
- package/dist/chunk-ZIAN4UY5.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/inspector/{custom-element-XDJT5T57.js → custom-element-A7UAELEG.js} +3 -1
- package/dist/inspector/{custom-element-XDJT5T57.js.map → custom-element-A7UAELEG.js.map} +1 -1
- package/dist/inspector/index.js +2 -0
- package/dist/inspector/index.js.map +1 -1
- package/dist/inspector/register-custom-element.js +1 -1
- package/dist/inspector/viewer/use-open-inspector.d.ts.map +1 -1
- package/dist/inspector/viewer/use-page-path.d.ts.map +1 -1
- package/dist/react/index.js +4 -2
- package/dist/react/index.js.map +1 -1
- package/dist/react/provider.d.ts +2 -1
- package/dist/react/provider.d.ts.map +1 -1
- package/dist/react/ssr.js +1 -1
- package/dist/react/ssr.js.map +1 -1
- package/dist/react-native-core/index.js +12 -11
- package/dist/react-native-core/index.js.map +1 -1
- package/dist/react-native-core/provider.d.ts +2 -1
- package/dist/react-native-core/provider.d.ts.map +1 -1
- package/dist/svelte/Provider.svelte +2 -0
- package/dist/svelte/Provider.svelte.d.ts.map +1 -1
- package/dist/testing.js +4 -4
- package/dist/testing.js.map +1 -1
- package/dist/tools/auth/AuthSecretStorage.d.ts +3 -1
- package/dist/tools/auth/AuthSecretStorage.d.ts.map +1 -1
- package/dist/tools/coValues/account.d.ts +3 -3
- package/dist/tools/coValues/account.d.ts.map +1 -1
- package/dist/tools/coValues/coVector.d.ts +127 -0
- package/dist/tools/coValues/coVector.d.ts.map +1 -0
- package/dist/tools/coValues/group.d.ts +20 -1
- package/dist/tools/coValues/group.d.ts.map +1 -1
- package/dist/tools/coValues/interfaces.d.ts.map +1 -1
- package/dist/tools/implementation/ContextManager.d.ts +1 -0
- package/dist/tools/implementation/ContextManager.d.ts.map +1 -1
- package/dist/tools/implementation/createContext.d.ts +7 -7
- package/dist/tools/implementation/createContext.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/coExport.d.ts +2 -1
- package/dist/tools/implementation/zodSchema/coExport.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoVectorSchema.d.ts +47 -0
- package/dist/tools/implementation/zodSchema/schemaTypes/CoVectorSchema.d.ts.map +1 -0
- package/dist/tools/implementation/zodSchema/schemaTypes/GroupSchema.d.ts +5 -0
- package/dist/tools/implementation/zodSchema/schemaTypes/GroupSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.d.ts +2 -2
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.d.ts +2 -2
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/zodCo.d.ts +2 -1
- package/dist/tools/implementation/zodSchema/zodCo.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/zodSchema.d.ts +3 -2
- package/dist/tools/implementation/zodSchema/zodSchema.d.ts.map +1 -1
- package/dist/tools/internal.d.ts +2 -0
- package/dist/tools/internal.d.ts.map +1 -1
- package/dist/tools/ssr.js +1 -1
- package/dist/tools/testing.d.ts.map +1 -1
- package/dist/tools/tests/coVector.test-d.d.ts +2 -0
- package/dist/tools/tests/coVector.test-d.d.ts.map +1 -0
- package/dist/tools/tests/coVector.test.d.ts +2 -0
- package/dist/tools/tests/coVector.test.d.ts.map +1 -0
- package/dist/worker/index.js +3 -3
- package/dist/worker/index.js.map +1 -1
- package/package.json +4 -4
- package/src/better-auth/database-adapter/tests/sync-utils.ts +1 -1
- package/src/browser/createBrowserContext.ts +9 -9
- package/src/browser/tests/utils.ts +2 -2
- package/src/inspector/viewer/use-open-inspector.ts +1 -0
- package/src/inspector/viewer/use-page-path.ts +1 -0
- package/src/react/provider.tsx +3 -0
- package/src/react-native-core/platform.ts +9 -9
- package/src/react-native-core/provider.tsx +3 -1
- package/src/svelte/Provider.svelte +2 -0
- package/src/tools/auth/AuthSecretStorage.ts +16 -9
- package/src/tools/coValues/account.ts +5 -5
- package/src/tools/coValues/coVector.ts +432 -0
- package/src/tools/coValues/group.ts +33 -0
- package/src/tools/coValues/interfaces.ts +4 -1
- package/src/tools/implementation/ContextManager.ts +7 -3
- package/src/tools/implementation/createContext.ts +12 -12
- package/src/tools/implementation/zodSchema/coExport.ts +2 -0
- package/src/tools/implementation/zodSchema/runtimeConverters/coValueSchemaTransformation.ts +13 -0
- package/src/tools/implementation/zodSchema/schemaTypes/CoVectorSchema.ts +105 -0
- package/src/tools/implementation/zodSchema/schemaTypes/GroupSchema.ts +7 -1
- package/src/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.ts +9 -5
- package/src/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.ts +15 -9
- package/src/tools/implementation/zodSchema/zodCo.ts +15 -0
- package/src/tools/implementation/zodSchema/zodSchema.ts +15 -6
- package/src/tools/internal.ts +2 -0
- package/src/tools/ssr/ssr.ts +1 -1
- package/src/tools/testing.ts +3 -3
- package/src/tools/tests/AuthSecretStorage.test.ts +59 -1
- package/src/tools/tests/ContextManager.test.ts +11 -1
- package/src/tools/tests/account.test.ts +16 -0
- package/src/tools/tests/coPlainText.test.ts +2 -2
- package/src/tools/tests/coVector.test-d.ts +40 -0
- package/src/tools/tests/coVector.test.ts +891 -0
- package/src/tools/tests/createContext.test.ts +19 -19
- package/src/tools/tests/deepLoading.test.ts +2 -2
- package/src/tools/tests/group.test.ts +59 -0
- package/src/tools/tests/inbox.test.ts +2 -2
- package/src/tools/tests/utils.ts +3 -3
- package/src/worker/index.ts +3 -3
- package/dist/chunk-BOMSRY5H.js.map +0 -1
- package/dist/chunk-W7JT3QUN.js.map +0 -1
|
@@ -53,7 +53,7 @@ async function setupPeers(options: BaseBrowserContextOptions) {
|
|
|
53
53
|
|
|
54
54
|
const { useIndexedDB } = getStorageOptions(options.storage);
|
|
55
55
|
|
|
56
|
-
const
|
|
56
|
+
const peers: Peer[] = [];
|
|
57
57
|
|
|
58
58
|
const storage = useIndexedDB ? await getIndexedDBStorage() : undefined;
|
|
59
59
|
|
|
@@ -62,7 +62,7 @@ async function setupPeers(options: BaseBrowserContextOptions) {
|
|
|
62
62
|
addConnectionListener: () => () => {},
|
|
63
63
|
connected: () => false,
|
|
64
64
|
toggleNetwork: () => {},
|
|
65
|
-
|
|
65
|
+
peers,
|
|
66
66
|
storage,
|
|
67
67
|
setNode: () => {},
|
|
68
68
|
crypto,
|
|
@@ -76,11 +76,11 @@ async function setupPeers(options: BaseBrowserContextOptions) {
|
|
|
76
76
|
if (node) {
|
|
77
77
|
node.syncManager.addPeer(peer);
|
|
78
78
|
} else {
|
|
79
|
-
|
|
79
|
+
peers.push(peer);
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
removePeer: (peer) => {
|
|
83
|
-
|
|
83
|
+
peers.splice(peers.indexOf(peer), 1);
|
|
84
84
|
},
|
|
85
85
|
});
|
|
86
86
|
|
|
@@ -112,7 +112,7 @@ async function setupPeers(options: BaseBrowserContextOptions) {
|
|
|
112
112
|
connected() {
|
|
113
113
|
return wsPeer.connected;
|
|
114
114
|
},
|
|
115
|
-
|
|
115
|
+
peers,
|
|
116
116
|
storage,
|
|
117
117
|
setNode,
|
|
118
118
|
crypto,
|
|
@@ -124,7 +124,7 @@ export async function createJazzBrowserGuestContext(
|
|
|
124
124
|
) {
|
|
125
125
|
const {
|
|
126
126
|
toggleNetwork,
|
|
127
|
-
|
|
127
|
+
peers,
|
|
128
128
|
setNode,
|
|
129
129
|
crypto,
|
|
130
130
|
storage,
|
|
@@ -134,7 +134,7 @@ export async function createJazzBrowserGuestContext(
|
|
|
134
134
|
|
|
135
135
|
const context = await createAnonymousJazzContext({
|
|
136
136
|
crypto,
|
|
137
|
-
|
|
137
|
+
peers,
|
|
138
138
|
storage,
|
|
139
139
|
});
|
|
140
140
|
|
|
@@ -176,7 +176,7 @@ export async function createJazzBrowserContext<
|
|
|
176
176
|
>(options: BrowserContextOptions<S>) {
|
|
177
177
|
const {
|
|
178
178
|
toggleNetwork,
|
|
179
|
-
|
|
179
|
+
peers,
|
|
180
180
|
setNode,
|
|
181
181
|
crypto,
|
|
182
182
|
storage,
|
|
@@ -205,7 +205,7 @@ export async function createJazzBrowserContext<
|
|
|
205
205
|
const context = await createJazzContext({
|
|
206
206
|
credentials: options.credentials,
|
|
207
207
|
newAccountProps: options.newAccountProps,
|
|
208
|
-
|
|
208
|
+
peers,
|
|
209
209
|
storage,
|
|
210
210
|
crypto,
|
|
211
211
|
defaultProfileName: options.defaultProfileName,
|
|
@@ -16,7 +16,7 @@ export async function setupTwoNodes() {
|
|
|
16
16
|
);
|
|
17
17
|
|
|
18
18
|
const client = await LocalNode.withNewlyCreatedAccount({
|
|
19
|
-
|
|
19
|
+
peers: [serverAsPeer],
|
|
20
20
|
crypto,
|
|
21
21
|
creationProps: { name: "Client" },
|
|
22
22
|
migration: async (rawAccount, _node, creationProps) => {
|
|
@@ -29,7 +29,7 @@ export async function setupTwoNodes() {
|
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
const server = await LocalNode.withNewlyCreatedAccount({
|
|
32
|
-
|
|
32
|
+
peers: [clientAsPeer],
|
|
33
33
|
crypto,
|
|
34
34
|
creationProps: { name: "Server" },
|
|
35
35
|
migration: async (rawAccount, _node, creationProps) => {
|
|
@@ -5,6 +5,7 @@ const STORAGE_KEY = "jazz-inspector-open";
|
|
|
5
5
|
export function useOpenInspector() {
|
|
6
6
|
const [open, setOpen] = useState(() => {
|
|
7
7
|
// Initialize from localStorage if available
|
|
8
|
+
if (typeof window === "undefined") return false;
|
|
8
9
|
const stored = localStorage.getItem(STORAGE_KEY);
|
|
9
10
|
return stored ? JSON.parse(stored) : false;
|
|
10
11
|
});
|
|
@@ -6,6 +6,7 @@ const STORAGE_KEY = "jazz-inspector-paths";
|
|
|
6
6
|
|
|
7
7
|
export function usePagePath(defaultPath?: PageInfo[]) {
|
|
8
8
|
const [path, setPath] = useState<PageInfo[]>(() => {
|
|
9
|
+
if (typeof window === "undefined") return [];
|
|
9
10
|
const stored = localStorage.getItem(STORAGE_KEY);
|
|
10
11
|
if (stored) {
|
|
11
12
|
try {
|
package/src/react/provider.tsx
CHANGED
|
@@ -21,6 +21,7 @@ export type JazzProviderProps<
|
|
|
21
21
|
children: React.ReactNode;
|
|
22
22
|
enableSSR?: boolean;
|
|
23
23
|
fallback?: React.ReactNode | null;
|
|
24
|
+
authSecretStorageKey?: string;
|
|
24
25
|
} & JazzContextManagerProps<S>;
|
|
25
26
|
|
|
26
27
|
/** @category Context & Hooks */
|
|
@@ -40,11 +41,13 @@ export function JazzReactProvider<
|
|
|
40
41
|
onAnonymousAccountDiscarded,
|
|
41
42
|
enableSSR,
|
|
42
43
|
fallback = null,
|
|
44
|
+
authSecretStorageKey,
|
|
43
45
|
}: JazzProviderProps<S>) {
|
|
44
46
|
const [contextManager] = React.useState(
|
|
45
47
|
() =>
|
|
46
48
|
new JazzBrowserContextManager<S>({
|
|
47
49
|
useAnonymousFallback: enableSSR,
|
|
50
|
+
authSecretStorageKey,
|
|
48
51
|
}),
|
|
49
52
|
);
|
|
50
53
|
|
|
@@ -46,7 +46,7 @@ async function setupPeers(options: BaseReactNativeContextOptions) {
|
|
|
46
46
|
const crypto = await CryptoProvider.create();
|
|
47
47
|
let node: LocalNode | undefined = undefined;
|
|
48
48
|
|
|
49
|
-
const
|
|
49
|
+
const peers: Peer[] = [];
|
|
50
50
|
|
|
51
51
|
const storage =
|
|
52
52
|
options.storage && options.storage !== "disabled"
|
|
@@ -58,7 +58,7 @@ async function setupPeers(options: BaseReactNativeContextOptions) {
|
|
|
58
58
|
toggleNetwork: () => {},
|
|
59
59
|
addConnectionListener: () => () => {},
|
|
60
60
|
connected: () => false,
|
|
61
|
-
|
|
61
|
+
peers,
|
|
62
62
|
setNode: () => {},
|
|
63
63
|
crypto,
|
|
64
64
|
storage,
|
|
@@ -72,11 +72,11 @@ async function setupPeers(options: BaseReactNativeContextOptions) {
|
|
|
72
72
|
if (node) {
|
|
73
73
|
node.syncManager.addPeer(peer);
|
|
74
74
|
} else {
|
|
75
|
-
|
|
75
|
+
peers.push(peer);
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
removePeer: (peer) => {
|
|
79
|
-
|
|
79
|
+
peers.splice(peers.indexOf(peer), 1);
|
|
80
80
|
},
|
|
81
81
|
});
|
|
82
82
|
|
|
@@ -106,7 +106,7 @@ async function setupPeers(options: BaseReactNativeContextOptions) {
|
|
|
106
106
|
};
|
|
107
107
|
},
|
|
108
108
|
connected: () => wsPeer.connected,
|
|
109
|
-
|
|
109
|
+
peers,
|
|
110
110
|
setNode,
|
|
111
111
|
crypto,
|
|
112
112
|
storage,
|
|
@@ -118,7 +118,7 @@ export async function createJazzReactNativeGuestContext(
|
|
|
118
118
|
) {
|
|
119
119
|
const {
|
|
120
120
|
toggleNetwork,
|
|
121
|
-
|
|
121
|
+
peers,
|
|
122
122
|
setNode,
|
|
123
123
|
crypto,
|
|
124
124
|
storage,
|
|
@@ -128,7 +128,7 @@ export async function createJazzReactNativeGuestContext(
|
|
|
128
128
|
|
|
129
129
|
const context = createAnonymousJazzContext({
|
|
130
130
|
crypto,
|
|
131
|
-
|
|
131
|
+
peers,
|
|
132
132
|
storage,
|
|
133
133
|
});
|
|
134
134
|
|
|
@@ -170,7 +170,7 @@ export async function createJazzReactNativeContext<
|
|
|
170
170
|
>(options: ReactNativeContextOptions<S>) {
|
|
171
171
|
const {
|
|
172
172
|
toggleNetwork,
|
|
173
|
-
|
|
173
|
+
peers,
|
|
174
174
|
setNode,
|
|
175
175
|
crypto,
|
|
176
176
|
storage,
|
|
@@ -202,7 +202,7 @@ export async function createJazzReactNativeContext<
|
|
|
202
202
|
const context = await createJazzContext({
|
|
203
203
|
credentials: options.credentials,
|
|
204
204
|
newAccountProps: options.newAccountProps,
|
|
205
|
-
|
|
205
|
+
peers,
|
|
206
206
|
crypto,
|
|
207
207
|
defaultProfileName: options.defaultProfileName,
|
|
208
208
|
AccountSchema: options.AccountSchema,
|
|
@@ -20,6 +20,7 @@ export type JazzProviderProps<
|
|
|
20
20
|
> = {
|
|
21
21
|
children: React.ReactNode;
|
|
22
22
|
kvStore?: KvStore;
|
|
23
|
+
authSecretStorageKey?: string;
|
|
23
24
|
} & JazzContextManagerProps<S>;
|
|
24
25
|
|
|
25
26
|
/** @category Context & Hooks */
|
|
@@ -39,11 +40,12 @@ export function JazzProviderCore<
|
|
|
39
40
|
onAnonymousAccountDiscarded,
|
|
40
41
|
kvStore,
|
|
41
42
|
CryptoProvider,
|
|
43
|
+
authSecretStorageKey,
|
|
42
44
|
}: JazzProviderProps<S>) {
|
|
43
45
|
setupKvStore(kvStore);
|
|
44
46
|
|
|
45
47
|
const [contextManager] = React.useState(
|
|
46
|
-
() => new ReactNativeContextManager<S>(),
|
|
48
|
+
() => new ReactNativeContextManager<S>({ authSecretStorageKey }),
|
|
47
49
|
);
|
|
48
50
|
|
|
49
51
|
const onLogOutRefCallback = useRefCallback(onLogOut);
|
|
@@ -19,10 +19,12 @@
|
|
|
19
19
|
let props: JazzContextManagerProps<S> & {
|
|
20
20
|
children?: Snippet;
|
|
21
21
|
enableSSR?: boolean;
|
|
22
|
+
authSecretStorageKey?: string;
|
|
22
23
|
} = $props();
|
|
23
24
|
|
|
24
25
|
const contextManager = new JazzBrowserContextManager<S>({
|
|
25
26
|
useAnonymousFallback: props.enableSSR,
|
|
27
|
+
authSecretStorageKey: props.authSecretStorageKey,
|
|
26
28
|
});
|
|
27
29
|
|
|
28
30
|
const ctx = $state<JazzContext<InstanceOfSchema<S>>>({ current: undefined });
|
|
@@ -3,6 +3,7 @@ import type { Account } from "../coValues/account.js";
|
|
|
3
3
|
import type { ID } from "../internal.js";
|
|
4
4
|
import { AuthCredentials } from "../types.js";
|
|
5
5
|
import KvStoreContext from "./KvStoreContext.js";
|
|
6
|
+
import { z } from "zod/v4";
|
|
6
7
|
|
|
7
8
|
const STORAGE_KEY = "jazz-logged-in-secret";
|
|
8
9
|
|
|
@@ -24,20 +25,26 @@ export class AuthSecretStorage {
|
|
|
24
25
|
private listeners: Set<(isAuthenticated: boolean) => void>;
|
|
25
26
|
public isAuthenticated: boolean;
|
|
26
27
|
|
|
27
|
-
constructor() {
|
|
28
|
+
constructor(private storageKey: string = STORAGE_KEY) {
|
|
29
|
+
z.string().nonempty().parse(storageKey);
|
|
30
|
+
|
|
28
31
|
this.listeners = new Set();
|
|
29
32
|
this.isAuthenticated = false;
|
|
30
33
|
}
|
|
31
34
|
|
|
35
|
+
getStorageKey(): string {
|
|
36
|
+
return this.storageKey;
|
|
37
|
+
}
|
|
38
|
+
|
|
32
39
|
async migrate() {
|
|
33
40
|
const kvStore = KvStoreContext.getInstance().getStorage();
|
|
34
41
|
|
|
35
|
-
if (!(await kvStore.get(
|
|
42
|
+
if (!(await kvStore.get(this.storageKey))) {
|
|
36
43
|
const demoAuthSecret = await kvStore.get("demo-auth-logged-in-secret");
|
|
37
44
|
if (demoAuthSecret) {
|
|
38
45
|
const parsed = JSON.parse(demoAuthSecret);
|
|
39
46
|
await kvStore.set(
|
|
40
|
-
|
|
47
|
+
this.storageKey,
|
|
41
48
|
JSON.stringify({
|
|
42
49
|
accountID: parsed.accountID,
|
|
43
50
|
accountSecret: parsed.accountSecret,
|
|
@@ -51,7 +58,7 @@ export class AuthSecretStorage {
|
|
|
51
58
|
if (clerkAuthSecret) {
|
|
52
59
|
const parsed = JSON.parse(clerkAuthSecret);
|
|
53
60
|
await kvStore.set(
|
|
54
|
-
|
|
61
|
+
this.storageKey,
|
|
55
62
|
JSON.stringify({
|
|
56
63
|
accountID: parsed.accountID,
|
|
57
64
|
accountSecret: parsed.secret,
|
|
@@ -62,14 +69,14 @@ export class AuthSecretStorage {
|
|
|
62
69
|
}
|
|
63
70
|
}
|
|
64
71
|
|
|
65
|
-
const value = await kvStore.get(
|
|
72
|
+
const value = await kvStore.get(this.storageKey);
|
|
66
73
|
|
|
67
74
|
if (value) {
|
|
68
75
|
const parsed = JSON.parse(value);
|
|
69
76
|
|
|
70
77
|
if ("secret" in parsed) {
|
|
71
78
|
await kvStore.set(
|
|
72
|
-
|
|
79
|
+
this.storageKey,
|
|
73
80
|
JSON.stringify({
|
|
74
81
|
accountID: parsed.accountID,
|
|
75
82
|
secretSeed: parsed.secretSeed,
|
|
@@ -83,7 +90,7 @@ export class AuthSecretStorage {
|
|
|
83
90
|
|
|
84
91
|
async get(): Promise<AuthCredentials | null> {
|
|
85
92
|
const kvStore = KvStoreContext.getInstance().getStorage();
|
|
86
|
-
const data = await kvStore.get(
|
|
93
|
+
const data = await kvStore.get(this.storageKey);
|
|
87
94
|
|
|
88
95
|
if (!data) return null;
|
|
89
96
|
|
|
@@ -106,7 +113,7 @@ export class AuthSecretStorage {
|
|
|
106
113
|
async setWithoutNotify(payload: AuthSetPayload) {
|
|
107
114
|
const kvStore = KvStoreContext.getInstance().getStorage();
|
|
108
115
|
await kvStore.set(
|
|
109
|
-
|
|
116
|
+
this.storageKey,
|
|
110
117
|
JSON.stringify({
|
|
111
118
|
accountID: payload.accountID,
|
|
112
119
|
secretSeed: payload.secretSeed
|
|
@@ -148,7 +155,7 @@ export class AuthSecretStorage {
|
|
|
148
155
|
|
|
149
156
|
async clearWithoutNotify() {
|
|
150
157
|
const kvStore = KvStoreContext.getInstance().getStorage();
|
|
151
|
-
await kvStore.delete(
|
|
158
|
+
await kvStore.delete(this.storageKey);
|
|
152
159
|
}
|
|
153
160
|
|
|
154
161
|
async clear() {
|
|
@@ -120,13 +120,13 @@ export class Account extends CoValueBase implements CoValue {
|
|
|
120
120
|
*
|
|
121
121
|
* @param valueID The ID of the `CoValue` or `Group` to accept the invite to.
|
|
122
122
|
* @param inviteSecret The secret of the invite to accept.
|
|
123
|
-
* @param coValueClass The class of the `CoValue` or `Group` to accept the invite to.
|
|
123
|
+
* @param coValueClass [Group] The class of the `CoValue` or `Group` to accept the invite to.
|
|
124
124
|
* @returns The loaded `CoValue` or `Group`.
|
|
125
125
|
*/
|
|
126
126
|
async acceptInvite<S extends CoValueClassOrSchema>(
|
|
127
127
|
valueID: string,
|
|
128
128
|
inviteSecret: InviteSecret,
|
|
129
|
-
coValueClass
|
|
129
|
+
coValueClass?: S,
|
|
130
130
|
): Promise<Resolved<InstanceOrPrimitiveOfSchema<S>, true> | null> {
|
|
131
131
|
if (!this.$jazz.isLocalNodeOwner) {
|
|
132
132
|
throw new Error("Only a controlled account can accept invites");
|
|
@@ -138,7 +138,7 @@ export class Account extends CoValueBase implements CoValue {
|
|
|
138
138
|
);
|
|
139
139
|
|
|
140
140
|
return loadCoValue(
|
|
141
|
-
coValueClassFromCoValueClassOrSchema(coValueClass),
|
|
141
|
+
coValueClassFromCoValueClassOrSchema(coValueClass ?? Group),
|
|
142
142
|
valueID,
|
|
143
143
|
{
|
|
144
144
|
loadAs: this,
|
|
@@ -212,7 +212,7 @@ export class Account extends CoValueBase implements CoValue {
|
|
|
212
212
|
options: {
|
|
213
213
|
creationProps: { name: string };
|
|
214
214
|
initialAgentSecret?: AgentSecret;
|
|
215
|
-
|
|
215
|
+
peers?: Peer[];
|
|
216
216
|
crypto: CryptoProvider;
|
|
217
217
|
},
|
|
218
218
|
): Promise<A> {
|
|
@@ -256,7 +256,7 @@ export class Account extends CoValueBase implements CoValue {
|
|
|
256
256
|
const account = await this.create<A>({
|
|
257
257
|
creationProps: options.creationProps,
|
|
258
258
|
crypto: as.$jazz.localNode.crypto,
|
|
259
|
-
|
|
259
|
+
peers: [connectedPeers[0]],
|
|
260
260
|
});
|
|
261
261
|
|
|
262
262
|
await account.$jazz.waitForAllCoValuesSync();
|