jazz-tools 0.15.7 → 0.15.8

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/dist/index.js CHANGED
@@ -34,7 +34,7 @@ import {
34
34
  subscribeToCoValue,
35
35
  zodReExport_exports,
36
36
  zodSchemaToCoSchema
37
- } from "./chunk-AV3MKD64.js";
37
+ } from "./chunk-DGFPP22M.js";
38
38
 
39
39
  // src/tools/auth/clerk/index.ts
40
40
  import {
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  // src/react/provider.tsx
2
4
  import {
3
5
  JazzBrowserContextManager
@@ -696,4 +698,4 @@ export {
696
698
  usePassphraseAuth2 as usePassphraseAuth,
697
699
  useProgressiveImg
698
700
  };
699
- //# sourceMappingURL=index.js.mapRL=index.js.map
701
+ //# sourceMappingURL=index.js.map
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  // src/react/testing.tsx
2
4
  export * from "jazz-tools/react-core/testing";
3
- //# sourceMappingURL=testing.js.map=testing.js.map
5
+ //# sourceMappingURL=testing.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/react/testing.tsx"],"sourcesContent":["export * from \"jazz-tools/react-core/testing\";\n"],"mappings":";AAAA,cAAc;","names":[]}]}
1
+ {"version":3,"sources":["../../src/react/testing.tsx"],"sourcesContent":["export * from \"jazz-tools/react-core/testing\";\n"],"mappings":";;;AAAA,cAAc;","names":[]}
package/dist/testing.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  createAnonymousJazzContext,
7
7
  createJazzContext,
8
8
  randomSessionProvider
9
- } from "./chunk-AV3MKD64.js";
9
+ } from "./chunk-DGFPP22M.js";
10
10
 
11
11
  // src/tools/testing.ts
12
12
  import { LocalNode } from "cojson";
@@ -20,5 +20,5 @@ export { PassphraseAuth } from "./auth/PassphraseAuth.js";
20
20
  export { createInviteLink, parseInviteLink, consumeInviteLink, } from "./implementation/invites.js";
21
21
  export { AnonymousJazzAgent, createAnonymousJazzContext, createJazzContextFromExistingCredentials, createJazzContextForNewAccount, createJazzContext, randomSessionProvider, type AuthResult, type Credentials, type JazzContextWithAccount, } from "./internal.js";
22
22
  export type * from "./types.js";
23
- export { zodSchemaToCoSchema, anySchemaToCoSchema, type InstanceOfSchema, type InstanceOfSchemaCoValuesNullable, type CoValueOrZodSchema, type Loaded, type AccountSchema, type AnyAccountSchema, type CoListSchema, type CoMapSchema, type CoFeedSchema, type PlainTextSchema, type FileStreamSchema, type ResolveQuery, type ResolveQueryStrict, type InitFor, type CoRecordSchema, type CoProfileSchema, } from "./internal.js";
23
+ export { zodSchemaToCoSchema, anySchemaToCoSchema, type InstanceOfSchema, type InstanceOfSchemaCoValuesNullable, type CoValueOrZodSchema, type Loaded, type BaseAccountShape, type DefaultAccountShape, type AccountSchema, type AnyAccountSchema, type CoListSchema, type CoMapSchema, type CoFeedSchema, type PlainTextSchema, type FileStreamSchema, type ResolveQuery, type ResolveQueryStrict, type InitFor, type CoRecordSchema, type CoProfileSchema, } from "./internal.js";
24
24
  //# sourceMappingURL=exports.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../src/tools/exports.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,IAAI,EACJ,SAAS,EACT,WAAW,GACZ,MAAM,QAAQ,CAAC;AAEhB,OAAO,KAAK,CAAC,MAAM,2CAA2C,CAAC;AAE/D,YAAY,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO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AgB,EACrB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC"}
@@ -6,21 +6,20 @@ import { InstanceOrPrimitiveOfSchemaCoValuesNullable } from "../typeConverters/I
6
6
  import { z } from "../zodReExport.js";
