MCPcopy
hub / github.com/partykit/partykit / fetch

Function fetch

packages/partykit/facade/source.ts:153–182  ·  view source on GitHub ↗
(
                pathOrInit?: string | RequestInit | Request,
                maybeInit?: RequestInit | Request
              )

Source from the content-addressed store, hash-verified

151 const stub = value.get(id);
152 return {
153 fetch(
154 pathOrInit?: string | RequestInit | Request,
155 maybeInit?: RequestInit | Request
156 ) {
157 let path: RequestInfo | undefined;
158 let init: RequestInit | Request | undefined;
159 if (pathOrInit) {
160 if (typeof pathOrInit === "string") {
161 path = pathOrInit;
162 init = maybeInit;
163 if (path[0] !== "/") {
164 throw new Error("Path must start with /");
165 }
166 return stub.fetch(
167 `http://${options.host}/parties/${key}/${name}${path}`,
168 init
169 );
170 } else {
171 init = pathOrInit;
172 return stub.fetch(
173 `http://${options.host}/parties/${key}/${name}`,
174 init
175 );
176 }
177 } else {
178 return stub.fetch(
179 `http://${options.host}/parties/${key}/${name}`
180 );
181 }
182 },
183 connect: () => {
184 return new WebSocket(
185 `ws://${options.host}/parties/${key}/${name}`

Callers 15

getYDocFunction · 0.85
fetchStaticAssetFunction · 0.85
fetchResultFunction · 0.85
serverReloadedListenerFunction · 0.85
fetchResultFunction · 0.85
initFunction · 0.85
signInWithGitHubFunction · 0.85
dev.test.tsxFile · 0.85
logoutFunction · 0.85
fetchAuthTokenFunction · 0.85
runHandshakeFunction · 0.85
eioPollFunction · 0.85

Calls 15

createMultiPartiesFunction · 0.85
isClassWorkerFunction · 0.85
extractVarsFunction · 0.85
assetsFetchFunction · 0.85
getBindingsFunction · 0.85
fetchStaticAssetFunction · 0.85
onCronFunction · 0.85
onBeforeConnectMethod · 0.80
onBeforeRequestMethod · 0.80
assertFunction · 0.70
getMethod · 0.65

Tested by 3

runHandshakeFunction · 0.68
eioPollFunction · 0.68
eioPushFunction · 0.68