@aiquants/daily-report 0.38.0 → 0.40.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.
@@ -1,4 +1,4 @@
1
- import { d as DailyReportDetail, m as DailyReportPostedComment, D as DailyReportItem, j as DailyReportExternalComment } from "./sse-schema-byewDmZK.js";
1
+ import { e as DailyReportDetail, q as DailyReportPostedComment, k as DailyReportExternalComment } from "./sse-schema-S7gXWA2N.mjs";
2
2
  declare const DAILY_REPORT_ACTION_INTENTS: readonly [
3
3
  "create",
4
4
  "update",
@@ -139,26 +139,6 @@ type ActionResultReading<Intent extends DailyReportActionIntent> = {
139
139
  readonly mismatch: string;
140
140
  };
141
141
  declare const parseActionResult: <Intent extends DailyReportActionIntent>(intent: Intent, json: unknown) => ActionResultReading<Intent>;
142
- type DailyReportIdsStreamCursor = {
143
- businessDate: string | null;
144
- reportHubId: number;
145
- };
146
- type DailyReportIdsStreamChunkLine = {
147
- kind: "chunk";
148
- items: DailyReportItem[];
149
- nextCursor: DailyReportIdsStreamCursor | null;
150
- isLast: boolean;
151
- total?: number;
152
- provisional?: boolean;
153
- snapshot?: string;
154
- restarted?: boolean;
155
- streamAnchor?: string | null;
156
- };
157
- type DailyReportSseStreamAnchor = {
158
- readonly lastEventId: string | null;
159
- readonly revision: number;
160
- };
161
- declare const isIdsStreamChunkLine: (line: unknown) => line is DailyReportIdsStreamChunkLine;
162
142
  type UIComment = {
163
143
  id: string | number;
164
144
  authorName: string;
@@ -170,4 +150,4 @@ type UIComment = {
170
150
  isAuthorUnknown: boolean;
171
151
  };
172
152
  declare const mergeComments: (legacyComments: DailyReportExternalComment[], modernComments: DailyReportPostedComment[], currentUserId: string | null | undefined, unknownAuthorName: string) => UIComment[];
173
- export { type ActionCommand as A, type DailyReportActionIntent as D, type UIComment as U, type DailyReportSseStreamAnchor as a, DAILY_REPORT_ACTION_FIELDS as b, DAILY_REPORT_ACTION_INTENTS as c, type ActionFailure as d, type ActionResult as e, type ActionResultOf as f, type ActionResultReading as g, type DailyReportIdsStreamChunkLine as h, type DailyReportIdsStreamCursor as i, encodeActionCommand as j, isIdsStreamChunkLine as k, mergeComments as m, parseActionResult as p };
153
+ export { type ActionCommand as A, type DailyReportActionIntent as D, type UIComment as U, DAILY_REPORT_ACTION_FIELDS as a, DAILY_REPORT_ACTION_INTENTS as b, type ActionFailure as c, type ActionResult as d, type ActionResultOf as e, type ActionResultReading as f, encodeActionCommand as g, mergeComments as m, parseActionResult as p };
@@ -1,4 +1,4 @@
1
- import { d as DailyReportDetail, m as DailyReportPostedComment, D as DailyReportItem, j as DailyReportExternalComment } from "./sse-schema-byewDmZK.mjs";
1
+ import { e as DailyReportDetail, q as DailyReportPostedComment, k as DailyReportExternalComment } from "./sse-schema-S7gXWA2N.js";
2
2
  declare const DAILY_REPORT_ACTION_INTENTS: readonly [
3
3
  "create",
4
4
  "update",
@@ -139,26 +139,6 @@ type ActionResultReading<Intent extends DailyReportActionIntent> = {
139
139
  readonly mismatch: string;
140
140
  };
141
141
  declare const parseActionResult: <Intent extends DailyReportActionIntent>(intent: Intent, json: unknown) => ActionResultReading<Intent>;
142
- type DailyReportIdsStreamCursor = {
143
- businessDate: string | null;
144
- reportHubId: number;
145
- };
146
- type DailyReportIdsStreamChunkLine = {
147
- kind: "chunk";
148
- items: DailyReportItem[];
149
- nextCursor: DailyReportIdsStreamCursor | null;
150
- isLast: boolean;
151
- total?: number;
152
- provisional?: boolean;
153
- snapshot?: string;
154
- restarted?: boolean;
155
- streamAnchor?: string | null;
156
- };
157
- type DailyReportSseStreamAnchor = {
158
- readonly lastEventId: string | null;
159
- readonly revision: number;
160
- };
161
- declare const isIdsStreamChunkLine: (line: unknown) => line is DailyReportIdsStreamChunkLine;
162
142
  type UIComment = {
163
143
  id: string | number;
164
144
  authorName: string;
@@ -170,4 +150,4 @@ type UIComment = {
170
150
  isAuthorUnknown: boolean;
171
151
  };
172
152
  declare const mergeComments: (legacyComments: DailyReportExternalComment[], modernComments: DailyReportPostedComment[], currentUserId: string | null | undefined, unknownAuthorName: string) => UIComment[];
173
- export { type ActionCommand as A, type DailyReportActionIntent as D, type UIComment as U, type DailyReportSseStreamAnchor as a, DAILY_REPORT_ACTION_FIELDS as b, DAILY_REPORT_ACTION_INTENTS as c, type ActionFailure as d, type ActionResult as e, type ActionResultOf as f, type ActionResultReading as g, type DailyReportIdsStreamChunkLine as h, type DailyReportIdsStreamCursor as i, encodeActionCommand as j, isIdsStreamChunkLine as k, mergeComments as m, parseActionResult as p };
153
+ export { type ActionCommand as A, type DailyReportActionIntent as D, type UIComment as U, DAILY_REPORT_ACTION_FIELDS as a, DAILY_REPORT_ACTION_INTENTS as b, type ActionFailure as c, type ActionResult as d, type ActionResultOf as e, type ActionResultReading as f, encodeActionCommand as g, mergeComments as m, parseActionResult as p };
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
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-BsbOiHmX.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
- 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-byewDmZK.mjs";
1
+ export { a as DAILY_REPORT_ACTION_FIELDS, b as DAILY_REPORT_ACTION_INTENTS, A as DailyReportActionCommand, c as DailyReportActionFailure, D as DailyReportActionIntent, d as DailyReportActionResult, e as DailyReportActionResultOf, f as DailyReportActionResultReading, U as DailyReportUIComment, g as encodeDailyReportActionCommand, m as mergeComments, p as parseDailyReportActionResult } from "./comment-adapter-BbGh4nc0.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 DailyReportAttachmentState, j as DailyReportAttachmentSummary, e as DailyReportDetail, k as DailyReportExternalComment, l as DailyReportIdsStreamChunkLine, m as DailyReportIdsStreamCursor, n as DailyReportIdsStreamRowColumns, o as DailyReportInterviewer, D as DailyReportItem, p as DailyReportLabelDef, q as DailyReportPostedComment, d as DailyReportSseMessage, a as DailyReportSseStreamAnchor, c as DailyReportSseTerminalEvent, b as DailyReportUser, r as commentAddMessageSchema, s as commentDeleteMessageSchema, t as connectedMessageSchema, u as dailyReportDetailSchema, v as dailyReportExternalCommentSchema, w as dailyReportInterviewerSchema, x as dailyReportLabelDefSchema, y as dailyReportPostedCommentSchema, z as dailyReportSseMessageSchema, A as forEachIdsStreamRow, B as isDailyReportSseStreamId, C as isIdsStreamChunkLine, E as reportCreateMessageSchema, F as reportDeleteMessageSchema, G as reportPublishMessageSchema, H as reportUpdateMessageSchema, I as statusUpdateMessageSchema } from "./sse-schema-S7gXWA2N.mjs";
3
+ export { D as DAILY_REPORT_SEARCH_BATCHES_IN_FLIGHT, a as DAILY_REPORT_SEARCH_COMBINES, b as DailyReportLogger, c as DailyReportSearchCombine, d as DailyReportSearchFieldMarks, e as DailyReportSearchHit, f as DailyReportSearchMarksAnswer, g as DailyReportSearchReportMarks } from "./search-marks-wire-DLgJTytk.mjs";
4
4
  import "zod";
5
5
  declare const DAILY_REPORT_API_ENDPOINTS: Readonly<{
6
6
  readonly businessDate: "business-date";
7
- readonly idsStream: "ids-stream";
7
+ readonly idsStream: "ids-columns";
8
8
  readonly report: "report";
9
9
  readonly search: "search";
10
10
  readonly reports: "reports";
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
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-CldlCy1v.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
- 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-byewDmZK.js";
1
+ export { a as DAILY_REPORT_ACTION_FIELDS, b as DAILY_REPORT_ACTION_INTENTS, A as DailyReportActionCommand, c as DailyReportActionFailure, D as DailyReportActionIntent, d as DailyReportActionResult, e as DailyReportActionResultOf, f as DailyReportActionResultReading, U as DailyReportUIComment, g as encodeDailyReportActionCommand, m as mergeComments, p as parseDailyReportActionResult } from "./comment-adapter-CNti3-Dv.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 DailyReportAttachmentState, j as DailyReportAttachmentSummary, e as DailyReportDetail, k as DailyReportExternalComment, l as DailyReportIdsStreamChunkLine, m as DailyReportIdsStreamCursor, n as DailyReportIdsStreamRowColumns, o as DailyReportInterviewer, D as DailyReportItem, p as DailyReportLabelDef, q as DailyReportPostedComment, d as DailyReportSseMessage, a as DailyReportSseStreamAnchor, c as DailyReportSseTerminalEvent, b as DailyReportUser, r as commentAddMessageSchema, s as commentDeleteMessageSchema, t as connectedMessageSchema, u as dailyReportDetailSchema, v as dailyReportExternalCommentSchema, w as dailyReportInterviewerSchema, x as dailyReportLabelDefSchema, y as dailyReportPostedCommentSchema, z as dailyReportSseMessageSchema, A as forEachIdsStreamRow, B as isDailyReportSseStreamId, C as isIdsStreamChunkLine, E as reportCreateMessageSchema, F as reportDeleteMessageSchema, G as reportPublishMessageSchema, H as reportUpdateMessageSchema, I as statusUpdateMessageSchema } from "./sse-schema-S7gXWA2N.js";
3
+ export { D as DAILY_REPORT_SEARCH_BATCHES_IN_FLIGHT, a as DAILY_REPORT_SEARCH_COMBINES, b as DailyReportLogger, c as DailyReportSearchCombine, d as DailyReportSearchFieldMarks, e as DailyReportSearchHit, f as DailyReportSearchMarksAnswer, g as DailyReportSearchReportMarks } from "./search-marks-wire-DLgJTytk.js";
4
4
  import "zod";
5
5
  declare const DAILY_REPORT_API_ENDPOINTS: Readonly<{
6
6
  readonly businessDate: "business-date";
7
- readonly idsStream: "ids-stream";
7
+ readonly idsStream: "ids-columns";
8
8
  readonly report: "report";
9
9
  readonly search: "search";
10
10
  readonly reports: "reports";
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 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:()=>c,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:()=>m,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 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})$/;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()}),m=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(m),attachments:t.z.array(de).default([])}),u=t.z.string().regex(c),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:m,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(c),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:m}),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,ce=()=>(w===null&&(w=ue()),w),v=(e,r)=>{let n=ce()[e].safeParse(r);return n.success?{result:n.data}:{mismatch:j(n.error)}};var z="ids-stream",me=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=>me(e)==="chunk";var F=Object.freeze({businessDate:"business-date",idsStream:z,report:"report",search:"search",reports:"reports",searchMarks:"search-marks",searchFacets:"search-facets",action:"action"}),V=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 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});
1
+ "use strict";var _=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var Ie=Object.prototype.hasOwnProperty;var fe=(e,t)=>{for(var n in t)_(e,n,{get:t[n],enumerable:!0})},De=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of be(t))!Ie.call(e,i)&&i!==n&&_(e,i,{get:()=>t[i],enumerable:!(o=ge(t,i))||o.enumerable});return e};var Se=e=>De(_({},"__esModule",{value:!0}),e);var Be={};fe(Be,{DAILY_REPORT_ACTION_FIELDS:()=>d,DAILY_REPORT_ACTION_INTENTS:()=>G,DAILY_REPORT_API_ENDPOINTS:()=>se,DAILY_REPORT_API_QUERY_PARAMS:()=>ie,DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS:()=>B,DAILY_REPORT_CLIENT_TEMP_ID_PATTERN:()=>b,DAILY_REPORT_SEARCH_BATCHES_IN_FLIGHT:()=>he,DAILY_REPORT_SEARCH_COMBINES:()=>Re,DAILY_REPORT_SSE_CURSOR_PARAM:()=>K,DAILY_REPORT_SSE_HEARTBEAT_MS:()=>F,DAILY_REPORT_SSE_TERMINAL_EVENTS:()=>W,buildDailyReportAttachmentUrl:()=>de,commentAddMessageSchema:()=>L,commentDeleteMessageSchema:()=>O,connectedMessageSchema:()=>N,dailyReportDetailSchema:()=>R,dailyReportExternalCommentSchema:()=>E,dailyReportInterviewerSchema:()=>C,dailyReportLabelDefSchema:()=>w,dailyReportPostedCommentSchema:()=>I,dailyReportSseMessageSchema:()=>Q,encodeDailyReportActionCommand:()=>X,forEachIdsStreamRow:()=>ae,isDailyReportAttachmentThumbnailVariant:()=>x,isDailyReportSseStreamId:()=>V,isIdsStreamChunkLine:()=>oe,mergeComments:()=>ye,normalizeBusinessDateKey:()=>re,parseDailyReportActionResult:()=>Z,parseDailyReportAttachmentQuery:()=>ce,reportCreateMessageSchema:()=>M,reportDeleteMessageSchema:()=>j,reportPublishMessageSchema:()=>Y,reportUpdateMessageSchema:()=>H,statusUpdateMessageSchema:()=>P});module.exports=Se(Be);var a=require("zod");var b=/^(?:[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 v=require("zod"),z=e=>Number.isSafeInteger(e)&&e>0,l=v.z.number().int().positive().max(Number.MAX_SAFE_INTEGER);var r=require("zod");var W=["auth-required","forbidden","resync-required"],F=15e3,K="lastEventId",Ae=/^\d{1,15}-\d{1,15}$/,V=e=>Ae.test(e),C=r.z.object({name:r.z.string().nullish(),affiliation:r.z.string().nullish()}),E=r.z.object({name:r.z.string().nullish(),text:r.z.string().nullish(),color:r.z.string().nullish()}),w=r.z.object({id:l,name:r.z.string().nullish(),color:r.z.string().nullish()}),I=r.z.object({id:l,userId:r.z.string().nullish(),userName:r.z.string().nullish(),content:r.z.string().nullish(),createdAt:r.z.string().nullish(),isMine:r.z.boolean()}),Te=r.z.object({id:r.z.string(),fileName:r.z.string(),fileType:r.z.string().nullable(),fileSize:r.z.number().nullable(),createdAt:r.z.string().nullable(),state:r.z.enum(["present","absent","unknown"]),hasThumbnail:r.z.boolean().default(!1)}),R=r.z.object({reportHubId:l,date:r.z.string().nullish(),createdAt:r.z.string().nullish(),author:r.z.string().nullish(),userId:r.z.string().nullish(),sourceType:r.z.string().nullish(),employeeName:r.z.string().nullish(),updatedBy:r.z.string().nullish(),updatedAt:r.z.string().nullish(),category:r.z.string().nullish(),creationCategory:r.z.string().nullish(),visitTimeFrom:r.z.string().nullish(),visitTimeTo:r.z.string().nullish(),customerName:r.z.string().nullish(),interviewers:r.z.array(C),subject:r.z.string().nullish(),content:r.z.string().nullish(),externalComments:r.z.array(E),isRead:r.z.boolean(),isStarred:r.z.boolean(),isDraft:r.z.boolean(),labels:r.z.array(w),postedComments:r.z.array(I),attachments:r.z.array(Te).default([])}),h=r.z.string().regex(b),N=r.z.object({type:r.z.literal("connected")}),P=r.z.object({type:r.z.literal("status-update"),reportHubId:l,statusType:r.z.enum(["star","read"]),value:r.z.boolean(),clientTempId:h,recipientRawUserId:l.optional()}),k=r.z.string().optional(),L=r.z.object({type:r.z.literal("comment-add"),reportHubId:l,comment:I,clientTempId:h,recipientRawUserId:l.optional(),sourceType:k}),O=r.z.object({type:r.z.literal("comment-delete"),reportHubId:l,commentId:l,clientTempId:h,recipientRawUserId:l.optional(),sourceType:k}),M=r.z.object({type:r.z.literal("report-create"),reportHubId:l,report:R,clientTempId:h,recipientRawUserId:l.optional()}),H=r.z.object({type:r.z.literal("report-update"),reportHubId:l,report:R,clientTempId:h,recipientRawUserId:l.optional()}),Y=r.z.object({type:r.z.literal("report-publish"),reportHubId:l,report:R,clientTempId:h,recipientRawUserId:l.optional()}),j=r.z.object({type:r.z.literal("report-delete"),reportHubId:l,clientTempId:h,sourceType:k}),Q=r.z.discriminatedUnion("type",[N,P,L,O,M,H,Y,j]);var q=e=>e.issues.map(t=>`${t.path.length===0?"(root)":t.path.join(".")}: ${t.code}`).join("; ");var G=Object.freeze(["create","update","publish","delete","toggleStar","toggleRead","addComment","deleteComment","clearCache"]);var d=Object.freeze({intent:"intent",clientTempId:"clientTempId",businessDate:"businessDate",operationTimestamp:"operationTimestamp",reportHubId:"reportHubId",title:"title",content:"content",isStarred:"isStarred",isRead:"isRead",commentId:"commentId"}),X=e=>{let t=new FormData;if(t.append(d.intent,e.intent),e.intent==="clearCache"||(t.append(d.clientTempId,e.clientTempId),e.businessDate!==null&&t.append(d.businessDate,e.businessDate),e.operationTimestamp!==null&&t.append(d.operationTimestamp,String(e.operationTimestamp)),e.intent==="create"))return t;switch(t.append(d.reportHubId,String(e.reportHubId)),e.intent){case"update":return e.changes.title!==void 0&&t.append(d.title,e.changes.title),e.changes.content!==void 0&&t.append(d.content,e.changes.content),t;case"publish":case"delete":return t;case"toggleStar":return t.append(d.isStarred,String(e.value)),t;case"toggleRead":return t.append(d.isRead,String(e.value)),t;case"addComment":return t.append(d.content,e.content),t;case"deleteComment":return t.append(d.commentId,String(e.commentId)),t}},xe=()=>{let e=l,t=a.z.string().regex(b),n=a.z.literal("OK"),o=a.z.object({isStarred:a.z.boolean(),isRead:a.z.boolean()}),i=a.z.number().int().nonnegative().nullable();return{create:a.z.object({status:n,intent:a.z.literal("create"),reportHubId:e,clientTempId:t,report:R}),update:a.z.object({status:n,intent:a.z.literal("update"),reportHubId:e,clientTempId:t}),publish:a.z.object({status:n,intent:a.z.literal("publish"),reportHubId:e,clientTempId:t,report:R.nullable()}),delete:a.z.object({status:n,intent:a.z.literal("delete"),reportHubId:e,clientTempId:t}),toggleStar:a.z.object({status:n,intent:a.z.literal("toggleStar"),reportHubId:e,clientTempId:t,updatedStatus:o,operationTimestamp:i}),toggleRead:a.z.object({status:n,intent:a.z.literal("toggleRead"),reportHubId:e,clientTempId:t,updatedStatus:o,operationTimestamp:i}),addComment:a.z.object({status:n,intent:a.z.literal("addComment"),reportHubId:e,clientTempId:t,newComment:I}),deleteComment:a.z.object({status:n,intent:a.z.literal("deleteComment"),reportHubId:e,clientTempId:t,deletedCommentId:l}),clearCache:a.z.object({status:n,intent:a.z.literal("clearCache")})}},U=null,_e=()=>(U===null&&(U=xe()),U),Z=(e,t)=>{let n=_e()[e].safeParse(t);return n.success?{result:n.data}:{mismatch:q(n.error)}};var Ce=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var J=e=>e<10?`0${e}`:`${e}`,Ee=e=>{if(Number.isNaN(e.getTime()))return null;let t=e.getFullYear(),n=J(e.getMonth()+1),o=J(e.getDate());return`${t}-${n}-${o}`},ee=e=>{let t=Ce.exec(e);if(t===null)return null;let[,n,,o,i]=t,p=Number(n),s=Number(o),u=Number(i);if(p<1)return null;let c=new Date(0);return c.setUTCFullYear(p,s-1,u),c.getUTCFullYear()!==p||c.getUTCMonth()!==s-1||c.getUTCDate()!==u?null:`${n}-${o}-${i}`},te=e=>ee(e)===e;var re=e=>e==null?null:e instanceof Date?Ee(e):ee(e);var ne="ids-columns",we=e=>{if(typeof e!="object"||e===null)return"unknown";let{kind:t}=e;return t==="chunk"?"chunk":t==="error"?"error":"unknown"},Ne=e=>typeof e=="number"&&z(e),Pe=e=>{if(typeof e!="object"||e===null)return!1;let{businessDate:t,reportHubId:n}=e;return(t===null||typeof t=="string")&&typeof n=="number"},ke=4,Le=e=>{let t=ke;for(;2**t<e*2;)t+=1;let n=new Float64Array(2**t),o=n.length-1,i=32-t;return p=>{let s=Math.imul(p|0,2654435761)>>>i;for(;;){let u=n[s];if(u===0)return n[s]=p,!0;if(u===p)return!1;s=s+1&o}}},oe=e=>{if(we(e)!=="chunk")return!1;let{ids:t,dates:n,counts:o,sourceTypes:i,sources:p,isLast:s,nextCursor:u}=e;if(typeof s!="boolean"||!(u===null||Pe(u))||!(Array.isArray(t)&&Array.isArray(n)&&Array.isArray(o)&&Array.isArray(i)&&Array.isArray(p))||n.length!==o.length||p.length!==t.length)return!1;for(let y of i)if(!(y===null||typeof y=="string"))return!1;let c=Le(t.length),m=0,D=null,f=0;for(let y=0;y<n.length;y++){let g=n[y],S=o[y];if(!(g===null||typeof g=="string"&&te(g))||y>0&&g===n[y-1]||typeof S!="number"||!Number.isSafeInteger(S)||S<1)return!1;let $=m+S;if($>t.length)return!1;for(;m<$;m++){let A=t[m],T=p[m];if(!(Ne(A)&&c(A))||typeof T!="number"||!Number.isSafeInteger(T)||T<0||T>=i.length||m>0&&!Me(D,f,g,A))return!1;D=g,f=A}}return m===t.length},ae=(e,t)=>{let{ids:n,dates:o,counts:i,sourceTypes:p,sources:s}=e,u=0;for(let c=0;c<o.length;c++){let m=o[c];for(let D=u+i[c];u<D;u++){let f=p[s[u]];t(n[u],m,f===null?void 0:f)}}};var Oe=(e,t,n,o)=>e!==n?e===null?1:n===null||e>n?-1:1:o-t,Me=(e,t,n,o)=>Oe(e,t,n,o)<0;var se=Object.freeze({businessDate:"business-date",idsStream:ne,report:"report",search:"search",reports:"reports",searchMarks:"search-marks",searchFacets:"search-facets",action:"action"}),ie=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 B=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),x=e=>Object.hasOwn(B,e);var le="download",ue="thumbnail",pe="1",de=(e,t,n)=>{let o=`${e}/attachment/${encodeURIComponent(t)}`;switch(n.kind){case"inline":return o;case"download":return`${o}?${new URLSearchParams({[le]:pe})}`;case"thumbnail":return`${o}?${new URLSearchParams({[ue]:n.variant})}`}},ce=e=>{let t=e.getAll(ue),n=e.getAll(le);if(t.length>0&&n.length>0)return{kind:"invalid",reason:"conflict"};if(t.length>0){let[o]=t;return t.length===1&&x(o)?{kind:"thumbnail",variant:o}:{kind:"invalid",reason:"thumbnail_variant"}}return n.length>0?n.length===1&&n[0]===pe?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var He=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,me=(e,t,n)=>new RangeError(`[daily-report] ${e} must be ${t}; got ${He(n)}`);var Ye="legacy-",je=e=>`${Ye}${e}`,ye=(e,t,n,o)=>{if(typeof o!="string"||o.trim()==="")throw me("mergeComments: unknownAuthorName","a non-blank string",o);let i=e.map((s,u)=>({id:je(u),authorName:s.name||o,content:s.text||"",isMine:!1,color:s.color||void 0,isLegacy:!0,isAuthorUnknown:!s.name})),p=t.map(s=>({id:s.id,authorName:s.userName||o,content:s.content??"",createdAt:s.createdAt??"",isMine:n?s.userId===n:s.isMine,isLegacy:!1,isAuthorUnknown:!s.userName}));return[...i,...p]};var Re=["intersection","union"];var dt=Object.freeze({maxQueryLength:500,maxSets:16,maxWordsPerSet:16,maxWords:32,maxWordLength:100,maxDetailIds:100}),Ue=2,he=2,ct=Object.freeze({word:0,reading:1});var mt=2*(1+Ue);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_BATCHES_IN_FLIGHT,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,forEachIdsStreamRow,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 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})$/;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(m),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(m),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",searchFacets:"search-facets",action:"action"}),te=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 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,c=Number(n),s=Number(i),R=Number(p);if(c<1)return null;let h=new Date(0);return h.setUTCFullYear(c,s-1,R),h.getUTCFullYear()!==c||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})),c=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,...c]};var ce=["intersection","union"];var Ye=Object.freeze({maxQueryLength:500,maxSets:16,maxWordsPerSet:16,maxWords:32,maxWordLength:100,maxDetailIds:100}),me=2;var je=Object.freeze({word:0,reading:1});var Be=2*(1+me);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,m as DAILY_REPORT_CLIENT_TEMP_ID_PATTERN,ce 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};
1
+ import{z as s}from"zod";var I=/^(?:[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 X}from"zod";var w=e=>Number.isSafeInteger(e)&&e>0,i=X.number().int().positive().max(Number.MAX_SAFE_INTEGER);import{z as r}from"zod";var Z=["auth-required","forbidden","resync-required"],J=15e3,ee="lastEventId",te=/^\d{1,15}-\d{1,15}$/,re=e=>te.test(e),N=r.object({name:r.string().nullish(),affiliation:r.string().nullish()}),P=r.object({name:r.string().nullish(),text:r.string().nullish(),color:r.string().nullish()}),k=r.object({id:i,name:r.string().nullish(),color:r.string().nullish()}),f=r.object({id:i,userId:r.string().nullish(),userName:r.string().nullish(),content:r.string().nullish(),createdAt:r.string().nullish(),isMine:r.boolean()}),ne=r.object({id:r.string(),fileName:r.string(),fileType:r.string().nullable(),fileSize:r.number().nullable(),createdAt:r.string().nullable(),state:r.enum(["present","absent","unknown"]),hasThumbnail:r.boolean().default(!1)}),R=r.object({reportHubId:i,date:r.string().nullish(),createdAt:r.string().nullish(),author:r.string().nullish(),userId:r.string().nullish(),sourceType:r.string().nullish(),employeeName:r.string().nullish(),updatedBy:r.string().nullish(),updatedAt:r.string().nullish(),category:r.string().nullish(),creationCategory:r.string().nullish(),visitTimeFrom:r.string().nullish(),visitTimeTo:r.string().nullish(),customerName:r.string().nullish(),interviewers:r.array(N),subject:r.string().nullish(),content:r.string().nullish(),externalComments:r.array(P),isRead:r.boolean(),isStarred:r.boolean(),isDraft:r.boolean(),labels:r.array(k),postedComments:r.array(f),attachments:r.array(ne).default([])}),h=r.string().regex(I),L=r.object({type:r.literal("connected")}),O=r.object({type:r.literal("status-update"),reportHubId:i,statusType:r.enum(["star","read"]),value:r.boolean(),clientTempId:h,recipientRawUserId:i.optional()}),x=r.string().optional(),M=r.object({type:r.literal("comment-add"),reportHubId:i,comment:f,clientTempId:h,recipientRawUserId:i.optional(),sourceType:x}),H=r.object({type:r.literal("comment-delete"),reportHubId:i,commentId:i,clientTempId:h,recipientRawUserId:i.optional(),sourceType:x}),Y=r.object({type:r.literal("report-create"),reportHubId:i,report:R,clientTempId:h,recipientRawUserId:i.optional()}),j=r.object({type:r.literal("report-update"),reportHubId:i,report:R,clientTempId:h,recipientRawUserId:i.optional()}),U=r.object({type:r.literal("report-publish"),reportHubId:i,report:R,clientTempId:h,recipientRawUserId:i.optional()}),B=r.object({type:r.literal("report-delete"),reportHubId:i,clientTempId:h,sourceType:x}),oe=r.discriminatedUnion("type",[L,O,M,H,Y,j,U,B]);var $=e=>e.issues.map(t=>`${t.path.length===0?"(root)":t.path.join(".")}: ${t.code}`).join("; ");var ae=Object.freeze(["create","update","publish","delete","toggleStar","toggleRead","addComment","deleteComment","clearCache"]);var d=Object.freeze({intent:"intent",clientTempId:"clientTempId",businessDate:"businessDate",operationTimestamp:"operationTimestamp",reportHubId:"reportHubId",title:"title",content:"content",isStarred:"isStarred",isRead:"isRead",commentId:"commentId"}),se=e=>{let t=new FormData;if(t.append(d.intent,e.intent),e.intent==="clearCache"||(t.append(d.clientTempId,e.clientTempId),e.businessDate!==null&&t.append(d.businessDate,e.businessDate),e.operationTimestamp!==null&&t.append(d.operationTimestamp,String(e.operationTimestamp)),e.intent==="create"))return t;switch(t.append(d.reportHubId,String(e.reportHubId)),e.intent){case"update":return e.changes.title!==void 0&&t.append(d.title,e.changes.title),e.changes.content!==void 0&&t.append(d.content,e.changes.content),t;case"publish":case"delete":return t;case"toggleStar":return t.append(d.isStarred,String(e.value)),t;case"toggleRead":return t.append(d.isRead,String(e.value)),t;case"addComment":return t.append(d.content,e.content),t;case"deleteComment":return t.append(d.commentId,String(e.commentId)),t}},ie=()=>{let e=i,t=s.string().regex(I),n=s.literal("OK"),o=s.object({isStarred:s.boolean(),isRead:s.boolean()}),u=s.number().int().nonnegative().nullable();return{create:s.object({status:n,intent:s.literal("create"),reportHubId:e,clientTempId:t,report:R}),update:s.object({status:n,intent:s.literal("update"),reportHubId:e,clientTempId:t}),publish:s.object({status:n,intent:s.literal("publish"),reportHubId:e,clientTempId:t,report:R.nullable()}),delete:s.object({status:n,intent:s.literal("delete"),reportHubId:e,clientTempId:t}),toggleStar:s.object({status:n,intent:s.literal("toggleStar"),reportHubId:e,clientTempId:t,updatedStatus:o,operationTimestamp:u}),toggleRead:s.object({status:n,intent:s.literal("toggleRead"),reportHubId:e,clientTempId:t,updatedStatus:o,operationTimestamp:u}),addComment:s.object({status:n,intent:s.literal("addComment"),reportHubId:e,clientTempId:t,newComment:f}),deleteComment:s.object({status:n,intent:s.literal("deleteComment"),reportHubId:e,clientTempId:t,deletedCommentId:i}),clearCache:s.object({status:n,intent:s.literal("clearCache")})}},_=null,le=()=>(_===null&&(_=ie()),_),ue=(e,t)=>{let n=le()[e].safeParse(t);return n.success?{result:n.data}:{mismatch:$(n.error)}};var pe=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var v=e=>e<10?`0${e}`:`${e}`,de=e=>{if(Number.isNaN(e.getTime()))return null;let t=e.getFullYear(),n=v(e.getMonth()+1),o=v(e.getDate());return`${t}-${n}-${o}`},z=e=>{let t=pe.exec(e);if(t===null)return null;let[,n,,o,u]=t,p=Number(n),a=Number(o),l=Number(u);if(p<1)return null;let c=new Date(0);return c.setUTCFullYear(p,a-1,l),c.getUTCFullYear()!==p||c.getUTCMonth()!==a-1||c.getUTCDate()!==l?null:`${n}-${o}-${u}`},W=e=>z(e)===e;var ce=e=>e==null?null:e instanceof Date?de(e):z(e);var F="ids-columns",me=e=>{if(typeof e!="object"||e===null)return"unknown";let{kind:t}=e;return t==="chunk"?"chunk":t==="error"?"error":"unknown"},ye=e=>typeof e=="number"&&w(e),Re=e=>{if(typeof e!="object"||e===null)return!1;let{businessDate:t,reportHubId:n}=e;return(t===null||typeof t=="string")&&typeof n=="number"},he=4,ge=e=>{let t=he;for(;2**t<e*2;)t+=1;let n=new Float64Array(2**t),o=n.length-1,u=32-t;return p=>{let a=Math.imul(p|0,2654435761)>>>u;for(;;){let l=n[a];if(l===0)return n[a]=p,!0;if(l===p)return!1;a=a+1&o}}},be=e=>{if(me(e)!=="chunk")return!1;let{ids:t,dates:n,counts:o,sourceTypes:u,sources:p,isLast:a,nextCursor:l}=e;if(typeof a!="boolean"||!(l===null||Re(l))||!(Array.isArray(t)&&Array.isArray(n)&&Array.isArray(o)&&Array.isArray(u)&&Array.isArray(p))||n.length!==o.length||p.length!==t.length)return!1;for(let y of u)if(!(y===null||typeof y=="string"))return!1;let c=ge(t.length),m=0,D=null,b=0;for(let y=0;y<n.length;y++){let g=n[y],S=o[y];if(!(g===null||typeof g=="string"&&W(g))||y>0&&g===n[y-1]||typeof S!="number"||!Number.isSafeInteger(S)||S<1)return!1;let E=m+S;if(E>t.length)return!1;for(;m<E;m++){let A=t[m],T=p[m];if(!(ye(A)&&c(A))||typeof T!="number"||!Number.isSafeInteger(T)||T<0||T>=u.length||m>0&&!De(D,b,g,A))return!1;D=g,b=A}}return m===t.length},Ie=(e,t)=>{let{ids:n,dates:o,counts:u,sourceTypes:p,sources:a}=e,l=0;for(let c=0;c<o.length;c++){let m=o[c];for(let D=l+u[c];l<D;l++){let b=p[a[l]];t(n[l],m,b===null?void 0:b)}}};var fe=(e,t,n,o)=>e!==n?e===null?1:n===null||e>n?-1:1:o-t,De=(e,t,n,o)=>fe(e,t,n,o)<0;var Se=Object.freeze({businessDate:"business-date",idsStream:F,report:"report",search:"search",reports:"reports",searchMarks:"search-marks",searchFacets:"search-facets",action:"action"}),Ae=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 K=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),C=e=>Object.hasOwn(K,e);var V="download",Q="thumbnail",q="1",Te=(e,t,n)=>{let o=`${e}/attachment/${encodeURIComponent(t)}`;switch(n.kind){case"inline":return o;case"download":return`${o}?${new URLSearchParams({[V]:q})}`;case"thumbnail":return`${o}?${new URLSearchParams({[Q]:n.variant})}`}},xe=e=>{let t=e.getAll(Q),n=e.getAll(V);if(t.length>0&&n.length>0)return{kind:"invalid",reason:"conflict"};if(t.length>0){let[o]=t;return t.length===1&&C(o)?{kind:"thumbnail",variant:o}:{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 _e=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,G=(e,t,n)=>new RangeError(`[daily-report] ${e} must be ${t}; got ${_e(n)}`);var Ce="legacy-",Ee=e=>`${Ce}${e}`,we=(e,t,n,o)=>{if(typeof o!="string"||o.trim()==="")throw G("mergeComments: unknownAuthorName","a non-blank string",o);let u=e.map((a,l)=>({id:Ee(l),authorName:a.name||o,content:a.text||"",isMine:!1,color:a.color||void 0,isLegacy:!0,isAuthorUnknown:!a.name})),p=t.map(a=>({id:a.id,authorName:a.userName||o,content:a.content??"",createdAt:a.createdAt??"",isMine:n?a.userId===n:a.isMine,isLegacy:!1,isAuthorUnknown:!a.userName}));return[...u,...p]};var Ne=["intersection","union"];var at=Object.freeze({maxQueryLength:500,maxSets:16,maxWordsPerSet:16,maxWords:32,maxWordLength:100,maxDetailIds:100}),Pe=2,ke=2,st=Object.freeze({word:0,reading:1});var it=2*(1+Pe);export{d as DAILY_REPORT_ACTION_FIELDS,ae as DAILY_REPORT_ACTION_INTENTS,Se as DAILY_REPORT_API_ENDPOINTS,Ae as DAILY_REPORT_API_QUERY_PARAMS,K as DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,I as DAILY_REPORT_CLIENT_TEMP_ID_PATTERN,ke as DAILY_REPORT_SEARCH_BATCHES_IN_FLIGHT,Ne as DAILY_REPORT_SEARCH_COMBINES,ee as DAILY_REPORT_SSE_CURSOR_PARAM,J as DAILY_REPORT_SSE_HEARTBEAT_MS,Z as DAILY_REPORT_SSE_TERMINAL_EVENTS,Te as buildDailyReportAttachmentUrl,M as commentAddMessageSchema,H as commentDeleteMessageSchema,L as connectedMessageSchema,R as dailyReportDetailSchema,P as dailyReportExternalCommentSchema,N as dailyReportInterviewerSchema,k as dailyReportLabelDefSchema,f as dailyReportPostedCommentSchema,oe as dailyReportSseMessageSchema,se as encodeDailyReportActionCommand,Ie as forEachIdsStreamRow,C as isDailyReportAttachmentThumbnailVariant,re as isDailyReportSseStreamId,be as isIdsStreamChunkLine,we as mergeComments,ce as normalizeBusinessDateKey,ue as parseDailyReportActionResult,xe as parseDailyReportAttachmentQuery,Y as reportCreateMessageSchema,B as reportDeleteMessageSchema,U as reportPublishMessageSchema,j as reportUpdateMessageSchema,O as statusUpdateMessageSchema};
@@ -3,6 +3,7 @@ declare const DAILY_REPORT_SEARCH_COMBINES: readonly [
3
3
  "union"
4
4
  ];
5
5
  type DailyReportSearchCombine = (typeof DAILY_REPORT_SEARCH_COMBINES)[number];
6
+ declare const DAILY_REPORT_SEARCH_BATCHES_IN_FLIGHT = 2;
6
7
  type DailyReportSearchAlternativeTier = 0 | 1;
7
8
  type DailyReportSearchAlternative = {
8
9
  readonly text: string;
@@ -22,6 +23,9 @@ interface DailyReportLogger {
22
23
  type DailyReportSearchFieldMarks = {
23
24
  readonly fingerprint: number;
24
25
  readonly ranges: readonly number[];
26
+ } | {
27
+ readonly fingerprint: number;
28
+ readonly dense: true;
25
29
  };
26
30
  type DailyReportSearchReportMarks = {
27
31
  readonly reportHubId: number;
@@ -31,5 +35,6 @@ type DailyReportSearchReportMarks = {
31
35
  type DailyReportSearchMarksAnswer = {
32
36
  readonly wordsDigest: number;
33
37
  readonly reports: readonly DailyReportSearchReportMarks[];
38
+ readonly deferred: readonly number[];
34
39
  };
35
- export { DAILY_REPORT_SEARCH_COMBINES as D, type DailyReportLogger as a, type DailyReportSearchCombine as b, type DailyReportSearchFieldMarks as c, type DailyReportSearchHit as d, type DailyReportSearchMarksAnswer as e, type DailyReportSearchReportMarks as f, type DailyReportSearchAlternative as g, type DailyReportSearchAlternativeTier as h };
40
+ export { DAILY_REPORT_SEARCH_BATCHES_IN_FLIGHT as D, DAILY_REPORT_SEARCH_COMBINES as a, type DailyReportLogger as b, type DailyReportSearchCombine as c, type DailyReportSearchFieldMarks as d, type DailyReportSearchHit as e, type DailyReportSearchMarksAnswer as f, type DailyReportSearchReportMarks as g, type DailyReportSearchAlternative as h, type DailyReportSearchAlternativeTier as i };
@@ -3,6 +3,7 @@ declare const DAILY_REPORT_SEARCH_COMBINES: readonly [
3
3
  "union"
4
4
  ];
5
5
  type DailyReportSearchCombine = (typeof DAILY_REPORT_SEARCH_COMBINES)[number];
6
+ declare const DAILY_REPORT_SEARCH_BATCHES_IN_FLIGHT = 2;
6
7
  type DailyReportSearchAlternativeTier = 0 | 1;
7
8
  type DailyReportSearchAlternative = {
8
9
  readonly text: string;
@@ -22,6 +23,9 @@ interface DailyReportLogger {
22
23
  type DailyReportSearchFieldMarks = {
23
24
  readonly fingerprint: number;
24
25
  readonly ranges: readonly number[];
26
+ } | {
27
+ readonly fingerprint: number;
28
+ readonly dense: true;
25
29
  };
26
30
  type DailyReportSearchReportMarks = {
27
31
  readonly reportHubId: number;
@@ -31,5 +35,6 @@ type DailyReportSearchReportMarks = {
31
35
  type DailyReportSearchMarksAnswer = {
32
36
  readonly wordsDigest: number;
33
37
  readonly reports: readonly DailyReportSearchReportMarks[];
38
+ readonly deferred: readonly number[];
34
39
  };
35
- export { DAILY_REPORT_SEARCH_COMBINES as D, type DailyReportLogger as a, type DailyReportSearchCombine as b, type DailyReportSearchFieldMarks as c, type DailyReportSearchHit as d, type DailyReportSearchMarksAnswer as e, type DailyReportSearchReportMarks as f, type DailyReportSearchAlternative as g, type DailyReportSearchAlternativeTier as h };
40
+ export { DAILY_REPORT_SEARCH_BATCHES_IN_FLIGHT as D, DAILY_REPORT_SEARCH_COMBINES as a, type DailyReportLogger as b, type DailyReportSearchCombine as c, type DailyReportSearchFieldMarks as d, type DailyReportSearchHit as e, type DailyReportSearchMarksAnswer as f, type DailyReportSearchReportMarks as g, type DailyReportSearchAlternative as h, type DailyReportSearchAlternativeTier as i };
package/dist/server.d.mts CHANGED
@@ -1,8 +1,9 @@
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-byewDmZK.mjs";
1
+ import { d as DailyReportSseMessage, o as DailyReportInterviewer, k as DailyReportExternalComment, D as DailyReportItem, e as DailyReportDetail, j as DailyReportAttachmentSummary, q as DailyReportPostedComment } from "./sse-schema-S7gXWA2N.mjs";
2
+ export { J as encodeIdsStreamRows } from "./sse-schema-S7gXWA2N.mjs";
2
3
  import * as drizzle_orm_mssql_core from "drizzle-orm/mssql-core";
3
4
  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-CZRU4q3h.mjs";
5
- export { h as DailyReportSearchAlternativeTier } from "./search-marks-wire-CZRU4q3h.mjs";
5
+ import { b as DailyReportLogger, c as DailyReportSearchCombine, h as DailyReportSearchAlternative, e as DailyReportSearchHit, f as DailyReportSearchMarksAnswer } from "./search-marks-wire-DLgJTytk.mjs";
6
+ export { i as DailyReportSearchAlternativeTier } from "./search-marks-wire-DLgJTytk.mjs";
6
7
  import { TransactionRetryOptions } from "@aiquants/mssql";
7
8
  import { b as DailyReportSearchFacets } from "./search-filters-wire-5MWi6GWu.mjs";
8
9
  import { SQL } from "drizzle-orm";
@@ -154,15 +155,19 @@ type EpochStore = ReturnType<typeof createEpochStore>;
154
155
  declare class SqlResultCache {
155
156
  private readonly epochStore;
156
157
  private readonly buckets;
158
+ private totalBytes;
157
159
  private readonly inFlight;
158
160
  private readonly forcedFetches;
159
161
  private readonly defaultTtlMs;
160
162
  private readonly maxBuckets;
163
+ private readonly maxBytes;
161
164
  private lastSweepAt;
162
165
  constructor(config: {
163
166
  readonly defaultTtlMs: number;
164
167
  readonly maxBuckets: number;
168
+ readonly maxBytes: number;
165
169
  }, epochStore: EpochStore);
170
+ private dropBucket;
166
171
  private writeBucket;
167
172
  private maybeRefreshAhead;
168
173
  private startFetch;
@@ -1864,8 +1869,10 @@ type DailyReportServiceConfig = {
1864
1869
  cache: SqlResultCache;
1865
1870
  epochs: EpochStore;
1866
1871
  transactionRetry?: TransactionRetryOptions;
1867
- draftLabelName?: string;
1868
- draftLabelNames?: string[];
1872
+ draftLabelNames: readonly [
1873
+ string,
1874
+ ...string[]
1875
+ ];
1869
1876
  streamKey?: string;
1870
1877
  streamMaxLen?: number;
1871
1878
  idsTtlMs?: number;
@@ -2109,6 +2116,7 @@ type DailyReportServerConfig = Omit<DailyReportServiceConfig, "cache" | "epochs"
2109
2116
  enableDevCacheClear?: boolean;
2110
2117
  cacheDefaultTtlMs?: number;
2111
2118
  cacheMaxBuckets?: number;
2119
+ cacheMaxBytes?: number;
2112
2120
  externalSources?: DailyReportExternalSource[];
2113
2121
  };
2114
2122
  type DailyReportServer = DailyReportHandlers & {
package/dist/server.d.ts CHANGED
@@ -1,8 +1,9 @@
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-byewDmZK.js";
1
+ import { d as DailyReportSseMessage, o as DailyReportInterviewer, k as DailyReportExternalComment, D as DailyReportItem, e as DailyReportDetail, j as DailyReportAttachmentSummary, q as DailyReportPostedComment } from "./sse-schema-S7gXWA2N.js";
2
+ export { J as encodeIdsStreamRows } from "./sse-schema-S7gXWA2N.js";
2
3
  import * as drizzle_orm_mssql_core from "drizzle-orm/mssql-core";
3
4
  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-CZRU4q3h.js";
5
- export { h as DailyReportSearchAlternativeTier } from "./search-marks-wire-CZRU4q3h.js";
5
+ import { b as DailyReportLogger, c as DailyReportSearchCombine, h as DailyReportSearchAlternative, e as DailyReportSearchHit, f as DailyReportSearchMarksAnswer } from "./search-marks-wire-DLgJTytk.js";
6
+ export { i as DailyReportSearchAlternativeTier } from "./search-marks-wire-DLgJTytk.js";
6
7
  import { TransactionRetryOptions } from "@aiquants/mssql";
7
8
  import { b as DailyReportSearchFacets } from "./search-filters-wire-5MWi6GWu.js";
8
9
  import { SQL } from "drizzle-orm";
@@ -154,15 +155,19 @@ type EpochStore = ReturnType<typeof createEpochStore>;
154
155
  declare class SqlResultCache {
155
156
  private readonly epochStore;
156
157
  private readonly buckets;
158
+ private totalBytes;
157
159
  private readonly inFlight;
158
160
  private readonly forcedFetches;
159
161
  private readonly defaultTtlMs;
160
162
  private readonly maxBuckets;
163
+ private readonly maxBytes;
161
164
  private lastSweepAt;
162
165
  constructor(config: {
163
166
  readonly defaultTtlMs: number;
164
167
  readonly maxBuckets: number;
168
+ readonly maxBytes: number;
165
169
  }, epochStore: EpochStore);
170
+ private dropBucket;
166
171
  private writeBucket;
167
172
  private maybeRefreshAhead;
168
173
  private startFetch;
@@ -1864,8 +1869,10 @@ type DailyReportServiceConfig = {
1864
1869
  cache: SqlResultCache;
1865
1870
  epochs: EpochStore;
1866
1871
  transactionRetry?: TransactionRetryOptions;
1867
- draftLabelName?: string;
1868
- draftLabelNames?: string[];
1872
+ draftLabelNames: readonly [
1873
+ string,
1874
+ ...string[]
1875
+ ];
1869
1876
  streamKey?: string;
1870
1877
  streamMaxLen?: number;
1871
1878
  idsTtlMs?: number;
@@ -2109,6 +2116,7 @@ type DailyReportServerConfig = Omit<DailyReportServiceConfig, "cache" | "epochs"
2109
2116
  enableDevCacheClear?: boolean;
2110
2117
  cacheDefaultTtlMs?: number;
2111
2118
  cacheMaxBuckets?: number;
2119
+ cacheMaxBytes?: number;
2112
2120
  externalSources?: DailyReportExternalSource[];
2113
2121
  };
2114
2122
  type DailyReportServer = DailyReportHandlers & {