@fjell/validation 4.4.4 → 4.4.6
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/LICENSE +1 -1
- package/guide/index.md +30 -0
- package/guide/integration.md +32 -0
- package/guide/usage.md +40 -0
- package/package.json +4 -4
package/LICENSE
CHANGED
|
@@ -187,7 +187,7 @@
|
|
|
187
187
|
same "printed page" as the copyright notice for easier
|
|
188
188
|
identification within third-party archives.
|
|
189
189
|
|
|
190
|
-
Copyright
|
|
190
|
+
Copyright 2026 Tim O'Brien
|
|
191
191
|
|
|
192
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
193
|
you may not use this file except in compliance with the License.
|
package/guide/index.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @fjell/validation - Agentic Guide
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Validation utilities for keys, item payloads, schema constraints, and location metadata.
|
|
6
|
+
|
|
7
|
+
This guide is optimized for AI-assisted code generation and integration workflows.
|
|
8
|
+
|
|
9
|
+
## Documentation
|
|
10
|
+
|
|
11
|
+
- **[Usage Guide](./usage.md)** - API-oriented usage patterns and model-safe examples
|
|
12
|
+
- **[Integration Guide](./integration.md)** - Architecture placement, composition rules, and implementation guidance
|
|
13
|
+
|
|
14
|
+
## Key Capabilities
|
|
15
|
+
|
|
16
|
+
- Validates primary and contained key shapes before persistence operations
|
|
17
|
+
- Checks location metadata and schema-level constraints
|
|
18
|
+
- Returns structured validation errors for API and UI layers
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install @fjell/validation
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Public API Highlights
|
|
27
|
+
|
|
28
|
+
- `validateKey`, `validatePriKey`, `validateComKey`
|
|
29
|
+
- `validatePK`, `validateKeys`, `validateLocations`
|
|
30
|
+
- `validateSchema` and `ValidationError` for schema-driven validation
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Integration Guide
|
|
2
|
+
|
|
3
|
+
Guide for integrating `@fjell/validation` into larger Fjell-based systems.
|
|
4
|
+
|
|
5
|
+
## Where It Fits
|
|
6
|
+
|
|
7
|
+
Validation utilities for keys, item payloads, schema constraints, and location metadata.
|
|
8
|
+
|
|
9
|
+
## Recommended Integration Pattern
|
|
10
|
+
|
|
11
|
+
- Run validation at API boundaries before calling @fjell/lib or backend libraries
|
|
12
|
+
- Convert validation failures into deterministic HTTP error payloads
|
|
13
|
+
- Use the same validation functions in tests to keep fixtures aligned with runtime rules
|
|
14
|
+
|
|
15
|
+
## System Composition Checklist
|
|
16
|
+
|
|
17
|
+
- Define package boundaries: schema/types, transport, operations, adapters, and UI.
|
|
18
|
+
- Keep contracts stable by sharing @fjell/types interfaces where applicable.
|
|
19
|
+
- Centralize retries/timeouts/logging around infrastructure-facing operations.
|
|
20
|
+
- Validate inputs at API boundaries before invoking persistence or provider layers.
|
|
21
|
+
- Add contract and integration tests for every generated workflow.
|
|
22
|
+
|
|
23
|
+
## Cross-Library Pairings
|
|
24
|
+
|
|
25
|
+
- Pair with @fjell/types for shared contracts.
|
|
26
|
+
- Pair with @fjell/validation for input and schema checks.
|
|
27
|
+
- Pair with @fjell/logging for observability in integration flows.
|
|
28
|
+
- Pair with storage/router/provider packages based on your runtime architecture.
|
|
29
|
+
|
|
30
|
+
## Integration Example Shape
|
|
31
|
+
|
|
32
|
+
Use this package behind an application service layer that exposes stable domain methods. Generated code should call those service methods, not raw infrastructure primitives, unless your architecture intentionally keeps infrastructure at the edge.
|
package/guide/usage.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Usage Guide
|
|
2
|
+
|
|
3
|
+
Comprehensive usage guidance for `@fjell/validation`.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @fjell/validation
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## API Highlights
|
|
12
|
+
|
|
13
|
+
- `validateKey`, `validatePriKey`, `validateComKey`
|
|
14
|
+
- `validatePK`, `validateKeys`, `validateLocations`
|
|
15
|
+
- `validateSchema` and `ValidationError` for schema-driven validation
|
|
16
|
+
|
|
17
|
+
## Quick Example
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { validatePriKey, ValidationError } from "@fjell/validation";
|
|
21
|
+
|
|
22
|
+
const result = validatePriKey({ pk: "widget#123", sk: "meta" });
|
|
23
|
+
if (!result.valid) {
|
|
24
|
+
throw new ValidationError("Invalid key", result.errors);
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Model Consumption Rules
|
|
29
|
+
|
|
30
|
+
1. Import from the package root (`@fjell/validation`) instead of deep-internal paths unless explicitly documented.
|
|
31
|
+
2. Keep usage aligned with exported public symbols listed in this guide.
|
|
32
|
+
3. Prefer explicit typing at package boundaries so generated code remains robust during upgrades.
|
|
33
|
+
4. Keep error handling deterministic and map infrastructure failures into domain-level errors.
|
|
34
|
+
5. Co-locate integration wrappers in your app so model-generated code has one canonical entry point.
|
|
35
|
+
|
|
36
|
+
## Best Practices
|
|
37
|
+
|
|
38
|
+
- Keep examples and abstractions consistent with existing Fjell package conventions.
|
|
39
|
+
- Favor composable wrappers over one-off inline integration logic.
|
|
40
|
+
- Add targeted tests around generated integration code paths.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fjell/validation",
|
|
3
3
|
"description": "Validation Logic for Fjell Items and Keys",
|
|
4
|
-
"version": "4.4.
|
|
4
|
+
"version": "4.4.6",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"validation",
|
|
7
7
|
"fjell"
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"prepublishOnly": "npm run clean && npm run build"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@fjell/logging": "^4.4.
|
|
31
|
-
"@fjell/types": "4.4.
|
|
30
|
+
"@fjell/logging": "^4.4.72",
|
|
31
|
+
"@fjell/types": "^4.4.9"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@eslint/eslintrc": "^3.3.1",
|
|
35
35
|
"@eslint/js": "^9.39.1",
|
|
36
|
-
"@fjell/common-config": "^1.1.
|
|
36
|
+
"@fjell/common-config": "^1.1.38",
|
|
37
37
|
"@swc/core": "^1.15.2",
|
|
38
38
|
"@tsconfig/recommended": "^1.0.13",
|
|
39
39
|
"@types/luxon": "^3.7.1",
|