@zyno-io/ts-server-foundation 26.927.107 → 26.930.146

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.
@@ -541,7 +541,7 @@ Examples:
541
541
  }
542
542
  this.signalHandlers = undefined;
543
543
  }
544
- static __tsfType = _AppMetadata_1 = _a.decodeCompactMetadataV2("[2,{\"kind\":16,\"name\":\"App\",\"typeName\":\"App\",\"classType\":{\"$tsf\":0},\"properties\":[{\"name\":\"container\",\"type\":{\"$tsfNode\":0},\"optional\":false},{\"name\":\"events\",\"type\":{\"kind\":16,\"typeName\":\"EventBus\",\"classType\":{\"$tsfImport\":[1,\"../events/index\",\"EventBus\"]}},\"optional\":false},{\"name\":\"config\",\"type\":{\"$tsfType\":0},\"optional\":false},{\"name\":\"router\",\"type\":{\"kind\":16,\"typeName\":\"HttpRouter\",\"classType\":{\"$tsfImport\":[1,\"../http/index\",\"HttpRouter\"]}},\"optional\":false},{\"name\":\"http\",\"type\":{\"kind\":16,\"typeName\":\"HttpServerRuntime\",\"classType\":{\"$tsfImport\":[1,\"../http/index\",\"HttpServerRuntime\"]},\"typeArguments\":[{\"kind\":2,\"typeName\":\"C\"}]},\"optional\":false}],\"methods\":[{\"name\":\"get\",\"parameters\":[{\"name\":\"token\",\"type\":{\"$tsfType\":1},\"optional\":false,\"default\":false}],\"returnType\":{\"$tsfType\":2}},{\"name\":\"getInjectorContext\",\"parameters\":[],\"returnType\":{\"$tsfNode\":0}},{\"name\":\"on\",\"parameters\":[{\"name\":\"token\",\"type\":{\"kind\":16,\"typeName\":\"EventToken\",\"classType\":{\"$tsfImport\":[1,\"../events/index\",\"EventToken\"]},\"typeArguments\":[{\"kind\":16,\"typeName\":\"TEvent\",\"classType\":{\"$tsf\":2}}]},\"optional\":false,\"default\":false},{\"name\":\"handler\",\"type\":{\"$tsfType\":3},\"optional\":false,\"default\":false},{\"name\":\"order\",\"type\":{\"$tsfType\":4},\"optional\":true,\"default\":true}],\"returnType\":{\"$tsfType\":5}},{\"name\":\"registerCleanup\",\"parameters\":[{\"name\":\"cleanup\",\"type\":{\"$tsfType\":6},\"optional\":false,\"default\":false}],\"returnType\":{\"$tsfType\":5},\"description\":\"Register cleanup for a resource acquired by this application.\"},{\"name\":\"start\",\"parameters\":[],\"returnType\":{\"$tsfType\":7}},{\"name\":\"stop\",\"parameters\":[],\"returnType\":{\"$tsfType\":7}},{\"name\":\"run\",\"parameters\":[{\"name\":\"port\",\"type\":{\"$tsfType\":8},\"optional\":true,\"default\":false},{\"name\":\"host\",\"type\":{\"$tsfType\":9},\"optional\":true,\"default\":false}],\"returnType\":{\"$tsfType\":7}},{\"name\":\"configureForCliService\",\"parameters\":[],\"returnType\":{\"$tsfType\":10}},{\"name\":\"configureForRepl\",\"parameters\":[],\"returnType\":{\"$tsfType\":10}},{\"name\":\"request\",\"parameters\":[{\"name\":\"request\",\"type\":{\"kind\":16,\"typeName\":\"HttpRequest\",\"classType\":{\"$tsfImport\":[1,\"../http/index\",\"HttpRequest\"]}},\"optional\":false,\"default\":false},{\"name\":\"response\",\"type\":{\"$tsfNode\":1},\"optional\":true,\"default\":true}],\"returnType\":{\"kind\":22,\"type\":{\"$tsfNode\":1}}}],\"hasConstructor\":true,\"constructorParameters\":[{\"name\":\"options\",\"type\":{\"kind\":18,\"typeName\":\"CreateAppOptions\",\"types\":[{\"$tsfNode\":2},{\"$tsfNode\":3},{\"kind\":20,\"name\":\"imports\",\"type\":{\"kind\":12,\"types\":[{\"kind\":14,\"type\":{\"kind\":12,\"types\":[{\"$tsfNode\":4},{\"kind\":2,\"typeName\":\"ClassType\"},{\"kind\":18,\"typeName\":\"ModuleInstance\",\"types\":[{\"kind\":20,\"name\":\"definition\",\"type\":{\"$tsfNode\":4},\"optional\":false}]}],\"typeName\":\"ModuleLike\"}},{\"kind\":4}]},\"optional\":true},{\"$tsfNode\":5},{\"$tsfNode\":6},{\"$tsfNode\":7},{\"$tsfNode\":8},{\"$tsfNode\":9},{\"$tsfNode\":2},{\"$tsfNode\":3},{\"kind\":20,\"name\":\"envPassthrough\",\"type\":{\"kind\":12,\"types\":[{\"kind\":14,\"type\":{\"$tsfNode\":10}},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"db\",\"type\":{\"kind\":12,\"types\":[{\"kind\":2,\"typeName\":\"ClassType\"},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"frameworkConfig\",\"type\":{\"$tsfNode\":11},\"optional\":true},{\"kind\":20,\"name\":\"serverConfig\",\"type\":{\"$tsfNode\":11},\"optional\":true},{\"kind\":20,\"name\":\"cors\",\"type\":{\"kind\":12,\"types\":[{\"kind\":2,\"typeName\":\"HttpCorsConfig\",\"typeArguments\":[{\"kind\":2,\"typeName\":\"C\"}]},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"staticFiles\",\"type\":{\"kind\":12,\"types\":[{\"kind\":12,\"types\":[{\"kind\":8},{\"kind\":18,\"typeName\":\"StaticFilesOptions\",\"types\":[{\"kind\":20,\"name\":\"directory\",\"type\":{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"index\",\"type\":{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"spaFallback\",\"type\":{\"kind\":12,\"types\":[{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":10,\"literal\":false}]},{\"kind\":4}]},\"optional\":true}]}]},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"requestLogging\",\"type\":{\"kind\":12,\"types\":[{\"kind\":18,\"typeName\":\"HttpRequestLoggingOptions\",\"types\":[{\"kind\":20,\"name\":\"excludePaths\",\"type\":{\"kind\":12,\"types\":[{\"kind\":14,\"type\":{\"kind\":12,\"types\":[{\"kind\":6},{\"$tsfNode\":10}]}},{\"kind\":4}]},\"optional\":true}]},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"httpResolvers\",\"type\":{\"kind\":12,\"types\":[{\"kind\":18,\"typeName\":\"Record\",\"utilityType\":\"Record\",\"typeArguments\":[{\"kind\":6},{\"kind\":2,\"typeName\":\"RouteParameterResolverInput\"}],\"index\":{\"kind\":2,\"typeName\":\"RouteParameterResolverInput\"},\"types\":[],\"typeName\":\"RouteParameterResolverRegistry\"},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"fallbackController\",\"type\":{\"kind\":12,\"types\":[{\"kind\":2,\"typeName\":\"ClassType\",\"typeArguments\":[{\"kind\":18,\"typeName\":\"HttpFallbackController\",\"types\":[]}]},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"enableHealthcheck\",\"type\":{\"kind\":12,\"types\":[{\"kind\":8},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"enableWorker\",\"type\":{\"kind\":12,\"types\":[{\"kind\":8},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"enableDkRpc\",\"type\":{\"kind\":12,\"types\":[{\"kind\":8},{\"kind\":4}]},\"optional\":true}]},\"optional\":false,\"default\":false}]},[{\"kind\":16,\"typeName\":\"Container\",\"classType\":{\"$tsfImport\":[1,\"../di/index\",\"Container\"]}},{\"kind\":16,\"typeName\":\"HttpResponse\",\"classType\":{\"$tsfImport\":[1,\"../http/index\",\"HttpResponse\"]}},{\"kind\":20,\"name\":\"config\",\"type\":{\"$tsfNode\":12},\"optional\":true},{\"kind\":20,\"name\":\"defaultConfig\",\"type\":{\"$tsfNode\":13},\"optional\":true},{\"kind\":18,\"typeName\":\"ModuleDefinition\",\"types\":{\"$tsfNode\":14},\"typeParameters\":[\"C\"]},{\"kind\":20,\"name\":\"exports\",\"type\":{\"$tsfNode\":15},\"optional\":true},{\"kind\":20,\"name\":\"providers\",\"type\":{\"$tsfNode\":16},\"optional\":true},{\"kind\":20,\"name\":\"controllers\",\"type\":{\"$tsfNode\":17},\"optional\":true},{\"kind\":20,\"name\":\"listeners\",\"type\":{\"$tsfNode\":17},\"optional\":true},{\"kind\":20,\"name\":\"commands\",\"type\":{\"$tsfNode\":17},\"optional\":true},{\"kind\":16,\"typeName\":\"RegExp\",\"classType\":{\"$tsf\":3}},{\"kind\":12,\"types\":{\"$tsfNode\":18}},{\"kind\":12,\"types\":{\"$tsfNode\":19}},{\"kind\":12,\"types\":{\"$tsfNode\":20}},[{\"$tsfNode\":2},{\"$tsfNode\":3},{\"$tsfNode\":21},{\"$tsfNode\":5},{\"$tsfNode\":6},{\"$tsfNode\":7},{\"$tsfNode\":8},{\"$tsfNode\":9}],{\"kind\":12,\"types\":{\"$tsfNode\":22}},{\"kind\":12,\"types\":{\"$tsfNode\":23}},{\"kind\":12,\"types\":{\"$tsfNode\":24}},[{\"$tsfNode\":25},{\"kind\":4}],[{\"$tsfNode\":26},{\"kind\":4}],[{\"$tsfNode\":27},{\"kind\":4}],{\"kind\":20,\"name\":\"imports\",\"type\":{\"$tsfNode\":28},\"optional\":true},[{\"kind\":14,\"type\":{\"kind\":2,\"typeName\":\"Token\"}},{\"kind\":4}],[{\"kind\":14,\"type\":{\"kind\":2,\"typeName\":\"Provider\"}},{\"kind\":4}],[{\"kind\":14,\"type\":{\"kind\":2,\"typeName\":\"ClassType\"}},{\"kind\":4}],{\"kind\":18,\"typeName\":\"Record\",\"utilityType\":\"Record\",\"typeArguments\":[{\"kind\":6},{\"kind\":2}],\"index\":{\"kind\":2},\"types\":[]},{\"kind\":2,\"typeName\":\"ClassType\",\"typeArguments\":[{\"kind\":2,\"typeName\":\"C\"}]},{\"kind\":18,\"typeName\":\"Partial\",\"utilityType\":\"Partial\",\"typeArguments\":[{\"kind\":2,\"typeName\":\"C\"}],\"utilityKeys\":[],\"types\":[]},{\"kind\":12,\"types\":[{\"kind\":2,\"typeName\":\"ModuleLike[]\"},{\"kind\":4}]}]]", [() => App, require, () => (typeof TEvent !== "undefined" ? TEvent : (typeof exports !== "undefined" ? exports.TEvent : undefined)), () => (typeof RegExp !== "undefined" ? RegExp : (typeof exports !== "undefined" ? exports.RegExp : undefined))], __tsf_metadata_type);
544
+ static __tsfType = _AppMetadata_1 = _a.decodeCompactMetadataV2("[2,{\"kind\":16,\"name\":\"App\",\"typeName\":\"App\",\"classType\":{\"$tsf\":0},\"properties\":[{\"name\":\"container\",\"type\":{\"$tsfNode\":0},\"optional\":false},{\"name\":\"events\",\"type\":{\"kind\":16,\"typeName\":\"EventBus\",\"classType\":{\"$tsfImport\":[1,\"../events/index\",\"EventBus\"]}},\"optional\":false},{\"name\":\"config\",\"type\":{\"$tsfType\":0},\"optional\":false},{\"name\":\"router\",\"type\":{\"kind\":16,\"typeName\":\"HttpRouter\",\"classType\":{\"$tsfImport\":[1,\"../http/index\",\"HttpRouter\"]}},\"optional\":false},{\"name\":\"http\",\"type\":{\"kind\":16,\"typeName\":\"HttpServerRuntime\",\"classType\":{\"$tsfImport\":[1,\"../http/index\",\"HttpServerRuntime\"]},\"typeArguments\":[{\"kind\":2,\"typeName\":\"C\"}]},\"optional\":false}],\"methods\":[{\"name\":\"get\",\"parameters\":[{\"name\":\"token\",\"type\":{\"$tsfType\":1},\"optional\":false,\"default\":false}],\"returnType\":{\"$tsfType\":2}},{\"name\":\"getInjectorContext\",\"parameters\":[],\"returnType\":{\"$tsfNode\":0}},{\"name\":\"on\",\"parameters\":[{\"name\":\"token\",\"type\":{\"kind\":16,\"typeName\":\"EventToken\",\"classType\":{\"$tsfImport\":[1,\"../events/index\",\"EventToken\"]},\"typeArguments\":[{\"kind\":16,\"typeName\":\"TEvent\",\"classType\":{\"$tsf\":2}}]},\"optional\":false,\"default\":false},{\"name\":\"handler\",\"type\":{\"$tsfType\":3},\"optional\":false,\"default\":false},{\"name\":\"order\",\"type\":{\"$tsfType\":4},\"optional\":true,\"default\":true}],\"returnType\":{\"$tsfType\":5}},{\"name\":\"registerCleanup\",\"parameters\":[{\"name\":\"cleanup\",\"type\":{\"$tsfType\":6},\"optional\":false,\"default\":false}],\"returnType\":{\"$tsfType\":5},\"description\":\"Register cleanup for a resource acquired by this application.\"},{\"name\":\"start\",\"parameters\":[],\"returnType\":{\"$tsfType\":7}},{\"name\":\"stop\",\"parameters\":[],\"returnType\":{\"$tsfType\":7}},{\"name\":\"run\",\"parameters\":[{\"name\":\"port\",\"type\":{\"$tsfType\":8},\"optional\":true,\"default\":false},{\"name\":\"host\",\"type\":{\"$tsfType\":9},\"optional\":true,\"default\":false}],\"returnType\":{\"$tsfType\":7}},{\"name\":\"configureForCliService\",\"parameters\":[],\"returnType\":{\"$tsfType\":10}},{\"name\":\"configureForRepl\",\"parameters\":[],\"returnType\":{\"$tsfType\":10}},{\"name\":\"request\",\"parameters\":[{\"name\":\"request\",\"type\":{\"kind\":16,\"typeName\":\"HttpRequest\",\"classType\":{\"$tsfImport\":[1,\"../http/index\",\"HttpRequest\"]}},\"optional\":false,\"default\":false},{\"name\":\"response\",\"type\":{\"$tsfNode\":1},\"optional\":true,\"default\":true}],\"returnType\":{\"kind\":22,\"type\":{\"$tsfNode\":1}}}],\"hasConstructor\":true,\"constructorParameters\":[{\"name\":\"options\",\"type\":{\"kind\":18,\"typeName\":\"CreateAppOptions\",\"types\":[{\"$tsfNode\":2},{\"$tsfNode\":3},{\"kind\":20,\"name\":\"imports\",\"type\":{\"kind\":12,\"types\":[{\"kind\":14,\"type\":{\"kind\":12,\"types\":[{\"kind\":18,\"typeName\":\"ModuleDefinition\",\"types\":[{\"$tsfNode\":2},{\"$tsfNode\":3},{\"kind\":20,\"name\":\"imports\",\"type\":{\"kind\":12,\"types\":[{\"kind\":14,\"type\":{\"kind\":12,\"types\":[{\"kind\":2,\"typeName\":\"ModuleDefinition\"},{\"kind\":2,\"typeName\":\"ClassType\"},{\"kind\":18,\"typeName\":\"ModuleInstance\",\"types\":[{\"kind\":20,\"name\":\"definition\",\"type\":{\"kind\":2,\"typeName\":\"ModuleDefinition\"},\"optional\":false}]}],\"typeName\":\"ModuleLike\"}},{\"kind\":4}]},\"optional\":true},{\"$tsfNode\":4},{\"$tsfNode\":5},{\"$tsfNode\":6},{\"$tsfNode\":7},{\"$tsfNode\":8}],\"typeParameters\":[\"C\"]},{\"kind\":2,\"typeName\":\"ClassType\"},{\"kind\":18,\"typeName\":\"ModuleInstance\",\"types\":[{\"kind\":20,\"name\":\"definition\",\"type\":{\"kind\":18,\"typeName\":\"ModuleDefinition\",\"types\":[{\"$tsfNode\":2},{\"$tsfNode\":3},{\"kind\":20,\"name\":\"imports\",\"type\":{\"kind\":12,\"types\":[{\"kind\":14,\"type\":{\"kind\":12,\"types\":[{\"kind\":2,\"typeName\":\"ModuleDefinition\"},{\"kind\":2,\"typeName\":\"ClassType\"},{\"kind\":2,\"typeName\":\"ModuleInstance\"}],\"typeName\":\"ModuleLike\"}},{\"kind\":4}]},\"optional\":true},{\"$tsfNode\":4},{\"$tsfNode\":5},{\"$tsfNode\":6},{\"$tsfNode\":7},{\"$tsfNode\":8}],\"typeParameters\":[\"C\"]},\"optional\":false}]}],\"typeName\":\"ModuleLike\"}},{\"kind\":4}]},\"optional\":true},{\"$tsfNode\":4},{\"$tsfNode\":5},{\"$tsfNode\":6},{\"$tsfNode\":7},{\"$tsfNode\":8},{\"$tsfNode\":2},{\"$tsfNode\":3},{\"kind\":20,\"name\":\"envPassthrough\",\"type\":{\"kind\":12,\"types\":[{\"kind\":14,\"type\":{\"$tsfNode\":9}},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"db\",\"type\":{\"kind\":12,\"types\":[{\"kind\":2,\"typeName\":\"ClassType\"},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"frameworkConfig\",\"type\":{\"$tsfNode\":10},\"optional\":true},{\"kind\":20,\"name\":\"serverConfig\",\"type\":{\"$tsfNode\":10},\"optional\":true},{\"kind\":20,\"name\":\"cors\",\"type\":{\"kind\":12,\"types\":[{\"kind\":2,\"typeName\":\"HttpCorsConfig\",\"typeArguments\":[{\"kind\":2,\"typeName\":\"C\"}]},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"staticFiles\",\"type\":{\"kind\":12,\"types\":[{\"kind\":12,\"types\":[{\"kind\":8},{\"kind\":18,\"typeName\":\"StaticFilesOptions\",\"types\":[{\"kind\":20,\"name\":\"directory\",\"type\":{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"index\",\"type\":{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"spaFallback\",\"type\":{\"kind\":12,\"types\":[{\"kind\":12,\"types\":[{\"kind\":6},{\"kind\":10,\"literal\":false}]},{\"kind\":4}]},\"optional\":true}]}]},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"requestLogging\",\"type\":{\"kind\":12,\"types\":[{\"kind\":18,\"typeName\":\"HttpRequestLoggingOptions\",\"types\":[{\"kind\":20,\"name\":\"excludePaths\",\"type\":{\"kind\":12,\"types\":[{\"kind\":14,\"type\":{\"kind\":12,\"types\":[{\"kind\":6},{\"$tsfNode\":9}]}},{\"kind\":4}]},\"optional\":true}]},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"httpResolvers\",\"type\":{\"kind\":12,\"types\":[{\"kind\":18,\"typeName\":\"Record\",\"utilityType\":\"Record\",\"typeArguments\":[{\"kind\":6},{\"kind\":2,\"typeName\":\"RouteParameterResolverInput\"}],\"index\":{\"kind\":2,\"typeName\":\"RouteParameterResolverInput\"},\"types\":[],\"typeName\":\"RouteParameterResolverRegistry\"},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"fallbackController\",\"type\":{\"kind\":12,\"types\":[{\"kind\":2,\"typeName\":\"ClassType\",\"typeArguments\":[{\"kind\":18,\"typeName\":\"HttpFallbackController\",\"types\":[]}]},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"enableHealthcheck\",\"type\":{\"kind\":12,\"types\":[{\"kind\":8},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"enableWorker\",\"type\":{\"kind\":12,\"types\":[{\"kind\":8},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"enableDkRpc\",\"type\":{\"kind\":12,\"types\":[{\"kind\":8},{\"kind\":4}]},\"optional\":true}]},\"optional\":false,\"default\":false}]},[{\"kind\":16,\"typeName\":\"Container\",\"classType\":{\"$tsfImport\":[1,\"../di/index\",\"Container\"]}},{\"kind\":16,\"typeName\":\"HttpResponse\",\"classType\":{\"$tsfImport\":[1,\"../http/index\",\"HttpResponse\"]}},{\"kind\":20,\"name\":\"config\",\"type\":{\"$tsfNode\":11},\"optional\":true},{\"kind\":20,\"name\":\"defaultConfig\",\"type\":{\"$tsfNode\":12},\"optional\":true},{\"kind\":20,\"name\":\"exports\",\"type\":{\"$tsfNode\":13},\"optional\":true},{\"kind\":20,\"name\":\"providers\",\"type\":{\"$tsfNode\":14},\"optional\":true},{\"kind\":20,\"name\":\"controllers\",\"type\":{\"$tsfNode\":15},\"optional\":true},{\"kind\":20,\"name\":\"listeners\",\"type\":{\"$tsfNode\":15},\"optional\":true},{\"kind\":20,\"name\":\"commands\",\"type\":{\"$tsfNode\":15},\"optional\":true},{\"kind\":16,\"typeName\":\"RegExp\",\"classType\":{\"$tsf\":3}},{\"kind\":12,\"types\":{\"$tsfNode\":16}},{\"kind\":12,\"types\":{\"$tsfNode\":17}},{\"kind\":12,\"types\":{\"$tsfNode\":18}},{\"kind\":12,\"types\":{\"$tsfNode\":19}},{\"kind\":12,\"types\":{\"$tsfNode\":20}},{\"kind\":12,\"types\":{\"$tsfNode\":21}},[{\"$tsfNode\":22},{\"kind\":4}],[{\"$tsfNode\":23},{\"kind\":4}],[{\"$tsfNode\":24},{\"kind\":4}],[{\"kind\":14,\"type\":{\"kind\":2,\"typeName\":\"Token\"}},{\"kind\":4}],[{\"kind\":14,\"type\":{\"kind\":2,\"typeName\":\"Provider\"}},{\"kind\":4}],[{\"kind\":14,\"type\":{\"kind\":2,\"typeName\":\"ClassType\"}},{\"kind\":4}],{\"kind\":18,\"typeName\":\"Record\",\"utilityType\":\"Record\",\"typeArguments\":[{\"kind\":6},{\"kind\":2}],\"index\":{\"kind\":2},\"types\":[]},{\"kind\":2,\"typeName\":\"ClassType\",\"typeArguments\":[{\"kind\":2,\"typeName\":\"C\"}]},{\"kind\":18,\"typeName\":\"Partial\",\"utilityType\":\"Partial\",\"typeArguments\":[{\"kind\":2,\"typeName\":\"C\"}],\"utilityKeys\":[],\"types\":[]}]]", [() => App, require, () => (typeof TEvent !== "undefined" ? TEvent : (typeof exports !== "undefined" ? exports.TEvent : undefined)), () => (typeof RegExp !== "undefined" ? RegExp : (typeof exports !== "undefined" ? exports.RegExp : undefined))], __tsf_metadata_type);
545
545
  }
