@aiquants/daily-report 0.21.0 → 0.22.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 { e as DailyReportExternalComment, h as DailyReportPostedComment } from "./types-CqgYQgbH.mjs";
1
+ import { e as DailyReportExternalComment, h as DailyReportPostedComment, a as DailyReportItem } from "./types-CqgYQgbH.js";
2
2
  import { z } from "zod";
3
3
  type UIComment = {
4
4
  id: string | number;
@@ -11,6 +11,15 @@ type UIComment = {
11
11
  };
12
12
  declare const mergeComments: (legacyComments: DailyReportExternalComment[], modernComments: DailyReportPostedComment[], currentUserId: string | null | undefined, unknownAuthorName: string) => UIComment[];
13
13
  declare const resolveCommentColorClass: (color: string | null | undefined) => string;
14
+ declare const DAILY_REPORT_SSE_TERMINAL_EVENTS: readonly [
15
+ "auth-required",
16
+ "forbidden",
17
+ "resync-required"
18
+ ];
19
+ type DailyReportSseTerminalEvent = (typeof DAILY_REPORT_SSE_TERMINAL_EVENTS)[number];
20
+ declare const DAILY_REPORT_SSE_HEARTBEAT_MS = 15000;
21
+ declare const DAILY_REPORT_SSE_CURSOR_PARAM = "lastEventId";
22
+ declare const isDailyReportSseStreamId: (value: string) => boolean;
14
23
  declare const dailyReportInterviewerSchema: z.ZodObject<{
15
24
  name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
16
25
  affiliation: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -2462,4 +2471,35 @@ declare const dailyReportSseMessageSchema: z.ZodDiscriminatedUnion<"type", [
2462
2471
  }>
2463
2472
  ]>;
2464
2473
  type DailyReportSseMessage = z.infer<typeof dailyReportSseMessageSchema>;
2465
- export { type DailyReportSseMessage as D, type UIComment as U, commentDeleteMessageSchema as a, connectedMessageSchema as b, commentAddMessageSchema as c, dailyReportAttachmentItemSchema as d, dailyReportDetailSchema as e, dailyReportExternalCommentSchema as f, dailyReportInterviewerSchema as g, dailyReportLabelDefSchema as h, dailyReportPostedCommentSchema as i, dailyReportSseMessageSchema as j, reportDeleteMessageSchema as k, reportPublishMessageSchema as l, mergeComments as m, reportUpdateMessageSchema as n, resolveCommentColorClass as o, reportCreateMessageSchema as r, statusUpdateMessageSchema as s };
2474
+ type DailyReportIdsStreamCursor = {
2475
+ businessDate: string | null;
2476
+ reportHubId: number;
2477
+ };
2478
+ type DailyReportIdsStreamChunkLine = {
2479
+ kind: "chunk";
2480
+ items: DailyReportItem[];
2481
+ nextCursor: DailyReportIdsStreamCursor | null;
2482
+ isLast: boolean;
2483
+ total?: number;
2484
+ provisional?: boolean;
2485
+ snapshot?: string;
2486
+ restarted?: boolean;
2487
+ streamAnchor?: string | null;
2488
+ };
2489
+ type DailyReportSseStreamAnchor = {
2490
+ readonly lastEventId: string | null;
2491
+ readonly revision: number;
2492
+ };
2493
+ type DailyReportIdsStreamErrorLine = {
2494
+ kind: "error";
2495
+ error: string;
2496
+ };
2497
+ type DailyReportIdsStreamLine = DailyReportIdsStreamChunkLine | DailyReportIdsStreamErrorLine;
2498
+ declare const classifyIdsStreamLine: (line: unknown) => "chunk" | "error" | "unknown";
2499
+ declare const isIdsStreamChunkLine: (line: unknown) => line is DailyReportIdsStreamChunkLine;
2500
+ declare const computeIdsStreamSnapshotToken: (items: readonly DailyReportItem[]) => string;
2501
+ declare const compareIdsStreamOrder: (a: DailyReportIdsStreamCursor, b: DailyReportIdsStreamCursor) => number;
2502
+ declare const isIdsStreamOrdered: (items: readonly DailyReportItem[]) => boolean;
2503
+ declare const upsertInIdsStreamOrder: (items: readonly DailyReportItem[], item: DailyReportItem) => DailyReportItem[];
2504
+ declare const findIdsStreamResumeIndex: (items: readonly DailyReportItem[], cursor: DailyReportIdsStreamCursor) => number;
2505
+ export { mergeComments as A, reportCreateMessageSchema as B, reportDeleteMessageSchema as C, type DailyReportSseTerminalEvent as D, reportPublishMessageSchema as E, reportUpdateMessageSchema as F, resolveCommentColorClass as G, statusUpdateMessageSchema as H, upsertInIdsStreamOrder as I, type UIComment as U, type DailyReportSseMessage as a, type DailyReportSseStreamAnchor as b, DAILY_REPORT_SSE_CURSOR_PARAM as c, DAILY_REPORT_SSE_HEARTBEAT_MS as d, DAILY_REPORT_SSE_TERMINAL_EVENTS as e, type DailyReportIdsStreamChunkLine as f, type DailyReportIdsStreamCursor as g, type DailyReportIdsStreamErrorLine as h, type DailyReportIdsStreamLine as i, classifyIdsStreamLine as j, commentAddMessageSchema as k, commentDeleteMessageSchema as l, compareIdsStreamOrder as m, computeIdsStreamSnapshotToken as n, connectedMessageSchema as o, dailyReportAttachmentItemSchema as p, dailyReportDetailSchema as q, dailyReportExternalCommentSchema as r, dailyReportInterviewerSchema as s, dailyReportLabelDefSchema as t, dailyReportPostedCommentSchema as u, dailyReportSseMessageSchema as v, findIdsStreamResumeIndex as w, isDailyReportSseStreamId as x, isIdsStreamChunkLine as y, isIdsStreamOrdered as z };
@@ -1,4 +1,4 @@
1
- import { e as DailyReportExternalComment, h as DailyReportPostedComment } from "./types-CqgYQgbH.js";
1
+ import { e as DailyReportExternalComment, h as DailyReportPostedComment, a as DailyReportItem } from "./types-CqgYQgbH.mjs";
2
2
  import { z } from "zod";
3
3
  type UIComment = {
4
4
  id: string | number;
@@ -11,6 +11,15 @@ type UIComment = {
11
11
  };
12
12
  declare const mergeComments: (legacyComments: DailyReportExternalComment[], modernComments: DailyReportPostedComment[], currentUserId: string | null | undefined, unknownAuthorName: string) => UIComment[];
13
13
  declare const resolveCommentColorClass: (color: string | null | undefined) => string;
14
+ declare const DAILY_REPORT_SSE_TERMINAL_EVENTS: readonly [
15
+ "auth-required",
16
+ "forbidden",
17
+ "resync-required"
18
+ ];
19
+ type DailyReportSseTerminalEvent = (typeof DAILY_REPORT_SSE_TERMINAL_EVENTS)[number];
20
+ declare const DAILY_REPORT_SSE_HEARTBEAT_MS = 15000;
21
+ declare const DAILY_REPORT_SSE_CURSOR_PARAM = "lastEventId";
22
+ declare const isDailyReportSseStreamId: (value: string) => boolean;
14
23
  declare const dailyReportInterviewerSchema: z.ZodObject<{
15
24
  name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
16
25
  affiliation: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -2462,4 +2471,35 @@ declare const dailyReportSseMessageSchema: z.ZodDiscriminatedUnion<"type", [
2462
2471
  }>
2463
2472
  ]>;
2464
2473
  type DailyReportSseMessage = z.infer<typeof dailyReportSseMessageSchema>;
2465
- export { type DailyReportSseMessage as D, type UIComment as U, commentDeleteMessageSchema as a, connectedMessageSchema as b, commentAddMessageSchema as c, dailyReportAttachmentItemSchema as d, dailyReportDetailSchema as e, dailyReportExternalCommentSchema as f, dailyReportInterviewerSchema as g, dailyReportLabelDefSchema as h, dailyReportPostedCommentSchema as i, dailyReportSseMessageSchema as j, reportDeleteMessageSchema as k, reportPublishMessageSchema as l, mergeComments as m, reportUpdateMessageSchema as n, resolveCommentColorClass as o, reportCreateMessageSchema as r, statusUpdateMessageSchema as s };
2474
+ type DailyReportIdsStreamCursor = {
2475
+ businessDate: string | null;
2476
+ reportHubId: number;
2477
+ };
2478
+ type DailyReportIdsStreamChunkLine = {
2479
+ kind: "chunk";
2480
+ items: DailyReportItem[];
2481
+ nextCursor: DailyReportIdsStreamCursor | null;
2482
+ isLast: boolean;
2483
+ total?: number;
2484
+ provisional?: boolean;
2485
+ snapshot?: string;
2486
+ restarted?: boolean;
2487
+ streamAnchor?: string | null;
2488
+ };
2489
+ type DailyReportSseStreamAnchor = {
2490
+ readonly lastEventId: string | null;
2491
+ readonly revision: number;
2492
+ };
2493
+ type DailyReportIdsStreamErrorLine = {
2494
+ kind: "error";
2495
+ error: string;
2496
+ };
2497
+ type DailyReportIdsStreamLine = DailyReportIdsStreamChunkLine | DailyReportIdsStreamErrorLine;
2498
+ declare const classifyIdsStreamLine: (line: unknown) => "chunk" | "error" | "unknown";
2499
+ declare const isIdsStreamChunkLine: (line: unknown) => line is DailyReportIdsStreamChunkLine;
2500
+ declare const computeIdsStreamSnapshotToken: (items: readonly DailyReportItem[]) => string;
2501
+ declare const compareIdsStreamOrder: (a: DailyReportIdsStreamCursor, b: DailyReportIdsStreamCursor) => number;
2502
+ declare const isIdsStreamOrdered: (items: readonly DailyReportItem[]) => boolean;
2503
+ declare const upsertInIdsStreamOrder: (items: readonly DailyReportItem[], item: DailyReportItem) => DailyReportItem[];
2504
+ declare const findIdsStreamResumeIndex: (items: readonly DailyReportItem[], cursor: DailyReportIdsStreamCursor) => number;
2505
+ export { mergeComments as A, reportCreateMessageSchema as B, reportDeleteMessageSchema as C, type DailyReportSseTerminalEvent as D, reportPublishMessageSchema as E, reportUpdateMessageSchema as F, resolveCommentColorClass as G, statusUpdateMessageSchema as H, upsertInIdsStreamOrder as I, type UIComment as U, type DailyReportSseMessage as a, type DailyReportSseStreamAnchor as b, DAILY_REPORT_SSE_CURSOR_PARAM as c, DAILY_REPORT_SSE_HEARTBEAT_MS as d, DAILY_REPORT_SSE_TERMINAL_EVENTS as e, type DailyReportIdsStreamChunkLine as f, type DailyReportIdsStreamCursor as g, type DailyReportIdsStreamErrorLine as h, type DailyReportIdsStreamLine as i, classifyIdsStreamLine as j, commentAddMessageSchema as k, commentDeleteMessageSchema as l, compareIdsStreamOrder as m, computeIdsStreamSnapshotToken as n, connectedMessageSchema as o, dailyReportAttachmentItemSchema as p, dailyReportDetailSchema as q, dailyReportExternalCommentSchema as r, dailyReportInterviewerSchema as s, dailyReportLabelDefSchema as t, dailyReportPostedCommentSchema as u, dailyReportSseMessageSchema as v, findIdsStreamResumeIndex as w, isDailyReportSseStreamId as x, isIdsStreamChunkLine as y, isIdsStreamOrdered as z };
package/dist/index.d.mts CHANGED
@@ -1,39 +1,12 @@
1
- export { D as DailyReportSseMessage, U as UIComment, c as commentAddMessageSchema, a as commentDeleteMessageSchema, b as connectedMessageSchema, d as dailyReportAttachmentItemSchema, e as dailyReportDetailSchema, f as dailyReportExternalCommentSchema, g as dailyReportInterviewerSchema, h as dailyReportLabelDefSchema, i as dailyReportPostedCommentSchema, j as dailyReportSseMessageSchema, m as mergeComments, r as reportCreateMessageSchema, k as reportDeleteMessageSchema, l as reportPublishMessageSchema, n as reportUpdateMessageSchema, o as resolveCommentColorClass, s as statusUpdateMessageSchema } from "./sse-schema-DCxpdETM.mjs";
2
- import { a as DailyReportItem } from "./types-CqgYQgbH.mjs";
3
- export { d as DailyReportAttachmentState, D as DailyReportAttachmentSummary, b as DailyReportDetail, e as DailyReportExternalComment, f as DailyReportInterviewer, g as DailyReportLabelDef, h as DailyReportPostedComment, c as DailyReportUser } from "./types-CqgYQgbH.mjs";
1
+ export { c as DAILY_REPORT_SSE_CURSOR_PARAM, d as DAILY_REPORT_SSE_HEARTBEAT_MS, e as DAILY_REPORT_SSE_TERMINAL_EVENTS, f as DailyReportIdsStreamChunkLine, g as DailyReportIdsStreamCursor, h as DailyReportIdsStreamErrorLine, i as DailyReportIdsStreamLine, a as DailyReportSseMessage, b as DailyReportSseStreamAnchor, D as DailyReportSseTerminalEvent, U as UIComment, j as classifyIdsStreamLine, k as commentAddMessageSchema, l as commentDeleteMessageSchema, m as compareIdsStreamOrder, n as computeIdsStreamSnapshotToken, o as connectedMessageSchema, p as dailyReportAttachmentItemSchema, q as dailyReportDetailSchema, r as dailyReportExternalCommentSchema, s as dailyReportInterviewerSchema, t as dailyReportLabelDefSchema, u as dailyReportPostedCommentSchema, v as dailyReportSseMessageSchema, w as findIdsStreamResumeIndex, x as isDailyReportSseStreamId, y as isIdsStreamChunkLine, z as isIdsStreamOrdered, A as mergeComments, B as reportCreateMessageSchema, C as reportDeleteMessageSchema, E as reportPublishMessageSchema, F as reportUpdateMessageSchema, G as resolveCommentColorClass, H as statusUpdateMessageSchema, I as upsertInIdsStreamOrder } from "./ids-stream-DCuiaTit.mjs";
4
2
  export { D as DailyReportLogger, L as LogLevel, c as createLogger } from "./logger-D3krZrNK.mjs";
3
+ export { d as DailyReportAttachmentState, D as DailyReportAttachmentSummary, b as DailyReportDetail, e as DailyReportExternalComment, f as DailyReportInterviewer, a as DailyReportItem, g as DailyReportLabelDef, h as DailyReportPostedComment, c as DailyReportUser } from "./types-CqgYQgbH.mjs";
5
4
  import "zod";
6
5
  type BusinessDateInput = string | Date | null | undefined;
7
6
  declare const resolveTodayBusinessDateKey: (now?: Date) => string;
8
7
  declare const normalizeBusinessDateKey: (value: BusinessDateInput) => string | null;
9
8
  declare const formatBusinessDateDisplay: (value: BusinessDateInput) => string | null;
10
9
  declare const parseBusinessDateKeyToDate: (value: BusinessDateInput) => Date | null;
11
- type DailyReportIdsStreamCursor = {
12
- businessDate: string | null;
13
- reportHubId: number;
14
- };
15
- type DailyReportIdsStreamChunkLine = {
16
- kind: "chunk";
17
- items: DailyReportItem[];
18
- nextCursor: DailyReportIdsStreamCursor | null;
19
- isLast: boolean;
20
- total?: number;
21
- provisional?: boolean;
22
- snapshot?: string;
23
- restarted?: boolean;
24
- };
25
- type DailyReportIdsStreamErrorLine = {
26
- kind: "error";
27
- error: string;
28
- };
29
- type DailyReportIdsStreamLine = DailyReportIdsStreamChunkLine | DailyReportIdsStreamErrorLine;
30
- declare const classifyIdsStreamLine: (line: unknown) => "chunk" | "error" | "unknown";
31
- declare const isIdsStreamChunkLine: (line: unknown) => line is DailyReportIdsStreamChunkLine;
32
- declare const computeIdsStreamSnapshotToken: (items: readonly DailyReportItem[]) => string;
33
- declare const compareIdsStreamOrder: (a: DailyReportIdsStreamCursor, b: DailyReportIdsStreamCursor) => number;
34
- declare const isIdsStreamOrdered: (items: readonly DailyReportItem[]) => boolean;
35
- declare const upsertInIdsStreamOrder: (items: readonly DailyReportItem[], item: DailyReportItem) => DailyReportItem[];
36
- declare const findIdsStreamResumeIndex: (items: readonly DailyReportItem[], cursor: DailyReportIdsStreamCursor) => number;
37
10
  declare const fallbackText: (value: string | null | undefined) => string;
38
11
  declare const formatToIsoDate: (value: unknown) => string;
39
- export { type DailyReportIdsStreamChunkLine, type DailyReportIdsStreamCursor, type DailyReportIdsStreamErrorLine, type DailyReportIdsStreamLine, DailyReportItem, classifyIdsStreamLine, compareIdsStreamOrder, computeIdsStreamSnapshotToken, fallbackText, findIdsStreamResumeIndex, formatBusinessDateDisplay, formatToIsoDate, isIdsStreamChunkLine, isIdsStreamOrdered, normalizeBusinessDateKey, parseBusinessDateKeyToDate, resolveTodayBusinessDateKey, upsertInIdsStreamOrder };
12
+ export { fallbackText, formatBusinessDateDisplay, formatToIsoDate, normalizeBusinessDateKey, parseBusinessDateKeyToDate, resolveTodayBusinessDateKey };
package/dist/index.d.ts CHANGED
@@ -1,39 +1,12 @@
1
- export { D as DailyReportSseMessage, U as UIComment, c as commentAddMessageSchema, a as commentDeleteMessageSchema, b as connectedMessageSchema, d as dailyReportAttachmentItemSchema, e as dailyReportDetailSchema, f as dailyReportExternalCommentSchema, g as dailyReportInterviewerSchema, h as dailyReportLabelDefSchema, i as dailyReportPostedCommentSchema, j as dailyReportSseMessageSchema, m as mergeComments, r as reportCreateMessageSchema, k as reportDeleteMessageSchema, l as reportPublishMessageSchema, n as reportUpdateMessageSchema, o as resolveCommentColorClass, s as statusUpdateMessageSchema } from "./sse-schema-DoQw8_om.js";
2
- import { a as DailyReportItem } from "./types-CqgYQgbH.js";
3
- export { d as DailyReportAttachmentState, D as DailyReportAttachmentSummary, b as DailyReportDetail, e as DailyReportExternalComment, f as DailyReportInterviewer, g as DailyReportLabelDef, h as DailyReportPostedComment, c as DailyReportUser } from "./types-CqgYQgbH.js";
1
+ export { c as DAILY_REPORT_SSE_CURSOR_PARAM, d as DAILY_REPORT_SSE_HEARTBEAT_MS, e as DAILY_REPORT_SSE_TERMINAL_EVENTS, f as DailyReportIdsStreamChunkLine, g as DailyReportIdsStreamCursor, h as DailyReportIdsStreamErrorLine, i as DailyReportIdsStreamLine, a as DailyReportSseMessage, b as DailyReportSseStreamAnchor, D as DailyReportSseTerminalEvent, U as UIComment, j as classifyIdsStreamLine, k as commentAddMessageSchema, l as commentDeleteMessageSchema, m as compareIdsStreamOrder, n as computeIdsStreamSnapshotToken, o as connectedMessageSchema, p as dailyReportAttachmentItemSchema, q as dailyReportDetailSchema, r as dailyReportExternalCommentSchema, s as dailyReportInterviewerSchema, t as dailyReportLabelDefSchema, u as dailyReportPostedCommentSchema, v as dailyReportSseMessageSchema, w as findIdsStreamResumeIndex, x as isDailyReportSseStreamId, y as isIdsStreamChunkLine, z as isIdsStreamOrdered, A as mergeComments, B as reportCreateMessageSchema, C as reportDeleteMessageSchema, E as reportPublishMessageSchema, F as reportUpdateMessageSchema, G as resolveCommentColorClass, H as statusUpdateMessageSchema, I as upsertInIdsStreamOrder } from "./ids-stream-BnM6L-Sk.js";
4
2
  export { D as DailyReportLogger, L as LogLevel, c as createLogger } from "./logger-D3krZrNK.js";
3
+ export { d as DailyReportAttachmentState, D as DailyReportAttachmentSummary, b as DailyReportDetail, e as DailyReportExternalComment, f as DailyReportInterviewer, a as DailyReportItem, g as DailyReportLabelDef, h as DailyReportPostedComment, c as DailyReportUser } from "./types-CqgYQgbH.js";
5
4
  import "zod";
6
5
  type BusinessDateInput = string | Date | null | undefined;
7
6
  declare const resolveTodayBusinessDateKey: (now?: Date) => string;
8
7
  declare const normalizeBusinessDateKey: (value: BusinessDateInput) => string | null;
9
8
  declare const formatBusinessDateDisplay: (value: BusinessDateInput) => string | null;
10
9
  declare const parseBusinessDateKeyToDate: (value: BusinessDateInput) => Date | null;
11
- type DailyReportIdsStreamCursor = {
12
- businessDate: string | null;
13
- reportHubId: number;
14
- };
15
- type DailyReportIdsStreamChunkLine = {
16
- kind: "chunk";
17
- items: DailyReportItem[];
18
- nextCursor: DailyReportIdsStreamCursor | null;
19
- isLast: boolean;
20
- total?: number;
21
- provisional?: boolean;
22
- snapshot?: string;
23
- restarted?: boolean;
24
- };
25
- type DailyReportIdsStreamErrorLine = {
26
- kind: "error";
27
- error: string;
28
- };
29
- type DailyReportIdsStreamLine = DailyReportIdsStreamChunkLine | DailyReportIdsStreamErrorLine;
30
- declare const classifyIdsStreamLine: (line: unknown) => "chunk" | "error" | "unknown";
31
- declare const isIdsStreamChunkLine: (line: unknown) => line is DailyReportIdsStreamChunkLine;
32
- declare const computeIdsStreamSnapshotToken: (items: readonly DailyReportItem[]) => string;
33
- declare const compareIdsStreamOrder: (a: DailyReportIdsStreamCursor, b: DailyReportIdsStreamCursor) => number;
34
- declare const isIdsStreamOrdered: (items: readonly DailyReportItem[]) => boolean;
35
- declare const upsertInIdsStreamOrder: (items: readonly DailyReportItem[], item: DailyReportItem) => DailyReportItem[];
36
- declare const findIdsStreamResumeIndex: (items: readonly DailyReportItem[], cursor: DailyReportIdsStreamCursor) => number;
37
10
  declare const fallbackText: (value: string | null | undefined) => string;
38
11
  declare const formatToIsoDate: (value: unknown) => string;
39
- export { type DailyReportIdsStreamChunkLine, type DailyReportIdsStreamCursor, type DailyReportIdsStreamErrorLine, type DailyReportIdsStreamLine, DailyReportItem, classifyIdsStreamLine, compareIdsStreamOrder, computeIdsStreamSnapshotToken, fallbackText, findIdsStreamResumeIndex, formatBusinessDateDisplay, formatToIsoDate, isIdsStreamChunkLine, isIdsStreamOrdered, normalizeBusinessDateKey, parseBusinessDateKeyToDate, resolveTodayBusinessDateKey, upsertInIdsStreamOrder };
12
+ export { fallbackText, formatBusinessDateDisplay, formatToIsoDate, normalizeBusinessDateKey, parseBusinessDateKeyToDate, resolveTodayBusinessDateKey };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var d=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var O=Object.prototype.hasOwnProperty;var z=(r,e)=>{for(var n in e)d(r,n,{get:e[n],enumerable:!0})},_=(r,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of B(e))!O.call(r,s)&&s!==n&&d(r,s,{get:()=>e[s],enumerable:!(o=P(e,s))||o.enumerable});return r};var L=r=>_(d({},"__esModule",{value:!0}),r);var re={};z(re,{LogLevel:()=>b,classifyIdsStreamLine:()=>h,commentAddMessageSchema:()=>C,commentDeleteMessageSchema:()=>T,compareIdsStreamOrder:()=>m,computeIdsStreamSnapshotToken:()=>Q,connectedMessageSchema:()=>k,createLogger:()=>v,dailyReportAttachmentItemSchema:()=>R,dailyReportDetailSchema:()=>p,dailyReportExternalCommentSchema:()=>I,dailyReportInterviewerSchema:()=>D,dailyReportLabelDefSchema:()=>S,dailyReportPostedCommentSchema:()=>g,dailyReportSseMessageSchema:()=>ee,fallbackText:()=>te,findIdsStreamResumeIndex:()=>Z,formatBusinessDateDisplay:()=>Y,formatToIsoDate:()=>H,isIdsStreamChunkLine:()=>q,isIdsStreamOrdered:()=>V,mergeComments:()=>W,normalizeBusinessDateKey:()=>c,parseBusinessDateKeyToDate:()=>G,reportCreateMessageSchema:()=>M,reportDeleteMessageSchema:()=>A,reportPublishMessageSchema:()=>N,reportUpdateMessageSchema:()=>$,resolveCommentColorClass:()=>J,resolveTodayBusinessDateKey:()=>x,statusUpdateMessageSchema:()=>w,upsertInIdsStreamOrder:()=>X});module.exports=L(re);var F=/^\d{4}-\d{2}-\d{2}$/,K=/^\d{4}\/\d{2}\/\d{2}$/,u=r=>r<10?`0${r}`:`${r}`,f=r=>{if(Number.isNaN(r.getTime()))return null;let e=r.getFullYear(),n=u(r.getMonth()+1),o=u(r.getDate());return`${e}-${n}-${o}`},x=(r=new Date)=>Number.isNaN(r.getTime())?x(new Date):`${r.getFullYear()}-${u(r.getMonth()+1)}-${u(r.getDate())}`,c=r=>{if(r==null)return null;if(r instanceof Date)return f(r);let e=r.trim();if(e==="")return null;if(F.test(e))return e;if(K.test(e))return e.replaceAll("/","-");let n=new Date(e);return f(n)},Y=r=>{let e=c(r);return e||null},G=r=>{let e=c(r);if(!e)return null;let[n,o,s]=e.split("-").map(i=>Number.parseInt(i,10));return[n,o,s].some(i=>Number.isNaN(i))?null:new Date(n,o-1,s)};var W=(r,e,n,o)=>{if(typeof o!="string"||o.trim()==="")throw new RangeError(`[daily-report] mergeComments: unknownAuthorName must be a non-blank string; got ${typeof o=="string"?JSON.stringify(o):typeof o}`);let s=r.map((a,l)=>({id:`legacy-${l}`,authorName:a.name||o,content:a.text||"",isMine:!1,color:a.color||void 0,isLegacy:!0})),i=e.map(a=>({id:a.id,authorName:a.userName||o,content:a.content??"",createdAt:a.createdAt??"",isMine:n?a.userId===n:a.isMine,isLegacy:!1}));return[...s,...i]},J=r=>{if(!r)return"text-gray-700 dark:text-gray-300";let e=r.toLowerCase();return e.includes("red")||e.includes("\u8D64")?"text-red-600 dark:text-red-400":e.includes("green")||e.includes("\u7DD1")?"text-green-600 dark:text-green-400":e.includes("blue")||e.includes("\u9752")?"text-blue-600 dark:text-blue-400":e.includes("yellow")||e.includes("\u9EC4")?"text-yellow-600 dark:text-yellow-400":e.includes("orange")||e.includes("\u6A59")?"text-orange-500 dark:text-orange-400":"text-gray-700 dark:text-gray-300"};var h=r=>{if(typeof r!="object"||r===null)return"unknown";let e=r;return typeof e.kind=="string"?e.kind==="chunk"?"chunk":e.kind==="error"?"error":"unknown":Array.isArray(e.items)?"chunk":typeof e.error=="string"?"error":"unknown"},q=r=>h(r)==="chunk",Q=r=>{let e=2166136261,n=-624069552;for(let o of r){let s=o.reportHubId;e^=s&255,e=Math.imul(e,16777619),e^=s>>>8&255,e=Math.imul(e,16777619),e^=s>>>16&255,e=Math.imul(e,16777619),e^=s>>>24&255,e=Math.imul(e,16777619),n^=s>>>24&255,n=Math.imul(n,16777619),n^=s>>>16&255,n=Math.imul(n,16777619),n^=s>>>8&255,n=Math.imul(n,16777619),n^=s&255,n=Math.imul(n,16777619);let i=o.businessDate;if(i===null)e^=1,e=Math.imul(e,16777619),n^=1,n=Math.imul(n,16777619);else for(let a=0;a<i.length;a++){let l=i.charCodeAt(a);e^=l&255,e=Math.imul(e,16777619),n^=l&255,n=Math.imul(n,16777619)}}return e^=r.length,e=Math.imul(e,16777619),n^=r.length,n=Math.imul(n,16777619),((e>>>0).toString(16).padStart(8,"0")+(n>>>0).toString(16).padStart(8,"0")).replace(/^0+(?=.)/,"")},m=(r,e)=>r.businessDate!==e.businessDate?r.businessDate===null?1:e.businessDate===null||r.businessDate>e.businessDate?-1:1:e.reportHubId-r.reportHubId,V=r=>{for(let e=1;e<r.length;e++)if(m(r[e-1],r[e])>0)return!1;return!0},X=(r,e)=>{let n=r.filter(i=>i.reportHubId!==e.reportHubId),o=0,s=n.length;for(;o<s;){let i=o+s>>1;m(n[i],e)<=0?o=i+1:s=i}return n.splice(o,0,e),n},Z=(r,e)=>{let n=r.findIndex(o=>m({businessDate:o.businessDate,reportHubId:o.reportHubId},e)>0);return n===-1?r.length:n};var b=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.NONE=4]="NONE",i))(b||{}),v=(r,e,n=console)=>{let o=s=>typeof s=="string"?[`${e} ${s}`]:[e,s];return{debug:(s,...i)=>{r<=0&&n.debug(...o(s),...i)},info:(s,...i)=>{r<=1&&n.info(...o(s),...i)},warn:(s,...i)=>{r<=2&&n.warn(...o(s),...i)},error:(s,...i)=>{r<=3&&n.error(...o(s),...i)}}};var t=require("zod"),D=t.z.object({name:t.z.string().nullish(),affiliation:t.z.string().nullish()}),I=t.z.object({name:t.z.string().nullish(),text:t.z.string().nullish(),color:t.z.string().nullish()}),S=t.z.object({id:t.z.number(),name:t.z.string().nullish(),color:t.z.string().nullish()}),g=t.z.object({id:t.z.number(),userId:t.z.string().nullish(),userName:t.z.string().nullish(),content:t.z.string().nullish(),createdAt:t.z.string().nullish(),isMine:t.z.boolean()}),R=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"])}),p=t.z.object({reportHubId:t.z.number(),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(D),subject:t.z.string().nullish(),content:t.z.string().nullish(),externalComments:t.z.array(I),isRead:t.z.boolean(),isStarred:t.z.boolean(),labels:t.z.array(S),postedComments:t.z.array(g),attachments:t.z.array(R).default([])}),k=t.z.object({type:t.z.literal("connected")}),w=t.z.object({type:t.z.literal("status-update"),reportHubId:t.z.number(),statusType:t.z.enum(["star","read"]),value:t.z.boolean(),clientTempId:t.z.string(),recipientRawUserId:t.z.number().optional()}),y=t.z.string().optional(),C=t.z.object({type:t.z.literal("comment-add"),reportHubId:t.z.number(),comment:g,clientTempId:t.z.string(),recipientRawUserId:t.z.number().optional(),sourceType:y}),T=t.z.object({type:t.z.literal("comment-delete"),reportHubId:t.z.number(),commentId:t.z.number(),clientTempId:t.z.string(),recipientRawUserId:t.z.number().optional(),sourceType:y}),M=t.z.object({type:t.z.literal("report-create"),reportHubId:t.z.number(),report:p,clientTempId:t.z.string(),recipientRawUserId:t.z.number().optional()}),$=t.z.object({type:t.z.literal("report-update"),reportHubId:t.z.number(),report:p,clientTempId:t.z.string(),recipientRawUserId:t.z.number().optional()}),N=t.z.object({type:t.z.literal("report-publish"),reportHubId:t.z.number(),report:p,clientTempId:t.z.string(),recipientRawUserId:t.z.number().optional()}),A=t.z.object({type:t.z.literal("report-delete"),reportHubId:t.z.number(),clientTempId:t.z.string(),sourceType:y}),ee=t.z.discriminatedUnion("type",[k,w,C,T,M,$,N,A]);var te=r=>{if(!r)return"-";let e=r.trim();return e===""?"-":e},H=r=>{if(!r)return"-";if(typeof r!="string")return r instanceof Date?H(r.toISOString()):String(r);let e=r.trim();if(e==="")return"-";let n=e.match(/^(\d{4})[-/](\d{2})[-/](\d{2})$/);if(n)return`${n[1]}-${n[2]}-${n[3]}`;let o=new Date(e);if(Number.isNaN(o.getTime()))return e;let s=o.getFullYear(),i=String(o.getMonth()+1).padStart(2,"0"),a=String(o.getDate()).padStart(2,"0");if(e.includes(":")||e.includes("T")){let j=String(o.getHours()).padStart(2,"0"),U=String(o.getMinutes()).padStart(2,"0"),E=String(o.getSeconds()).padStart(2,"0");return`${s}-${i}-${a}T${j}:${U}:${E}`}return`${s}-${i}-${a}`};0&&(module.exports={LogLevel,classifyIdsStreamLine,commentAddMessageSchema,commentDeleteMessageSchema,compareIdsStreamOrder,computeIdsStreamSnapshotToken,connectedMessageSchema,createLogger,dailyReportAttachmentItemSchema,dailyReportDetailSchema,dailyReportExternalCommentSchema,dailyReportInterviewerSchema,dailyReportLabelDefSchema,dailyReportPostedCommentSchema,dailyReportSseMessageSchema,fallbackText,findIdsStreamResumeIndex,formatBusinessDateDisplay,formatToIsoDate,isIdsStreamChunkLine,isIdsStreamOrdered,mergeComments,normalizeBusinessDateKey,parseBusinessDateKeyToDate,reportCreateMessageSchema,reportDeleteMessageSchema,reportPublishMessageSchema,reportUpdateMessageSchema,resolveCommentColorClass,resolveTodayBusinessDateKey,statusUpdateMessageSchema,upsertInIdsStreamOrder});
1
+ "use strict";var d=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var L=(r,e)=>{for(var n in e)d(r,n,{get:e[n],enumerable:!0})},B=(r,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of U(e))!j.call(r,s)&&s!==n&&d(r,s,{get:()=>e[s],enumerable:!(o=O(e,s))||o.enumerable});return r};var z=r=>B(d({},"__esModule",{value:!0}),r);var ae={};L(ae,{DAILY_REPORT_SSE_CURSOR_PARAM:()=>re,DAILY_REPORT_SSE_HEARTBEAT_MS:()=>te,DAILY_REPORT_SSE_TERMINAL_EVENTS:()=>ee,LogLevel:()=>h,classifyIdsStreamLine:()=>b,commentAddMessageSchema:()=>C,commentDeleteMessageSchema:()=>w,compareIdsStreamOrder:()=>m,computeIdsStreamSnapshotToken:()=>J,connectedMessageSchema:()=>k,createLogger:()=>v,dailyReportAttachmentItemSchema:()=>R,dailyReportDetailSchema:()=>p,dailyReportExternalCommentSchema:()=>I,dailyReportInterviewerSchema:()=>D,dailyReportLabelDefSchema:()=>S,dailyReportPostedCommentSchema:()=>g,dailyReportSseMessageSchema:()=>se,fallbackText:()=>ie,findIdsStreamResumeIndex:()=>Z,formatBusinessDateDisplay:()=>K,formatToIsoDate:()=>N,isDailyReportSseStreamId:()=>oe,isIdsStreamChunkLine:()=>W,isIdsStreamOrdered:()=>Q,mergeComments:()=>G,normalizeBusinessDateKey:()=>c,parseBusinessDateKeyToDate:()=>q,reportCreateMessageSchema:()=>M,reportDeleteMessageSchema:()=>_,reportPublishMessageSchema:()=>A,reportUpdateMessageSchema:()=>E,resolveCommentColorClass:()=>V,resolveTodayBusinessDateKey:()=>x,statusUpdateMessageSchema:()=>T,upsertInIdsStreamOrder:()=>X});module.exports=z(ae);var Y=/^\d{4}-\d{2}-\d{2}$/,F=/^\d{4}\/\d{2}\/\d{2}$/,u=r=>r<10?`0${r}`:`${r}`,f=r=>{if(Number.isNaN(r.getTime()))return null;let e=r.getFullYear(),n=u(r.getMonth()+1),o=u(r.getDate());return`${e}-${n}-${o}`},x=(r=new Date)=>Number.isNaN(r.getTime())?x(new Date):`${r.getFullYear()}-${u(r.getMonth()+1)}-${u(r.getDate())}`,c=r=>{if(r==null)return null;if(r instanceof Date)return f(r);let e=r.trim();if(e==="")return null;if(Y.test(e))return e;if(F.test(e))return e.replaceAll("/","-");let n=new Date(e);return f(n)},K=r=>{let e=c(r);return e||null},q=r=>{let e=c(r);if(!e)return null;let[n,o,s]=e.split("-").map(i=>Number.parseInt(i,10));return[n,o,s].some(i=>Number.isNaN(i))?null:new Date(n,o-1,s)};var G=(r,e,n,o)=>{if(typeof o!="string"||o.trim()==="")throw new RangeError(`[daily-report] mergeComments: unknownAuthorName must be a non-blank string; got ${typeof o=="string"?JSON.stringify(o):typeof o}`);let s=r.map((a,l)=>({id:`legacy-${l}`,authorName:a.name||o,content:a.text||"",isMine:!1,color:a.color||void 0,isLegacy:!0})),i=e.map(a=>({id:a.id,authorName:a.userName||o,content:a.content??"",createdAt:a.createdAt??"",isMine:n?a.userId===n:a.isMine,isLegacy:!1}));return[...s,...i]},V=r=>{if(!r)return"text-gray-700 dark:text-gray-300";let e=r.toLowerCase();return e.includes("red")||e.includes("\u8D64")?"text-red-600 dark:text-red-400":e.includes("green")||e.includes("\u7DD1")?"text-green-600 dark:text-green-400":e.includes("blue")||e.includes("\u9752")?"text-blue-600 dark:text-blue-400":e.includes("yellow")||e.includes("\u9EC4")?"text-yellow-600 dark:text-yellow-400":e.includes("orange")||e.includes("\u6A59")?"text-orange-500 dark:text-orange-400":"text-gray-700 dark:text-gray-300"};var b=r=>{if(typeof r!="object"||r===null)return"unknown";let e=r;return typeof e.kind=="string"?e.kind==="chunk"?"chunk":e.kind==="error"?"error":"unknown":Array.isArray(e.items)?"chunk":typeof e.error=="string"?"error":"unknown"},W=r=>b(r)==="chunk",J=r=>{let e=2166136261,n=-624069552;for(let o of r){let s=o.reportHubId;e^=s&255,e=Math.imul(e,16777619),e^=s>>>8&255,e=Math.imul(e,16777619),e^=s>>>16&255,e=Math.imul(e,16777619),e^=s>>>24&255,e=Math.imul(e,16777619),n^=s>>>24&255,n=Math.imul(n,16777619),n^=s>>>16&255,n=Math.imul(n,16777619),n^=s>>>8&255,n=Math.imul(n,16777619),n^=s&255,n=Math.imul(n,16777619);let i=o.businessDate;if(i===null)e^=1,e=Math.imul(e,16777619),n^=1,n=Math.imul(n,16777619);else for(let a=0;a<i.length;a++){let l=i.charCodeAt(a);e^=l&255,e=Math.imul(e,16777619),n^=l&255,n=Math.imul(n,16777619)}}return e^=r.length,e=Math.imul(e,16777619),n^=r.length,n=Math.imul(n,16777619),((e>>>0).toString(16).padStart(8,"0")+(n>>>0).toString(16).padStart(8,"0")).replace(/^0+(?=.)/,"")},m=(r,e)=>r.businessDate!==e.businessDate?r.businessDate===null?1:e.businessDate===null||r.businessDate>e.businessDate?-1:1:e.reportHubId-r.reportHubId,Q=r=>{for(let e=1;e<r.length;e++)if(m(r[e-1],r[e])>0)return!1;return!0},X=(r,e)=>{let n=r.filter(i=>i.reportHubId!==e.reportHubId),o=0,s=n.length;for(;o<s;){let i=o+s>>1;m(n[i],e)<=0?o=i+1:s=i}return n.splice(o,0,e),n},Z=(r,e)=>{let n=r.findIndex(o=>m({businessDate:o.businessDate,reportHubId:o.reportHubId},e)>0);return n===-1?r.length:n};var h=(i=>(i[i.DEBUG=0]="DEBUG",i[i.INFO=1]="INFO",i[i.WARN=2]="WARN",i[i.ERROR=3]="ERROR",i[i.NONE=4]="NONE",i))(h||{}),v=(r,e,n=console)=>{let o=s=>typeof s=="string"?[`${e} ${s}`]:[e,s];return{debug:(s,...i)=>{r<=0&&n.debug(...o(s),...i)},info:(s,...i)=>{r<=1&&n.info(...o(s),...i)},warn:(s,...i)=>{r<=2&&n.warn(...o(s),...i)},error:(s,...i)=>{r<=3&&n.error(...o(s),...i)}}};var t=require("zod"),ee=["auth-required","forbidden","resync-required"],te=15e3,re="lastEventId",ne=/^\d{1,15}-\d{1,15}$/,oe=r=>ne.test(r),D=t.z.object({name:t.z.string().nullish(),affiliation:t.z.string().nullish()}),I=t.z.object({name:t.z.string().nullish(),text:t.z.string().nullish(),color:t.z.string().nullish()}),S=t.z.object({id:t.z.number(),name:t.z.string().nullish(),color:t.z.string().nullish()}),g=t.z.object({id:t.z.number(),userId:t.z.string().nullish(),userName:t.z.string().nullish(),content:t.z.string().nullish(),createdAt:t.z.string().nullish(),isMine:t.z.boolean()}),R=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"])}),p=t.z.object({reportHubId:t.z.number(),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(D),subject:t.z.string().nullish(),content:t.z.string().nullish(),externalComments:t.z.array(I),isRead:t.z.boolean(),isStarred:t.z.boolean(),labels:t.z.array(S),postedComments:t.z.array(g),attachments:t.z.array(R).default([])}),k=t.z.object({type:t.z.literal("connected")}),T=t.z.object({type:t.z.literal("status-update"),reportHubId:t.z.number(),statusType:t.z.enum(["star","read"]),value:t.z.boolean(),clientTempId:t.z.string(),recipientRawUserId:t.z.number().optional()}),y=t.z.string().optional(),C=t.z.object({type:t.z.literal("comment-add"),reportHubId:t.z.number(),comment:g,clientTempId:t.z.string(),recipientRawUserId:t.z.number().optional(),sourceType:y}),w=t.z.object({type:t.z.literal("comment-delete"),reportHubId:t.z.number(),commentId:t.z.number(),clientTempId:t.z.string(),recipientRawUserId:t.z.number().optional(),sourceType:y}),M=t.z.object({type:t.z.literal("report-create"),reportHubId:t.z.number(),report:p,clientTempId:t.z.string(),recipientRawUserId:t.z.number().optional()}),E=t.z.object({type:t.z.literal("report-update"),reportHubId:t.z.number(),report:p,clientTempId:t.z.string(),recipientRawUserId:t.z.number().optional()}),A=t.z.object({type:t.z.literal("report-publish"),reportHubId:t.z.number(),report:p,clientTempId:t.z.string(),recipientRawUserId:t.z.number().optional()}),_=t.z.object({type:t.z.literal("report-delete"),reportHubId:t.z.number(),clientTempId:t.z.string(),sourceType:y}),se=t.z.discriminatedUnion("type",[k,T,C,w,M,E,A,_]);var ie=r=>{if(!r)return"-";let e=r.trim();return e===""?"-":e},N=r=>{if(!r)return"-";if(typeof r!="string")return r instanceof Date?N(r.toISOString()):String(r);let e=r.trim();if(e==="")return"-";let n=e.match(/^(\d{4})[-/](\d{2})[-/](\d{2})$/);if(n)return`${n[1]}-${n[2]}-${n[3]}`;let o=new Date(e);if(Number.isNaN(o.getTime()))return e;let s=o.getFullYear(),i=String(o.getMonth()+1).padStart(2,"0"),a=String(o.getDate()).padStart(2,"0");if(e.includes(":")||e.includes("T")){let $=String(o.getHours()).padStart(2,"0"),P=String(o.getMinutes()).padStart(2,"0"),H=String(o.getSeconds()).padStart(2,"0");return`${s}-${i}-${a}T${$}:${P}:${H}`}return`${s}-${i}-${a}`};0&&(module.exports={DAILY_REPORT_SSE_CURSOR_PARAM,DAILY_REPORT_SSE_HEARTBEAT_MS,DAILY_REPORT_SSE_TERMINAL_EVENTS,LogLevel,classifyIdsStreamLine,commentAddMessageSchema,commentDeleteMessageSchema,compareIdsStreamOrder,computeIdsStreamSnapshotToken,connectedMessageSchema,createLogger,dailyReportAttachmentItemSchema,dailyReportDetailSchema,dailyReportExternalCommentSchema,dailyReportInterviewerSchema,dailyReportLabelDefSchema,dailyReportPostedCommentSchema,dailyReportSseMessageSchema,fallbackText,findIdsStreamResumeIndex,formatBusinessDateDisplay,formatToIsoDate,isDailyReportSseStreamId,isIdsStreamChunkLine,isIdsStreamOrdered,mergeComments,normalizeBusinessDateKey,parseBusinessDateKeyToDate,reportCreateMessageSchema,reportDeleteMessageSchema,reportPublishMessageSchema,reportUpdateMessageSchema,resolveCommentColorClass,resolveTodayBusinessDateKey,statusUpdateMessageSchema,upsertInIdsStreamOrder});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var b=/^\d{4}-\d{2}-\d{2}$/,D=/^\d{4}\/\d{2}\/\d{2}$/,u=r=>r<10?`0${r}`:`${r}`,c=r=>{if(Number.isNaN(r.getTime()))return null;let t=r.getFullYear(),n=u(r.getMonth()+1),s=u(r.getDate());return`${t}-${n}-${s}`},I=(r=new Date)=>Number.isNaN(r.getTime())?I(new Date):`${r.getFullYear()}-${u(r.getMonth()+1)}-${u(r.getDate())}`,g=r=>{if(r==null)return null;if(r instanceof Date)return c(r);let t=r.trim();if(t==="")return null;if(b.test(t))return t;if(D.test(t))return t.replaceAll("/","-");let n=new Date(t);return c(n)},B=r=>{let t=g(r);return t||null},O=r=>{let t=g(r);if(!t)return null;let[n,s,i]=t.split("-").map(o=>Number.parseInt(o,10));return[n,s,i].some(o=>Number.isNaN(o))?null:new Date(n,s-1,i)};var _=(r,t,n,s)=>{if(typeof s!="string"||s.trim()==="")throw new RangeError(`[daily-report] mergeComments: unknownAuthorName must be a non-blank string; got ${typeof s=="string"?JSON.stringify(s):typeof s}`);let i=r.map((a,l)=>({id:`legacy-${l}`,authorName:a.name||s,content:a.text||"",isMine:!1,color:a.color||void 0,isLegacy:!0})),o=t.map(a=>({id:a.id,authorName:a.userName||s,content:a.content??"",createdAt:a.createdAt??"",isMine:n?a.userId===n:a.isMine,isLegacy:!1}));return[...i,...o]},L=r=>{if(!r)return"text-gray-700 dark:text-gray-300";let t=r.toLowerCase();return t.includes("red")||t.includes("\u8D64")?"text-red-600 dark:text-red-400":t.includes("green")||t.includes("\u7DD1")?"text-green-600 dark:text-green-400":t.includes("blue")||t.includes("\u9752")?"text-blue-600 dark:text-blue-400":t.includes("yellow")||t.includes("\u9EC4")?"text-yellow-600 dark:text-yellow-400":t.includes("orange")||t.includes("\u6A59")?"text-orange-500 dark:text-orange-400":"text-gray-700 dark:text-gray-300"};var S=r=>{if(typeof r!="object"||r===null)return"unknown";let t=r;return typeof t.kind=="string"?t.kind==="chunk"?"chunk":t.kind==="error"?"error":"unknown":Array.isArray(t.items)?"chunk":typeof t.error=="string"?"error":"unknown"},K=r=>S(r)==="chunk",Y=r=>{let t=2166136261,n=-624069552;for(let s of r){let i=s.reportHubId;t^=i&255,t=Math.imul(t,16777619),t^=i>>>8&255,t=Math.imul(t,16777619),t^=i>>>16&255,t=Math.imul(t,16777619),t^=i>>>24&255,t=Math.imul(t,16777619),n^=i>>>24&255,n=Math.imul(n,16777619),n^=i>>>16&255,n=Math.imul(n,16777619),n^=i>>>8&255,n=Math.imul(n,16777619),n^=i&255,n=Math.imul(n,16777619);let o=s.businessDate;if(o===null)t^=1,t=Math.imul(t,16777619),n^=1,n=Math.imul(n,16777619);else for(let a=0;a<o.length;a++){let l=o.charCodeAt(a);t^=l&255,t=Math.imul(t,16777619),n^=l&255,n=Math.imul(n,16777619)}}return t^=r.length,t=Math.imul(t,16777619),n^=r.length,n=Math.imul(n,16777619),((t>>>0).toString(16).padStart(8,"0")+(n>>>0).toString(16).padStart(8,"0")).replace(/^0+(?=.)/,"")},m=(r,t)=>r.businessDate!==t.businessDate?r.businessDate===null?1:t.businessDate===null||r.businessDate>t.businessDate?-1:1:t.reportHubId-r.reportHubId,G=r=>{for(let t=1;t<r.length;t++)if(m(r[t-1],r[t])>0)return!1;return!0},W=(r,t)=>{let n=r.filter(o=>o.reportHubId!==t.reportHubId),s=0,i=n.length;for(;s<i;){let o=s+i>>1;m(n[o],t)<=0?s=o+1:i=o}return n.splice(s,0,t),n},J=(r,t)=>{let n=r.findIndex(s=>m({businessDate:s.businessDate,reportHubId:s.reportHubId},t)>0);return n===-1?r.length:n};var R=(o=>(o[o.DEBUG=0]="DEBUG",o[o.INFO=1]="INFO",o[o.WARN=2]="WARN",o[o.ERROR=3]="ERROR",o[o.NONE=4]="NONE",o))(R||{}),Q=(r,t,n=console)=>{let s=i=>typeof i=="string"?[`${t} ${i}`]:[t,i];return{debug:(i,...o)=>{r<=0&&n.debug(...s(i),...o)},info:(i,...o)=>{r<=1&&n.info(...s(i),...o)},warn:(i,...o)=>{r<=2&&n.warn(...s(i),...o)},error:(i,...o)=>{r<=3&&n.error(...s(i),...o)}}};import{z as e}from"zod";var k=e.object({name:e.string().nullish(),affiliation:e.string().nullish()}),w=e.object({name:e.string().nullish(),text:e.string().nullish(),color:e.string().nullish()}),C=e.object({id:e.number(),name:e.string().nullish(),color:e.string().nullish()}),y=e.object({id:e.number(),userId:e.string().nullish(),userName:e.string().nullish(),content:e.string().nullish(),createdAt:e.string().nullish(),isMine:e.boolean()}),T=e.object({id:e.string(),fileName:e.string(),fileType:e.string().nullable(),fileSize:e.number().nullable(),createdAt:e.string().nullable(),state:e.enum(["present","absent","unknown"])}),p=e.object({reportHubId:e.number(),date:e.string().nullish(),createdAt:e.string().nullish(),author:e.string().nullish(),userId:e.string().nullish(),sourceType:e.string().nullish(),employeeName:e.string().nullish(),updatedBy:e.string().nullish(),updatedAt:e.string().nullish(),category:e.string().nullish(),creationCategory:e.string().nullish(),visitTimeFrom:e.string().nullish(),visitTimeTo:e.string().nullish(),customerName:e.string().nullish(),interviewers:e.array(k),subject:e.string().nullish(),content:e.string().nullish(),externalComments:e.array(w),isRead:e.boolean(),isStarred:e.boolean(),labels:e.array(C),postedComments:e.array(y),attachments:e.array(T).default([])}),M=e.object({type:e.literal("connected")}),$=e.object({type:e.literal("status-update"),reportHubId:e.number(),statusType:e.enum(["star","read"]),value:e.boolean(),clientTempId:e.string(),recipientRawUserId:e.number().optional()}),d=e.string().optional(),N=e.object({type:e.literal("comment-add"),reportHubId:e.number(),comment:y,clientTempId:e.string(),recipientRawUserId:e.number().optional(),sourceType:d}),A=e.object({type:e.literal("comment-delete"),reportHubId:e.number(),commentId:e.number(),clientTempId:e.string(),recipientRawUserId:e.number().optional(),sourceType:d}),H=e.object({type:e.literal("report-create"),reportHubId:e.number(),report:p,clientTempId:e.string(),recipientRawUserId:e.number().optional()}),j=e.object({type:e.literal("report-update"),reportHubId:e.number(),report:p,clientTempId:e.string(),recipientRawUserId:e.number().optional()}),U=e.object({type:e.literal("report-publish"),reportHubId:e.number(),report:p,clientTempId:e.string(),recipientRawUserId:e.number().optional()}),E=e.object({type:e.literal("report-delete"),reportHubId:e.number(),clientTempId:e.string(),sourceType:d}),Z=e.discriminatedUnion("type",[M,$,N,A,H,j,U,E]);var ee=r=>{if(!r)return"-";let t=r.trim();return t===""?"-":t},P=r=>{if(!r)return"-";if(typeof r!="string")return r instanceof Date?P(r.toISOString()):String(r);let t=r.trim();if(t==="")return"-";let n=t.match(/^(\d{4})[-/](\d{2})[-/](\d{2})$/);if(n)return`${n[1]}-${n[2]}-${n[3]}`;let s=new Date(t);if(Number.isNaN(s.getTime()))return t;let i=s.getFullYear(),o=String(s.getMonth()+1).padStart(2,"0"),a=String(s.getDate()).padStart(2,"0");if(t.includes(":")||t.includes("T")){let f=String(s.getHours()).padStart(2,"0"),x=String(s.getMinutes()).padStart(2,"0"),h=String(s.getSeconds()).padStart(2,"0");return`${i}-${o}-${a}T${f}:${x}:${h}`}return`${i}-${o}-${a}`};export{R as LogLevel,S as classifyIdsStreamLine,N as commentAddMessageSchema,A as commentDeleteMessageSchema,m as compareIdsStreamOrder,Y as computeIdsStreamSnapshotToken,M as connectedMessageSchema,Q as createLogger,T as dailyReportAttachmentItemSchema,p as dailyReportDetailSchema,w as dailyReportExternalCommentSchema,k as dailyReportInterviewerSchema,C as dailyReportLabelDefSchema,y as dailyReportPostedCommentSchema,Z as dailyReportSseMessageSchema,ee as fallbackText,J as findIdsStreamResumeIndex,B as formatBusinessDateDisplay,P as formatToIsoDate,K as isIdsStreamChunkLine,G as isIdsStreamOrdered,_ as mergeComments,g as normalizeBusinessDateKey,O as parseBusinessDateKeyToDate,H as reportCreateMessageSchema,E as reportDeleteMessageSchema,U as reportPublishMessageSchema,j as reportUpdateMessageSchema,L as resolveCommentColorClass,I as resolveTodayBusinessDateKey,$ as statusUpdateMessageSchema,W as upsertInIdsStreamOrder};
1
+ var h=/^\d{4}-\d{2}-\d{2}$/,D=/^\d{4}\/\d{2}\/\d{2}$/,u=r=>r<10?`0${r}`:`${r}`,c=r=>{if(Number.isNaN(r.getTime()))return null;let t=r.getFullYear(),n=u(r.getMonth()+1),s=u(r.getDate());return`${t}-${n}-${s}`},I=(r=new Date)=>Number.isNaN(r.getTime())?I(new Date):`${r.getFullYear()}-${u(r.getMonth()+1)}-${u(r.getDate())}`,g=r=>{if(r==null)return null;if(r instanceof Date)return c(r);let t=r.trim();if(t==="")return null;if(h.test(t))return t;if(D.test(t))return t.replaceAll("/","-");let n=new Date(t);return c(n)},j=r=>{let t=g(r);return t||null},L=r=>{let t=g(r);if(!t)return null;let[n,s,i]=t.split("-").map(o=>Number.parseInt(o,10));return[n,s,i].some(o=>Number.isNaN(o))?null:new Date(n,s-1,i)};var z=(r,t,n,s)=>{if(typeof s!="string"||s.trim()==="")throw new RangeError(`[daily-report] mergeComments: unknownAuthorName must be a non-blank string; got ${typeof s=="string"?JSON.stringify(s):typeof s}`);let i=r.map((a,l)=>({id:`legacy-${l}`,authorName:a.name||s,content:a.text||"",isMine:!1,color:a.color||void 0,isLegacy:!0})),o=t.map(a=>({id:a.id,authorName:a.userName||s,content:a.content??"",createdAt:a.createdAt??"",isMine:n?a.userId===n:a.isMine,isLegacy:!1}));return[...i,...o]},Y=r=>{if(!r)return"text-gray-700 dark:text-gray-300";let t=r.toLowerCase();return t.includes("red")||t.includes("\u8D64")?"text-red-600 dark:text-red-400":t.includes("green")||t.includes("\u7DD1")?"text-green-600 dark:text-green-400":t.includes("blue")||t.includes("\u9752")?"text-blue-600 dark:text-blue-400":t.includes("yellow")||t.includes("\u9EC4")?"text-yellow-600 dark:text-yellow-400":t.includes("orange")||t.includes("\u6A59")?"text-orange-500 dark:text-orange-400":"text-gray-700 dark:text-gray-300"};var S=r=>{if(typeof r!="object"||r===null)return"unknown";let t=r;return typeof t.kind=="string"?t.kind==="chunk"?"chunk":t.kind==="error"?"error":"unknown":Array.isArray(t.items)?"chunk":typeof t.error=="string"?"error":"unknown"},K=r=>S(r)==="chunk",q=r=>{let t=2166136261,n=-624069552;for(let s of r){let i=s.reportHubId;t^=i&255,t=Math.imul(t,16777619),t^=i>>>8&255,t=Math.imul(t,16777619),t^=i>>>16&255,t=Math.imul(t,16777619),t^=i>>>24&255,t=Math.imul(t,16777619),n^=i>>>24&255,n=Math.imul(n,16777619),n^=i>>>16&255,n=Math.imul(n,16777619),n^=i>>>8&255,n=Math.imul(n,16777619),n^=i&255,n=Math.imul(n,16777619);let o=s.businessDate;if(o===null)t^=1,t=Math.imul(t,16777619),n^=1,n=Math.imul(n,16777619);else for(let a=0;a<o.length;a++){let l=o.charCodeAt(a);t^=l&255,t=Math.imul(t,16777619),n^=l&255,n=Math.imul(n,16777619)}}return t^=r.length,t=Math.imul(t,16777619),n^=r.length,n=Math.imul(n,16777619),((t>>>0).toString(16).padStart(8,"0")+(n>>>0).toString(16).padStart(8,"0")).replace(/^0+(?=.)/,"")},m=(r,t)=>r.businessDate!==t.businessDate?r.businessDate===null?1:t.businessDate===null||r.businessDate>t.businessDate?-1:1:t.reportHubId-r.reportHubId,G=r=>{for(let t=1;t<r.length;t++)if(m(r[t-1],r[t])>0)return!1;return!0},V=(r,t)=>{let n=r.filter(o=>o.reportHubId!==t.reportHubId),s=0,i=n.length;for(;s<i;){let o=s+i>>1;m(n[o],t)<=0?s=o+1:i=o}return n.splice(s,0,t),n},W=(r,t)=>{let n=r.findIndex(s=>m({businessDate:s.businessDate,reportHubId:s.reportHubId},t)>0);return n===-1?r.length:n};var R=(o=>(o[o.DEBUG=0]="DEBUG",o[o.INFO=1]="INFO",o[o.WARN=2]="WARN",o[o.ERROR=3]="ERROR",o[o.NONE=4]="NONE",o))(R||{}),Q=(r,t,n=console)=>{let s=i=>typeof i=="string"?[`${t} ${i}`]:[t,i];return{debug:(i,...o)=>{r<=0&&n.debug(...s(i),...o)},info:(i,...o)=>{r<=1&&n.info(...s(i),...o)},warn:(i,...o)=>{r<=2&&n.warn(...s(i),...o)},error:(i,...o)=>{r<=3&&n.error(...s(i),...o)}}};import{z as e}from"zod";var v=["auth-required","forbidden","resync-required"],ee=15e3,te="lastEventId",k=/^\d{1,15}-\d{1,15}$/,re=r=>k.test(r),T=e.object({name:e.string().nullish(),affiliation:e.string().nullish()}),C=e.object({name:e.string().nullish(),text:e.string().nullish(),color:e.string().nullish()}),w=e.object({id:e.number(),name:e.string().nullish(),color:e.string().nullish()}),y=e.object({id:e.number(),userId:e.string().nullish(),userName:e.string().nullish(),content:e.string().nullish(),createdAt:e.string().nullish(),isMine:e.boolean()}),M=e.object({id:e.string(),fileName:e.string(),fileType:e.string().nullable(),fileSize:e.number().nullable(),createdAt:e.string().nullable(),state:e.enum(["present","absent","unknown"])}),p=e.object({reportHubId:e.number(),date:e.string().nullish(),createdAt:e.string().nullish(),author:e.string().nullish(),userId:e.string().nullish(),sourceType:e.string().nullish(),employeeName:e.string().nullish(),updatedBy:e.string().nullish(),updatedAt:e.string().nullish(),category:e.string().nullish(),creationCategory:e.string().nullish(),visitTimeFrom:e.string().nullish(),visitTimeTo:e.string().nullish(),customerName:e.string().nullish(),interviewers:e.array(T),subject:e.string().nullish(),content:e.string().nullish(),externalComments:e.array(C),isRead:e.boolean(),isStarred:e.boolean(),labels:e.array(w),postedComments:e.array(y),attachments:e.array(M).default([])}),E=e.object({type:e.literal("connected")}),A=e.object({type:e.literal("status-update"),reportHubId:e.number(),statusType:e.enum(["star","read"]),value:e.boolean(),clientTempId:e.string(),recipientRawUserId:e.number().optional()}),d=e.string().optional(),_=e.object({type:e.literal("comment-add"),reportHubId:e.number(),comment:y,clientTempId:e.string(),recipientRawUserId:e.number().optional(),sourceType:d}),N=e.object({type:e.literal("comment-delete"),reportHubId:e.number(),commentId:e.number(),clientTempId:e.string(),recipientRawUserId:e.number().optional(),sourceType:d}),$=e.object({type:e.literal("report-create"),reportHubId:e.number(),report:p,clientTempId:e.string(),recipientRawUserId:e.number().optional()}),P=e.object({type:e.literal("report-update"),reportHubId:e.number(),report:p,clientTempId:e.string(),recipientRawUserId:e.number().optional()}),H=e.object({type:e.literal("report-publish"),reportHubId:e.number(),report:p,clientTempId:e.string(),recipientRawUserId:e.number().optional()}),O=e.object({type:e.literal("report-delete"),reportHubId:e.number(),clientTempId:e.string(),sourceType:d}),ne=e.discriminatedUnion("type",[E,A,_,N,$,P,H,O]);var se=r=>{if(!r)return"-";let t=r.trim();return t===""?"-":t},U=r=>{if(!r)return"-";if(typeof r!="string")return r instanceof Date?U(r.toISOString()):String(r);let t=r.trim();if(t==="")return"-";let n=t.match(/^(\d{4})[-/](\d{2})[-/](\d{2})$/);if(n)return`${n[1]}-${n[2]}-${n[3]}`;let s=new Date(t);if(Number.isNaN(s.getTime()))return t;let i=s.getFullYear(),o=String(s.getMonth()+1).padStart(2,"0"),a=String(s.getDate()).padStart(2,"0");if(t.includes(":")||t.includes("T")){let f=String(s.getHours()).padStart(2,"0"),x=String(s.getMinutes()).padStart(2,"0"),b=String(s.getSeconds()).padStart(2,"0");return`${i}-${o}-${a}T${f}:${x}:${b}`}return`${i}-${o}-${a}`};export{te as DAILY_REPORT_SSE_CURSOR_PARAM,ee as DAILY_REPORT_SSE_HEARTBEAT_MS,v as DAILY_REPORT_SSE_TERMINAL_EVENTS,R as LogLevel,S as classifyIdsStreamLine,_ as commentAddMessageSchema,N as commentDeleteMessageSchema,m as compareIdsStreamOrder,q as computeIdsStreamSnapshotToken,E as connectedMessageSchema,Q as createLogger,M as dailyReportAttachmentItemSchema,p as dailyReportDetailSchema,C as dailyReportExternalCommentSchema,T as dailyReportInterviewerSchema,w as dailyReportLabelDefSchema,y as dailyReportPostedCommentSchema,ne as dailyReportSseMessageSchema,se as fallbackText,W as findIdsStreamResumeIndex,j as formatBusinessDateDisplay,U as formatToIsoDate,re as isDailyReportSseStreamId,K as isIdsStreamChunkLine,G as isIdsStreamOrdered,z as mergeComments,g as normalizeBusinessDateKey,L as parseBusinessDateKeyToDate,$ as reportCreateMessageSchema,O as reportDeleteMessageSchema,H as reportPublishMessageSchema,P as reportUpdateMessageSchema,Y as resolveCommentColorClass,I as resolveTodayBusinessDateKey,A as statusUpdateMessageSchema,V as upsertInIdsStreamOrder};
package/dist/server.d.mts CHANGED
@@ -1507,6 +1507,10 @@ type DailyReportServiceConfig = {
1507
1507
  logger?: DailyReportLogger;
1508
1508
  };
