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/esm/Schema.js
CHANGED
|
@@ -1876,6 +1876,9 @@ export const LowercasedSchemaId = /*#__PURE__*/Symbol.for("effect/SchemaId/Lower
|
|
|
1876
1876
|
export const lowercased = annotations => self => self.pipe(filter(a => a === a.toLowerCase(), {
|
|
1877
1877
|
schemaId: LowercasedSchemaId,
|
|
1878
1878
|
description: "a lowercase string",
|
|
1879
|
+
jsonSchema: {
|
|
1880
|
+
pattern: "^[^A-Z]*$"
|
|
1881
|
+
},
|
|
1879
1882
|
...annotations
|
|
1880
1883
|
}));
|
|
1881
1884
|
/**
|
|
@@ -1900,6 +1903,9 @@ export const CapitalizedSchemaId = /*#__PURE__*/Symbol.for("effect/SchemaId/Capi
|
|
|
1900
1903
|
export const capitalized = annotations => self => self.pipe(filter(a => a[0]?.toUpperCase() === a[0], {
|
|
1901
1904
|
schemaId: CapitalizedSchemaId,
|
|
1902
1905
|
description: "a capitalized string",
|
|
1906
|
+
jsonSchema: {
|
|
1907
|
+
pattern: "^[^a-z]?.*$"
|
|
1908
|
+
},
|
|
1903
1909
|
...annotations
|
|
1904
1910
|
}));
|
|
1905
1911
|
/**
|
|
@@ -1924,6 +1930,9 @@ export const UncapitalizedSchemaId = /*#__PURE__*/Symbol.for("effect/SchemaId/Un
|
|
|
1924
1930
|
export const uncapitalized = annotations => self => self.pipe(filter(a => a[0]?.toLowerCase() === a[0], {
|
|
1925
1931
|
schemaId: UncapitalizedSchemaId,
|
|
1926
1932
|
description: "a uncapitalized string",
|
|
1933
|
+
jsonSchema: {
|
|
1934
|
+
pattern: "^[^A-Z]?.*$"
|
|
1935
|
+
},
|
|
1927
1936
|
...annotations
|
|
1928
1937
|
}));
|
|
1929
1938
|
/**
|
|
@@ -1948,6 +1957,9 @@ export const UppercasedSchemaId = /*#__PURE__*/Symbol.for("effect/SchemaId/Upper
|
|
|
1948
1957
|
export const uppercased = annotations => self => self.pipe(filter(a => a === a.toUpperCase(), {
|
|
1949
1958
|
schemaId: UppercasedSchemaId,
|
|
1950
1959
|
description: "an uppercase string",
|
|
1960
|
+
jsonSchema: {
|
|
1961
|
+
pattern: "^[^a-z]*$"
|
|
1962
|
+
},
|
|
1951
1963
|
...annotations
|
|
1952
1964
|
}));
|
|
1953
1965
|
/**
|
|
@@ -2127,7 +2139,7 @@ export const split = separator => transform(String$.annotations({
|
|
|
2127
2139
|
const JsonString = /*#__PURE__*/String$.annotations({
|
|
2128
2140
|
[AST.IdentifierAnnotationId]: "JsonString",
|
|
2129
2141
|
[AST.TitleAnnotationId]: "JsonString",
|
|
2130
|
-
[AST.DescriptionAnnotationId]: "a JSON
|
|
2142
|
+
[AST.DescriptionAnnotationId]: "a string that will be parsed as JSON"
|
|
2131
2143
|
});
|
|
2132
2144
|
const getParseJsonTransformation = options => transformOrFail(JsonString, Unknown, {
|
|
2133
2145
|
strict: true,
|
|
@@ -3129,7 +3141,7 @@ export const minItems = (n, annotations) => self => {
|
|
|
3129
3141
|
}
|
|
3130
3142
|
return self.pipe(filter(a => a.length >= minItems, {
|
|
3131
3143
|
schemaId: MinItemsSchemaId,
|
|
3132
|
-
description: `an array of at least ${minItems}
|
|
3144
|
+
description: `an array of at least ${minItems} item(s)`,
|
|
3133
3145
|
jsonSchema: {
|
|
3134
3146
|
minItems
|
|
3135
3147
|
},
|
|
@@ -3148,7 +3160,7 @@ export const MaxItemsSchemaId = filters_.MaxItemsSchemaId;
|
|
|
3148
3160
|
*/
|
|
3149
3161
|
export const maxItems = (n, annotations) => self => self.pipe(filter(a => a.length <= n, {
|
|
3150
3162
|
schemaId: MaxItemsSchemaId,
|
|
3151
|
-
description: `an array of at most ${n}
|
|
3163
|
+
description: `an array of at most ${n} item(s)`,
|
|
3152
3164
|
jsonSchema: {
|
|
3153
3165
|
maxItems: n
|
|
3154
3166
|
},
|
|
@@ -4440,15 +4452,23 @@ const makeClass = ({
|
|
|
4440
4452
|
schema
|
|
4441
4453
|
}) => {
|
|
4442
4454
|
const classSymbol = Symbol.for(`effect/Schema/${kind}/${identifier}`);
|
|
4455
|
+
const ts = typeSchema(schema);
|
|
4456
|
+
const declarationSurrogate = ts.annotations({
|
|
4457
|
+
identifier,
|
|
4458
|
+
...annotations
|
|
4459
|
+
});
|
|
4460
|
+
const typeSide = ts.annotations({
|
|
4461
|
+
[AST.AutoTitleAnnotationId]: `${identifier} (Type side)`
|
|
4462
|
+
});
|
|
4463
|
+
const transformationSurrogate = schema.annotations({
|
|
4464
|
+
...annotations
|
|
4465
|
+
});
|
|
4443
4466
|
const validateSchema = schema.annotations({
|
|
4444
4467
|
[AST.AutoTitleAnnotationId]: `${identifier} (Constructor)`
|
|
4445
4468
|
});
|
|
4446
4469
|
const encodedSide = schema.annotations({
|
|
4447
4470
|
[AST.AutoTitleAnnotationId]: `${identifier} (Encoded side)`
|
|
4448
4471
|
});
|
|
4449
|
-
const typeSide = typeSchema(schema).annotations({
|
|
4450
|
-
[AST.AutoTitleAnnotationId]: `${identifier} (Type side)`
|
|
4451
|
-
});
|
|
4452
4472
|
const fallbackInstanceOf = u => Predicate.hasProperty(u, classSymbol) && ParseResult.is(typeSide)(u);
|
|
4453
4473
|
const klass = class extends Base {
|
|
4454
4474
|
constructor(props = {}, options = false) {
|
|
@@ -4477,13 +4497,11 @@ const makeClass = ({
|
|
|
4477
4497
|
encode: () => (input, options) => input instanceof this ? ParseResult.succeed(input) : ParseResult.map(ParseResult.encodeUnknown(typeSide)(input, options), props => new this(props, true))
|
|
4478
4498
|
}, {
|
|
4479
4499
|
identifier,
|
|
4480
|
-
title: identifier,
|
|
4481
|
-
description: `an instance of ${identifier}`,
|
|
4482
4500
|
pretty: pretty => self => `${identifier}(${pretty(self)})`,
|
|
4483
4501
|
// @ts-expect-error
|
|
4484
4502
|
arbitrary: arb => fc => arb(fc).map(props => new this(props)),
|
|
4485
4503
|
equivalence: identity,
|
|
4486
|
-
[AST.SurrogateAnnotationId]:
|
|
4504
|
+
[AST.SurrogateAnnotationId]: declarationSurrogate.ast,
|
|
4487
4505
|
...annotations
|
|
4488
4506
|
});
|
|
4489
4507
|
const transformation = transform(encodedSide, declaration, {
|
|
@@ -4491,7 +4509,8 @@ const makeClass = ({
|
|
|
4491
4509
|
decode: input => new this(input, true),
|
|
4492
4510
|
encode: identity
|
|
4493
4511
|
}).annotations({
|
|
4494
|
-
[AST.
|
|
4512
|
+
[AST.JSONIdentifierAnnotationId]: identifier,
|
|
4513
|
+
[AST.SurrogateAnnotationId]: transformationSurrogate.ast
|
|
4495
4514
|
});
|
|
4496
4515
|
astCache.set(this, transformation.ast);
|
|
4497
4516
|
return transformation.ast;
|