@cc-monitoring/proxy-core 0.1.9 → 0.2.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.
Files changed (47) hide show
  1. package/dist/docs/404.html +1 -1
  2. package/dist/docs/assets/{app.Dc5qjt2Z.js → app.DD-BoCdK.js} +1 -1
  3. package/dist/docs/assets/chunks/@localSearchIndexroot.B3GYFkD9.js +1 -0
  4. package/dist/docs/assets/chunks/{VPLocalSearchBox.DNn4HwDn.js → VPLocalSearchBox.q7jFlGS4.js} +1 -1
  5. package/dist/docs/assets/chunks/{theme.DCDU4HCI.js → theme.BPPiYYJS.js} +2 -2
  6. package/dist/docs/index.html +2 -2
  7. package/dist/docs/overview.html +2 -2
  8. package/dist/docs/packages-utils.html +2 -2
  9. package/dist/docs/proxy-admin/env-and-build.html +2 -2
  10. package/dist/docs/proxy-admin/index.html +2 -2
  11. package/dist/docs/proxy-admin/layout-and-menu.html +2 -2
  12. package/dist/docs/proxy-admin/pages.html +2 -2
  13. package/dist/docs/proxy-admin/routing-and-auth.html +2 -2
  14. package/dist/docs/proxy-admin/services-and-mock.html +2 -2
  15. package/dist/docs/proxy-cli/api-layer.html +2 -2
  16. package/dist/docs/proxy-cli/app-shell.html +2 -2
  17. package/dist/docs/proxy-cli/components-common.html +2 -2
  18. package/dist/docs/proxy-cli/components-config.html +2 -2
  19. package/dist/docs/proxy-cli/components-requests.html +2 -2
  20. package/dist/docs/proxy-cli/components-stats.html +2 -2
  21. package/dist/docs/proxy-cli/components-status.html +2 -2
  22. package/dist/docs/proxy-cli/data-hooks.html +2 -2
  23. package/dist/docs/proxy-cli/index.html +2 -2
  24. package/dist/docs/proxy-cli/utils-and-i18n.html +2 -2
  25. package/dist/docs/proxy-core/chat-api.html +2 -2
  26. package/dist/docs/proxy-core/cli.html +2 -2
  27. package/dist/docs/proxy-core/config.html +2 -2
  28. package/dist/docs/proxy-core/data-layer.html +2 -2
  29. package/dist/docs/proxy-core/entry.html +2 -2
  30. package/dist/docs/proxy-core/index.html +2 -2
  31. package/dist/docs/proxy-core/pm2.html +2 -2
  32. package/dist/docs/proxy-core/providers.html +2 -2
  33. package/dist/docs/proxy-core/proxy.html +2 -2
  34. package/dist/docs/proxy-core/stats.html +2 -2
  35. package/dist/docs/proxy-core/tool.html +2 -2
  36. package/dist/docs/proxy-core/ui-routes.html +2 -2
  37. package/dist/docs/proxy-core/utilities.html +2 -2
  38. package/dist/docs/quickstart.html +2 -2
  39. package/dist/docs/request-flow.html +2 -2
  40. package/dist/server/__tests__/proxy.test.js +34 -2
  41. package/dist/server/proxy.d.ts +2 -1
  42. package/dist/server/proxy.js +20 -4
  43. package/dist/utils/__tests__/db-migration.test.js +19 -1
  44. package/dist/utils/db.d.ts +1 -0
  45. package/dist/utils/db.js +11 -0
  46. package/package.json +1 -1
  47. package/dist/docs/assets/chunks/@localSearchIndexroot.BBrTCN3M.js +0 -1
@@ -9,9 +9,9 @@
9
9
  <link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
10
10
  <link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/docs/assets/app.Dc5qjt2Z.js"></script>
12
+ <script type="module" src="/docs/assets/app.DD-BoCdK.js"></script>
13
13
  <link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
- <link rel="modulepreload" href="/docs/assets/chunks/theme.DCDU4HCI.js">
14
+ <link rel="modulepreload" href="/docs/assets/chunks/theme.BPPiYYJS.js">
15
15
  <link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
