Skip to content

Commit

Permalink
Merge 2a4950a into cffbd71
Browse files Browse the repository at this point in the history
  • Loading branch information
LordSputnik committed Jun 23, 2021
2 parents cffbd71 + 2a4950a commit 4cf4d5f
Show file tree
Hide file tree
Showing 14 changed files with 1,142 additions and 2,546 deletions.
12 changes: 1 addition & 11 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
{
"plugins": [
"lodash",
"@babel/transform-modules-commonjs",
"@babel/proposal-object-rest-spread",
"@babel/proposal-class-properties",
"array-includes",
[
"@babel/transform-runtime",
{
"regenerator": true
}
]
"lodash"
],
"presets": [
"@babel/preset-typescript",
Expand Down
3,514 changes: 1,081 additions & 2,433 deletions package-lock.json

Large diffs are not rendered by default.

15 changes: 5 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,15 @@
"pg": "^8.5.1"
},
"devDependencies": {
"@babel/cli": "^7.10.1",
"@babel/core": "^7.10.1",
"@babel/plugin-proposal-class-properties": "^7.10.1",
"@babel/plugin-proposal-object-rest-spread": "^7.10.1",
"@babel/plugin-transform-modules-commonjs": "^7.10.1",
"@babel/plugin-transform-runtime": "^7.10.1",
"@babel/preset-env": "^7.10.1",
"@babel/cli": "^7.14.3",
"@babel/core": "^7.14.3",
"@babel/preset-env": "^7.14.4",
"@babel/preset-typescript": "^7.13.0",
"@babel/register": "^7.10.1",
"@babel/register": "^7.13.16",
"@types/lodash": "^4.14.168",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"babel-plugin-array-includes": "^2.0.3",
"babel-plugin-lodash": "^3.2.11",
"babel-plugin-lodash": "^3.3.4",
"chai": "^4.1.2",
"chai-as-promised": "^7.1.1",
"eslint": "^7.25.0",
Expand Down
29 changes: 7 additions & 22 deletions src/func/imports/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2018 Shivam Tripathi
* 2021 Ben Ockmore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -16,28 +17,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

import {DISCARD_LIMIT, castDiscardVote, discardVotesCast} from './discard';
import {
export {DISCARD_LIMIT, castDiscardVote, discardVotesCast} from './discard';
export {
getImportDetails, getOriginSourceFromId, getOriginSourceId,
originSourceMapping
} from './misc';
import {getRecentImports, getTotalImports} from './recent-imports';
import {approveImport} from './approve-import';
import {createImport} from './create-import';
import {deleteImport} from './delete-import';


export default {
DISCARD_LIMIT,
approveImport,
castDiscardVote,
createImport,
deleteImport,
discardVotesCast,
getImportDetails,
getOriginSourceFromId,
getOriginSourceId,
getRecentImports,
getTotalImports,
originSourceMapping
};
export {getRecentImports, getTotalImports} from './recent-imports';
export {approveImport} from './approve-import';
export {createImport} from './create-import';
export {deleteImport} from './delete-import';
58 changes: 0 additions & 58 deletions src/func/index.js

This file was deleted.

34 changes: 34 additions & 0 deletions src/func/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (C) 2021 Ben Ockmore
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

export * as alias from './alias';
export * as annotation from './annotation';
export * as area from './area';
export * as authorCredit from './author-credit';
export * as disambiguation from './disambiguation';
export * as editor from './editor';
export * as entity from './entity';
export * as identifier from './identifier';
export * as imports from './imports';
export * as language from './language';
export * as publisher from './publisher';
export * as relationship from './relationship';
export * as relationshipAttributes from './relationshipAttributes';
export * as releaseEvent from './releaseEvent';
export * as set from './set';
export {createEntity} from './create-entity';
6 changes: 4 additions & 2 deletions src/index.js → src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

import * as func from './func';
import * as util from './util'; // eslint-disable-line import/no-namespace

import Bookshelf from 'bookshelf';
Expand Down Expand Up @@ -52,7 +53,6 @@ import editor from './models/editor';
import editorEntityVisits from './models/editorEntityVisits';
import editorType from './models/editorType';
import entity from './models/entity';
import func from './func';
import gender from './models/gender';
import identifier from './models/identifier';
import identifierSet from './models/identifierSet';
Expand Down Expand Up @@ -189,7 +189,9 @@ export default function init(config) {
WorkRevision: workRevision(bookshelf),
WorkType: workType(bookshelf),
bookshelf,
func: func(),
func,
util
};
}

export {func};
2 changes: 1 addition & 1 deletion test/func/alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import faker from 'faker';
import {truncateTables} from '../../lib/util';
import {updateAliasSet} from '../../lib/func/alias';


chai.use(chaiAsPromised);
const {expect} = chai;
const {updateAliasSet} = bookbrainzData.func.alias;
const {Language, bookshelf} = bookbrainzData;

function getAliasData() {
Expand Down
2 changes: 1 addition & 1 deletion test/func/author-credit.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

import {fetchOrCreateCredit, updateAuthorCredit} from '../../lib/func/author-credit';
import _ from 'lodash';
import bookbrainzData from '../bookshelf';
import chai from 'chai';
Expand All @@ -26,7 +27,6 @@ import {truncateTables} from '../../lib/util';

chai.use(chaiAsPromised);
const {expect} = chai;
const {fetchOrCreateCredit, updateAuthorCredit} = bookbrainzData.func.authorCredit;
const {Entity, AuthorHeader, bookshelf} = bookbrainzData;

const aBBID = faker.random.uuid();
Expand Down
2 changes: 1 addition & 1 deletion test/func/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

import {getEntity, recursivelyGetRedirectBBID} from '../../lib/func/entity';
import bookbrainzData from '../bookshelf';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
Expand All @@ -26,7 +27,6 @@ import {truncateTables} from '../../lib/util';

chai.use(chaiAsPromised);
const {expect} = chai;
const {recursivelyGetRedirectBBID, getEntity} = bookbrainzData.func.entity;
const {Entity, AliasSet, RelationshipSet, IdentifierSet,
Author, Disambiguation, Gender, Editor, EditorType,
Revision, Annotation, bookshelf} = bookbrainzData;
Expand Down
2 changes: 1 addition & 1 deletion test/func/identifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import faker from 'faker';
import {truncateTables} from '../../lib/util';
import {updateIdentifierSet} from '../../lib/func/identifier';


chai.use(chaiAsPromised);
const {expect} = chai;
const {updateIdentifierSet} = bookbrainzData.func.identifier;
const {IdentifierType, bookshelf} = bookbrainzData;

function getIdentifierData() {
Expand Down
2 changes: 1 addition & 1 deletion test/func/language.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import bookbrainzData from '../bookshelf';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import {truncateTables} from '../../lib/util';
import {updateLanguageSet} from '../../lib/func/language';


chai.use(chaiAsPromised);
const {expect} = chai;
const {updateLanguageSet} = bookbrainzData.func.language;
const {Language, bookshelf} = bookbrainzData;

describe('updateLanguageSet', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/func/relationship.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import bookbrainzData from '../bookshelf';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import faker from 'faker';
import {updateRelationshipSets} from '../../lib/func/relationship';


chai.use(chaiAsPromised);
const {expect} = chai;
const {updateRelationshipSets} = bookbrainzData.func.relationship;
const {
RelationshipType, Entity, Gender, EditorType, Revision, Annotation, Work,
Editor, AliasSet, bookshelf
Expand Down
8 changes: 4 additions & 4 deletions test/func/set.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

import {
createNewSetWithItems, getAddedItems, getRemovedItems, getUnchangedItems,
removeItemsFromSet
} from '../../lib/func/set';
import _ from 'lodash';
import bookbrainzData from '../bookshelf';
import chai from 'chai';
Expand All @@ -26,10 +30,6 @@ import {truncateTables} from '../../lib/util';

chai.use(chaiAsPromised);
const {expect} = chai;
const {
getAddedItems, getRemovedItems, getUnchangedItems, removeItemsFromSet,
createNewSetWithItems
} = bookbrainzData.func.set;
const {AliasSet, Language, bookshelf} = bookbrainzData;

const arrayA = [
Expand Down

0 comments on commit 4cf4d5f

Please sign in to comment.