@@ -52,7 +52,7 @@ interface QueueSenderOptions {
5252 customFetch : ( request : Request ) => Promise < Response > ;
5353}
5454
55- export function createQueueSender ( options : QueueSenderOptions ) : QueueSender {
55+ export function createQueueSender ( senderOptions : QueueSenderOptions ) : QueueSender {
5656 return {
5757 async send (
5858 name : string ,
@@ -75,18 +75,18 @@ export function createQueueSender(options: QueueSenderOptions): QueueSender {
7575 url : `http://actor/queue/${ encodeURIComponent ( name ) } ` ,
7676 method : "POST" ,
7777 headers : {
78- [ HEADER_ENCODING ] : options . encoding ,
79- ...( options . params !== undefined
78+ [ HEADER_ENCODING ] : senderOptions . encoding ,
79+ ...( senderOptions . params !== undefined
8080 ? {
8181 [ HEADER_CONN_PARAMS ] : JSON . stringify (
82- options . params ,
82+ senderOptions . params ,
8383 ) ,
8484 }
8585 : { } ) ,
8686 } ,
8787 body : { body, wait, timeout } ,
88- encoding : options . encoding ,
89- customFetch : options . customFetch ,
88+ encoding : senderOptions . encoding ,
89+ customFetch : senderOptions . customFetch ,
9090 signal : normalizedOptions ?. signal ,
9191 requestVersion : CLIENT_PROTOCOL_CURRENT_VERSION ,
9292 requestVersionedDataHandler : HTTP_QUEUE_SEND_REQUEST_VERSIONED ,
@@ -103,23 +103,23 @@ export function createQueueSender(options: QueueSenderOptions): QueueSender {
103103 name : value . name ?? name ,
104104 body : bufferToArrayBuffer ( cbor . encode ( value . body ) ) ,
105105 wait : value . wait ?? false ,
106- timeout : value . timeout ?? null ,
106+ timeout : value . timeout !== undefined ? BigInt ( value . timeout ) : null ,
107107 } ) ,
108108 responseFromJson : ( json ) : QueueSendResult => {
109109 if ( json . response === undefined ) {
110- return { status : json . status } ;
110+ return { status : json . status as "completed" | "timedOut" } ;
111111 }
112112 return {
113- status : json . status ,
113+ status : json . status as "completed" | "timedOut" ,
114114 response : json . response ,
115115 } ;
116116 } ,
117117 responseFromBare : ( bare ) : QueueSendResult => {
118118 if ( bare . response === null || bare . response === undefined ) {
119- return { status : bare . status } ;
119+ return { status : bare . status as "completed" | "timedOut" } ;
120120 }
121121 return {
122- status : bare . status ,
122+ status : bare . status as "completed" | "timedOut" ,
123123 response : cbor . decode ( new Uint8Array ( bare . response ) ) ,
124124 } ;
125125 } ,
0 commit comments