@es-joy/jsoe 0.19.1 → 0.20.1
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 +10 -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 +6 -4
- package/dist/typeChoices.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/formats/schema.js +2 -2
- package/src/formats/structuredCloning.js +1 -1
- package/src/index.js +4 -0
- package/src/typeChoices.js +3 -1
package/CHANGES.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# CHANGES TO `@es-joy/jsoe`
|
|
2
2
|
|
|
3
|
+
## 0.20.1
|
|
4
|
+
|
|
5
|
+
- fix: allow detection of matching schema which are copies and not references
|
|
6
|
+
- fix: should pass original schema to editUI for `schemaContent`
|
|
7
|
+
- fix: refer to original JSON
|
|
8
|
+
|
|
9
|
+
## 0.20.0
|
|
10
|
+
|
|
11
|
+
- feat: make `getTypesForSchema` public
|
|
12
|
+
|
|
3
13
|
## 0.19.1
|
|
4
14
|
|
|
5
15
|
- fix: ensure `originalShape` passed to `dezerialize()` (`$ref`'s require)
|
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
|
@@ -2796,7 +2796,9 @@ const buildTypeChoices = ({
|
|
|
2796
2796
|
*/
|
|
2797
2797
|
$setTypeNoEditUI ({type, specificSchema}) {
|
|
2798
2798
|
if (schemaObjs && specificSchema) {
|
|
2799
|
-
const idx = schemaObjs.
|
|
2799
|
+
const idx = schemaObjs.map((obj) => {
|
|
2800
|
+
return JSON.stringify(obj);
|
|
2801
|
+
}).indexOf(JSON.stringify(specificSchema));
|
|
2800
2802
|
this.selectedIndex = idx + 1;
|
|
2801
2803
|
} else {
|
|
2802
2804
|
this.value = type;
|
|
@@ -3377,7 +3379,7 @@ const encapsulateObserver = (stateObj) => {
|
|
|
3377
3379
|
buildTypeChoices,
|
|
3378
3380
|
format,
|
|
3379
3381
|
specificSchemaObject: schema,
|
|
3380
|
-
schemaContent
|
|
3382
|
+
schemaContent,
|
|
3381
3383
|
value: newValue,
|
|
3382
3384
|
hasValue: true,
|
|
3383
3385
|
// Not currently in use but may be convenient for a
|
|
@@ -9135,7 +9137,7 @@ const schema = {
|
|
|
9135
9137
|
}
|
|
9136
9138
|
const schemaObjects = [...getTypesForSchema(
|
|
9137
9139
|
/** @type {import('zodex').SzType} */ (currentSchema),
|
|
9138
|
-
/** @type {import('zodex').SzType} */ (
|
|
9140
|
+
/** @type {import('zodex').SzType} */ (stateObj.schemaContent)
|
|
9139
9141
|
)];
|
|
9140
9142
|
// console.log(
|
|
9141
9143
|
// 'vvv', v, currentSchema,
|
|
@@ -22038,4 +22040,4 @@ async function formatAndTypeChoices ({
|
|
|
22038
22040
|
};
|
|
22039
22041
|
}
|
|
22040
22042
|
|
|
22041
|
-
export { Formats, Types, formatAndTypeChoices, getFormatAndSchemaChoices, buildTypeChoices as typeChoices };
|
|
22043
|
+
export { Formats, Types, formatAndTypeChoices, getFormatAndSchemaChoices, getTypesForSchema, buildTypeChoices as typeChoices };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeChoices.d.ts","sourceRoot":"","sources":["../src/typeChoices.js"],"names":[],"mappings":"AASA;;;;;;;GAOG;AAEH;;;;;;GAMG;AAEH;;;;;;;GAO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} 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();
|
|
@@ -651,7 +651,7 @@ const schema = {
|
|
|
651
651
|
}
|
|
652
652
|
const schemaObjects = [...getTypesForSchema(
|
|
653
653
|
/** @type {import('zodex').SzType} */ (currentSchema),
|
|
654
|
-
/** @type {import('zodex').SzType} */ (
|
|
654
|
+
/** @type {import('zodex').SzType} */ (stateObj.schemaContent)
|
|
655
655
|
)];
|
|
656
656
|
// console.log(
|
|
657
657
|
// 'vvv', v, currentSchema,
|
|
@@ -214,7 +214,7 @@ const encapsulateObserver = (stateObj) => {
|
|
|
214
214
|
buildTypeChoices,
|
|
215
215
|
format,
|
|
216
216
|
specificSchemaObject: schema,
|
|
217
|
-
schemaContent
|
|
217
|
+
schemaContent,
|
|
218
218
|
value: newValue,
|
|
219
219
|
hasValue: true,
|
|
220
220
|
// Not currently in use but may be convenient for a
|
package/src/index.js
CHANGED
package/src/typeChoices.js
CHANGED
|
@@ -174,7 +174,9 @@ export const buildTypeChoices = ({
|
|
|
174
174
|
*/
|
|
175
175
|
$setTypeNoEditUI ({type, specificSchema}) {
|
|
176
176
|
if (schemaObjs && specificSchema) {
|
|
177
|
-
const idx = schemaObjs.
|
|
177
|
+
const idx = schemaObjs.map((obj) => {
|
|
178
|
+
return JSON.stringify(obj);
|
|
179
|
+
}).indexOf(JSON.stringify(specificSchema));
|
|
178
180
|
this.selectedIndex = idx + 1;
|
|
179
181
|
} else {
|
|
180
182
|
this.value = type;
|