@aiquants/daily-report 0.47.0 → 0.47.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/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable changes to `@aiquants/daily-report` are documented here.
4
4
 
5
+ ## 0.47.1 (2026-10-16)
6
+
7
+ 版番号は 0.47.1 (patch) とする: 公開の名前を 1 つ足すだけで、振る舞いは変えない。
8
+
9
+ ### Added
10
+
11
+ - **読みの状態の規則を共有の入口から公開する** (`dailyReportReadStateOf(report, viewerUserId)`): パッケージのビューと `labels.rowState` が示す閲覧者の読みの状態
12
+ (`unread`・`read`・`updatedSinceRead`) の 1 つの規則。ラベルで自分の行を組むホスト (と、行の読み上げを確かめるホストの試験) が、規則を書き写さずに同じ状態を読む。
13
+
5
14
  ## 0.47.0 (2026-10-16)
6
15
 
7
16
  版番号は 0.47.0 (minor) とする: 状態の表に列を求め、公開の型・アクション・SSE のワイヤの形を変える (下の Breaking)。
package/README.md CHANGED
@@ -4540,6 +4540,8 @@ Documenting a name here is no reason to export it, and the values that tune the
4540
4540
  `encodeDailyReportActionCommand(command)` (a command as its `FormData`), `parseDailyReportActionResult(intent, json)` (the strict reading of a 200
4541
4541
  answer: `{ result }` or `{ mismatch }`), `DAILY_REPORT_API_ENDPOINTS` / `DAILY_REPORT_API_QUERY_PARAMS` (the endpoint and GET query-parameter
4542
4542
  names) and `DAILY_REPORT_CLIENT_TEMP_ID_PATTERN` (the echo id's two canonical forms),
4543
+ the viewer's read state `dailyReportReadStateOf(report, viewerUserId)` (`unread`, `read` or `updatedSinceRead`: the one rule the package's
4544
+ views and `labels.rowState` show, for a host that composes its own rows; [Read after update](#read-after-update)),
4543
4545
  and the source-type vocabulary a host builds its visibility port with: `DAILY_REPORT_INTERNAL_SOURCE_TYPE` (`"Internal"`, the source type of the
4544
4546
  reports the package creates) and `foldDailyReportSourceTypeToken(token)` (the one fold the server applies to the tokens the port returns:
4545
4547
  surrounding blanks removed, then lower case; [Source-type visibility](#source-type-visibility)).
package/dist/client.d.mts CHANGED
@@ -6,7 +6,7 @@ import { D as DailyReportItem, a as DailyReportUser, b as DailyReportDetail } fr
6
6
  import { VirtualScrollLocale, VirtualScrollLabels } from "@aiquants/virtualscroll";
7
7
  import { D as DailyReportActionIntent, U as UIComment } from "./source-types-a15dGIN1.mjs";
8
8
  export { f as foldDailyReportSourceTypeToken } from "./source-types-a15dGIN1.mjs";
9
- import { D as DailyReportReadState, a as DailyReportSseStreamAnchor, b as DailyReportSseTerminalEvent, c as DailyReportSseMessage, d as DailyReportReadMark, e as DailyReportReadStatus } from "./sse-schema-Bk_iO1vF.mjs";
9
+ import { D as DailyReportReadState, a as DailyReportSseStreamAnchor, b as DailyReportSseTerminalEvent, c as DailyReportSseMessage, d as DailyReportReadMark, e as DailyReportReadStatus } from "./sse-schema-DoLUV1Ow.mjs";
10
10
  import { D as DailyReportSearchFilterFacet } from "./search-filters-wire-5MWi6GWu.mjs";
11
11
  export { a as DAILY_REPORT_SEARCH_FILTER_FACETS } from "./search-filters-wire-5MWi6GWu.mjs";
12
12
  import { UseReopeningEventSourceResult } from "@aiquants/sse/react";
package/dist/client.d.ts CHANGED
@@ -6,7 +6,7 @@ import { D as DailyReportItem, a as DailyReportUser, b as DailyReportDetail } fr
6
6
  import { VirtualScrollLocale, VirtualScrollLabels } from "@aiquants/virtualscroll";
7
7
  import { D as DailyReportActionIntent, U as UIComment } from "./source-types-C1LvfRRJ.js";
8
8
  export { f as foldDailyReportSourceTypeToken } from "./source-types-C1LvfRRJ.js";
9
- import { D as DailyReportReadState, a as DailyReportSseStreamAnchor, b as DailyReportSseTerminalEvent, c as DailyReportSseMessage, d as DailyReportReadMark, e as DailyReportReadStatus } from "./sse-schema-BLe0x7BD.js";
9
+ import { D as DailyReportReadState, a as DailyReportSseStreamAnchor, b as DailyReportSseTerminalEvent, c as DailyReportSseMessage, d as DailyReportReadMark, e as DailyReportReadStatus } from "./sse-schema-ZdgeTkbk.js";
10
10
  import { D as DailyReportSearchFilterFacet } from "./search-filters-wire-5MWi6GWu.js";
11
11
  export { a as DAILY_REPORT_SEARCH_FILTER_FACETS } from "./search-filters-wire-5MWi6GWu.js";
12
12
  import { UseReopeningEventSourceResult } from "@aiquants/sse/react";
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { a as DAILY_REPORT_ACTION_FIELDS, b as DAILY_REPORT_ACTION_INTENTS, c as DAILY_REPORT_INTERNAL_SOURCE_TYPE, A as DailyReportActionCommand, d as DailyReportActionFailure, D as DailyReportActionIntent, e as DailyReportActionResult, g as DailyReportActionResultOf, h as DailyReportActionResultReading, U as DailyReportUIComment, i as encodeDailyReportActionCommand, f as foldDailyReportSourceTypeToken, p as parseDailyReportActionResult } from "./source-types-a15dGIN1.mjs";
2
- export { f as DAILY_REPORT_SSE_CURSOR_PARAM, g as DAILY_REPORT_SSE_HEARTBEAT_MS, h as DAILY_REPORT_SSE_TERMINAL_EVENTS, i as DailyReportIdsStreamChunk, j as DailyReportIdsStreamChunkLine, k as DailyReportIdsStreamCursor, l as DailyReportIdsStreamRowColumns, m as DailyReportIdsStreamRows, d as DailyReportReadMark, D as DailyReportReadState, e as DailyReportReadStatus, c as DailyReportSseMessage, a as DailyReportSseStreamAnchor, b as DailyReportSseTerminalEvent, n as dailyReportDetailSchema, o as dailyReportSseMessageSchema, p as forEachIdsStreamRow, r as readIdsStreamChunkLine } from "./sse-schema-Bk_iO1vF.mjs";
2
+ export { f as DAILY_REPORT_SSE_CURSOR_PARAM, g as DAILY_REPORT_SSE_HEARTBEAT_MS, h as DAILY_REPORT_SSE_TERMINAL_EVENTS, i as DailyReportIdsStreamChunk, j as DailyReportIdsStreamChunkLine, k as DailyReportIdsStreamCursor, l as DailyReportIdsStreamRowColumns, m as DailyReportIdsStreamRows, d as DailyReportReadMark, D as DailyReportReadState, e as DailyReportReadStatus, c as DailyReportSseMessage, a as DailyReportSseStreamAnchor, b as DailyReportSseTerminalEvent, n as dailyReportDetailSchema, o as dailyReportReadStateOf, p as dailyReportSseMessageSchema, q as forEachIdsStreamRow, r as readIdsStreamChunkLine } from "./sse-schema-DoLUV1Ow.mjs";
3
3
  export { D as DAILY_REPORT_SEARCH_BATCHES_IN_FLIGHT, a as DAILY_REPORT_SEARCH_COMBINES, b as DailyReportLogger, c as DailyReportSearchCombine, d as DailyReportSearchDetailOutcome, e as DailyReportSearchDetailsAnswer, f as DailyReportSearchFieldMarks, g as DailyReportSearchHit, h as DailyReportSearchMarksAnswer, i as DailyReportSearchMarksExpectation, j as DailyReportSearchReportMarks, r as readDailyReportSearchMarksAnswer } from "./search-marks-wire-CvOvhO30.mjs";
4
4
  export { c as DailyReportAttachmentState, d as DailyReportAttachmentSummary, b as DailyReportDetail, e as DailyReportExternalComment, f as DailyReportInterviewer, D as DailyReportItem, g as DailyReportLabelDef, h as DailyReportPostedComment, a as DailyReportUser } from "./types-CcUNWIyC.mjs";
5
5
  import "zod/v3";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { a as DAILY_REPORT_ACTION_FIELDS, b as DAILY_REPORT_ACTION_INTENTS, c as DAILY_REPORT_INTERNAL_SOURCE_TYPE, A as DailyReportActionCommand, d as DailyReportActionFailure, D as DailyReportActionIntent, e as DailyReportActionResult, g as DailyReportActionResultOf, h as DailyReportActionResultReading, U as DailyReportUIComment, i as encodeDailyReportActionCommand, f as foldDailyReportSourceTypeToken, p as parseDailyReportActionResult } from "./source-types-C1LvfRRJ.js";
2
- export { f as DAILY_REPORT_SSE_CURSOR_PARAM, g as DAILY_REPORT_SSE_HEARTBEAT_MS, h as DAILY_REPORT_SSE_TERMINAL_EVENTS, i as DailyReportIdsStreamChunk, j as DailyReportIdsStreamChunkLine, k as DailyReportIdsStreamCursor, l as DailyReportIdsStreamRowColumns, m as DailyReportIdsStreamRows, d as DailyReportReadMark, D as DailyReportReadState, e as DailyReportReadStatus, c as DailyReportSseMessage, a as DailyReportSseStreamAnchor, b as DailyReportSseTerminalEvent, n as dailyReportDetailSchema, o as dailyReportSseMessageSchema, p as forEachIdsStreamRow, r as readIdsStreamChunkLine } from "./sse-schema-BLe0x7BD.js";
2
+ export { f as DAILY_REPORT_SSE_CURSOR_PARAM, g as DAILY_REPORT_SSE_HEARTBEAT_MS, h as DAILY_REPORT_SSE_TERMINAL_EVENTS, i as DailyReportIdsStreamChunk, j as DailyReportIdsStreamChunkLine, k as DailyReportIdsStreamCursor, l as DailyReportIdsStreamRowColumns, m as DailyReportIdsStreamRows, d as DailyReportReadMark, D as DailyReportReadState, e as DailyReportReadStatus, c as DailyReportSseMessage, a as DailyReportSseStreamAnchor, b as DailyReportSseTerminalEvent, n as dailyReportDetailSchema, o as dailyReportReadStateOf, p as dailyReportSseMessageSchema, q as forEachIdsStreamRow, r as readIdsStreamChunkLine } from "./sse-schema-ZdgeTkbk.js";
3
3
  export { D as DAILY_REPORT_SEARCH_BATCHES_IN_FLIGHT, a as DAILY_REPORT_SEARCH_COMBINES, b as DailyReportLogger, c as DailyReportSearchCombine, d as DailyReportSearchDetailOutcome, e as DailyReportSearchDetailsAnswer, f as DailyReportSearchFieldMarks, g as DailyReportSearchHit, h as DailyReportSearchMarksAnswer, i as DailyReportSearchMarksExpectation, j as DailyReportSearchReportMarks, r as readDailyReportSearchMarksAnswer } from "./search-marks-wire-v7GTHpp7.js";
4
4
  export { c as DailyReportAttachmentState, d as DailyReportAttachmentSummary, b as DailyReportDetail, e as DailyReportExternalComment, f as DailyReportInterviewer, D as DailyReportItem, g as DailyReportLabelDef, h as DailyReportPostedComment, a as DailyReportUser } from "./types-CcUNWIyC.js";
5
5
  import "zod/v3";
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var F=Object.defineProperty;var ot=Object.getOwnPropertyDescriptor;var at=Object.getOwnPropertyNames;var st=Object.prototype.hasOwnProperty;var it=(e,t)=>{for(var r in t)F(e,r,{get:t[r],enumerable:!0})},lt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of at(t))!st.call(e,o)&&o!==r&&F(e,o,{get:()=>t[o],enumerable:!(n=ot(t,o))||n.enumerable});return e};var ut=e=>lt(F({},"__esModule",{value:!0}),e);var er={};it(er,{DAILY_REPORT_ACTION_FIELDS:()=>y,DAILY_REPORT_ACTION_INTENTS:()=>we,DAILY_REPORT_API_ENDPOINTS:()=>We,DAILY_REPORT_API_QUERY_PARAMS:()=>ve,DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS:()=>Q,DAILY_REPORT_CLIENT_TEMP_ID_PATTERN:()=>A,DAILY_REPORT_INTERNAL_SOURCE_TYPE:()=>et,DAILY_REPORT_SEARCH_BATCHES_IN_FLIGHT:()=>Qe,DAILY_REPORT_SEARCH_COMBINES:()=>qe,DAILY_REPORT_SSE_CURSOR_PARAM:()=>Se,DAILY_REPORT_SSE_HEARTBEAT_MS:()=>be,DAILY_REPORT_SSE_TERMINAL_EVENTS:()=>he,buildDailyReportAttachmentUrl:()=>ze,dailyReportDetailSchema:()=>_,dailyReportSseMessageSchema:()=>Ce,encodeDailyReportActionCommand:()=>Ne,foldDailyReportSourceTypeToken:()=>tt,forEachIdsStreamRow:()=>Ye,isDailyReportAttachmentThumbnailVariant:()=>v,normalizeBusinessDateKey:()=>Le,parseDailyReportActionResult:()=>Me,parseDailyReportAttachmentQuery:()=>$e,readDailyReportSearchMarksAnswer:()=>Je,readIdsStreamChunkLine:()=>je});module.exports=ut(er);var d=require("zod/v3");var A=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|-[1-9][0-9]{0,15})$/;var te=require("zod/v3"),D=e=>Number.isSafeInteger(e)&&e>0,m=te.z.number().int().positive().max(Number.MAX_SAFE_INTEGER);var C=/^[0-9a-f]{64}$/u;var re=e=>typeof e=="string"&&C.test(e);var i=require("zod/v3");var I=Symbol("daily-report wire mismatch"),R=(e,t,r)=>(e.issues.push({...r,path:t===null?[...e.path]:[...e.path,t]}),I),se=e=>e===null?"null":Array.isArray(e)?"array":Number.isNaN(e)?"nan":typeof e,b=(e,t)=>({code:"invalid_type",expected:e,received:se(t)}),pt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),dt=e=>{let t=0;for(let r in e)t+=1;return t},ne=(e,t,r)=>{let n={};for(let o=0;o<r;o+=1){let a=t[o];a in e&&(n[a]=e[a])}return n},x=e=>{let t=Object.keys(e),r=Object.values(e);return(n,o)=>{if(!pt(n))return R(o,null,b("object",n));let a=null,u=!1,s=0;for(let l=0;l<t.length;l+=1){let c=t[l],f=n[c];f!==void 0&&(s+=1);let g=r[l](f,o,c);if(g===I){u=!0;continue}a===null&&g!==f&&(a=ne(n,t,l)),a!==null&&(g!==void 0||c in n)&&(a[c]=g)}return u?I:a!==null?a:dt(n)===s?n:ne(n,t,t.length)}},k=e=>(t,r,n)=>{r.path.push(n);let o=e(t,r);return r.path.pop(),o},w=e=>(t,r,n)=>{if(!Array.isArray(t))return R(r,n,b("array",t));r.path.push(n);let o=t,a=!1;for(let u=0;u<t.length;u+=1){let s=t[u],l=e(s,r,u);l===I?a=!0:l!==s&&(o===t&&(o=t.slice()),o[u]=l)}return r.path.pop(),a?I:o},p=(e,t,r)=>e==null||typeof e=="string"?e:R(t,r,b("string",e)),oe=(e,t,r)=>e===null||typeof e=="string"?e:R(t,r,b("string",e)),ae=(e,t,r)=>typeof e=="string"?e:R(t,r,b("string",e)),ct=(e,t,r)=>e===null||typeof e=="number"&&!Number.isNaN(e)?e:R(t,r,b("number",e)),N=(e,t,r)=>typeof e=="boolean"?e:R(t,r,b("boolean",e)),ie=(e,t,r)=>typeof e!="string"?R(t,r,b("string",e)):re(e)?e:R(t,r,{code:"invalid_string",validation:"regex",message:"a content digest is 64 lowercase hex digits"}),mt=(e,t,r)=>e===null?null:ie(e,t,r),U=(e,t,r)=>{if(typeof e=="number"&&D(e))return e;for(let{message:n,path:o,...a}of m.safeParse(e).error.issues)R(t,r,a);return I},le={present:!0,absent:!0,unknown:!0},ue=Object.keys(le),yt=ue.map(e=>`'${e}'`).join(" | "),Rt=(e,t,r)=>typeof e!="string"?R(t,r,{code:"invalid_type",expected:yt,received:se(e)}):Object.hasOwn(le,e)?e:R(t,r,{code:"invalid_enum_value",received:e,options:[...ue]}),pe=x({name:p,affiliation:p}),de=x({name:p,text:p,color:p}),ce=x({id:U,name:p,color:p}),me=x({id:U,userId:p,userName:p,content:p,createdAt:p,isMine:N}),ft=x({id:ae,fileName:ae,fileType:oe,fileSize:ct,createdAt:oe,state:Rt,hasThumbnail:N}),Dt=x({reportHubId:U,date:p,createdAt:p,author:p,userId:p,sourceType:p,employeeName:p,updatedBy:p,updatedAt:p,category:p,creationCategory:p,visitTimeFrom:p,visitTimeTo:p,customerName:p,interviewers:w(k(pe)),subject:p,content:p,externalComments:w(k(de)),isRead:N,isStarred:N,contentDigest:ie,readContentDigest:mt,isDraft:N,labels:w(k(ce)),postedComments:w(k(me)),attachments:w(k(ft))}),M=(e,t)=>{let r={path:[],issues:[]},n=e(t,r);return n===I?{ok:!1,issues:r.issues}:{ok:!0,value:n}},ye=e=>M(Dt,e),Re=e=>M(pe,e),fe=e=>M(de,e),De=e=>M(ce,e),ge=e=>M(me,e);var he=["auth-required","forbidden","resync-required"],be=15e3,Se="lastEventId",gt=/^\d{1,15}-\d{1,15}$/,Ie=e=>gt.test(e);var O=e=>i.z.unknown().transform((t,r)=>{let n=e(t);if(n.ok)return n.value;for(let o of n.issues)r.addIssue({...o,fatal:!0});return i.z.NEVER}),cr=O(Re),mr=O(fe),yr=O(De),z=O(ge),_=O(ye),P=i.z.string().regex(A),Te=i.z.object({type:i.z.literal("connected")}),Ae=i.z.object({type:i.z.literal("status-update"),reportHubId:m,statusType:i.z.enum(["star","read"]),value:i.z.boolean(),readContentDigest:i.z.string().regex(C).nullable(),clientTempId:P}),$=i.z.string(),xe=i.z.object({type:i.z.literal("comment-add"),reportHubId:m,comment:z,clientTempId:P,sourceType:$}),_e=i.z.object({type:i.z.literal("comment-delete"),reportHubId:m,commentId:m,clientTempId:P,sourceType:$}),W={recipientRawUserId:m.optional()},ht=Ae.extend(W),bt=xe.extend(W),St=_e.extend(W),E={reportHubId:m,report:_,clientTempId:P},K={...W,actorRawUserId:m},V={viewerIsActor:i.z.boolean()},It=i.z.object({type:i.z.literal("report-create"),...E,...V}),Tt=i.z.object({type:i.z.literal("report-update"),...E,...V}),At=i.z.object({type:i.z.literal("report-publish"),...E,...V}),xt=i.z.object({type:i.z.literal("report-create"),...E,...K}),_t=i.z.object({type:i.z.literal("report-update"),...E,...K}),Et=i.z.object({type:i.z.literal("report-publish"),...E,...K}),Ee=i.z.object({type:i.z.literal("report-delete"),reportHubId:m,clientTempId:P,sourceType:$}),Ce=i.z.discriminatedUnion("type",[Te,Ae,xe,_e,It,Tt,At,Ee]),Rr=i.z.discriminatedUnion("type",[Te,ht,bt,St,xt,_t,Et,Ee]);var ke=e=>e.issues.map(t=>`${t.path.length===0?"(root)":t.path.join(".")}: ${t.code}`).join("; ");var we=Object.freeze(["create","update","publish","delete","toggleStar","toggleRead","addComment","deleteComment","clearCache"]);var y=Object.freeze({intent:"intent",clientTempId:"clientTempId",businessDate:"businessDate",operationTimestamp:"operationTimestamp",reportHubId:"reportHubId",title:"title",content:"content",isStarred:"isStarred",isRead:"isRead",contentDigest:"contentDigest",commentId:"commentId"}),Ne=e=>{let t=new FormData;if(t.append(y.intent,e.intent),e.intent==="clearCache"||(t.append(y.clientTempId,e.clientTempId),e.businessDate!==null&&t.append(y.businessDate,e.businessDate),e.operationTimestamp!==null&&t.append(y.operationTimestamp,String(e.operationTimestamp)),e.intent==="create"))return t;switch(t.append(y.reportHubId,String(e.reportHubId)),e.intent){case"update":return e.changes.title!==void 0&&t.append(y.title,e.changes.title),e.changes.content!==void 0&&t.append(y.content,e.changes.content),t;case"publish":case"delete":return t;case"toggleStar":return t.append(y.isStarred,String(e.value)),t;case"toggleRead":return t.append(y.isRead,String(e.value)),e.value&&t.append(y.contentDigest,e.contentDigest),t;case"addComment":return t.append(y.content,e.content),t;case"deleteComment":return t.append(y.commentId,String(e.commentId)),t}},Ct=()=>{let e=m,t=d.z.string().regex(A),r=d.z.literal("OK"),n=d.z.object({isStarred:d.z.boolean(),isRead:d.z.boolean(),readContentDigest:d.z.string().regex(C).nullable()}),o=d.z.number().int().nonnegative().nullable();return{create:d.z.object({status:r,intent:d.z.literal("create"),reportHubId:e,clientTempId:t,report:_}),update:d.z.object({status:r,intent:d.z.literal("update"),reportHubId:e,clientTempId:t}),publish:d.z.object({status:r,intent:d.z.literal("publish"),reportHubId:e,clientTempId:t,report:_.nullable()}),delete:d.z.object({status:r,intent:d.z.literal("delete"),reportHubId:e,clientTempId:t}),toggleStar:d.z.object({status:r,intent:d.z.literal("toggleStar"),reportHubId:e,clientTempId:t,updatedStatus:n,operationTimestamp:o}),toggleRead:d.z.object({status:r,intent:d.z.literal("toggleRead"),reportHubId:e,clientTempId:t,updatedStatus:n,operationTimestamp:o}),addComment:d.z.object({status:r,intent:d.z.literal("addComment"),reportHubId:e,clientTempId:t,newComment:z}),deleteComment:d.z.object({status:r,intent:d.z.literal("deleteComment"),reportHubId:e,clientTempId:t,deletedCommentId:m}),clearCache:d.z.object({status:r,intent:d.z.literal("clearCache")})}},G=null,kt=()=>(G===null&&(G=Ct()),G),Me=(e,t)=>{let r=kt()[e].safeParse(t);return r.success?{result:r.data}:{mismatch:ke(r.error)}};var wt=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var Oe=e=>e<10?`0${e}`:`${e}`,Nt=e=>{if(Number.isNaN(e.getTime()))return null;let t=e.getFullYear(),r=Oe(e.getMonth()+1),n=Oe(e.getDate());return`${t}-${r}-${n}`},Pe=e=>{let t=wt.exec(e);if(t===null)return null;let[,r,,n,o]=t,a=Number(r),u=Number(n),s=Number(o);if(a<1)return null;let l=new Date(0);return l.setUTCFullYear(a,u-1,s),l.getUTCFullYear()!==a||l.getUTCMonth()!==u-1||l.getUTCDate()!==s?null:`${r}-${n}-${o}`},q=e=>Pe(e)===e;var Le=e=>e==null?null:e instanceof Date?Nt(e):Pe(e);var He="ids-columns",Mt=e=>{if(typeof e!="object"||e===null)return"unknown";let{kind:t}=e;return t==="chunk"?"chunk":t==="error"?"error":"unknown"},Ot=e=>typeof e=="number"&&D(e),Pt=e=>{if(typeof e!="object"||e===null)return!1;let{businessDate:t,reportHubId:r}=e;return(t===null||typeof t=="string")&&typeof r=="number"},Lt=4,Ht=e=>{let t=Lt;for(;2**t<e*2;)t+=1;let r=new Float64Array(2**t),n=r.length-1,o=32-t;return a=>{let u=Math.imul(a|0,2654435761)>>>o;for(;;){let s=r[u];if(s===0)return r[u]=a,!0;if(s===a)return!1;u=u+1&n}}},jt=/^[0-9a-f]{1,16}$/,Yt=e=>D(e.reportHubId)&&(e.businessDate===null||q(e.businessDate)),Wt=e=>typeof e=="string"&&jt.test(e),vt=Object.freeze({kind:"absent"}),Bt=Object.freeze({kind:"value",value:null}),Ft=e=>e===void 0?vt:e===null?Bt:typeof e=="string"&&Ie(e)?{kind:"value",value:e}:{kind:"malformed",received:e},je=e=>{if(Mt(e)!=="chunk")return null;let{ids:t,dates:r,counts:n,sourceTypes:o,sources:a,isLast:u,nextCursor:s,total:l,snapshot:c,provisional:f,restarted:g,streamAnchor:rt}=e;if(typeof u!="boolean"||!(s===null||Pt(s))||!(Array.isArray(t)&&Array.isArray(r)&&Array.isArray(n)&&Array.isArray(o)&&Array.isArray(a))||r.length!==n.length||a.length!==t.length)return null;for(let h of o)if(!(h===null||typeof h=="string"))return null;let nt=Ht(t.length),S=0,X=null,J=0;for(let h=0;h<r.length;h++){let T=r[h],H=n[h];if(!(T===null||typeof T=="string"&&q(T))||h>0&&T===r[h-1]||typeof H!="number"||!Number.isSafeInteger(H)||H<1)return null;let ee=S+H;if(ee>t.length)return null;for(;S<ee;S++){let j=t[S],Y=a[S];if(!(Ot(j)&&nt(j))||typeof Y!="number"||!Number.isSafeInteger(Y)||Y<0||Y>=o.length||S>0&&!zt(X,J,T,j))return null;X=T,J=j}}return S!==t.length?null:{rows:e,isLast:u,resumeCursor:s!==null&&Yt(s)?s:null,total:typeof l=="number"&&Number.isSafeInteger(l)&&l>=0?l:null,snapshot:Wt(c)?c:null,provisional:f===!0,restarted:g===!0,streamAnchor:Ft(rt)}},Ye=(e,t)=>{let{ids:r,dates:n,counts:o,sourceTypes:a,sources:u}=e,s=0;for(let l=0;l<n.length;l++){let c=n[l];for(let f=s+o[l];s<f;s++){let g=a[u[s]];t(r[s],c,g===null?void 0:g)}}};var Ut=(e,t,r,n)=>e!==r?e===null?1:r===null||e>r?-1:1:n-t,zt=(e,t,r,n)=>Ut(e,t,r,n)<0;var We=Object.freeze({businessDate:"business-date",idsStream:He,report:"report",search:"search",reports:"reports",searchMarks:"search-marks",searchFacets:"search-facets",action:"action"}),ve=Object.freeze({businessDate:"businessDate",reportHubId:"reportHubId",searchQuery:"q",searchCombine:"combine",searchAuthor:"author",searchSourceType:"sourceType",searchCustomer:"customer",reportIds:"ids",forceRefresh:"forceRefresh",cursorReportHubId:"cursor_report_hub_id",cursorBusinessDate:"cursor_business_date",cursorSnapshot:"cursor_snapshot"});var Q=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),v=e=>Object.hasOwn(Q,e);var Be="download",Fe="thumbnail",Ue="1",ze=(e,t,r)=>{let n=`${e}/attachment/${encodeURIComponent(t)}`;switch(r.kind){case"inline":return n;case"download":return`${n}?${new URLSearchParams({[Be]:Ue})}`;case"thumbnail":return`${n}?${new URLSearchParams({[Fe]:r.variant})}`}},$e=e=>{let t=e.getAll(Fe),r=e.getAll(Be);if(t.length>0&&r.length>0)return{kind:"invalid",reason:"conflict"};if(t.length>0){let[n]=t;return t.length===1&&v(n)?{kind:"thumbnail",variant:n}:{kind:"invalid",reason:"thumbnail_variant"}}return r.length>0?r.length===1&&r[0]===Ue?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var Z="legacy-";var $t=/^[1-9][0-9]*$/,Kt=/^(?:0|[1-9][0-9]*)$/,Ke=e=>{if(e===null||!$t.test(e))return null;let t=Number(e);return D(t)?t:null},B=e=>{if(e===null||!Kt.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)?t:null};var Vt=Object.freeze(["subject","content","author","employeeName","updatedBy","category","creationCategory","customerName"]),Wr=Object.freeze({field:e=>e,interviewer:(e,t)=>`interviewer:${e}:${t}`,attachment:e=>`attachment:${e}`,comment:(e,t)=>`comment:${e}:${t}`}),Gt=e=>e.startsWith(Z)?B(e.slice(Z.length))!==null:Ke(e)!==null,Ve=e=>{if(Vt.includes(e))return!0;let t=e.split(":");switch(t[0]){case"interviewer":return t.length===3&&B(t[1])!==null&&(t[2]==="name"||t[2]==="affiliation");case"attachment":return t.length===2&&B(t[1])!==null;case"comment":return t.length===3&&Gt(t[1])&&(t[2]==="author"||t[2]==="content");default:return!1}};var vr=String.fromCodePoint(3),Br=String.fromCodePoint(2),Fr=String.fromCodePoint(1);var qe=["intersection","union"];var zr=Object.freeze({maxQueryLength:500,maxSets:16,maxWordsPerSet:16,maxWords:32,maxWordLength:100,maxDetailIds:100}),qt=2,Qe=2,Ge=Object.freeze({word:0,reading:1}),Ze=e=>e===Ge.word||e===Ge.reading;var L=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},$r=2*(1+qt);var Qt=4294967295,Xe=e=>typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=Qt,Zt=e=>{if(!Array.isArray(e)||e.length%3!==0)return null;let t=[];for(let r=0;r<e.length;r+=3){let n=e[r],o=e[r+1],a=e[r+2];if(!(typeof n=="number"&&Number.isSafeInteger(n)&&n>=0&&typeof o=="number"&&Number.isSafeInteger(o)&&n<o)||!Ze(a))return null;if(r>0){let u=t[r-2];if(u>n||u===n&&t[r-1]===a)return null}t.push(n,o,a)}return t},Xt=e=>{if(!(L(e)&&Xe(e.fingerprint)))return null;if(Object.hasOwn(e,"dense"))return e.dense===!0&&!Object.hasOwn(e,"ranges")?{fingerprint:e.fingerprint,dense:!0}:null;let t=Zt(e.ranges);return t===null?null:{fingerprint:e.fingerprint,ranges:t}},Jt=e=>{if(!L(e))return null;let t={};for(let[r,n]of Object.entries(e)){if(!Ve(r))return null;let o=Xt(n);if(o===null)return null;t[r]=o}return t},Je=(e,t)=>{if(!(L(e)&&Xe(e.wordsDigest)&&Array.isArray(e.reports)&&Array.isArray(e.deferred)))return null;let r=new Set(t.requestedIds),n=new Set,o=2**t.setCount-1,a=[];for(let s of e.reports){if(!L(s))return null;let{reportHubId:l,matchedSets:c}=s;if(!(typeof l=="number"&&D(l)&&r.has(l))||n.has(l)||(n.add(l),t.expectsMatchedSets?!(typeof c=="number"&&Number.isInteger(c)&&c>=0&&c<=o):c!==null))return null;let f=Jt(s.fields);if(f===null)return null;a.push({reportHubId:l,matchedSets:c,fields:f})}if(a.length===0&&e.deferred.length>0)return null;let u=[];for(let s of e.deferred){if(!(typeof s=="number"&&D(s)&&r.has(s))||n.has(s))return null;n.add(s),u.push(s)}return{wordsDigest:e.wordsDigest,reports:a,deferred:u}};var et="Internal",tt=e=>e.trim().toLowerCase();0&&(module.exports={DAILY_REPORT_ACTION_FIELDS,DAILY_REPORT_ACTION_INTENTS,DAILY_REPORT_API_ENDPOINTS,DAILY_REPORT_API_QUERY_PARAMS,DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,DAILY_REPORT_CLIENT_TEMP_ID_PATTERN,DAILY_REPORT_INTERNAL_SOURCE_TYPE,DAILY_REPORT_SEARCH_BATCHES_IN_FLIGHT,DAILY_REPORT_SEARCH_COMBINES,DAILY_REPORT_SSE_CURSOR_PARAM,DAILY_REPORT_SSE_HEARTBEAT_MS,DAILY_REPORT_SSE_TERMINAL_EVENTS,buildDailyReportAttachmentUrl,dailyReportDetailSchema,dailyReportSseMessageSchema,encodeDailyReportActionCommand,foldDailyReportSourceTypeToken,forEachIdsStreamRow,isDailyReportAttachmentThumbnailVariant,normalizeBusinessDateKey,parseDailyReportActionResult,parseDailyReportAttachmentQuery,readDailyReportSearchMarksAnswer,readIdsStreamChunkLine});
1
+ "use strict";var F=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var st=Object.getOwnPropertyNames;var it=Object.prototype.hasOwnProperty;var lt=(e,t)=>{for(var r in t)F(e,r,{get:t[r],enumerable:!0})},ut=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of st(t))!it.call(e,o)&&o!==r&&F(e,o,{get:()=>t[o],enumerable:!(n=at(t,o))||n.enumerable});return e};var pt=e=>ut(F({},"__esModule",{value:!0}),e);var tr={};lt(tr,{DAILY_REPORT_ACTION_FIELDS:()=>y,DAILY_REPORT_ACTION_INTENTS:()=>Ne,DAILY_REPORT_API_ENDPOINTS:()=>ve,DAILY_REPORT_API_QUERY_PARAMS:()=>Be,DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS:()=>Q,DAILY_REPORT_CLIENT_TEMP_ID_PATTERN:()=>A,DAILY_REPORT_INTERNAL_SOURCE_TYPE:()=>tt,DAILY_REPORT_SEARCH_BATCHES_IN_FLIGHT:()=>Ze,DAILY_REPORT_SEARCH_COMBINES:()=>Qe,DAILY_REPORT_SSE_CURSOR_PARAM:()=>Ie,DAILY_REPORT_SSE_HEARTBEAT_MS:()=>Se,DAILY_REPORT_SSE_TERMINAL_EVENTS:()=>be,buildDailyReportAttachmentUrl:()=>$e,dailyReportDetailSchema:()=>_,dailyReportReadStateOf:()=>ne,dailyReportSseMessageSchema:()=>ke,encodeDailyReportActionCommand:()=>Me,foldDailyReportSourceTypeToken:()=>rt,forEachIdsStreamRow:()=>We,isDailyReportAttachmentThumbnailVariant:()=>v,normalizeBusinessDateKey:()=>He,parseDailyReportActionResult:()=>Oe,parseDailyReportAttachmentQuery:()=>Ke,readDailyReportSearchMarksAnswer:()=>et,readIdsStreamChunkLine:()=>Ye});module.exports=pt(tr);var d=require("zod/v3");var A=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|-[1-9][0-9]{0,15})$/;var te=require("zod/v3"),D=e=>Number.isSafeInteger(e)&&e>0,m=te.z.number().int().positive().max(Number.MAX_SAFE_INTEGER);var C=/^[0-9a-f]{64}$/u;var re=e=>typeof e=="string"&&C.test(e),ne=(e,t)=>e.isRead?e.readContentDigest===null||e.readContentDigest===e.contentDigest||typeof t=="string"&&t!==""&&e.userId===t?"read":"updatedSinceRead":"unread";var i=require("zod/v3");var I=Symbol("daily-report wire mismatch"),R=(e,t,r)=>(e.issues.push({...r,path:t===null?[...e.path]:[...e.path,t]}),I),ie=e=>e===null?"null":Array.isArray(e)?"array":Number.isNaN(e)?"nan":typeof e,b=(e,t)=>({code:"invalid_type",expected:e,received:ie(t)}),dt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),ct=e=>{let t=0;for(let r in e)t+=1;return t},oe=(e,t,r)=>{let n={};for(let o=0;o<r;o+=1){let a=t[o];a in e&&(n[a]=e[a])}return n},x=e=>{let t=Object.keys(e),r=Object.values(e);return(n,o)=>{if(!dt(n))return R(o,null,b("object",n));let a=null,u=!1,s=0;for(let l=0;l<t.length;l+=1){let c=t[l],f=n[c];f!==void 0&&(s+=1);let g=r[l](f,o,c);if(g===I){u=!0;continue}a===null&&g!==f&&(a=oe(n,t,l)),a!==null&&(g!==void 0||c in n)&&(a[c]=g)}return u?I:a!==null?a:ct(n)===s?n:oe(n,t,t.length)}},k=e=>(t,r,n)=>{r.path.push(n);let o=e(t,r);return r.path.pop(),o},w=e=>(t,r,n)=>{if(!Array.isArray(t))return R(r,n,b("array",t));r.path.push(n);let o=t,a=!1;for(let u=0;u<t.length;u+=1){let s=t[u],l=e(s,r,u);l===I?a=!0:l!==s&&(o===t&&(o=t.slice()),o[u]=l)}return r.path.pop(),a?I:o},p=(e,t,r)=>e==null||typeof e=="string"?e:R(t,r,b("string",e)),ae=(e,t,r)=>e===null||typeof e=="string"?e:R(t,r,b("string",e)),se=(e,t,r)=>typeof e=="string"?e:R(t,r,b("string",e)),mt=(e,t,r)=>e===null||typeof e=="number"&&!Number.isNaN(e)?e:R(t,r,b("number",e)),N=(e,t,r)=>typeof e=="boolean"?e:R(t,r,b("boolean",e)),le=(e,t,r)=>typeof e!="string"?R(t,r,b("string",e)):re(e)?e:R(t,r,{code:"invalid_string",validation:"regex",message:"a content digest is 64 lowercase hex digits"}),yt=(e,t,r)=>e===null?null:le(e,t,r),U=(e,t,r)=>{if(typeof e=="number"&&D(e))return e;for(let{message:n,path:o,...a}of m.safeParse(e).error.issues)R(t,r,a);return I},ue={present:!0,absent:!0,unknown:!0},pe=Object.keys(ue),Rt=pe.map(e=>`'${e}'`).join(" | "),ft=(e,t,r)=>typeof e!="string"?R(t,r,{code:"invalid_type",expected:Rt,received:ie(e)}):Object.hasOwn(ue,e)?e:R(t,r,{code:"invalid_enum_value",received:e,options:[...pe]}),de=x({name:p,affiliation:p}),ce=x({name:p,text:p,color:p}),me=x({id:U,name:p,color:p}),ye=x({id:U,userId:p,userName:p,content:p,createdAt:p,isMine:N}),Dt=x({id:se,fileName:se,fileType:ae,fileSize:mt,createdAt:ae,state:ft,hasThumbnail:N}),gt=x({reportHubId:U,date:p,createdAt:p,author:p,userId:p,sourceType:p,employeeName:p,updatedBy:p,updatedAt:p,category:p,creationCategory:p,visitTimeFrom:p,visitTimeTo:p,customerName:p,interviewers:w(k(de)),subject:p,content:p,externalComments:w(k(ce)),isRead:N,isStarred:N,contentDigest:le,readContentDigest:yt,isDraft:N,labels:w(k(me)),postedComments:w(k(ye)),attachments:w(k(Dt))}),M=(e,t)=>{let r={path:[],issues:[]},n=e(t,r);return n===I?{ok:!1,issues:r.issues}:{ok:!0,value:n}},Re=e=>M(gt,e),fe=e=>M(de,e),De=e=>M(ce,e),ge=e=>M(me,e),he=e=>M(ye,e);var be=["auth-required","forbidden","resync-required"],Se=15e3,Ie="lastEventId",ht=/^\d{1,15}-\d{1,15}$/,Te=e=>ht.test(e);var O=e=>i.z.unknown().transform((t,r)=>{let n=e(t);if(n.ok)return n.value;for(let o of n.issues)r.addIssue({...o,fatal:!0});return i.z.NEVER}),mr=O(fe),yr=O(De),Rr=O(ge),z=O(he),_=O(Re),P=i.z.string().regex(A),Ae=i.z.object({type:i.z.literal("connected")}),xe=i.z.object({type:i.z.literal("status-update"),reportHubId:m,statusType:i.z.enum(["star","read"]),value:i.z.boolean(),readContentDigest:i.z.string().regex(C).nullable(),clientTempId:P}),$=i.z.string(),_e=i.z.object({type:i.z.literal("comment-add"),reportHubId:m,comment:z,clientTempId:P,sourceType:$}),Ee=i.z.object({type:i.z.literal("comment-delete"),reportHubId:m,commentId:m,clientTempId:P,sourceType:$}),W={recipientRawUserId:m.optional()},bt=xe.extend(W),St=_e.extend(W),It=Ee.extend(W),E={reportHubId:m,report:_,clientTempId:P},K={...W,actorRawUserId:m},V={viewerIsActor:i.z.boolean()},Tt=i.z.object({type:i.z.literal("report-create"),...E,...V}),At=i.z.object({type:i.z.literal("report-update"),...E,...V}),xt=i.z.object({type:i.z.literal("report-publish"),...E,...V}),_t=i.z.object({type:i.z.literal("report-create"),...E,...K}),Et=i.z.object({type:i.z.literal("report-update"),...E,...K}),Ct=i.z.object({type:i.z.literal("report-publish"),...E,...K}),Ce=i.z.object({type:i.z.literal("report-delete"),reportHubId:m,clientTempId:P,sourceType:$}),ke=i.z.discriminatedUnion("type",[Ae,xe,_e,Ee,Tt,At,xt,Ce]),fr=i.z.discriminatedUnion("type",[Ae,bt,St,It,_t,Et,Ct,Ce]);var we=e=>e.issues.map(t=>`${t.path.length===0?"(root)":t.path.join(".")}: ${t.code}`).join("; ");var Ne=Object.freeze(["create","update","publish","delete","toggleStar","toggleRead","addComment","deleteComment","clearCache"]);var y=Object.freeze({intent:"intent",clientTempId:"clientTempId",businessDate:"businessDate",operationTimestamp:"operationTimestamp",reportHubId:"reportHubId",title:"title",content:"content",isStarred:"isStarred",isRead:"isRead",contentDigest:"contentDigest",commentId:"commentId"}),Me=e=>{let t=new FormData;if(t.append(y.intent,e.intent),e.intent==="clearCache"||(t.append(y.clientTempId,e.clientTempId),e.businessDate!==null&&t.append(y.businessDate,e.businessDate),e.operationTimestamp!==null&&t.append(y.operationTimestamp,String(e.operationTimestamp)),e.intent==="create"))return t;switch(t.append(y.reportHubId,String(e.reportHubId)),e.intent){case"update":return e.changes.title!==void 0&&t.append(y.title,e.changes.title),e.changes.content!==void 0&&t.append(y.content,e.changes.content),t;case"publish":case"delete":return t;case"toggleStar":return t.append(y.isStarred,String(e.value)),t;case"toggleRead":return t.append(y.isRead,String(e.value)),e.value&&t.append(y.contentDigest,e.contentDigest),t;case"addComment":return t.append(y.content,e.content),t;case"deleteComment":return t.append(y.commentId,String(e.commentId)),t}},kt=()=>{let e=m,t=d.z.string().regex(A),r=d.z.literal("OK"),n=d.z.object({isStarred:d.z.boolean(),isRead:d.z.boolean(),readContentDigest:d.z.string().regex(C).nullable()}),o=d.z.number().int().nonnegative().nullable();return{create:d.z.object({status:r,intent:d.z.literal("create"),reportHubId:e,clientTempId:t,report:_}),update:d.z.object({status:r,intent:d.z.literal("update"),reportHubId:e,clientTempId:t}),publish:d.z.object({status:r,intent:d.z.literal("publish"),reportHubId:e,clientTempId:t,report:_.nullable()}),delete:d.z.object({status:r,intent:d.z.literal("delete"),reportHubId:e,clientTempId:t}),toggleStar:d.z.object({status:r,intent:d.z.literal("toggleStar"),reportHubId:e,clientTempId:t,updatedStatus:n,operationTimestamp:o}),toggleRead:d.z.object({status:r,intent:d.z.literal("toggleRead"),reportHubId:e,clientTempId:t,updatedStatus:n,operationTimestamp:o}),addComment:d.z.object({status:r,intent:d.z.literal("addComment"),reportHubId:e,clientTempId:t,newComment:z}),deleteComment:d.z.object({status:r,intent:d.z.literal("deleteComment"),reportHubId:e,clientTempId:t,deletedCommentId:m}),clearCache:d.z.object({status:r,intent:d.z.literal("clearCache")})}},G=null,wt=()=>(G===null&&(G=kt()),G),Oe=(e,t)=>{let r=wt()[e].safeParse(t);return r.success?{result:r.data}:{mismatch:we(r.error)}};var Nt=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var Pe=e=>e<10?`0${e}`:`${e}`,Mt=e=>{if(Number.isNaN(e.getTime()))return null;let t=e.getFullYear(),r=Pe(e.getMonth()+1),n=Pe(e.getDate());return`${t}-${r}-${n}`},Le=e=>{let t=Nt.exec(e);if(t===null)return null;let[,r,,n,o]=t,a=Number(r),u=Number(n),s=Number(o);if(a<1)return null;let l=new Date(0);return l.setUTCFullYear(a,u-1,s),l.getUTCFullYear()!==a||l.getUTCMonth()!==u-1||l.getUTCDate()!==s?null:`${r}-${n}-${o}`},q=e=>Le(e)===e;var He=e=>e==null?null:e instanceof Date?Mt(e):Le(e);var je="ids-columns",Ot=e=>{if(typeof e!="object"||e===null)return"unknown";let{kind:t}=e;return t==="chunk"?"chunk":t==="error"?"error":"unknown"},Pt=e=>typeof e=="number"&&D(e),Lt=e=>{if(typeof e!="object"||e===null)return!1;let{businessDate:t,reportHubId:r}=e;return(t===null||typeof t=="string")&&typeof r=="number"},Ht=4,jt=e=>{let t=Ht;for(;2**t<e*2;)t+=1;let r=new Float64Array(2**t),n=r.length-1,o=32-t;return a=>{let u=Math.imul(a|0,2654435761)>>>o;for(;;){let s=r[u];if(s===0)return r[u]=a,!0;if(s===a)return!1;u=u+1&n}}},Yt=/^[0-9a-f]{1,16}$/,Wt=e=>D(e.reportHubId)&&(e.businessDate===null||q(e.businessDate)),vt=e=>typeof e=="string"&&Yt.test(e),Bt=Object.freeze({kind:"absent"}),Ft=Object.freeze({kind:"value",value:null}),Ut=e=>e===void 0?Bt:e===null?Ft:typeof e=="string"&&Te(e)?{kind:"value",value:e}:{kind:"malformed",received:e},Ye=e=>{if(Ot(e)!=="chunk")return null;let{ids:t,dates:r,counts:n,sourceTypes:o,sources:a,isLast:u,nextCursor:s,total:l,snapshot:c,provisional:f,restarted:g,streamAnchor:nt}=e;if(typeof u!="boolean"||!(s===null||Lt(s))||!(Array.isArray(t)&&Array.isArray(r)&&Array.isArray(n)&&Array.isArray(o)&&Array.isArray(a))||r.length!==n.length||a.length!==t.length)return null;for(let h of o)if(!(h===null||typeof h=="string"))return null;let ot=jt(t.length),S=0,X=null,J=0;for(let h=0;h<r.length;h++){let T=r[h],H=n[h];if(!(T===null||typeof T=="string"&&q(T))||h>0&&T===r[h-1]||typeof H!="number"||!Number.isSafeInteger(H)||H<1)return null;let ee=S+H;if(ee>t.length)return null;for(;S<ee;S++){let j=t[S],Y=a[S];if(!(Pt(j)&&ot(j))||typeof Y!="number"||!Number.isSafeInteger(Y)||Y<0||Y>=o.length||S>0&&!$t(X,J,T,j))return null;X=T,J=j}}return S!==t.length?null:{rows:e,isLast:u,resumeCursor:s!==null&&Wt(s)?s:null,total:typeof l=="number"&&Number.isSafeInteger(l)&&l>=0?l:null,snapshot:vt(c)?c:null,provisional:f===!0,restarted:g===!0,streamAnchor:Ut(nt)}},We=(e,t)=>{let{ids:r,dates:n,counts:o,sourceTypes:a,sources:u}=e,s=0;for(let l=0;l<n.length;l++){let c=n[l];for(let f=s+o[l];s<f;s++){let g=a[u[s]];t(r[s],c,g===null?void 0:g)}}};var zt=(e,t,r,n)=>e!==r?e===null?1:r===null||e>r?-1:1:n-t,$t=(e,t,r,n)=>zt(e,t,r,n)<0;var ve=Object.freeze({businessDate:"business-date",idsStream:je,report:"report",search:"search",reports:"reports",searchMarks:"search-marks",searchFacets:"search-facets",action:"action"}),Be=Object.freeze({businessDate:"businessDate",reportHubId:"reportHubId",searchQuery:"q",searchCombine:"combine",searchAuthor:"author",searchSourceType:"sourceType",searchCustomer:"customer",reportIds:"ids",forceRefresh:"forceRefresh",cursorReportHubId:"cursor_report_hub_id",cursorBusinessDate:"cursor_business_date",cursorSnapshot:"cursor_snapshot"});var Q=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),v=e=>Object.hasOwn(Q,e);var Fe="download",Ue="thumbnail",ze="1",$e=(e,t,r)=>{let n=`${e}/attachment/${encodeURIComponent(t)}`;switch(r.kind){case"inline":return n;case"download":return`${n}?${new URLSearchParams({[Fe]:ze})}`;case"thumbnail":return`${n}?${new URLSearchParams({[Ue]:r.variant})}`}},Ke=e=>{let t=e.getAll(Ue),r=e.getAll(Fe);if(t.length>0&&r.length>0)return{kind:"invalid",reason:"conflict"};if(t.length>0){let[n]=t;return t.length===1&&v(n)?{kind:"thumbnail",variant:n}:{kind:"invalid",reason:"thumbnail_variant"}}return r.length>0?r.length===1&&r[0]===ze?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var Z="legacy-";var Kt=/^[1-9][0-9]*$/,Vt=/^(?:0|[1-9][0-9]*)$/,Ve=e=>{if(e===null||!Kt.test(e))return null;let t=Number(e);return D(t)?t:null},B=e=>{if(e===null||!Vt.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)?t:null};var Gt=Object.freeze(["subject","content","author","employeeName","updatedBy","category","creationCategory","customerName"]),vr=Object.freeze({field:e=>e,interviewer:(e,t)=>`interviewer:${e}:${t}`,attachment:e=>`attachment:${e}`,comment:(e,t)=>`comment:${e}:${t}`}),qt=e=>e.startsWith(Z)?B(e.slice(Z.length))!==null:Ve(e)!==null,Ge=e=>{if(Gt.includes(e))return!0;let t=e.split(":");switch(t[0]){case"interviewer":return t.length===3&&B(t[1])!==null&&(t[2]==="name"||t[2]==="affiliation");case"attachment":return t.length===2&&B(t[1])!==null;case"comment":return t.length===3&&qt(t[1])&&(t[2]==="author"||t[2]==="content");default:return!1}};var Br=String.fromCodePoint(3),Fr=String.fromCodePoint(2),Ur=String.fromCodePoint(1);var Qe=["intersection","union"];var $r=Object.freeze({maxQueryLength:500,maxSets:16,maxWordsPerSet:16,maxWords:32,maxWordLength:100,maxDetailIds:100}),Qt=2,Ze=2,qe=Object.freeze({word:0,reading:1}),Xe=e=>e===qe.word||e===qe.reading;var L=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Kr=2*(1+Qt);var Zt=4294967295,Je=e=>typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=Zt,Xt=e=>{if(!Array.isArray(e)||e.length%3!==0)return null;let t=[];for(let r=0;r<e.length;r+=3){let n=e[r],o=e[r+1],a=e[r+2];if(!(typeof n=="number"&&Number.isSafeInteger(n)&&n>=0&&typeof o=="number"&&Number.isSafeInteger(o)&&n<o)||!Xe(a))return null;if(r>0){let u=t[r-2];if(u>n||u===n&&t[r-1]===a)return null}t.push(n,o,a)}return t},Jt=e=>{if(!(L(e)&&Je(e.fingerprint)))return null;if(Object.hasOwn(e,"dense"))return e.dense===!0&&!Object.hasOwn(e,"ranges")?{fingerprint:e.fingerprint,dense:!0}:null;let t=Xt(e.ranges);return t===null?null:{fingerprint:e.fingerprint,ranges:t}},er=e=>{if(!L(e))return null;let t={};for(let[r,n]of Object.entries(e)){if(!Ge(r))return null;let o=Jt(n);if(o===null)return null;t[r]=o}return t},et=(e,t)=>{if(!(L(e)&&Je(e.wordsDigest)&&Array.isArray(e.reports)&&Array.isArray(e.deferred)))return null;let r=new Set(t.requestedIds),n=new Set,o=2**t.setCount-1,a=[];for(let s of e.reports){if(!L(s))return null;let{reportHubId:l,matchedSets:c}=s;if(!(typeof l=="number"&&D(l)&&r.has(l))||n.has(l)||(n.add(l),t.expectsMatchedSets?!(typeof c=="number"&&Number.isInteger(c)&&c>=0&&c<=o):c!==null))return null;let f=er(s.fields);if(f===null)return null;a.push({reportHubId:l,matchedSets:c,fields:f})}if(a.length===0&&e.deferred.length>0)return null;let u=[];for(let s of e.deferred){if(!(typeof s=="number"&&D(s)&&r.has(s))||n.has(s))return null;n.add(s),u.push(s)}return{wordsDigest:e.wordsDigest,reports:a,deferred:u}};var tt="Internal",rt=e=>e.trim().toLowerCase();0&&(module.exports={DAILY_REPORT_ACTION_FIELDS,DAILY_REPORT_ACTION_INTENTS,DAILY_REPORT_API_ENDPOINTS,DAILY_REPORT_API_QUERY_PARAMS,DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,DAILY_REPORT_CLIENT_TEMP_ID_PATTERN,DAILY_REPORT_INTERNAL_SOURCE_TYPE,DAILY_REPORT_SEARCH_BATCHES_IN_FLIGHT,DAILY_REPORT_SEARCH_COMBINES,DAILY_REPORT_SSE_CURSOR_PARAM,DAILY_REPORT_SSE_HEARTBEAT_MS,DAILY_REPORT_SSE_TERMINAL_EVENTS,buildDailyReportAttachmentUrl,dailyReportDetailSchema,dailyReportReadStateOf,dailyReportSseMessageSchema,encodeDailyReportActionCommand,foldDailyReportSourceTypeToken,forEachIdsStreamRow,isDailyReportAttachmentThumbnailVariant,normalizeBusinessDateKey,parseDailyReportActionResult,parseDailyReportAttachmentQuery,readDailyReportSearchMarksAnswer,readIdsStreamChunkLine});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{z as d}from"zod/v3";var _=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|-[1-9][0-9]{0,15})$/;import{z as je}from"zod/v3";var D=e=>Number.isSafeInteger(e)&&e>0,m=je.number().int().positive().max(Number.MAX_SAFE_INTEGER);var E=/^[0-9a-f]{64}$/u;var J=e=>typeof e=="string"&&E.test(e);import{z as i}from"zod/v3";var I=Symbol("daily-report wire mismatch"),R=(e,t,r)=>(e.issues.push({...r,path:t===null?[...e.path]:[...e.path,t]}),I),ne=e=>e===null?"null":Array.isArray(e)?"array":Number.isNaN(e)?"nan":typeof e,b=(e,t)=>({code:"invalid_type",expected:e,received:ne(t)}),Ye=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),We=e=>{let t=0;for(let r in e)t+=1;return t},ee=(e,t,r)=>{let n={};for(let o=0;o<r;o+=1){let a=t[o];a in e&&(n[a]=e[a])}return n},A=e=>{let t=Object.keys(e),r=Object.values(e);return(n,o)=>{if(!Ye(n))return R(o,null,b("object",n));let a=null,u=!1,s=0;for(let l=0;l<t.length;l+=1){let c=t[l],f=n[c];f!==void 0&&(s+=1);let g=r[l](f,o,c);if(g===I){u=!0;continue}a===null&&g!==f&&(a=ee(n,t,l)),a!==null&&(g!==void 0||c in n)&&(a[c]=g)}return u?I:a!==null?a:We(n)===s?n:ee(n,t,t.length)}},C=e=>(t,r,n)=>{r.path.push(n);let o=e(t,r);return r.path.pop(),o},k=e=>(t,r,n)=>{if(!Array.isArray(t))return R(r,n,b("array",t));r.path.push(n);let o=t,a=!1;for(let u=0;u<t.length;u+=1){let s=t[u],l=e(s,r,u);l===I?a=!0:l!==s&&(o===t&&(o=t.slice()),o[u]=l)}return r.path.pop(),a?I:o},p=(e,t,r)=>e==null||typeof e=="string"?e:R(t,r,b("string",e)),te=(e,t,r)=>e===null||typeof e=="string"?e:R(t,r,b("string",e)),re=(e,t,r)=>typeof e=="string"?e:R(t,r,b("string",e)),ve=(e,t,r)=>e===null||typeof e=="number"&&!Number.isNaN(e)?e:R(t,r,b("number",e)),w=(e,t,r)=>typeof e=="boolean"?e:R(t,r,b("boolean",e)),oe=(e,t,r)=>typeof e!="string"?R(t,r,b("string",e)):J(e)?e:R(t,r,{code:"invalid_string",validation:"regex",message:"a content digest is 64 lowercase hex digits"}),Be=(e,t,r)=>e===null?null:oe(e,t,r),B=(e,t,r)=>{if(typeof e=="number"&&D(e))return e;for(let{message:n,path:o,...a}of m.safeParse(e).error.issues)R(t,r,a);return I},ae={present:!0,absent:!0,unknown:!0},se=Object.keys(ae),Fe=se.map(e=>`'${e}'`).join(" | "),Ue=(e,t,r)=>typeof e!="string"?R(t,r,{code:"invalid_type",expected:Fe,received:ne(e)}):Object.hasOwn(ae,e)?e:R(t,r,{code:"invalid_enum_value",received:e,options:[...se]}),ie=A({name:p,affiliation:p}),le=A({name:p,text:p,color:p}),ue=A({id:B,name:p,color:p}),pe=A({id:B,userId:p,userName:p,content:p,createdAt:p,isMine:w}),ze=A({id:re,fileName:re,fileType:te,fileSize:ve,createdAt:te,state:Ue,hasThumbnail:w}),$e=A({reportHubId:B,date:p,createdAt:p,author:p,userId:p,sourceType:p,employeeName:p,updatedBy:p,updatedAt:p,category:p,creationCategory:p,visitTimeFrom:p,visitTimeTo:p,customerName:p,interviewers:k(C(ie)),subject:p,content:p,externalComments:k(C(le)),isRead:w,isStarred:w,contentDigest:oe,readContentDigest:Be,isDraft:w,labels:k(C(ue)),postedComments:k(C(pe)),attachments:k(C(ze))}),N=(e,t)=>{let r={path:[],issues:[]},n=e(t,r);return n===I?{ok:!1,issues:r.issues}:{ok:!0,value:n}},de=e=>N($e,e),ce=e=>N(ie,e),me=e=>N(le,e),ye=e=>N(ue,e),Re=e=>N(pe,e);var Ke=["auth-required","forbidden","resync-required"],Ve=15e3,Ge="lastEventId",qe=/^\d{1,15}-\d{1,15}$/,fe=e=>qe.test(e);var M=e=>i.unknown().transform((t,r)=>{let n=e(t);if(n.ok)return n.value;for(let o of n.issues)r.addIssue({...o,fatal:!0});return i.NEVER}),ar=M(ce),sr=M(me),ir=M(ye),F=M(Re),O=M(de),P=i.string().regex(_),De=i.object({type:i.literal("connected")}),ge=i.object({type:i.literal("status-update"),reportHubId:m,statusType:i.enum(["star","read"]),value:i.boolean(),readContentDigest:i.string().regex(E).nullable(),clientTempId:P}),U=i.string(),he=i.object({type:i.literal("comment-add"),reportHubId:m,comment:F,clientTempId:P,sourceType:U}),be=i.object({type:i.literal("comment-delete"),reportHubId:m,commentId:m,clientTempId:P,sourceType:U}),W={recipientRawUserId:m.optional()},Qe=ge.extend(W),Ze=he.extend(W),Xe=be.extend(W),x={reportHubId:m,report:O,clientTempId:P},z={...W,actorRawUserId:m},$={viewerIsActor:i.boolean()},Je=i.object({type:i.literal("report-create"),...x,...$}),et=i.object({type:i.literal("report-update"),...x,...$}),tt=i.object({type:i.literal("report-publish"),...x,...$}),rt=i.object({type:i.literal("report-create"),...x,...z}),nt=i.object({type:i.literal("report-update"),...x,...z}),ot=i.object({type:i.literal("report-publish"),...x,...z}),Se=i.object({type:i.literal("report-delete"),reportHubId:m,clientTempId:P,sourceType:U}),at=i.discriminatedUnion("type",[De,ge,he,be,Je,et,tt,Se]),lr=i.discriminatedUnion("type",[De,Qe,Ze,Xe,rt,nt,ot,Se]);var Ie=e=>e.issues.map(t=>`${t.path.length===0?"(root)":t.path.join(".")}: ${t.code}`).join("; ");var st=Object.freeze(["create","update","publish","delete","toggleStar","toggleRead","addComment","deleteComment","clearCache"]);var y=Object.freeze({intent:"intent",clientTempId:"clientTempId",businessDate:"businessDate",operationTimestamp:"operationTimestamp",reportHubId:"reportHubId",title:"title",content:"content",isStarred:"isStarred",isRead:"isRead",contentDigest:"contentDigest",commentId:"commentId"}),it=e=>{let t=new FormData;if(t.append(y.intent,e.intent),e.intent==="clearCache"||(t.append(y.clientTempId,e.clientTempId),e.businessDate!==null&&t.append(y.businessDate,e.businessDate),e.operationTimestamp!==null&&t.append(y.operationTimestamp,String(e.operationTimestamp)),e.intent==="create"))return t;switch(t.append(y.reportHubId,String(e.reportHubId)),e.intent){case"update":return e.changes.title!==void 0&&t.append(y.title,e.changes.title),e.changes.content!==void 0&&t.append(y.content,e.changes.content),t;case"publish":case"delete":return t;case"toggleStar":return t.append(y.isStarred,String(e.value)),t;case"toggleRead":return t.append(y.isRead,String(e.value)),e.value&&t.append(y.contentDigest,e.contentDigest),t;case"addComment":return t.append(y.content,e.content),t;case"deleteComment":return t.append(y.commentId,String(e.commentId)),t}},lt=()=>{let e=m,t=d.string().regex(_),r=d.literal("OK"),n=d.object({isStarred:d.boolean(),isRead:d.boolean(),readContentDigest:d.string().regex(E).nullable()}),o=d.number().int().nonnegative().nullable();return{create:d.object({status:r,intent:d.literal("create"),reportHubId:e,clientTempId:t,report:O}),update:d.object({status:r,intent:d.literal("update"),reportHubId:e,clientTempId:t}),publish:d.object({status:r,intent:d.literal("publish"),reportHubId:e,clientTempId:t,report:O.nullable()}),delete:d.object({status:r,intent:d.literal("delete"),reportHubId:e,clientTempId:t}),toggleStar:d.object({status:r,intent:d.literal("toggleStar"),reportHubId:e,clientTempId:t,updatedStatus:n,operationTimestamp:o}),toggleRead:d.object({status:r,intent:d.literal("toggleRead"),reportHubId:e,clientTempId:t,updatedStatus:n,operationTimestamp:o}),addComment:d.object({status:r,intent:d.literal("addComment"),reportHubId:e,clientTempId:t,newComment:F}),deleteComment:d.object({status:r,intent:d.literal("deleteComment"),reportHubId:e,clientTempId:t,deletedCommentId:m}),clearCache:d.object({status:r,intent:d.literal("clearCache")})}},K=null,ut=()=>(K===null&&(K=lt()),K),pt=(e,t)=>{let r=ut()[e].safeParse(t);return r.success?{result:r.data}:{mismatch:Ie(r.error)}};var dt=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var Te=e=>e<10?`0${e}`:`${e}`,ct=e=>{if(Number.isNaN(e.getTime()))return null;let t=e.getFullYear(),r=Te(e.getMonth()+1),n=Te(e.getDate());return`${t}-${r}-${n}`},Ae=e=>{let t=dt.exec(e);if(t===null)return null;let[,r,,n,o]=t,a=Number(r),u=Number(n),s=Number(o);if(a<1)return null;let l=new Date(0);return l.setUTCFullYear(a,u-1,s),l.getUTCFullYear()!==a||l.getUTCMonth()!==u-1||l.getUTCDate()!==s?null:`${r}-${n}-${o}`},V=e=>Ae(e)===e;var mt=e=>e==null?null:e instanceof Date?ct(e):Ae(e);var xe="ids-columns",yt=e=>{if(typeof e!="object"||e===null)return"unknown";let{kind:t}=e;return t==="chunk"?"chunk":t==="error"?"error":"unknown"},Rt=e=>typeof e=="number"&&D(e),ft=e=>{if(typeof e!="object"||e===null)return!1;let{businessDate:t,reportHubId:r}=e;return(t===null||typeof t=="string")&&typeof r=="number"},Dt=4,gt=e=>{let t=Dt;for(;2**t<e*2;)t+=1;let r=new Float64Array(2**t),n=r.length-1,o=32-t;return a=>{let u=Math.imul(a|0,2654435761)>>>o;for(;;){let s=r[u];if(s===0)return r[u]=a,!0;if(s===a)return!1;u=u+1&n}}},ht=/^[0-9a-f]{1,16}$/,bt=e=>D(e.reportHubId)&&(e.businessDate===null||V(e.businessDate)),St=e=>typeof e=="string"&&ht.test(e),It=Object.freeze({kind:"absent"}),Tt=Object.freeze({kind:"value",value:null}),At=e=>e===void 0?It:e===null?Tt:typeof e=="string"&&fe(e)?{kind:"value",value:e}:{kind:"malformed",received:e},xt=e=>{if(yt(e)!=="chunk")return null;let{ids:t,dates:r,counts:n,sourceTypes:o,sources:a,isLast:u,nextCursor:s,total:l,snapshot:c,provisional:f,restarted:g,streamAnchor:Le}=e;if(typeof u!="boolean"||!(s===null||ft(s))||!(Array.isArray(t)&&Array.isArray(r)&&Array.isArray(n)&&Array.isArray(o)&&Array.isArray(a))||r.length!==n.length||a.length!==t.length)return null;for(let h of o)if(!(h===null||typeof h=="string"))return null;let He=gt(t.length),S=0,Q=null,Z=0;for(let h=0;h<r.length;h++){let T=r[h],H=n[h];if(!(T===null||typeof T=="string"&&V(T))||h>0&&T===r[h-1]||typeof H!="number"||!Number.isSafeInteger(H)||H<1)return null;let X=S+H;if(X>t.length)return null;for(;S<X;S++){let j=t[S],Y=a[S];if(!(Rt(j)&&He(j))||typeof Y!="number"||!Number.isSafeInteger(Y)||Y<0||Y>=o.length||S>0&&!Ct(Q,Z,T,j))return null;Q=T,Z=j}}return S!==t.length?null:{rows:e,isLast:u,resumeCursor:s!==null&&bt(s)?s:null,total:typeof l=="number"&&Number.isSafeInteger(l)&&l>=0?l:null,snapshot:St(c)?c:null,provisional:f===!0,restarted:g===!0,streamAnchor:At(Le)}},_t=(e,t)=>{let{ids:r,dates:n,counts:o,sourceTypes:a,sources:u}=e,s=0;for(let l=0;l<n.length;l++){let c=n[l];for(let f=s+o[l];s<f;s++){let g=a[u[s]];t(r[s],c,g===null?void 0:g)}}};var Et=(e,t,r,n)=>e!==r?e===null?1:r===null||e>r?-1:1:n-t,Ct=(e,t,r,n)=>Et(e,t,r,n)<0;var kt=Object.freeze({businessDate:"business-date",idsStream:xe,report:"report",search:"search",reports:"reports",searchMarks:"search-marks",searchFacets:"search-facets",action:"action"}),wt=Object.freeze({businessDate:"businessDate",reportHubId:"reportHubId",searchQuery:"q",searchCombine:"combine",searchAuthor:"author",searchSourceType:"sourceType",searchCustomer:"customer",reportIds:"ids",forceRefresh:"forceRefresh",cursorReportHubId:"cursor_report_hub_id",cursorBusinessDate:"cursor_business_date",cursorSnapshot:"cursor_snapshot"});var _e=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),G=e=>Object.hasOwn(_e,e);var Ee="download",Ce="thumbnail",ke="1",Nt=(e,t,r)=>{let n=`${e}/attachment/${encodeURIComponent(t)}`;switch(r.kind){case"inline":return n;case"download":return`${n}?${new URLSearchParams({[Ee]:ke})}`;case"thumbnail":return`${n}?${new URLSearchParams({[Ce]:r.variant})}`}},Mt=e=>{let t=e.getAll(Ce),r=e.getAll(Ee);if(t.length>0&&r.length>0)return{kind:"invalid",reason:"conflict"};if(t.length>0){let[n]=t;return t.length===1&&G(n)?{kind:"thumbnail",variant:n}:{kind:"invalid",reason:"thumbnail_variant"}}return r.length>0?r.length===1&&r[0]===ke?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var q="legacy-";var Ot=/^[1-9][0-9]*$/,Pt=/^(?:0|[1-9][0-9]*)$/,we=e=>{if(e===null||!Ot.test(e))return null;let t=Number(e);return D(t)?t:null},v=e=>{if(e===null||!Pt.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)?t:null};var Lt=Object.freeze(["subject","content","author","employeeName","updatedBy","category","creationCategory","customerName"]),Or=Object.freeze({field:e=>e,interviewer:(e,t)=>`interviewer:${e}:${t}`,attachment:e=>`attachment:${e}`,comment:(e,t)=>`comment:${e}:${t}`}),Ht=e=>e.startsWith(q)?v(e.slice(q.length))!==null:we(e)!==null,Ne=e=>{if(Lt.includes(e))return!0;let t=e.split(":");switch(t[0]){case"interviewer":return t.length===3&&v(t[1])!==null&&(t[2]==="name"||t[2]==="affiliation");case"attachment":return t.length===2&&v(t[1])!==null;case"comment":return t.length===3&&Ht(t[1])&&(t[2]==="author"||t[2]==="content");default:return!1}};var Pr=String.fromCodePoint(3),Lr=String.fromCodePoint(2),Hr=String.fromCodePoint(1);var jt=["intersection","union"];var Yr=Object.freeze({maxQueryLength:500,maxSets:16,maxWordsPerSet:16,maxWords:32,maxWordLength:100,maxDetailIds:100}),Yt=2,Wt=2,Me=Object.freeze({word:0,reading:1}),Oe=e=>e===Me.word||e===Me.reading;var L=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},Wr=2*(1+Yt);var vt=4294967295,Pe=e=>typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=vt,Bt=e=>{if(!Array.isArray(e)||e.length%3!==0)return null;let t=[];for(let r=0;r<e.length;r+=3){let n=e[r],o=e[r+1],a=e[r+2];if(!(typeof n=="number"&&Number.isSafeInteger(n)&&n>=0&&typeof o=="number"&&Number.isSafeInteger(o)&&n<o)||!Oe(a))return null;if(r>0){let u=t[r-2];if(u>n||u===n&&t[r-1]===a)return null}t.push(n,o,a)}return t},Ft=e=>{if(!(L(e)&&Pe(e.fingerprint)))return null;if(Object.hasOwn(e,"dense"))return e.dense===!0&&!Object.hasOwn(e,"ranges")?{fingerprint:e.fingerprint,dense:!0}:null;let t=Bt(e.ranges);return t===null?null:{fingerprint:e.fingerprint,ranges:t}},Ut=e=>{if(!L(e))return null;let t={};for(let[r,n]of Object.entries(e)){if(!Ne(r))return null;let o=Ft(n);if(o===null)return null;t[r]=o}return t},zt=(e,t)=>{if(!(L(e)&&Pe(e.wordsDigest)&&Array.isArray(e.reports)&&Array.isArray(e.deferred)))return null;let r=new Set(t.requestedIds),n=new Set,o=2**t.setCount-1,a=[];for(let s of e.reports){if(!L(s))return null;let{reportHubId:l,matchedSets:c}=s;if(!(typeof l=="number"&&D(l)&&r.has(l))||n.has(l)||(n.add(l),t.expectsMatchedSets?!(typeof c=="number"&&Number.isInteger(c)&&c>=0&&c<=o):c!==null))return null;let f=Ut(s.fields);if(f===null)return null;a.push({reportHubId:l,matchedSets:c,fields:f})}if(a.length===0&&e.deferred.length>0)return null;let u=[];for(let s of e.deferred){if(!(typeof s=="number"&&D(s)&&r.has(s))||n.has(s))return null;n.add(s),u.push(s)}return{wordsDigest:e.wordsDigest,reports:a,deferred:u}};var $t="Internal",Kt=e=>e.trim().toLowerCase();export{y as DAILY_REPORT_ACTION_FIELDS,st as DAILY_REPORT_ACTION_INTENTS,kt as DAILY_REPORT_API_ENDPOINTS,wt as DAILY_REPORT_API_QUERY_PARAMS,_e as DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,_ as DAILY_REPORT_CLIENT_TEMP_ID_PATTERN,$t as DAILY_REPORT_INTERNAL_SOURCE_TYPE,Wt as DAILY_REPORT_SEARCH_BATCHES_IN_FLIGHT,jt as DAILY_REPORT_SEARCH_COMBINES,Ge as DAILY_REPORT_SSE_CURSOR_PARAM,Ve as DAILY_REPORT_SSE_HEARTBEAT_MS,Ke as DAILY_REPORT_SSE_TERMINAL_EVENTS,Nt as buildDailyReportAttachmentUrl,O as dailyReportDetailSchema,at as dailyReportSseMessageSchema,it as encodeDailyReportActionCommand,Kt as foldDailyReportSourceTypeToken,_t as forEachIdsStreamRow,G as isDailyReportAttachmentThumbnailVariant,mt as normalizeBusinessDateKey,pt as parseDailyReportActionResult,Mt as parseDailyReportAttachmentQuery,zt as readDailyReportSearchMarksAnswer,xt as readIdsStreamChunkLine};
1
+ import{z as d}from"zod/v3";var _=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|-[1-9][0-9]{0,15})$/;import{z as je}from"zod/v3";var D=e=>Number.isSafeInteger(e)&&e>0,m=je.number().int().positive().max(Number.MAX_SAFE_INTEGER);var E=/^[0-9a-f]{64}$/u;var J=e=>typeof e=="string"&&E.test(e),Ye=(e,t)=>e.isRead?e.readContentDigest===null||e.readContentDigest===e.contentDigest||typeof t=="string"&&t!==""&&e.userId===t?"read":"updatedSinceRead":"unread";import{z as i}from"zod/v3";var I=Symbol("daily-report wire mismatch"),R=(e,t,r)=>(e.issues.push({...r,path:t===null?[...e.path]:[...e.path,t]}),I),ne=e=>e===null?"null":Array.isArray(e)?"array":Number.isNaN(e)?"nan":typeof e,b=(e,t)=>({code:"invalid_type",expected:e,received:ne(t)}),We=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),ve=e=>{let t=0;for(let r in e)t+=1;return t},ee=(e,t,r)=>{let n={};for(let o=0;o<r;o+=1){let a=t[o];a in e&&(n[a]=e[a])}return n},A=e=>{let t=Object.keys(e),r=Object.values(e);return(n,o)=>{if(!We(n))return R(o,null,b("object",n));let a=null,u=!1,s=0;for(let l=0;l<t.length;l+=1){let c=t[l],f=n[c];f!==void 0&&(s+=1);let g=r[l](f,o,c);if(g===I){u=!0;continue}a===null&&g!==f&&(a=ee(n,t,l)),a!==null&&(g!==void 0||c in n)&&(a[c]=g)}return u?I:a!==null?a:ve(n)===s?n:ee(n,t,t.length)}},C=e=>(t,r,n)=>{r.path.push(n);let o=e(t,r);return r.path.pop(),o},k=e=>(t,r,n)=>{if(!Array.isArray(t))return R(r,n,b("array",t));r.path.push(n);let o=t,a=!1;for(let u=0;u<t.length;u+=1){let s=t[u],l=e(s,r,u);l===I?a=!0:l!==s&&(o===t&&(o=t.slice()),o[u]=l)}return r.path.pop(),a?I:o},p=(e,t,r)=>e==null||typeof e=="string"?e:R(t,r,b("string",e)),te=(e,t,r)=>e===null||typeof e=="string"?e:R(t,r,b("string",e)),re=(e,t,r)=>typeof e=="string"?e:R(t,r,b("string",e)),Be=(e,t,r)=>e===null||typeof e=="number"&&!Number.isNaN(e)?e:R(t,r,b("number",e)),w=(e,t,r)=>typeof e=="boolean"?e:R(t,r,b("boolean",e)),oe=(e,t,r)=>typeof e!="string"?R(t,r,b("string",e)):J(e)?e:R(t,r,{code:"invalid_string",validation:"regex",message:"a content digest is 64 lowercase hex digits"}),Fe=(e,t,r)=>e===null?null:oe(e,t,r),B=(e,t,r)=>{if(typeof e=="number"&&D(e))return e;for(let{message:n,path:o,...a}of m.safeParse(e).error.issues)R(t,r,a);return I},ae={present:!0,absent:!0,unknown:!0},se=Object.keys(ae),Ue=se.map(e=>`'${e}'`).join(" | "),ze=(e,t,r)=>typeof e!="string"?R(t,r,{code:"invalid_type",expected:Ue,received:ne(e)}):Object.hasOwn(ae,e)?e:R(t,r,{code:"invalid_enum_value",received:e,options:[...se]}),ie=A({name:p,affiliation:p}),le=A({name:p,text:p,color:p}),ue=A({id:B,name:p,color:p}),pe=A({id:B,userId:p,userName:p,content:p,createdAt:p,isMine:w}),$e=A({id:re,fileName:re,fileType:te,fileSize:Be,createdAt:te,state:ze,hasThumbnail:w}),Ke=A({reportHubId:B,date:p,createdAt:p,author:p,userId:p,sourceType:p,employeeName:p,updatedBy:p,updatedAt:p,category:p,creationCategory:p,visitTimeFrom:p,visitTimeTo:p,customerName:p,interviewers:k(C(ie)),subject:p,content:p,externalComments:k(C(le)),isRead:w,isStarred:w,contentDigest:oe,readContentDigest:Fe,isDraft:w,labels:k(C(ue)),postedComments:k(C(pe)),attachments:k(C($e))}),N=(e,t)=>{let r={path:[],issues:[]},n=e(t,r);return n===I?{ok:!1,issues:r.issues}:{ok:!0,value:n}},de=e=>N(Ke,e),ce=e=>N(ie,e),me=e=>N(le,e),ye=e=>N(ue,e),Re=e=>N(pe,e);var Ve=["auth-required","forbidden","resync-required"],Ge=15e3,qe="lastEventId",Qe=/^\d{1,15}-\d{1,15}$/,fe=e=>Qe.test(e);var M=e=>i.unknown().transform((t,r)=>{let n=e(t);if(n.ok)return n.value;for(let o of n.issues)r.addIssue({...o,fatal:!0});return i.NEVER}),sr=M(ce),ir=M(me),lr=M(ye),F=M(Re),O=M(de),P=i.string().regex(_),De=i.object({type:i.literal("connected")}),ge=i.object({type:i.literal("status-update"),reportHubId:m,statusType:i.enum(["star","read"]),value:i.boolean(),readContentDigest:i.string().regex(E).nullable(),clientTempId:P}),U=i.string(),he=i.object({type:i.literal("comment-add"),reportHubId:m,comment:F,clientTempId:P,sourceType:U}),be=i.object({type:i.literal("comment-delete"),reportHubId:m,commentId:m,clientTempId:P,sourceType:U}),W={recipientRawUserId:m.optional()},Ze=ge.extend(W),Xe=he.extend(W),Je=be.extend(W),x={reportHubId:m,report:O,clientTempId:P},z={...W,actorRawUserId:m},$={viewerIsActor:i.boolean()},et=i.object({type:i.literal("report-create"),...x,...$}),tt=i.object({type:i.literal("report-update"),...x,...$}),rt=i.object({type:i.literal("report-publish"),...x,...$}),nt=i.object({type:i.literal("report-create"),...x,...z}),ot=i.object({type:i.literal("report-update"),...x,...z}),at=i.object({type:i.literal("report-publish"),...x,...z}),Se=i.object({type:i.literal("report-delete"),reportHubId:m,clientTempId:P,sourceType:U}),st=i.discriminatedUnion("type",[De,ge,he,be,et,tt,rt,Se]),ur=i.discriminatedUnion("type",[De,Ze,Xe,Je,nt,ot,at,Se]);var Ie=e=>e.issues.map(t=>`${t.path.length===0?"(root)":t.path.join(".")}: ${t.code}`).join("; ");var it=Object.freeze(["create","update","publish","delete","toggleStar","toggleRead","addComment","deleteComment","clearCache"]);var y=Object.freeze({intent:"intent",clientTempId:"clientTempId",businessDate:"businessDate",operationTimestamp:"operationTimestamp",reportHubId:"reportHubId",title:"title",content:"content",isStarred:"isStarred",isRead:"isRead",contentDigest:"contentDigest",commentId:"commentId"}),lt=e=>{let t=new FormData;if(t.append(y.intent,e.intent),e.intent==="clearCache"||(t.append(y.clientTempId,e.clientTempId),e.businessDate!==null&&t.append(y.businessDate,e.businessDate),e.operationTimestamp!==null&&t.append(y.operationTimestamp,String(e.operationTimestamp)),e.intent==="create"))return t;switch(t.append(y.reportHubId,String(e.reportHubId)),e.intent){case"update":return e.changes.title!==void 0&&t.append(y.title,e.changes.title),e.changes.content!==void 0&&t.append(y.content,e.changes.content),t;case"publish":case"delete":return t;case"toggleStar":return t.append(y.isStarred,String(e.value)),t;case"toggleRead":return t.append(y.isRead,String(e.value)),e.value&&t.append(y.contentDigest,e.contentDigest),t;case"addComment":return t.append(y.content,e.content),t;case"deleteComment":return t.append(y.commentId,String(e.commentId)),t}},ut=()=>{let e=m,t=d.string().regex(_),r=d.literal("OK"),n=d.object({isStarred:d.boolean(),isRead:d.boolean(),readContentDigest:d.string().regex(E).nullable()}),o=d.number().int().nonnegative().nullable();return{create:d.object({status:r,intent:d.literal("create"),reportHubId:e,clientTempId:t,report:O}),update:d.object({status:r,intent:d.literal("update"),reportHubId:e,clientTempId:t}),publish:d.object({status:r,intent:d.literal("publish"),reportHubId:e,clientTempId:t,report:O.nullable()}),delete:d.object({status:r,intent:d.literal("delete"),reportHubId:e,clientTempId:t}),toggleStar:d.object({status:r,intent:d.literal("toggleStar"),reportHubId:e,clientTempId:t,updatedStatus:n,operationTimestamp:o}),toggleRead:d.object({status:r,intent:d.literal("toggleRead"),reportHubId:e,clientTempId:t,updatedStatus:n,operationTimestamp:o}),addComment:d.object({status:r,intent:d.literal("addComment"),reportHubId:e,clientTempId:t,newComment:F}),deleteComment:d.object({status:r,intent:d.literal("deleteComment"),reportHubId:e,clientTempId:t,deletedCommentId:m}),clearCache:d.object({status:r,intent:d.literal("clearCache")})}},K=null,pt=()=>(K===null&&(K=ut()),K),dt=(e,t)=>{let r=pt()[e].safeParse(t);return r.success?{result:r.data}:{mismatch:Ie(r.error)}};var ct=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var Te=e=>e<10?`0${e}`:`${e}`,mt=e=>{if(Number.isNaN(e.getTime()))return null;let t=e.getFullYear(),r=Te(e.getMonth()+1),n=Te(e.getDate());return`${t}-${r}-${n}`},Ae=e=>{let t=ct.exec(e);if(t===null)return null;let[,r,,n,o]=t,a=Number(r),u=Number(n),s=Number(o);if(a<1)return null;let l=new Date(0);return l.setUTCFullYear(a,u-1,s),l.getUTCFullYear()!==a||l.getUTCMonth()!==u-1||l.getUTCDate()!==s?null:`${r}-${n}-${o}`},V=e=>Ae(e)===e;var yt=e=>e==null?null:e instanceof Date?mt(e):Ae(e);var xe="ids-columns",Rt=e=>{if(typeof e!="object"||e===null)return"unknown";let{kind:t}=e;return t==="chunk"?"chunk":t==="error"?"error":"unknown"},ft=e=>typeof e=="number"&&D(e),Dt=e=>{if(typeof e!="object"||e===null)return!1;let{businessDate:t,reportHubId:r}=e;return(t===null||typeof t=="string")&&typeof r=="number"},gt=4,ht=e=>{let t=gt;for(;2**t<e*2;)t+=1;let r=new Float64Array(2**t),n=r.length-1,o=32-t;return a=>{let u=Math.imul(a|0,2654435761)>>>o;for(;;){let s=r[u];if(s===0)return r[u]=a,!0;if(s===a)return!1;u=u+1&n}}},bt=/^[0-9a-f]{1,16}$/,St=e=>D(e.reportHubId)&&(e.businessDate===null||V(e.businessDate)),It=e=>typeof e=="string"&&bt.test(e),Tt=Object.freeze({kind:"absent"}),At=Object.freeze({kind:"value",value:null}),xt=e=>e===void 0?Tt:e===null?At:typeof e=="string"&&fe(e)?{kind:"value",value:e}:{kind:"malformed",received:e},_t=e=>{if(Rt(e)!=="chunk")return null;let{ids:t,dates:r,counts:n,sourceTypes:o,sources:a,isLast:u,nextCursor:s,total:l,snapshot:c,provisional:f,restarted:g,streamAnchor:Le}=e;if(typeof u!="boolean"||!(s===null||Dt(s))||!(Array.isArray(t)&&Array.isArray(r)&&Array.isArray(n)&&Array.isArray(o)&&Array.isArray(a))||r.length!==n.length||a.length!==t.length)return null;for(let h of o)if(!(h===null||typeof h=="string"))return null;let He=ht(t.length),S=0,Q=null,Z=0;for(let h=0;h<r.length;h++){let T=r[h],H=n[h];if(!(T===null||typeof T=="string"&&V(T))||h>0&&T===r[h-1]||typeof H!="number"||!Number.isSafeInteger(H)||H<1)return null;let X=S+H;if(X>t.length)return null;for(;S<X;S++){let j=t[S],Y=a[S];if(!(ft(j)&&He(j))||typeof Y!="number"||!Number.isSafeInteger(Y)||Y<0||Y>=o.length||S>0&&!kt(Q,Z,T,j))return null;Q=T,Z=j}}return S!==t.length?null:{rows:e,isLast:u,resumeCursor:s!==null&&St(s)?s:null,total:typeof l=="number"&&Number.isSafeInteger(l)&&l>=0?l:null,snapshot:It(c)?c:null,provisional:f===!0,restarted:g===!0,streamAnchor:xt(Le)}},Et=(e,t)=>{let{ids:r,dates:n,counts:o,sourceTypes:a,sources:u}=e,s=0;for(let l=0;l<n.length;l++){let c=n[l];for(let f=s+o[l];s<f;s++){let g=a[u[s]];t(r[s],c,g===null?void 0:g)}}};var Ct=(e,t,r,n)=>e!==r?e===null?1:r===null||e>r?-1:1:n-t,kt=(e,t,r,n)=>Ct(e,t,r,n)<0;var wt=Object.freeze({businessDate:"business-date",idsStream:xe,report:"report",search:"search",reports:"reports",searchMarks:"search-marks",searchFacets:"search-facets",action:"action"}),Nt=Object.freeze({businessDate:"businessDate",reportHubId:"reportHubId",searchQuery:"q",searchCombine:"combine",searchAuthor:"author",searchSourceType:"sourceType",searchCustomer:"customer",reportIds:"ids",forceRefresh:"forceRefresh",cursorReportHubId:"cursor_report_hub_id",cursorBusinessDate:"cursor_business_date",cursorSnapshot:"cursor_snapshot"});var _e=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),G=e=>Object.hasOwn(_e,e);var Ee="download",Ce="thumbnail",ke="1",Mt=(e,t,r)=>{let n=`${e}/attachment/${encodeURIComponent(t)}`;switch(r.kind){case"inline":return n;case"download":return`${n}?${new URLSearchParams({[Ee]:ke})}`;case"thumbnail":return`${n}?${new URLSearchParams({[Ce]:r.variant})}`}},Ot=e=>{let t=e.getAll(Ce),r=e.getAll(Ee);if(t.length>0&&r.length>0)return{kind:"invalid",reason:"conflict"};if(t.length>0){let[n]=t;return t.length===1&&G(n)?{kind:"thumbnail",variant:n}:{kind:"invalid",reason:"thumbnail_variant"}}return r.length>0?r.length===1&&r[0]===ke?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var q="legacy-";var Pt=/^[1-9][0-9]*$/,Lt=/^(?:0|[1-9][0-9]*)$/,we=e=>{if(e===null||!Pt.test(e))return null;let t=Number(e);return D(t)?t:null},v=e=>{if(e===null||!Lt.test(e))return null;let t=Number(e);return Number.isSafeInteger(t)?t:null};var Ht=Object.freeze(["subject","content","author","employeeName","updatedBy","category","creationCategory","customerName"]),Pr=Object.freeze({field:e=>e,interviewer:(e,t)=>`interviewer:${e}:${t}`,attachment:e=>`attachment:${e}`,comment:(e,t)=>`comment:${e}:${t}`}),jt=e=>e.startsWith(q)?v(e.slice(q.length))!==null:we(e)!==null,Ne=e=>{if(Ht.includes(e))return!0;let t=e.split(":");switch(t[0]){case"interviewer":return t.length===3&&v(t[1])!==null&&(t[2]==="name"||t[2]==="affiliation");case"attachment":return t.length===2&&v(t[1])!==null;case"comment":return t.length===3&&jt(t[1])&&(t[2]==="author"||t[2]==="content");default:return!1}};var Lr=String.fromCodePoint(3),Hr=String.fromCodePoint(2),jr=String.fromCodePoint(1);var Yt=["intersection","union"];var Wr=Object.freeze({maxQueryLength:500,maxSets:16,maxWordsPerSet:16,maxWords:32,maxWordLength:100,maxDetailIds:100}),Wt=2,vt=2,Me=Object.freeze({word:0,reading:1}),Oe=e=>e===Me.word||e===Me.reading;var L=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},vr=2*(1+Wt);var Bt=4294967295,Pe=e=>typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=Bt,Ft=e=>{if(!Array.isArray(e)||e.length%3!==0)return null;let t=[];for(let r=0;r<e.length;r+=3){let n=e[r],o=e[r+1],a=e[r+2];if(!(typeof n=="number"&&Number.isSafeInteger(n)&&n>=0&&typeof o=="number"&&Number.isSafeInteger(o)&&n<o)||!Oe(a))return null;if(r>0){let u=t[r-2];if(u>n||u===n&&t[r-1]===a)return null}t.push(n,o,a)}return t},Ut=e=>{if(!(L(e)&&Pe(e.fingerprint)))return null;if(Object.hasOwn(e,"dense"))return e.dense===!0&&!Object.hasOwn(e,"ranges")?{fingerprint:e.fingerprint,dense:!0}:null;let t=Ft(e.ranges);return t===null?null:{fingerprint:e.fingerprint,ranges:t}},zt=e=>{if(!L(e))return null;let t={};for(let[r,n]of Object.entries(e)){if(!Ne(r))return null;let o=Ut(n);if(o===null)return null;t[r]=o}return t},$t=(e,t)=>{if(!(L(e)&&Pe(e.wordsDigest)&&Array.isArray(e.reports)&&Array.isArray(e.deferred)))return null;let r=new Set(t.requestedIds),n=new Set,o=2**t.setCount-1,a=[];for(let s of e.reports){if(!L(s))return null;let{reportHubId:l,matchedSets:c}=s;if(!(typeof l=="number"&&D(l)&&r.has(l))||n.has(l)||(n.add(l),t.expectsMatchedSets?!(typeof c=="number"&&Number.isInteger(c)&&c>=0&&c<=o):c!==null))return null;let f=zt(s.fields);if(f===null)return null;a.push({reportHubId:l,matchedSets:c,fields:f})}if(a.length===0&&e.deferred.length>0)return null;let u=[];for(let s of e.deferred){if(!(typeof s=="number"&&D(s)&&r.has(s))||n.has(s))return null;n.add(s),u.push(s)}return{wordsDigest:e.wordsDigest,reports:a,deferred:u}};var Kt="Internal",Vt=e=>e.trim().toLowerCase();export{y as DAILY_REPORT_ACTION_FIELDS,it as DAILY_REPORT_ACTION_INTENTS,wt as DAILY_REPORT_API_ENDPOINTS,Nt as DAILY_REPORT_API_QUERY_PARAMS,_e as DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,_ as DAILY_REPORT_CLIENT_TEMP_ID_PATTERN,Kt as DAILY_REPORT_INTERNAL_SOURCE_TYPE,vt as DAILY_REPORT_SEARCH_BATCHES_IN_FLIGHT,Yt as DAILY_REPORT_SEARCH_COMBINES,qe as DAILY_REPORT_SSE_CURSOR_PARAM,Ge as DAILY_REPORT_SSE_HEARTBEAT_MS,Ve as DAILY_REPORT_SSE_TERMINAL_EVENTS,Mt as buildDailyReportAttachmentUrl,O as dailyReportDetailSchema,Ye as dailyReportReadStateOf,st as dailyReportSseMessageSchema,lt as encodeDailyReportActionCommand,Vt as foldDailyReportSourceTypeToken,Et as forEachIdsStreamRow,G as isDailyReportAttachmentThumbnailVariant,yt as normalizeBusinessDateKey,dt as parseDailyReportActionResult,Ot as parseDailyReportAttachmentQuery,$t as readDailyReportSearchMarksAnswer,_t as readIdsStreamChunkLine};
package/dist/server.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { q as DailyReportSseStreamMessage, d as DailyReportReadMark } from "./sse-schema-Bk_iO1vF.mjs";
2
- export { s as dailyReportSseStreamMessageSchema, t as encodeIdsStreamRows } from "./sse-schema-Bk_iO1vF.mjs";
1
+ import { s as DailyReportSseStreamMessage, d as DailyReportReadMark } from "./sse-schema-DoLUV1Ow.mjs";
2
+ export { t as dailyReportSseStreamMessageSchema, u as encodeIdsStreamRows } from "./sse-schema-DoLUV1Ow.mjs";
3
3
  import * as drizzle_orm_mssql_core from "drizzle-orm/mssql-core";
