justus 0.0.1 → 0.0.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.
@@ -1,4 +1,15 @@
1
- import { additionalValidator, InferSchema, modifierValidator, never, Schema, schemaValidator, ValidationOptions, Validator } from '../types'
1
+ import {
2
+ InferSchema,
3
+ Schema,
4
+ TupleRestParameter,
5
+ ValidationOptions,
6
+ Validator,
7
+ additionalValidator,
8
+ modifierValidator,
9
+ never,
10
+ restValidator,
11
+ schemaValidator,
12
+ } from '../types'
2
13
  import { assertValidation, ValidationErrorBuilder } from '../errors'
3
14
  import { getValidator } from '../utilities'
4
15
  import { isModifier } from '../schema'
@@ -8,30 +19,47 @@ import { makeTupleRestIterable } from './tuple'
8
19
  * OBJECT VALIDATOR *
9
20
  * ========================================================================== */
10
21
 
11
- /** A `Validator` validating `object`s according to a `Schema` */
22
+ export type ObjectProperty = {
23
+ validator: Validator,
24
+ readonly?: true,
25
+ optional?: true,
26
+ }
27
+
28
+ /** A `Validator` validating any `object`. */
29
+ export class AnyObjectValidator extends Validator<Record<string, any>> {
30
+ validate(value: unknown): Record<string, any> {
31
+ assertValidation(typeof value == 'object', 'Value is not an "object"')
32
+ assertValidation(value !== null, 'Value is "null"')
33
+ return value
34
+ }
35
+ }
36
+
37
+ /** A `Validator` validating `object`s according to a `Schema`. */
12
38
  export class ObjectValidator<S extends Schema> extends Validator<InferSchema<S>> {
13
39
  readonly schema: Readonly<S>
14
40
 
15
- #additionalProperties?: Validator
16
- #requiredProperties: Record<string, Validator<any>> = {}
17
- #optionalProperties: Record<string, Validator<any>> = {}
18
- #neverProperties: Set<string> = new Set<string>()
41
+ properties = new Map<string, ObjectProperty | undefined>()
42
+ additionalProperties?: Validator
19
43
 
20
44
  constructor(schema: S) {
21
45
  super()
22
46
  const { [additionalValidator]: additional, ...properties } = schema
23
47
 
24
- if (additional) this.#additionalProperties = getValidator(additional)
48
+ if (additional) this.additionalProperties = getValidator(additional)
25
49
 
26
50
  for (const key of Object.keys(properties)) {
27
51
  const definition = properties[key]
28
52
 
29
53
  if (definition === never) {
30
- this.#neverProperties.add(key)
54
+ this.properties.set(key, undefined)
31
55
  } else if (isModifier(definition)) {
32
- (definition.optional ? this.#optionalProperties : this.#requiredProperties)[key] = definition[modifierValidator]
56
+ this.properties.set(key, {
57
+ validator: definition[modifierValidator],
58
+ readonly: definition.readonly,
59
+ optional: definition.optional,
60
+ })
33
61
  } else {
34
- this.#requiredProperties[key] = getValidator(definition)
62
+ this.properties.set(key, { validator: getValidator(definition) })
35
63
  }
36
64
  }
37
65
 
@@ -46,22 +74,24 @@ export class ObjectValidator<S extends Schema> extends Validator<InferSchema<S>>
46
74
  const builder = new ValidationErrorBuilder()
47
75
  const clone: Record<string, any> = {}
48
76
 
49
- for (const [ key, validator ] of Object.entries(this.#requiredProperties)) {
50
- if (record[key] === undefined) {
51
- builder.record('Required property missing', key)
77
+ for (const [ key, property ] of this.properties.entries()) {
78
+ const { validator, optional } = property || {}
79
+
80
+ // no validator? this is "never" (forbidden)
81
+ if (! validator) {
82
+ if (record[key] === undefined) continue
83
+ if (options.stripForbiddenProperties) continue
84
+ builder.record('Forbidden property', key)
52
85
  continue
53
86
  }
54
87
 
55
- try {
56
- clone[key] = validator.validate(record[key], options)
57
- } catch (error) {
58
- builder.record(error, key)
88
+ // no value? might be optional, but definitely not validated
89
+ if (record[key] === undefined) {
90
+ if (! optional) builder.record('Required property missing', key)
91
+ continue
59
92
  }
60
- }
61
-
62
- for (const [ key, validator ] of Object.entries(this.#optionalProperties)) {
63
- if (record[key] === undefined) continue
64
93
 
94
+ // all the rest gets validated normally
65
95
  try {
66
96
  clone[key] = validator.validate(record[key], options)
67
97
  } catch (error) {
@@ -69,19 +99,8 @@ export class ObjectValidator<S extends Schema> extends Validator<InferSchema<S>>
69
99
  }
70
100
  }
71
101
 
72
- for (const key of this.#neverProperties) {
73
- if (record[key] === undefined) continue
74
- if (options.stripForbiddenProperties) continue
75
- builder.record('Forbidden property', key)
76
- }
77
-
78
- const additional = this.#additionalProperties
79
- const additionalKeys = Object.keys(record).filter((k) => {
80
- if (k in this.#requiredProperties) return false
81
- if (k in this.#optionalProperties) return false
82
- if (this.#neverProperties.has(k)) return false
83
- return true
84
- })
102
+ const additionalKeys = Object.keys(record).filter((k) => !this.properties.has(k))
103
+ const additional = this.additionalProperties
85
104
 
86
105
  if (additional) {
87
106
  additionalKeys.forEach((key) => {
@@ -102,23 +121,23 @@ export class ObjectValidator<S extends Schema> extends Validator<InferSchema<S>>
102
121
  }
103
122
  }
104
123
 
105
- /** Validate _any_ `object` */
106
- const anyObjectValidator = new class extends Validator<Record<string, any>> {
107
- validate(value: unknown): Record<string, any> {
108
- assertValidation(typeof value == 'object', 'Value is not an "object"')
109
- assertValidation(value !== null, 'Value is "null"')
110
- return value
111
- }
112
- }
124
+ const anyObjectValidator = new AnyObjectValidator()
113
125
 
114
- function _object(): Validator<Record<string, any>>
115
- function _object<S extends Schema>(schema: S): S
116
- function _object(schema?: Schema): Validator<Record<string, any>> | Schema {
126
+ export function _object(): Validator<Record<string, any>>
127
+ export function _object<S extends Schema>(schema: S): S & {
128
+ [Symbol.iterator](): Generator<TupleRestParameter<InferSchema<S>>>
129
+ }
130
+ export function _object(schema?: Schema): Validator<Record<string, any>> | Schema {
117
131
  if (! schema) return anyObjectValidator
118
132
 
119
- return Object.defineProperty(schema, schemaValidator, {
120
- value: new ObjectValidator(schema),
121
- enumerable: false,
133
+ const validator = new ObjectValidator(schema)
134
+ function* iterator(): Generator<TupleRestParameter> {
135
+ yield { [restValidator]: validator }
136
+ }
137
+
138
+ return Object.defineProperties(schema, {
139
+ [schemaValidator]: { value: validator, enumerable: false },
140
+ [Symbol.iterator]: { value: iterator, enumerable: false },
122
141
  })
123
142
  }
124
143
 
@@ -1,4 +1,4 @@
1
- import { Validator } from '../types'
1
+ import { Branding, Validator } from '../types'
2
2
  import { assertValidation, assertSchema } from '../errors'
3
3
  import { makeTupleRestIterable } from './tuple'
4
4
 
@@ -12,11 +12,26 @@ export interface StringConstraints {
12
12
  pattern?: RegExp,
13
13
  }
14
14
 
15
- /** A `Validator` validating `string`s. */
15
+ /** Constraints to validate a `string` with extra branding information. */
16
+ export interface BrandedStringConstraints<B extends string> extends StringConstraints {
17
+ /** The _brand_ of the string (will generate a `__brand_${B}` type property */
18
+ brand: B
19
+ }
20
+
21
+ /** A `Validator` validating any `string`. */
22
+ export class AnyStringValidator extends Validator<string> {
23
+ validate(value: unknown): string {
24
+ assertValidation(typeof value == 'string', 'Value is not a "string"')
25
+ return value
26
+ }
27
+ }
28
+
29
+ /** A `Validator` validating `string`s with constraints. */
16
30
  export class StringValidator<S extends string = string> extends Validator<S> {
17
31
  readonly maxLength: number
18
32
  readonly minLength: number
19
33
  readonly pattern?: RegExp
34
+ readonly brand?: string
20
35
 
21
36
  constructor(constraints: StringConstraints = {}) {
22
37
  super()
@@ -27,6 +42,8 @@ export class StringValidator<S extends string = string> extends Validator<S> {
27
42
  pattern,
28
43
  } = constraints
29
44
 
45
+ if ('brand' in constraints) this.brand = (<any> constraints).brand
46
+
30
47
  assertSchema(minLength >= 0, `Constraint "minLength" (${minLength}) must be non-negative`)
31
48
  assertSchema(maxLength >= 0, `Constraint "maxLength" (${maxLength}) must be non-negative`)
32
49
  assertSchema(minLength <= maxLength, `Constraint "minLength" (${minLength}) is greater than "maxLength" (${maxLength})`)
@@ -52,17 +69,14 @@ export class StringValidator<S extends string = string> extends Validator<S> {
52
69
  }
53
70
  }
54
71
 
55
- const anyStringValidator = new class extends Validator<string> {
56
- validate(value: unknown): string {
57
- assertValidation(typeof value == 'string', 'Value is not a "string"')
58
- return value
59
- }
60
- }
72
+ const anyStringValidator = new AnyStringValidator()
61
73
 
62
- function _string(): Validator<string>
63
- function _string<S extends string = string>(constraints?: StringConstraints): StringValidator<S>
74
+ export function _string(): Validator<string>
75
+ export function _string(constraints?: StringConstraints): StringValidator<string>
76
+ export function _string<S extends string>(constraints?: StringConstraints): StringValidator<S>
77
+ export function _string<B extends string>(constraints: BrandedStringConstraints<B>): StringValidator<string & Branding<B>>
64
78
 
65
- function _string(constraints?: StringConstraints): Validator<string> {
79
+ export function _string(constraints?: StringConstraints): Validator<string> {
66
80
  return constraints ? new StringValidator(constraints) : anyStringValidator
67
81
  }
68
82
 
@@ -4,32 +4,36 @@ import { assertValidation, ValidationError } from '../errors'
4
4
  import { getValidator } from '../utilities'
5
5
  import { nullValidator } from './constant'
6
6
 
7
+ export interface TupleMember { single: boolean, validator: Validator }
8
+
7
9
  /** A `Validator` for _tuples_. */
8
10
  export class TupleValidator<T extends Tuple> extends Validator<InferTuple<T>> {
11
+ readonly members: readonly TupleMember[]
9
12
  readonly tuple: T
10
13
 
11
- #validators: ({ single: boolean, validator: Validator })[] = []
12
-
13
14
  constructor(tuple: T) {
14
15
  super()
15
16
 
16
- this.tuple = tuple
17
+ const members: TupleMember[] = []
17
18
  for (const item of tuple) {
18
19
  if (item === null) { // god knows why typeof null === "object"
19
- this.#validators.push({ single: true, validator: nullValidator })
20
+ members.push({ single: true, validator: nullValidator })
20
21
  } else if ((typeof item === 'object') && (restValidator in item)) {
21
- this.#validators.push({ single: false, validator: (<any>item)[restValidator] })
22
+ members.push({ single: false, validator: (<any>item)[restValidator] })
22
23
  } else {
23
- this.#validators.push({ single: true, validator: getValidator(item) })
24
+ members.push({ single: true, validator: getValidator(item) })
24
25
  }
25
26
  }
27
+
28
+ this.members = members
29
+ this.tuple = tuple
26
30
  }
27
31
 
28
32
  validate(value: unknown, options: ValidationOptions): InferTuple<T> {
29
33
  assertValidation(Array.isArray(value), 'Value is not an "array"')
30
34
 
31
35
  // Empty tuples
32
- if (this.#validators.length === 0) {
36
+ if (this.members.length === 0) {
33
37
  const size = value.length
34
38
  assertValidation(size === 0, `Found ${size} element${size === 1 ? '' : 's'} validating empty tuple`)
35
39
  return value as InferTuple<T>
@@ -39,24 +43,24 @@ export class TupleValidator<T extends Tuple> extends Validator<InferTuple<T>> {
39
43
  const clone = new Array(value.length)
40
44
  let needle = 0
41
45
  let haystack = 0
42
- let { single, validator } = this.#validators[needle]
46
+ let { single, validator } = this.members[needle]
43
47
 
44
- while ((needle < this.#validators.length) && (haystack < value.length)) {
48
+ while ((needle < this.members.length) && (haystack < value.length)) {
45
49
  try {
46
50
  clone[haystack] = validator.validate(value[haystack], options)
47
- if (single) ({ single, validator } = this.#validators[++ needle] || {})
51
+ if (single) ({ single, validator } = this.members[++ needle] || {})
48
52
  haystack ++
49
53
  } catch (error) {
50
54
  if (single) throw new ValidationError(error, [ haystack ])
51
- else ({ single, validator } = this.#validators[++ needle] || {})
55
+ else ({ single, validator } = this.members[++ needle] || {})
52
56
  }
53
57
  }
54
58
 
55
- while ((needle < this.#validators.length) && (this.#validators[needle].single === false)) {
59
+ while ((needle < this.members.length) && (this.members[needle].single === false)) {
56
60
  needle ++
57
61
  }
58
62
 
59
- const missing = this.#validators.length - needle
63
+ const missing = this.members.length - needle
60
64
  if ((missing === 1) && single) {
61
65
  throw new ValidationError('Tuple defines 1 missing validation')
62
66
  } else if (missing > 1) {
@@ -7,11 +7,11 @@ import {
7
7
  Validator,
8
8
  } from '../types'
9
9
 
10
- type UnionArguments = readonly [ Validation, ...Validation[] ]
10
+ export type UnionArguments = readonly [ Validation, ...Validation[] ]
11
11
 
12
12
  /* -------------------------------------------------------------------------- */
13
13
 
14
- type InferOneOfValidationType<A extends UnionArguments> =
14
+ export type InferOneOfValidationType<A extends UnionArguments> =
15
15
  A extends readonly [ infer First, ...infer Rest ] ?
16
16
  First extends Validation ?
17
17
  Rest extends UnionArguments ?
@@ -49,7 +49,7 @@ export function oneOf<A extends UnionArguments>(...args: A): OneOfValidator<A> {
49
49
 
50
50
  /* -------------------------------------------------------------------------- */
51
51
 
52
- type InferAllOfValidationType<A extends UnionArguments> =
52
+ export type InferAllOfValidationType<A extends UnionArguments> =
53
53
  A extends readonly [ infer First, ...infer Rest ] ?
54
54
  First extends Validation ?
55
55
  Rest extends UnionArguments ?
@@ -0,0 +1,140 @@
1
+ import { ConstantValidator } from './constant'
2
+ import { ValidationError, ValidationErrorBuilder } from '../errors'
3
+ import { Schema, Validator } from '../types'
4
+ import { makeTupleRestIterable } from './tuple'
5
+ import { ObjectValidator, ValidationOptions } from '..'
6
+
7
+ const KEYS: Exclude<keyof URLConstraints, 'searchParams'>[] = [
8
+ 'href',
9
+ 'origin',
10
+ 'protocol',
11
+ 'username',
12
+ 'password',
13
+ 'host',
14
+ 'hostname',
15
+ 'port',
16
+ 'pathname',
17
+ 'search',
18
+ 'hash',
19
+ ]
20
+
21
+ const OPTIONS: ValidationOptions = {
22
+ stripAdditionalProperties: false,
23
+ stripForbiddenProperties: false,
24
+ }
25
+
26
+ /** Constraints to validate a `URL` with. */
27
+ export interface URLConstraints {
28
+ /** Constraint to validate the `href` component of the `URL`. */
29
+ href?: string | Validator<string>,
30
+ /** Constraint to validate the `origin` component of the `URL`. */
31
+ origin?: string | Validator<string>,
32
+ /** Constraint to validate the `protocol` component of the `URL`. */
33
+ protocol?: string | Validator<string>,
34
+ /** Constraint to validate the `username` component of the `URL`. */
35
+ username?: string | Validator<string>,
36
+ /** Constraint to validate the `password` component of the `URL`. */
37
+ password?: string | Validator<string>,
38
+ /** Constraint to validate the `host` (`hostname:port`) component of the `URL`. */
39
+ host?: string | Validator<string>,
40
+ /** Constraint to validate the `hostname` component of the `URL`. */
41
+ hostname?: string | Validator<string>,
42
+ /** Constraint to validate the `port` component of the `URL`. */
43
+ port?: string | Validator<string>,
44
+ /** Constraint to validate the `pathname` component of the `URL`. */
45
+ pathname?: string | Validator<string>,
46
+ /** Constraint to validate the `search` component of the `URL` as a string. */
47
+ search?: string | Validator<string>,
48
+ /** Constraint to validate the `hash` component of the `URL`. */
49
+ hash?: string | Validator<string>,
50
+ /**
51
+ * Schema used to validate the `searchParams` component of the `URL`.
52
+ *
53
+ * The `searchParams` will be normalized in a `Record<string, string>`, where
54
+ * only the _first_ value associated with a search parameter will be checked.
55
+ */
56
+ searchParams?: Schema,
57
+ }
58
+
59
+ /** A `Validator` validating URLs and converting them to `URL` instances. */
60
+ export class URLValidator extends Validator<URL> {
61
+ readonly href?: Validator<string>
62
+ readonly origin?: Validator<string>
63
+ readonly protocol?: Validator<string>
64
+ readonly username?: Validator<string>
65
+ readonly password?: Validator<string>
66
+ readonly host?: Validator<string>
67
+ readonly hostname?: Validator<string>
68
+ readonly port?: Validator<string>
69
+ readonly pathname?: Validator<string>
70
+ readonly search?: Validator<string>
71
+ readonly hash?: Validator<string>
72
+
73
+ readonly searchParams?: ObjectValidator<Schema>
74
+
75
+ constructor(constraints: URLConstraints = {}) {
76
+ super()
77
+
78
+ for (const key of KEYS) {
79
+ const constraint = constraints[key]
80
+ if (typeof constraint === 'string') {
81
+ this[key] = new ConstantValidator(constraint)
82
+ } else if (constraint) {
83
+ this[key] = constraint
84
+ }
85
+ }
86
+
87
+ if (constraints.searchParams) {
88
+ this.searchParams = new ObjectValidator(constraints.searchParams)
89
+ }
90
+ }
91
+
92
+ validate(value: unknown): URL {
93
+ let url: URL
94
+ try {
95
+ url = value instanceof URL ? value : new URL(value as any)
96
+ } catch (error) {
97
+ throw new ValidationError('Value could not be converted to a "URL"')
98
+ }
99
+
100
+ const builder = new ValidationErrorBuilder()
101
+
102
+ for (const key of KEYS) {
103
+ const validator = this[key]
104
+ if (validator) {
105
+ try {
106
+ validator.validate(url[key], OPTIONS)
107
+ } catch (error) {
108
+ builder.record(error, key)
109
+ }
110
+ }
111
+ }
112
+
113
+ if (this.searchParams) {
114
+ const parameters: Record<string, string> = {}
115
+ for (const param of url.searchParams.keys()) {
116
+ parameters[param] = url.searchParams.get(param) as string
117
+ }
118
+
119
+ try {
120
+ this.searchParams.validate(parameters, OPTIONS)
121
+ } catch (error) {
122
+ builder.record(error, 'searchParams')
123
+ }
124
+ }
125
+
126
+ return builder.assert(url)
127
+ }
128
+ }
129
+
130
+ const anyURLValidator = new URLValidator()
131
+
132
+ export function _url(): URLValidator
133
+ export function _url(constraints: URLConstraints): URLValidator
134
+
135
+ export function _url(constraints?: URLConstraints): URLValidator {
136
+ return constraints ? new URLValidator(constraints) : anyURLValidator
137
+ }
138
+
139
+ /** Validate URLs and convert them to `URL` instances. */
140
+ export const url = makeTupleRestIterable(_url)
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/index.ts", "../src/errors.ts", "../src/types.ts", "../src/validators/any.ts", "../src/validators/constant.ts", "../src/validators/tuple.ts", "../src/validators/object.ts", "../src/utilities.ts", "../src/schema.ts", "../src/validators/union.ts", "../src/validators/array.ts", "../src/validators/boolean.ts", "../src/validators/date.ts", "../src/validators/number.ts", "../src/validators/string.ts"],
4
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,sBAAsB,MAAmC;AACvD,SAAO,KAAK,OAAO,CAAC,SAAgB,KAAK,UAAkB;AACzD,QAAI,OAAO,QAAQ;AAAU,aAAO,GAAG,WAAU;AACjD,WAAO,UAAU,IAAI,MAAM,GAAG,WAAU;AAAA,KACvC;AAAA;AAME,oCAA8B,MAAM;AAAA,EAEhC;AAAA,EAEA;AAAA,EAaT,YACI,gBACA,mBACA,kBACF;AACA,QAAI;AACJ,QAAI;AAEJ,QAAI,0BAA0B,wBAAwB;AACpD,eAAS,eAAe;AACxB,oBAAc,eAAe;AAAA,WACxB;AACL,YAAM,OAAO,MAAM,QAAQ,qBAAqB,oBAAoB;AAEpE,UAAI,0BAA0B,iBAAiB;AAC7C,iBAAS,eAAe,OAAO,IAAI,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