16
16
  <link rel="modulepreload" href="/docs/assets/proxy-cli_data-hooks.md.w9Oe1OD3.lean.js">
17
17
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
@@ -9,9 +9,9 @@
9
9
  <link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
10
10
  <link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/docs/assets/app.Dc5qjt2Z.js"></script>
12
+ <script type="module" src="/docs/assets/app.DD-BoCdK.js"></script>
13
13
  <link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
- <link rel="modulepreload" href="/docs/assets/chunks/theme.DCDU4HCI.js">
14
+ <link rel="modulepreload" href="/docs/assets/chunks/theme.BPPiYYJS.js">
15
15
  <link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
16
16
  <link rel="modulepreload" href="/docs/assets/proxy-cli_index.md.BA6g8QD-.lean.js">
17
17
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
@@ -9,9 +9,9 @@
9
9
  <link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
10
10
  <link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/docs/assets/app.Dc5qjt2Z.js"></script>
12
+ <script type="module" src="/docs/assets/app.DD-BoCdK.js"></script>
13
13
  <link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
- <link rel="modulepreload" href="/docs/assets/chunks/theme.DCDU4HCI.js">
14
+ <link rel="modulepreload" href="/docs/assets/chunks/theme.BPPiYYJS.js">
15
15
  <link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
16
16
  <link rel="modulepreload" href="/docs/assets/proxy-cli_utils-and-i18n.md.Ch_e-g_o.lean.js">
17
17
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
@@ -9,9 +9,9 @@
9
9
  <link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
10
10
  <link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/docs/assets/app.Dc5qjt2Z.js"></script>
12
+ <script type="module" src="/docs/assets/app.DD-BoCdK.js"></script>
13
13
  <link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
- <link rel="modulepreload" href="/docs/assets/chunks/theme.DCDU4HCI.js">
14
+ <link rel="modulepreload" href="/docs/assets/chunks/theme.BPPiYYJS.js">
15
15
  <link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
16
16
  <link rel="modulepreload" href="/docs/assets/proxy-core_chat-api.md.DHihiBxR.lean.js">
17
17
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
@@ -9,9 +9,9 @@
9
9
  <link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
10
10
  <link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/docs/assets/app.Dc5qjt2Z.js"></script>
12
+ <script type="module" src="/docs/assets/app.DD-BoCdK.js"></script>
13
13
  <link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
- <link rel="modulepreload" href="/docs/assets/chunks/theme.DCDU4HCI.js">
14
+ <link rel="modulepreload" href="/docs/assets/chunks/theme.BPPiYYJS.js">
15
15
  <link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
16
16
  <link rel="modulepreload" href="/docs/assets/proxy-core_cli.md.DCFYX4Bd.lean.js">
17
17
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
@@ -9,9 +9,9 @@
9
9
  <link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
10
10
  <link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/docs/assets/app.Dc5qjt2Z.js"></script>
12
+ <script type="module" src="/docs/assets/app.DD-BoCdK.js"></script>
13
13
  <link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
- <link rel="modulepreload" href="/docs/assets/chunks/theme.DCDU4HCI.js">
14
+ <link rel="modulepreload" href="/docs/assets/chunks/theme.BPPiYYJS.js">
15
15
  <link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
16
16
  <link rel="modulepreload" href="/docs/assets/proxy-core_config.md.BXSOyxYE.lean.js">
17
17
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
@@ -9,9 +9,9 @@
9
9
  <link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
10
10
  <link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/docs/assets/app.Dc5qjt2Z.js"></script>
12
+ <script type="module" src="/docs/assets/app.DD-BoCdK.js"></script>
13
13
  <link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
- <link rel="modulepreload" href="/docs/assets/chunks/theme.DCDU4HCI.js">
14
+ <link rel="modulepreload" href="/docs/assets/chunks/theme.BPPiYYJS.js">
15
15
  <link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
16
16
  <link rel="modulepreload" href="/docs/assets/proxy-core_data-layer.md.Cdomb3Gz.lean.js">
17
17
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
@@ -9,9 +9,9 @@
9
9
  <link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
10
10
  <link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/docs/assets/app.Dc5qjt2Z.js"></script>
12
+ <script type="module" src="/docs/assets/app.DD-BoCdK.js"></script>
13
13
  <link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
