Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
b6846d4
Merge pull request #580 from NYPL/HOTFIX/remove-schomburg-button
danamansana Oct 31, 2025
e24bdba
Merge pull request #586 from NYPL/qa
danamansana Nov 10, 2025
daa8dbb
Merge pull request #592 from NYPL/qa
danamansana Nov 19, 2025
008c5ab
Merge pull request #594 from NYPL/qa
nonword Nov 21, 2025
1f66eea
Merge pull request #604 from NYPL/qa
danamansana Dec 16, 2025
4291ded
Merge pull request #613 from NYPL/main
charmingduchess Jan 6, 2026
abd840d
Merge pull request #615 from NYPL/main
charmingduchess Jan 6, 2026
32ebc2f
Merge pull request #616 from NYPL/qa
charmingduchess Jan 8, 2026
d26f54c
wip
charmingduchess Jan 14, 2026
f4defb6
fix delivery location type biz
charmingduchess Jan 14, 2026
4f4e0e3
rm console.log
charmingduchess Jan 14, 2026
ec1ea45
rm console log
charmingduchess Jan 14, 2026
6404e6a
Merge pull request #619 from NYPL/noref-log-debug-schoalr-rooms
charmingduchess Jan 14, 2026
cac891f
Merge pull request #620 from NYPL/main
7emansell Jan 15, 2026
f917024
Merge pull request #624 from NYPL/qa
7emansell Jan 29, 2026
fa20748
Merge pull request #632 from NYPL/main
charmingduchess Feb 4, 2026
06d906c
Merge pull request #634 from NYPL/main
charmingduchess Feb 4, 2026
4f81e85
Merge branch 'main' into qa
charmingduchess Feb 4, 2026
f35c983
Merge pull request #637 from NYPL/main
yossariano Feb 5, 2026
7feceb6
Merge pull request #640 from NYPL/main
danamansana Feb 10, 2026
291b3e0
Merge pull request #641 from NYPL/main
danamansana Feb 10, 2026
7a34480
update resources index
charmingduchess Feb 12, 2026
a98d42a
Merge pull request #646 from NYPL/main
yossariano Feb 12, 2026
1474814
update index
charmingduchess Feb 13, 2026
97ff97d
Merge pull request #644 from NYPL/update-resources-index-
charmingduchess Feb 13, 2026
c684af5
Merge pull request #648 from NYPL/main
yossariano Feb 18, 2026
9eb15bb
Merge pull request #652 from NYPL/main
yossariano Feb 27, 2026
7bca5ec
Merge pull request #655 from NYPL/main
yossariano Mar 2, 2026
5af3cdf
Merge pull request #653 from NYPL/qa
7emansell Mar 2, 2026
6eceea4
Merge pull request #660 from NYPL/main
yossariano Mar 5, 2026
b53471c
Merge branch 'main' into qa
nonword Mar 6, 2026
bcb305c
Merge branch 'main' into qa
nonword Mar 9, 2026
b28805c
Merge branch 'main' into production
nonword Mar 9, 2026
891e41d
Support for _displayPacked fields (contributors and creators)
yossariano Mar 11, 2026
3dcbf33
refactor
charmingduchess Mar 12, 2026
a5ff965
Merge pull request #669 from NYPL/main
yossariano Mar 12, 2026
c0c5464
Merge pull request #667 from NYPL/SCC-5277-display-packed
yossariano Mar 12, 2026
85b9e41
Merge pull request #671 from NYPL/main
yossariano Mar 12, 2026
643b8df
fix filter
charmingduchess Mar 12, 2026
d4b31bc
Bump core to 2.39
7emansell Mar 12, 2026
220f336
Add collection access type to item holding location, plus test
7emansell Mar 12, 2026
c5d482d
Add shelfmark sorting for callnumber searches
danamansana Mar 13, 2026
df19f00
Merge pull request #674 from NYPL/scc-4668
danamansana Mar 13, 2026
687a32e
Merge pull request #676 from NYPL/main
danamansana Mar 13, 2026
fa97479
Update collection entities to include locationsPath, bump nypl-core-o…
7emansell Mar 13, 2026
129f9a6
One more test
7emansell Mar 13, 2026
af3fdab
Make getFormattedHoldingLocation more defensive
7emansell Mar 13, 2026
b88014e
Merge pull request #672 from NYPL/SCC-5208/filter-fix
charmingduchess Mar 16, 2026
faba5f9
Merge pull request #677 from NYPL/main
charmingduchess Mar 16, 2026
b6dcd86
the tests
charmingduchess Mar 16, 2026
3aa92cd
add int test file
charmingduchess Mar 16, 2026
57fef73
Merge branch 'production' into SCC-5164/delivery-integration-test
charmingduchess Mar 16, 2026
b62d846
rm commented code
charmingduchess Mar 16, 2026
66b2af2
Merge pull request #668 from NYPL/noref-refactor-deployment
charmingduchess Mar 17, 2026
0b0aa79
Merge pull request #681 from NYPL/main
charmingduchess Mar 17, 2026
4c9e284
Merge branch 'main' into SCC-5164/delivery-integration-test
charmingduchess Mar 17, 2026
8f07bfc
test
charmingduchess Mar 18, 2026
bf3c9ff
Merge pull request #683 from NYPL/SCC-5164/delivery-integration-test-…
charmingduchess Mar 18, 2026
1a82c24
Merge pull request #684 from NYPL/main
charmingduchess Mar 18, 2026
3d0a596
Merge branch 'main' into SCC-5090/collection-access-type
7emansell Mar 18, 2026
cec1e53
Merge pull request #673 from NYPL/SCC-5090/collection-access-type
7emansell Mar 18, 2026
29d5500
Merge branch 'main' into qa
7emansell Mar 18, 2026
f53c870
expect scholar delivery for m1 item/scholar
charmingduchess Mar 19, 2026
48066b4
Merge pull request #685 from NYPL/SCC-5164/delivery-integration-test-…
charmingduchess Mar 19, 2026
6098cb3
Merge pull request #688 from NYPL/main
charmingduchess Mar 19, 2026
e046813
Merge pull request #643 from NYPL/scc-5168
danamansana Mar 20, 2026
1ff1eba
Merge pull request #690 from NYPL/main
danamansana Mar 26, 2026
2ede4c4
Allow alphanumeric characters in itemUri
danamansana Apr 1, 2026
795c643
Ignore case in search for roles in contributor browse
yossariano Apr 2, 2026
77e683d
Merge pull request #694 from NYPL/scc-5285
danamansana Apr 3, 2026
64d44ec
Merge pull request #697 from NYPL/main
danamansana Apr 3, 2026
c604890
Merge pull request #695 from NYPL/NOREF-ignore-case-in-role-search
yossariano Apr 3, 2026
d1d018f
Merge pull request #698 from NYPL/main
yossariano Apr 3, 2026
fc42be2
Update resources index to resources-prod-2026-04-08
yossariano Apr 8, 2026
803f259
Merge pull request #703 from NYPL/NOREF-04-08-update-resources-index
yossariano Apr 9, 2026
45ebe02
use wait for stable ecs
charmingduchess Apr 9, 2026
5e872a7
replace service name
charmingduchess Apr 9, 2026
9cdb570
generalize
charmingduchess Apr 9, 2026
8df63cc
Merge pull request #704 from NYPL/noref-move-integration-tests
charmingduchess Apr 9, 2026
aa54e7e
Merge pull request #705 from NYPL/main
charmingduchess Apr 9, 2026
0fb6eb5
extract tests
charmingduchess Apr 9, 2026
3f208b7
Merge pull request #706 from NYPL/noref-move-integration-tests
charmingduchess Apr 9, 2026
8fd3841
restrict perms
charmingduchess Apr 9, 2026
7bfc73a
Potential fix for pull request finding 'CodeQL / Workflow does not co…
charmingduchess Apr 9, 2026
266e928
Merge pull request #707 from NYPL/main
charmingduchess Apr 9, 2026
bedab59
fix broken test reference
charmingduchess Apr 9, 2026
6129b7e
Merge pull request #708 from NYPL/noref-move-integration-tests
charmingduchess Apr 9, 2026
6373f4c
Merge pull request #709 from NYPL/main
charmingduchess Apr 9, 2026
35d6214
fix test ref
charmingduchess Apr 9, 2026
4d50db1
add workflow call
charmingduchess Apr 9, 2026
584011d
checkout repo
charmingduchess Apr 9, 2026
b46b4fd
head branch
charmingduchess Apr 9, 2026
3b23b3e
spaghetti
charmingduchess Apr 9, 2026
3316e8f
trigger rollback with integration-test failure
charmingduchess Apr 10, 2026
a19d88f
ensure int test failure
charmingduchess Apr 10, 2026
4ba6d0d
failure to pass linting
charmingduchess Apr 10, 2026
a5fa996
Merge pull request #710 from NYPL/test-auto-rollback
charmingduchess Apr 10, 2026
69d493e
add yml to remove in qa2 merge conflict
charmingduchess Apr 10, 2026
a8df84b
rm test and deploy
charmingduchess Apr 10, 2026
47d65d2
Merge branch 'qa2' into main
charmingduchess Apr 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Deploy

