@grest-ts/http 0.0.47 → 0.0.49

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 (128) hide show
  1. package/README.md +321 -128
  2. package/dist/src/_dedupCheck.js +1 -1
  3. package/dist/src/client/GGContextKeySynchronizer.d.ts +11 -0
  4. package/dist/src/client/GGContextKeySynchronizer.d.ts.map +1 -0
  5. package/dist/src/client/GGContextKeySynchronizer.js +26 -0
  6. package/dist/src/client/GGContextKeySynchronizer.js.map +1 -0
  7. package/dist/src/client/GGHttpSchema.createClient.d.ts +8 -0
  8. package/dist/src/client/GGHttpSchema.createClient.d.ts.map +1 -1
  9. package/dist/src/client/GGHttpSchema.createClient.js +2 -1
  10. package/dist/src/client/GGHttpSchema.createClient.js.map +1 -1
  11. package/dist/src/index-browser.d.ts +4 -0
  12. package/dist/src/index-browser.d.ts.map +1 -1
  13. package/dist/src/index-browser.js +4 -0
  14. package/dist/src/index-browser.js.map +1 -1
  15. package/dist/src/index-node.d.ts +9 -1
  16. package/dist/src/index-node.d.ts.map +1 -1
  17. package/dist/src/index-node.js +17 -5
  18. package/dist/src/index-node.js.map +1 -1
  19. package/dist/src/rpc/GGHttpRouteRPC.d.ts +4 -0
  20. package/dist/src/rpc/GGHttpRouteRPC.d.ts.map +1 -1
  21. package/dist/src/rpc/GGHttpRouteRPC.js +6 -0
  22. package/dist/src/rpc/GGHttpRouteRPC.js.map +1 -1
  23. package/dist/src/rpc/RpcRequest/GGRpcRequestBuilder.d.ts +4 -3
  24. package/dist/src/rpc/RpcRequest/GGRpcRequestBuilder.d.ts.map +1 -1
  25. package/dist/src/rpc/RpcRequest/GGRpcRequestBuilder.js +9 -2
  26. package/dist/src/rpc/RpcRequest/GGRpcRequestBuilder.js.map +1 -1
  27. package/dist/src/rpc/RpcRequest/GGRpcRequestParser.d.ts +3 -3
  28. package/dist/src/rpc/RpcRequest/GGRpcRequestParser.d.ts.map +1 -1
  29. package/dist/src/rpc/RpcRequest/GGRpcRequestParser.js +13 -16
  30. package/dist/src/rpc/RpcRequest/GGRpcRequestParser.js.map +1 -1
  31. package/dist/src/rpc/RpcResponse/GGRpcResponseBuilder.d.ts +1 -0
  32. package/dist/src/rpc/RpcResponse/GGRpcResponseBuilder.d.ts.map +1 -1
  33. package/dist/src/rpc/RpcResponse/GGRpcResponseBuilder.js +4 -0
  34. package/dist/src/rpc/RpcResponse/GGRpcResponseBuilder.js.map +1 -1
  35. package/dist/src/schema/GGCookie.d.ts +50 -0
  36. package/dist/src/schema/GGCookie.d.ts.map +1 -0
  37. package/dist/src/schema/GGCookie.js +130 -0
  38. package/dist/src/schema/GGCookie.js.map +1 -0
  39. package/dist/src/schema/GGHeader.d.ts +23 -0
  40. package/dist/src/schema/GGHeader.d.ts.map +1 -0
  41. package/dist/src/schema/GGHeader.js +41 -0
  42. package/dist/src/schema/GGHeader.js.map +1 -0
  43. package/dist/src/schema/GGHttpPermissionsChecker.d.ts +9 -0
  44. package/dist/src/schema/GGHttpPermissionsChecker.d.ts.map +1 -0
  45. package/dist/src/schema/GGHttpPermissionsChecker.js +29 -0
  46. package/dist/src/schema/GGHttpPermissionsChecker.js.map +1 -0
  47. package/dist/src/schema/GGHttpSchema.d.ts +14 -52
  48. package/dist/src/schema/GGHttpSchema.d.ts.map +1 -1
  49. package/dist/src/schema/GGHttpSchema.js.map +1 -1
  50. package/dist/src/schema/GGWireContextKey.d.ts +30 -0
  51. package/dist/src/schema/GGWireContextKey.d.ts.map +1 -0
  52. package/dist/src/schema/GGWireContextKey.js +36 -0
  53. package/dist/src/schema/GGWireContextKey.js.map +1 -0
  54. package/dist/src/schema/GGWireContextKey.node.d.ts +36 -0
  55. package/dist/src/schema/GGWireContextKey.node.d.ts.map +1 -0
  56. package/dist/src/schema/GGWireContextKey.node.js +83 -0
  57. package/dist/src/schema/GGWireContextKey.node.js.map +1 -0
  58. package/dist/src/schema/httpSchema.d.ts +2 -4
  59. package/dist/src/schema/httpSchema.d.ts.map +1 -1
  60. package/dist/src/schema/httpSchema.js +0 -48
  61. package/dist/src/schema/httpSchema.js.map +1 -1
  62. package/dist/src/server/GGHttp.d.ts +2 -26
  63. package/dist/src/server/GGHttp.d.ts.map +1 -1
  64. package/dist/src/server/GGHttp.js +0 -15
  65. package/dist/src/server/GGHttp.js.map +1 -1
  66. package/dist/src/server/GGHttpSchema.startServer.d.ts +2 -11
  67. package/dist/src/server/GGHttpSchema.startServer.d.ts.map +1 -1
  68. package/dist/src/server/GGHttpSchema.startServer.js +14 -28
  69. package/dist/src/server/GGHttpSchema.startServer.js.map +1 -1
  70. package/dist/src/server/GGHttpServer.d.ts +45 -14
  71. package/dist/src/server/GGHttpServer.d.ts.map +1 -1
  72. package/dist/src/server/GGHttpServer.js +61 -87
  73. package/dist/src/server/GGHttpServer.js.map +1 -1
  74. package/dist/src/server/applyRequestMiddleware.d.ts +11 -0
  75. package/dist/src/server/applyRequestMiddleware.d.ts.map +1 -0
  76. package/dist/src/server/applyRequestMiddleware.js +38 -0
  77. package/dist/src/server/applyRequestMiddleware.js.map +1 -0
  78. package/dist/src/server/applyResponseMiddleware.d.ts +12 -0
  79. package/dist/src/server/applyResponseMiddleware.d.ts.map +1 -0
  80. package/dist/src/server/applyResponseMiddleware.js +25 -0
  81. package/dist/src/server/applyResponseMiddleware.js.map +1 -0
  82. package/dist/src/server/checkers/checkPermissionsAtStart.d.ts +39 -0
  83. package/dist/src/server/checkers/checkPermissionsAtStart.d.ts.map +1 -0
  84. package/dist/src/server/checkers/checkPermissionsAtStart.js +82 -0
  85. package/dist/src/server/checkers/checkPermissionsAtStart.js.map +1 -0
  86. package/dist/src/server/checkers/checkWireConflicts.d.ts +18 -0
  87. package/dist/src/server/checkers/checkWireConflicts.d.ts.map +1 -0
  88. package/dist/src/server/checkers/checkWireConflicts.js +43 -0
  89. package/dist/src/server/checkers/checkWireConflicts.js.map +1 -0
  90. package/dist/src/server/checkers/checkWiresImplemented.d.ts +11 -0
  91. package/dist/src/server/checkers/checkWiresImplemented.d.ts.map +1 -0
  92. package/dist/src/server/checkers/checkWiresImplemented.js +27 -0
  93. package/dist/src/server/checkers/checkWiresImplemented.js.map +1 -0
  94. package/dist/src/tsconfig.json +2 -1
  95. package/dist/tsconfig.publish.tsbuildinfo +1 -1
  96. package/package.json +14 -11
  97. package/src/_dedupCheck.ts +1 -1
  98. package/src/client/GGContextKeySynchronizer.test.ts +106 -0
  99. package/src/client/GGContextKeySynchronizer.ts +42 -0
  100. package/src/client/GGHttpSchema.createClient.ts +10 -1
  101. package/src/index-browser.ts +4 -0
  102. package/src/index-node.ts +18 -5
  103. package/src/rpc/GGHttpRouteRPC.ts +8 -0
  104. package/src/rpc/RpcRequest/GGRpcRequestBuilder.ts +11 -4
  105. package/src/rpc/RpcRequest/GGRpcRequestParser.ts +16 -17
  106. package/src/rpc/RpcResponse/GGRpcResponseBuilder.ts +5 -0
  107. package/src/schema/GGCookie.ts +151 -0
  108. package/src/schema/GGHeader.ts +48 -0
  109. package/src/schema/GGHttpPermissionsChecker.test.ts +125 -0
  110. package/src/schema/GGHttpPermissionsChecker.ts +35 -0
  111. package/src/schema/GGHttpSchema.ts +15 -63
  112. package/src/schema/GGWireContextKey.node.ts +119 -0
  113. package/src/schema/GGWireContextKey.ts +46 -0
  114. package/src/schema/httpSchema.ts +4 -57
  115. package/src/server/GGHttp.ts +3 -34
  116. package/src/server/GGHttpSchema.startServer.ts +16 -38
  117. package/src/server/GGHttpServer.ts +90 -97
  118. package/src/server/applyRequestMiddleware.ts +40 -0
  119. package/src/server/applyResponseMiddleware.ts +27 -0
  120. package/src/server/checkers/checkPermissionsAtStart.ts +112 -0
  121. package/src/server/checkers/checkWireConflicts.ts +65 -0
  122. package/src/server/checkers/checkWiresImplemented.ts +42 -0
  123. package/src/tsconfig.json +2 -1
  124. package/dist/src/server/GG_PERMISSIONS.d.ts +0 -15
  125. package/dist/src/server/GG_PERMISSIONS.d.ts.map +0 -1
  126. package/dist/src/server/GG_PERMISSIONS.js +0 -15
  127. package/dist/src/server/GG_PERMISSIONS.js.map +0 -1
  128. package/src/server/GG_PERMISSIONS.ts +0 -15
