@power-plant/schema 0.0.18 → 0.0.19

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/codegen.cjs CHANGED
@@ -1,5 +1,5 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-CrePPGkD.cjs");let t=require("@stryke/string-format/list"),n=require("@stryke/type-checks"),r=require("@stryke/type-checks/is-set-string"),i=require("@stryke/convert/to-bool"),a=require("@stryke/string-format/camel-case"),o=require("@stryke/type-checks/is-boolean"),s=require("@stryke/type-checks/is-null"),c=require("@stryke/type-checks/is-number"),l=require("@stryke/type-checks/is-undefined");function u(e,t){return(0,l.isUndefined)(e)?`undefined`:(0,s.isNull)(e)?`null`:t===`boolean`||(0,o.isBoolean)(e)?String((0,i.toBool)(e)):t===`number`||(0,c.isNumber)(e)?Number.parseFloat(String(e)).toLocaleString(void 0,{maximumFractionDigits:20}):t===`integer`?Number.parseInt(String(e)).toLocaleString():t===`string`||t===`object`||t===`array`?JSON.stringify(e):String(e)}function d(t){if(!t)return`unknown`;if(typeof t==`boolean`)return t?`unknown`:`never`;if(e.I(t)&&(0,r.isSetString)(t.name))return t.name;let n=t;if((0,r.isSetString)(n.$ref))return/^#\/(?:definitions|\$defs)\/(.+)$/.exec(n.$ref)?.[1]??n.$ref;if(e.k(t)&&!(0,l.isUndefined)(t.const))return JSON.stringify((0,r.isSetString)(t.const)?t.const.replaceAll(/^['"`]|['"`]$/g,``):t.const);let i=e.m(t);if(i)return i===`integer`||i===`number`?`number`:i;if(n.type===`array`&&Array.isArray(n.enum))return n.enum.map(e=>JSON.stringify(e)).join(` | `);if(n.const!==void 0)return JSON.stringify(n.const);if(n.type===`array`||n.items)return`${d(Array.isArray(n.items)?n.items[0]:n.items)}[]`;if(n.type===`object`||n.properties||n.additionalProperties){if(e._(n.additionalProperties))return`{ [key: string]: ${d(n.additionalProperties)} }`;if(e.I(n)){let t=n.required??[];return`{ ${e.a(n).map(n=>{let r=!t.includes(n.name)||e.c(n)?`${t.includes(n.name)?``:`?`}${e.c(n)?` | null`:``}`:``;return`${n.name}${r}: ${d(n)}`}).join(`;
2
- `)} }`}}return n.oneOf||n.anyOf?(n.oneOf??n.anyOf??[]).map(e=>d(e)).join(` | `):n.allOf?`object`:`unknown`}function f(e){return(0,s.isNull)(e)?`null`:(0,o.isBoolean)(e)?`boolean`:(0,n.isInteger)(e)?`integer`:(0,c.isNumber)(e)?`number`:(0,n.isString)(e)?`string`:(0,n.isObject)(e)?`object`:Array.isArray(e)?`array`:void 0}function p(e){return/^#\/(?:definitions|\$defs)\/(.+)$/.exec(e)?.[1]}function m(e){let t=e.replace(/[^\w$]/gu,`_`);return`parse_${/^\d/u.test(t)?`_${t}`:t}`}function h(e){let t=e.type;return Array.isArray(t)?[...t]:t?[t]:[]}function g(e,t){return`${e} + ${JSON.stringify(t)}`}function _(i,o={}){let s=i,c=typeof s==`boolean`?{}:{...s.definitions,...s.$defs},l={};function u(e){let t=l[e]??0;return l[e]=t+1,`${e}${t>0?`${t}`:``}`}function f(t,n,i,s,l=`errors`){if(typeof t==`boolean`)return t?[`${s} = ${n};`]:[`${l}.push({ path: ${i}, failure: "No value is allowed at this location" });`,`${s} = ${n};`];if((0,r.isSetString)(t.$ref)){let e=p(t.$ref);return e&&e in c?[`${s} = ${m(e)}(${n}, ${i}, ${l});`]:[`${s} = ${n};`]}let d=u(t.name?`${(0,a.camelCase)(t.name)}Value`:`value`),f=u(t.name?`${(0,a.camelCase)(t.name)}Path`:`path`),h=[`const ${d} = ${n};`,`const ${f} = ${i};`];return!o.ignoreDefaults&&t.default!==void 0?(h.push(`if (${d} === undefined${t.type===`string`?` || ${d} === ""`:t.type===`number`||t.type===`integer`?` || Number.isNaN(${d})`:``}) {`,` ${s} = ${JSON.stringify(t.default)};`,`} else {`),e.c(t)?(h.push(` if (${d} === null) {`,` ${s} = null;`,` } else {`),h.push(..._(t,d,f,s,l)),h.push(` }`)):h.push(..._(t,d,f,s,l)),h.push(`}`),h):(h.push(`if (${d} === undefined) {`,` ${l}.push({ path: ${f}, failure: "A value is required" });`,` ${s} = ${d};`,`} else {`),e.c(t)?(h.push(` if (${d} === null) {`,` ${s} = null;`,` } else {`),h.push(..._(t,d,f,s,l)),h.push(` }`)):h.push(..._(t,d,f,s,l)),h.push(`}`),h)}function _(n,r,i,o,s){let c=[];if(n.const!==void 0){let e=JSON.stringify(n.const);return c.push(`if (${n.type===`string`?r:`JSON.stringify(${r})`} !== ${e}) { ${s}.push({ path: ${i}, failure: "Expected the constant value " + ${e} }); }`,`${o} = ${e};`),c}if(Array.isArray(n.enum)){let e=JSON.stringify(n.enum);return c.push(`if (!${e}.some(allowed => JSON.stringify(allowed) === JSON.stringify(${r}))) { ${s}.push({ path: ${i}, failure: \`Expected one of: ${(0,t.list)(n.enum.map(e=>JSON.stringify(e)),{conjunction:`or`})}, instead received: \${JSON.stringify(${r})}\` }); }`,`${o} = ${r};`),c}if(Array.isArray(n.oneOf)||Array.isArray(n.anyOf)){let e=n.oneOf??n.anyOf??[],t=u(n.name?`${(0,a.camelCase)(n.name)}Matched`:`matched`);c.push(`let ${t} = false;`);for(let s of e){let e=u(n.name?`${(0,a.camelCase)(n.name)}BranchErrors`:`branchErrors`),l=u(n.name?`${(0,a.camelCase)(n.name)}BranchResult`:`branchResult`);c.push(`if (!${t}) {`),c.push(` const ${e}: { path: string; failure: string }[] = [];`,` let ${l};`),c.push(...f(s,r,i,l,e)),c.push(` if (${e}.length === 0) {`,` ${o} = ${l};`,` ${t} = true;`,` }`,`}`)}return c.push(`if (!${t}) {`,` ${s}.push({ path: ${i}, failure: \`The provided value \${JSON.stringify(${r})} does not match the allowed schemas\` });`,` ${o} = ${r};`,`}`),c}if(Array.isArray(n.allOf)){let{allOf:t,...a}=n,l=e.u(a,...t);return c.push(...f(l,r,i,o,s)),c}let l=h(n);switch(e.m(n)??l.find(e=>e!==`null`)??(n.properties?`object`:n.items?`array`:void 0)){case`object`:c.push(...v(n,r,i,o,s));break;case`array`:c.push(...y(n,r,i,o,s));break;case`string`:c.push(`if (typeof ${r} === "string") {`,` ${o} = ${r};`,`} else if (typeof ${r} === "number" || typeof ${r} === "boolean") {`,` ${o} = String(${r});`,`} else {`,` ${s}.push({ path: ${i}, failure: "Expected a string value" });`,` ${o} = ${r};`,`}`);break;case`integer`:c.push(`if (typeof ${r} === "number" && Number.isInteger(${r})) {`,` ${o} = ${r};`,`} else if (typeof ${r} === "string" && ${r}.trim() !== "" && Number.isInteger(Number(${r}))) {`,` ${o} = Number(${r});`,`} else if (typeof ${r} === "boolean") {`,` ${o} = ${r} ? 1 : 0;`,`} else {`,` ${s}.push({ path: ${i}, failure: "Expected an integer value" });`,` ${o} = ${r};`,`}`);break;case`number`:c.push(`if (typeof ${r} === "number") {`,` ${o} = ${r};`,`} else if (typeof ${r} === "string" && ${r}.trim() !== "" && !Number.isNaN(Number(${r}))) {`,` ${o} = Number(${r});`,`} else if (typeof ${r} === "boolean") {`,` ${o} = ${r} ? 1 : 0;`,`} else {`,` ${s}.push({ path: ${i}, failure: "Expected a number value" });`,` ${o} = ${r};`,`}`);break;case`boolean`:c.push(`if (typeof ${r} === "boolean") {`,` ${o} = ${r};`,`} else if ((typeof ${r} === "string" && (${r}.toLowerCase() === "true" || ${r}.toLowerCase() === "t" || ${r}.toLowerCase() === "yes" || ${r}.toLowerCase() === "y" || (!Number.isNaN(Number.parseInt(${r})) && Number.parseInt(${r}) > 0))) || (typeof ${r} === "number" && ${r} > 0)) {`,` ${o} = true;`,`} else if ((typeof ${r} === "string" && (${r}.toLowerCase() === "false" || ${r}.toLowerCase() === "f" || ${r}.toLowerCase() === "no" || ${r}.toLowerCase() === "n" || (!Number.isNaN(Number.parseInt(${r})) && Number.parseInt(${r}) <= 0))) || (typeof ${r} === "number" && ${r} <= 0)) {`,` ${o} = false;`,`} else {`,` ${s}.push({ path: ${i}, failure: "Expected a boolean value" });`,` ${o} = ${r};`,`}`);break;case`null`:c.push(`if (${r} === null) {`,` ${o} = null;`,`} else {`,` ${s}.push({ path: ${i}, failure: "Expected a null value" });`,` ${o} = ${r};`,`}`);break;case void 0:default:c.push(`${o} = ${r};`);break}return c}function v(t,r,i,o,s){let c=d(t),l=[`if (typeof ${r} !== "object" || ${r} === null || Array.isArray(${r})) {`,` ${s}.push({ path: ${i}, failure: "Expected an object value" });`,` ${o} = ${r};`,`} else {`],p=u(c||t.name?`${(0,a.camelCase)(c||t.name)}Schema`:`schema`);if(l.push(`const ${p} = {} as Record<string, any>`),e.I(t)){let o=new Set;for(let c of e.a(t)){o.add(c.name);let t;(0,n.isSetArray)(c.alias)?(t=`(${c.alias.map(e=>`${r}[${JSON.stringify(e)}]`).join(` ${e.H(c)?`||`:`??`} `)} ${e.H(c)?`||`:`??`} ${r}[${JSON.stringify(c.name)}])`,c.alias.forEach(e=>o.add(e))):t=`${r}[${JSON.stringify(c.name)}]`;let d=g(i,`.${c.name}`),m=u(c.name?`${(0,a.camelCase)(c.name)}Property`:`property`),h=c.default===void 0?c.required?`${s}.push({ path: ${d}, failure: "Required property is missing" });`:``:`${p}[${JSON.stringify(c.name)}] = ${JSON.stringify(c.default)};`;l.push(` if (${t} !== undefined) {`,` let ${m};`),l.push(...f(c,t,d,m,s)),l.push(`${p}[${JSON.stringify(c.name)}] = ${m};`),h?l.push(`} else { ${h} }`):l.push(`}`)}let d=t.additionalProperties;if(e._(d)){let e=u(c||t.name?`${(0,a.camelCase)(c||t.name)}AdditionalProperties`:`additionalProperties`);l.push(` for (const key of Object.keys(${r})) {`,` if (${JSON.stringify([...o])}.includes(key)) { continue; }`,` let ${e};`),l.push(...f(d,`${r}[key]`,`${i} + "." + key`,e,s)),l.push(`${p}[key] = ${e};`,`}`)}else d!==!1&&l.push(` for (const key of Object.keys(${r})) {`,` if (${JSON.stringify([...o])}.includes(key)) { continue; }`,` ${p}[key] = ${r}[key];`,`}`)}return l.push(`${o} = ${p};`,`}`),l}function y(e,t,n,r,i){let o=[`if (!Array.isArray(${t})) {`,` ${i}.push({ path: ${n}, failure: "Expected an array value" });`,` ${r} = ${t};`,`} else {`],s=u(e.name?`${(0,a.camelCase)(e.name)}Array`:`array`);o.push(`const ${s}: unknown[] = [];`);let c=e.prefixItems??(Array.isArray(e.items)?e.items:void 0);if(c){let a=Array.isArray(e.items)?void 0:e.items;return o.push(` for (let index = 0; index < ${t}.length; index += 1) {`,` const item = ${t}[index];`,` let itemResult;`),c.forEach((e,t)=>{o.push(` ${t===0?`if`:`else if`} (index === ${t}) {`),o.push(...f(e,`item`,g(n,`[${t}]`),`itemResult`,i)),o.push(`}`)}),a?(o.push(`else {`),o.push(...f(a,`item`,`${n} + "[" + index + "]"`,`itemResult`,i)),o.push(`}`)):o.push(`else { itemResult = item; }`),o.push(` ${s}.push(itemResult);`,` }`,` ${r} = ${s};`,`}`),o}let l=e.items??!0;return o.push(` for (let index = 0; index < ${t}.length; index += 1) {`,` const item = ${t}[index];`,` let itemResult;`),o.push(...f(l,`item`,`${n} + "[" + index + "]"`,`itemResult`,i)),o.push(` ${s}.push(itemResult);`,` }`,` ${r} = ${s};`,`}`),o}return`/**
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./helpers-CFED4EbH.cjs");let t=require("@stryke/type-checks/is-set-string"),n=require("@stryke/type-checks"),r=require("@stryke/string-format/list"),i=require("@stryke/convert/to-bool"),a=require("@stryke/string-format/camel-case"),o=require("@stryke/type-checks/is-boolean"),s=require("@stryke/type-checks/is-null"),c=require("@stryke/type-checks/is-number"),l=require("@stryke/type-checks/is-undefined");function u(e,t){return(0,l.isUndefined)(e)?`undefined`:(0,s.isNull)(e)?`null`:t===`boolean`||(0,o.isBoolean)(e)?String((0,i.toBool)(e)):t===`number`||(0,c.isNumber)(e)?Number.parseFloat(String(e)).toLocaleString(void 0,{maximumFractionDigits:20}):t===`integer`?Number.parseInt(String(e)).toLocaleString():t===`string`||t===`object`||t===`array`?JSON.stringify(e):String(e)}function d(n){if(!n)return`unknown`;if(typeof n==`boolean`)return n?`unknown`:`never`;if(e.N(n)&&(0,t.isSetString)(n.name))return n.name;let r=n;if((0,t.isSetString)(r.$ref))return/^#\/(?:definitions|\$defs)\/(.+)$/.exec(r.$ref)?.[1]??r.$ref;if(e.E(n)&&!(0,l.isUndefined)(n.const))return JSON.stringify((0,t.isSetString)(n.const)?n.const.replaceAll(/^['"`]|['"`]$/g,``):n.const);let i=e.rt(n);if(i)return i===`integer`||i===`number`?`number`:i;if(r.type===`array`&&Array.isArray(r.enum))return r.enum.map(e=>JSON.stringify(e)).join(` | `);if(r.const!==void 0)return JSON.stringify(r.const);if(r.type===`array`||r.items)return`${d(Array.isArray(r.items)?r.items[0]:r.items)}[]`;if(r.type===`object`||r.properties||r.additionalProperties){if(e.m(r.additionalProperties))return`{ [key: string]: ${d(r.additionalProperties)} }`;if(e.N(r)){let t=r.required??[];return`{ ${e.a(r).map(n=>{let r=!t.includes(n.name)||e.c(n)?`${t.includes(n.name)?``:`?`}${e.c(n)?` | null`:``}`:``;return`${n.name}${r}: ${d(n)}`}).join(`;
2
+ `)} }`}}return r.oneOf||r.anyOf?(r.oneOf??r.anyOf??[]).map(e=>d(e)).join(` | `):r.allOf?`object`:`unknown`}function f(e){return(0,s.isNull)(e)?`null`:(0,o.isBoolean)(e)?`boolean`:(0,n.isInteger)(e)?`integer`:(0,c.isNumber)(e)?`number`:(0,n.isString)(e)?`string`:(0,n.isObject)(e)?`object`:Array.isArray(e)?`array`:void 0}function p(e){return/^#\/(?:definitions|\$defs)\/(.+)$/.exec(e)?.[1]}function m(e){let t=e.replace(/[^\w$]/gu,`_`);return`parse_${/^\d/u.test(t)?`_${t}`:t}`}function h(e){let t=e.type;return Array.isArray(t)?[...t]:t?[t]:[]}function g(e,t){return`${e} + ${JSON.stringify(t)}`}function _(i,o={}){let s=i,c=typeof s==`boolean`?{}:{...s.definitions,...s.$defs},l={};function u(e){let t=l[e]??0;return l[e]=t+1,`${e}${t>0?`${t}`:``}`}function f(n,r,i,s,l=`errors`){if(typeof n==`boolean`)return n?[`${s} = ${r};`]:[`${l}.push({ path: ${i}, failure: "No value is allowed at this location" });`,`${s} = ${r};`];if((0,t.isSetString)(n.$ref)){let e=p(n.$ref);return e&&e in c?[`${s} = ${m(e)}(${r}, ${i}, ${l});`]:[`${s} = ${r};`]}let d=u(n.name?`${(0,a.camelCase)(n.name)}Value`:`value`),f=u(n.name?`${(0,a.camelCase)(n.name)}Path`:`path`),h=[`const ${d} = ${r};`,`const ${f} = ${i};`];return!o.ignoreDefaults&&n.default!==void 0?(h.push(`if (${d} === undefined${n.type===`string`?` || ${d} === ""`:n.type===`number`||n.type===`integer`?` || Number.isNaN(${d})`:``}) {`,` ${s} = ${JSON.stringify(n.default)};`,`} else {`),e.c(n)?(h.push(` if (${d} === null) {`,` ${s} = null;`,` } else {`),h.push(..._(n,d,f,s,l)),h.push(` }`)):h.push(..._(n,d,f,s,l)),h.push(`}`),h):(h.push(`if (${d} === undefined) {`,` ${l}.push({ path: ${f}, failure: "A value is required" });`,` ${s} = ${d};`,`} else {`),e.c(n)?(h.push(` if (${d} === null) {`,` ${s} = null;`,` } else {`),h.push(..._(n,d,f,s,l)),h.push(` }`)):h.push(..._(n,d,f,s,l)),h.push(`}`),h)}function _(t,n,i,o,s){let c=[];if(t.const!==void 0){let e=JSON.stringify(t.const);return c.push(`if (${t.type===`string`?n:`JSON.stringify(${n})`} !== ${e}) { ${s}.push({ path: ${i}, failure: "Expected the constant value " + ${e} }); }`,`${o} = ${e};`),c}if(Array.isArray(t.enum)){let e=JSON.stringify(t.enum);return c.push(`if (!${e}.some(allowed => JSON.stringify(allowed) === JSON.stringify(${n}))) { ${s}.push({ path: ${i}, failure: \`Expected one of: ${(0,r.list)(t.enum.map(e=>JSON.stringify(e)),{conjunction:`or`})}, instead received: \${JSON.stringify(${n})}\` }); }`,`${o} = ${n};`),c}if(Array.isArray(t.oneOf)||Array.isArray(t.anyOf)){let e=t.oneOf??t.anyOf??[],r=u(t.name?`${(0,a.camelCase)(t.name)}Matched`:`matched`);c.push(`let ${r} = false;`);for(let s of e){let e=u(t.name?`${(0,a.camelCase)(t.name)}BranchErrors`:`branchErrors`),l=u(t.name?`${(0,a.camelCase)(t.name)}BranchResult`:`branchResult`);c.push(`if (!${r}) {`),c.push(` const ${e}: { path: string; failure: string }[] = [];`,` let ${l};`),c.push(...f(s,n,i,l,e)),c.push(` if (${e}.length === 0) {`,` ${o} = ${l};`,` ${r} = true;`,` }`,`}`)}return c.push(`if (!${r}) {`,` ${s}.push({ path: ${i}, failure: \`The provided value \${JSON.stringify(${n})} does not match the allowed schemas\` });`,` ${o} = ${n};`,`}`),c}if(Array.isArray(t.allOf)){let{allOf:r,...a}=t,l=e.u(a,...r);return c.push(...f(l,n,i,o,s)),c}let l=h(t);switch(e.rt(t)??l.find(e=>e!==`null`)??(t.properties?`object`:t.items?`array`:void 0)){case`object`:c.push(...v(t,n,i,o,s));break;case`array`:c.push(...y(t,n,i,o,s));break;case`string`:c.push(`if (typeof ${n} === "string") {`,` ${o} = ${n};`,`} else if (typeof ${n} === "number" || typeof ${n} === "boolean") {`,` ${o} = String(${n});`,`} else {`,` ${s}.push({ path: ${i}, failure: "Expected a string value" });`,` ${o} = ${n};`,`}`);break;case`integer`:c.push(`if (typeof ${n} === "number" && Number.isInteger(${n})) {`,` ${o} = ${n};`,`} else if (typeof ${n} === "string" && ${n}.trim() !== "" && Number.isInteger(Number(${n}))) {`,` ${o} = Number(${n});`,`} else if (typeof ${n} === "boolean") {`,` ${o} = ${n} ? 1 : 0;`,`} else {`,` ${s}.push({ path: ${i}, failure: "Expected an integer value" });`,` ${o} = ${n};`,`}`);break;case`number`:c.push(`if (typeof ${n} === "number") {`,` ${o} = ${n};`,`} else if (typeof ${n} === "string" && ${n}.trim() !== "" && !Number.isNaN(Number(${n}))) {`,` ${o} = Number(${n});`,`} else if (typeof ${n} === "boolean") {`,` ${o} = ${n} ? 1 : 0;`,`} else {`,` ${s}.push({ path: ${i}, failure: "Expected a number value" });`,` ${o} = ${n};`,`}`);break;case`boolean`:c.push(`if (typeof ${n} === "boolean") {`,` ${o} = ${n};`,`} else if ((typeof ${n} === "string" && (${n}.toLowerCase() === "true" || ${n}.toLowerCase() === "t" || ${n}.toLowerCase() === "yes" || ${n}.toLowerCase() === "y" || (!Number.isNaN(Number.parseInt(${n})) && Number.parseInt(${n}) > 0))) || (typeof ${n} === "number" && ${n} > 0)) {`,` ${o} = true;`,`} else if ((typeof ${n} === "string" && (${n}.toLowerCase() === "false" || ${n}.toLowerCase() === "f" || ${n}.toLowerCase() === "no" || ${n}.toLowerCase() === "n" || (!Number.isNaN(Number.parseInt(${n})) && Number.parseInt(${n}) <= 0))) || (typeof ${n} === "number" && ${n} <= 0)) {`,` ${o} = false;`,`} else {`,` ${s}.push({ path: ${i}, failure: "Expected a boolean value" });`,` ${o} = ${n};`,`}`);break;case`null`:c.push(`if (${n} === null) {`,` ${o} = null;`,`} else {`,` ${s}.push({ path: ${i}, failure: "Expected a null value" });`,` ${o} = ${n};`,`}`);break;case void 0:default:c.push(`${o} = ${n};`);break}return c}function v(t,r,i,o,s){let c=d(t),l=[`if (typeof ${r} !== "object" || ${r} === null || Array.isArray(${r})) {`,` ${s}.push({ path: ${i}, failure: "Expected an object value" });`,` ${o} = ${r};`,`} else {`],p=u(c||t.name?`${(0,a.camelCase)(c||t.name)}Schema`:`schema`);if(l.push(`const ${p} = {} as Record<string, any>`),e.N(t)){let o=new Set;for(let c of e.a(t)){o.add(c.name);let t;(0,n.isSetArray)(c.alias)?(t=`(${c.alias.map(e=>`${r}[${JSON.stringify(e)}]`).join(` ${e.z(c)?`||`:`??`} `)} ${e.z(c)?`||`:`??`} ${r}[${JSON.stringify(c.name)}])`,c.alias.forEach(e=>o.add(e))):t=`${r}[${JSON.stringify(c.name)}]`;let d=g(i,`.${c.name}`),m=u(c.name?`${(0,a.camelCase)(c.name)}Property`:`property`),h=c.default===void 0?c.required?`${s}.push({ path: ${d}, failure: "Required property is missing" });`:``:`${p}[${JSON.stringify(c.name)}] = ${JSON.stringify(c.default)};`;l.push(` if (${t} !== undefined) {`,` let ${m};`),l.push(...f(c,t,d,m,s)),l.push(`${p}[${JSON.stringify(c.name)}] = ${m};`),h?l.push(`} else { ${h} }`):l.push(`}`)}let d=t.additionalProperties;if(e.m(d)){let e=u(c||t.name?`${(0,a.camelCase)(c||t.name)}AdditionalProperties`:`additionalProperties`);l.push(` for (const key of Object.keys(${r})) {`,` if (${JSON.stringify([...o])}.includes(key)) { continue; }`,` let ${e};`),l.push(...f(d,`${r}[key]`,`${i} + "." + key`,e,s)),l.push(`${p}[key] = ${e};`,`}`)}else d!==!1&&l.push(` for (const key of Object.keys(${r})) {`,` if (${JSON.stringify([...o])}.includes(key)) { continue; }`,` ${p}[key] = ${r}[key];`,`}`)}return l.push(`${o} = ${p};`,`}`),l}function y(e,t,n,r,i){let o=[`if (!Array.isArray(${t})) {`,` ${i}.push({ path: ${n}, failure: "Expected an array value" });`,` ${r} = ${t};`,`} else {`],s=u(e.name?`${(0,a.camelCase)(e.name)}Array`:`array`);o.push(`const ${s}: unknown[] = [];`);let c=e.prefixItems??(Array.isArray(e.items)?e.items:void 0);if(c){let a=Array.isArray(e.items)?void 0:e.items;return o.push(` for (let index = 0; index < ${t}.length; index += 1) {`,` const item = ${t}[index];`,` let itemResult;`),c.forEach((e,t)=>{o.push(` ${t===0?`if`:`else if`} (index === ${t}) {`),o.push(...f(e,`item`,g(n,`[${t}]`),`itemResult`,i)),o.push(`}`)}),a?(o.push(`else {`),o.push(...f(a,`item`,`${n} + "[" + index + "]"`,`itemResult`,i)),o.push(`}`)):o.push(`else { itemResult = item; }`),o.push(` ${s}.push(itemResult);`,` }`,` ${r} = ${s};`,`}`),o}let l=e.items??!0;return o.push(` for (let index = 0; index < ${t}.length; index += 1) {`,` const item = ${t}[index];`,` let itemResult;`),o.push(...f(l,`item`,`${n} + "[" + index + "]"`,`itemResult`,i)),o.push(` ${s}.push(itemResult);`,` }`,` ${r} = ${s};`,`}`),o}return`/**
3
3
  * Parser error constructor function.
4
4
  */
5
5
  function ParserError(path, failure) {
package/dist/codegen.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import{H as e,I as t,_ as n,a as r,c as i,k as a,m as o,u as s}from"./helpers-CfLw5cNk.mjs";import{list as c}from"@stryke/string-format/list";import{isInteger as l,isObject as u,isSetArray as d,isString as f}from"@stryke/type-checks";import{isSetString as p}from"@stryke/type-checks/is-set-string";import{toBool as m}from"@stryke/convert/to-bool";import{camelCase as h}from"@stryke/string-format/camel-case";import{isBoolean as g}from"@stryke/type-checks/is-boolean";import{isNull as _}from"@stryke/type-checks/is-null";import{isNumber as v}from"@stryke/type-checks/is-number";import{isUndefined as y}from"@stryke/type-checks/is-undefined";function b(e,t){return y(e)?`undefined`:_(e)?`null`:t===`boolean`||g(e)?String(m(e)):t===`number`||v(e)?Number.parseFloat(String(e)).toLocaleString(void 0,{maximumFractionDigits:20}):t===`integer`?Number.parseInt(String(e)).toLocaleString():t===`string`||t===`object`||t===`array`?JSON.stringify(e):String(e)}function x(e){if(!e)return`unknown`;if(typeof e==`boolean`)return e?`unknown`:`never`;if(t(e)&&p(e.name))return e.name;let s=e;if(p(s.$ref))return/^#\/(?:definitions|\$defs)\/(.+)$/.exec(s.$ref)?.[1]??s.$ref;if(a(e)&&!y(e.const))return JSON.stringify(p(e.const)?e.const.replaceAll(/^['"`]|['"`]$/g,``):e.const);let c=o(e);if(c)return c===`integer`||c===`number`?`number`:c;if(s.type===`array`&&Array.isArray(s.enum))return s.enum.map(e=>JSON.stringify(e)).join(` | `);if(s.const!==void 0)return JSON.stringify(s.const);if(s.type===`array`||s.items)return`${x(Array.isArray(s.items)?s.items[0]:s.items)}[]`;if(s.type===`object`||s.properties||s.additionalProperties){if(n(s.additionalProperties))return`{ [key: string]: ${x(s.additionalProperties)} }`;if(t(s)){let e=s.required??[];return`{ ${r(s).map(t=>{let n=!e.includes(t.name)||i(t)?`${e.includes(t.name)?``:`?`}${i(t)?` | null`:``}`:``;return`${t.name}${n}: ${x(t)}`}).join(`;
2
- `)} }`}}return s.oneOf||s.anyOf?(s.oneOf??s.anyOf??[]).map(e=>x(e)).join(` | `):s.allOf?`object`:`unknown`}function S(e){return _(e)?`null`:g(e)?`boolean`:l(e)?`integer`:v(e)?`number`:f(e)?`string`:u(e)?`object`:Array.isArray(e)?`array`:void 0}function C(e){return/^#\/(?:definitions|\$defs)\/(.+)$/.exec(e)?.[1]}function w(e){let t=e.replace(/[^\w$]/gu,`_`);return`parse_${/^\d/u.test(t)?`_${t}`:t}`}function T(e){let t=e.type;return Array.isArray(t)?[...t]:t?[t]:[]}function E(e,t){return`${e} + ${JSON.stringify(t)}`}function D(a,l={}){let u=a,f=typeof u==`boolean`?{}:{...u.definitions,...u.$defs},m={};function g(e){let t=m[e]??0;return m[e]=t+1,`${e}${t>0?`${t}`:``}`}function _(e,t,n,r,a=`errors`){if(typeof e==`boolean`)return e?[`${r} = ${t};`]:[`${a}.push({ path: ${n}, failure: "No value is allowed at this location" });`,`${r} = ${t};`];if(p(e.$ref)){let i=C(e.$ref);return i&&i in f?[`${r} = ${w(i)}(${t}, ${n}, ${a});`]:[`${r} = ${t};`]}let o=g(e.name?`${h(e.name)}Value`:`value`),s=g(e.name?`${h(e.name)}Path`:`path`),c=[`const ${o} = ${t};`,`const ${s} = ${n};`];return!l.ignoreDefaults&&e.default!==void 0?(c.push(`if (${o} === undefined${e.type===`string`?` || ${o} === ""`:e.type===`number`||e.type===`integer`?` || Number.isNaN(${o})`:``}) {`,` ${r} = ${JSON.stringify(e.default)};`,`} else {`),i(e)?(c.push(` if (${o} === null) {`,` ${r} = null;`,` } else {`),c.push(...v(e,o,s,r,a)),c.push(` }`)):c.push(...v(e,o,s,r,a)),c.push(`}`),c):(c.push(`if (${o} === undefined) {`,` ${a}.push({ path: ${s}, failure: "A value is required" });`,` ${r} = ${o};`,`} else {`),i(e)?(c.push(` if (${o} === null) {`,` ${r} = null;`,` } else {`),c.push(...v(e,o,s,r,a)),c.push(` }`)):c.push(...v(e,o,s,r,a)),c.push(`}`),c)}function v(e,t,n,r,i){let a=[];if(e.const!==void 0){let o=JSON.stringify(e.const);return a.push(`if (${e.type===`string`?t:`JSON.stringify(${t})`} !== ${o}) { ${i}.push({ path: ${n}, failure: "Expected the constant value " + ${o} }); }`,`${r} = ${o};`),a}if(Array.isArray(e.enum)){let o=JSON.stringify(e.enum);return a.push(`if (!${o}.some(allowed => JSON.stringify(allowed) === JSON.stringify(${t}))) { ${i}.push({ path: ${n}, failure: \`Expected one of: ${c(e.enum.map(e=>JSON.stringify(e)),{conjunction:`or`})}, instead received: \${JSON.stringify(${t})}\` }); }`,`${r} = ${t};`),a}if(Array.isArray(e.oneOf)||Array.isArray(e.anyOf)){let o=e.oneOf??e.anyOf??[],s=g(e.name?`${h(e.name)}Matched`:`matched`);a.push(`let ${s} = false;`);for(let i of o){let o=g(e.name?`${h(e.name)}BranchErrors`:`branchErrors`),c=g(e.name?`${h(e.name)}BranchResult`:`branchResult`);a.push(`if (!${s}) {`),a.push(` const ${o}: { path: string; failure: string }[] = [];`,` let ${c};`),a.push(..._(i,t,n,c,o)),a.push(` if (${o}.length === 0) {`,` ${r} = ${c};`,` ${s} = true;`,` }`,`}`)}return a.push(`if (!${s}) {`,` ${i}.push({ path: ${n}, failure: \`The provided value \${JSON.stringify(${t})} does not match the allowed schemas\` });`,` ${r} = ${t};`,`}`),a}if(Array.isArray(e.allOf)){let{allOf:o,...c}=e,l=s(c,...o);return a.push(..._(l,t,n,r,i)),a}let l=T(e);switch(o(e)??l.find(e=>e!==`null`)??(e.properties?`object`:e.items?`array`:void 0)){case`object`:a.push(...y(e,t,n,r,i));break;case`array`:a.push(...b(e,t,n,r,i));break;case`string`:a.push(`if (typeof ${t} === "string") {`,` ${r} = ${t};`,`} else if (typeof ${t} === "number" || typeof ${t} === "boolean") {`,` ${r} = String(${t});`,`} else {`,` ${i}.push({ path: ${n}, failure: "Expected a string value" });`,` ${r} = ${t};`,`}`);break;case`integer`:a.push(`if (typeof ${t} === "number" && Number.isInteger(${t})) {`,` ${r} = ${t};`,`} else if (typeof ${t} === "string" && ${t}.trim() !== "" && Number.isInteger(Number(${t}))) {`,` ${r} = Number(${t});`,`} else if (typeof ${t} === "boolean") {`,` ${r} = ${t} ? 1 : 0;`,`} else {`,` ${i}.push({ path: ${n}, failure: "Expected an integer value" });`,` ${r} = ${t};`,`}`);break;case`number`:a.push(`if (typeof ${t} === "number") {`,` ${r} = ${t};`,`} else if (typeof ${t} === "string" && ${t}.trim() !== "" && !Number.isNaN(Number(${t}))) {`,` ${r} = Number(${t});`,`} else if (typeof ${t} === "boolean") {`,` ${r} = ${t} ? 1 : 0;`,`} else {`,` ${i}.push({ path: ${n}, failure: "Expected a number value" });`,` ${r} = ${t};`,`}`);break;case`boolean`:a.push(`if (typeof ${t} === "boolean") {`,` ${r} = ${t};`,`} else if ((typeof ${t} === "string" && (${t}.toLowerCase() === "true" || ${t}.toLowerCase() === "t" || ${t}.toLowerCase() === "yes" || ${t}.toLowerCase() === "y" || (!Number.isNaN(Number.parseInt(${t})) && Number.parseInt(${t}) > 0))) || (typeof ${t} === "number" && ${t} > 0)) {`,` ${r} = true;`,`} else if ((typeof ${t} === "string" && (${t}.toLowerCase() === "false" || ${t}.toLowerCase() === "f" || ${t}.toLowerCase() === "no" || ${t}.toLowerCase() === "n" || (!Number.isNaN(Number.parseInt(${t})) && Number.parseInt(${t}) <= 0))) || (typeof ${t} === "number" && ${t} <= 0)) {`,` ${r} = false;`,`} else {`,` ${i}.push({ path: ${n}, failure: "Expected a boolean value" });`,` ${r} = ${t};`,`}`);break;case`null`:a.push(`if (${t} === null) {`,` ${r} = null;`,`} else {`,` ${i}.push({ path: ${n}, failure: "Expected a null value" });`,` ${r} = ${t};`,`}`);break;case void 0:default:a.push(`${r} = ${t};`);break}return a}function y(i,a,o,s,c){let l=x(i),u=[`if (typeof ${a} !== "object" || ${a} === null || Array.isArray(${a})) {`,` ${c}.push({ path: ${o}, failure: "Expected an object value" });`,` ${s} = ${a};`,`} else {`],f=g(l||i.name?`${h(l||i.name)}Schema`:`schema`);if(u.push(`const ${f} = {} as Record<string, any>`),t(i)){let t=new Set;for(let n of r(i)){t.add(n.name);let r;d(n.alias)?(r=`(${n.alias.map(e=>`${a}[${JSON.stringify(e)}]`).join(` ${e(n)?`||`:`??`} `)} ${e(n)?`||`:`??`} ${a}[${JSON.stringify(n.name)}])`,n.alias.forEach(e=>t.add(e))):r=`${a}[${JSON.stringify(n.name)}]`;let i=E(o,`.${n.name}`),s=g(n.name?`${h(n.name)}Property`:`property`),l=n.default===void 0?n.required?`${c}.push({ path: ${i}, failure: "Required property is missing" });`:``:`${f}[${JSON.stringify(n.name)}] = ${JSON.stringify(n.default)};`;u.push(` if (${r} !== undefined) {`,` let ${s};`),u.push(..._(n,r,i,s,c)),u.push(`${f}[${JSON.stringify(n.name)}] = ${s};`),l?u.push(`} else { ${l} }`):u.push(`}`)}let s=i.additionalProperties;if(n(s)){let e=g(l||i.name?`${h(l||i.name)}AdditionalProperties`:`additionalProperties`);u.push(` for (const key of Object.keys(${a})) {`,` if (${JSON.stringify([...t])}.includes(key)) { continue; }`,` let ${e};`),u.push(..._(s,`${a}[key]`,`${o} + "." + key`,e,c)),u.push(`${f}[key] = ${e};`,`}`)}else s!==!1&&u.push(` for (const key of Object.keys(${a})) {`,` if (${JSON.stringify([...t])}.includes(key)) { continue; }`,` ${f}[key] = ${a}[key];`,`}`)}return u.push(`${s} = ${f};`,`}`),u}function b(e,t,n,r,i){let a=[`if (!Array.isArray(${t})) {`,` ${i}.push({ path: ${n}, failure: "Expected an array value" });`,` ${r} = ${t};`,`} else {`],o=g(e.name?`${h(e.name)}Array`:`array`);a.push(`const ${o}: unknown[] = [];`);let s=e.prefixItems??(Array.isArray(e.items)?e.items:void 0);if(s){let c=Array.isArray(e.items)?void 0:e.items;return a.push(` for (let index = 0; index < ${t}.length; index += 1) {`,` const item = ${t}[index];`,` let itemResult;`),s.forEach((e,t)=>{a.push(` ${t===0?`if`:`else if`} (index === ${t}) {`),a.push(..._(e,`item`,E(n,`[${t}]`),`itemResult`,i)),a.push(`}`)}),c?(a.push(`else {`),a.push(..._(c,`item`,`${n} + "[" + index + "]"`,`itemResult`,i)),a.push(`}`)):a.push(`else { itemResult = item; }`),a.push(` ${o}.push(itemResult);`,` }`,` ${r} = ${o};`,`}`),a}let c=e.items??!0;return a.push(` for (let index = 0; index < ${t}.length; index += 1) {`,` const item = ${t}[index];`,` let itemResult;`),a.push(..._(c,`item`,`${n} + "[" + index + "]"`,`itemResult`,i)),a.push(` ${o}.push(itemResult);`,` }`,` ${r} = ${o};`,`}`),a}return`/**
1
+ import{E as e,N as t,a as n,c as r,m as i,rt as a,u as o,z as s}from"./helpers-s2Zqtb-K.mjs";import{isSetString as c}from"@stryke/type-checks/is-set-string";import{isInteger as l,isObject as u,isSetArray as d,isString as f}from"@stryke/type-checks";import{list as p}from"@stryke/string-format/list";import{toBool as m}from"@stryke/convert/to-bool";import{camelCase as h}from"@stryke/string-format/camel-case";import{isBoolean as g}from"@stryke/type-checks/is-boolean";import{isNull as _}from"@stryke/type-checks/is-null";import{isNumber as v}from"@stryke/type-checks/is-number";import{isUndefined as y}from"@stryke/type-checks/is-undefined";function b(e,t){return y(e)?`undefined`:_(e)?`null`:t===`boolean`||g(e)?String(m(e)):t===`number`||v(e)?Number.parseFloat(String(e)).toLocaleString(void 0,{maximumFractionDigits:20}):t===`integer`?Number.parseInt(String(e)).toLocaleString():t===`string`||t===`object`||t===`array`?JSON.stringify(e):String(e)}function x(o){if(!o)return`unknown`;if(typeof o==`boolean`)return o?`unknown`:`never`;if(t(o)&&c(o.name))return o.name;let s=o;if(c(s.$ref))return/^#\/(?:definitions|\$defs)\/(.+)$/.exec(s.$ref)?.[1]??s.$ref;if(e(o)&&!y(o.const))return JSON.stringify(c(o.const)?o.const.replaceAll(/^['"`]|['"`]$/g,``):o.const);let l=a(o);if(l)return l===`integer`||l===`number`?`number`:l;if(s.type===`array`&&Array.isArray(s.enum))return s.enum.map(e=>JSON.stringify(e)).join(` | `);if(s.const!==void 0)return JSON.stringify(s.const);if(s.type===`array`||s.items)return`${x(Array.isArray(s.items)?s.items[0]:s.items)}[]`;if(s.type===`object`||s.properties||s.additionalProperties){if(i(s.additionalProperties))return`{ [key: string]: ${x(s.additionalProperties)} }`;if(t(s)){let e=s.required??[];return`{ ${n(s).map(t=>{let n=!e.includes(t.name)||r(t)?`${e.includes(t.name)?``:`?`}${r(t)?` | null`:``}`:``;return`${t.name}${n}: ${x(t)}`}).join(`;
2
+ `)} }`}}return s.oneOf||s.anyOf?(s.oneOf??s.anyOf??[]).map(e=>x(e)).join(` | `):s.allOf?`object`:`unknown`}function S(e){return _(e)?`null`:g(e)?`boolean`:l(e)?`integer`:v(e)?`number`:f(e)?`string`:u(e)?`object`:Array.isArray(e)?`array`:void 0}function C(e){return/^#\/(?:definitions|\$defs)\/(.+)$/.exec(e)?.[1]}function w(e){let t=e.replace(/[^\w$]/gu,`_`);return`parse_${/^\d/u.test(t)?`_${t}`:t}`}function T(e){let t=e.type;return Array.isArray(t)?[...t]:t?[t]:[]}function E(e,t){return`${e} + ${JSON.stringify(t)}`}function D(e,l={}){let u=e,f=typeof u==`boolean`?{}:{...u.definitions,...u.$defs},m={};function g(e){let t=m[e]??0;return m[e]=t+1,`${e}${t>0?`${t}`:``}`}function _(e,t,n,i,a=`errors`){if(typeof e==`boolean`)return e?[`${i} = ${t};`]:[`${a}.push({ path: ${n}, failure: "No value is allowed at this location" });`,`${i} = ${t};`];if(c(e.$ref)){let r=C(e.$ref);return r&&r in f?[`${i} = ${w(r)}(${t}, ${n}, ${a});`]:[`${i} = ${t};`]}let o=g(e.name?`${h(e.name)}Value`:`value`),s=g(e.name?`${h(e.name)}Path`:`path`),u=[`const ${o} = ${t};`,`const ${s} = ${n};`];return!l.ignoreDefaults&&e.default!==void 0?(u.push(`if (${o} === undefined${e.type===`string`?` || ${o} === ""`:e.type===`number`||e.type===`integer`?` || Number.isNaN(${o})`:``}) {`,` ${i} = ${JSON.stringify(e.default)};`,`} else {`),r(e)?(u.push(` if (${o} === null) {`,` ${i} = null;`,` } else {`),u.push(...v(e,o,s,i,a)),u.push(` }`)):u.push(...v(e,o,s,i,a)),u.push(`}`),u):(u.push(`if (${o} === undefined) {`,` ${a}.push({ path: ${s}, failure: "A value is required" });`,` ${i} = ${o};`,`} else {`),r(e)?(u.push(` if (${o} === null) {`,` ${i} = null;`,` } else {`),u.push(...v(e,o,s,i,a)),u.push(` }`)):u.push(...v(e,o,s,i,a)),u.push(`}`),u)}function v(e,t,n,r,i){let s=[];if(e.const!==void 0){let a=JSON.stringify(e.const);return s.push(`if (${e.type===`string`?t:`JSON.stringify(${t})`} !== ${a}) { ${i}.push({ path: ${n}, failure: "Expected the constant value " + ${a} }); }`,`${r} = ${a};`),s}if(Array.isArray(e.enum)){let a=JSON.stringify(e.enum);return s.push(`if (!${a}.some(allowed => JSON.stringify(allowed) === JSON.stringify(${t}))) { ${i}.push({ path: ${n}, failure: \`Expected one of: ${p(e.enum.map(e=>JSON.stringify(e)),{conjunction:`or`})}, instead received: \${JSON.stringify(${t})}\` }); }`,`${r} = ${t};`),s}if(Array.isArray(e.oneOf)||Array.isArray(e.anyOf)){let a=e.oneOf??e.anyOf??[],o=g(e.name?`${h(e.name)}Matched`:`matched`);s.push(`let ${o} = false;`);for(let i of a){let a=g(e.name?`${h(e.name)}BranchErrors`:`branchErrors`),c=g(e.name?`${h(e.name)}BranchResult`:`branchResult`);s.push(`if (!${o}) {`),s.push(` const ${a}: { path: string; failure: string }[] = [];`,` let ${c};`),s.push(..._(i,t,n,c,a)),s.push(` if (${a}.length === 0) {`,` ${r} = ${c};`,` ${o} = true;`,` }`,`}`)}return s.push(`if (!${o}) {`,` ${i}.push({ path: ${n}, failure: \`The provided value \${JSON.stringify(${t})} does not match the allowed schemas\` });`,` ${r} = ${t};`,`}`),s}if(Array.isArray(e.allOf)){let{allOf:a,...c}=e,l=o(c,...a);return s.push(..._(l,t,n,r,i)),s}let c=T(e);switch(a(e)??c.find(e=>e!==`null`)??(e.properties?`object`:e.items?`array`:void 0)){case`object`:s.push(...y(e,t,n,r,i));break;case`array`:s.push(...b(e,t,n,r,i));break;case`string`:s.push(`if (typeof ${t} === "string") {`,` ${r} = ${t};`,`} else if (typeof ${t} === "number" || typeof ${t} === "boolean") {`,` ${r} = String(${t});`,`} else {`,` ${i}.push({ path: ${n}, failure: "Expected a string value" });`,` ${r} = ${t};`,`}`);break;case`integer`:s.push(`if (typeof ${t} === "number" && Number.isInteger(${t})) {`,` ${r} = ${t};`,`} else if (typeof ${t} === "string" && ${t}.trim() !== "" && Number.isInteger(Number(${t}))) {`,` ${r} = Number(${t});`,`} else if (typeof ${t} === "boolean") {`,` ${r} = ${t} ? 1 : 0;`,`} else {`,` ${i}.push({ path: ${n}, failure: "Expected an integer value" });`,` ${r} = ${t};`,`}`);break;case`number`:s.push(`if (typeof ${t} === "number") {`,` ${r} = ${t};`,`} else if (typeof ${t} === "string" && ${t}.trim() !== "" && !Number.isNaN(Number(${t}))) {`,` ${r} = Number(${t});`,`} else if (typeof ${t} === "boolean") {`,` ${r} = ${t} ? 1 : 0;`,`} else {`,` ${i}.push({ path: ${n}, failure: "Expected a number value" });`,` ${r} = ${t};`,`}`);break;case`boolean`:s.push(`if (typeof ${t} === "boolean") {`,` ${r} = ${t};`,`} else if ((typeof ${t} === "string" && (${t}.toLowerCase() === "true" || ${t}.toLowerCase() === "t" || ${t}.toLowerCase() === "yes" || ${t}.toLowerCase() === "y" || (!Number.isNaN(Number.parseInt(${t})) && Number.parseInt(${t}) > 0))) || (typeof ${t} === "number" && ${t} > 0)) {`,` ${r} = true;`,`} else if ((typeof ${t} === "string" && (${t}.toLowerCase() === "false" || ${t}.toLowerCase() === "f" || ${t}.toLowerCase() === "no" || ${t}.toLowerCase() === "n" || (!Number.isNaN(Number.parseInt(${t})) && Number.parseInt(${t}) <= 0))) || (typeof ${t} === "number" && ${t} <= 0)) {`,` ${r} = false;`,`} else {`,` ${i}.push({ path: ${n}, failure: "Expected a boolean value" });`,` ${r} = ${t};`,`}`);break;case`null`:s.push(`if (${t} === null) {`,` ${r} = null;`,`} else {`,` ${i}.push({ path: ${n}, failure: "Expected a null value" });`,` ${r} = ${t};`,`}`);break;case void 0:default:s.push(`${r} = ${t};`);break}return s}function y(e,r,a,o,c){let l=x(e),u=[`if (typeof ${r} !== "object" || ${r} === null || Array.isArray(${r})) {`,` ${c}.push({ path: ${a}, failure: "Expected an object value" });`,` ${o} = ${r};`,`} else {`],f=g(l||e.name?`${h(l||e.name)}Schema`:`schema`);if(u.push(`const ${f} = {} as Record<string, any>`),t(e)){let t=new Set;for(let i of n(e)){t.add(i.name);let e;d(i.alias)?(e=`(${i.alias.map(e=>`${r}[${JSON.stringify(e)}]`).join(` ${s(i)?`||`:`??`} `)} ${s(i)?`||`:`??`} ${r}[${JSON.stringify(i.name)}])`,i.alias.forEach(e=>t.add(e))):e=`${r}[${JSON.stringify(i.name)}]`;let n=E(a,`.${i.name}`),o=g(i.name?`${h(i.name)}Property`:`property`),l=i.default===void 0?i.required?`${c}.push({ path: ${n}, failure: "Required property is missing" });`:``:`${f}[${JSON.stringify(i.name)}] = ${JSON.stringify(i.default)};`;u.push(` if (${e} !== undefined) {`,` let ${o};`),u.push(..._(i,e,n,o,c)),u.push(`${f}[${JSON.stringify(i.name)}] = ${o};`),l?u.push(`} else { ${l} }`):u.push(`}`)}let o=e.additionalProperties;if(i(o)){let n=g(l||e.name?`${h(l||e.name)}AdditionalProperties`:`additionalProperties`);u.push(` for (const key of Object.keys(${r})) {`,` if (${JSON.stringify([...t])}.includes(key)) { continue; }`,` let ${n};`),u.push(..._(o,`${r}[key]`,`${a} + "." + key`,n,c)),u.push(`${f}[key] = ${n};`,`}`)}else o!==!1&&u.push(` for (const key of Object.keys(${r})) {`,` if (${JSON.stringify([...t])}.includes(key)) { continue; }`,` ${f}[key] = ${r}[key];`,`}`)}return u.push(`${o} = ${f};`,`}`),u}function b(e,t,n,r,i){let a=[`if (!Array.isArray(${t})) {`,` ${i}.push({ path: ${n}, failure: "Expected an array value" });`,` ${r} = ${t};`,`} else {`],o=g(e.name?`${h(e.name)}Array`:`array`);a.push(`const ${o}: unknown[] = [];`);let s=e.prefixItems??(Array.isArray(e.items)?e.items:void 0);if(s){let c=Array.isArray(e.items)?void 0:e.items;return a.push(` for (let index = 0; index < ${t}.length; index += 1) {`,` const item = ${t}[index];`,` let itemResult;`),s.forEach((e,t)=>{a.push(` ${t===0?`if`:`else if`} (index === ${t}) {`),a.push(..._(e,`item`,E(n,`[${t}]`),`itemResult`,i)),a.push(`}`)}),c?(a.push(`else {`),a.push(..._(c,`item`,`${n} + "[" + index + "]"`,`itemResult`,i)),a.push(`}`)):a.push(`else { itemResult = item; }`),a.push(` ${o}.push(itemResult);`,` }`,` ${r} = ${o};`,`}`),a}let c=e.items??!0;return a.push(` for (let index = 0; index < ${t}.length; index += 1) {`,` const item = ${t}[index];`,` let itemResult;`),a.push(..._(c,`item`,`${n} + "[" + index + "]"`,`itemResult`,i)),a.push(` ${o}.push(itemResult);`,` }`,` ${r} = ${o};`,`}`),a}return`/**
3
3
  * Parser error constructor function.
4
4
  */
5
5
  function ParserError(path, failure) {
@@ -47,7 +47,7 @@ export function parseSafe(inputValue) {
47
47
  const errors = [];
48
48
 
49
49
  let result;
50
- ${_(a,`inputValue`,`"$"`,`result`,`errors`).join(`
50
+ ${_(e,`inputValue`,`"$"`,`result`,`errors`).join(`
51
51
  `)}
52
52
 
53
53
  if (errors.length > 0) {
@@ -0,0 +1 @@
1
+ const e=require("./rolldown-runtime-CMqjfN_6.cjs"),t=require("./constants-CjTQhR-l.cjs");let n=require("@stryke/type-checks/is-set-object"),r=require("@stryke/type-checks/is-set-string"),i=require("@stryke/type-checks"),a=require("@stryke/path/find"),ee=require("@stryke/resolve/constants"),te=require("@stryke/helpers/get-unique"),o=require("defu");o=e.t(o,1);function ne(e,r){if(!r||!(0,n.isSetObject)(e))return e;let i={...e},a=i;for(let e of t.t){let t=r[e];t!=null&&(a[e]=t)}return i}function s(e){if(!(0,n.isSetObject)(e))return[];let t=e;return Array.isArray(t.type)?t.type.filter(e=>(0,r.isSetString)(e)):(0,r.isSetString)(t.type)&&t.type!==`object`&&t.type!==`array`?[t.type]:[]}function re(e){if((0,n.isSetObject)(e))return s(e).find(e=>e!==`null`)}function ie(e){return!(0,i.isString)(e)&&e.file!==void 0}const c=e=>typeof e==`number`&&Number.isFinite(e),ae=e=>(0,i.isSetObject)(e)||(0,i.isBoolean)(e),l=e=>(0,i.isSetObject)(e)&&Object.values(e).every(e=>ae(e)),oe=e=>(0,i.isSetObject)(e)&&Object.values(e).every(e=>(0,i.isBoolean)(e)),u=e=>Array.isArray(e)&&e.every(e=>(0,i.isSetString)(e)),se=e=>(0,i.isSetObject)(e)&&Object.values(e).every(e=>u(e)),d=new Set(t.n),f=new Set(t.r);function ce(e){return(0,i.isSetString)(e)&&d.has(e)}function p(e){return(0,i.isSetString)(e)&&f.has(e)}const le=new Set([`date`,`time`,`date-time`,`iso-time`,`iso-date-time`,`unix-time`]),m=e=>typeof e==`bigint`,ue=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`function`,`object`,`any`,`array`]),de=e=>(0,i.isSetString)(e)&&ue.has(e),h=e=>{if(!(0,i.isSetObject)(e))return!1;let t=e;return!(t.type!==void 0&&!((0,i.isSetString)(t.type)&&de(t.type)||Array.isArray(t.type)&&t.type.every(e=>de(e)))||t.tsType!==void 0&&!(0,i.isSetString)(t.tsType)||t.markdownType!==void 0&&!(0,i.isSetString)(t.markdownType)||t.items!==void 0&&!(h(t.items)||Array.isArray(t.items)&&t.items.every(e=>h(e))))},fe=e=>{if(!h(e))return!1;let t=e;return t.name!==void 0&&!(0,i.isSetString)(t.name)?!1:t.optional===void 0||typeof t.optional==`boolean`},pe=e=>(0,i.isSetObject)(e)&&Object.values(e).every(e=>J(e)),g=(e,t)=>Array.isArray(e)&&e.every(e=>t(e)),me=(e,t,n)=>Array.isArray(e)&&e.length===2&&t(e[0])&&n(e[1]),_=(e,t=!1)=>e===void 0||(0,i.isString)(e)&&(t||e.length>0),v=e=>e===void 0||(0,i.isBoolean)(e),y=e=>e===void 0||c(e),b=e=>e===void 0||m(e),x=e=>e===void 0||q(e),S=e=>e===void 0||g(e,q),he=e=>e===void 0||Array.isArray(e)&&e.every(e=>(0,i.isSetString)(e)&&d.has(e)),ge=e=>e===void 0||Array.isArray(e)&&e.every(e=>(0,i.isSetString)(e)&&f.has(e)),C=e=>!(!_(e.$id)||!_(e.$schema)||e.$vocabulary!==void 0&&!oe(e.$vocabulary)||!_(e.$comment,!0)||!_(e.$anchor)||e.$defs!==void 0&&!l(e.$defs)||!_(e.$dynamicRef)||!_(e.$dynamicAnchor)||!_(e.name)||!_(e.title,!0)||!_(e.description,!0)||!_(e.docs,!0)||e.examples!==void 0&&!Array.isArray(e.examples)||e.alias!==void 0&&!u(e.alias)||e.tags!==void 0&&!u(e.tags)||!v(e.deprecated)||!v(e.hidden)||!v(e.ignore)||!v(e.internal)||!v(e.runtime)||!v(e.readOnly)||!v(e.writeOnly)||!S(e.allOf)||!S(e.anyOf)||!S(e.oneOf)||!x(e.not)||!x(e.if)||!x(e.then)||!x(e.else));function _e(e){return(0,i.isSetObject)(e)?C(e):!1}function w(e){if(!(0,i.isSetObject)(e))return!1;let n=e;return C(n)&&_(n.$ref)&&(!n.type||Array.isArray(n.type)&&n.type.every(e=>t.n.includes(e)))}function ve(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!C(t)||t.type!==`array`?!1:S(t.prefixItems)&&x(t.items)&&x(t.contains)&&y(t.minItems)&&y(t.maxItems)&&v(t.uniqueItems)&&y(t.minContains)&&y(t.maxContains)&&(t.unevaluatedItems===void 0||(0,i.isBoolean)(t.unevaluatedItems)||q(t.unevaluatedItems))}function T(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!C(t)||t.type!==`integer`||t.format!==`int64`?!1:b(t.minimum)&&b(t.exclusiveMinimum)&&b(t.maximum)&&b(t.exclusiveMaximum)&&b(t.multipleOf)&&b(t.default)&&(t.enum===void 0||g(t.enum,m))}function ye(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`boolean`&&v(t.default)}function E(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)?t.anyOf===void 0?t.type!==`integer`&&t.type!==`string`||!(0,i.isSetString)(t.format)||!le.has(t.format)?!1:y(t.minimum)&&y(t.maximum)&&(t.default===void 0||(0,i.isSetString)(t.default)||c(t.default)):g(t.anyOf,E):!1}function D(e){if(!(0,i.isSetObject)(e))return!1;let t=e;if(!C(t)||!(0,i.isSetString)(t.type)||!d.has(t.type)||!Array.isArray(t.enum))return!1;let n=t.type,r=t.enum,a=t.default;return n===`string`?r.every(e=>(0,i.isSetString)(e))&&(a===void 0||(0,i.isSetString)(a)):n===`number`||n===`integer`?r.every(e=>c(e))&&(a===void 0||c(a)):n===`boolean`?r.every(e=>(0,i.isBoolean)(e))&&(a===void 0||(0,i.isBoolean)(a)):n===`null`&&r.every(e=>e===null)&&a==null}function O(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!C(t)||!g(t.allOf,q)?!1:t.unevaluatedProperties===void 0||(0,i.isBoolean)(t.unevaluatedProperties)||q(t.unevaluatedProperties)}function k(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!C(t)||!(`const`in t)?!1:t.type===void 0||(0,i.isSetString)(t.type)&&p(t.type)||ge(t.type)}function A(e){if(!(0,i.isSetObject)(e))return!1;let t=e;if(!C(t)||t.type!==`array`||t.maxItems!==125||!(0,i.isSetObject)(t.items))return!1;let n=t.items;return n.type===`array`&&me(n.prefixItems,q,q)&&(n.items===void 0||n.items===!1)&&n.minItems===2&&n.maxItems===2}function j(e){if(!(0,i.isSetObject)(e))return!1;let t=e,n=t.type===`string`||t.type===`number`||Array.isArray(t.type)&&t.type.length===2&&t.type[0]===`string`&&t.type[1]===`number`;return C(t)&&n&&Array.isArray(t.enum)&&t.enum.every(e=>(0,i.isSetString)(e)||c(e))}function M(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&w(t.not)}function N(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`null`&&(t.const===void 0||t.const===null)&&(t.enum===void 0||Array.isArray(t.enum)&&t.enum.every(e=>e===null))&&(t.default===void 0||t.default===null)}function P(e){if(!(0,i.isSetObject)(e))return!1;let t=e;if(!C(t))return!1;let n=t.anyOf!==void 0&&Array.isArray(t.anyOf)&&t.anyOf.length===2&&q(t.anyOf[0])&&N(t.anyOf[1]),r=Array.isArray(t.type)&&t.type.length===2&&(t.type[0]===`null`&&(0,i.isSetString)(t.type[1])&&t.type[1]!==`null`&&f.has(t.type[1])||t.type[1]===`null`&&(0,i.isSetString)(t.type[0])&&t.type[0]!==`null`&&f.has(t.type[0]));return n||r}function F(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!C(t)||t.type!==`number`&&t.type!==`integer`?!1:_(t.format)&&y(t.minimum)&&y(t.exclusiveMinimum)&&y(t.maximum)&&y(t.exclusiveMaximum)&&y(t.multipleOf)&&y(t.default)&&(t.enum===void 0||g(t.enum,c))}function I(e){return F(e)&&e.type===`integer`}function L(e){return F(e)&&e.type===`number`}function R(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`object`&&(t.properties===void 0||l(t.properties))&&(t.patternProperties===void 0||l(t.patternProperties))&&(t.additionalProperties===void 0||(0,i.isBoolean)(t.additionalProperties)||q(t.additionalProperties))&&(t.required===void 0||u(t.required))&&(t.unevaluatedProperties===void 0||(0,i.isBoolean)(t.unevaluatedProperties)||q(t.unevaluatedProperties))&&(t.dependencies===void 0||(0,i.isSetObject)(t.dependencies)&&Object.values(t.dependencies).every(e=>u(e)||q(e)))&&(t.dependentRequired===void 0||se(t.dependentRequired))&&(t.dependentSchemas===void 0||l(t.dependentSchemas))&&y(t.minProperties)&&y(t.maxProperties)&&(t.primaryKey===void 0||u(t.primaryKey))&&_(t.databaseSchema)}function z(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`string`&&y(t.minLength)&&y(t.maxLength)&&_(t.pattern)&&_(t.format)&&_(t.default)&&(t.enum===void 0||g(t.enum,i.isSetString))&&_(t.contentMediaType)&&_(t.contentEncoding)&&_(t.contentSchema)}function B(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`array`&&t.uniqueItems===!0&&S(t.prefixItems)&&x(t.items)&&x(t.contains)&&y(t.minItems)&&y(t.maxItems)&&y(t.minContains)&&y(t.maxContains)&&(t.unevaluatedItems===void 0||(0,i.isBoolean)(t.unevaluatedItems)||q(t.unevaluatedItems))}function V(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`object`&&(t.patternProperties===void 0||l(t.patternProperties))&&(t.additionalProperties===void 0||(0,i.isBoolean)(t.additionalProperties)||q(t.additionalProperties))&&x(t.propertyNames)}function H(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`array`&&g(t.prefixItems,q)&&y(t.minItems)&&y(t.maxItems)&&x(t.items)&&x(t.contains)&&v(t.uniqueItems)&&y(t.minContains)&&y(t.maxContains)&&(t.unevaluatedItems===void 0||(0,i.isBoolean)(t.unevaluatedItems)||q(t.unevaluatedItems))}function U(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&w(t.not)&&(t.default===void 0||t.default===void 0)}function W(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)?(0,i.isSetString)(t.type)&&d.has(t.type)?t.enum===void 0?!0:Array.isArray(t.enum)?t.type===`string`?t.enum.every(e=>(0,i.isSetString)(e))&&(t.default===void 0||(0,i.isSetString)(t.default)):t.type===`number`?t.enum.every(e=>c(e))&&(t.default===void 0||c(t.default)):t.type===`boolean`?t.enum.every(e=>(0,i.isBoolean)(e))&&(t.default===void 0||(0,i.isBoolean)(t.default)):t.type===`integer`?t.format===`int64`&&t.enum.every(e=>m(e))&&(t.default===void 0||m(t.default)):t.type===`null`&&t.enum.every(e=>e===null)&&(t.default===void 0||t.default===null):!1:he(t.type)&&t.type!==void 0:!1}function G(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&(W(t)||xe(t))}function be(e){return w(e)}function xe(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&g(t.anyOf,q)}function Se(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&(0,i.isSetString)(t.$ref)}function K(e){if(!(0,i.isSetObject)(e))return!1;let t=e;if(!(0,i.isSetObject)(t[`~standard`]))return!1;let n=t[`~standard`];return n.version===1&&(0,i.isFunction)(n.validate)}function Ce(e){if(!(0,i.isSetObject)(e)||!K(e))return!1;let t=e;return t.kind===`schema`&&(0,i.isSetString)(t.type)&&(0,i.isBoolean)(t.async)&&(0,i.isFunction)(t.reference)&&(0,i.isSetString)(t.expects)&&(0,i.isFunction)(t[`~run`])}function q(e){return z(e)||I(e)||L(e)||T(e)||ye(e)||E(e)||D(e)||k(e)||j(e)||N(e)||ve(e)||R(e)||V(e)||H(e)||G(e)||U(e)||Se(e)||M(e)||A(e)||w(e)||P(e)||O(e)||be(e)||B(e)}function we(e){return N(e)}function J(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!(!h(t)||`id`in t&&!(0,i.isSetString)(t.id)||`resolve`in t&&!(0,i.isFunction)(t.resolve)||`properties`in t&&!pe(t.properties)||`required`in t&&!u(t.required)||`title`in t&&!(0,i.isSetString)(t.title)||`description`in t&&!(0,i.isSetString)(t.description)||`$schema`in t&&!(0,i.isSetString)(t.$schema)||`tags`in t&&!u(t.tags)||`args`in t&&(!Array.isArray(t.args)||!t.args.every(e=>fe(e)))||`returns`in t&&!h(t.returns))}function Te(e){return J(e)&&!q(e)}function Ee(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!(`$schema`in t&&!J(t.$schema)||`$resolve`in t&&!(0,i.isFunction)(t.$resolve))}function De(e){if(!Ee(e)||q(e))return!1;let t=e;return!(`$schema`in t&&t.$schema!==void 0&&!Te(t.$schema))}function Y(e){return(0,i.isSetObject)(e)&&`schema`in e&&q(e.schema)&&`variant`in e&&(0,i.isSetString)(e.variant)&&`hash`in e&&(0,i.isSetString)(e.hash)}function Oe(e){return Y(e)}function ke(e){return Y(e)&&`source`in e&&(0,i.isSetObject)(e.source)&&`schema`in e.source&&`variant`in e.source&&(0,i.isSetString)(e.source.variant)}function Ae(e){return Y(e)&&R(e.schema)}function X(e){let t=Y(e)?e.schema:e;if(!q(t))throw TypeError(`The provided input is not a valid JSON Schema`);return t}function Z(e){let t=X(e);if(!R(t))throw TypeError(`The provided input is not a valid JSON Schema object`);return t}function je(e){let t=Z(e);return(0,i.isSetObject)(t.properties)?Object.entries(t.properties).reduce((e,[n,r])=>(r.name=n,r.required=!$(t,n),r.default=t.default?.[n]??r.default,e[n]=r,e),{}):{}}function Me(e){return Object.values(je(e))}function Ne(e,t){let n=Z(e);if(!(0,i.isSetObject)(n.properties))throw TypeError(`The provided schema does not have any properties`);let r=n.properties[t];if(!r)throw TypeError(`The provided schema does not have a property named "${t}"`);return{...r,name:t,required:!$(n,t),default:n.default?.[t]??r?.default}}function Pe(e,t,n){let r=Z(e);r.properties??={},r.required??=[],n.name=t,r.properties[t]=n,r.required.includes(t)||r.required.push(t),r.required.length===0&&delete r.required}function Q(e,n){let r={...e};for(let[e,a]of Object.entries(n)){let n=r[e];if(e===`required`)r[e]=(0,te.getUnique)([...Array.isArray(n)?n:[],...Array.isArray(a)?a:[]]);else if(t.o.has(e)&&(0,i.isSetObject)(n)&&(0,i.isSetObject)(a)){let t={...n};for(let[e,n]of Object.entries(a)){let r=t[e];t[e]=q(r)&&q(n)?Q(r,n):n}r[e]=t}else t.a.has(e)&&Array.isArray(n)&&Array.isArray(a)?r[e]=[...n,...a]:t.s.has(e)&&q(n)&&q(a)?r[e]=Q(n,a):r[e]=a}return r}function Fe(...e){let t=e.map(e=>X(e));return t.length===0?{}:t.reduce((e,t)=>{let n=e.type,r=t.type;return n&&r&&n!==r?t:Q(e,t)})}function Ie(e,n){return(0,o.default)(e,Object.fromEntries(t.t.filter(e=>n[e]!==void 0).map(e=>[e,n[e]])))}function Le(e){return(0,i.isSetObject)(e)?e.nullable===!0||s(e).includes(`null`):!1}function $(e,t){if(!e.properties?.[t])throw Error(`The property "${t}" does not exist in the parent schema.`);return!(e.required??[]).includes(t)}function Re(e){return ee.VALID_OBJECT_SOURCE_EXTENSIONS.includes((0,a.findFileExtensionSafe)(e))}function ze(e,t){let n=[];function r(e){let i=t(e);if(i!==void 0&&n.push(i),R(e))for(let t of Object.values(e.properties??{}))r(t);for(let t of[`allOf`,`anyOf`,`oneOf`,`not`,`if`,`then`,`else`,`$ref`,`items`,`additionalProperties`,`unevaluatedProperties`,`propertyNames`,`unevaluatedItems`,`contains`]){let n=e[t];if(Array.isArray(n))for(let e of n)q(e)&&r(e);else q(n)&&r(n)}}return r(e),n}Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return z}});
@@ -0,0 +1,2 @@
1
+ import{a as e,n as t,o as n,r,s as i,t as a}from"./constants-lk1mMbgx.mjs";import{isSetObject as o}from"@stryke/type-checks/is-set-object";import{isSetString as ee}from"@stryke/type-checks/is-set-string";import{isBoolean as s,isFunction as c,isSetObject as l,isSetString as u,isString as d}from"@stryke/type-checks";import{findFileExtensionSafe as te}from"@stryke/path/find";import{VALID_OBJECT_SOURCE_EXTENSIONS as ne}from"@stryke/resolve/constants";import{getUnique as re}from"@stryke/helpers/get-unique";import ie from"defu";function ae(e,t){if(!t||!o(e))return e;let n={...e},r=n;for(let e of a){let n=t[e];n!=null&&(r[e]=n)}return n}function f(e){if(!o(e))return[];let t=e;return Array.isArray(t.type)?t.type.filter(e=>ee(e)):ee(t.type)&&t.type!==`object`&&t.type!==`array`?[t.type]:[]}function oe(e){if(o(e))return f(e).find(e=>e!==`null`)}function se(e){return!d(e)&&e.file!==void 0}const p=e=>typeof e==`number`&&Number.isFinite(e),ce=e=>l(e)||s(e),m=e=>l(e)&&Object.values(e).every(e=>ce(e)),le=e=>l(e)&&Object.values(e).every(e=>s(e)),h=e=>Array.isArray(e)&&e.every(e=>u(e)),ue=e=>l(e)&&Object.values(e).every(e=>h(e)),g=new Set(t),_=new Set(r);function de(e){return u(e)&&g.has(e)}function v(e){return u(e)&&_.has(e)}const fe=new Set([`date`,`time`,`date-time`,`iso-time`,`iso-date-time`,`unix-time`]),y=e=>typeof e==`bigint`,pe=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`function`,`object`,`any`,`array`]),me=e=>u(e)&&pe.has(e),b=e=>{if(!l(e))return!1;let t=e;return!(t.type!==void 0&&!(u(t.type)&&me(t.type)||Array.isArray(t.type)&&t.type.every(e=>me(e)))||t.tsType!==void 0&&!u(t.tsType)||t.markdownType!==void 0&&!u(t.markdownType)||t.items!==void 0&&!(b(t.items)||Array.isArray(t.items)&&t.items.every(e=>b(e))))},he=e=>{if(!b(e))return!1;let t=e;return t.name!==void 0&&!u(t.name)?!1:t.optional===void 0||typeof t.optional==`boolean`},ge=e=>l(e)&&Object.values(e).every(e=>J(e)),x=(e,t)=>Array.isArray(e)&&e.every(e=>t(e)),_e=(e,t,n)=>Array.isArray(e)&&e.length===2&&t(e[0])&&n(e[1]),S=(e,t=!1)=>e===void 0||d(e)&&(t||e.length>0),C=e=>e===void 0||s(e),w=e=>e===void 0||p(e),T=e=>e===void 0||y(e),E=e=>e===void 0||q(e),D=e=>e===void 0||x(e,q),ve=e=>e===void 0||Array.isArray(e)&&e.every(e=>u(e)&&g.has(e)),ye=e=>e===void 0||Array.isArray(e)&&e.every(e=>u(e)&&_.has(e)),O=e=>!(!S(e.$id)||!S(e.$schema)||e.$vocabulary!==void 0&&!le(e.$vocabulary)||!S(e.$comment,!0)||!S(e.$anchor)||e.$defs!==void 0&&!m(e.$defs)||!S(e.$dynamicRef)||!S(e.$dynamicAnchor)||!S(e.name)||!S(e.title,!0)||!S(e.description,!0)||!S(e.docs,!0)||e.examples!==void 0&&!Array.isArray(e.examples)||e.alias!==void 0&&!h(e.alias)||e.tags!==void 0&&!h(e.tags)||!C(e.deprecated)||!C(e.hidden)||!C(e.ignore)||!C(e.internal)||!C(e.runtime)||!C(e.readOnly)||!C(e.writeOnly)||!D(e.allOf)||!D(e.anyOf)||!D(e.oneOf)||!E(e.not)||!E(e.if)||!E(e.then)||!E(e.else));function be(e){return l(e)?O(e):!1}function k(e){if(!l(e))return!1;let n=e;return O(n)&&S(n.$ref)&&(!n.type||Array.isArray(n.type)&&n.type.every(e=>t.includes(e)))}function A(e){if(!l(e))return!1;let t=e;return!O(t)||t.type!==`array`?!1:D(t.prefixItems)&&E(t.items)&&E(t.contains)&&w(t.minItems)&&w(t.maxItems)&&C(t.uniqueItems)&&w(t.minContains)&&w(t.maxContains)&&(t.unevaluatedItems===void 0||s(t.unevaluatedItems)||q(t.unevaluatedItems))}function j(e){if(!l(e))return!1;let t=e;return!O(t)||t.type!==`integer`||t.format!==`int64`?!1:T(t.minimum)&&T(t.exclusiveMinimum)&&T(t.maximum)&&T(t.exclusiveMaximum)&&T(t.multipleOf)&&T(t.default)&&(t.enum===void 0||x(t.enum,y))}function M(e){if(!l(e))return!1;let t=e;return O(t)&&t.type===`boolean`&&C(t.default)}function N(e){if(!l(e))return!1;let t=e;return O(t)?t.anyOf===void 0?t.type!==`integer`&&t.type!==`string`||!u(t.format)||!fe.has(t.format)?!1:w(t.minimum)&&w(t.maximum)&&(t.default===void 0||u(t.default)||p(t.default)):x(t.anyOf,N):!1}function P(e){if(!l(e))return!1;let t=e;if(!O(t)||!u(t.type)||!g.has(t.type)||!Array.isArray(t.enum))return!1;let n=t.type,r=t.enum,i=t.default;return n===`string`?r.every(e=>u(e))&&(i===void 0||u(i)):n===`number`||n===`integer`?r.every(e=>p(e))&&(i===void 0||p(i)):n===`boolean`?r.every(e=>s(e))&&(i===void 0||s(i)):n===`null`&&r.every(e=>e===null)&&i==null}function F(e){if(!l(e))return!1;let t=e;return!O(t)||!x(t.allOf,q)?!1:t.unevaluatedProperties===void 0||s(t.unevaluatedProperties)||q(t.unevaluatedProperties)}function I(e){if(!l(e))return!1;let t=e;return!O(t)||!(`const`in t)?!1:t.type===void 0||u(t.type)&&v(t.type)||ye(t.type)}function L(e){if(!l(e))return!1;let t=e;if(!O(t)||t.type!==`array`||t.maxItems!==125||!l(t.items))return!1;let n=t.items;return n.type===`array`&&_e(n.prefixItems,q,q)&&(n.items===void 0||n.items===!1)&&n.minItems===2&&n.maxItems===2}function R(e){if(!l(e))return!1;let t=e,n=t.type===`string`||t.type===`number`||Array.isArray(t.type)&&t.type.length===2&&t.type[0]===`string`&&t.type[1]===`number`;return O(t)&&n&&Array.isArray(t.enum)&&t.enum.every(e=>u(e)||p(e))}function z(e){if(!l(e))return!1;let t=e;return O(t)&&k(t.not)}function B(e){if(!l(e))return!1;let t=e;return O(t)&&t.type===`null`&&(t.const===void 0||t.const===null)&&(t.enum===void 0||Array.isArray(t.enum)&&t.enum.every(e=>e===null))&&(t.default===void 0||t.default===null)}function V(e){if(!l(e))return!1;let t=e;if(!O(t))return!1;let n=t.anyOf!==void 0&&Array.isArray(t.anyOf)&&t.anyOf.length===2&&q(t.anyOf[0])&&B(t.anyOf[1]),r=Array.isArray(t.type)&&t.type.length===2&&(t.type[0]===`null`&&u(t.type[1])&&t.type[1]!==`null`&&_.has(t.type[1])||t.type[1]===`null`&&u(t.type[0])&&t.type[0]!==`null`&&_.has(t.type[0]));return n||r}function H(e){if(!l(e))return!1;let t=e;return!O(t)||t.type!==`number`&&t.type!==`integer`?!1:S(t.format)&&w(t.minimum)&&w(t.exclusiveMinimum)&&w(t.maximum)&&w(t.exclusiveMaximum)&&w(t.multipleOf)&&w(t.default)&&(t.enum===void 0||x(t.enum,p))}function U(e){return H(e)&&e.type===`integer`}function W(e){return H(e)&&e.type===`number`}function G(e){if(!l(e))return!1;let t=e;return O(t)&&t.type===`object`&&(t.properties===void 0||m(t.properties))&&(t.patternProperties===void 0||m(t.patternProperties))&&(t.additionalProperties===void 0||s(t.additionalProperties)||q(t.additionalProperties))&&(t.required===void 0||h(t.required))&&(t.unevaluatedProperties===void 0||s(t.unevaluatedProperties)||q(t.unevaluatedProperties))&&(t.dependencies===void 0||l(t.dependencies)&&Object.values(t.dependencies).every(e=>h(e)||q(e)))&&(t.dependentRequired===void 0||ue(t.dependentRequired))&&(t.dependentSchemas===void 0||m(t.dependentSchemas))&&w(t.minProperties)&&w(t.maxProperties)&&(t.primaryKey===void 0||h(t.primaryKey))&&S(t.databaseSchema)}function K(e){if(!l(e))return!1;let t=e;return O(t)&&t.type===`string`&&w(t.minLength)&&w(t.maxLength)&&S(t.pattern)&&S(t.format)&&S(t.default)&&(t.enum===void 0||x(t.enum,u))&&S(t.contentMediaType)&&S(t.contentEncoding)&&S(t.contentSchema)}function xe(e){if(!l(e))return!1;let t=e;return O(t)&&t.type===`array`&&t.uniqueItems===!0&&D(t.prefixItems)&&E(t.items)&&E(t.contains)&&w(t.minItems)&&w(t.maxItems)&&w(t.minContains)&&w(t.maxContains)&&(t.unevaluatedItems===void 0||s(t.unevaluatedItems)||q(t.unevaluatedItems))}function Se(e){if(!l(e))return!1;let t=e;return O(t)&&t.type===`object`&&(t.patternProperties===void 0||m(t.patternProperties))&&(t.additionalProperties===void 0||s(t.additionalProperties)||q(t.additionalProperties))&&E(t.propertyNames)}function Ce(e){if(!l(e))return!1;let t=e;return O(t)&&t.type===`array`&&x(t.prefixItems,q)&&w(t.minItems)&&w(t.maxItems)&&E(t.items)&&E(t.contains)&&C(t.uniqueItems)&&w(t.minContains)&&w(t.maxContains)&&(t.unevaluatedItems===void 0||s(t.unevaluatedItems)||q(t.unevaluatedItems))}function we(e){if(!l(e))return!1;let t=e;return O(t)&&k(t.not)&&(t.default===void 0||t.default===void 0)}function Te(e){if(!l(e))return!1;let t=e;return O(t)?u(t.type)&&g.has(t.type)?t.enum===void 0?!0:Array.isArray(t.enum)?t.type===`string`?t.enum.every(e=>u(e))&&(t.default===void 0||u(t.default)):t.type===`number`?t.enum.every(e=>p(e))&&(t.default===void 0||p(t.default)):t.type===`boolean`?t.enum.every(e=>s(e))&&(t.default===void 0||s(t.default)):t.type===`integer`?t.format===`int64`&&t.enum.every(e=>y(e))&&(t.default===void 0||y(t.default)):t.type===`null`&&t.enum.every(e=>e===null)&&(t.default===void 0||t.default===null):!1:ve(t.type)&&t.type!==void 0:!1}function Ee(e){if(!l(e))return!1;let t=e;return O(t)&&(Te(t)||Oe(t))}function De(e){return k(e)}function Oe(e){if(!l(e))return!1;let t=e;return O(t)&&x(t.anyOf,q)}function ke(e){if(!l(e))return!1;let t=e;return O(t)&&u(t.$ref)}function Ae(e){if(!l(e))return!1;let t=e;if(!l(t[`~standard`]))return!1;let n=t[`~standard`];return n.version===1&&c(n.validate)}function je(e){if(!l(e)||!Ae(e))return!1;let t=e;return t.kind===`schema`&&u(t.type)&&s(t.async)&&c(t.reference)&&u(t.expects)&&c(t[`~run`])}function q(e){return K(e)||U(e)||W(e)||j(e)||M(e)||N(e)||P(e)||I(e)||R(e)||B(e)||A(e)||G(e)||Se(e)||Ce(e)||Ee(e)||we(e)||ke(e)||z(e)||L(e)||k(e)||V(e)||F(e)||De(e)||xe(e)}function Me(e){return B(e)}function J(e){if(!l(e))return!1;let t=e;return!(!b(t)||`id`in t&&!u(t.id)||`resolve`in t&&!c(t.resolve)||`properties`in t&&!ge(t.properties)||`required`in t&&!h(t.required)||`title`in t&&!u(t.title)||`description`in t&&!u(t.description)||`$schema`in t&&!u(t.$schema)||`tags`in t&&!h(t.tags)||`args`in t&&(!Array.isArray(t.args)||!t.args.every(e=>he(e)))||`returns`in t&&!b(t.returns))}function Ne(e){return J(e)&&!q(e)}function Pe(e){if(!l(e))return!1;let t=e;return!(`$schema`in t&&!J(t.$schema)||`$resolve`in t&&!c(t.$resolve))}function Fe(e){if(!Pe(e)||q(e))return!1;let t=e;return!(`$schema`in t&&t.$schema!==void 0&&!Ne(t.$schema))}function Y(e){return l(e)&&`schema`in e&&q(e.schema)&&`variant`in e&&u(e.variant)&&`hash`in e&&u(e.hash)}function Ie(e){return Y(e)}function Le(e){return Y(e)&&`source`in e&&l(e.source)&&`schema`in e.source&&`variant`in e.source&&u(e.source.variant)}function Re(e){return Y(e)&&G(e.schema)}function X(e){let t=Y(e)?e.schema:e;if(!q(t))throw TypeError(`The provided input is not a valid JSON Schema`);return t}function Z(e){let t=X(e);if(!G(t))throw TypeError(`The provided input is not a valid JSON Schema object`);return t}function ze(e){let t=Z(e);return l(t.properties)?Object.entries(t.properties).reduce((e,[n,r])=>(r.name=n,r.required=!$(t,n),r.default=t.default?.[n]??r.default,e[n]=r,e),{}):{}}function Be(e){return Object.values(ze(e))}function Ve(e,t){let n=Z(e);if(!l(n.properties))throw TypeError(`The provided schema does not have any properties`);let r=n.properties[t];if(!r)throw TypeError(`The provided schema does not have a property named "${t}"`);return{...r,name:t,required:!$(n,t),default:n.default?.[t]??r?.default}}function He(e,t,n){let r=Z(e);r.properties??={},r.required??=[],n.name=t,r.properties[t]=n,r.required.includes(t)||r.required.push(t),r.required.length===0&&delete r.required}function Q(t,r){let a={...t};for(let[t,o]of Object.entries(r)){let r=a[t];if(t===`required`)a[t]=re([...Array.isArray(r)?r:[],...Array.isArray(o)?o:[]]);else if(n.has(t)&&l(r)&&l(o)){let e={...r};for(let[t,n]of Object.entries(o)){let r=e[t];e[t]=q(r)&&q(n)?Q(r,n):n}a[t]=e}else e.has(t)&&Array.isArray(r)&&Array.isArray(o)?a[t]=[...r,...o]:i.has(t)&&q(r)&&q(o)?a[t]=Q(r,o):a[t]=o}return a}function Ue(...e){let t=e.map(e=>X(e));return t.length===0?{}:t.reduce((e,t)=>{let n=e.type,r=t.type;return n&&r&&n!==r?t:Q(e,t)})}function We(e,t){return ie(e,Object.fromEntries(a.filter(e=>t[e]!==void 0).map(e=>[e,t[e]])))}function Ge(e){return l(e)?e.nullable===!0||f(e).includes(`null`):!1}function $(e,t){if(!e.properties?.[t])throw Error(`The property "${t}" does not exist in the parent schema.`);return!(e.required??[]).includes(t)}function Ke(e){return ne.includes(te(e))}function qe(e,t){let n=[];function r(e){let i=t(e);if(i!==void 0&&n.push(i),G(e))for(let t of Object.values(e.properties??{}))r(t);for(let t of[`allOf`,`anyOf`,`oneOf`,`not`,`if`,`then`,`else`,`$ref`,`items`,`additionalProperties`,`unevaluatedProperties`,`propertyNames`,`unevaluatedItems`,`contains`]){let n=e[t];if(Array.isArray(n))for(let e of n)q(e)&&r(e);else q(n)&&r(n)}}return r(e),n}export{J as $,B as A,Ce as B,P as C,L as D,I as E,Te as F,Me as G,we as H,Se as I,Ie as J,Y as K,ke as L,H as M,G as N,R as O,de as P,Fe as Q,xe as R,W as S,be as T,Ee as U,v as V,De as W,Ae as X,Le as Y,Pe as Z,Oe as _,Be as a,M as b,Ge as c,We as d,Ne as et,qe as f,k as g,F as h,ze as i,f as it,V as j,z as k,Ke as l,q as m,X as n,ae as nt,Ve as o,se as p,Re as q,Z as r,oe as rt,$ as s,He as t,je as tt,Ue as u,A as v,U as w,N as x,j as y,K as z};
2
+ //# sourceMappingURL=helpers-s2Zqtb-K.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers-s2Zqtb-K.mjs","names":[],"sources":[],"mappings":""}
package/dist/index.cjs CHANGED
@@ -1 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./constants-CjTQhR-l.cjs"),t=require("./storage-CgfRQlqS.cjs"),n=require("./helpers-CrePPGkD.cjs");let r=require("@stryke/convert/extract-file-reference"),i=require("@stryke/hash"),a=require("@stryke/helpers/deep-clone"),o=require("@stryke/json"),s=require("@stryke/path/find"),c=require("@stryke/resolve/constants"),l=require("@stryke/resolve/load"),u=require("@stryke/string-format/list"),d=require("@stryke/type-checks"),f=require("@stryke/type-checks/is-set-object"),p=require("@stryke/zod"),m=require("@valibot/to-json-schema"),h=require("ts-json-schema-generator/dist/factory/generator.js");const g=`https://power-plant.invalid/`;function _(e){return!(!(0,f.isSetObject)(e)||!(`schema`in e)||`hash`in e||`variant`in e||`source`in e)}function v(e){return _(e)?e.schema:e}function y(e){return e.endsWith(`#`)?e.slice(0,-1):e}function b(e){let t=e.indexOf(`#`);return t>=0?e.slice(0,t):e}function x(e){return e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}function S(e){return e.length===0?``:`/${e.map(e=>x(e)).join(`/`)}`}function C(e,t){try{return y(new URL(e,t).toString())}catch{return y(e)}}function w(e,t,n,r,i){if(!(0,f.isSetObject)(e))return;let a=e,o=S(t),s=(0,d.isSetString)(a.$id)?C(a.$id,n):n,c=b(s);if(r.set(s,o),r.set(c,o),(0,d.isSetString)(a.$anchor)&&r.set(`${c}#${a.$anchor}`,o),(0,d.isSetString)(a.$dynamicAnchor)){let e=`${c}#${a.$dynamicAnchor}`;r.set(e,o),i.set(e,`#${a.$dynamicAnchor}`)}for(let[e,n]of Object.entries(a)){if(Array.isArray(n)){n.forEach((n,a)=>{w(n,[...t,e,String(a)],s,r,i)});continue}w(n,[...t,e],s,r,i)}}function T(e,t,n,r,i){if(!(0,f.isSetObject)(e))return;let a=e,o=(0,d.isSetString)(a.$id)?C(a.$id,n):n;if((0,d.isSetString)(a.$ref)){let e=C(a.$ref,o),t=r.get(e)??r.get(b(e));t!==void 0&&(a.$ref=t.length>0?`#${t}`:`#`)}if((0,d.isSetString)(a.$dynamicRef)){let e=C(a.$dynamicRef,o),t=i.get(e);if(t)a.$dynamicRef=t;else{let t=r.get(e)??r.get(b(e));t!==void 0&&(a.$dynamicRef=t.length>0?`#${t}`:`#`)}}for(let[e,n]of Object.entries(a)){if(Array.isArray(n)){n.forEach((n,a)=>{T(n,[...t,e,String(a)],o,r,i)});continue}T(n,[...t,e],o,r,i)}}function E(e){if(!(0,f.isSetObject)(e))return e;let t=(0,a.deepClone)(e),n=(0,d.isSetString)(t.$id)?C(t.$id,g):g,r=new Map,i=new Map;return w(t,[],n,r,i),T(t,[],n,r,i),t}function D(e){if(n.nt(e))return A(e);if((0,f.isSetObject)(e)){if(n.et(e))return j(e);let t=e;if(`$schema`in t&&n.nt(t.$schema))return A(t.$schema)}return e}function O(e){return Array.isArray(e)?e.map(e=>D(e)):e}function k(e){return(0,m.toJsonSchema)(e,{target:`draft-2020-12`})}function A(e){let t=e,n={};for(let[e,r]of Object.entries(t))if(e!==`tsType`&&e!==`markdownType`&&e!==`tags`&&e!==`args`&&e!==`resolve`){if(e===`id`&&(0,d.isSetString)(r)){n.$id=r;continue}if(e===`properties`||e===`patternProperties`||e===`dependentSchemas`||e===`$defs`||e===`definitions`){if(!(0,f.isSetObject)(r)){n[e]=r;continue}n[e]=Object.fromEntries(Object.entries(r).map(([e,t])=>[e,D(t)]));continue}if(e===`items`||e===`contains`||e===`if`||e===`then`||e===`else`||e===`not`||e===`propertyNames`||e===`additionalProperties`||e===`unevaluatedProperties`){n[e]=D(r);continue}if(e===`oneOf`||e===`anyOf`||e===`allOf`){n[e]=O(r);continue}n[e]=r}return n}function j(e){let t=e,r=n.nt(t.$schema)?A(t.$schema):{},i={};for(let[e,r]of Object.entries(t)){if(e.startsWith(`$`)||!(0,f.isSetObject)(r))continue;if(n.et(r)){i[e]=j(r);continue}let t=r;if(`$schema`in t&&n.nt(t.$schema)){i[e]=A(t.$schema);continue}n.nt(r)&&(i[e]=A(r))}if(!n.I(r))throw Error(`Failed to convert untyped input to JSON Schema. The base schema must be a valid JSON Schema object.`);let a={...(0,f.isSetObject)(r.properties)?r.properties:{},...i};return{...r,type:r.type??`object`,...Object.keys(a).length>0?{properties:a}:{}}}function M(e,t){let r=v(t);if(n.Q(r)||n.Y(r))return(0,i.murmurhash)({variant:e,input:r.schema});if((0,d.isSetString)(r)||typeof r==`boolean`)return(0,i.murmurhash)({variant:e,input:r});if((0,f.isSetObject)(r)){if((0,p.isZod3Type)(r))return(0,i.murmurhash)({variant:e,input:r._def});if((0,o.isStandardJsonSchema)(r))return(0,i.murmurhash)({variant:e,input:r[`~standard`]});if(n._(r))return(0,i.murmurhash)({variant:e,input:r});if(n.it(r))return(0,i.murmurhash)({variant:e,input:k(r)});if(n.et(r))return(0,i.murmurhash)({variant:e,input:j(r)});if(n.nt(r))return(0,i.murmurhash)({variant:e,input:A(r)})}throw Error(`Failed to create an input hash for the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, or a reflected Deepkit Type object.`)}function N(e){if((0,f.isSetObject)(e)){if((0,p.isZod3Type)(e))return(0,p.extractJsonSchema)(e,{target:`draft-2020-12`});if(n.tt(e))return j(e);if(n.rt(e))return A(e);if((0,o.isStandardJsonSchema)(e))return e[`~standard`].jsonSchema.input({target:`draft-2020-12`});if(n.it(e))return k(e);if(n._(e))return e}}function P(e){if((0,f.isSetObject)(e)){if((0,p.isZod3Type)(e))return`zod3`;if(n.tt(e)||n.rt(e))return`untyped`;if((0,o.isStandardJsonSchema)(e))return`standard-schema`;if(n._(e))return`json-schema`;if(n.it(e))return`valibot`}throw Error(`Failed to determine the variant of the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, a reflected Deepkit Type object, or an Untyped schema.`)}function F(e){let t=v(e);return n.Q(t)||n.Y(t)?t.variant:(0,d.isSetString)(t)||n.g(t)?`file-reference`:P(t)}async function I(e,t){if(n.Q(e))return e.schema;let r=t??P(e),i;if((r===`zod3`||r===`json-schema`||r===`standard-schema`||r===`untyped`||r===`valibot`)&&(i=N(e)),i)return E(i);throw Error(`Failed to extract a valid schema from the provided input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, an untyped schema, or a reflected Deepkit Type object.`)}function L(e,t){if(e===`zod3`)return{hash:M(e,t),variant:`zod3`,schema:t};if(e===`untyped`)return{hash:M(e,t),variant:`untyped`,schema:t};if(e===`standard-schema`)return{hash:M(e,t),variant:`standard-schema`,schema:t};if(e===`json-schema`)return{hash:M(e,t),variant:`json-schema`,schema:t};if(e===`valibot`)return{hash:M(e,t),variant:`valibot`,schema:t};throw Error(`Failed to extract source information from the provided input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, an untyped schema, or a reflected Deepkit Type object.`)}async function R(e,t={}){let n=(0,r.extractFileReference)(e);if(!n)throw Error(`Failed to extract a file reference from the provided input. The input must be a string or an object with a "file" property that specifies the file path and optional export name.`);let i=n.export??`*`;try{return(0,h.createGenerator)({path:n.file,type:i,expose:`export`,jsDoc:`extended`,...t}).createSchema(i)}catch(e){throw Error(`Failed to generate a JSON schema for "${n.file}" using the type "${i}". Error: ${e.message}`)}}async function z(e,i={}){let a=v(e);if(n.Q(a))return a;if(n.Y(a))return{...a,source:{hash:M(`json-schema`,a.schema),variant:`json-schema`,schema:a.schema}};let o,d=F(a),f=M(d,a);if(d===`file-reference`){let e=(0,r.extractFileReference)(a);if(!e)throw Error(`Failed to extract a valid file reference from the provided input "${JSON.stringify(a)}". Please ensure that the input is correctly formatted as a file reference (e.g. "./schema.ts#MySchema") and that the file exists at the specified path.`);let d=(0,s.findFileExtensionSafe)(e.file);if(d&&!c.VALID_OBJECT_SOURCE_EXTENSIONS.includes(d))throw Error(`The provided schema file input "${e.file}" has an invalid file extension (.${d}). Please ensure that the file has one of the following extensions: ${(0,u.list)(c.VALID_OBJECT_SOURCE_EXTENSIONS,{conjunction:`or`})}.`);let f;i.storage&&(f=t.t(i.storage));let p=await(0,l.loadSafe)(a,{...i,fs:f});p??=await R(a,{...i,fs:f});let m=v(p);o=n.Q(m)?m.source:n.Y(m)?{hash:M(`json-schema`,m.schema),variant:`json-schema`,schema:m.schema}:L(P(m),m)}else if([`json-schema`,`standard-schema`,`zod3`,`untyped`,`valibot`,`reflection`].includes(d))o=L(d,a);else throw Error(`Invalid schema definition input "${d}". The variant must be one of "file-reference", "json-schema", "standard-schema", "zod3", "valibot", "untyped", or "reflection".`);return{variant:d,source:o,schema:await I(o.schema,o.variant),hash:f}}async function B(e,t={}){let r=v(e);if(n.Q(r)||n.Z(r))return r;let i=await z(e,t);if(!i?.schema)throw Error(`Failed to extract a valid schema from the provided input. The input must be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a reflected Deepkit Type object.`);return i}exports.JSON_SCHEMA_METADATA_KEYS=e.t,exports.JSON_SCHEMA_PRIMITIVE_TYPES=e.n,exports.JSON_SCHEMA_TYPES=e.r,exports.JsonSchemaTypeNames=e.i,exports.SCHEMA_ARRAY_CONCAT_KEYWORDS=e.a,exports.SCHEMA_RECORD_KEYWORDS=e.o,exports.SCHEMA_SINGLE_KEYWORDS=e.s,exports.addProperty=n.t,exports.applyJsonSchemaMetadata=n.p,exports.bundleReferences=E,exports.createStoragePromises=t.n,exports.extract=B,exports.extractHash=M,exports.extractJsonSchema=N,exports.extractResolvedVariant=P,exports.extractSchema=I,exports.extractSchemaWithSource=z,exports.extractSource=L,exports.extractTSType=R,exports.extractVariant=F,exports.getJsonSchema=n.n,exports.getJsonSchemaObject=n.r,exports.getPrimarySchemaType=n.m,exports.getProperties=n.i,exports.getPropertiesList=n.a,exports.getProperty=n.o,exports.isFileReference=n.g,exports.isJsonSchema=n._,exports.isJsonSchemaAllOf=n.v,exports.isJsonSchemaAny=n.y,exports.isJsonSchemaAnyOf=n.b,exports.isJsonSchemaArray=n.x,exports.isJsonSchemaBigint=n.S,exports.isJsonSchemaBoolean=n.C,exports.isJsonSchemaDate=n.w,exports.isJsonSchemaDecimal=n.T,exports.isJsonSchemaEnum=n.E,exports.isJsonSchemaInteger=n.D,exports.isJsonSchemaKeywords=n.O,exports.isJsonSchemaLiteral=n.k,exports.isJsonSchemaMap=n.A,exports.isJsonSchemaNativeEnum=n.j,exports.isJsonSchemaNever=n.M,exports.isJsonSchemaNull=n.N,exports.isJsonSchemaNullable=n.P,exports.isJsonSchemaNumber=n.F,exports.isJsonSchemaObject=n.I,exports.isJsonSchemaPrimitiveType=n.L,exports.isJsonSchemaPrimitiveUnion=n.R,exports.isJsonSchemaRecord=n.z,exports.isJsonSchemaRef=n.B,exports.isJsonSchemaSet=n.V,exports.isJsonSchemaString=n.H,exports.isJsonSchemaTuple=n.U,exports.isJsonSchemaType=n.W,exports.isJsonSchemaUndefined=n.G,exports.isJsonSchemaUnion=n.K,exports.isJsonSchemaUnknown=n.q,exports.isNullOnlyJsonSchema=n.J,exports.isPropertyOptional=n.s,exports.isSchema=n.Y,exports.isSchemaNullable=n.c,exports.isSchemaObject=n.X,exports.isSchemaOf=n.Z,exports.isSchemaWithSource=n.Q,exports.isStandardSchema=n.$,exports.isUntypedConfig=n.et,exports.isUntypedConfigStrict=n.tt,exports.isUntypedSchema=n.nt,exports.isUntypedSchemaStrict=n.rt,exports.isValibotSchema=n.it,exports.isValidSchemaConfigFile=n.l,exports.mapStorageToFileSystem=t.t,exports.merge=n.u,exports.mergeMetadata=n.d,exports.normalizeKey=t.r,exports.readSchemaTypes=n.h,exports.traverseSchema=n.f;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./constants-CjTQhR-l.cjs"),t=require("./helpers-CFED4EbH.cjs"),n=require("./storage-CgfRQlqS.cjs");let r=require("@stryke/type-checks/is-set-object"),i=require("@stryke/type-checks/is-set-string"),a=require("@stryke/type-checks"),o=require("@stryke/convert/extract-file-reference"),s=require("@stryke/hash"),c=require("@stryke/helpers/deep-clone"),l=require("@stryke/json"),u=require("@stryke/path/find"),d=require("@stryke/resolve/constants"),f=require("@stryke/resolve/load"),p=require("@stryke/string-format/list"),m=require("@stryke/zod"),h=require("@valibot/to-json-schema"),g=require("ts-json-schema-generator/dist/factory/generator.js");const _=new Set([...e.t,`default`,`examples`]);function v(e){return _.has(e)}function y(e){return!(0,r.isSetObject)(e)||e.type===`any`||Object.keys(e).filter(e=>!v(e)).length===0}function b(e){if(y(e))return`any`;let n=e.type;if((0,i.isSetString)(n))return[n];if(Array.isArray(n))return n.filter(i.isSetString);let r=t.it(e);return r.length>0?r:t.N(e)?[`object`]:t.v(e)?[`array`]:`any`}function x(e){return e.length>0?e:`schema`}function S(e,t){return JSON.stringify(e)===JSON.stringify(t)}function C(e,n,r=``){let i=[];if(y(e)||y(n))return i;let a=b(e),o=b(n);if(a!==`any`&&o!==`any`&&a.filter(e=>o.includes(e)).length===0)return i.push(`${x(r)} has conflicting types: ${a.join(`|`)} vs ${o.join(`|`)}`),i;let s=e.const,c=n.const;s!==void 0&&c!==void 0&&!S(s,c)&&i.push(`${x(r)} has conflicting const values`);let l=e.enum,u=n.enum;if(l?.length&&u?.length&&(u.some(e=>l.some(t=>S(t,e)))||i.push(`${x(r)} has enum values that do not overlap`)),t.N(e)&&t.N(n)){let a=e.properties??{},o=n.properties??{};for(let[e,n]of Object.entries(o)){let o=a[e],s=r?`${r}.${e}`:e;o&&t.m(o)&&t.m(n)&&i.push(...C(o,n,s))}}if(t.v(e)&&t.v(n)){let a=e.items,o=n.items;a&&o&&t.m(a)&&t.m(o)&&i.push(...C(a,o,r?`${r}[]`:`items`));let s=e.prefixItems,c=n.prefixItems;if(Array.isArray(s)&&Array.isArray(c)){let e=Math.min(s.length,c.length);for(let n=0;n<e;n++){let e=s[n],a=c[n];t.m(e)&&t.m(a)&&i.push(...C(e,a,r?`${r}[${n}]`:`[${n}]`))}}}return i}function w(e,t,n=`schema`){let r=C(e,t);if(r.length>0)throw Error(`The ${n} schema contradicts the generator schema:\n${r.map(e=>`- ${e}`).join(`
2
+ `)}`)}const T=`https://power-plant.invalid/`;function E(e){return!(!(0,r.isSetObject)(e)||!(`schema`in e)||`hash`in e||`variant`in e||`source`in e)}function D(e){return E(e)?e.schema:e}function O(e){return e.endsWith(`#`)?e.slice(0,-1):e}function k(e){let t=e.indexOf(`#`);return t>=0?e.slice(0,t):e}function A(e){return e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}function j(e){return e.length===0?``:`/${e.map(e=>A(e)).join(`/`)}`}function M(e,t){try{return O(new URL(e,t).toString())}catch{return O(e)}}function N(e,t,n,i,o){if(!(0,r.isSetObject)(e))return;let s=e,c=j(t),l=(0,a.isSetString)(s.$id)?M(s.$id,n):n,u=k(l);if(i.set(l,c),i.set(u,c),(0,a.isSetString)(s.$anchor)&&i.set(`${u}#${s.$anchor}`,c),(0,a.isSetString)(s.$dynamicAnchor)){let e=`${u}#${s.$dynamicAnchor}`;i.set(e,c),o.set(e,`#${s.$dynamicAnchor}`)}for(let[e,n]of Object.entries(s)){if(Array.isArray(n)){n.forEach((n,r)=>{N(n,[...t,e,String(r)],l,i,o)});continue}N(n,[...t,e],l,i,o)}}function P(e,t,n,i,o){if(!(0,r.isSetObject)(e))return;let s=e,c=(0,a.isSetString)(s.$id)?M(s.$id,n):n;if((0,a.isSetString)(s.$ref)){let e=M(s.$ref,c),t=i.get(e)??i.get(k(e));t!==void 0&&(s.$ref=t.length>0?`#${t}`:`#`)}if((0,a.isSetString)(s.$dynamicRef)){let e=M(s.$dynamicRef,c),t=o.get(e);if(t)s.$dynamicRef=t;else{let t=i.get(e)??i.get(k(e));t!==void 0&&(s.$dynamicRef=t.length>0?`#${t}`:`#`)}}for(let[e,n]of Object.entries(s)){if(Array.isArray(n)){n.forEach((n,r)=>{P(n,[...t,e,String(r)],c,i,o)});continue}P(n,[...t,e],c,i,o)}}function F(e){if(!(0,r.isSetObject)(e))return e;let t=(0,c.deepClone)(e),n=(0,a.isSetString)(t.$id)?M(t.$id,T):T,i=new Map,o=new Map;return N(t,[],n,i,o),P(t,[],n,i,o),t}function I(e){if(t.$(e))return z(e);if((0,r.isSetObject)(e)){if(t.Z(e))return B(e);let n=e;if(`$schema`in n&&t.$(n.$schema))return z(n.$schema)}return e}function L(e){return Array.isArray(e)?e.map(e=>I(e)):e}function R(e){return(0,h.toJsonSchema)(e,{target:`draft-2020-12`})}function z(e){let t=e,n={};for(let[e,i]of Object.entries(t))if(e!==`tsType`&&e!==`markdownType`&&e!==`tags`&&e!==`args`&&e!==`resolve`){if(e===`id`&&(0,a.isSetString)(i)){n.$id=i;continue}if(e===`properties`||e===`patternProperties`||e===`dependentSchemas`||e===`$defs`||e===`definitions`){if(!(0,r.isSetObject)(i)){n[e]=i;continue}n[e]=Object.fromEntries(Object.entries(i).map(([e,t])=>[e,I(t)]));continue}if(e===`items`||e===`contains`||e===`if`||e===`then`||e===`else`||e===`not`||e===`propertyNames`||e===`additionalProperties`||e===`unevaluatedProperties`){n[e]=I(i);continue}if(e===`oneOf`||e===`anyOf`||e===`allOf`){n[e]=L(i);continue}n[e]=i}return n}function B(e){let n=e,i=t.$(n.$schema)?z(n.$schema):{},a={};for(let[e,i]of Object.entries(n)){if(e.startsWith(`$`)||!(0,r.isSetObject)(i))continue;if(t.Z(i)){a[e]=B(i);continue}let n=i;if(`$schema`in n&&t.$(n.$schema)){a[e]=z(n.$schema);continue}t.$(i)&&(a[e]=z(i))}if(!t.N(i))throw Error(`Failed to convert untyped input to JSON Schema. The base schema must be a valid JSON Schema object.`);let o={...(0,r.isSetObject)(i.properties)?i.properties:{},...a};return{...i,type:i.type??`object`,...Object.keys(o).length>0?{properties:o}:{}}}function V(e,n){let i=D(n);if(t.Y(i)||t.K(i))return(0,s.murmurhash)({variant:e,input:i.schema});if((0,a.isSetString)(i)||typeof i==`boolean`)return(0,s.murmurhash)({variant:e,input:i});if((0,r.isSetObject)(i)){if((0,m.isZod3Type)(i))return(0,s.murmurhash)({variant:e,input:i._def});if((0,l.isStandardJsonSchema)(i))return(0,s.murmurhash)({variant:e,input:i[`~standard`]});if(t.m(i))return(0,s.murmurhash)({variant:e,input:i});if(t.tt(i))return(0,s.murmurhash)({variant:e,input:R(i)});if(t.Z(i))return(0,s.murmurhash)({variant:e,input:B(i)});if(t.$(i))return(0,s.murmurhash)({variant:e,input:z(i)})}throw Error(`Failed to create an input hash for the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, or a reflected Deepkit Type object.`)}function H(e){if((0,r.isSetObject)(e)){if((0,m.isZod3Type)(e))return(0,m.extractJsonSchema)(e,{target:`draft-2020-12`});if(t.Q(e))return B(e);if(t.et(e))return z(e);if((0,l.isStandardJsonSchema)(e))return e[`~standard`].jsonSchema.input({target:`draft-2020-12`});if(t.tt(e))return R(e);if(t.m(e))return e}}function U(e){if((0,r.isSetObject)(e)){if((0,m.isZod3Type)(e))return`zod3`;if(t.Q(e)||t.et(e))return`untyped`;if((0,l.isStandardJsonSchema)(e))return`standard-schema`;if(t.m(e))return`json-schema`;if(t.tt(e))return`valibot`}throw Error(`Failed to determine the variant of the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, a reflected Deepkit Type object, or an Untyped schema.`)}function W(e){let n=D(e);return t.Y(n)||t.K(n)?n.variant:(0,a.isSetString)(n)||t.p(n)?`file-reference`:U(n)}async function G(e,n){if(t.Y(e))return e.schema;let r=n??U(e),i;if((r===`zod3`||r===`json-schema`||r===`standard-schema`||r===`untyped`||r===`valibot`)&&(i=H(e)),i)return F(i);throw Error(`Failed to extract a valid schema from the provided input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, an untyped schema, or a reflected Deepkit Type object.`)}function K(e,t){if(e===`zod3`)return{hash:V(e,t),variant:`zod3`,schema:t};if(e===`untyped`)return{hash:V(e,t),variant:`untyped`,schema:t};if(e===`standard-schema`)return{hash:V(e,t),variant:`standard-schema`,schema:t};if(e===`json-schema`)return{hash:V(e,t),variant:`json-schema`,schema:t};if(e===`valibot`)return{hash:V(e,t),variant:`valibot`,schema:t};throw Error(`Failed to extract source information from the provided input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, an untyped schema, or a reflected Deepkit Type object.`)}async function q(e,t={}){let n=(0,o.extractFileReference)(e);if(!n)throw Error(`Failed to extract a file reference from the provided input. The input must be a string or an object with a "file" property that specifies the file path and optional export name.`);let r=n.export??`*`;try{return(0,g.createGenerator)({path:n.file,type:r,expose:`export`,jsDoc:`extended`,...t}).createSchema(r)}catch(e){throw Error(`Failed to generate a JSON schema for "${n.file}" using the type "${r}". Error: ${e.message}`)}}async function J(e,r={}){let i=D(e);if(t.Y(i))return i;if(t.K(i))return{...i,source:{hash:V(`json-schema`,i.schema),variant:`json-schema`,schema:i.schema}};let a,s=W(i),c=V(s,i);if(s===`file-reference`){let e=(0,o.extractFileReference)(i);if(!e)throw Error(`Failed to extract a valid file reference from the provided input "${JSON.stringify(i)}". Please ensure that the input is correctly formatted as a file reference (e.g. "./schema.ts#MySchema") and that the file exists at the specified path.`);let s=(0,u.findFileExtensionSafe)(e.file);if(s&&!d.VALID_OBJECT_SOURCE_EXTENSIONS.includes(s))throw Error(`The provided schema file input "${e.file}" has an invalid file extension (.${s}). Please ensure that the file has one of the following extensions: ${(0,p.list)(d.VALID_OBJECT_SOURCE_EXTENSIONS,{conjunction:`or`})}.`);let c;r.storage&&(c=n.t(r.storage));let l=await(0,f.loadSafe)(i,{...r,fs:c});l??=await q(i,{...r,fs:c});let m=D(l);a=t.Y(m)?m.source:t.K(m)?{hash:V(`json-schema`,m.schema),variant:`json-schema`,schema:m.schema}:K(U(m),m)}else if([`json-schema`,`standard-schema`,`zod3`,`untyped`,`valibot`,`reflection`].includes(s))a=K(s,i);else throw Error(`Invalid schema definition input "${s}". The variant must be one of "file-reference", "json-schema", "standard-schema", "zod3", "valibot", "untyped", or "reflection".`);return{variant:s,source:a,schema:await G(a.schema,a.variant),hash:c}}async function Y(e,n={}){let r=D(e);if(t.Y(r)||t.J(r))return r;let i=await J(e,n);if(!i?.schema)throw Error(`Failed to extract a valid schema from the provided input. The input must be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a reflected Deepkit Type object.`);return i}exports.JSON_SCHEMA_METADATA_KEYS=e.t,exports.JSON_SCHEMA_PRIMITIVE_TYPES=e.n,exports.JSON_SCHEMA_TYPES=e.r,exports.JsonSchemaTypeNames=e.i,exports.SCHEMA_ARRAY_CONCAT_KEYWORDS=e.a,exports.SCHEMA_RECORD_KEYWORDS=e.o,exports.SCHEMA_SINGLE_KEYWORDS=e.s,exports.addProperty=t.t,exports.applyJsonSchemaMetadata=t.nt,exports.assertSchemasDoNotContradict=w,exports.bundleReferences=F,exports.createStoragePromises=n.n,exports.extract=Y,exports.extractHash=V,exports.extractJsonSchema=H,exports.extractResolvedVariant=U,exports.extractSchema=G,exports.extractSchemaWithSource=J,exports.extractSource=K,exports.extractTSType=q,exports.extractVariant=W,exports.findSchemaContradictions=C,exports.getJsonSchema=t.n,exports.getJsonSchemaObject=t.r,exports.getPrimarySchemaType=t.rt,exports.getProperties=t.i,exports.getPropertiesList=t.a,exports.getProperty=t.o,exports.isFileReference=t.p,exports.isJsonSchema=t.m,exports.isJsonSchemaAllOf=t.h,exports.isJsonSchemaAny=t.g,exports.isJsonSchemaAnyOf=t._,exports.isJsonSchemaArray=t.v,exports.isJsonSchemaBigint=t.y,exports.isJsonSchemaBoolean=t.b,exports.isJsonSchemaDate=t.x,exports.isJsonSchemaDecimal=t.S,exports.isJsonSchemaEnum=t.C,exports.isJsonSchemaInteger=t.w,exports.isJsonSchemaKeywords=t.T,exports.isJsonSchemaLiteral=t.E,exports.isJsonSchemaMap=t.D,exports.isJsonSchemaNativeEnum=t.O,exports.isJsonSchemaNever=t.k,exports.isJsonSchemaNull=t.A,exports.isJsonSchemaNullable=t.j,exports.isJsonSchemaNumber=t.M,exports.isJsonSchemaObject=t.N,exports.isJsonSchemaPrimitiveType=t.P,exports.isJsonSchemaPrimitiveUnion=t.F,exports.isJsonSchemaRecord=t.I,exports.isJsonSchemaRef=t.L,exports.isJsonSchemaSet=t.R,exports.isJsonSchemaString=t.z,exports.isJsonSchemaTuple=t.B,exports.isJsonSchemaType=t.V,exports.isJsonSchemaUndefined=t.H,exports.isJsonSchemaUnion=t.U,exports.isJsonSchemaUnknown=t.W,exports.isNullOnlyJsonSchema=t.G,exports.isPropertyOptional=t.s,exports.isSchema=t.K,exports.isSchemaNullable=t.c,exports.isSchemaObject=t.q,exports.isSchemaOf=t.J,exports.isSchemaWithSource=t.Y,exports.isStandardSchema=t.X,exports.isUntypedConfig=t.Z,exports.isUntypedConfigStrict=t.Q,exports.isUntypedSchema=t.$,exports.isUntypedSchemaStrict=t.et,exports.isValibotSchema=t.tt,exports.isValidSchemaConfigFile=t.l,exports.mapStorageToFileSystem=n.t,exports.merge=t.u,exports.mergeMetadata=t.d,exports.normalizeKey=n.r,exports.readSchemaTypes=t.it,exports.traverseSchema=t.f;
package/dist/index.d.cts CHANGED
@@ -6,6 +6,31 @@ import { InputObject, Schema } from "untyped";
6
6
  import { BaseSchema } from "valibot";
7
7
  import { FileReferenceInput } from "@stryke/types";
8
8
  import { FileReference } from "@stryke/types/configuration";
9
+ //#region src/compatibility.d.ts
10
+ /**
11
+ * Finds structural contradictions between two JSON Schema fragments.
12
+ *
13
+ * @remarks
14
+ * Metadata-only keywords are ignored. Either schema may be unconstrained
15
+ * (`{}`, `{ type: "any" }`, or missing structural keywords) without
16
+ * producing contradictions.
17
+ *
18
+ * @param base - The base JSON Schema fragment.
19
+ * @param override - The JSON Schema fragment to compare against the base.
20
+ * @param path - Optional dot-separated path used in issue messages.
21
+ * @returns A list of human-readable contradiction descriptions.
22
+ */
23
+ declare function findSchemaContradictions(base: JsonSchema, override: JsonSchema, path?: string): string[];
24
+ /**
25
+ * Asserts that two JSON Schema fragments do not structurally contradict each other.
26
+ *
27
+ * @param base - The base JSON Schema fragment.
28
+ * @param override - The JSON Schema fragment to compare against the base.
29
+ * @param label - A label used in the thrown error message.
30
+ * @throws {Error} When one or more structural contradictions are found.
31
+ */
32
+ declare function assertSchemasDoNotContradict(base: JsonSchema, override: JsonSchema, label?: string): void;
33
+ //#endregion
9
34
  //#region src/extract.d.ts
10
35
  /**
11
36
  * Bundles all external references in a JSON Schema into a single schema document by collecting all reference targets and rewriting the references to point to the bundled definitions. This ensures that the resulting schema is self-contained and can be used independently without relying on external documents.
@@ -626,5 +651,5 @@ declare function isSchemaWithSource(input: unknown): input is ExtractedSchemaEnv
626
651
  */
627
652
  declare function isSchemaObject(input: unknown): input is SchemaEnvelope<JsonSchemaObject>;
628
653
  //#endregion
629
- export { type BaseSchemaSource, type ExtractedSchemaEnvelope, GetPropertyResult, type InferExtractOptions, JSON_SCHEMA_METADATA_KEYS, JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES, type JsonSchema, type JsonSchemaAllOf, type JsonSchemaAny, type JsonSchemaAnyOf, type JsonSchemaArray, type JsonSchemaBigint, type JsonSchemaBoolean, type JsonSchemaConditionalKeywords, type JsonSchemaDate, type JsonSchemaDecimal, type JsonSchemaDecimalFormat, type JsonSchemaEnum, type JsonSchemaInteger, type JsonSchemaIntegerFormat, type JsonSchemaKeywords, type JsonSchemaLike, type JsonSchemaLiteral, type JsonSchemaLogicKeywords, type JsonSchemaMap, type JsonSchemaMetadataKeywords, type JsonSchemaNativeEnum, type JsonSchemaNever, type JsonSchemaNull, type JsonSchemaNullable, type JsonSchemaNumber, type JsonSchemaNumberFormat, type JsonSchemaObject, type JsonSchemaOf, type JsonSchemaPrimitiveType, type JsonSchemaPrimitiveUnion, type JsonSchemaRecord, type JsonSchemaRecordPropertyNames, type JsonSchemaRef, type JsonSchemaSchemaSource, type JsonSchemaSet, type JsonSchemaString, type JsonSchemaStringFormat, type JsonSchemaTuple, type JsonSchemaType, JsonSchemaTypeNames, type JsonSchemaUndefined, type JsonSchemaUnion, type JsonSchemaUnknown, SCHEMA_ARRAY_CONCAT_KEYWORDS, SCHEMA_RECORD_KEYWORDS, SCHEMA_SINGLE_KEYWORDS, type SchemaConfig, type SchemaConfigVariant, type SchemaEnvelope, type SchemaEnvelopeOf, type SchemaSource, type SchemaSourceConfig, type SchemaSourceVariant, type SpecOf, type StandardSchemaSchemaSource, type UntypedConfigObject, type UntypedSchema, type UntypedSchemaSource, type ValibotSchema, type ValibotSchemaSource, type Zod3SchemaSource, addProperty, applyJsonSchemaMetadata, bundleReferences, createStoragePromises, extract, extractHash, extractJsonSchema, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractTSType, extractVariant, getJsonSchema, getJsonSchemaObject, getPrimarySchemaType, getProperties, getPropertiesList, getProperty, isFileReference, isJsonSchema, isJsonSchemaAllOf, isJsonSchemaAny, isJsonSchemaAnyOf, isJsonSchemaArray, isJsonSchemaBigint, isJsonSchemaBoolean, isJsonSchemaDate, isJsonSchemaDecimal, isJsonSchemaEnum, isJsonSchemaInteger, isJsonSchemaKeywords, isJsonSchemaLiteral, isJsonSchemaMap, isJsonSchemaNativeEnum, isJsonSchemaNever, isJsonSchemaNull, isJsonSchemaNullable, isJsonSchemaNumber, isJsonSchemaObject, isJsonSchemaPrimitiveType, isJsonSchemaPrimitiveUnion, isJsonSchemaRecord, isJsonSchemaRef, isJsonSchemaSet, isJsonSchemaString, isJsonSchemaTuple, isJsonSchemaType, isJsonSchemaUndefined, isJsonSchemaUnion, isJsonSchemaUnknown, isNullOnlyJsonSchema, isPropertyOptional, isSchema, isSchemaNullable, isSchemaObject, isSchemaOf, isSchemaWithSource, isStandardSchema, isUntypedConfig, isUntypedConfigStrict, isUntypedSchema, isUntypedSchemaStrict, isValibotSchema, isValidSchemaConfigFile, mapStorageToFileSystem, merge, mergeMetadata, normalizeKey, readSchemaTypes, traverseSchema };
654
+ export { type BaseSchemaSource, type ExtractedSchemaEnvelope, GetPropertyResult, type InferExtractOptions, JSON_SCHEMA_METADATA_KEYS, JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES, type JsonSchema, type JsonSchemaAllOf, type JsonSchemaAny, type JsonSchemaAnyOf, type JsonSchemaArray, type JsonSchemaBigint, type JsonSchemaBoolean, type JsonSchemaConditionalKeywords, type JsonSchemaDate, type JsonSchemaDecimal, type JsonSchemaDecimalFormat, type JsonSchemaEnum, type JsonSchemaInteger, type JsonSchemaIntegerFormat, type JsonSchemaKeywords, type JsonSchemaLike, type JsonSchemaLiteral, type JsonSchemaLogicKeywords, type JsonSchemaMap, type JsonSchemaMetadataKeywords, type JsonSchemaNativeEnum, type JsonSchemaNever, type JsonSchemaNull, type JsonSchemaNullable, type JsonSchemaNumber, type JsonSchemaNumberFormat, type JsonSchemaObject, type JsonSchemaOf, type JsonSchemaPrimitiveType, type JsonSchemaPrimitiveUnion, type JsonSchemaRecord, type JsonSchemaRecordPropertyNames, type JsonSchemaRef, type JsonSchemaSchemaSource, type JsonSchemaSet, type JsonSchemaString, type JsonSchemaStringFormat, type JsonSchemaTuple, type JsonSchemaType, JsonSchemaTypeNames, type JsonSchemaUndefined, type JsonSchemaUnion, type JsonSchemaUnknown, SCHEMA_ARRAY_CONCAT_KEYWORDS, SCHEMA_RECORD_KEYWORDS, SCHEMA_SINGLE_KEYWORDS, type SchemaConfig, type SchemaConfigVariant, type SchemaEnvelope, type SchemaEnvelopeOf, type SchemaSource, type SchemaSourceConfig, type SchemaSourceVariant, type SpecOf, type StandardSchemaSchemaSource, type UntypedConfigObject, type UntypedSchema, type UntypedSchemaSource, type ValibotSchema, type ValibotSchemaSource, type Zod3SchemaSource, addProperty, applyJsonSchemaMetadata, assertSchemasDoNotContradict, bundleReferences, createStoragePromises, extract, extractHash, extractJsonSchema, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractTSType, extractVariant, findSchemaContradictions, getJsonSchema, getJsonSchemaObject, getPrimarySchemaType, getProperties, getPropertiesList, getProperty, isFileReference, isJsonSchema, isJsonSchemaAllOf, isJsonSchemaAny, isJsonSchemaAnyOf, isJsonSchemaArray, isJsonSchemaBigint, isJsonSchemaBoolean, isJsonSchemaDate, isJsonSchemaDecimal, isJsonSchemaEnum, isJsonSchemaInteger, isJsonSchemaKeywords, isJsonSchemaLiteral, isJsonSchemaMap, isJsonSchemaNativeEnum, isJsonSchemaNever, isJsonSchemaNull, isJsonSchemaNullable, isJsonSchemaNumber, isJsonSchemaObject, isJsonSchemaPrimitiveType, isJsonSchemaPrimitiveUnion, isJsonSchemaRecord, isJsonSchemaRef, isJsonSchemaSet, isJsonSchemaString, isJsonSchemaTuple, isJsonSchemaType, isJsonSchemaUndefined, isJsonSchemaUnion, isJsonSchemaUnknown, isNullOnlyJsonSchema, isPropertyOptional, isSchema, isSchemaNullable, isSchemaObject, isSchemaOf, isSchemaWithSource, isStandardSchema, isUntypedConfig, isUntypedConfigStrict, isUntypedSchema, isUntypedSchemaStrict, isValibotSchema, isValidSchemaConfigFile, mapStorageToFileSystem, merge, mergeMetadata, normalizeKey, readSchemaTypes, traverseSchema };
630
655
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/extract.ts","../src/helpers.ts","../src/metadata.ts","../src/type-checks.ts"],"mappings":";;;;;;;;;;;;;;;iBAmQgB,iBAAiB,QAAQ,aAAa;;;;iBAgMtC,YACd,SAAS,qBACT,OAAO;;;;;;;iBAgDO,kBAAkB,kBAAkB;;;;;;;;iBAoCpC,uBACd,OAAO,qBACN;;;;;;;iBA0Ba,eAAe,OAAO,eAAe;;;;;;;;;iBAsB/B,cACpB,OAAO,oBACP,UAAU,sBACT,QAAQ;;;;;;;;;iBAmCK,cACd,SAAS,qBACT,OAAO,qBACN;;;;;;;;iBA6CmB,cACpB,OAAO,oBACP,UAAS,wBAAwB,SAChC,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8DW,wBAAwB,aAC5C,OAAO,cACP,UAAS,2BAA2B,SACnC,QAAQ,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2Ib,QAAQ,aAC5B,OAAO,aAAa,QACpB,UAAS,2BAA2B,SACnC,QAAQ,iBAAiB;;;KC30BhB,oBAAoB;EAC9B;EACA;EACA;;;;;;;;;;;;iBAac,cAAc,OAAO,iBAAiB,aAAa;;;;;;;;;;;iBAmBnD,oBACd,OAAO,iBAAiB,aACvB;;;;;;;;;;iBAkBa,cACd,KAAK,iBAAiB,mBACrB,eAAe;;;;;;;;;;iBA6BF,kBAAkB,KAAK,iBAAiB,mBAAgB;;;;;;;;;;iBAaxD,YAAY,gBAAgB,kBAC1C,KAAK,eAAe,WAAW,SAC/B,YAAY,iCACX;;;;;;;;;;;;iBAgCa,YACd,KAAK,iBAAiB,kBACtB,cACA,UAAU;;;;;;;;;;;;;;;;;;;;iBAyGI,SAAS,UAAU,aAAa,oBAAoB;;;;;;;;;;;iBA6BpD,cAAc,OAC5B,QAAQ,aAAa,QACrB,UAAU,6BACT,aAAa;;;;;;;;;;iBAoBA,iBAAiB,SAAS;;;;;;;;;;;iBAsB1B,mBACd,QAAQ,kBACR;;;;;;;iBAiBc,wBAAwB;;;;;;;;;;;iBAgBxB,eAAe,GAC7B,QAAQ,YACR,WAAW,QAAQ,eAAe,WACjC;;;;;;;;;;iBCnWa,wBACd,QAAQ,YACR,UAAU,yCACT;;;;;;;;;;iBA0Ba,gBACd,SAAS,aACR;;;;;;;iBA6Ba,qBACd,SAAS,aACR;;;;;;;;;iBCvBa,gBAAgB,aAAa,SAAS;;;;;;;iBAsCtC,0BACd,iBACC,SAAS;;;;;;;iBAaI,iBAAiB,iBAAiB,SAAS;;;;;;;iBAiR3C,qBACd,iBACC,SAAS;;;;;;;iBAcI,gBAAgB,iBAAiB,SAAS;;;;;;;iBAsB1C,kBAAkB,iBAAiB,SAAS;;;;;;;iBA+B5C,mBAAmB,iBAAiB,SAAS;;;;;;;iBA+B7C,oBACd,iBACC,SAAS;;;;;;;iBAoBI,iBAAiB,iBAAiB,SAAS;;;;;;;iBAqC3C,iBAAiB,iBAAiB,SAAS;;;;;;;iBAuD3C,kBAAkB,iBAAiB,SAAS;;;;;;;iBA0B5C,oBACd,iBACC,SAAS;;;;;;;iBAuBI,gBAAgB,iBAAiB,SAAS;;;;;;;iBAgC1C,uBACd,iBACC,SAAS;;;;;;;iBA4BI,kBAAkB,iBAAiB,SAAS;;;;;;;iBAgB5C,iBAAiB,iBAAiB,SAAS;;;;;;;iBAuB3C,qBACd,iBACC,SAAS;;;;;;;iBAsCI,mBAAmB,iBAAiB,SAAS;;;;;;;iBA+B7C,oBACd,iBACC,SAAS;;;;;;;iBAUI,oBACd,iBACC,SAAS;;;;;;;iBAUI,mBAAmB,iBAAiB,SAAS;;;;;;;iBA2C7C,mBAAmB,iBAAiB,SAAS;;;;;;;iBA4B7C,gBAAgB,iBAAiB,SAAS;;;;;;;iBA8B1C,mBAAmB,iBAAiB,SAAS;;;;;;;iBAyB7C,kBAAkB,iBAAiB,SAAS;;;;;;;iBA8B5C,sBACd,iBACC,SAAS;;;;;;;iBAoBI,2BACd,iBACC,SAAS;;;;;;;iBAsEI,kBAAkB,iBAAiB,SAAS;;;;;;;iBAmB5C,oBACd,iBACC,SAAS;;;;;;;iBAUI,kBAAkB,iBAAiB,SAAS;;;;;;;iBAkB5C,gBAAgB,iBAAiB,SAAS;;;;;;;iBAgB1C,iBAAiB,iBAAiB,SAAS;;;;;;;iBAqB3C,gBACd,iBACC,SAAS;;;;;;;;;;iBA0BI,aAAa,iBAAiB,SAAS;;;;;;;;;;iBAsCvC,qBAAqB,iBAAiB,SAAS;;;;;;;;;;iBAa/C,gBAAgB,iBAAiB,SAAS;;;;;;;;;;;iBAyD1C,sBAAsB,iBAAiB,SAAS;;;;;;;;;;iBAahD,gBAAgB,iBAAiB,SAAS;;;;;;;;;;;iBA0B1C,sBACd,iBACC,SAAS;;;;;;;iBAuBI,SAAS,iBAAiB,SAAS;;;;;;;iBAkBnC,WAAW,OACzB,iBACC,SAAS,iBAAiB;;;;;;;iBAUb,mBAAmB,iBAAiB,SAAS;;;;;;;iBAiB7C,eACd,iBACC,SAAS,eAAe"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/compatibility.ts","../src/extract.ts","../src/helpers.ts","../src/metadata.ts","../src/type-checks.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;iBAwGgB,yBACd,MAAM,YACN,UAAU,YACV;;;;;;;;;iBAqHc,6BACd,MAAM,YACN,UAAU,YACV;;;;;;;;;iBCgCc,iBAAiB,QAAQ,aAAa;;;;iBAgMtC,YACd,SAAS,qBACT,OAAO;;;;;;;iBAgDO,kBAAkB,kBAAkB;;;;;;;;iBAoCpC,uBACd,OAAO,qBACN;;;;;;;iBA0Ba,eAAe,OAAO,eAAe;;;;;;;;;iBAsB/B,cACpB,OAAO,oBACP,UAAU,sBACT,QAAQ;;;;;;;;;iBAmCK,cACd,SAAS,qBACT,OAAO,qBACN;;;;;;;;iBA6CmB,cACpB,OAAO,oBACP,UAAS,wBAAwB,SAChC,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8DW,wBAAwB,aAC5C,OAAO,cACP,UAAS,2BAA2B,SACnC,QAAQ,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2Ib,QAAQ,aAC5B,OAAO,aAAa,QACpB,UAAS,2BAA2B,SACnC,QAAQ,iBAAiB;;;KC30BhB,oBAAoB;EAC9B;EACA;EACA;;;;;;;;;;;;iBAac,cAAc,OAAO,iBAAiB,aAAa;;;;;;;;;;;iBAmBnD,oBACd,OAAO,iBAAiB,aACvB;;;;;;;;;;iBAkBa,cACd,KAAK,iBAAiB,mBACrB,eAAe;;;;;;;;;;iBA6BF,kBAAkB,KAAK,iBAAiB,mBAAgB;;;;;;;;;;iBAaxD,YAAY,gBAAgB,kBAC1C,KAAK,eAAe,WAAW,SAC/B,YAAY,iCACX;;;;;;;;;;;;iBAgCa,YACd,KAAK,iBAAiB,kBACtB,cACA,UAAU;;;;;;;;;;;;;;;;;;;;iBAyGI,SAAS,UAAU,aAAa,oBAAoB;;;;;;;;;;;iBA6BpD,cAAc,OAC5B,QAAQ,aAAa,QACrB,UAAU,6BACT,aAAa;;;;;;;;;;iBAoBA,iBAAiB,SAAS;;;;;;;;;;;iBAsB1B,mBACd,QAAQ,kBACR;;;;;;;iBAiBc,wBAAwB;;;;;;;;;;;iBAgBxB,eAAe,GAC7B,QAAQ,YACR,WAAW,QAAQ,eAAe,WACjC;;;;;;;;;;iBCnWa,wBACd,QAAQ,YACR,UAAU,yCACT;;;;;;;;;;iBA0Ba,gBACd,SAAS,aACR;;;;;;;iBA6Ba,qBACd,SAAS,aACR;;;;;;;;;iBCvBa,gBAAgB,aAAa,SAAS;;;;;;;iBAsCtC,0BACd,iBACC,SAAS;;;;;;;iBAaI,iBAAiB,iBAAiB,SAAS;;;;;;;iBAiR3C,qBACd,iBACC,SAAS;;;;;;;iBAcI,gBAAgB,iBAAiB,SAAS;;;;;;;iBAsB1C,kBAAkB,iBAAiB,SAAS;;;;;;;iBA+B5C,mBAAmB,iBAAiB,SAAS;;;;;;;iBA+B7C,oBACd,iBACC,SAAS;;;;;;;iBAoBI,iBAAiB,iBAAiB,SAAS;;;;;;;iBAqC3C,iBAAiB,iBAAiB,SAAS;;;;;;;iBAuD3C,kBAAkB,iBAAiB,SAAS;;;;;;;iBA0B5C,oBACd,iBACC,SAAS;;;;;;;iBAuBI,gBAAgB,iBAAiB,SAAS;;;;;;;iBAgC1C,uBACd,iBACC,SAAS;;;;;;;iBA4BI,kBAAkB,iBAAiB,SAAS;;;;;;;iBAgB5C,iBAAiB,iBAAiB,SAAS;;;;;;;iBAuB3C,qBACd,iBACC,SAAS;;;;;;;iBAsCI,mBAAmB,iBAAiB,SAAS;;;;;;;iBA+B7C,oBACd,iBACC,SAAS;;;;;;;iBAUI,oBACd,iBACC,SAAS;;;;;;;iBAUI,mBAAmB,iBAAiB,SAAS;;;;;;;iBA2C7C,mBAAmB,iBAAiB,SAAS;;;;;;;iBA4B7C,gBAAgB,iBAAiB,SAAS;;;;;;;iBA8B1C,mBAAmB,iBAAiB,SAAS;;;;;;;iBAyB7C,kBAAkB,iBAAiB,SAAS;;;;;;;iBA8B5C,sBACd,iBACC,SAAS;;;;;;;iBAoBI,2BACd,iBACC,SAAS;;;;;;;iBAsEI,kBAAkB,iBAAiB,SAAS;;;;;;;iBAmB5C,oBACd,iBACC,SAAS;;;;;;;iBAUI,kBAAkB,iBAAiB,SAAS;;;;;;;iBAkB5C,gBAAgB,iBAAiB,SAAS;;;;;;;iBAgB1C,iBAAiB,iBAAiB,SAAS;;;;;;;iBAqB3C,gBACd,iBACC,SAAS;;;;;;;;;;iBA0BI,aAAa,iBAAiB,SAAS;;;;;;;;;;iBAsCvC,qBAAqB,iBAAiB,SAAS;;;;;;;;;;iBAa/C,gBAAgB,iBAAiB,SAAS;;;;;;;;;;;iBAyD1C,sBAAsB,iBAAiB,SAAS;;;;;;;;;;iBAahD,gBAAgB,iBAAiB,SAAS;;;;;;;;;;;iBA0B1C,sBACd,iBACC,SAAS;;;;;;;iBAuBI,SAAS,iBAAiB,SAAS;;;;;;;iBAkBnC,WAAW,OACzB,iBACC,SAAS,iBAAiB;;;;;;;iBAUb,mBAAmB,iBAAiB,SAAS;;;;;;;iBAiB7C,eACd,iBACC,SAAS,eAAe"}
package/dist/index.d.mts CHANGED
@@ -6,6 +6,31 @@ import { InferLoadOptions } from "@stryke/resolve/types";
6
6
  import { InputObject, Schema } from "untyped";
7
7
  import { FileReferenceInput } from "@stryke/types";
8
8
  import { FileReference } from "@stryke/types/configuration";
9
+ //#region src/compatibility.d.ts
10
+ /**
11
+ * Finds structural contradictions between two JSON Schema fragments.
12
+ *
13
+ * @remarks
14
+ * Metadata-only keywords are ignored. Either schema may be unconstrained
15
+ * (`{}`, `{ type: "any" }`, or missing structural keywords) without
16
+ * producing contradictions.
17
+ *
18
+ * @param base - The base JSON Schema fragment.
19
+ * @param override - The JSON Schema fragment to compare against the base.
20
+ * @param path - Optional dot-separated path used in issue messages.
21
+ * @returns A list of human-readable contradiction descriptions.
22
+ */
23
+ declare function findSchemaContradictions(base: JsonSchema, override: JsonSchema, path?: string): string[];
24
+ /**
25
+ * Asserts that two JSON Schema fragments do not structurally contradict each other.
26
+ *
27
+ * @param base - The base JSON Schema fragment.
28
+ * @param override - The JSON Schema fragment to compare against the base.
29
+ * @param label - A label used in the thrown error message.
30
+ * @throws {Error} When one or more structural contradictions are found.
31
+ */
32
+ declare function assertSchemasDoNotContradict(base: JsonSchema, override: JsonSchema, label?: string): void;
33
+ //#endregion
9
34
  //#region src/extract.d.ts
10
35
  /**
11
36
  * Bundles all external references in a JSON Schema into a single schema document by collecting all reference targets and rewriting the references to point to the bundled definitions. This ensures that the resulting schema is self-contained and can be used independently without relying on external documents.
@@ -626,5 +651,5 @@ declare function isSchemaWithSource(input: unknown): input is ExtractedSchemaEnv
626
651
  */
627
652
  declare function isSchemaObject(input: unknown): input is SchemaEnvelope<JsonSchemaObject>;
628
653
  //#endregion
629
- export { type BaseSchemaSource, type ExtractedSchemaEnvelope, GetPropertyResult, type InferExtractOptions, JSON_SCHEMA_METADATA_KEYS, JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES, type JsonSchema, type JsonSchemaAllOf, type JsonSchemaAny, type JsonSchemaAnyOf, type JsonSchemaArray, type JsonSchemaBigint, type JsonSchemaBoolean, type JsonSchemaConditionalKeywords, type JsonSchemaDate, type JsonSchemaDecimal, type JsonSchemaDecimalFormat, type JsonSchemaEnum, type JsonSchemaInteger, type JsonSchemaIntegerFormat, type JsonSchemaKeywords, type JsonSchemaLike, type JsonSchemaLiteral, type JsonSchemaLogicKeywords, type JsonSchemaMap, type JsonSchemaMetadataKeywords, type JsonSchemaNativeEnum, type JsonSchemaNever, type JsonSchemaNull, type JsonSchemaNullable, type JsonSchemaNumber, type JsonSchemaNumberFormat, type JsonSchemaObject, type JsonSchemaOf, type JsonSchemaPrimitiveType, type JsonSchemaPrimitiveUnion, type JsonSchemaRecord, type JsonSchemaRecordPropertyNames, type JsonSchemaRef, type JsonSchemaSchemaSource, type JsonSchemaSet, type JsonSchemaString, type JsonSchemaStringFormat, type JsonSchemaTuple, type JsonSchemaType, JsonSchemaTypeNames, type JsonSchemaUndefined, type JsonSchemaUnion, type JsonSchemaUnknown, SCHEMA_ARRAY_CONCAT_KEYWORDS, SCHEMA_RECORD_KEYWORDS, SCHEMA_SINGLE_KEYWORDS, type SchemaConfig, type SchemaConfigVariant, type SchemaEnvelope, type SchemaEnvelopeOf, type SchemaSource, type SchemaSourceConfig, type SchemaSourceVariant, type SpecOf, type StandardSchemaSchemaSource, type UntypedConfigObject, type UntypedSchema, type UntypedSchemaSource, type ValibotSchema, type ValibotSchemaSource, type Zod3SchemaSource, addProperty, applyJsonSchemaMetadata, bundleReferences, createStoragePromises, extract, extractHash, extractJsonSchema, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractTSType, extractVariant, getJsonSchema, getJsonSchemaObject, getPrimarySchemaType, getProperties, getPropertiesList, getProperty, isFileReference, isJsonSchema, isJsonSchemaAllOf, isJsonSchemaAny, isJsonSchemaAnyOf, isJsonSchemaArray, isJsonSchemaBigint, isJsonSchemaBoolean, isJsonSchemaDate, isJsonSchemaDecimal, isJsonSchemaEnum, isJsonSchemaInteger, isJsonSchemaKeywords, isJsonSchemaLiteral, isJsonSchemaMap, isJsonSchemaNativeEnum, isJsonSchemaNever, isJsonSchemaNull, isJsonSchemaNullable, isJsonSchemaNumber, isJsonSchemaObject, isJsonSchemaPrimitiveType, isJsonSchemaPrimitiveUnion, isJsonSchemaRecord, isJsonSchemaRef, isJsonSchemaSet, isJsonSchemaString, isJsonSchemaTuple, isJsonSchemaType, isJsonSchemaUndefined, isJsonSchemaUnion, isJsonSchemaUnknown, isNullOnlyJsonSchema, isPropertyOptional, isSchema, isSchemaNullable, isSchemaObject, isSchemaOf, isSchemaWithSource, isStandardSchema, isUntypedConfig, isUntypedConfigStrict, isUntypedSchema, isUntypedSchemaStrict, isValibotSchema, isValidSchemaConfigFile, mapStorageToFileSystem, merge, mergeMetadata, normalizeKey, readSchemaTypes, traverseSchema };
654
+ export { type BaseSchemaSource, type ExtractedSchemaEnvelope, GetPropertyResult, type InferExtractOptions, JSON_SCHEMA_METADATA_KEYS, JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES, type JsonSchema, type JsonSchemaAllOf, type JsonSchemaAny, type JsonSchemaAnyOf, type JsonSchemaArray, type JsonSchemaBigint, type JsonSchemaBoolean, type JsonSchemaConditionalKeywords, type JsonSchemaDate, type JsonSchemaDecimal, type JsonSchemaDecimalFormat, type JsonSchemaEnum, type JsonSchemaInteger, type JsonSchemaIntegerFormat, type JsonSchemaKeywords, type JsonSchemaLike, type JsonSchemaLiteral, type JsonSchemaLogicKeywords, type JsonSchemaMap, type JsonSchemaMetadataKeywords, type JsonSchemaNativeEnum, type JsonSchemaNever, type JsonSchemaNull, type JsonSchemaNullable, type JsonSchemaNumber, type JsonSchemaNumberFormat, type JsonSchemaObject, type JsonSchemaOf, type JsonSchemaPrimitiveType, type JsonSchemaPrimitiveUnion, type JsonSchemaRecord, type JsonSchemaRecordPropertyNames, type JsonSchemaRef, type JsonSchemaSchemaSource, type JsonSchemaSet, type JsonSchemaString, type JsonSchemaStringFormat, type JsonSchemaTuple, type JsonSchemaType, JsonSchemaTypeNames, type JsonSchemaUndefined, type JsonSchemaUnion, type JsonSchemaUnknown, SCHEMA_ARRAY_CONCAT_KEYWORDS, SCHEMA_RECORD_KEYWORDS, SCHEMA_SINGLE_KEYWORDS, type SchemaConfig, type SchemaConfigVariant, type SchemaEnvelope, type SchemaEnvelopeOf, type SchemaSource, type SchemaSourceConfig, type SchemaSourceVariant, type SpecOf, type StandardSchemaSchemaSource, type UntypedConfigObject, type UntypedSchema, type UntypedSchemaSource, type ValibotSchema, type ValibotSchemaSource, type Zod3SchemaSource, addProperty, applyJsonSchemaMetadata, assertSchemasDoNotContradict, bundleReferences, createStoragePromises, extract, extractHash, extractJsonSchema, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractTSType, extractVariant, findSchemaContradictions, getJsonSchema, getJsonSchemaObject, getPrimarySchemaType, getProperties, getPropertiesList, getProperty, isFileReference, isJsonSchema, isJsonSchemaAllOf, isJsonSchemaAny, isJsonSchemaAnyOf, isJsonSchemaArray, isJsonSchemaBigint, isJsonSchemaBoolean, isJsonSchemaDate, isJsonSchemaDecimal, isJsonSchemaEnum, isJsonSchemaInteger, isJsonSchemaKeywords, isJsonSchemaLiteral, isJsonSchemaMap, isJsonSchemaNativeEnum, isJsonSchemaNever, isJsonSchemaNull, isJsonSchemaNullable, isJsonSchemaNumber, isJsonSchemaObject, isJsonSchemaPrimitiveType, isJsonSchemaPrimitiveUnion, isJsonSchemaRecord, isJsonSchemaRef, isJsonSchemaSet, isJsonSchemaString, isJsonSchemaTuple, isJsonSchemaType, isJsonSchemaUndefined, isJsonSchemaUnion, isJsonSchemaUnknown, isNullOnlyJsonSchema, isPropertyOptional, isSchema, isSchemaNullable, isSchemaObject, isSchemaOf, isSchemaWithSource, isStandardSchema, isUntypedConfig, isUntypedConfigStrict, isUntypedSchema, isUntypedSchemaStrict, isValibotSchema, isValidSchemaConfigFile, mapStorageToFileSystem, merge, mergeMetadata, normalizeKey, readSchemaTypes, traverseSchema };
630
655
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/extract.ts","../src/helpers.ts","../src/metadata.ts","../src/type-checks.ts"],"mappings":""}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/compatibility.ts","../src/extract.ts","../src/helpers.ts","../src/metadata.ts","../src/type-checks.ts"],"mappings":""}
package/dist/index.mjs CHANGED
@@ -1,2 +1,3 @@
1
- import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./constants-lk1mMbgx.mjs";import{n as s,r as c,t as l}from"./storage-BccFP9xn.mjs";import{$ as ee,A as te,B as ne,C as re,D as u,E as d,F as ie,G as ae,H as oe,I as f,J as se,K as ce,L as le,M as ue,N as de,O as fe,P as pe,Q as p,R as me,S as he,T as ge,U as _e,V as ve,W as ye,X as be,Y as m,Z as h,_ as g,a as xe,b as Se,c as Ce,d as we,et as _,f as Te,g as v,h as Ee,i as De,it as y,j as Oe,k as ke,l as b,m as x,n as S,nt as C,o as w,p as Ae,q as je,r as Me,rt as T,s as Ne,t as Pe,tt as E,u as Fe,v as Ie,w as Le,x as Re,y as ze,z as Be}from"./helpers-CfLw5cNk.mjs";import{extractFileReference as D}from"@stryke/convert/extract-file-reference";import{murmurhash as O}from"@stryke/hash";import{deepClone as Ve}from"@stryke/helpers/deep-clone";import{isStandardJsonSchema as k}from"@stryke/json";import{findFileExtensionSafe as He}from"@stryke/path/find";import{VALID_OBJECT_SOURCE_EXTENSIONS as A}from"@stryke/resolve/constants";import{loadSafe as Ue}from"@stryke/resolve/load";import{list as We}from"@stryke/string-format/list";import{isSetString as j}from"@stryke/type-checks";import{isSetObject as M}from"@stryke/type-checks/is-set-object";import{extractJsonSchema as Ge,isZod3Type as N}from"@stryke/zod";import{toJsonSchema as Ke}from"@valibot/to-json-schema";import{createGenerator as qe}from"ts-json-schema-generator/dist/factory/generator.js";const P=`https://power-plant.invalid/`;function Je(e){return!(!M(e)||!(`schema`in e)||`hash`in e||`variant`in e||`source`in e)}function F(e){return Je(e)?e.schema:e}function I(e){return e.endsWith(`#`)?e.slice(0,-1):e}function L(e){let t=e.indexOf(`#`);return t>=0?e.slice(0,t):e}function Ye(e){return e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}function Xe(e){return e.length===0?``:`/${e.map(e=>Ye(e)).join(`/`)}`}function R(e,t){try{return I(new URL(e,t).toString())}catch{return I(e)}}function z(e,t,n,r,i){if(!M(e))return;let a=e,o=Xe(t),s=j(a.$id)?R(a.$id,n):n,c=L(s);if(r.set(s,o),r.set(c,o),j(a.$anchor)&&r.set(`${c}#${a.$anchor}`,o),j(a.$dynamicAnchor)){let e=`${c}#${a.$dynamicAnchor}`;r.set(e,o),i.set(e,`#${a.$dynamicAnchor}`)}for(let[e,n]of Object.entries(a)){if(Array.isArray(n)){n.forEach((n,a)=>{z(n,[...t,e,String(a)],s,r,i)});continue}z(n,[...t,e],s,r,i)}}function B(e,t,n,r,i){if(!M(e))return;let a=e,o=j(a.$id)?R(a.$id,n):n;if(j(a.$ref)){let e=R(a.$ref,o),t=r.get(e)??r.get(L(e));t!==void 0&&(a.$ref=t.length>0?`#${t}`:`#`)}if(j(a.$dynamicRef)){let e=R(a.$dynamicRef,o),t=i.get(e);if(t)a.$dynamicRef=t;else{let t=r.get(e)??r.get(L(e));t!==void 0&&(a.$dynamicRef=t.length>0?`#${t}`:`#`)}}for(let[e,n]of Object.entries(a)){if(Array.isArray(n)){n.forEach((n,a)=>{B(n,[...t,e,String(a)],o,r,i)});continue}B(n,[...t,e],o,r,i)}}function V(e){if(!M(e))return e;let t=Ve(e),n=j(t.$id)?R(t.$id,P):P,r=new Map,i=new Map;return z(t,[],n,r,i),B(t,[],n,r,i),t}function H(e){if(C(e))return W(e);if(M(e)){if(_(e))return G(e);let t=e;if(`$schema`in t&&C(t.$schema))return W(t.$schema)}return e}function Ze(e){return Array.isArray(e)?e.map(e=>H(e)):e}function U(e){return Ke(e,{target:`draft-2020-12`})}function W(e){let t=e,n={};for(let[e,r]of Object.entries(t))if(e!==`tsType`&&e!==`markdownType`&&e!==`tags`&&e!==`args`&&e!==`resolve`){if(e===`id`&&j(r)){n.$id=r;continue}if(e===`properties`||e===`patternProperties`||e===`dependentSchemas`||e===`$defs`||e===`definitions`){if(!M(r)){n[e]=r;continue}n[e]=Object.fromEntries(Object.entries(r).map(([e,t])=>[e,H(t)]));continue}if(e===`items`||e===`contains`||e===`if`||e===`then`||e===`else`||e===`not`||e===`propertyNames`||e===`additionalProperties`||e===`unevaluatedProperties`){n[e]=H(r);continue}if(e===`oneOf`||e===`anyOf`||e===`allOf`){n[e]=Ze(r);continue}n[e]=r}return n}function G(e){let t=e,n=C(t.$schema)?W(t.$schema):{},r={};for(let[e,n]of Object.entries(t)){if(e.startsWith(`$`)||!M(n))continue;if(_(n)){r[e]=G(n);continue}let t=n;if(`$schema`in t&&C(t.$schema)){r[e]=W(t.$schema);continue}C(n)&&(r[e]=W(n))}if(!f(n))throw Error(`Failed to convert untyped input to JSON Schema. The base schema must be a valid JSON Schema object.`);let i={...M(n.properties)?n.properties:{},...r};return{...n,type:n.type??`object`,...Object.keys(i).length>0?{properties:i}:{}}}function K(e,t){let n=F(t);if(p(n)||m(n))return O({variant:e,input:n.schema});if(j(n)||typeof n==`boolean`)return O({variant:e,input:n});if(M(n)){if(N(n))return O({variant:e,input:n._def});if(k(n))return O({variant:e,input:n[`~standard`]});if(g(n))return O({variant:e,input:n});if(y(n))return O({variant:e,input:U(n)});if(_(n))return O({variant:e,input:G(n)});if(C(n))return O({variant:e,input:W(n)})}throw Error(`Failed to create an input hash for the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, or a reflected Deepkit Type object.`)}function q(e){if(M(e)){if(N(e))return Ge(e,{target:`draft-2020-12`});if(E(e))return G(e);if(T(e))return W(e);if(k(e))return e[`~standard`].jsonSchema.input({target:`draft-2020-12`});if(y(e))return U(e);if(g(e))return e}}function J(e){if(M(e)){if(N(e))return`zod3`;if(E(e)||T(e))return`untyped`;if(k(e))return`standard-schema`;if(g(e))return`json-schema`;if(y(e))return`valibot`}throw Error(`Failed to determine the variant of the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, a reflected Deepkit Type object, or an Untyped schema.`)}function Y(e){let t=F(e);return p(t)||m(t)?t.variant:j(t)||v(t)?`file-reference`:J(t)}async function X(e,t){if(p(e))return e.schema;let n=t??J(e),r;if((n===`zod3`||n===`json-schema`||n===`standard-schema`||n===`untyped`||n===`valibot`)&&(r=q(e)),r)return V(r);throw Error(`Failed to extract a valid schema from the provided input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, an untyped schema, or a reflected Deepkit Type object.`)}function Z(e,t){if(e===`zod3`)return{hash:K(e,t),variant:`zod3`,schema:t};if(e===`untyped`)return{hash:K(e,t),variant:`untyped`,schema:t};if(e===`standard-schema`)return{hash:K(e,t),variant:`standard-schema`,schema:t};if(e===`json-schema`)return{hash:K(e,t),variant:`json-schema`,schema:t};if(e===`valibot`)return{hash:K(e,t),variant:`valibot`,schema:t};throw Error(`Failed to extract source information from the provided input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, an untyped schema, or a reflected Deepkit Type object.`)}async function Q(e,t={}){let n=D(e);if(!n)throw Error(`Failed to extract a file reference from the provided input. The input must be a string or an object with a "file" property that specifies the file path and optional export name.`);let r=n.export??`*`;try{return qe({path:n.file,type:r,expose:`export`,jsDoc:`extended`,...t}).createSchema(r)}catch(e){throw Error(`Failed to generate a JSON schema for "${n.file}" using the type "${r}". Error: ${e.message}`)}}async function $(e,t={}){let n=F(e);if(p(n))return n;if(m(n))return{...n,source:{hash:K(`json-schema`,n.schema),variant:`json-schema`,schema:n.schema}};let r,i=Y(n),a=K(i,n);if(i===`file-reference`){let e=D(n);if(!e)throw Error(`Failed to extract a valid file reference from the provided input "${JSON.stringify(n)}". Please ensure that the input is correctly formatted as a file reference (e.g. "./schema.ts#MySchema") and that the file exists at the specified path.`);let i=He(e.file);if(i&&!A.includes(i))throw Error(`The provided schema file input "${e.file}" has an invalid file extension (.${i}). Please ensure that the file has one of the following extensions: ${We(A,{conjunction:`or`})}.`);let a;t.storage&&(a=l(t.storage));let o=await Ue(n,{...t,fs:a});o??=await Q(n,{...t,fs:a});let s=F(o);r=p(s)?s.source:m(s)?{hash:K(`json-schema`,s.schema),variant:`json-schema`,schema:s.schema}:Z(J(s),s)}else if([`json-schema`,`standard-schema`,`zod3`,`untyped`,`valibot`,`reflection`].includes(i))r=Z(i,n);else throw Error(`Invalid schema definition input "${i}". The variant must be one of "file-reference", "json-schema", "standard-schema", "zod3", "valibot", "untyped", or "reflection".`);return{variant:i,source:r,schema:await X(r.schema,r.variant),hash:a}}async function Qe(e,t={}){let n=F(e);if(p(n)||h(n))return n;let r=await $(e,t);if(!r?.schema)throw Error(`Failed to extract a valid schema from the provided input. The input must be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a reflected Deepkit Type object.`);return r}export{o as JSON_SCHEMA_METADATA_KEYS,n as JSON_SCHEMA_PRIMITIVE_TYPES,i as JSON_SCHEMA_TYPES,t as JsonSchemaTypeNames,e as SCHEMA_ARRAY_CONCAT_KEYWORDS,r as SCHEMA_RECORD_KEYWORDS,a as SCHEMA_SINGLE_KEYWORDS,Pe as addProperty,Ae as applyJsonSchemaMetadata,V as bundleReferences,s as createStoragePromises,Qe as extract,K as extractHash,q as extractJsonSchema,J as extractResolvedVariant,X as extractSchema,$ as extractSchemaWithSource,Z as extractSource,Q as extractTSType,Y as extractVariant,S as getJsonSchema,Me as getJsonSchemaObject,x as getPrimarySchemaType,De as getProperties,xe as getPropertiesList,w as getProperty,v as isFileReference,g as isJsonSchema,Ie as isJsonSchemaAllOf,ze as isJsonSchemaAny,Se as isJsonSchemaAnyOf,Re as isJsonSchemaArray,he as isJsonSchemaBigint,re as isJsonSchemaBoolean,Le as isJsonSchemaDate,ge as isJsonSchemaDecimal,d as isJsonSchemaEnum,u as isJsonSchemaInteger,fe as isJsonSchemaKeywords,ke as isJsonSchemaLiteral,te as isJsonSchemaMap,Oe as isJsonSchemaNativeEnum,ue as isJsonSchemaNever,de as isJsonSchemaNull,pe as isJsonSchemaNullable,ie as isJsonSchemaNumber,f as isJsonSchemaObject,le as isJsonSchemaPrimitiveType,me as isJsonSchemaPrimitiveUnion,Be as isJsonSchemaRecord,ne as isJsonSchemaRef,ve as isJsonSchemaSet,oe as isJsonSchemaString,_e as isJsonSchemaTuple,ye as isJsonSchemaType,ae as isJsonSchemaUndefined,ce as isJsonSchemaUnion,je as isJsonSchemaUnknown,se as isNullOnlyJsonSchema,Ne as isPropertyOptional,m as isSchema,Ce as isSchemaNullable,be as isSchemaObject,h as isSchemaOf,p as isSchemaWithSource,ee as isStandardSchema,_ as isUntypedConfig,E as isUntypedConfigStrict,C as isUntypedSchema,T as isUntypedSchemaStrict,y as isValibotSchema,b as isValidSchemaConfigFile,l as mapStorageToFileSystem,Fe as merge,we as mergeMetadata,c as normalizeKey,Ee as readSchemaTypes,Te as traverseSchema};
1
+ import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./constants-lk1mMbgx.mjs";import{$ as s,A as c,B as l,C as ee,D as te,E as ne,F as re,G as ie,H as ae,I as oe,J as u,K as d,L as se,M as ce,N as f,O as le,P as ue,Q as p,R as de,S as fe,T as pe,U as me,V as he,W as ge,X as _e,Y as m,Z as h,_ as ve,a as ye,b as be,c as xe,d as Se,et as g,f as Ce,g as we,h as Te,i as Ee,it as _,j as De,k as Oe,l as ke,m as v,n as Ae,nt as je,o as Me,p as y,q as Ne,r as Pe,rt as Fe,s as Ie,t as Le,tt as b,u as Re,v as x,w as ze,x as Be,y as Ve,z as He}from"./helpers-s2Zqtb-K.mjs";import{n as Ue,r as We,t as S}from"./storage-BccFP9xn.mjs";import{isSetObject as C}from"@stryke/type-checks/is-set-object";import{isSetString as w}from"@stryke/type-checks/is-set-string";import{isSetString as T}from"@stryke/type-checks";import{extractFileReference as E}from"@stryke/convert/extract-file-reference";import{murmurhash as D}from"@stryke/hash";import{deepClone as Ge}from"@stryke/helpers/deep-clone";import{isStandardJsonSchema as O}from"@stryke/json";import{findFileExtensionSafe as Ke}from"@stryke/path/find";import{VALID_OBJECT_SOURCE_EXTENSIONS as k}from"@stryke/resolve/constants";import{loadSafe as qe}from"@stryke/resolve/load";import{list as Je}from"@stryke/string-format/list";import{extractJsonSchema as Ye,isZod3Type as A}from"@stryke/zod";import{toJsonSchema as Xe}from"@valibot/to-json-schema";import{createGenerator as Ze}from"ts-json-schema-generator/dist/factory/generator.js";const Qe=new Set([...o,`default`,`examples`]);function $e(e){return Qe.has(e)}function j(e){return!C(e)||e.type===`any`||Object.keys(e).filter(e=>!$e(e)).length===0}function M(e){if(j(e))return`any`;let t=e.type;if(w(t))return[t];if(Array.isArray(t))return t.filter(w);let n=_(e);return n.length>0?n:f(e)?[`object`]:x(e)?[`array`]:`any`}function N(e){return e.length>0?e:`schema`}function P(e,t){return JSON.stringify(e)===JSON.stringify(t)}function F(e,t,n=``){let r=[];if(j(e)||j(t))return r;let i=M(e),a=M(t);if(i!==`any`&&a!==`any`&&i.filter(e=>a.includes(e)).length===0)return r.push(`${N(n)} has conflicting types: ${i.join(`|`)} vs ${a.join(`|`)}`),r;let o=e.const,s=t.const;o!==void 0&&s!==void 0&&!P(o,s)&&r.push(`${N(n)} has conflicting const values`);let c=e.enum,l=t.enum;if(c?.length&&l?.length&&(l.some(e=>c.some(t=>P(t,e)))||r.push(`${N(n)} has enum values that do not overlap`)),f(e)&&f(t)){let i=e.properties??{},a=t.properties??{};for(let[e,t]of Object.entries(a)){let a=i[e],o=n?`${n}.${e}`:e;a&&v(a)&&v(t)&&r.push(...F(a,t,o))}}if(x(e)&&x(t)){let i=e.items,a=t.items;i&&a&&v(i)&&v(a)&&r.push(...F(i,a,n?`${n}[]`:`items`));let o=e.prefixItems,s=t.prefixItems;if(Array.isArray(o)&&Array.isArray(s)){let e=Math.min(o.length,s.length);for(let t=0;t<e;t++){let e=o[t],i=s[t];v(e)&&v(i)&&r.push(...F(e,i,n?`${n}[${t}]`:`[${t}]`))}}}return r}function et(e,t,n=`schema`){let r=F(e,t);if(r.length>0)throw Error(`The ${n} schema contradicts the generator schema:\n${r.map(e=>`- ${e}`).join(`
2
+ `)}`)}const I=`https://power-plant.invalid/`;function tt(e){return!(!C(e)||!(`schema`in e)||`hash`in e||`variant`in e||`source`in e)}function L(e){return tt(e)?e.schema:e}function R(e){return e.endsWith(`#`)?e.slice(0,-1):e}function z(e){let t=e.indexOf(`#`);return t>=0?e.slice(0,t):e}function nt(e){return e.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}function rt(e){return e.length===0?``:`/${e.map(e=>nt(e)).join(`/`)}`}function B(e,t){try{return R(new URL(e,t).toString())}catch{return R(e)}}function V(e,t,n,r,i){if(!C(e))return;let a=e,o=rt(t),s=T(a.$id)?B(a.$id,n):n,c=z(s);if(r.set(s,o),r.set(c,o),T(a.$anchor)&&r.set(`${c}#${a.$anchor}`,o),T(a.$dynamicAnchor)){let e=`${c}#${a.$dynamicAnchor}`;r.set(e,o),i.set(e,`#${a.$dynamicAnchor}`)}for(let[e,n]of Object.entries(a)){if(Array.isArray(n)){n.forEach((n,a)=>{V(n,[...t,e,String(a)],s,r,i)});continue}V(n,[...t,e],s,r,i)}}function H(e,t,n,r,i){if(!C(e))return;let a=e,o=T(a.$id)?B(a.$id,n):n;if(T(a.$ref)){let e=B(a.$ref,o),t=r.get(e)??r.get(z(e));t!==void 0&&(a.$ref=t.length>0?`#${t}`:`#`)}if(T(a.$dynamicRef)){let e=B(a.$dynamicRef,o),t=i.get(e);if(t)a.$dynamicRef=t;else{let t=r.get(e)??r.get(z(e));t!==void 0&&(a.$dynamicRef=t.length>0?`#${t}`:`#`)}}for(let[e,n]of Object.entries(a)){if(Array.isArray(n)){n.forEach((n,a)=>{H(n,[...t,e,String(a)],o,r,i)});continue}H(n,[...t,e],o,r,i)}}function U(e){if(!C(e))return e;let t=Ge(e),n=T(t.$id)?B(t.$id,I):I,r=new Map,i=new Map;return V(t,[],n,r,i),H(t,[],n,r,i),t}function W(e){if(s(e))return K(e);if(C(e)){if(h(e))return q(e);let t=e;if(`$schema`in t&&s(t.$schema))return K(t.$schema)}return e}function it(e){return Array.isArray(e)?e.map(e=>W(e)):e}function G(e){return Xe(e,{target:`draft-2020-12`})}function K(e){let t=e,n={};for(let[e,r]of Object.entries(t))if(e!==`tsType`&&e!==`markdownType`&&e!==`tags`&&e!==`args`&&e!==`resolve`){if(e===`id`&&T(r)){n.$id=r;continue}if(e===`properties`||e===`patternProperties`||e===`dependentSchemas`||e===`$defs`||e===`definitions`){if(!C(r)){n[e]=r;continue}n[e]=Object.fromEntries(Object.entries(r).map(([e,t])=>[e,W(t)]));continue}if(e===`items`||e===`contains`||e===`if`||e===`then`||e===`else`||e===`not`||e===`propertyNames`||e===`additionalProperties`||e===`unevaluatedProperties`){n[e]=W(r);continue}if(e===`oneOf`||e===`anyOf`||e===`allOf`){n[e]=it(r);continue}n[e]=r}return n}function q(e){let t=e,n=s(t.$schema)?K(t.$schema):{},r={};for(let[e,n]of Object.entries(t)){if(e.startsWith(`$`)||!C(n))continue;if(h(n)){r[e]=q(n);continue}let t=n;if(`$schema`in t&&s(t.$schema)){r[e]=K(t.$schema);continue}s(n)&&(r[e]=K(n))}if(!f(n))throw Error(`Failed to convert untyped input to JSON Schema. The base schema must be a valid JSON Schema object.`);let i={...C(n.properties)?n.properties:{},...r};return{...n,type:n.type??`object`,...Object.keys(i).length>0?{properties:i}:{}}}function J(e,t){let n=L(t);if(m(n)||d(n))return D({variant:e,input:n.schema});if(T(n)||typeof n==`boolean`)return D({variant:e,input:n});if(C(n)){if(A(n))return D({variant:e,input:n._def});if(O(n))return D({variant:e,input:n[`~standard`]});if(v(n))return D({variant:e,input:n});if(b(n))return D({variant:e,input:G(n)});if(h(n))return D({variant:e,input:q(n)});if(s(n))return D({variant:e,input:K(n)})}throw Error(`Failed to create an input hash for the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, or a reflected Deepkit Type object.`)}function Y(e){if(C(e)){if(A(e))return Ye(e,{target:`draft-2020-12`});if(p(e))return q(e);if(g(e))return K(e);if(O(e))return e[`~standard`].jsonSchema.input({target:`draft-2020-12`});if(b(e))return G(e);if(v(e))return e}}function X(e){if(C(e)){if(A(e))return`zod3`;if(p(e)||g(e))return`untyped`;if(O(e))return`standard-schema`;if(v(e))return`json-schema`;if(b(e))return`valibot`}throw Error(`Failed to determine the variant of the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, a reflected Deepkit Type object, or an Untyped schema.`)}function Z(e){let t=L(e);return m(t)||d(t)?t.variant:T(t)||y(t)?`file-reference`:X(t)}async function at(e,t){if(m(e))return e.schema;let n=t??X(e),r;if((n===`zod3`||n===`json-schema`||n===`standard-schema`||n===`untyped`||n===`valibot`)&&(r=Y(e)),r)return U(r);throw Error(`Failed to extract a valid schema from the provided input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, an untyped schema, or a reflected Deepkit Type object.`)}function Q(e,t){if(e===`zod3`)return{hash:J(e,t),variant:`zod3`,schema:t};if(e===`untyped`)return{hash:J(e,t),variant:`untyped`,schema:t};if(e===`standard-schema`)return{hash:J(e,t),variant:`standard-schema`,schema:t};if(e===`json-schema`)return{hash:J(e,t),variant:`json-schema`,schema:t};if(e===`valibot`)return{hash:J(e,t),variant:`valibot`,schema:t};throw Error(`Failed to extract source information from the provided input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, an untyped schema, or a reflected Deepkit Type object.`)}async function ot(e,t={}){let n=E(e);if(!n)throw Error(`Failed to extract a file reference from the provided input. The input must be a string or an object with a "file" property that specifies the file path and optional export name.`);let r=n.export??`*`;try{return Ze({path:n.file,type:r,expose:`export`,jsDoc:`extended`,...t}).createSchema(r)}catch(e){throw Error(`Failed to generate a JSON schema for "${n.file}" using the type "${r}". Error: ${e.message}`)}}async function $(e,t={}){let n=L(e);if(m(n))return n;if(d(n))return{...n,source:{hash:J(`json-schema`,n.schema),variant:`json-schema`,schema:n.schema}};let r,i=Z(n),a=J(i,n);if(i===`file-reference`){let e=E(n);if(!e)throw Error(`Failed to extract a valid file reference from the provided input "${JSON.stringify(n)}". Please ensure that the input is correctly formatted as a file reference (e.g. "./schema.ts#MySchema") and that the file exists at the specified path.`);let i=Ke(e.file);if(i&&!k.includes(i))throw Error(`The provided schema file input "${e.file}" has an invalid file extension (.${i}). Please ensure that the file has one of the following extensions: ${Je(k,{conjunction:`or`})}.`);let a;t.storage&&(a=S(t.storage));let o=await qe(n,{...t,fs:a});o??=await ot(n,{...t,fs:a});let s=L(o);r=m(s)?s.source:d(s)?{hash:J(`json-schema`,s.schema),variant:`json-schema`,schema:s.schema}:Q(X(s),s)}else if([`json-schema`,`standard-schema`,`zod3`,`untyped`,`valibot`,`reflection`].includes(i))r=Q(i,n);else throw Error(`Invalid schema definition input "${i}". The variant must be one of "file-reference", "json-schema", "standard-schema", "zod3", "valibot", "untyped", or "reflection".`);return{variant:i,source:r,schema:await at(r.schema,r.variant),hash:a}}async function st(e,t={}){let n=L(e);if(m(n)||u(n))return n;let r=await $(e,t);if(!r?.schema)throw Error(`Failed to extract a valid schema from the provided input. The input must be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a reflected Deepkit Type object.`);return r}export{o as JSON_SCHEMA_METADATA_KEYS,n as JSON_SCHEMA_PRIMITIVE_TYPES,i as JSON_SCHEMA_TYPES,t as JsonSchemaTypeNames,e as SCHEMA_ARRAY_CONCAT_KEYWORDS,r as SCHEMA_RECORD_KEYWORDS,a as SCHEMA_SINGLE_KEYWORDS,Le as addProperty,je as applyJsonSchemaMetadata,et as assertSchemasDoNotContradict,U as bundleReferences,Ue as createStoragePromises,st as extract,J as extractHash,Y as extractJsonSchema,X as extractResolvedVariant,at as extractSchema,$ as extractSchemaWithSource,Q as extractSource,ot as extractTSType,Z as extractVariant,F as findSchemaContradictions,Ae as getJsonSchema,Pe as getJsonSchemaObject,Fe as getPrimarySchemaType,Ee as getProperties,ye as getPropertiesList,Me as getProperty,y as isFileReference,v as isJsonSchema,Te as isJsonSchemaAllOf,we as isJsonSchemaAny,ve as isJsonSchemaAnyOf,x as isJsonSchemaArray,Ve as isJsonSchemaBigint,be as isJsonSchemaBoolean,Be as isJsonSchemaDate,fe as isJsonSchemaDecimal,ee as isJsonSchemaEnum,ze as isJsonSchemaInteger,pe as isJsonSchemaKeywords,ne as isJsonSchemaLiteral,te as isJsonSchemaMap,le as isJsonSchemaNativeEnum,Oe as isJsonSchemaNever,c as isJsonSchemaNull,De as isJsonSchemaNullable,ce as isJsonSchemaNumber,f as isJsonSchemaObject,ue as isJsonSchemaPrimitiveType,re as isJsonSchemaPrimitiveUnion,oe as isJsonSchemaRecord,se as isJsonSchemaRef,de as isJsonSchemaSet,He as isJsonSchemaString,l as isJsonSchemaTuple,he as isJsonSchemaType,ae as isJsonSchemaUndefined,me as isJsonSchemaUnion,ge as isJsonSchemaUnknown,ie as isNullOnlyJsonSchema,Ie as isPropertyOptional,d as isSchema,xe as isSchemaNullable,Ne as isSchemaObject,u as isSchemaOf,m as isSchemaWithSource,_e as isStandardSchema,h as isUntypedConfig,p as isUntypedConfigStrict,s as isUntypedSchema,g as isUntypedSchemaStrict,b as isValibotSchema,ke as isValidSchemaConfigFile,S as mapStorageToFileSystem,Re as merge,Se as mergeMetadata,We as normalizeKey,_ as readSchemaTypes,Ce as traverseSchema};
2
3
  //# sourceMappingURL=index.mjs.map
