@graphrefly/graphrefly 0.46.0 → 0.47.1
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/base/composition/index.cjs +69 -15
- package/dist/base/composition/index.cjs.map +1 -1
- package/dist/base/composition/index.d.cts +1 -2
- package/dist/base/composition/index.d.ts +1 -2
- package/dist/base/composition/index.js +1 -1
- package/dist/base/index.cjs +69 -15
- package/dist/base/index.cjs.map +1 -1
- package/dist/base/index.d.cts +1 -2
- package/dist/base/index.d.ts +1 -2
- package/dist/base/index.js +1 -1
- package/dist/{chunk-CGHORL6G.js → chunk-7ADWWI2T.js} +2 -2
- package/dist/{chunk-RGL53X5G.js → chunk-B4AKFXGE.js} +4 -4
- package/dist/{chunk-FW23JYNQ.js → chunk-CEVNQ74M.js} +2 -2
- package/dist/{chunk-JGFRAFDL.js → chunk-FVINAAKA.js} +3 -3
- package/dist/{chunk-WKSWLSCX.js → chunk-J5WFUEO4.js} +2 -2
- package/dist/{chunk-HULCUY35.js → chunk-K7PDZYQE.js} +4 -4
- package/dist/{chunk-Z6EGP5D7.js → chunk-LDCSZ72P.js} +2 -2
- package/dist/{chunk-KIIXR252.js → chunk-MTTRCEJT.js} +2 -2
- package/dist/{chunk-Q3EYOCZB.js → chunk-NPRP3MCV.js} +111 -2
- package/dist/chunk-NPRP3MCV.js.map +1 -0
- package/dist/{chunk-5THCXDWY.js → chunk-RGMTUZCL.js} +3 -3
- package/dist/{chunk-FR6RGA3B.js → chunk-U225SKB4.js} +472 -37
- package/dist/chunk-U225SKB4.js.map +1 -0
- package/dist/{chunk-GBCENOLN.js → chunk-V4Y3TM7U.js} +5 -5
- package/dist/{chunk-LBAJK24K.js → chunk-VLAGJZSL.js} +11 -3
- package/dist/chunk-VLAGJZSL.js.map +1 -0
- package/dist/{chunk-OO5BM6CJ.js → chunk-YXCPV26R.js} +2 -2
- package/dist/chunk-Z65DVDEQ.js +146 -0
- package/dist/chunk-Z65DVDEQ.js.map +1 -0
- package/dist/compat/index.cjs +156 -93
- package/dist/compat/index.cjs.map +1 -1
- package/dist/compat/index.d.cts +3 -3
- package/dist/compat/index.d.ts +3 -3
- package/dist/compat/index.js +2 -2
- package/dist/compat/nestjs/index.cjs +156 -93
- package/dist/compat/nestjs/index.cjs.map +1 -1
- package/dist/compat/nestjs/index.d.cts +4 -4
- package/dist/compat/nestjs/index.d.ts +4 -4
- package/dist/compat/nestjs/index.js +4 -5
- package/dist/{index-5SU_O78r.d.cts → index-B_p8tnvf.d.cts} +19 -3
- package/dist/{index-CEXCtYYJ.d.ts → index-_HDSmPyp.d.ts} +19 -3
- package/dist/index.cjs +1449 -856
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +36 -14
- package/dist/index.js.map +1 -1
- package/dist/observable-B25XqCbZ.d.cts +59 -0
- package/dist/observable-B25XqCbZ.d.ts +59 -0
- package/dist/presets/ai/index.cjs.map +1 -1
- package/dist/presets/ai/index.js +6 -6
- package/dist/presets/harness/index.cjs.map +1 -1
- package/dist/presets/harness/index.js +9 -9
- package/dist/presets/index.cjs.map +1 -1
- package/dist/presets/index.js +13 -13
- package/dist/presets/inspect/index.cjs.map +1 -1
- package/dist/presets/inspect/index.js +4 -4
- package/dist/solutions/index.cjs.map +1 -1
- package/dist/solutions/index.js +10 -10
- package/dist/utils/ai/index.cjs.map +1 -1
- package/dist/utils/ai/index.js +5 -5
- package/dist/utils/index.cjs +939 -400
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +2 -2
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +28 -6
- package/dist/utils/inspect/index.cjs.map +1 -1
- package/dist/utils/inspect/index.js +2 -2
- package/dist/utils/memory/index.cjs +470 -40
- package/dist/utils/memory/index.cjs.map +1 -1
- package/dist/utils/memory/index.d.cts +669 -2
- package/dist/utils/memory/index.d.ts +669 -2
- package/dist/utils/memory/index.js +19 -1
- package/dist/utils/messaging/index.cjs +109 -0
- package/dist/utils/messaging/index.cjs.map +1 -1
- package/dist/utils/messaging/index.d.cts +115 -2
- package/dist/utils/messaging/index.d.ts +115 -2
- package/dist/utils/messaging/index.js +5 -1
- package/dist/utils/orchestration/index.cjs.map +1 -1
- package/dist/utils/orchestration/index.js +2 -2
- package/package.json +1 -5
- package/dist/chunk-3QZY5BI7.js +0 -92
- package/dist/chunk-3QZY5BI7.js.map +0 -1
- package/dist/chunk-FR6RGA3B.js.map +0 -1
- package/dist/chunk-LBAJK24K.js.map +0 -1
- package/dist/chunk-Q3EYOCZB.js.map +0 -1
- package/dist/observable-BXQoW1P-.d.cts +0 -36
- package/dist/observable-BXQoW1P-.d.ts +0 -36
- /package/dist/{chunk-CGHORL6G.js.map → chunk-7ADWWI2T.js.map} +0 -0
- /package/dist/{chunk-RGL53X5G.js.map → chunk-B4AKFXGE.js.map} +0 -0
- /package/dist/{chunk-FW23JYNQ.js.map → chunk-CEVNQ74M.js.map} +0 -0
- /package/dist/{chunk-JGFRAFDL.js.map → chunk-FVINAAKA.js.map} +0 -0
- /package/dist/{chunk-WKSWLSCX.js.map → chunk-J5WFUEO4.js.map} +0 -0
- /package/dist/{chunk-HULCUY35.js.map → chunk-K7PDZYQE.js.map} +0 -0
- /package/dist/{chunk-Z6EGP5D7.js.map → chunk-LDCSZ72P.js.map} +0 -0
- /package/dist/{chunk-KIIXR252.js.map → chunk-MTTRCEJT.js.map} +0 -0
- /package/dist/{chunk-5THCXDWY.js.map → chunk-RGMTUZCL.js.map} +0 -0
- /package/dist/{chunk-GBCENOLN.js.map → chunk-V4Y3TM7U.js.map} +0 -0
- /package/dist/{chunk-OO5BM6CJ.js.map → chunk-YXCPV26R.js.map} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as _graphrefly_pure_ts_extra from '@graphrefly/pure-ts/extra';
|
|
2
|
+
import { ReactiveLogBundle } from '@graphrefly/pure-ts/extra';
|
|
2
3
|
import { BaseAuditRecord } from '../../base/mutation/index.cjs';
|
|
3
4
|
import { Node } from '@graphrefly/pure-ts/core';
|
|
4
5
|
import { Graph, GraphOptions } from '@graphrefly/pure-ts/graph';
|
|
@@ -329,7 +330,7 @@ declare class TopicGraph<T> extends Graph {
|
|
|
329
330
|
attachEventStorage(tiers: readonly _graphrefly_pure_ts_extra.AppendLogStorageTier<T>[]): () => void;
|
|
330
331
|
retained(): readonly T[];
|
|
331
332
|
/** Internal log bundle — used by TopicBridgeGraph for `attach`. */
|
|
332
|
-
get _logBundle():
|
|
333
|
+
get _logBundle(): ReactiveLogBundle<T>;
|
|
333
334
|
}
|
|
334
335
|
type SubscriptionOptions = {
|
|
335
336
|
graph?: GraphOptions;
|
|
@@ -558,5 +559,117 @@ declare function subscription<T>(name: string, topicGraph: TopicGraph<T>, opts?:
|
|
|
558
559
|
* downstream subscription on the bridge's `output` node instead.
|
|
559
560
|
*/
|
|
560
561
|
declare function topicBridge<TIn, TOut = TIn>(name: string, sourceTopic: TopicGraph<TIn>, targetTopic: TopicGraph<TOut>, opts?: TopicBridgeOptions<TIn, TOut>): TopicBridgeGraph<TIn, TOut>;
|
|
562
|
+
type ProjectorPoisonPolicy = "halt" | "deadLetter";
|
|
563
|
+
/** A poison entry routed to {@link LogProjectorGraph.deadLetter}. */
|
|
564
|
+
type DeadLetterEntry<T> = {
|
|
565
|
+
readonly item: T;
|
|
566
|
+
/** `Error.message` (or `String(thrown)`) from the failing `sink`. */
|
|
567
|
+
readonly error: string;
|
|
568
|
+
/** Absolute 0-based log position of the poisoned item. */
|
|
569
|
+
readonly cursorPos: number;
|
|
570
|
+
};
|
|
571
|
+
type LogProjectorOptions<T> = {
|
|
572
|
+
graph?: GraphOptions;
|
|
573
|
+
/**
|
|
574
|
+
* Per-item side-effecting projection.
|
|
575
|
+
*
|
|
576
|
+
* **Transient-vs-poison contract (read this).** The projector cannot tell
|
|
577
|
+
* "this will project later" from "this will never project" — only the sink
|
|
578
|
+
* knows. So the contract is:
|
|
579
|
+
* - **Return normally** (sync return, or a resolved Promise) → the item is
|
|
580
|
+
* *handled*; the cursor advances. Use this for the success path AND for
|
|
581
|
+
* any transient/skip condition the sink wants to no-op (e.g. an optional
|
|
582
|
+
* native feature not yet available — return without throwing; the entry
|
|
583
|
+
* is simply considered done for this projector).
|
|
584
|
+
* - **Throw / reject** → the item is *poison*; the {@link onPoison} policy
|
|
585
|
+
* applies. Do NOT throw for transient conditions or the item is
|
|
586
|
+
* dead-lettered (or halts the stream).
|
|
587
|
+
*/
|
|
588
|
+
readonly sink: (item: T) => void | Promise<void>;
|
|
589
|
+
/**
|
|
590
|
+
* Behaviour when `sink` throws/rejects on an item (poison):
|
|
591
|
+
* - `"halt"` (default) — stop projecting at the poison item; the cursor
|
|
592
|
+
* does NOT advance past it (head-of-line stop). `position` stalls — that
|
|
593
|
+
* is the observable signal. No retry/backoff is built in.
|
|
594
|
+
* - `"deadLetter"` — publish `{ item, error, cursorPos }` to the
|
|
595
|
+
* {@link LogProjectorGraph.deadLetter} topic and advance past it, so
|
|
596
|
+
* newer entries still project.
|
|
597
|
+
*/
|
|
598
|
+
readonly onPoison?: ProjectorPoisonPolicy;
|
|
599
|
+
/**
|
|
600
|
+
* Initial cursor position. `"retained"` (default) projects all history;
|
|
601
|
+
* `"now"` skips existing entries (project only future appends); a number
|
|
602
|
+
* starts at that absolute index.
|
|
603
|
+
*/
|
|
604
|
+
readonly from?: "retained" | "now" | number;
|
|
605
|
+
/** Retained window for the `deadLetter` topic. Default 1024. */
|
|
606
|
+
readonly deadLetterRetainedLimit?: number;
|
|
607
|
+
};
|
|
608
|
+
/**
|
|
609
|
+
* Cursor-driven projector over a {@link TopicGraph} or {@link ReactiveLogBundle}.
|
|
610
|
+
*
|
|
611
|
+
* Topology (mounted on the returned graph):
|
|
612
|
+
* - `subscription` (TopicGraph source only) — the hardened
|
|
613
|
+
* {@link SubscriptionGraph} cursor; or a local `cursor` state + the
|
|
614
|
+
* bundle's `fromCursor` view (ReactiveLogBundle source).
|
|
615
|
+
* - `drain` — an `effect` that, on every not-yet-projected wave, schedules a
|
|
616
|
+
* serialized async pass that calls `sink` per item (mirrors the
|
|
617
|
+
* `SubscriptionGraph.ackPump` / `TopicBridge.ackPump` effect precedent +
|
|
618
|
+
* memo:Re's `inFlight` chain — one wave processed at a time).
|
|
619
|
+
* - `deadLetter` — a real {@link TopicGraph} (NOT a callback): poison entries
|
|
620
|
+
* are observable in `describe()` and subscribable, instead of memo:Re's
|
|
621
|
+
* silent `break`.
|
|
622
|
+
*
|
|
623
|
+
* **No imperative reads.** Observe `position` (cursor) / subscribe to
|
|
624
|
+
* `deadLetter`. `idle()` is a test-only await convenience.
|
|
625
|
+
*
|
|
626
|
+
* @category patterns
|
|
627
|
+
*/
|
|
628
|
+
declare class LogProjectorGraph<T> extends Graph {
|
|
629
|
+
/** Reactive count of fully-projected entries (the cursor; read-only). */
|
|
630
|
+
readonly position: Node<number>;
|
|
631
|
+
/**
|
|
632
|
+
* Poison entries (populated when `onPoison: "deadLetter"`). A real topic —
|
|
633
|
+
* subscribable + visible in `describe()`.
|
|
634
|
+
*/
|
|
635
|
+
readonly deadLetter: TopicGraph<DeadLetterEntry<T>>;
|
|
636
|
+
private _inFlight;
|
|
637
|
+
constructor(name: string, source: TopicGraph<T> | ReactiveLogBundle<T>, opts: LogProjectorOptions<T>);
|
|
638
|
+
/**
|
|
639
|
+
* Await any in-flight drain pass. **Test convenience only** — the canonical
|
|
640
|
+
* reactive observable is {@link LogProjectorGraph.position}.
|
|
641
|
+
*/
|
|
642
|
+
idle(): Promise<void>;
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Creates a cursor-driven log/topic projector with a typed poison-failure
|
|
646
|
+
* policy and an observable dead-letter topic.
|
|
647
|
+
*
|
|
648
|
+
* @example
|
|
649
|
+
* ```ts
|
|
650
|
+
* import { logProjector, topic } from "@graphrefly/graphrefly";
|
|
651
|
+
*
|
|
652
|
+
* const events = topic<Doc>("docs");
|
|
653
|
+
* const proj = logProjector("indexer", events, {
|
|
654
|
+
* sink: async (doc) => { await index(doc); }, // throw ⇒ poison
|
|
655
|
+
* onPoison: "deadLetter",
|
|
656
|
+
* });
|
|
657
|
+
* proj.deadLetter.events.subscribe(/* observe poison */);
|
|
658
|
+
* ```
|
|
659
|
+
*
|
|
660
|
+
* @remarks
|
|
661
|
+
* **Use an UNBOUNDED source for durable / long-lived projection.** The cursor
|
|
662
|
+
* is an absolute index; the underlying `fromCursor` view slices the source's
|
|
663
|
+
* *current* entries array. A `TopicGraph` with a `retainedLimit` (or a
|
|
664
|
+
* `ReactiveLogBundle` with `maxSize`) trims its head, so an absolute cursor
|
|
665
|
+
* past the retained window reads the wrong offset (skips entries or stalls).
|
|
666
|
+
* This is inherited `subscription()` / `fromCursor` behaviour, not specific to
|
|
667
|
+
* `logProjector` — but it matters here because projection is typically
|
|
668
|
+
* long-lived. For unbounded projection pass a source with NO `retainedLimit` /
|
|
669
|
+
* `maxSize` (memo:Re's `changesetLog` is unbounded ✓).
|
|
670
|
+
*
|
|
671
|
+
* @category patterns
|
|
672
|
+
*/
|
|
673
|
+
declare function logProjector<T>(name: string, source: TopicGraph<T> | ReactiveLogBundle<T>, opts: LogProjectorOptions<T>): LogProjectorGraph<T>;
|
|
561
674
|
|
|
562
|
-
export { CONTEXT_TOPIC, DEFERRED_TOPIC, type HubRemoveTopicRecord, INJECTIONS_TOPIC, type JsonSchema, type MessagingAuditRecord, MessagingHubGraph, type MessagingHubOptions, PROMPTS_TOPIC, type PullAndAckResult, RESPONSES_TOPIC, SPAWNS_TOPIC, STANDARD_TOPICS, type StandardTopic, type SubscriptionAckRecord, SubscriptionGraph, type SubscriptionOptions, type SubscriptionPullAndAckRecord, TODOS_TOPIC, TopicBridgeGraph, type TopicBridgeOptions, TopicGraph, type TopicMessage, type TopicOptions, type TopicPublishRecord, TopicRegistry, hubRemoveTopicKeyOf, messagingHub, subscription, subscriptionAckKeyOf, subscriptionPullAndAckKeyOf, topic, topicBridge, topicPublishKeyOf };
|
|
675
|
+
export { CONTEXT_TOPIC, DEFERRED_TOPIC, type DeadLetterEntry, type HubRemoveTopicRecord, INJECTIONS_TOPIC, type JsonSchema, LogProjectorGraph, type LogProjectorOptions, type MessagingAuditRecord, MessagingHubGraph, type MessagingHubOptions, PROMPTS_TOPIC, type ProjectorPoisonPolicy, type PullAndAckResult, RESPONSES_TOPIC, SPAWNS_TOPIC, STANDARD_TOPICS, type StandardTopic, type SubscriptionAckRecord, SubscriptionGraph, type SubscriptionOptions, type SubscriptionPullAndAckRecord, TODOS_TOPIC, TopicBridgeGraph, type TopicBridgeOptions, TopicGraph, type TopicMessage, type TopicOptions, type TopicPublishRecord, TopicRegistry, hubRemoveTopicKeyOf, logProjector, messagingHub, subscription, subscriptionAckKeyOf, subscriptionPullAndAckKeyOf, topic, topicBridge, topicPublishKeyOf };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as _graphrefly_pure_ts_extra from '@graphrefly/pure-ts/extra';
|
|
2
|
+
import { ReactiveLogBundle } from '@graphrefly/pure-ts/extra';
|
|
2
3
|
import { BaseAuditRecord } from '../../base/mutation/index.js';
|
|
3
4
|
import { Node } from '@graphrefly/pure-ts/core';
|
|
4
5
|
import { Graph, GraphOptions } from '@graphrefly/pure-ts/graph';
|
|
@@ -329,7 +330,7 @@ declare class TopicGraph<T> extends Graph {
|
|
|
329
330
|
attachEventStorage(tiers: readonly _graphrefly_pure_ts_extra.AppendLogStorageTier<T>[]): () => void;
|
|
330
331
|
retained(): readonly T[];
|
|
331
332
|
/** Internal log bundle — used by TopicBridgeGraph for `attach`. */
|
|
332
|
-
get _logBundle():
|
|
333
|
+
get _logBundle(): ReactiveLogBundle<T>;
|
|
333
334
|
}
|
|
334
335
|
type SubscriptionOptions = {
|
|
335
336
|
graph?: GraphOptions;
|
|
@@ -558,5 +559,117 @@ declare function subscription<T>(name: string, topicGraph: TopicGraph<T>, opts?:
|
|
|
558
559
|
* downstream subscription on the bridge's `output` node instead.
|
|
559
560
|
*/
|
|
560
561
|
declare function topicBridge<TIn, TOut = TIn>(name: string, sourceTopic: TopicGraph<TIn>, targetTopic: TopicGraph<TOut>, opts?: TopicBridgeOptions<TIn, TOut>): TopicBridgeGraph<TIn, TOut>;
|
|
562
|
+
type ProjectorPoisonPolicy = "halt" | "deadLetter";
|
|
563
|
+
/** A poison entry routed to {@link LogProjectorGraph.deadLetter}. */
|
|
564
|
+
type DeadLetterEntry<T> = {
|
|
565
|
+
readonly item: T;
|
|
566
|
+
/** `Error.message` (or `String(thrown)`) from the failing `sink`. */
|
|
567
|
+
readonly error: string;
|
|
568
|
+
/** Absolute 0-based log position of the poisoned item. */
|
|
569
|
+
readonly cursorPos: number;
|
|
570
|
+
};
|
|
571
|
+
type LogProjectorOptions<T> = {
|
|
572
|
+
graph?: GraphOptions;
|
|
573
|
+
/**
|
|
574
|
+
* Per-item side-effecting projection.
|
|
575
|
+
*
|
|
576
|
+
* **Transient-vs-poison contract (read this).** The projector cannot tell
|
|
577
|
+
* "this will project later" from "this will never project" — only the sink
|
|
578
|
+
* knows. So the contract is:
|
|
579
|
+
* - **Return normally** (sync return, or a resolved Promise) → the item is
|
|
580
|
+
* *handled*; the cursor advances. Use this for the success path AND for
|
|
581
|
+
* any transient/skip condition the sink wants to no-op (e.g. an optional
|
|
582
|
+
* native feature not yet available — return without throwing; the entry
|
|
583
|
+
* is simply considered done for this projector).
|
|
584
|
+
* - **Throw / reject** → the item is *poison*; the {@link onPoison} policy
|
|
585
|
+
* applies. Do NOT throw for transient conditions or the item is
|
|
586
|
+
* dead-lettered (or halts the stream).
|
|
587
|
+
*/
|
|
588
|
+
readonly sink: (item: T) => void | Promise<void>;
|
|
589
|
+
/**
|
|
590
|
+
* Behaviour when `sink` throws/rejects on an item (poison):
|
|
591
|
+
* - `"halt"` (default) — stop projecting at the poison item; the cursor
|
|
592
|
+
* does NOT advance past it (head-of-line stop). `position` stalls — that
|
|
593
|
+
* is the observable signal. No retry/backoff is built in.
|
|
594
|
+
* - `"deadLetter"` — publish `{ item, error, cursorPos }` to the
|
|
595
|
+
* {@link LogProjectorGraph.deadLetter} topic and advance past it, so
|
|
596
|
+
* newer entries still project.
|
|
597
|
+
*/
|
|
598
|
+
readonly onPoison?: ProjectorPoisonPolicy;
|
|
599
|
+
/**
|
|
600
|
+
* Initial cursor position. `"retained"` (default) projects all history;
|
|
601
|
+
* `"now"` skips existing entries (project only future appends); a number
|
|
602
|
+
* starts at that absolute index.
|
|
603
|
+
*/
|
|
604
|
+
readonly from?: "retained" | "now" | number;
|
|
605
|
+
/** Retained window for the `deadLetter` topic. Default 1024. */
|
|
606
|
+
readonly deadLetterRetainedLimit?: number;
|
|
607
|
+
};
|
|
608
|
+
/**
|
|
609
|
+
* Cursor-driven projector over a {@link TopicGraph} or {@link ReactiveLogBundle}.
|
|
610
|
+
*
|
|
611
|
+
* Topology (mounted on the returned graph):
|
|
612
|
+
* - `subscription` (TopicGraph source only) — the hardened
|
|
613
|
+
* {@link SubscriptionGraph} cursor; or a local `cursor` state + the
|
|
614
|
+
* bundle's `fromCursor` view (ReactiveLogBundle source).
|
|
615
|
+
* - `drain` — an `effect` that, on every not-yet-projected wave, schedules a
|
|
616
|
+
* serialized async pass that calls `sink` per item (mirrors the
|
|
617
|
+
* `SubscriptionGraph.ackPump` / `TopicBridge.ackPump` effect precedent +
|
|
618
|
+
* memo:Re's `inFlight` chain — one wave processed at a time).
|
|
619
|
+
* - `deadLetter` — a real {@link TopicGraph} (NOT a callback): poison entries
|
|
620
|
+
* are observable in `describe()` and subscribable, instead of memo:Re's
|
|
621
|
+
* silent `break`.
|
|
622
|
+
*
|
|
623
|
+
* **No imperative reads.** Observe `position` (cursor) / subscribe to
|
|
624
|
+
* `deadLetter`. `idle()` is a test-only await convenience.
|
|
625
|
+
*
|
|
626
|
+
* @category patterns
|
|
627
|
+
*/
|
|
628
|
+
declare class LogProjectorGraph<T> extends Graph {
|
|
629
|
+
/** Reactive count of fully-projected entries (the cursor; read-only). */
|
|
630
|
+
readonly position: Node<number>;
|
|
631
|
+
/**
|
|
632
|
+
* Poison entries (populated when `onPoison: "deadLetter"`). A real topic —
|
|
633
|
+
* subscribable + visible in `describe()`.
|
|
634
|
+
*/
|
|
635
|
+
readonly deadLetter: TopicGraph<DeadLetterEntry<T>>;
|
|
636
|
+
private _inFlight;
|
|
637
|
+
constructor(name: string, source: TopicGraph<T> | ReactiveLogBundle<T>, opts: LogProjectorOptions<T>);
|
|
638
|
+
/**
|
|
639
|
+
* Await any in-flight drain pass. **Test convenience only** — the canonical
|
|
640
|
+
* reactive observable is {@link LogProjectorGraph.position}.
|
|
641
|
+
*/
|
|
642
|
+
idle(): Promise<void>;
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Creates a cursor-driven log/topic projector with a typed poison-failure
|
|
646
|
+
* policy and an observable dead-letter topic.
|
|
647
|
+
*
|
|
648
|
+
* @example
|
|
649
|
+
* ```ts
|
|
650
|
+
* import { logProjector, topic } from "@graphrefly/graphrefly";
|
|
651
|
+
*
|
|
652
|
+
* const events = topic<Doc>("docs");
|
|
653
|
+
* const proj = logProjector("indexer", events, {
|
|
654
|
+
* sink: async (doc) => { await index(doc); }, // throw ⇒ poison
|
|
655
|
+
* onPoison: "deadLetter",
|
|
656
|
+
* });
|
|
657
|
+
* proj.deadLetter.events.subscribe(/* observe poison */);
|
|
658
|
+
* ```
|
|
659
|
+
*
|
|
660
|
+
* @remarks
|
|
661
|
+
* **Use an UNBOUNDED source for durable / long-lived projection.** The cursor
|
|
662
|
+
* is an absolute index; the underlying `fromCursor` view slices the source's
|
|
663
|
+
* *current* entries array. A `TopicGraph` with a `retainedLimit` (or a
|
|
664
|
+
* `ReactiveLogBundle` with `maxSize`) trims its head, so an absolute cursor
|
|
665
|
+
* past the retained window reads the wrong offset (skips entries or stalls).
|
|
666
|
+
* This is inherited `subscription()` / `fromCursor` behaviour, not specific to
|
|
667
|
+
* `logProjector` — but it matters here because projection is typically
|
|
668
|
+
* long-lived. For unbounded projection pass a source with NO `retainedLimit` /
|
|
669
|
+
* `maxSize` (memo:Re's `changesetLog` is unbounded ✓).
|
|
670
|
+
*
|
|
671
|
+
* @category patterns
|
|
672
|
+
*/
|
|
673
|
+
declare function logProjector<T>(name: string, source: TopicGraph<T> | ReactiveLogBundle<T>, opts: LogProjectorOptions<T>): LogProjectorGraph<T>;
|
|
561
674
|
|
|
562
|
-
export { CONTEXT_TOPIC, DEFERRED_TOPIC, type HubRemoveTopicRecord, INJECTIONS_TOPIC, type JsonSchema, type MessagingAuditRecord, MessagingHubGraph, type MessagingHubOptions, PROMPTS_TOPIC, type PullAndAckResult, RESPONSES_TOPIC, SPAWNS_TOPIC, STANDARD_TOPICS, type StandardTopic, type SubscriptionAckRecord, SubscriptionGraph, type SubscriptionOptions, type SubscriptionPullAndAckRecord, TODOS_TOPIC, TopicBridgeGraph, type TopicBridgeOptions, TopicGraph, type TopicMessage, type TopicOptions, type TopicPublishRecord, TopicRegistry, hubRemoveTopicKeyOf, messagingHub, subscription, subscriptionAckKeyOf, subscriptionPullAndAckKeyOf, topic, topicBridge, topicPublishKeyOf };
|
|
675
|
+
export { CONTEXT_TOPIC, DEFERRED_TOPIC, type DeadLetterEntry, type HubRemoveTopicRecord, INJECTIONS_TOPIC, type JsonSchema, LogProjectorGraph, type LogProjectorOptions, type MessagingAuditRecord, MessagingHubGraph, type MessagingHubOptions, PROMPTS_TOPIC, type ProjectorPoisonPolicy, type PullAndAckResult, RESPONSES_TOPIC, SPAWNS_TOPIC, STANDARD_TOPICS, type StandardTopic, type SubscriptionAckRecord, SubscriptionGraph, type SubscriptionOptions, type SubscriptionPullAndAckRecord, TODOS_TOPIC, TopicBridgeGraph, type TopicBridgeOptions, TopicGraph, type TopicMessage, type TopicOptions, type TopicPublishRecord, TopicRegistry, hubRemoveTopicKeyOf, logProjector, messagingHub, subscription, subscriptionAckKeyOf, subscriptionPullAndAckKeyOf, topic, topicBridge, topicPublishKeyOf };
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
CONTEXT_TOPIC,
|
|
3
3
|
DEFERRED_TOPIC,
|
|
4
4
|
INJECTIONS_TOPIC,
|
|
5
|
+
LogProjectorGraph,
|
|
5
6
|
MessagingHubGraph,
|
|
6
7
|
PROMPTS_TOPIC,
|
|
7
8
|
RESPONSES_TOPIC,
|
|
@@ -13,6 +14,7 @@ import {
|
|
|
13
14
|
TopicGraph,
|
|
14
15
|
TopicRegistry,
|
|
15
16
|
hubRemoveTopicKeyOf,
|
|
17
|
+
logProjector,
|
|
16
18
|
messagingHub,
|
|
17
19
|
subscription,
|
|
18
20
|
subscriptionAckKeyOf,
|
|
@@ -20,7 +22,7 @@ import {
|
|
|
20
22
|
topic,
|
|
21
23
|
topicBridge,
|
|
22
24
|
topicPublishKeyOf
|
|
23
|
-
} from "../../chunk-
|
|
25
|
+
} from "../../chunk-NPRP3MCV.js";
|
|
24
26
|
import "../../chunk-FMPF42Q4.js";
|
|
25
27
|
import "../../chunk-BXGZFGZ4.js";
|
|
26
28
|
import "../../chunk-AZDQPQ3V.js";
|
|
@@ -28,6 +30,7 @@ export {
|
|
|
28
30
|
CONTEXT_TOPIC,
|
|
29
31
|
DEFERRED_TOPIC,
|
|
30
32
|
INJECTIONS_TOPIC,
|
|
33
|
+
LogProjectorGraph,
|
|
31
34
|
MessagingHubGraph,
|
|
32
35
|
PROMPTS_TOPIC,
|
|
33
36
|
RESPONSES_TOPIC,
|
|
@@ -39,6 +42,7 @@ export {
|
|
|
39
42
|
TopicGraph,
|
|
40
43
|
TopicRegistry,
|
|
41
44
|
hubRemoveTopicKeyOf,
|
|
45
|
+
logProjector,
|
|
42
46
|
messagingHub,
|
|
43
47
|
subscription,
|
|
44
48
|
subscriptionAckKeyOf,
|