chore: clean up

This commit is contained in:
Luan
2024-09-16 07:21:33 -03:00
parent 5549a97173
commit f8c253177f
4 changed files with 11 additions and 105 deletions

View File

@@ -13,7 +13,7 @@
"build": "npm run clean && npm run lint && npm run build:proto && npm run build:esm && npm run bundle:node", "build": "npm run clean && npm run lint && npm run build:proto && npm run build:esm && npm run bundle:node",
"build:esm": "npx tsc", "build:esm": "npx tsc",
"build:proto": "node ./dev-scripts/generate-proto.mjs", "build:proto": "node ./dev-scripts/generate-proto.mjs",
"bundle:node": "npx esbuild ./dist/src/index.js --bundle --outfile=./bundle/index.cjs --platform=node --target=node10 --format=cjs --sourcemap --banner:js=\"/* eslint-disable */\"", "bundle:node": "npx esbuild ./dist/src/index.js --bundle --outfile=./bundle/index.cjs --platform=node --target=node16 --format=cjs --sourcemap --banner:js=\"/* eslint-disable */\"",
"prepare": "npm run build" "prepare": "npm run build"
}, },
"repository": { "repository": {

View File

@@ -7,6 +7,7 @@
/* eslint-disable */ /* eslint-disable */
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
import { FormatId } from "../misc/common.js"; import { FormatId } from "../misc/common.js";
import { TimeRange } from "./time_range.js";
export const protobufPackage = "video_streaming"; export const protobufPackage = "video_streaming";
@@ -25,7 +26,7 @@ export interface MediaHeader {
durationMs?: number | undefined; durationMs?: number | undefined;
formatId?: FormatId | undefined; formatId?: FormatId | undefined;
contentLength?: number | undefined; contentLength?: number | undefined;
timeRange?: MediaHeader_TimeRange | undefined; timeRange?: TimeRange | undefined;
} }
export enum MediaHeader_Compression { export enum MediaHeader_Compression {
@@ -67,12 +68,6 @@ export function mediaHeader_CompressionToJSON(object: MediaHeader_Compression):
} }
} }
export interface MediaHeader_TimeRange {
start?: number | undefined;
duration?: number | undefined;
timescale?: number | undefined;
}
function createBaseMediaHeader(): MediaHeader { function createBaseMediaHeader(): MediaHeader {
return { return {
headerId: undefined, headerId: undefined,
@@ -138,7 +133,7 @@ export const MediaHeader: MessageFns<MediaHeader> = {
writer.uint32(112).int64(message.contentLength); writer.uint32(112).int64(message.contentLength);
} }
if (message.timeRange !== undefined) { if (message.timeRange !== undefined) {
MediaHeader_TimeRange.encode(message.timeRange, writer.uint32(122).fork()).join(); TimeRange.encode(message.timeRange, writer.uint32(122).fork()).join();
} }
return writer; return writer;
}, },
@@ -253,7 +248,7 @@ export const MediaHeader: MessageFns<MediaHeader> = {
break; break;
} }
message.timeRange = MediaHeader_TimeRange.decode(reader, reader.uint32()); message.timeRange = TimeRange.decode(reader, reader.uint32());
continue; continue;
} }
if ((tag & 7) === 4 || tag === 0) { if ((tag & 7) === 4 || tag === 0) {
@@ -280,7 +275,7 @@ export const MediaHeader: MessageFns<MediaHeader> = {
durationMs: isSet(object.durationMs) ? globalThis.Number(object.durationMs) : undefined, durationMs: isSet(object.durationMs) ? globalThis.Number(object.durationMs) : undefined,
formatId: isSet(object.formatId) ? FormatId.fromJSON(object.formatId) : undefined, formatId: isSet(object.formatId) ? FormatId.fromJSON(object.formatId) : undefined,
contentLength: isSet(object.contentLength) ? globalThis.Number(object.contentLength) : undefined, contentLength: isSet(object.contentLength) ? globalThis.Number(object.contentLength) : undefined,
timeRange: isSet(object.timeRange) ? MediaHeader_TimeRange.fromJSON(object.timeRange) : undefined, timeRange: isSet(object.timeRange) ? TimeRange.fromJSON(object.timeRange) : undefined,
}; };
}, },
@@ -329,7 +324,7 @@ export const MediaHeader: MessageFns<MediaHeader> = {
obj.contentLength = Math.round(message.contentLength); obj.contentLength = Math.round(message.contentLength);
} }
if (message.timeRange !== undefined) { if (message.timeRange !== undefined) {
obj.timeRange = MediaHeader_TimeRange.toJSON(message.timeRange); obj.timeRange = TimeRange.toJSON(message.timeRange);
} }
return obj; return obj;
}, },
@@ -356,101 +351,12 @@ export const MediaHeader: MessageFns<MediaHeader> = {
: undefined; : undefined;
message.contentLength = object.contentLength ?? undefined; message.contentLength = object.contentLength ?? undefined;
message.timeRange = (object.timeRange !== undefined && object.timeRange !== null) message.timeRange = (object.timeRange !== undefined && object.timeRange !== null)
? MediaHeader_TimeRange.fromPartial(object.timeRange) ? TimeRange.fromPartial(object.timeRange)
: undefined; : undefined;
return message; return message;
}, },
}; };
function createBaseMediaHeader_TimeRange(): MediaHeader_TimeRange {
return { start: undefined, duration: undefined, timescale: undefined };
}
export const MediaHeader_TimeRange: MessageFns<MediaHeader_TimeRange> = {
encode(message: MediaHeader_TimeRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
if (message.start !== undefined) {
writer.uint32(8).int64(message.start);
}
if (message.duration !== undefined) {
writer.uint32(16).int64(message.duration);
}
if (message.timescale !== undefined) {
writer.uint32(24).int32(message.timescale);
}
return writer;
},
decode(input: BinaryReader | Uint8Array, length?: number): MediaHeader_TimeRange {
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseMediaHeader_TimeRange();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.start = longToNumber(reader.int64());
continue;
case 2:
if (tag !== 16) {
break;
}
message.duration = longToNumber(reader.int64());
continue;
case 3:
if (tag !== 24) {
break;
}
message.timescale = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skip(tag & 7);
}
return message;
},
fromJSON(object: any): MediaHeader_TimeRange {
return {
start: isSet(object.start) ? globalThis.Number(object.start) : undefined,
duration: isSet(object.duration) ? globalThis.Number(object.duration) : undefined,
timescale: isSet(object.timescale) ? globalThis.Number(object.timescale) : undefined,
};
},
toJSON(message: MediaHeader_TimeRange): unknown {
const obj: any = {};
if (message.start !== undefined) {
obj.start = Math.round(message.start);
}
if (message.duration !== undefined) {
obj.duration = Math.round(message.duration);
}
if (message.timescale !== undefined) {
obj.timescale = Math.round(message.timescale);
}
return obj;
},
create<I extends Exact<DeepPartial<MediaHeader_TimeRange>, I>>(base?: I): MediaHeader_TimeRange {
return MediaHeader_TimeRange.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<MediaHeader_TimeRange>, I>>(object: I): MediaHeader_TimeRange {
const message = createBaseMediaHeader_TimeRange();
message.start = object.start ?? undefined;
message.duration = object.duration ?? undefined;
message.timescale = object.timescale ?? undefined;
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
export type DeepPartial<T> = T extends Builtin ? T export type DeepPartial<T> = T extends Builtin ? T

View File

@@ -1,8 +1,8 @@
import type { FormatId } from '../../protos/generated/misc/common.js'; import type { FormatId } from '../../protos/generated/misc/common.js';
import type { MediaHeader_TimeRange } from '../../protos/generated/video_streaming/media_header.js';
import type { SabrError } from '../../protos/generated/video_streaming/sabr_error.js'; import type { SabrError } from '../../protos/generated/video_streaming/sabr_error.js';
import type { SabrRedirect } from '../../protos/generated/video_streaming/sabr_redirect.js'; import type { SabrRedirect } from '../../protos/generated/video_streaming/sabr_redirect.js';
import type { StreamProtectionStatus } from '../../protos/generated/video_streaming/stream_protection_status.js'; import type { StreamProtectionStatus } from '../../protos/generated/video_streaming/stream_protection_status.js';
import type { TimeRange } from '../../protos/generated/video_streaming/time_range.js';
import type { Zpa, MediaInfo } from '../../protos/generated/video_streaming/video_playback_abr_request.js'; import type { Zpa, MediaInfo } from '../../protos/generated/video_streaming/video_playback_abr_request.js';
import type { ChunkedDataBuffer } from '../core/index.js'; import type { ChunkedDataBuffer } from '../core/index.js';
@@ -36,7 +36,7 @@ export type Sequence = {
startDataRange?: number; startDataRange?: number;
sequenceNumber?: number; sequenceNumber?: number;
contentLength?: number; contentLength?: number;
timeRange?: MediaHeader_TimeRange; timeRange?: TimeRange;
} }
export type InitializedFormat = { export type InitializedFormat = {

View File

@@ -9,7 +9,7 @@
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */ /* Language and Environment */
"target": "ES2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ "target": "ES2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */ // "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */