Members
additionalAuthorProps
***************************
********** Helpers ************
- Source:
additionalEditionProps
***************************
********** Helpers ************
- Source:
additionalPublisherProps
***************************
********** Helpers ************
- Source:
additionalSeriesProps
***************************
********** Helpers ************
- Source:
AdminPanelSearchResults
Renders the document and displays the 'AdminPanelSearchResults' page.
EditorAchievementTab
Renders the document and displays the 'Editor Achievements Tab'.
ended
If one of the entities has an end date or area and another doesn't,
those endDate/Area properties will be automatically selected as the only option on the merge display page
We want to emulate this for the initialState to match, so if there's any endDate/Are, set ended to true
- Source:
ended
If one of the entities has an end date and another doesn't,
that endDate property will be automatically selected as the only option on the merge display page
We want to emulate this for the initialState to match, so if there's any endDate, set ended to true
- Source:
EntityRevisions
The class is derived from the React Component base class and
renders the 'Entity RevisionsPage' page.
getAuthorEntityMergeSection
Returns the initial form state for the Author merging page, based on the multiple entities.
The returned section has some properties transformed to a state acceptable by the reducer.
- Source:
getEditionEntityMergeSection
Returns the initial form state for the Edition merging page, based on the multiple entities.
The returned section has some properties transformed to a state acceptable by the reducer.
- Source:
getEditionGroupEntityMergeSection
Returns the initial form state for the Edition Group merging page, based on the multiple entities.
The returned section has some properties transformed to a state acceptable by the reducer.
- Source:
getInitAttribute
A function to insert all the individual attribute object(number, position etc) to
a array.
getPublisherEntityMergeSection
Returns the initial form state for the Publisher merging page, based on the multiple entities.
The returned section has some properties transformed to a state acceptable by the reducer.
- Source:
getSeriesEntityMergeSection
Returns the initial form state for the Series merging page, based on the multiple entities.
The returned section has some properties transformed to a state acceptable by the reducer.
- Source:
getWorkEntityMergeSection
Returns the initial form state for the Work merging page, based on the multiple entities.
The returned section has some properties transformed to a state acceptable by the reducer.
- Source:
NameSection
Container component. The NameSection component contains input fields for
setting the name of an entity. It also allows setting of the entity's
disambiguation. The intention is that this component is rendered as a
modular section within the entity editor.
PrivilegeTypes
Retrieves the icon for the shield depending on the privileges that the user has
(async) recursivelyGetMergedEntitiesBBIDs
This recursive function fetches all the merged BBIDs that are pointing to an array of BBIDs
An example; if entity A was merged into entity B, BBID A will point to BBID B.
Now if entity B is merged in entity C, BBID B will point to BBID C.
To allow for reverting merges cleanly, BBID A still points to B and not C (trust me on this).
In order to fetch the complete history tree containing all three entities, we need to recursively check
if a source_bbid appears as a target_bbid in other rows.
- Source:
router
***************************
********** Routes ************
- Source:
router
***************************
********** Routes ************
router
***************************
********** Routes *************
- Source:
router
***************************
********** Routes *************
router
***************************
********** Routes ************
- Source:
router
***************************
********** Routes *************
- Source:
SearchResults
Renders the document and displays the 'SearchResults' page.
setAttribute
This function returns the attribute name corresponding
to a attribute ID.
UPDATE_WARN_IF_EDITION_GROUP_EXISTS
Produces an action indicating that the edition status for the edition being
edited should be updated with the provided value.
wikidataIdentifierTypeIds
Wikipedia extract which includes information about the Wikipedia project where it comes from.
- Source:
Methods
_createAdminLog(from, size, orm) → {array}
Fetches Admin logs for Show All Admin Logs page
Fetches the last 'size' number of admin logs with offset 'from'
- Source:
Parameters:
Name | Type | Description |
---|---|---|
from |
number
|
the offset value |
size |
number
|
no. of last logs required |
orm |
object
|
the BookBrainz ORM, initialized during app setup |
Returns:
- Type:
-
array
- orderedLogs
_getAllEntities(orm) → {Object}
Retrieves the count of entities created in the last 30 days and returns it as an object, where
each key is the entity name and its value is the count.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
orm |
Object
|
An object representing the ORM. |
Throws:
-
If there is an error fetching entities total cound from last 30 days
- Type
-
Error
Returns:
- Type:
-
Object
An object where each key is the entity name and its value is the count
_getAssociatedEntityRevisions(from, size, orm) → {array}
Fetches revisions for Show All Revisions/Index Page
Fetches the last 'size' number of revisions with offset 'from'
- Source:
Parameters:
Name | Type | Description |
---|---|---|
from |
number
|
the offset value |
size |
number
|
no. of last revisions required |
orm |
object
|
the BookBrainz ORM, initialized during app setup |
Returns:
- Type:
-
array
- orderedRevisions
_getAvailableWikipediaArticles(wikidataId, preferredLanguages)
Tries to find a Wikipedia article for the given Wikidata item in the first preferred language which is available.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
wikidataId |
string
|
Wikidata item ID. |
preferredLanguages |
Array.<string>
|
List of language codes, preference in descending order. |
_getIdByField(sourceIdentifierState) → {object}
Generate Identifier state from req body
- Source:
Parameters:
Name | Type | Description |
---|---|---|
sourceIdentifierState |
object
|
source state in format of t{typeId}:value |
Returns:
- Type:
-
object
- correctly formatted identifierEditor state
_getLast30DaysEntities(orm) → {Array.<Object>}
Retrieves the top 10 editors with the most revisions and returns them as an array of objects,
where each object contains the editor's information.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
orm |
Object
|
An object representing the ORM. |
Throws:
-
If there is an error fetching the top 10 editors.
- Type
-
Error
Returns:
- Type:
-
Array.<Object>
An array of objects, where each object contains the editor's information.
_getOrderedCollectionsForEditorPage(from, size, entityType, orm) → {array}
Fetches public collections for Show All Collections/Index Page
Fetches the last 'size' number of collections with offset 'from'
- Source:
Parameters:
Name | Type | Description |
---|---|---|
from |
number
|
the offset value |
size |
number
|
no. of last collections required |
entityType |
string
|
entityType filter |
orm |
object
|
the BookBrainz ORM, initialized during app setup |
Returns:
- Type:
-
array
- orderedCollections
_getOrderedPublicCollections(collectionId, from, size, orm) → {array}
Fetches bbids of entities in the collection
Fetches the last 'size' number of bbids with offset 'from'
- Source:
Parameters:
Name | Type | Description |
---|---|---|
collectionId |
uuid
|
collectionId |
from |
number
|
the offset value |
size |
number
|
no. of last collections required |
orm |
object
|
the BookBrainz ORM, initialized during app setup |
Returns:
- Type:
-
array
- array of bbids
_getOrderedRevisions(from, size, req) → {array}
This checks whether Editor is valid or not.
If Editor is valid then this extracts the revisions done by that editor;
and then add associated entities in that array;
- Source:
Parameters:
Name | Type | Description |
---|---|---|
from |
number
|
the offset value |
size |
number
|
no. of last revisions required |
req |
object
|
req is an object containing information about the HTTP request |
Returns:
- Type:
-
array
- orderedRevisions for particular Editor
_loadWorkTableAuthors(entity, relationshipSet, orm)
Add the relationships on entity object.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
entity |
Object
|
The entity to load the relationships for. |
relationshipSet |
Object
|
The RelationshipSet model. |
orm |
Object
|
The ORM instance. |
_parseLanguages(orm, type, query, idKey, exactMatch) → {Promise}
Generate react-select option from query
- Source:
Parameters:
Name | Type | Description |
---|---|---|
orm |
object
|
orm |
type |
string
|
type eg. area |
query |
string
|
query string |
idKey |
string
|
key corresponding to id |
exactMatch |
boolean
|
exact matching the query string |
Returns:
- Type:
-
Promise
- resolves to option object
_relationshipTypeCreateOrEditHandler(req, res) → {promise}
Creates a new identifier type or updates an existing identifier type
- Source:
Parameters:
Name | Type | Description |
---|---|---|
req |
object
|
request object |
res |
object
|
response object |
Returns:
- Type:
-
promise
res.send promise
_searchOption(req, type) → {Promise}
Parse NameSection, IdentifierEditor, AnnotationSection state from request body
- Source:
Parameters:
Name | Type | Description |
---|---|---|
req |
object
|
Request object |
type |
string
|
entity type |
Returns:
- Type:
-
Promise
- Resolves to Entity initialState
_selectWikipediaPage(article)
Fetches the page extract of the given Wikipedia article.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
article |
object
|
Title and language of the article. |
AboutPage() → {JSX.Element}
Renders the document and displays the 'About' page.
- Source:
Returns:
- Type:
-
JSX.Element
a React JSX Element
page
AchievementComponent(props) → {JSX.Element}
Achievement Component
A React component that displays an achievement card with its details, including name,
description, badge image, and progress if the achievement is locked.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The props for the Achievement component.
|
Returns:
- Type:
-
JSX.Element
The rendered Achievement card component.
addAliasRow() → {Action}
Produces an action indicating that a row for a new alias should be added
to the alias editor. The row is assigned an ID based on an incrementing
variable existing on the client.
Returns:
- Type:
-
Action
The resulting ADD_ALIAS_ROW action.
addAuthor(value, rowId) → {Action}
Produces an action indicating that new Author should be added in `Authors`
as well as in AC of Edition.
Parameters:
Name | Type | Description |
---|---|---|
value |
object
|
New author credit state. |
rowId |
string
|
Row id of author credit editor. |
Returns:
- Type:
-
Action
The resulting ADD_AUTHOR action.
addAuthorCreditRow() → {Action}
Produces an action indicating that a row for an additional name should be
added to the author credit editor. The row is assigned an ID based on an
incrementing variable existing on the client.
Returns:
- Type:
-
Action
The resulting ADD_AUTHOR_CREDIT_ROW action.
addAuthorsDataToWorks(authorsData, works) → {array}
Get an array of works contained in an edition, along with the authorAlias of those works
- Source:
Parameters:
Name | Type | Description |
---|---|---|
authorsData |
object
|
an object which contains the authorAlias and authorBBID with workBBIDs as keys |
works |
array
|
the array containing all the works in an edition |
Returns:
- Type:
-
array
- return the works array after adding authorsData to each work in the array
addBulkSeriesItems(seriesItems) → {Action}
Produces an action indicating that the new series items should replace the old one.
Parameters:
Name | Type | Description |
---|---|---|
seriesItems |
Object
|
The series items object to be added. |
Returns:
- Type:
-
Action
The resulting ADD_BULK_SERIES_ITEMS action.
addEditionGroup(value) → {Action}
Produces an action indicating that new edition group should be added in `EditionGroups`.
Parameters:
Name | Type | Description |
---|---|---|
value |
Object
|
New edition group state. |
Returns:
- Type:
-
Action
The resulting ADD_EDITION_GROUP action.
addIdentifierRow() → {Action}
Produces an action indicating that a row for a new identifier should be added
to the identifier editor. The row is assigned an ID based on an incrementing
variable existing on the client.
Returns:
- Type:
-
Action
The resulting ADD_IDENTIFIER_ROW action.
addInitialRelationship(props, relationshipTypeId, targetEntity, relationshipIndex)
add an initial relationship to entity from another enitty
when one entity created from other.
Parameters:
Name | Type | Description |
---|---|---|
props |
object
|
props related to new entity |
relationshipTypeId |
number
|
relationshipId number for initaial relationship |
targetEntity |
object
|
details about target entitiy like edition group, publisher and author |
relationshipIndex |
number
|
initial relationship index number |
addLanguage(newLanguage) → {Action}
Produces an action indicating that new language should be added to languages field.
Parameters:
Name | Type | Description |
---|---|---|
newLanguage |
LanguageOption
|
The new language to be added/ |
Returns:
- Type:
-
Action
The resulting ADD_LANGUAGE action.
addOtherISBN(type, value) → {Action}
Produces an action indicating that the new ISBN should be added to the Identifiers.
Parameters:
Name | Type | Description |
---|---|---|
type |
number
|
The type Id correspond to this ISBN. |
value |
string
|
The value of this ISBN. |
Returns:
- Type:
-
Action
The resulting ADD_OTHER_ISBN action.
addPublisher(value) → {Action}
Produces an action indicating that new Publisher should be added in `Publishers`.
Parameters:
Name | Type | Description |
---|---|---|
value |
Object
|
New publisher state. |
Returns:
- Type:
-
Action
The resulting ADD_PUBLISHER action.
addSeries(value) → {Action}
Produces an action indicating that new Series should be added in `Series`.
Parameters:
Name | Type | Description |
---|---|---|
value |
object
|
New series entity state. |
Returns:
- Type:
-
Action
The resulting ADD_SERIES action.
addSeriesItem(data, rowID) → {Action}
Produces an action indicating that a row for a new series item should be added
to the series section. The row is assigned an ID based on an incrementing
variable existing on the client.
Parameters:
Name | Type | Description |
---|---|---|
data |
Relationship
|
The new entity to be added in the list. |
rowID |
string
|
The rowID of the new entity to be added in the list. |
Returns:
- Type:
-
Action
The resulting ADD_SERIES_ITEM action.
addWork(value) → {Action}
Produces an action indicating that new Work should be added in `Works`.
Parameters:
Name | Type | Description |
---|---|---|
value |
Object
|
New work state. |
Returns:
- Type:
-
Action
The resulting ADD_WORK action.
AliasButton(props) → {ReactElement}
Presentational component. The AliasButton component renders a button
component in the style of a link. The link text indicates the number of
aliases currently set in the AliasEditor, and invites the user to add new or
edit existing aliases.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered AliasButton.
AliasEditor(props) → {ReactElement}
Container component. The AliasEditor component contains a number of AliasRow
elements, and renders these inside a modal, which appears when the show
property of the component is set.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered AliasEditor.
AliasEditorMerge(props) → {ReactElement}
Container component. The AliasEditorMerge component contains a number of AliasRow
elements, and renders these inside a modal, which appears when the show
property of the component is set.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered AliasEditorMerge.
AliasRow(props) → {ReactElement}
Container component. The AliasRow component renders a single Row containing
several input fields, allowing the user to set the name, sort name, language
and primary flag for an alias in the AliasEditor. A button is also included
to remove the alias from the editor.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered AliasRow.
AliasRowMerge(props) → {ReactElement}
Container component. The AliasRowMerge component renders a single Row containing
several input fields, allowing the user to set the name, sort name, language
and primary flag for an alias in the AliasEditor. A button is also included
to remove the alias from the editor.
Parameters:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered AliasRowMerge.
AnnotationSection(props) → {ReactElement}
Container component. The AnnotationSection component contains a
field for entering or modifying annotations for this entity.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered
AnnotationSection.
areaToOption(area) → {object}
Transforms an Area entity to a react-select component option
- Source:
Parameters:
Name | Type | Description |
---|---|---|
area |
object
|
The Area entity to transfrom |
Returns:
- Type:
-
object
option - A react-select option
assignIfNotSet(targetObject, propName, sourceObject, sourcePathopt)
Mutates the targetObject, setting the value at propName if it isn't already set.
Accepts an optional path string or array of strings to allow get the source value at another path
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
targetObject |
object
|
Object to modify | ||
propName |
string
|
Property name to set on the targetObject | ||
sourceObject |
object
|
Source object to copy from | ||
sourcePath |
string
|
Array.<string>
|
<optional> |
propName | Path of the property to check on the sourceObject. |
attachAttribToRelForDisplay(relationships)
Takes an array of relationships and attach the deeply nested
relationship attributes to the first level of the relationship object.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
relationships |
Array
|
the array of relationships |
attachAttributes(relationships)
Takes an array of relationships and attach the deeply nested
relationship attributes to the first level of the relationship object.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
relationships |
Array
|
the array of relationships |
AuthorCreditEditor(props) → {ReactElement}
Container component. The AuthorCreditEditor component contains a number of
AuthorCreditRow elements, and renders these inside a modal, which appears when
the show property of the component is set.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered
AuthorCreditEditor modal.
AuthorCreditRow(props) → {ReactElement}
Container component. The IdentifierRow component renders a single Row
containing several input fields, allowing the user to set the value and type
for an identifier in the IdentifierEditor. A button is also included to
remove the identifier from the editor.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered IdentifierRow.
AuthorSection(props) → {ReactElement}
Container component. The AuthorSection component contains input fields
specific to the author entity. The intention is that this component is
rendered as a modular section within the entity editor.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered AuthorSection.
AuthorSectionMerge(props) → {ReactElement}
Container component. The AuthorSectionMerge component contains input fields
specific to the author entity. The intention is that this component is
rendered as a modular section within the entity editor.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered AuthorSectionMerge.
ButtonBar(props) → {ReactElement}
Container component. This component renders three buttons in a horizontal
row allowing the user to open the AliasEditor (AliasButton), add a
disambiguation to the entity and open the IdentifierEditor
(IdentifierButton).
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered ButtonBar.
calIsbn10Chk(isbn) → {string}
Calculate check digit for isbn10
- Source:
Parameters:
Name | Type | Description |
---|---|---|
isbn |
string
|
ISBN-10 |
Returns:
- Type:
-
string
check digit
calIsbn13Chk(isbn) → {string}
Calculate check digit for isbn13
- Source:
Parameters:
Name | Type | Description |
---|---|---|
isbn |
string
|
ISBN-13 |
Returns:
- Type:
-
string
check digit
CallToAction(props) → {ReactElement}
Renders the document and displays 'CallToAction' component.
Parameters:
Name | Type | Description |
---|---|---|
props |
object
|
Properties passed to the component. the 'CallToAction' component. |
Returns:
- Type:
-
ReactElement
a HTML document which displays
checkIfNameExists(name, entityBBID, entityType, action) → {checkIfNameExists~dispatch}
Produces an action containing boolean value indicating if the name of the
entity already exists. This is done by asynchronously checking if the name
of the entity already exists in the database.
Parameters:
Name | Type | Description |
---|---|---|
name |
string
|
The value to be checked if it already exists. |
entityBBID |
string
|
The BBID of the current entity, if it already exists |
entityType |
string
|
The entity type of the value to be checked. |
action |
string
|
An optional redux action to dispatch. Defaults to UPDATE_WARN_IF_EXISTS |
Returns:
- Type:
-
checkIfNameExists~dispatch
The returned function.
checkPrivilege(privs, privType) → {boolean}
Returns whether the user has a particular Privilege or not
Parameters:
Name | Type | Description |
---|---|---|
privs |
number
|
the privileges of the user |
privType |
PrivilegeType
|
the privilege type being checked |
Returns:
- Type:
-
boolean
- whether the user has the privilege type or not
cleanupOnExit(cleanupPromise)
Captures process exits and signals and calls user-defined cleanup function.
On SIGINT, terminate straight away instead of running cleanup function
Catches uncaught exceptions, and supports asynchronicity in cleanup function
- Source:
Parameters:
Name | Type | Description |
---|---|---|
cleanupPromise |
function
|
graceful cleanup function to call on exit. If the function returns false, it will be considered an asynchronous function and you will have to run `process.kill(process.pid, errorCode)` yourself. |
clearAuthor(aid) → {Action}
Produces an action indicating that newly created
Author should be removed from `Authors`.
Parameters:
Name | Type | Description |
---|---|---|
aid |
string
|
Author id to be removed. |
Returns:
- Type:
-
Action
The resulting CLEAR_AUTHOR action.
clearAuthorCredit() → {Action}
Returns:
- Type:
-
Action
The resulting CLEAR_AUTHOR_CREDIT action.
clearEditionGroups() → {Action}
Produces an action indicating that all edition groups should be removed from `EditionGroups`.
Returns:
- Type:
-
Action
The resulting CLEAR_EDITION_GROUPS action.
clearPublisher(pid) → {Action}
Produces an action indicating that newly created
Publisher should be removed from `Publishers`.
Parameters:
Name | Type | Description |
---|---|---|
pid |
string
|
Publisher id to be removed. |
Returns:
- Type:
-
Action
The resulting CLEAR_PUBLISHER action.
clearPublishers() → {Action}
Produces an action indicating that all Publishers should be removed from `Publishers`.
Returns:
- Type:
-
Action
The resulting CLEAR_PUBLISHERS action.
closeEntityModal() → {Action}
Set entity modal state to close
- Source:
Returns:
- Type:
-
Action
The resulting CLOSE_ENTITY_MODAL action.
collapseWhiteSpaces(text) → {string}
This function repalces other space control character to U+0020 and trim extra spaces
- Source:
Parameters:
Name | Type | Description |
---|---|---|
text |
string
|
text to sanitize |
Returns:
- Type:
-
string
- sanitized text
collectionCreateOrEditHandler(req, res, next) → {promise}
Creates a new collection or updates the existing collection
If it's a new collection or it's name is changed, ElasticSearch index is also updated
Parameters:
Name | Type | Description |
---|---|---|
req |
object
|
request object |
res |
object
|
response object |
next |
object
|
next object |
Returns:
- Type:
-
promise
res.send promise
constructAdminLogStatement(logData) → {string}
Constructs a log statement for each administrative action for the Admin Logs Page
- Source:
Parameters:
Name | Type | Description |
---|---|---|
logData |
AdminLogDataT
|
the data for the admin log action |
Returns:
- Type:
-
string
A statement of the log depending upon the AdminActionType
ContributePage() → {JSX.Element}
Renders the the document and displays the 'Contribute' page.
Returns:
- Type:
-
JSX.Element
a React JSX Element
createEntitiesHandler(req, res)
Middleware for handling unified form submission
Parameters:
Name | Type | Description |
---|---|---|
req |
object
|
Request object |
res |
object
|
Response object |
createEntityPageTitle(entity, titleForUnnamed, templateForNamed) → {string}
Generates a page title for an entity row
- Source:
Parameters:
Name | Type | Description |
---|---|---|
entity |
object
|
Entity object |
titleForUnnamed |
string
|
Fallback title in case entity has no name |
templateForNamed |
function
|
Accepts an object with a name field and uses it to generate a title string |
Returns:
- Type:
-
string
- Title string
dateObjectToISOString(value) → {string}
Format a {day, month, year} object into an ISO 8601-2004 string (±YYYYYY-MM-DD)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
string
|
a {day, month, year} object |
Returns:
- Type:
-
string
ISO 8601-2004 string (±YYYYYY-MM-DD)
debouncedUpdateAliasName(rowId, value) → {Action}
Produces an action indicating that the name for a particular alias within
the editor should be updated with the provided value. The action is
marked to be debounced by the keystroke debouncer defined for
redux-debounce.
Parameters:
Name | Type | Description |
---|---|---|
rowId |
number
|
The ID of the row in the alias editor to update. |
value |
string
|
The new value to be used for the alias name. |
Returns:
- Type:
-
Action
The resulting UPDATE_ALIAS_NAME action.
debouncedUpdateAliasSortName(rowId, value) → {Action}
Produces an action indicating that the sort name for a particular alias
within the editor should be updated with the provided value. The action is
marked to be debounced by the keystroke debouncer defined for
redux-debounce.
Parameters:
Name | Type | Description |
---|---|---|
rowId |
number
|
The ID of the row in the alias editor to update. |
value |
string
|
The new value to be used for the alias sort name. |
Returns:
- Type:
-
Action
The resulting UPDATE_ALIAS_SORT_NAME action.
debouncedUpdateBeginDate(newBeginDate) → {Action}
Produces an action indicating that the begin date for the author being
edited should be updated with the provided value. The action is marked to be
debounced by the keystroke debouncer defined for redux-debounce.
Parameters:
Name | Type | Description |
---|---|---|
newBeginDate |
string
|
The new value to be used for the begin date. |
Returns:
- Type:
-
Action
The resulting UPDATE_BEGIN_DATE action.
debouncedUpdateBeginDate(newBeginDate) → {Action}
Produces an action indicating that the begin date for the publisher being
edited should be updated with the provided value. The action is marked to be
debounced by the keystroke debouncer defined for redux-debounce.
Parameters:
Name | Type | Description |
---|---|---|
newBeginDate |
string
|
The new value to be used for the begin date. |
Returns:
- Type:
-
Action
The resulting UPDATE_BEGIN_DATE action.
debouncedUpdateDepth(value) → {Action}
Produces an action indicating that the depth for the edition
should be updated with the provided value. The action is marked to be
debounced by the keystroke debouncer defined for redux-debounce.
Parameters:
Name | Type | Description |
---|---|---|
value |
number
|
The new value to be used for the depth. |
Returns:
- Type:
-
Action
The resulting UPDATE_DEPTH action.
debouncedUpdateDisambiguationField(newDisambiguation) → {Action}
Produces an action indicating that the disambiguation for the entity being
edited should be updated with the provided value. The action is marked to be
debounced by the keystroke debouncer defined for redux-debounce.
Parameters:
Name | Type | Description |
---|---|---|
newDisambiguation |
string
|
The new value to be used for the disambiguation. |
Returns:
- Type:
-
Action
The resulting UPDATE_SORT_NAME_FIELD action.
debouncedUpdateEndDate(newEndDate) → {Action}
Produces an action indicating that the end date for the author being
edited should be updated with the provided value. The action is marked to be
debounced by the keystroke debouncer defined for redux-debounce.
Parameters:
Name | Type | Description |
---|---|---|
newEndDate |
string
|
The new value to be used for the end date. |
Returns:
- Type:
-
Action
The resulting UPDATE_END_DATE action.
debouncedUpdateEndDate(newEndDate) → {Action}
Produces an action indicating that the end date for the publisher being
edited should be updated with the provided value. The action is marked to be
debounced by the keystroke debouncer defined for redux-debounce.
Parameters:
Name | Type | Description |
---|---|---|
newEndDate |
string
|
The new value to be used for the end date. |
Returns:
- Type:
-
Action
The resulting UPDATE_END_DATE action.
debouncedUpdateHeight(value) → {Action}
Produces an action indicating that the height for the edition
should be updated with the provided value. The action is marked to be
debounced by the keystroke debouncer defined for redux-debounce.
Parameters:
Name | Type | Description |
---|---|---|
value |
number
|
The new value to be used for the height. |
Returns:
- Type:
-
Action
The resulting UPDATE_HEIGHT action.
debouncedUpdateIdentifierValue(rowId, value, suggestedType, doDebounce) → {Action}
Produces an action indicating that the value for a particular identifier
within the editor should be updated with the provided value. Also
provides a suggestion for the identifier type based on the provided value,
if this is possible and it has not already been set. The action is marked to
be debounced by the keystroke debouncer defined for redux-debounce.
Parameters:
Name | Type | Description |
---|---|---|
rowId |
number
|
The ID of the row in the identifier editor to update. |
value |
string
|
The new value to be used for the identifier value. |
suggestedType |
number
|
The ID for the type suggested by the new value. |
doDebounce |
boolean
|
flag for debouncing |
Returns:
- Type:
-
Action
The resulting UPDATE_IDENTIFIER_VALUE action.
debouncedUpdateISBNValue(newValue) → {Action}
Produces an action indicating that `ISBN` value should be updated.
Parameters:
Name | Type | Description |
---|---|---|
newValue |
string
|
New value of ISBN Field. |
Returns:
- Type:
-
Action
The resulting UPDATE_ISBN_VALUE action.
debouncedUpdateNameField(newName) → {Action}
Produces an action indicating that the name for the entity being edited
should be updated with the provided value. The action is marked to be
debounced by the keystroke debouncer defined for redux-debounce.
Parameters:
Name | Type | Description |
---|---|---|
newName |
string
|
The new value to be used for the name. |
Returns:
- Type:
-
Action
The resulting UPDATE_NAME_FIELD action.
debouncedUpdatePages(value) → {Action}
Produces an action indicating that the number of pages for the edition
should be updated with the provided value. The action is marked to be
debounced by the keystroke debouncer defined for redux-debounce.
Parameters:
Name | Type | Description |
---|---|---|
value |
number
|
The new value to be used for the number of pages. |
Returns:
- Type:
-
Action
The resulting UPDATE_PAGES action.
debouncedUpdateReleaseDate(newReleaseDate) → {Action}
Produces an action indicating that the release date for the edition
should be updated with the provided value. The action is marked to be
debounced by the keystroke debouncer defined for redux-debounce.
Parameters:
Name | Type | Description |
---|---|---|
newReleaseDate |
string
|
The new value to be used for the release date. |
Returns:
- Type:
-
Action
The resulting UPDATE_RELEASE_DATE action.
debouncedUpdateSortNameField(newSortName) → {Action}
Produces an action indicating that the sort name for the entity being edited
should be updated with the provided value. The action is marked to be
debounced by the keystroke debouncer defined for redux-debounce.
Parameters:
Name | Type | Description |
---|---|---|
newSortName |
string
|
The new value to be used for the sort name. |
Returns:
- Type:
-
Action
The resulting UPDATE_SORT_NAME_FIELD action.
debouncedUpdateWeight(value) → {Action}
Produces an action indicating that the weight for the edition
should be updated with the provided value. The action is marked to be
debounced by the keystroke debouncer defined for redux-debounce.
Parameters:
Name | Type | Description |
---|---|---|
value |
number
|
The new value to be used for the edition weight. |
Returns:
- Type:
-
Action
The resulting UPDATE_WEIGHT action.
debouncedUpdateWidth(value) → {Action}
Produces an action indicating that the width for the edition
should be updated with the provided value. The action is marked to be
debounced by the keystroke debouncer defined for redux-debounce.
Parameters:
Name | Type | Description |
---|---|---|
value |
number
|
The new value to be used for the width. |
Returns:
- Type:
-
Action
The resulting UPDATE_WIDTH action.
debounceUpdateAnnotation(value) → {Action}
Produces an action indicating that the annotation for the editing form
should be updated with the provided value. The action is marked to be
debounced by the keystroke debouncer defined for redux-debounce.
Parameters:
Name | Type | Description |
---|---|---|
value |
string
|
The new value to be used for the revision note. |
Returns:
- Type:
-
Action
The resulting UPDATE_ANNOTATION action.
debounceUpdateRevisionNote(value) → {Action}
Produces an action indicating that the revision note for the editing form
should be updated with the provided value. The action is marked to be
debounced by the keystroke debouncer defined for redux-debounce.
Parameters:
Name | Type | Description |
---|---|---|
value |
string
|
The new value to be used for the revision note. |
Returns:
- Type:
-
Action
The resulting UPDATE_REVISION_NOTE action.
DevelopPage() → {JSX.Element}
Renders the document and displays the 'Develop' page.
Returns:
- Type:
-
JSX.Element
a React JSX Element
disablePhysical() → {Action}
Produces an action indicating that the physical section of the edition
form should not be editable.
Returns:
- Type:
-
Action
The resulting DISABLE_PHYSICAL action.
DisambiguationField(props) → {Object}
Presentational component. Renders the disambiguation field for the name
section of entity editing forms.
Parameters:
Name | Type | Description |
---|---|---|
props.error |
boolean
|
Passed to the ValidationLabel within the component to indicate a validation error. |
props |
Object
|
an object containing the properties to be passed down to the child input element. |
Returns:
- Type:
-
Object
a React component containing the rendered input
dispatch(dispatch)
Parameters:
Name | Type | Description |
---|---|---|
dispatch |
function
|
The redux dispatch function. |
dispatch(dispatch)
Parameters:
Name | Type | Description |
---|---|---|
dispatch |
function
|
The redux dispatch function. |
DragAndDrop(props) → {JSX.Element}
A component for a drag-and-drop card that displays an achievement.
The card displays an image of the achievement and allows the user to drag and drop a different achievement onto it.
When a new achievement is dropped onto the card, it is displayed instead of the original achievement.
Parameters:
Name | Type | Description |
---|---|---|
props |
Props
|
The props object containing the following: |
Returns:
- Type:
-
JSX.Element
A React component that displays a drag-and-drop card for an achievement.
DragAndDropImage(props) → {JSX.Element}
The `DragAndDropImage` component renders an image of a particular achievement badge, which can be dragged to set the user's publicly showcased achievements.
Parameters:
Name | Type | Description |
---|---|---|
props |
Props
|
Props for the component |
Returns:
- Type:
-
JSX.Element
- The rendered image element.
dumpEdition(type) → {Action}
Produces an action indicating that current edition state should be saved in `Editions`.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
type |
string
|
type of new entity which caused dump |
Returns:
- Type:
-
Action
The resulting DUMP_EDITION action.
duplicateWork(id) → {Action}
Produces an action indicating that a Work need to be copied.
Parameters:
Name | Type | Description |
---|---|---|
id |
string
|
id of the work to be copied |
Returns:
- Type:
-
Action
The resulting DUPLICATE_WORK action.
EditionGroupSection(props) → {ReactElement}
Container component. The EditionGroupSection component contains input fields
specific to the editionGroup entity. The intention is that this component is
rendered as a modular section within the entity editor.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered
EditionGroupSection.
EditionGroupSectionMerge(props) → {ReactElement}
Container component. The EditionGroupSectionMerge component contains input fields
specific to merging editionGroup entities. The intention is that this component is
rendered as a modular section within the entity editor.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered
EditionGroupSectionMerge.
EditionSection(props) → {ReactElement}
Container component. The EditionSection component contains input fields
specific to the edition entity. The intention is that this component is
rendered as a modular section within the entity editor.
Parameters:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered EditionSection.
EditionSectionMerge(props) → {ReactElement}
Container component. The EditionSectionMerge component contains input fields
specific to the edition entity. The intention is that this component is
rendered as a modular section within the entity editor.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
depthValue
|
Returns:
- Type:
-
ReactElement
React element containing the rendered EditionSectionMerge.
editSeriesItem(data, rowID) → {Action}
Produces an action indicating that the attribute value of the entity being
edited should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
data |
Attribute
|
The new attribute value to be used for the entity. |
rowID |
string
|
The ID of the series item that is being edited. |
Returns:
- Type:
-
Action
The resulting EDIT_SERIES_ITEM action.
enablePhysical() → {Action}
Produces an action indicating that the physical section of the edition
form should be editable.
Returns:
- Type:
-
Action
The resulting ENABLE_PHYSICAL action.
EntityCountTable(props) → {JSX.Element}
Renders the document and displays the EntityCountTable table.
Parameters:
Name | Type | Description |
---|---|---|
props |
EntityCountTableProps
|
The properties passed to the EntityCountTable component. |
Returns:
- Type:
-
JSX.Element
a HTML document which displays the
EntityCountTable table in the statistics page
EntityEditor(props) → {ReactElement}
Container component. Renders all of the sections of the entity editing form.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered EntityEditor.
entityEditorMarkup(props) → {object}
Return markup for the entity editor.
This also modifies the props value with a new initialState!
Parameters:
Name | Type | Description |
---|---|---|
props |
object
|
react props |
Returns:
- Type:
-
object
- Updated props and HTML string with markup
EntityMerge(props) → {ReactElement}
Container component. Renders all of the sections of the entity editing form.
Parameters:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered EntityMerge.
entityMergeMarkup(props) → {object}
Return markup for the entity merging tool.
This also modifies the props value with a new initialState!
Parameters:
Name | Type | Description |
---|---|---|
props |
object
|
react props |
Returns:
- Type:
-
object
- Updated props and HTML string with markup
entityToOption(entity) → {object}
Transforms an entity to a react-select component option
- Source:
Parameters:
Name | Type | Description |
---|---|---|
entity |
object
|
The entity to transfrom |
Returns:
- Type:
-
object
option - A react-select option
entityToOption(entity) → {Object}
Takes an entity and converts it to a format acceptable to react-select.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
entity |
Object
|
the entity to convert |
Returns:
- Type:
-
Object
the formatted data
FAQPage() → {JSX.Element}
Renders the page for the Frequently Asked Questions on Bookbrainz
- Source:
Returns:
- Type:
-
JSX.Element
a React JSX Element
filterOutRelationshipTypeById(entity, relationshipTypeId) → {array}
Remove the all relationships which are belongs to given relationshipTypeId.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
entity |
object
|
Entity with all relationships |
relationshipTypeId |
number
|
typeId of spacific relationshipType |
Returns:
- Type:
-
array
retrun the all relationships after removing the relatioships for given relationshipTypeId
firstIndexOfUnbalancedParanthesis(url) → {number}
Find the first index of an unbalanced paranthesis in a url string.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
url |
string
|
URL string. |
Returns:
- Type:
-
number
idx - index of the first unbalanced parathesis. If no unbalanced paranthesis found, returns -1
formatYearForDisplay(year) → {string}
If year is a number, pad it for clarity ('84' -> '0084' to clarify it isn't '1984')
If it is too long (eg. extended ISO format ±YYYYYY), trim it
Parameters:
Name | Type | Description |
---|---|---|
year |
string
|
number
|
The year string or number to format |
Returns:
- Type:
-
string
a short ISO date string (YYYY-MM-DD)
generateEntityMergeProps(req, res, additionalProps, initialStateCallback) → {object}
Returns a props object with reasonable defaults for entity creation/editing.
Parameters:
Name | Type | Description |
---|---|---|
req |
request
|
request object |
res |
response
|
response object |
additionalProps |
object
|
additional props |
initialStateCallback |
initialStateCallback
|
callback to get the initial state |
Returns:
- Type:
-
object
- props
generateEntityProps(entityType, req, res, additionalProps, initialStateCallback) → {object}
Returns a props object with reasonable defaults for entity creation/editing.
Parameters:
Name | Type | Description |
---|---|---|
entityType |
string
|
entity type |
req |
request
|
request object |
res |
response
|
response object |
additionalProps |
object
|
additional props |
initialStateCallback |
initialStateCallback
|
callback to get the initial state |
Returns:
- Type:
-
object
- props
generateUnifiedProps(req, res, additionalProps, initialStateCallback) → {object}
Returns a props object with reasonable defaults for unified form.
Parameters:
Name | Type | Description |
---|---|---|
req |
request
|
request object |
res |
response
|
response object |
additionalProps |
object
|
additional props |
initialStateCallback |
initialStateCallback
|
callback to get the initial state |
Returns:
- Type:
-
object
- props
getAcceptedLanguageCodes(request) → {Array.<string>}
Extracts language codes from the Accept-Language header, ordered by weight/preference.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
request |
Request
|
Request object which includes HTTP headers. |
Returns:
- Type:
-
Array.<string>
Parsed language codes, sorted by weight in descending order.
getAdditionalRelations(modelType) → {array}
Return additional relations to withRelated array according to modelType
- Source:
Parameters:
Name | Type | Description |
---|---|---|
modelType |
string
|
type of the model or entity |
Returns:
- Type:
-
array
array of additional relations
getAllEntities(orm) → {Array.<Object>}
Retrieves the total count of all entities in the database and returns it as an array of objects,
where each object contains the entity name and its count. The results are sorted by count in
descending order.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
orm |
Object
|
An object representing the ORM. |
Throws:
-
If there is an error fetching entities lifetime total
- Type
-
Error
Returns:
- Type:
-
Array.<Object>
An array of objects, where each object contains the entity name and its count
getAssociatedEntityRevisions(revisions, orm) → {array}
Fetches the entities affected by a revision, their alias
or in case of deleted entities their last know alias.
It then attaches the necessary information to each revisions's entities array
- Source:
Parameters:
Name | Type | Description |
---|---|---|
revisions |
array
|
the array of revisions |
orm |
object
|
the BookBrainz ORM, initialized during app setup |
Returns:
- Type:
-
array
- The modified revisions array
getAvailableWikipediaArticles(wikidataId)
Fetches a list of Wikipedia articles in all available languages for the given Wikidata item.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
wikidataId |
string
|
Wikidata item ID. |
getDefaultAliasIndex(aliasSet) → (nullable) {number}
Returns the index of the default alias if defined in the aliasSet.
If there is no defaultAliasId, return the first alias where default = true.
Returns null if there are no aliases in the set.
- Source:
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
aliasSet |
Object
|
The entity's aliasSet returned by the ORM
|
Returns:
- Type:
-
number
The index of the default alias, or 0; returns null if 0 aliases in set
getEntityByBBID(orm, bbid, otherRelations) → {Promise}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
orm |
Object
|
orm |
bbid |
string
|
bookbrainz id |
otherRelations |
Array
|
entity specific relations to fetch |
Returns:
- Type:
-
Promise
- Promise resolves to entity data if exist else null
getEntityLink(entity) → {string}
Returns an API path for interacting with the given Bookshelf entity model
- Source:
Parameters:
Name | Type | Description |
---|---|---|
entity |
object
|
Entity object |
Returns:
- Type:
-
string
- URL path to interact with entity
getEntityModelByType(orm, type) → {object}
Retrieves the Bookshelf entity model with the given the model name
- Source:
Parameters:
Name | Type | Description |
---|---|---|
orm |
object
|
the BookBrainz ORM, initialized during app setup |
type |
string
|
Name or type of model |
Throws:
-
Throws a custom error if the param 'type' does not map to a model
- Type
-
Error
Returns:
- Type:
-
object
- Bookshelf model object with the type specified in the
single param
getEntityModels(orm) → {object}
Returns all entity models defined in bookbrainz-data-js
- Source:
Parameters:
Name | Type | Description |
---|---|---|
orm |
object
|
the BookBrainz ORM, initialized during app setup |
Returns:
- Type:
-
object
- Object mapping model name to the entity model
getEntitySectionByType(entityType, entities) → {object}
Returns the initial form state for the $entity$ section depending on the entity type
- Source:
Parameters:
Name | Type | Description |
---|---|---|
entityType |
string
|
Entity type string (lowercased) |
entities |
Array.<object>
|
Array of entities to merge |
Throws:
Will throw an error if the entityType is not one of the know entity types, lowercased.
Returns:
- Type:
-
object
- The entity section initial form state
getEntityTable(entityType) → {JSX}
Returns EntityTable associated with the entity type.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
entityType |
string
|
Entity Type (author, work, series etc ...) |
Returns:
- Type:
-
JSX
returns EntityTable Component
getIdByField(model, fieldName, fieldValue) → {Promise}
Fetch Id of a model using field value
- Source:
Parameters:
Name | Type | Description |
---|---|---|
model |
object
|
Model eg. Language |
fieldName |
string
|
given field eg. name |
fieldValue |
string
|
given field value eg. English |
Returns:
- Type:
-
Promise
- Resolves to required id
getIdByLabel(fromOptions, label, keyName) → {number}
Fetch id related with label
- Source:
Parameters:
Name | Type | Description |
---|---|---|
fromOptions |
Array.<object>
|
Options |
label |
string
|
related label |
keyName |
string
|
key associated |
Returns:
- Type:
-
number
- assigned id
getInitAttribute(attributes, id) → {void}
A function to extract individual attribute object corresponding to a attribute id
from attributes array.
Parameters:
Name | Type | Description |
---|---|---|
attributes |
array
|
Array of attributes. |
id |
number
|
Attribute id. |
Returns:
- Type:
-
void
getOrderedCollectionsForEditorPage(from, size, entityType, req) → {array}
This checks whether Editor is valid or not.
If Editor is valid then this extracts and returns collections of that editor;
If the user is not the editor, then only "Public' collections are returned
- Source:
Parameters:
Name | Type | Description |
---|---|---|
from |
number
|
the offset value |
size |
number
|
no. of last collections required |
entityType |
string
|
entityType filter |
req |
object
|
req is an object containing information about the HTTP request |
Returns:
- Type:
-
array
- orderedCollections for particular Editor
getPrivilegeBitsArray(privs) → {Array}
Retrieves the bits of all the privileges set in the privs variable
Parameters:
Name | Type | Description |
---|---|---|
privs |
number
|
the privileges of the user |
Throws:
-
Throws a custom error if there is some unsupported privilege type
- Type
-
Error
Returns:
- Type:
-
Array
- returns an array of containing the bits of all the privileges the user has set
getProgress(achievementId, editorId, orm) → {Promise.<number>}
Get progress counter of achievement for a editor
- Source:
Parameters:
Name | Type | Description |
---|---|---|
achievementId |
number
|
Achivement Type id |
editorId |
number
|
editorId |
orm |
object
|
orm |
Returns:
- Type:
-
Promise.<number>
- Promise resolved to progress counter
getRelationshipSourceByTypeId(entity, relationshipTypeId) → {array}
Get an array of all sources from relationships of an entity belongs to given relationshipTypeId
- Source:
Parameters:
Name | Type | Description |
---|---|---|
entity |
object
|
main entity |
relationshipTypeId |
number
|
typeId of spacific relationshipType |
Returns:
- Type:
-
array
Return array of all the sources belongs to entity relationships for given relationshipTypeId
getRelationshipTargetBBIDByTypeId(entity, relationshipTypeId) → {array}
Get an array of all target BBIDs from relationships of an entity belongs to given relationshipTypeId
- Source:
Parameters:
Name | Type | Description |
---|---|---|
entity |
object
|
an entity with all relationships |
relationshipTypeId |
number
|
typeId of spacific relationshipType |
Returns:
- Type:
-
array
Return array of all the targetBBIDs belongs to entity relationships for given relationshipTypeId
getRelationshipTargetByTypeId(entity, relationshipTypeId) → {array}
Get an array of all targets from relationships of an entity belongs to given relationshipTypeId
- Source:
Parameters:
Name | Type | Description |
---|---|---|
entity |
object
|
an entity with all relationships |
relationshipTypeId |
number
|
typeId of spacific relationshipType |
Returns:
- Type:
-
array
Return array of all the targets belongs to entity relationships for given relationshipTypeId
getTodayDate() → {object}
Returns today's date as a {day, month, year} object
Used to check if a date is in the future
- Source:
Returns:
- Type:
-
object
today's date as a {day, month, year} object
getUfValidator(validator) → {function}
Validate the unified form state
Parameters:
Name | Type | Description |
---|---|---|
validator |
function
|
validator function |
Returns:
- Type:
-
function
- uf validator function
getWikipediaExtractForWikidata(wikidataId, preferredLanguages)
Fetches a Wikipedia extract for the given Wikidata item.
Parameters:
Name | Type | Description |
---|---|---|
wikidataId |
string
|
Wikidata item ID. |
preferredLanguages |
Array.<string>
|
List of language codes, preference in descending order. |
HelpPage() → {JSX.Element}
Renders the document and displays the 'Help' page.
- Source:
Returns:
- Type:
-
JSX.Element
a React JSX Element
hideAliasEditor() → {Action}
Produces an action indicating that the alias editor should be hidden from
view.
Returns:
- Type:
-
Action
The resulting HIDE_ALIAS_EDITOR action.
hideAuthorCreditEditor() → {Action}
Produces an action indicating that the Author Credit editor popup should be hidden
Returns:
- Type:
-
Action
The resulting HIDE_AUTHOR_CREDIT_EDITOR action.
hideIdentifierEditor() → {Action}
Produces an action indicating that the identifier editor should be hidden
from view.
Returns:
- Type:
-
Action
The resulting HIDE_IDENTIFIER_EDITOR action.
IdentifierButton(props) → {ReactElement}
Presentational component. The IdentifierButton component renders a button
component in the style of a link. The link text indicates the number of
identifiers currently set in the IdentifierEditor, and invites the user to
add new or edit existing identifiers.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered
IdentifierButton.
IdentifierEditor(props) → {ReactElement}
Container component. The IdentifierEditor component contains a number of
IdentifierRow elements, and renders these inside a modal, which appears when
the show property of the component is set.
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered
IdentifierEditor.
IdentifierRow(props) → {ReactElement}
Container component. The IdentifierRow component renders a single Row
containing several input fields, allowing the user to set the value and type
for an identifier in the IdentifierEditor. A button is also included to
remove the identifier from the editor.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered IdentifierRow.
incrementEditorEditCountById(orm, id, transacting) → {Promise}
Adds 1 to the edit count of the specified editor
- Source:
Parameters:
Name | Type | Description |
---|---|---|
orm |
object
|
the BookBrainz ORM, initialized during app setup |
id |
string
|
row ID of editor to be updated |
transacting |
object
|
Bookshelf transaction object (must be in progress) |
Returns:
- Type:
-
Promise
- Resolves to the updated editor model
indexAutoCreatedEditionGroup(orm, newEdition, transacting)
Edition Groups will be created automatically by the ORM if no EditionGroup BBID is set on a new Edition.
This method fetches and indexes (search) those potential new EditionGroups that may have been created automatically.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
orm |
any
|
The BookBrainz ORM |
newEdition |
any
|
The ORM model of the newly created Edition |
transacting |
any
|
The ORM transaction object |
init(orm, optionsopt) → {Promise.<boolean>}
Sets up the search server connection with defaults,
and returns a connection status boolean
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
orm |
ORM
|
the BookBrainz ORM | |
options |
ClientOptions
|
<optional> |
Optional (but recommended) connection settings, will provide defaults if missing |
Returns:
- Type:
-
Promise.<boolean>
A Promise which resolves to the connection status boolean
injectDefaultAliasName(instance) → {object}
Injects entity model object with a default alias name property.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
instance |
object
|
Entity object. |
Returns:
- Type:
-
object
- New object with injected properties.
isArea(entity) → {boolean}
Determines whether an entity provided to the EntitySearch component is an
Area, using the present attributes.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
entity |
Object
|
the entity to test |
Returns:
- Type:
-
boolean
true if the entity looks like an Area
isbn10To13(isbn10) → {string}
Convert ISBN-10 to ISBN-13
- Source:
Parameters:
Name | Type | Description |
---|---|---|
isbn10 |
string
|
valid ISBN-10 |
Returns:
- Type:
-
string
ISBN-13
isbn13To10(isbn13) → {string}
Convert ISBN-13 to ISBN-10
- Source:
Parameters:
Name | Type | Description |
---|---|---|
isbn13 |
string
|
valid ISBN-13 |
Returns:
- Type:
-
string
ISBN-10
isCoverTabEmpty(data) → {boolean}
Check whether Cover Tab is modified or not.
Parameters:
Name | Type | Description |
---|---|---|
data |
object
|
the form state object |
Returns:
- Type:
-
boolean
- true if cover tab state empty
isDetailTabEmpty(data) → {boolean}
Check whether Detail Tab is modified or not.
Parameters:
Name | Type | Description |
---|---|---|
data |
object
|
the form state object |
Returns:
- Type:
-
boolean
- true if detail tab state is empty
isNullDate(date) → {boolean}
Determines wether a given date is empty or null, meaning no year month or day has been specified.
Accepts a {day, month, year} object or an ISO 8601-2004 string (±YYYYYY-MM-DD)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
date |
object
|
string
|
a {day, month, year} object or ISO 8601-2004 string (±YYYYYY-MM-DD) |
Returns:
- Type:
-
boolean
true if the date is empty/null
ISODateStringToObject(value) → {object}
Parse an ISO 8601-2004 string and return an object with separate day, month and year, if they exist.
If any of the values don't exist, the default is an empty string.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
string
|
relationshipId number for initaial relationship |
Returns:
- Type:
-
object
a {day, month, year} object
isValidBBID(bbid) → {boolean}
Tests if a BookBrainz UUID is valid
- Source:
Parameters:
Name | Type | Description |
---|---|---|
bbid |
string
|
BookBrainz UUID to validate |
Returns:
- Type:
-
boolean
- Returns true if BookBrainz UUID is valid
LanguageField(props) → {Object}
Presentational component. This component renders a dropdown selection box
allowing the user to select from a list of provided language options. The
input is labelled with a ValidationLabel containing the text 'Language'.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component, which are
then passed to the underlying VirtualizedSelect component.
|
Returns:
- Type:
-
Object
A React component containing the rendered input.
LicensingPage() → {JSX.Element}
Renders a page containing information about the licensing and copyrights for the content available on the Bookbrainz.
Returns:
- Type:
-
JSX.Element
a React JSX Component
loadEdition(editionId) → {Action}
Produces an action indicating that particular edition state having that id
should be loaded from `Editions`.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
editionId |
string
|
id of edition to load |
Returns:
- Type:
-
Action
The resulting LOAD_EDITION action.
LoadingSpinner() → {JSX.Element}
Renders a LoadingSpinner Component displaying a spinning loading icon.
Returns:
- Type:
-
JSX.Element
The JSX content of the LoadingSpinner indicator
makeEntityCreateOrEditHandler(entityType, transformNewForm, propertiesToPick, isMergeHandler) → {createOrEditHandler}
Makes a middleware handler for create or edit actions on entities.
Parameters:
Name | Type | Description |
---|---|---|
entityType |
string
|
entity type |
transformNewForm |
transformCallback
|
callback for transformations |
propertiesToPick |
string
|
Array.<string>
|
props from transformed request body to pick. |
isMergeHandler |
boolean
|
Wether the submission was from a /merge/handler route |
Returns:
- Type:
-
createOrEditHandler
createOrEditHandler - middleware handler
makePromiseFromObject(obj) → {Promise.<object>}
This function maps `{a: somePromise}` to a promise that
resolves with `{a: resolvedValue}`.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
obj |
object
|
an object with Promises as values |
Returns:
- Type:
-
Promise.<object>
- A Promise resolving to the object with resolved values
MergeField(props) → {Object}
Presentational component. This component renders a plain text input and a
ValidationLabel for a field labelled 'Name'.
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
Object
a React component containing the rendered input
NameField(props) → {Object}
Presentational component. This component renders a plain text input and a
ValidationLabel for a field labelled 'Name'.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
Object
a React component containing the rendered input
NameSectionMerge(props) → {ReactElement}
Container component. The NameSectionMerge component contains input fields for
setting the name of an entity. It also allows setting of the entity's
disambiguation. The intention is that this component is rendered as a
modular section within the entity editor.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered NameSectionMerge.
NumericField(props) → {Object}
Presentational component. This component renders a plain text input which
can be hidden, and an associated ValidationLabel.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
Object
A React component containing the rendered input.
openEntityModal() → {Action}
Set entity modal state to open
- Source:
Returns:
- Type:
-
Action
The resulting OPEN_ENTITY_MODAL action.
parseAcceptLanguage(acceptLanguage) → {Array}
Parses an Accept-Language header to obtain the language codes, optional subtags and weights.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
acceptLanguage |
string
|
Accept-Language header value. |
Returns:
- Type:
-
Array
Parsed languages, sorted by weight in descending order.
parseLanguages(sourceEntitySection, orm) → {Promise}
Generate EntitySection Language state from req body
- Source:
Parameters:
Name | Type | Description |
---|---|---|
sourceEntitySection |
object
|
source entity section state in format of languages{index}:value |
orm |
object
|
orm object |
Returns:
- Type:
-
Promise
- Resolves to modified state
PrivacyPage() → {JSX.Element}
Renders a page containing a link to the current MusicBrainz privacy
policy, which will form the basis of a future privacy policy
for BookBrainz.
Returns:
- Type:
-
JSX.Element
an element containing the rendered output
PublisherSection(props) → {ReactElement}
Container component. The PublisherSection component contains input fields
specific to the publisher entity. The intention is that this component is
rendered as a modular section within the entity editor.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered
PublisherSection.
PublisherSectionMerge(props) → {ReactElement}
Container component. The PublisherSectionMerge component contains input fields
specific to the publisher entity. The intention is that this component is
rendered as a modular section within the entity editor.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered
PublisherSectionMerge.
RegistrationAuth() → {ReactElement}
Renders a page allowing the user to sign in to MusicBrainz to
continue the BookBrainz registration process.
Returns:
- Type:
-
ReactElement
an element containing the rendered output.
relationshipTypeCreateOrEditHandler(req, res, next) → {promise}
Creates a new reationship type or updates an existing relationship type
- Source:
Parameters:
Name | Type | Description |
---|---|---|
req |
object
|
request object |
res |
object
|
response object |
next |
object
|
next object |
Returns:
- Type:
-
promise
res.send promise
removeAliasRow(rowId) → {Action}
Produces an action indicating that the row with the provided ID should be
removed from the alias editor.
Parameters:
Name | Type | Description |
---|---|---|
rowId |
number
|
The ID for the row to be deleted. |
Returns:
- Type:
-
Action
The resulting REMOVE_ALIAS_ROW action.
removeAllSeriesItems() → {Action}
Produces an action indicating that all series items should be removed.
Returns:
- Type:
-
Action
The resulting REMOVE_ALL_SERIES_ITEMS action.
removeAuthorCreditRow(rowId) → {Action}
Produces an action indicating that the row with the provided ID should be
removed from the author credit editor.
Parameters:
Name | Type | Description |
---|---|---|
rowId |
number
|
The ID for the row to be deleted. |
Returns:
- Type:
-
Action
The resulting REMOVE_AUTHOR_CREDIT_ROW action.
removeEmptyAliases() → {Action}
Produces an action indicating that the empty rows should be deleted.
Returns:
- Type:
-
Action
The resulting REMOVE_EMPTY_ALIASES action.
removeEmptyCreditRows() → {Action}
Produces an action indicating that triggers the removal of empty items in the Author Credit
Returns:
- Type:
-
Action
The resulting REMOVE_EMPTY_CREDIT_ROWS action.
removeEmptyIdentifiers() → {Action}
Produces an action indicating that the empty rows should be deleted.
Returns:
- Type:
-
Action
The resulting REMOVE_EMPTY_IDENTIFIERS action.
removeIdentifierRow(rowId) → {Action}
Produces an action indicating that the row with the provided ID should be
removed from the identifier editor.
Parameters:
Name | Type | Description |
---|---|---|
rowId |
number
|
The ID for the row to be deleted. |
Returns:
- Type:
-
Action
The resulting REMOVE_IDENTIFIER_ROW action.
removeSeries(id) → {Action}
Produces an action indicating that a given Series should be removed from `Series`.
Parameters:
Name | Type | Description |
---|---|---|
id |
string
|
id of the series to be removed |
Returns:
- Type:
-
Action
The resulting REMOVE_SERIES action.
removeSeriesItem(rowID) → {Action}
Produces an action indicating that the series item with the provided ID should be
removed.
Parameters:
Name | Type | Description |
---|---|---|
rowID |
string
|
The ID of the series item that is being removed. |
Returns:
- Type:
-
Action
The resulting REMOVE_SERIES_ITEM action.
removeWork(id) → {Action}
Produces an action indicating that a given Work should be removed from `Works`.
Parameters:
Name | Type | Description |
---|---|---|
id |
string
|
id of the work to be removed |
Returns:
- Type:
-
Action
The resulting REMOVE_WORK action.
renderRelationship(relationship) → {string}
Returns the markup corresponding to the given entity relationship.
This markup is defined by a Handlebars template in
relationship.type.displayTemplate.
This function is used, for example, to render
relationships on entity display pages.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
relationship |
Relationship
|
Relationship object. |
Returns:
- Type:
-
string
- Rendered HTML string.
resetAuthorCredit() → {Action}
Returns:
- Type:
-
Action
The resulting RESET_AUTHOR_CREDIT action.
sanitize(text) → {string}
This function is to sanitize text inputs
- Source:
Parameters:
Name | Type | Description |
---|---|---|
text |
string
|
text to sanitize |
Returns:
- Type:
-
string
- sanitized text
searchName(name, entityBBID, type) → {searchName~dispatch}
Produces an action containing search results of the name entered by the user.
This is done by asynchronously calling the route /search/autocomplete.
Parameters:
Name | Type | Description |
---|---|---|
name |
string
|
The value to be checked if it already exists. |
entityBBID |
string
|
The BBID of the current entity, if it already exists |
type |
string
|
Entity type of the name. |
Returns:
- Type:
-
searchName~dispatch
The returned function.
sendEmail(from, to, subject-, html) → {Promise.<object>}
This helper function sends E-mail with attributes collected from argument in given order.
It uses nodemailer's transporter to send the E-mail under the hood.
It returns a promise that should be handled using .then()/.catch() or async/await syntax wrapped in a try…catch block.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
from |
string
|
Email address of sender |
to |
string
|
Email address of receiver |
subject- |
string
|
Subject of the E-mail |
html |
string
|
Body of E-mail in form of HTML |
Returns:
- Type:
-
Promise.<object>
Returns a promise that resolves with an error object if message failed or an info object if the message succeeded (see https://nodemailer.com/usage/ for more details)
If entity is found successfully in the database this function set the entity data
at res.locals.entity and return to next function.
Example
Promise way :
sendEmail("abc@gmail.com", "def@gmail.com", "Revision added to Entity", "some html string")
.then((response)=>{
// the response object contains details of a successful response (see https://nodemailer.com/usage)
console.log("Email has been sent successfully")
})
.catch((error)=>{
//handle error
})
Async/Await way :
try{
const response = await sendEmail("abc@gmail.com", "def@gmail.com", "Revision added to Entity", "some html string")
console.log("Email has been sent successfully")
}
catch (error) {
//handle the error
}
SeriesListItem(props) → {ReactElement}
This is a simple React component. No Redux connection. Renders the
Entity Search Field and displays the list of series items. The Entity Search
Field is a simple search box that allows the user to search for entities, and the Add
Button allows the user to add the entity. The remove button allows to
remove a entity from the list.
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React Component as a modular section within the entity editor.
SeriesSection(props) → {ReactElement}
Container component. The SeriesSection component contains input fields
specific to the series entity. The intention is that this component is
rendered as a modular section within the entity editor.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered
SeriesSection.
SeriesSectionMerge(props) → {ReactElement}
Container component. The SeriesSectionMerge component contains input fields
specific to merging series entities. The intention is that this component is
rendered as a modular section within the entity editor.
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered
SeriesSectionMerge.
setSubmitError(error) → {Action}
Produces an action indicating that the submit error for the editing form
should be updated with the provided value. This error is displayed in an
Alert if set, to indicate to the user what went wrong.
Parameters:
Name | Type | Description |
---|---|---|
error |
string
|
The error message to be set for the form. |
Returns:
- Type:
-
Action
The resulting SET_SUBMIT_ERROR action.
setSubmitted(submitted) → {Action}
Produces an action indicating whether the form has been submitted or not.
This consequently enables or disables the submit button to prevent double submissions
Parameters:
Name | Type | Description |
---|---|---|
submitted |
boolean
|
Boolean indicating if the form has been submitted |
Returns:
- Type:
-
Action
The resulting SET_SUBMITTED action.
setupSessions(environmentopt) → {function}
Set up sessions, using Redis in production and default to in-memory for testing environment.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
environment |
string
|
<optional> |
Node.js environment. |
Returns:
- Type:
-
function
Express session request handler.
showAliasEditor() → {Action}
Produces an action indicating that the alias editor should be made visible.
- Source:
- See:
Returns:
- Type:
-
Action
The resulting SHOW_ALIAS_EDITOR action.
showAuthorCreditEditor() → {Action}
Produces an action indicating that the Author Credit editor popup should be shown
Returns:
- Type:
-
Action
The resulting SHOW_AUTHOR_CREDIT_EDITOR action.
showIdentifierEditor() → {Action}
Produces an action indicating that the identifier editor should be made
visible.
Returns:
- Type:
-
Action
The resulting SHOW_IDENTIFIER_EDITOR action.
SortNameField(props) → {Object}
Presentational component. This component renders a plain text input which
incorporates a 'Guess Sort Name' button, and a ValidationLabel for a field
labelled 'Sort Name'. When clicked, the 'Guess Sort Name' button uses the
name value passed to the component to guess an appropriate sort name.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
Object
a React component containing the rendered input
sortRelationshipOrdinal(sortByProperty) → {array}
This function sorts the relationship array
- Source:
Parameters:
Name | Type | Description |
---|---|---|
sortByProperty |
string
|
name of property which will be used for sorting |
Returns:
- Type:
-
array
- sorted relationship array
sortSeriesItems(oldIndex, newIndex) → {void}
This action creator first sorts the series items object and then pass the
sorted object in the payload while dispatching the action.
Parameters:
Name | Type | Description |
---|---|---|
oldIndex |
number
|
Old Position of the series item. |
newIndex |
number
|
New Position of the series item. |
Returns:
- Type:
-
void
StatisticsPage(props) → {JSX.Element}
Renders the document and displays the 'Statistics' page.
Parameters:
Name | Type | Description |
---|---|---|
props |
StatisticsPageProps
|
The properties passed to the StatisticsPage component. |
Returns:
- Type:
-
JSX.Element
A HTML document which displays the statistics page.
StrategyMock()
Author: Michael Weibel
License: MIT
stringToHTMLWithLinks(content) → {JSX}
Convert any string url that has a prefix http|https|ftp|ftps to a clickable link
and then rendered the HTML string as real HTML.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
content |
string
|
Can be either revision notes or annotation content etc... |
Returns:
- Type:
-
JSX
returns a JSX Element
stripDot(name) → {String}
Removes all period characters (dots) from the input string, returning a new
string.
Parameters:
Name | Type | Description |
---|---|---|
name |
String
|
the input string to strip |
Returns:
- Type:
-
String
the string with dots removed
SubmissionSection(props) → {ReactElement}
Container component. The SubmissionSection component contains a button for
submitting the changes made on the entity editing form as a revision, and a
field for entering a note for this revision. It also displays any errors
encountered while submitting the revision to the server.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered
SubmissionSection.
submitSingleEntity(submissionUrl, entityType, callback, initialState) → {function}
Parameters:
Name | Type | Description |
---|---|---|
submissionUrl |
string
|
The URL to post the submission to |
entityType |
string
|
The type of entity being submitted |
callback |
function
|
A function that adds the entity to the store |
initialState |
Object
|
The initial state of the entity being submitted, this include some fields which are required by the server |
Returns:
- Type:
-
function
- A thunk that posts the submission to the server
template(strings) → {function}
Helper-function / template-tag that allows the values of an object that
is passed in at a later time to be interpolated into a
string.
Cribbed from MDN documentation on template literals:
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals#Tagged_template_literals
- Source:
Parameters:
Name | Type | Description |
---|---|---|
strings |
Array.<string>
|
Array of string literals from template |
Returns:
- Type:
-
function
- Takes an object/array as an argument.
When invoked, it will return a string with all the key names from
the tagged template literal replaced with their corresponding values
from the newly passed in object.
toggleAuthorCredit() → {Action}
Produces an action indicating that the AC checkbox should be toggled.
Returns:
- Type:
-
Action
The resulting TOGGLE_AUTHOR_CREDIT action.
toggleCheck(id) → {Action}
Produces an action indicating that a Work's checkbox should be toggled in `Works`.
Parameters:
Name | Type | Description |
---|---|---|
id |
string
|
id of the work to be toggle |
Returns:
- Type:
-
Action
The resulting TOGGLE_COPY_AUTHOR_CREDITS action.
toggleShowEditionGroup(showEGSection:) → {Action}
Produces an action indicating that the Edition Group section of the edition
form should be shown.
Parameters:
Name | Type | Description |
---|---|---|
showEGSection: |
boolean
|
Whether to show the Edition Group selection section or not |
Returns:
- Type:
-
Action
The resulting TOGGLE_SHOW_EDITION_GROUP action.
TopEditorsTable(props) → {ReactElement}
Renders the document and displays the topEditors table.
Parameters:
Name | Type | Description |
---|---|---|
props |
TopEditorsTableProps
|
The properties passed to the TopEditorsTableProps component. |
Returns:
- Type:
-
ReactElement
a HTML document which displays the topEditors table
in the statistics page
transformISODateForDisplay(ISODateString) → {string}
Transforms an extended ISO 8601-2004 string to a more human-firendly result
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ISODateString |
string
|
an extended ISO date string (±YYYYYY-MM-DD) |
Returns:
- Type:
-
string
A date string with less padding zeros
transformISODateForSelect(dateValue) → {object}
Transforms an extended ISO 8601-2004 date string to an option fit for react-select
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dateValue |
string
|
object
|
an extended ISO date string (±YYYYYY-MM-DD) or date object {day,month,year} |
Returns:
- Type:
-
object
- A {label,value} object for react-select option
transformNewForm()
***************************
********** Helpers ************
transformNewForm()
***************************
********** Helpers ************
- Source:
unflatten(flattenObj)
Takes a flatten object and convert it into unflatten one
eg. { "a.c": 2 } -> { "a": { "c" : 2 } }
- Source:
Parameters:
Name | Type | Description |
---|---|---|
flattenObj |
Object
|
the flattened object i.e in diasy chain form |
unifiedFormMarkup(props) → {object}
Return markup for the unified form.
This also modifies the props value with a new initialState!
Parameters:
Name | Type | Description |
---|---|---|
props |
object
|
react props |
Returns:
- Type:
-
object
- Updated props and HTML string with markup
updateAliasLanguage(rowId, value) → {Action}
Produces an action indicating that the language for a particular alias
within the editor should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
rowId |
number
|
The ID of the row in the alias editor to update. |
value |
number
|
The new value to be used for the alias language ID. |
Returns:
- Type:
-
Action
The resulting UPDATE_ALIAS_LANGUAGE action.
updateAliasPrimary(rowId, value) → {Action}
Produces an action indicating that the primary flag for a particular alias
within the editor should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
rowId |
number
|
The ID of the row in the alias editor to update. |
value |
boolean
|
The new value to be used for the alias primary flag. |
Returns:
- Type:
-
Action
The resulting UPDATE_ALIAS_PRIMARY action.
updateArea(newArea) → {Action}
Produces an action indicating that the area for the publisher being edited
should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
newArea |
number
|
The new value to be used for the publisher area ID. |
Returns:
- Type:
-
Action
The resulting UPDATE_AREA action.
updateAuthorCredit(authorCredit) → {Action}
Produces an action indicating an existing Author Credit has been selected.
Used only on the Edition merge page
Parameters:
Name | Type | Description |
---|---|---|
authorCredit |
number
|
The selected existing Author Credit |
Returns:
- Type:
-
Action
The resulting UPDATE_AUTHOR_CREDIT action.
updateAutoISBN(value) → {Action}
Produces an action indicating that `autoISBN` value should be updated.
Parameters:
Name | Type | Description |
---|---|---|
value |
boolean
|
New value for autoISBN. |
Returns:
- Type:
-
Action
The resulting AUTO_ISBN action.
updateBeginArea(newBeginArea) → {Action}
Produces an action indicating that the begin area for the author being
edited should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
newBeginArea |
Area
|
The new value to be used for the begin area. |
Returns:
- Type:
-
Action
The resulting UPDATE_BEGIN_AREA action.
updateCreditAuthorValue(rowId, newAuthor) → {Action}
Produces an action indicating that the author value for a particular name
within the editor should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
rowId |
number
|
The ID of the row in the author credit editor to update. |
newAuthor |
Author
|
The new value to be used for the author value. |
Returns:
- Type:
-
Action
The resulting UPDATE_CREDIT_AUTHOR_VALUE action.
updateCreditDisplayValue(rowId, value) → {Action}
Produces an action indicating that the display value for a particular name
within the editor should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
rowId |
number
|
The ID of the row in the author credit editor to update. |
value |
string
|
The new value to be used for the author display. |
Returns:
- Type:
-
Action
The resulting UPDATE_CREDIT_DISPLAY_VALUE action.
updateCreditJoinPhraseValue(rowId, value) → {Action}
Produces an action indicating that the join phrase value for a particular
name within the editor should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
rowId |
number
|
The ID of the row in the author credit editor to update. |
value |
string
|
The new value to be used for the join phrase. |
Returns:
- Type:
-
Action
The resulting UPDATE_CREDIT_JOIN_PHRASE_VALUE action.
updateEditionGroup(newEditionGroup) → {Action}
Produces an action indicating that the Edition Group for the edition
being edited should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
newEditionGroup |
EditionGroup
|
The new EditionGroup object to be set for the edition. |
Returns:
- Type:
-
Action
The resulting UPDATE_EDITION_GROUP action.
updateEndArea(newEndArea) → {Action}
Produces an action indicating that the end area for the author being
edited should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
newEndArea |
Area
|
The new value to be used for the end area. |
Returns:
- Type:
-
Action
The resulting UPDATE_END_AREA action.
updateEnded(newEnded) → {Action}
Produces an action indicating that the ended flag for the author being
edited should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
newEnded |
boolean
|
The new value to be used for the ended flag. |
Returns:
- Type:
-
Action
The resulting UPDATE_ENDED action.
updateEnded(newEnded) → {Action}
Produces an action indicating that the ended flag for the publisher being
edited should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
newEnded |
boolean
|
The new value to be used for the ended flag. |
Returns:
- Type:
-
Action
The resulting UPDATE_ENDED action.
updateFormat(newFormatId) → {Action}
Produces an action indicating that the edition format for the edition being
edited should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
newFormatId |
number
|
The new value to be used for the edition format ID. |
Returns:
- Type:
-
Action
The resulting UPDATE_FORMAT action.
updateGender(newGenderId) → {Action}
Produces an action indicating that the gender for the author being edited
should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
newGenderId |
number
|
The new value to be used for the gender ID. |
Returns:
- Type:
-
Action
The resulting UPDATE_GENDER action.
updateIdentifierType(rowId, value) → {Action}
Produces an action indicating that the type for a particular identifier
within the editor should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
rowId |
number
|
The ID of the row in the identifier editor to update. |
value |
number
|
The new value to be used for the identifier type ID. |
Returns:
- Type:
-
Action
The resulting UPDATE_IDENTIFIER_TYPE action.
updateISBNType(typeId) → {Action}
Produces an action indicating that `ISBN` type should be updated.
Parameters:
Name | Type | Description |
---|---|---|
typeId |
number
|
Type of corresponding ISBN value. |
Returns:
- Type:
-
Action
The resulting UPDATE_ISBN_TYPE action.
updateLanguageField(newLanguageId) → {Action}
Produces an action indicating that the language of the name for the entity
being edited should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
newLanguageId |
string
|
The new value to be used for the language ID. |
Returns:
- Type:
-
Action
The resulting UPDATE_LANGUAGE_FIELD action.
updateLanguages(newLanguages) → {Action}
Produces an action indicating that the edition languages for the edition
being edited should be updated with the provided values.
Parameters:
Name | Type | Description |
---|---|---|
newLanguages |
LanguageOption
|
The new objects to be used for the edition languages. |
Returns:
- Type:
-
Action
The resulting UPDATE_LANGUAGES action.
updateLanguages(newLanguages) → {Action}
Produces an action indicating that the work languages for the work being
edited should be updated with the provided values.
Parameters:
Name | Type | Description |
---|---|---|
newLanguages |
LanguageOption
|
The new objects to be used for the work languages. |
Returns:
- Type:
-
Action
The resulting UPDATE_LANGUAGES action.
updateNameField(newName) → {Action}
Produces an action indicating that the name for the entity being edited
should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
newName |
string
|
The new value to be used for the name. |
Returns:
- Type:
-
Action
The resulting UPDATE_NAME_FIELD action.
updateOrderType(newType) → {Action}
Produces an action indicating that the ordering type for the series being
edited should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
newType |
number
|
The new value to be used for the series type ID. |
Returns:
- Type:
-
Action
The resulting UPDATE_ORDER_TYPE action.
updatePublisher(newPublisher) → {Action}
Produces an action indicating that the publisher for the edition
being edited should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
newPublisher |
Publisher
|
The new publisher object to be set for the edition. |
Returns:
- Type:
-
Action
The resulting UPDATE_PUBLISHER action.
updateSeriesType(seriesType) → {Action}
Produces an action indicating that the series type for the series being
edited should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
seriesType |
number
|
The new value to be used for the series type ID. |
Returns:
- Type:
-
Action
The resulting UPDATE_SERIES_TYPE action.
updateSortNameField(newSortName) → {Action}
Produces an action indicating that the sort name for the entity being edited
should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
newSortName |
string
|
The new value to be used for the sort name. |
Returns:
- Type:
-
Action
The resulting UPDATE_SORT_NAME_FIELD action.
updateType(newTypeId) → {Action}
Produces an action indicating that the author type for the author being
edited should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
newTypeId |
number
|
The new value to be used for the author type ID. |
Returns:
- Type:
-
Action
The resulting UPDATE_TYPE action.
updateType(newType) → {Action}
Produces an action indicating that the publisher type for the publisher
being edited should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
newType |
number
|
The new value to be used for the publisher type. |
Returns:
- Type:
-
Action
The resulting UPDATE_TYPE action.
updateType(newTypeId) → {Action}
Produces an action indicating that the publisher type for the publisher
being edited should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
newTypeId |
number
|
The new value to be used for the publisher type ID. |
Returns:
- Type:
-
Action
The resulting UPDATE_TYPE action.
updateType(newTypeId) → {Action}
Produces an action indicating that the work type for the work being
edited should be updated with the provided value.
Parameters:
Name | Type | Description |
---|---|---|
newTypeId |
number
|
The new value to be used for the work type ID. |
Returns:
- Type:
-
Action
The resulting UPDATE_TYPE action.
updateWork(id, value) → {Action}
Produces an action indicating that `Works` State should be updated with the new `Works`.
Parameters:
Name | Type | Description |
---|---|---|
id |
string
|
id of work to be updated |
value |
Object
|
updated work state. |
Returns:
- Type:
-
Action
The resulting UPDATE_WORK action.
validateCoverTab(data, identifierTypes) → {boolean}
Validates the Cover Tab state.
Parameters:
Name | Type | Description |
---|---|---|
data |
object
|
the form state object |
identifierTypes |
Array
|
the list of identifier types |
Returns:
- Type:
-
boolean
- true if form state valid, false if invalid
validateDetailTab(data) → {boolean}
Validates the Detail Tab state.
Parameters:
Name | Type | Description |
---|---|---|
data |
object
|
the form state object |
Returns:
- Type:
-
boolean
- true if detail tab state is valid
validateISBN(isbn) → {boolean}
Validates the ISBN Field.
Parameters:
Name | Type | Description |
---|---|---|
isbn |
object
|
ISBN state object containing `type` and `value` |
Returns:
- Type:
-
boolean
- true if valid, false if invalid
validateUnifiedForm(body) → {boolean}
Validate Unified form
Parameters:
Name | Type | Description |
---|---|---|
body |
object
|
request body |
Returns:
- Type:
-
boolean
ValidationLabel(props) → {Object}
Presentational component. This component renders a textual label, intended
to be used with an input. Some formatting is applied and an icon is chosen
based on the validation state passed in via the component properties.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
Object
A React component containing the rendered input.
ValueField(props) → {ReactElement}
Presentational component. Renders a text input field for setting the value
of an identifier, with an associated ValidationLabel.
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
A React component containing the rendered input
component.
WorkSection(props) → {ReactElement}
Container component. The WorkSection component contains input fields
specific to the work entity. The intention is that this component is
rendered as a modular section within the entity editor.
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered WorkSection.
WorkSectionMerge(props) → {ReactElement}
Container component. The WorkSectionMerge component contains input fields
specific to the work entity. The intention is that this component is
rendered as a modular section within the entity editor.
Parameters:
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object
|
The properties passed to the component.
|
Returns:
- Type:
-
ReactElement
React element containing the rendered WorkSectionMerge.
Type Definitions
blankBadge
The Achievement interface, defining the properties of an achievement.
Properties:
Name | Type | Description |
---|---|---|
name |
string
|
The name of the achievement. |
badgeUrl |
string
|
The source URL of the achievement's badge image. |
id |
number
|
The ID of the achievement. |
EntityInRelationship
Properties:
Name | Type | Attributes | Description | ||
---|---|---|---|---|---|
bbid |
string
|
||||
defaultAlias |
Object
|
<nullable> |
|||
Name | Type | Description |
---|---|---|
name |
string
|
type
string
- Source:
Type:
-
Object
initialStateCallback(entity)
Callback to get the initial state
Parameters:
Name | Type | Description |
---|---|---|
entity |
object
|
entity |
initialStateCallback(entity)
Callback to get the initial state
Parameters:
Name | Type | Description |
---|---|---|
entity |
object
|
entity |
Props
Props for DragAndDropImage component
Properties:
Name | Type | Description |
---|---|---|
achievementId |
number
|
ID of the achievement |
achievementName |
string
|
Name of the achievement |
height |
string
|
Height of the image |
src |
string
|
Image source URL |
Type:
-
Object
Props
Props for DragAndDropImage component
Properties:
Name | Type | Description |
---|---|---|
name |
string
|
The name of the DragAndDrop component. |
initialAchievement |
Achievement
|
The initial achievement to display in the card. |
Type:
-
Object
Relationship
Properties:
Name | Type | Description | |||
---|---|---|---|---|---|
source |
EntityInRelationship
|
||||
target |
EntityInRelationship
|
||||
type |
Object
|
||||
Name | Type | Description |
---|---|---|
displayTemplate |
string
|
- Source:
Type:
-
Object
transformCallback(body)
Callback for any transformations to the request body
Parameters:
Name | Type | Description |
---|---|---|
body |
object
|
request body |
transformCallback(req, res)
Handler for create or edit actions
Parameters:
Name | Type | Description |
---|---|---|
req |
object
|
request object |
res |
object
|
response object |