Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@effect/schema

Package Overview
Dependencies
Maintainers
3
Versions
335
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@effect/schema - npm Package Compare versions

Comparing version 0.19.1 to 0.19.2

4

AST.js

@@ -6,3 +6,3 @@ "use strict";

});
exports.voidKeyword = exports.unknownKeyword = exports.undefinedKeyword = exports.to = exports.symbolKeyword = exports.stringKeyword = exports.setAnnotation = exports.required = exports.pick = exports.partial = exports.omit = exports.objectKeyword = exports.numberKeyword = exports.neverKeyword = exports.mergeAnnotations = exports.keyof = exports.isVoidKeyword = exports.isUnknownKeyword = exports.isUniqueSymbol = exports.isUnion = exports.isUndefinedKeyword = exports.isTypeLiteral = exports.isTuple = exports.isTransform = exports.isTemplateLiteral = exports.isSymbolKeyword = exports.isStringKeyword = exports.isRefinement = exports.isParameter = exports.isObjectKeyword = exports.isNumberKeyword = exports.isNeverKeyword = exports.isLiteral = exports.isLazy = exports.isEnums = exports.isDeclaration = exports.isBooleanKeyword = exports.isBigIntKeyword = exports.isAnyKeyword = exports.getWeight = exports.getPropertySignatures = exports.getCompiler = exports.getCardinality = exports.getAnnotation = exports.from = exports.createUniqueSymbol = exports.createUnion = exports.createTypeLiteral = exports.createTuple = exports.createTransformByPropertySignatureTransformations = exports.createTransform = exports.createTemplateLiteral = exports.createRefinement = exports.createRecord = exports.createPropertySignatureTransformation = exports.createPropertySignature = exports.createLiteral = exports.createLazy = exports.createIndexSignature = exports.createEnums = exports.createElement = exports.createDeclaration = exports.booleanKeyword = exports.bigIntKeyword = exports.appendRestElement = exports.appendElement = exports.anyKeyword = exports._createTransform = exports.TypeAnnotationId = exports.TitleAnnotationId = exports.MessageAnnotationId = exports.JSONSchemaAnnotationId = exports.IdentifierAnnotationId = exports.ExamplesAnnotationId = exports.DocumentationAnnotationId = exports.DescriptionAnnotationId = exports.BrandAnnotationId = void 0;
exports.voidKeyword = exports.unknownKeyword = exports.undefinedKeyword = exports.to = exports.symbolKeyword = exports.stringKeyword = exports.setAnnotation = exports.required = exports.pick = exports.partial = exports.omit = exports.objectKeyword = exports.numberKeyword = exports.neverKeyword = exports.mergeAnnotations = exports.keyof = exports.isVoidKeyword = exports.isUnknownKeyword = exports.isUniqueSymbol = exports.isUnion = exports.isUndefinedKeyword = exports.isTypeLiteral = exports.isTuple = exports.isTransform = exports.isTemplateLiteral = exports.isSymbolKeyword = exports.isStringKeyword = exports.isRefinement = exports.isParameter = exports.isObjectKeyword = exports.isNumberKeyword = exports.isNeverKeyword = exports.isLiteral = exports.isLazy = exports.isEnums = exports.isDeclaration = exports.isBooleanKeyword = exports.isBigIntKeyword = exports.isAnyKeyword = exports.getWeight = exports.getPropertySignatures = exports.getParameterBase = exports.getCompiler = exports.getCardinality = exports.getAnnotation = exports.from = exports.createUniqueSymbol = exports.createUnion = exports.createTypeLiteral = exports.createTuple = exports.createTransformByPropertySignatureTransformations = exports.createTransform = exports.createTemplateLiteral = exports.createRefinement = exports.createRecord = exports.createPropertySignatureTransformation = exports.createPropertySignature = exports.createLiteral = exports.createLazy = exports.createIndexSignature = exports.createEnums = exports.createElement = exports.createDeclaration = exports.booleanKeyword = exports.bigIntKeyword = exports.appendRestElement = exports.appendElement = exports.anyKeyword = exports._createTransform = exports.TypeAnnotationId = exports.TitleAnnotationId = exports.MessageAnnotationId = exports.JSONSchemaAnnotationId = exports.IdentifierAnnotationId = exports.ExamplesAnnotationId = exports.DocumentationAnnotationId = exports.DescriptionAnnotationId = exports.BrandAnnotationId = void 0;
var _Function = /*#__PURE__*/require("@effect/data/Function");

