npm: Explicitely retrieve the revision date from extrinsic metadata
No date is available in intrinsic metadata, so we retrieve it from the API metadata, using the version number that the API claims this package has.
This fixes the current loading which fails when this scenario occurs.
Note: This matches what was done in the prior loader-npm version [1]
Test Plan
-
tox
-
swh-docker-dev:
from swh.loader.package.npm import NpmLoader;
l = NpmLoader(package_url='https://www.npmjs.com/package/@aller/shared', package_name='@aller/shared', package_metadata_url='https://replicate.npmjs.com/%40aller%2Fshared');
l.load()
- worker0@staging
Without patch, explodes mid-air with KeyError on version mismatch. With patch, ok.
Migrated from D2344 (view on Phabricator)