@aiquants/daily-report 0.33.0 → 0.35.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.
@@ -0,0 +1,172 @@
1
+ import { d as DailyReportDetail, m as DailyReportPostedComment, D as DailyReportItem, j as DailyReportExternalComment } from "./sse-schema-getLS62T.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 ActionCommand<ClientTempId extends string = string> = {
27
+ readonly intent: "clearCache";
28
+ } | {
29
+ readonly intent: "create";
30
+ readonly clientTempId: ClientTempId;
31
+ readonly businessDate: string;
32
+ readonly operationTimestamp: number | null;
33
+ } | {
34
+ readonly intent: "update";
35
+ readonly clientTempId: ClientTempId;
36
+ readonly businessDate: string | null;
37
+ readonly operationTimestamp: number | null;
38
+ readonly reportHubId: number;
39
+ readonly changes: {
40
+ readonly title?: string;
41
+ readonly content?: string;
42
+ };
43
+ } | {
44
+ readonly intent: "publish" | "delete";
45
+ readonly clientTempId: ClientTempId;
46
+ readonly businessDate: string | null;
47
+ readonly operationTimestamp: number | null;
48
+ readonly reportHubId: number;
49
+ } | {
50
+ readonly intent: "toggleStar" | "toggleRead";
51
+ readonly clientTempId: ClientTempId;
52
+ readonly businessDate: string | null;
53
+ readonly operationTimestamp: number | null;
54
+ readonly reportHubId: number;
55
+ readonly value: boolean;
56
+ } | {
57
+ readonly intent: "addComment";
58
+ readonly clientTempId: ClientTempId;
59
+ readonly businessDate: string | null;
60
+ readonly operationTimestamp: number | null;
61
+ readonly reportHubId: number;
62
+ readonly content: string;
63
+ } | {
64
+ readonly intent: "deleteComment";
65
+ readonly clientTempId: ClientTempId;
66
+ readonly businessDate: string | null;
67
+ readonly operationTimestamp: number | null;
68
+ readonly reportHubId: number;
69
+ readonly commentId: number;
70
+ };
71
+ declare const encodeActionCommand: (command: ActionCommand) => FormData;
72
+ type ActionResult = {
73
+ readonly status: "OK";
74
+ readonly intent: "create";
75
+ readonly reportHubId: number;
76
+ readonly clientTempId: string;
77
+ readonly report: DailyReportDetail;
78
+ } | {
79
+ readonly status: "OK";
80
+ readonly intent: "update";
81
+ readonly reportHubId: number;
82
+ readonly clientTempId: string;
83
+ } | {
84
+ readonly status: "OK";
85
+ readonly intent: "publish";
86
+ readonly reportHubId: number;
87
+ readonly clientTempId: string;
88
+ readonly report: DailyReportDetail | null;
89
+ } | {
90
+ readonly status: "OK";
91
+ readonly intent: "delete";
92
+ readonly reportHubId: number;
93
+ readonly clientTempId: string;
94
+ } | {
95
+ readonly status: "OK";
96
+ readonly intent: "toggleStar";
97
+ readonly reportHubId: number;
98
+ readonly clientTempId: string;
99
+ readonly updatedStatus: {
100
+ readonly isStarred: boolean;
101
+ readonly isRead: boolean;
102
+ };
103
+ readonly operationTimestamp: number | null;
104
+ } | {
105
+ readonly status: "OK";
106
+ readonly intent: "toggleRead";
107
+ readonly reportHubId: number;
108
+ readonly clientTempId: string;
109
+ readonly updatedStatus: {
110
+ readonly isStarred: boolean;
111
+ readonly isRead: boolean;
112
+ };
113
+ readonly operationTimestamp: number | null;
114
+ } | {
115
+ readonly status: "OK";
116
+ readonly intent: "addComment";
117
+ readonly reportHubId: number;
118
+ readonly clientTempId: string;
119
+ readonly newComment: DailyReportPostedComment;
120
+ } | {
121
+ readonly status: "OK";
122
+ readonly intent: "deleteComment";
123
+ readonly reportHubId: number;
124
+ readonly clientTempId: string;
125
+ readonly deletedCommentId: number;
126
+ } | {
127
+ readonly status: "OK";
128
+ readonly intent: "clearCache";
129
+ };
130
+ type ActionResultOf<Intent extends DailyReportActionIntent> = Extract<ActionResult, {
131
+ readonly intent: Intent;
132
+ }>;
133
+ type ActionFailure = {
134
+ readonly error: string;
135
+ };
136
+ type ActionResultReading<Intent extends DailyReportActionIntent> = {
137
+ readonly result: ActionResultOf<Intent>;
138
+ } | {
139
+ readonly mismatch: string;
140
+ };
141
+ declare const parseActionResult: <Intent extends DailyReportActionIntent>(intent: Intent, json: unknown) => ActionResultReading<Intent>;
142
+ type DailyReportIdsStreamCursor = {
143
+ businessDate: string | null;
144
+ reportHubId: number;
145
+ };
146
+ type DailyReportIdsStreamChunkLine = {
147
+ kind: "chunk";
148
+ items: DailyReportItem[];
149
+ nextCursor: DailyReportIdsStreamCursor | null;
150
+ isLast: boolean;
151
+ total?: number;
152
+ provisional?: boolean;
153
+ snapshot?: string;
154
+ restarted?: boolean;
155
+ streamAnchor?: string | null;
156
+ };
157
+ type DailyReportSseStreamAnchor = {
158
+ readonly lastEventId: string | null;
159
+ readonly revision: number;
160
+ };
161
+ declare const isIdsStreamChunkLine: (line: unknown) => line is DailyReportIdsStreamChunkLine;
162
+ type UIComment = {
163
+ id: string | number;
164
+ authorName: string;
165
+ content: string;
166
+ createdAt?: string;
167
+ isMine: boolean;
168
+ color?: string;
169
+ isLegacy: boolean;
170
+ };
171
+ declare const mergeComments: (legacyComments: DailyReportExternalComment[], modernComments: DailyReportPostedComment[], currentUserId: string | null | undefined, unknownAuthorName: string) => UIComment[];
172
+ export { type ActionCommand as A, type DailyReportActionIntent as D, type UIComment as U, type DailyReportSseStreamAnchor as a, DAILY_REPORT_ACTION_FIELDS as b, DAILY_REPORT_ACTION_INTENTS as c, type ActionFailure as d, type ActionResult as e, type ActionResultOf as f, type ActionResultReading as g, type DailyReportIdsStreamChunkLine as h, type DailyReportIdsStreamCursor as i, encodeActionCommand as j, isIdsStreamChunkLine as k, mergeComments as m, parseActionResult as p };
@@ -0,0 +1,172 @@
1
+ import { d as DailyReportDetail, m as DailyReportPostedComment, D as DailyReportItem, j as DailyReportExternalComment } from "./sse-schema-getLS62T.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 ActionCommand<ClientTempId extends string = string> = {
27
+ readonly intent: "clearCache";
28
+ } | {
29
+ readonly intent: "create";
30
+ readonly clientTempId: ClientTempId;
31
+ readonly businessDate: string;
32
+ readonly operationTimestamp: number | null;
33
+ } | {
34
+ readonly intent: "update";
35
+ readonly clientTempId: ClientTempId;
36
+ readonly businessDate: string | null;
37
+ readonly operationTimestamp: number | null;
38
+ readonly reportHubId: number;
39
+ readonly changes: {
40
+ readonly title?: string;
41
+ readonly content?: string;
42
+ };
43
+ } | {
44
+ readonly intent: "publish" | "delete";
45
+ readonly clientTempId: ClientTempId;
46
+ readonly businessDate: string | null;
47
+ readonly operationTimestamp: number | null;
48
+ readonly reportHubId: number;
49
+ } | {
50
+ readonly intent: "toggleStar" | "toggleRead";
51
+ readonly clientTempId: ClientTempId;
52
+ readonly businessDate: string | null;
53
+ readonly operationTimestamp: number | null;
54
+ readonly reportHubId: number;
55
+ readonly value: boolean;
56
+ } | {
57
+ readonly intent: "addComment";
58
+ readonly clientTempId: ClientTempId;
59
+ readonly businessDate: string | null;
60
+ readonly operationTimestamp: number | null;
61
+ readonly reportHubId: number;
62
+ readonly content: string;
63
+ } | {
64
+ readonly intent: "deleteComment";
65
+ readonly clientTempId: ClientTempId;
66
+ readonly businessDate: string | null;
67
+ readonly operationTimestamp: number | null;
68
+ readonly reportHubId: number;
69
+ readonly commentId: number;
70
+ };
71
+ declare const encodeActionCommand: (command: ActionCommand) => FormData;
72
+ type ActionResult = {
73
+ readonly status: "OK";
74
+ readonly intent: "create";
75
+ readonly reportHubId: number;
76
+ readonly clientTempId: string;
77
+ readonly report: DailyReportDetail;
78
+ } | {
79
+ readonly status: "OK";
80
+ readonly intent: "update";
81
+ readonly reportHubId: number;
82
+ readonly clientTempId: string;
83
+ } | {
84
+ readonly status: "OK";
85
+ readonly intent: "publish";
86
+ readonly reportHubId: number;
87
+ readonly clientTempId: string;
88
+ readonly report: DailyReportDetail | null;
89
+ } | {
90
+ readonly status: "OK";
91
+ readonly intent: "delete";
92
+ readonly reportHubId: number;
93
+ readonly clientTempId: string;
94
+ } | {
95
+ readonly status: "OK";
96
+ readonly intent: "toggleStar";
97
+ readonly reportHubId: number;
98
+ readonly clientTempId: string;
99
+ readonly updatedStatus: {
100
+ readonly isStarred: boolean;
101
+ readonly isRead: boolean;
102
+ };
103
+ readonly operationTimestamp: number | null;
104
+ } | {
105
+ readonly status: "OK";
106
+ readonly intent: "toggleRead";
107
+ readonly reportHubId: number;
108
+ readonly clientTempId: string;
109
+ readonly updatedStatus: {
110
+ readonly isStarred: boolean;
111
+ readonly isRead: boolean;
112
+ };
113
+ readonly operationTimestamp: number | null;
114
+ } | {
115
+ readonly status: "OK";
116
+ readonly intent: "addComment";
117
+ readonly reportHubId: number;
118
+ readonly clientTempId: string;
119
+ readonly newComment: DailyReportPostedComment;
120
+ } | {
121
+ readonly status: "OK";
122
+ readonly intent: "deleteComment";
123
+ readonly reportHubId: number;
124
+ readonly clientTempId: string;
125
+ readonly deletedCommentId: number;
126
+ } | {
127
+ readonly status: "OK";
128
+ readonly intent: "clearCache";
129
+ };
130
+ type ActionResultOf<Intent extends DailyReportActionIntent> = Extract<ActionResult, {
131
+ readonly intent: Intent;
132
+ }>;
133
+ type ActionFailure = {
134
+ readonly error: string;
135
+ };
136
+ type ActionResultReading<Intent extends DailyReportActionIntent> = {
137
+ readonly result: ActionResultOf<Intent>;
138
+ } | {
139
+ readonly mismatch: string;
140
+ };
141
+ declare const parseActionResult: <Intent extends DailyReportActionIntent>(intent: Intent, json: unknown) => ActionResultReading<Intent>;
142
+ type DailyReportIdsStreamCursor = {
143
+ businessDate: string | null;
144
+ reportHubId: number;
145
+ };
146
+ type DailyReportIdsStreamChunkLine = {
147
+ kind: "chunk";
148
+ items: DailyReportItem[];
149
+ nextCursor: DailyReportIdsStreamCursor | null;
150
+ isLast: boolean;
151
+ total?: number;
152
+ provisional?: boolean;
153
+ snapshot?: string;
154
+ restarted?: boolean;
155
+ streamAnchor?: string | null;
156
+ };
157
+ type DailyReportSseStreamAnchor = {
158
+ readonly lastEventId: string | null;
159
+ readonly revision: number;
160
+ };
161
+ declare const isIdsStreamChunkLine: (line: unknown) => line is DailyReportIdsStreamChunkLine;
162
+ type UIComment = {
163
+ id: string | number;
164
+ authorName: string;
165
+ content: string;
166
+ createdAt?: string;
167
+ isMine: boolean;
168
+ color?: string;
169
+ isLegacy: boolean;
170
+ };
171
+ declare const mergeComments: (legacyComments: DailyReportExternalComment[], modernComments: DailyReportPostedComment[], currentUserId: string | null | undefined, unknownAuthorName: string) => UIComment[];
172
+ export { type ActionCommand as A, type DailyReportActionIntent as D, type UIComment as U, type DailyReportSseStreamAnchor as a, DAILY_REPORT_ACTION_FIELDS as b, DAILY_REPORT_ACTION_INTENTS as c, type ActionFailure as d, type ActionResult as e, type ActionResultOf as f, type ActionResultReading as g, type DailyReportIdsStreamChunkLine as h, type DailyReportIdsStreamCursor as i, encodeActionCommand as j, isIdsStreamChunkLine as k, mergeComments as m, parseActionResult as p };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,26 @@
1
- export { a as DailyReportIdsStreamChunkLine, D as DailyReportSseStreamAnchor, i as isIdsStreamChunkLine, m as mergeComments } from "./ids-stream-CyK2upgD.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-DcOgQr_O.mjs";
1
+ export { b as DAILY_REPORT_ACTION_FIELDS, c as DAILY_REPORT_ACTION_INTENTS, A as DailyReportActionCommand, d as DailyReportActionFailure, D as DailyReportActionIntent, e as DailyReportActionResult, f as DailyReportActionResultOf, g as DailyReportActionResultReading, h as DailyReportIdsStreamChunkLine, i as DailyReportIdsStreamCursor, a as DailyReportSseStreamAnchor, U as DailyReportUIComment, j as encodeDailyReportActionCommand, k as isIdsStreamChunkLine, m as mergeComments, p as parseDailyReportActionResult } from "./comment-adapter-ChA4KOE1.mjs";
2
+ export { D as DAILY_REPORT_SEARCH_COMBINES, a as DailyReportLogger, b as DailyReportSearchCombine, c as DailyReportSearchHit } from "./logger-BaxnzF-0.mjs";
3
+ export { e as DAILY_REPORT_SSE_CURSOR_PARAM, f as DAILY_REPORT_SSE_HEARTBEAT_MS, g as DAILY_REPORT_SSE_TERMINAL_EVENTS, h as DailyReportAttachmentState, i as DailyReportAttachmentSummary, d as DailyReportDetail, j as DailyReportExternalComment, k as DailyReportInterviewer, D as DailyReportItem, l as DailyReportLabelDef, m as DailyReportPostedComment, c as DailyReportSseMessage, b as DailyReportSseTerminalEvent, a as DailyReportUser, n as commentAddMessageSchema, o as commentDeleteMessageSchema, p as connectedMessageSchema, q as dailyReportDetailSchema, r as dailyReportExternalCommentSchema, s as dailyReportInterviewerSchema, t as dailyReportLabelDefSchema, u as dailyReportPostedCommentSchema, v as dailyReportSseMessageSchema, w as isDailyReportSseStreamId, x as reportCreateMessageSchema, y as reportDeleteMessageSchema, z as reportPublishMessageSchema, A as reportUpdateMessageSchema, B as statusUpdateMessageSchema } from "./sse-schema-getLS62T.mjs";
3
4
  import "zod";
