@es-joy/jsoe 0.19.0 → 0.20.0
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/CHANGES.md +8 -0
- package/dist/formats/schema.d.ts +6 -0
- package/dist/formats/schema.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/package.json +1 -1
- package/src/formats/schema.js +4 -2
- package/src/index.js +4 -0
package/CHANGES.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# CHANGES TO `@es-joy/jsoe`
|
|
2
2
|
|
|
3
|
+
## 0.20.0
|
|
4
|
+
|
|
5
|
+
- feat: make `getTypesForSchema` public
|
|
6
|
+
|
|
7
|
+
## 0.19.1
|
|
8
|
+
|
|
9
|
+
- fix: ensure `originalShape` passed to `dezerialize()` (`$ref`'s require)
|
|
10
|
+
|
|
3
11
|
## 0.19.0
|
|
4
12
|
|
|
5
13
|
- feat: change API for `$setFormat` to accept `schema` and change API to object with
|
package/dist/formats/schema.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {ZodexSchema} schemaObject
|
|
3
|
+
* @param {ZodexSchema} originalJSON
|
|
4
|
+
* @returns {Set<ZodexSchema>}
|
|
5
|
+
*/
|
|
6
|
+
export function getTypesForSchema(schemaObject: ZodexSchema, originalJSON: ZodexSchema): Set<ZodexSchema>;
|
|
1
7
|
export default schema;
|
|
2
8
|
export type ZodexSchema = import("zodex").SzType;
|
|
3
9
|
export type NestedObject = import("../utils/objects.js").NestedObject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/formats/schema.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/formats/schema.js"],"names":[],"mappings":"AAmMA;;;;GAIG;AACH,gDAJW,WAAW,gBACX,WAAW,GACT,GAAG,CAAC,WAAW,CAAC,CAgX5B;;0BA3fY,OAAO,OAAO,EAAE,MAAM;2BAGtB,OAAO,qBAAqB,EAAE,YAAY;;;;oBAnD1C,CAAC,IADD,CAAC,CAAC,MAAM,CAAC,CAAC;iCAMV,OAAO,CAChB,IAAI,CAAC,OAAO,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CACrC;AAsiBH,6CAA6C;AAC7C,sBADW,OAAO,eAAe,EAAE,MAAM,CA2MvC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as Types } from "./types.js";
|
|
2
2
|
export { default as Formats } from "./formats.js";
|
|
3
3
|
export { buildTypeChoices as typeChoices } from "./typeChoices.js";
|
|
4
|
+
export { getTypesForSchema } from "./formats/schema.js";
|
|
4
5
|
export type TypeRootGetter = import("./formatAndTypeChoices.js").TypeRootGetter;
|
|
5
6
|
export type SetType = (cfg: {
|
|
6
7
|
type: string;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";;;;6BACa,OAAO,2BAA2B,EAAE,cAAc;sBAGlD,CAAC,GAAG,EAAE;IACnB,IAAQ,EAAE,MAAM,CAAC;IACjB,SAAa,CAAC,EAAE,OAAO,cAAc,EAAE,oBAAoB,CAAC;IAC5D,cAAkB,CAAC,EAAE,OAAO,CAAA;CACzB,KAAK,IAAI"}
|
package/dist/index.js
CHANGED
|
@@ -9151,7 +9151,9 @@ const schema = {
|
|
|
9151
9151
|
// however, if the tested object has extra non-standard properties
|
|
9152
9152
|
schema.unknownKeys = 'strict';
|
|
9153
9153
|
}
|
|
9154
|
-
const dezSchema = dezerialize(schema
|
|
9154
|
+
const dezSchema = dezerialize(schema, {
|
|
9155
|
+
originalShape: stateObj.schemaContent
|
|
9156
|
+
});
|
|
9155
9157
|
const parsed = dezSchema.safeParse(v);
|
|
9156
9158
|
|
|
9157
9159
|
if (schema.type === 'object') {
|
|
@@ -22036,4 +22038,4 @@ async function formatAndTypeChoices ({
|
|
|
22036
22038
|
};
|
|
22037
22039
|
}
|
|
22038
22040
|
|
|
22039
|
-
export { Formats, Types, formatAndTypeChoices, getFormatAndSchemaChoices, buildTypeChoices as typeChoices };
|
|
22041
|
+
export { Formats, Types, formatAndTypeChoices, getFormatAndSchemaChoices, getTypesForSchema, buildTypeChoices as typeChoices };
|
package/package.json
CHANGED
package/src/formats/schema.js
CHANGED
|
@@ -198,7 +198,7 @@ function addModifiers (schemaObject, set) {
|
|
|
198
198
|
* @param {ZodexSchema} originalJSON
|
|
199
199
|
* @returns {Set<ZodexSchema>}
|
|
200
200
|
*/
|
|
201
|
-
function getTypesForSchema (schemaObject, originalJSON) {
|
|
201
|
+
export function getTypesForSchema (schemaObject, originalJSON) {
|
|
202
202
|
switch (schemaObject.type) {
|
|
203
203
|
case 'never':
|
|
204
204
|
return new Set();
|
|
@@ -667,7 +667,9 @@ const schema = {
|
|
|
667
667
|
// however, if the tested object has extra non-standard properties
|
|
668
668
|
schema.unknownKeys = 'strict';
|
|
669
669
|
}
|
|
670
|
-
const dezSchema = dezerialize(schema
|
|
670
|
+
const dezSchema = dezerialize(schema, {
|
|
671
|
+
originalShape: stateObj.schemaContent
|
|
672
|
+
});
|
|
671
673
|
const parsed = dezSchema.safeParse(v);
|
|
672
674
|
|
|
673
675
|
if (schema.type === 'object') {
|