@@ -4,7 +4,7 @@ import {Collection} from "./collection";
44import { clone } from "./clone" ;
55import { Doc , StorageAdapter } from "../../common/types" ;
66import { PLUGINS } from "../../common/plugin" ;
7- import { Serialization , deserializeLegacyDB } from "./serialization/serialization " ;
7+ import { Serialization , migrateDatabase } from "./serialization/migrate " ;
88
99function getENV ( ) : Loki . Environment {
1010 if ( global !== undefined && ( global [ "android" ] || global [ "NSObject" ] ) ) {
@@ -49,7 +49,7 @@ export class Loki extends LokiEventEmitter {
4949 // currently keeping persistenceMethod and persistenceAdapter as loki level properties that
5050 // will not or cannot be deserialized You are required to configure persistence every time
5151 // you instantiate a loki object (or use default environment detection) in order to load the database anyways.
52- private _serializationMethod : Loki . SerializedMethod ;
52+ private _serializationMethod : Loki . SerializationMethod ;
5353 private _destructureDelimiter : string ;
5454 // persistenceMethod could be 'fs', 'localStorage', or 'adapter'
5555 // this is optional option param, otherwise environment detection will be used
@@ -74,7 +74,7 @@ export class Loki extends LokiEventEmitter {
7474 * @param {string } filename - name of the file to be saved to
7575 * @param {object } [options={}] - options
7676 * @param {Loki.Environment } [options.env] - the javascript environment
77- * @param {Loki.SerializedMethod } [options.serializationMethod=NORMAL] - the serialization method
77+ * @param {Loki.SerializationMethod } [options.serializationMethod=NORMAL] - the serialization method
7878 * @param {string } [options.destructureDelimiter="$<\n"] - string delimiter used for destructured serialization
7979 */
8080 constructor ( filename = "loki.db" , options : Loki . Options = { } ) {
@@ -666,7 +666,7 @@ export class Loki extends LokiEventEmitter {
666666 public loadJSONObject ( obj : Serialization . Serialized , options : Collection . DeserializeOptions = { } ) : void {
667667
668668 const databaseVersion = obj . databaseVersion ;
669- const dbObj = deserializeLegacyDB ( obj ) ;
669+ const dbObj = migrateDatabase ( obj ) ;
670670
671671 const len = dbObj . collections ? dbObj . collections . length : 0 ;
672672 this . filename = dbObj . filename ;
@@ -1045,7 +1045,7 @@ export class Loki extends LokiEventEmitter {
10451045export namespace Loki {
10461046 export interface Options {
10471047 env ?: Environment ;
1048- serializationMethod ?: SerializedMethod ;
1048+ serializationMethod ?: SerializationMethod ;
10491049 destructureDelimiter ?: string ;
10501050 }
10511051
@@ -1064,7 +1064,7 @@ export namespace Loki {
10641064 }
10651065
10661066 export interface SerializeOptions {
1067- serializationMethod ?: SerializedMethod ;
1067+ serializationMethod ?: SerializationMethod ;
10681068 }
10691069
10701070 export interface SerializeDestructuredOptions {
@@ -1089,7 +1089,7 @@ export namespace Loki {
10891089
10901090 export type LoadDatabaseOptions = Collection . DeserializeOptions & ThrottledDrainOptions ;
10911091
1092- export type SerializedMethod = "normal" | "pretty" | "destructured" ;
1092+ export type SerializationMethod = "normal" | "pretty" | "destructured" ;
10931093
10941094 export type PersistenceMethod = "fs-storage" | "local-storage" | "indexed-storage" | "memory-storage" | "adapter" ;
10951095
0 commit comments