@crvouga/mockingbird-service-flex 1.2.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-KNQ2MP6O.js";
7
- import "./chunk-UQWTCFIV.js";
6
+ } from "./chunk-BQA5UCJS.js";
7
+ import "./chunk-UKBUYHZN.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;
@@ -469,6 +475,36 @@ type NamespaceSnapshot = {
469
475
  }[];
470
476
  };
471
477
 
478
+ declare const STATE_FIELD_KINDS: readonly ["string", "number", "boolean", "null", "object", "array", "unknown"];
479
+ type StateFieldKind = (typeof STATE_FIELD_KINDS)[number];
480
+ /** JSON-safe annotations a bespoke admin UI may read. The default UI shows them as text. */
481
+ type StateMeta = Readonly<Record<string, string | number | boolean | null>>;
482
+ type StateField = {
483
+ name: string;
484
+ kind: StateFieldKind;
485
+ optional: boolean;
486
+ description?: string;
487
+ /** One level of nested object fields. */
488
+ fields?: StateField[];
489
+ meta?: StateMeta;
490
+ };
491
+ type StateCollectionView = {
492
+ name: string;
493
+ label: string;
494
+ description?: string;
495
+ count: number;
496
+ /** `mixed` when a declaration and stored rows both contribute fields. */
497
+ source: "declared" | "inferred" | "mixed";
498
+ fields: StateField[];
499
+ meta?: StateMeta;
500
+ };
501
+ /** The shape of one namespace, for an admin UI that has never seen the service before. */
502
+ type StateView = {
503
+ namespace: string;
504
+ storageNamespace: string;
505
+ collections: StateCollectionView[];
506
+ };
507
+
472
508
  type WebhookEndpoint = {
473
509
  /** Stable id; generated when omitted. */
474
510
  id?: string;
@@ -595,6 +631,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
595
631
  }): void;
596
632
  /** Inspect the retained history for a namespace. */
597
633
  timeline(namespace?: string): Timeline<ServiceTimelineState>;
634
+ /** Collections in one namespace: declared shape plus what the rows actually hold. */
635
+ state(namespace?: string): StateView;
598
636
  };
599
637
 
600
638
  /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  periodEnd,
21
21
  substituteSessionId,
22
22
  supportedOperationIds
23
- } from "./chunk-UQWTCFIV.js";
23
+ } from "./chunk-UKBUYHZN.js";
24
24
  export {
25
25
  CARDS,
26
26
  CORPUS_ROWS,
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;
@@ -997,6 +1035,36 @@ type NamespaceSnapshot = {
997
1035
  }[];
998
1036
  };
999
1037
 
1038
+ declare const STATE_FIELD_KINDS: readonly ["string", "number", "boolean", "null", "object", "array", "unknown"];
1039
+ type StateFieldKind = (typeof STATE_FIELD_KINDS)[number];
1040
+ /** JSON-safe annotations a bespoke admin UI may read. The default UI shows them as text. */
1041
+ type StateMeta = Readonly<Record<string, string | number | boolean | null>>;
1042
+ type StateField = {
1043
+ name: string;
1044
+ kind: StateFieldKind;
1045
+ optional: boolean;
1046
+ description?: string;
1047
+ /** One level of nested object fields. */
1048
+ fields?: StateField[];
1049
+ meta?: StateMeta;
1050
+ };
1051
+ type StateCollectionView = {
1052
+ name: string;
1053
+ label: string;
1054
+ description?: string;
1055
+ count: number;
1056
+ /** `mixed` when a declaration and stored rows both contribute fields. */
1057
+ source: "declared" | "inferred" | "mixed";
1058
+ fields: StateField[];
1059
+ meta?: StateMeta;
1060
+ };
1061
+ /** The shape of one namespace, for an admin UI that has never seen the service before. */
1062
+ type StateView = {
1063
+ namespace: string;
1064
+ storageNamespace: string;
1065
+ collections: StateCollectionView[];
1066
+ };
1067
+
1000
1068
  type WebhookEndpoint = {
1001
1069
  /** Stable id; generated when omitted. */
1002
1070
  id?: string;
@@ -1123,6 +1191,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
1123
1191
  }): void;
1124
1192
  /** Inspect the retained history for a namespace. */
1125
1193
  timeline(namespace?: string): Timeline<ServiceTimelineState>;
1194
+ /** Collections in one namespace: declared shape plus what the rows actually hold. */
1195
+ state(namespace?: string): StateView;
1126
1196
  };
1127
1197
 
1128
1198
  /** 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-KNQ2MP6O.js";
6
- import "./chunk-UQWTCFIV.js";
5
+ } from "./chunk-BQA5UCJS.js";
6
+ import "./chunk-UKBUYHZN.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-flex",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "Stateful mock of the Flex HSA/FSA payments API: products (recorded catalog corpus), checkout sessions in payment, subscription, off-session and setup modes, subscriptions, customers, setup intents, refunds, the hosted checkout page, and Svix-signed webhooks.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -80,7 +80,7 @@
80
80
  "pack:check": "bun ../../../scripts/pack-check.ts"
81
81
  },
82
82
  "dependencies": {
83
- "@crvouga/mockingbird-service-sqlite": "1.0.0",
83
+ "@crvouga/mockingbird-service-sqlite": "1.1.0",
84
84
  "hono": "4.11.9"
85
85
  },
86
86
  "devDependencies": {