ocean-brain 0.3.0 → 0.3.2
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/mcp.js +2 -2
- package/package.json +1 -1
- package/server/client/dist/assets/Calendar-DynpmB3D.js +25 -0
- package/server/client/dist/assets/{Callout-B2kPcDrq.js → Callout-tNHgPhLM.js} +1 -1
- package/server/client/dist/assets/Graph-DMXLUfCv.js +1 -0
- package/server/client/dist/assets/Image-ZxF459sC.js +1 -0
- package/server/client/dist/assets/{Image.es-Dld9r9MJ.js → Image.es-Dnn4SMzG.js} +1 -1
- package/server/client/dist/assets/{ModalActionRow-CES9L_Gy.js → ModalActionRow-B3vNjcDc.js} +1 -1
- package/server/client/dist/assets/Note-PDMuj62M.js +1 -0
- package/server/client/dist/assets/{Note-SK4hDhEM.css → Note-PEevDKBh.css} +1 -1
- package/server/client/dist/assets/Reminders-ComtTLuN.js +1 -0
- package/server/client/dist/assets/{Search-Cp17DGR6.js → Search-BJeZTbVu.js} +1 -1
- package/server/client/dist/assets/SurfaceCard-DAcVMY4f.js +1 -0
- package/server/client/dist/assets/{Tag-CwmuMPmo.js → Tag-BuNCDGD5.js} +1 -1
- package/server/client/dist/assets/TagNotes-ajFOP5pZ.js +1 -0
- package/server/client/dist/assets/{Trash.es-B3KWD8_C.js → Trash.es-DLiHgjNo.js} +1 -1
- package/server/client/dist/assets/{image.api-DJgOBt8S.js → image.api-CjJgNbC0.js} +1 -1
- package/server/client/dist/assets/{index-DYUg2N-6.js → index-CDrZmLC2.js} +1 -1
- package/server/client/dist/assets/index-DAZMX8bQ.css +1 -0
- package/server/client/dist/assets/index-DqFkOWbi.js +205 -0
- package/server/client/dist/assets/manage-image-CVyZTDT_.js +1 -0
- package/server/client/dist/assets/{manage-image-detail-BVaDZHRu.js → manage-image-detail-Bp17tylS.js} +1 -1
- package/server/client/dist/assets/mcp-BpD7VH-d.js +1 -0
- package/server/client/dist/assets/placeholder-DSf4QF4v.js +34 -0
- package/server/client/dist/assets/trash-Ceb17h_s.js +1 -0
- package/server/client/dist/assets/useReminderMutate-CzyOQ_VB.js +82 -0
- package/server/client/dist/index.html +2 -2
- package/server/dist/modules/blocknote.js +154 -7
- package/server/dist/modules/blocknote.js.map +1 -1
- package/server/dist/modules/note-authoring.js +16 -3
- package/server/dist/modules/note-authoring.js.map +1 -1
- package/server/client/dist/assets/Calendar-DRv2aEl8.js +0 -28
- package/server/client/dist/assets/Graph-DotbTrZR.js +0 -1
- package/server/client/dist/assets/Image-B5R7gF2P.js +0 -1
- package/server/client/dist/assets/Note-cIbXJc1v.js +0 -1
- package/server/client/dist/assets/Reminders-4LunlZRb.js +0 -1
- package/server/client/dist/assets/SurfaceCard-yzVU4Qkx.js +0 -1
- package/server/client/dist/assets/TagNotes-gGroWMtT.js +0 -1
- package/server/client/dist/assets/color-wpu7wT_s.js +0 -1
- package/server/client/dist/assets/index-40Y2UsVr.js +0 -205
- package/server/client/dist/assets/index-BnxpTwtL.css +0 -1
- package/server/client/dist/assets/manage-image-ByY1mRZx.js +0 -1
- package/server/client/dist/assets/mcp-Jj3061aI.js +0 -1
- package/server/client/dist/assets/placeholder-4P_GK7fV.js +0 -34
- package/server/client/dist/assets/trash-CPBwY07S.js +0 -1
- package/server/client/dist/assets/useReminderMutate-1YVndM2T.js +0 -82
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./note-vendor-BofYbzmZ.js";import{k as x,q as d,ae as g,A as y,v as j,H as I,P as A,Q as E,E as N,L as v,af as M,B as T,f as S,S as c,e as w,a7 as G}from"./index-40Y2UsVr.js";import"./graph-vendor-CUxe67Lr.js";import{I as _}from"./Image-B5R7gF2P.js";import{S as b}from"./SurfaceCard-yzVU4Qkx.js";import{f as C,d as P}from"./image.api-DJgOBt8S.js";import{c as R,n as k}from"./Trash.es-B3KWD8_C.js";import"./note-core-BCgMq5QA.js";const q=t=>{const{data:n}=x({queryKey:d.images.list(t.searchParams),async queryFn(){const r=await C({offset:t.searchParams.offset,limit:t.searchParams.limit});if(r.type==="error")throw r;return r.allImages}});return t.render(n)},L=240,Q=20,D=4,m=w(G),J=()=>{const t=g(),n=y(),r=m.useNavigate(),{page:o}=m.useSearch(),{containerRef:u,limit:i}=j({minItemWidth:L,gap:Q,rows:D}),f=I({mutationFn:P,onSuccess:s=>{if(s.type==="error")throw s;n.invalidateQueries({queryKey:d.images.listAll(),exact:!1})}}),h=async s=>{await t("Are you really sure?")&&f.mutate(s)};return e.jsx(A,{title:"Images",variant:"subtle",description:"Manage images uploaded to your notes",children:e.jsx("div",{ref:u,children:e.jsx(E,{fallback:e.jsxs("div",{className:"grid gap-4",style:{gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))"},children:[e.jsx(c,{height:"200px"}),e.jsx(c,{height:"200px"}),e.jsx(c,{height:"200px"})]}),errorTitle:"Failed to load images",errorDescription:"Retry loading uploaded image metadata.",resetKeys:[o,i],children:e.jsx(q,{searchParams:{offset:(o-1)*i,limit:i},render:({images:s,totalCount:l})=>s.length===0?e.jsx(N,{title:"There are no images",description:"Try drag and drop an image on the note editor."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid gap-4",style:{gridTemplateColumns:"repeat(auto-fill, minmax(240px, 1fr))"},children:s.map(a=>e.jsxs(b,{className:"overflow-hidden p-0",children:[e.jsx(v,{to:M,params:{id:a.id},className:"block overflow-hidden",children:e.jsx(_,{className:"h-48 w-full object-cover transition-transform duration-200 hover:scale-[1.02]",src:a.url,alt:a.id})}),e.jsxs("div",{className:"flex items-center justify-between border-t border-border-subtle px-3 py-2.5",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-medium text-fg-tertiary",children:[e.jsx(R,{className:"h-3.5 w-3.5"}),a.referenceCount]}),e.jsx(T,{variant:"ghost",size:"icon-sm",disabled:a.referenceCount>0,onClick:()=>h(a.id),children:e.jsx(k,{className:"h-4 w-4"})})]})]},a.id))}),l&&i<l&&e.jsx(S,{page:o,last:Math.ceil(l/i),onChange:a=>{r({search:p=>({...p,page:a})})}})]})})})})})};export{J as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./note-vendor-BofYbzmZ.js";import{aa as r,z as C,A as M,u as N,H as o,P as w,ab as P,B as g,V as i,X as S,W as T}from"./index-40Y2UsVr.js";import{a as k}from"./graph-vendor-CUxe67Lr.js";import{C as v}from"./Callout-B2kPcDrq.js";import{S as c}from"./SurfaceCard-yzVU4Qkx.js";import"./note-core-BCgMq5QA.js";const A=async()=>{const{data:s}=await r.get("/api/mcp-admin/status");return s},F=async s=>{const{data:a}=await r.post("/api/mcp-admin/enabled",{enabled:s});return a},R=async()=>{const{data:s}=await r.post("/api/mcp-admin/token/rotate");return s},L=async()=>{const{data:s}=await r.post("/api/mcp-admin/token/revoke");return s},n=["mcp-admin","status"],q=s=>JSON.stringify({mcpServers:{"ocean-brain":{command:"npx",args:["-y","ocean-brain","mcp","--server",s,"--token-file","/path/to/token.txt"]}}},null,2),K=()=>{const s=C(),a=M(),[d,f]=k.useState(()=>window.location.origin),[l,u]=k.useState(""),{data:m,isLoading:j}=N({queryKey:n,queryFn:A}),p=o({mutationFn:F,onSuccess:t=>{a.setQueryData(n,t),s(t.enabled?"MCP access enabled.":"MCP access disabled.")}}),x=o({mutationFn:R,onSuccess:async({token:t})=>{u(t),s("A new MCP token has been issued."),await a.invalidateQueries({queryKey:n})}}),b=o({mutationFn:L,onSuccess:t=>{u(""),a.setQueryData(n,t),s("The active MCP token has been revoked.")}}),h=m?.enabled??!1,y=!j&&!p.isPending;return e.jsx(w,{title:"MCP",description:"Manage MCP access and issue a single service token",children:e.jsxs("div",{className:"grid grid-cols-1 gap-4",children:[e.jsx(c,{className:"p-4 space-y-4",children:e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-4 border-b border-border-subtle pb-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-fg-default",children:"MCP Access"}),e.jsx("p",{className:"text-xs font-medium text-fg-tertiary",children:"Allow or block MCP requests at the server level."})]}),e.jsx("div",{className:"inline-flex items-center",children:e.jsx(P,{"aria-label":"Allow MCP access",checked:h,disabled:!y,onCheckedChange:()=>{p.mutate(!h)}})})]})}),e.jsxs(c,{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"mb-4 border-b border-border-subtle pb-4",children:[e.jsx("h2",{className:"text-base font-semibold text-fg-default",children:"Token Management"}),e.jsx("p",{className:"text-xs font-medium text-fg-tertiary",children:"Ocean Brain supports one active MCP token per service."})]}),e.jsx(v,{children:"Rotating token invalidates previous token immediately."}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(g,{onClick:()=>x.mutate(void 0),isLoading:x.isPending,children:"Rotate token"}),e.jsx(g,{variant:"soft-danger",onClick:()=>b.mutate(),isLoading:b.isPending,disabled:!m?.hasActiveToken,children:"Revoke token"})]}),l&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"issued-mcp-token",children:"Issued Token"}),e.jsx(S,{id:"issued-mcp-token",rows:3,readOnly:!0,value:l})]})]}),e.jsxs(c,{className:"p-4 space-y-4",children:[e.jsxs("div",{className:"mb-4 border-b border-border-subtle pb-4",children:[e.jsx("h2",{className:"text-base font-semibold text-fg-default",children:"Connection Guide"}),e.jsx("p",{className:"text-xs font-medium text-fg-tertiary",children:"Default server URL uses current origin. Change it when registering a public host."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{htmlFor:"mcp-server-url",children:"MCP Server URL"}),e.jsx(T,{id:"mcp-server-url",value:d,onChange:t=>f(t.target.value)})]}),e.jsxs(v,{children:["Recommended: ",e.jsx("code",{children:"--token-file"}),". For quick local tests, ",e.jsx("code",{children:"--token"})," also works."]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Recommended (.mcp.json with token file)"}),e.jsx("pre",{className:"overflow-x-auto rounded-[14px] border border-border-subtle bg-surface px-4 py-3 text-xs text-fg-secondary",children:q(d)})]})]})]})})};export{K as default};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./note-vendor-BofYbzmZ.js";import{p as O,g as y,z as $,A as H,q as x,al as I,u as q,H as P,P as Z,B as f,Y as k,am as F,an as v,ao as Q,M as p,V as g,W as j,F as T,f as K,e as B,a8 as U}from"./index-40Y2UsVr.js";import{a as t}from"./graph-vendor-CUxe67Lr.js";import{C as z}from"./Callout-B2kPcDrq.js";import{n as X,M as Y}from"./ModalActionRow-CES9L_Gy.js";import{S as C}from"./SurfaceCard-yzVU4Qkx.js";import"./note-core-BCgMq5QA.js";const G=new Map([["bold",t.createElement(t.Fragment,null,t.createElement("path",{d:"M216.49,168.49a12,12,0,0,1-17,0L128,97,56.49,168.49a12,12,0,0,1-17-17l80-80a12,12,0,0,1,17,0l80,80A12,12,0,0,1,216.49,168.49Z"}))],["duotone",t.createElement(t.Fragment,null,t.createElement("path",{d:"M208,160H48l80-80Z",opacity:"0.2"}),t.createElement("path",{d:"M213.66,154.34l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,48,168H208a8,8,0,0,0,5.66-13.66ZM67.31,152,128,91.31,188.69,152Z"}))],["fill",t.createElement(t.Fragment,null,t.createElement("path",{d:"M215.39,163.06A8,8,0,0,1,208,168H48a8,8,0,0,1-5.66-13.66l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,215.39,163.06Z"}))],["light",t.createElement(t.Fragment,null,t.createElement("path",{d:"M212.24,164.24a6,6,0,0,1-8.48,0L128,88.49,52.24,164.24a6,6,0,0,1-8.48-8.48l80-80a6,6,0,0,1,8.48,0l80,80A6,6,0,0,1,212.24,164.24Z"}))],["regular",t.createElement(t.Fragment,null,t.createElement("path",{d:"M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z"}))],["thin",t.createElement(t.Fragment,null,t.createElement("path",{d:"M210.83,162.83a4,4,0,0,1-5.66,0L128,85.66,50.83,162.83a4,4,0,0,1-5.66-5.66l80-80a4,4,0,0,1,5.66,0l80,80A4,4,0,0,1,210.83,162.83Z"}))]]),S=t.forwardRef((l,r)=>t.createElement(O,{ref:r,...l,weights:G}));S.displayName="CaretUpIcon";const V=S,b=["id","name","template","replacement","createdAt","updatedAt"],W=new Set(b),J=`query FetchPlaceholders(
|
|
2
|
-
$searchFilter: SearchFilterInput,
|
|
3
|
-
$pagination: PaginationInput
|
|
4
|
-
) {
|
|
5
|
-
allPlaceholders(
|
|
6
|
-
searchFilter: $searchFilter,
|
|
7
|
-
pagination: $pagination
|
|
8
|
-
) {
|
|
9
|
-
totalCount
|
|
10
|
-
placeholders {
|
|
11
|
-
__PLACEHOLDER_FIELDS__ }
|
|
12
|
-
}
|
|
13
|
-
}`,ee=l=>{const r=l&&l.length>0?l.filter(n=>W.has(n)):b;return Array.from(new Set(r)).map(n=>" "+n).join(`
|
|
14
|
-
`)+`
|
|
15
|
-
`},te=async({limit:l=25,offset:r=0,query:d="",fields:n}={})=>{const h=ee(n),c=J.replace("__PLACEHOLDER_FIELDS__",h);return y(c,{searchFilter:{query:d},pagination:{limit:l,offset:r}})},ae=l=>y(`mutation CreatePlaceholder(
|
|
16
|
-
$name: String!,
|
|
17
|
-
$template: String!,
|
|
18
|
-
$replacement: String!
|
|
19
|
-
) {
|
|
20
|
-
createPlaceholder(
|
|
21
|
-
name: $name,
|
|
22
|
-
template: $template,
|
|
23
|
-
replacement: $replacement
|
|
24
|
-
) {
|
|
25
|
-
id
|
|
26
|
-
name
|
|
27
|
-
template
|
|
28
|
-
replacement
|
|
29
|
-
createdAt
|
|
30
|
-
updatedAt
|
|
31
|
-
}
|
|
32
|
-
}`,l),le=l=>y(`mutation DeletePlaceholder($id: ID!) {
|
|
33
|
-
deletePlaceholder(id: $id)
|
|
34
|
-
}`,{id:l}),L="p-4",A=B(U),me=()=>{const l=$(),r=H(),d=A.useNavigate(),{page:n}=A.useSearch(),[h,c]=t.useState(!1),[u,N]=t.useState(!1),[s,m]=t.useState({name:"",template:"",replacement:""}),i=25,_=x.placeholders.list({limit:i,offset:(n-1)*i}),[w]=t.useState(I),{data:o,isLoading:M}=q({queryKey:_,queryFn:async()=>{const a=await te({offset:(n-1)*i,limit:i});if(a.type==="error")throw a;return a.allPlaceholders}}),E=P({mutationFn:ae,onSuccess:async()=>{l("Placeholder added successfully"),c(!1),m({name:"",template:"",replacement:""}),await r.invalidateQueries({queryKey:x.placeholders.listAll(),exact:!1})}}),R=P({mutationFn:le,onSuccess:async()=>{l("Placeholder deleted successfully"),await r.invalidateQueries({queryKey:x.placeholders.listAll(),exact:!1})}});return e.jsxs(Z,{title:"Placeholders",variant:"subtle",description:"Manage template variables for note cloning",children:[e.jsx(z,{className:"mb-4",children:e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{children:"Placeholders will be replaced with new note data during cloning."}),e.jsx(f,{variant:"subtle",size:"icon-sm",onClick:()=>c(!0),children:e.jsx(X,{width:20,height:20})})]})}),e.jsxs("div",{className:"mt-3 flex flex-col gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>N(!u),className:"focus-ring-soft surface-base flex items-center justify-between gap-2 rounded-[18px] px-4 py-3 text-left text-sm font-semibold text-fg-default transition-colors hover:bg-hover-subtle",children:[e.jsx("div",{children:"System Placeholders"}),e.jsx("div",{className:"flex h-6 w-6 items-center justify-center text-fg-tertiary",children:u?e.jsx(V,{}):e.jsx(k,{})})]}),u&&e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:w.map(a=>e.jsxs(C,{className:L,children:[e.jsx("div",{className:"text-sm font-semibold text-fg-default",children:a.name}),e.jsxs("div",{className:"text-xs font-medium text-fg-tertiary",children:[F,a.template,v," = '",a.replacement,"'"]})]},a.name))}),!M&&o?.placeholders&&o.placeholders.length>0&&e.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3",children:o.placeholders.map(a=>e.jsxs(C,{className:`${L} relative`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm font-semibold text-fg-default",children:a.name}),e.jsx("button",{type:"button",className:"focus-ring-soft inline-flex h-8 w-8 items-center justify-center rounded-[10px] text-fg-tertiary transition-colors hover:bg-hover-subtle hover:text-fg-default",onClick:()=>R.mutate(a.id.toString()),children:e.jsx(Q,{})})]}),e.jsxs("div",{className:"text-xs font-medium text-fg-tertiary",children:[F,a.template,v," = '",a.replacement,"'"]})]},a.id))})]}),e.jsxs(p,{isOpen:h,onClose:()=>c(!1),children:[e.jsx(p.Header,{title:"Add Placeholder",onClose:()=>c(!1)}),e.jsx(p.Body,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(g,{htmlFor:"name",children:"Name:"}),e.jsx(j,{id:"name",type:"text",value:s.name,onChange:a=>m({...s,name:a.target.value}),placeholder:"Description of this placeholder"}),e.jsx(g,{htmlFor:"template",children:"Placeholder:"}),e.jsx(j,{id:"template",type:"text",value:s.template,onChange:a=>m({...s,template:a.target.value}),placeholder:"note_app"}),e.jsx(g,{htmlFor:"replacement",children:"Replacement:"}),e.jsx(j,{id:"replacement",type:"text",value:s.replacement,onChange:a=>m({...s,replacement:a.target.value}),placeholder:"Ocean Brain"})]})}),e.jsx(p.Footer,{children:e.jsxs(Y,{children:[e.jsx(f,{variant:"ghost",onClick:()=>c(!1),children:"Cancel"}),e.jsx(f,{variant:"primary",isLoading:E.isPending,onClick:()=>{if(!s.name||!s.template||!s.replacement){l("All fields are required");return}E.mutate({name:s.name,template:s.template,replacement:s.replacement})},children:"Add"})]})})]}),e.jsx(T,{fallback:null,children:o?.totalCount&&i<o.totalCount&&e.jsx(K,{page:n,last:Math.ceil(o.totalCount/i),onChange:a=>{d({search:D=>({...D,page:a})})}})})]})};export{me as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./note-vendor-BofYbzmZ.js";import{P as h,Q as p,S as d,e as f,a1 as y,A as g,z as j,k as b,ac as v,q as i,H as N,ad as T,N as S,F as q,a2 as E,B as R,f as Q,E as w,d as C}from"./index-40Y2UsVr.js";import"./graph-vendor-CUxe67Lr.js";import{S as K}from"./SurfaceCard-yzVU4Qkx.js";import"./note-core-BCgMq5QA.js";const a=25,c=f(y),x=t=>C(t).format("YYYY-MM-DD HH:mm"),k=()=>{const{page:t}=c.useSearch(),u=c.useNavigate(),r=g(),m=j(),{data:l}=b({queryKey:i.notes.trash({limit:a,offset:(t-1)*a}),queryFn:async()=>{const s=await v({limit:a,offset:(t-1)*a});if(s.type==="error")throw s;return s.trashedNotes}}),o=N({mutationFn:T,onSuccess:async s=>{if(s.type==="error")throw s;await Promise.all([r.invalidateQueries({queryKey:i.notes.all(),exact:!1}),r.invalidateQueries({queryKey:i.tags.all(),exact:!1}),r.invalidateQueries({queryKey:i.reminders.all(),exact:!1}),r.invalidateQueries({queryKey:i.images.all(),exact:!1}),r.invalidateQueries({queryKey:["calendar"],exact:!1})]),m("The note has been restored."),u({to:S,params:{id:s.restoreTrashedNote.id}})},onError:()=>{m("Failed to restore the note.")}});return e.jsx(q,{fallback:e.jsx(w,{title:"Trash is empty",description:"Deleted notes stay here until you restore them or retention cleanup removes them."}),children:l.notes.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid gap-4",children:l.notes.map(s=>e.jsx(K,{className:"p-4",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-base font-semibold text-fg-default",children:s.title}),s.pinned&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-border-subtle bg-hover-subtle px-2 py-0.5 text-xs font-medium text-fg-secondary",children:[e.jsx(E,{className:"h-3.5 w-3.5"}),"Pinned"]})]}),e.jsxs("div",{className:"text-sm text-fg-secondary",children:["Deleted ",x(s.deletedAt)]}),e.jsxs("div",{className:"text-xs text-fg-tertiary",children:["Last edited ",x(s.updatedAt)]}),s.tagNames.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:s.tagNames.map(n=>e.jsx("span",{className:"rounded-full border border-border-subtle bg-hover-subtle px-2 py-0.5 text-xs font-medium text-fg-secondary",children:n},`${s.id}-${n}`))})]}),e.jsx(R,{variant:"subtle",isLoading:o.isPending&&o.variables===s.id,onClick:()=>o.mutate(s.id),children:"Restore"})]})},s.id))}),l.totalCount>a&&e.jsx(Q,{page:t,last:Math.ceil(l.totalCount/a),onChange:s=>{u({search:n=>({...n,page:s})})}})]})})},H=()=>{const{page:t}=c.useSearch();return e.jsx(h,{title:"Trash",variant:"subtle",description:"Restore notes removed from your active workspace before retention cleanup clears them",children:e.jsx(p,{fallback:e.jsxs("div",{className:"grid gap-4",children:[e.jsx(d,{height:"128px"}),e.jsx(d,{height:"128px"}),e.jsx(d,{height:"128px"})]}),errorTitle:"Failed to load trash",errorDescription:"Retry loading deleted notes.",resetKeys:[t],children:e.jsx(k,{})})})};export{H as default};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import{j as y}from"./note-vendor-BofYbzmZ.js";import{g as u,k as f,q as n,z as R,A as $}from"./index-40Y2UsVr.js";import{a as l}from"./graph-vendor-CUxe67Lr.js";const g=(e={})=>({limit:e.limit??10,offset:e.offset??0}),D=async(e,t)=>u(`
|
|
2
|
-
query FetchNoteReminders($noteId: ID!, $pagination: PaginationInput) {
|
|
3
|
-
noteReminders(noteId: $noteId, pagination: $pagination) {
|
|
4
|
-
totalCount
|
|
5
|
-
reminders {
|
|
6
|
-
id
|
|
7
|
-
noteId
|
|
8
|
-
reminderDate
|
|
9
|
-
priority
|
|
10
|
-
content
|
|
11
|
-
completed
|
|
12
|
-
createdAt
|
|
13
|
-
updatedAt
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
`,{noteId:e,pagination:g(t)}),A=async e=>u(`
|
|
18
|
-
query FetchUpcomingReminders($pagination: PaginationInput) {
|
|
19
|
-
upcomingReminders(pagination: $pagination) {
|
|
20
|
-
totalCount
|
|
21
|
-
reminders {
|
|
22
|
-
id
|
|
23
|
-
noteId
|
|
24
|
-
reminderDate
|
|
25
|
-
priority
|
|
26
|
-
content
|
|
27
|
-
completed
|
|
28
|
-
createdAt
|
|
29
|
-
updatedAt
|
|
30
|
-
note {
|
|
31
|
-
id
|
|
32
|
-
title
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
`,{pagination:g(e)}),q=async e=>{const{noteId:t,reminderDate:a,priority:o="medium",content:i}=e;return u(`
|
|
38
|
-
mutation CreateReminder($noteId: ID!, $reminderDate: String!, $priority: ReminderPriority, $content: String) {
|
|
39
|
-
createReminder(
|
|
40
|
-
noteId: $noteId,
|
|
41
|
-
reminderDate: $reminderDate,
|
|
42
|
-
priority: $priority,
|
|
43
|
-
content: $content
|
|
44
|
-
) {
|
|
45
|
-
id
|
|
46
|
-
noteId
|
|
47
|
-
reminderDate
|
|
48
|
-
completed
|
|
49
|
-
priority
|
|
50
|
-
createdAt
|
|
51
|
-
updatedAt
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
`,{noteId:t,reminderDate:a.toISOString(),priority:o,content:i})},I=async({id:e,reminderDate:t,completed:a,priority:o,content:i})=>{const r={id:e};return t&&(r.reminderDate=t.toISOString()),a!==void 0&&(r.completed=a),o&&(r.priority=o),i!==void 0&&(r.content=i),u(`
|
|
55
|
-
mutation UpdateReminder(
|
|
56
|
-
$id: ID!,
|
|
57
|
-
$reminderDate: String,
|
|
58
|
-
$completed: Boolean,
|
|
59
|
-
$priority: ReminderPriority,
|
|
60
|
-
$content: String
|
|
61
|
-
) {
|
|
62
|
-
updateReminder(
|
|
63
|
-
id: $id,
|
|
64
|
-
reminderDate: $reminderDate,
|
|
65
|
-
completed: $completed,
|
|
66
|
-
priority: $priority,
|
|
67
|
-
content: $content
|
|
68
|
-
) {
|
|
69
|
-
id
|
|
70
|
-
noteId
|
|
71
|
-
reminderDate
|
|
72
|
-
completed
|
|
73
|
-
priority
|
|
74
|
-
createdAt
|
|
75
|
-
updatedAt
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
`,r)},x=async e=>u(`
|
|
79
|
-
mutation DeleteReminder($id: ID!) {
|
|
80
|
-
deleteReminder(id: $id)
|
|
81
|
-
}
|
|
82
|
-
`,{id:e});function P({noteId:e,searchParams:t,render:a}){const{data:o}=f({queryKey:e?n.reminders.note(e,t):n.reminders.upcoming(t),queryFn:async()=>{if(e){const r=await D(e,t);if(r.type==="error")throw r;return r.noteReminders}const i=await A(t);if(i.type==="error")throw i;return i.upcomingReminders}});return y.jsx(y.Fragment,{children:a(o)})}function w(){const e=R(),t=$(),a=l.useCallback(async(r,m,d="medium",s,c)=>{const p=await q({noteId:r,reminderDate:m,priority:d,content:c});if(p.type==="error"){e(p.errors[0].message);return}await Promise.all([t.invalidateQueries({queryKey:n.reminders.noteAllPages(r),exact:!1}),t.invalidateQueries({queryKey:n.reminders.upcomingAllPages(),exact:!1}),t.invalidateQueries({queryKey:n.reminders.inDateRangeAll(),exact:!1})]),s&&s()},[t,e]),o=l.useCallback(async(r,m,d,s)=>{const c=await I({id:r,...d});if(c.type==="error"){e(c.errors[0].message);return}await Promise.all([t.invalidateQueries({queryKey:n.reminders.noteAllPages(m),exact:!1}),t.invalidateQueries({queryKey:n.reminders.upcomingAllPages(),exact:!1}),t.invalidateQueries({queryKey:n.reminders.inDateRangeAll(),exact:!1})]),s&&s()},[t,e]),i=l.useCallback(async(r,m,d)=>{const s=await x(r);if(s.type==="error"){e(s.errors[0].message);return}await Promise.all([t.invalidateQueries({queryKey:n.reminders.noteAllPages(m),exact:!1}),t.invalidateQueries({queryKey:n.reminders.upcomingAllPages(),exact:!1}),t.invalidateQueries({queryKey:n.reminders.inDateRangeAll(),exact:!1})]),d&&d()},[t,e]);return{onCreate:a,onUpdate:o,onDelete:i}}export{P as R,w as u};
|