- <link rel="modulepreload" href="/docs/assets/chunks/theme.DCDU4HCI.js">
14
+ <link rel="modulepreload" href="/docs/assets/chunks/theme.BPPiYYJS.js">
15
15
  <link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
16
16
  <link rel="modulepreload" href="/docs/assets/proxy-core_entry.md.BZmIcCUM.lean.js">
17
17
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
@@ -9,9 +9,9 @@
9
9
  <link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
10
10
  <link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/docs/assets/app.Dc5qjt2Z.js"></script>
12
+ <script type="module" src="/docs/assets/app.DD-BoCdK.js"></script>
13
13
  <link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
- <link rel="modulepreload" href="/docs/assets/chunks/theme.DCDU4HCI.js">
14
+ <link rel="modulepreload" href="/docs/assets/chunks/theme.BPPiYYJS.js">
15
15
  <link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
16
16
  <link rel="modulepreload" href="/docs/assets/proxy-core_index.md.BM6VV5Qe.lean.js">
17
17
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
@@ -9,9 +9,9 @@
9
9
  <link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
10
10
  <link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/docs/assets/app.Dc5qjt2Z.js"></script>
12
+ <script type="module" src="/docs/assets/app.DD-BoCdK.js"></script>
13
13
  <link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
- <link rel="modulepreload" href="/docs/assets/chunks/theme.DCDU4HCI.js">
14
+ <link rel="modulepreload" href="/docs/assets/chunks/theme.BPPiYYJS.js">
15
15
  <link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
16
16
  <link rel="modulepreload" href="/docs/assets/proxy-core_pm2.md.DUhWEtgn.lean.js">
17
17
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
@@ -9,9 +9,9 @@
9
9
  <link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
10
10
  <link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/docs/assets/app.Dc5qjt2Z.js"></script>
12
+ <script type="module" src="/docs/assets/app.DD-BoCdK.js"></script>
13
13
  <link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
- <link rel="modulepreload" href="/docs/assets/chunks/theme.DCDU4HCI.js">
14
+ <link rel="modulepreload" href="/docs/assets/chunks/theme.BPPiYYJS.js">
15
15
  <link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
16
16
  <link rel="modulepreload" href="/docs/assets/proxy-core_providers.md.CbDZ6b_7.lean.js">
17
17
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
@@ -9,9 +9,9 @@
9
9
  <link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
10
10
  <link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/docs/assets/app.Dc5qjt2Z.js"></script>
12
+ <script type="module" src="/docs/assets/app.DD-BoCdK.js"></script>
13
13
  <link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
- <link rel="modulepreload" href="/docs/assets/chunks/theme.DCDU4HCI.js">
14
+ <link rel="modulepreload" href="/docs/assets/chunks/theme.BPPiYYJS.js">
15
15
  <link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
16
16
  <link rel="modulepreload" href="/docs/assets/proxy-core_proxy.md.CzQYmX6X.lean.js">
17
17
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
@@ -9,9 +9,9 @@
9
9
  <link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
10
10
  <link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/docs/assets/app.Dc5qjt2Z.js"></script>
12
+ <script type="module" src="/docs/assets/app.DD-BoCdK.js"></script>
13
13
  <link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
- <link rel="modulepreload" href="/docs/assets/chunks/theme.DCDU4HCI.js">
14
+ <link rel="modulepreload" href="/docs/assets/chunks/theme.BPPiYYJS.js">
15
15
  <link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
16
16
  <link rel="modulepreload" href="/docs/assets/proxy-core_stats.md.BsM6wuK_.lean.js">
17
17
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
@@ -9,9 +9,9 @@
9
9
  <link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
10
10
  <link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/docs/assets/app.Dc5qjt2Z.js"></script>
12
+ <script type="module" src="/docs/assets/app.DD-BoCdK.js"></script>
13
13
  <link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
- <link rel="modulepreload" href="/docs/assets/chunks/theme.DCDU4HCI.js">
14
+ <link rel="modulepreload" href="/docs/assets/chunks/theme.BPPiYYJS.js">
15
15
  <link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
16
16
  <link rel="modulepreload" href="/docs/assets/proxy-core_tool.md.B6Le1nQr.lean.js">
