@nivaro/react 0.2.12 → 0.2.14

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/index.d.ts CHANGED
@@ -300,6 +300,19 @@ export declare interface ApiVersionInfo {
300
300
 
301
301
  export declare function applyValidationRule(rule: FormValidationRule_2, value: unknown, label: string, record?: Record<string, unknown>): string | null;
302
302
 
303
+ /**
304
+ * "As it was" (#1385): the record as it stood when the notification was sent
305
+ * beside the record now — two columns, the fields that moved since marked
306
+ * with an amber dot and listed first. Scalar + link fields only; the server
307
+ * narrows both sides to what the viewer may read NOW. Needs `<NivaroProvider>`.
308
+ */
309
+ export declare function AsItWasSheet({ notificationId, title, onClose }: {
310
+ notificationId: number | null;
311
+ /** The notification's subject — the sheet's eyebrow. */
312
+ title?: string | null;
313
+ onClose: () => void;
314
+ }): JSX.Element;
315
+
303
316
  /**
304
317
  * "Fill from a document" — a person drops a statement of work, a quote, a
305
318
  * spreadsheet on a NEW record and reviews what the model read out of it
@@ -1433,6 +1446,10 @@ export declare interface DataTableProps<T = Record<string, unknown>> {
1433
1446
 
1434
1447
  export declare function DateField({ field, value, onChange, error, disabled, readOnly, inputId, errorId }: FieldComponentProps): JSX.Element;
1435
1448
 
1449
+ export declare function DbTuningView({ onNotice }: {
1450
+ onNotice?: Notice;
1451
+ }): JSX.Element;
1452
+
1436
1453
  /** Decoder for `?prefill=` (base64 → JSON), tolerant of '+' arriving as ' '. */
1437
1454
  export declare function decodePrefill(raw: string | null | undefined): Record<string, unknown> | null;
1438
1455
 
@@ -3950,6 +3967,8 @@ export declare function NivaroProvider({ client, children }: {
3950
3967
  */
3951
3968
  export declare function normalizeFieldType(rawType: string, iface: string | null, relation: FormFieldDescriptor['relation']): FormFieldType;
3952
3969
 
3970
+ declare type Notice = (message: string, tone?: 'error' | 'success') => void;
3971
+
3953
3972
  export declare function NotificationActions({ actions, notificationId, onDone, onError, size, className }: NotificationActionsProps): JSX.Element | null;
3954
3973
 
3955
3974
  /** An inline action the server says is safe to fire from a click. */
@@ -4048,6 +4067,33 @@ export declare interface NotificationBellProps {
4048
4067
  tabBadge?: boolean;
4049
4068
  }
4050
4069
 
4070
+ /**
4071
+ * Record bundles (#1256): the server's `bundle=record` grouping of a page —
4072
+ * every row that names the same record folded into one entry. The rows ride
4073
+ * along so the expand list needs no second request.
4074
+ */
4075
+ export declare interface NotificationBundle<R = unknown> {
4076
+ collection: string;
4077
+ item: string;
4078
+ /** The record's headline — friendly id, display label, or (deleted) its
4079
+ * trash snapshot's label. Only a client-side fold shows a raw id. */
4080
+ label: string;
4081
+ /** The record no longer exists: no Open, a "deleted" chip. */
4082
+ deleted?: boolean;
4083
+ /** "Region" — the collection's singular name for a chip beside the label. */
4084
+ collection_label?: string | null;
4085
+ count: number;
4086
+ unread: number;
4087
+ lane: NotificationLane;
4088
+ categories: string[];
4089
+ newest: string | null;
4090
+ /** The server's URL for the recipient's app — the fallback when the host
4091
+ * has no record route. */
4092
+ url: string | null;
4093
+ ids: number[];
4094
+ rows: R[];
4095
+ }
4096
+
4051
4097
  export declare function NotificationCenterView({ routes, onNavigate, app, mailLogUrl, subscriptionsPath, onNotice, onError, className }: NotificationCenterViewProps): JSX.Element;
4052
4098
 
4053
4099
  export declare interface NotificationCenterViewProps {
@@ -5336,7 +5382,7 @@ export declare interface QueueRealtimeAdapter {
5336
5382
  subscribe: (collections: string[], onUpdate: () => void) => () => void;
5337
5383
  }
5338
5384
 
5339
- export declare function QueueWorklist({ queueId, realtime, renderError, hideCreateActions }: QueueWorklistProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | ReactPortal | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | JSX.Element | null;
5385
+ export declare function QueueWorklist({ queueId, realtime, renderError, hideCreateActions, onAsk }: QueueWorklistProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | ReactPortal | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | JSX.Element | null;
5340
5386
 
5341
5387
  export declare interface QueueWorklistProps {
5342
5388
  queueId: string;
@@ -5347,6 +5393,13 @@ export declare interface QueueWorklistProps {
5347
5393
  * everywhere; a list hides them only when every collection the queue can
5348
5394
  * create in is on it (the header covers those, not the rest). */
5349
5395
  hideCreateActions?: boolean | string[];
5396
+ /** Hosts with an Ask AI page pass this: the toolbar gains "Ask about this
5397
+ * queue" (#1276), which hands the queue over so the host can open Ask AI
5398
+ * with the question seeded. Absent = no button. */
5399
+ onAsk?: (queue: {
5400
+ id: string;
5401
+ name: string;
5402
+ }) => void;
5350
5403
  }
5351
5404
 
5352
5405
  export declare function QueueWorkloadView({ queueId }: {
@@ -6710,6 +6763,97 @@ export declare function translateScopeValues(client: {
6710
6763
  target_collection: string;
6711
6764
  }, ids: Array<string | number>, valueField?: string): Promise<Array<string | number>>;
6712
6765
 
6766
+ /**
6767
+ * Database tuning (#996): what the nightly observer proposed, the proof behind each proposal,
6768
+ * and the one-click Apply / Roll back / Dismiss / Re-prove. Propose-only — nothing changes until
6769
+ * an administrator clicks; the request carries the proposal id, never a statement.
6770
+ */
6771
+ declare type TuningKind = 'index_create' | 'index_drop' | 'proc_rewrite' | 'rollup_store' | 'query_cache';
6772
+
6773
+ declare interface TuningProof {
6774
+ passed: boolean;
6775
+ method: string;
6776
+ before: Record<string, number | string | null>;
6777
+ after: Record<string, number | string | null>;
6778
+ detail: string;
6779
+ rows_diff?: Array<{
6780
+ set: number;
6781
+ added: string[];
6782
+ removed: string[];
6783
+ }>;
6784
+ watch?: Array<{
6785
+ at: string;
6786
+ value: number | null;
6787
+ }>;
6788
+ }
6789
+
6790
+ /** Mirror of the API's ProposalRow. */
6791
+ export declare interface TuningProposal {
6792
+ id: string;
6793
+ kind: TuningKind;
6794
+ target: string;
6795
+ fingerprint: string;
6796
+ status: TuningStatus;
6797
+ title: string;
6798
+ evidence: Record<string, unknown>;
6799
+ proof: TuningProof | null;
6800
+ estimate_ms_per_day: number;
6801
+ risk: 'reversible' | 'review';
6802
+ replicated: boolean;
6803
+ dialect_note: string | null;
6804
+ apply: Record<string, unknown>;
6805
+ undo: Record<string, unknown>;
6806
+ applied_at: string | null;
6807
+ applied_by: string | null;
6808
+ watch_until: string | null;
6809
+ watch_baseline: {
6810
+ before: Record<string, number | null>;
6811
+ after: Record<string, number | null>;
6812
+ } | null;
6813
+ rolled_back_at: string | null;
6814
+ rollback_reason: string | null;
6815
+ dismissed_at: string | null;
6816
+ dismissed_by: string | null;
6817
+ dismiss_note: string | null;
6818
+ first_seen: string;
6819
+ last_seen: string;
6820
+ run_id: number | null;
6821
+ }
6822
+
6823
+ declare interface TuningSettings {
6824
+ enabled: boolean;
6825
+ ai_rewrites: boolean;
6826
+ min_estimate_ms_per_day: number;
6827
+ watch_days: number;
6828
+ regression_pct: number;
6829
+ proc_timeout_minutes: number;
6830
+ ai_daily_budget_usd: number;
6831
+ }
6832
+
6833
+ declare type TuningStatus = 'proposed' | 'rejected_by_proof' | 'stale' | 'applying' | 'watching' | 'applied' | 'rolled_back' | 'dismissed' | 'failed';
6834
+
6835
+ /** GET /db-tuning. */
6836
+ export declare interface TuningSummary {
6837
+ settings: TuningSettings;
6838
+ by_status: Record<string, number>;
6839
+ by_kind: Record<string, number>;
6840
+ open_estimate_ms_per_day: number;
6841
+ applied_30d: number;
6842
+ last_run: {
6843
+ id: number;
6844
+ started_at: string;
6845
+ status: string;
6846
+ outcome: string | null;
6847
+ error: string | null;
6848
+ } | null;
6849
+ is_running: boolean;
6850
+ observers: Array<{
6851
+ id: string;
6852
+ owner: string;
6853
+ kind: string;
6854
+ }>;
6855
+ }
6856
+
6713
6857
  /** What is unsaved right now — the leave-page prompt, the changes tray and
6714
6858
  * the host's own dirty indicator all read this one breakdown. */
6715
6859
  declare interface UnsavedSummary {