@grest-ts/http 0.0.64 → 0.0.65

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 (58) hide show
  1. package/README.md +161 -156
  2. package/dist/src/_dedupCheck.js +1 -1
  3. package/dist/src/client/GGHttpSchema.createClient.d.ts +2 -2
  4. package/dist/src/client/GGHttpSchema.createClient.d.ts.map +1 -1
  5. package/dist/src/client/GGHttpSchema.createClient.js.map +1 -1
  6. package/dist/src/index-browser.d.ts +0 -1
  7. package/dist/src/index-browser.d.ts.map +1 -1
  8. package/dist/src/index-browser.js +0 -1
  9. package/dist/src/index-browser.js.map +1 -1
  10. package/dist/src/index-node.d.ts +0 -2
  11. package/dist/src/index-node.d.ts.map +1 -1
  12. package/dist/src/index-node.js +0 -2
  13. package/dist/src/index-node.js.map +1 -1
  14. package/dist/src/schema/GGHttpSchema.d.ts +8 -2
  15. package/dist/src/schema/GGHttpSchema.d.ts.map +1 -1
  16. package/dist/src/schema/GGHttpSchema.js +6 -6
  17. package/dist/src/schema/GGHttpSchema.js.map +1 -1
  18. package/dist/src/server/GGHttp.d.ts +6 -6
  19. package/dist/src/server/GGHttp.d.ts.map +1 -1
  20. package/dist/src/server/GGHttp.js +4 -3
  21. package/dist/src/server/GGHttp.js.map +1 -1
  22. package/dist/src/server/GGHttpSchema.startServer.d.ts +5 -20
  23. package/dist/src/server/GGHttpSchema.startServer.d.ts.map +1 -1
  24. package/dist/src/server/GGHttpSchema.startServer.js +5 -12
  25. package/dist/src/server/GGHttpSchema.startServer.js.map +1 -1
  26. package/dist/src/server/GGHttpServer.d.ts +11 -9
  27. package/dist/src/server/GGHttpServer.d.ts.map +1 -1
  28. package/dist/src/server/GGHttpServer.js +4 -4
  29. package/dist/src/server/GGHttpServer.js.map +1 -1
  30. package/dist/src/server/checkers/checkPermissionsAtStart.d.ts +7 -6
  31. package/dist/src/server/checkers/checkPermissionsAtStart.d.ts.map +1 -1
  32. package/dist/src/server/checkers/checkPermissionsAtStart.js +13 -10
  33. package/dist/src/server/checkers/checkPermissionsAtStart.js.map +1 -1
  34. package/dist/testkit/clientHttp/GGHttpSchema.callOn.d.ts +2 -2
  35. package/dist/testkit/clientHttp/GGHttpSchema.callOn.d.ts.map +1 -1
  36. package/dist/testkit/clientHttp/GGHttpSchema.callOn.js.map +1 -1
  37. package/dist/testkit/mock/GGHttpSchema.mock.d.ts +1 -1
  38. package/dist/testkit/mock/GGHttpSchema.mock.d.ts.map +1 -1
  39. package/dist/testkit/routing/GGHttpSchema.routing.d.ts +1 -1
  40. package/dist/testkit/routing/GGHttpSchema.routing.d.ts.map +1 -1
  41. package/dist/testkit/routing/GGHttpSchema.routing.js.map +1 -1
  42. package/dist/tsconfig.publish.tsbuildinfo +1 -1
  43. package/package.json +10 -10
  44. package/src/_dedupCheck.ts +1 -1
  45. package/src/client/GGHttpSchema.createClient.test.ts +6 -4
  46. package/src/client/GGHttpSchema.createClient.ts +5 -5
  47. package/src/index-browser.ts +0 -1
  48. package/src/index-node.ts +0 -2
  49. package/src/schema/GGHttpSchema.ts +14 -12
  50. package/src/server/GGHttp.ts +11 -10
  51. package/src/server/GGHttpSchema.startServer.ts +11 -35
  52. package/src/server/GGHttpServer.ts +12 -12
  53. package/src/server/checkers/checkPermissionsAtStart.ts +18 -15
  54. package/dist/src/schema/httpSchema.d.ts +0 -41
  55. package/dist/src/schema/httpSchema.d.ts.map +0 -1
  56. package/dist/src/schema/httpSchema.js +0 -48
  57. package/dist/src/schema/httpSchema.js.map +0 -1
  58. package/src/schema/httpSchema.ts +0 -58
package/README.md CHANGED
@@ -11,9 +11,13 @@ How to use the HTTP package for building type-safe HTTP and WebSocket APIs.
11
11
 
12
12
  ### Basic API Structure
13
13
 
