@standard-community/standard-json 0.3.1 → 0.3.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.
- package/dist/index.cjs +5 -10
- package/dist/index.js +5 -10
- package/dist/utils-8OktpmW4.js +13 -0
- package/dist/utils-CeR2367j.cjs +17 -0
- package/dist/vendors/arktype.cjs +1 -1
- package/dist/vendors/arktype.d.cts +1 -1
- package/dist/vendors/arktype.d.ts +1 -1
- package/dist/vendors/arktype.js +1 -1
- package/dist/vendors/effect.cjs +2 -2
- package/dist/vendors/effect.js +2 -2
- package/dist/vendors/valibot.cjs +2 -4
- package/dist/vendors/valibot.js +2 -4
- package/dist/vendors/zod.cjs +8 -11
- package/dist/vendors/zod.js +8 -11
- package/package.json +1 -1
- package/dist/utils-BOYKSG8-.js +0 -4
- package/dist/utils-D7AosoZA.cjs +0 -7
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var quansync = require('quansync');
|
|
4
|
-
var utils = require('./utils-
|
|
4
|
+
var utils = require('./utils-CeR2367j.cjs');
|
|
5
5
|
|
|
6
6
|
function _interopNamespaceDefaultOnly (e) { return Object.freeze({ __proto__: null, default: e }); }
|
|
7
7
|
|
|
@@ -25,9 +25,7 @@ const getToJsonSchemaFn = async (vendor) => {
|
|
|
25
25
|
vendorFnPromise = (await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespaceDefaultOnly(require('./vendors/zod.cjs')); })).default();
|
|
26
26
|
break;
|
|
27
27
|
default:
|
|
28
|
-
throw new
|
|
29
|
-
utils.errorMessageWrapper(`Unsupported schema vendor "${vendor}".`)
|
|
30
|
-
);
|
|
28
|
+
throw new utils.UnsupportedVendorError(vendor);
|
|
31
29
|
}
|
|
32
30
|
const vendorFn = await vendorFnPromise;
|
|
33
31
|
utils.validationMapper.set(vendor, vendorFn);
|
|
@@ -36,13 +34,10 @@ const getToJsonSchemaFn = async (vendor) => {
|
|
|
36
34
|
|
|
37
35
|
const toJsonSchema = quansync.quansync({
|
|
38
36
|
sync: (schema, options) => {
|
|
39
|
-
const
|
|
37
|
+
const vendor = schema["~standard"].vendor;
|
|
38
|
+
const fn = utils.validationMapper.get(vendor);
|
|
40
39
|
if (!fn) {
|
|
41
|
-
throw new
|
|
42
|
-
utils.errorMessageWrapper(
|
|
43
|
-
`Unsupported schema vendor "${schema["~standard"].vendor}".`
|
|
44
|
-
)
|
|
45
|
-
);
|
|
40
|
+
throw new utils.UnsupportedVendorError(vendor);
|
|
46
41
|
}
|
|
47
42
|
return fn(schema, options);
|
|
48
43
|
},
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { quansync } from 'quansync';
|
|
2
|
-
import { v as validationMapper,
|
|
2
|
+
import { v as validationMapper, U as UnsupportedVendorError } from './utils-8OktpmW4.js';
|
|
3
3
|
|
|
4
4
|
const getToJsonSchemaFn = async (vendor) => {
|
|
5
5
|
const cached = validationMapper.get(vendor);
|
|
@@ -21,9 +21,7 @@ const getToJsonSchemaFn = async (vendor) => {
|
|
|
21
21
|
vendorFnPromise = (await import('./vendors/zod.js')).default();
|
|
22
22
|
break;
|
|
23
23
|
default:
|
|
24
|
-
throw new
|
|
25
|
-
errorMessageWrapper(`Unsupported schema vendor "${vendor}".`)
|
|
26
|
-
);
|
|
24
|
+
throw new UnsupportedVendorError(vendor);
|
|
27
25
|
}
|
|
28
26
|
const vendorFn = await vendorFnPromise;
|
|
29
27
|
validationMapper.set(vendor, vendorFn);
|
|
@@ -32,13 +30,10 @@ const getToJsonSchemaFn = async (vendor) => {
|
|
|
32
30
|
|
|
33
31
|
const toJsonSchema = quansync({
|
|
34
32
|
sync: (schema, options) => {
|
|
35
|
-
const
|
|
33
|
+
const vendor = schema["~standard"].vendor;
|
|
34
|
+
const fn = validationMapper.get(vendor);
|
|
36
35
|
if (!fn) {
|
|
37
|
-
throw new
|
|
38
|
-
errorMessageWrapper(
|
|
39
|
-
`Unsupported schema vendor "${schema["~standard"].vendor}".`
|
|
40
|
-
)
|
|
41
|
-
);
|
|
36
|
+
throw new UnsupportedVendorError(vendor);
|
|
42
37
|
}
|
|
43
38
|
return fn(schema, options);
|
|
44
39
|
},
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const validationMapper = /* @__PURE__ */ new Map();
|
|
2
|
+
class UnsupportedVendorError extends Error {
|
|
3
|
+
constructor(vendor) {
|
|
4
|
+
super(`standard-json: Unsupported schema vendor "${vendor}".`);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
class MissingDependencyError extends Error {
|
|
8
|
+
constructor(packageName) {
|
|
9
|
+
super(`standard-json: Missing dependencies "${packageName}".`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { MissingDependencyError as M, UnsupportedVendorError as U, validationMapper as v };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const validationMapper = /* @__PURE__ */ new Map();
|
|
4
|
+
class UnsupportedVendorError extends Error {
|
|
5
|
+
constructor(vendor) {
|
|
6
|
+
super(`standard-json: Unsupported schema vendor "${vendor}".`);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
class MissingDependencyError extends Error {
|
|
10
|
+
constructor(packageName) {
|
|
11
|
+
super(`standard-json: Missing dependencies "${packageName}".`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
exports.MissingDependencyError = MissingDependencyError;
|
|
16
|
+
exports.UnsupportedVendorError = UnsupportedVendorError;
|
|
17
|
+
exports.validationMapper = validationMapper;
|
package/dist/vendors/arktype.cjs
CHANGED
package/dist/vendors/arktype.js
CHANGED
package/dist/vendors/effect.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var utils = require('../utils-
|
|
3
|
+
var utils = require('../utils-CeR2367j.cjs');
|
|
4
4
|
|
|
5
5
|
async function getToJsonSchemaFn() {
|
|
6
6
|
try {
|
|
7
7
|
const { JSONSchema } = await import('effect');
|
|
8
8
|
return (schema) => JSONSchema.make(schema);
|
|
9
9
|
} catch {
|
|
10
|
-
throw new
|
|
10
|
+
throw new utils.MissingDependencyError("effect");
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
package/dist/vendors/effect.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { M as MissingDependencyError } from '../utils-8OktpmW4.js';
|
|
2
2
|
|
|
3
3
|
async function getToJsonSchemaFn() {
|
|
4
4
|
try {
|
|
5
5
|
const { JSONSchema } = await import('effect');
|
|
6
6
|
return (schema) => JSONSchema.make(schema);
|
|
7
7
|
} catch {
|
|
8
|
-
throw new
|
|
8
|
+
throw new MissingDependencyError("effect");
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
package/dist/vendors/valibot.cjs
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var utils = require('../utils-
|
|
3
|
+
var utils = require('../utils-CeR2367j.cjs');
|
|
4
4
|
|
|
5
5
|
async function getToJsonSchemaFn() {
|
|
6
6
|
try {
|
|
7
7
|
const { toJsonSchema } = await import('@valibot/to-json-schema');
|
|
8
8
|
return toJsonSchema;
|
|
9
9
|
} catch {
|
|
10
|
-
throw new
|
|
11
|
-
utils.errorMessageWrapper('Missing dependencies "@valibot/to-json-schema".')
|
|
12
|
-
);
|
|
10
|
+
throw new utils.MissingDependencyError("@valibot/to-json-schema");
|
|
13
11
|
}
|
|
14
12
|
}
|
|
15
13
|
|
package/dist/vendors/valibot.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { M as MissingDependencyError } from '../utils-8OktpmW4.js';
|
|
2
2
|
|
|
3
3
|
async function getToJsonSchemaFn() {
|
|
4
4
|
try {
|
|
5
5
|
const { toJsonSchema } = await import('@valibot/to-json-schema');
|
|
6
6
|
return toJsonSchema;
|
|
7
7
|
} catch {
|
|
8
|
-
throw new
|
|
9
|
-
errorMessageWrapper('Missing dependencies "@valibot/to-json-schema".')
|
|
10
|
-
);
|
|
8
|
+
throw new MissingDependencyError("@valibot/to-json-schema");
|
|
11
9
|
}
|
|
12
10
|
}
|
|
13
11
|
|
package/dist/vendors/zod.cjs
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var utils = require('../utils-
|
|
3
|
+
var utils = require('../utils-CeR2367j.cjs');
|
|
4
4
|
|
|
5
|
+
const zodv4Error = new utils.MissingDependencyError("zod v4");
|
|
5
6
|
async function getToJsonSchemaFn() {
|
|
6
7
|
return async (schema, options) => {
|
|
7
8
|
let handler;
|
|
8
9
|
if ("_zod" in schema) {
|
|
9
10
|
try {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
);
|
|
11
|
+
const mod = await import('zod/v4/core');
|
|
12
|
+
handler = mod.toJSONSchema;
|
|
13
13
|
} catch {
|
|
14
|
-
throw
|
|
14
|
+
throw zodv4Error;
|
|
15
15
|
}
|
|
16
16
|
} else {
|
|
17
17
|
try {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
);
|
|
18
|
+
const mod = await import('zod-to-json-schema');
|
|
19
|
+
handler = mod.zodToJsonSchema;
|
|
21
20
|
} catch {
|
|
22
|
-
throw new
|
|
23
|
-
utils.errorMessageWrapper('Missing dependencies "zod-to-json-schema".')
|
|
24
|
-
);
|
|
21
|
+
throw new utils.MissingDependencyError("zod-to-json-schema");
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
24
|
return handler(schema, options);
|
package/dist/vendors/zod.js
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { M as MissingDependencyError } from '../utils-8OktpmW4.js';
|
|
2
2
|
|
|
3
|
+
const zodv4Error = new MissingDependencyError("zod v4");
|
|
3
4
|
async function getToJsonSchemaFn() {
|
|
4
5
|
return async (schema, options) => {
|
|
5
6
|
let handler;
|
|
6
7
|
if ("_zod" in schema) {
|
|
7
8
|
try {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
);
|
|
9
|
+
const mod = await import('zod/v4/core');
|
|
10
|
+
handler = mod.toJSONSchema;
|
|
11
11
|
} catch {
|
|
12
|
-
throw
|
|
12
|
+
throw zodv4Error;
|
|
13
13
|
}
|
|
14
14
|
} else {
|
|
15
15
|
try {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
);
|
|
16
|
+
const mod = await import('zod-to-json-schema');
|
|
17
|
+
handler = mod.zodToJsonSchema;
|
|
19
18
|
} catch {
|
|
20
|
-
throw new
|
|
21
|
-
errorMessageWrapper('Missing dependencies "zod-to-json-schema".')
|
|
22
|
-
);
|
|
19
|
+
throw new MissingDependencyError("zod-to-json-schema");
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
22
|
return handler(schema, options);
|
package/package.json
CHANGED
package/dist/utils-BOYKSG8-.js
DELETED
package/dist/utils-D7AosoZA.cjs
DELETED