Skip to content

Commit

Permalink
fix: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Jul 27, 2019
1 parent f53c82c commit 7f2baa6
Show file tree
Hide file tree
Showing 9 changed files with 82 additions and 82 deletions.
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,28 @@
"core-js": "^3.1.4",
"delay": "^4.3.0",
"es6-error": "^4.1.1",
"lodash": "^4.17.11",
"lodash": "^4.17.15",
"roarr": "^2.13.2",
"serialize-error": "^4.1.0",
"slonik": "^17.1.1"
"slonik": "^18.2.0"
},
"description": "Utilities for manipulating data in PostgreSQL database using Slonik.",
"devDependencies": {
"@babel/cli": "^7.5.0",
"@babel/core": "^7.5.0",
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/plugin-transform-flow-strip-types": "^7.4.4",
"@babel/preset-env": "^7.5.2",
"@babel/register": "^7.4.4",
"@babel/preset-env": "^7.5.5",
"@babel/register": "^7.5.5",
"ava": "^2.2.0",
"babel-plugin-istanbul": "^5.1.4",
"babel-plugin-istanbul": "^5.2.0",
"babel-plugin-transform-export-default-name": "^2.0.4",
"coveralls": "^3.0.4",
"eslint": "^6.0.1",
"eslint-config-canonical": "^17.1.1",
"flow-bin": "^0.102.0",
"coveralls": "^3.0.5",
"eslint": "^6.1.0",
"eslint-config-canonical": "^17.3.1",
"flow-bin": "^0.104.0",
"flow-copy-source": "^2.0.7",
"gitdown": "^2.6.1",
"husky": "^3.0.0",
"gitdown": "^3.1.1",
"husky": "^3.0.1",
"nyc": "^14.1.1",
"semantic-release": "^15.13.18",
"sinon": "^7.3.2"
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: 'slonik-utilities'
package: 'slonik-utilities',
});
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
export {
update,
updateDistinct,
upsert
upsert,
} from './routines';
6 changes: 3 additions & 3 deletions src/routines/update.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// @flow

import {
sql
sql,
} from 'slonik';
import type {
DatabaseConnectionType,
ValueExpressionType
ValueExpressionType,
} from 'slonik';

type NamedValueBindingsType = {
+[key: string]: ValueExpressionType
+[key: string]: ValueExpressionType,
};

export default async (
Expand Down
8 changes: 4 additions & 4 deletions src/routines/updateDistinct.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import {
normalizeIdentifier,
sql
sql,
} from 'slonik';
import type {
DatabaseConnectionType,
ValueExpressionType
ValueExpressionType,
} from 'slonik';

type NamedValueBindingsType = {
+[key: string]: ValueExpressionType
+[key: string]: ValueExpressionType,
};

export default async (
Expand Down Expand Up @@ -45,7 +45,7 @@ export default async (
return sql.comparisonPredicate(sql.identifier([key]), '=', value);
}),
'AND'
)
),
],
'AND'
);
Expand Down
28 changes: 14 additions & 14 deletions src/routines/upsert.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
// @flow

import {
sql
sql,
} from 'slonik';
import type {
DatabaseConnectionType,
ValueExpressionType
ValueExpressionType,
} from 'slonik';
import {
difference,
uniq,
mapKeys,
snakeCase
snakeCase,
} from 'lodash';
import {
escapeIdentifier
escapeIdentifier,
} from '../utilities';
import Logger from '../Logger';

type NamedValueBindingsType = {
+[key: string]: ValueExpressionType
+[key: string]: ValueExpressionType,
};

type UpsertConfigurationType = {|
+identifierName: string
+identifierName: string,
|};

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

const normalizeNamedValueBindingName = (name: string): string => {
return snakeCase(name);
};

const defaultConfiguration = {
identifierName: 'id'
identifierName: 'id',
};

