@secondlayer/sdk 12.0.0 → 12.2.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/dist/index.d.ts +53 -1
- package/dist/index.js +76 -3
- package/dist/index.js.map +7 -6
- package/dist/streams/index.d.ts +11 -0
- package/dist/streams/index.js +7 -3
- package/dist/streams/index.js.map +5 -5
- package/dist/subgraphs/index.d.ts +11 -0
- package/dist/subgraphs/index.js +7 -3
- package/dist/subgraphs/index.js.map +4 -4
- package/dist/webhooks/doctor.d.ts +42 -0
- package/dist/webhooks/doctor.js +74 -0
- package/dist/webhooks/doctor.js.map +10 -0
- package/package.json +7 -3
package/dist/streams/index.d.ts
CHANGED
|
@@ -597,6 +597,17 @@ type StreamsEventsConsumeParams<
|
|
|
597
597
|
maxPages?: number;
|
|
598
598
|
maxEmptyPolls?: number;
|
|
599
599
|
signal?: AbortSignal;
|
|
600
|
+
/**
|
|
601
|
+
* Cuts the empty-poll backoff short: on an empty page, the loop races
|
|
602
|
+
* `emptyBackoffMs` against this promise instead of sleeping the full
|
|
603
|
+
* amount. Pass a function that resolves once when new data MIGHT be
|
|
604
|
+
* available (e.g. a Postgres NOTIFY listener) — it is called fresh on
|
|
605
|
+
* every empty page, never awaited more than once concurrently per page.
|
|
606
|
+
* The backoff timer still runs underneath, so a wake source that never
|
|
607
|
+
* resolves (or a `wake` this call omits) degrades to the same polling
|
|
608
|
+
* behavior as before.
|
|
609
|
+
*/
|
|
610
|
+
wake?: () => Promise<void>;
|
|
600
611
|
};
|
|
601
612
|
/**
|
|
602
613
|
* One yielded page from {@link StreamsClient.consume} — the
|
package/dist/streams/index.js
CHANGED
|
@@ -713,7 +713,10 @@ async function consumeStreamsEvents(opts) {
|
|
|
713
713
|
if (mode === "bounded") {
|
|
714
714
|
return { cursor, pages, emptyPolls };
|
|
715
715
|
}
|
|
716
|
-
await
|
|
716
|
+
await (opts.wake ? Promise.race([
|
|
717
|
+
sleep(emptyBackoffMs, opts.signal),
|
|
718
|
+
opts.wake().catch(() => new Promise(() => {}))
|
|
719
|
+
]) : sleep(emptyBackoffMs, opts.signal));
|
|
717
720
|
continue;
|
|
718
721
|
}
|
|
719
722
|
return { cursor, pages, emptyPolls };
|
|
@@ -1378,7 +1381,8 @@ function createStreamsClient(options) {
|
|
|
1378
1381
|
signal: params.signal,
|
|
1379
1382
|
retryCount: params.retryCount,
|
|
1380
1383
|
retryDelay: params.retryDelay,
|
|
1381
|
-
onError: params.onError
|
|
1384
|
+
onError: params.onError,
|
|
1385
|
+
wake: params.wake
|
|
1382
1386
|
});
|
|
1383
1387
|
}
|
|
1384
1388
|
return {
|
|
@@ -1530,5 +1534,5 @@ export {
|
|
|
1530
1534
|
isStxTransfer
|
|
1531
1535
|
};
|
|
1532
1536
|
|
|
1533
|
-
//# debugId=
|
|
1537
|
+
//# debugId=6154E3BEB02079D064756E2164756E21
|
|
1534
1538
|
//# sourceMappingURL=index.js.map
|