4
4
  import { AnyMsSqlColumn } from "drizzle-orm/mssql-core";
5
5
  import { b as DailyReportLogger, c as DailyReportSearchCombine, k as DailyReportSearchAlternative, d as DailyReportSearchDetailOutcome, g as DailyReportSearchHit, h as DailyReportSearchMarksAnswer } from "./search-marks-wire-CvOvhO30.mjs";
package/dist/server.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { q as DailyReportSseStreamMessage, d as DailyReportReadMark } from "./sse-schema-BLe0x7BD.js";
2
- export { s as dailyReportSseStreamMessageSchema, t as encodeIdsStreamRows } from "./sse-schema-BLe0x7BD.js";
1
+ import { s as DailyReportSseStreamMessage, d as DailyReportReadMark } from "./sse-schema-ZdgeTkbk.js";
2
+ export { t as dailyReportSseStreamMessageSchema, u as encodeIdsStreamRows } from "./sse-schema-ZdgeTkbk.js";
3
3
  import * as drizzle_orm_mssql_core from "drizzle-orm/mssql-core";
4
4
  import { AnyMsSqlColumn } from "drizzle-orm/mssql-core";
5
5
  import { b as DailyReportLogger, c as DailyReportSearchCombine, k as DailyReportSearchAlternative, d as DailyReportSearchDetailOutcome, g as DailyReportSearchHit, h as DailyReportSearchMarksAnswer } from "./search-marks-wire-v7GTHpp7.js";
