unforgit 0.7.8 → 0.8.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.
|
@@ -1748,6 +1748,9 @@ var INITIAL_BACKOFF_MS = 1e3;
|
|
|
1748
1748
|
function isTransientError(status) {
|
|
1749
1749
|
return status >= 500 || status === 429;
|
|
1750
1750
|
}
|
|
1751
|
+
function pathSegment(value) {
|
|
1752
|
+
return encodeURIComponent(value);
|
|
1753
|
+
}
|
|
1751
1754
|
var RemoteClient = class {
|
|
1752
1755
|
constructor(baseUrl, apiKey, options) {
|
|
1753
1756
|
this.baseUrl = baseUrl;
|
|
@@ -1840,7 +1843,7 @@ var RemoteClient = class {
|
|
|
1840
1843
|
}
|
|
1841
1844
|
async deprecate(id, reason) {
|
|
1842
1845
|
const res = await this.fetchWithRetry(
|
|
1843
|
-
`${this.baseUrl}/v1/memory/${id}/deprecate`,
|
|
1846
|
+
`${this.baseUrl}/v1/memory/${pathSegment(id)}/deprecate`,
|
|
1844
1847
|
{ method: "POST", headers: this.getHeaders(), body: JSON.stringify({ reason }) },
|
|
1845
1848
|
"deprecate"
|
|
1846
1849
|
);
|
|
@@ -1851,7 +1854,7 @@ var RemoteClient = class {
|
|
|
1851
1854
|
}
|
|
1852
1855
|
async supersede(oldId, newId) {
|
|
1853
1856
|
const res = await this.fetchWithRetry(
|
|
1854
|
-
`${this.baseUrl}/v1/memory/${oldId}/supersede`,
|
|
1857
|
+
`${this.baseUrl}/v1/memory/${pathSegment(oldId)}/supersede`,
|
|
1855
1858
|
{ method: "POST", headers: this.getHeaders(), body: JSON.stringify({ newId }) },
|
|
1856
1859
|
"supersede"
|
|
1857
1860
|
);
|
|
@@ -1862,7 +1865,7 @@ var RemoteClient = class {
|
|
|
1862
1865
|
}
|
|
1863
1866
|
async link(sourceId, targetId, linkType, metadata) {
|
|
1864
1867
|
const res = await this.fetchWithRetry(
|
|
1865
|
-
`${this.baseUrl}/v1/memory/${sourceId}/link`,
|
|
1868
|
+
`${this.baseUrl}/v1/memory/${pathSegment(sourceId)}/link`,
|
|
1866
1869
|
{
|
|
1867
1870
|
method: "POST",
|
|
1868
1871
|
headers: this.getHeaders(),
|
|
@@ -1877,7 +1880,7 @@ var RemoteClient = class {
|
|
|
1877
1880
|
}
|
|
1878
1881
|
async unlink(sourceId, targetId, linkType) {
|
|
1879
1882
|
const res = await this.fetchWithRetry(
|
|
1880
|
-
`${this.baseUrl}/v1/memory/${sourceId}/link`,
|
|
1883
|
+
`${this.baseUrl}/v1/memory/${pathSegment(sourceId)}/link`,
|
|
1881
1884
|
{
|
|
1882
1885
|
method: "DELETE",
|
|
1883
1886
|
headers: this.getHeaders(),
|
|
@@ -1894,7 +1897,7 @@ var RemoteClient = class {
|
|
|
1894
1897
|
const params = new URLSearchParams();
|
|
1895
1898
|
if (linkType) params.set("linkType", linkType);
|
|
1896
1899
|
const qs = params.toString();
|
|
1897
|
-
const url = `${this.baseUrl}/v1/memory/${memoryId}/links${qs ? `?${qs}` : ""}`;
|
|
1900
|
+
const url = `${this.baseUrl}/v1/memory/${pathSegment(memoryId)}/links${qs ? `?${qs}` : ""}`;
|
|
1898
1901
|
const res = await this.fetchWithRetry(url, { headers: this.getHeaders() }, "getLinks");
|
|
1899
1902
|
if (!res.ok) {
|
|
1900
1903
|
this.handleError(res, "getLinks", await res.text());
|
|
@@ -1914,7 +1917,7 @@ var RemoteClient = class {
|
|
|
1914
1917
|
}
|
|
1915
1918
|
async delete(id, deletedBy, hardDelete) {
|
|
1916
1919
|
const res = await this.fetchWithRetry(
|
|
1917
|
-
`${this.baseUrl}/v1/memory/${id}`,
|
|
1920
|
+
`${this.baseUrl}/v1/memory/${pathSegment(id)}`,
|
|
1918
1921
|
{
|
|
1919
1922
|
method: "DELETE",
|
|
1920
1923
|
headers: this.getHeaders(),
|
|
@@ -1929,7 +1932,7 @@ var RemoteClient = class {
|
|
|
1929
1932
|
}
|
|
1930
1933
|
async restore(id) {
|
|
1931
1934
|
const res = await this.fetchWithRetry(
|
|
1932
|
-
`${this.baseUrl}/v1/memory/${id}/restore`,
|
|
1935
|
+
`${this.baseUrl}/v1/memory/${pathSegment(id)}/restore`,
|
|
1933
1936
|
{ method: "POST", headers: this.getHeaders() },
|
|
1934
1937
|
"restore"
|
|
1935
1938
|
);
|
|
@@ -1996,7 +1999,7 @@ var RemoteClient = class {
|
|
|
1996
1999
|
}
|
|
1997
2000
|
async revokeApiKey(id) {
|
|
1998
2001
|
const res = await this.fetchWithRetry(
|
|
1999
|
-
`${this.baseUrl}/v1/api-keys/${id}`,
|
|
2002
|
+
`${this.baseUrl}/v1/api-keys/${pathSegment(id)}`,
|
|
2000
2003
|
{ method: "DELETE", headers: this.getHeaders() },
|
|
2001
2004
|
"revokeApiKey"
|
|
2002
2005
|
);
|
|
@@ -3794,4 +3797,4 @@ export {
|
|
|
3794
3797
|
RemoteClient,
|
|
3795
3798
|
LocalStore
|
|
3796
3799
|
};
|
|
3797
|
-
//# sourceMappingURL=chunk-
|
|
3800
|
+
//# sourceMappingURL=chunk-EMM6CWGS.js.map
|