@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.cjs +42 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +42 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -170,7 +170,8 @@ var HttpClient = class {
|
|
|
170
170
|
if (newToken) return this.exec({ ...opts, token: newToken }, true);
|
|
171
171
|
}
|
|
172
172
|
if (res.status === 204) {
|
|
173
|
-
if (!res.ok)
|
|
173
|
+
if (!res.ok)
|
|
174
|
+
throw new FonderieApiError("unknown", res.statusText, res.status, void 0, rid);
|
|
174
175
|
return void 0;
|
|
175
176
|
}
|
|
176
177
|
const data = await res.json();
|
|
@@ -1573,19 +1574,49 @@ var FonderieClient = class {
|
|
|
1573
1574
|
});
|
|
1574
1575
|
}
|
|
1575
1576
|
post(path, body, config) {
|
|
1576
|
-
return this.request({
|
|
1577
|
+
return this.request({
|
|
1578
|
+
method: "POST",
|
|
1579
|
+
path,
|
|
1580
|
+
body,
|
|
1581
|
+
token: config?.token,
|
|
1582
|
+
workspaceId: config?.workspaceId,
|
|
1583
|
+
invalidate: config?.invalidate
|
|
1584
|
+
});
|
|
1577
1585
|
}
|
|
1578
1586
|
put(path, body, config) {
|
|
1579
|
-
return this.request({
|
|
1587
|
+
return this.request({
|
|
1588
|
+
method: "PUT",
|
|
1589
|
+
path,
|
|
1590
|
+
body,
|
|
1591
|
+
token: config?.token,
|
|
1592
|
+
workspaceId: config?.workspaceId,
|
|
1593
|
+
invalidate: config?.invalidate
|
|
1594
|
+
});
|
|
1580
1595
|
}
|
|
1581
1596
|
patch(path, body, config) {
|
|
1582
|
-
return this.request({
|
|
1597
|
+
return this.request({
|
|
1598
|
+
method: "PATCH",
|
|
1599
|
+
path,
|
|
1600
|
+
body,
|
|
1601
|
+
token: config?.token,
|
|
1602
|
+
workspaceId: config?.workspaceId,
|
|
1603
|
+
invalidate: config?.invalidate
|
|
1604
|
+
});
|
|
1583
1605
|
}
|
|
1584
1606
|
delete(path, config) {
|
|
1585
|
-
return this.request({
|
|
1607
|
+
return this.request({
|
|
1608
|
+
method: "DELETE",
|
|
1609
|
+
path,
|
|
1610
|
+
token: config?.token,
|
|
1611
|
+
workspaceId: config?.workspaceId,
|
|
1612
|
+
invalidate: config?.invalidate
|
|
1613
|
+
});
|
|
1586
1614
|
}
|
|
1587
1615
|
};
|
|
1588
1616
|
|
|
1617
|
+
// src/path.ts
|
|
1618
|
+
var normalizeMountPath = (path) => path.replace(/\/+$/, "");
|
|
1619
|
+
|
|
1589
1620
|
// src/modules/config-admin.ts
|
|
1590
1621
|
function envQuery(environment) {
|
|
1591
1622
|
return environment ? `?environment=${encodeURIComponent(environment)}` : "";
|
|
@@ -1598,7 +1629,7 @@ var ConfigAdminClient = class {
|
|
|
1598
1629
|
constructor(opts) {
|
|
1599
1630
|
this.http = new HttpClient(opts.baseUrl);
|
|
1600
1631
|
this.adminToken = opts.adminToken;
|
|
1601
|
-
this.prefix = opts.prefix
|
|
1632
|
+
this.prefix = opts.prefix ? normalizeMountPath(opts.prefix) : void 0;
|
|
1602
1633
|
this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
|
|
1603
1634
|
}
|
|
1604
1635
|
// The path literals stay on the legacy '/admin/...' so the route table and
|
|
@@ -1749,7 +1780,7 @@ var AdminClient = class {
|
|
|
1749
1780
|
constructor(opts) {
|
|
1750
1781
|
this.http = new HttpClient(opts.baseUrl);
|
|
1751
1782
|
this.adminToken = opts.adminToken;
|
|
1752
|
-
this.prefix = (opts.prefix ?? "/_admin")
|
|
1783
|
+
this.prefix = normalizeMountPath(opts.prefix ?? "/_admin");
|
|
1753
1784
|
this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
|
|
1754
1785
|
}
|
|
1755
1786
|
get(suffix) {
|
|
@@ -1808,7 +1839,7 @@ var AuthAdminClient = class {
|
|
|
1808
1839
|
constructor(opts) {
|
|
1809
1840
|
this.http = new HttpClient(opts.baseUrl);
|
|
1810
1841
|
this.adminToken = opts.adminToken;
|
|
1811
|
-
this.prefix = (opts.prefix ?? "/_admin")
|
|
1842
|
+
this.prefix = normalizeMountPath(opts.prefix ?? "/_admin");
|
|
1812
1843
|
this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
|
|
1813
1844
|
}
|
|
1814
1845
|
call(method, suffix) {
|
|
@@ -1859,7 +1890,7 @@ var BillingAdminClient = class {
|
|
|
1859
1890
|
constructor(opts) {
|
|
1860
1891
|
this.http = new HttpClient(opts.baseUrl);
|
|
1861
1892
|
this.adminToken = opts.adminToken;
|
|
1862
|
-
this.prefix = (opts.prefix ?? "/_admin")
|
|
1893
|
+
this.prefix = normalizeMountPath(opts.prefix ?? "/_admin");
|
|
1863
1894
|
this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
|
|
1864
1895
|
}
|
|
1865
1896
|
call(method, suffix, body) {
|
|
@@ -1919,7 +1950,7 @@ var AuditAdminClient = class {
|
|
|
1919
1950
|
constructor(opts) {
|
|
1920
1951
|
this.http = new HttpClient(opts.baseUrl);
|
|
1921
1952
|
this.adminToken = opts.adminToken;
|
|
1922
|
-
this.prefix = (opts.prefix ?? "/_admin")
|
|
1953
|
+
this.prefix = normalizeMountPath(opts.prefix ?? "/_admin");
|
|
1923
1954
|
this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
|
|
1924
1955
|
}
|
|
1925
1956
|
// Every workspace unless one is named. Newest first, keyset-paged.
|
|
@@ -1951,7 +1982,7 @@ var CourierAdminClient = class {
|
|
|
1951
1982
|
constructor(opts) {
|
|
1952
1983
|
this.http = new HttpClient(opts.baseUrl);
|
|
1953
1984
|
this.adminToken = opts.adminToken;
|
|
1954
|
-
this.prefix = opts.prefix
|
|
1985
|
+
this.prefix = opts.prefix ? normalizeMountPath(opts.prefix) : void 0;
|
|
1955
1986
|
this.actorHeaders = opts.actor ? { "X-Actor": opts.actor } : void 0;
|
|
1956
1987
|
}
|
|
1957
1988
|
// The path literals stay on the legacy '/admin/...' so the route table and
|