-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #429 from NYPL/noref-nypl-core-objects-async
NYPL core objects async refactor
- Loading branch information
Showing
12 changed files
with
104 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const _data = {} | ||
const nyplCoreObjects = require('@nypl/nypl-core-objects') | ||
|
||
const loadNyplCoreData = () => { | ||
const vocabularies = { | ||
sierraLocations: 'by-sierra-location', | ||
recordTypes: 'by-record-types', | ||
recapCustomerCodes: 'by-recap-customer-code', | ||
m2CustomerCodes: 'by-m2-customer-code', | ||
patronTypes: 'by-patron-type' | ||
} | ||
return Promise.all(Object.keys(vocabularies).map(async (vocab) => { | ||
const nyplCoreValues = await nyplCoreObjects(vocabularies[vocab]) | ||
_data[vocab] = nyplCoreValues | ||
})) | ||
} | ||
|
||
module.exports = { | ||
loadNyplCoreData, | ||
patronTypes: () => _data.patronTypes || {}, | ||
sierraLocations: () => _data.sierraLocations || {}, | ||
recapCustomerCodes: () => _data.recapCustomerCodes || {}, | ||
recordTypes: () => _data.recordTypes || {}, | ||
m2CustomerCodes: () => _data.m2CustomerCodes || {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.