@stone-js/validation 0.8.11 → 0.8.13
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/dist/index.d.ts +0 -1
- package/dist/index.js +1 -42
- package/package.json +4 -4
- package/dist/middleware/BlueprintMiddleware.d.ts +0 -18
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export * from './decorators/Validate.js';
|
|
|
6
6
|
export * from './decorators/Validation.js';
|
|
7
7
|
export * from './decorators/ValidationSchema.js';
|
|
8
8
|
export * from './errors/ValidationError.js';
|
|
9
|
-
export * from './middleware/BlueprintMiddleware.js';
|
|
10
9
|
export * from './middleware/validate.js';
|
|
11
10
|
export * from './middleware/ValidateRouteMiddleware.js';
|
|
12
11
|
export * from './options/ValidationBlueprint.js';
|
package/dist/index.js
CHANGED
|
@@ -595,42 +595,6 @@ const MetaValidateRouteMiddleware = {
|
|
|
595
595
|
priority: 5
|
|
596
596
|
};
|
|
597
597
|
|
|
598
|
-
/**
|
|
599
|
-
* Build-phase middleware: collect every class registered with `@ValidationSchema` into the registry.
|
|
600
|
-
*
|
|
601
|
-
* The same scan the router does for its route definitions, applied to this module's own key. After
|
|
602
|
-
* it runs, `stone.validation.schemas` maps each alias to its class, so a route or a handler can name
|
|
603
|
-
* a schema instead of importing it, and `@stone-js/openapi` can walk the registry to publish request
|
|
604
|
-
* schemas without loading anything itself.
|
|
605
|
-
*
|
|
606
|
-
* @param context - The blueprint context.
|
|
607
|
-
* @param next - The next blueprint middleware.
|
|
608
|
-
* @returns The blueprint.
|
|
609
|
-
*/
|
|
610
|
-
async function ValidationSchemaMiddleware(context, next) {
|
|
611
|
-
const registered = context
|
|
612
|
-
.modules
|
|
613
|
-
.filter((module) => hasMetadata(module, VALIDATION_SCHEMA_KEY))
|
|
614
|
-
.reduce((registry, module) => {
|
|
615
|
-
const { alias } = getMetadata(module, VALIDATION_SCHEMA_KEY, {});
|
|
616
|
-
return { ...registry, [alias ?? module.name]: module };
|
|
617
|
-
}, {});
|
|
618
|
-
if (Object.keys(registered).length > 0) {
|
|
619
|
-
context.blueprint.set('stone.validation.schemas', {
|
|
620
|
-
...context.blueprint.get('stone.validation.schemas', {}),
|
|
621
|
-
...registered
|
|
622
|
-
});
|
|
623
|
-
}
|
|
624
|
-
return await next(context);
|
|
625
|
-
}
|
|
626
|
-
/**
|
|
627
|
-
* Meta blueprint middleware for schema discovery.
|
|
628
|
-
*/
|
|
629
|
-
const MetaValidationSchemaMiddleware = {
|
|
630
|
-
module: ValidationSchemaMiddleware,
|
|
631
|
-
priority: 5
|
|
632
|
-
};
|
|
633
|
-
|
|
634
598
|
/**
|
|
635
599
|
* Opt-in blueprint: import and register it to enable validation.
|
|
636
600
|
*
|
|
@@ -644,11 +608,6 @@ const MetaValidationSchemaMiddleware = {
|
|
|
644
608
|
const validationBlueprint = {
|
|
645
609
|
stone: {
|
|
646
610
|
validation: {},
|
|
647
|
-
blueprint: {
|
|
648
|
-
middleware: [
|
|
649
|
-
MetaValidationSchemaMiddleware
|
|
650
|
-
]
|
|
651
|
-
},
|
|
652
611
|
providers: [
|
|
653
612
|
ValidationServiceProvider
|
|
654
613
|
],
|
|
@@ -754,4 +713,4 @@ function validate(rules) {
|
|
|
754
713
|
};
|
|
755
714
|
}
|
|
756
715
|
|
|
757
|
-
export { MetaValidateRouteMiddleware,
|
|
716
|
+
export { MetaValidateRouteMiddleware, VALIDATE_KEY, VALIDATION_SCHEMA_KEY, Validate, ValidateRouteMiddleware, Validation, ValidationError, ValidationSchema, ValidationServiceProvider, Validator, defineValidationSchema, fromStandard, fromZod, isNativeSchema, isSchemaLike, isStandardSchema, isValidationSchema, isValidationSchemaClass, isZodLike, metadataKeyFor, readSource, resolveSchema, rulesOf, toValidationRules, validate, validateEvent, validationBlueprint };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stone-js/validation",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.13",
|
|
4
4
|
"description": "Framework-agnostic input validation for Stone.js. Define a schema once (Zod, Valibot, ArkType — anything Standard Schema) and validate it identically on the backend and the frontend.",
|
|
5
5
|
"author": "Mr. Stone <evensstone@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"node": ">=18.17.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@stone-js/core": "0.8.
|
|
43
|
+
"@stone-js/core": "0.8.13"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@commitlint/cli": "^19.8.1",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"typescript": "^5.6.3",
|
|
63
63
|
"vitest": "^3.2.4",
|
|
64
64
|
"zod": "^3.24.1",
|
|
65
|
-
"@stone-js/core": "0.8.
|
|
65
|
+
"@stone-js/core": "0.8.13"
|
|
66
66
|
},
|
|
67
67
|
"ts-standard": {
|
|
68
68
|
"globals": [
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
]
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@stone-js/config": "0.8.
|
|
78
|
+
"@stone-js/config": "0.8.13"
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|
|
81
81
|
"lint": "ts-standard src",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { BlueprintContext, ClassType, IBlueprint, NextMiddleware, type MetaMiddleware } from '@stone-js/core';
|
|
2
|
-
/**
|
|
3
|
-
* Build-phase middleware: collect every class registered with `@ValidationSchema` into the registry.
|
|
4
|
-
*
|
|
5
|
-
* The same scan the router does for its route definitions, applied to this module's own key. After
|
|
6
|
-
* it runs, `stone.validation.schemas` maps each alias to its class, so a route or a handler can name
|
|
7
|
-
* a schema instead of importing it, and `@stone-js/openapi` can walk the registry to publish request
|
|
8
|
-
* schemas without loading anything itself.
|
|
9
|
-
*
|
|
10
|
-
* @param context - The blueprint context.
|
|
11
|
-
* @param next - The next blueprint middleware.
|
|
12
|
-
* @returns The blueprint.
|
|
13
|
-
*/
|
|
14
|
-
export declare function ValidationSchemaMiddleware(context: BlueprintContext<IBlueprint, ClassType>, next: NextMiddleware<BlueprintContext<IBlueprint, ClassType>, IBlueprint>): Promise<IBlueprint>;
|
|
15
|
-
/**
|
|
16
|
-
* Meta blueprint middleware for schema discovery.
|
|
17
|
-
*/
|
|
18
|
-
export declare const MetaValidationSchemaMiddleware: MetaMiddleware<any, any>;
|