1509
1509
  type DailyReportService = ReturnType<typeof createDailyReportService>;
1510
+ type DailyReportIdsSource = {
1511
+ readonly items: DailyReportItem[];
1512
+ readonly streamAnchor: string | null;
1513
+ };
1510
1514
  type DatePattern = "YYYY-MM-DD HH:mm:ss" | "YYYY-MM-DD";
1511
1515
  declare const formatDateValue: (value: Date | string | null | undefined, pattern: DatePattern) => string | null;
1512
1516
  declare function createDailyReportService(config: DailyReportServiceConfig): {
@@ -1517,8 +1521,9 @@ declare function createDailyReportService(config: DailyReportServiceConfig): {
1517
1521
  getUserIdByExternalId: (externalId: string) => Promise<number | null>;
1518
1522
  getDailyReportIdsByExternalId: (scope: DailyReportViewerScope, externalId: string, { forceRefresh, snapshot, ttlMsOverride, onFetchStart }?: SqlResultCacheQueryOptions & {
1519
1523
  onFetchStart?: () => void;
1520
- }) => Promise<DailyReportItem[]>;
1524
+ }) => Promise<DailyReportIdsSource>;
1521
1525
  getDailyReportIdsFirstPageByExternalId: (scope: DailyReportViewerScope, externalId: string, limit: number) => Promise<DailyReportItem[]>;
