@atproto/lex-schema 0.0.5 → 0.0.6

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.
Files changed (265) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/core/property-key.d.ts.map +1 -0
  3. package/dist/core/property-key.js.map +1 -0
  4. package/dist/core/schema.d.ts.map +1 -0
  5. package/dist/core/schema.js.map +1 -0
  6. package/dist/core/validation-error.d.ts +19 -0
  7. package/dist/core/validation-error.d.ts.map +1 -0
  8. package/dist/{validation → core}/validation-error.js +12 -5
  9. package/dist/core/validation-error.js.map +1 -0
  10. package/dist/{validation → core}/validation-issue.d.ts +43 -0
  11. package/dist/core/validation-issue.d.ts.map +1 -0
  12. package/dist/{validation → core}/validation-issue.js +45 -0
  13. package/dist/core/validation-issue.js.map +1 -0
  14. package/dist/{validation → core}/validator.d.ts +1 -1
  15. package/dist/core/validator.d.ts.map +1 -0
  16. package/dist/{validation → core}/validator.js +4 -4
  17. package/dist/core/validator.js.map +1 -0
  18. package/dist/core.d.ts +5 -0
  19. package/dist/core.d.ts.map +1 -1
  20. package/dist/core.js +5 -0
  21. package/dist/core.js.map +1 -1
  22. package/dist/external.d.ts +15 -16
  23. package/dist/external.d.ts.map +1 -1
  24. package/dist/external.js +38 -55
  25. package/dist/external.js.map +1 -1
  26. package/dist/helpers.d.ts +7 -2
  27. package/dist/helpers.d.ts.map +1 -1
  28. package/dist/helpers.js +10 -0
  29. package/dist/helpers.js.map +1 -1
  30. package/dist/schema/_parameters.d.ts +1 -1
  31. package/dist/schema/_parameters.d.ts.map +1 -1
  32. package/dist/schema/_parameters.js.map +1 -1
  33. package/dist/schema/array.d.ts +1 -1
  34. package/dist/schema/array.d.ts.map +1 -1
  35. package/dist/schema/array.js +2 -2
  36. package/dist/schema/array.js.map +1 -1
  37. package/dist/schema/blob.d.ts +1 -1
  38. package/dist/schema/blob.d.ts.map +1 -1
  39. package/dist/schema/blob.js +2 -2
  40. package/dist/schema/blob.js.map +1 -1
  41. package/dist/schema/boolean.d.ts +1 -1
  42. package/dist/schema/boolean.d.ts.map +1 -1
  43. package/dist/schema/boolean.js +2 -2
  44. package/dist/schema/boolean.js.map +1 -1
  45. package/dist/schema/bytes.d.ts +1 -1
  46. package/dist/schema/bytes.d.ts.map +1 -1
  47. package/dist/schema/bytes.js +2 -2
  48. package/dist/schema/bytes.js.map +1 -1
  49. package/dist/schema/cid.d.ts +1 -1
  50. package/dist/schema/cid.d.ts.map +1 -1
  51. package/dist/schema/cid.js +2 -2
  52. package/dist/schema/cid.js.map +1 -1
  53. package/dist/schema/custom.d.ts +1 -1
  54. package/dist/schema/custom.d.ts.map +1 -1
  55. package/dist/schema/custom.js +3 -3
  56. package/dist/schema/custom.js.map +1 -1
  57. package/dist/schema/dict.d.ts +1 -1
  58. package/dist/schema/dict.d.ts.map +1 -1
  59. package/dist/schema/dict.js +2 -2
  60. package/dist/schema/dict.js.map +1 -1
  61. package/dist/schema/discriminated-union.d.ts +1 -1
  62. package/dist/schema/discriminated-union.d.ts.map +1 -1
  63. package/dist/schema/discriminated-union.js +2 -2
  64. package/dist/schema/discriminated-union.js.map +1 -1
  65. package/dist/schema/enum.d.ts +1 -1
  66. package/dist/schema/enum.d.ts.map +1 -1
  67. package/dist/schema/enum.js +2 -2
  68. package/dist/schema/enum.js.map +1 -1
  69. package/dist/schema/integer.d.ts +1 -1
  70. package/dist/schema/integer.d.ts.map +1 -1
  71. package/dist/schema/integer.js +4 -4
  72. package/dist/schema/integer.js.map +1 -1
  73. package/dist/schema/intersection.d.ts +1 -2
  74. package/dist/schema/intersection.d.ts.map +1 -1
  75. package/dist/schema/intersection.js +2 -2
  76. package/dist/schema/intersection.js.map +1 -1
  77. package/dist/schema/literal.d.ts +1 -1
  78. package/dist/schema/literal.d.ts.map +1 -1
  79. package/dist/schema/literal.js +2 -2
  80. package/dist/schema/literal.js.map +1 -1
  81. package/dist/schema/never.d.ts +1 -1
  82. package/dist/schema/never.d.ts.map +1 -1
  83. package/dist/schema/never.js +2 -2
  84. package/dist/schema/never.js.map +1 -1
  85. package/dist/schema/null.d.ts +1 -1
  86. package/dist/schema/null.d.ts.map +1 -1
  87. package/dist/schema/null.js +2 -2
  88. package/dist/schema/null.js.map +1 -1
  89. package/dist/schema/nullable.d.ts +1 -1
  90. package/dist/schema/nullable.d.ts.map +1 -1
  91. package/dist/schema/nullable.js +2 -2
  92. package/dist/schema/nullable.js.map +1 -1
  93. package/dist/schema/object.d.ts +1 -2
  94. package/dist/schema/object.d.ts.map +1 -1
  95. package/dist/schema/object.js +2 -2
  96. package/dist/schema/object.js.map +1 -1
  97. package/dist/schema/optional.d.ts +1 -1
  98. package/dist/schema/optional.d.ts.map +1 -1
  99. package/dist/schema/optional.js +2 -2
  100. package/dist/schema/optional.js.map +1 -1
  101. package/dist/schema/params.d.ts +1 -2
  102. package/dist/schema/params.d.ts.map +1 -1
  103. package/dist/schema/params.js +2 -2
  104. package/dist/schema/params.js.map +1 -1
  105. package/dist/schema/payload.d.ts +1 -1
  106. package/dist/schema/payload.d.ts.map +1 -1
  107. package/dist/schema/payload.js.map +1 -1
  108. package/dist/schema/record.d.ts +1 -2
  109. package/dist/schema/record.d.ts.map +1 -1
  110. package/dist/schema/record.js +2 -2
  111. package/dist/schema/record.js.map +1 -1
  112. package/dist/schema/ref.d.ts +1 -1
  113. package/dist/schema/ref.d.ts.map +1 -1
  114. package/dist/schema/ref.js +2 -2
  115. package/dist/schema/ref.js.map +1 -1
  116. package/dist/schema/refine.d.ts +18 -1
  117. package/dist/schema/refine.d.ts.map +1 -1
  118. package/dist/schema/refine.js +2 -2
  119. package/dist/schema/refine.js.map +1 -1
  120. package/dist/schema/regexp.d.ts +1 -1
  121. package/dist/schema/regexp.d.ts.map +1 -1
  122. package/dist/schema/regexp.js +2 -2
  123. package/dist/schema/regexp.js.map +1 -1
  124. package/dist/schema/string.d.ts +1 -2
  125. package/dist/schema/string.d.ts.map +1 -1
  126. package/dist/schema/string.js +1 -2
  127. package/dist/schema/string.js.map +1 -1
  128. package/dist/schema/subscription.d.ts +1 -2
  129. package/dist/schema/subscription.d.ts.map +1 -1
  130. package/dist/schema/subscription.js.map +1 -1
  131. package/dist/schema/token.d.ts +1 -1
  132. package/dist/schema/token.d.ts.map +1 -1
  133. package/dist/schema/token.js +2 -2
  134. package/dist/schema/token.js.map +1 -1
  135. package/dist/schema/typed-object.d.ts +1 -2
  136. package/dist/schema/typed-object.d.ts.map +1 -1
  137. package/dist/schema/typed-object.js +2 -2
  138. package/dist/schema/typed-object.js.map +1 -1
  139. package/dist/schema/typed-ref.d.ts +1 -1
  140. package/dist/schema/typed-ref.d.ts.map +1 -1
  141. package/dist/schema/typed-ref.js +2 -2
  142. package/dist/schema/typed-ref.js.map +1 -1
  143. package/dist/schema/typed-union.d.ts +2 -3
  144. package/dist/schema/typed-union.d.ts.map +1 -1
  145. package/dist/schema/typed-union.js +2 -2
  146. package/dist/schema/typed-union.js.map +1 -1
  147. package/dist/schema/union.d.ts +1 -1
  148. package/dist/schema/union.d.ts.map +1 -1
  149. package/dist/schema/union.js +3 -3
  150. package/dist/schema/union.js.map +1 -1
  151. package/dist/schema/unknown-object.d.ts +1 -2
  152. package/dist/schema/unknown-object.d.ts.map +1 -1
  153. package/dist/schema/unknown-object.js +2 -2
  154. package/dist/schema/unknown-object.js.map +1 -1
  155. package/dist/schema/unknown.d.ts +1 -1
  156. package/dist/schema/unknown.d.ts.map +1 -1
  157. package/dist/schema/unknown.js +2 -2
  158. package/dist/schema/unknown.js.map +1 -1
  159. package/dist/util/memoize.d.ts +3 -0
  160. package/dist/util/memoize.d.ts.map +1 -0
  161. package/dist/util/memoize.js +52 -0
  162. package/dist/util/memoize.js.map +1 -0
  163. package/package.json +6 -6
  164. package/src/{validation → core}/validation-error.ts +11 -3
  165. package/src/{validation → core}/validation-issue.ts +52 -0
  166. package/src/{validation → core}/validator.ts +1 -1
  167. package/src/core.ts +5 -0
  168. package/src/external.ts +67 -48
  169. package/src/helpers.test.ts +1 -0
  170. package/src/helpers.ts +16 -2
  171. package/src/schema/_parameters.test.ts +1 -0
  172. package/src/schema/_parameters.ts +1 -1
  173. package/src/schema/array.test.ts +1 -0
  174. package/src/schema/array.ts +1 -1
  175. package/src/schema/blob.test.ts +1 -0
  176. package/src/schema/blob.ts +1 -1
  177. package/src/schema/boolean.test.ts +1 -0
  178. package/src/schema/boolean.ts +1 -1
  179. package/src/schema/bytes.test.ts +1 -0
  180. package/src/schema/bytes.ts +1 -1
  181. package/src/schema/cid.test.ts +1 -0
  182. package/src/schema/cid.ts +1 -1
  183. package/src/schema/custom.test.ts +3 -2
  184. package/src/schema/custom.ts +1 -1
  185. package/src/schema/dict.test.ts +1 -0
  186. package/src/schema/dict.ts +1 -1
  187. package/src/schema/discriminated-union.test.ts +1 -0
  188. package/src/schema/discriminated-union.ts +1 -1
  189. package/src/schema/enum.test.ts +1 -0
  190. package/src/schema/enum.ts +1 -1
  191. package/src/schema/integer.test.ts +1 -0
  192. package/src/schema/integer.ts +3 -3
  193. package/src/schema/intersection.test.ts +1 -0
  194. package/src/schema/intersection.ts +2 -2
  195. package/src/schema/literal.test.ts +1 -0
  196. package/src/schema/literal.ts +1 -1
  197. package/src/schema/never.test.ts +1 -0
  198. package/src/schema/never.ts +1 -1
  199. package/src/schema/null.test.ts +1 -0
  200. package/src/schema/null.ts +1 -1
  201. package/src/schema/nullable.test.ts +1 -0
  202. package/src/schema/nullable.ts +1 -1
  203. package/src/schema/object.test.ts +1 -0
  204. package/src/schema/object.ts +3 -3
  205. package/src/schema/optional.test.ts +1 -0
  206. package/src/schema/optional.ts +1 -1
  207. package/src/schema/params.test.ts +1 -0
  208. package/src/schema/params.ts +3 -3
  209. package/src/schema/payload.test.ts +1 -0
  210. package/src/schema/payload.ts +1 -1
  211. package/src/schema/permission-set.test.ts +1 -0
  212. package/src/schema/permission.test.ts +1 -0
  213. package/src/schema/procedure.test.ts +1 -0
  214. package/src/schema/query.test.ts +1 -0
  215. package/src/schema/record.test.ts +1 -0
  216. package/src/schema/record.ts +5 -2
  217. package/src/schema/ref.test.ts +2 -1
  218. package/src/schema/ref.ts +1 -1
  219. package/src/schema/refine.test.ts +1 -0
  220. package/src/schema/refine.ts +18 -1
  221. package/src/schema/regexp.test.ts +1 -0
  222. package/src/schema/regexp.ts +1 -1
  223. package/src/schema/string.test.ts +1 -0
  224. package/src/schema/string.ts +8 -2
  225. package/src/schema/subscription.test.ts +1 -0
  226. package/src/schema/subscription.ts +1 -2
  227. package/src/schema/token.test.ts +1 -0
  228. package/src/schema/token.ts +1 -1
  229. package/src/schema/typed-object.test.ts +1 -0
  230. package/src/schema/typed-object.ts +3 -2
  231. package/src/schema/typed-ref.test.ts +1 -0
  232. package/src/schema/typed-ref.ts +1 -1
  233. package/src/schema/typed-union.test.ts +1 -0
  234. package/src/schema/typed-union.ts +4 -4
  235. package/src/schema/union.test.ts +1 -0
  236. package/src/schema/union.ts +1 -1
  237. package/src/schema/unknown-object.test.ts +1 -0
  238. package/src/schema/unknown-object.ts +1 -2
  239. package/src/schema/unknown.test.ts +1 -0
  240. package/src/schema/unknown.ts +1 -1
  241. package/src/util/array-agg.test.ts +1 -0
  242. package/src/util/memoize.ts +57 -0
  243. package/tsconfig.tests.json +1 -1
  244. package/dist/validation/property-key.d.ts.map +0 -1
  245. package/dist/validation/property-key.js.map +0 -1
  246. package/dist/validation/schema.d.ts.map +0 -1
  247. package/dist/validation/schema.js.map +0 -1
  248. package/dist/validation/validation-error.d.ts +0 -9
  249. package/dist/validation/validation-error.d.ts.map +0 -1
  250. package/dist/validation/validation-error.js.map +0 -1
  251. package/dist/validation/validation-issue.d.ts.map +0 -1
  252. package/dist/validation/validation-issue.js.map +0 -1
  253. package/dist/validation/validator.d.ts.map +0 -1
  254. package/dist/validation/validator.js.map +0 -1
  255. package/dist/validation.d.ts +0 -6
  256. package/dist/validation.d.ts.map +0 -1
  257. package/dist/validation.js +0 -9
  258. package/dist/validation.js.map +0 -1
  259. package/src/validation.ts +0 -5
  260. /package/dist/{validation → core}/property-key.d.ts +0 -0
  261. /package/dist/{validation → core}/property-key.js +0 -0
  262. /package/dist/{validation → core}/schema.d.ts +0 -0
  263. /package/dist/{validation → core}/schema.js +0 -0
  264. /package/src/{validation → core}/property-key.ts +0 -0
  265. /package/src/{validation → core}/schema.ts +0 -0
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { BooleanSchema } from './boolean.js'
2
3
  import { DictSchema } from './dict.js'
