@l10nmonster/server 3.0.0-alpha.8 → 3.1.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 (36) hide show
  1. package/.releaserc.json +1 -1
  2. package/CHANGELOG.md +38 -0
  3. package/CLAUDE.md +808 -0
  4. package/index.js +121 -17
  5. package/package.json +9 -8
  6. package/routes/dispatcher.js +116 -0
  7. package/routes/info.js +25 -0
  8. package/routes/providers.js +17 -0
  9. package/routes/sources.js +49 -7
  10. package/routes/status.js +27 -27
  11. package/routes/tm.js +156 -6
  12. package/ui/dist/assets/Cart-CiY5V__G.js +1 -0
  13. package/ui/dist/assets/Job-D-5ikxga.js +1 -0
  14. package/ui/dist/assets/Providers-BZVmclS1.js +1 -0
  15. package/ui/dist/assets/Sources-BwZ8Vub0.js +1 -0
  16. package/ui/dist/assets/SourcesDetail-CXgslRDb.js +1 -0
  17. package/ui/dist/assets/SourcesResource-Br3Bspz2.js +1 -0
  18. package/ui/dist/assets/Status-Bx0Ui7d2.js +1 -0
  19. package/ui/dist/assets/StatusDetail-BzJ2TIme.js +1 -0
  20. package/ui/dist/assets/TMByProvider-B2MrTxO0.js +1 -0
  21. package/ui/dist/assets/TMDetail-BxbKr57p.js +1 -0
  22. package/ui/dist/assets/TMToc-CQ1zhmPh.js +1 -0
  23. package/ui/dist/assets/Welcome-Tp-UfiIW.js +1 -0
  24. package/ui/dist/assets/index-543A5WcJ.js +1 -0
  25. package/ui/dist/assets/index-CPrLFF-N.js +2 -0
  26. package/ui/dist/assets/vendor-BVgSJH5C.js +19 -0
  27. package/ui/dist/index.html +3 -1
  28. package/ui/dist/assets/Sources-D0R-Sgwf.js +0 -1
  29. package/ui/dist/assets/Status-XBRD-MuK.js +0 -1
  30. package/ui/dist/assets/TM-DZ2x6--n.js +0 -1
  31. package/ui/dist/assets/Welcome-p4gi31Lo.js +0 -1
  32. package/ui/dist/assets/api-DXOYnFyU.js +0 -1
  33. package/ui/dist/assets/badge-CveKztw5.js +0 -1
  34. package/ui/dist/assets/grid-DetiGbYY.js +0 -1
  35. package/ui/dist/assets/index-Ce8PP-0Z.js +0 -76
  36. package/ui/dist/assets/v-stack-CQ6LIfdw.js +0 -1
@@ -11,7 +11,9 @@
11
11
  />
12
12
  <link rel="manifest" href="/manifest.json" />
13
13
  <title>L10n Monster</title>
14
- <script type="module" crossorigin src="/assets/index-Ce8PP-0Z.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-CPrLFF-N.js"></script>
15
+ <link rel="modulepreload" crossorigin href="/assets/vendor-BVgSJH5C.js">
16
+ <link rel="modulepreload" crossorigin href="/assets/index-543A5WcJ.js">
15
17
  <link rel="stylesheet" crossorigin href="/assets/index-CIfVvUo9.css">
16
18
  </head>
17
19
  <body>
