@@ -140,6 +140,7 @@ export namespace Permission {
140140 export const layer = Layer . effect (
141141 Service ,
142142 Effect . gen ( function * ( ) {
143+ const bus = yield * Bus . Service
143144 const state = yield * InstanceState . make < State > (
144145 Effect . fn ( "Permission.state" ) ( function * ( ctx ) {
145146 const row = Database . use ( ( db ) =>
@@ -191,7 +192,7 @@ export namespace Permission {
191192
192193 const deferred = yield * Deferred . make < void , RejectedError | CorrectedError > ( )
193194 pending . set ( id , { info, deferred } )
194- void Bus . publish ( Event . Asked , info )
195+ yield * bus . publish ( Event . Asked , info )
195196 return yield * Effect . ensuring (
196197 Deferred . await ( deferred ) ,
197198 Effect . sync ( ( ) => {
@@ -206,7 +207,7 @@ export namespace Permission {
206207 if ( ! existing ) return
207208
208209 pending . delete ( input . requestID )
209- void Bus . publish ( Event . Replied , {
210+ yield * bus . publish ( Event . Replied , {
210211 sessionID : existing . info . sessionID ,
211212 requestID : existing . info . id ,
212213 reply : input . reply ,
@@ -221,7 +222,7 @@ export namespace Permission {
221222 for ( const [ id , item ] of pending . entries ( ) ) {
222223 if ( item . info . sessionID !== existing . info . sessionID ) continue
223224 pending . delete ( id )
224- void Bus . publish ( Event . Replied , {
225+ yield * bus . publish ( Event . Replied , {
225226 sessionID : item . info . sessionID ,
226227 requestID : item . info . id ,
227228 reply : "reject" ,
@@ -249,7 +250,7 @@ export namespace Permission {
249250 )
250251 if ( ! ok ) continue
251252 pending . delete ( id )
252- void Bus . publish ( Event . Replied , {
253+ yield * bus . publish ( Event . Replied , {
253254 sessionID : item . info . sessionID ,
254255 requestID : item . info . id ,
255256 reply : "always" ,
@@ -306,7 +307,9 @@ export namespace Permission {
306307 return result
307308 }
308309
309- export const { runPromise } = makeRuntime ( Service , layer )
310+ export const defaultLayer = layer . pipe ( Layer . provide ( Bus . layer ) )
311+
312+ export const { runPromise } = makeRuntime ( Service , defaultLayer )
310313
311314 export async function ask ( input : z . infer < typeof AskInput > ) {
312315 return runPromise ( ( s ) => s . ask ( input ) )
0 commit comments