7
7
  import { Loaded, ResolveQuery } from "../zodSchema.js";
8
8
  import { AnyCoMapSchema, CoMapSchema } from "./CoMapSchema.js";
9
- export type AccountSchema<Shape extends {
10
- profile: AnyCoMapSchema<{
11
- name: z.core.$ZodString<string>;
12
- inbox?: z.core.$ZodOptional<z.core.$ZodString>;
13
- inboxInvite?: z.core.$ZodOptional<z.core.$ZodString>;
14
- }>;
9
+ export type BaseProfileShape = {
10
+ name: z.core.$ZodString<string>;
11
+ inbox?: z.core.$ZodOptional<z.core.$ZodString>;
12
+ inboxInvite?: z.core.$ZodOptional<z.core.$ZodString>;
13
+ };
14
+ export type BaseAccountShape = {
15
+ profile: AnyCoMapSchema<BaseProfileShape>;
15
16
  root: AnyCoMapSchema;
16
- } = {
17
- profile: CoMapSchema<{
18
- name: z.core.$ZodString<string>;
19
- inbox?: z.core.$ZodOptional<z.core.$ZodString>;
20
- inboxInvite?: z.core.$ZodOptional<z.core.$ZodString>;
21
- }>;
17
+ };
18
+ export type DefaultAccountShape = {
19
+ profile: CoMapSchema<BaseProfileShape>;
22
20
  root: CoMapSchema<{}>;
23
- }> = Omit<CoMapSchema<Shape>, "create" | "load" | "withMigration"> & {
21
+ };
22
+ export type AccountSchema<Shape extends BaseAccountShape = DefaultAccountShape> = Omit<CoMapSchema<Shape>, "create" | "load" | "withMigration"> & {
24
23
  builtin: "Account";
25
24
  create: (options: {
26
25
  creationProps?: {
@@ -1 +1 @@
1
- {"version":3,"file":"AccountSchema.d.ts","sourceRoot":"","sources":["../../../../../src/tools/implementation/zodSchema/schemaTypes/AccountSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,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Y,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC9C,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,cAAc,GAAG,mBAAmB,EACzD,MAAM,SAAS,CAAC,CAAC,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,gBAAgB,IAC9D,WAAW,CAAC,KAAK,GAAG,mBAAmB,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AAG5D,MAAM,MAAM,gBAAgB,CAC1B,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,cAAc,IACzD,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG;IAC7B,aAAa,EAAE,IAAI,CAAC;IACpB,OAAO,EAAE,SAAS,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,eAAe,CAAC,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,cAAc,IAAI;IACjE,CAAC,UAAU,GAAG,IAAI,MAAM,KAAK,GAAG,2BAA2B,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;CACxE,GAAG,OAAO,CAAC;AAEZ,MAAM,MAAM,+BAA+B,CACzC,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,cAAc,IACjC;IACF,CAAC,UAAU,GAAG,IAAI,MAAM,KAAK,GAAG,2CAA2C,CACzE,KAAK,CAAC,GAAG,CAAC,CACX;CACF,GAAG,OAAO,CAAC"}
@@ -1,15 +1,45 @@
1
- import { AccountSchema, AnyCoMapSchema, CoFeedSchema, CoListSchema, CoMapSchema, CoProfileSchema, CoRecordSchema, FileStreamSchema, ImageDefinition, PlainTextSchema } from "../../internal.js";
1
+ import { type AccountSchema, BaseAccountShape, type CoFeedSchema, type CoListSchema, type CoMapSchema, type CoProfileSchema, type CoRecordSchema, type FileStreamSchema, ImageDefinition, type PlainTextSchema } from "../../internal.js";
2
2
  import { RichTextSchema } from "./schemaTypes/RichTextSchema.js";
3
3
  import { z } from "./zodReExport.js";
4
4
  export declare const coMapDefiner: <Shape extends z.core.$ZodLooseShape>(shape: Shape) => CoMapSchema<Shape>;
5
- export declare const coAccountDefiner: <Shape extends {
6
- profile: AnyCoMapSchema<{
7
- name: z.core.$ZodString<string>;
8
- inbox?: z.core.$ZodOptional<z.core.$ZodString>;
9
- inboxInvite?: z.core.$ZodOptional<z.core.$ZodString>;
10
- }>;
11
- root: AnyCoMapSchema;
12
- }>(shape?: Shape) => AccountSchema<Shape>;
5
+ /**
6
+ * Defines a collaborative account schema for Jazz applications.
7
+ *
8
+ * Creates an account schema that represents a user account with profile and root data.
9
+ * Accounts are the primary way to identify and manage users in Jazz applications.
10
+ *
11
+ * @template Shape - The shape of the account schema extending BaseAccountShape
12
+ * @param shape - The account schema shape. Defaults to a basic profile with name, inbox, and inboxInvite fields, plus an empty root object.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * // Basic account with default profile
17
+ * const BasicAccount = co.account();
18
+ *
19
+ * // Custom account with specific profile and root structure
20
+ * const JazzAccount = co.account({
21
+ * profile: co.profile({
22
+ * name: z.string(),
23
+ * avatar: z.optional(z.string()),
24
+ * }),
25
+ * root: co.map({
26
+ * organizations: co.list(Organization),
27
+ * draftOrganization: DraftOrganization,
28
+ * }),
29
+ * }).withMigration(async (account) => {
30
+ * // Migration logic for existing accounts
31
+ * if (account.profile === undefined) {
32
+ * const group = Group.create();
33
+ * account.profile = co.profile().create(
34
+ * { name: getRandomUsername() },
35
+ * group
36
+ * );
37
+ * group.addMember("everyone", "reader");
38
+ * }
39
+ * });
40
+ * ```
41
+ */
42
+ export declare const coAccountDefiner: <Shape extends BaseAccountShape>(shape?: Shape) => AccountSchema<Shape>;
13
43
  export declare const coRecordDefiner: <K extends z.core.$ZodString<string>, V extends z.core.$ZodType>(_keyType: K, valueType: V) => CoRecordSchema<K, V>;
14
44
  export declare const coListDefiner: <T extends z.core.$ZodType>(element: T) => CoListSchema<T>;
15
45
  export declare const coProfileDefiner: <Shape extends z.core.$ZodLooseShape = {
@@ -1 +1 @@
1
- {"version":3,"file":"zodCo.d.ts","sourceRoot":"","sources":["../../../../src/tools/implementation/zodSchema/zodCo.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,EACb,cAAc,EAEd,YAAY,EACZ,YAAY,EACZ,WAAW,EAEX,eAAe,EACf,cAAc,EAId,gBAAgB,EAChB,eAAe,EACf,eAAe,EAGhB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAC;AAoDrC,eAAO,MAAM,YAAY,GAAI,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,cAAc,SACvD,KAAK,KACX,WAAW,CAAC,KAAK,CAMnB,CAAC;AA8DF,eAAO,MAAM,gBAAgB,GAC3B,KAAK,SAAS;IACZ,OAAO,EAAE,cAAc,CAAC;QACtB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAChC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC/C,WAAW,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KACtD,CAAC,CAAC;IACH,IAAI,EAAE,cAAc,CAAC;CACtB,UAEM,KAAK,KAQX,aAAa,CAAC,KAAK,CAMrB,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EACnC,CAAC,SAAS,CAAC,CAAC,IAAI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CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC/C,WAAW,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;CACtD,KACA,eAAe,CAAC,KAAK,CAQvB,CAAC;AAiCF,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,QAAQ,WAC5C,CAAC,KACT,YAAY,CAAC,CAAC,CAEhB,CAAC;AAgCF,eAAO,MAAM,mBAAmB,QAAO,gBAEtC,CAAC;AA6BF,eAAO,MAAM,kBAAkB,QAAO,eAErC,CAAC;AA0BF,eAAO,MAAM,iBAAiB,QAAO,cAEpC,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,OAAO,eAExC,CAAC"}
package/package.json CHANGED
@@ -139,7 +139,7 @@
139
139
  },
140
140
  "type": "module",
141
141
  "license": "MIT",
142
- "version": "0.15.7",
142
+ "version": "0.15.8",
143
143
  "dependencies": {
144
144
  "@manuscripts/prosemirror-recreate-steps": "^0.1.4",
145
145
  "@scure/base": "1.2.1",
@@ -158,10 +158,10 @@
158
158
  "prosemirror-state": "^1.4.3",
159
159
  "prosemirror-transform": "^1.9.0",
160
160
  "zod": "3.25.28",
161
- "cojson": "0.15.7",
162
- "cojson-storage": "0.15.7",
163
- "cojson-storage-indexeddb": "0.15.7",
164
- "cojson-transport-ws": "0.15.7"
161
+ "cojson": "0.15.8",
162
+ "cojson-storage": "0.15.8",
163
+ "cojson-storage-indexeddb": "0.15.8",
164
+ "cojson-transport-ws": "0.15.8"
165
165
  },
166
166
  "devDependencies": {
167
167
  "@scure/bip39": "^1.3.0",
@@ -102,6 +102,8 @@ export {
102
102
  type InstanceOfSchemaCoValuesNullable,
103
103
  type CoValueOrZodSchema,
104
104
  type Loaded,
105
+ type BaseAccountShape,
106
+ type DefaultAccountShape,
105
107
  type AccountSchema,
106
108
  type AnyAccountSchema,
107
109
  type CoListSchema,
@@ -7,22 +7,24 @@ import { z } from "../zodReExport.js";
7
7
  import { Loaded, ResolveQuery } from "../zodSchema.js";
8
8
  import { AnyCoMapSchema, CoMapSchema } from "./CoMapSchema.js";
9
9
 
10
+ export type BaseProfileShape = {
11
+ name: z.core.$ZodString<string>;
12
+ inbox?: z.core.$ZodOptional<z.core.$ZodString>;
13
+ inboxInvite?: z.core.$ZodOptional<z.core.$ZodString>;
14
+ };
15
+
16
+ export type BaseAccountShape = {
17
+ profile: AnyCoMapSchema<BaseProfileShape>;
18
+ root: AnyCoMapSchema;
19
+ };
20
+
21
+ export type DefaultAccountShape = {
22
+ profile: CoMapSchema<BaseProfileShape>;
23
+ root: CoMapSchema<{}>;
24
+ };
25
+
10
26
  export type AccountSchema<
11
- Shape extends {
12
- profile: AnyCoMapSchema<{
13
- name: z.core.$ZodString<string>;
14
- inbox?: z.core.$ZodOptional<z.core.$ZodString>;
15
- inboxInvite?: z.core.$ZodOptional<z.core.$ZodString>;
16
- }>;
17
- root: AnyCoMapSchema;
18
- } = {
19
- profile: CoMapSchema<{
20
- name: z.core.$ZodString<string>;
21
- inbox?: z.core.$ZodOptional<z.core.$ZodString>;
22
- inboxInvite?: z.core.$ZodOptional<z.core.$ZodString>;
23
- }>;
24
- root: CoMapSchema<{}>;
25
- },
27
+ Shape extends BaseAccountShape = DefaultAccountShape,
26
28
  > = Omit<CoMapSchema<Shape>, "create" | "load" | "withMigration"> & {
27
29
  builtin: "Account";
28
30
 
@@ -1,22 +1,23 @@
1
1
  import {
2
2
  type Account,
3
- AccountCreationProps,
4
- AccountSchema,
5
- AnyCoMapSchema,
3
+ type AccountCreationProps,
4
+ type AccountSchema,
5
+ type AnyCoMapSchema,
6
+ BaseAccountShape,
6
7
  CoFeed,
7
- CoFeedSchema,
8
- CoListSchema,
9
- CoMapSchema,
8
+ type CoFeedSchema,
9
+ type CoListSchema,
10
+ type CoMapSchema,
10
11
  CoPlainText,
11
- CoProfileSchema,
12
- CoRecordSchema,
12
+ type CoProfileSchema,
13
+ type CoRecordSchema,
13
14
  CoRichText,
14
- DefaultProfileShape,
15
+ type DefaultProfileShape,
15
16
  FileStream,
16
- FileStreamSchema,
17
+ type FileStreamSchema,
17
18
  ImageDefinition,
18
- PlainTextSchema,
19
- Simplify,
19
+ type PlainTextSchema,
20
+ type Simplify,
20
21
  zodSchemaToCoSchema,
21
22
  } from "../../internal.js";
22
23
  import { RichTextSchema } from "./schemaTypes/RichTextSchema.js";
@@ -82,16 +83,9 @@ export const coMapDefiner = <Shape extends z.core.$ZodLooseShape>(
82
83
  return enrichCoMapSchema(objectSchema);
83
84
  };
84
85
 
85
- function enrichAccountSchema<
86
- Shape extends {
87
- profile: AnyCoMapSchema<{
88
- name: z.core.$ZodString<string>;
89
- inbox?: z.core.$ZodOptional<z.core.$ZodString>;
90
- inboxInvite?: z.core.$ZodOptional<z.core.$ZodString>;
91
- }>;
92
- root: AnyCoMapSchema;
93
- },
94
- >(schema: z.ZodObject<Shape, z.core.$strip>) {
86
+ function enrichAccountSchema<Shape extends BaseAccountShape>(
87
+ schema: z.ZodObject<Shape, z.core.$strip>,
88
+ ) {
95
89
  const enrichedSchema = Object.assign(schema, {
96
90
  collaborative: true,
97
91
  builtin: "Account",
@@ -142,16 +136,44 @@ function enrichAccountSchema<
142
136
  return enrichedSchema;
143
137
  }
144
138
 
145
- export const coAccountDefiner = <
146
- Shape extends {
147
- profile: AnyCoMapSchema<{
148
- name: z.core.$ZodString<string>;
149
- inbox?: z.core.$ZodOptional<z.core.$ZodString>;
150
- inboxInvite?: z.core.$ZodOptional<z.core.$ZodString>;
151
- }>;
152
- root: AnyCoMapSchema;
153
- },
154
- >(
139
+ /**
140
+ * Defines a collaborative account schema for Jazz applications.
141
+ *
142
+ * Creates an account schema that represents a user account with profile and root data.
143
+ * Accounts are the primary way to identify and manage users in Jazz applications.
144
+ *
145
+ * @template Shape - The shape of the account schema extending BaseAccountShape
146
+ * @param shape - The account schema shape. Defaults to a basic profile with name, inbox, and inboxInvite fields, plus an empty root object.
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * // Basic account with default profile
151
+ * const BasicAccount = co.account();
152
+ *
153
+ * // Custom account with specific profile and root structure
154
+ * const JazzAccount = co.account({
155
+ * profile: co.profile({
156
+ * name: z.string(),
157
+ * avatar: z.optional(z.string()),
158
+ * }),
159
+ * root: co.map({
160
+ * organizations: co.list(Organization),
161
+ * draftOrganization: DraftOrganization,
162
+ * }),
163
+ * }).withMigration(async (account) => {
164
+ * // Migration logic for existing accounts
165
+ * if (account.profile === undefined) {
166
+ * const group = Group.create();
167
+ * account.profile = co.profile().create(
168
+ * { name: getRandomUsername() },
169
+ * group
170
+ * );
171
+ * group.addMember("everyone", "reader");
172
+ * }
173
+ * });
174
+ * ```
175
+ */
176
+ export const coAccountDefiner = <Shape extends BaseAccountShape>(
155
177
  shape: Shape = {
156
178
  profile: coMapDefiner({
157
179
  name: z.string(),