Comparing version 0.0.3 to 0.8.20-alpha.6
@@ -1,4 +0,8 @@ | ||
import axios from 'axios'; | ||
import type { OutgoingWebhookCreateDTO } from '@bika/types/events/dto'; | ||
import { SpaceAO } from './space-ao'; | ||
import type { IHttpClient } from './types'; | ||
interface IBaseOptions { | ||
baseURL: string | undefined; | ||
baseURL?: string; | ||
onErrorHandler?: (error: Error) => void; | ||
customHttpClient?: IHttpClient; | ||
} | ||
@@ -13,15 +17,52 @@ interface ITokenOptions extends IBaseOptions { | ||
export declare class Bika { | ||
private _options; | ||
private _httpClient; | ||
private readonly _options; | ||
private readonly _httpClient; | ||
constructor(options: IOptions); | ||
space: { | ||
list: () => Promise<axios.AxiosResponse<any, any>>; | ||
list: () => Promise<SpaceAO[]>; | ||
get: (spaceId: string) => Promise<SpaceAO>; | ||
}; | ||
siteAdmin: { | ||
appEnv: () => Promise<void>; | ||
appEnv: () => Promise<string>; | ||
outgoingWebhooks: { | ||
list: () => Promise<(({ | ||
name: string; | ||
databaseId: string; | ||
callbackURL: string; | ||
eventType: "ON_RECORD_CREATED"; | ||
description?: string | undefined; | ||
} | { | ||
name: string; | ||
callbackURL: string; | ||
eventType: "ON_NODE_CREATED"; | ||
description?: string | undefined; | ||
}) & { | ||
id: string; | ||
})[]>; | ||
register: (oWebhook: OutgoingWebhookCreateDTO) => Promise<({ | ||
name: string; | ||
databaseId: string; | ||
callbackURL: string; | ||
eventType: "ON_RECORD_CREATED"; | ||
description?: string | undefined; | ||
} | { | ||
name: string; | ||
callbackURL: string; | ||
eventType: "ON_NODE_CREATED"; | ||
description?: string | undefined; | ||
}) & { | ||
id: string; | ||
}>; | ||
delete: () => Promise<boolean>; | ||
}; | ||
}; | ||
system: { | ||
meta: () => Promise<void>; | ||
meta: () => Promise<{ | ||
version: string; | ||
hostname: string; | ||
headers: Record<string, string>; | ||
isFromCN?: boolean | undefined; | ||
}>; | ||
}; | ||
} | ||
export {}; |
export * from './bika'; | ||
export * from './types'; |
@@ -1,54 +0,1 @@ | ||
"use strict"; | ||
(() => { | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { | ||
get: (a, b) => (typeof require !== "undefined" ? require : a)[b] | ||
}) : x)(function(x) { | ||
if (typeof require !== "undefined") return require.apply(this, arguments); | ||
throw Error('Dynamic require of "' + x + '" is not supported'); | ||
}); | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
// src/bika.ts | ||
var import_axios = __toESM(__require("axios")); | ||
var Bika = class { | ||
_options; | ||
_httpClient; | ||
constructor(options) { | ||
this._options = options; | ||
this._httpClient = import_axios.default.create({ | ||
baseURL: options.baseURL || "https://bika.ai/api/openapi" | ||
}); | ||
} | ||
space = { | ||
list: async () => ( | ||
// | ||
this._httpClient.get("/space/list") | ||
) | ||
}; | ||
system = { | ||
meta: async () => { | ||
} | ||
}; | ||
}; | ||
})(); | ||
import u from"axios";var r=class{_axios;_token;constructor(t,e){this._axios=u.create({baseURL:t}),this._token=e}async post(t,e){return(await this._axios.post(t,e,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${this._token}`}})).data}async patch(t,e){return(await this._axios.patch(t,e,{headers:{"Content-Type":"application/json",Authorization:`Bearer ${this._token}`}})).data}async delete(t){return(await this._axios.delete(t)).data}async get(t){return(await this._axios.get(t)).data}};var n=class{_vo;_httpClient;constructor(t,e){this._httpClient=e,this._vo=t}get vo(){return this._vo}};var i=class{_vo;_httpClient;_databaseVO;constructor(t,e,h){this._httpClient=h,this._vo=t,this._databaseVO=e}records={list:async()=>{let t=this._vo.id;return(await this._httpClient.get(`/v1/spaces/${this._databaseVO.spaceId}/resources/databases/${this._vo.id}/records/${t}`)).data}}};var p=class{_vo;_httpClient;constructor(t,e){this._httpClient=e,this._vo=t}get id(){return this._vo.id}views={get:async t=>{let e=await this._httpClient.get(`/v1/spaces/${this._vo.spaceId}/resources/databases/${this._vo.id}/views/${t}`);return new i(e.data,this._vo,this._httpClient)},list:async()=>(await this._httpClient.get(`/v1/spaces/${this._vo.spaceId}/resources/databases/${this._vo.id}/views`)).data.map(e=>new i(e,this._vo,this._httpClient))};fields={list:async()=>[]};records={list:async()=>(await this._httpClient.get(`/v1/spaces/${this._vo.spaceId}/resources/databases/${this._vo.id}/records`)).data};attachments={upload:async()=>"post"}};var o=class{_vo;_httpClient;constructor(t,e){this._vo=t,this._httpClient=e}get id(){return this._vo.id}get resourceType(){return this._vo.type}async asDatabase(){let t=await this._httpClient.get(`/v1/spaces/${this._vo.id}/resources/databases/${this._vo.id}`);return new p(t.data,this._httpClient)}async asAutomation(){let t=await this._httpClient.get(`/v1/spaces/${this._vo.id}/resources/automations/${this._vo.id}`);return new n(t.data,this._httpClient)}embeddedLink={create:async()=>{},get:async()=>{},list:async()=>{},delete:async()=>{}}};var c=class{_vo;_httpClient;constructor(t,e){this._vo=t,this._httpClient=e}get id(){return this._vo.id}members={};teams={};roles={}};var a=class{_vo;_httpClient;constructor(t,e){this._vo=t,this._httpClient=e}get id(){return this._vo.id}intelligence={search:()=>{},chat:()=>{}};outgoingWebhooks={list:async()=>(await this._httpClient.get(`/v1/spaces/${this._vo.id}/outgoing-webhooks`)).data,register:async t=>{let e=await this._httpClient.post(`/v1/spaces/${this._vo.id}/outgoing-webhooks`,t);return e.error&&(console.log("ERROR2222",e.error.issues,t),console.log("333",e)),e.data},delete:async t=>(await this._httpClient.delete(`/v1/spaces/${this._vo.id}/outgoing-webhooks/${t.id}`)).data};units={list:async()=>(await this._httpClient.get(`/v1/spaces/${this._vo.id}/nodes`)).data.map(e=>new c(e,this._httpClient))};nodes={list:async()=>(await this._httpClient.get(`/v1/spaces/${this._vo.id}/nodes`)).data.map(e=>new o(e,this._httpClient)),get:async t=>{let e=await this._httpClient.get(`/v1/spaces/${this._vo.id}/nodes/${t}`);return new o(e.data,this._httpClient)}}};var l=class{_options;_httpClient;constructor(t){this._options=t,this._httpClient=t.customHttpClient||new r(t.baseURL||"https://bika.ai/api/openapi/bika",t.token)}space={list:async()=>(await this._httpClient.get("/v1/spaces")).data.map(e=>new a(e,this._httpClient)),get:async t=>{let e=await this._httpClient.get(`/v1/spaces/${t}`);return new a(e.data,this._httpClient)}};siteAdmin={appEnv:async()=>(await this._httpClient.get("/v1/site-admin/app-env")).data,outgoingWebhooks:{list:async()=>(await this._httpClient.get("/v1/site-admin/outgoing-webhooks")).data,register:async t=>(await this._httpClient.post("/v1/site-admin/outgoing-webhooks",t)).data,delete:async()=>(await this._httpClient.delete("/v1/site-admin/outgoing-webhooks")).data}};system={meta:async()=>(await this._httpClient.get("/v1/system/meta")).data}};export{l as Bika}; |
{ | ||
"name": "bika.ai", | ||
"version": "0.0.3", | ||
"version": "0.8.20-alpha.6", | ||
"description": "Bika.ai Official JavaScript API Client", | ||
"main": "dist/index.js", | ||
"exports": { | ||
".": "./dist/index.js", | ||
"./types": "./dist/types/index.d.ts" | ||
}, | ||
"files": [ | ||
@@ -11,3 +15,3 @@ "dist", | ||
"scripts": { | ||
"test": "vitest", | ||
"test": "dotenv -e ../../apps/web/.env.local -- vitest", | ||
"build": "tsc && node build.mjs build", | ||
@@ -39,4 +43,6 @@ "dev": "tsc && node build.mjs watch" | ||
"dependencies": { | ||
"axios": "^1.6.7" | ||
"@bika/types": "workspace:*", | ||
"axios": "^1.6.7", | ||
"zod": "^3.23.8" | ||
} | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
14744
13
308
0
3
1
+ Added@bika/types@workspace:*
+ Addedzod@^3.23.8
+ Addedzod@3.24.1(transitive)