@blockcast/mmt-base 2.2.0-main.7c8c15c3547c → 2.2.0-main.81661a8bce1d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ export interface EventTimelineTrack {
2
+ readonly name: string;
3
+ readonly namespace?: string;
4
+ readonly eventType: string;
5
+ /** Tracks whose timeline the records index; [] when the track declares none (msf-02 8.3). */
6
+ readonly depends: readonly string[];
7
+ }
8
+ export type EventTimelineTrackIssueCode = 'track_event_type' | 'track_event_mime_type' | 'track_event_depends';
9
+ export interface EventTimelineTrackIssue {
10
+ readonly code: EventTimelineTrackIssueCode;
11
+ readonly path: string;
12
+ readonly name: string;
13
+ readonly index: number;
14
+ }
15
+ /** Tracks of packaging "eventtimeline", only those of `eventTypes` when given. `issues` names every
16
+ * eventtimeline track a consumer must skip, whatever its eventType. */
17
+ export declare function catalogEventTimelineTracks(catalog: unknown, eventTypes?: readonly string[]): {
18
+ tracks: EventTimelineTrack[];
19
+ issues: EventTimelineTrackIssue[];
20
+ };
21
+ //# sourceMappingURL=event-timeline-catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-timeline-catalog.d.ts","sourceRoot":"","sources":["../src/event-timeline-catalog.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,6FAA6F;IAC7F,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CACpC;AACD,MAAM,MAAM,2BAA2B,GAAG,kBAAkB,GAAG,uBAAuB,GAAG,qBAAqB,CAAA;AAC9G,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,2BAA2B,CAAA;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAOD;wEACwE;AACxE,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG;IAC5F,MAAM,EAAE,kBAAkB,EAAE,CAAA;IAC5B,MAAM,EAAE,uBAAuB,EAAE,CAAA;CAClC,CA+BA"}
@@ -0,0 +1,45 @@
1
+ // The Event Timeline tracks of an MSF catalog (draft-ietf-moq-msf-02 8.3), read once for every
2
+ // consumer: the container's ad-creative receiver, the transport's join selection, the players.
3
+ // Track-level, like mmtpTrackIssues: a bad entry costs that track, never the catalog.
4
+ /** draft-riedl-moq-ad-creative-signaling-01 3, R3: this type always indexes a media timeline. */
5
+ const RIEDL_AD_CREATIVE = 'urn:svta:advertising-wg:ad-creative-signaling';
6
+ const isObject = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
7
+ /** Tracks of packaging "eventtimeline", only those of `eventTypes` when given. `issues` names every
8
+ * eventtimeline track a consumer must skip, whatever its eventType. */
9
+ export function catalogEventTimelineTracks(catalog, eventTypes) {
10
+ const tracks = [];
11
+ const issues = [];
12
+ const list = isObject(catalog) && Array.isArray(catalog['tracks']) ? catalog['tracks'] : [];
13
+ // msf-02 5.2.15 (msf-01 5.2.14): a depends name resolves in the namespace of the track that declares it.
14
+ const named = new Set(list.filter(isObject).map((t) => `${String(t['namespace'] ?? '')}\u0000${String(t['name'])}`));
15
+ list.forEach((t, index) => {
16
+ if (!isObject(t) || t['packaging'] !== 'eventtimeline' || typeof t['name'] !== 'string')
17
+ return;
18
+ const name = t['name'];
19
+ const issue = (code, field) => {
20
+ issues.push({ code, path: `$.tracks[${index}].${field}`, name, index });
21
+ };
22
+ const eventType = t['eventType'];
23
+ if (typeof eventType !== 'string' || eventType.length === 0)
24
+ return issue('track_event_type', 'eventType');
25
+ // msf-01 8.2 requires application/json, msf-02 8.3 drops the requirement: only another value rejects.
26
+ if (t['mimeType'] !== undefined && t['mimeType'] !== 'application/json')
27
+ return issue('track_event_mime_type', 'mimeType');
28
+ const namespace = String(t['namespace'] ?? '');
29
+ // riedl 3 (R3): the ad-creative type indexes a media timeline, so depends is required and non-empty.
30
+ // msf-02 8.3: any other type needs depends only when its index refers to a media timeline, which the
31
+ // catalog does not state, so an absent depends is accepted; a present one must resolve (msf-02 5.2.15).
32
+ // shortcut: renderGroup (Number) entries are rejected, as the schema does; accept them when a publisher emits one.
33
+ const depends = t['depends'] ?? [];
34
+ if (!Array.isArray(depends) || (eventType === RIEDL_AD_CREATIVE && depends.length === 0) ||
35
+ !depends.every((d) => typeof d === 'string' && d !== name && named.has(`${namespace}\u0000${d}`))) {
36
+ return issue('track_event_depends', 'depends');
37
+ }
38
+ if (eventTypes !== undefined && !eventTypes.includes(eventType))
39
+ return;
40
+ const ns = t['namespace'];
41
+ tracks.push({ name, ...(typeof ns === 'string' ? { namespace: ns } : {}), eventType, depends: depends });
42
+ });
43
+ return { tracks, issues };
44
+ }
45
+ //# sourceMappingURL=event-timeline-catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-timeline-catalog.js","sourceRoot":"","sources":["../src/event-timeline-catalog.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,+FAA+F;AAC/F,sFAAsF;AAiBtF,iGAAiG;AACjG,MAAM,iBAAiB,GAAG,+CAA+C,CAAA;AAEzE,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAgC,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AAEvH;wEACwE;AACxE,MAAM,UAAU,0BAA0B,CAAC,OAAgB,EAAE,UAA8B;IAIzF,MAAM,MAAM,GAAyB,EAAE,CAAA;IACvC,MAAM,MAAM,GAA8B,EAAE,CAAA;IAC5C,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AAO,KAAK,CAAC,uBAAuB,EAAE,UAAU,CAAC,CAAA;QAC1H,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAA;QAC9C,qGAAqG;QACrG,qGAAqG;QACrG,wGAAwG;QACxG,mHAAmH;QACnH,MAAM,OAAO,GAAG,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,CAAA;QAClC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,KAAK,iBAAiB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC;YACtF,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,SAAS,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YACpG,OAAO,KAAK,CAAC,qBAAqB,EAAE,SAAS,CAAC,CAAA;QAChD,CAAC;QACD,IAAI,UAAU,KAAK,SAAS,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC;YAAE,OAAM;QACvE,MAAM,EAAE,GAAG,CAAC,CAAC,WAAW,CAAC,CAAA;QACzB,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,OAAmB,EAAE,CAAC,CAAA;IACtH,CAAC,CAAC,CAAA;IACF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AAC3B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -10,4 +10,5 @@ export * from './fec-catalog.js';
10
10
  export * from './fec-bindings.js';
