carrick 0.3.99 → 0.3.101

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.
@@ -374,10 +374,157 @@ export interface VerifyClientSemanticsRequest extends BaseRequest {
374
374
  /** Checks not reached in time come back `unchecked` with reason `budget`. */
375
375
  budget_ms?: number;
376
376
  }
377
+ /**
378
+ * Where one part of a library call sits: argument `arg` (0-based), or, with
379
+ * `key`, the property `key` of the object passed there (carrick#1616).
380
+ */
381
+ export interface ClaimSlot {
382
+ arg: number;
383
+ key?: string;
384
+ }
385
+ /**
386
+ * A name the call does not carry: the one the maker's `name` slot bound to
387
+ * the instance (`maker`), or the one the scope member bound (`scope`).
388
+ */
389
+ export interface BoundName {
390
+ bound: 'maker' | 'scope';
391
+ }
392
+ /** The closed role list; the role alone picks the checks a claim needs. */
393
+ export type LibraryRole = 'http_client' | 'graphql_client' | 'broker' | 'in_process_bus' | 'socket' | 'server_framework' | 'none';
394
+ /** What an `op` claim does on the wire. */
395
+ export type LibraryOp = 'request' | 'send' | 'receive' | 'execute';
396
+ /** Which receivers an op, scope or reserved name is claimed on. */
397
+ export type ClaimOn = 'export' | 'instance' | 'both';
398
+ /**
399
+ * Whether a string-accepting key of an options type is the name (design D2).
400
+ * Which key is the name is the picker's answer; the verifier checks only that
401
+ * every string-accepting key at the call is accounted for.
402
+ */
403
+ export type KeyLabel = 'name' | 'not_name';
404
+ /** Where a name means something. Carried for the scanner; the verifier never reads it. */
405
+ export interface NameScope {
406
+ scope: 'global' | 'service';
407
+ namespace: string | null;
408
+ }
409
+ /**
410
+ * One claim element, in the shape the store answers (contract on
411
+ * carrick#1564, comment 5937606126, sections 2 and 3, as amendment 2,
412
+ * comment 5939543981, changes it), tagged by `kind`. `picker` and
413
+ * `name_scope` are carried and never read.
414
+ *
415
+ * `on` and `of` say which receivers an op, scope or reserved name applies
416
+ * to, and an element carries at most one of them: `of` is exactly one
417
+ * receiver, by its receiver id (`instance:new`, `instance:connect>scope:channel`);
418
+ * `on` is the export, every instance of every maker, or both.
419
+ */
420
+ export type LibraryClaim = {
421
+ /** How an instance is made: `member(...)` (`call`) or `new member(...)`; `member` null is the export itself. */
422
+ kind: 'make';
423
+ form: 'call' | 'new';
424
+ member: string | null;
425
+ /** An HTTP base URL, or a broker's address. */
426
+ base?: ClaimSlot;
427
+ /** A prefix every name the instance sends gets. */
428
+ prefix?: ClaimSlot;
429
+ /** A definition's id or a queue's name: bound to every op that names `{ bound: 'maker' }`. */
430
+ name?: ClaimSlot;
431
+ handler?: ClaimSlot;
432
+ key_labels?: Record<string, KeyLabel>;
433
+ name_scope?: NameScope;
434
+ picker?: string;
435
+ } | {
436
+ /** A member that returns a receiver bound to a name (a channel, room or queue). */
437
+ kind: 'scope';
438
+ member: string;
439
+ name: ClaimSlot;
440
+ path?: string[];
441
+ on?: ClaimOn;
442
+ of?: string;
443
+ key_labels?: Record<string, KeyLabel>;
444
+ name_scope?: NameScope;
445
+ picker?: string;
446
+ } | {
447
+ kind: 'op';
448
+ op: LibraryOp;
449
+ /** null: the receiver itself (after `path`) is called. */
450
+ member: string | null;
451
+ /** The members walked from the receiver to the object `member` sits on (`client.tasks.trigger`). */
452
+ path?: string[];
453
+ on?: ClaimOn;
454
+ /** The one receiver the op acts on, by its receiver id. */
455
+ of?: string;
456
+ name?: ClaimSlot | BoundName;
457
+ payload?: ClaimSlot;
458
+ handler?: ClaimSlot;
459
+ ack?: ClaimSlot;
460
+ key_labels?: Record<string, KeyLabel>;
461
+ name_scope?: NameScope;
462
+ picker?: string;
463
+ /** HTTP: an options object sits at `arg` (no `key`). */
464
+ options?: ClaimSlot;
465
+ /** HTTP: the method the member always sends. */
466
+ method?: string;
467
+ /** HTTP: where the method sits. */
468
+ method_key?: ClaimSlot;
469
+ } | {
470
+ /** A name the library emits itself, spelled in one of `member`'s parameters. */
471
+ kind: 'reserved';
472
+ member: string;
473
+ name: string;
474
+ path?: string[];
475
+ on?: ClaimOn;
476
+ of?: string;
477
+ picker?: string;
478
+ };
479
+ /**
480
+ * One claim to check against the package's own declarations, on one receiver.
481
+ * The receiver is `export`, `instance:<member>` (what `export.member(...)`
482
+ * returns), `instance:()` (what calling the export returns), `instance:new`
483
+ * (what `new export(...)` builds) or `instance:new:<member>` (what
484
+ * `new export.member(...)` builds), optionally followed by
485
+ * `>scope:<path.member>` (what that scope member returns). The unit is
486
+ * `(claim_id, receiver)`.
487
+ */
488
+ export interface LibraryCheck {
489
+ claim_id: string;
490
+ /** The module specifier as the service imports it (`pkg` or `pkg/sub`). */
491
+ package: string;
492
+ export: string;
493
+ role: LibraryRole;
494
+ receiver: string;
495
+ claim: LibraryClaim;
496
+ }
497
+ /**
498
+ * Check library claims of every role against each package's own
499
+ * declarations (carrick#1616). `verify_client_semantics` answers HTTP claims
500
+ * through the same verifier.
501
+ */
502
+ export interface VerifyLibraryClaimsRequest extends BaseRequest {
503
+ action: 'verify_library_claims';
504
+ from_dir: string;
505
+ checks: LibraryCheck[];
506
+ /** Checks not reached in time come back `unchecked` with reason `budget`; null or absent is the default. */
507
+ budget_ms?: number | null;
508
+ }
509
+ /**
510
+ * List each package's declared surface the way the verifier reads it
511
+ * (carrick#1660): the input a model picks claims from, and the full-surface
512
+ * hash the shared library store keys its answers on.
513
+ */
514
+ export interface ListLibrarySurfaceRequest extends BaseRequest {
515
+ action: 'list_library_surface';
516
+ from_dir: string;
517
+ /** Module specifiers: a package, its subpaths, or a runtime module (`node:events`). */
518
+ packages: string[];
519
+ /** Entries kept per package (exports, receivers, members, signatures, parameters and keys each count one); default 1000. */
520
+ max_entries?: number;
521
+ /** Per package, the only exports to list (the ones the service imports); absent lists every value export. */
522
+ exports?: Record<string, string[]>;
523
+ }
377
524
  /**
378
525
  * Union type for all possible sidecar requests
379
526
  */
