Skip to content
Merged
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
5 changes: 2 additions & 3 deletions .circleci/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'
services:
stardog1:
command: ["--port", "5821", "--home", "/var/opt/stardog"]
command: ['--port', '5821', '--home', '/var/opt/stardog']
depends_on:
- zoo1
environment:
Expand All @@ -18,7 +18,7 @@ services:
- ../stardog-license-key.bin:/var/opt/stardog/stardog-license-key.bin
- ./cluster.properties:/var/opt/stardog/stardog.properties
stardog2:
command: ["--port", "5822", "--home", "/var/opt/stardog"]
command: ['--port', '5822', '--home', '/var/opt/stardog']
depends_on:
- zoo1
environment:
Expand Down Expand Up @@ -71,7 +71,6 @@ services:
working_dir: /app
environment:
- HOST=stardog1
- CIRCLECI=true
Comment thread
SpiralP marked this conversation as resolved.
volumes:
- ../:/app/
depends_on:
Expand Down
6 changes: 3 additions & 3 deletions .circleci/jwt.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
confVersion: "1.0"
confVersion: '1.0'
deploymentName: stardog-server
issuers:
http://stardog.com:
algorithms:
HS256:
secret: "some-kind-of-secret-key-here"
secret: 'some-kind-of-secret-key-here'

signer:
algorithm: HS256
secret: "some-kind-of-secret-key-here"
secret: 'some-kind-of-secret-key-here'
issuer: http://stardog.com
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,5 @@ module.exports = {

// TODO remove these:
'no-unused-vars': 'off',
'prefer-object-spread': 'warn',
},
};
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

2 changes: 1 addition & 1 deletion lib/Connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Connection {
// request creation can be overriden by providing a `createRequest` method on
// `meta`, and header creation can be overriden with `createHeaders`.
config(options, meta) {
const config = Object.assign({}, this, options, { meta });
const config = { ...this, ...options, meta };

// If it ends with / slice it off
if (
Expand Down
2 changes: 1 addition & 1 deletion lib/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const addCredential = (conn, credentials, label) => {
const headers = conn.headers();
headers.set('Content-Type', 'application/json');

const body = Object.assign({}, credentials, { label });
const body = { ...credentials, label };

return fetch(conn.request('admin', 'catalog', 'credentials'), {
method: 'POST',
Expand Down
21 changes: 10 additions & 11 deletions lib/db/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ const reasoning = require('./reasoning');
const docs = require('./docs');
const namespaces = require('./namespaces');

module.exports = Object.assign(
{},
db,
{ icv },
{ transaction },
{ options },
{ docs },
{ graph },
{ reasoning },
{ namespaces }
);
module.exports = {
...db,
icv,
transaction,
options,
docs,
graph,
reasoning,
namespaces,
};
6 changes: 2 additions & 4 deletions lib/db/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ const dispatchChange = (conn, config, content, params = {}) => {
}
)
.then(httpBody)
.then(res =>
Object.assign({}, res, { transactionId: config.transactionId })
);
.then(res => ({ ...res, transactionId: config.transactionId }));
};

const create = (conn, database, databaseOptions = {}, options = {}, params) => {
Expand Down Expand Up @@ -151,7 +149,7 @@ const clear = (conn, database, transactionId, params = {}) => {
}
)
.then(httpBody)
.then(res => Object.assign({}, res, { transactionId }));
.then(res => ({ ...res, transactionId }));
};

// options - graphUri, contentType, encoding
Expand Down
18 changes: 8 additions & 10 deletions lib/db/namespaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const backwardsCompatGetNamespaces = (conn, database) =>
const n = lodashGet(res, 'body.database.namespaces', []);
const names = n.reduce((memo, keyValString) => {
const [key, value] = keyValString.split('=');
return Object.assign({}, memo, { [key]: value });
return { ...memo, [key]: value };
}, {});
res.body = names;
}
Expand All @@ -29,15 +29,13 @@ const get = (conn, database) => {
return backwardsCompatGetNamespaces(conn, database);
}

return httpBody(res).then(bodyRes =>
Object.assign({}, bodyRes, {
body: lodashGet(bodyRes, 'body.namespaces', []).reduce(
(memo, { prefix, name }) =>
Object.assign({}, memo, { [prefix]: name }),
{}
),
})
);
return httpBody(res).then(bodyRes => ({
...bodyRes,
body: lodashGet(bodyRes, 'body.namespaces', []).reduce(
(memo, { prefix, name }) => ({ ...memo, [prefix]: name }),
{}
),
}));
});
};

