document-drive 1.0.0-alpha.21 → 1.0.0-alpha.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-drive",
3
- "version": "1.0.0-alpha.21",
3
+ "version": "1.0.0-alpha.22",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "module": "./src/index.ts",
@@ -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,
@@ -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<void>;
145
+ abstract addDrive(drive: DriveInput): Promise<DocumentDriveDocument>;
146
146
  abstract addRemoteDrive(
147
147
  url: string,
148
148
  options: RemoteDriveOptions
149
- ): Promise<void>;
149
+ ): Promise<DocumentDriveDocument>;
150
150
  abstract deleteDrive(id: string): Promise<void>;
151
151
  abstract getDrive(
152
152
  id: string,