@crvouga/mockingbird-service-aha 1.3.0 → 1.4.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/cli.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  runCli,
4
4
  serveCommand,
5
5
  serveTarget
6
- } from "./chunk-H6DPSSMR.js";
7
- import "./chunk-7QJZ3SXP.js";
6
+ } from "./chunk-TIPEDV6R.js";
7
+ import "./chunk-WC5YEEUF.js";
8
8
 
9
9
  // src/cli.ts
10
10
  var code = await runCli(
package/dist/index.d.ts CHANGED
@@ -86,9 +86,15 @@ type ListRecordsOptions<T> = {
86
86
  */
87
87
  declare class Collection<T> {
88
88
  private readonly sqlite;
89
- private readonly namespace;
90
- private readonly name;
91
- constructor(sqlite: SqliteClient$1, namespace: string, name: string);
89
+ /** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
90
+ readonly namespace: string;
91
+ /** Table name inside the namespace. Stable across resets of the rows themselves. */
92
+ readonly collectionName: string;
93
+ constructor(sqlite: SqliteClient$1,
94
+ /** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
95
+ namespace: string,
96
+ /** Table name inside the namespace. Stable across resets of the rows themselves. */
97
+ collectionName: string);
92
98
  private bumpCollectionSeq;
93
99
  nextSequence(): number;
94
100
  get(id: string): T | undefined;
@@ -487,6 +493,36 @@ type NamespaceSnapshot = {
487
493
  }[];
488
494
  };
489
495
 
496
+ declare const STATE_FIELD_KINDS: readonly ["string", "number", "boolean", "null", "object", "array", "unknown"];
497
+ type StateFieldKind = (typeof STATE_FIELD_KINDS)[number];
498
+ /** JSON-safe annotations a bespoke admin UI may read. The default UI shows them as text. */
499
+ type StateMeta = Readonly<Record<string, string | number | boolean | null>>;
500
+ type StateField = {
501
+ name: string;
502
+ kind: StateFieldKind;
503
+ optional: boolean;
504
+ description?: string;
505
+ /** One level of nested object fields. */
506
+ fields?: StateField[];
507
+ meta?: StateMeta;
508
+ };
509
+ type StateCollectionView = {
510
+ name: string;
511
+ label: string;
512
+ description?: string;
513
+ count: number;
514
+ /** `mixed` when a declaration and stored rows both contribute fields. */
515
+ source: "declared" | "inferred" | "mixed";
516
+ fields: StateField[];
517
+ meta?: StateMeta;
518
+ };
519
+ /** The shape of one namespace, for an admin UI that has never seen the service before. */
520
+ type StateView = {
521
+ namespace: string;
522
+ storageNamespace: string;
523
+ collections: StateCollectionView[];
524
+ };
525
+
490
526
  type WebhookEndpoint = {
491
527
  /** Stable id; generated when omitted. */
492
528
  id?: string;
@@ -613,6 +649,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
613
649
  }): void;
614
650
  /** Inspect the retained history for a namespace. */
615
651
  timeline(namespace?: string): Timeline<ServiceTimelineState>;
652
+ /** Collections in one namespace: declared shape plus what the rows actually hold. */
653
+ state(namespace?: string): StateView;
616
654
  };
617
655
 
618
656
  /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  verifyAuth,
15
15
  zonedParts,
16
16
  zonedToEpoch
17
- } from "./chunk-7QJZ3SXP.js";
17
+ } from "./chunk-WC5YEEUF.js";
18
18
  export {
19
19
  AHA_NAMESPACE,
20
20
  AHA_PRESETS,
package/dist/server.d.ts CHANGED
@@ -386,6 +386,36 @@ type NamespaceSnapshot$1 = {
386
386
  }[];
387
387
  };
388
388
 
389
+ declare const STATE_FIELD_KINDS$1: readonly ["string", "number", "boolean", "null", "object", "array", "unknown"];
390
+ type StateFieldKind$1 = (typeof STATE_FIELD_KINDS$1)[number];
391
+ /** JSON-safe annotations a bespoke admin UI may read. The default UI shows them as text. */
392
+ type StateMeta$1 = Readonly<Record<string, string | number | boolean | null>>;
393
+ type StateField$1 = {
394
+ name: string;
395
+ kind: StateFieldKind$1;
396
+ optional: boolean;
397
+ description?: string;
398
+ /** One level of nested object fields. */
399
+ fields?: StateField$1[];
400
+ meta?: StateMeta$1;
401
+ };
402
+ type StateCollectionView$1 = {
403
+ name: string;
404
+ label: string;
405
+ description?: string;
406
+ count: number;
407
+ /** `mixed` when a declaration and stored rows both contribute fields. */
408
+ source: "declared" | "inferred" | "mixed";
409
+ fields: StateField$1[];
410
+ meta?: StateMeta$1;
411
+ };
412
+ /** The shape of one namespace, for an admin UI that has never seen the service before. */
413
+ type StateView$1 = {
414
+ namespace: string;
415
+ storageNamespace: string;
416
+ collections: StateCollectionView$1[];
417
+ };
418
+
389
419
  type WebhookEndpoint$1 = {
390
420
  /** Stable id; generated when omitted. */
391
421
  id?: string;
@@ -512,6 +542,8 @@ type ServiceRuntime$1<T extends ServiceInstance$1> = FetchAPI$2 & {
512
542
  }): void;
