document-drive 1.0.0-experimental.21 → 1.0.0-experimental.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/queue/base.ts +1 -1
- package/src/server/index.ts +8 -5
- package/src/server/types.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "document-drive",
|
|
3
|
-
"version": "1.0.0-experimental.
|
|
3
|
+
"version": "1.0.0-experimental.22",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./src/index.ts",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@typescript-eslint/parser": "^6.21.0",
|
|
67
67
|
"@vitest/coverage-v8": "^1.4.0",
|
|
68
68
|
"document-model": "1.1.0-experimental.4",
|
|
69
|
-
"document-model-libs": "1.
|
|
69
|
+
"document-model-libs": "1.52.0",
|
|
70
70
|
"eslint": "^8.57.0",
|
|
71
71
|
"eslint-config-prettier": "^9.1.0",
|
|
72
72
|
"fake-indexeddb": "^5.0.2",
|
package/src/queue/base.ts
CHANGED
|
@@ -237,7 +237,7 @@ export class BaseQueueManager implements IQueueManager {
|
|
|
237
237
|
|
|
238
238
|
try {
|
|
239
239
|
const result = await this.delegate.processOperationJob(nextJob);
|
|
240
|
-
await queue.setResult(nextJob.jobId, result);
|
|
240
|
+
// await queue.setResult(nextJob.jobId, result);
|
|
241
241
|
|
|
242
242
|
// unblock the document queues of each add_file operation
|
|
243
243
|
const addFileOperations = nextJob.operations.filter((op) => op.type === "ADD_FILE");
|
package/src/server/index.ts
CHANGED
|
@@ -667,7 +667,7 @@ export class DocumentDriveServer extends BaseDocumentDriveServer {
|
|
|
667
667
|
: merge(trunk, invertedTrunk, reshuffleByTimestamp);
|
|
668
668
|
|
|
669
669
|
const newOperations = newHistory.filter(
|
|
670
|
-
(op
|
|
670
|
+
(op) => trunk.length < 1 || precedes(trunk[trunk.length - 1]!, op)
|
|
671
671
|
);
|
|
672
672
|
|
|
673
673
|
for (const nextOperation of newOperations) {
|
|
@@ -741,7 +741,11 @@ export class DocumentDriveServer extends BaseDocumentDriveServer {
|
|
|
741
741
|
undefined,
|
|
742
742
|
documentStorage,
|
|
743
743
|
undefined,
|
|
744
|
-
{
|
|
744
|
+
{
|
|
745
|
+
...options,
|
|
746
|
+
checkHashes: options?.checkHashes ?? true,
|
|
747
|
+
reuseOperationResultingState: options?.checkHashes ?? true
|
|
748
|
+
}
|
|
745
749
|
) as T;
|
|
746
750
|
}
|
|
747
751
|
|
|
@@ -792,7 +796,7 @@ export class DocumentDriveServer extends BaseDocumentDriveServer {
|
|
|
792
796
|
);
|
|
793
797
|
}
|
|
794
798
|
},
|
|
795
|
-
{ skip: operation.skip, reuseOperationResultingState: true
|
|
799
|
+
{ skip: operation.skip, reuseOperationResultingState: true }
|
|
796
800
|
) as T;
|
|
797
801
|
|
|
798
802
|
const appliedOperation = newDocument.operations[operation.scope].filter(
|
|
@@ -884,7 +888,6 @@ export class DocumentDriveServer extends BaseDocumentDriveServer {
|
|
|
884
888
|
}
|
|
885
889
|
});
|
|
886
890
|
const unsubscribeError = this.queueManager.on('jobFailed', (job, error) => {
|
|
887
|
-
console.log("test")
|
|
888
891
|
if (job.jobId === jobId) {
|
|
889
892
|
unsubscribe();
|
|
890
893
|
unsubscribeError();
|
|
@@ -1259,7 +1262,7 @@ export class DocumentDriveServer extends BaseDocumentDriveServer {
|
|
|
1259
1262
|
const document = await this.getDrive(drive);
|
|
1260
1263
|
const operations = this._buildOperations(document, actions);
|
|
1261
1264
|
const result = await this.queueDriveOperations(drive, operations);
|
|
1262
|
-
return result
|
|
1265
|
+
return result;
|
|
1263
1266
|
}
|
|
1264
1267
|
|
|
1265
1268
|
async addInternalListener(
|
package/src/server/types.ts
CHANGED
|
@@ -14,6 +14,7 @@ import type {
|
|
|
14
14
|
Document,
|
|
15
15
|
Operation,
|
|
16
16
|
OperationScope,
|
|
17
|
+
ReducerOptions,
|
|
17
18
|
Signal,
|
|
18
19
|
State
|
|
19
20
|
} from 'document-model/document';
|
|
@@ -140,7 +141,7 @@ export type PartialRecord<K extends keyof any, T> = {
|
|
|
140
141
|
|
|
141
142
|
export type RevisionsFilter = PartialRecord<OperationScope, number>;
|
|
142
143
|
|
|
143
|
-
export type GetDocumentOptions = {
|
|
144
|
+
export type GetDocumentOptions = ReducerOptions & {
|
|
144
145
|
revisions?: RevisionsFilter;
|
|
145
146
|
checkHashes?: boolean;
|
|
146
147
|
};
|