@aiquants/daily-report 0.25.0 → 0.27.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 +83 -3
- package/README.md +143 -65
- package/dist/client.d.mts +4 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.js +4 -4
- package/dist/client.mjs +4 -4
- package/dist/server.d.mts +45 -32
- package/dist/server.d.ts +45 -32
- package/dist/server.js +4 -4
- package/dist/server.mjs +4 -4
- package/dist/styles/daily-report.standalone.css +1 -1
- package/package.json +7 -7
package/dist/server.d.mts
CHANGED
|
@@ -14,6 +14,35 @@ declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_OUTPUT_MEDIA_TYPES: readonly [
|
|
|
14
14
|
"image/png"
|
|
15
15
|
];
|
|
16
16
|
declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_MAX_OUTPUT_BYTES: number;
|
|
17
|
+
declare const isStreamIdLte: (a: string, b: string) => boolean;
|
|
18
|
+
type StreamEntry = {
|
|
19
|
+
id: string;
|
|
20
|
+
message: Record<string, string>;
|
|
21
|
+
};
|
|
22
|
+
type DailyReportSseReaderConfig = {
|
|
23
|
+
redis?: DailyReportRedisProvider;
|
|
24
|
+
streamKey: string;
|
|
25
|
+
cache: SqlResultCache;
|
|
26
|
+
logger?: DailyReportLogger;
|
|
27
|
+
};
|
|
28
|
+
declare class DailyReportSseReader implements DailyReportSseReaderPort {
|
|
29
|
+
private readonly config;
|
|
30
|
+
private _source;
|
|
31
|
+
private _lastId;
|
|
32
|
+
private _positioning;
|
|
33
|
+
private _generation;
|
|
34
|
+
private readonly _logger;
|
|
35
|
+
constructor(config: DailyReportSseReaderConfig);
|
|
36
|
+
ready(): Promise<void>;
|
|
37
|
+
subscribe(onEntry: (entry: StreamEntry) => void, onError: (err: Error) => void): () => void;
|
|
38
|
+
destroy(): Promise<void>;
|
|
39
|
+
private _position;
|
|
40
|
+
private _readTail;
|
|
41
|
+
private _createSource;
|
|
42
|
+
private _start;
|
|
43
|
+
private _readLoop;
|
|
44
|
+
private _invalidateCaches;
|
|
45
|
+
}
|
|
17
46
|
type RedisStreamMessage = {
|
|
18
47
|
id: string;
|
|
19
48
|
message: Record<string, string>;
|
|
@@ -48,6 +77,10 @@ type DailyReportRedisProvider = {
|
|
|
48
77
|
getClient(): Promise<DailyReportRedisClient | undefined>;
|
|
49
78
|
createClient(): Promise<DailyReportRedisBlockingClient | undefined>;
|
|
50
79
|
};
|
|
80
|
+
type DailyReportSseReaderPort = {
|
|
81
|
+
ready(): Promise<void>;
|
|
82
|
+
subscribe(onEntry: (entry: StreamEntry) => void, onError: (err: Error) => void): () => void;
|
|
83
|
+
};
|
|
51
84
|
type DailyReportAuthResult = {
|
|
52
85
|
user?: {
|
|
53
86
|
id: string;
|
|
@@ -142,14 +175,12 @@ declare class SqlResultCache {
|
|
|
142
175
|
constructor(config: {
|
|
143
176
|
defaultTtlMs: number;
|
|
144
177
|
}, epochStore: EpochStore);
|
|
145
|
-
invalidate: (cacheKey: string) => void;
|
|
146
178
|
private maybeRefreshAhead;
|
|
147
179
|
getOrFetch: <T>(opts: {
|
|
148
180
|
cacheKey: string;
|
|
149
181
|
fetcher: () => Promise<readonly T[]>;
|
|
150
182
|
onFetchStart?: () => void;
|
|
151
183
|
} & SqlResultCacheQueryOptions) => Promise<readonly T[]>;
|
|
152
|
-
flush: (cacheKey: string) => void;
|
|
153
184
|
clearAll: () => void;
|
|
154
185
|
invalidatePrefix: (prefix: string) => void;
|
|
155
186
|
private cleanExpired;
|
|
@@ -1577,34 +1608,6 @@ declare function createDailyReportService(config: DailyReportServiceConfig): {
|
|
|
1577
1608
|
updateDailyReportInternal: (tx: DailyReportDb, hubId: number, data: Partial<DailyReportInternalRow>) => Promise<void>;
|
|
1578
1609
|
deleteDailyReportLabel: (tx: DailyReportDb, hubId: number, labelId: number) => Promise<void>;
|
|
1579
1610
|
};
|
|
1580
|
-
declare const isStreamIdLte: (a: string, b: string) => boolean;
|
|
1581
|
-
type StreamEntry = {
|
|
1582
|
-
id: string;
|
|
1583
|
-
message: Record<string, string>;
|
|
1584
|
-
};
|
|
1585
|
-
type DailyReportSseReaderConfig = {
|
|
1586
|
-
redis?: DailyReportRedisProvider;
|
|
1587
|
-
streamKey: string;
|
|
1588
|
-
cache: SqlResultCache;
|
|
1589
|
-
logger?: DailyReportLogger;
|
|
1590
|
-
};
|
|
1591
|
-
declare class DailyReportSseReader {
|
|
1592
|
-
private readonly config;
|
|
1593
|
-
private _source;
|
|
1594
|
-
private _lastId;
|
|
1595
|
-
private _positioning;
|
|
1596
|
-
private _generation;
|
|
1597
|
-
private readonly _logger;
|
|
1598
|
-
constructor(config: DailyReportSseReaderConfig);
|
|
1599
|
-
ready(): Promise<void>;
|
|
1600
|
-
subscribe(onEntry: (entry: StreamEntry) => void, onError: (err: Error) => void): () => void;
|
|
1601
|
-
destroy(): Promise<void>;
|
|
1602
|
-
private _readTail;
|
|
1603
|
-
private _createSource;
|
|
1604
|
-
private _start;
|
|
1605
|
-
private _readLoop;
|
|
1606
|
-
private _invalidateCaches;
|
|
1607
|
-
}
|
|
1608
1611
|
type LoaderArgs = {
|
|
1609
1612
|
request: Request;
|
|
1610
1613
|
params: Record<string, string | undefined>;
|
|
@@ -1622,7 +1625,7 @@ type DailyReportHandlersConfig = {
|
|
|
1622
1625
|
attachmentThumbnailConcurrency?: number;
|
|
1623
1626
|
attachmentThumbnailCacheBytes?: number;
|
|
1624
1627
|
redis?: DailyReportRedisProvider;
|
|
1625
|
-
sseReader:
|
|
1628
|
+
sseReader: DailyReportSseReaderPort;
|
|
1626
1629
|
streamKey: string;
|
|
1627
1630
|
loginRedirectPath?: string;
|
|
1628
1631
|
enableDevCacheClear?: boolean;
|
|
@@ -1737,6 +1740,16 @@ declare const DAILY_REPORT_SHARP_THUMBNAIL_WORKING_SET_MODEL: Readonly<{
|
|
|
1737
1740
|
}>;
|
|
1738
1741
|
}>;
|
|
1739
1742
|
}>;
|
|
1743
|
+
declare const DAILY_REPORT_SHARP_THUMBNAIL_DECODE_WORK_MODEL: Readonly<{
|
|
1744
|
+
renderMs: 10000;
|
|
1745
|
+
nanosecondsPerBlockVisit: 125;
|
|
1746
|
+
margin: 4;
|
|
1747
|
+
maxBlockVisits: number;
|
|
1748
|
+
walkBudgetMs: 16;
|
|
1749
|
+
nanosecondsPerWalkStep: 50;
|
|
1750
|
+
walkMargin: 2;
|
|
1751
|
+
maxWalkSteps: number;
|
|
1752
|
+
}>;
|
|
1740
1753
|
declare const predictSharpThumbnailWorkingSetBytes: (source: Uint8Array, format: DailyReportAttachmentThumbnailSourceFormat, header: SharpHeaderLike) => number | null;
|
|
1741
1754
|
declare const createSharpThumbnailRenderer: (sharp: SharpLike) => DailyReportAttachmentThumbnailRenderer;
|
|
1742
1755
|
type DailyReportServerConfig = Omit<DailyReportServiceConfig, "cache" | "epochs"> & {
|
|
@@ -1837,4 +1850,4 @@ declare function createDailyReportServer(config: DailyReportServerConfig): {
|
|
|
1837
1850
|
streamKey: string;
|
|
1838
1851
|
knownSourceTypes: readonly string[];
|
|
1839
1852
|
};
|
|
1840
|
-
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_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 DailyReportIdCodec, type DailyReportReadAttachment, type DailyReportRedisProvider, type DailyReportServerConfig, type DailyReportServiceConfig, DailyReportSseReader, type DailyReportTables, DailyReportViewerScope, type ExternalReportFields, type SharpLike, SqlResultCache, type StreamEntry, createDailyReportHandlers, createDailyReportServer, createDailyReportService, createEpochStore, createSharpThumbnailRenderer, defineDailyReportSchema, generateETag, isStreamIdLte, jsonResponseWithETag, predictSharpThumbnailWorkingSetBytes, transformJsonArray };
|
|
1853
|
+
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 DailyReportIdCodec, type DailyReportReadAttachment, type DailyReportRedisProvider, 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
|
@@ -14,6 +14,35 @@ declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_OUTPUT_MEDIA_TYPES: readonly [
|
|
|
14
14
|
"image/png"
|
|
15
15
|
];
|
|
16
16
|
declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_MAX_OUTPUT_BYTES: number;
|
|
17
|
+
declare const isStreamIdLte: (a: string, b: string) => boolean;
|
|
18
|
+
type StreamEntry = {
|
|
19
|
+
id: string;
|
|
20
|
+
message: Record<string, string>;
|
|
21
|
+
};
|
|
22
|
+
type DailyReportSseReaderConfig = {
|
|
23
|
+
redis?: DailyReportRedisProvider;
|
|
24
|
+
streamKey: string;
|
|
25
|
+
cache: SqlResultCache;
|
|
26
|
+
logger?: DailyReportLogger;
|
|
27
|
+
};
|
|
28
|
+
declare class DailyReportSseReader implements DailyReportSseReaderPort {
|
|
29
|
+
private readonly config;
|
|
30
|
+
private _source;
|
|
31
|
+
private _lastId;
|
|
32
|
+
private _positioning;
|
|
33
|
+
private _generation;
|
|
34
|
+
private readonly _logger;
|
|
35
|
+
constructor(config: DailyReportSseReaderConfig);
|
|
36
|
+
ready(): Promise<void>;
|
|
37
|
+
subscribe(onEntry: (entry: StreamEntry) => void, onError: (err: Error) => void): () => void;
|
|
38
|
+
destroy(): Promise<void>;
|
|
39
|
+
private _position;
|
|
40
|
+
private _readTail;
|
|
41
|
+
private _createSource;
|
|
42
|
+
private _start;
|
|
43
|
+
private _readLoop;
|
|
44
|
+
private _invalidateCaches;
|
|
45
|
+
}
|
|
17
46
|
type RedisStreamMessage = {
|
|
18
47
|
id: string;
|
|
19
48
|
message: Record<string, string>;
|
|
@@ -48,6 +77,10 @@ type DailyReportRedisProvider = {
|
|
|
48
77
|
getClient(): Promise<DailyReportRedisClient | undefined>;
|
|
49
78
|
createClient(): Promise<DailyReportRedisBlockingClient | undefined>;
|
|
50
79
|
};
|
|
80
|
+
type DailyReportSseReaderPort = {
|
|
81
|
+
ready(): Promise<void>;
|
|
82
|
+
subscribe(onEntry: (entry: StreamEntry) => void, onError: (err: Error) => void): () => void;
|
|
83
|
+
};
|
|
51
84
|
type DailyReportAuthResult = {
|
|
52
85
|
user?: {
|
|
53
86
|
id: string;
|
|
@@ -142,14 +175,12 @@ declare class SqlResultCache {
|
|
|
142
175
|
constructor(config: {
|
|
143
176
|
defaultTtlMs: number;
|
|
144
177
|
}, epochStore: EpochStore);
|
|
145
|
-
invalidate: (cacheKey: string) => void;
|
|
146
178
|
private maybeRefreshAhead;
|
|
147
179
|
getOrFetch: <T>(opts: {
|
|
148
180
|
cacheKey: string;
|
|
149
181
|
fetcher: () => Promise<readonly T[]>;
|
|
150
182
|
onFetchStart?: () => void;
|
|
151
183
|
} & SqlResultCacheQueryOptions) => Promise<readonly T[]>;
|
|
152
|
-
flush: (cacheKey: string) => void;
|
|
153
184
|
clearAll: () => void;
|
|
154
185
|
invalidatePrefix: (prefix: string) => void;
|
|
155
186
|
private cleanExpired;
|
|
@@ -1577,34 +1608,6 @@ declare function createDailyReportService(config: DailyReportServiceConfig): {
|
|
|
1577
1608
|
updateDailyReportInternal: (tx: DailyReportDb, hubId: number, data: Partial<DailyReportInternalRow>) => Promise<void>;
|
|
1578
1609
|
deleteDailyReportLabel: (tx: DailyReportDb, hubId: number, labelId: number) => Promise<void>;
|
|
1579
1610
|
};
|
|
1580
|
-
declare const isStreamIdLte: (a: string, b: string) => boolean;
|
|
1581
|
-
type StreamEntry = {
|
|
1582
|
-
id: string;
|
|
1583
|
-
message: Record<string, string>;
|
|
1584
|
-
};
|
|
1585
|
-
type DailyReportSseReaderConfig = {
|
|
1586
|
-
redis?: DailyReportRedisProvider;
|
|
1587
|
-
streamKey: string;
|
|
1588
|
-
cache: SqlResultCache;
|
|
1589
|
-
logger?: DailyReportLogger;
|
|
1590
|
-
};
|
|
1591
|
-
declare class DailyReportSseReader {
|
|
1592
|
-
private readonly config;
|
|
1593
|
-
private _source;
|
|
1594
|
-
private _lastId;
|
|
1595
|
-
private _positioning;
|
|
1596
|
-
private _generation;
|
|
1597
|
-
private readonly _logger;
|
|
1598
|
-
constructor(config: DailyReportSseReaderConfig);
|
|
1599
|
-
ready(): Promise<void>;
|
|
1600
|
-
subscribe(onEntry: (entry: StreamEntry) => void, onError: (err: Error) => void): () => void;
|
|
1601
|
-
destroy(): Promise<void>;
|
|
1602
|
-
private _readTail;
|
|
1603
|
-
private _createSource;
|
|
1604
|
-
private _start;
|
|
1605
|
-
private _readLoop;
|
|
1606
|
-
private _invalidateCaches;
|
|
1607
|
-
}
|
|
1608
1611
|
type LoaderArgs = {
|
|
1609
1612
|
request: Request;
|
|
1610
1613
|
params: Record<string, string | undefined>;
|
|
@@ -1622,7 +1625,7 @@ type DailyReportHandlersConfig = {
|
|
|
1622
1625
|
attachmentThumbnailConcurrency?: number;
|
|
1623
1626
|
attachmentThumbnailCacheBytes?: number;
|
|
1624
1627
|
redis?: DailyReportRedisProvider;
|
|
1625
|
-
sseReader:
|
|
1628
|
+
sseReader: DailyReportSseReaderPort;
|
|
1626
1629
|
streamKey: string;
|
|
1627
1630
|
loginRedirectPath?: string;
|
|
1628
1631
|
enableDevCacheClear?: boolean;
|
|
@@ -1737,6 +1740,16 @@ declare const DAILY_REPORT_SHARP_THUMBNAIL_WORKING_SET_MODEL: Readonly<{
|
|
|
1737
1740
|
}>;
|
|
1738
1741
|
}>;
|
|
1739
1742
|
}>;
|
|
1743
|
+
declare const DAILY_REPORT_SHARP_THUMBNAIL_DECODE_WORK_MODEL: Readonly<{
|
|
1744
|
+
renderMs: 10000;
|
|
1745
|
+
nanosecondsPerBlockVisit: 125;
|
|
1746
|
+
margin: 4;
|
|
1747
|
+
maxBlockVisits: number;
|
|
1748
|
+
walkBudgetMs: 16;
|
|
1749
|
+
nanosecondsPerWalkStep: 50;
|
|
1750
|
+
walkMargin: 2;
|
|
1751
|
+
maxWalkSteps: number;
|
|
1752
|
+
}>;
|
|
1740
1753
|
declare const predictSharpThumbnailWorkingSetBytes: (source: Uint8Array, format: DailyReportAttachmentThumbnailSourceFormat, header: SharpHeaderLike) => number | null;
|
|
1741
1754
|
declare const createSharpThumbnailRenderer: (sharp: SharpLike) => DailyReportAttachmentThumbnailRenderer;
|
|
1742
1755
|
type DailyReportServerConfig = Omit<DailyReportServiceConfig, "cache" | "epochs"> & {
|
|
@@ -1837,4 +1850,4 @@ declare function createDailyReportServer(config: DailyReportServerConfig): {
|
|
|
1837
1850
|
streamKey: string;
|
|
1838
1851
|
knownSourceTypes: readonly string[];
|
|
1839
1852
|
};
|
|
1840
|
-
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_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 DailyReportIdCodec, type DailyReportReadAttachment, type DailyReportRedisProvider, type DailyReportServerConfig, type DailyReportServiceConfig, DailyReportSseReader, type DailyReportTables, DailyReportViewerScope, type ExternalReportFields, type SharpLike, SqlResultCache, type StreamEntry, createDailyReportHandlers, createDailyReportServer, createDailyReportService, createEpochStore, createSharpThumbnailRenderer, defineDailyReportSchema, generateETag, isStreamIdLte, jsonResponseWithETag, predictSharpThumbnailWorkingSetBytes, transformJsonArray };
|
|
1853
|
+
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 DailyReportIdCodec, type DailyReportReadAttachment, type DailyReportRedisProvider, 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 };
|