14
+ A schema is a plain object passed to `new GGHttpSchema({...})`: a `contract`, a
15
+ `pathPrefix`, a `routes` map (one verb helper per contract method), and an optional
16
+ `use` array of wires (omit it for a public API).
17
+
14
18
  ```typescript
15
19
  // MyApi.ts
16
- import { GGRpc, httpSchema } from "@grest-ts/http"
20
+ import { GGRpc, GGHttpSchema } from "@grest-ts/http"
17
21
  import { GGContractClass, IsArray, IsObject, IsString, IsBoolean, IsUint, NOT_FOUND, FORBIDDEN, VALIDATION_ERROR, SERVER_ERROR } from "@grest-ts/schema"
18
22
 
19
23
  // ---------------------------------------------------------
@@ -80,17 +84,22 @@ export const MyApiContract = new GGContractClass("MyApi", {
80
84
  }
81
85
  })
82
86
 
83
- export const MyApi = httpSchema(MyApiContract)
84
- .pathPrefix("api/items")
85
- .routes({
87
+ export const MyApi = new GGHttpSchema({
88
+ contract: MyApiContract,
89
+ pathPrefix: "api/items",
90
+ routes: {
86
91
  list: GGRpc.GET("list"),
87
92
  get: GGRpc.GET("get/:id"),
88
93
  create: GGRpc.POST("create"),
89
94
  update: GGRpc.PUT("update"),
90
95
  delete: GGRpc.DELETE("delete/:id")
91
- })
96
+ }
97
+ })
92
98
  ```
93
99
 
100
+ Every key in `routes` must match a method key on the contract. The verb helpers
101
+ (`GGRpc.GET/POST/PUT/DELETE`) are unchanged.
102
+
94
103
  ### HTTP Methods
95
104
 
96
105
  ```typescript
@@ -118,12 +127,14 @@ export const MyApiContract = new GGContractClass("MyApi", {
118
127
  }
119
128
  })
120
129
 
121
- export const MyApi = httpSchema(MyApiContract)
122
- .pathPrefix("api")
123
- .routes({
130
+ export const MyApi = new GGHttpSchema({
131
+ contract: MyApiContract,
132
+ pathPrefix: "api",
133
+ routes: {
124
134
  getUser: GGRpc.GET("users/:userId"),
125
135
  getUserPost: GGRpc.GET("users/:userId/posts/:postId")
126
- })
136
+ }
137
+ })
127
138
  ```
128
139
 
129
140
  ### Query Parameters
