( packageIdentifier: PackageIdentifier, accessToken: string | null, organizationId: string | null, apiClient: DefaultApiInterface, injectBlocks: PackageIdentifier[], )
| 390 | } |
| 391 | |
| 392 | async function unrollAssistantWithConfig( |
| 393 | packageIdentifier: PackageIdentifier, |
| 394 | accessToken: string | null, |
| 395 | organizationId: string | null, |
| 396 | apiClient: DefaultApiInterface, |
| 397 | injectBlocks: PackageIdentifier[], |
| 398 | ): Promise<AssistantUnrolled> { |
| 399 | const unrollResult = await unrollAssistant( |
| 400 | packageIdentifier, |
| 401 | new RegistryClient({ |
| 402 | rootPath: |
| 403 | packageIdentifier.uriType === "file" |
| 404 | ? dirname(packageIdentifier.fileUri) |
| 405 | : undefined, |
| 406 | }), |
| 407 | { |
| 408 | currentUserSlug: "", |
| 409 | alwaysUseProxy: false, |
| 410 | renderSecrets: true, |
| 411 | platformClient: new CLIPlatformClient(organizationId, apiClient), |
| 412 | injectBlocks, |
| 413 | }, |
| 414 | ); |
| 415 | |
| 416 | const errorDetails = unrollResult.errors; |
| 417 | if (!unrollResult.config) { |
| 418 | throw new Error(`Failed to load config:\n${errorDetails}`); |
| 419 | } else if (errorDetails?.length) { |
| 420 | const warnings = |
| 421 | errorDetails?.length > 1 |
| 422 | ? errorDetails.map((d) => `\n- ${d.message}`) |
| 423 | : errorDetails[0].message; |
| 424 | console.warn(chalk.dim(`Warning: ${warnings}`)); |
| 425 | } |
| 426 | |
| 427 | return unrollResult.config; |
| 428 | } |
| 429 | |
| 430 | /** |
| 431 | * Loads a local YAML configuration file |
no test coverage detected