Skip to content

Commit

Permalink
fix: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Sep 20, 2019
1 parent b97819f commit 3aabbae
Show file tree
Hide file tree
Showing 24 changed files with 109 additions and 108 deletions.
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,32 @@
"bin": "./dist/bin/index.js",
"dependencies": {
"es6-error": "^4.1.1",
"lodash": "^4.17.11",
"lodash": "^4.17.15",
"pluralize": "^8.0.0",
"roarr": "^2.13.2",
"slonik": "^17.1.1",
"yargs": "^13.2.4"
"roarr": "^2.14.1",
"slonik": "^19.0.1",
"yargs": "^14.0.0"
},
"description": "A scaffolding tool for projects using DataLoader, Flow and PostgreSQL.",
"devDependencies": {
"@babel/cli": "^7.5.0",
"@babel/core": "^7.5.0",
"@babel/node": "^7.5.0",
"@babel/cli": "^7.6.0",
"@babel/core": "^7.6.0",
"@babel/node": "^7.6.1",
"@babel/plugin-transform-flow-strip-types": "^7.4.4",
"@babel/preset-env": "^7.5.0",
"@babel/register": "^7.4.4",
"ava": "^2.1.0",
"babel-plugin-istanbul": "^5.1.4",
"@babel/preset-env": "^7.6.0",
"@babel/register": "^7.6.0",
"ava": "^2.4.0",
"babel-plugin-istanbul": "^5.2.0",
"babel-plugin-macros": "^2.6.1",
"coveralls": "^3.0.4",
"eslint": "^6.0.1",
"eslint-config-canonical": "^17.1.1",
"flow-bin": "^0.102.0",
"flow-copy-source": "^2.0.7",
"husky": "^3.0.0",
"coveralls": "^3.0.6",
"eslint": "^6.4.0",
"eslint-config-canonical": "^17.7.0",
"flow-bin": "^0.108.0",
"flow-copy-source": "^2.0.8",
"husky": "^3.0.5",
"inline-loops.macro": "^1.2.2",
"nyc": "^14.1.1",
"semantic-release": "^15.13.18"
"semantic-release": "^15.13.24"
},
"engines": {
"node": ">=8"
Expand Down
2 changes: 1 addition & 1 deletion src/Logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import Logger from 'roarr';

export default Logger.child({
package: 'postloader'
package: 'postloader',
});
24 changes: 12 additions & 12 deletions src/bin/commands/generate-loaders.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
// @flow

import {
createPool
createPool,
} from 'slonik';
import type {
ColumnType,
DataTypeMapType
DataTypeMapType,
} from '../../types';
import {
getDatabaseColumns,
getDatabaseIndexes
getDatabaseIndexes,
} from '../../queries';
import {
generateDataLoaderFactory
generateDataLoaderFactory,
} from '../../utilities';

type ArgvType = {|
+columnFilter?: string,
+dataTypeMap?: string,
+databaseConnectionUri: string,
+tableNameMapper?: string
+tableNameMapper?: string,
|};

type ColumnFilterType = (tableName: string, columnName: string, columns: $ReadOnlyArray<ColumnType>) => boolean;
Expand All @@ -33,19 +33,19 @@ export const builder = (yargs: Object): void => {
.options({
'column-filter': {
description: 'Function used to filter columns. Function is constructed using `new Function`. Function receives table name as the first parameter, column name as the second parameter and all database columns as the third parameter (parameter names are "tableName", "columnName" and "columns").',
type: 'string'
type: 'string',
},
'data-type-map': {
description: 'A JSON string describing an object mapping user-defined database types to Flow types, e.g. {"email": "string"}',
type: 'string'
type: 'string',
},
'database-connection-uri': {
demand: true
demand: true,
},
'table-name-mapper': {
description: 'Function used to map table names. Function is constructed using `new Function`. Function receives table name as the first parameter and all database columns as the second parameter (parameter names are "tableName" and "columns").',
type: 'string'
}
type: 'string',
},
});
};

