MCPcopy Index your code
hub / github.com/triggerdotdev/trigger.dev / parsePacket

Function parsePacket

packages/core/src/v3/utils/ioSerialization.ts:13–34  ·  view source on GitHub ↗
(value: IOPacket)

Source from the content-addressed store, hash-verified

11};
12
13export async function parsePacket(value: IOPacket): Promise<any> {
14 if (!value.data) {
15 return undefined;
16 }
17
18 switch (value.dataType) {
19 case "application/json":
20 return JSON.parse(value.data);
21 case "application/super+json":
22 const { parse } = await loadSuperJSON();
23
24 return parse(value.data);
25 case "text/plain":
26 return value.data;
27 case "application/store":
28 throw new Error(
29 `Cannot parse an application/store packet (${value.data}). Needs to be imported first.`
30 );
31 default:
32 return value.data;
33 }
34}
35
36export async function stringifyIO(value: any): Promise<IOPacket> {
37 if (value === undefined) {

Callers 5

executeMethod · 0.90
callMethod · 0.90
callMethod · 0.90

Calls 2

loadSuperJSONFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…