@clementine-solutions/jane-io 1.0.0 → 1.0.1
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/README.md +132 -1
- package/dist/core/analysis/diff.d.ts +35 -0
- package/dist/core/analysis/explain.d.ts +35 -0
- package/dist/core/analysis/index.d.ts +14 -0
- package/dist/core/analysis/replay.d.ts +34 -0
- package/dist/core/analysis/telemetry.d.ts +28 -0
- package/dist/core/boundary-rules/at-most-one.d.ts +17 -0
- package/dist/core/boundary-rules/conditionally-required.d.ts +18 -0
- package/dist/core/boundary-rules/date-range.d.ts +17 -0
- package/dist/core/boundary-rules/index.d.ts +18 -0
- package/dist/core/boundary-rules/mutually-exclusive.d.ts +16 -0
- package/dist/core/boundary-rules/no-unknown-fields.d.ts +17 -0
- package/dist/core/boundary-rules/require-all.d.ts +16 -0
- package/dist/core/boundary-rules/require-one.d.ts +17 -0
- package/dist/core/common/events.d.ts +37 -0
- package/dist/core/common/fluent.d.ts +151 -0
- package/dist/core/common/index.d.ts +16 -0
- package/dist/core/common/policy.d.ts +170 -0
- package/dist/core/common/utilities.d.ts +59 -0
- package/dist/core/common/wildcard.d.ts +27 -0
- package/dist/core/field-path/construct.d.ts +77 -0
- package/dist/core/field-path/format.d.ts +41 -0
- package/dist/core/field-path/index.d.ts +14 -0
- package/dist/core/field-path/utilities.d.ts +85 -0
- package/dist/core/field-path/walk.d.ts +36 -0
- package/dist/core/fluent-registry.d.ts +138 -0
- package/dist/core/normalizers/array/compact-sparse-array.d.ts +22 -0
- package/dist/core/normalizers/array/flatten-one-level.d.ts +17 -0
- package/dist/core/normalizers/array/remove-empty-string-items.d.ts +6 -0
- package/dist/core/normalizers/array/remove-null-items.d.ts +16 -0
- package/dist/core/normalizers/array/remove-undefined-items.d.ts +16 -0
- package/dist/core/normalizers/date/invalid-date-to-undefined.d.ts +17 -0
- package/dist/core/normalizers/index.d.ts +28 -0
- package/dist/core/normalizers/normalizer-register.d.ts +17 -0
- package/dist/core/normalizers/number/infinity-to-undefined.d.ts +18 -0
- package/dist/core/normalizers/number/nan-to-undefined.d.ts +17 -0
- package/dist/core/normalizers/number/normalize-negative-zero.d.ts +16 -0
- package/dist/core/normalizers/object/remove-empty-array-keys.d.ts +17 -0
- package/dist/core/normalizers/object/remove-empty-object-keys.d.ts +16 -0
- package/dist/core/normalizers/object/remove-empty-string-keys.d.ts +16 -0
- package/dist/core/normalizers/object/remove-null-keys.d.ts +16 -0
- package/dist/core/normalizers/object/remove-undefined-keys.d.ts +16 -0
- package/dist/core/normalizers/string/collapse-whitespace.d.ts +17 -0
- package/dist/core/normalizers/string/empty-to-undefined.d.ts +16 -0
- package/dist/core/normalizers/string/trim.d.ts +16 -0
- package/dist/core/parsers/index.d.ts +22 -0
- package/dist/core/parsers/parse-array-string.d.ts +16 -0
- package/dist/core/parsers/parse-bigint-string.d.ts +16 -0
- package/dist/core/parsers/parse-binary-string.d.ts +16 -0
- package/dist/core/parsers/parse-boolean-string.d.ts +16 -0
- package/dist/core/parsers/parse-date-string.d.ts +16 -0
- package/dist/core/parsers/parse-duration-string.d.ts +16 -0
- package/dist/core/parsers/parse-hex-string.d.ts +16 -0
- package/dist/core/parsers/parse-integer-string.d.ts +16 -0
- package/dist/core/parsers/parse-json-string.d.ts +17 -0
- package/dist/core/parsers/parse-numeric-string.d.ts +16 -0
- package/dist/core/parsers/parse-object-string.d.ts +16 -0
- package/dist/core/parsers/parse-octal-string.d.ts +16 -0
- package/dist/core/parsers/parse-scientific-notation-string.d.ts +16 -0
- package/dist/core/parsers/parse-url-string.d.ts +16 -0
- package/dist/core/pipeline/boundary.d.ts +36 -0
- package/dist/core/pipeline/contain.d.ts +122 -0
- package/dist/core/pipeline/index.d.ts +16 -0
- package/dist/core/pipeline/normalize.d.ts +34 -0
- package/dist/core/pipeline/parse.d.ts +40 -0
- package/dist/core/pipeline/pipeline.d.ts +23 -0
- package/dist/core/pipeline/scan.d.ts +46 -0
- package/dist/core/pipeline/validate.d.ts +40 -0
- package/dist/core/scanners/any/scan-for-sentinels.d.ts +19 -0
- package/dist/core/scanners/array/array-is-deep.d.ts +19 -0
- package/dist/core/scanners/array/array-is-heterogenous.d.ts +18 -0
- package/dist/core/scanners/array/array-is-large.d.ts +19 -0
- package/dist/core/scanners/bigint/bigint-is-large.d.ts +20 -0
- package/dist/core/scanners/bigint/bigint-not-safe.d.ts +20 -0
- package/dist/core/scanners/date/date-is-before-epoch.d.ts +19 -0
- package/dist/core/scanners/date/date-is-far-future.d.ts +19 -0
- package/dist/core/scanners/date/date-is-invalid.d.ts +19 -0
- package/dist/core/scanners/index.d.ts +31 -0
- package/dist/core/scanners/number/number-is-infinite.d.ts +19 -0
- package/dist/core/scanners/number/number-is-nan.d.ts +19 -0
- package/dist/core/scanners/number/number-is-too-large.d.ts +20 -0
- package/dist/core/scanners/number/number-is-unsafe-integer.d.ts +19 -0
- package/dist/core/scanners/object/object-has-circular-references.d.ts +20 -0
- package/dist/core/scanners/object/object-has-many-keys.d.ts +19 -0
- package/dist/core/scanners/object/object-is-deep.d.ts +20 -0
- package/dist/core/scanners/scanner-registry.d.ts +19 -0
- package/dist/core/scanners/string/string-has-unsafe-unicode.d.ts +19 -0
- package/dist/core/scanners/string/string-has-whitespace-edges.d.ts +19 -0
- package/dist/core/scanners/string/string-is-long.d.ts +19 -0
- package/dist/core/scanners/unknown/unknown-not-scannable.d.ts +21 -0
- package/dist/core/shapes/analysis.d.ts +239 -0
- package/dist/core/shapes/boundary.d.ts +126 -0
- package/dist/core/shapes/events.d.ts +83 -0
- package/dist/core/shapes/field-path.d.ts +51 -0
- package/dist/core/shapes/index.d.ts +21 -0
- package/dist/core/shapes/normalize.d.ts +59 -0
- package/dist/core/shapes/parse.d.ts +75 -0
- package/dist/core/shapes/pipeline.d.ts +149 -0
- package/dist/core/shapes/policy.d.ts +158 -0
- package/dist/core/shapes/public.d.ts +92 -0
- package/dist/core/shapes/scan.d.ts +126 -0
- package/dist/core/shapes/validate.d.ts +65 -0
- package/dist/core/validators/array/array-max-items.d.ts +25 -0
- package/dist/core/validators/array/array-min-items.d.ts +25 -0
- package/dist/core/validators/array/array.d.ts +22 -0
- package/dist/core/validators/array/excludes.d.ts +25 -0
- package/dist/core/validators/array/has-unique-items.d.ts +24 -0
- package/dist/core/validators/array/includes.d.ts +24 -0
- package/dist/core/validators/array/items-equal.d.ts +25 -0
- package/dist/core/validators/array/no-empty-string-items.d.ts +24 -0
- package/dist/core/validators/array/no-null-items.d.ts +24 -0
- package/dist/core/validators/array/no-undefined-items.d.ts +24 -0
- package/dist/core/validators/array/non-empty-array.d.ts +24 -0
- package/dist/core/validators/array/not-sparse.d.ts +25 -0
- package/dist/core/validators/bigint/bigint-equals.d.ts +24 -0
- package/dist/core/validators/bigint/bigint-max.d.ts +25 -0
- package/dist/core/validators/bigint/bigint-min.d.ts +25 -0
- package/dist/core/validators/bigint/bigint-negative.d.ts +23 -0
- package/dist/core/validators/bigint/bigint-non-negative.d.ts +24 -0
- package/dist/core/validators/bigint/bigint-non-positive.d.ts +24 -0
- package/dist/core/validators/bigint/bigint-positive.d.ts +24 -0
- package/dist/core/validators/bigint/bigint-safe.d.ts +25 -0
- package/dist/core/validators/bigint/bigint.d.ts +20 -0
- package/dist/core/validators/boolean/boolean.d.ts +21 -0
- package/dist/core/validators/boolean/is-false.d.ts +22 -0
- package/dist/core/validators/boolean/is-true.d.ts +22 -0
- package/dist/core/validators/common/is-country-code.d.ts +17 -0
- package/dist/core/validators/common/is-currency-code.d.ts +17 -0
- package/dist/core/validators/common/is-email-strict.d.ts +17 -0
- package/dist/core/validators/common/is-email.d.ts +17 -0
- package/dist/core/validators/common/is-ip.d.ts +17 -0
- package/dist/core/validators/common/is-phone-strict.d.ts +17 -0
- package/dist/core/validators/common/is-phone.d.ts +17 -0
- package/dist/core/validators/common/is-port.d.ts +17 -0
- package/dist/core/validators/common/is-postal-code.d.ts +17 -0
- package/dist/core/validators/common/is-url.d.ts +17 -0
- package/dist/core/validators/common/is-uuid.d.ts +17 -0
- package/dist/core/validators/date/before-epoch.d.ts +28 -0
- package/dist/core/validators/date/date-now-required.d.ts +22 -0
- package/dist/core/validators/date/is-date.d.ts +21 -0
- package/dist/core/validators/date/is-far-future.d.ts +23 -0
- package/dist/core/validators/date/is-future.d.ts +24 -0
- package/dist/core/validators/date/is-past.d.ts +24 -0
- package/dist/core/validators/date/not-after.d.ts +25 -0
- package/dist/core/validators/date/not-before.d.ts +25 -0
- package/dist/core/validators/date/same-day.d.ts +25 -0
- package/dist/core/validators/date/same-month.d.ts +25 -0
- package/dist/core/validators/date/same-year.d.ts +24 -0
- package/dist/core/validators/date/too-early.d.ts +25 -0
- package/dist/core/validators/date/too-late.d.ts +25 -0
- package/dist/core/validators/date/weekday.d.ts +32 -0
- package/dist/core/validators/date/weekend.d.ts +27 -0
- package/dist/core/validators/index.d.ts +112 -0
- package/dist/core/validators/nullish/is-null-or-undefined.d.ts +22 -0
- package/dist/core/validators/nullish/is-null.d.ts +21 -0
- package/dist/core/validators/nullish/is-undefined.d.ts +21 -0
- package/dist/core/validators/number/finite.d.ts +22 -0
- package/dist/core/validators/number/integer.d.ts +22 -0
- package/dist/core/validators/number/less-than.d.ts +21 -0
- package/dist/core/validators/number/max.d.ts +21 -0
- package/dist/core/validators/number/min.d.ts +21 -0
- package/dist/core/validators/number/more-than.d.ts +21 -0
- package/dist/core/validators/number/negative.d.ts +20 -0
- package/dist/core/validators/number/non-negative.d.ts +19 -0
- package/dist/core/validators/number/non-positive.d.ts +19 -0
- package/dist/core/validators/number/number.d.ts +19 -0
- package/dist/core/validators/number/positive.d.ts +20 -0
- package/dist/core/validators/number/safe-integer.d.ts +19 -0
- package/dist/core/validators/object/deep-equals.d.ts +24 -0
- package/dist/core/validators/object/has-key.d.ts +23 -0
- package/dist/core/validators/object/has-value.d.ts +27 -0
- package/dist/core/validators/object/keys-equal.d.ts +26 -0
- package/dist/core/validators/object/max-keys.d.ts +24 -0
- package/dist/core/validators/object/min-keys.d.ts +24 -0
- package/dist/core/validators/object/missing-key.d.ts +23 -0
- package/dist/core/validators/object/no-empty-array-values.d.ts +23 -0
- package/dist/core/validators/object/no-empty-object-values.d.ts +23 -0
- package/dist/core/validators/object/no-null-values.d.ts +23 -0
- package/dist/core/validators/object/no-undefined-values.d.ts +23 -0
- package/dist/core/validators/object/non-empty-object.d.ts +21 -0
- package/dist/core/validators/object/only-keys.d.ts +23 -0
- package/dist/core/validators/object/plain-object.d.ts +22 -0
- package/dist/core/validators/string/alpha-num.d.ts +23 -0
- package/dist/core/validators/string/alpha.d.ts +24 -0
- package/dist/core/validators/string/chars-equal.d.ts +23 -0
- package/dist/core/validators/string/ends-with.d.ts +23 -0
- package/dist/core/validators/string/is-ascii.d.ts +24 -0
- package/dist/core/validators/string/is-printable.d.ts +25 -0
- package/dist/core/validators/string/matches.d.ts +23 -0
- package/dist/core/validators/string/max-length.d.ts +24 -0
- package/dist/core/validators/string/min-length.d.ts +24 -0
- package/dist/core/validators/string/no-lead-space.d.ts +23 -0
- package/dist/core/validators/string/no-repeat-space.d.ts +25 -0
- package/dist/core/validators/string/no-space.d.ts +24 -0
- package/dist/core/validators/string/no-trail-space.d.ts +23 -0
- package/dist/core/validators/string/non-empty.d.ts +22 -0
- package/dist/core/validators/string/not-one-of.d.ts +24 -0
- package/dist/core/validators/string/num-string.d.ts +23 -0
- package/dist/core/validators/string/one-of.d.ts +23 -0
- package/dist/core/validators/string/starts-with.d.ts +23 -0
- package/dist/core/validators/string/string.d.ts +21 -0
- package/dist/core/validators/string/trimmed.d.ts +24 -0
- package/dist/index.d.ts +83 -0
- package/dist/test.d.ts +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Maximum Keys (Max Keys)
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that a plain object contains no more than a
|
|
7
|
+
* specified number of keys.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validate that a plain object contains no more than a specified number of keys.
|
|
14
|
+
*
|
|
15
|
+
* This rule accepts only JSON-compatible plain objects (prototype === Object.prototype).
|
|
16
|
+
* Arrays, null, class instances, Maps, Sets, Dates, and other non-plain objects are rejected.
|
|
17
|
+
*
|
|
18
|
+
* If the value is not a plain object, an object.not.plain-object event is emitted.
|
|
19
|
+
* If the object contains more than the allowed number of keys, an object.too.many-keys
|
|
20
|
+
* event is emitted.
|
|
21
|
+
*
|
|
22
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
23
|
+
*/
|
|
24
|
+
export declare const maxKeys: (maximum: number) => ValidationRule;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Minimum Keys (Min Keys)
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that a plain object contains at least a specified
|
|
7
|
+
* number of keys.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validate that a plain object contains at least a specified number of keys.
|
|
14
|
+
*
|
|
15
|
+
* This rule accepts only JSON-compatible plain objects (prototype === Object.prototype).
|
|
16
|
+
* Arrays, null, class instances, Maps, Sets, Dates, and other non-plain objects are rejected.
|
|
17
|
+
*
|
|
18
|
+
* If the value is not a plain object, an object.not.plain-object event is emitted.
|
|
19
|
+
* If the object contains fewer than the required number of keys, an object.too.few-keys
|
|
20
|
+
* event is emitted.
|
|
21
|
+
*
|
|
22
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
23
|
+
*/
|
|
24
|
+
export declare const minKeys: (minimum: number) => ValidationRule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Missing Keys
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that a plain object contains all required own
|
|
7
|
+
* enumerable keys.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validate that a plain object contains all required own enumerable keys.
|
|
14
|
+
*
|
|
15
|
+
* This rule accepts only JSON-compatible plain objects (prototype === Object.prototype).
|
|
16
|
+
* Arrays, null, class instances, Maps, Sets, Dates, and other non-plain objects are rejected.
|
|
17
|
+
*
|
|
18
|
+
* If the value is not a plain object, an object.not.plain-object event is emitted.
|
|
19
|
+
* If one or more required keys are missing, an object.missing-keys event is emitted.
|
|
20
|
+
*
|
|
21
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
22
|
+
*/
|
|
23
|
+
export declare const missingKey: (requiredKeys: readonly string[]) => ValidationRule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | No Empty Array Values
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that a plain object does not contain any empty
|
|
7
|
+
* array values.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validate that a plain object does not contain any empty array values.
|
|
14
|
+
*
|
|
15
|
+
* This rule accepts only JSON-compatible plain objects (prototype === Object.prototype).
|
|
16
|
+
* Arrays, null, class instances, Maps, Sets, Dates, and other non-plain objects are rejected.
|
|
17
|
+
*
|
|
18
|
+
* Each own enumerable property is inspected. If any property value is an array with length 0,
|
|
19
|
+
* an object.empty-array-value event is emitted.
|
|
20
|
+
*
|
|
21
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
22
|
+
*/
|
|
23
|
+
export declare const noEmptyArrayValues: ValidationRule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | No Empty Object Values
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that a plain object does not contain any empty
|
|
7
|
+
* plain-object values.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validate that a plain object does not contain any empty plain-object values.
|
|
14
|
+
*
|
|
15
|
+
* This rule accepts only JSON-compatible plain objects (prototype === Object.prototype).
|
|
16
|
+
* Arrays, null, class instances, Maps, Sets, Dates, and other non-plain objects are rejected.
|
|
17
|
+
*
|
|
18
|
+
* Each own enumerable property is inspected. If any property value is a plain object
|
|
19
|
+
* with zero keys, an object.empty-object-value event is emitted.
|
|
20
|
+
*
|
|
21
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
22
|
+
*/
|
|
23
|
+
export declare const noEmptyObjectValues: ValidationRule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | No Null Values
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that a plain object does not contain any null
|
|
7
|
+
* values.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validate that a plain object does not contain any null values.
|
|
14
|
+
*
|
|
15
|
+
* This rule accepts only JSON-compatible plain objects (prototype === Object.prototype).
|
|
16
|
+
* Arrays, null, class instances, Maps, Sets, Dates, and other non-plain objects are rejected.
|
|
17
|
+
*
|
|
18
|
+
* Each own enumerable property is inspected. If any property value is null,
|
|
19
|
+
* an object.null-value event is emitted.
|
|
20
|
+
*
|
|
21
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
22
|
+
*/
|
|
23
|
+
export declare const noNullValues: ValidationRule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | No Undefined Values
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that a plain object does not contain any
|
|
7
|
+
* undefined values.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validate that a plain object does not contain any undefined values.
|
|
14
|
+
*
|
|
15
|
+
* This rule accepts only JSON-compatible plain objects (prototype === Object.prototype).
|
|
16
|
+
* Arrays, null, class instances, Maps, Sets, Dates, and other non-plain objects are rejected.
|
|
17
|
+
*
|
|
18
|
+
* Each own enumerable property is inspected. If any property value is undefined,
|
|
19
|
+
* an object.undefined-value event is emitted.
|
|
20
|
+
*
|
|
21
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
22
|
+
*/
|
|
23
|
+
export declare const noUndefinedValues: ValidationRule;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Non-Empty Object
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that a plain object is not empty.
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
import type { ValidationRule } from '../../shapes';
|
|
11
|
+
/**
|
|
12
|
+
* Validate that a plain object is not empty.
|
|
13
|
+
*
|
|
14
|
+
* This rule accepts only JSON-compatible plain objects (prototype === Object.prototype).
|
|
15
|
+
* Arrays, null, class instances, Maps, Sets, Dates, and other non-plain objects are rejected.
|
|
16
|
+
*
|
|
17
|
+
* If the object contains zero own enumerable keys, an object.empty-object event is emitted.
|
|
18
|
+
*
|
|
19
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
20
|
+
*/
|
|
21
|
+
export declare const nonEmptyObject: ValidationRule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Only Keys
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that a plain object contains only the allowed keys.
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
import type { ValidationRule } from '../../shapes';
|
|
11
|
+
/**
|
|
12
|
+
* Validate that a plain object contains only the allowed keys.
|
|
13
|
+
*
|
|
14
|
+
* This rule accepts only JSON-compatible plain objects (prototype === Object.prototype).
|
|
15
|
+
* Arrays, null, class instances, Maps, Sets, Dates, and other non-plain objects
|
|
16
|
+
* are rejected.
|
|
17
|
+
*
|
|
18
|
+
* If the object contains any keys not included in the allowed list,
|
|
19
|
+
* an object.has.extra-keys event is emitted.
|
|
20
|
+
*
|
|
21
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
22
|
+
*/
|
|
23
|
+
export declare const onlyKeys: (allowed: readonly string[]) => ValidationRule;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Object
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that the value is a JSON-compatible plain object.
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
import type { ValidationRule } from '../../shapes';
|
|
11
|
+
/**
|
|
12
|
+
* Validate that the value is a JSON-compatible plain object.
|
|
13
|
+
*
|
|
14
|
+
* This rule accepts only plain objects (prototype === Object.prototype).
|
|
15
|
+
* Arrays, null, class instances, Maps, Sets, Dates, and other non-plain objects
|
|
16
|
+
* are rejected.
|
|
17
|
+
*
|
|
18
|
+
* If the value is not a plain object, an object.not.plain-object event is emitted.
|
|
19
|
+
*
|
|
20
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
21
|
+
*/
|
|
22
|
+
export declare const plainObject: ValidationRule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Alpha-Numeric (Alpha Num)
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is a string containing only ASCII
|
|
7
|
+
* letters and digits.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validates that the value is a string containing only ASCII letters and digits.
|
|
14
|
+
*
|
|
15
|
+
* - Non‑string values emit `type.not.valid`.
|
|
16
|
+
* - Strings containing characters outside `[A-Za-z0-9]` emit `string.not.alphanumeric`.
|
|
17
|
+
* - Returns an empty array when the value is valid.
|
|
18
|
+
*
|
|
19
|
+
* This rule is pure, total, async‑compatible, and returns a readonly array of
|
|
20
|
+
* JaneEvent objects. It preserves the provided path and supports userMessage
|
|
21
|
+
* overrides applied at the pipeline level.
|
|
22
|
+
*/
|
|
23
|
+
export declare const alphaNum: ValidationRule;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Alphabetic (Alpha)
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is a string containing only ASCII
|
|
7
|
+
* alphabetic characters (`A–Z` and `a–z`).
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validates that the value is a string containing only ASCII alphabetic
|
|
14
|
+
* characters (`A–Z` and `a–z`).
|
|
15
|
+
*
|
|
16
|
+
* - Non‑string values emit `type.not.valid`.
|
|
17
|
+
* - Strings containing characters outside `[A-Za-z]` emit `string.not.alpha`.
|
|
18
|
+
* - Returns an empty array when the value is valid.
|
|
19
|
+
*
|
|
20
|
+
* This rule is pure, total, async‑compatible, and returns a readonly array of
|
|
21
|
+
* JaneEvent objects. It preserves the provided path and supports userMessage
|
|
22
|
+
* overrides applied at the pipeline level.
|
|
23
|
+
*/
|
|
24
|
+
export declare const alpha: ValidationRule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Characters Equal (Chars Equal)
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is a string whose length is
|
|
7
|
+
* exactly `exact`.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validates that the value is a string whose length is exactly `exact`.
|
|
14
|
+
*
|
|
15
|
+
* - Non‑string values emit `type.not.valid`.
|
|
16
|
+
* - Strings whose length does not match `exact` emit `string.has.invalid-length`.
|
|
17
|
+
* - Returns an empty array when the value is valid.
|
|
18
|
+
*
|
|
19
|
+
* This rule is pure, total, async‑compatible, and returns a readonly array of
|
|
20
|
+
* JaneEvent objects. It preserves the provided path and supports userMessage
|
|
21
|
+
* overrides applied at the pipeline level.
|
|
22
|
+
*/
|
|
23
|
+
export declare const charsEqual: (exact: number) => ValidationRule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Ends With
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is a string ending with the
|
|
7
|
+
* provided `suffix`.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validates that the value is a string ending with the provided `suffix`.
|
|
14
|
+
*
|
|
15
|
+
* - Non‑string values emit `string.not.string`.
|
|
16
|
+
* - Strings that do not end with `suffix` emit `string.must.end-with`.
|
|
17
|
+
* - Returns an empty array when the value is valid.
|
|
18
|
+
*
|
|
19
|
+
* This rule is pure, total, async‑compatible, and returns a readonly array of
|
|
20
|
+
* JaneEvent objects. It preserves the provided path and supports userMessage
|
|
21
|
+
* overrides applied at the pipeline level.
|
|
22
|
+
*/
|
|
23
|
+
export declare const endsWith: (suffix: string) => ValidationRule;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Is Ascii
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is a string containing only ASCII
|
|
7
|
+
* characters (code points 0x00–0x7F).
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validates that the value is a string containing only ASCII characters
|
|
14
|
+
* (code points 0x00–0x7F).
|
|
15
|
+
*
|
|
16
|
+
* - Non‑string values emit `string.not.string`.
|
|
17
|
+
* - Strings containing characters outside the ASCII range emit `string.not.ascii`.
|
|
18
|
+
* - Returns an empty array when the value is valid.
|
|
19
|
+
*
|
|
20
|
+
* This rule is pure, total, async‑compatible, and returns a readonly array of
|
|
21
|
+
* JaneEvent objects. It preserves the provided path and supports userMessage
|
|
22
|
+
* overrides applied at the pipeline level.
|
|
23
|
+
*/
|
|
24
|
+
export declare const isAscii: ValidationRule;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Is Printable
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is a string containing only
|
|
7
|
+
* printable ASCII characters (code points 0x20–0x7E).
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validates that the value is a string containing only printable ASCII
|
|
14
|
+
* characters (code points 0x20–0x7E).
|
|
15
|
+
*
|
|
16
|
+
* - Non‑string values emit `string.not.string`.
|
|
17
|
+
* - Strings containing characters outside the printable ASCII range emit
|
|
18
|
+
* `string.not.printable`.
|
|
19
|
+
* - Returns an empty array when the value is valid.
|
|
20
|
+
*
|
|
21
|
+
* This rule is pure, total, async‑compatible, and returns a readonly array of
|
|
22
|
+
* JaneEvent objects. It preserves the provided path and supports userMessage
|
|
23
|
+
* overrides applied at the pipeline level.
|
|
24
|
+
*/
|
|
25
|
+
export declare const isPrintable: ValidationRule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Matches
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is a string matching the provided
|
|
7
|
+
* regular expression.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validates that the value is a string matching the provided regular expression.
|
|
14
|
+
*
|
|
15
|
+
* - Non‑string values emit `string.not.string`.
|
|
16
|
+
* - Strings that do not satisfy the pattern emit `string.is.not-match`.
|
|
17
|
+
* - Returns an empty array when the value is valid.
|
|
18
|
+
*
|
|
19
|
+
* This rule is pure, total, async‑compatible, and returns a readonly array of
|
|
20
|
+
* JaneEvent objects. It preserves the provided path and supports userMessage
|
|
21
|
+
* overrides applied at the pipeline level.
|
|
22
|
+
*/
|
|
23
|
+
export declare const matches: (pattern: RegExp) => ValidationRule;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Maximum Length (Max Length)
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is a string whose length is less
|
|
7
|
+
* than or equal to the provided `max` value.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validates that the value is a string whose length is less than or equal to
|
|
14
|
+
* the provided `max` value.
|
|
15
|
+
*
|
|
16
|
+
* - Non‑string values emit `type.not.valid`.
|
|
17
|
+
* - Strings longer than `max` emit `string.too.long`.
|
|
18
|
+
* - Returns an empty array when the value is valid.
|
|
19
|
+
*
|
|
20
|
+
* This rule is pure, total, async‑compatible, and returns a readonly array of
|
|
21
|
+
* JaneEvent objects. It preserves the provided path and supports userMessage
|
|
22
|
+
* overrides applied at the pipeline level.
|
|
23
|
+
*/
|
|
24
|
+
export declare const maxLength: (max: number) => ValidationRule;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Minimum Length (Min Length)
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is a string whose length is greater
|
|
7
|
+
* than or equal to the provided `min` value.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validates that the value is a string whose length is greater than or equal to
|
|
14
|
+
* the provided `min` value.
|
|
15
|
+
*
|
|
16
|
+
* - Non‑string values emit `type.not.valid`.
|
|
17
|
+
* - Strings shorter than `min` emit `string.too.short`.
|
|
18
|
+
* - Returns an empty array when the value is valid.
|
|
19
|
+
*
|
|
20
|
+
* This rule is pure, total, async‑compatible, and returns a readonly array of
|
|
21
|
+
* JaneEvent objects. It preserves the provided path and supports userMessage
|
|
22
|
+
* overrides applied at the pipeline level.
|
|
23
|
+
*/
|
|
24
|
+
export declare const minLength: (min: number) => ValidationRule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | No Leading Whitespace (No Lead Space)
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is a string that does not begin
|
|
7
|
+
* with whitespace.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validates that the value is a string that does not begin with whitespace.
|
|
14
|
+
*
|
|
15
|
+
* - Non‑string values emit `type.not.valid`.
|
|
16
|
+
* - Strings beginning with whitespace emit `string.has.leading-whitespace`.
|
|
17
|
+
* - Returns an empty array when the value is valid.
|
|
18
|
+
*
|
|
19
|
+
* This rule is pure, total, async‑compatible, and returns a readonly array of
|
|
20
|
+
* JaneEvent objects. It preserves the provided path and supports userMessage
|
|
21
|
+
* overrides applied at the pipeline level.
|
|
22
|
+
*/
|
|
23
|
+
export declare const noLeadSpace: ValidationRule;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | No Repeated Whitespace (No Repeat Space)
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is a string that does not contain
|
|
7
|
+
* repeated consecutive space characters.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validates that the value is a string that does not contain repeated
|
|
14
|
+
* consecutive space characters.
|
|
15
|
+
*
|
|
16
|
+
* - Non‑string values emit `type.not.valid`.
|
|
17
|
+
* - Strings containing `" "` (two or more consecutive spaces) emit
|
|
18
|
+
* `string.has.repeating-whitespace`.
|
|
19
|
+
* - Returns an empty array when the value is valid.
|
|
20
|
+
*
|
|
21
|
+
* This rule is pure, total, async‑compatible, and returns a readonly array of
|
|
22
|
+
* JaneEvent objects. It preserves the provided path and supports userMessage
|
|
23
|
+
* overrides applied at the pipeline level.
|
|
24
|
+
*/
|
|
25
|
+
export declare const noRepeatSpace: ValidationRule;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | No Whitespace (No Space)
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is a string containing no
|
|
7
|
+
* whitespace characters.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validates that the value is a string containing no whitespace characters.
|
|
14
|
+
*
|
|
15
|
+
* - Non‑string values emit `type.not.valid`.
|
|
16
|
+
* - Strings containing any whitespace (spaces, tabs, newlines, etc.) emit
|
|
17
|
+
* `string.has.whitespace`.
|
|
18
|
+
* - Returns an empty array when the value is valid.
|
|
19
|
+
*
|
|
20
|
+
* This rule is pure, total, async‑compatible, and returns a readonly array of
|
|
21
|
+
* JaneEvent objects. It preserves the provided path and supports userMessage
|
|
22
|
+
* overrides applied at the pipeline level.
|
|
23
|
+
*/
|
|
24
|
+
export declare const noSpace: ValidationRule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | No Trailing Whitespace (No Trail Space)
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is a string that does not end with
|
|
7
|
+
* whitespace.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validates that the value is a string that does not end with whitespace.
|
|
14
|
+
*
|
|
15
|
+
* - Non‑string values emit `type.not.valid`.
|
|
16
|
+
* - Strings ending with whitespace emit `string.has.trailing-whitespace`.
|
|
17
|
+
* - Returns an empty array when the value is valid.
|
|
18
|
+
*
|
|
19
|
+
* This rule is pure, total, async‑compatible, and returns a readonly array of
|
|
20
|
+
* JaneEvent objects. It preserves the provided path and supports userMessage
|
|
21
|
+
* overrides applied at the pipeline level.
|
|
22
|
+
*/
|
|
23
|
+
export declare const noTrailSpace: ValidationRule;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Non-Empty
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is a non-empty string.
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
import type { ValidationRule } from '../../shapes';
|
|
11
|
+
/**
|
|
12
|
+
* Validates that the value is a non-empty string.
|
|
13
|
+
*
|
|
14
|
+
* - Non‑string values emit `string.not.string`.
|
|
15
|
+
* - Empty strings emit `string.is.empty`.
|
|
16
|
+
* - Returns an empty array when the value is valid.
|
|
17
|
+
*
|
|
18
|
+
* This rule is pure, total, async‑compatible, and returns a readonly array of
|
|
19
|
+
* JaneEvent objects. It preserves the provided path and supports userMessage
|
|
20
|
+
* overrides applied at the pipeline level.
|
|
21
|
+
*/
|
|
22
|
+
export declare const nonEmpty: ValidationRule;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Not One Of
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is a string that is *not* included
|
|
7
|
+
* in the provided `disallowed` list.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validates that the value is a string that is *not* included in the provided
|
|
14
|
+
* `disallowed` list.
|
|
15
|
+
*
|
|
16
|
+
* - Non‑string values emit `type.not.valid`.
|
|
17
|
+
* - Strings that appear in the disallowed list emit `string.is.disallowed`.
|
|
18
|
+
* - Returns an empty array when the value is valid.
|
|
19
|
+
*
|
|
20
|
+
* This rule is pure, total, async‑compatible, and returns a readonly array of
|
|
21
|
+
* JaneEvent objects. It preserves the provided path and supports userMessage
|
|
22
|
+
* overrides applied at the pipeline level.
|
|
23
|
+
*/
|
|
24
|
+
export declare const notOneOf: (disallowed: readonly string[]) => ValidationRule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Number String (Num String)
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is a string containing only ASCII
|
|
7
|
+
* digits (`0–9`).
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validates that the value is a string containing only ASCII digits (`0–9`).
|
|
14
|
+
*
|
|
15
|
+
* - Non‑string values emit `type.not.valid`.
|
|
16
|
+
* - Strings containing any non-digit character emit `string.not.numeric`.
|
|
17
|
+
* - Returns an empty array when the value is valid.
|
|
18
|
+
*
|
|
19
|
+
* This rule is pure, total, async‑compatible, and returns a readonly array of
|
|
20
|
+
* JaneEvent objects. It preserves the provided path and supports userMessage
|
|
21
|
+
* overrides applied at the pipeline level.
|
|
22
|
+
*/
|
|
23
|
+
export declare const numString: ValidationRule;
|