@ripple-ts/adapter 0.2.211 → 0.2.213

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @ripple-ts/adapter
2
2
 
3
+ ## 0.2.213
4
+
5
+ ## 0.2.212
6
+
3
7
  ## 0.2.211
4
8
 
5
9
  ### Patch Changes
package/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # @ripple-ts/adapter
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/%40ripple-ts%2Fadapter?logo=npm)](https://www.npmjs.com/package/@ripple-ts/adapter)
4
+ [![npm downloads](https://img.shields.io/npm/dm/%40ripple-ts%2Fadapter?logo=npm&label=downloads)](https://www.npmjs.com/package/@ripple-ts/adapter)
5
+
3
6
  Shared adapter primitives for Ripple metaframework adapters.
4
7
 
5
8
  This package contains common runtime helpers and shared type contracts used by
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Shared adapter primitives for Ripple metaframework adapters",
4
4
  "license": "MIT",
5
5
  "author": "Dominic Gannaway",
6
- "version": "0.2.211",
6
+ "version": "0.2.213",
7
7
  "type": "module",
8
8
  "module": "src/index.js",
9
9
  "main": "src/index.js",
package/types/index.d.ts CHANGED
@@ -6,6 +6,17 @@ export type FetchHandler<Platform = any, ResultValue = Response> = (
6
6
  export type AdapterCoreOptions = {
7
7
  port?: number;
8
8
  hostname?: string;
9
+ /**
10
+ * Whether to trust `X-Forwarded-Proto` and `X-Forwarded-Host` headers
11
+ * when deriving the request origin (protocol + host).
12
+ *
13
+ * Enable this only when the application is behind a trusted reverse proxy
14
+ * (e.g., nginx, Cloudflare, AWS ALB). When `false` (the default), the
15
+ * protocol is inferred from the socket and the host from the `Host` header.
16
+ *
17
+ * @default false
18
+ */
19
+ trustProxy?: boolean;
9
20
  };
10
21
 
11
22
  export type ServeStaticOptions = {
@@ -29,6 +40,12 @@ export type ServeResult<Server = any> = {
29
40
  close: () => void;
30
41
  };
31
42
 
43
+ export type ServeFunction<
44
+ Platform = any,
45
+ Options extends AdapterCoreOptions = AdapterCoreOptions,
46
+ Server = any,
47
+ > = (fetch_handler: FetchHandler<Platform>, options?: Options) => ServeResult<Server>;
48
+
32
49
  export const DEFAULT_HOSTNAME: 'localhost';
33
50
  export const DEFAULT_PORT: 3000;
34
51
  export const DEFAULT_STATIC_PREFIX: '/';