package/dist/zod.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-CMqjfN_6.cjs"),t=require("./constants-CjTQhR-l.cjs"),n=require("./helpers-CrePPGkD.cjs");let r=require("@stryke/helpers/deep-clone"),i=require("zod/mini");i=e.t(i,1);let a=require("zod/v4");a=e.t(a,1);const o=i.enum(t.r),s=i.union([i.string(),i.number(),i.bigint(),i.boolean(),i.null()]),c=i.union([i.number(),i.bigint()]),l=i.union([i.boolean(),i.string(),i.object({message:i.optional(i.string()),since:i.optional(i.string()),alternative:i.optional(i.string())})]),u=i.union([i.unknown(),i.object({name:i.optional(i.string()),description:i.optional(i.string()),value:i.unknown()})]),d=i.number().check(i.int(),i.nonnegative()),f=i.object({$ref:i.string().check(i.minLength(1,`Reference must be a non-empty URI`))});function p(e){return i.union([f,e])}const m=i.object({$id:i.optional(i.string()),$schema:i.optional(i.string()),$vocabulary:i.optional(i.record(i.string(),i.boolean())),$comment:i.optional(i.string()),$anchor:i.optional(i.string()),$dynamicRef:i.optional(i.string()),$dynamicAnchor:i.optional(i.string()),name:i.optional(i.string()),version:i.optional(i.union([i.string(),i.number()])),title:i.optional(i.string()),description:i.optional(i.string()),docs:i.optional(i.string()),examples:i.optional(i.array(u)),alias:i.optional(i.array(i.string())),tags:i.optional(i.array(i.string())),deprecated:i.optional(l),hidden:i.optional(i.boolean()),ignore:i.optional(i.boolean()),internal:i.optional(i.boolean()),runtime:i.optional(i.boolean()),readOnly:i.optional(i.boolean()),writeOnly:i.optional(i.boolean())}),h=i.lazy(()=>{let e=i.object({type:i.literal(`array`),prefixItems:i.tuple([h,h]),items:i.optional(i.literal(!1)),minItems:i.literal(2),maxItems:i.literal(2)}),t=i.extend(m,{$ref:i.optional(i.string()),$defs:i.optional(i.record(i.string(),h)),type:i.optional(i.union([o,i.array(o)])),const:i.optional(i.unknown()),enum:i.optional(i.array(s)),format:i.optional(i.string()),default:i.optional(i.unknown()),allOf:i.optional(i.array(h)),anyOf:i.optional(i.array(h)),oneOf:i.optional(i.array(h)),not:i.optional(h),if:i.optional(h),then:i.optional(h),else:i.optional(h),properties:i.optional(i.record(i.string(),h)),patternProperties:i.optional(i.record(i.string(),h)),additionalProperties:i.optional(i.union([i.boolean(),h])),required:i.optional(i.array(i.string())),propertyNames:i.optional(h),dependencies:i.optional(i.record(i.string(),i.union([i.array(i.string()),h]))),dependentRequired:i.optional(i.record(i.string(),i.array(i.string()))),dependentSchemas:i.optional(i.record(i.string(),h)),minProperties:i.optional(d),maxProperties:i.optional(d),primaryKey:i.optional(i.array(i.string())),databaseSchema:i.optional(i.string()),unevaluatedProperties:i.optional(i.union([i.boolean(),h])),prefixItems:i.optional(i.array(h)),items:i.optional(i.union([h,e])),contains:i.optional(h),minItems:i.optional(d),maxItems:i.optional(d),uniqueItems:i.optional(i.boolean()),minContains:i.optional(d),maxContains:i.optional(d),unevaluatedItems:i.optional(i.union([i.boolean(),h])),minLength:i.optional(d),maxLength:i.optional(d),pattern:i.optional(i.string()),contentMediaType:i.optional(i.string()),contentEncoding:i.optional(i.string()),contentSchema:i.optional(i.string()),minimum:i.optional(c),maximum:i.optional(c),exclusiveMinimum:i.optional(c),exclusiveMaximum:i.optional(c),multipleOf:i.optional(c)});return i.union([f,t])});function g(e,t={}){let i=(0,r.deepClone)(n.n(e));return n.f(i,e=>{n.y(e)&&(e.type=[`string`,`number`,`integer`,`boolean`,`null`,`array`,`object`])}),a.fromJSONSchema(i,t)}exports.jsonSchema=h,exports.refOr=p,exports.referenceSchema=f,exports.toZodSchema=g;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-CMqjfN_6.cjs"),t=require("./constants-CjTQhR-l.cjs"),n=require("./helpers-CFED4EbH.cjs");let r=require("@stryke/helpers/deep-clone"),i=require("zod/mini");i=e.t(i,1);let a=require("zod/v4");a=e.t(a,1);const o=i.enum(t.r),s=i.union([i.string(),i.number(),i.bigint(),i.boolean(),i.null()]),c=i.union([i.number(),i.bigint()]),l=i.union([i.boolean(),i.string(),i.object({message:i.optional(i.string()),since:i.optional(i.string()),alternative:i.optional(i.string())})]),u=i.union([i.unknown(),i.object({name:i.optional(i.string()),description:i.optional(i.string()),value:i.unknown()})]),d=i.number().check(i.int(),i.nonnegative()),f=i.object({$ref:i.string().check(i.minLength(1,`Reference must be a non-empty URI`))});function p(e){return i.union([f,e])}const m=i.object({$id:i.optional(i.string()),$schema:i.optional(i.string()),$vocabulary:i.optional(i.record(i.string(),i.boolean())),$comment:i.optional(i.string()),$anchor:i.optional(i.string()),$dynamicRef:i.optional(i.string()),$dynamicAnchor:i.optional(i.string()),name:i.optional(i.string()),version:i.optional(i.union([i.string(),i.number()])),title:i.optional(i.string()),description:i.optional(i.string()),docs:i.optional(i.string()),examples:i.optional(i.array(u)),alias:i.optional(i.array(i.string())),tags:i.optional(i.array(i.string())),deprecated:i.optional(l),hidden:i.optional(i.boolean()),ignore:i.optional(i.boolean()),internal:i.optional(i.boolean()),runtime:i.optional(i.boolean()),readOnly:i.optional(i.boolean()),writeOnly:i.optional(i.boolean())}),h=i.lazy(()=>{let e=i.object({type:i.literal(`array`),prefixItems:i.tuple([h,h]),items:i.optional(i.literal(!1)),minItems:i.literal(2),maxItems:i.literal(2)}),t=i.extend(m,{$ref:i.optional(i.string()),$defs:i.optional(i.record(i.string(),h)),type:i.optional(i.union([o,i.array(o)])),const:i.optional(i.unknown()),enum:i.optional(i.array(s)),format:i.optional(i.string()),default:i.optional(i.unknown()),allOf:i.optional(i.array(h)),anyOf:i.optional(i.array(h)),oneOf:i.optional(i.array(h)),not:i.optional(h),if:i.optional(h),then:i.optional(h),else:i.optional(h),properties:i.optional(i.record(i.string(),h)),patternProperties:i.optional(i.record(i.string(),h)),additionalProperties:i.optional(i.union([i.boolean(),h])),required:i.optional(i.array(i.string())),propertyNames:i.optional(h),dependencies:i.optional(i.record(i.string(),i.union([i.array(i.string()),h]))),dependentRequired:i.optional(i.record(i.string(),i.array(i.string()))),dependentSchemas:i.optional(i.record(i.string(),h)),minProperties:i.optional(d),maxProperties:i.optional(d),primaryKey:i.optional(i.array(i.string())),databaseSchema:i.optional(i.string()),unevaluatedProperties:i.optional(i.union([i.boolean(),h])),prefixItems:i.optional(i.array(h)),items:i.optional(i.union([h,e])),contains:i.optional(h),minItems:i.optional(d),maxItems:i.optional(d),uniqueItems:i.optional(i.boolean()),minContains:i.optional(d),maxContains:i.optional(d),unevaluatedItems:i.optional(i.union([i.boolean(),h])),minLength:i.optional(d),maxLength:i.optional(d),pattern:i.optional(i.string()),contentMediaType:i.optional(i.string()),contentEncoding:i.optional(i.string()),contentSchema:i.optional(i.string()),minimum:i.optional(c),maximum:i.optional(c),exclusiveMinimum:i.optional(c),exclusiveMaximum:i.optional(c),multipleOf:i.optional(c)});return i.union([f,t])});function g(e,t={}){let i=(0,r.deepClone)(n.n(e));return n.f(i,e=>{n.g(e)&&(e.type=[`string`,`number`,`integer`,`boolean`,`null`,`array`,`object`])}),a.fromJSONSchema(i,t)}exports.jsonSchema=h,exports.refOr=p,exports.referenceSchema=f,exports.toZodSchema=g;
package/dist/zod.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import{r as e}from"./constants-lk1mMbgx.mjs";import{f as t,n,y as r}from"./helpers-CfLw5cNk.mjs";import{deepClone as i}from"@stryke/helpers/deep-clone";import*as a from"zod/mini";import*as o from"zod/v4";const s=a.enum(e),c=a.union([a.string(),a.number(),a.bigint(),a.boolean(),a.null()]),l=a.union([a.number(),a.bigint()]),u=a.union([a.boolean(),a.string(),a.object({message:a.optional(a.string()),since:a.optional(a.string()),alternative:a.optional(a.string())})]),d=a.union([a.unknown(),a.object({name:a.optional(a.string()),description:a.optional(a.string()),value:a.unknown()})]),f=a.number().check(a.int(),a.nonnegative()),p=a.object({$ref:a.string().check(a.minLength(1,`Reference must be a non-empty URI`))});function m(e){return a.union([p,e])}const h=a.object({$id:a.optional(a.string()),$schema:a.optional(a.string()),$vocabulary:a.optional(a.record(a.string(),a.boolean())),$comment:a.optional(a.string()),$anchor:a.optional(a.string()),$dynamicRef:a.optional(a.string()),$dynamicAnchor:a.optional(a.string()),name:a.optional(a.string()),version:a.optional(a.union([a.string(),a.number()])),title:a.optional(a.string()),description:a.optional(a.string()),docs:a.optional(a.string()),examples:a.optional(a.array(d)),alias:a.optional(a.array(a.string())),tags:a.optional(a.array(a.string())),deprecated:a.optional(u),hidden:a.optional(a.boolean()),ignore:a.optional(a.boolean()),internal:a.optional(a.boolean()),runtime:a.optional(a.boolean()),readOnly:a.optional(a.boolean()),writeOnly:a.optional(a.boolean())}),g=a.lazy(()=>{let e=a.object({type:a.literal(`array`),prefixItems:a.tuple([g,g]),items:a.optional(a.literal(!1)),minItems:a.literal(2),maxItems:a.literal(2)}),t=a.extend(h,{$ref:a.optional(a.string()),$defs:a.optional(a.record(a.string(),g)),type:a.optional(a.union([s,a.array(s)])),const:a.optional(a.unknown()),enum:a.optional(a.array(c)),format:a.optional(a.string()),default:a.optional(a.unknown()),allOf:a.optional(a.array(g)),anyOf:a.optional(a.array(g)),oneOf:a.optional(a.array(g)),not:a.optional(g),if:a.optional(g),then:a.optional(g),else:a.optional(g),properties:a.optional(a.record(a.string(),g)),patternProperties:a.optional(a.record(a.string(),g)),additionalProperties:a.optional(a.union([a.boolean(),g])),required:a.optional(a.array(a.string())),propertyNames:a.optional(g),dependencies:a.optional(a.record(a.string(),a.union([a.array(a.string()),g]))),dependentRequired:a.optional(a.record(a.string(),a.array(a.string()))),dependentSchemas:a.optional(a.record(a.string(),g)),minProperties:a.optional(f),maxProperties:a.optional(f),primaryKey:a.optional(a.array(a.string())),databaseSchema:a.optional(a.string()),unevaluatedProperties:a.optional(a.union([a.boolean(),g])),prefixItems:a.optional(a.array(g)),items:a.optional(a.union([g,e])),contains:a.optional(g),minItems:a.optional(f),maxItems:a.optional(f),uniqueItems:a.optional(a.boolean()),minContains:a.optional(f),maxContains:a.optional(f),unevaluatedItems:a.optional(a.union([a.boolean(),g])),minLength:a.optional(f),maxLength:a.optional(f),pattern:a.optional(a.string()),contentMediaType:a.optional(a.string()),contentEncoding:a.optional(a.string()),contentSchema:a.optional(a.string()),minimum:a.optional(l),maximum:a.optional(l),exclusiveMinimum:a.optional(l),exclusiveMaximum:a.optional(l),multipleOf:a.optional(l)});return a.union([p,t])});function _(e,a={}){let s=i(n(e));return t(s,e=>{r(e)&&(e.type=[`string`,`number`,`integer`,`boolean`,`null`,`array`,`object`])}),o.fromJSONSchema(s,a)}export{g as jsonSchema,m as refOr,p as referenceSchema,_ as toZodSchema};
1
+ import{r as e}from"./constants-lk1mMbgx.mjs";import{f as t,g as n,n as r}from"./helpers-s2Zqtb-K.mjs";import{deepClone as i}from"@stryke/helpers/deep-clone";import*as a from"zod/mini";import*as o from"zod/v4";const s=a.enum(e),c=a.union([a.string(),a.number(),a.bigint(),a.boolean(),a.null()]),l=a.union([a.number(),a.bigint()]),u=a.union([a.boolean(),a.string(),a.object({message:a.optional(a.string()),since:a.optional(a.string()),alternative:a.optional(a.string())})]),d=a.union([a.unknown(),a.object({name:a.optional(a.string()),description:a.optional(a.string()),value:a.unknown()})]),f=a.number().check(a.int(),a.nonnegative()),p=a.object({$ref:a.string().check(a.minLength(1,`Reference must be a non-empty URI`))});function m(e){return a.union([p,e])}const h=a.object({$id:a.optional(a.string()),$schema:a.optional(a.string()),$vocabulary:a.optional(a.record(a.string(),a.boolean())),$comment:a.optional(a.string()),$anchor:a.optional(a.string()),$dynamicRef:a.optional(a.string()),$dynamicAnchor:a.optional(a.string()),name:a.optional(a.string()),version:a.optional(a.union([a.string(),a.number()])),title:a.optional(a.string()),description:a.optional(a.string()),docs:a.optional(a.string()),examples:a.optional(a.array(d)),alias:a.optional(a.array(a.string())),tags:a.optional(a.array(a.string())),deprecated:a.optional(u),hidden:a.optional(a.boolean()),ignore:a.optional(a.boolean()),internal:a.optional(a.boolean()),runtime:a.optional(a.boolean()),readOnly:a.optional(a.boolean()),writeOnly:a.optional(a.boolean())}),g=a.lazy(()=>{let e=a.object({type:a.literal(`array`),prefixItems:a.tuple([g,g]),items:a.optional(a.literal(!1)),minItems:a.literal(2),maxItems:a.literal(2)}),t=a.extend(h,{$ref:a.optional(a.string()),$defs:a.optional(a.record(a.string(),g)),type:a.optional(a.union([s,a.array(s)])),const:a.optional(a.unknown()),enum:a.optional(a.array(c)),format:a.optional(a.string()),default:a.optional(a.unknown()),allOf:a.optional(a.array(g)),anyOf:a.optional(a.array(g)),oneOf:a.optional(a.array(g)),not:a.optional(g),if:a.optional(g),then:a.optional(g),else:a.optional(g),properties:a.optional(a.record(a.string(),g)),patternProperties:a.optional(a.record(a.string(),g)),additionalProperties:a.optional(a.union([a.boolean(),g])),required:a.optional(a.array(a.string())),propertyNames:a.optional(g),dependencies:a.optional(a.record(a.string(),a.union([a.array(a.string()),g]))),dependentRequired:a.optional(a.record(a.string(),a.array(a.string()))),dependentSchemas:a.optional(a.record(a.string(),g)),minProperties:a.optional(f),maxProperties:a.optional(f),primaryKey:a.optional(a.array(a.string())),databaseSchema:a.optional(a.string()),unevaluatedProperties:a.optional(a.union([a.boolean(),g])),prefixItems:a.optional(a.array(g)),items:a.optional(a.union([g,e])),contains:a.optional(g),minItems:a.optional(f),maxItems:a.optional(f),uniqueItems:a.optional(a.boolean()),minContains:a.optional(f),maxContains:a.optional(f),unevaluatedItems:a.optional(a.union([a.boolean(),g])),minLength:a.optional(f),maxLength:a.optional(f),pattern:a.optional(a.string()),contentMediaType:a.optional(a.string()),contentEncoding:a.optional(a.string()),contentSchema:a.optional(a.string()),minimum:a.optional(l),maximum:a.optional(l),exclusiveMinimum:a.optional(l),exclusiveMaximum:a.optional(l),multipleOf:a.optional(l)});return a.union([p,t])});function _(e,a={}){let s=i(r(e));return t(s,e=>{n(e)&&(e.type=[`string`,`number`,`integer`,`boolean`,`null`,`array`,`object`])}),o.fromJSONSchema(s,a)}export{g as jsonSchema,m as refOr,p as referenceSchema,_ as toZodSchema};
2
2
  //# sourceMappingURL=zod.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@power-plant/schema",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "private": false,