on:
push:
branches:
- qa
- production
- qa2

# Global environment variable based on the branch name
env:
ENV_TAG: ${{ github.ref_name }}
ECR_REPOSITORY: discovery-api

jobs:
tests:
name: Run Tests
uses: ./.github/workflows/test.yml

deploy:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Comment on lines +17 to +20
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
needs: tests
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::946183545209:role/GithubActionsDeployerRole
aws-region: us-east-1

- name: Log in to ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Back up previous image for rollback
run: |
MANIFEST=$(aws ecr batch-get-image --repository-name ${{ env.ECR_REPOSITORY }} --image-ids imageTag="${{ env.ENV_TAG }}-latest" --output json | jq --raw-output --join-output '.images[0].imageManifest')
PREVIOUS_MANIFEST=$(aws ecr batch-get-image --repository-name ${{ env.ECR_REPOSITORY }} --image-ids imageTag="${{ env.ENV_TAG }}-previous" --output json | jq --raw-output --join-output '.images[0].imageManifest')
if [ "$MANIFEST" != "$PREVIOUS_MANIFEST" ]; then
aws ecr put-image --repository-name ${{ env.ECR_REPOSITORY }} --image-tag "${{ env.ENV_TAG }}-previous" --image-manifest "$MANIFEST"
fi

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/${{ env.ECR_REPOSITORY }}:$IMAGE_TAG .
docker push $ECR_REGISTRY/${{ env.ECR_REPOSITORY }}:$IMAGE_TAG
docker tag $ECR_REGISTRY/${{ env.ECR_REPOSITORY }}:$IMAGE_TAG $ECR_REGISTRY/${{ env.ECR_REPOSITORY }}:${{ env.ENV_TAG }}-latest
docker push $ECR_REGISTRY/${{ env.ECR_REPOSITORY }}:${{ env.ENV_TAG }}-latest

