@@ -366,6 +366,7 @@ This wrapper simplifies proxy session management. It takes:
366366
367367- The path to your Wrangler config, or an object with remote bindings.
368368- The current proxy session details (this parameter can be set to ` null ` or not being provided if none).
369+ - Potentially the auth data to use for the remote proxy session.
369370
370371It returns an object with the proxy session details if started or updated, or ` null ` if no proxy session is needed.
371372
@@ -388,42 +389,37 @@ import { experimental_maybeStartOrUpdateRemoteProxySession } from "wrangler";
388389
389390let mf: Miniflare | null ;
390391
391- let remoteProxySessionDetails: Awaited <
392- ReturnType <typeof experimental_maybeStartOrUpdateRemoteProxySession >
393-
394- > | null = null ;
392+ let remoteProxySessionDetails: Awaited <ReturnType <typeof experimental_maybeStartOrUpdateRemoteProxySession >> | null = null ;
395393
396394async function startOrUpdateDevSession() {
397- remoteProxySessionDetails =
398- await experimental_maybeStartOrUpdateRemoteProxySession (
399- {
400- bindings: {
401- MY_KV: {
402- type: ' kv_namespace' ,
403- id: ' kv-id' ,
404- experimental_remote: true ,
405- }
406- }
407- },
408- remoteProxySessionDetails
409- );
410-
411- const miniflareOptions: MiniflareOptions = {
412- scriptPath: " ./worker.js" ,
413- kvNamespaces: {
414- MY_KV: {
415- id: " kv-id" ,
416- remoteProxyConnectionString:
417- remoteProxySessionDetails ?.session .remoteProxyConnectionString ,
418- },
419- },
420- };
421-
422- if (! mf ) {
423- mf = new Miniflare (miniflareOptions );
424- } else {
425- mf .setOptions (miniflareOptions );
426- }
395+ remoteProxySessionDetails = await experimental_maybeStartOrUpdateRemoteProxySession ({
396+ bindings: {
397+ MY_KV: {
398+ type: ' kv_namespace' ,
399+ id: ' kv-id' ,
400+ experimental_remote: true ,
401+ }
402+ }
403+ },
404+ remoteProxySessionDetails
405+ );
406+
407+ const miniflareOptions: MiniflareOptions = {
408+ scriptPath: " ./worker.js" ,
409+ kvNamespaces: {
410+ MY_KV: {
411+ id: " kv-id" ,
412+ remoteProxyConnectionString:
413+ remoteProxySessionDetails ?.session .remoteProxyConnectionString ,
414+ },
415+ },
416+ };
417+
418+ if (! mf ) {
419+ mf = new Miniflare (miniflareOptions );
420+ } else {
421+ mf .setOptions (miniflareOptions );
422+ }
427423}
428424
429425// ... tool logic that invokes `startOrUpdateDevSession()` ...
0 commit comments