17
17
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
@@ -9,9 +9,9 @@
9
9
  <link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
10
10
  <link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/docs/assets/app.Dc5qjt2Z.js"></script>
12
+ <script type="module" src="/docs/assets/app.DD-BoCdK.js"></script>
13
13
  <link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
- <link rel="modulepreload" href="/docs/assets/chunks/theme.DCDU4HCI.js">
14
+ <link rel="modulepreload" href="/docs/assets/chunks/theme.BPPiYYJS.js">
15
15
  <link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
16
16
  <link rel="modulepreload" href="/docs/assets/proxy-core_ui-routes.md.Dyqkeoiv.lean.js">
17
17
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
@@ -9,9 +9,9 @@
9
9
  <link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
10
10
  <link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/docs/assets/app.Dc5qjt2Z.js"></script>
12
+ <script type="module" src="/docs/assets/app.DD-BoCdK.js"></script>
13
13
  <link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
- <link rel="modulepreload" href="/docs/assets/chunks/theme.DCDU4HCI.js">
14
+ <link rel="modulepreload" href="/docs/assets/chunks/theme.BPPiYYJS.js">
15
15
  <link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
16
16
  <link rel="modulepreload" href="/docs/assets/proxy-core_utilities.md.C18pjnkz.lean.js">
17
17
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
@@ -9,9 +9,9 @@
9
9
  <link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
10
10
  <link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/docs/assets/app.Dc5qjt2Z.js"></script>
12
+ <script type="module" src="/docs/assets/app.DD-BoCdK.js"></script>
13
13
  <link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
- <link rel="modulepreload" href="/docs/assets/chunks/theme.DCDU4HCI.js">
14
+ <link rel="modulepreload" href="/docs/assets/chunks/theme.BPPiYYJS.js">
15
15
  <link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
16
16
  <link rel="modulepreload" href="/docs/assets/quickstart.md.Cy_FmXIY.lean.js">
17
17
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
@@ -9,9 +9,9 @@
9
9
  <link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
10
10
  <link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
11
11
 
12
- <script type="module" src="/docs/assets/app.Dc5qjt2Z.js"></script>
12
+ <script type="module" src="/docs/assets/app.DD-BoCdK.js"></script>
13
13
  <link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
14
- <link rel="modulepreload" href="/docs/assets/chunks/theme.DCDU4HCI.js">
14
+ <link rel="modulepreload" href="/docs/assets/chunks/theme.BPPiYYJS.js">
15
15
  <link rel="modulepreload" href="/docs/assets/chunks/framework.D_Xv2a7c.js">
16
16
  <link rel="modulepreload" href="/docs/assets/request-flow.md.C1fyxdPE.lean.js">
17
17
  <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
@@ -1,4 +1,4 @@
1
- import { getErrorStatusCode, getErrorMessage, resolveProxyTarget } from '../proxy';
1
+ import { getErrorStatusCode, getErrorMessage, resolveProxyTarget, filterForwardHeaders } from '../proxy';
2
2
  import Database from 'better-sqlite3';
