Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: creatives without transcoded assets are not included in the VAST response #16

Merged
merged 1 commit into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion src/encore/encoreclient.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { EncoreClient } from './encoreclient';
import { EncoreJob, InputType } from './types';
import { ManifestAsset } from '../vast/vastApi';

jest.mock('../util/logger', () => ({
info: jest.fn()
Expand Down
6 changes: 4 additions & 2 deletions src/vast/vastApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
};

const findMissingAndDispatchJobs = async (
vastXmlObj: any,

Check warning on line 164 in src/vast/vastApi.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
opts: AdApiOptions
): Promise<ManifestResponse> => {
const creatives = await getCreatives(vastXmlObj);
Expand Down Expand Up @@ -251,11 +251,11 @@
}
};

const getCreatives = async (vastXml: any): Promise<ManifestAsset[]> => {

Check warning on line 254 in src/vast/vastApi.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
try {
if (vastXml.VAST.Ad) {
const creatives = vastXml.VAST.Ad.reduce(
(acc: ManifestAsset[], ad: any) => {

Check warning on line 258 in src/vast/vastApi.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
const adId = ad.InLine.Creatives.Creative.UniversalAdId[
'#text'
].replace(/[^a-zA-Z0-9]/g, '');
Expand All @@ -279,7 +279,7 @@
const parser = new XMLParser({ ignoreAttributes: false });
const parsedVAST = parser.parse(vastXml);
if (parsedVAST.VAST.Ad) {
for (const ad of parsedVAST.VAST.Ad) {
parsedVAST.VAST.Ad = parsedVAST.VAST.Ad.reduce((acc: any[], ad: any) => {

Check warning on line 282 in src/vast/vastApi.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected any. Specify a different type
const adId = ad.InLine.Creatives.Creative.UniversalAdId[
'#text'
].replace(/[^a-zA-Z0-9]/g, '');
Expand All @@ -289,8 +289,10 @@
asset.masterPlaylistUrl;
ad.InLine.Creatives.Creative.Linear.MediaFiles.MediaFile['@_type'] =
'application/x-mpegURL';
acc.push(ad);
}
}
return acc;
}, []);
}
const builder = new XMLBuilder({ format: true, ignoreAttributes: false });
const modifiedVastXml = builder.build(parsedVAST);
Expand Down
Loading