@@ -927,2 +927,3 @@ var Number = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect/data/Number"));

};
/** @internal */
const getParameterBase = ast => {

@@ -938,2 +939,3 @@ switch (ast._tag) {

};
exports.getParameterBase = getParameterBase;
const _keyof = ast => {

@@ -940,0 +942,0 @@ switch (ast._tag) {

{
"name": "@effect/schema",
"version": "0.19.1",
"version": "0.19.2",
"license": "MIT",

@@ -5,0 +5,0 @@ "repository": {

@@ -503,2 +503,3 @@ "use strict";

const indexSignatures = ast.indexSignatures.map(is => [go(is.parameter, isBoundary), go(is.type, isBoundary)]);
const parameter = go(AST.createUnion(ast.indexSignatures.map(is => AST.getParameterBase(is.parameter))));
const expectedKeys = {};

@@ -519,11 +520,15 @@ for (let i = 0; i < propertySignatures.length; i++) {

const onExcessPropertyError = options?.onExcessProperty === "error";
if (onExcessPropertyError && indexSignatures.length === 0) {
if (onExcessPropertyError) {
for (const key of I.ownKeys(input)) {
if (!Object.prototype.hasOwnProperty.call(expectedKeys, key)) {
const e = PR.key(key, [PR.unexpected(input[key])]);
if (allErrors) {
es.push([stepKey++, e]);
continue;
} else {
return PR.failures(mutableAppend(sortByIndex(es), e));
const te = parameter(key);
const eu = PR.eitherOrUndefined(te);
if (eu && E.isLeft(eu)) {
const e = PR.key(key, [PR.unexpected(input[key])]);
if (allErrors) {
es.push([stepKey++, e]);
continue;
} else {
return PR.failures(mutableAppend(sortByIndex(es), e));
}
}

@@ -599,38 +604,58 @@ }

// ---------------------------------------------
if (indexSignatures.length > 0) {
for (let i = 0; i < indexSignatures.length; i++) {
const parameter = indexSignatures[i][0];
const type = indexSignatures[i][1];
const keys = I.getKeysForIndexSignature(input, ast.indexSignatures[i].parameter);
for (const key of keys) {
if (Object.prototype.hasOwnProperty.call(expectedKeys, key)) {
continue;
for (let i = 0; i < indexSignatures.length; i++) {
const parameter = indexSignatures[i][0];
const type = indexSignatures[i][1];
const keys = I.getKeysForIndexSignature(input, ast.indexSignatures[i].parameter);
for (const key of keys) {
if (Object.prototype.hasOwnProperty.call(expectedKeys, key)) {
continue;
}
// ---------------------------------------------
// handle keys
// ---------------------------------------------
const keu = PR.eitherOrUndefined(parameter(key, options));
if (keu) {
if (E.isLeft(keu)) {
const e = PR.key(key, keu.left.errors);
if (allErrors) {
es.push([stepKey++, e]);
continue;
} else {
return PR.failures(mutableAppend(sortByIndex(es), e));
}
}
// ---------------------------------------------
// handle keys
// ---------------------------------------------
const keu = PR.eitherOrUndefined(parameter(key, options));
if (keu) {
if (E.isLeft(keu)) {
const e = PR.key(key, keu.left.errors);
if (allErrors) {
es.push([stepKey++, e]);
continue;
} else {
return PR.failures(mutableAppend(sortByIndex(es), e));
}
}
// there's no else here because index signature parameters are restricted to primitives
// ---------------------------------------------
// handle values
// ---------------------------------------------
const vpr = type(input[key], options);
const veu = PR.eitherOrUndefined(vpr);
if (veu) {
if (E.isLeft(veu)) {
const e = PR.key(key, veu.left.errors);
if (allErrors) {
es.push([stepKey++, e]);
continue;
} else {
return PR.failures(mutableAppend(sortByIndex(es), e));
}
} else {
output[key] = veu.right;
}
// there's no else here because index signature parameters are restricted to primitives
// ---------------------------------------------
// handle values
// ---------------------------------------------
const vpr = type(input[key], options);
const veu = PR.eitherOrUndefined(vpr);
if (veu) {
if (E.isLeft(veu)) {
const e = PR.key(key, veu.left.errors);
} else {
const nk = stepKey++;
const index = key;
if (!queue) {
queue = [];
}
queue.push((0, _Debug.untracedMethod)(() => ({
es,
output
}) => Effect.flatMap(Effect.either(vpr), tv => {
if (E.isLeft(tv)) {
const e = PR.key(index, tv.left.errors);
if (allErrors) {
es.push([stepKey++, e]);
continue;
es.push([nk, e]);
return Effect.unit();
} else {

@@ -640,28 +665,6 @@ return PR.failures(mutableAppend(sortByIndex(es), e));

} else {
output[key] = veu.right;
output[key] = tv.right;
return Effect.unit();
}
} else {
const nk = stepKey++;
const index = key;
if (!queue) {
queue = [];
}
queue.push((0, _Debug.untracedMethod)(() => ({
es,
output
}) => Effect.flatMap(Effect.either(vpr), tv => {
if (E.isLeft(tv)) {
const e = PR.key(index, tv.left.errors);
if (allErrors) {
es.push([nk, e]);
return Effect.unit();
} else {
return PR.failures(mutableAppend(sortByIndex(es), e));
}
} else {
output[key] = tv.right;
return Effect.unit();
}
})));
}
})));
}

@@ -668,0 +671,0 @@ }

@@ -1465,3 +1465,4 @@ /**

const getParameterBase = (
/** @internal */
export const getParameterBase = (
ast: Parameter

@@ -1468,0 +1469,0 @@ ): StringKeyword | SymbolKeyword | TemplateLiteral => {

@@ -592,2 +592,5 @@ /**

)
const parameter = go(AST.createUnion(
ast.indexSignatures.map((is) => AST.getParameterBase(is.parameter))
))
const expectedKeys: any = {}

@@ -609,11 +612,15 @@ for (let i = 0; i < propertySignatures.length; i++) {

const onExcessPropertyError = options?.onExcessProperty === "error"
if (onExcessPropertyError && indexSignatures.length === 0) {
if (onExcessPropertyError) {
for (const key of I.ownKeys(input)) {
if (!(Object.prototype.hasOwnProperty.call(expectedKeys, key))) {
const e = PR.key(key, [PR.unexpected(input[key])])
if (allErrors) {
es.push([stepKey++, e])
continue
} else {
return PR.failures(mutableAppend(sortByIndex(es), e))
const te = parameter(key)
const eu = PR.eitherOrUndefined(te)
if (eu && E.isLeft(eu)) {
const e = PR.key(key, [PR.unexpected(input[key])])
if (allErrors) {
es.push([stepKey++, e])
continue
} else {
return PR.failures(mutableAppend(sortByIndex(es), e))
}
}

@@ -700,74 +707,72 @@ }

// ---------------------------------------------
if (indexSignatures.length > 0) {
for (let i = 0; i < indexSignatures.length; i++) {
const parameter = indexSignatures[i][0]
const type = indexSignatures[i][1]
const keys = I.getKeysForIndexSignature(input, ast.indexSignatures[i].parameter)
for (const key of keys) {
if (Object.prototype.hasOwnProperty.call(expectedKeys, key)) {
continue
}
// ---------------------------------------------
// handle keys
// ---------------------------------------------
const keu = PR.eitherOrUndefined(parameter(key, options))
if (keu) {
if (E.isLeft(keu)) {
const e = PR.key(key, keu.left.errors)
if (allErrors) {
es.push([stepKey++, e])
continue
} else {
return PR.failures(mutableAppend(sortByIndex(es), e))
}
for (let i = 0; i < indexSignatures.length; i++) {
const parameter = indexSignatures[i][0]
const type = indexSignatures[i][1]
const keys = I.getKeysForIndexSignature(input, ast.indexSignatures[i].parameter)
for (const key of keys) {
if (Object.prototype.hasOwnProperty.call(expectedKeys, key)) {
continue
}
// ---------------------------------------------
// handle keys
// ---------------------------------------------
const keu = PR.eitherOrUndefined(parameter(key, options))
if (keu) {
if (E.isLeft(keu)) {
const e = PR.key(key, keu.left.errors)
if (allErrors) {
es.push([stepKey++, e])
continue
} else {
return PR.failures(mutableAppend(sortByIndex(es), e))
}
}
// there's no else here because index signature parameters are restricted to primitives
}
// there's no else here because index signature parameters are restricted to primitives
// ---------------------------------------------
// handle values
// ---------------------------------------------
const vpr = type(input[key], options)
const veu = PR.eitherOrUndefined(vpr)
if (veu) {
if (E.isLeft(veu)) {
const e = PR.key(key, veu.left.errors)
if (allErrors) {
es.push([stepKey++, e])
continue
} else {
return PR.failures(mutableAppend(sortByIndex(es), e))
}
// ---------------------------------------------
// handle values
// ---------------------------------------------
const vpr = type(input[key], options)
const veu = PR.eitherOrUndefined(vpr)
if (veu) {
if (E.isLeft(veu)) {
const e = PR.key(key, veu.left.errors)
if (allErrors) {
es.push([stepKey++, e])
continue
} else {
output[key] = veu.right
return PR.failures(mutableAppend(sortByIndex(es), e))
}
} else {
const nk = stepKey++
const index = key
if (!queue) {
queue = []
}
queue.push(
untracedMethod(() =>
({ es, output }: State) =>
Effect.flatMap(
Effect.either(vpr),
(tv) => {
if (E.isLeft(tv)) {
const e = PR.key(index, tv.left.errors)
if (allErrors) {
es.push([nk, e])
return Effect.unit()
} else {
return PR.failures(mutableAppend(sortByIndex(es), e))
}
output[key] = veu.right
}
} else {
const nk = stepKey++
const index = key
if (!queue) {
queue = []
}
queue.push(
untracedMethod(() =>
({ es, output }: State) =>
Effect.flatMap(
Effect.either(vpr),
(tv) => {
if (E.isLeft(tv)) {
const e = PR.key(index, tv.left.errors)
if (allErrors) {
es.push([nk, e])
return Effect.unit()
} else {
output[key] = tv.right
return Effect.unit()
return PR.failures(mutableAppend(sortByIndex(es), e))
}
} else {
output[key] = tv.right
return Effect.unit()
}
)
)
}
)
)
}
)
}

@@ -774,0 +779,0 @@ }

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 not supported yet

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 not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc