feat(core): jobs, scheduler, plugin registry, connections

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
Lucas Winther
2026-10-30 20:39:17 +01:00
co-authored by Claude Sonnet 5.5
parent 207c92bb4d
commit 166b8ecb5e
20 changed files with 744 additions and 10 deletions
+35
View File
@@ -0,0 +1,35 @@
import { definePlugin, type SourceRecord } from "@sttracker/plugin-sdk/types";
export default definePlugin({
manifest: {
id: "echo",
name: "Echo",
version: "0.0.1",
sdkVersion: 1,
mediaTypes: ["book"],
capabilities: ["pull", "pullChanges"],
config: [
{ key: "label", label: "Label", type: "string" },
{ key: "token", label: "Token", type: "secret" },
],
rateLimit: { perMinute: 30, burst: 2 },
},
async *pull(ctx) {
const cfg = ctx.config;
if (cfg.label === "explode") {
await ctx.credentials.save({ refresh: "new-refresh" });
throw new Error("boom after save");
}
const rec: SourceRecord = {
kind: "entry",
key: "echo-1",
raw: { label: cfg.label ?? null },
work: { title: String(cfg.label ?? "Echo"), mediaType: "book", externalIds: { isbn13: "9780000000002" } },
entry: { status: "completed" },
};
yield rec;
},
async *pullChanges(ctx) {
yield* this.pull!(ctx);
},
});