jazz-tools 0.14.2 → 0.14.5

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.
Files changed (43) hide show
  1. package/.turbo/turbo-build.log +6 -6
  2. package/CHANGELOG.md +13 -0
  3. package/dist/{chunk-WLOZKDOH.js → chunk-52PJ4QZ3.js} +29 -17
  4. package/dist/chunk-52PJ4QZ3.js.map +1 -0
  5. package/dist/coValues/extensions/imageDef.d.ts +2 -1
  6. package/dist/coValues/extensions/imageDef.d.ts.map +1 -1
  7. package/dist/implementation/zodSchema/coExport.d.ts +3 -0
  8. package/dist/implementation/zodSchema/coExport.d.ts.map +1 -0
  9. package/dist/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.d.ts.map +1 -1
  10. package/dist/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts +11 -3
  11. package/dist/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts.map +1 -1
  12. package/dist/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchema.d.ts +1 -1
  13. package/dist/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchema.d.ts.map +1 -1
  14. package/dist/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchemaCoValuesNullable.d.ts +1 -1
  15. package/dist/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchemaCoValuesNullable.d.ts.map +1 -1
  16. package/dist/implementation/zodSchema/zodCo.d.ts +21 -27
  17. package/dist/implementation/zodSchema/zodCo.d.ts.map +1 -1
  18. package/dist/implementation/zodSchema/zodSchema.d.ts +1 -4
  19. package/dist/implementation/zodSchema/zodSchema.d.ts.map +1 -1
  20. package/dist/index.js +3 -3
  21. package/dist/internal.d.ts +1 -0
  22. package/dist/internal.d.ts.map +1 -1
  23. package/dist/testing.js +1 -1
  24. package/dist/tests/coMap.record.test-d.d.ts +2 -0
  25. package/dist/tests/coMap.record.test-d.d.ts.map +1 -0
  26. package/dist/tests/coMap.test-d.d.ts +2 -0
  27. package/dist/tests/coMap.test-d.d.ts.map +1 -0
  28. package/package.json +1 -1
  29. package/src/coValues/extensions/imageDef.ts +7 -1
  30. package/src/implementation/zodSchema/coExport.ts +13 -0
  31. package/src/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.ts +3 -0
  32. package/src/implementation/zodSchema/schemaTypes/CoMapSchema.ts +20 -8
  33. package/src/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchema.ts +3 -1
  34. package/src/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchemaCoValuesNullable.ts +3 -1
  35. package/src/implementation/zodSchema/zodCo.ts +9 -20
  36. package/src/implementation/zodSchema/zodSchema.ts +0 -5
  37. package/src/internal.ts +1 -0
  38. package/src/tests/coList.test.ts +9 -0
  39. package/src/tests/coMap.record.test-d.ts +149 -0
  40. package/src/tests/coMap.record.test.ts +11 -0
  41. package/src/tests/coMap.test-d.ts +421 -0
  42. package/src/tests/coMap.test.ts +8 -0
  43. package/dist/chunk-WLOZKDOH.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
 
2
- > jazz-tools@0.14.2 build /home/runner/_work/jazz/jazz/packages/jazz-tools
2
+ > jazz-tools@0.14.5 build /home/runner/_work/jazz/jazz/packages/jazz-tools
3
3
  > tsup && pnpm types
4
4
 
5
5
  CLI Building entry: {"index":"src/index.ts","testing":"src/testing.ts"}
@@ -9,14 +9,14 @@
9
9
  CLI Target: es2021
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
- ESM dist/index.js 11.03 KB
12
+ ESM dist/index.js 11.07 KB
13
13
  ESM dist/testing.js 6.31 KB
14
- ESM dist/chunk-WLOZKDOH.js 130.46 KB
14
+ ESM dist/chunk-52PJ4QZ3.js 130.91 KB
15
15
  ESM dist/index.js.map 20.74 KB
16
16
  ESM dist/testing.js.map 12.57 KB
17
- ESM dist/chunk-WLOZKDOH.js.map 304.21 KB
18
- ESM ⚡️ Build success in 104ms
17
+ ESM dist/chunk-52PJ4QZ3.js.map 304.39 KB
18
+ ESM ⚡️ Build success in 51ms
19
19
 