380
- export type SidecarRequest = RetypeCheckRequest | VerifyClientSemanticsRequest | InitRequest | BundleRequest | EmitSurfaceRequest | CaptureV2Request | CheckV2Request | InferRequest | BuildWorkspaceRequest | CheckCompatibilityRequest | ResolveDefinitionsRequest | HealthRequest | ShutdownRequest;
527
+ export type SidecarRequest = RetypeCheckRequest | VerifyClientSemanticsRequest | VerifyLibraryClaimsRequest | ListLibrarySurfaceRequest | InitRequest | BundleRequest | EmitSurfaceRequest | CaptureV2Request | CheckV2Request | InferRequest | BuildWorkspaceRequest | CheckCompatibilityRequest | ResolveDefinitionsRequest | HealthRequest | ShutdownRequest;
381
528
  /**
382
529
  * Request for a specific symbol to be bundled
383
530
  */
@@ -613,10 +760,85 @@ export interface VerifyClientSemanticsResponse extends BaseResponse {
613
760
  semantics_modules?: SemanticsModule[];
614
761
  errors?: string[];
615
762
  }
763
+ /** Library-claim verdicts (carrick#1616): the same objects, under the contract's names. */
764
+ export interface VerifyLibraryClaimsResponse extends BaseResponse {
765
+ /** Exactly one per check, in request order. */
766
+ verdicts?: SemanticsResult[];
767
+ modules?: SemanticsModule[];
768
+ /** Wall time of the verification, program build included. */
769
+ duration_ms?: number;
770
+ errors?: string[];
771
+ }
772
+ /** What one parameter position takes, read with the verifier's predicates. */
773
+ export interface SurfaceParam {
774
+ name: string;
775
+ optional: boolean;
776
+ rest: boolean;
777
+ /** The parameter's type as the declarations print it, truncated. */
778
+ type: string;
779
+ accepts_string: boolean;
780
+ /** A function type with a declared signature. */
781
+ function: boolean;
782
+ /** Declared keys, when it is an object type. */
783
+ keys?: SurfaceKey[];
784
+ /** String literals the slot spells (an overload's literal, a `keyof` map's keys). */
785
+ literals?: string[];
786
+ }
787
+ export interface SurfaceKey {
788
+ name: string;
789
+ /** Declared optional (`key?:`). */
790
+ optional: boolean;
791
+ accepts_string: boolean;
792
+ function: boolean;
793
+ }
794
+ export interface SurfaceSignature {
795
+ params: SurfaceParam[];
796
+ returns: string;
797
+ }
798
+ export interface SurfaceMember {
799
+ name: string;
800
+ /** Declared by the receiver's home packages (not only inherited from another package). */
801
+ own: boolean;
802
+ signatures: SurfaceSignature[];
803
+ }
804
+ /** One receiver the verifier can read claims on, in its receiver grammar, with what it declares. */
805
+ export interface SurfaceReceiver {
806
+ receiver: string;
807
+ call?: SurfaceSignature[];
808
+ construct?: SurfaceSignature[];
809
+ members: SurfaceMember[];
810
+ }
811
+ export interface SurfaceExport {
812
+ export: string;
813
+ receivers: SurfaceReceiver[];
814
+ }
815
+ /** One specifier's surface. */
816
+ export interface LibrarySurface {
817
+ package: string;
818
+ resolved_file?: string;
819
+ installed_version?: string;
820
+ /** Why nothing was listed (the verifier's module reasons). */
821
+ reason?: string;
822
+ /** Entries dropped by `max_entries`. */
823
+ truncated: number;
824
+ exports: SurfaceExport[];
825
+ }
826
+ export interface ListLibrarySurfaceResponse extends BaseResponse {
827
+ /** One per requested specifier, in request order. */
828
+ surfaces?: LibrarySurface[];
829
+ /**
830
+ * The full-surface hash: sha256 of the JSON array of `[package, exports]`
831
+ * for every surface that listed at least one export, sorted by `package`.
832
+ * Type text names the request's directory as `<root>`, so the same
833
+ * packages hash the same wherever they are installed.
834
+ */
835
+ surface_sha256?: string;
836
+ errors?: string[];
837
+ }
616
838
  /**
617
839
  * Union type for all possible sidecar responses
618
840
  */
619
- export type SidecarResponse = RetypeCheckResponse | VerifyClientSemanticsResponse | InitResponse | BundleResponse | EmitSurfaceResponse | CaptureV2Response | CheckV2Response | InferResponse | BuildWorkspaceResponse | CheckCompatibilityResponse | ResolveDefinitionsResponse | HealthResponse | ShutdownResponse | ErrorResponse;
841
+ export type SidecarResponse = RetypeCheckResponse | VerifyClientSemanticsResponse | VerifyLibraryClaimsResponse | ListLibrarySurfaceResponse | InitResponse | BundleResponse | EmitSurfaceResponse | CaptureV2Response | CheckV2Response | InferResponse | BuildWorkspaceResponse | CheckCompatibilityResponse | ResolveDefinitionsResponse | HealthResponse | ShutdownResponse | ErrorResponse;
620
842
  /**
621
843
  * An entry in the type manifest
622
844
  */