Expand Down Expand Up @@ -73,7 +73,7 @@ export const handler = async (argv: ArgvType): Promise<void> => {
.map((column) => {
return {
...column,
isNullable: column.comment && column.comment.includes('POSTLOAD_NOTNULL') ? false : column.isNullable
isNullable: column.comment && column.comment.includes('POSTLOAD_NOTNULL') ? false : column.isNullable,
};
})
.map((column) => {
Expand All @@ -83,7 +83,7 @@ export const handler = async (argv: ArgvType): Promise<void> => {

return {
...column,
mappedTableName: mapTableName(column.tableName, columns)
mappedTableName: mapTableName(column.tableName, columns),
};
});

Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

export {
getByIds,
getByIdsUsingJoiningTable
getByIdsUsingJoiningTable,
} from './routines';
export {
PostLoaderError,
NotFoundError
NotFoundError,
} from './errors';
4 changes: 2 additions & 2 deletions src/queries/getDatabaseColumns.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// @flow

import {
sql
sql,
} from 'slonik';
import type {
ColumnType,
DatabaseConnectionType
DatabaseConnectionType,
} from '../types';

export default async (connection: DatabaseConnectionType): Promise<$ReadOnlyArray<ColumnType>> => {
Expand Down
4 changes: 2 additions & 2 deletions src/queries/getDatabaseIndexes.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// @flow

import {
sql
sql,
} from 'slonik';
import type {
DatabaseConnectionType,
IndexType
IndexType,
} from '../types';

export default async (connection: DatabaseConnectionType): Promise<$ReadOnlyArray<IndexType>> => {
Expand Down
14 changes: 7 additions & 7 deletions src/routines/getByIds.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
// @flow

import {
sql
sql,
} from 'slonik';
import {
camelCase
camelCase,
} from 'lodash';
import {
filter,
find
find,
} from 'inline-loops.macro';
import Logger from '../Logger';
import {
NotFoundError
NotFoundError,
} from '../errors';
import type {
DatabaseConnectionType
DatabaseConnectionType,
} from '../types';

const log = Logger.child({
namespace: 'getByIds'
namespace: 'getByIds',
});

export default async (
Expand Down Expand Up @@ -64,7 +64,7 @@ export default async (
log.warn({
id,
idName,
tableName
tableName,
}, 'resource not found');

result = new NotFoundError();
Expand Down
6 changes: 3 additions & 3 deletions src/routines/getByIdsUsingJoiningTable.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// @flow

import {
sql
sql,
} from 'slonik';
import {
filter
filter,
} from 'inline-loops.macro';
import type {
DatabaseConnectionType
DatabaseConnectionType,
} from '../types';

export default async (
Expand Down
9 changes: 5 additions & 4 deletions src/types.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// @flow

export type {
DatabaseConnectionType
DatabaseConnectionType,
} from 'slonik';

export type DataTypeMapType = {
+[key: string]: string
+[key: string]: string,
...,
};

export type ColumnType = {|
Expand All @@ -15,12 +16,12 @@ export type ColumnType = {|
+isNullable: boolean,
+mappedTableName?: string,
+name: string,
+tableName: string
+tableName: string,
|};

export type IndexType = {|
+columnNames: $ReadOnlyArray<string>,
+indexIsUnique: boolean,
+indexName: string,
+tableName: string
+tableName: string,
|};
4 changes: 2 additions & 2 deletions src/utilities/createColumnSelector.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// @flow

import {
camelCase
camelCase,
} from 'lodash';
import type {
ColumnType
ColumnType,
} from '../types';

export default (columns: $ReadOnlyArray<ColumnType>, alias: ?string): string => {
Expand Down
4 changes: 2 additions & 2 deletions src/utilities/createLoaderTypePropertyDeclaration.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import isNumberType from './isNumberType';
import isStringType from './isStringType';

const log = Logger.child({
namespace: 'createLoaderTypePropertyDeclaration'
namespace: 'createLoaderTypePropertyDeclaration',
});

export default (loaderName: string, dataTypeName: string, resourceName: string, resultIsArray: boolean) => {
Expand All @@ -21,7 +21,7 @@ export default (loaderName: string, dataTypeName: string, resourceName: string,
dataTypeName,
loaderName,
resourceName,
resultIsArray
resultIsArray,
}, 'key type cannot be resolved to a string or number');

throw new Error('Cannot resolve key type.');
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/formatPropertyName.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow

import {
camelCase
camelCase,
} from 'lodash';

export default (columnName: string): string => {
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/formatTypeName.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import {
camelCase,
upperFirst
upperFirst,
} from 'lodash';

export default (tableName: string): string => {
Expand Down
18 changes: 9 additions & 9 deletions src/utilities/generateDataLoaderFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
import pluralize from 'pluralize';
import {
camelCase,
upperFirst
upperFirst,
} from 'lodash';
import type {
ColumnType,
DataTypeMapType,
IndexType
IndexType,
} from '../types';
import {
UnexpectedStateError
UnexpectedStateError,
} from '../errors';
import Logger from '../Logger';
import generateFlowTypeDocument from './generateFlowTypeDocument';
Expand All @@ -22,7 +22,7 @@ import createLoaderTypePropertyDeclaration from './createLoaderTypePropertyDecla
import pluralizeTableName from './pluralizeTableName';

const log = Logger.child({
namespace: 'generateDataLoaderFactory'
namespace: 'generateDataLoaderFactory',
});

const createLoaderByIdsDeclaration = (loaderName: string, tableName: string, keyColumnName, columnSelector: string, resultIsArray: boolean) => {
Expand Down Expand Up @@ -54,7 +54,7 @@ export default (
.map((column) => {
return {
...column,
mappedTableName: column.mappedTableName || column.tableName
mappedTableName: column.mappedTableName || column.tableName,
};
});

Expand Down Expand Up @@ -178,12 +178,12 @@ export default (
const relations = [
{
key: firstIdColumnNames[0],
resource: firstIdColumnNames[1]
resource: firstIdColumnNames[1],
},
{
key: firstIdColumnNames[1],
resource: firstIdColumnNames[0]
}
resource: firstIdColumnNames[0],
},
];

for (const relation of relations) {
Expand All @@ -199,7 +199,7 @@ export default (

if (!resourceTableColumns.length) {
log.warn({
relation
relation,
}, 'resource without columns');

continue;
Expand Down
6 changes: 3 additions & 3 deletions src/utilities/generateFlowTypeDocument.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// @flow

import {
sortBy
sortBy,
} from 'lodash';
import type {
ColumnType,
DataTypeMapType
DataTypeMapType,
} from '../types';
import getFlowType from './getFlowType';
import formatTypeName from './formatTypeName';
Expand All @@ -30,7 +30,7 @@ export default (unnormalisedColumns: $ReadOnlyArray<ColumnType>, dataTypeMap: Da
.map((column) => {
return {
...column,
mappedTableName: column.mappedTableName || column.tableName
mappedTableName: column.mappedTableName || column.tableName,
};
});

Expand Down
Loading

0 comments on commit 3aabbae

Please sign in to comment.