@@ -8,6 +8,7 @@ type DailyReportReadMark = {
8
8
  readonly isRead: false;
9
9
  };
10
10
  type DailyReportReadStatus = Pick<DailyReportDetail, "isRead" | "readContentDigest">;
11
+ declare const dailyReportReadStateOf: (report: Pick<DailyReportDetail, "isRead" | "readContentDigest" | "contentDigest" | "userId">, viewerUserId: string | null | undefined) => DailyReportReadState;
11
12
  type DailyReportIdsStreamCursor = {
12
13
  businessDate: string | null;
13
14
  reportHubId: number;
@@ -379,4 +380,4 @@ declare const dailyReportSseStreamMessageSchema: z.ZodDiscriminatedUnion<"type",
379
380
  ]>;
380
381
  type DailyReportSseMessage = z.infer<typeof dailyReportSseMessageSchema>;
381
382
  type DailyReportSseStreamMessage = z.infer<typeof dailyReportSseStreamMessageSchema>;
382
- export { type DailyReportReadState as D, type DailyReportSseStreamAnchor as a, type DailyReportSseTerminalEvent as b, type DailyReportSseMessage as c, type DailyReportReadMark as d, type DailyReportReadStatus as e, DAILY_REPORT_SSE_CURSOR_PARAM as f, DAILY_REPORT_SSE_HEARTBEAT_MS as g, DAILY_REPORT_SSE_TERMINAL_EVENTS as h, type DailyReportIdsStreamChunk as i, type DailyReportIdsStreamChunkLine as j, type DailyReportIdsStreamCursor as k, type DailyReportIdsStreamRowColumns as l, type DailyReportIdsStreamRows as m, dailyReportDetailSchema as n, dailyReportSseMessageSchema as o, forEachIdsStreamRow as p, type DailyReportSseStreamMessage as q, readIdsStreamChunkLine as r, dailyReportSseStreamMessageSchema as s, encodeIdsStreamRows as t };
383
+ export { type DailyReportReadState as D, type DailyReportSseStreamAnchor as a, type DailyReportSseTerminalEvent as b, type DailyReportSseMessage as c, type DailyReportReadMark as d, type DailyReportReadStatus as e, DAILY_REPORT_SSE_CURSOR_PARAM as f, DAILY_REPORT_SSE_HEARTBEAT_MS as g, DAILY_REPORT_SSE_TERMINAL_EVENTS as h, type DailyReportIdsStreamChunk as i, type DailyReportIdsStreamChunkLine as j, type DailyReportIdsStreamCursor as k, type DailyReportIdsStreamRowColumns as l, type DailyReportIdsStreamRows as m, dailyReportDetailSchema as n, dailyReportReadStateOf as o, dailyReportSseMessageSchema as p, forEachIdsStreamRow as q, readIdsStreamChunkLine as r, type DailyReportSseStreamMessage as s, dailyReportSseStreamMessageSchema as t, encodeIdsStreamRows as u };
@@ -8,6 +8,7 @@ type DailyReportReadMark = {
8
8
  readonly isRead: false;
9
9
  };
