Skip to content

Commit

Permalink
chore(deps): Update most dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
freezy committed Nov 12, 2020
1 parent 561ae44 commit c790f6f
Show file tree
Hide file tree
Showing 13 changed files with 6,391 additions and 4,242 deletions.
6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10,491 changes: 6,315 additions & 4,176 deletions npm-shrinkwrap.json → package-lock.json

Large diffs are not rendered by default.

90 changes: 45 additions & 45 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,116 +39,116 @@
"test:serve:debug:compiled": "cross-env NODE_ENV=test APP_SETTINGS=config/settings.test.js PORT=7357 APP_NAME=local LOGLEVEL=silly run-s build test:dropdbs test:rimraf serve:test:debug:compiled",
"test:ci": "run-p test:serve test:run",
"update-top-100": "node -r ts-node/register src/scripts/update-top-100.ts",
"snyk-protect": "snyk protect",
"prepare": "npm run snyk-protect"
"snyk-protect": "snyk protect"
},
"engines": {
"node": "12.x"
},
"mod-project-name": "vpdb",
"dependencies": {
"@koa/cors": "3.0.0",
"@koa/cors": "3.1.0",
"@slack/client": "5.0.2",
"acl": "0.4.11",
"adm-zip": "0.4.13",
"adm-zip": "0.4.16",
"archiver": "3.1.1",
"axios": "0.19.0",
"base64-stream": "1.0.0",
"bluebird": "3.7.1",
"bluebird": "3.7.2",
"buffer-indexof": "1.1.1",
"bull": "3.12.0",
"bull": "3.18.1",
"busboy": "0.3.1",
"bytes": "3.1.0",
"chalk": "2.4.2",
"diff": "4.0.1",
"elastic-apm-node": "3.1.0",
"elastic-apm-node": "3.8.0",
"ent": "2.2.0",
"es6-promise-pool": "2.5.0",
"fluent-ffmpeg": "2.1.2",
"gltf-pipeline": "github:freezy/gltf-pipeline#hotfix/dedupe",
"gm": "1.23.1",
"google-auth-library": "5.3.0",
"handlebars": "^4.5.3",
"handlebars": "4.7.6",
"has-ansi": "4.0.0",
"ioredis": "4.14.1",
"ioredis": "4.19.2",
"jwt-simple": "0.5.6",
"koa": "2.11.0",
"koa-bodyparser": "4.2.1",
"koa": "2.13.0",
"koa-bodyparser": "4.3.0",
"koa-json": "2.0.2",
"koa-response-time": "2.1.0",
"koa-router": "7.4.0",
"koa-send": "5.0.0",
"lodash": "4.17.15",
"mongo-sanitize": "1.0.1",
"koa-send": "5.0.1",
"lodash": "4.17.20",
"microtime": "3.0.0",
"mongo-sanitize": "1.1.0",
"mongoose": "5.7.8",
"mongoose-paginate": "5.0.3",
"mongoose-unique-validator": "2.0.3",
"natives": "1.1.6",
"nodegit": "^0.26.2",
"nodemailer": "6.3.1",
"optipng": "2.1.0",
"nodemailer": "6.4.15",
"optipng": "2.2.0",
"passthrough-counter": "1.0.0",
"path-to-regexp": "3.1.0",
"pngquant": "3.0.0",
"project-name-generator": "2.1.7",
"pngquant": "3.1.0",
"project-name-generator": "2.1.9",
"randomstring": "1.1.5",
"raygun": "0.10.1",
"redis": "2.8.0",
"rollbar": "2.14.2",
"rollbar": "2.19.4",
"sax": "1.2.4",
"sharp": "0.23.2",
"sharp": "^0.26.2",
"shortid32": "0.1.1",
"snyk": "1.244.0",
"sqreen": "1.37.0",
"snyk": "1.425.3",
"sqreen": "1.55.1",
"strip-ansi": "5.2.0",
"ua-parser-js": "0.7.20",
"uglify-js": "3.6.8",
"uglify-js": "3.11.5",
"unrar": "0.2.0",
"unzipper": "^0.10.5",
"validator": "11.1.0",
"vpx-toolbox": "1.2.0",
"winston": "3.2.1",
"winston-daily-rotate-file": "4.2.1",
"vpx-js": "1.3.4",
"winston": "3.3.3",
"winston-daily-rotate-file": "4.5.0",
"xmlbuilder": "13.0.2"
},
"devDependencies": {
"@types/adm-zip": "0.4.32",
"@types/archiver": "3.0.0",
"@types/bluebird": "3.5.28",
"@types/bull": "3.10.6",
"@types/adm-zip": "0.4.33",
"@types/archiver": "3.1.1",
"@types/bluebird": "3.5.33",
"@types/bull": "3.14.4",
"@types/busboy": "0.2.3",
"@types/bytes": "3.0.0",
"@types/bytes": "3.1.0",
"@types/cheerio": "0.22.13",
"@types/diff": "4.0.2",
"@types/ent": "2.2.1",
"@types/ent": "2.2.3",
"@types/expect.js": "0.3.29",
"@types/faker": "4.1.7",
"@types/fluent-ffmpeg": "2.1.11",
"@types/gm": "1.18.6",
"@types/fluent-ffmpeg": "2.1.16",
"@types/gm": "1.18.9",
"@types/has-ansi": "3.0.0",
"@types/ioredis": "4.0.18",
"@types/ioredis": "4.17.7",
"@types/jwt-simple": "0.5.33",
"@types/koa": "2.0.51",
"@types/koa": "2.11.6",
"@types/koa-bodyparser": "4.3.0",
"@types/koa-json": "2.0.18",
"@types/koa-router": "7.0.42",
"@types/koa-router": "7.4.1",
"@types/koa-send": "4.1.2",
"@types/lodash": "4.14.145",
"@types/lodash": "4.14.165",
"@types/mocha": "5.2.7",
"@types/mongo-sanitize": "1.0.1",
"@types/mongoose": "5.5.29",
"@types/mongoose": "5.10.0",
"@types/mongoose-paginate": "5.0.8",
"@types/mongoose-unique-validator": "1.0.3",
"@types/mongoose-unique-validator": "1.0.4",
"@types/node": "12.12.6",
"@types/nodegit": "0.24.13",
"@types/nodemailer": "6.2.2",
"@types/nodemailer": "6.4.0",
"@types/randomstring": "1.1.6",
"@types/redis": "2.8.14",
"@types/sax": "1.2.0",
"@types/redis": "2.8.28",
"@types/sax": "1.2.1",
"@types/sharp": "0.23.0",
"@types/strip-ansi": "5.2.1",
"@types/ua-parser-js": "0.7.33",
"@types/uglify-js": "3.0.4",
"@types/uglify-js": "3.11.1",
"@types/unzipper": "^0.10.0",
"@types/validator": "10.11.3",
"@types/yargs": "13.0.3",
Expand All @@ -157,7 +157,7 @@
"cross-env": "6.0.3",
"expect.js": "0.3.1",
"faker": "4.1.0",
"fast-glob": "3.1.0",
"fast-glob": "3.2.4",
"form-data": "2.5.1",
"json-stable-stringify": "1.0.1",
"mocha": "5.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/app/builds/build.api.cache.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ describe('The build cache', () => {
});
});

});
});
4 changes: 2 additions & 2 deletions src/app/common/mongoose/game.reference.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export function gameReferencePlugin(schema: Schema, options: GameReferenceOption
* @param {Array<any> | object} query Input query
* @return {Promise<Array<any> | object>} Output query
*/
schema.statics.applyRestrictions = async function<T>(this: ModelProperties, ctx: Context, query: T): Promise<T> {
schema.statics.applyRestrictions = async function<T>(ctx: Context, query: T): Promise<T> {

const reference = modelReferenceMap[this.modelName];
const resource = modelResourceMap[this.modelName];
Expand Down Expand Up @@ -109,7 +109,7 @@ export function gameReferencePlugin(schema: Schema, options: GameReferenceOption
* @param {Array<any> | object} query Query to append
* @return {Promise<Array<any> | object | null>} Updated query on restriction, same without restriction and null if not logged.
*/
schema.statics.applyRestrictionsForGame = async function<T>(this: ModelProperties, ctx: Context, game: GameDocument, query: T): Promise<T | null> {
schema.statics.applyRestrictionsForGame = async function<T>(ctx: Context, game: GameDocument, query: T): Promise<T | null> {

const reference = modelReferenceMap[this.modelName];
const resource = modelResourceMap[this.modelName];
Expand Down
2 changes: 1 addition & 1 deletion src/app/common/mongoose/metrics.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export function metricsPlugin<T>(schema: Schema, options: MetricsOptions = {}) {
* @param {string} counterName Name of the counter, e.g. "views"
* @param {number} [value=1] How much to increment. Use a negative value for decrement
*/
schema.statics.incrementCounter = async function(this: ModelProperties, entityId: string, counterName: string, value: number = 1): Promise<void> {
schema.statics.incrementCounter = async function(entityId: string, counterName: string, value: number = 1): Promise<void> {
// update cache
await apiCache.incrementCounter(this.modelName.toLowerCase(), entityId, counterName, value);
// update db
Expand Down
4 changes: 2 additions & 2 deletions src/app/common/visualpinball.table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import { isUndefined, times } from 'lodash';

import { createHash } from 'crypto';
import { OleCompoundDoc, Storage } from 'vpx-toolbox';
import { BinaryReader, OleCompoundDoc, Storage } from 'vpx-js';
import { TableBlock } from '../releases/release.tableblock';
import { logger } from './logger';
import { RequestState } from './typings/context';
Expand Down Expand Up @@ -115,7 +115,7 @@ class VisualPinballTable {
* @returns {Promise<OleCompoundDoc>}
*/
public async readDoc(filename: string): Promise<OleCompoundDoc> {
return await OleCompoundDoc.load(filename);
return await OleCompoundDoc.load(new BinaryReader(filename));
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/app/files/metadata/vpt.metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
import { mapKeys, omit } from 'lodash';

import { Table } from 'vpx-toolbox';
import { BinaryReader, Table } from 'vpx-js';
import { RequestState } from '../../common/typings/context';
import { File } from '../file';
import { FileDocument } from '../file.document';
Expand All @@ -33,9 +33,9 @@ export class VptMetadata extends Metadata {
}

public async getMetadata(requestState: RequestState, file: FileDocument, path: string, variation?: FileVariation): Promise<{ [p: string]: any }> {
const table = await Table.load(path, { gameDataOnly: true, tableInfoOnly: true });
const table = await Table.load(new BinaryReader(path), { tableDataOnly: true, tableInfoOnly: true, loadTableScript: true });
const script = await table.getTableScript();
const props = mapKeys(table.tableInfo, key => {
const props = mapKeys(table.info, key => {
switch (key) {
case 'TableName': return 'table_name';
case 'AuthorName': return 'author_name';
Expand Down
9 changes: 5 additions & 4 deletions src/app/files/processor/vpt.gltf.processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

import { Table } from 'vpx-toolbox';
import { BinaryReader, Table, TableExporter, ThreeTextureLoader } from 'vpx-js';
import { logger } from '../../common/logger';
import { RequestState } from '../../common/typings/context';
import { FileDocument } from '../file.document';
Expand All @@ -40,13 +40,14 @@ export class VptGltfProcessor implements CreationProcessor<FileVariation> {
public async process(requestState: RequestState, file: FileDocument, src: string, dest: string, variation?: FileVariation): Promise<string> {

logger.info(requestState, '[VptGltfProcessor.process]: Parsing VPX file at %s', src);
const vpt = await Table.load(src);
const vpt = await Table.load(new BinaryReader(src));
logger.info(requestState, '[VptGltfProcessor.process]: VPX file parsed, exporting to GLB at %s.', dest);

const glb = await vpt.exportGlb({
const exporter = new TableExporter(vpt);
const glb = await exporter.exportGlb({

// texture and material
applyTextures: process.env.NODE_ENV !== 'test', // gltf loader in tests can't handle textures
applyTextures: (process.env.NODE_ENV !== 'test') ? new ThreeTextureLoader() : undefined, // gltf loader in tests can't handle textures
applyMaterials: true,
optimizeTextures: true,
gltfOptions: {
Expand Down
3 changes: 2 additions & 1 deletion src/app/releases/release.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import { compact, flatten, isArray, map, uniq } from 'lodash';
import {
FilterQuery,
GameReferenceModel,
MetricsModel,
ModeratedDocument,
Expand Down Expand Up @@ -162,7 +163,7 @@ releaseSchema.pre('remove', async function(this: ReleaseDocument) {

for (const fileId of fileIds) {
await state.models.TableBlock.updateOne(
{ _files: fileId },
{ _files: fileId } as FilterQuery<ReleaseDocument>,
{ $pull: { _files: fileId } },
{ multi: true },
);
Expand Down
4 changes: 2 additions & 2 deletions src/app/stars/star.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import { pick } from 'lodash';
import { MetricsDocument, Model } from 'mongoose';
import { FilterQuery, MetricsDocument, Model } from 'mongoose';

import { Api } from '../common/api';
import { apiCache } from '../common/api.cache';
Expand Down Expand Up @@ -190,7 +190,7 @@ export class StarApi extends Api {
['_ref.' + modelName]: entity._id,
_from: ctx.state.user._id,
type: modelName,
};
} as FilterQuery<StarDocument>;
const star = await state.models.Star.findOne(q);
return [entity, star];
};
Expand Down
3 changes: 2 additions & 1 deletion src/app/tokens/token.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import { extend, pick } from 'lodash';
import sanitize = require('mongo-sanitize');
import { FilterQuery } from 'mongoose';

import { acl } from '../common/acl';
import { Api } from '../common/api';
Expand Down Expand Up @@ -182,7 +183,7 @@ export class TokenApi extends Api {
*/
public async list(ctx: Context) {

const query = { _created_by: ctx.state.user._id, type: 'personal' };
const query = { _created_by: ctx.state.user._id, type: 'personal' } as FilterQuery<TokenDocument>;
const allowedTypes = [ 'personal', 'provider' ];

// filter by type?
Expand Down
9 changes: 5 additions & 4 deletions src/scripts/3dtest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import { writeFileSync } from 'fs';
import { basename } from 'path';
import { Table } from 'vpx-toolbox';
import { BinaryReader, Table, TableExporter, ThreeTextureLoader } from 'vpx-js';

(async () => {

Expand All @@ -35,16 +35,17 @@ import { Table } from 'vpx-toolbox';
//const tablePath = 'C:/Development/vpdb-server/src/test/fixtures/table-hit-target.vpx';
//const tablePath = 'D:/Pinball/Visual Pinball/Tables/vpdb-production/eksmrxkrw.vpx';

const vpt = await Table.load(tablePath);
const vpt = await Table.load(new BinaryReader(tablePath));
const loaded = Date.now();

// const obj = vpt.gates.find(g => g.getName() === 'WireW');
// writeFileSync('gate-vpdb.obj', obj.getMeshes(vpt).wire.mesh.serializeToObj());

const name = basename(tablePath, '.vpx');
const glb = await vpt.exportGlb({
const exporter = new TableExporter(vpt);
const glb = await exporter.exportGlb({

applyTextures: true,
applyTextures: new ThreeTextureLoader(),
applyMaterials: true,
exportLightBulbLights: true,
optimizeTextures: true,
Expand Down

0 comments on commit c790f6f

Please sign in to comment.