5
5
  "description": "A Power Plant utility package to help managing schemas.",
6
6
  "keywords": [
@@ -155,5 +155,5 @@
155
155
  "zod": { "optional": true }
156
156
  },
157
157
  "publishConfig": { "access": "public" },
158
- "gitHead": "e74eca4c7a32c5289a37be1cf42240e6abd051ac"
158
+ "gitHead": "0639d772e3b45c9a4060f913fd5ee26c68ac48ad"
159
159
  }
@@ -1,2 +0,0 @@
1
- import{a as e,n as t,o as n,r,s as i,t as a}from"./constants-lk1mMbgx.mjs";import{findFileExtensionSafe as o}from"@stryke/path/find";import{VALID_OBJECT_SOURCE_EXTENSIONS as ee}from"@stryke/resolve/constants";import{isBoolean as s,isFunction as c,isSetObject as l,isSetString as u,isString as te}from"@stryke/type-checks";import{isSetObject as d}from"@stryke/type-checks/is-set-object";import{getUnique as ne}from"@stryke/helpers/get-unique";import re from"defu";import{isSetString as f}from"@stryke/type-checks/is-set-string";function ie(e){return!te(e)&&e.file!==void 0}const p=e=>typeof e==`number`&&Number.isFinite(e),ae=e=>l(e)||s(e),m=e=>l(e)&&Object.values(e).every(e=>ae(e)),oe=e=>l(e)&&Object.values(e).every(e=>s(e)),h=e=>Array.isArray(e)&&e.every(e=>u(e)),se=e=>l(e)&&Object.values(e).every(e=>h(e)),g=new Set(t),_=new Set(r);function ce(e){return u(e)&&g.has(e)}function v(e){return u(e)&&_.has(e)}const le=new Set([`date`,`time`,`date-time`,`iso-time`,`iso-date-time`,`unix-time`]),y=e=>typeof e==`bigint`,ue=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`function`,`object`,`any`,`array`]),b=e=>u(e)&&ue.has(e),x=e=>{if(!l(e))return!1;let t=e;return!(t.type!==void 0&&!(u(t.type)&&b(t.type)||Array.isArray(t.type)&&t.type.every(e=>b(e)))||t.tsType!==void 0&&!u(t.tsType)||t.markdownType!==void 0&&!u(t.markdownType)||t.items!==void 0&&!(x(t.items)||Array.isArray(t.items)&&t.items.every(e=>x(e))))},de=e=>{if(!x(e))return!1;let t=e;return t.name!==void 0&&!u(t.name)?!1:t.optional===void 0||typeof t.optional==`boolean`},fe=e=>l(e)&&Object.values(e).every(e=>q(e)),S=(e,t)=>Array.isArray(e)&&e.every(e=>t(e)),pe=(e,t,n)=>Array.isArray(e)&&e.length===2&&t(e[0])&&n(e[1]),C=(e,t=!1)=>e===void 0||te(e)&&(t||e.length>0),w=e=>e===void 0||s(e),T=e=>e===void 0||p(e),E=e=>e===void 0||y(e),D=e=>e===void 0||K(e),O=e=>e===void 0||S(e,K),me=e=>e===void 0||Array.isArray(e)&&e.every(e=>u(e)&&g.has(e)),he=e=>e===void 0||Array.isArray(e)&&e.every(e=>u(e)&&_.has(e)),k=e=>!(!C(e.$id)||!C(e.$schema)||e.$vocabulary!==void 0&&!oe(e.$vocabulary)||!C(e.$comment,!0)||!C(e.$anchor)||e.$defs!==void 0&&!m(e.$defs)||!C(e.$dynamicRef)||!C(e.$dynamicAnchor)||!C(e.name)||!C(e.title,!0)||!C(e.description,!0)||!C(e.docs,!0)||e.examples!==void 0&&!Array.isArray(e.examples)||e.alias!==void 0&&!h(e.alias)||e.tags!==void 0&&!h(e.tags)||!w(e.deprecated)||!w(e.hidden)||!w(e.ignore)||!w(e.internal)||!w(e.runtime)||!w(e.readOnly)||!w(e.writeOnly)||!O(e.allOf)||!O(e.anyOf)||!O(e.oneOf)||!D(e.not)||!D(e.if)||!D(e.then)||!D(e.else));function ge(e){return l(e)?k(e):!1}function A(e){if(!l(e))return!1;let n=e;return k(n)&&C(n.$ref)&&(!n.type||Array.isArray(n.type)&&n.type.every(e=>t.includes(e)))}function j(e){if(!l(e))return!1;let t=e;return!k(t)||t.type!==`array`?!1:O(t.prefixItems)&&D(t.items)&&D(t.contains)&&T(t.minItems)&&T(t.maxItems)&&w(t.uniqueItems)&&T(t.minContains)&&T(t.maxContains)&&(t.unevaluatedItems===void 0||s(t.unevaluatedItems)||K(t.unevaluatedItems))}function M(e){if(!l(e))return!1;let t=e;return!k(t)||t.type!==`integer`||t.format!==`int64`?!1:E(t.minimum)&&E(t.exclusiveMinimum)&&E(t.maximum)&&E(t.exclusiveMaximum)&&E(t.multipleOf)&&E(t.default)&&(t.enum===void 0||S(t.enum,y))}function N(e){if(!l(e))return!1;let t=e;return k(t)&&t.type===`boolean`&&w(t.default)}function P(e){if(!l(e))return!1;let t=e;return k(t)?t.anyOf===void 0?t.type!==`integer`&&t.type!==`string`||!u(t.format)||!le.has(t.format)?!1:T(t.minimum)&&T(t.maximum)&&(t.default===void 0||u(t.default)||p(t.default)):S(t.anyOf,P):!1}function F(e){if(!l(e))return!1;let t=e;if(!k(t)||!u(t.type)||!g.has(t.type)||!Array.isArray(t.enum))return!1;let n=t.type,r=t.enum,i=t.default;return n===`string`?r.every(e=>u(e))&&(i===void 0||u(i)):n===`number`||n===`integer`?r.every(e=>p(e))&&(i===void 0||p(i)):n===`boolean`?r.every(e=>s(e))&&(i===void 0||s(i)):n===`null`&&r.every(e=>e===null)&&i==null}function I(e){if(!l(e))return!1;let t=e;return!k(t)||!S(t.allOf,K)?!1:t.unevaluatedProperties===void 0||s(t.unevaluatedProperties)||K(t.unevaluatedProperties)}function L(e){if(!l(e))return!1;let t=e;return!k(t)||!(`const`in t)?!1:t.type===void 0||u(t.type)&&v(t.type)||he(t.type)}function R(e){if(!l(e))return!1;let t=e;if(!k(t)||t.type!==`array`||t.maxItems!==125||!l(t.items))return!1;let n=t.items;return n.type===`array`&&pe(n.prefixItems,K,K)&&(n.items===void 0||n.items===!1)&&n.minItems===2&&n.maxItems===2}function z(e){if(!l(e))return!1;let t=e,n=t.type===`string`||t.type===`number`||Array.isArray(t.type)&&t.type.length===2&&t.type[0]===`string`&&t.type[1]===`number`;return k(t)&&n&&Array.isArray(t.enum)&&t.enum.every(e=>u(e)||p(e))}function B(e){if(!l(e))return!1;let t=e;return k(t)&&A(t.not)}function V(e){if(!l(e))return!1;let t=e;return k(t)&&t.type===`null`&&(t.const===void 0||t.const===null)&&(t.enum===void 0||Array.isArray(t.enum)&&t.enum.every(e=>e===null))&&(t.default===void 0||t.default===null)}function H(e){if(!l(e))return!1;let t=e;if(!k(t))return!1;let n=t.anyOf!==void 0&&Array.isArray(t.anyOf)&&t.anyOf.length===2&&K(t.anyOf[0])&&V(t.anyOf[1]),r=Array.isArray(t.type)&&t.type.length===2&&(t.type[0]===`null`&&u(t.type[1])&&t.type[1]!==`null`&&_.has(t.type[1])||t.type[1]===`null`&&u(t.type[0])&&t.type[0]!==`null`&&_.has(t.type[0]));return n||r}function U(e){if(!l(e))return!1;let t=e;return!k(t)||t.type!==`number`&&t.type!==`integer`?!1:C(t.format)&&T(t.minimum)&&T(t.exclusiveMinimum)&&T(t.maximum)&&T(t.exclusiveMaximum)&&T(t.multipleOf)&&T(t.default)&&(t.enum===void 0||S(t.enum,p))}function W(e){return U(e)&&e.type===`integer`}function _e(e){return U(e)&&e.type===`number`}function G(e){if(!l(e))return!1;let t=e;return k(t)&&t.type===`object`&&(t.properties===void 0||m(t.properties))&&(t.patternProperties===void 0||m(t.patternProperties))&&(t.additionalProperties===void 0||s(t.additionalProperties)||K(t.additionalProperties))&&(t.required===void 0||h(t.required))&&(t.unevaluatedProperties===void 0||s(t.unevaluatedProperties)||K(t.unevaluatedProperties))&&(t.dependencies===void 0||l(t.dependencies)&&Object.values(t.dependencies).every(e=>h(e)||K(e)))&&(t.dependentRequired===void 0||se(t.dependentRequired))&&(t.dependentSchemas===void 0||m(t.dependentSchemas))&&T(t.minProperties)&&T(t.maxProperties)&&(t.primaryKey===void 0||h(t.primaryKey))&&C(t.databaseSchema)}function ve(e){if(!l(e))return!1;let t=e;return k(t)&&t.type===`string`&&T(t.minLength)&&T(t.maxLength)&&C(t.pattern)&&C(t.format)&&C(t.default)&&(t.enum===void 0||S(t.enum,u))&&C(t.contentMediaType)&&C(t.contentEncoding)&&C(t.contentSchema)}function ye(e){if(!l(e))return!1;let t=e;return k(t)&&t.type===`array`&&t.uniqueItems===!0&&O(t.prefixItems)&&D(t.items)&&D(t.contains)&&T(t.minItems)&&T(t.maxItems)&&T(t.minContains)&&T(t.maxContains)&&(t.unevaluatedItems===void 0||s(t.unevaluatedItems)||K(t.unevaluatedItems))}function be(e){if(!l(e))return!1;let t=e;return k(t)&&t.type===`object`&&(t.patternProperties===void 0||m(t.patternProperties))&&(t.additionalProperties===void 0||s(t.additionalProperties)||K(t.additionalProperties))&&D(t.propertyNames)}function xe(e){if(!l(e))return!1;let t=e;return k(t)&&t.type===`array`&&S(t.prefixItems,K)&&T(t.minItems)&&T(t.maxItems)&&D(t.items)&&D(t.contains)&&w(t.uniqueItems)&&T(t.minContains)&&T(t.maxContains)&&(t.unevaluatedItems===void 0||s(t.unevaluatedItems)||K(t.unevaluatedItems))}function Se(e){if(!l(e))return!1;let t=e;return k(t)&&A(t.not)&&(t.default===void 0||t.default===void 0)}function Ce(e){if(!l(e))return!1;let t=e;return k(t)?u(t.type)&&g.has(t.type)?t.enum===void 0?!0:Array.isArray(t.enum)?t.type===`string`?t.enum.every(e=>u(e))&&(t.default===void 0||u(t.default)):t.type===`number`?t.enum.every(e=>p(e))&&(t.default===void 0||p(t.default)):t.type===`boolean`?t.enum.every(e=>s(e))&&(t.default===void 0||s(t.default)):t.type===`integer`?t.format===`int64`&&t.enum.every(e=>y(e))&&(t.default===void 0||y(t.default)):t.type===`null`&&t.enum.every(e=>e===null)&&(t.default===void 0||t.default===null):!1:me(t.type)&&t.type!==void 0:!1}function we(e){if(!l(e))return!1;let t=e;return k(t)&&(Ce(t)||Ee(t))}function Te(e){return A(e)}function Ee(e){if(!l(e))return!1;let t=e;return k(t)&&S(t.anyOf,K)}function De(e){if(!l(e))return!1;let t=e;return k(t)&&u(t.$ref)}function Oe(e){if(!l(e))return!1;let t=e;if(!l(t[`~standard`]))return!1;let n=t[`~standard`];return n.version===1&&c(n.validate)}function ke(e){if(!l(e)||!Oe(e))return!1;let t=e;return t.kind===`schema`&&u(t.type)&&s(t.async)&&c(t.reference)&&u(t.expects)&&c(t[`~run`])}function K(e){return ve(e)||W(e)||_e(e)||M(e)||N(e)||P(e)||F(e)||L(e)||z(e)||V(e)||j(e)||G(e)||be(e)||xe(e)||we(e)||Se(e)||De(e)||B(e)||R(e)||A(e)||H(e)||I(e)||Te(e)||ye(e)}function Ae(e){return V(e)}function q(e){if(!l(e))return!1;let t=e;return!(!x(t)||`id`in t&&!u(t.id)||`resolve`in t&&!c(t.resolve)||`properties`in t&&!fe(t.properties)||`required`in t&&!h(t.required)||`title`in t&&!u(t.title)||`description`in t&&!u(t.description)||`$schema`in t&&!u(t.$schema)||`tags`in t&&!h(t.tags)||`args`in t&&(!Array.isArray(t.args)||!t.args.every(e=>de(e)))||`returns`in t&&!x(t.returns))}function je(e){return q(e)&&!K(e)}function Me(e){if(!l(e))return!1;let t=e;return!(`$schema`in t&&!q(t.$schema)||`$resolve`in t&&!c(t.$resolve))}function Ne(e){if(!Me(e)||K(e))return!1;let t=e;return!(`$schema`in t&&t.$schema!==void 0&&!je(t.$schema))}function J(e){return l(e)&&`schema`in e&&K(e.schema)&&`variant`in e&&u(e.variant)&&`hash`in e&&u(e.hash)}function Pe(e){return J(e)}function Fe(e){return J(e)&&`source`in e&&l(e.source)&&`schema`in e.source&&`variant`in e.source&&u(e.source.variant)}function Ie(e){return J(e)&&G(e.schema)}function Le(e,t){if(!t||!d(e))return e;let n={...e},r=n;for(let e of a){let n=t[e];n!=null&&(r[e]=n)}return n}function Y(e){if(!d(e))return[];let t=e;return Array.isArray(t.type)?t.type.filter(e=>f(e)):f(t.type)&&t.type!==`object`&&t.type!==`array`?[t.type]:[]}function Re(e){if(d(e))return Y(e).find(e=>e!==`null`)}function X(e){let t=J(e)?e.schema:e;if(!K(t))throw TypeError(`The provided input is not a valid JSON Schema`);return t}function Z(e){let t=X(e);if(!G(t))throw TypeError(`The provided input is not a valid JSON Schema object`);return t}function ze(e){let t=Z(e);return l(t.properties)?Object.entries(t.properties).reduce((e,[n,r])=>(r.name=n,r.required=!$(t,n),r.default=t.default?.[n]??r.default,e[n]=r,e),{}):{}}function Be(e){return Object.values(ze(e))}function Ve(e,t){let n=Z(e);if(!l(n.properties))throw TypeError(`The provided schema does not have any properties`);let r=n.properties[t];if(!r)throw TypeError(`The provided schema does not have a property named "${t}"`);return{...r,name:t,required:!$(n,t),default:n.default?.[t]??r?.default}}function He(e,t,n){let r=Z(e);r.properties??={},r.required??=[],n.name=t,r.properties[t]=n,r.required.includes(t)||r.required.push(t),r.required.length===0&&delete r.required}function Q(t,r){let a={...t};for(let[t,o]of Object.entries(r)){let r=a[t];if(t===`required`)a[t]=ne([...Array.isArray(r)?r:[],...Array.isArray(o)?o:[]]);else if(n.has(t)&&l(r)&&l(o)){let e={...r};for(let[t,n]of Object.entries(o)){let r=e[t];e[t]=K(r)&&K(n)?Q(r,n):n}a[t]=e}else e.has(t)&&Array.isArray(r)&&Array.isArray(o)?a[t]=[...r,...o]:i.has(t)&&K(r)&&K(o)?a[t]=Q(r,o):a[t]=o}return a}function Ue(...e){let t=e.map(e=>X(e));return t.length===0?{}:t.reduce((e,t)=>{let n=e.type,r=t.type;return n&&r&&n!==r?t:Q(e,t)})}function We(e,t){return re(e,Object.fromEntries(a.filter(e=>t[e]!==void 0).map(e=>[e,t[e]])))}function Ge(e){return l(e)?e.nullable===!0||Y(e).includes(`null`):!1}function $(e,t){if(!e.properties?.[t])throw Error(`The property "${t}" does not exist in the parent schema.`);return!(e.required??[]).includes(t)}function Ke(e){return ee.includes(o(e))}function qe(e,t){let n=[];function r(e){let i=t(e);if(i!==void 0&&n.push(i),G(e))for(let t of Object.values(e.properties??{}))r(t);for(let t of[`allOf`,`anyOf`,`oneOf`,`not`,`if`,`then`,`else`,`$ref`,`items`,`additionalProperties`,`unevaluatedProperties`,`propertyNames`,`unevaluatedItems`,`contains`]){let n=e[t];if(Array.isArray(n))for(let e of n)K(e)&&r(e);else K(n)&&r(n)}}return r(e),n}export{Oe as $,R as A,De as B,N as C,W as D,F as E,U as F,Se as G,ve as H,G as I,Ae as J,we as K,ce as L,B as M,V as N,ge as O,H as P,Fe as Q,Ce as R,M as S,_e as T,xe as U,ye as V,v as W,Ie as X,J as Y,Pe as Z,K as _,Be as a,Ee as b,Ge as c,We as d,Me as et,qe as f,ie as g,Y as h,ze as i,ke as it,z as j,L as k,Ke as l,Re as m,X as n,q as nt,Ve as o,Le as p,Te as q,Z as r,je as rt,$ as s,He as t,Ne as tt,Ue as u,I as v,P as w,j as x,A as y,be as z};
2
- //# sourceMappingURL=helpers-CfLw5cNk.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers-CfLw5cNk.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +0,0 @@
1
- const e=require("./rolldown-runtime-CMqjfN_6.cjs"),t=require("./constants-CjTQhR-l.cjs");let n=require("@stryke/path/find"),r=require("@stryke/resolve/constants"),i=require("@stryke/type-checks"),a=require("@stryke/type-checks/is-set-object"),ee=require("@stryke/helpers/get-unique"),o=require("defu");o=e.t(o,1);let s=require("@stryke/type-checks/is-set-string");function te(e){return!(0,i.isString)(e)&&e.file!==void 0}const c=e=>typeof e==`number`&&Number.isFinite(e),ne=e=>(0,i.isSetObject)(e)||(0,i.isBoolean)(e),l=e=>(0,i.isSetObject)(e)&&Object.values(e).every(e=>ne(e)),re=e=>(0,i.isSetObject)(e)&&Object.values(e).every(e=>(0,i.isBoolean)(e)),u=e=>Array.isArray(e)&&e.every(e=>(0,i.isSetString)(e)),ie=e=>(0,i.isSetObject)(e)&&Object.values(e).every(e=>u(e)),d=new Set(t.n),f=new Set(t.r);function ae(e){return(0,i.isSetString)(e)&&d.has(e)}function oe(e){return(0,i.isSetString)(e)&&f.has(e)}const se=new Set([`date`,`time`,`date-time`,`iso-time`,`iso-date-time`,`unix-time`]),p=e=>typeof e==`bigint`,ce=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`function`,`object`,`any`,`array`]),m=e=>(0,i.isSetString)(e)&&ce.has(e),h=e=>{if(!(0,i.isSetObject)(e))return!1;let t=e;return!(t.type!==void 0&&!((0,i.isSetString)(t.type)&&m(t.type)||Array.isArray(t.type)&&t.type.every(e=>m(e)))||t.tsType!==void 0&&!(0,i.isSetString)(t.tsType)||t.markdownType!==void 0&&!(0,i.isSetString)(t.markdownType)||t.items!==void 0&&!(h(t.items)||Array.isArray(t.items)&&t.items.every(e=>h(e))))},le=e=>{if(!h(e))return!1;let t=e;return t.name!==void 0&&!(0,i.isSetString)(t.name)?!1:t.optional===void 0||typeof t.optional==`boolean`},ue=e=>(0,i.isSetObject)(e)&&Object.values(e).every(e=>q(e)),g=(e,t)=>Array.isArray(e)&&e.every(e=>t(e)),de=(e,t,n)=>Array.isArray(e)&&e.length===2&&t(e[0])&&n(e[1]),_=(e,t=!1)=>e===void 0||(0,i.isString)(e)&&(t||e.length>0),v=e=>e===void 0||(0,i.isBoolean)(e),y=e=>e===void 0||c(e),b=e=>e===void 0||p(e),x=e=>e===void 0||K(e),S=e=>e===void 0||g(e,K),fe=e=>e===void 0||Array.isArray(e)&&e.every(e=>(0,i.isSetString)(e)&&d.has(e)),pe=e=>e===void 0||Array.isArray(e)&&e.every(e=>(0,i.isSetString)(e)&&f.has(e)),C=e=>!(!_(e.$id)||!_(e.$schema)||e.$vocabulary!==void 0&&!re(e.$vocabulary)||!_(e.$comment,!0)||!_(e.$anchor)||e.$defs!==void 0&&!l(e.$defs)||!_(e.$dynamicRef)||!_(e.$dynamicAnchor)||!_(e.name)||!_(e.title,!0)||!_(e.description,!0)||!_(e.docs,!0)||e.examples!==void 0&&!Array.isArray(e.examples)||e.alias!==void 0&&!u(e.alias)||e.tags!==void 0&&!u(e.tags)||!v(e.deprecated)||!v(e.hidden)||!v(e.ignore)||!v(e.internal)||!v(e.runtime)||!v(e.readOnly)||!v(e.writeOnly)||!S(e.allOf)||!S(e.anyOf)||!S(e.oneOf)||!x(e.not)||!x(e.if)||!x(e.then)||!x(e.else));function me(e){return(0,i.isSetObject)(e)?C(e):!1}function w(e){if(!(0,i.isSetObject)(e))return!1;let n=e;return C(n)&&_(n.$ref)&&(!n.type||Array.isArray(n.type)&&n.type.every(e=>t.n.includes(e)))}function T(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!C(t)||t.type!==`array`?!1:S(t.prefixItems)&&x(t.items)&&x(t.contains)&&y(t.minItems)&&y(t.maxItems)&&v(t.uniqueItems)&&y(t.minContains)&&y(t.maxContains)&&(t.unevaluatedItems===void 0||(0,i.isBoolean)(t.unevaluatedItems)||K(t.unevaluatedItems))}function E(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!C(t)||t.type!==`integer`||t.format!==`int64`?!1:b(t.minimum)&&b(t.exclusiveMinimum)&&b(t.maximum)&&b(t.exclusiveMaximum)&&b(t.multipleOf)&&b(t.default)&&(t.enum===void 0||g(t.enum,p))}function D(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`boolean`&&v(t.default)}function O(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)?t.anyOf===void 0?t.type!==`integer`&&t.type!==`string`||!(0,i.isSetString)(t.format)||!se.has(t.format)?!1:y(t.minimum)&&y(t.maximum)&&(t.default===void 0||(0,i.isSetString)(t.default)||c(t.default)):g(t.anyOf,O):!1}function k(e){if(!(0,i.isSetObject)(e))return!1;let t=e;if(!C(t)||!(0,i.isSetString)(t.type)||!d.has(t.type)||!Array.isArray(t.enum))return!1;let n=t.type,r=t.enum,a=t.default;return n===`string`?r.every(e=>(0,i.isSetString)(e))&&(a===void 0||(0,i.isSetString)(a)):n===`number`||n===`integer`?r.every(e=>c(e))&&(a===void 0||c(a)):n===`boolean`?r.every(e=>(0,i.isBoolean)(e))&&(a===void 0||(0,i.isBoolean)(a)):n===`null`&&r.every(e=>e===null)&&a==null}function A(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!C(t)||!g(t.allOf,K)?!1:t.unevaluatedProperties===void 0||(0,i.isBoolean)(t.unevaluatedProperties)||K(t.unevaluatedProperties)}function j(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!C(t)||!(`const`in t)?!1:t.type===void 0||(0,i.isSetString)(t.type)&&oe(t.type)||pe(t.type)}function M(e){if(!(0,i.isSetObject)(e))return!1;let t=e;if(!C(t)||t.type!==`array`||t.maxItems!==125||!(0,i.isSetObject)(t.items))return!1;let n=t.items;return n.type===`array`&&de(n.prefixItems,K,K)&&(n.items===void 0||n.items===!1)&&n.minItems===2&&n.maxItems===2}function N(e){if(!(0,i.isSetObject)(e))return!1;let t=e,n=t.type===`string`||t.type===`number`||Array.isArray(t.type)&&t.type.length===2&&t.type[0]===`string`&&t.type[1]===`number`;return C(t)&&n&&Array.isArray(t.enum)&&t.enum.every(e=>(0,i.isSetString)(e)||c(e))}function P(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&w(t.not)}function F(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`null`&&(t.const===void 0||t.const===null)&&(t.enum===void 0||Array.isArray(t.enum)&&t.enum.every(e=>e===null))&&(t.default===void 0||t.default===null)}function I(e){if(!(0,i.isSetObject)(e))return!1;let t=e;if(!C(t))return!1;let n=t.anyOf!==void 0&&Array.isArray(t.anyOf)&&t.anyOf.length===2&&K(t.anyOf[0])&&F(t.anyOf[1]),r=Array.isArray(t.type)&&t.type.length===2&&(t.type[0]===`null`&&(0,i.isSetString)(t.type[1])&&t.type[1]!==`null`&&f.has(t.type[1])||t.type[1]===`null`&&(0,i.isSetString)(t.type[0])&&t.type[0]!==`null`&&f.has(t.type[0]));return n||r}function L(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!C(t)||t.type!==`number`&&t.type!==`integer`?!1:_(t.format)&&y(t.minimum)&&y(t.exclusiveMinimum)&&y(t.maximum)&&y(t.exclusiveMaximum)&&y(t.multipleOf)&&y(t.default)&&(t.enum===void 0||g(t.enum,c))}function R(e){return L(e)&&e.type===`integer`}function z(e){return L(e)&&e.type===`number`}function B(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`object`&&(t.properties===void 0||l(t.properties))&&(t.patternProperties===void 0||l(t.patternProperties))&&(t.additionalProperties===void 0||(0,i.isBoolean)(t.additionalProperties)||K(t.additionalProperties))&&(t.required===void 0||u(t.required))&&(t.unevaluatedProperties===void 0||(0,i.isBoolean)(t.unevaluatedProperties)||K(t.unevaluatedProperties))&&(t.dependencies===void 0||(0,i.isSetObject)(t.dependencies)&&Object.values(t.dependencies).every(e=>u(e)||K(e)))&&(t.dependentRequired===void 0||ie(t.dependentRequired))&&(t.dependentSchemas===void 0||l(t.dependentSchemas))&&y(t.minProperties)&&y(t.maxProperties)&&(t.primaryKey===void 0||u(t.primaryKey))&&_(t.databaseSchema)}function V(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`string`&&y(t.minLength)&&y(t.maxLength)&&_(t.pattern)&&_(t.format)&&_(t.default)&&(t.enum===void 0||g(t.enum,i.isSetString))&&_(t.contentMediaType)&&_(t.contentEncoding)&&_(t.contentSchema)}function H(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`array`&&t.uniqueItems===!0&&S(t.prefixItems)&&x(t.items)&&x(t.contains)&&y(t.minItems)&&y(t.maxItems)&&y(t.minContains)&&y(t.maxContains)&&(t.unevaluatedItems===void 0||(0,i.isBoolean)(t.unevaluatedItems)||K(t.unevaluatedItems))}function U(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`object`&&(t.patternProperties===void 0||l(t.patternProperties))&&(t.additionalProperties===void 0||(0,i.isBoolean)(t.additionalProperties)||K(t.additionalProperties))&&x(t.propertyNames)}function W(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&t.type===`array`&&g(t.prefixItems,K)&&y(t.minItems)&&y(t.maxItems)&&x(t.items)&&x(t.contains)&&v(t.uniqueItems)&&y(t.minContains)&&y(t.maxContains)&&(t.unevaluatedItems===void 0||(0,i.isBoolean)(t.unevaluatedItems)||K(t.unevaluatedItems))}function G(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&w(t.not)&&(t.default===void 0||t.default===void 0)}function he(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)?(0,i.isSetString)(t.type)&&d.has(t.type)?t.enum===void 0?!0:Array.isArray(t.enum)?t.type===`string`?t.enum.every(e=>(0,i.isSetString)(e))&&(t.default===void 0||(0,i.isSetString)(t.default)):t.type===`number`?t.enum.every(e=>c(e))&&(t.default===void 0||c(t.default)):t.type===`boolean`?t.enum.every(e=>(0,i.isBoolean)(e))&&(t.default===void 0||(0,i.isBoolean)(t.default)):t.type===`integer`?t.format===`int64`&&t.enum.every(e=>p(e))&&(t.default===void 0||p(t.default)):t.type===`null`&&t.enum.every(e=>e===null)&&(t.default===void 0||t.default===null):!1:fe(t.type)&&t.type!==void 0:!1}function ge(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&(he(t)||ve(t))}function _e(e){return w(e)}function ve(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&g(t.anyOf,K)}function ye(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return C(t)&&(0,i.isSetString)(t.$ref)}function be(e){if(!(0,i.isSetObject)(e))return!1;let t=e;if(!(0,i.isSetObject)(t[`~standard`]))return!1;let n=t[`~standard`];return n.version===1&&(0,i.isFunction)(n.validate)}function xe(e){if(!(0,i.isSetObject)(e)||!be(e))return!1;let t=e;return t.kind===`schema`&&(0,i.isSetString)(t.type)&&(0,i.isBoolean)(t.async)&&(0,i.isFunction)(t.reference)&&(0,i.isSetString)(t.expects)&&(0,i.isFunction)(t[`~run`])}function K(e){return V(e)||R(e)||z(e)||E(e)||D(e)||O(e)||k(e)||j(e)||N(e)||F(e)||T(e)||B(e)||U(e)||W(e)||ge(e)||G(e)||ye(e)||P(e)||M(e)||w(e)||I(e)||A(e)||_e(e)||H(e)}function Se(e){return F(e)}function q(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!(!h(t)||`id`in t&&!(0,i.isSetString)(t.id)||`resolve`in t&&!(0,i.isFunction)(t.resolve)||`properties`in t&&!ue(t.properties)||`required`in t&&!u(t.required)||`title`in t&&!(0,i.isSetString)(t.title)||`description`in t&&!(0,i.isSetString)(t.description)||`$schema`in t&&!(0,i.isSetString)(t.$schema)||`tags`in t&&!u(t.tags)||`args`in t&&(!Array.isArray(t.args)||!t.args.every(e=>le(e)))||`returns`in t&&!h(t.returns))}function Ce(e){return q(e)&&!K(e)}function we(e){if(!(0,i.isSetObject)(e))return!1;let t=e;return!(`$schema`in t&&!q(t.$schema)||`$resolve`in t&&!(0,i.isFunction)(t.$resolve))}function Te(e){if(!we(e)||K(e))return!1;let t=e;return!(`$schema`in t&&t.$schema!==void 0&&!Ce(t.$schema))}function J(e){return(0,i.isSetObject)(e)&&`schema`in e&&K(e.schema)&&`variant`in e&&(0,i.isSetString)(e.variant)&&`hash`in e&&(0,i.isSetString)(e.hash)}function Ee(e){return J(e)}function De(e){return J(e)&&`source`in e&&(0,i.isSetObject)(e.source)&&`schema`in e.source&&`variant`in e.source&&(0,i.isSetString)(e.source.variant)}function Oe(e){return J(e)&&B(e.schema)}function ke(e,n){if(!n||!(0,a.isSetObject)(e))return e;let r={...e},i=r;for(let e of t.t){let t=n[e];t!=null&&(i[e]=t)}return r}function Y(e){if(!(0,a.isSetObject)(e))return[];let t=e;return Array.isArray(t.type)?t.type.filter(e=>(0,s.isSetString)(e)):(0,s.isSetString)(t.type)&&t.type!==`object`&&t.type!==`array`?[t.type]:[]}function Ae(e){if((0,a.isSetObject)(e))return Y(e).find(e=>e!==`null`)}function X(e){let t=J(e)?e.schema:e;if(!K(t))throw TypeError(`The provided input is not a valid JSON Schema`);return t}function Z(e){let t=X(e);if(!B(t))throw TypeError(`The provided input is not a valid JSON Schema object`);return t}function je(e){let t=Z(e);return(0,i.isSetObject)(t.properties)?Object.entries(t.properties).reduce((e,[n,r])=>(r.name=n,r.required=!$(t,n),r.default=t.default?.[n]??r.default,e[n]=r,e),{}):{}}function Me(e){return Object.values(je(e))}function Ne(e,t){let n=Z(e);if(!(0,i.isSetObject)(n.properties))throw TypeError(`The provided schema does not have any properties`);let r=n.properties[t];if(!r)throw TypeError(`The provided schema does not have a property named "${t}"`);return{...r,name:t,required:!$(n,t),default:n.default?.[t]??r?.default}}function Pe(e,t,n){let r=Z(e);r.properties??={},r.required??=[],n.name=t,r.properties[t]=n,r.required.includes(t)||r.required.push(t),r.required.length===0&&delete r.required}function Q(e,n){let r={...e};for(let[e,a]of Object.entries(n)){let n=r[e];if(e===`required`)r[e]=(0,ee.getUnique)([...Array.isArray(n)?n:[],...Array.isArray(a)?a:[]]);else if(t.o.has(e)&&(0,i.isSetObject)(n)&&(0,i.isSetObject)(a)){let t={...n};for(let[e,n]of Object.entries(a)){let r=t[e];t[e]=K(r)&&K(n)?Q(r,n):n}r[e]=t}else t.a.has(e)&&Array.isArray(n)&&Array.isArray(a)?r[e]=[...n,...a]:t.s.has(e)&&K(n)&&K(a)?r[e]=Q(n,a):r[e]=a}return r}function Fe(...e){let t=e.map(e=>X(e));return t.length===0?{}:t.reduce((e,t)=>{let n=e.type,r=t.type;return n&&r&&n!==r?t:Q(e,t)})}function Ie(e,n){return(0,o.default)(e,Object.fromEntries(t.t.filter(e=>n[e]!==void 0).map(e=>[e,n[e]])))}function Le(e){return(0,i.isSetObject)(e)?e.nullable===!0||Y(e).includes(`null`):!1}function $(e,t){if(!e.properties?.[t])throw Error(`The property "${t}" does not exist in the parent schema.`);return!(e.required??[]).includes(t)}function Re(e){return r.VALID_OBJECT_SOURCE_EXTENSIONS.includes((0,n.findFileExtensionSafe)(e))}function ze(e,t){let n=[];function r(e){let i=t(e);if(i!==void 0&&n.push(i),B(e))for(let t of Object.values(e.properties??{}))r(t);for(let t of[`allOf`,`anyOf`,`oneOf`,`not`,`if`,`then`,`else`,`$ref`,`items`,`additionalProperties`,`unevaluatedProperties`,`propertyNames`,`unevaluatedItems`,`contains`]){let n=e[t];if(Array.isArray(n))for(let e of n)K(e)&&r(e);else K(n)&&r(n)}}return r(e),n}Object.defineProperty(exports,"$",{enumerable:!0,get:function(){return be}}),Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"B",{enumerable:!0,get:function(){return ye}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"G",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"H",{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,"J",{enumerable:!0,get:function(){return Se}}),Object.defineProperty(exports,"K",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return me}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"Q",{enumerable:!0,get:function(){return De}}),Object.defineProperty(exports,"R",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,"U",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"V",{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,"W",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"X",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(exports,"Y",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"Z",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return Me}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return ve}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Ie}}),Object.defineProperty(exports,"et",{enumerable:!0,get:function(){return we}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return je}}),Object.defineProperty(exports,"it",{enumerable:!0,get:function(){return xe}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return Re}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,"nt",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Ne}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(exports,"q",{enumerable:!0,get:function(){return _e}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"rt",{enumerable:!0,get:function(){return Ce}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Pe}}),Object.defineProperty(exports,"tt",{enumerable:!0,get:function(){return Te}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return Fe}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"z",{enumerable:!0,get:function(){return U}});