546
546
  exports.App = App;
547
547
  _AppMetadata_1.classType = App;
@@ -3,20 +3,27 @@ import type { DatabaseDriver, DriverConnection } from '../driver';
3
3
  export interface PgPoolLike {
4
4
  connect(): Promise<PgClientLike>;
5
5
  end(): Promise<void>;
6
+ on?(event: 'error', listener: (error: Error) => void): unknown;
7
+ on?(event: 'connect', listener: (client: PgClientLike) => void): unknown;
6
8
  }
7
9
  export interface PgClientLike {
8
10
  query<T = Record<string, unknown>>(text: string, values?: unknown[]): Promise<{
9
11
  rows: T[];
10
12
  rowCount: number | null;
11
13
  }>;
12
- release(): void;
14
+ release(error?: Error | boolean): void;
15
+ on?(event: 'error', listener: (error: Error) => void): unknown;
13
16
  }
14
17
  export declare class PostgresDriver implements DatabaseDriver {
15
18
  readonly dialect: 'postgres';
16
19
  private pool;
20
+ private logger;
21
+ private clientErrors;
17
22
  constructor(configOrPool: PoolConfig | PgPoolLike);
18
23
  connect(): Promise<void>;
19
24
  close(): Promise<void>;
20
25
  acquire(): Promise<DriverConnection>;
26
+ private watchClient;
27
+ private logConnectionError;
21
28
  }
