@fonderie/client 0.29.0 → 0.29.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/dist/index.js CHANGED
@@ -128,7 +128,8 @@ var HttpClient = class {
128
128
  if (newToken) return this.exec({ ...opts, token: newToken }, true);
129
129
  }
130
130
  if (res.status === 204) {
131
- if (!res.ok) throw new FonderieApiError("unknown", res.statusText, res.status, void 0, rid);
131
+ if (!res.ok)
132
+ throw new FonderieApiError("unknown", res.statusText, res.status, void 0, rid);
132
133
  return void 0;
133
134
  }
134
135
  const data = await res.json();
@@ -1531,19 +1532,49 @@ var FonderieClient = class {
1531
1532
  });
1532
1533
  }
1533
1534
  post(path, body, config) {
1534
- return this.request({ method: "POST", path, body, token: config?.token, workspaceId: config?.workspaceId, invalidate: config?.invalidate });
1535
+ return this.request({
1536
+ method: "POST",
1537
+ path,
1538
+ body,
1539
+ token: config?.token,
1540
+ workspaceId: config?.workspaceId,
1541
+ invalidate: config?.invalidate
1542
+ });
1535
1543
  }
1536
1544
  put(path, body, config) {
1537
- return this.request({ method: "PUT", path, body, token: config?.token, workspaceId: config?.workspaceId, invalidate: config?.invalidate });
1545
+ return this.request({
1546
+ method: "PUT",
1547
+ path,
1548
+ body,
1549
+ token: config?.token,
1550
+ workspaceId: config?.workspaceId,
1551
+ invalidate: config?.invalidate
1552
+ });
1538
1553
  }
1539
1554
  patch(path, body, config) {
1540
- return this.request({ method: "PATCH", path, body, token: config?.token, workspaceId: config?.workspaceId, invalidate: config?.invalidate });
1555
+ return this.request({
1556
+ method: "PATCH",
1557
+ path,
1558
+ body,
1559
+ token: config?.token,
1560
+ workspaceId: config?.workspaceId,
1561
+ invalidate: config?.invalidate
1562
+ });
1541
1563
  }
1542
1564
  delete(path, config) {
1543
- return this.request({ method: "DELETE", path, token: config?.token, workspaceId: config?.workspaceId, invalidate: config?.invalidate });
1565
+ return this.request({
1566
+ method: "DELETE",
1567
+ path,
1568
+ token: config?.token,
1569
+ workspaceId: config?.workspaceId,
1570
+ invalidate: config?.invalidate
1571
+ });
1544
1572
  }
1545
1573
  };
1546
1574
 
1575
+ // src/path.ts
1576
+ var normalizeMountPath = (path) => path.replace(/\/+$/, "");
1577
+
1547
1578
  // src/modules/config-admin.ts
1548
1579
  function envQuery(environment) {
1549
1580
  return environment ? `?environment=${encodeURIComponent(environment)}` : "";
@@ -1556,7 +1587,7 @@ var ConfigAdminClient = class {
1556
1587
  constructor(opts) {
1557
1588
  this.http = new HttpClient(opts.baseUrl);
1558
1589
  this.adminToken = opts.adminToken;
1559
- this.prefix = opts.prefix?.replace(/\/+$/, "");
1590
+ this.prefix = opts.prefix ? normalizeMountPath(opts.prefix) : void 0;
1560
1591
  this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
1561
1592
  }
1562
1593
  // The path literals stay on the legacy '/admin/...' so the route table and
@@ -1707,7 +1738,7 @@ var AdminClient = class {
1707
1738
  constructor(opts) {
1708
1739
  this.http = new HttpClient(opts.baseUrl);
1709
1740
  this.adminToken = opts.adminToken;
1710
- this.prefix = (opts.prefix ?? "/_admin").replace(/\/+$/, "");
1741
+ this.prefix = normalizeMountPath(opts.prefix ?? "/_admin");
1711
1742
  this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
1712
1743
  }
1713
1744
  get(suffix) {
@@ -1766,7 +1797,7 @@ var AuthAdminClient = class {
1766
1797
  constructor(opts) {
1767
1798
  this.http = new HttpClient(opts.baseUrl);
1768
1799
  this.adminToken = opts.adminToken;
1769
- this.prefix = (opts.prefix ?? "/_admin").replace(/\/+$/, "");
1800
+ this.prefix = normalizeMountPath(opts.prefix ?? "/_admin");
1770
1801
  this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
1771
1802
  }
1772
1803
  call(method, suffix) {
@@ -1817,7 +1848,7 @@ var BillingAdminClient = class {
1817
1848
  constructor(opts) {
1818
1849
  this.http = new HttpClient(opts.baseUrl);
1819
1850
  this.adminToken = opts.adminToken;
1820
- this.prefix = (opts.prefix ?? "/_admin").replace(/\/+$/, "");
1851
+ this.prefix = normalizeMountPath(opts.prefix ?? "/_admin");
1821
1852
  this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
1822
1853
  }
1823
1854
  call(method, suffix, body) {
@@ -1877,7 +1908,7 @@ var AuditAdminClient = class {
1877
1908
  constructor(opts) {
1878
1909
  this.http = new HttpClient(opts.baseUrl);
1879
1910
  this.adminToken = opts.adminToken;
1880
- this.prefix = (opts.prefix ?? "/_admin").replace(/\/+$/, "");
1911
+ this.prefix = normalizeMountPath(opts.prefix ?? "/_admin");
1881
1912
  this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
1882
1913
  }
1883
1914
  // Every workspace unless one is named. Newest first, keyset-paged.
@@ -1909,7 +1940,7 @@ var CourierAdminClient = class {
1909
1940
  constructor(opts) {
1910
1941
  this.http = new HttpClient(opts.baseUrl);
1911
1942
  this.adminToken = opts.adminToken;
1912
- this.prefix = opts.prefix?.replace(/\/+$/, "");
1943
+ this.prefix = opts.prefix ? normalizeMountPath(opts.prefix) : void 0;
1913
1944
  this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
1914
1945
  }
1915
1946
  // The path literals stay on the legacy '/admin/...' so the route table and