This repository was archived by the owner on Mar 1, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathmodels.ts
More file actions
468 lines (466 loc) · 21.9 KB
/
models.ts
File metadata and controls
468 lines (466 loc) · 21.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
//////////////////////////////////////////////////////////////////////////////////////////////
// DO NOT MODIFY THIS FILE //
// This file is automatically generated by ZenStack CLI and should not be manually updated. //
//////////////////////////////////////////////////////////////////////////////////////////////
/* eslint-disable */
import { schema as $schema, type SchemaType as $Schema } from "./schema";
import type { ModelResult as $ModelResult } from "@zenstackhq/orm";
/**
* Represents a webhook endpoint for receiving survey-related events.
* Webhooks can be configured to receive notifications about response creation, updates, and completion.
*
* @property id - Unique identifier for the webhook
* @property name - Optional display name for the webhook
* @property url - The endpoint URL where events will be sent
* @property source - Origin of the webhook (user, zapier, make, etc.)
* @property environment - Associated environment
* @property triggers - Types of events that trigger this webhook
* @property surveyIds - List of surveys this webhook is monitoring
*/
export type Webhook = $ModelResult<$Schema, "Webhook">;
/**
* Represents an attribute value associated with a contact.
* Used to store custom properties and characteristics of contacts.
*
* @property id - Unique identifier for the attribute
* @property attributeKey - Reference to the attribute definition
* @property contact - The contact this attribute belongs to
* @property value - The actual value of the attribute
*/
export type ContactAttribute = $ModelResult<$Schema, "ContactAttribute">;
/**
* Defines the possible attributes that can be assigned to contacts.
* Acts as a schema for contact attributes within an environment.
*
* @property id - Unique identifier for the attribute key
* @property isUnique - Whether the attribute must have unique values across contacts
* @property key - The attribute identifier used in the system
* @property name - Display name for the attribute
* @property type - Whether this is a default or custom attribute
* @property environment - The environment this attribute belongs to
*/
export type ContactAttributeKey = $ModelResult<$Schema, "ContactAttributeKey">;
/**
* Represents a person or user who can receive and respond to surveys.
* Contacts are environment-specific and can have multiple attributes and responses.
*
* @property id - Unique identifier for the contact
* @property userId - Optional external user identifier
* @property environment - The environment this contact belongs to
* @property responses - Survey responses from this contact
* @property attributes - Custom attributes associated with this contact
* @property displays - Record of surveys shown to this contact
*/
export type Contact = $ModelResult<$Schema, "Contact">;
/**
* Stores a user's response to a survey, including their answers and metadata.
* Each response is linked to a specific survey and optionally to a contact.
*
* @property id - Unique identifier for the response
* @property finished - Whether the survey was completed
* @property survey - The associated survey
* @property contact - The optional contact who provided the response
* @property data - JSON object containing the actual response data
* @property variables - Custom variables used in the response
* @property ttc - Time to completion metrics
* @property meta - Additional metadata about the response
*/
export type Response = $ModelResult<$Schema, "Response">;
/**
* Represents notes or comments added to survey responses by team members.
* Used for internal communication and response analysis.
*
* @property id - Unique identifier for the note
* @property response - The associated survey response
* @property user - The team member who created the note
* @property text - Content of the note
* @property isResolved - Whether the note has been marked as resolved
* @property isEdited - Whether the note has been modified
*/
export type ResponseNote = $ModelResult<$Schema, "ResponseNote">;
/**
* Represents a label that can be applied to survey responses.
* Used for categorizing and organizing responses within an environment.
*
* @property id - Unique identifier for the tag
* @property name - Display name of the tag
* @property responses - Survey responses tagged with this label
* @property environment - The environment this tag belongs to
*/
export type Tag = $ModelResult<$Schema, "Tag">;
/**
* Junction table linking tags to responses.
* Enables many-to-many relationship between tags and responses.
*
* @property response - The tagged response
* @property tag - The tag applied to the response
*/
export type TagsOnResponses = $ModelResult<$Schema, "TagsOnResponses">;
/**
* Records when a survey is shown to a user.
* Tracks survey display history and response status.
*
* @property id - Unique identifier for the display event
* @property survey - The survey that was displayed
* @property contact - The contact who saw the survey
* @property status - Whether the survey was just seen or responded to
* @property response - The associated response if one exists
*/
export type Display = $ModelResult<$Schema, "Display">;
/**
* Links surveys to specific trigger actions.
* Defines which user actions should cause a survey to be displayed.
* This is the connection table between Surveys and ActionClasses that determines
* when and under what conditions a survey should be triggered.
*
* @property id - Unique identifier for the trigger
* @property survey - The survey to be triggered
* @property actionClass - The action that triggers the survey
* @property createdAt - When the trigger was created
* @property updatedAt - When the trigger was last modified
*/
export type SurveyTrigger = $ModelResult<$Schema, "SurveyTrigger">;
/**
* Defines targeting rules for surveys based on contact attributes.
* Used to show surveys only to contacts matching specific criteria.
*
* @property id - Unique identifier for the filter
* @property attributeKey - The contact attribute to filter on
* @property survey - The survey being filtered
* @property condition - The comparison operator to use
* @property value - The value to compare against
*/
export type SurveyAttributeFilter = $ModelResult<$Schema, "SurveyAttributeFilter">;
/**
* Represents a complete survey configuration including questions, styling, and display rules.
* Core model for the survey functionality in Formbricks.
*
* @property id - Unique identifier for the survey
* @property name - Display name of the survey
* @property type - Survey delivery method (link, web, website, app)
* @property status - Current state of the survey (draft, active, completed, etc)
* @property environment - The environment this survey belongs to
* @property questions - JSON array containing survey questions configuration
* @property displayOption - Rules for how often the survey can be shown
* @property triggers - Actions that can trigger this survey
* @property attributeFilters - Rules for targeting specific contacts
*/
export type Survey = $ModelResult<$Schema, "Survey">;
/**
* Defines follow-up actions for survey responses.
* Enables automated actions based on specific survey response conditions.
*
* @property id - Unique identifier for the follow-up
* @property survey - The associated survey
* @property name - Display name for the follow-up
* @property trigger - Conditions that activate the follow-up
* @property action - Actions to take when triggered
*/
export type SurveyFollowUp = $ModelResult<$Schema, "SurveyFollowUp">;
/**
* Represents a user action that can trigger surveys.
* Used to define points in the user journey where surveys can be shown.
*
* @property id - Unique identifier for the action
* @property name - Display name of the action
* @property type - Whether this is a code or no-code action
* @property key - Unique identifier used in code implementation
* @property noCodeConfig - Configuration for no-code setup
* @property environment - The environment this action belongs to
*/
export type ActionClass = $ModelResult<$Schema, "ActionClass">;
/**
* Represents third-party service integrations.
* Enables data flow between Formbricks and external services.
*
* @property id - Unique identifier for the integration
* @property type - The service being integrated (Google Sheets, Notion, etc.)
* @property environment - The environment this integration belongs to
* @property config - Service-specific configuration details
*/
export type Integration = $ModelResult<$Schema, "Integration">;
/**
* Tracks database schema migrations.
* Used to manage and track the state of data structure changes.
*
* @property id - Unique identifier for the migration
* @property name - Name of the migration
* @property status - Current state of the migration (pending, applied, failed)
* @property startedAt - When the migration began
* @property finishedAt - When the migration completed
*/
export type DataMigration = $ModelResult<$Schema, "DataMigration">;
/**
* Represents either a production or development environment within a project.
* Each project has exactly two environments, serving as the main reference point
* for most Formbricks resources including surveys and actions.
*
* @property id - Unique identifier for the environment
* @property type - Either 'production' or 'development'
* @property project - Reference to parent project
* @property widgetSetupCompleted - Tracks initial widget setup status
* @property surveys - Collection of surveys in this environment
* @property contacts - Collection of contacts/users tracked
* @property actionClasses - Defined actions that can trigger surveys
* @property attributeKeys - Custom attributes configuration
*/
export type Environment = $ModelResult<$Schema, "Environment">;
/**
* Main grouping mechanism for resources in Formbricks.
* Each organization can have multiple projects to separate different applications or products.
*
* @property id - Unique identifier for the project
* @property name - Display name of the project
* @property organization - Reference to parent organization
* @property environments - Development and production environments
* @property styling - Project-wide styling configuration
* @property config - Project-specific configuration
* @property recontactDays - Default recontact delay for surveys
* @property placement - Default widget placement for in-app surveys
*/
export type Project = $ModelResult<$Schema, "Project">;
/**
* Represents the top-level organizational hierarchy in Formbricks.
* Self-hosting instances typically have a single organization, while Formbricks Cloud
* supports multiple organizations with multi-tenancy.
*
* @property id - Unique identifier for the organization
* @property name - Display name of the organization
* @property memberships - User memberships within the organization
* @property projects - Collection of projects owned by the organization
* @property billing - JSON field containing billing information
* @property whitelabel - Whitelabel configuration for the organization
* @property isAIEnabled - Controls access to AI-powered features
*/
export type Organization = $ModelResult<$Schema, "Organization">;
/**
* Links users to organizations with specific roles.
* Manages organization membership and permissions.
* Core model for managing user access within organizations.
*
* @property organization - The organization the user belongs to
* @property user - The member user
* @property accepted - Whether the user has accepted the membership
* @property role - User's role within the organization (owner, manager, member, billing)
*/
export type Membership = $ModelResult<$Schema, "Membership">;
/**
* Represents pending invitations to join an organization.
* Used to manage the process of adding new users to an organization.
* Once accepted, invites are converted into memberships.
*
* @property id - Unique identifier for the invite
* @property email - Email address of the invited user
* @property name - Optional display name for the invited user
* @property organization - The organization sending the invite
* @property creator - The user who created the invite
* @property acceptor - The user who accepted the invite (if accepted)
* @property expiresAt - When the invite becomes invalid
* @property role - Intended role for the invited user
* @property teamIds - Teams the user will be added to upon acceptance
*/
export type Invite = $ModelResult<$Schema, "Invite">;
/**
* Represents enhanced API authentication keys with organization-level ownership.
* Used for authenticating API requests to Formbricks with more granular permissions.
*
* @property id - Unique identifier for the API key
* @property label - Optional descriptive name for the key
* @property hashedKey - Securely stored API key
* @property organization - The organization this key belongs to
* @property createdBy - User ID who created this key
* @property lastUsedAt - Timestamp of last usage
* @property apiKeyEnvironments - Environments this key has access to
*/
export type ApiKey = $ModelResult<$Schema, "ApiKey">;
/**
* Links API keys to environments with specific permissions.
* Enables granular access control for API keys across environments.
*
* @property id - Unique identifier for the environment access entry
* @property apiKey - The associated API key
* @property environment - The environment being accessed
* @property permission - Level of access granted
*/
export type ApiKeyEnvironment = $ModelResult<$Schema, "ApiKeyEnvironment">;
/**
* Stores third-party authentication account information.
* Enables OAuth and other external authentication methods.
*
* @property id - Unique identifier for the account
* @property user - The Formbricks user who owns this account
* @property provider - The authentication provider (GitHub, Google, etc.)
* @property providerAccountId - User ID from the provider
* @property access_token - OAuth access token
* @property refresh_token - OAuth refresh token
*/
export type Account = $ModelResult<$Schema, "Account">;
/**
* Represents a user in the Formbricks system.
* Central model for user authentication and profile management.
*
* @property id - Unique identifier for the user
* @property name - Display name of the user
* @property email - User's email address
* @property role - User's professional role
* @property objective - User's main goal with Formbricks
* @property twoFactorEnabled - Whether 2FA is active
* @property memberships - Organizations the user belongs to
* @property notificationSettings - User's notification preferences
*/
export type User = $ModelResult<$Schema, "User">;
/**
* Maps a short URL to its full destination.
* Used for creating memorable, shortened URLs for surveys.
*
* @property id - Short identifier/slug for the URL
* @property url - The full destination URL
*/
export type ShortUrl = $ModelResult<$Schema, "ShortUrl">;
/**
* Defines a segment of contacts based on attributes.
* Used for targeting surveys to specific user groups.
*
* @property id - Unique identifier for the segment
* @property title - Display name of the segment
* @property filters - Rules defining the segment
* @property isPrivate - Whether the segment is private
* @property environment - The environment this segment belongs to
*/
export type Segment = $ModelResult<$Schema, "Segment">;
/**
* Represents a supported language in the system.
* Used for multilingual survey support.
*
* @property id - Unique identifier for the language
* @property code - Language code (e.g., 'en-US')
* @property alias - Optional friendly name
* @property project - The project this language is enabled for
*/
export type Language = $ModelResult<$Schema, "Language">;
/**
* Links surveys to their supported languages.
* Manages which languages are available for each survey.
*
* @property language - The supported language
* @property survey - The associated survey
* @property default - Whether this is the default language
* @property enabled - Whether this language is currently active
*/
export type SurveyLanguage = $ModelResult<$Schema, "SurveyLanguage">;
/**
* Stores analyzed insights from survey responses.
* Used for tracking patterns and extracting meaningful information.
*
* @property id - Unique identifier for the insight
* @property category - Type of insight (feature request, complaint, etc.)
* @property title - Summary of the insight
* @property description - Detailed explanation
* @property vector - Embedding vector for similarity search
*/
export type Insight = $ModelResult<$Schema, "Insight">;
/**
* Links insights to source documents.
* Enables tracing insights back to original responses.
*
* @property document - The source document
* @property insight - The derived insight
*/
export type DocumentInsight = $ModelResult<$Schema, "DocumentInsight">;
/**
* Represents a processed text document from survey responses.
* Used for analysis and insight generation.
*
* @property id - Unique identifier for the document
* @property survey - The associated survey
* @property response - The source response
* @property sentiment - Analyzed sentiment (positive, negative, neutral)
* @property text - The document content
* @property vector - Embedding vector for similarity search
*/
export type Document = $ModelResult<$Schema, "Document">;
/**
* Represents a team within an organization.
* Enables group-based access control and collaboration.
*
* @property id - Unique identifier for the team
* @property name - Display name of the team
* @property organization - The parent organization
* @property teamUsers - Users who are part of this team
* @property projectTeams - Projects this team has access to
*/
export type Team = $ModelResult<$Schema, "Team">;
/**
* Links users to teams with specific roles.
* Manages team membership and permissions.
*
* @property team - The associated team
* @property user - The team member
* @property role - User's role within the team
*/
export type TeamUser = $ModelResult<$Schema, "TeamUser">;
/**
* Defines team access to specific projects.
* Manages project-level permissions for teams.
*
* @property project - The accessed project
* @property team - The team receiving access
* @property permission - Level of access granted
*/
export type ProjectTeam = $ModelResult<$Schema, "ProjectTeam">;
export const PipelineTriggers = $schema.enums.PipelineTriggers.values;
export type PipelineTriggers = (typeof PipelineTriggers)[keyof typeof PipelineTriggers];
export const WebhookSource = $schema.enums.WebhookSource.values;
export type WebhookSource = (typeof WebhookSource)[keyof typeof WebhookSource];
export const ContactAttributeType = $schema.enums.ContactAttributeType.values;
export type ContactAttributeType = (typeof ContactAttributeType)[keyof typeof ContactAttributeType];
export const SurveyStatus = $schema.enums.SurveyStatus.values;
export type SurveyStatus = (typeof SurveyStatus)[keyof typeof SurveyStatus];
export const DisplayStatus = $schema.enums.DisplayStatus.values;
export type DisplayStatus = (typeof DisplayStatus)[keyof typeof DisplayStatus];
export const SurveyAttributeFilterCondition = $schema.enums.SurveyAttributeFilterCondition.values;
export type SurveyAttributeFilterCondition = (typeof SurveyAttributeFilterCondition)[keyof typeof SurveyAttributeFilterCondition];
export const SurveyType = $schema.enums.SurveyType.values;
export type SurveyType = (typeof SurveyType)[keyof typeof SurveyType];
export const displayOptions = $schema.enums.displayOptions.values;
export type displayOptions = (typeof displayOptions)[keyof typeof displayOptions];
export const ActionType = $schema.enums.ActionType.values;
export type ActionType = (typeof ActionType)[keyof typeof ActionType];
export const EnvironmentType = $schema.enums.EnvironmentType.values;
export type EnvironmentType = (typeof EnvironmentType)[keyof typeof EnvironmentType];
export const IntegrationType = $schema.enums.IntegrationType.values;
export type IntegrationType = (typeof IntegrationType)[keyof typeof IntegrationType];
export const DataMigrationStatus = $schema.enums.DataMigrationStatus.values;
export type DataMigrationStatus = (typeof DataMigrationStatus)[keyof typeof DataMigrationStatus];
export const WidgetPlacement = $schema.enums.WidgetPlacement.values;
export type WidgetPlacement = (typeof WidgetPlacement)[keyof typeof WidgetPlacement];
export const OrganizationRole = $schema.enums.OrganizationRole.values;
export type OrganizationRole = (typeof OrganizationRole)[keyof typeof OrganizationRole];
export const MembershipRole = $schema.enums.MembershipRole.values;
export type MembershipRole = (typeof MembershipRole)[keyof typeof MembershipRole];
/**
* Defines permission levels for API keys.
* Controls what operations an API key can perform.
*/
export const ApiKeyPermission = $schema.enums.ApiKeyPermission.values;
/**
* Defines permission levels for API keys.
* Controls what operations an API key can perform.
*/
export type ApiKeyPermission = (typeof ApiKeyPermission)[keyof typeof ApiKeyPermission];
export const IdentityProvider = $schema.enums.IdentityProvider.values;
export type IdentityProvider = (typeof IdentityProvider)[keyof typeof IdentityProvider];
export const Role = $schema.enums.Role.values;
export type Role = (typeof Role)[keyof typeof Role];
export const Objective = $schema.enums.Objective.values;
export type Objective = (typeof Objective)[keyof typeof Objective];
export const Intention = $schema.enums.Intention.values;
export type Intention = (typeof Intention)[keyof typeof Intention];
export const InsightCategory = $schema.enums.InsightCategory.values;
export type InsightCategory = (typeof InsightCategory)[keyof typeof InsightCategory];
export const Sentiment = $schema.enums.Sentiment.values;
export type Sentiment = (typeof Sentiment)[keyof typeof Sentiment];
export const TeamUserRole = $schema.enums.TeamUserRole.values;
export type TeamUserRole = (typeof TeamUserRole)[keyof typeof TeamUserRole];
export const ProjectTeamPermission = $schema.enums.ProjectTeamPermission.values;
export type ProjectTeamPermission = (typeof ProjectTeamPermission)[keyof typeof ProjectTeamPermission];