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.73.4 to 0.74.0

8

dist/cjs/internal/util.js

@@ -23,3 +23,9 @@ "use strict";

};
/** @internal */
/**
* JavaScript does not store the insertion order of properties in a way that
* combines both string and symbol keys. The internal order groups string keys
* and symbol keys separately. Hence concatenating the keys is fine.
*
* @internal
*/
exports.getKeysForIndexSignature = getKeysForIndexSignature;

@@ -26,0 +32,0 @@ const ownKeys = o => Object.keys(o).concat(Object.getOwnPropertySymbols(o));

97

dist/esm/AST.js

@@ -1137,4 +1137,4 @@ /**

}
this.propertySignatures = sortPropertySignatures(propertySignatures);
this.indexSignatures = sortIndexSignatures(indexSignatures);
this.propertySignatures = propertySignatures;
this.indexSignatures = indexSignatures;
}

@@ -1710,2 +1710,3 @@ /**

if (Predicate.isString(name)) {
let out = undefined;
for (const is of ast.indexSignatures) {

@@ -1723,5 +1724,12 @@ const parameterBase = getParameterBase(is.parameter);

case "StringKeyword":
return new PropertySignature(name, is.type, false, true);
{
if (out === undefined) {
out = new PropertySignature(name, is.type, false, true);
}
}
}
}
if (out) {
return out;
}
} else if (Predicate.isSymbol(name)) {

@@ -2129,85 +2137,2 @@ for (const is of ast.indexSignatures) {

/** @internal */
export const getCardinality = ast => {
switch (ast._tag) {
case "NeverKeyword":
return 0;
case "Literal":
case "UndefinedKeyword":
case "VoidKeyword":
case "UniqueSymbol":
return 1;
case "BooleanKeyword":
return 2;
case "StringKeyword":
case "NumberKeyword":
case "BigIntKeyword":
case "SymbolKeyword":
return 3;
case "ObjectKeyword":
return 5;
case "UnknownKeyword":
case "AnyKeyword":
return 6;
default:
return 4;
}
};
const sortPropertySignatures = /*#__PURE__*/Arr.sort( /*#__PURE__*/Order.mapInput(Number.Order, ps => getCardinality(ps.type)));
const sortIndexSignatures = /*#__PURE__*/Arr.sort( /*#__PURE__*/Order.mapInput(Number.Order, is => {
switch (getParameterBase(is.parameter)._tag) {
case "StringKeyword":
return 2;
case "SymbolKeyword":
return 3;
case "TemplateLiteral":
return 1;
}
}));
const WeightOrder = /*#__PURE__*/Order.tuple(Number.Order, Number.Order, Number.Order);
const maxWeight = /*#__PURE__*/Order.max(WeightOrder);
const emptyWeight = [0, 0, 0];
const maxWeightAll = weights => weights.reduce(maxWeight, emptyWeight);
/** @internal */
export const getWeight = ast => {
switch (ast._tag) {
case "TupleType":
{
return [2, ast.elements.length, ast.rest.length];
}
case "TypeLiteral":
{
const y = ast.propertySignatures.length;
const z = ast.indexSignatures.length;
return y + z === 0 ? [-4, 0, 0] : [4, y, z];
}
case "Declaration":
{
const annotation = getSurrogateAnnotation(ast);
if (Option.isSome(annotation)) {
const [_, y, z] = getWeight(annotation.value);
return [6, y, z];
}
return [6, 0, 0];
}
case "Suspend":
return [8, 0, 0];
case "Union":
return maxWeightAll(ast.types.map(getWeight));
case "Refinement":
{
const [x, y, z] = getWeight(ast.from);
return [x + 1, y, z];
}
case "Transformation":
return getWeight(ast.from);
case "ObjectKeyword":
return [-2, 0, 0];
case "UnknownKeyword":
case "AnyKeyword":
return [-4, 0, 0];
default:
return emptyWeight;
}
};
/** @internal */
export const getParameterBase = ast => {

@@ -2214,0 +2139,0 @@ switch (ast._tag) {

@@ -15,3 +15,9 @@ import * as array_ from "effect/Array";

};
/** @internal */
/**
* JavaScript does not store the insertion order of properties in a way that
* combines both string and symbol keys. The internal order groups string keys
* and symbol keys separately. Hence concatenating the keys is fine.
*
* @internal
*/
export const ownKeys = o => Object.keys(o).concat(Object.getOwnPropertySymbols(o));

@@ -18,0 +24,0 @@ /** @internal */

{
"name": "@effect/schema",
"version": "0.73.4",
"version": "0.74.0",
"description": "Modeling the schema of data structures as first-class values",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -22,3 +22,9 @@ import * as array_ from "effect/Array"

/** @internal */
/**
* JavaScript does not store the insertion order of properties in a way that
* combines both string and symbol keys. The internal order groups string keys
* and symbol keys separately. Hence concatenating the keys is fine.
*
* @internal
*/
export const ownKeys = (o: object): Array<PropertyKey> =>

@@ -25,0 +31,0 @@ (Object.keys(o) as Array<PropertyKey>).concat(Object.getOwnPropertySymbols(o))

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 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 too big to display

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