@aiquants/daily-report 0.29.0 → 0.31.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
@@ -1,9 +1,9 @@
1
1
  import * as react from "react";
2
2
  import { RefObject, ReactNode, Context } from "react";
3
- import { D as DailyReportItem, a as DailyReportUser, b as DailyReportDetail, c as DailyReportSseStreamAnchor } from "./ids-stream-CWuIDrIO.mjs";
3
+ import { D as DailyReportItem, a as DailyReportUser, b as DailyReportDetail } from "./types-DkERw8NE.mjs";
4
4
  import { VirtualScrollLocale, VirtualScrollLabels, VirtualScrollHandle } from "@aiquants/virtualscroll";
5
5
  import { UseReopeningEventSourceResult } from "@aiquants/sse/react";
6
- import { D as DailyReportSseTerminalEvent, a as DailyReportSseMessage, U as UIComment } from "./comment-adapter-lV2ZB_vH.mjs";
6
+ import { D as DailyReportSseTerminalEvent, a as DailyReportSseMessage, U as UIComment, b as DailyReportSseStreamAnchor } from "./ids-stream-DvB2h1dj.mjs";
7
7
  import { ShouldRevalidateFunction } from "react-router";
8
8
  import "zod";
9
9
  type DailyReportAttachmentIndicatorProps = {
@@ -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;
@@ -128,6 +130,8 @@ type DailyReportLabels = VirtualScrollLabels & {
128
130
  readonly isRead: boolean;
129
131
  readonly isStarred: boolean;
130
132
  }) => string;
133
+ readonly listRowPosition: (position: number, total: number) => string;
134
+ readonly listRowPositionInUnknownTotal: (position: number) => string;
131
135
  };
