├── src ├── vite-env.d.ts ├── pages │ ├── PlaygroundPage.tsx │ ├── WidgetsLibrary │ │ ├── index.ts │ │ ├── WidgetsSidebar.tsx │ │ └── WidgetPreview.tsx │ ├── index.ts │ ├── WidgetsLibraryPage.tsx │ ├── WelcomePage.tsx │ ├── DatabasePage.tsx │ └── DashboardPage.tsx ├── lib │ ├── utils.ts │ ├── dialogs.ts │ ├── componentAnalyzer.ts │ ├── compiler │ │ ├── ESBuildCompiler.ts │ │ ├── TailwindCompiler.ts │ │ ├── ESBuildVFS.ts │ │ └── ComponentCompiler.ts │ └── runtime │ │ ├── WidgetRuntime.ts │ │ └── ComponentRuntime.ts ├── pipeline │ ├── ValidationStage.ts │ └── modules-mocks │ │ ├── mockShadcnUiModules.tsx │ │ ├── mockGlobalModules.tsx │ │ └── mockUtilsModule.ts ├── virtual-fs │ ├── shadcn-ui.ts │ ├── types.ts │ └── default-fs.ts ├── platform │ ├── tauri │ │ ├── index.ts │ │ ├── platform.ts │ │ ├── window.ts │ │ ├── storage.ts │ │ ├── dialogs.ts │ │ └── database.ts │ ├── browser │ │ ├── index.ts │ │ ├── platform.ts │ │ ├── window.ts │ │ └── database.ts │ ├── abstract │ │ ├── index.ts │ │ ├── platform.ts │ │ ├── window.ts │ │ ├── storage.ts │ │ ├── dialogs.ts │ │ └── database.ts │ └── index.ts ├── components │ ├── PageHeader.tsx │ ├── ErrorBoundary.tsx │ ├── ui │ │ ├── label.tsx │ │ ├── textarea.tsx │ │ ├── input.tsx │ │ ├── badge.tsx │ │ ├── tabs.tsx │ │ ├── resizable.tsx │ │ ├── button.tsx │ │ ├── card.tsx │ │ └── dialog.tsx │ ├── LoadingState.tsx │ ├── EmptyState.tsx │ ├── dashboard │ │ ├── GridOverlay.tsx │ │ ├── AddWidgetModal.tsx │ │ └── DashboardWidgetComponent.tsx │ ├── DashboardsList.tsx │ ├── database │ │ └── DatabaseCard.tsx │ ├── DashboardCard.tsx │ └── AppHeader.tsx ├── types │ ├── database.ts │ ├── widget.ts │ ├── dashboard.ts │ └── storage.ts ├── main.tsx ├── hooks │ └── useCellSize.ts ├── App.tsx ├── App.css ├── stores │ ├── WidgetsRepository.ts │ └── DatabaseStore.ts └── assets │ └── react.svg ├── src-tauri ├── build.rs ├── icons │ ├── icon.ico │ ├── icon.png │ ├── 32x32.png │ ├── icon.icns │ ├── 128x128.png │ ├── StoreLogo.png │ ├── 128x128@2x.png │ ├── Square30x30Logo.png │ ├── Square44x44Logo.png │ ├── Square71x71Logo.png │ ├── Square89x89Logo.png │ ├── Square107x107Logo.png │ ├── Square142x142Logo.png │ ├── Square150x150Logo.png │ ├── Square284x284Logo.png │ └── Square310x310Logo.png ├── .gitignore ├── src │ ├── main.rs │ └── lib.rs ├── tauri.conf.json ├── capabilities │ └── default.json └── Cargo.toml ├── public ├── icon.png ├── favicon.ico ├── apple-icon.png ├── vite.svg └── tauri.svg ├── pnpm-workspace.yaml ├── assets └── gh-screen.png ├── .vscode └── extensions.json ├── .supercode └── def.json ├── src-back ├── nodemon.json ├── .prettierrc ├── src │ ├── middlewares │ │ ├── errorHandler.ts │ │ └── rateLimiter.ts │ ├── types │ │ └── index.ts │ ├── index.ts │ └── routes │ │ └── sql.ts ├── tsconfig.json ├── package.json ├── .gitignore └── README.md ├── __legacy ├── src-node │ ├── src │ │ ├── ipc │ │ │ ├── index.ts │ │ │ ├── types.ts │ │ │ ├── protocol.ts │ │ │ └── command-handler.ts │ │ ├── types │ │ │ └── index.ts │ │ ├── utils │ │ │ └── index.ts │ │ ├── request-handler │ │ │ └── index.ts │ │ ├── compiler │ │ │ ├── esbuild-compiler.ts │ │ │ ├── index.ts │ │ │ └── esbuild-vfs.ts │ │ └── index.ts │ ├── tsconfig.json │ ├── scripts │ │ └── build.js │ └── package.json ├── SidecarEncoder.ts ├── sidecar.ts ├── SidecarExecutor.ts └── compiler │ ├── index.ts │ ├── postcss-compiler.ts │ └── tailwind-compiler.ts ├── tsconfig.node.json ├── .prettierrc ├── .gitignore ├── components.json ├── tsconfig.json ├── index.html ├── vite.config.ts ├── README.md └── package.json /src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /src-tauri/build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | tauri_build::build() 3 | } 4 | -------------------------------------------------------------------------------- /public/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/public/icon.png -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | onlyBuiltDependencies: 2 | - esbuild 3 | - sharp 4 | - workerd 5 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /assets/gh-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/assets/gh-screen.png -------------------------------------------------------------------------------- /public/apple-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/public/apple-icon.png -------------------------------------------------------------------------------- /src-tauri/icons/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/src-tauri/icons/icon.ico -------------------------------------------------------------------------------- /src-tauri/icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/src-tauri/icons/icon.png -------------------------------------------------------------------------------- /src-tauri/icons/32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/src-tauri/icons/32x32.png -------------------------------------------------------------------------------- /src-tauri/icons/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/src-tauri/icons/icon.icns -------------------------------------------------------------------------------- /src-tauri/icons/128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/src-tauri/icons/128x128.png -------------------------------------------------------------------------------- /src-tauri/icons/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/src-tauri/icons/StoreLogo.png -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"] 3 | } 4 | -------------------------------------------------------------------------------- /src-tauri/icons/128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/src-tauri/icons/128x128@2x.png -------------------------------------------------------------------------------- /src-tauri/icons/Square30x30Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/src-tauri/icons/Square30x30Logo.png -------------------------------------------------------------------------------- /src-tauri/icons/Square44x44Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/src-tauri/icons/Square44x44Logo.png -------------------------------------------------------------------------------- /src-tauri/icons/Square71x71Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/src-tauri/icons/Square71x71Logo.png -------------------------------------------------------------------------------- /src-tauri/icons/Square89x89Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/src-tauri/icons/Square89x89Logo.png -------------------------------------------------------------------------------- /src-tauri/icons/Square107x107Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/src-tauri/icons/Square107x107Logo.png -------------------------------------------------------------------------------- /src-tauri/icons/Square142x142Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/src-tauri/icons/Square142x142Logo.png -------------------------------------------------------------------------------- /src-tauri/icons/Square150x150Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/src-tauri/icons/Square150x150Logo.png -------------------------------------------------------------------------------- /src-tauri/icons/Square284x284Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/src-tauri/icons/Square284x284Logo.png -------------------------------------------------------------------------------- /src-tauri/icons/Square310x310Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ElKornacio/qyp-mini/HEAD/src-tauri/icons/Square310x310Logo.png -------------------------------------------------------------------------------- /.supercode/def.json: -------------------------------------------------------------------------------- 1 | { 2 | "tags": ["react", "typescript", "nodejs", "rust", "tauri", "vite", "tailwindcss", "pnpm", "shadcn/ui"] 3 | } 4 | -------------------------------------------------------------------------------- /src-back/nodemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "watch": ["src"], 3 | "ext": "ts,js,json", 4 | "ignore": ["src/**/*.spec.ts"], 5 | "exec": "ts-node src/index.ts" 6 | } 7 | -------------------------------------------------------------------------------- /src/pages/PlaygroundPage.tsx: -------------------------------------------------------------------------------- 1 | export function PlaygroundPage() { 2 | // 3 | 4 | return
none
; 5 | } 6 | -------------------------------------------------------------------------------- /src/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { clsx, type ClassValue } from "clsx" 2 | import { twMerge } from "tailwind-merge" 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)) 6 | } 7 | -------------------------------------------------------------------------------- /src-tauri/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | 5 | # Generated by Tauri 6 | # will have schema files for capabilities auto-completion 7 | /gen/schemas 8 | -------------------------------------------------------------------------------- /src-tauri/src/main.rs: -------------------------------------------------------------------------------- 1 | // Prevents additional console window on Windows in release, DO NOT REMOVE!! 2 | #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] 3 | 4 | fn main() { 5 | qyp_mini_lib::run() 6 | } 7 | -------------------------------------------------------------------------------- /src/pipeline/ValidationStage.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Здесь мы будем гонять линтеры, typechecking, etc. 3 | * Чтобы на раннем этапе выявлять ошибки и сообщать о них агенту. 4 | */ 5 | export class ValidationStage { 6 | constructor() {} 7 | } 8 | -------------------------------------------------------------------------------- /src/pages/WidgetsLibrary/index.ts: -------------------------------------------------------------------------------- 1 | export { WidgetsSidebar } from './WidgetsSidebar'; 2 | export { WidgetPreview } from './WidgetPreview'; 3 | export { CodeEditor } from './CodeEditor'; 4 | export { WidgetEditor } from './WidgetEditor'; 5 | -------------------------------------------------------------------------------- /src/lib/dialogs.ts: -------------------------------------------------------------------------------- 1 | import { platform } from '@/platform'; 2 | 3 | export const confirmDialog = async (message: string) => { 4 | return await platform.dialogs.confirm(message, { 5 | title: 'Подтверждение', 6 | kind: 'warning', 7 | }); 8 | }; 9 | -------------------------------------------------------------------------------- /__legacy/src-node/src/ipc/index.ts: -------------------------------------------------------------------------------- 1 | export { IPCProtocol } from './protocol.js'; 2 | export { CommandHandler, type CommandProcessor } from './command-handler.js'; 3 | export { BaseRequest, BaseSuccessResponse, BaseErrorResponse, BaseResponse } from './types.js'; 4 | -------------------------------------------------------------------------------- /tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "skipLibCheck": true, 5 | "module": "ESNext", 6 | "moduleResolution": "bundler", 7 | "allowSyntheticDefaultImports": true 8 | }, 9 | "include": ["vite.config.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /src/pages/index.ts: -------------------------------------------------------------------------------- 1 | export { WelcomePage } from './WelcomePage'; 2 | export { PlaygroundPage } from './PlaygroundPage'; 3 | export { WidgetsLibraryPage } from './WidgetsLibraryPage'; 4 | export { DatabasePage } from './DatabasePage'; 5 | export { DashboardPage } from './DashboardPage'; 6 | -------------------------------------------------------------------------------- /src/virtual-fs/shadcn-ui.ts: -------------------------------------------------------------------------------- 1 | import { VirtualFS } from '@/virtual-fs/VirtualFS'; 2 | 3 | export const buildShadcnUiFS = async (vfs: VirtualFS): Promise => { 4 | vfs.writeFile('/src/components/ui/button.tsx', `// nothing here for now`, { 5 | externalized: true, 6 | }); 7 | }; 8 | -------------------------------------------------------------------------------- /src/platform/tauri/index.ts: -------------------------------------------------------------------------------- 1 | export { TauriWindowManager } from './window'; 2 | export { TauriStorageManager } from './storage'; 3 | export { TauriDialogManager } from './dialogs'; 4 | export { TauriDatabaseConnection, TauriDatabaseManager } from './database'; 5 | export { TauriPlatform } from './platform'; 6 | -------------------------------------------------------------------------------- /src/pipeline/modules-mocks/mockShadcnUiModules.tsx: -------------------------------------------------------------------------------- 1 | import * as ButtonModule from '@/components/ui/button'; 2 | 3 | export const tryToMockShadcnUiModules = (_context: any, path: string) => { 4 | if (path === '@/components/ui/button') { 5 | return ButtonModule; 6 | } 7 | 8 | return null; 9 | }; 10 | -------------------------------------------------------------------------------- /src/platform/browser/index.ts: -------------------------------------------------------------------------------- 1 | export { BrowserWindowManager } from './window'; 2 | export { BrowserStorageManager } from './storage'; 3 | export { BrowserDialogManager } from './dialogs'; 4 | export { BrowserDatabaseConnection, BrowserDatabaseManager } from './database'; 5 | export { BrowserPlatform } from './platform'; 6 | -------------------------------------------------------------------------------- /src/pipeline/modules-mocks/mockGlobalModules.tsx: -------------------------------------------------------------------------------- 1 | import * as ReactRuntime from 'react'; 2 | import * as ReactJSXRuntime from 'react/jsx-runtime'; 3 | 4 | export const tryToMockGlobalModule = (_context: any, path: string) => { 5 | if (path === 'react') { 6 | return ReactRuntime; 7 | } else if (path === 'react/jsx-runtime') { 8 | return ReactJSXRuntime; 9 | } 10 | 11 | return null; 12 | }; 13 | -------------------------------------------------------------------------------- /src/platform/abstract/index.ts: -------------------------------------------------------------------------------- 1 | export type { WindowManager, WindowSize } from './window'; 2 | export type { StorageManager, DirectoryEntry } from './storage'; 3 | export type { DialogManager, ConfirmOptions, AlertOptions, MessageBoxOptions } from './dialogs'; 4 | export { DatabaseConnection, type DatabaseManager, type ConnectionStatus } from './database'; 5 | export type { PlatformManager } from './platform'; 6 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120, 3 | "tabWidth": 4, 4 | "useTabs": true, 5 | "semi": true, 6 | "singleQuote": true, 7 | "trailingComma": "all", 8 | "bracketSpacing": true, 9 | "jsxBracketSameLine": false, 10 | "arrowParens": "avoid", 11 | "quoteProps": "consistent", 12 | "proseWrap": "never", 13 | "jsxSingleQuote": false, 14 | "htmlWhitespaceSensitivity": "strict", 15 | "endOfLine": "lf" 16 | } 17 | -------------------------------------------------------------------------------- /src-back/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120, 3 | "tabWidth": 4, 4 | "useTabs": true, 5 | "semi": true, 6 | "singleQuote": true, 7 | "trailingComma": "all", 8 | "bracketSpacing": true, 9 | "jsxBracketSameLine": false, 10 | "arrowParens": "avoid", 11 | "quoteProps": "consistent", 12 | "proseWrap": "never", 13 | "jsxSingleQuote": false, 14 | "htmlWhitespaceSensitivity": "strict", 15 | "endOfLine": "lf" 16 | } 17 | -------------------------------------------------------------------------------- /src/pages/WidgetsLibraryPage.tsx: -------------------------------------------------------------------------------- 1 | import { observer } from 'mobx-react'; 2 | import { WidgetsSidebar, WidgetEditor } from './WidgetsLibrary'; 3 | 4 | export const WidgetsLibraryPage = observer(() => { 5 | return ( 6 |
7 | {/* Левый сайдбар со списком виджетов */} 8 | 9 | 10 | {/* Основная область редактирования */} 11 | 12 |
13 | ); 14 | }); 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | 26 | /__temp 27 | 28 | src-tauri/binaries/* 29 | 30 | .env.wrangler 31 | .wrangler -------------------------------------------------------------------------------- /__legacy/src-node/src/ipc/types.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Базовый интерфейс для запроса 3 | */ 4 | export interface BaseRequest { 5 | command: string; 6 | } 7 | 8 | export interface BaseSuccessResponse { 9 | status: 'success'; 10 | result: T; 11 | } 12 | 13 | export interface BaseErrorResponse { 14 | status: 'error'; 15 | error: string; 16 | stack?: string; 17 | } 18 | 19 | export type BaseResponse = BaseSuccessResponse | BaseErrorResponse; 20 | -------------------------------------------------------------------------------- /__legacy/src-node/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "commonjs", 5 | "declaration": true, 6 | "outDir": "./dist", 7 | "sourceMap": true, 8 | "esModuleInterop": true, 9 | "experimentalDecorators": true, 10 | "emitDecoratorMetadata": true, 11 | "strict": true, 12 | "strictNullChecks": true, 13 | "skipLibCheck": true 14 | }, 15 | "include": ["./src", "../src/virtual-fs/VirtualFS.ts", "../src/virtual-fs/types.ts"] 16 | } 17 | -------------------------------------------------------------------------------- /__legacy/src-node/scripts/build.js: -------------------------------------------------------------------------------- 1 | const { execSync } = require('child_process'); 2 | const fs = require('fs'); 3 | 4 | const ext = process.platform === 'win32' ? '.exe' : ''; 5 | 6 | const appName = process.argv[2]; 7 | 8 | const rustInfo = execSync('rustc -vV'); 9 | const targetTriple = /host: (\S+)/g.exec(rustInfo)[1]; 10 | if (!targetTriple) { 11 | console.error('Failed to determine platform target triple'); 12 | } 13 | fs.renameSync(`${appName}${ext}`, `../src-tauri/binaries/${appName}-${targetTriple}${ext}`); 14 | -------------------------------------------------------------------------------- /components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "new-york", 4 | "rsc": false, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "", 8 | "css": "src/index.css", 9 | "baseColor": "zinc", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils", 16 | "ui": "@/components/ui", 17 | "lib": "@/lib", 18 | "hooks": "@/hooks" 19 | }, 20 | "iconLibrary": "lucide" 21 | } -------------------------------------------------------------------------------- /src/pipeline/modules-mocks/mockUtilsModule.ts: -------------------------------------------------------------------------------- 1 | import { WidgetRuntimeContext } from '@/types/dashboard'; 2 | 3 | export const tryToMockUtilsModule = (context: any, path: string) => { 4 | if (path === '@/lib/utils') { 5 | const runtimeContext = context as WidgetRuntimeContext; 6 | 7 | return { 8 | runSql: async (query: string): Promise => { 9 | const result = await runtimeContext.database.connection.select(query); 10 | return result as T; 11 | }, 12 | }; 13 | } 14 | 15 | return null; 16 | }; 17 | -------------------------------------------------------------------------------- /src/components/PageHeader.tsx: -------------------------------------------------------------------------------- 1 | export const PageHeader = ({ 2 | title, 3 | subtitle, 4 | children, 5 | }: { 6 | title: string; 7 | subtitle: string; 8 | children: React.ReactNode; 9 | }) => { 10 | return ( 11 |
12 |
13 |

