@beliq/sdk 0.4.2 → 0.4.4

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.js CHANGED
@@ -292,6 +292,11 @@ async function send(config, req) {
292
292
 
293
293
  // src/client.ts
294
294
  var TEST_KEY_PREFIX = "blq_test_";
295
+ function trimTrailingSlashes(url) {
296
+ let end = url.length;
297
+ while (end > 0 && url[end - 1] === "/") end--;
298
+ return url.slice(0, end);
299
+ }
295
300
  function livemodeHeader(headers) {
296
301
  const raw = headers.get("x-beliq-livemode");
297
302
  if (raw === "true") return true;
@@ -356,7 +361,7 @@ var Beliq = class {
356
361
  this.livemode = !options.apiKey.startsWith(TEST_KEY_PREFIX);
357
362
  this.#config = {
358
363
  apiKey: options.apiKey,
359
- baseUrl: (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, ""),
364
+ baseUrl: trimTrailingSlashes(options.baseUrl ?? DEFAULT_BASE_URL),
360
365
  auth: options.auth ?? "header",
361
366
  fetchImpl,
362
367
  timeoutMs: options.timeoutMs ?? DEFAULT_TIMEOUT_MS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beliq/sdk",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "description": "Official beliq SDK: generate, validate, parse, and convert EU-compliant e-invoices (XRechnung, ZUGFeRD, Factur-X, Peppol BIS) against authority-pinned, drift-checked rules.",
5
5
  "keywords": [
6
6
  "beliq",