@bumidb/admin 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=function(e){return e.Json=`application/json`,e.JsonApi=`application/vnd.api+json`,e.FormData=`multipart/form-data`,e.UrlEncoded=`application/x-www-form-urlencoded`,e.Text=`text/plain`,e}({});var t=class{baseUrl=``;securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:`same-origin`,headers:{},redirect:`follow`,referrerPolicy:`no-referrer`};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t==`number`?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(e=>this.encodeQueryParam(t,e)).join(`&`)}toQueryString(e){let t=e||{};return Object.keys(t).filter(e=>t[e]!==void 0).map(e=>Array.isArray(t[e])?this.addArrayQueryParam(t,e):this.addQueryParam(t,e)).join(`&`)}addQueryParams(e){let t=this.toQueryString(e);return t?`?${t}`:``}contentFormatters={"application/json":e=>e!==null&&(typeof e==`object`||typeof e==`string`)?JSON.stringify(e):e,"application/vnd.api+json":e=>e!==null&&(typeof e==`object`||typeof e==`string`)?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!=`string`?JSON.stringify(e):e,"multipart/form-data":e=>e instanceof FormData?e:Object.keys(e||{}).reduce((t,n)=>{let r=e[n];return t.append(n,r instanceof Blob?r:typeof r==`object`&&r?JSON.stringify(r):`${r}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){let t=this.abortControllers.get(e);return t?t.signal:void 0}let t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{let t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};request=async({body:e,secure:t,path:n,type:r,query:i,format:a,baseUrl:o,cancelToken:s,...c})=>{let l=(typeof t==`boolean`?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},u=this.mergeRequestParams(c,l),d=i&&this.toQueryString(i),f=this.contentFormatters[r||`application/json`],p=a||u.format;return this.customFetch(`${o||this.baseUrl||``}${n}${d?`?${d}`:``}`,{...u,headers:{...u.headers||{},...r&&r!==`multipart/form-data`?{"Content-Type":r}:{}},signal:(s?this.createAbortSignal(s):u.signal)||null,body:e==null?null:f(e)}).then(async e=>{let t=e;t.data=null,t.error=null;let n=p?e.clone():e,r=p?await n[p]().then(e=>(t.ok?t.data=e:t.error=e,t)).catch(e=>(t.error=e,t)):t;if(s&&this.abortControllers.delete(s),!e.ok)throw r;return r})}},n=class{http;constructor(e){this.http=e}createTenant=(e,t={})=>this.http.request({path:`/api/management/createTenant`,method:`POST`,body:e,type:`application/json`,format:`json`,...t});listTenants=(e={})=>this.http.request({path:`/api/management/listTenants`,method:`POST`,format:`json`,...e});getTenant=(e,t={})=>this.http.request({path:`/api/management/getTenant`,method:`POST`,body:e,type:`application/json`,format:`json`,...t});deleteTenant=(e,t={})=>this.http.request({path:`/api/management/deleteTenant`,method:`POST`,body:e,type:`application/json`,format:`json`,...t});createSession=(e,t={})=>this.http.request({path:`/api/management/createSession`,method:`POST`,body:e,type:`application/json`,format:`json`,...t});tenantUsage=(e,t={})=>this.http.request({path:`/api/management/tenantUsage`,method:`POST`,body:e,type:`application/json`,format:`json`,...t})},r=class extends n{constructor(e){if(!e.apiKey)throw Error(`BumiAdmin requires an apiKey`);let n=new t({baseUrl:e.baseUrl,baseApiParams:{headers:{Authorization:`Bearer ${e.apiKey}`}}});super(n)}};exports.BumiAdmin=r,exports.BumiManagementApi=n,exports.ContentType=e,exports.HttpClient=t;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=function(e){return e.Json=`application/json`,e.JsonApi=`application/vnd.api+json`,e.FormData=`multipart/form-data`,e.UrlEncoded=`application/x-www-form-urlencoded`,e.Text=`text/plain`,e}({});var t=class{baseUrl=``;securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:`same-origin`,headers:{},redirect:`follow`,referrerPolicy:`no-referrer`};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t==`number`?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(e=>this.encodeQueryParam(t,e)).join(`&`)}toQueryString(e){let t=e||{};return Object.keys(t).filter(e=>t[e]!==void 0).map(e=>Array.isArray(t[e])?this.addArrayQueryParam(t,e):this.addQueryParam(t,e)).join(`&`)}addQueryParams(e){let t=this.toQueryString(e);return t?`?${t}`:``}contentFormatters={"application/json":e=>e!==null&&(typeof e==`object`||typeof e==`string`)?JSON.stringify(e):e,"application/vnd.api+json":e=>e!==null&&(typeof e==`object`||typeof e==`string`)?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!=`string`?JSON.stringify(e):e,"multipart/form-data":e=>e instanceof FormData?e:Object.keys(e||{}).reduce((t,n)=>{let r=e[n];return t.append(n,r instanceof Blob?r:typeof r==`object`&&r?JSON.stringify(r):`${r}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){let t=this.abortControllers.get(e);return t?t.signal:void 0}let t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{let t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};request=async({body:e,secure:t,path:n,type:r,query:i,format:a,baseUrl:o,cancelToken:s,...c})=>{let l=(typeof t==`boolean`?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},u=this.mergeRequestParams(c,l),d=i&&this.toQueryString(i),f=this.contentFormatters[r||`application/json`],p=a||u.format;return this.customFetch(`${o||this.baseUrl||``}${n}${d?`?${d}`:``}`,{...u,headers:{...u.headers||{},...r&&r!==`multipart/form-data`?{"Content-Type":r}:{}},signal:(s?this.createAbortSignal(s):u.signal)||null,body:e==null?null:f(e)}).then(async e=>{let t=e;t.data=null,t.error=null;let n=p?e.clone():e,r=p?await n[p]().then(e=>(t.ok?t.data=e:t.error=e,t)).catch(e=>(t.error=e,t)):t;if(s&&this.abortControllers.delete(s),!e.ok)throw r;return r})}},n=class{http;constructor(e){this.http=e}createTenant=(e,t={})=>this.http.request({path:`/api/management/createTenant`,method:`POST`,body:e,type:`application/json`,format:`json`,...t});listTenants=(e={})=>this.http.request({path:`/api/management/listTenants`,method:`POST`,format:`json`,...e});getTenant=(e,t={})=>this.http.request({path:`/api/management/getTenant`,method:`POST`,body:e,type:`application/json`,format:`json`,...t});deleteTenant=(e,t={})=>this.http.request({path:`/api/management/deleteTenant`,method:`POST`,body:e,type:`application/json`,format:`json`,...t});createSession=(e,t={})=>this.http.request({path:`/api/management/createSession`,method:`POST`,body:e,type:`application/json`,format:`json`,...t});tenantUsage=(e,t={})=>this.http.request({path:`/api/management/tenantUsage`,method:`POST`,body:e,type:`application/json`,format:`json`,...t})},r=class extends n{constructor(e){if(!e.apiKey)throw Error(`BumiAdmin requires an apiKey`);let n=new t({baseUrl:e.baseUrl??`https://api.bumi.so`,baseApiParams:{headers:{Authorization:`Bearer ${e.apiKey}`}}});super(n)}};exports.BumiAdmin=r,exports.BumiManagementApi=n,exports.ContentType=e,exports.HttpClient=t;
package/dist/index.d.cts CHANGED
@@ -355,7 +355,7 @@ declare class BumiManagementApi<SecurityDataType extends unknown> {
355
355
  //#endregion
356
356
  //#region src/index.d.ts
357
357
  interface BumiAdminConfig {
358
- baseUrl: string;
358
+ baseUrl?: string;
359
359
  apiKey: string;
360
360
  }
361
361
  declare class BumiAdmin extends BumiManagementApi<void> {
package/dist/index.d.mts CHANGED
@@ -355,7 +355,7 @@ declare class BumiManagementApi<SecurityDataType extends unknown> {
355
355
  //#endregion
356
356
  //#region src/index.d.ts
357
357
  interface BumiAdminConfig {
358
- baseUrl: string;
358
+ baseUrl?: string;
359
359
  apiKey: string;
360
360
  }
361
361
  declare class BumiAdmin extends BumiManagementApi<void> {
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- let e=function(e){return e.Json=`application/json`,e.JsonApi=`application/vnd.api+json`,e.FormData=`multipart/form-data`,e.UrlEncoded=`application/x-www-form-urlencoded`,e.Text=`text/plain`,e}({});var t=class{baseUrl=``;securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:`same-origin`,headers:{},redirect:`follow`,referrerPolicy:`no-referrer`};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t==`number`?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(e=>this.encodeQueryParam(t,e)).join(`&`)}toQueryString(e){let t=e||{};return Object.keys(t).filter(e=>t[e]!==void 0).map(e=>Array.isArray(t[e])?this.addArrayQueryParam(t,e):this.addQueryParam(t,e)).join(`&`)}addQueryParams(e){let t=this.toQueryString(e);return t?`?${t}`:``}contentFormatters={"application/json":e=>e!==null&&(typeof e==`object`||typeof e==`string`)?JSON.stringify(e):e,"application/vnd.api+json":e=>e!==null&&(typeof e==`object`||typeof e==`string`)?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!=`string`?JSON.stringify(e):e,"multipart/form-data":e=>e instanceof FormData?e:Object.keys(e||{}).reduce((t,n)=>{let r=e[n];return t.append(n,r instanceof Blob?r:typeof r==`object`&&r?JSON.stringify(r):`${r}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){let t=this.abortControllers.get(e);return t?t.signal:void 0}let t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{let t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};request=async({body:e,secure:t,path:n,type:r,query:i,format:a,baseUrl:o,cancelToken:s,...c})=>{let l=(typeof t==`boolean`?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},u=this.mergeRequestParams(c,l),d=i&&this.toQueryString(i),f=this.contentFormatters[r||`application/json`],p=a||u.format;return this.customFetch(`${o||this.baseUrl||``}${n}${d?`?${d}`:``}`,{...u,headers:{...u.headers||{},...r&&r!==`multipart/form-data`?{"Content-Type":r}:{}},signal:(s?this.createAbortSignal(s):u.signal)||null,body:e==null?null:f(e)}).then(async e=>{let t=e;t.data=null,t.error=null;let n=p?e.clone():e,r=p?await n[p]().then(e=>(t.ok?t.data=e:t.error=e,t)).catch(e=>(t.error=e,t)):t;if(s&&this.abortControllers.delete(s),!e.ok)throw r;return r})}},n=class{http;constructor(e){this.http=e}createTenant=(e,t={})=>this.http.request({path:`/api/management/createTenant`,method:`POST`,body:e,type:`application/json`,format:`json`,...t});listTenants=(e={})=>this.http.request({path:`/api/management/listTenants`,method:`POST`,format:`json`,...e});getTenant=(e,t={})=>this.http.request({path:`/api/management/getTenant`,method:`POST`,body:e,type:`application/json`,format:`json`,...t});deleteTenant=(e,t={})=>this.http.request({path:`/api/management/deleteTenant`,method:`POST`,body:e,type:`application/json`,format:`json`,...t});createSession=(e,t={})=>this.http.request({path:`/api/management/createSession`,method:`POST`,body:e,type:`application/json`,format:`json`,...t});tenantUsage=(e,t={})=>this.http.request({path:`/api/management/tenantUsage`,method:`POST`,body:e,type:`application/json`,format:`json`,...t})},r=class extends n{constructor(e){if(!e.apiKey)throw Error(`BumiAdmin requires an apiKey`);let n=new t({baseUrl:e.baseUrl,baseApiParams:{headers:{Authorization:`Bearer ${e.apiKey}`}}});super(n)}};export{r as BumiAdmin,n as BumiManagementApi,e as ContentType,t as HttpClient};
1
+ let e=function(e){return e.Json=`application/json`,e.JsonApi=`application/vnd.api+json`,e.FormData=`multipart/form-data`,e.UrlEncoded=`application/x-www-form-urlencoded`,e.Text=`text/plain`,e}({});var t=class{baseUrl=``;securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:`same-origin`,headers:{},redirect:`follow`,referrerPolicy:`no-referrer`};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t==`number`?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(e=>this.encodeQueryParam(t,e)).join(`&`)}toQueryString(e){let t=e||{};return Object.keys(t).filter(e=>t[e]!==void 0).map(e=>Array.isArray(t[e])?this.addArrayQueryParam(t,e):this.addQueryParam(t,e)).join(`&`)}addQueryParams(e){let t=this.toQueryString(e);return t?`?${t}`:``}contentFormatters={"application/json":e=>e!==null&&(typeof e==`object`||typeof e==`string`)?JSON.stringify(e):e,"application/vnd.api+json":e=>e!==null&&(typeof e==`object`||typeof e==`string`)?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!=`string`?JSON.stringify(e):e,"multipart/form-data":e=>e instanceof FormData?e:Object.keys(e||{}).reduce((t,n)=>{let r=e[n];return t.append(n,r instanceof Blob?r:typeof r==`object`&&r?JSON.stringify(r):`${r}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){let t=this.abortControllers.get(e);return t?t.signal:void 0}let t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{let t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};request=async({body:e,secure:t,path:n,type:r,query:i,format:a,baseUrl:o,cancelToken:s,...c})=>{let l=(typeof t==`boolean`?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},u=this.mergeRequestParams(c,l),d=i&&this.toQueryString(i),f=this.contentFormatters[r||`application/json`],p=a||u.format;return this.customFetch(`${o||this.baseUrl||``}${n}${d?`?${d}`:``}`,{...u,headers:{...u.headers||{},...r&&r!==`multipart/form-data`?{"Content-Type":r}:{}},signal:(s?this.createAbortSignal(s):u.signal)||null,body:e==null?null:f(e)}).then(async e=>{let t=e;t.data=null,t.error=null;let n=p?e.clone():e,r=p?await n[p]().then(e=>(t.ok?t.data=e:t.error=e,t)).catch(e=>(t.error=e,t)):t;if(s&&this.abortControllers.delete(s),!e.ok)throw r;return r})}},n=class{http;constructor(e){this.http=e}createTenant=(e,t={})=>this.http.request({path:`/api/management/createTenant`,method:`POST`,body:e,type:`application/json`,format:`json`,...t});listTenants=(e={})=>this.http.request({path:`/api/management/listTenants`,method:`POST`,format:`json`,...e});getTenant=(e,t={})=>this.http.request({path:`/api/management/getTenant`,method:`POST`,body:e,type:`application/json`,format:`json`,...t});deleteTenant=(e,t={})=>this.http.request({path:`/api/management/deleteTenant`,method:`POST`,body:e,type:`application/json`,format:`json`,...t});createSession=(e,t={})=>this.http.request({path:`/api/management/createSession`,method:`POST`,body:e,type:`application/json`,format:`json`,...t});tenantUsage=(e,t={})=>this.http.request({path:`/api/management/tenantUsage`,method:`POST`,body:e,type:`application/json`,format:`json`,...t})},r=class extends n{constructor(e){if(!e.apiKey)throw Error(`BumiAdmin requires an apiKey`);let n=new t({baseUrl:e.baseUrl??`https://api.bumi.so`,baseApiParams:{headers:{Authorization:`Bearer ${e.apiKey}`}}});super(n)}};export{r as BumiAdmin,n as BumiManagementApi,e as ContentType,t as HttpClient};
2
2
  //# sourceMappingURL=index.mjs.map
package/package.json CHANGED
@@ -1,28 +1,32 @@
1
1
  {
2
2
  "name": "@bumidb/admin",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Server-side admin SDK for bumi — manage tenants, sessions, and projects via the Bumi Management API.",
5
5
  "keywords": [
6
+ "admin",
6
7
  "bumi",
7
8
  "bumidb",
8
- "admin",
9
- "sdk",
10
9
  "database",
11
- "management"
10
+ "management",
11
+ "sdk"
12
12
  ],
13
13
  "homepage": "https://bumi.so",
14
+ "bugs": {
15
+ "url": "https://github.com/mirinhq/bumi/issues"
16
+ },
17
+ "license": "UNLICENSED",
18
+ "author": "Mirin Pte Ltd",
14
19
  "repository": {
15
20
  "type": "git",
16
21
  "url": "git+https://github.com/mirinhq/bumi.git",
17
22
  "directory": "bumidb/admin"
18
23
  },
19
- "bugs": {
20
- "url": "https://github.com/mirinhq/bumi/issues"
21
- },
22
- "author": "Mirin Pte Ltd",
23
- "license": "UNLICENSED",
24
+ "files": [
25
+ "dist"
26
+ ],
24
27
  "type": "module",
25
28
  "main": "./dist/index.cjs",
29
+ "module": "./dist/index.mjs",
26
30
  "types": "./dist/index.d.cts",
27
31
  "exports": {
28
32
  ".": {
@@ -36,12 +40,6 @@
36
40
  }
37
41
  }
38
42
  },
39
- "files": [
40
- "dist"
41
- ],
42
- "publishConfig": {
43
- "access": "public"
44
- },
45
43
  "dependencies": {
46
44
  "axios": "^1.13.4"
47
45
  },
@@ -56,6 +54,5 @@
56
54
  "generate:openapi": "pnpm --filter @bumidb/backend generate:openapi -- ../packages/sdk-management/openapi.json --only-prefix=/api/management/",
57
55
  "generate": "swagger-typescript-api generate --path ./openapi.json --output ./src/generated --name index.ts --http-client axios --api-class-name BumiManagementApi --single-http-client --extract-request-params --extract-request-body --extract-response-body --responses --route-types --clean-output --templates ./swagger-templates --module-name-index=1",
58
56
  "regen": "pnpm run generate:openapi && pnpm run generate"
59
- },
60
- "module": "./dist/index.mjs"
57
+ }
61
58
  }