@mepuka/skygent 0.3.0 → 0.3.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/package.json +1 -1
- package/src/cli/compact-output.ts +52 -0
- package/src/cli/config.ts +30 -5
- package/src/cli/feed.ts +52 -15
- package/src/cli/filter-errors.ts +5 -9
- package/src/cli/filter.ts +5 -7
- package/src/cli/graph.ts +128 -37
- package/src/cli/interval.ts +4 -33
- package/src/cli/jetstream.ts +2 -0
- package/src/cli/option-schemas.ts +22 -0
- package/src/cli/output-format.ts +11 -0
- package/src/cli/pagination.ts +10 -11
- package/src/cli/parse-errors.ts +12 -0
- package/src/cli/parse.ts +1 -47
- package/src/cli/pipe-input.ts +18 -0
- package/src/cli/pipe.ts +16 -19
- package/src/cli/post.ts +57 -12
- package/src/cli/query-fields.ts +13 -3
- package/src/cli/query.ts +18 -39
- package/src/cli/search.ts +8 -25
- package/src/cli/shared-options.ts +11 -63
- package/src/cli/shared.ts +1 -1
- package/src/cli/store-errors.ts +5 -9
- package/src/cli/store.ts +6 -0
- package/src/cli/sync-factory.ts +13 -21
- package/src/cli/sync.ts +32 -51
- package/src/cli/thread-options.ts +8 -16
- package/src/cli/view-thread.ts +18 -15
- package/src/cli/watch.ts +12 -25
- package/src/domain/primitives.ts +20 -3
- package/src/services/bsky-client.ts +11 -5
- package/src/services/shared.ts +48 -1
- package/src/services/store-cleaner.ts +5 -2
- package/src/services/store-renamer.ts +3 -1
- package/src/services/sync-engine.ts +13 -4
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
|
|
62
62
|
import { Chunk, Clock, Context, Duration, Effect, Fiber, Layer, Option, Ref, Schedule, Schema, Stream } from "effect";
|
|
63
63
|
import { messageFromCause } from "./shared.js";
|
|
64
|
+
import type { BskyError } from "../domain/errors.js";
|
|
64
65
|
import { FilterRuntime } from "./filter-runtime.js";
|
|
65
66
|
import { PostParser } from "./post-parser.js";
|
|
66
67
|
import { StoreCommitter } from "./store-commit.js";
|
|
@@ -155,7 +156,7 @@ export class SyncEngine extends Context.Tag("@skygent/SyncEngine")<
|
|
|
155
156
|
source: DataSource,
|
|
156
157
|
target: StoreRef,
|
|
157
158
|
filter: FilterExpr,
|
|
158
|
-
options?: { readonly policy?: SyncUpsertPolicy }
|
|
159
|
+
options?: { readonly policy?: SyncUpsertPolicy; readonly limit?: number }
|
|
159
160
|
) => Effect.Effect<SyncResult, SyncError>;
|
|
160
161
|
readonly watch: (config: WatchConfig) => Stream.Stream<SyncEvent, SyncError>;
|
|
161
162
|
}
|
|
@@ -172,7 +173,12 @@ export class SyncEngine extends Context.Tag("@skygent/SyncEngine")<
|
|
|
172
173
|
const settings = yield* SyncSettings;
|
|
173
174
|
|
|
174
175
|
const sync = Effect.fn("SyncEngine.sync")(
|
|
175
|
-
(
|
|
176
|
+
(
|
|
177
|
+
source: DataSource,
|
|
178
|
+
target: StoreRef,
|
|
179
|
+
filter: FilterExpr,
|
|
180
|
+
options?: { readonly policy?: SyncUpsertPolicy; readonly limit?: number }
|
|
181
|
+
) =>
|
|
176
182
|
Effect.gen(function* () {
|
|
177
183
|
const predicate = yield* runtime
|
|
178
184
|
.evaluateWithMetadata(filter)
|
|
@@ -287,7 +293,7 @@ export class SyncEngine extends Context.Tag("@skygent/SyncEngine")<
|
|
|
287
293
|
);
|
|
288
294
|
const pageLimit = settings.pageLimit;
|
|
289
295
|
|
|
290
|
-
|
|
296
|
+
let stream = (() => {
|
|
291
297
|
switch (source._tag) {
|
|
292
298
|
case "Timeline":
|
|
293
299
|
return client.getTimeline(
|
|
@@ -360,7 +366,10 @@ export class SyncEngine extends Context.Tag("@skygent/SyncEngine")<
|
|
|
360
366
|
})
|
|
361
367
|
);
|
|
362
368
|
}
|
|
363
|
-
})()
|
|
369
|
+
})() as Stream.Stream<RawPost, BskyError | SyncError>;
|
|
370
|
+
if (options?.limit !== undefined) {
|
|
371
|
+
stream = stream.pipe(Stream.take(options.limit));
|
|
372
|
+
}
|
|
364
373
|
|
|
365
374
|
type SyncState = {
|
|
366
375
|
readonly result: SyncResult;
|