@serverbench/js 1.5.10 → 1.5.12

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.
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk32TKBZKIcjs = require('./chunk-32TKBZKI.cjs');require('./chunk-3YNQTTHI.cjs');require('./chunk-LUTKTZJQ.cjs');require('./chunk-T4XJ6ERT.cjs');require('./chunk-5EFJ4GIY.cjs');require('./chunk-MZEH4ELC.cjs');require('./chunk-UZVZQL4F.cjs');require('./chunk-FXVJCHR6.cjs');require('./chunk-VX4LKECW.cjs');exports.default = _chunk32TKBZKIcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNEBSBX3Fcjs = require('./chunk-NEBSBX3F.cjs');require('./chunk-XM6Q3ZPG.cjs');require('./chunk-UZVZQL4F.cjs');require('./chunk-3YNQTTHI.cjs');require('./chunk-LUTKTZJQ.cjs');require('./chunk-T4XJ6ERT.cjs');require('./chunk-5EFJ4GIY.cjs');require('./chunk-FXVJCHR6.cjs');require('./chunk-VX4LKECW.cjs');exports.default = _chunkNEBSBX3Fcjs.a;
2
2
  //# sourceMappingURL=Serverbench.cjs.map
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-RNRSNTR3.js";import"./chunk-CTMUE5H3.js";import"./chunk-4GCQV2YR.js";import"./chunk-G27KF7G3.js";import"./chunk-4PA7GD6K.js";import"./chunk-73RD3OU4.js";import"./chunk-UTQPTYIQ.js";import"./chunk-GLEWOHG7.js";import"./chunk-4NMPBSP3.js";export{a as default};
1
+ import{a}from"./chunk-AB2ET2EM.js";import"./chunk-PYY2YREC.js";import"./chunk-UTQPTYIQ.js";import"./chunk-CTMUE5H3.js";import"./chunk-4GCQV2YR.js";import"./chunk-G27KF7G3.js";import"./chunk-4PA7GD6K.js";import"./chunk-GLEWOHG7.js";import"./chunk-4NMPBSP3.js";export{a as default};
2
2
  //# sourceMappingURL=Serverbench.js.map
