From bb57e99d048fdac576d0c98b2d27793a0967ab78 Mon Sep 17 00:00:00 2001 From: C-3PO Date: Fri, 2 Nov 2018 02:34:29 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=91=EF=B8=8F=20Remove=20unused=20ISett?= =?UTF-8?q?ings=20interface?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.ts | 2 +- src/interfaces/ISettings.ts | 11 ----------- src/interfaces/ISolidFile.ts | 4 ++-- src/interfaces/Product.ts | 24 ++++++++++++++++++++++++ src/ssn/findReleasePath.ts | 2 +- src/ssn/getManifest.ts | 2 +- src/ssn/getPatchZip.ts | 2 +- src/ssn/getSolidpkg.ts | 2 +- src/ssn/installPatch.ts | 2 +- src/ssn/verify/verifyPatch.ts | 2 +- src/ssn/verify/verifyPatchmanifest.ts | 2 +- src/ssn/verify/verifyProductName.ts | 2 +- 12 files changed, 35 insertions(+), 22 deletions(-) delete mode 100644 src/interfaces/ISettings.ts create mode 100644 src/interfaces/Product.ts diff --git a/src/index.ts b/src/index.ts index 1ce0ef0..69455eb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,9 +1,9 @@ //Make endpoints available for import by other modules import IManifest from './interfaces/IManifest'; -import { Product } from './interfaces/ISettings'; import ISolidSimple from './interfaces/ISolidSimple'; import { ISsnFileEntry } from './interfaces/ISsnFileEntry'; +import Product from './interfaces/Product'; import findReleasePath from './ssn/findReleasePath'; import getManifest from './ssn/getManifest'; import getPatchZip from './ssn/getPatchZip'; diff --git a/src/interfaces/ISettings.ts b/src/interfaces/ISettings.ts deleted file mode 100644 index da052ca..0000000 --- a/src/interfaces/ISettings.ts +++ /dev/null @@ -1,11 +0,0 @@ -type Product = 'assets_swtor_de_de' | 'assets_swtor_en_us' | 'assets_swtor_fr_fr' | 'assets_swtor_main' | 'assets_swtor_test_de_de' | 'assets_swtor_test_en_us' | 'assets_swtor_test_fr_fr' | 'assets_swtor_test_main' | 'eualas' | 'movies_de_de' | 'movies_en_us' | 'movies_fr_fr' | 'patcher2014' | 'patcher2017' | 'retailclient_betatest' | 'retailclient_cstraining' | 'retailclient_liveeptest' | 'retailclient_liveqatest' | 'retailclient_publictest' | 'retailclient_squadron157' | 'retailclient_swtor'; - -interface ISettings { - [key: string]: any; - product?: Product; - release?: number; //TODO: allow 'current', but how will we know what current version is? - from?: number; - outputType?: 'info' | 'file'; //whether to just show JSON information, or actually write files into a directory -} - -export { ISettings, Product }; diff --git a/src/interfaces/ISolidFile.ts b/src/interfaces/ISolidFile.ts index de1485b..4c32a61 100644 --- a/src/interfaces/ISolidFile.ts +++ b/src/interfaces/ISolidFile.ts @@ -5,7 +5,7 @@ interface ISolidFile { path: [string]; } -interface ISolidFileInfo { +interface ISolidInfo { /** List of files that are part of this torrent. */ files: ISolidFile[]; /** Length of one piece in bytes, i.e. 64 KiB, 128 KiB, 256 KiB, 512 KiB, 1 MiB, 2MiB or 4 MiB */ @@ -34,7 +34,7 @@ interface ISolid { /** Integer in the range 0-3 */ 'reliable-id': '0' | '1' | '2' | '3'; /** Contains further information about this torrent, including the list of files. */ - info: ISolidFileInfo; + info: ISolidInfo; } export default ISolid; diff --git a/src/interfaces/Product.ts b/src/interfaces/Product.ts new file mode 100644 index 0000000..544cee1 --- /dev/null +++ b/src/interfaces/Product.ts @@ -0,0 +1,24 @@ +type Product = + 'assets_swtor_de_de' | + 'assets_swtor_en_us' | + 'assets_swtor_fr_fr' | + 'assets_swtor_main' | + 'assets_swtor_test_de_de' | + 'assets_swtor_test_en_us' | + 'assets_swtor_test_fr_fr' | + 'assets_swtor_test_main' | + 'eualas' | + 'movies_de_de' | + 'movies_en_us' | + 'movies_fr_fr' | + 'patcher2014' | + 'patcher2017' | + 'retailclient_betatest' | + 'retailclient_cstraining' | + 'retailclient_liveeptest' | + 'retailclient_liveqatest' | + 'retailclient_publictest' | + 'retailclient_squadron157' | + 'retailclient_swtor'; + +export default Product; diff --git a/src/ssn/findReleasePath.ts b/src/ssn/findReleasePath.ts index 465bd41..73637f8 100644 --- a/src/ssn/findReleasePath.ts +++ b/src/ssn/findReleasePath.ts @@ -1,4 +1,4 @@ -import { Product } from '../interfaces/ISettings'; +import Product from '../interfaces/Product'; import verifyProductName from './verify/verifyProductName'; /** For the given release in the given product, returns from which releases we can patch to this release. */ diff --git a/src/ssn/getManifest.ts b/src/ssn/getManifest.ts index c8eca05..203e3ae 100644 --- a/src/ssn/getManifest.ts +++ b/src/ssn/getManifest.ts @@ -1,7 +1,7 @@ import * as xmlJs from 'xml-js'; import getUrlContents from '../cdn/getUrlContents'; import IManifest from '../interfaces/IManifest'; -import { Product } from '../interfaces/ISettings'; +import Product from '../interfaces/Product'; import extractFileAsStream from './extractFileAsStream'; import parsePatchmanifest from './reader/parsePatchmanifest'; import readSsnFile from './reader/readSsnFile'; diff --git a/src/ssn/getPatchZip.ts b/src/ssn/getPatchZip.ts index 9c9ee4a..395db30 100644 --- a/src/ssn/getPatchZip.ts +++ b/src/ssn/getPatchZip.ts @@ -1,6 +1,6 @@ import getUrlContents from '../cdn/getUrlContents'; -import { Product } from '../interfaces/ISettings'; import { ISsnFileEntry } from '../interfaces/ISsnFileEntry'; +import Product from '../interfaces/Product'; import getSolidpkg from './getSolidpkg'; import readSsnFile from './reader/readSsnFile'; import verifyPatch from './verify/verifyPatch'; diff --git a/src/ssn/getSolidpkg.ts b/src/ssn/getSolidpkg.ts index d1f2bce..dedaef4 100644 --- a/src/ssn/getSolidpkg.ts +++ b/src/ssn/getSolidpkg.ts @@ -1,7 +1,7 @@ import getUrlContents from '../cdn/getUrlContents'; -import { Product } from '../interfaces/ISettings'; import ISolid from '../interfaces/ISolidFile'; import ISolidSimple from '../interfaces/ISolidSimple'; +import Product from '../interfaces/Product'; import extractFileAsStream from './extractFileAsStream'; import parseBencode from './reader/bencodeParser'; import readSsnFile from './reader/readSsnFile'; diff --git a/src/ssn/installPatch.ts b/src/ssn/installPatch.ts index 9705337..61456cc 100644 --- a/src/ssn/installPatch.ts +++ b/src/ssn/installPatch.ts @@ -3,8 +3,8 @@ import * as path from 'path'; import downloadWrapper from '../cdn/downloadWrapper'; import createDirRecursively from '../cdn/funcs/createDirRecursively'; import getUrlContents from '../cdn/getUrlContents'; -import { Product } from '../interfaces/ISettings'; import { ISsnFileEntry, SsnDiffType } from '../interfaces/ISsnFileEntry'; +import Product from '../interfaces/Product'; import getSolidpkg from './getSolidpkg'; import launch from './installation/launch'; import taskManager from './installation/taskManager'; diff --git a/src/ssn/verify/verifyPatch.ts b/src/ssn/verify/verifyPatch.ts index af4900a..a8cf1e7 100644 --- a/src/ssn/verify/verifyPatch.ts +++ b/src/ssn/verify/verifyPatch.ts @@ -1,6 +1,6 @@ -import { Product } from '../../interfaces/ISettings'; import { ISsnFileEntry } from '../../interfaces/ISsnFileEntry'; import { SsnDiffType } from '../../interfaces/ISsnFileEntry'; +import Product from '../../interfaces/Product'; /** 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 { diff --git a/src/ssn/verify/verifyPatchmanifest.ts b/src/ssn/verify/verifyPatchmanifest.ts index f2d73dd..fac5842 100644 --- a/src/ssn/verify/verifyPatchmanifest.ts +++ b/src/ssn/verify/verifyPatchmanifest.ts @@ -1,5 +1,5 @@ import * as xmlJs from 'xml-js'; -import { Product } from '../../interfaces/ISettings'; +import Product from '../../interfaces/Product'; /** Receives a JSON-converted version of the manifest.xml file, and verifies that all required elements and attributes are present, and nothing more */ export default function verifyPatchmanifest(manifestFile: xmlJs.Element, product: Product): void { diff --git a/src/ssn/verify/verifyProductName.ts b/src/ssn/verify/verifyProductName.ts index c8d70d6..6ee45bc 100644 --- a/src/ssn/verify/verifyProductName.ts +++ b/src/ssn/verify/verifyProductName.ts @@ -1,4 +1,4 @@ -import { Product } from '../../interfaces/ISettings'; +import Product from '../../interfaces/Product'; const allowedProducts: Product[] = [ 'assets_swtor_de_de',