@effect/schema
Advanced tools
Comparing version 0.0.0-snapshot-79dc882eafd6ddb60780764e2f663a6087b52622 to 0.0.0-snapshot-981d1fc733b034a10bf77fb06b1e8c764ba879a9
@@ -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 |
@@ -1963,10 +1963,7 @@ /** | ||
} | ||
/** | ||
* @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); | ||
@@ -1977,6 +1974,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)); | ||
@@ -1987,7 +1984,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); | ||
@@ -1999,13 +1996,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 => { | ||
@@ -2012,0 +2024,0 @@ const out = {}; |
{ | ||
"name": "@effect/schema", | ||
"version": "0.0.0-snapshot-79dc882eafd6ddb60780764e2f663a6087b52622", | ||
"version": "0.0.0-snapshot-981d1fc733b034a10bf77fb06b1e8c764ba879a9", | ||
"description": "Modeling the schema of data structures as first-class values", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"peerDependencies": { | ||
"effect": "^0.0.0-snapshot-79dc882eafd6ddb60780764e2f663a6087b52622" | ||
"effect": "^0.0.0-snapshot-981d1fc733b034a10bf77fb06b1e8c764ba879a9" | ||
}, | ||
@@ -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