@stone-js/validation 0.8.0 → 0.8.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.
Files changed (3) hide show
  1. package/README.md +10 -3
  2. package/dist/index.js +16 -16
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -1,9 +1,16 @@
1
1
  # Stone.js · Validation
2
2
 
3
- [![npm](https://img.shields.io/npm/v/@stone-js/validation)](https://www.npmjs.com/package/@stone-js/validation)
3
+ [![npm license](https://img.shields.io/npm/l/@stone-js/validation)](https://opensource.org/licenses/MIT)
4
+ [![npm version](https://img.shields.io/npm/v/@stone-js/validation)](https://www.npmjs.com/package/@stone-js/validation)
5
+ [![npm downloads](https://img.shields.io/npm/dm/@stone-js/validation)](https://www.npmjs.com/package/@stone-js/validation)
6
+ ![Maintenance](https://img.shields.io/maintenance/yes/2026)
4
7
  [![CI](https://github.com/stone-foundation/stone-js-framework/actions/workflows/ci.yml/badge.svg)](https://github.com/stone-foundation/stone-js-framework/actions/workflows/ci.yml)
5
- [![Quality Gate](https://sonarcloud.io/api/project_badges/measure?project=stone-foundation_stone-js-framework&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=stone-foundation_stone-js-framework)
6
- [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)
8
+ [![Release](https://github.com/stone-foundation/stone-js-framework/actions/workflows/release.yml/badge.svg)](https://github.com/stone-foundation/stone-js-framework/actions/workflows/release.yml)
9
+ [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=stone-foundation_stone-js-framework&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=stone-foundation_stone-js-framework)
10
+ [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=stone-foundation_stone-js-framework&metric=coverage)](https://sonarcloud.io/summary/new_code?id=stone-foundation_stone-js-framework)
11
+ [![Security Policy](https://img.shields.io/badge/Security-Policy-blue.svg)](https://github.com/stone-foundation/stone-js-framework/blob/main/SECURITY.md)
12
+ [![CodeQL](https://github.com/stone-foundation/stone-js-framework/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/stone-foundation/stone-js-framework/security/code-scanning)
13
+ [![Dependabot Status](https://img.shields.io/badge/Dependabot-enabled-brightgreen.svg)](https://github.com/stone-foundation/stone-js-framework/network/updates)
7
14
  [![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
8
15
 
9
16
  > 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.
package/dist/index.js CHANGED
@@ -105,7 +105,7 @@ function fromStandard(schema) {
105
105
  */
106
106
  function isStandardSchema(value) {
107
107
  const std = value?.['~standard'];
108
- return std !== undefined && std.version === 1 && typeof std.validate === 'function';
108
+ return std?.version === 1 && typeof std?.validate === 'function';
109
109
  }
110
110
 
111
111
  /**
@@ -247,6 +247,21 @@ function validateEvent(event, rules, validator = Validator.create()) {
247
247
  }
248
248
  }
249
249
 
250
+ /**
251
+ * Opt-in blueprint: import and register it to enable validation.
252
+ *
253
+ * It contributes the validation service provider. `stone.providers` is an array, so this merges
254
+ * with the rest of the app rather than replacing anything.
255
+ */
256
+ const validationBlueprint = {
257
+ stone: {
258
+ validation: {},
259
+ providers: [
260
+ ValidationServiceProvider
261
+ ]
262
+ }
263
+ };
264
+
250
265
  /**
251
266
  * Builds a route middleware that validates the event's inputs before the handler runs.
252
267
  *
@@ -268,19 +283,4 @@ function validate(rules) {
268
283
  };
269
284
  }
270
285
 
271
- /**
272
- * Opt-in blueprint: import and register it to enable validation.
273
- *
274
- * It contributes the validation service provider. `stone.providers` is an array, so this merges
275
- * with the rest of the app rather than replacing anything.
276
- */
277
- const validationBlueprint = {
278
- stone: {
279
- validation: {},
280
- providers: [
281
- ValidationServiceProvider
282
- ]
283
- }
284
- };
285
-
286
286
  export { ValidationError, ValidationServiceProvider, Validator, fromStandard, fromZod, isNativeSchema, isStandardSchema, isZodLike, resolveSchema, validate, validateEvent, validationBlueprint };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stone-js/validation",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
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.0"
43
+ "@stone-js/core": "0.8.1"
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.0"
65
+ "@stone-js/core": "0.8.1"
66
66
  },
67
67
  "ts-standard": {
68
68
  "globals": [