jazz-tools 0.19.4 → 0.19.6
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/.turbo/turbo-build.log +48 -48
- package/CHANGELOG.md +24 -0
- package/dist/{chunk-PT7FCV26.js → chunk-GCBXV2KC.js} +68 -24
- package/dist/chunk-GCBXV2KC.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/inspector/index.d.ts +1 -1
- package/dist/inspector/index.d.ts.map +1 -1
- package/dist/inspector/index.js +8 -1
- package/dist/inspector/index.js.map +1 -1
- package/dist/react-core/hooks.d.ts +2 -1
- package/dist/react-core/hooks.d.ts.map +1 -1
- package/dist/react-core/index.js +39 -15
- package/dist/react-core/index.js.map +1 -1
- package/dist/react-native-core/crypto/RNQuickCrypto.d.ts +3 -1
- package/dist/react-native-core/crypto/RNQuickCrypto.d.ts.map +1 -1
- package/dist/react-native-core/crypto.js +23 -1
- package/dist/react-native-core/crypto.js.map +1 -1
- package/dist/testing.js +1 -1
- package/dist/tools/coValues/CoValueBase.d.ts +2 -1
- package/dist/tools/coValues/CoValueBase.d.ts.map +1 -1
- package/dist/tools/coValues/account.d.ts +3 -2
- package/dist/tools/coValues/account.d.ts.map +1 -1
- package/dist/tools/coValues/interfaces.d.ts +8 -0
- package/dist/tools/coValues/interfaces.d.ts.map +1 -1
- package/dist/tools/exports.d.ts +1 -1
- package/dist/tools/exports.d.ts.map +1 -1
- package/dist/tools/implementation/anonymousJazzAgent.d.ts +5 -0
- package/dist/tools/implementation/anonymousJazzAgent.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/AccountSchema.d.ts +3 -3
- package/dist/tools/implementation/zodSchema/schemaTypes/AccountSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/zodCo.d.ts.map +1 -1
- package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
- package/dist/tools/testing.d.ts.map +1 -1
- package/dist/tools/tests/utils.d.ts +6 -1
- package/dist/tools/tests/utils.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/inspector/index.tsx +10 -1
- package/src/react-core/hooks.ts +65 -21
- package/src/react-core/tests/useCoState.test.ts +102 -2
- package/src/react-native-core/crypto/RNQuickCrypto.ts +32 -2
- package/src/tools/coValues/CoValueBase.ts +11 -1
- package/src/tools/coValues/account.ts +30 -6
- package/src/tools/coValues/interfaces.ts +25 -1
- package/src/tools/exports.ts +1 -0
- package/src/tools/implementation/anonymousJazzAgent.ts +21 -1
- package/src/tools/implementation/zodSchema/schemaTypes/AccountSchema.ts +9 -4
- package/src/tools/subscribe/SubscriptionScope.ts +2 -9
- package/src/tools/tests/account.test.ts +65 -0
- package/src/tools/tests/exportImport.test.ts +78 -0
- package/src/tools/tests/groupsAndAccounts.test.ts +21 -20
- package/src/tools/tests/schema.resolved.test.ts +26 -19
- package/src/tools/tests/utils.ts +27 -0
- package/dist/chunk-PT7FCV26.js.map +0 -1
- package/dist/tools/coValues/promise.d.ts +0 -9
- package/dist/tools/coValues/promise.d.ts.map +0 -1
- package/src/tools/coValues/promise.ts +0 -34
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anonymousJazzAgent.d.ts","sourceRoot":"","sources":["../../../src/tools/implementation/anonymousJazzAgent.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"anonymousJazzAgent.d.ts","sourceRoot":"","sources":["../../../src/tools/implementation/anonymousJazzAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,qBAAa,kBAAkB;IAEV,IAAI,EAAE,SAAS;IADlC,CAAC,OAAO,CAAC,cAAwB;gBACd,IAAI,EAAE,SAAS;IAClC,QAAQ,CAAC,CAAC,EAAE,OAAO;IAGnB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAUhC,SAAS,CAAC,CAAC,EAAE,OAAO;IAGpB,QAAQ,CAAC,CAAC,EAAE,OAAO;CAGpB"}
|
|
@@ -37,12 +37,12 @@ export declare class AccountSchema<Shape extends BaseAccountShape = DefaultAccou
|
|
|
37
37
|
loadAs?: Account | AnonymousJazzAgent;
|
|
38
38
|
resolve?: RefsToResolveStrict<AccountSchema<Shape>, R>;
|
|
39
39
|
}): Promise<MaybeLoaded<Loaded<AccountSchema<Shape>, R>>>;
|
|
40
|
-
|
|
41
|
-
createAs(as: Account, options: {
|
|
40
|
+
createAs(worker: Account, options: {
|
|
42
41
|
creationProps: {
|
|
43
42
|
name: string;
|
|
44
43
|
};
|
|
45
|
-
|
|
44
|
+
onCreate?: (account: AccountInstance<Shape>, worker: Account) => Promise<void>;
|
|
45
|
+
}): Promise<Loaded<AccountSchema<Shape>, DefaultResolveQuery>>;
|
|
46
46
|
unstable_merge<R extends ResolveQuery<AccountSchema<Shape>> = DefaultResolveQuery>(id: string, options: {
|
|
47
47
|
loadAs?: Account | AnonymousJazzAgent;
|
|
48
48
|
resolve?: RefsToResolveStrict<AccountSchema<Shape>, R>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountSchema.d.ts","sourceRoot":"","sources":["../../../../../src/tools/implementation/zodSchema/schemaTypes/AccountSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,gBAAgB,EAChB,qBAAqB,EAErB,KAAK,EACL,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,wBAAwB,EAEzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAC;AAE/F,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAA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O,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAC3D,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAKlC,IAAI,CAEF,KAAK,CAAC,CAAC,SAAS,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,GAAG,mBAAmB,EAExE,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAAC;QACtC,OAAO,CAAC,EAAE,mBAAmB,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;KACxD,GACA,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"AccountSchema.d.ts","sourceRoot":"","sources":["../../../../../src/tools/implementation/zodSchema/schemaTypes/AccountSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,gBAAgB,EAChB,qBAAqB,EAErB,KAAK,EACL,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,wBAAwB,EAEzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAC;AAE/F,OAAO,EAAE,CAAC,EAAE,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EACL,WAAW,EACX,eAAe,EAEhB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,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AAM,eAAe,eAAgB,MAAM,KAAG,cAWpD,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAO,eAGrC,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAO,cAGpC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,OAAO,eAAe,CAAC;AAC3D,eAAO,MAAM,cAAc,QAAO,qBAEjC,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,iBAAiB,UACnD,CAAC,KACR,gBAAgB,CAAC,CAAC,CAEpB,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,OAAO,SAAS,2BAA2B,iBAE5B,MAAM,WACZ,OAAO,KACf,0BAA0B,CAAC,OAAO,CAMpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubscriptionScope.d.ts","sourceRoot":"","sources":["../../../src/tools/subscribe/SubscriptionScope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAEL,MAAM,EACN,KAAK,EACL,KAAK,OAAO,EACZ,KAAK,EAAE,EACP,WAAW,EACX,SAAS,EACT,KAAK,UAAU,EACf,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"SubscriptionScope.d.ts","sourceRoot":"","sources":["../../../src/tools/subscribe/SubscriptionScope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAEL,MAAM,EACN,KAAK,EACL,KAAK,OAAO,EACZ,KAAK,EAAE,EACP,WAAW,EACX,SAAS,EACT,KAAK,UAAU,EACf,KAAK,aAAa,EAKnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,SAAS,EAAuB,MAAM,gBAAgB,CAAC;AAChE,OAAO,KAAK,EACV,gBAAgB,EACh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AAC,EAAE,OAAO,EACV,CAAC,EAAE,OAAO,EACV,KAAK,GAAE,QAAQ,GAAG,QAAmB,EACrC,KAAK,GAAE,QAAQ,GAAG,QAAmB,iBAgBtC;AAED,wBAAsB,iBAAiB,CAAC,EACtC,UAAkB,GACnB,GAAE;IACD,UAAU,CAAC,EAAE,OAAO,CAAC;CACjB,oBAgBL;AAED,wBAAgB,mBAAmB,SAKlC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AccountClass } from "../coValues/account";
|
|
2
2
|
import { CoID, LocalNode, RawCoValue } from "cojson";
|
|
3
3
|
import { Account } from "../index";
|
|
4
|
-
import { CoValue, CoValueFromRaw, MaybeLoaded, LoadedAndRequired } from "../internal";
|
|
4
|
+
import { CoValue, CoValueFromRaw, MaybeLoaded, LoadedAndRequired, AccountSchema } from "../internal";
|
|
5
5
|
export declare function setupAccount(): Promise<{
|
|
6
6
|
me: import("../internal").ControlledAccount;
|
|
7
7
|
meOnSecondPeer: Account | ({
|
|
@@ -19,4 +19,9 @@ export declare function setupTwoNodes(options?: {
|
|
|
19
19
|
export declare function waitFor(callback: () => boolean | void | Promise<boolean | void>): Promise<void>;
|
|
20
20
|
export declare function loadCoValueOrFail<V extends RawCoValue>(node: LocalNode, id: CoID<V>): Promise<V>;
|
|
21
21
|
export declare function assertLoaded<T extends MaybeLoaded<CoValue>>(coValue: T): asserts coValue is LoadedAndRequired<T>;
|
|
22
|
+
export declare function createAccountAs<S extends AccountSchema<any, any>>(schema: S, as: Account, options: {
|
|
23
|
+
creationProps: {
|
|
24
|
+
name: string;
|
|
25
|
+
};
|
|
26
|
+
}): Promise<import("../internal").AccountInstance<any>>;
|
|
22
27
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/tools/tests/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAuB,MAAM,qBAAqB,CAAC;AA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EAAE,OAAO,EACX,OAAO,EAAE;IACP,aAAa,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACjC,uDAmBF"}
|
package/package.json
CHANGED
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
},
|
|
188
188
|
"type": "module",
|
|
189
189
|
"license": "MIT",
|
|
190
|
-
"version": "0.19.
|
|
190
|
+
"version": "0.19.6",
|
|
191
191
|
"dependencies": {
|
|
192
192
|
"@manuscripts/prosemirror-recreate-steps": "^0.1.4",
|
|
193
193
|
"@scure/base": "1.2.1",
|
|
@@ -204,9 +204,9 @@
|
|
|
204
204
|
"prosemirror-transform": "^1.9.0",
|
|
205
205
|
"use-sync-external-store": "^1.5.0",
|
|
206
206
|
"zod": "4.1.11",
|
|
207
|
-
"cojson": "0.19.
|
|
208
|
-
"cojson-storage-indexeddb": "0.19.
|
|
209
|
-
"cojson-transport-ws": "0.19.
|
|
207
|
+
"cojson": "0.19.6",
|
|
208
|
+
"cojson-storage-indexeddb": "0.19.6",
|
|
209
|
+
"cojson-transport-ws": "0.19.6"
|
|
210
210
|
},
|
|
211
211
|
"devDependencies": {
|
|
212
212
|
"@scure/bip39": "^1.3.0",
|
|
@@ -244,7 +244,7 @@
|
|
|
244
244
|
"react-native-fast-encoder": "^0.2.0",
|
|
245
245
|
"react-native-mmkv": "^3.3.0",
|
|
246
246
|
"react-native-nitro-modules": "^0.26.4",
|
|
247
|
-
"react-native-quick-crypto": "^1.0.0-beta.
|
|
247
|
+
"react-native-quick-crypto": "^1.0.0-beta.21",
|
|
248
248
|
"sharp": "^0.33.5",
|
|
249
249
|
"svelte": "^5.0.0"
|
|
250
250
|
},
|
package/src/inspector/index.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
2
|
|
|
3
3
|
export { JazzInspectorInternal } from "./viewer/new-app.js";
|
|
4
4
|
export { PageStack } from "./viewer/page-stack.js";
|
|
@@ -30,6 +30,15 @@ export function JazzInspector({ position = "right" }: { position?: Position }) {
|
|
|
30
30
|
const localNode = context.node;
|
|
31
31
|
const me = "me" in context ? context.me : undefined;
|
|
32
32
|
|
|
33
|
+
const [isCSR, setIsCSR] = useState(false);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
setIsCSR(true);
|
|
36
|
+
}, []);
|
|
37
|
+
|
|
38
|
+
if (!isCSR) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
33
42
|
return (
|
|
34
43
|
<JazzInspectorInternal
|
|
35
44
|
position={position}
|
package/src/react-core/hooks.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
CoValue,
|
|
15
15
|
CoValueClassOrSchema,
|
|
16
16
|
CoValueLoadingState,
|
|
17
|
+
ExportedCoValue,
|
|
17
18
|
InboxSender,
|
|
18
19
|
InstanceOfSchema,
|
|
19
20
|
JazzContextManager,
|
|
@@ -26,6 +27,7 @@ import {
|
|
|
26
27
|
SchemaResolveQuery,
|
|
27
28
|
SubscriptionScope,
|
|
28
29
|
coValueClassFromCoValueClassOrSchema,
|
|
30
|
+
importContentPieces,
|
|
29
31
|
getUnloadedCoValueWithoutId,
|
|
30
32
|
type BranchDefinition,
|
|
31
33
|
} from "jazz-tools";
|
|
@@ -100,6 +102,7 @@ export function useCoValueSubscription<
|
|
|
100
102
|
},
|
|
101
103
|
) {
|
|
102
104
|
const contextManager = useJazzContextManager();
|
|
105
|
+
const agent = useAgent();
|
|
103
106
|
|
|
104
107
|
const createSubscription = () => {
|
|
105
108
|
if (!id) {
|
|
@@ -137,39 +140,63 @@ export function useCoValueSubscription<
|
|
|
137
140
|
);
|
|
138
141
|
|
|
139
142
|
return {
|
|
140
|
-
subscription,
|
|
143
|
+
value: subscription,
|
|
141
144
|
contextManager,
|
|
142
145
|
id,
|
|
143
146
|
Schema,
|
|
144
147
|
branchName: options?.unstable_branch?.name,
|
|
145
148
|
branchOwnerId: options?.unstable_branch?.owner?.$jazz.id,
|
|
149
|
+
agent,
|
|
146
150
|
};
|
|
147
151
|
};
|
|
148
152
|
|
|
149
|
-
const
|
|
153
|
+
const subscriptionRef = React.useRef<null | ReturnType<
|
|
154
|
+
typeof createSubscription
|
|
155
|
+
>>(null);
|
|
156
|
+
|
|
157
|
+
if (!subscriptionRef.current) {
|
|
158
|
+
subscriptionRef.current = createSubscription();
|
|
159
|
+
}
|
|
150
160
|
|
|
151
161
|
const branchName = options?.unstable_branch?.name;
|
|
152
162
|
const branchOwnerId = options?.unstable_branch?.owner?.$jazz.id;
|
|
153
163
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
164
|
+
let subscription = subscriptionRef.current;
|
|
165
|
+
|
|
166
|
+
// Check if the subscription needs to be updated
|
|
167
|
+
// because one of the dependencies has changed
|
|
168
|
+
if (
|
|
169
|
+
subscription.contextManager !== contextManager ||
|
|
170
|
+
subscription.id !== id ||
|
|
171
|
+
subscription.Schema !== Schema ||
|
|
172
|
+
subscription.branchName !== branchName ||
|
|
173
|
+
subscription.branchOwnerId !== branchOwnerId ||
|
|
174
|
+
subscription.agent !== agent
|
|
175
|
+
) {
|
|
176
|
+
subscription.value?.destroy();
|
|
177
|
+
subscriptionRef.current = createSubscription();
|
|
178
|
+
subscription = subscriptionRef.current;
|
|
179
|
+
}
|
|
165
180
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
});
|
|
170
|
-
}, [Schema, id, contextManager, branchName, branchOwnerId]);
|
|
181
|
+
// Subscribe to the context manager to react to auth changes
|
|
182
|
+
return subscription.value as CoValueSubscription<S, R>;
|
|
183
|
+
}
|
|
171
184
|
|
|
172
|
-
|
|
185
|
+
function useImportCoValueContent<V>(
|
|
186
|
+
id: string | undefined | null,
|
|
187
|
+
content?: ExportedCoValue<V>,
|
|
188
|
+
) {
|
|
189
|
+
const agent = useAgent();
|
|
190
|
+
const preloadExecuted = useRef<typeof agent | null>(null);
|
|
191
|
+
if (content && preloadExecuted.current !== agent && id) {
|
|
192
|
+
if (content.id === id) {
|
|
193
|
+
importContentPieces(content.contentPieces, agent);
|
|
194
|
+
} else {
|
|
195
|
+
console.warn("Preloaded value ID does not match the subscription ID");
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
preloadExecuted.current = agent;
|
|
199
|
+
}
|
|
173
200
|
}
|
|
174
201
|
|
|
175
202
|
function useGetCurrentValue<C extends CoValue>(
|
|
@@ -375,8 +402,11 @@ export function useCoState<
|
|
|
375
402
|
* For more info see the [branching](https://jazz.tools/docs/react/using-covalues/version-control) documentation.
|
|
376
403
|
*/
|
|
377
404
|
unstable_branch?: BranchDefinition;
|
|
405
|
+
preloaded?: ExportedCoValue<Loaded<S, R>>;
|
|
378
406
|
},
|
|
379
407
|
): TSelectorReturn {
|
|
408
|
+
useImportCoValueContent(id, options?.preloaded);
|
|
409
|
+
|
|
380
410
|
const subscription = useCoValueSubscription(Schema, id, options);
|
|
381
411
|
const getCurrentValue = useGetCurrentValue(subscription);
|
|
382
412
|
|
|
@@ -679,8 +709,22 @@ export function useAgent<
|
|
|
679
709
|
A extends AccountClass<Account> | AnyAccountSchema = typeof Account,
|
|
680
710
|
>(): AnonymousJazzAgent | Loaded<A, true> {
|
|
681
711
|
const contextManager = useJazzContextManager<InstanceOfSchema<A>>();
|
|
682
|
-
|
|
683
|
-
|
|
712
|
+
|
|
713
|
+
const getCurrentValue = () =>
|
|
714
|
+
getCurrentAccountFromContextManager(contextManager) as
|
|
715
|
+
| AnonymousJazzAgent
|
|
716
|
+
| Loaded<A, true>;
|
|
717
|
+
|
|
718
|
+
return React.useSyncExternalStore(
|
|
719
|
+
useCallback(
|
|
720
|
+
(callback) => {
|
|
721
|
+
return contextManager.subscribe(callback);
|
|
722
|
+
},
|
|
723
|
+
[contextManager],
|
|
724
|
+
),
|
|
725
|
+
getCurrentValue,
|
|
726
|
+
getCurrentValue,
|
|
727
|
+
);
|
|
684
728
|
}
|
|
685
729
|
|
|
686
730
|
export function experimental_useInboxSender<
|
|
@@ -13,9 +13,9 @@ import {
|
|
|
13
13
|
co,
|
|
14
14
|
z,
|
|
15
15
|
} from "jazz-tools";
|
|
16
|
-
import { assertLoaded } from "jazz-tools/testing";
|
|
16
|
+
import { assertLoaded, disableJazzTestSync } from "jazz-tools/testing";
|
|
17
17
|
import { assert, beforeEach, describe, expect, expectTypeOf, it } from "vitest";
|
|
18
|
-
import { useCoState } from "../index.js";
|
|
18
|
+
import { useCoState, useLogOut } from "../index.js";
|
|
19
19
|
import { createJazzTestAccount, setupJazzTestSync } from "../testing.js";
|
|
20
20
|
import { act, renderHook, waitFor } from "./testUtils.js";
|
|
21
21
|
|
|
@@ -757,4 +757,104 @@ describe("useCoState", () => {
|
|
|
757
757
|
expect(updatedMainPerson.age).toBe(31);
|
|
758
758
|
expect(updatedMainPerson.email).toBe("john.smith@example.com");
|
|
759
759
|
});
|
|
760
|
+
|
|
761
|
+
it("should preload the value when provided", async () => {
|
|
762
|
+
disableJazzTestSync();
|
|
763
|
+
|
|
764
|
+
const Person = co.map({
|
|
765
|
+
name: z.string(),
|
|
766
|
+
age: z.number(),
|
|
767
|
+
email: z.string(),
|
|
768
|
+
});
|
|
769
|
+
|
|
770
|
+
const group = Group.create();
|
|
771
|
+
group.addMember("everyone", "writer");
|
|
772
|
+
|
|
773
|
+
const originalPerson = Person.create(
|
|
774
|
+
{
|
|
775
|
+
name: "John Doe",
|
|
776
|
+
age: 30,
|
|
777
|
+
email: "john@example.com",
|
|
778
|
+
},
|
|
779
|
+
group,
|
|
780
|
+
);
|
|
781
|
+
|
|
782
|
+
const bob = await createJazzTestAccount({
|
|
783
|
+
isCurrentActiveAccount: true,
|
|
784
|
+
});
|
|
785
|
+
|
|
786
|
+
const exportedPerson = originalPerson.$jazz.export();
|
|
787
|
+
let renderCount = 0;
|
|
788
|
+
|
|
789
|
+
const { result } = renderHook(
|
|
790
|
+
() => {
|
|
791
|
+
renderCount++;
|
|
792
|
+
return useCoState(Person, originalPerson.$jazz.id, {
|
|
793
|
+
preloaded: exportedPerson,
|
|
794
|
+
});
|
|
795
|
+
},
|
|
796
|
+
{
|
|
797
|
+
account: bob,
|
|
798
|
+
},
|
|
799
|
+
);
|
|
800
|
+
|
|
801
|
+
expect(renderCount).toBe(1);
|
|
802
|
+
|
|
803
|
+
assertLoaded(result.current);
|
|
804
|
+
expect(result.current.name).toBe("John Doe");
|
|
805
|
+
expect(result.current.age).toBe(30);
|
|
806
|
+
expect(result.current.email).toBe("john@example.com");
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
it("preload should work when changing the account", async () => {
|
|
810
|
+
disableJazzTestSync();
|
|
811
|
+
|
|
812
|
+
const Person = co.map({
|
|
813
|
+
name: z.string(),
|
|
814
|
+
age: z.number(),
|
|
815
|
+
email: z.string(),
|
|
816
|
+
});
|
|
817
|
+
|
|
818
|
+
const group = Group.create();
|
|
819
|
+
group.addMember("everyone", "writer");
|
|
820
|
+
|
|
821
|
+
const originalPerson = Person.create(
|
|
822
|
+
{
|
|
823
|
+
name: "John Doe",
|
|
824
|
+
age: 30,
|
|
825
|
+
email: "john@example.com",
|
|
826
|
+
},
|
|
827
|
+
group,
|
|
828
|
+
);
|
|
829
|
+
|
|
830
|
+
await createJazzTestAccount({
|
|
831
|
+
isCurrentActiveAccount: true,
|
|
832
|
+
});
|
|
833
|
+
|
|
834
|
+
const exportedPerson = originalPerson.$jazz.export();
|
|
835
|
+
let renderCount = 0;
|
|
836
|
+
|
|
837
|
+
const { result } = renderHook(() => {
|
|
838
|
+
renderCount++;
|
|
839
|
+
const person = useCoState(Person, originalPerson.$jazz.id, {
|
|
840
|
+
preloaded: exportedPerson,
|
|
841
|
+
});
|
|
842
|
+
|
|
843
|
+
return { person, logout: useLogOut() };
|
|
844
|
+
});
|
|
845
|
+
|
|
846
|
+
// Required to perform the logout
|
|
847
|
+
await setupJazzTestSync();
|
|
848
|
+
|
|
849
|
+
await act(async () => {
|
|
850
|
+
result.current.logout();
|
|
851
|
+
});
|
|
852
|
+
|
|
853
|
+
expect(renderCount).toBe(2);
|
|
854
|
+
|
|
855
|
+
assertLoaded(result.current.person);
|
|
856
|
+
expect(result.current.person.name).toBe("John Doe");
|
|
857
|
+
expect(result.current.person.age).toBe(30);
|
|
858
|
+
expect(result.current.person.email).toBe("john@example.com");
|
|
859
|
+
});
|
|
760
860
|
});
|
|
@@ -6,10 +6,31 @@ import {
|
|
|
6
6
|
bytesToBase64url,
|
|
7
7
|
} from "cojson";
|
|
8
8
|
import { CojsonInternalTypes, cojsonInternals } from "cojson";
|
|
9
|
-
import { PureJSCrypto } from "cojson/dist/crypto/PureJSCrypto"; // Importing from dist to not rely on the exports field
|
|
10
|
-
import { Ed, xsalsa20 } from "react-native-quick-crypto";
|
|
9
|
+
import { PureJSCrypto, Blake3State } from "cojson/dist/crypto/PureJSCrypto"; // Importing from dist to not rely on the exports field
|
|
10
|
+
import { Ed, xsalsa20, blake3, Blake3 } from "react-native-quick-crypto";
|
|
11
11
|
const { stableStringify } = cojsonInternals;
|
|
12
12
|
|
|
13
|
+
class Blake3StateAdapter implements Blake3State {
|
|
14
|
+
private instance: Blake3;
|
|
15
|
+
|
|
16
|
+
constructor(instance: Blake3) {
|
|
17
|
+
this.instance = instance;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
update(buf: Uint8Array) {
|
|
21
|
+
this.instance.update(buf);
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
digest() {
|
|
26
|
+
return this.instance.digest();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
clone() {
|
|
30
|
+
return new Blake3StateAdapter(this.instance.copy());
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
13
34
|
export class RNQuickCrypto extends PureJSCrypto {
|
|
14
35
|
ed: Ed;
|
|
15
36
|
|
|
@@ -22,6 +43,15 @@ export class RNQuickCrypto extends PureJSCrypto {
|
|
|
22
43
|
return new RNQuickCrypto();
|
|
23
44
|
}
|
|
24
45
|
|
|
46
|
+
createStreamingHash(): Blake3State {
|
|
47
|
+
const instance = blake3.create({});
|
|
48
|
+
return new Blake3StateAdapter(instance);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
blake3HashOnce(data: Uint8Array) {
|
|
52
|
+
return blake3(data);
|
|
53
|
+
}
|
|
54
|
+
|
|
25
55
|
newEd25519SigningKey(): Uint8Array {
|
|
26
56
|
this.ed.generateKeyPairSync();
|
|
27
57
|
return new Uint8Array(this.ed.getPrivateKey());
|
|
@@ -4,11 +4,13 @@ import {
|
|
|
4
4
|
CoValue,
|
|
5
5
|
CoValueClass,
|
|
6
6
|
CoValueLoadingState,
|
|
7
|
-
|
|
7
|
+
ExportedCoValue,
|
|
8
8
|
RegisteredSchemas,
|
|
9
9
|
type SubscriptionScope,
|
|
10
10
|
coValueClassFromCoValueClassOrSchema,
|
|
11
11
|
coValuesCache,
|
|
12
|
+
exportCoValueFromSubscription,
|
|
13
|
+
getSubscriptionScope,
|
|
12
14
|
inspect,
|
|
13
15
|
unstable_mergeBranch,
|
|
14
16
|
} from "../internal.js";
|
|
@@ -156,4 +158,12 @@ export abstract class CoValueJazzApi<V extends CoValue> {
|
|
|
156
158
|
|
|
157
159
|
unstable_mergeBranch(subscriptionScope);
|
|
158
160
|
}
|
|
161
|
+
|
|
162
|
+
export(): ExportedCoValue<V> {
|
|
163
|
+
const subscriptionScope = getSubscriptionScope(this.coValue);
|
|
164
|
+
|
|
165
|
+
return exportCoValueFromSubscription(
|
|
166
|
+
subscriptionScope as SubscriptionScope<CoValue>,
|
|
167
|
+
);
|
|
168
|
+
}
|
|
159
169
|
}
|
|
@@ -269,29 +269,53 @@ export class Account extends CoValueBase implements CoValue {
|
|
|
269
269
|
*/
|
|
270
270
|
static async createAs<A extends Account>(
|
|
271
271
|
this: CoValueClass<A> & typeof Account,
|
|
272
|
-
|
|
272
|
+
worker: Account,
|
|
273
273
|
options: {
|
|
274
274
|
creationProps: { name: string };
|
|
275
|
+
onCreate?: (account: A, worker: Account) => Promise<void>;
|
|
275
276
|
},
|
|
276
277
|
) {
|
|
277
|
-
|
|
278
|
+
const crypto = worker.$jazz.localNode.crypto;
|
|
279
|
+
|
|
278
280
|
const connectedPeers = cojsonInternals.connectedPeers(
|
|
279
281
|
"creatingAccount",
|
|
280
|
-
|
|
282
|
+
crypto.uniquenessForHeader(), // Use a unique id for the client peer, so we don't have clashes in the worker node
|
|
281
283
|
{ peer1role: "server", peer2role: "client" },
|
|
282
284
|
);
|
|
283
285
|
|
|
284
|
-
|
|
286
|
+
worker.$jazz.localNode.syncManager.addPeer(connectedPeers[1]);
|
|
285
287
|
|
|
286
288
|
const account = await this.create<A>({
|
|
287
289
|
creationProps: options.creationProps,
|
|
288
|
-
crypto
|
|
290
|
+
crypto,
|
|
289
291
|
peers: [connectedPeers[0]],
|
|
290
292
|
});
|
|
291
293
|
|
|
294
|
+
// Load the worker inside the account node
|
|
295
|
+
const loadedWorker = await Account.load(worker.$jazz.id, {
|
|
296
|
+
loadAs: account,
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
// This should never happen, because the two accounts are linked
|
|
300
|
+
if (!loadedWorker.$isLoaded)
|
|
301
|
+
throw new Error("Unable to load the worker account");
|
|
302
|
+
|
|
303
|
+
// The onCreate hook can be helpful to define inline logic, such as querying the DB
|
|
304
|
+
if (options.onCreate) await options.onCreate(account, loadedWorker);
|
|
305
|
+
|
|
292
306
|
await account.$jazz.waitForAllCoValuesSync();
|
|
293
307
|
|
|
294
|
-
|
|
308
|
+
const createdAccount = await this.load(account.$jazz.id, {
|
|
309
|
+
loadAs: worker,
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
if (!createdAccount.$isLoaded)
|
|
313
|
+
throw new Error("Unable to load the created account");
|
|
314
|
+
|
|
315
|
+
// Close the account node, to avoid leaking memory
|
|
316
|
+
account.$jazz.localNode.gracefulShutdown();
|
|
317
|
+
|
|
318
|
+
return createdAccount;
|
|
295
319
|
}
|
|
296
320
|
|
|
297
321
|
static fromNode<A extends Account>(
|
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
NotLoaded,
|
|
27
27
|
activeAccountContext,
|
|
28
28
|
coValueClassFromCoValueClassOrSchema,
|
|
29
|
-
getSubscriptionScope,
|
|
30
29
|
inspect,
|
|
31
30
|
} from "../internal.js";
|
|
32
31
|
import type { BranchDefinition } from "../subscribe/types.js";
|
|
@@ -710,6 +709,31 @@ export async function exportCoValue<
|
|
|
710
709
|
return contentPieces;
|
|
711
710
|
}
|
|
712
711
|
|
|
712
|
+
export function exportCoValueFromSubscription<V>(
|
|
713
|
+
subscription: SubscriptionScope<CoValue>,
|
|
714
|
+
): ExportedCoValue<V> {
|
|
715
|
+
const valuesExported = new Set<string>();
|
|
716
|
+
const contentPieces: CojsonInternalTypes.NewContentMessage[] = [];
|
|
717
|
+
|
|
718
|
+
loadContentPiecesFromSubscription(
|
|
719
|
+
subscription,
|
|
720
|
+
valuesExported,
|
|
721
|
+
contentPieces,
|
|
722
|
+
);
|
|
723
|
+
|
|
724
|
+
return {
|
|
725
|
+
id: subscription.id as ExportedID<V>,
|
|
726
|
+
contentPieces,
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
export type ExportedID<V> = string & { _exportedID: V };
|
|
731
|
+
|
|
732
|
+
export type ExportedCoValue<V> = {
|
|
733
|
+
id: ExportedID<V>; // This is used for branding the export type
|
|
734
|
+
contentPieces: CojsonInternalTypes.NewContentMessage[];
|
|
735
|
+
};
|
|
736
|
+
|
|
713
737
|
function loadContentPiecesFromSubscription(
|
|
714
738
|
subscription: SubscriptionScope<any>,
|
|
715
739
|
valuesExported: Set<string>,
|
package/src/tools/exports.ts
CHANGED
|
@@ -1,7 +1,27 @@
|
|
|
1
|
-
import { LocalNode } from "cojson";
|
|
1
|
+
import { isAccountRole, LocalNode } from "cojson";
|
|
2
2
|
import { TypeSym } from "./symbols.js";
|
|
3
|
+
import { CoValue } from "../internal.js";
|
|
3
4
|
|
|
4
5
|
export class AnonymousJazzAgent {
|
|
5
6
|
[TypeSym] = "Anonymous" as const;
|
|
6
7
|
constructor(public node: LocalNode) {}
|
|
8
|
+
canWrite(_: CoValue) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
canRead(value: CoValue): boolean {
|
|
12
|
+
const valueOwner = value.$jazz.owner;
|
|
13
|
+
if (!valueOwner) {
|
|
14
|
+
// Groups and Accounts are public
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
const role = valueOwner.getRoleOf("everyone");
|
|
18
|
+
|
|
19
|
+
return isAccountRole(role);
|
|
20
|
+
}
|
|
21
|
+
canManage(_: CoValue) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
canAdmin(_: CoValue) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
7
27
|
}
|