@fluid-topics/public-api 1.0.5 → 1.0.6

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/README.md CHANGED
@@ -2,10 +2,24 @@
2
2
 
3
3
  Convenient wrapper for Fluid Topics public APIs and models.
4
4
 
5
+ ## Installation
6
+
7
+ Using npm
8
+
5
9
  `npm install @fluid-topics/public-api`
6
10
 
11
+ Using yarn
12
+
7
13
  `yarn add @fluid-topics/public-api`
8
14
 
15
+ Using jsDelivr CDN
16
+
17
+ `<script src="https://cdn.jsdelivr.net/npm/@fluid-topics/public-api/dist/fluidtopics.min.js"></script>`
18
+
19
+ Using unpkg CDN
20
+
21
+ `<script src="https://unpkg.com/@fluid-topics/public-api/dist/fluidtopics.min.js"></script>`
22
+
9
23
  ## Examples
10
24
 
11
25
  ### Typescript
@@ -24,6 +38,8 @@ api.getMap("4R52zKZkt~kDZT3ZpoFNng")
24
38
 
25
39
  ### Javascript
26
40
 
41
+ ESM/CommonJS:
42
+
27
43
  ```javascript
28
44
  const {FluidTopicsApi} = require("@fluid-topics/public-api")
29
45
 
@@ -33,6 +49,17 @@ api.getMap("4R52zKZkt~kDZT3ZpoFNng")
33
49
  .then(ftMap => console.log(ftMap))
34
50
  ```
35
51
 
52
+ UMD/Browser:
53
+
54
+ ```javascript
55
+ const {FluidTopicsApi} = window.fluidtopics
56
+
57
+ const api = new FluidTopicsApi("https://doc.fluidtopics.com", "my-js-integration")
58
+
59
+ api.getMap("4R52zKZkt~kDZT3ZpoFNng")
60
+ .then(ftMap => console.log(ftMap))
61
+ ```
62
+
36
63
  ### Result
37
64
 
