@semantha/product-sdk 11.11.0 → 12.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,7 @@ declare class SseEndpoint {
15
15
  constructor(restClient: RestClient, parentEndpoint: string);
16
16
  /**
17
17
  * Chat with a document, streaming the answer via Server-Sent Events
18
- * Streaming variant of the document chat endpoint with identical semantics (same path parameters, headers, request body and settings). The response is a text/event-stream: an 'event: delta' per answer chunk (data: {"content":"..."}), a terminal 'event: done' carrying the conversationId (data: {"conversationId":"..."}), and 'event: error' (data: {"message":"..."}) if the stream fails after it has started.
18
+ * Streaming variant of the document chat endpoint with identical semantics (same path parameters, headers, request body and settings). The response is a text/event-stream: an 'event: delta' per message chunk, carrying the kind of message it belongs to (data: {"content":"...","type":"ANSWER"}), a terminal 'event: done' carrying the conversationId (data: {"conversationId":"..."}), and 'event: error' (data: {"message":"..."}) if the stream fails after it has started.
19
19
  *
20
20
  * @param body DocumentChatRequest? -
21
21
  * @param polarionToken string? - The personal access token for polarion
@@ -15,7 +15,7 @@ declare class SseEndpoint {
15
15
  constructor(restClient: RestClient, parentEndpoint: string);
16
16
  /**
17
17
  * Chat with a document, streaming the answer via Server-Sent Events
18
- * Streaming variant of the document chat endpoint with identical semantics (same path parameters, headers, request body and settings). The response is a text/event-stream: an 'event: delta' per answer chunk (data: {"content":"..."}), a terminal 'event: done' carrying the conversationId (data: {"conversationId":"..."}), and 'event: error' (data: {"message":"..."}) if the stream fails after it has started.
18
+ * Streaming variant of the document chat endpoint with identical semantics (same path parameters, headers, request body and settings). The response is a text/event-stream: an 'event: delta' per message chunk, carrying the kind of message it belongs to (data: {"content":"...","type":"ANSWER"}), a terminal 'event: done' carrying the conversationId (data: {"conversationId":"..."}), and 'event: error' (data: {"message":"..."}) if the stream fails after it has started.
19
19
  *
20
20
  * @param body DocumentChatRequest? -
21
21
  * @param polarionToken string? - The personal access token for polarion
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../semantha-product-sdk/document-chat/api/sse.ts","../../../semantha-product-sdk/document-chat/api/document.ts","../../../semantha-product-sdk/document-chat/api/documents.ts","../../../semantha-product-sdk/document-chat/api/domain.ts","../../../semantha-product-sdk/document-chat/api/domains.ts","../../../semantha-product-sdk/document-chat/api/documentchat.ts","../../../semantha-product-sdk/document-chat/api/documentChatAPI.ts"],"names":["SseEndpoint","restClient","parentEndpoint","body","polarionToken","polarionURL","headers","DocumentEndpoint","sourcedocid","DocumentsEndpoint","DomainEndpoint","domainname","DomainsEndpoint","DocumentchatEndpoint","PARENT_ENDPOINT","DocumentChatAPI","_DocumentChatAPI","serverUrl","apiKey","RestClient","clientId","clientSecret","tokenUrl","credentialsFilePath","lines","f","line","searchKey"],"mappings":"2bAWO,IAAMA,CAAAA,CAAN,KAAkB,CAGvB,WAAA,CACmBC,CAAAA,CACAC,CAAAA,CACjB,CAFiB,IAAA,CAAA,UAAA,CAAAD,CAAAA,CACA,IAAA,CAAA,cAAA,CAAAC,CAAAA,CAEjB,IAAA,CAAK,QAAA,CAAW,IAAA,CAAK,cAAA,CAAiB,OACxC,CAPiB,QAAA,CAiBjB,MAAM,iBAAA,CACJC,CAAAA,CACFC,CAAAA,CAAwBC,CAAAA,CAA+D,CACrF,IAAMC,CAAAA,CAAU,IAAA,CAAK,UAAA,CAAW,QAAA,CAAA,mBAA+B,CAAA,CAC/D,OAAIF,CAAAA,GAAkB,MAAA,GACpBE,CAAAA,CAAQ,gBAAgB,CAAA,CAAIF,CAAAA,CAAAA,CAE1BC,CAAAA,GAAgB,MAAA,GAClBC,CAAAA,CAAQ,cAAc,CAAA,CAAID,CAAAA,CAAAA,CAErB,IAAA,CAAK,UAAA,CAAW,eAAA,CACrB,IAAA,CAAK,QAAA,CACL,EAAC,CACDC,CAAAA,CACAH,CACF,CACF,CACF,EClCO,IAAMI,CAAAA,CAAN,KAAuB,CAG5B,WAAA,CACmBN,EACAC,CAAAA,CACAM,CAAAA,CACjB,CAHiB,I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K,UAAA,CAAY,IAAA,CAAK,QAAA,EAAU,CAClE,CAEF","file":"index.js","sourcesContent":["import { DocumentChatRequest } from '../model';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\nimport { ServerSentEvent } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains/{domainname}/documents/{sourcedocid}/sse\"\n * This is a generated file do not change manually!\n */\nexport class SseEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/sse\";\n }\n\n /**\n * Chat with a document, streaming the answer via Server-Sent Events\n * Streaming variant of the document chat endpoint with identical semantics (same path parameters, headers, request body and settings). The response is a text/event-stream: an 'event: delta' per answer chunk (data: {\"content\":\"...\"}), a terminal 'event: done' carrying the conversationId (data: {\"conversationId\":\"...\"}), and 'event: error' (data: {\"message\":\"...\"}) if the stream fails after it has started.\n *\n * @param body DocumentChatRequest? - \n * @param polarionToken string? - The personal access token for polarion\n * @param polarionURL string? - The url of the polarion server to talk to\n */\n async postAsEventStream(\n body?: DocumentChatRequest,\n polarionToken?: string, polarionURL?: string): Promise<AsyncIterable<ServerSentEvent>> {\n const headers = this.restClient.toHeader(MediaType.EVENT_STREAM);\n if (polarionToken !== undefined) {\n headers['Polarion-Token'] = polarionToken;\n }\n if (polarionURL !== undefined) {\n headers['Polarion-URL'] = polarionURL;\n }\n return this.restClient.postEventStream(\n this.ENDPOINT,\n {},\n headers,\n body\n );\n }\n}\n","import { DocumentChatRequest } from '../model';\nimport { DocumentChatResponse } from '../model';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\nimport { SseEndpoint } from './sse';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains/{domainname}/documents/{sourcedocid}\"\n * This is a generated file do not change manually!\n */\nexport class DocumentEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n private readonly sourcedocid: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/documents\" + `/${this.sourcedocid}`;\n }\n\n sse(): SseEndpoint {\n return new SseEndpoint(this.restClient, this.ENDPOINT);\n }\n\n /**\n * @param body DocumentChatRequest? - \n * @param polarionToken string? - The personal access token for polarion\n * @param polarionURL string? - The url of the polarion server to talk to\n */\n async post(\n body?: DocumentChatRequest,\n polarionToken?: string, polarionURL?: string): Promise<DocumentChatResponse> {\n const headers = this.restClient.toHeader(MediaType.JSON);\n if (polarionToken !== undefined) {\n headers['Polarion-Token'] = polarionToken;\n }\n if (polarionURL !== undefined) {\n headers['Polarion-URL'] = polarionURL;\n }\n return (\n await this.restClient.post<DocumentChatResponse>(\n this.ENDPOINT,\n {},\n headers,\n body\n )\n ).toModel();\n }\n}\n","import { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains/{domainname}/documents\"\n * This is a generated file do not change manually!\n */\nexport class DocumentsEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/documents\";\n }\n}\n","import { DocumentEndpoint } from './document';\nimport { DocumentsEndpoint } from './documents';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains/{domainname}\"\n * This is a generated file do not change manually!\n */\nexport class DomainEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n private readonly domainname: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/domains\" + `/${this.domainname}`;\n }\n\n documents(): DocumentsEndpoint;\n documents(sourcedocid: string): DocumentEndpoint\n \n documents(sourcedocid?: string): DocumentEndpoint | DocumentsEndpoint {\n if(sourcedocid !== undefined && sourcedocid !== null) {\n\t return new DocumentEndpoint(this.restClient, this.ENDPOINT, sourcedocid);\n } else {\n\t return new DocumentsEndpoint(this.restClient, this.ENDPOINT);\n }\n }\n}\n","import { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains\"\n * This is a generated file do not change manually!\n */\nexport class DomainsEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/domains\";\n }\n}\n","import { DomainEndpoint } from './domain';\nimport { DomainsEndpoint } from './domains';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat\"\n * This is a generated file do not change manually!\n */\nexport class DocumentchatEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/documentchat\";\n }\n\n domains(): DomainsEndpoint;\n domains(domainname: string): DomainEndpoint\n \n domains(domainname?: string): DomainEndpoint | DomainsEndpoint {\n if(domainname !== undefined && domainname !== null) {\n\t return new DomainEndpoint(this.restClient, this.ENDPOINT, domainname);\n } else {\n\t return new DomainsEndpoint(this.restClient, this.ENDPOINT);\n }\n }\n}\n","import * as fs from 'fs';\n\nimport { DocumentchatEndpoint } from './documentchat';\nimport { RestClient } from '../../rest';\n\nconst PARENT_ENDPOINT = '/api';\n\n/**\n * Entry point to the DocumentChat API.\n *\n * @author semantha\n * Calls the /documentchat, endpoints.\n *\n * Note:\n * The constructor is not meant to be invoked directly\n * use `loginXXX()` with your credentials instead.\n *\n * this is a generated class do not change manually!\n */\nexport class DocumentChatAPI {\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string\n ) {\n }\n\n /**\n * Access to the DocumentChat API\n *\n * @param serverUrl: string - URL to the DocumentChat server.\n * @param apiKey: string - A valid bearer token for accessing the given url.\n *\n * @return DocumentChatAPI: Entry point to the DocumentChat API.\n */\n static loginWithApiKey(\n serverUrl: string,\n apiKey: string\n ): DocumentChatAPI {\n if(!apiKey) {\n throw new Error('You need to supply an API key to login.');\n }\n if(!serverUrl) {\n throw new Error('You need to supply a server url to login.');\n }\n return new DocumentChatAPI(new RestClient(this.parseServerUrl(serverUrl), apiKey), PARENT_ENDPOINT);\n }\n\n\n /**\n * Access to the DocumentChat API, when there is a auth proxy in place to handle the addition of the Authorization header\n *\n * @param serverUrl: string - URL to the DocumentChat server.\n *\n * @return DocumentChatAPI: Entry point to the DocumentChat API.\n */\n static loginWithAuthProxy(\n serverUrl: string\n ): DocumentChatAPI {\n if(!serverUrl) {\n throw new Error('You need to supply a server url to login.');\n }\n return new DocumentChatAPI(new RestClient(this.parseServerUrl(serverUrl)), PARENT_ENDPOINT);\n }\n\n /**\n * Access to the DocumentChat API\n *\n * @param serverUrl: string - URL to the DocumentChat server.\n * @param clientId: string - OAuth2 client id.\n * @param clientSecret: string - OAuth2 client secret.\n * @param tokenUrl: string OAuth2 url to get a valid access token\n *\n * @return DocumentChatAPI: Entry point to the DocumentChat API.\n */\n static loginWithCredentials(\n serverUrl: string,\n clientId: string,\n clientSecret: string,\n tokenUrl: string\n ): DocumentChatAPI {\n serverUrl = this.parseServerUrl(serverUrl);\n return new DocumentChatAPI(new RestClient(serverUrl, undefined, clientId, clientSecret, tokenUrl), PARENT_ENDPOINT);\n }\n\t\n /**\n * Access to the DocumentChat API\n *\n * @param credentialsFilePath: string - Path to a properties file providing client credentials.\n *\n * @return DocumentChatAPI: Entry point to the DocumentChat API.\n */\n static loginWithCredentialsFile(credentialsFilePath: string) : DocumentChatAPI {\n if (credentialsFilePath.endsWith('.properties') || credentialsFilePath.endsWith('.PROPERTIES')) {\n const rawData = fs.readFileSync(credentialsFilePath, 'utf8');\n const lines = rawData\n\t .split(/[\\n|\\r\\n]/)\n\t .filter(line => line.length !== 0)\n\t .map(line => line.split('='));\n\t const serverUrl = this.getValueOfInPropertiesFile('serverUrl', lines);\n\t const clientId = this.getValueOfInPropertiesFile('clientId', lines);\n\t const clientSecret = this.getValueOfInPropertiesFile('clientSecret', lines);\n\t const tokenUrl = this.getValueOfInPropertiesFile('tokenUrl', lines);\n\t return DocumentChatAPI.loginWithCredentials(serverUrl, clientId, clientSecret, tokenUrl);\n\t}\n throw new Error('Can not login, please supply a credentials properties file.');\n }\n\n private static parseServerUrl(serverUrl: string): string {\n if (serverUrl.endsWith('/')) {\n serverUrl = serverUrl.slice(0, -1);\n }\n if (serverUrl.endsWith('/tt-platform-ui/en/#')) {\n serverUrl = serverUrl.replace('/tt-platform-ui/en/#', '/tt-product-server');\n } else if (!serverUrl.endsWith('/tt-product-server')) {\n serverUrl += '/tt-product-server';\n }\n return serverUrl;\n }\n\n private static getValueOfInPropertiesFile(searchKey: string, lines: string[][]): string {\n for (const line of lines) {\n if (line[0] === searchKey) {\n return line[1].replace('\\\\:', ':');\n }\n }\n throw Error(`.properties files contains no ${searchKey}!`);\n }\n\n endpoint(): string {\n return this.parentEndpoint;\n }\n\n documentchat(): DocumentchatEndpoint {\n return new DocumentchatEndpoint(this.restClient, this.endpoint());\n }\n\n}"]}
1
+ {"version":3,"sources":["../../../semantha-product-sdk/document-chat/api/sse.ts","../../../semantha-product-sdk/document-chat/api/document.ts","../../../semantha-product-sdk/document-chat/api/documents.ts","../../../semantha-product-sdk/document-chat/api/domain.ts","../../../semantha-product-sdk/document-chat/api/domains.ts","../../../semantha-product-sdk/document-chat/api/documentchat.ts","../../../semantha-product-sdk/document-chat/api/documentChatAPI.ts"],"names":["SseEndpoint","restClient","parentEndpoint","body","polarionToken","polarionURL","headers","DocumentEndpoint","sourcedocid","DocumentsEndpoint","DomainEndpoint","domainname","DomainsEndpoint","DocumentchatEndpoint","PARENT_ENDPOINT","DocumentChatAPI","_DocumentChatAPI","serverUrl","apiKey","RestClient","clientId","clientSecret","tokenUrl","credentialsFilePath","lines","f","line","searchKey"],"mappings":"2bAWO,IAAMA,CAAAA,CAAN,KAAkB,CAGvB,WAAA,CACmBC,CAAAA,CACAC,CAAAA,CACjB,CAFiB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U,MAAM,CAAA,CAAG,EAAE,CAAA,CAAA,CAE/BA,CAAAA,CAAU,QAAA,CAAS,sBAAsB,CAAA,CAC3CA,CAAAA,CAAYA,CAAAA,CAAU,OAAA,CAAQ,sBAAA,CAAwB,oBAAoB,CAAA,CAChEA,CAAAA,CAAU,QAAA,CAAS,oBAAoB,CAAA,GACjDA,CAAAA,EAAa,oBAAA,CAAA,CAERA,CACT,CAEA,OAAe,0BAAA,CAA2BU,CAAAA,CAAmBH,CAAAA,CAA2B,CACtF,IAAA,IAAWE,CAAAA,IAAQF,CAAAA,CACjB,GAAIE,CAAAA,CAAK,CAAC,IAAMC,CAAAA,CACd,OAAOD,CAAAA,CAAK,CAAC,CAAA,CAAE,OAAA,CAAQ,KAAA,CAAO,GAAG,CAAA,CAGrC,MAAM,KAAA,CAAM,CAAA,8BAAA,EAAiCC,CAAS,CAAA,CAAA,CAAG,CAC3D,CAEA,QAAA,EAAmB,CACjB,OAAO,IAAA,CAAK,cACd,CAEA,YAAA,EAAqC,CACnC,OAAO,IAAId,CAAAA,CAAqB,IAAA,CAAK,UAAA,CAAY,IAAA,CAAK,QAAA,EAAU,CAClE,CAEF","file":"index.js","sourcesContent":["import { DocumentChatRequest } from '../model';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\nimport { ServerSentEvent } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains/{domainname}/documents/{sourcedocid}/sse\"\n * This is a generated file do not change manually!\n */\nexport class SseEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/sse\";\n }\n\n /**\n * Chat with a document, streaming the answer via Server-Sent Events\n * Streaming variant of the document chat endpoint with identical semantics (same path parameters, headers, request body and settings). The response is a text/event-stream: an 'event: delta' per message chunk, carrying the kind of message it belongs to (data: {\"content\":\"...\",\"type\":\"ANSWER\"}), a terminal 'event: done' carrying the conversationId (data: {\"conversationId\":\"...\"}), and 'event: error' (data: {\"message\":\"...\"}) if the stream fails after it has started.\n *\n * @param body DocumentChatRequest? - \n * @param polarionToken string? - The personal access token for polarion\n * @param polarionURL string? - The url of the polarion server to talk to\n */\n async postAsEventStream(\n body?: DocumentChatRequest,\n polarionToken?: string, polarionURL?: string): Promise<AsyncIterable<ServerSentEvent>> {\n const headers = this.restClient.toHeader(MediaType.EVENT_STREAM);\n if (polarionToken !== undefined) {\n headers['Polarion-Token'] = polarionToken;\n }\n if (polarionURL !== undefined) {\n headers['Polarion-URL'] = polarionURL;\n }\n return this.restClient.postEventStream(\n this.ENDPOINT,\n {},\n headers,\n body\n );\n }\n}\n","import { DocumentChatRequest } from '../model';\nimport { DocumentChatResponse } from '../model';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\nimport { SseEndpoint } from './sse';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains/{domainname}/documents/{sourcedocid}\"\n * This is a generated file do not change manually!\n */\nexport class DocumentEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n private readonly sourcedocid: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/documents\" + `/${this.sourcedocid}`;\n }\n\n sse(): SseEndpoint {\n return new SseEndpoint(this.restClient, this.ENDPOINT);\n }\n\n /**\n * @param body DocumentChatRequest? - \n * @param polarionToken string? - The personal access token for polarion\n * @param polarionURL string? - The url of the polarion server to talk to\n */\n async post(\n body?: DocumentChatRequest,\n polarionToken?: string, polarionURL?: string): Promise<DocumentChatResponse> {\n const headers = this.restClient.toHeader(MediaType.JSON);\n if (polarionToken !== undefined) {\n headers['Polarion-Token'] = polarionToken;\n }\n if (polarionURL !== undefined) {\n headers['Polarion-URL'] = polarionURL;\n }\n return (\n await this.restClient.post<DocumentChatResponse>(\n this.ENDPOINT,\n {},\n headers,\n body\n )\n ).toModel();\n }\n}\n","import { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains/{domainname}/documents\"\n * This is a generated file do not change manually!\n */\nexport class DocumentsEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/documents\";\n }\n}\n","import { DocumentEndpoint } from './document';\nimport { DocumentsEndpoint } from './documents';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains/{domainname}\"\n * This is a generated file do not change manually!\n */\nexport class DomainEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n private readonly domainname: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/domains\" + `/${this.domainname}`;\n }\n\n documents(): DocumentsEndpoint;\n documents(sourcedocid: string): DocumentEndpoint\n \n documents(sourcedocid?: string): DocumentEndpoint | DocumentsEndpoint {\n if(sourcedocid !== undefined && sourcedocid !== null) {\n\t return new DocumentEndpoint(this.restClient, this.ENDPOINT, sourcedocid);\n } else {\n\t return new DocumentsEndpoint(this.restClient, this.ENDPOINT);\n }\n }\n}\n","import { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains\"\n * This is a generated file do not change manually!\n */\nexport class DomainsEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/domains\";\n }\n}\n","import { DomainEndpoint } from './domain';\nimport { DomainsEndpoint } from './domains';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat\"\n * This is a generated file do not change manually!\n */\nexport class DocumentchatEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/documentchat\";\n }\n\n domains(): DomainsEndpoint;\n domains(domainname: string): DomainEndpoint\n \n domains(domainname?: string): DomainEndpoint | DomainsEndpoint {\n if(domainname !== undefined && domainname !== null) {\n\t return new DomainEndpoint(this.restClient, this.ENDPOINT, domainname);\n } else {\n\t return new DomainsEndpoint(this.restClient, this.ENDPOINT);\n }\n }\n}\n","import * as fs from 'fs';\n\nimport { DocumentchatEndpoint } from './documentchat';\nimport { RestClient } from '../../rest';\n\nconst PARENT_ENDPOINT = '/api';\n\n/**\n * Entry point to the DocumentChat API.\n *\n * @author semantha\n * Calls the /documentchat, endpoints.\n *\n * Note:\n * The constructor is not meant to be invoked directly\n * use `loginXXX()` with your credentials instead.\n *\n * this is a generated class do not change manually!\n */\nexport class DocumentChatAPI {\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string\n ) {\n }\n\n /**\n * Access to the DocumentChat API\n *\n * @param serverUrl: string - URL to the DocumentChat server.\n * @param apiKey: string - A valid bearer token for accessing the given url.\n *\n * @return DocumentChatAPI: Entry point to the DocumentChat API.\n */\n static loginWithApiKey(\n serverUrl: string,\n apiKey: string\n ): DocumentChatAPI {\n if(!apiKey) {\n throw new Error('You need to supply an API key to login.');\n }\n if(!serverUrl) {\n throw new Error('You need to supply a server url to login.');\n }\n return new DocumentChatAPI(new RestClient(this.parseServerUrl(serverUrl), apiKey), PARENT_ENDPOINT);\n }\n\n\n /**\n * Access to the DocumentChat API, when there is a auth proxy in place to handle the addition of the Authorization header\n *\n * @param serverUrl: string - URL to the DocumentChat server.\n *\n * @return DocumentChatAPI: Entry point to the DocumentChat API.\n */\n static loginWithAuthProxy(\n serverUrl: string\n ): DocumentChatAPI {\n if(!serverUrl) {\n throw new Error('You need to supply a server url to login.');\n }\n return new DocumentChatAPI(new RestClient(this.parseServerUrl(serverUrl)), PARENT_ENDPOINT);\n }\n\n /**\n * Access to the DocumentChat API\n *\n * @param serverUrl: string - URL to the DocumentChat server.\n * @param clientId: string - OAuth2 client id.\n * @param clientSecret: string - OAuth2 client secret.\n * @param tokenUrl: string OAuth2 url to get a valid access token\n *\n * @return DocumentChatAPI: Entry point to the DocumentChat API.\n */\n static loginWithCredentials(\n serverUrl: string,\n clientId: string,\n clientSecret: string,\n tokenUrl: string\n ): DocumentChatAPI {\n serverUrl = this.parseServerUrl(serverUrl);\n return new DocumentChatAPI(new RestClient(serverUrl, undefined, clientId, clientSecret, tokenUrl), PARENT_ENDPOINT);\n }\n\t\n /**\n * Access to the DocumentChat API\n *\n * @param credentialsFilePath: string - Path to a properties file providing client credentials.\n *\n * @return DocumentChatAPI: Entry point to the DocumentChat API.\n */\n static loginWithCredentialsFile(credentialsFilePath: string) : DocumentChatAPI {\n if (credentialsFilePath.endsWith('.properties') || credentialsFilePath.endsWith('.PROPERTIES')) {\n const rawData = fs.readFileSync(credentialsFilePath, 'utf8');\n const lines = rawData\n\t .split(/[\\n|\\r\\n]/)\n\t .filter(line => line.length !== 0)\n\t .map(line => line.split('='));\n\t const serverUrl = this.getValueOfInPropertiesFile('serverUrl', lines);\n\t const clientId = this.getValueOfInPropertiesFile('clientId', lines);\n\t const clientSecret = this.getValueOfInPropertiesFile('clientSecret', lines);\n\t const tokenUrl = this.getValueOfInPropertiesFile('tokenUrl', lines);\n\t return DocumentChatAPI.loginWithCredentials(serverUrl, clientId, clientSecret, tokenUrl);\n\t}\n throw new Error('Can not login, please supply a credentials properties file.');\n }\n\n private static parseServerUrl(serverUrl: string): string {\n if (serverUrl.endsWith('/')) {\n serverUrl = serverUrl.slice(0, -1);\n }\n if (serverUrl.endsWith('/tt-platform-ui/en/#')) {\n serverUrl = serverUrl.replace('/tt-platform-ui/en/#', '/tt-product-server');\n } else if (!serverUrl.endsWith('/tt-product-server')) {\n serverUrl += '/tt-product-server';\n }\n return serverUrl;\n }\n\n private static getValueOfInPropertiesFile(searchKey: string, lines: string[][]): string {\n for (const line of lines) {\n if (line[0] === searchKey) {\n return line[1].replace('\\\\:', ':');\n }\n }\n throw Error(`.properties files contains no ${searchKey}!`);\n }\n\n endpoint(): string {\n return this.parentEndpoint;\n }\n\n documentchat(): DocumentchatEndpoint {\n return new DocumentchatEndpoint(this.restClient, this.endpoint());\n }\n\n}"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../semantha-product-sdk/document-chat/api/sse.ts","../../../semantha-product-sdk/document-chat/api/document.ts","../../../semantha-product-sdk/document-chat/api/documents.ts","../../../semantha-product-sdk/document-chat/api/domain.ts","../../../semantha-product-sdk/document-chat/api/domains.ts","../../../semantha-product-sdk/document-chat/api/documentchat.ts","../../../semantha-product-sdk/document-chat/api/documentChatAPI.ts"],"names":["SseEndpoint","restClient","parentEndpoint","body","polarionToken","polarionURL","headers","DocumentEndpoint","sourcedocid","DocumentsEndpoint","DomainEndpoint","domainname","DomainsEndpoint","DocumentchatEndpoint","PARENT_ENDPOINT","DocumentChatAPI","_DocumentChatAPI","serverUrl","apiKey","RestClient","clientId","clientSecret","tokenUrl","credentialsFilePath","lines","line","searchKey"],"mappings":"8DAWO,IAAMA,CAAAA,CAAN,KAAkB,CAGvB,WAAA,CACmBC,CAAAA,CACAC,CAAAA,CACjB,CAFiB,IAAA,CAAA,UAAA,CAAAD,CAAAA,CACA,IAAA,CAAA,cAAA,CAAAC,CAAAA,CAEjB,IAAA,CAAK,QAAA,CAAW,IAAA,CAAK,cAAA,CAAiB,OACxC,CAPiB,QAAA,CAiBjB,MAAM,iBAAA,CACJC,CAAAA,CACFC,CAAAA,CAAwBC,CAAAA,CAA+D,CACrF,IAAMC,CAAAA,CAAU,IAAA,CAAK,UAAA,CAAW,QAAA,CAAA,mBAA+B,CAAA,CAC/D,OAAIF,CAAAA,GAAkB,MAAA,GACpBE,CAAAA,CAAQ,gBAAgB,CAAA,CAAIF,CAAAA,CAAAA,CAE1BC,CAAAA,GAAgB,MAAA,GAClBC,CAAAA,CAAQ,cAAc,CAAA,CAAID,CAAAA,CAAAA,CAErB,IAAA,CAAK,UAAA,CAAW,eAAA,CACrB,IAAA,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AiCC,CAAS,CAAA,CAAA,CAAG,CAC3D,CAEA,QAAA,EAAmB,CACjB,OAAO,IAAA,CAAK,cACd,CAEA,YAAA,EAAqC,CACnC,OAAO,IAAIb,CAAAA,CAAqB,IAAA,CAAK,UAAA,CAAY,IAAA,CAAK,QAAA,EAAU,CAClE,CAEF","file":"index.mjs","sourcesContent":["import { DocumentChatRequest } from '../model';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\nimport { ServerSentEvent } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains/{domainname}/documents/{sourcedocid}/sse\"\n * This is a generated file do not change manually!\n */\nexport class SseEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/sse\";\n }\n\n /**\n * Chat with a document, streaming the answer via Server-Sent Events\n * Streaming variant of the document chat endpoint with identical semantics (same path parameters, headers, request body and settings). The response is a text/event-stream: an 'event: delta' per answer chunk (data: {\"content\":\"...\"}), a terminal 'event: done' carrying the conversationId (data: {\"conversationId\":\"...\"}), and 'event: error' (data: {\"message\":\"...\"}) if the stream fails after it has started.\n *\n * @param body DocumentChatRequest? - \n * @param polarionToken string? - The personal access token for polarion\n * @param polarionURL string? - The url of the polarion server to talk to\n */\n async postAsEventStream(\n body?: DocumentChatRequest,\n polarionToken?: string, polarionURL?: string): Promise<AsyncIterable<ServerSentEvent>> {\n const headers = this.restClient.toHeader(MediaType.EVENT_STREAM);\n if (polarionToken !== undefined) {\n headers['Polarion-Token'] = polarionToken;\n }\n if (polarionURL !== undefined) {\n headers['Polarion-URL'] = polarionURL;\n }\n return this.restClient.postEventStream(\n this.ENDPOINT,\n {},\n headers,\n body\n );\n }\n}\n","import { DocumentChatRequest } from '../model';\nimport { DocumentChatResponse } from '../model';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\nimport { SseEndpoint } from './sse';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains/{domainname}/documents/{sourcedocid}\"\n * This is a generated file do not change manually!\n */\nexport class DocumentEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n private readonly sourcedocid: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/documents\" + `/${this.sourcedocid}`;\n }\n\n sse(): SseEndpoint {\n return new SseEndpoint(this.restClient, this.ENDPOINT);\n }\n\n /**\n * @param body DocumentChatRequest? - \n * @param polarionToken string? - The personal access token for polarion\n * @param polarionURL string? - The url of the polarion server to talk to\n */\n async post(\n body?: DocumentChatRequest,\n polarionToken?: string, polarionURL?: string): Promise<DocumentChatResponse> {\n const headers = this.restClient.toHeader(MediaType.JSON);\n if (polarionToken !== undefined) {\n headers['Polarion-Token'] = polarionToken;\n }\n if (polarionURL !== undefined) {\n headers['Polarion-URL'] = polarionURL;\n }\n return (\n await this.restClient.post<DocumentChatResponse>(\n this.ENDPOINT,\n {},\n headers,\n body\n )\n ).toModel();\n }\n}\n","import { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains/{domainname}/documents\"\n * This is a generated file do not change manually!\n */\nexport class DocumentsEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/documents\";\n }\n}\n","import { DocumentEndpoint } from './document';\nimport { DocumentsEndpoint } from './documents';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains/{domainname}\"\n * This is a generated file do not change manually!\n */\nexport class DomainEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n private readonly domainname: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/domains\" + `/${this.domainname}`;\n }\n\n documents(): DocumentsEndpoint;\n documents(sourcedocid: string): DocumentEndpoint\n \n documents(sourcedocid?: string): DocumentEndpoint | DocumentsEndpoint {\n if(sourcedocid !== undefined && sourcedocid !== null) {\n\t return new DocumentEndpoint(this.restClient, this.ENDPOINT, sourcedocid);\n } else {\n\t return new DocumentsEndpoint(this.restClient, this.ENDPOINT);\n }\n }\n}\n","import { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains\"\n * This is a generated file do not change manually!\n */\nexport class DomainsEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/domains\";\n }\n}\n","import { DomainEndpoint } from './domain';\nimport { DomainsEndpoint } from './domains';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat\"\n * This is a generated file do not change manually!\n */\nexport class DocumentchatEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/documentchat\";\n }\n\n domains(): DomainsEndpoint;\n domains(domainname: string): DomainEndpoint\n \n domains(domainname?: string): DomainEndpoint | DomainsEndpoint {\n if(domainname !== undefined && domainname !== null) {\n\t return new DomainEndpoint(this.restClient, this.ENDPOINT, domainname);\n } else {\n\t return new DomainsEndpoint(this.restClient, this.ENDPOINT);\n }\n }\n}\n","import * as fs from 'fs';\n\nimport { DocumentchatEndpoint } from './documentchat';\nimport { RestClient } from '../../rest';\n\nconst PARENT_ENDPOINT = '/api';\n\n/**\n * Entry point to the DocumentChat API.\n *\n * @author semantha\n * Calls the /documentchat, endpoints.\n *\n * Note:\n * The constructor is not meant to be invoked directly\n * use `loginXXX()` with your credentials instead.\n *\n * this is a generated class do not change manually!\n */\nexport class DocumentChatAPI {\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string\n ) {\n }\n\n /**\n * Access to the DocumentChat API\n *\n * @param serverUrl: string - URL to the DocumentChat server.\n * @param apiKey: string - A valid bearer token for accessing the given url.\n *\n * @return DocumentChatAPI: Entry point to the DocumentChat API.\n */\n static loginWithApiKey(\n serverUrl: string,\n apiKey: string\n ): DocumentChatAPI {\n if(!apiKey) {\n throw new Error('You need to supply an API key to login.');\n }\n if(!serverUrl) {\n throw new Error('You need to supply a server url to login.');\n }\n return new DocumentChatAPI(new RestClient(this.parseServerUrl(serverUrl), apiKey), PARENT_ENDPOINT);\n }\n\n\n /**\n * Access to the DocumentChat API, when there is a auth proxy in place to handle the addition of the Authorization header\n *\n * @param serverUrl: string - URL to the DocumentChat server.\n *\n * @return DocumentChatAPI: Entry point to the DocumentChat API.\n */\n static loginWithAuthProxy(\n serverUrl: string\n ): DocumentChatAPI {\n if(!serverUrl) {\n throw new Error('You need to supply a server url to login.');\n }\n return new DocumentChatAPI(new RestClient(this.parseServerUrl(serverUrl)), PARENT_ENDPOINT);\n }\n\n /**\n * Access to the DocumentChat API\n *\n * @param serverUrl: string - URL to the DocumentChat server.\n * @param clientId: string - OAuth2 client id.\n * @param clientSecret: string - OAuth2 client secret.\n * @param tokenUrl: string OAuth2 url to get a valid access token\n *\n * @return DocumentChatAPI: Entry point to the DocumentChat API.\n */\n static loginWithCredentials(\n serverUrl: string,\n clientId: string,\n clientSecret: string,\n tokenUrl: string\n ): DocumentChatAPI {\n serverUrl = this.parseServerUrl(serverUrl);\n return new DocumentChatAPI(new RestClient(serverUrl, undefined, clientId, clientSecret, tokenUrl), PARENT_ENDPOINT);\n }\n\t\n /**\n * Access to the DocumentChat API\n *\n * @param credentialsFilePath: string - Path to a properties file providing client credentials.\n *\n * @return DocumentChatAPI: Entry point to the DocumentChat API.\n */\n static loginWithCredentialsFile(credentialsFilePath: string) : DocumentChatAPI {\n if (credentialsFilePath.endsWith('.properties') || credentialsFilePath.endsWith('.PROPERTIES')) {\n const rawData = fs.readFileSync(credentialsFilePath, 'utf8');\n const lines = rawData\n\t .split(/[\\n|\\r\\n]/)\n\t .filter(line => line.length !== 0)\n\t .map(line => line.split('='));\n\t const serverUrl = this.getValueOfInPropertiesFile('serverUrl', lines);\n\t const clientId = this.getValueOfInPropertiesFile('clientId', lines);\n\t const clientSecret = this.getValueOfInPropertiesFile('clientSecret', lines);\n\t const tokenUrl = this.getValueOfInPropertiesFile('tokenUrl', lines);\n\t return DocumentChatAPI.loginWithCredentials(serverUrl, clientId, clientSecret, tokenUrl);\n\t}\n throw new Error('Can not login, please supply a credentials properties file.');\n }\n\n private static parseServerUrl(serverUrl: string): string {\n if (serverUrl.endsWith('/')) {\n serverUrl = serverUrl.slice(0, -1);\n }\n if (serverUrl.endsWith('/tt-platform-ui/en/#')) {\n serverUrl = serverUrl.replace('/tt-platform-ui/en/#', '/tt-product-server');\n } else if (!serverUrl.endsWith('/tt-product-server')) {\n serverUrl += '/tt-product-server';\n }\n return serverUrl;\n }\n\n private static getValueOfInPropertiesFile(searchKey: string, lines: string[][]): string {\n for (const line of lines) {\n if (line[0] === searchKey) {\n return line[1].replace('\\\\:', ':');\n }\n }\n throw Error(`.properties files contains no ${searchKey}!`);\n }\n\n endpoint(): string {\n return this.parentEndpoint;\n }\n\n documentchat(): DocumentchatEndpoint {\n return new DocumentchatEndpoint(this.restClient, this.endpoint());\n }\n\n}"]}
1
+ {"version":3,"sources":["../../../semantha-product-sdk/document-chat/api/sse.ts","../../../semantha-product-sdk/document-chat/api/document.ts","../../../semantha-product-sdk/document-chat/api/documents.ts","../../../semantha-product-sdk/document-chat/api/domain.ts","../../../semantha-product-sdk/document-chat/api/domains.ts","../../../semantha-product-sdk/document-chat/api/documentchat.ts","../../../semantha-product-sdk/document-chat/api/documentChatAPI.ts"],"names":["SseEndpoint","restClient","parentEndpoint","body","polarionToken","polarionURL","headers","DocumentEndpoint","sourcedocid","DocumentsEndpoint","DomainEndpoint","domainname","DomainsEndpoint","DocumentchatEndpoint","PARENT_ENDPOINT","DocumentChatAPI","_DocumentChatAPI","serverUrl","apiK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AAM,6DAA6D,CAC/E,CAEA,OAAe,cAAA,CAAeL,CAAAA,CAA2B,CACvD,OAAIA,CAAAA,CAAU,QAAA,CAAS,GAAG,CAAA,GACxBA,CAAAA,CAAYA,CAAAA,CAAU,MAAM,CAAA,CAAG,EAAE,CAAA,CAAA,CAE/BA,CAAAA,CAAU,QAAA,CAAS,sBAAsB,CAAA,CAC3CA,CAAAA,CAAYA,CAAAA,CAAU,OAAA,CAAQ,sBAAA,CAAwB,oBAAoB,CAAA,CAChEA,CAAAA,CAAU,QAAA,CAAS,oBAAoB,CAAA,GACjDA,CAAAA,EAAa,oBAAA,CAAA,CAERA,CACT,CAEA,OAAe,0BAAA,CAA2BS,CAAAA,CAAmBF,CAAAA,CAA2B,CACtF,IAAA,IAAWC,CAAAA,IAAQD,CAAAA,CACjB,GAAIC,CAAAA,CAAK,CAAC,IAAMC,CAAAA,CACd,OAAOD,CAAAA,CAAK,CAAC,CAAA,CAAE,OAAA,CAAQ,KAAA,CAAO,GAAG,CAAA,CAGrC,MAAM,KAAA,CAAM,CAAA,8BAAA,EAAiCC,CAAS,CAAA,CAAA,CAAG,CAC3D,CAEA,QAAA,EAAmB,CACjB,OAAO,IAAA,CAAK,cACd,CAEA,YAAA,EAAqC,CACnC,OAAO,IAAIb,CAAAA,CAAqB,IAAA,CAAK,UAAA,CAAY,IAAA,CAAK,QAAA,EAAU,CAClE,CAEF","file":"index.mjs","sourcesContent":["import { DocumentChatRequest } from '../model';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\nimport { ServerSentEvent } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains/{domainname}/documents/{sourcedocid}/sse\"\n * This is a generated file do not change manually!\n */\nexport class SseEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/sse\";\n }\n\n /**\n * Chat with a document, streaming the answer via Server-Sent Events\n * Streaming variant of the document chat endpoint with identical semantics (same path parameters, headers, request body and settings). The response is a text/event-stream: an 'event: delta' per message chunk, carrying the kind of message it belongs to (data: {\"content\":\"...\",\"type\":\"ANSWER\"}), a terminal 'event: done' carrying the conversationId (data: {\"conversationId\":\"...\"}), and 'event: error' (data: {\"message\":\"...\"}) if the stream fails after it has started.\n *\n * @param body DocumentChatRequest? - \n * @param polarionToken string? - The personal access token for polarion\n * @param polarionURL string? - The url of the polarion server to talk to\n */\n async postAsEventStream(\n body?: DocumentChatRequest,\n polarionToken?: string, polarionURL?: string): Promise<AsyncIterable<ServerSentEvent>> {\n const headers = this.restClient.toHeader(MediaType.EVENT_STREAM);\n if (polarionToken !== undefined) {\n headers['Polarion-Token'] = polarionToken;\n }\n if (polarionURL !== undefined) {\n headers['Polarion-URL'] = polarionURL;\n }\n return this.restClient.postEventStream(\n this.ENDPOINT,\n {},\n headers,\n body\n );\n }\n}\n","import { DocumentChatRequest } from '../model';\nimport { DocumentChatResponse } from '../model';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\nimport { SseEndpoint } from './sse';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains/{domainname}/documents/{sourcedocid}\"\n * This is a generated file do not change manually!\n */\nexport class DocumentEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n private readonly sourcedocid: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/documents\" + `/${this.sourcedocid}`;\n }\n\n sse(): SseEndpoint {\n return new SseEndpoint(this.restClient, this.ENDPOINT);\n }\n\n /**\n * @param body DocumentChatRequest? - \n * @param polarionToken string? - The personal access token for polarion\n * @param polarionURL string? - The url of the polarion server to talk to\n */\n async post(\n body?: DocumentChatRequest,\n polarionToken?: string, polarionURL?: string): Promise<DocumentChatResponse> {\n const headers = this.restClient.toHeader(MediaType.JSON);\n if (polarionToken !== undefined) {\n headers['Polarion-Token'] = polarionToken;\n }\n if (polarionURL !== undefined) {\n headers['Polarion-URL'] = polarionURL;\n }\n return (\n await this.restClient.post<DocumentChatResponse>(\n this.ENDPOINT,\n {},\n headers,\n body\n )\n ).toModel();\n }\n}\n","import { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains/{domainname}/documents\"\n * This is a generated file do not change manually!\n */\nexport class DocumentsEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/documents\";\n }\n}\n","import { DocumentEndpoint } from './document';\nimport { DocumentsEndpoint } from './documents';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains/{domainname}\"\n * This is a generated file do not change manually!\n */\nexport class DomainEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n private readonly domainname: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/domains\" + `/${this.domainname}`;\n }\n\n documents(): DocumentsEndpoint;\n documents(sourcedocid: string): DocumentEndpoint\n \n documents(sourcedocid?: string): DocumentEndpoint | DocumentsEndpoint {\n if(sourcedocid !== undefined && sourcedocid !== null) {\n\t return new DocumentEndpoint(this.restClient, this.ENDPOINT, sourcedocid);\n } else {\n\t return new DocumentsEndpoint(this.restClient, this.ENDPOINT);\n }\n }\n}\n","import { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat/domains\"\n * This is a generated file do not change manually!\n */\nexport class DomainsEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/domains\";\n }\n}\n","import { DomainEndpoint } from './domain';\nimport { DomainsEndpoint } from './domains';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/documentchat\"\n * This is a generated file do not change manually!\n */\nexport class DocumentchatEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/documentchat\";\n }\n\n domains(): DomainsEndpoint;\n domains(domainname: string): DomainEndpoint\n \n domains(domainname?: string): DomainEndpoint | DomainsEndpoint {\n if(domainname !== undefined && domainname !== null) {\n\t return new DomainEndpoint(this.restClient, this.ENDPOINT, domainname);\n } else {\n\t return new DomainsEndpoint(this.restClient, this.ENDPOINT);\n }\n }\n}\n","import * as fs from 'fs';\n\nimport { DocumentchatEndpoint } from './documentchat';\nimport { RestClient } from '../../rest';\n\nconst PARENT_ENDPOINT = '/api';\n\n/**\n * Entry point to the DocumentChat API.\n *\n * @author semantha\n * Calls the /documentchat, endpoints.\n *\n * Note:\n * The constructor is not meant to be invoked directly\n * use `loginXXX()` with your credentials instead.\n *\n * this is a generated class do not change manually!\n */\nexport class DocumentChatAPI {\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string\n ) {\n }\n\n /**\n * Access to the DocumentChat API\n *\n * @param serverUrl: string - URL to the DocumentChat server.\n * @param apiKey: string - A valid bearer token for accessing the given url.\n *\n * @return DocumentChatAPI: Entry point to the DocumentChat API.\n */\n static loginWithApiKey(\n serverUrl: string,\n apiKey: string\n ): DocumentChatAPI {\n if(!apiKey) {\n throw new Error('You need to supply an API key to login.');\n }\n if(!serverUrl) {\n throw new Error('You need to supply a server url to login.');\n }\n return new DocumentChatAPI(new RestClient(this.parseServerUrl(serverUrl), apiKey), PARENT_ENDPOINT);\n }\n\n\n /**\n * Access to the DocumentChat API, when there is a auth proxy in place to handle the addition of the Authorization header\n *\n * @param serverUrl: string - URL to the DocumentChat server.\n *\n * @return DocumentChatAPI: Entry point to the DocumentChat API.\n */\n static loginWithAuthProxy(\n serverUrl: string\n ): DocumentChatAPI {\n if(!serverUrl) {\n throw new Error('You need to supply a server url to login.');\n }\n return new DocumentChatAPI(new RestClient(this.parseServerUrl(serverUrl)), PARENT_ENDPOINT);\n }\n\n /**\n * Access to the DocumentChat API\n *\n * @param serverUrl: string - URL to the DocumentChat server.\n * @param clientId: string - OAuth2 client id.\n * @param clientSecret: string - OAuth2 client secret.\n * @param tokenUrl: string OAuth2 url to get a valid access token\n *\n * @return DocumentChatAPI: Entry point to the DocumentChat API.\n */\n static loginWithCredentials(\n serverUrl: string,\n clientId: string,\n clientSecret: string,\n tokenUrl: string\n ): DocumentChatAPI {\n serverUrl = this.parseServerUrl(serverUrl);\n return new DocumentChatAPI(new RestClient(serverUrl, undefined, clientId, clientSecret, tokenUrl), PARENT_ENDPOINT);\n }\n\t\n /**\n * Access to the DocumentChat API\n *\n * @param credentialsFilePath: string - Path to a properties file providing client credentials.\n *\n * @return DocumentChatAPI: Entry point to the DocumentChat API.\n */\n static loginWithCredentialsFile(credentialsFilePath: string) : DocumentChatAPI {\n if (credentialsFilePath.endsWith('.properties') || credentialsFilePath.endsWith('.PROPERTIES')) {\n const rawData = fs.readFileSync(credentialsFilePath, 'utf8');\n const lines = rawData\n\t .split(/[\\n|\\r\\n]/)\n\t .filter(line => line.length !== 0)\n\t .map(line => line.split('='));\n\t const serverUrl = this.getValueOfInPropertiesFile('serverUrl', lines);\n\t const clientId = this.getValueOfInPropertiesFile('clientId', lines);\n\t const clientSecret = this.getValueOfInPropertiesFile('clientSecret', lines);\n\t const tokenUrl = this.getValueOfInPropertiesFile('tokenUrl', lines);\n\t return DocumentChatAPI.loginWithCredentials(serverUrl, clientId, clientSecret, tokenUrl);\n\t}\n throw new Error('Can not login, please supply a credentials properties file.');\n }\n\n private static parseServerUrl(serverUrl: string): string {\n if (serverUrl.endsWith('/')) {\n serverUrl = serverUrl.slice(0, -1);\n }\n if (serverUrl.endsWith('/tt-platform-ui/en/#')) {\n serverUrl = serverUrl.replace('/tt-platform-ui/en/#', '/tt-product-server');\n } else if (!serverUrl.endsWith('/tt-product-server')) {\n serverUrl += '/tt-product-server';\n }\n return serverUrl;\n }\n\n private static getValueOfInPropertiesFile(searchKey: string, lines: string[][]): string {\n for (const line of lines) {\n if (line[0] === searchKey) {\n return line[1].replace('\\\\:', ':');\n }\n }\n throw Error(`.properties files contains no ${searchKey}!`);\n }\n\n endpoint(): string {\n return this.parentEndpoint;\n }\n\n documentchat(): DocumentchatEndpoint {\n return new DocumentchatEndpoint(this.restClient, this.endpoint());\n }\n\n}"]}
@@ -22,6 +22,18 @@ interface DocumentChatRequest {
22
22
  conversationId?: string;
23
23
  }
24
24
 
25
+ /**
26
+ * @author semantha
27
+ *
28
+ * This is a generated file do not change manually!
29
+ */
30
+ interface McpApprovalRequest {
31
+ id: string;
32
+ toolName: string;
33
+ serverLabel?: string;
34
+ arguments?: string;
35
+ }
36
+
25
37
  /**
26
38
  * @author semantha
27
39
  *
@@ -33,6 +45,8 @@ interface MessageResponse {
33
45
  metadata?: {
34
46
  [key: string]: any;
35
47
  };
48
+ type?: MessageResponseTypeEnum;
49
+ approvalRequest?: McpApprovalRequest;
36
50
  }
37
51
 
38
52
  /**
@@ -54,6 +68,15 @@ declare const MessageResponseRoleEnumValues: readonly ["USER", "ASSISTANT", "SYS
54
68
  type MessageResponseRoleEnum = (typeof MessageResponseRoleEnumValues)[number];
55
69
  declare function isMessageResponseRoleEnumValue(value: any): value is MessageResponseRoleEnum;
56
70
 
71
+ /**
72
+ * @author semantha
73
+ *
74
+ * This is a generated file do not change manually!
75
+ */
76
+ declare const MessageResponseTypeEnumValues: readonly ["ANSWER", "REASONING", "ERROR", "APPROVAL_REQUEST"];
77
+ type MessageResponseTypeEnum = (typeof MessageResponseTypeEnumValues)[number];
78
+ declare function isMessageResponseTypeEnumValue(value: any): value is MessageResponseTypeEnum;
79
+
57
80
  /**
58
81
  * @author semantha
59
82
  *
@@ -63,4 +86,4 @@ declare const MessageRoleEnumValues: readonly ["USER", "ASSISTANT", "SYSTEM"];
63
86
  type MessageRoleEnum = (typeof MessageRoleEnumValues)[number];
64
87
  declare function isMessageRoleEnumValue(value: any): value is MessageRoleEnum;
65
88
 
66
- export { type DocumentChatRequest, type DocumentChatResponse, type Message, type MessageResponse, type MessageResponseRoleEnum, MessageResponseRoleEnumValues, type MessageRoleEnum, MessageRoleEnumValues, isMessageResponseRoleEnumValue, isMessageRoleEnumValue };
89
+ export { type DocumentChatRequest, type DocumentChatResponse, type McpApprovalRequest, type Message, type MessageResponse, type MessageResponseRoleEnum, MessageResponseRoleEnumValues, type MessageResponseTypeEnum, MessageResponseTypeEnumValues, type MessageRoleEnum, MessageRoleEnumValues, isMessageResponseRoleEnumValue, isMessageResponseTypeEnumValue, isMessageRoleEnumValue };
@@ -22,6 +22,18 @@ interface DocumentChatRequest {
22
22
  conversationId?: string;
23
23
  }
24
24
 
25
+ /**
26
+ * @author semantha
27
+ *
28
+ * This is a generated file do not change manually!
29
+ */
30
+ interface McpApprovalRequest {
31
+ id: string;
32
+ toolName: string;
33
+ serverLabel?: string;
34
+ arguments?: string;
35
+ }
36
+
25
37
  /**
26
38
  * @author semantha
27
39
  *
@@ -33,6 +45,8 @@ interface MessageResponse {
33
45
  metadata?: {
34
46
  [key: string]: any;
35
47
  };
48
+ type?: MessageResponseTypeEnum;
49
+ approvalRequest?: McpApprovalRequest;
36
50
  }
37
51
 
38
52
  /**
@@ -54,6 +68,15 @@ declare const MessageResponseRoleEnumValues: readonly ["USER", "ASSISTANT", "SYS
54
68
  type MessageResponseRoleEnum = (typeof MessageResponseRoleEnumValues)[number];
55
69
  declare function isMessageResponseRoleEnumValue(value: any): value is MessageResponseRoleEnum;
56
70
 
71
+ /**
72
+ * @author semantha
73
+ *
74
+ * This is a generated file do not change manually!
75
+ */
76
+ declare const MessageResponseTypeEnumValues: readonly ["ANSWER", "REASONING", "ERROR", "APPROVAL_REQUEST"];
77
+ type MessageResponseTypeEnum = (typeof MessageResponseTypeEnumValues)[number];
78
+ declare function isMessageResponseTypeEnumValue(value: any): value is MessageResponseTypeEnum;
79
+
57
80
  /**
58
81
  * @author semantha
59
82
  *
@@ -63,4 +86,4 @@ declare const MessageRoleEnumValues: readonly ["USER", "ASSISTANT", "SYSTEM"];
63
86
  type MessageRoleEnum = (typeof MessageRoleEnumValues)[number];
64
87
  declare function isMessageRoleEnumValue(value: any): value is MessageRoleEnum;
65
88
 
66
- export { type DocumentChatRequest, type DocumentChatResponse, type Message, type MessageResponse, type MessageResponseRoleEnum, MessageResponseRoleEnumValues, type MessageRoleEnum, MessageRoleEnumValues, isMessageResponseRoleEnumValue, isMessageRoleEnumValue };
89
+ export { type DocumentChatRequest, type DocumentChatResponse, type McpApprovalRequest, type Message, type MessageResponse, type MessageResponseRoleEnum, MessageResponseRoleEnumValues, type MessageResponseTypeEnum, MessageResponseTypeEnumValues, type MessageRoleEnum, MessageRoleEnumValues, isMessageResponseRoleEnumValue, isMessageResponseTypeEnumValue, isMessageRoleEnumValue };
@@ -1,2 +1,2 @@
1
- 'use strict';var s=["USER","ASSISTANT","SYSTEM"];function n(e){return s.includes(e)}var o=["USER","ASSISTANT","SYSTEM"];function r(e){return o.includes(e)}exports.MessageResponseRoleEnumValues=s;exports.MessageRoleEnumValues=o;exports.isMessageResponseRoleEnumValue=n;exports.isMessageRoleEnumValue=r;//# sourceMappingURL=index.js.map
1
+ 'use strict';var s=["USER","ASSISTANT","SYSTEM"];function u(e){return s.includes(e)}var o=["ANSWER","REASONING","ERROR","APPROVAL_REQUEST"];function t(e){return o.includes(e)}var n=["USER","ASSISTANT","SYSTEM"];function a(e){return n.includes(e)}exports.MessageResponseRoleEnumValues=s;exports.MessageResponseTypeEnumValues=o;exports.MessageRoleEnumValues=n;exports.isMessageResponseRoleEnumValue=u;exports.isMessageResponseTypeEnumValue=t;exports.isMessageRoleEnumValue=a;//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../semantha-product-sdk/document-chat/model/messageResponseRoleEnum.ts","../../../semantha-product-sdk/document-chat/model/messageRoleEnum.ts"],"names":["MessageResponseRoleEnumValues","isMessageResponseRoleEnumValue","value","MessageRoleEnumValues","isMessageRoleEnumValue"],"mappings":"aAKO,IAAMA,CAAAA,CAAgC,CAC3C,MAAA,CACA,WAAA,CACA,QACF,EAGO,SAASC,CAAAA,CAA+BC,CAAAA,CAA8C,CAC3F,OAAOF,CAAAA,CAA8B,SAASE,CAAK,CACrD,CCTO,IAAMC,CAAAA,CAAwB,CACnC,MAAA,CACA,WAAA,CACA,QACF,EAGO,SAASC,CAAAA,CAAuBF,CAAAA,CAAsC,CAC3E,OAAOC,CAAAA,CAAsB,QAAA,CAASD,CAAK,CAC7C","file":"index.js","sourcesContent":["/**\n * @author semantha\n *\n * This is a generated file do not change manually!\n */\nexport const MessageResponseRoleEnumValues = [\n 'USER',\n 'ASSISTANT',\n 'SYSTEM'\n] as const;\nexport type MessageResponseRoleEnum = (typeof MessageResponseRoleEnumValues)[number];\n\nexport function isMessageResponseRoleEnumValue(value: any): value is MessageResponseRoleEnum {\n return MessageResponseRoleEnumValues.includes(value);\n}\n\n","/**\n * @author semantha\n *\n * This is a generated file do not change manually!\n */\nexport const MessageRoleEnumValues = [\n 'USER',\n 'ASSISTANT',\n 'SYSTEM'\n] as const;\nexport type MessageRoleEnum = (typeof MessageRoleEnumValues)[number];\n\nexport function isMessageRoleEnumValue(value: any): value is MessageRoleEnum {\n return MessageRoleEnumValues.includes(value);\n}\n\n"]}
1
+ {"version":3,"sources":["../../../semantha-product-sdk/document-chat/model/messageResponseRoleEnum.ts","../../../semantha-product-sdk/document-chat/model/messageResponseTypeEnum.ts","../../../semantha-product-sdk/document-chat/model/messageRoleEnum.ts"],"names":["MessageResponseRoleEnumValues","isMessageResponseRoleEnumValue","value","MessageResponseTypeEnumValues","isMessageResponseTypeEnumValue","MessageRoleEnumValues","isMessageRoleEnumValue"],"mappings":"aAKO,IAAMA,CAAAA,CAAgC,CAC3C,MAAA,CACA,WAAA,CACA,QACF,EAGO,SAASC,CAAAA,CAA+BC,CAAAA,CAA8C,CAC3F,OAAOF,EAA8B,QAAA,CAASE,CAAK,CACrD,CCTO,IAAMC,EAAgC,CAC3C,QAAA,CACA,WAAA,CACA,OAAA,CACA,kBACF,EAGO,SAASC,CAAAA,CAA+BF,CAAAA,CAA8C,CAC3F,OAAOC,CAAAA,CAA8B,SAASD,CAAK,CACrD,CCVO,IAAMG,CAAAA,CAAwB,CACnC,OACA,WAAA,CACA,QACF,EAGO,SAASC,CAAAA,CAAuBJ,CAAAA,CAAsC,CAC3E,OAAOG,CAAAA,CAAsB,QAAA,CAASH,CAAK,CAC7C","file":"index.js","sourcesContent":["/**\n * @author semantha\n *\n * This is a generated file do not change manually!\n */\nexport const MessageResponseRoleEnumValues = [\n 'USER',\n 'ASSISTANT',\n 'SYSTEM'\n] as const;\nexport type MessageResponseRoleEnum = (typeof MessageResponseRoleEnumValues)[number];\n\nexport function isMessageResponseRoleEnumValue(value: any): value is MessageResponseRoleEnum {\n return MessageResponseRoleEnumValues.includes(value);\n}\n\n","/**\n * @author semantha\n *\n * This is a generated file do not change manually!\n */\nexport const MessageResponseTypeEnumValues = [\n 'ANSWER',\n 'REASONING',\n 'ERROR',\n 'APPROVAL_REQUEST'\n] as const;\nexport type MessageResponseTypeEnum = (typeof MessageResponseTypeEnumValues)[number];\n\nexport function isMessageResponseTypeEnumValue(value: any): value is MessageResponseTypeEnum {\n return MessageResponseTypeEnumValues.includes(value);\n}\n\n","/**\n * @author semantha\n *\n * This is a generated file do not change manually!\n */\nexport const MessageRoleEnumValues = [\n 'USER',\n 'ASSISTANT',\n 'SYSTEM'\n] as const;\nexport type MessageRoleEnum = (typeof MessageRoleEnumValues)[number];\n\nexport function isMessageRoleEnumValue(value: any): value is MessageRoleEnum {\n return MessageRoleEnumValues.includes(value);\n}\n\n"]}
@@ -1,2 +1,2 @@
1
- var s=["USER","ASSISTANT","SYSTEM"];function n(e){return s.includes(e)}var o=["USER","ASSISTANT","SYSTEM"];function r(e){return o.includes(e)}export{s as MessageResponseRoleEnumValues,o as MessageRoleEnumValues,n as isMessageResponseRoleEnumValue,r as isMessageRoleEnumValue};//# sourceMappingURL=index.mjs.map
1
+ var s=["USER","ASSISTANT","SYSTEM"];function u(e){return s.includes(e)}var o=["ANSWER","REASONING","ERROR","APPROVAL_REQUEST"];function t(e){return o.includes(e)}var n=["USER","ASSISTANT","SYSTEM"];function a(e){return n.includes(e)}export{s as MessageResponseRoleEnumValues,o as MessageResponseTypeEnumValues,n as MessageRoleEnumValues,u as isMessageResponseRoleEnumValue,t as isMessageResponseTypeEnumValue,a as isMessageRoleEnumValue};//# sourceMappingURL=index.mjs.map
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../semantha-product-sdk/document-chat/model/messageResponseRoleEnum.ts","../../../semantha-product-sdk/document-chat/model/messageRoleEnum.ts"],"names":["MessageResponseRoleEnumValues","isMessageResponseRoleEnumValue","value","MessageRoleEnumValues","isMessageRoleEnumValue"],"mappings":"AAKO,IAAMA,CAAAA,CAAgC,CAC3C,MAAA,CACA,WAAA,CACA,QACF,EAGO,SAASC,CAAAA,CAA+BC,CAAAA,CAA8C,CAC3F,OAAOF,CAAAA,CAA8B,SAASE,CAAK,CACrD,CCTO,IAAMC,CAAAA,CAAwB,CACnC,MAAA,CACA,WAAA,CACA,QACF,EAGO,SAASC,CAAAA,CAAuBF,CAAAA,CAAsC,CAC3E,OAAOC,CAAAA,CAAsB,QAAA,CAASD,CAAK,CAC7C","file":"index.mjs","sourcesContent":["/**\n * @author semantha\n *\n * This is a generated file do not change manually!\n */\nexport const MessageResponseRoleEnumValues = [\n 'USER',\n 'ASSISTANT',\n 'SYSTEM'\n] as const;\nexport type MessageResponseRoleEnum = (typeof MessageResponseRoleEnumValues)[number];\n\nexport function isMessageResponseRoleEnumValue(value: any): value is MessageResponseRoleEnum {\n return MessageResponseRoleEnumValues.includes(value);\n}\n\n","/**\n * @author semantha\n *\n * This is a generated file do not change manually!\n */\nexport const MessageRoleEnumValues = [\n 'USER',\n 'ASSISTANT',\n 'SYSTEM'\n] as const;\nexport type MessageRoleEnum = (typeof MessageRoleEnumValues)[number];\n\nexport function isMessageRoleEnumValue(value: any): value is MessageRoleEnum {\n return MessageRoleEnumValues.includes(value);\n}\n\n"]}
1
+ {"version":3,"sources":["../../../semantha-product-sdk/document-chat/model/messageResponseRoleEnum.ts","../../../semantha-product-sdk/document-chat/model/messageResponseTypeEnum.ts","../../../semantha-product-sdk/document-chat/model/messageRoleEnum.ts"],"names":["MessageResponseRoleEnumValues","isMessageResponseRoleEnumValue","value","MessageResponseTypeEnumValues","isMessageResponseTypeEnumValue","MessageRoleEnumValues","isMessageRoleEnumValue"],"mappings":"AAKO,IAAMA,CAAAA,CAAgC,CAC3C,MAAA,CACA,WAAA,CACA,QACF,EAGO,SAASC,CAAAA,CAA+BC,CAAAA,CAA8C,CAC3F,OAAOF,EAA8B,QAAA,CAASE,CAAK,CACrD,CCTO,IAAMC,EAAgC,CAC3C,QAAA,CACA,WAAA,CACA,OAAA,CACA,kBACF,EAGO,SAASC,CAAAA,CAA+BF,CAAAA,CAA8C,CAC3F,OAAOC,CAAAA,CAA8B,SAASD,CAAK,CACrD,CCVO,IAAMG,CAAAA,CAAwB,CACnC,OACA,WAAA,CACA,QACF,EAGO,SAASC,CAAAA,CAAuBJ,CAAAA,CAAsC,CAC3E,OAAOG,CAAAA,CAAsB,QAAA,CAASH,CAAK,CAC7C","file":"index.mjs","sourcesContent":["/**\n * @author semantha\n *\n * This is a generated file do not change manually!\n */\nexport const MessageResponseRoleEnumValues = [\n 'USER',\n 'ASSISTANT',\n 'SYSTEM'\n] as const;\nexport type MessageResponseRoleEnum = (typeof MessageResponseRoleEnumValues)[number];\n\nexport function isMessageResponseRoleEnumValue(value: any): value is MessageResponseRoleEnum {\n return MessageResponseRoleEnumValues.includes(value);\n}\n\n","/**\n * @author semantha\n *\n * This is a generated file do not change manually!\n */\nexport const MessageResponseTypeEnumValues = [\n 'ANSWER',\n 'REASONING',\n 'ERROR',\n 'APPROVAL_REQUEST'\n] as const;\nexport type MessageResponseTypeEnum = (typeof MessageResponseTypeEnumValues)[number];\n\nexport function isMessageResponseTypeEnumValue(value: any): value is MessageResponseTypeEnum {\n return MessageResponseTypeEnumValues.includes(value);\n}\n\n","/**\n * @author semantha\n *\n * This is a generated file do not change manually!\n */\nexport const MessageRoleEnumValues = [\n 'USER',\n 'ASSISTANT',\n 'SYSTEM'\n] as const;\nexport type MessageRoleEnum = (typeof MessageRoleEnumValues)[number];\n\nexport function isMessageRoleEnumValue(value: any): value is MessageRoleEnum {\n return MessageRoleEnumValues.includes(value);\n}\n\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semantha/product-sdk",
3
3
  "description": "SDK for semantha products",
4
- "version": "11.11.0",
4
+ "version": "12.0.0",
5
5
  "packageManager": "pnpm@11.6.0+sha512.9a36518224080c6fe5165afdcfe79bfa118c29be703f3f462b1e32efe1e98e47e8750b148e08286250aad4113cc7993ca413c4e2cd447752708c2ee5751bc95f",
6
6
  "engines": {
7
7
  "node": ">=24"