11
11
  export * from './mmtp-siblings.js';
12
12
  export * from './datagram-leg-size.js';
13
+ export * from './event-timeline-catalog.js';
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA"}
package/dist/index.js CHANGED
@@ -10,4 +10,5 @@ export * from './fec-catalog.js';
10
10
  export * from './fec-bindings.js';
11
11
  export * from './mmtp-siblings.js';
12
12
  export * from './datagram-leg-size.js';
13
+ export * from './event-timeline-catalog.js';
13
14
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockcast/mmt-base",
3
- "version": "2.2.0-main.7c8c15c3547c",
3
+ "version": "2.2.0-main.81661a8bce1d",
4
4
  "description": "Shared MMTP parsing primitives and protocol constants (zero FEC dependency). Hosts MMTP_HEADER_SIZE, parseMMTPHeader, extractMFUPayload and friends, plus wire constants such as DEFAULT_AMT_RELAY_PORT, so @blockcast/mmt-fec, @blockcast/mmt-container and @blockcast/mmt-transport can share one definition without a circular dep.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,61 @@
1
+ // The Event Timeline tracks of an MSF catalog (draft-ietf-moq-msf-02 8.3), read once for every
2
+ // consumer: the container's ad-creative receiver, the transport's join selection, the players.
3
+ // Track-level, like mmtpTrackIssues: a bad entry costs that track, never the catalog.
4
+
5
+ export interface EventTimelineTrack {
6
+ readonly name: string
7
+ readonly namespace?: string
8
+ readonly eventType: string
9
+ /** Tracks whose timeline the records index; [] when the track declares none (msf-02 8.3). */
10
+ readonly depends: readonly string[]
11
+ }
12
+ export type EventTimelineTrackIssueCode = 'track_event_type' | 'track_event_mime_type' | 'track_event_depends'
13
+ export interface EventTimelineTrackIssue {
14
+ readonly code: EventTimelineTrackIssueCode
15
+ readonly path: string
16
+ readonly name: string
17
+ readonly index: number
18
+ }
19
+
20
+ /** draft-riedl-moq-ad-creative-signaling-01 3, R3: this type always indexes a media timeline. */
21
+ const RIEDL_AD_CREATIVE = 'urn:svta:advertising-wg:ad-creative-signaling'
22
+
23
+ const isObject = (v: unknown): v is Record<string, unknown> => typeof v === 'object' && v !== null && !Array.isArray(v)
24
+
25
+ /** Tracks of packaging "eventtimeline", only those of `eventTypes` when given. `issues` names every
26
+ * eventtimeline track a consumer must skip, whatever its eventType. */
27
+ export function catalogEventTimelineTracks(catalog: unknown, eventTypes?: readonly string[]): {
28
+ tracks: EventTimelineTrack[]
29
+ issues: EventTimelineTrackIssue[]
30
+ } {
31
+ const tracks: EventTimelineTrack[] = []
32
+ const issues: EventTimelineTrackIssue[] = []
33
+ const list: unknown[] = isObject(catalog) && Array.isArray(catalog['tracks']) ? catalog['tracks'] : []
34
+ // msf-02 5.2.15 (msf-01 5.2.14): a depends name resolves in the namespace of the track that declares it.
35
+ const named = new Set(list.filter(isObject).map((t) => `${String(t['namespace'] ?? '')}\u0000${String(t['name'])}`))
36
+ list.forEach((t, index) => {
37
+ if (!isObject(t) || t['packaging'] !== 'eventtimeline' || typeof t['name'] !== 'string') return
38
+ const name = t['name']
39
+ const issue = (code: EventTimelineTrackIssueCode, field: string): void => {
40
+ issues.push({ code, path: `$.tracks[${index}].${field}`, name, index })
41
+ }
42
+ const eventType = t['eventType']
43
+ if (typeof eventType !== 'string' || eventType.length === 0) return issue('track_event_type', 'eventType')
44
+ // msf-01 8.2 requires application/json, msf-02 8.3 drops the requirement: only another value rejects.
45
+ if (t['mimeType'] !== undefined && t['mimeType'] !== 'application/json') return issue('track_event_mime_type', 'mimeType')
46
+ const namespace = String(t['namespace'] ?? '')
47
+ // riedl 3 (R3): the ad-creative type indexes a media timeline, so depends is required and non-empty.
48
+ // msf-02 8.3: any other type needs depends only when its index refers to a media timeline, which the
49
+ // catalog does not state, so an absent depends is accepted; a present one must resolve (msf-02 5.2.15).
50
+ // shortcut: renderGroup (Number) entries are rejected, as the schema does; accept them when a publisher emits one.
51
+ const depends = t['depends'] ?? []
52
+ if (!Array.isArray(depends) || (eventType === RIEDL_AD_CREATIVE && depends.length === 0) ||
53
+ !depends.every((d) => typeof d === 'string' && d !== name && named.has(`${namespace}\u0000${d}`))) {
54
+ return issue('track_event_depends', 'depends')
55
+ }
56
+ if (eventTypes !== undefined && !eventTypes.includes(eventType)) return
57
+ const ns = t['namespace']
58
+ tracks.push({ name, ...(typeof ns === 'string' ? { namespace: ns } : {}), eventType, depends: depends as string[] })
59
+ })
60
+ return { tracks, issues }
61
+ }
package/src/index.ts CHANGED
@@ -10,3 +10,4 @@ export * from './fec-catalog.js'
10
10
  export * from './fec-bindings.js'
11
11
  export * from './mmtp-siblings.js'
12
12
  export * from './datagram-leg-size.js'
13
+ export * from './event-timeline-catalog.js'