@@ -168,7 +179,7 @@ export const MyApiContract = new GGContractClass("MyApi", {
168
179
 
169
180
  ## Permissions
170
181
 
171
- Contract methods may declare a `permission`. The framework gates every request against the declared permission **before the handler runs**, so missing or wrong scopes can never reach service code. The caller's scopes come from the **wires** the schema `.use()`s (see "Authentication & Context" below) — a smart wire verifies the credential and exposes the caller's grants via its `permissions()` resolver. There is no separate `.usePermissions(...)` step and no auth-middleware chain; the schema's wires ARE the source of scopes.
182
+ Contract methods may declare a `permission`. The framework gates every request against the declared permission **before the handler runs**, so missing or wrong scopes can never reach service code. The caller's scopes come from the **wires** the schema lists in `use: [...]` (see "Authentication & Context" below) — a smart wire verifies the credential and exposes the caller's grants via its `permissions()` resolver. There is no separate `.usePermissions(...)` step and no auth-middleware chain; the schema's wires ARE the source of scopes.
172
183
 
173
184
  Declarations are opt-in but *infectious*: once any route on the server declares a `permission`, every route on the server must declare one — the runtime refuses to start otherwise (see "Hard guarantee" below).
174
185
 
@@ -179,20 +190,22 @@ export const ItemApiContract = new GGContractClass("ItemApi", {
179
190
  delete: { input: IsItemIdParam, errors: [NOT_AUTHORIZED, FORBIDDEN, SERVER_ERROR], permission: ItemPermission.DELETE },
180
191
  })
181
192
 
182
- // schema: .use() the wire that authenticates + resolves scopes for these routes
183
- export const ItemApi = httpSchema(ItemApiContract)
184
- .pathPrefix("api/items")
185
- .use(USER_TOKEN_WIRE)
186
- .routes({ list: GGRpc.GET("list"), delete: GGRpc.DELETE("delete/:id") })
193
+ // schema: list the wire that authenticates + resolves scopes for these routes
194
+ export const ItemApi = new GGHttpSchema({
195
+ contract: ItemApiContract,
196
+ pathPrefix: "api/items",
197
+ use: [USER_TOKEN_WIRE],
198
+ routes: { list: GGRpc.GET("list"), delete: GGRpc.DELETE("delete/:id") },
199
+ })
187
200
  ```
188
201
 
189
202
  The gate reads the method's `permission`, collects the caller's grants from every wire on the schema (each wire's `permissions()`), pools them into one set, checks `satisfies(method.permission, pooledGrants)`, and throws `NOT_AUTHORIZED` (a wire couldn't authenticate) or `FORBIDDEN` (authenticated, wrong scopes).
190
203
 
191
- **Multi-wire composition (AND across sources).** A schema may `.use()` more than one auth wire (e.g. a user wire AND an org wire). Each wire's server handler runs at the request boundary, so **every** wire must authenticate — any one throwing rejects the request. That is the AND across sources. For scope checks the grants from all wires are **pooled** into one set, and the method's `permission` must be satisfied by that union; grants are matched by string against the pool, with no per-wire ownership of permission strings. A route that declares a non-public `permission` on a schema that `.use()`s **no** permission-resolving wire can never be satisfied (its pooled grants are always empty), so it fails at startup — see the hard guarantee below.
204
+ **Multi-wire composition (AND across sources).** A schema may list more than one auth wire in `use: [...]` (e.g. a user wire AND an org wire). Each wire's server handler runs at the request boundary, so **every** wire must authenticate — any one throwing rejects the request. That is the AND across sources. For scope checks the grants from all wires are **pooled** into one set, and the method's `permission` must be satisfied by that union; grants are matched by string against the pool, with no per-wire ownership of permission strings. A route that declares a non-public `permission` on a schema with **no** permission-resolving wire can never be satisfied (its pooled grants are always empty), so it fails at startup — see the hard guarantee below.
192
205
 
193
206
  **Hard guarantee.** At server start the framework walks every HTTP / WS route registered on the `GGHttpServer`, before it accepts traffic. Two guarantees hold:
194
207
 
195
- - **Wires are implemented (always).** A `.use()`d wire that was never implemented (no `.define(...).create(deps)` in `compose()`) fails the start — a listed wire must work or the request fails loud. This runs regardless of whether any permission is declared.
208
+ - **Wires are implemented (always).** A `use`d wire that was never implemented (no `.define(...).create(deps)` in `compose()`) fails the start — a listed wire must work or the request fails loud. This runs regardless of whether any permission is declared.
196
209
  - **Permission coverage (strict mode).** If any route declared a permission, **strict mode** is on for the whole server: every route must declare `permission` — use `GG_NO_PERMISSIONS` for intentionally public ones. Routes that omit it fail the start and are listed by name.
197
210
 
198
211
  The coverage check is per-server (HTTP routes + WS schemas on the same `GGHttpServer`), so a permission declared anywhere is infectious across sibling chains. The only way to opt out is to declare nothing — projects with no auth pay zero ceremony, but the moment one route opts in, the framework forces consistency.
@@ -203,9 +216,10 @@ The coverage check is per-server (HTTP routes + WS schemas on the same `GGHttpSe
203
216
 
204
217
  Authentication and per-request context ride on **wires**. A wire (`GGHeader` / `GGCookie`)
205
218
  *is* a context key and a transport middleware at once: it reads a value off the inbound
206
- request and attaches to a schema with a single `.use(WIRE)`. The schema declares the wire
207
- once and every method on it parses (and, for credentials, verifies) that wire — you can't
208
- forget it on a method, and "is this endpoint protected?" is readable off the schema.
219
+ request and attaches to a schema by listing it in the schema's `use: [WIRE]` array. The
220
+ schema declares the wire once and every method on it parses (and, for credentials, verifies)
221
+ that wire — you can't forget it on a method, and "is this endpoint protected?" is readable
222
+ off the schema.
209
223
 
210
224
  There are two tiers, decided by whether the wire is `.define()`d server-side:
211
225
 
@@ -270,15 +284,17 @@ export const USER_TOKEN_WIRE_HANDLER = USER_TOKEN_WIRE.define((users: UserServic
270
284
  }))
271
285
  ```
272
286
 
273
- `.use()` the wire on every schema whose routes need it, and `.create()` its handler once in
274
- the runtime's `compose()`:
287
+ List the wire in `use: [...]` on every schema whose routes need it, and `.create()` its
288
+ handler once in the runtime's `compose()`:
275
289
 
276
290
  ```typescript
277
291
  // api/UserApi.ts
278
- export const UserApi = httpSchema(UserApiContract)
279
- .pathPrefix("api/users")
280
- .use(USER_TOKEN_WIRE) // every route here verifies the token
281
- .routes({ me: GGRpc.GET("me"), updateProfile: GGRpc.PUT("profile") })
292
+ export const UserApi = new GGHttpSchema({
293
+ contract: UserApiContract,
294
+ pathPrefix: "api/users",
295
+ use: [USER_TOKEN_WIRE], // every route here verifies the token
296
+ routes: { me: GGRpc.GET("me"), updateProfile: GGRpc.PUT("profile") },
297
+ })
282
298
  ```
283
299
 
284
300
  ```typescript
@@ -312,9 +328,12 @@ bare wire (no `.define()`). The value lands in the wire and persists through the
312
328
  // shared api/
313
329
  export const CLIENT_VERSION_WIRE = new GGHeader("x-client-version") // ambient
314
330
 
315
- httpSchema(MyContract)
316
- .use(CLIENT_VERSION_WIRE)
317
- .routes({ ... })
331
+ new GGHttpSchema({
332
+ contract: MyContract,
333
+ pathPrefix: "api",
334
+ use: [CLIENT_VERSION_WIRE],
335
+ routes: { ... },
336
+ })
318
337
 
319
338
  // in a handler — read it directly:
320
339
  const version = CLIENT_VERSION_WIRE.get() // string | undefined
@@ -356,7 +375,7 @@ export const ClientInfoMiddleware: GGTransportMiddleware = {
356
375
  },
357
376
  }
