@effect/schema
Advanced tools
Comparing version 0.45.5 to 0.45.6
{ | ||
"name": "@effect/schema", | ||
"version": "0.45.5", | ||
"version": "0.45.6", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
@@ -723,3 +723,3 @@ 'use strict'; | ||
{ | ||
const searchTree = _getSearchTree(ast.types); | ||
const searchTree = _getSearchTree(ast.types, isDecoding); | ||
const ownKeys = AST_dist_effectSchemaAST.ownKeys(searchTree.keys); | ||
@@ -833,6 +833,6 @@ const len = ownKeys.length; | ||
/** @internal */ | ||
const _getLiterals = ast => { | ||
const _getLiterals = (ast, isDecoding) => { | ||
switch (ast._tag) { | ||
case "Declaration": | ||
return _getLiterals(ast.type); | ||
return _getLiterals(ast.type, isDecoding); | ||
case "TypeLiteral": | ||
@@ -843,3 +843,3 @@ { | ||
const propertySignature = ast.propertySignatures[i]; | ||
const type = AST_dist_effectSchemaAST.from(propertySignature.type); | ||
const type = isDecoding ? AST_dist_effectSchemaAST.from(propertySignature.type) : AST_dist_effectSchemaAST.to(propertySignature.type); | ||
if (AST_dist_effectSchemaAST.isLiteral(type) && !propertySignature.isOptional) { | ||
@@ -852,4 +852,5 @@ out.push([propertySignature.name, type]); | ||
case "Refinement": | ||
return _getLiterals(ast.from, isDecoding); | ||
case "Transform": | ||
return _getLiterals(ast.from); | ||
return _getLiterals(isDecoding ? ast.from : ast.to, isDecoding); | ||
} | ||
@@ -873,3 +874,3 @@ return []; | ||
*/ | ||
const _getSearchTree = members => { | ||
const _getSearchTree = (members, isDecoding) => { | ||
const keys = {}; | ||
@@ -879,3 +880,3 @@ const otherwise = []; | ||
const member = members[i]; | ||
const tags = _getLiterals(member); | ||
const tags = _getLiterals(member, isDecoding); | ||
if (tags.length > 0) { | ||
@@ -882,0 +883,0 @@ for (let j = 0; j < tags.length; j++) { |
@@ -723,3 +723,3 @@ 'use strict'; | ||
{ | ||
const searchTree = _getSearchTree(ast.types); | ||
const searchTree = _getSearchTree(ast.types, isDecoding); | ||
const ownKeys = AST_dist_effectSchemaAST.ownKeys(searchTree.keys); | ||
@@ -833,6 +833,6 @@ const len = ownKeys.length; | ||
/** @internal */ | ||
const _getLiterals = ast => { | ||
const _getLiterals = (ast, isDecoding) => { | ||
switch (ast._tag) { | ||
case "Declaration": | ||
return _getLiterals(ast.type); | ||
return _getLiterals(ast.type, isDecoding); | ||
case "TypeLiteral": | ||
@@ -843,3 +843,3 @@ { | ||
const propertySignature = ast.propertySignatures[i]; | ||
const type = AST_dist_effectSchemaAST.from(propertySignature.type); | ||
const type = isDecoding ? AST_dist_effectSchemaAST.from(propertySignature.type) : AST_dist_effectSchemaAST.to(propertySignature.type); | ||
if (AST_dist_effectSchemaAST.isLiteral(type) && !propertySignature.isOptional) { | ||
@@ -852,4 +852,5 @@ out.push([propertySignature.name, type]); | ||
case "Refinement": | ||
return _getLiterals(ast.from, isDecoding); | ||
case "Transform": | ||
return _getLiterals(ast.from); | ||
return _getLiterals(isDecoding ? ast.from : ast.to, isDecoding); | ||
} | ||
@@ -873,3 +874,3 @@ return []; | ||
*/ | ||
const _getSearchTree = members => { | ||
const _getSearchTree = (members, isDecoding) => { | ||
const keys = {}; | ||
@@ -879,3 +880,3 @@ const otherwise = []; | ||
const member = members[i]; | ||
const tags = _getLiterals(member); | ||
const tags = _getLiterals(member, isDecoding); | ||
if (tags.length > 0) { | ||
@@ -882,0 +883,0 @@ for (let j = 0; j < tags.length; j++) { |
@@ -694,3 +694,3 @@ import * as Effect from 'effect/Effect'; | ||
{ | ||
const searchTree = _getSearchTree(ast.types); | ||
const searchTree = _getSearchTree(ast.types, isDecoding); | ||
const ownKeys$1 = ownKeys(searchTree.keys); | ||
@@ -804,6 +804,6 @@ const len = ownKeys$1.length; | ||
/** @internal */ | ||
const _getLiterals = ast => { | ||
const _getLiterals = (ast, isDecoding) => { | ||
switch (ast._tag) { | ||
case "Declaration": | ||
return _getLiterals(ast.type); | ||
return _getLiterals(ast.type, isDecoding); | ||
case "TypeLiteral": | ||
@@ -814,3 +814,3 @@ { | ||
const propertySignature = ast.propertySignatures[i]; | ||
const type = from(propertySignature.type); | ||
const type = isDecoding ? from(propertySignature.type) : to(propertySignature.type); | ||
if (isLiteral(type) && !propertySignature.isOptional) { | ||
@@ -823,4 +823,5 @@ out.push([propertySignature.name, type]); | ||
case "Refinement": | ||
return _getLiterals(ast.from, isDecoding); | ||
case "Transform": | ||
return _getLiterals(ast.from); | ||
return _getLiterals(isDecoding ? ast.from : ast.to, isDecoding); | ||
} | ||
@@ -844,3 +845,3 @@ return []; | ||
*/ | ||
const _getSearchTree = members => { | ||
const _getSearchTree = (members, isDecoding) => { | ||
const keys = {}; | ||
@@ -850,3 +851,3 @@ const otherwise = []; | ||
const member = members[i]; | ||
const tags = _getLiterals(member); | ||
const tags = _getLiterals(member, isDecoding); | ||
if (tags.length > 0) { | ||
@@ -853,0 +854,0 @@ for (let j = 0; j < tags.length; j++) { |
@@ -811,3 +811,3 @@ /** | ||
case "Union": { | ||
const searchTree = _getSearchTree(ast.types) | ||
const searchTree = _getSearchTree(ast.types, isDecoding) | ||
const ownKeys = Internal.ownKeys(searchTree.keys) | ||
@@ -946,7 +946,8 @@ const len = ownKeys.length | ||
export const _getLiterals = ( | ||
ast: AST.AST | ||
ast: AST.AST, | ||
isDecoding: boolean | ||
): ReadonlyArray<[PropertyKey, AST.Literal]> => { | ||
switch (ast._tag) { | ||
case "Declaration": | ||
return _getLiterals(ast.type) | ||
return _getLiterals(ast.type, isDecoding) | ||
case "TypeLiteral": { | ||
@@ -956,3 +957,3 @@ const out: Array<[PropertyKey, AST.Literal]> = [] | ||
const propertySignature = ast.propertySignatures[i] | ||
const type = AST.from(propertySignature.type) | ||
const type = isDecoding ? AST.from(propertySignature.type) : AST.to(propertySignature.type) | ||
if (AST.isLiteral(type) && !propertySignature.isOptional) { | ||
@@ -965,4 +966,5 @@ out.push([propertySignature.name, type]) | ||
case "Refinement": | ||
return _getLiterals(ast.from, isDecoding) | ||
case "Transform": | ||
return _getLiterals(ast.from) | ||
return _getLiterals(isDecoding ? ast.from : ast.to, isDecoding) | ||
} | ||
@@ -987,3 +989,4 @@ return [] | ||
export const _getSearchTree = ( | ||
members: ReadonlyArray<AST.AST> | ||
members: ReadonlyArray<AST.AST>, | ||
isDecoding: boolean | ||
): { | ||
@@ -1007,3 +1010,3 @@ keys: { | ||
const member = members[i] | ||
const tags = _getLiterals(member) | ||
const tags = _getLiterals(member, isDecoding) | ||
if (tags.length > 0) { | ||
@@ -1010,0 +1013,0 @@ for (let j = 0; j < tags.length; j++) { |
Sorry, the diff of this file is too big to display
1048296
28727
2315