513
543
  /** Inspect the retained history for a namespace. */
514
544
  timeline(namespace?: string): Timeline$1<ServiceTimelineState$1>;
545
+ /** Collections in one namespace: declared shape plus what the rows actually hold. */
546
+ state(namespace?: string): StateView$1;
515
547
  };
516
548
 
517
549
  type CliOption = {
@@ -627,9 +659,15 @@ type ListRecordsOptions<T> = {
627
659
  */
628
660
  declare class Collection<T> {
629
661
  private readonly sqlite;
630
- private readonly namespace;
631
- private readonly name;
632
- constructor(sqlite: SqliteClient$1, namespace: string, name: string);
662
+ /** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
663
+ readonly namespace: string;
664
+ /** Table name inside the namespace. Stable across resets of the rows themselves. */
665
+ readonly collectionName: string;
666
+ constructor(sqlite: SqliteClient$1,
667
+ /** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
668
+ namespace: string,
669
+ /** Table name inside the namespace. Stable across resets of the rows themselves. */
670
+ collectionName: string);
633
671
  private bumpCollectionSeq;
634
672
  nextSequence(): number;
635
673
  get(id: string): T | undefined;
@@ -1015,6 +1053,36 @@ type NamespaceSnapshot = {
1015
1053
  }[];
1016
1054
  };
1017
1055
 
1056
+ declare const STATE_FIELD_KINDS: readonly ["string", "number", "boolean", "null", "object", "array", "unknown"];
1057
+ type StateFieldKind = (typeof STATE_FIELD_KINDS)[number];
1058
+ /** JSON-safe annotations a bespoke admin UI may read. The default UI shows them as text. */
1059
+ type StateMeta = Readonly<Record<string, string | number | boolean | null>>;
1060
+ type StateField = {
1061
+ name: string;
1062
+ kind: StateFieldKind;
1063
+ optional: boolean;
1064
+ description?: string;
1065
+ /** One level of nested object fields. */
1066
+ fields?: StateField[];
1067
+ meta?: StateMeta;
1068
+ };
1069
+ type StateCollectionView = {
1070
+ name: string;
1071
+ label: string;
1072
+ description?: string;
1073
+ count: number;
1074
+ /** `mixed` when a declaration and stored rows both contribute fields. */
1075
+ source: "declared" | "inferred" | "mixed";
1076
+ fields: StateField[];
1077
+ meta?: StateMeta;
1078
+ };
1079
+ /** The shape of one namespace, for an admin UI that has never seen the service before. */
1080
+ type StateView = {
1081
+ namespace: string;
1082
+ storageNamespace: string;
1083
+ collections: StateCollectionView[];
1084
+ };
1085
+
1018
1086
  type WebhookEndpoint = {
1019
1087
  /** Stable id; generated when omitted. */
1020
1088
  id?: string;
@@ -1141,6 +1209,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
1141
1209
  }): void;
1142
1210
  /** Inspect the retained history for a namespace. */
1143
1211
  timeline(namespace?: string): Timeline<ServiceTimelineState>;
1212
+ /** Collections in one namespace: declared shape plus what the rows actually hold. */
1213
+ state(namespace?: string): StateView;
1144
1214
  };
1145
1215
 
1146
1216
  /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
package/dist/server.js CHANGED
@@ -2,8 +2,8 @@ import {
2
2
  DEFAULT_PORT,
3
3
  createServer,
4
4
  serveTarget
5
- } from "./chunk-H6DPSSMR.js";
6
- import "./chunk-7QJZ3SXP.js";
5
+ } from "./chunk-TIPEDV6R.js";
6
+ import "./chunk-WC5YEEUF.js";
7
7
  export {
8
8
  DEFAULT_PORT,
9
9
  createServer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crvouga/mockingbird-service-aha",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Stateful AHA phlebotomy mock with signed HTTP orders, status webhooks, and a real deterministic SSH/SFTP result server.",
5
5
  "license": "MIT",
6
6
  "type": "module",