effect 3.13.7 → 3.13.8

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.
@@ -1,4 +1,4 @@
1
- let moduleVersion = "3.13.7";
1
+ let moduleVersion = "3.13.8";
2
2
  export const getCurrentVersion = () => moduleVersion;
3
3
  export const setCurrentVersion = version => {
4
4
  moduleVersion = version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "effect",
3
- "version": "3.13.7",
3
+ "version": "3.13.8",
4
4
  "description": "The missing standard library for TypeScript, for writing production-grade software.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -2015,7 +2015,7 @@ const makeArrayFormatterIssue = (
2015
2015
  * @since 3.10.0
2016
2016
  */
2017
2017
  export const ArrayFormatter: ParseResultFormatter<Array<ArrayFormatterIssue>> = {
2018
- formatIssue: (issue) => getArrayFormatterIssues(issue),
2018
+ formatIssue: (issue) => getArrayFormatterIssues(issue, undefined, []),
2019
2019
  formatIssueSync: (issue) => {
2020
2020
  const e = ArrayFormatter.formatIssue(issue)
2021
2021
  return isEither(e) ? Either.getOrThrow(e) : Effect.runSync(e)
@@ -2026,12 +2026,13 @@ export const ArrayFormatter: ParseResultFormatter<Array<ArrayFormatterIssue>> =
2026
2026
 
2027
2027
  const getArrayFormatterIssues = (
2028
2028
  issue: ParseIssue,
2029
- path: ReadonlyArray<PropertyKey> = []
2029
+ parentTag: ArrayFormatterIssue["_tag"] | undefined,
2030
+ path: ReadonlyArray<PropertyKey>
2030
2031
  ): Effect.Effect<Array<ArrayFormatterIssue>> => {
2031
2032
  const _tag = issue._tag
2032
2033
  switch (_tag) {
2033
2034
  case "Type":
2034
- return map(formatTypeMessage(issue), (message) => [makeArrayFormatterIssue(_tag, path, message)])
2035
+ return map(formatTypeMessage(issue), (message) => [makeArrayFormatterIssue(parentTag ?? _tag, path, message)])
2035
2036
  case "Forbidden":
2036
2037
  return Either.right([makeArrayFormatterIssue(_tag, path, formatForbiddenMessage(issue))])
2037
2038
  case "Unexpected":
@@ -2039,23 +2040,29 @@ const getArrayFormatterIssues = (
2039
2040
  case "Missing":
2040
2041
  return map(formatMissingMessage(issue), (message) => [makeArrayFormatterIssue(_tag, path, message)])
2041
2042
  case "Pointer":
2042
- return getArrayFormatterIssues(issue.issue, path.concat(issue.path))
2043
+ return getArrayFormatterIssues(issue.issue, undefined, path.concat(issue.path))
2043
2044
  case "Composite":
2044
2045
  return flatMap(getMessage(issue), (message) => {
2045
2046
  if (message !== undefined) {
2046
- return Either.right([makeArrayFormatterIssue(issue._tag, path, message)])
2047
+ return Either.right([makeArrayFormatterIssue(_tag, path, message)])
2047
2048
  }
2048
2049
  return util_.isNonEmpty(issue.issues)
2049
- ? map(Effect.forEach(issue.issues, (issue) => getArrayFormatterIssues(issue, path)), Arr.flatten)
2050
- : getArrayFormatterIssues(issue.issues, path)
2050
+ ? map(Effect.forEach(issue.issues, (issue) => getArrayFormatterIssues(issue, undefined, path)), Arr.flatten)
2051
+ : getArrayFormatterIssues(issue.issues, undefined, path)
2051
2052
  })
2052
2053
  case "Refinement":
2054
+ return flatMap(getMessage(issue), (message) => {
2055
+ if (message !== undefined) {
2056
+ return Either.right([makeArrayFormatterIssue(_tag, path, message)])
2057
+ }
2058
+ return getArrayFormatterIssues(issue.issue, issue.kind === "Predicate" ? _tag : undefined, path)
2059
+ })
2053
2060
  case "Transformation":
2054
2061
  return flatMap(getMessage(issue), (message) => {
2055
2062
  if (message !== undefined) {
2056
- return Either.right([makeArrayFormatterIssue(issue._tag, path, message)])
2063
+ return Either.right([makeArrayFormatterIssue(_tag, path, message)])
2057
2064
  }
2058
- return getArrayFormatterIssues(issue.issue, path)
2065
+ return getArrayFormatterIssues(issue.issue, issue.kind === "Transformation" ? _tag : undefined, path)
2059
2066
  })
2060
2067
  }
2061
2068
  }
package/src/Schema.ts CHANGED
@@ -192,8 +192,11 @@ const makeStandardFailureFromParseIssue = (
192
192
  * @category Standard Schema
193
193
  * @since 3.13.0
194
194
  */
195
- export const standardSchemaV1 = <A, I>(schema: Schema<A, I, never>): StandardSchemaV1<I, A> => {
196
- const decodeUnknown = ParseResult.decodeUnknown(schema)
195
+ export const standardSchemaV1 = <A, I>(
196
+ schema: Schema<A, I, never>,
197
+ overrideOptions?: AST.ParseOptions
198
+ ): StandardSchemaV1<I, A> => {
199
+ const decodeUnknown = ParseResult.decodeUnknown(schema, { errors: "all" })
197
200
  return {
198
201
  "~standard": {
199
202
  version: 1,
@@ -201,7 +204,7 @@ export const standardSchemaV1 = <A, I>(schema: Schema<A, I, never>): StandardSch
201
204
  validate(value) {
202
205
  const scheduler = new scheduler_.SyncScheduler()
203
206
  const fiber = Effect.runFork(
204
- Effect.matchEffect(decodeUnknown(value), {
207
+ Effect.matchEffect(decodeUnknown(value, overrideOptions), {
205
208
  onFailure: makeStandardFailureFromParseIssue,
206
209
  onSuccess: (value) => Effect.succeed({ value })
207
210
  }),
@@ -1,4 +1,4 @@
1
- let moduleVersion = "3.13.7"
1
+ let moduleVersion = "3.13.8"
2
2
 
3
3
  export const getCurrentVersion = () => moduleVersion
4
4