10
10
  type DailyReportReadStatus = Pick<DailyReportDetail, "isRead" | "readContentDigest">;
11
+ declare const dailyReportReadStateOf: (report: Pick<DailyReportDetail, "isRead" | "readContentDigest" | "contentDigest" | "userId">, viewerUserId: string | null | undefined) => DailyReportReadState;
11
12
  type DailyReportIdsStreamCursor = {
12
13
  businessDate: string | null;
13
14
  reportHubId: number;
@@ -379,4 +380,4 @@ declare const dailyReportSseStreamMessageSchema: z.ZodDiscriminatedUnion<"type",
379
380
  ]>;
380
381
  type DailyReportSseMessage = z.infer<typeof dailyReportSseMessageSchema>;
381
382
  type DailyReportSseStreamMessage = z.infer<typeof dailyReportSseStreamMessageSchema>;
382
- export { type DailyReportReadState as D, type DailyReportSseStreamAnchor as a, type DailyReportSseTerminalEvent as b, type DailyReportSseMessage as c, type DailyReportReadMark as d, type DailyReportReadStatus as e, DAILY_REPORT_SSE_CURSOR_PARAM as f, DAILY_REPORT_SSE_HEARTBEAT_MS as g, DAILY_REPORT_SSE_TERMINAL_EVENTS as h, type DailyReportIdsStreamChunk as i, type DailyReportIdsStreamChunkLine as j, type DailyReportIdsStreamCursor as k, type DailyReportIdsStreamRowColumns as l, type DailyReportIdsStreamRows as m, dailyReportDetailSchema as n, dailyReportSseMessageSchema as o, forEachIdsStreamRow as p, type DailyReportSseStreamMessage as q, readIdsStreamChunkLine as r, dailyReportSseStreamMessageSchema as s, encodeIdsStreamRows as t };
383
+ export { type DailyReportReadState as D, type DailyReportSseStreamAnchor as a, type DailyReportSseTerminalEvent as b, type DailyReportSseMessage as c, type DailyReportReadMark as d, type DailyReportReadStatus as e, DAILY_REPORT_SSE_CURSOR_PARAM as f, DAILY_REPORT_SSE_HEARTBEAT_MS as g, DAILY_REPORT_SSE_TERMINAL_EVENTS as h, type DailyReportIdsStreamChunk as i, type DailyReportIdsStreamChunkLine as j, type DailyReportIdsStreamCursor as k, type DailyReportIdsStreamRowColumns as l, type DailyReportIdsStreamRows as m, dailyReportDetailSchema as n, dailyReportReadStateOf as o, dailyReportSseMessageSchema as p, forEachIdsStreamRow as q, readIdsStreamChunkLine as r, type DailyReportSseStreamMessage as s, dailyReportSseStreamMessageSchema as t, encodeIdsStreamRows as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiquants/daily-report",
3
- "version": "0.47.0",
3
+ "version": "0.47.1",
4
4
  "description": "Reusable daily-report feature package: shared types/schemas, React (Router v7 / v8) UI with virtual scrolling + optimistic updates + SSE sync, and a drizzle (mssql) server layer with DI ports (auth, user resolution, redis, external sources).",
5
5
  "sideEffects": [
6
6
  "**/*.css"