1526
+ readSseStreamAnchor: () => Promise<string | null>;
1522
1527
  getDailyReportsByBusinessDate: (scope: DailyReportViewerScope, businessDate: string, { forceRefresh, snapshot, ttlMsOverride }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail[]>;
1523
1528
  getDailyReportsByBusinessDateByExternalId: (scope: DailyReportViewerScope, businessDate: string, externalId: string, { forceRefresh, snapshot, ttlMsOverride }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail[]>;
1524
1529
  getDailyReportDetailById: (scope: DailyReportViewerScope, reportHubId: number, userId: number, { forceRefresh, snapshot, ttlMsOverride }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail | null>;
@@ -1600,6 +1605,8 @@ type LoaderArgs = {
1600
1605
  request: Request;
1601
1606
  params: Record<string, string | undefined>;
1602
1607
  };
1608
+ declare const DAILY_REPORT_SSE_VISIBILITY_REFRESH_MS = 60000;
1609
+ declare const DAILY_REPORT_SSE_CATCH_UP_BATCH = 1000;
1603
1610
  declare const sanitizeMediaType: (value: string | null | undefined) => string | null;
1604
1611
  declare const encodeRfc8187: (name: string) => string;
1605
1612
  declare const asciiFallbackFileName: (name: string) => string;
@@ -1701,8 +1708,9 @@ declare function createDailyReportServer(config: DailyReportServerConfig): {
1701
1708
  getUserIdByExternalId: (externalId: string) => Promise<number | null>;
1702
1709
  getDailyReportIdsByExternalId: (scope: DailyReportViewerScope, externalId: string, { forceRefresh, snapshot, ttlMsOverride, onFetchStart }?: SqlResultCacheQueryOptions & {
1703
1710
  onFetchStart?: () => void;
1704
- }) => Promise<DailyReportItem[]>;
1711
+ }) => Promise<DailyReportIdsSource>;
1705
1712
  getDailyReportIdsFirstPageByExternalId: (scope: DailyReportViewerScope, externalId: string, limit: number) => Promise<DailyReportItem[]>;
1713
+ readSseStreamAnchor: () => Promise<string | null>;
1706
1714
  getDailyReportsByBusinessDate: (scope: DailyReportViewerScope, businessDate: string, { forceRefresh, snapshot, ttlMsOverride }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail[]>;
1707
1715
  getDailyReportsByBusinessDateByExternalId: (scope: DailyReportViewerScope, businessDate: string, externalId: string, { forceRefresh, snapshot, ttlMsOverride }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail[]>;
1708
1716
  getDailyReportDetailById: (scope: DailyReportViewerScope, reportHubId: number, userId: number, { forceRefresh, snapshot, ttlMsOverride }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail | null>;
@@ -1742,4 +1750,4 @@ declare function createDailyReportServer(config: DailyReportServerConfig): {
1742
1750
  streamKey: string;
1743
1751
  knownSourceTypes: readonly string[];
1744
1752
  };
1745
- export { type AuthzResourceItem, type DailyReportAttachmentBytes, type DailyReportAttachmentError, type DailyReportAttachmentFailure, type DailyReportAttachmentTable, type DailyReportAuthResult, type DailyReportAuthenticate, type DailyReportCommentRow, type DailyReportCommentTable, type DailyReportDb, type DailyReportEncodeUserId, type DailyReportExternalSource, type DailyReportHandlersConfig, type DailyReportHubLabelTable, type DailyReportHubRow, type DailyReportHubTable, type DailyReportIdCodec, type DailyReportInternalRow, type DailyReportInternalTable, type DailyReportLabelTable, type DailyReportReadAttachment, type DailyReportRedisBlockingClient, type DailyReportRedisClient, type DailyReportRedisProvider, type DailyReportResolveUserId, type DailyReportResolveVisibleSourceTypes, type DailyReportServerConfig, type DailyReportService, type DailyReportServiceConfig, type DailyReportSourceTypeInput, DailyReportSseReader, type DailyReportSseReaderConfig, type DailyReportTables, type DailyReportUserStatusRow, type DailyReportUserStatusTable, type DailyReportUserTable, DailyReportViewerScope, type DailyReportVisibilityDimensions, type DailyReportVisibilityResolveContext, type DailyReportVisibilityResolveReason, type DailyReportVisibleSourceTypes, type EpochStore, type ExternalReportFields, type RedisStreamMessage, SqlResultCache, type SqlResultCacheQueryOptions, type StreamEntry, type VisibleSourceTypeSet, asciiFallbackFileName, buildVisibleSourceTypeCondition, computeSourceTypeDigest, computeViewerScopeDigest, createDailyReportHandlers, createDailyReportServer, createDailyReportService, createEpochStore, defineDailyReportAuthzResources, defineDailyReportSchema, deniesEverySourceType, encodeRfc8187, formatDateValue, generateETag, isSourceTypeVisible, isStreamIdLte, jsonResponseWithETag, normalizeVisibleSourceTypes, sanitizeMediaType, seedDailyReportAuthzResources, transformJsonArray };
1753
+ export { type AuthzResourceItem, DAILY_REPORT_SSE_CATCH_UP_BATCH, DAILY_REPORT_SSE_VISIBILITY_REFRESH_MS, type DailyReportAttachmentBytes, type DailyReportAttachmentError, type DailyReportAttachmentFailure, type DailyReportAttachmentTable, type DailyReportAuthResult, type DailyReportAuthenticate, type DailyReportCommentRow, type DailyReportCommentTable, type DailyReportDb, type DailyReportEncodeUserId, type DailyReportExternalSource, type DailyReportHandlersConfig, type DailyReportHubLabelTable, type DailyReportHubRow, type DailyReportHubTable, type DailyReportIdCodec, type DailyReportIdsSource, type DailyReportInternalRow, type DailyReportInternalTable, type DailyReportLabelTable, type DailyReportReadAttachment, type DailyReportRedisBlockingClient, type DailyReportRedisClient, type DailyReportRedisProvider, type DailyReportResolveUserId, type DailyReportResolveVisibleSourceTypes, type DailyReportServerConfig, type DailyReportService, type DailyReportServiceConfig, type DailyReportSourceTypeInput, DailyReportSseReader, type DailyReportSseReaderConfig, type DailyReportTables, type DailyReportUserStatusRow, type DailyReportUserStatusTable, type DailyReportUserTable, DailyReportViewerScope, type DailyReportVisibilityDimensions, type DailyReportVisibilityResolveContext, type DailyReportVisibilityResolveReason, type DailyReportVisibleSourceTypes, type EpochStore, type ExternalReportFields, type RedisStreamMessage, SqlResultCache, type SqlResultCacheQueryOptions, type StreamEntry, type VisibleSourceTypeSet, asciiFallbackFileName, buildVisibleSourceTypeCondition, computeSourceTypeDigest, computeViewerScopeDigest, createDailyReportHandlers, createDailyReportServer, createDailyReportService, createEpochStore, defineDailyReportAuthzResources, defineDailyReportSchema, deniesEverySourceType, encodeRfc8187, formatDateValue, generateETag, isSourceTypeVisible, isStreamIdLte, jsonResponseWithETag, normalizeVisibleSourceTypes, sanitizeMediaType, seedDailyReportAuthzResources, transformJsonArray };
package/dist/server.d.ts CHANGED
@@ -1507,6 +1507,10 @@ type DailyReportServiceConfig = {
1507
1507
  logger?: DailyReportLogger;
1508
1508
  };
1509
1509
  type DailyReportService = ReturnType<typeof createDailyReportService>;
1510
+ type DailyReportIdsSource = {
1511
+ readonly items: DailyReportItem[];
1512
+ readonly streamAnchor: string | null;
1513
+ };
1510
1514
  type DatePattern = "YYYY-MM-DD HH:mm:ss" | "YYYY-MM-DD";
1511
1515
  declare const formatDateValue: (value: Date | string | null | undefined, pattern: DatePattern) => string | null;
1512
1516
  declare function createDailyReportService(config: DailyReportServiceConfig): {
@@ -1517,8 +1521,9 @@ declare function createDailyReportService(config: DailyReportServiceConfig): {
1517
1521
  getUserIdByExternalId: (externalId: string) => Promise<number | null>;
1518
1522
  getDailyReportIdsByExternalId: (scope: DailyReportViewerScope, externalId: string, { forceRefresh, snapshot, ttlMsOverride, onFetchStart }?: SqlResultCacheQueryOptions & {
1519
1523
  onFetchStart?: () => void;
1520
- }) => Promise<DailyReportItem[]>;
1524
+ }) => Promise<DailyReportIdsSource>;
1521
1525
  getDailyReportIdsFirstPageByExternalId: (scope: DailyReportViewerScope, externalId: string, limit: number) => Promise<DailyReportItem[]>;
1526
+ readSseStreamAnchor: () => Promise<string | null>;
1522
1527
  getDailyReportsByBusinessDate: (scope: DailyReportViewerScope, businessDate: string, { forceRefresh, snapshot, ttlMsOverride }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail[]>;
1523
1528
  getDailyReportsByBusinessDateByExternalId: (scope: DailyReportViewerScope, businessDate: string, externalId: string, { forceRefresh, snapshot, ttlMsOverride }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail[]>;
1524
1529
  getDailyReportDetailById: (scope: DailyReportViewerScope, reportHubId: number, userId: number, { forceRefresh, snapshot, ttlMsOverride }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail | null>;
@@ -1600,6 +1605,8 @@ type LoaderArgs = {
1600
1605
  request: Request;
1601
1606
  params: Record<string, string | undefined>;
1602
1607
  };
1608
+ declare const DAILY_REPORT_SSE_VISIBILITY_REFRESH_MS = 60000;
1609
+ declare const DAILY_REPORT_SSE_CATCH_UP_BATCH = 1000;
1603
1610
  declare const sanitizeMediaType: (value: string | null | undefined) => string | null;
1604
1611
  declare const encodeRfc8187: (name: string) => string;
1605
1612
  declare const asciiFallbackFileName: (name: string) => string;
@@ -1701,8 +1708,9 @@ declare function createDailyReportServer(config: DailyReportServerConfig): {
1701
1708
  getUserIdByExternalId: (externalId: string) => Promise<number | null>;
1702
1709
  getDailyReportIdsByExternalId: (scope: DailyReportViewerScope, externalId: string, { forceRefresh, snapshot, ttlMsOverride, onFetchStart }?: SqlResultCacheQueryOptions & {
1703
1710
  onFetchStart?: () => void;
1704
- }) => Promise<DailyReportItem[]>;
1711
+ }) => Promise<DailyReportIdsSource>;
1705
1712
  getDailyReportIdsFirstPageByExternalId: (scope: DailyReportViewerScope, externalId: string, limit: number) => Promise<DailyReportItem[]>;
1713
+ readSseStreamAnchor: () => Promise<string | null>;
1706
1714
  getDailyReportsByBusinessDate: (scope: DailyReportViewerScope, businessDate: string, { forceRefresh, snapshot, ttlMsOverride }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail[]>;
1707
1715
  getDailyReportsByBusinessDateByExternalId: (scope: DailyReportViewerScope, businessDate: string, externalId: string, { forceRefresh, snapshot, ttlMsOverride }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail[]>;
1708
1716
  getDailyReportDetailById: (scope: DailyReportViewerScope, reportHubId: number, userId: number, { forceRefresh, snapshot, ttlMsOverride }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail | null>;
@@ -1742,4 +1750,4 @@ declare function createDailyReportServer(config: DailyReportServerConfig): {
1742
1750
  streamKey: string;
1743
1751
  knownSourceTypes: readonly string[];
1744
1752
  };
1745
- export { type AuthzResourceItem, type DailyReportAttachmentBytes, type DailyReportAttachmentError, type DailyReportAttachmentFailure, type DailyReportAttachmentTable, type DailyReportAuthResult, type DailyReportAuthenticate, type DailyReportCommentRow, type DailyReportCommentTable, type DailyReportDb, type DailyReportEncodeUserId, type DailyReportExternalSource, type DailyReportHandlersConfig, type DailyReportHubLabelTable, type DailyReportHubRow, type DailyReportHubTable, type DailyReportIdCodec, type DailyReportInternalRow, type DailyReportInternalTable, type DailyReportLabelTable, type DailyReportReadAttachment, type DailyReportRedisBlockingClient, type DailyReportRedisClient, type DailyReportRedisProvider, type DailyReportResolveUserId, type DailyReportResolveVisibleSourceTypes, type DailyReportServerConfig, type DailyReportService, type DailyReportServiceConfig, type DailyReportSourceTypeInput, DailyReportSseReader, type DailyReportSseReaderConfig, type DailyReportTables, type DailyReportUserStatusRow, type DailyReportUserStatusTable, type DailyReportUserTable, DailyReportViewerScope, type DailyReportVisibilityDimensions, type DailyReportVisibilityResolveContext, type DailyReportVisibilityResolveReason, type DailyReportVisibleSourceTypes, type EpochStore, type ExternalReportFields, type RedisStreamMessage, SqlResultCache, type SqlResultCacheQueryOptions, type StreamEntry, type VisibleSourceTypeSet, asciiFallbackFileName, buildVisibleSourceTypeCondition, computeSourceTypeDigest, computeViewerScopeDigest, createDailyReportHandlers, createDailyReportServer, createDailyReportService, createEpochStore, defineDailyReportAuthzResources, defineDailyReportSchema, deniesEverySourceType, encodeRfc8187, formatDateValue, generateETag, isSourceTypeVisible, isStreamIdLte, jsonResponseWithETag, normalizeVisibleSourceTypes, sanitizeMediaType, seedDailyReportAuthzResources, transformJsonArray };
1753
+ export { type AuthzResourceItem, DAILY_REPORT_SSE_CATCH_UP_BATCH, DAILY_REPORT_SSE_VISIBILITY_REFRESH_MS, type DailyReportAttachmentBytes, type DailyReportAttachmentError, type DailyReportAttachmentFailure, type DailyReportAttachmentTable, type DailyReportAuthResult, type DailyReportAuthenticate, type DailyReportCommentRow, type DailyReportCommentTable, type DailyReportDb, type DailyReportEncodeUserId, type DailyReportExternalSource, type DailyReportHandlersConfig, type DailyReportHubLabelTable, type DailyReportHubRow, type DailyReportHubTable, type DailyReportIdCodec, type DailyReportIdsSource, type DailyReportInternalRow, type DailyReportInternalTable, type DailyReportLabelTable, type DailyReportReadAttachment, type DailyReportRedisBlockingClient, type DailyReportRedisClient, type DailyReportRedisProvider, type DailyReportResolveUserId, type DailyReportResolveVisibleSourceTypes, type DailyReportServerConfig, type DailyReportService, type DailyReportServiceConfig, type DailyReportSourceTypeInput, DailyReportSseReader, type DailyReportSseReaderConfig, type DailyReportTables, type DailyReportUserStatusRow, type DailyReportUserStatusTable, type DailyReportUserTable, DailyReportViewerScope, type DailyReportVisibilityDimensions, type DailyReportVisibilityResolveContext, type DailyReportVisibilityResolveReason, type DailyReportVisibleSourceTypes, type EpochStore, type ExternalReportFields, type RedisStreamMessage, SqlResultCache, type SqlResultCacheQueryOptions, type StreamEntry, type VisibleSourceTypeSet, asciiFallbackFileName, buildVisibleSourceTypeCondition, computeSourceTypeDigest, computeViewerScopeDigest, createDailyReportHandlers, createDailyReportServer, createDailyReportService, createEpochStore, defineDailyReportAuthzResources, defineDailyReportSchema, deniesEverySourceType, encodeRfc8187, formatDateValue, generateETag, isSourceTypeVisible, isStreamIdLte, jsonResponseWithETag, normalizeVisibleSourceTypes, sanitizeMediaType, seedDailyReportAuthzResources, transformJsonArray };