@haathie/pgmb 0.2.6 → 0.2.7

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/lib/batcher.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import type { IEventData, PGMBEventBatcherOpts } from './types.ts';
2
- export declare class PGMBEventBatcher<T extends IEventData> {
3
- #private;
4
- constructor({ shouldLog, publish, flushIntervalMs, maxBatchSize, logger }: PGMBEventBatcherOpts<T>);
5
- end(): Promise<void>;
6
- /**
7
- * Enqueue a message to be published, will be flushed to the database
8
- * when flush() is called (either manually or via interval)
9
- */
10
- enqueue(msg: T): void;
11
- flush(): Promise<void>;
12
- }
package/lib/client.d.ts DELETED
@@ -1,76 +0,0 @@
1
- import { type Logger } from 'pino';
2
- import { PGMBEventBatcher } from './batcher.ts';
3
- import type { PgClientLike } from './query-types.ts';
4
- import type { GetWebhookInfoFn, IEphemeralListener, IEventData, IEventHandler, IFindEventsFn, IReadEvent, IReadNextEventsFn, ISplitFn, Pgmb2ClientOpts, registerReliableHandlerParams, RegisterSubscriptionParams } from './types.ts';
5
- type IReliableListener<T extends IEventData> = {
6
- type: 'reliable';
7
- handler: IEventHandler<T>;
8
- removeOnEmpty?: boolean;
9
- extra?: unknown;
10
- splitBy?: ISplitFn<T>;
11
- queue: {
12
- item: IReadEvent<T>;
13
- checkpoint: Checkpoint;
14
- }[];
15
- };
16
- type IFireAndForgetListener<T extends IEventData> = {
17
- type: 'fire-and-forget';
18
- stream: IEphemeralListener<T>;
19
- };
20
- type IListener<T extends IEventData> = IFireAndForgetListener<T> | IReliableListener<T>;
21
- type Checkpoint = {
22
- activeTasks: number;
23
- nextCursor: string;
24
- cancelled?: boolean;
25
- };
26
- export type IListenerStore<T extends IEventData> = {
27
- values: {
28
- [id: string]: IListener<T>;
29
- };
30
- };
31
- export declare class PgmbClient<T extends IEventData = IEventData> extends PGMBEventBatcher<T> {
32
- #private;
33
- readonly client: PgClientLike;
34
- readonly logger: Logger;
35
- readonly groupId: string;
36
- readonly sleepDurationMs: number;
37
- readonly readChunkSize: number;
38
- readonly subscriptionMaintenanceMs: number;
39
- readonly tableMaintenanceMs: number;
40
- readonly maxActiveCheckpoints: number;
41
- readonly readNextEvents: IReadNextEventsFn;
42
- readonly findEvents?: IFindEventsFn;
43
- readonly getWebhookInfo: GetWebhookInfoFn;
44
- readonly webhookHandler: IEventHandler<T>;
45
- readonly listeners: {
46
- [subId: string]: IListenerStore<T>;
47
- };
48
- constructor({ client, groupId, logger, sleepDurationMs, readChunkSize, maxActiveCheckpoints, poll, subscriptionMaintenanceMs, webhookHandlerOpts: { splitBy: whSplitBy, ...whHandlerOpts }, getWebhookInfo, tableMaintainanceMs, readNextEvents, findEvents, ...batcherOpts }: Pgmb2ClientOpts<T>);
49
- init(): Promise<void>;
50
- end(): Promise<void>;
51
- publish(events: T[], client?: PgClientLike): Promise<import("./queries.ts").IWriteEventsResult[]>;
52
- assertSubscription(opts: RegisterSubscriptionParams, client?: PgClientLike): Promise<import("./queries.ts").IAssertSubscriptionResult>;
53
- /**
54
- * Registers a fire-and-forget handler, returning an async iterator
55
- * that yields events as they arrive. The client does not wait for event
56
- * processing acknowledgements. Useful for cases where data is eventually
57
- * consistent, or when event delivery isn't critical
58
- * (eg. http SSE, websockets).
59
- */
60
- registerFireAndForgetHandler(opts: RegisterSubscriptionParams): Promise<IEphemeralListener<T>>;
61
- /**
62
- * Registers a reliable handler for the given subscription params.
63
- * If the handler throws an error, client will rollback to the last known
64
- * good cursor, and re-deliver events.
65
- * To avoid a full redelivery of a batch, a retry strategy can be provided
66
- * to retry failed events by the handler itself, allowing for delayed retries
67
- * with backoff, and without disrupting the overall event flow.
68
- */
69
- registerReliableHandler({ retryOpts, name, splitBy, ...opts }: registerReliableHandlerParams<T>, handler: IEventHandler<T>): Promise<{
70
- subscriptionId: string;
71
- cancel: () => void;
72
- }>;
73
- removeSubscription(subId: string): Promise<void>;
74
- readChanges(): Promise<number>;
75
- }
76
- export {};
package/lib/consts.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare const RETRY_EVENT = "pgmb-retry";
package/lib/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export * from './client.ts';
2
- export type * from './types.ts';
3
- export type * from './query-types.ts';
4
- export * from './utils.ts';
5
- export * from './sse.ts';
6
- export * from './queries.ts';
package/lib/queries.d.ts DELETED
@@ -1,453 +0,0 @@
1
- /** Types generated for queries found in "sql/queries.sql" */
2
- import { PreparedQuery } from '@pgtyped/runtime';
3
- export type DateOrString = Date | string;
4
- export type DateOrStringArray = (DateOrString)[];
5
- export type stringArray = (string)[];
6
- export type unknownArray = (unknown)[];
7
- /** 'AssertGroup' parameters type */
8
- export interface IAssertGroupParams {
9
- id: string;
10
- }
11
- /** 'AssertGroup' return type */
12
- export type IAssertGroupResult = void;
13
- /** 'AssertGroup' query type */
14
- export interface IAssertGroupQuery {
15
- params: IAssertGroupParams;
16
- result: IAssertGroupResult;
17
- }
18
- /**
19
- * Query generated from SQL:
20
- * ```
21
- * INSERT INTO pgmb.subscription_groups (id)
22
- * VALUES (:id!)
23
- * ON CONFLICT DO NOTHING
24
- * ```
25
- */
26
- export declare const assertGroup: PreparedQuery<IAssertGroupParams, void>;
27
- /** 'AssertSubscription' parameters type */
28
- export interface IAssertSubscriptionParams {
29
- conditionsSql?: string | null | void;
30
- expiryInterval?: DateOrString | null | void;
31
- groupId: string;
32
- params?: unknown | null | void;
33
- }
34
- /** 'AssertSubscription' return type */
35
- export interface IAssertSubscriptionResult {
36
- id: string;
37
- }
38
- /** 'AssertSubscription' query type */
39
- export interface IAssertSubscriptionQuery {
40
- params: IAssertSubscriptionParams;
41
- result: IAssertSubscriptionResult;
42
- }
43
- /**
44
- * Query generated from SQL:
45
- * ```
46
- * INSERT INTO pgmb.subscriptions
47
- * AS s(group_id, conditions_sql, params, expiry_interval)
48
- * VALUES (
49
- * :groupId!,
50
- * COALESCE(:conditionsSql, 'TRUE'),
51
- * COALESCE(:params::jsonb, '{}'),
52
- * :expiryInterval::interval
53
- * )
54
- * ON CONFLICT (identity) DO UPDATE
55
- * SET
56
- * -- set expiry_interval to the new value only if it's greater than the existing one
57
- * -- or if the new value is NULL (indicating no expiration)
58
- * expiry_interval = CASE
59
- * WHEN EXCLUDED.expiry_interval IS NULL OR s.expiry_interval IS NULL
60
- * THEN NULL
61
- * ELSE
62
- * GREATEST(s.expiry_interval, EXCLUDED.expiry_interval)
63
- * END,
64
- * last_active_at = NOW()
65
- * RETURNING id AS "id!"
66
- * ```
67
- */
68
- export declare const assertSubscription: PreparedQuery<IAssertSubscriptionParams, IAssertSubscriptionResult>;
69
- /** 'DeleteSubscriptions' parameters type */
70
- export interface IDeleteSubscriptionsParams {
71
- ids: readonly (string)[];
72
- }
73
- /** 'DeleteSubscriptions' return type */
74
- export type IDeleteSubscriptionsResult = void;
75
- /** 'DeleteSubscriptions' query type */
76
- export interface IDeleteSubscriptionsQuery {
77
- params: IDeleteSubscriptionsParams;
78
- result: IDeleteSubscriptionsResult;
79
- }
80
- /**
81
- * Query generated from SQL:
82
- * ```
83
- * DELETE FROM pgmb.subscriptions
84
- * WHERE id IN :ids!
85
- * ```
86
- */
87
- export declare const deleteSubscriptions: PreparedQuery<IDeleteSubscriptionsParams, void>;
88
- /** 'MarkSubscriptionsActive' parameters type */
89
- export interface IMarkSubscriptionsActiveParams {
90
- ids: stringArray;
91
- }
92
- /** 'MarkSubscriptionsActive' return type */
93
- export type IMarkSubscriptionsActiveResult = void;
94
- /** 'MarkSubscriptionsActive' query type */
95
- export interface IMarkSubscriptionsActiveQuery {
96
- params: IMarkSubscriptionsActiveParams;
97
- result: IMarkSubscriptionsActiveResult;
98
- }
99
- /**
100
- * Query generated from SQL:
101
- * ```
102
- * UPDATE pgmb.subscriptions
103
- * SET
104
- * last_active_at = NOW()
105
- * WHERE id IN (SELECT * FROM unnest(:ids!::pgmb.subscription_id[]))
106
- * ```
107
- */
108
- export declare const markSubscriptionsActive: PreparedQuery<IMarkSubscriptionsActiveParams, void>;
109
- /** 'PollForEvents' parameters type */
110
- export type IPollForEventsParams = void;
111
- /** 'PollForEvents' return type */
112
- export interface IPollForEventsResult {
113
- count: number;
114
- }
115
- /** 'PollForEvents' query type */
116
- export interface IPollForEventsQuery {
117
- params: IPollForEventsParams;
118
- result: IPollForEventsResult;
119
- }
120
- /**
121
- * Query generated from SQL:
122
- * ```
123
- * SELECT count AS "count!" FROM pgmb.poll_for_events() AS count
124
- * ```
125
- */
126
- export declare const pollForEvents: PreparedQuery<void, IPollForEventsResult>;
127
- /** 'ReadNextEvents' parameters type */
128
- export interface IReadNextEventsParams {
129
- chunkSize: number;
130
- cursor?: string | null | void;
131
- groupId: string;
132
- }
133
- /** 'ReadNextEvents' return type */
134
- export interface IReadNextEventsResult {
135
- id: string;
136
- metadata: unknown;
137
- nextCursor: string;
138
- payload: unknown;
139
- subscriptionIds: stringArray;
140
- topic: string;
141
- }
142
- /** 'ReadNextEvents' query type */
143
- export interface IReadNextEventsQuery {
144
- params: IReadNextEventsParams;
145
- result: IReadNextEventsResult;
146
- }
147
- /**
148
- * Query generated from SQL:
149
- * ```
150
- * SELECT
151
- * id AS "id!",
152
- * topic AS "topic!",
153
- * payload AS "payload!",
154
- * metadata AS "metadata!",
155
- * subscription_ids::text[] AS "subscriptionIds!",
156
- * next_cursor AS "nextCursor!"
157
- * FROM pgmb.read_next_events(:groupId!, :cursor, :chunkSize!)
158
- * ```
159
- */
160
- export declare const readNextEvents: PreparedQuery<IReadNextEventsParams, IReadNextEventsResult>;
161
- /** 'ReadNextEventsText' parameters type */
162
- export interface IReadNextEventsTextParams {
163
- chunkSize: number;
164
- cursor?: string | null | void;
165
- groupId: string;
166
- }
167
- /** 'ReadNextEventsText' return type */
168
- export interface IReadNextEventsTextResult {
169
- id: string;
170
- payload: string;
171
- topic: string;
172
- }
173
- /** 'ReadNextEventsText' query type */
174
- export interface IReadNextEventsTextQuery {
175
- params: IReadNextEventsTextParams;
176
- result: IReadNextEventsTextResult;
177
- }
178
- /**
179
- * Query generated from SQL:
180
- * ```
181
- * SELECT
182
- * id AS "id!",
183
- * topic AS "topic!",
184
- * payload::text AS "payload!"
185
- * FROM pgmb.read_next_events(:groupId!, :cursor, :chunkSize!)
186
- * ```
187
- */
188
- export declare const readNextEventsText: PreparedQuery<IReadNextEventsTextParams, IReadNextEventsTextResult>;
189
- /** 'ReplayEvents' parameters type */
190
- export interface IReplayEventsParams {
191
- fromEventId: string;
192
- groupId: string;
193
- maxEvents: number;
194
- subscriptionId: string;
195
- }
196
- /** 'ReplayEvents' return type */
197
- export interface IReplayEventsResult {
198
- id: string;
199
- metadata: unknown;
200
- payload: unknown;
201
- topic: string;
202
- }
203
- /** 'ReplayEvents' query type */
204
- export interface IReplayEventsQuery {
205
- params: IReplayEventsParams;
206
- result: IReplayEventsResult;
207
- }
208
- /**
209
- * Query generated from SQL:
210
- * ```
211
- * SELECT
212
- * id AS "id!",
213
- * topic AS "topic!",
214
- * payload AS "payload!",
215
- * metadata AS "metadata!"
216
- * FROM pgmb.replay_events(
217
- * :groupId!,
218
- * :subscriptionId!,
219
- * :fromEventId!::pgmb.event_id,
220
- * :maxEvents!
221
- * )
222
- * ```
223
- */
224
- export declare const replayEvents: PreparedQuery<IReplayEventsParams, IReplayEventsResult>;
225
- /** 'SetGroupCursor' parameters type */
226
- export interface ISetGroupCursorParams {
227
- cursor: string;
228
- groupId: string;
229
- releaseLock?: boolean | null | void;
230
- }
231
- /** 'SetGroupCursor' return type */
232
- export interface ISetGroupCursorResult {
233
- success: undefined;
234
- }
235
- /** 'SetGroupCursor' query type */
236
- export interface ISetGroupCursorQuery {
237
- params: ISetGroupCursorParams;
238
- result: ISetGroupCursorResult;
239
- }
240
- /**
241
- * Query generated from SQL:
242
- * ```
243
- * SELECT pgmb.set_group_cursor(
244
- * :groupId!,
245
- * :cursor!::pgmb.event_id,
246
- * :releaseLock::boolean
247
- * ) AS "success!"
248
- * ```
249
- */
250
- export declare const setGroupCursor: PreparedQuery<ISetGroupCursorParams, ISetGroupCursorResult>;
251
- /** 'ReleaseGroupLock' parameters type */
252
- export interface IReleaseGroupLockParams {
253
- groupId: string;
254
- }
255
- /** 'ReleaseGroupLock' return type */
256
- export interface IReleaseGroupLockResult {
257
- success: undefined;
258
- }
259
- /** 'ReleaseGroupLock' query type */
260
- export interface IReleaseGroupLockQuery {
261
- params: IReleaseGroupLockParams;
262
- result: IReleaseGroupLockResult;
263
- }
264
- /**
265
- * Query generated from SQL:
266
- * ```
267
- * SELECT pgmb.release_group_lock(:groupId!) AS "success!"
268
- * ```
269
- */
270
- export declare const releaseGroupLock: PreparedQuery<IReleaseGroupLockParams, IReleaseGroupLockResult>;
271
- /** 'WriteEvents' parameters type */
272
- export interface IWriteEventsParams {
273
- metadatas: unknownArray;
274
- payloads: unknownArray;
275
- topics: stringArray;
276
- }
277
- /** 'WriteEvents' return type */
278
- export interface IWriteEventsResult {
279
- id: string;
280
- }
281
- /** 'WriteEvents' query type */
282
- export interface IWriteEventsQuery {
283
- params: IWriteEventsParams;
284
- result: IWriteEventsResult;
285
- }
286
- /**
287
- * Query generated from SQL:
288
- * ```
289
- * INSERT INTO pgmb.events (topic, payload, metadata)
290
- * SELECT
291
- * topic,
292
- * payload,
293
- * metadata
294
- * FROM unnest(
295
- * :topics!::TEXT[],
296
- * :payloads!::JSONB[],
297
- * :metadatas!::JSONB[]
298
- * ) AS t(topic, payload, metadata)
299
- * RETURNING id AS "id!"
300
- * ```
301
- */
302
- export declare const writeEvents: PreparedQuery<IWriteEventsParams, IWriteEventsResult>;
303
- /** 'WriteScheduledEvents' parameters type */
304
- export interface IWriteScheduledEventsParams {
305
- metadatas: unknownArray;
306
- payloads: unknownArray;
307
- topics: stringArray;
308
- ts: DateOrStringArray;
309
- }
310
- /** 'WriteScheduledEvents' return type */
311
- export interface IWriteScheduledEventsResult {
312
- id: string;
313
- }
314
- /** 'WriteScheduledEvents' query type */
315
- export interface IWriteScheduledEventsQuery {
316
- params: IWriteScheduledEventsParams;
317
- result: IWriteScheduledEventsResult;
318
- }
319
- /**
320
- * Query generated from SQL:
321
- * ```
322
- * INSERT INTO pgmb.events (id, topic, payload, metadata)
323
- * SELECT
324
- * pgmb.create_event_id(COALESCE(ts, clock_timestamp()), pgmb.create_random_bigint()),
325
- * topic,
326
- * payload,
327
- * metadata
328
- * FROM unnest(
329
- * :ts!::TIMESTAMPTZ[],
330
- * :topics!::TEXT[],
331
- * :payloads!::JSONB[],
332
- * :metadatas!::JSONB[]
333
- * ) AS t(ts, topic, payload, metadata)
334
- * RETURNING id AS "id!"
335
- * ```
336
- */
337
- export declare const writeScheduledEvents: PreparedQuery<IWriteScheduledEventsParams, IWriteScheduledEventsResult>;
338
- /** 'ScheduleEventRetry' parameters type */
339
- export interface IScheduleEventRetryParams {
340
- delayInterval: DateOrString;
341
- handlerName: string;
342
- ids: stringArray;
343
- retryNumber: number;
344
- subscriptionId: string;
345
- }
346
- /** 'ScheduleEventRetry' return type */
347
- export interface IScheduleEventRetryResult {
348
- id: string;
349
- }
350
- /** 'ScheduleEventRetry' query type */
351
- export interface IScheduleEventRetryQuery {
352
- params: IScheduleEventRetryParams;
353
- result: IScheduleEventRetryResult;
354
- }
355
- /**
356
- * Query generated from SQL:
357
- * ```
358
- * INSERT INTO pgmb.events (id, topic, payload, subscription_id)
359
- * SELECT
360
- * pgmb.create_event_id(
361
- * NOW() + (:delayInterval!::INTERVAL),
362
- * pgmb.create_random_bigint()
363
- * ),
364
- * 'pgmb-retry',
365
- * jsonb_build_object(
366
- * 'ids',
367
- * :ids!::pgmb.event_id[],
368
- * 'retryNumber',
369
- * :retryNumber!::int,
370
- * 'handlerName',
371
- * :handlerName!::text
372
- * ),
373
- * :subscriptionId!::pgmb.subscription_id
374
- * RETURNING id AS "id!"
375
- * ```
376
- */
377
- export declare const scheduleEventRetry: PreparedQuery<IScheduleEventRetryParams, IScheduleEventRetryResult>;
378
- /** 'FindEvents' parameters type */
379
- export interface IFindEventsParams {
380
- ids: stringArray;
381
- }
382
- /** 'FindEvents' return type */
383
- export interface IFindEventsResult {
384
- id: string;
385
- metadata: unknown;
386
- payload: unknown;
387
- topic: string;
388
- }
389
- /** 'FindEvents' query type */
390
- export interface IFindEventsQuery {
391
- params: IFindEventsParams;
392
- result: IFindEventsResult;
393
- }
394
- /**
395
- * Query generated from SQL:
396
- * ```
397
- * SELECT
398
- * id AS "id!",
399
- * topic AS "topic!",
400
- * payload AS "payload!",
401
- * metadata AS "metadata!"
402
- * FROM pgmb.events
403
- * WHERE id = ANY(:ids!::pgmb.event_id[])
404
- * ```
405
- */
406
- export declare const findEvents: PreparedQuery<IFindEventsParams, IFindEventsResult>;
407
- /** 'RemoveExpiredSubscriptions' parameters type */
408
- export interface IRemoveExpiredSubscriptionsParams {
409
- activeIds: stringArray;
410
- groupId: string;
411
- }
412
- /** 'RemoveExpiredSubscriptions' return type */
413
- export interface IRemoveExpiredSubscriptionsResult {
414
- deleted: string;
415
- }
416
- /** 'RemoveExpiredSubscriptions' query type */
417
- export interface IRemoveExpiredSubscriptionsQuery {
418
- params: IRemoveExpiredSubscriptionsParams;
419
- result: IRemoveExpiredSubscriptionsResult;
420
- }
421
- /**
422
- * Query generated from SQL:
423
- * ```
424
- * WITH deleted AS (
425
- * DELETE FROM pgmb.subscriptions
426
- * WHERE group_id = :groupId!
427
- * AND expiry_interval IS NOT NULL
428
- * AND pgmb.add_interval_imm(last_active_at, expiry_interval) < NOW()
429
- * AND id NOT IN (select * from unnest(:activeIds!::pgmb.subscription_id[]))
430
- * RETURNING id
431
- * )
432
- * SELECT COUNT(*) AS "deleted!" FROM deleted
433
- * ```
434
- */
435
- export declare const removeExpiredSubscriptions: PreparedQuery<IRemoveExpiredSubscriptionsParams, IRemoveExpiredSubscriptionsResult>;
436
- /** 'MaintainEventsTable' parameters type */
437
- export type IMaintainEventsTableParams = void;
438
- /** 'MaintainEventsTable' return type */
439
- export interface IMaintainEventsTableResult {
440
- maintainEventsTable: undefined | null;
441
- }
442
- /** 'MaintainEventsTable' query type */
443
- export interface IMaintainEventsTableQuery {
444
- params: IMaintainEventsTableParams;
445
- result: IMaintainEventsTableResult;
446
- }
447
- /**
448
- * Query generated from SQL:
449
- * ```
450
- * SELECT pgmb.maintain_events_table()
451
- * ```
452
- */
453
- export declare const maintainEventsTable: PreparedQuery<void, IMaintainEventsTableResult>;
@@ -1,17 +0,0 @@
1
- export type QueryResult<T> = {
2
- rowCount: number;
3
- rows: T[];
4
- };
5
- export interface PgClient {
6
- query<T = any>(query: string, params?: unknown[]): Promise<QueryResult<T>>;
7
- exec?(query: string): Promise<unknown>;
8
- }
9
- export interface PgReleasableClient extends PgClient {
10
- release: () => void;
11
- }
12
- export interface PgPoolLike extends PgClient {
13
- connect: () => Promise<PgReleasableClient>;
14
- on(ev: 'remove', handler: (cl: PgReleasableClient) => void): this;
15
- off(ev: 'remove', handler: (cl: PgReleasableClient) => void): this;
16
- }
17
- export type PgClientLike = PgClient | PgPoolLike;
@@ -1,11 +0,0 @@
1
- import type { IReadNextEventsResult } from './queries.ts';
2
- import type { PgClientLike } from './query-types.ts';
3
- import type { IEventData, IEventHandler, IFindEventsFn, IReadEvent, IRetryHandlerOpts } from './types.ts';
4
- export declare function createRetryHandler<T extends IEventData>({ retriesS }: IRetryHandlerOpts, handler: IEventHandler<T>): IEventHandler<T>;
5
- export declare function normaliseRetryEventsInReadEventMap<T extends IEventData>(rows: IReadNextEventsResult[], client: PgClientLike, findEvents?: IFindEventsFn): Promise<{
6
- map: {
7
- [sid: string]: IReadEvent<T>[];
8
- };
9
- retryEvents: number;
10
- retryItemCount: number;
11
- }>;
package/lib/sse.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import type { IncomingMessage, ServerResponse } from 'node:http';
2
- import type { PgmbClient } from './client.ts';
3
- import type { IEventData, SSERequestHandlerOpts } from './types.ts';
4
- export declare function createSSERequestHandler<T extends IEventData>(this: PgmbClient<T>, { getSubscriptionOpts, maxReplayEvents, maxReplayIntervalMs, jsonifier }: SSERequestHandlerOpts): (req: IncomingMessage, res: ServerResponse<IncomingMessage>) => Promise<void>;