3
3
  jest.mock('@utils/db', () => ({
4
4
  __esModule: true,
@@ -66,7 +66,7 @@ describe('resolveProxyTarget', () => {
66
66
  beforeEach(() => {
67
67
  jest.clearAllMocks();
68
68
  db = new Database(':memory:');
69
- db.exec(`CREATE TABLE providers (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, base_url TEXT, api_key TEXT, model TEXT, haiku_model TEXT, sonnet_model TEXT, opus_model TEXT, subagent_model TEXT, provider TEXT NOT NULL, is_default INTEGER NOT NULL DEFAULT 0, is_openai_compatible INTEGER NOT NULL DEFAULT 0, created_at TEXT DEFAULT CURRENT_TIMESTAMP, updated_at TEXT DEFAULT CURRENT_TIMESTAMP)`);
69
+ db.exec(`CREATE TABLE providers (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT UNIQUE NOT NULL, base_url TEXT, api_key TEXT, model TEXT, haiku_model TEXT, sonnet_model TEXT, opus_model TEXT, subagent_model TEXT, provider TEXT NOT NULL, is_default INTEGER NOT NULL DEFAULT 0, is_openai_compatible INTEGER NOT NULL DEFAULT 0, auth_style TEXT NOT NULL DEFAULT 'bearer', created_at TEXT DEFAULT CURRENT_TIMESTAMP, updated_at TEXT DEFAULT CURRENT_TIMESTAMP)`);
70
70
  getDatabase.mockReturnValue(db);
71
71
  });
72
72
  afterEach(() => {
@@ -102,4 +102,36 @@ describe('resolveProxyTarget', () => {
102
102
  const result = resolveProxyTarget(config);
103
103
  expect(result.is_openai_compatible).toBe(false);
104
104
  });
105
+ test('returns auth_style x-api-key when provider sets it', () => {
106
+ db.prepare('INSERT INTO providers (name, base_url, api_key, model, provider, is_default, auth_style) VALUES (?, ?, ?, ?, ?, ?, ?)').run('xkey-provider', 'https://provider.example.com/v1', 'provider-key', 'test-model', 'anthropic', 1, 'x-api-key');
107
+ const result = resolveProxyTarget(config);
108
+ expect(result.auth_style).toBe('x-api-key');
109
+ });
110
+ test('defaults auth_style to bearer when column is null', () => {
111
+ db.prepare('INSERT INTO providers (name, base_url, api_key, model, provider, is_default) VALUES (?, ?, ?, ?, ?, ?)').run('bearer-provider', 'https://provider.example.com/v1', 'provider-key', 'test-model', 'anthropic', 1);
112
+ const result = resolveProxyTarget(config);
113
+ expect(result.auth_style).toBe('bearer');
114
+ });
115
+ });
116
+ describe('filterForwardHeaders with authStyle', () => {
117
+ test('bearer style: inbound x-api-key is normalized to authorization Bearer', () => {
118
+ const out = filterForwardHeaders({ 'x-api-key': 'inbound-key' }, 'proxy-key', 'bearer');
119
+ expect(out['authorization']).toBe('Bearer proxy-key');
120
+ expect(out['x-api-key']).toBeUndefined();
121
+ });
122
+ test('x-api-key style: inbound authorization Bearer is normalized to x-api-key', () => {
123
+ const out = filterForwardHeaders({ 'authorization': 'Bearer inbound-key' }, 'proxy-key', 'x-api-key');
124
+ expect(out['x-api-key']).toBe('proxy-key');
125
+ expect(out['authorization']).toBeUndefined();
126
+ expect(out['Authorization']).toBeUndefined();
127
+ });
128
+ test('authStyle not provided keeps inbound style (x-api-key stays)', () => {
129
+ const out = filterForwardHeaders({ 'x-api-key': 'inbound-key' }, 'proxy-key');
130
+ expect(out['x-api-key']).toBe('proxy-key');
131
+ expect(out['authorization']).toBeUndefined();
132
+ });
133
+ test('proxyApiKey not provided leaves headers untouched', () => {
134
+ const out = filterForwardHeaders({ 'x-api-key': 'inbound-key' });
135
+ expect(out['x-api-key']).toBe('inbound-key');
136
+ });
105
137
  });
@@ -12,6 +12,7 @@ interface ResolvedTarget {
12
12
  sonnet_model?: string;
13
13
  opus_model?: string;
14
14
  is_openai_compatible?: boolean;
15
+ auth_style?: 'bearer' | 'x-api-key';
15
16
  }
16
17
  /**
17
18
  * Resolves the proxy target per request:
@@ -37,7 +38,7 @@ export declare function getProxyModel(originalModel: string | undefined, tierMod
37
38
  model?: string;
38
39
  }): string | undefined;
39
40
  export declare function extractSafeHeaders(headers: Record<string, unknown>): Record<string, string>;
40
- export declare function filterForwardHeaders(headers: Record<string, string>, proxyApiKey?: string): Record<string, string>;
41
+ export declare function filterForwardHeaders(headers: Record<string, string>, proxyApiKey?: string, authStyle?: 'bearer' | 'x-api-key'): Record<string, string>;
41
42
  export declare function getErrorStatusCode(error: ProxyError): number;
42
43
  export declare function getErrorMessage(error: ProxyError): string;
43
44
  export declare function setupProxy(fastify: FastifyInstance, proxyConfig: ProxyConfig): Promise<void>;
@@ -29,6 +29,7 @@ export function resolveProxyTarget(proxyConfig) {
29
29
  let sonnet_model;
30
30
  let opus_model;
31
31
  let is_openai_compatible;
32
+ let auth_style;
32
33
  try {
33
34
  // Parse config target as base
34
35
  const configUrl = new URL(proxyConfig.target);
@@ -41,7 +42,7 @@ export function resolveProxyTarget(proxyConfig) {
41
42
  cachedDbInstance = db;
42
43
  }
43
44
  if (!activeProviderStmt) {
44
- activeProviderStmt = db.prepare('SELECT base_url, api_key, model, haiku_model, sonnet_model, opus_model, is_openai_compatible FROM providers WHERE is_default = 1 LIMIT 1');
45
+ activeProviderStmt = db.prepare('SELECT base_url, api_key, model, haiku_model, sonnet_model, opus_model, is_openai_compatible, auth_style FROM providers WHERE is_default = 1 LIMIT 1');
45
46
  }
46
47
  const active = activeProviderStmt.get();
47
48
  if (active) {
@@ -66,6 +67,8 @@ export function resolveProxyTarget(proxyConfig) {
66
67
  opus_model = active.opus_model;
67
68
  // Populate is_openai_compatible
68
69
  is_openai_compatible = !!active.is_openai_compatible;
70
+ // Populate auth_style (default bearer for null/unknown)
71
+ auth_style = active.auth_style === 'x-api-key' ? 'x-api-key' : 'bearer';
69
72
  }
70
73
  }
71
74
  catch {
@@ -74,7 +77,7 @@ export function resolveProxyTarget(proxyConfig) {
74
77
  baseUrl = configUrl.origin;
75
78
  targetPath = configUrl.pathname.replace(/\/$/, '');
76
79
  }
77
- return { baseUrl, targetPath, apiKey, model, haiku_model, sonnet_model, opus_model, is_openai_compatible };
80
+ return { baseUrl, targetPath, apiKey, model, haiku_model, sonnet_model, opus_model, is_openai_compatible, auth_style };
78
81
  }
79
82
  /**
80
83
  * Selects the proxy model based on the original request model and provider tier config.
@@ -112,7 +115,7 @@ export function extractSafeHeaders(headers) {
112
115
  return safeHeaders;
113
116
  }
114
117
  // Filter headers for forwarding (remove problematic ones, replace API key if configured)
115
- export function filterForwardHeaders(headers, proxyApiKey) {
118
+ export function filterForwardHeaders(headers, proxyApiKey, authStyle) {
116
119
  const filtered = { ...headers };
117
120
  // Remove headers that cause issues
118
121
  delete filtered.host;
@@ -120,6 +123,19 @@ export function filterForwardHeaders(headers, proxyApiKey) {
120
123
  delete filtered['x-req-key'];
121
124
  // Inject or replace API key when proxy key is available
122
125
  if (proxyApiKey) {
126
+ // If provider specifies an auth style, normalize to it (override inbound style)
127
+ if (authStyle) {
128
+ delete filtered['x-api-key'];
129
+ delete filtered['authorization'];
130
+ delete filtered['Authorization'];
131
+ if (authStyle === 'bearer') {
132
+ filtered['authorization'] = `Bearer ${proxyApiKey}`;
133
+ }
134
+ else {
135
+ filtered['x-api-key'] = proxyApiKey;
136
+ }
137
+ return filtered;
138
+ }
123
139
  const hasApiKey = 'x-api-key' in filtered;
124
140
  const hasAuth = 'authorization' in filtered || 'Authorization' in filtered;
125
141
  if (hasApiKey) {
@@ -282,7 +298,7 @@ export async function setupProxy(fastify, proxyConfig) {
282
298
  request.log.info(`model rewrite: ${originalModel} -> ${forwardedModel} (${request.id})`);
283
299
  }
284
300
  // Prepare headers for forwarding (replace API key if configured)
285
- const forwardHeaders = filterForwardHeaders(extractSafeHeaders(request.headers), resolved.apiKey);
301
+ const forwardHeaders = filterForwardHeaders(extractSafeHeaders(request.headers), resolved.apiKey, resolved.auth_style);
286
302
  // Extract proxy fields
287
303
  // API key: extract from authorization (Bearer token) or x-api-key header
288
304
  const authHeader = request.headers['authorization'];
@@ -1,5 +1,5 @@
1
1
  import Database from 'better-sqlite3';
2
- import { applySchemaV2, applySchemaV3 } from '../db.js';
2
+ import { applySchemaV2, applySchemaV3, applySchemaV9 } from '../db.js';
3
3
  describe('Schema Migration V2', () => {
4
4
  let db;
5
5
  beforeEach(() => {
@@ -81,4 +81,22 @@ describe('Schema Migration V2', () => {
81
81
  const isDefaultCols = columns.filter((c) => c.name === 'is_default');
82
82
  expect(isDefaultCols.length).toBe(1);
83
83
  });
84
+ test('applySchemaV9 adds auth_style column with default bearer', () => {
85
+ applySchemaV2(db);
86
+ applySchemaV9(db);
87
+ const columns = db.prepare("PRAGMA table_info(providers)").all();
88
+ expect(columns.map(c => c.name)).toContain('auth_style');
89
+ // Existing rows get the default 'bearer'
90
+ db.prepare("INSERT INTO providers (name, base_url, api_key, model, provider) VALUES (?, ?, ?, ?, ?)").run('p1', 'https://api.test.com', 'key1', 'claude-3', 'anthropic');
91
+ const row = db.prepare("SELECT auth_style FROM providers WHERE name = 'p1'").get();
92
+ expect(row.auth_style).toBe('bearer');
93
+ });
94
+ test('applySchemaV9 is idempotent', () => {
95
+ applySchemaV2(db);
96
+ applySchemaV9(db);
97
+ expect(() => applySchemaV9(db)).not.toThrow();
98
+ const columns = db.prepare("PRAGMA table_info(providers)").all();
99
+ const authStyleCols = columns.filter(c => c.name === 'auth_style');
100
+ expect(authStyleCols.length).toBe(1);
101
+ });
84
102
  });
@@ -8,5 +8,6 @@ export declare function applySchemaV5(db: Database.Database): void;
8
8
  export declare function applySchemaV6(db: Database.Database): void;
9
9
  export declare function applySchemaV7(db: Database.Database): void;
10
10
  export declare function applySchemaV8(db: Database.Database): void;
11
+ export declare function applySchemaV9(db: Database.Database): void;
11
12
  export declare function closeDatabase(): void;
12
13
  export declare function getDatabase(): Database.Database;
package/dist/utils/db.js CHANGED
@@ -64,6 +64,10 @@ export function initDatabase() {
64
64
  applySchemaV8(db);
65
65
  db.prepare('INSERT OR REPLACE INTO schema_version (version) VALUES (8)').run();
66
66
  }
67
+ if (currentVersion < 9) {
68
+ applySchemaV9(db);
69
+ db.prepare('INSERT OR REPLACE INTO schema_version (version) VALUES (9)').run();
70
+ }
67
71
  return db;
68
72
  }
69
73
  export function applySchemaV2(db) {
@@ -251,6 +255,13 @@ export function applySchemaV8(db) {
251
255
  ON response_events(request_id, session_id, event_index)
252
256
  `);
253
257
  }
258
+ export function applySchemaV9(db) {
259
+ // Add auth_style column for per-provider auth header normalization
260
+ const columns = db.prepare("PRAGMA table_info(providers)").all();
261
+ if (!columns.some(c => c.name === 'auth_style')) {
262
+ db.exec("ALTER TABLE providers ADD COLUMN auth_style TEXT NOT NULL DEFAULT 'bearer'");
263
+ }
264
+ }
254
265
  export function closeDatabase() {
255
266
  if (db) {
256
267
  db.close();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cc-monitoring/proxy-core",
3
- "version": "0.1.9",
3
+ "version": "0.2.0",
4
4
  "description": "Claude Code 代理工具 + Token 消耗监控面板",
5
5
  "keywords": [
6
6
  "claude-code-proxy",