@@ -364,7 +364,9 @@ This type conversion is temporary. In the future, the types will be unified so y
364364
365365This wrapper simplifies proxy session management. It takes:
366366
367- - The path to your Wrangler config, or an object with remote bindings.
367+ - An object that either contains
368+ - the path to a Wrangler config and a potential target environment
369+ - the name of the Worker and the bindings it is using
368370- The current proxy session details (this parameter can be set to ` null ` or not being provided if none).
369371- Potentially the auth data to use for the remote proxy session.
370372
@@ -392,34 +394,34 @@ let mf: Miniflare | null;
392394let remoteProxySessionDetails: Awaited <ReturnType <typeof experimental_maybeStartOrUpdateRemoteProxySession >> | null = null ;
393395
394396async function startOrUpdateDevSession() {
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- }
397+ remoteProxySessionDetails = await experimental_maybeStartOrUpdateRemoteProxySession ({
398+ bindings: {
399+ MY_KV: {
400+ type: ' kv_namespace' ,
401+ id: ' kv-id' ,
402+ experimental_remote: true ,
403+ }
404+ }
405+ },
406+ remoteProxySessionDetails
407+ );
408+
409+ const miniflareOptions: MiniflareOptions = {
410+ scriptPath: " ./worker.js" ,
411+ kvNamespaces: {
412+ MY_KV: {
413+ id: " kv-id" ,
414+ remoteProxyConnectionString:
415+ remoteProxySessionDetails ?.session .remoteProxyConnectionString ,
416+ },
417+ },
418+ };
419+
420+ if (! mf ) {
421+ mf = new Miniflare (miniflareOptions );
422+ } else {
423+ mf .setOptions (miniflareOptions );
424+ }
423425}
424426
425427// ... tool logic that invokes `startOrUpdateDevSession()` ...
0 commit comments