@aiquants/daily-report 0.30.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.mts CHANGED
@@ -23,6 +23,7 @@ type DailyReportDetailListScrollRestore = {
23
23
  };
24
24
  type DailyReportDetailListProps = {
25
25
  dailyReportItems: DailyReportItem[];
26
+ rowSetSize?: number;
26
27
  userId?: string | null;
27
28
  selectedItemId?: number | null;
28
29
  onSelectItem?: (id: number | null) => void;
@@ -32,6 +33,7 @@ declare const DailyReportDetailList: (props: DailyReportDetailListProps) => reac
32
33
  declare const DailyReportIdsStreamStatus: () => react.JSX.Element | null;
33
34
  type DailyReportListProps = {
34
35
  dailyReportItems: DailyReportItem[];
36
+ rowSetSize?: number;
35
37
  autoMarkRead?: boolean;
36
38
  selectedReportHubId: number | null;
37
39
  onSelectItem: (reportHubId: number | null) => void;
@@ -129,6 +131,7 @@ type DailyReportLabels = VirtualScrollLabels & {
129
131
  readonly isStarred: boolean;
130
132
  }) => string;
131
133
  readonly listRowPosition: (position: number, total: number) => string;
134
+ readonly listRowPositionInUnknownTotal: (position: number) => string;
132
135
  };