export default async (
Expand All @@ -47,7 +47,7 @@ export default async (
) => {
const configuration = {
...defaultConfiguration,
...inputConfiguration
...inputConfiguration,
};

const namedValueBindingNamesWithUndefinedValues = [];
Expand All @@ -65,7 +65,7 @@ export default async (

if (namedValueBindingNamesWithUndefinedValues.length > 0) {
log.warn({
namedValueBindingNamesWithUndefinedValues
namedValueBindingNamesWithUndefinedValues,
}, 'named value bindings with undefined values');

throw new Error('Named value binding values must be defined.');
Expand All @@ -89,7 +89,7 @@ export default async (
columnNames
.map((columnName) => {
return [
columnName
columnName,
];
})
);
Expand All @@ -99,7 +99,7 @@ export default async (
const conflictColumnIdentifiers = sql.identifierList(
uniqueConstraintColumnNames.map((uniqueConstraintColumnName) => {
return [
uniqueConstraintColumnName
uniqueConstraintColumnName,
];
})
);
Expand All @@ -118,7 +118,7 @@ export default async (

const targetColumnNames = uniq([
...uniqueConstraintColumnNames,
...updateColumnNames
...updateColumnNames,
]);

const whereClause = sql.booleanExpression(targetColumnNames.map((targetColumnName) => {
Expand All @@ -128,7 +128,7 @@ export default async (
return sql.raw(
'$1 IS NULL',
[
sql.identifier([targetColumnName])
sql.identifier([targetColumnName]),
]
);
}
Expand Down
22 changes: 11 additions & 11 deletions test/slonik-utilities/routines/update.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow

import {
sql
sql,
} from 'slonik';
import test from 'ava';
import sinon from 'sinon';
Expand All @@ -12,7 +12,7 @@ const createConnection = () => {
const query = sinon.stub();

const connection = {
query
query,
};

return connection;
Expand All @@ -25,15 +25,15 @@ test('executes UPDATE query without WHERE condition (single column)', async (t)
connection,
'foo',
{
bar: 'baz'
bar: 'baz',
}
);

t.is(connection.query.callCount, 1);

t.is(normalizeQuery(connection.query.firstCall.args[0].sql), 'UPDATE "foo" SET "bar" = $1');
t.deepEqual(connection.query.firstCall.args[0].values, [
'baz'
'baz',
]);
});

Expand All @@ -46,7 +46,7 @@ test('executes UPDATE query without WHERE condition (multiple columns)', async (
{
bar0: 'baz0',
bar1: 'baz1',
bar2: 'baz2'
bar2: 'baz2',
}
);

Expand All @@ -56,7 +56,7 @@ test('executes UPDATE query without WHERE condition (multiple columns)', async (
t.deepEqual(connection.query.firstCall.args[0].values, [
'baz0',
'baz1',
'baz2'
'baz2',
]);
});

Expand All @@ -69,7 +69,7 @@ test('executes UPDATE query without WHERE condition (SQL token)', async (t) => {
{
bar0: 'baz0',
bar1: sql.raw('to_timestamp($1)', ['baz1']),
bar2: 'baz2'
bar2: 'baz2',
}
);

Expand All @@ -79,7 +79,7 @@ test('executes UPDATE query without WHERE condition (SQL token)', async (t) => {
t.deepEqual(connection.query.firstCall.args[0].values, [
'baz0',
'baz1',
'baz2'
'baz2',
]);
});

Expand All @@ -90,10 +90,10 @@ test('executes UPDATE query with WHERE condition (AND boolean expression short-h
connection,
'foo',
{
bar: 'baz'
bar: 'baz',
},
{
qux: 'quux'
qux: 'quux',
}
);

Expand All @@ -102,6 +102,6 @@ test('executes UPDATE query with WHERE condition (AND boolean expression short-h
t.is(normalizeQuery(connection.query.firstCall.args[0].sql), 'UPDATE "foo" SET "bar" = $1 WHERE ("qux" = $2)');
t.deepEqual(connection.query.firstCall.args[0].values, [
'baz',
'quux'
'quux',
]);
});
22 changes: 11 additions & 11 deletions test/slonik-utilities/routines/updateDistinct.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow

import {
sql
sql,
} from 'slonik';
import test from 'ava';
import sinon from 'sinon';
Expand All @@ -12,7 +12,7 @@ const createConnection = () => {
const query = sinon.stub();

const connection = {
query
query,
};

return connection;
Expand All @@ -25,7 +25,7 @@ test('executes UPDATE query without WHERE condition (single column)', async (t)
connection,
'foo',
{
bar: 'baz'
bar: 'baz',
}
);

Expand All @@ -34,7 +34,7 @@ test('executes UPDATE query without WHERE condition (single column)', async (t)
t.is(normalizeQuery(connection.query.firstCall.args[0].sql), 'UPDATE "foo" SET "bar" = $1 WHERE ("bar" IS DISTINCT FROM $2)');
t.deepEqual(connection.query.firstCall.args[0].values, [
'baz',
'baz'
'baz',
]);
});

Expand All @@ -47,7 +47,7 @@ test('executes UPDATE query without WHERE condition (multiple columns)', async (
{
bar0: 'baz0',
bar1: 'baz1',
bar2: 'baz2'
bar2: 'baz2',
}
);

Expand All @@ -60,7 +60,7 @@ test('executes UPDATE query without WHERE condition (multiple columns)', async (
'baz2',
'baz0',
'baz1',
'baz2'
'baz2',
]);
});

Expand All @@ -73,7 +73,7 @@ test('executes UPDATE query without WHERE condition (SQL token)', async (t) => {
{
bar0: 'baz0',
bar1: sql.raw('to_timestamp($1)', ['baz1']),
bar2: 'baz2'
bar2: 'baz2',
}
);

Expand All @@ -86,7 +86,7 @@ test('executes UPDATE query without WHERE condition (SQL token)', async (t) => {
'baz2',
'baz0',
'baz1',
'baz2'
'baz2',
]);
});

Expand All @@ -97,10 +97,10 @@ test('executes UPDATE query with WHERE condition (AND boolean expression short-h
connection,
'foo',
{
bar: 'baz'
bar: 'baz',
},
{
qux: 'quux'
qux: 'quux',
}
);

Expand All @@ -110,6 +110,6 @@ test('executes UPDATE query with WHERE condition (AND boolean expression short-h
t.deepEqual(connection.query.firstCall.args[0].values, [
'baz',
'baz',
'quux'
'quux',
]);
});

0 comments on commit 7f2baa6

Please sign in to comment.