Expand Down
5 changes: 2 additions & 3 deletions lib/db/transaction.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { httpBody } = require('../response-transforms');

const attachTransactionId = transactionId => res =>
Object.assign({}, res, { transactionId });
const attachTransactionId = transactionId => res => ({ ...res, transactionId });

const begin = (conn, database, params = {}) => {
const headers = conn.headers();
Expand All @@ -11,7 +10,7 @@ const begin = (conn, database, params = {}) => {
headers,
})
.then(httpBody)
.then(res => Object.assign({}, res, { transactionId: res.body }));
.then(res => ({ ...res, transactionId: res.body }));
};

const rollback = (conn, database, transactionId, params = {}) => {
Expand Down
2 changes: 1 addition & 1 deletion lib/query/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ const stored = require('./stored');
const graphql = require('./graphql');
const utils = require('./utils');

module.exports = Object.assign({}, query, { stored }, { graphql }, { utils });
module.exports = { ...query, stored, graphql, utils };
6 changes: 2 additions & 4 deletions lib/query/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const executeInTransaction = (
}
)
.then(httpBody)
.then(res => Object.assign({}, res, { transactionId }));
.then(res => ({ ...res, transactionId }));
};

const property = (conn, database, config, params) =>
Expand All @@ -108,9 +108,7 @@ const property = (conn, database, config, params) =>
).then(res => {
const values = lodashGet(res, 'body.results.bindings', []);
if (values.length > 0) {
return Object.assign({}, res, {
body: values[0].val.value,
});
return { ...res, body: values[0].val.value };
}
return res;
});
Expand Down
2 changes: 1 addition & 1 deletion lib/query/stored.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const CONTENT_TYPE_JSON = 'application/json';