22
29
  //# sourceMappingURL=postgres.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../../../src/database/drivers/postgres.ts"],"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AO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC;IAC/D,EAAE,CAAC,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,GAAG,OAAO,CAAC;CAC5E;AAED,MAAM,WAAW,YAAY;IACzB,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,CAAC,EAAE,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IACtH,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,IAAI,CAAC;IACvC,EAAE,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,OAAO,CAAC;CAClE;AAED,qBAAa,cAAe,YAAW,cAAc;IACjD,QAAQ,CAAC,OAAO,EAAG,UAAU,CAAU;IACvC,OAAO,CAAC,IAAI,CAAa;IACzB,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,YAAY,CAAkD;IAEtE,YAAY,YAAY,EAAE,UAAU,GAAG,UAAU,EAOhD;IAEK,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAG7B;IAEK,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAE3B;IAEK,OAAO,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAGzC;IAED,OAAO,CAAC,WAAW;IAenB,OAAO,CAAC,kBAAkB;CAI7B"}
@@ -4,13 +4,21 @@ exports.__tsfTypeAliases = exports.PostgresDriver = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const _a = tslib_1.__importStar(require("@zyno-io/ts-reflection/type-metadata-runtime"));
6
6
  const pg_1 = require("pg");
7
+ const logger_1 = require("../../services/logger");
7
8
  const __tsf_metadata_type = _a.createCompactMetadataRegistryV2("[2,[{\"kind\":10,\"literal\":\"postgres\"},{\"kind\":22,\"type\":{\"kind\":3}},{\"kind\":22,\"type\":{\"kind\":18,\"typeName\":\"DriverConnection\",\"types\":[]}},{\"kind\":18,\"typeName\":\"RenderedSql\",\"types\":[{\"kind\":20,\"name\":\"sql\",\"type\":{\"kind\":6},\"optional\":false},{\"kind\":20,\"name\":\"bindings\",\"type\":{\"kind\":14,\"type\":{\"kind\":2}},\"optional\":false}]},{\"kind\":22,\"type\":{\"kind\":18,\"typeName\":\"QueryResult\",\"types\":[{\"kind\":20,\"name\":\"rows\",\"type\":{\"kind\":14,\"type\":{\"kind\":2,\"typeName\":\"T\"}},\"optional\":false},{\"kind\":20,\"name\":\"executeResult\",\"type\":{\"kind\":12,\"types\":[{\"$tsfNode\":0},{\"kind\":4}]},\"optional\":true}]}},{\"kind\":22,\"type\":{\"$tsfNode\":0}},{\"kind\":6},{\"kind\":18,\"typeName\":\"PgClientLike\",\"types\":[]}],[{\"kind\":18,\"typeName\":\"ExecuteResult\",\"types\":{\"$tsfNode\":1}},[{\"$tsfNode\":2},{\"$tsfNode\":3},{\"$tsfNode\":4},{\"$tsfNode\":5}],{\"kind\":20,\"name\":\"affectedRows\",\"type\":{\"kind\":7},\"optional\":false},{\"kind\":20,\"name\":\"insertId\",\"type\":{\"$tsfNode\":6},\"optional\":true},{\"kind\":20,\"name\":\"warningStatus\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":20,\"name\":\"rowCount\",\"type\":{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":4}]},\"optional\":true},{\"kind\":12,\"types\":[{\"kind\":12,\"types\":[{\"kind\":7},{\"kind\":6}]},{\"kind\":4}]}]]", []);
