Skip to content

Commit

Permalink
Merge branch 'main' of github.com:qualabs/common-media-library into f…
Browse files Browse the repository at this point in the history
…eature/add-unit-tests
  • Loading branch information
Felipe Young committed Feb 21, 2024
2 parents 2b10854 + 921ae5f commit b60dc5b
Show file tree
Hide file tree
Showing 37 changed files with 2,270 additions and 325 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
node-version: 20
cache: 'npm'
registry-url: "https://npm.pkg.github.com"
scope: "@cbsinteractive"
scope: "@svta"

- name: Install
run: npm ci
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/publish-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ on:
description: "An id to append to the version. Defaults to the current timestamp"
type: string
required: false

env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
PKG_VERSION: ""
BUILD_ID: ""

jobs:
publish:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v3
with:
Expand All @@ -39,20 +41,20 @@ jobs:

- name: Test
run: npm test

- name: Get Version
run: echo "version=`node -p "require('./package').version"`" >> $GITHUB_ENV
run: echo "PKG_VERSION=`node -p "require('./package').version"`" >> $GITHUB_ENV

- name: Get Time
if: github.event.inputs.id == ''
run: echo "id=`date +%s`" >> $GITHUB_ENV
run: echo "BUILD_ID=`date +%s`" >> $GITHUB_ENV

- name: Get ID
if: github.event.inputs.id != ''
run: echo "id=${{ github.event.inputs.id }}" >> $GITHUB_ENV
run: echo "BUILD_ID=${{ github.event.inputs.id }}" >> $GITHUB_ENV

- name: Generate Version
run: npm version ${{ env.version }}-${{ github.event.inputs.tag }}.${{ env.id }} --no-git-tag-version
run: npm version ${{ env.PKG_VERSION }}-${{ github.event.inputs.tag }}.${{ env.BUILD_ID }} --no-git-tag-version

- name: Publish Tag
run: npm run pub --tag ${{ github.event.inputs.tag }}
11 changes: 6 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ on:

env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
PKG_VERSION: ""

jobs:
publish:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v3
with:
Expand All @@ -35,7 +36,7 @@ jobs:
run: npm run pub

- name: Get Version
run: echo "version=`node -p "require('./package').version"`" >> $GITHUB_ENV
run: echo "PKG_VERSION=`node -p "require('./package').version"`" >> $GITHUB_ENV

