@icure/api 4.2.25 → 4.2.26
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.
|
@@ -59,6 +59,7 @@ class IccBeresultimportApi {
|
|
|
59
59
|
*/
|
|
60
60
|
doImport(documentId, hcpId, language, protocolIds, formIds, planOfActionId, enckeys, ctc) {
|
|
61
61
|
let _body = null;
|
|
62
|
+
_body = ctc;
|
|
62
63
|
const _url = this.host +
|
|
63
64
|
`/be_result_import/import/${encodeURIComponent(String(documentId))}/${encodeURIComponent(String(hcpId))}/${encodeURIComponent(String(language))}` +
|
|
64
65
|
'?ts=' +
|
|
@@ -66,8 +67,7 @@ class IccBeresultimportApi {
|
|
|
66
67
|
(protocolIds ? '&protocolIds=' + encodeURIComponent(String(protocolIds)) : '') +
|
|
67
68
|
(formIds ? '&formIds=' + encodeURIComponent(String(formIds)) : '') +
|
|
68
69
|
(planOfActionId ? '&planOfActionId=' + encodeURIComponent(String(planOfActionId)) : '') +
|
|
69
|
-
(enckeys ? '&enckeys=' + encodeURIComponent(String(enckeys)) : '')
|
|
70
|
-
(ctc ? '&ctc=' + encodeURIComponent(String(ctc)) : '');
|
|
70
|
+
(enckeys ? '&enckeys=' + encodeURIComponent(String(enckeys)) : '');
|
|
71
71
|
let headers = this.headers;
|
|
72
72
|
return XHR_1.XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl)
|
|
73
73
|
.then((doc) => new Contact_1.Contact(doc.body))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IccBeresultimportApi.js","sourceRoot":"","sources":["../../../icc-api/api/IccBeresultimportApi.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,+
|
|
1
|
+
{"version":3,"file":"IccBeresultimportApi.js","sourceRoot":"","sources":["../../../icc-api/api/IccBeresultimportApi.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;GAUG;AACH,+BAA2B;AAC3B,8CAA0C;AAC1C,oDA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D,oDA0GC","sourcesContent":["/**\n * iCure Data Stack API Documentation\n * The iCure Data Stack Application API is the native interface to iCure. This version is obsolete, please use v2.\n *\n * OpenAPI spec version: v1\n *\n *\n * NOTE: This class is auto generated by the swagger code generator program.\n * https://github.com/swagger-api/swagger-codegen.git\n * Do not edit the class manually.\n */\nimport { XHR } from './XHR'\nimport { Contact } from '../model/Contact'\nimport { ResultInfo } from '../model/ResultInfo'\n\nexport class IccBeresultimportApi {\n host: string\n headers: Array<XHR.Header>\n fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>\n\n constructor(host: string, headers: any, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>) {\n this.host = host\n this.headers = Object.keys(headers).map((k) => new XHR.Header(k, headers[k]))\n this.fetchImpl = fetchImpl\n }\n\n setHeaders(h: Array<XHR.Header>) {\n this.headers = h\n }\n\n handleError(e: XHR.XHRError): never {\n throw e\n }\n\n /**\n *\n * @summary Can we handle this document\n * @param id\n * @param enckeys\n */\n canHandle(id: string, enckeys: string): Promise<boolean> {\n let _body = null\n\n const _url =\n this.host +\n `/be_result_import/canhandle/${encodeURIComponent(String(id))}` +\n '?ts=' +\n new Date().getTime() +\n (enckeys ? '&enckeys=' + encodeURIComponent(String(enckeys)) : '')\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl)\n .then((doc) => JSON.parse(JSON.stringify(doc.body)))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary import document\n * @param documentId\n * @param hcpId\n * @param language\n * @param protocolIds\n * @param formIds\n * @param planOfActionId\n * @param enckeys\n * @param ctc\n */\n doImport(\n documentId: string,\n hcpId: string,\n language: string,\n protocolIds: string,\n formIds: string,\n planOfActionId: string,\n enckeys: string,\n ctc: Contact\n ): Promise<Contact> {\n let _body = null\n _body = ctc\n\n const _url =\n this.host +\n `/be_result_import/import/${encodeURIComponent(String(documentId))}/${encodeURIComponent(String(hcpId))}/${encodeURIComponent(\n String(language)\n )}` +\n '?ts=' +\n new Date().getTime() +\n (protocolIds ? '&protocolIds=' + encodeURIComponent(String(protocolIds)) : '') +\n (formIds ? '&formIds=' + encodeURIComponent(String(formIds)) : '') +\n (planOfActionId ? '&planOfActionId=' + encodeURIComponent(String(planOfActionId)) : '') +\n (enckeys ? '&enckeys=' + encodeURIComponent(String(enckeys)) : '')\n let headers = this.headers\n return XHR.sendCommand('POST', _url, headers, _body, this.fetchImpl)\n .then((doc) => new Contact(doc.body as JSON))\n .catch((err) => this.handleError(err))\n }\n\n /**\n *\n * @summary Extract general infos from document\n * @param id\n * @param language\n * @param enckeys\n * @param full\n */\n getInfos(id: string, language: string, enckeys: string, full?: boolean): Promise<Array<ResultInfo>> {\n let _body = null\n\n const _url =\n this.host +\n `/be_result_import/infos/${encodeURIComponent(String(id))}` +\n '?ts=' +\n new Date().getTime() +\n (language ? '&language=' + encodeURIComponent(String(language)) : '') +\n (enckeys ? '&enckeys=' + encodeURIComponent(String(enckeys)) : '') +\n (full ? '&full=' + encodeURIComponent(String(full)) : '')\n let headers = this.headers\n return XHR.sendCommand('GET', _url, headers, _body, this.fetchImpl)\n .then((doc) => (doc.body as Array<JSON>).map((it) => new ResultInfo(it)))\n .catch((err) => this.handleError(err))\n }\n}\n"]}
|
package/icc-api/api/XHR.d.ts
CHANGED
|
@@ -18,5 +18,5 @@ export declare namespace XHR {
|
|
|
18
18
|
url: string;
|
|
19
19
|
constructor(url: string, message: string, status: number, errorCode: string, headers: Headers);
|
|
20
20
|
}
|
|
21
|
-
function sendCommand(method: string, url: string, headers: Array<Header> | null, data?: string | any, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>, contentTypeOverride?: 'application/json' | 'text/plain' | 'application/octet-stream',
|
|
21
|
+
function sendCommand(method: string, url: string, headers: Array<Header> | null, data?: string | any, fetchImpl?: (input: RequestInfo, init?: RequestInit) => Promise<Response>, contentTypeOverride?: 'application/json' | 'text/plain' | 'application/octet-stream', forceAuthentication?: boolean): Promise<Data>;
|
|
22
22
|
}
|
package/icc-api/api/XHR.js
CHANGED
|
@@ -62,7 +62,9 @@ var XHR;
|
|
|
62
62
|
? window.fetch
|
|
63
63
|
: typeof self !== 'undefined'
|
|
64
64
|
? self.fetch
|
|
65
|
-
: fetch, contentTypeOverride,
|
|
65
|
+
: fetch, contentTypeOverride, forceAuthentication = false) {
|
|
66
|
+
var _a;
|
|
67
|
+
const forceSendAuthorization = forceAuthentication || ((_a = headers === null || headers === void 0 ? void 0 : headers.find((it) => { var _a; return ((_a = it.header) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'force-authentication'; })) === null || _a === void 0 ? void 0 : _a.data) === 'true';
|
|
66
68
|
const contentType = headers && headers.find((it) => (it.header ? it.header.toLowerCase() === 'content-type' : false));
|
|
67
69
|
const clientTimeout = headers && headers.find((it) => (it.header ? it.header.toUpperCase() === 'X-CLIENT-SIDE-TIMEOUT' : false));
|
|
68
70
|
const timeout = clientTimeout ? Number(clientTimeout.data) : 600000;
|
|
@@ -70,9 +72,13 @@ var XHR;
|
|
|
70
72
|
method: method,
|
|
71
73
|
credentials: 'include',
|
|
72
74
|
headers: (headers !== null && headers !== void 0 ? headers : [])
|
|
73
|
-
.filter((h) =>
|
|
74
|
-
|
|
75
|
-
h.header.
|
|
75
|
+
.filter((h) => {
|
|
76
|
+
var _a, _b, _c;
|
|
77
|
+
return (forceSendAuthorization || h.header.toLowerCase() !== 'authorization') &&
|
|
78
|
+
(((_a = h.header) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== 'content-type' || h.data !== 'multipart/form-data') &&
|
|
79
|
+
((_b = h.header) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== 'X-CLIENT-SIDE-TIMEOUT' &&
|
|
80
|
+
((_c = h.header) === null || _c === void 0 ? void 0 : _c.toLowerCase()) !== 'force-authentication';
|
|
81
|
+
})
|
|
76
82
|
.reduce((acc, h) => {
|
|
77
83
|
acc[h.header] = h.data;
|
|
78
84
|
return acc;
|
package/icc-api/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,OAAO,CAAC,CAAA;qBACpF;oBACD,MAAM,EAAE,GAAG,mBAAmB,IAAI,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,YAAY,CAAA;oBACtF,OAAO,CACL,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC;wBAC/B,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE;wBACjB,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC;4BAC5D,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE;4BACjB,CAAC,CAAC,QAAQ,CAAC,WAAW,EAAE,CAC3B,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;iBAChD;YACH,CAAC;SAAA,CAAC,CAAA;IACN,CAAC;IAxFe,eAAW,cAwF1B,CAAA;AACH,CAAC,EA1JgB,GAAG,GAAH,WAAG,KAAH,WAAG,QA0JnB","sourcesContent":["import { ua2b64 } from '../model/ModelHelper'\n\nexport namespace XHR {\n export class Header {\n header: string\n data: string\n\n constructor(header: string, data: string) {\n this.header = header\n this.data = data\n }\n }\n\n export class Data {\n statusCode: number\n contentType: string\n body: JSON | Array<JSON> | any //stream bytes|json|array<json>\n\n constructor(status: number, contentType: string, body: JSON | Array<JSON> | any) {\n this.statusCode = status\n this.contentType = contentType\n this.body = body\n }\n }\n\n export class XHRError extends Error {\n statusCode: number\n errorCode: string\n headers: Headers\n message: string\n url: string\n\n constructor(url: string, message: string, status: number, errorCode: string, headers: Headers) {\n super(message)\n this.url = url\n this.statusCode = status\n this.message = message\n this.errorCode = errorCode\n this.headers = headers\n }\n }\n\n function fetchWithTimeout(\n url: string,\n init: RequestInit,\n timeout = 10000,\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ): Promise<Response> {\n return new Promise((resolve, reject) => {\n // Set timeout timer\n let timer = setTimeout(() => reject({ message: 'Request timed out', status: 'Request timed out' }), timeout)\n fetchImpl(url, init)\n .then((response) => {\n clearTimeout(timer)\n resolve(response)\n })\n .catch((err) => {\n clearTimeout(timer)\n reject(err)\n })\n })\n }\n\n export function sendCommand(\n method: string,\n url: string,\n headers: Array<Header> | null,\n data: string | any = '',\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch,\n contentTypeOverride?: 'application/json' | 'text/plain' | 'application/octet-stream',\n forceSendAuthorization = false\n ): Promise<Data> {\n const contentType = headers && headers.find((it) => (it.header ? it.header.toLowerCase() === 'content-type' : false))\n const clientTimeout = headers && headers.find((it) => (it.header ? it.header.toUpperCase() === 'X-CLIENT-SIDE-TIMEOUT' : false))\n const timeout = clientTimeout ? Number(clientTimeout.data) : 600000\n return fetchWithTimeout(\n url,\n Object.assign(\n {\n method: method,\n credentials: 'include' as RequestCredentials,\n headers: (headers ?? [])\n .filter(\n (h) =>\n (forceSendAuthorization || h.header.toLowerCase() !== 'authorization') &&\n (h.header.toLowerCase() !== 'content-type' || h.data !== 'multipart/form-data') &&\n h.header.toUpperCase() !== 'X-CLIENT-SIDE-TIMEOUT'\n )\n .reduce(\n (acc: { [key: string]: string }, h) => {\n acc[h.header] = h.data\n return acc\n },\n { 'X-Requested-With': 'XMLHttpRequest' }\n ),\n },\n method === 'POST' || method === 'PUT'\n ? {\n body:\n !contentType || contentType.data === 'application/json'\n ? JSON.stringify(data, (k, v) => {\n return v instanceof ArrayBuffer || v instanceof Uint8Array ? ua2b64(v) : v\n })\n : data,\n }\n : {}\n ),\n timeout,\n fetchImpl\n )\n .catch(async (e) => {\n if (!forceSendAuthorization) {\n //Might be due to a 401\n return {\n status: 401,\n statusText: e.message,\n arrayBuffer: () => Promise.resolve(new ArrayBuffer(0)),\n json: () => Promise.resolve({}),\n text: () => Promise.resolve(''),\n headers: new Headers(),\n }\n } else {\n throw e\n }\n })\n .then(async function (response) {\n if (response.status === 401 && !forceSendAuthorization) {\n return sendCommand(method, url, headers, data, fetchImpl, contentTypeOverride, true)\n } else {\n if (response.status >= 400) {\n const error: {\n error: string\n message: string\n status: number\n } = { error: response.statusText, message: await response.text(), status: response.status }\n throw new XHRError(url, error.message, error.status, error.error, response.headers)\n }\n const ct = contentTypeOverride || response.headers.get('content-type') || 'text/plain'\n return (\n ct.startsWith('application/json')\n ? response.json()\n : ct.startsWith('application/xml') || ct.startsWith('text/')\n ? response.text()\n : response.arrayBuffer()\n ).then((d) => new Data(response.status, ct, d))\n }\n })\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"XHR.js","sourceRoot":"","sources":["../../../icc-api/api/XHR.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sDAA6C;AAE7C,IAAiB,GAAG,CA4JnB;AA5JD,WAAiB,GAAG;IAClB,MAAa,MAAM;QAIjB,YAAY,MAAc,EAAE,IAAY;YACtC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;YACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAClB,CAAC;KACF;IARY,UAAM,SAQlB,CAAA;IAED,MAAa,IAAI;QAKf,YAAY,MAAc,EAAE,WAAmB,EAAE,IAA8B;YAC7E,IAAI,CAAC,UAAU,GAAG,MAAM,CAAA;YACxB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;YAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAClB,CAAC;KACF;IAVY,QAAI,OAUhB,CAAA;IAED,MAAa,QAAS,SAAQ,KAAK;QAOjC,YAAY,GAAW,EAAE,OAAe,EAAE,MAAc,EAAE,SAAiB,EAAE,OAAgB;YAC3F,KAAK,CAAC,OAAO,CAAC,CAAA;YACd,IAAI,CAAC,GAAG,GAAG,G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AAQ,CAAC,WAAW,EAAE,CAC3B,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA;iBAChD;YACH,CAAC;SAAA,CAAC,CAAA;IACN,CAAC;IA1Fe,eAAW,cA0F1B,CAAA;AACH,CAAC,EA5JgB,GAAG,GAAH,WAAG,KAAH,WAAG,QA4JnB","sourcesContent":["import { ua2b64 } from '../model/ModelHelper'\n\nexport namespace XHR {\n export class Header {\n header: string\n data: string\n\n constructor(header: string, data: string) {\n this.header = header\n this.data = data\n }\n }\n\n export class Data {\n statusCode: number\n contentType: string\n body: JSON | Array<JSON> | any //stream bytes|json|array<json>\n\n constructor(status: number, contentType: string, body: JSON | Array<JSON> | any) {\n this.statusCode = status\n this.contentType = contentType\n this.body = body\n }\n }\n\n export class XHRError extends Error {\n statusCode: number\n errorCode: string\n headers: Headers\n message: string\n url: string\n\n constructor(url: string, message: string, status: number, errorCode: string, headers: Headers) {\n super(message)\n this.url = url\n this.statusCode = status\n this.message = message\n this.errorCode = errorCode\n this.headers = headers\n }\n }\n\n function fetchWithTimeout(\n url: string,\n init: RequestInit,\n timeout = 10000,\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch\n ): Promise<Response> {\n return new Promise((resolve, reject) => {\n // Set timeout timer\n let timer = setTimeout(() => reject({ message: 'Request timed out', status: 'Request timed out' }), timeout)\n fetchImpl(url, init)\n .then((response) => {\n clearTimeout(timer)\n resolve(response)\n })\n .catch((err) => {\n clearTimeout(timer)\n reject(err)\n })\n })\n }\n\n export function sendCommand(\n method: string,\n url: string,\n headers: Array<Header> | null,\n data: string | any = '',\n fetchImpl: (input: RequestInfo, init?: RequestInit) => Promise<Response> = typeof window !== 'undefined'\n ? window.fetch\n : typeof self !== 'undefined'\n ? self.fetch\n : fetch,\n contentTypeOverride?: 'application/json' | 'text/plain' | 'application/octet-stream',\n forceAuthentication = false\n ): Promise<Data> {\n const forceSendAuthorization = forceAuthentication || headers?.find((it) => it.header?.toLowerCase() === 'force-authentication')?.data === 'true'\n const contentType = headers && headers.find((it) => (it.header ? it.header.toLowerCase() === 'content-type' : false))\n const clientTimeout = headers && headers.find((it) => (it.header ? it.header.toUpperCase() === 'X-CLIENT-SIDE-TIMEOUT' : false))\n const timeout = clientTimeout ? Number(clientTimeout.data) : 600000\n return fetchWithTimeout(\n url,\n Object.assign(\n {\n method: method,\n credentials: 'include' as RequestCredentials,\n headers: (headers ?? [])\n .filter(\n (h) =>\n (forceSendAuthorization || h.header.toLowerCase() !== 'authorization') &&\n (h.header?.toLowerCase() !== 'content-type' || h.data !== 'multipart/form-data') &&\n h.header?.toUpperCase() !== 'X-CLIENT-SIDE-TIMEOUT' &&\n h.header?.toLowerCase() !== 'force-authentication'\n )\n .reduce(\n (acc: { [key: string]: string }, h) => {\n acc[h.header] = h.data\n return acc\n },\n { 'X-Requested-With': 'XMLHttpRequest' }\n ),\n },\n method === 'POST' || method === 'PUT'\n ? {\n body:\n !contentType || contentType.data === 'application/json'\n ? JSON.stringify(data, (k, v) => {\n return v instanceof ArrayBuffer || v instanceof Uint8Array ? ua2b64(v) : v\n })\n : data,\n }\n : {}\n ),\n timeout,\n fetchImpl\n )\n .catch(async (e) => {\n if (!forceSendAuthorization) {\n //Might be due to a 401\n return {\n status: 401,\n statusText: e.message,\n arrayBuffer: () => Promise.resolve(new ArrayBuffer(0)),\n json: () => Promise.resolve({}),\n text: () => Promise.resolve(''),\n headers: new Headers(),\n }\n } else {\n throw e\n }\n })\n .then(async function (response) {\n if (response.status === 401 && !forceSendAuthorization) {\n return sendCommand(method, url, headers, data, fetchImpl, contentTypeOverride, true)\n } else {\n if (response.status >= 400) {\n const error: {\n error: string\n message: string\n status: number\n } = { error: response.statusText, message: await response.text(), status: response.status }\n throw new XHRError(url, error.message, error.status, error.error, response.headers)\n }\n const ct = contentTypeOverride || response.headers.get('content-type') || 'text/plain'\n return (\n ct.startsWith('application/json')\n ? response.json()\n : ct.startsWith('application/xml') || ct.startsWith('text/')\n ? response.text()\n : response.arrayBuffer()\n ).then((d) => new Data(response.status, ct, d))\n }\n })\n }\n}\n"]}
|