@aiquants/daily-report 0.30.0 → 0.32.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 +129 -0
- package/README.md +162 -95
- package/dist/client.d.mts +49 -18
- package/dist/client.d.ts +49 -18
- package/dist/client.js +4 -4
- package/dist/client.mjs +4 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/server.d.mts +40 -22
- package/dist/server.d.ts +40 -22
- package/dist/server.js +4 -4
- package/dist/server.mjs +4 -4
- package/dist/styles/daily-report.standalone.css +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var d=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var F=(t,r)=>{for(var n in r)d(t,n,{get:r[n],enumerable:!0})},K=(t,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of Y(r))!z.call(t,i)&&i!==n&&d(t,i,{get:()=>r[i],enumerable:!(o=V(r,i))||o.enumerable});return t};var q=t=>K(d({},"__esModule",{value:!0}),t);var te={};F(te,{DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS:()=>y,DAILY_REPORT_SSE_CURSOR_PARAM:()=>H,DAILY_REPORT_SSE_HEARTBEAT_MS:()=>B,DAILY_REPORT_SSE_TERMINAL_EVENTS:()=>$,buildDailyReportAttachmentUrl:()=>k,commentAddMessageSchema:()=>f,commentDeleteMessageSchema:()=>S,connectedMessageSchema:()=>D,dailyReportDetailSchema:()=>l,dailyReportExternalCommentSchema:()=>g,dailyReportInterviewerSchema:()=>h,dailyReportLabelDefSchema:()=>R,dailyReportPostedCommentSchema:()=>c,dailyReportSseMessageSchema:()=>v,isDailyReportAttachmentThumbnailVariant:()=>p,isDailyReportSseStreamId:()=>j,isIdsStreamChunkLine:()=>O,mergeComments:()=>P,normalizeBusinessDateKey:()=>w,parseDailyReportAttachmentQuery:()=>N,reportCreateMessageSchema:()=>I,reportDeleteMessageSchema:()=>_,reportPublishMessageSchema:()=>T,reportUpdateMessageSchema:()=>A,statusUpdateMessageSchema:()=>b});module.exports=q(te);var y=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),p=t=>Object.hasOwn(y,t);var E="download",C="thumbnail",M="1",k=(t,r,n)=>{let o=`${t}/attachment/${encodeURIComponent(r)}`;switch(n.kind){case"inline":return o;case"download":return`${o}?${new URLSearchParams({[E]:M})}`;case"thumbnail":return`${o}?${new URLSearchParams({[C]:n.variant})}`}},N=t=>{let r=t.getAll(C),n=t.getAll(E);if(r.length>0&&n.length>0)return{kind:"invalid",reason:"conflict"};if(r.length>0){let[o]=r;return r.length===1&&p(o)?{kind:"thumbnail",variant:o}:{kind:"invalid",reason:"thumbnail_variant"}}return n.length>0?n.length===1&&n[0]===M?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var Q=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var L=t=>t<10?`0${t}`:`${t}`,W=t=>{if(Number.isNaN(t.getTime()))return null;let r=t.getFullYear(),n=L(t.getMonth()+1),o=L(t.getDate());return`${r}-${n}-${o}`},J=t=>{let r=Q.exec(t);if(r===null)return null;let[,n,,o,i]=r,s=Number(n),a=Number(o),m=Number(i);if(s<1)return null;let u=new Date(0);return u.setUTCFullYear(s,a-1,m),u.getUTCFullYear()!==s||u.getUTCMonth()!==a-1||u.getUTCDate()!==m?null:`${n}-${o}-${i}`};var w=t=>t==null?null:t instanceof Date?W(t):J(t);var G=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,U=(t,r,n)=>new RangeError(`[daily-report] ${t} must be ${r}; got ${G(n)}`);var P=(t,r,n,o)=>{if(typeof o!="string"||o.trim()==="")throw U("mergeComments: unknownAuthorName","a non-blank string",o);let i=t.map((a,m)=>({id:`legacy-${m}`,authorName:a.name||o,content:a.text||"",isMine:!1,color:a.color||void 0,isLegacy:!0})),s=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,...s]};var X=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"},O=t=>X(t)==="chunk";var e=require("zod"),$=["auth-required","forbidden","resync-required"],B=15e3,H="lastEventId",Z=/^\d{1,15}-\d{1,15}$/,j=t=>Z.test(t),h=e.z.object({name:e.z.string().nullish(),affiliation:e.z.string().nullish()}),g=e.z.object({name:e.z.string().nullish(),text:e.z.string().nullish(),color:e.z.string().nullish()}),R=e.z.object({id:e.z.number(),name:e.z.string().nullish(),color:e.z.string().nullish()}),c=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()}),ee=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)}),l=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(h),subject:e.z.string().nullish(),content:e.z.string().nullish(),externalComments:e.z.array(g),isRead:e.z.boolean(),isStarred:e.z.boolean(),labels:e.z.array(R),postedComments:e.z.array(c),attachments:e.z.array(ee).default([])}),D=e.z.object({type:e.z.literal("connected")}),b=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()}),x=e.z.string().optional(),f=e.z.object({type:e.z.literal("comment-add"),reportHubId:e.z.number(),comment:c,clientTempId:e.z.string(),recipientRawUserId:e.z.number().optional(),sourceType:x}),S=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:x}),I=e.z.object({type:e.z.literal("report-create"),reportHubId:e.z.number(),report:l,clientTempId:e.z.string(),recipientRawUserId:e.z.number().optional()}),A=e.z.object({type:e.z.literal("report-update"),reportHubId:e.z.number(),report:l,clientTempId:e.z.string(),recipientRawUserId:e.z.number().optional()}),T=e.z.object({type:e.z.literal("report-publish"),reportHubId:e.z.number(),report:l,clientTempId:e.z.string(),recipientRawUserId:e.z.number().optional()}),_=e.z.object({type:e.z.literal("report-delete"),reportHubId:e.z.number(),clientTempId:e.z.string(),sourceType:x}),v=e.z.discriminatedUnion("type",[D,b,f,S,I,A,T,_]);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
|
|
1
|
+
var y=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),p=t=>Object.hasOwn(y,t);var h="download",g="thumbnail",R="1",N=(t,r,n)=>{let o=`${t}/attachment/${encodeURIComponent(r)}`;switch(n.kind){case"inline":return o;case"download":return`${o}?${new URLSearchParams({[h]:R})}`;case"thumbnail":return`${o}?${new URLSearchParams({[g]:n.variant})}`}},L=t=>{let r=t.getAll(g),n=t.getAll(h);if(r.length>0&&n.length>0)return{kind:"invalid",reason:"conflict"};if(r.length>0){let[o]=r;return r.length===1&&p(o)?{kind:"thumbnail",variant:o}:{kind:"invalid",reason:"thumbnail_variant"}}return n.length>0?n.length===1&&n[0]===R?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var w=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var D=t=>t<10?`0${t}`:`${t}`,U=t=>{if(Number.isNaN(t.getTime()))return null;let r=t.getFullYear(),n=D(t.getMonth()+1),o=D(t.getDate());return`${r}-${n}-${o}`},P=t=>{let r=w.exec(t);if(r===null)return null;let[,n,,o,s]=r,i=Number(n),a=Number(o),l=Number(s);if(i<1)return null;let m=new Date(0);return m.setUTCFullYear(i,a-1,l),m.getUTCFullYear()!==i||m.getUTCMonth()!==a-1||m.getUTCDate()!==l?null:`${n}-${o}-${s}`};var O=t=>t==null?null:t instanceof Date?U(t):P(t);var $=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,b=(t,r,n)=>new RangeError(`[daily-report] ${t} must be ${r}; got ${$(n)}`);var B=(t,r,n,o)=>{if(typeof o!="string"||o.trim()==="")throw b("mergeComments: unknownAuthorName","a non-blank string",o);let s=t.map((a,l)=>({id:`legacy-${l}`,authorName:a.name||o,content:a.text||"",isMine:!1,color:a.color||void 0,isLegacy:!0})),i=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[...s,...i]};var H=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=>H(t)==="chunk";import{z as e}from"zod";var v=["auth-required","forbidden","resync-required"],V=15e3,Y="lastEventId",z=/^\d{1,15}-\d{1,15}$/,F=t=>z.test(t),x=e.object({name:e.string().nullish(),affiliation:e.string().nullish()}),f=e.object({name:e.string().nullish(),text:e.string().nullish(),color:e.string().nullish()}),S=e.object({id:e.number(),name:e.string().nullish(),color:e.string().nullish()}),c=e.object({id:e.number(),userId:e.string().nullish(),userName:e.string().nullish(),content:e.string().nullish(),createdAt:e.string().nullish(),isMine:e.boolean()}),K=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)}),u=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(x),subject:e.string().nullish(),content:e.string().nullish(),externalComments:e.array(f),isRead:e.boolean(),isStarred:e.boolean(),labels:e.array(S),postedComments:e.array(c),attachments:e.array(K).default([])}),I=e.object({type:e.literal("connected")}),A=e.object({type:e.literal("status-update"),reportHubId:e.number(),statusType:e.enum(["star","read"]),value:e.boolean(),clientTempId:e.string(),recipientRawUserId:e.number().optional()}),d=e.string().optional(),T=e.object({type:e.literal("comment-add"),reportHubId:e.number(),comment:c,clientTempId:e.string(),recipientRawUserId:e.number().optional(),sourceType:d}),_=e.object({type:e.literal("comment-delete"),reportHubId:e.number(),commentId:e.number(),clientTempId:e.string(),recipientRawUserId:e.number().optional(),sourceType:d}),E=e.object({type:e.literal("report-create"),reportHubId:e.number(),report:u,clientTempId:e.string(),recipientRawUserId:e.number().optional()}),C=e.object({type:e.literal("report-update"),reportHubId:e.number(),report:u,clientTempId:e.string(),recipientRawUserId:e.number().optional()}),M=e.object({type:e.literal("report-publish"),reportHubId:e.number(),report:u,clientTempId:e.string(),recipientRawUserId:e.number().optional()}),k=e.object({type:e.literal("report-delete"),reportHubId:e.number(),clientTempId:e.string(),sourceType:d}),q=e.discriminatedUnion("type",[I,A,T,_,E,C,M,k]);export{y as DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,Y as DAILY_REPORT_SSE_CURSOR_PARAM,V as DAILY_REPORT_SSE_HEARTBEAT_MS,v as DAILY_REPORT_SSE_TERMINAL_EVENTS,N as buildDailyReportAttachmentUrl,T as commentAddMessageSchema,_ as commentDeleteMessageSchema,I as connectedMessageSchema,u as dailyReportDetailSchema,f as dailyReportExternalCommentSchema,x as dailyReportInterviewerSchema,S as dailyReportLabelDefSchema,c as dailyReportPostedCommentSchema,q as dailyReportSseMessageSchema,p as isDailyReportAttachmentThumbnailVariant,F as isDailyReportSseStreamId,j as isIdsStreamChunkLine,B as mergeComments,O as normalizeBusinessDateKey,L as parseDailyReportAttachmentQuery,E as reportCreateMessageSchema,k as reportDeleteMessageSchema,M as reportPublishMessageSchema,C as reportUpdateMessageSchema,A as statusUpdateMessageSchema};
|
package/dist/server.d.mts
CHANGED
|
@@ -182,6 +182,34 @@ type ResourceRouteArgs = {
|
|
|
182
182
|
request: Request;
|
|
183
183
|
params: Record<string, string | undefined>;
|
|
184
184
|
};
|
|
185
|
+
type DailyReportAttachmentThumbnailsConfig = {
|
|
186
|
+
renderer: DailyReportAttachmentThumbnailRenderer;
|
|
187
|
+
rateLimitPerMinute?: number;
|
|
188
|
+
concurrency?: number;
|
|
189
|
+
cacheBytes?: number;
|
|
190
|
+
};
|
|
191
|
+
type DailyReportAttachmentsConfig = {
|
|
192
|
+
idCodec: DailyReportIdCodec;
|
|
193
|
+
read: DailyReportReadAttachment;
|
|
194
|
+
maxBytes?: number;
|
|
195
|
+
rateLimitPerMinute?: number;
|
|
196
|
+
concurrency?: number;
|
|
197
|
+
thumbnails?: DailyReportAttachmentThumbnailsConfig;
|
|
198
|
+
};
|
|
199
|
+
type AttachmentThumbnailDelivery = Readonly<{
|
|
200
|
+
renderer: DailyReportAttachmentThumbnailRenderer;
|
|
201
|
+
rateLimitPerMinute: number;
|
|
202
|
+
concurrency: number;
|
|
203
|
+
cacheBytes: number;
|
|
204
|
+
}>;
|
|
205
|
+
type DailyReportAttachmentDelivery = Readonly<{
|
|
206
|
+
idCodec: DailyReportIdCodec;
|
|
207
|
+
read: DailyReportReadAttachment;
|
|
208
|
+
maxBytes: number;
|
|
209
|
+
rateLimitPerMinute: number;
|
|
210
|
+
concurrency: number;
|
|
211
|
+
thumbnails: AttachmentThumbnailDelivery | null;
|
|
212
|
+
}>;
|
|
185
213
|
type DailyReportUserTable = {
|
|
186
214
|
id: AnyMsSqlColumn;
|
|
187
215
|
displayName: AnyMsSqlColumn;
|
|
@@ -1528,27 +1556,27 @@ type DailyReportServiceConfig = {
|
|
|
1528
1556
|
idsTtlMs?: number;
|
|
1529
1557
|
businessDateTtlMs?: number;
|
|
1530
1558
|
disableUserIdCache?: boolean;
|
|
1531
|
-
|
|
1532
|
-
readAttachment?: DailyReportReadAttachment;
|
|
1533
|
-
attachmentThumbnailRenderer?: DailyReportAttachmentThumbnailRenderer;
|
|
1534
|
-
attachmentMaxBytes?: number;
|
|
1559
|
+
attachments?: DailyReportAttachmentsConfig;
|
|
1535
1560
|
logger?: DailyReportLogger;
|
|
1536
1561
|
};
|
|
1537
|
-
type DailyReportAttachmentDelivery = {
|
|
1538
|
-
readonly idCodec: DailyReportIdCodec | undefined;
|
|
1539
|
-
readonly readAttachment: DailyReportReadAttachment | undefined;
|
|
1540
|
-
readonly thumbnailRenderer: DailyReportAttachmentThumbnailRenderer | undefined;
|
|
1541
|
-
readonly maxBytes: number;
|
|
1542
|
-
};
|
|
1543
1562
|
type DailyReportService = ReturnType<typeof createDailyReportService>;
|
|
1544
1563
|
type DailyReportIdsSource = {
|
|
1545
1564
|
readonly items: DailyReportItem[];
|
|
1546
1565
|
readonly streamAnchor: string | null;
|
|
1566
|
+
readonly snapshot: string;
|
|
1547
1567
|
};
|
|
1548
1568
|
declare function createDailyReportService(config: DailyReportServiceConfig): {
|
|
1549
1569
|
streamKey: string;
|
|
1550
1570
|
streamMaxLen: number;
|
|
1551
|
-
attachmentDelivery:
|
|
1571
|
+
attachmentDelivery: Readonly<{
|
|
1572
|
+
idCodec: DailyReportIdCodec;
|
|
1573
|
+
read: DailyReportReadAttachment;
|
|
1574
|
+
maxBytes: number;
|
|
1575
|
+
rateLimitPerMinute: number;
|
|
1576
|
+
concurrency: number;
|
|
1577
|
+
thumbnails: AttachmentThumbnailDelivery | null;
|
|
1578
|
+
}> | null;
|
|
1579
|
+
titleMaxLength: number;
|
|
1552
1580
|
clearCache: () => Promise<void>;
|
|
1553
1581
|
invalidateHubReadCaches: (hubIds: readonly number[], businessDates: readonly string[]) => Promise<void>;
|
|
1554
1582
|
getUserIdByExternalId: (externalId: string) => Promise<number | null>;
|
|
@@ -1592,11 +1620,6 @@ type DailyReportHandlersConfig = {
|
|
|
1592
1620
|
resolveVisibleSourceTypes?: DailyReportResolveVisibleSourceTypes;
|
|
1593
1621
|
service: DailyReportService;
|
|
1594
1622
|
encodeUserId: DailyReportEncodeUserId;
|
|
1595
|
-
attachmentRateLimitPerMinute?: number;
|
|
1596
|
-
attachmentConcurrency?: number;
|
|
1597
|
-
attachmentThumbnailRateLimitPerMinute?: number;
|
|
1598
|
-
attachmentThumbnailConcurrency?: number;
|
|
1599
|
-
attachmentThumbnailCacheBytes?: number;
|
|
1600
1623
|
redis?: DailyReportRedisProvider;
|
|
1601
1624
|
sseReader: DailyReportSseReaderPort;
|
|
1602
1625
|
streamKey: string;
|
|
@@ -1752,11 +1775,6 @@ declare const DAILY_REPORT_SSE_CATCH_UP_BATCH = 1000;
|
|
|
1752
1775
|
type DailyReportServerConfig = Omit<DailyReportServiceConfig, "cache" | "epochs"> & {
|
|
1753
1776
|
authenticate: DailyReportAuthenticate;
|
|
1754
1777
|
resolveVisibleSourceTypes?: DailyReportResolveVisibleSourceTypes;
|
|
1755
|
-
attachmentRateLimitPerMinute?: number;
|
|
1756
|
-
attachmentConcurrency?: number;
|
|
1757
|
-
attachmentThumbnailRateLimitPerMinute?: number;
|
|
1758
|
-
attachmentThumbnailConcurrency?: number;
|
|
1759
|
-
attachmentThumbnailCacheBytes?: number;
|
|
1760
1778
|
loginRedirectPath?: string;
|
|
1761
1779
|
enableDevCacheClear?: boolean;
|
|
1762
1780
|
cacheDefaultTtlMs?: number;
|
|
@@ -1771,4 +1789,4 @@ type DailyReportServer = DailyReportHandlers & {
|
|
|
1771
1789
|
knownSourceTypes: readonly string[];
|
|
1772
1790
|
};
|
|
1773
1791
|
declare function createDailyReportServer(config: DailyReportServerConfig): DailyReportServer;
|
|
1774
|
-
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 DailyReportAttachmentDelivery, type DailyReportAttachmentError, type DailyReportAttachmentFailure, type DailyReportAttachmentThumbnail, type DailyReportAttachmentThumbnailOutputMediaType, type DailyReportAttachmentThumbnailRenderer, type DailyReportAttachmentThumbnailSourceFormat, type DailyReportAuthResult, type DailyReportAuthenticate, type DailyReportDb, type DailyReportHandlers, type DailyReportHandlersConfig, type DailyReportIdCodec, type DailyReportReadAttachment, type DailyReportRedisProvider, type DailyReportServer, type DailyReportServerConfig, type DailyReportServiceConfig, DailyReportSseReader, type DailyReportSseReaderPort, type DailyReportTables, DailyReportViewerScope, type ExternalReportFields, type SharpLike, SqlResultCache, type StreamEntry, createDailyReportHandlers, createDailyReportServer, createDailyReportService, createEpochStore, createSharpThumbnailRenderer, defineDailyReportSchema, generateETag, isStreamIdLte, jsonResponseWithETag, predictSharpThumbnailWorkingSetBytes, transformJsonArray };
|
|
1792
|
+
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 DailyReportAttachmentDelivery, type DailyReportAttachmentError, type DailyReportAttachmentFailure, type DailyReportAttachmentThumbnail, type DailyReportAttachmentThumbnailOutputMediaType, type DailyReportAttachmentThumbnailRenderer, type DailyReportAttachmentThumbnailSourceFormat, type DailyReportAttachmentThumbnailsConfig, type DailyReportAttachmentsConfig, type DailyReportAuthResult, type DailyReportAuthenticate, type DailyReportDb, type DailyReportHandlers, type DailyReportHandlersConfig, type DailyReportIdCodec, type DailyReportReadAttachment, type DailyReportRedisProvider, type DailyReportServer, type DailyReportServerConfig, type DailyReportServiceConfig, DailyReportSseReader, type DailyReportSseReaderPort, type DailyReportTables, DailyReportViewerScope, type ExternalReportFields, type SharpLike, SqlResultCache, type StreamEntry, createDailyReportHandlers, createDailyReportServer, createDailyReportService, createEpochStore, createSharpThumbnailRenderer, defineDailyReportSchema, generateETag, isStreamIdLte, jsonResponseWithETag, predictSharpThumbnailWorkingSetBytes, transformJsonArray };
|
package/dist/server.d.ts
CHANGED
|
@@ -182,6 +182,34 @@ type ResourceRouteArgs = {
|
|
|
182
182
|
request: Request;
|
|
183
183
|
params: Record<string, string | undefined>;
|
|
184
184
|
};
|
|
185
|
+
type DailyReportAttachmentThumbnailsConfig = {
|
|
186
|
+
renderer: DailyReportAttachmentThumbnailRenderer;
|
|
187
|
+
rateLimitPerMinute?: number;
|
|
188
|
+
concurrency?: number;
|
|
189
|
+
cacheBytes?: number;
|
|
190
|
+
};
|
|
191
|
+
type DailyReportAttachmentsConfig = {
|
|
192
|
+
idCodec: DailyReportIdCodec;
|
|
193
|
+
read: DailyReportReadAttachment;
|
|
194
|
+
maxBytes?: number;
|
|
195
|
+
rateLimitPerMinute?: number;
|
|
196
|
+
concurrency?: number;
|
|
197
|
+
thumbnails?: DailyReportAttachmentThumbnailsConfig;
|
|
198
|
+
};
|
|
199
|
+
type AttachmentThumbnailDelivery = Readonly<{
|
|
200
|
+
renderer: DailyReportAttachmentThumbnailRenderer;
|
|
201
|
+
rateLimitPerMinute: number;
|
|
202
|
+
concurrency: number;
|
|
203
|
+
cacheBytes: number;
|
|
204
|
+
}>;
|
|
205
|
+
type DailyReportAttachmentDelivery = Readonly<{
|
|
206
|
+
idCodec: DailyReportIdCodec;
|
|
207
|
+
read: DailyReportReadAttachment;
|
|
208
|
+
maxBytes: number;
|
|
209
|
+
rateLimitPerMinute: number;
|
|
210
|
+
concurrency: number;
|
|
211
|
+
thumbnails: AttachmentThumbnailDelivery | null;
|
|
212
|
+
}>;
|
|
185
213
|
type DailyReportUserTable = {
|
|
186
214
|
id: AnyMsSqlColumn;
|
|
187
215
|
displayName: AnyMsSqlColumn;
|
|
@@ -1528,27 +1556,27 @@ type DailyReportServiceConfig = {
|
|
|
1528
1556
|
idsTtlMs?: number;
|
|
1529
1557
|
businessDateTtlMs?: number;
|
|
1530
1558
|
disableUserIdCache?: boolean;
|
|
1531
|
-
|
|
1532
|
-
readAttachment?: DailyReportReadAttachment;
|
|
1533
|
-
attachmentThumbnailRenderer?: DailyReportAttachmentThumbnailRenderer;
|
|
1534
|
-
attachmentMaxBytes?: number;
|
|
1559
|
+
attachments?: DailyReportAttachmentsConfig;
|
|
1535
1560
|
logger?: DailyReportLogger;
|
|
1536
1561
|
};
|
|
1537
|
-
type DailyReportAttachmentDelivery = {
|
|
1538
|
-
readonly idCodec: DailyReportIdCodec | undefined;
|
|
1539
|
-
readonly readAttachment: DailyReportReadAttachment | undefined;
|
|
1540
|
-
readonly thumbnailRenderer: DailyReportAttachmentThumbnailRenderer | undefined;
|
|
1541
|
-
readonly maxBytes: number;
|
|
1542
|
-
};
|
|
1543
1562
|
type DailyReportService = ReturnType<typeof createDailyReportService>;
|
|
1544
1563
|
type DailyReportIdsSource = {
|
|
1545
1564
|
readonly items: DailyReportItem[];
|
|
1546
1565
|
readonly streamAnchor: string | null;
|
|
1566
|
+
readonly snapshot: string;
|
|
1547
1567
|
};
|
|
1548
1568
|
declare function createDailyReportService(config: DailyReportServiceConfig): {
|
|
1549
1569
|
streamKey: string;
|
|
1550
1570
|
streamMaxLen: number;
|
|
1551
|
-
attachmentDelivery:
|
|
1571
|
+
attachmentDelivery: Readonly<{
|
|
1572
|
+
idCodec: DailyReportIdCodec;
|
|
1573
|
+
read: DailyReportReadAttachment;
|
|
1574
|
+
maxBytes: number;
|
|
1575
|
+
rateLimitPerMinute: number;
|
|
1576
|
+
concurrency: number;
|
|
1577
|
+
thumbnails: AttachmentThumbnailDelivery | null;
|
|
1578
|
+
}> | null;
|
|
1579
|
+
titleMaxLength: number;
|
|
1552
1580
|
clearCache: () => Promise<void>;
|
|
1553
1581
|
invalidateHubReadCaches: (hubIds: readonly number[], businessDates: readonly string[]) => Promise<void>;
|
|
1554
1582
|
getUserIdByExternalId: (externalId: string) => Promise<number | null>;
|
|
@@ -1592,11 +1620,6 @@ type DailyReportHandlersConfig = {
|
|
|
1592
1620
|
resolveVisibleSourceTypes?: DailyReportResolveVisibleSourceTypes;
|
|
1593
1621
|
service: DailyReportService;
|
|
1594
1622
|
encodeUserId: DailyReportEncodeUserId;
|
|
1595
|
-
attachmentRateLimitPerMinute?: number;
|
|
1596
|
-
attachmentConcurrency?: number;
|
|
1597
|
-
attachmentThumbnailRateLimitPerMinute?: number;
|
|
1598
|
-
attachmentThumbnailConcurrency?: number;
|
|
1599
|
-
attachmentThumbnailCacheBytes?: number;
|
|
1600
1623
|
redis?: DailyReportRedisProvider;
|
|
1601
1624
|
sseReader: DailyReportSseReaderPort;
|
|
1602
1625
|
streamKey: string;
|
|
@@ -1752,11 +1775,6 @@ declare const DAILY_REPORT_SSE_CATCH_UP_BATCH = 1000;
|
|
|
1752
1775
|
type DailyReportServerConfig = Omit<DailyReportServiceConfig, "cache" | "epochs"> & {
|
|
1753
1776
|
authenticate: DailyReportAuthenticate;
|
|
1754
1777
|
resolveVisibleSourceTypes?: DailyReportResolveVisibleSourceTypes;
|
|
1755
|
-
attachmentRateLimitPerMinute?: number;
|
|
1756
|
-
attachmentConcurrency?: number;
|
|
1757
|
-
attachmentThumbnailRateLimitPerMinute?: number;
|
|
1758
|
-
attachmentThumbnailConcurrency?: number;
|
|
1759
|
-
attachmentThumbnailCacheBytes?: number;
|
|
1760
1778
|
loginRedirectPath?: string;
|
|
1761
1779
|
enableDevCacheClear?: boolean;
|
|
1762
1780
|
cacheDefaultTtlMs?: number;
|
|
@@ -1771,4 +1789,4 @@ type DailyReportServer = DailyReportHandlers & {
|
|
|
1771
1789
|
knownSourceTypes: readonly string[];
|
|
1772
1790
|
};
|
|
1773
1791
|
declare function createDailyReportServer(config: DailyReportServerConfig): DailyReportServer;
|
|
1774
|
-
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 DailyReportAttachmentDelivery, type DailyReportAttachmentError, type DailyReportAttachmentFailure, type DailyReportAttachmentThumbnail, type DailyReportAttachmentThumbnailOutputMediaType, type DailyReportAttachmentThumbnailRenderer, type DailyReportAttachmentThumbnailSourceFormat, type DailyReportAuthResult, type DailyReportAuthenticate, type DailyReportDb, type DailyReportHandlers, type DailyReportHandlersConfig, type DailyReportIdCodec, type DailyReportReadAttachment, type DailyReportRedisProvider, type DailyReportServer, type DailyReportServerConfig, type DailyReportServiceConfig, DailyReportSseReader, type DailyReportSseReaderPort, type DailyReportTables, DailyReportViewerScope, type ExternalReportFields, type SharpLike, SqlResultCache, type StreamEntry, createDailyReportHandlers, createDailyReportServer, createDailyReportService, createEpochStore, createSharpThumbnailRenderer, defineDailyReportSchema, generateETag, isStreamIdLte, jsonResponseWithETag, predictSharpThumbnailWorkingSetBytes, transformJsonArray };
|
|
1792
|
+
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 DailyReportAttachmentDelivery, type DailyReportAttachmentError, type DailyReportAttachmentFailure, type DailyReportAttachmentThumbnail, type DailyReportAttachmentThumbnailOutputMediaType, type DailyReportAttachmentThumbnailRenderer, type DailyReportAttachmentThumbnailSourceFormat, type DailyReportAttachmentThumbnailsConfig, type DailyReportAttachmentsConfig, type DailyReportAuthResult, type DailyReportAuthenticate, type DailyReportDb, type DailyReportHandlers, type DailyReportHandlersConfig, type DailyReportIdCodec, type DailyReportReadAttachment, type DailyReportRedisProvider, type DailyReportServer, type DailyReportServerConfig, type DailyReportServiceConfig, DailyReportSseReader, type DailyReportSseReaderPort, type DailyReportTables, DailyReportViewerScope, type ExternalReportFields, type SharpLike, SqlResultCache, type StreamEntry, createDailyReportHandlers, createDailyReportServer, createDailyReportService, createEpochStore, createSharpThumbnailRenderer, defineDailyReportSchema, generateETag, isStreamIdLte, jsonResponseWithETag, predictSharpThumbnailWorkingSetBytes, transformJsonArray };
|