MCPcopy Index your code
hub / github.com/triggerdotdev/jsonhero-web / createFromRawJson

Function createFromRawJson

app/jsonDoc.server.ts:83–104  ·  view source on GitHub ↗
(
  filename: string,
  contents: string,
  options?: CreateJsonOptions
)

Source from the content-addressed store, hash-verified

81}
82
83export async function createFromRawJson(
84 filename: string,
85 contents: string,
86 options?: CreateJsonOptions
87): Promise<JSONDocument> {
88 const docId = createId();
89 const doc: JSONDocument = {
90 id: docId,
91 type: <const>"raw",
92 contents,
93 title: filename,
94 readOnly: options?.readOnly ?? false,
95 };
96
97 JSON.parse(contents);
98 await DOCUMENTS.put(docId, JSON.stringify(doc), {
99 expirationTtl: options?.ttl ?? undefined,
100 metadata: options?.metadata ?? undefined,
101 });
102
103 return doc;
104}
105
106export async function getDocument(
107 slug: string

Callers 6

loaderFunction · 0.90
actionFunction · 0.90
actionFunction · 0.90
createFromRawXmlFunction · 0.90
createFromUrlOrRawJsonFunction · 0.85
createFromUrlFunction · 0.85

Calls 1

createIdFunction · 0.85

Tested by

no test coverage detected