@@ -1 +0,0 @@
1
- import{r as i,j as e,C as d,S as b,B as s,T as t,F as y}from"./index-Ce8PP-0Z.js";import{A as z,f as C}from"./api-DXOYnFyU.js";import{B as h}from"./badge-CveKztw5.js";import{G as w}from"./grid-DetiGbYY.js";import{V as x}from"./v-stack-CQ6LIfdw.js";const E=()=>{const[f,j]=i.useState({}),[m,u]=i.useState(!0),[g,p]=i.useState(null);i.useEffect(()=>{(async()=>{try{const n=await C("/api/activeContentStats");j(n)}catch(n){console.error("Error fetching content stats:",n),p(n instanceof Error?n.message:"Failed to fetch content statistics")}finally{u(!1)}})()},[]);const S=a=>{const n=new Date,o=new Date(a),c=n-o,r=Math.floor(c/1e3),l=new Intl.RelativeTimeFormat("en",{numeric:"auto",style:"short"});return r<60?l.format(-r,"second"):r<3600?l.format(-Math.floor(r/60),"minute"):r<86400?l.format(-Math.floor(r/3600),"hour"):r<2592e3?l.format(-Math.floor(r/86400),"day"):r<31536e3?l.format(-Math.floor(r/2592e3),"month"):l.format(-Math.floor(r/31536e3),"year")};return m?e.jsx(d,{display:"flex",justifyContent:"center",mt:10,children:e.jsx(b,{size:"xl"})}):g?e.jsx(d,{mt:5,children:e.jsx(z,{status:"error",children:e.jsxs(s,{children:[e.jsx(t,{fontWeight:"bold",children:"Error"}),e.jsx(t,{children:g})]})})}):e.jsx(d,{maxWidth:"6xl",py:6,children:e.jsxs(x,{gap:6,align:"stretch",children:[e.jsxs(s,{children:[e.jsx(t,{fontSize:"2xl",fontWeight:"bold",mb:2,children:"Active Content Sources"}),e.jsx(t,{color:"gray.600",children:"Overview of content sources across all channels"})]}),Object.keys(f).length===0?e.jsx(s,{p:6,borderWidth:"1px",borderRadius:"md",bg:"white",textAlign:"center",children:e.jsx(t,{color:"gray.500",children:"No active content found."})}):e.jsx(x,{gap:6,align:"stretch",children:Object.entries(f).map(([a,n])=>e.jsx(s,{p:6,borderWidth:"1px",borderRadius:"lg",bg:"white",shadow:"sm",children:e.jsxs(x,{gap:4,align:"stretch",children:[e.jsx(s,{children:e.jsx(t,{fontSize:"xl",fontWeight:"bold",color:"blue.600",mb:2,children:a})}),n.map((o,c)=>e.jsx(s,{p:3,borderWidth:"1px",borderRadius:"md",borderColor:"gray.200",bg:"gray.50",children:e.jsxs(w,{templateColumns:"1fr 80px 1fr 80px 80px 100px",gap:4,alignItems:"center",children:[e.jsxs(s,{children:[e.jsx(t,{fontSize:"xs",color:"gray.500",mb:1,children:"Project"}),e.jsx(t,{fontSize:"sm",fontWeight:"semibold",children:o.prj||"Default"})]}),e.jsxs(s,{children:[e.jsx(t,{fontSize:"xs",color:"gray.500",mb:1,children:"Source"}),e.jsx(h,{colorPalette:"blue",size:"sm",children:o.sourceLang})]}),e.jsxs(s,{children:[e.jsxs(t,{fontSize:"xs",color:"gray.500",mb:1,children:["Targets (",o.targetLangs.length,")"]}),e.jsxs(y,{wrap:"wrap",gap:1,children:[o.targetLangs.slice(0,3).map(r=>e.jsx(h,{colorPalette:"green",size:"sm",children:r},r)),o.targetLangs.length>3&&e.jsxs(h,{colorPalette:"gray",size:"sm",children:["+",o.targetLangs.length-3]})]})]}),e.jsxs(s,{textAlign:"center",children:[e.jsx(t,{fontSize:"xs",color:"gray.500",mb:1,children:"Resources"}),e.jsx(t,{fontSize:"sm",fontWeight:"bold",color:"orange.600",children:o.resCount.toLocaleString()})]}),e.jsxs(s,{textAlign:"center",children:[e.jsx(t,{fontSize:"xs",color:"gray.500",mb:1,children:"Segments"}),e.jsx(t,{fontSize:"sm",fontWeight:"bold",color:"purple.600",children:o.segmentCount.toLocaleString()})]}),e.jsxs(s,{textAlign:"center",children:[e.jsx(t,{fontSize:"xs",color:"gray.500",mb:1,children:"Modified"}),e.jsx(t,{fontSize:"xs",color:"gray.600",children:S(o.lastModified)})]})]})},c))]})},a))})]})})};export{E as default};
@@ -1 +0,0 @@
1
- import{c as z,j as t,T as e,B as n,F as W,r as f,C as y,S as v}from"./index-Ce8PP-0Z.js";import{A as $,f as E}from"./api-DXOYnFyU.js";import{G as O}from"./grid-DetiGbYY.js";const{withProvider:R,withContext:d}=z({key:"card"}),D=R("div","root"),L=d("div","body");d("div","header");d("div","footer");d("h3","title");d("p","description");const T=({project:h})=>{const{sourceLang:m,targetLang:x,resCount:g,segmentCount:o,translationStatus:j}=h,s={untranslated:0,"in flight":0,translated:0,"low quality":0,words:0,chars:0};for(const{minQ:i,q:a,seg:l,words:p,chars:u}of j){const c=a===null?"untranslated":a===0?"in flight":a>=i?"translated":"low quality";s[c]+=l,s.words+=p,s.chars+=u}const r=Math.round(s.translated/o*100);return t.jsx(D,{variant:"outline",children:t.jsxs(L,{children:[t.jsxs(e,{fontSize:"lg",fontWeight:"semibold",mb:2,children:[m," → ",x]}),t.jsx(n,{mb:3,children:t.jsxs(W,{align:"center",gap:2,mb:1,children:[t.jsx(n,{flex:"1",bg:"gray.200",rounded:"full",height:"6px",position:"relative",children:t.jsx(n,{bg:"blue.500",height:"100%",rounded:"full",width:`${r}%`,transition:"width 0.3s ease"})}),t.jsxs(e,{fontSize:"sm",color:"gray.600",minW:"45px",children:[r,"%"]})]})}),t.jsxs(e,{fontSize:"sm",children:["Resources: ",g.toLocaleString()]}),t.jsxs(e,{fontSize:"sm",children:["Segments: ",o.toLocaleString()]}),t.jsxs(e,{fontSize:"sm",children:["Words: ",s.words.toLocaleString()]}),s.untranslated>0&&t.jsxs(e,{fontSize:"sm",color:"orange.600",children:["Untranslated segments: ",s.untranslated.toLocaleString()]})]})})},P=()=>{const[h,m]=f.useState({}),[x,g]=f.useState(!0),[o,j]=f.useState(null);return f.useEffect(()=>{(async()=>{try{const r=await E("/api/status");m(r)}catch(r){console.error("Error fetching status:",r),j(r instanceof Error?r.message:"Failed to fetch status data")}finally{g(!1)}})()},[]),x?t.jsx(y,{display:"flex",justifyContent:"center",mt:5,children:t.jsx(v,{size:"xl"})}):o?t.jsx(y,{mt:5,children:t.jsx($,{status:"error",children:t.jsxs(n,{children:[t.jsx(e,{fontWeight:"bold",children:"Error"}),t.jsx(e,{children:o})]})})}):t.jsxs(y,{maxWidth:"6xl",py:6,children:[Object.entries(h).map(([s,r])=>Object.entries(r).map(([i,a])=>Object.entries(a).map(([l,p])=>t.jsxs(n,{mb:6,p:3,borderWidth:"1px",borderRadius:"md",bg:"white",borderColor:"gray.200",children:[t.jsxs(n,{display:"flex",alignItems:"center",gap:3,flexWrap:"wrap",children:[t.jsxs(n,{children:[t.jsx(e,{fontSize:"sm",color:"gray.600",mb:1,children:"Channel"}),t.jsx(e,{fontSize:"xl",fontWeight:"semibold",color:"blue.600",children:s})]}),t.jsx(n,{height:"40px",width:"1px",bg:"gray.300"}),t.jsxs(n,{children:[t.jsx(e,{fontSize:"sm",color:"gray.600",mb:1,children:"Project"}),t.jsx(e,{fontSize:"xl",fontWeight:"semibold",color:"green.600",children:i})]})]}),t.jsx(O,{templateColumns:"repeat(auto-fit, minmax(300px, 1fr))",gap:4,mt:4,children:Object.entries(p).map(([u,c])=>{const C=c.reduce((b,S)=>b+S.res,0),w=c.reduce((b,S)=>b+S.seg,0);return t.jsx(T,{project:{sourceLang:l,targetLang:u,resCount:C,segmentCount:w,translationStatus:c}},`${l}-${u}-${i}-${s}`)})})]},`${l}-${s}-${i}`)))),Object.keys(h).length===0&&!x&&t.jsx(e,{mt:4,color:"gray.600",children:"No active content found."})]})};export{P as default};
@@ -1 +0,0 @@
1
- import{r as i,j as e,C as a,S,B as r,T as t,F as y}from"./index-Ce8PP-0Z.js";import{A as z,f as W}from"./api-DXOYnFyU.js";import{B as c}from"./badge-CveKztw5.js";import{G as T}from"./grid-DetiGbYY.js";import{V as l}from"./v-stack-CQ6LIfdw.js";const B=()=>{const[d,g]=i.useState({}),[j,m]=i.useState(!0),[x,f]=i.useState(null);i.useEffect(()=>{(async()=>{try{const s=await W("/api/tm/stats");g(s)}catch(s){console.error("Error fetching TM stats:",s),f(s instanceof Error?s.message:"Failed to fetch translation memory statistics")}finally{m(!1)}})()},[]);const u=o=>{switch(o){case"done":return"green";case"pending":return"yellow";case"error":return"red";default:return"gray"}};return j?e.jsx(a,{display:"flex",justifyContent:"center",mt:10,children:e.jsx(S,{size:"xl"})}):x?e.jsx(a,{mt:5,children:e.jsx(z,{status:"error",children:e.jsxs(r,{children:[e.jsx(t,{fontWeight:"bold",children:"Error"}),e.jsx(t,{children:x})]})})}):e.jsx(a,{maxWidth:"6xl",py:6,children:e.jsxs(l,{gap:6,align:"stretch",children:[e.jsxs(r,{children:[e.jsx(t,{fontSize:"2xl",fontWeight:"bold",mb:2,children:"Translation Memory Statistics"}),e.jsx(t,{color:"gray.600",children:"Overview of jobs by translation provider for each language pair"})]}),Object.keys(d).length===0?e.jsx(r,{p:6,borderWidth:"1px",borderRadius:"md",bg:"white",textAlign:"center",children:e.jsx(t,{color:"gray.500",children:"No translation memory data found."})}):e.jsx(l,{gap:6,align:"stretch",children:Object.entries(d).flatMap(([o,s])=>Object.entries(s).map(([h,p])=>e.jsx(r,{p:6,borderWidth:"1px",borderRadius:"lg",bg:"white",shadow:"sm",children:e.jsxs(l,{gap:4,align:"stretch",children:[e.jsx(r,{children:e.jsxs(y,{align:"center",gap:3,mb:2,children:[e.jsx(c,{colorPalette:"blue",size:"sm",children:o}),e.jsx(t,{color:"gray.500",fontSize:"lg",children:"→"}),e.jsx(c,{colorPalette:"green",size:"sm",children:h})]})}),e.jsx(l,{gap:3,align:"stretch",children:p.map((n,b)=>e.jsx(r,{p:3,borderWidth:"1px",borderRadius:"md",borderColor:"gray.200",bg:"gray.50",children:e.jsxs(T,{templateColumns:"2fr 80px 80px 80px 80px",gap:4,alignItems:"center",children:[e.jsxs(r,{children:[e.jsx(t,{fontSize:"xs",color:"gray.500",mb:1,children:"Provider"}),e.jsx(t,{fontSize:"sm",fontWeight:"semibold",children:n.translationProvider})]}),e.jsxs(r,{textAlign:"center",children:[e.jsx(t,{fontSize:"xs",color:"gray.500",mb:1,children:"Status"}),e.jsx(c,{colorPalette:u(n.status),size:"sm",children:n.status})]}),e.jsxs(r,{textAlign:"center",children:[e.jsx(t,{fontSize:"xs",color:"gray.500",mb:1,children:"TUs"}),e.jsx(t,{fontSize:"sm",fontWeight:"bold",color:"purple.600",children:n.tuCount.toLocaleString()})]}),e.jsxs(r,{textAlign:"center",children:[e.jsx(t,{fontSize:"xs",color:"gray.500",mb:1,children:"Unique"}),e.jsx(t,{fontSize:"sm",fontWeight:"bold",color:"orange.600",children:n.distinctGuids.toLocaleString()})]}),e.jsxs(r,{textAlign:"center",children:[e.jsx(t,{fontSize:"xs",color:"gray.500",mb:1,children:"Jobs"}),e.jsx(t,{fontSize:"sm",fontWeight:"bold",color:"teal.600",children:n.jobCount.toLocaleString()})]})]})},b))})]})},`${o}-${h}`)))})]})})};export{B as default};
@@ -1 +0,0 @@
1
- import{r as s,j as e,C as n,S as g,B as t,T as r,F as l}from"./index-Ce8PP-0Z.js";import{A as p,f as j}from"./api-DXOYnFyU.js";import{V as c}from"./v-stack-CQ6LIfdw.js";const S=()=>{const[o,d]=s.useState(null),[x,h]=s.useState(!0),[a,f]=s.useState(null);return s.useEffect(()=>{(async()=>{try{const i=await j("/api/info");d(i)}catch(i){console.error("Error fetching info:",i),f(i instanceof Error?i.message:"Failed to fetch info data")}finally{h(!1)}})()},[]),x?e.jsx(n,{display:"flex",justifyContent:"center",mt:20,children:e.jsx(g,{size:"xl"})}):a?e.jsx(n,{mt:10,children:e.jsx(p,{status:"error",children:e.jsxs(t,{children:[e.jsx(r,{fontWeight:"bold",children:"Error"}),e.jsx(r,{children:a})]})})}):e.jsx(n,{maxWidth:"2xl",py:20,children:e.jsx(c,{gap:8,align:"center",children:o&&e.jsx(t,{p:8,borderWidth:"1px",borderRadius:"xl",bg:"white",shadow:"lg",width:"500px",height:"300px",position:"relative",background:"linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%)",borderColor:"gray.300",children:e.jsxs(l,{height:"100%",direction:"column",justify:"space-between",children:[e.jsxs(l,{align:"center",gap:4,children:[e.jsx("img",{src:"/logo.svg",alt:"L10n Monster",width:"60",height:"60"}),e.jsx(t,{children:e.jsx(r,{fontSize:"xl",fontWeight:"bold",color:"gray.800",lineHeight:"1.2",children:o.description})})]}),e.jsxs(c,{gap:3,align:"stretch",mt:4,children:[e.jsxs(t,{children:[e.jsx(r,{fontSize:"xs",color:"gray.500",textTransform:"uppercase",letterSpacing:"wide",mb:1,children:"Version"}),e.jsx(r,{fontSize:"lg",fontWeight:"semibold",color:"blue.600",children:o.version})]}),e.jsxs(t,{children:[e.jsx(r,{fontSize:"xs",color:"gray.500",textTransform:"uppercase",letterSpacing:"wide",mb:1,children:"Project Directory"}),e.jsx(r,{fontSize:"xs",fontFamily:"mono",color:"gray.600",wordBreak:"break-all",lineHeight:"1.3",children:o.baseDir})]})]}),e.jsx(t,{position:"absolute",top:"-10px",right:"-10px",width:"80px",height:"80px",bg:"blue.50",borderRadius:"full",opacity:"0.5",zIndex:"-1"})]})})})})};export{S as default};
@@ -1 +0,0 @@
1
- import{j as e,b as n,c as p,r as a,e as x}from"./index-Ce8PP-0Z.js";const f=t=>e.jsx(n.svg,{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",...t,children:e.jsx("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11.0026 16L6.75999 11.7574L8.17421 10.3431L11.0026 13.1716L16.6595 7.51472L18.0737 8.92893L11.0026 16Z"})}),l=t=>e.jsx(n.svg,{stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",...t,children:e.jsx("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11 15H13V17H11V15ZM11 7H13V13H11V7Z"})}),C=t=>e.jsx(n.svg,{viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",...t,children:e.jsx("path",{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM11 7H13V9H11V7ZM11 11H13V17H11V11Z"})}),[v,A]=x({name:"AlertStatusContext",hookName:"useAlertStatusContext",providerName:"<Alert />"}),{withProvider:j,withContext:i,useStyles:w,PropsProvider:M}=p({key:"alert"}),g=j("div","root",{forwardAsChild:!0,wrapElement(t,o){return e.jsx(v,{value:{status:o.status||"info"},children:t})}}),k=M,P=i("div","title"),Z=i("div","description"),m=i("div","content"),y={info:C,warning:l,success:f,error:l,neutral:C},H=a.forwardRef(function(o,r){const s=A(),c=w(),u=typeof s.status=="string"?y[s.status]:a.Fragment,{children:d=e.jsx(u,{}),...h}=o;return e.jsx(n.span,{ref:r,...h,css:[c.indicator,o.css],children:d})}),S=Object.freeze(Object.defineProperty({__proto__:null,Content:m,Description:Z,Indicator:H,Root:g,RootPropsProvider:k,Title:P},Symbol.toStringTag,{value:"Module"}));async function V(t,o={}){try{const r=await fetch(t,o);if(!r.ok){let s;try{s=await r.json()}catch{}const c=s?.message||`HTTP error! status: ${r.status}`;throw new Error(c)}return await r.json()}catch(r){throw console.error("API Fetch Error:",r),r}}export{S as A,V as f};
@@ -1 +0,0 @@
1
- import{a as e}from"./index-Ce8PP-0Z.js";const{withContext:t}=e({key:"badge"}),o=t("span");export{o as B};
@@ -1 +0,0 @@
1
- import{r as g,j as p,b as w}from"./index-Ce8PP-0Z.js";const x=g.forwardRef(function(o,r){const{templateAreas:t,column:s,row:e,autoFlow:i,autoRows:a,templateRows:l,autoColumns:n,templateColumns:d,inline:m,...u}=o;return p.jsx(w.div,{...u,ref:r,css:[{display:m?"inline-grid":"grid",gridTemplateAreas:t,gridAutoColumns:n,gridColumn:s,gridRow:e,gridAutoFlow:i,gridAutoRows:a,gridTemplateRows:l,gridTemplateColumns:d},o.css]})});export{x as G};