@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,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Pipeline | Boundary
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Aggregates field results and applies boundary‑level policy
|
|
7
|
+
* to produce a final decision.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { BoundaryContext, BoundaryDecision, BoundaryInput, BoundaryResult } from '../shapes';
|
|
12
|
+
import type { BoundaryRule } from '../shapes/boundary';
|
|
13
|
+
/**
|
|
14
|
+
* Holds all registered boundary‑level rules.
|
|
15
|
+
*
|
|
16
|
+
* Provides a central lookup for rule names used in boundary policies,
|
|
17
|
+
* allowing contributors to extend or customize boundary evaluation
|
|
18
|
+
* without modifying the core engine.
|
|
19
|
+
*/
|
|
20
|
+
export declare const boundaryRuleRegistry: Record<string, BoundaryRule>;
|
|
21
|
+
/**
|
|
22
|
+
* Executes boundary evaluation across all field results.
|
|
23
|
+
*
|
|
24
|
+
* Aggregates issues and events from each pipeline result, applies
|
|
25
|
+
* boundary‑level rules, shapes values and metadata according to policy,
|
|
26
|
+
* and produces the final boundary result used for acceptance decisions.
|
|
27
|
+
*/
|
|
28
|
+
export declare function boundaryRunner(input: BoundaryInput): Promise<BoundaryResult>;
|
|
29
|
+
/**
|
|
30
|
+
* Applies boundary decision logic to the aggregated context.
|
|
31
|
+
*
|
|
32
|
+
* Shapes events and issues through ignore, override, escalate, and
|
|
33
|
+
* visibility rules, evaluates acceptance modes, and optionally invokes
|
|
34
|
+
* a reducer to refine or override the final decision.
|
|
35
|
+
*/
|
|
36
|
+
export declare function decideBoundary(context: BoundaryContext): Promise<BoundaryDecision>;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Pipeline | Contain
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Enforces structural limits and produces a safe, cycle‑free
|
|
7
|
+
* representation of input.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ContainmentContext, ContainmentOptions, FieldPath, InternalJsonValue, Policy } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Sentinel markers used when a value cannot be safely contained.
|
|
14
|
+
*
|
|
15
|
+
* These appear when encountering cycles, excessive depth or size, unsafe
|
|
16
|
+
* structures, or disallowed types such as functions, symbols, and proxies.
|
|
17
|
+
*/
|
|
18
|
+
export declare const ContainmentSentinel: {
|
|
19
|
+
readonly Circular: "[Circular]";
|
|
20
|
+
readonly TooDeep: "[TooDeep]";
|
|
21
|
+
readonly TooLarge: "[TooLarge]";
|
|
22
|
+
readonly Proxy: "[Proxy]";
|
|
23
|
+
readonly Getter: "[Getter]";
|
|
24
|
+
readonly Function: "[Function]";
|
|
25
|
+
readonly Symbol: "[Symbol]";
|
|
26
|
+
readonly BigInt: "[BigInt]";
|
|
27
|
+
};
|
|
28
|
+
export type ContainmentSentinel = (typeof ContainmentSentinel)[keyof typeof ContainmentSentinel];
|
|
29
|
+
/**
|
|
30
|
+
* Contains an array by applying depth and length limits.
|
|
31
|
+
*
|
|
32
|
+
* Recursively contains each element, records the container for cycle
|
|
33
|
+
* detection, and appends a TooLarge sentinel when the array exceeds
|
|
34
|
+
* the configured maximum length.
|
|
35
|
+
*/
|
|
36
|
+
export declare function containArray(value: readonly unknown[], path: FieldPath, context: ContainmentContext, depth: number): unknown;
|
|
37
|
+
/**
|
|
38
|
+
* Represents a bigint value in a safe, JSON‑compatible form.
|
|
39
|
+
*
|
|
40
|
+
* Used only when bigint is explicitly allowed by policy; otherwise
|
|
41
|
+
* containment falls back to the BigInt sentinel.
|
|
42
|
+
*/
|
|
43
|
+
export declare function containBigInt(value: bigint): {
|
|
44
|
+
kind: "bigint";
|
|
45
|
+
asString: string;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Contains a plain object by enforcing key limits and safe property access.
|
|
49
|
+
*
|
|
50
|
+
* Skips prototype‑pollution vectors, replaces getters/setters with a
|
|
51
|
+
* Getter sentinel, and recursively contains each value. Adds a TooLarge
|
|
52
|
+
* sentinel entry when the object exceeds the configured key limit.
|
|
53
|
+
*/
|
|
54
|
+
export declare function containObject(value: Record<string, unknown>, path: FieldPath, ctx: ContainmentContext, depth: number): unknown;
|
|
55
|
+
/**
|
|
56
|
+
* Recursively contains any value into a safe, JSON‑like structure.
|
|
57
|
+
*
|
|
58
|
+
* Enforces depth limits, detects cycles, handles primitives directly,
|
|
59
|
+
* applies policy‑controlled exceptions (e.g., bigint), and replaces
|
|
60
|
+
* unsafe or non‑plain objects with appropriate sentinels.
|
|
61
|
+
*/
|
|
62
|
+
export declare function containRecursive(value: unknown, path: FieldPath, context: ContainmentContext, depth: number): unknown;
|
|
63
|
+
/**
|
|
64
|
+
* Entry point for containment.
|
|
65
|
+
*
|
|
66
|
+
* Creates a fresh containment context and produces a safe representation
|
|
67
|
+
* of the input value. Falls back to the Proxy sentinel if containment
|
|
68
|
+
* fails unexpectedly.
|
|
69
|
+
*/
|
|
70
|
+
export declare function containValue(value: unknown, path?: FieldPath, options?: ContainmentOptions, policy?: Policy): unknown;
|
|
71
|
+
/**
|
|
72
|
+
* Constructs a containment context with structural limits, policy,
|
|
73
|
+
* and a fresh cycle‑detection map.
|
|
74
|
+
*/
|
|
75
|
+
export declare function createContainmentContext(options: ContainmentOptions, policy: Policy): ContainmentContext;
|
|
76
|
+
/**
|
|
77
|
+
* Produces a deep, acyclic clone of an internal JSON value.
|
|
78
|
+
*
|
|
79
|
+
* Preserves primitives, arrays, plain objects, and Date instances while
|
|
80
|
+
* tracking references to avoid infinite recursion. Used to safely copy
|
|
81
|
+
* containment output without re‑running containment.
|
|
82
|
+
*/
|
|
83
|
+
export declare function deepClone(input: InternalJsonValue, seen?: WeakMap<object, InternalJsonValue>): InternalJsonValue | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* Default structural limits applied during containment.
|
|
86
|
+
*
|
|
87
|
+
* These bounds prevent excessive recursion and traversal by capping depth,
|
|
88
|
+
* array length, and object key count.
|
|
89
|
+
*/
|
|
90
|
+
export declare const defaultContainmentOptions: ContainmentOptions;
|
|
91
|
+
/**
|
|
92
|
+
* Determines whether a value is a containment sentinel.
|
|
93
|
+
*
|
|
94
|
+
* Sentinels represent structural hazards or disallowed types encountered
|
|
95
|
+
* during containment and are encoded as well‑known string markers.
|
|
96
|
+
*/
|
|
97
|
+
export declare function isSentinel(value: unknown): value is ContainmentSentinel;
|
|
98
|
+
/**
|
|
99
|
+
* Safely retrieves an object's own enumerable keys.
|
|
100
|
+
*
|
|
101
|
+
* Returns an empty array if key enumeration fails, protecting containment
|
|
102
|
+
* from objects with hostile or unusual prototypes.
|
|
103
|
+
*/
|
|
104
|
+
export declare function safeObjectKeys(value: Record<string, unknown>): string[];
|
|
105
|
+
/**
|
|
106
|
+
* Safely retrieves a property descriptor.
|
|
107
|
+
*
|
|
108
|
+
* Returns undefined if descriptor access throws, allowing containment to
|
|
109
|
+
* gracefully handle objects with unsafe or non‑standard behavior.
|
|
110
|
+
*/
|
|
111
|
+
export declare function safePropertyDescriptor(value: Record<string, unknown>, key: string): PropertyDescriptor | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Maps a containment sentinel to its corresponding event.
|
|
114
|
+
*
|
|
115
|
+
* Used to surface structural hazards—such as cycles, excessive depth,
|
|
116
|
+
* unsafe objects, or disallowed types—as typed events during scanning
|
|
117
|
+
* and policy evaluation.
|
|
118
|
+
*/
|
|
119
|
+
export declare function sentinelEvent(kind: ContainmentSentinel): {
|
|
120
|
+
code: string;
|
|
121
|
+
severity: string;
|
|
122
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Pipeline | Barrel File
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description
|
|
7
|
+
* @see https://jane-io.com
|
|
8
|
+
* ----------------------------------------------------------------------------
|
|
9
|
+
*/
|
|
10
|
+
export { boundaryRunner, decideBoundary } from './boundary';
|
|
11
|
+
export { ContainmentSentinel, containArray, containBigInt, containObject, containRecursive, containValue, createContainmentContext, deepClone, defaultContainmentOptions, isSentinel, safeObjectKeys, safePropertyDescriptor, sentinelEvent, } from './contain';
|
|
12
|
+
export { normalizationEvent, normalizationRunner, selectNormalizationRules } from './normalize';
|
|
13
|
+
export { isFluentParser, isParseFactory, parseEvent, parseRunner } from './parse';
|
|
14
|
+
export { createPipeline, pipelineRunner } from './pipeline';
|
|
15
|
+
export { detectStructuralType, measureDepth, scanEvent, scanRunner, selectScanRules } from './scan';
|
|
16
|
+
export { isFluentValidator, isValidationFactory, validationEvent, validationRunner, } from './validate';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Pipeline | Normalize
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Applies mode‑aware transformations to the safe value
|
|
7
|
+
* before validation.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { EventCode, EventKind, FieldPath, JaneEvent, NormalizationRule, NormalizationStageContext, NormalizationStageOutput } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Creates a normalization‑stage event.
|
|
14
|
+
*
|
|
15
|
+
* Wraps createEvent with the 'normalize' stage tag, producing structured
|
|
16
|
+
* messages emitted during value‑shaping operations.
|
|
17
|
+
*/
|
|
18
|
+
export declare const normalizationEvent: (kind: EventKind, code: EventCode, path: FieldPath, message?: string, userMessage?: string, meta?: Record<string, unknown>) => JaneEvent;
|
|
19
|
+
/**
|
|
20
|
+
* Executes the normalization stage.
|
|
21
|
+
*
|
|
22
|
+
* Applies each normalization rule in sequence, collects emitted events,
|
|
23
|
+
* and updates the working value according to the active mode. Lossy
|
|
24
|
+
* transformations are skipped in moderate mode, with a corresponding
|
|
25
|
+
* warning event recorded.
|
|
26
|
+
*/
|
|
27
|
+
export declare const normalizationRunner: (input: NormalizationStageContext) => Promise<NormalizationStageOutput>;
|
|
28
|
+
/**
|
|
29
|
+
* Selects normalization rules based on the structural type of the value.
|
|
30
|
+
*
|
|
31
|
+
* Uses detectStructuralType to choose the appropriate rule set from the
|
|
32
|
+
* registry, ensuring predictable and type‑specific normalization behavior.
|
|
33
|
+
*/
|
|
34
|
+
export declare function selectNormalizationRules(value: unknown): readonly NormalizationRule[];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Pipeline | Parse
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Converts raw input into typed values using registered parse
|
|
7
|
+
* rules.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { EventCode, EventKind, FieldPath, JaneEvent, ParserFactory, ParserFluentRule, ParseRule, ParseStageContext, ParseStageOutput } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Creates a parse‑stage event.
|
|
14
|
+
*
|
|
15
|
+
* Produces a structured event tagged with the 'parse' phase, used to
|
|
16
|
+
* surface observations or errors encountered while interpreting input.
|
|
17
|
+
*/
|
|
18
|
+
export declare function parseEvent(kind: EventKind, code: EventCode, message: string, path: FieldPath, userMessage?: string, metadata?: Record<string, unknown>): JaneEvent;
|
|
19
|
+
/**
|
|
20
|
+
* Determines whether a fluent parser entry is a factory.
|
|
21
|
+
*
|
|
22
|
+
* Factories accept arbitrary parameters and return a ParseRule, while
|
|
23
|
+
* fluent parsers expose a fixed two‑argument rule signature.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isParseFactory(fn: ParserFluentRule | ParserFactory): fn is ParserFactory;
|
|
26
|
+
/**
|
|
27
|
+
* Determines whether a fluent parser entry is a direct parse rule.
|
|
28
|
+
*
|
|
29
|
+
* Fluent rules always accept exactly two parameters—value and path—
|
|
30
|
+
* distinguishing them from parameterized factories.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isFluentParser(fn: ParserFluentRule): fn is ParseRule;
|
|
33
|
+
/**
|
|
34
|
+
* Executes the parse stage.
|
|
35
|
+
*
|
|
36
|
+
* Applies each parse rule in sequence, collects emitted events, and
|
|
37
|
+
* updates the working value as rules propose transformations. Errors
|
|
38
|
+
* thrown by rules are captured as fatal parse events.
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseRunner(ctx: ParseStageContext): Promise<ParseStageOutput>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Pipeline | Pipeline
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Orchestrates all pipeline stages into a unified execution
|
|
7
|
+
* lifecycle.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { FieldPath, ParseRule, PipelineBuilder, PipelineInput, PipelineResult, Policy, PolicyOverrides, ScanRule, ValidationRule } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Runs the configured pipeline through all enabled stages and assembles the
|
|
14
|
+
* complete result. Coordinates scan, normalize, parse, validate, analysis,
|
|
15
|
+
* and policy decision into a single execution flow.
|
|
16
|
+
*/
|
|
17
|
+
export declare function pipelineRunner<T>(input: PipelineInput): Promise<PipelineResult<T>>;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new pipeline builder rooted at the given raw value and path.
|
|
20
|
+
* Establishes the initial rule sets, policy state, and override surface,
|
|
21
|
+
* returning a fluent interface for assembling and running a complete pipeline.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createPipeline(raw: unknown, path?: FieldPath, scanRules?: readonly ScanRule[], parseRules?: readonly ParseRule[], validationRules?: readonly ValidationRule[], policy?: Policy, overrides?: PolicyOverrides): PipelineBuilder;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Pipeline | Scan
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Inspects the contained value and emits structural
|
|
7
|
+
* observations for later stages.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { EventCode, EventKind, FieldPath, JaneEvent, ScanRule, ScanRunner, StructuralType } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Classifies a raw value into one of Jane’s structural types.
|
|
14
|
+
*
|
|
15
|
+
* Used by the scanner to select appropriate rules without relying on
|
|
16
|
+
* user‑defined schemas or runtime shape assumptions.
|
|
17
|
+
*/
|
|
18
|
+
export declare function detectStructuralType(input: unknown): StructuralType;
|
|
19
|
+
/**
|
|
20
|
+
* Computes the maximum nesting depth of a JSON‑like structure.
|
|
21
|
+
*
|
|
22
|
+
* Traverses objects recursively and returns the deepest level encountered,
|
|
23
|
+
* ignoring non‑object values and null.
|
|
24
|
+
*/
|
|
25
|
+
export declare function measureDepth(value: unknown, current?: number): number;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a scan‑stage event.
|
|
28
|
+
*
|
|
29
|
+
* Wraps createEvent with the 'scan' stage tag, producing structured
|
|
30
|
+
* observations emitted during the scan pipeline phase.
|
|
31
|
+
*/
|
|
32
|
+
export declare const scanEvent: (kind: EventKind, code: EventCode, path: FieldPath, message: string, userMessage?: string, meta?: Record<string, unknown>) => JaneEvent;
|
|
33
|
+
/**
|
|
34
|
+
* Executes the scan stage for a single value.
|
|
35
|
+
*
|
|
36
|
+
* Produces a safe contained value, applies all scan rules, collects
|
|
37
|
+
* emitted events, and performs a structural walk to ensure full coverage.
|
|
38
|
+
*/
|
|
39
|
+
export declare const scanRunner: ScanRunner;
|
|
40
|
+
/**
|
|
41
|
+
* Selects scan rules based on the structural type of the raw value.
|
|
42
|
+
*
|
|
43
|
+
* Returns the union of universal rules and the rules specific to the
|
|
44
|
+
* detected type, ensuring consistent and predictable scan behavior.
|
|
45
|
+
*/
|
|
46
|
+
export declare function selectScanRules(raw: unknown): readonly ScanRule[];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Pipeline | Validate
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Evaluates the normalized value and emits rule‑driven
|
|
7
|
+
* correctness events.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { EventCode, EventKind, FieldPath, JaneEvent, ValidatorFactory, ValidationStageContext, ValidationStageOutput, ValidatorFluentRule, ValidationRule } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Determines whether a fluent validator entry is a factory.
|
|
14
|
+
*
|
|
15
|
+
* Factories accept arbitrary parameters and return a ValidationRule,
|
|
16
|
+
* distinguishing them from fixed‑signature fluent validators.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isValidationFactory(fn: ValidatorFluentRule): fn is ValidatorFactory;
|
|
19
|
+
/**
|
|
20
|
+
* Determines whether a fluent validator entry is a direct validation rule.
|
|
21
|
+
*
|
|
22
|
+
* Fluent validators always expose a two‑argument signature—value and path—
|
|
23
|
+
* making them distinguishable from parameterized factories.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isFluentValidator(fn: ValidatorFluentRule): fn is ValidationRule;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a validation‑stage event.
|
|
28
|
+
*
|
|
29
|
+
* Wraps createEvent with the 'validate' phase tag, producing correctness‑
|
|
30
|
+
* focused messages emitted during rule evaluation.
|
|
31
|
+
*/
|
|
32
|
+
export declare const validationEvent: (kind: EventKind, code: EventCode, path: FieldPath, message?: string, userMessage?: string, meta?: Record<string, unknown>) => JaneEvent;
|
|
33
|
+
/**
|
|
34
|
+
* Executes the validation stage.
|
|
35
|
+
*
|
|
36
|
+
* Applies each validation rule to the value, collects all emitted events,
|
|
37
|
+
* and records fatal errors when rules throw. Produces the complete set of
|
|
38
|
+
* correctness observations for the stage.
|
|
39
|
+
*/
|
|
40
|
+
export declare const validationRunner: (input: ValidationStageContext) => Promise<ValidationStageOutput>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Scan For Sentinels
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Detects sentinel markers in raw input and emits structural‑
|
|
7
|
+
* hazard events.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ScanRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Detects containment sentinels produced during safe‑clone operations.
|
|
14
|
+
*
|
|
15
|
+
* Flags any sentinel string as a fatal structural hazard, emitting a
|
|
16
|
+
* scan event that identifies the hazard code and the original sentinel
|
|
17
|
+
* value for downstream analysis and policy decisions.
|
|
18
|
+
*/
|
|
19
|
+
export declare const scanForSentinels: ScanRule;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Array Is Deep
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Detects arrays nested beyond a safe structural depth and
|
|
7
|
+
* emits a warning event.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ScanRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Warns when an array is nested beyond a safe structural depth.
|
|
14
|
+
*
|
|
15
|
+
* Walks down the first element chain to estimate nesting. If the depth
|
|
16
|
+
* exceeds the conservative threshold, emits a warning describing the
|
|
17
|
+
* observed and allowed depth.
|
|
18
|
+
*/
|
|
19
|
+
export declare const arrayIsDeep: ScanRule;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Array Is Heterogeneous
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Warns when an array contains mixed structural types,
|
|
7
|
+
* indicating inconsistent data shape.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ScanRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Flags arrays whose length exceeds a conservative safety threshold.
|
|
14
|
+
*
|
|
15
|
+
* Emits a warning when the list is unusually large, helping prevent
|
|
16
|
+
* excessive memory usage or pathological input shapes during scanning.
|
|
17
|
+
*/
|
|
18
|
+
export declare const arrayIsHeterogeneous: ScanRule;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Array Is Large
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Flags arrays whose length exceeds a conservative safety
|
|
7
|
+
* threshold.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ScanRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Detects containment sentinels produced during safe‑clone operations.
|
|
14
|
+
*
|
|
15
|
+
* Flags any sentinel string as a fatal structural hazard, emitting a
|
|
16
|
+
* scan event that identifies the hazard code and the original sentinel
|
|
17
|
+
* value for downstream analysis and policy decisions.
|
|
18
|
+
*/
|
|
19
|
+
export declare const arrayIsLarge: ScanRule;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Bigint Is Large
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Flags BigInt values that fall outside JavaScript’s safe
|
|
7
|
+
* integer range, surfacing numbers that cannot be reliably
|
|
8
|
+
* represented or compared using standard numeric APIs.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import type { ScanRule } from '../../shapes';
|
|
13
|
+
/**
|
|
14
|
+
* Flags `BigInt` values whose bit‑length exceeds a safe structural boundary.
|
|
15
|
+
*
|
|
16
|
+
* Extremely large integers can stress memory, break downstream serializers,
|
|
17
|
+
* and indicate adversarial or malformed input. This rule surfaces oversized
|
|
18
|
+
* values early so validators and policy layers can decide how to handle them.
|
|
19
|
+
*/
|
|
20
|
+
export declare const bigintIsLarge: ScanRule;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Bigint Not Safe
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Detects BigInt values whose bit-length exceeds a safe
|
|
7
|
+
* structural threshold, highlighting oversized or adversarial
|
|
8
|
+
* integers before deeper validation occurs.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import type { ScanRule } from '../../shapes';
|
|
13
|
+
/**
|
|
14
|
+
* Flags `BigInt` values that fall outside JavaScript’s safe integer range.
|
|
15
|
+
*
|
|
16
|
+
* While `BigInt` itself is unbounded, many systems assume values remain within
|
|
17
|
+
* the safe `number` range for interoperability. This rule highlights integers
|
|
18
|
+
* that cannot be safely represented or compared using standard numeric APIs.
|
|
19
|
+
*/
|
|
20
|
+
export declare const bigintNotSafe: ScanRule;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Date Is Before Epoch
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Flags Date values that occur before the Unix epoch,
|
|
7
|
+
* surfacing malformed or legacy timestamps early in scanning.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ScanRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Flags Date values that occur before the Unix epoch (1970‑01‑01).
|
|
14
|
+
*
|
|
15
|
+
* Dates earlier than the epoch often indicate malformed input, legacy
|
|
16
|
+
* serialization issues, or unexpected coercions. This rule surfaces those
|
|
17
|
+
* anomalies early so downstream validators can respond appropriately.
|
|
18
|
+
*/
|
|
19
|
+
export declare const dateIsBeforeEpoch: ScanRule;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Date Is Far Future
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Detects Date values that fall far beyond a safe future
|
|
7
|
+
* boundary, highlighting unrealistic or adversarial timestamps.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ScanRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Detects Date values that fall far beyond a conservative future boundary.
|
|
14
|
+
*
|
|
15
|
+
* Extremely future‑dated timestamps can signal corrupted data, unrealistic
|
|
16
|
+
* scheduling values, or adversarial input. This rule highlights such values
|
|
17
|
+
* before they propagate into business logic or policy layers.
|
|
18
|
+
*/
|
|
19
|
+
export declare const dateIsFarFuture: ScanRule;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Date Is Invalid
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Warns when a Date instance resolves to an invalid timestamp,
|
|
7
|
+
* ensuring parsing failures are surfaced explicitly.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ScanRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Warns when a Date instance resolves to an invalid (NaN) timestamp.
|
|
14
|
+
*
|
|
15
|
+
* Invalid Date objects commonly arise from parsing failures or unexpected
|
|
16
|
+
* transformations. This rule ensures they are surfaced explicitly rather than
|
|
17
|
+
* silently passing through the scan pipeline.
|
|
18
|
+
*/
|
|
19
|
+
export declare const dateIsInvalid: ScanRule;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Barrel File
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Re‑exports all scanner modules, providing a single,
|
|
7
|
+
* consolidated entry point for the scanning subsystem.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
export { scanForSentinels } from './any/scan-for-sentinels';
|
|
12
|
+
export { arrayIsDeep } from './array/array-is-deep';
|
|
13
|
+
export { arrayIsHeterogeneous } from './array/array-is-heterogenous';
|
|
14
|
+
export { arrayIsLarge } from './array/array-is-large';
|
|
15
|
+
export { bigintIsLarge } from './bigint/bigint-is-large';
|
|
16
|
+
export { bigintNotSafe } from './bigint/bigint-not-safe';
|
|
17
|
+
export { dateIsBeforeEpoch } from './date/date-is-before-epoch';
|
|
18
|
+
export { dateIsFarFuture } from './date/date-is-far-future';
|
|
19
|
+
export { dateIsInvalid } from './date/date-is-invalid';
|
|
20
|
+
export { numberIsInfinite } from './number/number-is-infinite';
|
|
21
|
+
export { numberIsNaN } from './number/number-is-nan';
|
|
22
|
+
export { numberIsTooLarge } from './number/number-is-too-large';
|
|
23
|
+
export { numberIsUnsafeInteger } from './number/number-is-unsafe-integer';
|
|
24
|
+
export { objectHasCircularReferences } from './object/object-has-circular-references';
|
|
25
|
+
export { objectHasManyKeys } from './object/object-has-many-keys';
|
|
26
|
+
export { objectIsDeep } from './object/object-is-deep';
|
|
27
|
+
export { stringHasUnsafeUnicode } from './string/string-has-unsafe-unicode';
|
|
28
|
+
export { stringHasWhitespaceEdges } from './string/string-has-whitespace-edges';
|
|
29
|
+
export { stringIsLong } from './string/string-is-long';
|
|
30
|
+
export { unknownNotScannable } from './unknown/unknown-not-scannable';
|
|
31
|
+
export { scanRuleRegistry } from './scanner-registry';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Number Is Infinite
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Flags numeric values that resolve to Infinity, surfacing
|
|
7
|
+
* calculation errors or malformed inputs before they propagate.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ScanRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Flags numeric values that are infinite rather than finite.
|
|
14
|
+
*
|
|
15
|
+
* Infinite values often indicate upstream calculation errors, division
|
|
16
|
+
* anomalies, or malformed input. This rule surfaces them early so downstream
|
|
17
|
+
* logic never assumes a safe, bounded number.
|
|
18
|
+
*/
|
|
19
|
+
export declare const numberIsInfinite: ScanRule;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Number Is NaN
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Detects numeric values that evaluate to NaN, ensuring failed
|
|
7
|
+
* arithmetic or parsing does not silently pass through scanning.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ScanRule } from '../../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Detects numeric values that resolve to NaN.
|
|
14
|
+
*
|
|
15
|
+
* NaN commonly arises from failed arithmetic, invalid parsing, or unexpected
|
|
16
|
+
* coercions. This rule ensures such values are treated as structurally unsafe
|
|
17
|
+
* rather than silently propagating through the scan pipeline.
|
|
18
|
+
*/
|
|
19
|
+
export declare const numberIsNaN: ScanRule;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Scanners | Number Is Too Large
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Warns when a number exceeds a conservative magnitude limit,
|
|
7
|
+
* highlighting values that may indicate corrupted or adversarial
|
|
8
|
+
* input.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import type { ScanRule } from '../../shapes';
|
|
13
|
+
/**
|
|
14
|
+
* Warns when a numeric value exceeds a conservative magnitude threshold.
|
|
15
|
+
*
|
|
16
|
+
* Extremely large numbers can signal corrupted data, unrealistic inputs, or
|
|
17
|
+
* adversarial payloads. This rule highlights values that may cause overflow,
|
|
18
|
+
* precision loss, or performance issues in downstream systems.
|
|
19
|
+
*/
|
|
20
|
+
export declare const numberIsTooLarge: ScanRule;
|