- name: Force ECS Update
run: |
aws ecs update-service --cluster discovery-api-${{ env.ENV_TAG }} --service discovery-api-${{ env.ENV_TAG }} --force-new-deployment
45 changes: 32 additions & 13 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,44 @@
name: Run Smoke Tests

on:
workflow_run:
workflows: ["Deploy"]
types: [completed]
branches: [production, qa, qa2]

permissions:
id-token: write
contents: read

env:
ENV: ${{ github.event.workflow_run.head_branch }}

jobs:
integration-test-qa:
integration-test:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
needs: tests
if: github.ref == 'refs/heads/qa2'
steps:
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::946183545209:role/GithubActionsDeployerRole
aws-region: us-east-1
- uses: actions/checkout@v4
- name: Wait for stable service
uses: nick-fields/retry@v3
with:
max_attempts: 3
timeout_minutes: 10
command: aws ecs wait services-stable --cluster discovery-api-${{env.ENV}} --services discovery-api-${{env.ENV}}
- uses: actions/checkout@v3
- name: Set Node version
uses: actions/setup-node@v4
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm ci
- name: Start service
run: ENV=qa npm start &
- name: Run tests
run: node test/integration/delivery-locations-by-barcode.test.js
node-version-file: ".nvmrc"
- name: npm install
run: npm i
- name: Run integration tests
env:
ENV: "qa"
run: node test/integration/delivery-locations-by-barcode.test.js
10 changes: 8 additions & 2 deletions .github/workflows/rollback-qa2.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
name: Rollback qa2

on:
workflow_dispatch:
on:
workflow_run:
workflows: ["Run Smoke Test"]
types: [completed]

env:
ENV: ${{ github.event.workflow_run.head_branch }}

jobs:
# Rollback job in case of failure (Revert qa to the previous task definition)
Expand All @@ -11,6 +16,7 @@ jobs:
contents: read
name: Rollback to Previous Version
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' && env.ENV == 'qa2'}}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Unit Tests

on:
workflow_call:
push:

permissions:
contents: read

