@textbee/sdk 0.3.0 → 0.3.1

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
@@ -8,6 +8,8 @@ Official JavaScript SDK for [textbee.dev](https://textbee.dev), the open source
8
8
 
9
9
  Zero dependencies, TypeScript types included, works in Node 18+, Bun, Deno, Cloudflare Workers, and Vercel Edge.
10
10
 
11
+ Writing Python? Use the official [Python SDK](https://github.com/textbee/textbee-python): `pip install textbee`.
12
+
11
13
  ## Install
12
14
 
13
15
  ```bash
@@ -229,7 +231,7 @@ new Textbee({ apiKey, baseUrl: 'https://sms.example.com/api/v1' })
229
231
  new Textbee({ apiKey, baseUrl: 'http://localhost:3001' })
230
232
  ```
231
233
 
232
- If the API sits under a path prefix, give the full path, for example `https://example.com/textbee/api/v1`. Any path other than `/api/v1` is used as given, so a proxy that maps `/sms` onto the API keeps working with `https://example.com/sms`. A value with no scheme gets `https://`. An invalid URL, or one with a username or password, throws a `TypeError` instead of falling back to the hosted API, so a typo never sends your key to textbee.dev.
234
+ If the API sits under a path prefix, give the prefix: `https://example.com/textbee` reaches `https://example.com/textbee/api/v1`. The SDK adds `/api/v1` unless the path already contains it, the same rule the textbee MCP server uses for `TEXTBEE_BASE_URL`. A value with no scheme gets `https://`. An invalid URL, or one with a username or password, throws a `TypeError` instead of falling back to the hosted API, so a typo never sends your key to textbee.dev.
233
235
 
234
236
  ## What is not covered yet
235
237
 
package/dist/index.cjs CHANGED
@@ -48,7 +48,7 @@ var TextbeeError = class extends Error {
48
48
 
49
49
  // src/client.ts
50
50
  var DEFAULT_BASE_URL = "https://api.textbee.dev/api/v1";
51
- var CLIENT_ID = `textbee-js/${"0.3.0"}`;
51
+ var CLIENT_ID = `textbee-js/${"0.3.1"}`;
52
52
  var Textbee = class {
53
53
  #apiKey;
54
54
  #baseUrl;
@@ -224,10 +224,8 @@ function normalizeBaseUrl(raw) {
224
224
  }
225
225
  }
226
226
  let path;
227
- if (segments.length === 0) {
228
- path = ["api", "v1"];
229
- } else if (cut === -1) {
230
- path = segments;
227
+ if (cut === -1) {
228
+ path = [...segments, "api", "v1"];
231
229
  } else {
232
230
  path = [...segments.slice(0, cut - 2), "api", "v1"];
233
231
  }
package/dist/index.d.cts CHANGED
@@ -4,9 +4,9 @@ interface TextbeeOptions {
4
4
  /**
5
5
  * Your self-hosted textbee API. Defaults to `https://api.textbee.dev/api/v1`.
6
6
  *
7
- * A bare origin such as `https://sms.example.com` gets `/api/v1` added. A URL
7
+ * `/api/v1` is added unless the path already contains it, so
8
+ * `https://sms.example.com` and `https://example.com/textbee` both work. A URL
8
9
  * that contains `/api/v1` is cut there, so a pasted endpoint URL still works.
9
- * Any other path is used as given, for proxies that map a prefix onto the API.
10
10
  * A value with no scheme gets `https://`. An invalid URL throws a `TypeError`
11
11
  * rather than falling back, so a typo never sends your key to the public API.
12
12
  */
package/dist/index.d.ts CHANGED
@@ -4,9 +4,9 @@ interface TextbeeOptions {
4
4
  /**
5
5
  * Your self-hosted textbee API. Defaults to `https://api.textbee.dev/api/v1`.
6
6
  *
7
- * A bare origin such as `https://sms.example.com` gets `/api/v1` added. A URL
7
+ * `/api/v1` is added unless the path already contains it, so
8
+ * `https://sms.example.com` and `https://example.com/textbee` both work. A URL
8
9
  * that contains `/api/v1` is cut there, so a pasted endpoint URL still works.
9
- * Any other path is used as given, for proxies that map a prefix onto the API.
10
10
  * A value with no scheme gets `https://`. An invalid URL throws a `TypeError`
11
11
  * rather than falling back, so a typo never sends your key to the public API.
12
12
  */
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ var TextbeeError = class extends Error {
14
14
 
15
15
  // src/client.ts
16
16
  var DEFAULT_BASE_URL = "https://api.textbee.dev/api/v1";
17
- var CLIENT_ID = `textbee-js/${"0.3.0"}`;
17
+ var CLIENT_ID = `textbee-js/${"0.3.1"}`;
18
18
  var Textbee = class {
19
19
  #apiKey;
20
20
  #baseUrl;
@@ -190,10 +190,8 @@ function normalizeBaseUrl(raw) {
190
190
  }
191
191
  }
192
192
  let path;
193
- if (segments.length === 0) {
194
- path = ["api", "v1"];
195
- } else if (cut === -1) {
196
- path = segments;
193
+ if (cut === -1) {
194
+ path = [...segments, "api", "v1"];
197
195
  } else {
198
196
  path = [...segments.slice(0, cut - 2), "api", "v1"];
199
197
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbee/sdk",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Official JavaScript SDK for textbee.dev, the open source SMS gateway",
5
5
  "license": "MIT",
6
6
  "packageManager": "pnpm@9.14.2",