jazz-tools 0.17.14 → 0.18.1
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__/jazz.class.svelte.js +1 -1
- package/.svelte-kit/__package__/media/image.svelte +3 -9
- package/.svelte-kit/__package__/media/image.svelte.d.ts +1 -6
- package/.svelte-kit/__package__/media/image.svelte.d.ts.map +1 -1
- package/.svelte-kit/__package__/media/image.types.d.ts +7 -0
- package/.svelte-kit/__package__/media/image.types.d.ts.map +1 -0
- package/.svelte-kit/__package__/media/image.types.js +1 -0
- package/.svelte-kit/__package__/tests/media/image.svelte.test.js +31 -31
- package/.turbo/turbo-build.log +60 -46
- package/CHANGELOG.md +41 -0
- package/dist/better-auth/auth/client.d.ts +29 -0
- package/dist/better-auth/auth/client.d.ts.map +1 -0
- package/dist/better-auth/auth/client.js +127 -0
- package/dist/better-auth/auth/client.js.map +1 -0
- package/dist/better-auth/auth/react.d.ts +2170 -0
- package/dist/better-auth/auth/react.d.ts.map +1 -0
- package/dist/better-auth/auth/react.js +40 -0
- package/dist/better-auth/auth/react.js.map +1 -0
- package/dist/better-auth/auth/server.d.ts +14 -0
- package/dist/better-auth/auth/server.d.ts.map +1 -0
- package/dist/better-auth/auth/server.js +198 -0
- package/dist/better-auth/auth/server.js.map +1 -0
- package/dist/better-auth/auth/tests/client.test.d.ts +2 -0
- package/dist/better-auth/auth/tests/client.test.d.ts.map +1 -0
- package/dist/better-auth/auth/tests/server.test.d.ts +2 -0
- package/dist/better-auth/auth/tests/server.test.d.ts.map +1 -0
- package/dist/browser/index.js +2 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/{chunk-LZOF6WP5.js → chunk-IERUTUXB.js} +1336 -1017
- package/dist/chunk-IERUTUXB.js.map +1 -0
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/dist/inspector/{custom-element-ZSNTCECD.js → custom-element-WCY6D3QJ.js} +3 -3
- package/dist/inspector/{custom-element-ZSNTCECD.js.map → custom-element-WCY6D3QJ.js.map} +1 -1
- package/dist/inspector/index.js +1 -1
- package/dist/inspector/index.js.map +1 -1
- package/dist/inspector/register-custom-element.js +1 -1
- package/dist/media/{chunk-E5J3WLQW.js → chunk-KR2V6X2N.js} +14 -9
- package/dist/media/chunk-KR2V6X2N.js.map +1 -0
- package/dist/media/create-image.d.ts +6 -6
- package/dist/media/index.browser.d.ts +6 -6
- package/dist/media/index.browser.js +1 -1
- package/dist/media/index.d.ts +1 -1
- package/dist/media/index.js +1 -1
- package/dist/media/index.native.d.ts +6 -6
- package/dist/media/index.native.js +1 -1
- package/dist/media/utils.d.ts.map +1 -1
- package/dist/prosemirror/index.js +2 -2
- package/dist/prosemirror/index.js.map +1 -1
- package/dist/react/index.js +7 -5
- package/dist/react/index.js.map +1 -1
- package/dist/react-core/hooks.d.ts.map +1 -1
- package/dist/react-core/index.js +4675 -23
- package/dist/react-core/index.js.map +1 -1
- package/dist/react-native-core/index.js +1 -1
- package/dist/react-native-core/index.js.map +1 -1
- package/dist/svelte/jazz.class.svelte.js +1 -1
- package/dist/svelte/media/image.svelte +3 -9
- package/dist/svelte/media/image.svelte.d.ts +1 -6
- package/dist/svelte/media/image.svelte.d.ts.map +1 -1
- package/dist/svelte/media/image.types.d.ts +7 -0
- package/dist/svelte/media/image.types.d.ts.map +1 -0
- package/dist/svelte/media/image.types.js +1 -0
- package/dist/svelte/tests/media/image.svelte.test.js +31 -31
- package/dist/testing.js +18 -14
- package/dist/testing.js.map +1 -1
- package/dist/tools/coValues/CoFieldInit.d.ts +13 -0
- package/dist/tools/coValues/CoFieldInit.d.ts.map +1 -0
- package/dist/tools/coValues/CoValueBase.d.ts +18 -15
- package/dist/tools/coValues/CoValueBase.d.ts.map +1 -1
- package/dist/tools/coValues/account.d.ts +101 -46
- package/dist/tools/coValues/account.d.ts.map +1 -1
- package/dist/tools/coValues/coFeed.d.ts +78 -62
- package/dist/tools/coValues/coFeed.d.ts.map +1 -1
- package/dist/tools/coValues/coList.d.ts +212 -99
- package/dist/tools/coValues/coList.d.ts.map +1 -1
- package/dist/tools/coValues/coMap.d.ts +210 -192
- package/dist/tools/coValues/coMap.d.ts.map +1 -1
- package/dist/tools/coValues/coPlainText.d.ts +30 -22
- package/dist/tools/coValues/coPlainText.d.ts.map +1 -1
- package/dist/tools/coValues/deepLoading.d.ts +13 -13
- package/dist/tools/coValues/deepLoading.d.ts.map +1 -1
- package/dist/tools/coValues/extensions/imageDef.d.ts +1 -1
- package/dist/tools/coValues/group.d.ts +32 -32
- package/dist/tools/coValues/group.d.ts.map +1 -1
- package/dist/tools/coValues/inbox.d.ts.map +1 -1
- package/dist/tools/coValues/interfaces.d.ts +18 -17
- package/dist/tools/coValues/interfaces.d.ts.map +1 -1
- package/dist/tools/coValues/profile.d.ts +6 -5
- package/dist/tools/coValues/profile.d.ts.map +1 -1
- package/dist/tools/coValues/schemaUnion.d.ts +3 -3
- package/dist/tools/coValues/schemaUnion.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 +2 -1
- package/dist/tools/implementation/anonymousJazzAgent.d.ts.map +1 -1
- package/dist/tools/implementation/schema.d.ts +5 -5
- package/dist/tools/implementation/schema.d.ts.map +1 -1
- package/dist/tools/implementation/symbols.d.ts +2 -0
- package/dist/tools/implementation/symbols.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/AccountSchema.d.ts +2 -2
- package/dist/tools/implementation/zodSchema/schemaTypes/AccountSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.d.ts +6 -2
- package/dist/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoListSchema.d.ts +8 -3
- package/dist/tools/implementation/zodSchema/schemaTypes/CoListSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts +12 -7
- package/dist/tools/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.d.ts +13 -7
- package/dist/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.d.ts +11 -2
- package/dist/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.d.ts +4 -0
- package/dist/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/RichTextSchema.d.ts +4 -0
- package/dist/tools/implementation/zodSchema/schemaTypes/RichTextSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/typeConverters/{CoFieldInit.d.ts → CoFieldSchemaInit.d.ts} +7 -7
- package/dist/tools/implementation/zodSchema/typeConverters/CoFieldSchemaInit.d.ts.map +1 -0
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.d.ts +4 -4
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.d.ts +4 -4
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/zodCo.d.ts +3 -3
- package/dist/tools/implementation/zodSchema/zodCo.d.ts.map +1 -1
- package/dist/tools/internal.d.ts +2 -1
- package/dist/tools/internal.d.ts.map +1 -1
- package/dist/tools/lib/migration.d.ts +1 -1
- package/dist/tools/lib/migration.d.ts.map +1 -1
- package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
- package/dist/tools/subscribe/index.d.ts +1 -1
- package/dist/tools/subscribe/index.d.ts.map +1 -1
- package/dist/tools/subscribe/utils.d.ts +2 -2
- package/dist/tools/subscribe/utils.d.ts.map +1 -1
- package/dist/tools/testing.d.ts.map +1 -1
- package/dist/tools/tests/utils.d.ts +2 -6
- package/dist/tools/tests/utils.d.ts.map +1 -1
- package/dist/worker/index.js +3 -3
- package/dist/worker/index.js.map +1 -1
- package/package.json +23 -4
- package/src/better-auth/auth/client.ts +169 -0
- package/src/better-auth/auth/react.tsx +105 -0
- package/src/better-auth/auth/server.ts +250 -0
- package/src/better-auth/auth/tests/client.test.ts +249 -0
- package/src/better-auth/auth/tests/server.test.ts +226 -0
- package/src/browser/auth/PasskeyAuth.ts +2 -2
- package/src/browser/createBrowserContext.ts +2 -2
- package/src/browser/tests/PasskeyAuth.test.ts +2 -2
- package/src/inspector/custom-element.tsx +2 -2
- package/src/inspector/viewer/new-app.tsx +1 -1
- package/src/media/create-image.test.ts +7 -7
- package/src/media/create-image.ts +5 -3
- package/src/media/index.ts +1 -1
- package/src/media/utils.test.ts +72 -66
- package/src/media/utils.ts +9 -6
- package/src/prosemirror/lib/plugin.ts +1 -1
- package/src/prosemirror/lib/sync.ts +1 -1
- package/src/prosemirror/tests/plugin.test.ts +4 -4
- package/src/react/media/image.tsx +2 -2
- package/src/react/tests/media/image.test.tsx +52 -32
- package/src/react-core/hooks.ts +11 -5
- package/src/react-core/tests/useAccount.test.ts +16 -22
- package/src/react-core/tests/useCoState.test.ts +19 -19
- package/src/react-core/tests/useInboxSender.test.ts +5 -2
- package/src/react-core/tests/usePassPhraseAuth.test.ts +6 -6
- package/src/react-native-core/media/image.tsx +1 -1
- package/src/svelte/jazz.class.svelte.ts +1 -1
- package/src/svelte/media/image.svelte +3 -9
- package/src/svelte/media/image.types.ts +7 -0
- package/src/svelte/tests/media/image.svelte.test.ts +34 -32
- package/src/tools/auth/DemoAuth.ts +2 -2
- package/src/tools/auth/PassphraseAuth.ts +2 -2
- package/src/tools/auth/clerk/index.ts +2 -2
- package/src/tools/auth/clerk/tests/JazzClerkAuth.test.ts +1 -1
- package/src/tools/coValues/CoFieldInit.ts +20 -0
- package/src/tools/coValues/CoValueBase.ts +40 -60
- package/src/tools/coValues/account.ts +311 -232
- package/src/tools/coValues/coFeed.ts +185 -153
- package/src/tools/coValues/coList.ts +507 -334
- package/src/tools/coValues/coMap.ts +434 -286
- package/src/tools/coValues/coPlainText.ts +94 -110
- package/src/tools/coValues/deepLoading.ts +13 -13
- package/src/tools/coValues/group.ts +100 -114
- package/src/tools/coValues/inbox.ts +16 -14
- package/src/tools/coValues/interfaces.ts +49 -31
- package/src/tools/coValues/profile.ts +8 -6
- package/src/tools/coValues/request.ts +9 -9
- package/src/tools/coValues/schemaUnion.ts +11 -5
- package/src/tools/exports.ts +1 -1
- package/src/tools/implementation/ContextManager.ts +4 -4
- package/src/tools/implementation/anonymousJazzAgent.ts +2 -1
- package/src/tools/implementation/createContext.ts +1 -1
- package/src/tools/implementation/devtoolsFormatters.ts +9 -9
- package/src/tools/implementation/invites.ts +2 -2
- package/src/tools/implementation/schema.ts +7 -7
- package/src/tools/implementation/symbols.ts +3 -0
- package/src/tools/implementation/zodSchema/schemaTypes/AccountSchema.ts +2 -2
- package/src/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.ts +11 -2
- package/src/tools/implementation/zodSchema/schemaTypes/CoListSchema.ts +18 -7
- package/src/tools/implementation/zodSchema/schemaTypes/CoMapSchema.ts +17 -7
- package/src/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.ts +20 -11
- package/src/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.ts +19 -2
- package/src/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.ts +6 -0
- package/src/tools/implementation/zodSchema/schemaTypes/RichTextSchema.ts +6 -0
- package/src/tools/implementation/zodSchema/typeConverters/{CoFieldInit.ts → CoFieldSchemaInit.ts} +11 -11
- package/src/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.ts +4 -4
- package/src/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.ts +4 -4
- package/src/tools/implementation/zodSchema/zodCo.ts +3 -3
- package/src/tools/internal.ts +2 -1
- package/src/tools/lib/migration.ts +5 -5
- package/src/tools/subscribe/SubscriptionScope.ts +32 -24
- package/src/tools/subscribe/index.ts +4 -4
- package/src/tools/subscribe/utils.ts +11 -11
- package/src/tools/testing.ts +17 -13
- package/src/tools/tests/ContextManager.test.ts +70 -59
- package/src/tools/tests/PassphraseAuth.test.ts +2 -2
- package/src/tools/tests/account.test.ts +188 -67
- package/src/tools/tests/coDiscriminatedUnion.test-d.ts +12 -6
- package/src/tools/tests/coDiscriminatedUnion.test.ts +26 -17
- package/src/tools/tests/coFeed.test-d.ts +18 -17
- package/src/tools/tests/coFeed.test.ts +108 -97
- package/src/tools/tests/coList.test-d.ts +18 -23
- package/src/tools/tests/coList.test.ts +350 -165
- package/src/tools/tests/coMap.record.test-d.ts +9 -13
- package/src/tools/tests/coMap.record.test.ts +37 -23
- package/src/tools/tests/coMap.test-d.ts +43 -21
- package/src/tools/tests/coMap.test.ts +459 -182
- package/src/tools/tests/coOptional.test.ts +28 -13
- package/src/tools/tests/coPlainText.test.ts +15 -15
- package/src/tools/tests/createContext.test.ts +14 -14
- package/src/tools/tests/deepLoading.test.ts +95 -94
- package/src/tools/tests/exportImport.test.ts +61 -41
- package/src/tools/tests/groupsAndAccounts.test.ts +333 -116
- package/src/tools/tests/inbox.test.ts +22 -17
- package/src/tools/tests/interfaces.test.ts +12 -11
- package/src/tools/tests/invites.test.ts +6 -4
- package/src/tools/tests/load.test.ts +20 -18
- package/src/tools/tests/patterns/notifications.test.ts +7 -7
- package/src/tools/tests/patterns/quest.test.ts +3 -3
- package/src/tools/tests/patterns/requestToJoin.test.ts +22 -22
- package/src/tools/tests/request.test.ts +38 -39
- package/src/tools/tests/schemaUnion.test.ts +64 -10
- package/src/tools/tests/subscribe.test.ts +64 -64
- package/src/tools/tests/testing.test.ts +7 -11
- package/src/tools/tests/utils.ts +3 -3
- package/src/tools/tests/zod.test.ts +3 -3
- package/src/worker/index.ts +3 -3
- package/tsup.config.ts +9 -0
- package/dist/chunk-LZOF6WP5.js.map +0 -1
- package/dist/media/chunk-E5J3WLQW.js.map +0 -1
- package/dist/tools/implementation/zodSchema/typeConverters/CoFieldInit.d.ts.map +0 -1
@@ -69,7 +69,7 @@ export class AccountCoState {
|
|
69
69
|
return this.update(undefined);
|
70
70
|
}
|
71
71
|
const me = ctx.me;
|
72
|
-
const unsubscribe = subscribeToCoValue(coValueClassFromCoValueClassOrSchema(Schema), me.id, {
|
72
|
+
const unsubscribe = subscribeToCoValue(coValueClassFromCoValueClassOrSchema(Schema), me.$jazz.id, {
|
73
73
|
// @ts-expect-error The resolve query type isn't compatible with the coValueClassFromCoValueClassOrSchema conversion
|
74
74
|
resolve: options?.resolve,
|
75
75
|
loadAs: me,
|
@@ -2,14 +2,8 @@
|
|
2
2
|
import { ImageDefinition } from "jazz-tools";
|
3
3
|
import { highestResAvailable } from "jazz-tools/media";
|
4
4
|
import { onDestroy } from "svelte";
|
5
|
-
import type { HTMLImgAttributes } from "svelte/elements";
|
6
5
|
import { CoState } from "../jazz.class.svelte";
|
7
|
-
|
8
|
-
interface ImageProps extends Omit<HTMLImgAttributes, "width" | "height"> {
|
9
|
-
imageId: string;
|
10
|
-
width?: number | "original";
|
11
|
-
height?: number | "original";
|
12
|
-
}
|
6
|
+
import type { ImageProps } from "./image.types.js";
|
13
7
|
|
14
8
|
const { imageId, width, height, ...rest }: ImageProps = $props();
|
15
9
|
|
@@ -83,14 +77,14 @@ const src = $derived.by(() => {
|
|
83
77
|
);
|
84
78
|
|
85
79
|
if (!bestImage) return image.placeholderDataURL;
|
86
|
-
if (lastBestImage?.[0] === bestImage.image.id) return lastBestImage?.[1];
|
80
|
+
if (lastBestImage?.[0] === bestImage.image.$jazz.id) return lastBestImage?.[1];
|
87
81
|
|
88
82
|
const blob = bestImage.image.toBlob();
|
89
83
|
|
90
84
|
if (blob) {
|
91
85
|
const url = URL.createObjectURL(blob);
|
92
86
|
revokeObjectURL(lastBestImage?.[1]);
|
93
|
-
lastBestImage = [bestImage.image.id, url];
|
87
|
+
lastBestImage = [bestImage.image.$jazz.id, url];
|
94
88
|
return url;
|
95
89
|
}
|
96
90
|
|
@@ -1,9 +1,4 @@
|
|
1
|
-
import type {
|
2
|
-
interface ImageProps extends Omit<HTMLImgAttributes, "width" | "height"> {
|
3
|
-
imageId: string;
|
4
|
-
width?: number | "original";
|
5
|
-
height?: number | "original";
|
6
|
-
}
|
1
|
+
import type { ImageProps } from "./image.types.js";
|
7
2
|
declare const Image: import("svelte").Component<ImageProps, {}, "">;
|
8
3
|
type Image = ReturnType<typeof Image>;
|
9
4
|
export default Image;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"image.svelte.d.ts","sourceRoot":"","sources":["../../../../src/svelte/media/image.svelte.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"image.svelte.d.ts","sourceRoot":"","sources":["../../../../src/svelte/media/image.svelte.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA2HnD,QAAA,MAAM,KAAK,gDAAsC,CAAC;AAClD,KAAK,KAAK,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AACtC,eAAe,KAAK,CAAC"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { HTMLImgAttributes } from "svelte/elements";
|
2
|
+
export interface ImageProps extends Omit<HTMLImgAttributes, "width" | "height"> {
|
3
|
+
imageId: string;
|
4
|
+
width?: number | "original";
|
5
|
+
height?: number | "original";
|
6
|
+
}
|
7
|
+
//# sourceMappingURL=image.types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"image.types.d.ts","sourceRoot":"","sources":["../../../../src/svelte/media/image.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;CAC9B"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -23,7 +23,7 @@ describe("Image", async () => {
|
|
23
23
|
expect(img.src).toBe("");
|
24
24
|
});
|
25
25
|
it("should render an empty image if the image is not loaded yet", async () => {
|
26
|
-
const original = FileStream.create({ owner: account.
|
26
|
+
const original = FileStream.create({ owner: account.$jazz.owner });
|
27
27
|
original.start({ mimeType: "image/jpeg" });
|
28
28
|
// Don't end original, so it has no chunks
|
29
29
|
const im = ImageDefinition.create({
|
@@ -34,7 +34,7 @@ describe("Image", async () => {
|
|
34
34
|
owner: account,
|
35
35
|
});
|
36
36
|
const { container } = renderWithAccount({
|
37
|
-
imageId: im.id,
|
37
|
+
imageId: im.$jazz.id,
|
38
38
|
alt: "test",
|
39
39
|
});
|
40
40
|
const img = container.querySelector("img");
|
@@ -46,7 +46,7 @@ describe("Image", async () => {
|
|
46
46
|
});
|
47
47
|
it("should render the placeholder image if the image is not loaded yet", async () => {
|
48
48
|
const placeholderDataUrl = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=";
|
49
|
-
const original = FileStream.create({ owner: account.
|
49
|
+
const original = FileStream.create({ owner: account.$jazz.owner });
|
50
50
|
original.start({ mimeType: "image/jpeg" });
|
51
51
|
// Don't end original, so it has no chunks
|
52
52
|
const im = ImageDefinition.create({
|
@@ -58,7 +58,7 @@ describe("Image", async () => {
|
|
58
58
|
owner: account,
|
59
59
|
});
|
60
60
|
const { container } = renderWithAccount({
|
61
|
-
imageId: im.id,
|
61
|
+
imageId: im.$jazz.id,
|
62
62
|
alt: "test",
|
63
63
|
});
|
64
64
|
const img = container.querySelector("img");
|
@@ -82,7 +82,7 @@ describe("Image", async () => {
|
|
82
82
|
owner: account,
|
83
83
|
});
|
84
84
|
renderWithAccount({
|
85
|
-
imageId: im.id,
|
85
|
+
imageId: im.$jazz.id,
|
86
86
|
alt: "test-loading",
|
87
87
|
});
|
88
88
|
await waitFor(() => {
|
@@ -101,7 +101,7 @@ describe("Image", async () => {
|
|
101
101
|
owner: account,
|
102
102
|
});
|
103
103
|
const { container } = renderWithAccount({
|
104
|
-
imageId: im.id,
|
104
|
+
imageId: im.$jazz.id,
|
105
105
|
alt: "test",
|
106
106
|
});
|
107
107
|
const img = container.querySelector("img");
|
@@ -118,7 +118,7 @@ describe("Image", async () => {
|
|
118
118
|
owner: account,
|
119
119
|
});
|
120
120
|
const { container } = renderWithAccount({
|
121
|
-
imageId: im.id,
|
121
|
+
imageId: im.$jazz.id,
|
122
122
|
alt: "test",
|
123
123
|
width: "original",
|
124
124
|
height: "original",
|
@@ -137,7 +137,7 @@ describe("Image", async () => {
|
|
137
137
|
owner: account,
|
138
138
|
});
|
139
139
|
const { container } = renderWithAccount({
|
140
|
-
imageId: im.id,
|
140
|
+
imageId: im.$jazz.id,
|
141
141
|
alt: "test",
|
142
142
|
width: "original",
|
143
143
|
height: 300,
|
@@ -156,7 +156,7 @@ describe("Image", async () => {
|
|
156
156
|
owner: account,
|
157
157
|
});
|
158
158
|
const { container } = renderWithAccount({
|
159
|
-
imageId: im.id,
|
159
|
+
imageId: im.$jazz.id,
|
160
160
|
alt: "test",
|
161
161
|
width: 50,
|
162
162
|
});
|
@@ -174,7 +174,7 @@ describe("Image", async () => {
|
|
174
174
|
owner: account,
|
175
175
|
});
|
176
176
|
const { container } = renderWithAccount({
|
177
|
-
imageId: im.id,
|
177
|
+
imageId: im.$jazz.id,
|
178
178
|
alt: "test",
|
179
179
|
height: 50,
|
180
180
|
});
|
@@ -192,7 +192,7 @@ describe("Image", async () => {
|
|
192
192
|
owner: account,
|
193
193
|
});
|
194
194
|
const { container } = renderWithAccount({
|
195
|
-
imageId: im.id,
|
195
|
+
imageId: im.$jazz.id,
|
196
196
|
alt: "test",
|
197
197
|
class: "test-class",
|
198
198
|
});
|
@@ -219,10 +219,10 @@ describe("Image", async () => {
|
|
219
219
|
}, {
|
220
220
|
owner: account,
|
221
221
|
});
|
222
|
-
im
|
223
|
-
im
|
222
|
+
im.$jazz.set("500x500", original);
|
223
|
+
im.$jazz.set("256x256", await createDummyFileStream(256, account));
|
224
224
|
const { container } = renderWithAccount({
|
225
|
-
imageId: im.id,
|
225
|
+
imageId: im.$jazz.id,
|
226
226
|
alt: "test-progressive",
|
227
227
|
width: 300,
|
228
228
|
});
|
@@ -248,10 +248,10 @@ describe("Image", async () => {
|
|
248
248
|
}, {
|
249
249
|
owner: account,
|
250
250
|
});
|
251
|
-
im
|
252
|
-
im
|
251
|
+
im.$jazz.set("1920x1080", original);
|
252
|
+
im.$jazz.set("256x256", await createDummyFileStream(256, account));
|
253
253
|
const { container } = renderWithAccount({
|
254
|
-
imageId: im.id,
|
254
|
+
imageId: im.$jazz.id,
|
255
255
|
alt: "test-progressive",
|
256
256
|
width: 1024,
|
257
257
|
});
|
@@ -260,7 +260,7 @@ describe("Image", async () => {
|
|
260
260
|
});
|
261
261
|
expect(createObjectURLSpy).toHaveBeenCalledTimes(1);
|
262
262
|
// Load higher resolution image
|
263
|
-
im
|
263
|
+
im.$jazz.set("1024x1024", await createDummyFileStream(1024, account));
|
264
264
|
await waitFor(() => {
|
265
265
|
expect(container.querySelector("img").src).toBe("blob:test-1024");
|
266
266
|
});
|
@@ -285,11 +285,11 @@ describe("Image", async () => {
|
|
285
285
|
}, {
|
286
286
|
owner: account,
|
287
287
|
});
|
288
|
-
im
|
289
|
-
im
|
290
|
-
im
|
288
|
+
im.$jazz.set("100x100", original);
|
289
|
+
im.$jazz.set("256x256", await createDummyFileStream(256, account));
|
290
|
+
im.$jazz.set("1024x1024", await createDummyFileStream(1024, account));
|
291
291
|
const { container } = renderWithAccount({
|
292
|
-
imageId: im.id,
|
292
|
+
imageId: im.$jazz.id,
|
293
293
|
alt: "test-progressive",
|
294
294
|
width: 256,
|
295
295
|
});
|
@@ -315,10 +315,10 @@ describe("Image", async () => {
|
|
315
315
|
}, {
|
316
316
|
owner: account,
|
317
317
|
});
|
318
|
-
im
|
319
|
-
im
|
318
|
+
im.$jazz.set("100x100", original);
|
319
|
+
im.$jazz.set("256x256", await createDummyFileStream(256, account));
|
320
320
|
const { container } = renderWithAccount({
|
321
|
-
imageId: im.id,
|
321
|
+
imageId: im.$jazz.id,
|
322
322
|
alt: "test-progressive",
|
323
323
|
width: 100,
|
324
324
|
});
|
@@ -344,10 +344,10 @@ describe("Image", async () => {
|
|
344
344
|
}, {
|
345
345
|
owner: account,
|
346
346
|
});
|
347
|
-
im
|
348
|
-
im
|
347
|
+
im.$jazz.set("256x256", original);
|
348
|
+
im.$jazz.set("1024x1024", await createDummyFileStream(1024, account));
|
349
349
|
const { container, rerender } = renderWithAccount({
|
350
|
-
imageId: im.id,
|
350
|
+
imageId: im.$jazz.id,
|
351
351
|
alt: "test-dynamic",
|
352
352
|
width: 256,
|
353
353
|
height: 256,
|
@@ -358,7 +358,7 @@ describe("Image", async () => {
|
|
358
358
|
});
|
359
359
|
expect(createObjectURLSpy).toHaveBeenCalledTimes(1);
|
360
360
|
rerender({
|
361
|
-
imageId: im.id,
|
361
|
+
imageId: im.$jazz.id,
|
362
362
|
alt: "test-dynamic",
|
363
363
|
width: 1024,
|
364
364
|
height: 1024,
|
@@ -380,7 +380,7 @@ describe("Image", async () => {
|
|
380
380
|
owner: account,
|
381
381
|
});
|
382
382
|
const { container } = renderWithAccount({
|
383
|
-
imageId: im.id,
|
383
|
+
imageId: im.$jazz.id,
|
384
384
|
alt: "test",
|
385
385
|
loading: "lazy",
|
386
386
|
});
|
@@ -405,7 +405,7 @@ describe("Image", async () => {
|
|
405
405
|
owner: account,
|
406
406
|
});
|
407
407
|
const { container } = renderWithAccount({
|
408
|
-
imageId: im.id,
|
408
|
+
imageId: im.$jazz.id,
|
409
409
|
alt: "test",
|
410
410
|
loading: "lazy",
|
411
411
|
});
|
package/.turbo/turbo-build.log
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
> jazz-tools@0.
|
2
|
+
> jazz-tools@0.18.1 build /home/runner/_work/jazz/jazz/packages/jazz-tools
|
3
3
|
> tsup && pnpm types && pnpm build:svelte
|
4
4
|
|
5
5
|
[34mCLI[39m Building entry: {"index":"src/index.ts","testing":"src/testing.ts"}
|
@@ -30,6 +30,10 @@
|
|
30
30
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
31
31
|
[34mCLI[39m Building entry: {"index":"src/worker/index.ts"}
|
32
32
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
33
|
+
[34mCLI[39m Building entry: {"client":"src/better-auth/auth/client.ts","server":"src/better-auth/auth/server.ts","react":"src/better-auth/auth/react.tsx"}
|
34
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
35
|
+
[34mCLI[39m tsup v8.5.0
|
36
|
+
[34mCLI[39m Using tsup config: /home/runner/_work/jazz/jazz/packages/jazz-tools/tsup.config.ts
|
33
37
|
[34mCLI[39m tsup v8.5.0
|
34
38
|
[34mCLI[39m Using tsup config: /home/runner/_work/jazz/jazz/packages/jazz-tools/tsup.config.ts
|
35
39
|
[34mCLI[39m tsup v8.5.0
|
@@ -72,6 +76,9 @@
|
|
72
76
|
[34mCLI[39m Target: es2021
|
73
77
|
[34mCLI[39m Target: es2021
|
74
78
|
[34mCLI[39m Target: es2021
|
79
|
+
[34mCLI[39m Target: es2021
|
80
|
+
[34mCLI[39m Cleaning output folder
|
81
|
+
[34mESM[39m Build start
|
75
82
|
[34mCLI[39m Cleaning output folder
|
76
83
|
[34mESM[39m Build start
|
77
84
|
[34mCLI[39m Cleaning output folder
|
@@ -100,84 +107,91 @@
|
|
100
107
|
[34mESM[39m Build start
|
101
108
|
[34mCLI[39m Cleaning output folder
|
102
109
|
[34mESM[39m Build start
|
103
|
-
[32mESM[39m [1mdist/worker/index.js [22m[32m2.31 KB[39m
|
104
|
-
[32mESM[39m [1mdist/worker/index.js.map [22m[32m4.77 KB[39m
|
105
|
-
[32mESM[39m ⚡️ Build success in 18ms
|
106
|
-
[32mESM[39m [1mdist/tiptap/index.js [22m[32m564.00 B[39m
|
107
|
-
[32mESM[39m [1mdist/tiptap/index.js.map [22m[32m1.21 KB[39m
|
108
|
-
[32mESM[39m ⚡️ Build success in 20ms
|
109
110
|
[32mESM[39m [1mdist/react/ssr.js [22m[32m688.00 B[39m
|
110
111
|
[32mESM[39m [1mdist/react/ssr.js.map [22m[32m1.12 KB[39m
|
111
|
-
[32mESM[39m ⚡️ Build success in
|
112
|
+
[32mESM[39m ⚡️ Build success in 28ms
|
113
|
+
[32mESM[39m [1mdist/tiptap/index.js [22m[32m564.00 B[39m
|
114
|
+
[32mESM[39m [1mdist/tiptap/index.js.map [22m[32m1.21 KB[39m
|
115
|
+
[32mESM[39m ⚡️ Build success in 27ms
|
116
|
+
[32mESM[39m [1mdist/worker/index.js [22m[32m2.33 KB[39m
|
117
|
+
[32mESM[39m [1mdist/worker/index.js.map [22m[32m4.79 KB[39m
|
118
|
+
[32mESM[39m ⚡️ Build success in 25ms
|
112
119
|
[32mESM[39m [1mdist/media/index.js [22m[32m236.00 B[39m
|
113
120
|
[32mESM[39m [1mdist/media/index.browser.js [22m[32m3.21 KB[39m
|
114
121
|
[32mESM[39m [1mdist/media/index.native.js [22m[32m3.53 KB[39m
|
115
|
-
[32mESM[39m [1mdist/media/chunk-
|
122
|
+
[32mESM[39m [1mdist/media/chunk-KR2V6X2N.js [22m[32m6.42 KB[39m
|
116
123
|
[32mESM[39m [1mdist/media/index.js.map [22m[32m71.00 B[39m
|
117
|
-
[32mESM[39m [1mdist/media/index.browser.js.map [22m[32m6.02 KB[39m
|
118
124
|
[32mESM[39m [1mdist/media/index.native.js.map [22m[32m6.52 KB[39m
|
119
|
-
[32mESM[39m [1mdist/media/
|
125
|
+
[32mESM[39m [1mdist/media/index.browser.js.map [22m[32m6.02 KB[39m
|
126
|
+
[32mESM[39m [1mdist/media/chunk-KR2V6X2N.js.map [22m[32m16.19 KB[39m
|
127
|
+
[32mESM[39m ⚡️ Build success in 34ms
|
128
|
+
[32mESM[39m [1mdist/better-auth/auth/server.js [22m[32m5.94 KB[39m
|
129
|
+
[32mESM[39m [1mdist/better-auth/auth/react.js [22m[32m1.19 KB[39m
|
130
|
+
[32mESM[39m [1mdist/better-auth/auth/client.js [22m[32m4.36 KB[39m
|
131
|
+
[32mESM[39m [1mdist/better-auth/auth/server.js.map [22m[32m10.66 KB[39m
|
132
|
+
[32mESM[39m [1mdist/better-auth/auth/react.js.map [22m[32m3.37 KB[39m
|
133
|
+
[32mESM[39m [1mdist/better-auth/auth/client.js.map [22m[32m8.12 KB[39m
|
120
134
|
[32mESM[39m ⚡️ Build success in 26ms
|
121
|
-
[32mESM[39m [1mdist/browser/index.js [22m[32m13.
|
122
|
-
[32mESM[39m [1mdist/browser/index.js.map [22m[32m28.
|
123
|
-
[32mESM[39m ⚡️ Build success in
|
135
|
+
[32mESM[39m [1mdist/browser/index.js [22m[32m13.44 KB[39m
|
136
|
+
[32mESM[39m [1mdist/browser/index.js.map [22m[32m28.70 KB[39m
|
137
|
+
[32mESM[39m ⚡️ Build success in 40ms
|
124
138
|
[32mESM[39m [1mdist/react-native/index.js [22m[32m2.53 KB[39m
|
125
139
|
[32mESM[39m [1mdist/react-native/testing.js [22m[32m120.00 B[39m
|
126
140
|
[32mESM[39m [1mdist/react-native/crypto.js [22m[32m161.00 B[39m
|
127
141
|
[32mESM[39m [1mdist/react-native/index.js.map [22m[32m5.68 KB[39m
|
128
142
|
[32mESM[39m [1mdist/react-native/testing.js.map [22m[32m176.00 B[39m
|
129
143
|
[32mESM[39m [1mdist/react-native/crypto.js.map [22m[32m197.00 B[39m
|
130
|
-
[32mESM[39m ⚡️ Build success in
|
131
|
-
[32mESM[39m [1mdist/react-core/index.js [22m[32m8.41 KB[39m
|
132
|
-
[32mESM[39m [1mdist/react-core/testing.js [22m[32m1.17 KB[39m
|
133
|
-
[32mESM[39m [1mdist/react-core/chunk-7DYMJ74I.js [22m[32m279.00 B[39m
|
134
|
-
[32mESM[39m [1mdist/react-core/index.js.map [22m[32m20.68 KB[39m
|
135
|
-
[32mESM[39m [1mdist/react-core/testing.js.map [22m[32m1.82 KB[39m
|
136
|
-
[32mESM[39m [1mdist/react-core/chunk-7DYMJ74I.js.map [22m[32m533.00 B[39m
|
137
|
-
[32mESM[39m ⚡️ Build success in 26ms
|
144
|
+
[32mESM[39m ⚡️ Build success in 46ms
|
138
145
|
[32mESM[39m [1mdist/expo/index.js [22m[32m4.68 KB[39m
|
139
146
|
[32mESM[39m [1mdist/expo/testing.js [22m[32m112.00 B[39m
|
140
147
|
[32mESM[39m [1mdist/expo/crypto.js [22m[32m153.00 B[39m
|
141
148
|
[32mESM[39m [1mdist/expo/index.js.map [22m[32m10.23 KB[39m
|
142
|
-
[32mESM[39m [1mdist/expo/testing.js.map [22m[32m168.00 B[39m
|
143
149
|
[32mESM[39m [1mdist/expo/crypto.js.map [22m[32m189.00 B[39m
|
144
|
-
[32mESM[39m
|
150
|
+
[32mESM[39m [1mdist/expo/testing.js.map [22m[32m168.00 B[39m
|
151
|
+
[32mESM[39m ⚡️ Build success in 50ms
|
145
152
|
[32mESM[39m [1mdist/react-native-core/index.js [22m[32m17.90 KB[39m
|
146
153
|
[32mESM[39m [1mdist/react-native-core/testing.js [22m[32m119.00 B[39m
|
147
154
|
[32mESM[39m [1mdist/react-native-core/crypto.js [22m[32m2.10 KB[39m
|
148
|
-
[32mESM[39m [1mdist/react-native-core/index.js.map [22m[32m36.
|
155
|
+
[32mESM[39m [1mdist/react-native-core/index.js.map [22m[32m36.66 KB[39m
|
149
156
|
[32mESM[39m [1mdist/react-native-core/testing.js.map [22m[32m175.00 B[39m
|
150
157
|
[32mESM[39m [1mdist/react-native-core/crypto.js.map [22m[32m4.25 KB[39m
|
151
|
-
[32mESM[39m ⚡️ Build success in
|
152
|
-
[32mESM[39m [1mdist/react/index.js [22m[32m24.
|
158
|
+
[32mESM[39m ⚡️ Build success in 47ms
|
159
|
+
[32mESM[39m [1mdist/react/index.js [22m[32m24.66 KB[39m
|
153
160
|
[32mESM[39m [1mdist/react/testing.js [22m[32m122.00 B[39m
|
161
|
+
[32mESM[39m [1mdist/react/index.js.map [22m[32m53.09 KB[39m
|
154
162
|
[32mESM[39m [1mdist/react/testing.js.map [22m[32m165.00 B[39m
|
155
|
-
[32mESM[39m
|
156
|
-
[32mESM[39m
|
157
|
-
[32mESM[39m [1mdist/prosemirror/index.js
|
158
|
-
[32mESM[39m
|
159
|
-
[32mESM[39m ⚡️ Build success in 54ms
|
163
|
+
[32mESM[39m ⚡️ Build success in 61ms
|
164
|
+
[32mESM[39m [1mdist/prosemirror/index.js [22m[32m77.63 KB[39m
|
165
|
+
[32mESM[39m [1mdist/prosemirror/index.js.map [22m[32m306.98 KB[39m
|
166
|
+
[32mESM[39m ⚡️ Build success in 62ms
|
160
167
|
[32mESM[39m [1mdist/inspector/index.js [22m[32m61.52 KB[39m
|
161
|
-
[32mESM[39m [1mdist/inspector/index.js.map [22m[32m109.
|
162
|
-
[32mESM[39m ⚡️ Build success in
|
163
|
-
[32mESM[39m [1mdist/
|
164
|
-
[32mESM[39m [1mdist/
|
165
|
-
[32mESM[39m [1mdist/
|
166
|
-
[32mESM[39m [1mdist/testing.js.map [22m[32m14.
|
167
|
-
[32mESM[39m [1mdist/index.js.map [22m[32m52.
|
168
|
-
[32mESM[39m [1mdist/chunk-
|
169
|
-
[32mESM[39m ⚡️ Build success in
|
168
|
+
[32mESM[39m [1mdist/inspector/index.js.map [22m[32m109.98 KB[39m
|
169
|
+
[32mESM[39m ⚡️ Build success in 76ms
|
170
|
+
[32mESM[39m [1mdist/index.js [22m[32m26.13 KB[39m
|
171
|
+
[32mESM[39m [1mdist/chunk-IERUTUXB.js [22m[32m163.90 KB[39m
|
172
|
+
[32mESM[39m [1mdist/testing.js [22m[32m7.17 KB[39m
|
173
|
+
[32mESM[39m [1mdist/testing.js.map [22m[32m14.10 KB[39m
|
174
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m52.92 KB[39m
|
175
|
+
[32mESM[39m [1mdist/chunk-IERUTUXB.js.map [22m[32m389.03 KB[39m
|
176
|
+
[32mESM[39m ⚡️ Build success in 108ms
|
177
|
+
[32mESM[39m [1mdist/react-core/testing.js [22m[32m1.17 KB[39m
|
178
|
+
[32mESM[39m [1mdist/react-core/chunk-7DYMJ74I.js [22m[32m279.00 B[39m
|
179
|
+
[32mESM[39m [1mdist/react-core/index.js [22m[32m141.07 KB[39m
|
180
|
+
[32mESM[39m [1mdist/react-core/testing.js.map [22m[32m1.82 KB[39m
|
181
|
+
[32mESM[39m [1mdist/react-core/chunk-7DYMJ74I.js.map [22m[32m533.00 B[39m
|
182
|
+
[32mESM[39m [1mdist/react-core/index.js.map [22m[32m383.45 KB[39m
|
183
|
+
[32mESM[39m ⚡️ Build success in 107ms
|
170
184
|
[32mESM[39m [1mdist/inspector/register-custom-element.js [22m[32m218.00 B[39m
|
171
185
|
[32mESM[39m [1mdist/inspector/register-custom-element.js.map [22m[32m314.00 B[39m
|
172
|
-
[32mESM[39m [1mdist/inspector/custom-element-
|
173
|
-
[32mESM[39m [1mdist/inspector/custom-element-
|
174
|
-
[32mESM[39m ⚡️ Build success in
|
186
|
+
[32mESM[39m [1mdist/inspector/custom-element-WCY6D3QJ.js [22m[32m1.53 MB[39m
|
187
|
+
[32mESM[39m [1mdist/inspector/custom-element-WCY6D3QJ.js.map [22m[32m2.35 MB[39m
|
188
|
+
[32mESM[39m ⚡️ Build success in 147ms
|
175
189
|
|
176
|
-
> jazz-tools@0.
|
190
|
+
> jazz-tools@0.18.1 types /home/runner/_work/jazz/jazz/packages/jazz-tools
|
177
191
|
> tsc --outDir dist
|
178
192
|
|
179
193
|
|
180
|
-
> jazz-tools@0.
|
194
|
+
> jazz-tools@0.18.1 build:svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
|
181
195
|
> rm -rf dist/svelte && svelte-package -i src/svelte -o dist/svelte --tsconfig tsconfig.svelte.json
|
182
196
|
|
183
197
|
src/svelte -> dist/svelte
|
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,46 @@
|
|
1
1
|
# jazz-tools
|
2
2
|
|
3
|
+
## 0.18.1
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- af5fbe7: New BetterAuth plugins to store Jazz's credentials
|
8
|
+
- 9837459: Add `CoMap.$jazz.has` and `Account.$jazz.has` method to check for property existance without loading referenced CoValues or checking permissions
|
9
|
+
- cojson@0.18.1
|
10
|
+
- cojson-storage-indexeddb@0.18.1
|
11
|
+
- cojson-transport-ws@0.18.1
|
12
|
+
|
13
|
+
## 0.18.0
|
14
|
+
|
15
|
+
### Minor Changes
|
16
|
+
|
17
|
+
- f263856: Add `$jazz` field to CoValues:
|
18
|
+
- This field contains Jazz methods that cluttered CoValues' API, as well as Jazz internal properties. This field is not enumerable, to allow CoValues to behave similarly to JSON objects.
|
19
|
+
- Added a `$jazz.set` method to update a CoValue's fields. When updating collaborative fields, you can pass in JSON objects instead of CoValues and Jazz will create
|
20
|
+
the CoValues automatically (similarly to CoValue `create` methods).
|
21
|
+
- All CoMap methods have been moved into `$jazz`, to allow defining any arbitrary key in the CoMap (except for `$jazz`) without conflicts.
|
22
|
+
- For CoMaps created with `co.map`, fields are now `readonly` to prevent setting properties directly. Use the `$jazz.set` method instead.
|
23
|
+
- CoMaps created with class schemas don't get type errors on direct property assignments, but they get a runtime errors prompting indicating to use `$jazz.set`.
|
24
|
+
- the `delete` operator can no longer be used to delete CoRecord properties. Use `$jazz.delete` instead.
|
25
|
+
- CoList's array-mutation methods have been moved into `$jazz`, in order to prevent using methods
|
26
|
+
- CoLists are now readonly arrays. Trying to use any mutation method yields a type error.
|
27
|
+
- `$jazz.set` can be used in place of direct element assignments.
|
28
|
+
- Added two new utility methods: `$jazz.remove` and `$jazz.retain`. They allow editing a CoList in-place with a simpler API than `$jazz.splice`.
|
29
|
+
- `sort`, `reverse`, `fill` and `copyWithin` have been deprecated, given that they could behave inconsistently with CoLists. `$jazz` replacements may be introduced
|
30
|
+
in future releases.
|
31
|
+
- `.$jazz.owner` now always returns a Group (instead of a Group or an Account). We'll be migrating away of having Accounts as CoValue owners in future releases.
|
32
|
+
- Removed `castAs`, since it's an inherently unsafe operation that bypassed typechecking and enabled using CoValues in unsupported ways.
|
33
|
+
- Removed the `id` and `_type` fields from `toJSON()`'s output in Account, CoMap, CoFeed & FileStream, to make CoValues behave more similarly to JSON objects.
|
34
|
+
- Removed the `root` and `profile` fields from Group.
|
35
|
+
|
36
|
+
### Patch Changes
|
37
|
+
|
38
|
+
- Updated dependencies [b709494]
|
39
|
+
- Updated dependencies [f263856]
|
40
|
+
- cojson@0.18.0
|
41
|
+
- cojson-storage-indexeddb@0.18.0
|
42
|
+
- cojson-transport-ws@0.18.0
|
43
|
+
|
3
44
|
## 0.17.14
|
4
45
|
|
5
46
|
### Patch Changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import type { AuthSecretStorage, Account, JazzContextType } from "jazz-tools";
|
2
|
+
import type { jazzPlugin } from "./server.js";
|
3
|
+
/**
|
4
|
+
* @example
|
5
|
+
* ```ts
|
6
|
+
* const auth = betterAuth({
|
7
|
+
* plugins: [jazzPluginClient()],
|
8
|
+
* });
|
9
|
+
* ```
|
10
|
+
*/
|
11
|
+
export declare const jazzPluginClient: () => {
|
12
|
+
id: "jazz-plugin";
|
13
|
+
$InferServerPlugin: ReturnType<typeof jazzPlugin>;
|
14
|
+
getActions: ($fetch: import("@better-fetch/fetch").BetterFetch, $store: import("better-auth").Store) => {
|
15
|
+
jazz: {
|
16
|
+
setJazzContext: (context: JazzContextType<Account>) => void;
|
17
|
+
setAuthSecretStorage: (storage: AuthSecretStorage) => void;
|
18
|
+
};
|
19
|
+
};
|
20
|
+
fetchPlugins: {
|
21
|
+
id: string;
|
22
|
+
name: string;
|
23
|
+
hooks: {
|
24
|
+
onRequest<T extends Record<string, any>>(context: import("@better-fetch/fetch").RequestContext<T>): Promise<void>;
|
25
|
+
onSuccess(context: import("@better-fetch/fetch").SuccessContext<any>): Promise<void>;
|
26
|
+
};
|
27
|
+
}[];
|
28
|
+
};
|
29
|
+
//# sourceMappingURL=client.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/better-auth/auth/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iBAAiB,EAEjB,OAAO,EACP,eAAe,EAChB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB;;wBAmBC,UAAU,CAAC,OAAO,UAAU,CAAC;;;sCAIvB,eAAe,CAAC,OAAO,CAAC;4CAGlB,iBAAiB;;;;;;;;;;;CA6H1D,CAAC"}
|
@@ -0,0 +1,127 @@
|
|
1
|
+
// src/better-auth/auth/client.ts
|
2
|
+
var jazzPluginClient = () => {
|
3
|
+
let jazzContext;
|
4
|
+
let authSecretStorage;
|
5
|
+
let signOutUnsubscription;
|
6
|
+
const authenticateOnJazz = async (jazzAuth) => {
|
7
|
+
const parsedJazzAuth = {
|
8
|
+
...jazzAuth,
|
9
|
+
secretSeed: jazzAuth.secretSeed ? Uint8Array.from(jazzAuth.secretSeed) : void 0
|
10
|
+
};
|
11
|
+
await jazzContext.authenticate(parsedJazzAuth);
|
12
|
+
await authSecretStorage.set(parsedJazzAuth);
|
13
|
+
};
|
14
|
+
return {
|
15
|
+
id: "jazz-plugin",
|
16
|
+
$InferServerPlugin: {},
|
17
|
+
getActions: ($fetch, $store) => {
|
18
|
+
return {
|
19
|
+
jazz: {
|
20
|
+
setJazzContext: (context) => {
|
21
|
+
jazzContext = context;
|
22
|
+
},
|
23
|
+
setAuthSecretStorage: (storage) => {
|
24
|
+
authSecretStorage = storage;
|
25
|
+
if (signOutUnsubscription) signOutUnsubscription();
|
26
|
+
signOutUnsubscription = authSecretStorage.onUpdate(
|
27
|
+
(isAuthenticated) => {
|
28
|
+
if (isAuthenticated === false) {
|
29
|
+
const session = $store.atoms.session?.get();
|
30
|
+
if (!session) return;
|
31
|
+
if (session.isPending || session.isRefetching) {
|
32
|
+
const unsub = $store.atoms.session?.listen((session2) => {
|
33
|
+
unsub?.();
|
34
|
+
if (session2.data !== null) {
|
35
|
+
$fetch("/sign-out", { method: "POST" });
|
36
|
+
}
|
37
|
+
});
|
38
|
+
} else {
|
39
|
+
$fetch("/sign-out", { method: "POST" });
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
};
|
47
|
+
},
|
48
|
+
fetchPlugins: [
|
49
|
+
{
|
50
|
+
id: "jazz-plugin",
|
51
|
+
name: "jazz-plugin",
|
52
|
+
hooks: {
|
53
|
+
async onRequest(context) {
|
54
|
+
if (context.url.toString().includes("/sign-up") || context.url.toString().includes("/sign-in/social")) {
|
55
|
+
const credentials = await authSecretStorage.get();
|
56
|
+
if (!credentials) {
|
57
|
+
throw new Error("Jazz credentials not found");
|
58
|
+
}
|
59
|
+
context.headers.set(
|
60
|
+
"x-jazz-auth",
|
61
|
+
JSON.stringify({
|
62
|
+
accountID: credentials.accountID,
|
63
|
+
secretSeed: credentials.secretSeed,
|
64
|
+
accountSecret: credentials.accountSecret
|
65
|
+
})
|
66
|
+
);
|
67
|
+
}
|
68
|
+
},
|
69
|
+
async onSuccess(context) {
|
70
|
+
if (context.request.url.toString().includes("/sign-up")) {
|
71
|
+
await authenticateOnJazz(context.data.jazzAuth);
|
72
|
+
return;
|
73
|
+
}
|
74
|
+
if (context.request.url.toString().includes("/sign-in/email")) {
|
75
|
+
await authenticateOnJazz(context.data.jazzAuth);
|
76
|
+
return;
|
77
|
+
}
|
78
|
+
if (context.request.url.toString().includes("/get-session")) {
|
79
|
+
if (context.data === null) {
|
80
|
+
if (authSecretStorage.isAuthenticated === true) {
|
81
|
+
console.warn(
|
82
|
+
"Jazz is authenticated, but the session is null"
|
83
|
+
);
|
84
|
+
}
|
85
|
+
return;
|
86
|
+
}
|
87
|
+
if (!context.data?.user) {
|
88
|
+
return;
|
89
|
+
}
|
90
|
+
if (authSecretStorage.isAuthenticated === false) {
|
91
|
+
console.info(
|
92
|
+
"Jazz is not authenticated, using Better Auth stored credentials"
|
93
|
+
);
|
94
|
+
await authenticateOnJazz(context.data.jazzAuth);
|
95
|
+
return;
|
96
|
+
}
|
97
|
+
const sessionAccountID = context.data.user.accountID;
|
98
|
+
const credentials = await authSecretStorage.get();
|
99
|
+
if (!credentials) {
|
100
|
+
throw new Error("Jazz credentials not found");
|
101
|
+
}
|
102
|
+
if (credentials.accountID !== sessionAccountID) {
|
103
|
+
console.info(
|
104
|
+
"Jazz credentials mismatch, using Better Auth stored credentials"
|
105
|
+
);
|
106
|
+
await authenticateOnJazz(context.data.jazzAuth);
|
107
|
+
}
|
108
|
+
return;
|
109
|
+
}
|
110
|
+
if (context.request.url.toString().includes("/sign-out")) {
|
111
|
+
await jazzContext.logOut();
|
112
|
+
return;
|
113
|
+
}
|
114
|
+
if (context.request.url.toString().includes("/delete-user")) {
|
115
|
+
await jazzContext.logOut();
|
116
|
+
return;
|
117
|
+
}
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}
|
121
|
+
]
|
122
|
+
};
|
123
|
+
};
|
124
|
+
export {
|
125
|
+
jazzPluginClient
|
126
|
+
};
|
127
|
+
//# sourceMappingURL=client.js.map
|