{title}

14 |

{subtitle}

15 |
16 | {children} 17 |
18 | ); 19 | }; 20 | -------------------------------------------------------------------------------- /src-back/src/middlewares/errorHandler.ts: -------------------------------------------------------------------------------- 1 | import { Request, Response, NextFunction } from 'express'; 2 | import { ErrorResponse } from '../types'; 3 | 4 | export const errorHandler = (err: Error, req: Request, res: Response, next: NextFunction): void => { 5 | console.error('Error:', err); 6 | 7 | const errorResponse: ErrorResponse = { 8 | success: false, 9 | error: process.env.NODE_ENV === 'production' ? 'Internal server error' : err.message, 10 | timestamp: new Date().toISOString(), 11 | }; 12 | 13 | res.status(500).json(errorResponse); 14 | }; 15 | -------------------------------------------------------------------------------- /__legacy/src-node/src/types/index.ts: -------------------------------------------------------------------------------- 1 | import { BaseRequest } from '../ipc/index.js'; 2 | import { SerializedVirtualNode } from '../../../src/virtual-fs/types.js'; 3 | 4 | export interface PingRequest extends BaseRequest { 5 | message: string; 6 | } 7 | 8 | export interface PingResponse { 9 | message: string; 10 | } 11 | 12 | export interface CompileComponentRequest extends BaseRequest { 13 | serializedVFS: SerializedVirtualNode[]; 14 | entryPoint: string; 15 | } 16 | 17 | export interface CompileComponentResponse { 18 | jsBundle: string; 19 | cssBundle: string; 20 | } 21 | -------------------------------------------------------------------------------- /__legacy/src-node/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Безопасно парсит JSON с обработкой ошибок 3 | */ 4 | export function safeJsonParse(json: string): T | null { 5 | try { 6 | return JSON.parse(json) as T; 7 | } catch { 8 | return null; 9 | } 10 | } 11 | 12 | /** 13 | * Создает ошибку с дополнительной информацией 14 | */ 15 | export function createError(message: string, originalError?: unknown): Error { 16 | const error = new Error(message); 17 | 18 | if (originalError instanceof Error) { 19 | error.stack = `${error.stack}\nCaused by: ${originalError.stack}`; 20 | } 21 | 22 | return error; 23 | } 24 | -------------------------------------------------------------------------------- /src-back/src/types/index.ts: -------------------------------------------------------------------------------- 1 | export interface DatabaseCredentials { 2 | host: string; 3 | port: number; 4 | username: string; 5 | password: string; 6 | database: string; 7 | type: 'postgres' | 'mysql' | 'sqlite'; 8 | ssl?: boolean; 9 | } 10 | 11 | export interface SqlRequest { 12 | credentials: DatabaseCredentials; 13 | query: string; 14 | parameters?: any[]; 15 | } 16 | 17 | export interface SqlResponse { 18 | success: boolean; 19 | data?: any[]; 20 | error?: string; 21 | executionTime?: number; 22 | rowCount?: number; 23 | } 24 | 25 | export interface ErrorResponse { 26 | success: false; 27 | error: string; 28 | timestamp: string; 29 | } 30 | -------------------------------------------------------------------------------- /src/components/ErrorBoundary.tsx: -------------------------------------------------------------------------------- 1 | import { makeObservable, observable } from 'mobx'; 2 | import * as React from 'react'; 3 | 4 | export class ErrorBoundary extends React.Component<{ 5 | fallback: (error: any) => React.ReactNode; 6 | children: React.ReactNode; 7 | }> { 8 | @observable error = null; 9 | 10 | constructor(props: any) { 11 | super(props); 12 | 13 | makeObservable(this); 14 | } 15 | 16 | componentDidCatch(error: any, _info: any) { 17 | this.error = error; 18 | } 19 | 20 | render() { 21 | if (this.error) { 22 | // You can render any custom fallback UI 23 | return this.props.fallback(this.error); 24 | } 25 | 26 | return this.props.children; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/platform/tauri/platform.ts: -------------------------------------------------------------------------------- 1 | import { PlatformManager } from '../abstract/platform'; 2 | import { TauriWindowManager } from './window'; 3 | import { TauriStorageManager } from './storage'; 4 | import { TauriDialogManager } from './dialogs'; 5 | import { TauriDatabaseManager } from './database'; 6 | 7 | /** 8 | * Tauri-реализация платформы 9 | */ 10 | export class TauriPlatform implements PlatformManager { 11 | readonly type = 'tauri' as const; 12 | 13 | public readonly window = new TauriWindowManager(); 14 | public readonly storage = new TauriStorageManager(); 15 | public readonly dialogs = new TauriDialogManager(); 16 | public readonly database = new TauriDatabaseManager(); 17 | } 18 | -------------------------------------------------------------------------------- /src/components/ui/label.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | import * as LabelPrimitive from "@radix-ui/react-label" 3 | 4 | import { cn } from "@/lib/utils" 5 | 6 | function Label({ 7 | className, 8 | ...props 9 | }: React.ComponentProps) { 10 | return ( 11 | 19 | ) 20 | } 21 | 22 | export { Label } 23 | -------------------------------------------------------------------------------- /src-tauri/tauri.conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://schema.tauri.app/config/2", 3 | "productName": "qyp-mini", 4 | "version": "0.1.0", 5 | "identifier": "ai.qyp.mini.app", 6 | "build": { 7 | "beforeDevCommand": "pnpm dev", 8 | "devUrl": "http://localhost:1420", 9 | "beforeBuildCommand": "pnpm build", 10 | "frontendDist": "../dist" 11 | }, 12 | "app": { 13 | "windows": [ 14 | { 15 | "title": "qyp-mini", 16 | "width": 800, 17 | "height": 600 18 | } 19 | ], 20 | "security": { 21 | "csp": null 22 | } 23 | }, 24 | "bundle": { 25 | "active": true, 26 | "targets": "all", 27 | "icon": ["icons/32x32.png", "icons/128x128.png", "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico"] 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/platform/abstract/platform.ts: -------------------------------------------------------------------------------- 1 | import { WindowManager } from './window'; 2 | import { StorageManager } from './storage'; 3 | import { DialogManager } from './dialogs'; 4 | import { DatabaseManager } from './database'; 5 | 6 | /** 7 | * Основной интерфейс платформы, объединяющий все менеджеры 8 | */ 9 | export interface PlatformManager { 10 | /** 11 | * Менеджер управления окном 12 | */ 13 | window: WindowManager; 14 | 15 | /** 16 | * Менеджер файловой системы 17 | */ 18 | storage: StorageManager; 19 | 20 | /** 21 | * Менеджер диалогов 22 | */ 23 | dialogs: DialogManager; 24 | 25 | /** 26 | * Менеджер подключений к БД 27 | */ 28 | database: DatabaseManager; 29 | 30 | /** 31 | * Тип платформы 32 | */ 33 | readonly type: 'tauri' | 'browser'; 34 | } 35 | -------------------------------------------------------------------------------- /src-back/src/middlewares/rateLimiter.ts: -------------------------------------------------------------------------------- 1 | import rateLimit from 'express-rate-limit'; 2 | 3 | export const sqlRateLimit = rateLimit({ 4 | windowMs: 1 * 60 * 1000, // 1 minute 5 | max: 10, // Maximum 10 requests per minute per IP 6 | message: { 7 | success: false, 8 | error: 'Too many SQL requests from this IP, please try again later.', 9 | timestamp: new Date().toISOString(), 10 | }, 11 | standardHeaders: true, 12 | legacyHeaders: false, 13 | }); 14 | 15 | export const generalRateLimit = rateLimit({ 16 | windowMs: 1 * 60 * 1000, // 1 minute 17 | max: 100, // Maximum 100 requests per minute per IP 18 | message: { 19 | success: false, 20 | error: 'Too many requests from this IP, please try again later.', 21 | timestamp: new Date().toISOString(), 22 | }, 23 | standardHeaders: true, 24 | legacyHeaders: false, 25 | }); 26 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2020", 4 | "useDefineForClassFields": true, 5 | "lib": ["ES2020", "DOM", "DOM.Iterable"], 6 | "module": "ESNext", 7 | "skipLibCheck": true, 8 | 9 | /* Bundler mode */ 10 | "moduleResolution": "bundler", 11 | "allowImportingTsExtensions": true, 12 | "experimentalDecorators": true, 13 | "resolveJsonModule": true, 14 | "isolatedModules": true, 15 | "noEmit": true, 16 | "jsx": "react-jsx", 17 | 18 | "baseUrl": ".", 19 | 20 | "paths": { 21 | "@/*": ["./src/*"] 22 | }, 23 | 24 | /* Linting */ 25 | "strict": true, 26 | "noUnusedLocals": true, 27 | "noUnusedParameters": true, 28 | "noFallthroughCasesInSwitch": true 29 | }, 30 | "include": ["src", "src/virtual-fs/VirtualFS.ts"], 31 | "references": [{ "path": "./tsconfig.node.json" }] 32 | } 33 | -------------------------------------------------------------------------------- /src-tauri/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Learn more about Tauri commands at https://tauri.app/develop/calling-rust/ 2 | #[tauri::command] 3 | fn greet(name: &str) -> String { 4 | format!("Hello, {}! You've been greeted from Rust!", name) 5 | } 6 | 7 | #[cfg_attr(mobile, tauri::mobile_entry_point)] 8 | pub fn run() { 9 | tauri::Builder::default() 10 | .plugin(tauri_plugin_stronghold::Builder::new(|pass| todo!()).build()) 11 | .plugin(tauri_plugin_fs::init()) 12 | .plugin(tauri_plugin_dialog::init()) 13 | .plugin(tauri_plugin_sql::Builder::new().build()) 14 | .plugin(tauri_plugin_shell::init()) 15 | .plugin(tauri_plugin_opener::init()) 16 | .invoke_handler(tauri::generate_handler![greet]) 17 | .run(tauri::generate_context!()) 18 | .expect("error while running tauri application"); 19 | } 20 | -------------------------------------------------------------------------------- /src/components/ui/textarea.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | import { cn } from "@/lib/utils" 4 | 5 | function Textarea({ className, ...props }: React.ComponentProps<"textarea">) { 6 | return ( 7 |