@effect/schema
Advanced tools
Comparing version 0.0.0-snapshot-a514ee721521f26f393f3a3b4e4eacedfad8e61d to 0.0.0-snapshot-a5ad9d748a9f2655de9c9dbe76597867a218e45b
@@ -1126,2 +1126,6 @@ /** | ||
export declare const encodedAST: (ast: AST) => AST; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export declare const encodedBoundAST: (ast: AST) => AST; | ||
//# sourceMappingURL=AST.d.ts.map |
@@ -1894,6 +1894,2 @@ /** | ||
}; | ||
/** @internal */ | ||
export const getToPropertySignatures = ps => ps.map(p => new PropertySignature(p.name, typeAST(p.type), p.isOptional, p.isReadonly, p.annotations)); | ||
/** @internal */ | ||
export const getToIndexSignatures = ps => ps.map(is => new IndexSignature(is.parameter, typeAST(is.type), is.isReadonly)); | ||
/** | ||
@@ -1968,10 +1964,7 @@ * @since 1.0.0 | ||
} | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export const encodedAST = ast => { | ||
const encodedAST_ = (ast, bound) => { | ||
switch (ast._tag) { | ||
case "Declaration": | ||
{ | ||
const typeParameters = changeMap(ast.typeParameters, encodedAST); | ||
const typeParameters = changeMap(ast.typeParameters, ast => encodedAST_(ast, bound)); | ||
return typeParameters === ast.typeParameters ? ast : new Declaration(typeParameters, ast.decodeUnknown, ast.encodeUnknown, ast.annotations); | ||
@@ -1982,6 +1975,6 @@ } | ||
const elements = changeMap(ast.elements, e => { | ||
const type = encodedAST(e.type); | ||
const type = encodedAST_(e.type, bound); | ||
return type === e.type ? e : new Element(type, e.isOptional); | ||
}); | ||
const rest = changeMap(ast.rest, encodedAST); | ||
const rest = changeMap(ast.rest, ast => encodedAST_(ast, bound)); | ||
return elements === ast.elements && rest === ast.rest ? ast : new TupleType(elements, rest, ast.isReadonly, createJSONIdentifierAnnotation(ast)); | ||
@@ -1992,7 +1985,7 @@ } | ||
const propertySignatures = changeMap(ast.propertySignatures, ps => { | ||
const type = encodedAST(ps.type); | ||
const type = encodedAST_(ps.type, bound); | ||
return type === ps.type ? ps : new PropertySignature(ps.name, type, ps.isOptional, ps.isReadonly); | ||
}); | ||
const indexSignatures = changeMap(ast.indexSignatures, is => { | ||
const type = encodedAST(is.type); | ||
const type = encodedAST_(is.type, bound); | ||
return type === is.type ? is : new IndexSignature(is.parameter, type, is.isReadonly); | ||
@@ -2004,13 +1997,28 @@ }); | ||
{ | ||
const types = changeMap(ast.types, encodedAST); | ||
const types = changeMap(ast.types, ast => encodedAST_(ast, bound)); | ||
return types === ast.types ? ast : Union.make(types, createJSONIdentifierAnnotation(ast)); | ||
} | ||
case "Suspend": | ||
return new Suspend(() => encodedAST(ast.f()), createJSONIdentifierAnnotation(ast)); | ||
return new Suspend(() => encodedAST_(ast.f(), bound), createJSONIdentifierAnnotation(ast)); | ||
case "Refinement": | ||
{ | ||
const from = encodedAST_(ast.from, bound); | ||
if (bound) { | ||
return from === ast.from ? ast : from; | ||
} | ||
return from; | ||
} | ||
case "Transformation": | ||
return encodedAST(ast.from); | ||
return encodedAST_(ast.from, bound); | ||
} | ||
return ast; | ||
}; | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export const encodedAST = ast => encodedAST_(ast, false); | ||
/** | ||
* @since 1.0.0 | ||
*/ | ||
export const encodedBoundAST = ast => encodedAST_(ast, true); | ||
const toJSONAnnotations = annotations => { | ||
@@ -2017,0 +2025,0 @@ const out = {}; |
{ | ||
"name": "@effect/schema", | ||
"version": "0.0.0-snapshot-a514ee721521f26f393f3a3b4e4eacedfad8e61d", | ||
"version": "0.0.0-snapshot-a5ad9d748a9f2655de9c9dbe76597867a218e45b", | ||
"description": "Modeling the schema of data structures as first-class values", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"peerDependencies": { | ||
"effect": "^0.0.0-snapshot-a514ee721521f26f393f3a3b4e4eacedfad8e61d" | ||
"effect": "^0.0.0-snapshot-a5ad9d748a9f2655de9c9dbe76597867a218e45b" | ||
}, | ||
@@ -19,0 +19,0 @@ "publishConfig": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2341054
39961
8298