@@ -16,9 +16,10 @@ import {
1616	RECORDS_PER_PAGE , 
1717}  from  "./default-data-provider" ; 
1818
19+ const  mightRequireAuth  =  __APP_TYPE__  ===  "engine" ; 
20+ 
1921export  type  CreateNamespace  =  { 
2022	displayName : string ; 
21- 	name ?: string ; 
2223} ; 
2324
2425export  type  Namespace  =  { 
@@ -30,7 +31,7 @@ export type Namespace = {
3031
3132export  function  createClient ( 
3233	baseUrl  =  engineEnv ( ) . VITE_APP_API_URL , 
33- 	opts : {  token : ( ( )  =>  string )  |  string  } , 
34+ 	opts : {  token : ( ( )  =>  string )  |  string  |   ( ( )   =>   Promise < string > )   } , 
3435)  { 
3536	return  new  RivetClient ( { 
3637		baseUrl : ( )  =>  baseUrl , 
@@ -87,7 +88,7 @@ export const createGlobalContext = (opts: {
8788				mutationFn : async  ( data : CreateNamespace )  =>  { 
8889					const  response  =  await  client . namespaces . create ( { 
8990						displayName : data . displayName , 
90- 						name : data . name   ||   convertStringToId ( data . displayName ) , 
91+ 						name : convertStringToId ( data . displayName ) , 
9192					} ) ; 
9293
9394					return  { 
@@ -132,7 +133,7 @@ export const createNamespaceContext = ({
132133				retry : shouldRetryAllExpect403 , 
133134				throwOnError : noThrow , 
134135				meta : { 
135- 					mightRequireAuth :  true , 
136+ 					mightRequireAuth, 
136137				} , 
137138			} ) ; 
138139		} , 
@@ -157,7 +158,7 @@ export const createNamespaceContext = ({
157158				retry : shouldRetryAllExpect403 , 
158159				throwOnError : noThrow , 
159160				meta : { 
160- 					mightRequireAuth :  true , 
161+ 					mightRequireAuth, 
161162				} , 
162163			} ) ; 
163164		} , 
@@ -186,7 +187,7 @@ export const createNamespaceContext = ({
186187				retry : shouldRetryAllExpect403 , 
187188				throwOnError : noThrow , 
188189				meta : { 
189- 					mightRequireAuth :  true , 
190+ 					mightRequireAuth, 
190191				} , 
191192			} ) ; 
192193		} , 
@@ -213,7 +214,7 @@ export const createNamespaceContext = ({
213214				retry : shouldRetryAllExpect403 , 
214215				throwOnError : noThrow , 
215216				meta : { 
216- 					mightRequireAuth :  true , 
217+ 					mightRequireAuth, 
217218				} , 
218219			} ) ; 
219220		} , 
@@ -288,7 +289,7 @@ export const createNamespaceContext = ({
288289				retry : shouldRetryAllExpect403 , 
289290				throwOnError : noThrow , 
290291				meta : { 
291- 					mightRequireAuth :  true , 
292+ 					mightRequireAuth, 
292293				} , 
293294			} ) ; 
294295		} , 
@@ -329,7 +330,7 @@ export const createNamespaceContext = ({
329330				retry : shouldRetryAllExpect403 , 
330331				throwOnError : noThrow , 
331332				meta : { 
332- 					mightRequireAuth :  true , 
333+ 					mightRequireAuth, 
333334				} , 
334335			} ) ; 
335336		} , 
@@ -353,7 +354,7 @@ export const createNamespaceContext = ({
353354				throwOnError : noThrow , 
354355				retry : shouldRetryAllExpect403 , 
355356				meta : { 
356- 					mightRequireAuth :  true , 
357+ 					mightRequireAuth, 
357358				} , 
358359			} ; 
359360		} , 
@@ -363,7 +364,7 @@ export const createNamespaceContext = ({
363364				throwOnError : noThrow , 
364365				retry : shouldRetryAllExpect403 , 
365366				meta : { 
366- 					mightRequireAuth :  true , 
367+ 					mightRequireAuth, 
367368				} , 
368369				mutationFn : async  ( )  =>  { 
369370					await  client . actorsDelete ( actorId ) ; 
@@ -374,14 +375,14 @@ export const createNamespaceContext = ({
374375
375376	return  { 
376377		...dataProvider , 
377- 		runnersQueryOptions ( opts :  {   namespace :  string   } )  { 
378+ 		runnersQueryOptions ( )  { 
378379			return  infiniteQueryOptions ( { 
379- 				queryKey : [ opts . namespace ,  "runners" ] , 
380+ 				queryKey : [ {   namespace  } ,  "runners" ] , 
380381				initialPageParam : undefined  as  string  |  undefined , 
381382				queryFn : async  ( {  pageParam,  signal : abortSignal  } )  =>  { 
382383					const  data  =  await  client . runners . list ( 
383384						{ 
384- 							namespace :  opts . namespace , 
385+ 							namespace, 
385386							cursor : pageParam  ??  undefined , 
386387							limit : RECORDS_PER_PAGE , 
387388						} , 
@@ -398,7 +399,7 @@ export const createNamespaceContext = ({
398399				select : ( data )  =>  data . pages . flatMap ( ( page )  =>  page . runners ) , 
399400				retry : shouldRetryAllExpect403 , 
400401				meta : { 
401- 					mightRequireAuth :  true , 
402+ 					mightRequireAuth, 
402403				} , 
403404			} ) ; 
404405		} , 
@@ -429,7 +430,7 @@ export const createNamespaceContext = ({
429430				retry : shouldRetryAllExpect403 , 
430431				throwOnError : noThrow , 
431432				meta : { 
432- 					mightRequireAuth :  true , 
433+ 					mightRequireAuth, 
433434				} , 
434435			} ) ; 
435436		} , 
@@ -456,7 +457,7 @@ export const createNamespaceContext = ({
456457				throwOnError : noThrow , 
457458				retry : shouldRetryAllExpect403 , 
458459				meta : { 
459- 					mightRequireAuth :  true , 
460+ 					mightRequireAuth, 
460461				} , 
461462			} ) ; 
462463		} , 
@@ -481,7 +482,7 @@ export const createNamespaceContext = ({
481482				} , 
482483				retry : shouldRetryAllExpect403 , 
483484				meta : { 
484- 					mightRequireAuth :  true , 
485+ 					mightRequireAuth, 
485486				} , 
486487			} ) ; 
487488		} , 
@@ -506,6 +507,10 @@ export const createNamespaceContext = ({
506507					} ) ; 
507508					return  response ; 
508509				} , 
510+ 				retry : shouldRetryAllExpect403 , 
511+ 				meta : { 
512+ 					mightRequireAuth, 
513+ 				} , 
509514			} ; 
510515		} , 
511516		runnerConfigsQueryOptions ( )  { 
@@ -538,6 +543,12 @@ export const createNamespaceContext = ({
538543					} 
539544					return  lastPage . pagination . cursor ; 
540545				} , 
546+ 
547+ 				retryDelay : 50_000 , 
548+ 				retry : shouldRetryAllExpect403 , 
549+ 				meta : { 
550+ 					mightRequireAuth, 
551+ 				} , 
541552			} ) ; 
542553		} , 
543554	} ; 
0 commit comments