@gravito/mass 1.0.0-alpha.5 → 1.0.0-beta.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 CHANGED
@@ -6,7 +6,7 @@ TypeBox-based validation for Gravito. High-performance schema validation with fu
6
6
 
7
7
  - **Fast validation**: TypeBox-powered validators with strong runtime performance
8
8
  - **Full TypeScript support**: Type inference without manual typings
9
- - **Hono integration**: Works seamlessly with Hono validation middleware
9
+ - **Photon integration**: Works seamlessly with Photon validation middleware
10
10
  - **Multiple sources**: Validate JSON, query, params, and form data
11
11
 
12
12
  ## Installation
@@ -20,10 +20,10 @@ bun add @gravito/mass
20
20
  ### JSON validation
21
21
 
22
22
  ```typescript
23
- import { Hono } from 'hono'
23
+ import { Photon } from '@gravito/photon'
24
24
  import { Schema, validate } from '@gravito/mass'
25
25
 
26
- const app = new Hono()
26
+ const app = new Photon()
27
27
 
28
28
  app.post('/login',
29
29
  validate('json', Schema.Object({
@@ -90,16 +90,16 @@ Schema.Number({ minimum: 0, maximum: 100 })
90
90
  Schema.String({ format: 'email' })
91
91
  ```
92
92
 
93
- ## Hono Client Integration
93
+ ## Beam Client Integration
94
94
 
95
95
  When you compose routes with `app.route()`, you get full type inference for the client:
96
96
 
97
97
  ```typescript
98
98
  // app.ts
99
- import { Hono } from 'hono'
99
+ import { Photon } from '@gravito/photon'
100
100
  import { userRoute } from './routes/user'
101
101
 
102
- const app = new Hono()
102
+ const app = new Photon()
103
103
  const routes = app.route('/api/users', userRoute)
104
104
 
105
105
  export default app
@@ -108,11 +108,11 @@ export type AppRoutes = typeof routes
108
108
 
109
109
  ```typescript
110
110
  // client.ts
111
- import { hc } from 'hono/client'
111
+ import { createBeam } from '@gravito/beam'
112
112
  import type { AppRoutes } from './types'
113
113
 
114
114
  export const createClient = (baseUrl: string) => {
115
- return hc<AppRoutes>(baseUrl)
115
+ return createBeam<AppRoutes>(baseUrl)
116
116
  }
117
117
 
118
118
  const client = createClient('http://localhost:3000')
package/README.zh-TW.md CHANGED
@@ -11,10 +11,10 @@ bun add @gravito/mass
11
11
  ## 快速開始
12
12
 
13
13
  ```typescript
14
- import { Hono } from 'hono'
14
+ import { Photon } from '@gravito/photon'
15
15
  import { Schema, validate } from '@gravito/mass'
16
16
 
17
- const app = new Hono()
17
+ const app = new Photon()
18
18
 
19
19
  app.post('/login',
20
20
  validate('json', Schema.Object({
@@ -6,10 +6,10 @@
6
6
  *
7
7
  * @example
8
8
  * ```typescript
9
- * import { Hono } from 'hono'
9
+ * import { Photon } from '@gravito/photon'
10
10
  * import { Schema, validate } from '@gravito/mass'
11
11
  *
12
- * const app = new Hono()
12
+ * const app = new Photon()
13
13
  *
14
14
  * app.post('/login',
15
15
  * validate('json', Schema.Object({
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,WAAW,IAAI,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGlE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAG3C,OAAO,EAAE,KAAK,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA"}
@@ -1,5 +1,5 @@
1
+ import type { Env, MiddlewareHandler } from '@gravito/photon';
1
2
  import type { Static, TSchema } from '@sinclair/typebox';
2
- import type { Env, MiddlewareHandler } from 'hono';
3
3
  /**
4
4
  * Validation source type.
5
5
  */
@@ -11,7 +11,7 @@ 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
- * @returns Hono middleware handler that validates the request.
14
+ * @returns Photon middleware handler that validates the request.
15
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
17
  in: {
@@ -0,0 +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"}
@@ -0,0 +1,3 @@
1
+ export * from 'hono';
2
+ export { Hono as Photon } from 'hono';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../photon/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAA;AACpB,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,MAAM,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravito/mass",
3
- "version": "1.0.0-alpha.5",
3
+ "version": "1.0.0-beta.1",
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",
@@ -28,11 +28,11 @@
28
28
  "@sinclair/typebox": "^0.34.0"
29
29
  },
30
30
  "peerDependencies": {
31
- "gravito-core": "1.0.0-beta.4"
31
+ "gravito-core": "1.0.0-beta.6"
32
32
  },
33
33
  "devDependencies": {
34
34
  "bun-types": "^1.1.0",
35
- "hono": "^4.0.0",
35
+ "@gravito/photon": "1.0.0-beta.1",
36
36
  "typescript": "^5.0.0"
37
37
  },
38
38
  "author": "Carl Lee <carllee0520@gmail.com>",
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EAAE,WAAW,IAAI,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGlE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAExD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAG3C,OAAO,EAAE,KAAK,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,KAAK,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAA;AAElD;;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"}