@crvouga/mockingbird-service-payload-cms 1.3.0 → 1.5.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-VQD2J3NH.js";
7
- import "./chunk-BB273WDT.js";
6
+ } from "./chunk-3OUYZQTC.js";
7
+ import "./chunk-7HS4CTPK.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;
@@ -457,6 +463,36 @@ type NamespaceSnapshot = {
457
463
  }[];
458
464
  };
459
465
 
466
+ declare const STATE_FIELD_KINDS: readonly ["string", "number", "boolean", "null", "object", "array", "unknown"];
467
+ type StateFieldKind = (typeof STATE_FIELD_KINDS)[number];
468
+ /** JSON-safe annotations a bespoke admin UI may read. The default UI shows them as text. */
469
+ type StateMeta = Readonly<Record<string, string | number | boolean | null>>;
470
+ type StateField = {
471
+ name: string;
472
+ kind: StateFieldKind;
473
+ optional: boolean;
474
+ description?: string;
475
+ /** One level of nested object fields. */
476
+ fields?: StateField[];
477
+ meta?: StateMeta;
478
+ };
479
+ type StateCollectionView = {
480
+ name: string;
481
+ label: string;
482
+ description?: string;
483
+ count: number;
484
+ /** `mixed` when a declaration and stored rows both contribute fields. */
485
+ source: "declared" | "inferred" | "mixed";
486
+ fields: StateField[];
487
+ meta?: StateMeta;
488
+ };
489
+ /** The shape of one namespace, for an admin UI that has never seen the service before. */
490
+ type StateView = {
491
+ namespace: string;
492
+ storageNamespace: string;
493
+ collections: StateCollectionView[];
494
+ };
495
+
460
496
  type WebhookEndpoint = {
461
497
  /** Stable id; generated when omitted. */
462
498
  id?: string;
@@ -583,6 +619,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
583
619
  }): void;
584
620
  /** Inspect the retained history for a namespace. */
585
621
  timeline(namespace?: string): Timeline<ServiceTimelineState>;
622
+ /** Collections in one namespace: declared shape plus what the rows actually hold. */
623
+ state(namespace?: string): StateView;
586
624
  };
587
625
 
588
626
  /** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  payloadCredential,
12
12
  payloadError,
13
13
  supportedOperationIds
14
- } from "./chunk-BB273WDT.js";
14
+ } from "./chunk-7HS4CTPK.js";
15
15
  export {
16
16
  DEFAULT_MARKETING_DOCS,
17
17
  MARKETING_FIELDS,
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;
@@ -985,6 +1023,36 @@ type NamespaceSnapshot = {
985
1023
  }[];
986
1024
  };
987
1025
 
1026
+ declare const STATE_FIELD_KINDS: readonly ["string", "number", "boolean", "null", "object", "array", "unknown"];
1027
+ type StateFieldKind = (typeof STATE_FIELD_KINDS)[number];
1028
+ /** JSON-safe annotations a bespoke admin UI may read. The default UI shows them as text. */
1029
+ type StateMeta = Readonly<Record<string, string | number | boolean | null>>;
1030
+ type StateField = {
1031
+ name: string;
1032
+ kind: StateFieldKind;
1033
+ optional: boolean;
1034
+ description?: string;
1035
+ /** One level of nested object fields. */
1036
+ fields?: StateField[];
1037
+ meta?: StateMeta;
1038
+ };
1039
+ type StateCollectionView = {
1040
+ name: string;
1041
+ label: string;
1042
+ description?: string;
1043
+ count: number;
1044
+ /** `mixed` when a declaration and stored rows both contribute fields. */
1045
+ source: "declared" | "inferred" | "mixed";
1046
+ fields: StateField[];
1047
+ meta?: StateMeta;
1048
+ };
1049
+ /** The shape of one namespace, for an admin UI that has never seen the service before. */
1050
+ type StateView = {
1051
+ namespace: string;
1052
+ storageNamespace: string;
1053
+ collections: StateCollectionView[];
1054
+ };
1055
+
988
1056
  type WebhookEndpoint = {
989
1057
  /** Stable id; generated when omitted. */
990
1058
  id?: string;
@@ -1111,6 +1179,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI$1 & {
1111
1179
  }): void;
1112
1180
  /** Inspect the retained history for a namespace. */
1113
1181
  timeline(namespace?: string): Timeline<ServiceTimelineState>;
1182
+ /** Collections in one namespace: declared shape plus what the rows actually hold. */
1183
+ state(namespace?: string): StateView;
1114
1184
  };
1115
1185
 
1116
1186
  /** 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-VQD2J3NH.js";
6
- import "./chunk-BB273WDT.js";
5
+ } from "./chunk-3OUYZQTC.js";
6
+ import "./chunk-7HS4CTPK.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-payload-cms",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "Stateful mock of the Payload CMS collection REST API: paginated finds with a where-query subset, find by id, a seeded marketing collection and admin-editable documents.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -55,7 +55,7 @@
55
55
  "website": "https://payloadcms.com",
56
56
  "docs": "https://payloadcms.com/docs/rest-api/overview"
57
57
  },
58
- "status": "wip",
58
+ "parity": "Collection REST",
59
59
  "parityTier": "cold"
60
60
  },
61
61
  "scripts": {
@@ -71,7 +71,7 @@
71
71
  "pack:check": "bun ../../../scripts/pack-check.ts"
72
72
  },
73
73
  "dependencies": {
74
- "@crvouga/mockingbird-service-sqlite": "1.1.0",
74
+ "@crvouga/mockingbird-service-sqlite": "1.2.0",
75
75
  "hono": "4.11.9"
76
76
  },
77
77
  "devDependencies": {