133
136
  type DailyReportLabelOverrides = {
134
137
  readonly [K in keyof DailyReportLabels]?: DailyReportLabels[K];
@@ -228,7 +231,8 @@ declare const DAILY_REPORT_LABEL_KEYS: readonly [
228
231
  "interviewerWithAffiliation",
229
232
  "operationFailed",
230
233
  "rowState",
231
- "listRowPosition"
234
+ "listRowPosition",
235
+ "listRowPositionInUnknownTotal"
232
236
  ];
233
237
  declare const DAILY_REPORT_LABEL_CATALOGS: Readonly<Record<DailyReportLocale, DailyReportLabels>>;
234
238
  declare const resolveDailyReportLabels: (locale: DailyReportLocale | undefined, overrides: DailyReportLabelOverrides | undefined) => DailyReportLabels;
@@ -303,26 +307,16 @@ type UseDailyReportSseConnectionOptions = {
303
307
  };
304
308
  declare const useDailyReportSseConnection: ({ isSseEnabled, onMessage }: UseDailyReportSseConnectionOptions) => DailyReportSseConnectionStatus;
305
309
  type ReportBusinessDate = DailyReportDetail["date"];
306
- type DailyReportActionContextType = {
307
- user?: DailyReportUser;
308
- pendingAddCommentIds: React.MutableRefObject<Map<number, Map<number, string>>>;
309
- pendingDeleteCommentIds: React.MutableRefObject<Map<number, Set<number>>>;
310
- pendingStarUpdates: React.MutableRefObject<Map<number, boolean>>;
311
- pendingReadUpdates: React.MutableRefObject<Map<number, boolean>>;
312
- resolvedIdMap: React.MutableRefObject<Map<number, number>>;
313
- version: number;
314
- items: DailyReportItem[];
315
- isSseEnabled: boolean;
310
+ type DailyReportActionFunctions = {
316
311
  toggleSse: () => void;
317
- sseStatus: DailyReportSseConnectionStatus;
318
312
  addComment: (reportHubId: number, content: string, businessDate: ReportBusinessDate) => Promise<void>;
319
313
  deleteComment: (reportHubId: number, commentId: number, businessDate: ReportBusinessDate) => Promise<void>;
320
314
  toggleStar: (reportHubId: number, isStarred: boolean, businessDate: ReportBusinessDate) => Promise<void>;
321
315
  toggleRead: (reportHubId: number, isRead: boolean, businessDate: ReportBusinessDate) => Promise<void>;
322
316
  createReport: (businessDate: string) => Promise<number>;
323
317
  updateReport: (reportHubId: number, data: {
324
- title?: string;
325
- content?: string;
318
+ title: string;
319
+ content: string;
326
320
  }, businessDate: ReportBusinessDate) => Promise<void>;
327
321
  publishReport: (reportHubId: number, businessDate: ReportBusinessDate) => Promise<void>;
328
322
  deleteReport: (reportHubId: number, businessDate: ReportBusinessDate) => Promise<void>;
@@ -330,14 +324,31 @@ type DailyReportActionContextType = {
330
324
  refetchData: () => Promise<void>;
331
325
  clearCacheAndRefetch: () => Promise<void>;
332
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;
333
344
  declare global {
334
- var __DailyReportActionContext: Context<DailyReportActionContextType | null> | undefined;
345
+ var __DailyReportActionsContext: Context<DailyReportActions | null> | undefined;
346
+ var __DailyReportActionStateContext: Context<DailyReportActionState | null> | undefined;
335
347
  }
336
348
  declare const useDailyReportActionContext: () => DailyReportActionContextType;
337
- declare const DailyReportActionProvider: ({ children, user, initialItems, userId }: {
349
+ declare const DailyReportActionProvider: ({ children, user, userId }: {
338
350
  children: ReactNode;
339
351
  user?: DailyReportUser;
340
- initialItems?: DailyReportItem[];
341
352
  userId?: string | null;
342
353
  }) => react.JSX.Element;
343
354
  declare const DailyReportErrorProvider: ({ children }: {
@@ -378,10 +389,22 @@ declare const createDailyReportClientLoader: <TServerData extends Record<string,
378
389
  }): Promise<TServerData>;
379
390
  hydrate: true;
380
391
  };
392
+ type DailyReportIdsStreamItemReplacement = {
393
+ readonly previous: DailyReportItem;
394
+ readonly next: DailyReportItem;
395
+ };
396
+ type DailyReportIdsStreamItemsChange = {
397
+ readonly base: number;
398
+ readonly revision: number;
399
+ readonly appended: readonly DailyReportItem[];
400
+ readonly replaced: readonly DailyReportIdsStreamItemReplacement[];
401
+ readonly removed: readonly DailyReportItem[];
402
+ };
381
403
  type DailyReportIdsStreamPhase = "idle" | "streaming" | "retrying" | "complete" | "failed" | "auth-required";
382
404
  type DailyReportIdsStreamState = {
383
- items: DailyReportItem[];
384
405
  loadedCount: number;
406
+ itemsRevision: number;
407
+ itemsChanges: readonly DailyReportIdsStreamItemsChange[];
385
408
  totalCount: number | null;
386
409
  phase: DailyReportIdsStreamPhase;
387
410
  isRevalidating: boolean;
@@ -402,6 +425,7 @@ type DailyReportIdsStreamClientOptions = {
402
425
  readStallTimeoutMs?: number;
403
426
  warn?: (...args: unknown[]) => void;
404
427
  publishCoalesceMs?: number;
428
+ now?: () => number;
405
429
  };
406
430
  declare class DailyReportIdsStreamClient {
407
431
  private readonly apiBasePath;
@@ -428,7 +452,9 @@ declare class DailyReportIdsStreamClient {
428
452
  private readonly handleOnline;
429
453
  private readonly publishCoalesceMs;
430
454
  private publishCoalesceTimer;
455
+ private readonly now;
431
456
  private lastItemsPublishAt;
457
+ private pendingItemsChange;
432
458
  constructor(options?: DailyReportIdsStreamClientOptions);
433
459
  getState(): DailyReportIdsStreamState;
434
460
  subscribe(listener: () => void): () => void;
@@ -440,13 +466,18 @@ declare class DailyReportIdsStreamClient {
440
466
  resync(): void;
441
467
  applyExternalUpsert(item: DailyReportItem): void;
442
468
  applyExternalRemoval(reportHubId: number): void;
469
+ has(reportHubId: number): boolean;
470
+ readItems(): DailyReportItem[];
443
471
  dispose(): void;
444
472
  private runStreamLoop;
445
473
  private pruneUnseenItems;
446
474
  private streamOnce;
447
475
  private readWithStallGuard;
448
476
  private absorbChunkLine;
477
+ private putItem;
478
+ private deleteItem;
449
479
  private absorbStreamAnchor;
480
+ private takePendingItems;
450
481
  private publishItems;
451
482
  private schedulePublishItems;
452
483
  private cancelScheduledPublishItems;
package/dist/client.d.ts CHANGED
@@ -23,6 +23,7 @@ type DailyReportDetailListScrollRestore = {
23
23
  };
24
24
  type DailyReportDetailListProps = {
25
25
  dailyReportItems: DailyReportItem[];
26
+ rowSetSize?: number;
26
27
  userId?: string | null;
27
28
  selectedItemId?: number | null;
28
29
  onSelectItem?: (id: number | null) => void;
@@ -32,6 +33,7 @@ declare const DailyReportDetailList: (props: DailyReportDetailListProps) => reac
32
33
  declare const DailyReportIdsStreamStatus: () => react.JSX.Element | null;
33
34
  type DailyReportListProps = {
34
35
  dailyReportItems: DailyReportItem[];
36
+ rowSetSize?: number;
35
37
  autoMarkRead?: boolean;
36
38
  selectedReportHubId: number | null;
37
39
  onSelectItem: (reportHubId: number | null) => void;
@@ -129,6 +131,7 @@ type DailyReportLabels = VirtualScrollLabels & {
129
131
  readonly isStarred: boolean;
130
132
  }) => string;
131
133
  readonly listRowPosition: (position: number, total: number) => string;
134
+ readonly listRowPositionInUnknownTotal: (position: number) => string;
132
135
  };
133
136
  type DailyReportLabelOverrides = {
134
137
  readonly [K in keyof DailyReportLabels]?: DailyReportLabels[K];
@@ -228,7 +231,8 @@ declare const DAILY_REPORT_LABEL_KEYS: readonly [
228
231
  "interviewerWithAffiliation",
229
232
  "operationFailed",
230
233
  "rowState",
231
- "listRowPosition"
234
+ "listRowPosition",
235
+ "listRowPositionInUnknownTotal"
232
236
  ];
233
237
  declare const DAILY_REPORT_LABEL_CATALOGS: Readonly<Record<DailyReportLocale, DailyReportLabels>>;
234
238
  declare const resolveDailyReportLabels: (locale: DailyReportLocale | undefined, overrides: DailyReportLabelOverrides | undefined) => DailyReportLabels;
@@ -303,26 +307,16 @@ type UseDailyReportSseConnectionOptions = {
303
307
  };
304
308
  declare const useDailyReportSseConnection: ({ isSseEnabled, onMessage }: UseDailyReportSseConnectionOptions) => DailyReportSseConnectionStatus;
305
309
  type ReportBusinessDate = DailyReportDetail["date"];
306
- type DailyReportActionContextType = {
307
- user?: DailyReportUser;
308
- pendingAddCommentIds: React.MutableRefObject<Map<number, Map<number, string>>>;
309
- pendingDeleteCommentIds: React.MutableRefObject<Map<number, Set<number>>>;
310
- pendingStarUpdates: React.MutableRefObject<Map<number, boolean>>;
311
- pendingReadUpdates: React.MutableRefObject<Map<number, boolean>>;
312
- resolvedIdMap: React.MutableRefObject<Map<number, number>>;
313
- version: number;
314
- items: DailyReportItem[];
315
- isSseEnabled: boolean;
310
+ type DailyReportActionFunctions = {
316
311
  toggleSse: () => void;
317
- sseStatus: DailyReportSseConnectionStatus;
318
312
  addComment: (reportHubId: number, content: string, businessDate: ReportBusinessDate) => Promise<void>;
319
313
  deleteComment: (reportHubId: number, commentId: number, businessDate: ReportBusinessDate) => Promise<void>;
320
314
  toggleStar: (reportHubId: number, isStarred: boolean, businessDate: ReportBusinessDate) => Promise<void>;
321
315
  toggleRead: (reportHubId: number, isRead: boolean, businessDate: ReportBusinessDate) => Promise<void>;
322
316
  createReport: (businessDate: string) => Promise<number>;
323
317
  updateReport: (reportHubId: number, data: {
324
- title?: string;
325
- content?: string;
318
+ title: string;
319
+ content: string;
326
320
  }, businessDate: ReportBusinessDate) => Promise<void>;
327
321
  publishReport: (reportHubId: number, businessDate: ReportBusinessDate) => Promise<void>;
328
322
  deleteReport: (reportHubId: number, businessDate: ReportBusinessDate) => Promise<void>;
@@ -330,14 +324,31 @@ type DailyReportActionContextType = {
330
324
  refetchData: () => Promise<void>;
331
325
  clearCacheAndRefetch: () => Promise<void>;
332
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;
333
344
  declare global {
334
- var __DailyReportActionContext: Context<DailyReportActionContextType | null> | undefined;
345
+ var __DailyReportActionsContext: Context<DailyReportActions | null> | undefined;
346
+ var __DailyReportActionStateContext: Context<DailyReportActionState | null> | undefined;
335
347
  }
336
348
  declare const useDailyReportActionContext: () => DailyReportActionContextType;
337
- declare const DailyReportActionProvider: ({ children, user, initialItems, userId }: {
349
+ declare const DailyReportActionProvider: ({ children, user, userId }: {
338
350
  children: ReactNode;
339
351
  user?: DailyReportUser;
340
- initialItems?: DailyReportItem[];
341
352
  userId?: string | null;
342
353
  }) => react.JSX.Element;
343
354
  declare const DailyReportErrorProvider: ({ children }: {
@@ -378,10 +389,22 @@ declare const createDailyReportClientLoader: <TServerData extends Record<string,
378
389
  }): Promise<TServerData>;
379
390
  hydrate: true;
380
391
  };
392
+ type DailyReportIdsStreamItemReplacement = {
393
+ readonly previous: DailyReportItem;
394
+ readonly next: DailyReportItem;
395
+ };
396
+ type DailyReportIdsStreamItemsChange = {
397
+ readonly base: number;
398
+ readonly revision: number;
399
+ readonly appended: readonly DailyReportItem[];
400
+ readonly replaced: readonly DailyReportIdsStreamItemReplacement[];
401
+ readonly removed: readonly DailyReportItem[];
402
+ };
381
403
  type DailyReportIdsStreamPhase = "idle" | "streaming" | "retrying" | "complete" | "failed" | "auth-required";
382
404
  type DailyReportIdsStreamState = {
383
- items: DailyReportItem[];
384
405
  loadedCount: number;
406
+ itemsRevision: number;
407
+ itemsChanges: readonly DailyReportIdsStreamItemsChange[];
385
408
  totalCount: number | null;
386
409
  phase: DailyReportIdsStreamPhase;
387
410
  isRevalidating: boolean;
@@ -402,6 +425,7 @@ type DailyReportIdsStreamClientOptions = {
402
425
  readStallTimeoutMs?: number;
403
426
  warn?: (...args: unknown[]) => void;
404
427
  publishCoalesceMs?: number;
428
+ now?: () => number;
405
429
  };
406
430
  declare class DailyReportIdsStreamClient {
407
431
  private readonly apiBasePath;
@@ -428,7 +452,9 @@ declare class DailyReportIdsStreamClient {
428
452
  private readonly handleOnline;
429
453
  private readonly publishCoalesceMs;
430
454
  private publishCoalesceTimer;
455
+ private readonly now;
431
456
  private lastItemsPublishAt;
457
+ private pendingItemsChange;
432
458
  constructor(options?: DailyReportIdsStreamClientOptions);
433
459
  getState(): DailyReportIdsStreamState;
434
460
  subscribe(listener: () => void): () => void;
@@ -440,13 +466,18 @@ declare class DailyReportIdsStreamClient {
440
466
  resync(): void;
441
467
  applyExternalUpsert(item: DailyReportItem): void;
442
468
  applyExternalRemoval(reportHubId: number): void;
469
+ has(reportHubId: number): boolean;
470
+ readItems(): DailyReportItem[];
443
471
  dispose(): void;
444
472
  private runStreamLoop;
445
473
  private pruneUnseenItems;
446
474
  private streamOnce;
447
475
  private readWithStallGuard;
448
476
  private absorbChunkLine;
477
+ private putItem;
478
+ private deleteItem;
449
479
  private absorbStreamAnchor;
480
+ private takePendingItems;
450
481
  private publishItems;
451
482
  private schedulePublishItems;
452
483
  private cancelScheduledPublishItems;