@aiquants/daily-report 0.27.0 → 0.29.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,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { d as DailyReportExternalComment, g as DailyReportPostedComment, D as DailyReportItem } from "./types-DkERw8NE.js";
2
+ import { e as DailyReportExternalComment, i as DailyReportPostedComment } from "./ids-stream-CWuIDrIO.js";
3
3
  declare const DAILY_REPORT_SSE_TERMINAL_EVENTS: readonly [
4
4
  "auth-required",
5
5
  "forbidden",
@@ -2491,24 +2491,4 @@ type UIComment = {
2491
2491
  isLegacy: boolean;
2492
2492
  };
2493
2493
  declare const mergeComments: (legacyComments: DailyReportExternalComment[], modernComments: DailyReportPostedComment[], currentUserId: string | null | undefined, unknownAuthorName: string) => UIComment[];
2494
- type DailyReportIdsStreamCursor = {
2495
- businessDate: string | null;
2496
- reportHubId: number;
2497
- };
2498
- type DailyReportIdsStreamChunkLine = {
2499
- kind: "chunk";
2500
- items: DailyReportItem[];
2501
- nextCursor: DailyReportIdsStreamCursor | null;
2502
- isLast: boolean;
2503
- total?: number;
2504
- provisional?: boolean;
2505
- snapshot?: string;
2506
- restarted?: boolean;
2507
- streamAnchor?: string | null;
2508
- };
2509
- type DailyReportSseStreamAnchor = {
2510
- readonly lastEventId: string | null;
2511
- readonly revision: number;
2512
- };
2513
- declare const isIdsStreamChunkLine: (line: unknown) => line is DailyReportIdsStreamChunkLine;
2514
- export { type DailyReportSseTerminalEvent as D, 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, commentAddMessageSchema as g, commentDeleteMessageSchema as h, connectedMessageSchema as i, dailyReportDetailSchema as j, dailyReportExternalCommentSchema as k, dailyReportInterviewerSchema as l, dailyReportLabelDefSchema as m, dailyReportPostedCommentSchema as n, dailyReportSseMessageSchema as o, isDailyReportSseStreamId as p, isIdsStreamChunkLine as q, mergeComments as r, reportCreateMessageSchema as s, reportDeleteMessageSchema as t, reportPublishMessageSchema as u, reportUpdateMessageSchema as v, statusUpdateMessageSchema as w };
2494
+ export { type DailyReportSseTerminalEvent as D, type UIComment as U, type DailyReportSseMessage as a, DAILY_REPORT_SSE_CURSOR_PARAM as b, DAILY_REPORT_SSE_HEARTBEAT_MS as c, DAILY_REPORT_SSE_TERMINAL_EVENTS as d, commentAddMessageSchema as e, commentDeleteMessageSchema as f, connectedMessageSchema as g, dailyReportDetailSchema as h, dailyReportExternalCommentSchema as i, dailyReportInterviewerSchema as j, dailyReportLabelDefSchema as k, dailyReportPostedCommentSchema as l, dailyReportSseMessageSchema as m, isDailyReportSseStreamId as n, mergeComments as o, reportDeleteMessageSchema as p, reportPublishMessageSchema as q, reportCreateMessageSchema as r, reportUpdateMessageSchema as s, statusUpdateMessageSchema as t };
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod";
2
- import { d as DailyReportExternalComment, g as DailyReportPostedComment, D as DailyReportItem } from "./types-DkERw8NE.mjs";
2
+ import { e as DailyReportExternalComment, i as DailyReportPostedComment } from "./ids-stream-CWuIDrIO.mjs";
3
3
  declare const DAILY_REPORT_SSE_TERMINAL_EVENTS: readonly [
4
4
  "auth-required",
5
5
  "forbidden",
@@ -2491,24 +2491,4 @@ type UIComment = {
2491
2491
  isLegacy: boolean;
2492
2492
  };
2493
2493
  declare const mergeComments: (legacyComments: DailyReportExternalComment[], modernComments: DailyReportPostedComment[], currentUserId: string | null | undefined, unknownAuthorName: string) => UIComment[];
2494
- type DailyReportIdsStreamCursor = {
2495
- businessDate: string | null;
2496
- reportHubId: number;
2497
- };
2498
- type DailyReportIdsStreamChunkLine = {
2499
- kind: "chunk";
2500
- items: DailyReportItem[];
2501
- nextCursor: DailyReportIdsStreamCursor | null;
2502
- isLast: boolean;
2503
- total?: number;
2504
- provisional?: boolean;
2505
- snapshot?: string;
2506
- restarted?: boolean;
2507
- streamAnchor?: string | null;
2508
- };
2509
- type DailyReportSseStreamAnchor = {
2510
- readonly lastEventId: string | null;
2511
- readonly revision: number;
2512
- };
2513
- declare const isIdsStreamChunkLine: (line: unknown) => line is DailyReportIdsStreamChunkLine;
2514
- export { type DailyReportSseTerminalEvent as D, 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, commentAddMessageSchema as g, commentDeleteMessageSchema as h, connectedMessageSchema as i, dailyReportDetailSchema as j, dailyReportExternalCommentSchema as k, dailyReportInterviewerSchema as l, dailyReportLabelDefSchema as m, dailyReportPostedCommentSchema as n, dailyReportSseMessageSchema as o, isDailyReportSseStreamId as p, isIdsStreamChunkLine as q, mergeComments as r, reportCreateMessageSchema as s, reportDeleteMessageSchema as t, reportPublishMessageSchema as u, reportUpdateMessageSchema as v, statusUpdateMessageSchema as w };
2494
+ export { type DailyReportSseTerminalEvent as D, type UIComment as U, type DailyReportSseMessage as a, DAILY_REPORT_SSE_CURSOR_PARAM as b, DAILY_REPORT_SSE_HEARTBEAT_MS as c, DAILY_REPORT_SSE_TERMINAL_EVENTS as d, commentAddMessageSchema as e, commentDeleteMessageSchema as f, connectedMessageSchema as g, dailyReportDetailSchema as h, dailyReportExternalCommentSchema as i, dailyReportInterviewerSchema as j, dailyReportLabelDefSchema as k, dailyReportPostedCommentSchema as l, dailyReportSseMessageSchema as m, isDailyReportSseStreamId as n, mergeComments as o, reportDeleteMessageSchema as p, reportPublishMessageSchema as q, reportCreateMessageSchema as r, reportUpdateMessageSchema as s, statusUpdateMessageSchema as t };
@@ -71,4 +71,25 @@ type DailyReportUser = {
71
71
  value: string;
72
72
  }[];
73
73
  };
74
- export type { DailyReportItem as D, DailyReportUser as a, DailyReportDetail as b, DailyReportAttachmentSummary as c, DailyReportExternalComment as d, DailyReportInterviewer as e, DailyReportLabelDef as f, DailyReportPostedComment as g };
74
+ declare const DAILY_REPORT_IDS_STREAM_ENDPOINT = "ids-stream";
75
+ type DailyReportIdsStreamCursor = {
76
+ businessDate: string | null;
77
+ reportHubId: number;
78
+ };
79
+ type DailyReportIdsStreamChunkLine = {
80
+ kind: "chunk";
81
+ items: DailyReportItem[];
82
+ nextCursor: DailyReportIdsStreamCursor | null;
83
+ isLast: boolean;
84
+ total?: number;
85
+ provisional?: boolean;
86
+ snapshot?: string;
87
+ restarted?: boolean;
88
+ streamAnchor?: string | null;
89
+ };
90
+ type DailyReportSseStreamAnchor = {
91
+ readonly lastEventId: string | null;
92
+ readonly revision: number;
93
+ };
94
+ declare const isIdsStreamChunkLine: (line: unknown) => line is DailyReportIdsStreamChunkLine;
95
+ export { type DailyReportItem as D, type DailyReportUser as a, type DailyReportDetail as b, type DailyReportSseStreamAnchor as c, type DailyReportAttachmentSummary as d, type DailyReportExternalComment as e, type DailyReportIdsStreamChunkLine as f, type DailyReportInterviewer as g, type DailyReportLabelDef as h, type DailyReportPostedComment as i, isIdsStreamChunkLine as j, DAILY_REPORT_IDS_STREAM_ENDPOINT as k };
@@ -71,4 +71,25 @@ type DailyReportUser = {
71
71
  value: string;
72
72
  }[];
73
73
  };
