♻️ Split SsnDiffType interface into separate file

This commit is contained in:
C-3PO 2018-11-16 00:48:36 +01:00
parent 9aff99ae86
commit bddaef0373
Signed by: c3po
GPG key ID: 62993C4BB4D86F24
9 changed files with 23 additions and 23 deletions

View file

@ -2,7 +2,7 @@
export { default as IManifest } from './interfaces/IManifest'; export { default as IManifest } from './interfaces/IManifest';
export { default as ISolidSimple } from './interfaces/ISolidSimple'; export { default as ISolidSimple } from './interfaces/ISolidSimple';
export { ISsnFileEntry } from './interfaces/ISsnFileEntry'; export { default as ISsnFileEntry } from './interfaces/ISsnFileEntry';
export { default as Product } from './interfaces/Product'; export { default as Product } from './interfaces/Product';
export { default as findReleasePath } from './ssn/findReleasePath'; export { default as findReleasePath } from './ssn/findReleasePath';
export { default as getManifest } from './ssn/getManifest'; export { default as getManifest } from './ssn/getManifest';

View file

@ -20,7 +20,7 @@ interface ISolidInfo {
uniqueid: string; uniqueid: string;
} }
interface ISolid { export default interface ISolid {
/** Timestamp when this torrent was created, given in seconds since 1970. Can be read with `new Date(... * 1000)`. */ /** Timestamp when this torrent was created, given in seconds since 1970. Can be read with `new Date(... * 1000)`. */
'creation date': number; 'creation date': number;
/** Internal tracker URL used to announce this torrent. */ /** Internal tracker URL used to announce this torrent. */
@ -36,5 +36,3 @@ interface ISolid {
/** Contains further information about this torrent, including the list of files. */ /** Contains further information about this torrent, including the list of files. */
info: ISolidInfo; info: ISolidInfo;
} }
export default ISolid;

View file

@ -1,15 +1,6 @@
enum SsnDiffType { import SsnDiffType from './SsnDiffType';
/** We included the original file contents, not just the differences, because file is new or it's in a format that's not suitable for diffing. */
NewFile = 0,
/** File is not included in the .zip archive because it has been deleted. */
Deleted = 1,
/** File has changed and we include the differences, encoded in vcdiff/xdelta3 */
Changed = 2,
/** File is not included in the .zip archive because it hasn't changed */
Unchanged = 3,
}
interface ISsnFileEntry { export default interface ISsnFileEntry {
/** CRC-32 checksum of this file. */ /** CRC-32 checksum of this file. */
crc: number; crc: number;
/** If we only store the differences, the size of the destination file. */ /** If we only store the differences, the size of the destination file. */
@ -33,5 +24,3 @@ interface ISsnFileEntry {
/** Offset into the disk to where the local file header starts. */ /** Offset into the disk to where the local file header starts. */
offset: number; offset: number;
} }
export { ISsnFileEntry, SsnDiffType };

View file

@ -0,0 +1,12 @@
enum SsnDiffType {
/** We included the original file contents, not just the differences, because file is new or it's in a format that's not suitable for diffing. */
NewFile = 0,
/** File is not included in the .zip archive because it has been deleted. */
Deleted = 1,
/** File has changed and we include the differences, encoded in vcdiff/xdelta3 */
Changed = 2,
/** File is not included in the .zip archive because it hasn't changed */
Unchanged = 3,
}
export default SsnDiffType;

View file

@ -1,6 +1,6 @@
import * as stream from 'stream'; import * as stream from 'stream';
import * as zlib from 'zlib'; import * as zlib from 'zlib';
import { ISsnFileEntry } from '../interfaces/ISsnFileEntry'; import ISsnFileEntry from '../interfaces/ISsnFileEntry';
import decryptTransform from './streams/decryptTransform'; import decryptTransform from './streams/decryptTransform';
import readBytesFromStream from './streams/readBytesFromStream'; import readBytesFromStream from './streams/readBytesFromStream';

View file

@ -1,5 +1,5 @@
import getUrlContents from '../cdn/getUrlContents'; import getUrlContents from '../cdn/getUrlContents';
import { ISsnFileEntry } from '../interfaces/ISsnFileEntry'; import ISsnFileEntry from '../interfaces/ISsnFileEntry';
import Product from '../interfaces/Product'; import Product from '../interfaces/Product';
import getSolidpkg from './getSolidpkg'; import getSolidpkg from './getSolidpkg';
import readSsnFile from './reader/readSsnFile'; import readSsnFile from './reader/readSsnFile';

View file

@ -3,8 +3,9 @@ import * as path from 'path';
import downloadWrapper from '../cdn/downloadWrapper'; import downloadWrapper from '../cdn/downloadWrapper';
import createDirRecursively from '../cdn/funcs/createDirRecursively'; import createDirRecursively from '../cdn/funcs/createDirRecursively';
import getUrlContents from '../cdn/getUrlContents'; import getUrlContents from '../cdn/getUrlContents';
import { ISsnFileEntry, SsnDiffType } from '../interfaces/ISsnFileEntry'; import ISsnFileEntry from '../interfaces/ISsnFileEntry';
import Product from '../interfaces/Product'; import Product from '../interfaces/Product';
import SsnDiffType from '../interfaces/SsnDiffType';
import getSolidpkg from './getSolidpkg'; import getSolidpkg from './getSolidpkg';
import launch from './installation/launch'; import launch from './installation/launch';
import taskManager from './installation/taskManager'; import taskManager from './installation/taskManager';

View file

@ -3,7 +3,7 @@
* Check the .ZIP File Format Specification <https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT>. * Check the .ZIP File Format Specification <https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT>.
*/ */
import { ISsnFileEntry } from '../../interfaces/ISsnFileEntry'; import ISsnFileEntry from '../../interfaces/ISsnFileEntry';
import getDecryptionKeys from '../decryption/getDecryptionKeys'; import getDecryptionKeys from '../decryption/getDecryptionKeys';
import modifyPassword from '../decryption/modifyPassword'; import modifyPassword from '../decryption/modifyPassword';

View file

@ -1,6 +1,6 @@
import { ISsnFileEntry } from '../../interfaces/ISsnFileEntry'; import ISsnFileEntry from '../../interfaces/ISsnFileEntry';
import { SsnDiffType } from '../../interfaces/ISsnFileEntry';
import Product from '../../interfaces/Product'; import Product from '../../interfaces/Product';
import SsnDiffType from '../../interfaces/SsnDiffType';
/** Receives a list of file entries from the .zip file and checks them for correctness */ /** Receives a list of file entries from the .zip file and checks them for correctness */
export default function verifyPatch(fileEntries: ISsnFileEntry[], product: Product, from: number): void { export default function verifyPatch(fileEntries: ISsnFileEntry[], product: Product, from: number): void {