pixivflow 2.10.31 → 2.12.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.
Files changed (67) hide show
  1. package/config/fly-two-bots.example.json +4 -0
  2. package/dist/commands/SchedulerCommand.d.ts.map +1 -1
  3. package/dist/commands/SchedulerCommand.js +96 -0
  4. package/dist/commands/SchedulerCommand.js.map +1 -1
  5. package/dist/commands/SchedulerRunOnceCommand.d.ts.map +1 -1
  6. package/dist/commands/SchedulerRunOnceCommand.js +5 -1
  7. package/dist/commands/SchedulerRunOnceCommand.js.map +1 -1
  8. package/dist/commands/scheduler-runtime.d.ts +4 -1
  9. package/dist/commands/scheduler-runtime.d.ts.map +1 -1
  10. package/dist/commands/scheduler-runtime.js +104 -5
  11. package/dist/commands/scheduler-runtime.js.map +1 -1
  12. package/dist/config/defaults.d.ts +7 -0
  13. package/dist/config/defaults.d.ts.map +1 -1
  14. package/dist/config/defaults.js +7 -0
  15. package/dist/config/defaults.js.map +1 -1
  16. package/dist/config/types.d.ts +72 -0
  17. package/dist/config/types.d.ts.map +1 -1
  18. package/dist/config/validation.d.ts.map +1 -1
  19. package/dist/config/validation.js +16 -1
  20. package/dist/config/validation.js.map +1 -1
  21. package/dist/delivery/DeliveryOutbox.d.ts +7 -0
  22. package/dist/delivery/DeliveryOutbox.d.ts.map +1 -1
  23. package/dist/delivery/DeliveryOutbox.js +19 -0
  24. package/dist/delivery/DeliveryOutbox.js.map +1 -1
  25. package/dist/delivery/HttpMultipartDelivery.d.ts.map +1 -1
  26. package/dist/delivery/HttpMultipartDelivery.js +10 -1
  27. package/dist/delivery/HttpMultipartDelivery.js.map +1 -1
  28. package/dist/delivery/types.d.ts +16 -0
  29. package/dist/delivery/types.d.ts.map +1 -1
  30. package/dist/download/DownloadManager.d.ts +12 -1
  31. package/dist/download/DownloadManager.d.ts.map +1 -1
  32. package/dist/download/DownloadManager.js +15 -0
  33. package/dist/download/DownloadManager.js.map +1 -1
  34. package/dist/package.json +1 -1
  35. package/dist/scheduler/MultiScheduleManager.d.ts +17 -1
  36. package/dist/scheduler/MultiScheduleManager.d.ts.map +1 -1
  37. package/dist/scheduler/MultiScheduleManager.js +55 -5
  38. package/dist/scheduler/MultiScheduleManager.js.map +1 -1
  39. package/dist/scheduler/OccurrenceResolver.d.ts +90 -0
  40. package/dist/scheduler/OccurrenceResolver.d.ts.map +1 -0
  41. package/dist/scheduler/OccurrenceResolver.js +127 -0
  42. package/dist/scheduler/OccurrenceResolver.js.map +1 -0
  43. package/dist/scheduler/ScheduleTriggerServer.d.ts +60 -0
  44. package/dist/scheduler/ScheduleTriggerServer.d.ts.map +1 -0
  45. package/dist/scheduler/ScheduleTriggerServer.js +99 -0
  46. package/dist/scheduler/ScheduleTriggerServer.js.map +1 -0
  47. package/dist/scheduler/Scheduler.d.ts +15 -4
  48. package/dist/scheduler/Scheduler.d.ts.map +1 -1
  49. package/dist/scheduler/Scheduler.js +36 -15
  50. package/dist/scheduler/Scheduler.js.map +1 -1
  51. package/dist/scheduler/SlotCoordinator.d.ts +90 -0
  52. package/dist/scheduler/SlotCoordinator.d.ts.map +1 -0
  53. package/dist/scheduler/SlotCoordinator.js +176 -0
  54. package/dist/scheduler/SlotCoordinator.js.map +1 -0
  55. package/dist/storage/Database.d.ts +4 -0
  56. package/dist/storage/Database.d.ts.map +1 -1
  57. package/dist/storage/Database.js +7 -0
  58. package/dist/storage/Database.js.map +1 -1
  59. package/dist/storage/DatabaseMigration.d.ts.map +1 -1
  60. package/dist/storage/DatabaseMigration.js +74 -2
  61. package/dist/storage/DatabaseMigration.js.map +1 -1
  62. package/dist/storage/repositories/SlotRepository.d.ts +102 -0
  63. package/dist/storage/repositories/SlotRepository.d.ts.map +1 -0
  64. package/dist/storage/repositories/SlotRepository.js +224 -0
  65. package/dist/storage/repositories/SlotRepository.js.map +1 -0
  66. package/dist/webui/package.json +1 -1
  67. package/package.json +1 -1
