@communecter/cocolight-api-client 1.0.11 → 1.0.13

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
@@ -38,12 +38,14 @@ package.json # Dépendances, scripts, métadonnées
38
38
  ### ESM
39
39
 
40
40
  ```js
41
- import { ApiClient, Api } from "@communecter/cocolight-api-client";
41
+ import Cocolight from "@communecter/cocolight-api-client";
42
+
43
+ const { Api, ApiClient, tokenStorageStrategy } = Cocolight;
42
44
  ```
43
45
  ### CommonJS
44
46
 
45
47
  ```js
46
- const { ApiClient, Api } = require("@communecter/cocolight-api-client").default;
48
+ const { ApiClient, Api, tokenStorageStrategy } = require("@communecter/cocolight-api-client").default;
47
49
  ```
48
50
 
49
51
  ### 🔗 Intégration via CDN
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_communecter_cocolight_api_client=self.webpackChunk_communecter_cocolight_api_client||[]).push([[405],{405:(e,i,t)=>{t.d(i,{FileStorageStrategy:()=>o});var r=t(383),s=t(366),n=t(3),c=t(27);class o extends c.u3{constructor(e="tokens.json",i=n.join(s.homedir(),".config","cocolight")){super(),this.dir=i,this.filePath=n.join(i,e),this._ensureDirectoryExists()}_ensureDirectoryExists(){r.existsSync(this.dir)||r.mkdirSync(this.dir,{recursive:!0})}_readFile(){if(!r.existsSync(this.filePath))return{};try{return JSON.parse(r.readFileSync(this.filePath,"utf8"))}catch(e){return console.error("Error reading token file:",e),{}}}_writeFile(e){r.writeFileSync(this.filePath,JSON.stringify(e,null,2),"utf8")}getAccessToken(){return this._readFile().accessToken||null}setAccessToken(e){const i=this._readFile();i.accessToken=e,this._writeFile(i)}getRefreshToken(){return this._readFile().refreshToken||null}setRefreshToken(e){const i=this._readFile();i.refreshToken=e,this._writeFile(i)}clear(){this._writeFile({})}}}}]);
1
+ "use strict";exports.id=405,exports.ids=[405],exports.modules={405:(e,r,i)=>{i.d(r,{FileStorageStrategy:()=>c});var t=i(383),s=i(366),n=i(3),o=i(27);class c extends o.u3{constructor(e="tokens.json",r=n.join(s.homedir(),".config","cocolight")){super(),this.dir=r,this.filePath=n.join(r,e),this._ensureDirectoryExists()}_ensureDirectoryExists(){t.existsSync(this.dir)||t.mkdirSync(this.dir,{recursive:!0})}_readFile(){if(!t.existsSync(this.filePath))return{};try{return JSON.parse(t.readFileSync(this.filePath,"utf8"))}catch(e){return console.error("Error reading token file:",e),{}}}_writeFile(e){t.writeFileSync(this.filePath,JSON.stringify(e,null,2),"utf8")}getAccessToken(){return this._readFile().accessToken||null}setAccessToken(e){const r=this._readFile();r.accessToken=e,this._writeFile(r)}getRefreshToken(){return this._readFile().refreshToken||null}setRefreshToken(e){const r=this._readFile();r.refreshToken=e,this._writeFile(r)}clear(){this._writeFile({})}}}};
@@ -1 +1 @@
1
- "use strict";(self.webpackChunk_communecter_cocolight_api_client=self.webpackChunk_communecter_cocolight_api_client||[]).push([[931],{931:(e,n,t)=>{async function c(e){const{Readable:n}=await Promise.resolve().then(t.t.bind(t,272,19));return n.from(e)}async function o(){const{PassThrough:e}=await Promise.resolve().then(t.t.bind(t,272,19));return new e}t.d(n,{bufferToReadable:()=>c,createPassThrough:()=>o})}}]);
1
+ "use strict";exports.id=931,exports.ids=[931],exports.modules={931:(e,s,t)=>{async function r(e){const{Readable:s}=await Promise.resolve().then(t.t.bind(t,272,19));return s.from(e)}async function o(){const{PassThrough:e}=await Promise.resolve().then(t.t.bind(t,272,19));return new e}t.d(s,{bufferToReadable:()=>r,createPassThrough:()=>o})}};