38
65
  ```
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).fluidtopics={})}(this,(function(e){"use strict";var t={exports:{}},n=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}},r=n,o=Object.prototype.toString;function i(e){return"[object Array]"===o.call(e)}function a(e){return void 0===e}function s(e){return null!==e&&"object"==typeof e}function u(e){if("[object Object]"!==o.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function c(e){return"[object Function]"===o.call(e)}function f(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),i(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var l={isArray:i,isArrayBuffer:function(e){return"[object ArrayBuffer]"===o.call(e)},isBuffer:function(e){return null!==e&&!a(e)&&null!==e.constructor&&!a(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:s,isPlainObject:u,isUndefined:a,isDate:function(e){return"[object Date]"===o.call(e)},isFile:function(e){return"[object File]"===o.call(e)},isBlob:function(e){return"[object Blob]"===o.call(e)},isFunction:c,isStream:function(e){return s(e)&&c(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:f,merge:function e(){var t={};function n(n,r){u(t[r])&&u(n)?t[r]=e(t[r],n):u(n)?t[r]=e({},n):i(n)?t[r]=n.slice():t[r]=n}for(var r=0,o=arguments.length;r<o;r++)f(arguments[r],n);return t},extend:function(e,t,n){return f(t,(function(t,o){e[o]=n&&"function"==typeof t?r(t,n):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}},p=l;function d(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var h=function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(p.isURLSearchParams(t))r=t.toString();else{var o=[];p.forEach(t,(function(e,t){null!=e&&(p.isArray(e)?t+="[]":e=[e],p.forEach(e,(function(e){p.isDate(e)?e=e.toISOString():p.isObject(e)&&(e=JSON.stringify(e)),o.push(d(t)+"="+d(e))})))})),r=o.join("&")}if(r){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e},m=l;function g(){this.handlers=[]}g.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},g.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},g.prototype.forEach=function(e){m.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var y=g,v=l,b=function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e},w=b,x=function(e,t,n,r,o){var i=new Error(e);return w(i,t,n,r,o)},E=x,j=l,C=j.isStandardBrowserEnv()?{write:function(e,t,n,r,o,i){var a=[];a.push(e+"="+encodeURIComponent(t)),j.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),j.isString(r)&&a.push("path="+r),j.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},O=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)},T=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e},A=l,S=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],k=l,R=k.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=r(window.location.href),function(t){var n=k.isString(t)?r(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},N=l,U=function(e,t,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(E("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)},P=C,B=h,L=function(e,t){return e&&!O(t)?T(e,t):t},D=function(e){var t,n,r,o={};return e?(A.forEach(e.split("\n"),(function(e){if(r=e.indexOf(":"),t=A.trim(e.substr(0,r)).toLowerCase(),n=A.trim(e.substr(r+1)),t){if(o[t]&&S.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([n]):o[t]?o[t]+", "+n:n}})),o):o},F=R,M=x,$=function(e){return new Promise((function(t,n){var r=e.data,o=e.headers,i=e.responseType;N.isFormData(r)&&delete o["Content-Type"];var a=new XMLHttpRequest;if(e.auth){var s=e.auth.username||"",u=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(s+":"+u)}var c=L(e.baseURL,e.url);function f(){if(a){var r="getAllResponseHeaders"in a?D(a.getAllResponseHeaders()):null,o={data:i&&"text"!==i&&"json"!==i?a.response:a.responseText,status:a.status,statusText:a.statusText,headers:r,config:e,request:a};U(t,n,o),a=null}}if(a.open(e.method.toUpperCase(),B(c,e.params,e.paramsSerializer),!0),a.timeout=e.timeout,"onloadend"in a?a.onloadend=f:a.onreadystatechange=function(){a&&4===a.readyState&&(0!==a.status||a.responseURL&&0===a.responseURL.indexOf("file:"))&&setTimeout(f)},a.onabort=function(){a&&(n(M("Request aborted",e,"ECONNABORTED",a)),a=null)},a.onerror=function(){n(M("Network Error",e,null,a)),a=null},a.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(M(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",a)),a=null},N.isStandardBrowserEnv()){var l=(e.withCredentials||F(c))&&e.xsrfCookieName?P.read(e.xsrfCookieName):void 0;l&&(o[e.xsrfHeaderName]=l)}"setRequestHeader"in a&&N.forEach(o,(function(e,t){void 0===r&&"content-type"===t.toLowerCase()?delete o[t]:a.setRequestHeader(t,e)})),N.isUndefined(e.withCredentials)||(a.withCredentials=!!e.withCredentials),i&&"json"!==i&&(a.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&a.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&a.upload&&a.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){a&&(a.abort(),n(e),a=null)})),r||(r=null),a.send(r)}))},q=l,I=function(e,t){v.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))},H=b,J={"Content-Type":"application/x-www-form-urlencoded"};function _(e,t){!q.isUndefined(e)&&q.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var z,X={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(z=$),z),transformRequest:[function(e,t){return I(t,"Accept"),I(t,"Content-Type"),q.isFormData(e)||q.isArrayBuffer(e)||q.isBuffer(e)||q.isStream(e)||q.isFile(e)||q.isBlob(e)?e:q.isArrayBufferView(e)?e.buffer:q.isURLSearchParams(e)?(_(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):q.isObject(e)||t&&"application/json"===t["Content-Type"]?(_(t,"application/json"),function(e,t,n){if(q.isString(e))try{return(t||JSON.parse)(e),q.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(n||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional,n=t&&t.silentJSONParsing,r=t&&t.forcedJSONParsing,o=!n&&"json"===this.responseType;if(o||r&&q.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw H(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};X.headers={common:{Accept:"application/json, text/plain, */*"}},q.forEach(["delete","get","head"],(function(e){X.headers[e]={}})),q.forEach(["post","put","patch"],(function(e){X.headers[e]=q.merge(J)}));var V=X,K=l,W=V,G=function(e){return!(!e||!e.__CANCEL__)},Z=l,Q=function(e,t,n){var r=this||W;return K.forEach(n,(function(n){e=n.call(r,e,t)})),e},Y=G,ee=V;function te(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var ne=l,re=function(e,t){t=t||{};var n={},r=["url","method","data"],o=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function s(e,t){return ne.isPlainObject(e)&&ne.isPlainObject(t)?ne.merge(e,t):ne.isPlainObject(t)?ne.merge({},t):ne.isArray(t)?t.slice():t}function u(r){ne.isUndefined(t[r])?ne.isUndefined(e[r])||(n[r]=s(void 0,e[r])):n[r]=s(e[r],t[r])}ne.forEach(r,(function(e){ne.isUndefined(t[e])||(n[e]=s(void 0,t[e]))})),ne.forEach(o,u),ne.forEach(i,(function(r){ne.isUndefined(t[r])?ne.isUndefined(e[r])||(n[r]=s(void 0,e[r])):n[r]=s(void 0,t[r])})),ne.forEach(a,(function(r){r in t?n[r]=s(e[r],t[r]):r in e&&(n[r]=s(void 0,e[r]))}));var c=r.concat(o).concat(i).concat(a),f=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===c.indexOf(e)}));return ne.forEach(f,u),n},oe={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]},ie={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){ie[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var ae={},se=oe.version.split(".");function ue(e,t){for(var n=t?t.split("."):se,r=e.split("."),o=0;o<3;o++){if(n[o]>r[o])return!0;if(n[o]<r[o])return!1}return!1}ie.transitional=function(e,t,n){var r=t&&ue(t);function o(e,t){return"[Axios v"+oe.version+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,i,a){if(!1===e)throw new Error(o(i," has been removed in "+t));return r&&!ae[i]&&(ae[i]=!0,console.warn(o(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,i,a)}};var ce={isOlderVersion:ue,assertOptions:function(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),o=r.length;o-- >0;){var i=r[o],a=t[i];if(a){var s=e[i],u=void 0===s||a(s,i,e);if(!0!==u)throw new TypeError("option "+i+" must be "+u)}else if(!0!==n)throw Error("Unknown option "+i)}},validators:ie},fe=l,le=h,pe=y,de=function(e){return te(e),e.headers=e.headers||{},e.data=Q.call(e,e.data,e.headers,e.transformRequest),e.headers=Z.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Z.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||ee.adapter)(e).then((function(t){return te(e),t.data=Q.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return Y(t)||(te(e),t&&t.response&&(t.response.data=Q.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},he=re,me=ce,ge=me.validators;function ye(e){this.defaults=e,this.interceptors={request:new pe,response:new pe}}ye.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=he(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&me.assertOptions(t,{silentJSONParsing:ge.transitional(ge.boolean,"1.0.0"),forcedJSONParsing:ge.transitional(ge.boolean,"1.0.0"),clarifyTimeoutError:ge.transitional(ge.boolean,"1.0.0")},!1);var n=[],r=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(r=r&&t.synchronous,n.unshift(t.fulfilled,t.rejected))}));var o,i=[];if(this.interceptors.response.forEach((function(e){i.push(e.fulfilled,e.rejected)})),!r){var a=[de,void 0];for(Array.prototype.unshift.apply(a,n),a=a.concat(i),o=Promise.resolve(e);a.length;)o=o.then(a.shift(),a.shift());return o}for(var s=e;n.length;){var u=n.shift(),c=n.shift();try{s=u(s)}catch(e){c(e);break}}try{o=de(s)}catch(e){return Promise.reject(e)}for(;i.length;)o=o.then(i.shift(),i.shift());return o},ye.prototype.getUri=function(e){return e=he(this.defaults,e),le(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},fe.forEach(["delete","get","head","options"],(function(e){ye.prototype[e]=function(t,n){return this.request(he(n||{},{method:e,url:t,data:(n||{}).data}))}})),fe.forEach(["post","put","patch"],(function(e){ye.prototype[e]=function(t,n,r){return this.request(he(r||{},{method:e,url:t,data:n}))}}));var ve=ye;function be(e){this.message=e}be.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},be.prototype.__CANCEL__=!0;var we=be,xe=we;function Ee(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new xe(e),t(n.reason))}))}Ee.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Ee.source=function(){var e;return{token:new Ee((function(t){e=t})),cancel:e}};var je=Ee,Ce=l,Oe=n,Te=ve,Ae=re;function Se(e){var t=new Te(e),n=Oe(Te.prototype.request,t);return Ce.extend(n,Te.prototype,t),Ce.extend(n,t),n}var ke=Se(V);ke.Axios=Te,ke.create=function(e){return Se(Ae(ke.defaults,e))},ke.Cancel=we,ke.CancelToken=je,ke.isCancel=G,ke.all=function(e){return Promise.all(e)},ke.spread=function(e){return function(t){return e.apply(null,t)}},ke.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError},t.exports=ke,t.exports.default=ke;var Re,Ne,Ue,Pe=t.exports;e.FtEditorialType=void 0,(Re=e.FtEditorialType||(e.FtEditorialType={})).ARTICLE="ARTICLE",Re.BOOK="BOOK",e.FtOpenMode=void 0,(Ne=e.FtOpenMode||(e.FtOpenMode={})).FLUIDTOPICS="FLUIDTOPICS",Ne.EXTERNAL="EXTERNAL",e.FtSearchResultType=void 0,(Ue=e.FtSearchResultType||(e.FtSearchResultType={})).MAP="MAP",Ue.DOCUMENT="DOCUMENT",Ue.TOPIC="TOPIC";class Be{constructor(e,t){this.tenantBaseUrl=e.trim().replace(/\/$/,""),this.ftCallingApp=`ft-public-api/${t}`}setCredentials(e,t){this.auth={username:e,password:t}}clearAuthentication(){this.auth=void 0}login(e,t){let n={login:e,password:t,rememberMe:!0};return this.post("/api/authentication/login",n).then((n=>(this.setCredentials(e,t),n)))}logout(){return this.post("/api/authentication/logout").then((()=>this.clearAuthentication()))}getMap(e){return this.get(`/api/khub/maps/${e}`)}getTableOfContent(e){return this.get(`/api/khub/maps/${e}/toc`)}getTopic(e,t){return this.get(`/api/khub/maps/${e}/topics/${t}`)}getTopicHTMLContent(e,t){return this.get(`/api/khub/maps/${e}/topics/${t}/content`)}getMapAttachments(e){return this.get(`/api/khub/maps/${e}/attachments`)}getMapAttachmentContent(e,t){return this.getRawData(`/api/khub/maps/${e}/attachments/${t}`)}getMapResources(e){return this.get(`/api/khub/maps/${e}/resources`)}getMapResourceContent(e,t){return this.getRawData(`/api/khub/maps/${e}/resources/${t}`)}getUnstructuredDocument(e){return this.get(`/api/khub/documents/${e}`)}getUnstructuredDocumentContent(e){return this.getRawData(`/api/khub/documents/${e}/content`)}getCollectionDocuments(e,t){return this.get(`/api/users/${e}/collections/${t}/documents`)}get defaultAxiosConfig(){return{auth:this.auth,headers:{"Ft-Calling-App":this.ftCallingApp}}}get(e){return Pe.get(this.tenantBaseUrl+e,this.defaultAxiosConfig).then((e=>this.handleResponse(e)))}post(e,t){return Pe.post(this.tenantBaseUrl+e,t,this.defaultAxiosConfig).then((e=>this.handleResponse(e)))}getRawData(e){return Pe({...this.defaultAxiosConfig,method:"get",url:this.tenantBaseUrl+e,responseType:"arraybuffer"}).then((e=>this.handleResponse(e)))}handleResponse(e){if(e.status>=200&&e.status<400)return e.data;throw new Error(`${e.status}: ${e.statusText}`)}}e.FluidTopicsApi=Be,e.default=Be}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/public-api",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Fluid Topics Public API",
5
5
  "main": "build/index.js",
6
6
  "typings": "build/index",
@@ -12,11 +12,19 @@
12
12
  "axios": "^0.21.4"
13
13
  },
14
14
  "devDependencies": {
15
+ "@rollup/plugin-commonjs": "^20.0.0",
16
+ "@rollup/plugin-json": "^4.1.0",
17
+ "@rollup/plugin-node-resolve": "^13.0.4",
18
+ "@rollup/plugin-typescript": "^8.2.5",
15
19
  "@types/chai": "^4.2.21",
16
20
  "@types/mocha": "^9.0.0",
17
21
  "@types/node": "^16.9.1",
18
22
  "chai": "^4.3.4",
19
23
  "mocha": "^9.1.1",
24
+ "rollup": "^2.56.3",
25
+ "rollup-plugin-node-resolve": "^5.2.0",
26
+ "rollup-plugin-terser": "^7.0.2",
27
+ "rollup-plugin-typescript2": "^0.30.0",
20
28
  "ts-node": "^10.2.1",
21
29
  "typescript": "^4.4.2"
22
30
  }