Skip to content

WEBDEV-8510: Migrate metadata-service into elements#54

Open
jbuckner wants to merge 4 commits into
WEBDEV-8509-migrate-item-metadatafrom
WEBDEV-8510-migrate-metadata-service
Open

WEBDEV-8510: Migrate metadata-service into elements#54
jbuckner wants to merge 4 commits into
WEBDEV-8509-migrate-item-metadatafrom
WEBDEV-8510-migrate-metadata-service

Conversation

@jbuckner
Copy link
Copy Markdown
Collaborator

@jbuckner jbuckner commented May 27, 2026

Move @internetarchive/metadata-service into src/services/metadata-service/ — terminal node of the consolidation chain.

Stacked on #53 (→ #51); effectively needs field-parsers + item-metadata + result-type in tree. The src/types/result.ts here collapses to a no-op once #52 lands.

  • Imports rewritten: result-type@src/types/result, item-metadata barrel → individual @src/models/....
  • metadata-service-error.ts: enumconst … as const (string values unchanged, equality checks still pass).

No runtime change; build + tests green. QA-waived (code move).

WEBDEV-8510

jbuckner and others added 3 commits May 27, 2026 14:10
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>
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>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 28, 2026

PR Preview Action v1.8.1

🚀 View preview at
https://internetarchive.github.io/elements/pr/pr-54/

Built to branch ghpages at 2026-06-01 20:04 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

Copy link
Copy Markdown

@bfalling bfalling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Add an interactive `metadata-service-story` built on the shared
`story-template`. It performs a live fetch against the archive.org
metadata API via `MetadataService.default`, exercising `fetchMetadata`
and `fetchMetadataValue` and rendering the `Result` (a modeled
`MetadataResponse`, or a `MetadataServiceError`). Broaden the demo
`app-root.ts` glob to `../src/**/*-story.ts` so stories outside
`elements`/`labs` are auto-discovered.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants