@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
package/README.md
CHANGED
|
@@ -1 +1,132 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Jane IO
|
|
2
|
+
|
|
3
|
+
[](https://gitlab.com/clementine-solution/open-source/jane-io/-/commits/main)
|
|
4
|
+
[](https://gitlab.com/clementine-solution/open-source/jane-io/-/commits/main)
|
|
5
|
+
[](https://www.npmjs.com/package/@clementine-solutions/jane-io)
|
|
6
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
7
|
+
|
|
8
|
+
> A clarity-first boundary system for shaping, validating, and transforming data with full introspection and policy control.
|
|
9
|
+
|
|
10
|
+
Jane IO is a TypeScript-first data validation library that emphasizes **explicit design**, **runtime safety**, and **comprehensive observability**. Unlike traditional validators, Jane treats data processing as a multi-stage pipeline with policy-driven decision making.
|
|
11
|
+
|
|
12
|
+
## Key Features
|
|
13
|
+
|
|
14
|
+
- **Security-First**: Built-in protection against prototype pollution, circular references, and unsafe Unicode
|
|
15
|
+
- **Type-Safe**: Full TypeScript coverage with immutable, composable APIs
|
|
16
|
+
- **Observable**: Rich telemetry, diff tracking, and audit trails
|
|
17
|
+
- **Configurable**: Policy-driven behavior with multiple validation modes
|
|
18
|
+
- **Performant**: Lazy evaluation and efficient data structures
|
|
19
|
+
- **Extensible**: Plugin architecture for custom validators and parsers
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @clementine-solutions/jane-io
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
yarn add @clementine-solutions/jane-io
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm add @clementine-solutions/jane-io
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { jane } from '@clementine-solutions/jane-io';
|
|
39
|
+
|
|
40
|
+
// Simple validation
|
|
41
|
+
const result = await jane.value("hello@example.com")
|
|
42
|
+
.parse("string")
|
|
43
|
+
.matches(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)
|
|
44
|
+
.run();
|
|
45
|
+
|
|
46
|
+
if (result.ok) {
|
|
47
|
+
console.log("Valid email:", result.value);
|
|
48
|
+
} else {
|
|
49
|
+
console.log("Issues:", result.issues);
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Documentation
|
|
54
|
+
|
|
55
|
+
- [Getting Started Guide](https://jane-io.com/docs/getting-started/introduction)
|
|
56
|
+
- [Conceptual Overview](https://jane-io.clementine.solutions/concepts/introduction/)
|
|
57
|
+
|
|
58
|
+
## Use Cases
|
|
59
|
+
|
|
60
|
+
Jane excels at:
|
|
61
|
+
|
|
62
|
+
- **API Data Validation**: Secure processing of external inputs.
|
|
63
|
+
- **Configuration Management**: Structured config validation with audit trails.
|
|
64
|
+
- **Data Transformation Pipelines**: ETL workflows with error tracking.
|
|
65
|
+
- **Form Validation**: Complex multi-field validation scenarios.
|
|
66
|
+
- **Data Import/Export**: Safe handling of structured data.
|
|
67
|
+
|
|
68
|
+
## Architecture
|
|
69
|
+
|
|
70
|
+
Jane's pipeline processes data through distinct stages:
|
|
71
|
+
|
|
72
|
+
```mermaid
|
|
73
|
+
graph LR
|
|
74
|
+
A[Raw Input] --> B[Contain]
|
|
75
|
+
B --> C[Scan]
|
|
76
|
+
C --> D[Normalize]
|
|
77
|
+
D --> E[Parse]
|
|
78
|
+
E --> F[Validate]
|
|
79
|
+
F --> G[Policy]
|
|
80
|
+
G --> H[Result]
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
- **Contain**: Structural safety and sanitization.
|
|
84
|
+
- **Scan**: Analysis and hazard detection.
|
|
85
|
+
- **Normalize**: Data hygiene and standardization.
|
|
86
|
+
- **Parse**: Semantic interpretation.
|
|
87
|
+
- **Validate**: Business rule enforcement.
|
|
88
|
+
- **Policy**: Decision-making and observability.
|
|
89
|
+
|
|
90
|
+
## Security Features
|
|
91
|
+
|
|
92
|
+
- **Structural Hazard Detection**: Identifies circular references, excessive depth, and unsafe structures.
|
|
93
|
+
- **Unicode Safety**: Detects and handles bidirectional control characters.
|
|
94
|
+
- **Prototype Pollution Prevention**: Safe property access and key filtering.
|
|
95
|
+
- **Containment Sentinels**: Safe representation of dangerous values.
|
|
96
|
+
- **Immutable Processing**: No side effects or data mutation.
|
|
97
|
+
|
|
98
|
+
## Observability
|
|
99
|
+
|
|
100
|
+
Jane provides comprehensive introspection:
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
const result = await jane.value(data)
|
|
104
|
+
.withDiff() // Track changes
|
|
105
|
+
.withExplain() // Explain decisions
|
|
106
|
+
.withReplay() // Reconstruct transformations
|
|
107
|
+
.withTelemetry(sink) // Custom telemetry
|
|
108
|
+
.run();
|
|
109
|
+
|
|
110
|
+
// Access detailed metadata
|
|
111
|
+
console.log(result.metadata);
|
|
112
|
+
console.log(result.diff);
|
|
113
|
+
console.log(result.explain);
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## License
|
|
117
|
+
|
|
118
|
+
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.
|
|
119
|
+
|
|
120
|
+
## Acknowledgments
|
|
121
|
+
|
|
122
|
+
Jane IO is built with care for the developer experience and runtime safety. Special thanks to the TypeScript community and the broader JavaScript ecosystem for inspiration and tooling.
|
|
123
|
+
|
|
124
|
+
## Support
|
|
125
|
+
|
|
126
|
+
- **Issues**: [GitLab Issues](https://gitlab.com/clementine-solution/open-source/jane-io/issues)
|
|
127
|
+
- **Discussions**: [GitLab Discussions](https://gitlab.com/clementine-solution/open-source/jane-io/discussions)
|
|
128
|
+
- **Documentation**: [Jane IO Docs](https://jane-io.com/)
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
**Jane IO** - Data validation with clarity and confidence.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Analysis | Diff
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Structural diff utilities used to compare safe and
|
|
7
|
+
* normalized values.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { DiffEntry, DiffFunction, FieldPath, JsonValue, PipelineBuilder } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Computes a structural diff between two JSON‑compatible values.
|
|
14
|
+
*
|
|
15
|
+
* Delegates all traversal to `walkDiff`, collecting every change into a flat
|
|
16
|
+
* list of diff entries rooted at the top‑level path. Always returns a stable
|
|
17
|
+
* `{ entries }` object with no filtering or interpretation.
|
|
18
|
+
*/
|
|
19
|
+
export declare const diff: DiffFunction;
|
|
20
|
+
/**
|
|
21
|
+
* Recursively walks two JSON‑compatible values and records structural changes.
|
|
22
|
+
*
|
|
23
|
+
* Compares primitives, arrays, and plain objects by shape and content, emitting
|
|
24
|
+
* diff entries at each divergent path. Keys and indices are traversed in a
|
|
25
|
+
* stable order, and non‑object mismatches are treated as direct value changes.
|
|
26
|
+
* All entries are appended to `out`; no filtering or interpretation occurs here.
|
|
27
|
+
*/
|
|
28
|
+
export declare function walkDiff(before: JsonValue | undefined, after: JsonValue | undefined, path: FieldPath, out: DiffEntry[]): void;
|
|
29
|
+
/**
|
|
30
|
+
* Runs the pipeline and returns its computed diff.
|
|
31
|
+
*
|
|
32
|
+
* Delegates execution to the provided builder and exposes only the diff
|
|
33
|
+
* portion of the result. No additional processing or filtering occurs here.
|
|
34
|
+
*/
|
|
35
|
+
export declare function runDiff<T>(builder: PipelineBuilder): Promise<import("../shapes").DiffResult | undefined>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Analysis | Explain
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Builds a human‑readable narrative of all pipeline events in
|
|
7
|
+
* order.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { ExplainFunction, PipelineBuilder } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Builds a linear explanation of all pipeline events.
|
|
14
|
+
*
|
|
15
|
+
* Emits scan hazards, normalization events, diff entries, parse changes, and
|
|
16
|
+
* validation errors in pipeline order. Each event is mapped to a stable
|
|
17
|
+
* ExplainStep with its path, stage, kind, code, and message. No filtering or
|
|
18
|
+
* interpretation occurs; this is a direct narrative of what the pipeline saw.
|
|
19
|
+
*/
|
|
20
|
+
export declare const explain: ExplainFunction;
|
|
21
|
+
/**
|
|
22
|
+
* Formats a value for human‑readable explain output.
|
|
23
|
+
*
|
|
24
|
+
* Produces stable string representations for primitives and falls back to
|
|
25
|
+
* compact JSON for objects. Never throws; errors during formatting degrade
|
|
26
|
+
* gracefully to `String(value)`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function format(value: unknown): string;
|
|
29
|
+
/**
|
|
30
|
+
* Runs the pipeline and returns its explain output.
|
|
31
|
+
*
|
|
32
|
+
* Delegates execution to the provided builder and exposes only the explain
|
|
33
|
+
* portion of the result. No additional processing or reshaping occurs here.
|
|
34
|
+
*/
|
|
35
|
+
export declare function runExplain<T>(builder: PipelineBuilder): Promise<import("../shapes").ExplainResult | undefined>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Analysis | Barrel File
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Re‑exports the public Analysis modules (Diff, Explain,
|
|
7
|
+
* Replay, Telemetry).
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
export { diff, walkDiff, runDiff } from './diff';
|
|
12
|
+
export { explain, format, runExplain } from './explain';
|
|
13
|
+
export { applyEntry, replay, runReplay } from './replay';
|
|
14
|
+
export { runTelemetry, telemetry } from './telemetry';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Analysis | Replay
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Reconstructs intermediate states by applying diff entries
|
|
7
|
+
* in order.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { DiffEntry, InternalJsonValue, PipelineBuilder, ReplayFunction } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Applies a single diff entry to an internal JSON value.
|
|
14
|
+
*
|
|
15
|
+
* Clones the current state, then sets or clears the value at the entry’s path
|
|
16
|
+
* according to its kind. Used by Replay to advance state one change at a time.
|
|
17
|
+
* Never mutates the original state.
|
|
18
|
+
*/
|
|
19
|
+
export declare function applyEntry(state: InternalJsonValue, entry: DiffEntry): InternalJsonValue;
|
|
20
|
+
/**
|
|
21
|
+
* Replays a diff step‑by‑step to reconstruct intermediate states.
|
|
22
|
+
*
|
|
23
|
+
* Clones the initial value, applies each diff entry in order, and records a
|
|
24
|
+
* snapshot after every application. Produces a stable sequence of ReplayStep
|
|
25
|
+
* objects with index, entry, and resulting state. Never mutates inputs.
|
|
26
|
+
*/
|
|
27
|
+
export declare const replay: ReplayFunction;
|
|
28
|
+
/**
|
|
29
|
+
* Runs the pipeline and returns its replay output.
|
|
30
|
+
*
|
|
31
|
+
* Delegates execution to the provided builder and exposes only the replay
|
|
32
|
+
* portion of the result. No additional processing or transformation occurs.
|
|
33
|
+
*/
|
|
34
|
+
export declare function runReplay<T>(builder: PipelineBuilder): Promise<import("../shapes").ReplayResult | undefined>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Analysis | Telemetry
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Emits structured records for each pipeline stage for
|
|
7
|
+
* auditing and observability.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { PipelineBuilder, PipelineResult, TelemetryContext, TelemetryResult, TelemetrySink } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Collects flat telemetry records for each pipeline stage.
|
|
14
|
+
*
|
|
15
|
+
* Emits one record per stage with boundary, pipeline, timestamp, and the
|
|
16
|
+
* stage‑specific payload (events, diff, explain, replay). Stages are reported
|
|
17
|
+
* in pipeline order, and a final `decide` record captures the policy outcome.
|
|
18
|
+
* No aggregation, filtering, or interpretation occurs here.
|
|
19
|
+
*/
|
|
20
|
+
export declare function telemetry<T>(ctx: TelemetryContext<T>): TelemetryResult;
|
|
21
|
+
/**
|
|
22
|
+
* Runs the pipeline and emits telemetry if enabled by policy.
|
|
23
|
+
*
|
|
24
|
+
* Delegates execution to the builder, collects stage records through the
|
|
25
|
+
* telemetry helper, and forwards them to the provided sink. Returns the full
|
|
26
|
+
* pipeline result unchanged.
|
|
27
|
+
*/
|
|
28
|
+
export declare function runTelemetry<T>(builder: PipelineBuilder, sink: TelemetrySink): Promise<PipelineResult<T>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | At Most One
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Ensures that no more than one of the specified fields is
|
|
7
|
+
* accepted. If multiple fields are present, a boundary error
|
|
8
|
+
* is emitted.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import type { BoundaryRule } from '../shapes';
|
|
13
|
+
/**
|
|
14
|
+
* Ensures that at most one of the specified fields is accepted. If more than
|
|
15
|
+
* one field is present, a boundary‑level error is emitted.
|
|
16
|
+
*/
|
|
17
|
+
export declare function atMostOne(...keys: string[]): BoundaryRule;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | Conditionally Required
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Requires a set of fields when a controlling field matches a
|
|
7
|
+
* specific value. Missing or rejected fields trigger
|
|
8
|
+
* boundary‑level errors.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import type { BoundaryRule } from '../shapes';
|
|
13
|
+
/**
|
|
14
|
+
* Requires a set of fields when a controlling field matches a specific value.
|
|
15
|
+
* If the condition is met and any required field is missing or rejected, an
|
|
16
|
+
* error is emitted for each missing field.
|
|
17
|
+
*/
|
|
18
|
+
export declare function conditionallyRequired(typeKey: string, typeValue: unknown, ...required: string[]): BoundaryRule;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | Date Range
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Validates that a start and end date form a proper
|
|
7
|
+
* chronological range. Emits an error when the start occurs
|
|
8
|
+
* after the end.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import type { BoundaryRule } from '../shapes';
|
|
13
|
+
/**
|
|
14
|
+
* Validates that a start/end date pair forms a proper chronological range.
|
|
15
|
+
* Emits an error when both fields are dates and the start occurs after the end.
|
|
16
|
+
*/
|
|
17
|
+
export declare function dateRange(startKey: string, endKey: string): BoundaryRule;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | Barrel File
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Re‑exports shared boundary rules to provide a stable,
|
|
7
|
+
* minimal entry point for internal consumers. This file
|
|
8
|
+
* exposes no logic of its own.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
export { atMostOne } from './at-most-one';
|
|
13
|
+
export { conditionallyRequired } from './conditionally-required';
|
|
14
|
+
export { dateRange } from './date-range';
|
|
15
|
+
export { mutuallyExclusive } from './mutually-exclusive';
|
|
16
|
+
export { noUnknownFields } from './no-unknown-fields';
|
|
17
|
+
export { requireAll } from './require-all';
|
|
18
|
+
export { requireOne } from './require-one';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | Mutually Exclusive
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Enforces that two fields cannot both be accepted. If both
|
|
7
|
+
* appear, a mutual‑exclusion boundary error is produced.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { BoundaryRule } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Enforces mutual exclusion between two fields. If both fields are accepted,
|
|
14
|
+
* a boundary‑level error is emitted indicating the conflict.
|
|
15
|
+
*/
|
|
16
|
+
export declare function mutuallyExclusive(a: string, b: string): BoundaryRule;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | No Unknown Fields
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Ensures that only explicitly allowed fields appear in the
|
|
7
|
+
* boundary input. Any unknown key results in a boundary error.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { BoundaryRule } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Ensures that only the explicitly allowed fields appear in the boundary
|
|
14
|
+
* input. Any field not listed is treated as an unknown key and produces a
|
|
15
|
+
* boundary‑level error.
|
|
16
|
+
*/
|
|
17
|
+
export declare function noUnknownFields(...allowed: string[]): BoundaryRule;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | Require All
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Requires that all specified fields be present and accepted.
|
|
7
|
+
* Missing or rejected fields each produce a boundary error.
|
|
8
|
+
* @see https://jane-io.com
|
|
9
|
+
* ----------------------------------------------------------------------------
|
|
10
|
+
*/
|
|
11
|
+
import type { BoundaryRule } from '../shapes';
|
|
12
|
+
/**
|
|
13
|
+
* Requires that all specified fields be present and accepted. Any missing or
|
|
14
|
+
* rejected field results in a boundary‑level error for that key.
|
|
15
|
+
*/
|
|
16
|
+
export declare function requireAll(...keys: string[]): BoundaryRule;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Boundary Rules | Require One
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Requires that at least one of the specified fields be
|
|
7
|
+
* accepted. If none are present, a single boundary error is
|
|
8
|
+
* emitted.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import type { BoundaryRule } from '../shapes';
|
|
13
|
+
/**
|
|
14
|
+
* Requires that at least one of the specified fields be present and accepted.
|
|
15
|
+
* If none are provided, a single boundary‑level error is emitted.
|
|
16
|
+
*/
|
|
17
|
+
export declare function requireOne(...keys: string[]): BoundaryRule;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Common | Events
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Shared event types, factories, and helpers used across all
|
|
7
|
+
* pipeline stages. These modules define how Jane records and
|
|
8
|
+
* communicates observable facts during execution.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import type { EventCode, EventKind, FieldPath, JaneEvent, PipelinePhase } from '../shapes';
|
|
13
|
+
/**
|
|
14
|
+
* Creates a frozen JaneEvent with consistent metadata.
|
|
15
|
+
*
|
|
16
|
+
* This factory centralizes event construction so all stages emit the same
|
|
17
|
+
* shape: stable identifiers, optional context, and a metadata block that
|
|
18
|
+
* tooling can rely on. Callers provide only the facts; the factory attaches
|
|
19
|
+
* timestamps and prepares the object for safe sharing across the pipeline.
|
|
20
|
+
*
|
|
21
|
+
* The returned event is immutable to prevent accidental mutation during
|
|
22
|
+
* scan, parse, normalize, validate, boundary, or policy execution.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createEvent(phase: PipelinePhase, kind: EventKind, code: EventCode, path?: FieldPath, message?: string, userMessage?: string, meta?: Record<string, unknown>): JaneEvent;
|
|
25
|
+
/**
|
|
26
|
+
* Structural type guard for JaneEvent.
|
|
27
|
+
*
|
|
28
|
+
* This check verifies that a value has the minimal shape required for an
|
|
29
|
+
* event: a valid phase, kind, code, and optional context fields. It does not
|
|
30
|
+
* validate semantics or metadata—only that the object is structurally safe to
|
|
31
|
+
* treat as a JaneEvent inside the pipeline.
|
|
32
|
+
*
|
|
33
|
+
* The guard is intentionally strict and literal. It accepts only the phases
|
|
34
|
+
* and kinds defined here, ensuring that stray or misspelled values cannot
|
|
35
|
+
* enter policy, explain, or replay logic.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isJaneEvent(value: unknown): value is JaneEvent;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Common | Fluent
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Internal helpers that build Jane’s fluent API surface.
|
|
7
|
+
* These modules attach parser and validator methods and wrap
|
|
8
|
+
* PipelineBuilder instances into the public pipeline.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
import type { BoundaryResult, FieldPath, JaneBoundaryResult, JaneResult, PipelineBuilder, PipelineResult, PublicPipeline } from '../shapes';
|
|
13
|
+
import type { PolicyInput } from '../shapes/policy';
|
|
14
|
+
/**
|
|
15
|
+
* Internal hook used to associate a PipelineBuilder with a PublicPipeline.
|
|
16
|
+
*
|
|
17
|
+
* The unique symbol prevents accidental collisions with user code and keeps
|
|
18
|
+
* the builder hidden from the public API. Only internal helpers read or
|
|
19
|
+
* write this property, and it is never surfaced to consumers.
|
|
20
|
+
*
|
|
21
|
+
* PublicPipelineInternal exists solely to give internal code a typed way to
|
|
22
|
+
* access the builder without widening the public interface.
|
|
23
|
+
*/
|
|
24
|
+
declare const BUILDER: unique symbol;
|
|
25
|
+
export type PublicPipelineInternal = PublicPipeline & {
|
|
26
|
+
[BUILDER]?: PipelineBuilder;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Attaches fluent validator methods directly to a PipelineBuilder.
|
|
30
|
+
*
|
|
31
|
+
* Each validator in the registry becomes a fluent method on the builder.
|
|
32
|
+
* Calls record the validator request on the current builder and return the
|
|
33
|
+
* same builder instance, allowing internal code to compose validation steps
|
|
34
|
+
* without wrapping or producing a new public pipeline.
|
|
35
|
+
*
|
|
36
|
+
* Methods are non‑enumerable and immutable so the builder’s shape stays
|
|
37
|
+
* stable and free of accidental overrides.
|
|
38
|
+
*/
|
|
39
|
+
export declare function attachFluentValidators(builder: PipelineBuilder): void;
|
|
40
|
+
/**
|
|
41
|
+
* Attaches fluent parser methods directly to a PipelineBuilder.
|
|
42
|
+
*
|
|
43
|
+
* Each parser in the registry becomes a fluent method on the builder. Calls
|
|
44
|
+
* record the parser request on the current builder and return the same
|
|
45
|
+
* builder instance, allowing internal code to compose parse steps without
|
|
46
|
+
* wrapping or producing a new public pipeline.
|
|
47
|
+
*
|
|
48
|
+
* Methods are non‑enumerable and immutable so the builder’s shape stays
|
|
49
|
+
* stable and free of accidental overrides.
|
|
50
|
+
*/
|
|
51
|
+
export declare function attachFluentParsers(builder: PipelineBuilder): void;
|
|
52
|
+
/**
|
|
53
|
+
* Creates a policy‑aware Jane instance.
|
|
54
|
+
*
|
|
55
|
+
* Normalizes the base policy, wraps pipeline builders with the public API,
|
|
56
|
+
* and wires in analysis features (diff, explain, replay, telemetry) according
|
|
57
|
+
* to the active policy. Each fluent call returns a new wrapped builder, keeping
|
|
58
|
+
* the pipeline immutable and policy‑driven end‑to‑end.
|
|
59
|
+
*/
|
|
60
|
+
export declare function createJane(basePolicyInput: PolicyInput): {
|
|
61
|
+
value(raw: unknown, path?: FieldPath, options?: {
|
|
62
|
+
inputName?: string;
|
|
63
|
+
}): PublicPipeline;
|
|
64
|
+
boundary<TShape extends Record<string, PublicPipeline>>(shape: TShape): Promise<{
|
|
65
|
+
policy: import("../shapes").Policy;
|
|
66
|
+
ok: boolean;
|
|
67
|
+
issues?: readonly import("../shapes").JaneEvent[];
|
|
68
|
+
events?: readonly import("../shapes").JaneEvent[];
|
|
69
|
+
values?: Record<string, unknown> | undefined;
|
|
70
|
+
fields: Record<string, JaneResult<unknown>>;
|
|
71
|
+
metadata: {
|
|
72
|
+
runId?: string;
|
|
73
|
+
startedAt?: string;
|
|
74
|
+
finishedAt?: string;
|
|
75
|
+
durationMs?: number;
|
|
76
|
+
fields: Record<string, import("../shapes").FieldMetadata>;
|
|
77
|
+
};
|
|
78
|
+
}>;
|
|
79
|
+
withPolicy(input: PolicyInput): /*elided*/ any;
|
|
80
|
+
strictBoundary<TShape extends Record<string, PublicPipeline>>(shape: TShape): Promise<{
|
|
81
|
+
policy: import("../shapes").Policy;
|
|
82
|
+
ok: boolean;
|
|
83
|
+
issues?: readonly import("../shapes").JaneEvent[];
|
|
84
|
+
events?: readonly import("../shapes").JaneEvent[];
|
|
85
|
+
values?: Record<string, unknown> | undefined;
|
|
86
|
+
fields: Record<string, JaneResult<unknown>>;
|
|
87
|
+
metadata: {
|
|
88
|
+
runId?: string;
|
|
89
|
+
startedAt?: string;
|
|
90
|
+
finishedAt?: string;
|
|
91
|
+
durationMs?: number;
|
|
92
|
+
fields: Record<string, import("../shapes").FieldMetadata>;
|
|
93
|
+
};
|
|
94
|
+
}>;
|
|
95
|
+
laxBoundary<TShape extends Record<string, PublicPipeline>>(shape: TShape): Promise<{
|
|
96
|
+
policy: import("../shapes").Policy;
|
|
97
|
+
ok: boolean;
|
|
98
|
+
issues?: readonly import("../shapes").JaneEvent[];
|
|
99
|
+
events?: readonly import("../shapes").JaneEvent[];
|
|
100
|
+
values?: Record<string, unknown> | undefined;
|
|
101
|
+
fields: Record<string, JaneResult<unknown>>;
|
|
102
|
+
metadata: {
|
|
103
|
+
runId?: string;
|
|
104
|
+
startedAt?: string;
|
|
105
|
+
finishedAt?: string;
|
|
106
|
+
durationMs?: number;
|
|
107
|
+
fields: Record<string, import("../shapes").FieldMetadata>;
|
|
108
|
+
};
|
|
109
|
+
}>;
|
|
110
|
+
defaultBoundary<TShape extends Record<string, PublicPipeline>>(shape: TShape): Promise<{
|
|
111
|
+
policy: import("../shapes").Policy;
|
|
112
|
+
ok: boolean;
|
|
113
|
+
issues?: readonly import("../shapes").JaneEvent[];
|
|
114
|
+
events?: readonly import("../shapes").JaneEvent[];
|
|
115
|
+
values?: Record<string, unknown> | undefined;
|
|
116
|
+
fields: Record<string, JaneResult<unknown>>;
|
|
117
|
+
metadata: {
|
|
118
|
+
runId?: string;
|
|
119
|
+
startedAt?: string;
|
|
120
|
+
finishedAt?: string;
|
|
121
|
+
durationMs?: number;
|
|
122
|
+
fields: Record<string, import("../shapes").FieldMetadata>;
|
|
123
|
+
};
|
|
124
|
+
}>;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Creates a Jane instance with a normalized base policy and the full fluent API.
|
|
128
|
+
*
|
|
129
|
+
* The factory wraps a PipelineBuilder and exposes a stable, user‑facing
|
|
130
|
+
* pipeline surface. Each fluent call produces a new wrapped builder, while
|
|
131
|
+
* root‑level helpers (value, boundary, withPolicy) create new Jane instances
|
|
132
|
+
* with merged policy state.
|
|
133
|
+
*
|
|
134
|
+
* The wrapper isolates internal builder mechanics from consumers, attaches
|
|
135
|
+
* parser and validator methods from the registry, and ensures that telemetry,
|
|
136
|
+
* diff, explain, replay, and boundary behavior all flow through a consistent
|
|
137
|
+
* entry point. All policy resolution happens here so contributors can reason
|
|
138
|
+
* about effective behavior without tracing through individual pipeline steps.
|
|
139
|
+
*/
|
|
140
|
+
export declare function toJaneResult<T>(r: PipelineResult<T>): JaneResult<T>;
|
|
141
|
+
/**
|
|
142
|
+
* Converts an internal BoundaryResult and its field-level PipelineResults
|
|
143
|
+
* into the public JaneBoundaryResult shape.
|
|
144
|
+
*
|
|
145
|
+
* Each pipeline result is first converted to a JaneResult, then assembled
|
|
146
|
+
* alongside the boundary’s own decision, issues, events, values, and metadata.
|
|
147
|
+
* No interpretation or rewriting occurs here—this function preserves the
|
|
148
|
+
* boundary runner’s output exactly while projecting it into the public API.
|
|
149
|
+
*/
|
|
150
|
+
export declare function toJaneBoundaryResult(boundary: BoundaryResult, pipelines: Record<string, PipelineResult<unknown>>): JaneBoundaryResult<Record<string, unknown>>;
|
|
151
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ----------------------------------------------------------------------------
|
|
3
|
+
* Common | Barrel File
|
|
4
|
+
* ----------------------------------------------------------------------------
|
|
5
|
+
* @package @clementine-solutions/jane
|
|
6
|
+
* @description Re‑exports shared common modules to provide a stable,
|
|
7
|
+
* minimal entry point for internal consumers. This file
|
|
8
|
+
* exposes no logic of its own.
|
|
9
|
+
* @see https://jane-io.com
|
|
10
|
+
* ----------------------------------------------------------------------------
|
|
11
|
+
*/
|
|
12
|
+
export { createEvent, isJaneEvent } from './events';
|
|
13
|
+
export { attachFluentParsers, attachFluentValidators, createJane, toJaneBoundaryResult, toJaneResult, } from './fluent';
|
|
14
|
+
export { applyEscalate, applyOverride, boundaryPolicyDefault, boundaryPolicyLax, boundaryPolicyStrict, clampSeverityIndex, compileSeverityMap, decideEvent, defaultPolicy, laxPolicy, normalizePolicy, mergeBoundaryPolicies, policyDecision, resolveLevel, resolvePolicy, severityIndex, SEVERITY_ORDER, strictPolicy, } from './policy';
|
|
15
|
+
export { deepEqual, generateRunId, isObject, isPlainObject, isPrimitive, safeStringify, } from './utilities';
|
|
16
|
+
export { compileWildcard, getCompiledWildcard, matchesWildcard } from './wildcard';
|