UNPKG

@codesandbox/api

Version:
326 lines (325 loc) 7.93 kB
import type { Team } from "./generated_gql"; export type ModuleError = { message: string; line: number; column: number; title: string; path: string; severity: "error" | "warning"; type: "compile" | "dependency-not-found" | "no-dom-change"; source: string | undefined; payload?: Record<string, unknown>; columnEnd?: number; lineEnd?: number; }; export type ModuleCorrection = { message: string; line: number; column: number; lineEnd?: number; columnEnd?: number; source: string | undefined; path: string | undefined; severity: "notice" | "warning"; }; export type Module = { id: string; title: string; code: string; savedCode: string | null; shortid: string; errors: ModuleError[]; corrections: ModuleCorrection[]; directoryShortid: string | null; isNotSynced: boolean; sourceId: string; isBinary: boolean; insertedAt: string; updatedAt: string; path: string; uploadId?: string; sha?: string; type: "file"; }; export type Directory = { id: string; title: string; directoryShortid: string | null; shortid: string; path: string | null; sourceId: string; type: "directory"; }; export type NpmRegistry = { enabledScopes: string[]; limitToScopes: boolean; registryUrl: string; proxyEnabled?: boolean; registryAuthKey?: string; }; export type PermissionType = "owner" | "write_code" | "write_project" | "comment" | "read" | "none"; export type CustomTemplate = { color?: string; iconUrl?: string; id: string; published?: boolean; title: string; url: string | null; v2: boolean | null; }; export type GitInfo = { repo: string; username: string; path: string; branch: string; commitSha: string | null; }; export type ForkedSandbox = { id: string; alias: string | null; title: string | null; customTemplate: CustomTemplate | null; insertedAt: string; updatedAt: string; template: string; privacy: 0 | 1 | 2; git: GitInfo | null; team: Team | null; }; export type Badge = { id: string; name: string; visible: boolean; }; export type SandboxAuthor = { id: string; username: string; name: string; avatarUrl: string; badges: Badge[]; subscriptionSince: string | null; subscriptionPlan: "pro" | "patron"; }; export type TemplateType = "adonis" | "create-react-app" | "vue-cli" | "preact-cli" | "svelte" | "create-react-app-typescript" | "angular-cli" | "parcel" | "cxjs" | "@dojo/cli-create-app" | "gatsby" | "marko" | "nuxt" | "next" | "reason" | "apollo" | "sapper" | "nest" | "static" | "styleguidist" | "gridsome" | "vuepress" | "mdx-deck" | "quasar" | "unibit" | "node" | "ember" | "custom" | "docusaurus" | "babel-repl" | "esm-react" | "remix" | "solid"; export type Sandbox = { id: string; alias: string | null; title: string | null; description: string; v2: boolean; viewCount: number; likeCount: number; forkCount: number; userLiked: boolean; modules: Module[]; directories: Directory[]; npmRegistries: NpmRegistry[]; featureFlags: Record<string, boolean>; collection?: { id: string; path: string; }; owned: boolean; authorization: PermissionType; npmDependencies: Record<string, string>; customTemplate: CustomTemplate | null; /** * Which template this sandbox is based on */ forkedTemplate: CustomTemplate | null; /** * Sandbox the forked template is from */ forkedTemplateSandbox: ForkedSandbox | null; externalResources: string[]; team: { id: string; name: string; avatarUrl: string | null; } | null; aiConsent: boolean; roomId: string | null; privacy: 0 | 1 | 2; author: SandboxAuthor | null; forkedFromSandbox: ForkedSandbox | null; git: GitInfo | null; tags: string[]; isFrozen: boolean; isSse?: boolean; alwaysOn: boolean; insertedAt: string; updatedAt: string; environmentVariables: Record<string, string> | null; /** * This is the source it's assigned to, a source contains all dependencies, modules and directories * * @type {string} */ sourceId: string; source?: { template: string; }; template: TemplateType; entry: string; originalGit: GitInfo | null; baseGit: GitInfo | null; prNumber: number | null; originalGitCommitSha: string | null; baseGitCommitSha: string | null; originalGitChanges: { added: string[]; modified: string[]; deleted: string[]; rights: "none" | "read" | "write" | "admin"; } | null; version: number; screenshotUrl: string | null; previewSecret: string | null; permissions: { preventSandboxLeaving: boolean; preventSandboxExport: boolean; }; draft: boolean; restricted: boolean; }; export type SignUpUser = { avatarUrl: string | null; username: string; name: string | null; id: string; valid?: boolean; }; export type User = { avatarUrl: string; email: string; username: string; name: string; id: string; provider: "github" | "google"; integrations: { github?: { email: string; } | null; zeit?: { token: string; } | null; }; githubProfile: { data: { avatarUrl: string; id: string; login: string; name?: string; scopes: string[]; } | null; error: { code: string; mesage: string; } | null; }; }; export type GitHubProfile = { avatar_url: string; id: number; login: string; name: string; scopes: string[]; }; export type GHScopeOption = "private_repos" | "public_repos"; export type MetaFeatures = { loginWithApple?: boolean; loginWithGithub?: boolean; loginWithGoogle?: boolean; loginWithWorkos?: boolean; }; export type AuthenticationProvider = { type: "google"; } | { type: "apple"; } | { type: "github"; includedScopes?: GHScopeOption; rawScopes?: string[]; } | { type: "sso"; redirectUrl: string; }; export type AuthenticationResponse = { type: "signin"; data: { devJwt?: string; }; } | { type: "duplicate"; data: { provider: AuthenticationProvider; }; } | { type: "signup"; data: { id: string; }; }; export type DependencyVersion = { version: string; }; export type PricesDetail = { currency: string; unitAmount: number; }; export type Prices = { pro: { month: PricesDetail; year: PricesDetail; }; teamPro: { month: PricesDetail; year: PricesDetail; }; }; export type OK = { status: "ok"; }; export type BranchWithEnvironment = { id: string; owner: string; repo: string; branch: string; sourceBranch: string | null; lastAccessedAt: string | null; gitProvider: "github"; container: { limits: { cpu: string; memory: string; storage: string; }; }; remotes: { origin: string; upstream: string; }; contribution: boolean; }; export type BranchImport = { id: string; owner: string; repo: string; branch: string; defaultBranch: string; sourceBranch: string | null; gitProvider: "github"; appInstalled: boolean; authorization: PermissionType; insertedAt: string; isV2: true; lastAccessedAt: string; repoPrivate: boolean; contribution: boolean; parent: { owner: string; repo: string; defaultBranch: string; } | null; }; export type Branch = Omit<BranchWithEnvironment, "container" | "remotes">;