effect 3.11.4 → 3.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/JSONSchema.js +226 -134
- package/dist/cjs/JSONSchema.js.map +1 -1
- package/dist/cjs/Schema.js +29 -10
- package/dist/cjs/Schema.js.map +1 -1
- package/dist/cjs/SchemaAST.js +34 -9
- package/dist/cjs/SchemaAST.js.map +1 -1
- package/dist/cjs/internal/core.js +6 -7
- package/dist/cjs/internal/core.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/Effect.d.ts +50 -19
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/JSONSchema.d.ts +57 -1
- package/dist/dts/JSONSchema.d.ts.map +1 -1
- package/dist/dts/Schema.d.ts +1 -1
- package/dist/dts/Schema.d.ts.map +1 -1
- package/dist/dts/SchemaAST.d.ts +1 -1
- package/dist/dts/SchemaAST.d.ts.map +1 -1
- package/dist/dts/internal/core.d.ts +5 -0
- package/dist/dts/internal/core.d.ts.map +1 -1
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/JSONSchema.js +224 -133
- package/dist/esm/JSONSchema.js.map +1 -1
- package/dist/esm/Schema.js +29 -10
- package/dist/esm/Schema.js.map +1 -1
- package/dist/esm/SchemaAST.js +31 -7
- package/dist/esm/SchemaAST.js.map +1 -1
- package/dist/esm/internal/core.js +7 -6
- package/dist/esm/internal/core.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/Effect.ts +68 -20
- package/src/JSONSchema.ts +233 -134
- package/src/Schema.ts +25 -10
- package/src/SchemaAST.ts +31 -7
- package/src/internal/core.ts +9 -6
- package/src/internal/version.ts +1 -1
package/dist/cjs/Schema.js
CHANGED
|
@@ -1961,6 +1961,9 @@ const LowercasedSchemaId = exports.LowercasedSchemaId = /*#__PURE__*/Symbol.for(
|
|
|
1961
1961
|
const lowercased = annotations => self => self.pipe(filter(a => a === a.toLowerCase(), {
|
|
1962
1962
|
schemaId: LowercasedSchemaId,
|
|
1963
1963
|
description: "a lowercase string",
|
|
1964
|
+
jsonSchema: {
|
|
1965
|
+
pattern: "^[^A-Z]*$"
|
|
1966
|
+
},
|
|
1964
1967
|
...annotations
|
|
1965
1968
|
}));
|
|
1966
1969
|
/**
|
|
@@ -1987,6 +1990,9 @@ const CapitalizedSchemaId = exports.CapitalizedSchemaId = /*#__PURE__*/Symbol.fo
|
|
|
1987
1990
|
const capitalized = annotations => self => self.pipe(filter(a => a[0]?.toUpperCase() === a[0], {
|
|
1988
1991
|
schemaId: CapitalizedSchemaId,
|
|
1989
1992
|
description: "a capitalized string",
|
|
1993
|
+
jsonSchema: {
|
|
1994
|
+
pattern: "^[^a-z]?.*$"
|
|
1995
|
+
},
|
|
1990
1996
|
...annotations
|
|
1991
1997
|
}));
|
|
1992
1998
|
/**
|
|
@@ -2013,6 +2019,9 @@ const UncapitalizedSchemaId = exports.UncapitalizedSchemaId = /*#__PURE__*/Symbo
|
|
|
2013
2019
|
const uncapitalized = annotations => self => self.pipe(filter(a => a[0]?.toLowerCase() === a[0], {
|
|
2014
2020
|
schemaId: UncapitalizedSchemaId,
|
|
2015
2021
|
description: "a uncapitalized string",
|
|
2022
|
+
jsonSchema: {
|
|
2023
|
+
pattern: "^[^A-Z]?.*$"
|
|
2024
|
+
},
|
|
2016
2025
|
...annotations
|
|
2017
2026
|
}));
|
|
2018
2027
|
/**
|
|
@@ -2039,6 +2048,9 @@ const UppercasedSchemaId = exports.UppercasedSchemaId = /*#__PURE__*/Symbol.for(
|
|
|
2039
2048
|
const uppercased = annotations => self => self.pipe(filter(a => a === a.toUpperCase(), {
|
|
2040
2049
|
schemaId: UppercasedSchemaId,
|
|
2041
2050
|
description: "an uppercase string",
|
|
2051
|
+
jsonSchema: {
|
|
2052
|
+
pattern: "^[^a-z]*$"
|
|
2053
|
+
},
|
|
2042
2054
|
...annotations
|
|
2043
2055
|
}));
|
|
2044
2056
|
/**
|
|
@@ -2231,7 +2243,7 @@ exports.split = split;
|
|
|
2231
2243
|
const JsonString = /*#__PURE__*/String$.annotations({
|
|
2232
2244
|
[AST.IdentifierAnnotationId]: "JsonString",
|
|
2233
2245
|
[AST.TitleAnnotationId]: "JsonString",
|
|
2234
|
-
[AST.DescriptionAnnotationId]: "a JSON
|
|
2246
|
+
[AST.DescriptionAnnotationId]: "a string that will be parsed as JSON"
|
|
2235
2247
|
});
|
|
2236
2248
|
const getParseJsonTransformation = options => transformOrFail(JsonString, Unknown, {
|
|
2237
2249
|
strict: true,
|
|
@@ -3254,7 +3266,7 @@ const minItems = (n, annotations) => self => {
|
|
|
3254
3266
|
}
|
|
3255
3267
|
return self.pipe(filter(a => a.length >= minItems, {
|
|
3256
3268
|
schemaId: MinItemsSchemaId,
|
|
3257
|
-
description: `an array of at least ${minItems}
|
|
3269
|
+
description: `an array of at least ${minItems} item(s)`,
|
|
3258
3270
|
jsonSchema: {
|
|
3259
3271
|
minItems
|
|
3260
3272
|
},
|
|
@@ -3274,7 +3286,7 @@ const MaxItemsSchemaId = exports.MaxItemsSchemaId = filters_.MaxItemsSchemaId;
|
|
|
3274
3286
|
*/
|
|
3275
3287
|
const maxItems = (n, annotations) => self => self.pipe(filter(a => a.length <= n, {
|
|
3276
3288
|
schemaId: MaxItemsSchemaId,
|
|
3277
|
-
description: `an array of at most ${n}
|
|
3289
|
+
description: `an array of at most ${n} item(s)`,
|
|
3278
3290
|
jsonSchema: {
|
|
3279
3291
|
maxItems: n
|
|
3280
3292
|
},
|
|
@@ -4609,15 +4621,23 @@ const makeClass = ({
|
|
|
4609
4621
|
schema
|
|
4610
4622
|
}) => {
|
|
4611
4623
|
const classSymbol = Symbol.for(`effect/Schema/${kind}/${identifier}`);
|
|
4624
|
+
const ts = typeSchema(schema);
|
|
4625
|
+
const declarationSurrogate = ts.annotations({
|
|
4626
|
+
identifier,
|
|
4627
|
+
...annotations
|
|
4628
|
+
});
|
|
4629
|
+
const typeSide = ts.annotations({
|
|
4630
|
+
[AST.AutoTitleAnnotationId]: `${identifier} (Type side)`
|
|
4631
|
+
});
|
|
4632
|
+
const transformationSurrogate = schema.annotations({
|
|
4633
|
+
...annotations
|
|
4634
|
+
});
|
|
4612
4635
|
const validateSchema = schema.annotations({
|
|
4613
4636
|
[AST.AutoTitleAnnotationId]: `${identifier} (Constructor)`
|
|
4614
4637
|
});
|
|
4615
4638
|
const encodedSide = schema.annotations({
|
|
4616
4639
|
[AST.AutoTitleAnnotationId]: `${identifier} (Encoded side)`
|
|
4617
4640
|
});
|
|
4618
|
-
const typeSide = typeSchema(schema).annotations({
|
|
4619
|
-
[AST.AutoTitleAnnotationId]: `${identifier} (Type side)`
|
|
4620
|
-
});
|
|
4621
4641
|
const fallbackInstanceOf = u => Predicate.hasProperty(u, classSymbol) && ParseResult.is(typeSide)(u);
|
|
4622
4642
|
const klass = class extends Base {
|
|
4623
4643
|
constructor(props = {}, options = false) {
|
|
@@ -4646,13 +4666,11 @@ const makeClass = ({
|
|
|
4646
4666
|
encode: () => (input, options) => input instanceof this ? ParseResult.succeed(input) : ParseResult.map(ParseResult.encodeUnknown(typeSide)(input, options), props => new this(props, true))
|
|
4647
4667
|
}, {
|
|
4648
4668
|
identifier,
|
|
4649
|
-
title: identifier,
|
|
4650
|
-
description: `an instance of ${identifier}`,
|
|
4651
4669
|
pretty: pretty => self => `${identifier}(${pretty(self)})`,
|
|
4652
4670
|
// @ts-expect-error
|
|
4653
4671
|
arbitrary: arb => fc => arb(fc).map(props => new this(props)),
|
|
4654
4672
|
equivalence: _Function.identity,
|
|
4655
|
-
[AST.SurrogateAnnotationId]:
|
|
4673
|
+
[AST.SurrogateAnnotationId]: declarationSurrogate.ast,
|
|
4656
4674
|
...annotations
|
|
4657
4675
|
});
|
|
4658
4676
|
const transformation = transform(encodedSide, declaration, {
|
|
@@ -4660,7 +4678,8 @@ const makeClass = ({
|
|
|
4660
4678
|
decode: input => new this(input, true),
|
|
4661
4679
|
encode: _Function.identity
|
|
4662
4680
|
}).annotations({
|
|
4663
|
-
[AST.
|
|
4681
|
+
[AST.JSONIdentifierAnnotationId]: identifier,
|
|
4682
|
+
[AST.SurrogateAnnotationId]: transformationSurrogate.ast
|
|
4664
4683
|
});
|
|
4665
4684
|
astCache.set(this, transformation.ast);
|
|
4666
4685
|
return transformation.ast;
|