@aiquants/daily-report 0.36.0 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- export { b as DAILY_REPORT_ACTION_FIELDS, c as DAILY_REPORT_ACTION_INTENTS, A as DailyReportActionCommand, d as DailyReportActionFailure, D as DailyReportActionIntent, e as DailyReportActionResult, f as DailyReportActionResultOf, g as DailyReportActionResultReading, h as DailyReportIdsStreamChunkLine, i as DailyReportIdsStreamCursor, a as DailyReportSseStreamAnchor, U as DailyReportUIComment, j as encodeDailyReportActionCommand, k as isIdsStreamChunkLine, m as mergeComments, p as parseDailyReportActionResult } from "./comment-adapter-pzx3O8_h.mjs";
2
- export { D as DAILY_REPORT_SEARCH_COMBINES, a as DailyReportLogger, b as DailyReportSearchCombine, c as DailyReportSearchFieldMarks, d as DailyReportSearchHit, e as DailyReportSearchMarksAnswer, f as DailyReportSearchReportMarks } from "./search-marks-wire-DCFuK5yr.mjs";
1
+ export { b as DAILY_REPORT_ACTION_FIELDS, c as DAILY_REPORT_ACTION_INTENTS, A as DailyReportActionCommand, d as DailyReportActionFailure, D as DailyReportActionIntent, e as DailyReportActionResult, f as DailyReportActionResultOf, g as DailyReportActionResultReading, h as DailyReportIdsStreamChunkLine, i as DailyReportIdsStreamCursor, a as DailyReportSseStreamAnchor, U as DailyReportUIComment, j as encodeDailyReportActionCommand, k as isIdsStreamChunkLine, m as mergeComments, p as parseDailyReportActionResult } from "./comment-adapter-_h3W1duG.mjs";
2
+ export { D as DAILY_REPORT_SEARCH_COMBINES, a as DailyReportLogger, b as DailyReportSearchCombine, c as DailyReportSearchFieldMarks, d as DailyReportSearchHit, e as DailyReportSearchMarksAnswer, f as DailyReportSearchReportMarks } from "./search-marks-wire-CZRU4q3h.mjs";
3
3
  export { e as DAILY_REPORT_SSE_CURSOR_PARAM, f as DAILY_REPORT_SSE_HEARTBEAT_MS, g as DAILY_REPORT_SSE_TERMINAL_EVENTS, h as DailyReportAttachmentState, i as DailyReportAttachmentSummary, d as DailyReportDetail, j as DailyReportExternalComment, k as DailyReportInterviewer, D as DailyReportItem, l as DailyReportLabelDef, m as DailyReportPostedComment, c as DailyReportSseMessage, b as DailyReportSseTerminalEvent, a as DailyReportUser, n as commentAddMessageSchema, o as commentDeleteMessageSchema, p as connectedMessageSchema, q as dailyReportDetailSchema, r as dailyReportExternalCommentSchema, s as dailyReportInterviewerSchema, t as dailyReportLabelDefSchema, u as dailyReportPostedCommentSchema, v as dailyReportSseMessageSchema, w as isDailyReportSseStreamId, x as reportCreateMessageSchema, y as reportDeleteMessageSchema, z as reportPublishMessageSchema, A as reportUpdateMessageSchema, B as statusUpdateMessageSchema } from "./sse-schema-getLS62T.mjs";
4
4
  import "zod";
