From ff1d6ae53b0d7c78d673c9d653997a8e35f9f4ea Mon Sep 17 00:00:00 2001 From: Eli Selkin Date: Mon, 4 Dec 2023 17:00:56 -0800 Subject: [PATCH 1/7] police testing --- .../drupal/static-data-files/fetchApi.js | 1 - .../drupal/static-data-files/generate.js | 1 + .../static-data-files/vaPoliceData/index.js | 29 +----- .../vaPoliceData/police-contact.csv | 6 +- .../vaPoliceData/police-events.csv | 10 +- .../vaPoliceData/postProcessPolice.js | 95 +++++++++++++++++++ .../vaPoliceData/pre-contact-police.csv | 3 - .../vaPoliceData/pre-events-police.csv | 7 -- .../drupal/tests/police/download.unit.spec.js | 75 +++++++++++++++ .../tests/police/fixtures/police-contact.csv | 3 + .../drupal/tests/police/fixtures/police.csv | 3 + yarn.lock | 6 +- 12 files changed, 190 insertions(+), 49 deletions(-) create mode 100644 src/site/stages/build/drupal/static-data-files/vaPoliceData/postProcessPolice.js delete mode 100644 src/site/stages/build/drupal/static-data-files/vaPoliceData/pre-contact-police.csv delete mode 100644 src/site/stages/build/drupal/static-data-files/vaPoliceData/pre-events-police.csv create mode 100644 src/site/stages/build/drupal/tests/police/download.unit.spec.js create mode 100644 src/site/stages/build/drupal/tests/police/fixtures/police-contact.csv create mode 100644 src/site/stages/build/drupal/tests/police/fixtures/police.csv diff --git a/src/site/stages/build/drupal/static-data-files/fetchApi.js b/src/site/stages/build/drupal/static-data-files/fetchApi.js index 6a716838ca..1a43fb2455 100644 --- a/src/site/stages/build/drupal/static-data-files/fetchApi.js +++ b/src/site/stages/build/drupal/static-data-files/fetchApi.js @@ -58,7 +58,6 @@ function getCurlClient(buildOptions, _clientOptionsArg = { verbose: true }) { 'certs/VA-Internal-S2-RCA2.pem', ]); } - return fetchWrapper( url, // eslint-disable-next-line prefer-object-spread diff --git a/src/site/stages/build/drupal/static-data-files/generate.js b/src/site/stages/build/drupal/static-data-files/generate.js index 6cbacddc01..e0d651e59d 100644 --- a/src/site/stages/build/drupal/static-data-files/generate.js +++ b/src/site/stages/build/drupal/static-data-files/generate.js @@ -380,3 +380,4 @@ const generateStaticDataFiles = async ( }; module.exports.generateStaticDataFiles = generateStaticDataFiles; +module.exports.processCurlDataFile = processCurlDataFile; diff --git a/src/site/stages/build/drupal/static-data-files/vaPoliceData/index.js b/src/site/stages/build/drupal/static-data-files/vaPoliceData/index.js index 9388718420..40d07e1d34 100644 --- a/src/site/stages/build/drupal/static-data-files/vaPoliceData/index.js +++ b/src/site/stages/build/drupal/static-data-files/vaPoliceData/index.js @@ -1,35 +1,14 @@ -const fs = require('fs'); -const csv = require('csvtojson'); -const path = require('path'); const { join } = require('path'); const { pathToFileURL } = require('url'); +const { postProcessPolice } = require('./postProcessPolice'); // URLs to fetch (even if they are local files) const query = [ - pathToFileURL(join(__dirname, 'police-contact.csv')).toString(), - pathToFileURL(join(__dirname, 'police-events.csv')).toString(), + pathToFileURL(join(__dirname, 'police-contact.csv')).toString(), // contacts is always first + pathToFileURL(join(__dirname, 'police-events.csv')).toString(), // any number of events files following ]; -const postProcess = async queryResult => { - const processedJSON = { - data: { - statistics: {}, - contacts: {}, - }, - }; - const [contact, events] = queryResult; - const contactFile = path.join(__dirname, 'pre-contact-police.csv'); - const eventsFile = path.join(__dirname, 'pre-events-police.csv'); - // Unfortunately there's no Buffer or file-string support in csvtojson, there's read and process per-line, but this is more efficient. - fs.writeFileSync(contactFile, contact, { append: false }); - fs.writeFileSync(eventsFile, events, { append: false }); - // eslint-disable-next-line no-unused-vars - const contactsJson = await csv().fromFile(contactFile); - // eslint-disable-next-line no-unused-vars - const eventsJson = await csv().fromFile(eventsFile); - // TODO: Process jsonEvents and Join data with contact info for a Facility Police Page content - return processedJSON; -}; +const postProcess = postProcessPolice; module.exports = { query, diff --git a/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-contact.csv b/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-contact.csv index da9c0203e5..2865b8dc35 100644 --- a/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-contact.csv +++ b/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-contact.csv @@ -1,3 +1,3 @@ -facility_id,contact_name,contact_number -vha_011,Abc Jameson,1234567899 -vha_021,Xyz Adamson,1123456799 +VISN,Facility API ID,Contact Name,Contact Number +19,vha_635,Abc Jameson,12345689 +1,vha_523A5,Zyz Adamson,1123456799 \ No newline at end of file diff --git a/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-events.csv b/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-events.csv index df790c0066..fe26762642 100644 --- a/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-events.csv +++ b/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-events.csv @@ -1,7 +1,3 @@ -date_range,facility_id,a,b,c -2021-01-01:2021-12-31,vha_011,2,3,4 -2022-01-01:2022-12-31,vha_011,3,4,5 -2023-01-01:2023-10-10,vha_011,1,1,1 -2021-01-01:2021-12-31,vha_021,1,3,1 -2022-01-01:2022-12-31,vha_021,2,0,1 -2023-01-01:2023-10-10,vha_021,0,1,0 \ No newline at end of file +VISN,Facility API ID,Facility Name,MM/YYYY,Number of service calls (officer initiated and response to calls),Traffic and parking tickets,Non-traffic (criminal) tickets,Arrests,Complaints and investigations,Numbers of sustained allegations,Numbers of disciplinary actions +19,avha_635,Not Oklahoma City VA Medical Center,10/2023,4000,100,100,600,50,10,2 +1,avha_523A5,Not Brockton VA Medical Center,10/2023,5200,220,325,752,78,8,3 \ No newline at end of file diff --git a/src/site/stages/build/drupal/static-data-files/vaPoliceData/postProcessPolice.js b/src/site/stages/build/drupal/static-data-files/vaPoliceData/postProcessPolice.js new file mode 100644 index 0000000000..023d111e04 --- /dev/null +++ b/src/site/stages/build/drupal/static-data-files/vaPoliceData/postProcessPolice.js @@ -0,0 +1,95 @@ +const csv = require('csvtojson'); + +function processJsonPoliceData(unprocessedJson) { + const processedJSON = { + VISN: null, + facilityAPIId: '', + facilityName: '', + date: '', + numServiceCalls: null, + trafficParkingTickets: null, + criminalTickets: null, + arrests: null, + complaintsInvestigations: null, + sustainedAllegations: null, + disciplinaryActions: null, + }; + for (const [key, value] of Object.entries(unprocessedJson)) { + switch (key) { + case 'VISN': + processedJSON.VISN = parseInt(value, 10); + break; + case 'Facility API ID': + processedJSON.facilityAPIId = value; + break; + case 'Facility Name': + processedJSON.facilityName = value; + break; + case 'MM/YYYY': + processedJSON.date = value; + break; + case 'Number of service calls (officer initiated and response to calls)': + processedJSON.numServiceCalls = parseInt(value, 10); + break; + case 'Traffic and parking tickets': + processedJSON.trafficParkingTickets = parseInt(value, 10); + break; + case 'Non-traffic (criminal) tickets': + processedJSON.criminalTickets = parseInt(value, 10); + break; + case 'Arrests': + processedJSON.arrests = parseInt(value, 10); + break; + case 'Complaints and investigations': + processedJSON.complaintsInvestigations = parseInt(value, 10); + break; + case 'Numbers of sustained allegations': + processedJSON.sustainedAllegations = parseInt(value, 10); + break; + case 'Numbers of disciplinary actions': + processedJSON.disciplinaryActions = parseInt(value, 10); + break; + default: + break; + } + } + return processedJSON; +} + +async function postProcessPolice(queryResult) { + const processedJSON = { + data: { + statistics: {}, // keys:facilityAPIId, values: array of objects in processed format + contacts: {}, + }, + }; + const [contact, ...events] = queryResult; + if (!contact || !events || events.length === 0) { + throw new Error( + 'Police data files must have at least one contact file and one events file.', + ); + } + const contactData = await csv().fromString(contact); + const eventsData = await Promise.all( + events.map(eventsFile => csv().fromString(eventsFile)), + ); // each file has its own header, but JSON's are the same + const processedEventsData = eventsData.flat().map(processJsonPoliceData); // convert keys to usable format + for (const processedEventsDataEntry of processedEventsData) { + if (processedJSON.data.statistics[processedEventsDataEntry.facilityAPIId]) { + processedJSON.data.statistics[ + processedEventsDataEntry.facilityAPIId + ].push(processedEventsDataEntry); + } else { + processedJSON.data.statistics[processedEventsDataEntry.facilityAPIId] = [ + processedEventsDataEntry, + ]; + } + } + + processedJSON.data.contacts = contactData; + + // TODO: Process jsonEvents and Join data with contact info for a Facility Police Page content + return processedJSON; +} +module.exports.postProcessPolice = postProcessPolice; +module.exports.processJsonPoliceData = processJsonPoliceData; diff --git a/src/site/stages/build/drupal/static-data-files/vaPoliceData/pre-contact-police.csv b/src/site/stages/build/drupal/static-data-files/vaPoliceData/pre-contact-police.csv deleted file mode 100644 index da9c0203e5..0000000000 --- a/src/site/stages/build/drupal/static-data-files/vaPoliceData/pre-contact-police.csv +++ /dev/null @@ -1,3 +0,0 @@ -facility_id,contact_name,contact_number -vha_011,Abc Jameson,1234567899 -vha_021,Xyz Adamson,1123456799 diff --git a/src/site/stages/build/drupal/static-data-files/vaPoliceData/pre-events-police.csv b/src/site/stages/build/drupal/static-data-files/vaPoliceData/pre-events-police.csv deleted file mode 100644 index df790c0066..0000000000 --- a/src/site/stages/build/drupal/static-data-files/vaPoliceData/pre-events-police.csv +++ /dev/null @@ -1,7 +0,0 @@ -date_range,facility_id,a,b,c -2021-01-01:2021-12-31,vha_011,2,3,4 -2022-01-01:2022-12-31,vha_011,3,4,5 -2023-01-01:2023-10-10,vha_011,1,1,1 -2021-01-01:2021-12-31,vha_021,1,3,1 -2022-01-01:2022-12-31,vha_021,2,0,1 -2023-01-01:2023-10-10,vha_021,0,1,0 \ No newline at end of file diff --git a/src/site/stages/build/drupal/tests/police/download.unit.spec.js b/src/site/stages/build/drupal/tests/police/download.unit.spec.js new file mode 100644 index 0000000000..b825b40caa --- /dev/null +++ b/src/site/stages/build/drupal/tests/police/download.unit.spec.js @@ -0,0 +1,75 @@ +/* eslint-disable @department-of-veterans-affairs/axe-check-required */ +import path from 'path'; +import { describe, it } from 'mocha'; +import { expect } from 'chai'; +import { processCurlDataFile } from '../../static-data-files/generate'; +import { postProcessPolice } from '../../static-data-files/vaPoliceData/postProcessPolice'; + +const { pathToFileURL } = require('url'); +const getCurlClient = require('../../static-data-files/fetchApi'); + +/* This is not a FE test but a unit test. */ +describe('process police csv files', () => { + it('should have an error if the police-contact.csv file is missing', async () => { + const client = getCurlClient({ + 'drupal-user': 'eli.selkin@va.gov', + 'drupal-password': 'drupal8', + 'drupal-max-parallel-requests': 10, + }); + expect( + processCurlDataFile( + { + description: 'Curl', + filename: 'test-police.json', + query: [ + pathToFileURL( + path.join( + __dirname, + './fixtures/non-existant-police-contact.csv', + ), + ).toString(), + pathToFileURL( + path.join(__dirname, './fixtures/non-existant-police.csv'), + ).toString(), + ], + postProcess: postProcessPolice, + }, + client, + ), + ).to.be.rejectedWith(Error); + }); + it('should process files', async () => { + const client = getCurlClient({ + 'drupal-user': 'eli.selkin@va.gov', + 'drupal-password': 'drupal8', + 'drupal-max-parallel-requests': 10, + }); + const processedDataFile = await processCurlDataFile( + { + description: 'Curl', + filename: 'test-police.json', + query: [ + pathToFileURL( + path.join(__dirname, './fixtures/police-contact.csv'), + ).toString(), + pathToFileURL( + path.join(__dirname, './fixtures/police.csv'), + ).toString(), + ], + postProcess: postProcessPolice, + }, + client, + ); + const keys = Object.keys(processedDataFile.data.data.statistics); + expect(keys).to.contain('vha_635'); + expect(keys).to.contain('vha_523A5'); + expect(processedDataFile.data.data.statistics.vha_635).to.be.an('array'); + expect(processedDataFile.data.data.statistics.vha_523A5).to.be.an('array'); + expect(processedDataFile.data.data.statistics.vha_635[0].VISN).to.be.equal( + 19, + ); // that way we know processing succeeded + expect( + processedDataFile.data.data.statistics.vha_523A5[0].VISN, + ).to.be.equal(1); + }); +}); diff --git a/src/site/stages/build/drupal/tests/police/fixtures/police-contact.csv b/src/site/stages/build/drupal/tests/police/fixtures/police-contact.csv new file mode 100644 index 0000000000..2865b8dc35 --- /dev/null +++ b/src/site/stages/build/drupal/tests/police/fixtures/police-contact.csv @@ -0,0 +1,3 @@ +VISN,Facility API ID,Contact Name,Contact Number +19,vha_635,Abc Jameson,12345689 +1,vha_523A5,Zyz Adamson,1123456799 \ No newline at end of file diff --git a/src/site/stages/build/drupal/tests/police/fixtures/police.csv b/src/site/stages/build/drupal/tests/police/fixtures/police.csv new file mode 100644 index 0000000000..ec8e359ec6 --- /dev/null +++ b/src/site/stages/build/drupal/tests/police/fixtures/police.csv @@ -0,0 +1,3 @@ +VISN,Facility API ID,Facility Name,MM/YYYY,Number of service calls (officer initiated and response to calls),Traffic and parking tickets,Non-traffic (criminal) tickets,Arrests,Complaints and investigations,Numbers of sustained allegations,Numbers of disciplinary actions +19,vha_635,Oklahoma City VA Medical Center,12/2023,4000,100,100,600,50,10,2 +1,vha_523A5,Brockton VA Medical Center,12/2023,5200,220,325,752,78,8,3 \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 30c3f7df43..c4d363a556 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2777,9 +2777,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001252, caniuse-lite@^1.0.30001254: - version "1.0.30001259" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001259.tgz#ae21691d3da9c4be6144403ac40f71d9f6efd790" - integrity sha512-V7mQTFhjITxuk9zBpI6nYsiTXhcPe05l+364nZjK7MFK/E7ibvYBSAXr4YcA6oPR8j3ZLM/LN+lUqUVAQEUZFg== + version "1.0.30001566" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001566.tgz" + integrity sha512-ggIhCsTxmITBAMmK8yZjEhCO5/47jKXPu6Dha/wuCS4JePVL+3uiDEBuhu2aIoT+bqTOR8L76Ip1ARL9xYsEJA== caseless@~0.12.0: version "0.12.0" From 478c3f3a2968e4e71c921997c6a04b6355c70918 Mon Sep 17 00:00:00 2001 From: Eli Selkin Date: Mon, 4 Dec 2023 17:04:25 -0800 Subject: [PATCH 2/7] modify test data for vets-website --- .../drupal/static-data-files/vaPoliceData/police-contact.csv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-contact.csv b/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-contact.csv index 2865b8dc35..ba5cf2659e 100644 --- a/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-contact.csv +++ b/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-contact.csv @@ -1,3 +1,3 @@ VISN,Facility API ID,Contact Name,Contact Number -19,vha_635,Abc Jameson,12345689 -1,vha_523A5,Zyz Adamson,1123456799 \ No newline at end of file +19,avha_635,Abc Jameson,12345689 +1,avha_523A5,Zyz Adamson,1123456799 \ No newline at end of file From 306fac4aa17d1c244345b75f242b0e12e140d7d2 Mon Sep 17 00:00:00 2001 From: Eli Selkin Date: Mon, 4 Dec 2023 17:14:24 -0800 Subject: [PATCH 3/7] correct demo data --- .../build/drupal/tests/police/download.unit.spec.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/site/stages/build/drupal/tests/police/download.unit.spec.js b/src/site/stages/build/drupal/tests/police/download.unit.spec.js index b825b40caa..d8b468a775 100644 --- a/src/site/stages/build/drupal/tests/police/download.unit.spec.js +++ b/src/site/stages/build/drupal/tests/police/download.unit.spec.js @@ -61,15 +61,15 @@ describe('process police csv files', () => { client, ); const keys = Object.keys(processedDataFile.data.data.statistics); - expect(keys).to.contain('vha_635'); - expect(keys).to.contain('vha_523A5'); - expect(processedDataFile.data.data.statistics.vha_635).to.be.an('array'); - expect(processedDataFile.data.data.statistics.vha_523A5).to.be.an('array'); - expect(processedDataFile.data.data.statistics.vha_635[0].VISN).to.be.equal( + expect(keys).to.contain('avha_635'); + expect(keys).to.contain('avha_523A5'); + expect(processedDataFile.data.data.statistics.avha_635).to.be.an('array'); + expect(processedDataFile.data.data.statistics.avha_523A5).to.be.an('array'); + expect(processedDataFile.data.data.statistics.avha_635[0].VISN).to.be.equal( 19, ); // that way we know processing succeeded expect( - processedDataFile.data.data.statistics.vha_523A5[0].VISN, + processedDataFile.data.data.statistics.avha_523A5[0].VISN, ).to.be.equal(1); }); }); From 443da9862ccab71fcca1b35f42c0ad3a6fe9e062 Mon Sep 17 00:00:00 2001 From: Eli Selkin Date: Mon, 4 Dec 2023 19:09:19 -0800 Subject: [PATCH 4/7] fix csv --- .../drupal/static-data-files/vaPoliceData/police-contact.csv | 2 -- .../drupal/static-data-files/vaPoliceData/police-events.csv | 2 -- .../build/drupal/tests/police/fixtures/police-contact.csv | 4 ++-- src/site/stages/build/drupal/tests/police/fixtures/police.csv | 4 ++-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-contact.csv b/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-contact.csv index ba5cf2659e..c1f4e9249f 100644 --- a/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-contact.csv +++ b/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-contact.csv @@ -1,3 +1 @@ VISN,Facility API ID,Contact Name,Contact Number -19,avha_635,Abc Jameson,12345689 -1,avha_523A5,Zyz Adamson,1123456799 \ No newline at end of file diff --git a/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-events.csv b/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-events.csv index fe26762642..99536e981f 100644 --- a/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-events.csv +++ b/src/site/stages/build/drupal/static-data-files/vaPoliceData/police-events.csv @@ -1,3 +1 @@ VISN,Facility API ID,Facility Name,MM/YYYY,Number of service calls (officer initiated and response to calls),Traffic and parking tickets,Non-traffic (criminal) tickets,Arrests,Complaints and investigations,Numbers of sustained allegations,Numbers of disciplinary actions -19,avha_635,Not Oklahoma City VA Medical Center,10/2023,4000,100,100,600,50,10,2 -1,avha_523A5,Not Brockton VA Medical Center,10/2023,5200,220,325,752,78,8,3 \ No newline at end of file diff --git a/src/site/stages/build/drupal/tests/police/fixtures/police-contact.csv b/src/site/stages/build/drupal/tests/police/fixtures/police-contact.csv index 2865b8dc35..ba5cf2659e 100644 --- a/src/site/stages/build/drupal/tests/police/fixtures/police-contact.csv +++ b/src/site/stages/build/drupal/tests/police/fixtures/police-contact.csv @@ -1,3 +1,3 @@ VISN,Facility API ID,Contact Name,Contact Number -19,vha_635,Abc Jameson,12345689 -1,vha_523A5,Zyz Adamson,1123456799 \ No newline at end of file +19,avha_635,Abc Jameson,12345689 +1,avha_523A5,Zyz Adamson,1123456799 \ No newline at end of file diff --git a/src/site/stages/build/drupal/tests/police/fixtures/police.csv b/src/site/stages/build/drupal/tests/police/fixtures/police.csv index ec8e359ec6..96a2083620 100644 --- a/src/site/stages/build/drupal/tests/police/fixtures/police.csv +++ b/src/site/stages/build/drupal/tests/police/fixtures/police.csv @@ -1,3 +1,3 @@ VISN,Facility API ID,Facility Name,MM/YYYY,Number of service calls (officer initiated and response to calls),Traffic and parking tickets,Non-traffic (criminal) tickets,Arrests,Complaints and investigations,Numbers of sustained allegations,Numbers of disciplinary actions -19,vha_635,Oklahoma City VA Medical Center,12/2023,4000,100,100,600,50,10,2 -1,vha_523A5,Brockton VA Medical Center,12/2023,5200,220,325,752,78,8,3 \ No newline at end of file +19,avha_635,Oklahoma City VA Medical Center,12/2023,4000,100,100,600,50,10,2 +1,avha_523A5,Brockton VA Medical Center,12/2023,5200,220,325,752,78,8,3 \ No newline at end of file From a0ebbe6f0860c5bd357b14cfe73ab022fb5fbbdd Mon Sep 17 00:00:00 2001 From: Eli Selkin Date: Tue, 5 Dec 2023 10:45:17 -0800 Subject: [PATCH 5/7] CODEOWNERS --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index ae1e783508..10d9f4f98e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -30,6 +30,7 @@ src/site/layouts/health*.drupal.liquid @department-of-veterans-affairs/vfs-facil src/site/navigation/facility_no_drupal_page_sidebar_nav.drupal.liquid @department-of-veterans-affairs/vfs-facilities-frontend src/site/navigation/facility_sidebar_nav.drupal.liquid @department-of-veterans-affairs/vfs-facilities-frontend src/site/paragraphs/facilities @department-of-veterans-affairs/vfs-facilities-frontend +src/site/stages/build/drupal/static-data-files/vaPoliceData @department-of-veterans-affairs/vfs-facilities-frontend # GraphQL Queries src/site/stages/build/drupal @department-of-veterans-affairs/vfs-public-websites-frontend @department-of-veterans-affairs/vfs-facilities-frontend @department-of-veterans-affairs/cms-infrastructure From 383d2bd2176ccc86b0693ac081dd339af8f35f40 Mon Sep 17 00:00:00 2001 From: Eli Selkin Date: Wed, 6 Dec 2023 10:15:11 -0800 Subject: [PATCH 6/7] Update fetchApi.js add spaces --- src/site/stages/build/drupal/static-data-files/fetchApi.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/site/stages/build/drupal/static-data-files/fetchApi.js b/src/site/stages/build/drupal/static-data-files/fetchApi.js index 1a43fb2455..76b82ac4ad 100644 --- a/src/site/stages/build/drupal/static-data-files/fetchApi.js +++ b/src/site/stages/build/drupal/static-data-files/fetchApi.js @@ -12,6 +12,7 @@ async function fetchWrapper(url, options) { const { data } = await curly.get(url); return new Response(data, { status: 200, statusText: 'OK', url }); } + return fetch(url, options); } @@ -58,6 +59,7 @@ function getCurlClient(buildOptions, _clientOptionsArg = { verbose: true }) { 'certs/VA-Internal-S2-RCA2.pem', ]); } + return fetchWrapper( url, // eslint-disable-next-line prefer-object-spread From 8602ea7a97bc03ed1bc8f867bff8d09d5b96a450 Mon Sep 17 00:00:00 2001 From: Eli Selkin Date: Wed, 6 Dec 2023 12:46:33 -0800 Subject: [PATCH 7/7] Update fetchApi.js Evidently I cannot add spaces without annoying the linter --- src/site/stages/build/drupal/static-data-files/fetchApi.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/site/stages/build/drupal/static-data-files/fetchApi.js b/src/site/stages/build/drupal/static-data-files/fetchApi.js index 76b82ac4ad..1a43fb2455 100644 --- a/src/site/stages/build/drupal/static-data-files/fetchApi.js +++ b/src/site/stages/build/drupal/static-data-files/fetchApi.js @@ -12,7 +12,6 @@ async function fetchWrapper(url, options) { const { data } = await curly.get(url); return new Response(data, { status: 200, statusText: 'OK', url }); } - return fetch(url, options); } @@ -59,7 +58,6 @@ function getCurlClient(buildOptions, _clientOptionsArg = { verbose: true }) { 'certs/VA-Internal-S2-RCA2.pem', ]); } - return fetchWrapper( url, // eslint-disable-next-line prefer-object-spread