@aiquants/daily-report 0.31.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -307,26 +307,16 @@ type UseDailyReportSseConnectionOptions = {
307
307
  };
308
308
  declare const useDailyReportSseConnection: ({ isSseEnabled, onMessage }: UseDailyReportSseConnectionOptions) => DailyReportSseConnectionStatus;
309
309
  type ReportBusinessDate = DailyReportDetail["date"];
310
- type DailyReportActionContextType = {
311
- user?: DailyReportUser;
312
- pendingAddCommentIds: React.MutableRefObject<Map<number, Map<number, string>>>;
313
- pendingDeleteCommentIds: React.MutableRefObject<Map<number, Set<number>>>;
314
- pendingStarUpdates: React.MutableRefObject<Map<number, boolean>>;
315
- pendingReadUpdates: React.MutableRefObject<Map<number, boolean>>;
316
- resolvedIdMap: React.MutableRefObject<Map<number, number>>;
317
- version: number;
318
- items: DailyReportItem[];
319
- isSseEnabled: boolean;
310
+ type DailyReportActionFunctions = {
320
311
  toggleSse: () => void;
321
- sseStatus: DailyReportSseConnectionStatus;
322
312
  addComment: (reportHubId: number, content: string, businessDate: ReportBusinessDate) => Promise<void>;
323
313
  deleteComment: (reportHubId: number, commentId: number, businessDate: ReportBusinessDate) => Promise<void>;
324
314
  toggleStar: (reportHubId: number, isStarred: boolean, businessDate: ReportBusinessDate) => Promise<void>;
325
315
  toggleRead: (reportHubId: number, isRead: boolean, businessDate: ReportBusinessDate) => Promise<void>;
326
316
  createReport: (businessDate: string) => Promise<number>;
327
317
  updateReport: (reportHubId: number, data: {
328
- title?: string;
329
- content?: string;
318
+ title: string;
319
+ content: string;
330
320
  }, businessDate: ReportBusinessDate) => Promise<void>;
331
321
  publishReport: (reportHubId: number, businessDate: ReportBusinessDate) => Promise<void>;
332
322
  deleteReport: (reportHubId: number, businessDate: ReportBusinessDate) => Promise<void>;
@@ -334,8 +324,26 @@ type DailyReportActionContextType = {
334
324
  refetchData: () => Promise<void>;
335
325
  clearCacheAndRefetch: () => Promise<void>;
336
326
  };
327
+ type DailyReportActionLedgers = {
328
+ pendingAddCommentIds: React.MutableRefObject<Map<number, Map<number, string>>>;
329
+ pendingDeleteCommentIds: React.MutableRefObject<Map<number, Set<number>>>;
330
+ pendingStarUpdates: React.MutableRefObject<Map<number, boolean>>;
331
+ pendingReadUpdates: React.MutableRefObject<Map<number, boolean>>;
332
+ resolvedIdMap: React.MutableRefObject<Map<number, number>>;
333
+ };
334
+ type DailyReportActions = DailyReportActionFunctions & DailyReportActionLedgers & {
335
+ user?: DailyReportUser;
336
+ };
337
+ type DailyReportActionState = {
338
+ version: number;
339
+ items: DailyReportItem[];
340
+ isSseEnabled: boolean;
341
+ sseStatus: DailyReportSseConnectionStatus;
342
+ };
343
+ type DailyReportActionContextType = DailyReportActions & DailyReportActionState;
337
344
  declare global {
338
- var __DailyReportActionContext: Context<DailyReportActionContextType | null> | undefined;
345
+ var __DailyReportActionsContext: Context<DailyReportActions | null> | undefined;
346
+ var __DailyReportActionStateContext: Context<DailyReportActionState | null> | undefined;
339
347
  }
340
348
  declare const useDailyReportActionContext: () => DailyReportActionContextType;
341
349
  declare const DailyReportActionProvider: ({ children, user, userId }: {
@@ -394,7 +402,6 @@ type DailyReportIdsStreamItemsChange = {
394
402
  };
395
403
  type DailyReportIdsStreamPhase = "idle" | "streaming" | "retrying" | "complete" | "failed" | "auth-required";
396
404
  type DailyReportIdsStreamState = {
397
- items: DailyReportItem[];
398
405
  loadedCount: number;
399
406
  itemsRevision: number;
400
407
  itemsChanges: readonly DailyReportIdsStreamItemsChange[];
@@ -460,6 +467,7 @@ declare class DailyReportIdsStreamClient {
460
467
  applyExternalUpsert(item: DailyReportItem): void;
461
468
  applyExternalRemoval(reportHubId: number): void;
462
469
  has(reportHubId: number): boolean;
470
+ readItems(): DailyReportItem[];
463
471
  dispose(): void;
464
472
  private runStreamLoop;
465
473
  private pruneUnseenItems;