@crvouga/mockingbird-service-posthog 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/CHANGELOG.md +6 -4
- package/dist/{chunk-2W4NW7AB.js → chunk-BLA3BJC5.js} +3 -2
- package/dist/{chunk-2W4NW7AB.js.map → chunk-BLA3BJC5.js.map} +2 -2
- package/dist/{chunk-2FGITTBR.js → chunk-UJEAOIXF.js} +1481 -91
- package/dist/chunk-UJEAOIXF.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +41 -3
- package/dist/index.js +1 -1
- package/dist/server.d.ts +73 -3
- package/dist/server.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-2FGITTBR.js.map +0 -7
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -147,9 +147,15 @@ type ListRecordsOptions<T> = {
|
|
|
147
147
|
*/
|
|
148
148
|
declare class Collection<T> {
|
|
149
149
|
private readonly sqlite;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
/** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
|
|
151
|
+
readonly namespace: string;
|
|
152
|
+
/** Table name inside the namespace. Stable across resets of the rows themselves. */
|
|
153
|
+
readonly collectionName: string;
|
|
154
|
+
constructor(sqlite: SqliteClient$1,
|
|
155
|
+
/** Storage namespace. Admin introspection uses this to ignore another namespace's tables. */
|
|
156
|
+
namespace: string,
|
|
157
|
+
/** Table name inside the namespace. Stable across resets of the rows themselves. */
|
|
158
|
+
collectionName: string);
|
|
153
159
|
private bumpCollectionSeq;
|
|
154
160
|
nextSequence(): number;
|
|
155
161
|
get(id: string): T | undefined;
|
|
@@ -530,6 +536,36 @@ type NamespaceSnapshot = {
|
|
|
530
536
|
}[];
|
|
531
537
|
};
|
|
532
538
|
|
|
539
|
+
declare const STATE_FIELD_KINDS: readonly ["string", "number", "boolean", "null", "object", "array", "unknown"];
|
|
540
|
+
type StateFieldKind = (typeof STATE_FIELD_KINDS)[number];
|
|
541
|
+
/** JSON-safe annotations a bespoke admin UI may read. The default UI shows them as text. */
|
|
542
|
+
type StateMeta = Readonly<Record<string, string | number | boolean | null>>;
|
|
543
|
+
type StateField = {
|
|
544
|
+
name: string;
|
|
545
|
+
kind: StateFieldKind;
|
|
546
|
+
optional: boolean;
|
|
547
|
+
description?: string;
|
|
548
|
+
/** One level of nested object fields. */
|
|
549
|
+
fields?: StateField[];
|
|
550
|
+
meta?: StateMeta;
|
|
551
|
+
};
|
|
552
|
+
type StateCollectionView = {
|
|
553
|
+
name: string;
|
|
554
|
+
label: string;
|
|
555
|
+
description?: string;
|
|
556
|
+
count: number;
|
|
557
|
+
/** `mixed` when a declaration and stored rows both contribute fields. */
|
|
558
|
+
source: "declared" | "inferred" | "mixed";
|
|
559
|
+
fields: StateField[];
|
|
560
|
+
meta?: StateMeta;
|
|
561
|
+
};
|
|
562
|
+
/** The shape of one namespace, for an admin UI that has never seen the service before. */
|
|
563
|
+
type StateView = {
|
|
564
|
+
namespace: string;
|
|
565
|
+
storageNamespace: string;
|
|
566
|
+
collections: StateCollectionView[];
|
|
567
|
+
};
|
|
568
|
+
|
|
533
569
|
type WebhookEndpoint = {
|
|
534
570
|
/** Stable id; generated when omitted. */
|
|
535
571
|
id?: string;
|
|
@@ -656,6 +692,8 @@ type ServiceRuntime<T extends ServiceInstance> = FetchAPI & {
|
|
|
656
692
|
}): void;
|
|
657
693
|
/** Inspect the retained history for a namespace. */
|
|
658
694
|
timeline(namespace?: string): Timeline<ServiceTimelineState>;
|
|
695
|
+
/** Collections in one namespace: declared shape plus what the rows actually hold. */
|
|
696
|
+
state(namespace?: string): StateView;
|
|
659
697
|
};
|
|
660
698
|
|
|
661
699
|
/** Bind values accepted by Mockingbird's SQLite port (matches sqlite-mem / better-sqlite3). */
|
package/dist/index.js
CHANGED
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
|
-
|
|
631
|
-
|
|
632
|
-
|
|
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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crvouga/mockingbird-service-posthog",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Stateful mock of PostHog: /flags v2 and legacy /decide evaluation with per-test flag, variant and payload control, remote config, gzip/base64 capture (/batch/, /e/, /i/v0/e/), recordings intake, and the feature-flag management and HogQL API slice.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|