@powerhousedao/reactor 4.1.0-dev.9 → 5.0.0-staging.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/bench/end-to-end-flow.bench.js +21 -11
- package/dist/bench/end-to-end-flow.bench.js.map +1 -1
- package/dist/bench/event-bus.bench.js +7 -7
- package/dist/bench/event-bus.bench.js.map +1 -1
- package/dist/bench/queue-only.bench.js +8 -3
- package/dist/bench/queue-only.bench.js.map +1 -1
- package/dist/bench/reactor-throughput.bench.js +18 -8
- package/dist/bench/reactor-throughput.bench.js.map +1 -1
- package/dist/src/events/event-bus.d.ts +2 -2
- package/dist/src/events/event-bus.d.ts.map +1 -1
- package/dist/src/events/event-bus.js +1 -1
- package/dist/src/events/event-bus.js.map +1 -1
- package/dist/src/events/interfaces.d.ts +1 -1
- package/dist/src/events/interfaces.d.ts.map +1 -1
- package/dist/src/events/types.d.ts +1 -1
- package/dist/src/events/types.d.ts.map +1 -1
- package/dist/src/events/types.js.map +1 -1
- package/dist/src/executor/interfaces.d.ts +2 -2
- package/dist/src/executor/interfaces.d.ts.map +1 -1
- package/dist/src/executor/job-executor.d.ts +5 -5
- package/dist/src/executor/job-executor.d.ts.map +1 -1
- package/dist/src/executor/job-executor.js +2 -2
- package/dist/src/executor/job-executor.js.map +1 -1
- package/dist/src/executor/types.d.ts +1 -1
- package/dist/src/executor/types.d.ts.map +1 -1
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/interfaces/reactor.d.ts +121 -0
- package/dist/src/interfaces/reactor.d.ts.map +1 -0
- package/dist/src/interfaces/reactor.js +2 -0
- package/dist/src/interfaces/reactor.js.map +1 -0
- package/dist/src/queue/interfaces.d.ts +1 -1
- package/dist/src/queue/interfaces.d.ts.map +1 -1
- package/dist/src/queue/queue.d.ts +3 -3
- package/dist/src/queue/queue.d.ts.map +1 -1
- package/dist/src/queue/queue.js.map +1 -1
- package/dist/src/queue/types.d.ts +1 -1
- package/dist/src/queue/types.d.ts.map +1 -1
- package/dist/src/reactor.d.ts +109 -0
- package/dist/src/reactor.d.ts.map +1 -0
- package/dist/src/reactor.js +602 -0
- package/dist/src/reactor.js.map +1 -0
- package/dist/src/shared/factories.d.ts +16 -0
- package/dist/src/shared/factories.d.ts.map +1 -0
- package/dist/src/shared/factories.js +33 -0
- package/dist/src/shared/factories.js.map +1 -0
- package/dist/src/shared/types.d.ts +83 -19
- package/dist/src/shared/types.d.ts.map +1 -1
- package/dist/src/shared/types.js +30 -1
- package/dist/src/shared/types.js.map +1 -1
- package/dist/src/shared/utils.d.ts +3 -0
- package/dist/src/shared/utils.d.ts.map +1 -0
- package/dist/src/shared/utils.js +8 -0
- package/dist/src/shared/utils.js.map +1 -0
- package/dist/src/utils.d.ts +11 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +29 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/test/event-bus.test.js +4 -4
- package/dist/test/event-bus.test.js.map +1 -1
- package/dist/test/job-executor.test.js +9 -3
- package/dist/test/job-executor.test.js.map +1 -1
- package/dist/test/queue.test.js +17 -6
- package/dist/test/queue.test.js.map +1 -1
- package/dist/test/reactor-read.test.d.ts +2 -0
- package/dist/test/reactor-read.test.d.ts.map +1 -0
- package/dist/test/reactor-read.test.js +330 -0
- package/dist/test/reactor-read.test.js.map +1 -0
- package/dist/test/reactor-write.test.d.ts +2 -0
- package/dist/test/reactor-write.test.d.ts.map +1 -0
- package/dist/test/reactor-write.test.js +232 -0
- package/dist/test/reactor-write.test.js.map +1 -0
- package/dist/test/utils.test.d.ts +2 -0
- package/dist/test/utils.test.d.ts.map +1 -0
- package/dist/test/utils.test.js +66 -0
- package/dist/test/utils.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -1
|
@@ -0,0 +1,602 @@
|
|
|
1
|
+
import { AbortError } from "document-drive/utils/errors";
|
|
2
|
+
import { v4 as uuidv4 } from "uuid";
|
|
3
|
+
import { createMutableShutdownStatus } from "./shared/factories.js";
|
|
4
|
+
import { JobStatus, } from "./shared/types.js";
|
|
5
|
+
import { matchesScope } from "./shared/utils.js";
|
|
6
|
+
import { filterByParentId, filterByType } from "./utils.js";
|
|
7
|
+
/**
|
|
8
|
+
* The Reactor facade implementation.
|
|
9
|
+
*
|
|
10
|
+
* This class implements the IReactor interface and serves as the main entry point
|
|
11
|
+
* for the new Reactor architecture. In Phase 2 of the refactoring plan, it acts
|
|
12
|
+
* as a facade over the existing BaseDocumentDriveServer while we incrementally
|
|
13
|
+
* migrate to the new architecture.
|
|
14
|
+
*
|
|
15
|
+
* The facade pattern allows us to:
|
|
16
|
+
* 1. Present the new IReactor API to clients immediately
|
|
17
|
+
* 2. Internally delegate to the refactored BaseDocumentDriveServer (post Phase 1)
|
|
18
|
+
* 3. Incrementally replace internal implementations without breaking clients
|
|
19
|
+
* 4. Validate the new architecture alongside the existing system
|
|
20
|
+
*/
|
|
21
|
+
export class Reactor {
|
|
22
|
+
driveServer;
|
|
23
|
+
documentStorage;
|
|
24
|
+
shutdownStatus;
|
|
25
|
+
setShutdown;
|
|
26
|
+
eventBus;
|
|
27
|
+
queue;
|
|
28
|
+
jobExecutor;
|
|
29
|
+
jobExecutorStarted = false;
|
|
30
|
+
constructor(driveServer, documentStorage, eventBus, queue, jobExecutor) {
|
|
31
|
+
// Store required dependencies
|
|
32
|
+
this.driveServer = driveServer;
|
|
33
|
+
this.documentStorage = documentStorage;
|
|
34
|
+
this.eventBus = eventBus;
|
|
35
|
+
this.queue = queue;
|
|
36
|
+
this.jobExecutor = jobExecutor;
|
|
37
|
+
// Create mutable shutdown status using factory method
|
|
38
|
+
const [status, setter] = createMutableShutdownStatus(false);
|
|
39
|
+
this.shutdownStatus = status;
|
|
40
|
+
this.setShutdown = setter;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Signals that the reactor should shutdown.
|
|
44
|
+
*/
|
|
45
|
+
kill() {
|
|
46
|
+
// Mark the reactor as shutdown
|
|
47
|
+
this.setShutdown(true);
|
|
48
|
+
// TODO: Phase 3+ - Implement graceful shutdown for queue, executors, etc.
|
|
49
|
+
// For now, we just mark as shutdown and return status
|
|
50
|
+
return this.shutdownStatus;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Retrieves a list of document model specifications
|
|
54
|
+
*/
|
|
55
|
+
getDocumentModels(namespace, paging, signal) {
|
|
56
|
+
// Get document model modules from the drive server
|
|
57
|
+
// Note: BaseDocumentDriveServer provides modules, not model states
|
|
58
|
+
// This is an adaptation layer that converts modules to states
|
|
59
|
+
const modules = this.driveServer.getDocumentModelModules();
|
|
60
|
+
// Convert modules to DocumentModelState format
|
|
61
|
+
// TODO: Proper conversion when DocumentModelState structure is finalized
|
|
62
|
+
const filteredModels = modules
|
|
63
|
+
.filter((module) => !namespace || module.documentModel.name.startsWith(namespace))
|
|
64
|
+
.map((module) => ({
|
|
65
|
+
id: module.documentModel.id,
|
|
66
|
+
name: module.documentModel.name,
|
|
67
|
+
extension: module.documentModel.extension,
|
|
68
|
+
author: module.documentModel.author,
|
|
69
|
+
description: module.documentModel.description || "",
|
|
70
|
+
specifications: module.documentModel.specifications,
|
|
71
|
+
}));
|
|
72
|
+
// Apply paging
|
|
73
|
+
const startIndex = paging ? parseInt(paging.cursor) || 0 : 0;
|
|
74
|
+
const limit = paging?.limit || filteredModels.length;
|
|
75
|
+
const pagedModels = filteredModels.slice(startIndex, startIndex + limit);
|
|
76
|
+
// Create paged results
|
|
77
|
+
const hasMore = startIndex + limit < filteredModels.length;
|
|
78
|
+
const nextCursor = hasMore ? String(startIndex + limit) : undefined;
|
|
79
|
+
// even thought this is currently synchronous, they could have passed in an already-aborted signal
|
|
80
|
+
if (signal?.aborted) {
|
|
81
|
+
throw new AbortError();
|
|
82
|
+
}
|
|
83
|
+
return Promise.resolve({
|
|
84
|
+
results: pagedModels,
|
|
85
|
+
options: paging || { cursor: "0", limit: filteredModels.length },
|
|
86
|
+
nextCursor,
|
|
87
|
+
next: hasMore
|
|
88
|
+
? () => this.getDocumentModels(namespace, { cursor: nextCursor, limit }, signal)
|
|
89
|
+
: undefined,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Retrieves a specific PHDocument by id
|
|
94
|
+
*/
|
|
95
|
+
async get(id, view, signal) {
|
|
96
|
+
const document = await this.documentStorage.get(id);
|
|
97
|
+
if (signal?.aborted) {
|
|
98
|
+
throw new AbortError();
|
|
99
|
+
}
|
|
100
|
+
const childIds = await this.documentStorage.getChildren(id);
|
|
101
|
+
if (signal?.aborted) {
|
|
102
|
+
throw new AbortError();
|
|
103
|
+
}
|
|
104
|
+
// Apply view filter - This will be removed when we pass the viewfilter along
|
|
105
|
+
// to the underlying store, but is here now for the interface.
|
|
106
|
+
for (const scope in document.state) {
|
|
107
|
+
if (!matchesScope(view, scope)) {
|
|
108
|
+
delete document.state[scope];
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
document,
|
|
113
|
+
childIds,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Retrieves a specific PHDocument by slug
|
|
118
|
+
*/
|
|
119
|
+
async getBySlug(slug, view, signal) {
|
|
120
|
+
// Use the storage layer to resolve slug to ID
|
|
121
|
+
let ids;
|
|
122
|
+
try {
|
|
123
|
+
ids = await this.documentStorage.resolveIds([slug], signal);
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
// If the error is from resolveIds (document not found), wrap it with our message
|
|
127
|
+
if (error instanceof Error && error.message.includes("not found")) {
|
|
128
|
+
throw new Error(`Document not found with slug: ${slug}`);
|
|
129
|
+
}
|
|
130
|
+
throw error;
|
|
131
|
+
}
|
|
132
|
+
if (ids.length === 0 || !ids[0]) {
|
|
133
|
+
throw new Error(`Document not found with slug: ${slug}`);
|
|
134
|
+
}
|
|
135
|
+
// Now get the document by its resolved ID
|
|
136
|
+
return await this.get(ids[0], view, signal);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Retrieves the operations for a document
|
|
140
|
+
*/
|
|
141
|
+
async getOperations(documentId, view, paging, signal) {
|
|
142
|
+
// Use storage directly to get the document
|
|
143
|
+
const document = await this.documentStorage.get(documentId);
|
|
144
|
+
if (signal?.aborted) {
|
|
145
|
+
throw new AbortError();
|
|
146
|
+
}
|
|
147
|
+
const operations = document.operations;
|
|
148
|
+
const result = {};
|
|
149
|
+
// apply view filter, per scope -- this will be removed when we pass the viewfilter along
|
|
150
|
+
// to the underlying store, but is here now for the interface.
|
|
151
|
+
for (const scope in operations) {
|
|
152
|
+
if (matchesScope(view, scope)) {
|
|
153
|
+
const scopeOperations = operations[scope];
|
|
154
|
+
// apply paging too
|
|
155
|
+
const startIndex = paging ? parseInt(paging.cursor) || 0 : 0;
|
|
156
|
+
const limit = paging?.limit || scopeOperations.length;
|
|
157
|
+
const pagedOperations = scopeOperations.slice(startIndex, startIndex + limit);
|
|
158
|
+
result[scope] = {
|
|
159
|
+
results: pagedOperations,
|
|
160
|
+
options: { cursor: String(startIndex + limit), limit },
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return Promise.resolve(result);
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Filters documents by criteria and returns a list of them
|
|
168
|
+
*/
|
|
169
|
+
async find(search, view, paging, signal) {
|
|
170
|
+
let results;
|
|
171
|
+
if (search.ids) {
|
|
172
|
+
if (search.slugs && search.slugs.length > 0) {
|
|
173
|
+
throw new Error("Cannot use both ids and slugs in the same search");
|
|
174
|
+
}
|
|
175
|
+
results = await this.findByIds(search.ids, view, paging, signal);
|
|
176
|
+
if (search.parentId) {
|
|
177
|
+
results = filterByParentId(results, search.parentId);
|
|
178
|
+
}
|
|
179
|
+
if (search.type) {
|
|
180
|
+
results = filterByType(results, search.type);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
else if (search.slugs) {
|
|
184
|
+
results = await this.findBySlugs(search.slugs, view, paging, signal);
|
|
185
|
+
if (search.parentId) {
|
|
186
|
+
results = filterByParentId(results, search.parentId);
|
|
187
|
+
}
|
|
188
|
+
if (search.type) {
|
|
189
|
+
results = filterByType(results, search.type);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
else if (search.parentId) {
|
|
193
|
+
results = await this.findByParentId(search.parentId, view, paging, signal);
|
|
194
|
+
if (search.type) {
|
|
195
|
+
results = filterByType(results, search.type);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
else if (search.type) {
|
|
199
|
+
results = await this.findByType(search.type, view, paging, signal);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
throw new Error("No search criteria provided");
|
|
203
|
+
}
|
|
204
|
+
if (signal?.aborted) {
|
|
205
|
+
throw new AbortError();
|
|
206
|
+
}
|
|
207
|
+
return results;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Creates a document
|
|
211
|
+
*/
|
|
212
|
+
async create(document, signal) {
|
|
213
|
+
try {
|
|
214
|
+
// BaseDocumentDriveServer uses addDocument, not createDocument
|
|
215
|
+
// addDocument adds an existing document to a drive
|
|
216
|
+
await this.driveServer.addDocument(document);
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
// TODO: Phase 4 - This will return a job that can be retried
|
|
220
|
+
return JobStatus.FAILED;
|
|
221
|
+
}
|
|
222
|
+
if (signal?.aborted) {
|
|
223
|
+
throw new AbortError();
|
|
224
|
+
}
|
|
225
|
+
// Return success status
|
|
226
|
+
// TODO: Phase 4 - This will return a job that goes through the queue
|
|
227
|
+
return JobStatus.COMPLETED;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Deletes a document
|
|
231
|
+
*/
|
|
232
|
+
async deleteDocument(id, propagate, signal) {
|
|
233
|
+
const jobId = uuidv4();
|
|
234
|
+
try {
|
|
235
|
+
// Delete document using drive server
|
|
236
|
+
await this.driveServer.deleteDocument(id);
|
|
237
|
+
// TODO: Implement cascade deletion when propagate mode is CASCADE
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
// TODO: Phase 4 - This will return a job that can be retried
|
|
241
|
+
return {
|
|
242
|
+
id: jobId,
|
|
243
|
+
status: JobStatus.FAILED,
|
|
244
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
if (signal?.aborted) {
|
|
248
|
+
throw new AbortError();
|
|
249
|
+
}
|
|
250
|
+
// Return success job info
|
|
251
|
+
// TODO: Phase 4 - This will return a job that goes through the queue
|
|
252
|
+
return {
|
|
253
|
+
id: jobId,
|
|
254
|
+
status: JobStatus.COMPLETED,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Applies a list of actions to a document
|
|
259
|
+
*/
|
|
260
|
+
async mutate(id, actions) {
|
|
261
|
+
// Ensure the job executor is running
|
|
262
|
+
await this.ensureJobExecutorRunning();
|
|
263
|
+
// Create jobs for each action/operation
|
|
264
|
+
const jobs = actions.map((action, index) => ({
|
|
265
|
+
id: uuidv4(),
|
|
266
|
+
documentId: id,
|
|
267
|
+
scope: action.scope || "global",
|
|
268
|
+
branch: "main", // Default to main branch
|
|
269
|
+
operation: {
|
|
270
|
+
index: index,
|
|
271
|
+
timestampUtcMs: String(action.timestampUtcMs || Date.now()),
|
|
272
|
+
hash: "", // Will be computed by the executor
|
|
273
|
+
skip: 0,
|
|
274
|
+
action: action,
|
|
275
|
+
},
|
|
276
|
+
createdAt: new Date().toISOString(),
|
|
277
|
+
maxRetries: 3,
|
|
278
|
+
}));
|
|
279
|
+
// Enqueue all jobs
|
|
280
|
+
for (const job of jobs) {
|
|
281
|
+
await this.queue.enqueue(job);
|
|
282
|
+
}
|
|
283
|
+
// Return job info for the batch (using the first job's ID as the batch ID)
|
|
284
|
+
const batchJobId = jobs.length > 0 ? jobs[0].id : uuidv4();
|
|
285
|
+
return {
|
|
286
|
+
id: batchJobId,
|
|
287
|
+
status: JobStatus.PENDING,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Adds multiple documents as children to another
|
|
292
|
+
*/
|
|
293
|
+
async addChildren(parentId, documentIds, view, signal) {
|
|
294
|
+
const jobId = uuidv4();
|
|
295
|
+
// Check abort signal before starting
|
|
296
|
+
if (signal?.aborted) {
|
|
297
|
+
throw new AbortError();
|
|
298
|
+
}
|
|
299
|
+
// TODO: Implement when drive server supports hierarchical documents
|
|
300
|
+
// For now, this is a placeholder implementation
|
|
301
|
+
// Verify parent exists
|
|
302
|
+
try {
|
|
303
|
+
await this.driveServer.getDocument(parentId);
|
|
304
|
+
}
|
|
305
|
+
catch (error) {
|
|
306
|
+
return {
|
|
307
|
+
id: jobId,
|
|
308
|
+
status: JobStatus.FAILED,
|
|
309
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
// Check abort signal after parent verification
|
|
313
|
+
if (signal?.aborted) {
|
|
314
|
+
throw new AbortError();
|
|
315
|
+
}
|
|
316
|
+
// Verify all children exist
|
|
317
|
+
for (const childId of documentIds) {
|
|
318
|
+
try {
|
|
319
|
+
await this.driveServer.getDocument(childId);
|
|
320
|
+
}
|
|
321
|
+
catch (error) {
|
|
322
|
+
return {
|
|
323
|
+
id: jobId,
|
|
324
|
+
status: JobStatus.FAILED,
|
|
325
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
// Check abort signal after each child verification
|
|
329
|
+
if (signal?.aborted) {
|
|
330
|
+
throw new AbortError();
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
// TODO: Actually establish parent-child relationships
|
|
334
|
+
// Return success job info
|
|
335
|
+
return {
|
|
336
|
+
id: jobId,
|
|
337
|
+
status: JobStatus.COMPLETED,
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Removes multiple documents as children from another
|
|
342
|
+
*/
|
|
343
|
+
async removeChildren(parentId, documentIds, view, signal) {
|
|
344
|
+
const jobId = uuidv4();
|
|
345
|
+
// Check abort signal before starting
|
|
346
|
+
if (signal?.aborted) {
|
|
347
|
+
throw new AbortError();
|
|
348
|
+
}
|
|
349
|
+
// TODO: Implement when drive server supports hierarchical documents
|
|
350
|
+
// For now, this is a placeholder implementation
|
|
351
|
+
// Verify parent exists
|
|
352
|
+
try {
|
|
353
|
+
await this.driveServer.getDocument(parentId);
|
|
354
|
+
}
|
|
355
|
+
catch (error) {
|
|
356
|
+
return {
|
|
357
|
+
id: jobId,
|
|
358
|
+
status: JobStatus.FAILED,
|
|
359
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
// Check abort signal after parent verification
|
|
363
|
+
if (signal?.aborted) {
|
|
364
|
+
throw new AbortError();
|
|
365
|
+
}
|
|
366
|
+
// TODO: Actually remove parent-child relationships
|
|
367
|
+
// Return success job info
|
|
368
|
+
return {
|
|
369
|
+
id: jobId,
|
|
370
|
+
status: JobStatus.COMPLETED,
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Retrieves the status of a job
|
|
375
|
+
*/
|
|
376
|
+
async getJobStatus(jobId, signal) {
|
|
377
|
+
// TODO: Phase 3 - Implement once IQueue and job tracking is in place
|
|
378
|
+
// For now, return a not found status
|
|
379
|
+
return {
|
|
380
|
+
id: jobId,
|
|
381
|
+
status: JobStatus.FAILED,
|
|
382
|
+
error: "Job tracking not yet implemented",
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Starts the job executor if not already running.
|
|
387
|
+
* Called automatically when the first job is enqueued.
|
|
388
|
+
*/
|
|
389
|
+
async ensureJobExecutorRunning() {
|
|
390
|
+
if (!this.jobExecutorStarted) {
|
|
391
|
+
await this.jobExecutor.start({
|
|
392
|
+
maxConcurrency: 5,
|
|
393
|
+
jobTimeout: 30000,
|
|
394
|
+
});
|
|
395
|
+
this.jobExecutorStarted = true;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Finds documents by their IDs
|
|
400
|
+
*/
|
|
401
|
+
async findByIds(ids, view, paging, signal) {
|
|
402
|
+
const documents = [];
|
|
403
|
+
// Fetch each document by ID using storage directly
|
|
404
|
+
for (const id of ids) {
|
|
405
|
+
if (signal?.aborted) {
|
|
406
|
+
throw new AbortError();
|
|
407
|
+
}
|
|
408
|
+
let document;
|
|
409
|
+
try {
|
|
410
|
+
document = await this.documentStorage.get(id);
|
|
411
|
+
}
|
|
412
|
+
catch {
|
|
413
|
+
// Skip documents that don't exist or can't be accessed
|
|
414
|
+
// This matches the behavior expected from a search operation
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
// Apply view filter - This will be removed when we pass the viewfilter along
|
|
418
|
+
// to the underlying store, but is here now for the interface.
|
|
419
|
+
for (const scope in document.state) {
|
|
420
|
+
if (!matchesScope(view, scope)) {
|
|
421
|
+
delete document.state[scope];
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
documents.push(document);
|
|
425
|
+
}
|
|
426
|
+
if (signal?.aborted) {
|
|
427
|
+
throw new AbortError();
|
|
428
|
+
}
|
|
429
|
+
// Apply paging
|
|
430
|
+
const startIndex = paging ? parseInt(paging.cursor) || 0 : 0;
|
|
431
|
+
const limit = paging?.limit || documents.length;
|
|
432
|
+
const pagedDocuments = documents.slice(startIndex, startIndex + limit);
|
|
433
|
+
// Create paged results
|
|
434
|
+
const hasMore = startIndex + limit < documents.length;
|
|
435
|
+
const nextCursor = hasMore ? String(startIndex + limit) : undefined;
|
|
436
|
+
return {
|
|
437
|
+
results: pagedDocuments,
|
|
438
|
+
options: paging || { cursor: "0", limit: documents.length },
|
|
439
|
+
nextCursor,
|
|
440
|
+
next: hasMore
|
|
441
|
+
? () => this.findByIds(ids, view, { cursor: nextCursor, limit }, signal)
|
|
442
|
+
: undefined,
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Finds documents by their slugs
|
|
447
|
+
*/
|
|
448
|
+
async findBySlugs(slugs, view, paging, signal) {
|
|
449
|
+
const documents = [];
|
|
450
|
+
// Use storage to resolve slugs to IDs
|
|
451
|
+
let ids;
|
|
452
|
+
try {
|
|
453
|
+
ids = await this.documentStorage.resolveIds(slugs, signal);
|
|
454
|
+
}
|
|
455
|
+
catch {
|
|
456
|
+
// If slug resolution fails, return empty results
|
|
457
|
+
// This matches the behavior expected from a search operation
|
|
458
|
+
ids = [];
|
|
459
|
+
}
|
|
460
|
+
// Fetch each document by resolved ID
|
|
461
|
+
for (const id of ids) {
|
|
462
|
+
if (signal?.aborted) {
|
|
463
|
+
throw new AbortError();
|
|
464
|
+
}
|
|
465
|
+
let document;
|
|
466
|
+
try {
|
|
467
|
+
document = await this.documentStorage.get(id);
|
|
468
|
+
}
|
|
469
|
+
catch {
|
|
470
|
+
// Skip documents that don't exist or can't be accessed
|
|
471
|
+
continue;
|
|
472
|
+
}
|
|
473
|
+
// Apply view filter - This will be removed when we pass the viewfilter along
|
|
474
|
+
// to the underlying store, but is here now for the interface.
|
|
475
|
+
for (const scope in document.state) {
|
|
476
|
+
if (!matchesScope(view, scope)) {
|
|
477
|
+
delete document.state[scope];
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
documents.push(document);
|
|
481
|
+
}
|
|
482
|
+
if (signal?.aborted) {
|
|
483
|
+
throw new AbortError();
|
|
484
|
+
}
|
|
485
|
+
// Apply paging - this will be removed when we pass the paging along
|
|
486
|
+
// to the underlying store, but is here now for the interface.
|
|
487
|
+
const startIndex = paging ? parseInt(paging.cursor) || 0 : 0;
|
|
488
|
+
const limit = paging?.limit || documents.length;
|
|
489
|
+
const pagedDocuments = documents.slice(startIndex, startIndex + limit);
|
|
490
|
+
// Create paged results
|
|
491
|
+
const hasMore = startIndex + limit < documents.length;
|
|
492
|
+
const nextCursor = hasMore ? String(startIndex + limit) : undefined;
|
|
493
|
+
return {
|
|
494
|
+
results: pagedDocuments,
|
|
495
|
+
options: paging || { cursor: "0", limit: documents.length },
|
|
496
|
+
nextCursor,
|
|
497
|
+
next: hasMore
|
|
498
|
+
? () => this.findBySlugs(slugs, view, { cursor: nextCursor, limit }, signal)
|
|
499
|
+
: undefined,
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Finds documents by parent ID
|
|
504
|
+
*/
|
|
505
|
+
async findByParentId(parentId, view, paging, signal) {
|
|
506
|
+
// Get child document IDs from storage
|
|
507
|
+
const childIds = await this.documentStorage.getChildren(parentId);
|
|
508
|
+
if (signal?.aborted) {
|
|
509
|
+
throw new AbortError();
|
|
510
|
+
}
|
|
511
|
+
const documents = [];
|
|
512
|
+
// Fetch each child document
|
|
513
|
+
for (const childId of childIds) {
|
|
514
|
+
if (signal?.aborted) {
|
|
515
|
+
throw new AbortError();
|
|
516
|
+
}
|
|
517
|
+
let document;
|
|
518
|
+
try {
|
|
519
|
+
document = await this.documentStorage.get(childId);
|
|
520
|
+
}
|
|
521
|
+
catch {
|
|
522
|
+
// Skip documents that don't exist or can't be accessed
|
|
523
|
+
// This matches the behavior expected from a search operation
|
|
524
|
+
continue;
|
|
525
|
+
}
|
|
526
|
+
// Apply view filter - This will be removed when we pass the viewfilter along
|
|
527
|
+
// to the underlying store, but is here now for the interface.
|
|
528
|
+
for (const scope in document.state) {
|
|
529
|
+
if (!matchesScope(view, scope)) {
|
|
530
|
+
delete document.state[scope];
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
documents.push(document);
|
|
534
|
+
}
|
|
535
|
+
if (signal?.aborted) {
|
|
536
|
+
throw new AbortError();
|
|
537
|
+
}
|
|
538
|
+
// Apply paging
|
|
539
|
+
const startIndex = paging ? parseInt(paging.cursor) || 0 : 0;
|
|
540
|
+
const limit = paging?.limit || documents.length;
|
|
541
|
+
const pagedDocuments = documents.slice(startIndex, startIndex + limit);
|
|
542
|
+
// Create paged results
|
|
543
|
+
const hasMore = startIndex + limit < documents.length;
|
|
544
|
+
const nextCursor = hasMore ? String(startIndex + limit) : undefined;
|
|
545
|
+
return {
|
|
546
|
+
results: pagedDocuments,
|
|
547
|
+
options: paging || { cursor: "0", limit: documents.length },
|
|
548
|
+
nextCursor,
|
|
549
|
+
next: hasMore
|
|
550
|
+
? () => this.findByParentId(parentId, view, { cursor: nextCursor, limit }, signal)
|
|
551
|
+
: undefined,
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Finds documents by type
|
|
556
|
+
*/
|
|
557
|
+
async findByType(type, view, paging, signal) {
|
|
558
|
+
const documents = [];
|
|
559
|
+
// Use storage's findByType method directly
|
|
560
|
+
const cursor = paging?.cursor;
|
|
561
|
+
const limit = paging?.limit || 100;
|
|
562
|
+
// Get document IDs of the specified type
|
|
563
|
+
const { documents: documentIds, nextCursor } = await this.documentStorage.findByType(type, limit, cursor);
|
|
564
|
+
if (signal?.aborted) {
|
|
565
|
+
throw new AbortError();
|
|
566
|
+
}
|
|
567
|
+
// Fetch each document by its ID
|
|
568
|
+
for (const documentId of documentIds) {
|
|
569
|
+
if (signal?.aborted) {
|
|
570
|
+
throw new AbortError();
|
|
571
|
+
}
|
|
572
|
+
let document;
|
|
573
|
+
try {
|
|
574
|
+
document = await this.documentStorage.get(documentId);
|
|
575
|
+
}
|
|
576
|
+
catch {
|
|
577
|
+
// Skip documents that can't be retrieved
|
|
578
|
+
continue;
|
|
579
|
+
}
|
|
580
|
+
// Apply view filter
|
|
581
|
+
for (const scope in document.state) {
|
|
582
|
+
if (!matchesScope(view, scope)) {
|
|
583
|
+
delete document.state[scope];
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
documents.push(document);
|
|
587
|
+
}
|
|
588
|
+
if (signal?.aborted) {
|
|
589
|
+
throw new AbortError();
|
|
590
|
+
}
|
|
591
|
+
// Results are already paged from the storage layer
|
|
592
|
+
return {
|
|
593
|
+
results: documents,
|
|
594
|
+
options: paging || { cursor: cursor || "0", limit },
|
|
595
|
+
nextCursor,
|
|
596
|
+
next: nextCursor
|
|
597
|
+
? async () => this.findByType(type, view, { cursor: nextCursor, limit }, signal)
|
|
598
|
+
: undefined,
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
//# sourceMappingURL=reactor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactor.js","sourceRoot":"","sources":["../../src/reactor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAQzD,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAMpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EACL,SAAS,GAQV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE5D;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,OAAO;IACV,WAAW,CAA0B;IACrC,eAAe,CAAmB;IAClC,cAAc,CAAiB;IAC/B,WAAW,CAA2B;IACtC,QAAQ,CAAY;IACpB,KAAK,CAAS;IACd,WAAW,CAAe;IAC1B,kBAAkB,GAAG,KAAK,CAAC;IAEnC,YACE,WAAoC,EACpC,eAAiC,EACjC,QAAmB,EACnB,KAAa,EACb,WAAyB;QAEzB,8BAA8B;QAC9B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,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UAAU;YACV,IAAI,EAAE,UAAU;gBACd,CAAC,CAAC,KAAK,IAAI,EAAE,CACT,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC;gBACtE,CAAC,CAAC,SAAS;SACd,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ShutdownStatus } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Factory method to create a ShutdownStatus object
|
|
4
|
+
*
|
|
5
|
+
* @param isShutdown - Initial shutdown state
|
|
6
|
+
* @returns A ShutdownStatus object with a getter for the shutdown state
|
|
7
|
+
*/
|
|
8
|
+
export declare function createShutdownStatus(isShutdown: boolean): ShutdownStatus;
|
|
9
|
+
/**
|
|
10
|
+
* Factory method to create a ShutdownStatus that can be updated
|
|
11
|
+
*
|
|
12
|
+
* @param initialState - Initial shutdown state (default: false)
|
|
13
|
+
* @returns A tuple of [ShutdownStatus, setter function]
|
|
14
|
+
*/
|
|
15
|
+
export declare function createMutableShutdownStatus(initialState?: boolean): [ShutdownStatus, (value: boolean) => void];
|
|
16
|
+
//# sourceMappingURL=factories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../../../src/shared/factories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,OAAO,GAAG,cAAc,CAQxE;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,YAAY,UAAQ,GACnB,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC,CAc5C"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Factory method to create a ShutdownStatus object
|
|
3
|
+
*
|
|
4
|
+
* @param isShutdown - Initial shutdown state
|
|
5
|
+
* @returns A ShutdownStatus object with a getter for the shutdown state
|
|
6
|
+
*/
|
|
7
|
+
export function createShutdownStatus(isShutdown) {
|
|
8
|
+
const shutdownState = isShutdown;
|
|
9
|
+
return {
|
|
10
|
+
get isShutdown() {
|
|
11
|
+
return shutdownState;
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Factory method to create a ShutdownStatus that can be updated
|
|
17
|
+
*
|
|
18
|
+
* @param initialState - Initial shutdown state (default: false)
|
|
19
|
+
* @returns A tuple of [ShutdownStatus, setter function]
|
|
20
|
+
*/
|
|
21
|
+
export function createMutableShutdownStatus(initialState = false) {
|
|
22
|
+
let shutdownState = initialState;
|
|
23
|
+
const status = {
|
|
24
|
+
get isShutdown() {
|
|
25
|
+
return shutdownState;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
const setShutdown = (value) => {
|
|
29
|
+
shutdownState = value;
|
|
30
|
+
};
|
|
31
|
+
return [status, setShutdown];
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=factories.js.map
|