@powerhousedao/reactor 6.0.2-staging.4 → 6.0.2-staging.5
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/index.d.ts +989 -868
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +279 -159
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
1
|
import { Action, CreateDocumentActionInput, DocumentModelModule, ISigner, Operation, OperationContext, OperationWithContext, OperationWithContext as OperationWithContext$1, PHDocument, PHDocumentState, SignatureVerificationHandler, UpgradeDocumentActionInput, UpgradeManifest, UpgradeReducer, UpgradeTransition, actions as documentActions } from "@powerhousedao/shared/document-model";
|
|
2
|
+
import { DocumentDriveDocument, DriveInput, FolderNode, Node } from "@powerhousedao/shared/document-drive";
|
|
2
3
|
import { ILogger } from "document-model";
|
|
3
4
|
import * as kysely from "kysely";
|
|
4
5
|
import { Generated, Insertable, Kysely, Transaction } from "kysely";
|
|
5
6
|
import { IProcessor, IProcessorHostModule, IProcessorManager, IProcessorManager as IProcessorManager$1, IRelationalDb, ProcessorApp, ProcessorFactory, ProcessorFactory as ProcessorFactory$1, ProcessorFactoryBuilder, ProcessorFilter, ProcessorRecord, ProcessorStatus, RelationalDbProcessor, TrackedProcessor, TrackedProcessor as TrackedProcessor$1, createRelationalDb } from "@powerhousedao/shared/processors";
|
|
6
7
|
|
|
8
|
+
//#region src/attachments/types.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Content hash of the attachment data. This is the primary identifier.
|
|
11
|
+
* Format is algorithm-dependent, e.g. SHA-256 hex.
|
|
12
|
+
*/
|
|
13
|
+
type AttachmentHash = string;
|
|
14
|
+
/**
|
|
15
|
+
* A reference to an attachment, used in document state and action inputs.
|
|
16
|
+
* Format: `attachment://v<version>:<hash>`
|
|
17
|
+
*
|
|
18
|
+
* The version prefix allows changing the hash algorithm, encoding, or
|
|
19
|
+
* length without leaking implementation details into the ref format.
|
|
20
|
+
* Version 1 is defined as SHA-256 hex.
|
|
21
|
+
*
|
|
22
|
+
* Using the hash as the ref makes attachments content-addressable:
|
|
23
|
+
* any peer that has the bytes for a given hash can serve the attachment.
|
|
24
|
+
*/
|
|
25
|
+
type AttachmentRef = `attachment://v${number}:${string}`;
|
|
26
|
+
//#endregion
|
|
7
27
|
//#region src/actions/index.d.ts
|
|
8
28
|
/**
|
|
9
29
|
* Creates a CREATE_DOCUMENT action for document creation.
|
|
@@ -1247,196 +1267,734 @@ interface IEventBus {
|
|
|
1247
1267
|
emit(type: number, data: any): Promise<void>;
|
|
1248
1268
|
}
|
|
1249
1269
|
//#endregion
|
|
1250
|
-
//#region src/
|
|
1251
|
-
|
|
1252
|
-
* Represents the result of a job execution
|
|
1253
|
-
*/
|
|
1254
|
-
type JobResult = {
|
|
1255
|
-
/** The job that was executed */job: Job; /** Whether the job executed successfully */
|
|
1256
|
-
success: boolean; /** Error if the job failed */
|
|
1257
|
-
error?: Error; /** The operations generated from the actions (if successful) */
|
|
1258
|
-
operations?: Operation[];
|
|
1270
|
+
//#region src/shared/awaiter.d.ts
|
|
1271
|
+
interface IJobAwaiter {
|
|
1259
1272
|
/**
|
|
1260
|
-
*
|
|
1261
|
-
*
|
|
1273
|
+
* Waits for a job to complete: turns a job into a promise.
|
|
1274
|
+
*
|
|
1275
|
+
* @param jobId - The job id or job object
|
|
1276
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1277
|
+
* @returns The result of the job
|
|
1262
1278
|
*/
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
* Configuration options for the job executor
|
|
1270
|
-
*/
|
|
1271
|
-
type JobExecutorConfig = {
|
|
1272
|
-
/** Maximum number of conflicting operations to skip when reshuffling. */maxSkipThreshold?: number; /** Maximum number of concurrent jobs to execute */
|
|
1273
|
-
maxConcurrency?: number; /** Maximum time in milliseconds a job can run before being considered timed out */
|
|
1274
|
-
jobTimeoutMs?: number; /** Base delay in milliseconds for exponential backoff retries */
|
|
1275
|
-
retryBaseDelayMs?: number; /** Maximum delay in milliseconds for exponential backoff retries */
|
|
1276
|
-
retryMaxDelayMs?: number;
|
|
1277
|
-
/** Maximum elapsed milliseconds before yielding to the main thread between actions.
|
|
1278
|
-
* Keeps the UI responsive when processing large batches. */
|
|
1279
|
-
yieldDeadlineMs?: number;
|
|
1280
|
-
};
|
|
1281
|
-
/**
|
|
1282
|
-
* Event types for the job executor
|
|
1283
|
-
*/
|
|
1284
|
-
declare const JobExecutorEventTypes: {
|
|
1285
|
-
readonly JOB_STARTED: 20000;
|
|
1286
|
-
readonly JOB_COMPLETED: 20001;
|
|
1287
|
-
readonly JOB_FAILED: 20002;
|
|
1288
|
-
readonly EXECUTOR_STARTED: 20003;
|
|
1289
|
-
readonly EXECUTOR_STOPPED: 20004;
|
|
1290
|
-
};
|
|
1291
|
-
/**
|
|
1292
|
-
* Event data for job execution events
|
|
1293
|
-
*/
|
|
1294
|
-
type JobStartedEvent = {
|
|
1295
|
-
job: Job;
|
|
1296
|
-
startedAt: string;
|
|
1297
|
-
};
|
|
1298
|
-
type JobCompletedEvent = {
|
|
1299
|
-
job: Job;
|
|
1300
|
-
result: JobResult;
|
|
1301
|
-
};
|
|
1302
|
-
type JobFailedEvent = {
|
|
1303
|
-
job: Job;
|
|
1304
|
-
error: string;
|
|
1305
|
-
willRetry: boolean;
|
|
1306
|
-
retryCount: number;
|
|
1307
|
-
};
|
|
1308
|
-
type ExecutorStartedEvent = {
|
|
1309
|
-
config: JobExecutorConfig;
|
|
1310
|
-
startedAt: string;
|
|
1311
|
-
};
|
|
1312
|
-
type ExecutorStoppedEvent = {
|
|
1313
|
-
stoppedAt: string;
|
|
1314
|
-
graceful: boolean;
|
|
1315
|
-
};
|
|
1279
|
+
waitForJob(jobId: string, signal?: AbortSignal): Promise<JobInfo>;
|
|
1280
|
+
/**
|
|
1281
|
+
* Shuts down the job awaiter. This will synchronously reject all pending jobs.
|
|
1282
|
+
*/
|
|
1283
|
+
shutdown(): void;
|
|
1284
|
+
}
|
|
1316
1285
|
/**
|
|
1317
|
-
*
|
|
1286
|
+
* Event-driven implementation of IJobAwaiter.
|
|
1287
|
+
* Subscribes to operation events to detect job completion without polling.
|
|
1318
1288
|
*/
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1289
|
+
declare class JobAwaiter implements IJobAwaiter {
|
|
1290
|
+
private eventBus;
|
|
1291
|
+
private getJobStatus;
|
|
1292
|
+
private pendingJobs;
|
|
1293
|
+
private unsubscribers;
|
|
1294
|
+
constructor(eventBus: IEventBus, getJobStatus: (jobId: string, signal?: AbortSignal) => Promise<JobInfo>);
|
|
1295
|
+
private subscribeToEvents;
|
|
1296
|
+
shutdown(): void;
|
|
1297
|
+
waitForJob(jobId: string, signal?: AbortSignal): Promise<JobInfo>;
|
|
1298
|
+
private handleWriteReady;
|
|
1299
|
+
private handleReadReady;
|
|
1300
|
+
private handleJobFailed;
|
|
1301
|
+
private checkAndResolveWaiters;
|
|
1302
|
+
}
|
|
1325
1303
|
//#endregion
|
|
1326
|
-
//#region src/
|
|
1304
|
+
//#region src/subs/types.d.ts
|
|
1327
1305
|
/**
|
|
1328
|
-
*
|
|
1329
|
-
* A JobExecutor simply takes a job and executes it - nothing more.
|
|
1306
|
+
* Error handler for subscription callback errors
|
|
1330
1307
|
*/
|
|
1331
|
-
interface
|
|
1308
|
+
interface ISubscriptionErrorHandler {
|
|
1332
1309
|
/**
|
|
1333
|
-
*
|
|
1334
|
-
* @param
|
|
1335
|
-
* @
|
|
1310
|
+
* Called when a subscription callback throws an error
|
|
1311
|
+
* @param error - The error that was thrown
|
|
1312
|
+
* @param context - Context about which subscription failed
|
|
1336
1313
|
*/
|
|
1337
|
-
|
|
1314
|
+
handleError(error: unknown, context: SubscriptionErrorContext): void;
|
|
1338
1315
|
}
|
|
1339
1316
|
/**
|
|
1340
|
-
*
|
|
1341
|
-
* Listens for 'jobAvailable' events from the event bus, pulls jobs from the queue,
|
|
1342
|
-
* and coordinates the distribution of jobs across multiple executor instances.
|
|
1317
|
+
* Context information about a subscription error
|
|
1343
1318
|
*/
|
|
1344
|
-
interface
|
|
1319
|
+
interface SubscriptionErrorContext {
|
|
1320
|
+
/** The type of event that was being processed */
|
|
1321
|
+
eventType: "created" | "deleted" | "updated" | "relationshipChanged";
|
|
1322
|
+
/** The subscription ID that failed */
|
|
1323
|
+
subscriptionId: string;
|
|
1324
|
+
/** Optional additional data about the event */
|
|
1325
|
+
eventData?: unknown;
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* Interface for subscribing to document events in the reactor.
|
|
1329
|
+
*/
|
|
1330
|
+
interface IReactorSubscriptionManager {
|
|
1345
1331
|
/**
|
|
1346
|
-
*
|
|
1347
|
-
* Begins listening for 'jobAvailable' events and dispatching to executors.
|
|
1332
|
+
* Subscribes to document creation events
|
|
1348
1333
|
*
|
|
1349
|
-
* @param
|
|
1350
|
-
* @
|
|
1334
|
+
* @param callback - Function called when documents are created
|
|
1335
|
+
* @param search - Optional search filter to limit which documents trigger events
|
|
1336
|
+
* @param view - Optional filter containing branch and scopes information
|
|
1337
|
+
* @returns A function that unsubscribes from the events
|
|
1351
1338
|
*/
|
|
1352
|
-
|
|
1339
|
+
onDocumentCreated(callback: (result: PagedResults<string>) => void, search?: SearchFilter): () => void;
|
|
1353
1340
|
/**
|
|
1354
|
-
*
|
|
1341
|
+
* Subscribes to document deletion events
|
|
1355
1342
|
*
|
|
1356
|
-
* @param
|
|
1357
|
-
* @
|
|
1343
|
+
* @param callback - Function called when documents are deleted
|
|
1344
|
+
* @param search - Optional search filter to limit which documents trigger events
|
|
1345
|
+
* @returns A function that unsubscribes from the events
|
|
1358
1346
|
*/
|
|
1359
|
-
|
|
1347
|
+
onDocumentDeleted(callback: (documentIds: string[]) => void, search?: SearchFilter): () => void;
|
|
1360
1348
|
/**
|
|
1361
|
-
*
|
|
1349
|
+
* Subscribes to document state updates
|
|
1362
1350
|
*
|
|
1363
|
-
* @
|
|
1351
|
+
* @param callback - Function called when documents are updated
|
|
1352
|
+
* @param search - Optional search filter to limit which documents trigger events
|
|
1353
|
+
* @param view - Optional filter containing branch and scopes information
|
|
1354
|
+
* @returns A function that unsubscribes from the events
|
|
1364
1355
|
*/
|
|
1365
|
-
|
|
1356
|
+
onDocumentStateUpdated(callback: (result: PagedResults<PHDocument>) => void, search?: SearchFilter, view?: ViewFilter): () => void;
|
|
1366
1357
|
/**
|
|
1367
|
-
*
|
|
1358
|
+
* Subscribes to parent-child relationship change events
|
|
1368
1359
|
*
|
|
1369
|
-
* @
|
|
1360
|
+
* @param callback - Function called when parent-child relationships change
|
|
1361
|
+
* @param search - Optional search filter to limit which documents trigger events
|
|
1362
|
+
* @returns A function that unsubscribes from the events
|
|
1370
1363
|
*/
|
|
1371
|
-
|
|
1364
|
+
onRelationshipChanged(callback: (parentId: string, childId: string, changeType: RelationshipChangeType) => void, search?: SearchFilter): () => void;
|
|
1372
1365
|
}
|
|
1373
1366
|
//#endregion
|
|
1374
|
-
//#region src/
|
|
1367
|
+
//#region src/client/types.d.ts
|
|
1375
1368
|
/**
|
|
1376
|
-
*
|
|
1377
|
-
* Maintains job state throughout execution: PENDING → RUNNING → COMPLETED/FAILED.
|
|
1369
|
+
* Describes the types of document changes that can occur.
|
|
1378
1370
|
*/
|
|
1379
|
-
|
|
1371
|
+
declare enum DocumentChangeType {
|
|
1372
|
+
Created = "created",
|
|
1373
|
+
Deleted = "deleted",
|
|
1374
|
+
Updated = "updated",
|
|
1375
|
+
ParentAdded = "parent_added",
|
|
1376
|
+
ParentRemoved = "parent_removed",
|
|
1377
|
+
ChildAdded = "child_added",
|
|
1378
|
+
ChildRemoved = "child_removed"
|
|
1379
|
+
}
|
|
1380
|
+
/**
|
|
1381
|
+
* Represents a change event for documents.
|
|
1382
|
+
*/
|
|
1383
|
+
type DocumentChangeEvent = {
|
|
1384
|
+
type: DocumentChangeType;
|
|
1385
|
+
documents: PHDocument[];
|
|
1386
|
+
context?: {
|
|
1387
|
+
parentId?: string;
|
|
1388
|
+
childId?: string;
|
|
1389
|
+
};
|
|
1390
|
+
};
|
|
1391
|
+
/**
|
|
1392
|
+
* Options for creating an empty document.
|
|
1393
|
+
*/
|
|
1394
|
+
type CreateDocumentOptions = {
|
|
1395
|
+
/** Optional "id" or "slug" of parent document */parentIdentifier?: string; /** Optional version of the document model to use (defaults to latest) */
|
|
1396
|
+
documentModelVersion?: number;
|
|
1397
|
+
};
|
|
1398
|
+
/**
|
|
1399
|
+
* Drive-aware operations grouped under `client.drives`.
|
|
1400
|
+
*
|
|
1401
|
+
* These methods orchestrate the multi-action, multi-document choreography
|
|
1402
|
+
* required to keep a drive's `state.global.nodes` array consistent with the
|
|
1403
|
+
* relationship index and the underlying documents. Use the flat
|
|
1404
|
+
* `IReactorClient` primitives (`get`, `execute`, `find`) for everything that
|
|
1405
|
+
* is not drive-aware.
|
|
1406
|
+
*/
|
|
1407
|
+
interface IDriveClient {
|
|
1380
1408
|
/**
|
|
1381
|
-
*
|
|
1382
|
-
*
|
|
1383
|
-
* @param jobInfo - The job information to register
|
|
1409
|
+
* Creates a new drive document and waits for completion.
|
|
1384
1410
|
*/
|
|
1385
|
-
|
|
1411
|
+
create(input: DriveInput, signal?: AbortSignal): Promise<DocumentDriveDocument>;
|
|
1386
1412
|
/**
|
|
1387
|
-
*
|
|
1413
|
+
* Adds a document to a drive as a single batched operation.
|
|
1388
1414
|
*
|
|
1389
|
-
*
|
|
1415
|
+
* Issues CREATE_DOCUMENT, UPGRADE_DOCUMENT, ADD_RELATIONSHIP on the new
|
|
1416
|
+
* document and ADD_FILE on the drive in a single dependent batch.
|
|
1390
1417
|
*/
|
|
1391
|
-
|
|
1418
|
+
addFile<TDocument extends PHDocument = PHDocument>(driveIdentifier: string, document: PHDocument, parentFolder?: string, signal?: AbortSignal): Promise<TDocument>;
|
|
1392
1419
|
/**
|
|
1393
|
-
*
|
|
1394
|
-
*
|
|
1395
|
-
* @param jobId - The job ID to mark as failed
|
|
1396
|
-
* @param error - Error information including message and stack trace
|
|
1397
|
-
* @param job - Optional full job object for debugging purposes
|
|
1420
|
+
* Adds a folder node to a drive.
|
|
1398
1421
|
*/
|
|
1399
|
-
|
|
1422
|
+
addFolder(driveIdentifier: string, name: string, parentFolder?: string, signal?: AbortSignal): Promise<FolderNode>;
|
|
1400
1423
|
/**
|
|
1401
|
-
*
|
|
1402
|
-
*
|
|
1403
|
-
* @param jobId - The job ID to query
|
|
1404
|
-
* @returns The job information, or null if the job is not found
|
|
1424
|
+
* Removes a node from a drive. Folder nodes cascade: descendant file
|
|
1425
|
+
* documents are deleted first, then the folder node entry itself.
|
|
1405
1426
|
*/
|
|
1406
|
-
|
|
1427
|
+
removeNode(driveIdentifier: string, nodeId: string, signal?: AbortSignal): Promise<void>;
|
|
1407
1428
|
/**
|
|
1408
|
-
*
|
|
1409
|
-
*
|
|
1429
|
+
* Renames a node. Updates both the underlying document header and the
|
|
1430
|
+
* drive's node entry.
|
|
1410
1431
|
*/
|
|
1411
|
-
|
|
1412
|
-
}
|
|
1413
|
-
//#endregion
|
|
1414
|
-
//#region src/queue/interfaces.d.ts
|
|
1415
|
-
/**
|
|
1416
|
-
* Interface for a job queue that manages write operations.
|
|
1417
|
-
* Internally organizes jobs by documentId, scope, and branch to ensure proper ordering.
|
|
1418
|
-
* Emits events to the event bus when new jobs are available for consumption.
|
|
1419
|
-
*/
|
|
1420
|
-
interface IQueue {
|
|
1432
|
+
renameNode(driveIdentifier: string, nodeId: string, name: string, signal?: AbortSignal): Promise<Node>;
|
|
1421
1433
|
/**
|
|
1422
|
-
*
|
|
1423
|
-
*
|
|
1424
|
-
* Emits a 'jobAvailable' event to the event bus when the job is queued.
|
|
1425
|
-
* @param job - The job to add to the queue
|
|
1426
|
-
* @returns Promise that resolves when the job is queued
|
|
1434
|
+
* Moves a node to a different parent folder within the same drive.
|
|
1435
|
+
* Pass `undefined` to move the node to the drive root.
|
|
1427
1436
|
*/
|
|
1428
|
-
|
|
1437
|
+
moveNode(driveIdentifier: string, srcNodeId: string, targetParentFolderId: string | undefined, signal?: AbortSignal): Promise<DocumentDriveDocument>;
|
|
1429
1438
|
/**
|
|
1430
|
-
*
|
|
1431
|
-
*
|
|
1432
|
-
* @param scope - The scope to get jobs for
|
|
1433
|
-
* @param branch - The branch to get jobs for
|
|
1434
|
-
* @param signal - Optional abort signal to cancel the request
|
|
1435
|
-
* @returns Promise that resolves to the next job execution handle or null if no jobs available
|
|
1439
|
+
* Copies a node (and its subtree, if it is a folder) within a drive.
|
|
1440
|
+
* Each copied file gets a new id and a duplicated document.
|
|
1436
1441
|
*/
|
|
1437
|
-
|
|
1442
|
+
copyNode(driveIdentifier: string, srcNodeId: string, targetParentFolderId: string | undefined, signal?: AbortSignal): Promise<DocumentDriveDocument>;
|
|
1438
1443
|
/**
|
|
1439
|
-
*
|
|
1444
|
+
* Returns a single node from the drive's `state.global.nodes` array.
|
|
1445
|
+
*/
|
|
1446
|
+
getNode(driveIdentifier: string, nodeId: string, signal?: AbortSignal): Promise<Node>;
|
|
1447
|
+
/**
|
|
1448
|
+
* Returns nodes in the drive, optionally filtered to a single parent
|
|
1449
|
+
* folder. Pass `null` to list root-level nodes only.
|
|
1450
|
+
*/
|
|
1451
|
+
listNodes(driveIdentifier: string, parentFolder?: string | null, signal?: AbortSignal): Promise<Node[]>;
|
|
1452
|
+
}
|
|
1453
|
+
/**
|
|
1454
|
+
* The ReactorClient interface that wraps lower-level APIs to provide
|
|
1455
|
+
* a simpler interface for document operations.
|
|
1456
|
+
*
|
|
1457
|
+
* Features:
|
|
1458
|
+
* - Wraps Jobs with Promises for easier async handling
|
|
1459
|
+
* - Manages signing of submitted Action objects
|
|
1460
|
+
* - Provides quality-of-life functions for common tasks
|
|
1461
|
+
* - Wraps subscription interface with ViewFilters
|
|
1462
|
+
*/
|
|
1463
|
+
interface IReactorClient {
|
|
1464
|
+
/**
|
|
1465
|
+
* Drive-aware operations. See {@link IDriveClient}.
|
|
1466
|
+
*/
|
|
1467
|
+
readonly drives: IDriveClient;
|
|
1468
|
+
/**
|
|
1469
|
+
* Retrieves a list of document model modules.
|
|
1470
|
+
*
|
|
1471
|
+
* @param namespace - Optional namespace like "powerhouse" or "sky", defaults to ""
|
|
1472
|
+
* @param paging - Optional pagination options
|
|
1473
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1474
|
+
* @returns List of document model modules
|
|
1475
|
+
*/
|
|
1476
|
+
getDocumentModelModules(namespace?: string, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<DocumentModelModule>>;
|
|
1477
|
+
/**
|
|
1478
|
+
* Retrieves a specific document model module by document type.
|
|
1479
|
+
*
|
|
1480
|
+
* @param documentType - The document type identifier
|
|
1481
|
+
* @returns The document model module
|
|
1482
|
+
*/
|
|
1483
|
+
getDocumentModelModule(documentType: string): Promise<DocumentModelModule<any>>;
|
|
1484
|
+
/**
|
|
1485
|
+
* Retrieves a specific document by identifier (either id or slug).
|
|
1486
|
+
*
|
|
1487
|
+
* @param identifier - Required, this is the document id or slug
|
|
1488
|
+
* @param view - Optional filter containing branch and scopes information
|
|
1489
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1490
|
+
* @returns The up-to-date PHDocument with scopes and list of child document ids
|
|
1491
|
+
*/
|
|
1492
|
+
get<TDocument extends PHDocument>(identifier: string, view?: ViewFilter, signal?: AbortSignal): Promise<TDocument>;
|
|
1493
|
+
/**
|
|
1494
|
+
* Retrieves operations for a document.
|
|
1495
|
+
*
|
|
1496
|
+
* @param documentIdentifier - Required, this is either a document "id" field or a "slug"
|
|
1497
|
+
* @param view - Optional filter containing branch and scopes information
|
|
1498
|
+
* @param filter - Optional filter for actionTypes, timestamps, and revision
|
|
1499
|
+
* @param paging - Optional pagination options
|
|
1500
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1501
|
+
* @returns Paginated list of operations
|
|
1502
|
+
*/
|
|
1503
|
+
getOperations(documentIdentifier: string, view?: ViewFilter, filter?: OperationFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<Operation>>;
|
|
1504
|
+
/**
|
|
1505
|
+
* Retrieves outgoing relationships of a given type from a source document.
|
|
1506
|
+
*
|
|
1507
|
+
* @param sourceIdentifier - Required, this is either a document "id" field or a "slug"
|
|
1508
|
+
* @param relationshipType - The relationship type to filter by
|
|
1509
|
+
* @param view - Optional filter containing branch and scopes information
|
|
1510
|
+
* @param paging - Optional pagination options
|
|
1511
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1512
|
+
* @returns The target documents and paging cursor
|
|
1513
|
+
*/
|
|
1514
|
+
getOutgoingRelationships(sourceIdentifier: string, relationshipType: string, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
|
|
1515
|
+
/**
|
|
1516
|
+
* Retrieves incoming relationships of a given type to a target document.
|
|
1517
|
+
*
|
|
1518
|
+
* @param targetIdentifier - Required, this is either a document "id" field or a "slug"
|
|
1519
|
+
* @param relationshipType - The relationship type to filter by
|
|
1520
|
+
* @param view - Optional filter containing branch and scopes information
|
|
1521
|
+
* @param paging - Optional pagination options
|
|
1522
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1523
|
+
* @returns The source documents and paging cursor
|
|
1524
|
+
*/
|
|
1525
|
+
getIncomingRelationships(targetIdentifier: string, relationshipType: string, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
|
|
1526
|
+
/**
|
|
1527
|
+
* Filters documents by criteria and returns a list of them
|
|
1528
|
+
*
|
|
1529
|
+
* @param search - Search filter options (type, parentId, identifiers)
|
|
1530
|
+
* @param view - Optional filter containing branch and scopes information
|
|
1531
|
+
* @param paging - Optional pagination options
|
|
1532
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1533
|
+
* @returns List of documents matching criteria and pagination cursor
|
|
1534
|
+
*/
|
|
1535
|
+
find(search: SearchFilter, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
|
|
1536
|
+
/**
|
|
1537
|
+
* Creates a document and waits for completion
|
|
1538
|
+
*
|
|
1539
|
+
* @param document - Document with optional id, slug, parent, model type, and initial state
|
|
1540
|
+
* @param parentIdentifier - Optional "id" or "slug" of parent document
|
|
1541
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1542
|
+
* @returns The created document
|
|
1543
|
+
*/
|
|
1544
|
+
create<TDocument extends PHDocument = PHDocument>(document: PHDocument, parentIdentifier?: string, signal?: AbortSignal): Promise<TDocument>;
|
|
1545
|
+
/**
|
|
1546
|
+
* Creates an empty document and waits for completion
|
|
1547
|
+
*
|
|
1548
|
+
* @param documentModelType - Type of document to create
|
|
1549
|
+
* @param options - Optional creation options (parentIdentifier, documentModelVersion)
|
|
1550
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1551
|
+
*/
|
|
1552
|
+
createEmpty<TDocument extends PHDocument>(documentModelType: string, options?: CreateDocumentOptions, signal?: AbortSignal): Promise<TDocument>;
|
|
1553
|
+
/**
|
|
1554
|
+
* Creates an empty document in a drive as a single batched operation.
|
|
1555
|
+
* This is more efficient than createEmpty + addFile as it batches all
|
|
1556
|
+
* actions into dependent jobs and waits for them to complete together.
|
|
1557
|
+
*
|
|
1558
|
+
* @deprecated Use {@link IDriveClient.addFile} via `client.drives.addFile`
|
|
1559
|
+
* instead. This method will be removed in a future release.
|
|
1560
|
+
* @param driveId - The drive document id or slug
|
|
1561
|
+
* @param document - The document to create
|
|
1562
|
+
* @param parentFolder - Optional folder id within the drive
|
|
1563
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1564
|
+
* @returns The created document
|
|
1565
|
+
*/
|
|
1566
|
+
createDocumentInDrive<TDocument extends PHDocument>(driveId: string, document: PHDocument, parentFolder?: string, signal?: AbortSignal): Promise<TDocument>;
|
|
1567
|
+
/**
|
|
1568
|
+
* Applies a list of actions to a document and waits for completion
|
|
1569
|
+
*
|
|
1570
|
+
* @param documentIdentifier - Target document id or slug
|
|
1571
|
+
* @param branch - Branch to apply actions to
|
|
1572
|
+
* @param actions - List of actions to apply
|
|
1573
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1574
|
+
* @returns The updated document
|
|
1575
|
+
*/
|
|
1576
|
+
execute<TDocument extends PHDocument>(documentIdentifier: string, branch: string, actions: Action[], signal?: AbortSignal): Promise<TDocument>;
|
|
1577
|
+
/**
|
|
1578
|
+
* Submits a list of actions to a document
|
|
1579
|
+
*
|
|
1580
|
+
* @param documentIdentifier - Target document id or slug
|
|
1581
|
+
* @param branch - Branch to apply actions to
|
|
1582
|
+
* @param actions - List of actions to apply
|
|
1583
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1584
|
+
* @returns The job
|
|
1585
|
+
*/
|
|
1586
|
+
executeAsync(documentIdentifier: string, branch: string, actions: Action[], signal?: AbortSignal): Promise<JobInfo>;
|
|
1587
|
+
/**
|
|
1588
|
+
* Renames a document and waits for completion
|
|
1589
|
+
*
|
|
1590
|
+
* @param documentIdentifier - Target document id or slug
|
|
1591
|
+
* @param name - The new name of the document
|
|
1592
|
+
* @param branch - Optional branch to rename the document, defaults to "main"
|
|
1593
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1594
|
+
* @returns The updated document.
|
|
1595
|
+
*/
|
|
1596
|
+
rename(documentIdentifier: string, name: string, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
|
|
1597
|
+
/**
|
|
1598
|
+
* Adds a relationship between two documents and waits for completion.
|
|
1599
|
+
*
|
|
1600
|
+
* @param sourceIdentifier - Source document id or slug
|
|
1601
|
+
* @param targetIdentifier - Target document id or slug
|
|
1602
|
+
* @param relationshipType - Relationship type identifier
|
|
1603
|
+
* @param branch - Optional branch to add the relationship to, defaults to "main"
|
|
1604
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1605
|
+
* @returns The updated source document
|
|
1606
|
+
*/
|
|
1607
|
+
addRelationship(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
|
|
1608
|
+
/**
|
|
1609
|
+
* Removes a relationship between two documents and waits for completion.
|
|
1610
|
+
*
|
|
1611
|
+
* @param sourceIdentifier - Source document id or slug
|
|
1612
|
+
* @param targetIdentifier - Target document id or slug
|
|
1613
|
+
* @param relationshipType - Relationship type identifier
|
|
1614
|
+
* @param branch - Optional branch to remove the relationship from, defaults to "main"
|
|
1615
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1616
|
+
* @returns The updated source document
|
|
1617
|
+
*/
|
|
1618
|
+
removeRelationship(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
|
|
1619
|
+
/**
|
|
1620
|
+
* Moves a relationship from one source document to another and waits for completion.
|
|
1621
|
+
*
|
|
1622
|
+
* @param sourceParentIdentifier - Source parent document id or slug
|
|
1623
|
+
* @param targetParentIdentifier - Target parent document id or slug
|
|
1624
|
+
* @param targetIdentifier - The target document id or slug
|
|
1625
|
+
* @param relationshipType - Relationship type identifier
|
|
1626
|
+
* @param branch - Optional branch to apply the move to, defaults to "main"
|
|
1627
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1628
|
+
* @returns The updated source and target documents
|
|
1629
|
+
*/
|
|
1630
|
+
moveRelationship(sourceParentIdentifier: string, targetParentIdentifier: string, targetIdentifier: string, relationshipType: string, branch?: string, signal?: AbortSignal): Promise<{
|
|
1631
|
+
source: PHDocument;
|
|
1632
|
+
target: PHDocument;
|
|
1633
|
+
}>;
|
|
1634
|
+
/**
|
|
1635
|
+
* Deletes a document and waits for completion
|
|
1636
|
+
*
|
|
1637
|
+
* @param identifier - Document identifier (id or slug)
|
|
1638
|
+
* @param propagate - Optional mode for handling children, CASCADE deletes child documents
|
|
1639
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1640
|
+
* @returns a promise, resolving on deletion confirmation
|
|
1641
|
+
*/
|
|
1642
|
+
deleteDocument(identifier: string, propagate?: PropagationMode, signal?: AbortSignal): Promise<void>;
|
|
1643
|
+
/**
|
|
1644
|
+
* Deletes documents and waits for completion
|
|
1645
|
+
*
|
|
1646
|
+
* @param identifiers - Document identifiers (ids or slugs)
|
|
1647
|
+
* @param propagate - Optional mode for handling children, CASCADE deletes child documents
|
|
1648
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1649
|
+
* @returns a promise, resolving on deletion confirmation
|
|
1650
|
+
*/
|
|
1651
|
+
deleteDocuments(identifiers: string[], propagate?: PropagationMode, signal?: AbortSignal): Promise<void>;
|
|
1652
|
+
/**
|
|
1653
|
+
* Loads multiple batches of pre-existing operations across documents with dependency management.
|
|
1654
|
+
* Waits for all jobs to complete.
|
|
1655
|
+
*
|
|
1656
|
+
* @param request - Batch load request containing jobs with dependencies
|
|
1657
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1658
|
+
* @returns Map of job keys to completed job information
|
|
1659
|
+
*/
|
|
1660
|
+
loadBatch(request: BatchLoadRequest, signal?: AbortSignal): Promise<BatchLoadResult>;
|
|
1661
|
+
/**
|
|
1662
|
+
* Retrieves the status of a job
|
|
1663
|
+
*
|
|
1664
|
+
* @param jobId - The job id
|
|
1665
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1666
|
+
* @returns The job status
|
|
1667
|
+
*/
|
|
1668
|
+
getJobStatus(jobId: string, signal?: AbortSignal): Promise<JobInfo>;
|
|
1669
|
+
/**
|
|
1670
|
+
* Waits for a job to complete
|
|
1671
|
+
*
|
|
1672
|
+
* @param jobId - The job id or job object
|
|
1673
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1674
|
+
* @returns The result of the job
|
|
1675
|
+
*/
|
|
1676
|
+
waitForJob(jobId: string | JobInfo, signal?: AbortSignal): Promise<JobInfo>;
|
|
1677
|
+
/**
|
|
1678
|
+
* Subscribes to changes for documents matching specified filters
|
|
1679
|
+
*
|
|
1680
|
+
* @param search - Search filter options (type, parentId, identifiers)
|
|
1681
|
+
* @param callback - Function called when documents change with the change event details
|
|
1682
|
+
* @param view - Optional filter containing branch and scopes information
|
|
1683
|
+
* @returns A function that unsubscribes from the changes
|
|
1684
|
+
*/
|
|
1685
|
+
subscribe(search: SearchFilter, callback: (event: DocumentChangeEvent) => void, view?: ViewFilter): () => void;
|
|
1686
|
+
}
|
|
1687
|
+
//#endregion
|
|
1688
|
+
//#region src/client/reactor-client.d.ts
|
|
1689
|
+
/**
|
|
1690
|
+
* ReactorClient implementation that wraps lower-level APIs to provide
|
|
1691
|
+
* a simpler interface for document operations.
|
|
1692
|
+
*
|
|
1693
|
+
* Features:
|
|
1694
|
+
* - Wraps Jobs with Promises for easier async handling
|
|
1695
|
+
* - Manages signing of submitted Action objects
|
|
1696
|
+
* - Provides quality-of-life functions for common tasks
|
|
1697
|
+
* - Wraps subscription interface with ViewFilters
|
|
1698
|
+
*/
|
|
1699
|
+
declare class ReactorClient implements IReactorClient {
|
|
1700
|
+
private logger;
|
|
1701
|
+
private reactor;
|
|
1702
|
+
private signer;
|
|
1703
|
+
private subscriptionManager;
|
|
1704
|
+
private jobAwaiter;
|
|
1705
|
+
private documentIndexer;
|
|
1706
|
+
private documentView;
|
|
1707
|
+
readonly drives: IDriveClient;
|
|
1708
|
+
constructor(logger: ILogger, reactor: IReactor, signer: ISigner, subscriptionManager: IReactorSubscriptionManager, jobAwaiter: IJobAwaiter, documentIndexer: IDocumentIndexer, documentView: IDocumentView);
|
|
1709
|
+
/**
|
|
1710
|
+
* Retrieves a list of document model modules.
|
|
1711
|
+
*/
|
|
1712
|
+
getDocumentModelModules(namespace?: string, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<DocumentModelModule>>;
|
|
1713
|
+
/**
|
|
1714
|
+
* Retrieves a specific document model module by document type.
|
|
1715
|
+
*
|
|
1716
|
+
* @param documentType - The document type identifier
|
|
1717
|
+
* @returns The document model module
|
|
1718
|
+
*/
|
|
1719
|
+
getDocumentModelModule(documentType: string): Promise<DocumentModelModule<any>>;
|
|
1720
|
+
/**
|
|
1721
|
+
* Retrieves a specific PHDocument
|
|
1722
|
+
*/
|
|
1723
|
+
get<TDocument extends PHDocument>(identifier: string, view?: ViewFilter, signal?: AbortSignal): Promise<TDocument>;
|
|
1724
|
+
/**
|
|
1725
|
+
* Retrieves operations for a document
|
|
1726
|
+
*/
|
|
1727
|
+
getOperations(documentIdentifier: string, view?: ViewFilter, filter?: OperationFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<Operation>>;
|
|
1728
|
+
private getOperationsWithCompositeCursor;
|
|
1729
|
+
/**
|
|
1730
|
+
* Retrieves outgoing relationships of a given type from a source document.
|
|
1731
|
+
*/
|
|
1732
|
+
getOutgoingRelationships(sourceIdentifier: string, relationshipType: string, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
|
|
1733
|
+
/**
|
|
1734
|
+
* Retrieves incoming relationships of a given type to a target document.
|
|
1735
|
+
*/
|
|
1736
|
+
getIncomingRelationships(targetIdentifier: string, relationshipType: string, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
|
|
1737
|
+
/**
|
|
1738
|
+
* Filters documents by criteria and returns a list of them
|
|
1739
|
+
*/
|
|
1740
|
+
find(search: SearchFilter, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
|
|
1741
|
+
/**
|
|
1742
|
+
* Creates a document and waits for completion
|
|
1743
|
+
*/
|
|
1744
|
+
create<TDocument extends PHDocument = PHDocument>(document: PHDocument, parentIdentifier?: string, signal?: AbortSignal): Promise<TDocument>;
|
|
1745
|
+
/**
|
|
1746
|
+
* Creates an empty document and waits for completion
|
|
1747
|
+
*/
|
|
1748
|
+
createEmpty<TDocument extends PHDocument>(documentModelType: string, options?: CreateDocumentOptions, signal?: AbortSignal): Promise<TDocument>;
|
|
1749
|
+
/**
|
|
1750
|
+
* Creates an empty document in a drive as a single batched operation.
|
|
1751
|
+
* Delegates to {@link IDriveClient.addFile}.
|
|
1752
|
+
*
|
|
1753
|
+
* @deprecated Use `client.drives.addFile` instead. This method will be
|
|
1754
|
+
* removed in a future release.
|
|
1755
|
+
*/
|
|
1756
|
+
createDocumentInDrive<TDocument extends PHDocument>(driveId: string, document: PHDocument, parentFolder?: string, signal?: AbortSignal): Promise<TDocument>;
|
|
1757
|
+
/**
|
|
1758
|
+
* Applies a list of actions to a document and waits for completion
|
|
1759
|
+
*/
|
|
1760
|
+
execute<TDocument extends PHDocument>(documentIdentifier: string, branch: string, actions: Action[], signal?: AbortSignal): Promise<TDocument>;
|
|
1761
|
+
/**
|
|
1762
|
+
* Submits a list of actions to a document
|
|
1763
|
+
*/
|
|
1764
|
+
executeAsync(documentIdentifier: string, branch: string, actions: Action[], signal?: AbortSignal): Promise<JobInfo>;
|
|
1765
|
+
/**
|
|
1766
|
+
* Renames a document and waits for completion
|
|
1767
|
+
*/
|
|
1768
|
+
rename(documentIdentifier: string, name: string, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
|
|
1769
|
+
/**
|
|
1770
|
+
* Adds multiple documents as children to another and waits for completion
|
|
1771
|
+
*/
|
|
1772
|
+
addRelationship(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
|
|
1773
|
+
/**
|
|
1774
|
+
* Removes a relationship between two documents and waits for completion.
|
|
1775
|
+
*/
|
|
1776
|
+
removeRelationship(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
|
|
1777
|
+
/**
|
|
1778
|
+
* Moves a relationship from one source document to another and waits for completion.
|
|
1779
|
+
*/
|
|
1780
|
+
moveRelationship(sourceParentIdentifier: string, targetParentIdentifier: string, targetIdentifier: string, relationshipType: string, branch?: string, signal?: AbortSignal): Promise<{
|
|
1781
|
+
source: PHDocument;
|
|
1782
|
+
target: PHDocument;
|
|
1783
|
+
}>;
|
|
1784
|
+
loadBatch(request: BatchLoadRequest, signal?: AbortSignal): Promise<BatchLoadResult>;
|
|
1785
|
+
/**
|
|
1786
|
+
* Deletes a document and waits for completion
|
|
1787
|
+
*/
|
|
1788
|
+
deleteDocument(identifier: string, propagate?: PropagationMode, signal?: AbortSignal): Promise<void>;
|
|
1789
|
+
/**
|
|
1790
|
+
* Deletes documents and waits for completion
|
|
1791
|
+
*/
|
|
1792
|
+
deleteDocuments(identifiers: string[], propagate?: PropagationMode, signal?: AbortSignal): Promise<void>;
|
|
1793
|
+
/**
|
|
1794
|
+
* Retrieves the status of a job
|
|
1795
|
+
*/
|
|
1796
|
+
getJobStatus(jobId: string, signal?: AbortSignal): Promise<JobInfo>;
|
|
1797
|
+
/**
|
|
1798
|
+
* Waits for a job to complete
|
|
1799
|
+
*/
|
|
1800
|
+
waitForJob(jobId: string | JobInfo, signal?: AbortSignal): Promise<JobInfo>;
|
|
1801
|
+
/**
|
|
1802
|
+
* Subscribes to changes for documents matching specified filters
|
|
1803
|
+
*/
|
|
1804
|
+
subscribe(search: SearchFilter, callback: (event: DocumentChangeEvent) => void, view?: ViewFilter): () => void;
|
|
1805
|
+
private removeAllIncomingRelationships;
|
|
1806
|
+
}
|
|
1807
|
+
//#endregion
|
|
1808
|
+
//#region src/executor/types.d.ts
|
|
1809
|
+
/**
|
|
1810
|
+
* Represents the result of a job execution
|
|
1811
|
+
*/
|
|
1812
|
+
type JobResult = {
|
|
1813
|
+
/** The job that was executed */job: Job; /** Whether the job executed successfully */
|
|
1814
|
+
success: boolean; /** Error if the job failed */
|
|
1815
|
+
error?: Error; /** The operations generated from the actions (if successful) */
|
|
1816
|
+
operations?: Operation[];
|
|
1817
|
+
/**
|
|
1818
|
+
* Operations with context (includes ephemeral resultingState).
|
|
1819
|
+
* Used for emitting to IDocumentView via event bus.
|
|
1820
|
+
*/
|
|
1821
|
+
operationsWithContext?: OperationWithContext$1[]; /** Timestamp when the job execution completed */
|
|
1822
|
+
completedAt?: string; /** Duration of job execution in milliseconds */
|
|
1823
|
+
duration?: number; /** Any additional metadata from the execution */
|
|
1824
|
+
metadata?: Record<string, any>;
|
|
1825
|
+
};
|
|
1826
|
+
/**
|
|
1827
|
+
* Configuration options for the job executor
|
|
1828
|
+
*/
|
|
1829
|
+
type JobExecutorConfig = {
|
|
1830
|
+
/** Maximum number of conflicting operations to skip when reshuffling. */maxSkipThreshold?: number; /** Maximum number of concurrent jobs to execute */
|
|
1831
|
+
maxConcurrency?: number; /** Maximum time in milliseconds a job can run before being considered timed out */
|
|
1832
|
+
jobTimeoutMs?: number; /** Base delay in milliseconds for exponential backoff retries */
|
|
1833
|
+
retryBaseDelayMs?: number; /** Maximum delay in milliseconds for exponential backoff retries */
|
|
1834
|
+
retryMaxDelayMs?: number;
|
|
1835
|
+
/** Maximum elapsed milliseconds before yielding to the main thread between actions.
|
|
1836
|
+
* Keeps the UI responsive when processing large batches. */
|
|
1837
|
+
yieldDeadlineMs?: number;
|
|
1838
|
+
};
|
|
1839
|
+
/**
|
|
1840
|
+
* Event types for the job executor
|
|
1841
|
+
*/
|
|
1842
|
+
declare const JobExecutorEventTypes: {
|
|
1843
|
+
readonly JOB_STARTED: 20000;
|
|
1844
|
+
readonly JOB_COMPLETED: 20001;
|
|
1845
|
+
readonly JOB_FAILED: 20002;
|
|
1846
|
+
readonly EXECUTOR_STARTED: 20003;
|
|
1847
|
+
readonly EXECUTOR_STOPPED: 20004;
|
|
1848
|
+
};
|
|
1849
|
+
/**
|
|
1850
|
+
* Event data for job execution events
|
|
1851
|
+
*/
|
|
1852
|
+
type JobStartedEvent = {
|
|
1853
|
+
job: Job;
|
|
1854
|
+
startedAt: string;
|
|
1855
|
+
};
|
|
1856
|
+
type JobCompletedEvent = {
|
|
1857
|
+
job: Job;
|
|
1858
|
+
result: JobResult;
|
|
1859
|
+
};
|
|
1860
|
+
type JobFailedEvent = {
|
|
1861
|
+
job: Job;
|
|
1862
|
+
error: string;
|
|
1863
|
+
willRetry: boolean;
|
|
1864
|
+
retryCount: number;
|
|
1865
|
+
};
|
|
1866
|
+
type ExecutorStartedEvent = {
|
|
1867
|
+
config: JobExecutorConfig;
|
|
1868
|
+
startedAt: string;
|
|
1869
|
+
};
|
|
1870
|
+
type ExecutorStoppedEvent = {
|
|
1871
|
+
stoppedAt: string;
|
|
1872
|
+
graceful: boolean;
|
|
1873
|
+
};
|
|
1874
|
+
/**
|
|
1875
|
+
* Status information for the job executor manager
|
|
1876
|
+
*/
|
|
1877
|
+
type ExecutorManagerStatus = {
|
|
1878
|
+
/** Whether the manager is currently running */isRunning: boolean; /** Number of executor instances managed */
|
|
1879
|
+
numExecutors: number; /** Number of jobs currently being processed */
|
|
1880
|
+
activeJobs: number; /** Total number of jobs processed since start */
|
|
1881
|
+
totalJobsProcessed: number;
|
|
1882
|
+
};
|
|
1883
|
+
//#endregion
|
|
1884
|
+
//#region src/executor/interfaces.d.ts
|
|
1885
|
+
/**
|
|
1886
|
+
* Simple interface for executing a job.
|
|
1887
|
+
* A JobExecutor simply takes a job and executes it - nothing more.
|
|
1888
|
+
*/
|
|
1889
|
+
interface IJobExecutor {
|
|
1890
|
+
/**
|
|
1891
|
+
* Execute a single job.
|
|
1892
|
+
* @param job - The job to execute
|
|
1893
|
+
* @returns Promise that resolves to the job result
|
|
1894
|
+
*/
|
|
1895
|
+
executeJob(job: Job, signal?: AbortSignal): Promise<JobResult>;
|
|
1896
|
+
}
|
|
1897
|
+
/**
|
|
1898
|
+
* Interface for managing multiple job executors.
|
|
1899
|
+
* Listens for 'jobAvailable' events from the event bus, pulls jobs from the queue,
|
|
1900
|
+
* and coordinates the distribution of jobs across multiple executor instances.
|
|
1901
|
+
*/
|
|
1902
|
+
interface IJobExecutorManager {
|
|
1903
|
+
/**
|
|
1904
|
+
* Start the executor manager.
|
|
1905
|
+
* Begins listening for 'jobAvailable' events and dispatching to executors.
|
|
1906
|
+
*
|
|
1907
|
+
* @param numExecutors - Number of executor instances to create
|
|
1908
|
+
* @returns Promise that resolves when the manager is started
|
|
1909
|
+
*/
|
|
1910
|
+
start(numExecutors: number): Promise<void>;
|
|
1911
|
+
/**
|
|
1912
|
+
* Stop the executor manager.
|
|
1913
|
+
*
|
|
1914
|
+
* @param graceful - Whether to wait for current jobs to complete
|
|
1915
|
+
* @returns Promise that resolves when the manager is stopped
|
|
1916
|
+
*/
|
|
1917
|
+
stop(graceful?: boolean): Promise<void>;
|
|
1918
|
+
/**
|
|
1919
|
+
* Get all managed executor instances.
|
|
1920
|
+
*
|
|
1921
|
+
* @returns Array of executor instances
|
|
1922
|
+
*/
|
|
1923
|
+
getExecutors(): IJobExecutor[];
|
|
1924
|
+
/**
|
|
1925
|
+
* Get the current status of the manager.
|
|
1926
|
+
*
|
|
1927
|
+
* @returns The current manager status
|
|
1928
|
+
*/
|
|
1929
|
+
getStatus(): ExecutorManagerStatus;
|
|
1930
|
+
}
|
|
1931
|
+
//#endregion
|
|
1932
|
+
//#region src/job-tracker/interfaces.d.ts
|
|
1933
|
+
/**
|
|
1934
|
+
* Interface for tracking job lifecycle status.
|
|
1935
|
+
* Maintains job state throughout execution: PENDING → RUNNING → COMPLETED/FAILED.
|
|
1936
|
+
*/
|
|
1937
|
+
interface IJobTracker {
|
|
1938
|
+
/**
|
|
1939
|
+
* Register a new job with PENDING status.
|
|
1940
|
+
*
|
|
1941
|
+
* @param jobInfo - The job information to register
|
|
1942
|
+
*/
|
|
1943
|
+
registerJob(jobInfo: JobInfo): void;
|
|
1944
|
+
/**
|
|
1945
|
+
* Update a job's status to RUNNING.
|
|
1946
|
+
*
|
|
1947
|
+
* @param jobId - The job ID to mark as running
|
|
1948
|
+
*/
|
|
1949
|
+
markRunning(jobId: string): void;
|
|
1950
|
+
/**
|
|
1951
|
+
* Mark a job as failed.
|
|
1952
|
+
*
|
|
1953
|
+
* @param jobId - The job ID to mark as failed
|
|
1954
|
+
* @param error - Error information including message and stack trace
|
|
1955
|
+
* @param job - Optional full job object for debugging purposes
|
|
1956
|
+
*/
|
|
1957
|
+
markFailed(jobId: string, error: ErrorInfo, job?: Job): void;
|
|
1958
|
+
/**
|
|
1959
|
+
* Retrieve the current status of a job.
|
|
1960
|
+
*
|
|
1961
|
+
* @param jobId - The job ID to query
|
|
1962
|
+
* @returns The job information, or null if the job is not found
|
|
1963
|
+
*/
|
|
1964
|
+
getJobStatus(jobId: string): JobInfo | null;
|
|
1965
|
+
/**
|
|
1966
|
+
* Shutdown the job tracker and clean up resources.
|
|
1967
|
+
* Unsubscribes from all event bus subscriptions.
|
|
1968
|
+
*/
|
|
1969
|
+
shutdown(): void;
|
|
1970
|
+
}
|
|
1971
|
+
//#endregion
|
|
1972
|
+
//#region src/queue/interfaces.d.ts
|
|
1973
|
+
/**
|
|
1974
|
+
* Interface for a job queue that manages write operations.
|
|
1975
|
+
* Internally organizes jobs by documentId, scope, and branch to ensure proper ordering.
|
|
1976
|
+
* Emits events to the event bus when new jobs are available for consumption.
|
|
1977
|
+
*/
|
|
1978
|
+
interface IQueue {
|
|
1979
|
+
/**
|
|
1980
|
+
* Add a new job to the queue.
|
|
1981
|
+
* Jobs are automatically organized by documentId, scope, and branch internally.
|
|
1982
|
+
* Emits a 'jobAvailable' event to the event bus when the job is queued.
|
|
1983
|
+
* @param job - The job to add to the queue
|
|
1984
|
+
* @returns Promise that resolves when the job is queued
|
|
1985
|
+
*/
|
|
1986
|
+
enqueue(job: Job): Promise<void>;
|
|
1987
|
+
/**
|
|
1988
|
+
* Get the next job to execute for a specific document/scope/branch combination.
|
|
1989
|
+
* @param documentId - The document ID to get jobs for
|
|
1990
|
+
* @param scope - The scope to get jobs for
|
|
1991
|
+
* @param branch - The branch to get jobs for
|
|
1992
|
+
* @param signal - Optional abort signal to cancel the request
|
|
1993
|
+
* @returns Promise that resolves to the next job execution handle or null if no jobs available
|
|
1994
|
+
*/
|
|
1995
|
+
dequeue(documentId: string, scope: string, branch: string, signal?: AbortSignal): Promise<IJobExecutionHandle | null>;
|
|
1996
|
+
/**
|
|
1997
|
+
* Get the next available job from any queue.
|
|
1440
1998
|
* @param signal - Optional abort signal to cancel the request
|
|
1441
1999
|
* @returns Promise that resolves to the next job execution handle or null if no jobs available
|
|
1442
2000
|
*/
|
|
@@ -1689,40 +2247,6 @@ interface IDocumentModelRegistry {
|
|
|
1689
2247
|
getUpgradeReducer(documentType: string, fromVersion: number, toVersion: number): UpgradeReducer<any, any>;
|
|
1690
2248
|
}
|
|
1691
2249
|
//#endregion
|
|
1692
|
-
//#region src/shared/awaiter.d.ts
|
|
1693
|
-
interface IJobAwaiter {
|
|
1694
|
-
/**
|
|
1695
|
-
* Waits for a job to complete: turns a job into a promise.
|
|
1696
|
-
*
|
|
1697
|
-
* @param jobId - The job id or job object
|
|
1698
|
-
* @param signal - Optional abort signal to cancel the request
|
|
1699
|
-
* @returns The result of the job
|
|
1700
|
-
*/
|
|
1701
|
-
waitForJob(jobId: string, signal?: AbortSignal): Promise<JobInfo>;
|
|
1702
|
-
/**
|
|
1703
|
-
* Shuts down the job awaiter. This will synchronously reject all pending jobs.
|
|
1704
|
-
*/
|
|
1705
|
-
shutdown(): void;
|
|
1706
|
-
}
|
|
1707
|
-
/**
|
|
1708
|
-
* Event-driven implementation of IJobAwaiter.
|
|
1709
|
-
* Subscribes to operation events to detect job completion without polling.
|
|
1710
|
-
*/
|
|
1711
|
-
declare class JobAwaiter implements IJobAwaiter {
|
|
1712
|
-
private eventBus;
|
|
1713
|
-
private getJobStatus;
|
|
1714
|
-
private pendingJobs;
|
|
1715
|
-
private unsubscribers;
|
|
1716
|
-
constructor(eventBus: IEventBus, getJobStatus: (jobId: string, signal?: AbortSignal) => Promise<JobInfo>);
|
|
1717
|
-
private subscribeToEvents;
|
|
1718
|
-
shutdown(): void;
|
|
1719
|
-
waitForJob(jobId: string, signal?: AbortSignal): Promise<JobInfo>;
|
|
1720
|
-
private handleWriteReady;
|
|
1721
|
-
private handleReadReady;
|
|
1722
|
-
private handleJobFailed;
|
|
1723
|
-
private checkAndResolveWaiters;
|
|
1724
|
-
}
|
|
1725
|
-
//#endregion
|
|
1726
2250
|
//#region src/shared/consistency-tracker.d.ts
|
|
1727
2251
|
interface IConsistencyTracker {
|
|
1728
2252
|
/**
|
|
@@ -1858,108 +2382,45 @@ interface SyncDeadLetterTable {
|
|
|
1858
2382
|
job_dependencies: unknown;
|
|
1859
2383
|
remote_name: string;
|
|
1860
2384
|
document_id: string;
|
|
1861
|
-
scopes: unknown;
|
|
1862
|
-
branch: string;
|
|
1863
|
-
operations: unknown;
|
|
1864
|
-
error_source: string;
|
|
1865
|
-
error_message: string;
|
|
1866
|
-
created_at: Generated<Date>;
|
|
1867
|
-
}
|
|
1868
|
-
interface Database$1 {
|
|
1869
|
-
Operation: OperationTable;
|
|
1870
|
-
Keyframe: KeyframeTable;
|
|
1871
|
-
document_collections: DocumentCollectionTable;
|
|
1872
|
-
operation_index_operations: OperationIndexOperationTable;
|
|
1873
|
-
sync_remotes: SyncRemoteTable;
|
|
1874
|
-
sync_cursors: SyncCursorTable;
|
|
1875
|
-
sync_dead_letters: SyncDeadLetterTable;
|
|
1876
|
-
}
|
|
1877
|
-
interface DocumentTable {
|
|
1878
|
-
id: string;
|
|
1879
|
-
createdAt: Generated<Date>;
|
|
1880
|
-
updatedAt: Generated<Date>;
|
|
1881
|
-
}
|
|
1882
|
-
interface DocumentRelationshipTable {
|
|
1883
|
-
id: Generated<string>;
|
|
1884
|
-
sourceId: string;
|
|
1885
|
-
targetId: string;
|
|
1886
|
-
relationshipType: string;
|
|
1887
|
-
metadata: unknown;
|
|
1888
|
-
createdAt: Generated<Date>;
|
|
1889
|
-
updatedAt: Generated<Date>;
|
|
1890
|
-
}
|
|
1891
|
-
interface IndexerStateTable {
|
|
1892
|
-
id: Generated<number>;
|
|
1893
|
-
lastOperationId: number;
|
|
1894
|
-
lastOperationTimestamp: Generated<Date>;
|
|
1895
|
-
}
|
|
1896
|
-
interface DocumentIndexerDatabase {
|
|
1897
|
-
Document: DocumentTable;
|
|
1898
|
-
DocumentRelationship: DocumentRelationshipTable;
|
|
1899
|
-
IndexerState: IndexerStateTable;
|
|
1900
|
-
}
|
|
1901
|
-
//#endregion
|
|
1902
|
-
//#region src/subs/types.d.ts
|
|
1903
|
-
/**
|
|
1904
|
-
* Error handler for subscription callback errors
|
|
1905
|
-
*/
|
|
1906
|
-
interface ISubscriptionErrorHandler {
|
|
1907
|
-
/**
|
|
1908
|
-
* Called when a subscription callback throws an error
|
|
1909
|
-
* @param error - The error that was thrown
|
|
1910
|
-
* @param context - Context about which subscription failed
|
|
1911
|
-
*/
|
|
1912
|
-
handleError(error: unknown, context: SubscriptionErrorContext): void;
|
|
1913
|
-
}
|
|
1914
|
-
/**
|
|
1915
|
-
* Context information about a subscription error
|
|
1916
|
-
*/
|
|
1917
|
-
interface SubscriptionErrorContext {
|
|
1918
|
-
/** The type of event that was being processed */
|
|
1919
|
-
eventType: "created" | "deleted" | "updated" | "relationshipChanged";
|
|
1920
|
-
/** The subscription ID that failed */
|
|
1921
|
-
subscriptionId: string;
|
|
1922
|
-
/** Optional additional data about the event */
|
|
1923
|
-
eventData?: unknown;
|
|
1924
|
-
}
|
|
1925
|
-
/**
|
|
1926
|
-
* Interface for subscribing to document events in the reactor.
|
|
1927
|
-
*/
|
|
1928
|
-
interface IReactorSubscriptionManager {
|
|
1929
|
-
/**
|
|
1930
|
-
* Subscribes to document creation events
|
|
1931
|
-
*
|
|
1932
|
-
* @param callback - Function called when documents are created
|
|
1933
|
-
* @param search - Optional search filter to limit which documents trigger events
|
|
1934
|
-
* @param view - Optional filter containing branch and scopes information
|
|
1935
|
-
* @returns A function that unsubscribes from the events
|
|
1936
|
-
*/
|
|
1937
|
-
onDocumentCreated(callback: (result: PagedResults<string>) => void, search?: SearchFilter): () => void;
|
|
1938
|
-
/**
|
|
1939
|
-
* Subscribes to document deletion events
|
|
1940
|
-
*
|
|
1941
|
-
* @param callback - Function called when documents are deleted
|
|
1942
|
-
* @param search - Optional search filter to limit which documents trigger events
|
|
1943
|
-
* @returns A function that unsubscribes from the events
|
|
1944
|
-
*/
|
|
1945
|
-
onDocumentDeleted(callback: (documentIds: string[]) => void, search?: SearchFilter): () => void;
|
|
1946
|
-
/**
|
|
1947
|
-
* Subscribes to document state updates
|
|
1948
|
-
*
|
|
1949
|
-
* @param callback - Function called when documents are updated
|
|
1950
|
-
* @param search - Optional search filter to limit which documents trigger events
|
|
1951
|
-
* @param view - Optional filter containing branch and scopes information
|
|
1952
|
-
* @returns A function that unsubscribes from the events
|
|
1953
|
-
*/
|
|
1954
|
-
onDocumentStateUpdated(callback: (result: PagedResults<PHDocument>) => void, search?: SearchFilter, view?: ViewFilter): () => void;
|
|
1955
|
-
/**
|
|
1956
|
-
* Subscribes to parent-child relationship change events
|
|
1957
|
-
*
|
|
1958
|
-
* @param callback - Function called when parent-child relationships change
|
|
1959
|
-
* @param search - Optional search filter to limit which documents trigger events
|
|
1960
|
-
* @returns A function that unsubscribes from the events
|
|
1961
|
-
*/
|
|
1962
|
-
onRelationshipChanged(callback: (parentId: string, childId: string, changeType: RelationshipChangeType) => void, search?: SearchFilter): () => void;
|
|
2385
|
+
scopes: unknown;
|
|
2386
|
+
branch: string;
|
|
2387
|
+
operations: unknown;
|
|
2388
|
+
error_source: string;
|
|
2389
|
+
error_message: string;
|
|
2390
|
+
created_at: Generated<Date>;
|
|
2391
|
+
}
|
|
2392
|
+
interface Database$1 {
|
|
2393
|
+
Operation: OperationTable;
|
|
2394
|
+
Keyframe: KeyframeTable;
|
|
2395
|
+
document_collections: DocumentCollectionTable;
|
|
2396
|
+
operation_index_operations: OperationIndexOperationTable;
|
|
2397
|
+
sync_remotes: SyncRemoteTable;
|
|
2398
|
+
sync_cursors: SyncCursorTable;
|
|
2399
|
+
sync_dead_letters: SyncDeadLetterTable;
|
|
2400
|
+
}
|
|
2401
|
+
interface DocumentTable {
|
|
2402
|
+
id: string;
|
|
2403
|
+
createdAt: Generated<Date>;
|
|
2404
|
+
updatedAt: Generated<Date>;
|
|
2405
|
+
}
|
|
2406
|
+
interface DocumentRelationshipTable {
|
|
2407
|
+
id: Generated<string>;
|
|
2408
|
+
sourceId: string;
|
|
2409
|
+
targetId: string;
|
|
2410
|
+
relationshipType: string;
|
|
2411
|
+
metadata: unknown;
|
|
2412
|
+
createdAt: Generated<Date>;
|
|
2413
|
+
updatedAt: Generated<Date>;
|
|
2414
|
+
}
|
|
2415
|
+
interface IndexerStateTable {
|
|
2416
|
+
id: Generated<number>;
|
|
2417
|
+
lastOperationId: number;
|
|
2418
|
+
lastOperationTimestamp: Generated<Date>;
|
|
2419
|
+
}
|
|
2420
|
+
interface DocumentIndexerDatabase {
|
|
2421
|
+
Document: DocumentTable;
|
|
2422
|
+
DocumentRelationship: DocumentRelationshipTable;
|
|
2423
|
+
IndexerState: IndexerStateTable;
|
|
1963
2424
|
}
|
|
1964
2425
|
//#endregion
|
|
1965
2426
|
//#region src/sync/errors.d.ts
|
|
@@ -2259,695 +2720,355 @@ interface ISyncManager {
|
|
|
2259
2720
|
*
|
|
2260
2721
|
* @returns Array of all remotes
|
|
2261
2722
|
*/
|
|
2262
|
-
list(): Remote[];
|
|
2263
|
-
/**
|
|
2264
|
-
* Waits for sync operations for a job to complete.
|
|
2265
|
-
* Resolves when SYNC_SUCCEEDED is emitted.
|
|
2266
|
-
* Rejects when SYNC_FAILED is emitted.
|
|
2267
|
-
*
|
|
2268
|
-
* @param jobId - The job id to wait for
|
|
2269
|
-
* @param signal - Optional abort signal
|
|
2270
|
-
* @returns The sync result
|
|
2271
|
-
*/
|
|
2272
|
-
waitForSync(jobId: string, signal?: AbortSignal): Promise<SyncResult>;
|
|
2273
|
-
/**
|
|
2274
|
-
* Gets the current sync status for a document.
|
|
2275
|
-
*
|
|
2276
|
-
* @param documentId - The document ID to check
|
|
2277
|
-
* @returns The sync status, or undefined if the document has never been tracked
|
|
2278
|
-
*/
|
|
2279
|
-
getSyncStatus(documentId: string): SyncStatus | undefined;
|
|
2280
|
-
/**
|
|
2281
|
-
* Registers a callback that fires when a document's sync status changes.
|
|
2282
|
-
*
|
|
2283
|
-
* @param callback - Called with (documentId, newStatus) on each transition
|
|
2284
|
-
* @returns Unsubscribe function
|
|
2285
|
-
*/
|
|
2286
|
-
onSyncStatusChange(callback: SyncStatusChangeCallback): () => void;
|
|
2287
|
-
}
|
|
2288
|
-
//#endregion
|
|
2289
|
-
//#region src/core/types.d.ts
|
|
2290
|
-
/**
|
|
2291
|
-
* A single mutation job within a batch request.
|
|
2292
|
-
*/
|
|
2293
|
-
type ExecutionJobPlan = {
|
|
2294
|
-
key: string;
|
|
2295
|
-
documentId: string;
|
|
2296
|
-
scope: string;
|
|
2297
|
-
branch: string;
|
|
2298
|
-
actions: Action[];
|
|
2299
|
-
dependsOn: string[];
|
|
2300
|
-
};
|
|
2301
|
-
/**
|
|
2302
|
-
* Request for batch mutation operation.
|
|
2303
|
-
*/
|
|
2304
|
-
type BatchExecutionRequest = {
|
|
2305
|
-
jobs: ExecutionJobPlan[];
|
|
2306
|
-
};
|
|
2307
|
-
/**
|
|
2308
|
-
* Result from batch mutation operation.
|
|
2309
|
-
*/
|
|
2310
|
-
type BatchExecutionResult = {
|
|
2311
|
-
jobs: Record<string, JobInfo>;
|
|
2312
|
-
};
|
|
2313
|
-
/**
|
|
2314
|
-
* A single load job within a batch request.
|
|
2315
|
-
*/
|
|
2316
|
-
type LoadJobPlan = {
|
|
2317
|
-
key: string;
|
|
2318
|
-
documentId: string;
|
|
2319
|
-
scope: string;
|
|
2320
|
-
branch: string;
|
|
2321
|
-
operations: Operation[];
|
|
2322
|
-
dependsOn: string[];
|
|
2323
|
-
};
|
|
2324
|
-
/**
|
|
2325
|
-
* Request for batch load operation.
|
|
2326
|
-
*/
|
|
2327
|
-
type BatchLoadRequest = {
|
|
2328
|
-
jobs: LoadJobPlan[];
|
|
2329
|
-
};
|
|
2330
|
-
/**
|
|
2331
|
-
* Result from batch load operation.
|
|
2332
|
-
*/
|
|
2333
|
-
type BatchLoadResult = {
|
|
2334
|
-
jobs: Record<string, JobInfo>;
|
|
2335
|
-
};
|
|
2336
|
-
/**
|
|
2337
|
-
* The main Reactor interface that serves as a facade for document operations.
|
|
2338
|
-
* This interface provides a unified API for document management, including
|
|
2339
|
-
* creation, retrieval, mutation, and deletion operations.
|
|
2340
|
-
*/
|
|
2341
|
-
interface IReactor {
|
|
2342
|
-
/**
|
|
2343
|
-
* Signals that the reactor should shutdown.
|
|
2344
|
-
*/
|
|
2345
|
-
kill(): ShutdownStatus;
|
|
2346
|
-
/**
|
|
2347
|
-
* Retrieves a list of document model modules.
|
|
2348
|
-
*
|
|
2349
|
-
* @param namespace - Optional namespace like "powerhouse" or "sky", defaults to ""
|
|
2350
|
-
* @param paging - Optional options for paging data in large queries.
|
|
2351
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2352
|
-
* @returns List of document model modules
|
|
2353
|
-
*/
|
|
2354
|
-
getDocumentModels(namespace?: string, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<DocumentModelModule>>;
|
|
2355
|
-
/**
|
|
2356
|
-
* Retrieves a specific PHDocument by id
|
|
2357
|
-
*
|
|
2358
|
-
* @param id - Required, this is the document id
|
|
2359
|
-
* @param view - Optional filter containing branch and scopes information
|
|
2360
|
-
* @param consistencyToken - Optional token for read-after-write consistency
|
|
2361
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2362
|
-
* @returns The up-to-date PHDocument
|
|
2363
|
-
*/
|
|
2364
|
-
get<TDocument extends PHDocument>(id: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<TDocument>;
|
|
2365
|
-
/**
|
|
2366
|
-
* Retrieves a specific PHDocument by slug
|
|
2367
|
-
*
|
|
2368
|
-
* @param slug - Required, this is the document slug
|
|
2369
|
-
* @param view - Optional filter containing branch and scopes information
|
|
2370
|
-
* @param consistencyToken - Optional token for read-after-write consistency
|
|
2371
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2372
|
-
* @returns The up-to-date PHDocument with scopes and list of child document ids
|
|
2373
|
-
*/
|
|
2374
|
-
getBySlug<TDocument extends PHDocument>(slug: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<TDocument>;
|
|
2375
|
-
/**
|
|
2376
|
-
* Retrieves a specific PHDocument by identifier (either id or slug).
|
|
2377
|
-
* Throws an error if the identifier matches both an id and a slug that refer to different documents.
|
|
2378
|
-
*
|
|
2379
|
-
* @param identifier - Required, this is the document id or slug
|
|
2380
|
-
* @param view - Optional filter containing branch and scopes information
|
|
2381
|
-
* @param consistencyToken - Optional token for read-after-write consistency
|
|
2382
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2383
|
-
* @returns The up-to-date PHDocument with scopes and list of child document ids
|
|
2384
|
-
* @throws {Error} If identifier matches both an ID and slug referring to different documents
|
|
2385
|
-
*/
|
|
2386
|
-
getByIdOrSlug<TDocument extends PHDocument>(identifier: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<TDocument>;
|
|
2387
|
-
/**
|
|
2388
|
-
* Retrieves the children of a document
|
|
2389
|
-
*
|
|
2390
|
-
* @param parentId - The parent document id
|
|
2391
|
-
* @param consistencyToken - Optional token for read-after-write consistency
|
|
2392
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2393
|
-
* @returns The list of child document ids
|
|
2394
|
-
*/
|
|
2395
|
-
getChildren(parentId: string, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<string[]>;
|
|
2396
|
-
/**
|
|
2397
|
-
* Retrieves the parents of a document
|
|
2398
|
-
*
|
|
2399
|
-
* @param childId - The child document id
|
|
2400
|
-
* @param consistencyToken - Optional token for read-after-write consistency
|
|
2401
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2402
|
-
* @returns The list of parent document ids
|
|
2403
|
-
*/
|
|
2404
|
-
getParents(childId: string, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<string[]>;
|
|
2405
|
-
/**
|
|
2406
|
-
* Retrieves the operations for a document
|
|
2407
|
-
*
|
|
2408
|
-
* @param documentId - The document id
|
|
2409
|
-
* @param view - Optional filter containing branch and scopes information
|
|
2410
|
-
* @param filter - Optional filter for actionTypes, timestamps, and revision
|
|
2411
|
-
* @param paging - Optional pagination options
|
|
2412
|
-
* @param consistencyToken - Optional token for read-after-write consistency
|
|
2413
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2414
|
-
* @returns The list of operations
|
|
2415
|
-
*/
|
|
2416
|
-
getOperations(documentId: string, view?: ViewFilter, filter?: OperationFilter, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<Record<string, PagedResults<Operation>>>;
|
|
2417
|
-
/**
|
|
2418
|
-
* Filters documents by criteria and returns a list of them
|
|
2419
|
-
*
|
|
2420
|
-
* @param search - Search filter options (type, parentId, identifiers)
|
|
2421
|
-
* @param view - Optional filter containing branch and scopes information
|
|
2422
|
-
* @param paging - Optional pagination options
|
|
2423
|
-
* @param consistencyToken - Optional token for read-after-write consistency
|
|
2424
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2425
|
-
* @returns List of documents matching criteria and pagination cursor
|
|
2426
|
-
*/
|
|
2427
|
-
find(search: SearchFilter, view?: ViewFilter, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
|
|
2428
|
-
/**
|
|
2429
|
-
* Creates a document
|
|
2430
|
-
*
|
|
2431
|
-
* @param document - Document with optional id, slug, parent, model type, and initial state
|
|
2432
|
-
* @param signer - Optional signer to sign the actions
|
|
2433
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2434
|
-
* @param meta - Optional metadata that flows through the job lifecycle
|
|
2435
|
-
* @returns The job status
|
|
2436
|
-
*/
|
|
2437
|
-
create(document: PHDocument, signer?: ISigner, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<JobInfo>;
|
|
2438
|
-
/**
|
|
2439
|
-
* Deletes a document
|
|
2440
|
-
*
|
|
2441
|
-
* @param id - Document id
|
|
2442
|
-
* @param signer - Optional signer to sign the actions
|
|
2443
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2444
|
-
* @param meta - Optional metadata that flows through the job lifecycle
|
|
2445
|
-
* @returns The job id and status
|
|
2446
|
-
*/
|
|
2447
|
-
deleteDocument(id: string, signer?: ISigner, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<JobInfo>;
|
|
2448
|
-
/**
|
|
2449
|
-
* Applies a list of actions to a document.
|
|
2450
|
-
*
|
|
2451
|
-
* @param docId - Document id
|
|
2452
|
-
* @param branch - Branch to apply actions to
|
|
2453
|
-
* @param actions - List of actions to apply
|
|
2454
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2455
|
-
* @param meta - Optional metadata that flows through the job lifecycle
|
|
2456
|
-
* @returns The job id and status
|
|
2457
|
-
*/
|
|
2458
|
-
execute(docId: string, branch: string, actions: Action[], signal?: AbortSignal, meta?: Record<string, unknown>): Promise<JobInfo>;
|
|
2459
|
-
/**
|
|
2460
|
-
* Loads existing operations generated elsewhere into this reactor.
|
|
2461
|
-
*
|
|
2462
|
-
* @param docId - Document id
|
|
2463
|
-
* @param branch - Branch to load operations to
|
|
2464
|
-
* @param operations - List of operations to load
|
|
2465
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2466
|
-
* @param meta - Optional metadata that flows through the job lifecycle
|
|
2467
|
-
* @returns The job id and status
|
|
2468
|
-
*/
|
|
2469
|
-
load(docId: string, branch: string, operations: Operation[], signal?: AbortSignal, meta?: Record<string, unknown>): Promise<JobInfo>;
|
|
2470
|
-
/**
|
|
2471
|
-
* Applies multiple mutations across documents with dependency management.
|
|
2472
|
-
*
|
|
2473
|
-
* @param request - Batch mutation request containing jobs with dependencies
|
|
2474
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2475
|
-
* @param meta - Optional metadata that flows through the job lifecycle
|
|
2476
|
-
* @returns Map of job keys to job information
|
|
2477
|
-
*/
|
|
2478
|
-
executeBatch(request: BatchExecutionRequest, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<BatchExecutionResult>;
|
|
2479
|
-
/**
|
|
2480
|
-
* Loads multiple batches of pre-existing operations across documents with dependency management.
|
|
2481
|
-
*
|
|
2482
|
-
* @param request - Batch load request containing jobs with dependencies
|
|
2483
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2484
|
-
* @param meta - Optional metadata that flows through the job lifecycle
|
|
2485
|
-
* @returns Map of job keys to job information
|
|
2486
|
-
*/
|
|
2487
|
-
loadBatch(request: BatchLoadRequest, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<BatchLoadResult>;
|
|
2723
|
+
list(): Remote[];
|
|
2488
2724
|
/**
|
|
2489
|
-
*
|
|
2725
|
+
* Waits for sync operations for a job to complete.
|
|
2726
|
+
* Resolves when SYNC_SUCCEEDED is emitted.
|
|
2727
|
+
* Rejects when SYNC_FAILED is emitted.
|
|
2490
2728
|
*
|
|
2491
|
-
* @param
|
|
2492
|
-
* @param
|
|
2493
|
-
* @
|
|
2494
|
-
* @param signer - Optional signer to sign the actions
|
|
2495
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2496
|
-
* @returns The job id and status
|
|
2729
|
+
* @param jobId - The job id to wait for
|
|
2730
|
+
* @param signal - Optional abort signal
|
|
2731
|
+
* @returns The sync result
|
|
2497
2732
|
*/
|
|
2498
|
-
|
|
2733
|
+
waitForSync(jobId: string, signal?: AbortSignal): Promise<SyncResult>;
|
|
2499
2734
|
/**
|
|
2500
|
-
*
|
|
2735
|
+
* Gets the current sync status for a document.
|
|
2501
2736
|
*
|
|
2502
|
-
* @param
|
|
2503
|
-
* @
|
|
2504
|
-
* @param branch - Branch to remove children from, defaults to "main"
|
|
2505
|
-
* @param signer - Optional signer to sign the actions
|
|
2506
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2507
|
-
* @returns The job id and status
|
|
2737
|
+
* @param documentId - The document ID to check
|
|
2738
|
+
* @returns The sync status, or undefined if the document has never been tracked
|
|
2508
2739
|
*/
|
|
2509
|
-
|
|
2740
|
+
getSyncStatus(documentId: string): SyncStatus | undefined;
|
|
2510
2741
|
/**
|
|
2511
|
-
*
|
|
2742
|
+
* Registers a callback that fires when a document's sync status changes.
|
|
2512
2743
|
*
|
|
2513
|
-
* @param
|
|
2514
|
-
* @returns
|
|
2744
|
+
* @param callback - Called with (documentId, newStatus) on each transition
|
|
2745
|
+
* @returns Unsubscribe function
|
|
2515
2746
|
*/
|
|
2516
|
-
|
|
2747
|
+
onSyncStatusChange(callback: SyncStatusChangeCallback): () => void;
|
|
2517
2748
|
}
|
|
2749
|
+
//#endregion
|
|
2750
|
+
//#region src/core/types.d.ts
|
|
2518
2751
|
/**
|
|
2519
|
-
*
|
|
2752
|
+
* A single mutation job within a batch request.
|
|
2520
2753
|
*/
|
|
2521
|
-
type
|
|
2522
|
-
|
|
2754
|
+
type ExecutionJobPlan = {
|
|
2755
|
+
key: string;
|
|
2756
|
+
documentId: string;
|
|
2757
|
+
scope: string;
|
|
2758
|
+
branch: string;
|
|
2759
|
+
actions: Action[];
|
|
2760
|
+
dependsOn: string[];
|
|
2523
2761
|
};
|
|
2524
2762
|
/**
|
|
2525
|
-
*
|
|
2526
|
-
*/
|
|
2527
|
-
type Database = Database$1 & DocumentViewDatabase & DocumentIndexerDatabase;
|
|
2528
|
-
/**
|
|
2529
|
-
* Container for all sync manager dependencies created during the build process.
|
|
2530
|
-
*/
|
|
2531
|
-
interface SyncModule {
|
|
2532
|
-
remoteStorage: ISyncRemoteStorage;
|
|
2533
|
-
cursorStorage: ISyncCursorStorage;
|
|
2534
|
-
deadLetterStorage: ISyncDeadLetterStorage;
|
|
2535
|
-
channelFactory: IChannelFactory;
|
|
2536
|
-
syncManager: ISyncManager;
|
|
2537
|
-
}
|
|
2538
|
-
/**
|
|
2539
|
-
* Container for all reactor dependencies created during the build process.
|
|
2540
|
-
* Provides direct access to internal components for advanced use cases,
|
|
2541
|
-
* testing, or integration scenarios.
|
|
2763
|
+
* Request for batch mutation operation.
|
|
2542
2764
|
*/
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
queue: IQueue;
|
|
2547
|
-
jobTracker: IJobTracker;
|
|
2548
|
-
executorManager: IJobExecutorManager;
|
|
2549
|
-
database: Kysely<Database>;
|
|
2550
|
-
operationStore: IOperationStore;
|
|
2551
|
-
keyframeStore: IKeyframeStore;
|
|
2552
|
-
writeCache: IWriteCache;
|
|
2553
|
-
operationIndex: IOperationIndex;
|
|
2554
|
-
documentView: IDocumentView;
|
|
2555
|
-
documentViewConsistencyTracker: IConsistencyTracker;
|
|
2556
|
-
documentIndexer: IDocumentIndexer;
|
|
2557
|
-
documentIndexerConsistencyTracker: IConsistencyTracker;
|
|
2558
|
-
readModelCoordinator: IReadModelCoordinator;
|
|
2559
|
-
subscriptionManager: IReactorSubscriptionManager;
|
|
2560
|
-
processorManager: IProcessorManager$1;
|
|
2561
|
-
processorManagerConsistencyTracker: IConsistencyTracker;
|
|
2562
|
-
syncModule: SyncModule | undefined;
|
|
2563
|
-
reactor: IReactor;
|
|
2564
|
-
}
|
|
2765
|
+
type BatchExecutionRequest = {
|
|
2766
|
+
jobs: ExecutionJobPlan[];
|
|
2767
|
+
};
|
|
2565
2768
|
/**
|
|
2566
|
-
*
|
|
2567
|
-
* Provides direct access to internal components for advanced use cases,
|
|
2568
|
-
* testing, or integration scenarios.
|
|
2769
|
+
* Result from batch mutation operation.
|
|
2569
2770
|
*/
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
eventBus: IEventBus;
|
|
2574
|
-
documentIndexer: IDocumentIndexer;
|
|
2575
|
-
documentView: IDocumentView;
|
|
2576
|
-
signer: ISigner;
|
|
2577
|
-
subscriptionManager: IReactorSubscriptionManager;
|
|
2578
|
-
jobAwaiter: IJobAwaiter;
|
|
2579
|
-
reactorModule: ReactorModule | undefined;
|
|
2580
|
-
}
|
|
2581
|
-
//#endregion
|
|
2582
|
-
//#region src/client/types.d.ts
|
|
2771
|
+
type BatchExecutionResult = {
|
|
2772
|
+
jobs: Record<string, JobInfo>;
|
|
2773
|
+
};
|
|
2583
2774
|
/**
|
|
2584
|
-
*
|
|
2775
|
+
* A single load job within a batch request.
|
|
2585
2776
|
*/
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
}
|
|
2777
|
+
type LoadJobPlan = {
|
|
2778
|
+
key: string;
|
|
2779
|
+
documentId: string;
|
|
2780
|
+
scope: string;
|
|
2781
|
+
branch: string;
|
|
2782
|
+
operations: Operation[];
|
|
2783
|
+
dependsOn: string[];
|
|
2784
|
+
};
|
|
2595
2785
|
/**
|
|
2596
|
-
*
|
|
2786
|
+
* Request for batch load operation.
|
|
2597
2787
|
*/
|
|
2598
|
-
type
|
|
2599
|
-
|
|
2600
|
-
documents: PHDocument[];
|
|
2601
|
-
context?: {
|
|
2602
|
-
parentId?: string;
|
|
2603
|
-
childId?: string;
|
|
2604
|
-
};
|
|
2788
|
+
type BatchLoadRequest = {
|
|
2789
|
+
jobs: LoadJobPlan[];
|
|
2605
2790
|
};
|
|
2606
2791
|
/**
|
|
2607
|
-
*
|
|
2792
|
+
* Result from batch load operation.
|
|
2608
2793
|
*/
|
|
2609
|
-
type
|
|
2610
|
-
|
|
2611
|
-
documentModelVersion?: number;
|
|
2794
|
+
type BatchLoadResult = {
|
|
2795
|
+
jobs: Record<string, JobInfo>;
|
|
2612
2796
|
};
|
|
2613
2797
|
/**
|
|
2614
|
-
* The
|
|
2615
|
-
* a
|
|
2616
|
-
*
|
|
2617
|
-
* Features:
|
|
2618
|
-
* - Wraps Jobs with Promises for easier async handling
|
|
2619
|
-
* - Manages signing of submitted Action objects
|
|
2620
|
-
* - Provides quality-of-life functions for common tasks
|
|
2621
|
-
* - Wraps subscription interface with ViewFilters
|
|
2798
|
+
* The main Reactor interface that serves as a facade for document operations.
|
|
2799
|
+
* This interface provides a unified API for document management, including
|
|
2800
|
+
* creation, retrieval, mutation, and deletion operations.
|
|
2622
2801
|
*/
|
|
2623
|
-
interface
|
|
2802
|
+
interface IReactor {
|
|
2803
|
+
/**
|
|
2804
|
+
* Signals that the reactor should shutdown.
|
|
2805
|
+
*/
|
|
2806
|
+
kill(): ShutdownStatus;
|
|
2624
2807
|
/**
|
|
2625
2808
|
* Retrieves a list of document model modules.
|
|
2626
2809
|
*
|
|
2627
2810
|
* @param namespace - Optional namespace like "powerhouse" or "sky", defaults to ""
|
|
2628
|
-
* @param paging - Optional
|
|
2811
|
+
* @param paging - Optional options for paging data in large queries.
|
|
2629
2812
|
* @param signal - Optional abort signal to cancel the request
|
|
2630
2813
|
* @returns List of document model modules
|
|
2631
2814
|
*/
|
|
2632
|
-
|
|
2815
|
+
getDocumentModels(namespace?: string, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<DocumentModelModule>>;
|
|
2633
2816
|
/**
|
|
2634
|
-
* Retrieves a specific
|
|
2817
|
+
* Retrieves a specific PHDocument by id
|
|
2635
2818
|
*
|
|
2636
|
-
* @param
|
|
2637
|
-
* @
|
|
2819
|
+
* @param id - Required, this is the document id
|
|
2820
|
+
* @param view - Optional filter containing branch and scopes information
|
|
2821
|
+
* @param consistencyToken - Optional token for read-after-write consistency
|
|
2822
|
+
* @param signal - Optional abort signal to cancel the request
|
|
2823
|
+
* @returns The up-to-date PHDocument
|
|
2638
2824
|
*/
|
|
2639
|
-
|
|
2825
|
+
get<TDocument extends PHDocument>(id: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<TDocument>;
|
|
2640
2826
|
/**
|
|
2641
|
-
* Retrieves a specific
|
|
2827
|
+
* Retrieves a specific PHDocument by slug
|
|
2642
2828
|
*
|
|
2643
|
-
* @param
|
|
2829
|
+
* @param slug - Required, this is the document slug
|
|
2644
2830
|
* @param view - Optional filter containing branch and scopes information
|
|
2831
|
+
* @param consistencyToken - Optional token for read-after-write consistency
|
|
2645
2832
|
* @param signal - Optional abort signal to cancel the request
|
|
2646
2833
|
* @returns The up-to-date PHDocument with scopes and list of child document ids
|
|
2647
2834
|
*/
|
|
2648
|
-
|
|
2835
|
+
getBySlug<TDocument extends PHDocument>(slug: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<TDocument>;
|
|
2649
2836
|
/**
|
|
2650
|
-
* Retrieves
|
|
2837
|
+
* Retrieves a specific PHDocument by identifier (either id or slug).
|
|
2838
|
+
* Throws an error if the identifier matches both an id and a slug that refer to different documents.
|
|
2651
2839
|
*
|
|
2652
|
-
* @param
|
|
2840
|
+
* @param identifier - Required, this is the document id or slug
|
|
2653
2841
|
* @param view - Optional filter containing branch and scopes information
|
|
2654
|
-
* @param
|
|
2655
|
-
* @param paging - Optional pagination options
|
|
2842
|
+
* @param consistencyToken - Optional token for read-after-write consistency
|
|
2656
2843
|
* @param signal - Optional abort signal to cancel the request
|
|
2657
|
-
* @returns
|
|
2844
|
+
* @returns The up-to-date PHDocument with scopes and list of child document ids
|
|
2845
|
+
* @throws {Error} If identifier matches both an ID and slug referring to different documents
|
|
2658
2846
|
*/
|
|
2659
|
-
|
|
2847
|
+
getByIdOrSlug<TDocument extends PHDocument>(identifier: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<TDocument>;
|
|
2660
2848
|
/**
|
|
2661
|
-
* Retrieves
|
|
2849
|
+
* Retrieves outgoing relationships of a given type from a source document.
|
|
2662
2850
|
*
|
|
2663
|
-
* @param
|
|
2664
|
-
* @param
|
|
2665
|
-
* @param
|
|
2851
|
+
* @param sourceId - The source document id
|
|
2852
|
+
* @param relationshipType - The relationship type to filter by
|
|
2853
|
+
* @param consistencyToken - Optional token for read-after-write consistency
|
|
2666
2854
|
* @param signal - Optional abort signal to cancel the request
|
|
2667
|
-
* @returns The
|
|
2855
|
+
* @returns The list of target document ids
|
|
2668
2856
|
*/
|
|
2669
|
-
|
|
2857
|
+
getOutgoingRelationships(sourceId: string, relationshipType: string, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<string[]>;
|
|
2670
2858
|
/**
|
|
2671
|
-
* Retrieves
|
|
2859
|
+
* Retrieves incoming relationships of a given type to a target document.
|
|
2672
2860
|
*
|
|
2673
|
-
* @param
|
|
2674
|
-
* @param
|
|
2675
|
-
* @param
|
|
2861
|
+
* @param targetId - The target document id
|
|
2862
|
+
* @param relationshipType - The relationship type to filter by
|
|
2863
|
+
* @param consistencyToken - Optional token for read-after-write consistency
|
|
2676
2864
|
* @param signal - Optional abort signal to cancel the request
|
|
2677
|
-
* @returns The
|
|
2865
|
+
* @returns The list of source document ids
|
|
2678
2866
|
*/
|
|
2679
|
-
|
|
2867
|
+
getIncomingRelationships(targetId: string, relationshipType: string, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<string[]>;
|
|
2680
2868
|
/**
|
|
2681
|
-
*
|
|
2869
|
+
* Retrieves the operations for a document
|
|
2682
2870
|
*
|
|
2683
|
-
* @param
|
|
2871
|
+
* @param documentId - The document id
|
|
2684
2872
|
* @param view - Optional filter containing branch and scopes information
|
|
2873
|
+
* @param filter - Optional filter for actionTypes, timestamps, and revision
|
|
2685
2874
|
* @param paging - Optional pagination options
|
|
2875
|
+
* @param consistencyToken - Optional token for read-after-write consistency
|
|
2686
2876
|
* @param signal - Optional abort signal to cancel the request
|
|
2687
|
-
* @returns
|
|
2688
|
-
*/
|
|
2689
|
-
find(search: SearchFilter, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
|
|
2690
|
-
/**
|
|
2691
|
-
* Creates a document and waits for completion
|
|
2692
|
-
*
|
|
2693
|
-
* @param document - Document with optional id, slug, parent, model type, and initial state
|
|
2694
|
-
* @param parentIdentifier - Optional "id" or "slug" of parent document
|
|
2695
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2696
|
-
* @returns The created document
|
|
2697
|
-
*/
|
|
2698
|
-
create<TDocument extends PHDocument = PHDocument>(document: PHDocument, parentIdentifier?: string, signal?: AbortSignal): Promise<TDocument>;
|
|
2699
|
-
/**
|
|
2700
|
-
* Creates an empty document and waits for completion
|
|
2701
|
-
*
|
|
2702
|
-
* @param documentModelType - Type of document to create
|
|
2703
|
-
* @param options - Optional creation options (parentIdentifier, documentModelVersion)
|
|
2704
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2705
|
-
*/
|
|
2706
|
-
createEmpty<TDocument extends PHDocument>(documentModelType: string, options?: CreateDocumentOptions, signal?: AbortSignal): Promise<TDocument>;
|
|
2707
|
-
/**
|
|
2708
|
-
* Creates an empty document in a drive as a single batched operation.
|
|
2709
|
-
* This is more efficient than createEmpty + addFile as it batches all
|
|
2710
|
-
* actions into dependent jobs and waits for them to complete together.
|
|
2711
|
-
*
|
|
2712
|
-
* @param driveId - The drive document id or slug
|
|
2713
|
-
* @param document - The document to create
|
|
2714
|
-
* @param parentFolder - Optional folder id within the drive
|
|
2715
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2716
|
-
* @returns The created document
|
|
2717
|
-
*/
|
|
2718
|
-
createDocumentInDrive<TDocument extends PHDocument>(driveId: string, document: PHDocument, parentFolder?: string, signal?: AbortSignal): Promise<TDocument>;
|
|
2719
|
-
/**
|
|
2720
|
-
* Applies a list of actions to a document and waits for completion
|
|
2721
|
-
*
|
|
2722
|
-
* @param documentIdentifier - Target document id or slug
|
|
2723
|
-
* @param branch - Branch to apply actions to
|
|
2724
|
-
* @param actions - List of actions to apply
|
|
2725
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2726
|
-
* @returns The updated document
|
|
2727
|
-
*/
|
|
2728
|
-
execute<TDocument extends PHDocument>(documentIdentifier: string, branch: string, actions: Action[], signal?: AbortSignal): Promise<TDocument>;
|
|
2729
|
-
/**
|
|
2730
|
-
* Submits a list of actions to a document
|
|
2731
|
-
*
|
|
2732
|
-
* @param documentIdentifier - Target document id or slug
|
|
2733
|
-
* @param branch - Branch to apply actions to
|
|
2734
|
-
* @param actions - List of actions to apply
|
|
2735
|
-
* @param signal - Optional abort signal to cancel the request
|
|
2736
|
-
* @returns The job
|
|
2877
|
+
* @returns The list of operations
|
|
2737
2878
|
*/
|
|
2738
|
-
|
|
2879
|
+
getOperations(documentId: string, view?: ViewFilter, filter?: OperationFilter, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<Record<string, PagedResults<Operation>>>;
|
|
2739
2880
|
/**
|
|
2740
|
-
*
|
|
2881
|
+
* Filters documents by criteria and returns a list of them
|
|
2741
2882
|
*
|
|
2742
|
-
* @param
|
|
2743
|
-
* @param
|
|
2744
|
-
* @param
|
|
2883
|
+
* @param search - Search filter options (type, parentId, identifiers)
|
|
2884
|
+
* @param view - Optional filter containing branch and scopes information
|
|
2885
|
+
* @param paging - Optional pagination options
|
|
2886
|
+
* @param consistencyToken - Optional token for read-after-write consistency
|
|
2745
2887
|
* @param signal - Optional abort signal to cancel the request
|
|
2746
|
-
* @returns
|
|
2888
|
+
* @returns List of documents matching criteria and pagination cursor
|
|
2747
2889
|
*/
|
|
2748
|
-
|
|
2890
|
+
find(search: SearchFilter, view?: ViewFilter, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
|
|
2749
2891
|
/**
|
|
2750
|
-
*
|
|
2892
|
+
* Creates a document
|
|
2751
2893
|
*
|
|
2752
|
-
* @param
|
|
2753
|
-
* @param
|
|
2754
|
-
* @param branch - Optional branch to add children to, defaults to "main"
|
|
2894
|
+
* @param document - Document with optional id, slug, parent, model type, and initial state
|
|
2895
|
+
* @param signer - Optional signer to sign the actions
|
|
2755
2896
|
* @param signal - Optional abort signal to cancel the request
|
|
2756
|
-
* @
|
|
2897
|
+
* @param meta - Optional metadata that flows through the job lifecycle
|
|
2898
|
+
* @returns The job status
|
|
2757
2899
|
*/
|
|
2758
|
-
|
|
2900
|
+
create(document: PHDocument, signer?: ISigner, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<JobInfo>;
|
|
2759
2901
|
/**
|
|
2760
|
-
*
|
|
2902
|
+
* Deletes a document
|
|
2761
2903
|
*
|
|
2762
|
-
* @param
|
|
2763
|
-
* @param
|
|
2764
|
-
* @param branch - Optional branch to remove children from, defaults to "main"
|
|
2904
|
+
* @param id - Document id
|
|
2905
|
+
* @param signer - Optional signer to sign the actions
|
|
2765
2906
|
* @param signal - Optional abort signal to cancel the request
|
|
2766
|
-
* @
|
|
2907
|
+
* @param meta - Optional metadata that flows through the job lifecycle
|
|
2908
|
+
* @returns The job id and status
|
|
2767
2909
|
*/
|
|
2768
|
-
|
|
2910
|
+
deleteDocument(id: string, signer?: ISigner, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<JobInfo>;
|
|
2769
2911
|
/**
|
|
2770
|
-
*
|
|
2912
|
+
* Applies a list of actions to a document.
|
|
2771
2913
|
*
|
|
2772
|
-
* @param
|
|
2773
|
-
* @param
|
|
2774
|
-
* @param
|
|
2775
|
-
* @param branch - Optional branch to move children to, defaults to "main"
|
|
2914
|
+
* @param docId - Document id
|
|
2915
|
+
* @param branch - Branch to apply actions to
|
|
2916
|
+
* @param actions - List of actions to apply
|
|
2776
2917
|
* @param signal - Optional abort signal to cancel the request
|
|
2777
|
-
* @
|
|
2918
|
+
* @param meta - Optional metadata that flows through the job lifecycle
|
|
2919
|
+
* @returns The job id and status
|
|
2778
2920
|
*/
|
|
2779
|
-
|
|
2780
|
-
source: PHDocument;
|
|
2781
|
-
target: PHDocument;
|
|
2782
|
-
}>;
|
|
2921
|
+
execute(docId: string, branch: string, actions: Action[], signal?: AbortSignal, meta?: Record<string, unknown>): Promise<JobInfo>;
|
|
2783
2922
|
/**
|
|
2784
|
-
*
|
|
2923
|
+
* Loads existing operations generated elsewhere into this reactor.
|
|
2785
2924
|
*
|
|
2786
|
-
* @param
|
|
2787
|
-
* @param
|
|
2925
|
+
* @param docId - Document id
|
|
2926
|
+
* @param branch - Branch to load operations to
|
|
2927
|
+
* @param operations - List of operations to load
|
|
2788
2928
|
* @param signal - Optional abort signal to cancel the request
|
|
2789
|
-
* @
|
|
2929
|
+
* @param meta - Optional metadata that flows through the job lifecycle
|
|
2930
|
+
* @returns The job id and status
|
|
2790
2931
|
*/
|
|
2791
|
-
|
|
2932
|
+
load(docId: string, branch: string, operations: Operation[], signal?: AbortSignal, meta?: Record<string, unknown>): Promise<JobInfo>;
|
|
2792
2933
|
/**
|
|
2793
|
-
*
|
|
2934
|
+
* Applies multiple mutations across documents with dependency management.
|
|
2794
2935
|
*
|
|
2795
|
-
* @param
|
|
2796
|
-
* @param propagate - Optional mode for handling children, CASCADE deletes child documents
|
|
2936
|
+
* @param request - Batch mutation request containing jobs with dependencies
|
|
2797
2937
|
* @param signal - Optional abort signal to cancel the request
|
|
2798
|
-
* @
|
|
2938
|
+
* @param meta - Optional metadata that flows through the job lifecycle
|
|
2939
|
+
* @returns Map of job keys to job information
|
|
2799
2940
|
*/
|
|
2800
|
-
|
|
2941
|
+
executeBatch(request: BatchExecutionRequest, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<BatchExecutionResult>;
|
|
2801
2942
|
/**
|
|
2802
2943
|
* Loads multiple batches of pre-existing operations across documents with dependency management.
|
|
2803
|
-
* Waits for all jobs to complete.
|
|
2804
2944
|
*
|
|
2805
2945
|
* @param request - Batch load request containing jobs with dependencies
|
|
2806
2946
|
* @param signal - Optional abort signal to cancel the request
|
|
2807
|
-
* @
|
|
2947
|
+
* @param meta - Optional metadata that flows through the job lifecycle
|
|
2948
|
+
* @returns Map of job keys to job information
|
|
2808
2949
|
*/
|
|
2809
|
-
loadBatch(request: BatchLoadRequest, signal?: AbortSignal): Promise<BatchLoadResult>;
|
|
2950
|
+
loadBatch(request: BatchLoadRequest, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<BatchLoadResult>;
|
|
2810
2951
|
/**
|
|
2811
|
-
*
|
|
2952
|
+
* Adds a relationship between two documents.
|
|
2812
2953
|
*
|
|
2813
|
-
* @param
|
|
2954
|
+
* @param sourceId - Source document id
|
|
2955
|
+
* @param targetId - Target document id
|
|
2956
|
+
* @param relationshipType - Relationship type identifier
|
|
2957
|
+
* @param branch - Branch to add the relationship to, defaults to "main"
|
|
2958
|
+
* @param signer - Optional signer to sign the actions
|
|
2814
2959
|
* @param signal - Optional abort signal to cancel the request
|
|
2815
|
-
* @returns The job status
|
|
2960
|
+
* @returns The job id and status
|
|
2816
2961
|
*/
|
|
2817
|
-
|
|
2962
|
+
addRelationship(sourceId: string, targetId: string, relationshipType: string, branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
|
|
2818
2963
|
/**
|
|
2819
|
-
*
|
|
2964
|
+
* Removes a relationship between two documents.
|
|
2820
2965
|
*
|
|
2821
|
-
* @param
|
|
2966
|
+
* @param sourceId - Source document id
|
|
2967
|
+
* @param targetId - Target document id
|
|
2968
|
+
* @param relationshipType - Relationship type identifier
|
|
2969
|
+
* @param branch - Branch to remove the relationship from, defaults to "main"
|
|
2970
|
+
* @param signer - Optional signer to sign the actions
|
|
2822
2971
|
* @param signal - Optional abort signal to cancel the request
|
|
2823
|
-
* @returns The
|
|
2972
|
+
* @returns The job id and status
|
|
2824
2973
|
*/
|
|
2825
|
-
|
|
2974
|
+
removeRelationship(sourceId: string, targetId: string, relationshipType: string, branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
|
|
2826
2975
|
/**
|
|
2827
|
-
*
|
|
2976
|
+
* Retrieves the status of a job
|
|
2828
2977
|
*
|
|
2829
|
-
* @param
|
|
2830
|
-
* @
|
|
2831
|
-
* @param view - Optional filter containing branch and scopes information
|
|
2832
|
-
* @returns A function that unsubscribes from the changes
|
|
2978
|
+
* @param jobId - The job id
|
|
2979
|
+
* @returns The job status
|
|
2833
2980
|
*/
|
|
2834
|
-
|
|
2981
|
+
getJobStatus(jobId: string, signal?: AbortSignal): Promise<JobInfo>;
|
|
2982
|
+
}
|
|
2983
|
+
/**
|
|
2984
|
+
* Feature flags for reactor configuration
|
|
2985
|
+
*/
|
|
2986
|
+
type ReactorFeatures = {
|
|
2987
|
+
[key: string]: boolean;
|
|
2988
|
+
};
|
|
2989
|
+
/**
|
|
2990
|
+
* Combined database type that includes all schemas
|
|
2991
|
+
*/
|
|
2992
|
+
type Database = Database$1 & DocumentViewDatabase & DocumentIndexerDatabase;
|
|
2993
|
+
/**
|
|
2994
|
+
* Container for all sync manager dependencies created during the build process.
|
|
2995
|
+
*/
|
|
2996
|
+
interface SyncModule {
|
|
2997
|
+
remoteStorage: ISyncRemoteStorage;
|
|
2998
|
+
cursorStorage: ISyncCursorStorage;
|
|
2999
|
+
deadLetterStorage: ISyncDeadLetterStorage;
|
|
3000
|
+
channelFactory: IChannelFactory;
|
|
3001
|
+
syncManager: ISyncManager;
|
|
3002
|
+
}
|
|
3003
|
+
/**
|
|
3004
|
+
* Container for all reactor dependencies created during the build process.
|
|
3005
|
+
* Provides direct access to internal components for advanced use cases,
|
|
3006
|
+
* testing, or integration scenarios.
|
|
3007
|
+
*/
|
|
3008
|
+
interface ReactorModule {
|
|
3009
|
+
eventBus: IEventBus;
|
|
3010
|
+
documentModelRegistry: IDocumentModelRegistry;
|
|
3011
|
+
queue: IQueue;
|
|
3012
|
+
jobTracker: IJobTracker;
|
|
3013
|
+
executorManager: IJobExecutorManager;
|
|
3014
|
+
database: Kysely<Database>;
|
|
3015
|
+
operationStore: IOperationStore;
|
|
3016
|
+
keyframeStore: IKeyframeStore;
|
|
3017
|
+
writeCache: IWriteCache;
|
|
3018
|
+
operationIndex: IOperationIndex;
|
|
3019
|
+
documentView: IDocumentView;
|
|
3020
|
+
documentViewConsistencyTracker: IConsistencyTracker;
|
|
3021
|
+
documentIndexer: IDocumentIndexer;
|
|
3022
|
+
documentIndexerConsistencyTracker: IConsistencyTracker;
|
|
3023
|
+
readModelCoordinator: IReadModelCoordinator;
|
|
3024
|
+
subscriptionManager: IReactorSubscriptionManager;
|
|
3025
|
+
processorManager: IProcessorManager$1;
|
|
3026
|
+
processorManagerConsistencyTracker: IConsistencyTracker;
|
|
3027
|
+
syncModule: SyncModule | undefined;
|
|
3028
|
+
reactor: IReactor;
|
|
3029
|
+
}
|
|
3030
|
+
/**
|
|
3031
|
+
* Container for all reactor client dependencies created during the build process.
|
|
3032
|
+
* Provides direct access to internal components for advanced use cases,
|
|
3033
|
+
* testing, or integration scenarios.
|
|
3034
|
+
*/
|
|
3035
|
+
interface ReactorClientModule {
|
|
3036
|
+
client: ReactorClient;
|
|
3037
|
+
reactor: IReactor;
|
|
3038
|
+
eventBus: IEventBus;
|
|
3039
|
+
documentIndexer: IDocumentIndexer;
|
|
3040
|
+
documentView: IDocumentView;
|
|
3041
|
+
signer: ISigner;
|
|
3042
|
+
subscriptionManager: IReactorSubscriptionManager;
|
|
3043
|
+
jobAwaiter: IJobAwaiter;
|
|
3044
|
+
reactorModule: ReactorModule | undefined;
|
|
2835
3045
|
}
|
|
2836
3046
|
//#endregion
|
|
2837
|
-
//#region src/client/
|
|
3047
|
+
//#region src/client/drive-client.d.ts
|
|
2838
3048
|
/**
|
|
2839
|
-
*
|
|
2840
|
-
* a simpler interface for document operations.
|
|
3049
|
+
* Implementation of {@link IDriveClient}.
|
|
2841
3050
|
*
|
|
2842
|
-
*
|
|
2843
|
-
* -
|
|
2844
|
-
* -
|
|
2845
|
-
*
|
|
2846
|
-
* - Wraps subscription interface with ViewFilters
|
|
3051
|
+
* Holds a back-reference to its parent {@link IReactorClient} for read and
|
|
3052
|
+
* single-document write primitives, plus direct access to {@link IReactor}
|
|
3053
|
+
* for batch execution. The back-reference is captured but never invoked
|
|
3054
|
+
* during construction, so the partial-`this` hazard does not apply.
|
|
2847
3055
|
*/
|
|
2848
|
-
declare class
|
|
2849
|
-
private
|
|
2850
|
-
private
|
|
2851
|
-
private
|
|
2852
|
-
private
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
* @param documentType - The document type identifier
|
|
2865
|
-
* @returns The document model module
|
|
2866
|
-
*/
|
|
2867
|
-
getDocumentModelModule(documentType: string): Promise<DocumentModelModule<any>>;
|
|
2868
|
-
/**
|
|
2869
|
-
* Retrieves a specific PHDocument
|
|
2870
|
-
*/
|
|
2871
|
-
get<TDocument extends PHDocument>(identifier: string, view?: ViewFilter, signal?: AbortSignal): Promise<TDocument>;
|
|
2872
|
-
/**
|
|
2873
|
-
* Retrieves operations for a document
|
|
2874
|
-
*/
|
|
2875
|
-
getOperations(documentIdentifier: string, view?: ViewFilter, filter?: OperationFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<Operation>>;
|
|
2876
|
-
private getOperationsWithCompositeCursor;
|
|
2877
|
-
/**
|
|
2878
|
-
* Retrieves children of a document
|
|
2879
|
-
*/
|
|
2880
|
-
getChildren(parentIdentifier: string, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
|
|
2881
|
-
/**
|
|
2882
|
-
* Retrieves parents of a document
|
|
2883
|
-
*/
|
|
2884
|
-
getParents(childIdentifier: string, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
|
|
2885
|
-
/**
|
|
2886
|
-
* Filters documents by criteria and returns a list of them
|
|
2887
|
-
*/
|
|
2888
|
-
find(search: SearchFilter, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
|
|
2889
|
-
/**
|
|
2890
|
-
* Creates a document and waits for completion
|
|
2891
|
-
*/
|
|
2892
|
-
create<TDocument extends PHDocument = PHDocument>(document: PHDocument, parentIdentifier?: string, signal?: AbortSignal): Promise<TDocument>;
|
|
2893
|
-
/**
|
|
2894
|
-
* Creates an empty document and waits for completion
|
|
2895
|
-
*/
|
|
2896
|
-
createEmpty<TDocument extends PHDocument>(documentModelType: string, options?: CreateDocumentOptions, signal?: AbortSignal): Promise<TDocument>;
|
|
2897
|
-
/**
|
|
2898
|
-
* Creates an empty document in a drive as a single batched operation.
|
|
2899
|
-
*/
|
|
2900
|
-
createDocumentInDrive<TDocument extends PHDocument>(driveId: string, document: PHDocument, parentFolder?: string, signal?: AbortSignal): Promise<TDocument>;
|
|
2901
|
-
/**
|
|
2902
|
-
* Applies a list of actions to a document and waits for completion
|
|
2903
|
-
*/
|
|
2904
|
-
execute<TDocument extends PHDocument>(documentIdentifier: string, branch: string, actions: Action[], signal?: AbortSignal): Promise<TDocument>;
|
|
2905
|
-
/**
|
|
2906
|
-
* Submits a list of actions to a document
|
|
2907
|
-
*/
|
|
2908
|
-
executeAsync(documentIdentifier: string, branch: string, actions: Action[], signal?: AbortSignal): Promise<JobInfo>;
|
|
2909
|
-
/**
|
|
2910
|
-
* Renames a document and waits for completion
|
|
2911
|
-
*/
|
|
2912
|
-
rename(documentIdentifier: string, name: string, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
|
|
2913
|
-
/**
|
|
2914
|
-
* Adds multiple documents as children to another and waits for completion
|
|
2915
|
-
*/
|
|
2916
|
-
addChildren(parentIdentifier: string, documentIdentifiers: string[], branch?: string, signal?: AbortSignal): Promise<PHDocument>;
|
|
2917
|
-
/**
|
|
2918
|
-
* Removes multiple documents as children from another and waits for completion
|
|
2919
|
-
*/
|
|
2920
|
-
removeChildren(parentIdentifier: string, documentIdentifiers: string[], branch?: string, signal?: AbortSignal): Promise<PHDocument>;
|
|
2921
|
-
/**
|
|
2922
|
-
* Moves multiple documents from one parent to another and waits for completion
|
|
2923
|
-
*/
|
|
2924
|
-
moveChildren(sourceParentIdentifier: string, targetParentIdentifier: string, documentIdentifiers: string[], branch?: string, signal?: AbortSignal): Promise<{
|
|
2925
|
-
source: PHDocument;
|
|
2926
|
-
target: PHDocument;
|
|
2927
|
-
}>;
|
|
2928
|
-
loadBatch(request: BatchLoadRequest, signal?: AbortSignal): Promise<BatchLoadResult>;
|
|
2929
|
-
/**
|
|
2930
|
-
* Deletes a document and waits for completion
|
|
2931
|
-
*/
|
|
2932
|
-
deleteDocument(identifier: string, propagate?: PropagationMode, signal?: AbortSignal): Promise<void>;
|
|
2933
|
-
/**
|
|
2934
|
-
* Deletes documents and waits for completion
|
|
2935
|
-
*/
|
|
2936
|
-
deleteDocuments(identifiers: string[], propagate?: PropagationMode, signal?: AbortSignal): Promise<void>;
|
|
2937
|
-
/**
|
|
2938
|
-
* Retrieves the status of a job
|
|
2939
|
-
*/
|
|
2940
|
-
getJobStatus(jobId: string, signal?: AbortSignal): Promise<JobInfo>;
|
|
2941
|
-
/**
|
|
2942
|
-
* Waits for a job to complete
|
|
2943
|
-
*/
|
|
2944
|
-
waitForJob(jobId: string | JobInfo, signal?: AbortSignal): Promise<JobInfo>;
|
|
2945
|
-
/**
|
|
2946
|
-
* Subscribes to changes for documents matching specified filters
|
|
2947
|
-
*/
|
|
2948
|
-
subscribe(search: SearchFilter, callback: (event: DocumentChangeEvent) => void, view?: ViewFilter): () => void;
|
|
2949
|
-
private removeFromAllParents;
|
|
2950
|
-
private removeFromParent;
|
|
3056
|
+
declare class DriveClient implements IDriveClient {
|
|
3057
|
+
private readonly client;
|
|
3058
|
+
private readonly logger;
|
|
3059
|
+
private readonly reactor;
|
|
3060
|
+
private readonly signer;
|
|
3061
|
+
constructor(client: IReactorClient, logger: ILogger, reactor: IReactor, signer: ISigner);
|
|
3062
|
+
create(input: DriveInput, signal?: AbortSignal): Promise<DocumentDriveDocument>;
|
|
3063
|
+
addFile<TDocument extends PHDocument = PHDocument>(driveIdentifier: string, document: PHDocument, parentFolder?: string, signal?: AbortSignal): Promise<TDocument>;
|
|
3064
|
+
addFolder(driveIdentifier: string, name: string, parentFolder?: string, signal?: AbortSignal): Promise<FolderNode>;
|
|
3065
|
+
removeNode(driveIdentifier: string, nodeId: string, signal?: AbortSignal): Promise<void>;
|
|
3066
|
+
renameNode(driveIdentifier: string, nodeId: string, name: string, signal?: AbortSignal): Promise<Node>;
|
|
3067
|
+
moveNode(driveIdentifier: string, srcNodeId: string, targetParentFolderId: string | undefined, signal?: AbortSignal): Promise<DocumentDriveDocument>;
|
|
3068
|
+
copyNode(driveIdentifier: string, srcNodeId: string, targetParentFolderId: string | undefined, signal?: AbortSignal): Promise<DocumentDriveDocument>;
|
|
3069
|
+
getNode(driveIdentifier: string, nodeId: string, signal?: AbortSignal): Promise<Node>;
|
|
3070
|
+
listNodes(driveIdentifier: string, parentFolder?: string | null, signal?: AbortSignal): Promise<Node[]>;
|
|
3071
|
+
private removeFileNode;
|
|
2951
3072
|
}
|
|
2952
3073
|
//#endregion
|
|
2953
3074
|
//#region src/cache/write-cache-types.d.ts
|
|
@@ -3137,8 +3258,8 @@ declare class Reactor implements IReactor {
|
|
|
3137
3258
|
get<TDocument extends PHDocument>(id: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<TDocument>;
|
|
3138
3259
|
getBySlug<TDocument extends PHDocument>(slug: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<TDocument>;
|
|
3139
3260
|
getByIdOrSlug<TDocument extends PHDocument>(identifier: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<TDocument>;
|
|
3140
|
-
|
|
3141
|
-
|
|
3261
|
+
getOutgoingRelationships(sourceId: string, relationshipType: string, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<string[]>;
|
|
3262
|
+
getIncomingRelationships(targetId: string, relationshipType: string, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<string[]>;
|
|
3142
3263
|
getOperations(documentId: string, view?: ViewFilter, filter?: OperationFilter, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<Record<string, PagedResults<Operation>>>;
|
|
3143
3264
|
find(search: SearchFilter, view?: ViewFilter, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
|
|
3144
3265
|
create(document: PHDocument, signer?: ISigner, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<JobInfo>;
|
|
@@ -3147,8 +3268,8 @@ declare class Reactor implements IReactor {
|
|
|
3147
3268
|
load(docId: string, branch: string, operations: Operation[], signal?: AbortSignal, meta?: Record<string, unknown>): Promise<JobInfo>;
|
|
3148
3269
|
executeBatch(request: BatchExecutionRequest, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<BatchExecutionResult>;
|
|
3149
3270
|
loadBatch(request: BatchLoadRequest, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<BatchLoadResult>;
|
|
3150
|
-
|
|
3151
|
-
|
|
3271
|
+
addRelationship(sourceId: string, targetId: string, relationshipType: string, branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
|
|
3272
|
+
removeRelationship(sourceId: string, targetId: string, relationshipType: string, branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
|
|
3152
3273
|
getJobStatus(jobId: string, signal?: AbortSignal): Promise<JobInfo>;
|
|
3153
3274
|
private findByIds;
|
|
3154
3275
|
private findBySlugs;
|
|
@@ -4369,5 +4490,5 @@ declare class ProcessorManager extends BaseReadModel implements IProcessorManage
|
|
|
4369
4490
|
private deleteProcessorCursors;
|
|
4370
4491
|
}
|
|
4371
4492
|
//#endregion
|
|
4372
|
-
export { type AtomicTxn, BaseReadModel, type BatchLoadRequest, type BatchLoadResult, type CachedSnapshot, type ChannelConfig, ChannelError, ChannelErrorSource, type ChannelHealth, type ChannelMeta, ChannelScheme, type ConnectionState, type ConnectionStateChangeCallback, type ConnectionStateChangedEvent, type ConnectionStateSnapshot, type ConsistencyCoordinate, type ConsistencyKey, type ConsistencyToken, ConsistencyTracker, type Database, type DeadLetterAddedEvent, DefaultSubscriptionErrorHandler, type DocumentChangeEvent, DocumentChangeType, type DocumentGraphEdge, type DocumentIndexerDatabase, DocumentIntegrityService, DocumentModelRegistry, type DocumentRelationship, type DocumentRevisions, type DocumentStreamKey, type DocumentViewDatabase, DuplicateManifestError, DuplicateModuleError, DuplicateOperationError, EventBus, EventBusAggregateError, type ExecutorStartedEvent, type ExecutorStoppedEvent, type GqlChannelConfig, GqlRequestChannel, GqlRequestChannelFactory, GqlResponseChannel, GqlResponseChannelFactory, type IChannel, type IChannelFactory, type IConsistencyTracker, type IDocumentGraph, type IDocumentIndexer, type IDocumentIntegrityService, type IDocumentModelLoader, type IDocumentModelRegistry, type IDocumentView, type IEventBus, type IJobAwaiter, type IJobExecutor, type IJobExecutorManager, type IJobTracker, type IKeyframeStore, type IOperationIndex, type IOperationStore, type IPollTimer, type IProcessor, type IProcessorHostModule, type IProcessorManager, type IQueue, type IReactor, type IReactorClient, type IReactorSubscriptionManager, type IReadModel, type IReadModelCoordinator, type IRelationalDb, type ISubscriptionErrorHandler, type ISyncCursorStorage, type ISyncManager, type ISyncRemoteStorage, type ISyncStatusTracker, type IWriteCache, SimpleJobExecutor as InMemoryJobExecutor, SimpleJobExecutor, InMemoryJobTracker, InMemoryQueue, type InsertableDocumentSnapshot, IntervalPollTimer, InvalidModuleError, type Job, type JobAvailableEvent, JobAwaiter, type JobCompletedEvent, type JobExecutorConfig, JobExecutorEventTypes, type JobExecutorFactory, type JobFailedEvent, type JobInfo, type JobPendingEvent, type JobReadReadyEvent, type JobResult, type JobRunningEvent, type JobStartedEvent, JobStatus, type JobWriteReadyEvent, type JwtHandler, type KeyframeSnapshot, type KeyframeValidationIssue, KyselyDocumentIndexer, KyselyDocumentView, KyselyKeyframeStore, KyselyOperationStore, KyselySyncCursorStorage, KyselySyncRemoteStorage, KyselyWriteCache, type LoadJobPlan, Mailbox, ModuleNotFoundError, NullDocumentModelResolver, type OperationBatch, type OperationContext, type OperationFilter, type OperationIndexEntry, type OperationTable, type OperationWithContext, OptimisticLockError, type PagedResults, type PagingOptions, type ParsedDriveUrl, PollingChannelError, type ProcessorApp, type ProcessorFactory, type ProcessorFactoryBuilder, type ProcessorFilter, ProcessorManager, type ProcessorRecord, type ProcessorStatus, PropagationMode, QueueEventTypes, REACTOR_SCHEMA, Reactor, ReactorBuilder, ReactorClient, ReactorClientBuilder, type ReactorClientModule, ReactorEventTypes, type ReactorFeatures, type JobFailedEvent$1 as ReactorJobFailedEvent, type ReactorModule, ReactorSubscriptionManager, ReadModelCoordinator, type RebuildResult, RelationalDbProcessor, RelationshipChangeType, type Remote, type RemoteCursor, type RemoteFilter, type RemoteOptions, type RemoteRecord, type RemoteStatus, RevisionMismatchError, type SearchFilter, type ShutdownStatus, type SignatureVerificationHandler, type SignerConfig, SimpleJobExecutorManager, type SnapshotValidationIssue, type Database$1 as StorageDatabase, type SubscriptionErrorContext, SyncBuilder, type SyncEnvelope, type SyncEnvelopeType, SyncEventTypes, type SyncFailedEvent, type SyncModule, SyncOperation, SyncOperationAggregateError, type SyncOperationErrorType, SyncOperationStatus, type SyncPendingEvent, SyncStatus, type SyncStatusChangeCallback, SyncStatusTracker, type SyncSucceededEvent, type TrackedProcessor, type Unsubscribe, type ValidationResult, type ViewFilter, type WriteCacheConfig, addRelationshipAction, batchOperationsByDocument, consolidateSyncOperations, createDocumentAction, createMutableShutdownStatus, createRelationalDb, deleteDocumentAction, documentActions, driveCollectionId, driveIdFromUrl, envelopesToSyncOperations, getMigrationStatus, makeConsistencyKey, parseDriveUrl, removeRelationshipAction, runMigrations, sortEnvelopesByFirstOperationTimestamp, trimMailboxFromAckOrdinal, upgradeDocumentAction };
|
|
4493
|
+
export { type AtomicTxn, type AttachmentHash, type AttachmentRef, BaseReadModel, type BatchLoadRequest, type BatchLoadResult, type CachedSnapshot, type ChannelConfig, ChannelError, ChannelErrorSource, type ChannelHealth, type ChannelMeta, ChannelScheme, type ConnectionState, type ConnectionStateChangeCallback, type ConnectionStateChangedEvent, type ConnectionStateSnapshot, type ConsistencyCoordinate, type ConsistencyKey, type ConsistencyToken, ConsistencyTracker, type Database, type DeadLetterAddedEvent, DefaultSubscriptionErrorHandler, type DocumentChangeEvent, DocumentChangeType, type DocumentGraphEdge, type DocumentIndexerDatabase, DocumentIntegrityService, DocumentModelRegistry, type DocumentRelationship, type DocumentRevisions, type DocumentStreamKey, type DocumentViewDatabase, DriveClient, DuplicateManifestError, DuplicateModuleError, DuplicateOperationError, EventBus, EventBusAggregateError, type ExecutorStartedEvent, type ExecutorStoppedEvent, type GqlChannelConfig, GqlRequestChannel, GqlRequestChannelFactory, GqlResponseChannel, GqlResponseChannelFactory, type IChannel, type IChannelFactory, type IConsistencyTracker, type IDocumentGraph, type IDocumentIndexer, type IDocumentIntegrityService, type IDocumentModelLoader, type IDocumentModelRegistry, type IDocumentView, type IDriveClient, type IEventBus, type IJobAwaiter, type IJobExecutor, type IJobExecutorManager, type IJobTracker, type IKeyframeStore, type IOperationIndex, type IOperationStore, type IPollTimer, type IProcessor, type IProcessorHostModule, type IProcessorManager, type IQueue, type IReactor, type IReactorClient, type IReactorSubscriptionManager, type IReadModel, type IReadModelCoordinator, type IRelationalDb, type ISubscriptionErrorHandler, type ISyncCursorStorage, type ISyncManager, type ISyncRemoteStorage, type ISyncStatusTracker, type IWriteCache, SimpleJobExecutor as InMemoryJobExecutor, SimpleJobExecutor, InMemoryJobTracker, InMemoryQueue, type InsertableDocumentSnapshot, IntervalPollTimer, InvalidModuleError, type Job, type JobAvailableEvent, JobAwaiter, type JobCompletedEvent, type JobExecutorConfig, JobExecutorEventTypes, type JobExecutorFactory, type JobFailedEvent, type JobInfo, type JobPendingEvent, type JobReadReadyEvent, type JobResult, type JobRunningEvent, type JobStartedEvent, JobStatus, type JobWriteReadyEvent, type JwtHandler, type KeyframeSnapshot, type KeyframeValidationIssue, KyselyDocumentIndexer, KyselyDocumentView, KyselyKeyframeStore, KyselyOperationStore, KyselySyncCursorStorage, KyselySyncRemoteStorage, KyselyWriteCache, type LoadJobPlan, Mailbox, ModuleNotFoundError, NullDocumentModelResolver, type OperationBatch, type OperationContext, type OperationFilter, type OperationIndexEntry, type OperationTable, type OperationWithContext, OptimisticLockError, type PagedResults, type PagingOptions, type ParsedDriveUrl, PollingChannelError, type ProcessorApp, type ProcessorFactory, type ProcessorFactoryBuilder, type ProcessorFilter, ProcessorManager, type ProcessorRecord, type ProcessorStatus, PropagationMode, QueueEventTypes, REACTOR_SCHEMA, Reactor, ReactorBuilder, ReactorClient, ReactorClientBuilder, type ReactorClientModule, ReactorEventTypes, type ReactorFeatures, type JobFailedEvent$1 as ReactorJobFailedEvent, type ReactorModule, ReactorSubscriptionManager, ReadModelCoordinator, type RebuildResult, RelationalDbProcessor, RelationshipChangeType, type Remote, type RemoteCursor, type RemoteFilter, type RemoteOptions, type RemoteRecord, type RemoteStatus, RevisionMismatchError, type SearchFilter, type ShutdownStatus, type SignatureVerificationHandler, type SignerConfig, SimpleJobExecutorManager, type SnapshotValidationIssue, type Database$1 as StorageDatabase, type SubscriptionErrorContext, SyncBuilder, type SyncEnvelope, type SyncEnvelopeType, SyncEventTypes, type SyncFailedEvent, type SyncModule, SyncOperation, SyncOperationAggregateError, type SyncOperationErrorType, SyncOperationStatus, type SyncPendingEvent, SyncStatus, type SyncStatusChangeCallback, SyncStatusTracker, type SyncSucceededEvent, type TrackedProcessor, type Unsubscribe, type ValidationResult, type ViewFilter, type WriteCacheConfig, addRelationshipAction, batchOperationsByDocument, consolidateSyncOperations, createDocumentAction, createMutableShutdownStatus, createRelationalDb, deleteDocumentAction, documentActions, driveCollectionId, driveIdFromUrl, envelopesToSyncOperations, getMigrationStatus, makeConsistencyKey, parseDriveUrl, removeRelationshipAction, runMigrations, sortEnvelopesByFirstOperationTimestamp, trimMailboxFromAckOrdinal, upgradeDocumentAction };
|
|
4373
4494
|
//# sourceMappingURL=index.d.ts.map
|