mirror of
https://github.com/zenstackhq/zenstack
synced 2026-05-24 10:08:55 +00:00
* Initial plan * Fix: Change ModelResult/TypeDefResult imports to type-only imports in ts-schema-generator Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com> * Regenerate test schemas with type-only imports Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com> * Fix: Update bun runtime models.ts to use type-only imports Co-authored-by: Yiming Cao <ymc9@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ymc9 <104139426+ymc9@users.noreply.github.com> Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: Yiming Cao <ymc9@users.noreply.github.com>
468 lines
22 KiB
TypeScript
468 lines
22 KiB
TypeScript
//////////////////////////////////////////////////////////////////////////////////////////////
|
|
// 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];
|