@@ -1,2 +1,2 @@
1
- import{a as g}from"./chunk-CTMUE5H3.js";import{a as m}from"./chunk-73RD3OU4.js";import{a as u}from"./chunk-GLEWOHG7.js";import{nanoid as d}from"nanoid/non-secure";var n=class n{constructor(t,s,i){this.clientId=t,this.clientSecret=s,this.test=i}static get(t,s,i=!1){return(!n.instance||n.instance.clientId!==t||n.instance.clientSecret!==s||n.instance.test!==i)&&(n.instance=new n(t,s,i)),n.instance}get store(){return new m(this)}get voting(){return new g(this)}async member(t){return u.fromObject(this,await this.post("community","/member/search",t))}get domain(){return this.test?"https://dev.serverbench.io":"https://api.beta.serverbench.io"}async fetch(t,s,i){let a=new Headers({authorization:`ApiKey ${this.clientSecret}`});i&&a.set("Content-Type","application/json");let e=await fetch(`${this.domain}/${t}/${this.clientId}${s}`,{headers:a,method:i?"POST":"GET",body:i?JSON.stringify(i):void 0});if(e.status<200||e.status>=300)throw new Error(e.statusText);return e.json()}rid(){return d()}socket(t,s=a=>{},i=!1){let a=this.test?"ws://localhost:3030":"wss://live.beta.serverbench.io",e=new WebSocket(`${a}?${new URLSearchParams({key:this.clientSecret})}`),c=0,o=this.rid();return e.onopen=()=>{c=0,e.send(JSON.stringify({action:`community.${this.clientId}.${t}`,rid:o}))},e.onmessage=p=>{let r=JSON.parse(p.data);if(r.result!=null&&(Array.isArray(r.result)&&r.result.length||Object.keys(r.result).length>0)&&r.rid==o)s(r.result);else{let l=[r.realm];r.realm=="community"&&l.push(this.clientId),l.push(r.action),o=this.rid(),e.send(JSON.stringify({action:l.join("."),rid:o}))}},i||(e.onclose=()=>{c++,setTimeout(()=>{e=this.socket(t,s,!0).ws},Math.min(1e3*c*5,30*1e3))}),{dispose:()=>{e.onclose=null,e.close()},ws:e}}async get(t,s){return this.fetch(t,s)}async post(t,s,i={}){return this.fetch(t,s,i)}};n.instance=null;var h=n;export{h as a};
2
- //# sourceMappingURL=chunk-RNRSNTR3.js.map
1
+ import{a as m}from"./chunk-PYY2YREC.js";import{a as g}from"./chunk-CTMUE5H3.js";import{a as u}from"./chunk-GLEWOHG7.js";import{nanoid as d}from"nanoid/non-secure";var n=class n{constructor(t,s,i){this.clientId=t,this.clientSecret=s,this.test=i}static get(t,s,i=!1){return(!n.instance||n.instance.clientId!==t||n.instance.clientSecret!==s||n.instance.test!==i)&&(n.instance=new n(t,s,i)),n.instance}get store(){return new m(this)}get voting(){return new g(this)}async member(t){return u.fromObject(this,await this.post("community","/member/search",t))}get domain(){return this.test?"https://dev.serverbench.io":"https://api.beta.serverbench.io"}async fetch(t,s,i){let a=new Headers({authorization:`ApiKey ${this.clientSecret}`});i&&a.set("Content-Type","application/json");let e=await fetch(`${this.domain}/${t}/${this.clientId}${s}`,{headers:a,method:i?"POST":"GET",body:i?JSON.stringify(i):void 0});if(e.status<200||e.status>=300)throw new Error(e.statusText);return e.json()}rid(){return d()}socket(t,s=a=>{},i=!1){let a=this.test?"ws://localhost:3030":"wss://live.beta.serverbench.io",e=new WebSocket(`${a}?${new URLSearchParams({key:this.clientSecret})}`),c=0,o=this.rid();return e.onopen=()=>{c=0,e.send(JSON.stringify({action:`community.${this.clientId}.${t}`,rid:o}))},e.onmessage=p=>{let r=JSON.parse(p.data);if(r.result!=null&&(Array.isArray(r.result)&&r.result.length||Object.keys(r.result).length>0)&&r.rid==o)s(r.result);else{let l=[r.realm];r.realm=="community"&&l.push(this.clientId),l.push(r.action),o=this.rid(),e.send(JSON.stringify({action:l.join("."),rid:o}))}},i||(e.onclose=()=>{c++,setTimeout(()=>{e=this.socket(t,s,!0).ws},Math.min(1e3*c*5,30*1e3))}),{dispose:()=>{e.onclose=null,e.close()},ws:e}}async get(t,s){return this.fetch(t,s)}async post(t,s,i={}){return this.fetch(t,s,i)}};n.instance=null;var h=n;export{h as a};
2
+ //# sourceMappingURL=chunk-AB2ET2EM.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk3YNQTTHIcjs = require('./chunk-3YNQTTHI.cjs');var _chunkMZEH4ELCcjs = require('./chunk-MZEH4ELC.cjs');var _chunkFXVJCHR6cjs = require('./chunk-FXVJCHR6.cjs');var _nonsecure = require('nanoid/non-secure');var n=class n{constructor(t,s,i){this.clientId=t,this.clientSecret=s,this.test=i}static get(t,s,i=!1){return(!n.instance||n.instance.clientId!==t||n.instance.clientSecret!==s||n.instance.test!==i)&&(n.instance=new n(t,s,i)),n.instance}get store(){return new (0, _chunkMZEH4ELCcjs.a)(this)}get voting(){return new (0, _chunk3YNQTTHIcjs.a)(this)}async member(t){return _chunkFXVJCHR6cjs.a.fromObject(this,await this.post("community","/member/search",t))}get domain(){return this.test?"https://dev.serverbench.io":"https://api.beta.serverbench.io"}async fetch(t,s,i){let a=new Headers({authorization:`ApiKey ${this.clientSecret}`});i&&a.set("Content-Type","application/json");let e=await fetch(`${this.domain}/${t}/${this.clientId}${s}`,{headers:a,method:i?"POST":"GET",body:i?JSON.stringify(i):void 0});if(e.status<200||e.status>=300)throw new Error(e.statusText);return e.json()}rid(){return _nonsecure.nanoid.call(void 0, )}socket(t,s=a=>{},i=!1){let a=this.test?"ws://localhost:3030":"wss://live.beta.serverbench.io",e=new WebSocket(`${a}?${new URLSearchParams({key:this.clientSecret})}`),c=0,o=this.rid();return e.onopen=()=>{c=0,e.send(JSON.stringify({action:`community.${this.clientId}.${t}`,rid:o}))},e.onmessage=p=>{let r=JSON.parse(p.data);if(r.result!=null&&(Array.isArray(r.result)&&r.result.length||Object.keys(r.result).length>0)&&r.rid==o)s(r.result);else{let l=[r.realm];r.realm=="community"&&l.push(this.clientId),l.push(r.action),o=this.rid(),e.send(JSON.stringify({action:l.join("."),rid:o}))}},i||(e.onclose=()=>{c++,setTimeout(()=>{e=this.socket(t,s,!0).ws},Math.min(1e3*c*5,30*1e3))}),{dispose:()=>{e.onclose=null,e.close()},ws:e}}async get(t,s){return this.fetch(t,s)}async post(t,s,i={}){return this.fetch(t,s,i)}};n.instance=null;var h=n;exports.a = h;
2
- //# sourceMappingURL=chunk-32TKBZKI.cjs.map
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXM6Q3ZPGcjs = require('./chunk-XM6Q3ZPG.cjs');var _chunk3YNQTTHIcjs = require('./chunk-3YNQTTHI.cjs');var _chunkFXVJCHR6cjs = require('./chunk-FXVJCHR6.cjs');var _nonsecure = require('nanoid/non-secure');var n=class n{constructor(t,s,i){this.clientId=t,this.clientSecret=s,this.test=i}static get(t,s,i=!1){return(!n.instance||n.instance.clientId!==t||n.instance.clientSecret!==s||n.instance.test!==i)&&(n.instance=new n(t,s,i)),n.instance}get store(){return new (0, _chunkXM6Q3ZPGcjs.a)(this)}get voting(){return new (0, _chunk3YNQTTHIcjs.a)(this)}async member(t){return _chunkFXVJCHR6cjs.a.fromObject(this,await this.post("community","/member/search",t))}get domain(){return this.test?"https://dev.serverbench.io":"https://api.beta.serverbench.io"}async fetch(t,s,i){let a=new Headers({authorization:`ApiKey ${this.clientSecret}`});i&&a.set("Content-Type","application/json");let e=await fetch(`${this.domain}/${t}/${this.clientId}${s}`,{headers:a,method:i?"POST":"GET",body:i?JSON.stringify(i):void 0});if(e.status<200||e.status>=300)throw new Error(e.statusText);return e.json()}rid(){return _nonsecure.nanoid.call(void 0, )}socket(t,s=a=>{},i=!1){let a=this.test?"ws://localhost:3030":"wss://live.beta.serverbench.io",e=new WebSocket(`${a}?${new URLSearchParams({key:this.clientSecret})}`),c=0,o=this.rid();return e.onopen=()=>{c=0,e.send(JSON.stringify({action:`community.${this.clientId}.${t}`,rid:o}))},e.onmessage=p=>{let r=JSON.parse(p.data);if(r.result!=null&&(Array.isArray(r.result)&&r.result.length||Object.keys(r.result).length>0)&&r.rid==o)s(r.result);else{let l=[r.realm];r.realm=="community"&&l.push(this.clientId),l.push(r.action),o=this.rid(),e.send(JSON.stringify({action:l.join("."),rid:o}))}},i||(e.onclose=()=>{c++,setTimeout(()=>{e=this.socket(t,s,!0).ws},Math.min(1e3*c*5,30*1e3))}),{dispose:()=>{e.onclose=null,e.close()},ws:e}}async get(t,s){return this.fetch(t,s)}async post(t,s,i={}){return this.fetch(t,s,i)}};n.instance=null;var h=n;exports.a = h;
2
+ //# sourceMappingURL=chunk-NEBSBX3F.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/quique/Documents/serverbench/js/dist/chunk-32TKBZKI.cjs","../src/Serverbench.ts"],"names":["_Serverbench","clientId","clientSecret","test","Store","Voting","find","Member","realm","url","body","headers"],"mappings":"AAAA,iIAAwC,wDAAyC,wDAAyC,8CCAnG,IAKFA,CAAAA,CAArB,MAAqBA,CAAY,CAQrB,WAAA,CAAYC,CAAAA,CAAkBC,CAAAA,CAAsBC,CAAAA,CAAe,CACvE,IAAA,CAAK,QAAA,CAAWF,CAAAA,CAChB,IAAA,CAAK,YAAA,CAAeC,CAAAA,CACpB,IAAA,CAAK,IAAA,CAAOC,CAChB,CAEA,OAAO,GAAA,CAAIF,CAAAA,CAAkBC,CAAAA,CAAsBC,CAAAA,CAAgB,CAAA,CAAA,CAAO,CACtE,MAAA,CAAI,CAACH,CAAAA,CAAY,QAAA,EAAYA,CAAAA,CAAY,QAAA,CAAS,QAAA,GAAaC,CAAAA,EAAYD,CAAAA,CAAY,QAAA,CAAS,YAAA,GAAiBE,CAAAA,EAAgBF,CAAAA,CAAY,QAAA,CAAS,IAAA,GAASG,CAAAA,CAAAA,EAAAA,CAC3JH,CAAAA,CAAY,QAAA,CAAW,IAAIA,CAAAA,CAAYC,CAAAA,CAAUC,CAAAA,CAAcC,CAAI,CAAA,CAAA,CAEhEH,CAAAA,CAAY,QACvB,CAEA,IAAI,KAAA,CAAA,CAAQ,CACR,OAAO,IAAII,wBAAAA,CAAM,IAAI,CACzB,CAEA,IAAI,MAAA,CAAA,CAAS,CACT,OAAO,IAAIC,wBAAAA,CAAO,IAAI,CAC1B,CAEA,MAAa,MAAA,CAAOC,CAAAA,CAGjB,CACC,OAAOC,mBAAAA,CAAO,UAAA,CAAW,IAAA,CAAM,MAAM,IAAA,CAAK,IAAA,CAAK,WAAA,CAAa,gBAAA,CAAkBD,CAAI,CAAC,CACvF,CAEA,IAAI,MAAA,CAAA,CAAiB,CACjB,OAAO,IAAA,CAAK,IAAA,CAAO,4BAAA,CAA+B,iCACtD,CAEA,MAAc,KAAA,CAAME,CAAAA,CAAeC,CAAAA,CAAaC,CAAAA,CAAY,CACxD,IAAMC,CAAAA,CAAU,IAAI,OAAA,CAAQ,CACxB,aAAA,CAAe,CAAA,OAAA,EAAU,IAAA,CAAK,YAAY,CAAA,CAAA","file":"/Users/quique/Documents/serverbench/js/dist/chunk-32TKBZKI.cjs","sourcesContent":[null,"import { nanoid } from \"nanoid/non-secure\"\nimport Member from \"./Member.js\"\nimport Store from \"./store/Store.js\"\nimport Voting from \"./voting/Voting.js\"\n\nexport default class Serverbench {\n\n clientId: string\n clientSecret: string\n test: boolean\n\n private static instance: Serverbench | null = null\n\n private constructor(clientId: string, clientSecret: string, test: boolean) {\n this.clientId = clientId\n this.clientSecret = clientSecret\n this.test = test\n }\n\n static get(clientId: string, clientSecret: string, test: boolean = false) {\n if (!Serverbench.instance || Serverbench.instance.clientId !== clientId || Serverbench.instance.clientSecret !== clientSecret || Serverbench.instance.test !== test) {\n Serverbench.instance = new Serverbench(clientId, clientSecret, test)\n }\n return Serverbench.instance\n }\n\n get store() {\n return new Store(this)\n }\n\n get voting() {\n return new Voting(this)\n }\n\n public async member(find: {\n username?: string,\n eid?: string,\n }) {\n return Member.fromObject(this, await this.post('community', '/member/search', find))\n }\n\n get domain(): string {\n return this.test ? 'https://dev.serverbench.io' : 'https://api.beta.serverbench.io'\n }\n\n private async fetch(realm: string, url: string, body?: any) {\n const headers = new Headers({\n authorization: `ApiKey ${this.clientSecret}`,\n })\n if (body) {\n headers.set('Content-Type', 'application/json')\n }\n const response = await fetch(`${this.domain}/${realm}/${this.clientId}${url}`, {\n headers,\n method: body ? 'POST' : 'GET',\n body: body ? JSON.stringify(body) : undefined\n })\n if (response.status < 200 || response.status >= 300) {\n throw new Error(response.statusText)\n }\n return response.json()\n }\n\n private rid() {\n return nanoid()\n }\n\n public socket(action: string, handleMessage = (data: any) => { }, ignoreClose = false) {\n const domain = this.test ? 'ws://localhost:3030' : 'wss://live.beta.serverbench.io'\n let ws = new WebSocket(`${domain}?${new URLSearchParams({\n key: this.clientSecret,\n })}`)\n let i = 0\n let expecting = this.rid()\n ws.onopen = () => {\n i = 0\n ws.send(JSON.stringify({\n action: `community.${this.clientId}.${action}`,\n rid: expecting\n }))\n }\n ws.onmessage = (event) => {\n const data = JSON.parse(event.data)\n if (data.result != null && ((Array.isArray(data.result) && data.result.length) || Object.keys(data.result).length > 0) && data.rid == expecting) {\n handleMessage(data.result)\n } else {\n let action = [data.realm]\n if (data.realm == 'community') {\n action.push(this.clientId)\n }\n action.push(data.action)\n expecting = this.rid()\n ws.send(JSON.stringify({\n action: action.join('.'),\n rid: expecting\n }))\n }\n }\n if (!ignoreClose) {\n ws.onclose = () => {\n i++\n setTimeout(() => {\n ws = this.socket(action, handleMessage, true).ws\n }, Math.min(1000 * (i) * 5, 30 * 1000));\n }\n }\n return {\n dispose: () => {\n ws.onclose = null\n ws.close()\n },\n ws\n }\n }\n\n async get(realm: string, url: string) {\n return this.fetch(realm, url)\n }\n\n async post(realm: string, url: string, body: any = {}) {\n return this.fetch(realm, url, body)\n }\n\n}"]}
1
+ {"version":3,"sources":["/Users/quique/Documents/serverbench/js/dist/chunk-NEBSBX3F.cjs","../src/Serverbench.ts"],"names":["_Serverbench","clientId","clientSecret","test","Store","Voting","find","Member","realm","url","body","headers"],"mappings":"AAAA,iIAAwC,wDAAyC,wDAAyC,8CCAnG,IAKFA,CAAAA,CAArB,MAAqBA,CAAY,CAQrB,WAAA,CAAYC,CAAAA,CAAkBC,CAAAA,CAAsBC,CAAAA,CAAe,CACvE,IAAA,CAAK,QAAA,CAAWF,CAAAA,CAChB,IAAA,CAAK,YAAA,CAAeC,CAAAA,CACpB,IAAA,CAAK,IAAA,CAAOC,CAChB,CAEA,OAAO,GAAA,CAAIF,CAAAA,CAAkBC,CAAAA,CAAsBC,CAAAA,CAAgB,CAAA,CAAA,CAAO,CACtE,MAAA,CAAI,CAACH,CAAAA,CAAY,QAAA,EAAYA,CAAAA,CAAY,QAAA,CAAS,QAAA,GAAaC,CAAAA,EAAYD,CAAAA,CAAY,QAAA,CAAS,YAAA,GAAiBE,CAAAA,EAAgBF,CAAAA,CAAY,QAAA,CAAS,IAAA,GAASG,CAAAA,CAAAA,EAAAA,CAC3JH,CAAAA,CAAY,QAAA,CAAW,IAAIA,CAAAA,CAAYC,CAAAA,CAAUC,CAAAA,CAAcC,CAAI,CAAA,CAAA,CAEhEH,CAAAA,CAAY,QACvB,CAEA,IAAI,KAAA,CAAA,CAAQ,CACR,OAAO,IAAII,wBAAAA,CAAM,IAAI,CACzB,CAEA,IAAI,MAAA,CAAA,CAAS,CACT,OAAO,IAAIC,wBAAAA,CAAO,IAAI,CAC1B,CAEA,MAAa,MAAA,CAAOC,CAAAA,CAGjB,CACC,OAAOC,mBAAAA,CAAO,UAAA,CAAW,IAAA,CAAM,MAAM,IAAA,CAAK,IAAA,CAAK,WAAA,CAAa,gBAAA,CAAkBD,CAAI,CAAC,CACvF,CAEA,IAAI,MAAA,CAAA,CAAiB,CACjB,OAAO,IAAA,CAAK,IAAA,CAAO,4BAAA,CAA+B,iCACtD,CAEA,MAAc,KAAA,CAAME,CAAAA,CAAeC,CAAAA,CAAaC,CAAAA,CAAY,CACxD,IAAMC,CAAAA,CAAU,IAAI,OAAA,CAAQ,CACxB,aAAA,CAAe,CAAA,OAAA,EAAU,IAAA,CAAK,YAAY,CAAA,CAAA","file":"/Users/quique/Documents/serverbench/js/dist/chunk-NEBSBX3F.cjs","sourcesContent":[null,"import { nanoid } from \"nanoid/non-secure\"\nimport Member from \"./Member.js\"\nimport Store from \"./store/Store.js\"\nimport Voting from \"./voting/Voting.js\"\n\nexport default class Serverbench {\n\n clientId: string\n clientSecret: string\n test: boolean\n\n private static instance: Serverbench | null = null\n\n private constructor(clientId: string, clientSecret: string, test: boolean) {\n this.clientId = clientId\n this.clientSecret = clientSecret\n this.test = test\n }\n\n static get(clientId: string, clientSecret: string, test: boolean = false) {\n if (!Serverbench.instance || Serverbench.instance.clientId !== clientId || Serverbench.instance.clientSecret !== clientSecret || Serverbench.instance.test !== test) {\n Serverbench.instance = new Serverbench(clientId, clientSecret, test)\n }\n return Serverbench.instance\n }\n\n get store() {\n return new Store(this)\n }\n\n get voting() {\n return new Voting(this)\n }\n\n public async member(find: {\n username?: string,\n eid?: string,\n }) {\n return Member.fromObject(this, await this.post('community', '/member/search', find))\n }\n\n get domain(): string {\n return this.test ? 'https://dev.serverbench.io' : 'https://api.beta.serverbench.io'\n }\n\n private async fetch(realm: string, url: string, body?: any) {\n const headers = new Headers({\n authorization: `ApiKey ${this.clientSecret}`,\n })\n if (body) {\n headers.set('Content-Type', 'application/json')\n }\n const response = await fetch(`${this.domain}/${realm}/${this.clientId}${url}`, {\n headers,\n method: body ? 'POST' : 'GET',\n body: body ? JSON.stringify(body) : undefined\n })\n if (response.status < 200 || response.status >= 300) {\n throw new Error(response.statusText)\n }\n return response.json()\n }\n\n private rid() {\n return nanoid()\n }\n\n public socket(action: string, handleMessage = (data: any) => { }, ignoreClose = false) {\n const domain = this.test ? 'ws://localhost:3030' : 'wss://live.beta.serverbench.io'\n let ws = new WebSocket(`${domain}?${new URLSearchParams({\n key: this.clientSecret,\n })}`)\n let i = 0\n let expecting = this.rid()\n ws.onopen = () => {\n i = 0\n ws.send(JSON.stringify({\n action: `community.${this.clientId}.${action}`,\n rid: expecting\n }))\n }\n ws.onmessage = (event) => {\n const data = JSON.parse(event.data)\n if (data.result != null && ((Array.isArray(data.result) && data.result.length) || Object.keys(data.result).length > 0) && data.rid == expecting) {\n handleMessage(data.result)\n } else {\n let action = [data.realm]\n if (data.realm == 'community') {\n action.push(this.clientId)\n }\n action.push(data.action)\n expecting = this.rid()\n ws.send(JSON.stringify({\n action: action.join('.'),\n rid: expecting\n }))\n }\n }\n if (!ignoreClose) {\n ws.onclose = () => {\n i++\n setTimeout(() => {\n ws = this.socket(action, handleMessage, true).ws\n }, Math.min(1000 * (i) * 5, 30 * 1000));\n }\n }\n return {\n dispose: () => {\n ws.onclose = null\n ws.close()\n },\n ws\n }\n }\n\n async get(realm: string, url: string) {\n return this.fetch(realm, url)\n }\n\n async post(realm: string, url: string, body: any = {}) {\n return this.fetch(realm, url, body)\n }\n\n}"]}
@@ -1,2 +1,2 @@
1
- import{a as m}from"./chunk-UTQPTYIQ.js";import{a}from"./chunk-4NMPBSP3.js";var l=class{constructor(t){this.client=t}async get(t,i){return m.fromObject(this.client,await this.client.post("community","/store/view",{username:t,eid:i}))}async subscriptionCount(){let{count:t}=await this.client.get("community","/subscription/count");return t}checkout(t,i,e,s){let o=t.map(n=>typeof n=="string"?n:n.id),c=i.map(n=>typeof n=="string"?n:n.id),u=typeof e=="string"?e:e.id;return new a(this.client,"/community/checkout",{prices:o.join(","),discounts:c.join(","),member:u,country:s??void 0})}async getCheckout(t,i,e,s,o=null){let c=t.map(r=>typeof r=="string"?r:r.id),u=i.map(r=>typeof r=="string"?r:r.id),n=typeof e=="string"?e:e.id;return await this.client.post("community","/store/checkout",{prices:c,discounts:u,member:n,email:s,country:o??void 0})}async claimCheckout(t){let i=await fetch(`${this.client.domain}/checkout/claim`,{headers:{authorization:`Bearer ${t}`},method:"POST"});if(i.status!=200&&i.status!=201)throw new Error(`Error claiming checkout: ${i.statusText}`)}billing(){return new a(this.client,"/billing")}};export{l as a};
2
- //# sourceMappingURL=chunk-73RD3OU4.js.map
1
+ import{a as m}from"./chunk-UTQPTYIQ.js";import{a}from"./chunk-4NMPBSP3.js";var l=class{constructor(t){this.client=t}async get(t,i){return m.fromObject(this.client,await this.client.post("community","/store/view",{username:t,eid:i}))}async subscriptionCount(){let{count:t}=await this.client.get("community","/subscription/count");return t}checkout(t,i,e,s){let o=t.map(n=>typeof n=="string"?n:n.id),c=i.map(n=>typeof n=="string"?n:n.id),u=typeof e=="string"?e:e.id;return new a(this.client,"/community/checkout",{prices:o.join(","),discounts:c.join(","),member:u,country:s??void 0})}async getCheckout(t,i,e,s,o=null){let c=t.map(r=>typeof r=="string"?r:r.id),u=i.map(r=>typeof r=="string"?r:r.id),n=typeof e=="string"?e:e.id;return await this.client.post("community","/store/checkout",{prices:c,discounts:u,member:n,email:s,country:o??void 0})}async claimCheckout(t){let i=await fetch(`${this.client.domain}/checkout/claim`,{headers:{authorization:`Bearer ${t}`},method:"POST"});if(i.status!=200&&i.status!=204)throw new Error(`Error claiming checkout: ${i.statusText}`)}billing(){return new a(this.client,"/billing")}};export{l as a};
2
+ //# sourceMappingURL=chunk-PYY2YREC.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/store/Store.ts"],"sourcesContent":["import Element from \"../element/Element.js\";\nimport Member from \"../Member.js\";\nimport type Serverbench from \"../Serverbench.js\";\nimport IDiscount from \"./IDiscount.js\";\nimport ISkuPrice from \"./ISkuPrice.js\";\nimport StoreDisplay from \"./StoreDisplay.js\";\n\nexport default class Store {\n\n private client: Serverbench\n\n constructor(client: Serverbench) {\n this.client = client\n }\n\n async get(username?: string, eid?: string) {\n return StoreDisplay.fromObject(this.client, await this.client.post('community', '/store/view', {\n username,\n eid\n }))\n }\n\n async subscriptionCount() {\n const { count } = await this.client.get('community', '/subscription/count')\n return count\n }\n\n checkout(prices: ISkuPrice[] | string[], discounts: IDiscount[] | string[], member: Member | string, country: string | null) {\n const finalPrices = prices.map(price => typeof price === 'string' ? price : price.id)\n const finalDiscounts = discounts.map(discount => typeof discount === 'string' ? discount : discount.id)\n const finalMember = typeof member === 'string' ? member : member.id\n return new Element(\n this.client,\n '/community/checkout',\n {\n prices: finalPrices.join(','),\n discounts: finalDiscounts.join(','),\n member: finalMember,\n country: country ?? undefined\n }\n )\n }\n\n async getCheckout(prices: ISkuPrice[] | string[], discounts: IDiscount[] | string[], member: Member | string, email: string, country: string | null = null) {\n const finalPrices = prices.map(price => typeof price === 'string' ? price : price.id)\n const finalDiscounts = discounts.map(discount => typeof discount === 'string' ? discount : discount.id)\n const finalMember = typeof member === 'string' ? member : member.id\n const checkout = await this.client.post('community', '/store/checkout', {\n prices: finalPrices,\n discounts: finalDiscounts,\n member: finalMember,\n email,\n country: country ?? undefined\n })\n return checkout\n }\n\n async claimCheckout(token: string) {\n const req = await fetch(`${this.client.domain}/checkout/claim`, {\n headers: {\n authorization: `Bearer ${token}`\n },\n method: 'POST'\n })\n if (req.status != 200 && req.status != 201) {\n throw new Error(`Error claiming checkout: ${req.statusText}`)\n }\n }\n\n billing() {\n return new Element(this.client, '/billing')\n }\n\n}"],"mappings":"2EAOA,IAAqBA,EAArB,KAA2B,CAIvB,YAAYC,EAAqB,CAC7B,KAAK,OAASA,CAClB,CAEA,MAAM,IAAIC,EAAmBC,EAAc,CACvC,OAAOC,EAAa,WAAW,KAAK,OAAQ,MAAM,KAAK,OAAO,KAAK,YAAa,cAAe,CAC3F,SAAAF,EACA,IAAAC,CACJ,CAAC,CAAC,CACN,CAEA,MAAM,mBAAoB,CACtB,GAAM,CAAE,MAAAE,CAAM,EAAI,MAAM,KAAK,OAAO,IAAI,YAAa,qBAAqB,EAC1E,OAAOA,CACX,CAEA,SAASC,EAAgCC,EAAmCC,EAAyBC,EAAwB,CACzH,IAAMC,EAAcJ,EAAO,IAAIK,GAAS,OAAOA,GAAU,SAAWA,EAAQA,EAAM,EAAE,EAC9EC,EAAiBL,EAAU,IAAIM,GAAY,OAAOA,GAAa,SAAWA,EAAWA,EAAS,EAAE,EAChGC,EAAc,OAAON,GAAW,SAAWA,EAASA,EAAO,GACjE,OAAO,IAAIO,EACP,KAAK,OACL,sBACA,CACI,OAAQL,EAAY,KAAK,GAAG,EAC5B,UAAWE,EAAe,KAAK,GAAG,EAClC,OAAQE,EACR,QAASL,GAAW,MACxB,CACJ,CACJ,CAEA,MAAM,YAAYH,EAAgCC,EAAmCC,EAAyBQ,EAAeP,EAAyB,KAAM,CACxJ,IAAMC,EAAcJ,EAAO,IAAIK,GAAS,OAAOA,GAAU,SAAWA,EAAQA,EAAM,EAAE,EAC9EC,EAAiBL,EAAU,IAAIM,GAAY,OAAOA,GAAa,SAAWA,EAAWA,EAAS,EAAE,EAChGC,EAAc,OAAON,GAAW,SAAWA,EAASA,EAAO,GAQjE,OAPiB,MAAM,KAAK,OAAO,KAAK,YAAa,kBAAmB,CACpE,OAAQE,EACR,UAAWE,EACX,OAAQE,EACR,MAAAE,EACA,QAASP,GAAW,MACxB,CAAC,CAEL,CAEA,MAAM,cAAcQ,EAAe,CAC/B,IAAMC,EAAM,MAAM,MAAM,GAAG,KAAK,OAAO,MAAM,kBAAmB,CAC5D,QAAS,CACL,cAAe,UAAUD,CAAK,EAClC,EACA,OAAQ,MACZ,CAAC,EACD,GAAIC,EAAI,QAAU,KAAOA,EAAI,QAAU,IACnC,MAAM,IAAI,MAAM,4BAA4BA,EAAI,UAAU,EAAE,CAEpE,CAEA,SAAU,CACN,OAAO,IAAIH,EAAQ,KAAK,OAAQ,UAAU,CAC9C,CAEJ","names":["Store","client","username","eid","StoreDisplay","count","prices","discounts","member","country","finalPrices","price","finalDiscounts","discount","finalMember","Element","email","token","req"]}
1
+ {"version":3,"sources":["../src/store/Store.ts"],"sourcesContent":["import Element from \"../element/Element.js\";\nimport Member from \"../Member.js\";\nimport type Serverbench from \"../Serverbench.js\";\nimport IDiscount from \"./IDiscount.js\";\nimport ISkuPrice from \"./ISkuPrice.js\";\nimport StoreDisplay from \"./StoreDisplay.js\";\n\nexport default class Store {\n\n private client: Serverbench\n\n constructor(client: Serverbench) {\n this.client = client\n }\n\n async get(username?: string, eid?: string) {\n return StoreDisplay.fromObject(this.client, await this.client.post('community', '/store/view', {\n username,\n eid\n }))\n }\n\n async subscriptionCount() {\n const { count } = await this.client.get('community', '/subscription/count')\n return count\n }\n\n checkout(prices: ISkuPrice[] | string[], discounts: IDiscount[] | string[], member: Member | string, country: string | null) {\n const finalPrices = prices.map(price => typeof price === 'string' ? price : price.id)\n const finalDiscounts = discounts.map(discount => typeof discount === 'string' ? discount : discount.id)\n const finalMember = typeof member === 'string' ? member : member.id\n return new Element(\n this.client,\n '/community/checkout',\n {\n prices: finalPrices.join(','),\n discounts: finalDiscounts.join(','),\n member: finalMember,\n country: country ?? undefined\n }\n )\n }\n\n async getCheckout(prices: ISkuPrice[] | string[], discounts: IDiscount[] | string[], member: Member | string, email: string, country: string | null = null) {\n const finalPrices = prices.map(price => typeof price === 'string' ? price : price.id)\n const finalDiscounts = discounts.map(discount => typeof discount === 'string' ? discount : discount.id)\n const finalMember = typeof member === 'string' ? member : member.id\n const checkout = await this.client.post('community', '/store/checkout', {\n prices: finalPrices,\n discounts: finalDiscounts,\n member: finalMember,\n email,\n country: country ?? undefined\n })\n return checkout\n }\n\n async claimCheckout(token: string) {\n const req = await fetch(`${this.client.domain}/checkout/claim`, {\n headers: {\n authorization: `Bearer ${token}`\n },\n method: 'POST'\n })\n if (req.status != 200 && req.status != 204) {\n throw new Error(`Error claiming checkout: ${req.statusText}`)\n }\n }\n\n billing() {\n return new Element(this.client, '/billing')\n }\n\n}"],"mappings":"2EAOA,IAAqBA,EAArB,KAA2B,CAIvB,YAAYC,EAAqB,CAC7B,KAAK,OAASA,CAClB,CAEA,MAAM,IAAIC,EAAmBC,EAAc,CACvC,OAAOC,EAAa,WAAW,KAAK,OAAQ,MAAM,KAAK,OAAO,KAAK,YAAa,cAAe,CAC3F,SAAAF,EACA,IAAAC,CACJ,CAAC,CAAC,CACN,CAEA,MAAM,mBAAoB,CACtB,GAAM,CAAE,MAAAE,CAAM,EAAI,MAAM,KAAK,OAAO,IAAI,YAAa,qBAAqB,EAC1E,OAAOA,CACX,CAEA,SAASC,EAAgCC,EAAmCC,EAAyBC,EAAwB,CACzH,IAAMC,EAAcJ,EAAO,IAAIK,GAAS,OAAOA,GAAU,SAAWA,EAAQA,EAAM,EAAE,EAC9EC,EAAiBL,EAAU,IAAIM,GAAY,OAAOA,GAAa,SAAWA,EAAWA,EAAS,EAAE,EAChGC,EAAc,OAAON,GAAW,SAAWA,EAASA,EAAO,GACjE,OAAO,IAAIO,EACP,KAAK,OACL,sBACA,CACI,OAAQL,EAAY,KAAK,GAAG,EAC5B,UAAWE,EAAe,KAAK,GAAG,EAClC,OAAQE,EACR,QAASL,GAAW,MACxB,CACJ,CACJ,CAEA,MAAM,YAAYH,EAAgCC,EAAmCC,EAAyBQ,EAAeP,EAAyB,KAAM,CACxJ,IAAMC,EAAcJ,EAAO,IAAIK,GAAS,OAAOA,GAAU,SAAWA,EAAQA,EAAM,EAAE,EAC9EC,EAAiBL,EAAU,IAAIM,GAAY,OAAOA,GAAa,SAAWA,EAAWA,EAAS,EAAE,EAChGC,EAAc,OAAON,GAAW,SAAWA,EAASA,EAAO,GAQjE,OAPiB,MAAM,KAAK,OAAO,KAAK,YAAa,kBAAmB,CACpE,OAAQE,EACR,UAAWE,EACX,OAAQE,EACR,MAAAE,EACA,QAASP,GAAW,MACxB,CAAC,CAEL,CAEA,MAAM,cAAcQ,EAAe,CAC/B,IAAMC,EAAM,MAAM,MAAM,GAAG,KAAK,OAAO,MAAM,kBAAmB,CAC5D,QAAS,CACL,cAAe,UAAUD,CAAK,EAClC,EACA,OAAQ,MACZ,CAAC,EACD,GAAIC,EAAI,QAAU,KAAOA,EAAI,QAAU,IACnC,MAAM,IAAI,MAAM,4BAA4BA,EAAI,UAAU,EAAE,CAEpE,CAEA,SAAU,CACN,OAAO,IAAIH,EAAQ,KAAK,OAAQ,UAAU,CAC9C,CAEJ","names":["Store","client","username","eid","StoreDisplay","count","prices","discounts","member","country","finalPrices","price","finalDiscounts","discount","finalMember","Element","email","token","req"]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _chunkUZVZQL4Fcjs = require('./chunk-UZVZQL4F.cjs');var _chunkVX4LKECWcjs = require('./chunk-VX4LKECW.cjs');var l=class{constructor(t){this.client=t}async get(t,i){return _chunkUZVZQL4Fcjs.a.fromObject(this.client,await this.client.post("community","/store/view",{username:t,eid:i}))}async subscriptionCount(){let{count:t}=await this.client.get("community","/subscription/count");return t}checkout(t,i,e,s){let o=t.map(n=>typeof n=="string"?n:n.id),c=i.map(n=>typeof n=="string"?n:n.id),u=typeof e=="string"?e:e.id;return new (0, _chunkVX4LKECWcjs.a)(this.client,"/community/checkout",{prices:o.join(","),discounts:c.join(","),member:u,country:_nullishCoalesce(s, () => (void 0))})}async getCheckout(t,i,e,s,o=null){let c=t.map(r=>typeof r=="string"?r:r.id),u=i.map(r=>typeof r=="string"?r:r.id),n=typeof e=="string"?e:e.id;return await this.client.post("community","/store/checkout",{prices:c,discounts:u,member:n,email:s,country:_nullishCoalesce(o, () => (void 0))})}async claimCheckout(t){let i=await fetch(`${this.client.domain}/checkout/claim`,{headers:{authorization:`Bearer ${t}`},method:"POST"});if(i.status!=200&&i.status!=201)throw new Error(`Error claiming checkout: ${i.statusText}`)}billing(){return new (0, _chunkVX4LKECWcjs.a)(this.client,"/billing")}};exports.a = l;
2
- //# sourceMappingURL=chunk-MZEH4ELC.cjs.map
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _chunkUZVZQL4Fcjs = require('./chunk-UZVZQL4F.cjs');var _chunkVX4LKECWcjs = require('./chunk-VX4LKECW.cjs');var l=class{constructor(t){this.client=t}async get(t,i){return _chunkUZVZQL4Fcjs.a.fromObject(this.client,await this.client.post("community","/store/view",{username:t,eid:i}))}async subscriptionCount(){let{count:t}=await this.client.get("community","/subscription/count");return t}checkout(t,i,e,s){let o=t.map(n=>typeof n=="string"?n:n.id),c=i.map(n=>typeof n=="string"?n:n.id),u=typeof e=="string"?e:e.id;return new (0, _chunkVX4LKECWcjs.a)(this.client,"/community/checkout",{prices:o.join(","),discounts:c.join(","),member:u,country:_nullishCoalesce(s, () => (void 0))})}async getCheckout(t,i,e,s,o=null){let c=t.map(r=>typeof r=="string"?r:r.id),u=i.map(r=>typeof r=="string"?r:r.id),n=typeof e=="string"?e:e.id;return await this.client.post("community","/store/checkout",{prices:c,discounts:u,member:n,email:s,country:_nullishCoalesce(o, () => (void 0))})}async claimCheckout(t){let i=await fetch(`${this.client.domain}/checkout/claim`,{headers:{authorization:`Bearer ${t}`},method:"POST"});if(i.status!=200&&i.status!=204)throw new Error(`Error claiming checkout: ${i.statusText}`)}billing(){return new (0, _chunkVX4LKECWcjs.a)(this.client,"/billing")}};exports.a = l;
2
+ //# sourceMappingURL=chunk-XM6Q3ZPG.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/quique/Documents/serverbench/js/dist/chunk-MZEH4ELC.cjs","../src/store/Store.ts"],"names":["Store","client","username","eid","StoreDisplay","count","prices","discounts","member","country","finalPrices","price","finalDiscounts","discount","finalMember","Element","email","token","req"],"mappings":"AAAA,qOAAwC,wDAAoC,ICOvDA,CAAAA,CAArB,KAA2B,CAIvB,WAAA,CAAYC,CAAAA,CAAqB,CAC7B,IAAA,CAAK,MAAA,CAASA,CAClB,CAEA,MAAM,GAAA,CAAIC,CAAAA,CAAmBC,CAAAA,CAAc,CACvC,OAAOC,mBAAAA,CAAa,UAAA,CAAW,IAAA,CAAK,MAAA,CAAQ,MAAM,IAAA,CAAK,MAAA,CAAO,IAAA,CAAK,WAAA,CAAa,aAAA,CAAe,CAC3F,QAAA,CAAAF,CAAAA,CACA,GAAA,CAAAC,CACJ,CAAC,CAAC,CACN,CAEA,MAAM,iBAAA,CAAA,CAAoB,CACtB,GAAM,CAAE,KAAA,CAAAE,CAAM,CAAA,CAAI,MAAM,IAAA,CAAK,MAAA,CAAO,GAAA,CAAI,WAAA,CAAa,qBAAqB,CAAA,CAC1E,OAAOA,CACX,CAEA,QAAA,CAASC,CAAAA,CAAgCC,CAAAA,CAAmCC,CAAAA,CAAyBC,CAAAA,CAAwB,CACzH,IAAMC,CAAAA,CAAcJ,CAAAA,CAAO,GAAA,CAAIK,CAAAA,EAAS,OAAOA,CAAAA,EAAU,QAAA,CAAWA,CAAAA,CAAQA,CAAAA,CAAM,EAAE,CAAA,CAC9EC,CAAAA,CAAiBL,CAAAA,CAAU,GAAA,CAAIM,CAAAA,EAAY,OAAOA,CAAAA,EAAa,QAAA,CAAWA,CAAAA,CAAWA,CAAAA,CAAS,EAAE,CAAA,CAChGC,CAAAA,CAAc,OAAON,CAAAA,EAAW,QAAA,CAAWA,CAAAA,CAASA,CAAAA,CAAO,EAAA,CACjE,OAAO,IAAIO,wBAAAA,CACP,IAAA,CAAK,MAAA,CACL,qBAAA,CACA,CACI,MAAA,CAAQL,CAAAA,CAAY,IAAA,CAAK,GAAG,CAAA,CAC5B,SAAA,CAAWE,CAAAA,CAAe,IAAA,CAAK,GAAG,CAAA,CAClC,MAAA,CAAQE,CAAAA,CACR,OAAA,kBAASL,CAAAA,SAAW,KAAA,GACxB,CACJ,CACJ,CAEA,MAAM,WAAA,CAAYH,CAAAA,CAAgCC,CAAAA,CAAmCC,CAAAA,CAAyBQ,CAAAA,CAAeP,CAAAA,CAAyB,IAAA,CAAM,CACxJ,IAAMC,CAAAA,CAAcJ,CAAAA,CAAO,GAAA,CAAIK,CAAAA,EAAS,OAAOA,CAAAA,EAAU,QAAA,CAAWA,CAAAA,CAAQA,CAAAA,CAAM,EAAE,CAAA,CAC9EC,CAAAA,CAAiBL,CAAAA,CAAU,GAAA,CAAIM,CAAAA,EAAY,OAAOA,CAAAA,EAAa,QAAA,CAAWA,CAAAA,CAAWA,CAAAA,CAAS,EAAE,CAAA,CAChGC,CAAAA,CAAc,OAAON,CAAAA,EAAW,QAAA,CAAWA,CAAAA,CAASA,CAAAA,CAAO,EAAA,CAQjE,OAPiB,MAAM,IAAA,CAAK,MAAA,CAAO,IAAA,CAAK,WAAA,CAAa,iBAAA,CAAmB,CACpE,MAAA,CAAQE,CAAAA,CACR,SAAA,CAAWE,CAAAA,CACX,MAAA,CAAQE,CAAAA,CACR,KAAA,CAAAE,CAAAA,CACA,OAAA,kBAASP,CAAAA,SAAW,KAAA,GACxB,CAAC,CAEL,CAEA,MAAM,aAAA,CAAcQ,CAAAA,CAAe,CAC/B,IAAMC,CAAAA,CAAM,MAAM,KAAA,CAAM,CAAA,EAAA","file":"/Users/quique/Documents/serverbench/js/dist/chunk-MZEH4ELC.cjs","sourcesContent":[null,"import Element from \"../element/Element.js\";\nimport Member from \"../Member.js\";\nimport type Serverbench from \"../Serverbench.js\";\nimport IDiscount from \"./IDiscount.js\";\nimport ISkuPrice from \"./ISkuPrice.js\";\nimport StoreDisplay from \"./StoreDisplay.js\";\n\nexport default class Store {\n\n private client: Serverbench\n\n constructor(client: Serverbench) {\n this.client = client\n }\n\n async get(username?: string, eid?: string) {\n return StoreDisplay.fromObject(this.client, await this.client.post('community', '/store/view', {\n username,\n eid\n }))\n }\n\n async subscriptionCount() {\n const { count } = await this.client.get('community', '/subscription/count')\n return count\n }\n\n checkout(prices: ISkuPrice[] | string[], discounts: IDiscount[] | string[], member: Member | string, country: string | null) {\n const finalPrices = prices.map(price => typeof price === 'string' ? price : price.id)\n const finalDiscounts = discounts.map(discount => typeof discount === 'string' ? discount : discount.id)\n const finalMember = typeof member === 'string' ? member : member.id\n return new Element(\n this.client,\n '/community/checkout',\n {\n prices: finalPrices.join(','),\n discounts: finalDiscounts.join(','),\n member: finalMember,\n country: country ?? undefined\n }\n )\n }\n\n async getCheckout(prices: ISkuPrice[] | string[], discounts: IDiscount[] | string[], member: Member | string, email: string, country: string | null = null) {\n const finalPrices = prices.map(price => typeof price === 'string' ? price : price.id)\n const finalDiscounts = discounts.map(discount => typeof discount === 'string' ? discount : discount.id)\n const finalMember = typeof member === 'string' ? member : member.id\n const checkout = await this.client.post('community', '/store/checkout', {\n prices: finalPrices,\n discounts: finalDiscounts,\n member: finalMember,\n email,\n country: country ?? undefined\n })\n return checkout\n }\n\n async claimCheckout(token: string) {\n const req = await fetch(`${this.client.domain}/checkout/claim`, {\n headers: {\n authorization: `Bearer ${token}`\n },\n method: 'POST'\n })\n if (req.status != 200 && req.status != 201) {\n throw new Error(`Error claiming checkout: ${req.statusText}`)\n }\n }\n\n billing() {\n return new Element(this.client, '/billing')\n }\n\n}"]}
1
+ {"version":3,"sources":["/Users/quique/Documents/serverbench/js/dist/chunk-XM6Q3ZPG.cjs","../src/store/Store.ts"],"names":["Store","client","username","eid","StoreDisplay","count","prices","discounts","member","country","finalPrices","price","finalDiscounts","discount","finalMember","Element","email","token","req"],"mappings":"AAAA,qOAAwC,wDAAoC,ICOvDA,CAAAA,CAArB,KAA2B,CAIvB,WAAA,CAAYC,CAAAA,CAAqB,CAC7B,IAAA,CAAK,MAAA,CAASA,CAClB,CAEA,MAAM,GAAA,CAAIC,CAAAA,CAAmBC,CAAAA,CAAc,CACvC,OAAOC,mBAAAA,CAAa,UAAA,CAAW,IAAA,CAAK,MAAA,CAAQ,MAAM,IAAA,CAAK,MAAA,CAAO,IAAA,CAAK,WAAA,CAAa,aAAA,CAAe,CAC3F,QAAA,CAAAF,CAAAA,CACA,GAAA,CAAAC,CACJ,CAAC,CAAC,CACN,CAEA,MAAM,iBAAA,CAAA,CAAoB,CACtB,GAAM,CAAE,KAAA,CAAAE,CAAM,CAAA,CAAI,MAAM,IAAA,CAAK,MAAA,CAAO,GAAA,CAAI,WAAA,CAAa,qBAAqB,CAAA,CAC1E,OAAOA,CACX,CAEA,QAAA,CAASC,CAAAA,CAAgCC,CAAAA,CAAmCC,CAAAA,CAAyBC,CAAAA,CAAwB,CACzH,IAAMC,CAAAA,CAAcJ,CAAAA,CAAO,GAAA,CAAIK,CAAAA,EAAS,OAAOA,CAAAA,EAAU,QAAA,CAAWA,CAAAA,CAAQA,CAAAA,CAAM,EAAE,CAAA,CAC9EC,CAAAA,CAAiBL,CAAAA,CAAU,GAAA,CAAIM,CAAAA,EAAY,OAAOA,CAAAA,EAAa,QAAA,CAAWA,CAAAA,CAAWA,CAAAA,CAAS,EAAE,CAAA,CAChGC,CAAAA,CAAc,OAAON,CAAAA,EAAW,QAAA,CAAWA,CAAAA,CAASA,CAAAA,CAAO,EAAA,CACjE,OAAO,IAAIO,wBAAAA,CACP,IAAA,CAAK,MAAA,CACL,qBAAA,CACA,CACI,MAAA,CAAQL,CAAAA,CAAY,IAAA,CAAK,GAAG,CAAA,CAC5B,SAAA,CAAWE,CAAAA,CAAe,IAAA,CAAK,GAAG,CAAA,CAClC,MAAA,CAAQE,CAAAA,CACR,OAAA,kBAASL,CAAAA,SAAW,KAAA,GACxB,CACJ,CACJ,CAEA,MAAM,WAAA,CAAYH,CAAAA,CAAgCC,CAAAA,CAAmCC,CAAAA,CAAyBQ,CAAAA,CAAeP,CAAAA,CAAyB,IAAA,CAAM,CACxJ,IAAMC,CAAAA,CAAcJ,CAAAA,CAAO,GAAA,CAAIK,CAAAA,EAAS,OAAOA,CAAAA,EAAU,QAAA,CAAWA,CAAAA,CAAQA,CAAAA,CAAM,EAAE,CAAA,CAC9EC,CAAAA,CAAiBL,CAAAA,CAAU,GAAA,CAAIM,CAAAA,EAAY,OAAOA,CAAAA,EAAa,QAAA,CAAWA,CAAAA,CAAWA,CAAAA,CAAS,EAAE,CAAA,CAChGC,CAAAA,CAAc,OAAON,CAAAA,EAAW,QAAA,CAAWA,CAAAA,CAASA,CAAAA,CAAO,EAAA,CAQjE,OAPiB,MAAM,IAAA,CAAK,MAAA,CAAO,IAAA,CAAK,WAAA,CAAa,iBAAA,CAAmB,CACpE,MAAA,CAAQE,CAAAA,CACR,SAAA,CAAWE,CAAAA,CACX,MAAA,CAAQE,CAAAA,CACR,KAAA,CAAAE,CAAAA,CACA,OAAA,kBAASP,CAAAA,SAAW,KAAA,GACxB,CAAC,CAEL,CAEA,MAAM,aAAA,CAAcQ,CAAAA,CAAe,CAC/B,IAAMC,CAAAA,CAAM,MAAM,KAAA,CAAM,CAAA,EAAA","file":"/Users/quique/Documents/serverbench/js/dist/chunk-XM6Q3ZPG.cjs","sourcesContent":[null,"import Element from \"../element/Element.js\";\nimport Member from \"../Member.js\";\nimport type Serverbench from \"../Serverbench.js\";\nimport IDiscount from \"./IDiscount.js\";\nimport ISkuPrice from \"./ISkuPrice.js\";\nimport StoreDisplay from \"./StoreDisplay.js\";\n\nexport default class Store {\n\n private client: Serverbench\n\n constructor(client: Serverbench) {\n this.client = client\n }\n\n async get(username?: string, eid?: string) {\n return StoreDisplay.fromObject(this.client, await this.client.post('community', '/store/view', {\n username,\n eid\n }))\n }\n\n async subscriptionCount() {\n const { count } = await this.client.get('community', '/subscription/count')\n return count\n }\n\n checkout(prices: ISkuPrice[] | string[], discounts: IDiscount[] | string[], member: Member | string, country: string | null) {\n const finalPrices = prices.map(price => typeof price === 'string' ? price : price.id)\n const finalDiscounts = discounts.map(discount => typeof discount === 'string' ? discount : discount.id)\n const finalMember = typeof member === 'string' ? member : member.id\n return new Element(\n this.client,\n '/community/checkout',\n {\n prices: finalPrices.join(','),\n discounts: finalDiscounts.join(','),\n member: finalMember,\n country: country ?? undefined\n }\n )\n }\n\n async getCheckout(prices: ISkuPrice[] | string[], discounts: IDiscount[] | string[], member: Member | string, email: string, country: string | null = null) {\n const finalPrices = prices.map(price => typeof price === 'string' ? price : price.id)\n const finalDiscounts = discounts.map(discount => typeof discount === 'string' ? discount : discount.id)\n const finalMember = typeof member === 'string' ? member : member.id\n const checkout = await this.client.post('community', '/store/checkout', {\n prices: finalPrices,\n discounts: finalDiscounts,\n member: finalMember,\n email,\n country: country ?? undefined\n })\n return checkout\n }\n\n async claimCheckout(token: string) {\n const req = await fetch(`${this.client.domain}/checkout/claim`, {\n headers: {\n authorization: `Bearer ${token}`\n },\n method: 'POST'\n })\n if (req.status != 200 && req.status != 204) {\n throw new Error(`Error claiming checkout: ${req.statusText}`)\n }\n }\n\n billing() {\n return new Element(this.client, '/billing')\n }\n\n}"]}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-CJWXGEQN.cjs');require('./chunk-A63AYQ4G.cjs');require('./chunk-OW4YZ724.cjs');require('./chunk-X4NW2R7G.cjs');require('./chunk-DSKIK7XF.cjs');var _chunk7KV4THCIcjs = require('./chunk-7KV4THCI.cjs');require('./chunk-SYLAVD2D.cjs');var _chunk32TKBZKIcjs = require('./chunk-32TKBZKI.cjs');require('./chunk-3YNQTTHI.cjs');var _chunkLUTKTZJQcjs = require('./chunk-LUTKTZJQ.cjs');var _chunkT4XJ6ERTcjs = require('./chunk-T4XJ6ERT.cjs');var _chunk5EFJ4GIYcjs = require('./chunk-5EFJ4GIY.cjs');require('./chunk-MZEH4ELC.cjs');var _chunkUZVZQL4Fcjs = require('./chunk-UZVZQL4F.cjs');var _chunkFXVJCHR6cjs = require('./chunk-FXVJCHR6.cjs');var _chunkVX4LKECWcjs = require('./chunk-VX4LKECW.cjs');require('./chunk-GOVZHEHO.cjs');require('./chunk-D22KLLON.cjs');require('./chunk-UHS7Z46V.cjs');require('./chunk-OVXIHLHV.cjs');var x=_chunk32TKBZKIcjs.a;exports.Element = _chunkVX4LKECWcjs.a; exports.IStore = _chunkUZVZQL4Fcjs.a; exports.ListingDisplay = _chunkLUTKTZJQcjs.a; exports.ListingSiteDisplay = _chunkT4XJ6ERTcjs.a; exports.Member = _chunkFXVJCHR6cjs.a; exports.Store = _chunkUZVZQL4Fcjs.a; exports.UpsellType = _chunk7KV4THCIcjs.a; exports.Vote = _chunk5EFJ4GIYcjs.a; exports.default = x;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-OW4YZ724.cjs');require('./chunk-X4NW2R7G.cjs');require('./chunk-DSKIK7XF.cjs');var _chunk7KV4THCIcjs = require('./chunk-7KV4THCI.cjs');require('./chunk-GOVZHEHO.cjs');require('./chunk-D22KLLON.cjs');require('./chunk-UHS7Z46V.cjs');require('./chunk-OVXIHLHV.cjs');var _chunkNEBSBX3Fcjs = require('./chunk-NEBSBX3F.cjs');require('./chunk-XM6Q3ZPG.cjs');var _chunkUZVZQL4Fcjs = require('./chunk-UZVZQL4F.cjs');require('./chunk-3YNQTTHI.cjs');var _chunkLUTKTZJQcjs = require('./chunk-LUTKTZJQ.cjs');var _chunkT4XJ6ERTcjs = require('./chunk-T4XJ6ERT.cjs');var _chunk5EFJ4GIYcjs = require('./chunk-5EFJ4GIY.cjs');var _chunkFXVJCHR6cjs = require('./chunk-FXVJCHR6.cjs');var _chunkVX4LKECWcjs = require('./chunk-VX4LKECW.cjs');require('./chunk-SYLAVD2D.cjs');require('./chunk-CJWXGEQN.cjs');require('./chunk-A63AYQ4G.cjs');var x=_chunkNEBSBX3Fcjs.a;exports.Element = _chunkVX4LKECWcjs.a; exports.IStore = _chunkUZVZQL4Fcjs.a; exports.ListingDisplay = _chunkLUTKTZJQcjs.a; exports.ListingSiteDisplay = _chunkT4XJ6ERTcjs.a; exports.Member = _chunkFXVJCHR6cjs.a; exports.Store = _chunkUZVZQL4Fcjs.a; exports.UpsellType = _chunk7KV4THCIcjs.a; exports.Vote = _chunk5EFJ4GIYcjs.a; exports.default = x;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/quique/Documents/serverbench/js/dist/index.cjs","../src/index.ts"],"names":["src_default","Serverbench"],"mappings":"AAAA,yGAA4B,gCAA6B,gCAA6B,gCAA6B,gCAA6B,wDAAyC,gCAA6B,wDAAyC,gCAA6B,wDAAyC,wDAAyC,wDAAyC,gCAA6B,wDAAyC,wDAAyC,wDAAyC,gCAA6B,gCAA6B,gCAA6B,gCAA6B,ICmD5pBA,CAAAA,CAAQC,mBAAAA,CAAAA,0VAAAA","file":"/Users/quique/Documents/serverbench/js/dist/index.cjs","sourcesContent":[null,"import Member from \"./Member.js\";\nimport Serverbench from \"./Serverbench.js\";\nimport ICountryCurrency from \"./store/ICountryCurrency.js\";\nimport ISku from \"./store/ISku.js\";\nimport ISkuPerkUsage from \"./store/ISkuPerkUsage.js\";\nimport ISkuPrice from \"./store/ISkuPrice.js\";\nimport StoreDisplay from \"./store/StoreDisplay.js\";\nimport IStoreCategory from \"./store/IStoreCategory.js\";\nimport IStoreCategorySet from \"./store/IStoreCategorySet.js\";\nimport Store from \"./store/Store.js\";\nimport Element from \"./element/Element.js\"\nimport IDiscount from \"./store/IDiscount.js\";\nimport IListingAmountSettings from \"./voting/IListingAmountSettings.js\";\nimport ISite from \"./voting/ISite.js\";\nimport ISiteSetup from \"./voting/ISiteSetup.js\";\nimport Vote from \"./voting/Vote.js\";\nimport ListingDisplay from \"./voting/ListingDisplay.js\";\nimport ListingSiteDisplay from \"./voting/ListingSiteDisplay.js\";\nimport IUpsell, { UpsellType } from \"./store/IUpsell.js\";\n\nexport {\n StoreDisplay as Store,\n ICountryCurrency,\n IDiscount,\n ISku,\n ISkuPerkUsage,\n ISkuPrice,\n StoreDisplay as IStore,\n IStoreCategory,\n IStoreCategorySet,\n UpsellType,\n IUpsell\n}\n\nexport {\n ListingDisplay,\n ListingSiteDisplay,\n IListingAmountSettings,\n ISite,\n ISiteSetup,\n Vote\n}\n\nexport {\n Member\n}\n\nexport {\n Element\n}\n\nexport default Serverbench"]}
1
+ {"version":3,"sources":["/Users/quique/Documents/serverbench/js/dist/index.cjs","../src/index.ts"],"names":["src_default","Serverbench"],"mappings":"AAAA,yGAA4B,gCAA6B,gCAA6B,wDAAyC,gCAA6B,gCAA6B,gCAA6B,gCAA6B,wDAAyC,gCAA6B,wDAAyC,gCAA6B,wDAAyC,wDAAyC,wDAAyC,wDAAyC,wDAAyC,gCAA6B,gCAA6B,gCAA6B,ICmD5pBA,CAAAA,CAAQC,mBAAAA,CAAAA,0VAAAA","file":"/Users/quique/Documents/serverbench/js/dist/index.cjs","sourcesContent":[null,"import Member from \"./Member.js\";\nimport Serverbench from \"./Serverbench.js\";\nimport ICountryCurrency from \"./store/ICountryCurrency.js\";\nimport ISku from \"./store/ISku.js\";\nimport ISkuPerkUsage from \"./store/ISkuPerkUsage.js\";\nimport ISkuPrice from \"./store/ISkuPrice.js\";\nimport StoreDisplay from \"./store/StoreDisplay.js\";\nimport IStoreCategory from \"./store/IStoreCategory.js\";\nimport IStoreCategorySet from \"./store/IStoreCategorySet.js\";\nimport Store from \"./store/Store.js\";\nimport Element from \"./element/Element.js\"\nimport IDiscount from \"./store/IDiscount.js\";\nimport IListingAmountSettings from \"./voting/IListingAmountSettings.js\";\nimport ISite from \"./voting/ISite.js\";\nimport ISiteSetup from \"./voting/ISiteSetup.js\";\nimport Vote from \"./voting/Vote.js\";\nimport ListingDisplay from \"./voting/ListingDisplay.js\";\nimport ListingSiteDisplay from \"./voting/ListingSiteDisplay.js\";\nimport IUpsell, { UpsellType } from \"./store/IUpsell.js\";\n\nexport {\n StoreDisplay as Store,\n ICountryCurrency,\n IDiscount,\n ISku,\n ISkuPerkUsage,\n ISkuPrice,\n StoreDisplay as IStore,\n IStoreCategory,\n IStoreCategorySet,\n UpsellType,\n IUpsell\n}\n\nexport {\n ListingDisplay,\n ListingSiteDisplay,\n IListingAmountSettings,\n ISite,\n ISiteSetup,\n Vote\n}\n\nexport {\n Member\n}\n\nexport {\n Element\n}\n\nexport default Serverbench"]}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import"./chunk-EMFCL4IX.js";import"./chunk-33DIW7ZK.js";import"./chunk-FI7FAFLX.js";import"./chunk-LBVHKFZO.js";import"./chunk-7KUMKL43.js";import{a as f}from"./chunk-2HAOVSUI.js";import"./chunk-5YLG7KH6.js";import{a as r}from"./chunk-RNRSNTR3.js";import"./chunk-CTMUE5H3.js";import{a as p}from"./chunk-4GCQV2YR.js";import{a as i}from"./chunk-G27KF7G3.js";import{a as e}from"./chunk-4PA7GD6K.js";import"./chunk-73RD3OU4.js";import{a as m}from"./chunk-UTQPTYIQ.js";import{a as o}from"./chunk-GLEWOHG7.js";import{a as t}from"./chunk-4NMPBSP3.js";import"./chunk-RY7QEHM4.js";import"./chunk-ZYLLOUW6.js";import"./chunk-AS4B37XA.js";import"./chunk-56HSL4MD.js";var x=r;export{t as Element,m as IStore,p as ListingDisplay,i as ListingSiteDisplay,o as Member,m as Store,f as UpsellType,e as Vote,x as default};
1
+ import"./chunk-FI7FAFLX.js";import"./chunk-LBVHKFZO.js";import"./chunk-7KUMKL43.js";import{a as f}from"./chunk-2HAOVSUI.js";import"./chunk-RY7QEHM4.js";import"./chunk-ZYLLOUW6.js";import"./chunk-AS4B37XA.js";import"./chunk-56HSL4MD.js";import{a as r}from"./chunk-AB2ET2EM.js";import"./chunk-PYY2YREC.js";import{a as m}from"./chunk-UTQPTYIQ.js";import"./chunk-CTMUE5H3.js";import{a as p}from"./chunk-4GCQV2YR.js";import{a as i}from"./chunk-G27KF7G3.js";import{a as e}from"./chunk-4PA7GD6K.js";import{a as o}from"./chunk-GLEWOHG7.js";import{a as t}from"./chunk-4NMPBSP3.js";import"./chunk-5YLG7KH6.js";import"./chunk-EMFCL4IX.js";import"./chunk-33DIW7ZK.js";var x=r;export{t as Element,m as IStore,p as ListingDisplay,i as ListingSiteDisplay,o as Member,m as Store,f as UpsellType,e as Vote,x as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -12,6 +12,7 @@ interface ISku {
12
12
  prices: ISkuPrice[];
13
13
  available: boolean;
14
14
  discounts: IDiscount[];
15
+ enabled: boolean;
15
16
  }
16
17
 
17
18
  export type { ISku as default };
@@ -12,6 +12,7 @@ interface ISku {
12
12
  prices: ISkuPrice[];
13
13
  available: boolean;
14
14
  discounts: IDiscount[];
15
+ enabled: boolean;
15
16
  }
16
17
 
17
18
  export type { ISku as default };
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkMZEH4ELCcjs = require('../chunk-MZEH4ELC.cjs');require('../chunk-UZVZQL4F.cjs');require('../chunk-FXVJCHR6.cjs');require('../chunk-VX4LKECW.cjs');exports.default = _chunkMZEH4ELCcjs.a;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXM6Q3ZPGcjs = require('../chunk-XM6Q3ZPG.cjs');require('../chunk-UZVZQL4F.cjs');require('../chunk-FXVJCHR6.cjs');require('../chunk-VX4LKECW.cjs');exports.default = _chunkXM6Q3ZPGcjs.a;
2
2
  //# sourceMappingURL=Store.cjs.map
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-73RD3OU4.js";import"../chunk-UTQPTYIQ.js";import"../chunk-GLEWOHG7.js";import"../chunk-4NMPBSP3.js";export{a as default};
1
+ import{a}from"../chunk-PYY2YREC.js";import"../chunk-UTQPTYIQ.js";import"../chunk-GLEWOHG7.js";import"../chunk-4NMPBSP3.js";export{a as default};
2
2
  //# sourceMappingURL=Store.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serverbench/js",
3
- "version": "1.5.10",
3
+ "version": "1.5.12",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": {