@@ -41,54 +41,6 @@ class GGHttpSchemaBuilder {
41
41
  this._middlewares.push(middleware);
42
42
  return this;
43
43
  }
44
- useHeader(contextKey) {
45
- const codec = contextKey.getCodec("http");
46
- if (!codec) {
47
- throw new Error(`Context key '${contextKey.name}' does not have an 'http-header' codec registered.`);
48
- }
49
- // Build the typed header map from codec.inputSchema — the IsObject({headerName: schema})
50
- // that describes which headers this codec reads and what format each value has.
51
- const inputSchema = codec.inputSchema;
52
- const headers = {};
53
- if (inputSchema) {
54
- const desc = inputSchema.toSchemaDescription();
55
- if (desc.node.kind === 'object') {
56
- for (const [k, fieldDesc] of Object.entries(desc.node.properties)) {
57
- headers[k] = fieldDesc.schema;
58
- }
59
- }
60
- }
61
- const middleware = {
62
- headers,
63
- responseHeaders: {},
64
- updateRequest(req) {
65
- const contextValue = contextKey.get();
66
- if (contextValue !== undefined) {
67
- const result = codec.decode(contextValue);
68
- if (result.success) {
69
- Object.assign(req.headers, result.value);
70
- }
71
- }
72
- else {
73
- const emptyResult = codec.decode({});
74
- if (emptyResult.success) {
75
- for (const key of Object.keys(emptyResult.value)) {
76
- delete req.headers[key];
77
- }
78
- }
79
- }
80
- },
81
- parseRequest(req) {
82
- const headers = req.headers;
83
- const result = codec.encode(headers);
84
- if (result.success) {
85
- contextKey.set(result.value);
86
- }
87
- }
88
- };
89
- this._middlewares.push(middleware);
90
- return this;
91
- }
92
44
  routes(mapping) {
93
45
  return new GGHttpSchema(this._pathPrefix, this._contract, mapping, this._middlewares);
94
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"httpSchema.js","sourceRoot":"","sources":["../../../src/schema/httpSchema.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAKzD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,UAAU,CACtB,Q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
1
+ {"version":3,"file":"httpSchema.js","sourceRoot":"","sources":["../../../src/schema/httpSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAIzD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,UAAU,CACtB,QAAoC;IAEpC,OAAO,IAAI,mBAAmB,CAAC,QAAQ,CAAC,CAAA;AAC5C,CAAC;AAED,MAAM,mBAAmB;IAEJ,SAAS,CAA4B;IAC9C,WAAW,GAAW,EAAE,CAAA;IACxB,YAAY,GAA4B,EAAE,CAAA;IAElD,YAAY,QAAoC;QAC5C,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC9B,CAAC;IAED,UAAU,CAAC,MAAc;QACrB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAA;QACzB,OAAO,IAAI,CAAA;IACf,CAAC;IAED,GAAG,CAAkC,UAAa;QAC9C,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;QAClC,OAAO,IAA+D,CAAA;IAC1E,CAAC;IAED,MAAM,CAAC,OAAgD;QACnD,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;IACzF,CAAC;CACJ"}
@@ -1,20 +1,7 @@
1
1
  import { GGHttpSchema } from "../schema/GGHttpSchema";
2
2
  import { GGContractApiDefinition, GGContractImplementation } from "@grest-ts/schema";
3
- import { GGHttpServerMiddleware } from "./GGHttpSchema.startServer";
3
+ import type { GGTransportMiddleware } from "@grest-ts/context";
4
4
  import { GGHttpServer } from "./GGHttpServer";
5
- /**
6
- * Resolves the caller's permission scopes for the current request. The function
7
- * is called once between transport middleware and the handler. Sync or async —
8
- * both supported (the gate awaits).
9
- *
10
- * Return `null` when no caller identity is available (the gate will throw
11
- * NOT_AUTHORIZED for non-public methods). Return a (possibly empty) set
12
- * otherwise; the gate will call satisfies() against the method's permission.
13
- *
14
- * The resolver should read whatever app-defined context the upstream auth
15
- * middleware populated — it should NOT parse the token itself.
16
- */
17
- export type GGScopeResolver = () => ReadonlySet<string> | null | Promise<ReadonlySet<string> | null>;
18
5
  export declare class GGHttp<TContext = undefined> {
19
6
  /**
20
7
  * Protected (not private) so that plugin modules can access the underlying server
@@ -23,19 +10,8 @@ export declare class GGHttp<TContext = undefined> {
23
10
  */
24
11
  protected readonly httpServer: GGHttpServer;
25
12
  private readonly middlewares;
26
- private permissionResolver?;
27
13
  constructor(httpServer: GGHttpServer);
28
- use<M extends GGHttpServerMiddleware>(middleware: M): GGHttp<TContext | M>;
29
- /**
30
- * Register a scope resolver. Subsequent .http(...) calls capture this
31
- * resolver and use it to gate every request against the contract's
32
- * declared `permission`.
33
- *
34
- * Calling order matters: .use(auth) → .usePermissions(getScopes) → .http(api).
35
- * If .http() runs before .usePermissions(), the call sees no resolver — and
36
- * the startup check will hard-fail if its schema has any non-public method.
37
- */
38
- usePermissions(resolver: GGScopeResolver): this;
14
+ use<M extends GGTransportMiddleware>(middleware: M): GGHttp<TContext | M>;
39
15
  http<TContract extends GGContractApiDefinition, TSchemaContext>(schema: GGHttpSchema<TContract, TSchemaContext>, implementation: GGContractImplementation<TContract>): this;
40
16
  }
41
17
  //# sourceMappingURL=GGHttp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GGHttp.d.ts","sourceRoot":"","sources":["../../../src/server/GGHttp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAC,uBAAuB,EAAE,wBAAwB,EAAC,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAC,sBAAsB,EAAC,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GACvB,MAAM,WAAW,CAAC,MAAM,CA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,CAAC,QAAQ,GAAG,CAAC,CAAC;IAKzE,IAAI,CAAC,SAAS,SAAS,uBAAuB,EAAE,cAAc,EACjE,MAAM,EAAE,YAAY,CAAC,SAAS,EAAE,cAAc,CAAC,EAC/C,cAAc,EAAE,wBAAwB,CAAC,SAAS,CAAC,GACpD,IAAI;CAOV"}
@@ -6,7 +6,6 @@ export class GGHttp {
6
6
  */
7
7
  httpServer;
8
8
  middlewares = [];
9
- permissionResolver;
10
9
  constructor(httpServer) {
11
10
  this.httpServer = httpServer;
12
11
  }
@@ -14,24 +13,10 @@ export class GGHttp {
14
13
  this.middlewares.push(middleware);
15
14
  return this;
16
15
  }
17
- /**
18
- * Register a scope resolver. Subsequent .http(...) calls capture this
19
- * resolver and use it to gate every request against the contract's
20
- * declared `permission`.
21
- *
22
- * Calling order matters: .use(auth) → .usePermissions(getScopes) → .http(api).
23
- * If .http() runs before .usePermissions(), the call sees no resolver — and
24
- * the startup check will hard-fail if its schema has any non-public method.
25
- */
26
- usePermissions(resolver) {
27
- this.permissionResolver = resolver;
28
- return this;
29
- }
30
16
  http(schema, implementation) {
31
17
  schema.register(implementation, {
32
18
  http: this.httpServer,
33
19
  middlewares: this.middlewares,
34
- permissionResolver: this.permissionResolver,
35
20
  });
36
21
  return this;
37
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"GGHttp.js","sourceRoot":"","sources":["../../../src/server/GGHttp.ts"],"names":[],"mappings":"AAoBA,MAAM,OAAO,MAAM;IAEf;;;;OAIG;IACgB,UAAU,CAAc;IAC1B,WAAW,GAA6B,EAAE,CAAC;IACpD,kBAAkB,CAAmB;IAE7C,YAAY,UAAwB;QAChC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IAEM,GAAG,CAAmC,UAAa;QACtD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAClC,OAAO,IAAW,CAAC;IACvB,CAAC;IAED;;;;;;;;OAQG;IACI,cAAc,CAAC,QAAyB;QAC3C,IAAI,CAAC,kBAAkB,GAAG,QAAQ,CAAC;QACnC,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,IAAI,CACP,MAA+C,EAC/C,cAAmD;QAEnD,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE;YAC5B,IAAI,EAAE,IAAI,CAAC,UAAU;YACrB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC9C,CAAC,CAAC;QACH,OAAO,IAAW,CAAC;IACvB,CAAC;CACJ"}
1
+ {"version":3,"file":"GGHttp.js","sourceRoot":"","sources":["../../../src/server/GGHttp.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,MAAM;IAEf;;;;OAIG;IACgB,UAAU,CAAc;IAC1B,WAAW,GAA4B,EAAE,CAAC;IAE3D,YAAY,UAAwB;QAChC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IAEM,GAAG,CAAkC,UAAa;QACrD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAClC,OAAO,IAAW,CAAC;IACvB,CAAC;IAEM,IAAI,CACP,MAA+C,EAC/C,cAAmD;QAEnD,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE;YAC5B,IAAI,EAAE,IAAI,CAAC,UAAU;YACrB,WAAW,EAAE,IAAI,CAAC,WAAW;SAChC,CAAC,CAAC;QACH,OAAO,IAAW,CAAC;IACvB,CAAC;CACJ"}
@@ -3,8 +3,8 @@
3
3
  * This file should only be imported in server (Node.js) context.
4
4
  */
5
5
  import { GGContractApiDefinition, GGContractImplementation } from "@grest-ts/schema";
6
+ import { type GGTransportMiddleware } from "@grest-ts/context";
6
7
  import { GGHttpServer } from "./GGHttpServer";
7
- import type { GGScopeResolver } from "./GGHttp";
8
8
  export interface GGHttpSchemaConfig {
9
9
  /**
10
10
  * The HTTP request handler to register with.
@@ -13,16 +13,7 @@ export interface GGHttpSchemaConfig {
13
13
  /**
14
14
  * Additional middlewares to apply to all routes.
15
15
  */
16
- middlewares?: GGHttpServerMiddleware[];
17
- /**
18
- * Optional scope resolver. When set, the gate calls it once per request,
19
- * populates GG_PERMISSIONS, and rejects requests whose contract permission
20
- * is not satisfied by the resolved scopes.
21
- */
22
- permissionResolver?: GGScopeResolver;
23
- }
24
- export interface GGHttpServerMiddleware {
25
- process?(): Promise<void>;
16
+ middlewares?: GGTransportMiddleware[];
26
17
  }
27
18
  declare module "../schema/GGHttpSchema" {
28
19
  interface GGHttpSchema<TContract extends GGContractApiDefinition> {
@@ -1 +1 @@
1
- {"version":3,"file":"GGHttpSchema.startServer.d.ts","sourceRoot":"","sources":["../../../src/server/GGHttpSchema.startServer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAA0D,uBAAuB,EAAE,wBAAwB,EAAqF,MAAM,kBAAkB,CAAC;AAShO,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAG5C,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAE9C,MAAM,WAAW,kBAAkB;IAC/B;;OAEG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,sBAAsB,EAAE,CAAC;IACvC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,eAAe,CAAC;CACxC;AAED,MAAM,WAAW,sBAAsB;IACnC,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAC5B;AAED,OAAO,QAAQ,wBAAwB,CAAC;IACpC,UAAU,YAAY,CAAC,SAAS,SAAS,uBAAuB;QAC5D;;;;WAIG;QACH,QAAQ,CAAC,cAAc,EAAE,wBAAwB,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAA;KACnG;CACJ"}
1
+ {"version":3,"file":"GGHttpSchema.startServer.d.ts","sourceRoot":"","sources":["../../../src/server/GGHttpSchema.startServer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAQ,uBAAuB,EAAE,wBAAwB,EAAqC,MAAM,kBAAkB,CAAC;AAG9H,OAAO,EAA4B,KAAK,qBAAqB,EAAC,MAAM,mBAAmB,CAAC;AAOxF,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAI5C,MAAM,WAAW,kBAAkB;IAC/B;;OAEG;IACH,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,qBAAqB,EAAE,CAAC;CACzC;AAED,OAAO,QAAQ,wBAAwB,CAAC;IACpC,UAAU,YAAY,CAAC,SAAS,SAAS,uBAAuB;QAC5D;;;;WAIG;QACH,QAAQ,CAAC,cAAc,EAAE,wBAAwB,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAA;KACnG;CACJ"}
@@ -4,16 +4,17 @@
4
4
  */
5
5
  import { GGLocator } from "@grest-ts/locator";
6
6
  import { GGHttpSchema } from "../schema/GGHttpSchema.js";
7
- import { describePermission, ERROR, FORBIDDEN, GG_NO_PERMISSIONS, GGPermissionChecker, NOT_AUTHORIZED, satisfies, SERVER_ERROR } from "@grest-ts/schema";
7
+ import { ERROR, SERVER_ERROR } from "@grest-ts/schema";
8
8
  import { GG_DISCOVERY } from "@grest-ts/discovery";
9
9
  import { GGContext, GGContextStore } from "@grest-ts/context";
10
10
  import { GG_TRACE } from "@grest-ts/trace";
11
11
  import { GG_HTTP_REQUEST } from "./GG_HTTP_REQUEST.js";
12
+ import { GG_COOKIE_WRITES } from "../schema/GGCookie.js";
12
13
  import { GG_METRICS } from "@grest-ts/metrics";
13
14
  import { GGHttpMetrics } from "./GGHttpMetrics.js";
14
15
  import { GG_HTTP_SERVER } from "./GG_HTTP_SERVER.js";
15
16
  import { GGLog } from "@grest-ts/logger";
16
- import { GG_PERMISSIONS } from "./GG_PERMISSIONS.js";
17
+ import { GGHttpPermissionsChecker } from "../schema/GGHttpPermissionsChecker.js";
17
18
  GGHttpSchema.prototype.register = function (implementation, config) {
18
19
  return setupRoutes(this, implementation, config);
19
20
  };
@@ -30,9 +31,10 @@ function setupRoutes(httpSchema, implementation, config) {
30
31
  const apiMiddlewares = httpSchema.apiMiddlewares;
31
32
  const scope = GGLocator.getScope();
32
33
  const parentContext = GGContextStore.tryGetContext();
34
+ const permissionsChecker = new GGHttpPermissionsChecker(apiMiddlewares);
33
35
  for (const mw of apiMiddlewares) {
34
- const hKeys = Object.keys(mw.headers);
35
- const rhKeys = Object.keys(mw.responseHeaders);
36
+ const hKeys = Object.keys(mw.headers ?? {});
37
+ const rhKeys = Object.keys(mw.responseHeaders ?? {});
36
38
  if (hKeys.length)
37
39
  server.registerCorsHeaders(hKeys);
38
40
  if (rhKeys.length)
@@ -56,8 +58,6 @@ function setupRoutes(httpSchema, implementation, config) {
56
58
  // Info: Contract instance is auto-registered in GGLocator via patched implement()
57
59
  // @TODO This is not really used and only for testkit so it would register implementation of the contract... Not cool
58
60
  httpSchema.contract.implement(implementation);
59
- if (config.permissionResolver)
60
- server._markResolverWired(httpSchema);
61
61
  for (const methodName in httpSchema.codec) {
62
62
  // Wire format.
63
63
  const codec = httpSchema.codec[methodName];
@@ -74,36 +74,22 @@ function setupRoutes(httpSchema, implementation, config) {
74
74
  // build request mapping
75
75
  const requestParser = codec.createForServer({
76
76
  contract: contractFunctionSchema,
77
- apiMiddlewares: apiMiddlewares,
78
- serverMiddlewares: config.middlewares
77
+ middlewares: [...apiMiddlewares, ...(config.middlewares ?? [])]
79
78
  });
79
+ const cookieWriteNames = new Set((codec.updatesCookies ?? []).map(k => k.name));
80
80
  server.registerRoute(codec.method, pathPrefix + codec.path, async (req, res) => {
81
81
  scope.ensureEntered();
82
- return new GGContext("REQ", parentContext).run(async () => {
82
+ return new GGContext("REQ", parentContext, true).run(async () => {
83
83
  GG_TRACE.init();
84
84
  GG_HTTP_REQUEST.set({ port: server.port, method: req.method, path: req.url });
85
+ GG_COOKIE_WRITES.set(cookieWriteNames);
85
86
  const startTime = performance.now();
86
87
  let rpcResult;
87
88
  try {
88
- const rpcInput = await requestParser.parseRequest(req);
89
+ const rawInput = await requestParser.readRequest(req);
90
+ await permissionsChecker.assert(httpSchema.name, methodName, contractFunctionSchema.permission);
89
91
  try {
90
- if (config.permissionResolver) {
91
- const scopes = await config.permissionResolver();
92
- if (scopes != null)
93
- GG_PERMISSIONS.set(new GGPermissionChecker(scopes));
94
- const required = contractFunctionSchema.permission;
95
- if (required !== undefined && required !== GG_NO_PERMISSIONS) {
96
- if (scopes == null)
97
- throw new NOT_AUTHORIZED({
98
- debugMessage: `${httpSchema.name}.${methodName} requires ${describePermission(required)} but no caller identity was resolved`
99
- });
100
- if (!satisfies(required, scopes))
101
- throw new FORBIDDEN({
102
- debugMessage: `${httpSchema.name}.${methodName} requires ${describePermission(required)} — caller scopes did not satisfy`
103
- });
104
- }
105
- }
106
- rpcResult = { success: true, type: "OK", data: await implFn(rpcInput) };
92
+ rpcResult = { success: true, type: "OK", data: await implFn(requestParser.validateInput(rawInput)) };
107
93
  // GGLog.debug(httpSchema, "Response", rpcResult) // This is very slow to log this (like 3x performance loss)
108
94
  }
109
95
  catch (error) {
@@ -123,7 +109,7 @@ function setupRoutes(httpSchema, implementation, config) {
123
109
  metrics(rpcResult?.type, httpSchema.name, codec.method, pathPrefix, codec.path, startTime);
124
110
  }
125
111
  });
126
- });
112
+ }, `${httpSchema.name}.${methodName}`);
127
113
  }
128
114
  }
129
115
  function metrics(resultType, apiName, method, pathPrefix, pathSuffix, startTime) {
@@ -1 +1 @@
1
- {"version":3,"file":"GGHttpSchema.startServer.js","sourceRoot":"","sources":["../../../src/server/GGHttpSchema.startServer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAwD,YAAY,EAAC,MAAM,wBAAwB,CAAC;AAC3G,OAAO,EAAC,k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AAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,SAAiB;IAEjB,IAAI,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC;QACnB,MAAM,IAAI,GAAG,MAAM,GAAG,GAAG,GAAG,UAAU,GAAG,UAAU,CAAC;QACpD,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE;YAC1B,GAAG,EAAE,OAAO;YACZ,MAAM,EAAE,UAAU;YAClB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,UAAU;SACrB,CAAC,CAAC;QACH,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS,EAAE;YACjE,GAAG,EAAE,OAAO;YACZ,MAAM,EAAE,UAAU;YAClB,IAAI,EAAE,IAAI;SACb,CAAC,CAAC;IACP,CAAC;AACL,CAAC"}
@@ -2,7 +2,9 @@ import http from "http";
2
2
  import { HttpMethod } from "@grest-ts/common";
3
3
  import { GGLocatorKey, GGLocatorScope } from "@grest-ts/locator";
4
4
  import type { GGHttpSchema } from "../schema/GGHttpSchema";
5
+ import "../schema/GGWireContextKey.node";
5
6
  import { GGContractMethod, GGPermission } from "@grest-ts/schema";
7
+ import type { GGTransportMiddleware } from "@grest-ts/context";
6
8
  type AnyWebSocketSchema = {
7
9
  name: string;
8
10
  path: string;
@@ -10,13 +12,37 @@ type AnyWebSocketSchema = {
10
12
  clientToServer: {
11
13
  methods: Record<string, GGContractMethod>;
12
14
  };
15
+ serverToClient: {
16
+ methods: Record<string, GGContractMethod>;
17
+ };
13
18
  };
14
- middlewares: readonly unknown[];
19
+ middlewares: readonly GGTransportMiddleware[];
15
20
  connectPermission?: GGPermission;
16
21
  };
22
+ export interface GGCorsConfig {
23
+ /**
24
+ * Allowed cross-origin origins. Either an exact-match list or a predicate.
25
+ * Only a matching Origin is echoed back — an arbitrary origin is never
26
+ * reflected (that would be a credential-leak / CSRF hole with credentials on).
27
+ */
28
+ origins: string[] | ((origin: string) => boolean);
29
+ /**
30
+ * When true, adds Access-Control-Allow-Credentials: true so the browser will
31
+ * send/store cross-origin cookies. Requires an exact-origin echo (never `*`),
32
+ * which this enforces by construction.
33
+ */
34
+ credentials?: boolean;
35
+ }
17
36
  export interface GGHttpServerAdapterConfig {
18
37
  key?: GGLocatorKey<GGHttpServer>;
19
38
  port?: number;
39
+ /**
40
+ * Cross-origin policy. Omitted (default) keeps the permissive
41
+ * `Access-Control-Allow-Origin: *` with no credentials — backward compatible.
42
+ * When set, switches to allowlisted mode: only an Origin in `origins` is echoed
43
+ * (never `*`), and `credentials: true` enables cross-origin cookies.
44
+ */
45
+ cors?: GGCorsConfig;
20
46
  /**
21
47
  * If provided, the server listens over HTTPS using this cert+key. Both
22
48
  * must be PEM-encoded strings or Buffers. Leaving undefined keeps the
@@ -36,6 +62,7 @@ export declare class GGHttpServer {
36
62
  protected readonly scope: GGLocatorScope;
37
63
  protected readonly runtimeName: string;
38
64
  private readonly configuredPort;
65
+ private readonly cors?;
39
66
  private readonly _onStart;
40
67
  private readonly _onTeardown;
41
68
  /**
@@ -43,12 +70,9 @@ export declare class GGHttpServer {
43
70
  * Framework-internal — only setupRoutes() (in GGHttpSchema.startServer.ts) should push here.
44
71
  */
45
72
  private readonly _registeredSchemas;
46
- /**
47
- * All GGHttpSchema instances registered on this server, in registration order.
48
- * Available from the moment compose() begins; frozen (no further push allowed) once start() is called.
49
- */
50
- get registeredSchemas(): ReadonlyArray<GGHttpSchema<any, any>>;
73
+ private readonly _registeredWebSocketSchemas;
51
74
  readonly httpServer: http.Server;
75
+ private readonly _routeOwners;
52
76
  private activeRequests;
53
77
  private router;
54
78
  private static readonly DEFAULT_CORS_HEADERS;
@@ -74,24 +98,31 @@ export declare class GGHttpServer {
74
98
  get port(): number | undefined;
75
99
  /** @internal Called by setupRoutes() during compose(). Do not call directly. */
76
100
  _registerSchema(schema: GGHttpSchema<any, any>): void;
77
- private readonly _registeredWebSocketSchemas;
101
+ /**
102
+ * All GGHttpSchema instances registered on this server, in registration order.
103
+ * Available from the moment compose() begins; frozen (no further push allowed) once start() is called.
104
+ */
105
+ get registeredSchemas(): ReadonlyArray<GGHttpSchema<any, any>>;
106
+ /** @internal Called by GGWebSocketSchema.startServer(). Do not call directly. */
107
+ _registerWebSocketSchema(schema: AnyWebSocketSchema): void;
78
108
  /**
79
109
  * All GGWebSocketSchema instances registered on this server, in registration order.
80
110
  * Populated automatically by GGWebSocketSchema.startServer() / .register().
81
111
  */
82
112
  get registeredWebSocketSchemas(): ReadonlyArray<AnyWebSocketSchema>;
83
- /** @internal Called by GGWebSocketSchema.startServer(). Do not call directly. */
84
- _registerWebSocketSchema(schema: AnyWebSocketSchema): void;
85
- private readonly _schemasWithResolver;
86
- /** @internal Called by HTTP / WS register paths when a scope resolver is wired. */
87
- _markResolverWired(schema: object): void;
88
- private _checkPermissionsAtStart;
89
- registerRoute(method: HttpMethod, path: string, handler: GGHttpRequestCallback): void;
113
+ registerRoute(method: HttpMethod, path: string, handler: GGHttpRequestCallback, owner?: string): void;
90
114
  start(): Promise<void>;
91
115
  teardown(): Promise<void>;
92
116
  onStart(callback: () => Promise<void> | void): this;
93
117
  onTeardown(callback: () => Promise<void> | void): this;
94
118
  }
95
119
  export type GGHttpRequestCallback = (req: http.IncomingMessage, res: http.ServerResponse) => Promise<void>;
120
+ /**
121
+ * Computes CORS response headers for a request Origin. Pure (no req/res) so it is
122
+ * unit-testable. Default (no config) = permissive `*`, no credentials. With config =
123
+ * allowlisted: only a matching Origin is echoed (never `*`), `credentials` adds
124
+ * Allow-Credentials, and Vary: Origin is always set so caches key on the origin.
125
+ */
126
+ export declare function corsResponseHeaders(origin: string | undefined, cors: GGCorsConfig | undefined, allowHeaders: string, exposeHeaders: string): Record<string, string>;
96
127
  export {};
97
128
  //# sourceMappingURL=GGHttpServer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GGHttpServer.d.ts","sourceRoot":"","sources":["../../../src/server/GGHttpServer.ts"],"names":[],"mappings":"AA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