@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,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Too Early
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Ensures the input is a Date instance that is not later than
|
|
7
|
+
* the provided `max` boundary.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Ensures the input is a Date instance that is not later than the
|
|
14
|
+
* provided `max` boundary. The comparison is inclusive: value must be
|
|
15
|
+
* ≤ max.
|
|
16
|
+
*
|
|
17
|
+
* - Non-Date values emit `date.not.date`.
|
|
18
|
+
* - Invalid Date instances emit `date.is.invalid`.
|
|
19
|
+
* - Dates > max emit `date.too.late`.
|
|
20
|
+
*
|
|
21
|
+
* This rule is pure, total, async-compatible, and preserves the
|
|
22
|
+
* provided path. It supports userMessage overrides applied at the
|
|
23
|
+
* pipeline level.
|
|
24
|
+
*/
|
|
25
|
+
export declare const tooLate: (max: Date) => ValidationRule;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Weekday
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Ensures the input is a Date instance whose weekday (0–6)
|
|
7
|
+
* matches the required weekday.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Ensures the input is a Date instance whose weekday (0–6) matches
|
|
14
|
+
* the required weekday. JavaScript uses:
|
|
15
|
+
*
|
|
16
|
+
* 0 = Sunday
|
|
17
|
+
* 1 = Monday
|
|
18
|
+
* 2 = Tuesday
|
|
19
|
+
* 3 = Wednesday
|
|
20
|
+
* 4 = Thursday
|
|
21
|
+
* 5 = Friday
|
|
22
|
+
* 6 = Saturday
|
|
23
|
+
*
|
|
24
|
+
* - Non-Date values emit `date.not.date`.
|
|
25
|
+
* - Invalid Date instances emit `date.is.invalid`.
|
|
26
|
+
* - Mismatched weekdays emit `date.not.weekday`.
|
|
27
|
+
*
|
|
28
|
+
* This rule is pure, total, async-compatible, and preserves the
|
|
29
|
+
* provided path. It supports userMessage overrides applied at the
|
|
30
|
+
* pipeline level.
|
|
31
|
+
*/
|
|
32
|
+
export declare const weekday: (required: number) => ValidationRule;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Weekend
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Ensures the input is a Date instance that falls on a
|
|
7
|
+
* weekend.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Ensures the input is a Date instance that falls on a weekend.
|
|
14
|
+
*
|
|
15
|
+
* JavaScript weekday values:
|
|
16
|
+
* 0 = Sunday
|
|
17
|
+
* 6 = Saturday
|
|
18
|
+
*
|
|
19
|
+
* - Non-Date values emit `date.not.date`.
|
|
20
|
+
* - Invalid Date instances emit `date.is.invalid`.
|
|
21
|
+
* - Weekdays (1–5) emit `date.not.weekend`.
|
|
22
|
+
*
|
|
23
|
+
* This rule is pure, total, async-compatible, and preserves the
|
|
24
|
+
* provided path. It supports userMessage overrides applied at the
|
|
25
|
+
* pipeline level.
|
|
26
|
+
*/
|
|
27
|
+
export declare const weekend: ValidationRule;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Barrel File
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Re‑exports all built‑in validation rules, providing a single
|
|
7
|
+
* cohesive entry point for Jane’s validation subsystem. This
|
|
8
|
+
* keeps contributor onboarding simple and ensures consistent,
|
|
9
|
+
* predictable resolution of validator names across the
|
|
10
|
+
* framework.
|
|
11
|
+
* @see https://jane-io.com
|
|
12
|
+
* ----------------------------------------------------------------------------
|
|
13
|
+
*/
|
|
14
|
+
export { array } from './array/array';
|
|
15
|
+
export { arrayMaxItems } from './array/array-max-items';
|
|
16
|
+
export { arrayMinItems } from './array/array-min-items';
|
|
17
|
+
export { excludes } from './array/excludes';
|
|
18
|
+
export { hasUniqueItems } from './array/has-unique-items';
|
|
19
|
+
export { includes } from './array/includes';
|
|
20
|
+
export { itemsEqual } from './array/items-equal';
|
|
21
|
+
export { noEmptyStringItems } from './array/no-empty-string-items';
|
|
22
|
+
export { noNullItems } from './array/no-null-items';
|
|
23
|
+
export { noUndefinedItems } from './array/no-undefined-items';
|
|
24
|
+
export { nonEmptyArray } from './array/non-empty-array';
|
|
25
|
+
export { notSparse } from './array/not-sparse';
|
|
26
|
+
export { bigint } from './bigint/bigint';
|
|
27
|
+
export { bigintEquals } from './bigint/bigint-equals';
|
|
28
|
+
export { bigintMax } from './bigint/bigint-max';
|
|
29
|
+
export { bigintMin } from './bigint/bigint-min';
|
|
30
|
+
export { bigintNegative } from './bigint/bigint-negative';
|
|
31
|
+
export { bigintNonNegative } from './bigint/bigint-non-negative';
|
|
32
|
+
export { bigintNonPositive } from './bigint/bigint-non-positive';
|
|
33
|
+
export { bigintPositive } from './bigint/bigint-positive';
|
|
34
|
+
export { bigintSafe } from './bigint/bigint-safe';
|
|
35
|
+
export { boolean } from './boolean/boolean';
|
|
36
|
+
export { isFalse } from './boolean/is-false';
|
|
37
|
+
export { isTrue } from './boolean/is-true';
|
|
38
|
+
export { isCountryCode } from './common/is-country-code';
|
|
39
|
+
export { isCurrencyCode } from './common/is-currency-code';
|
|
40
|
+
export { isEmail } from './common/is-email';
|
|
41
|
+
export { isEmailStrict } from './common/is-email-strict';
|
|
42
|
+
export { isIp } from './common/is-ip';
|
|
43
|
+
export { isPhone } from './common/is-phone';
|
|
44
|
+
export { isPhoneStrict } from './common/is-phone-strict';
|
|
45
|
+
export { isPort } from './common/is-port';
|
|
46
|
+
export { isPostalCode } from './common/is-postal-code';
|
|
47
|
+
export { isUrl } from './common/is-url';
|
|
48
|
+
export { isUuid } from './common/is-uuid';
|
|
49
|
+
export { beforeEpoch } from './date/before-epoch';
|
|
50
|
+
export { dateNowRequired } from './date/date-now-required';
|
|
51
|
+
export { isDate } from './date/is-date';
|
|
52
|
+
export { isFarFuture } from './date/is-far-future';
|
|
53
|
+
export { isFuture } from './date/is-future';
|
|
54
|
+
export { isPast } from './date/is-past';
|
|
55
|
+
export { notAfter } from './date/not-after';
|
|
56
|
+
export { notBefore } from './date/not-before';
|
|
57
|
+
export { sameDay } from './date/same-day';
|
|
58
|
+
export { sameMonth } from './date/same-month';
|
|
59
|
+
export { sameYear } from './date/same-year';
|
|
60
|
+
export { tooEarly } from './date/too-early';
|
|
61
|
+
export { tooLate } from './date/too-late';
|
|
62
|
+
export { weekday } from './date/weekday';
|
|
63
|
+
export { weekend } from './date/weekend';
|
|
64
|
+
export { isNull } from './nullish/is-null';
|
|
65
|
+
export { isNullOrUndefined } from './nullish/is-null-or-undefined';
|
|
66
|
+
export { isUndefined } from './nullish/is-undefined';
|
|
67
|
+
export { finite } from './number/finite';
|
|
68
|
+
export { integer } from './number/integer';
|
|
69
|
+
export { lessThan } from './number/less-than';
|
|
70
|
+
export { max } from './number/max';
|
|
71
|
+
export { min } from './number/min';
|
|
72
|
+
export { moreThan } from './number/more-than';
|
|
73
|
+
export { negative } from './number/negative';
|
|
74
|
+
export { nonNegative } from './number/non-negative';
|
|
75
|
+
export { nonPositive } from './number/non-positive';
|
|
76
|
+
export { number } from './number/number';
|
|
77
|
+
export { positive } from './number/positive';
|
|
78
|
+
export { safeInteger } from './number/safe-integer';
|
|
79
|
+
export { deepEquals } from './object/deep-equals';
|
|
80
|
+
export { hasKey } from './object/has-key';
|
|
81
|
+
export { hasValue } from './object/has-value';
|
|
82
|
+
export { keysEqual } from './object/keys-equal';
|
|
83
|
+
export { maxKeys } from './object/max-keys';
|
|
84
|
+
export { minKeys } from './object/min-keys';
|
|
85
|
+
export { missingKey } from './object/missing-key';
|
|
86
|
+
export { noEmptyArrayValues } from './object/no-empty-array-values';
|
|
87
|
+
export { noEmptyObjectValues } from './object/no-empty-object-values';
|
|
88
|
+
export { noNullValues } from './object/no-null-values';
|
|
89
|
+
export { noUndefinedValues } from './object/no-undefined-values';
|
|
90
|
+
export { nonEmptyObject } from './object/non-empty-object';
|
|
91
|
+
export { plainObject } from './object/plain-object';
|
|
92
|
+
export { onlyKeys } from './object/only-keys';
|
|
93
|
+
export { alpha } from './string/alpha';
|
|
94
|
+
export { alphaNum } from './string/alpha-num';
|
|
95
|
+
export { charsEqual } from './string/chars-equal';
|
|
96
|
+
export { endsWith } from './string/ends-with';
|
|
97
|
+
export { isAscii } from './string/is-ascii';
|
|
98
|
+
export { isPrintable } from './string/is-printable';
|
|
99
|
+
export { matches } from './string/matches';
|
|
100
|
+
export { maxLength } from './string/max-length';
|
|
101
|
+
export { minLength } from './string/min-length';
|
|
102
|
+
export { noLeadSpace } from './string/no-lead-space';
|
|
103
|
+
export { noRepeatSpace } from './string/no-repeat-space';
|
|
104
|
+
export { noSpace } from './string/no-space';
|
|
105
|
+
export { noTrailSpace } from './string/no-trail-space';
|
|
106
|
+
export { nonEmpty } from './string/non-empty';
|
|
107
|
+
export { notOneOf } from './string/not-one-of';
|
|
108
|
+
export { numString } from './string/num-string';
|
|
109
|
+
export { oneOf } from './string/one-of';
|
|
110
|
+
export { startsWith } from './string/starts-with';
|
|
111
|
+
export { string } from './string/string';
|
|
112
|
+
export { trimmed } from './string/trimmed';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Is Null Or Undefined
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is either `null` or `undefined`.
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
import type { ValidationRule } from '../../shapes';
|
|
11
|
+
/**
|
|
12
|
+
* Validates that the value is either `null` or `undefined`.
|
|
13
|
+
*
|
|
14
|
+
* - Any value other than `null` or `undefined` emits
|
|
15
|
+
* `value.not.null-or-undefined`.
|
|
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 isNullOrUndefined: ValidationRule;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Is Null
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is exactly `null`.
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
import type { ValidationRule } from '../../shapes';
|
|
11
|
+
/**
|
|
12
|
+
* Validates that the value is exactly `null`.
|
|
13
|
+
*
|
|
14
|
+
* - Any value other than `null` emits `value.not.null`.
|
|
15
|
+
* - Returns an empty array when the value is valid.
|
|
16
|
+
*
|
|
17
|
+
* This rule is pure, total, async‑compatible, and returns a readonly array of
|
|
18
|
+
* JaneEvent objects. It preserves the provided path and supports userMessage
|
|
19
|
+
* overrides applied at the pipeline level.
|
|
20
|
+
*/
|
|
21
|
+
export declare const isNull: ValidationRule;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Is Undefined
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that the value is exactly `undefined`.
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
import type { ValidationRule } from '../../shapes';
|
|
11
|
+
/**
|
|
12
|
+
* Validates that the value is exactly `undefined`.
|
|
13
|
+
*
|
|
14
|
+
* - Any value other than `undefined` emits `value.not.undefined`.
|
|
15
|
+
* - Returns an empty array when the value is valid.
|
|
16
|
+
*
|
|
17
|
+
* This rule is pure, total, async‑compatible, and returns a readonly array of
|
|
18
|
+
* JaneEvent objects. It preserves the provided path and supports userMessage
|
|
19
|
+
* overrides applied at the pipeline level.
|
|
20
|
+
*/
|
|
21
|
+
export declare const isUndefined: ValidationRule;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Finite
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that the value is a finite number.
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
import type { ValidationRule } from '../../shapes';
|
|
11
|
+
/**
|
|
12
|
+
* Validate that the value is a finite number.
|
|
13
|
+
*
|
|
14
|
+
* This rule accepts only JavaScript numbers that are both numeric and finite.
|
|
15
|
+
* Non-number values, NaN, Infinity, and -Infinity are rejected.
|
|
16
|
+
*
|
|
17
|
+
* If the value is not a number, a type.not.valid event is emitted.
|
|
18
|
+
* If the value is a number but not finite, a number.not.finite event is emitted.
|
|
19
|
+
*
|
|
20
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
21
|
+
*/
|
|
22
|
+
export declare const finite: ValidationRule;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Integer
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that the value is an integer.
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
import type { ValidationRule } from '../../shapes';
|
|
11
|
+
/**
|
|
12
|
+
* Validate that the value is an integer.
|
|
13
|
+
*
|
|
14
|
+
* This rule accepts only JavaScript numbers that are both numeric and integer‑valued.
|
|
15
|
+
* Non-number values and non-integer numbers are rejected.
|
|
16
|
+
*
|
|
17
|
+
* If the value is not a number, a type.not.valid event is emitted.
|
|
18
|
+
* If the value is a number but not an integer, a number.not.integer event is emitted.
|
|
19
|
+
*
|
|
20
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
21
|
+
*/
|
|
22
|
+
export declare const integer: ValidationRule;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Less Than
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that the value is a number strictly less than the
|
|
7
|
+
* given limit.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validate that the value is a number strictly less than the given limit.
|
|
14
|
+
*
|
|
15
|
+
* This rule accepts only JavaScript numbers. Non-number values are rejected.
|
|
16
|
+
* If the value is numeric but not less than the provided limit, a
|
|
17
|
+
* number.too.high event is emitted.
|
|
18
|
+
*
|
|
19
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
20
|
+
*/
|
|
21
|
+
export declare const lessThan: (limit: number) => ValidationRule;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Maximum (Max)
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that the value is a number less than or equal to
|
|
7
|
+
* the given limit.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validate that the value is a number less than or equal to the given limit.
|
|
14
|
+
*
|
|
15
|
+
* This rule accepts only JavaScript numbers. Non-number values are rejected.
|
|
16
|
+
* If the value is numeric but greater than the provided limit, a
|
|
17
|
+
* number.too.high event is emitted.
|
|
18
|
+
*
|
|
19
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
20
|
+
*/
|
|
21
|
+
export declare const max: (limit: number) => ValidationRule;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Minimum (Min)
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that the value is a number greater than or equal
|
|
7
|
+
* to the given limit.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validate that the value is a number greater than or equal to the given limit.
|
|
14
|
+
*
|
|
15
|
+
* This rule accepts only JavaScript numbers. Non-number values are rejected.
|
|
16
|
+
* If the value is numeric but less than the provided limit, a
|
|
17
|
+
* number.too.low event is emitted.
|
|
18
|
+
*
|
|
19
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
20
|
+
*/
|
|
21
|
+
export declare const min: (limit: number) => ValidationRule;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | More Than
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that the value is a number strictly greater than
|
|
7
|
+
* the given limit.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validate that the value is a number strictly greater than the given limit.
|
|
14
|
+
*
|
|
15
|
+
* This rule accepts only JavaScript numbers. Non-number values and NaN are rejected.
|
|
16
|
+
* If the value is numeric but not greater than the provided limit, a
|
|
17
|
+
* number.too.low event is emitted.
|
|
18
|
+
*
|
|
19
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
20
|
+
*/
|
|
21
|
+
export declare const moreThan: (limit: number) => ValidationRule;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Negative
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that the value is a negative number.
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
import type { ValidationRule } from '../../shapes';
|
|
11
|
+
/**
|
|
12
|
+
* Validate that the value is a negative number.
|
|
13
|
+
*
|
|
14
|
+
* This rule accepts only JavaScript numbers. Non-number values and NaN are rejected.
|
|
15
|
+
* If the value is numeric but not strictly less than zero, a number.not.negative
|
|
16
|
+
* event is emitted.
|
|
17
|
+
*
|
|
18
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
19
|
+
*/
|
|
20
|
+
export declare const negative: ValidationRule;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Non-Negative
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that the value is a non‑negative number.
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
import type { ValidationRule } from '../../shapes';
|
|
11
|
+
/**
|
|
12
|
+
* Validate that the value is a non‑negative number.
|
|
13
|
+
*
|
|
14
|
+
* This rule accepts only JavaScript numbers. Non-number values and NaN are rejected.
|
|
15
|
+
* If the value is numeric but less than zero, a number.not.non-negative event is emitted.
|
|
16
|
+
*
|
|
17
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
18
|
+
*/
|
|
19
|
+
export declare const nonNegative: ValidationRule;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Non Positive
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that the value is a non‑positive number.
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
import type { ValidationRule } from '../../shapes';
|
|
11
|
+
/**
|
|
12
|
+
* Validate that the value is a non‑positive number.
|
|
13
|
+
*
|
|
14
|
+
* This rule accepts only JavaScript numbers. Non-number values and NaN are rejected.
|
|
15
|
+
* If the value is numeric but greater than zero, a number.not.non-positive event is emitted.
|
|
16
|
+
*
|
|
17
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
18
|
+
*/
|
|
19
|
+
export declare const nonPositive: ValidationRule;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Number
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that the value is a JavaScript number.
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
import type { ValidationRule } from '../../shapes';
|
|
11
|
+
/**
|
|
12
|
+
* Validate that the value is a JavaScript number.
|
|
13
|
+
*
|
|
14
|
+
* This rule accepts only JavaScript numbers. Non-number values and NaN are rejected.
|
|
15
|
+
* If the value is not a number, a type.not.valid event is emitted.
|
|
16
|
+
*
|
|
17
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
18
|
+
*/
|
|
19
|
+
export declare const number: ValidationRule;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Positive
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that the value is a positive number.
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
import type { ValidationRule } from '../../shapes';
|
|
11
|
+
/**
|
|
12
|
+
* Validate that the value is a positive number.
|
|
13
|
+
*
|
|
14
|
+
* This rule accepts only JavaScript numbers. Non-number values and NaN are rejected.
|
|
15
|
+
* If the value is numeric but not strictly greater than zero, a number.not.positive
|
|
16
|
+
* event is emitted.
|
|
17
|
+
*
|
|
18
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
19
|
+
*/
|
|
20
|
+
export declare const positive: ValidationRule;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Safe Integer
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that a value is a safe integer.
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
import type { ValidationRule } from '../../shapes';
|
|
11
|
+
/**
|
|
12
|
+
* Validates that a value is a safe integer.
|
|
13
|
+
*
|
|
14
|
+
* Safe integers must be whole numbers that fall within JavaScript’s
|
|
15
|
+
* IEEE‑754 safe range. This protects downstream logic from precision loss,
|
|
16
|
+
* overflow‑adjacent behavior, and malformed numeric input that appears valid
|
|
17
|
+
* but cannot be represented exactly.
|
|
18
|
+
*/
|
|
19
|
+
export declare const safeInteger: ValidationRule;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Deep Equals
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that a value is deeply equal to an expected
|
|
7
|
+
* structural value.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validate that a value is deeply equal to an expected structural value.
|
|
14
|
+
*
|
|
15
|
+
* Deep equality is performed against JSON-compatible values only:
|
|
16
|
+
* - primitives
|
|
17
|
+
* - arrays
|
|
18
|
+
* - plain objects (no class instances, Maps, Sets, Dates, etc.)
|
|
19
|
+
*
|
|
20
|
+
* If the value is not structural, an object.not.plain-object event is emitted.
|
|
21
|
+
* If the value is structural but not deeply equal, an object.not.deeply-equal event is emitted.
|
|
22
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
23
|
+
*/
|
|
24
|
+
export declare const deepEquals: (expected: unknown) => ValidationRule;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Has Key
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that a plain object contains a required own
|
|
7
|
+
* enumerable key.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validate that a plain object contains a required own enumerable key.
|
|
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 required key is missing, an object.missing-key event is emitted.
|
|
20
|
+
*
|
|
21
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
22
|
+
*/
|
|
23
|
+
export declare const hasKey: (requiredKey: string) => ValidationRule;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Has Value
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that an array or plain object contains a value
|
|
7
|
+
* deeply equal to the target.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validate that an array or plain object contains a value deeply equal to the target.
|
|
14
|
+
*
|
|
15
|
+
* This rule accepts only JSON-compatible arrays and plain objects.
|
|
16
|
+
* Primitives, null, class instances, Maps, Sets, Dates, and other non-collection
|
|
17
|
+
* values are rejected.
|
|
18
|
+
*
|
|
19
|
+
* Arrays are searched using deep equality on each element.
|
|
20
|
+
* Objects are searched using deep equality on each own enumerable value.
|
|
21
|
+
*
|
|
22
|
+
* If the value is not a collection, an object.not.collection event is emitted.
|
|
23
|
+
* If the target value is not found, a value.not.found event is emitted.
|
|
24
|
+
*
|
|
25
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
26
|
+
*/
|
|
27
|
+
export declare const hasValue: (target: unknown) => ValidationRule;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Validators | Keys Equal
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validate that a plain object contains exactly the expected
|
|
7
|
+
* set of keys.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ValidationRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Validate that a plain object contains exactly the expected set 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
|
+
* The object must contain the same number of keys and the same key names as expectedKeys.
|
|
19
|
+
* Order does not matter. Keys must match exactly.
|
|
20
|
+
*
|
|
21
|
+
* If the value is not a plain object, an object.not.plain-object event is emitted.
|
|
22
|
+
* If the key set does not match, an object.invalid-keys event is emitted.
|
|
23
|
+
*
|
|
24
|
+
* The rule is async-compatible and returns a readonly array of JaneEvent objects.
|
|
25
|
+
*/
|
|
26
|
+
export declare const keysEqual: (expectedKeys: readonly string[]) => ValidationRule;
|