Stubbed missing types from 3rd party modules

This commit is contained in:
Jonathan Barrow
2023-03-18 10:12:37 -04:00
parent dd952954fd
commit 0d3d6fcce7
8 changed files with 494 additions and 348 deletions

721
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -60,7 +60,6 @@
"@types/dicer": "^0.2.2",
"@types/express": "^4.17.17",
"@types/fs-extra": "^11.0.1",
"@types/mongoose-unique-validator": "^1.0.7",
"@types/morgan": "^1.9.4",
"@types/node": "^18.14.4",
"@types/node-rsa": "^1.1.1",

View File

@@ -172,8 +172,8 @@ PNIDSchema.method('generateMiiImages', async function generateMiiImages(): Promi
const mii: Mii = new Mii(Buffer.from(miiData, 'base64'));
const miiStudioUrl: string = mii.studioUrl({
type: 'face',
width: '128',
instanceCount: '1',
width: 128,
instanceCount: 1,
});
const miiStudioNormalFaceImageData: Buffer = await got(miiStudioUrl).buffer();
const pngData: {
@@ -193,8 +193,8 @@ PNIDSchema.method('generateMiiImages', async function generateMiiImages(): Promi
const miiStudioExpressionUrl: string = mii.studioUrl({
type: 'face',
expression: expression,
width: '128',
instanceCount: '1',
width: 128,
instanceCount: 1,
});
const miiStudioExpressionImageData: Buffer = await got(miiStudioExpressionUrl).buffer();
await uploadCDNAsset('pn-cdn', `${userMiiKey}/${expression}.png`, miiStudioExpressionImageData, 'public-read');
@@ -202,8 +202,8 @@ PNIDSchema.method('generateMiiImages', async function generateMiiImages(): Promi
const miiStudioBodyUrl: string = mii.studioUrl({
type: 'all_body',
width: '270',
instanceCount: '1',
width: 270,
instanceCount: 1,
});
const miiStudioBodyImageData: Buffer = await got(miiStudioBodyUrl).buffer();
await uploadCDNAsset('pn-cdn', `${userMiiKey}/body.png`, miiStudioBodyImageData, 'public-read');

3
src/types/express-subdomain.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
declare module 'express-subdomain';
// TODO - Add proper types

3
src/types/image-pixels.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
declare module 'image-pixels';
// TODO - Add proper types

98
src/types/mii-js.d.ts vendored Normal file
View File

@@ -0,0 +1,98 @@
declare module 'mii-js';
// TODO - These have limits, and should be validated
type MiiStudioURLOptions = {
type?: string;
expression?: string;
width?: number;
bgColor?: string;
clothesColor?: string;
cameraXRotate?: number;
cameraYRotate?: number;
cameraZRotate?: number;
characterXRotate?: number;
characterYRotate?: number;
characterZRotate?: number;
lightXDirection?: number;
lightYDirection?: number;
lightZDirection?: number;
lightDirectionMode?: string;
instanceCount?: number;
instanceRotationMode?: string;
};
type Mii = {
version: number;
allowCopying: boolean;
profanityFlag: boolean;
regionLock: number;
characterSet: number;
pageIndex: number;
slotIndex: number;
unknown1: number;
deviceOrigin: number;
systemId: Buffer;
normalMii: boolean;
dsMii: boolean;
nonUserMii: boolean;
isValid: boolean;
creationTime: number;
consoleMAC: Buffer;
gender: number;
birthMonth: number;
birthDay: number;
favoriteColor: number;
favorite: boolean;
miiName: string;
height: number;
build: number;
disableSharing: boolean;
faceType: number;
skinColor: number;
wrinklesType: number;
makeupType: number;
hairType: number;
hairColor: number;
flipHair: boolean;
eyeType: number;
eyeColor: number;
eyeScale: number;
eyeVerticalStretch: number;
eyeRotation: number;
eyeSpacing: number;
eyeYPosition: number;
eyebrowType: number;
eyebrowColor: number;
eyebrowScale: number;
eyebrowVerticalStretch: number;
eyebrowRotation: number;
eyebrowSpacing: number;
eyebrowYPosition: number;
noseType: number;
noseScale: number;
noseYPosition: number;
mouthType: number;
mouthColor: number;
mouthScale: number;
mouthHorizontalStretch: number;
mouthYPosition: number;
mustacheType: number;
unknown2: number;
beardType: number;
facialHairColor: number;
mustacheScale: number;
mustacheYPosition: number;
glassesType: number;
glassesColor: number;
glassesScale: number;
glassesYPosition: number;
moleEnabled: boolean;
moleScale: number;
moleXPosition: number;
moleYPosition: number;
creatorName: string;
checksum: number;
studioUrl: (options: MiiStudioURLOptions) => string
};

View File

@@ -0,0 +1 @@
declare module 'mongoose-unique-validator';

3
src/types/tga.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
declare module 'tga';
// TODO - Add proper types