358
377
 
359
- httpSchema(MyContract).use(ClientInfoMiddleware).routes({ ... })
378
+ new GGHttpSchema({ contract: MyContract, pathPrefix: "api", use: [ClientInfoMiddleware], routes: { ... } })
360
379
  ```
361
380
 
362
381
  ### Client — sending the credential
@@ -378,9 +397,10 @@ For the no-session case (a static service-to-service API key), the underlying pr
378
397
 
379
398
  ### Public API (No Auth)
380
399
 
381
- A public route simply lives on a schema that does **not** `.use()` an auth wire — "what's
382
- public?" is answered by looking at the schema, not by reading handler code. (There is no
383
- "optional auth": anonymous and authenticated variants live on separate schemas.)
400
+ A public route simply lives on a schema that lists **no** auth wire in `use` (omit the field
401
+ entirely) — "what's public?" is answered by looking at the schema, not by reading handler
402
+ code. (There is no "optional auth": anonymous and authenticated variants live on separate
403
+ schemas.)
384
404
 
385
405
  ```typescript
386
406
  export const PublicApiContract = new GGContractClass("PublicApi", {
@@ -388,12 +408,14 @@ export const PublicApiContract = new GGContractClass("PublicApi", {
388
408
  login: { input: IsLoginRequest, success: IsLoginResponse, errors: [VALIDATION_ERROR, SERVER_ERROR], permission: GG_NO_PERMISSIONS },
389
409
  })
390
410
 
391
- export const PublicApi = httpSchema(PublicApiContract)
392
- .pathPrefix("pub") // no .use(WIRE) → public
393
- .routes({
411
+ export const PublicApi = new GGHttpSchema({
412
+ contract: PublicApiContract,
413
+ pathPrefix: "pub", // no `use` → public
414
+ routes: {
394
415
  status: GGRpc.GET("status"),
395
416
  login: GGRpc.POST("login"),
396
- })
417
+ },
418
+ })
397
419
  ```
398
420
 
399
421
  (`permission: GG_NO_PERMISSIONS` is only needed once any route on the server declares a
@@ -452,14 +474,33 @@ export class MyService {
452
474
  }
453
475
  ```
454
476
 
477
+ ## Server Implementation
478
+
479
+ The implementation is a plain class. `typeof Contract.infer` gives its method shape — keep
480
+ the alias next to the class:
481
+
482
+ ```typescript
483
+ import type { BenchmarkRequest, BenchmarkResponse } from "../api/BenchmarkApi"
484
+ import { BenchmarkApiContract } from "../api/BenchmarkApi"
485
+
486
+ type IBenchmarkApi = typeof BenchmarkApiContract.infer
487
+
488
+ export class BenchmarkService implements IBenchmarkApi {
489
+ public async hello(request: BenchmarkRequest): Promise<BenchmarkResponse> {
490
+ return { res: "Hello " + request.name }
491
+ }
492
+ }
493
+ ```
494
+
455
495
  ## HTTP Server Setup
456
496
 
457
- ### Using GGHttp (Fluent API)
497
+ ### Registering with GGHttp
458
498
 
459
- Auth wiring is **not** a chain on `GGHttp` — the schema carries the wire (`.use(WIRE)`) and
460
- the runtime binds the wire's deps once via `WIRE_HANDLER.create(deps)`. `GGHttp.use(...)` is
461
- reserved for *ambient* middleware (e.g. client-info, trace) that should apply to every API
462
- registered on that builder.
499
+ `GGHttp` is the single entry point: `new GGHttp(httpServer).http(Schema, impl)`, chained per
500
+ API. Auth wiring is **not** a chain on `GGHttp` — the schema carries the wire (`use: [WIRE]`)
501
+ and the runtime binds the wire's deps once via `WIRE_HANDLER.create(deps)`. `GGHttp.use(...)`
502
+ is reserved for *ambient* middleware (e.g. client-info, trace) that applies to every API
503
+ registered **after** it on that builder.
463
504
 
464
505
  ```typescript
465
506
  import { GGHttp, GGHttpServer } from "@grest-ts/http"
@@ -473,23 +514,11 @@ protected compose(): void {
473
514
  new GGHttp(httpServer)
474
515
  .use(ClientInfoMiddleware) // ambient middleware for every API below (optional)
475
516
  .http(PublicApi, publicService) // no wire on its schema → public
476
- .http(MyApi, myService) // MyApi schema .use(USER_TOKEN_WIRE)
517
+ .http(MyApi, myService) // MyApi schema uses USER_TOKEN_WIRE
477
518
  .http(UserAuthApi, userService)
478
519
  }
479
520
  ```
480
521
 
481
- ### Using GGHttpSchema.register (Direct)
482
-
483
- ```typescript
484
- import { GGHttpServer } from "@grest-ts/http"
485
-
486
- protected compose(): void {
487
- const httpServer = new GGHttpServer()
488
- MyApi.register(myService, { http: httpServer })
489
- OtherApi.register(otherService, { http: httpServer })
490
- }
491
- ```
492
-
493
522
  ### Multiple HTTP Servers
494
523
 
495
524
  ```typescript
@@ -509,19 +538,22 @@ protected compose(): void {
509
538
  ### CORS Headers
510
539
 
511
540
  CORS `Access-Control-Allow-Headers` are auto-discovered from the wires and middleware a
512
- schema `.use()`s. Only `Content-Type` is included by default (it's set by the framework's
513
- RPC layer). All other headers — including `Authorization` — are registered automatically
514
- from each wire/middleware's declared header names.
541
+ schema lists in `use`. Only `Content-Type` is included by default (it's set by the
542
+ framework's RPC layer). All other headers — including `Authorization` — are registered
543
+ automatically from each wire/middleware's declared header names.
515
544
 
516
- A `GGHeader` wire carries its own header name, so `.use()`ing it is enough — no extra CORS
517
- wiring:
545
+ A `GGHeader` wire carries its own header name, so listing it in `use` is enough — no extra
546
+ CORS wiring:
518
547
 
519
548
  ```typescript
520
549
  export const ORG_TOKEN_WIRE = new GGHeader("x-org-token", {}) // smart wire, custom header
521
550
 
522
- httpSchema(Contract)
523
- .use(ORG_TOKEN_WIRE) // "x-org-token" added to CORS Allow-Headers automatically
524
- .routes({ ... })
551
+ new GGHttpSchema({
552
+ contract: Contract,
553
+ pathPrefix: "api",
554
+ use: [ORG_TOKEN_WIRE], // "x-org-token" added to CORS Allow-Headers automatically
555
+ routes: { ... },
556
+ })
525
557
  ```
526
558
 
527
559
  A custom middleware declares the headers it reads via `headers` and the response headers it
@@ -554,25 +586,27 @@ that JavaScript cannot read (so XSS can't steal it). It is **server-minted**: th
554
586
  server emits `Set-Cookie`, the browser stores and resends it, and JS never touches it.
555
587
 
556
588
  A cookie is a **`GGCookie` wire** — it IS its own context key. Its name is the cookie
557
- name. Attach it with one `.use(SESSION)` on the schema; read it with `SESSION.get()` in any
558
- handler; write it with the static `GGCookie.setCookie(SESSION, …)` / `clearCookie(SESSION)`
589
+ name. Attach it by listing `SESSION` in the schema's `use`; read it with `SESSION.get()` in
590
+ any handler; write it with the static `GGCookie.setCookie(SESSION, …)` / `clearCookie(SESSION)`
559
591
  from a route that declared `.updatesCookie(SESSION)`:
560
592
 
561
593
  ```typescript
562
594
  // shared api/
563
- import {GGRpc, httpSchema, GGCookie} from "@grest-ts/http"
595
+ import {GGRpc, GGHttpSchema, GGCookie} from "@grest-ts/http"
564
596
 
565
597
  // The wire's name IS the cookie name. No cookie policy in the shared API.
566
598
  export const SESSION = new GGCookie("session")
567
599
 
568
- export const AuthApi = httpSchema(AuthContract)
569
- .use(SESSION)
570
- .pathPrefix("api/auth")
571
- .routes({
600
+ export const AuthApi = new GGHttpSchema({
601
+ contract: AuthContract,
602
+ pathPrefix: "api/auth",
603
+ use: [SESSION],
604
+ routes: {
572
605
  login: GGRpc.POST("login").updatesCookie(SESSION), // may write the cookie
573
606
  logout: GGRpc.POST("logout").updatesCookie(SESSION), // may write (clear)
574
607
  me: GGRpc.GET("me"), // read-only -> no declaration
575
- })
608
+ },
609
+ })
576
610
  ```
577
611
 
578
612
  ```typescript
@@ -593,7 +627,7 @@ export class AuthService {
593
627
  ```
594
628
 
595
629
  **Read vs write.** Reading is implicit — `SESSION.get()` works on any route whose schema
596
- `.use()`d the cookie. **Writing is explicit**: only a route that declared
630
+ lists the cookie in `use`. **Writing is explicit**: only a route that declared
597
631
  `.updatesCookie(SESSION)` may write it. A `GGCookie.setCookie(SESSION, …)` call from a route
598
632
  that *didn't* declare it throws `SERVER_ERROR`, so a deep service function can't silently
599
633
  mint or change someone's session — the capability is visible at the API boundary. The
@@ -660,8 +694,8 @@ Same-origin calls and the default need nothing.
660
694
 
661
695
  The same `GGCookie` wire works on a WebSocket schema, read-only: a browser auto-attaches
662
696
  the httpOnly cookie to the WS **upgrade** request, and the runtime fills `inbound.cookie`
663
- from that real upgrade header (never from the spoofable in-band handshake message). `.use()`
664
- the same `SESSION` wire on the WS schema and read it at handshake with `SESSION.get()` — no
697
+ from that real upgrade header (never from the spoofable in-band handshake message). List the
698
+ same `SESSION` wire in the WS schema's `use` and read it at handshake with `SESSION.get()` — no
665
699
  client code, no ticket dance. There is no `Set-Cookie` over a socket, so the wire only reads
666
700
  there (`.updatesCookie` is an HTTP route concept). See `@grest-ts/websocket` → "Cookies".
667
701
 
@@ -730,54 +764,45 @@ const title = await client.get({ id: "item-123" }).map(item => item.title)
730
764
 
731
765
  ## WebSocket APIs
732
766
 
767
+ The websocket package documents the WS model in depth; this is the short version. A WS schema
768
+ follows the same object-config shape as HTTP: a `GGDuplexContract` (with `connect`,
769
+ `clientToServer`, `serverToClient`), a `path`, and an optional `use` array of wires.
770
+
733
771
  ### Defining WebSocket API
734
772
 
735
773
  ```typescript
736
- import { defineSocketContract, webSocketSchema } from "@grest-ts/websocket"
737
- import { IsObject, IsString, IsBoolean, SERVER_ERROR, VALIDATION_ERROR } from "@grest-ts/schema"
774
+ import { GGWebSocketSchema } from "@grest-ts/websocket"
775
+ import { GGDuplexContract, IsObject, IsString, IsBoolean, GG_NO_PERMISSIONS, NOT_AUTHORIZED, SERVER_ERROR, VALIDATION_ERROR } from "@grest-ts/schema"
738
776
 
739
- // Message schemas
740
- export const IsItemMarkedEvent = IsObject({
741
- item: IsItem,
742
- markedBy: IsString
743
- })
777
+ export const IsItemMarkedEvent = IsObject({ item: IsItem, markedBy: IsString })
744
778
  export type ItemMarkedEvent = typeof IsItemMarkedEvent.infer
745
779
 
746
- export const IsUpdateItemRequest = IsObject({
747
- item: IsItem,
748
- reason: IsString.orUndefined
749
- })
780
+ export const IsUpdateItemRequest = IsObject({ item: IsItem, reason: IsString.orUndefined })
781
+ export const IsUpdateItemResponse = IsObject({ success: IsBoolean, message: IsString })
750
782
 
751
- export const IsUpdateItemResponse = IsObject({
752
- success: IsBoolean,
753
- message: IsString
754
- })
755
-
756
- // Contract definition
757
- export const NotificationApiContract = defineSocketContract("NotificationApi", {
783
+ export const NotificationApiContract = new GGDuplexContract("NotificationApi", {
784
+ connect: {
785
+ errors: [NOT_AUTHORIZED, SERVER_ERROR], // thrown at handshake (auth, etc.)
786
+ },
758
787
  clientToServer: {
759
788
  updateItem: {
760
789
  input: IsUpdateItemRequest,
761
790
  success: IsUpdateItemResponse,
762
- errors: [VALIDATION_ERROR, SERVER_ERROR]
791
+ errors: [VALIDATION_ERROR, SERVER_ERROR],
792
+ permission: GG_NO_PERMISSIONS,
763
793
  },
764
- ping: {}
794
+ ping: { permission: GG_NO_PERMISSIONS },
765
795
  },
766
796
  serverToClient: {
767
- itemMarked: {
768
- input: IsItemMarkedEvent
769
- },
770
- areYouThere: {
771
- success: IsBoolean,
772
- errors: [SERVER_ERROR]
773
- }
774
- }
797
+ itemMarked: { input: IsItemMarkedEvent },
798
+ },
775
799
  })
776
800
 
777
- export const NotificationApi = webSocketSchema(NotificationApiContract)
778
- .path("ws/notifications")
779
- .use(USER_TOKEN_WIRE) // same wire as the HTTP schemas — verified at handshake
780
- .done()
801
+ export const NotificationApi = new GGWebSocketSchema({
802
+ contract: NotificationApiContract,
803
+ path: "ws/notifications",
804
+ use: [USER_TOKEN_WIRE], // same wire as the HTTP schemas — verified at handshake
805
+ })
781
806
  ```
782
807
 
783
808
  The wire works identically on WebSocket: it reads + verifies the credential off the upgrade
@@ -786,89 +811,69 @@ full WS auth + permissions model.
786
811
 
787
812
  ### WebSocket Server Handler
788
813
 
789
- ```typescript
790
- import { WebSocketIncoming, WebSocketOutgoing } from "@grest-ts/websocket"
814
+ The handler is a `handleConnection(incoming, outgoing)` method. Type both params with
815
+ `typeof NotificationApi.clientToServer` / `serverToClient` — register incoming handlers with
816
+ `incoming.on({...})`, push to the client by calling methods on `outgoing`.
791
817
 
818
+ ```typescript
792
819
  export class NotificationService {
793
- private connections = new Map<string, Set<WebSocketOutgoing<any>>>()
820
+ private connections = new Set<typeof NotificationApi.serverToClient>()
794
821
 
795
- handleConnection = (incoming: WebSocketIncoming<any>, outgoing: WebSocketOutgoing<any>): void => {
822
+ handleConnection = (incoming: typeof NotificationApi.clientToServer, outgoing: typeof NotificationApi.serverToClient): void => {
796
823
  const user = USER_DATA.get() // durable principal minted by the wire at handshake
824
+ this.connections.add(outgoing)
825
+ outgoing.onClose(() => this.connections.delete(outgoing))
797
826
 
798
- // Track connection
799
- if (!this.connections.has(user.id)) {
800
- this.connections.set(user.id, new Set())
801
- }
802
- this.connections.get(user.id)!.add(outgoing)
803
-
804
- // Handle incoming messages
805
827
  incoming.on({
806
- updateItem: async (request) => {
807
- // Process update
808
- return { success: true, message: "Updated" }
809
- },
810
- ping: async () => {
811
- // Handle ping
812
- }
813
- })
814
-
815
- // Handle disconnect
816
- outgoing.onClose(() => {
817
- this.connections.get(user.id)?.delete(outgoing)
828
+ updateItem: async (request) => ({ success: true, message: "Updated" }),
829
+ ping: async () => {},
818
830
  })
819
831
  }
820
832
 
821
- // Broadcast to user
822
- notifyUser(userId: string, event: ItemMarkedEvent): void {
823
- const userConnections = this.connections.get(userId)
824
- userConnections?.forEach(conn => conn.itemMarked(event))
833
+ // Broadcast a server→client push to every connection
834
+ notifyAll(event: ItemMarkedEvent): void {
835
+ for (const conn of this.connections) conn.itemMarked(event)
825
836
  }
826
837
  }
827
838
  ```
828
839
 
829
840
  ### WebSocket in Runtime
830
841
 
842
+ WS schemas register on the same `GGHttp` builder via `.ws(Schema, handleConnection)` (use
843
+ `.wsRaw(...)` for an unstructured socket):
844
+
831
845
  ```typescript
832
- import { GGHttpServer } from "@grest-ts/http"
846
+ import { GGHttp, GGHttpServer } from "@grest-ts/http"
833
847
 
834
848
  protected compose(): void {
835
849
  const httpServer = new GGHttpServer()
836
850
 
837
- // One wire handler covers every schema that .use()s it — HTTP and WS alike.
851
+ // One wire handler covers every schema that uses it — HTTP and WS alike.
838
852
  USER_TOKEN_WIRE_HANDLER.create(userService)
839
853
 
840
854
  new GGHttp(httpServer)
841
855
  .http(MyApi, myService)
842
-
843
- // Register WebSocket on the same HTTP server
844
- NotificationApi.register(notificationService.handleConnection, { http: httpServer })
856
+ .ws(NotificationApi, notificationService.handleConnection)
845
857
  }
846
858
  ```
847
859
 
848
860
  ### WebSocket Client
849
861
 
850
- ```typescript
851
- import { GGSocketPool } from "@grest-ts/websocket"
862
+ Same `Schema.createClient({url})` as HTTP. `connect()` opens the socket (its optional setup
863
+ callback registers `incoming.on({...})` handlers for server→client pushes); call
864
+ `client.outgoing.<method>(...)` to send.
852
865
 
853
- // Connect via socket pool (reuses connections for same URL + headers)
854
- const socket = await GGSocketPool.getOrConnect({
855
- domain: "ws://localhost:3000",
856
- path: "/ws/notifications",
857
- middlewares: NotificationApi.middlewares
858
- })
859
-
860
- // Send messages via the socket
861
- const response = await socket.send("NotificationApi.updateItem", { item, reason: "Updated via UI" }, true)
866
+ ```typescript
867
+ const client = NotificationApi.createClient({ url: "ws://localhost:3000" })
862
868
 
863
- // Handle disconnect
864
- socket.onClose(() => {
865
- console.log("Disconnected")
869
+ await client.connect(({ incoming }) => {
870
+ incoming.on({
871
+ itemMarked: async ({ item, markedBy }) => { /* handle server push */ },
872
+ })
866
873
  })
867
874
 
868
- // Close connection
869
- socket.close()
875
+ const res = await client.outgoing.updateItem({ item, reason: "Updated via UI" })
870
876
 
871
- // Close all pooled connections
872
- await GGSocketPool.closeAll()
877
+ await client.disconnect()
873
878
  ```
874
879
 
@@ -11,7 +11,7 @@
11
11
  const __KEY = Symbol.for("grest-ts:dedup:@grest-ts/http");
12
12
  const __slot = globalThis;
13
13
  const __existing = __slot[__KEY];
14
- const __here = { path: import.meta.url, version: "0.0.64" };
14
+ const __here = { path: import.meta.url, version: "0.0.65" };
15
15
  // Same path + same version means the same physical package is being
16
16
  // re-evaluated by a different ESM runner (e.g. vitest projects share one
17
17
  // process but each project has its own module cache). That isn't a true
@@ -1,7 +1,7 @@
1
1
  import { GGContractApiDefinition, GGContractClient } from "@grest-ts/schema";
2
2
  import { GGHttpSchema } from "../schema/GGHttpSchema";
3
3
  declare module "../schema/GGHttpSchema" {
4
- interface GGHttpSchema<TContract extends GGContractApiDefinition, TContext = {}> {
4
+ interface GGHttpSchema<TContract extends GGContractApiDefinition> {
5
5
  createClient(config?: GGHttpClientConfig): GGContractClient<TContract>;
6
6
  }
7
7
  }
@@ -45,5 +45,5 @@ export interface GGHttpClientConfig {
45
45
  transport?: GGHttpTransport;
46
46
  }
47
47
  export declare function _registerDiscoveryUrlResolver(resolver: (apiName: string) => Promise<string>): void;
48
- export declare function createClient<TContract extends GGContractApiDefinition, TContext>(httpSchema: GGHttpSchema<TContract, TContext>, config?: GGHttpClientConfig): GGContractClient<TContract>;
48
+ export declare function createClient<TContract extends GGContractApiDefinition>(httpSchema: GGHttpSchema<TContract>, config?: GGHttpClientConfig): GGContractClient<TContract>;
49
49
  //# sourceMappingURL=GGHttpSchema.createClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GGHttpSchema.createClient.d.ts","sourceRoot":"","sources":["../../../src/client/GGHttpSchema.createClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,uBAAuB,EAAE,gBAAgB,EAA4E,MAAM,kBAAkB,CAAA;AACvK,OAAO,EAAwD,YAAY,EAAC,MAAM,wBAAwB,CAAC;AAI3G,OAAO,QAAQ,wBAAwB,CAAC;IACpC,UAAU,YAAY,CAAC,SAAS,SAAS,uBAAuB,EAAE,QAAQ,GAAG,EAAE;QAC3E,YAAY,CAAC,MAAM,CAAC,EAAE,kBAAkB,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAA;KACzE;CACJ;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,eAAe,GAAG,CAC1B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE;IACF,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAA;IACnC,MAAM,EAAE,WAAW,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAAA;CACnD,KACA,OAAO,CAAC,QAAQ,CAAC,CAAA;AAEtB,MAAM,WAAW,kBAAkB;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAA;I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QACL,CAAC,CAAC;QAEF,uBAAuB,CAAC,UAAU,CAAC,GAAG,CAAC,IAAc,EAAE,EAAE;YACrD,OAAO,IAAI,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAA;QAC9C,CAAC,CAAA;IAEL,CAAC;IACD,gFAAgF;IAChF,QAAQ,CAAC,SAAS,CAAC,uBAA8D,EAAE,EAAC,uBAAuB,EAAE,IAAI,EAAC,CAAC,CAAA;IACnH,OAAO,uBAAuB,CAAC;AACnC,CAAC;AAED,MAAM,qBAAqB,GAAoB,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CACzD,KAAK,CAAC,GAAG,EAAE,IAAmB,CAAC,CAAA"}
@@ -1,6 +1,5 @@
1
1
  import "./_dedupCheck";
2
2
  export * from "./schema/GGHttpSchema";
3
- export * from "./schema/httpSchema";
4
3
  export * from "./schema/GGCookie";
5
4
  export * from "./schema/GGWireContextKey";
6
5
  export * from "./schema/GGHeader";
@@ -1 +1 @@
1
- {"version":3,"file":"index-browser.d.ts","sourceRoot":"","sources":["../../src/index-browser.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AAGtD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AAGnD,OAAO,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index-browser.d.ts","sourceRoot":"","sources":["../../src/index-browser.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AAGtD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AAGnD,OAAO,oCAAoC,CAAC"}
@@ -1,7 +1,6 @@
1
1
  import "./_dedupCheck.js";
2
2
  // API Schema
3
3
  export * from "./schema/GGHttpSchema.js";
4
- export * from "./schema/httpSchema.js";
5
4
  export * from "./schema/GGCookie.js";
6
5
  export * from "./schema/GGWireContextKey.js";
7
6
  export * from "./schema/GGHeader.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index-browser.js","sourceRoot":"","sources":["../../src/index-browser.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,aAAa;AACb,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AAEtD,SAAS;AACT,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AAEnD,aAAa;AACb,OAAO,oCAAoC,CAAC"}
1
+ {"version":3,"file":"index-browser.js","sourceRoot":"","sources":["../../src/index-browser.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,aAAa;AACb,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AAEtD,SAAS;AACT,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AAEnD,aAAa;AACb,OAAO,oCAAoC,CAAC"}
@@ -2,7 +2,6 @@ import "./_dedupCheck";
2
2
  export * from "./server/GGHttpMetrics";
3
3
  export * from "./server/GG_HTTP_REQUEST";
4
4
  export * from "./schema/GGHttpSchema";
5
- export * from "./schema/httpSchema";
6
5
  export * from "./schema/GGCookie";
7
6
  export * from "./schema/GGWireContextKey";
8
7
  export * from "./schema/GGWireContextKey.node";
@@ -26,6 +25,5 @@ export * from "./client/GGHttpSchema.createClient";
26
25
  export * from "./server/GGHttpSchema.startServer";
27
26
  import "./client/GGHttpSchema.createClient";
28
27
  import "./client/GGHttpSchema.createClient.node";
29
- import "./server/GGHttpSchema.startServer";
30
28
  import "./schema/GGWireContextKey.node";
31
29
  //# sourceMappingURL=index-node.d.ts.map