74
- export type { DailyReportItem as D, DailyReportUser as a, DailyReportDetail as b, DailyReportAttachmentSummary as c, DailyReportExternalComment as d, DailyReportInterviewer as e, DailyReportLabelDef as f, DailyReportPostedComment as g };
74
+ declare const DAILY_REPORT_IDS_STREAM_ENDPOINT = "ids-stream";
75
+ type DailyReportIdsStreamCursor = {
76
+ businessDate: string | null;
77
+ reportHubId: number;
78
+ };
79
+ type DailyReportIdsStreamChunkLine = {
80
+ kind: "chunk";
81
+ items: DailyReportItem[];
82
+ nextCursor: DailyReportIdsStreamCursor | null;
83
+ isLast: boolean;
84
+ total?: number;
85
+ provisional?: boolean;
86
+ snapshot?: string;
87
+ restarted?: boolean;
88
+ streamAnchor?: string | null;
89
+ };
90
+ type DailyReportSseStreamAnchor = {
91
+ readonly lastEventId: string | null;
92
+ readonly revision: number;
93
+ };
94
+ declare const isIdsStreamChunkLine: (line: unknown) => line is DailyReportIdsStreamChunkLine;
95
+ export { type DailyReportItem as D, type DailyReportUser as a, type DailyReportDetail as b, type DailyReportSseStreamAnchor as c, type DailyReportAttachmentSummary as d, type DailyReportExternalComment as e, type DailyReportIdsStreamChunkLine as f, type DailyReportInterviewer as g, type DailyReportLabelDef as h, type DailyReportPostedComment as i, isIdsStreamChunkLine as j, DAILY_REPORT_IDS_STREAM_ENDPOINT as k };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
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, a as DailyReportSseMessage, b as DailyReportSseStreamAnchor, g as commentAddMessageSchema, h as commentDeleteMessageSchema, i as connectedMessageSchema, j as dailyReportDetailSchema, k as dailyReportExternalCommentSchema, l as dailyReportInterviewerSchema, m as dailyReportLabelDefSchema, n as dailyReportPostedCommentSchema, o as dailyReportSseMessageSchema, p as isDailyReportSseStreamId, q as isIdsStreamChunkLine, r as mergeComments, s as reportCreateMessageSchema, t as reportDeleteMessageSchema, u as reportPublishMessageSchema, v as reportUpdateMessageSchema, w as statusUpdateMessageSchema } from "./ids-stream-DvB2h1dj.mjs";
2
- export { c as DailyReportAttachmentSummary, b as DailyReportDetail, d as DailyReportExternalComment, e as DailyReportInterviewer, D as DailyReportItem, f as DailyReportLabelDef, g as DailyReportPostedComment, a as DailyReportUser } from "./types-DkERw8NE.mjs";
1
+ export { b as DAILY_REPORT_SSE_CURSOR_PARAM, c as DAILY_REPORT_SSE_HEARTBEAT_MS, d as DAILY_REPORT_SSE_TERMINAL_EVENTS, a as DailyReportSseMessage, e as commentAddMessageSchema, f as commentDeleteMessageSchema, g as connectedMessageSchema, h as dailyReportDetailSchema, i as dailyReportExternalCommentSchema, j as dailyReportInterviewerSchema, k as dailyReportLabelDefSchema, l as dailyReportPostedCommentSchema, m as dailyReportSseMessageSchema, n as isDailyReportSseStreamId, o as mergeComments, r as reportCreateMessageSchema, p as reportDeleteMessageSchema, q as reportPublishMessageSchema, s as reportUpdateMessageSchema, t as statusUpdateMessageSchema } from "./comment-adapter-lV2ZB_vH.mjs";
2
+ export { d as DailyReportAttachmentSummary, b as DailyReportDetail, e as DailyReportExternalComment, f as DailyReportIdsStreamChunkLine, g as DailyReportInterviewer, D as DailyReportItem, h as DailyReportLabelDef, i as DailyReportPostedComment, c as DailyReportSseStreamAnchor, a as DailyReportUser, j as isIdsStreamChunkLine } from "./ids-stream-CWuIDrIO.mjs";
3
3
  import "zod";
4
4
  type DailyReportAttachmentThumbnailBox = {
5
5
  readonly maxWidth: number;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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, a as DailyReportSseMessage, b as DailyReportSseStreamAnchor, g as commentAddMessageSchema, h as commentDeleteMessageSchema, i as connectedMessageSchema, j as dailyReportDetailSchema, k as dailyReportExternalCommentSchema, l as dailyReportInterviewerSchema, m as dailyReportLabelDefSchema, n as dailyReportPostedCommentSchema, o as dailyReportSseMessageSchema, p as isDailyReportSseStreamId, q as isIdsStreamChunkLine, r as mergeComments, s as reportCreateMessageSchema, t as reportDeleteMessageSchema, u as reportPublishMessageSchema, v as reportUpdateMessageSchema, w as statusUpdateMessageSchema } from "./ids-stream-BR5RSj5u.js";
2
- export { c as DailyReportAttachmentSummary, b as DailyReportDetail, d as DailyReportExternalComment, e as DailyReportInterviewer, D as DailyReportItem, f as DailyReportLabelDef, g as DailyReportPostedComment, a as DailyReportUser } from "./types-DkERw8NE.js";
1
+ export { b as DAILY_REPORT_SSE_CURSOR_PARAM, c as DAILY_REPORT_SSE_HEARTBEAT_MS, d as DAILY_REPORT_SSE_TERMINAL_EVENTS, a as DailyReportSseMessage, e as commentAddMessageSchema, f as commentDeleteMessageSchema, g as connectedMessageSchema, h as dailyReportDetailSchema, i as dailyReportExternalCommentSchema, j as dailyReportInterviewerSchema, k as dailyReportLabelDefSchema, l as dailyReportPostedCommentSchema, m as dailyReportSseMessageSchema, n as isDailyReportSseStreamId, o as mergeComments, r as reportCreateMessageSchema, p as reportDeleteMessageSchema, q as reportPublishMessageSchema, s as reportUpdateMessageSchema, t as statusUpdateMessageSchema } from "./comment-adapter-5bAtR4qb.js";
2
+ export { d as DailyReportAttachmentSummary, b as DailyReportDetail, e as DailyReportExternalComment, f as DailyReportIdsStreamChunkLine, g as DailyReportInterviewer, D as DailyReportItem, h as DailyReportLabelDef, i as DailyReportPostedComment, c as DailyReportSseStreamAnchor, a as DailyReportUser, j as isIdsStreamChunkLine } from "./ids-stream-CWuIDrIO.js";
3
3
  import "zod";
