membase-ai 0.2.2 → 0.3.0

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
@@ -1,71 +1,7 @@
1
- <p align="center">
2
- <img src="https://raw.githubusercontent.com/unibaseio/membase-ai/main/assets/membase-logo.png" width="72" alt="Membase">
3
- </p>
1
+ # membase-ai
4
2
 
5
- <h1 align="center">membase-ai</h1>
6
-
7
- <p align="center">
8
- <b>One memory. Every AI.</b><br>
9
- The Membase SDK for TypeScript: drop-in memory infrastructure for AI agents and apps.
10
- </p>
11
-
12
- <p align="center">
13
- <a href="https://www.unibase.com/memory">Website</a> ·
14
- <a href="https://unibaseio.gitbook.io/unibase-docs/membase">Docs</a> ·
15
- <a href="https://www.app.membase.ai">Web app</a> ·
16
- <a href="https://github.com/unibaseio/membase-ai">GitHub</a> ·
17
- <a href="https://discord.gg/nB9EfPGsSf">Discord</a>
18
- </p>
19
-
20
- Memory hosted in your Membase account, or local through the Python package.
21
-
22
- ```bash
23
- npm install membase-ai
24
- export MEMBASE_API_KEY="mbk_…" # Connect › Developer keys in the Membase app
25
- ```
26
-
27
- ```ts
28
- import { Membase } from "membase-ai";
29
-
30
- const client = new Membase();
31
-
32
- await client.add({ container: "mv-…", content: "Call notes with Acme: they want SSO before the pilot.", customId: "call-2026-09-24" });
33
- const { results } = await client.search({ q: "what does Acme need before the pilot", limit: 5 });
34
- console.log(results[0].content);
35
-
36
- await client.profile({ q: "working hours" }); // who the user is (the key needs Profile access)
37
- await client.containers.list();
38
- await client.documents.list({ container: "mv-…" });
39
- await client.memories.add({ content: "The user prefers dark mode.", static: true });
40
- await client.documents.delete("srcitem_…", { confirm: true }); // Full access; confirm means the person agreed
41
- ```
42
-
43
- Container ids come from `containers.list()`; document ids from `documents.list()` or the
44
- `document_id` that `add()` returns.
45
-
46
- Every method is one operation of the Membase agent protocol; access level, reach and confirmation
47
- rules are enforced server-side. Errors are one class per HTTP status (`PermissionDeniedError`,
48
- `RateLimitError`, …) and carry the API's `code` and `traceId`. 408, 409, 429 and 5xx answers,
49
- connection errors and timeouts are retried twice with backoff, honouring `Retry-After`; the
50
- default timeout is 90 s per attempt, because the first search after a quiet spell waits for the
51
- user's memory to wake.
52
-
53
- Node 18+ (global `fetch`). Zero dependencies.
54
-
55
- ## Local memory
56
-
57
- Run the engine on your machine with the Python package (Python 3.12 or 3.13, with
58
- `OPENAI_API_KEY` set for the server) and point the client at it — same methods:
3
+ Use [@unibaseio/membase](https://www.npmjs.com/package/@unibaseio/membase).
59
4
 
60
5
  ```bash
61
- pip install 'membase-ai[local]'
62
- membase --local serve # http://127.0.0.1:8787/v1, store under ~/.membase
63
- ```
64
-
65
- ```ts
66
- const local = new Membase({ apiKey: "local", baseUrl: "http://127.0.0.1:8787" });
6
+ npm install @unibaseio/membase
67
7
  ```
68
-
69
- If the server runs with `MEMBASE_LOCAL_TOKEN`, pass that token as `apiKey`.
70
-
71
- `membase-sdk` on npm is the earlier name of this package and keeps working as an alias.
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "@unibaseio/membase";
package/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "@unibaseio/membase";
package/package.json CHANGED
@@ -1,49 +1,18 @@
1
1
  {
2
2
  "name": "membase-ai",
3
- "version": "0.2.2",
4
- "description": "Membase SDK for TypeScript: drop-in memory infrastructure for AI agents and apps, hosted or local via `membase --local serve`.",
5
- "license": "MIT",
3
+ "version": "0.3.0",
4
+ "description": "Use @unibaseio/membase.",
5
+ "license": "UNLICENSED",
6
+ "homepage": "https://www.unibase.com/memory",
6
7
  "type": "module",
7
- "main": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js"
13
- }
14
- },
8
+ "main": "./index.js",
9
+ "types": "./index.d.ts",
15
10
  "files": [
16
- "dist",
17
- "README.md",
18
- "LICENSE"
19
- ],
20
- "sideEffects": false,
21
- "engines": {
22
- "node": ">=18"
23
- },
24
- "scripts": {
25
- "build": "tsc -p tsconfig.build.json",
26
- "typecheck": "tsc -p tsconfig.json --noEmit",
27
- "test": "vitest run"
28
- },
29
- "keywords": [
30
- "membase",
31
- "memory",
32
- "agent-memory",
33
- "long-term-memory",
34
- "llm",
35
- "ai",
36
- "agents"
11
+ "index.js",
12
+ "index.d.ts",
13
+ "README.md"
37
14
  ],