20
- > jazz-tools@0.14.2 types /home/runner/_work/jazz/jazz/packages/jazz-tools
20
+ > jazz-tools@0.14.5 types /home/runner/_work/jazz/jazz/packages/jazz-tools
21
21
  > tsc --outDir dist
22
22
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # jazz-tools
2
2
 
3
+ ## 0.14.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 91cbb2f: Fix CoMap.create with optional types
8
+ - 20b3d88: Add co.loaded utility
9
+
10
+ ## 0.14.4
11
+
12
+ ### Patch Changes
13
+
14
+ - 011af55: Support z.enum in the schema definitions
15
+
3
16
  ## 0.14.2
4
17
 
5
18
  ### Patch Changes
@@ -1,3 +1,9 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
1
7
  // src/coValues/CoValueBase.ts
2
8
  import { ControlledAccount, RawAccount } from "cojson";
3
9
  var CoValueBase = class {
@@ -3391,12 +3397,12 @@ var coMapDefiner = (shape) => {
3391
3397
  return coMapSchema;
3392
3398
  };
3393
3399
  var coAccountDefiner = (shape = {
3394
- profile: co.map({
3400
+ profile: coMapDefiner({
3395
3401
  name: z.string(),
3396
3402
  inbox: z.optional(z.string()),
3397
3403
  inboxInvite: z.optional(z.string())
3398
3404
  }),
3399
- root: co.map({})
3405
+ root: coMapDefiner({})
3400
3406
  }) => {
3401
3407
  const objectSchema = z.object(shape).meta({
3402
3408
  collaborative: true
@@ -3530,21 +3536,25 @@ var coRichTextDefiner = () => {
3530
3536
  };
3531
3537
  return richTextSchema;
3532
3538
  };
3533
- var co = {
3534
- map: coMapDefiner,
3535
- record: coRecordDefiner,
3536
- list: coListDefiner,
3537
- feed: coFeedDefiner,
3538
- plainText: coPlainTextDefiner,
3539
- richText: coRichTextDefiner,
3540
- fileStream: coFileStreamDefiner,
3541
- image: () => {
3542
- return ImageDefinition;
3543
- },
3544
- account: coAccountDefiner,
3545
- profile: coProfileDefiner
3539
+ var coImageDefiner = () => {
3540
+ return ImageDefinition;
3546
3541
  };
3547
3542
 
3543
+ // src/implementation/zodSchema/coExport.ts
3544
+ var coExport_exports = {};
3545
+ __export(coExport_exports, {
3546
+ account: () => coAccountDefiner,
3547
+ feed: () => coFeedDefiner,
3548
+ fileStream: () => coFileStreamDefiner,
3549
+ image: () => coImageDefiner,
3550
+ list: () => coListDefiner,
3551
+ map: () => coMapDefiner,
3552
+ plainText: () => coPlainTextDefiner,
3553
+ profile: () => coProfileDefiner,
3554
+ record: () => coRecordDefiner,
3555
+ richText: () => coRichTextDefiner
3556
+ });
3557
+
3548
3558
  // src/implementation/zodSchema/runtimeConverters/zodSchemaToCoSchema.ts
3549
3559
  import z3 from "zod/v4";
3550
3560
 
@@ -3682,6 +3692,8 @@ function zodFieldToCoFieldDef(schema) {
3682
3692
  return coField.boolean;
3683
3693
  } else if (schema._zod.def.type === "null") {
3684
3694
  return coField.null;
3695
+ } else if (schema._zod.def.type === "enum") {
3696
+ return coField.string;
3685
3697
  } else if (schema._zod.def.type === "date") {
3686
3698
  return coField.Date;
3687
3699
  } else if (schema._zod.def.type === "literal") {
@@ -4526,7 +4538,7 @@ export {
4526
4538
  createJazzContextForNewAccount,
4527
4539
  createJazzContext,
4528
4540
  createAnonymousJazzContext,
4529
- co,
4541
+ coExport_exports,
4530
4542
  zodSchemaToCoSchema2 as zodSchemaToCoSchema,
4531
4543
  anySchemaToCoSchema,
4532
4544
  ImageDefinition,
@@ -4536,4 +4548,4 @@ export {
4536
4548
  JazzContextManager
4537
4549
  };
4538
4550
  /* istanbul ignore file -- @preserve */
4539
- //# sourceMappingURL=chunk-WLOZKDOH.js.map
4551
+ //# sourceMappingURL=chunk-52PJ4QZ3.js.map