document-drive 1.0.0-alpha.21 → 1.0.0-alpha.23
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
CHANGED
package/src/server/index.ts
CHANGED
|
@@ -399,7 +399,7 @@ export class DocumentDriveServer extends BaseDocumentDriveServer {
|
|
|
399
399
|
}
|
|
400
400
|
|
|
401
401
|
async addDrive(drive: DriveInput) {
|
|
402
|
-
const id = drive.global.id
|
|
402
|
+
const id = drive.global.id || generateUUID();
|
|
403
403
|
if (!id) {
|
|
404
404
|
throw new Error('Invalid Drive Id');
|
|
405
405
|
}
|
|
@@ -417,6 +417,7 @@ export class DocumentDriveServer extends BaseDocumentDriveServer {
|
|
|
417
417
|
|
|
418
418
|
await this.storage.createDrive(id, document);
|
|
419
419
|
await this._initializeDrive(id);
|
|
420
|
+
return document;
|
|
420
421
|
}
|
|
421
422
|
|
|
422
423
|
async addRemoteDrive(url: string, options: RemoteDriveOptions) {
|
|
@@ -667,6 +668,13 @@ export class DocumentDriveServer extends BaseDocumentDriveServer {
|
|
|
667
668
|
{ existingOperation, newOperation: op }
|
|
668
669
|
);
|
|
669
670
|
continue;
|
|
671
|
+
} else if (!existingOperation) {
|
|
672
|
+
error = new OperationError(
|
|
673
|
+
'MISSING',
|
|
674
|
+
op,
|
|
675
|
+
`Missing operation on index ${nextIndex}`
|
|
676
|
+
);
|
|
677
|
+
continue;
|
|
670
678
|
}
|
|
671
679
|
} else {
|
|
672
680
|
if (noopUpdate) {
|
|
@@ -42,6 +42,7 @@ export class ListenerManager extends BaseListenerManager {
|
|
|
42
42
|
this.listenerState.set(drive, new Map());
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
45
46
|
const driveMap = this.listenerState.get(drive)!;
|
|
46
47
|
driveMap.set(listener.listenerId, {
|
|
47
48
|
block: listener.block,
|
package/src/server/types.ts
CHANGED
|
@@ -142,11 +142,11 @@ export type GetDocumentOptions = {
|
|
|
142
142
|
export abstract class BaseDocumentDriveServer {
|
|
143
143
|
/** Public methods **/
|
|
144
144
|
abstract getDrives(): Promise<string[]>;
|
|
145
|
-
abstract addDrive(drive: DriveInput): Promise<
|
|
145
|
+
abstract addDrive(drive: DriveInput): Promise<DocumentDriveDocument>;
|
|
146
146
|
abstract addRemoteDrive(
|
|
147
147
|
url: string,
|
|
148
148
|
options: RemoteDriveOptions
|
|
149
|
-
): Promise<
|
|
149
|
+
): Promise<DocumentDriveDocument>;
|
|
150
150
|
abstract deleteDrive(id: string): Promise<void>;
|
|
151
151
|
abstract getDrive(
|
|
152
152
|
id: string,
|