import { ApplicationUserDto, BaseBlock, BranchDto, CommitDto, DatasourceEnvironments, DataTreeGroup, DataTreeUser, DegradedMode, Difference, ExportedApiV3Dto, IApiV3Dto, Plugin, RepositoryDto, SupersetIntegrationDto } from '..'; import { ApplicationSignatureTreeSigned, Signature } from '../../signing/index.js'; import { ResourceMetadata } from '../metadata/index.js'; import { Dimension, EntityWithBindings6, IPageV2Dto, MultiStepDef, Padding, PageDSL, PageSummary } from '../page/index.js'; import { EntityProfileSettings } from '../profile/index.js'; import { IResourceMetadata } from '../resource/index.js'; export interface Application { id: string; environment: DatasourceEnvironments; name: string; icon?: string; color: string; organizationId: string; new: boolean; appIsExample: boolean; isPublic: boolean; userPermissions: string[]; deletedAt: Date | undefined; settings: ApplicationSettings; configuration?: ApplicationConfiguration; } export type GetEditorsForAppIdResponse = ApplicationUserDto[]; interface PropertiesPanelDisplay { controlType: 'text' | 'js-expr' | 'switch'; label: string; defaultValue?: string | number | boolean; placeholder?: string; exampleData?: string; expectedType?: string; } /** @pattern ^[a-zA-Z_][a-zA-Z0-9_]*$ */ type Identifier = string; export interface CustomComponentProperty { path: Identifier; dataType: 'string' | 'number' | 'boolean' | 'any'; propertiesPanelDisplay?: PropertiesPanelDisplay; description?: string; isExternallySettable?: boolean; isExternallyReadable?: boolean; } export interface PreviousCustomComponentConfigs { '0.0.20': { id: string; name: string; displayName: string; componentPath: string; statefulProperties: Array<{ path: string; label: string; inputType: 'text' | 'number' | 'boolean' | 'js'; placeholder?: string; }>; eventHandlers: Array<{ label: string; path: string; }>; }; '0.0.21': { id: string; name: string; displayName: string; componentPath: string; properties: Array<{ path: string; dataType: 'string' | 'number' | 'boolean' | 'any'; propertiesPanelDisplay?: { controlType: 'text' | 'js-expr' | 'switch'; label: string; defaultValue?: string; placeholder?: string; exampleData?: string; }; description?: string; }>; events: Array<{ label: string; path: string; }>; }; } export interface CustomComponentConfig { id: string; name: string; displayName: string; componentPath: string; properties: CustomComponentProperty[]; events: Array<{ label: string; path: Identifier; }>; gridDimensions?: { initialColumns: number; initialRows: number; }; } export declare enum ComponentEvent { CREATE = "create", INIT = "init", LOGIN = "login", MIGRATE = "migrate", PULL = "pull", PUSH = "push", REGISTER = "register", UPLOAD = "upload", DEPLOY = "deploy" } export type RegisteredComponents = Record; type BaseRoute = { id: string; path: string; testParams?: Record; onRouteLoad?: MultiStepDef; } & EntityWithBindings6; export type PageRoute = BaseRoute & { pageId: string; }; type PageComponentRoute = PageRoute & { widgetId: string; }; type RedirectRoute = BaseRoute; export type RouteDef = PageRoute | PageComponentRoute | RedirectRoute; export declare const DEFAULT_ROUTE_ID = "ahjjxoy521"; export declare function getDefaultRoute(pageId: string): RouteDef; export interface ApplicationConfiguration { version?: 1; routes?: Record; dsl?: { version: 8; stateVars?: PageDSL['stateVars']; timers?: PageDSL['timers']; events?: PageDSL['events']; apis?: PageDSL['apis']; }; } export interface ApplicationConfigurationUpdate extends ApplicationConfiguration { routes: Record; } export declare enum ThemeMode { LIGHT = "LIGHT", DARK = "DARK", AUTO = "AUTO" } export type Border = { color?: string; width?: Dimension<'px'>; style?: 'solid'; }; export type PerSideBorder = { left: Border; right: Border; top: Border; bottom: Border; }; export type PerCornerBorderRadius = { topLeft: Dimension<'px'>; topRight: Dimension<'px'>; bottomLeft: Dimension<'px'>; bottomRight: Dimension<'px'>; }; export type UserDefinedPalette = { primaryColor: string; appBackgroundColor: string; }; export interface ColorBlock { default: string; disabled?: string; hover?: string; error?: string; active?: string; activeHover?: string; } interface TextColorBlock { textColor: ColorBlock; } interface BackgroundColorBlock { backgroundColor: ColorBlock; } interface BorderColorBlock { borderColor: ColorBlock; } interface BoxShadowBlock { boxShadow: ColorBlock; } export interface IconColorBlock { iconColor: ColorBlock; } interface SizeBlock { height: Dimension; width: Dimension; } export interface ColoredDimensionStyle { size: Dimension; color?: string; } export interface BorderStyleBlock extends BorderColorBlock, BoxShadowBlock { borderWidth: Dimension; borderStyle: string; borderRadius: Dimension; } export interface StyleBlockWithSize extends StyleBlock, SizeBlock { } export interface TextStyleBlock extends TextColorBlock { fontFamily: string; fontSize: string; fontWeight: number; lineHeight: number | string; textDecoration?: string; fontStyle?: 'normal' | 'italic' | 'inherit'; letterSpacing?: string; textTransform?: 'uppercase' | 'lowercase' | 'capitalize' | 'none' | 'inherit'; } export type CustomTypographies = Record; export interface StyleBlock extends TextStyleBlock, BorderStyleBlock, BackgroundColorBlock { padding: Padding; } export declare const CUSTOM_THEME_TYPOGRAPHY_KEY = "custom"; export type Typographies = { heading1: TextStyleBlock; heading2: TextStyleBlock; heading3: TextStyleBlock; heading4: TextStyleBlock; heading5: TextStyleBlock; heading6: TextStyleBlock; body1: TextStyleBlock; body2: TextStyleBlock; body3: TextStyleBlock; label: TextStyleBlock; inputLabel: TextStyleBlock; inputPlaceholder: TextStyleBlock; inputText: TextStyleBlock; buttonLabel: TextStyleBlock; link: TextStyleBlock; code: TextStyleBlock; [CUSTOM_THEME_TYPOGRAPHY_KEY]?: CustomTypographies; }; export type NonCustomTypography = Exclude; export type FontFamily = { name: string; key: string; url?: string; type: 'google' | 'custom'; weights?: Array; }; export type UserDefinedTheme = { primaryColor: string; mode: ThemeMode; borderRadius: Dimension<'px'>; typeFace: string; padding?: Padding; palette?: { dark?: UserDefinedPalette; light?: UserDefinedPalette; }; typographies?: Typographies; availableFonts?: Record; version?: number; }; export type ApplicationSettings = EntityProfileSettings & VersionedApplicationSettings; export type NonVersionedApplicationSettings = Difference; export type VersionedApplicationSettings = { componentBaseUrl?: string; registeredComponents?: RegisteredComponents; files?: string[]; sourceFiles?: string[]; bundledFiles?: string[]; cliVersion?: string; componentsLastUploaded?: string; theme?: UserDefinedTheme; }; export declare function toExportedApplicationSettings(applicationSettings: ApplicationSettings): ExportedApplicationSettings; export declare function toNonVersionedApplicationSettings(applicationSettings?: ApplicationSettings): NonVersionedApplicationSettings | undefined; export type ApplicationSettingsResponse = ApplicationSettings & { prefix?: string; }; export interface FullApplicationV2Dto { application: IApplicationV2Dto; metadata?: ResourceMetadata; plugins?: Plugin[]; integrations?: SupersetIntegrationDto[]; page?: IPageV2Dto | null; editors?: ApplicationUserDto[]; global?: Partial; apis?: IApiV3Dto[]; versions?: { current: CommitDto; }; } export type ExportedApplication = Omit & { settings?: ExportedApplicationSettings; pages: { id: string; isDefault: boolean; }[]; }; export type ExportedMultiPageApplication = Pick & { settings?: ExportedApplicationSettings; }; export type ExportedPage = Omit; export type ExportedPageWithApis = Omit & { apis?: ExportedApiV3Dto[]; }; type ExportedApplicationSettings = Omit; export type ExportedMultiPageApplicationDto = Omit & { application: ExportedMultiPageApplication; apis?: ExportedApiV3Dto[]; deployedCommitId?: string | null; pages?: ExportedPageWithApis[]; }; export declare function isFullApplicationV2Dto(value: unknown): value is FullApplicationV2Dto; export declare function isExportedApplicationDto(value: unknown): value is ExportedMultiPageApplicationDto; export interface IApplicationV2Dto { id: string; name: string; organizationId: string; pageSummaryList?: PageSummary[]; isPublic: boolean; isDeployed: boolean; deployedCommitId?: string | null; deployedGitSha?: string | null; isEditable: boolean; canDelete?: boolean; userPermissions: string[]; deletedAt: Date | null; updated: Date; created: Date; deployedAt?: Date | null; folderId: string | null; creator?: { id: string; name: string; email: string; }; settings?: ApplicationSettings; signature?: ApplicationSignatureTreeSigned | null; configuration?: ApplicationConfiguration; repoConnection?: { created: Date; repository: RepositoryDto; }; currentBranch?: BranchDto; devEnvEnabled?: boolean; /** The name of the template used to create this application (e.g., 'shadcn-demo-app', 'blank-app'). Null for legacy apps. */ templateName?: string | null; degradedMode?: DegradedMode; removedProfiles?: Record>; } export interface IHomepageApplicationV2Dto extends IResourceMetadata { deployedAt?: Date | null; creator?: { id: string; name: string; email: string; }; } export interface ApplicationV2GlobalDto { groups: DataTreeGroup[]; user: DataTreeUser; versions: { current: CommitDto; }; } export type PostApplicationCreateRequestBody = { name: string; organizationId: string; isPublic?: boolean; folderId?: string; settings?: Partial; configuration?: ApplicationConfiguration; signature?: ApplicationSignatureTreeSigned; ipCountry?: string; /** only used for DSL applications */ initialPageDSL?: PageDSL; /** only used for React applications */ createUsingReact?: boolean; /** which template to use when creating a React/code-mode application (e.g. 'shadcn-demo-app', 'blank-app') */ templateName?: string; /** When provided, server generates an AI app name from this prompt */ initialPrompt?: string; }; export interface ApplicationPageClonePayload { applicationId: string; pageId: string; pageName: string; routePath: string; branch?: string; lastSuccessfulWrite: number; signingRequired: boolean; } export interface CreateApplicationPagePayload { pageId?: string; dsl?: PageDSL; routePath?: string; testParams?: Record; signature?: ApplicationSignatureTreeSigned; lastSuccessfulWrite: number; } export type CreateApplicationPageSocketPayload = CreateApplicationPagePayload & { applicationId: string; signingRequired: boolean; branchName?: string; superblocksSupportUpdateEnabled?: boolean; }; export type ModifyEntitiesPayload = { applicationId: string; appConfiguration: ApplicationConfigurationUpdate; pages: ModifyEntitiesPayloadPage[]; apis: ModifyEntitiesPayloadApi[]; renames?: ModifyEntityiesPayloadRename[]; branch?: string; lastSuccessfulWrite: number; signingRequired: boolean; }; type ModifyEntitiesPayloadPage = { pageId: string; dsl: PageDSL; }; export type ModifyEntitiesPayloadApi = { apiId: string; pageId?: string; dsl: { metadata?: Record; blocks?: BaseBlock[]; trigger: Record; signature?: Signature; }; }; export type ModifyEntityiesPayloadRename = { newName: string; oldName: string; entityId: string; }; export type ModifyEntitiesResponse = { updatedTime: number; updatedAPIs?: string[]; signature?: ApplicationSignatureTreeSigned; }; export declare enum ApplicationScope { APP = "APP", PAGE = "PAGE", GLOBAL = "GLOBAL" } export type ApplicationHashChangeSource = 'ai:reject' | 'ai:accept' | 'ai:generate:pre' | 'ai:generate:interim' | 'ai:generate:post' | 'rootUpdate' | 'multiRootUpdate' | 'rootReset' | 'fileChanged' | 'apiUpdate' | 'apiManualUpdate' | 'apiDelete' | 'apiManualDelete' | 'requestedFilesSync' | 'cli:sdk' | 'cli:git-sync' | 'cli:private-registry-migration' | 'initialSync' | 'migrate:templateFlip' | 'migrate:backup' | 'migrate:complete'; /** * Why setApplicationHash returned no `commitId` even though the call succeeded. * These are the by-design no-checkpoint paths. The dev server, which always * supplies a `source`, uses this to log by-design skips at info instead of * warning on every autosave; for it, absence of both `commitId` and this field * is the only genuine "checkpoint creation failed" signal. (The server-side * `no-source` path also returns a commit-less response without this field, but * the dev server never omits the source, so that case does not arise here.) * * - 'draft-autosave' a DRAFT autosave was written inside an active draft session * (a commit exists, but its id is intentionally withheld) * - 'no-changes' the tree hash matches the last checkpoint, so nothing to commit * - 'no-op-source' the change source never produces a commit (e.g. ai:generate:pre) */ export type CheckpointSkipReason = 'draft-autosave' | 'no-changes' | 'no-op-source'; export declare function isSdkApiTemplate(templateName: string | null | undefined): boolean; /** * The product generation an application belongs to, as reported to analytics and * billing. The values are the customer-facing version labels so downstream * consumers (Snowflake, billing) can filter on them directly. */ export declare enum ApplicationType { /** Legacy drag-and-drop application (not code mode). */ V1 = "1.0", /** Code-mode application on a non-SDK-API template. */ V2 = "2.0", /** Code-mode application on an SDK API template. */ V3 = "3.0" } /** * Classifies an application as 1.0 / 2.0 / 3.0 from the two fields that already * live on the application row: `dev_env_enabled` separates legacy (1.0) from * code-mode (2.0+), and the SDK API template separates 3.0 from 2.0. A 2.0 to * 3.0 migration is a `template_name` flip on the same application row, so this * classification follows the app across a migration with no extra lookup. * * Both inputs must come from the application ROW. In particular `templateName` * must not be a commit's effective template (see `effectiveCommitTemplateName`): * a commit predating a 2.0 to 3.0 migration resolves to the legacy template and * would misreport a 3.0 app as 2.0. * * Returns `undefined` when the app cannot be classified because a field was not * projected by the caller's query. `undefined` is distinguishable from a real * `null` template (a legacy template, a valid 2.0 value), so an unselected * column yields no answer instead of a confidently wrong one. */ export declare function getApplicationType(application: { devEnvEnabled?: boolean | null; templateName?: string | null; }): ApplicationType | undefined; /** * The legacy template name that commits predating the per-commit `template_name` * column are treated as. NULL on `application_commit.template_name` means the * commit was created before the per-commit column existed (or by a legacy * write path), and must be rendered with the old YAML/shadcn code path. */ export declare const LEGACY_COMMIT_TEMPLATE_NAME = "shadcn-demo-app"; /** * Resolves the effective template name for a given commit. NULL means "legacy * template" (rendered as `shadcn-demo-app`); anything non-null is the explicit * template the commit was created against. * * Use this helper anywhere `isSdkApiTemplate` is evaluated against a commit * rather than the application row (e.g. when serving preview/deployed versions). */ export declare function effectiveCommitTemplateName(commitTemplateName: string | null | undefined): string; /** * Convenience: does the commit-scoped template use the SDK API structure? * Equivalent to `isSdkApiTemplate(effectiveCommitTemplateName(commitTemplateName))`. */ export declare function isSdkApiCommitTemplate(commitTemplateName: string | null | undefined): boolean; export {}; //# sourceMappingURL=index.d.ts.map