@aiquants/daily-report 0.20.0 → 0.20.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.
- package/dist/client.d.mts +11 -706
- package/dist/client.d.ts +11 -706
- package/dist/client.js +0 -1
- package/dist/client.mjs +0 -1
- package/dist/index.d.mts +5 -197
- package/dist/index.d.ts +5 -197
- package/dist/index.js +0 -1
- package/dist/index.mjs +0 -1
- package/dist/logger-D3krZrNK.d.mts +0 -14
- package/dist/logger-D3krZrNK.d.ts +0 -14
- package/dist/server.d.mts +114 -744
- package/dist/server.d.ts +114 -744
- package/dist/server.js +0 -1
- package/dist/server.mjs +0 -1
- package/dist/sse-schema-BdUGThiz.d.ts +1025 -1009
- package/dist/sse-schema-ChSFm-4q.d.mts +1025 -1009
- package/dist/types-CqgYQgbH.d.mts +0 -34
- package/dist/types-CqgYQgbH.d.ts +0 -34
- package/package.json +7 -8
- package/dist/client.js.map +0 -1
- package/dist/client.mjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/server.mjs.map +0 -1
- package/src/client/components/business-day-thumb-overlay.tsx +0 -19
- package/src/client/components/daily-report-attachment-indicator.spec.tsx +0 -51
- package/src/client/components/daily-report-attachment-indicator.tsx +0 -45
- package/src/client/components/daily-report-attachment-list.spec.tsx +0 -94
- package/src/client/components/daily-report-attachment-list.tsx +0 -112
- package/src/client/components/daily-report-comment-item.tsx +0 -89
- package/src/client/components/daily-report-comment-section.tsx +0 -166
- package/src/client/components/daily-report-detail-list.tsx +0 -842
- package/src/client/components/daily-report-edit-form.tsx +0 -87
- package/src/client/components/daily-report-ids-stream-status.spec.tsx +0 -93
- package/src/client/components/daily-report-ids-stream-status.tsx +0 -67
- package/src/client/components/daily-report-list.tsx +0 -1232
- package/src/client/components/daily-report-page.spec.tsx +0 -119
- package/src/client/components/daily-report-page.tsx +0 -140
- package/src/client/components/daily-report-resize-panels.spec.tsx +0 -307
- package/src/client/components/daily-report-resolved-content.tsx +0 -207
- package/src/client/components/daily-report-scroll-restoration.spec.tsx +0 -422
- package/src/client/components/report-views.spec.tsx +0 -375
- package/src/client/components/unread-indicator.tsx +0 -13
- package/src/client/config-context.tsx +0 -184
- package/src/client/contexts/daily-report-action-context.spec.tsx +0 -433
- package/src/client/contexts/daily-report-action-context.tsx +0 -1147
- package/src/client/contexts/daily-report-error-context.spec.tsx +0 -66
- package/src/client/contexts/daily-report-error-context.tsx +0 -98
- package/src/client/hooks/use-animated-number.spec.ts +0 -103
- package/src/client/hooks/use-animated-number.ts +0 -69
- package/src/client/hooks/use-daily-report-comments.ts +0 -73
- package/src/client/hooks/use-daily-report-sse-connection.ts +0 -86
- package/src/client/hooks/use-daily-report.spec.ts +0 -546
- package/src/client/hooks/use-daily-report.ts +0 -549
- package/src/client/hooks/use-dynamic-viewport-height.ts +0 -127
- package/src/client/hooks/use-responsive-layout.spec.ts +0 -74
- package/src/client/hooks/use-responsive-layout.ts +0 -63
- package/src/client/route-helpers.spec.ts +0 -100
- package/src/client/route-helpers.ts +0 -61
- package/src/client/streaming/daily-report-ids-stream-client.spec.ts +0 -910
- package/src/client/streaming/daily-report-ids-stream-client.ts +0 -730
- package/src/client/streaming/daily-report-ids-stream-session.spec.ts +0 -401
- package/src/client/streaming/daily-report-ids-stream-session.ts +0 -319
- package/src/client/ui/button.tsx +0 -42
- package/src/client/ui/cn.ts +0 -14
- package/src/client/ui/input.tsx +0 -21
- package/src/client/ui/label.tsx +0 -16
- package/src/client/ui/switch.tsx +0 -19
- package/src/client/ui/tabs.tsx +0 -40
- package/src/client/ui/textarea.tsx +0 -19
- package/src/client/utils/constants.spec.ts +0 -96
- package/src/client/utils/constants.ts +0 -84
- package/src/client.ts +0 -28
- package/src/index.ts +0 -11
- package/src/lucide-icons.d.ts +0 -6
- package/src/server/authz.spec.ts +0 -57
- package/src/server/authz.ts +0 -99
- package/src/server/cache.spec.ts +0 -556
- package/src/server/cache.ts +0 -303
- package/src/server/etag.ts +0 -18
- package/src/server/external-source.ts +0 -60
- package/src/server/handlers.action.spec.ts +0 -44
- package/src/server/handlers.attachment.spec.ts +0 -470
- package/src/server/handlers.ids-stream.spec.ts +0 -618
- package/src/server/handlers.ts +0 -1638
- package/src/server/handlers.unauthorized-cookie.spec.ts +0 -187
- package/src/server/handlers.visibility.spec.ts +0 -774
- package/src/server/ports.ts +0 -222
- package/src/server/response.ts +0 -37
- package/src/server/schema.spec.ts +0 -30
- package/src/server/schema.ts +0 -344
- package/src/server/service.spec.ts +0 -1130
- package/src/server/service.ts +0 -2045
- package/src/server/sse-reader.spec.ts +0 -302
- package/src/server/sse-reader.ts +0 -267
- package/src/server/test-helpers/handlers-config.ts +0 -321
- package/src/server/transaction-retry.spec.ts +0 -63
- package/src/server/visibility.spec.ts +0 -403
- package/src/server/visibility.ts +0 -373
- package/src/server.spec.ts +0 -160
- package/src/server.ts +0 -131
- package/src/shared/business-date.spec.ts +0 -82
- package/src/shared/business-date.ts +0 -104
- package/src/shared/comment-adapter.spec.ts +0 -38
- package/src/shared/comment-adapter.ts +0 -80
- package/src/shared/ids-stream.spec.ts +0 -154
- package/src/shared/ids-stream.ts +0 -279
- package/src/shared/logger.ts +0 -47
- package/src/shared/sse-schema.spec.ts +0 -50
- package/src/shared/sse-schema.ts +0 -198
- package/src/shared/text-utils.spec.ts +0 -42
- package/src/shared/text-utils.ts +0 -65
- package/src/shared/types.ts +0 -109
- package/src/styles/standalone.entry.css +0 -51
package/dist/client.js
CHANGED
|
@@ -5,4 +5,3 @@
|
|
|
5
5
|
`).replace(/<[^>]+>/g,""):null,[e]),ve=async()=>{if(!e)return;let I=!e.isStarred;try{await u(e.reportHubId,I,e.date??"")}catch{}},ie=async()=>{if(e&&confirm("\u672C\u5F53\u306B\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F"))try{await y(e.reportHubId,e.date??"")}catch{alert("\u524A\u9664\u306B\u5931\u6557\u3057\u307E\u3057\u305F")}};if(r)return(0,o.jsx)("p",{className:"text-red-500",children:r.message});let se=!e,ue=e?.isStarred??!1,X=e?.isRead??!1,ce=!!(p&&e?.userId===p),Pe=N.length>0;return(0,o.jsxs)("div",{className:"relative space-y-4 text-slate-700 dark:text-slate-200",onDoubleClick:m,children:[!se&&e&&(0,o.jsxs)("div",{className:"absolute top-0 right-2 z-10 flex items-center justify-end gap-3",children:[(0,o.jsx)("button",{type:"button",onClick:()=>z(!1),className:"rounded text-lg leading-none transition-transform focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 active:scale-95",title:X?"\u672A\u8AAD\u306B\u3059\u308B":"\u65E2\u8AAD\u306B\u3059\u308B","data-detail-read-button":e.reportHubId,children:X?(0,o.jsx)("span",{className:"text-slate-300 hover:text-blue-500",children:"\u2713"}):(0,o.jsx)(Je,{className:"hover:text-blue-600"})}),(0,o.jsx)("button",{type:"button",onClick:ve,className:"rounded text-lg leading-none transition-transform focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 active:scale-95",title:ue?"\u30B9\u30BF\u30FC\u3092\u5916\u3059":"\u30B9\u30BF\u30FC\u3092\u4ED8\u3051\u308B","data-detail-star-button":e.reportHubId,children:ue?(0,o.jsx)("span",{className:"text-yellow-400",children:"\u2605"}):(0,o.jsx)("span",{className:"text-slate-300 hover:text-yellow-400",children:"\u2606"})}),ce&&(0,o.jsx)("button",{type:"button",onClick:ie,"data-detail-delete-button":e.reportHubId,className:"rounded text-lg leading-none transition-transform focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 active:scale-95",title:"\u524A\u9664\u3059\u308B",children:(0,o.jsx)(In.default,{className:"h-4 w-4 text-slate-300 hover:text-red-500"})})]}),(0,o.jsxs)("div",{className:"flex items-baseline",children:[(0,o.jsx)("span",{className:"w-24 shrink-0 font-semibold text-slate-500 text-xs uppercase tracking-wide dark:text-slate-300",children:g.subject}),(0,o.jsx)("div",{className:"flex-1 pr-20",children:se?(0,o.jsx)(et,{className:"w-3/4"}):(0,o.jsx)("span",{className:"fade-in animate-in text-sm duration-500",children:le(e?.subject)})})]}),(0,o.jsxs)("div",{className:"flex items-baseline",children:[(0,o.jsx)("span",{className:"w-24 shrink-0 font-semibold text-slate-500 text-xs uppercase tracking-wide dark:text-slate-300",children:g.customer}),(0,o.jsx)("div",{className:"flex-1",children:se?(0,o.jsx)(et,{className:"w-1/2"}):(0,o.jsx)("span",{className:"fade-in animate-in text-sm duration-500",children:le(e?.customerName)})})]}),(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)("div",{className:"font-semibold text-slate-500 text-xs uppercase tracking-wide dark:text-slate-300",children:g.content}),(0,o.jsx)("div",{className:"min-h-22 rounded-lg bg-slate-50 p-3 text-sm leading-relaxed dark:bg-slate-800/40",children:se?(0,o.jsxs)("div",{className:"space-y-2",children:[(0,o.jsx)(et,{className:"w-full"}),(0,o.jsx)(et,{className:"w-11/12"}),(0,o.jsx)(et,{className:"w-4/5"})]}):re?(0,o.jsx)("div",{className:"fade-in animate-in whitespace-pre-wrap duration-500",children:re}):(0,o.jsx)("p",{className:"fade-in animate-in text-slate-500 duration-500 dark:text-slate-400",children:"\u5185\u5BB9\u306F\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"})})]}),(0,o.jsxs)("div",{className:"flex items-baseline",children:[(0,o.jsx)("span",{className:"w-24 shrink-0 font-semibold text-slate-500 text-xs uppercase tracking-wide dark:text-slate-300",children:g.visitTime}),(0,o.jsx)("div",{className:"flex-1",children:se?(0,o.jsx)(et,{className:"w-1/3"}):(0,o.jsxs)("span",{className:"fade-in animate-in text-sm duration-500",children:[le(e?.visitTimeFrom)," ",e?.visitTimeFrom&&e?.visitTimeTo?"-":""," ",le(e?.visitTimeTo)]})})]}),e&&(0,o.jsx)(ot,{attachments:e.attachments}),e&&(0,o.jsxs)("div",{className:"fade-in animate-in space-y-2 border-slate-100 border-t pt-4 duration-500 dark:border-slate-800",children:[(0,o.jsx)("div",{className:"font-semibold text-slate-500 text-xs uppercase tracking-wide dark:text-slate-300",children:g.comments}),Pe&&(0,o.jsx)(it,{comments:N,reportHubId:e.reportHubId,businessDate:e.date??"",onDeleteComment:U,pendingDeleteId:T,onPendingDeleteIdChange:M,resolvedIdMap:A}),k&&(0,o.jsx)(lt,{reportHubId:e.reportHubId,businessDate:e.date??"",onAddComment:Ne})]})]})},Qs=({isOpen:e,selectedItem:t,onClose:r,autoMarkRead:n=!1,userId:s})=>{let a=(0,w.useRef)(null),d=(0,w.useRef)(null),{isBlocked:p,requestBlock:m,reset:u}=(0,we.useSwipeGuardState)(),{report:i,error:y,isLoading:R}=Oe(t?.reportHubId??-1,t?.businessDate??null),D=(0,we.useTransitionDisplay)(e,t?{item:t,detail:{report:i,error:y,isLoading:R}}:null)?.item??null,{overlayRef:N,overlayStyle:C,attemptClose:U,isSwiping:T}=(0,we.useSwipeToDismissOverlay)({isOpen:e,onClose:r,isCloseBlocked:(0,w.useCallback)(()=>p,[p]),skipWhenTextSelected:!0}),M=(0,we.useTapClick)(()=>U());return(0,w.useEffect)(()=>{e?requestAnimationFrame(()=>d.current?.focus()):(a.current?.contains(document.activeElement)&&document.activeElement.blur(),u())},[e,u]),D?(0,o.jsxs)("div",{ref:a,"data-daily-report-mobile-overlay":"true",className:`fixed top-0 bottom-0 left-0 z-[100] flex touch-manipulation transition-[visibility] duration-200 ${e?"visible":"invisible"} ${e&&!T?"pointer-events-auto":"pointer-events-none"}`,style:{right:"var(--aqdr-overlay-right, 0px)",transition:"right 0.5s, visibility 0.2s"},"aria-hidden":!e,children:[(0,o.jsx)("button",{type:"button","aria-label":"\u80CC\u666F\u3092\u30BF\u30C3\u30D7\u3057\u3066\u9589\u3058\u308B",className:`absolute inset-0 touch-manipulation bg-slate-900/50 transition-opacity duration-200 focus:outline-none ${e?"opacity-100":"opacity-0"}`,...M}),(0,o.jsx)("aside",{role:"dialog","aria-modal":"true","aria-label":"\u65E5\u5831\u8A73\u7D30",className:`relative ml-auto flex h-full w-full max-w-full transform touch-none bg-white shadow-xl transition-transform duration-200 ease-out dark:bg-slate-900/95 ${e?"pointer-events-auto":"pointer-events-none"}`,ref:N,onKeyDown:A=>{A.key==="Escape"&&(A.preventDefault(),U())},style:C,children:(0,o.jsxs)("div",{className:"flex h-full w-full flex-col gap-3 p-4",children:[(0,o.jsx)(we.SwipeCloseGuardContext.Provider,{value:{isBlocked:p,requestBlock:m},children:(0,o.jsx)(Cn,{selectedItem:D,autoMarkRead:n,isActive:e,userId:s})}),(0,o.jsx)("div",{className:"mt-2 flex justify-start",children:(0,o.jsx)("button",{type:"button",ref:d,"data-overlay-interactive":"true",className:"touch-manipulation rounded-full border border-slate-300 px-4 py-2 font-medium text-slate-600 text-sm shadow-sm transition-colors hover:bg-slate-100 dark:border-slate-600 dark:text-slate-200 dark:hover:bg-slate-800",onClick:()=>U(),children:"\u9589\u3058\u308B"})})]})})]}):null},Zs=e=>e?e.replace(/<br\s*\/?\s*>/gi,`
|
|
6
6
|
`).replace(/<\/p>/gi,`
|
|
7
7
|
`).replace(/<[^>]+>/g,"").split(/\r?\n/).map(t=>t.replace(/\u3000/g," ").trim()).filter(t=>t.length>0).slice(0,nr):[],Tn=(0,w.memo)(({item:e,index:t,setSize:r,isActive:n,onSelect:s})=>{let{fieldLabels:a,sourceTypeConfigs:d}=q(),{toggleStar:p,toggleRead:m,removeStaleItem:u}=be(),{report:i,error:y,isLoading:R,isRefetching:g}=Oe(e.reportHubId,e.businessDate),D={role:"listitem","aria-posinset":t+1,"aria-setsize":r},N=(0,w.useRef)(!1);g&&(N.current=!0),(0,w.useEffect)(()=>{!(i||R||g||y)&&N.current&&e.reportHubId>0&&u(e.reportHubId)},[i,R,g,y,e.reportHubId,u]);let C=(0,we.useTapClick)(()=>s(e.reportHubId));if(y)return(0,o.jsx)("div",{...D,className:"px-2 pb-3",style:{height:je},children:(0,o.jsx)("div",{className:"flex h-full items-center justify-center rounded-2xl border border-red-200 bg-red-50 p-4 text-red-700 text-sm dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-300",children:(0,o.jsxs)("p",{children:["\u65E5\u5831 ",e.reportHubId.toLocaleString()," \u306E\u6982\u8981\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002"]})})});if(R)return(0,o.jsx)(Xs,{...D});if(!i)return(0,o.jsx)("div",{...D,className:"px-2 pb-3",style:{height:je},children:(0,o.jsx)("div",{className:"flex h-full items-center justify-center rounded-2xl border border-slate-200 bg-slate-50 p-4 text-slate-500 text-sm dark:border-slate-700 dark:bg-slate-900/40 dark:text-slate-400",children:(0,o.jsx)("p",{children:"\u65E5\u5831\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093"})})});let U=Zs(i.content??null).map((_,O)=>({line:_,key:`${e.reportHubId}-line-${O}`})),T=le(i.employeeName??i.author),M=de(i.date),A=async _=>{_.stopPropagation();let O=!i.isStarred;try{await p(i.reportHubId,O,i.date??"")}catch{}},z=async _=>{_.stopPropagation();let O=!i.isRead;try{await m(i.reportHubId,O,i.date??"")}catch{}},E=_=>{_.stopPropagation()};return(0,o.jsx)("div",{...D,className:"px-2 pb-3",style:{height:je},children:(0,o.jsxs)("div",{"data-daily-report-button":e.reportHubId,className:`flex h-full w-full in-[[data-scrolling]]:transform-none cursor-pointer select-none flex-col rounded-2xl border in-[[data-scrolling]]:border-slate-200 bg-white p-4 text-left in-[[data-scrolling]]:shadow-sm shadow-sm in-[[data-scrolling]]:transition-none transition-[transform,border-color,box-shadow] duration-200 hover:-translate-y-0.5 hover:border-blue-300 hover:shadow-lg dark:bg-slate-900/70 ${n?"border-blue-300 shadow-md ring-2 ring-blue-200 dark:border-blue-500/70 dark:ring-blue-500/40":"border-slate-200 dark:border-slate-700"}`,style:{touchAction:"manipulation"},role:"button",tabIndex:0,"aria-current":n?"true":void 0,"aria-pressed":n,"aria-label":`${M} ${T}`,...C,children:[(0,o.jsxs)("div",{className:"mb-3 flex items-center gap-3 text-slate-600 text-sm",children:[(0,o.jsx)("span",{className:"inline-flex shrink-0 items-center rounded-full bg-slate-100 px-3 py-1 font-semibold text-xs dark:bg-slate-800 dark:text-slate-200",children:(0,o.jsx)("span",{className:"whitespace-nowrap font-medium text-slate-900 dark:text-slate-100",children:M})}),(0,o.jsx)("span",{className:"inline-flex min-w-0 max-w-full items-center rounded-full bg-slate-100 px-3 py-1 font-semibold text-xs dark:bg-slate-800 dark:text-slate-200",children:(0,o.jsx)("span",{className:"truncate font-medium text-slate-900 dark:text-slate-100",children:T})}),(0,o.jsxs)("div",{className:"ml-auto flex items-center gap-1.5",children:[(0,o.jsx)(st,{count:i.attachments.length,label:a.attachments}),(()=>{let _=e.sourceType??i?.sourceType,O=He(_,d);return O?(0,o.jsx)("span",{className:J("inline-flex shrink-0 items-center rounded px-2 py-0.5 font-semibold text-[10px] tracking-wide",O.badgeClassName),children:O.label}):null})(),(0,o.jsx)("button",{type:"button",title:i.isStarred?"\u30B9\u30BF\u30FC\u3092\u5916\u3059":"\u30B9\u30BF\u30FC\u3092\u4ED8\u3051\u308B","aria-label":i.isStarred?"\u30B9\u30BF\u30FC\u3092\u5916\u3059":"\u30B9\u30BF\u30FC\u3092\u4ED8\u3051\u308B","aria-pressed":i.isStarred,"data-list-star-button":e.reportHubId,onClick:A,onPointerDown:E,onPointerUp:E,className:"flex h-6 w-6 items-center justify-center rounded-full transition-colors hover:bg-slate-200 dark:hover:bg-slate-700",children:i.isStarred?(0,o.jsx)(Nr.default,{className:"h-3.5 w-3.5 fill-yellow-400 text-yellow-400"}):(0,o.jsx)(Nr.default,{className:"h-3.5 w-3.5 text-slate-300 dark:text-slate-500"})}),(0,o.jsx)("button",{type:"button",title:i.isRead?"\u672A\u8AAD\u306B\u3059\u308B":"\u65E2\u8AAD\u306B\u3059\u308B","aria-label":i.isRead?"\u672A\u8AAD\u306B\u3059\u308B":"\u65E2\u8AAD\u306B\u3059\u308B","aria-pressed":i.isRead,"data-list-read-button":e.reportHubId,onClick:z,onPointerDown:E,onPointerUp:E,className:"flex h-6 w-6 items-center justify-center rounded-full transition-colors hover:bg-slate-200 dark:hover:bg-slate-700",children:i.isRead?(0,o.jsx)(Sn.default,{className:"h-3.5 w-3.5 text-blue-500"}):(0,o.jsx)(Je,{className:"text-xs"})})]})]}),(0,o.jsx)("div",{className:"space-y-1 text-slate-700 text-sm leading-relaxed dark:text-slate-200",children:U.length>0?U.map(({line:_,key:O})=>(0,o.jsx)("p",{className:"wrap-break-word line-clamp-1",children:_},O)):(0,o.jsx)("p",{children:"\u5185\u5BB9\u306F\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093"})})]})})});Tn.displayName="ListReportItem";var Ar=require("react");var kn=ne(require("lucide-react/dist/esm/icons/plus.js")),En=ne(require("lucide-react/dist/esm/icons/refresh-cw.js")),Pn=ne(require("lucide-react/dist/esm/icons/rotate-cw.js")),xe=require("react"),An=require("react-router");var Mt=ne(require("@radix-ui/react-switch")),Nn=ne(require("react"));var Er=require("react/jsx-runtime"),Kt=Nn.forwardRef(({className:e,...t},r)=>(0,Er.jsx)(Mt.Root,{className:J("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:(0,Er.jsx)(Mt.Thumb,{className:J("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Kt.displayName=Mt.Root.displayName;var W=require("react/jsx-runtime"),ea="px-2 py-1 font-medium text-slate-600 text-xs transition-colors rounded-sm data-[state=active]:bg-white data-[state=active]:text-slate-900 data-[state=active]:shadow-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",Pr=({userId:e})=>{let[t,r]=(0,xe.useState)(!1),{title:n,renderHeader:s,showDevControls:a}=q(),{isSseEnabled:d,toggleSse:p,createReport:m,items:u,refetchData:i,clearCacheAndRefetch:y}=be(),[R]=(0,An.useSearchParams)(),g=Qe(u.length),D=(0,xe.useRef)(0),N=(0,xe.useRef)({topItem:null,anchorReportHubId:null,measuredHeights:new Map}),[C,U]=(0,xe.useState)(()=>u.length===0?null:u[0].reportHubId),T=(0,xe.useRef)(!1);(0,xe.useEffect)(()=>{!T.current&&u.length>0&&(T.current=!0,U(O=>O??u[0].reportHubId))},[u]);let M=async()=>{await i()},A=async()=>{await y()},z=async()=>{let k=R.get("businessDate")||er(),B=await m(k);U(B)};(0,xe.useEffect)(()=>{localStorage.getItem("daily-report-auto-read")==="true"&&r(!0)},[]);let E=O=>{r(O),localStorage.setItem("daily-report-auto-read",String(O))},_=(0,xe.useMemo)(()=>[{value:"list",label:"\u{1F4C4} List",content:(0,W.jsx)(kr,{dailyReportItems:u,autoMarkRead:t,selectedReportHubId:C,onSelectItem:U,userId:e,scrollOffsetRef:D})},{value:"tree",label:"\u{1F333} Tree",content:(0,W.jsx)("div",{className:"flex flex-1 items-center justify-center rounded-lg border border-slate-300 border-dashed bg-white p-6 text-slate-500 transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:text-slate-300",children:"Tree \u30D3\u30E5\u30FC\u306F\u73FE\u5728\u6E96\u5099\u4E2D\u3067\u3059"})},{value:"detailList",label:"\u{1F4CB} DetailList",content:(0,W.jsx)(Cr,{dailyReportItems:u,userId:e,selectedItemId:C,onSelectItem:U,scrollRestoreRef:N})}],[u,t,C,e]);return(0,W.jsxs)(W.Fragment,{children:[s({title:n,annotation:(0,W.jsxs)("div",{className:"flex flex-wrap items-center gap-2 leading-1",children:[(0,W.jsx)(Pt,{}),(0,W.jsxs)("span",{className:"tabular-nums",children:["\u7DCF\u4EF6\u6570: ",g.toLocaleString()," \u4EF6"]}),(0,W.jsxs)("span",{children:["\u30C7\u30D0\u30A6\u30F3\u30B9: ",_e," ms"]})]})}),(0,W.jsx)("div",{className:"h-full bg-slate-50 dark:bg-slate-950",children:(0,W.jsx)("div",{className:"flex h-full w-full max-w-6xl flex-1 flex-col p-1",children:(0,W.jsxs)(Gt,{defaultValue:"list",className:"flex h-full flex-1 flex-col",children:[(0,W.jsxs)("div",{className:"flex items-center justify-between gap-1.5 rounded-md border border-slate-200/80 bg-slate-100/60 p-0.5 transition-colors dark:border-slate-800 dark:bg-slate-900/60 dark:text-slate-200",children:[(0,W.jsx)(At,{className:"scrollbar-none flex h-auto touch-pan-x flex-nowrap gap-0.5 overflow-x-auto overflow-y-hidden bg-transparent p-0",children:_.map(({value:O,label:k})=>(0,W.jsx)(Lt,{value:O,className:ea,children:k},O))}),(0,W.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5 px-1",children:[(0,W.jsxs)(Ee,{size:"sm",onClick:z,className:"flex h-6 items-center gap-1 rounded bg-amber-600 px-2 font-medium text-[11px] text-white shadow-xs hover:bg-amber-700 dark:bg-amber-600 dark:hover:bg-amber-700",title:"\u65E5\u5831\u3092\u4F5C\u6210",children:[(0,W.jsx)(kn.default,{className:"h-3 w-3"}),(0,W.jsx)("span",{children:"\u65E5\u5831\u4F5C\u6210"})]}),a&&(0,W.jsxs)("div",{className:"hidden h-5.5 items-center gap-1 rounded border border-amber-300/70 bg-amber-50/60 px-1 text-slate-600 sm:flex dark:border-amber-700/50 dark:bg-amber-950/40 dark:text-slate-300",title:"\u958B\u767A\u74B0\u5883\u9650\u5B9A\u30B3\u30F3\u30C8\u30ED\u30FC\u30EB","data-testid":"dev-controls-toolbox",children:[(0,W.jsx)("span",{className:"select-none font-bold font-mono text-[9px] text-amber-800 uppercase dark:text-amber-200",children:"dev"}),(0,W.jsx)("div",{className:"-mx-0.5 flex items-center",title:"SSE \u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u540C\u671F\u5207\u66FF",children:(0,W.jsx)(Kt,{id:"sse-mode",checked:d,onCheckedChange:p,className:"origin-center scale-50"})}),(0,W.jsx)(Ee,{variant:"ghost",size:"icon",onClick:M,className:"h-4 w-4 p-0 text-slate-600 hover:bg-amber-200/60 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-amber-800/60 dark:hover:text-slate-100",title:"\u30C7\u30FC\u30BF\u518D\u53D6\u5F97 (\u30EA\u30ED\u30FC\u30C9)","data-testid":"dev-reload-btn",children:(0,W.jsx)(Pn.default,{className:"h-2.5 w-2.5"})}),(0,W.jsx)(Ee,{variant:"ghost",size:"icon",onClick:A,className:"h-4 w-4 p-0 text-amber-800 hover:bg-amber-200/60 hover:text-amber-950 dark:text-amber-300 dark:hover:bg-amber-800/60 dark:hover:text-amber-100",title:"\u30AD\u30E3\u30C3\u30B7\u30E5\u7834\u68C4 & \u518D\u53D6\u5F97","data-testid":"dev-clear-cache-btn",children:(0,W.jsx)(En.default,{className:"h-2.5 w-2.5"})})]}),(0,W.jsxs)("div",{className:"flex items-center gap-0.5 pl-0.5",title:"\u65E5\u5831\u95B2\u89A7\u6642\u306E\u81EA\u52D5\u65E2\u8AAD\u51E6\u7406\u5207\u66FF",children:[(0,W.jsx)(Kt,{id:"auto-read-mode",checked:t,onCheckedChange:E,className:"origin-center scale-50"}),(0,W.jsx)(kt,{htmlFor:"auto-read-mode",className:"cursor-pointer select-none text-[10px] text-slate-500 dark:text-slate-400",children:"\u81EA\u52D5\u65E2\u8AAD"})]})]})]}),_.map(({value:O,content:k})=>(0,W.jsx)(Ze,{value:O,className:"mt-0 flex h-full min-h-0 flex-1 flex-col",children:k},O))]})})})]})};var Y=require("react/jsx-runtime"),Ln=()=>{let{title:e,renderHeader:t}=q();return(0,Y.jsxs)(Y.Fragment,{children:[t({title:e,annotation:(0,Y.jsx)("span",{className:"font-bold text-red-500",children:"Error"})}),(0,Y.jsx)("div",{className:"h-full bg-slate-50 p-2",children:(0,Y.jsx)("div",{className:"mx-auto flex h-full w-full max-w-6xl flex-1 flex-col gap-6",children:(0,Y.jsxs)("div",{className:"flex h-full flex-1 flex-col items-center justify-center gap-4 rounded-lg border border-red-200 bg-white p-4 text-slate-500 shadow-sm dark:border-red-900 dark:bg-slate-900/70 dark:text-slate-400",children:[(0,Y.jsx)("p",{className:"font-medium text-red-600",children:"\u65E5\u5831\u30C7\u30FC\u30BF\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002"}),(0,Y.jsx)("button",{type:"button","data-testid":"daily-report-load-error-retry",onClick:()=>It(),className:"rounded bg-slate-100 px-4 py-2 text-slate-700 text-sm hover:bg-slate-200 dark:bg-slate-800 dark:text-slate-300 dark:hover:bg-slate-700",children:"\u518D\u8AAD\u307F\u8FBC\u307F"})]})})})]})},Mn=()=>{let{title:e,renderHeader:t}=q();return(0,Y.jsxs)(Y.Fragment,{children:[t({title:e,annotation:(0,Y.jsxs)("div",{className:"flex flex-wrap items-center gap-2 leading-none",children:[(0,Y.jsx)(Pt,{}),(0,Y.jsx)("span",{children:"\u7DCF\u4EF6\u6570: \u8AAD\u307F\u8FBC\u307F\u4E2D..."}),(0,Y.jsxs)("span",{children:["\u30C7\u30D0\u30A6\u30F3\u30B9: ",_e," ms"]})]})}),(0,Y.jsx)("div",{className:"h-full bg-slate-50 p-2",children:(0,Y.jsx)("div",{className:"mx-auto flex h-full w-full max-w-6xl flex-1 flex-col gap-6",children:(0,Y.jsx)("div",{className:"flex h-full flex-1 items-center justify-center rounded-lg border border-slate-200 bg-white text-slate-500 shadow-sm dark:border-slate-700 dark:bg-slate-900/70 dark:text-slate-300",children:"\u65E5\u5831 ID \u3092\u8AAD\u307F\u8FBC\u307F\u4E2D\u3067\u3059..."})})})]})},ta=({user:e,userId:t})=>{let{apiBasePath:r}=q(),n=Fe();(0,Ar.useEffect)(()=>{wt({apiBasePath:r,userKey:t??null})},[r,t]),(0,Ar.useEffect)(()=>{n.phase==="auth-required"&&gr()},[n.phase]);let s=n.items.length>0||n.phase==="complete";return(0,Y.jsx)(Dr,{children:(0,Y.jsx)(Sr,{user:e,initialItems:n.items,userId:t,children:s?(0,Y.jsx)(Pr,{userId:t}):n.phase==="failed"?(0,Y.jsx)(Ln,{}):(0,Y.jsx)(Mn,{})},t??"anonymous")})},ra=({config:e,...t})=>(0,Y.jsx)(Xt,{config:e,children:(0,Y.jsx)(ta,{...t})});var na=({actionResult:e,actionStatus:t,currentUrl:r,defaultShouldRevalidate:n,formAction:s,formData:a,formEncType:d,formMethod:p,json:m,nextUrl:u,text:i})=>{if(!n)return!1;if(!(r.pathname===u.pathname&&r.search===u.search&&r.hash===u.hash))return n;if(a){let g=a.get("intent");if(g==="toggleRead"||g==="toggleStar"||g==="addComment"||g==="deleteComment"||g==="create"||g==="update"||g==="publish"||g==="delete")return!1}return e!==void 0||t!==void 0||s!==void 0||a!==void 0||d!==void 0||p!==void 0||m!==void 0||i!==void 0?n:!1},sa=e=>{let t=async r=>{xr();let n=await r.serverLoader(),s=n.userId;return yr({apiBasePath:e?.apiBasePath,userKey:typeof s=="string"?s:null}),n};return t.hydrate=!0,t};0&&(module.exports={BusinessDayThumbOverlay,CONTENT_DRAG_POINTER_INPUTS,DAILY_REPORT_FETCH_DEBOUNCE_MS,DEFAULT_ITEM_HEIGHT,DailyReportActionProvider,DailyReportAttachmentIndicator,DailyReportAttachmentList,DailyReportCache,DailyReportCommentForm,DailyReportCommentList,DailyReportConfigProvider,DailyReportDetailList,DailyReportEditForm,DailyReportErrorProvider,DailyReportIdsStreamClient,DailyReportIdsStreamStatus,DailyReportList,DailyReportLoadError,DailyReportLoading,DailyReportPage,DailyReportPostedComment,DailyReportResolvedContent,EMPTY_DETAIL,EMPTY_ITEM,FAST_SCROLL_INERTIA_OPTIONS,FAST_SCROLL_WHEEL_MULTIPLIER,ITEM_CONTAINER_HEIGHT,ITEM_VERTICAL_PADDING,MAX_PREVIEW_LINES,PREFETCH_LOOKAHEAD,PREFETCH_MAX_DATES,SCROLL_BAR_WIDTH,SSE_INITIAL_CONNECT_DEFER_MS,TAP_SCROLL_CIRCLE_OPTIONS,UnreadIndicator,VIRTUAL_SCROLL_OVERSCAN_COUNT,WHEEL_RESET_TIMEOUT_MS,acquireMutationLock,applyBroadcastReportUpdate,applyDailyReportServerUpdates,bootstrapDailyReportIdsStreamSession,clearDailyReportCache,createDailyReportClientLoader,dailyReportShouldRevalidate,defaultDailyReportClientConfig,defaultDailyReportFieldLabels,deleteDailyReportCache,ensureDailyReportIdsStreamSession,getCachedReport,getDailyReportIdsStreamSessionUserKey,primeDailyReportIdsStreamSession,refreshDailyReportIdsStream,registerRecentDeletion,releaseMutationLock,reloadDocument,removeDailyReportIdsStreamItem,resetDailyReportIdsStreamSessionForTesting,resolveSourceTypeConfig,retryDailyReportIdsStream,subscribeCacheReady,updateDailyReportCache,upsertDailyReportIdsStreamItem,useAnimatedNumber,useDailyReportActionContext,useDailyReportComments,useDailyReportConfig,useDailyReportDetail,useDailyReportErrorSurface,useDailyReportIdsStream,useDailyReportPrefetch,useDailyReportSseConnection,useDynamicViewportHeight,writeCache});
|
|
8
|
-
//# sourceMappingURL=client.js.map
|
package/dist/client.mjs
CHANGED
|
@@ -5,4 +5,3 @@ import{jsx as qt}from"react/jsx-runtime";var at=({orientation:e,thumbCenter:t,la
|
|
|
5
5
|
`).replace(/<[^>]+>/g,""):null,[e]),ge=async()=>{if(!e)return;let S=!e.isStarred;try{await l(e.reportHubId,S,e.date??"")}catch{}},oe=async()=>{if(e&&confirm("\u672C\u5F53\u306B\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F"))try{await g(e.reportHubId,e.date??"")}catch{alert("\u524A\u9664\u306B\u5931\u6557\u3057\u307E\u3057\u305F")}};if(r)return c("p",{className:"text-red-500",children:r.message});let re=!e,ce=e?.isStarred??!1,G=e?.isRead??!1,me=!!(m&&e?.userId===m),Te=T.length>0;return X("div",{className:"relative space-y-4 text-slate-700 dark:text-slate-200",onDoubleClick:u,children:[!re&&e&&X("div",{className:"absolute top-0 right-2 z-10 flex items-center justify-end gap-3",children:[c("button",{type:"button",onClick:()=>U(!1),className:"rounded text-lg leading-none transition-transform focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 active:scale-95",title:G?"\u672A\u8AAD\u306B\u3059\u308B":"\u65E2\u8AAD\u306B\u3059\u308B","data-detail-read-button":e.reportHubId,children:G?c("span",{className:"text-slate-300 hover:text-blue-500",children:"\u2713"}):c(Qe,{className:"hover:text-blue-600"})}),c("button",{type:"button",onClick:ge,className:"rounded text-lg leading-none transition-transform focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 active:scale-95",title:ce?"\u30B9\u30BF\u30FC\u3092\u5916\u3059":"\u30B9\u30BF\u30FC\u3092\u4ED8\u3051\u308B","data-detail-star-button":e.reportHubId,children:ce?c("span",{className:"text-yellow-400",children:"\u2605"}):c("span",{className:"text-slate-300 hover:text-yellow-400",children:"\u2606"})}),me&&c("button",{type:"button",onClick:oe,"data-detail-delete-button":e.reportHubId,className:"rounded text-lg leading-none transition-transform focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2 active:scale-95",title:"\u524A\u9664\u3059\u308B",children:c(Ea,{className:"h-4 w-4 text-slate-300 hover:text-red-500"})})]}),X("div",{className:"flex items-baseline",children:[c("span",{className:"w-24 shrink-0 font-semibold text-slate-500 text-xs uppercase tracking-wide dark:text-slate-300",children:h.subject}),c("div",{className:"flex-1 pr-20",children:re?c(Ue,{className:"w-3/4"}):c("span",{className:"fade-in animate-in text-sm duration-500",children:ie(e?.subject)})})]}),X("div",{className:"flex items-baseline",children:[c("span",{className:"w-24 shrink-0 font-semibold text-slate-500 text-xs uppercase tracking-wide dark:text-slate-300",children:h.customer}),c("div",{className:"flex-1",children:re?c(Ue,{className:"w-1/2"}):c("span",{className:"fade-in animate-in text-sm duration-500",children:ie(e?.customerName)})})]}),X("div",{className:"space-y-2",children:[c("div",{className:"font-semibold text-slate-500 text-xs uppercase tracking-wide dark:text-slate-300",children:h.content}),c("div",{className:"min-h-22 rounded-lg bg-slate-50 p-3 text-sm leading-relaxed dark:bg-slate-800/40",children:re?X("div",{className:"space-y-2",children:[c(Ue,{className:"w-full"}),c(Ue,{className:"w-11/12"}),c(Ue,{className:"w-4/5"})]}):te?c("div",{className:"fade-in animate-in whitespace-pre-wrap duration-500",children:te}):c("p",{className:"fade-in animate-in text-slate-500 duration-500 dark:text-slate-400",children:"\u5185\u5BB9\u306F\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002"})})]}),X("div",{className:"flex items-baseline",children:[c("span",{className:"w-24 shrink-0 font-semibold text-slate-500 text-xs uppercase tracking-wide dark:text-slate-300",children:h.visitTime}),c("div",{className:"flex-1",children:re?c(Ue,{className:"w-1/3"}):X("span",{className:"fade-in animate-in text-sm duration-500",children:[ie(e?.visitTimeFrom)," ",e?.visitTimeFrom&&e?.visitTimeTo?"-":""," ",ie(e?.visitTimeTo)]})})]}),e&&c(dt,{attachments:e.attachments}),e&&X("div",{className:"fade-in animate-in space-y-2 border-slate-100 border-t pt-4 duration-500 dark:border-slate-800",children:[c("div",{className:"font-semibold text-slate-500 text-xs uppercase tracking-wide dark:text-slate-300",children:h.comments}),Te&&c(ct,{comments:T,reportHubId:e.reportHubId,businessDate:e.date??"",onDeleteComment:F,pendingDeleteId:C,onPendingDeleteIdChange:A,resolvedIdMap:P}),N&&c(mt,{reportHubId:e.reportHubId,businessDate:e.date??"",onAddComment:we})]})]})},Fa=({isOpen:e,selectedItem:t,onClose:r,autoMarkRead:n=!1,userId:s})=>{let a=Q(null),i=Q(null),{isBlocked:m,requestBlock:u,reset:l}=Ia(),{report:o,error:g,isLoading:R}=Oe(t?.reportHubId??-1,t?.businessDate??null),D=Ta(e,t?{item:t,detail:{report:o,error:g,isLoading:R}}:null)?.item??null,{overlayRef:T,overlayStyle:I,attemptClose:F,isSwiping:C}=Ca({isOpen:e,onClose:r,isCloseBlocked:xe(()=>m,[m]),skipWhenTextSelected:!0}),A=bn(()=>F());return ae(()=>{e?requestAnimationFrame(()=>i.current?.focus()):(a.current?.contains(document.activeElement)&&document.activeElement.blur(),l())},[e,l]),D?X("div",{ref:a,"data-daily-report-mobile-overlay":"true",className:`fixed top-0 bottom-0 left-0 z-[100] flex touch-manipulation transition-[visibility] duration-200 ${e?"visible":"invisible"} ${e&&!C?"pointer-events-auto":"pointer-events-none"}`,style:{right:"var(--aqdr-overlay-right, 0px)",transition:"right 0.5s, visibility 0.2s"},"aria-hidden":!e,children:[c("button",{type:"button","aria-label":"\u80CC\u666F\u3092\u30BF\u30C3\u30D7\u3057\u3066\u9589\u3058\u308B",className:`absolute inset-0 touch-manipulation bg-slate-900/50 transition-opacity duration-200 focus:outline-none ${e?"opacity-100":"opacity-0"}`,...A}),c("aside",{role:"dialog","aria-modal":"true","aria-label":"\u65E5\u5831\u8A73\u7D30",className:`relative ml-auto flex h-full w-full max-w-full transform touch-none bg-white shadow-xl transition-transform duration-200 ease-out dark:bg-slate-900/95 ${e?"pointer-events-auto":"pointer-events-none"}`,ref:T,onKeyDown:P=>{P.key==="Escape"&&(P.preventDefault(),F())},style:I,children:X("div",{className:"flex h-full w-full flex-col gap-3 p-4",children:[c(Sa.Provider,{value:{isBlocked:m,requestBlock:u},children:c(gn,{selectedItem:D,autoMarkRead:n,isActive:e,userId:s})}),c("div",{className:"mt-2 flex justify-start",children:c("button",{type:"button",ref:i,"data-overlay-interactive":"true",className:"touch-manipulation rounded-full border border-slate-300 px-4 py-2 font-medium text-slate-600 text-sm shadow-sm transition-colors hover:bg-slate-100 dark:border-slate-600 dark:text-slate-200 dark:hover:bg-slate-800",onClick:()=>F(),children:"\u9589\u3058\u308B"})})]})})]}):null},Ba=e=>e?e.replace(/<br\s*\/?\s*>/gi,`
|
|
6
6
|
`).replace(/<\/p>/gi,`
|
|
7
7
|
`).replace(/<[^>]+>/g,"").split(/\r?\n/).map(t=>t.replace(/\u3000/g," ").trim()).filter(t=>t.length>0).slice(0,Nr):[],yn=Pa(({item:e,index:t,setSize:r,isActive:n,onSelect:s})=>{let{fieldLabels:a,sourceTypeConfigs:i}=W(),{toggleStar:m,toggleRead:u,removeStaleItem:l}=he(),{report:o,error:g,isLoading:R,isRefetching:h}=Oe(e.reportHubId,e.businessDate),D={role:"listitem","aria-posinset":t+1,"aria-setsize":r},T=Q(!1);h&&(T.current=!0),ae(()=>{!(o||R||h||g)&&T.current&&e.reportHubId>0&&l(e.reportHubId)},[o,R,h,g,e.reportHubId,l]);let I=bn(()=>s(e.reportHubId));if(g)return c("div",{...D,className:"px-2 pb-3",style:{height:je},children:c("div",{className:"flex h-full items-center justify-center rounded-2xl border border-red-200 bg-red-50 p-4 text-red-700 text-sm dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-300",children:X("p",{children:["\u65E5\u5831 ",e.reportHubId.toLocaleString()," \u306E\u6982\u8981\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002"]})})});if(R)return c(_a,{...D});if(!o)return c("div",{...D,className:"px-2 pb-3",style:{height:je},children:c("div",{className:"flex h-full items-center justify-center rounded-2xl border border-slate-200 bg-slate-50 p-4 text-slate-500 text-sm dark:border-slate-700 dark:bg-slate-900/40 dark:text-slate-400",children:c("p",{children:"\u65E5\u5831\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093"})})});let F=Ba(o.content??null).map((L,M)=>({line:L,key:`${e.reportHubId}-line-${M}`})),C=ie(o.employeeName??o.author),A=le(o.date),P=async L=>{L.stopPropagation();let M=!o.isStarred;try{await m(o.reportHubId,M,o.date??"")}catch{}},U=async L=>{L.stopPropagation();let M=!o.isRead;try{await u(o.reportHubId,M,o.date??"")}catch{}},k=L=>{L.stopPropagation()};return c("div",{...D,className:"px-2 pb-3",style:{height:je},children:X("div",{"data-daily-report-button":e.reportHubId,className:`flex h-full w-full in-[[data-scrolling]]:transform-none cursor-pointer select-none flex-col rounded-2xl border in-[[data-scrolling]]:border-slate-200 bg-white p-4 text-left in-[[data-scrolling]]:shadow-sm shadow-sm in-[[data-scrolling]]:transition-none transition-[transform,border-color,box-shadow] duration-200 hover:-translate-y-0.5 hover:border-blue-300 hover:shadow-lg dark:bg-slate-900/70 ${n?"border-blue-300 shadow-md ring-2 ring-blue-200 dark:border-blue-500/70 dark:ring-blue-500/40":"border-slate-200 dark:border-slate-700"}`,style:{touchAction:"manipulation"},role:"button",tabIndex:0,"aria-current":n?"true":void 0,"aria-pressed":n,"aria-label":`${A} ${C}`,...I,children:[X("div",{className:"mb-3 flex items-center gap-3 text-slate-600 text-sm",children:[c("span",{className:"inline-flex shrink-0 items-center rounded-full bg-slate-100 px-3 py-1 font-semibold text-xs dark:bg-slate-800 dark:text-slate-200",children:c("span",{className:"whitespace-nowrap font-medium text-slate-900 dark:text-slate-100",children:A})}),c("span",{className:"inline-flex min-w-0 max-w-full items-center rounded-full bg-slate-100 px-3 py-1 font-semibold text-xs dark:bg-slate-800 dark:text-slate-200",children:c("span",{className:"truncate font-medium text-slate-900 dark:text-slate-100",children:C})}),X("div",{className:"ml-auto flex items-center gap-1.5",children:[c(ot,{count:o.attachments.length,label:a.attachments}),(()=>{let L=e.sourceType??o?.sourceType,M=Le(L,i);return M?c("span",{className:q("inline-flex shrink-0 items-center rounded px-2 py-0.5 font-semibold text-[10px] tracking-wide",M.badgeClassName),children:M.label}):null})(),c("button",{type:"button",title:o.isStarred?"\u30B9\u30BF\u30FC\u3092\u5916\u3059":"\u30B9\u30BF\u30FC\u3092\u4ED8\u3051\u308B","aria-label":o.isStarred?"\u30B9\u30BF\u30FC\u3092\u5916\u3059":"\u30B9\u30BF\u30FC\u3092\u4ED8\u3051\u308B","aria-pressed":o.isStarred,"data-list-star-button":e.reportHubId,onClick:P,onPointerDown:k,onPointerUp:k,className:"flex h-6 w-6 items-center justify-center rounded-full transition-colors hover:bg-slate-200 dark:hover:bg-slate-700",children:o.isStarred?c(fn,{className:"h-3.5 w-3.5 fill-yellow-400 text-yellow-400"}):c(fn,{className:"h-3.5 w-3.5 text-slate-300 dark:text-slate-500"})}),c("button",{type:"button",title:o.isRead?"\u672A\u8AAD\u306B\u3059\u308B":"\u65E2\u8AAD\u306B\u3059\u308B","aria-label":o.isRead?"\u672A\u8AAD\u306B\u3059\u308B":"\u65E2\u8AAD\u306B\u3059\u308B","aria-pressed":o.isRead,"data-list-read-button":e.reportHubId,onClick:U,onPointerDown:k,onPointerUp:k,className:"flex h-6 w-6 items-center justify-center rounded-full transition-colors hover:bg-slate-200 dark:hover:bg-slate-700",children:o.isRead?c(ka,{className:"h-3.5 w-3.5 text-blue-500"}):c(Qe,{className:"text-xs"})})]})]}),c("div",{className:"space-y-1 text-slate-700 text-sm leading-relaxed dark:text-slate-200",children:F.length>0?F.map(({line:L,key:M})=>c("p",{className:"wrap-break-word line-clamp-1",children:L},M)):c("p",{children:"\u5185\u5BB9\u306F\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093"})})]})})});yn.displayName="ListReportItem";import{useEffect as Sn}from"react";import $a from"lucide-react/dist/esm/icons/plus.js";import Va from"lucide-react/dist/esm/icons/refresh-cw.js";import za from"lucide-react/dist/esm/icons/rotate-cw.js";import{useEffect as Rn,useMemo as ja,useRef as cr,useState as Dn}from"react";import{useSearchParams as Wa}from"react-router";import*as nt from"@radix-ui/react-switch";import*as vn from"react";import{jsx as xn}from"react/jsx-runtime";var Gt=vn.forwardRef(({className:e,...t},r)=>xn(nt.Root,{className:q("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:xn(nt.Thumb,{className:q("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Gt.displayName=nt.Root.displayName;import{Fragment as qa,jsx as Z,jsxs as De}from"react/jsx-runtime";var Ga="px-2 py-1 font-medium text-slate-600 text-xs transition-colors rounded-sm data-[state=active]:bg-white data-[state=active]:text-slate-900 data-[state=active]:shadow-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",wn=({userId:e})=>{let[t,r]=Dn(!1),{title:n,renderHeader:s,showDevControls:a}=W(),{isSseEnabled:i,toggleSse:m,createReport:u,items:l,refetchData:o,clearCacheAndRefetch:g}=he(),[R]=Wa(),h=et(l.length),D=cr(0),T=cr({topItem:null,anchorReportHubId:null,measuredHeights:new Map}),[I,F]=Dn(()=>l.length===0?null:l[0].reportHubId),C=cr(!1);Rn(()=>{!C.current&&l.length>0&&(C.current=!0,F(M=>M??l[0].reportHubId))},[l]);let A=async()=>{await o()},P=async()=>{await g()},U=async()=>{let N=R.get("businessDate")||Jt(),O=await u(N);F(O)};Rn(()=>{localStorage.getItem("daily-report-auto-read")==="true"&&r(!0)},[]);let k=M=>{r(M),localStorage.setItem("daily-report-auto-read",String(M))},L=ja(()=>[{value:"list",label:"\u{1F4C4} List",content:Z(hn,{dailyReportItems:l,autoMarkRead:t,selectedReportHubId:I,onSelectItem:F,userId:e,scrollOffsetRef:D})},{value:"tree",label:"\u{1F333} Tree",content:Z("div",{className:"flex flex-1 items-center justify-center rounded-lg border border-slate-300 border-dashed bg-white p-6 text-slate-500 transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:text-slate-300",children:"Tree \u30D3\u30E5\u30FC\u306F\u73FE\u5728\u6E96\u5099\u4E2D\u3067\u3059"})},{value:"detailList",label:"\u{1F4CB} DetailList",content:Z(ln,{dailyReportItems:l,userId:e,selectedItemId:I,onSelectItem:F,scrollRestoreRef:T})}],[l,t,I,e]);return De(qa,{children:[s({title:n,annotation:De("div",{className:"flex flex-wrap items-center gap-2 leading-1",children:[Z(Vt,{}),De("span",{className:"tabular-nums",children:["\u7DCF\u4EF6\u6570: ",h.toLocaleString()," \u4EF6"]}),De("span",{children:["\u30C7\u30D0\u30A6\u30F3\u30B9: ",_e," ms"]})]})}),Z("div",{className:"h-full bg-slate-50 dark:bg-slate-950",children:Z("div",{className:"flex h-full w-full max-w-6xl flex-1 flex-col p-1",children:De(jt,{defaultValue:"list",className:"flex h-full flex-1 flex-col",children:[De("div",{className:"flex items-center justify-between gap-1.5 rounded-md border border-slate-200/80 bg-slate-100/60 p-0.5 transition-colors dark:border-slate-800 dark:bg-slate-900/60 dark:text-slate-200",children:[Z(tt,{className:"scrollbar-none flex h-auto touch-pan-x flex-nowrap gap-0.5 overflow-x-auto overflow-y-hidden bg-transparent p-0",children:L.map(({value:M,label:N})=>Z(rt,{value:M,className:Ga,children:N},M))}),De("div",{className:"flex shrink-0 items-center gap-1.5 px-1",children:[De(Ie,{size:"sm",onClick:U,className:"flex h-6 items-center gap-1 rounded bg-amber-600 px-2 font-medium text-[11px] text-white shadow-xs hover:bg-amber-700 dark:bg-amber-600 dark:hover:bg-amber-700",title:"\u65E5\u5831\u3092\u4F5C\u6210",children:[Z($a,{className:"h-3 w-3"}),Z("span",{children:"\u65E5\u5831\u4F5C\u6210"})]}),a&&De("div",{className:"hidden h-5.5 items-center gap-1 rounded border border-amber-300/70 bg-amber-50/60 px-1 text-slate-600 sm:flex dark:border-amber-700/50 dark:bg-amber-950/40 dark:text-slate-300",title:"\u958B\u767A\u74B0\u5883\u9650\u5B9A\u30B3\u30F3\u30C8\u30ED\u30FC\u30EB","data-testid":"dev-controls-toolbox",children:[Z("span",{className:"select-none font-bold font-mono text-[9px] text-amber-800 uppercase dark:text-amber-200",children:"dev"}),Z("div",{className:"-mx-0.5 flex items-center",title:"SSE \u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u540C\u671F\u5207\u66FF",children:Z(Gt,{id:"sse-mode",checked:i,onCheckedChange:m,className:"origin-center scale-50"})}),Z(Ie,{variant:"ghost",size:"icon",onClick:A,className:"h-4 w-4 p-0 text-slate-600 hover:bg-amber-200/60 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-amber-800/60 dark:hover:text-slate-100",title:"\u30C7\u30FC\u30BF\u518D\u53D6\u5F97 (\u30EA\u30ED\u30FC\u30C9)","data-testid":"dev-reload-btn",children:Z(za,{className:"h-2.5 w-2.5"})}),Z(Ie,{variant:"ghost",size:"icon",onClick:P,className:"h-4 w-4 p-0 text-amber-800 hover:bg-amber-200/60 hover:text-amber-950 dark:text-amber-300 dark:hover:bg-amber-800/60 dark:hover:text-amber-100",title:"\u30AD\u30E3\u30C3\u30B7\u30E5\u7834\u68C4 & \u518D\u53D6\u5F97","data-testid":"dev-clear-cache-btn",children:Z(Va,{className:"h-2.5 w-2.5"})})]}),De("div",{className:"flex items-center gap-0.5 pl-0.5",title:"\u65E5\u5831\u95B2\u89A7\u6642\u306E\u81EA\u52D5\u65E2\u8AAD\u51E6\u7406\u5207\u66FF",children:[Z(Gt,{id:"auto-read-mode",checked:t,onCheckedChange:k,className:"origin-center scale-50"}),Z(Je,{htmlFor:"auto-read-mode",className:"cursor-pointer select-none text-[10px] text-slate-500 dark:text-slate-400",children:"\u81EA\u52D5\u65E2\u8AAD"})]})]})]}),L.map(({value:M,content:N})=>Z(Be,{value:M,className:"mt-0 flex h-full min-h-0 flex-1 flex-col",children:N},M))]})})})]})};import{Fragment as In,jsx as ne,jsxs as st}from"react/jsx-runtime";var Ka=()=>{let{title:e,renderHeader:t}=W();return st(In,{children:[t({title:e,annotation:ne("span",{className:"font-bold text-red-500",children:"Error"})}),ne("div",{className:"h-full bg-slate-50 p-2",children:ne("div",{className:"mx-auto flex h-full w-full max-w-6xl flex-1 flex-col gap-6",children:st("div",{className:"flex h-full flex-1 flex-col items-center justify-center gap-4 rounded-lg border border-red-200 bg-white p-4 text-slate-500 shadow-sm dark:border-red-900 dark:bg-slate-900/70 dark:text-slate-400",children:[ne("p",{className:"font-medium text-red-600",children:"\u65E5\u5831\u30C7\u30FC\u30BF\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002"}),ne("button",{type:"button","data-testid":"daily-report-load-error-retry",onClick:()=>Mt(),className:"rounded bg-slate-100 px-4 py-2 text-slate-700 text-sm hover:bg-slate-200 dark:bg-slate-800 dark:text-slate-300 dark:hover:bg-slate-700",children:"\u518D\u8AAD\u307F\u8FBC\u307F"})]})})})]})},Ya=()=>{let{title:e,renderHeader:t}=W();return st(In,{children:[t({title:e,annotation:st("div",{className:"flex flex-wrap items-center gap-2 leading-none",children:[ne(Vt,{}),ne("span",{children:"\u7DCF\u4EF6\u6570: \u8AAD\u307F\u8FBC\u307F\u4E2D..."}),st("span",{children:["\u30C7\u30D0\u30A6\u30F3\u30B9: ",_e," ms"]})]})}),ne("div",{className:"h-full bg-slate-50 p-2",children:ne("div",{className:"mx-auto flex h-full w-full max-w-6xl flex-1 flex-col gap-6",children:ne("div",{className:"flex h-full flex-1 items-center justify-center rounded-lg border border-slate-200 bg-white text-slate-500 shadow-sm dark:border-slate-700 dark:bg-slate-900/70 dark:text-slate-300",children:"\u65E5\u5831 ID \u3092\u8AAD\u307F\u8FBC\u307F\u4E2D\u3067\u3059..."})})})]})},Xa=({user:e,userId:t})=>{let{apiBasePath:r}=W(),n=Fe();Sn(()=>{Et({apiBasePath:r,userKey:t??null})},[r,t]),Sn(()=>{n.phase==="auth-required"&&zr()},[n.phase]);let s=n.items.length>0||n.phase==="complete";return ne(Zr,{children:ne(en,{user:e,initialItems:n.items,userId:t,children:s?ne(wn,{userId:t}):n.phase==="failed"?ne(Ka,{}):ne(Ya,{})},t??"anonymous")})},Sd=({config:e,...t})=>ne(hr,{config:e,children:ne(Xa,{...t})});var Nd=({actionResult:e,actionStatus:t,currentUrl:r,defaultShouldRevalidate:n,formAction:s,formData:a,formEncType:i,formMethod:m,json:u,nextUrl:l,text:o})=>{if(!n)return!1;if(!(r.pathname===l.pathname&&r.search===l.search&&r.hash===l.hash))return n;if(a){let h=a.get("intent");if(h==="toggleRead"||h==="toggleStar"||h==="addComment"||h==="deleteComment"||h==="create"||h==="update"||h==="publish"||h==="delete")return!1}return e!==void 0||t!==void 0||s!==void 0||a!==void 0||i!==void 0||m!==void 0||u!==void 0||o!==void 0?n:!1},kd=e=>{let t=async r=>{Wr();let n=await r.serverLoader(),s=n.userId;return jr({apiBasePath:e?.apiBasePath,userKey:typeof s=="string"?s:null}),n};return t.hydrate=!0,t};export{at as BusinessDayThumbOverlay,St as CONTENT_DRAG_POINTER_INPUTS,_e as DAILY_REPORT_FETCH_DEBOUNCE_MS,Qt as DEFAULT_ITEM_HEIGHT,en as DailyReportActionProvider,ot as DailyReportAttachmentIndicator,dt as DailyReportAttachmentList,H as DailyReportCache,mt as DailyReportCommentForm,ct as DailyReportCommentList,hr as DailyReportConfigProvider,ln as DailyReportDetailList,Bt as DailyReportEditForm,Zr as DailyReportErrorProvider,kt as DailyReportIdsStreamClient,Vt as DailyReportIdsStreamStatus,hn as DailyReportList,Ka as DailyReportLoadError,Ya as DailyReportLoading,Sd as DailyReportPage,vr as DailyReportPostedComment,wn as DailyReportResolvedContent,ko as EMPTY_DETAIL,xt as EMPTY_ITEM,gt as FAST_SCROLL_INERTIA_OPTIONS,ht as FAST_SCROLL_WHEEL_MULTIPLIER,je as ITEM_CONTAINER_HEIGHT,bt as ITEM_VERTICAL_PADDING,Nr as MAX_PREVIEW_LINES,yt as PREFETCH_LOOKAHEAD,Tr as PREFETCH_MAX_DATES,Dt as SCROLL_BAR_WIDTH,Cr as SSE_INITIAL_CONNECT_DEFER_MS,wt as TAP_SCROLL_CIRCLE_OPTIONS,Qe as UnreadIndicator,Rt as VIRTUAL_SCROLL_OVERSCAN_COUNT,vt as WHEEL_RESET_TIMEOUT_MS,Ge as acquireMutationLock,_r as applyBroadcastReportUpdate,Pe as applyDailyReportServerUpdates,jr as bootstrapDailyReportIdsStreamSession,We as clearDailyReportCache,kd as createDailyReportClientLoader,Nd as dailyReportShouldRevalidate,it as defaultDailyReportClientConfig,fr as defaultDailyReportFieldLabels,Tt as deleteDailyReportCache,Et as ensureDailyReportIdsStreamSession,fe as getCachedReport,Gr as getDailyReportIdsStreamSessionUserKey,Wr as primeDailyReportIdsStreamSession,ar as refreshDailyReportIdsStream,Mr as registerRecentDeletion,qe as releaseMutationLock,zr as reloadDocument,Lt as removeDailyReportIdsStreamItem,Xo as resetDailyReportIdsStreamSessionForTesting,Le as resolveSourceTypeConfig,Mt as retryDailyReportIdsStream,Hr as subscribeCacheReady,be as updateDailyReportCache,Ye as upsertDailyReportIdsStreamItem,et as useAnimatedNumber,he as useDailyReportActionContext,_t as useDailyReportComments,W as useDailyReportConfig,Oe as useDailyReportDetail,Qr as useDailyReportErrorSurface,Fe as useDailyReportIdsStream,Or as useDailyReportPrefetch,Ur as useDailyReportSseConnection,Ot as useDynamicViewportHeight,Lr as writeCache};
|
|
8
|
-
//# sourceMappingURL=client.mjs.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,231 +1,39 @@
|
|
|
1
|
-
export { D as DailyReportSseMessage, U as UIComment, c as commentAddMessageSchema, a as commentDeleteMessageSchema, b as connectedMessageSchema, d as dailyReportAttachmentItemSchema, e as dailyReportDetailSchema, f as dailyReportExternalCommentSchema, g as dailyReportInterviewerSchema, h as dailyReportLabelDefSchema, i as dailyReportPostedCommentSchema, j as dailyReportSseMessageSchema, m as mergeComments, r as reportCreateMessageSchema, k as reportDeleteMessageSchema, l as reportPublishMessageSchema, n as reportUpdateMessageSchema, o as resolveCommentColorClass, s as statusUpdateMessageSchema } from
|
|
2
|
-
import { a as DailyReportItem } from
|
|
3
|
-
export { d as DailyReportAttachmentState, D as DailyReportAttachmentSummary, b as DailyReportDetail, e as DailyReportExternalComment, f as DailyReportInterviewer, g as DailyReportLabelDef, h as DailyReportPostedComment, c as DailyReportUser } from
|
|
4
|
-
export { D as DailyReportLogger, L as LogLevel, c as createLogger } from
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Business date normalization and formatting helper functions.
|
|
9
|
-
* 営業日の正規化とフォーマットを支援するユーティリティ群。
|
|
10
|
-
*/
|
|
1
|
+
export { D as DailyReportSseMessage, U as UIComment, c as commentAddMessageSchema, a as commentDeleteMessageSchema, b as connectedMessageSchema, d as dailyReportAttachmentItemSchema, e as dailyReportDetailSchema, f as dailyReportExternalCommentSchema, g as dailyReportInterviewerSchema, h as dailyReportLabelDefSchema, i as dailyReportPostedCommentSchema, j as dailyReportSseMessageSchema, m as mergeComments, r as reportCreateMessageSchema, k as reportDeleteMessageSchema, l as reportPublishMessageSchema, n as reportUpdateMessageSchema, o as resolveCommentColorClass, s as statusUpdateMessageSchema } from "./sse-schema-ChSFm-4q.mjs";
|
|
2
|
+
import { a as DailyReportItem } from "./types-CqgYQgbH.mjs";
|
|
3
|
+
export { d as DailyReportAttachmentState, D as DailyReportAttachmentSummary, b as DailyReportDetail, e as DailyReportExternalComment, f as DailyReportInterviewer, g as DailyReportLabelDef, h as DailyReportPostedComment, c as DailyReportUser } from "./types-CqgYQgbH.mjs";
|
|
4
|
+
export { D as DailyReportLogger, L as LogLevel, c as createLogger } from "./logger-D3krZrNK.mjs";
|
|
5
|
+
import "zod";
|
|
11
6
|
type BusinessDateInput = string | Date | null | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* Returns today's business-date key (YYYY-MM-DD) in the local calendar.
|
|
14
|
-
* ローカルカレンダー上の「本日」の営業日キー (YYYY-MM-DD) を返す。
|
|
15
|
-
*
|
|
16
|
-
* `new Date().toISOString()` の日付部は UTC 日付になり、UTC より東のタイムゾーン
|
|
17
|
-
* (JST など) では深夜〜午前帯に前日へずれる。営業日はブラウザのローカル暦日で判定する
|
|
18
|
-
* ため、ローカル getter から直接組む。タイムゾーンはパッケージに固定しない (消費側の
|
|
19
|
-
* 実行環境が決める) 方針に沿う。
|
|
20
|
-
*
|
|
21
|
-
* @param now Clock injection for tests (defaults to the current time). テスト用の時刻注入 (既定は現在時刻)。
|
|
22
|
-
* @returns Local calendar day as YYYY-MM-DD. ローカル暦日の YYYY-MM-DD。
|
|
23
|
-
*/
|
|
24
7
|
declare const resolveTodayBusinessDateKey: (now?: Date) => string;
|
|
25
|
-
/**
|
|
26
|
-
* Normalizes business date input into YYYY-MM-DD format string.
|
|
27
|
-
* 営業日を YYYY-MM-DD 形式の文字列へ正規化する。
|
|
28
|
-
*/
|
|
29
8
|
declare const normalizeBusinessDateKey: (value: BusinessDateInput) => string | null;
|
|
30
|
-
/**
|
|
31
|
-
* Converts normalized business date into display format YYYY-MM-DD.
|
|
32
|
-
* 正規化済みの営業日を YYYY-MM-DD 形式の表示文字列へ変換する。
|
|
33
|
-
*/
|
|
34
9
|
declare const formatBusinessDateDisplay: (value: BusinessDateInput) => string | null;
|
|
35
|
-
/**
|
|
36
|
-
* Parses normalized business date into Date object.
|
|
37
|
-
* 正規化した営業日を Date オブジェクトへ変換する。
|
|
38
|
-
*/
|
|
39
10
|
declare const parseBusinessDateKeyToDate: (value: BusinessDateInput) => Date | null;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Wire contract and ordering helpers for the daily-report ids NDJSON stream.
|
|
43
|
-
* 日報 ID 一覧 NDJSON ストリームのワイヤ契約と並び順ヘルパー。
|
|
44
|
-
*
|
|
45
|
-
* サーバーは `GET {apiBasePath}/ids-stream` で 1 行 1 JSON の NDJSON を返す。
|
|
46
|
-
* 行は原則 {@link DailyReportIdsStreamChunkLine} で、送出中に予期しない失敗が
|
|
47
|
-
* 起きた場合のみ {@link DailyReportIdsStreamErrorLine} を 1 行流して正常クローズする
|
|
48
|
-
* (クライアントは「isLast 無しで終端」を再開シグナルとして扱う)。
|
|
49
|
-
*
|
|
50
|
-
* 並び順は SQL の `ORDER BY business_date DESC, id DESC` (MSSQL の DESC は NULL を
|
|
51
|
-
* 末尾に置く) と完全一致させる。カーソル再開はこの全順序に対する「厳密に後」の
|
|
52
|
-
* 位置からのスライスとして定義する。
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
|
-
/** ストリーム再開カーソル。直前チャンク末尾アイテムの並び順キー。 */
|
|
56
11
|
type DailyReportIdsStreamCursor = {
|
|
57
|
-
/** 営業日 (YYYY-MM-DD)。null は「営業日なし領域」(並び順の末尾) を表す。 */
|
|
58
12
|
businessDate: string | null;
|
|
59
|
-
/** 日報 Hub ID。 */
|
|
60
13
|
reportHubId: number;
|
|
61
14
|
};
|
|
62
|
-
/** データを運ぶ NDJSON 行。 */
|
|
63
15
|
type DailyReportIdsStreamChunkLine = {
|
|
64
|
-
/**
|
|
65
|
-
* 行種別。判別可能ユニオンの識別子。
|
|
66
|
-
*
|
|
67
|
-
* ❗ 行の意味は `kind` が宣言する。「`items` を持つかどうか」で判定していた時代は、
|
|
68
|
-
* 新しい行種別を足すと既存クライアントがそれをエラー行と解釈して走査を中断した。
|
|
69
|
-
* `kind` を欠く行は本識別子の導入前の送信元とみなし、分類器が従来判定へ落とす。
|
|
70
|
-
*/
|
|
71
16
|
kind: "chunk";
|
|
72
|
-
/** このチャンクのアイテム群 (並び順どおり)。 */
|
|
73
17
|
items: DailyReportItem[];
|
|
74
|
-
/** 次チャンクの再開カーソル。最終チャンクでは null。 */
|
|
75
18
|
nextCursor: DailyReportIdsStreamCursor | null;
|
|
76
|
-
/** これが最終チャンクかどうか。 */
|
|
77
19
|
isLast: boolean;
|
|
78
|
-
/** 全体件数。接続ごとの先頭行にのみ載る。 */
|
|
79
20
|
total?: number;
|
|
80
|
-
/**
|
|
81
|
-
* この行が**暫定** (未確認スナップショット) かどうか。既定 (未指定) は権威。
|
|
82
|
-
*
|
|
83
|
-
* 高速先頭ページは全量配列とは別のスナップショットなので、そのまま「観測した」と
|
|
84
|
-
* 扱うと、送出後に消えた行が完走剪定を免れて幽霊行になる。暫定行はクライアント側で
|
|
85
|
-
* 描画はするが観測集合へ刻まないため、権威パス (全量配列を先頭から流し直す) に
|
|
86
|
-
* 現れなかった行が完走時に正確に落ちる。
|
|
87
|
-
*
|
|
88
|
-
* ❗ 暫定行には `nextCursor` を載せない (常に null)。未確認領域を指すカーソルで再開すると、
|
|
89
|
-
* 三つ目のスナップショットへ継ぎ目が移るだけになる。
|
|
90
|
-
*/
|
|
91
21
|
provisional?: boolean;
|
|
92
|
-
/**
|
|
93
|
-
* この行を切り出した全量配列の同一性トークン ({@link computeIdsStreamSnapshotToken})。
|
|
94
|
-
*
|
|
95
|
-
* クライアントは再接続時にカーソルと**対で**送り返し、サーバーは現在の配列のトークンと
|
|
96
|
-
* 照合して、同じ配列のときだけカーソルを信用する。別の配列にカーソルを当てると、
|
|
97
|
-
* カーソルより前に入った行が丸ごと飛ぶ (再接続のたびの欠損)。
|
|
98
|
-
*
|
|
99
|
-
* ❗ resume 経路を含む**全ての権威行**に載せる。載せ忘れると最初の再開成功でクライアントの
|
|
100
|
-
* トークンが失われ、2 度目以降の切断が全て全量再送へ退化する。
|
|
101
|
-
* ❗ 暫定行と短絡行には載せない (全量配列を代表しないため、再開起点にしてはならない)。
|
|
102
|
-
*/
|
|
103
22
|
snapshot?: string;
|
|
104
|
-
/**
|
|
105
|
-
* 送られたカーソルを破棄して先頭から流し直したことの明示 (先頭行にのみ載る)。
|
|
106
|
-
*
|
|
107
|
-
* クライアントはこれを受けたらカーソル・トークン・観測集合・トゥームストーンを初期化する
|
|
108
|
-
* (処理は行の吸収関数の内部で行われ、呼び出し側に順序の自由度は無い)。
|
|
109
|
-
*/
|
|
110
23
|
restarted?: boolean;
|
|
111
24
|
};
|
|
112
|
-
/** サーバー側の予期しない失敗を伝える NDJSON 行 (内部情報は含めない)。 */
|
|
113
25
|
type DailyReportIdsStreamErrorLine = {
|
|
114
|
-
/** 行種別。判別可能ユニオンの識別子。 */
|
|
115
26
|
kind: "error";
|
|
116
27
|
error: string;
|
|
117
28
|
};
|
|
118
|
-
/** NDJSON 1 行のユニオン。 */
|
|
119
29
|
type DailyReportIdsStreamLine = DailyReportIdsStreamChunkLine | DailyReportIdsStreamErrorLine;
|
|
120
|
-
/**
|
|
121
|
-
* Classifies one parsed NDJSON line by its declared kind.
|
|
122
|
-
* パース済みの NDJSON 行を宣言された種別で分類する処理。
|
|
123
|
-
*
|
|
124
|
-
* クライアントとテストはこの分類器**だけ**を使う。契約:
|
|
125
|
-
*
|
|
126
|
-
* - `"chunk"` / `"error"`: 宣言どおりに扱う。
|
|
127
|
-
* - **未知の `kind` は `"unknown"`** — 将来のワイヤ拡張であり、エラー扱いすると
|
|
128
|
-
* 走査が中断する (旧判定の罠が 1 段上で再発する)。呼び出し側は警告して読み飛ばす。
|
|
129
|
-
* - `kind` を欠く行は本識別子の導入前の送信元 (配備入れ替わり窓)。従来判定
|
|
130
|
-
* (`items` 配列の有無 → チャンク、`error` 文字列 → エラー) へ落とす。
|
|
131
|
-
*
|
|
132
|
-
* @param line Parsed NDJSON line. パース済みの NDJSON 行。
|
|
133
|
-
* @returns Line classification. 行の分類。
|
|
134
|
-
*/
|
|
135
30
|
declare const classifyIdsStreamLine: (line: unknown) => "chunk" | "error" | "unknown";
|
|
136
|
-
/**
|
|
137
|
-
* Type guard for chunk lines (thin wrapper over the classifier).
|
|
138
|
-
* チャンク行の型ガード ({@link classifyIdsStreamLine} の薄い包み)。
|
|
139
|
-
*
|
|
140
|
-
* @param line Parsed NDJSON line. パース済みの NDJSON 行。
|
|
141
|
-
* @returns True when the line is a chunk line. チャンク行なら true。
|
|
142
|
-
*/
|
|
143
31
|
declare const isIdsStreamChunkLine: (line: unknown) => line is DailyReportIdsStreamChunkLine;
|
|
144
|
-
/**
|
|
145
|
-
* Computes the identity token of a materialized ids array.
|
|
146
|
-
* 確定済み ids 配列の同一性トークンを算出する処理。
|
|
147
|
-
*
|
|
148
|
-
* 内容から決まる値にする — プロセスごとにキャッシュバケットが別なので、別ワーカーが
|
|
149
|
-
* 応答しても同じ配列なら同じトークンにならなければならない。畳み込むのは各行の
|
|
150
|
-
* `reportHubId` と `businessDate` (= カーソルの位置を決める全順序の構成要素) + 件数。
|
|
151
|
-
* `sourceType` は順序に関与しないため畳み込まない (変わっても位置は不変)。
|
|
152
|
-
*
|
|
153
|
-
* ❗ 衝突の方向を取り違えないこと。決定的ハッシュに「同じ配列なのに別トークン」(偽不一致 =
|
|
154
|
-
* 無駄な再送) は構造上起こり得ない。危険なのはその逆 — **異なる配列が同一トークンになる
|
|
155
|
-
* 偽一致**であり、その場合カーソルが変化後の配列に対して信用され、欠損・重複が無音で発生する
|
|
156
|
-
* (認可には影響しない — 再開行は常に現在の認可済み配列から切り出される)。この確率を議論の
|
|
157
|
-
* 余地なく無視できる水準 (~2^-64) にするため、オフセット基底の異なる FNV-1a 32bit を
|
|
158
|
-
* 2 レーン走らせて連結する。費用は 22 万件で数 ms。
|
|
159
|
-
*
|
|
160
|
-
* @param items Stream-ordered items. ストリーム順のアイテム配列。
|
|
161
|
-
* @returns Hex token (up to 16 chars). 16 進トークン (最長 16 桁)。
|
|
162
|
-
*/
|
|
163
32
|
declare const computeIdsStreamSnapshotToken: (items: readonly DailyReportItem[]) => string;
|
|
164
|
-
/**
|
|
165
|
-
* Total order of the ids stream: businessDate DESC (NULL last), then id DESC.
|
|
166
|
-
* ids ストリームの全順序。営業日降順 (NULL は末尾)、同日内は ID 降順。
|
|
167
|
-
*
|
|
168
|
-
* MSSQL の `ORDER BY business_date DESC, id DESC` と一致させることが唯一の存在理由。
|
|
169
|
-
* 営業日は正規化済みの `YYYY-MM-DD` 文字列なので辞書順比較 = 時系列比較になる。
|
|
170
|
-
*
|
|
171
|
-
* @param a Left key. 左辺キー。
|
|
172
|
-
* @param b Right key. 右辺キー。
|
|
173
|
-
* @returns Negative when `a` streams before `b`. `a` が先に流れるなら負値。
|
|
174
|
-
*/
|
|
175
33
|
declare const compareIdsStreamOrder: (a: DailyReportIdsStreamCursor, b: DailyReportIdsStreamCursor) => number;
|
|
176
|
-
/**
|
|
177
|
-
* Checks whether items already follow the ids-stream total order.
|
|
178
|
-
* アイテム配列が ids ストリームの全順序に既に従っているかを検査する処理。
|
|
179
|
-
*
|
|
180
|
-
* ストリームはソート順どおりに届いて末尾へ追記されるため通常は整列済みで、
|
|
181
|
-
* この O(n) 検査で全件ソート (O(n log n)) を省略できる。
|
|
182
|
-
*
|
|
183
|
-
* @param items Items to probe. 検査対象のアイテム配列。
|
|
184
|
-
* @returns True when already ordered. 整列済みなら true。
|
|
185
|
-
*/
|
|
186
34
|
declare const isIdsStreamOrdered: (items: readonly DailyReportItem[]) => boolean;
|
|
187
|
-
/**
|
|
188
|
-
* Returns a copy with the item upserted at its ids-stream-ordered position.
|
|
189
|
-
* アイテムを ids ストリーム順の正しい位置へ upsert した複製配列を返す処理。
|
|
190
|
-
*
|
|
191
|
-
* 前提: `items` は ids ストリーム順に整列済み (このモジュールの比較器を使う全書き込み元が
|
|
192
|
-
* 維持する不変条件)。既存の同 ID は除去してから二分探索で挿入位置を求めるため、
|
|
193
|
-
* 全件ソート無しの O(n) で並び順を保てる (以前は SSE 1 件ごとに 20 万件超を
|
|
194
|
-
* localeCompare で全ソートしていた)。
|
|
195
|
-
*
|
|
196
|
-
* @param items Ordered items. 整列済みアイテム配列。
|
|
197
|
-
* @param item Item to upsert. upsert するアイテム。
|
|
198
|
-
* @returns New ordered array. 新しい整列済み配列。
|
|
199
|
-
*/
|
|
200
35
|
declare const upsertInIdsStreamOrder: (items: readonly DailyReportItem[], item: DailyReportItem) => DailyReportItem[];
|
|
201
|
-
/**
|
|
202
|
-
* Finds the first index that streams strictly after the cursor.
|
|
203
|
-
* カーソルより厳密に後ろへ並ぶ最初のインデックスを求める処理。
|
|
204
|
-
*
|
|
205
|
-
* 配列は必ずストリーム順 (SQL の ORDER BY) で渡されるが、比較器とのズレが
|
|
206
|
-
* あっても壊れない線形走査で決定する (件数は高々数万・再開時のみの実行)。
|
|
207
|
-
* 該当なし (カーソルが末尾以降) は `items.length` を返し、空チャンク +
|
|
208
|
-
* `isLast: true` の正常終端に落ちる。
|
|
209
|
-
*
|
|
210
|
-
* @param items Stream-ordered items. ストリーム順のアイテム配列。
|
|
211
|
-
* @param cursor Resume cursor. 再開カーソル。
|
|
212
|
-
* @returns Index to resume emission from. 送出を再開するインデックス。
|
|
213
|
-
*/
|
|
214
36
|
declare const findIdsStreamResumeIndex: (items: readonly DailyReportItem[], cursor: DailyReportIdsStreamCursor) => number;
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Shared text helpers for daily report view components.
|
|
218
|
-
* 日報ビューコンポーネント向けの共通テキストヘルパー。
|
|
219
|
-
*/
|
|
220
|
-
/**
|
|
221
|
-
* Normalizes nullable text by trimming whitespace and applying fallback.
|
|
222
|
-
* null 許容の文字列をトリムしつつフォールバック値を適用する関数。
|
|
223
|
-
*/
|
|
224
37
|
declare const fallbackText: (value: string | null | undefined) => string;
|
|
225
|
-
/**
|
|
226
|
-
* Formats a date string to ISO 8601 format (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss).
|
|
227
|
-
* 日付文字列を ISO 8601 形式 (YYYY-MM-DD または YYYY-MM-DDTHH:mm:ss) に整形する関数。
|
|
228
|
-
*/
|
|
229
38
|
declare const formatToIsoDate: (value: unknown) => string;
|
|
230
|
-
|
|
231
39
|
export { type DailyReportIdsStreamChunkLine, type DailyReportIdsStreamCursor, type DailyReportIdsStreamErrorLine, type DailyReportIdsStreamLine, DailyReportItem, classifyIdsStreamLine, compareIdsStreamOrder, computeIdsStreamSnapshotToken, fallbackText, findIdsStreamResumeIndex, formatBusinessDateDisplay, formatToIsoDate, isIdsStreamChunkLine, isIdsStreamOrdered, normalizeBusinessDateKey, parseBusinessDateKeyToDate, resolveTodayBusinessDateKey, upsertInIdsStreamOrder };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,231 +1,39 @@
|
|
|
1
|
-
export { D as DailyReportSseMessage, U as UIComment, c as commentAddMessageSchema, a as commentDeleteMessageSchema, b as connectedMessageSchema, d as dailyReportAttachmentItemSchema, e as dailyReportDetailSchema, f as dailyReportExternalCommentSchema, g as dailyReportInterviewerSchema, h as dailyReportLabelDefSchema, i as dailyReportPostedCommentSchema, j as dailyReportSseMessageSchema, m as mergeComments, r as reportCreateMessageSchema, k as reportDeleteMessageSchema, l as reportPublishMessageSchema, n as reportUpdateMessageSchema, o as resolveCommentColorClass, s as statusUpdateMessageSchema } from
|
|
2
|
-
import { a as DailyReportItem } from
|
|
3
|
-
export { d as DailyReportAttachmentState, D as DailyReportAttachmentSummary, b as DailyReportDetail, e as DailyReportExternalComment, f as DailyReportInterviewer, g as DailyReportLabelDef, h as DailyReportPostedComment, c as DailyReportUser } from
|
|
4
|
-
export { D as DailyReportLogger, L as LogLevel, c as createLogger } from
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Business date normalization and formatting helper functions.
|
|
9
|
-
* 営業日の正規化とフォーマットを支援するユーティリティ群。
|
|
10
|
-
*/
|
|
1
|
+
export { D as DailyReportSseMessage, U as UIComment, c as commentAddMessageSchema, a as commentDeleteMessageSchema, b as connectedMessageSchema, d as dailyReportAttachmentItemSchema, e as dailyReportDetailSchema, f as dailyReportExternalCommentSchema, g as dailyReportInterviewerSchema, h as dailyReportLabelDefSchema, i as dailyReportPostedCommentSchema, j as dailyReportSseMessageSchema, m as mergeComments, r as reportCreateMessageSchema, k as reportDeleteMessageSchema, l as reportPublishMessageSchema, n as reportUpdateMessageSchema, o as resolveCommentColorClass, s as statusUpdateMessageSchema } from "./sse-schema-BdUGThiz.js";
|
|
2
|
+
import { a as DailyReportItem } from "./types-CqgYQgbH.js";
|
|
3
|
+
export { d as DailyReportAttachmentState, D as DailyReportAttachmentSummary, b as DailyReportDetail, e as DailyReportExternalComment, f as DailyReportInterviewer, g as DailyReportLabelDef, h as DailyReportPostedComment, c as DailyReportUser } from "./types-CqgYQgbH.js";
|
|
4
|
+
export { D as DailyReportLogger, L as LogLevel, c as createLogger } from "./logger-D3krZrNK.js";
|
|
5
|
+
import "zod";
|
|
11
6
|
type BusinessDateInput = string | Date | null | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* Returns today's business-date key (YYYY-MM-DD) in the local calendar.
|
|
14
|
-
* ローカルカレンダー上の「本日」の営業日キー (YYYY-MM-DD) を返す。
|
|
15
|
-
*
|
|
16
|
-
* `new Date().toISOString()` の日付部は UTC 日付になり、UTC より東のタイムゾーン
|
|
17
|
-
* (JST など) では深夜〜午前帯に前日へずれる。営業日はブラウザのローカル暦日で判定する
|
|
18
|
-
* ため、ローカル getter から直接組む。タイムゾーンはパッケージに固定しない (消費側の
|
|
19
|
-
* 実行環境が決める) 方針に沿う。
|
|
20
|
-
*
|
|
21
|
-
* @param now Clock injection for tests (defaults to the current time). テスト用の時刻注入 (既定は現在時刻)。
|
|
22
|
-
* @returns Local calendar day as YYYY-MM-DD. ローカル暦日の YYYY-MM-DD。
|
|
23
|
-
*/
|
|
24
7
|
declare const resolveTodayBusinessDateKey: (now?: Date) => string;
|
|
25
|
-
/**
|
|
26
|
-
* Normalizes business date input into YYYY-MM-DD format string.
|
|
27
|
-
* 営業日を YYYY-MM-DD 形式の文字列へ正規化する。
|
|
28
|
-
*/
|
|
29
8
|
declare const normalizeBusinessDateKey: (value: BusinessDateInput) => string | null;
|
|
30
|
-
/**
|
|
31
|
-
* Converts normalized business date into display format YYYY-MM-DD.
|
|
32
|
-
* 正規化済みの営業日を YYYY-MM-DD 形式の表示文字列へ変換する。
|
|
33
|
-
*/
|
|
34
9
|
declare const formatBusinessDateDisplay: (value: BusinessDateInput) => string | null;
|
|
35
|
-
/**
|
|
36
|
-
* Parses normalized business date into Date object.
|
|
37
|
-
* 正規化した営業日を Date オブジェクトへ変換する。
|
|
38
|
-
*/
|
|
39
10
|
declare const parseBusinessDateKeyToDate: (value: BusinessDateInput) => Date | null;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Wire contract and ordering helpers for the daily-report ids NDJSON stream.
|
|
43
|
-
* 日報 ID 一覧 NDJSON ストリームのワイヤ契約と並び順ヘルパー。
|
|
44
|
-
*
|
|
45
|
-
* サーバーは `GET {apiBasePath}/ids-stream` で 1 行 1 JSON の NDJSON を返す。
|
|
46
|
-
* 行は原則 {@link DailyReportIdsStreamChunkLine} で、送出中に予期しない失敗が
|
|
47
|
-
* 起きた場合のみ {@link DailyReportIdsStreamErrorLine} を 1 行流して正常クローズする
|
|
48
|
-
* (クライアントは「isLast 無しで終端」を再開シグナルとして扱う)。
|
|
49
|
-
*
|
|
50
|
-
* 並び順は SQL の `ORDER BY business_date DESC, id DESC` (MSSQL の DESC は NULL を
|
|
51
|
-
* 末尾に置く) と完全一致させる。カーソル再開はこの全順序に対する「厳密に後」の
|
|
52
|
-
* 位置からのスライスとして定義する。
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
|
-
/** ストリーム再開カーソル。直前チャンク末尾アイテムの並び順キー。 */
|
|
56
11
|
type DailyReportIdsStreamCursor = {
|
|
57
|
-
/** 営業日 (YYYY-MM-DD)。null は「営業日なし領域」(並び順の末尾) を表す。 */
|
|
58
12
|
businessDate: string | null;
|
|
59
|
-
/** 日報 Hub ID。 */
|
|
60
13
|
reportHubId: number;
|
|
61
14
|
};
|
|
62
|
-
/** データを運ぶ NDJSON 行。 */
|
|
63
15
|
type DailyReportIdsStreamChunkLine = {
|
|
64
|
-
/**
|
|
65
|
-
* 行種別。判別可能ユニオンの識別子。
|
|
66
|
-
*
|
|
67
|
-
* ❗ 行の意味は `kind` が宣言する。「`items` を持つかどうか」で判定していた時代は、
|
|
68
|
-
* 新しい行種別を足すと既存クライアントがそれをエラー行と解釈して走査を中断した。
|
|
69
|
-
* `kind` を欠く行は本識別子の導入前の送信元とみなし、分類器が従来判定へ落とす。
|
|
70
|
-
*/
|
|
71
16
|
kind: "chunk";
|
|
72
|
-
/** このチャンクのアイテム群 (並び順どおり)。 */
|
|
73
17
|
items: DailyReportItem[];
|
|
74
|
-
/** 次チャンクの再開カーソル。最終チャンクでは null。 */
|
|
75
18
|
nextCursor: DailyReportIdsStreamCursor | null;
|
|
76
|
-
/** これが最終チャンクかどうか。 */
|
|
77
19
|
isLast: boolean;
|
|
78
|
-
/** 全体件数。接続ごとの先頭行にのみ載る。 */
|
|
79
20
|
total?: number;
|
|
80
|
-
/**
|
|
81
|
-
* この行が**暫定** (未確認スナップショット) かどうか。既定 (未指定) は権威。
|
|
82
|
-
*
|
|
83
|
-
* 高速先頭ページは全量配列とは別のスナップショットなので、そのまま「観測した」と
|
|
84
|
-
* 扱うと、送出後に消えた行が完走剪定を免れて幽霊行になる。暫定行はクライアント側で
|
|
85
|
-
* 描画はするが観測集合へ刻まないため、権威パス (全量配列を先頭から流し直す) に
|
|
86
|
-
* 現れなかった行が完走時に正確に落ちる。
|
|
87
|
-
*
|
|
88
|
-
* ❗ 暫定行には `nextCursor` を載せない (常に null)。未確認領域を指すカーソルで再開すると、
|
|
89
|
-
* 三つ目のスナップショットへ継ぎ目が移るだけになる。
|
|
90
|
-
*/
|
|
91
21
|
provisional?: boolean;
|
|
92
|
-
/**
|
|
93
|
-
* この行を切り出した全量配列の同一性トークン ({@link computeIdsStreamSnapshotToken})。
|
|
94
|
-
*
|
|
95
|
-
* クライアントは再接続時にカーソルと**対で**送り返し、サーバーは現在の配列のトークンと
|
|
96
|
-
* 照合して、同じ配列のときだけカーソルを信用する。別の配列にカーソルを当てると、
|
|
97
|
-
* カーソルより前に入った行が丸ごと飛ぶ (再接続のたびの欠損)。
|
|
98
|
-
*
|
|
99
|
-
* ❗ resume 経路を含む**全ての権威行**に載せる。載せ忘れると最初の再開成功でクライアントの
|
|
100
|
-
* トークンが失われ、2 度目以降の切断が全て全量再送へ退化する。
|
|
101
|
-
* ❗ 暫定行と短絡行には載せない (全量配列を代表しないため、再開起点にしてはならない)。
|
|
102
|
-
*/
|
|
103
22
|
snapshot?: string;
|
|
104
|
-
/**
|
|
105
|
-
* 送られたカーソルを破棄して先頭から流し直したことの明示 (先頭行にのみ載る)。
|
|
106
|
-
*
|
|
107
|
-
* クライアントはこれを受けたらカーソル・トークン・観測集合・トゥームストーンを初期化する
|
|
108
|
-
* (処理は行の吸収関数の内部で行われ、呼び出し側に順序の自由度は無い)。
|
|
109
|
-
*/
|
|
110
23
|
restarted?: boolean;
|
|
111
24
|
};
|
|
112
|
-
/** サーバー側の予期しない失敗を伝える NDJSON 行 (内部情報は含めない)。 */
|
|
113
25
|
type DailyReportIdsStreamErrorLine = {
|
|
114
|
-
/** 行種別。判別可能ユニオンの識別子。 */
|
|
115
26
|
kind: "error";
|
|
116
27
|
error: string;
|
|
117
28
|
};
|
|
118
|
-
/** NDJSON 1 行のユニオン。 */
|
|
119
29
|
type DailyReportIdsStreamLine = DailyReportIdsStreamChunkLine | DailyReportIdsStreamErrorLine;
|
|
120
|
-
/**
|
|
121
|
-
* Classifies one parsed NDJSON line by its declared kind.
|
|
122
|
-
* パース済みの NDJSON 行を宣言された種別で分類する処理。
|
|
123
|
-
*
|
|
124
|
-
* クライアントとテストはこの分類器**だけ**を使う。契約:
|
|
125
|
-
*
|
|
126
|
-
* - `"chunk"` / `"error"`: 宣言どおりに扱う。
|
|
127
|
-
* - **未知の `kind` は `"unknown"`** — 将来のワイヤ拡張であり、エラー扱いすると
|
|
128
|
-
* 走査が中断する (旧判定の罠が 1 段上で再発する)。呼び出し側は警告して読み飛ばす。
|
|
129
|
-
* - `kind` を欠く行は本識別子の導入前の送信元 (配備入れ替わり窓)。従来判定
|
|
130
|
-
* (`items` 配列の有無 → チャンク、`error` 文字列 → エラー) へ落とす。
|
|
131
|
-
*
|
|
132
|
-
* @param line Parsed NDJSON line. パース済みの NDJSON 行。
|
|
133
|
-
* @returns Line classification. 行の分類。
|
|
134
|
-
*/
|
|
135
30
|
declare const classifyIdsStreamLine: (line: unknown) => "chunk" | "error" | "unknown";
|
|
136
|
-
/**
|
|
137
|
-
* Type guard for chunk lines (thin wrapper over the classifier).
|
|
138
|
-
* チャンク行の型ガード ({@link classifyIdsStreamLine} の薄い包み)。
|
|
139
|
-
*
|
|
140
|
-
* @param line Parsed NDJSON line. パース済みの NDJSON 行。
|
|
141
|
-
* @returns True when the line is a chunk line. チャンク行なら true。
|
|
142
|
-
*/
|
|
143
31
|
declare const isIdsStreamChunkLine: (line: unknown) => line is DailyReportIdsStreamChunkLine;
|
|
144
|
-
/**
|
|
145
|
-
* Computes the identity token of a materialized ids array.
|
|
146
|
-
* 確定済み ids 配列の同一性トークンを算出する処理。
|
|
147
|
-
*
|
|
148
|
-
* 内容から決まる値にする — プロセスごとにキャッシュバケットが別なので、別ワーカーが
|
|
149
|
-
* 応答しても同じ配列なら同じトークンにならなければならない。畳み込むのは各行の
|
|
150
|
-
* `reportHubId` と `businessDate` (= カーソルの位置を決める全順序の構成要素) + 件数。
|
|
151
|
-
* `sourceType` は順序に関与しないため畳み込まない (変わっても位置は不変)。
|
|
152
|
-
*
|
|
153
|
-
* ❗ 衝突の方向を取り違えないこと。決定的ハッシュに「同じ配列なのに別トークン」(偽不一致 =
|
|
154
|
-
* 無駄な再送) は構造上起こり得ない。危険なのはその逆 — **異なる配列が同一トークンになる
|
|
155
|
-
* 偽一致**であり、その場合カーソルが変化後の配列に対して信用され、欠損・重複が無音で発生する
|
|
156
|
-
* (認可には影響しない — 再開行は常に現在の認可済み配列から切り出される)。この確率を議論の
|
|
157
|
-
* 余地なく無視できる水準 (~2^-64) にするため、オフセット基底の異なる FNV-1a 32bit を
|
|
158
|
-
* 2 レーン走らせて連結する。費用は 22 万件で数 ms。
|
|
159
|
-
*
|
|
160
|
-
* @param items Stream-ordered items. ストリーム順のアイテム配列。
|
|
161
|
-
* @returns Hex token (up to 16 chars). 16 進トークン (最長 16 桁)。
|
|
162
|
-
*/
|
|
163
32
|
declare const computeIdsStreamSnapshotToken: (items: readonly DailyReportItem[]) => string;
|
|
164
|
-
/**
|
|
165
|
-
* Total order of the ids stream: businessDate DESC (NULL last), then id DESC.
|
|
166
|
-
* ids ストリームの全順序。営業日降順 (NULL は末尾)、同日内は ID 降順。
|
|
167
|
-
*
|
|
168
|
-
* MSSQL の `ORDER BY business_date DESC, id DESC` と一致させることが唯一の存在理由。
|
|
169
|
-
* 営業日は正規化済みの `YYYY-MM-DD` 文字列なので辞書順比較 = 時系列比較になる。
|
|
170
|
-
*
|
|
171
|
-
* @param a Left key. 左辺キー。
|
|
172
|
-
* @param b Right key. 右辺キー。
|
|
173
|
-
* @returns Negative when `a` streams before `b`. `a` が先に流れるなら負値。
|
|
174
|
-
*/
|
|
175
33
|
declare const compareIdsStreamOrder: (a: DailyReportIdsStreamCursor, b: DailyReportIdsStreamCursor) => number;
|
|
176
|
-
/**
|
|
177
|
-
* Checks whether items already follow the ids-stream total order.
|
|
178
|
-
* アイテム配列が ids ストリームの全順序に既に従っているかを検査する処理。
|
|
179
|
-
*
|
|
180
|
-
* ストリームはソート順どおりに届いて末尾へ追記されるため通常は整列済みで、
|
|
181
|
-
* この O(n) 検査で全件ソート (O(n log n)) を省略できる。
|
|
182
|
-
*
|
|
183
|
-
* @param items Items to probe. 検査対象のアイテム配列。
|
|
184
|
-
* @returns True when already ordered. 整列済みなら true。
|
|
185
|
-
*/
|
|
186
34
|
declare const isIdsStreamOrdered: (items: readonly DailyReportItem[]) => boolean;
|
|
187
|
-
/**
|
|
188
|
-
* Returns a copy with the item upserted at its ids-stream-ordered position.
|
|
189
|
-
* アイテムを ids ストリーム順の正しい位置へ upsert した複製配列を返す処理。
|
|
190
|
-
*
|
|
191
|
-
* 前提: `items` は ids ストリーム順に整列済み (このモジュールの比較器を使う全書き込み元が
|
|
192
|
-
* 維持する不変条件)。既存の同 ID は除去してから二分探索で挿入位置を求めるため、
|
|
193
|
-
* 全件ソート無しの O(n) で並び順を保てる (以前は SSE 1 件ごとに 20 万件超を
|
|
194
|
-
* localeCompare で全ソートしていた)。
|
|
195
|
-
*
|
|
196
|
-
* @param items Ordered items. 整列済みアイテム配列。
|
|
197
|
-
* @param item Item to upsert. upsert するアイテム。
|
|
198
|
-
* @returns New ordered array. 新しい整列済み配列。
|
|
199
|
-
*/
|
|
200
35
|
declare const upsertInIdsStreamOrder: (items: readonly DailyReportItem[], item: DailyReportItem) => DailyReportItem[];
|
|
201
|
-
/**
|
|
202
|
-
* Finds the first index that streams strictly after the cursor.
|
|
203
|
-
* カーソルより厳密に後ろへ並ぶ最初のインデックスを求める処理。
|
|
204
|
-
*
|
|
205
|
-
* 配列は必ずストリーム順 (SQL の ORDER BY) で渡されるが、比較器とのズレが
|
|
206
|
-
* あっても壊れない線形走査で決定する (件数は高々数万・再開時のみの実行)。
|
|
207
|
-
* 該当なし (カーソルが末尾以降) は `items.length` を返し、空チャンク +
|
|
208
|
-
* `isLast: true` の正常終端に落ちる。
|
|
209
|
-
*
|
|
210
|
-
* @param items Stream-ordered items. ストリーム順のアイテム配列。
|
|
211
|
-
* @param cursor Resume cursor. 再開カーソル。
|
|
212
|
-
* @returns Index to resume emission from. 送出を再開するインデックス。
|
|
213
|
-
*/
|
|
214
36
|
declare const findIdsStreamResumeIndex: (items: readonly DailyReportItem[], cursor: DailyReportIdsStreamCursor) => number;
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Shared text helpers for daily report view components.
|
|
218
|
-
* 日報ビューコンポーネント向けの共通テキストヘルパー。
|
|
219
|
-
*/
|
|
220
|
-
/**
|
|
221
|
-
* Normalizes nullable text by trimming whitespace and applying fallback.
|
|
222
|
-
* null 許容の文字列をトリムしつつフォールバック値を適用する関数。
|
|
223
|
-
*/
|
|
224
37
|
declare const fallbackText: (value: string | null | undefined) => string;
|
|
225
|
-
/**
|
|
226
|
-
* Formats a date string to ISO 8601 format (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss).
|
|
227
|
-
* 日付文字列を ISO 8601 形式 (YYYY-MM-DD または YYYY-MM-DDTHH:mm:ss) に整形する関数。
|
|
228
|
-
*/
|
|
229
38
|
declare const formatToIsoDate: (value: unknown) => string;
|
|
230
|
-
|
|
231
39
|
export { type DailyReportIdsStreamChunkLine, type DailyReportIdsStreamCursor, type DailyReportIdsStreamErrorLine, type DailyReportIdsStreamLine, DailyReportItem, classifyIdsStreamLine, compareIdsStreamOrder, computeIdsStreamSnapshotToken, fallbackText, findIdsStreamResumeIndex, formatBusinessDateDisplay, formatToIsoDate, isIdsStreamChunkLine, isIdsStreamOrdered, normalizeBusinessDateKey, parseBusinessDateKeyToDate, resolveTodayBusinessDateKey, upsertInIdsStreamOrder };
|