zod-prisma-schemas 0.0.2 → 0.0.3

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.
@@ -1,3 +1,3 @@
1
1
  import { ExtendedWriteFieldOptions } from '../../types';
2
- export declare const writeDecimal: ({ writer, field, model, writeOptionalDefaults, }: ExtendedWriteFieldOptions) => void;
2
+ export declare const writeDecimal: ({ writer, field, writeOptionalDefaults, }: ExtendedWriteFieldOptions) => void;
3
3
  //# sourceMappingURL=writeModelDecimal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"writeModelDecimal.d.ts","sourceRoot":"","sources":["../../../src/functions/fieldWriters/writeModelDecimal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGxD,eAAO,MAAM,YAAY,GAAI,kDAK1B,yBAAyB,SAqC3B,CAAC"}
1
+ {"version":3,"file":"writeModelDecimal.d.ts","sourceRoot":"","sources":["../../../src/functions/fieldWriters/writeModelDecimal.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAExD,eAAO,MAAM,YAAY,GAAI,2CAI1B,yBAAyB,SAO3B,CAAC"}
@@ -2,17 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeDecimal = void 0;
4
4
  const _1 = require(".");
5
- const config_1 = require("../../config");
6
- const writeDecimal = ({ writer, field, model, writeOptionalDefaults = false, }) => {
7
- const { isPrismaClientGenerator } = (0, config_1.getConfig)();
8
- const decimalTypeName = isPrismaClientGenerator
9
- ? 'PrismaDecimal'
10
- : 'Prisma.Decimal';
5
+ const writeDecimal = ({ writer, field, writeOptionalDefaults = false, }) => {
11
6
  writer
12
7
  .conditionalWrite(field.omitInModel(), '// omitted: ')
13
8
  .write(`${field.formattedNames.original}: `)
14
- .write(`z.instanceof(${decimalTypeName}, { message: "Field '${field.formattedNames.original}' must be a Decimal. Location: ['Models', '${model.formattedNames.original}']"`)
15
- .write(`})`);
9
+ .write(`DecimalJsLikeSchema,`);
16
10
  (0, _1.writeFieldAdditions)({ writer, field, writeOptionalDefaults });
17
11
  };
18
12
  exports.writeDecimal = writeDecimal;
@@ -1 +1 @@
1
- {"version":3,"file":"writeModelDecimal.js","sourceRoot":"","sources":["../../../src/functions/fieldWriters/writeModelDecimal.ts"],"names":[],"mappings":";;;AACA,wBAAwC;AAExC,yCAAyC;AAElC,MAAM,YAAY,GAAG,CAAC,EAC3B,MAAM,EACN,KAAK,EACL,KAAK,EACL,qBAAqB,GAAG,KAAK,GACH,EAAE,EAAE;IAC9B,MAAM,EAAE,uBAAuB,EAAE,GAAG,IAAA,kBAAS,GAAE,CAAC;IAEhD,MAAM,eAAe,GAAG,uBAAuB;QAC7C,CAAC,CAAC,eAAe;QACjB,CAAC,CAAC,gBAAgB,CAAC;IAErB,MAAM;SACH,gBAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,cAAc,CAAC;SACrD,KAAK,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,IAAI,CAAC;SAC3C,KAAK,CACJ,gBAAgB,eAAe,wBAAwB,KAAK,CAAC,cAAc,CAAC,QAAQ,8CAA8C,KAAK,CAAC,cAAc,CAAC,QAAQ,KAAK,CACrK;SAOA,KAAK,CAAC,IAAI,CAAC,CAAC;IAiBf,IAAA,sBAAmB,EAAC,EAAE,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC,CAAC;AAChE,CAAC,CAAC;AA1CW,QAAA,YAAY,gBA0CvB"}
1
+ {"version":3,"file":"writeModelDecimal.js","sourceRoot":"","sources":["../../../src/functions/fieldWriters/writeModelDecimal.ts"],"names":[],"mappings":";;;AAAA,wBAAwC;AAGjC,MAAM,YAAY,GAAG,CAAC,EAC3B,MAAM,EACN,KAAK,EACL,qBAAqB,GAAG,KAAK,GACH,EAAE,EAAE;IAC9B,MAAM;SACH,gBAAgB,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,cAAc,CAAC;SACrD,KAAK,CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,IAAI,CAAC;SAC3C,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAEjC,IAAA,sBAAmB,EAAC,EAAE,MAAM,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC,CAAC;AAChE,CAAC,CAAC;AAXW,QAAA,YAAY,gBAWvB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod-prisma-schemas",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Generates zod schemas from Prisma models with advanced validation (Fork of zod-prisma-types)",
5
5
  "author": "Mario Campa",
6
6
  "license": "MIT",