@temporary-name/server 1.9.3-alpha.e098b3d1c5bffbad2fadfda89ba01f6452db46b5 → 1.9.3-alpha.f9f5ce625d5edee78250b87b3a64f1d9760c2244

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.
@@ -30,32 +30,6 @@ declare class CORSPlugin<T extends Context> implements StandardHandlerPlugin<T>
30
30
  init(options: StandardHandlerOptions<T>): void;
31
31
  }
32
32
 
33
- interface RequestHeadersPluginContext {
34
- reqHeaders?: Headers;
35
- }
36
- /**
37
- * The Request Headers Plugin injects a `reqHeaders` instance into the context,
38
- * allowing access to request headers in oRPC.
39
- *
40
- * @see {@link https://orpc.unnoq.com/docs/plugins/request-headers Request Headers Plugin Docs}
41
- */
42
- declare class RequestHeadersPlugin<T extends RequestHeadersPluginContext> implements StandardHandlerPlugin<T> {
43
- init(options: StandardHandlerOptions<T>): void;
44
- }
45
-
46
- interface ResponseHeadersPluginContext {
47
- resHeaders?: Headers;
48
- }
49
- /**
50
- * The Response Headers Plugin allows you to set response headers in oRPC.
51
- * It injects a resHeaders instance into the context, enabling you to modify response headers easily.
52
- *
53
- * @see {@link https://orpc.unnoq.com/docs/plugins/response-headers Response Headers Plugin Docs}
54
- */
55
- declare class ResponseHeadersPlugin<T extends ResponseHeadersPluginContext> implements StandardHandlerPlugin<T> {
56
- init(options: StandardHandlerOptions<T>): void;
57
- }
58
-
59
33
  interface SimpleCsrfProtectionHandlerPluginOptions<T extends Context> {
60
34
  /**
61
35
  * The name of the header to check.
@@ -106,5 +80,5 @@ declare class SimpleCsrfProtectionHandlerPlugin<T extends Context> implements St
106
80
  init(options: StandardHandlerOptions<T>): void;
107
81
  }
108
82
 
109
- export { CORSPlugin, RequestHeadersPlugin, ResponseHeadersPlugin, SimpleCsrfProtectionHandlerPlugin };
110
- export type { CORSOptions, RequestHeadersPluginContext, ResponseHeadersPluginContext, SimpleCsrfProtectionHandlerPluginOptions };
83
+ export { CORSPlugin, SimpleCsrfProtectionHandlerPlugin };
84
+ export type { CORSOptions, SimpleCsrfProtectionHandlerPluginOptions };
@@ -30,32 +30,6 @@ declare class CORSPlugin<T extends Context> implements StandardHandlerPlugin<T>
30
30
  init(options: StandardHandlerOptions<T>): void;
31
31
  }
32
32
 
33
- interface RequestHeadersPluginContext {
34
- reqHeaders?: Headers;
35
- }
36
- /**
37
- * The Request Headers Plugin injects a `reqHeaders` instance into the context,
38
- * allowing access to request headers in oRPC.
39
- *
40
- * @see {@link https://orpc.unnoq.com/docs/plugins/request-headers Request Headers Plugin Docs}
41
- */
42
- declare class RequestHeadersPlugin<T extends RequestHeadersPluginContext> implements StandardHandlerPlugin<T> {
43
- init(options: StandardHandlerOptions<T>): void;
44
- }
45
-
46
- interface ResponseHeadersPluginContext {
47
- resHeaders?: Headers;
48
- }
49
- /**
50
- * The Response Headers Plugin allows you to set response headers in oRPC.
51
- * It injects a resHeaders instance into the context, enabling you to modify response headers easily.
52
- *
53
- * @see {@link https://orpc.unnoq.com/docs/plugins/response-headers Response Headers Plugin Docs}
54
- */
55
- declare class ResponseHeadersPlugin<T extends ResponseHeadersPluginContext> implements StandardHandlerPlugin<T> {
56
- init(options: StandardHandlerOptions<T>): void;
57
- }
58
-
59
33
  interface SimpleCsrfProtectionHandlerPluginOptions<T extends Context> {
60
34
  /**
61
35
  * The name of the header to check.
@@ -106,5 +80,5 @@ declare class SimpleCsrfProtectionHandlerPlugin<T extends Context> implements St
106
80
  init(options: StandardHandlerOptions<T>): void;
107
81
  }
108
82
 
109
- export { CORSPlugin, RequestHeadersPlugin, ResponseHeadersPlugin, SimpleCsrfProtectionHandlerPlugin };
110
- export type { CORSOptions, RequestHeadersPluginContext, ResponseHeadersPluginContext, SimpleCsrfProtectionHandlerPluginOptions };
83
+ export { CORSPlugin, SimpleCsrfProtectionHandlerPlugin };
84
+ export type { CORSOptions, SimpleCsrfProtectionHandlerPluginOptions };
@@ -1,6 +1,5 @@
1
- import { value, clone, ORPCError } from '@temporary-name/shared';
1
+ import { value, ORPCError } from '@temporary-name/shared';
2
2
  import { flattenHeader } from '@temporary-name/standard-server';
3
- import { toFetchHeaders } from '@temporary-name/standard-server-fetch';
4
3
 
5
4
  class CORSPlugin {
6
5
  options;
@@ -75,58 +74,6 @@ class CORSPlugin {
75
74
  }
76
75
  }
77
76
 
78
- class RequestHeadersPlugin {
79
- init(options) {
80
- options.rootInterceptors ??= [];
81
- options.rootInterceptors.push((interceptorOptions) => {
82
- const reqHeaders = interceptorOptions.context.reqHeaders ?? toFetchHeaders(interceptorOptions.request.headers);
83
- return interceptorOptions.next({
84
- ...interceptorOptions,
85
- context: {
86
- ...interceptorOptions.context,
87
- reqHeaders
88
- }
89
- });
90
- });
91
- }
92
- }
93
-
94
- class ResponseHeadersPlugin {
95
- init(options) {
96
- options.rootInterceptors ??= [];
97
- options.rootInterceptors.push(async (interceptorOptions) => {
98
- const resHeaders = interceptorOptions.context.resHeaders ?? new Headers();
99
- const result = await interceptorOptions.next({
100
- ...interceptorOptions,
101
- context: {
102
- ...interceptorOptions.context,
103
- resHeaders
104
- }
105
- });
106
- if (!result.matched) {
107
- return result;
108
- }
109
- const responseHeaders = clone(result.response.headers);
110
- for (const [key, value] of resHeaders) {
111
- if (Array.isArray(responseHeaders[key])) {
112
- responseHeaders[key].push(value);
113
- } else if (responseHeaders[key] !== void 0) {
114
- responseHeaders[key] = [responseHeaders[key], value];
115
- } else {
116
- responseHeaders[key] = value;
117
- }
118
- }
119
- return {
120
- ...result,
121
- response: {
122
- ...result.response,
123
- headers: responseHeaders
124
- }
125
- };
126
- });
127
- }
128
- }
129
-
130
77
  const SIMPLE_CSRF_PROTECTION_CONTEXT_SYMBOL = Symbol("SIMPLE_CSRF_PROTECTION_CONTEXT");
131
78
  class SimpleCsrfProtectionHandlerPlugin {
132
79
  headerName;
@@ -172,4 +119,4 @@ class SimpleCsrfProtectionHandlerPlugin {
172
119
  }
173
120
  }
174
121
 
175
- export { CORSPlugin, RequestHeadersPlugin, ResponseHeadersPlugin, SimpleCsrfProtectionHandlerPlugin };
122
+ export { CORSPlugin, SimpleCsrfProtectionHandlerPlugin };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@temporary-name/server",
3
3
  "type": "module",
4
- "version": "1.9.3-alpha.e098b3d1c5bffbad2fadfda89ba01f6452db46b5",
4
+ "version": "1.9.3-alpha.f9f5ce625d5edee78250b87b3a64f1d9760c2244",
5
5
  "license": "MIT",
6
6
  "homepage": "https://www.stainless.com/",
7
7
  "repository": {
@@ -73,15 +73,15 @@
73
73
  "cookie": "^1.0.2",
74
74
  "rou3": "^0.7.7",
75
75
  "zod": "^4.1.12",
76
- "@temporary-name/contract": "1.9.3-alpha.e098b3d1c5bffbad2fadfda89ba01f6452db46b5",
77
- "@temporary-name/json-schema": "1.9.3-alpha.e098b3d1c5bffbad2fadfda89ba01f6452db46b5",
78
- "@temporary-name/interop": "1.9.3-alpha.e098b3d1c5bffbad2fadfda89ba01f6452db46b5",
79
- "@temporary-name/standard-server-aws-lambda": "1.9.3-alpha.e098b3d1c5bffbad2fadfda89ba01f6452db46b5",
80
- "@temporary-name/standard-server": "1.9.3-alpha.e098b3d1c5bffbad2fadfda89ba01f6452db46b5",
81
- "@temporary-name/standard-server-fetch": "1.9.3-alpha.e098b3d1c5bffbad2fadfda89ba01f6452db46b5",
82
- "@temporary-name/standard-server-node": "1.9.3-alpha.e098b3d1c5bffbad2fadfda89ba01f6452db46b5",
83
- "@temporary-name/shared": "1.9.3-alpha.e098b3d1c5bffbad2fadfda89ba01f6452db46b5",
84
- "@temporary-name/zod": "1.9.3-alpha.e098b3d1c5bffbad2fadfda89ba01f6452db46b5"
76
+ "@temporary-name/contract": "1.9.3-alpha.f9f5ce625d5edee78250b87b3a64f1d9760c2244",
77
+ "@temporary-name/interop": "1.9.3-alpha.f9f5ce625d5edee78250b87b3a64f1d9760c2244",
78
+ "@temporary-name/shared": "1.9.3-alpha.f9f5ce625d5edee78250b87b3a64f1d9760c2244",
79
+ "@temporary-name/standard-server": "1.9.3-alpha.f9f5ce625d5edee78250b87b3a64f1d9760c2244",
80
+ "@temporary-name/standard-server-aws-lambda": "1.9.3-alpha.f9f5ce625d5edee78250b87b3a64f1d9760c2244",
81
+ "@temporary-name/standard-server-fetch": "1.9.3-alpha.f9f5ce625d5edee78250b87b3a64f1d9760c2244",
82
+ "@temporary-name/standard-server-node": "1.9.3-alpha.f9f5ce625d5edee78250b87b3a64f1d9760c2244",
83
+ "@temporary-name/json-schema": "1.9.3-alpha.f9f5ce625d5edee78250b87b3a64f1d9760c2244",
84
+ "@temporary-name/zod": "1.9.3-alpha.f9f5ce625d5edee78250b87b3a64f1d9760c2244"
85
85
  },
86
86
  "devDependencies": {
87
87
  "@types/supertest": "^6.0.3",