jobs:
tests:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Node version
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: npm install
run: npm ci
- name: Unit Tests
run: npm test
4 changes: 2 additions & 2 deletions config/production.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ENCRYPTED_ELASTICSEARCH_URI=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAJYwgZMGCSqGSIb3DQEHBqCBhTCBggIBADB9BgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDFWw8ECX9Pz81z0kvAIBEIBQGec9PCpwuvEgLH6imhqP6tx1fj8Vlf2ZipnUy06jzmpE262Qvk9LPAq7sIYPVkTCZctwilwcU9oC6yxasVoUlK87la77v03CeZsPIDwciFY=
ENCRYPTED_RESOURCES_INDEX=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAHcwdQYJKoZIhvcNAQcGoGgwZgIBADBhBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDLHxxMobbmmkVc76dQIBEIA0aZV7enzAKvaDMt7lJik1Ps8J6wikj4dJTL6YzjIlpRh8Dsl7tYgpEgsTNVqA7JRhErUT9w==
ENCRYPTED_RESOURCES_INDEX=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAHcwdQYJKoZIhvcNAQcGoGgwZgIBADBhBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDAk2mOM+zTrPU2rOagIBEIA0E3OuraTI5i3rqAiNrAj4RKV/c6DqotQ5nqSP8TzKk0qZYlHz+1jua11ZtKHIJ9LhszaE4Q==
ENCRYPTED_ELASTICSEARCH_API_KEY=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAJ4wgZsGCSqGSIb3DQEHBqCBjTCBigIBADCBhAYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAyPOPaQCBbvKQhJoPQCARCAV2TlWlRh+xKnCegpprEQgfldZGcVW48RND0LVd/pQpVTJnRTtbCpP7damT7k8ziJVdWZ3jsfs5fw5YnKc/EIQ1M//DRUzOJL98ir5LTTxE7QhflKDtUY+Q==

ENCRYPTED_SCSB_URL=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAHwwegYJKoZIhvcNAQcGoG0wawIBADBmBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDKPFC8wFkVM5CyT6VQIBEIA5m4eLBkpChRA//ZNEWsRqIDGZmevb/thzI03a0NiAW6VfybSAYpFthh+bj/yAk1VEEBF6r1T4A2GP
Expand All @@ -10,7 +10,7 @@ NYPL_OAUTH_URL=https://isso.nypl.org/
ENCRYPTED_NYPL_OAUTH_ID=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAGswaQYJKoZIhvcNAQcGoFwwWgIBADBVBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDMLKVUQA58B6vprNcAIBEIAoaz0lI9EL2M9NyTuEwT8JDmPBt6aXfMiFs027DEuwsCN0wS0qWeFL1g==
ENCRYPTED_NYPL_OAUTH_SECRET=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAIcwgYQGCSqGSIb3DQEHBqB3MHUCAQAwcAYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAyWz91LOP2YP5fg0q0CARCAQ9inO9SV1M8R0Pkkx84r7UdwlU1FxfXvIjk/z6Qs81KBAVELhby2iD5LawQyDrR9tjhuMbotS6QnydwwMR/p8+qJXHI=

NYPL_CORE_VERSION=v2.35
NYPL_CORE_VERSION=v2.39

LOG_LEVEL=info
FEATURES=on-site-edd
Expand Down
2 changes: 1 addition & 1 deletion config/qa.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ NYPL_OAUTH_URL=https://isso.nypl.org/
ENCRYPTED_NYPL_OAUTH_ID=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAGswaQYJKoZIhvcNAQcGoFwwWgIBADBVBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDMLKVUQA58B6vprNcAIBEIAoaz0lI9EL2M9NyTuEwT8JDmPBt6aXfMiFs027DEuwsCN0wS0qWeFL1g==
ENCRYPTED_NYPL_OAUTH_SECRET=AQECAHh7ea2tyZ6phZgT4B9BDKwguhlFtRC6hgt+7HbmeFsrsgAAAIcwgYQGCSqGSIb3DQEHBqB3MHUCAQAwcAYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAyWz91LOP2YP5fg0q0CARCAQ9inO9SV1M8R0Pkkx84r7UdwlU1FxfXvIjk/z6Qs81KBAVELhby2iD5LawQyDrR9tjhuMbotS6QnydwwMR/p8+qJXHI=

NYPL_CORE_VERSION=v2.35
NYPL_CORE_VERSION=v2.39

