@effectstream/utils 0.200.5 → 0.300.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effectstream/utils",
3
- "version": "0.200.5",
3
+ "version": "0.300.0",
4
4
  "license": "(MIT OR Apache-2.0)",
5
5
  "homepage": "https://effectstream.github.io/docs/",
6
6
  "repository": {
package/src/config.ts CHANGED
@@ -207,6 +207,13 @@ const definitions: Record<string, ConfigDefinition> = {
207
207
  description:
208
208
  "Main Paima API Port. Used by developers custom endpoints and RPC endpoints. Example: '9999'",
209
209
  },
210
+ EFFECTSTREAM_TRUST_PROXY: {
211
+ key: "EFFECTSTREAM_TRUST_PROXY",
212
+ type: "string",
213
+ defaultValue: "true",
214
+ description:
215
+ "Whether the HTTP server trusts X-Forwarded-For / X-Forwarded-Proto from a reverse proxy in front of it, so request.ip is the client and not the proxy. 'true' (default, trust every hop), 'false' (never), or a comma-separated list of proxy IPs/CIDRs such as '127.0.0.1,10.0.0.0/8'. Mirrors Fastify's trustProxy option.",
216
+ },
210
217
  EFFECTSTREAM_EXPLORER_PORT: {
211
218
  key: "EFFECTSTREAM_EXPLORER_PORT",
212
219
  type: "number",
@@ -412,6 +419,9 @@ export class ENV {
412
419
  static get EFFECTSTREAM_API_PORT(): number {
413
420
  return ENV.getConfig(definitions.EFFECTSTREAM_API_PORT);
414
421
  }
422
+ static get EFFECTSTREAM_TRUST_PROXY(): string {
423
+ return ENV.getConfig(definitions.EFFECTSTREAM_TRUST_PROXY);
424
+ }
415
425
  static get RECAPTCHA_V3_FRONTEND(): string {
416
426
  return ENV.getConfig(definitions.RECAPTCHA_V3_FRONTEND);
417
427
  }
@@ -94,13 +94,26 @@ export function spawn(command: string, options: SpawnOptions = {}): SpawnChild {
94
94
  code?: number;
95
95
  signal?: string;
96
96
  }>((resolve) => {
97
+ let settled = false;
98
+ const finish = (value: { success: boolean; code?: number; signal?: string }) => {
99
+ if (settled) return;
100
+ settled = true;
101
+ resolve(value);
102
+ };
97
103
  cp.on("close", (code: number | null, signal: string | null) => {
98
- resolve({
104
+ finish({
99
105
  success: code === 0,
100
106
  code: code ?? undefined,
101
107
  signal: signal ?? undefined,
102
108
  });
103
109
  });
110
+ // A ChildProcess "error" with no listener is an uncaught exception. It is
111
+ // emitted when the process cannot be spawned at all and, importantly, when
112
+ // `options.signal` aborts a running child — the supported way to cancel a
113
+ // long-lived child such as `pg_dump`.
114
+ cp.on("error", () => {
115
+ finish({ success: false });
116
+ });
104
117
  });
105
118
 
106
119
  let stdinStream: WritableStream<Uint8Array> | undefined;