4
4
  type DailyReportAttachmentThumbnailBox = {
5
5
  readonly maxWidth: number;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var p=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var q=(t,r)=>{for(var n in r)p(t,n,{get:r[n],enumerable:!0})},F=(t,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of z(r))!Y.call(t,i)&&i!==n&&p(t,i,{get:()=>r[i],enumerable:!(o=V(r,i))||o.enumerable});return t};var K=t=>F(p({},"__esModule",{value:!0}),t);var ee={};q(ee,{DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS:()=>u,DAILY_REPORT_SSE_CURSOR_PARAM:()=>O,DAILY_REPORT_SSE_HEARTBEAT_MS:()=>H,DAILY_REPORT_SSE_TERMINAL_EVENTS:()=>U,buildDailyReportAttachmentUrl:()=>E,commentAddMessageSchema:()=>D,commentDeleteMessageSchema:()=>b,connectedMessageSchema:()=>h,dailyReportDetailSchema:()=>s,dailyReportExternalCommentSchema:()=>c,dailyReportInterviewerSchema:()=>d,dailyReportLabelDefSchema:()=>y,dailyReportPostedCommentSchema:()=>m,dailyReportSseMessageSchema:()=>j,isDailyReportAttachmentThumbnailVariant:()=>l,isDailyReportSseStreamId:()=>$,isIdsStreamChunkLine:()=>P,mergeComments:()=>N,normalizeBusinessDateKey:()=>L,parseDailyReportAttachmentQuery:()=>C,reportCreateMessageSchema:()=>f,reportDeleteMessageSchema:()=>I,reportPublishMessageSchema:()=>S,reportUpdateMessageSchema:()=>x,statusUpdateMessageSchema:()=>g});module.exports=K(ee);var u=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),l=t=>Object.hasOwn(u,t);var A="download",T="thumbnail",_="1",E=(t,r,n)=>{let o=`${t}/attachment/${encodeURIComponent(r)}`;switch(n.kind){case"inline":return o;case"download":return`${o}?${new URLSearchParams({[A]:_})}`;case"thumbnail":return`${o}?${new URLSearchParams({[T]:n.variant})}`}},C=t=>{let r=t.getAll(T),n=t.getAll(A);if(r.length>0&&n.length>0)return{kind:"invalid",reason:"conflict"};if(r.length>0){let[o]=r;return r.length===1&&l(o)?{kind:"thumbnail",variant:o}:{kind:"invalid",reason:"thumbnail_variant"}}return n.length>0?n.length===1&&n[0]===_?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var Q=/^\d{4}-\d{2}-\d{2}$/,W=/^\d{4}\/\d{2}\/\d{2}$/,M=t=>t<10?`0${t}`:`${t}`,k=t=>{if(Number.isNaN(t.getTime()))return null;let r=t.getFullYear(),n=M(t.getMonth()+1),o=M(t.getDate());return`${r}-${n}-${o}`};var L=t=>{if(t==null)return null;if(t instanceof Date)return k(t);let r=t.trim();if(r==="")return null;if(Q.test(r))return r;if(W.test(r))return r.replaceAll("/","-");let n=new Date(r);return k(n)};var J=t=>typeof t=="string"?JSON.stringify(t):typeof t=="number"||typeof t=="boolean"||t===null||t===void 0?String(t):Array.isArray(t)?"array":typeof t,w=(t,r,n)=>new RangeError(`[daily-report] ${t} must be ${r}; got ${J(n)}`);var N=(t,r,n,o)=>{if(typeof o!="string"||o.trim()==="")throw w("mergeComments: unknownAuthorName","a non-blank string",o);let i=t.map((a,B)=>({id:`legacy-${B}`,authorName:a.name||o,content:a.text||"",isMine:!1,color:a.color||void 0,isLegacy:!0})),v=r.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[...i,...v]};var G=t=>{if(typeof t!="object"||t===null)return"unknown";let r=t;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"},P=t=>G(t)==="chunk";var e=require("zod"),U=["auth-required","forbidden","resync-required"],H=15e3,O="lastEventId",X=/^\d{1,15}-\d{1,15}$/,$=t=>X.test(t),d=e.z.object({name:e.z.string().nullish(),affiliation:e.z.string().nullish()}),c=e.z.object({name:e.z.string().nullish(),text:e.z.string().nullish(),color:e.z.string().nullish()}),y=e.z.object({id:e.z.number(),name:e.z.string().nullish(),color:e.z.string().nullish()}),m=e.z.object({id:e.z.number(),userId:e.z.string().nullish(),userName:e.z.string().nullish(),content:e.z.string().nullish(),createdAt:e.z.string().nullish(),isMine:e.z.boolean()}),Z=e.z.object({id:e.z.string(),fileName:e.z.string(),fileType:e.z.string().nullable(),fileSize:e.z.number().nullable(),createdAt:e.z.string().nullable(),state:e.z.enum(["present","absent","unknown"]),hasThumbnail:e.z.boolean().default(!1)}),s=e.z.object({reportHubId:e.z.number(),date:e.z.string().nullish(),createdAt:e.z.string().nullish(),author:e.z.string().nullish(),userId:e.z.string().nullish(),sourceType:e.z.string().nullish(),employeeName:e.z.string().nullish(),updatedBy:e.z.string().nullish(),updatedAt:e.z.string().nullish(),category:e.z.string().nullish(),creationCategory:e.z.string().nullish(),visitTimeFrom:e.z.string().nullish(),visitTimeTo:e.z.string().nullish(),customerName:e.z.string().nullish(),interviewers:e.z.array(d),subject:e.z.string().nullish(),content:e.z.string().nullish(),externalComments:e.z.array(c),isRead:e.z.boolean(),isStarred:e.z.boolean(),labels:e.z.array(y),postedComments:e.z.array(m),attachments:e.z.array(Z).default([])}),h=e.z.object({type:e.z.literal("connected")}),g=e.z.object({type:e.z.literal("status-update"),reportHubId:e.z.number(),statusType:e.z.enum(["star","read"]),value:e.z.boolean(),clientTempId:e.z.string(),recipientRawUserId:e.z.number().optional()}),R=e.z.string().optional(),D=e.z.object({type:e.z.literal("comment-add"),reportHubId:e.z.number(),comment:m,clientTempId:e.z.string(),recipientRawUserId:e.z.number().optional(),sourceType:R}),b=e.z.object({type:e.z.literal("comment-delete"),reportHubId:e.z.number(),commentId:e.z.number(),clientTempId:e.z.string(),recipientRawUserId:e.z.number().optional(),sourceType:R}),f=e.z.object({type:e.z.literal("report-create"),reportHubId:e.z.number(),report:s,clientTempId:e.z.string(),recipientRawUserId:e.z.number().optional()}),x=e.z.object({type:e.z.literal("report-update"),reportHubId:e.z.number(),report:s,clientTempId:e.z.string(),recipientRawUserId:e.z.number().optional()}),S=e.z.object({type:e.z.literal("report-publish"),reportHubId:e.z.number(),report:s,clientTempId:e.z.string(),recipientRawUserId:e.z.number().optional()}),I=e.z.object({type:e.z.literal("report-delete"),reportHubId:e.z.number(),clientTempId:e.z.string(),sourceType:R}),j=e.z.discriminatedUnion("type",[h,g,D,b,f,x,S,I]);0&&(module.exports={DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,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,isDailyReportAttachmentThumbnailVariant,isDailyReportSseStreamId,isIdsStreamChunkLine,mergeComments,normalizeBusinessDateKey,parseDailyReportAttachmentQuery,reportCreateMessageSchema,reportDeleteMessageSchema,reportPublishMessageSchema,reportUpdateMessageSchema,statusUpdateMessageSchema});
1
+ "use strict";var p=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var q=(t,r)=>{for(var n in r)p(t,n,{get:r[n],enumerable:!0})},F=(t,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of z(r))!Y.call(t,i)&&i!==n&&p(t,i,{get:()=>r[i],enumerable:!(o=V(r,i))||o.enumerable});return t};var K=t=>F(p({},"__esModule",{value:!0}),t);var ee={};q(ee,{DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS:()=>u,DAILY_REPORT_SSE_CURSOR_PARAM:()=>H,DAILY_REPORT_SSE_HEARTBEAT_MS:()=>U,DAILY_REPORT_SSE_TERMINAL_EVENTS:()=>O,buildDailyReportAttachmentUrl:()=>E,commentAddMessageSchema:()=>D,commentDeleteMessageSchema:()=>b,connectedMessageSchema:()=>h,dailyReportDetailSchema:()=>s,dailyReportExternalCommentSchema:()=>c,dailyReportInterviewerSchema:()=>d,dailyReportLabelDefSchema:()=>y,dailyReportPostedCommentSchema:()=>m,dailyReportSseMessageSchema:()=>j,isDailyReportAttachmentThumbnailVariant:()=>l,isDailyReportSseStreamId:()=>$,isIdsStreamChunkLine:()=>P,mergeComments:()=>N,normalizeBusinessDateKey:()=>L,parseDailyReportAttachmentQuery:()=>M,reportCreateMessageSchema:()=>f,reportDeleteMessageSchema:()=>I,reportPublishMessageSchema:()=>S,reportUpdateMessageSchema:()=>x,statusUpdateMessageSchema:()=>g});module.exports=K(ee);var u=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),l=t=>Object.hasOwn(u,t);var A="download",T="thumbnail",_="1",E=(t,r,n)=>{let o=`${t}/attachment/${encodeURIComponent(r)}`;switch(n.kind){case"inline":return o;case"download":return`${o}?${new URLSearchParams({[A]:_})}`;case"thumbnail":return`${o}?${new URLSearchParams({[T]:n.variant})}`}},M=t=>{let r=t.getAll(T),n=t.getAll(A);if(r.length>0&&n.length>0)return{kind:"invalid",reason:"conflict"};if(r.length>0){let[o]=r;return r.length===1&&l(o)?{kind:"thumbnail",variant:o}:{kind:"invalid",reason:"thumbnail_variant"}}return n.length>0?n.length===1&&n[0]===_?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var Q=/^\d{4}-\d{2}-\d{2}$/,W=/^\d{4}\/\d{2}\/\d{2}$/,C=t=>t<10?`0${t}`:`${t}`,k=t=>{if(Number.isNaN(t.getTime()))return null;let r=t.getFullYear(),n=C(t.getMonth()+1),o=C(t.getDate());return`${r}-${n}-${o}`};var L=t=>{if(t==null)return null;if(t instanceof Date)return k(t);let r=t.trim();if(r==="")return null;if(Q.test(r))return r;if(W.test(r))return r.replaceAll("/","-");let n=new Date(r);return k(n)};var J=t=>typeof t=="string"?JSON.stringify(t):typeof t=="number"||typeof t=="boolean"||t===null||t===void 0?String(t):Array.isArray(t)?"array":typeof t,w=(t,r,n)=>new RangeError(`[daily-report] ${t} must be ${r}; got ${J(n)}`);var N=(t,r,n,o)=>{if(typeof o!="string"||o.trim()==="")throw w("mergeComments: unknownAuthorName","a non-blank string",o);let i=t.map((a,B)=>({id:`legacy-${B}`,authorName:a.name||o,content:a.text||"",isMine:!1,color:a.color||void 0,isLegacy:!0})),v=r.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[...i,...v]};var G=t=>{if(typeof t!="object"||t===null)return"unknown";let r=t;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"},P=t=>G(t)==="chunk";var e=require("zod"),O=["auth-required","forbidden","resync-required"],U=15e3,H="lastEventId",X=/^\d{1,15}-\d{1,15}$/,$=t=>X.test(t),d=e.z.object({name:e.z.string().nullish(),affiliation:e.z.string().nullish()}),c=e.z.object({name:e.z.string().nullish(),text:e.z.string().nullish(),color:e.z.string().nullish()}),y=e.z.object({id:e.z.number(),name:e.z.string().nullish(),color:e.z.string().nullish()}),m=e.z.object({id:e.z.number(),userId:e.z.string().nullish(),userName:e.z.string().nullish(),content:e.z.string().nullish(),createdAt:e.z.string().nullish(),isMine:e.z.boolean()}),Z=e.z.object({id:e.z.string(),fileName:e.z.string(),fileType:e.z.string().nullable(),fileSize:e.z.number().nullable(),createdAt:e.z.string().nullable(),state:e.z.enum(["present","absent","unknown"]),hasThumbnail:e.z.boolean().default(!1)}),s=e.z.object({reportHubId:e.z.number(),date:e.z.string().nullish(),createdAt:e.z.string().nullish(),author:e.z.string().nullish(),userId:e.z.string().nullish(),sourceType:e.z.string().nullish(),employeeName:e.z.string().nullish(),updatedBy:e.z.string().nullish(),updatedAt:e.z.string().nullish(),category:e.z.string().nullish(),creationCategory:e.z.string().nullish(),visitTimeFrom:e.z.string().nullish(),visitTimeTo:e.z.string().nullish(),customerName:e.z.string().nullish(),interviewers:e.z.array(d),subject:e.z.string().nullish(),content:e.z.string().nullish(),externalComments:e.z.array(c),isRead:e.z.boolean(),isStarred:e.z.boolean(),labels:e.z.array(y),postedComments:e.z.array(m),attachments:e.z.array(Z).default([])}),h=e.z.object({type:e.z.literal("connected")}),g=e.z.object({type:e.z.literal("status-update"),reportHubId:e.z.number(),statusType:e.z.enum(["star","read"]),value:e.z.boolean(),clientTempId:e.z.string(),recipientRawUserId:e.z.number().optional()}),R=e.z.string().optional(),D=e.z.object({type:e.z.literal("comment-add"),reportHubId:e.z.number(),comment:m,clientTempId:e.z.string(),recipientRawUserId:e.z.number().optional(),sourceType:R}),b=e.z.object({type:e.z.literal("comment-delete"),reportHubId:e.z.number(),commentId:e.z.number(),clientTempId:e.z.string(),recipientRawUserId:e.z.number().optional(),sourceType:R}),f=e.z.object({type:e.z.literal("report-create"),reportHubId:e.z.number(),report:s,clientTempId:e.z.string(),recipientRawUserId:e.z.number().optional()}),x=e.z.object({type:e.z.literal("report-update"),reportHubId:e.z.number(),report:s,clientTempId:e.z.string(),recipientRawUserId:e.z.number().optional()}),S=e.z.object({type:e.z.literal("report-publish"),reportHubId:e.z.number(),report:s,clientTempId:e.z.string(),recipientRawUserId:e.z.number().optional()}),I=e.z.object({type:e.z.literal("report-delete"),reportHubId:e.z.number(),clientTempId:e.z.string(),sourceType:R}),j=e.z.discriminatedUnion("type",[h,g,D,b,f,x,S,I]);0&&(module.exports={DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,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,isDailyReportAttachmentThumbnailVariant,isDailyReportSseStreamId,isIdsStreamChunkLine,mergeComments,normalizeBusinessDateKey,parseDailyReportAttachmentQuery,reportCreateMessageSchema,reportDeleteMessageSchema,reportPublishMessageSchema,reportUpdateMessageSchema,statusUpdateMessageSchema});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var p=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),s=t=>Object.hasOwn(p,t);var u="download",d="thumbnail",c="1",L=(t,r,n)=>{let o=`${t}/attachment/${encodeURIComponent(r)}`;switch(n.kind){case"inline":return o;case"download":return`${o}?${new URLSearchParams({[u]:c})}`;case"thumbnail":return`${o}?${new URLSearchParams({[d]:n.variant})}`}},w=t=>{let r=t.getAll(d),n=t.getAll(u);if(r.length>0&&n.length>0)return{kind:"invalid",reason:"conflict"};if(r.length>0){let[o]=r;return r.length===1&&s(o)?{kind:"thumbnail",variant:o}:{kind:"invalid",reason:"thumbnail_variant"}}return n.length>0?n.length===1&&n[0]===c?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var N=/^\d{4}-\d{2}-\d{2}$/,P=/^\d{4}\/\d{2}\/\d{2}$/,y=t=>t<10?`0${t}`:`${t}`,h=t=>{if(Number.isNaN(t.getTime()))return null;let r=t.getFullYear(),n=y(t.getMonth()+1),o=y(t.getDate());return`${r}-${n}-${o}`};var U=t=>{if(t==null)return null;if(t instanceof Date)return h(t);let r=t.trim();if(r==="")return null;if(N.test(r))return r;if(P.test(r))return r.replaceAll("/","-");let n=new Date(r);return h(n)};var H=t=>typeof t=="string"?JSON.stringify(t):typeof t=="number"||typeof t=="boolean"||t===null||t===void 0?String(t):Array.isArray(t)?"array":typeof t,g=(t,r,n)=>new RangeError(`[daily-report] ${t} must be ${r}; got ${H(n)}`);var O=(t,r,n,o)=>{if(typeof o!="string"||o.trim()==="")throw g("mergeComments: unknownAuthorName","a non-blank string",o);let C=t.map((a,k)=>({id:`legacy-${k}`,authorName:a.name||o,content:a.text||"",isMine:!1,color:a.color||void 0,isLegacy:!0})),M=r.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[...C,...M]};var $=t=>{if(typeof t!="object"||t===null)return"unknown";let r=t;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=t=>$(t)==="chunk";import{z as e}from"zod";var v=["auth-required","forbidden","resync-required"],B=15e3,V="lastEventId",z=/^\d{1,15}-\d{1,15}$/,Y=t=>z.test(t),R=e.object({name:e.string().nullish(),affiliation:e.string().nullish()}),D=e.object({name:e.string().nullish(),text:e.string().nullish(),color:e.string().nullish()}),b=e.object({id:e.number(),name:e.string().nullish(),color:e.string().nullish()}),l=e.object({id:e.number(),userId:e.string().nullish(),userName:e.string().nullish(),content:e.string().nullish(),createdAt:e.string().nullish(),isMine:e.boolean()}),q=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"]),hasThumbnail:e.boolean().default(!1)}),i=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(R),subject:e.string().nullish(),content:e.string().nullish(),externalComments:e.array(D),isRead:e.boolean(),isStarred:e.boolean(),labels:e.array(b),postedComments:e.array(l),attachments:e.array(q).default([])}),f=e.object({type:e.literal("connected")}),x=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()}),m=e.string().optional(),S=e.object({type:e.literal("comment-add"),reportHubId:e.number(),comment:l,clientTempId:e.string(),recipientRawUserId:e.number().optional(),sourceType:m}),I=e.object({type:e.literal("comment-delete"),reportHubId:e.number(),commentId:e.number(),clientTempId:e.string(),recipientRawUserId:e.number().optional(),sourceType:m}),A=e.object({type:e.literal("report-create"),reportHubId:e.number(),report:i,clientTempId:e.string(),recipientRawUserId:e.number().optional()}),T=e.object({type:e.literal("report-update"),reportHubId:e.number(),report:i,clientTempId:e.string(),recipientRawUserId:e.number().optional()}),_=e.object({type:e.literal("report-publish"),reportHubId:e.number(),report:i,clientTempId:e.string(),recipientRawUserId:e.number().optional()}),E=e.object({type:e.literal("report-delete"),reportHubId:e.number(),clientTempId:e.string(),sourceType:m}),F=e.discriminatedUnion("type",[f,x,S,I,A,T,_,E]);export{p as DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,V as DAILY_REPORT_SSE_CURSOR_PARAM,B as DAILY_REPORT_SSE_HEARTBEAT_MS,v as DAILY_REPORT_SSE_TERMINAL_EVENTS,L as buildDailyReportAttachmentUrl,S as commentAddMessageSchema,I as commentDeleteMessageSchema,f as connectedMessageSchema,i as dailyReportDetailSchema,D as dailyReportExternalCommentSchema,R as dailyReportInterviewerSchema,b as dailyReportLabelDefSchema,l as dailyReportPostedCommentSchema,F as dailyReportSseMessageSchema,s as isDailyReportAttachmentThumbnailVariant,Y as isDailyReportSseStreamId,j as isIdsStreamChunkLine,O as mergeComments,U as normalizeBusinessDateKey,w as parseDailyReportAttachmentQuery,A as reportCreateMessageSchema,E as reportDeleteMessageSchema,_ as reportPublishMessageSchema,T as reportUpdateMessageSchema,x as statusUpdateMessageSchema};
1
+ var p=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),s=t=>Object.hasOwn(p,t);var u="download",d="thumbnail",c="1",L=(t,r,n)=>{let o=`${t}/attachment/${encodeURIComponent(r)}`;switch(n.kind){case"inline":return o;case"download":return`${o}?${new URLSearchParams({[u]:c})}`;case"thumbnail":return`${o}?${new URLSearchParams({[d]:n.variant})}`}},w=t=>{let r=t.getAll(d),n=t.getAll(u);if(r.length>0&&n.length>0)return{kind:"invalid",reason:"conflict"};if(r.length>0){let[o]=r;return r.length===1&&s(o)?{kind:"thumbnail",variant:o}:{kind:"invalid",reason:"thumbnail_variant"}}return n.length>0?n.length===1&&n[0]===c?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var N=/^\d{4}-\d{2}-\d{2}$/,P=/^\d{4}\/\d{2}\/\d{2}$/,y=t=>t<10?`0${t}`:`${t}`,h=t=>{if(Number.isNaN(t.getTime()))return null;let r=t.getFullYear(),n=y(t.getMonth()+1),o=y(t.getDate());return`${r}-${n}-${o}`};var O=t=>{if(t==null)return null;if(t instanceof Date)return h(t);let r=t.trim();if(r==="")return null;if(N.test(r))return r;if(P.test(r))return r.replaceAll("/","-");let n=new Date(r);return h(n)};var U=t=>typeof t=="string"?JSON.stringify(t):typeof t=="number"||typeof t=="boolean"||t===null||t===void 0?String(t):Array.isArray(t)?"array":typeof t,g=(t,r,n)=>new RangeError(`[daily-report] ${t} must be ${r}; got ${U(n)}`);var H=(t,r,n,o)=>{if(typeof o!="string"||o.trim()==="")throw g("mergeComments: unknownAuthorName","a non-blank string",o);let M=t.map((a,k)=>({id:`legacy-${k}`,authorName:a.name||o,content:a.text||"",isMine:!1,color:a.color||void 0,isLegacy:!0})),C=r.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[...M,...C]};var $=t=>{if(typeof t!="object"||t===null)return"unknown";let r=t;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=t=>$(t)==="chunk";import{z as e}from"zod";var v=["auth-required","forbidden","resync-required"],B=15e3,V="lastEventId",z=/^\d{1,15}-\d{1,15}$/,Y=t=>z.test(t),R=e.object({name:e.string().nullish(),affiliation:e.string().nullish()}),D=e.object({name:e.string().nullish(),text:e.string().nullish(),color:e.string().nullish()}),b=e.object({id:e.number(),name:e.string().nullish(),color:e.string().nullish()}),l=e.object({id:e.number(),userId:e.string().nullish(),userName:e.string().nullish(),content:e.string().nullish(),createdAt:e.string().nullish(),isMine:e.boolean()}),q=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"]),hasThumbnail:e.boolean().default(!1)}),i=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(R),subject:e.string().nullish(),content:e.string().nullish(),externalComments:e.array(D),isRead:e.boolean(),isStarred:e.boolean(),labels:e.array(b),postedComments:e.array(l),attachments:e.array(q).default([])}),f=e.object({type:e.literal("connected")}),x=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()}),m=e.string().optional(),S=e.object({type:e.literal("comment-add"),reportHubId:e.number(),comment:l,clientTempId:e.string(),recipientRawUserId:e.number().optional(),sourceType:m}),I=e.object({type:e.literal("comment-delete"),reportHubId:e.number(),commentId:e.number(),clientTempId:e.string(),recipientRawUserId:e.number().optional(),sourceType:m}),A=e.object({type:e.literal("report-create"),reportHubId:e.number(),report:i,clientTempId:e.string(),recipientRawUserId:e.number().optional()}),T=e.object({type:e.literal("report-update"),reportHubId:e.number(),report:i,clientTempId:e.string(),recipientRawUserId:e.number().optional()}),_=e.object({type:e.literal("report-publish"),reportHubId:e.number(),report:i,clientTempId:e.string(),recipientRawUserId:e.number().optional()}),E=e.object({type:e.literal("report-delete"),reportHubId:e.number(),clientTempId:e.string(),sourceType:m}),F=e.discriminatedUnion("type",[f,x,S,I,A,T,_,E]);export{p as DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,V as DAILY_REPORT_SSE_CURSOR_PARAM,B as DAILY_REPORT_SSE_HEARTBEAT_MS,v as DAILY_REPORT_SSE_TERMINAL_EVENTS,L as buildDailyReportAttachmentUrl,S as commentAddMessageSchema,I as commentDeleteMessageSchema,f as connectedMessageSchema,i as dailyReportDetailSchema,D as dailyReportExternalCommentSchema,R as dailyReportInterviewerSchema,b as dailyReportLabelDefSchema,l as dailyReportPostedCommentSchema,F as dailyReportSseMessageSchema,s as isDailyReportAttachmentThumbnailVariant,Y as isDailyReportSseStreamId,j as isIdsStreamChunkLine,H as mergeComments,O as normalizeBusinessDateKey,w as parseDailyReportAttachmentQuery,A as reportCreateMessageSchema,E as reportDeleteMessageSchema,_ as reportPublishMessageSchema,T as reportUpdateMessageSchema,x as statusUpdateMessageSchema};
package/dist/server.d.mts CHANGED
@@ -1,4 +1,5 @@
1
- import { e as DailyReportInterviewer, d as DailyReportExternalComment, D as DailyReportItem, b as DailyReportDetail, c as DailyReportAttachmentSummary, g as DailyReportPostedComment } from "./types-DkERw8NE.mjs";
1
+ import { g as DailyReportInterviewer, e as DailyReportExternalComment, D as DailyReportItem, b as DailyReportDetail, d as DailyReportAttachmentSummary, i as DailyReportPostedComment } from "./ids-stream-CWuIDrIO.mjs";
2
+ export { k as DAILY_REPORT_IDS_STREAM_ENDPOINT } from "./ids-stream-CWuIDrIO.mjs";
2
3
  import { TransactionRetryOptions } from "@aiquants/mssql";
3
4
  import * as drizzle_orm_mssql_core from "drizzle-orm/mssql-core";
4
5
  import { AnyMsSqlColumn } from "drizzle-orm/mssql-core";
@@ -8,41 +9,6 @@ interface DailyReportLogger {
8
9
  warn(message?: unknown, ...optionalParams: unknown[]): void;
9
10
  error(message?: unknown, ...optionalParams: unknown[]): void;
10
11
  }
11
- declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_OUTPUT_MEDIA_TYPES: readonly [
12
- "image/webp",
13
- "image/jpeg",
14
- "image/png"
15
- ];
16
- declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_MAX_OUTPUT_BYTES: number;
17
- declare const isStreamIdLte: (a: string, b: string) => boolean;
18
- type StreamEntry = {
19
- id: string;
20
- message: Record<string, string>;
21
- };
22
- type DailyReportSseReaderConfig = {
23
- redis?: DailyReportRedisProvider;
24
- streamKey: string;
25
- cache: SqlResultCache;
26
- logger?: DailyReportLogger;
27
- };
28
- declare class DailyReportSseReader implements DailyReportSseReaderPort {
29
- private readonly config;
30
- private _source;
31
- private _lastId;
32
- private _positioning;
33
- private _generation;
34
- private readonly _logger;
35
- constructor(config: DailyReportSseReaderConfig);
36
- ready(): Promise<void>;
37
- subscribe(onEntry: (entry: StreamEntry) => void, onError: (err: Error) => void): () => void;
38
- destroy(): Promise<void>;
39
- private _position;
40
- private _readTail;
41
- private _createSource;
42
- private _start;
43
- private _readLoop;
44
- private _invalidateCaches;
45
- }
46
12
  type RedisStreamMessage = {
47
13
  id: string;
48
14
  message: Record<string, string>;
@@ -77,6 +43,10 @@ type DailyReportRedisProvider = {
77
43
  getClient(): Promise<DailyReportRedisClient | undefined>;
78
44
  createClient(): Promise<DailyReportRedisBlockingClient | undefined>;
79
45
  };
46
+ type StreamEntry = {
47
+ id: string;
48
+ message: Record<string, string>;
49
+ };
80
50
  type DailyReportSseReaderPort = {
81
51
  ready(): Promise<void>;
82
52
  subscribe(onEntry: (entry: StreamEntry) => void, onError: (err: Error) => void): () => void;
@@ -116,7 +86,7 @@ type DailyReportIdCodec = {
116
86
  encode: (id: number) => string;
117
87
  decode: (token: string) => number | null;
118
88
  };
119
- type DailyReportAttachmentFailure = "not_found" | "denied" | "too_large" | "invalid_path" | "unavailable";
89
+ type DailyReportAttachmentFailure = "not_found" | "denied" | "too_large" | "invalid_path" | "unavailable" | "busy" | "deadline";
120
90
  type DailyReportAttachmentBytes = {
121
91
  ok: true;
122
92
  bytes: Uint8Array<ArrayBuffer>;
@@ -136,6 +106,12 @@ type DailyReportReadAttachment = (filePath: string, options: {
136
106
  }) => Promise<DailyReportAttachmentBytes | DailyReportAttachmentError>;
137
107
  type DailyReportAttachmentThumbnailSourceFormat = "png" | "jpeg" | "gif" | "webp";
138
108
  type DailyReportAttachmentThumbnailFailure = "unsupported" | "failed";
109
+ declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_OUTPUT_MEDIA_TYPES: readonly [
110
+ "image/webp",
111
+ "image/jpeg",
112
+ "image/png"
113
+ ];
114
+ declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_MAX_OUTPUT_BYTES: number;
139
115
  type DailyReportAttachmentThumbnailOutputMediaType = (typeof DAILY_REPORT_ATTACHMENT_THUMBNAIL_OUTPUT_MEDIA_TYPES)[number];
140
116
  type DailyReportAttachmentThumbnail = {
141
117
  ok: true;
@@ -1608,6 +1584,32 @@ declare function createDailyReportService(config: DailyReportServiceConfig): {
1608
1584
  updateDailyReportInternal: (tx: DailyReportDb, hubId: number, data: Partial<DailyReportInternalRow>) => Promise<void>;
1609
1585
  deleteDailyReportLabel: (tx: DailyReportDb, hubId: number, labelId: number) => Promise<void>;
1610
1586
  };
1587
+ declare const isStreamIdLte: (a: string, b: string) => boolean;
1588
+ type DailyReportSseReaderConfig = {
1589
+ redis?: DailyReportRedisProvider;
1590
+ streamKey: string;
1591
+ cache: SqlResultCache;
1592
+ logger?: DailyReportLogger;
1593
+ };
1594
+ declare class DailyReportSseReader implements DailyReportSseReaderPort {
1595
+ private readonly config;
1596
+ private _source;
1597
+ private _lastId;
1598
+ private _positioning;
1599
+ private _generation;
1600
+ private readonly _logger;
1601
+ constructor(config: DailyReportSseReaderConfig);
1602
+ ready(): Promise<void>;
1603
+ subscribe(onEntry: (entry: StreamEntry) => void, onError: (err: Error) => void): () => void;
1604
+ destroy(): Promise<void>;
1605
+ private _position;
1606
+ private _readTail;
1607
+ private _createSource;
1608
+ private _start;
1609
+ private _readLoop;
1610
+ private _invalidateCaches;
1611
+ }
1612
+ declare const generateETag: (data: unknown) => string;
1611
1613
  type LoaderArgs = {
1612
1614
  request: Request;
1613
1615
  params: Record<string, string | undefined>;
@@ -1644,21 +1646,16 @@ declare function createDailyReportHandlers(config: DailyReportHandlersConfig): {
1644
1646
  }>;
1645
1647
  };
1646
1648
  api: {
1647
- loader: ({ request, params }: LoaderArgs) => Promise<Response>;
1648
- action: ({ request, params }: LoaderArgs) => Promise<Response>;
1649
+ loader: (args: LoaderArgs) => Promise<Response>;
1650
+ action: (args: LoaderArgs) => Promise<Response>;
1649
1651
  };
1650
1652
  sse: {
1651
- loader: ({ request, params }: LoaderArgs) => Promise<Response>;
1653
+ loader: (args: LoaderArgs) => Promise<Response>;
1652
1654
  };
1653
1655
  attachment: {
1654
- loader: (args: AttachmentLoaderArgs) => Promise<Response>;
1656
+ loader: (args: LoaderArgs) => Promise<Response>;
1655
1657
  };
1656
1658
  };
1657
- type AttachmentLoaderArgs = {
1658
- request: Request;
1659
- params: Record<string, string | undefined>;
1660
- };
1661
- declare const generateETag: (data: unknown) => string;
1662
1659
  declare const jsonResponseWithETag: (request: Request, cookie: string | null, payload: Record<string, unknown>, status?: number, logger?: DailyReportLogger) => Response;
1663
1660
  type SharpHeaderLike = {
1664
1661
  width: number;
@@ -1781,23 +1778,26 @@ declare function createDailyReportServer(config: DailyReportServerConfig): {
1781
1778
  }>;
1782
1779
  };
1783
1780
  api: {
1784
- loader: ({ request, params }: {
1781
+ loader: (args: {
1785
1782
  request: Request;
1786
1783
  params: Record<string, string | undefined>;
1787
1784
  }) => Promise<Response>;
1788
- action: ({ request, params }: {
1785
+ action: (args: {
1789
1786
  request: Request;
1790
1787
  params: Record<string, string | undefined>;
1791
1788
  }) => Promise<Response>;
1792
1789
  };
1793
1790
  sse: {
1794
- loader: ({ request, params }: {
1791
+ loader: (args: {
1795
1792
  request: Request;
1796
1793
  params: Record<string, string | undefined>;
1797
1794
  }) => Promise<Response>;
1798
1795
  };
1799
1796
  attachment: {
1800
- loader: (args: AttachmentLoaderArgs) => Promise<Response>;
1797
+ loader: (args: {
1798
+ request: Request;
1799
+ params: Record<string, string | undefined>;
1800
+ }) => Promise<Response>;
1801
1801
  };
1802
1802
  service: {
1803
1803
  streamKey: string;
package/dist/server.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { e as DailyReportInterviewer, d as DailyReportExternalComment, D as DailyReportItem, b as DailyReportDetail, c as DailyReportAttachmentSummary, g as DailyReportPostedComment } from "./types-DkERw8NE.js";
1
+ import { g as DailyReportInterviewer, e as DailyReportExternalComment, D as DailyReportItem, b as DailyReportDetail, d as DailyReportAttachmentSummary, i as DailyReportPostedComment } from "./ids-stream-CWuIDrIO.js";
2
+ export { k as DAILY_REPORT_IDS_STREAM_ENDPOINT } from "./ids-stream-CWuIDrIO.js";
2
3
  import { TransactionRetryOptions } from "@aiquants/mssql";
3
4
  import * as drizzle_orm_mssql_core from "drizzle-orm/mssql-core";
4
5
  import { AnyMsSqlColumn } from "drizzle-orm/mssql-core";
@@ -8,41 +9,6 @@ interface DailyReportLogger {
8
9
  warn(message?: unknown, ...optionalParams: unknown[]): void;
9
10
  error(message?: unknown, ...optionalParams: unknown[]): void;
10
11
  }
11
- declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_OUTPUT_MEDIA_TYPES: readonly [
12
- "image/webp",
13
- "image/jpeg",
14
- "image/png"
15
- ];
16
- declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_MAX_OUTPUT_BYTES: number;
17
- declare const isStreamIdLte: (a: string, b: string) => boolean;
18
- type StreamEntry = {
19
- id: string;
20
- message: Record<string, string>;
21
- };
22
- type DailyReportSseReaderConfig = {
23
- redis?: DailyReportRedisProvider;
24
- streamKey: string;
25
- cache: SqlResultCache;
26
- logger?: DailyReportLogger;
27
- };
28
- declare class DailyReportSseReader implements DailyReportSseReaderPort {
29
- private readonly config;
30
- private _source;
31
- private _lastId;
32
- private _positioning;
33
- private _generation;
34
- private readonly _logger;
35
- constructor(config: DailyReportSseReaderConfig);
36
- ready(): Promise<void>;
37
- subscribe(onEntry: (entry: StreamEntry) => void, onError: (err: Error) => void): () => void;
38
- destroy(): Promise<void>;
39
- private _position;
40
- private _readTail;
41
- private _createSource;
42
- private _start;
43
- private _readLoop;
44
- private _invalidateCaches;
45
- }
46
12
  type RedisStreamMessage = {
47
13
  id: string;
48
14
  message: Record<string, string>;
@@ -77,6 +43,10 @@ type DailyReportRedisProvider = {
77
43
  getClient(): Promise<DailyReportRedisClient | undefined>;
78
44
  createClient(): Promise<DailyReportRedisBlockingClient | undefined>;
79
45
  };
46
+ type StreamEntry = {
47
+ id: string;
48
+ message: Record<string, string>;
49
+ };
80
50
  type DailyReportSseReaderPort = {
81
51
  ready(): Promise<void>;
82
52
  subscribe(onEntry: (entry: StreamEntry) => void, onError: (err: Error) => void): () => void;
@@ -116,7 +86,7 @@ type DailyReportIdCodec = {
116
86
  encode: (id: number) => string;
117
87
  decode: (token: string) => number | null;
118
88
  };
119
- type DailyReportAttachmentFailure = "not_found" | "denied" | "too_large" | "invalid_path" | "unavailable";
89
+ type DailyReportAttachmentFailure = "not_found" | "denied" | "too_large" | "invalid_path" | "unavailable" | "busy" | "deadline";
120
90
  type DailyReportAttachmentBytes = {
121
91
  ok: true;
122
92
  bytes: Uint8Array<ArrayBuffer>;
@@ -136,6 +106,12 @@ type DailyReportReadAttachment = (filePath: string, options: {
136
106
  }) => Promise<DailyReportAttachmentBytes | DailyReportAttachmentError>;
137
107
  type DailyReportAttachmentThumbnailSourceFormat = "png" | "jpeg" | "gif" | "webp";
138
108
  type DailyReportAttachmentThumbnailFailure = "unsupported" | "failed";
109
+ declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_OUTPUT_MEDIA_TYPES: readonly [
110
+ "image/webp",
111
+ "image/jpeg",
112
+ "image/png"
113
+ ];
114
+ declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_MAX_OUTPUT_BYTES: number;
139
115
  type DailyReportAttachmentThumbnailOutputMediaType = (typeof DAILY_REPORT_ATTACHMENT_THUMBNAIL_OUTPUT_MEDIA_TYPES)[number];
140
116
  type DailyReportAttachmentThumbnail = {
141
117
  ok: true;
@@ -1608,6 +1584,32 @@ declare function createDailyReportService(config: DailyReportServiceConfig): {
1608
1584
  updateDailyReportInternal: (tx: DailyReportDb, hubId: number, data: Partial<DailyReportInternalRow>) => Promise<void>;
1609
1585
  deleteDailyReportLabel: (tx: DailyReportDb, hubId: number, labelId: number) => Promise<void>;
1610
1586
  };
1587
+ declare const isStreamIdLte: (a: string, b: string) => boolean;
1588
+ type DailyReportSseReaderConfig = {
1589
+ redis?: DailyReportRedisProvider;
1590
+ streamKey: string;
1591
+ cache: SqlResultCache;
1592
+ logger?: DailyReportLogger;
1593
+ };
1594
+ declare class DailyReportSseReader implements DailyReportSseReaderPort {
1595
+ private readonly config;
1596
+ private _source;
1597
+ private _lastId;
1598
+ private _positioning;
1599
+ private _generation;
1600
+ private readonly _logger;
1601
+ constructor(config: DailyReportSseReaderConfig);
1602
+ ready(): Promise<void>;
1603
+ subscribe(onEntry: (entry: StreamEntry) => void, onError: (err: Error) => void): () => void;
1604
+ destroy(): Promise<void>;
1605
+ private _position;
1606
+ private _readTail;
1607
+ private _createSource;
1608
+ private _start;
1609
+ private _readLoop;
1610
+ private _invalidateCaches;
1611
+ }
1612
+ declare const generateETag: (data: unknown) => string;
1611
1613
  type LoaderArgs = {
1612
1614
  request: Request;
1613
1615
  params: Record<string, string | undefined>;
@@ -1644,21 +1646,16 @@ declare function createDailyReportHandlers(config: DailyReportHandlersConfig): {
1644
1646
  }>;
1645
1647
  };
1646
1648
  api: {
1647
- loader: ({ request, params }: LoaderArgs) => Promise<Response>;
1648
- action: ({ request, params }: LoaderArgs) => Promise<Response>;
1649
+ loader: (args: LoaderArgs) => Promise<Response>;
1650
+ action: (args: LoaderArgs) => Promise<Response>;
1649
1651
  };
1650
1652
  sse: {
1651
- loader: ({ request, params }: LoaderArgs) => Promise<Response>;
1653
+ loader: (args: LoaderArgs) => Promise<Response>;
1652
1654
  };
1653
1655
  attachment: {
1654
- loader: (args: AttachmentLoaderArgs) => Promise<Response>;
1656
+ loader: (args: LoaderArgs) => Promise<Response>;
1655
1657
  };
1656
1658
  };
1657
- type AttachmentLoaderArgs = {
1658
- request: Request;
1659
- params: Record<string, string | undefined>;
1660
- };
1661
- declare const generateETag: (data: unknown) => string;
1662
1659
  declare const jsonResponseWithETag: (request: Request, cookie: string | null, payload: Record<string, unknown>, status?: number, logger?: DailyReportLogger) => Response;
1663
1660
  type SharpHeaderLike = {
1664
1661
  width: number;
@@ -1781,23 +1778,26 @@ declare function createDailyReportServer(config: DailyReportServerConfig): {
1781
1778
  }>;
1782
1779
  };
1783
1780
  api: {
1784
- loader: ({ request, params }: {
1781
+ loader: (args: {
1785
1782
  request: Request;
1786
1783
  params: Record<string, string | undefined>;
1787
1784
  }) => Promise<Response>;
1788
- action: ({ request, params }: {
1785
+ action: (args: {
1789
1786
  request: Request;
1790
1787
  params: Record<string, string | undefined>;
1791
1788
  }) => Promise<Response>;
1792
1789
  };
1793
1790
  sse: {
1794
- loader: ({ request, params }: {
1791
+ loader: (args: {
1795
1792
  request: Request;
1796
1793
  params: Record<string, string | undefined>;
1797
1794
  }) => Promise<Response>;
1798
1795
  };
1799
1796
  attachment: {
1800
- loader: (args: AttachmentLoaderArgs) => Promise<Response>;
1797
+ loader: (args: {
1798
+ request: Request;
1799
+ params: Record<string, string | undefined>;
1800
+ }) => Promise<Response>;
1801
1801
  };
1802
1802
  service: {
1803
1803
  streamKey: string;