Repository navigation
refactor(transcode): replace any types in Encore methods with generated EncoreJobRequest/Response - #140
Merged
Conversation
…ed EncoreJobRequest/Response Replaces implicit any with proper generated types from @osaas/client-services: - encore.ts: import EncoreJobResponse and use in createFetch<EncoreJobResponse> - transcode.ts: use EncoreJobRequest for job body, EncoreJobResponse[] in JobList - vodpipeline.ts: use EncoreJobRequest for job body, cast response as EncoreJobResponse - index.ts: re-export EncoreJobRequest and EncoreJobResponse for consumers Closes #133. Part of Eyevinn/osaas-app#4345. Co-Authored-By: Claude <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
Replaces implicit
anytypes in the transcode package with generated Encore types from@osaas/client-services.Changes:
encore.ts:createFetch<any>->createFetch<EncoreJobResponse>with explicit importtranscode.ts:encoreJobs: any[]inJobList->encoreJobs: EncoreJobResponse[]; job body typed asPartial<EncoreJobRequest>with field intersections for fields not yet in the generated schemavodpipeline.ts: job body typed asPartial<EncoreJobRequest>with field intersections; response cast asEncoreJobResponseindex.ts: re-exportsEncoreJobRequestandEncoreJobResponsefor package consumersCloses #133
Part of Eyevinn/osaas-app#4345
Lessons
EncoreJobRequestaliases the POST request body from the OpenAPI spec, which does not include some fields used at the call sites (baseName,seekTo,inputs,progressCallbackUri,profileParams). These are real fields accepted by Encore but not yet reflected in the generated spec. The approach used isPartial<EncoreJobRequest> & { fieldA?: type; ... }which keeps the typed fields type-safe without erroring on the extra fields. Attempting to useEncoreJobRequestdirectly would fail TypeScript with missing required fields.EncoreJobResponseresolves toEntityModelEncoreJobwhich hasidas a direct optional field — no HAL nesting issue.🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com