@crvouga/mockingbird-service-formbricks 1.7.1 → 2.0.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/openapi.yaml ADDED
@@ -0,0 +1,555 @@
1
+ openapi: 3.1.0
2
+ info:
3
+ title: Formbricks client + management API (Mockingbird subset)
4
+ description: |
5
+ Stateful mock subset of open-source Formbricks (6.x): the client environment state (surveys)
6
+ and response creation the JS SDK uses, the v1 management API for responses and surveys
7
+ (`x-api-key`), and the widget script the web SDK loads. Errors use Formbricks' v1
8
+ `{code, message, details}` shape (`apps/web/app/lib/api/response.ts`). Client routes take a
9
+ workspace id or a legacy (pre-5) environment id in the path.
10
+ version: "1"
11
+ x-mockingbird-upstream:
12
+ note: >-
13
+ Hand-authored from upstream Formbricks 6.0.0 (https://github.com/formbricks/formbricks):
14
+ apps/web/app/api/v1/client/[workspaceId]/environment, apps/web/app/api/v2/client/[workspaceId]/responses,
15
+ apps/web/app/api/v1/management/{responses,surveys}, and the response pipeline's webhook body
16
+ (apps/web/modules/response-pipeline). Docs: https://formbricks.com/docs
17
+ servers:
18
+ - url: https://app.formbricks.com
19
+ paths:
20
+ /api/v1/client/{workspaceId}/environment:
21
+ parameters:
22
+ - $ref: "#/components/parameters/WorkspaceId"
23
+ get:
24
+ operationId: GetEnvironmentState
25
+ x-mockingbird:
26
+ supported: true
27
+ parity:
28
+ enabled: true
29
+ safe: true
30
+ responses:
31
+ "200":
32
+ description: The environment state the SDK caches (surveys, action classes, project)
33
+ content:
34
+ application/json:
35
+ schema:
36
+ type: object
37
+ required: [data]
38
+ properties:
39
+ data:
40
+ type: object
41
+ required: [data, expiresAt]
42
+ properties:
43
+ data:
44
+ type: object
45
+ required: [surveys, actionClasses, project]
46
+ properties:
47
+ surveys:
48
+ type: array
49
+ items:
50
+ $ref: "#/components/schemas/Survey"
51
+ actionClasses:
52
+ type: array
53
+ items:
54
+ type: object
55
+ project:
56
+ type: object
57
+ expiresAt:
58
+ type: string
59
+ x-mockingbird-volatile:
60
+ kind: timestamp
61
+ "400":
62
+ $ref: "#/components/responses/Error"
63
+ "404":
64
+ $ref: "#/components/responses/Error"
65
+ /api/v2/client/{workspaceId}/responses:
66
+ parameters:
67
+ - $ref: "#/components/parameters/WorkspaceId"
68
+ post:
69
+ operationId: CreateClientResponse
70
+ x-mockingbird:
71
+ supported: true
72
+ parity:
73
+ enabled: true
74
+ safe: false
75
+ requestBody:
76
+ required: true
77
+ content:
78
+ application/json:
79
+ schema:
80
+ type: object
81
+ required: [surveyId, finished, data]
82
+ properties:
83
+ surveyId:
84
+ type: string
85
+ x-mockingbird-resource-ref:
86
+ type: survey
87
+ missing: czzzzzzzzzzzzzzzzzzzzzzzz
88
+ finished:
89
+ type: boolean
90
+ data:
91
+ $ref: "#/components/schemas/ResponseData"
92
+ contactId:
93
+ type: ["string", "null"]
94
+ displayId:
95
+ type: ["string", "null"]
96
+ singleUseId:
97
+ type: ["string", "null"]
98
+ endingId:
99
+ type: ["string", "null"]
100
+ language:
101
+ type: string
102
+ maxLength: 10
103
+ variables:
104
+ type: object
105
+ ttc:
106
+ type: object
107
+ additionalProperties:
108
+ type: number
109
+ meta:
110
+ type: object
111
+ properties:
112
+ source:
113
+ type: string
114
+ url:
115
+ type: string
116
+ action:
117
+ type: string
118
+ pagePath:
119
+ type: string
120
+ utmSource:
121
+ type: string
122
+ responses:
123
+ "200":
124
+ description: The created response's id
125
+ content:
126
+ application/json:
127
+ schema:
128
+ type: object
129
+ required: [data]
130
+ properties:
131
+ data:
132
+ type: object
133
+ properties:
134
+ id:
135
+ type: string
136
+ x-mockingbird-resource:
137
+ type: response
138
+ identity: true
139
+ quotaFull:
140
+ type: boolean
141
+ "400":
142
+ $ref: "#/components/responses/Error"
143
+ "403":
144
+ $ref: "#/components/responses/Error"
145
+ "404":
146
+ $ref: "#/components/responses/Error"
147
+ /api/v1/management/responses:
148
+ get:
149
+ operationId: ListResponses
150
+ security:
151
+ - apiKey: []
152
+ x-mockingbird:
153
+ supported: true
154
+ parity:
155
+ enabled: true
156
+ safe: true
157
+ parameters:
158
+ - name: surveyId
159
+ in: query
160
+ schema:
161
+ type: string
162
+ x-mockingbird-resource-ref:
163
+ type: survey
164
+ missing: czzzzzzzzzzzzzzzzzzzzzzzz
165
+ - name: limit
166
+ in: query
167
+ schema:
168
+ type: integer
169
+ minimum: 1
170
+ maximum: 100
171
+ - name: skip
172
+ in: query
173
+ schema:
174
+ type: integer
175
+ minimum: 0
176
+ maximum: 100
177
+ responses:
178
+ "200":
179
+ description: Responses, newest first
180
+ content:
181
+ application/json:
182
+ schema:
183
+ type: object
184
+ required: [data]
185
+ properties:
186
+ data:
187
+ type: array
188
+ items:
189
+ $ref: "#/components/schemas/Response"
190
+ "401":
191
+ $ref: "#/components/responses/Error"
192
+ "404":
193
+ $ref: "#/components/responses/Error"
194
+ /api/v1/management/responses/{responseId}:
195
+ parameters:
196
+ - name: responseId
197
+ in: path
198
+ required: true
199
+ schema:
200
+ type: string
201
+ x-mockingbird-resource-ref:
202
+ type: response
203
+ missing: czzzzzzzzzzzzzzzzzzzzzzzy
204
+ get:
205
+ operationId: GetResponse
206
+ security:
207
+ - apiKey: []
208
+ x-mockingbird:
209
+ supported: true
210
+ parity:
211
+ enabled: true
212
+ safe: true
213
+ responses:
214
+ "200":
215
+ description: One response
216
+ content:
217
+ application/json:
218
+ schema:
219
+ type: object
220
+ required: [data]
221
+ properties:
222
+ data:
223
+ $ref: "#/components/schemas/Response"
224
+ "401":
225
+ $ref: "#/components/responses/Error"
226
+ "404":
227
+ $ref: "#/components/responses/Error"
228
+ /api/v1/management/surveys:
229
+ get:
230
+ operationId: ListSurveys
231
+ security:
232
+ - apiKey: []
233
+ x-mockingbird:
234
+ supported: true
235
+ parity:
236
+ enabled: true
237
+ safe: true
238
+ parameters:
239
+ - name: limit
240
+ in: query
241
+ schema:
242
+ type: integer
243
+ minimum: 1
244
+ maximum: 100
245
+ - name: offset
246
+ in: query
247
+ schema:
248
+ type: integer
249
+ minimum: 0
250
+ maximum: 100
251
+ responses:
252
+ "200":
253
+ description: Surveys, most recently updated first
254
+ content:
255
+ application/json:
256
+ schema:
257
+ type: object
258
+ required: [data]
259
+ properties:
260
+ data:
261
+ type: array
262
+ items:
263
+ $ref: "#/components/schemas/Survey"
264
+ "401":
265
+ $ref: "#/components/responses/Error"
266
+ post:
267
+ operationId: CreateSurvey
268
+ security:
269
+ - apiKey: []
270
+ x-mockingbird:
271
+ supported: true
272
+ parity:
273
+ enabled: true
274
+ safe: false
275
+ requestBody:
276
+ required: true
277
+ content:
278
+ application/json:
279
+ schema:
280
+ type: object
281
+ required: [workspaceId, name, blocks]
282
+ properties:
283
+ workspaceId:
284
+ description: A workspace id, or (as `environmentId`) a legacy environment id.
285
+ type: string
286
+ enum: [cworkspace000000000000001, cenvironment0000000000001]
287
+ name:
288
+ type: string
289
+ minLength: 1
290
+ maxLength: 80
291
+ type:
292
+ type: string
293
+ enum: [app, link]
294
+ status:
295
+ type: string
296
+ enum: [draft, inProgress, paused, completed]
297
+ blocks:
298
+ description: >-
299
+ The survey's blocks of elements. The legacy `questions` array (one element per
300
+ block) is also accepted, but not together with `blocks`.
301
+ type: array
302
+ minItems: 1
303
+ maxItems: 3
304
+ items:
305
+ type: object
306
+ required: [id, elements]
307
+ properties:
308
+ id:
309
+ type: string
310
+ minLength: 1
311
+ maxLength: 30
312
+ name:
313
+ type: string
314
+ maxLength: 30
315
+ elements:
316
+ type: array
317
+ minItems: 1
318
+ maxItems: 3
319
+ items:
320
+ $ref: "#/components/schemas/Element"
321
+ responses:
322
+ "200":
323
+ description: The created survey
324
+ content:
325
+ application/json:
326
+ schema:
327
+ type: object
328
+ required: [data]
329
+ properties:
330
+ data:
331
+ $ref: "#/components/schemas/Survey"
332
+ "400":
333
+ $ref: "#/components/responses/Error"
334
+ "401":
335
+ $ref: "#/components/responses/Error"
336
+ "404":
337
+ $ref: "#/components/responses/Error"
338
+ /api/v1/management/surveys/{surveyId}:
339
+ parameters:
340
+ - name: surveyId
341
+ in: path
342
+ required: true
343
+ schema:
344
+ type: string
345
+ x-mockingbird-resource-ref:
346
+ type: survey
347
+ missing: czzzzzzzzzzzzzzzzzzzzzzzz
348
+ get:
349
+ operationId: GetSurvey
350
+ security:
351
+ - apiKey: []
352
+ x-mockingbird:
353
+ supported: true
354
+ parity:
355
+ enabled: true
356
+ safe: true
357
+ responses:
358
+ "200":
359
+ description: One survey
360
+ content:
361
+ application/json:
362
+ schema:
363
+ type: object
364
+ required: [data]
365
+ properties:
366
+ data:
367
+ $ref: "#/components/schemas/Survey"
368
+ "401":
369
+ $ref: "#/components/responses/Error"
370
+ "404":
371
+ $ref: "#/components/responses/Error"
372
+ /js/formbricks.umd.cjs:
373
+ get:
374
+ operationId: GetWidgetScript
375
+ description: The widget bundle the web SDK loads; served as a no-op script.
376
+ security: []
377
+ x-mockingbird:
378
+ supported: true
379
+ parity:
380
+ enabled: true
381
+ safe: true
382
+ responses:
383
+ "200":
384
+ description: A no-op script defining `window.formbricks`
385
+ content:
386
+ application/javascript:
387
+ schema:
388
+ type: string
389
+ components:
390
+ securitySchemes:
391
+ apiKey:
392
+ type: apiKey
393
+ in: header
394
+ name: x-api-key
395
+ parameters:
396
+ WorkspaceId:
397
+ name: workspaceId
398
+ in: path
399
+ required: true
400
+ description: A workspace id, or a legacy (pre-Formbricks-5) environment id.
401
+ schema:
402
+ type: string
403
+ enum: [cworkspace000000000000001, cenvironment0000000000001]
404
+ responses:
405
+ Error:
406
+ description: Formbricks' v1 `{code, message, details}` error
407
+ content:
408
+ application/json:
409
+ schema:
410
+ type: object
411
+ required: [code, message, details]
412
+ properties:
413
+ code:
414
+ type: string
415
+ enum:
416
+ - not_found
417
+ - gone
418
+ - bad_request
419
+ - internal_server_error
420
+ - unauthorized
421
+ - method_not_allowed
422
+ - not_authenticated
423
+ - forbidden
424
+ - too_many_requests
425
+ - conflict
426
+ - payload_too_large
427
+ message:
428
+ type: string
429
+ details:
430
+ type: object
431
+ schemas:
432
+ ResponseData:
433
+ type: object
434
+ maxProperties: 5
435
+ additionalProperties:
436
+ anyOf:
437
+ - type: string
438
+ maxLength: 60
439
+ - type: number
440
+ - type: array
441
+ maxItems: 3
442
+ items:
443
+ type: string
444
+ maxLength: 30
445
+ - type: object
446
+ maxProperties: 3
447
+ additionalProperties:
448
+ type: string
449
+ maxLength: 30
450
+ Element:
451
+ type: object
452
+ required: [id, type, headline]
453
+ properties:
454
+ id:
455
+ type: string
456
+ minLength: 1
457
+ maxLength: 30
458
+ type:
459
+ type: string
460
+ enum: [openText, multipleChoiceSingle, multipleChoiceMulti, nps, rating, date, cta, consent]
461
+ headline:
462
+ type: object
463
+ required: [default]
464
+ properties:
465
+ default:
466
+ type: string
467
+ maxLength: 80
468
+ required:
469
+ type: boolean
470
+ inputType:
471
+ type: string
472
+ enum: [text, email, url, number, phone]
473
+ Survey:
474
+ type: object
475
+ required: [id, name, type, status]
476
+ properties:
477
+ id:
478
+ type: string
479
+ x-mockingbird-resource:
480
+ type: survey
481
+ identity: true
482
+ name:
483
+ type: string
484
+ type:
485
+ type: string
486
+ status:
487
+ type: string
488
+ workspaceId:
489
+ type: string
490
+ environmentId:
491
+ description: The legacy environment id of the survey's workspace (v1 compatibility).
492
+ type: string
493
+ questions:
494
+ type: ["array", "object"]
495
+ blocks:
496
+ type: array
497
+ createdAt:
498
+ type: string
499
+ x-mockingbird-volatile:
500
+ kind: timestamp
501
+ updatedAt:
502
+ type: string
503
+ x-mockingbird-volatile:
504
+ kind: timestamp
505
+ Response:
506
+ type: object
507
+ required: [id, createdAt, updatedAt, surveyId, finished, data]
508
+ properties:
509
+ id:
510
+ type: string
511
+ x-mockingbird-resource:
512
+ type: response
513
+ identity: true
514
+ createdAt:
515
+ type: string
516
+ x-mockingbird-volatile:
517
+ kind: timestamp
518
+ updatedAt:
519
+ type: string
520
+ x-mockingbird-volatile:
521
+ kind: timestamp
522
+ surveyId:
523
+ type: string
524
+ displayId:
525
+ type: ["string", "null"]
526
+ contact:
527
+ type: ["object", "null"]
528
+ properties:
529
+ id:
530
+ type: string
531
+ x-mockingbird-volatile:
532
+ kind: id
533
+ userId:
534
+ type: string
535
+ contactAttributes:
536
+ type: ["object", "null"]
537
+ finished:
538
+ type: boolean
539
+ endingId:
540
+ type: ["string", "null"]
541
+ data:
542
+ description: An object, or (for some deployments) the same object as a JSON string.
543
+ type: ["object", "string"]
544
+ variables:
545
+ type: object
546
+ ttc:
547
+ type: object
548
+ tags:
549
+ type: array
550
+ meta:
551
+ type: object
552
+ singleUseId:
553
+ type: ["string", "null"]
554
+ language:
555
+ type: ["string", "null"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crvouga/mockingbird-service-formbricks",
3
- "version": "1.7.1",
3
+ "version": "2.0.0",
4
4
  "description": "Stateful mock of open-source Formbricks: the client environment state (seeded with a synthetic survey corpus), response creation with upstream's validation and {code, message, details} errors, the v1 management API, the widget script, and signed response webhooks.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -8,7 +8,10 @@
8
8
  "files": [
9
9
  "dist",
10
10
  "README.md",
11
- "CHANGELOG.md"
11
+ "CHANGELOG.md",
12
+ "DISCOVERY.md",
13
+ "SUPPORT.md",
14
+ "openapi.yaml"
12
15
  ],
13
16
  "main": "./dist/index.js",
14
17
  "types": "./dist/index.d.ts",
@@ -57,7 +60,29 @@
57
60
  "docs": "https://formbricks.com/docs"
58
61
  },