@@ -74,8 +74,77 @@ class DatabaseMigration {
74
74
  progress_message TEXT,
75
75
  created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
76
76
  updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
77
+ )`,
78
+ // Schedule Slots: one business batch (e.g. 2026-09-08:morning). A slot
79
+ // groups one run of each enabled target (a "cell"). External triggers
80
+ // and restarts converge on the SAME slot row instead of re-running.
81
+ //
82
+ // A Slot is one durable execution occurrence of a Schedule. Its id is
83
+ // schedule-scoped (`<scheduleId>@<occurrenceStamp>`); occurrence_at is
84
+ // the canonical scheduled fire time in the schedule's own timezone.
85
+ // target_ids snapshots the membership materialized at first run so a
86
+ // later config reload cannot mutate an in-flight occurrence.
87
+ `CREATE TABLE IF NOT EXISTS schedule_slots (
88
+ id TEXT PRIMARY KEY,
89
+ schedule_id TEXT NOT NULL,
90
+ occurrence_at INTEGER,
91
+ occurrence_date TEXT NOT NULL DEFAULT '',
92
+ occurrence_label TEXT NOT NULL DEFAULT '',
93
+ timezone TEXT NOT NULL DEFAULT 'UTC',
94
+ target_ids TEXT,
95
+ status TEXT NOT NULL DEFAULT 'pending',
96
+ trigger_source TEXT,
97
+ slot_date TEXT NOT NULL DEFAULT '',
98
+ slot_name TEXT NOT NULL DEFAULT '',
99
+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
100
+ started_at DATETIME,
101
+ completed_at DATETIME,
102
+ last_error TEXT
103
+ )`,
104
+ // One cell per (slot, target). UNIQUE(slot_id, target_id) is the core
105
+ // business idempotency: a given slot can never emit two works for one
106
+ // target even under duplicate triggers / restarts / outbox replay.
107
+ `CREATE TABLE IF NOT EXISTS schedule_slot_items (
108
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
109
+ slot_id TEXT NOT NULL,
110
+ target_id TEXT NOT NULL,
111
+ work_id TEXT,
112
+ work_type TEXT,
113
+ status TEXT NOT NULL DEFAULT 'pending',
114
+ attempt_count INTEGER NOT NULL DEFAULT 0,
115
+ last_error TEXT,
116
+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
117
+ updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
118
+ completed_at DATETIME,
119
+ UNIQUE(slot_id, target_id)
77
120
  )`,
78
121
  ];
122
+ // Phase 1: create tables (idempotent). Must run before any PRAGMA-based
123
+ // column check, otherwise a fresh DB would report the table as missing and
124
+ // both CREATE and ADD COLUMN would create the same column.
125
+ const createTables = this.db.transaction((stmts) => {
126
+ for (const sql of stmts) {
127
+ this.db.prepare(sql).run();
128
+ }
129
+ });
130
+ createTables(migrations);
131
+ // Phase 2: additive column migrations for databases created before the
132
+ // canonical occurrence model. The table now exists, so PRAGMA reports the
133
+ // true current columns; ALTER only the ones missing on upgraded DBs (fresh
134
+ // DBs already have them from the CREATE above and skip these).
135
+ const slotCols = this.db.prepare(`PRAGMA table_info(schedule_slots)`).all().map((c) => c.name);
136
+ const slotColumnMigrations = {
137
+ occurrence_at: 'ALTER TABLE schedule_slots ADD COLUMN occurrence_at INTEGER',
138
+ occurrence_date: `ALTER TABLE schedule_slots ADD COLUMN occurrence_date TEXT NOT NULL DEFAULT ''`,
139
+ occurrence_label: `ALTER TABLE schedule_slots ADD COLUMN occurrence_label TEXT NOT NULL DEFAULT ''`,
140
+ timezone: `ALTER TABLE schedule_slots ADD COLUMN timezone TEXT NOT NULL DEFAULT 'UTC'`,
141
+ target_ids: 'ALTER TABLE schedule_slots ADD COLUMN target_ids TEXT',
142
+ };
143
+ const columnAlters = [];
144
+ for (const [col, sql] of Object.entries(slotColumnMigrations)) {
145
+ if (!slotCols.includes(col))
146
+ columnAlters.push(sql);
147
+ }
79
148
  // Create indexes for better query performance
80
149
  const indexes = [
81
150
  `CREATE INDEX IF NOT EXISTS idx_downloads_pixiv_id_type ON downloads(pixiv_id, type)`,
@@ -88,13 +157,16 @@ class DatabaseMigration {
88
157
  `CREATE INDEX IF NOT EXISTS idx_task_history_task_id ON task_history(task_id)`,
89
158
  `CREATE INDEX IF NOT EXISTS idx_task_history_status ON task_history(status)`,
90
159
  `CREATE INDEX IF NOT EXISTS idx_task_history_start_time ON task_history(start_time)`,
160
+ `CREATE INDEX IF NOT EXISTS idx_slots_schedule_occ ON schedule_slots(schedule_id, occurrence_at DESC)`,
161
+ `CREATE INDEX IF NOT EXISTS idx_slot_items_slot ON schedule_slot_items(slot_id)`,
162
+ `CREATE INDEX IF NOT EXISTS idx_slot_items_work ON schedule_slot_items(work_id, work_type)`,
91
163
  ];
92
- const transaction = this.db.transaction((stmts) => {
164
+ const postMigration = this.db.transaction((stmts) => {
93
165
  for (const sql of stmts) {
94
166
  this.db.prepare(sql).run();
95
167
  }
96
168
  });
97
- transaction([...migrations, ...indexes]);
169
+ postMigration([...columnAlters, ...indexes]);
98
170
  // Add is_active column to config_history if it doesn't exist
99
171
  try {
100
172
  // Check if column exists by querying pragma_table_info
@@ -1 +1 @@
1
- {"version":3,"file":"DatabaseMigration.js","sourceRoot":"","sources":["../../src/storage/DatabaseMigration.ts"],"names":[],"mappings":";;;AACA,4CAAgD;AAChD,sCAAmC;AAEnC;;GAEG;AACH,MAAa,iBAAiB;IACC;IAA7B,YAA6B,EAA2B;QAA3B,OAAE,GAAF,EAAE,CAAyB;IAAG,CAAC;IAE5D;;OAEG;IACI,OAAO;QACZ,IAAI,CAAC;YACH,MAAM,UAAU,GAAG;gBACjB;;;;YAII;gBACJ;;;;;;;;;;;YAWI;gBACJ;;;;;;;YAOI;gBACJ;;;;;;;;;;YAUI;gBACJ;;;;;;;YAOI;gBACJ;;;;;;;;;;;;;YAaI;aACL,CAAC;YAEF,8CAA8C;YAC9C,MAAM,OAAO,GAAG;gBACd,qFAAqF;gBACrF,gEAAgE;gBAChE,oFAAoF;gBACpF,mFAAmF;gBACnF,sGAAsG;gBACtG,4FAA4F;gBAC5F,wFAAwF;gBACxF,8EAA8E;gBAC9E,4EAA4E;gBAC5E,oFAAoF;aACrF,CAAC;YAEF,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,KAAe,EAAE,EAAE;gBAC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@
1
+ import { BaseRepository } from './BaseRepository';
2
+ export type SlotStatus = 'pending' | 'running' | 'success' | 'partial' | 'failed' | 'expired';
3
+ export type CellStatus = 'pending' | 'selected' | 'submitted' | 'no_candidate' | 'failed';
4
+ export interface SlotRecord {
5
+ id: string;
6
+ /** Schedule this occurrence belongs to (id is already schedule-scoped). */
7
+ scheduleId: string;
8
+ /** Canonical scheduled fire time (epoch ms, UTC); null for legacy rows. */
9
+ occurrenceAt: number | null;
10
+ /** Schedule date (YYYY-MM-DD) in the schedule timezone — display only. */
11
+ occurrenceDate: string;
12
+ /** Wall-clock time-of-day label in tz, e.g. "10:00" — display only. */
13
+ occurrenceLabel: string;
14
+ timezone: string;
15
+ /** Materialized target membership snapshot (JSON array of target ids). */
16
+ targetIds: string[];
17
+ status: SlotStatus;
18
+ triggerSource: string | null;
19
+ slotDate: string;
20
+ slotName: string;
21
+ createdAt: string;
22
+ startedAt: string | null;
23
+ completedAt: string | null;
24
+ lastError: string | null;
25
+ }
26
+ export interface SlotItemRecord {
27
+ id: number;
28
+ slotId: string;
29
+ targetId: string;
30
+ workId: string | null;
31
+ workType: string | null;
32
+ status: CellStatus;
33
+ attemptCount: number;
34
+ lastError: string | null;
35
+ createdAt: string;
36
+ updatedAt: string;
37
+ completedAt: string | null;
38
+ }
39
+ /**
40
+ * Durable ledger for Schedule Slots and their per-target cells.
41
+ *
42
+ * A slot is one business batch (e.g. `2026-09-08:morning`). Each enabled target
43
+ * owns exactly one cell in a slot, enforced by UNIQUE(slot_id, target_id). This
44
+ * is the business-level idempotency layer above TelePost's work-level
45
+ * idempotency: duplicate triggers / restarts / outbox replays all converge on
46
+ * the same row instead of emitting a second work for the same slot/target.
47
+ */
48
+ export declare class SlotRepository extends BaseRepository {
49
+ /**
50
+ * Fetch an existing slot or create it. On creation the schedule's target
51
+ * membership is snapshotted (target_ids); a later config reload never mutates
52
+ * this occurrence. Returns `created:false` when the id already existed so the
53
+ * caller resumes rather than restarting.
54
+ */
55
+ getOrCreateSlot(id: string, data: {
56
+ scheduleId: string;
57
+ occurrenceAt?: number | null;
58
+ occurrenceDate?: string;
59
+ occurrenceLabel?: string;
60
+ timezone?: string;
61
+ targetIds: string[];
62
+ triggerSource?: string;
63
+ slotDate?: string;
64
+ slotName?: string;
65
+ }): {
66
+ slot: SlotRecord;
67
+ created: boolean;
68
+ };
69
+ getSlot(id: string): SlotRecord | null;
70
+ /** Target ids materialized for a slot (stable membership; falls back to []). */
71
+ getSlotTargetIds(id: string): string[];
72
+ getRecentSlots(limit?: number): SlotRecord[];
73
+ markSlotStatus(id: string, status: SlotStatus, error?: string): void;
74
+ /** All cells for a slot (one per target). */
75
+ getCells(slotId: string): SlotItemRecord[];
76
+ getCell(slotId: string, targetId: string): SlotItemRecord | null;
77
+ /**
78
+ * Ensure a cell exists for every target id in the slot's materialized
79
+ * membership. The cell set is fixed at first materialization (the snapshot in
80
+ * schedule_slots.target_ids); a config reload cannot add/remove cells here.
81
+ * Returns the authoritative target ids for this occurrence.
82
+ */
83
+ materializeCells(slotId: string, targetIds: string[], workTypeByTarget: (id: string) => string): string[];
84
+ /** Create the cell row if it does not exist (idempotent). */
85
+ ensureCell(slotId: string, targetId: string, workType: string): SlotItemRecord;
86
+ /**
87
+ * Lock the selected work for a cell. The first selection wins; later calls
88
+ * (automatic retries, outbox replay, duplicate triggers) never overwrite it —
89
+ * candidate replacement is a separate explicit operator action (clearCellWork).
90
+ */
91
+ lockCellWork(slotId: string, targetId: string, workId: string, workType: string): SlotItemRecord;
92
+ /** Explicit operator action: forget the locked work so a re-run picks another candidate. */
93
+ clearCellWork(slotId: string, targetId: string): void;
94
+ setCellStatus(slotId: string, targetId: string, status: CellStatus, error?: string): void;
95
+ /** Work ids already locked in THIS slot (to stop two cells taking the same work). */
96
+ getLockedWorkIds(slotId: string): Set<string>;
97
+ /** Roll up a slot's status from its cells. */
98
+ deriveSlotStatus(slotId: string): SlotStatus;
99
+ private toSlot;
100
+ private toItem;
101
+ }
102
+ //# sourceMappingURL=SlotRepository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SlotRepository.d.ts","sourceRoot":"","sources":["../../../src/storage/repositories/SlotRepository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;AAC9F,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,cAAc,GAAG,QAAQ,CAAC;AAE1F,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,2EAA2E;IAC3E,UAAU,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,0EAA0E;IAC1E,cAAc,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,0EAA0E;IAC1E,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,UAAU,CAAC;IACnB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,UAAU,CA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AE,MAAM,EAAE,EAAE,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,EAAE;IAoBhH,6DAA6D;IACtD,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc;IAWrF;;;;OAIG;IACI,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc;IAevG,4FAA4F;IACrF,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI;IAWrD,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI;IAShG,qFAAqF;IAC9E,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;IAOpD,8CAA8C;IACvC,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU;IAUnD,OAAO,CAAC,MAAM;IA2Bd,OAAO,CAAC,MAAM;CAef"}
@@ -0,0 +1,224 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SlotRepository = void 0;
4
+ const BaseRepository_1 = require("./BaseRepository");
5
+ /**
6
+ * Durable ledger for Schedule Slots and their per-target cells.
7
+ *
8
+ * A slot is one business batch (e.g. `2026-09-08:morning`). Each enabled target
9
+ * owns exactly one cell in a slot, enforced by UNIQUE(slot_id, target_id). This
10
+ * is the business-level idempotency layer above TelePost's work-level
11
+ * idempotency: duplicate triggers / restarts / outbox replays all converge on
12
+ * the same row instead of emitting a second work for the same slot/target.
13
+ */
14
+ class SlotRepository extends BaseRepository_1.BaseRepository {
15
+ /**
16
+ * Fetch an existing slot or create it. On creation the schedule's target
17
+ * membership is snapshotted (target_ids); a later config reload never mutates
18
+ * this occurrence. Returns `created:false` when the id already existed so the
19
+ * caller resumes rather than restarting.
20
+ */
21
+ getOrCreateSlot(id, data) {
22
+ const insert = this.db.prepare(`INSERT INTO schedule_slots
23
+ (id, schedule_id, occurrence_at, occurrence_date, occurrence_label, timezone, target_ids,
24
+ status, trigger_source, slot_date, slot_name)
25
+ VALUES
26
+ (@id, @scheduleId, @occurrenceAt, @occurrenceDate, @occurrenceLabel, @timezone, @targetIds,
27
+ 'pending', @triggerSource, @slotDate, @slotName)
28
+ ON CONFLICT(id) DO NOTHING`);
29
+ const info = insert.run({
30
+ id,
31
+ scheduleId: data.scheduleId,
32
+ occurrenceAt: data.occurrenceAt ?? null,
33
+ occurrenceDate: data.occurrenceDate ?? '',
34
+ occurrenceLabel: data.occurrenceLabel ?? '',
35
+ timezone: data.timezone ?? 'UTC',
36
+ targetIds: JSON.stringify(data.targetIds),
37
+ triggerSource: data.triggerSource ?? null,
38
+ slotDate: data.slotDate ?? data.occurrenceDate ?? '',
39
+ slotName: data.slotName ?? '',
40
+ });
41
+ const created = info.changes > 0;
42
+ return { slot: this.getSlot(id), created };
43
+ }
44
+ getSlot(id) {
45
+ const row = this.db.prepare(`SELECT * FROM schedule_slots WHERE id = ?`).get(id);
46
+ return row ? this.toSlot(row) : null;
47
+ }
48
+ /** Target ids materialized for a slot (stable membership; falls back to []). */
49
+ getSlotTargetIds(id) {
50
+ const row = this.db.prepare(`SELECT target_ids FROM schedule_slots WHERE id = ?`).get(id);
51
+ if (!row?.target_ids)
52
+ return [];
53
+ try {
54
+ const parsed = JSON.parse(row.target_ids);
55
+ return Array.isArray(parsed) ? parsed.map(String) : [];
56
+ }
57
+ catch {
58
+ return [];
59
+ }
60
+ }
61
+ getRecentSlots(limit = 14) {
62
+ const rows = this.db
63
+ .prepare(`SELECT * FROM schedule_slots ORDER BY COALESCE(occurrence_at, 0) DESC, id DESC LIMIT ?`)
64
+ .all(limit);
65
+ return rows.map((r) => this.toSlot(r));
66
+ }
67
+ markSlotStatus(id, status, error) {
68
+ const stamp = status === 'running' ? 'started_at' : status === 'success' || status === 'partial' || status === 'failed' ? 'completed_at' : null;
69
+ const sets = ['status = @status', 'last_error = @error'];
70
+ if (stamp === 'started_at')
71
+ sets.push('started_at = CURRENT_TIMESTAMP');
72
+ if (stamp === 'completed_at')
73
+ sets.push('completed_at = CURRENT_TIMESTAMP');
74
+ this.db
75
+ .prepare(`UPDATE schedule_slots SET ${sets.join(', ')} WHERE id = @id`)
76
+ .run({ id, status, error: error ?? null });
77
+ }
78
+ /** All cells for a slot (one per target). */
79
+ getCells(slotId) {
80
+ const rows = this.db
81
+ .prepare(`SELECT * FROM schedule_slot_items WHERE slot_id = ? ORDER BY target_id ASC`)
82
+ .all(slotId);
83
+ return rows.map((r) => this.toItem(r));
84
+ }
85
+ getCell(slotId, targetId) {
86
+ const row = this.db
87
+ .prepare(`SELECT * FROM schedule_slot_items WHERE slot_id = ? AND target_id = ?`)
88
+ .get(slotId, targetId);
89
+ return row ? this.toItem(row) : null;
90
+ }
91
+ /**
92
+ * Ensure a cell exists for every target id in the slot's materialized
93
+ * membership. The cell set is fixed at first materialization (the snapshot in
94
+ * schedule_slots.target_ids); a config reload cannot add/remove cells here.
95
+ * Returns the authoritative target ids for this occurrence.
96
+ */
97
+ materializeCells(slotId, targetIds, workTypeByTarget) {
98
+ // The frozen snapshot (schedule_slots.target_ids) is the authority for which
99
+ // cells belong to this occurrence. Intersect with the requested ids so a
100
+ // later config reload can never materialize a cell outside the snapshot.
101
+ const snapshot = new Set(this.getSlotTargetIds(slotId));
102
+ const authorized = snapshot.size > 0 ? targetIds.filter((id) => snapshot.has(id)) : targetIds;
103
+ const insert = this.db.prepare(`INSERT INTO schedule_slot_items (slot_id, target_id, work_type, status)
104
+ VALUES (@slotId, @targetId, @workType, 'pending')
105
+ ON CONFLICT(slot_id, target_id) DO NOTHING`);
106
+ const tx = this.db.transaction((ids) => {
107
+ for (const targetId of ids) {
108
+ insert.run({ slotId, targetId, workType: workTypeByTarget(targetId) || 'unknown' });
109
+ }
110
+ });
111
+ tx(authorized);
112
+ return authorized;
113
+ }
114
+ /** Create the cell row if it does not exist (idempotent). */
115
+ ensureCell(slotId, targetId, workType) {
116
+ this.db
117
+ .prepare(`INSERT INTO schedule_slot_items (slot_id, target_id, work_type, status)
118
+ VALUES (@slotId, @targetId, @workType, 'pending')
119
+ ON CONFLICT(slot_id, target_id) DO NOTHING`)
120
+ .run({ slotId, targetId, workType });
121
+ return this.getCell(slotId, targetId);
122
+ }
123
+ /**
124
+ * Lock the selected work for a cell. The first selection wins; later calls
125
+ * (automatic retries, outbox replay, duplicate triggers) never overwrite it —
126
+ * candidate replacement is a separate explicit operator action (clearCellWork).
127
+ */
128
+ lockCellWork(slotId, targetId, workId, workType) {
129
+ this.db
130
+ .prepare(`UPDATE schedule_slot_items
131
+ SET work_id = COALESCE(work_id, @workId),
132
+ work_type = CASE WHEN work_id IS NULL THEN @workType ELSE work_type END,
133
+ status = CASE WHEN status = 'pending' THEN 'selected' ELSE status END,
134
+ attempt_count = attempt_count + 1,
135
+ updated_at = CURRENT_TIMESTAMP
136
+ WHERE slot_id = @slotId AND target_id = @targetId`)
137
+ .run({ slotId, targetId, workId, workType });
138
+ return this.getCell(slotId, targetId);
139
+ }
140
+ /** Explicit operator action: forget the locked work so a re-run picks another candidate. */
141
+ clearCellWork(slotId, targetId) {
142
+ this.db
143
+ .prepare(`UPDATE schedule_slot_items
144
+ SET work_id = NULL, status = 'pending', last_error = NULL,
145
+ completed_at = NULL, updated_at = CURRENT_TIMESTAMP
146
+ WHERE slot_id = @slotId AND target_id = @targetId`)
147
+ .run({ slotId, targetId });
148
+ }
149
+ setCellStatus(slotId, targetId, status, error) {
150
+ const terminal = status === 'submitted' || status === 'no_candidate' || status === 'failed';
151
+ const sets = ['status = @status', 'last_error = @error', 'updated_at = CURRENT_TIMESTAMP'];
152
+ if (terminal)
153
+ sets.push('completed_at = CURRENT_TIMESTAMP');
154
+ this.db
155
+ .prepare(`UPDATE schedule_slot_items SET ${sets.join(', ')} WHERE slot_id = @slotId AND target_id = @targetId`)
156
+ .run({ slotId, targetId, status, error: error ?? null });
157
+ }
158
+ /** Work ids already locked in THIS slot (to stop two cells taking the same work). */
159
+ getLockedWorkIds(slotId) {
160
+ const rows = this.db
161
+ .prepare(`SELECT work_id FROM schedule_slot_items WHERE slot_id = ? AND work_id IS NOT NULL`)
162
+ .all(slotId);
163
+ return new Set(rows.map((r) => r.work_id));
164
+ }
165
+ /** Roll up a slot's status from its cells. */
166
+ deriveSlotStatus(slotId) {
167
+ const cells = this.getCells(slotId);
168
+ if (cells.length === 0)
169
+ return 'pending';
170
+ const terminal = cells.filter((c) => c.status === 'submitted' || c.status === 'no_candidate' || c.status === 'failed');
171
+ if (terminal.length < cells.length)
172
+ return 'running';
173
+ if (cells.every((c) => c.status === 'submitted'))
174
+ return 'success';
175
+ if (cells.some((c) => c.status === 'submitted'))
176
+ return 'partial';
177
+ return 'failed';
178
+ }
179
+ toSlot(row) {
180
+ let targetIds = [];
181
+ try {
182
+ const parsed = row.target_ids ? JSON.parse(row.target_ids) : [];
183
+ if (Array.isArray(parsed))
184
+ targetIds = parsed.map(String);
185
+ }
186
+ catch {
187
+ targetIds = [];
188
+ }
189
+ return {
190
+ id: row.id,
191
+ scheduleId: row.schedule_id,
192
+ occurrenceAt: row.occurrence_at ?? null,
193
+ occurrenceDate: row.occurrence_date ?? '',
194
+ occurrenceLabel: row.occurrence_label ?? '',
195
+ timezone: row.timezone ?? 'UTC',
196
+ targetIds,
197
+ status: row.status,
198
+ triggerSource: row.trigger_source,
199
+ slotDate: row.slot_date ?? '',
200
+ slotName: row.slot_name ?? '',
201
+ createdAt: row.created_at,
202
+ startedAt: row.started_at,
203
+ completedAt: row.completed_at,
204
+ lastError: row.last_error,
205
+ };
206
+ }
207
+ toItem(row) {
208
+ return {
209
+ id: row.id,
210
+ slotId: row.slot_id,
211
+ targetId: row.target_id,
212
+ workId: row.work_id,
213
+ workType: row.work_type,
214
+ status: row.status,
215
+ attemptCount: row.attempt_count,
216
+ lastError: row.last_error,
217
+ createdAt: row.created_at,
218
+ updatedAt: row.updated_at,
219
+ completedAt: row.completed_at,
220
+ };
221
+ }
222
+ }
223
+ exports.SlotRepository = SlotRepository;
224
+ //# sourceMappingURL=SlotRepository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SlotRepository.js","sourceRoot":"","sources":["../../../src/storage/repositories/SlotRepository.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AA2ClD;;;;;;;;GAQG;AACH,MAAa,cAAe,SAAQ,+BAAc;IAChD;;;;;OAKG;IACI,eAAe,CACpB,EAAU,EACV,IAWC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CAC5B;;;;;;kCAM4B,CAC7B,CAAC;QACF,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC;YACtB,EAAE;YACF,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,IAAI;YACvC,cAAc,EAAE,IAAI,CAAC,cAAc,IAAI,EAAE;YACzC,eAAe,EAAE,IAAI,CAAC,eAAe,IAAI,EAAE;YAC3C,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,KAAK;YAChC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC;YACzC,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,IAAI;YACzC,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,cAAc,IAAI,EAAE;YACpD,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE;SAC9B,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;QACjC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAE,EAAE,OAAO,EAAE,CAAC;IA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AI,KAAK;YAC/B,SAAS;YACT,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,aAAa,EAAE,GAAG,CAAC,cAAc;YACjC,QAAQ,EAAE,GAAG,CAAC,SAAS,IAAI,EAAE;YAC7B,QAAQ,EAAE,GAAG,CAAC,SAAS,IAAI,EAAE;YAC7B,SAAS,EAAE,GAAG,CAAC,UAAU;YACzB,SAAS,EAAE,GAAG,CAAC,UAAU;YACzB,WAAW,EAAE,GAAG,CAAC,YAAY;YAC7B,SAAS,EAAE,GAAG,CAAC,UAAU;SAC1B,CAAC;IACJ,CAAC;IAEO,MAAM,CAAC,GAAQ;QACrB,OAAO;YACL,EAAE,EAAE,GAAG,CAAC,EAAE;YACV,MAAM,EAAE,GAAG,CAAC,OAAO;YACnB,QAAQ,EAAE,GAAG,CAAC,SAAS;YACvB,MAAM,EAAE,GAAG,CAAC,OAAO;YACnB,QAAQ,EAAE,GAAG,CAAC,SAAS;YACvB,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,YAAY,EAAE,GAAG,CAAC,aAAa;YAC/B,SAAS,EAAE,GAAG,CAAC,UAAU;YACzB,SAAS,EAAE,GAAG,CAAC,UAAU;YACzB,SAAS,EAAE,GAAG,CAAC,UAAU;YACzB,WAAW,EAAE,GAAG,CAAC,YAAY;SAC9B,CAAC;IACJ,CAAC;CACF;AA9OD,wCA8OC"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "type": "commonjs",
3
3
  "name": "pixivflow-webui-backend",
4
- "version": "2.10.31",
4
+ "version": "2.12.0",
5
5
  "description": "PixivFlow WebUI Backend - CommonJS module"
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixivflow",
3
- "version": "2.10.31",
3
+ "version": "2.12.0",
4
4
  "description": "🎨 智能的 Pixiv 自动化下载工具 - 支持批量下载插画和小说、定时任务、Docker部署 | Intelligent Pixiv Automation Downloader with batch download, scheduler, and Docker support",
5
5
  "repository": {
6
6
  "type": "git",