LOG_LEVEL=debug
FEATURES=on-site-edd
Expand Down
2 changes: 1 addition & 1 deletion config/test.env
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ NYPL_OAUTH_URL=http://oauth.example.com
NYPL_OAUTH_ID=encrypted-nypl-oauth-id
NYPL_OAUTH_SECRET=encrypted-nypl-oauth-id

NYPL_CORE_VERSION=v2.37
NYPL_CORE_VERSION=v2.39

LOG_LEVEL=error
FEATURES=on-site-edd
Expand Down
1 change: 0 additions & 1 deletion lib/available_delivery_location_types.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ class AvailableDeliveryLocationTypes {
if (!patronID) return null

const patronType = await this._getPatronTypeOf(patronID)

if (this._isUnfamiliarPatronType(patronType)) {
return null
}
Expand Down
20 changes: 16 additions & 4 deletions lib/contributors.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,33 @@ module.exports = function (app, _private = null) {
}

/**
* Builds an aggregation query that checks the resource index for counts on the contributorRoleLiteral field for a list of contributors.
* Builds an aggregation query that checks the resource index for counts on the browseableContributorRole_packed field for a list of contributors.
*/
const buildElasticRoleCountQuery = function (contributorList) {
return {
size: 0,
query: {
terms: {
contributorRoleLiteral: contributorList
bool: {
should: [
{
terms: {
'creatorLiteral.keywordLowercased': contributorList
}
},
{
terms: {
'contributorLiteral.keywordLowercased': contributorList
}
}
],
minimum_should_match: 1
}
},
aggs: {
contributor_role: {
terms: {
script: {
source: 'def results = []; for (val in doc["contributorRoleLiteral"]) { int pos = val.indexOf("||"); if (pos != -1) { String name = val.substring(0, pos); if (params.targets.contains(name)) { results.add(val); } } } return results;',
source: 'def results = []; for (val in doc["browseableContributorRole_packed"]) { int pos = val.indexOf("||"); if (pos != -1) { String name = val.substring(0, pos); if (params.targets.contains(name)) { results.add(val); } } } return results;',
params: {
targets: contributorList
}
Expand Down
25 changes: 25 additions & 0 deletions lib/display-field-unpacker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const parseValueAndLabel = (delimitedString) => {
if (!delimitedString.includes('||')) {
return { value: delimitedString, display: null }
}
const [value, display] = delimitedString.split('||')
return { value, display }
}

module.exports = (elasticSearchResponse) => {
elasticSearchResponse.hits.hits.forEach((bib) => {
// Contributors and creators are packed like so <name>||<display label> where <display label>
// can have prefix, title, and roles. We'd like to unpack them in a friendly format for the frontend
// to display the full label and use the isolated name for link-building
Object.entries(bib._source).forEach(([key, value]) => {
if (key.endsWith('_displayPacked')) {
const fieldName = key.replace('_displayPacked', '')
bib._source[fieldName + 'Display'] = value.map((packedValue) => parseValueAndLabel(packedValue))
delete bib._source[key]
}
})

return bib
})
return elasticSearchResponse
}
2 changes: 1 addition & 1 deletion lib/elasticsearch/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const FILTER_CONFIG = {
mediaType: { operator: 'match', field: ['mediaType.id', 'mediaType.label'], repeatable: true },
carrierType: { operator: 'match', field: ['carrierType.id', 'carrierType.label'], repeatable: true },
publisher: { operator: 'match', field: ['publisherLiteral.raw'], repeatable: true },
contributorLiteral: { operator: 'match', field: ['contributorLiteral.keywordLowercased', 'parallelContributor.raw', 'creatorLiteral.keywordLowercased', 'parallelCreatorLiteral.raw'], repeatable: true },
contributorLiteral: { operator: 'match', field: ['contributorLiteral.keywordLowercased', 'parallelContributorLiteral.raw', 'creatorLiteral.keywordLowercased', 'parallelCreatorLiteral.raw'], repeatable: true },
creatorLiteral: { operator: 'match', field: ['creatorLiteral.raw', 'parallelCreatorLiteral.raw'], repeatable: true },
issuance: { operator: 'match', field: ['issuance.id', 'issuance.label'], repeatable: true },
createdYear: { operator: 'match', field: ['createdYear'], repeatable: true },
Expand Down
2 changes: 1 addition & 1 deletion lib/elasticsearch/elastic-query-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class ElasticQueryBuilder {
* Concat contributor + role if role param is provided
*/
applyContributorRole () {
this.query.addMust(termMatch('contributorRoleLiteral', this.request.params.filters.contributorLiteral + '||' + this.request.params.role))
this.query.addMust(termMatch('browseableContributorRole_packed', this.request.params.filters.contributorLiteral + '||' + this.request.params.role))
}

/**
Expand Down
22 changes: 21 additions & 1 deletion lib/jsonld_serializers.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,14 @@ ResourceSerializer.getFormattedFormat = function (formatId) {

ResourceSerializer.formatCollection = function (collectionId) {
const prefLabel = nyplCore.collections()[`nyplCollection:${collectionId}`]?.label
const locationsPath = nyplCore.collections()[`nyplCollection:${collectionId}`]?.locationsPath
const buildingLocationLabel = buildingLocations.find((loc) => loc.value === collectionId.slice(0, 2))?.label
if (!prefLabel) return null
return {
'@id': collectionId,
prefLabel,
buildingLocationLabel
buildingLocationLabel,
locationsPath
}
}

Expand Down Expand Up @@ -374,10 +376,15 @@ class ItemResourceSerializer extends JsonLdItemSerializer {
})
}

if (this.body.holdingLocation) {
stmts.holdingLocation = ItemResourceSerializer.getFormattedHoldingLocation(this.body.holdingLocation)
}

// Override default serialization of item.electronicLocator statements (full digital surrogates):
if (this.body.electronicLocator) {
stmts.electronicLocator = this.body.electronicLocator.map((link) => ResourceSerializer.formatElectronicResourceBlankNode(link, 'nypl:ElectronicLocation'))
}

return stmts
}

Expand All @@ -386,6 +393,19 @@ class ItemResourceSerializer extends JsonLdItemSerializer {
return (new ItemResourceSerializer(resp, options)).format()
}

static getFormattedHoldingLocation (location) {
const loc = Array.isArray(location) ? location[0] : null
if (!loc) return []
const locationId = loc['@id']?.split(':')[1]
const sierraLocations = nyplCore.sierraLocations()
const collectionAccessType = sierraLocations?.[locationId]?.collectionAccessType
return [{
'@id': loc['@id'],
prefLabel: loc?.prefLabel,
collectionAccessType
}]
}

// Given an item, returns item with an added `identifier`
// of form 'urn:[sourceIdentifierPrefix]:[sourceIdentifier]'
// e.g.
Expand Down
1 change: 0 additions & 1 deletion lib/models/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ Item.withDeliveryLocationsByBarcode = async function (item, scholarRoom) {
const model = new Item(item)
item.eddRequestable = !!model.eddRequestable
const filteredDeliveryLocationsWithScholarRoom = locationUtils.filterLocations(model.deliveryLocation, scholarRoom)

item.deliveryLocation = locationUtils.formatLocations(filteredDeliveryLocationsWithScholarRoom)
return item
}
Expand Down
13 changes: 1 addition & 12 deletions lib/models/Location.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,7 @@ class Location {
case 'm2-customer-code':
return this.deliveryLocationsByM2CustomerCode
default:
return this.deliveryLocationByHoldingLocation
}
}

get deliveryLocationByHoldingLocation () {
if (this.nyplCoreLocation?.sierraDeliveryLocations?.length) {
// It's mapped, but the sierraDeliveryLocation entities only have `code` and `label`
// Do a second lookup to populate `deliveryLocationTypes`
return this.nyplCoreLocation.sierraDeliveryLocations.map((deliveryLocation) => {
deliveryLocation.deliveryLocationTypes = this.nyplCoreLocation.deliveryLocationTypes
return deliveryLocation
})
return this.nyplCoreLocation?.sierraDeliveryLocations
}
}

Expand Down
5 changes: 4 additions & 1 deletion lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ const SORT_FIELDS = {
initialDirection: 'asc',
field: 'creator_sort'
},
callnumber: {
initialDirection: 'asc',
field: 'shelfMark.keywordLowercased'
},
relevance: {}
}

Expand Down Expand Up @@ -334,7 +338,6 @@ module.exports = function (app, _private = null) {
// The resolved values of Promise.all are strictly ordered based on original array of promises
const items = resp[0]
const scholarRoom = resp[1]

// Use HTC API and nypl-core mappings to ammend ES response with deliveryLocations:
return Promise.all(items.map(async (item) => Item.withDeliveryLocationsByBarcode(item, scholarRoom)))
.catch((e) => {
Expand Down
Loading
Loading