5
5
  declare const DAILY_REPORT_API_ENDPOINTS: Readonly<{
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { b as DAILY_REPORT_ACTION_FIELDS, c as DAILY_REPORT_ACTION_INTENTS, A as DailyReportActionCommand, d as DailyReportActionFailure, D as DailyReportActionIntent, e as DailyReportActionResult, f as DailyReportActionResultOf, g as DailyReportActionResultReading, h as DailyReportIdsStreamChunkLine, i as DailyReportIdsStreamCursor, a as DailyReportSseStreamAnchor, U as DailyReportUIComment, j as encodeDailyReportActionCommand, k as isIdsStreamChunkLine, m as mergeComments, p as parseDailyReportActionResult } from "./comment-adapter-BvGGQkBE.js";
2
- export { D as DAILY_REPORT_SEARCH_COMBINES, a as DailyReportLogger, b as DailyReportSearchCombine, c as DailyReportSearchFieldMarks, d as DailyReportSearchHit, e as DailyReportSearchMarksAnswer, f as DailyReportSearchReportMarks } from "./search-marks-wire-DCFuK5yr.js";
1
+ export { b as DAILY_REPORT_ACTION_FIELDS, c as DAILY_REPORT_ACTION_INTENTS, A as DailyReportActionCommand, d as DailyReportActionFailure, D as DailyReportActionIntent, e as DailyReportActionResult, f as DailyReportActionResultOf, g as DailyReportActionResultReading, h as DailyReportIdsStreamChunkLine, i as DailyReportIdsStreamCursor, a as DailyReportSseStreamAnchor, U as DailyReportUIComment, j as encodeDailyReportActionCommand, k as isIdsStreamChunkLine, m as mergeComments, p as parseDailyReportActionResult } from "./comment-adapter-DOUwSlKf.js";
2
+ export { D as DAILY_REPORT_SEARCH_COMBINES, a as DailyReportLogger, b as DailyReportSearchCombine, c as DailyReportSearchFieldMarks, d as DailyReportSearchHit, e as DailyReportSearchMarksAnswer, f as DailyReportSearchReportMarks } from "./search-marks-wire-CZRU4q3h.js";
3
3
  export { e as DAILY_REPORT_SSE_CURSOR_PARAM, f as DAILY_REPORT_SSE_HEARTBEAT_MS, g as DAILY_REPORT_SSE_TERMINAL_EVENTS, h as DailyReportAttachmentState, i as DailyReportAttachmentSummary, d as DailyReportDetail, j as DailyReportExternalComment, k as DailyReportInterviewer, D as DailyReportItem, l as DailyReportLabelDef, m as DailyReportPostedComment, c as DailyReportSseMessage, b as DailyReportSseTerminalEvent, a as DailyReportUser, n as commentAddMessageSchema, o as commentDeleteMessageSchema, p as connectedMessageSchema, q as dailyReportDetailSchema, r as dailyReportExternalCommentSchema, s as dailyReportInterviewerSchema, t as dailyReportLabelDefSchema, u as dailyReportPostedCommentSchema, v as dailyReportSseMessageSchema, w as isDailyReportSseStreamId, x as reportCreateMessageSchema, y as reportDeleteMessageSchema, z as reportPublishMessageSchema, A as reportUpdateMessageSchema, B as statusUpdateMessageSchema } from "./sse-schema-getLS62T.js";
4
4
  import "zod";
5
5
  declare const DAILY_REPORT_API_ENDPOINTS: Readonly<{
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var D=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ae=Object.prototype.hasOwnProperty;var ie=(e,r)=>{for(var n in r)D(e,n,{get:r[n],enumerable:!0})},se=(e,r,n,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of oe(r))!ae.call(e,l)&&l!==n&&D(e,l,{get:()=>r[l],enumerable:!(a=ne(r,l))||a.enumerable});return e};var le=e=>se(D({},"__esModule",{value:!0}),e);var Se={};ie(Se,{DAILY_REPORT_ACTION_FIELDS:()=>p,DAILY_REPORT_ACTION_INTENTS:()=>B,DAILY_REPORT_API_ENDPOINTS:()=>F,DAILY_REPORT_API_QUERY_PARAMS:()=>V,DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS:()=>N,DAILY_REPORT_CLIENT_TEMP_ID_PATTERN:()=>m,DAILY_REPORT_SEARCH_COMBINES:()=>re,DAILY_REPORT_SSE_CURSOR_PARAM:()=>H,DAILY_REPORT_SSE_HEARTBEAT_MS:()=>k,DAILY_REPORT_SSE_TERMINAL_EVENTS:()=>L,buildDailyReportAttachmentUrl:()=>G,commentAddMessageSchema:()=>x,commentDeleteMessageSchema:()=>_,connectedMessageSchema:()=>A,dailyReportDetailSchema:()=>d,dailyReportExternalCommentSchema:()=>b,dailyReportInterviewerSchema:()=>I,dailyReportLabelDefSchema:()=>S,dailyReportPostedCommentSchema:()=>c,dailyReportSseMessageSchema:()=>Y,encodeDailyReportActionCommand:()=>$,isDailyReportAttachmentThumbnailVariant:()=>g,isDailyReportSseStreamId:()=>U,isIdsStreamChunkLine:()=>W,mergeComments:()=>te,normalizeBusinessDateKey:()=>J,parseDailyReportActionResult:()=>v,parseDailyReportAttachmentQuery:()=>X,reportCreateMessageSchema:()=>C,reportDeleteMessageSchema:()=>P,reportPublishMessageSchema:()=>O,reportUpdateMessageSchema:()=>E,statusUpdateMessageSchema:()=>f});module.exports=le(Se);var o=require("zod");var m=/^(?:[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 w=require("zod");var i=w.z.number().int().positive().max(Number.MAX_SAFE_INTEGER);var t=require("zod");var L=["auth-required","forbidden","resync-required"],k=15e3,H="lastEventId",pe=/^\d{1,15}-\d{1,15}$/,U=e=>pe.test(e),I=t.z.object({name:t.z.string().nullish(),affiliation:t.z.string().nullish()}),b=t.z.object({name:t.z.string().nullish(),text:t.z.string().nullish(),color:t.z.string().nullish()}),S=t.z.object({id:i,name:t.z.string().nullish(),color:t.z.string().nullish()}),c=t.z.object({id:i,userId:t.z.string().nullish(),userName:t.z.string().nullish(),content:t.z.string().nullish(),createdAt:t.z.string().nullish(),isMine:t.z.boolean()}),de=t.z.object({id:t.z.string(),fileName:t.z.string(),fileType:t.z.string().nullable(),fileSize:t.z.number().nullable(),createdAt:t.z.string().nullable(),state:t.z.enum(["present","absent","unknown"]),hasThumbnail:t.z.boolean().default(!1)}),d=t.z.object({reportHubId:i,date:t.z.string().nullish(),createdAt:t.z.string().nullish(),author:t.z.string().nullish(),userId:t.z.string().nullish(),sourceType:t.z.string().nullish(),employeeName:t.z.string().nullish(),updatedBy:t.z.string().nullish(),updatedAt:t.z.string().nullish(),category:t.z.string().nullish(),creationCategory:t.z.string().nullish(),visitTimeFrom:t.z.string().nullish(),visitTimeTo:t.z.string().nullish(),customerName:t.z.string().nullish(),interviewers:t.z.array(I),subject:t.z.string().nullish(),content:t.z.string().nullish(),externalComments:t.z.array(b),isRead:t.z.boolean(),isStarred:t.z.boolean(),labels:t.z.array(S),postedComments:t.z.array(c),attachments:t.z.array(de).default([])}),u=t.z.string().regex(m),A=t.z.object({type:t.z.literal("connected")}),f=t.z.object({type:t.z.literal("status-update"),reportHubId:i,statusType:t.z.enum(["star","read"]),value:t.z.boolean(),clientTempId:u,recipientRawUserId:i.optional()}),T=t.z.string().optional(),x=t.z.object({type:t.z.literal("comment-add"),reportHubId:i,comment:c,clientTempId:u,recipientRawUserId:i.optional(),sourceType:T}),_=t.z.object({type:t.z.literal("comment-delete"),reportHubId:i,commentId:i,clientTempId:u,recipientRawUserId:i.optional(),sourceType:T}),C=t.z.object({type:t.z.literal("report-create"),reportHubId:i,report:d,clientTempId:u,recipientRawUserId:i.optional()}),E=t.z.object({type:t.z.literal("report-update"),reportHubId:i,report:d,clientTempId:u,recipientRawUserId:i.optional()}),O=t.z.object({type:t.z.literal("report-publish"),reportHubId:i,report:d,clientTempId:u,recipientRawUserId:i.optional()}),P=t.z.object({type:t.z.literal("report-delete"),reportHubId:i,clientTempId:u,sourceType:T}),Y=t.z.discriminatedUnion("type",[A,f,x,_,C,E,O,P]);var j=e=>e.issues.map(r=>`${r.path.length===0?"(root)":r.path.join(".")}: ${r.code}`).join("; ");var B=Object.freeze(["create","update","publish","delete","toggleStar","toggleRead","addComment","deleteComment","clearCache"]);var p=Object.freeze({intent:"intent",clientTempId:"clientTempId",businessDate:"businessDate",operationTimestamp:"operationTimestamp",reportHubId:"reportHubId",title:"title",content:"content",isStarred:"isStarred",isRead:"isRead",commentId:"commentId"}),$=e=>{let r=new FormData;if(r.append(p.intent,e.intent),e.intent==="clearCache"||(r.append(p.clientTempId,e.clientTempId),e.businessDate!==null&&r.append(p.businessDate,e.businessDate),e.operationTimestamp!==null&&r.append(p.operationTimestamp,String(e.operationTimestamp)),e.intent==="create"))return r;switch(r.append(p.reportHubId,String(e.reportHubId)),e.intent){case"update":return e.changes.title!==void 0&&r.append(p.title,e.changes.title),e.changes.content!==void 0&&r.append(p.content,e.changes.content),r;case"publish":case"delete":return r;case"toggleStar":return r.append(p.isStarred,String(e.value)),r;case"toggleRead":return r.append(p.isRead,String(e.value)),r;case"addComment":return r.append(p.content,e.content),r;case"deleteComment":return r.append(p.commentId,String(e.commentId)),r}},ue=()=>{let e=i,r=o.z.string().regex(m),n=o.z.literal("OK"),a=o.z.object({isStarred:o.z.boolean(),isRead:o.z.boolean()}),l=o.z.number().int().nonnegative().nullable();return{create:o.z.object({status:n,intent:o.z.literal("create"),reportHubId:e,clientTempId:r,report:d}),update:o.z.object({status:n,intent:o.z.literal("update"),reportHubId:e,clientTempId:r}),publish:o.z.object({status:n,intent:o.z.literal("publish"),reportHubId:e,clientTempId:r,report:d.nullable()}),delete:o.z.object({status:n,intent:o.z.literal("delete"),reportHubId:e,clientTempId:r}),toggleStar:o.z.object({status:n,intent:o.z.literal("toggleStar"),reportHubId:e,clientTempId:r,updatedStatus:a,operationTimestamp:l}),toggleRead:o.z.object({status:n,intent:o.z.literal("toggleRead"),reportHubId:e,clientTempId:r,updatedStatus:a,operationTimestamp:l}),addComment:o.z.object({status:n,intent:o.z.literal("addComment"),reportHubId:e,clientTempId:r,newComment:c}),deleteComment:o.z.object({status:n,intent:o.z.literal("deleteComment"),reportHubId:e,clientTempId:r,deletedCommentId:i}),clearCache:o.z.object({status:n,intent:o.z.literal("clearCache")})}},M=null,me=()=>(M===null&&(M=ue()),M),v=(e,r)=>{let n=me()[e].safeParse(r);return n.success?{result:n.data}:{mismatch:j(n.error)}};var z="ids-stream",ce=e=>{if(typeof e!="object"||e===null)return"unknown";let r=e;return typeof r.kind=="string"?r.kind==="chunk"?"chunk":r.kind==="error"?"error":"unknown":Array.isArray(r.items)?"chunk":typeof r.error=="string"?"error":"unknown"},W=e=>ce(e)==="chunk";var F=Object.freeze({businessDate:"business-date",idsStream:z,report:"report",search:"search",reports:"reports",searchMarks:"search-marks",action:"action"}),V=Object.freeze({businessDate:"businessDate",reportHubId:"reportHubId",searchQuery:"q",searchCombine:"combine",reportIds:"ids",forceRefresh:"forceRefresh",cursorReportHubId:"cursor_report_hub_id",cursorBusinessDate:"cursor_business_date",cursorSnapshot:"cursor_snapshot"});var N=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),g=e=>Object.hasOwn(N,e);var K="download",Q="thumbnail",q="1",G=(e,r,n)=>{let a=`${e}/attachment/${encodeURIComponent(r)}`;switch(n.kind){case"inline":return a;case"download":return`${a}?${new URLSearchParams({[K]:q})}`;case"thumbnail":return`${a}?${new URLSearchParams({[Q]:n.variant})}`}},X=e=>{let r=e.getAll(Q),n=e.getAll(K);if(r.length>0&&n.length>0)return{kind:"invalid",reason:"conflict"};if(r.length>0){let[a]=r;return r.length===1&&g(a)?{kind:"thumbnail",variant:a}:{kind:"invalid",reason:"thumbnail_variant"}}return n.length>0?n.length===1&&n[0]===q?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var ye=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var Z=e=>e<10?`0${e}`:`${e}`,Re=e=>{if(Number.isNaN(e.getTime()))return null;let r=e.getFullYear(),n=Z(e.getMonth()+1),a=Z(e.getDate());return`${r}-${n}-${a}`},he=e=>{let r=ye.exec(e);if(r===null)return null;let[,n,,a,l]=r,y=Number(n),s=Number(a),R=Number(l);if(y<1)return null;let h=new Date(0);return h.setUTCFullYear(y,s-1,R),h.getUTCFullYear()!==y||h.getUTCMonth()!==s-1||h.getUTCDate()!==R?null:`${n}-${a}-${l}`};var J=e=>e==null?null:e instanceof Date?Re(e):he(e);var ge=e=>typeof e=="string"?JSON.stringify(e):typeof e=="number"||typeof e=="boolean"||e===null||e===void 0?String(e):Array.isArray(e)?"array":typeof e,ee=(e,r,n)=>new RangeError(`[daily-report] ${e} must be ${r}; got ${ge(n)}`);var De="legacy-",Ie=e=>`${De}${e}`,te=(e,r,n,a)=>{if(typeof a!="string"||a.trim()==="")throw ee("mergeComments: unknownAuthorName","a non-blank string",a);let l=e.map((s,R)=>({id:Ie(R),authorName:s.name||a,content:s.text||"",isMine:!1,color:s.color||void 0,isLegacy:!0,isAuthorUnknown:!s.name})),y=r.map(s=>({id:s.id,authorName:s.userName||a,content:s.content??"",createdAt:s.createdAt??"",isMine:n?s.userId===n:s.isMine,isLegacy:!1,isAuthorUnknown:!s.userName}));return[...l,...y]};var re=["intersection","union"];var We=Object.freeze({maxQueryLength:500,maxSets:16,maxWordsPerSet:16,maxWords:32,maxWordLength:100,maxDetailIds:100}),be=2;var Fe=2*(1+be);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_SEARCH_COMBINES,DAILY_REPORT_SSE_CURSOR_PARAM,DAILY_REPORT_SSE_HEARTBEAT_MS,DAILY_REPORT_SSE_TERMINAL_EVENTS,buildDailyReportAttachmentUrl,commentAddMessageSchema,commentDeleteMessageSchema,connectedMessageSchema,dailyReportDetailSchema,dailyReportExternalCommentSchema,dailyReportInterviewerSchema,dailyReportLabelDefSchema,dailyReportPostedCommentSchema,dailyReportSseMessageSchema,encodeDailyReportActionCommand,isDailyReportAttachmentThumbnailVariant,isDailyReportSseStreamId,isIdsStreamChunkLine,mergeComments,normalizeBusinessDateKey,parseDailyReportActionResult,parseDailyReportAttachmentQuery,reportCreateMessageSchema,reportDeleteMessageSchema,reportPublishMessageSchema,reportUpdateMessageSchema,statusUpdateMessageSchema});
1
+ "use strict";var D=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ae=Object.prototype.hasOwnProperty;var ie=(e,r)=>{for(var n in r)D(e,n,{get:r[n],enumerable:!0})},se=(e,r,n,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of oe(r))!ae.call(e,l)&&l!==n&&D(e,l,{get:()=>r[l],enumerable:!(a=ne(r,l))||a.enumerable});return e};var le=e=>se(D({},"__esModule",{value:!0}),e);var Ae={};ie(Ae,{DAILY_REPORT_ACTION_FIELDS:()=>p,DAILY_REPORT_ACTION_INTENTS:()=>B,DAILY_REPORT_API_ENDPOINTS:()=>F,DAILY_REPORT_API_QUERY_PARAMS:()=>V,DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS:()=>M,DAILY_REPORT_CLIENT_TEMP_ID_PATTERN:()=>m,DAILY_REPORT_SEARCH_COMBINES:()=>re,DAILY_REPORT_SSE_CURSOR_PARAM:()=>H,DAILY_REPORT_SSE_HEARTBEAT_MS:()=>k,DAILY_REPORT_SSE_TERMINAL_EVENTS:()=>L,buildDailyReportAttachmentUrl:()=>G,commentAddMessageSchema:()=>x,commentDeleteMessageSchema:()=>_,connectedMessageSchema:()=>S,dailyReportDetailSchema:()=>d,dailyReportExternalCommentSchema:()=>b,dailyReportInterviewerSchema:()=>I,dailyReportLabelDefSchema:()=>A,dailyReportPostedCommentSchema:()=>c,dailyReportSseMessageSchema:()=>Y,encodeDailyReportActionCommand:()=>$,isDailyReportAttachmentThumbnailVariant:()=>g,isDailyReportSseStreamId:()=>U,isIdsStreamChunkLine:()=>W,mergeComments:()=>te,normalizeBusinessDateKey:()=>J,parseDailyReportActionResult:()=>v,parseDailyReportAttachmentQuery:()=>X,reportCreateMessageSchema:()=>E,reportDeleteMessageSchema:()=>P,reportPublishMessageSchema:()=>O,reportUpdateMessageSchema:()=>C,statusUpdateMessageSchema:()=>f});module.exports=le(Ae);var o=require("zod");var m=/^(?:[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 N=require("zod");var i=N.z.number().int().positive().max(Number.MAX_SAFE_INTEGER);var t=require("zod");var L=["auth-required","forbidden","resync-required"],k=15e3,H="lastEventId",pe=/^\d{1,15}-\d{1,15}$/,U=e=>pe.test(e),I=t.z.object({name:t.z.string().nullish(),affiliation:t.z.string().nullish()}),b=t.z.object({name:t.z.string().nullish(),text:t.z.string().nullish(),color:t.z.string().nullish()}),A=t.z.object({id:i,name:t.z.string().nullish(),color:t.z.string().nullish()}),c=t.z.object({id:i,userId:t.z.string().nullish(),userName:t.z.string().nullish(),content:t.z.string().nullish(),createdAt:t.z.string().nullish(),isMine:t.z.boolean()}),de=t.z.object({id:t.z.string(),fileName:t.z.string(),fileType:t.z.string().nullable(),fileSize:t.z.number().nullable(),createdAt:t.z.string().nullable(),state:t.z.enum(["present","absent","unknown"]),hasThumbnail:t.z.boolean().default(!1)}),d=t.z.object({reportHubId:i,date:t.z.string().nullish(),createdAt:t.z.string().nullish(),author:t.z.string().nullish(),userId:t.z.string().nullish(),sourceType:t.z.string().nullish(),employeeName:t.z.string().nullish(),updatedBy:t.z.string().nullish(),updatedAt:t.z.string().nullish(),category:t.z.string().nullish(),creationCategory:t.z.string().nullish(),visitTimeFrom:t.z.string().nullish(),visitTimeTo:t.z.string().nullish(),customerName:t.z.string().nullish(),interviewers:t.z.array(I),subject:t.z.string().nullish(),content:t.z.string().nullish(),externalComments:t.z.array(b),isRead:t.z.boolean(),isStarred:t.z.boolean(),labels:t.z.array(A),postedComments:t.z.array(c),attachments:t.z.array(de).default([])}),u=t.z.string().regex(m),S=t.z.object({type:t.z.literal("connected")}),f=t.z.object({type:t.z.literal("status-update"),reportHubId:i,statusType:t.z.enum(["star","read"]),value:t.z.boolean(),clientTempId:u,recipientRawUserId:i.optional()}),T=t.z.string().optional(),x=t.z.object({type:t.z.literal("comment-add"),reportHubId:i,comment:c,clientTempId:u,recipientRawUserId:i.optional(),sourceType:T}),_=t.z.object({type:t.z.literal("comment-delete"),reportHubId:i,commentId:i,clientTempId:u,recipientRawUserId:i.optional(),sourceType:T}),E=t.z.object({type:t.z.literal("report-create"),reportHubId:i,report:d,clientTempId:u,recipientRawUserId:i.optional()}),C=t.z.object({type:t.z.literal("report-update"),reportHubId:i,report:d,clientTempId:u,recipientRawUserId:i.optional()}),O=t.z.object({type:t.z.literal("report-publish"),reportHubId:i,report:d,clientTempId:u,recipientRawUserId:i.optional()}),P=t.z.object({type:t.z.literal("report-delete"),reportHubId:i,clientTempId:u,sourceType:T}),Y=t.z.discriminatedUnion("type",[S,f,x,_,E,C,O,P]);var j=e=>e.issues.map(r=>`${r.path.length===0?"(root)":r.path.join(".")}: ${r.code}`).join("; ");var B=Object.freeze(["create","update","publish","delete","toggleStar","toggleRead","addComment","deleteComment","clearCache"]);var p=Object.freeze({intent:"intent",clientTempId:"clientTempId",businessDate:"businessDate",operationTimestamp:"operationTimestamp",reportHubId:"reportHubId",title:"title",content:"content",isStarred:"isStarred",isRead:"isRead",commentId:"commentId"}),$=e=>{let r=new FormData;if(r.append(p.intent,e.intent),e.intent==="clearCache"||(r.append(p.clientTempId,e.clientTempId),e.businessDate!==null&&r.append(p.businessDate,e.businessDate),e.operationTimestamp!==null&&r.append(p.operationTimestamp,String(e.operationTimestamp)),e.intent==="create"))return r;switch(r.append(p.reportHubId,String(e.reportHubId)),e.intent){case"update":return e.changes.title!==void 0&&r.append(p.title,e.changes.title),e.changes.content!==void 0&&r.append(p.content,e.changes.content),r;case"publish":case"delete":return r;case"toggleStar":return r.append(p.isStarred,String(e.value)),r;case"toggleRead":return r.append(p.isRead,String(e.value)),r;case"addComment":return r.append(p.content,e.content),r;case"deleteComment":return r.append(p.commentId,String(e.commentId)),r}},ue=()=>{let e=i,r=o.z.string().regex(m),n=o.z.literal("OK"),a=o.z.object({isStarred:o.z.boolean(),isRead:o.z.boolean()}),l=o.z.number().int().nonnegative().nullable();return{create:o.z.object({status:n,intent:o.z.literal("create"),reportHubId:e,clientTempId:r,report:d}),update:o.z.object({status:n,intent:o.z.literal("update"),reportHubId:e,clientTempId:r}),publish:o.z.object({status:n,intent:o.z.literal("publish"),reportHubId:e,clientTempId:r,report:d.nullable()}),delete:o.z.object({status:n,intent:o.z.literal("delete"),reportHubId:e,clientTempId:r}),toggleStar:o.z.object({status:n,intent:o.z.literal("toggleStar"),reportHubId:e,clientTempId:r,updatedStatus:a,operationTimestamp:l}),toggleRead:o.z.object({status:n,intent:o.z.literal("toggleRead"),reportHubId:e,clientTempId:r,updatedStatus:a,operationTimestamp:l}),addComment:o.z.object({status:n,intent:o.z.literal("addComment"),reportHubId:e,clientTempId:r,newComment:c}),deleteComment:o.z.object({status:n,intent:o.z.literal("deleteComment"),reportHubId:e,clientTempId:r,deletedCommentId:i}),clearCache:o.z.object({status:n,intent:o.z.literal("clearCache")})}},w=null,me=()=>(w===null&&(w=ue()),w),v=(e,r)=>{let n=me()[e].safeParse(r);return n.success?{result:n.data}:{mismatch:j(n.error)}};var z="ids-stream",ce=e=>{if(typeof e!="object"||e===null)return"unknown";let r=e;return typeof r.kind=="string"?r.kind==="chunk"?"chunk":r.kind==="error"?"error":"unknown":Array.isArray(r.items)?"chunk":typeof r.error=="string"?"error":"unknown"},W=e=>ce(e)==="chunk";var F=Object.freeze({businessDate:"business-date",idsStream:z,report:"report",search:"search",reports:"reports",searchMarks:"search-marks",action:"action"}),V=Object.freeze({businessDate:"businessDate",reportHubId:"reportHubId",searchQuery:"q",searchCombine:"combine",reportIds:"ids",forceRefresh:"forceRefresh",cursorReportHubId:"cursor_report_hub_id",cursorBusinessDate:"cursor_business_date",cursorSnapshot:"cursor_snapshot"});var M=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),g=e=>Object.hasOwn(M,e);var K="download",Q="thumbnail",q="1",G=(e,r,n)=>{let a=`${e}/attachment/${encodeURIComponent(r)}`;switch(n.kind){case"inline":return a;case"download":return`${a}?${new URLSearchParams({[K]:q})}`;case"thumbnail":return`${a}?${new URLSearchParams({[Q]:n.variant})}`}},X=e=>{let r=e.getAll(Q),n=e.getAll(K);if(r.length>0&&n.length>0)return{kind:"invalid",reason:"conflict"};if(r.length>0){let[a]=r;return r.length===1&&g(a)?{kind:"thumbnail",variant:a}:{kind:"invalid",reason:"thumbnail_variant"}}return n.length>0?n.length===1&&n[0]===q?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var ye=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var Z=e=>e<10?`0${e}`:`${e}`,Re=e=>{if(Number.isNaN(e.getTime()))return null;let r=e.getFullYear(),n=Z(e.getMonth()+1),a=Z(e.getDate());return`${r}-${n}-${a}`},he=e=>{let r=ye.exec(e);if(r===null)return null;let[,n,,a,l]=r,y=Number(n),s=Number(a),R=Number(l);if(y<1)return null;let h=new Date(0);return h.setUTCFullYear(y,s-1,R),h.getUTCFullYear()!==y||h.getUTCMonth()!==s-1||h.getUTCDate()!==R?null:`${n}-${a}-${l}`};var J=e=>e==null?null:e instanceof Date?Re(e):he(e);var ge=e=>typeof e=="string"?JSON.stringify(e):typeof e=="number"||typeof e=="boolean"||e===null||e===void 0?String(e):Array.isArray(e)?"array":typeof e,ee=(e,r,n)=>new RangeError(`[daily-report] ${e} must be ${r}; got ${ge(n)}`);var De="legacy-",Ie=e=>`${De}${e}`,te=(e,r,n,a)=>{if(typeof a!="string"||a.trim()==="")throw ee("mergeComments: unknownAuthorName","a non-blank string",a);let l=e.map((s,R)=>({id:Ie(R),authorName:s.name||a,content:s.text||"",isMine:!1,color:s.color||void 0,isLegacy:!0,isAuthorUnknown:!s.name})),y=r.map(s=>({id:s.id,authorName:s.userName||a,content:s.content??"",createdAt:s.createdAt??"",isMine:n?s.userId===n:s.isMine,isLegacy:!1,isAuthorUnknown:!s.userName}));return[...l,...y]};var re=["intersection","union"];var We=Object.freeze({maxQueryLength:500,maxSets:16,maxWordsPerSet:16,maxWords:32,maxWordLength:100,maxDetailIds:100}),be=2;var Fe=Object.freeze({word:0,reading:1});var Ve=2*(1+be);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_SEARCH_COMBINES,DAILY_REPORT_SSE_CURSOR_PARAM,DAILY_REPORT_SSE_HEARTBEAT_MS,DAILY_REPORT_SSE_TERMINAL_EVENTS,buildDailyReportAttachmentUrl,commentAddMessageSchema,commentDeleteMessageSchema,connectedMessageSchema,dailyReportDetailSchema,dailyReportExternalCommentSchema,dailyReportInterviewerSchema,dailyReportLabelDefSchema,dailyReportPostedCommentSchema,dailyReportSseMessageSchema,encodeDailyReportActionCommand,isDailyReportAttachmentThumbnailVariant,isDailyReportSseStreamId,isIdsStreamChunkLine,mergeComments,normalizeBusinessDateKey,parseDailyReportActionResult,parseDailyReportAttachmentQuery,reportCreateMessageSchema,reportDeleteMessageSchema,reportPublishMessageSchema,reportUpdateMessageSchema,statusUpdateMessageSchema});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{z as o}from"zod";var c=/^(?:[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 j}from"zod";var a=j.number().int().positive().max(Number.MAX_SAFE_INTEGER);import{z as t}from"zod";var B=["auth-required","forbidden","resync-required"],$=15e3,v="lastEventId",z=/^\d{1,15}-\d{1,15}$/,W=e=>z.test(e),b=t.object({name:t.string().nullish(),affiliation:t.string().nullish()}),S=t.object({name:t.string().nullish(),text:t.string().nullish(),color:t.string().nullish()}),A=t.object({id:a,name:t.string().nullish(),color:t.string().nullish()}),y=t.object({id:a,userId:t.string().nullish(),userName:t.string().nullish(),content:t.string().nullish(),createdAt:t.string().nullish(),isMine:t.boolean()}),F=t.object({id:t.string(),fileName:t.string(),fileType:t.string().nullable(),fileSize:t.number().nullable(),createdAt:t.string().nullable(),state:t.enum(["present","absent","unknown"]),hasThumbnail:t.boolean().default(!1)}),d=t.object({reportHubId:a,date:t.string().nullish(),createdAt:t.string().nullish(),author:t.string().nullish(),userId:t.string().nullish(),sourceType:t.string().nullish(),employeeName:t.string().nullish(),updatedBy:t.string().nullish(),updatedAt:t.string().nullish(),category:t.string().nullish(),creationCategory:t.string().nullish(),visitTimeFrom:t.string().nullish(),visitTimeTo:t.string().nullish(),customerName:t.string().nullish(),interviewers:t.array(b),subject:t.string().nullish(),content:t.string().nullish(),externalComments:t.array(S),isRead:t.boolean(),isStarred:t.boolean(),labels:t.array(A),postedComments:t.array(y),attachments:t.array(F).default([])}),u=t.string().regex(c),f=t.object({type:t.literal("connected")}),T=t.object({type:t.literal("status-update"),reportHubId:a,statusType:t.enum(["star","read"]),value:t.boolean(),clientTempId:u,recipientRawUserId:a.optional()}),g=t.string().optional(),x=t.object({type:t.literal("comment-add"),reportHubId:a,comment:y,clientTempId:u,recipientRawUserId:a.optional(),sourceType:g}),_=t.object({type:t.literal("comment-delete"),reportHubId:a,commentId:a,clientTempId:u,recipientRawUserId:a.optional(),sourceType:g}),C=t.object({type:t.literal("report-create"),reportHubId:a,report:d,clientTempId:u,recipientRawUserId:a.optional()}),E=t.object({type:t.literal("report-update"),reportHubId:a,report:d,clientTempId:u,recipientRawUserId:a.optional()}),O=t.object({type:t.literal("report-publish"),reportHubId:a,report:d,clientTempId:u,recipientRawUserId:a.optional()}),P=t.object({type:t.literal("report-delete"),reportHubId:a,clientTempId:u,sourceType:g}),V=t.discriminatedUnion("type",[f,T,x,_,C,E,O,P]);var M=e=>e.issues.map(r=>`${r.path.length===0?"(root)":r.path.join(".")}: ${r.code}`).join("; ");var K=Object.freeze(["create","update","publish","delete","toggleStar","toggleRead","addComment","deleteComment","clearCache"]);var l=Object.freeze({intent:"intent",clientTempId:"clientTempId",businessDate:"businessDate",operationTimestamp:"operationTimestamp",reportHubId:"reportHubId",title:"title",content:"content",isStarred:"isStarred",isRead:"isRead",commentId:"commentId"}),Q=e=>{let r=new FormData;if(r.append(l.intent,e.intent),e.intent==="clearCache"||(r.append(l.clientTempId,e.clientTempId),e.businessDate!==null&&r.append(l.businessDate,e.businessDate),e.operationTimestamp!==null&&r.append(l.operationTimestamp,String(e.operationTimestamp)),e.intent==="create"))return r;switch(r.append(l.reportHubId,String(e.reportHubId)),e.intent){case"update":return e.changes.title!==void 0&&r.append(l.title,e.changes.title),e.changes.content!==void 0&&r.append(l.content,e.changes.content),r;case"publish":case"delete":return r;case"toggleStar":return r.append(l.isStarred,String(e.value)),r;case"toggleRead":return r.append(l.isRead,String(e.value)),r;case"addComment":return r.append(l.content,e.content),r;case"deleteComment":return r.append(l.commentId,String(e.commentId)),r}},q=()=>{let e=a,r=o.string().regex(c),n=o.literal("OK"),i=o.object({isStarred:o.boolean(),isRead:o.boolean()}),p=o.number().int().nonnegative().nullable();return{create:o.object({status:n,intent:o.literal("create"),reportHubId:e,clientTempId:r,report:d}),update:o.object({status:n,intent:o.literal("update"),reportHubId:e,clientTempId:r}),publish:o.object({status:n,intent:o.literal("publish"),reportHubId:e,clientTempId:r,report:d.nullable()}),delete:o.object({status:n,intent:o.literal("delete"),reportHubId:e,clientTempId:r}),toggleStar:o.object({status:n,intent:o.literal("toggleStar"),reportHubId:e,clientTempId:r,updatedStatus:i,operationTimestamp:p}),toggleRead:o.object({status:n,intent:o.literal("toggleRead"),reportHubId:e,clientTempId:r,updatedStatus:i,operationTimestamp:p}),addComment:o.object({status:n,intent:o.literal("addComment"),reportHubId:e,clientTempId:r,newComment:y}),deleteComment:o.object({status:n,intent:o.literal("deleteComment"),reportHubId:e,clientTempId:r,deletedCommentId:a}),clearCache:o.object({status:n,intent:o.literal("clearCache")})}},D=null,G=()=>(D===null&&(D=q()),D),X=(e,r)=>{let n=G()[e].safeParse(r);return n.success?{result:n.data}:{mismatch:M(n.error)}};var N="ids-stream",Z=e=>{if(typeof e!="object"||e===null)return"unknown";let r=e;return typeof r.kind=="string"?r.kind==="chunk"?"chunk":r.kind==="error"?"error":"unknown":Array.isArray(r.items)?"chunk":typeof r.error=="string"?"error":"unknown"},J=e=>Z(e)==="chunk";var ee=Object.freeze({businessDate:"business-date",idsStream:N,report:"report",search:"search",reports:"reports",searchMarks:"search-marks",action:"action"}),te=Object.freeze({businessDate:"businessDate",reportHubId:"reportHubId",searchQuery:"q",searchCombine:"combine",reportIds:"ids",forceRefresh:"forceRefresh",cursorReportHubId:"cursor_report_hub_id",cursorBusinessDate:"cursor_business_date",cursorSnapshot:"cursor_snapshot"});var w=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),I=e=>Object.hasOwn(w,e);var L="download",k="thumbnail",H="1",re=(e,r,n)=>{let i=`${e}/attachment/${encodeURIComponent(r)}`;switch(n.kind){case"inline":return i;case"download":return`${i}?${new URLSearchParams({[L]:H})}`;case"thumbnail":return`${i}?${new URLSearchParams({[k]:n.variant})}`}},ne=e=>{let r=e.getAll(k),n=e.getAll(L);if(r.length>0&&n.length>0)return{kind:"invalid",reason:"conflict"};if(r.length>0){let[i]=r;return r.length===1&&I(i)?{kind:"thumbnail",variant:i}:{kind:"invalid",reason:"thumbnail_variant"}}return n.length>0?n.length===1&&n[0]===H?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var oe=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var U=e=>e<10?`0${e}`:`${e}`,ae=e=>{if(Number.isNaN(e.getTime()))return null;let r=e.getFullYear(),n=U(e.getMonth()+1),i=U(e.getDate());return`${r}-${n}-${i}`},ie=e=>{let r=oe.exec(e);if(r===null)return null;let[,n,,i,p]=r,m=Number(n),s=Number(i),R=Number(p);if(m<1)return null;let h=new Date(0);return h.setUTCFullYear(m,s-1,R),h.getUTCFullYear()!==m||h.getUTCMonth()!==s-1||h.getUTCDate()!==R?null:`${n}-${i}-${p}`};var se=e=>e==null?null:e instanceof Date?ae(e):ie(e);var le=e=>typeof e=="string"?JSON.stringify(e):typeof e=="number"||typeof e=="boolean"||e===null||e===void 0?String(e):Array.isArray(e)?"array":typeof e,Y=(e,r,n)=>new RangeError(`[daily-report] ${e} must be ${r}; got ${le(n)}`);var pe="legacy-",de=e=>`${pe}${e}`,ue=(e,r,n,i)=>{if(typeof i!="string"||i.trim()==="")throw Y("mergeComments: unknownAuthorName","a non-blank string",i);let p=e.map((s,R)=>({id:de(R),authorName:s.name||i,content:s.text||"",isMine:!1,color:s.color||void 0,isLegacy:!0,isAuthorUnknown:!s.name})),m=r.map(s=>({id:s.id,authorName:s.userName||i,content:s.content??"",createdAt:s.createdAt??"",isMine:n?s.userId===n:s.isMine,isLegacy:!1,isAuthorUnknown:!s.userName}));return[...p,...m]};var me=["intersection","union"];var Ye=Object.freeze({maxQueryLength:500,maxSets:16,maxWordsPerSet:16,maxWords:32,maxWordLength:100,maxDetailIds:100}),ce=2;var je=2*(1+ce);export{l as DAILY_REPORT_ACTION_FIELDS,K as DAILY_REPORT_ACTION_INTENTS,ee as DAILY_REPORT_API_ENDPOINTS,te as DAILY_REPORT_API_QUERY_PARAMS,w as DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,c as DAILY_REPORT_CLIENT_TEMP_ID_PATTERN,me as DAILY_REPORT_SEARCH_COMBINES,v as DAILY_REPORT_SSE_CURSOR_PARAM,$ as DAILY_REPORT_SSE_HEARTBEAT_MS,B as DAILY_REPORT_SSE_TERMINAL_EVENTS,re as buildDailyReportAttachmentUrl,x as commentAddMessageSchema,_ as commentDeleteMessageSchema,f as connectedMessageSchema,d as dailyReportDetailSchema,S as dailyReportExternalCommentSchema,b as dailyReportInterviewerSchema,A as dailyReportLabelDefSchema,y as dailyReportPostedCommentSchema,V as dailyReportSseMessageSchema,Q as encodeDailyReportActionCommand,I as isDailyReportAttachmentThumbnailVariant,W as isDailyReportSseStreamId,J as isIdsStreamChunkLine,ue as mergeComments,se as normalizeBusinessDateKey,X as parseDailyReportActionResult,ne as parseDailyReportAttachmentQuery,C as reportCreateMessageSchema,P as reportDeleteMessageSchema,O as reportPublishMessageSchema,E as reportUpdateMessageSchema,T as statusUpdateMessageSchema};
1
+ import{z as o}from"zod";var c=/^(?:[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 j}from"zod";var a=j.number().int().positive().max(Number.MAX_SAFE_INTEGER);import{z as t}from"zod";var B=["auth-required","forbidden","resync-required"],$=15e3,v="lastEventId",z=/^\d{1,15}-\d{1,15}$/,W=e=>z.test(e),b=t.object({name:t.string().nullish(),affiliation:t.string().nullish()}),A=t.object({name:t.string().nullish(),text:t.string().nullish(),color:t.string().nullish()}),S=t.object({id:a,name:t.string().nullish(),color:t.string().nullish()}),y=t.object({id:a,userId:t.string().nullish(),userName:t.string().nullish(),content:t.string().nullish(),createdAt:t.string().nullish(),isMine:t.boolean()}),F=t.object({id:t.string(),fileName:t.string(),fileType:t.string().nullable(),fileSize:t.number().nullable(),createdAt:t.string().nullable(),state:t.enum(["present","absent","unknown"]),hasThumbnail:t.boolean().default(!1)}),d=t.object({reportHubId:a,date:t.string().nullish(),createdAt:t.string().nullish(),author:t.string().nullish(),userId:t.string().nullish(),sourceType:t.string().nullish(),employeeName:t.string().nullish(),updatedBy:t.string().nullish(),updatedAt:t.string().nullish(),category:t.string().nullish(),creationCategory:t.string().nullish(),visitTimeFrom:t.string().nullish(),visitTimeTo:t.string().nullish(),customerName:t.string().nullish(),interviewers:t.array(b),subject:t.string().nullish(),content:t.string().nullish(),externalComments:t.array(A),isRead:t.boolean(),isStarred:t.boolean(),labels:t.array(S),postedComments:t.array(y),attachments:t.array(F).default([])}),u=t.string().regex(c),f=t.object({type:t.literal("connected")}),T=t.object({type:t.literal("status-update"),reportHubId:a,statusType:t.enum(["star","read"]),value:t.boolean(),clientTempId:u,recipientRawUserId:a.optional()}),g=t.string().optional(),x=t.object({type:t.literal("comment-add"),reportHubId:a,comment:y,clientTempId:u,recipientRawUserId:a.optional(),sourceType:g}),_=t.object({type:t.literal("comment-delete"),reportHubId:a,commentId:a,clientTempId:u,recipientRawUserId:a.optional(),sourceType:g}),E=t.object({type:t.literal("report-create"),reportHubId:a,report:d,clientTempId:u,recipientRawUserId:a.optional()}),C=t.object({type:t.literal("report-update"),reportHubId:a,report:d,clientTempId:u,recipientRawUserId:a.optional()}),O=t.object({type:t.literal("report-publish"),reportHubId:a,report:d,clientTempId:u,recipientRawUserId:a.optional()}),P=t.object({type:t.literal("report-delete"),reportHubId:a,clientTempId:u,sourceType:g}),V=t.discriminatedUnion("type",[f,T,x,_,E,C,O,P]);var w=e=>e.issues.map(r=>`${r.path.length===0?"(root)":r.path.join(".")}: ${r.code}`).join("; ");var K=Object.freeze(["create","update","publish","delete","toggleStar","toggleRead","addComment","deleteComment","clearCache"]);var l=Object.freeze({intent:"intent",clientTempId:"clientTempId",businessDate:"businessDate",operationTimestamp:"operationTimestamp",reportHubId:"reportHubId",title:"title",content:"content",isStarred:"isStarred",isRead:"isRead",commentId:"commentId"}),Q=e=>{let r=new FormData;if(r.append(l.intent,e.intent),e.intent==="clearCache"||(r.append(l.clientTempId,e.clientTempId),e.businessDate!==null&&r.append(l.businessDate,e.businessDate),e.operationTimestamp!==null&&r.append(l.operationTimestamp,String(e.operationTimestamp)),e.intent==="create"))return r;switch(r.append(l.reportHubId,String(e.reportHubId)),e.intent){case"update":return e.changes.title!==void 0&&r.append(l.title,e.changes.title),e.changes.content!==void 0&&r.append(l.content,e.changes.content),r;case"publish":case"delete":return r;case"toggleStar":return r.append(l.isStarred,String(e.value)),r;case"toggleRead":return r.append(l.isRead,String(e.value)),r;case"addComment":return r.append(l.content,e.content),r;case"deleteComment":return r.append(l.commentId,String(e.commentId)),r}},q=()=>{let e=a,r=o.string().regex(c),n=o.literal("OK"),i=o.object({isStarred:o.boolean(),isRead:o.boolean()}),p=o.number().int().nonnegative().nullable();return{create:o.object({status:n,intent:o.literal("create"),reportHubId:e,clientTempId:r,report:d}),update:o.object({status:n,intent:o.literal("update"),reportHubId:e,clientTempId:r}),publish:o.object({status:n,intent:o.literal("publish"),reportHubId:e,clientTempId:r,report:d.nullable()}),delete:o.object({status:n,intent:o.literal("delete"),reportHubId:e,clientTempId:r}),toggleStar:o.object({status:n,intent:o.literal("toggleStar"),reportHubId:e,clientTempId:r,updatedStatus:i,operationTimestamp:p}),toggleRead:o.object({status:n,intent:o.literal("toggleRead"),reportHubId:e,clientTempId:r,updatedStatus:i,operationTimestamp:p}),addComment:o.object({status:n,intent:o.literal("addComment"),reportHubId:e,clientTempId:r,newComment:y}),deleteComment:o.object({status:n,intent:o.literal("deleteComment"),reportHubId:e,clientTempId:r,deletedCommentId:a}),clearCache:o.object({status:n,intent:o.literal("clearCache")})}},D=null,G=()=>(D===null&&(D=q()),D),X=(e,r)=>{let n=G()[e].safeParse(r);return n.success?{result:n.data}:{mismatch:w(n.error)}};var M="ids-stream",Z=e=>{if(typeof e!="object"||e===null)return"unknown";let r=e;return typeof r.kind=="string"?r.kind==="chunk"?"chunk":r.kind==="error"?"error":"unknown":Array.isArray(r.items)?"chunk":typeof r.error=="string"?"error":"unknown"},J=e=>Z(e)==="chunk";var ee=Object.freeze({businessDate:"business-date",idsStream:M,report:"report",search:"search",reports:"reports",searchMarks:"search-marks",action:"action"}),te=Object.freeze({businessDate:"businessDate",reportHubId:"reportHubId",searchQuery:"q",searchCombine:"combine",reportIds:"ids",forceRefresh:"forceRefresh",cursorReportHubId:"cursor_report_hub_id",cursorBusinessDate:"cursor_business_date",cursorSnapshot:"cursor_snapshot"});var N=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),I=e=>Object.hasOwn(N,e);var L="download",k="thumbnail",H="1",re=(e,r,n)=>{let i=`${e}/attachment/${encodeURIComponent(r)}`;switch(n.kind){case"inline":return i;case"download":return`${i}?${new URLSearchParams({[L]:H})}`;case"thumbnail":return`${i}?${new URLSearchParams({[k]:n.variant})}`}},ne=e=>{let r=e.getAll(k),n=e.getAll(L);if(r.length>0&&n.length>0)return{kind:"invalid",reason:"conflict"};if(r.length>0){let[i]=r;return r.length===1&&I(i)?{kind:"thumbnail",variant:i}:{kind:"invalid",reason:"thumbnail_variant"}}return n.length>0?n.length===1&&n[0]===H?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var oe=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var U=e=>e<10?`0${e}`:`${e}`,ae=e=>{if(Number.isNaN(e.getTime()))return null;let r=e.getFullYear(),n=U(e.getMonth()+1),i=U(e.getDate());return`${r}-${n}-${i}`},ie=e=>{let r=oe.exec(e);if(r===null)return null;let[,n,,i,p]=r,m=Number(n),s=Number(i),R=Number(p);if(m<1)return null;let h=new Date(0);return h.setUTCFullYear(m,s-1,R),h.getUTCFullYear()!==m||h.getUTCMonth()!==s-1||h.getUTCDate()!==R?null:`${n}-${i}-${p}`};var se=e=>e==null?null:e instanceof Date?ae(e):ie(e);var le=e=>typeof e=="string"?JSON.stringify(e):typeof e=="number"||typeof e=="boolean"||e===null||e===void 0?String(e):Array.isArray(e)?"array":typeof e,Y=(e,r,n)=>new RangeError(`[daily-report] ${e} must be ${r}; got ${le(n)}`);var pe="legacy-",de=e=>`${pe}${e}`,ue=(e,r,n,i)=>{if(typeof i!="string"||i.trim()==="")throw Y("mergeComments: unknownAuthorName","a non-blank string",i);let p=e.map((s,R)=>({id:de(R),authorName:s.name||i,content:s.text||"",isMine:!1,color:s.color||void 0,isLegacy:!0,isAuthorUnknown:!s.name})),m=r.map(s=>({id:s.id,authorName:s.userName||i,content:s.content??"",createdAt:s.createdAt??"",isMine:n?s.userId===n:s.isMine,isLegacy:!1,isAuthorUnknown:!s.userName}));return[...p,...m]};var me=["intersection","union"];var Ye=Object.freeze({maxQueryLength:500,maxSets:16,maxWordsPerSet:16,maxWords:32,maxWordLength:100,maxDetailIds:100}),ce=2;var je=Object.freeze({word:0,reading:1});var Be=2*(1+ce);export{l as DAILY_REPORT_ACTION_FIELDS,K as DAILY_REPORT_ACTION_INTENTS,ee as DAILY_REPORT_API_ENDPOINTS,te as DAILY_REPORT_API_QUERY_PARAMS,N as DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,c as DAILY_REPORT_CLIENT_TEMP_ID_PATTERN,me as DAILY_REPORT_SEARCH_COMBINES,v as DAILY_REPORT_SSE_CURSOR_PARAM,$ as DAILY_REPORT_SSE_HEARTBEAT_MS,B as DAILY_REPORT_SSE_TERMINAL_EVENTS,re as buildDailyReportAttachmentUrl,x as commentAddMessageSchema,_ as commentDeleteMessageSchema,f as connectedMessageSchema,d as dailyReportDetailSchema,A as dailyReportExternalCommentSchema,b as dailyReportInterviewerSchema,S as dailyReportLabelDefSchema,y as dailyReportPostedCommentSchema,V as dailyReportSseMessageSchema,Q as encodeDailyReportActionCommand,I as isDailyReportAttachmentThumbnailVariant,W as isDailyReportSseStreamId,J as isIdsStreamChunkLine,ue as mergeComments,se as normalizeBusinessDateKey,X as parseDailyReportActionResult,ne as parseDailyReportAttachmentQuery,E as reportCreateMessageSchema,P as reportDeleteMessageSchema,O as reportPublishMessageSchema,C as reportUpdateMessageSchema,T as statusUpdateMessageSchema};
package/dist/server.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { c as DailyReportSseMessage, k as DailyReportInterviewer, j as DailyReportExternalComment, D as DailyReportItem, d as DailyReportDetail, i as DailyReportAttachmentSummary, m as DailyReportPostedComment } from "./sse-schema-getLS62T.mjs";
2
2
  import * as drizzle_orm_mssql_core from "drizzle-orm/mssql-core";
3
3
  import { AnyMsSqlColumn } from "drizzle-orm/mssql-core";
4
- import { a as DailyReportLogger, b as DailyReportSearchCombine, g as DailyReportSearchAlternative, d as DailyReportSearchHit, e as DailyReportSearchMarksAnswer } from "./search-marks-wire-DCFuK5yr.mjs";
5
- export { h as DailyReportSearchAlternativeTier } from "./search-marks-wire-DCFuK5yr.mjs";
4
+ import { a as DailyReportLogger, b as DailyReportSearchCombine, g as DailyReportSearchAlternative, d as DailyReportSearchHit, e as DailyReportSearchMarksAnswer } from "./search-marks-wire-CZRU4q3h.mjs";
5
+ export { h as DailyReportSearchAlternativeTier } from "./search-marks-wire-CZRU4q3h.mjs";
6
6
  import { TransactionRetryOptions } from "@aiquants/mssql";
7
7
  import { SQL } from "drizzle-orm";
8
8
  import "zod";
@@ -1858,7 +1858,9 @@ declare function createDailyReportService(config: DailyReportServiceConfig): {
1858
1858
  getDailyReportDetailsByIdsByExternalId: (scope: DailyReportViewerScope, reportHubIds: readonly number[], externalId: string) => Promise<DailyReportDetail[]>;
1859
1859
  getDraftLabelId: () => Promise<number | null>;
1860
1860
  searchDailyReports: (scope: DailyReportViewerScope, userId: number, plan: DailyReportSearchPlan) => Promise<DailyReportSearchHit[]>;
1861
- markDailyReportSearchHits: (scope: DailyReportViewerScope, userId: number, plan: DailyReportSearchPlan, reportHubIds: readonly number[]) => Promise<DailyReportSearchMarksAnswer>;
1861
+ markDailyReportSearchHits: (scope: DailyReportViewerScope, userId: number, plan: DailyReportSearchPlan, reportHubIds: readonly number[], options: {
1862
+ readonly signal: AbortSignal;
1863
+ }) => Promise<DailyReportSearchMarksAnswer>;
1862
1864
  reconcileSearchIndex: (options: DailyReportSearchReconcileOptions) => Promise<DailyReportSearchReconcileSummary>;
1863
1865
  getAttachmentsByHubIds: (hubIds: number[]) => Promise<Map<number, DailyReportAttachmentSummary[]>>;
1864
1866
  getAttachmentForUser: (scope: DailyReportViewerScope, attachmentId: number, userId: number) => Promise<{
package/dist/server.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { c as DailyReportSseMessage, k as DailyReportInterviewer, j as DailyReportExternalComment, D as DailyReportItem, d as DailyReportDetail, i as DailyReportAttachmentSummary, m as DailyReportPostedComment } from "./sse-schema-getLS62T.js";
2
2
  import * as drizzle_orm_mssql_core from "drizzle-orm/mssql-core";
3
3
  import { AnyMsSqlColumn } from "drizzle-orm/mssql-core";
4
- import { a as DailyReportLogger, b as DailyReportSearchCombine, g as DailyReportSearchAlternative, d as DailyReportSearchHit, e as DailyReportSearchMarksAnswer } from "./search-marks-wire-DCFuK5yr.js";
5
- export { h as DailyReportSearchAlternativeTier } from "./search-marks-wire-DCFuK5yr.js";
4
+ import { a as DailyReportLogger, b as DailyReportSearchCombine, g as DailyReportSearchAlternative, d as DailyReportSearchHit, e as DailyReportSearchMarksAnswer } from "./search-marks-wire-CZRU4q3h.js";
5
+ export { h as DailyReportSearchAlternativeTier } from "./search-marks-wire-CZRU4q3h.js";
6
6
  import { TransactionRetryOptions } from "@aiquants/mssql";
7
7
  import { SQL } from "drizzle-orm";
8
8
  import "zod";
@@ -1858,7 +1858,9 @@ declare function createDailyReportService(config: DailyReportServiceConfig): {
1858
1858
  getDailyReportDetailsByIdsByExternalId: (scope: DailyReportViewerScope, reportHubIds: readonly number[], externalId: string) => Promise<DailyReportDetail[]>;
1859
1859
  getDraftLabelId: () => Promise<number | null>;
1860
1860
  searchDailyReports: (scope: DailyReportViewerScope, userId: number, plan: DailyReportSearchPlan) => Promise<DailyReportSearchHit[]>;
1861
- markDailyReportSearchHits: (scope: DailyReportViewerScope, userId: number, plan: DailyReportSearchPlan, reportHubIds: readonly number[]) => Promise<DailyReportSearchMarksAnswer>;
1861
+ markDailyReportSearchHits: (scope: DailyReportViewerScope, userId: number, plan: DailyReportSearchPlan, reportHubIds: readonly number[], options: {
1862
+ readonly signal: AbortSignal;
1863
+ }) => Promise<DailyReportSearchMarksAnswer>;
1862
1864
  reconcileSearchIndex: (options: DailyReportSearchReconcileOptions) => Promise<DailyReportSearchReconcileSummary>;
1863
1865
  getAttachmentsByHubIds: (hubIds: number[]) => Promise<Map<number, DailyReportAttachmentSummary[]>>;
1864
1866
  getAttachmentForUser: (scope: DailyReportViewerScope, attachmentId: number, userId: number) => Promise<{