@crvouga/mockingbird-service-formbricks 1.5.1 → 1.6.1
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 +19 -4
- package/README.md +4 -4
- package/dist/{chunk-PTHSM46L.js → chunk-6PARZPBY.js} +3 -2
- package/dist/chunk-6PARZPBY.js.map +7 -0
- package/dist/{chunk-24SBIGNG.js → chunk-JAVNDNOU.js} +150 -28
- package/dist/chunk-JAVNDNOU.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.d.ts +23 -4
- package/dist/index.js +1 -1
- package/dist/server.d.ts +19 -9
- package/dist/server.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-24SBIGNG.js.map +0 -7
- package/dist/chunk-PTHSM46L.js.map +0 -7
package/dist/cli.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -936,6 +936,12 @@ type ResponseRecord = {
|
|
|
936
936
|
singleUseId: string | null;
|
|
937
937
|
language: string | null;
|
|
938
938
|
};
|
|
939
|
+
/**
|
|
940
|
+
* Which survey elements response creation validates.
|
|
941
|
+
* `present-only` is Formbricks after #7292 (only keys present in `data`).
|
|
942
|
+
* `finished-validates-all` is Formbricks before #7292 (every element when `finished` is true).
|
|
943
|
+
*/
|
|
944
|
+
type ResponseValidation = "present-only" | "finished-validates-all";
|
|
939
945
|
/** Per-namespace knobs, set through `PUT /__admin/settings`; cleared on reset. */
|
|
940
946
|
type Settings = {
|
|
941
947
|
/** Workspace ids that exist and serve the shared corpus surveys. */
|
|
@@ -948,6 +954,8 @@ type Settings = {
|
|
|
948
954
|
webhookId: string;
|
|
949
955
|
/** Contacts are an Enterprise feature: when off, a response with a `contactId` is 403. */
|
|
950
956
|
contactsEnabled: boolean;
|
|
957
|
+
/** Element-validation rule. Default matches current Formbricks (`present-only`). */
|
|
958
|
+
validation: ResponseValidation;
|
|
951
959
|
};
|
|
952
960
|
/** The default workspace every namespace starts with. */
|
|
953
961
|
declare const WORKSPACE_ID = "cworkspace000000000000001";
|
|
@@ -1163,13 +1171,24 @@ declare const supportedOperationIds: readonly ["GetEnvironmentState", "CreateCli
|
|
|
1163
1171
|
* Formbricks' response validation (`validateResponseData` in `apps/web/modules/api/lib/validation.ts`
|
|
1164
1172
|
* → `validateBlockResponses` in `packages/surveys/src/lib/validation/evaluator.ts`), trimmed to the
|
|
1165
1173
|
* structural checks: required elements, choice membership for choice elements without an "other"
|
|
1166
|
-
* option, and the implicit email / url / phone rules of openText elements.
|
|
1167
|
-
* present
|
|
1174
|
+
* option, and the implicit email / url / phone rules of openText elements.
|
|
1175
|
+
* `present-only` (default, Formbricks after #7292) checks only elements present in `data`.
|
|
1176
|
+
* `finished-validates-all` (Formbricks before #7292, commit 7c8a760) checks every element when
|
|
1177
|
+
* `finished` is true, and only the present ones when it is false.
|
|
1168
1178
|
* Custom `validation.rules` are not evaluated.
|
|
1179
|
+
*
|
|
1180
|
+
* The "other" length check is separate (`validateOtherOptionLengthForMultipleChoice` in
|
|
1181
|
+
* `apps/web/modules/api/v2/lib/element.ts`) and the response route runs it before this.
|
|
1169
1182
|
*/
|
|
1170
1183
|
|
|
1184
|
+
type ValidateResponseDataOptions = {
|
|
1185
|
+
/** Defaults to post-#7292 `present-only`. */
|
|
1186
|
+
validation?: ResponseValidation;
|
|
1187
|
+
/** Read only when `validation` is `finished-validates-all`. */
|
|
1188
|
+
finished?: boolean;
|
|
1189
|
+
};
|
|
1171
1190
|
/** `{<elementId>: [messages]}`, or `null` when the response passes. */
|
|
1172
|
-
declare const validateResponseData: (survey: Survey, data: Record<string, unknown>, language?: string) => Record<string, string[]> | null;
|
|
1191
|
+
declare const validateResponseData: (survey: Survey, data: Record<string, unknown>, language?: string, options?: ValidateResponseDataOptions) => Record<string, string[]> | null;
|
|
1173
1192
|
|
|
1174
1193
|
/** A conventional path for the consumer app's webhook receiver (examples and the CLI help use it). */
|
|
1175
1194
|
declare const WEBHOOK_PATH = "/webhooks/formbricks";
|
|
@@ -1277,4 +1296,4 @@ declare class FormbricksAPI implements FetchAPI$1 {
|
|
|
1277
1296
|
}
|
|
1278
1297
|
|
|
1279
1298
|
export { CORPUS_SURVEYS, DEFAULT_SETTINGS, ENVIRONMENT_ID, FORMBRICKS_NAMESPACE, FORMBRICKS_PRESETS, FormbricksAPI, WEBHOOK_PATH, WORKSPACE_ID, createRuntime, document, formbricksCredential, formbricksError, operationIds, supportedOperationIds, validateResponseData };
|
|
1280
|
-
export type { ApiResponse, Contact, FetchAPI$1 as FetchAPI, FormbricksAPIOptions, FormbricksRuntime, FormbricksRuntimeOptions, FormbricksWebhook, OperationId, ResponseRecord, Settings, SqliteClient, SupportedOperationId, Survey };
|
|
1299
|
+
export type { ApiResponse, Contact, FetchAPI$1 as FetchAPI, FormbricksAPIOptions, FormbricksRuntime, FormbricksRuntimeOptions, FormbricksWebhook, OperationId, ResponseRecord, ResponseValidation, Settings, SqliteClient, SupportedOperationId, Survey, ValidateResponseDataOptions };
|
package/dist/index.js
CHANGED
package/dist/server.d.ts
CHANGED
|
@@ -546,6 +546,15 @@ type ServiceRuntime$1<T extends ServiceInstance$1> = FetchAPI$2 & {
|
|
|
546
546
|
state(namespace?: string): StateView$1;
|
|
547
547
|
};
|
|
548
548
|
|
|
549
|
+
/** A running server, with the address it actually bound. */
|
|
550
|
+
type Listening = {
|
|
551
|
+
url: string;
|
|
552
|
+
port: number;
|
|
553
|
+
host: string;
|
|
554
|
+
server: Server;
|
|
555
|
+
close(): Promise<void>;
|
|
556
|
+
};
|
|
557
|
+
|
|
549
558
|
type CliOption = {
|
|
550
559
|
type: "string" | "boolean";
|
|
551
560
|
description: string;
|
|
@@ -572,15 +581,8 @@ type ServeTarget = {
|
|
|
572
581
|
create(values: CliValues, common: CommonServeOptions): Promise<ServiceRuntime$1<ServiceInstance$1>> | ServiceRuntime$1<ServiceInstance$1>;
|
|
573
582
|
/** Startup lines after the listen address, e.g. the loaded corpus version. */
|
|
574
583
|
banner?(runtime: ServiceRuntime$1<ServiceInstance$1>): string[];
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
/** A running server, with the address it actually bound. */
|
|
578
|
-
type Listening = {
|
|
579
|
-
url: string;
|
|
580
|
-
port: number;
|
|
581
|
-
host: string;
|
|
582
|
-
server: Server;
|
|
583
|
-
close(): Promise<void>;
|
|
584
|
+
/** After the HTTP server is bound. A service that speaks more than HTTP attaches it here. */
|
|
585
|
+
listening?(server: Listening): void;
|
|
584
586
|
};
|
|
585
587
|
|
|
586
588
|
/**
|
|
@@ -1506,6 +1508,12 @@ type ResponseRecord = {
|
|
|
1506
1508
|
singleUseId: string | null;
|
|
1507
1509
|
language: string | null;
|
|
1508
1510
|
};
|
|
1511
|
+
/**
|
|
1512
|
+
* Which survey elements response creation validates.
|
|
1513
|
+
* `present-only` is Formbricks after #7292 (only keys present in `data`).
|
|
1514
|
+
* `finished-validates-all` is Formbricks before #7292 (every element when `finished` is true).
|
|
1515
|
+
*/
|
|
1516
|
+
type ResponseValidation = "present-only" | "finished-validates-all";
|
|
1509
1517
|
/** Per-namespace knobs, set through `PUT /__admin/settings`; cleared on reset. */
|
|
1510
1518
|
type Settings = {
|
|
1511
1519
|
/** Workspace ids that exist and serve the shared corpus surveys. */
|
|
@@ -1518,6 +1526,8 @@ type Settings = {
|
|
|
1518
1526
|
webhookId: string;
|
|
1519
1527
|
/** Contacts are an Enterprise feature: when off, a response with a `contactId` is 403. */
|
|
1520
1528
|
contactsEnabled: boolean;
|
|
1529
|
+
/** Element-validation rule. Default matches current Formbricks (`present-only`). */
|
|
1530
|
+
validation: ResponseValidation;
|
|
1521
1531
|
};
|
|
1522
1532
|
declare class FormbricksState {
|
|
1523
1533
|
private readonly seed;
|
package/dist/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crvouga/mockingbird-service-formbricks",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
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",
|