- name: Create Release Notes
run: npm run notes
Expand All @@ -45,8 +46,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GH_ACTIONS }}
with:
tag_name: v${{ env.version }}
release_name: ${{ env.version }}
tag_name: v${{ env.PKG_VERSION }}
release_name: ${{ env.PKG_VERSION }}
commitish: main
body_path: ./RELEASE.md
draft: true
Expand Down
4 changes: 2 additions & 2 deletions dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
"url": "https://github.com/streaming-video-technology-alliance/common-media-library/issues"
},
"scripts": {
"start": "web-dev-server --node-resolve --open --watch"
"start": "wds --node-resolve --open --watch"
},
"devDependencies": {
"typedoc": "0.25.2"
"@web/dev-server": "0.4.2"
}
}
3 changes: 0 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,5 @@
"scripts": {
"build": "typedoc",
"start": "npm run build && npx -y http-server dist --cors -p 8080"
},
"devDependencies": {
"typedoc": "0.25.2"
}
}
1 change: 1 addition & 0 deletions docs/typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"entryPoints": [
"../lib/src/index.ts"
],
"excludeInternal": true,
"excludePrivate": true,
"hideGenerator": true,
"navigation": {
Expand Down
4 changes: 1 addition & 3 deletions lib/src/cmcd/CmcdCustomKey.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { CmCustomKey } from '../cta/CmCustomKey.js';

/**
* A custom key for CMCD. Custom keys MUST carry a hyphenated prefix
* to ensure that there will not be a namespace collision with future
Expand All @@ -10,4 +8,4 @@ import { CmCustomKey } from '../cta/CmCustomKey.js';
*
* @beta
*/
export type CmcdCustomKey = CmCustomKey;
export type CmcdCustomKey = `${string}-${string}`;
49 changes: 47 additions & 2 deletions lib/src/cmcd/CmcdObjectType.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,53 @@
/**
* Common Media Object Type
* Common Media Client Data Object Type
*
* @group CMCD
*
* @beta
*/
export { CmObjectType as CmcdObjectType } from '../cta/CmObjectType.js';
export enum CmcdObjectType {
/**
* text file, such as a manifest or playlist
*/
MANIFEST = 'm',

/**
* audio only
*/
AUDIO = 'a',

/**
* video only
*/
VIDEO = 'v',

/**
* muxed audio and video
*/
MUXED = 'av',

/**
* init segment
*/
INIT = 'i',

/**
* caption or subtitle
*/
CAPTION = 'c',

/**
* ISOBMFF timed text track
*/
TIMED_TEXT = 'tt',

/**
* cryptographic key, license or certificate.
*/
KEY = 'k',

/**
* other
*/
OTHER = 'o',
}
14 changes: 12 additions & 2 deletions lib/src/cmcd/CmcdStreamType.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
/**
* Common Media Streaming Type
* Common Media Client Data Stream Type
*
* @group CMCD
*
* @beta
*/
export { CmStreamType as CmcdStreamType } from '../cta/CmStreamType.js';
export enum CmcdStreamType {
/**
* All segments are available – e.g., VOD
*/
VOD = 'v',

/**
* Segments become available over time – e.g., LIVE
*/
LIVE = 'l',
}
25 changes: 23 additions & 2 deletions lib/src/cmcd/CmcdStreamingFormat.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
/**
* Common Media Streaming Format
* Common Media Client Data Streaming Format
*
* @group CMCD
*
* @beta
*/
export { CmStreamingFormat as CmcdStreamingFormat } from '../cta/CmStreamingFormat.js';
export enum CmcdStreamingFormat {
/**
* MPEG DASH
*/
DASH = 'd',

/**
* HTTP Live Streaming (HLS)
*/
HLS = 'h',

/**
* Smooth Streaming
*/
SMOOTH = 's',

/**
* Other
*/
OTHER = 'o',
}

7 changes: 5 additions & 2 deletions lib/src/cmcd/CmcdValue.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { CmValue } from '../cta/CmValue.js';
import type { SfToken } from '../structuredfield/SfToken';
import type { CmcdObjectType } from './CmcdObjectType';
import type { CmcdStreamType } from './CmcdStreamType';
import type { CmcdStreamingFormat } from './CmcdStreamingFormat';

/**
* CMCD Value
Expand All @@ -7,4 +10,4 @@ import { CmValue } from '../cta/CmValue.js';
*
* @beta
*/
export type CmcdValue = CmValue;
export type CmcdValue = CmcdObjectType | CmcdStreamingFormat | CmcdStreamType | string | number | boolean | symbol | SfToken;
2 changes: 1 addition & 1 deletion lib/src/cmcd/appendCmcdHeaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { toCmcdHeaders } from './toCmcdHeaders.js';
*
* @param headers - The headers to append to.
* @param cmcd - The CMCD object to append.
* @param customHeaderMap - A map of custom CMCD keys to header fields.
* @param options - Encode options.
*
* @returns The headers with the CMCD header shards appended.
*
Expand Down
4 changes: 1 addition & 3 deletions lib/src/cmsd/CmsdCustomKey.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { CmCustomKey } from '../cta/CmCustomKey.js';

/**
* A custom key for CMSD. Custom keys MUST carry a hyphenated prefix
* to ensure that there will not be a namespace collision with future
Expand All @@ -10,4 +8,4 @@ import { CmCustomKey } from '../cta/CmCustomKey.js';
*
* @beta
*/
export type CmsdCustomKey = CmCustomKey;
export type CmsdCustomKey = `${string}-${string}`;
51 changes: 47 additions & 4 deletions lib/src/cmsd/CmsdObjectType.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,53 @@
import { CmObjectType } from '../cta/CmObjectType.js';

/**
* Common Media Object Type
* Common Media Server Data Object Type
*
* @group CMSD
*
* @beta
*/
export { CmObjectType as CmsdObjectType };
export enum CmsdObjectType {
/**
* text file, such as a manifest or playlist
*/
MANIFEST = 'm',

/**
* audio only
*/
AUDIO = 'a',

/**
* video only
*/
VIDEO = 'v',

/**
* muxed audio and video
*/
MUXED = 'av',

/**
* init segment
*/
INIT = 'i',

/**
* caption or subtitle
*/
CAPTION = 'c',

/**
* ISOBMFF timed text track
*/
TIMED_TEXT = 'tt',

/**
* cryptographic key, license or certificate.
*/
KEY = 'k',

/**
* other
*/
OTHER = 'o',
}
15 changes: 13 additions & 2 deletions lib/src/cmsd/CmsdStreamType.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
/**
* Common Media Streaming Type
* Common Media Server Data Stream Type
*
* @group CMSD
*
* @beta
*/
export { CmStreamType as CmsdStreamType } from '../cta/CmStreamType.js';
export enum CmsdStreamType {
/**
* All segments are available – e.g., VOD
*/
VOD = 'v',

/**
* Segments become available over time – e.g., LIVE
*/
LIVE = 'l',
}

25 changes: 23 additions & 2 deletions lib/src/cmsd/CmsdStreamingFormat.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
/**
* Common Media Streaming Format
* Common Media Server Data Streaming Format
*
* @group CMSD
*
* @beta
*/
export { CmStreamingFormat as CmsdStreamingFormat } from '../cta/CmStreamingFormat.js';
export enum CmsdStreamingFormat {
/**
* MPEG DASH
*/
DASH = 'd',

/**
* HTTP Live Streaming (HLS)
*/
HLS = 'h',

/**
* Smooth Streaming
*/
SMOOTH = 's',

/**
* Other
*/
OTHER = 'o',
}

Loading

0 comments on commit b60dc5b

Please sign in to comment.