@semantha/product-sdk 11.10.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.
- package/dist/chunk-34CEU4KS.mjs +2 -0
- package/dist/{chunk-GJ5RRVHT.mjs.map → chunk-34CEU4KS.mjs.map} +1 -1
- package/dist/chunk-36CIB62T.mjs +10 -0
- package/dist/chunk-36CIB62T.mjs.map +1 -0
- package/dist/{chunk-CULSSUTK.js → chunk-5MXQ6XTH.js} +2 -2
- package/dist/{chunk-CULSSUTK.js.map → chunk-5MXQ6XTH.js.map} +1 -1
- package/dist/chunk-C255MF6C.js +10 -0
- package/dist/chunk-C255MF6C.js.map +1 -0
- package/dist/chunk-NVF34XUK.mjs +2 -0
- package/dist/{chunk-VH2AB5TA.mjs.map → chunk-NVF34XUK.mjs.map} +1 -1
- package/dist/chunk-PNXLWDZQ.mjs +2 -0
- package/dist/{chunk-P2K3VXP2.mjs.map → chunk-PNXLWDZQ.mjs.map} +1 -1
- package/dist/{chunk-7VUBZ76N.js → chunk-R6QPYMV4.js} +2 -2
- package/dist/{chunk-7VUBZ76N.js.map → chunk-R6QPYMV4.js.map} +1 -1
- package/dist/{chunk-TNOEPM5N.js → chunk-T3AKTUUR.js} +2 -2
- package/dist/{chunk-TNOEPM5N.js.map → chunk-T3AKTUUR.js.map} +1 -1
- package/dist/document-chat/api/index.d.mts +25 -2
- package/dist/document-chat/api/index.d.ts +25 -2
- package/dist/document-chat/api/index.js +1 -1
- package/dist/document-chat/api/index.js.map +1 -1
- package/dist/document-chat/api/index.mjs +1 -1
- package/dist/document-chat/api/index.mjs.map +1 -1
- package/dist/document-chat/model/index.d.mts +24 -1
- package/dist/document-chat/model/index.d.ts +24 -1
- package/dist/document-chat/model/index.js +1 -1
- package/dist/document-chat/model/index.js.map +1 -1
- package/dist/document-chat/model/index.mjs +1 -1
- package/dist/document-chat/model/index.mjs.map +1 -1
- package/dist/file-box/api/index.js +1 -1
- package/dist/file-box/api/index.mjs +1 -1
- package/dist/file-box/index.js +1 -1
- package/dist/file-box/index.mjs +1 -1
- package/dist/requirements/api/index.js +1 -1
- package/dist/requirements/api/index.mjs +1 -1
- package/dist/requirements/api/index.mjs.map +1 -1
- package/dist/rest/index.d.mts +32 -2
- package/dist/rest/index.d.ts +32 -2
- package/dist/rest/index.js +1 -1
- package/dist/rest/index.mjs +1 -1
- package/dist/structure-navigator/api/index.js +1 -1
- package/dist/structure-navigator/api/index.mjs +1 -1
- package/dist/structure-navigator/index.js +1 -1
- package/dist/structure-navigator/index.mjs +1 -1
- package/dist/table-extractor/api/index.js +1 -1
- package/dist/table-extractor/api/index.mjs +1 -1
- package/dist/table-extractor/api/index.mjs.map +1 -1
- package/dist/tracking/api/index.js +1 -1
- package/dist/tracking/api/index.mjs +1 -1
- package/dist/tracking/index.js +1 -1
- package/dist/tracking/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-4CX7MUVC.js +0 -2
- package/dist/chunk-4CX7MUVC.js.map +0 -1
- package/dist/chunk-FA37ZZXB.mjs +0 -2
- package/dist/chunk-FA37ZZXB.mjs.map +0 -1
- package/dist/chunk-GJ5RRVHT.mjs +0 -2
- package/dist/chunk-P2K3VXP2.mjs +0 -2
- package/dist/chunk-VH2AB5TA.mjs +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {e}from'./chunk-36CIB62T.mjs';import*as h from'fs';var o=class{constructor(t,r){this.restClient=t;this.parentEndpoint=r;this.ENDPOINT=this.parentEndpoint+"/log";}ENDPOINT;async post(t){return (await this.restClient.post(this.ENDPOINT,{},this.restClient.toHeader("application/json"),t)).toModel()}};var s=class{constructor(t,r){this.restClient=t;this.parentEndpoint=r;this.ENDPOINT=this.parentEndpoint+"/track";}ENDPOINT;async patch(t){return (await this.restClient.patch(this.ENDPOINT,t)).toModel()}};var a=class{constructor(t,r,i){this.restClient=t;this.parentEndpoint=r;this.domainname=i;this.ENDPOINT=this.parentEndpoint+`/domains/${this.domainname}`;}ENDPOINT;log(){return new o(this.restClient,this.ENDPOINT)}track(){return new s(this.restClient,this.ENDPOINT)}};var p=class{constructor(t,r){this.restClient=t;this.parentEndpoint=r;this.ENDPOINT=this.parentEndpoint+"/domains";}ENDPOINT};var l=class{constructor(t,r){this.restClient=t;this.parentEndpoint=r;this.ENDPOINT=this.parentEndpoint+"/uitracking";}ENDPOINT;domains(t){return t!=null?new a(this.restClient,this.ENDPOINT,t):new p(this.restClient,this.ENDPOINT)}};var c="/api",m=class n{constructor(t,r){this.restClient=t;this.parentEndpoint=r;}static loginWithApiKey(t,r){if(!r)throw new Error("You need to supply an API key to login.");if(!t)throw new Error("You need to supply a server url to login.");return new n(new e(this.parseServerUrl(t),r),c)}static loginWithAuthProxy(t){if(!t)throw new Error("You need to supply a server url to login.");return new n(new e(this.parseServerUrl(t)),c)}static loginWithCredentials(t,r,i,d){return t=this.parseServerUrl(t),new n(new e(t,void 0,r,i,d),c)}static loginWithCredentialsFile(t){if(t.endsWith(".properties")||t.endsWith(".PROPERTIES")){let i=h.readFileSync(t,"utf8").split(/[\n|\r\n]/).filter(g=>g.length!==0).map(g=>g.split("=")),d=this.getValueOfInPropertiesFile("serverUrl",i),f=this.getValueOfInPropertiesFile("clientId",i),u=this.getValueOfInPropertiesFile("clientSecret",i),E=this.getValueOfInPropertiesFile("tokenUrl",i);return n.loginWithCredentials(d,f,u,E)}throw new Error("Can not login, please supply a credentials properties file.")}static parseServerUrl(t){return t.endsWith("/")&&(t=t.slice(0,-1)),t.endsWith("/tt-platform-ui/en/#")?t=t.replace("/tt-platform-ui/en/#","/tt-product-server"):t.endsWith("/tt-product-server")||(t+="/tt-product-server"),t}static getValueOfInPropertiesFile(t,r){for(let i of r)if(i[0]===t)return i[1].replace("\\:",":");throw Error(`.properties files contains no ${t}!`)}endpoint(){return this.parentEndpoint}uitracking(){return new l(this.restClient,this.endpoint())}};export{o as a,s as b,a as c,p as d,l as e,m as f};//# sourceMappingURL=chunk-34CEU4KS.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-34CEU4KS.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../semantha-product-sdk/tracking/api/log.ts","../semantha-product-sdk/tracking/api/track.ts","../semantha-product-sdk/tracking/api/domain.ts","../semantha-product-sdk/tracking/api/domains.ts","../semantha-product-sdk/tracking/api/uitracking.ts","../semantha-product-sdk/tracking/api/trackingAPI.ts"],"names":["LogEndpoint","restClient","parentEndpoint","body","TrackEndpoint","DomainEndpoint","domainname","DomainsEndpoint","UitrackingEndpoint","PARENT_ENDPOINT","TrackingAPI","_TrackingAPI","serverUrl","apiKey","RestClient","clientId","clientSecret","tokenUrl","credentialsFilePath","lines","line","searchKey"],"mappings":"iEAUO,IAAMA,CAAAA,CAAN,KAAkB,CAGvB,WAAA,CACmBC,CAAAA,CACAC,EACjB,CAFiB,IAAA,CAAA,UAAA,CAAAD,CAAAA,CACA,IAAA,CAAA,cAAA,CAAAC,CAAAA,CAEjB,IAAA,CAAK,SAAW,IAAA,CAAK,cAAA,CAAiB,OACxC,CAPiB,QAAA,CAYjB,MAAM,KACJC,CAAAA,CACe,CACf,OAAA,CACE,MAAM,IAAA,CAAK,UAAA,CAAW,KACpB,IAAA,CAAK,QAAA,CACL,EAAC,CACD,IAAA,CAAK,UAAA,CAAW,2BAAuB,CAAA,CACvCA,CACF,CAAA,EACA,OAAA,EACJ,CACF,EC1BO,IAAMC,CAAAA,CAAN,KAAoB,CAGzB,WAAA,CACmBH,CAAAA,CACAC,EACjB,CAFiB,IAAA,CAAA,UAAA,CAAAD,CAAAA,CACA,IAAA,CAAA,cAAA,CAAAC,CAAAA,CAEjB,IAAA,CAAK,SAAW,IAAA,CAAK,cAAA,CAAiB,SACxC,CAPiB,QAAA,CAYjB,MAAM,MACJC,CAAAA,CACe,CACf,OAAA,CACI,MAAM,IAAA,CAAK,UAAA,CAAW,MACpB,IAAA,CAAK,QAAA,CACLA,CACF,CAAA,EACF,OAAA,EACJ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U,CAChE,CAEF","file":"chunk-GJ5RRVHT.mjs","sourcesContent":["import { Logging } from '../model';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/uitracking/domains/{domainname}/log\"\n * This is a generated file do not change manually!\n */\nexport class LogEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/log\";\n }\n\n /**\n * @param body Logging? - \n */\n async post(\n body?: Logging,\n ): Promise<void> {\n return (\n await this.restClient.post<void>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.JSON),\n body\n )\n ).toModel();\n }\n}\n","import { RestClient } from '../../rest';\nimport { Tracking } from '../model';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/uitracking/domains/{domainname}/track\"\n * This is a generated file do not change manually!\n */\nexport class TrackEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/track\";\n }\n\n /**\n * @param body Tracking - \n */\n async patch(\n body: Tracking,\n ): Promise<void> {\n return (\n await this.restClient.patch<void>(\n this.ENDPOINT,\n body\n )\n ).toModel();\n }\n}\n","import { LogEndpoint } from './log';\nimport { RestClient } from '../../rest';\nimport { TrackEndpoint } from './track';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/uitracking/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 log(): LogEndpoint {\n return new LogEndpoint(this.restClient, this.ENDPOINT);\n }\n\n track(): TrackEndpoint {\n return new TrackEndpoint(this.restClient, this.ENDPOINT);\n }\n}\n","import { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/uitracking/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/uitracking\"\n * This is a generated file do not change manually!\n */\nexport class UitrackingEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/uitracking\";\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 { UitrackingEndpoint } from './uitracking';\nimport { RestClient } from '../../rest';\n\nconst PARENT_ENDPOINT = '/api';\n\n/**\n * Entry point to the Tracking API.\n *\n * @author semantha\n * Calls the /uitracking, 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 TrackingAPI {\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string\n ) {\n }\n\n /**\n * Access to the Tracking API\n *\n * @param serverUrl: string - URL to the Tracking server.\n * @param apiKey: string - A valid bearer token for accessing the given url.\n *\n * @return TrackingAPI: Entry point to the Tracking API.\n */\n static loginWithApiKey(\n serverUrl: string,\n apiKey: string\n ): TrackingAPI {\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 TrackingAPI(new RestClient(this.parseServerUrl(serverUrl), apiKey), PARENT_ENDPOINT);\n }\n\n\n /**\n * Access to the Tracking 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 Tracking server.\n *\n * @return TrackingAPI: Entry point to the Tracking API.\n */\n static loginWithAuthProxy(\n serverUrl: string\n ): TrackingAPI {\n if(!serverUrl) {\n throw new Error('You need to supply a server url to login.');\n }\n return new TrackingAPI(new RestClient(this.parseServerUrl(serverUrl)), PARENT_ENDPOINT);\n }\n\n /**\n * Access to the Tracking API\n *\n * @param serverUrl: string - URL to the Tracking 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 TrackingAPI: Entry point to the Tracking API.\n */\n static loginWithCredentials(\n serverUrl: string,\n clientId: string,\n clientSecret: string,\n tokenUrl: string\n ): TrackingAPI {\n serverUrl = this.parseServerUrl(serverUrl);\n return new TrackingAPI(new RestClient(serverUrl, undefined, clientId, clientSecret, tokenUrl), PARENT_ENDPOINT);\n }\n\t\n /**\n * Access to the Tracking API\n *\n * @param credentialsFilePath: string - Path to a properties file providing client credentials.\n *\n * @return TrackingAPI: Entry point to the Tracking API.\n */\n static loginWithCredentialsFile(credentialsFilePath: string) : TrackingAPI {\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 TrackingAPI.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 uitracking(): UitrackingEndpoint {\n return new UitrackingEndpoint(this.restClient, this.endpoint());\n }\n\n}"]}
|
|
1
|
+
{"version":3,"sources":["../semantha-product-sdk/tracking/api/log.ts","../semantha-product-sdk/tracking/api/track.ts","../semantha-product-sdk/tracking/api/domain.ts","../semantha-product-sdk/tracking/api/domains.ts","../semantha-product-sdk/tracking/api/uitracking.ts","../semantha-product-sdk/tracking/api/trackingAPI.ts"],"names":["LogEndpoint","restClient","parentEndpoint","body","TrackEndpoint","DomainEndpoint","domainname","DomainsEndpoint","UitrackingEndpoint","PARENT_ENDPOINT","TrackingAPI","_TrackingAPI","serverUrl","apiKey","RestClient","clientId","clientSecret","tokenUrl","credentialsFilePath","lines","line","searchKey"],"mappings":"0DAUO,IAAMA,CAAAA,CAAN,KAAkB,CAGvB,WAAA,CACmBC,CAAAA,CACAC,EACjB,CAFiB,IAAA,CAAA,UAAA,CAAAD,CAAAA,CACA,IAAA,CAAA,cAAA,CAAAC,CAAAA,CAEjB,IAAA,CAAK,SAAW,IAAA,CAAK,cAAA,CAAiB,OACxC,CAPiB,QAAA,CAYjB,MAAM,KACJC,CAAAA,CACe,CACf,OAAA,CACE,MAAM,IAAA,CAAK,UAAA,CAAW,KACp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A,GACjDA,CAAAA,EAAa,sBAERA,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,MAAO,GAAG,CAAA,CAGrC,MAAM,KAAA,CAAM,CAAA,8BAAA,EAAiCC,CAAS,GAAG,CAC3D,CAEA,QAAA,EAAmB,CACjB,OAAO,IAAA,CAAK,cACd,CAEA,UAAA,EAAiC,CAC/B,OAAO,IAAIb,CAAAA,CAAmB,IAAA,CAAK,UAAA,CAAY,IAAA,CAAK,QAAA,EAAU,CAChE,CAEF","file":"chunk-34CEU4KS.mjs","sourcesContent":["import { Logging } from '../model';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/uitracking/domains/{domainname}/log\"\n * This is a generated file do not change manually!\n */\nexport class LogEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/log\";\n }\n\n /**\n * @param body Logging? - \n */\n async post(\n body?: Logging,\n ): Promise<void> {\n return (\n await this.restClient.post<void>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.JSON),\n body\n )\n ).toModel();\n }\n}\n","import { RestClient } from '../../rest';\nimport { Tracking } from '../model';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/uitracking/domains/{domainname}/track\"\n * This is a generated file do not change manually!\n */\nexport class TrackEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/track\";\n }\n\n /**\n * @param body Tracking - \n */\n async patch(\n body: Tracking,\n ): Promise<void> {\n return (\n await this.restClient.patch<void>(\n this.ENDPOINT,\n body\n )\n ).toModel();\n }\n}\n","import { LogEndpoint } from './log';\nimport { RestClient } from '../../rest';\nimport { TrackEndpoint } from './track';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/uitracking/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 log(): LogEndpoint {\n return new LogEndpoint(this.restClient, this.ENDPOINT);\n }\n\n track(): TrackEndpoint {\n return new TrackEndpoint(this.restClient, this.ENDPOINT);\n }\n}\n","import { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/uitracking/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/uitracking\"\n * This is a generated file do not change manually!\n */\nexport class UitrackingEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/uitracking\";\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 { UitrackingEndpoint } from './uitracking';\nimport { RestClient } from '../../rest';\n\nconst PARENT_ENDPOINT = '/api';\n\n/**\n * Entry point to the Tracking API.\n *\n * @author semantha\n * Calls the /uitracking, 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 TrackingAPI {\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string\n ) {\n }\n\n /**\n * Access to the Tracking API\n *\n * @param serverUrl: string - URL to the Tracking server.\n * @param apiKey: string - A valid bearer token for accessing the given url.\n *\n * @return TrackingAPI: Entry point to the Tracking API.\n */\n static loginWithApiKey(\n serverUrl: string,\n apiKey: string\n ): TrackingAPI {\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 TrackingAPI(new RestClient(this.parseServerUrl(serverUrl), apiKey), PARENT_ENDPOINT);\n }\n\n\n /**\n * Access to the Tracking 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 Tracking server.\n *\n * @return TrackingAPI: Entry point to the Tracking API.\n */\n static loginWithAuthProxy(\n serverUrl: string\n ): TrackingAPI {\n if(!serverUrl) {\n throw new Error('You need to supply a server url to login.');\n }\n return new TrackingAPI(new RestClient(this.parseServerUrl(serverUrl)), PARENT_ENDPOINT);\n }\n\n /**\n * Access to the Tracking API\n *\n * @param serverUrl: string - URL to the Tracking 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 TrackingAPI: Entry point to the Tracking API.\n */\n static loginWithCredentials(\n serverUrl: string,\n clientId: string,\n clientSecret: string,\n tokenUrl: string\n ): TrackingAPI {\n serverUrl = this.parseServerUrl(serverUrl);\n return new TrackingAPI(new RestClient(serverUrl, undefined, clientId, clientSecret, tokenUrl), PARENT_ENDPOINT);\n }\n\t\n /**\n * Access to the Tracking API\n *\n * @param credentialsFilePath: string - Path to a properties file providing client credentials.\n *\n * @return TrackingAPI: Entry point to the Tracking API.\n */\n static loginWithCredentialsFile(credentialsFilePath: string) : TrackingAPI {\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 TrackingAPI.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 uitracking(): UitrackingEndpoint {\n return new UitrackingEndpoint(this.restClient, this.endpoint());\n }\n\n}"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import l from'axios';var u=class{constructor(t){this.response=t;}async toModel(){return (await this.response).data}async toFile(){let t=await this.response,s=t?.headers["content-disposition"],e="file";if(s){let n=s.match(/filename="?([^"]+)"?/);n&&n[1]&&(e=n[1]);}return new File([t.data],e)}async getStatusCode(){return (await this.response).status}async getStatusText(){return (await this.response).statusText}},y=class{constructor(t,s,e,n){this.event=t;this.data=s;this.id=e;this.retry=n;}json(){return JSON.parse(this.data)}};function f(c){let t,s=[],e,n,r=false;for(let i of c.split(`
|
|
2
|
+
`)){if(i===""||i.startsWith(":"))continue;let a=i.indexOf(":"),d=a===-1?i:i.slice(0,a),p=a===-1?"":i.slice(a+1);switch(p.startsWith(" ")&&(p=p.slice(1)),r=true,d){case "event":t=p;break;case "data":s.push(p);break;case "id":e=p;break;case "retry":{let o=Number(p);Number.isNaN(o)||(n=o);break}}}return r?new y(t,s.join(`
|
|
3
|
+
`),e,n):void 0}async function*h(c){let t=c.getReader(),s=new TextDecoder,e="",n=function*(r){e=e.replace(/\r\n/g,`
|
|
4
|
+
`).replace(/\r/g,`
|
|
5
|
+
`);let i=e.indexOf(`
|
|
6
|
+
|
|
7
|
+
`);for(;i!==-1;){let a=f(e.slice(0,i));e=e.slice(i+2),a&&(yield a),i=e.indexOf(`
|
|
8
|
+
|
|
9
|
+
`);}if(r){let a=f(e);e="",a&&(yield a);}};try{let{value:r,done:i}=await t.read();for(;!i;)e+=s.decode(r,{stream:!0}),yield*n(!1),{value:r,done:i}=await t.read();e+=s.decode(),yield*n(!0);}finally{await t.cancel().catch(()=>{}),t.releaseLock();}}var g=(o=>(o.JSON="application/json",o.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",o.PDF="application/pdf",o.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",o.ZIP="application/zip",o.REQIFZ="application/reqifz",o.PNG="image/png",o.BINARY="application/octet-stream",o.TEXT_PLAIN="text/plain",o.EVENT_STREAM="text/event-stream",o))(g||{}),m=class c{constructor(t,s,e,n,r){this.serverUrl=t;this.apiKey=s;this.clientId=e;this.client_secret=n;this.tokenUrl=r;this.expireTime=0,this.accessToken="",this.skipAuthHeader=!!t&&!(s||e||n||r);}static LEEWAY=30;static MAX_ERROR_BODY_LENGTH=500;expireTime;accessToken;skipAuthHeader;async buildHeadersForJsonRequest(){return this.skipAuthHeader?{Accept:"application/json"}:{Accept:"application/json",Authorization:`Bearer ${await this.getToken()}`}}async buildHeadersForRequest(){return this.skipAuthHeader?{}:{Authorization:`Bearer ${await this.getToken()}`}}async getToken(){if(this.apiKey)return this.apiKey;if(this.clientId&&this.client_secret&&this.tokenUrl&&(this.accessToken==""||this.expireTime<performance.now())){let t={grant_type:"client_credentials",client_id:this.clientId,client_secret:this.client_secret,scope:"openid"},s=await l.post(this.tokenUrl,t,{headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"}});if(s.status>=l.HttpStatusCode.BadRequest)return "";this.accessToken=s.data.id_token??s.data.access_token,this.expireTime=performance.now()+(s.data.expires_in-c.LEEWAY);}return this.accessToken}toRequestData(t,s){if(!s?.["Content-Type"]?.startsWith("multipart/form-data")||(delete s["Content-Type"],!t||typeof t!="object"||t instanceof FormData))return t;let e=new FormData;for(let[n,r]of Object.entries(t))r!=null&&(r instanceof Blob?e.append(n,r,r.name??n):typeof r=="object"?e.append(n,JSON.stringify(r)):e.append(n,String(r)));return e}async request(t,s,e){if(!e.headers)e.headers=await this.buildHeadersForJsonRequest();else {let r=await this.buildHeadersForRequest();e.headers={...e.headers,...r};}let n=this.toRequestData(e.data,e.headers);return new u(l.request({method:t,url:this.serverUrl+s,headers:{...e.headers,"User-Agent":"semantha TypeScript SDK; "},data:n,params:e.params,responseType:e.responseType}))}async get(t,s,e,n,r="json"){return this.request("GET",t,{params:s,headers:e,data:n,responseType:r})}async post(t,s,e,n,r="json"){if(!e)e=await this.buildHeadersForJsonRequest();else {let i=await this.buildHeadersForRequest();e={...e,...i};}return new u(l.post(this.serverUrl+t,this.toRequestData(n,e),{params:s,headers:e,responseType:r}))}async postEventStream(t,s,e,n,r){let i=await this.buildHeadersForRequest(),a={...e,...i,Accept:"text/event-stream"};n!=null&&!a["Content-Type"]&&(a["Content-Type"]="application/json");let d=await fetch(this.serverUrl+t+this.toQueryString(s),{method:"POST",headers:a,body:n!=null?JSON.stringify(n):void 0,signal:r});if(!d.ok){let p=await c.readErrorBody(d);throw new Error(`Event stream request to ${t} failed with status ${d.status} ${d.statusText}${p}`)}if(!d.body)throw new Error(`Event stream request to ${t} returned an empty response body`);return h(d.body)}static async readErrorBody(t){let s;try{s=(await t.text()).trim();}catch{return ""}return s?`: ${s.length>c.MAX_ERROR_BODY_LENGTH?`${s.slice(0,c.MAX_ERROR_BODY_LENGTH)}\u2026`:s}`:""}toQueryString(t){if(!t)return "";let s=new URLSearchParams;for(let[n,r]of Object.entries(t))r!=null&&s.append(n,String(r));let e=s.toString();return e?`?${e}`:""}async delete(t,s,e,n){return this.request("DELETE",t,{data:s,params:e,headers:n})}async patch(t,s,e){return this.request("PATCH",t,{data:s,headers:e})}async put(t,s,e){return this.request("PUT",t,{data:s,headers:e})}toHeader(t,s){return s?{Accept:t,"Content-Type":s}:{Accept:t}}};export{u as a,y as b,h as c,g as d,m as e};//# sourceMappingURL=chunk-36CIB62T.mjs.map
|
|
10
|
+
//# sourceMappingURL=chunk-36CIB62T.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../semantha-product-sdk/rest/restResponse.ts","../semantha-product-sdk/rest/restClient.ts"],"names":["RestResponse","response","contentDisposition","filename","match","ServerSentEvent","event","data","id","retry","parseEvent","chunk","hasField","line","colon","field","value","parsed","parseServerSentEvents","body","reader","decoder","buffer","flushEvents","final","separator","done","MediaType","RestClient","_RestClient","serverUrl","apiKey","clientId","client_secret","tokenUrl","axios","headers","form","key","method","url","config","authHeader","params","responseType","signal","requestHeaders","details","search","query","acceptMimeType","contentType"],"mappings":"qBAEO,IAAMA,CAAAA,CAAN,KAAsB,CAC3B,WAAA,CAA6BC,CAAAA,CAAqC,CAArC,IAAA,CAAA,QAAA,CAAAA,EAAsC,CAEnE,MAAM,OAAA,EAAsB,CAC1B,OAAA,CAAQ,MAAM,IAAA,CAAK,QAAA,EAAU,IAC/B,CAEA,MAAM,MAAA,EAAwB,CAC5B,IAA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AAA,CAAA6B,CAAQ,CAAC,CACtD,CAEA,QAAA,CAASc,CAAAA,CAA2BC,EAAiD,CACnF,OAAIA,EACK,CAAE,MAAA,CAAQD,EAAgB,cAAA,CAAgBC,CAAY,EAExD,CAAE,MAAA,CAAQD,CAAe,CAClC,CACF","file":"chunk-36CIB62T.mjs","sourcesContent":["import { AxiosResponse } from 'axios';\n\nexport class RestResponse<T> {\n constructor(private readonly response: Promise<AxiosResponse<T>>) {}\n\n async toModel(): Promise<T> {\n return (await this.response).data;\n }\n\n async toFile(): Promise<File> {\n const response: AxiosResponse = await this.response;\n const contentDisposition = response?.headers['content-disposition'];\n let filename = 'file';\n if (contentDisposition) {\n const match = contentDisposition.match(/filename=\"?([^\"]+)\"?/);\n if (match && match[1]) {\n filename = match[1];\n }\n }\n return new File([response.data], filename);\n }\n\n async getStatusCode(): Promise<number> {\n return (await this.response).status;\n }\n\n async getStatusText(): Promise<string> {\n return (await this.response).statusText;\n }\n}\n\n/**\n * A single Server-Sent Event as emitted by a `text/event-stream` response,\n * parsed according to the WHATWG event stream format.\n */\nexport class ServerSentEvent {\n constructor(\n public readonly event: string | undefined,\n public readonly data: string,\n public readonly id?: string,\n public readonly retry?: number\n ) {}\n\n /**\n * The `data` payload parsed as JSON.\n */\n json<T = unknown>(): T {\n return JSON.parse(this.data) as T;\n }\n}\n\nfunction parseEvent(chunk: string): ServerSentEvent | undefined {\n let event: string | undefined;\n const data: string[] = [];\n let id: string | undefined;\n let retry: number | undefined;\n let hasField = false;\n for (const line of chunk.split('\\n')) {\n if (line === '' || line.startsWith(':')) {\n // blank lines never occur inside a chunk here, comments are ignored\n continue;\n }\n const colon = line.indexOf(':');\n const field = colon === -1 ? line : line.slice(0, colon);\n let value = colon === -1 ? '' : line.slice(colon + 1);\n if (value.startsWith(' ')) {\n value = value.slice(1);\n }\n hasField = true;\n switch (field) {\n case 'event':\n event = value;\n break;\n case 'data':\n data.push(value);\n break;\n case 'id':\n id = value;\n break;\n case 'retry': {\n const parsed = Number(value);\n if (!Number.isNaN(parsed)) {\n retry = parsed;\n }\n break;\n }\n }\n }\n return hasField ? new ServerSentEvent(event, data.join('\\n'), id, retry) : undefined;\n}\n\n/**\n * Turns the raw byte stream of a `text/event-stream` response into an async\n * iterable of {@link ServerSentEvent}s, yielding each event as soon as it has\n * been fully received.\n */\nexport async function* parseServerSentEvents(body: ReadableStream<Uint8Array>): AsyncIterable<ServerSentEvent> {\n const reader = body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n const flushEvents = function* (final: boolean): Generator<ServerSentEvent> {\n buffer = buffer.replace(/\\r\\n/g, '\\n').replace(/\\r/g, '\\n');\n let separator = buffer.indexOf('\\n\\n');\n while (separator !== -1) {\n const event = parseEvent(buffer.slice(0, separator));\n buffer = buffer.slice(separator + 2);\n if (event) {\n yield event;\n }\n separator = buffer.indexOf('\\n\\n');\n }\n if (final) {\n const event = parseEvent(buffer);\n buffer = '';\n if (event) {\n yield event;\n }\n }\n };\n try {\n let { value, done } = await reader.read();\n while (!done) {\n buffer += decoder.decode(value, { stream: true });\n yield* flushEvents(false);\n ({ value, done } = await reader.read());\n }\n buffer += decoder.decode();\n yield* flushEvents(true);\n } finally {\n await reader.cancel().catch(() => undefined);\n reader.releaseLock();\n }\n}\n","import axios, { AxiosRequestConfig, AxiosResponse, ResponseType } from 'axios';\nimport { parseServerSentEvents, RestResponse, ServerSentEvent } from './restResponse';\n\nexport enum MediaType {\n JSON = 'application/json',\n XLSX = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n PDF = 'application/pdf',\n DOCX = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n ZIP = 'application/zip',\n REQIFZ = 'application/reqifz',\n PNG = 'image/png',\n BINARY = 'application/octet-stream',\n TEXT_PLAIN = 'text/plain',\n EVENT_STREAM = 'text/event-stream'\n}\n\nexport class RestClient {\n // in seconds\n private static readonly LEEWAY = 30;\n\n // Max characters of an error response body to include in a thrown Error\n private static readonly MAX_ERROR_BODY_LENGTH = 500;\n\n private expireTime: number;\n private accessToken: string;\n private skipAuthHeader: boolean;\n\n constructor(\n private readonly serverUrl: string,\n private readonly apiKey?: string,\n private readonly clientId?: string,\n private readonly client_secret?: string,\n private readonly tokenUrl?: string\n ) {\n this.expireTime = 0.0;\n this.accessToken = '';\n this.skipAuthHeader = !!serverUrl && !(apiKey || clientId || client_secret || tokenUrl);\n }\n\n async buildHeadersForJsonRequest(): Promise<{ [key: string]: string }> {\n if (this.skipAuthHeader) {\n return {\n Accept: 'application/json'\n };\n }\n return {\n Accept: 'application/json',\n Authorization: `Bearer ${await this.getToken()}`\n };\n }\n\n async buildHeadersForRequest(): Promise<{ [key: string]: string }> {\n if (this.skipAuthHeader) {\n return {};\n }\n return {\n Authorization: `Bearer ${await this.getToken()}`\n };\n }\n\n async getToken(): Promise<string> {\n if (this.apiKey) {\n return this.apiKey;\n }\n if (\n this.clientId &&\n this.client_secret &&\n this.tokenUrl &&\n (this.accessToken == '' || this.expireTime < performance.now())\n ) {\n const data = {\n grant_type: 'client_credentials',\n client_id: this.clientId,\n client_secret: this.client_secret,\n scope: 'openid'\n };\n const response = await axios.post(this.tokenUrl, data, {\n headers: { accept: 'application/json', 'content-type': 'application/x-www-form-urlencoded' }\n });\n if (response.status >= axios.HttpStatusCode.BadRequest) {\n // example for error response: {\"error\":\"invalid_client\",\"error_description\":\"Invalid client or Invalid client credentials\"}\n // we have no token -> this leads to a permission error\n return '';\n }\n this.accessToken = response.data['id_token'] ?? response.data['access_token'];\n this.expireTime = performance.now() + (response.data['expires_in'] - RestClient.LEEWAY);\n }\n return this.accessToken;\n }\n\n // Multipart endpoints announce it via a multipart/form-data Content-Type header\n // set by the generated code; their plain-object bodies (possibly containing\n // Blobs) must be sent as FormData, not JSON-serialized.\n private toRequestData(data: any, headers?: { [key: string]: string }): any {\n if (!headers?.['Content-Type']?.startsWith('multipart/form-data')) {\n return data;\n }\n // axios must set the Content-Type itself to include the multipart boundary\n delete headers['Content-Type'];\n if (!data || typeof data !== 'object' || data instanceof FormData) {\n return data;\n }\n const form = new FormData();\n for (const [key, value] of Object.entries(data)) {\n if (value === undefined || value === null) {\n continue;\n }\n if (value instanceof Blob) {\n form.append(key, value, (value as File).name ?? key);\n } else if (typeof value === 'object') {\n form.append(key, JSON.stringify(value));\n } else {\n form.append(key, String(value));\n }\n }\n return form;\n }\n\n private async request<R>(\n method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE',\n url: string,\n config: { params?: any; headers?: { [key: string]: string }; data?: any; responseType?: ResponseType }\n ): Promise<RestResponse<R>> {\n if (!config.headers) {\n config.headers = await this.buildHeadersForJsonRequest();\n } else {\n const authHeader = await this.buildHeadersForRequest();\n config.headers = { ...config.headers, ...authHeader };\n }\n // convert first: toRequestData strips a multipart Content-Type from config.headers\n const data = this.toRequestData(config.data, config.headers);\n return new RestResponse<R>(\n axios.request<R>({\n method: method,\n url: this.serverUrl + url,\n headers: { ...config.headers, 'User-Agent': 'semantha TypeScript SDK; ' },\n data: data,\n params: config.params,\n responseType: config.responseType\n })\n );\n }\n\n async get<R>(\n url: string,\n params?: any,\n headers?: { [key: string]: string },\n data?: any,\n responseType: ResponseType = 'json'\n ): Promise<RestResponse<R>> {\n return this.request<R>('GET', url, { params, headers, data, responseType });\n }\n\n async post<R>(\n url: string,\n params?: any,\n headers?: { [key: string]: string },\n data?: any,\n responseType: ResponseType = 'json'\n ): Promise<RestResponse<R>> {\n if (!headers) {\n headers = await this.buildHeadersForJsonRequest();\n } else {\n const authHeader = await this.buildHeadersForRequest();\n headers = { ...headers, ...authHeader };\n }\n return new RestResponse<R>(\n axios.post<R>(this.serverUrl + url, this.toRequestData(data, headers), { params, headers, responseType })\n );\n }\n\n // Server-Sent Events are consumed with the Fetch API instead of axios so the\n // response body can be read incrementally as a stream in both browser and Node\n // (18+) runtimes. An event stream stays open until the server closes it, so\n // callers that may need to stop early (component unmount, timeout, user\n // cancel) should pass a `signal` — aborting it fails the pending read and\n // ends the iteration instead of hanging on a read that never completes.\n async postEventStream(\n url: string,\n params?: { [key: string]: any },\n headers?: { [key: string]: string },\n data?: any,\n signal?: AbortSignal\n ): Promise<AsyncIterable<ServerSentEvent>> {\n const authHeader = await this.buildHeadersForRequest();\n const requestHeaders: { [key: string]: string } = {\n ...headers,\n ...authHeader,\n Accept: MediaType.EVENT_STREAM\n };\n if (data !== undefined && data !== null && !requestHeaders['Content-Type']) {\n requestHeaders['Content-Type'] = MediaType.JSON;\n }\n const response = await fetch(this.serverUrl + url + this.toQueryString(params), {\n method: 'POST',\n headers: requestHeaders,\n body: data !== undefined && data !== null ? JSON.stringify(data) : undefined,\n signal\n });\n if (!response.ok) {\n const details = await RestClient.readErrorBody(response);\n throw new Error(\n `Event stream request to ${url} failed with status ${response.status} ${response.statusText}${details}`\n );\n }\n if (!response.body) {\n throw new Error(`Event stream request to ${url} returned an empty response body`);\n }\n return parseServerSentEvents(response.body);\n }\n\n // An error response carries a body explaining what went wrong; without it the\n // caller only sees a bare status code. The body is untrusted and potentially\n // large, so it is trimmed to a bounded slice before being put on the Error.\n private static async readErrorBody(response: Response): Promise<string> {\n let body: string;\n try {\n body = (await response.text()).trim();\n } catch {\n // Body already consumed, or the connection failed mid-read — the status\n // line is still worth throwing on its own.\n return '';\n }\n if (!body) {\n return '';\n }\n const slice =\n body.length > RestClient.MAX_ERROR_BODY_LENGTH ? `${body.slice(0, RestClient.MAX_ERROR_BODY_LENGTH)}…` : body;\n return `: ${slice}`;\n }\n\n private toQueryString(params?: { [key: string]: any }): string {\n if (!params) {\n return '';\n }\n const search = new URLSearchParams();\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n search.append(key, String(value));\n }\n }\n const query = search.toString();\n return query ? `?${query}` : '';\n }\n\n async delete(\n url: string,\n data?: any,\n params?: any,\n headers?: { [key: string]: string }\n ): Promise<RestResponse<void>> {\n return this.request<void>('DELETE', url, { data, params, headers });\n }\n\n async patch<R>(url: string, data?: any, headers?: { [key: string]: string }): Promise<RestResponse<R>> {\n return this.request<R>('PATCH', url, { data, headers });\n }\n\n async put<R>(url: string, data: any, headers?: { [key: string]: string }): Promise<RestResponse<R>> {\n return this.request<R>('PUT', url, { data, headers });\n }\n\n toHeader(acceptMimeType: MediaType, contentType?: string): { [key: string]: string } {\n if (contentType) {\n return { Accept: acceptMimeType, 'Content-Type': contentType };\n }\n return { Accept: acceptMimeType };\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
'use strict';var chunkC255MF6C_js=require('./chunk-C255MF6C.js'),P=require('fs');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var P__namespace=/*#__PURE__*/_interopNamespace(P);var s=class{constructor(t,e){this.restClient=t;this.parentEndpoint=e;this.ENDPOINT=this.parentEndpoint+"/binary";}ENDPOINT;async getAsXlsx(){return (await this.restClient.get(this.ENDPOINT,{},this.restClient.toHeader("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),null,"blob")).toFile()}async getAsDocx(){return (await this.restClient.get(this.ENDPOINT,{},this.restClient.toHeader("application/vnd.openxmlformats-officedocument.wordprocessingml.document"),null,"blob")).toFile()}async getAsPdf(){return (await this.restClient.get(this.ENDPOINT,{},this.restClient.toHeader("application/pdf"),null,"blob")).toFile()}};var a=class{constructor(t,e,i){this.restClient=t;this.parentEndpoint=e;this.configurationid=i;this.ENDPOINT=this.parentEndpoint+`/configurations/${this.configurationid}`;}ENDPOINT;async get(){return (await this.restClient.get(this.ENDPOINT,{},this.restClient.toHeader("application/json"))).toModel()}async delete(){return await this.restClient.delete(this.ENDPOINT)}async patch(t){return (await this.restClient.patch(this.ENDPOINT,t)).toModel()}};var l=class{constructor(t,e){this.restClient=t;this.parentEndpoint=e;this.ENDPOINT=this.parentEndpoint+"/configurations";}ENDPOINT;async get(){return (await this.restClient.get(this.ENDPOINT,{},this.restClient.toHeader("application/json"))).toModel()}async delete(){return await this.restClient.delete(this.ENDPOINT)}async post(t){return (await this.restClient.post(this.ENDPOINT,{},this.restClient.toHeader("application/json"),t)).toModel()}};var p=class{constructor(t,e){this.restClient=t;this.parentEndpoint=e;this.ENDPOINT=this.parentEndpoint+"/events";}ENDPOINT;async get(){return (await this.restClient.get(this.ENDPOINT,{},this.restClient.toHeader("application/json"))).toModel()}async post(t,e){return (await this.restClient.post(this.ENDPOINT,e,this.restClient.toHeader("application/json"),t)).toModel()}};var u=class{constructor(t,e){this.restClient=t;this.parentEndpoint=e;this.ENDPOINT=this.parentEndpoint+"/screenshots";}ENDPOINT;async getAsPng(t){return (await this.restClient.get(this.ENDPOINT,t,this.restClient.toHeader("image/png"),null,"blob")).toFile()}};var c=class{constructor(t,e,i){this.restClient=t;this.parentEndpoint=e;this.documentstructureid=i;this.ENDPOINT=this.parentEndpoint+`/documentstructures/${this.documentstructureid}`;}ENDPOINT;binary(){return new s(this.restClient,this.ENDPOINT)}events(){return new p(this.restClient,this.ENDPOINT)}screenshots(){return new u(this.restClient,this.ENDPOINT)}async get(){return (await this.restClient.get(this.ENDPOINT,{},this.restClient.toHeader("application/json"))).toModel()}async getAsReqifz(){return (await this.restClient.get(this.ENDPOINT,{},this.restClient.toHeader("application/reqifz"),null,"blob")).toFile()}async delete(){return await this.restClient.delete(this.ENDPOINT)}async patch(t){return (await this.restClient.patch(this.ENDPOINT,t)).toModel()}async put(t){return (await this.restClient.put(this.ENDPOINT,t)).toModel()}};var d=class{constructor(t,e){this.restClient=t;this.parentEndpoint=e;this.ENDPOINT=this.parentEndpoint+"/documentstructures";}ENDPOINT;async get(t){return (await this.restClient.get(this.ENDPOINT,t,this.restClient.toHeader("application/json"))).toModel()}async delete(){return await this.restClient.delete(this.ENDPOINT)}async post(t){return (await this.restClient.post(this.ENDPOINT,{},this.restClient.toHeader("application/json","multipart/form-data"),t)).toModel()}};var m=class{constructor(t,e,i){this.restClient=t;this.parentEndpoint=e;this.domainname=i;this.ENDPOINT=this.parentEndpoint+`/domains/${this.domainname}`;}ENDPOINT;configurations(t){return t!=null?new a(this.restClient,this.ENDPOINT,t):new l(this.restClient,this.ENDPOINT)}documentstructures(t){return t!=null?new c(this.restClient,this.ENDPOINT,t):new d(this.restClient,this.ENDPOINT)}};var h=class{constructor(t,e){this.restClient=t;this.parentEndpoint=e;this.ENDPOINT=this.parentEndpoint+"/domains";}ENDPOINT};var g=class{constructor(t,e){this.restClient=t;this.parentEndpoint=e;this.ENDPOINT=this.parentEndpoint+"/structurenavigator";}ENDPOINT;domains(t){return t!=null?new m(this.restClient,this.ENDPOINT,t):new h(this.restClient,this.ENDPOINT)}};var E="/api",C=class r{constructor(t,e){this.restClient=t;this.parentEndpoint=e;}static loginWithApiKey(t,e){if(!e)throw new Error("You need to supply an API key to login.");if(!t)throw new Error("You need to supply a server url to login.");return new r(new chunkC255MF6C_js.e(this.parseServerUrl(t),e),E)}static loginWithAuthProxy(t){if(!t)throw new Error("You need to supply a server url to login.");return new r(new chunkC255MF6C_js.e(this.parseServerUrl(t)),E)}static loginWithCredentials(t,e,i,N){return t=this.parseServerUrl(t),new r(new chunkC255MF6C_js.e(t,void 0,e,i,N),E)}static loginWithCredentialsFile(t){if(t.endsWith(".properties")||t.endsWith(".PROPERTIES")){let i=P__namespace.readFileSync(t,"utf8").split(/[\n|\r\n]/).filter(f=>f.length!==0).map(f=>f.split("=")),N=this.getValueOfInPropertiesFile("serverUrl",i),D=this.getValueOfInPropertiesFile("clientId",i),O=this.getValueOfInPropertiesFile("clientSecret",i),v=this.getValueOfInPropertiesFile("tokenUrl",i);return r.loginWithCredentials(N,D,O,v)}throw new Error("Can not login, please supply a credentials properties file.")}static parseServerUrl(t){return t.endsWith("/")&&(t=t.slice(0,-1)),t.endsWith("/tt-platform-ui/en/#")?t=t.replace("/tt-platform-ui/en/#","/tt-product-server"):t.endsWith("/tt-product-server")||(t+="/tt-product-server"),t}static getValueOfInPropertiesFile(t,e){for(let i of e)if(i[0]===t)return i[1].replace("\\:",":");throw Error(`.properties files contains no ${t}!`)}endpoint(){return this.parentEndpoint}structurenavigator(){return new g(this.restClient,this.endpoint())}};exports.a=s;exports.b=a;exports.c=l;exports.d=p;exports.e=u;exports.f=c;exports.g=d;exports.h=m;exports.i=h;exports.j=g;exports.k=C;//# sourceMappingURL=chunk-5MXQ6XTH.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-5MXQ6XTH.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../semantha-product-sdk/structure-navigator/api/binary.ts","../semantha-product-sdk/structure-navigator/api/configuration.ts","../semantha-product-sdk/structure-navigator/api/configurations.ts","../semantha-product-sdk/structure-navigator/api/events.ts","../semantha-product-sdk/structure-navigator/api/screenshots.ts","../semantha-product-sdk/structure-navigator/api/documentstructure.ts","../semantha-product-sdk/structure-navigator/api/documentstructures.ts","../semantha-product-sdk/structure-navigator/api/domain.ts","../semantha-product-sdk/structure-navigator/api/domains.ts","../semantha-product-sdk/structure-navigator/api/structurenavigator.ts","../semantha-product-sdk/structure-navigator/api/structureNavigatorAPI.ts"],"names":["BinaryEndpoint","restClient","parentEndpoint","ConfigurationEndpoint","configurationid","body","ConfigurationsEndpoint","EventsEndpoint","params","ScreenshotsEndpoint","DocumentstructureEndpoint","documentstructureid","DocumentstructuresEndpoint","data","DomainEndpoint","domainname","DomainsEndpoint","StructurenavigatorEndpoint","PARENT_ENDPOINT","StructureNavigatorAPI","_StructureNavigatorAPI","serverUrl","apiKey","RestClient","clientId","clientSecret","tokenUrl","credentialsFilePath","lines","P","line","searchKey"],"mappings":"ubASO,IAAMA,CAAAA,CAAN,KAAqB,CAG1B,WAAA,CACmBC,CAAAA,CACAC,EACjB,CAFiB,IAAA,CAAA,UAAA,CAAAD,CAAAA,CACA,IAAA,C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BAAA,CAAqBC,CAAAA,CAAWG,CAAAA,CAAUC,EAAcC,CAAQ,CAC/F,CACG,MAAM,IAAI,KAAA,CAAM,6DAA6D,CAC/E,CAEA,OAAe,cAAA,CAAeL,CAAAA,CAA2B,CACvD,OAAIA,EAAU,QAAA,CAAS,GAAG,CAAA,GACxBA,CAAAA,CAAYA,CAAAA,CAAU,KAAA,CAAM,CAAA,CAAG,EAAE,CAAA,CAAA,CAE/BA,CAAAA,CAAU,QAAA,CAAS,sBAAsB,CAAA,CAC3CA,CAAAA,CAAYA,EAAU,OAAA,CAAQ,sBAAA,CAAwB,oBAAoB,CAAA,CAChEA,CAAAA,CAAU,QAAA,CAAS,oBAAoB,CAAA,GACjDA,CAAAA,EAAa,oBAAA,CAAA,CAERA,CACT,CAEA,OAAe,0BAAA,CAA2BU,EAAmBH,CAAAA,CAA2B,CACtF,IAAA,IAAWE,CAAAA,IAAQF,CAAAA,CACjB,GAAIE,CAAAA,CAAK,CAAC,CAAA,GAAMC,CAAAA,CACd,OAAOD,CAAAA,CAAK,CAAC,CAAA,CAAE,QAAQ,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,kBAAA,EAAiD,CAC/C,OAAO,IAAId,CAAAA,CAA2B,IAAA,CAAK,UAAA,CAAY,IAAA,CAAK,QAAA,EAAU,CACxE,CAEF","file":"chunk-CULSSUTK.js","sourcesContent":["import { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/structurenavigator/domains/{domainname}/documentstructures/{documentstructureid}/binary\"\n * This is a generated file do not change manually!\n */\nexport class BinaryEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/binary\";\n }\n\n /**\n * Returns the input document.\n */\n async getAsXlsx(): Promise<Blob> {\n return (\n await this.restClient.get<Blob>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.XLSX),\n null,\n \"blob\"\n )\n ).toFile();\n }\n /**\n * Returns the input document.\n */\n async getAsDocx(): Promise<Blob> {\n return (\n await this.restClient.get<Blob>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.DOCX),\n null,\n \"blob\"\n )\n ).toFile();\n }\n /**\n * Returns the input document.\n */\n async getAsPdf(): Promise<Blob> {\n return (\n await this.restClient.get<Blob>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.PDF),\n null,\n \"blob\"\n )\n ).toFile();\n }\n}\n","import { Configuration } from '../model';\nimport { ConfigurationUpdate } from '../model';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/structurenavigator/domains/{domainname}/configurations/{configurationid}\"\n * This is a generated file do not change manually!\n */\nexport class ConfigurationEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n private readonly configurationid: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/configurations\" + `/${this.configurationid}`;\n }\n\n /**\n * Returns the configuration for the given id.\n */\n async get(): Promise<Configuration> {\n return (\n await this.restClient.get<Configuration>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.JSON)\n )\n ).toModel();\n }\n\n /**\n * Delete a given configuration. Needs roles: 'Advanced User', 'Domain Admin' or 'Expert User'\n */\n async delete() {\n return await this.restClient.delete(this.ENDPOINT);\n }\n\n /**\n * Make changes to an existing configuration. Needs roles: 'Advanced User', 'Domain Admin' or 'Expert User'\n *\n * @param body ConfigurationUpdate - \n */\n async patch(\n body: ConfigurationUpdate,\n ): Promise<Configuration> {\n return (\n await this.restClient.patch<Configuration>(\n this.ENDPOINT,\n body\n )\n ).toModel();\n }\n}\n","import { Configuration } from '../model';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/structurenavigator/domains/{domainname}/configurations\"\n * This is a generated file do not change manually!\n */\nexport class ConfigurationsEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/configurations\";\n }\n\n /**\n * Returns all configurations.\n */\n async get(): Promise<Configuration[]> {\n return (\n await this.restClient.get<Configuration[]>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.JSON)\n )\n ).toModel();\n }\n\n /**\n * Delete all configurations. Needs roles: 'Advanced User', 'Domain Admin' or 'Expert User'\n */\n async delete() {\n return await this.restClient.delete(this.ENDPOINT);\n }\n\n /**\n * Creates a new configuration. Needs roles: 'Advanced User', 'Domain Admin' or 'Expert User'\n *\n * @param body Configuration? - \n */\n async post(\n body?: Configuration,\n ): Promise<Configuration> {\n return (\n await this.restClient.post<Configuration>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.JSON),\n body\n )\n ).toModel();\n }\n}\n","import { Event } from '../model';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/structurenavigator/domains/{domainname}/documentstructures/{documentstructureid}/events\"\n * This is a generated file do not change manually!\n */\nexport class EventsEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/events\";\n }\n\n /**\n * Returns all events of given document structure\n */\n async get(): Promise<Event[]> {\n return (\n await this.restClient.get<Event[]>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.JSON)\n )\n ).toModel();\n }\n\n /**\n * Creates a new event for a document structure.\n *\n * @param body Event? - \n */\n async post(\n body: Event,\n params?: {\n lasteventid?: string,\n }): Promise<Event> {\n return (\n await this.restClient.post<Event>(\n this.ENDPOINT,\n params,\n this.restClient.toHeader(MediaType.JSON),\n body\n )\n ).toModel();\n }\n}\n","import { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/structurenavigator/domains/{domainname}/documentstructures/{documentstructureid}/screenshots\"\n * This is a generated file do not change manually!\n */\nexport class ScreenshotsEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/screenshots\";\n }\n\n /**\n * Returns a 'screenshot' of a page of the given document structure\n *\n * @param page number? - Number of the page to create a screenshot. Zero based\n * @param x number? - X position of the area to screenshot.\n * @param y number? - Y position of the area to screenshot.\n * @param width number? - Width of the area to screenshot.\n * @param height number? - Height of the area to screenshot.\n */\n async getAsPng(params?: {\n page?: number,\n x?: number,\n y?: number,\n width?: number,\n height?: number,\n }): Promise<Blob> {\n return (\n await this.restClient.get<Blob>(\n this.ENDPOINT,\n params,\n this.restClient.toHeader(MediaType.PNG),\n null,\n \"blob\"\n )\n ).toFile();\n }\n}\n","import { BinaryEndpoint } from './binary';\nimport { DocumentStructure } from '../model';\nimport { DocumentStructureOverview } from '../model';\nimport { DocumentStructureReplaceSections } from '../model';\nimport { DocumentStructureUpdate } from '../model';\nimport { EventsEndpoint } from './events';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\nimport { ScreenshotsEndpoint } from './screenshots';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/structurenavigator/domains/{domainname}/documentstructures/{documentstructureid}\"\n * This is a generated file do not change manually!\n */\nexport class DocumentstructureEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n private readonly documentstructureid: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/documentstructures\" + `/${this.documentstructureid}`;\n }\n\n binary(): BinaryEndpoint {\n return new BinaryEndpoint(this.restClient, this.ENDPOINT);\n }\n\n events(): EventsEndpoint {\n return new EventsEndpoint(this.restClient, this.ENDPOINT);\n }\n\n screenshots(): ScreenshotsEndpoint {\n return new ScreenshotsEndpoint(this.restClient, this.ENDPOINT);\n }\n\n /**\n * Returns the document structure for the given id.\n */\n async get(): Promise<DocumentStructure> {\n return (\n await this.restClient.get<DocumentStructure>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.JSON)\n )\n ).toModel();\n }\n /**\n * Returns the document structure for the given id.\n */\n async getAsReqifz(): Promise<Blob> {\n return (\n await this.restClient.get<Blob>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.REQIFZ),\n null,\n \"blob\"\n )\n ).toFile();\n }\n\n /**\n * Delete a given document structure.\n */\n async delete() {\n return await this.restClient.delete(this.ENDPOINT);\n }\n\n /**\n * Make changes to an existing document structure.\n *\n * @param body DocumentStructureUpdate - \n */\n async patch(\n body: DocumentStructureUpdate,\n ): Promise<DocumentStructureOverview> {\n return (\n await this.restClient.patch<DocumentStructureOverview>(\n this.ENDPOINT,\n body\n )\n ).toModel();\n }\n\n /**\n * Replace paragraphs of an existing document structure.\n *\n * @param body DocumentStructureReplaceSections - \n */\n async put(\n body: DocumentStructureReplaceSections,\n ): Promise<DocumentStructureOverview> {\n return (\n await this.restClient.put<DocumentStructureOverview>(\n this.ENDPOINT,\n body\n )\n ).toModel();\n }\n}\n","import { DocumentStructureOverview } from '../model';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/structurenavigator/domains/{domainname}/documentstructures\"\n * This is a generated file do not change manually!\n */\nexport class DocumentstructuresEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/documentstructures\";\n }\n\n /**\n * Returns an overview of all available document structures.\n *\n * @param customfield string? - \n * @param customfieldvalues string? - \n */\n async get(params?: {\n customfield?: string,\n customfieldvalues?: string,\n }): Promise<DocumentStructureOverview[]> {\n return (\n await this.restClient.get<DocumentStructureOverview[]>(\n this.ENDPOINT,\n params,\n this.restClient.toHeader(MediaType.JSON)\n )\n ).toModel();\n }\n\n /**\n * Delete all document structures. Needs role: 'Domain Admin'\n */\n async delete() {\n return await this.restClient.delete(this.ENDPOINT);\n }\n\n /**\n * Creates a new document structure.\n *\n * @param file Blob? - \n * @param name string? - \n * @param publicaccess boolean? - \n * @param configurationid string? - \n */\n async post(data: {\n file?: Blob,\n name?: string,\n publicaccess?: boolean,\n configurationid?: string,\n }): Promise<DocumentStructureOverview> {\n return (\n await this.restClient.post<DocumentStructureOverview>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.JSON, \"multipart/form-data\"),\n data\n )\n ).toModel();\n }\n}\n","import { ConfigurationEndpoint } from './configuration';\nimport { ConfigurationsEndpoint } from './configurations';\nimport { DocumentstructureEndpoint } from './documentstructure';\nimport { DocumentstructuresEndpoint } from './documentstructures';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/structurenavigator/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 configurations(): ConfigurationsEndpoint;\n configurations(configurationid: string): ConfigurationEndpoint\n \n configurations(configurationid?: string): ConfigurationEndpoint | ConfigurationsEndpoint {\n if(configurationid !== undefined && configurationid !== null) {\n\t return new ConfigurationEndpoint(this.restClient, this.ENDPOINT, configurationid);\n } else {\n\t return new ConfigurationsEndpoint(this.restClient, this.ENDPOINT);\n }\n }\n\n documentstructures(): DocumentstructuresEndpoint;\n documentstructures(documentstructureid: string): DocumentstructureEndpoint\n \n documentstructures(documentstructureid?: string): DocumentstructureEndpoint | DocumentstructuresEndpoint {\n if(documentstructureid !== undefined && documentstructureid !== null) {\n\t return new DocumentstructureEndpoint(this.restClient, this.ENDPOINT, documentstructureid);\n } else {\n\t return new DocumentstructuresEndpoint(this.restClient, this.ENDPOINT);\n }\n }\n}\n","import { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/structurenavigator/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/structurenavigator\"\n * This is a generated file do not change manually!\n */\nexport class StructurenavigatorEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/structurenavigator\";\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 { StructurenavigatorEndpoint } from './structurenavigator';\nimport { RestClient } from '../../rest';\n\nconst PARENT_ENDPOINT = '/api';\n\n/**\n * Entry point to the StructureNavigator API.\n *\n * @author semantha\n * Calls the /structurenavigator, 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 StructureNavigatorAPI {\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string\n ) {\n }\n\n /**\n * Access to the StructureNavigator API\n *\n * @param serverUrl: string - URL to the StructureNavigator server.\n * @param apiKey: string - A valid bearer token for accessing the given url.\n *\n * @return StructureNavigatorAPI: Entry point to the StructureNavigator API.\n */\n static loginWithApiKey(\n serverUrl: string,\n apiKey: string\n ): StructureNavigatorAPI {\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 StructureNavigatorAPI(new RestClient(this.parseServerUrl(serverUrl), apiKey), PARENT_ENDPOINT);\n }\n\n\n /**\n * Access to the StructureNavigator 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 StructureNavigator server.\n *\n * @return StructureNavigatorAPI: Entry point to the StructureNavigator API.\n */\n static loginWithAuthProxy(\n serverUrl: string\n ): StructureNavigatorAPI {\n if(!serverUrl) {\n throw new Error('You need to supply a server url to login.');\n }\n return new StructureNavigatorAPI(new RestClient(this.parseServerUrl(serverUrl)), PARENT_ENDPOINT);\n }\n\n /**\n * Access to the StructureNavigator API\n *\n * @param serverUrl: string - URL to the StructureNavigator 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 StructureNavigatorAPI: Entry point to the StructureNavigator API.\n */\n static loginWithCredentials(\n serverUrl: string,\n clientId: string,\n clientSecret: string,\n tokenUrl: string\n ): StructureNavigatorAPI {\n serverUrl = this.parseServerUrl(serverUrl);\n return new StructureNavigatorAPI(new RestClient(serverUrl, undefined, clientId, clientSecret, tokenUrl), PARENT_ENDPOINT);\n }\n\t\n /**\n * Access to the StructureNavigator API\n *\n * @param credentialsFilePath: string - Path to a properties file providing client credentials.\n *\n * @return StructureNavigatorAPI: Entry point to the StructureNavigator API.\n */\n static loginWithCredentialsFile(credentialsFilePath: string) : StructureNavigatorAPI {\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 StructureNavigatorAPI.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 structurenavigator(): StructurenavigatorEndpoint {\n return new StructurenavigatorEndpoint(this.restClient, this.endpoint());\n }\n\n}"]}
|
|
1
|
+
{"version":3,"sources":["../semantha-product-sdk/structure-navigator/api/binary.ts","../semantha-product-sdk/structure-navigator/api/configuration.ts","../semantha-product-sdk/structure-navigator/api/configurations.ts","../semantha-product-sdk/structure-navigator/api/events.ts","../semantha-product-sdk/structure-navigator/api/screenshots.ts","../semantha-product-sdk/structure-navigator/api/documentstructure.ts","../semantha-product-sdk/structure-navigator/api/documentstructures.ts","../semantha-product-sdk/structure-navigator/api/domain.ts","../semantha-product-sdk/structure-navigator/api/domains.ts","../semantha-product-sdk/structure-navigator/api/structurenavigator.ts","../semantha-product-sdk/structure-navigator/api/structureNavigatorAPI.ts"],"names":["BinaryEndpoint","restClient","parentEndpoint","ConfigurationEndpoint","configurationid","body","ConfigurationsEndpoint","EventsEndpoint","params","ScreenshotsEndpoint","DocumentstructureEndpoint","documentstructureid","DocumentstructuresEndpoint","data","DomainEndpoint","domainname","DomainsEndpoint","StructurenavigatorEndpoint","PARENT_ENDPOINT","StructureNavigatorAPI","_StructureNavigatorAPI","serverUrl","apiKey","RestClient","clientId","clientSecret","tokenUrl","credentialsFilePath","lines","P","line","searchKey"],"mappings":"ubASO,IAAMA,CAAAA,CAAN,KAAqB,CAG1B,WAAA,CACmBC,CAAAA,CACAC,EACjB,CAFiB,IAAA,CAAA,UAAA,CAAAD,CAAAA,CACA,IAAA,CAAA,cAAA,CAAAC,CAAAA,CAEjB,IAAA,CAAK,SAAW,IAAA,CAAK,cAAA,CAAiB,UACxC,CAPiB,QAAA,CAYjB,MAAM,SAAA,EAA2B,CAC/B,OAAA,CACE,MAAM,IAAA,CAAK,UAAA,CAAW,GAAA,CACpB,IAAA,CAAK,SACL,EAAC,CACD,IAAA,CAAK,UAAA,CAAW,QAAA,CAAA,mEAAuB,CAAA,CACvC,IAAA,CACA,MACF,CAAA,EACA,MAAA,EACJ,CAIA,MAAM,SAAA,EAA2B,CAC/B,OAAA,CACE,MAAM,IAAA,CAAK,UAAA,CAAW,GAAA,CACpB,IAAA,CAAK,QAAA,CACL,EAAC,CACD,IAAA,CAAK,UAAA,CAAW,QAAA,CAAA,yEAAuB,CAAA,CACvC,IAAA,CACA,MACF,CAAA,EACA,MAAA,EACJ,CAIA,MAAM,QAAA,EAA0B,CAC9B,OAAA,CACE,MAAM,IAAA,CAAK,UAAA,CAAW,GAAA,CACpB,IAAA,CAAK,SACL,EAAC,CACD,IAAA,CAAK,UAAA,CAAW,QAAA,CAAA,iBAAsB,CAAA,CACtC,IAAA,CACA,MACF,CAAA,EACA,MAAA,EACJ,CACF,EClDO,IAAMC,EAAN,KAA4B,CAGjC,WAAA,CACmBF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CAEA,QAAA,EAAmB,CACjB,OAAO,IAAA,CAAK,cACd,CAEA,kBAAA,EAAiD,CAC/C,OAAO,IAAId,CAAAA,CAA2B,IAAA,CAAK,UAAA,CAAY,IAAA,CAAK,QAAA,EAAU,CACxE,CAEF","file":"chunk-5MXQ6XTH.js","sourcesContent":["import { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/structurenavigator/domains/{domainname}/documentstructures/{documentstructureid}/binary\"\n * This is a generated file do not change manually!\n */\nexport class BinaryEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/binary\";\n }\n\n /**\n * Returns the input document.\n */\n async getAsXlsx(): Promise<Blob> {\n return (\n await this.restClient.get<Blob>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.XLSX),\n null,\n \"blob\"\n )\n ).toFile();\n }\n /**\n * Returns the input document.\n */\n async getAsDocx(): Promise<Blob> {\n return (\n await this.restClient.get<Blob>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.DOCX),\n null,\n \"blob\"\n )\n ).toFile();\n }\n /**\n * Returns the input document.\n */\n async getAsPdf(): Promise<Blob> {\n return (\n await this.restClient.get<Blob>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.PDF),\n null,\n \"blob\"\n )\n ).toFile();\n }\n}\n","import { Configuration } from '../model';\nimport { ConfigurationUpdate } from '../model';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/structurenavigator/domains/{domainname}/configurations/{configurationid}\"\n * This is a generated file do not change manually!\n */\nexport class ConfigurationEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n private readonly configurationid: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/configurations\" + `/${this.configurationid}`;\n }\n\n /**\n * Returns the configuration for the given id.\n */\n async get(): Promise<Configuration> {\n return (\n await this.restClient.get<Configuration>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.JSON)\n )\n ).toModel();\n }\n\n /**\n * Delete a given configuration. Needs roles: 'Advanced User', 'Domain Admin' or 'Expert User'\n */\n async delete() {\n return await this.restClient.delete(this.ENDPOINT);\n }\n\n /**\n * Make changes to an existing configuration. Needs roles: 'Advanced User', 'Domain Admin' or 'Expert User'\n *\n * @param body ConfigurationUpdate - \n */\n async patch(\n body: ConfigurationUpdate,\n ): Promise<Configuration> {\n return (\n await this.restClient.patch<Configuration>(\n this.ENDPOINT,\n body\n )\n ).toModel();\n }\n}\n","import { Configuration } from '../model';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/structurenavigator/domains/{domainname}/configurations\"\n * This is a generated file do not change manually!\n */\nexport class ConfigurationsEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/configurations\";\n }\n\n /**\n * Returns all configurations.\n */\n async get(): Promise<Configuration[]> {\n return (\n await this.restClient.get<Configuration[]>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.JSON)\n )\n ).toModel();\n }\n\n /**\n * Delete all configurations. Needs roles: 'Advanced User', 'Domain Admin' or 'Expert User'\n */\n async delete() {\n return await this.restClient.delete(this.ENDPOINT);\n }\n\n /**\n * Creates a new configuration. Needs roles: 'Advanced User', 'Domain Admin' or 'Expert User'\n *\n * @param body Configuration? - \n */\n async post(\n body?: Configuration,\n ): Promise<Configuration> {\n return (\n await this.restClient.post<Configuration>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.JSON),\n body\n )\n ).toModel();\n }\n}\n","import { Event } from '../model';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/structurenavigator/domains/{domainname}/documentstructures/{documentstructureid}/events\"\n * This is a generated file do not change manually!\n */\nexport class EventsEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/events\";\n }\n\n /**\n * Returns all events of given document structure\n */\n async get(): Promise<Event[]> {\n return (\n await this.restClient.get<Event[]>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.JSON)\n )\n ).toModel();\n }\n\n /**\n * Creates a new event for a document structure.\n *\n * @param body Event? - \n */\n async post(\n body: Event,\n params?: {\n lasteventid?: string,\n }): Promise<Event> {\n return (\n await this.restClient.post<Event>(\n this.ENDPOINT,\n params,\n this.restClient.toHeader(MediaType.JSON),\n body\n )\n ).toModel();\n }\n}\n","import { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/structurenavigator/domains/{domainname}/documentstructures/{documentstructureid}/screenshots\"\n * This is a generated file do not change manually!\n */\nexport class ScreenshotsEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/screenshots\";\n }\n\n /**\n * Returns a 'screenshot' of a page of the given document structure\n *\n * @param page number? - Number of the page to create a screenshot. Zero based\n * @param x number? - X position of the area to screenshot.\n * @param y number? - Y position of the area to screenshot.\n * @param width number? - Width of the area to screenshot.\n * @param height number? - Height of the area to screenshot.\n */\n async getAsPng(params?: {\n page?: number,\n x?: number,\n y?: number,\n width?: number,\n height?: number,\n }): Promise<Blob> {\n return (\n await this.restClient.get<Blob>(\n this.ENDPOINT,\n params,\n this.restClient.toHeader(MediaType.PNG),\n null,\n \"blob\"\n )\n ).toFile();\n }\n}\n","import { BinaryEndpoint } from './binary';\nimport { DocumentStructure } from '../model';\nimport { DocumentStructureOverview } from '../model';\nimport { DocumentStructureReplaceSections } from '../model';\nimport { DocumentStructureUpdate } from '../model';\nimport { EventsEndpoint } from './events';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\nimport { ScreenshotsEndpoint } from './screenshots';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/structurenavigator/domains/{domainname}/documentstructures/{documentstructureid}\"\n * This is a generated file do not change manually!\n */\nexport class DocumentstructureEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n private readonly documentstructureid: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/documentstructures\" + `/${this.documentstructureid}`;\n }\n\n binary(): BinaryEndpoint {\n return new BinaryEndpoint(this.restClient, this.ENDPOINT);\n }\n\n events(): EventsEndpoint {\n return new EventsEndpoint(this.restClient, this.ENDPOINT);\n }\n\n screenshots(): ScreenshotsEndpoint {\n return new ScreenshotsEndpoint(this.restClient, this.ENDPOINT);\n }\n\n /**\n * Returns the document structure for the given id.\n */\n async get(): Promise<DocumentStructure> {\n return (\n await this.restClient.get<DocumentStructure>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.JSON)\n )\n ).toModel();\n }\n /**\n * Returns the document structure for the given id.\n */\n async getAsReqifz(): Promise<Blob> {\n return (\n await this.restClient.get<Blob>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.REQIFZ),\n null,\n \"blob\"\n )\n ).toFile();\n }\n\n /**\n * Delete a given document structure.\n */\n async delete() {\n return await this.restClient.delete(this.ENDPOINT);\n }\n\n /**\n * Make changes to an existing document structure.\n *\n * @param body DocumentStructureUpdate - \n */\n async patch(\n body: DocumentStructureUpdate,\n ): Promise<DocumentStructureOverview> {\n return (\n await this.restClient.patch<DocumentStructureOverview>(\n this.ENDPOINT,\n body\n )\n ).toModel();\n }\n\n /**\n * Replace paragraphs of an existing document structure.\n *\n * @param body DocumentStructureReplaceSections - \n */\n async put(\n body: DocumentStructureReplaceSections,\n ): Promise<DocumentStructureOverview> {\n return (\n await this.restClient.put<DocumentStructureOverview>(\n this.ENDPOINT,\n body\n )\n ).toModel();\n }\n}\n","import { DocumentStructureOverview } from '../model';\nimport { MediaType } from '../../rest';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/structurenavigator/domains/{domainname}/documentstructures\"\n * This is a generated file do not change manually!\n */\nexport class DocumentstructuresEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/documentstructures\";\n }\n\n /**\n * Returns an overview of all available document structures.\n *\n * @param customfield string? - \n * @param customfieldvalues string? - \n */\n async get(params?: {\n customfield?: string,\n customfieldvalues?: string,\n }): Promise<DocumentStructureOverview[]> {\n return (\n await this.restClient.get<DocumentStructureOverview[]>(\n this.ENDPOINT,\n params,\n this.restClient.toHeader(MediaType.JSON)\n )\n ).toModel();\n }\n\n /**\n * Delete all document structures. Needs role: 'Domain Admin'\n */\n async delete() {\n return await this.restClient.delete(this.ENDPOINT);\n }\n\n /**\n * Creates a new document structure.\n *\n * @param file Blob? - \n * @param name string? - \n * @param publicaccess boolean? - \n * @param configurationid string? - \n */\n async post(data: {\n file?: Blob,\n name?: string,\n publicaccess?: boolean,\n configurationid?: string,\n }): Promise<DocumentStructureOverview> {\n return (\n await this.restClient.post<DocumentStructureOverview>(\n this.ENDPOINT,\n {},\n this.restClient.toHeader(MediaType.JSON, \"multipart/form-data\"),\n data\n )\n ).toModel();\n }\n}\n","import { ConfigurationEndpoint } from './configuration';\nimport { ConfigurationsEndpoint } from './configurations';\nimport { DocumentstructureEndpoint } from './documentstructure';\nimport { DocumentstructuresEndpoint } from './documentstructures';\nimport { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/structurenavigator/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 configurations(): ConfigurationsEndpoint;\n configurations(configurationid: string): ConfigurationEndpoint\n \n configurations(configurationid?: string): ConfigurationEndpoint | ConfigurationsEndpoint {\n if(configurationid !== undefined && configurationid !== null) {\n\t return new ConfigurationEndpoint(this.restClient, this.ENDPOINT, configurationid);\n } else {\n\t return new ConfigurationsEndpoint(this.restClient, this.ENDPOINT);\n }\n }\n\n documentstructures(): DocumentstructuresEndpoint;\n documentstructures(documentstructureid: string): DocumentstructureEndpoint\n \n documentstructures(documentstructureid?: string): DocumentstructureEndpoint | DocumentstructuresEndpoint {\n if(documentstructureid !== undefined && documentstructureid !== null) {\n\t return new DocumentstructureEndpoint(this.restClient, this.ENDPOINT, documentstructureid);\n } else {\n\t return new DocumentstructuresEndpoint(this.restClient, this.ENDPOINT);\n }\n }\n}\n","import { RestClient } from '../../rest';\n\n/**\n * @author semantha\n *\n * Class to access resource \"/api/structurenavigator/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/structurenavigator\"\n * This is a generated file do not change manually!\n */\nexport class StructurenavigatorEndpoint {\n private readonly ENDPOINT: string;\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string,\n ) {\n this.ENDPOINT = this.parentEndpoint + \"/structurenavigator\";\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 { StructurenavigatorEndpoint } from './structurenavigator';\nimport { RestClient } from '../../rest';\n\nconst PARENT_ENDPOINT = '/api';\n\n/**\n * Entry point to the StructureNavigator API.\n *\n * @author semantha\n * Calls the /structurenavigator, 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 StructureNavigatorAPI {\n\n constructor(\n private readonly restClient: RestClient,\n private readonly parentEndpoint: string\n ) {\n }\n\n /**\n * Access to the StructureNavigator API\n *\n * @param serverUrl: string - URL to the StructureNavigator server.\n * @param apiKey: string - A valid bearer token for accessing the given url.\n *\n * @return StructureNavigatorAPI: Entry point to the StructureNavigator API.\n */\n static loginWithApiKey(\n serverUrl: string,\n apiKey: string\n ): StructureNavigatorAPI {\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 StructureNavigatorAPI(new RestClient(this.parseServerUrl(serverUrl), apiKey), PARENT_ENDPOINT);\n }\n\n\n /**\n * Access to the StructureNavigator 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 StructureNavigator server.\n *\n * @return StructureNavigatorAPI: Entry point to the StructureNavigator API.\n */\n static loginWithAuthProxy(\n serverUrl: string\n ): StructureNavigatorAPI {\n if(!serverUrl) {\n throw new Error('You need to supply a server url to login.');\n }\n return new StructureNavigatorAPI(new RestClient(this.parseServerUrl(serverUrl)), PARENT_ENDPOINT);\n }\n\n /**\n * Access to the StructureNavigator API\n *\n * @param serverUrl: string - URL to the StructureNavigator 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 StructureNavigatorAPI: Entry point to the StructureNavigator API.\n */\n static loginWithCredentials(\n serverUrl: string,\n clientId: string,\n clientSecret: string,\n tokenUrl: string\n ): StructureNavigatorAPI {\n serverUrl = this.parseServerUrl(serverUrl);\n return new StructureNavigatorAPI(new RestClient(serverUrl, undefined, clientId, clientSecret, tokenUrl), PARENT_ENDPOINT);\n }\n\t\n /**\n * Access to the StructureNavigator API\n *\n * @param credentialsFilePath: string - Path to a properties file providing client credentials.\n *\n * @return StructureNavigatorAPI: Entry point to the StructureNavigator API.\n */\n static loginWithCredentialsFile(credentialsFilePath: string) : StructureNavigatorAPI {\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 StructureNavigatorAPI.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 structurenavigator(): StructurenavigatorEndpoint {\n return new StructurenavigatorEndpoint(this.restClient, this.endpoint());\n }\n\n}"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';var l=require('axios');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var l__default=/*#__PURE__*/_interopDefault(l);var u=class{constructor(t){this.response=t;}async toModel(){return (await this.response).data}async toFile(){let t=await this.response,s=t?.headers["content-disposition"],e="file";if(s){let n=s.match(/filename="?([^"]+)"?/);n&&n[1]&&(e=n[1]);}return new File([t.data],e)}async getStatusCode(){return (await this.response).status}async getStatusText(){return (await this.response).statusText}},y=class{constructor(t,s,e,n){this.event=t;this.data=s;this.id=e;this.retry=n;}json(){return JSON.parse(this.data)}};function f(c){let t,s=[],e,n,r=false;for(let i of c.split(`
|
|
2
|
+
`)){if(i===""||i.startsWith(":"))continue;let a=i.indexOf(":"),d=a===-1?i:i.slice(0,a),p=a===-1?"":i.slice(a+1);switch(p.startsWith(" ")&&(p=p.slice(1)),r=true,d){case "event":t=p;break;case "data":s.push(p);break;case "id":e=p;break;case "retry":{let o=Number(p);Number.isNaN(o)||(n=o);break}}}return r?new y(t,s.join(`
|
|
3
|
+
`),e,n):void 0}async function*h(c){let t=c.getReader(),s=new TextDecoder,e="",n=function*(r){e=e.replace(/\r\n/g,`
|
|
4
|
+
`).replace(/\r/g,`
|
|
5
|
+
`);let i=e.indexOf(`
|
|
6
|
+
|
|
7
|
+
`);for(;i!==-1;){let a=f(e.slice(0,i));e=e.slice(i+2),a&&(yield a),i=e.indexOf(`
|
|
8
|
+
|
|
9
|
+
`);}if(r){let a=f(e);e="",a&&(yield a);}};try{let{value:r,done:i}=await t.read();for(;!i;)e+=s.decode(r,{stream:!0}),yield*n(!1),{value:r,done:i}=await t.read();e+=s.decode(),yield*n(!0);}finally{await t.cancel().catch(()=>{}),t.releaseLock();}}var g=(o=>(o.JSON="application/json",o.XLSX="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",o.PDF="application/pdf",o.DOCX="application/vnd.openxmlformats-officedocument.wordprocessingml.document",o.ZIP="application/zip",o.REQIFZ="application/reqifz",o.PNG="image/png",o.BINARY="application/octet-stream",o.TEXT_PLAIN="text/plain",o.EVENT_STREAM="text/event-stream",o))(g||{}),m=class c{constructor(t,s,e,n,r){this.serverUrl=t;this.apiKey=s;this.clientId=e;this.client_secret=n;this.tokenUrl=r;this.expireTime=0,this.accessToken="",this.skipAuthHeader=!!t&&!(s||e||n||r);}static LEEWAY=30;static MAX_ERROR_BODY_LENGTH=500;expireTime;accessToken;skipAuthHeader;async buildHeadersForJsonRequest(){return this.skipAuthHeader?{Accept:"application/json"}:{Accept:"application/json",Authorization:`Bearer ${await this.getToken()}`}}async buildHeadersForRequest(){return this.skipAuthHeader?{}:{Authorization:`Bearer ${await this.getToken()}`}}async getToken(){if(this.apiKey)return this.apiKey;if(this.clientId&&this.client_secret&&this.tokenUrl&&(this.accessToken==""||this.expireTime<performance.now())){let t={grant_type:"client_credentials",client_id:this.clientId,client_secret:this.client_secret,scope:"openid"},s=await l__default.default.post(this.tokenUrl,t,{headers:{accept:"application/json","content-type":"application/x-www-form-urlencoded"}});if(s.status>=l__default.default.HttpStatusCode.BadRequest)return "";this.accessToken=s.data.id_token??s.data.access_token,this.expireTime=performance.now()+(s.data.expires_in-c.LEEWAY);}return this.accessToken}toRequestData(t,s){if(!s?.["Content-Type"]?.startsWith("multipart/form-data")||(delete s["Content-Type"],!t||typeof t!="object"||t instanceof FormData))return t;let e=new FormData;for(let[n,r]of Object.entries(t))r!=null&&(r instanceof Blob?e.append(n,r,r.name??n):typeof r=="object"?e.append(n,JSON.stringify(r)):e.append(n,String(r)));return e}async request(t,s,e){if(!e.headers)e.headers=await this.buildHeadersForJsonRequest();else {let r=await this.buildHeadersForRequest();e.headers={...e.headers,...r};}let n=this.toRequestData(e.data,e.headers);return new u(l__default.default.request({method:t,url:this.serverUrl+s,headers:{...e.headers,"User-Agent":"semantha TypeScript SDK; "},data:n,params:e.params,responseType:e.responseType}))}async get(t,s,e,n,r="json"){return this.request("GET",t,{params:s,headers:e,data:n,responseType:r})}async post(t,s,e,n,r="json"){if(!e)e=await this.buildHeadersForJsonRequest();else {let i=await this.buildHeadersForRequest();e={...e,...i};}return new u(l__default.default.post(this.serverUrl+t,this.toRequestData(n,e),{params:s,headers:e,responseType:r}))}async postEventStream(t,s,e,n,r){let i=await this.buildHeadersForRequest(),a={...e,...i,Accept:"text/event-stream"};n!=null&&!a["Content-Type"]&&(a["Content-Type"]="application/json");let d=await fetch(this.serverUrl+t+this.toQueryString(s),{method:"POST",headers:a,body:n!=null?JSON.stringify(n):void 0,signal:r});if(!d.ok){let p=await c.readErrorBody(d);throw new Error(`Event stream request to ${t} failed with status ${d.status} ${d.statusText}${p}`)}if(!d.body)throw new Error(`Event stream request to ${t} returned an empty response body`);return h(d.body)}static async readErrorBody(t){let s;try{s=(await t.text()).trim();}catch{return ""}return s?`: ${s.length>c.MAX_ERROR_BODY_LENGTH?`${s.slice(0,c.MAX_ERROR_BODY_LENGTH)}\u2026`:s}`:""}toQueryString(t){if(!t)return "";let s=new URLSearchParams;for(let[n,r]of Object.entries(t))r!=null&&s.append(n,String(r));let e=s.toString();return e?`?${e}`:""}async delete(t,s,e,n){return this.request("DELETE",t,{data:s,params:e,headers:n})}async patch(t,s,e){return this.request("PATCH",t,{data:s,headers:e})}async put(t,s,e){return this.request("PUT",t,{data:s,headers:e})}toHeader(t,s){return s?{Accept:t,"Content-Type":s}:{Accept:t}}};exports.a=u;exports.b=y;exports.c=h;exports.d=g;exports.e=m;//# sourceMappingURL=chunk-C255MF6C.js.map
|
|
10
|
+
//# sourceMappingURL=chunk-C255MF6C.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../semantha-product-sdk/rest/restResponse.ts","../semantha-product-sdk/rest/restClient.ts"],"names":["RestResponse","response","contentDisposition","filename","match","ServerSentEvent","event","data","id","retry","parseEvent","chunk","hasField","line","colon","field","value","parsed","parseServerSentEvents","body","reader","decoder","buffer","flushEvents","final","separator","done","MediaType","RestClient","_RestClient","serverUrl","apiKey","clientId","client_secret","tokenUrl","axios","headers","form","key","method","url","config","authHeader","params","responseType","signal","requestHeaders","details","search","query","acceptMimeType","contentType"],"mappings":"oJAEO,IAAMA,CAAAA,CAAN,KAAsB,CAC3B,WAAA,CAA6BC,CAAAA,CAAqC,CAArC,IAAA,CAAA,QAAA,CAAAA,EAAsC,CAEnE,MAAM,OAAA,EAAsB,CAC1B,OAAA,CAAQ,MAAM,IAAA,CAAK,QAAA,EAAU,IAC/B,CAEA,MAAM,MAAA,EAAwB,CAC5B,IAAMA,CAAAA,CAA0B,MAAM,IAAA,CAAK,QAAA,CACrCC,CAAAA,CAAqBD,CAAAA,EAAU,OAAA,CAAQ,qBAAqB,CAAA,CAC9DE,CAAAA,CAAW,MAAA,CACf,GAAID,CAAAA,CAAoB,CACtB,IAAME,CAAAA,CAAQF,CAAAA,CAAmB,KAAA,CAAM,sBAAsB,CAAA,CACzDE,CAAAA,EAASA,CAAAA,CAAM,CAAC,CAAA,GAClBD,CAAAA,CAAWC,CAAAA,CAAM,CAAC,CAAA,EAEtB,CACA,OAAO,IAAI,IAAA,CAAK,CAACH,CAAAA,CAAS,IAAI,EAAGE,CAAQ,CAC3C,CAEA,MAAM,aAAA,EAAiC,CACrC,OAAA,CAAQ,MAAM,IAAA,CAAK,QAAA,EAAU,MAC/B,CAEA,MAAM,aAAA,EAAiC,CACrC,OAAA,CAAQ,MAAM,IAAA,CAAK,QAAA,EAAU,UAC/B,CACF,CAAA,CAMaE,CAAAA,CAAN,KAAsB,CAC3B,WAAA,CACkBC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CACAC,CAAAA,CAChB,CAJgB,IAAA,CAAA,KAAA,CAAAH,EACA,IAAA,CAAA,IAAA,CAAAC,CAAAA,CACA,IAAA,CAAA,EAAA,CAAAC,CAAAA,CACA,IAAA,CAAA,KAAA,CAAAC,EACf,CAK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,CAAK,CAAE,KAAAjC,CAAAA,CAAM,MAAA,CAAAoC,EAAQ,OAAA,CAAAP,CAAQ,CAAC,CACpE,CAEA,MAAM,KAAA,CAASI,CAAAA,CAAajC,CAAAA,CAAY6B,CAAAA,CAA+D,CACrG,OAAO,KAAK,OAAA,CAAW,OAAA,CAASI,EAAK,CAAE,IAAA,CAAAjC,EAAM,OAAA,CAAA6B,CAAQ,CAAC,CACxD,CAEA,MAAM,GAAA,CAAOI,CAAAA,CAAajC,EAAW6B,CAAAA,CAA+D,CAClG,OAAO,IAAA,CAAK,OAAA,CAAW,MAAOI,CAAAA,CAAK,CAAE,KAAAjC,CAAAA,CAAM,OAAA,CAAA6B,CAAQ,CAAC,CACtD,CAEA,QAAA,CAASc,CAAAA,CAA2BC,EAAiD,CACnF,OAAIA,EACK,CAAE,MAAA,CAAQD,EAAgB,cAAA,CAAgBC,CAAY,EAExD,CAAE,MAAA,CAAQD,CAAe,CAClC,CACF","file":"chunk-C255MF6C.js","sourcesContent":["import { AxiosResponse } from 'axios';\n\nexport class RestResponse<T> {\n constructor(private readonly response: Promise<AxiosResponse<T>>) {}\n\n async toModel(): Promise<T> {\n return (await this.response).data;\n }\n\n async toFile(): Promise<File> {\n const response: AxiosResponse = await this.response;\n const contentDisposition = response?.headers['content-disposition'];\n let filename = 'file';\n if (contentDisposition) {\n const match = contentDisposition.match(/filename=\"?([^\"]+)\"?/);\n if (match && match[1]) {\n filename = match[1];\n }\n }\n return new File([response.data], filename);\n }\n\n async getStatusCode(): Promise<number> {\n return (await this.response).status;\n }\n\n async getStatusText(): Promise<string> {\n return (await this.response).statusText;\n }\n}\n\n/**\n * A single Server-Sent Event as emitted by a `text/event-stream` response,\n * parsed according to the WHATWG event stream format.\n */\nexport class ServerSentEvent {\n constructor(\n public readonly event: string | undefined,\n public readonly data: string,\n public readonly id?: string,\n public readonly retry?: number\n ) {}\n\n /**\n * The `data` payload parsed as JSON.\n */\n json<T = unknown>(): T {\n return JSON.parse(this.data) as T;\n }\n}\n\nfunction parseEvent(chunk: string): ServerSentEvent | undefined {\n let event: string | undefined;\n const data: string[] = [];\n let id: string | undefined;\n let retry: number | undefined;\n let hasField = false;\n for (const line of chunk.split('\\n')) {\n if (line === '' || line.startsWith(':')) {\n // blank lines never occur inside a chunk here, comments are ignored\n continue;\n }\n const colon = line.indexOf(':');\n const field = colon === -1 ? line : line.slice(0, colon);\n let value = colon === -1 ? '' : line.slice(colon + 1);\n if (value.startsWith(' ')) {\n value = value.slice(1);\n }\n hasField = true;\n switch (field) {\n case 'event':\n event = value;\n break;\n case 'data':\n data.push(value);\n break;\n case 'id':\n id = value;\n break;\n case 'retry': {\n const parsed = Number(value);\n if (!Number.isNaN(parsed)) {\n retry = parsed;\n }\n break;\n }\n }\n }\n return hasField ? new ServerSentEvent(event, data.join('\\n'), id, retry) : undefined;\n}\n\n/**\n * Turns the raw byte stream of a `text/event-stream` response into an async\n * iterable of {@link ServerSentEvent}s, yielding each event as soon as it has\n * been fully received.\n */\nexport async function* parseServerSentEvents(body: ReadableStream<Uint8Array>): AsyncIterable<ServerSentEvent> {\n const reader = body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n const flushEvents = function* (final: boolean): Generator<ServerSentEvent> {\n buffer = buffer.replace(/\\r\\n/g, '\\n').replace(/\\r/g, '\\n');\n let separator = buffer.indexOf('\\n\\n');\n while (separator !== -1) {\n const event = parseEvent(buffer.slice(0, separator));\n buffer = buffer.slice(separator + 2);\n if (event) {\n yield event;\n }\n separator = buffer.indexOf('\\n\\n');\n }\n if (final) {\n const event = parseEvent(buffer);\n buffer = '';\n if (event) {\n yield event;\n }\n }\n };\n try {\n let { value, done } = await reader.read();\n while (!done) {\n buffer += decoder.decode(value, { stream: true });\n yield* flushEvents(false);\n ({ value, done } = await reader.read());\n }\n buffer += decoder.decode();\n yield* flushEvents(true);\n } finally {\n await reader.cancel().catch(() => undefined);\n reader.releaseLock();\n }\n}\n","import axios, { AxiosRequestConfig, AxiosResponse, ResponseType } from 'axios';\nimport { parseServerSentEvents, RestResponse, ServerSentEvent } from './restResponse';\n\nexport enum MediaType {\n JSON = 'application/json',\n XLSX = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n PDF = 'application/pdf',\n DOCX = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n ZIP = 'application/zip',\n REQIFZ = 'application/reqifz',\n PNG = 'image/png',\n BINARY = 'application/octet-stream',\n TEXT_PLAIN = 'text/plain',\n EVENT_STREAM = 'text/event-stream'\n}\n\nexport class RestClient {\n // in seconds\n private static readonly LEEWAY = 30;\n\n // Max characters of an error response body to include in a thrown Error\n private static readonly MAX_ERROR_BODY_LENGTH = 500;\n\n private expireTime: number;\n private accessToken: string;\n private skipAuthHeader: boolean;\n\n constructor(\n private readonly serverUrl: string,\n private readonly apiKey?: string,\n private readonly clientId?: string,\n private readonly client_secret?: string,\n private readonly tokenUrl?: string\n ) {\n this.expireTime = 0.0;\n this.accessToken = '';\n this.skipAuthHeader = !!serverUrl && !(apiKey || clientId || client_secret || tokenUrl);\n }\n\n async buildHeadersForJsonRequest(): Promise<{ [key: string]: string }> {\n if (this.skipAuthHeader) {\n return {\n Accept: 'application/json'\n };\n }\n return {\n Accept: 'application/json',\n Authorization: `Bearer ${await this.getToken()}`\n };\n }\n\n async buildHeadersForRequest(): Promise<{ [key: string]: string }> {\n if (this.skipAuthHeader) {\n return {};\n }\n return {\n Authorization: `Bearer ${await this.getToken()}`\n };\n }\n\n async getToken(): Promise<string> {\n if (this.apiKey) {\n return this.apiKey;\n }\n if (\n this.clientId &&\n this.client_secret &&\n this.tokenUrl &&\n (this.accessToken == '' || this.expireTime < performance.now())\n ) {\n const data = {\n grant_type: 'client_credentials',\n client_id: this.clientId,\n client_secret: this.client_secret,\n scope: 'openid'\n };\n const response = await axios.post(this.tokenUrl, data, {\n headers: { accept: 'application/json', 'content-type': 'application/x-www-form-urlencoded' }\n });\n if (response.status >= axios.HttpStatusCode.BadRequest) {\n // example for error response: {\"error\":\"invalid_client\",\"error_description\":\"Invalid client or Invalid client credentials\"}\n // we have no token -> this leads to a permission error\n return '';\n }\n this.accessToken = response.data['id_token'] ?? response.data['access_token'];\n this.expireTime = performance.now() + (response.data['expires_in'] - RestClient.LEEWAY);\n }\n return this.accessToken;\n }\n\n // Multipart endpoints announce it via a multipart/form-data Content-Type header\n // set by the generated code; their plain-object bodies (possibly containing\n // Blobs) must be sent as FormData, not JSON-serialized.\n private toRequestData(data: any, headers?: { [key: string]: string }): any {\n if (!headers?.['Content-Type']?.startsWith('multipart/form-data')) {\n return data;\n }\n // axios must set the Content-Type itself to include the multipart boundary\n delete headers['Content-Type'];\n if (!data || typeof data !== 'object' || data instanceof FormData) {\n return data;\n }\n const form = new FormData();\n for (const [key, value] of Object.entries(data)) {\n if (value === undefined || value === null) {\n continue;\n }\n if (value instanceof Blob) {\n form.append(key, value, (value as File).name ?? key);\n } else if (typeof value === 'object') {\n form.append(key, JSON.stringify(value));\n } else {\n form.append(key, String(value));\n }\n }\n return form;\n }\n\n private async request<R>(\n method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE',\n url: string,\n config: { params?: any; headers?: { [key: string]: string }; data?: any; responseType?: ResponseType }\n ): Promise<RestResponse<R>> {\n if (!config.headers) {\n config.headers = await this.buildHeadersForJsonRequest();\n } else {\n const authHeader = await this.buildHeadersForRequest();\n config.headers = { ...config.headers, ...authHeader };\n }\n // convert first: toRequestData strips a multipart Content-Type from config.headers\n const data = this.toRequestData(config.data, config.headers);\n return new RestResponse<R>(\n axios.request<R>({\n method: method,\n url: this.serverUrl + url,\n headers: { ...config.headers, 'User-Agent': 'semantha TypeScript SDK; ' },\n data: data,\n params: config.params,\n responseType: config.responseType\n })\n );\n }\n\n async get<R>(\n url: string,\n params?: any,\n headers?: { [key: string]: string },\n data?: any,\n responseType: ResponseType = 'json'\n ): Promise<RestResponse<R>> {\n return this.request<R>('GET', url, { params, headers, data, responseType });\n }\n\n async post<R>(\n url: string,\n params?: any,\n headers?: { [key: string]: string },\n data?: any,\n responseType: ResponseType = 'json'\n ): Promise<RestResponse<R>> {\n if (!headers) {\n headers = await this.buildHeadersForJsonRequest();\n } else {\n const authHeader = await this.buildHeadersForRequest();\n headers = { ...headers, ...authHeader };\n }\n return new RestResponse<R>(\n axios.post<R>(this.serverUrl + url, this.toRequestData(data, headers), { params, headers, responseType })\n );\n }\n\n // Server-Sent Events are consumed with the Fetch API instead of axios so the\n // response body can be read incrementally as a stream in both browser and Node\n // (18+) runtimes. An event stream stays open until the server closes it, so\n // callers that may need to stop early (component unmount, timeout, user\n // cancel) should pass a `signal` — aborting it fails the pending read and\n // ends the iteration instead of hanging on a read that never completes.\n async postEventStream(\n url: string,\n params?: { [key: string]: any },\n headers?: { [key: string]: string },\n data?: any,\n signal?: AbortSignal\n ): Promise<AsyncIterable<ServerSentEvent>> {\n const authHeader = await this.buildHeadersForRequest();\n const requestHeaders: { [key: string]: string } = {\n ...headers,\n ...authHeader,\n Accept: MediaType.EVENT_STREAM\n };\n if (data !== undefined && data !== null && !requestHeaders['Content-Type']) {\n requestHeaders['Content-Type'] = MediaType.JSON;\n }\n const response = await fetch(this.serverUrl + url + this.toQueryString(params), {\n method: 'POST',\n headers: requestHeaders,\n body: data !== undefined && data !== null ? JSON.stringify(data) : undefined,\n signal\n });\n if (!response.ok) {\n const details = await RestClient.readErrorBody(response);\n throw new Error(\n `Event stream request to ${url} failed with status ${response.status} ${response.statusText}${details}`\n );\n }\n if (!response.body) {\n throw new Error(`Event stream request to ${url} returned an empty response body`);\n }\n return parseServerSentEvents(response.body);\n }\n\n // An error response carries a body explaining what went wrong; without it the\n // caller only sees a bare status code. The body is untrusted and potentially\n // large, so it is trimmed to a bounded slice before being put on the Error.\n private static async readErrorBody(response: Response): Promise<string> {\n let body: string;\n try {\n body = (await response.text()).trim();\n } catch {\n // Body already consumed, or the connection failed mid-read — the status\n // line is still worth throwing on its own.\n return '';\n }\n if (!body) {\n return '';\n }\n const slice =\n body.length > RestClient.MAX_ERROR_BODY_LENGTH ? `${body.slice(0, RestClient.MAX_ERROR_BODY_LENGTH)}…` : body;\n return `: ${slice}`;\n }\n\n private toQueryString(params?: { [key: string]: any }): string {\n if (!params) {\n return '';\n }\n const search = new URLSearchParams();\n for (const [key, value] of Object.entries(params)) {\n if (value !== undefined && value !== null) {\n search.append(key, String(value));\n }\n }\n const query = search.toString();\n return query ? `?${query}` : '';\n }\n\n async delete(\n url: string,\n data?: any,\n params?: any,\n headers?: { [key: string]: string }\n ): Promise<RestResponse<void>> {\n return this.request<void>('DELETE', url, { data, params, headers });\n }\n\n async patch<R>(url: string, data?: any, headers?: { [key: string]: string }): Promise<RestResponse<R>> {\n return this.request<R>('PATCH', url, { data, headers });\n }\n\n async put<R>(url: string, data: any, headers?: { [key: string]: string }): Promise<RestResponse<R>> {\n return this.request<R>('PUT', url, { data, headers });\n }\n\n toHeader(acceptMimeType: MediaType, contentType?: string): { [key: string]: string } {\n if (contentType) {\n return { Accept: acceptMimeType, 'Content-Type': contentType };\n }\n return { Accept: acceptMimeType };\n }\n}\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {e}from'./chunk-36CIB62T.mjs';import*as P from'fs';var s=class{constructor(t,e){this.restClient=t;this.parentEndpoint=e;this.ENDPOINT=this.parentEndpoint+"/binary";}ENDPOINT;async getAsXlsx(){return (await this.restClient.get(this.ENDPOINT,{},this.restClient.toHeader("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),null,"blob")).toFile()}async getAsDocx(){return (await this.restClient.get(this.ENDPOINT,{},this.restClient.toHeader("application/vnd.openxmlformats-officedocument.wordprocessingml.document"),null,"blob")).toFile()}async getAsPdf(){return (await this.restClient.get(this.ENDPOINT,{},this.restClient.toHeader("application/pdf"),null,"blob")).toFile()}};var a=class{constructor(t,e,i){this.restClient=t;this.parentEndpoint=e;this.configurationid=i;this.ENDPOINT=this.parentEndpoint+`/configurations/${this.configurationid}`;}ENDPOINT;async get(){return (await this.restClient.get(this.ENDPOINT,{},this.restClient.toHeader("application/json"))).toModel()}async delete(){return await this.restClient.delete(this.ENDPOINT)}async patch(t){return (await this.restClient.patch(this.ENDPOINT,t)).toModel()}};var l=class{constructor(t,e){this.restClient=t;this.parentEndpoint=e;this.ENDPOINT=this.parentEndpoint+"/configurations";}ENDPOINT;async get(){return (await this.restClient.get(this.ENDPOINT,{},this.restClient.toHeader("application/json"))).toModel()}async delete(){return await this.restClient.delete(this.ENDPOINT)}async post(t){return (await this.restClient.post(this.ENDPOINT,{},this.restClient.toHeader("application/json"),t)).toModel()}};var p=class{constructor(t,e){this.restClient=t;this.parentEndpoint=e;this.ENDPOINT=this.parentEndpoint+"/events";}ENDPOINT;async get(){return (await this.restClient.get(this.ENDPOINT,{},this.restClient.toHeader("application/json"))).toModel()}async post(t,e){return (await this.restClient.post(this.ENDPOINT,e,this.restClient.toHeader("application/json"),t)).toModel()}};var u=class{constructor(t,e){this.restClient=t;this.parentEndpoint=e;this.ENDPOINT=this.parentEndpoint+"/screenshots";}ENDPOINT;async getAsPng(t){return (await this.restClient.get(this.ENDPOINT,t,this.restClient.toHeader("image/png"),null,"blob")).toFile()}};var c=class{constructor(t,e,i){this.restClient=t;this.parentEndpoint=e;this.documentstructureid=i;this.ENDPOINT=this.parentEndpoint+`/documentstructures/${this.documentstructureid}`;}ENDPOINT;binary(){return new s(this.restClient,this.ENDPOINT)}events(){return new p(this.restClient,this.ENDPOINT)}screenshots(){return new u(this.restClient,this.ENDPOINT)}async get(){return (await this.restClient.get(this.ENDPOINT,{},this.restClient.toHeader("application/json"))).toModel()}async getAsReqifz(){return (await this.restClient.get(this.ENDPOINT,{},this.restClient.toHeader("application/reqifz"),null,"blob")).toFile()}async delete(){return await this.restClient.delete(this.ENDPOINT)}async patch(t){return (await this.restClient.patch(this.ENDPOINT,t)).toModel()}async put(t){return (await this.restClient.put(this.ENDPOINT,t)).toModel()}};var d=class{constructor(t,e){this.restClient=t;this.parentEndpoint=e;this.ENDPOINT=this.parentEndpoint+"/documentstructures";}ENDPOINT;async get(t){return (await this.restClient.get(this.ENDPOINT,t,this.restClient.toHeader("application/json"))).toModel()}async delete(){return await this.restClient.delete(this.ENDPOINT)}async post(t){return (await this.restClient.post(this.ENDPOINT,{},this.restClient.toHeader("application/json","multipart/form-data"),t)).toModel()}};var m=class{constructor(t,e,i){this.restClient=t;this.parentEndpoint=e;this.domainname=i;this.ENDPOINT=this.parentEndpoint+`/domains/${this.domainname}`;}ENDPOINT;configurations(t){return t!=null?new a(this.restClient,this.ENDPOINT,t):new l(this.restClient,this.ENDPOINT)}documentstructures(t){return t!=null?new c(this.restClient,this.ENDPOINT,t):new d(this.restClient,this.ENDPOINT)}};var h=class{constructor(t,e){this.restClient=t;this.parentEndpoint=e;this.ENDPOINT=this.parentEndpoint+"/domains";}ENDPOINT};var g=class{constructor(t,e){this.restClient=t;this.parentEndpoint=e;this.ENDPOINT=this.parentEndpoint+"/structurenavigator";}ENDPOINT;domains(t){return t!=null?new m(this.restClient,this.ENDPOINT,t):new h(this.restClient,this.ENDPOINT)}};var E="/api",C=class r{constructor(t,e){this.restClient=t;this.parentEndpoint=e;}static loginWithApiKey(t,e$1){if(!e$1)throw new Error("You need to supply an API key to login.");if(!t)throw new Error("You need to supply a server url to login.");return new r(new e(this.parseServerUrl(t),e$1),E)}static loginWithAuthProxy(t){if(!t)throw new Error("You need to supply a server url to login.");return new r(new e(this.parseServerUrl(t)),E)}static loginWithCredentials(t,e$1,i,N){return t=this.parseServerUrl(t),new r(new e(t,void 0,e$1,i,N),E)}static loginWithCredentialsFile(t){if(t.endsWith(".properties")||t.endsWith(".PROPERTIES")){let i=P.readFileSync(t,"utf8").split(/[\n|\r\n]/).filter(f=>f.length!==0).map(f=>f.split("=")),N=this.getValueOfInPropertiesFile("serverUrl",i),D=this.getValueOfInPropertiesFile("clientId",i),O=this.getValueOfInPropertiesFile("clientSecret",i),v=this.getValueOfInPropertiesFile("tokenUrl",i);return r.loginWithCredentials(N,D,O,v)}throw new Error("Can not login, please supply a credentials properties file.")}static parseServerUrl(t){return t.endsWith("/")&&(t=t.slice(0,-1)),t.endsWith("/tt-platform-ui/en/#")?t=t.replace("/tt-platform-ui/en/#","/tt-product-server"):t.endsWith("/tt-product-server")||(t+="/tt-product-server"),t}static getValueOfInPropertiesFile(t,e){for(let i of e)if(i[0]===t)return i[1].replace("\\:",":");throw Error(`.properties files contains no ${t}!`)}endpoint(){return this.parentEndpoint}structurenavigator(){return new g(this.restClient,this.endpoint())}};export{s as a,a as b,l as c,p as d,u as e,c as f,d as g,m as h,h as i,g as j,C as k};//# sourceMappingURL=chunk-NVF34XUK.mjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-NVF34XUK.mjs.map
|