5
+ declare const DAILY_REPORT_API_ENDPOINTS: Readonly<{
6
+ readonly businessDate: "business-date";
7
+ readonly idsStream: "ids-stream";
8
+ readonly report: "report";
9
+ readonly search: "search";
10
+ readonly reports: "reports";
11
+ readonly action: "action";
12
+ }>;
13
+ declare const DAILY_REPORT_API_QUERY_PARAMS: Readonly<{
14
+ readonly businessDate: "businessDate";
15
+ readonly reportHubId: "reportHubId";
16
+ readonly searchQuery: "q";
17
+ readonly searchCombine: "combine";
18
+ readonly reportIds: "ids";
19
+ readonly forceRefresh: "forceRefresh";
20
+ readonly cursorReportHubId: "cursor_report_hub_id";
21
+ readonly cursorBusinessDate: "cursor_business_date";
22
+ readonly cursorSnapshot: "cursor_snapshot";
23
+ }>;
4
24
  type DailyReportAttachmentThumbnailBox = {
5
25
  readonly maxWidth: number;
6
26
  readonly maxHeight: number;
@@ -29,4 +49,5 @@ declare const buildDailyReportAttachmentUrl: (apiBasePath: string, token: string
29
49
  declare const parseDailyReportAttachmentQuery: (params: URLSearchParams) => DailyReportAttachmentDeliveryRequest | DailyReportAttachmentInvalidQuery;
30
50
  type BusinessDateInput = string | Date | null | undefined;
31
51
  declare const normalizeBusinessDateKey: (value: BusinessDateInput) => string | null;
32
- export { DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS, type DailyReportAttachmentDeliveryRequest, type DailyReportAttachmentInvalidQuery, type DailyReportAttachmentThumbnailBox, type DailyReportAttachmentThumbnailVariant, buildDailyReportAttachmentUrl, isDailyReportAttachmentThumbnailVariant, normalizeBusinessDateKey, parseDailyReportAttachmentQuery };
52
+ declare const DAILY_REPORT_CLIENT_TEMP_ID_PATTERN: RegExp;
53
+ 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, type BusinessDateInput as DailyReportBusinessDateInput, buildDailyReportAttachmentUrl, isDailyReportAttachmentThumbnailVariant, normalizeBusinessDateKey, parseDailyReportAttachmentQuery };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,26 @@
1
- export { a as DailyReportIdsStreamChunkLine, D as DailyReportSseStreamAnchor, i as isIdsStreamChunkLine, m as mergeComments } from "./ids-stream-CtlszCHr.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-DcOgQr_O.js";
1
+ export { b as DAILY_REPORT_ACTION_FIELDS, c as DAILY_REPORT_ACTION_INTENTS, A as DailyReportActionCommand, d as DailyReportActionFailure, D as DailyReportActionIntent, e as DailyReportActionResult, f as DailyReportActionResultOf, g as DailyReportActionResultReading, h as DailyReportIdsStreamChunkLine, i as DailyReportIdsStreamCursor, a as DailyReportSseStreamAnchor, U as DailyReportUIComment, j as encodeDailyReportActionCommand, k as isIdsStreamChunkLine, m as mergeComments, p as parseDailyReportActionResult } from "./comment-adapter-DqBqtqfA.js";
2
+ export { D as DAILY_REPORT_SEARCH_COMBINES, a as DailyReportLogger, b as DailyReportSearchCombine, c as DailyReportSearchHit } from "./logger-BaxnzF-0.js";
3
+ export { e as DAILY_REPORT_SSE_CURSOR_PARAM, f as DAILY_REPORT_SSE_HEARTBEAT_MS, g as DAILY_REPORT_SSE_TERMINAL_EVENTS, h as DailyReportAttachmentState, i as DailyReportAttachmentSummary, d as DailyReportDetail, j as DailyReportExternalComment, k as DailyReportInterviewer, D as DailyReportItem, l as DailyReportLabelDef, m as DailyReportPostedComment, c as DailyReportSseMessage, b as DailyReportSseTerminalEvent, a as DailyReportUser, n as commentAddMessageSchema, o as commentDeleteMessageSchema, p as connectedMessageSchema, q as dailyReportDetailSchema, r as dailyReportExternalCommentSchema, s as dailyReportInterviewerSchema, t as dailyReportLabelDefSchema, u as dailyReportPostedCommentSchema, v as dailyReportSseMessageSchema, w as isDailyReportSseStreamId, x as reportCreateMessageSchema, y as reportDeleteMessageSchema, z as reportPublishMessageSchema, A as reportUpdateMessageSchema, B as statusUpdateMessageSchema } from "./sse-schema-getLS62T.js";
3
4
  import "zod";
5
+ declare const DAILY_REPORT_API_ENDPOINTS: Readonly<{
6
+ readonly businessDate: "business-date";
7
+ readonly idsStream: "ids-stream";
8
+ readonly report: "report";
9
+ readonly search: "search";
10
+ readonly reports: "reports";
11
+ readonly action: "action";
12
+ }>;
13
+ declare const DAILY_REPORT_API_QUERY_PARAMS: Readonly<{
14
+ readonly businessDate: "businessDate";
15
+ readonly reportHubId: "reportHubId";
16
+ readonly searchQuery: "q";
17
+ readonly searchCombine: "combine";
18
+ readonly reportIds: "ids";
19
+ readonly forceRefresh: "forceRefresh";
20
+ readonly cursorReportHubId: "cursor_report_hub_id";
21
+ readonly cursorBusinessDate: "cursor_business_date";
22
+ readonly cursorSnapshot: "cursor_snapshot";
23
+ }>;
4
24
  type DailyReportAttachmentThumbnailBox = {
5
25
  readonly maxWidth: number;
6
26
  readonly maxHeight: number;
@@ -29,4 +49,5 @@ declare const buildDailyReportAttachmentUrl: (apiBasePath: string, token: string
29
49
  declare const parseDailyReportAttachmentQuery: (params: URLSearchParams) => DailyReportAttachmentDeliveryRequest | DailyReportAttachmentInvalidQuery;
30
50
  type BusinessDateInput = string | Date | null | undefined;
31
51
  declare const normalizeBusinessDateKey: (value: BusinessDateInput) => string | null;
32
- export { DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS, type DailyReportAttachmentDeliveryRequest, type DailyReportAttachmentInvalidQuery, type DailyReportAttachmentThumbnailBox, type DailyReportAttachmentThumbnailVariant, buildDailyReportAttachmentUrl, isDailyReportAttachmentThumbnailVariant, normalizeBusinessDateKey, parseDailyReportAttachmentQuery };
52
+ declare const DAILY_REPORT_CLIENT_TEMP_ID_PATTERN: RegExp;
53
+ 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, type BusinessDateInput as DailyReportBusinessDateInput, buildDailyReportAttachmentUrl, isDailyReportAttachmentThumbnailVariant, normalizeBusinessDateKey, parseDailyReportAttachmentQuery };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var y=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var K=Object.prototype.hasOwnProperty;var q=(t,r)=>{for(var n in r)y(t,n,{get:r[n],enumerable:!0})},Q=(t,r,n,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of F(r))!K.call(t,i)&&i!==n&&y(t,i,{get:()=>r[i],enumerable:!(o=z(r,i))||o.enumerable});return t};var W=t=>Q(y({},"__esModule",{value:!0}),t);var ne={};q(ne,{DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS:()=>h,DAILY_REPORT_SSE_CURSOR_PARAM:()=>Y,DAILY_REPORT_SSE_HEARTBEAT_MS:()=>j,DAILY_REPORT_SSE_TERMINAL_EVENTS:()=>H,buildDailyReportAttachmentUrl:()=>N,commentAddMessageSchema:()=>S,commentDeleteMessageSchema:()=>I,connectedMessageSchema:()=>f,dailyReportDetailSchema:()=>m,dailyReportExternalCommentSchema:()=>R,dailyReportInterviewerSchema:()=>g,dailyReportLabelDefSchema:()=>D,dailyReportPostedCommentSchema:()=>d,dailyReportSseMessageSchema:()=>V,isDailyReportAttachmentThumbnailVariant:()=>c,isDailyReportSseStreamId:()=>v,isIdsStreamChunkLine:()=>$,mergeComments:()=>O,normalizeBusinessDateKey:()=>P,parseDailyReportAttachmentQuery:()=>L,reportCreateMessageSchema:()=>T,reportDeleteMessageSchema:()=>E,reportPublishMessageSchema:()=>_,reportUpdateMessageSchema:()=>A,statusUpdateMessageSchema:()=>b});module.exports=W(ne);var h=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),c=t=>Object.hasOwn(h,t);var C="download",M="thumbnail",k="1",N=(t,r,n)=>{let o=`${t}/attachment/${encodeURIComponent(r)}`;switch(n.kind){case"inline":return o;case"download":return`${o}?${new URLSearchParams({[C]:k})}`;case"thumbnail":return`${o}?${new URLSearchParams({[M]:n.variant})}`}},L=t=>{let r=t.getAll(M),n=t.getAll(C);if(r.length>0&&n.length>0)return{kind:"invalid",reason:"conflict"};if(r.length>0){let[o]=r;return r.length===1&&c(o)?{kind:"thumbnail",variant:o}:{kind:"invalid",reason:"thumbnail_variant"}}return n.length>0?n.length===1&&n[0]===k?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var J=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var w=t=>t<10?`0${t}`:`${t}`,G=t=>{if(Number.isNaN(t.getTime()))return null;let r=t.getFullYear(),n=w(t.getMonth()+1),o=w(t.getDate());return`${r}-${n}-${o}`},X=t=>{let r=J.exec(t);if(r===null)return null;let[,n,,o,i]=r,l=Number(n),a=Number(o),u=Number(i);if(l<1)return null;let p=new Date(0);return p.setUTCFullYear(l,a-1,u),p.getUTCFullYear()!==l||p.getUTCMonth()!==a-1||p.getUTCDate()!==u?null:`${n}-${o}-${i}`};var P=t=>t==null?null:t instanceof Date?G(t):X(t);var Z=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 ${Z(n)}`);var O=(t,r,n,o)=>{if(typeof o!="string"||o.trim()==="")throw U("mergeComments: unknownAuthorName","a non-blank string",o);let i=t.map((a,u)=>({id:`legacy-${u}`,authorName:a.name||o,content:a.text||"",isMine:!1,color:a.color||void 0,isLegacy:!0})),l=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,...l]};var ee=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"},$=t=>ee(t)==="chunk";var e=require("zod");var B=/^(?:[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 H=["auth-required","forbidden","resync-required"],j=15e3,Y="lastEventId",te=/^\d{1,15}-\d{1,15}$/,v=t=>te.test(t),g=e.z.object({name:e.z.string().nullish(),affiliation:e.z.string().nullish()}),R=e.z.object({name:e.z.string().nullish(),text:e.z.string().nullish(),color:e.z.string().nullish()}),D=e.z.object({id:e.z.number(),name:e.z.string().nullish(),color:e.z.string().nullish()}),d=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()}),re=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)}),m=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(g),subject:e.z.string().nullish(),content:e.z.string().nullish(),externalComments:e.z.array(R),isRead:e.z.boolean(),isStarred:e.z.boolean(),labels:e.z.array(D),postedComments:e.z.array(d),attachments:e.z.array(re).default([])}),s=e.z.string().regex(B),f=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:s,recipientRawUserId:e.z.number().optional()}),x=e.z.string().optional(),S=e.z.object({type:e.z.literal("comment-add"),reportHubId:e.z.number(),comment:d,clientTempId:s,recipientRawUserId:e.z.number().optional(),sourceType:x}),I=e.z.object({type:e.z.literal("comment-delete"),reportHubId:e.z.number(),commentId:e.z.number(),clientTempId:s,recipientRawUserId:e.z.number().optional(),sourceType:x}),T=e.z.object({type:e.z.literal("report-create"),reportHubId:e.z.number(),report:m,clientTempId:s,recipientRawUserId:e.z.number().optional()}),A=e.z.object({type:e.z.literal("report-update"),reportHubId:e.z.number(),report:m,clientTempId:s,recipientRawUserId:e.z.number().optional()}),_=e.z.object({type:e.z.literal("report-publish"),reportHubId:e.z.number(),report:m,clientTempId:s,recipientRawUserId:e.z.number().optional()}),E=e.z.object({type:e.z.literal("report-delete"),reportHubId:e.z.number(),clientTempId:s,sourceType:x}),V=e.z.discriminatedUnion("type",[f,b,S,I,T,A,_,E]);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 b=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ae=Object.prototype.hasOwnProperty;var ie=(e,n)=>{for(var r in n)b(e,r,{get:n[r],enumerable:!0})},se=(e,n,r,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let s of oe(n))!ae.call(e,s)&&s!==r&&b(e,s,{get:()=>n[s],enumerable:!(a=re(n,s))||a.enumerable});return e};var le=e=>se(b({},"__esModule",{value:!0}),e);var be={};ie(be,{DAILY_REPORT_ACTION_FIELDS:()=>p,DAILY_REPORT_ACTION_INTENTS:()=>B,DAILY_REPORT_API_ENDPOINTS:()=>V,DAILY_REPORT_API_QUERY_PARAMS:()=>F,DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS:()=>M,DAILY_REPORT_CLIENT_TEMP_ID_PATTERN:()=>m,DAILY_REPORT_SEARCH_COMBINES:()=>ne,DAILY_REPORT_SSE_CURSOR_PARAM:()=>H,DAILY_REPORT_SSE_HEARTBEAT_MS:()=>w,DAILY_REPORT_SSE_TERMINAL_EVENTS:()=>k,buildDailyReportAttachmentUrl:()=>Z,commentAddMessageSchema:()=>x,commentDeleteMessageSchema:()=>_,connectedMessageSchema:()=>S,dailyReportDetailSchema:()=>d,dailyReportExternalCommentSchema:()=>D,dailyReportInterviewerSchema:()=>h,dailyReportLabelDefSchema:()=>f,dailyReportPostedCommentSchema:()=>c,dailyReportSseMessageSchema:()=>U,encodeDailyReportActionCommand:()=>$,isDailyReportAttachmentThumbnailVariant:()=>I,isDailyReportSseStreamId:()=>j,isIdsStreamChunkLine:()=>K,mergeComments:()=>te,normalizeBusinessDateKey:()=>X,parseDailyReportActionResult:()=>z,parseDailyReportAttachmentQuery:()=>G,reportCreateMessageSchema:()=>C,reportDeleteMessageSchema:()=>P,reportPublishMessageSchema:()=>O,reportUpdateMessageSchema:()=>E,statusUpdateMessageSchema:()=>A});module.exports=le(be);var o=require("zod");var m=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|-[1-9][0-9]{0,15})$/;var L=require("zod");var i=L.z.number().int().positive().max(Number.MAX_SAFE_INTEGER);var t=require("zod");var k=["auth-required","forbidden","resync-required"],w=15e3,H="lastEventId",pe=/^\d{1,15}-\d{1,15}$/,j=e=>pe.test(e),h=t.z.object({name:t.z.string().nullish(),affiliation:t.z.string().nullish()}),D=t.z.object({name:t.z.string().nullish(),text:t.z.string().nullish(),color:t.z.string().nullish()}),f=t.z.object({id:i,name:t.z.string().nullish(),color:t.z.string().nullish()}),c=t.z.object({id:i,userId:t.z.string().nullish(),userName:t.z.string().nullish(),content:t.z.string().nullish(),createdAt:t.z.string().nullish(),isMine:t.z.boolean()}),de=t.z.object({id:t.z.string(),fileName:t.z.string(),fileType:t.z.string().nullable(),fileSize:t.z.number().nullable(),createdAt:t.z.string().nullable(),state:t.z.enum(["present","absent","unknown"]),hasThumbnail:t.z.boolean().default(!1)}),d=t.z.object({reportHubId:i,date:t.z.string().nullish(),createdAt:t.z.string().nullish(),author:t.z.string().nullish(),userId:t.z.string().nullish(),sourceType:t.z.string().nullish(),employeeName:t.z.string().nullish(),updatedBy:t.z.string().nullish(),updatedAt:t.z.string().nullish(),category:t.z.string().nullish(),creationCategory:t.z.string().nullish(),visitTimeFrom:t.z.string().nullish(),visitTimeTo:t.z.string().nullish(),customerName:t.z.string().nullish(),interviewers:t.z.array(h),subject:t.z.string().nullish(),content:t.z.string().nullish(),externalComments:t.z.array(D),isRead:t.z.boolean(),isStarred:t.z.boolean(),labels:t.z.array(f),postedComments:t.z.array(c),attachments:t.z.array(de).default([])}),u=t.z.string().regex(m),S=t.z.object({type:t.z.literal("connected")}),A=t.z.object({type:t.z.literal("status-update"),reportHubId:i,statusType:t.z.enum(["star","read"]),value:t.z.boolean(),clientTempId:u,recipientRawUserId:i.optional()}),T=t.z.string().optional(),x=t.z.object({type:t.z.literal("comment-add"),reportHubId:i,comment:c,clientTempId:u,recipientRawUserId:i.optional(),sourceType:T}),_=t.z.object({type:t.z.literal("comment-delete"),reportHubId:i,commentId:i,clientTempId:u,recipientRawUserId:i.optional(),sourceType:T}),C=t.z.object({type:t.z.literal("report-create"),reportHubId:i,report:d,clientTempId:u,recipientRawUserId:i.optional()}),E=t.z.object({type:t.z.literal("report-update"),reportHubId:i,report:d,clientTempId:u,recipientRawUserId:i.optional()}),O=t.z.object({type:t.z.literal("report-publish"),reportHubId:i,report:d,clientTempId:u,recipientRawUserId:i.optional()}),P=t.z.object({type:t.z.literal("report-delete"),reportHubId:i,clientTempId:u,sourceType:T}),U=t.z.discriminatedUnion("type",[S,A,x,_,C,E,O,P]);var Y=e=>e.issues.map(n=>`${n.path.length===0?"(root)":n.path.join(".")}: ${n.code}`).join("; ");var B=Object.freeze(["create","update","publish","delete","toggleStar","toggleRead","addComment","deleteComment","clearCache"]);var p=Object.freeze({intent:"intent",clientTempId:"clientTempId",businessDate:"businessDate",operationTimestamp:"operationTimestamp",reportHubId:"reportHubId",title:"title",content:"content",isStarred:"isStarred",isRead:"isRead",commentId:"commentId"}),$=e=>{let n=new FormData;if(n.append(p.intent,e.intent),e.intent==="clearCache"||(n.append(p.clientTempId,e.clientTempId),e.businessDate!==null&&n.append(p.businessDate,e.businessDate),e.operationTimestamp!==null&&n.append(p.operationTimestamp,String(e.operationTimestamp)),e.intent==="create"))return n;switch(n.append(p.reportHubId,String(e.reportHubId)),e.intent){case"update":return e.changes.title!==void 0&&n.append(p.title,e.changes.title),e.changes.content!==void 0&&n.append(p.content,e.changes.content),n;case"publish":case"delete":return n;case"toggleStar":return n.append(p.isStarred,String(e.value)),n;case"toggleRead":return n.append(p.isRead,String(e.value)),n;case"addComment":return n.append(p.content,e.content),n;case"deleteComment":return n.append(p.commentId,String(e.commentId)),n}},ue=()=>{let e=i,n=o.z.string().regex(m),r=o.z.literal("OK"),a=o.z.object({isStarred:o.z.boolean(),isRead:o.z.boolean()}),s=o.z.number().int().nonnegative().nullable();return{create:o.z.object({status:r,intent:o.z.literal("create"),reportHubId:e,clientTempId:n,report:d}),update:o.z.object({status:r,intent:o.z.literal("update"),reportHubId:e,clientTempId:n}),publish:o.z.object({status:r,intent:o.z.literal("publish"),reportHubId:e,clientTempId:n,report:d.nullable()}),delete:o.z.object({status:r,intent:o.z.literal("delete"),reportHubId:e,clientTempId:n}),toggleStar:o.z.object({status:r,intent:o.z.literal("toggleStar"),reportHubId:e,clientTempId:n,updatedStatus:a,operationTimestamp:s}),toggleRead:o.z.object({status:r,intent:o.z.literal("toggleRead"),reportHubId:e,clientTempId:n,updatedStatus:a,operationTimestamp:s}),addComment:o.z.object({status:r,intent:o.z.literal("addComment"),reportHubId:e,clientTempId:n,newComment:c}),deleteComment:o.z.object({status:r,intent:o.z.literal("deleteComment"),reportHubId:e,clientTempId:n,deletedCommentId:i}),clearCache:o.z.object({status:r,intent:o.z.literal("clearCache")})}},N=null,me=()=>(N===null&&(N=ue()),N),z=(e,n)=>{let r=me()[e].safeParse(n);return r.success?{result:r.data}:{mismatch:Y(r.error)}};var v="ids-stream",ce=e=>{if(typeof e!="object"||e===null)return"unknown";let n=e;return typeof n.kind=="string"?n.kind==="chunk"?"chunk":n.kind==="error"?"error":"unknown":Array.isArray(n.items)?"chunk":typeof n.error=="string"?"error":"unknown"},K=e=>ce(e)==="chunk";var V=Object.freeze({businessDate:"business-date",idsStream:v,report:"report",search:"search",reports:"reports",action:"action"}),F=Object.freeze({businessDate:"businessDate",reportHubId:"reportHubId",searchQuery:"q",searchCombine:"combine",reportIds:"ids",forceRefresh:"forceRefresh",cursorReportHubId:"cursor_report_hub_id",cursorBusinessDate:"cursor_business_date",cursorSnapshot:"cursor_snapshot"});var M=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),I=e=>Object.hasOwn(M,e);var W="download",Q="thumbnail",q="1",Z=(e,n,r)=>{let a=`${e}/attachment/${encodeURIComponent(n)}`;switch(r.kind){case"inline":return a;case"download":return`${a}?${new URLSearchParams({[W]:q})}`;case"thumbnail":return`${a}?${new URLSearchParams({[Q]:r.variant})}`}},G=e=>{let n=e.getAll(Q),r=e.getAll(W);if(n.length>0&&r.length>0)return{kind:"invalid",reason:"conflict"};if(n.length>0){let[a]=n;return n.length===1&&I(a)?{kind:"thumbnail",variant:a}:{kind:"invalid",reason:"thumbnail_variant"}}return r.length>0?r.length===1&&r[0]===q?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var ye=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var J=e=>e<10?`0${e}`:`${e}`,Re=e=>{if(Number.isNaN(e.getTime()))return null;let n=e.getFullYear(),r=J(e.getMonth()+1),a=J(e.getDate());return`${n}-${r}-${a}`},ge=e=>{let n=ye.exec(e);if(n===null)return null;let[,r,,a,s]=n,y=Number(r),l=Number(a),R=Number(s);if(y<1)return null;let g=new Date(0);return g.setUTCFullYear(y,l-1,R),g.getUTCFullYear()!==y||g.getUTCMonth()!==l-1||g.getUTCDate()!==R?null:`${r}-${a}-${s}`};var X=e=>e==null?null:e instanceof Date?Re(e):ge(e);var Ie=e=>typeof e=="string"?JSON.stringify(e):typeof e=="number"||typeof e=="boolean"||e===null||e===void 0?String(e):Array.isArray(e)?"array":typeof e,ee=(e,n,r)=>new RangeError(`[daily-report] ${e} must be ${n}; got ${Ie(r)}`);var te=(e,n,r,a)=>{if(typeof a!="string"||a.trim()==="")throw ee("mergeComments: unknownAuthorName","a non-blank string",a);let s=e.map((l,R)=>({id:`legacy-${R}`,authorName:l.name||a,content:l.text||"",isMine:!1,color:l.color||void 0,isLegacy:!0})),y=n.map(l=>({id:l.id,authorName:l.userName||a,content:l.content??"",createdAt:l.createdAt??"",isMine:r?l.userId===r:l.isMine,isLegacy:!1}));return[...s,...y]};var ne=["intersection","union"];var $e=Object.freeze({maxQueryLength:500,maxSets:16,maxWordsPerSet:16,maxWords:32,maxWordLength:100,maxDetailIds:100});0&&(module.exports={DAILY_REPORT_ACTION_FIELDS,DAILY_REPORT_ACTION_INTENTS,DAILY_REPORT_API_ENDPOINTS,DAILY_REPORT_API_QUERY_PARAMS,DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,DAILY_REPORT_CLIENT_TEMP_ID_PATTERN,DAILY_REPORT_SEARCH_COMBINES,DAILY_REPORT_SSE_CURSOR_PARAM,DAILY_REPORT_SSE_HEARTBEAT_MS,DAILY_REPORT_SSE_TERMINAL_EVENTS,buildDailyReportAttachmentUrl,commentAddMessageSchema,commentDeleteMessageSchema,connectedMessageSchema,dailyReportDetailSchema,dailyReportExternalCommentSchema,dailyReportInterviewerSchema,dailyReportLabelDefSchema,dailyReportPostedCommentSchema,dailyReportSseMessageSchema,encodeDailyReportActionCommand,isDailyReportAttachmentThumbnailVariant,isDailyReportSseStreamId,isIdsStreamChunkLine,mergeComments,normalizeBusinessDateKey,parseDailyReportActionResult,parseDailyReportAttachmentQuery,reportCreateMessageSchema,reportDeleteMessageSchema,reportPublishMessageSchema,reportUpdateMessageSchema,statusUpdateMessageSchema});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var h=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),c=t=>Object.hasOwn(h,t);var g="download",R="thumbnail",D="1",w=(t,r,n)=>{let o=`${t}/attachment/${encodeURIComponent(r)}`;switch(n.kind){case"inline":return o;case"download":return`${o}?${new URLSearchParams({[g]:D})}`;case"thumbnail":return`${o}?${new URLSearchParams({[R]:n.variant})}`}},P=t=>{let r=t.getAll(R),n=t.getAll(g);if(r.length>0&&n.length>0)return{kind:"invalid",reason:"conflict"};if(r.length>0){let[o]=r;return r.length===1&&c(o)?{kind:"thumbnail",variant:o}:{kind:"invalid",reason:"thumbnail_variant"}}return n.length>0?n.length===1&&n[0]===D?{kind:"download"}:{kind:"invalid",reason:"download_value"}:{kind:"inline"}};var U=/^(\d{4})([-/])(\d{2})\2(\d{2})$/;var f=t=>t<10?`0${t}`:`${t}`,O=t=>{if(Number.isNaN(t.getTime()))return null;let r=t.getFullYear(),n=f(t.getMonth()+1),o=f(t.getDate());return`${r}-${n}-${o}`},$=t=>{let r=U.exec(t);if(r===null)return null;let[,n,,o,l]=r,s=Number(n),a=Number(o),m=Number(l);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}-${l}`};var B=t=>t==null?null:t instanceof Date?O(t):$(t);var H=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 ${H(n)}`);var j=(t,r,n,o)=>{if(typeof o!="string"||o.trim()==="")throw b("mergeComments: unknownAuthorName","a non-blank string",o);let l=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[...l,...s]};var Y=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"},v=t=>Y(t)==="chunk";import{z as e}from"zod";var x=/^(?:[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 V=["auth-required","forbidden","resync-required"],z=15e3,F="lastEventId",K=/^\d{1,15}-\d{1,15}$/,q=t=>K.test(t),S=e.object({name:e.string().nullish(),affiliation:e.string().nullish()}),I=e.object({name:e.string().nullish(),text:e.string().nullish(),color:e.string().nullish()}),T=e.object({id:e.number(),name:e.string().nullish(),color:e.string().nullish()}),d=e.object({id:e.number(),userId:e.string().nullish(),userName:e.string().nullish(),content:e.string().nullish(),createdAt:e.string().nullish(),isMine:e.boolean()}),Q=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)}),p=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(S),subject:e.string().nullish(),content:e.string().nullish(),externalComments:e.array(I),isRead:e.boolean(),isStarred:e.boolean(),labels:e.array(T),postedComments:e.array(d),attachments:e.array(Q).default([])}),i=e.string().regex(x),A=e.object({type:e.literal("connected")}),_=e.object({type:e.literal("status-update"),reportHubId:e.number(),statusType:e.enum(["star","read"]),value:e.boolean(),clientTempId:i,recipientRawUserId:e.number().optional()}),y=e.string().optional(),E=e.object({type:e.literal("comment-add"),reportHubId:e.number(),comment:d,clientTempId:i,recipientRawUserId:e.number().optional(),sourceType:y}),C=e.object({type:e.literal("comment-delete"),reportHubId:e.number(),commentId:e.number(),clientTempId:i,recipientRawUserId:e.number().optional(),sourceType:y}),M=e.object({type:e.literal("report-create"),reportHubId:e.number(),report:p,clientTempId:i,recipientRawUserId:e.number().optional()}),k=e.object({type:e.literal("report-update"),reportHubId:e.number(),report:p,clientTempId:i,recipientRawUserId:e.number().optional()}),N=e.object({type:e.literal("report-publish"),reportHubId:e.number(),report:p,clientTempId:i,recipientRawUserId:e.number().optional()}),L=e.object({type:e.literal("report-delete"),reportHubId:e.number(),clientTempId:i,sourceType:y}),W=e.discriminatedUnion("type",[A,_,E,C,M,k,N,L]);export{h as DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,F as DAILY_REPORT_SSE_CURSOR_PARAM,z as DAILY_REPORT_SSE_HEARTBEAT_MS,V as DAILY_REPORT_SSE_TERMINAL_EVENTS,w as buildDailyReportAttachmentUrl,E as commentAddMessageSchema,C as commentDeleteMessageSchema,A as connectedMessageSchema,p as dailyReportDetailSchema,I as dailyReportExternalCommentSchema,S as dailyReportInterviewerSchema,T as dailyReportLabelDefSchema,d as dailyReportPostedCommentSchema,W as dailyReportSseMessageSchema,c as isDailyReportAttachmentThumbnailVariant,q as isDailyReportSseStreamId,v as isIdsStreamChunkLine,j as mergeComments,B as normalizeBusinessDateKey,P as parseDailyReportAttachmentQuery,M as reportCreateMessageSchema,L as reportDeleteMessageSchema,N as reportPublishMessageSchema,k as reportUpdateMessageSchema,_ as statusUpdateMessageSchema};
1
+ import{z as o}from"zod";var c=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|-[1-9][0-9]{0,15})$/;import{z as 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}$/,K=e=>v.test(e),D=t.object({name:t.string().nullish(),affiliation:t.string().nullish()}),f=t.object({name:t.string().nullish(),text:t.string().nullish(),color:t.string().nullish()}),S=t.object({id:a,name:t.string().nullish(),color:t.string().nullish()}),y=t.object({id:a,userId:t.string().nullish(),userName:t.string().nullish(),content:t.string().nullish(),createdAt:t.string().nullish(),isMine:t.boolean()}),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)}),d=t.object({reportHubId:a,date:t.string().nullish(),createdAt:t.string().nullish(),author:t.string().nullish(),userId:t.string().nullish(),sourceType:t.string().nullish(),employeeName:t.string().nullish(),updatedBy:t.string().nullish(),updatedAt:t.string().nullish(),category:t.string().nullish(),creationCategory:t.string().nullish(),visitTimeFrom:t.string().nullish(),visitTimeTo:t.string().nullish(),customerName:t.string().nullish(),interviewers:t.array(D),subject:t.string().nullish(),content:t.string().nullish(),externalComments:t.array(f),isRead:t.boolean(),isStarred:t.boolean(),labels:t.array(S),postedComments:t.array(y),attachments:t.array(V).default([])}),u=t.string().regex(c),A=t.object({type:t.literal("connected")}),T=t.object({type:t.literal("status-update"),reportHubId:a,statusType:t.enum(["star","read"]),value:t.boolean(),clientTempId:u,recipientRawUserId:a.optional()}),I=t.string().optional(),x=t.object({type:t.literal("comment-add"),reportHubId:a,comment:y,clientTempId:u,recipientRawUserId:a.optional(),sourceType:I}),_=t.object({type:t.literal("comment-delete"),reportHubId:a,commentId:a,clientTempId:u,recipientRawUserId:a.optional(),sourceType:I}),C=t.object({type:t.literal("report-create"),reportHubId:a,report:d,clientTempId:u,recipientRawUserId:a.optional()}),E=t.object({type:t.literal("report-update"),reportHubId:a,report:d,clientTempId:u,recipientRawUserId:a.optional()}),O=t.object({type:t.literal("report-publish"),reportHubId:a,report:d,clientTempId:u,recipientRawUserId:a.optional()}),P=t.object({type:t.literal("report-delete"),reportHubId:a,clientTempId:u,sourceType:I}),F=t.discriminatedUnion("type",[A,T,x,_,C,E,O,P]);var N=e=>e.issues.map(n=>`${n.path.length===0?"(root)":n.path.join(".")}: ${n.code}`).join("; ");var W=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}},q=()=>{let e=a,n=o.string().regex(c),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:d}),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:d.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")})}},b=null,Z=()=>(b===null&&(b=q()),b),G=(e,n)=>{let r=Z()[e].safeParse(n);return r.success?{result:r.data}:{mismatch:N(r.error)}};var M="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:M,report:"report",search:"search",reports:"reports",action:"action"}),te=Object.freeze({businessDate:"businessDate",reportHubId:"reportHubId",searchQuery:"q",searchCombine:"combine",reportIds:"ids",forceRefresh:"forceRefresh",cursorReportHubId:"cursor_report_hub_id",cursorBusinessDate:"cursor_business_date",cursorSnapshot:"cursor_snapshot"});var L=Object.freeze({tile:Object.freeze({maxWidth:480,maxHeight:320})}),h=e=>Object.hasOwn(L,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&&h(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 j=e=>e<10?`0${e}`:`${e}`,ae=e=>{if(Number.isNaN(e.getTime()))return null;let n=e.getFullYear(),r=j(e.getMonth()+1),i=j(e.getDate());return`${n}-${r}-${i}`},ie=e=>{let n=oe.exec(e);if(n===null)return null;let[,r,,i,p]=n,m=Number(r),s=Number(i),R=Number(p);if(m<1)return null;let g=new Date(0);return g.setUTCFullYear(m,s-1,R),g.getUTCFullYear()!==m||g.getUTCMonth()!==s-1||g.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,U=(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 U("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})),m=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,...m]};var de=["intersection","union"];var we=Object.freeze({maxQueryLength:500,maxSets:16,maxWordsPerSet:16,maxWords:32,maxWordLength:100,maxDetailIds:100});export{l as DAILY_REPORT_ACTION_FIELDS,W as DAILY_REPORT_ACTION_INTENTS,ee as DAILY_REPORT_API_ENDPOINTS,te as DAILY_REPORT_API_QUERY_PARAMS,L as DAILY_REPORT_ATTACHMENT_THUMBNAIL_VARIANTS,c as DAILY_REPORT_CLIENT_TEMP_ID_PATTERN,de as DAILY_REPORT_SEARCH_COMBINES,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,A as connectedMessageSchema,d as dailyReportDetailSchema,f as dailyReportExternalCommentSchema,D as dailyReportInterviewerSchema,S as dailyReportLabelDefSchema,y as dailyReportPostedCommentSchema,F as dailyReportSseMessageSchema,Q as encodeDailyReportActionCommand,h as isDailyReportAttachmentThumbnailVariant,K as isDailyReportSseStreamId,X as isIdsStreamChunkLine,pe as mergeComments,se as normalizeBusinessDateKey,G as parseDailyReportActionResult,re as parseDailyReportAttachmentQuery,C as reportCreateMessageSchema,P as reportDeleteMessageSchema,O as reportPublishMessageSchema,E as reportUpdateMessageSchema,T as statusUpdateMessageSchema};
@@ -0,0 +1,17 @@
1
+ declare const DAILY_REPORT_SEARCH_COMBINES: readonly [
2
+ "intersection",
3
+ "union"
4
+ ];
5
+ type DailyReportSearchCombine = (typeof DAILY_REPORT_SEARCH_COMBINES)[number];
6
+ type DailyReportSearchHit = {
7
+ readonly reportHubId: number;
8
+ readonly businessDate: string | null;
9
+ readonly sourceType: string;
10
+ };
11
+ interface DailyReportLogger {
12
+ debug(message?: unknown, ...optionalParams: unknown[]): void;
13
+ info(message?: unknown, ...optionalParams: unknown[]): void;
14
+ warn(message?: unknown, ...optionalParams: unknown[]): void;
15
+ error(message?: unknown, ...optionalParams: unknown[]): void;
16
+ }
17
+ export { DAILY_REPORT_SEARCH_COMBINES as D, type DailyReportLogger as a, type DailyReportSearchCombine as b, type DailyReportSearchHit as c };
@@ -0,0 +1,17 @@
1
+ declare const DAILY_REPORT_SEARCH_COMBINES: readonly [
2
+ "intersection",
3
+ "union"
4
+ ];
5
+ type DailyReportSearchCombine = (typeof DAILY_REPORT_SEARCH_COMBINES)[number];
6
+ type DailyReportSearchHit = {
7
+ readonly reportHubId: number;
8
+ readonly businessDate: string | null;
9
+ readonly sourceType: string;
10
+ };
11
+ interface DailyReportLogger {
12
+ debug(message?: unknown, ...optionalParams: unknown[]): void;
13
+ info(message?: unknown, ...optionalParams: unknown[]): void;
14
+ warn(message?: unknown, ...optionalParams: unknown[]): void;
15
+ error(message?: unknown, ...optionalParams: unknown[]): void;
16
+ }
17
+ export { DAILY_REPORT_SEARCH_COMBINES as D, type DailyReportLogger as a, type DailyReportSearchCombine as b, type DailyReportSearchHit as c };