Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dependencies warnings #72

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,23 @@
],
"dependencies": {
"@materia/interfaces": "^1.0.3",
"@types/bluebird": "^3.5.26",
"@types/express": "^4.0.34",
"@types/express": "^4.17.7",
"@types/validator": "^10.11.0",
"@types/ws": "^4.0.2",
"body-parser": "^1.19.0",
"chalk": "^2.3.1",
"chalk": "^4.1.0",
"chokidar": "^3.4.0",
"compression": "^1.7.4",
"connect-session-sequelize": "^6.0.0",
"cors": "^2.8.5",
"errorhandler": "^1.5.0",
"execa": "^4.0.0",
"express": "^4.17.1",
"express-session": "^1.16.2",
"fs-extra": "^8.1.0",
"inquirer": "^7.0.4",
"express-session": "^1.17.1",
"fs-extra": "^9.0.1",
"inquirer": "^7.3.3",
"method-override": "^3.0.0",
"minimist": "^1.2.0",
"minimist": "^1.2.5",
"morgan": "^1.9.1",
"mysql2": "^1.6.1",
"oauth2orize": "^1.11.0",
Expand All @@ -44,28 +43,28 @@
"passport-oauth2-client-password": "^0.1.2",
"pg": "^7.11.0",
"pg-hstore": "^2.3.2",
"sequelize": "^5.21.7",
"simple-git": "^1.121.0",
"sqlite3": "4.2.0",
"sequelize": "^5.22.3",
"simple-git": "^2.15.0",
"sqlite3": "^5.0.0",
"uuid": "^3.1.0",
"which": "^1.3.1",
"ws": "6.1.2"
},
"devDependencies": {
"@types/chai": "^3.4.34",
"@types/chai-as-promised": "0.0.29",
"@types/chai": "^4.2.12",
"@types/chai-as-promised": "^7.1.3",
"@types/compression": "0.0.33",
"@types/fs-extra": "^4.0.0",
"@types/mocha": "^5.2.6",
"@types/node-uuid": "0.0.28",
"@types/mocha": "^8.0.1",
"@types/node-uuid": "^0.0.28",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"chai-http": "^4.3.0",
"crlf": "^1.1.1",
"mocha": "^7.1.2",
"mocha": "^8.1.0",
"ncp": "^2.0.0",
"tslint": "^6.1.2",
"typescript": "3.7.5"
"tslint": "^6.1.3",
"typescript": "3.9.6"
},
"scripts": {
"build": "tsc -p . && ncp package.json dist/package.json && ncp src/cli dist/cli && ncp scripts dist/scripts && ncp README.md dist/README.MD && ncp LICENSE.md dist/LICENSE.md",
Expand Down
2 changes: 1 addition & 1 deletion src/api/controllers/client.ctrl.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk from 'chalk';
import chalk = require('chalk');
import { join } from 'path';
import { IClientConfig } from '@materia/interfaces';

Expand Down
7 changes: 6 additions & 1 deletion src/api/lib/entities-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import { App } from '../../lib/app';
const entitySpacing = 20;
const entityWidth = 200;

export function generateActionId({ stringBase = 'base64', byteLength = 8 } = {}): Promise<string> {
export function generateActionId(
{ stringBase, byteLength }: { stringBase: BufferEncoding, byteLength: number } = {
stringBase: 'base64',
byteLength: 32
}
): Promise<string> {
return new Promise((resolve, reject) => {
crypto.randomBytes(byteLength, (err, buffer) => {
if (err) {
Expand Down
6 changes: 5 additions & 1 deletion src/api/oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ export class OAuth {
});
}

private generateToken({ stringBase = 'base64', byteLength = 32 } = {}): Promise<string> {
private generateToken(
{ stringBase, byteLength }: { stringBase: BufferEncoding, byteLength: number} = {
stringBase: 'base64',
byteLength: 32
}): Promise<string> {
return new Promise((resolve, reject) => {
crypto.randomBytes(byteLength, (err, buffer) => {
if (err) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/actions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from 'path';
import * as fs from 'fs';
import chalk from 'chalk';
import chalk = require('chalk');
import { IAction, IActionFilter, IApplyOptions, IAddon } from '@materia/interfaces';

import { App } from './app';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/addons.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as path from 'path';
import chalk from 'chalk';
import chalk = require('chalk');
import { IAddonsConfig } from '@materia/interfaces';

import { App } from './app';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';
import * as express from 'express';
import chalk from 'chalk';
import chalk = require('chalk');
import { IAddon, IEndpoint, IApplyOptions } from '@materia/interfaces';

import { Endpoint } from './api/endpoint';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/api/endpoint.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk from 'chalk';
import chalk = require('chalk');
import { IEndpoint, IParam } from '@materia/interfaces';

import { App } from '../app';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as events from 'events';
import chalk from 'chalk';
import chalk = require('chalk');
import { join, sep, dirname, relative, normalize, extname, basename } from 'path';
import * as fse from 'fs-extra';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from 'fs';
import * as path from 'path';
import chalk from 'chalk';
import chalk = require('chalk');
import { IClientBuild } from '@materia/interfaces';

import { App } from './app';
Expand Down
6 changes: 3 additions & 3 deletions src/lib/database.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { existsSync, readFileSync } from 'fs-extra';
import { join, resolve } from 'path';
import chalk from 'chalk';
import chalk = require('chalk');
import { Sequelize, Options, Dialect, QueryTypes } from 'sequelize';
import { IDatabaseConfig, ISQLDatabase, ISQLiteDatabase } from '@materia/interfaces';

Expand Down Expand Up @@ -156,7 +156,7 @@ export class Database {
}

const optsDialect = {
dialect: settings.type,
dialect: settings.type as Dialect,
logging: false
};
let opts: Options;
Expand Down Expand Up @@ -243,7 +243,7 @@ export class Database {
query = `SELECT datname FROM pg_database`;
field = 'datname';
}
tmp.query(query).spread((results: any, metadata) => {
tmp.query(query).then(([results, metadata]) => {
const formatedResult = [];
for (const i in results) {
if (results[i]) {
Expand Down
15 changes: 7 additions & 8 deletions src/lib/database/dialects/abstract.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Sequelize } from 'sequelize';
import * as Bluebird from 'bluebird';

import { MateriaError } from '../../error';

Expand All @@ -14,7 +13,7 @@ export class AbstractDialect {
return Promise.reject(new MateriaError('Not implemented method in dialect'));
}

getIndices(table): Bluebird<any> {
getIndices(table): Promise<any> {
return this.sequelize.getQueryInterface().showIndex(table).then((res: Array<any>) => {
const fields = {};
for (const index of res) {
Expand All @@ -27,7 +26,7 @@ export class AbstractDialect {
});
}

_getFKs(table): Bluebird<any> {
_getFKs(table): Promise<any> {
const qg: any = this.sequelize.getQueryInterface().QueryGenerator;
const query = qg.getForeignKeysQuery(table, 'public');
return this.sequelize.query(query, {raw: true}).then((fks: any[]) => {
Expand All @@ -42,7 +41,7 @@ export class AbstractDialect {
});
}

getFKs(table): Bluebird<any> {
getFKs(table): Promise<any> {
return this._getFKs(table).then((res) => {
const fields = {};
for (const fk of res) {
Expand All @@ -52,7 +51,7 @@ export class AbstractDialect {
});
}

addColumn(table, column_name, attributes): Bluebird<any> {
addColumn(table, column_name, attributes): Promise<any> {
return this.sequelize.getQueryInterface().addColumn(
table, column_name, attributes
);
Expand All @@ -64,11 +63,11 @@ export class AbstractDialect {
);
}

removeColumn(table, column_name): Bluebird<any> {
removeColumn(table, column_name): Promise<any> {
return this.sequelize.getQueryInterface().removeColumn(table, column_name);
}

renameColumn(table, column_name, column_new_name): Bluebird<any> {
renameColumn(table, column_name, column_new_name): Promise<any> {
return this.sequelize.getQueryInterface().renameColumn(table, column_name, column_new_name);
}

Expand All @@ -84,7 +83,7 @@ export class AbstractDialect {
return Promise.resolve(false);
}

authenticate(): Bluebird<any> {
authenticate(): Promise<any> {
return this.sequelize.authenticate();
}

Expand Down
9 changes: 4 additions & 5 deletions src/lib/database/dialects/mysql.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Sequelize, NOW } from 'sequelize';
import * as Bluebird from 'bluebird';

import { AbstractDialect } from './abstract';
import { MateriaError } from '../../error';
Expand Down Expand Up @@ -57,7 +56,7 @@ export class MysqlDialect extends AbstractDialect {
});
}

_getFKs(table): Bluebird<any> {
_getFKs(table): Promise<any> {
const query =
'SELECT INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME as `constraint_name`,' +
'INFORMATION_SCHEMA.KEY_COLUMN_USAGE.COLUMN_NAME as `from`,' +
Expand All @@ -84,7 +83,7 @@ export class MysqlDialect extends AbstractDialect {
});
}

showTables(): Bluebird<any> {
showTables(): Promise<any> {
const promises = [];
return this.sequelize.getQueryInterface().showAllTables().then((tables: Array<string>) => {
for (const table of tables) {
Expand Down Expand Up @@ -168,7 +167,7 @@ export class MysqlDialect extends AbstractDialect {
});
}

addConstraint(table, constraint): Bluebird<any> {
addConstraint(table, constraint): Promise<any> {
if (constraint.type != 'primary' && ! constraint.name) {
constraint.name = constraint.fields.join('_') + '_' + table + '_key';
}
Expand All @@ -178,7 +177,7 @@ export class MysqlDialect extends AbstractDialect {
);
}

dropConstraint(table, constraint): Bluebird<any> {
dropConstraint(table, constraint): Promise<any> {
if (constraint.name) {
return this.sequelize.getQueryInterface().showIndex(table).then((res: Array<any>) => {
for (const index of res) {
Expand Down
3 changes: 1 addition & 2 deletions src/lib/database/dialects/postgres.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Sequelize, NOW } from 'sequelize';
import * as Bluebird from 'bluebird';

import { AbstractDialect } from './abstract';
import { MateriaError } from '../../error';
Expand Down Expand Up @@ -35,7 +34,7 @@ export class PostgresDialect extends AbstractDialect {
return super.changeColumn(table, column_name, attributes);
}

showTables(): Bluebird<any> {
showTables(): Promise<any> {
const promises = [];
return this.sequelize.getQueryInterface().showAllTables().then((tables: Array<string>) => {
for (const table of tables) {
Expand Down
3 changes: 1 addition & 2 deletions src/lib/database/dialects/sqlite.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as Sequelize from 'sequelize';
import * as Bluebird from 'bluebird';

import { AbstractDialect } from './abstract';
import { MateriaError } from '../../error';
Expand All @@ -21,7 +20,7 @@ export class SqliteDialect extends AbstractDialect {
return super.define(entityName, cols, defOptions);
}

showTables(): Bluebird<any> {
showTables(): Promise<any> {
const promises = [];
return this.sequelize.getQueryInterface().showAllTables().then((tables: Array<string>) => {
tables.forEach(table => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/entities.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as fse from 'fs-extra';
import chalk from 'chalk';
import chalk = require('chalk');
import * as Sequelize from 'sequelize';
import { join } from 'path';
import { IEndpoint, IApplyOptions, IField } from '@materia/interfaces';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/entities/entity.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';
import * as uuid from 'uuid/v4';
import chalk from 'chalk';
import chalk = require('chalk');
import { IEntityConfig, IRelation, IQuery, IField, IApplyOptions, IFieldUpdate } from '@materia/interfaces';

import { App } from '../app';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/entities/queries/create.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Query, QueryParamResolver } from '../query';
import chalk from 'chalk';
import chalk = require('chalk');

export class CreateQuery extends Query {
type: string;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/entities/queries/custom.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as fs from 'fs';
import * as path from 'path';
import chalk from 'chalk';
import chalk = require('chalk');
import { ICustomQueryOptions } from '@materia/interfaces';

import { MateriaError } from '../../error';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/entities/queries/delete.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Query } from '../query';
import { Conditions } from './utils/conditions';
import chalk from 'chalk';
import chalk = require('chalk');

export class DeleteQuery extends Query {
type: string;
Expand Down
5 changes: 2 additions & 3 deletions src/lib/entities/queries/findAll.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import chalk from 'chalk';
import * as Bluebird from 'bluebird';
import chalk = require('chalk');
import { IFindAllOptions, IQueryOrdering } from '@materia/interfaces';
import { FindOptions } from 'sequelize';

Expand Down Expand Up @@ -238,7 +237,7 @@ export class FindAllQuery extends Query {
return tmp;
}

private _run(sequelizeOpts: FindOptions, options): Bluebird<any> {
private _run(sequelizeOpts: FindOptions, options): Promise<any> {
return this.entity.model.findAndCountAll(sequelizeOpts).then(res => {
if ( ! options || ! options.silent ) {
this.entity.app.logger.log(` └── ${chalk.green.bold('OK')}\n`);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/entities/queries/findOne.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk from 'chalk';
import chalk = require('chalk');

import { Query } from '../query';
import { Conditions } from './utils/conditions';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/entities/queries/sql.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk from 'chalk';
import chalk = require('chalk');
import { QueryTypes } from 'sequelize';

import { Query, QueryParamResolver } from '../query';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/entities/queries/update.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chalk from 'chalk';
import chalk = require('chalk');
import * as Sequelize from 'sequelize';
import { IQuery, IUpdateQueryOptions, IQueryValues } from '@materia/interfaces';

Expand Down
Loading