MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / cf

Function cf

apps/host-cloudflare/scripts/preview.ts:59–74  ·  view source on GitHub ↗
(method: string, path: string, body?: unknown)

Source from the content-addressed store, hash-verified

57}
58
59const cf = async (method: string, path: string, body?: unknown): Promise<CfFetchResult> => {
60 const response = await fetch(`${CF_API}${path}`, {
61 method,
62 headers: {
63 authorization: `Bearer ${TOKEN}`,
64 "content-type": "application/json",
65 },
66 body: body === undefined ? undefined : JSON.stringify(body),
67 });
68 const json: any = await response.json().catch(() => ({ success: false, errors: [] }));
69 return {
70 ok: json.success === true,
71 errors: JSON.stringify(json.errors ?? []),
72 result: json.result,
73 };
74};
75
76const cfOk = async (method: string, path: string, body?: unknown): Promise<any> => {
77 const response = await cf(method, path, body);

Callers 3

cfOkFunction · 0.85
ensureSharedBucketFunction · 0.85
destroyFunction · 0.85

Calls 2

jsonMethod · 0.65
fetchFunction · 0.50

Tested by

no test coverage detected