@gravito/mass 1.0.0-beta.1 → 2.0.0

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.js CHANGED
@@ -5,8 +5,8 @@ import * as Schema from "@sinclair/typebox";
5
5
 
6
6
  // src/validator.ts
7
7
  import { tbValidator } from "@hono/typebox-validator";
8
- function validate(source, schema) {
9
- return tbValidator(source, schema);
8
+ function validate(source, schema, hook) {
9
+ return tbValidator(source, schema, hook);
10
10
  }
11
11
  export {
12
12
  tbValidator2 as validator,
@@ -11,9 +11,10 @@ export type ValidationSource = 'json' | 'query' | 'param' | 'form';
11
11
  *
12
12
  * @param source - Validation source (json, query, param, form)
13
13
  * @param schema - TypeBox Schema
14
+ * @param hook - Optional callback to handle validation results
14
15
  * @returns Photon middleware handler that validates the request.
15
16
  */
16
- export declare function validate<T extends TSchema, S extends ValidationSource, E extends Env = any, P extends string = any>(source: S, schema: T): MiddlewareHandler<E, P, {
17
+ export declare function validate<T extends TSchema, S extends ValidationSource, E extends Env = any, P extends string = any>(source: S, schema: T, hook?: (result: any, c: any) => any): MiddlewareHandler<E, P, {
17
18
  in: {
18
19
  [K in S]: Static<T>;
19
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAE7D,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAExD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;AAElE;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CACtB,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,gBAAgB,EAC1B,CAAC,SAAS,GAAG,GAAG,GAAG,EACnB,CAAC,SAAS,MAAM,GAAG,GAAG,EAEtB,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,CAAC,GACR,iBAAiB,CAClB,CAAC,EACD,CAAC,EACD;IACE,EAAE,EAAE;SAAG,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;KAAE,CAAA;IAC3B,GAAG,EAAE;SAAG,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;KAAE,CAAA;CAC7B,CACF,CAEA"}
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/validator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAE7D,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAExD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;AAElE;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CACtB,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,gBAAgB,EAC1B,CAAC,SAAS,GAAG,GAAG,GAAG,EACnB,CAAC,SAAS,MAAM,GAAG,GAAG,EAEtB,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,CAAC,EACT,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,GAAG,GAClC,iBAAiB,CAClB,CAAC,EACD,CAAC,EACD;IACE,EAAE,EAAE;SAAG,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;KAAE,CAAA;IAC3B,GAAG,EAAE;SAAG,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;KAAE,CAAA;CAC7B,CACF,CAEA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravito/mass",
3
- "version": "1.0.0-beta.1",
3
+ "version": "2.0.0",
4
4
  "description": "TypeBox-based validation for Gravito - High-performance schema validation with full TypeScript support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -16,9 +16,11 @@
16
16
  ],
17
17
  "scripts": {
18
18
  "build": "bun run build.ts",
19
- "typecheck": "tsc --noEmit",
19
+ "typecheck": "bun tsc -p tsconfig.json --noEmit --skipLibCheck",
20
20
  "test": "bun test",
21
- "prepublishOnly": "bun run build"
21
+ "prepublishOnly": "bun run build",
22
+ "test:coverage": "bun test --coverage --coverage-threshold=80",
23
+ "test:ci": "bun test --coverage --coverage-threshold=80"
22
24
  },
23
25
  "publishConfig": {
24
26
  "access": "public"
@@ -28,12 +30,12 @@
28
30
  "@sinclair/typebox": "^0.34.0"
29
31
  },
30
32
  "peerDependencies": {
31
- "gravito-core": "1.0.0-beta.6"
33
+ "@gravito/core": "workspace:*"
32
34
  },
33
35
  "devDependencies": {
34
36
  "bun-types": "^1.1.0",
35
- "@gravito/photon": "1.0.0-beta.1",
36
- "typescript": "^5.0.0"
37
+ "@gravito/photon": "workspace:*",
38
+ "typescript": "^5.9.3"
37
39
  },
38
40
  "author": "Carl Lee <carllee0520@gmail.com>",
39
41
  "license": "MIT",
@@ -51,4 +53,4 @@
51
53
  "typescript"
52
54
  ],
53
55
  "homepage": "https://github.com/gravito-framework/gravito#readme"
54
- }
56
+ }