38
- "homepage": "https://www.unibase.com/memory",
39
- "devDependencies": {
40
- "@types/node": "^20.19.43",
41
- "typescript": "^5.6.2",
42
- "vitest": "^4.1.11"
43
- },
44
- "repository": {
45
- "type": "git",
46
- "url": "git+https://github.com/unibaseio/membase-ai.git",
47
- "directory": "typescript"
15
+ "dependencies": {
16
+ "@unibaseio/membase": "^0.3.0"
48
17
  }
49
18
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Unibase
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
package/dist/client.d.ts DELETED
@@ -1,160 +0,0 @@
1
- /** The Membase client: one developer key, the account's memory. */
2
- export declare const VERSION = "0.2.0";
3
- export declare const DEFAULT_BASE_URL = "https://api.app.membase.io";
4
- /** The first search after a quiet spell can take up to a minute while the memory wakes. */
5
- export declare const DEFAULT_TIMEOUT_MS = 90000;
6
- export declare const DEFAULT_MAX_RETRIES = 2;
7
- type Fetch = typeof fetch;
8
- export interface MembaseOptions {
9
- /** Defaults to `process.env.MEMBASE_API_KEY`. */
10
- apiKey?: string;
11
- /** Defaults to `process.env.MEMBASE_BASE_URL`, then `https://api.app.membase.io`. */
12
- baseUrl?: string;
13
- /** Per-request timeout. Default 90 s. */
14
- timeoutMs?: number;
15
- /** Retries on 408/409/429/5xx and connection errors. Default 2. */
16
- maxRetries?: number;
17
- /** A `fetch` to use instead of the global one (tests, custom agents). */
18
- fetch?: Fetch;
19
- }
20
- export interface Container {
21
- id: string;
22
- name: string;
23
- description?: string;
24
- [k: string]: unknown;
25
- }
26
- export interface ContainerList {
27
- containers: Container[];
28
- }
29
- export interface SearchHit {
30
- content: string;
31
- score?: number;
32
- container: string;
33
- container_name?: string;
34
- source?: string;
35
- [k: string]: unknown;
36
- }
37
- export interface SearchResult {
38
- query: string;
39
- results: SearchHit[];
40
- containers: Array<{
41
- id: string;
42
- name: string;
43
- error?: string;
44
- }>;
45
- }
46
- export interface Profile {
47
- available?: boolean;
48
- ready?: boolean;
49
- static: string[];
50
- dynamic: Array<{
51
- id: number | string;
52
- content: string;
53
- updated_at?: string;
54
- }>;
55
- results?: SearchHit[];
56
- }
57
- export interface Document {
58
- id: string;
59
- container: string;
60
- title?: string;
61
- learned?: boolean;
62
- [k: string]: unknown;
63
- }
64
- export interface DocumentList {
65
- documents: Document[];
66
- }
67
- export interface AddDocumentResult {
68
- document_id: string | null;
69
- container: string;
70
- status: string;
71
- path?: string;
72
- learning_run?: {
73
- id: string;
74
- status: string;
75
- } | null;
76
- [k: string]: unknown;
77
- }
78
- export interface ConfirmationRequired {
79
- status: "confirmation_required";
80
- verb: string;
81
- how: string;
82
- [k: string]: unknown;
83
- }
84
- export type Json = Record<string, unknown>;
85
- export interface AddParams {
86
- /** Which container reads it. */
87
- container: string;
88
- /** The document's full text. */
89
- content?: string;
90
- /** A public web address to fetch instead of `content`. */
91
- url?: string;
92
- title?: string;
93
- /** Your own tags, as an object. */
94
- metadata?: Record<string, unknown>;
95
- /** Your own id; adding the same customId again is a no-op. */
96
- customId?: string;
97
- }
98
- export interface SearchParams {
99
- /** The question, in natural language. */
100
- q: string;
101
- /** One container id; omit to search every container in reach. */
102
- container?: string;
103
- /** How many passages in all, not per container (1–50). */
104
- limit?: number;
105
- }
106
- export declare class Membase {
107
- readonly baseUrl: string;
108
- readonly maxRetries: number;
109
- readonly timeoutMs: number;
110
- private readonly apiKey;
111
- private readonly fetchImpl;
112
- readonly containers: {
113
- /** The containers this key may use — every one, for the account's owner. */
114
- list: () => Promise<ContainerList>;
115
- };
116
- readonly documents: {
117
- /** The documents the containers in reach have read, newest first, each with `learned`. */
118
- list: (params?: {
119
- container?: string;
120
- }) => Promise<DocumentList>;
121
- /** One document, with whether its container has learned it yet. */
122
- get: (documentId: string) => Promise<Document>;
123
- /** Remove one document everywhere; needs Full access and `confirm: true`. */
124
- delete: (documentId: string, params?: {
125
- confirm?: boolean;
126
- }) => Promise<Json | ConfirmationRequired>;
127
- };
128
- readonly memories: {
129
- /** Save one fact; `static: true` records a standing fact in the user's profile. */
130
- add: (params: {
131
- content: string;
132
- container?: string;
133
- static?: boolean;
134
- title?: string;
135
- }) => Promise<Json>;
136
- /** Forget one learned fact; needs `confirm: true`, like `documents.delete`. */
137
- forget: (memoryId: string, params?: {
138
- container?: string;
139
- confirm?: boolean;
140
- }) => Promise<Json | ConfirmationRequired>;
141
- };
142
- constructor(opts?: MembaseOptions);
143
- /** Hand a document (its text, or a public `url` to fetch) to a container. */
144
- add(params: AddParams): Promise<AddDocumentResult>;
145
- /** Passages the containers hold on `q`, most relevant first, each naming its container. */
146
- search(params: SearchParams): Promise<SearchResult>;
147
- /** Who the user is: `static` (standing facts), `dynamic` (recently changed facts) and, with `q`, `results` relevant to the topic. */
148
- profile(params?: {
149
- q?: string;
150
- }): Promise<Profile>;
151
- /** The exposed agent's answer to `message` (an agent-endpoint credential). */
152
- ask(params: {
153
- message: string;
154
- model?: string;
155
- }): Promise<Json>;
156
- /** The user's standing rules for how their memory is used by this credential. */
157
- rules(): Promise<Json>;
158
- private request;
159
- }
160
- export {};
package/dist/client.js DELETED
@@ -1,147 +0,0 @@
1
- /** The Membase client: one developer key, the account's memory. */
2
- import { APIConnectionError, APITimeoutError, errorFor } from "./errors.js";
3
- export const VERSION = "0.2.0";
4
- export const DEFAULT_BASE_URL = "https://api.app.membase.io";
5
- /** The first search after a quiet spell can take up to a minute while the memory wakes. */
6
- export const DEFAULT_TIMEOUT_MS = 90_000;
7
- export const DEFAULT_MAX_RETRIES = 2;
8
- const RETRY_STATUSES = new Set([408, 409, 429]);
9
- export class Membase {
10
- baseUrl;
11
- maxRetries;
12
- timeoutMs;
13
- apiKey;
14
- fetchImpl;
15
- containers = {
16
- /** The containers this key may use — every one, for the account's owner. */
17
- list: () => this.request("GET", "/v1/containers"),
18
- };
19
- documents = {
20
- /** The documents the containers in reach have read, newest first, each with `learned`. */
21
- list: (params = {}) => this.request("GET", "/v1/documents", { query: { container: params.container } }),
22
- /** One document, with whether its container has learned it yet. */
23
- get: (documentId) => this.request("GET", `/v1/documents/${encodeURIComponent(documentId)}`),
24
- /** Remove one document everywhere; needs Full access and `confirm: true`. */
25
- delete: (documentId, params = {}) => this.request("DELETE", `/v1/documents/${encodeURIComponent(documentId)}`, {
26
- query: { confirm: params.confirm ? "true" : "false" },
27
- }),
28
- };
29
- memories = {
30
- /** Save one fact; `static: true` records a standing fact in the user's profile. */
31
- add: (params) => this.request("POST", "/v1/memories", {
32
- body: { content: params.content, container: params.container, static: params.static ?? false, title: params.title ?? "" },
33
- }),
34
- /** Forget one learned fact; needs `confirm: true`, like `documents.delete`. */
35
- forget: (memoryId, params = {}) => this.request("DELETE", `/v1/memories/${encodeURIComponent(memoryId)}`, {
36
- query: { container: params.container, confirm: params.confirm ? "true" : "false" },
37
- }),
38
- };
39
- constructor(opts = {}) {
40
- const env = globalThis.process?.env ?? {};
41
- const apiKey = opts.apiKey ?? env.MEMBASE_API_KEY;
42
- if (!apiKey) {
43
- throw new Error("no API key: pass apiKey or set MEMBASE_API_KEY (Connect › Developer keys in the Membase app)");
44
- }
45
- this.apiKey = apiKey;
46
- this.baseUrl = (opts.baseUrl ?? env.MEMBASE_BASE_URL ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
47
- this.timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
48
- this.maxRetries = Math.max(0, opts.maxRetries ?? DEFAULT_MAX_RETRIES);
49
- this.fetchImpl = opts.fetch ?? fetch;
50
- }
51
- /** Hand a document (its text, or a public `url` to fetch) to a container. */
52
- add(params) {
53
- return this.request("POST", "/v1/documents", {
54
- body: {
55
- container: params.container,
56
- content: params.content,
57
- url: params.url,
58
- title: params.title ?? "",
59
- metadata: params.metadata,
60
- custom_id: params.customId ?? "",
61
- },
62
- });
63
- }
64
- /** Passages the containers hold on `q`, most relevant first, each naming its container. */
65
- search(params) {
66
- return this.request("POST", "/v1/search", { body: { q: params.q, container: params.container, limit: params.limit } });
67
- }
68
- /** Who the user is: `static` (standing facts), `dynamic` (recently changed facts) and, with `q`, `results` relevant to the topic. */
69
- profile(params = {}) {
70
- return this.request("GET", "/v1/profile", { query: { q: params.q } });
71
- }
72
- /** The exposed agent's answer to `message` (an agent-endpoint credential). */
73
- ask(params) {
74
- return this.request("POST", "/v1/ask", { body: { message: params.message, model: params.model } });
75
- }
76
- /** The user's standing rules for how their memory is used by this credential. */
77
- rules() {
78
- return this.request("GET", "/v1/rules");
79
- }
80
- async request(method, path, opts = {}) {
81
- const url = new URL(this.baseUrl + path);
82
- for (const [k, v] of Object.entries(opts.query ?? {}))
83
- if (v !== undefined)
84
- url.searchParams.set(k, String(v));
85
- const headers = {
86
- Authorization: `Bearer ${this.apiKey}`,
87
- Accept: "application/json",
88
- "User-Agent": `membase-ai-typescript/${VERSION}`,
89
- };
90
- let body;
91
- if (opts.body !== undefined) {
92
- headers["Content-Type"] = "application/json";
93
- body = JSON.stringify(Object.fromEntries(Object.entries(opts.body).filter(([, v]) => v !== undefined)));
94
- }
95
- let attempt = 0;
96
- for (;;) {
97
- const controller = new AbortController();
98
- const timer = setTimeout(() => controller.abort(), this.timeoutMs);
99
- let res;
100
- try {
101
- res = await this.fetchImpl(url.toString(), { method, headers, body, signal: controller.signal });
102
- }
103
- catch (e) {
104
- clearTimeout(timer);
105
- if (attempt < this.maxRetries) {
106
- attempt += 1;
107
- await sleep(backoff(attempt));
108
- continue;
109
- }
110
- const aborted = e?.name === "AbortError";
111
- throw aborted
112
- ? new APITimeoutError(`${method} ${path} timed out after ${this.timeoutMs} ms`)
113
- : new APIConnectionError(`${method} ${path}: ${e?.message ?? String(e)}`);
114
- }
115
- clearTimeout(timer);
116
- if (res.ok) {
117
- const text = await res.text();
118
- return (text ? JSON.parse(text) : null);
119
- }
120
- if ((RETRY_STATUSES.has(res.status) || res.status >= 500) && attempt < this.maxRetries) {
121
- attempt += 1;
122
- await sleep(backoff(attempt, res.headers.get("Retry-After")));
123
- continue;
124
- }
125
- let parsed;
126
- const text = await res.text();
127
- try {
128
- parsed = text ? JSON.parse(text) : {};
129
- }
130
- catch {
131
- parsed = { error: { message: text } };
132
- }
133
- throw errorFor(res.status, parsed);
134
- }
135
- }
136
- }
137
- function backoff(attempt, retryAfter) {
138
- if (retryAfter) {
139
- const s = Number(retryAfter);
140
- if (Number.isFinite(s))
141
- return Math.min(s, 30) * 1000;
142
- }
143
- return Math.min(500 * 2 ** (attempt - 1), 8000) * (0.5 + Math.random());
144
- }
145
- function sleep(ms) {
146
- return new Promise((r) => setTimeout(r, ms));
147
- }
package/dist/errors.d.ts DELETED
@@ -1,58 +0,0 @@
1
- /** Errors, one class per HTTP status class, all carrying the platform's error envelope. */
2
- export interface ErrorEnvelope {
3
- error?: {
4
- code?: string;
5
- message?: string;
6
- details?: unknown;
7
- retryable?: boolean;
8
- trace_id?: string;
9
- };
10
- detail?: unknown;
11
- }
12
- export declare class MembaseError extends Error {
13
- readonly status: number | undefined;
14
- readonly body: unknown;
15
- readonly code: string;
16
- readonly details: unknown;
17
- readonly retryable: boolean;
18
- readonly traceId: string;
19
- constructor(message: string, opts?: {
20
- status?: number;
21
- body?: unknown;
22
- });
23
- }
24
- /** The request never got an answer (DNS, connection refused, reset). */
25
- export declare class APIConnectionError extends MembaseError {
26
- }
27
- /** The request ran past the client's timeout. */
28
- export declare class APITimeoutError extends APIConnectionError {
29
- }
30
- /** A non-2xx answer. */
31
- export declare class APIStatusError extends MembaseError {
32
- }
33
- /** 400 — a malformed request: a missing `q`, both `content` and `url`, an ambiguous `container`. */
34
- export declare class BadRequestError extends APIStatusError {
35
- }
36
- /** 401 — the request carried no bearer at all. */
37
- export declare class AuthenticationError extends APIStatusError {
38
- }
39
- /** 403 (`code: unauthorized`) — an unknown, expired or revoked key; a container outside the key's reach; or a verb above its access level. */
40
- export declare class PermissionDeniedError extends APIStatusError {
41
- }
42
- /** 404 — an unknown document or memory id. */
43
- export declare class NotFoundError extends APIStatusError {
44
- }
45
- /** 409. */
46
- export declare class ConflictError extends APIStatusError {
47
- }
48
- /** 422 — the account's memory cannot run a turn on this deployment (`capability_unavailable`). */
49
- export declare class UnprocessableEntityError extends APIStatusError {
50
- }
51
- /** 429 — the account's turn budget is spent for now. */
52
- export declare class RateLimitError extends APIStatusError {
53
- }
54
- /** 5xx. */
55
- export declare class InternalServerError extends APIStatusError {
56
- }
57
- /** The exception for a non-2xx answer. */
58
- export declare function errorFor(status: number, body: unknown, fallback?: string): APIStatusError;
package/dist/errors.js DELETED
@@ -1,72 +0,0 @@
1
- /** Errors, one class per HTTP status class, all carrying the platform's error envelope. */
2
- export class MembaseError extends Error {
3
- status;
4
- body;
5
- code;
6
- details;
7
- retryable;
8
- traceId;
9
- constructor(message, opts = {}) {
10
- super(message);
11
- this.name = new.target.name;
12
- this.status = opts.status;
13
- this.body = opts.body;
14
- const err = opts.body?.error ?? {};
15
- this.code = String(err.code ?? "");
16
- this.details = err.details;
17
- this.retryable = Boolean(err.retryable ?? false);
18
- this.traceId = String(err.trace_id ?? "");
19
- }
20
- }
21
- /** The request never got an answer (DNS, connection refused, reset). */
22
- export class APIConnectionError extends MembaseError {
23
- }
24
- /** The request ran past the client's timeout. */
25
- export class APITimeoutError extends APIConnectionError {
26
- }
27
- /** A non-2xx answer. */
28
- export class APIStatusError extends MembaseError {
29
- }
30
- /** 400 — a malformed request: a missing `q`, both `content` and `url`, an ambiguous `container`. */
31
- export class BadRequestError extends APIStatusError {
32
- }
33
- /** 401 — the request carried no bearer at all. */
34
- export class AuthenticationError extends APIStatusError {
35
- }
36
- /** 403 (`code: unauthorized`) — an unknown, expired or revoked key; a container outside the key's reach; or a verb above its access level. */
37
- export class PermissionDeniedError extends APIStatusError {
38
- }
39
- /** 404 — an unknown document or memory id. */
40
- export class NotFoundError extends APIStatusError {
41
- }
42
- /** 409. */
43
- export class ConflictError extends APIStatusError {
44
- }
45
- /** 422 — the account's memory cannot run a turn on this deployment (`capability_unavailable`). */
46
- export class UnprocessableEntityError extends APIStatusError {
47
- }
48
- /** 429 — the account's turn budget is spent for now. */
49
- export class RateLimitError extends APIStatusError {
50
- }
51
- /** 5xx. */
52
- export class InternalServerError extends APIStatusError {
53
- }
54
- const BY_STATUS = {
55
- 400: BadRequestError,
56
- 401: AuthenticationError,
57
- 403: PermissionDeniedError,
58
- 404: NotFoundError,
59
- 409: ConflictError,
60
- 422: UnprocessableEntityError,
61
- 429: RateLimitError,
62
- };
63
- /** The exception for a non-2xx answer. */
64
- export function errorFor(status, body, fallback = "") {
65
- const env = (body ?? {});
66
- let message = env.error?.message;
67
- if (!message && env.detail !== undefined)
68
- message = typeof env.detail === "string" ? env.detail : JSON.stringify(env.detail);
69
- message = message || fallback || `HTTP ${status}`;
70
- const Cls = BY_STATUS[status] ?? (status >= 500 ? InternalServerError : APIStatusError);
71
- return new Cls(message, { status, body });
72
- }
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export { Membase, DEFAULT_BASE_URL, DEFAULT_TIMEOUT_MS, DEFAULT_MAX_RETRIES, VERSION } from "./client.js";
2
- export type { MembaseOptions, AddParams, SearchParams, Container, ContainerList, SearchHit, SearchResult, Profile, Document, DocumentList, AddDocumentResult, ConfirmationRequired, Json, } from "./client.js";
3
- export { MembaseError, APIConnectionError, APITimeoutError, APIStatusError, BadRequestError, AuthenticationError, PermissionDeniedError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitError, InternalServerError, } from "./errors.js";
package/dist/index.js DELETED
@@ -1,2 +0,0 @@
1
- export { Membase, DEFAULT_BASE_URL, DEFAULT_TIMEOUT_MS, DEFAULT_MAX_RETRIES, VERSION } from "./client.js";
2
- export { MembaseError, APIConnectionError, APITimeoutError, APIStatusError, BadRequestError, AuthenticationError, PermissionDeniedError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitError, InternalServerError, } from "./errors.js";