@@ -6,6 +6,7 @@ import { Provider } from "../../provider/provider"
66import { ModelsDev } from "../../provider/models"
77import { ProviderAuth } from "../../provider/auth"
88import { ProviderID } from "../../provider/schema"
9+ import { AppRuntime } from "../../effect/app-runtime"
910import { mapValues } from "remeda"
1011import { errors } from "../error"
1112import { lazy } from "../../util/lazy"
@@ -81,7 +82,7 @@ export const ProviderRoutes = lazy(() =>
8182 } ,
8283 } ) ,
8384 async ( c ) => {
84- return c . json ( await ProviderAuth . methods ( ) )
85+ return c . json ( await AppRuntime . runPromise ( ProviderAuth . Service . use ( ( svc ) => svc . methods ( ) ) ) )
8586 } ,
8687 )
8788 . post (
@@ -118,11 +119,15 @@ export const ProviderRoutes = lazy(() =>
118119 async ( c ) => {
119120 const providerID = c . req . valid ( "param" ) . providerID
120121 const { method, inputs } = c . req . valid ( "json" )
121- const result = await ProviderAuth . authorize ( {
122- providerID,
123- method,
124- inputs,
125- } )
122+ const result = await AppRuntime . runPromise (
123+ ProviderAuth . Service . use ( ( svc ) =>
124+ svc . authorize ( {
125+ providerID,
126+ method,
127+ inputs,
128+ } ) ,
129+ ) ,
130+ )
126131 return c . json ( result )
127132 } ,
128133 )
@@ -160,11 +165,15 @@ export const ProviderRoutes = lazy(() =>
160165 async ( c ) => {
161166 const providerID = c . req . valid ( "param" ) . providerID
162167 const { method, code } = c . req . valid ( "json" )
163- await ProviderAuth . callback ( {
164- providerID,
165- method,
166- code,
167- } )
168+ await AppRuntime . runPromise (
169+ ProviderAuth . Service . use ( ( svc ) =>
170+ svc . callback ( {
171+ providerID,
172+ method,
173+ code,
174+ } ) ,
175+ ) ,
176+ )
168177 return c . json ( true )
169178 } ,
170179 ) ,
0 commit comments