@@ -11,7 +11,7 @@ import { RaftIdGenerator } from "../../../../Utility/RaftIdGenerator.js";
1111import { throwError } from "../../../../Exceptions/index.js" ;
1212import { HeadersBuilder } from "../../../../Utility/HttpUtil.js" ;
1313
14- function hasNoSampleObjectOrSchema ( configuration : AiAgentConfiguration ) {
14+ function hasNoSampleObjectAndSchema ( configuration : AiAgentConfiguration ) {
1515 return ( ! configuration . outputSchema || configuration . outputSchema . trim ( ) === "" )
1616 && ( ! configuration . sampleObject || configuration . sampleObject . trim ( ) === "" ) ;
1717}
@@ -20,17 +20,17 @@ export class AddOrUpdateAiAgentOperation implements IMaintenanceOperation<AiAgen
2020 private readonly _configuration : AiAgentConfiguration ;
2121 private readonly _sampleObject ?: unknown ;
2222
23- public constructor ( configuration : AiAgentConfiguration , schemaType ?: any ) {
23+ public constructor ( configuration : AiAgentConfiguration , sampleObject ?: any ) {
2424 if ( ! configuration ) {
2525 throwError ( "InvalidArgumentException" , "configuration cannot be null or undefined." ) ;
2626 }
2727
28- if ( ! configuration . outputSchema && ! configuration . sampleObject && ! schemaType ) {
28+ if ( ! configuration . outputSchema && ! configuration . sampleObject && ! sampleObject ) {
2929 throwError ( "InvalidArgumentException" , "Please provide a non-empty value for either outputSchema or sampleObject." ) ;
3030 }
3131 this . _configuration = configuration ;
32- if ( schemaType ) {
33- this . _sampleObject = schemaType ;
32+ if ( sampleObject ) {
33+ this . _sampleObject = sampleObject ;
3434 }
3535 }
3636
@@ -51,7 +51,7 @@ class AddOrUpdateAiAgentCommand extends RavenCommand<AiAgentConfigurationResult>
5151
5252 public constructor ( configuration : AiAgentConfiguration , sampleSchema : any , conventions : DocumentConventions ) {
5353 super ( ) ;
54- if ( hasNoSampleObjectOrSchema ( configuration ) ) {
54+ if ( hasNoSampleObjectAndSchema ( configuration ) ) {
5555 throwError ( "InvalidArgumentException" , "Please provide a non-empty value for either outputSchema or sampleObject." ) ;
5656 }
5757 this . _configuration = configuration ;
0 commit comments