@syncot/client-storage
Advanced tools
Comparing version 0.0.3 to 0.0.4
import { Operation, Snapshot } from '@syncot/type'; | ||
import { Id } from '@syncot/util'; | ||
export interface ClientStorageStatus { | ||
readonly documentId: Id; | ||
readonly documentId: string; | ||
readonly documentType: string; | ||
@@ -10,3 +9,3 @@ readonly initialized: boolean; | ||
readonly lastVersion: number; | ||
readonly sessionId: Id; | ||
readonly sessionId: string; | ||
} | ||
@@ -38,7 +37,7 @@ /** | ||
*/ | ||
clear(documentType: string, documentId: Id): Promise<void>; | ||
clear(documentType: string, documentId: string): Promise<void>; | ||
/** | ||
* Returns the storage status for the specified combination of `documentType` and `documentId`. | ||
*/ | ||
getStatus(documentType: string, documentId: Id): Promise<ClientStorageStatus>; | ||
getStatus(documentType: string, documentId: string): Promise<ClientStorageStatus>; | ||
/** | ||
@@ -78,3 +77,3 @@ * Stores the specified operation. | ||
*/ | ||
load(documentType: string, documentId: Id, minVersion?: number, maxVersion?: number): Promise<Operation[]>; | ||
load(documentType: string, documentId: string, minVersion?: number, maxVersion?: number): Promise<Operation[]>; | ||
} |
import { TypeManager } from '@syncot/type'; | ||
import { Id } from '@syncot/util'; | ||
import { ClientStorage } from '.'; | ||
export declare const clientStorageTests: (createClientStorage: (options: { | ||
sessionId: Id; | ||
sessionId: string; | ||
typeManager: TypeManager; | ||
}) => ClientStorage) => void; |
@@ -149,12 +149,2 @@ import { createTypeManager, } from '@syncot/type'; | ||
}); | ||
await clientStorage.init({ | ||
...snapshot, | ||
documentId: 5, | ||
version: 0, | ||
}); | ||
await clientStorage.init({ | ||
...snapshot, | ||
documentId: Buffer.from('binary-id'), | ||
version: 0, | ||
}); | ||
await expect(getStatus(documentType, documentId)).resolves.toEqual(status); | ||
@@ -169,20 +159,8 @@ await expect(getStatus('type-2', documentId)).resolves.toEqual({ | ||
}); | ||
await expect(getStatus(documentType, 5)).resolves.toEqual({ | ||
...status0, | ||
documentId: 5, | ||
}); | ||
await expect(getStatus(documentType, Buffer.from('binary-id'))).resolves.toEqual({ | ||
...status0, | ||
documentId: Buffer.from('binary-id'), | ||
}); | ||
await expect(load(documentType, documentId)).resolves.toEqual([]); | ||
await expect(load('type-2', documentId)).resolves.toEqual([]); | ||
await expect(load(documentType, 'id-2')).resolves.toEqual([]); | ||
await expect(load(documentType, 5)).resolves.toEqual([]); | ||
await expect(load(documentType, Buffer.from('binary-id'))).resolves.toEqual([]); | ||
await clientStorage.clear(documentType, documentId); | ||
await clientStorage.clear('type-2', documentId); | ||
await clientStorage.clear(documentType, 'id-2'); | ||
await clientStorage.clear(documentType, 5); | ||
await clientStorage.clear(documentType, Buffer.from('binary-id')); | ||
await expect(getStatus(documentType, documentId)).resolves.toEqual(uninitializedStatus0); | ||
@@ -197,10 +175,2 @@ await expect(getStatus('type-2', documentId)).resolves.toEqual({ | ||
}); | ||
await expect(getStatus(documentType, 5)).resolves.toEqual({ | ||
...uninitializedStatus0, | ||
documentId: 5, | ||
}); | ||
await expect(getStatus(documentType, Buffer.from('binary-id'))).resolves.toEqual({ | ||
...uninitializedStatus0, | ||
documentId: Buffer.from('binary-id'), | ||
}); | ||
}); | ||
@@ -207,0 +177,0 @@ }); |
{ | ||
"name": "@syncot/client-storage", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Interfaces and types related to storing document data in the client.", | ||
@@ -29,7 +29,6 @@ "keywords": [ | ||
"dependencies": { | ||
"@syncot/type": "^0.0.3", | ||
"@syncot/util": "^0.0.1", | ||
"@syncot/type": "^0.0.4", | ||
"tslib": "^1.9.3" | ||
}, | ||
"gitHead": "bd4d64ce07f354f6123f71b6f6ba0796bc5b198b" | ||
"gitHead": "b952421ee19e038a054420c80e3b870f52e23ed9" | ||
} |
2
25852
546
+ Added@syncot/type@0.0.4(transitive)
+ Added@syncot/util@0.0.2(transitive)
- Removed@syncot/util@^0.0.1
- Removed@syncot/type@0.0.3(transitive)
- Removed@syncot/util@0.0.1(transitive)
Updated@syncot/type@^0.0.4