59
62
  "parity": "Surveys, responses, and webhooks",
60
- "parityTier": "cold"
63
+ "parityTier": "cold",
64
+ "discovery": {
65
+ "guide": "DISCOVERY.md",
66
+ "behavior": "README.md",
67
+ "capabilities": "SUPPORT.md",
68
+ "contract": "openapi.yaml",
69
+ "types": "dist/index.d.ts",
70
+ "oracle": {
71
+ "kind": "Live vendor API or sandbox",
72
+ "command": "bun run parity:service -- formbricks",
73
+ "note": "Run from a Mockingbird checkout; credentials come only from .env.local or GitHub Actions secrets. Missing credentials exit 2."
74
+ },
75
+ "introspection": [
76
+ "GET /__admin/health",
77
+ "GET /__admin",
78
+ "GET /__admin/state",
79
+ "GET /__admin/requests",
80
+ "GET /__admin/metrics",
81
+ "GET /__admin/faults/presets",
82
+ "GET /__admin/ui"
83
+ ],
84
+ "reporting": "https://github.com/crvouga/mockingbird/blob/main/docs/REPORTING_ISSUES.md"
85
+ }
61
86
  },
62
87
  "scripts": {
63
88
  "generate": "bun ../../openapi/codegen/dist/cli.js",
@@ -72,7 +97,7 @@
72
97
  "pack:check": "bun ../../../scripts/pack-check.ts"
73
98
  },
74
99
  "dependencies": {
75
- "@crvouga/mockingbird-service-sqlite": "1.3.0",
100
+ "@crvouga/mockingbird-service-sqlite": "2.0.0",
76
101
  "hono": "4.11.9"
77
102
  },
78
103
  "devDependencies": {