132
136
  type DailyReportLabelOverrides = {
133
137
  readonly [K in keyof DailyReportLabels]?: DailyReportLabels[K];
@@ -226,7 +230,9 @@ declare const DAILY_REPORT_LABEL_KEYS: readonly [
226
230
  "reportSummaryLoadFailed",
227
231
  "interviewerWithAffiliation",
228
232
  "operationFailed",
229
- "rowState"
233
+ "rowState",
234
+ "listRowPosition",
235
+ "listRowPositionInUnknownTotal"
230
236
  ];
231
237
  declare const DAILY_REPORT_LABEL_CATALOGS: Readonly<Record<DailyReportLocale, DailyReportLabels>>;
232
238
  declare const resolveDailyReportLabels: (locale: DailyReportLocale | undefined, overrides: DailyReportLabelOverrides | undefined) => DailyReportLabels;
@@ -332,10 +338,9 @@ declare global {
332
338
  var __DailyReportActionContext: Context<DailyReportActionContextType | null> | undefined;
333
339
  }
334
340
  declare const useDailyReportActionContext: () => DailyReportActionContextType;
335
- declare const DailyReportActionProvider: ({ children, user, initialItems, userId }: {
341
+ declare const DailyReportActionProvider: ({ children, user, userId }: {
336
342
  children: ReactNode;
337
343
  user?: DailyReportUser;
338
- initialItems?: DailyReportItem[];
339
344
  userId?: string | null;
340
345
  }) => react.JSX.Element;
341
346
  declare const DailyReportErrorProvider: ({ children }: {
@@ -376,10 +381,23 @@ declare const createDailyReportClientLoader: <TServerData extends Record<string,
376
381
  }): Promise<TServerData>;
377
382
  hydrate: true;
378
383
  };
384
+ type DailyReportIdsStreamItemReplacement = {
385
+ readonly previous: DailyReportItem;
386
+ readonly next: DailyReportItem;
387
+ };
388
+ type DailyReportIdsStreamItemsChange = {
389
+ readonly base: number;
390
+ readonly revision: number;
391
+ readonly appended: readonly DailyReportItem[];
392
+ readonly replaced: readonly DailyReportIdsStreamItemReplacement[];
393
+ readonly removed: readonly DailyReportItem[];
394
+ };
379
395
  type DailyReportIdsStreamPhase = "idle" | "streaming" | "retrying" | "complete" | "failed" | "auth-required";
380
396
  type DailyReportIdsStreamState = {
381
397
  items: DailyReportItem[];
382
398
  loadedCount: number;
399
+ itemsRevision: number;
400
+ itemsChanges: readonly DailyReportIdsStreamItemsChange[];
383
401
  totalCount: number | null;
384
402
  phase: DailyReportIdsStreamPhase;
385
403
  isRevalidating: boolean;
@@ -400,6 +418,7 @@ type DailyReportIdsStreamClientOptions = {
400
418
  readStallTimeoutMs?: number;
401
419
  warn?: (...args: unknown[]) => void;
402
420
  publishCoalesceMs?: number;
421
+ now?: () => number;
403
422
  };
404
423
  declare class DailyReportIdsStreamClient {
405
424
  private readonly apiBasePath;
@@ -426,7 +445,9 @@ declare class DailyReportIdsStreamClient {
426
445
  private readonly handleOnline;
427
446
  private readonly publishCoalesceMs;
428
447
  private publishCoalesceTimer;
448
+ private readonly now;
429
449
  private lastItemsPublishAt;
450
+ private pendingItemsChange;
430
451
  constructor(options?: DailyReportIdsStreamClientOptions);
431
452
  getState(): DailyReportIdsStreamState;
432
453
  subscribe(listener: () => void): () => void;
@@ -438,13 +459,17 @@ declare class DailyReportIdsStreamClient {
438
459
  resync(): void;
439
460
  applyExternalUpsert(item: DailyReportItem): void;
440
461
  applyExternalRemoval(reportHubId: number): void;
462
+ has(reportHubId: number): boolean;
441
463
  dispose(): void;
442
464
  private runStreamLoop;
443
465
  private pruneUnseenItems;
444
466
  private streamOnce;
445
467
  private readWithStallGuard;
446
468
  private absorbChunkLine;
469
+ private putItem;
470
+ private deleteItem;
447
471
  private absorbStreamAnchor;
472
+ private takePendingItems;
448
473
  private publishItems;
449
474
  private schedulePublishItems;
450
475
  private cancelScheduledPublishItems;
package/dist/client.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import * as react from "react";
2
2
  import { RefObject, ReactNode, Context } from "react";
3
- import { D as DailyReportItem, a as DailyReportUser, b as DailyReportDetail, c as DailyReportSseStreamAnchor } from "./ids-stream-CWuIDrIO.js";
3
+ import { D as DailyReportItem, a as DailyReportUser, b as DailyReportDetail } from "./types-DkERw8NE.js";
4
4
  import { VirtualScrollLocale, VirtualScrollLabels, VirtualScrollHandle } from "@aiquants/virtualscroll";
5
5
  import { UseReopeningEventSourceResult } from "@aiquants/sse/react";
6
- import { D as DailyReportSseTerminalEvent, a as DailyReportSseMessage, U as UIComment } from "./comment-adapter-5bAtR4qb.js";
6
+ import { D as DailyReportSseTerminalEvent, a as DailyReportSseMessage, U as UIComment, b as DailyReportSseStreamAnchor } from "./ids-stream-BR5RSj5u.js";
7
7
  import { ShouldRevalidateFunction } from "react-router";
8
8
  import "zod";
9
9
  type DailyReportAttachmentIndicatorProps = {
@@ -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;
@@ -128,6 +130,8 @@ type DailyReportLabels = VirtualScrollLabels & {
128
130
  readonly isRead: boolean;
129
131
  readonly isStarred: boolean;
130
132
  }) => string;
133
+ readonly listRowPosition: (position: number, total: number) => string;
134
+ readonly listRowPositionInUnknownTotal: (position: number) => string;
131
135
  };
132
136
  type DailyReportLabelOverrides = {
133
137
  readonly [K in keyof DailyReportLabels]?: DailyReportLabels[K];
@@ -226,7 +230,9 @@ declare const DAILY_REPORT_LABEL_KEYS: readonly [
226
230
  "reportSummaryLoadFailed",
227
231
  "interviewerWithAffiliation",
228
232
  "operationFailed",
229
- "rowState"
233
+ "rowState",
234
+ "listRowPosition",
235
+ "listRowPositionInUnknownTotal"
230
236
  ];
231
237
  declare const DAILY_REPORT_LABEL_CATALOGS: Readonly<Record<DailyReportLocale, DailyReportLabels>>;
232
238
  declare const resolveDailyReportLabels: (locale: DailyReportLocale | undefined, overrides: DailyReportLabelOverrides | undefined) => DailyReportLabels;
@@ -332,10 +338,9 @@ declare global {
332
338
  var __DailyReportActionContext: Context<DailyReportActionContextType | null> | undefined;
333
339
  }
334
340
  declare const useDailyReportActionContext: () => DailyReportActionContextType;
335
- declare const DailyReportActionProvider: ({ children, user, initialItems, userId }: {
341
+ declare const DailyReportActionProvider: ({ children, user, userId }: {
336
342
  children: ReactNode;
337
343
  user?: DailyReportUser;
338
- initialItems?: DailyReportItem[];
339
344
  userId?: string | null;
340
345
  }) => react.JSX.Element;
341
346
  declare const DailyReportErrorProvider: ({ children }: {
@@ -376,10 +381,23 @@ declare const createDailyReportClientLoader: <TServerData extends Record<string,
376
381
  }): Promise<TServerData>;
377
382
  hydrate: true;
378
383
  };
384
+ type DailyReportIdsStreamItemReplacement = {
385
+ readonly previous: DailyReportItem;
386
+ readonly next: DailyReportItem;
387
+ };
388
+ type DailyReportIdsStreamItemsChange = {
389
+ readonly base: number;
390
+ readonly revision: number;
391
+ readonly appended: readonly DailyReportItem[];
392
+ readonly replaced: readonly DailyReportIdsStreamItemReplacement[];
393
+ readonly removed: readonly DailyReportItem[];
394
+ };
379
395
  type DailyReportIdsStreamPhase = "idle" | "streaming" | "retrying" | "complete" | "failed" | "auth-required";
380
396
  type DailyReportIdsStreamState = {
381
397
  items: DailyReportItem[];
382
398
  loadedCount: number;
399
+ itemsRevision: number;
400
+ itemsChanges: readonly DailyReportIdsStreamItemsChange[];
383
401
  totalCount: number | null;
384
402
  phase: DailyReportIdsStreamPhase;
385
403
  isRevalidating: boolean;
@@ -400,6 +418,7 @@ type DailyReportIdsStreamClientOptions = {
400
418
  readStallTimeoutMs?: number;
401
419
  warn?: (...args: unknown[]) => void;
402
420
  publishCoalesceMs?: number;
421
+ now?: () => number;
403
422
  };
404
423
  declare class DailyReportIdsStreamClient {
405
424
  private readonly apiBasePath;
@@ -426,7 +445,9 @@ declare class DailyReportIdsStreamClient {
426
445
  private readonly handleOnline;
427
446
  private readonly publishCoalesceMs;
428
447
  private publishCoalesceTimer;
448
+ private readonly now;
429
449
  private lastItemsPublishAt;
450
+ private pendingItemsChange;
430
451
  constructor(options?: DailyReportIdsStreamClientOptions);
431
452
  getState(): DailyReportIdsStreamState;
432
453
  subscribe(listener: () => void): () => void;
@@ -438,13 +459,17 @@ declare class DailyReportIdsStreamClient {
438
459
  resync(): void;
439
460
  applyExternalUpsert(item: DailyReportItem): void;
440
461
  applyExternalRemoval(reportHubId: number): void;
462
+ has(reportHubId: number): boolean;
441
463
  dispose(): void;
442
464
  private runStreamLoop;
443
465
  private pruneUnseenItems;
444
466
  private streamOnce;
445
467
  private readWithStallGuard;
446
468
  private absorbChunkLine;
469
+ private putItem;
470
+ private deleteItem;
447
471
  private absorbStreamAnchor;
472
+ private takePendingItems;
448
473
  private publishItems;
449
474
  private schedulePublishItems;
450
475
  private cancelScheduledPublishItems;