@aiquants/daily-report 0.35.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +141 -0
- package/README.md +177 -66
- package/dist/client.d.mts +26 -15
- package/dist/client.d.ts +26 -15
- package/dist/client.js +6 -6
- package/dist/client.mjs +6 -6
- package/dist/{comment-adapter-DqBqtqfA.d.ts → comment-adapter-DOUwSlKf.d.ts} +1 -0
- package/dist/{comment-adapter-ChA4KOE1.d.mts → comment-adapter-_h3W1duG.d.mts} +1 -0
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/search-marks-wire-CZRU4q3h.d.mts +35 -0
- package/dist/search-marks-wire-CZRU4q3h.d.ts +35 -0
- package/dist/server.d.mts +25 -12
- package/dist/server.d.ts +25 -12
- package/dist/server.js +10 -10
- package/dist/server.mjs +10 -10
- package/dist/styles/daily-report.standalone.css +1 -1
- package/package.json +1 -1
- package/dist/logger-BaxnzF-0.d.mts +0 -17
- package/dist/logger-BaxnzF-0.d.ts +0 -17
|
@@ -167,6 +167,7 @@ type UIComment = {
|
|
|
167
167
|
isMine: boolean;
|
|
168
168
|
color?: string;
|
|
169
169
|
isLegacy: boolean;
|
|
170
|
+
isAuthorUnknown: boolean;
|
|
170
171
|
};
|
|
171
172
|
declare const mergeComments: (legacyComments: DailyReportExternalComment[], modernComments: DailyReportPostedComment[], currentUserId: string | null | undefined, unknownAuthorName: string) => UIComment[];
|
|
172
173
|
export { type ActionCommand as A, type DailyReportActionIntent as D, type UIComment as U, type DailyReportSseStreamAnchor as a, DAILY_REPORT_ACTION_FIELDS as b, DAILY_REPORT_ACTION_INTENTS as c, type ActionFailure as d, type ActionResult as e, type ActionResultOf as f, type ActionResultReading as g, type DailyReportIdsStreamChunkLine as h, type DailyReportIdsStreamCursor as i, encodeActionCommand as j, isIdsStreamChunkLine as k, mergeComments as m, parseActionResult as p };
|
|
@@ -167,6 +167,7 @@ type UIComment = {
|
|
|
167
167
|
isMine: boolean;
|
|
168
168
|
color?: string;
|
|
169
169
|
isLegacy: boolean;
|
|
170
|
+
isAuthorUnknown: boolean;
|
|
170
171
|
};
|
|
171
172
|
declare const mergeComments: (legacyComments: DailyReportExternalComment[], modernComments: DailyReportPostedComment[], currentUserId: string | null | undefined, unknownAuthorName: string) => UIComment[];
|
|
172
173
|
export { type ActionCommand as A, type DailyReportActionIntent as D, type UIComment as U, type DailyReportSseStreamAnchor as a, DAILY_REPORT_ACTION_FIELDS as b, DAILY_REPORT_ACTION_INTENTS as c, type ActionFailure as d, type ActionResult as e, type ActionResultOf as f, type ActionResultReading as g, type DailyReportIdsStreamChunkLine as h, type DailyReportIdsStreamCursor as i, encodeActionCommand as j, isIdsStreamChunkLine as k, mergeComments as m, parseActionResult as p };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { b as DAILY_REPORT_ACTION_FIELDS, c as DAILY_REPORT_ACTION_INTENTS, A as DailyReportActionCommand, d as DailyReportActionFailure, D as DailyReportActionIntent, e as DailyReportActionResult, f as DailyReportActionResultOf, g as DailyReportActionResultReading, h as DailyReportIdsStreamChunkLine, i as DailyReportIdsStreamCursor, a as DailyReportSseStreamAnchor, U as DailyReportUIComment, j as encodeDailyReportActionCommand, k as isIdsStreamChunkLine, m as mergeComments, p as parseDailyReportActionResult } from "./comment-adapter-
|
|
2
|
-
export { D as DAILY_REPORT_SEARCH_COMBINES, a as DailyReportLogger, b as DailyReportSearchCombine, c as DailyReportSearchHit } from "./
|
|
1
|
+
export { b as DAILY_REPORT_ACTION_FIELDS, c as DAILY_REPORT_ACTION_INTENTS, A as DailyReportActionCommand, d as DailyReportActionFailure, D as DailyReportActionIntent, e as DailyReportActionResult, f as DailyReportActionResultOf, g as DailyReportActionResultReading, h as DailyReportIdsStreamChunkLine, i as DailyReportIdsStreamCursor, a as DailyReportSseStreamAnchor, U as DailyReportUIComment, j as encodeDailyReportActionCommand, k as isIdsStreamChunkLine, m as mergeComments, p as parseDailyReportActionResult } from "./comment-adapter-_h3W1duG.mjs";
|
|
2
|
+
export { D as DAILY_REPORT_SEARCH_COMBINES, a as DailyReportLogger, b as DailyReportSearchCombine, c as DailyReportSearchFieldMarks, d as DailyReportSearchHit, e as DailyReportSearchMarksAnswer, f as DailyReportSearchReportMarks } from "./search-marks-wire-CZRU4q3h.mjs";
|
|
3
3
|
export { e as DAILY_REPORT_SSE_CURSOR_PARAM, f as DAILY_REPORT_SSE_HEARTBEAT_MS, g as DAILY_REPORT_SSE_TERMINAL_EVENTS, h as DailyReportAttachmentState, i as DailyReportAttachmentSummary, d as DailyReportDetail, j as DailyReportExternalComment, k as DailyReportInterviewer, D as DailyReportItem, l as DailyReportLabelDef, m as DailyReportPostedComment, c as DailyReportSseMessage, b as DailyReportSseTerminalEvent, a as DailyReportUser, n as commentAddMessageSchema, o as commentDeleteMessageSchema, p as connectedMessageSchema, q as dailyReportDetailSchema, r as dailyReportExternalCommentSchema, s as dailyReportInterviewerSchema, t as dailyReportLabelDefSchema, u as dailyReportPostedCommentSchema, v as dailyReportSseMessageSchema, w as isDailyReportSseStreamId, x as reportCreateMessageSchema, y as reportDeleteMessageSchema, z as reportPublishMessageSchema, A as reportUpdateMessageSchema, B as statusUpdateMessageSchema } from "./sse-schema-getLS62T.mjs";
|
|
4
4
|
import "zod";
|
|
5
5
|
declare const DAILY_REPORT_API_ENDPOINTS: Readonly<{
|
|
@@ -8,6 +8,7 @@ declare const DAILY_REPORT_API_ENDPOINTS: Readonly<{
|
|
|
8
8
|
readonly report: "report";
|
|
9
9
|
readonly search: "search";
|
|
10
10
|
readonly reports: "reports";
|
|
11
|
+
readonly searchMarks: "search-marks";
|
|
11
12
|
readonly action: "action";
|
|
12
13
|
}>;
|
|
13
14
|
declare const DAILY_REPORT_API_QUERY_PARAMS: Readonly<{
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { b as DAILY_REPORT_ACTION_FIELDS, c as DAILY_REPORT_ACTION_INTENTS, A as DailyReportActionCommand, d as DailyReportActionFailure, D as DailyReportActionIntent, e as DailyReportActionResult, f as DailyReportActionResultOf, g as DailyReportActionResultReading, h as DailyReportIdsStreamChunkLine, i as DailyReportIdsStreamCursor, a as DailyReportSseStreamAnchor, U as DailyReportUIComment, j as encodeDailyReportActionCommand, k as isIdsStreamChunkLine, m as mergeComments, p as parseDailyReportActionResult } from "./comment-adapter-
|
|
2
|
-
export { D as DAILY_REPORT_SEARCH_COMBINES, a as DailyReportLogger, b as DailyReportSearchCombine, c as DailyReportSearchHit } from "./
|
|
1
|
+
export { b as DAILY_REPORT_ACTION_FIELDS, c as DAILY_REPORT_ACTION_INTENTS, A as DailyReportActionCommand, d as DailyReportActionFailure, D as DailyReportActionIntent, e as DailyReportActionResult, f as DailyReportActionResultOf, g as DailyReportActionResultReading, h as DailyReportIdsStreamChunkLine, i as DailyReportIdsStreamCursor, a as DailyReportSseStreamAnchor, U as DailyReportUIComment, j as encodeDailyReportActionCommand, k as isIdsStreamChunkLine, m as mergeComments, p as parseDailyReportActionResult } from "./comment-adapter-DOUwSlKf.js";
|
|
2
|
+
export { D as DAILY_REPORT_SEARCH_COMBINES, a as DailyReportLogger, b as DailyReportSearchCombine, c as DailyReportSearchFieldMarks, d as DailyReportSearchHit, e as DailyReportSearchMarksAnswer, f as DailyReportSearchReportMarks } from "./search-marks-wire-CZRU4q3h.js";
|
|
3
3
|
export { e as DAILY_REPORT_SSE_CURSOR_PARAM, f as DAILY_REPORT_SSE_HEARTBEAT_MS, g as DAILY_REPORT_SSE_TERMINAL_EVENTS, h as DailyReportAttachmentState, i as DailyReportAttachmentSummary, d as DailyReportDetail, j as DailyReportExternalComment, k as DailyReportInterviewer, D as DailyReportItem, l as DailyReportLabelDef, m as DailyReportPostedComment, c as DailyReportSseMessage, b as DailyReportSseTerminalEvent, a as DailyReportUser, n as commentAddMessageSchema, o as commentDeleteMessageSchema, p as connectedMessageSchema, q as dailyReportDetailSchema, r as dailyReportExternalCommentSchema, s as dailyReportInterviewerSchema, t as dailyReportLabelDefSchema, u as dailyReportPostedCommentSchema, v as dailyReportSseMessageSchema, w as isDailyReportSseStreamId, x as reportCreateMessageSchema, y as reportDeleteMessageSchema, z as reportPublishMessageSchema, A as reportUpdateMessageSchema, B as statusUpdateMessageSchema } from "./sse-schema-getLS62T.js";
|
|
4
4
|
import "zod";
|
|
5
5
|
declare const DAILY_REPORT_API_ENDPOINTS: Readonly<{
|
|
@@ -8,6 +8,7 @@ declare const DAILY_REPORT_API_ENDPOINTS: Readonly<{
|
|
|
8
8
|
readonly report: "report";
|
|
9
9
|
readonly search: "search";
|
|
10
10
|
readonly reports: "reports";
|
|
11
|
+
readonly searchMarks: "search-marks";
|
|
11
12
|
readonly action: "action";
|
|
12
13
|
}>;
|
|
13
14
|
declare const DAILY_REPORT_API_QUERY_PARAMS: Readonly<{
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var b=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ae=Object.prototype.hasOwnProperty;var ie=(e,n)=>{for(var r in n)b(e,r,{get:n[r],enumerable:!0})},se=(e,n,r,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of oe(n))!ae.call(e,s)&&s!==r&&b(e,s,{get:()=>n[s],enumerable:!(a=re(n,s))||a.enumerable});return e};var le=e=>se(b({},"__esModule",{value:!0}),e);var be={};ie(be,{DAILY_REPORT_ACTION_FIELDS:()=>p,DAILY_REPORT_ACTION_INTENTS:()=>B,DAILY_REPORT_API_ENDPOINTS:()=>V,DAILY_REPORT_API_QUERY_PARAMS:()=>F,DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS:()=>M,DAILY_REPORT_CLIENT_TEMP_ID_PATTERN:()=>m,DAILY_REPORT_SEARCH_COMBINES:()=>ne,DAILY_REPORT_SSE_CURSOR_PARAM:()=>H,DAILY_REPORT_SSE_HEARTBEAT_MS:()=>w,DAILY_REPORT_SSE_TERMINAL_EVENTS:()=>k,buildDailyReportAttachmentUrl:()=>Z,commentAddMessageSchema:()=>x,commentDeleteMessageSchema:()=>_,connectedMessageSchema:()=>S,dailyReportDetailSchema:()=>d,dailyReportExternalCommentSchema:()=>D,dailyReportInterviewerSchema:()=>h,dailyReportLabelDefSchema:()=>f,dailyReportPostedCommentSchema:()=>c,dailyReportSseMessageSchema:()=>U,encodeDailyReportActionCommand:()=>$,isDailyReportAttachmentThumbnailVariant:()=>I,isDailyReportSseStreamId:()=>j,isIdsStreamChunkLine:()=>K,mergeComments:()=>te,normalizeBusinessDateKey:()=>X,parseDailyReportActionResult:()=>z,parseDailyReportAttachmentQuery:()=>G,reportCreateMessageSchema:()=>C,reportDeleteMessageSchema:()=>P,reportPublishMessageSchema:()=>O,reportUpdateMessageSchema:()=>E,statusUpdateMessageSchema:()=>A});module.exports=le(be);var o=require("zod");var m=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|-[1-9][0-9]{0,15})$/;var L=require("zod");var i=L.z.number().int().positive().max(Number.MAX_SAFE_INTEGER);var t=require("zod");var k=["auth-required","forbidden","resync-required"],w=15e3,H="lastEventId",pe=/^\d{1,15}-\d{1,15}$/,j=e=>pe.test(e),h=t.z.object({name:t.z.string().nullish(),affiliation:t.z.string().nullish()}),D=t.z.object({name:t.z.string().nullish(),text:t.z.string().nullish(),color:t.z.string().nullish()}),f=t.z.object({id:i,name:t.z.string().nullish(),color:t.z.string().nullish()}),c=t.z.object({id:i,userId:t.z.string().nullish(),userName:t.z.string().nullish(),content:t.z.string().nullish(),createdAt:t.z.string().nullish(),isMine:t.z.boolean()}),de=t.z.object({id:t.z.string(),fileName:t.z.string(),fileType:t.z.string().nullable(),fileSize:t.z.number().nullable(),createdAt:t.z.string().nullable(),state:t.z.enum(["present","absent","unknown"]),hasThumbnail:t.z.boolean().default(!1)}),d=t.z.object({reportHubId:i,date:t.z.string().nullish(),createdAt:t.z.string().nullish(),author:t.z.string().nullish(),userId:t.z.string().nullish(),sourceType:t.z.string().nullish(),employeeName:t.z.string().nullish(),updatedBy:t.z.string().nullish(),updatedAt:t.z.string().nullish(),category:t.z.string().nullish(),creationCategory:t.z.string().nullish(),visitTimeFrom:t.z.string().nullish(),visitTimeTo:t.z.string().nullish(),customerName:t.z.string().nullish(),interviewers:t.z.array(h),subject:t.z.string().nullish(),content:t.z.string().nullish(),externalComments:t.z.array(D),isRead:t.z.boolean(),isStarred:t.z.boolean(),labels:t.z.array(f),postedComments:t.z.array(c),attachments:t.z.array(de).default([])}),u=t.z.string().regex(m),S=t.z.object({type:t.z.literal("connected")}),A=t.z.object({type:t.z.literal("status-update"),reportHubId:i,statusType:t.z.enum(["star","read"]),value:t.z.boolean(),clientTempId:u,recipientRawUserId:i.optional()}),T=t.z.string().optional(),x=t.z.object({type:t.z.literal("comment-add"),reportHubId:i,comment:c,clientTempId:u,recipientRawUserId:i.optional(),sourceType:T}),_=t.z.object({type:t.z.literal("comment-delete"),reportHubId:i,commentId:i,clientTempId:u,recipientRawUserId:i.optional(),sourceType:T}),C=t.z.object({type:t.z.literal("report-create"),reportHubId:i,report:d,clientTempId:u,recipientRawUserId:i.optional()}),E=t.z.object({type:t.z.literal("report-update"),reportHubId:i,report:d,clientTempId:u,recipientRawUserId:i.optional()}),O=t.z.object({type:t.z.literal("report-publish"),reportHubId:i,report:d,clientTempId:u,recipientRawUserId:i.optional()}),P=t.z.object({type:t.z.literal("report-delete"),reportHubId:i,clientTempId:u,sourceType:T}),U=t.z.discriminatedUnion("type",[S,A,x,_,C,E,O,P]);var Y=e=>e.issues.map(n=>`${n.path.length===0?"(root)":n.path.join(".")}: ${n.code}`).join("; ");var B=Object.freeze(["create","update","publish","delete","toggleStar","toggleRead","addComment","deleteComment","clearCache"]);var p=Object.freeze({intent:"intent",clientTempId:"clientTempId",businessDate:"businessDate",operationTimestamp:"operationTimestamp",reportHubId:"reportHubId",title:"title",content:"content",isStarred:"isStarred",isRead:"isRead",commentId:"commentId"}),$=e=>{let n=new FormData;if(n.append(p.intent,e.intent),e.intent==="clearCache"||(n.append(p.clientTempId,e.clientTempId),e.businessDate!==null&&n.append(p.businessDate,e.businessDate),e.operationTimestamp!==null&&n.append(p.operationTimestamp,String(e.operationTimestamp)),e.intent==="create"))return n;switch(n.append(p.reportHubId,String(e.reportHubId)),e.intent){case"update":return e.changes.title!==void 0&&n.append(p.title,e.changes.title),e.changes.content!==void 0&&n.append(p.content,e.changes.content),n;case"publish":case"delete":return n;case"toggleStar":return n.append(p.isStarred,String(e.value)),n;case"toggleRead":return n.append(p.isRead,String(e.value)),n;case"addComment":return n.append(p.content,e.content),n;case"deleteComment":return n.append(p.commentId,String(e.commentId)),n}},ue=()=>{let e=i,n=o.z.string().regex(m),r=o.z.literal("OK"),a=o.z.object({isStarred:o.z.boolean(),isRead:o.z.boolean()}),s=o.z.number().int().nonnegative().nullable();return{create:o.z.object({status:r,intent:o.z.literal("create"),reportHubId:e,clientTempId:n,report:d}),update:o.z.object({status:r,intent:o.z.literal("update"),reportHubId:e,clientTempId:n}),publish:o.z.object({status:r,intent:o.z.literal("publish"),reportHubId:e,clientTempId:n,report:d.nullable()}),delete:o.z.object({status:r,intent:o.z.literal("delete"),reportHubId:e,clientTempId:n}),toggleStar:o.z.object({status:r,intent:o.z.literal("toggleStar"),reportHubId:e,clientTempId:n,updatedStatus:a,operationTimestamp:s}),toggleRead:o.z.object({status:r,intent:o.z.literal("toggleRead"),reportHubId:e,clientTempId:n,updatedStatus:a,operationTimestamp:s}),addComment:o.z.object({status:r,intent:o.z.literal("addComment"),reportHubId:e,clientTempId:n,newComment:c}),deleteComment:o.z.object({status:r,intent:o.z.literal("deleteComment"),reportHubId:e,clientTempId:n,deletedCommentId:i}),clearCache:o.z.object({status:r,intent:o.z.literal("clearCache")})}},N=null,me=()=>(N===null&&(N=ue()),N),z=(e,n)=>{let r=me()[e].safeParse(n);return r.success?{result:r.data}:{mismatch:Y(r.error)}};var v="ids-stream",ce=e=>{if(typeof e!="object"||e===null)return"unknown";let n=e;return typeof n.kind=="string"?n.kind==="chunk"?"chunk":n.kind==="error"?"error":"unknown":Array.isArray(n.items)?"chunk":typeof n.error=="string"?"error":"unknown"},K=e=>ce(e)==="chunk";var V=Object.freeze({businessDate:"business-date",idsStream:v,report:"report",search:"search",reports:"reports",action:"action"}),F=Object.freeze({businessDate:"businessDate",reportHubId:"reportHubId",searchQuery:"q",searchCombine:"combine",reportIds:"ids",forceRefresh:"forceRefresh",cursorReportHubId:"cursor_report_hub_id",cursorBusinessDate:"cursor_business_date",cursorSnapshot:"cursor_snapshot"});var M=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),I=e=>Object.hasOwn(M,e);var W="download",Q="thumbnail",q="1",Z=(e,n,r)=>{let a=`${e}/attachment/${encodeURIComponent(n)}`;switch(r.kind){case"inline":return a;case"download":return`${a}?${new URLSearchParams({[W]:q})}`;case"thumbnail":return`${a}?${new URLSearchParams({[Q]:r.variant})}`}},G=e=>{let n=e.getAll(Q),r=e.getAll(W);if(n.length>0&&r.length>0)return{kind:"invalid",reason:"conflict"};if(n.length>0){let[a]=n;return n.length===1&&I(a)?{kind:"thumbnail",variant:a}:{kind:"invalid",reason:"thumbnail_variant"}}return r.length>0?r.length===1&&r[0]===q?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var ye=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var J=e=>e<10?`0${e}`:`${e}`,Re=e=>{if(Number.isNaN(e.getTime()))return null;let n=e.getFullYear(),r=J(e.getMonth()+1),a=J(e.getDate());return`${n}-${r}-${a}`},ge=e=>{let n=ye.exec(e);if(n===null)return null;let[,r,,a,s]=n,y=Number(r),l=Number(a),R=Number(s);if(y<1)return null;let g=new Date(0);return g.setUTCFullYear(y,l-1,R),g.getUTCFullYear()!==y||g.getUTCMonth()!==l-1||g.getUTCDate()!==R?null:`${r}-${a}-${s}`};var X=e=>e==null?null:e instanceof Date?Re(e):ge(e);var Ie=e=>typeof e=="string"?JSON.stringify(e):typeof e=="number"||typeof e=="boolean"||e===null||e===void 0?String(e):Array.isArray(e)?"array":typeof e,ee=(e,n,r)=>new RangeError(`[daily-report] ${e} must be ${n}; got ${Ie(r)}`);var te=(e,n,r,a)=>{if(typeof a!="string"||a.trim()==="")throw ee("mergeComments: unknownAuthorName","a non-blank string",a);let s=e.map((l,R)=>({id:`legacy-${R}`,authorName:l.name||a,content:l.text||"",isMine:!1,color:l.color||void 0,isLegacy:!0})),y=n.map(l=>({id:l.id,authorName:l.userName||a,content:l.content??"",createdAt:l.createdAt??"",isMine:r?l.userId===r:l.isMine,isLegacy:!1}));return[...s,...y]};var ne=["intersection","union"];var $e=Object.freeze({maxQueryLength:500,maxSets:16,maxWordsPerSet:16,maxWords:32,maxWordLength:100,maxDetailIds:100});0&&(module.exports={DAILY_REPORT_ACTION_FIELDS,DAILY_REPORT_ACTION_INTENTS,DAILY_REPORT_API_ENDPOINTS,DAILY_REPORT_API_QUERY_PARAMS,DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,DAILY_REPORT_CLIENT_TEMP_ID_PATTERN,DAILY_REPORT_SEARCH_COMBINES,DAILY_REPORT_SSE_CURSOR_PARAM,DAILY_REPORT_SSE_HEARTBEAT_MS,DAILY_REPORT_SSE_TERMINAL_EVENTS,buildDailyReportAttachmentUrl,commentAddMessageSchema,commentDeleteMessageSchema,connectedMessageSchema,dailyReportDetailSchema,dailyReportExternalCommentSchema,dailyReportInterviewerSchema,dailyReportLabelDefSchema,dailyReportPostedCommentSchema,dailyReportSseMessageSchema,encodeDailyReportActionCommand,isDailyReportAttachmentThumbnailVariant,isDailyReportSseStreamId,isIdsStreamChunkLine,mergeComments,normalizeBusinessDateKey,parseDailyReportActionResult,parseDailyReportAttachmentQuery,reportCreateMessageSchema,reportDeleteMessageSchema,reportPublishMessageSchema,reportUpdateMessageSchema,statusUpdateMessageSchema});
|
|
1
|
+
"use strict";var D=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ae=Object.prototype.hasOwnProperty;var ie=(e,r)=>{for(var n in r)D(e,n,{get:r[n],enumerable:!0})},se=(e,r,n,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let l of oe(r))!ae.call(e,l)&&l!==n&&D(e,l,{get:()=>r[l],enumerable:!(a=ne(r,l))||a.enumerable});return e};var le=e=>se(D({},"__esModule",{value:!0}),e);var Ae={};ie(Ae,{DAILY_REPORT_ACTION_FIELDS:()=>p,DAILY_REPORT_ACTION_INTENTS:()=>B,DAILY_REPORT_API_ENDPOINTS:()=>F,DAILY_REPORT_API_QUERY_PARAMS:()=>V,DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS:()=>M,DAILY_REPORT_CLIENT_TEMP_ID_PATTERN:()=>m,DAILY_REPORT_SEARCH_COMBINES:()=>re,DAILY_REPORT_SSE_CURSOR_PARAM:()=>H,DAILY_REPORT_SSE_HEARTBEAT_MS:()=>k,DAILY_REPORT_SSE_TERMINAL_EVENTS:()=>L,buildDailyReportAttachmentUrl:()=>G,commentAddMessageSchema:()=>x,commentDeleteMessageSchema:()=>_,connectedMessageSchema:()=>S,dailyReportDetailSchema:()=>d,dailyReportExternalCommentSchema:()=>b,dailyReportInterviewerSchema:()=>I,dailyReportLabelDefSchema:()=>A,dailyReportPostedCommentSchema:()=>c,dailyReportSseMessageSchema:()=>Y,encodeDailyReportActionCommand:()=>$,isDailyReportAttachmentThumbnailVariant:()=>g,isDailyReportSseStreamId:()=>U,isIdsStreamChunkLine:()=>W,mergeComments:()=>te,normalizeBusinessDateKey:()=>J,parseDailyReportActionResult:()=>v,parseDailyReportAttachmentQuery:()=>X,reportCreateMessageSchema:()=>E,reportDeleteMessageSchema:()=>P,reportPublishMessageSchema:()=>O,reportUpdateMessageSchema:()=>C,statusUpdateMessageSchema:()=>f});module.exports=le(Ae);var o=require("zod");var m=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|-[1-9][0-9]{0,15})$/;var N=require("zod");var i=N.z.number().int().positive().max(Number.MAX_SAFE_INTEGER);var t=require("zod");var L=["auth-required","forbidden","resync-required"],k=15e3,H="lastEventId",pe=/^\d{1,15}-\d{1,15}$/,U=e=>pe.test(e),I=t.z.object({name:t.z.string().nullish(),affiliation:t.z.string().nullish()}),b=t.z.object({name:t.z.string().nullish(),text:t.z.string().nullish(),color:t.z.string().nullish()}),A=t.z.object({id:i,name:t.z.string().nullish(),color:t.z.string().nullish()}),c=t.z.object({id:i,userId:t.z.string().nullish(),userName:t.z.string().nullish(),content:t.z.string().nullish(),createdAt:t.z.string().nullish(),isMine:t.z.boolean()}),de=t.z.object({id:t.z.string(),fileName:t.z.string(),fileType:t.z.string().nullable(),fileSize:t.z.number().nullable(),createdAt:t.z.string().nullable(),state:t.z.enum(["present","absent","unknown"]),hasThumbnail:t.z.boolean().default(!1)}),d=t.z.object({reportHubId:i,date:t.z.string().nullish(),createdAt:t.z.string().nullish(),author:t.z.string().nullish(),userId:t.z.string().nullish(),sourceType:t.z.string().nullish(),employeeName:t.z.string().nullish(),updatedBy:t.z.string().nullish(),updatedAt:t.z.string().nullish(),category:t.z.string().nullish(),creationCategory:t.z.string().nullish(),visitTimeFrom:t.z.string().nullish(),visitTimeTo:t.z.string().nullish(),customerName:t.z.string().nullish(),interviewers:t.z.array(I),subject:t.z.string().nullish(),content:t.z.string().nullish(),externalComments:t.z.array(b),isRead:t.z.boolean(),isStarred:t.z.boolean(),labels:t.z.array(A),postedComments:t.z.array(c),attachments:t.z.array(de).default([])}),u=t.z.string().regex(m),S=t.z.object({type:t.z.literal("connected")}),f=t.z.object({type:t.z.literal("status-update"),reportHubId:i,statusType:t.z.enum(["star","read"]),value:t.z.boolean(),clientTempId:u,recipientRawUserId:i.optional()}),T=t.z.string().optional(),x=t.z.object({type:t.z.literal("comment-add"),reportHubId:i,comment:c,clientTempId:u,recipientRawUserId:i.optional(),sourceType:T}),_=t.z.object({type:t.z.literal("comment-delete"),reportHubId:i,commentId:i,clientTempId:u,recipientRawUserId:i.optional(),sourceType:T}),E=t.z.object({type:t.z.literal("report-create"),reportHubId:i,report:d,clientTempId:u,recipientRawUserId:i.optional()}),C=t.z.object({type:t.z.literal("report-update"),reportHubId:i,report:d,clientTempId:u,recipientRawUserId:i.optional()}),O=t.z.object({type:t.z.literal("report-publish"),reportHubId:i,report:d,clientTempId:u,recipientRawUserId:i.optional()}),P=t.z.object({type:t.z.literal("report-delete"),reportHubId:i,clientTempId:u,sourceType:T}),Y=t.z.discriminatedUnion("type",[S,f,x,_,E,C,O,P]);var j=e=>e.issues.map(r=>`${r.path.length===0?"(root)":r.path.join(".")}: ${r.code}`).join("; ");var B=Object.freeze(["create","update","publish","delete","toggleStar","toggleRead","addComment","deleteComment","clearCache"]);var p=Object.freeze({intent:"intent",clientTempId:"clientTempId",businessDate:"businessDate",operationTimestamp:"operationTimestamp",reportHubId:"reportHubId",title:"title",content:"content",isStarred:"isStarred",isRead:"isRead",commentId:"commentId"}),$=e=>{let r=new FormData;if(r.append(p.intent,e.intent),e.intent==="clearCache"||(r.append(p.clientTempId,e.clientTempId),e.businessDate!==null&&r.append(p.businessDate,e.businessDate),e.operationTimestamp!==null&&r.append(p.operationTimestamp,String(e.operationTimestamp)),e.intent==="create"))return r;switch(r.append(p.reportHubId,String(e.reportHubId)),e.intent){case"update":return e.changes.title!==void 0&&r.append(p.title,e.changes.title),e.changes.content!==void 0&&r.append(p.content,e.changes.content),r;case"publish":case"delete":return r;case"toggleStar":return r.append(p.isStarred,String(e.value)),r;case"toggleRead":return r.append(p.isRead,String(e.value)),r;case"addComment":return r.append(p.content,e.content),r;case"deleteComment":return r.append(p.commentId,String(e.commentId)),r}},ue=()=>{let e=i,r=o.z.string().regex(m),n=o.z.literal("OK"),a=o.z.object({isStarred:o.z.boolean(),isRead:o.z.boolean()}),l=o.z.number().int().nonnegative().nullable();return{create:o.z.object({status:n,intent:o.z.literal("create"),reportHubId:e,clientTempId:r,report:d}),update:o.z.object({status:n,intent:o.z.literal("update"),reportHubId:e,clientTempId:r}),publish:o.z.object({status:n,intent:o.z.literal("publish"),reportHubId:e,clientTempId:r,report:d.nullable()}),delete:o.z.object({status:n,intent:o.z.literal("delete"),reportHubId:e,clientTempId:r}),toggleStar:o.z.object({status:n,intent:o.z.literal("toggleStar"),reportHubId:e,clientTempId:r,updatedStatus:a,operationTimestamp:l}),toggleRead:o.z.object({status:n,intent:o.z.literal("toggleRead"),reportHubId:e,clientTempId:r,updatedStatus:a,operationTimestamp:l}),addComment:o.z.object({status:n,intent:o.z.literal("addComment"),reportHubId:e,clientTempId:r,newComment:c}),deleteComment:o.z.object({status:n,intent:o.z.literal("deleteComment"),reportHubId:e,clientTempId:r,deletedCommentId:i}),clearCache:o.z.object({status:n,intent:o.z.literal("clearCache")})}},w=null,me=()=>(w===null&&(w=ue()),w),v=(e,r)=>{let n=me()[e].safeParse(r);return n.success?{result:n.data}:{mismatch:j(n.error)}};var z="ids-stream",ce=e=>{if(typeof e!="object"||e===null)return"unknown";let r=e;return typeof r.kind=="string"?r.kind==="chunk"?"chunk":r.kind==="error"?"error":"unknown":Array.isArray(r.items)?"chunk":typeof r.error=="string"?"error":"unknown"},W=e=>ce(e)==="chunk";var F=Object.freeze({businessDate:"business-date",idsStream:z,report:"report",search:"search",reports:"reports",searchMarks:"search-marks",action:"action"}),V=Object.freeze({businessDate:"businessDate",reportHubId:"reportHubId",searchQuery:"q",searchCombine:"combine",reportIds:"ids",forceRefresh:"forceRefresh",cursorReportHubId:"cursor_report_hub_id",cursorBusinessDate:"cursor_business_date",cursorSnapshot:"cursor_snapshot"});var M=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),g=e=>Object.hasOwn(M,e);var K="download",Q="thumbnail",q="1",G=(e,r,n)=>{let a=`${e}/attachment/${encodeURIComponent(r)}`;switch(n.kind){case"inline":return a;case"download":return`${a}?${new URLSearchParams({[K]:q})}`;case"thumbnail":return`${a}?${new URLSearchParams({[Q]:n.variant})}`}},X=e=>{let r=e.getAll(Q),n=e.getAll(K);if(r.length>0&&n.length>0)return{kind:"invalid",reason:"conflict"};if(r.length>0){let[a]=r;return r.length===1&&g(a)?{kind:"thumbnail",variant:a}:{kind:"invalid",reason:"thumbnail_variant"}}return n.length>0?n.length===1&&n[0]===q?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var ye=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var Z=e=>e<10?`0${e}`:`${e}`,Re=e=>{if(Number.isNaN(e.getTime()))return null;let r=e.getFullYear(),n=Z(e.getMonth()+1),a=Z(e.getDate());return`${r}-${n}-${a}`},he=e=>{let r=ye.exec(e);if(r===null)return null;let[,n,,a,l]=r,y=Number(n),s=Number(a),R=Number(l);if(y<1)return null;let h=new Date(0);return h.setUTCFullYear(y,s-1,R),h.getUTCFullYear()!==y||h.getUTCMonth()!==s-1||h.getUTCDate()!==R?null:`${n}-${a}-${l}`};var J=e=>e==null?null:e instanceof Date?Re(e):he(e);var ge=e=>typeof e=="string"?JSON.stringify(e):typeof e=="number"||typeof e=="boolean"||e===null||e===void 0?String(e):Array.isArray(e)?"array":typeof e,ee=(e,r,n)=>new RangeError(`[daily-report] ${e} must be ${r}; got ${ge(n)}`);var De="legacy-",Ie=e=>`${De}${e}`,te=(e,r,n,a)=>{if(typeof a!="string"||a.trim()==="")throw ee("mergeComments: unknownAuthorName","a non-blank string",a);let l=e.map((s,R)=>({id:Ie(R),authorName:s.name||a,content:s.text||"",isMine:!1,color:s.color||void 0,isLegacy:!0,isAuthorUnknown:!s.name})),y=r.map(s=>({id:s.id,authorName:s.userName||a,content:s.content??"",createdAt:s.createdAt??"",isMine:n?s.userId===n:s.isMine,isLegacy:!1,isAuthorUnknown:!s.userName}));return[...l,...y]};var re=["intersection","union"];var We=Object.freeze({maxQueryLength:500,maxSets:16,maxWordsPerSet:16,maxWords:32,maxWordLength:100,maxDetailIds:100}),be=2;var Fe=Object.freeze({word:0,reading:1});var Ve=2*(1+be);0&&(module.exports={DAILY_REPORT_ACTION_FIELDS,DAILY_REPORT_ACTION_INTENTS,DAILY_REPORT_API_ENDPOINTS,DAILY_REPORT_API_QUERY_PARAMS,DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,DAILY_REPORT_CLIENT_TEMP_ID_PATTERN,DAILY_REPORT_SEARCH_COMBINES,DAILY_REPORT_SSE_CURSOR_PARAM,DAILY_REPORT_SSE_HEARTBEAT_MS,DAILY_REPORT_SSE_TERMINAL_EVENTS,buildDailyReportAttachmentUrl,commentAddMessageSchema,commentDeleteMessageSchema,connectedMessageSchema,dailyReportDetailSchema,dailyReportExternalCommentSchema,dailyReportInterviewerSchema,dailyReportLabelDefSchema,dailyReportPostedCommentSchema,dailyReportSseMessageSchema,encodeDailyReportActionCommand,isDailyReportAttachmentThumbnailVariant,isDailyReportSseStreamId,isIdsStreamChunkLine,mergeComments,normalizeBusinessDateKey,parseDailyReportActionResult,parseDailyReportAttachmentQuery,reportCreateMessageSchema,reportDeleteMessageSchema,reportPublishMessageSchema,reportUpdateMessageSchema,statusUpdateMessageSchema});
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as o}from"zod";var c=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|-[1-9][0-9]{0,15})$/;import{z as
|
|
1
|
+
import{z as o}from"zod";var c=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|-[1-9][0-9]{0,15})$/;import{z as j}from"zod";var a=j.number().int().positive().max(Number.MAX_SAFE_INTEGER);import{z as t}from"zod";var B=["auth-required","forbidden","resync-required"],$=15e3,v="lastEventId",z=/^\d{1,15}-\d{1,15}$/,W=e=>z.test(e),b=t.object({name:t.string().nullish(),affiliation:t.string().nullish()}),A=t.object({name:t.string().nullish(),text:t.string().nullish(),color:t.string().nullish()}),S=t.object({id:a,name:t.string().nullish(),color:t.string().nullish()}),y=t.object({id:a,userId:t.string().nullish(),userName:t.string().nullish(),content:t.string().nullish(),createdAt:t.string().nullish(),isMine:t.boolean()}),F=t.object({id:t.string(),fileName:t.string(),fileType:t.string().nullable(),fileSize:t.number().nullable(),createdAt:t.string().nullable(),state:t.enum(["present","absent","unknown"]),hasThumbnail:t.boolean().default(!1)}),d=t.object({reportHubId:a,date:t.string().nullish(),createdAt:t.string().nullish(),author:t.string().nullish(),userId:t.string().nullish(),sourceType:t.string().nullish(),employeeName:t.string().nullish(),updatedBy:t.string().nullish(),updatedAt:t.string().nullish(),category:t.string().nullish(),creationCategory:t.string().nullish(),visitTimeFrom:t.string().nullish(),visitTimeTo:t.string().nullish(),customerName:t.string().nullish(),interviewers:t.array(b),subject:t.string().nullish(),content:t.string().nullish(),externalComments:t.array(A),isRead:t.boolean(),isStarred:t.boolean(),labels:t.array(S),postedComments:t.array(y),attachments:t.array(F).default([])}),u=t.string().regex(c),f=t.object({type:t.literal("connected")}),T=t.object({type:t.literal("status-update"),reportHubId:a,statusType:t.enum(["star","read"]),value:t.boolean(),clientTempId:u,recipientRawUserId:a.optional()}),g=t.string().optional(),x=t.object({type:t.literal("comment-add"),reportHubId:a,comment:y,clientTempId:u,recipientRawUserId:a.optional(),sourceType:g}),_=t.object({type:t.literal("comment-delete"),reportHubId:a,commentId:a,clientTempId:u,recipientRawUserId:a.optional(),sourceType:g}),E=t.object({type:t.literal("report-create"),reportHubId:a,report:d,clientTempId:u,recipientRawUserId:a.optional()}),C=t.object({type:t.literal("report-update"),reportHubId:a,report:d,clientTempId:u,recipientRawUserId:a.optional()}),O=t.object({type:t.literal("report-publish"),reportHubId:a,report:d,clientTempId:u,recipientRawUserId:a.optional()}),P=t.object({type:t.literal("report-delete"),reportHubId:a,clientTempId:u,sourceType:g}),V=t.discriminatedUnion("type",[f,T,x,_,E,C,O,P]);var w=e=>e.issues.map(r=>`${r.path.length===0?"(root)":r.path.join(".")}: ${r.code}`).join("; ");var K=Object.freeze(["create","update","publish","delete","toggleStar","toggleRead","addComment","deleteComment","clearCache"]);var l=Object.freeze({intent:"intent",clientTempId:"clientTempId",businessDate:"businessDate",operationTimestamp:"operationTimestamp",reportHubId:"reportHubId",title:"title",content:"content",isStarred:"isStarred",isRead:"isRead",commentId:"commentId"}),Q=e=>{let r=new FormData;if(r.append(l.intent,e.intent),e.intent==="clearCache"||(r.append(l.clientTempId,e.clientTempId),e.businessDate!==null&&r.append(l.businessDate,e.businessDate),e.operationTimestamp!==null&&r.append(l.operationTimestamp,String(e.operationTimestamp)),e.intent==="create"))return r;switch(r.append(l.reportHubId,String(e.reportHubId)),e.intent){case"update":return e.changes.title!==void 0&&r.append(l.title,e.changes.title),e.changes.content!==void 0&&r.append(l.content,e.changes.content),r;case"publish":case"delete":return r;case"toggleStar":return r.append(l.isStarred,String(e.value)),r;case"toggleRead":return r.append(l.isRead,String(e.value)),r;case"addComment":return r.append(l.content,e.content),r;case"deleteComment":return r.append(l.commentId,String(e.commentId)),r}},q=()=>{let e=a,r=o.string().regex(c),n=o.literal("OK"),i=o.object({isStarred:o.boolean(),isRead:o.boolean()}),p=o.number().int().nonnegative().nullable();return{create:o.object({status:n,intent:o.literal("create"),reportHubId:e,clientTempId:r,report:d}),update:o.object({status:n,intent:o.literal("update"),reportHubId:e,clientTempId:r}),publish:o.object({status:n,intent:o.literal("publish"),reportHubId:e,clientTempId:r,report:d.nullable()}),delete:o.object({status:n,intent:o.literal("delete"),reportHubId:e,clientTempId:r}),toggleStar:o.object({status:n,intent:o.literal("toggleStar"),reportHubId:e,clientTempId:r,updatedStatus:i,operationTimestamp:p}),toggleRead:o.object({status:n,intent:o.literal("toggleRead"),reportHubId:e,clientTempId:r,updatedStatus:i,operationTimestamp:p}),addComment:o.object({status:n,intent:o.literal("addComment"),reportHubId:e,clientTempId:r,newComment:y}),deleteComment:o.object({status:n,intent:o.literal("deleteComment"),reportHubId:e,clientTempId:r,deletedCommentId:a}),clearCache:o.object({status:n,intent:o.literal("clearCache")})}},D=null,G=()=>(D===null&&(D=q()),D),X=(e,r)=>{let n=G()[e].safeParse(r);return n.success?{result:n.data}:{mismatch:w(n.error)}};var M="ids-stream",Z=e=>{if(typeof e!="object"||e===null)return"unknown";let r=e;return typeof r.kind=="string"?r.kind==="chunk"?"chunk":r.kind==="error"?"error":"unknown":Array.isArray(r.items)?"chunk":typeof r.error=="string"?"error":"unknown"},J=e=>Z(e)==="chunk";var ee=Object.freeze({businessDate:"business-date",idsStream:M,report:"report",search:"search",reports:"reports",searchMarks:"search-marks",action:"action"}),te=Object.freeze({businessDate:"businessDate",reportHubId:"reportHubId",searchQuery:"q",searchCombine:"combine",reportIds:"ids",forceRefresh:"forceRefresh",cursorReportHubId:"cursor_report_hub_id",cursorBusinessDate:"cursor_business_date",cursorSnapshot:"cursor_snapshot"});var N=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),I=e=>Object.hasOwn(N,e);var L="download",k="thumbnail",H="1",re=(e,r,n)=>{let i=`${e}/attachment/${encodeURIComponent(r)}`;switch(n.kind){case"inline":return i;case"download":return`${i}?${new URLSearchParams({[L]:H})}`;case"thumbnail":return`${i}?${new URLSearchParams({[k]:n.variant})}`}},ne=e=>{let r=e.getAll(k),n=e.getAll(L);if(r.length>0&&n.length>0)return{kind:"invalid",reason:"conflict"};if(r.length>0){let[i]=r;return r.length===1&&I(i)?{kind:"thumbnail",variant:i}:{kind:"invalid",reason:"thumbnail_variant"}}return n.length>0?n.length===1&&n[0]===H?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var oe=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var U=e=>e<10?`0${e}`:`${e}`,ae=e=>{if(Number.isNaN(e.getTime()))return null;let r=e.getFullYear(),n=U(e.getMonth()+1),i=U(e.getDate());return`${r}-${n}-${i}`},ie=e=>{let r=oe.exec(e);if(r===null)return null;let[,n,,i,p]=r,m=Number(n),s=Number(i),R=Number(p);if(m<1)return null;let h=new Date(0);return h.setUTCFullYear(m,s-1,R),h.getUTCFullYear()!==m||h.getUTCMonth()!==s-1||h.getUTCDate()!==R?null:`${n}-${i}-${p}`};var se=e=>e==null?null:e instanceof Date?ae(e):ie(e);var le=e=>typeof e=="string"?JSON.stringify(e):typeof e=="number"||typeof e=="boolean"||e===null||e===void 0?String(e):Array.isArray(e)?"array":typeof e,Y=(e,r,n)=>new RangeError(`[daily-report] ${e} must be ${r}; got ${le(n)}`);var pe="legacy-",de=e=>`${pe}${e}`,ue=(e,r,n,i)=>{if(typeof i!="string"||i.trim()==="")throw Y("mergeComments: unknownAuthorName","a non-blank string",i);let p=e.map((s,R)=>({id:de(R),authorName:s.name||i,content:s.text||"",isMine:!1,color:s.color||void 0,isLegacy:!0,isAuthorUnknown:!s.name})),m=r.map(s=>({id:s.id,authorName:s.userName||i,content:s.content??"",createdAt:s.createdAt??"",isMine:n?s.userId===n:s.isMine,isLegacy:!1,isAuthorUnknown:!s.userName}));return[...p,...m]};var me=["intersection","union"];var Ye=Object.freeze({maxQueryLength:500,maxSets:16,maxWordsPerSet:16,maxWords:32,maxWordLength:100,maxDetailIds:100}),ce=2;var je=Object.freeze({word:0,reading:1});var Be=2*(1+ce);export{l as DAILY_REPORT_ACTION_FIELDS,K as DAILY_REPORT_ACTION_INTENTS,ee as DAILY_REPORT_API_ENDPOINTS,te as DAILY_REPORT_API_QUERY_PARAMS,N as DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,c as DAILY_REPORT_CLIENT_TEMP_ID_PATTERN,me as DAILY_REPORT_SEARCH_COMBINES,v as DAILY_REPORT_SSE_CURSOR_PARAM,$ as DAILY_REPORT_SSE_HEARTBEAT_MS,B as DAILY_REPORT_SSE_TERMINAL_EVENTS,re as buildDailyReportAttachmentUrl,x as commentAddMessageSchema,_ as commentDeleteMessageSchema,f as connectedMessageSchema,d as dailyReportDetailSchema,A as dailyReportExternalCommentSchema,b as dailyReportInterviewerSchema,S as dailyReportLabelDefSchema,y as dailyReportPostedCommentSchema,V as dailyReportSseMessageSchema,Q as encodeDailyReportActionCommand,I as isDailyReportAttachmentThumbnailVariant,W as isDailyReportSseStreamId,J as isIdsStreamChunkLine,ue as mergeComments,se as normalizeBusinessDateKey,X as parseDailyReportActionResult,ne as parseDailyReportAttachmentQuery,E as reportCreateMessageSchema,P as reportDeleteMessageSchema,O as reportPublishMessageSchema,C as reportUpdateMessageSchema,T as statusUpdateMessageSchema};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
declare const DAILY_REPORT_SEARCH_COMBINES: readonly [
|
|
2
|
+
"intersection",
|
|
3
|
+
"union"
|
|
4
|
+
];
|
|
5
|
+
type DailyReportSearchCombine = (typeof DAILY_REPORT_SEARCH_COMBINES)[number];
|
|
6
|
+
type DailyReportSearchAlternativeTier = 0 | 1;
|
|
7
|
+
type DailyReportSearchAlternative = {
|
|
8
|
+
readonly text: string;
|
|
9
|
+
readonly tier: DailyReportSearchAlternativeTier;
|
|
10
|
+
};
|
|
11
|
+
type DailyReportSearchHit = {
|
|
12
|
+
readonly reportHubId: number;
|
|
13
|
+
readonly businessDate: string | null;
|
|
14
|
+
readonly sourceType: string;
|
|
15
|
+
};
|
|
16
|
+
interface DailyReportLogger {
|
|
17
|
+
debug(message?: unknown, ...optionalParams: unknown[]): void;
|
|
18
|
+
info(message?: unknown, ...optionalParams: unknown[]): void;
|
|
19
|
+
warn(message?: unknown, ...optionalParams: unknown[]): void;
|
|
20
|
+
error(message?: unknown, ...optionalParams: unknown[]): void;
|
|
21
|
+
}
|
|
22
|
+
type DailyReportSearchFieldMarks = {
|
|
23
|
+
readonly fingerprint: number;
|
|
24
|
+
readonly ranges: readonly number[];
|
|
25
|
+
};
|
|
26
|
+
type DailyReportSearchReportMarks = {
|
|
27
|
+
readonly reportHubId: number;
|
|
28
|
+
readonly matchedSets: number | null;
|
|
29
|
+
readonly fields: Readonly<Record<string, DailyReportSearchFieldMarks>>;
|
|
30
|
+
};
|
|
31
|
+
type DailyReportSearchMarksAnswer = {
|
|
32
|
+
readonly wordsDigest: number;
|
|
33
|
+
readonly reports: readonly DailyReportSearchReportMarks[];
|
|
34
|
+
};
|
|
35
|
+
export { DAILY_REPORT_SEARCH_COMBINES as D, type DailyReportLogger as a, type DailyReportSearchCombine as b, type DailyReportSearchFieldMarks as c, type DailyReportSearchHit as d, type DailyReportSearchMarksAnswer as e, type DailyReportSearchReportMarks as f, type DailyReportSearchAlternative as g, type DailyReportSearchAlternativeTier as h };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
declare const DAILY_REPORT_SEARCH_COMBINES: readonly [
|
|
2
|
+
"intersection",
|
|
3
|
+
"union"
|
|
4
|
+
];
|
|
5
|
+
type DailyReportSearchCombine = (typeof DAILY_REPORT_SEARCH_COMBINES)[number];
|
|
6
|
+
type DailyReportSearchAlternativeTier = 0 | 1;
|
|
7
|
+
type DailyReportSearchAlternative = {
|
|
8
|
+
readonly text: string;
|
|
9
|
+
readonly tier: DailyReportSearchAlternativeTier;
|
|
10
|
+
};
|
|
11
|
+
type DailyReportSearchHit = {
|
|
12
|
+
readonly reportHubId: number;
|
|
13
|
+
readonly businessDate: string | null;
|
|
14
|
+
readonly sourceType: string;
|
|
15
|
+
};
|
|
16
|
+
interface DailyReportLogger {
|
|
17
|
+
debug(message?: unknown, ...optionalParams: unknown[]): void;
|
|
18
|
+
info(message?: unknown, ...optionalParams: unknown[]): void;
|
|
19
|
+
warn(message?: unknown, ...optionalParams: unknown[]): void;
|
|
20
|
+
error(message?: unknown, ...optionalParams: unknown[]): void;
|
|
21
|
+
}
|
|
22
|
+
type DailyReportSearchFieldMarks = {
|
|
23
|
+
readonly fingerprint: number;
|
|
24
|
+
readonly ranges: readonly number[];
|
|
25
|
+
};
|
|
26
|
+
type DailyReportSearchReportMarks = {
|
|
27
|
+
readonly reportHubId: number;
|
|
28
|
+
readonly matchedSets: number | null;
|
|
29
|
+
readonly fields: Readonly<Record<string, DailyReportSearchFieldMarks>>;
|
|
30
|
+
};
|
|
31
|
+
type DailyReportSearchMarksAnswer = {
|
|
32
|
+
readonly wordsDigest: number;
|
|
33
|
+
readonly reports: readonly DailyReportSearchReportMarks[];
|
|
34
|
+
};
|
|
35
|
+
export { DAILY_REPORT_SEARCH_COMBINES as D, type DailyReportLogger as a, type DailyReportSearchCombine as b, type DailyReportSearchFieldMarks as c, type DailyReportSearchHit as d, type DailyReportSearchMarksAnswer as e, type DailyReportSearchReportMarks as f, type DailyReportSearchAlternative as g, type DailyReportSearchAlternativeTier as h };
|
package/dist/server.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { c as DailyReportSseMessage, k as DailyReportInterviewer, j as DailyReportExternalComment, D as DailyReportItem, d as DailyReportDetail, i as DailyReportAttachmentSummary, m as DailyReportPostedComment } from "./sse-schema-getLS62T.mjs";
|
|
2
2
|
import * as drizzle_orm_mssql_core from "drizzle-orm/mssql-core";
|
|
3
3
|
import { AnyMsSqlColumn } from "drizzle-orm/mssql-core";
|
|
4
|
-
import { a as DailyReportLogger, b as DailyReportSearchCombine,
|
|
4
|
+
import { a as DailyReportLogger, b as DailyReportSearchCombine, g as DailyReportSearchAlternative, d as DailyReportSearchHit, e as DailyReportSearchMarksAnswer } from "./search-marks-wire-CZRU4q3h.mjs";
|
|
5
|
+
export { h as DailyReportSearchAlternativeTier } from "./search-marks-wire-CZRU4q3h.mjs";
|
|
5
6
|
import { TransactionRetryOptions } from "@aiquants/mssql";
|
|
6
7
|
import { SQL } from "drizzle-orm";
|
|
7
8
|
import "zod";
|
|
@@ -132,11 +133,16 @@ type DailyReportAttachmentThumbnailRenderer = {
|
|
|
132
133
|
signal: AbortSignal;
|
|
133
134
|
}) => Promise<DailyReportAttachmentThumbnail | DailyReportAttachmentThumbnailError>;
|
|
134
135
|
};
|
|
136
|
+
type SqlResultCacheMissAdmission = {
|
|
137
|
+
readonly signal: AbortSignal;
|
|
138
|
+
readonly acquire: (signal: AbortSignal) => Promise<(() => void) | null>;
|
|
139
|
+
};
|
|
135
140
|
type SqlResultCacheQueryOptions = {
|
|
136
141
|
forceRefresh?: boolean;
|
|
137
142
|
snapshot?: boolean;
|
|
138
143
|
ttlMsOverride?: number;
|
|
139
144
|
epochKey?: string;
|
|
145
|
+
admission?: SqlResultCacheMissAdmission;
|
|
140
146
|
refreshAheadRatio?: number;
|
|
141
147
|
};
|
|
142
148
|
declare const createEpochStore: (redis?: DailyReportRedisProvider) => {
|
|
@@ -145,14 +151,18 @@ declare const createEpochStore: (redis?: DailyReportRedisProvider) => {
|
|
|
145
151
|
};
|
|
146
152
|
type EpochStore = ReturnType<typeof createEpochStore>;
|
|
147
153
|
declare class SqlResultCache {
|
|
148
|
-
private readonly config;
|
|
149
154
|
private readonly epochStore;
|
|
150
155
|
private readonly buckets;
|
|
151
156
|
private readonly inFlight;
|
|
152
157
|
private readonly forcedFetches;
|
|
158
|
+
private readonly defaultTtlMs;
|
|
159
|
+
private readonly maxBuckets;
|
|
160
|
+
private lastSweepAt;
|
|
153
161
|
constructor(config: {
|
|
154
|
-
defaultTtlMs: number;
|
|
162
|
+
readonly defaultTtlMs: number;
|
|
163
|
+
readonly maxBuckets: number;
|
|
155
164
|
}, epochStore: EpochStore);
|
|
165
|
+
private writeBucket;
|
|
156
166
|
private maybeRefreshAhead;
|
|
157
167
|
private startFetch;
|
|
158
168
|
private forcedFetch;
|
|
@@ -162,9 +172,10 @@ declare class SqlResultCache {
|
|
|
162
172
|
fetcher: () => Promise<readonly T[]>;
|
|
163
173
|
onFetchStart?: () => void;
|
|
164
174
|
} & SqlResultCacheQueryOptions) => Promise<readonly T[]>;
|
|
175
|
+
private readOwnOrRetry;
|
|
165
176
|
clearAll: () => void;
|
|
166
177
|
invalidatePrefix: (prefix: string) => void;
|
|
167
|
-
private
|
|
178
|
+
private sweepExpired;
|
|
168
179
|
}
|
|
169
180
|
type ExternalReportFields = {
|
|
170
181
|
content?: string | null;
|
|
@@ -1702,7 +1713,7 @@ type DailyReportSearchReconcileOptions = {
|
|
|
1702
1713
|
readonly onProgress?: (progress: DailyReportSearchReconcileProgress) => void;
|
|
1703
1714
|
};
|
|
1704
1715
|
type DailyReportSearchWord = {
|
|
1705
|
-
readonly alternatives: readonly
|
|
1716
|
+
readonly alternatives: readonly DailyReportSearchAlternative[];
|
|
1706
1717
|
};
|
|
1707
1718
|
type DailyReportSearchSet = {
|
|
1708
1719
|
readonly words: readonly DailyReportSearchWord[];
|
|
@@ -1835,18 +1846,21 @@ declare function createDailyReportService(config: DailyReportServiceConfig): {
|
|
|
1835
1846
|
clearCache: () => Promise<void>;
|
|
1836
1847
|
invalidateHubReadCaches: (hubIds: readonly number[], businessDates: readonly string[]) => Promise<void>;
|
|
1837
1848
|
getUserIdByExternalId: (externalId: string) => Promise<number | null>;
|
|
1838
|
-
getDailyReportIdsByExternalId: (scope: DailyReportViewerScope, externalId: string, { forceRefresh, snapshot, ttlMsOverride, onFetchStart }?: SqlResultCacheQueryOptions & {
|
|
1849
|
+
getDailyReportIdsByExternalId: (scope: DailyReportViewerScope, externalId: string, { forceRefresh, snapshot, ttlMsOverride, onFetchStart, admission }?: SqlResultCacheQueryOptions & {
|
|
1839
1850
|
onFetchStart?: () => void;
|
|
1840
1851
|
}) => Promise<DailyReportIdsSource>;
|
|
1841
1852
|
getDailyReportIdsFirstPageByExternalId: (scope: DailyReportViewerScope, externalId: string, limit: number) => Promise<DailyReportItem[]>;
|
|
1842
1853
|
readSseStreamAnchor: () => Promise<string | null>;
|
|
1843
|
-
getDailyReportsByBusinessDate: (scope: DailyReportViewerScope, businessDate: string, { forceRefresh, snapshot, ttlMsOverride }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail[]>;
|
|
1844
|
-
getDailyReportsByBusinessDateByExternalId: (scope: DailyReportViewerScope, businessDate: string, externalId: string, { forceRefresh, snapshot, ttlMsOverride }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail[]>;
|
|
1845
|
-
getDailyReportDetailById: (scope: DailyReportViewerScope, reportHubId: number, userId: number, { forceRefresh, snapshot, ttlMsOverride }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail | null>;
|
|
1854
|
+
getDailyReportsByBusinessDate: (scope: DailyReportViewerScope, businessDate: string, { forceRefresh, snapshot, ttlMsOverride }?: Omit<SqlResultCacheQueryOptions, "admission">) => Promise<DailyReportDetail[]>;
|
|
1855
|
+
getDailyReportsByBusinessDateByExternalId: (scope: DailyReportViewerScope, businessDate: string, externalId: string, { forceRefresh, snapshot, ttlMsOverride, admission }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail[]>;
|
|
1856
|
+
getDailyReportDetailById: (scope: DailyReportViewerScope, reportHubId: number, userId: number, { forceRefresh, snapshot, ttlMsOverride, admission }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail | null>;
|
|
1846
1857
|
getDailyReportDetailByIdByExternalId: (scope: DailyReportViewerScope, reportHubId: number, externalId: string, options?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail | null>;
|
|
1847
1858
|
getDailyReportDetailsByIdsByExternalId: (scope: DailyReportViewerScope, reportHubIds: readonly number[], externalId: string) => Promise<DailyReportDetail[]>;
|
|
1848
1859
|
getDraftLabelId: () => Promise<number | null>;
|
|
1849
1860
|
searchDailyReports: (scope: DailyReportViewerScope, userId: number, plan: DailyReportSearchPlan) => Promise<DailyReportSearchHit[]>;
|
|
1861
|
+
markDailyReportSearchHits: (scope: DailyReportViewerScope, userId: number, plan: DailyReportSearchPlan, reportHubIds: readonly number[], options: {
|
|
1862
|
+
readonly signal: AbortSignal;
|
|
1863
|
+
}) => Promise<DailyReportSearchMarksAnswer>;
|
|
1850
1864
|
reconcileSearchIndex: (options: DailyReportSearchReconcileOptions) => Promise<DailyReportSearchReconcileSummary>;
|
|
1851
1865
|
getAttachmentsByHubIds: (hubIds: number[]) => Promise<Map<number, DailyReportAttachmentSummary[]>>;
|
|
1852
1866
|
getAttachmentForUser: (scope: DailyReportViewerScope, attachmentId: number, userId: number) => Promise<{
|
|
@@ -1934,8 +1948,6 @@ declare class DailyReportSseReader implements DailyReportSseReaderPort {
|
|
|
1934
1948
|
private _readLoop;
|
|
1935
1949
|
private _invalidateCaches;
|
|
1936
1950
|
}
|
|
1937
|
-
declare const generateETag: (data: unknown) => string;
|
|
1938
|
-
declare const jsonResponseWithETag: (request: Request, cookie: string | null, payload: Record<string, unknown>, status?: number) => Response;
|
|
1939
1951
|
type SharpHeaderLike = {
|
|
1940
1952
|
width: number;
|
|
1941
1953
|
height: number;
|
|
@@ -2040,6 +2052,7 @@ type DailyReportServerConfig = Omit<DailyReportServiceConfig, "cache" | "epochs"
|
|
|
2040
2052
|
loginRedirectPath?: string;
|
|
2041
2053
|
enableDevCacheClear?: boolean;
|
|
2042
2054
|
cacheDefaultTtlMs?: number;
|
|
2055
|
+
cacheMaxBuckets?: number;
|
|
2043
2056
|
externalSources?: DailyReportExternalSource[];
|
|
2044
2057
|
};
|
|
2045
2058
|
type DailyReportServer = DailyReportHandlers & {
|
|
@@ -2051,4 +2064,4 @@ type DailyReportServer = DailyReportHandlers & {
|
|
|
2051
2064
|
knownSourceTypes: readonly string[];
|
|
2052
2065
|
};
|
|
2053
2066
|
declare function createDailyReportServer(config: DailyReportServerConfig): DailyReportServer;
|
|
2054
|
-
export { DAILY_REPORT_ATTACHMENT_THUMBNAIL_MAX_OUTPUT_BYTES, DAILY_REPORT_ATTACHMENT_THUMBNAIL_OUTPUT_MEDIA_TYPES, DAILY_REPORT_SHARP_THUMBNAIL_DECODE_BUDGET_BYTES, DAILY_REPORT_SHARP_THUMBNAIL_DECODE_WORK_MODEL, DAILY_REPORT_SHARP_THUMBNAIL_WORKING_SET_MODEL, DAILY_REPORT_SSE_CATCH_UP_BATCH, DAILY_REPORT_SSE_VISIBILITY_REFRESH_MS, type DailyReportAttachmentBytes, type DailyReportAttachmentDelivery, type DailyReportAttachmentError, type DailyReportAttachmentFailure, type DailyReportAttachmentTable, type DailyReportAttachmentThumbnail, type AttachmentThumbnailDelivery as DailyReportAttachmentThumbnailDelivery, type DailyReportAttachmentThumbnailError, type DailyReportAttachmentThumbnailFailure, type DailyReportAttachmentThumbnailOutputMediaType, type DailyReportAttachmentThumbnailRenderer, type DailyReportAttachmentThumbnailSourceFormat, type DailyReportAttachmentThumbnailsConfig, type DailyReportAttachmentsConfig, type DailyReportAuthResult, type DailyReportAuthenticate, type DailyReportClientTempId, type DailyReportCommentTable, type DailyReportDb, type DeleteChain as DailyReportDbDeleteChain, type InsertChain as DailyReportDbInsertChain, type Rows as DailyReportDbRows, type SelectChain as DailyReportDbSelectChain, type UpdateChain as DailyReportDbUpdateChain, type DailyReportEncodeUserId, type EpochStore as DailyReportEpochStore, type DailyReportExternalSource, type DailyReportHandlers, 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 RedisStreamMessage as DailyReportRedisStreamMessage, type DailyReportResolveUserId, type DailyReportResolveVisibleSourceTypes, type ResourceRouteArgs as DailyReportResourceRouteArgs, type DailyReportSearchCommentTable, type DailyReportSearchConfig, type DailyReportSearchDocumentTable, type DailyReportSearchPlan, type DailyReportSearchReconcileOptions, type DailyReportSearchReconcileProgress, type DailyReportSearchReconcileSummary, type DailyReportSearchSet, type DailyReportSearchSourceTextReader, type DailyReportSearchSqlExecutor, type DailyReportSearchTables, type DailyReportSearchWord, type DailyReportServer, type DailyReportServerConfig, type DailyReportService, type DailyReportServiceConfig, type SharpHeaderLike as DailyReportSharpHeaderLike, type SharpPipelineLike as DailyReportSharpPipelineLike, type SqlResultCacheQueryOptions as DailyReportSqlResultCacheQueryOptions, type DailyReportSseEntryMessage, DailyReportSseReader, type DailyReportSseReaderConfig, type DailyReportSseReaderPort, type DailyReportTables, type DailyReportUserStatusRow, type DailyReportUserStatusTable, type DailyReportUserTable, DailyReportViewerScope, type DailyReportVisibilityDimensions, type DailyReportVisibilityResolveContext, type DailyReportVisibilityResolveReason, type VisibleSourceTypeSet as DailyReportVisibleSourceTypeSet, type DailyReportVisibleSourceTypes, type ExternalReportFields, type SharpLike, SqlResultCache, type StreamEntry, createDailyReportHandlers, createDailyReportServer, createDailyReportService, createEpochStore, createSharpThumbnailRenderer, defineDailyReportSchema, defineDailyReportSearchSchema,
|
|
2067
|
+
export { DAILY_REPORT_ATTACHMENT_THUMBNAIL_MAX_OUTPUT_BYTES, DAILY_REPORT_ATTACHMENT_THUMBNAIL_OUTPUT_MEDIA_TYPES, DAILY_REPORT_SHARP_THUMBNAIL_DECODE_BUDGET_BYTES, DAILY_REPORT_SHARP_THUMBNAIL_DECODE_WORK_MODEL, DAILY_REPORT_SHARP_THUMBNAIL_WORKING_SET_MODEL, DAILY_REPORT_SSE_CATCH_UP_BATCH, DAILY_REPORT_SSE_VISIBILITY_REFRESH_MS, type DailyReportAttachmentBytes, type DailyReportAttachmentDelivery, type DailyReportAttachmentError, type DailyReportAttachmentFailure, type DailyReportAttachmentTable, type DailyReportAttachmentThumbnail, type AttachmentThumbnailDelivery as DailyReportAttachmentThumbnailDelivery, type DailyReportAttachmentThumbnailError, type DailyReportAttachmentThumbnailFailure, type DailyReportAttachmentThumbnailOutputMediaType, type DailyReportAttachmentThumbnailRenderer, type DailyReportAttachmentThumbnailSourceFormat, type DailyReportAttachmentThumbnailsConfig, type DailyReportAttachmentsConfig, type DailyReportAuthResult, type DailyReportAuthenticate, type DailyReportClientTempId, type DailyReportCommentTable, type DailyReportDb, type DeleteChain as DailyReportDbDeleteChain, type InsertChain as DailyReportDbInsertChain, type Rows as DailyReportDbRows, type SelectChain as DailyReportDbSelectChain, type UpdateChain as DailyReportDbUpdateChain, type DailyReportEncodeUserId, type EpochStore as DailyReportEpochStore, type DailyReportExternalSource, type DailyReportHandlers, 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 RedisStreamMessage as DailyReportRedisStreamMessage, type DailyReportResolveUserId, type DailyReportResolveVisibleSourceTypes, type ResourceRouteArgs as DailyReportResourceRouteArgs, DailyReportSearchAlternative, type DailyReportSearchCommentTable, type DailyReportSearchConfig, type DailyReportSearchDocumentTable, type DailyReportSearchPlan, type DailyReportSearchReconcileOptions, type DailyReportSearchReconcileProgress, type DailyReportSearchReconcileSummary, type DailyReportSearchSet, type DailyReportSearchSourceTextReader, type DailyReportSearchSqlExecutor, type DailyReportSearchTables, type DailyReportSearchWord, type DailyReportServer, type DailyReportServerConfig, type DailyReportService, type DailyReportServiceConfig, type SharpHeaderLike as DailyReportSharpHeaderLike, type SharpPipelineLike as DailyReportSharpPipelineLike, type SqlResultCacheMissAdmission as DailyReportSqlResultCacheMissAdmission, type SqlResultCacheQueryOptions as DailyReportSqlResultCacheQueryOptions, type DailyReportSseEntryMessage, DailyReportSseReader, type DailyReportSseReaderConfig, type DailyReportSseReaderPort, type DailyReportTables, type DailyReportUserStatusRow, type DailyReportUserStatusTable, type DailyReportUserTable, DailyReportViewerScope, type DailyReportVisibilityDimensions, type DailyReportVisibilityResolveContext, type DailyReportVisibilityResolveReason, type VisibleSourceTypeSet as DailyReportVisibleSourceTypeSet, type DailyReportVisibleSourceTypes, type ExternalReportFields, type SharpLike, SqlResultCache, type StreamEntry, createDailyReportHandlers, createDailyReportServer, createDailyReportService, createEpochStore, createSharpThumbnailRenderer, defineDailyReportSchema, defineDailyReportSearchSchema, isStreamIdLte, parseClientTempId, predictSharpThumbnailWorkingSetBytes, readSseStreamEntry as readDailyReportSseStreamEntry, transformJsonArray };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { c as DailyReportSseMessage, k as DailyReportInterviewer, j as DailyReportExternalComment, D as DailyReportItem, d as DailyReportDetail, i as DailyReportAttachmentSummary, m as DailyReportPostedComment } from "./sse-schema-getLS62T.js";
|
|
2
2
|
import * as drizzle_orm_mssql_core from "drizzle-orm/mssql-core";
|
|
3
3
|
import { AnyMsSqlColumn } from "drizzle-orm/mssql-core";
|
|
4
|
-
import { a as DailyReportLogger, b as DailyReportSearchCombine,
|
|
4
|
+
import { a as DailyReportLogger, b as DailyReportSearchCombine, g as DailyReportSearchAlternative, d as DailyReportSearchHit, e as DailyReportSearchMarksAnswer } from "./search-marks-wire-CZRU4q3h.js";
|
|
5
|
+
export { h as DailyReportSearchAlternativeTier } from "./search-marks-wire-CZRU4q3h.js";
|
|
5
6
|
import { TransactionRetryOptions } from "@aiquants/mssql";
|
|
6
7
|
import { SQL } from "drizzle-orm";
|
|
7
8
|
import "zod";
|
|
@@ -132,11 +133,16 @@ type DailyReportAttachmentThumbnailRenderer = {
|
|
|
132
133
|
signal: AbortSignal;
|
|
133
134
|
}) => Promise<DailyReportAttachmentThumbnail | DailyReportAttachmentThumbnailError>;
|
|
134
135
|
};
|
|
136
|
+
type SqlResultCacheMissAdmission = {
|
|
137
|
+
readonly signal: AbortSignal;
|
|
138
|
+
readonly acquire: (signal: AbortSignal) => Promise<(() => void) | null>;
|
|
139
|
+
};
|
|
135
140
|
type SqlResultCacheQueryOptions = {
|
|
136
141
|
forceRefresh?: boolean;
|
|
137
142
|
snapshot?: boolean;
|
|
138
143
|
ttlMsOverride?: number;
|
|
139
144
|
epochKey?: string;
|
|
145
|
+
admission?: SqlResultCacheMissAdmission;
|
|
140
146
|
refreshAheadRatio?: number;
|
|
141
147
|
};
|
|
142
148
|
declare const createEpochStore: (redis?: DailyReportRedisProvider) => {
|
|
@@ -145,14 +151,18 @@ declare const createEpochStore: (redis?: DailyReportRedisProvider) => {
|
|
|
145
151
|
};
|
|
146
152
|
type EpochStore = ReturnType<typeof createEpochStore>;
|
|
147
153
|
declare class SqlResultCache {
|
|
148
|
-
private readonly config;
|
|
149
154
|
private readonly epochStore;
|
|
150
155
|
private readonly buckets;
|
|
151
156
|
private readonly inFlight;
|
|
152
157
|
private readonly forcedFetches;
|
|
158
|
+
private readonly defaultTtlMs;
|
|
159
|
+
private readonly maxBuckets;
|
|
160
|
+
private lastSweepAt;
|
|
153
161
|
constructor(config: {
|
|
154
|
-
defaultTtlMs: number;
|
|
162
|
+
readonly defaultTtlMs: number;
|
|
163
|
+
readonly maxBuckets: number;
|
|
155
164
|
}, epochStore: EpochStore);
|
|
165
|
+
private writeBucket;
|
|
156
166
|
private maybeRefreshAhead;
|
|
157
167
|
private startFetch;
|
|
158
168
|
private forcedFetch;
|
|
@@ -162,9 +172,10 @@ declare class SqlResultCache {
|
|
|
162
172
|
fetcher: () => Promise<readonly T[]>;
|
|
163
173
|
onFetchStart?: () => void;
|
|
164
174
|
} & SqlResultCacheQueryOptions) => Promise<readonly T[]>;
|
|
175
|
+
private readOwnOrRetry;
|
|
165
176
|
clearAll: () => void;
|
|
166
177
|
invalidatePrefix: (prefix: string) => void;
|
|
167
|
-
private
|
|
178
|
+
private sweepExpired;
|
|
168
179
|
}
|
|
169
180
|
type ExternalReportFields = {
|
|
170
181
|
content?: string | null;
|
|
@@ -1702,7 +1713,7 @@ type DailyReportSearchReconcileOptions = {
|
|
|
1702
1713
|
readonly onProgress?: (progress: DailyReportSearchReconcileProgress) => void;
|
|
1703
1714
|
};
|
|
1704
1715
|
type DailyReportSearchWord = {
|
|
1705
|
-
readonly alternatives: readonly
|
|
1716
|
+
readonly alternatives: readonly DailyReportSearchAlternative[];
|
|
1706
1717
|
};
|
|
1707
1718
|
type DailyReportSearchSet = {
|
|
1708
1719
|
readonly words: readonly DailyReportSearchWord[];
|
|
@@ -1835,18 +1846,21 @@ declare function createDailyReportService(config: DailyReportServiceConfig): {
|
|
|
1835
1846
|
clearCache: () => Promise<void>;
|
|
1836
1847
|
invalidateHubReadCaches: (hubIds: readonly number[], businessDates: readonly string[]) => Promise<void>;
|
|
1837
1848
|
getUserIdByExternalId: (externalId: string) => Promise<number | null>;
|
|
1838
|
-
getDailyReportIdsByExternalId: (scope: DailyReportViewerScope, externalId: string, { forceRefresh, snapshot, ttlMsOverride, onFetchStart }?: SqlResultCacheQueryOptions & {
|
|
1849
|
+
getDailyReportIdsByExternalId: (scope: DailyReportViewerScope, externalId: string, { forceRefresh, snapshot, ttlMsOverride, onFetchStart, admission }?: SqlResultCacheQueryOptions & {
|
|
1839
1850
|
onFetchStart?: () => void;
|
|
1840
1851
|
}) => Promise<DailyReportIdsSource>;
|
|
1841
1852
|
getDailyReportIdsFirstPageByExternalId: (scope: DailyReportViewerScope, externalId: string, limit: number) => Promise<DailyReportItem[]>;
|
|
1842
1853
|
readSseStreamAnchor: () => Promise<string | null>;
|
|
1843
|
-
getDailyReportsByBusinessDate: (scope: DailyReportViewerScope, businessDate: string, { forceRefresh, snapshot, ttlMsOverride }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail[]>;
|
|
1844
|
-
getDailyReportsByBusinessDateByExternalId: (scope: DailyReportViewerScope, businessDate: string, externalId: string, { forceRefresh, snapshot, ttlMsOverride }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail[]>;
|
|
1845
|
-
getDailyReportDetailById: (scope: DailyReportViewerScope, reportHubId: number, userId: number, { forceRefresh, snapshot, ttlMsOverride }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail | null>;
|
|
1854
|
+
getDailyReportsByBusinessDate: (scope: DailyReportViewerScope, businessDate: string, { forceRefresh, snapshot, ttlMsOverride }?: Omit<SqlResultCacheQueryOptions, "admission">) => Promise<DailyReportDetail[]>;
|
|
1855
|
+
getDailyReportsByBusinessDateByExternalId: (scope: DailyReportViewerScope, businessDate: string, externalId: string, { forceRefresh, snapshot, ttlMsOverride, admission }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail[]>;
|
|
1856
|
+
getDailyReportDetailById: (scope: DailyReportViewerScope, reportHubId: number, userId: number, { forceRefresh, snapshot, ttlMsOverride, admission }?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail | null>;
|
|
1846
1857
|
getDailyReportDetailByIdByExternalId: (scope: DailyReportViewerScope, reportHubId: number, externalId: string, options?: SqlResultCacheQueryOptions) => Promise<DailyReportDetail | null>;
|
|
1847
1858
|
getDailyReportDetailsByIdsByExternalId: (scope: DailyReportViewerScope, reportHubIds: readonly number[], externalId: string) => Promise<DailyReportDetail[]>;
|
|
1848
1859
|
getDraftLabelId: () => Promise<number | null>;
|
|
1849
1860
|
searchDailyReports: (scope: DailyReportViewerScope, userId: number, plan: DailyReportSearchPlan) => Promise<DailyReportSearchHit[]>;
|
|
1861
|
+
markDailyReportSearchHits: (scope: DailyReportViewerScope, userId: number, plan: DailyReportSearchPlan, reportHubIds: readonly number[], options: {
|
|
1862
|
+
readonly signal: AbortSignal;
|
|
1863
|
+
}) => Promise<DailyReportSearchMarksAnswer>;
|
|
1850
1864
|
reconcileSearchIndex: (options: DailyReportSearchReconcileOptions) => Promise<DailyReportSearchReconcileSummary>;
|
|
1851
1865
|
getAttachmentsByHubIds: (hubIds: number[]) => Promise<Map<number, DailyReportAttachmentSummary[]>>;
|
|
1852
1866
|
getAttachmentForUser: (scope: DailyReportViewerScope, attachmentId: number, userId: number) => Promise<{
|
|
@@ -1934,8 +1948,6 @@ declare class DailyReportSseReader implements DailyReportSseReaderPort {
|
|
|
1934
1948
|
private _readLoop;
|
|
1935
1949
|
private _invalidateCaches;
|
|
1936
1950
|
}
|
|
1937
|
-
declare const generateETag: (data: unknown) => string;
|
|
1938
|
-
declare const jsonResponseWithETag: (request: Request, cookie: string | null, payload: Record<string, unknown>, status?: number) => Response;
|
|
1939
1951
|
type SharpHeaderLike = {
|
|
1940
1952
|
width: number;
|
|
1941
1953
|
height: number;
|
|
@@ -2040,6 +2052,7 @@ type DailyReportServerConfig = Omit<DailyReportServiceConfig, "cache" | "epochs"
|
|
|
2040
2052
|
loginRedirectPath?: string;
|
|
2041
2053
|
enableDevCacheClear?: boolean;
|
|
2042
2054
|
cacheDefaultTtlMs?: number;
|
|
2055
|
+
cacheMaxBuckets?: number;
|
|
2043
2056
|
externalSources?: DailyReportExternalSource[];
|
|
2044
2057
|
};
|
|
2045
2058
|
type DailyReportServer = DailyReportHandlers & {
|
|
@@ -2051,4 +2064,4 @@ type DailyReportServer = DailyReportHandlers & {
|
|
|
2051
2064
|
knownSourceTypes: readonly string[];
|
|
2052
2065
|
};
|
|
2053
2066
|
declare function createDailyReportServer(config: DailyReportServerConfig): DailyReportServer;
|
|
2054
|
-
export { DAILY_REPORT_ATTACHMENT_THUMBNAIL_MAX_OUTPUT_BYTES, DAILY_REPORT_ATTACHMENT_THUMBNAIL_OUTPUT_MEDIA_TYPES, DAILY_REPORT_SHARP_THUMBNAIL_DECODE_BUDGET_BYTES, DAILY_REPORT_SHARP_THUMBNAIL_DECODE_WORK_MODEL, DAILY_REPORT_SHARP_THUMBNAIL_WORKING_SET_MODEL, DAILY_REPORT_SSE_CATCH_UP_BATCH, DAILY_REPORT_SSE_VISIBILITY_REFRESH_MS, type DailyReportAttachmentBytes, type DailyReportAttachmentDelivery, type DailyReportAttachmentError, type DailyReportAttachmentFailure, type DailyReportAttachmentTable, type DailyReportAttachmentThumbnail, type AttachmentThumbnailDelivery as DailyReportAttachmentThumbnailDelivery, type DailyReportAttachmentThumbnailError, type DailyReportAttachmentThumbnailFailure, type DailyReportAttachmentThumbnailOutputMediaType, type DailyReportAttachmentThumbnailRenderer, type DailyReportAttachmentThumbnailSourceFormat, type DailyReportAttachmentThumbnailsConfig, type DailyReportAttachmentsConfig, type DailyReportAuthResult, type DailyReportAuthenticate, type DailyReportClientTempId, type DailyReportCommentTable, type DailyReportDb, type DeleteChain as DailyReportDbDeleteChain, type InsertChain as DailyReportDbInsertChain, type Rows as DailyReportDbRows, type SelectChain as DailyReportDbSelectChain, type UpdateChain as DailyReportDbUpdateChain, type DailyReportEncodeUserId, type EpochStore as DailyReportEpochStore, type DailyReportExternalSource, type DailyReportHandlers, 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 RedisStreamMessage as DailyReportRedisStreamMessage, type DailyReportResolveUserId, type DailyReportResolveVisibleSourceTypes, type ResourceRouteArgs as DailyReportResourceRouteArgs, type DailyReportSearchCommentTable, type DailyReportSearchConfig, type DailyReportSearchDocumentTable, type DailyReportSearchPlan, type DailyReportSearchReconcileOptions, type DailyReportSearchReconcileProgress, type DailyReportSearchReconcileSummary, type DailyReportSearchSet, type DailyReportSearchSourceTextReader, type DailyReportSearchSqlExecutor, type DailyReportSearchTables, type DailyReportSearchWord, type DailyReportServer, type DailyReportServerConfig, type DailyReportService, type DailyReportServiceConfig, type SharpHeaderLike as DailyReportSharpHeaderLike, type SharpPipelineLike as DailyReportSharpPipelineLike, type SqlResultCacheQueryOptions as DailyReportSqlResultCacheQueryOptions, type DailyReportSseEntryMessage, DailyReportSseReader, type DailyReportSseReaderConfig, type DailyReportSseReaderPort, type DailyReportTables, type DailyReportUserStatusRow, type DailyReportUserStatusTable, type DailyReportUserTable, DailyReportViewerScope, type DailyReportVisibilityDimensions, type DailyReportVisibilityResolveContext, type DailyReportVisibilityResolveReason, type VisibleSourceTypeSet as DailyReportVisibleSourceTypeSet, type DailyReportVisibleSourceTypes, type ExternalReportFields, type SharpLike, SqlResultCache, type StreamEntry, createDailyReportHandlers, createDailyReportServer, createDailyReportService, createEpochStore, createSharpThumbnailRenderer, defineDailyReportSchema, defineDailyReportSearchSchema,
|
|
2067
|
+
export { DAILY_REPORT_ATTACHMENT_THUMBNAIL_MAX_OUTPUT_BYTES, DAILY_REPORT_ATTACHMENT_THUMBNAIL_OUTPUT_MEDIA_TYPES, DAILY_REPORT_SHARP_THUMBNAIL_DECODE_BUDGET_BYTES, DAILY_REPORT_SHARP_THUMBNAIL_DECODE_WORK_MODEL, DAILY_REPORT_SHARP_THUMBNAIL_WORKING_SET_MODEL, DAILY_REPORT_SSE_CATCH_UP_BATCH, DAILY_REPORT_SSE_VISIBILITY_REFRESH_MS, type DailyReportAttachmentBytes, type DailyReportAttachmentDelivery, type DailyReportAttachmentError, type DailyReportAttachmentFailure, type DailyReportAttachmentTable, type DailyReportAttachmentThumbnail, type AttachmentThumbnailDelivery as DailyReportAttachmentThumbnailDelivery, type DailyReportAttachmentThumbnailError, type DailyReportAttachmentThumbnailFailure, type DailyReportAttachmentThumbnailOutputMediaType, type DailyReportAttachmentThumbnailRenderer, type DailyReportAttachmentThumbnailSourceFormat, type DailyReportAttachmentThumbnailsConfig, type DailyReportAttachmentsConfig, type DailyReportAuthResult, type DailyReportAuthenticate, type DailyReportClientTempId, type DailyReportCommentTable, type DailyReportDb, type DeleteChain as DailyReportDbDeleteChain, type InsertChain as DailyReportDbInsertChain, type Rows as DailyReportDbRows, type SelectChain as DailyReportDbSelectChain, type UpdateChain as DailyReportDbUpdateChain, type DailyReportEncodeUserId, type EpochStore as DailyReportEpochStore, type DailyReportExternalSource, type DailyReportHandlers, 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 RedisStreamMessage as DailyReportRedisStreamMessage, type DailyReportResolveUserId, type DailyReportResolveVisibleSourceTypes, type ResourceRouteArgs as DailyReportResourceRouteArgs, DailyReportSearchAlternative, type DailyReportSearchCommentTable, type DailyReportSearchConfig, type DailyReportSearchDocumentTable, type DailyReportSearchPlan, type DailyReportSearchReconcileOptions, type DailyReportSearchReconcileProgress, type DailyReportSearchReconcileSummary, type DailyReportSearchSet, type DailyReportSearchSourceTextReader, type DailyReportSearchSqlExecutor, type DailyReportSearchTables, type DailyReportSearchWord, type DailyReportServer, type DailyReportServerConfig, type DailyReportService, type DailyReportServiceConfig, type SharpHeaderLike as DailyReportSharpHeaderLike, type SharpPipelineLike as DailyReportSharpPipelineLike, type SqlResultCacheMissAdmission as DailyReportSqlResultCacheMissAdmission, type SqlResultCacheQueryOptions as DailyReportSqlResultCacheQueryOptions, type DailyReportSseEntryMessage, DailyReportSseReader, type DailyReportSseReaderConfig, type DailyReportSseReaderPort, type DailyReportTables, type DailyReportUserStatusRow, type DailyReportUserStatusTable, type DailyReportUserTable, DailyReportViewerScope, type DailyReportVisibilityDimensions, type DailyReportVisibilityResolveContext, type DailyReportVisibilityResolveReason, type VisibleSourceTypeSet as DailyReportVisibleSourceTypeSet, type DailyReportVisibleSourceTypes, type ExternalReportFields, type SharpLike, SqlResultCache, type StreamEntry, createDailyReportHandlers, createDailyReportServer, createDailyReportService, createEpochStore, createSharpThumbnailRenderer, defineDailyReportSchema, defineDailyReportSearchSchema, isStreamIdLte, parseClientTempId, predictSharpThumbnailWorkingSetBytes, readSseStreamEntry as readDailyReportSseStreamEntry, transformJsonArray };
|