MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / emit

Function emit

packages/cli/src/commands/cloud/list.ts:110–144  ·  view source on GitHub ↗
(
  renders: HyperframesRenderDetail[],
  asJson: boolean,
  nextToken: string | null,
  hasMore: boolean,
)

Source from the content-addressed store, hash-verified

108
109// fallow-ignore-next-line complexity
110function emit(
111 renders: HyperframesRenderDetail[],
112 asJson: boolean,
113 nextToken: string | null,
114 hasMore: boolean,
115): void {
116 if (asJson) {
117 const payload: Record<string, unknown> = { renders, has_more: hasMore };
118 if (nextToken !== null) payload["next_token"] = nextToken;
119 console.log(JSON.stringify(withMeta(payload), null, 2));
120 return;
121 }
122 if (renders.length === 0) {
123 console.log(c.dim("No renders found."));
124 return;
125 }
126 const idWidth = Math.max(8, ...renders.map((r) => r.render_id.length));
127 const statusWidth = Math.max(6, ...renders.map((r) => r.status.length));
128 for (const r of renders) {
129 const id = c.accent(r.render_id);
130 const status = colorStatus(r.status);
131 const created =
132 r.created_at !== undefined && r.created_at !== null
133 ? new Date(r.created_at * 1000).toISOString()
134 : "—";
135 const title = r.title ? ` ${c.dim(r.title)}` : "";
136 console.log(
137 `${padEndVisible(id, idWidth)} ${padEndVisible(status, statusWidth)} ${c.dim(created)}${title}`,
138 );
139 }
140 if (nextToken) {
141 console.log("");
142 console.log(c.dim(`More results — pass --token ${nextToken} to continue.`));
143 }
144}

Callers 1

runFunction · 0.85

Calls 3

withMetaFunction · 0.85
colorStatusFunction · 0.85
padEndVisibleFunction · 0.85

Tested by

no test coverage detected