@aiquants/daily-report 0.27.0 → 0.28.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 +32 -0
- package/README.md +48 -23
- package/dist/client.d.mts +12 -2
- package/dist/client.d.ts +12 -2
- package/dist/client.js +5 -4
- package/dist/client.mjs +5 -4
- package/dist/server.d.mts +47 -48
- package/dist/server.d.ts +47 -48
- package/dist/server.js +4 -4
- package/dist/server.mjs +4 -4
- package/dist/styles/daily-report.standalone.css +1 -1
- package/package.json +3 -3
package/dist/server.d.mts
CHANGED
|
@@ -8,41 +8,6 @@ interface DailyReportLogger {
|
|
|
8
8
|
warn(message?: unknown, ...optionalParams: unknown[]): void;
|
|
9
9
|
error(message?: unknown, ...optionalParams: unknown[]): void;
|
|
10
10
|
}
|
|
11
|
-
declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_OUTPUT_MEDIA_TYPES: readonly [
|
|
12
|
-
"image/webp",
|
|
13
|
-
"image/jpeg",
|
|
14
|
-
"image/png"
|
|
15
|
-
];
|
|
16
|
-
declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_MAX_OUTPUT_BYTES: number;
|
|
17
|
-
declare const isStreamIdLte: (a: string, b: string) => boolean;
|
|
18
|
-
type StreamEntry = {
|
|
19
|
-
id: string;
|
|
20
|
-
message: Record<string, string>;
|
|
21
|
-
};
|
|
22
|
-
type DailyReportSseReaderConfig = {
|
|
23
|
-
redis?: DailyReportRedisProvider;
|
|
24
|
-
streamKey: string;
|
|
25
|
-
cache: SqlResultCache;
|
|
26
|
-
logger?: DailyReportLogger;
|
|
27
|
-
};
|
|
28
|
-
declare class DailyReportSseReader implements DailyReportSseReaderPort {
|
|
29
|
-
private readonly config;
|
|
30
|
-
private _source;
|
|
31
|
-
private _lastId;
|
|
32
|
-
private _positioning;
|
|
33
|
-
private _generation;
|
|
34
|
-
private readonly _logger;
|
|
35
|
-
constructor(config: DailyReportSseReaderConfig);
|
|
36
|
-
ready(): Promise<void>;
|
|
37
|
-
subscribe(onEntry: (entry: StreamEntry) => void, onError: (err: Error) => void): () => void;
|
|
38
|
-
destroy(): Promise<void>;
|
|
39
|
-
private _position;
|
|
40
|
-
private _readTail;
|
|
41
|
-
private _createSource;
|
|
42
|
-
private _start;
|
|
43
|
-
private _readLoop;
|
|
44
|
-
private _invalidateCaches;
|
|
45
|
-
}
|
|
46
11
|
type RedisStreamMessage = {
|
|
47
12
|
id: string;
|
|
48
13
|
message: Record<string, string>;
|
|
@@ -77,6 +42,10 @@ type DailyReportRedisProvider = {
|
|
|
77
42
|
getClient(): Promise<DailyReportRedisClient | undefined>;
|
|
78
43
|
createClient(): Promise<DailyReportRedisBlockingClient | undefined>;
|
|
79
44
|
};
|
|
45
|
+
type StreamEntry = {
|
|
46
|
+
id: string;
|
|
47
|
+
message: Record<string, string>;
|
|
48
|
+
};
|
|
80
49
|
type DailyReportSseReaderPort = {
|
|
81
50
|
ready(): Promise<void>;
|
|
82
51
|
subscribe(onEntry: (entry: StreamEntry) => void, onError: (err: Error) => void): () => void;
|
|
@@ -136,6 +105,12 @@ type DailyReportReadAttachment = (filePath: string, options: {
|
|
|
136
105
|
}) => Promise<DailyReportAttachmentBytes | DailyReportAttachmentError>;
|
|
137
106
|
type DailyReportAttachmentThumbnailSourceFormat = "png" | "jpeg" | "gif" | "webp";
|
|
138
107
|
type DailyReportAttachmentThumbnailFailure = "unsupported" | "failed";
|
|
108
|
+
declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_OUTPUT_MEDIA_TYPES: readonly [
|
|
109
|
+
"image/webp",
|
|
110
|
+
"image/jpeg",
|
|
111
|
+
"image/png"
|
|
112
|
+
];
|
|
113
|
+
declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_MAX_OUTPUT_BYTES: number;
|
|
139
114
|
type DailyReportAttachmentThumbnailOutputMediaType = (typeof DAILY_REPORT_ATTACHMENT_THUMBNAIL_OUTPUT_MEDIA_TYPES)[number];
|
|
140
115
|
type DailyReportAttachmentThumbnail = {
|
|
141
116
|
ok: true;
|
|
@@ -1608,6 +1583,32 @@ declare function createDailyReportService(config: DailyReportServiceConfig): {
|
|
|
1608
1583
|
updateDailyReportInternal: (tx: DailyReportDb, hubId: number, data: Partial<DailyReportInternalRow>) => Promise<void>;
|
|
1609
1584
|
deleteDailyReportLabel: (tx: DailyReportDb, hubId: number, labelId: number) => Promise<void>;
|
|
1610
1585
|
};
|
|
1586
|
+
declare const isStreamIdLte: (a: string, b: string) => boolean;
|
|
1587
|
+
type DailyReportSseReaderConfig = {
|
|
1588
|
+
redis?: DailyReportRedisProvider;
|
|
1589
|
+
streamKey: string;
|
|
1590
|
+
cache: SqlResultCache;
|
|
1591
|
+
logger?: DailyReportLogger;
|
|
1592
|
+
};
|
|
1593
|
+
declare class DailyReportSseReader implements DailyReportSseReaderPort {
|
|
1594
|
+
private readonly config;
|
|
1595
|
+
private _source;
|
|
1596
|
+
private _lastId;
|
|
1597
|
+
private _positioning;
|
|
1598
|
+
private _generation;
|
|
1599
|
+
private readonly _logger;
|
|
1600
|
+
constructor(config: DailyReportSseReaderConfig);
|
|
1601
|
+
ready(): Promise<void>;
|
|
1602
|
+
subscribe(onEntry: (entry: StreamEntry) => void, onError: (err: Error) => void): () => void;
|
|
1603
|
+
destroy(): Promise<void>;
|
|
1604
|
+
private _position;
|
|
1605
|
+
private _readTail;
|
|
1606
|
+
private _createSource;
|
|
1607
|
+
private _start;
|
|
1608
|
+
private _readLoop;
|
|
1609
|
+
private _invalidateCaches;
|
|
1610
|
+
}
|
|
1611
|
+
declare const generateETag: (data: unknown) => string;
|
|
1611
1612
|
type LoaderArgs = {
|
|
1612
1613
|
request: Request;
|
|
1613
1614
|
params: Record<string, string | undefined>;
|
|
@@ -1644,21 +1645,16 @@ declare function createDailyReportHandlers(config: DailyReportHandlersConfig): {
|
|
|
1644
1645
|
}>;
|
|
1645
1646
|
};
|
|
1646
1647
|
api: {
|
|
1647
|
-
loader: (
|
|
1648
|
-
action: (
|
|
1648
|
+
loader: (args: LoaderArgs) => Promise<Response>;
|
|
1649
|
+
action: (args: LoaderArgs) => Promise<Response>;
|
|
1649
1650
|
};
|
|
1650
1651
|
sse: {
|
|
1651
|
-
loader: (
|
|
1652
|
+
loader: (args: LoaderArgs) => Promise<Response>;
|
|
1652
1653
|
};
|
|
1653
1654
|
attachment: {
|
|
1654
|
-
loader: (args:
|
|
1655
|
+
loader: (args: LoaderArgs) => Promise<Response>;
|
|
1655
1656
|
};
|
|
1656
1657
|
};
|
|
1657
|
-
type AttachmentLoaderArgs = {
|
|
1658
|
-
request: Request;
|
|
1659
|
-
params: Record<string, string | undefined>;
|
|
1660
|
-
};
|
|
1661
|
-
declare const generateETag: (data: unknown) => string;
|
|
1662
1658
|
declare const jsonResponseWithETag: (request: Request, cookie: string | null, payload: Record<string, unknown>, status?: number, logger?: DailyReportLogger) => Response;
|
|
1663
1659
|
type SharpHeaderLike = {
|
|
1664
1660
|
width: number;
|
|
@@ -1781,23 +1777,26 @@ declare function createDailyReportServer(config: DailyReportServerConfig): {
|
|
|
1781
1777
|
}>;
|
|
1782
1778
|
};
|
|
1783
1779
|
api: {
|
|
1784
|
-
loader: (
|
|
1780
|
+
loader: (args: {
|
|
1785
1781
|
request: Request;
|
|
1786
1782
|
params: Record<string, string | undefined>;
|
|
1787
1783
|
}) => Promise<Response>;
|
|
1788
|
-
action: (
|
|
1784
|
+
action: (args: {
|
|
1789
1785
|
request: Request;
|
|
1790
1786
|
params: Record<string, string | undefined>;
|
|
1791
1787
|
}) => Promise<Response>;
|
|
1792
1788
|
};
|
|
1793
1789
|
sse: {
|
|
1794
|
-
loader: (
|
|
1790
|
+
loader: (args: {
|
|
1795
1791
|
request: Request;
|
|
1796
1792
|
params: Record<string, string | undefined>;
|
|
1797
1793
|
}) => Promise<Response>;
|
|
1798
1794
|
};
|
|
1799
1795
|
attachment: {
|
|
1800
|
-
loader: (args:
|
|
1796
|
+
loader: (args: {
|
|
1797
|
+
request: Request;
|
|
1798
|
+
params: Record<string, string | undefined>;
|
|
1799
|
+
}) => Promise<Response>;
|
|
1801
1800
|
};
|
|
1802
1801
|
service: {
|
|
1803
1802
|
streamKey: string;
|
package/dist/server.d.ts
CHANGED
|
@@ -8,41 +8,6 @@ interface DailyReportLogger {
|
|
|
8
8
|
warn(message?: unknown, ...optionalParams: unknown[]): void;
|
|
9
9
|
error(message?: unknown, ...optionalParams: unknown[]): void;
|
|
10
10
|
}
|
|
11
|
-
declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_OUTPUT_MEDIA_TYPES: readonly [
|
|
12
|
-
"image/webp",
|
|
13
|
-
"image/jpeg",
|
|
14
|
-
"image/png"
|
|
15
|
-
];
|
|
16
|
-
declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_MAX_OUTPUT_BYTES: number;
|
|
17
|
-
declare const isStreamIdLte: (a: string, b: string) => boolean;
|
|
18
|
-
type StreamEntry = {
|
|
19
|
-
id: string;
|
|
20
|
-
message: Record<string, string>;
|
|
21
|
-
};
|
|
22
|
-
type DailyReportSseReaderConfig = {
|
|
23
|
-
redis?: DailyReportRedisProvider;
|
|
24
|
-
streamKey: string;
|
|
25
|
-
cache: SqlResultCache;
|
|
26
|
-
logger?: DailyReportLogger;
|
|
27
|
-
};
|
|
28
|
-
declare class DailyReportSseReader implements DailyReportSseReaderPort {
|
|
29
|
-
private readonly config;
|
|
30
|
-
private _source;
|
|
31
|
-
private _lastId;
|
|
32
|
-
private _positioning;
|
|
33
|
-
private _generation;
|
|
34
|
-
private readonly _logger;
|
|
35
|
-
constructor(config: DailyReportSseReaderConfig);
|
|
36
|
-
ready(): Promise<void>;
|
|
37
|
-
subscribe(onEntry: (entry: StreamEntry) => void, onError: (err: Error) => void): () => void;
|
|
38
|
-
destroy(): Promise<void>;
|
|
39
|
-
private _position;
|
|
40
|
-
private _readTail;
|
|
41
|
-
private _createSource;
|
|
42
|
-
private _start;
|
|
43
|
-
private _readLoop;
|
|
44
|
-
private _invalidateCaches;
|
|
45
|
-
}
|
|
46
11
|
type RedisStreamMessage = {
|
|
47
12
|
id: string;
|
|
48
13
|
message: Record<string, string>;
|
|
@@ -77,6 +42,10 @@ type DailyReportRedisProvider = {
|
|
|
77
42
|
getClient(): Promise<DailyReportRedisClient | undefined>;
|
|
78
43
|
createClient(): Promise<DailyReportRedisBlockingClient | undefined>;
|
|
79
44
|
};
|
|
45
|
+
type StreamEntry = {
|
|
46
|
+
id: string;
|
|
47
|
+
message: Record<string, string>;
|
|
48
|
+
};
|
|
80
49
|
type DailyReportSseReaderPort = {
|
|
81
50
|
ready(): Promise<void>;
|
|
82
51
|
subscribe(onEntry: (entry: StreamEntry) => void, onError: (err: Error) => void): () => void;
|
|
@@ -136,6 +105,12 @@ type DailyReportReadAttachment = (filePath: string, options: {
|
|
|
136
105
|
}) => Promise<DailyReportAttachmentBytes | DailyReportAttachmentError>;
|
|
137
106
|
type DailyReportAttachmentThumbnailSourceFormat = "png" | "jpeg" | "gif" | "webp";
|
|
138
107
|
type DailyReportAttachmentThumbnailFailure = "unsupported" | "failed";
|
|
108
|
+
declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_OUTPUT_MEDIA_TYPES: readonly [
|
|
109
|
+
"image/webp",
|
|
110
|
+
"image/jpeg",
|
|
111
|
+
"image/png"
|
|
112
|
+
];
|
|
113
|
+
declare const DAILY_REPORT_ATTACHMENT_THUMBNAIL_MAX_OUTPUT_BYTES: number;
|
|
139
114
|
type DailyReportAttachmentThumbnailOutputMediaType = (typeof DAILY_REPORT_ATTACHMENT_THUMBNAIL_OUTPUT_MEDIA_TYPES)[number];
|
|
140
115
|
type DailyReportAttachmentThumbnail = {
|
|
141
116
|
ok: true;
|
|
@@ -1608,6 +1583,32 @@ declare function createDailyReportService(config: DailyReportServiceConfig): {
|
|
|
1608
1583
|
updateDailyReportInternal: (tx: DailyReportDb, hubId: number, data: Partial<DailyReportInternalRow>) => Promise<void>;
|
|
1609
1584
|
deleteDailyReportLabel: (tx: DailyReportDb, hubId: number, labelId: number) => Promise<void>;
|
|
1610
1585
|
};
|
|
1586
|
+
declare const isStreamIdLte: (a: string, b: string) => boolean;
|
|
1587
|
+
type DailyReportSseReaderConfig = {
|
|
1588
|
+
redis?: DailyReportRedisProvider;
|
|
1589
|
+
streamKey: string;
|
|
1590
|
+
cache: SqlResultCache;
|
|
1591
|
+
logger?: DailyReportLogger;
|
|
1592
|
+
};
|
|
1593
|
+
declare class DailyReportSseReader implements DailyReportSseReaderPort {
|
|
1594
|
+
private readonly config;
|
|
1595
|
+
private _source;
|
|
1596
|
+
private _lastId;
|
|
1597
|
+
private _positioning;
|
|
1598
|
+
private _generation;
|
|
1599
|
+
private readonly _logger;
|
|
1600
|
+
constructor(config: DailyReportSseReaderConfig);
|
|
1601
|
+
ready(): Promise<void>;
|
|
1602
|
+
subscribe(onEntry: (entry: StreamEntry) => void, onError: (err: Error) => void): () => void;
|
|
1603
|
+
destroy(): Promise<void>;
|
|
1604
|
+
private _position;
|
|
1605
|
+
private _readTail;
|
|
1606
|
+
private _createSource;
|
|
1607
|
+
private _start;
|
|
1608
|
+
private _readLoop;
|
|
1609
|
+
private _invalidateCaches;
|
|
1610
|
+
}
|
|
1611
|
+
declare const generateETag: (data: unknown) => string;
|
|
1611
1612
|
type LoaderArgs = {
|
|
1612
1613
|
request: Request;
|
|
1613
1614
|
params: Record<string, string | undefined>;
|
|
@@ -1644,21 +1645,16 @@ declare function createDailyReportHandlers(config: DailyReportHandlersConfig): {
|
|
|
1644
1645
|
}>;
|
|
1645
1646
|
};
|
|
1646
1647
|
api: {
|
|
1647
|
-
loader: (
|
|
1648
|
-
action: (
|
|
1648
|
+
loader: (args: LoaderArgs) => Promise<Response>;
|
|
1649
|
+
action: (args: LoaderArgs) => Promise<Response>;
|
|
1649
1650
|
};
|
|
1650
1651
|
sse: {
|
|
1651
|
-
loader: (
|
|
1652
|
+
loader: (args: LoaderArgs) => Promise<Response>;
|
|
1652
1653
|
};
|
|
1653
1654
|
attachment: {
|
|
1654
|
-
loader: (args:
|
|
1655
|
+
loader: (args: LoaderArgs) => Promise<Response>;
|
|
1655
1656
|
};
|
|
1656
1657
|
};
|
|
1657
|
-
type AttachmentLoaderArgs = {
|
|
1658
|
-
request: Request;
|
|
1659
|
-
params: Record<string, string | undefined>;
|
|
1660
|
-
};
|
|
1661
|
-
declare const generateETag: (data: unknown) => string;
|
|
1662
1658
|
declare const jsonResponseWithETag: (request: Request, cookie: string | null, payload: Record<string, unknown>, status?: number, logger?: DailyReportLogger) => Response;
|
|
1663
1659
|
type SharpHeaderLike = {
|
|
1664
1660
|
width: number;
|
|
@@ -1781,23 +1777,26 @@ declare function createDailyReportServer(config: DailyReportServerConfig): {
|
|
|
1781
1777
|
}>;
|
|
1782
1778
|
};
|
|
1783
1779
|
api: {
|
|
1784
|
-
loader: (
|
|
1780
|
+
loader: (args: {
|
|
1785
1781
|
request: Request;
|
|
1786
1782
|
params: Record<string, string | undefined>;
|
|
1787
1783
|
}) => Promise<Response>;
|
|
1788
|
-
action: (
|
|
1784
|
+
action: (args: {
|
|
1789
1785
|
request: Request;
|
|
1790
1786
|
params: Record<string, string | undefined>;
|
|
1791
1787
|
}) => Promise<Response>;
|
|
1792
1788
|
};
|
|
1793
1789
|
sse: {
|
|
1794
|
-
loader: (
|
|
1790
|
+
loader: (args: {
|
|
1795
1791
|
request: Request;
|
|
1796
1792
|
params: Record<string, string | undefined>;
|
|
1797
1793
|
}) => Promise<Response>;
|
|
1798
1794
|
};
|
|
1799
1795
|
attachment: {
|
|
1800
|
-
loader: (args:
|
|
1796
|
+
loader: (args: {
|
|
1797
|
+
request: Request;
|
|
1798
|
+
params: Record<string, string | undefined>;
|
|
1799
|
+
}) => Promise<Response>;
|
|
1801
1800
|
};
|
|
1802
1801
|
service: {
|
|
1803
1802
|
streamKey: string;
|