document-drive 1.0.0-alpha.5 → 1.0.0-alpha.7

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.5",
3
+ "version": "1.0.0-alpha.7",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "module": "./src/index.ts",
@@ -19,7 +19,12 @@ import {
19
19
  import { createNanoEvents, Unsubscribe } from 'nanoevents';
20
20
  import { MemoryStorage } from '../storage/memory';
21
21
  import type { DocumentStorage, IDriveStorage } from '../storage/types';
22
- import { generateUUID, isDocumentDrive, isNoopUpdate } from '../utils';
22
+ import {
23
+ generateUUID,
24
+ isBefore,
25
+ isDocumentDrive,
26
+ isNoopUpdate
27
+ } from '../utils';
23
28
  import { requestPublicDrive } from '../utils/graphql';
24
29
  import { OperationError } from './error';
25
30
  import { ListenerManager } from './listener/manager';
@@ -306,7 +311,7 @@ export class DocumentDriveServer extends BaseDocumentDriveServer {
306
311
  operation =>
307
312
  Object.keys(filter).length === 0 ||
308
313
  ((filter.since === undefined ||
309
- filter.since <= operation.timestamp) &&
314
+ isBefore(filter.since, operation.timestamp)) &&
310
315
  (filter.fromRevision === undefined ||
311
316
  operation.index > filter.fromRevision))
312
317
  );
@@ -75,3 +75,8 @@ export function isNoopUpdate(
75
75
  isSkipOpGreaterThanLatestOp
76
76
  );
77
77
  }
78
+
79
+ // return true if dateA is before dateB
80
+ export function isBefore(dateA: Date | string, dateB: Date | string) {
81
+ return new Date(dateA) < new Date(dateB);
82
+ }