@aiquants/daily-report 0.32.0 → 0.34.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 +106 -0
- package/README.md +155 -55
- package/dist/client.d.mts +111 -111
- package/dist/client.d.ts +111 -111
- package/dist/client.js +4 -4
- package/dist/client.mjs +4 -4
- package/dist/comment-adapter-7TduiLiu.d.mts +127 -0
- package/dist/comment-adapter-BLfjD6P0.d.ts +127 -0
- package/dist/index.d.mts +18 -3
- package/dist/index.d.ts +18 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/server.d.mts +33 -14
- package/dist/server.d.ts +33 -14
- package/dist/server.js +4 -4
- package/dist/server.mjs +4 -4
- package/dist/{ids-stream-BR5RSj5u.d.ts → sse-schema-DVIUaiAG.d.mts} +685 -643
- package/dist/{ids-stream-DvB2h1dj.d.mts → sse-schema-DVIUaiAG.d.ts} +685 -643
- package/dist/styles/daily-report.standalone.css +1 -1
- package/package.json +5 -4
- package/dist/types-DkERw8NE.d.mts +0 -74
- package/dist/types-DkERw8NE.d.ts +0 -74
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { d as DailyReportDetail, l as DailyReportPostedComment, D as DailyReportItem, i as DailyReportExternalComment } from "./sse-schema-DVIUaiAG.mjs";
|
|
2
|
+
declare const DAILY_REPORT_ACTION_INTENTS: readonly [
|
|
3
|
+
"create",
|
|
4
|
+
"update",
|
|
5
|
+
"publish",
|
|
6
|
+
"delete",
|
|
7
|
+
"toggleStar",
|
|
8
|
+
"toggleRead",
|
|
9
|
+
"addComment",
|
|
10
|
+
"deleteComment",
|
|
11
|
+
"clearCache"
|
|
12
|
+
];
|
|
13
|
+
type DailyReportActionIntent = (typeof DAILY_REPORT_ACTION_INTENTS)[number];
|
|
14
|
+
declare const DAILY_REPORT_ACTION_FIELDS: Readonly<{
|
|
15
|
+
readonly intent: "intent";
|
|
16
|
+
readonly clientTempId: "clientTempId";
|
|
17
|
+
readonly businessDate: "businessDate";
|
|
18
|
+
readonly operationTimestamp: "operationTimestamp";
|
|
19
|
+
readonly reportHubId: "reportHubId";
|
|
20
|
+
readonly title: "title";
|
|
21
|
+
readonly content: "content";
|
|
22
|
+
readonly isStarred: "isStarred";
|
|
23
|
+
readonly isRead: "isRead";
|
|
24
|
+
readonly commentId: "commentId";
|
|
25
|
+
}>;
|
|
26
|
+
type ActionCommandBase<ClientTempId extends string> = {
|
|
27
|
+
readonly clientTempId: ClientTempId;
|
|
28
|
+
readonly businessDate: string | null;
|
|
29
|
+
readonly operationTimestamp: number | null;
|
|
30
|
+
};
|
|
31
|
+
type ActionCommand<ClientTempId extends string = string> = {
|
|
32
|
+
readonly intent: "clearCache";
|
|
33
|
+
} | (ActionCommandBase<ClientTempId> & {
|
|
34
|
+
readonly intent: "create";
|
|
35
|
+
readonly businessDate: string;
|
|
36
|
+
}) | (ActionCommandBase<ClientTempId> & {
|
|
37
|
+
readonly intent: "update";
|
|
38
|
+
readonly reportHubId: number;
|
|
39
|
+
readonly changes: {
|
|
40
|
+
readonly title?: string;
|
|
41
|
+
readonly content?: string;
|
|
42
|
+
};
|
|
43
|
+
}) | (ActionCommandBase<ClientTempId> & {
|
|
44
|
+
readonly intent: "publish" | "delete";
|
|
45
|
+
readonly reportHubId: number;
|
|
46
|
+
}) | (ActionCommandBase<ClientTempId> & {
|
|
47
|
+
readonly intent: "toggleStar" | "toggleRead";
|
|
48
|
+
readonly reportHubId: number;
|
|
49
|
+
readonly value: boolean;
|
|
50
|
+
}) | (ActionCommandBase<ClientTempId> & {
|
|
51
|
+
readonly intent: "addComment";
|
|
52
|
+
readonly reportHubId: number;
|
|
53
|
+
readonly content: string;
|
|
54
|
+
}) | (ActionCommandBase<ClientTempId> & {
|
|
55
|
+
readonly intent: "deleteComment";
|
|
56
|
+
readonly reportHubId: number;
|
|
57
|
+
readonly commentId: number;
|
|
58
|
+
});
|
|
59
|
+
declare const encodeActionCommand: (command: ActionCommand) => FormData;
|
|
60
|
+
type ActionEcho<Intent extends DailyReportActionIntent> = {
|
|
61
|
+
readonly status: "OK";
|
|
62
|
+
readonly intent: Intent;
|
|
63
|
+
readonly reportHubId: number;
|
|
64
|
+
readonly clientTempId: string;
|
|
65
|
+
};
|
|
66
|
+
type ActionToggleFields = {
|
|
67
|
+
readonly updatedStatus: {
|
|
68
|
+
readonly isStarred: boolean;
|
|
69
|
+
readonly isRead: boolean;
|
|
70
|
+
};
|
|
71
|
+
readonly operationTimestamp: number | null;
|
|
72
|
+
};
|
|
73
|
+
type ActionResult = (ActionEcho<"create"> & {
|
|
74
|
+
readonly report: DailyReportDetail;
|
|
75
|
+
}) | ActionEcho<"update"> | (ActionEcho<"publish"> & {
|
|
76
|
+
readonly report: DailyReportDetail | null;
|
|
77
|
+
}) | ActionEcho<"delete"> | (ActionEcho<"toggleStar"> & ActionToggleFields) | (ActionEcho<"toggleRead"> & ActionToggleFields) | (ActionEcho<"addComment"> & {
|
|
78
|
+
readonly newComment: DailyReportPostedComment;
|
|
79
|
+
}) | (ActionEcho<"deleteComment"> & {
|
|
80
|
+
readonly deletedCommentId: number;
|
|
81
|
+
}) | {
|
|
82
|
+
readonly status: "OK";
|
|
83
|
+
readonly intent: "clearCache";
|
|
84
|
+
};
|
|
85
|
+
type ActionResultOf<Intent extends DailyReportActionIntent> = Extract<ActionResult, {
|
|
86
|
+
readonly intent: Intent;
|
|
87
|
+
}>;
|
|
88
|
+
type ActionFailure = {
|
|
89
|
+
readonly error: string;
|
|
90
|
+
};
|
|
91
|
+
type ActionResultReading<Intent extends DailyReportActionIntent> = {
|
|
92
|
+
readonly result: ActionResultOf<Intent>;
|
|
93
|
+
} | {
|
|
94
|
+
readonly mismatch: string;
|
|
95
|
+
};
|
|
96
|
+
declare const parseActionResult: <Intent extends DailyReportActionIntent>(intent: Intent, json: unknown) => ActionResultReading<Intent>;
|
|
97
|
+
type DailyReportIdsStreamCursor = {
|
|
98
|
+
businessDate: string | null;
|
|
99
|
+
reportHubId: number;
|
|
100
|
+
};
|
|
101
|
+
type DailyReportIdsStreamChunkLine = {
|
|
102
|
+
kind: "chunk";
|
|
103
|
+
items: DailyReportItem[];
|
|
104
|
+
nextCursor: DailyReportIdsStreamCursor | null;
|
|
105
|
+
isLast: boolean;
|
|
106
|
+
total?: number;
|
|
107
|
+
provisional?: boolean;
|
|
108
|
+
snapshot?: string;
|
|
109
|
+
restarted?: boolean;
|
|
110
|
+
streamAnchor?: string | null;
|
|
111
|
+
};
|
|
112
|
+
type DailyReportSseStreamAnchor = {
|
|
113
|
+
readonly lastEventId: string | null;
|
|
114
|
+
readonly revision: number;
|
|
115
|
+
};
|
|
116
|
+
declare const isIdsStreamChunkLine: (line: unknown) => line is DailyReportIdsStreamChunkLine;
|
|
117
|
+
type UIComment = {
|
|
118
|
+
id: string | number;
|
|
119
|
+
authorName: string;
|
|
120
|
+
content: string;
|
|
121
|
+
createdAt?: string;
|
|
122
|
+
isMine: boolean;
|
|
123
|
+
color?: string;
|
|
124
|
+
isLegacy: boolean;
|
|
125
|
+
};
|
|
126
|
+
declare const mergeComments: (legacyComments: DailyReportExternalComment[], modernComments: DailyReportPostedComment[], currentUserId: string | null | undefined, unknownAuthorName: string) => UIComment[];
|
|
127
|
+
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 DailyReportIdsStreamChunkLine as g, encodeActionCommand as h, isIdsStreamChunkLine as i, mergeComments as m, parseActionResult as p };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { d as DailyReportDetail, l as DailyReportPostedComment, D as DailyReportItem, i as DailyReportExternalComment } from "./sse-schema-DVIUaiAG.js";
|
|
2
|
+
declare const DAILY_REPORT_ACTION_INTENTS: readonly [
|
|
3
|
+
"create",
|
|
4
|
+
"update",
|
|
5
|
+
"publish",
|
|
6
|
+
"delete",
|
|
7
|
+
"toggleStar",
|
|
8
|
+
"toggleRead",
|
|
9
|
+
"addComment",
|
|
10
|
+
"deleteComment",
|
|
11
|
+
"clearCache"
|
|
12
|
+
];
|
|
13
|
+
type DailyReportActionIntent = (typeof DAILY_REPORT_ACTION_INTENTS)[number];
|
|
14
|
+
declare const DAILY_REPORT_ACTION_FIELDS: Readonly<{
|
|
15
|
+
readonly intent: "intent";
|
|
16
|
+
readonly clientTempId: "clientTempId";
|
|
17
|
+
readonly businessDate: "businessDate";
|
|
18
|
+
readonly operationTimestamp: "operationTimestamp";
|
|
19
|
+
readonly reportHubId: "reportHubId";
|
|
20
|
+
readonly title: "title";
|
|
21
|
+
readonly content: "content";
|
|
22
|
+
readonly isStarred: "isStarred";
|
|
23
|
+
readonly isRead: "isRead";
|
|
24
|
+
readonly commentId: "commentId";
|
|
25
|
+
}>;
|
|
26
|
+
type ActionCommandBase<ClientTempId extends string> = {
|
|
27
|
+
readonly clientTempId: ClientTempId;
|
|
28
|
+
readonly businessDate: string | null;
|
|
29
|
+
readonly operationTimestamp: number | null;
|
|
30
|
+
};
|
|
31
|
+
type ActionCommand<ClientTempId extends string = string> = {
|
|
32
|
+
readonly intent: "clearCache";
|
|
33
|
+
} | (ActionCommandBase<ClientTempId> & {
|
|
34
|
+
readonly intent: "create";
|
|
35
|
+
readonly businessDate: string;
|
|
36
|
+
}) | (ActionCommandBase<ClientTempId> & {
|
|
37
|
+
readonly intent: "update";
|
|
38
|
+
readonly reportHubId: number;
|
|
39
|
+
readonly changes: {
|
|
40
|
+
readonly title?: string;
|
|
41
|
+
readonly content?: string;
|
|
42
|
+
};
|
|
43
|
+
}) | (ActionCommandBase<ClientTempId> & {
|
|
44
|
+
readonly intent: "publish" | "delete";
|
|
45
|
+
readonly reportHubId: number;
|
|
46
|
+
}) | (ActionCommandBase<ClientTempId> & {
|
|
47
|
+
readonly intent: "toggleStar" | "toggleRead";
|
|
48
|
+
readonly reportHubId: number;
|
|
49
|
+
readonly value: boolean;
|
|
50
|
+
}) | (ActionCommandBase<ClientTempId> & {
|
|
51
|
+
readonly intent: "addComment";
|
|
52
|
+
readonly reportHubId: number;
|
|
53
|
+
readonly content: string;
|
|
54
|
+
}) | (ActionCommandBase<ClientTempId> & {
|
|
55
|
+
readonly intent: "deleteComment";
|
|
56
|
+
readonly reportHubId: number;
|
|
57
|
+
readonly commentId: number;
|
|
58
|
+
});
|
|
59
|
+
declare const encodeActionCommand: (command: ActionCommand) => FormData;
|
|
60
|
+
type ActionEcho<Intent extends DailyReportActionIntent> = {
|
|
61
|
+
readonly status: "OK";
|
|
62
|
+
readonly intent: Intent;
|
|
63
|
+
readonly reportHubId: number;
|
|
64
|
+
readonly clientTempId: string;
|
|
65
|
+
};
|
|
66
|
+
type ActionToggleFields = {
|
|
67
|
+
readonly updatedStatus: {
|
|
68
|
+
readonly isStarred: boolean;
|
|
69
|
+
readonly isRead: boolean;
|
|
70
|
+
};
|
|
71
|
+
readonly operationTimestamp: number | null;
|
|
72
|
+
};
|
|
73
|
+
type ActionResult = (ActionEcho<"create"> & {
|
|
74
|
+
readonly report: DailyReportDetail;
|
|
75
|
+
}) | ActionEcho<"update"> | (ActionEcho<"publish"> & {
|
|
76
|
+
readonly report: DailyReportDetail | null;
|
|
77
|
+
}) | ActionEcho<"delete"> | (ActionEcho<"toggleStar"> & ActionToggleFields) | (ActionEcho<"toggleRead"> & ActionToggleFields) | (ActionEcho<"addComment"> & {
|
|
78
|
+
readonly newComment: DailyReportPostedComment;
|
|
79
|
+
}) | (ActionEcho<"deleteComment"> & {
|
|
80
|
+
readonly deletedCommentId: number;
|
|
81
|
+
}) | {
|
|
82
|
+
readonly status: "OK";
|
|
83
|
+
readonly intent: "clearCache";
|
|
84
|
+
};
|
|
85
|
+
type ActionResultOf<Intent extends DailyReportActionIntent> = Extract<ActionResult, {
|
|
86
|
+
readonly intent: Intent;
|
|
87
|
+
}>;
|
|
88
|
+
type ActionFailure = {
|
|
89
|
+
readonly error: string;
|
|
90
|
+
};
|
|
91
|
+
type ActionResultReading<Intent extends DailyReportActionIntent> = {
|
|
92
|
+
readonly result: ActionResultOf<Intent>;
|
|
93
|
+
} | {
|
|
94
|
+
readonly mismatch: string;
|
|
95
|
+
};
|
|
96
|
+
declare const parseActionResult: <Intent extends DailyReportActionIntent>(intent: Intent, json: unknown) => ActionResultReading<Intent>;
|
|
97
|
+
type DailyReportIdsStreamCursor = {
|
|
98
|
+
businessDate: string | null;
|
|
99
|
+
reportHubId: number;
|
|
100
|
+
};
|
|
101
|
+
type DailyReportIdsStreamChunkLine = {
|
|
102
|
+
kind: "chunk";
|
|
103
|
+
items: DailyReportItem[];
|
|
104
|
+
nextCursor: DailyReportIdsStreamCursor | null;
|
|
105
|
+
isLast: boolean;
|
|
106
|
+
total?: number;
|
|
107
|
+
provisional?: boolean;
|
|
108
|
+
snapshot?: string;
|
|
109
|
+
restarted?: boolean;
|
|
110
|
+
streamAnchor?: string | null;
|
|
111
|
+
};
|
|
112
|
+
type DailyReportSseStreamAnchor = {
|
|
113
|
+
readonly lastEventId: string | null;
|
|
114
|
+
readonly revision: number;
|
|
115
|
+
};
|
|
116
|
+
declare const isIdsStreamChunkLine: (line: unknown) => line is DailyReportIdsStreamChunkLine;
|
|
117
|
+
type UIComment = {
|
|
118
|
+
id: string | number;
|
|
119
|
+
authorName: string;
|
|
120
|
+
content: string;
|
|
121
|
+
createdAt?: string;
|
|
122
|
+
isMine: boolean;
|
|
123
|
+
color?: string;
|
|
124
|
+
isLegacy: boolean;
|
|
125
|
+
};
|
|
126
|
+
declare const mergeComments: (legacyComments: DailyReportExternalComment[], modernComments: DailyReportPostedComment[], currentUserId: string | null | undefined, unknownAuthorName: string) => UIComment[];
|
|
127
|
+
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 DailyReportIdsStreamChunkLine as g, encodeActionCommand as h, isIdsStreamChunkLine as i, mergeComments as m, parseActionResult as p };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
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 DailyReportIdsStreamChunkLine, a as DailyReportSseStreamAnchor, h as encodeDailyReportActionCommand, i as isIdsStreamChunkLine, m as mergeComments, p as parseDailyReportActionResult } from "./comment-adapter-7TduiLiu.mjs";
|
|
2
|
+
export { e as DAILY_REPORT_SSE_CURSOR_PARAM, f as DAILY_REPORT_SSE_HEARTBEAT_MS, g as DAILY_REPORT_SSE_TERMINAL_EVENTS, h as DailyReportAttachmentSummary, d as DailyReportDetail, i as DailyReportExternalComment, j as DailyReportInterviewer, D as DailyReportItem, k as DailyReportLabelDef, l as DailyReportPostedComment, c as DailyReportSseMessage, a as DailyReportUser, m as commentAddMessageSchema, n as commentDeleteMessageSchema, o as connectedMessageSchema, p as dailyReportDetailSchema, q as dailyReportExternalCommentSchema, r as dailyReportInterviewerSchema, s as dailyReportLabelDefSchema, t as dailyReportPostedCommentSchema, u as dailyReportSseMessageSchema, v as isDailyReportSseStreamId, w as reportCreateMessageSchema, x as reportDeleteMessageSchema, y as reportPublishMessageSchema, z as reportUpdateMessageSchema, A as statusUpdateMessageSchema } from "./sse-schema-DVIUaiAG.mjs";
|
|
3
3
|
import "zod";
|
|
4
|
+
declare const DAILY_REPORT_API_ENDPOINTS: Readonly<{
|
|
5
|
+
readonly businessDate: "business-date";
|
|
6
|
+
readonly idsStream: "ids-stream";
|
|
7
|
+
readonly report: "report";
|
|
8
|
+
readonly action: "action";
|
|
9
|
+
}>;
|
|
10
|
+
declare const DAILY_REPORT_API_QUERY_PARAMS: Readonly<{
|
|
11
|
+
readonly businessDate: "businessDate";
|
|
12
|
+
readonly reportHubId: "reportHubId";
|
|
13
|
+
readonly forceRefresh: "forceRefresh";
|
|
14
|
+
readonly cursorReportHubId: "cursor_report_hub_id";
|
|
15
|
+
readonly cursorBusinessDate: "cursor_business_date";
|
|
16
|
+
readonly cursorSnapshot: "cursor_snapshot";
|
|
17
|
+
}>;
|
|
4
18
|
type DailyReportAttachmentThumbnailBox = {
|
|
5
19
|
readonly maxWidth: number;
|
|
6
20
|
readonly maxHeight: number;
|
|
@@ -29,4 +43,5 @@ declare const buildDailyReportAttachmentUrl: (apiBasePath: string, token: string
|
|
|
29
43
|
declare const parseDailyReportAttachmentQuery: (params: URLSearchParams) => DailyReportAttachmentDeliveryRequest | DailyReportAttachmentInvalidQuery;
|
|
30
44
|
type BusinessDateInput = string | Date | null | undefined;
|
|
31
45
|
declare const normalizeBusinessDateKey: (value: BusinessDateInput) => string | null;
|
|
32
|
-
|
|
46
|
+
declare const DAILY_REPORT_CLIENT_TEMP_ID_PATTERN: RegExp;
|
|
47
|
+
export { DAILY_REPORT_API_ENDPOINTS, DAILY_REPORT_API_QUERY_PARAMS, DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS, DAILY_REPORT_CLIENT_TEMP_ID_PATTERN, type DailyReportAttachmentDeliveryRequest, type DailyReportAttachmentInvalidQuery, type DailyReportAttachmentThumbnailBox, type DailyReportAttachmentThumbnailVariant, buildDailyReportAttachmentUrl, isDailyReportAttachmentThumbnailVariant, normalizeBusinessDateKey, parseDailyReportAttachmentQuery };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
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 DailyReportIdsStreamChunkLine, a as DailyReportSseStreamAnchor, h as encodeDailyReportActionCommand, i as isIdsStreamChunkLine, m as mergeComments, p as parseDailyReportActionResult } from "./comment-adapter-BLfjD6P0.js";
|
|
2
|
+
export { e as DAILY_REPORT_SSE_CURSOR_PARAM, f as DAILY_REPORT_SSE_HEARTBEAT_MS, g as DAILY_REPORT_SSE_TERMINAL_EVENTS, h as DailyReportAttachmentSummary, d as DailyReportDetail, i as DailyReportExternalComment, j as DailyReportInterviewer, D as DailyReportItem, k as DailyReportLabelDef, l as DailyReportPostedComment, c as DailyReportSseMessage, a as DailyReportUser, m as commentAddMessageSchema, n as commentDeleteMessageSchema, o as connectedMessageSchema, p as dailyReportDetailSchema, q as dailyReportExternalCommentSchema, r as dailyReportInterviewerSchema, s as dailyReportLabelDefSchema, t as dailyReportPostedCommentSchema, u as dailyReportSseMessageSchema, v as isDailyReportSseStreamId, w as reportCreateMessageSchema, x as reportDeleteMessageSchema, y as reportPublishMessageSchema, z as reportUpdateMessageSchema, A as statusUpdateMessageSchema } from "./sse-schema-DVIUaiAG.js";
|
|
3
3
|
import "zod";
|
|
4
|
+
declare const DAILY_REPORT_API_ENDPOINTS: Readonly<{
|
|
5
|
+
readonly businessDate: "business-date";
|
|
6
|
+
readonly idsStream: "ids-stream";
|
|
7
|
+
readonly report: "report";
|
|
8
|
+
readonly action: "action";
|
|
9
|
+
}>;
|
|
10
|
+
declare const DAILY_REPORT_API_QUERY_PARAMS: Readonly<{
|
|
11
|
+
readonly businessDate: "businessDate";
|
|
12
|
+
readonly reportHubId: "reportHubId";
|
|
13
|
+
readonly forceRefresh: "forceRefresh";
|
|
14
|
+
readonly cursorReportHubId: "cursor_report_hub_id";
|
|
15
|
+
readonly cursorBusinessDate: "cursor_business_date";
|
|
16
|
+
readonly cursorSnapshot: "cursor_snapshot";
|
|
17
|
+
}>;
|
|
4
18
|
type DailyReportAttachmentThumbnailBox = {
|
|
5
19
|
readonly maxWidth: number;
|
|
6
20
|
readonly maxHeight: number;
|
|
@@ -29,4 +43,5 @@ declare const buildDailyReportAttachmentUrl: (apiBasePath: string, token: string
|
|
|
29
43
|
declare const parseDailyReportAttachmentQuery: (params: URLSearchParams) => DailyReportAttachmentDeliveryRequest | DailyReportAttachmentInvalidQuery;
|
|
30
44
|
type BusinessDateInput = string | Date | null | undefined;
|
|
31
45
|
declare const normalizeBusinessDateKey: (value: BusinessDateInput) => string | null;
|
|
32
|
-
|
|
46
|
+
declare const DAILY_REPORT_CLIENT_TEMP_ID_PATTERN: RegExp;
|
|
47
|
+
export { DAILY_REPORT_API_ENDPOINTS, DAILY_REPORT_API_QUERY_PARAMS, DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS, DAILY_REPORT_CLIENT_TEMP_ID_PATTERN, type DailyReportAttachmentDeliveryRequest, type DailyReportAttachmentInvalidQuery, type DailyReportAttachmentThumbnailBox, type DailyReportAttachmentThumbnailVariant, buildDailyReportAttachmentUrl, isDailyReportAttachmentThumbnailVariant, normalizeBusinessDateKey, parseDailyReportAttachmentQuery };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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});
|
|
1
|
+
"use strict";var I=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var oe=Object.prototype.hasOwnProperty;var ae=(e,n)=>{for(var r in n)I(e,r,{get:n[r],enumerable:!0})},ie=(e,n,r,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of re(n))!oe.call(e,s)&&s!==r&&I(e,s,{get:()=>n[s],enumerable:!(a=ne(n,s))||a.enumerable});return e};var se=e=>ie(I({},"__esModule",{value:!0}),e);var ge={};ae(ge,{DAILY_REPORT_ACTION_FIELDS:()=>p,DAILY_REPORT_ACTION_INTENTS:()=>B,DAILY_REPORT_API_ENDPOINTS:()=>V,DAILY_REPORT_API_QUERY_PARAMS:()=>K,DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS:()=>L,DAILY_REPORT_CLIENT_TEMP_ID_PATTERN:()=>d,DAILY_REPORT_SSE_CURSOR_PARAM:()=>H,DAILY_REPORT_SSE_HEARTBEAT_MS:()=>w,DAILY_REPORT_SSE_TERMINAL_EVENTS:()=>k,buildDailyReportAttachmentUrl:()=>Z,commentAddMessageSchema:()=>x,commentDeleteMessageSchema:()=>_,connectedMessageSchema:()=>f,dailyReportDetailSchema:()=>c,dailyReportExternalCommentSchema:()=>b,dailyReportInterviewerSchema:()=>D,dailyReportLabelDefSchema:()=>A,dailyReportPostedCommentSchema:()=>u,dailyReportSseMessageSchema:()=>j,encodeDailyReportActionCommand:()=>$,isDailyReportAttachmentThumbnailVariant:()=>g,isDailyReportSseStreamId:()=>U,isIdsStreamChunkLine:()=>F,mergeComments:()=>te,normalizeBusinessDateKey:()=>X,parseDailyReportActionResult:()=>z,parseDailyReportAttachmentQuery:()=>G,reportCreateMessageSchema:()=>C,reportDeleteMessageSchema:()=>M,reportPublishMessageSchema:()=>N,reportUpdateMessageSchema:()=>E,statusUpdateMessageSchema:()=>S});module.exports=se(ge);var o=require("zod");var d=/^(?:[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 O=require("zod");var i=O.z.number().int().positive().max(Number.MAX_SAFE_INTEGER);var t=require("zod");var k=["auth-required","forbidden","resync-required"],w=15e3,H="lastEventId",le=/^\d{1,15}-\d{1,15}$/,U=e=>le.test(e),D=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()}),u=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()}),pe=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)}),c=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(D),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(u),attachments:t.z.array(pe).default([])}),m=t.z.string().regex(d),f=t.z.object({type:t.z.literal("connected")}),S=t.z.object({type:t.z.literal("status-update"),reportHubId:i,statusType:t.z.enum(["star","read"]),value:t.z.boolean(),clientTempId:m,recipientRawUserId:i.optional()}),T=t.z.string().optional(),x=t.z.object({type:t.z.literal("comment-add"),reportHubId:i,comment:u,clientTempId:m,recipientRawUserId:i.optional(),sourceType:T}),_=t.z.object({type:t.z.literal("comment-delete"),reportHubId:i,commentId:i,clientTempId:m,recipientRawUserId:i.optional(),sourceType:T}),C=t.z.object({type:t.z.literal("report-create"),reportHubId:i,report:c,clientTempId:m,recipientRawUserId:i.optional()}),E=t.z.object({type:t.z.literal("report-update"),reportHubId:i,report:c,clientTempId:m,recipientRawUserId:i.optional()}),N=t.z.object({type:t.z.literal("report-publish"),reportHubId:i,report:c,clientTempId:m,recipientRawUserId:i.optional()}),M=t.z.object({type:t.z.literal("report-delete"),reportHubId:i,clientTempId:m,sourceType:T}),j=t.z.discriminatedUnion("type",[f,S,x,_,C,E,N,M]);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}},ce=()=>{let e=i,n=o.z.string().regex(d),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:c}),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:c.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:u}),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")})}},P=null,me=()=>(P===null&&(P=ce()),P),z=(e,n)=>{let r=me()[e].safeParse(n);return r.success?{result:r.data}:{mismatch:Y(r.error)}};var v="ids-stream",de=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"},F=e=>de(e)==="chunk";var V=Object.freeze({businessDate:"business-date",idsStream:v,report:"report",action:"action"}),K=Object.freeze({businessDate:"businessDate",reportHubId:"reportHubId",forceRefresh:"forceRefresh",cursorReportHubId:"cursor_report_hub_id",cursorBusinessDate:"cursor_business_date",cursorSnapshot:"cursor_snapshot"});var L=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),g=e=>Object.hasOwn(L,e);var Q="download",q="thumbnail",W="1",Z=(e,n,r)=>{let a=`${e}/attachment/${encodeURIComponent(n)}`;switch(r.kind){case"inline":return a;case"download":return`${a}?${new URLSearchParams({[Q]:W})}`;case"thumbnail":return`${a}?${new URLSearchParams({[q]:r.variant})}`}},G=e=>{let n=e.getAll(q),r=e.getAll(Q);if(n.length>0&&r.length>0)return{kind:"invalid",reason:"conflict"};if(n.length>0){let[a]=n;return n.length===1&&g(a)?{kind:"thumbnail",variant:a}:{kind:"invalid",reason:"thumbnail_variant"}}return r.length>0?r.length===1&&r[0]===W?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var ue=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var J=e=>e<10?`0${e}`:`${e}`,ye=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}`},Re=e=>{let n=ue.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 h=new Date(0);return h.setUTCFullYear(y,l-1,R),h.getUTCFullYear()!==y||h.getUTCMonth()!==l-1||h.getUTCDate()!==R?null:`${r}-${a}-${s}`};var X=e=>e==null?null:e instanceof Date?ye(e):Re(e);var he=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 ${he(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]};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_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
|
-
|
|
1
|
+
import{z as o}from"zod";var u=/^(?:[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 Y}from"zod";var a=Y.number().int().positive().max(Number.MAX_SAFE_INTEGER);import{z as t}from"zod";var B=["auth-required","forbidden","resync-required"],$=15e3,z="lastEventId",v=/^\d{1,15}-\d{1,15}$/,F=e=>v.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()}),f=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()}),V=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)}),c=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(f),postedComments:t.array(y),attachments:t.array(V).default([])}),m=t.string().regex(u),S=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:m,recipientRawUserId:a.optional()}),g=t.string().optional(),x=t.object({type:t.literal("comment-add"),reportHubId:a,comment:y,clientTempId:m,recipientRawUserId:a.optional(),sourceType:g}),_=t.object({type:t.literal("comment-delete"),reportHubId:a,commentId:a,clientTempId:m,recipientRawUserId:a.optional(),sourceType:g}),C=t.object({type:t.literal("report-create"),reportHubId:a,report:c,clientTempId:m,recipientRawUserId:a.optional()}),E=t.object({type:t.literal("report-update"),reportHubId:a,report:c,clientTempId:m,recipientRawUserId:a.optional()}),N=t.object({type:t.literal("report-publish"),reportHubId:a,report:c,clientTempId:m,recipientRawUserId:a.optional()}),M=t.object({type:t.literal("report-delete"),reportHubId:a,clientTempId:m,sourceType:g}),K=t.discriminatedUnion("type",[S,T,x,_,C,E,N,M]);var P=e=>e.issues.map(n=>`${n.path.length===0?"(root)":n.path.join(".")}: ${n.code}`).join("; ");var Q=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 n=new FormData;if(n.append(l.intent,e.intent),e.intent==="clearCache"||(n.append(l.clientTempId,e.clientTempId),e.businessDate!==null&&n.append(l.businessDate,e.businessDate),e.operationTimestamp!==null&&n.append(l.operationTimestamp,String(e.operationTimestamp)),e.intent==="create"))return n;switch(n.append(l.reportHubId,String(e.reportHubId)),e.intent){case"update":return e.changes.title!==void 0&&n.append(l.title,e.changes.title),e.changes.content!==void 0&&n.append(l.content,e.changes.content),n;case"publish":case"delete":return n;case"toggleStar":return n.append(l.isStarred,String(e.value)),n;case"toggleRead":return n.append(l.isRead,String(e.value)),n;case"addComment":return n.append(l.content,e.content),n;case"deleteComment":return n.append(l.commentId,String(e.commentId)),n}},W=()=>{let e=a,n=o.string().regex(u),r=o.literal("OK"),i=o.object({isStarred:o.boolean(),isRead:o.boolean()}),p=o.number().int().nonnegative().nullable();return{create:o.object({status:r,intent:o.literal("create"),reportHubId:e,clientTempId:n,report:c}),update:o.object({status:r,intent:o.literal("update"),reportHubId:e,clientTempId:n}),publish:o.object({status:r,intent:o.literal("publish"),reportHubId:e,clientTempId:n,report:c.nullable()}),delete:o.object({status:r,intent:o.literal("delete"),reportHubId:e,clientTempId:n}),toggleStar:o.object({status:r,intent:o.literal("toggleStar"),reportHubId:e,clientTempId:n,updatedStatus:i,operationTimestamp:p}),toggleRead:o.object({status:r,intent:o.literal("toggleRead"),reportHubId:e,clientTempId:n,updatedStatus:i,operationTimestamp:p}),addComment:o.object({status:r,intent:o.literal("addComment"),reportHubId:e,clientTempId:n,newComment:y}),deleteComment:o.object({status:r,intent:o.literal("deleteComment"),reportHubId:e,clientTempId:n,deletedCommentId:a}),clearCache:o.object({status:r,intent:o.literal("clearCache")})}},I=null,Z=()=>(I===null&&(I=W()),I),G=(e,n)=>{let r=Z()[e].safeParse(n);return r.success?{result:r.data}:{mismatch:P(r.error)}};var L="ids-stream",J=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"},X=e=>J(e)==="chunk";var ee=Object.freeze({businessDate:"business-date",idsStream:L,report:"report",action:"action"}),te=Object.freeze({businessDate:"businessDate",reportHubId:"reportHubId",forceRefresh:"forceRefresh",cursorReportHubId:"cursor_report_hub_id",cursorBusinessDate:"cursor_business_date",cursorSnapshot:"cursor_snapshot"});var O=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),D=e=>Object.hasOwn(O,e);var k="download",w="thumbnail",H="1",ne=(e,n,r)=>{let i=`${e}/attachment/${encodeURIComponent(n)}`;switch(r.kind){case"inline":return i;case"download":return`${i}?${new URLSearchParams({[k]:H})}`;case"thumbnail":return`${i}?${new URLSearchParams({[w]:r.variant})}`}},re=e=>{let n=e.getAll(w),r=e.getAll(k);if(n.length>0&&r.length>0)return{kind:"invalid",reason:"conflict"};if(n.length>0){let[i]=n;return n.length===1&&D(i)?{kind:"thumbnail",variant:i}:{kind:"invalid",reason:"thumbnail_variant"}}return r.length>0?r.length===1&&r[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 n=e.getFullYear(),r=U(e.getMonth()+1),i=U(e.getDate());return`${n}-${r}-${i}`},ie=e=>{let n=oe.exec(e);if(n===null)return null;let[,r,,i,p]=n,d=Number(r),s=Number(i),R=Number(p);if(d<1)return null;let h=new Date(0);return h.setUTCFullYear(d,s-1,R),h.getUTCFullYear()!==d||h.getUTCMonth()!==s-1||h.getUTCDate()!==R?null:`${r}-${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,j=(e,n,r)=>new RangeError(`[daily-report] ${e} must be ${n}; got ${le(r)}`);var pe=(e,n,r,i)=>{if(typeof i!="string"||i.trim()==="")throw j("mergeComments: unknownAuthorName","a non-blank string",i);let p=e.map((s,R)=>({id:`legacy-${R}`,authorName:s.name||i,content:s.text||"",isMine:!1,color:s.color||void 0,isLegacy:!0})),d=n.map(s=>({id:s.id,authorName:s.userName||i,content:s.content??"",createdAt:s.createdAt??"",isMine:r?s.userId===r:s.isMine,isLegacy:!1}));return[...p,...d]};export{l as DAILY_REPORT_ACTION_FIELDS,Q as DAILY_REPORT_ACTION_INTENTS,ee as DAILY_REPORT_API_ENDPOINTS,te as DAILY_REPORT_API_QUERY_PARAMS,O as DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,u as DAILY_REPORT_CLIENT_TEMP_ID_PATTERN,z as DAILY_REPORT_SSE_CURSOR_PARAM,$ as DAILY_REPORT_SSE_HEARTBEAT_MS,B as DAILY_REPORT_SSE_TERMINAL_EVENTS,ne as buildDailyReportAttachmentUrl,x as commentAddMessageSchema,_ as commentDeleteMessageSchema,S as connectedMessageSchema,c as dailyReportDetailSchema,A as dailyReportExternalCommentSchema,b as dailyReportInterviewerSchema,f as dailyReportLabelDefSchema,y as dailyReportPostedCommentSchema,K as dailyReportSseMessageSchema,q as encodeDailyReportActionCommand,D as isDailyReportAttachmentThumbnailVariant,F as isDailyReportSseStreamId,X as isIdsStreamChunkLine,pe as mergeComments,se as normalizeBusinessDateKey,G as parseDailyReportActionResult,re as parseDailyReportAttachmentQuery,C as reportCreateMessageSchema,M as reportDeleteMessageSchema,N as reportPublishMessageSchema,E as reportUpdateMessageSchema,T as statusUpdateMessageSchema};
|
package/dist/server.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { c as DailyReportSseMessage, j as DailyReportInterviewer, i as DailyReportExternalComment, D as DailyReportItem, d as DailyReportDetail, h as DailyReportAttachmentSummary, l as DailyReportPostedComment } from "./sse-schema-DVIUaiAG.mjs";
|
|
1
2
|
import * as drizzle_orm_mssql_core from "drizzle-orm/mssql-core";
|
|
2
3
|
import { AnyMsSqlColumn } from "drizzle-orm/mssql-core";
|
|
3
|
-
import { e as DailyReportInterviewer, d as DailyReportExternalComment, D as DailyReportItem, b as DailyReportDetail, c as DailyReportAttachmentSummary, g as DailyReportPostedComment } from "./types-DkERw8NE.mjs";
|
|
4
4
|
import { TransactionRetryOptions } from "@aiquants/mssql";
|
|
5
|
+
import "zod";
|
|
5
6
|
type RedisStreamMessage = {
|
|
6
7
|
id: string;
|
|
7
8
|
message: Record<string, string>;
|
|
@@ -36,9 +37,14 @@ type DailyReportRedisProvider = {
|
|
|
36
37
|
getClient(): Promise<DailyReportRedisClient | undefined>;
|
|
37
38
|
createClient(): Promise<DailyReportRedisBlockingClient | undefined>;
|
|
38
39
|
};
|
|
40
|
+
type DailyReportSseEntryMessage = {
|
|
41
|
+
readonly parsed: DailyReportSseMessage;
|
|
42
|
+
readonly published: Readonly<Record<string, unknown>>;
|
|
43
|
+
readonly text: string;
|
|
44
|
+
};
|
|
39
45
|
type StreamEntry = {
|
|
40
|
-
id: string;
|
|
41
|
-
message:
|
|
46
|
+
readonly id: string;
|
|
47
|
+
readonly message: DailyReportSseEntryMessage | null;
|
|
42
48
|
};
|
|
43
49
|
type DailyReportSseReaderPort = {
|
|
44
50
|
ready(): Promise<void>;
|
|
@@ -141,10 +147,14 @@ declare class SqlResultCache {
|
|
|
141
147
|
private readonly epochStore;
|
|
142
148
|
private readonly buckets;
|
|
143
149
|
private readonly inFlight;
|
|
150
|
+
private readonly forcedFetches;
|
|
144
151
|
constructor(config: {
|
|
145
152
|
defaultTtlMs: number;
|
|
146
153
|
}, epochStore: EpochStore);
|
|
147
154
|
private maybeRefreshAhead;
|
|
155
|
+
private startFetch;
|
|
156
|
+
private forcedFetch;
|
|
157
|
+
private runForcedFetch;
|
|
148
158
|
getOrFetch: <T>(opts: {
|
|
149
159
|
cacheKey: string;
|
|
150
160
|
fetcher: () => Promise<readonly T[]>;
|
|
@@ -178,6 +188,11 @@ type DailyReportExternalSource = {
|
|
|
178
188
|
mapRow: (row: Record<string, unknown>) => ExternalReportFields;
|
|
179
189
|
};
|
|
180
190
|
declare const transformJsonArray: <TRaw, TResult>(payload: string | null, label: string, mapper: (raw: TRaw) => TResult | null, logger?: DailyReportLogger) => TResult[];
|
|
191
|
+
declare const CLIENT_TEMP_ID_BRAND: unique symbol;
|
|
192
|
+
type DailyReportClientTempId = string & {
|
|
193
|
+
readonly [CLIENT_TEMP_ID_BRAND]: true;
|
|
194
|
+
};
|
|
195
|
+
declare const parseClientTempId: (raw: string | null) => DailyReportClientTempId | null;
|
|
181
196
|
type ResourceRouteArgs = {
|
|
182
197
|
request: Request;
|
|
183
198
|
params: Record<string, string | undefined>;
|
|
@@ -1599,17 +1614,17 @@ declare function createDailyReportService(config: DailyReportServiceConfig): {
|
|
|
1599
1614
|
} | null>;
|
|
1600
1615
|
markAttachmentMissing: (attachmentId: number) => Promise<void>;
|
|
1601
1616
|
markAttachmentPresent: (attachmentId: number) => Promise<void>;
|
|
1602
|
-
setStarStatus: (scope: DailyReportViewerScope, userId: number, reportHubId: number, businessDate: string | null, isStarred: boolean, clientTempId:
|
|
1603
|
-
setReadStatus: (scope: DailyReportViewerScope, userId: number, reportHubId: number, businessDate: string | null, isRead: boolean, clientTempId:
|
|
1604
|
-
addComment: (scope: DailyReportViewerScope, userId: number, reportHubId: number, content: string, businessDate: string | null, clientTempId:
|
|
1605
|
-
deleteComment: (scope: DailyReportViewerScope, userId: number, reportHubId: number, commentId: number, businessDate: string | null, clientTempId:
|
|
1606
|
-
createDailyReport: (userId: number, businessDate: string, clientTempId:
|
|
1617
|
+
setStarStatus: (scope: DailyReportViewerScope, userId: number, reportHubId: number, businessDate: string | null, isStarred: boolean, clientTempId: DailyReportClientTempId) => Promise<DailyReportUserStatusRow>;
|
|
1618
|
+
setReadStatus: (scope: DailyReportViewerScope, userId: number, reportHubId: number, businessDate: string | null, isRead: boolean, clientTempId: DailyReportClientTempId) => Promise<DailyReportUserStatusRow>;
|
|
1619
|
+
addComment: (scope: DailyReportViewerScope, userId: number, reportHubId: number, content: string, businessDate: string | null, clientTempId: DailyReportClientTempId) => Promise<DailyReportPostedComment>;
|
|
1620
|
+
deleteComment: (scope: DailyReportViewerScope, userId: number, reportHubId: number, commentId: number, businessDate: string | null, clientTempId: DailyReportClientTempId) => Promise<void>;
|
|
1621
|
+
createDailyReport: (userId: number, businessDate: string, clientTempId: DailyReportClientTempId) => Promise<DailyReportDetail>;
|
|
1607
1622
|
updateDailyReport: (reportHubId: number, userId: number, data: {
|
|
1608
1623
|
title?: string;
|
|
1609
1624
|
content?: string;
|
|
1610
|
-
}, clientTempId:
|
|
1611
|
-
publishDailyReport: (reportHubId: number, userId: number, clientTempId:
|
|
1612
|
-
deleteDailyReport: (reportHubId: number, userId: number, clientTempId:
|
|
1625
|
+
}, clientTempId: DailyReportClientTempId) => Promise<void>;
|
|
1626
|
+
publishDailyReport: (reportHubId: number, userId: number, clientTempId: DailyReportClientTempId) => Promise<DailyReportDetail | null>;
|
|
1627
|
+
deleteDailyReport: (reportHubId: number, userId: number, clientTempId: DailyReportClientTempId) => Promise<void>;
|
|
1613
1628
|
findDailyReportHubById: (tx: DailyReportDb, reportHubId: number) => Promise<DailyReportHubRow[]>;
|
|
1614
1629
|
updateDailyReportHub: (tx: DailyReportDb, reportHubId: number, data: Partial<DailyReportHubRow>) => Promise<void>;
|
|
1615
1630
|
updateDailyReportInternal: (tx: DailyReportDb, hubId: number, data: Partial<DailyReportInternalRow>) => Promise<void>;
|
|
@@ -1677,7 +1692,7 @@ declare class DailyReportSseReader implements DailyReportSseReaderPort {
|
|
|
1677
1692
|
private _invalidateCaches;
|
|
1678
1693
|
}
|
|
1679
1694
|
declare const generateETag: (data: unknown) => string;
|
|
1680
|
-
declare const jsonResponseWithETag: (request: Request, cookie: string | null, payload: Record<string, unknown>, status?: number
|
|
1695
|
+
declare const jsonResponseWithETag: (request: Request, cookie: string | null, payload: Record<string, unknown>, status?: number) => Response;
|
|
1681
1696
|
type SharpHeaderLike = {
|
|
1682
1697
|
width: number;
|
|
1683
1698
|
height: number;
|
|
@@ -1771,7 +1786,11 @@ declare const DAILY_REPORT_SHARP_THUMBNAIL_DECODE_WORK_MODEL: Readonly<{
|
|
|
1771
1786
|
declare const predictSharpThumbnailWorkingSetBytes: (source: Uint8Array, format: DailyReportAttachmentThumbnailSourceFormat, header: SharpHeaderLike) => number | null;
|
|
1772
1787
|
declare const createSharpThumbnailRenderer: (sharp: SharpLike) => DailyReportAttachmentThumbnailRenderer;
|
|
1773
1788
|
declare const DAILY_REPORT_SSE_VISIBILITY_REFRESH_MS = 60000;
|
|
1774
|
-
declare const DAILY_REPORT_SSE_CATCH_UP_BATCH
|
|
1789
|
+
declare const DAILY_REPORT_SSE_CATCH_UP_BATCH: number;
|
|
1790
|
+
declare const readSseStreamEntry: (raw: RedisStreamMessage, logger: DailyReportLogger) => {
|
|
1791
|
+
readonly entry: StreamEntry;
|
|
1792
|
+
readonly json: unknown;
|
|
1793
|
+
};
|
|
1775
1794
|
type DailyReportServerConfig = Omit<DailyReportServiceConfig, "cache" | "epochs"> & {
|
|
1776
1795
|
authenticate: DailyReportAuthenticate;
|
|
1777
1796
|
resolveVisibleSourceTypes?: DailyReportResolveVisibleSourceTypes;
|
|
@@ -1789,4 +1808,4 @@ type DailyReportServer = DailyReportHandlers & {
|
|
|
1789
1808
|
knownSourceTypes: readonly string[];
|
|
1790
1809
|
};
|
|
1791
1810
|
declare function createDailyReportServer(config: DailyReportServerConfig): DailyReportServer;
|
|
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 };
|
|
1811
|
+
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 DailyReportClientTempId, 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, parseClientTempId, predictSharpThumbnailWorkingSetBytes, readSseStreamEntry as readDailyReportSseStreamEntry, transformJsonArray };
|