interface SerializeOptions { /** * set this to true if you need to deserialize the domain objects losslessly * * note * - this will make it so we do not call `getUniqueIdentifier` on the nested domain objects * - by default, this is set to false, so that this can be used for change detection */ lossless?: boolean; /** * set this to true if the order of items in arrays does not matter in your usecase * * note * - this will make it so that the original order of items in arrays is not preserved * - by default, this is set to false, since order matters in arrays by common definition */ orderless?: boolean; } /** * Returns a deterministic, human readable, and de-serializable string representation of a Domain Object. * * Deterministic: * - orders object keys * - sorts elements in arrays * - when lossless=false, replaces nested domain objects with their minimal and static representation (i.e., calls `getUniqueIdentifier` on any nested domain objects) * * Use Cases: * - change detection * - e.g., determine whether there has been a change to an entity or not, by serializing the previous and current versions, and comparing equality * - i.e., `const areEqual = serialize(omitMetadata(userBefore)) === serialize(omitMetadata(userNow));` * * - identity comparison * - e.g., determine whether two domain objects are the same, by getting their unique identities, serializing each and comparing equality * - i.e., `const areEqual = serialize(getUniqueIdentity(contactMethod1)) === serialize(getUniqueIdentity(contactMethod2))` * * - persistance * - e.g., serialize domain objects into a persistant store in string format (to be later revived with the `deserialize` method) */ export declare const serialize: (value: any, options?: SerializeOptions) => string; export {};