/* * THIS FILE WAS GENERATED BY "@atproto/lex". DO NOT EDIT. */ import { l } from "@atproto/lex"; import * as RepoStrongRef from "../../../com/atproto/repo/strongRef.defs.js"; const $nsid = "place.stream.media.viewCount"; export { $nsid }; /** A streamplace node's report of view counts for one place.stream.video over a closed time window. Published in the reporting node's server repo (not the streamer's), so a video served by multiple nodes accumulates multiple records — consumers are expected to sum across trusted reporters. The rkey is conventionally `-` so re-running the aggregator over the same window is idempotent. Counts represent the reporting node's best effort given the data it has; the `tracks` array carries the objective byte / duration totals it observed. */ type Main = { $type: "place.stream.media.viewCount"; /** * AT-URI of the place.stream.video this count is for. */ "video":l.AtUriString; /** * Number of distinct sessions the reporting node observed as a view over [windowStart, windowEnd). */ "count":number; /** * Inclusive lower bound of the aggregation window. */ "windowStart":l.DatetimeString; /** * Exclusive upper bound of the aggregation window. */ "windowEnd":l.DatetimeString; /** * Per-track totals of bytes + playback duration the reporting node served over the window. Each entry references the place.stream.media.track record whose bytes were transferred, so user-contributed tracks (transcripts, transcodes published by other accounts) attribute naturally to their own records. */ "tracks"?:(TrackUsage)[]; /** * When the reporting node ran this aggregation. Useful for ordering successive reports. */ "indexedAt":l.DatetimeString }; export type { Main }; /** A streamplace node's report of view counts for one place.stream.video over a closed time window. Published in the reporting node's server repo (not the streamer's), so a video served by multiple nodes accumulates multiple records — consumers are expected to sum across trusted reporters. The rkey is conventionally `-` so re-running the aggregator over the same window is idempotent. Counts represent the reporting node's best effort given the data it has; the `tracks` array carries the objective byte / duration totals it observed. */ const main = /*#__PURE__*/ l.record<"any", Main>("any", $nsid, /*#__PURE__*/ l.object({"video":/*#__PURE__*/ l.string({"format":"at-uri"}),"count":/*#__PURE__*/ l.integer({"minimum":0}),"windowStart":/*#__PURE__*/ l.string({"format":"datetime"}),"windowEnd":/*#__PURE__*/ l.string({"format":"datetime"}),"tracks":/*#__PURE__*/ l.optional(/*#__PURE__*/ l.array(/*#__PURE__*/ l.ref((() => trackUsage) as any), )),"indexedAt":/*#__PURE__*/ l.string({"format":"datetime"})})); export { main }; export const $type = $nsid; export const $isTypeOf = /*#__PURE__*/ main.isTypeOf.bind(main); export const $build = /*#__PURE__*/ main.build.bind(main); export const $assert = /*#__PURE__*/ main.assert.bind(main); export const $check = /*#__PURE__*/ main.check.bind(main); export const $cast = /*#__PURE__*/ main.cast.bind(main); export const $ifMatches = /*#__PURE__*/ main.ifMatches.bind(main); export const $matches = /*#__PURE__*/ main.matches.bind(main); export const $parse = /*#__PURE__*/ main.parse.bind(main); export const $safeParse = /*#__PURE__*/ main.safeParse.bind(main); export const $validate = /*#__PURE__*/ main.validate.bind(main); export const $safeValidate = /*#__PURE__*/ main.safeValidate.bind(main); /** One row of the tracks array: bytes + duration transferred for a single place.stream.media.track record over the window. */ type TrackUsage = { $type?: "place.stream.media.viewCount#trackUsage"; /** * Strong reference to the place.stream.media.track record whose bytes were transferred. */ "track":RepoStrongRef.Main; /** * Total bytes served from this track over the window. Sum across attributed segment_requests' Range intersections with the track's segment offsets in the metafile. */ "bytes":number; /** * Total playback duration served from this track, in milliseconds. Per HLS segment in the range: (overlap bytes / segment bytes) * segment duration, so partial-segment fetches credit a proportional share of duration. */ "durationMs":number }; export type { TrackUsage }; /** One row of the tracks array: bytes + duration transferred for a single place.stream.media.track record over the window. */ const trackUsage = /*#__PURE__*/ l.typedObject($nsid, "trackUsage", /*#__PURE__*/ l.object({"track":/*#__PURE__*/ l.ref((() => RepoStrongRef.main) as any),"bytes":/*#__PURE__*/ l.integer({"minimum":0}),"durationMs":/*#__PURE__*/ l.integer({"minimum":0})})); export { trackUsage };