(
configParam: ResolvedConfig,
authorization: { apiUrl: string; accessToken: string },
configPath?: string,
configModule?: any
)
| 165 | } |
| 166 | |
| 167 | async function getDevReactElement( |
| 168 | configParam: ResolvedConfig, |
| 169 | authorization: { apiUrl: string; accessToken: string }, |
| 170 | configPath?: string, |
| 171 | configModule?: any |
| 172 | ) { |
| 173 | const accessToken = authorization.accessToken; |
| 174 | const apiUrl = authorization.apiUrl; |
| 175 | |
| 176 | apiClient = new CliApiClient(apiUrl, accessToken); |
| 177 | |
| 178 | const devEnv = await apiClient.getProjectEnv({ |
| 179 | projectRef: configParam.project, |
| 180 | env: "dev", |
| 181 | }); |
| 182 | |
| 183 | if (!devEnv.success) { |
| 184 | if (devEnv.error === "Project not found") { |
| 185 | logger.error( |
| 186 | `Project not found: ${configParam.project}. Ensure you are using the correct project ref and CLI profile (use --profile). Currently using the "${options.profile}" profile, which points to ${authorization.apiUrl}` |
| 187 | ); |
| 188 | } else { |
| 189 | logger.error( |
| 190 | `Failed to initialize dev environment: ${devEnv.error}. Using project ref ${configParam.project}` |
| 191 | ); |
| 192 | } |
| 193 | |
| 194 | process.exit(1); |
| 195 | } |
| 196 | |
| 197 | const environmentClient = new CliApiClient(apiUrl, devEnv.data.apiKey); |
| 198 | |
| 199 | return ( |
| 200 | <DevUI |
| 201 | dashboardUrl={dashboardUrl} |
| 202 | config={configParam} |
| 203 | apiUrl={apiUrl} |
| 204 | apiKey={devEnv.data.apiKey} |
| 205 | environmentClient={environmentClient} |
| 206 | projectName={devEnv.data.name} |
| 207 | debuggerOn={options.debugger} |
| 208 | debugOtel={options.debugOtel} |
| 209 | configPath={configPath} |
| 210 | configModule={configModule} |
| 211 | /> |
| 212 | ); |
| 213 | } |
| 214 | |
| 215 | const devReactElement = render( |
| 216 | await getDevReactElement( |
no test coverage detected
searching dependent graphs…