3
4
  import { EnumSchema } from './enum.js'
@@ -5,7 +5,7 @@ import {
5
5
  ValidationResult,
6
6
  Validator,
7
7
  ValidatorContext,
8
- } from '../validation.js'
8
+ } from '../core.js'
9
9
 
10
10
  export type DictSchemaOutput<
11
11
  KeySchema extends Validator<string>,
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { DiscriminatedUnionSchema } from './discriminated-union.js'
2
3
  import { EnumSchema } from './enum.js'
3
4
  import { IntegerSchema } from './integer.js'
@@ -5,7 +5,7 @@ import {
5
5
  ValidationResult,
6
6
  Validator,
7
7
  ValidatorContext,
8
- } from '../validation.js'
8
+ } from '../core.js'
9
9
  import { EnumSchema } from './enum.js'
10
10
  import { LiteralSchema } from './literal.js'
11
11
  import { ObjectSchema } from './object.js'
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { EnumSchema } from './enum.js'
2
3
 
3
4
  describe('EnumSchema', () => {
@@ -1,4 +1,4 @@
1
- import { Schema, ValidationResult, ValidatorContext } from '../validation.js'
1
+ import { Schema, ValidationResult, ValidatorContext } from '../core.js'
2
2
 
3
3
  export type EnumSchemaOptions<T extends null | string | number | boolean> = {
4
4
  default?: T
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { IntegerSchema } from './integer.js'
2
3
 
3
4
  describe('IntegerSchema', () => {
@@ -1,4 +1,4 @@
1
- import { Schema, ValidationResult, ValidatorContext } from '../validation.js'
1
+ import { Schema, ValidationResult, ValidatorContext } from '../core.js'
2
2
 
3
3
  export type IntegerSchemaOptions = {
4
4
  default?: number
@@ -32,8 +32,8 @@ export class IntegerSchema extends Schema<number> {
32
32
  }
33
33
 
34
34
  /**
35
- * Simple wrapper around {@link Number.isInteger} that acts as a type guard.
35
+ * Simple wrapper around {@link Number.isSafeInteger} that acts as a type guard.
36
36
  */
37
37
  function isInteger(input: unknown): input is number {
38
- return Number.isInteger(input) && Number.isSafeInteger(input)
38
+ return Number.isSafeInteger(input)
39
39
  }
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { BooleanSchema } from './boolean.js'
2
3
  import { DictSchema } from './dict.js'
3
4
  import { EnumSchema } from './enum.js'
@@ -1,10 +1,10 @@
1
- import { Simplify } from '../core.js'
2
1
  import {
3
2
  Infer,
4
3
  Schema,
4
+ Simplify,
5
5
  ValidationResult,
6
6
  ValidatorContext,
7
- } from '../validation.js'
7
+ } from '../core.js'
8
8
  import { DictSchema } from './dict.js'
9
9
  import { ObjectSchema } from './object.js'
10
10
 
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { LiteralSchema } from './literal.js'
2
3
 
3
4
  describe('LiteralSchema', () => {
@@ -1,4 +1,4 @@
1
- import { Schema, ValidationResult, ValidatorContext } from '../validation.js'
1
+ import { Schema, ValidationResult, ValidatorContext } from '../core.js'
2
2
 
3
3
  export type LiteralSchemaOptions<T extends null | string | number | boolean> = {
4
4
  default?: T
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { NeverSchema } from './never.js'
2
3
 
3
4
  describe('NeverSchema', () => {
@@ -1,4 +1,4 @@
1
- import { Schema, ValidationFailure, ValidatorContext } from '../validation.js'
1
+ import { Schema, ValidationFailure, ValidatorContext } from '../core.js'
2
2
 
3
3
  export class NeverSchema extends Schema<never> {
4
4
  validateInContext(input: unknown, ctx: ValidatorContext): ValidationFailure {
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { NullSchema } from './null.js'
2
3
 
3
4
  describe('NullSchema', () => {
@@ -1,4 +1,4 @@
1
- import { Schema, ValidationResult, ValidatorContext } from '../validation.js'
1
+ import { Schema, ValidationResult, ValidatorContext } from '../core.js'
2
2
 
3
3
  export class NullSchema extends Schema<null> {
4
4
  constructor() {
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { EnumSchema } from './enum.js'
2
3
  import { IntegerSchema } from './integer.js'
3
4
  import { NullableSchema } from './nullable.js'
@@ -3,7 +3,7 @@ import {
3
3
  ValidationResult,
4
4
  Validator,
5
5
  ValidatorContext,
6
- } from '../validation.js'
6
+ } from '../core.js'
7
7
 
8
8
  export class NullableSchema<V> extends Schema<V | null> {
9
9
  constructor(readonly schema: Validator<V>) {
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { EnumSchema } from './enum.js'
2
3
  import { IntegerSchema } from './integer.js'
3
4
  import { NullableSchema } from './nullable.js'
@@ -1,13 +1,13 @@
1
1
  import { isPlainObject } from '@atproto/lex-data'
2
- import { WithOptionalProperties } from '../core.js'
3
- import { lazyProperty } from '../util/lazy-property.js'
4
2
  import {
5
3
  Infer,
6
4
  Schema,
7
5
  ValidationResult,
8
6
  Validator,
9
7
  ValidatorContext,
10
- } from '../validation.js'
8
+ WithOptionalProperties,
9
+ } from '../core.js'
10
+ import { lazyProperty } from '../util/lazy-property.js'
11
11
 
12
12
  export type ObjectSchemaShape = Record<string, Validator>
13
13
 
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { BooleanSchema } from './boolean.js'
2
3
  import { IntegerSchema } from './integer.js'
3
4
  import { OptionalSchema } from './optional.js'
@@ -3,7 +3,7 @@ import {
3
3
  ValidationResult,
4
4
  Validator,
5
5
  ValidatorContext,
6
- } from '../validation.js'
6
+ } from '../core.js'
7
7
 
8
8
  export class OptionalSchema<V> extends Schema<V | undefined> {
9
9
  constructor(readonly schema: Validator<V>) {
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { ArraySchema } from './array.js'
2
3
  import { BooleanSchema } from './boolean.js'
3
4
  import { IntegerSchema } from './integer.js'
@@ -1,13 +1,13 @@
1
1
  import { isPlainObject } from '@atproto/lex-data'
2
- import { WithOptionalProperties } from '../core.js'
3
- import { lazyProperty } from '../util/lazy-property.js'
4
2
  import {
5
3
  Infer,
6
4
  Schema,
7
5
  ValidationResult,
8
6
  Validator,
9
7
  ValidatorContext,
10
- } from '../validation.js'
8
+ WithOptionalProperties,
9
+ } from '../core.js'
10
+ import { lazyProperty } from '../util/lazy-property.js'
11
11
  import { Param, ParamScalar, paramSchema } from './_parameters.js'
12
12
  import { StringSchema } from './string.js'
13
13
 
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { IntegerSchema } from './integer.js'
2
3
  import { ObjectSchema } from './object.js'
3
4
  import { Payload } from './payload.js'
@@ -1,5 +1,5 @@
1
1
  import { LexValue } from '@atproto/lex-data'
2
- import { Infer, Schema } from '../validation.js'
2
+ import { Infer, Schema } from '../core.js'
3
3
 
4
4
  export type InferPayload<
5
5
  P extends Payload,
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { asNsidString } from '../core.js'
2
3
  import { PermissionSet } from './permission-set.js'
3
4
  import { Permission } from './permission.js'
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { Permission } from './permission.js'
2
3
 
3
4
  describe('Permission', () => {
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { ObjectSchema } from './object.js'
2
3
  import { ParamsSchema } from './params.js'
3
4
  import { Payload } from './payload.js'
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { asNsidString } from '../core.js'
2
3
  import { IntegerSchema } from './integer.js'
3
4
  import { ObjectSchema } from './object.js'
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { ObjectSchema } from './object.js'
2
3
  import { RecordSchema } from './record.js'
3
4
  import { StringSchema } from './string.js'
@@ -1,11 +1,14 @@
1
- import { LexiconRecordKey, NsidString, Simplify, TidString } from '../core.js'
2
1
  import {
3
2
  Infer,
3
+ LexiconRecordKey,
4
+ NsidString,
4
5
  Schema,
6
+ Simplify,
7
+ TidString,
5
8
  ValidationResult,
6
9
  Validator,
7
10
  ValidatorContext,
8
- } from '../validation.js'
11
+ } from '../core.js'
9
12
  import { LiteralSchema } from './literal.js'
10
13
  import { StringSchema } from './string.js'
11
14
  import { TypedObject } from './typed-union.js'
@@ -1,4 +1,5 @@
1
- import { Schema } from '../validation.js'
1
+ import { describe, expect, it } from 'vitest'
2
+ import { Schema } from '../core.js'
2
3
  import { IntegerSchema } from './integer.js'
3
4
  import { ObjectSchema } from './object.js'
4
5
  import { OptionalSchema } from './optional.js'
package/src/schema/ref.ts CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  ValidationResult,
4
4
  Validator,
5
5
  ValidatorContext,
6
- } from '../validation.js'
6
+ } from '../core.js'
7
7
 
8
8
  export type RefSchemaGetter<V> = () => Validator<V>
9
9
 
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { IntegerSchema } from './integer.js'
2
3
  import { ObjectSchema } from './object.js'
3
4
  import { refine } from './refine.js'
@@ -5,7 +5,7 @@ import {
5
5
  ValidationResult,
6
6
  Validator,
7
7
  ValidatorContext,
8
- } from '../validation.js'
8
+ } from '../core.js'
9
9
  import { CustomAssertionContext } from './custom.js'
10
10
 
11
11
  export type RefinementCheck<T> = {
@@ -31,6 +31,23 @@ export type Refinement<T = any, Out extends T = T> =
31
31
  | RefinementCheck<T>
32
32
  | RefinementAssertion<T, Out>
33
33
 
34
+ /**
35
+ * Create a refined schema based on an existing schema and a refinement check.
36
+ *
37
+ * @param schema - The base schema to refine.
38
+ * @param refinement - The refinement check to apply.
39
+ * @returns A new schema that includes the refinement.
40
+ * @example
41
+ *
42
+ * ```ts
43
+ * const PositiveInt = refine(l.integer(), {
44
+ * check: (value) => value > 0,
45
+ * message: 'Value must be a positive integer',
46
+ * })
47
+ * const result = PositiveInt.validate(-5)
48
+ * // result.success === false
49
+ * ```
50
+ */
34
51
  export function refine<S extends Validator, Out extends Infer<S>>(
35
52
  schema: S,
36
53
  refinement: RefinementAssertion<Infer<S>, Out>,
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { RegexpSchema } from './regexp.js'
2
3
 
3
4
  describe('RegexpSchema', () => {
@@ -1,4 +1,4 @@
1
- import { Schema, ValidationResult, ValidatorContext } from '../validation'
1
+ import { Schema, ValidationResult, ValidatorContext } from '../core.js'
2
2
 
3
3
  export class RegexpSchema<T extends string> extends Schema<T> {
4
4
  constructor(public readonly pattern: RegExp) {
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { StringSchema } from './string.js'
2
3
  import { TokenSchema } from './token.js'
3
4
 
@@ -1,6 +1,12 @@
1
1
  import { asCid, graphemeLen, utf8Len } from '@atproto/lex-data'
2
- import { InferStringFormat, StringFormat, assertStringFormat } from '../core.js'
3
- import { Schema, ValidationResult, ValidatorContext } from '../validation.js'
2
+ import {
3
+ InferStringFormat,
4
+ Schema,
5
+ StringFormat,
6
+ ValidationResult,
7
+ ValidatorContext,
8
+ assertStringFormat,
9
+ } from '../core.js'
4
10
  import { TokenSchema } from './token.js'
5
11
 
6
12
  export type StringSchemaOptions = {
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { asNsidString } from '../core.js'
2
3
  import { IntegerSchema } from './integer.js'
3
4
  import { ObjectSchema } from './object.js'
@@ -1,5 +1,4 @@
1
- import { NsidString } from '../core.js'
2
- import { Infer, Schema } from '../validation.js'
1
+ import { Infer, NsidString, Schema } from '../core.js'
3
2
  import { ParamsSchema } from './params.js'
4
3
 
5
4
  export type InferSubscriptionParameters<S extends Subscription> = Infer<
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { TokenSchema } from './token.js'
2
3
 
3
4
  describe('TokenSchema', () => {
@@ -1,4 +1,4 @@
1
- import { Schema, ValidationResult, ValidatorContext } from '../validation.js'
1
+ import { Schema, ValidationResult, ValidatorContext } from '../core.js'
2
2
 
3
3
  export class TokenSchema<V extends string = any> extends Schema<V> {
4
4
  constructor(protected readonly value: V) {
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { EnumSchema } from './enum.js'
2
3
  import { IntegerSchema } from './integer.js'
3
4
  import { NullableSchema } from './nullable.js'
@@ -1,12 +1,13 @@
1
1
  import { isPlainObject } from '@atproto/lex-data'
2
- import { $Type, Simplify } from '../core.js'
3
2
  import {
3
+ $Type,
4
4
  Infer,
5
5
  Schema,
6
+ Simplify,
6
7
  ValidationResult,
7
8
  Validator,
8
9
  ValidatorContext,
9
- } from '../validation.js'
10
+ } from '../core.js'
10
11
  import { TypedObject } from './typed-union.js'
11
12
 
12
13
  export type TypedObjectSchemaOutput<
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { IntegerSchema } from './integer.js'
2
3
  import { ObjectSchema } from './object.js'
3
4
  import { StringSchema } from './string.js'
@@ -3,7 +3,7 @@ import {
3
3
  ValidationResult,
4
4
  Validator,
5
5
  ValidatorContext,
6
- } from '../validation.js'
6
+ } from '../core.js'
7
7
 
8
8
  // Basically a RecordSchema or TypedObjectSchema
9
9
  export type TypedRefSchemaValidator<V extends { $type?: string } = any> =
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { IntegerSchema } from './integer.js'
2
3
  import { ObjectSchema } from './object.js'
3
4
  import { StringSchema } from './string.js'
@@ -1,17 +1,17 @@
1
1
  import { isPlainObject } from '@atproto/lex-data'
2
- import { Restricted, UnknownString } from '../core.js'
3
- import { lazyProperty } from '../util/lazy-property.js'
4
2
  import {
5
3
  Infer,
4
+ Restricted,
6
5
  Schema,
7
6
  ValidationResult,
8
7
  ValidatorContext,
9
- } from '../validation.js'
8
+ } from '../core.js'
9
+ import { lazyProperty } from '../util/lazy-property.js'
10
10
  import { TypedRefSchema, TypedRefSchemaOutput } from './typed-ref.js'
11
11
 
12
12
  export type TypedRef<T extends { $type?: string }> = TypedRefSchemaOutput<T>
13
13
 
14
- export type TypedObject = { $type: UnknownString } & {
14
+ export type TypedObject = { $type: string } & {
15
15
  // In order to prevent places that expect an open union from accepting an
16
16
  // invalid version of the known typed objects, we need to prevent any other
17
17
  // properties from being present.
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { BooleanSchema } from './boolean.js'
2
3
  import { IntegerSchema } from './integer.js'
3
4
  import { ObjectSchema } from './object.js'
@@ -6,7 +6,7 @@ import {
6
6
  ValidationResult,
7
7
  Validator,
8
8
  ValidatorContext,
9
- } from '../validation.js'
9
+ } from '../core.js'
10
10
 
11
11
  export type UnionSchemaValidators = readonly [Validator, ...Validator[]]
12
12
  export type UnionSchemaOutput<V extends readonly Validator[]> = Infer<V[number]>
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { UnknownObjectSchema } from './unknown-object.js'
2
3
 
3
4
  describe('UnknownObjectSchema', () => {
@@ -1,7 +1,6 @@
1
1
  import { LexMap, isLexMap } from '@atproto/lex-data'
2
- import { Schema, ValidationResult, ValidatorContext } from '../validation'
2
+ import { Schema, ValidationResult, ValidatorContext } from '../core.js'
3
3
 
4
- export type { LexMap }
5
4
  export type UnknownObjectOutput = LexMap
6
5
 
7
6
  export class UnknownObjectSchema extends Schema<UnknownObjectOutput> {
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { UnknownSchema } from './unknown.js'
2
3
 
3
4
  describe('UnknownSchema', () => {
@@ -1,4 +1,4 @@
1
- import { Schema, ValidationResult, ValidatorContext } from '../validation'
1
+ import { Schema, ValidationResult, ValidatorContext } from '../core.js'
2
2
 
3
3
  export class UnknownSchema extends Schema<unknown> {
4
4
  validateInContext(
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest'
1
2
  import { arrayAgg } from './array-agg.js'
2
3
 
3
4
  describe('arrayAgg', () => {
@@ -0,0 +1,57 @@
1
+ /*@__NO_SIDE_EFFECTS__*/
2
+ export function memoizedOptions<
3
+ F extends (options?: NonNullable<unknown>) => any,
4
+ >(
5
+ fn: F,
6
+ keyFn?: (
7
+ options: NonNullable<Parameters<F>[0]>,
8
+ ) => string | number | boolean | null | void,
9
+ ): F {
10
+ let emptyOptionsValue: ReturnType<F> | undefined
11
+
12
+ if (keyFn) {
13
+ const cache = new Map<string | number | boolean | null, ReturnType<F>>()
14
+ const fromCache = (
15
+ options: NonNullable<Parameters<F>[0]>,
16
+ ): ReturnType<F> => {
17
+ const key = keyFn(options)
18
+ if (key !== undefined) {
19
+ const cached = cache.get(key)
20
+ if (cached) return cached
21
+ const result = fn(options) as ReturnType<F>
22
+ cache.set(key, result)
23
+ return result
24
+ }
25
+
26
+ return fn(options)
27
+ }
28
+
29
+ return ((options: Parameters<F>[0]): ReturnType<F> => {
30
+ // Non-empty options case
31
+ if (options) for (const _ in options) return fromCache(options)
32
+
33
+ // Empty or missing options case
34
+ return (emptyOptionsValue ??= fn(options))
35
+ }) as F
36
+ }
37
+
38
+ return ((options: Parameters<F>[0]): ReturnType<F> => {
39
+ // Non-empty options case
40
+ if (options) for (const _ in options) return fn(options)
41
+
42
+ // Empty or missing options case
43
+ return (emptyOptionsValue ??= fn(options))
44
+ }) as F
45
+ }
46
+
47
+ /*@__NO_SIDE_EFFECTS__*/
48
+ export function memoizedTransformer<F extends (arg: any) => any>(fn: F): F {
49
+ const cache = new WeakMap<object, ReturnType<F>>()
50
+ return ((arg: Parameters<F>[0]): ReturnType<F> => {
51
+ const cached = cache.get(arg)
52
+ if (cached) return cached
53
+ const result = fn(arg) as ReturnType<F>
54
+ cache.set(arg, result)
55
+ return result
56
+ }) as F
57
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "../../../tsconfig/tests.json",
2
+ "extends": "../../../tsconfig/vitest.json",
3
3
  "include": ["./tests", "./src/**/*.test.ts"],
4
4
  "compilerOptions": {
5
5
  "noImplicitAny": true,
@@ -1 +0,0 @@
1
- {"version":3,"file":"property-key.d.ts","sourceRoot":"","sources":["../../src/validation/property-key.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"property-key.js","sourceRoot":"","sources":["../../src/validation/property-key.ts"],"names":[],"mappings":"","sourcesContent":["export type PropertyKey = string | number\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/validation/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EACjB,MAAM,gBAAgB,CAAA;AAEvB,8BAAsB,MAAM,CAAC,MAAM,GAAG,GAAG,CAAE,YAAW,SAAS,CAAC,MAAM,CAAC;IACrE,SAAiB,CAAC,OAAO,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;IAE9C,QAAQ,CAAC,iBAAiB,CACxB,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,gBAAgB,GACpB,gBAAgB,CAAC,MAAM,CAAC;IAE3B;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM;IAK/C;;;;;OAKG;IACH,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAI3B;;;;OAIG;IACH,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,MAAM;IAI7B,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM;IAKxC,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,SAAS;IAIhD,KAAK,CAAC,CAAC,EACL,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,iBAAiB,GAAG;QAAE,cAAc,EAAE,KAAK,CAAA;KAAE,GACrD,CAAC,GAAG,MAAM;IACb,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM;IAO1D,SAAS,CAAC,CAAC,EACT,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,iBAAiB,GAAG;QAAE,cAAc,EAAE,KAAK,CAAA;KAAE,GACrD,gBAAgB,CAAC,CAAC,GAAG,MAAM,CAAC;IAC/B,SAAS,CACP,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,iBAAiB,GAC1B,gBAAgB,CAAC,MAAM,CAAC;IAsB3B,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM;IAIhD,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM;IAIzC,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,SAAS;IAIjD,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM;IAI3D,UAAU,CACR,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,iBAAiB,GAC1B,gBAAgB,CAAC,MAAM,CAAC;CAG5B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/validation/schema.ts"],"names":[],"mappings":";;;AAAA,iDAKuB;AAEvB,MAAsB,MAAM;IAQ1B;;;;;OAKG;IACH,MAAM,CAAC,KAAc;QACnB,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAA;QAC/D,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,MAAM,MAAM,CAAC,MAAM,CAAA;IAC1C,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,KAAc;QAClB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACpB,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAI,KAAQ;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAA;IACrD,CAAC;IAED,OAAO,CAAC,KAAc;QACpB,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAA;QAC/D,OAAO,MAAM,CAAC,OAAO,CAAA;IACvB,CAAC;IAED,SAAS,CAAI,KAAQ;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;IAChD,CAAC;IAOD,KAAK,CAAC,KAAc,EAAE,OAA2B;QAC/C,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAC7C,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,MAAM,MAAM,CAAC,MAAM,CAAA;QACxC,OAAO,MAAM,CAAC,KAAK,CAAA;IACrB,CAAC;IAUD,SAAS,CACP,KAAc,EACd,OAA2B;QAE3B,OAAO,+BAAgB,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;IACxD,CAAC;IAED,yEAAyE;IACzE,4EAA4E;IAC5E,6EAA6E;IAC7E,iEAAiE;IACjE,uEAAuE;IACvE,wEAAwE;IACxE,8EAA8E;IAC9E,2EAA2E;IAC3E,6EAA6E;IAC7E,+DAA+D;IAC/D,EAAE;IACF,wFAAwF;IACxF,qGAAqG;IAErG,OAAO,CAAC,KAAc;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAC3B,CAAC;IAED,QAAQ,CAAC,KAAc;QACrB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAC5B,CAAC;IAED,UAAU,CAAI,KAAQ;QACpB,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IAC9B,CAAC;IAED,MAAM,CAAC,KAAc,EAAE,OAA2B;QAChD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IACnC,CAAC;IAED,UAAU,CACR,KAAc,EACd,OAA2B;QAE3B,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IACvC,CAAC;CACF;AA7GD,wBA6GC","sourcesContent":["import {\n ValidationOptions,\n ValidationResult,\n Validator,\n ValidatorContext,\n} from './validator.js'\n\nexport abstract class Schema<Output = any> implements Validator<Output> {\n declare readonly ['__lex']: { output: Output }\n\n abstract validateInContext(\n input: unknown,\n ctx: ValidatorContext,\n ): ValidationResult<Output>\n\n /**\n * @note use {@link check}() instead of {@link assert}() if you encounter a\n * `ts(2775)` error and you are not able to fully type the validator. This\n * will typically arise in generic contexts, where the narrowed type is not\n * needed.\n */\n assert(input: unknown): asserts input is Output {\n const result = this.safeParse(input, { allowTransform: false })\n if (!result.success) throw result.reason\n }\n\n /**\n * Alias for {@link assert}(). Most useful in generic contexts where the\n * validator is not exactly typed, allowing to avoid \"_Assertions require\n * every name in the call target to be declared with an explicit type\n * annotation. ts(2775)_\" errors.\n */\n check(input: unknown): void {\n this.assert(input)\n }\n\n /**\n * Casts the input (by validating it) to the output type if it matches the\n * schema, otherwise throws. This is the same as calling {@link parse}() with\n * `allowTransform: false`.\n */\n cast<I>(input: I): I & Output {\n return this.parse(input, { allowTransform: false })\n }\n\n matches(input: unknown): input is Output {\n const result = this.safeParse(input, { allowTransform: false })\n return result.success\n }\n\n ifMatches<I>(input: I): (I & Output) | undefined {\n return this.matches(input) ? input : undefined\n }\n\n parse<I>(\n input: I,\n options: ValidationOptions & { allowTransform: false },\n ): I & Output\n parse(input: unknown, options?: ValidationOptions): Output\n parse(input: unknown, options?: ValidationOptions): Output {\n const result = this.safeParse(input, options)\n if (!result.success) throw result.reason\n return result.value\n }\n\n safeParse<I>(\n input: I,\n options: ValidationOptions & { allowTransform: false },\n ): ValidationResult<I & Output>\n safeParse(\n input: unknown,\n options?: ValidationOptions,\n ): ValidationResult<Output>\n safeParse(\n input: unknown,\n options?: ValidationOptions,\n ): ValidationResult<Output> {\n return ValidatorContext.validate(input, this, options)\n }\n\n // @NOTE The built lexicons namespaces will export utility functions that\n // allow accessing the schema's methods without the need to specify \".main.\"\n // as part of the namespace. This way, a utility for a particular record type\n // can be called like \"app.bsky.feed.post.<utility>()\" instead of\n // \"app.bsky.feed.post.main.<utility>()\". Because those utilities could\n // conflict with other schemas (e.g. if there is a lexicon definition at\n // \"#<utility>\"), those exported utilities will be prefixed with \"$\". In order\n // to be able to consistently call the utilities, when using the \"main\" and\n // non \"main\" definitions, we also expose the same methods with a \"$\" prefix.\n // Thanks to this, both of the following call will be possible:\n //\n // - \"app.bsky.feed.post.$parse(...)\" // calls a utility function created by \"lex build\"\n // - \"app.bsky.feed.defs.postView.$parse(...)\" // uses the alias defined below on the schema instance\n\n $assert(input: unknown): asserts input is Output {\n return this.assert(input)\n }\n\n $matches(input: unknown): input is Output {\n return this.matches(input)\n }\n\n $ifMatches<I>(input: I): (I & Output) | undefined {\n return this.ifMatches(input)\n }\n\n $parse(input: unknown, options?: ValidationOptions): Output {\n return this.parse(input, options)\n }\n\n $safeParse(\n input: unknown,\n options?: ValidationOptions,\n ): ValidationResult<Output> {\n return this.safeParse(input, options)\n }\n}\n"]}
@@ -1,9 +0,0 @@
1
- import { ResultFailure } from '../core.js';
2
- import { Issue } from './validation-issue.js';
3
- export declare class ValidationError extends Error {
4
- name: string;
5
- readonly issues: Issue[];
6
- constructor(issues: Issue[], options?: ErrorOptions);
7
- static fromFailures(failures: ResultFailure<ValidationError>[]): ValidationError;
8
- }
9
- //# sourceMappingURL=validation-error.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validation-error.d.ts","sourceRoot":"","sources":["../../src/validation/validation-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAiB,MAAM,YAAY,CAAA;AAEzD,OAAO,EACL,KAAK,EAGN,MAAM,uBAAuB,CAAA;AAE9B,qBAAa,eAAgB,SAAQ,KAAK;IACxC,IAAI,SAAoB;IAExB,QAAQ,CAAC,MAAM,EAAE,KAAK,EAAE,CAAA;gBAEZ,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,EAAE,YAAY;IAMnD,MAAM,CAAC,YAAY,CACjB,QAAQ,EAAE,aAAa,CAAC,eAAe,CAAC,EAAE,GACzC,eAAe;CAQnB"}