8
9
  let _PostgresDriverMetadata_1;
9
10
  class PostgresDriver {
10
11
  dialect = 'postgres';
11
12
  pool;
13
+ logger = (0, logger_1.createLogger)('PostgresDriver');
14
+ clientErrors = new WeakMap();
12
15
  constructor(configOrPool) {
13
- this.pool = isPgPoolLike(configOrPool) ? configOrPool : new pg_1.Pool(configOrPool);
16
+ this.pool = isPgPoolLike(configOrPool)
17
+ ? configOrPool
18
+ : new pg_1.Pool({ ...configOrPool, connectionTimeoutMillis: configOrPool.connectionTimeoutMillis ?? 5000 });
19
+ // pg-pool removes failed idle clients before forwarding their errors.
20
+ this.pool.on?.('error', error => this.logConnectionError('pool', error));
21
+ this.pool.on?.('connect', client => this.watchClient(client));
14
22
  }
15
23
  async connect() {
16
24
  const connection = await this.acquire();
@@ -20,7 +28,26 @@ class PostgresDriver {
20
28
  await this.pool.end();
21
29
  }
22
30
  async acquire() {
23
- return new PostgresConnection(await this.pool.connect());
31
+ const client = await this.pool.connect();
32
+ return new PostgresConnection(client, this.watchClient(client));
33
+ }
34
+ watchClient(client) {
35
+ let state = this.clientErrors.get(client);
36
+ if (!state) {
37
+ state = {};
38
+ this.clientErrors.set(client, state);
39
+ const clientState = state;
40
+ // Keep this listener while idle and between transaction queries.
41
+ client.on?.('error', error => {
42
+ clientState.error = error;
43
+ this.logConnectionError('client', error);
44
+ });
45
+ }
46
+ return state;
47
+ }
48
+ logConnectionError(source, error) {
49
+ // Pool errors can contain a client with credentials and query bindings.
50
+ this.logger.error('PostgreSQL connection error', { source, message: error.message });
24
51
  }
25
52
  static __tsfType = _PostgresDriverMetadata_1 = _a.decodeCompactMetadataV2("[2,{\"kind\":16,\"name\":\"PostgresDriver\",\"typeName\":\"PostgresDriver\",\"classType\":{\"$tsf\":0},\"properties\":[{\"name\":\"dialect\",\"type\":{\"$tsfType\":0},\"optional\":false}],\"methods\":[{\"name\":\"connect\",\"parameters\":[],\"returnType\":{\"$tsfType\":1}},{\"name\":\"close\",\"parameters\":[],\"returnType\":{\"$tsfType\":1}},{\"name\":\"acquire\",\"parameters\":[],\"returnType\":{\"$tsfType\":2}}],\"hasConstructor\":true,\"constructorParameters\":[{\"name\":\"configOrPool\",\"type\":{\"kind\":12,\"types\":[{\"$tsfAlias\":[1,\"pg\",\"PoolConfig\",\"PoolConfig\"]},{\"kind\":18,\"typeName\":\"PgPoolLike\",\"types\":[]}]},\"optional\":false,\"default\":false}]},[]]", [() => PostgresDriver, require], __tsf_metadata_type);
26
53
  }
@@ -30,8 +57,10 @@ PostgresDriver.__tsfType = _PostgresDriverMetadata_1;
30
57
  let _PostgresConnectionMetadata_1;
31
58
  class PostgresConnection {
32
59
  client;
33
- constructor(client) {
60
+ state;
61
+ constructor(client, state) {
34
62
  this.client = client;
63
+ this.state = state;
35
64
  }
36
65
  async query(query) {
37
66
  const result = await this.client.query(query.sql, query.bindings);
@@ -60,9 +89,9 @@ class PostgresConnection {
60
89
  await this.client.query(`ROLLBACK TO SAVEPOINT ${quoteSavepoint(name)}`);
61
90
  }
62
91
  async release() {
63
- this.client.release();
92
+ this.client.release(this.state.error);
64
93
  }
65
- static __tsfType = _PostgresConnectionMetadata_1 = _a.decodeCompactMetadataV2("[2,{\"kind\":16,\"name\":\"PostgresConnection\",\"typeName\":\"PostgresConnection\",\"classType\":{\"$tsf\":0},\"properties\":[],\"methods\":[{\"name\":\"query\",\"parameters\":{\"$tsfNode\":0},\"returnType\":{\"$tsfType\":4}},{\"name\":\"execute\",\"parameters\":{\"$tsfNode\":0},\"returnType\":{\"$tsfType\":5}},{\"name\":\"begin\",\"parameters\":[],\"returnType\":{\"$tsfType\":1}},{\"name\":\"commit\",\"parameters\":[],\"returnType\":{\"$tsfType\":1}},{\"name\":\"rollback\",\"parameters\":[],\"returnType\":{\"$tsfType\":1}},{\"name\":\"savepoint\",\"parameters\":{\"$tsfNode\":1},\"returnType\":{\"$tsfType\":1}},{\"name\":\"rollbackToSavepoint\",\"parameters\":{\"$tsfNode\":1},\"returnType\":{\"$tsfType\":1}},{\"name\":\"release\",\"parameters\":[],\"returnType\":{\"$tsfType\":1}}],\"hasConstructor\":true,\"constructorParameters\":[{\"name\":\"client\",\"type\":{\"$tsfType\":7},\"optional\":false,\"default\":false}]},[[{\"$tsfNode\":2}],[{\"$tsfNode\":3}],{\"name\":\"query\",\"type\":{\"$tsfType\":3},\"optional\":false,\"default\":false},{\"name\":\"name\",\"type\":{\"$tsfType\":6},\"optional\":false,\"default\":false}]]", [() => PostgresConnection], __tsf_metadata_type);
94
+ static __tsfType = _PostgresConnectionMetadata_1 = _a.decodeCompactMetadataV2("[2,{\"kind\":16,\"name\":\"PostgresConnection\",\"typeName\":\"PostgresConnection\",\"classType\":{\"$tsf\":0},\"properties\":[],\"methods\":[{\"name\":\"query\",\"parameters\":{\"$tsfNode\":0},\"returnType\":{\"$tsfType\":4}},{\"name\":\"execute\",\"parameters\":{\"$tsfNode\":0},\"returnType\":{\"$tsfType\":5}},{\"name\":\"begin\",\"parameters\":[],\"returnType\":{\"$tsfType\":1}},{\"name\":\"commit\",\"parameters\":[],\"returnType\":{\"$tsfType\":1}},{\"name\":\"rollback\",\"parameters\":[],\"returnType\":{\"$tsfType\":1}},{\"name\":\"savepoint\",\"parameters\":{\"$tsfNode\":1},\"returnType\":{\"$tsfType\":1}},{\"name\":\"rollbackToSavepoint\",\"parameters\":{\"$tsfNode\":1},\"returnType\":{\"$tsfType\":1}},{\"name\":\"release\",\"parameters\":[],\"returnType\":{\"$tsfType\":1}}],\"hasConstructor\":true,\"constructorParameters\":[{\"name\":\"client\",\"type\":{\"$tsfType\":7},\"optional\":false,\"default\":false},{\"name\":\"state\",\"type\":{\"kind\":18,\"types\":[{\"kind\":20,\"name\":\"error\",\"type\":{\"kind\":12,\"types\":[{\"kind\":16,\"typeName\":\"Error\",\"classType\":{\"$tsf\":1}},{\"kind\":4}]},\"optional\":true}]},\"optional\":false,\"default\":false}]},[[{\"$tsfNode\":2}],[{\"$tsfNode\":3}],{\"name\":\"query\",\"type\":{\"$tsfType\":3},\"optional\":false,\"default\":false},{\"name\":\"name\",\"type\":{\"$tsfType\":6},\"optional\":false,\"default\":false}]]", [() => PostgresConnection, () => (typeof Error !== "undefined" ? Error : (typeof exports !== "undefined" ? exports.Error : undefined))], __tsf_metadata_type);
66
95
  }
67
96
  _PostgresConnectionMetadata_1.classType = PostgresConnection;
68
97
  PostgresConnection.__tsfType = _PostgresConnectionMetadata_1;
@@ -1 +1 @@
1
- {"version":3,"file":"postgres.js","sourceRoot":"","sources":["../../../../src/database/drivers/postgres.ts"],"names":[],"mappings":";;;;;AAAA,2BAAkD;;;AAelD;IACa,OAAO,GAAG,UAAmB,CAAC;IAC/B,IAAI,CAAa;IAEzB,YAAY,YAAqC;QAC7C,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,SAAI,CAAC,YAAY,CAAC,CAAC;IACnF,CAAC;IAED,KAAK,CAAC,OAAO;QACT,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QACxC,MAAM,UAAU,CAAC,OAAO,EAAE,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,KAAK;QACP,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,OAAO;QACT,OAAO,IAAI,kBAAkB,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC;;CACJ;;;;;AAED,MAAM,kBAAkB;IACA,MAAM;IAA1B,YAAoB,MAAoB;sBAApB,MAAM;IAAiB,CAAC;IAE5C,KAAK,CAAC,KAAK,CAA8B,KAAkB;QACvD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAI,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QACrE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,KAAkB;QAC5B,MAAM,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eAAe,CAAC;AAOjE,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,MAAa,GAAG,MAAM,GAAG,IAAI,CAG/E;AAYD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKlF;AA+BD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACtG,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,eAAe,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,UAAU,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC"}
1
+ {"version":3,"file":"phone.d.ts","sourceRoot":"","sources":["../../../src/types/phone.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAejE,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,MAAa,GAAG,MAAM,GAAG,IAAI,CAG/E;AAaD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMlF;AA+BD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACtG,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,eAAe,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,UAAU,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC"}
@@ -6,10 +6,16 @@ exports.formatPhoneFriendly = formatPhoneFriendly;
6
6
  const tslib_1 = require("tslib");
7
7
  const _a = tslib_1.__importStar(require("@zyno-io/ts-reflection/type-metadata-runtime"));
8
8
  const reflection_1 = require("../reflection");
9
- const google_libphonenumber_1 = require("google-libphonenumber");
10
9
  const type_annotations_1 = require("./type-annotations");
11
- const phoneFormatter = google_libphonenumber_1.PhoneNumberUtil.getInstance();
12
10
  const InvalidPhoneSymbol = '¡InvalidPhone¡';
11
+ let phoneTools;
12
+ function loadPhoneTools() {
13
+ const { PhoneNumberFormat, PhoneNumberUtil } = require('google-libphonenumber');
14
+ return { phoneFormatter: PhoneNumberUtil.getInstance(), PhoneNumberFormat };
15
+ }
16
+ function getPhoneTools() {
17
+ return (phoneTools ??= loadPhoneTools());
18
+ }
13
19
  function cleanPhone(value, country = 'US') {
14
20
  const cleaned = cleanPhoneInternal(value, country);
15
21
  return cleaned === InvalidPhoneSymbol ? null : cleaned;
@@ -17,23 +23,25 @@ function cleanPhone(value, country = 'US') {
17
23
  function cleanPhoneInternal(value, country = 'US', stripUSPrefix = false) {
18
24
  if (typeof value !== 'string')
19
25
  return InvalidPhoneSymbol;
26
+ const { phoneFormatter, PhoneNumberFormat } = getPhoneTools();
20
27
  const number = tryOrErrorSync(() => phoneFormatter.parseAndKeepRawInput(value, country));
21
28
  if (number instanceof Error)
22
29
  return InvalidPhoneSymbol;
23
30
  if (!phoneFormatter.isValidNumber(number))
24
31
  return InvalidPhoneSymbol;
25
- const result = phoneFormatter.format(number, google_libphonenumber_1.PhoneNumberFormat.E164);
32
+ const result = phoneFormatter.format(number, PhoneNumberFormat.E164);
26
33
  if (!stripUSPrefix)
27
34
  return result;
28
35
  return result.startsWith('+1') ? result.slice(2) : InvalidPhoneSymbol;
29
36
  }
30
37
  function formatPhoneFriendly(value, country) {
38
+ const { phoneFormatter, PhoneNumberFormat } = getPhoneTools();
31
39
  const number = tryOrErrorSync(() => phoneFormatter.parse(value, country));
32
40
  if (number instanceof Error)
33
41
  return null;
34
42
  if (!phoneFormatter.isValidNumber(number))
35
43
  return null;
36
- return phoneFormatter.format(number, google_libphonenumber_1.PhoneNumberFormat.NATIONAL);
44
+ return phoneFormatter.format(number, PhoneNumberFormat.NATIONAL);
37
45
  }
38
46
  function validatePhone(value) {
39
47
  if (value === InvalidPhoneSymbol) {
@@ -1 +1 @@
1
- {"version":3,"file":"phone.js","sourceRoot":"","sources":["../../../src/types/phone.ts"],"names":[],"mappings":";;;;;;;AAAA,8CAAiG;AAEjG,iEAA2E;AAC3E,yDAA4D;AAE5D,MAAM,cAAc,GAAG,uCAAe,CAAC,WAAW,EAAE,CAAC;AACrD,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;AAE5C,oBAA2B,KAAa,EAAE,OAAO,GAAW,IAAI;IAC5D,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACnD,OAAO,OAAO,KAAK,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;AAC3D,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAa,EAAE,OAAO,GAAW,IAAI,EAAE,aAAa,GAAG,KAAK;IACpF,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,kBAAkB,CAAC;IACzD,MAAM,MAAM,GAAG,cAAc,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IACzF,IAAI,MAAM,YAAY,KAAK;QAAE,OAAO,kBAAkB,CAAC;IACvD,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,MAAM,CAAC;QAAE,OAAO,kBAAkB,CAAC;IACrE,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,yCAAiB,CAAC,IAAI,CAAC,CAAC;IACrE,IAAI,CAAC,aAAa;QAAE,OAAO,MAAM,CAAC;IAClC,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC;AAC1E,CAAC;AAED,6BAAoC,KAAa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,CAAC;IACrE,CAAC;AACL,CAAC"}
@@ -546,3 +546,22 @@ const stop = registerDatabaseQueryObserver(entry => {
546
546
  ```
547
547
 
548
548
  Observers receive start/finish events with SQL, bindings, dialect, operation, timing, and errors.
549
+
550
+ ## PostgreSQL connection recovery
551
+
552
+ PostgreSQL pools created by the driver default `connectionTimeoutMillis` to 5000
553
+ (5 seconds). Set this standard pg option in `createPostgresDatabase` or
554
+ `PostgresDriver` configuration to override it; explicit `0` disables the timeout.
555
+ Injected pools retain their own timeout configuration.
556
+
557
+ The driver logs pool and client connection errors through the `PostgresDriver`
558
+ logger, including only the source and error message. Failed idle clients are
559
+ evicted by pg-pool; failed checked-out clients are destroyed when released.
560
+ Always release acquired connections, including after query or transaction errors.
561
+ Later acquisitions open fresh connections. Failed queries and transactions reject
562
+ and are never automatically replayed, because a disconnected write may already
563
+ have committed.
564
+
565
+ Custom `PgPoolLike` and `PgClientLike` implementations remain supported without
566
+ event methods. To support disconnect recovery they should provide the optional
567
+ `on` methods and honor `client.release(error)` by destroying failed clients.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zyno-io/ts-server-foundation",
3
- "version": "26.927.107",
3
+ "version": "26.930.146",
4
4
  "description": "TypeScript server foundation with reflected type metadata",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -92,7 +92,7 @@
92
92
  "@ttsc/graph": "^0.30.1",
93
93
  "@types/ws": "^8.18.1",
94
94
  "@zyno-io/config": "^1.14.0",
95
- "@zyno-io/ts-reflection": "26.927.107",
95
+ "@zyno-io/ts-reflection": "26.930.146",
96
96
  "bcrypt": "^6.0.0",
97
97
  "bullmq": "^6.3.4",
98
98
  "busboy": "^1.6.0",