WEBDEV-8510: Migrate metadata-service into elements#54
Open
jbuckner wants to merge 3 commits into
Open
Conversation
Moves @internetarchive/metadata-service into src/services/metadata-service/. Rewrites field-parsers / iaux-item-metadata / result-type imports to the in-tree @src/* paths landed by WEBDEV-8507, WEBDEV-8508, WEBDEV-8509. The MetadataServiceErrorType enum became a const object to satisfy erasableSyntaxOnly. Tests ported to vitest; default-backend tests restore window.fetch via afterEach instead of inline try/finally. The mock-response-generator helper was inlined into the test file (reduced to a single small function) to avoid shipping a test helper in the published dist. Also brings in src/types/result.ts from WEBDEV-8508 since this branch is stacked on 8509 (which is stacked on 8507) — when 8508 lands first, this commit's result.ts becomes a no-op via rebase. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…rate-metadata-service
The migrated metadata-service test mocks declared interface params (identifier/keypath, fetch input) they don't use. The source repo silenced this via eslint-disable, but elements' tsc build has noUnusedParameters on and TS6133 isn't covered by that eslint comment. Prefix the intentionally unused params with _ so the build passes while keeping the mock signatures. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves @internetarchive/metadata-service into
src/services/metadata-service/— the terminal node of the consolidation chain.WEBDEV-8509-migrate-item-metadata), which is stacked on #51. Effectively depends on field-parsers + item-metadata + result-type being in tree. Thesrc/types/result.tsfile in this PR is the same content as #52 — once #52 lands first, the rebase here will collapse that file to a no-op.Changes
src/services/metadata-service/—metadata-service.ts,metadata-service-interface.ts,metadata-service-error.ts,backend/{default-metadata-backend,metadata-backend-interface}.ts,responses/metadata-response.ts.@internetarchive/result-type→@src/types/result@internetarchive/iaux-item-metadatabarrel → individual@src/models/item-metadata/{file,metadata,review,speech-music-asr-entry}importssrc/services/metadata-service/metadata-service-error.ts—enum MetadataServiceErrorType→const … as const+ type alias (forerasableSyntaxOnly). String values are unchanged, so all existing equality checks still pass.src/types/result.ts— included to make this branch build standalone; will collapse to a no-op once WEBDEV-8508: Migrate result-type into elements #52 lands on main.MockResponseGeneratorclass became a single inlinegenerateMockMetadataResponsefunction — the test only used a tiny subset of the original mock data.window.fetchviaafterEachinstead of per-test backup/restore.Verification
npm run build✓npm run test✓ — 283 tests pass (11 new for metadata-service)npm run circular✓Order in the migration chain
Test plan
generateMockMetadataResponsecovers the test's needs (onlymetadata.identifieris asserted in the test that uses it)MetadataServiceErrorTypeconst-object preserves string values used by callers (type === MetadataServiceErrorType.networkErrorshould still work everywhere)🤖 Generated with Claude Code