const getBody = (conn, storedQuery, options) => {
if (!options.contentType || options.contentType === CONTENT_TYPE_JSON) {
const body = Object.assign({}, storedQuery);
const body = { ...storedQuery };
body.creator = conn.username;
body.shared = typeof body.shared === 'boolean' ? body.shared : false;
return body;
Expand Down
2 changes: 1 addition & 1 deletion lib/user/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const user = require('./main');
const role = require('./role');

module.exports = Object.assign({}, user, { role });
module.exports = { ...user, role };
2 changes: 0 additions & 2 deletions scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable no-console */
const { babel } = require('@rollup/plugin-babel');
const commonjs = require('@rollup/plugin-commonjs');
const json = require('@rollup/plugin-json');
Expand Down
9 changes: 6 additions & 3 deletions scripts/changelog.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable no-console */
const fs = require('fs');
const path = require('path');
const semver = require('semver');
Expand Down Expand Up @@ -78,7 +76,12 @@ function getMilestones(
}),
})
.then(res => res.json())
.then(({ data: { repository: { milestones } } }) =>
.then(
({
data: {
repository: { milestones },
},
}) =>
Promise.all(
milestones.nodes.map(milestone => {
if (!milestoneAndIssuesData[milestone.title]) {
Expand Down
25 changes: 14 additions & 11 deletions scripts/docs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-disable no-param-reassign */
/* eslint-disable import/no-extraneous-dependencies */

const typedocs = require('typedocs/out');
const fs = require('fs');
const path = require('path');
Expand Down Expand Up @@ -44,8 +41,9 @@ const getPath = obj => {
obj.parent === null ||
obj.parent === undefined ||
obj.parent.name === `"${pathToDeclaration}"`
)
) {
return obj.name;
}
return `${getPath(obj.parent)}.${obj.name}`;
};

Expand All @@ -57,11 +55,9 @@ const getMarkdown = (obj, parent = null) => {
const typeName = type.slice(type.indexOf('<') + 1, type.lastIndexOf('>'));
const typeHeading = typeName.split('.').pop();
return ''.concat(
`#### <a name="${obj.name.toLowerCase()}">\`${getPath(
parent
)}.${obj.name}(${obj.parameters
.map(param => param.name)
.join(', ')})\`</a>\n\n`,
`#### <a name="${obj.name.toLowerCase()}">\`${getPath(parent)}.${
obj.name
}(${obj.parameters.map(param => param.name).join(', ')})\`</a>\n\n`,
`${obj.documentation}\n\n`,
`Expects the following parameters:\n\n${obj.parameters.reduce(
(acc, val) => acc.concat(`- ${val.name} (${getType(val.type)})\n\n`),
Expand Down Expand Up @@ -162,8 +158,12 @@ Promise.resolve(typedocs.generate([pathToDeclaration]))
markdown =>
new Promise((resolve, reject) => {
fs.readFile(pathToREADME, 'utf8', (err, data) => {
if (err) return reject(err);
if (err) {
return reject(err);
}
// eslint-disable-next-line no-param-reassign
data = data.slice(0, data.indexOf('<!--- API Goes Here --->'));
// eslint-disable-next-line no-param-reassign
data = data.concat('<!--- API Goes Here --->\n# API\n\n', markdown);
return fs.writeFile(pathToREADME, data, error => {
if (error) {
Expand All @@ -175,4 +175,7 @@ Promise.resolve(typedocs.generate([pathToDeclaration]))
})
)
.then(console.log)
.catch(console.err);
.catch(e => {
console.error(e);
process.exit(1);
});
4 changes: 2 additions & 2 deletions scripts/triggerAnnoyingAlert.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ const writeCountdown = () => {
process.stdout.clearLine();
process.stdout.cursorTo(0);
process.stdout.write(` ...\u0007Publishing in ${countdown} seconds!`);
}
};

const beAnnoying = () => {
writeCountdown();
countdown--;
countdown -= 1;
if (countdown < 0) {
console.log(chalk.green('\n\n Publishing!\n'));
return;
Expand Down
32 changes: 13 additions & 19 deletions test/stored.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,14 @@ const convertToJsonLd = (conn, storedQuery) => {
types.push('system:ReasoningQuery');
}

const keyValuePairs = Object.entries(
Object.assign(
{
'system:queryName': storedQuery.name,
'system:queryDescription': storedQuery.description,
'system:queryString': storedQuery.query,
'system:queryCreator': conn.username,
'system:queryDatabase': storedQuery.database,
},
storedQuery.annotations
)
).reduce((obj, [iri, value]) => {
const keyValuePairs = Object.entries({
'system:queryName': storedQuery.name,
'system:queryDescription': storedQuery.description,
'system:queryString': storedQuery.query,
'system:queryCreator': conn.username,
'system:queryDatabase': storedQuery.database,
...storedQuery.annotations,
}).reduce((obj, [iri, value]) => {
if (typeof value !== 'undefined') {
// eslint-disable-next-line no-param-reassign
obj[iri] = { '@value': value };
Expand All @@ -49,13 +45,11 @@ const convertToJsonLd = (conn, storedQuery) => {
system: 'http://system.stardog.com/',
},
'@graph': [
Object.assign(
{
'@id': 'system:Query',
'@type': types,
},
keyValuePairs
),
{
'@id': 'system:Query',
'@type': types,
...keyValuePairs,
},
],
};
};
Expand Down
2 changes: 1 addition & 1 deletion test/transactions.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ describe('transactions', () => {
it('Should be able to clean and insert all data in the DB using a transaction.', () => {
const dbContent = fs.readFileSync(
`${process.cwd()}/test/fixtures/api_tests.nt`,
'utf-8'
'utf8'
);
return begin()
.then(res => {
Expand Down