@@ -2,26 +2,34 @@ import type { Object as APObject } from "@fedify/vocab";
22
33/**
44 * Backfill traversal strategy used to discover the returned object.
5+ *
6+ * @since 2.3.0
57 */
68export type BackfillStrategy = "context-posts" ;
79
810/**
911 * Source relation that produced a backfilled object.
12+ *
13+ * @since 2.3.0
1014 */
1115export type BackfillOrigin = "context" | "collection" ;
1216
1317/**
1418 * Options passed to {@link BackfillDocumentLoader}.
19+ *
20+ * @since 2.3.0
1521 */
1622export interface BackfillDocumentLoaderOptions {
1723 /**
1824 * Cancellation signal for the current dereference operation.
1925 */
20- signal ?: AbortSignal ;
26+ readonly signal ?: AbortSignal ;
2127}
2228
2329/**
2430 * Dereferences an ActivityPub object or collection IRI.
31+ *
32+ * @since 2.3.0
2533 */
2634export type BackfillDocumentLoader = (
2735 iri : URL ,
@@ -30,83 +38,89 @@ export type BackfillDocumentLoader = (
3038
3139/**
3240 * Dependencies used by backfill traversal.
41+ *
42+ * @since 2.3.0
3343 */
3444export interface BackfillContext {
3545 /**
3646 * Dereferences context collections and collection item IRIs.
3747 */
38- documentLoader : BackfillDocumentLoader ;
48+ readonly documentLoader : BackfillDocumentLoader ;
3949}
4050
4151/**
4252 * Controls direct context collection backfill traversal.
53+ *
54+ * @since 2.3.0
4355 */
4456export interface BackfillOptions <
4557 TObject extends APObject = APObject ,
4658> {
4759 /**
4860 * Maximum number of items to yield. Skipped duplicates do not count.
4961 */
50- maxItems ?: number ;
62+ readonly maxItems ?: number ;
5163
5264 /**
5365 * Maximum traversal depth. This is reserved for future reply-tree traversal;
5466 */
55- maxDepth ?: number ;
67+ readonly maxDepth ?: number ;
5668
5769 /**
5870 * Maximum number of calls to {@link BackfillContext.documentLoader}.
5971 *
6072 * Dereferencing the note context, collection item IRIs, and future page IRIs
6173 * all count as requests. Embedded collection items do not count.
6274 */
63- maxRequests ?: number ;
75+ readonly maxRequests ?: number ;
6476
6577 /**
6678 * Delay between `documentLoader` requests.
6779 *
6880 * When a callback is provided, `iteration` is the zero-based request index.
6981 */
70- interval ?:
82+ readonly interval ?:
7183 | Temporal . DurationLike
7284 | string
7385 | ( ( iteration : number ) => Temporal . DurationLike | string ) ;
7486
7587 /**
7688 * Cancels traversal before requests and before yields.
7789 */
78- signal ?: AbortSignal ;
90+ readonly signal ?: AbortSignal ;
7991}
8092
8193/**
8294 * A single object discovered by backfill traversal.
95+ *
96+ * @since 2.3.0
8397 */
8498export interface BackfillItem <
8599 TObject extends APObject = APObject ,
86100> {
87101 /**
88102 * The discovered ActivityPub object.
89103 */
90- object : TObject ;
104+ readonly object : TObject ;
91105
92106 /**
93107 * The object's ActivityPub ID, when present.
94108 */
95- id ?: URL ;
109+ readonly id ?: URL ;
96110
97111 /**
98112 * The traversal strategy that produced this item.
99113 */
100- strategy : BackfillStrategy ;
114+ readonly strategy : BackfillStrategy ;
101115
102116 /**
103117 * The source relation that produced this item.
104118 */
105- origin : BackfillOrigin ;
119+ readonly origin : BackfillOrigin ;
106120
107121 /**
108122 * Traversal depth. Direct context collection items are depth 0; deeper
109123 * values are reserved for future reply-tree traversal.
110124 */
111- depth ?: number ;
125+ readonly depth ?: number ;
112126}
0 commit comments