diff --git a/package.json b/package.json index b11c0f2fb5..21cea66d26 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ }, "browserslist": "> 0.25%, not dead", "overrides": { - "react-select-fast-filter-options":{ + "react-select-fast-filter-options": { "react-select": "$react-select" } }, @@ -41,7 +41,7 @@ "@fortawesome/free-solid-svg-icons": "^6.4.2", "@fortawesome/react-fontawesome": "^0.1.11", "array-move": "^3.0.1", - "bookbrainz-data": "^5.0.0", + "bookbrainz-data": "5.1.1", "chart.js": "^2.9.4", "chartjs-adapter-date-fns": "^1.0.0", "classnames": "^2.3.2", diff --git a/sql/migrations/2024-02-07-credit-section/down.sql b/sql/migrations/2024-02-07-credit-section/down.sql new file mode 100644 index 0000000000..acd67c9c4b --- /dev/null +++ b/sql/migrations/2024-02-07-credit-section/down.sql @@ -0,0 +1,42 @@ +BEGIN TRANSACTION; + +ALTER TABLE bookbrainz.edition_data DROP COLUMN credit_section; +ALTER TABLE bookbrainz.edition_group_data DROP COLUMN credit_section; + +-- Drop the existing view if it exists +DROP VIEW IF EXISTS + bookbrainz.edition, + bookbrainz.edition_group; + +CREATE VIEW bookbrainz.edition AS + SELECT + e.bbid, edd.id AS data_id, edr.id AS revision_id, (edr.id = edh.master_revision_id) AS master, edd.annotation_id, edd.disambiguation_id, dis.comment disambiguation, + als.default_alias_id, al."name", al.sort_name, edd.edition_group_bbid, edd.author_credit_id, edd.width, edd.height, + edd.depth, edd.weight, edd.pages, edd.format_id, edd.status_id, + edd.alias_set_id, edd.identifier_set_id, edd.relationship_set_id, + edd.language_set_id, edd.release_event_set_id, edd.publisher_set_id, e.type + FROM bookbrainz.edition_revision edr + LEFT JOIN bookbrainz.entity e ON e.bbid = edr.bbid + LEFT JOIN bookbrainz.edition_header edh ON edh.bbid = e.bbid + LEFT JOIN bookbrainz.edition_data edd ON edr.data_id = edd.id + LEFT JOIN bookbrainz.alias_set als ON edd.alias_set_id = als.id + LEFT JOIN bookbrainz.alias al ON al.id = als.default_alias_id + LEFT JOIN bookbrainz.disambiguation dis ON dis.id = edd.disambiguation_id + WHERE e.type = 'Edition'; + +CREATE VIEW bookbrainz.edition_group AS + SELECT + e.bbid, egd.id AS data_id, pcr.id AS revision_id, (pcr.id = egh.master_revision_id) AS master, egd.annotation_id, egd.disambiguation_id, dis.comment disambiguation, + als.default_alias_id, al."name", al.sort_name, egd.type_id, egtype.label as edition_group_type, egd.author_credit_id, egd.alias_set_id, egd.identifier_set_id, + egd.relationship_set_id, e.type + FROM bookbrainz.edition_group_revision pcr + LEFT JOIN bookbrainz.entity e ON e.bbid = pcr.bbid + LEFT JOIN bookbrainz.edition_group_header egh ON egh.bbid = e.bbid + LEFT JOIN bookbrainz.edition_group_data egd ON pcr.data_id = egd.id + LEFT JOIN bookbrainz.alias_set als ON egd.alias_set_id = als.id + LEFT JOIN bookbrainz.alias al ON al.id = als.default_alias_id + LEFT JOIN bookbrainz.disambiguation dis ON dis.id = egd.disambiguation_id + LEFT JOIN bookbrainz.edition_group_type egtype ON egtype.id = egd.type_id + WHERE e.type = 'EditionGroup'; + +COMMIT; \ No newline at end of file diff --git a/sql/migrations/2024-02-07-credit-section/up.sql b/sql/migrations/2024-02-07-credit-section/up.sql new file mode 100644 index 0000000000..4834320997 --- /dev/null +++ b/sql/migrations/2024-02-07-credit-section/up.sql @@ -0,0 +1,92 @@ +----------------------------------------------------------------------- +-- Adds a credit_section boolean column to edition_data and edition_group_data to make author credits optional -- +------------------------------------------------------------------------ + + +---------------------- ****** NOTICE ****** ---------------------- +-- Don't forget to run the create_trigger.sql script afterwards -- +------------------------------------------------------------------ + +BEGIN TRANSACTION; + +-- Adding credit_section column in edition_data and edition_group_data table and intitalizing it with true +ALTER TABLE bookbrainz.edition_data ADD COLUMN credit_section BOOLEAN DEFAULT TRUE; +ALTER TABLE bookbrainz.edition_group_data ADD COLUMN credit_section BOOLEAN DEFAULT TRUE; + +DROP VIEW IF EXISTS + bookbrainz.edition, + bookbrainz.edition_group; + +-- Recreate the view with the new definition +-- Adding credit_section column in edition view and edition_group view +CREATE VIEW bookbrainz.edition AS +SELECT e.bbid, + edd.id AS data_id, + edr.id AS revision_id, + edr.id = edh.master_revision_id AS master, + edd.annotation_id, + edd.disambiguation_id, + dis.comment AS disambiguation, + als.default_alias_id, + al.name, + al.sort_name, + edd.edition_group_bbid, + edd.author_credit_id, + edd.width, + edd.height, + edd.depth, + edd.weight, + edd.pages, + edd.format_id, + edd.status_id, + edd.alias_set_id, + edd.identifier_set_id, + edd.relationship_set_id, + edd.language_set_id, + edd.release_event_set_id, + edd.publisher_set_id, + edd.credit_section, + e.type + FROM bookbrainz.edition_revision edr + LEFT JOIN bookbrainz.entity e ON e.bbid = edr.bbid + LEFT JOIN bookbrainz.edition_header edh ON edh.bbid = e.bbid + LEFT JOIN bookbrainz.edition_data edd ON edr.data_id = edd.id + LEFT JOIN bookbrainz.alias_set als ON edd.alias_set_id = als.id + LEFT JOIN bookbrainz.alias al ON al.id = als.default_alias_id + LEFT JOIN bookbrainz.disambiguation dis ON dis.id = edd.disambiguation_id + WHERE e.type = 'Edition'; + +CREATE VIEW bookbrainz.edition_group AS +SELECT e.bbid, + egd.id AS data_id, + pcr.id AS revision_id, + pcr.id = egh.master_revision_id AS master, + egd.annotation_id, + egd.disambiguation_id, + dis.comment AS disambiguation, + als.default_alias_id, + al.name, + al.sort_name, + egd.type_id, + egtype.label AS edition_group_type, + egd.author_credit_id, + egd.alias_set_id, + egd.identifier_set_id, + egd.relationship_set_id, + egd.credit_section, + e.type + FROM bookbrainz.edition_group_revision pcr + LEFT JOIN bookbrainz.entity e ON e.bbid = pcr.bbid + LEFT JOIN bookbrainz.edition_group_header egh ON egh.bbid = e.bbid + LEFT JOIN bookbrainz.edition_group_data egd ON pcr.data_id = egd.id + LEFT JOIN bookbrainz.alias_set als ON egd.alias_set_id = als.id + LEFT JOIN bookbrainz.alias al ON al.id = als.default_alias_id + LEFT JOIN bookbrainz.disambiguation dis ON dis.id = egd.disambiguation_id + LEFT JOIN bookbrainz.edition_group_type egtype ON egtype.id = egd.type_id + WHERE e.type = 'EditionGroup'; + +---------------------- ****** NOTICE ****** ---------------------- +-- Don't forget to run the create_trigger.sql script afterwards -- +------------------------------------------------------------------ + +COMMIT TRANSACTION; \ No newline at end of file diff --git a/sql/schemas/bookbrainz.sql b/sql/schemas/bookbrainz.sql index 533a4eccea..5bb1af2aa6 100644 --- a/sql/schemas/bookbrainz.sql +++ b/sql/schemas/bookbrainz.sql @@ -352,7 +352,8 @@ CREATE TABLE bookbrainz.edition_data ( weight SMALLINT CHECK (weight >= 0), pages SMALLINT CHECK (pages >= 0), format_id INT, - status_id INT + status_id INT, + credit_section BOOLEAN DEFAULT TRUE ); ALTER TABLE bookbrainz.edition_data ADD FOREIGN KEY (author_credit_id) REFERENCES bookbrainz.author_credit (id); ALTER TABLE bookbrainz.edition_data ADD FOREIGN KEY (format_id) REFERENCES bookbrainz.edition_format (id); @@ -375,8 +376,10 @@ CREATE TABLE bookbrainz.edition_group_data ( annotation_id INT, disambiguation_id INT, author_credit_id INT, - type_id INT + type_id INT, + credit_section BOOLEAN DEFAULT TRUE ); + ALTER TABLE bookbrainz.edition_group_data ADD FOREIGN KEY (type_id) REFERENCES bookbrainz.edition_group_type (id); ALTER TABLE bookbrainz.edition_group_data ADD FOREIGN KEY (author_credit_id) REFERENCES bookbrainz.author_credit (id); ALTER TABLE bookbrainz.edition_group_revision ADD FOREIGN KEY (data_id) REFERENCES bookbrainz.edition_group_data (id); @@ -867,20 +870,41 @@ CREATE VIEW bookbrainz.author AS WHERE e.type = 'Author'; CREATE VIEW bookbrainz.edition AS - SELECT - e.bbid, edd.id AS data_id, edr.id AS revision_id, (edr.id = edh.master_revision_id) AS master, edd.annotation_id, edd.disambiguation_id, dis.comment disambiguation, - als.default_alias_id, al."name", al.sort_name, edd.edition_group_bbid, edd.author_credit_id, edd.width, edd.height, - edd.depth, edd.weight, edd.pages, edd.format_id, edd.status_id, - edd.alias_set_id, edd.identifier_set_id, edd.relationship_set_id, - edd.language_set_id, edd.release_event_set_id, edd.publisher_set_id, e.type - FROM bookbrainz.edition_revision edr - LEFT JOIN bookbrainz.entity e ON e.bbid = edr.bbid - LEFT JOIN bookbrainz.edition_header edh ON edh.bbid = e.bbid - LEFT JOIN bookbrainz.edition_data edd ON edr.data_id = edd.id - LEFT JOIN bookbrainz.alias_set als ON edd.alias_set_id = als.id - LEFT JOIN bookbrainz.alias al ON al.id = als.default_alias_id - LEFT JOIN bookbrainz.disambiguation dis ON dis.id = edd.disambiguation_id - WHERE e.type = 'Edition'; +SELECT e.bbid, + edd.id AS data_id, + edr.id AS revision_id, + edr.id = edh.master_revision_id AS master, + edd.annotation_id, + edd.disambiguation_id, + dis.comment AS disambiguation, + als.default_alias_id, + al.name, + al.sort_name, + edd.edition_group_bbid, + edd.author_credit_id, + edd.width, + edd.height, + edd.depth, + edd.weight, + edd.pages, + edd.format_id, + edd.status_id, + edd.alias_set_id, + edd.identifier_set_id, + edd.relationship_set_id, + edd.language_set_id, + edd.release_event_set_id, + edd.publisher_set_id, + edd.credit_section, + e.type + FROM bookbrainz.edition_revision edr + LEFT JOIN bookbrainz.entity e ON e.bbid = edr.bbid + LEFT JOIN bookbrainz.edition_header edh ON edh.bbid = e.bbid + LEFT JOIN bookbrainz.edition_data edd ON edr.data_id = edd.id + LEFT JOIN bookbrainz.alias_set als ON edd.alias_set_id = als.id + LEFT JOIN bookbrainz.alias al ON al.id = als.default_alias_id + LEFT JOIN bookbrainz.disambiguation dis ON dis.id = edd.disambiguation_id + WHERE e.type = 'Edition'; CREATE VIEW bookbrainz.work AS SELECT @@ -914,19 +938,33 @@ CREATE VIEW bookbrainz.publisher AS WHERE e.type = 'Publisher'; CREATE VIEW bookbrainz.edition_group AS - SELECT - e.bbid, egd.id AS data_id, pcr.id AS revision_id, (pcr.id = egh.master_revision_id) AS master, egd.annotation_id, egd.disambiguation_id, dis.comment disambiguation, - als.default_alias_id, al."name", al.sort_name, egd.type_id, egtype.label as edition_group_type, egd.author_credit_id, egd.alias_set_id, egd.identifier_set_id, - egd.relationship_set_id, e.type - FROM bookbrainz.edition_group_revision pcr - LEFT JOIN bookbrainz.entity e ON e.bbid = pcr.bbid - LEFT JOIN bookbrainz.edition_group_header egh ON egh.bbid = e.bbid - LEFT JOIN bookbrainz.edition_group_data egd ON pcr.data_id = egd.id - LEFT JOIN bookbrainz.alias_set als ON egd.alias_set_id = als.id - LEFT JOIN bookbrainz.alias al ON al.id = als.default_alias_id - LEFT JOIN bookbrainz.disambiguation dis ON dis.id = egd.disambiguation_id - LEFT JOIN bookbrainz.edition_group_type egtype ON egtype.id = egd.type_id - WHERE e.type = 'EditionGroup'; +SELECT e.bbid, + egd.id AS data_id, + pcr.id AS revision_id, + pcr.id = egh.master_revision_id AS master, + egd.annotation_id, + egd.disambiguation_id, + dis.comment AS disambiguation, + als.default_alias_id, + al.name, + al.sort_name, + egd.type_id, + egtype.label AS edition_group_type, + egd.author_credit_id, + egd.alias_set_id, + egd.identifier_set_id, + egd.relationship_set_id, + egd.credit_section, + e.type + FROM bookbrainz.edition_group_revision pcr + LEFT JOIN bookbrainz.entity e ON e.bbid = pcr.bbid + LEFT JOIN bookbrainz.edition_group_header egh ON egh.bbid = e.bbid + LEFT JOIN bookbrainz.edition_group_data egd ON pcr.data_id = egd.id + LEFT JOIN bookbrainz.alias_set als ON egd.alias_set_id = als.id + LEFT JOIN bookbrainz.alias al ON al.id = als.default_alias_id + LEFT JOIN bookbrainz.disambiguation dis ON dis.id = egd.disambiguation_id + LEFT JOIN bookbrainz.edition_group_type egtype ON egtype.id = egd.type_id + WHERE e.type = 'EditionGroup'; CREATE VIEW bookbrainz.series AS SELECT @@ -983,6 +1021,7 @@ CREATE VIEW bookbrainz.edition_import AS edition_data.depth, edition_data.weight, edition_data.pages, + edition_data.credit_section, edition_data.format_id, edition_data.status_id, edition_data.alias_set_id, @@ -1028,6 +1067,7 @@ CREATE VIEW bookbrainz.edition_group_import AS edition_group_data.disambiguation_id, alias_set.default_alias_id, edition_group_data.type_id, + edition_group_data.credit_section, edition_group_data.alias_set_id, edition_group_data.identifier_set_id, import.type diff --git a/sql/scripts/create_triggers.sql b/sql/scripts/create_triggers.sql index 9d0af01345..5c8c0b0285 100644 --- a/sql/scripts/create_triggers.sql +++ b/sql/scripts/create_triggers.sql @@ -60,14 +60,14 @@ CREATE OR REPLACE FUNCTION bookbrainz.process_edition() RETURNS TRIGGER alias_set_id, identifier_set_id, relationship_set_id, annotation_id, disambiguation_id, edition_group_bbid, author_credit_id, publisher_set_id, release_event_set_id, language_set_id, width, - height, depth, weight, pages, format_id, status_id + height, depth, weight, pages, format_id, status_id, credit_section ) VALUES ( NEW.alias_set_id, NEW.identifier_set_id, NEW.relationship_set_id, NEW.annotation_id, NEW.disambiguation_id, NEW.edition_group_bbid, NEW.author_credit_id, NEW.publisher_set_id, NEW.release_event_set_id, NEW.language_set_id, NEW.width, NEW.height, NEW.depth, NEW.weight, NEW.pages, NEW.format_id, - NEW.status_id + NEW.status_id, NEW.credit_section ) RETURNING bookbrainz.edition_data.id INTO edition_data_id; INSERT INTO bookbrainz.edition_revision VALUES(NEW.revision_id, NEW.bbid, edition_data_id); @@ -218,10 +218,10 @@ CREATE OR REPLACE FUNCTION bookbrainz.process_edition_group() RETURNS TRIGGER IF (TG_OP <> 'DELETE') THEN INSERT INTO bookbrainz.edition_group_data( alias_set_id, identifier_set_id, relationship_set_id, annotation_id, - disambiguation_id, type_id, author_credit_id + disambiguation_id, type_id, author_credit_id, credit_section ) VALUES ( NEW.alias_set_id, NEW.identifier_set_id, NEW.relationship_set_id, - NEW.annotation_id, NEW.disambiguation_id, NEW.type_id, NEW.author_credit_id + NEW.annotation_id, NEW.disambiguation_id, NEW.type_id, NEW.author_credit_id, NEW.credit_section ) RETURNING bookbrainz.edition_group_data.id INTO edition_group_data_id; INSERT INTO bookbrainz.edition_group_revision VALUES(NEW.revision_id, NEW.bbid, edition_group_data_id); diff --git a/src/client/components/pages/entities/edition-group.js b/src/client/components/pages/entities/edition-group.js index a8be344c1e..2951c1b1a3 100644 --- a/src/client/components/pages/entities/edition-group.js +++ b/src/client/components/pages/entities/edition-group.js @@ -92,6 +92,7 @@ function EditionGroupDisplayPage({entity, identifierTypes, user, wikipediaExtrac }, [reviewsRef]); const urlPrefix = getEntityUrl(entity); + const hasAuthorCredits = entity.creditSection; let authorCreditSection; if (entity.authorCredit) { @@ -101,7 +102,7 @@ function EditionGroupDisplayPage({entity, identifierTypes, user, wikipediaExtrac /> ); } - else if (!entity.deleted) { + else if (!entity.deleted && (hasAuthorCredits === true || hasAuthorCredits === null)) { authorCreditSection = (
Author Credit unset; please  diff --git a/src/client/components/pages/entities/edition.js b/src/client/components/pages/entities/edition.js index afbd5fe354..2d6de5cfd2 100644 --- a/src/client/components/pages/entities/edition.js +++ b/src/client/components/pages/entities/edition.js @@ -113,6 +113,7 @@ function EditionDisplayPage({entity, identifierTypes, user, wikipediaExtract}) { const worksContainedByEdition = getRelationshipTargetByTypeId(entity, relationshipTypeId); const worksContainedByEditionWithAuthors = addAuthorsDataToWorks(entity.authorsData, worksContainedByEdition); const urlPrefix = getEntityUrl(entity); + const hasAuthorCredits = entity.creditSection; let authorCreditSection; if (entity.authorCredit) { @@ -122,7 +123,7 @@ function EditionDisplayPage({entity, identifierTypes, user, wikipediaExtract}) { /> ); } - else if (!entity.deleted) { + else if (!entity.deleted && (hasAuthorCredits === true || hasAuthorCredits === null)) { authorCreditSection = (
Author Credit unset; please  diff --git a/src/client/entity-editor/author-credit-editor/actions.ts b/src/client/entity-editor/author-credit-editor/actions.ts index 52e5eabf30..6f17c4d172 100644 --- a/src/client/entity-editor/author-credit-editor/actions.ts +++ b/src/client/entity-editor/author-credit-editor/actions.ts @@ -224,3 +224,4 @@ export function toggleAuthorCredit(): Action { type: TOGGLE_AUTHOR_CREDIT }; } + diff --git a/src/client/entity-editor/author-credit-editor/author-credit-section.tsx b/src/client/entity-editor/author-credit-editor/author-credit-section.tsx index c55a8e9f9a..e3bc893f2f 100644 --- a/src/client/entity-editor/author-credit-editor/author-credit-section.tsx +++ b/src/client/entity-editor/author-credit-editor/author-credit-section.tsx @@ -24,8 +24,8 @@ import {Action, removeEmptyCreditRows, resetAuthorCredit, showAuthorCreditEditor, - toggleAuthorCredit - , updateCreditAuthorValue} from './actions'; + toggleAuthorCredit, + updateCreditAuthorValue} from './actions'; import {Button, Col, Form, FormLabel, InputGroup, OverlayTrigger, Row, Tooltip} from 'react-bootstrap'; import {get as _get, map as _map, values as _values, camelCase} from 'lodash'; diff --git a/src/server/helpers/diffFormatters/authorCredit.ts b/src/server/helpers/diffFormatters/authorCredit.ts index b7bf4bd10c..7556b4c96c 100644 --- a/src/server/helpers/diffFormatters/authorCredit.ts +++ b/src/server/helpers/diffFormatters/authorCredit.ts @@ -35,7 +35,7 @@ function authorCreditNameForDisplay(authorCreditName: AuthorCreditNameT) { } function authorCreditNamesForDisplay(rhs: {names: AuthorCreditNameT[]}) { - return rhs.names.sort((a, b) => a.position - b.position) + return rhs?.names?.sort((a, b) => a.position - b.position) .map(authorCreditNameForDisplay); } @@ -45,7 +45,7 @@ function formatNewAuthorCredit(change) { function formatAuthorCreditAddOrDelete(change) { return set.formatItemAddOrDelete( - change, `Author Credit ${change.item?.rhs?.position + 1}`, authorCreditNameForDisplay + change, `Author Credit ${change.item?.rhs?.position + 1 || 'removed'}`, authorCreditNamesForDisplay ); } diff --git a/src/server/helpers/diffFormatters/set.js b/src/server/helpers/diffFormatters/set.js index 7e13213932..01d56e1467 100644 --- a/src/server/helpers/diffFormatters/set.js +++ b/src/server/helpers/diffFormatters/set.js @@ -31,7 +31,7 @@ export function formatNewSet(change, label, itemProp, transformerFunc) { export function formatItemAddOrDelete(change, label, transformerFunc) { return [ - base.formatChange(change.item, label, transformerFunc) + base.formatChange(change, label, transformerFunc) ]; } @@ -55,11 +55,11 @@ export function format( return newSetFormatter(change); } - const itemAddDeleteModify = - change.path.length > 1 && change.path[0] === setProp && - change.path[1] === itemProp; + const itemAddDeleteModify = (change.kind === 'D' && change.path[0] === setProp) || + (change.path.length > 1 && change.path[0] === setProp && + change.path[1] === itemProp); if (itemAddDeleteModify) { - if (change.kind === 'A') { + if (change.kind === 'A' || change.kind === 'D') { // Item added to or deleted from set return addDeleteFormatter(change); } diff --git a/src/server/routes/entity/edition-group.ts b/src/server/routes/entity/edition-group.ts index 59b4b2ab4a..6b2d6da5f7 100644 --- a/src/server/routes/entity/edition-group.ts +++ b/src/server/routes/entity/edition-group.ts @@ -62,9 +62,9 @@ export function transformNewForm(data) { const relationships = entityRoutes.constructRelationships( data.relationshipSection ); - + const authorCreditEnable = _.get(data, ['editionGroupSection', 'authorCreditEnable'], true); let authorCredit = {}; - if (!_.get(data, ['editionGroupSection', 'authorCreditEnable'], true)) { + if (!authorCreditEnable) { authorCredit = null; } else if (!_.isNil(data.authorCredit)) { @@ -79,6 +79,7 @@ export function transformNewForm(data) { aliases, annotation: data.annotationSection.content, authorCredit, + creditSection: authorCreditEnable, disambiguation: data.nameSection.disambiguation, identifiers, note: data.submissionSection.note, @@ -88,7 +89,7 @@ export function transformNewForm(data) { } const createOrEditHandler = makeEntityCreateOrEditHandler( - 'editionGroup', transformNewForm, 'typeId' + 'editionGroup', transformNewForm, ['typeId', 'creditSection'] ); const mergeHandler = makeEntityCreateOrEditHandler( @@ -279,6 +280,7 @@ export function editionGroupToFormState(editionGroup) { ); const editionGroupSection = { + authorCreditEnable: editionGroup.creditSection, type: editionGroup.editionGroupType && editionGroup.editionGroupType.id }; @@ -313,11 +315,14 @@ export function editionGroupToFormState(editionGroup) { }) ) : []; - const authorCreditEditor: AuthorCreditEditorT = {}; + let authorCreditEditor: AuthorCreditEditorT = {}; for (const credit of credits) { authorCreditEditor[credit.position] = credit; } - if (_.isEmpty(authorCreditEditor)) { + if (!editionGroup.creditSection) { + authorCreditEditor = {}; + } + if (_.isEmpty(authorCreditEditor) && editionGroup.creditSection) { authorCreditEditor.n0 = { author: null, joinPhrase: '', diff --git a/src/server/routes/entity/edition.ts b/src/server/routes/entity/edition.ts index 3239810f48..0de14ece70 100644 --- a/src/server/routes/entity/edition.ts +++ b/src/server/routes/entity/edition.ts @@ -54,7 +54,7 @@ type AuthorCreditEditorT ={ const additionalEditionProps = [ 'editionGroupBbid', 'width', 'height', 'depth', 'weight', 'pages', - 'formatId', 'statusId' + 'formatId', 'statusId', 'creditSection' ]; type PassportRequest = express.Request & { @@ -83,8 +83,11 @@ export function transformNewForm(data) { const languages = _.map( data.editionSection.languages, (language) => language.value ); + let authorCredit = {}; - if (!_.get(data, ['editionSection', 'authorCreditEnable'], true)) { + const authorCreditEnable = _.get(data, ['editionSection', 'authorCreditEnable'], true); + + if (!authorCreditEnable) { authorCredit = null; } else if (!_.isNil(data.authorCredit)) { @@ -99,6 +102,7 @@ export function transformNewForm(data) { aliases, annotation: data.annotationSection.content, authorCredit, + creditSection: authorCreditEnable, depth: data.editionSection.depth && parseInt(data.editionSection.depth, 10), disambiguation: data.nameSection.disambiguation, @@ -204,7 +208,6 @@ router.get( let relationshipTypeId; let initialRelationshipIndex = 0; - initialState.editionSection = initialState.editionSection ?? {}; if (props.author) { initialState.authorCreditEditor = { a0: { @@ -437,11 +440,14 @@ export function editionToFormState(edition) { }) ) : []; - const authorCreditEditor: AuthorCreditEditorT = {}; + let authorCreditEditor: AuthorCreditEditorT = {}; for (const credit of credits) { authorCreditEditor[credit.position] = credit; } - if (_.isEmpty(authorCreditEditor)) { + if (!edition.creditSection) { + authorCreditEditor = {}; + } + if (_.isEmpty(authorCreditEditor) && edition.creditSection) { authorCreditEditor.n0 = { author: null, joinPhrase: '', @@ -476,7 +482,7 @@ export function editionToFormState(edition) { const editionGroup = utils.entityToOption(edition.editionGroup); const editionSection = { - authorCreditEnable: true, + authorCreditEnable: edition.creditSection, depth: edition.depth, editionGroup, // Determines whether the EG can be left blank (an EG will be auto-created) for existing Editions diff --git a/src/server/routes/entity/entity.tsx b/src/server/routes/entity/entity.tsx index 5d65c002ab..95ec6df0a1 100644 --- a/src/server/routes/entity/entity.tsx +++ b/src/server/routes/entity/entity.tsx @@ -689,25 +689,33 @@ export async function processMergeOperation(orm, transacting, session, mainEntit } type ProcessAuthorCreditBody = { - authorCredit: Array + authorCredit: Array; + creditSection: boolean; }; type ProcessAuthorCreditResult = {authorCreditId: number}; async function processAuthorCredit( orm: any, currentEntity: Record | null | undefined, - body: ProcessAuthorCreditBody, + newEntityBody: ProcessAuthorCreditBody, transacting: Transaction ): Promise { - const authorCreditID = _.get(currentEntity, ['authorCredit', 'id']); + const authorCreditEnabled = newEntityBody.creditSection !== false; + if (!authorCreditEnabled) { + return { + authorCreditId: null + }; + } + + const existingAuthorCreditID = _.get(currentEntity, ['authorCredit', 'id']); const oldAuthorCredit = await ( - authorCreditID && - orm.AuthorCredit.forge({id: authorCreditID}) + existingAuthorCreditID && + orm.AuthorCredit.forge({id: existingAuthorCreditID}) .fetch({transacting, withRelated: ['names']}) ); - const names = _.get(body, 'authorCredit') || []; + const names = _.get(newEntityBody, 'authorCredit') || []; const newAuthorCredit = await orm.func.authorCredit.updateAuthorCredit( orm, transacting, oldAuthorCredit, names.map((name) => ({ @@ -745,14 +753,14 @@ async function processEditionSets( ); const languages = _.get(body, 'languages') || []; - const newLanguageSetIDPromise = orm.func.language.updateLanguageSet( + + const newLanguageSet = await orm.func.language.updateLanguageSet( orm, transacting, oldLanguageSet, languages.map((languageID) => ({id: languageID})) - ) - .then((set) => set && set.get('id')); + ); + const newLanguageSetID = newLanguageSet && newLanguageSet.get('id'); const publisherSetID = _.get(currentEntity, ['publisherSet', 'id']); - const oldPublisherSet = await ( publisherSetID && orm.PublisherSet.forge({id: publisherSetID}) @@ -760,12 +768,12 @@ async function processEditionSets( ); const publishers = _.get(body, 'publishers') || []; - const newPublisherSetIDPromise = orm.func.publisher.updatePublisherSet( + + const newPublisherSet = await orm.func.publisher.updatePublisherSet( orm, transacting, oldPublisherSet, publishers.map((publisherBBID) => ({bbid: publisherBBID})) - ) - .then((set) => set && set.get('id')); - + ); + const newPublisherSetID = newPublisherSet && newPublisherSet.get('id'); const releaseEventSetID = _.get(currentEntity, ['releaseEventSet', 'id']); const oldReleaseEventSet = await ( @@ -788,20 +796,20 @@ async function processEditionSets( } } - const newReleaseEventSetIDPromise = - orm.func.releaseEvent.updateReleaseEventSet( + const newReleaseEventSet = + await orm.func.releaseEvent.updateReleaseEventSet( orm, transacting, oldReleaseEventSet, releaseEvents - ) - .then((set) => set && set.get('id')); - - const authorCreditIDPromise = processAuthorCredit(orm, currentEntity, body, transacting).then(acResult => acResult.authorCreditId); + ); + const newReleaseEventSetID = newReleaseEventSet && newReleaseEventSet.get('id'); + const newAuthorCredit = await processAuthorCredit(orm, currentEntity, body, transacting); + const newAuthorCreditID = newAuthorCredit.authorCreditId; - return commonUtils.makePromiseFromObject({ - authorCreditId: authorCreditIDPromise, - languageSetId: newLanguageSetIDPromise, - publisherSetId: newPublisherSetIDPromise, - releaseEventSetId: newReleaseEventSetIDPromise - }); + return { + authorCreditId: newAuthorCreditID, + languageSetId: newLanguageSetID, + publisherSetId: newPublisherSetID, + releaseEventSetId: newReleaseEventSetID + }; } type ProcessWorkSetsResult = {languageSetId: number[]}; diff --git a/src/server/routes/entity/process-unified-form.ts b/src/server/routes/entity/process-unified-form.ts index 9a1fdf5812..ca9d048543 100644 --- a/src/server/routes/entity/process-unified-form.ts +++ b/src/server/routes/entity/process-unified-form.ts @@ -34,9 +34,9 @@ const additionalEntityProps = { ], edition: [ 'editionGroupBbid', 'width', 'height', 'depth', 'weight', 'pages', - 'formatId', 'statusId' + 'formatId', 'statusId', 'creditSection' ], - editionGroup: 'typeid', + editionGroup: ['typeid', 'creditSection'], publisher: ['typeId', 'areaId', 'beginDate', 'endDate', 'ended'], series: ['entityType', 'orderingTypeId'], work: 'typeId' diff --git a/test/src/server/routes/entity/edition-group.js b/test/src/server/routes/entity/edition-group.js index 759ef9e757..a686811ac0 100644 --- a/test/src/server/routes/entity/edition-group.js +++ b/test/src/server/routes/entity/edition-group.js @@ -53,6 +53,7 @@ describe('Edition Group routes with entity editing priv', () => { 'editionGroupSection.type': '', 'identifierEditor.t19': 'wikidataid' + }; const res = await agent.post('/edition-group/create').set('Origin', `http://127.0.0.1:${agent.app.address().port}`).send(data); expect(res.ok).to.be.true; diff --git a/yarn.lock b/yarn.lock index 5f4ef0ac51..e01546568b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2760,10 +2760,10 @@ body-parser@1.20.2: type-is "~1.6.18" unpipe "1.0.0" -bookbrainz-data@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/bookbrainz-data/-/bookbrainz-data-5.0.0.tgz#02ef3ef8483300fed33d1e3bc64b21466fdb62e5" - integrity sha512-CqpJHYrQGeQjxhjJBbzdSpl6FEvrINc05yAb23ClDsLEEgDvWMPoB85+FElCtR+KcvqA44oMmq95ez3nHVvX0g== +bookbrainz-data@5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/bookbrainz-data/-/bookbrainz-data-5.1.1.tgz#600158905b6f1f27ceba96311bf2c238c98fb45e" + integrity sha512-REP1BpCc93lAqrGRPO5+l27ggNkpLbyxf2m41znlbFeR63GtAkAv2udqxqSRqLKTmQSftWWGes9McT0hmDplXw== dependencies: "@metabrainz/bookshelf" "^1.4.0" bookshelf-virtuals-plugin "^1.0.0" @@ -2852,11 +2852,6 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== -buffer-writer@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/buffer-writer/-/buffer-writer-2.0.0.tgz#ce7eb81a38f7829db09c873f2fbb792c0c98ec04" - integrity sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw== - bytes@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.0.0.tgz#d32815404d689699f85a4ea4fa8755dd13a96048" @@ -3215,11 +3210,6 @@ commander@^7.0.0, commander@^7.2.0: resolved "https://registry.yarnpkg.com/commander/-/commander-7.2.0.tgz#a36cb57d0b501ce108e4d20559a150a391d97ab7" integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== -commander@^9.1.0: - version "9.5.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-9.5.0.tgz#bc08d1eb5cedf7ccb797a96199d41c7bc3e60d30" - integrity sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ== - commondir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" @@ -3359,7 +3349,7 @@ cosmiconfig@^6.0.0: create-error@~0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/create-error/-/create-error-0.3.1.tgz#69810245a629e654432bf04377360003a5351a23" - integrity sha1-aYECRaYp5lRDK/BDdzYAA6U1GiM= + integrity sha512-n/Q4aSCtYuuDneEW5Q+nd0IIZwbwmX/oF6wKcDUhXGJNwhmp2WHEoWKz7X+/H7rBtjimInW7f0ceouxU0SmuzQ== cross-env@^7.0.3: version "7.0.3" @@ -3999,9 +3989,9 @@ es6-weak-map@^2.0.3: es6-symbol "^3.1.1" escalade@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" - integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== + version "3.1.2" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27" + integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA== escape-goat@^2.0.0: version "2.1.1" @@ -4686,10 +4676,10 @@ fsevents@^2.3.2, fsevents@~2.3.2: resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== -function-bind@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" - integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +function-bind@^1.1.1, function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== function.prototype.name@^1.1.2, function.prototype.name@^1.1.3, function.prototype.name@^1.1.5: version "1.1.5" @@ -4973,11 +4963,16 @@ has-yarn@^2.1.0: integrity sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw== has@^1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" - integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== + version "1.0.4" + resolved "https://registry.yarnpkg.com/has/-/has-1.0.4.tgz#2eb2860e000011dae4f1406a86fe80e530fb2ec6" + integrity sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ== + +hasown@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== dependencies: - function-bind "^1.1.1" + function-bind "^1.1.2" he@1.2.0: version "1.2.0" @@ -5163,9 +5158,9 @@ imurmurhash@^0.1.4: integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= inflection@^1.12.0: - version "1.13.1" - resolved "https://registry.yarnpkg.com/inflection/-/inflection-1.13.1.tgz#c5cadd80888a90cf84c2e96e340d7edc85d5f0cb" - integrity sha512-dldYtl2WlN0QDkIDtg8+xFwOS2Tbmp12t1cHa5/YClU6ZQjTFm7B66UcVbh9NQB+HvT5BAd2t5+yKsBkw5pcqA== + version "1.13.4" + resolved "https://registry.yarnpkg.com/inflection/-/inflection-1.13.4.tgz#65aa696c4e2da6225b148d7a154c449366633a32" + integrity sha512-6I/HUDeYFfuNCVS3td055BaXBwKYuzw7K3ExVMStBowKo9oOAMJIXIHvdyR3iboTCp1b+1i5DSkIZTcwIktuDw== inflight@^1.0.4: version "1.0.6" @@ -5180,7 +5175,7 @@ influx@^5.9.3: resolved "https://registry.yarnpkg.com/influx/-/influx-5.9.3.tgz#81f92b55c8354275653393eae0c0c697b6568e76" integrity sha512-QQU9CgwnaEV6zMrK8+vhVItsdoKFqDioXJrjJhRQaff9utvT3N0jcrQJT9qnxFLktqgJ5ngbDY68Zh4eo4uD/w== -inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.3: +inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@~2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -5273,7 +5268,14 @@ is-ci@^2.0.0: dependencies: ci-info "^2.0.0" -is-core-module@^2.2.0, is-core-module@^2.8.1, is-core-module@^2.9.0: +is-core-module@^2.13.0, is-core-module@^2.9.0: + version "2.13.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384" + integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw== + dependencies: + hasown "^2.0.0" + +is-core-module@^2.2.0, is-core-module@^2.8.1: version "2.11.0" resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.11.0.tgz#ad4cb3e3863e814523c96f3f58d26cc570ff0144" integrity sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw== @@ -5808,12 +5810,12 @@ klona@^2.0.4: integrity sha512-pJiBpiXMbt7dkzXe8Ghj/u4FfXOOa98fPW+bihOJ4SjnoijweJrNThJfd3ifXpXhREjpoF2mZVH1GfS9LV3kHQ== knex@^2.4.2: - version "2.4.2" - resolved "https://registry.yarnpkg.com/knex/-/knex-2.4.2.tgz#a34a289d38406dc19a0447a78eeaf2d16ebedd61" - integrity sha512-tMI1M7a+xwHhPxjbl/H9K1kHX+VncEYcvCx5K00M16bWvpYPKAZd6QrCu68PtHAdIZNQPWZn0GVhqVBEthGWCg== + version "2.5.1" + resolved "https://registry.yarnpkg.com/knex/-/knex-2.5.1.tgz#a6c6b449866cf4229f070c17411f23871ba52ef9" + integrity sha512-z78DgGKUr4SE/6cm7ku+jHvFT0X97aERh/f0MUKAKgFnwCYBEW4TFBqtHWFYiJFid7fMrtpZ/gxJthvz5mEByA== dependencies: colorette "2.0.19" - commander "^9.1.0" + commander "^10.0.0" debug "4.3.4" escalade "^3.1.1" esm "^3.2.25" @@ -5821,7 +5823,7 @@ knex@^2.4.2: getopts "2.3.0" interpret "^2.2.0" lodash "^4.17.21" - pg-connection-string "2.5.0" + pg-connection-string "2.6.1" rechoir "^0.8.0" resolve-from "^5.0.0" tarn "^3.0.2" @@ -6271,11 +6273,16 @@ mocha@^9.1.3: yargs-parser "20.2.4" yargs-unparser "2.0.0" -moment@^2.10.2, moment@^2.29.1: +moment@^2.10.2: version "2.29.4" resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== +moment@^2.29.1: + version "2.30.1" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.30.1.tgz#f8c91c07b7a786e30c59926df530b4eac96974ae" + integrity sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how== + moo@^0.5.0: version "0.5.1" resolved "https://registry.yarnpkg.com/moo/-/moo-0.5.1.tgz#7aae7f384b9b09f620b6abf6f74ebbcd1b65dbc4" @@ -6655,11 +6662,6 @@ package-json@^6.3.0: registry-url "^5.0.0" semver "^6.2.0" -packet-reader@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/packet-reader/-/packet-reader-1.0.0.tgz#9238e5480dedabacfe1fe3f2771063f164157d74" - integrity sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ== - parent-module@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" @@ -6802,25 +6804,35 @@ performance-now@^2.1.0: resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= -pg-connection-string@2.5.0, pg-connection-string@^2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.5.0.tgz#538cadd0f7e603fc09a12590f3b8a452c2c0cf34" - integrity sha512-r5o/V/ORTA6TmUnyWZR9nCj1klXCO2CEKNRlVuJptZe85QuhFayC7WeMic7ndayT5IRIR0S0xFxFi2ousartlQ== +pg-cloudflare@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz#e6d5833015b170e23ae819e8c5d7eaedb472ca98" + integrity sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q== + +pg-connection-string@2.6.1: + version "2.6.1" + resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.6.1.tgz#78c23c21a35dd116f48e12e23c0965e8d9e2cbfb" + integrity sha512-w6ZzNu6oMmIzEAYVw+RLK0+nqHPt8K3ZnknKi+g48Ak2pr3dtljJW3o+D/n2zzCG07Zoe9VOX3aiKpj+BN0pjg== + +pg-connection-string@^2.6.4: + version "2.6.4" + resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.6.4.tgz#f543862adfa49fa4e14bc8a8892d2a84d754246d" + integrity sha512-v+Z7W/0EO707aNMaAEfiGnGL9sxxumwLl2fJvCQtMn9Fxsg+lPpPkdcyBSv/KFgpGdYkMfn+EI1Or2EHjpgLCA== pg-int8@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/pg-int8/-/pg-int8-1.0.1.tgz#943bd463bf5b71b4170115f80f8efc9a0c0eb78c" integrity sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw== -pg-pool@^3.4.1: - version "3.4.1" - resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-3.4.1.tgz#0e71ce2c67b442a5e862a9c182172c37eda71e9c" - integrity sha512-TVHxR/gf3MeJRvchgNHxsYsTCHQ+4wm3VIHSS19z8NC0+gioEhq1okDY1sm/TYbfoP6JLFx01s0ShvZ3puP/iQ== +pg-pool@^3.6.2: + version "3.6.2" + resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-3.6.2.tgz#3a592370b8ae3f02a7c8130d245bc02fa2c5f3f2" + integrity sha512-Htjbg8BlwXqSBQ9V8Vjtc+vzf/6fVUuak/3/XXKA9oxZprwW3IMDQTGHP+KDmVL7rtd+R1QjbnCFPuTHm3G4hg== -pg-protocol@^1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/pg-protocol/-/pg-protocol-1.5.0.tgz#b5dd452257314565e2d54ab3c132adc46565a6a0" - integrity sha512-muRttij7H8TqRNu/DxrAJQITO4Ac7RmX3Klyr/9mJEOBeIpgnF8f9jAfRz5d3XwQZl5qBjF9gLsUtMPJE0vezQ== +pg-protocol@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/pg-protocol/-/pg-protocol-1.6.1.tgz#21333e6d83b01faaebfe7a33a7ad6bfd9ed38cb3" + integrity sha512-jPIlvgoD63hrEuihvIg+tJhoGjUsLPn6poJY9N5CnlPd91c2T18T/9zBtLxZSb1EhYxBRoZJtzScCaWlYLtktg== pg-types@^2.1.0: version "2.2.0" @@ -6834,24 +6846,24 @@ pg-types@^2.1.0: postgres-interval "^1.1.0" pg@^8.6.0: - version "8.7.1" - resolved "https://registry.yarnpkg.com/pg/-/pg-8.7.1.tgz#9ea9d1ec225980c36f94e181d009ab9f4ce4c471" - integrity sha512-7bdYcv7V6U3KAtWjpQJJBww0UEsWuh4yQ/EjNf2HeO/NnvKjpvhEIe/A/TleP6wtmSKnUnghs5A9jUoK6iDdkA== - dependencies: - buffer-writer "2.0.0" - packet-reader "1.0.0" - pg-connection-string "^2.5.0" - pg-pool "^3.4.1" - pg-protocol "^1.5.0" + version "8.11.5" + resolved "https://registry.yarnpkg.com/pg/-/pg-8.11.5.tgz#e722b0a5f1ed92931c31758ebec3ddf878dd4128" + integrity sha512-jqgNHSKL5cbDjFlHyYsCXmQDrfIX/3RsNwYqpd4N0Kt8niLuNoRNH+aazv6cOd43gPh9Y4DjQCtb+X0MH0Hvnw== + dependencies: + pg-connection-string "^2.6.4" + pg-pool "^3.6.2" + pg-protocol "^1.6.1" pg-types "^2.1.0" pgpass "1.x" + optionalDependencies: + pg-cloudflare "^1.1.1" pgpass@1.x: - version "1.0.4" - resolved "https://registry.yarnpkg.com/pgpass/-/pgpass-1.0.4.tgz#85eb93a83800b20f8057a2b029bf05abaf94ea9c" - integrity sha512-YmuA56alyBq7M59vxVBfPJrGSozru8QAdoNlWuW3cz8l+UX3cWge0vTvjKhsSHSJpo3Bom8/Mm6hf0TR5GY0+w== + version "1.0.5" + resolved "https://registry.yarnpkg.com/pgpass/-/pgpass-1.0.5.tgz#9b873e4a564bb10fa7a7dbd55312728d422a223d" + integrity sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug== dependencies: - split2 "^3.1.1" + split2 "^4.1.0" picocolors@^1.0.0: version "1.0.0" @@ -6967,7 +6979,7 @@ postgres-array@~2.0.0: postgres-bytea@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/postgres-bytea/-/postgres-bytea-1.0.0.tgz#027b533c0aa890e26d172d47cf9ccecc521acd35" - integrity sha1-AntTPAqokOJtFy1Hz5zOzFIazTU= + integrity sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w== postgres-date@~1.0.4: version "1.0.7" @@ -7399,15 +7411,6 @@ readable-stream@^2.0.0, readable-stream@^2.3.5: string_decoder "~1.1.1" util-deprecate "~1.0.1" -readable-stream@^3.0.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" - integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== - dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" - readdirp@~3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" @@ -7628,7 +7631,7 @@ resolve-url-loader@^5.0.0: postcss "^8.2.14" source-map "0.6.1" -resolve@^1.10.1, resolve@^1.12.0, resolve@^1.14.2, resolve@^1.20.0, resolve@^1.22.0, resolve@^1.9.0: +resolve@^1.10.1, resolve@^1.12.0, resolve@^1.14.2, resolve@^1.22.0, resolve@^1.9.0: version "1.22.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.1.tgz#27cb2ebb53f91abb49470a928bba7558066ac177" integrity sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw== @@ -7637,6 +7640,15 @@ resolve@^1.10.1, resolve@^1.12.0, resolve@^1.14.2, resolve@^1.20.0, resolve@^1.2 path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +resolve@^1.20.0: + version "1.22.8" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" + integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== + dependencies: + is-core-module "^2.13.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + resolve@^2.0.0-next.3: version "2.0.0-next.3" resolved "https://registry.yarnpkg.com/resolve/-/resolve-2.0.0-next.3.tgz#d41016293d4a8586a39ca5d9b5f15cbea1f55e46" @@ -7713,7 +7725,7 @@ safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-buffer@5.2.1, safe-buffer@^5.1.0, safe-buffer@~5.2.0: +safe-buffer@5.2.1, safe-buffer@^5.1.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== @@ -7987,12 +7999,10 @@ source-map@^0.7.3: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== -split2@^3.1.1: - version "3.2.2" - resolved "https://registry.yarnpkg.com/split2/-/split2-3.2.2.tgz#bf2cf2a37d838312c249c89206fd7a17dd12365f" - integrity sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg== - dependencies: - readable-stream "^3.0.0" +split2@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/split2/-/split2-4.2.0.tgz#c9c5920904d148bab0b9f67145f245a86aadbfa4" + integrity sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg== sprintf-js@~1.0.2: version "1.0.3" @@ -8084,13 +8094,6 @@ string.prototype.trimstart@^1.0.5: define-properties "^1.1.4" es-abstract "^1.19.5" -string_decoder@^1.1.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" - integrity sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA== - dependencies: - safe-buffer "~5.2.0" - string_decoder@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" @@ -8583,7 +8586,7 @@ url-parse@^1.5.3: querystringify "^2.1.1" requires-port "^1.0.0" -util-deprecate@^1.0.1, util-deprecate@^1.0.2, util-deprecate@~1.0.1: +util-deprecate@^1.0.2, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=