@crvouga/mockingbird-service-posthog 2.1.0 → 2.3.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 +36 -4
- package/README.md +9 -3
- package/SUPPORT.md +8 -3
- package/dist/chunk-DBFEFLR4.js +4175 -0
- package/dist/chunk-DBFEFLR4.js.map +7 -0
- package/dist/{chunk-SCY2VOTE.js → chunk-NCOO3LKB.js} +2 -2
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +172 -150
- package/dist/index.js +1 -1
- package/dist/server.d.ts +358 -332
- package/dist/server.js +2 -2
- package/openapi.yaml +168 -1
- package/package.json +2 -2
- package/dist/chunk-VZ3ZHVNW.js +0 -3821
- package/dist/chunk-VZ3ZHVNW.js.map +0 -7
- /package/dist/{chunk-SCY2VOTE.js.map → chunk-NCOO3LKB.js.map} +0 -0
package/dist/server.js
CHANGED
package/openapi.yaml
CHANGED
|
@@ -5,7 +5,7 @@ info:
|
|
|
5
5
|
Stateful mock subset of PostHog: remote flag evaluation (`/flags` v2 and the legacy
|
|
6
6
|
`/decide` shape), remote config, event capture (`/batch/`, `/e/`, `/i/v0/e/`), session
|
|
7
7
|
recording intake, the posthog-js asset and survey endpoints, and the slice of the
|
|
8
|
-
management API our tooling and crons call (feature-flag list/create/patch, HogQL query).
|
|
8
|
+
management API our tooling and crons call (feature-flag list/create/read/patch, experiment management, HogQL query).
|
|
9
9
|
Hand-authored from the wire shapes of posthog-node 5.52.2 / @posthog/core 1.54.0,
|
|
10
10
|
posthog-js 1.433.2 and our own raw fetches.
|
|
11
11
|
|
|
@@ -498,6 +498,21 @@ paths:
|
|
|
498
498
|
x-mockingbird-resource-ref:
|
|
499
499
|
type: feature_flag
|
|
500
500
|
missing: "999999"
|
|
501
|
+
get:
|
|
502
|
+
operationId: GetFeatureFlag
|
|
503
|
+
security:
|
|
504
|
+
- bearerAuth: []
|
|
505
|
+
x-mockingbird:
|
|
506
|
+
supported: true
|
|
507
|
+
parity: { enabled: true, safe: true }
|
|
508
|
+
responses:
|
|
509
|
+
"200":
|
|
510
|
+
description: Current flag by numeric id (or mock key alias)
|
|
511
|
+
content:
|
|
512
|
+
application/json:
|
|
513
|
+
schema: { $ref: "#/components/schemas/FeatureFlag" }
|
|
514
|
+
"401": { $ref: "#/components/responses/ManagementError" }
|
|
515
|
+
"404": { $ref: "#/components/responses/ManagementError" }
|
|
501
516
|
patch:
|
|
502
517
|
operationId: UpdateFeatureFlag
|
|
503
518
|
security:
|
|
@@ -538,6 +553,115 @@ paths:
|
|
|
538
553
|
application/json:
|
|
539
554
|
schema:
|
|
540
555
|
$ref: "#/components/schemas/ErrorBody"
|
|
556
|
+
/api/projects/{projectId}/experiments:
|
|
557
|
+
parameters:
|
|
558
|
+
- $ref: "#/components/parameters/ProjectId"
|
|
559
|
+
get:
|
|
560
|
+
operationId: ListExperiments
|
|
561
|
+
security:
|
|
562
|
+
- bearerAuth: []
|
|
563
|
+
x-mockingbird:
|
|
564
|
+
supported: true
|
|
565
|
+
parity: { enabled: true, safe: true }
|
|
566
|
+
parameters:
|
|
567
|
+
- name: limit
|
|
568
|
+
in: query
|
|
569
|
+
schema: { type: integer, minimum: 1, maximum: 100, default: 100 }
|
|
570
|
+
- name: offset
|
|
571
|
+
in: query
|
|
572
|
+
schema: { type: integer, minimum: 0, maximum: 1000, default: 0 }
|
|
573
|
+
responses:
|
|
574
|
+
"200":
|
|
575
|
+
description: Newest experiments first, with limit/offset links
|
|
576
|
+
content:
|
|
577
|
+
application/json:
|
|
578
|
+
schema:
|
|
579
|
+
type: object
|
|
580
|
+
required: [count, next, previous, results]
|
|
581
|
+
properties:
|
|
582
|
+
count: { type: integer }
|
|
583
|
+
next:
|
|
584
|
+
type: [string, "null"]
|
|
585
|
+
x-mockingbird-volatile: { kind: url }
|
|
586
|
+
previous:
|
|
587
|
+
type: [string, "null"]
|
|
588
|
+
x-mockingbird-volatile: { kind: url }
|
|
589
|
+
results:
|
|
590
|
+
type: array
|
|
591
|
+
items: { $ref: "#/components/schemas/Experiment" }
|
|
592
|
+
"400": { $ref: "#/components/responses/ManagementError" }
|
|
593
|
+
"401": { $ref: "#/components/responses/ManagementError" }
|
|
594
|
+
post:
|
|
595
|
+
operationId: CreateExperiment
|
|
596
|
+
security:
|
|
597
|
+
- bearerAuth: []
|
|
598
|
+
x-mockingbird:
|
|
599
|
+
supported: true
|
|
600
|
+
parity: { enabled: true, safe: false }
|
|
601
|
+
requestBody:
|
|
602
|
+
required: true
|
|
603
|
+
content:
|
|
604
|
+
application/json:
|
|
605
|
+
schema:
|
|
606
|
+
allOf:
|
|
607
|
+
- $ref: "#/components/schemas/ExperimentWrite"
|
|
608
|
+
- type: object
|
|
609
|
+
required: [name, feature_flag_key]
|
|
610
|
+
properties:
|
|
611
|
+
feature_flag_key: { type: string, pattern: "^[A-Za-z0-9_-]{1,64}$" }
|
|
612
|
+
responses:
|
|
613
|
+
"201":
|
|
614
|
+
description: Experiment with a linked flag; new draft flags are inactive
|
|
615
|
+
content:
|
|
616
|
+
application/json:
|
|
617
|
+
schema: { $ref: "#/components/schemas/Experiment" }
|
|
618
|
+
"400": { $ref: "#/components/responses/ManagementError" }
|
|
619
|
+
"401": { $ref: "#/components/responses/ManagementError" }
|
|
620
|
+
/api/projects/{projectId}/experiments/{experimentId}:
|
|
621
|
+
parameters:
|
|
622
|
+
- $ref: "#/components/parameters/ProjectId"
|
|
623
|
+
- name: experimentId
|
|
624
|
+
in: path
|
|
625
|
+
required: true
|
|
626
|
+
schema:
|
|
627
|
+
type: string
|
|
628
|
+
pattern: "^[0-9]{1,6}$"
|
|
629
|
+
get:
|
|
630
|
+
operationId: GetExperiment
|
|
631
|
+
security:
|
|
632
|
+
- bearerAuth: []
|
|
633
|
+
x-mockingbird:
|
|
634
|
+
supported: true
|
|
635
|
+
parity: { enabled: true, safe: true }
|
|
636
|
+
responses:
|
|
637
|
+
"200":
|
|
638
|
+
description: Persisted experiment with the current linked flag
|
|
639
|
+
content:
|
|
640
|
+
application/json:
|
|
641
|
+
schema: { $ref: "#/components/schemas/Experiment" }
|
|
642
|
+
"401": { $ref: "#/components/responses/ManagementError" }
|
|
643
|
+
"404": { $ref: "#/components/responses/ManagementError" }
|
|
644
|
+
patch:
|
|
645
|
+
operationId: UpdateExperiment
|
|
646
|
+
security:
|
|
647
|
+
- bearerAuth: []
|
|
648
|
+
x-mockingbird:
|
|
649
|
+
supported: true
|
|
650
|
+
parity: { enabled: true, safe: false }
|
|
651
|
+
requestBody:
|
|
652
|
+
required: true
|
|
653
|
+
content:
|
|
654
|
+
application/json:
|
|
655
|
+
schema: { $ref: "#/components/schemas/ExperimentWrite" }
|
|
656
|
+
responses:
|
|
657
|
+
"200":
|
|
658
|
+
description: Only provided fields change; setting start_date activates a draft's flag
|
|
659
|
+
content:
|
|
660
|
+
application/json:
|
|
661
|
+
schema: { $ref: "#/components/schemas/Experiment" }
|
|
662
|
+
"400": { $ref: "#/components/responses/ManagementError" }
|
|
663
|
+
"401": { $ref: "#/components/responses/ManagementError" }
|
|
664
|
+
"404": { $ref: "#/components/responses/ManagementError" }
|
|
541
665
|
/api/projects/{projectId}/query:
|
|
542
666
|
parameters:
|
|
543
667
|
- $ref: "#/components/parameters/ProjectId"
|
|
@@ -579,6 +703,12 @@ paths:
|
|
|
579
703
|
schema:
|
|
580
704
|
$ref: "#/components/schemas/ErrorBody"
|
|
581
705
|
components:
|
|
706
|
+
responses:
|
|
707
|
+
ManagementError:
|
|
708
|
+
description: Management API error
|
|
709
|
+
content:
|
|
710
|
+
application/json:
|
|
711
|
+
schema: { $ref: "#/components/schemas/ErrorBody" }
|
|
582
712
|
securitySchemes:
|
|
583
713
|
bearerAuth:
|
|
584
714
|
type: http
|
|
@@ -620,6 +750,43 @@ components:
|
|
|
620
750
|
minimum: 1
|
|
621
751
|
maximum: 999999999
|
|
622
752
|
schemas:
|
|
753
|
+
ExperimentWrite:
|
|
754
|
+
type: object
|
|
755
|
+
properties:
|
|
756
|
+
name: { type: string, minLength: 1, maxLength: 120 }
|
|
757
|
+
parameters: { type: object }
|
|
758
|
+
metrics:
|
|
759
|
+
type: array
|
|
760
|
+
maxItems: 5
|
|
761
|
+
items: { type: object }
|
|
762
|
+
start_date: { type: [string, "null"], format: date-time }
|
|
763
|
+
end_date: { type: [string, "null"], format: date-time }
|
|
764
|
+
archived: { type: boolean }
|
|
765
|
+
Experiment:
|
|
766
|
+
type: object
|
|
767
|
+
required: [id, name, feature_flag_key, feature_flag, parameters, metrics, start_date, end_date, archived, created_at, updated_at]
|
|
768
|
+
properties:
|
|
769
|
+
id:
|
|
770
|
+
type: integer
|
|
771
|
+
name: { type: string }
|
|
772
|
+
feature_flag_key: { type: string }
|
|
773
|
+
feature_flag:
|
|
774
|
+
oneOf:
|
|
775
|
+
- $ref: "#/components/schemas/FeatureFlag"
|
|
776
|
+
- type: "null"
|
|
777
|
+
parameters: { type: object }
|
|
778
|
+
metrics:
|
|
779
|
+
type: array
|
|
780
|
+
items: { type: object }
|
|
781
|
+
start_date: { type: [string, "null"] }
|
|
782
|
+
end_date: { type: [string, "null"] }
|
|
783
|
+
archived: { type: boolean }
|
|
784
|
+
created_at:
|
|
785
|
+
type: string
|
|
786
|
+
x-mockingbird-volatile: { kind: timestamp }
|
|
787
|
+
updated_at:
|
|
788
|
+
type: string
|
|
789
|
+
x-mockingbird-volatile: { kind: timestamp }
|
|
623
790
|
ErrorBody:
|
|
624
791
|
type: object
|
|
625
792
|
required: [type, code, detail]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crvouga/mockingbird-service-posthog",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.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",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"pack:check": "bun ../../../scripts/pack-check.ts"
|
|
99
99
|
},
|
|
100
100
|
"dependencies": {
|
|
101
|
-
"@crvouga/mockingbird-service-sqlite": "2.1.
|
|
101
|
+
"@crvouga/mockingbird-service-sqlite": "2.1.1",
|
|
102
102
|
"hono": "4.11.9"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|