jazz-tools 0.14.8 → 0.14.10
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 +7 -7
- package/CHANGELOG.md +14 -0
- package/dist/{chunk-PA6UHG6Q.js → chunk-YLZ5746T.js} +114 -40
- package/dist/chunk-YLZ5746T.js.map +1 -0
- package/dist/coValues/extensions/imageDef.d.ts +3 -3
- package/dist/coValues/extensions/imageDef.d.ts.map +1 -1
- package/dist/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.d.ts +2 -2
- package/dist/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.d.ts.map +1 -1
- package/dist/implementation/zodSchema/runtimeConverters/zodSchemaToCoSchema.d.ts +1 -1
- package/dist/implementation/zodSchema/runtimeConverters/zodSchemaToCoSchema.d.ts.map +1 -1
- package/dist/implementation/zodSchema/schemaTypes/AccountSchema.d.ts +1 -1
- package/dist/implementation/zodSchema/schemaTypes/AccountSchema.d.ts.map +1 -1
- package/dist/implementation/zodSchema/schemaTypes/CoFeedSchema.d.ts +1 -1
- package/dist/implementation/zodSchema/schemaTypes/CoFeedSchema.d.ts.map +1 -1
- package/dist/implementation/zodSchema/schemaTypes/CoListSchema.d.ts +2 -1
- package/dist/implementation/zodSchema/schemaTypes/CoListSchema.d.ts.map +1 -1
- package/dist/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts +2 -1
- package/dist/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts.map +1 -1
- package/dist/implementation/zodSchema/schemaTypes/CoRecordSchema.d.ts +2 -1
- package/dist/implementation/zodSchema/schemaTypes/CoRecordSchema.d.ts.map +1 -1
- package/dist/implementation/zodSchema/schemaTypes/FileStreamSchema.d.ts +1 -1
- package/dist/implementation/zodSchema/schemaTypes/FileStreamSchema.d.ts.map +1 -1
- package/dist/implementation/zodSchema/schemaTypes/PlainTextSchema.d.ts +1 -1
- package/dist/implementation/zodSchema/schemaTypes/PlainTextSchema.d.ts.map +1 -1
- package/dist/implementation/zodSchema/schemaTypes/RichTextSchema.d.ts +1 -1
- package/dist/implementation/zodSchema/schemaTypes/RichTextSchema.d.ts.map +1 -1
- package/dist/implementation/zodSchema/typeConverters/InstanceOfSchema.d.ts +1 -1
- package/dist/implementation/zodSchema/typeConverters/InstanceOfSchema.d.ts.map +1 -1
- package/dist/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.d.ts +1 -1
- package/dist/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.d.ts.map +1 -1
- package/dist/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchema.d.ts +2 -2
- package/dist/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchema.d.ts.map +1 -1
- package/dist/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchemaCoValuesNullable.d.ts +2 -2
- package/dist/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchemaCoValuesNullable.d.ts.map +1 -1
- package/dist/implementation/zodSchema/unionUtils.d.ts +1 -1
- package/dist/implementation/zodSchema/unionUtils.d.ts.map +1 -1
- package/dist/implementation/zodSchema/zodCo.d.ts +1 -1
- package/dist/implementation/zodSchema/zodCo.d.ts.map +1 -1
- package/dist/implementation/zodSchema/zodReExport.d.ts +1 -1
- package/dist/implementation/zodSchema/zodReExport.d.ts.map +1 -1
- package/dist/implementation/zodSchema/zodSchema.d.ts +1 -1
- package/dist/implementation/zodSchema/zodSchema.d.ts.map +1 -1
- package/dist/index.js +4 -75
- package/dist/index.js.map +1 -1
- package/dist/testing.js +1 -1
- package/package.json +2 -2
- package/src/coValues/extensions/imageDef.ts +3 -8
- package/src/implementation/zodSchema/runtimeConverters/zodFieldToCoFieldDef.ts +21 -5
- package/src/implementation/zodSchema/runtimeConverters/zodSchemaToCoSchema.ts +1 -1
- package/src/implementation/zodSchema/schemaTypes/AccountSchema.ts +1 -1
- package/src/implementation/zodSchema/schemaTypes/CoFeedSchema.ts +1 -1
- package/src/implementation/zodSchema/schemaTypes/CoListSchema.ts +2 -1
- package/src/implementation/zodSchema/schemaTypes/CoMapSchema.ts +2 -1
- package/src/implementation/zodSchema/schemaTypes/CoRecordSchema.ts +2 -1
- package/src/implementation/zodSchema/schemaTypes/FileStreamSchema.ts +1 -1
- package/src/implementation/zodSchema/schemaTypes/PlainTextSchema.ts +1 -1
- package/src/implementation/zodSchema/schemaTypes/RichTextSchema.ts +1 -1
- package/src/implementation/zodSchema/typeConverters/InstanceOfSchema.ts +1 -1
- package/src/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.ts +1 -1
- package/src/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchema.ts +10 -2
- package/src/implementation/zodSchema/typeConverters/InstanceOrPrimitiveOfSchemaCoValuesNullable.ts +10 -2
- package/src/implementation/zodSchema/unionUtils.ts +1 -1
- package/src/implementation/zodSchema/zodCo.ts +4 -1
- package/src/implementation/zodSchema/zodReExport.ts +7 -1
- package/src/implementation/zodSchema/zodSchema.ts +1 -1
- package/src/tests/zod.test.ts +35 -17
- package/dist/chunk-PA6UHG6Q.js.map +0 -1
package/src/tests/zod.test.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
1
|
+
import { describe, expect, it, vi } from "vitest";
|
2
2
|
import { z } from "../exports.js";
|
3
3
|
import { co } from "../internal.js";
|
4
4
|
import { createJazzTestAccount } from "../testing.js";
|
@@ -380,23 +380,41 @@ describe("co.map and Zod schema compatibility", () => {
|
|
380
380
|
expect(map.longString).toBe("this is a long string");
|
381
381
|
});
|
382
382
|
|
383
|
-
|
384
|
-
|
385
|
-
// fish: z.string().default("tuna"),
|
386
|
-
// });
|
387
|
-
// const account = await createJazzTestAccount();
|
388
|
-
// const map = schema.create({}, account);
|
389
|
-
// expect(map.fish).toBe("tuna");
|
390
|
-
// });
|
383
|
+
it("should log a warning on default values", async () => {
|
384
|
+
const consoleSpy = vi.spyOn(console, "warn");
|
391
385
|
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
386
|
+
const schema = co.map({
|
387
|
+
fish: z.string().default("tuna"),
|
388
|
+
});
|
389
|
+
const account = await createJazzTestAccount();
|
390
|
+
const map = schema.create(
|
391
|
+
{
|
392
|
+
fish: "salmon",
|
393
|
+
},
|
394
|
+
account,
|
395
|
+
);
|
396
|
+
expect(map.fish).toBe("salmon");
|
397
|
+
|
398
|
+
expect(consoleSpy).toHaveBeenCalledWith(
|
399
|
+
"z.default()/z.catch() are not supported in collaborative schemas. They will be ignored.",
|
400
|
+
);
|
401
|
+
consoleSpy.mockRestore();
|
402
|
+
});
|
403
|
+
|
404
|
+
it("should log a warning on catch values", async () => {
|
405
|
+
const consoleSpy = vi.spyOn(console, "warn");
|
406
|
+
const schema = co.map({
|
407
|
+
number: z.number().catch(42),
|
408
|
+
});
|
409
|
+
const account = await createJazzTestAccount();
|
410
|
+
const map = schema.create({ number: 18 }, account);
|
411
|
+
expect(map.number).toBe(18);
|
412
|
+
|
413
|
+
expect(consoleSpy).toHaveBeenCalledWith(
|
414
|
+
"z.default()/z.catch() are not supported in collaborative schemas. They will be ignored.",
|
415
|
+
);
|
416
|
+
consoleSpy.mockRestore();
|
417
|
+
});
|
400
418
|
|
401
419
|
it("should handle branded types", async () => {
|
402
420
|
const schema = co.map({
|