unforgit 0.7.7 → 0.8.0

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.
@@ -199,6 +199,8 @@ var SENSITIVE_PATTERNS = [
199
199
  /token/i,
200
200
  /credential/i,
201
201
  /private[_-]?key/i,
202
+ /authorization\s*[:=]/i,
203
+ /bearer\s+[A-Za-z0-9._~+/=-]+/i,
202
204
  /-----BEGIN/
203
205
  ];
204
206
  var RULE_LIKE_TAGS = /* @__PURE__ */ new Set([
@@ -1746,6 +1748,9 @@ var INITIAL_BACKOFF_MS = 1e3;
1746
1748
  function isTransientError(status) {
1747
1749
  return status >= 500 || status === 429;
1748
1750
  }
1751
+ function pathSegment(value) {
1752
+ return encodeURIComponent(value);
1753
+ }
1749
1754
  var RemoteClient = class {
1750
1755
  constructor(baseUrl, apiKey, options) {
1751
1756
  this.baseUrl = baseUrl;
@@ -1838,7 +1843,7 @@ var RemoteClient = class {
1838
1843
  }
1839
1844
  async deprecate(id, reason) {
1840
1845
  const res = await this.fetchWithRetry(
1841
- `${this.baseUrl}/v1/memory/${id}/deprecate`,
1846
+ `${this.baseUrl}/v1/memory/${pathSegment(id)}/deprecate`,
1842
1847
  { method: "POST", headers: this.getHeaders(), body: JSON.stringify({ reason }) },
1843
1848
  "deprecate"
1844
1849
  );
@@ -1849,7 +1854,7 @@ var RemoteClient = class {
1849
1854
  }
1850
1855
  async supersede(oldId, newId) {
1851
1856
  const res = await this.fetchWithRetry(
1852
- `${this.baseUrl}/v1/memory/${oldId}/supersede`,
1857
+ `${this.baseUrl}/v1/memory/${pathSegment(oldId)}/supersede`,
1853
1858
  { method: "POST", headers: this.getHeaders(), body: JSON.stringify({ newId }) },
1854
1859
  "supersede"
1855
1860
  );
@@ -1860,7 +1865,7 @@ var RemoteClient = class {
1860
1865
  }
1861
1866
  async link(sourceId, targetId, linkType, metadata) {
1862
1867
  const res = await this.fetchWithRetry(
1863
- `${this.baseUrl}/v1/memory/${sourceId}/link`,
1868
+ `${this.baseUrl}/v1/memory/${pathSegment(sourceId)}/link`,
1864
1869
  {
1865
1870
  method: "POST",
1866
1871
  headers: this.getHeaders(),
@@ -1875,7 +1880,7 @@ var RemoteClient = class {
1875
1880
  }
1876
1881
  async unlink(sourceId, targetId, linkType) {
1877
1882
  const res = await this.fetchWithRetry(
1878
- `${this.baseUrl}/v1/memory/${sourceId}/link`,
1883
+ `${this.baseUrl}/v1/memory/${pathSegment(sourceId)}/link`,
1879
1884
  {
1880
1885
  method: "DELETE",
1881
1886
  headers: this.getHeaders(),
@@ -1892,7 +1897,7 @@ var RemoteClient = class {
1892
1897
  const params = new URLSearchParams();
1893
1898
  if (linkType) params.set("linkType", linkType);
1894
1899
  const qs = params.toString();
1895
- const url = `${this.baseUrl}/v1/memory/${memoryId}/links${qs ? `?${qs}` : ""}`;
1900
+ const url = `${this.baseUrl}/v1/memory/${pathSegment(memoryId)}/links${qs ? `?${qs}` : ""}`;
1896
1901
  const res = await this.fetchWithRetry(url, { headers: this.getHeaders() }, "getLinks");
1897
1902
  if (!res.ok) {
1898
1903
  this.handleError(res, "getLinks", await res.text());
@@ -1912,7 +1917,7 @@ var RemoteClient = class {
1912
1917
  }
1913
1918
  async delete(id, deletedBy, hardDelete) {
1914
1919
  const res = await this.fetchWithRetry(
1915
- `${this.baseUrl}/v1/memory/${id}`,
1920
+ `${this.baseUrl}/v1/memory/${pathSegment(id)}`,
1916
1921
  {
1917
1922
  method: "DELETE",
1918
1923
  headers: this.getHeaders(),
@@ -1927,7 +1932,7 @@ var RemoteClient = class {
1927
1932
  }
1928
1933
  async restore(id) {
1929
1934
  const res = await this.fetchWithRetry(
1930
- `${this.baseUrl}/v1/memory/${id}/restore`,
1935
+ `${this.baseUrl}/v1/memory/${pathSegment(id)}/restore`,
1931
1936
  { method: "POST", headers: this.getHeaders() },
1932
1937
  "restore"
1933
1938
  );
@@ -1994,7 +1999,7 @@ var RemoteClient = class {
1994
1999
  }
1995
2000
  async revokeApiKey(id) {
1996
2001
  const res = await this.fetchWithRetry(
1997
- `${this.baseUrl}/v1/api-keys/${id}`,
2002
+ `${this.baseUrl}/v1/api-keys/${pathSegment(id)}`,
1998
2003
  { method: "DELETE", headers: this.getHeaders() },
1999
2004
  "revokeApiKey"
2000
2005
  );
@@ -3792,4 +3797,4 @@ export {
3792
3797
  RemoteClient,
3793
3798
  LocalStore
3794
3799
  };
3795
- //# sourceMappingURL=chunk-TGDR7Y7T.js.map
3800
+ //# sourceMappingURL=chunk-EMM6CWGS.js.map