@happyvertical/smrt-types 0.49.3 → 0.49.4

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +320 -0
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -391,6 +391,326 @@ export declare type DataQueryTotal = {
391
391
  reason?: string;
392
392
  };
393
393
 
394
+ export declare interface DataSurfaceActionDescriptor {
395
+ id: string;
396
+ label: string;
397
+ description?: string;
398
+ sensitivity?: DataSurfaceSensitivity;
399
+ selectionScopes: DataSurfaceSelectionScope[];
400
+ requiresConfirmation?: boolean;
401
+ /** Optional column dependencies used by field-policy adapters. */
402
+ columnIds?: string[];
403
+ }
404
+
405
+ /** Preview/apply is a contract only here; server-side adapters execute it. */
406
+ export declare interface DataSurfaceActionRequest {
407
+ version: 1;
408
+ requestId: string;
409
+ identity: DataSurfaceIdentity;
410
+ actionId: string;
411
+ phase: 'preview' | 'apply';
412
+ selection: DataSurfaceSelectionReference;
413
+ payload?: DataSurfaceJsonValue;
414
+ /** Opaque confirmation produced by a prior preview, never an authority. */
415
+ confirmationToken?: string;
416
+ }
417
+
418
+ export declare interface DataSurfaceActionResult {
419
+ version: 1;
420
+ requestId: string;
421
+ identity: DataSurfaceIdentity;
422
+ actionId: string;
423
+ phase: 'preview' | 'apply';
424
+ ok: boolean;
425
+ reason?: string;
426
+ confirmationToken?: string;
427
+ details?: DataSurfaceJsonObject;
428
+ }
429
+
430
+ /** Serializable outcome for one server-resolved row in an action. */
431
+ export declare interface DataSurfaceActionRowOutcome {
432
+ rowId: DataSurfaceRowId;
433
+ status: 'accepted' | 'skipped' | 'failed';
434
+ reason?: string;
435
+ metadata?: DataSurfaceJsonObject;
436
+ }
437
+
438
+ /**
439
+ * Canonical wire request for principal-bound server adapters. A preview can
440
+ * omit the idempotency key; apply requires it at the server boundary.
441
+ */
442
+ export declare interface DataSurfaceActionWireRequest extends DataSurfaceActionRequest {
443
+ expectedRevision: number;
444
+ idempotencyKey?: string;
445
+ }
446
+
447
+ export declare type DataSurfaceColumnCapability = 'read' | 'search' | 'filter' | 'sort' | 'project';
448
+
449
+ export declare interface DataSurfaceColumnDescriptor {
450
+ id: string;
451
+ label: string;
452
+ description?: string;
453
+ sensitivity?: DataSurfaceSensitivity;
454
+ capabilities: DataSurfaceColumnCapability[];
455
+ /** Domain field identity; never accepted as a request path. */
456
+ fieldName?: string;
457
+ /** Effective policy visibility, when a domain adapter supplies one. */
458
+ visibility?: DataSurfaceColumnVisibility;
459
+ /** Stable policy order; domain column ids remain unchanged. */
460
+ order?: number;
461
+ /** Structural columns are preserved even when field policy narrows data columns. */
462
+ role?: DataSurfaceColumnRole;
463
+ /** Responsive adapters consume this without importing DataTable types. */
464
+ responsivePriority?: number;
465
+ /** Per-operation operator allowlists, narrowed by policy adapters. */
466
+ operators?: DataSurfaceColumnOperators;
467
+ /** Explicit aliases for adapters that mirror the canonical query schema. */
468
+ searchOperators?: string[];
469
+ filterOperators?: string[];
470
+ sortOperators?: string[];
471
+ /** Explicit readability is useful when read capability is policy-gated. */
472
+ readable?: boolean;
473
+ }
474
+
475
+ /** Operator allowlists are intentionally strings: #2444 owns query semantics. */
476
+ export declare interface DataSurfaceColumnOperators {
477
+ search?: string[];
478
+ filter?: string[];
479
+ sort?: string[];
480
+ }
481
+
482
+ /** A domain-neutral column role. Adapters use roles to protect structural columns. */
483
+ export declare type DataSurfaceColumnRole = 'data' | 'status' | 'computed' | 'row-key' | 'selection' | 'action';
484
+
485
+ /** Presentation tier emitted by policy-aware domain adapters. */
486
+ export declare type DataSurfaceColumnVisibility = 'basic' | 'advanced' | 'hidden';
487
+
488
+ export declare type DataSurfaceCommandExecution = {
489
+ ok: false;
490
+ } | undefined;
491
+
492
+ export declare type DataSurfaceCommandFailureReason = 'not_found' | 'unsupported' | 'stale_revision' | 'idempotency_conflict' | 'denied' | 'execution_failed' | 'non_monotonic_revision';
493
+
494
+ export declare interface DataSurfaceCommandResult {
495
+ ok: boolean;
496
+ commandId: string;
497
+ identity: DataSurfaceIdentity;
498
+ revision?: number;
499
+ snapshot?: DataSurfaceSnapshot;
500
+ reason?: DataSurfaceCommandFailureReason;
501
+ }
502
+
503
+ /** Public, serializable discovery metadata for a mounted data surface. */
504
+ export declare interface DataSurfaceDescriptor {
505
+ version: 1;
506
+ identity: DataSurfaceIdentity;
507
+ /** Version of the domain adapter's descriptor and view-state schema. */
508
+ schemaVersion: number;
509
+ label: string;
510
+ description?: string;
511
+ /** Stable row-identity column, including when it is not visibly rendered. */
512
+ rowKey: string;
513
+ columns: DataSurfaceColumnDescriptor[];
514
+ query: DataSurfaceQueryCapabilities;
515
+ controls: DataSurfaceVisibleControl[];
516
+ actions: DataSurfaceActionDescriptor[];
517
+ limits: DataSurfaceLimits;
518
+ }
519
+
520
+ /** Stable address for one mounted instance, never an authority boundary. */
521
+ export declare interface DataSurfaceIdentity {
522
+ surfaceId: string;
523
+ kind: DataSurfaceKind;
524
+ subject?: DataSurfaceSubject;
525
+ }
526
+
527
+ export declare type DataSurfaceJsonObject = {
528
+ [key: string]: DataSurfaceJsonValue;
529
+ };
530
+
531
+ /**
532
+ * Transport-neutral data-surface contracts.
533
+ *
534
+ * These declarations describe bounded browser/server action envelopes and
535
+ * mounted-surface metadata. They carry neither authority nor execution:
536
+ * authenticated adapters own both.
537
+ */
538
+ export declare type DataSurfaceJsonPrimitive = string | number | boolean | null;
539
+
540
+ export declare type DataSurfaceJsonValue = DataSurfaceJsonPrimitive | DataSurfaceJsonValue[] | {
541
+ [key: string]: DataSurfaceJsonValue;
542
+ };
543
+
544
+ export declare type DataSurfaceKind = 'table' | 'list' | 'report' | 'custom';
545
+
546
+ /** Per-surface limits; generic envelopes use DATA_SURFACE_MAX_REQUEST_BYTES. */
547
+ export declare interface DataSurfaceLimits {
548
+ maxQueryRows: number;
549
+ maxQueryBytes: number;
550
+ maxSelectionSize: number;
551
+ }
552
+
553
+ export declare interface DataSurfaceQueryCapabilities {
554
+ modes: DataSurfaceQueryMode[];
555
+ /** Explicit allowlist; field paths are not accepted in requests. */
556
+ projectableColumnIds: string[];
557
+ /** Explicit allowlists for non-projection query operations. */
558
+ searchableColumnIds?: string[];
559
+ filterableColumnIds?: string[];
560
+ sortableColumnIds?: string[];
561
+ }
562
+
563
+ /** #2444 owns the canonical query language; this declares only its bounds. */
564
+ export declare type DataSurfaceQueryMode = 'rows' | 'count' | 'facets';
565
+
566
+ /**
567
+ * This intentionally contains only bounded read shape. #2444 adds the
568
+ * canonical filters, ordering, cursors, totals, and normalized result details.
569
+ */
570
+ export declare type DataSurfaceQueryRequest = {
571
+ version: 1;
572
+ requestId: string;
573
+ identity: DataSurfaceIdentity;
574
+ kind: 'rows';
575
+ limit: number;
576
+ cursor?: string;
577
+ projection?: string[];
578
+ } | {
579
+ version: 1;
580
+ requestId: string;
581
+ identity: DataSurfaceIdentity;
582
+ kind: 'count';
583
+ } | {
584
+ version: 1;
585
+ requestId: string;
586
+ identity: DataSurfaceIdentity;
587
+ kind: 'facets';
588
+ columnId: string;
589
+ limit: number;
590
+ };
591
+
592
+ /** Bounded read result shapes; #2444 owns their canonical query semantics. */
593
+ export declare type DataSurfaceQueryResult = (DataSurfaceQueryResultBase & {
594
+ kind: 'rows';
595
+ rowKey: string;
596
+ rows: DataSurfaceJsonObject[];
597
+ hasMore: boolean;
598
+ truncated: boolean;
599
+ nextCursor?: string;
600
+ }) | (DataSurfaceQueryResultBase & {
601
+ kind: 'count';
602
+ count: number;
603
+ }) | (DataSurfaceQueryResultBase & {
604
+ kind: 'facets';
605
+ columnId: string;
606
+ facets: Array<{
607
+ value: DataSurfaceJsonPrimitive;
608
+ count: number;
609
+ }>;
610
+ truncated: boolean;
611
+ });
612
+
613
+ declare interface DataSurfaceQueryResultBase {
614
+ version: 1;
615
+ requestId: string;
616
+ identity: DataSurfaceIdentity;
617
+ revision: number;
618
+ }
619
+
620
+ /** Runtime-only handle supplied by a mounted renderer or controller. */
621
+ export declare interface DataSurfaceRegistration {
622
+ descriptor: DataSurfaceDescriptor;
623
+ getSnapshot: () => DataSurfaceSnapshotState;
624
+ execute?: (command: DataSurfaceVisibleCommand) => DataSurfaceCommandExecution | Promise<DataSurfaceCommandExecution>;
625
+ /**
626
+ * A host-owned redaction boundary. It cannot change identity or revision and
627
+ * the registry validates its output before exposing it.
628
+ */
629
+ redact?: (snapshot: DataSurfaceSnapshot) => DataSurfaceSnapshot;
630
+ }
631
+
632
+ export declare interface DataSurfaceRegistry {
633
+ register(registration: DataSurfaceRegistration): () => void;
634
+ unregister(identity: DataSurfaceIdentity): void;
635
+ list(): DataSurfaceDescriptor[];
636
+ inspect(identity: DataSurfaceIdentity): DataSurfaceSnapshot | undefined;
637
+ execute(command: DataSurfaceVisibleCommand): Promise<DataSurfaceCommandResult>;
638
+ validateQuery(request: DataSurfaceQueryRequest): DataSurfaceValidationResult;
639
+ validateAction(request: DataSurfaceActionRequest): DataSurfaceValidationResult;
640
+ subscribe(listener: (event: DataSurfaceRegistryEvent) => void): () => void;
641
+ }
642
+
643
+ export declare interface DataSurfaceRegistryEvent {
644
+ type: 'registered' | 'unregistered' | 'command';
645
+ sequence: number;
646
+ identity: DataSurfaceIdentity;
647
+ revision: number;
648
+ command?: DataSurfaceVisibleCommand;
649
+ result?: DataSurfaceCommandResult;
650
+ }
651
+
652
+ export declare type DataSurfaceRowId = string | number;
653
+
654
+ export declare type DataSurfaceSelectionReference = {
655
+ scope: 'current-page';
656
+ } | {
657
+ scope: 'explicit-ids';
658
+ rowIds: DataSurfaceRowId[];
659
+ } | {
660
+ scope: 'all-matching';
661
+ queryFingerprint: string;
662
+ };
663
+
664
+ export declare type DataSurfaceSelectionScope = 'current-page' | 'explicit-ids' | 'all-matching';
665
+
666
+ export declare type DataSurfaceSensitivity = 'public' | 'personal' | 'sensitive' | 'secret';
667
+
668
+ /** Deterministic inspect/result envelope. It intentionally has no timestamp. */
669
+ export declare interface DataSurfaceSnapshot {
670
+ version: 1;
671
+ descriptor: DataSurfaceDescriptor;
672
+ revision: number;
673
+ state: DataSurfaceJsonObject;
674
+ selection: DataSurfaceSelectionReference | null;
675
+ }
676
+
677
+ /** Input supplied by a mounted renderer/controller, before registry wrapping. */
678
+ export declare interface DataSurfaceSnapshotState {
679
+ revision: number;
680
+ state: DataSurfaceJsonObject;
681
+ selection?: DataSurfaceSelectionReference | null;
682
+ }
683
+
684
+ export declare interface DataSurfaceSubject {
685
+ type: string;
686
+ id: string;
687
+ label?: string;
688
+ }
689
+
690
+ export declare type DataSurfaceValidationReason = 'not_found' | 'unsupported' | 'invalid_request' | 'limit_exceeded' | 'projection_not_allowed' | 'selection_not_supported' | 'confirmation_required';
691
+
692
+ export declare interface DataSurfaceValidationResult {
693
+ ok: boolean;
694
+ reason?: DataSurfaceValidationReason;
695
+ }
696
+
697
+ /** A browser-visible state transition, not a server-side query or mutation. */
698
+ export declare interface DataSurfaceVisibleCommand {
699
+ version: 1;
700
+ commandId: string;
701
+ identity: DataSurfaceIdentity;
702
+ expectedRevision: number;
703
+ controlId: string;
704
+ payload?: DataSurfaceJsonValue;
705
+ }
706
+
707
+ export declare interface DataSurfaceVisibleControl {
708
+ /** Stable command name accepted by the mounted surface. */
709
+ id: string;
710
+ label: string;
711
+ description?: string;
712
+ }
713
+
394
714
  /**
395
715
  * The package's declared agent-addressable surface beyond its generated model
396
716
  * tools (#2591).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-types",
3
- "version": "0.49.3",
3
+ "version": "0.49.4",
4
4
  "description": "Shared type definitions for the HAVE SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",