From f6a43a5f2cda6ab3b007705e97b54bd047ed2b66 Mon Sep 17 00:00:00 2001 From: melvinchia3636 Date: Tue, 9 Jun 2026 17:44:51 +0800 Subject: [PATCH] refactor: some more sdk update --- client/package.json | 6 +- .../components/AvatarColumn.tsx | 2 +- .../components/OrdinaryColumn.tsx | 2 +- .../components/TwoFAColumn.tsx | 2 +- .../modals/DisableTwoFAModal.tsx | 2 +- .../modals/EnableTwoFAModal/index.tsx | 2 +- .../accountSettings/modals/ModifyModal.tsx | 2 +- client/src/core/auth/components/AuthForm.tsx | 2 +- .../components/SignInButton.tsx | 2 +- .../components/SigninWithProviderButton.tsx | 2 +- .../QRLoginModal/hooks/useQRLoginSession.ts | 2 +- .../TwoFAModal/components/UsingEmail.tsx | 2 +- .../src/core/auth/modals/TwoFAModal/index.tsx | 2 +- client/src/core/auth/pages/LoginPage.tsx | 2 +- .../features/UserPersonalizationProvider.tsx | 2 +- client/src/providers/index.tsx | 2 +- .../components/Sidebar/SidebarBottomBar.tsx | 2 +- .../components/Sidebar/SidebarEventBanner.tsx | 2 +- .../components/Sidebar/SidebarItems.tsx | 2 +- client/src/routes/hooks/useAppRouter.ts | 2 +- client/tsconfig.json | 1 - package.json | 3 +- packages/api/contract.ts | 2985 +++++++++++++++++ packages/api/package.json | 11 +- packages/api/src/index.ts | 2 + .../api}/src/providers/AuthProvider.tsx | 32 +- packages/api/tsconfig.json | 18 +- packages/api/vite.config.ts | 46 + packages/configs/package.json | 11 +- .../src/interfaces/module_config.types.ts | 5 +- packages/federation/package.json | 6 +- .../src/loaders/loadModuleConfig.ts | 1 - packages/log/package.json | 3 +- packages/log/tsconfig.json | 17 +- packages/server-utils/package.json | 6 +- .../src/typescript/core/core_context.types.ts | 2 +- packages/server-utils/tsconfig.json | 19 +- packages/ui/contract.ts | 2985 +++++++++++++++++ packages/ui/package.json | 4 +- .../IconInput/components/IconPreview.tsx | 9 +- server/package.json | 2 +- server/src/core/routes/core.routes.ts | 7 +- 42 files changed, 6126 insertions(+), 93 deletions(-) create mode 100644 packages/api/contract.ts rename {client => packages/api}/src/providers/AuthProvider.tsx (91%) create mode 100644 packages/api/vite.config.ts create mode 100644 packages/ui/contract.ts diff --git a/client/package.json b/client/package.json index e254ac0b2..8a2c2a059 100644 --- a/client/package.json +++ b/client/package.json @@ -13,15 +13,14 @@ "type": "module", "scripts": { "dev": "vite", - "types": "tsc -b", - "build": "tsc -b && vite build", + "types": "tsgo -b", + "build": "tsgo -b && vite build", "preview": "vite preview" }, "dependencies": { "@dnd-kit/core": "^6.3.1", "@dnd-kit/sortable": "^10.0.0", "@dnd-kit/utilities": "^3.2.2", - "@iconify/react": "^6.0.2", "@lifeforge/api": "workspace:*", "@lifeforge/federation": "workspace:*", "@lifeforge/ui": "workspace:*", @@ -45,7 +44,6 @@ "react-virtualized": "^9.22.6", "recharts": "^2.15.0", "socket.io-client": "^4.8.1", - "typescript": "^5.9.3", "uuid": "^13.0.0" }, "devDependencies": { diff --git a/client/src/core/accountSettings/components/AvatarColumn.tsx b/client/src/core/accountSettings/components/AvatarColumn.tsx index f4a96d644..271d47ff2 100644 --- a/client/src/core/accountSettings/components/AvatarColumn.tsx +++ b/client/src/core/accountSettings/components/AvatarColumn.tsx @@ -3,7 +3,7 @@ import { useCallback } from 'react' import { useTranslation } from 'react-i18next' import { toast } from '@lifeforge/ui' -import { useAuth } from '@/providers/AuthProvider' +import { useAuth } from '@lifeforge/api' import { Box, Button, diff --git a/client/src/core/accountSettings/components/OrdinaryColumn.tsx b/client/src/core/accountSettings/components/OrdinaryColumn.tsx index 54a4b5c64..147c524b6 100644 --- a/client/src/core/accountSettings/components/OrdinaryColumn.tsx +++ b/client/src/core/accountSettings/components/OrdinaryColumn.tsx @@ -3,7 +3,7 @@ import _ from 'lodash' import { useCallback } from 'react' import { useTranslation } from 'react-i18next' -import { useAuth } from '@/providers/AuthProvider' +import { useAuth } from '@lifeforge/api' import { Button, Flex, OptionsColumn, Text, useModalStore } from '@lifeforge/ui' import ModifyModal from '../modals/ModifyModal' diff --git a/client/src/core/accountSettings/components/TwoFAColumn.tsx b/client/src/core/accountSettings/components/TwoFAColumn.tsx index 7fc701c11..869100860 100644 --- a/client/src/core/accountSettings/components/TwoFAColumn.tsx +++ b/client/src/core/accountSettings/components/TwoFAColumn.tsx @@ -1,7 +1,7 @@ import { useCallback } from 'react' import { useTranslation } from 'react-i18next' -import { useAuth } from '@/providers/AuthProvider' +import { useAuth } from '@lifeforge/api' import { Flex, OptionsColumn, Switch, Text, useModalStore } from '@lifeforge/ui' import DisableTwoFAModal from '../modals/DisableTwoFAModal' diff --git a/client/src/core/accountSettings/modals/DisableTwoFAModal.tsx b/client/src/core/accountSettings/modals/DisableTwoFAModal.tsx index 66d27c937..cb498f6b2 100644 --- a/client/src/core/accountSettings/modals/DisableTwoFAModal.tsx +++ b/client/src/core/accountSettings/modals/DisableTwoFAModal.tsx @@ -1,7 +1,7 @@ import { useTranslation } from 'react-i18next' import { toast } from '@lifeforge/ui' -import { useAuth } from '@/providers/AuthProvider' +import { useAuth } from '@lifeforge/api' import { ConfirmationModal } from '@lifeforge/ui' import forgeAPI from '@/forgeAPI' diff --git a/client/src/core/accountSettings/modals/EnableTwoFAModal/index.tsx b/client/src/core/accountSettings/modals/EnableTwoFAModal/index.tsx index 48632285c..0192dae83 100644 --- a/client/src/core/accountSettings/modals/EnableTwoFAModal/index.tsx +++ b/client/src/core/accountSettings/modals/EnableTwoFAModal/index.tsx @@ -2,7 +2,7 @@ import { useCallback } from 'react' import { useTranslation } from 'react-i18next' import { toast } from '@lifeforge/ui' -import { useAuth } from '@/providers/AuthProvider' +import { useAuth } from '@lifeforge/api' import { Box, ModalHeader } from '@lifeforge/ui' import TwoFAEnableProcedure from './components/TwoFAEnableProcedure' diff --git a/client/src/core/accountSettings/modals/ModifyModal.tsx b/client/src/core/accountSettings/modals/ModifyModal.tsx index fb01301ce..43bf1e397 100644 --- a/client/src/core/accountSettings/modals/ModifyModal.tsx +++ b/client/src/core/accountSettings/modals/ModifyModal.tsx @@ -5,7 +5,7 @@ import { useForm } from 'react-hook-form' import { toast } from '@lifeforge/ui' import z from 'zod' -import { useAuth, type UserData } from '@/providers/AuthProvider' +import { useAuth, type UserData } from '@lifeforge/api' import { DateField, FormModal, diff --git a/client/src/core/auth/components/AuthForm.tsx b/client/src/core/auth/components/AuthForm.tsx index 03375a24c..961731700 100644 --- a/client/src/core/auth/components/AuthForm.tsx +++ b/client/src/core/auth/components/AuthForm.tsx @@ -6,7 +6,7 @@ import { useSearchParams } from 'react-router' import { usePromiseLoading } from '@lifeforge/api' import { Stack, TextInput, toast } from '@lifeforge/ui' -import { useAuth } from '@/providers/AuthProvider' +import { useAuth } from '@lifeforge/api' import AuthSignInButton from './AuthSignInButtons' diff --git a/client/src/core/auth/components/AuthSignInButtons/components/SignInButton.tsx b/client/src/core/auth/components/AuthSignInButtons/components/SignInButton.tsx index a44e37354..62ed4be0c 100644 --- a/client/src/core/auth/components/AuthSignInButtons/components/SignInButton.tsx +++ b/client/src/core/auth/components/AuthSignInButtons/components/SignInButton.tsx @@ -1,6 +1,6 @@ import { memo } from 'react' -import { useAuth } from '@/providers/AuthProvider' +import { useAuth } from '@lifeforge/api' import { Button } from '@lifeforge/ui' function SignInButton({ diff --git a/client/src/core/auth/components/AuthSignInButtons/components/SigninWithProviderButton.tsx b/client/src/core/auth/components/AuthSignInButtons/components/SigninWithProviderButton.tsx index dac4f2bee..7cf4c35b6 100644 --- a/client/src/core/auth/components/AuthSignInButtons/components/SigninWithProviderButton.tsx +++ b/client/src/core/auth/components/AuthSignInButtons/components/SigninWithProviderButton.tsx @@ -2,7 +2,7 @@ import _ from 'lodash' import { memo, useCallback } from 'react' import { toast } from '@lifeforge/ui' -import { useAuth } from '@/providers/AuthProvider' +import { useAuth } from '@lifeforge/api' import { Button } from '@lifeforge/ui' import forgeAPI from '@/forgeAPI' diff --git a/client/src/core/auth/modals/QRLoginModal/hooks/useQRLoginSession.ts b/client/src/core/auth/modals/QRLoginModal/hooks/useQRLoginSession.ts index 10804689a..6501429ea 100644 --- a/client/src/core/auth/modals/QRLoginModal/hooks/useQRLoginSession.ts +++ b/client/src/core/auth/modals/QRLoginModal/hooks/useQRLoginSession.ts @@ -4,7 +4,7 @@ import { toast } from '@lifeforge/ui' import { Socket, io } from 'socket.io-client' import { v4 as uuidv4 } from 'uuid' -import { useAuth } from '@/providers/AuthProvider' +import { useAuth } from '@lifeforge/api' import { useAPIEndpoint } from '@lifeforge/api' import forgeAPI from '@/forgeAPI' diff --git a/client/src/core/auth/modals/TwoFAModal/components/UsingEmail.tsx b/client/src/core/auth/modals/TwoFAModal/components/UsingEmail.tsx index 55e86370d..ad14ddc54 100644 --- a/client/src/core/auth/modals/TwoFAModal/components/UsingEmail.tsx +++ b/client/src/core/auth/modals/TwoFAModal/components/UsingEmail.tsx @@ -2,7 +2,7 @@ import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from '@lifeforge/ui' -import { useAuth } from '@/providers/AuthProvider' +import { useAuth } from '@lifeforge/api' import { Button, OTPInputBox, Stack, Text, TextInput } from '@lifeforge/ui' import forgeAPI from '@/forgeAPI' diff --git a/client/src/core/auth/modals/TwoFAModal/index.tsx b/client/src/core/auth/modals/TwoFAModal/index.tsx index cf80c726c..ad2110c56 100644 --- a/client/src/core/auth/modals/TwoFAModal/index.tsx +++ b/client/src/core/auth/modals/TwoFAModal/index.tsx @@ -2,7 +2,7 @@ import { useState } from 'react' import { useTranslation } from 'react-i18next' import { toast } from '@lifeforge/ui' -import { useAuth } from '@/providers/AuthProvider' +import { useAuth } from '@lifeforge/api' import { Button, Flex, ModalHeader } from '@lifeforge/ui' import OrAuthWithDivider from '../../components/OrAuthWithDivider' diff --git a/client/src/core/auth/pages/LoginPage.tsx b/client/src/core/auth/pages/LoginPage.tsx index 10e1dc198..a969fa0b1 100644 --- a/client/src/core/auth/pages/LoginPage.tsx +++ b/client/src/core/auth/pages/LoginPage.tsx @@ -1,7 +1,7 @@ import { useEffect } from 'react' import { useSearchParams } from 'react-router' -import { useAuth } from '@/providers/AuthProvider' +import { useAuth } from '@lifeforge/api' import { ModalManager, Stack, WithQueryData } from '@lifeforge/ui' import forgeAPI from '@/forgeAPI' diff --git a/client/src/providers/features/UserPersonalizationProvider.tsx b/client/src/providers/features/UserPersonalizationProvider.tsx index 57004c6a6..f6e21a4d1 100644 --- a/client/src/providers/features/UserPersonalizationProvider.tsx +++ b/client/src/providers/features/UserPersonalizationProvider.tsx @@ -1,7 +1,7 @@ import { createContext, useContext, useEffect } from 'react' import { toast } from '@lifeforge/ui' -import { useAuth } from '@/providers/AuthProvider' +import { useAuth } from '@lifeforge/api' import { type IBackdropFilters, type IDashboardLayout, diff --git a/client/src/providers/index.tsx b/client/src/providers/index.tsx index d118d886d..13c22f4ca 100644 --- a/client/src/providers/index.tsx +++ b/client/src/providers/index.tsx @@ -9,7 +9,7 @@ import { SocketProvider } from '@lifeforge/api' import { FederationProvider } from '@lifeforge/federation' -import AuthProvider from '@/providers/AuthProvider' +import { AuthProvider } from '@lifeforge/api' import { APIOnlineStatusWrapper, BackgroundProvider, diff --git a/client/src/routes/components/Sidebar/SidebarBottomBar.tsx b/client/src/routes/components/Sidebar/SidebarBottomBar.tsx index 70e97a3b8..71ac6bef4 100644 --- a/client/src/routes/components/Sidebar/SidebarBottomBar.tsx +++ b/client/src/routes/components/Sidebar/SidebarBottomBar.tsx @@ -2,7 +2,7 @@ import { useCallback } from 'react' import { useNavigate } from 'react-router' import { toast } from '@lifeforge/ui' -import { useAuth } from '@/providers/AuthProvider' +import { useAuth } from '@lifeforge/api' import { Box, Card, diff --git a/client/src/routes/components/Sidebar/SidebarEventBanner.tsx b/client/src/routes/components/Sidebar/SidebarEventBanner.tsx index 6e8eeafd4..30abec369 100644 --- a/client/src/routes/components/Sidebar/SidebarEventBanner.tsx +++ b/client/src/routes/components/Sidebar/SidebarEventBanner.tsx @@ -2,7 +2,7 @@ import dayjs from 'dayjs' import { useMemo } from 'react' import tinycolor from 'tinycolor2' -import { useAuth } from '@/providers/AuthProvider' +import { useAuth } from '@lifeforge/api' import { COLORS, Flex, diff --git a/client/src/routes/components/Sidebar/SidebarItems.tsx b/client/src/routes/components/Sidebar/SidebarItems.tsx index d6339ad43..543b8cdc6 100644 --- a/client/src/routes/components/Sidebar/SidebarItems.tsx +++ b/client/src/routes/components/Sidebar/SidebarItems.tsx @@ -13,7 +13,7 @@ import { useMainSidebarState } from '@lifeforge/ui' -import { useAuth } from '@/providers/AuthProvider' +import { useAuth } from '@lifeforge/api' import MainSidebarTitle from './MainSidebarTitle' diff --git a/client/src/routes/hooks/useAppRouter.ts b/client/src/routes/hooks/useAppRouter.ts index 012857fe7..3626d6190 100644 --- a/client/src/routes/hooks/useAppRouter.ts +++ b/client/src/routes/hooks/useAppRouter.ts @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next' import { type DataRouter, createBrowserRouter } from 'react-router' import { useFederation } from '@lifeforge/federation' -import { useAuth } from '@/providers/AuthProvider' +import { useAuth } from '@lifeforge/api' import { createAuthLoadingConfig, diff --git a/client/tsconfig.json b/client/tsconfig.json index 78a782ef1..bdfd93888 100644 --- a/client/tsconfig.json +++ b/client/tsconfig.json @@ -27,7 +27,6 @@ "verbatimModuleSyntax": true, "composite": true, "rootDir": "../", - "baseUrl": "./", "paths": { "@/*": [ "./src/*" diff --git a/package.json b/package.json index fb5638e0a..00aae4136 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,8 @@ "lifeforge" ], "devDependencies": { - "@lifeforge/configs": "workspace:*", "@eslint/js": "^9.26.0", + "@lifeforge/configs": "workspace:*", "@originjs/vite-plugin-federation": "^1.4.1", "@trivago/prettier-plugin-sort-imports": "^5.2.2", "@types/lodash": "^4.17.21", @@ -45,6 +45,7 @@ "@types/tinycolor2": "^1.4.6", "@typescript-eslint/eslint-plugin": "^7.18.0", "@typescript-eslint/parser": "^7.18.0", + "@typescript/native-preview": "^7.0.0-dev.20260609.1", "@vitejs/plugin-react": "^4.4.1", "bun-types": "latest", "concurrently": "^9.1.2", diff --git a/packages/api/contract.ts b/packages/api/contract.ts new file mode 100644 index 000000000..528328417 --- /dev/null +++ b/packages/api/contract.ts @@ -0,0 +1,2985 @@ +export const contract = { + "": { + "method": "get", + "description": "Welcome to LifeForge API", + "noAuth": true, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string", + "const": "Get ready to forge your life!" + } + } + }, + "locales": { + "listLanguages": { + "method": "get", + "description": "List all languages", + "noAuth": true, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "alternative": { + "type": "array", + "items": { + "type": "string" + } + }, + "icon": { + "type": "string" + }, + "displayName": { + "type": "string" + } + }, + "required": [ + "name", + "icon", + "displayName" + ], + "additionalProperties": false + } + } + } + }, + "getLocale": { + "method": "get", + "description": "Retrieve localization strings for namespace", + "noAuth": true, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "lang": { + "type": "string" + }, + "namespace": { + "type": "string", + "enum": [ + "apps", + "common" + ] + }, + "subnamespace": { + "type": "string" + } + }, + "required": [ + "lang", + "namespace", + "subnamespace" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "additionalProperties": {} + }, + "NOT_FOUND": true + } + }, + "notifyMissing": { + "method": "post", + "description": "Report missing localization key", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "namespace": { + "type": "string" + }, + "key": { + "type": "string" + } + }, + "required": [ + "namespace", + "key" + ], + "additionalProperties": false + } + }, + "output": { + "NO_CONTENT": true + } + } + }, + "user": { + "exists": { + "method": "get", + "description": "Check if user exists", + "noAuth": true, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "boolean" + } + } + }, + "auth": { + "createFirstUser": { + "method": "post", + "description": "Create the first user (only works when no users exist)", + "noAuth": true, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "email": { + "type": "string", + "format": "email", + "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + }, + "username": { + "type": "string", + "minLength": 3 + }, + "name": { + "type": "string", + "minLength": 1 + }, + "password": { + "type": "string", + "minLength": 8 + } + }, + "required": [ + "email", + "username", + "name", + "password" + ], + "additionalProperties": false + } + }, + "output": { + "CREATED": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "state": { + "type": "string", + "const": "success" + } + }, + "required": [ + "state" + ], + "additionalProperties": false + }, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "generateOTP": { + "method": "get", + "description": "Generate one-time password", + "noAuth": false, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "getUserData": { + "method": "get", + "description": "Get current user data", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "email": { + "type": "string", + "format": "email", + "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + }, + "emailVisibility": { + "type": "boolean" + }, + "verified": { + "type": "boolean" + }, + "username": { + "type": "string" + }, + "name": { + "type": "string" + }, + "avatar": { + "type": "string" + }, + "dateOfBirth": { + "type": "string" + }, + "theme": { + "type": "string", + "enum": [ + "system", + "light", + "dark" + ] + }, + "color": { + "type": "string" + }, + "bgTemp": { + "type": "string" + }, + "bgImage": { + "type": "string" + }, + "backdropFilters": {}, + "fontFamily": { + "type": "string" + }, + "language": { + "type": "string" + }, + "dashboardLayout": {}, + "fontScale": { + "type": "number" + }, + "pinnedFontFamilies": {}, + "borderRadiusMultiplier": { + "type": "number" + }, + "bordered": { + "type": "boolean" + }, + "created": { + "type": "string" + }, + "updated": { + "type": "string" + }, + "id": { + "type": "string" + }, + "collectionId": { + "type": "string" + }, + "collectionName": { + "type": "string" + }, + "hasMasterPassword": { + "type": "boolean" + }, + "hasJournalMasterPassword": { + "type": "boolean" + }, + "hasAPIKeysMasterPassword": { + "type": "boolean" + }, + "twoFAEnabled": { + "type": "boolean" + } + }, + "required": [ + "email", + "emailVisibility", + "verified", + "username", + "name", + "avatar", + "dateOfBirth", + "theme", + "color", + "bgTemp", + "bgImage", + "backdropFilters", + "fontFamily", + "language", + "dashboardLayout", + "fontScale", + "pinnedFontFamilies", + "borderRadiusMultiplier", + "bordered", + "created", + "updated", + "id", + "collectionId", + "collectionName", + "hasMasterPassword", + "hasJournalMasterPassword", + "hasAPIKeysMasterPassword", + "twoFAEnabled" + ], + "additionalProperties": false + }, + "NOT_FOUND": true + } + }, + "login": { + "method": "post", + "description": "Authenticate user with credentials", + "noAuth": true, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "password": { + "type": "string" + } + }, + "required": [ + "email", + "password" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "type": "object", + "properties": { + "state": { + "type": "string", + "const": "2fa_required" + }, + "tid": { + "type": "string" + } + }, + "required": [ + "state", + "tid" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "state": { + "type": "string", + "const": "success" + }, + "session": { + "type": "string" + } + }, + "required": [ + "state", + "session" + ], + "additionalProperties": false + } + ] + }, + "UNAUTHORIZED": true + } + }, + "validateOTP": { + "method": "post", + "description": "Verify one-time password", + "noAuth": false, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "otp": { + "type": "string" + }, + "otpId": { + "type": "string" + } + }, + "required": [ + "otp", + "otpId" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "boolean" + } + } + }, + "verifySessionToken": { + "method": "post", + "description": "Validate user session token", + "noAuth": false, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "boolean" + }, + "UNAUTHORIZED": true + } + } + }, + "oauth": { + "getEndpoint": { + "method": "get", + "description": "Get OAuth authorization URL for provider", + "noAuth": true, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "provider": { + "type": "string" + } + }, + "required": [ + "provider" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "state": { + "type": "string" + }, + "codeVerifier": { + "type": "string" + }, + "codeChallenge": { + "type": "string" + }, + "codeChallengeMethod": { + "type": "string" + }, + "authURL": { + "type": "string" + }, + "displayName": { + "type": "string" + } + }, + "required": [ + "name", + "state", + "codeVerifier", + "codeChallenge", + "codeChallengeMethod", + "authURL", + "displayName" + ], + "additionalProperties": false + }, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "listProviders": { + "method": "get", + "description": "Retrieve available OAuth providers", + "noAuth": true, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "verify": { + "method": "post", + "description": "Verify OAuth authorization callback", + "noAuth": true, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "provider": { + "type": "string" + }, + "code": { + "type": "string" + } + }, + "required": [ + "provider", + "code" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "type": "object", + "properties": { + "state": { + "type": "string", + "const": "2fa_required" + }, + "tid": { + "type": "string" + } + }, + "required": [ + "state", + "tid" + ], + "additionalProperties": false + }, + { + "type": "string" + } + ] + }, + "UNAUTHORIZED": true, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + } + }, + "2fa": { + "disable": { + "method": "post", + "description": "Disable two-factor authentication", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "NO_CONTENT": true + } + }, + "generateAuthenticatorLink": { + "method": "get", + "description": "Generate authenticator app setup link", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "getChallenge": { + "method": "get", + "description": "Retrieve 2FA challenge token", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "requestOTP": { + "method": "get", + "description": "Request OTP for two-factor authentication", + "noAuth": true, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "email": { + "type": "string", + "format": "email", + "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + } + }, + "required": [ + "email" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + }, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "verify": { + "method": "post", + "description": "Verify two-factor authentication code", + "noAuth": true, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "otp": { + "type": "string" + }, + "tid": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "email", + "app" + ] + } + }, + "required": [ + "otp", + "tid", + "type" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "session": { + "type": "string" + } + }, + "required": [ + "session" + ], + "additionalProperties": false + }, + "UNAUTHORIZED": true + } + }, + "verifyAndEnable": { + "method": "post", + "description": "Verify and activate two-factor authentication", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "otp": { + "type": "string" + } + }, + "required": [ + "otp" + ], + "additionalProperties": false + } + }, + "output": { + "NO_CONTENT": true, + "UNAUTHORIZED": true + } + } + }, + "qrLogin": { + "approveQRLogin": { + "method": "post", + "description": "Approve a QR login request", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "sessionId": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "required": [ + "sessionId" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "browserInfo": { + "type": "string" + } + }, + "required": [ + "success", + "browserInfo" + ], + "additionalProperties": false + }, + "NOT_FOUND": true, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "checkQRSessionStatus": { + "method": "get", + "description": "Check QR login session status", + "noAuth": true, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "sessionId": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "required": [ + "sessionId" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "type": "object", + "properties": { + "status": { + "type": "string", + "const": "not_found" + } + }, + "required": [ + "status" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "status": { + "type": "string", + "const": "expired" + } + }, + "required": [ + "status" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "status": { + "type": "string", + "const": "approved" + }, + "session": { + "type": "string" + } + }, + "required": [ + "status", + "session" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "status": { + "type": "string", + "const": "pending" + }, + "expiresAt": { + "type": "string" + } + }, + "required": [ + "status", + "expiresAt" + ], + "additionalProperties": false + } + ] + } + } + }, + "registerQRSession": { + "method": "post", + "description": "Register a new QR login session", + "noAuth": true, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "sessionId": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "browserInfo": { + "type": "string" + } + }, + "required": [ + "sessionId", + "browserInfo" + ], + "additionalProperties": false + } + }, + "output": { + "CREATED": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "sessionId": { + "type": "string" + }, + "expiresAt": { + "type": "string" + } + }, + "required": [ + "sessionId", + "expiresAt" + ], + "additionalProperties": false + }, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + } + }, + "settings": { + "deleteAvatar": { + "method": "post", + "description": "Remove user avatar", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "NO_CONTENT": true + } + }, + "requestPasswordReset": { + "method": "post", + "description": "Request password reset email", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "NO_CONTENT": true + } + }, + "updateAvatar": { + "method": "post", + "description": "Upload new user avatar", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": { + "file": { + "optional": false + } + }, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "updateProfile": { + "method": "post", + "description": "Update user profile information", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "username": { + "type": "string", + "pattern": "^[a-zA-Z0-9]+$" + }, + "email": { + "type": "string", + "format": "email", + "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + }, + "name": { + "type": "string" + }, + "dateOfBirth": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "required": [ + "data" + ], + "additionalProperties": false + } + }, + "output": { + "NO_CONTENT": true + } + } + }, + "personalization": { + "deleteBgImage": { + "method": "post", + "description": "Remove background image", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "NO_CONTENT": true + } + }, + "getGoogleFont": { + "method": "get", + "description": "Get details of a specific Google Font", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "family": { + "type": "string" + } + }, + "required": [ + "family" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "items": {} + }, + "required": [ + "enabled" + ], + "additionalProperties": false + } + } + }, + "listGoogleFonts": { + "method": "get", + "description": "Retrieve available Google Fonts", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "family": { + "type": "string" + }, + "variants": { + "type": "array", + "items": { + "type": "string" + } + }, + "subsets": { + "type": "array", + "items": { + "type": "string" + } + }, + "version": { + "type": "string" + }, + "lastModified": { + "type": "string" + }, + "files": { + "type": "object", + "properties": { + "100": { + "type": "string" + }, + "200": { + "type": "string" + }, + "300": { + "type": "string" + }, + "500": { + "type": "string" + }, + "600": { + "type": "string" + }, + "700": { + "type": "string" + }, + "800": { + "type": "string" + }, + "900": { + "type": "string" + }, + "regular": { + "type": "string" + }, + "italic": { + "type": "string" + }, + "100italic": { + "type": "string" + }, + "200italic": { + "type": "string" + }, + "300italic": { + "type": "string" + }, + "500italic": { + "type": "string" + }, + "600italic": { + "type": "string" + }, + "700italic": { + "type": "string" + }, + "800italic": { + "type": "string" + }, + "900italic": { + "type": "string" + } + }, + "additionalProperties": false + }, + "category": { + "type": "string", + "enum": [ + "display", + "handwriting", + "monospace", + "sans-serif", + "serif" + ] + }, + "kind": { + "type": "string", + "const": "webfonts#webfont" + }, + "menu": { + "type": "string" + }, + "colorCapabilities": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "COLRv0", + "COLRv1", + "SVG" + ] + } + } + }, + "required": [ + "family", + "variants", + "subsets", + "version", + "lastModified", + "files", + "category", + "kind", + "menu" + ], + "additionalProperties": false + } + } + }, + "required": [ + "enabled", + "items" + ], + "additionalProperties": false + } + } + }, + "listGoogleFontsPin": { + "method": "get", + "description": "Retrieve pinned Google Fonts", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "string" + } + }, + "UNAUTHORIZED": true + } + }, + "toggleGoogleFontsPin": { + "method": "post", + "description": "Pin or unpin a Google Font", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "family": { + "type": "string" + } + }, + "required": [ + "family" + ], + "additionalProperties": false + } + }, + "output": { + "NO_CONTENT": true, + "UNAUTHORIZED": true + } + }, + "updateBgImage": { + "method": "post", + "description": "Upload new background image", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": { + "file": { + "optional": false + } + }, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "collectionId": { + "type": "string" + }, + "recordId": { + "type": "string" + }, + "fieldId": { + "type": "string" + } + }, + "required": [ + "collectionId", + "recordId", + "fieldId" + ], + "additionalProperties": false + } + } + }, + "updatePersonalization": { + "method": "post", + "description": "Update user personalization preferences", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "fontFamily": { + "type": "string" + }, + "theme": { + "type": "string" + }, + "color": { + "type": "string" + }, + "bgTemp": { + "type": "string" + }, + "language": { + "type": "string" + }, + "fontScale": { + "type": "number" + }, + "borderRadiusMultiplier": { + "type": "number" + }, + "bordered": { + "type": "boolean" + }, + "dashboardLayout": { + "type": "object", + "additionalProperties": {} + }, + "backdropFilters": { + "type": "object", + "additionalProperties": {} + } + }, + "additionalProperties": false + } + }, + "required": [ + "data" + ], + "additionalProperties": false + } + }, + "output": { + "NO_CONTENT": true, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + } + }, + "customFonts": { + "get": { + "method": "get", + "description": "Get a specific custom font by ID", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": [ + "id" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "family": { + "type": "string" + }, + "weight": { + "type": "number" + }, + "file": { + "type": "string" + }, + "collectionId": { + "type": "string" + } + }, + "required": [ + "id", + "displayName", + "family", + "weight", + "file", + "collectionId" + ], + "additionalProperties": false + }, + "NOT_FOUND": true + } + }, + "list": { + "method": "get", + "description": "List all custom uploaded fonts", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "family": { + "type": "string" + }, + "weight": { + "type": "number" + }, + "file": { + "type": "string" + }, + "collectionId": { + "type": "string" + } + }, + "required": [ + "id", + "displayName", + "family", + "weight", + "file", + "collectionId" + ], + "additionalProperties": false + } + } + } + }, + "remove": { + "method": "post", + "description": "Delete a custom font", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": [ + "id" + ], + "additionalProperties": false + } + }, + "output": { + "NO_CONTENT": true, + "NOT_FOUND": true + } + }, + "upload": { + "method": "post", + "description": "Upload a new custom font", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": { + "file": { + "optional": false + } + }, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "additionalProperties": false + }, + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "displayName": { + "type": "string", + "minLength": 1 + }, + "family": { + "type": "string", + "minLength": 1 + }, + "weight": { + "default": 400, + "type": "number", + "minimum": 100, + "maximum": 900 + } + }, + "required": [ + "displayName", + "family", + "weight" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "family": { + "type": "string" + }, + "weight": { + "type": "number" + }, + "file": { + "type": "string" + }, + "collectionId": { + "type": "string" + } + }, + "required": [ + "id", + "displayName", + "family", + "weight", + "file", + "collectionId" + ], + "additionalProperties": false + }, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + }, + "NOT_FOUND": true + } + } + } + }, + "apiKeys": { + "entries": { + "get": { + "method": "get", + "description": "Retrieve API key by key ID. Only exposable keys can be retrieved.", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "keyId": { + "type": "string" + } + }, + "required": [ + "keyId" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "FORBIDDEN": true + } + }, + "list": { + "method": "get", + "description": "Retrieve all API key entries", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "keyId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "key": { + "type": "string" + }, + "exposable": { + "type": "boolean" + }, + "created": { + "type": "string" + }, + "updated": { + "type": "string" + }, + "id": { + "type": "string" + }, + "collectionId": { + "type": "string" + }, + "collectionName": { + "type": "string" + } + }, + "required": [ + "keyId", + "name", + "icon", + "key", + "exposable", + "created", + "updated", + "id", + "collectionId", + "collectionName" + ], + "additionalProperties": false + } + } + } + }, + "checkKeys": { + "method": "get", + "description": "Verify if API keys exist", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "keys": { + "type": "string" + } + }, + "required": [ + "keys" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "boolean" + } + } + }, + "create": { + "method": "post", + "description": "Create a new API key entry", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "keyId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "key": { + "type": "string" + }, + "exposable": { + "type": "boolean" + } + }, + "required": [ + "keyId", + "name", + "icon", + "key", + "exposable" + ], + "additionalProperties": false + } + }, + "output": { + "CREATED": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "keyId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "key": { + "type": "string" + }, + "exposable": { + "type": "boolean" + }, + "created": { + "type": "string" + }, + "updated": { + "type": "string" + }, + "id": { + "type": "string" + }, + "collectionId": { + "type": "string" + }, + "collectionName": { + "type": "string" + } + }, + "required": [ + "keyId", + "name", + "icon", + "key", + "exposable", + "created", + "updated", + "id", + "collectionId", + "collectionName" + ], + "additionalProperties": false + } + } + }, + "update": { + "method": "post", + "description": "Update an existing API key entry", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": [ + "id" + ], + "additionalProperties": false + }, + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "keyId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "key": { + "type": "string" + }, + "exposable": { + "type": "boolean" + }, + "overrideKey": { + "type": "boolean" + } + }, + "required": [ + "keyId", + "name", + "icon", + "key", + "exposable", + "overrideKey" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "keyId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "key": { + "type": "string" + }, + "exposable": { + "type": "boolean" + }, + "created": { + "type": "string" + }, + "updated": { + "type": "string" + }, + "id": { + "type": "string" + }, + "collectionId": { + "type": "string" + }, + "collectionName": { + "type": "string" + } + }, + "required": [ + "keyId", + "name", + "icon", + "key", + "exposable", + "created", + "updated", + "id", + "collectionId", + "collectionName" + ], + "additionalProperties": false + }, + "NOT_FOUND": true + } + }, + "remove": { + "method": "post", + "description": "Delete an API key entry", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": [ + "id" + ], + "additionalProperties": false + } + }, + "output": { + "NO_CONTENT": true, + "NOT_FOUND": true + } + } + } + }, + "pixabay": { + "searchImages": { + "method": "get", + "description": "Search for images on Pixabay", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "q": { + "type": "string", + "minLength": 1 + }, + "page": { + "default": "1", + "type": "string" + }, + "type": { + "default": "all", + "type": "string", + "enum": [ + "all", + "photo", + "illustration", + "vector" + ] + }, + "category": { + "type": "string", + "enum": [ + "backgrounds", + "fashion", + "nature", + "science", + "education", + "feelings", + "health", + "people", + "religion", + "places", + "animals", + "industry", + "computer", + "food", + "sports", + "transportation", + "travel", + "buildings", + "business", + "music" + ] + }, + "colors": { + "anyOf": [ + { + "type": "string", + "enum": [ + "grayscale", + "transparent", + "red", + "orange", + "yellow", + "green", + "turquoise", + "blue", + "lilac", + "pink", + "white", + "gray", + "black", + "brown" + ] + }, + { + "type": "null" + } + ] + }, + "editors_choice": { + "default": "false", + "type": "string", + "enum": [ + "true", + "false" + ] + } + }, + "required": [ + "q", + "page", + "type", + "editors_choice" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "total": { + "type": "number" + }, + "hits": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "thumbnail": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "width": { + "type": "number" + }, + "height": { + "type": "number" + } + }, + "required": [ + "url", + "width", + "height" + ], + "additionalProperties": false + }, + "imageURL": { + "type": "string" + } + }, + "required": [ + "id", + "thumbnail", + "imageURL" + ], + "additionalProperties": false + } + } + }, + "required": [ + "total", + "hits" + ], + "additionalProperties": false + }, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + } + }, + "locations": { + "search": { + "method": "get", + "description": "Search for locations using Google Places API", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "q": { + "type": "string" + } + }, + "required": [ + "q" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "formattedAddress": { + "type": "string" + }, + "location": { + "type": "object", + "properties": { + "latitude": { + "type": "number" + }, + "longitude": { + "type": "number" + } + }, + "required": [ + "latitude", + "longitude" + ], + "additionalProperties": false + } + }, + "required": [ + "name", + "formattedAddress", + "location" + ], + "additionalProperties": false + } + }, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + } + }, + "backups": { + "list": { + "method": "get", + "description": "Retrieve all database backups", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "size": { + "type": "number" + }, + "modified": { + "type": "string" + } + }, + "required": [ + "key", + "size", + "modified" + ], + "additionalProperties": false + } + } + } + }, + "download": { + "method": "get", + "description": "Download a database backup file", + "noAuth": false, + "encrypted": true, + "isDownloadable": true, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "key": { + "type": "string" + } + }, + "required": [ + "key" + ], + "additionalProperties": false + } + }, + "output": { + "NO_CONTENT": true, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "create": { + "method": "post", + "description": "Create a new database backup", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "backupName": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "output": { + "CREATED": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "null" + } + } + }, + "remove": { + "method": "post", + "description": "Delete a database backup", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "key": { + "type": "string" + } + }, + "required": [ + "key" + ], + "additionalProperties": false + } + }, + "output": { + "NO_CONTENT": true + } + } + }, + "database": { + "collections": { + "list": { + "method": "get", + "description": "Retrieve all database collections", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "base", + "view" + ] + }, + "fields": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "optional": { + "type": "boolean" + }, + "options": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "name", + "type", + "optional" + ], + "additionalProperties": false + } + } + }, + "required": [ + "name", + "type", + "fields" + ], + "additionalProperties": false + } + } + } + } + } + }, + "modules": { + "checkModuleAvailability": { + "method": "get", + "description": "Check if a module is available (installed)", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "moduleId": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "moduleId" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "boolean" + } + } + }, + "list": { + "method": "get", + "description": "List installed modules with metadata", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "moduleId": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "version": { + "type": "string" + }, + "description": { + "type": "string" + }, + "author": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "category": { + "type": "string" + }, + "isInternal": { + "type": "boolean" + }, + "isDevMode": { + "type": "boolean" + }, + "hasDist": { + "type": "boolean" + }, + "hasSource": { + "type": "boolean" + } + }, + "required": [ + "name", + "moduleId", + "displayName", + "version", + "description", + "author", + "icon", + "category", + "isInternal", + "isDevMode", + "hasDist", + "hasSource" + ], + "additionalProperties": false + } + } + } + }, + "manifest": { + "method": "get", + "description": "Get installed modules manifest for runtime loading", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "modules": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "moduleId": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "version": { + "type": "string" + }, + "description": { + "type": "string" + }, + "author": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "category": { + "type": "string" + }, + "remoteEntryUrl": { + "type": "string" + }, + "isInternal": { + "type": "boolean" + }, + "isDevMode": { + "type": "boolean" + }, + "APIKeyAccess": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "usage": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "usage", + "required" + ], + "additionalProperties": false + } + } + }, + "required": [ + "name", + "moduleId", + "displayName", + "version", + "description", + "author", + "icon", + "category", + "remoteEntryUrl", + "isInternal" + ], + "additionalProperties": false + } + } + }, + "required": [ + "modules" + ], + "additionalProperties": false + } + } + }, + "uninstall": { + "method": "post", + "description": "Uninstall a module", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "moduleName": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "moduleName" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "error": { + "type": "string" + } + }, + "required": [ + "success" + ], + "additionalProperties": false + } + } + }, + "categories": { + "aiTranslate": { + "method": "post", + "description": "Translate a specific category into desired languages", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "languages": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "key", + "languages" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + { + "type": "null" + } + ] + } + } + }, + "list": { + "method": "get", + "description": "Get the category display order", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + }, + "update": { + "method": "post", + "description": "Update the category display order", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "data": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "required": [ + "data" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "success": { + "type": "boolean" + } + }, + "required": [ + "success" + ], + "additionalProperties": false + } + } + } + }, + "devMode": { + "toggle": { + "method": "post", + "description": "Toggle dev mode for a module", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "moduleName": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "moduleName" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "boolean" + } + } + } + } + }, + "ai": { + "imageGeneration": { + "generateImage": { + "method": "post", + "description": "Generate image from text prompt using AI", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "prompt": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "prompt" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + }, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + } + } + }, + "ping": { + "method": "post", + "description": "Ping the server", + "noAuth": true, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "timestamp": { + "type": "number", + "minimum": 0 + } + }, + "required": [ + "timestamp" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "status": { + "method": "get", + "description": "Get server status", + "noAuth": true, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "environment": { + "type": "string" + } + }, + "required": [ + "environment" + ], + "additionalProperties": false + } + } + }, + "media": { + "method": "get", + "description": "Retrieve media file from PocketBase", + "noAuth": true, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "collectionId": { + "type": "string" + }, + "recordId": { + "type": "string" + }, + "fieldId": { + "type": "string" + }, + "thumb": { + "type": "string" + }, + "token": { + "type": "string" + } + }, + "required": [ + "collectionId", + "recordId", + "fieldId" + ], + "additionalProperties": false + } + }, + "output": "custom" + }, + "corsAnywhere": { + "method": "get", + "description": "CORS Anywhere - Fetch external URL content", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "url": { + "type": "string", + "format": "uri" + } + }, + "required": [ + "url" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema" + }, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "encryptionPublicKey": { + "method": "get", + "description": "Get server public key for end-to-end encryption", + "noAuth": true, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + } +} as const + +export default contract diff --git a/packages/api/package.json b/packages/api/package.json index 9429b471d..dddc41333 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -3,12 +3,13 @@ "version": "0.0.1", "type": "module", "main": "dist/index.js", + "module": "dist/index.mjs", "types": "dist/index.d.ts", "typings": "dist/index.d.ts", "scripts": { - "dev": "tsc --watch", - "types": "tsc -b --noEmit", - "build": "tsc" + "dev": "vite build --watch", + "types": "tsgo -b --noEmit", + "build": "rm -rf dist && bun types && vite build" }, "dependencies": { "axios": "^1.12.2", @@ -18,8 +19,8 @@ }, "devDependencies": { "@types/crypto-js": "^4.2.2", - "@types/react": "^19.2.0", - "typescript": "^5.9.3" + "@vitejs/plugin-react": "^4.7.0", + "vite-plugin-dts": "^4.5.4" }, "peerDependencies": { "@tanstack/react-query": "^5.90.2", diff --git a/packages/api/src/index.ts b/packages/api/src/index.ts index d3153fe41..e2a72c9dc 100644 --- a/packages/api/src/index.ts +++ b/packages/api/src/index.ts @@ -14,6 +14,8 @@ export * from './providers/EncryptionProvider' export * from './providers/SocketProvider' +export * from './providers/AuthProvider' + export * from './utils/encryption' export * from './utils/fetchAPI' diff --git a/client/src/providers/AuthProvider.tsx b/packages/api/src/providers/AuthProvider.tsx similarity index 91% rename from client/src/providers/AuthProvider.tsx rename to packages/api/src/providers/AuthProvider.tsx index 33a6a3b6f..d9e022f3f 100644 --- a/client/src/providers/AuthProvider.tsx +++ b/packages/api/src/providers/AuthProvider.tsx @@ -8,13 +8,14 @@ import { useRef, useState } from 'react' -import { useTranslation } from 'react-i18next' -import { toast } from '@lifeforge/ui' -import type { InferOutput } from '@lifeforge/api' -import type forgeAPIInstance from '@/forgeAPI' +import { contract } from '../../contract' +import { createForgeProxy } from '../core/createForgeProxy' +import type { InferOutput, ProxyTree } from '../typescript/forge_proxy.types' -export type UserData = InferOutput +const _forgeAPI = createForgeProxy(contract) + +export type UserData = InferOutput interface AuthData { auth: boolean @@ -54,17 +55,15 @@ interface Verify2FAResponse { export const AuthContext = createContext(undefined) -export default function AuthProvider({ +export function AuthProvider({ forgeAPI, onTwoFAModalOpen, children }: { - forgeAPI: typeof forgeAPIInstance + forgeAPI: ProxyTree onTwoFAModalOpen: () => void children: React.ReactNode }) { - const { t } = useTranslation('common.auth') - const [auth, _setAuth] = useState(false) const [userData, setUserData] = useState(null) @@ -84,8 +83,8 @@ export default function AuthProvider({ async ( session: string ): Promise<{ - success: boolean; - userData: UserData | null; + success: boolean + userData: UserData | null }> => { try { const verifyRes = await fetch( @@ -119,8 +118,8 @@ export default function AuthProvider({ email, password }: { - email: string; - password: string; + email: string + password: string }): Promise => { try { const data = await forgeAPI.user.auth.login.mutate({ @@ -163,8 +162,8 @@ export default function AuthProvider({ otp, type }: { - otp: string; - type: 'email' | 'app'; + otp: string + type: 'email' | 'app' }): Promise => { try { const res = await fetch(forgeAPI.user['2fa'].verify.endpoint, { @@ -237,8 +236,6 @@ export default function AuthProvider({ localStorage.setItem('session', session) - toast.success(t('auth.welcome') + userData.username) - return true } else { throw new Error('Invalid session') @@ -247,7 +244,6 @@ export default function AuthProvider({ setAuth(false) setUserData(null) setAuthLoading(false) - toast.error(t('messages.invalidLoginAttempt')) return false } finally { diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json index 5ba901adf..ccda529d3 100644 --- a/packages/api/tsconfig.json +++ b/packages/api/tsconfig.json @@ -1,11 +1,13 @@ { "extends": "@lifeforge/configs/tsconfig/base.json", "compilerOptions": { - "lib": ["ESNext", "DOM"], + "lib": [ + "ESNext", + "DOM" + ], "target": "ESNext", "module": "ESNext", "declaration": true, - "rootDir": "./src", "outDir": "./dist", "noEmit": false, "strict": true, @@ -13,6 +15,12 @@ "noFallthroughCasesInSwitch": true, "noUncheckedIndexedAccess": true }, - "include": ["./src/**/*"], - "exclude": ["dist", "node_modules"] -} + "include": [ + "./src/**/*", + "./contract.ts" + ], + "exclude": [ + "dist", + "node_modules" + ] +} \ No newline at end of file diff --git a/packages/api/vite.config.ts b/packages/api/vite.config.ts new file mode 100644 index 000000000..b6a7e7d58 --- /dev/null +++ b/packages/api/vite.config.ts @@ -0,0 +1,46 @@ +import react from '@vitejs/plugin-react' +import { resolve } from 'path' +import { defineConfig } from 'vite' +import dts from 'vite-plugin-dts' + +export default defineConfig({ + plugins: [ + react(), + dts({ + rollupTypes: true + }) + ], + resolve: { + alias: { + '@': resolve(__dirname, 'src') + } + }, + build: { + lib: { + entry: resolve(__dirname, 'src/index.ts'), + formats: ['es', 'cjs'], + fileName: format => `index.${format === 'es' ? 'mjs' : 'js'}` + }, + rollupOptions: { + external: [ + 'react', + 'react-dom', + 'react/jsx-runtime', + '@tanstack/react-query', + 'zod', + 'axios', + 'crypto-js', + 'json-schema-to-ts', + 'socket.io-client' + ], + output: { + globals: { + react: 'React', + 'react-dom': 'ReactDOM' + } + } + }, + sourcemap: false, + minify: true + } +}) diff --git a/packages/configs/package.json b/packages/configs/package.json index b9e7eac1c..bb00ef16d 100644 --- a/packages/configs/package.json +++ b/packages/configs/package.json @@ -21,19 +21,16 @@ "./package.json": "./package.json" }, "scripts": { - "build": "vite build && tsc --emitDeclarationOnly" - }, - "dependencies": { - "zod": "4.3.5" + "build": "vite build && tsgo --emitDeclarationOnly" }, "peerDependencies": { "@originjs/vite-plugin-federation": "^1.4.1", "@vitejs/plugin-react": "^4.4.1", "react": "^19.2.0", - "vite": "^7.1.9" + "vite": "^7.1.9", + "zod": "4.3.5" }, "devDependencies": { - "@types/react": "^19.2.0", - "typescript": "^5.9.3" + "@types/react": "^19.2.0" } } diff --git a/packages/configs/src/interfaces/module_config.types.ts b/packages/configs/src/interfaces/module_config.types.ts index 052160893..bfc72d832 100644 --- a/packages/configs/src/interfaces/module_config.types.ts +++ b/packages/configs/src/interfaces/module_config.types.ts @@ -1,9 +1,12 @@ import { z } from 'zod' import type { WidgetConfig } from './widget_config.types' +import type React from 'react'; export interface ModuleConfig { - provider?: React.LazyExoticComponent + provider?: React.LazyExoticComponent< + React.ComponentType<{ children: React.ReactNode }> + > routes: Record> subsection?: { label: string diff --git a/packages/federation/package.json b/packages/federation/package.json index f9a21dc42..28406ceb7 100644 --- a/packages/federation/package.json +++ b/packages/federation/package.json @@ -10,14 +10,12 @@ "build": "tsc" }, "dependencies": { - "@lifeforge/api": "workspace:*", - "zod": "4.3.5" + "@lifeforge/api": "workspace:*" }, "peerDependencies": { "react": "^19.2.0" }, "devDependencies": { - "@types/react": "^19.2.0", - "typescript": "^5.9.3" + "@types/react": "^19.2.0" } } diff --git a/packages/federation/src/loaders/loadModuleConfig.ts b/packages/federation/src/loaders/loadModuleConfig.ts index 1da84f1aa..fd3f133be 100644 --- a/packages/federation/src/loaders/loadModuleConfig.ts +++ b/packages/federation/src/loaders/loadModuleConfig.ts @@ -1,5 +1,4 @@ import { globalProxyRegistry } from '@lifeforge/api' - import { type ModuleCategory, type ModuleConfig, diff --git a/packages/log/package.json b/packages/log/package.json index 29062cebd..d8c7347cb 100644 --- a/packages/log/package.json +++ b/packages/log/package.json @@ -16,7 +16,7 @@ } }, "scripts": { - "build": "bun build ./src/index.ts ./src/loggers/cliLogger.ts --outdir=dist --target=node && bun tsc --project tsconfig.json", + "build": "bun build ./src/index.ts ./src/loggers/cliLogger.ts --outdir=dist --target=node && bun tsgo --project tsconfig.json", "test": "vitest run", "test:watch": "vitest" }, @@ -28,7 +28,6 @@ }, "devDependencies": { "@types/node": "^25.0.6", - "typescript": "^5.9.0", "vitest": "^4.0.0" } } diff --git a/packages/log/tsconfig.json b/packages/log/tsconfig.json index 4f0ed0b9d..a5b0da39a 100644 --- a/packages/log/tsconfig.json +++ b/packages/log/tsconfig.json @@ -11,11 +11,18 @@ "esModuleInterop": true, "outDir": "./dist", "rootDir": "./src", - "baseUrl": ".", "paths": { - "@/*": ["./src/*"] + "@/*": [ + "./src/*" + ] } }, - "include": ["src/**/*"], - "exclude": ["node_modules", "dist", "**/*.test.ts"] -} + "include": [ + "src/**/*" + ], + "exclude": [ + "node_modules", + "dist", + "**/*.test.ts" + ] +} \ No newline at end of file diff --git a/packages/server-utils/package.json b/packages/server-utils/package.json index beb8464eb..81c4ceef8 100644 --- a/packages/server-utils/package.json +++ b/packages/server-utils/package.json @@ -14,8 +14,8 @@ } }, "scripts": { - "build": "rm -rf dist && bun build ./src/index.ts --outdir=dist --target=node && bun tsc --emitDeclarationOnly", - "types": "bun tsc --emitDeclarationOnly" + "build": "rm -rf dist && bun build ./src/index.ts --outdir=dist --target=node && bun tsgo --emitDeclarationOnly", + "types": "bun tsgo --emitDeclarationOnly" }, "dependencies": { "chalk": "^5.6.2", @@ -31,7 +31,6 @@ "socket.io": "^4.8.3", "tesseract.js": "^5.1.1", "uuid": "^11.1.0", - "zod": "4.3.5", "@lifeforge/log": "workspace:*" }, "devDependencies": { @@ -40,7 +39,6 @@ "@types/express-serve-static-core": "4", "@types/lodash": "^4.17.21", "@types/multer": "^1.4.13", - "typescript": "^5.8.3", "vitest": "^4.1.7" }, "peerDependencies": { diff --git a/packages/server-utils/src/typescript/core/core_context.types.ts b/packages/server-utils/src/typescript/core/core_context.types.ts index ec448992e..ab8ebe105 100644 --- a/packages/server-utils/src/typescript/core/core_context.types.ts +++ b/packages/server-utils/src/typescript/core/core_context.types.ts @@ -1,10 +1,10 @@ import type OpenAI from 'openai' import { Server } from 'socket.io' -import { CleanedSchemas } from 'utils/schemaUtils' import z from 'zod' import type { Logger } from '@lifeforge/log' +import { CleanedSchemas } from '../../utils/schemaUtils' import IPBService from '../pb/PBService.interface' import { CollectionKey } from '../pb/pb_service.types' import { ITempFileManagerConstructor } from './tempfile_manager.types' diff --git a/packages/server-utils/tsconfig.json b/packages/server-utils/tsconfig.json index b9c104cdc..beca8b32f 100644 --- a/packages/server-utils/tsconfig.json +++ b/packages/server-utils/tsconfig.json @@ -3,7 +3,9 @@ "target": "ESNext", "module": "ESNext", "moduleResolution": "bundler", - "lib": ["ESNext"], + "lib": [ + "ESNext" + ], "strict": true, "esModuleInterop": true, "skipLibCheck": true, @@ -15,8 +17,15 @@ "isolatedModules": true, "noEmit": false, "emitDeclarationOnly": true, - "baseUrl": "./src" + "types": [ + "Multer" + ] }, - "include": ["src/**/*"], - "exclude": ["node_modules", "dist"] -} + "include": [ + "src/**/*" + ], + "exclude": [ + "node_modules", + "dist" + ] +} \ No newline at end of file diff --git a/packages/ui/contract.ts b/packages/ui/contract.ts new file mode 100644 index 000000000..528328417 --- /dev/null +++ b/packages/ui/contract.ts @@ -0,0 +1,2985 @@ +export const contract = { + "": { + "method": "get", + "description": "Welcome to LifeForge API", + "noAuth": true, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string", + "const": "Get ready to forge your life!" + } + } + }, + "locales": { + "listLanguages": { + "method": "get", + "description": "List all languages", + "noAuth": true, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "alternative": { + "type": "array", + "items": { + "type": "string" + } + }, + "icon": { + "type": "string" + }, + "displayName": { + "type": "string" + } + }, + "required": [ + "name", + "icon", + "displayName" + ], + "additionalProperties": false + } + } + } + }, + "getLocale": { + "method": "get", + "description": "Retrieve localization strings for namespace", + "noAuth": true, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "lang": { + "type": "string" + }, + "namespace": { + "type": "string", + "enum": [ + "apps", + "common" + ] + }, + "subnamespace": { + "type": "string" + } + }, + "required": [ + "lang", + "namespace", + "subnamespace" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "additionalProperties": {} + }, + "NOT_FOUND": true + } + }, + "notifyMissing": { + "method": "post", + "description": "Report missing localization key", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "namespace": { + "type": "string" + }, + "key": { + "type": "string" + } + }, + "required": [ + "namespace", + "key" + ], + "additionalProperties": false + } + }, + "output": { + "NO_CONTENT": true + } + } + }, + "user": { + "exists": { + "method": "get", + "description": "Check if user exists", + "noAuth": true, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "boolean" + } + } + }, + "auth": { + "createFirstUser": { + "method": "post", + "description": "Create the first user (only works when no users exist)", + "noAuth": true, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "email": { + "type": "string", + "format": "email", + "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + }, + "username": { + "type": "string", + "minLength": 3 + }, + "name": { + "type": "string", + "minLength": 1 + }, + "password": { + "type": "string", + "minLength": 8 + } + }, + "required": [ + "email", + "username", + "name", + "password" + ], + "additionalProperties": false + } + }, + "output": { + "CREATED": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "state": { + "type": "string", + "const": "success" + } + }, + "required": [ + "state" + ], + "additionalProperties": false + }, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "generateOTP": { + "method": "get", + "description": "Generate one-time password", + "noAuth": false, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "getUserData": { + "method": "get", + "description": "Get current user data", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "email": { + "type": "string", + "format": "email", + "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + }, + "emailVisibility": { + "type": "boolean" + }, + "verified": { + "type": "boolean" + }, + "username": { + "type": "string" + }, + "name": { + "type": "string" + }, + "avatar": { + "type": "string" + }, + "dateOfBirth": { + "type": "string" + }, + "theme": { + "type": "string", + "enum": [ + "system", + "light", + "dark" + ] + }, + "color": { + "type": "string" + }, + "bgTemp": { + "type": "string" + }, + "bgImage": { + "type": "string" + }, + "backdropFilters": {}, + "fontFamily": { + "type": "string" + }, + "language": { + "type": "string" + }, + "dashboardLayout": {}, + "fontScale": { + "type": "number" + }, + "pinnedFontFamilies": {}, + "borderRadiusMultiplier": { + "type": "number" + }, + "bordered": { + "type": "boolean" + }, + "created": { + "type": "string" + }, + "updated": { + "type": "string" + }, + "id": { + "type": "string" + }, + "collectionId": { + "type": "string" + }, + "collectionName": { + "type": "string" + }, + "hasMasterPassword": { + "type": "boolean" + }, + "hasJournalMasterPassword": { + "type": "boolean" + }, + "hasAPIKeysMasterPassword": { + "type": "boolean" + }, + "twoFAEnabled": { + "type": "boolean" + } + }, + "required": [ + "email", + "emailVisibility", + "verified", + "username", + "name", + "avatar", + "dateOfBirth", + "theme", + "color", + "bgTemp", + "bgImage", + "backdropFilters", + "fontFamily", + "language", + "dashboardLayout", + "fontScale", + "pinnedFontFamilies", + "borderRadiusMultiplier", + "bordered", + "created", + "updated", + "id", + "collectionId", + "collectionName", + "hasMasterPassword", + "hasJournalMasterPassword", + "hasAPIKeysMasterPassword", + "twoFAEnabled" + ], + "additionalProperties": false + }, + "NOT_FOUND": true + } + }, + "login": { + "method": "post", + "description": "Authenticate user with credentials", + "noAuth": true, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "password": { + "type": "string" + } + }, + "required": [ + "email", + "password" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "type": "object", + "properties": { + "state": { + "type": "string", + "const": "2fa_required" + }, + "tid": { + "type": "string" + } + }, + "required": [ + "state", + "tid" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "state": { + "type": "string", + "const": "success" + }, + "session": { + "type": "string" + } + }, + "required": [ + "state", + "session" + ], + "additionalProperties": false + } + ] + }, + "UNAUTHORIZED": true + } + }, + "validateOTP": { + "method": "post", + "description": "Verify one-time password", + "noAuth": false, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "otp": { + "type": "string" + }, + "otpId": { + "type": "string" + } + }, + "required": [ + "otp", + "otpId" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "boolean" + } + } + }, + "verifySessionToken": { + "method": "post", + "description": "Validate user session token", + "noAuth": false, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "boolean" + }, + "UNAUTHORIZED": true + } + } + }, + "oauth": { + "getEndpoint": { + "method": "get", + "description": "Get OAuth authorization URL for provider", + "noAuth": true, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "provider": { + "type": "string" + } + }, + "required": [ + "provider" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "state": { + "type": "string" + }, + "codeVerifier": { + "type": "string" + }, + "codeChallenge": { + "type": "string" + }, + "codeChallengeMethod": { + "type": "string" + }, + "authURL": { + "type": "string" + }, + "displayName": { + "type": "string" + } + }, + "required": [ + "name", + "state", + "codeVerifier", + "codeChallenge", + "codeChallengeMethod", + "authURL", + "displayName" + ], + "additionalProperties": false + }, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "listProviders": { + "method": "get", + "description": "Retrieve available OAuth providers", + "noAuth": true, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "verify": { + "method": "post", + "description": "Verify OAuth authorization callback", + "noAuth": true, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "provider": { + "type": "string" + }, + "code": { + "type": "string" + } + }, + "required": [ + "provider", + "code" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "type": "object", + "properties": { + "state": { + "type": "string", + "const": "2fa_required" + }, + "tid": { + "type": "string" + } + }, + "required": [ + "state", + "tid" + ], + "additionalProperties": false + }, + { + "type": "string" + } + ] + }, + "UNAUTHORIZED": true, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + } + }, + "2fa": { + "disable": { + "method": "post", + "description": "Disable two-factor authentication", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "NO_CONTENT": true + } + }, + "generateAuthenticatorLink": { + "method": "get", + "description": "Generate authenticator app setup link", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "getChallenge": { + "method": "get", + "description": "Retrieve 2FA challenge token", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "requestOTP": { + "method": "get", + "description": "Request OTP for two-factor authentication", + "noAuth": true, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "email": { + "type": "string", + "format": "email", + "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + } + }, + "required": [ + "email" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + }, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "verify": { + "method": "post", + "description": "Verify two-factor authentication code", + "noAuth": true, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "otp": { + "type": "string" + }, + "tid": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "email", + "app" + ] + } + }, + "required": [ + "otp", + "tid", + "type" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "session": { + "type": "string" + } + }, + "required": [ + "session" + ], + "additionalProperties": false + }, + "UNAUTHORIZED": true + } + }, + "verifyAndEnable": { + "method": "post", + "description": "Verify and activate two-factor authentication", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "otp": { + "type": "string" + } + }, + "required": [ + "otp" + ], + "additionalProperties": false + } + }, + "output": { + "NO_CONTENT": true, + "UNAUTHORIZED": true + } + } + }, + "qrLogin": { + "approveQRLogin": { + "method": "post", + "description": "Approve a QR login request", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "sessionId": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "required": [ + "sessionId" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "browserInfo": { + "type": "string" + } + }, + "required": [ + "success", + "browserInfo" + ], + "additionalProperties": false + }, + "NOT_FOUND": true, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "checkQRSessionStatus": { + "method": "get", + "description": "Check QR login session status", + "noAuth": true, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "sessionId": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + } + }, + "required": [ + "sessionId" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "type": "object", + "properties": { + "status": { + "type": "string", + "const": "not_found" + } + }, + "required": [ + "status" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "status": { + "type": "string", + "const": "expired" + } + }, + "required": [ + "status" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "status": { + "type": "string", + "const": "approved" + }, + "session": { + "type": "string" + } + }, + "required": [ + "status", + "session" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "status": { + "type": "string", + "const": "pending" + }, + "expiresAt": { + "type": "string" + } + }, + "required": [ + "status", + "expiresAt" + ], + "additionalProperties": false + } + ] + } + } + }, + "registerQRSession": { + "method": "post", + "description": "Register a new QR login session", + "noAuth": true, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "sessionId": { + "type": "string", + "format": "uuid", + "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$" + }, + "browserInfo": { + "type": "string" + } + }, + "required": [ + "sessionId", + "browserInfo" + ], + "additionalProperties": false + } + }, + "output": { + "CREATED": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "sessionId": { + "type": "string" + }, + "expiresAt": { + "type": "string" + } + }, + "required": [ + "sessionId", + "expiresAt" + ], + "additionalProperties": false + }, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + } + }, + "settings": { + "deleteAvatar": { + "method": "post", + "description": "Remove user avatar", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "NO_CONTENT": true + } + }, + "requestPasswordReset": { + "method": "post", + "description": "Request password reset email", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "NO_CONTENT": true + } + }, + "updateAvatar": { + "method": "post", + "description": "Upload new user avatar", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": { + "file": { + "optional": false + } + }, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "updateProfile": { + "method": "post", + "description": "Update user profile information", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "username": { + "type": "string", + "pattern": "^[a-zA-Z0-9]+$" + }, + "email": { + "type": "string", + "format": "email", + "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$" + }, + "name": { + "type": "string" + }, + "dateOfBirth": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "required": [ + "data" + ], + "additionalProperties": false + } + }, + "output": { + "NO_CONTENT": true + } + } + }, + "personalization": { + "deleteBgImage": { + "method": "post", + "description": "Remove background image", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "NO_CONTENT": true + } + }, + "getGoogleFont": { + "method": "get", + "description": "Get details of a specific Google Font", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "family": { + "type": "string" + } + }, + "required": [ + "family" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "items": {} + }, + "required": [ + "enabled" + ], + "additionalProperties": false + } + } + }, + "listGoogleFonts": { + "method": "get", + "description": "Retrieve available Google Fonts", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "enabled": { + "type": "boolean" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "properties": { + "family": { + "type": "string" + }, + "variants": { + "type": "array", + "items": { + "type": "string" + } + }, + "subsets": { + "type": "array", + "items": { + "type": "string" + } + }, + "version": { + "type": "string" + }, + "lastModified": { + "type": "string" + }, + "files": { + "type": "object", + "properties": { + "100": { + "type": "string" + }, + "200": { + "type": "string" + }, + "300": { + "type": "string" + }, + "500": { + "type": "string" + }, + "600": { + "type": "string" + }, + "700": { + "type": "string" + }, + "800": { + "type": "string" + }, + "900": { + "type": "string" + }, + "regular": { + "type": "string" + }, + "italic": { + "type": "string" + }, + "100italic": { + "type": "string" + }, + "200italic": { + "type": "string" + }, + "300italic": { + "type": "string" + }, + "500italic": { + "type": "string" + }, + "600italic": { + "type": "string" + }, + "700italic": { + "type": "string" + }, + "800italic": { + "type": "string" + }, + "900italic": { + "type": "string" + } + }, + "additionalProperties": false + }, + "category": { + "type": "string", + "enum": [ + "display", + "handwriting", + "monospace", + "sans-serif", + "serif" + ] + }, + "kind": { + "type": "string", + "const": "webfonts#webfont" + }, + "menu": { + "type": "string" + }, + "colorCapabilities": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "COLRv0", + "COLRv1", + "SVG" + ] + } + } + }, + "required": [ + "family", + "variants", + "subsets", + "version", + "lastModified", + "files", + "category", + "kind", + "menu" + ], + "additionalProperties": false + } + } + }, + "required": [ + "enabled", + "items" + ], + "additionalProperties": false + } + } + }, + "listGoogleFontsPin": { + "method": "get", + "description": "Retrieve pinned Google Fonts", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "string" + } + }, + "UNAUTHORIZED": true + } + }, + "toggleGoogleFontsPin": { + "method": "post", + "description": "Pin or unpin a Google Font", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "family": { + "type": "string" + } + }, + "required": [ + "family" + ], + "additionalProperties": false + } + }, + "output": { + "NO_CONTENT": true, + "UNAUTHORIZED": true + } + }, + "updateBgImage": { + "method": "post", + "description": "Upload new background image", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": { + "file": { + "optional": false + } + }, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "collectionId": { + "type": "string" + }, + "recordId": { + "type": "string" + }, + "fieldId": { + "type": "string" + } + }, + "required": [ + "collectionId", + "recordId", + "fieldId" + ], + "additionalProperties": false + } + } + }, + "updatePersonalization": { + "method": "post", + "description": "Update user personalization preferences", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "data": { + "type": "object", + "properties": { + "fontFamily": { + "type": "string" + }, + "theme": { + "type": "string" + }, + "color": { + "type": "string" + }, + "bgTemp": { + "type": "string" + }, + "language": { + "type": "string" + }, + "fontScale": { + "type": "number" + }, + "borderRadiusMultiplier": { + "type": "number" + }, + "bordered": { + "type": "boolean" + }, + "dashboardLayout": { + "type": "object", + "additionalProperties": {} + }, + "backdropFilters": { + "type": "object", + "additionalProperties": {} + } + }, + "additionalProperties": false + } + }, + "required": [ + "data" + ], + "additionalProperties": false + } + }, + "output": { + "NO_CONTENT": true, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + } + }, + "customFonts": { + "get": { + "method": "get", + "description": "Get a specific custom font by ID", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": [ + "id" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "family": { + "type": "string" + }, + "weight": { + "type": "number" + }, + "file": { + "type": "string" + }, + "collectionId": { + "type": "string" + } + }, + "required": [ + "id", + "displayName", + "family", + "weight", + "file", + "collectionId" + ], + "additionalProperties": false + }, + "NOT_FOUND": true + } + }, + "list": { + "method": "get", + "description": "List all custom uploaded fonts", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "family": { + "type": "string" + }, + "weight": { + "type": "number" + }, + "file": { + "type": "string" + }, + "collectionId": { + "type": "string" + } + }, + "required": [ + "id", + "displayName", + "family", + "weight", + "file", + "collectionId" + ], + "additionalProperties": false + } + } + } + }, + "remove": { + "method": "post", + "description": "Delete a custom font", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": [ + "id" + ], + "additionalProperties": false + } + }, + "output": { + "NO_CONTENT": true, + "NOT_FOUND": true + } + }, + "upload": { + "method": "post", + "description": "Upload a new custom font", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": { + "file": { + "optional": false + } + }, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "additionalProperties": false + }, + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "displayName": { + "type": "string", + "minLength": 1 + }, + "family": { + "type": "string", + "minLength": 1 + }, + "weight": { + "default": 400, + "type": "number", + "minimum": 100, + "maximum": 900 + } + }, + "required": [ + "displayName", + "family", + "weight" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "family": { + "type": "string" + }, + "weight": { + "type": "number" + }, + "file": { + "type": "string" + }, + "collectionId": { + "type": "string" + } + }, + "required": [ + "id", + "displayName", + "family", + "weight", + "file", + "collectionId" + ], + "additionalProperties": false + }, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + }, + "NOT_FOUND": true + } + } + } + }, + "apiKeys": { + "entries": { + "get": { + "method": "get", + "description": "Retrieve API key by key ID. Only exposable keys can be retrieved.", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "keyId": { + "type": "string" + } + }, + "required": [ + "keyId" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] + }, + "FORBIDDEN": true + } + }, + "list": { + "method": "get", + "description": "Retrieve all API key entries", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "keyId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "key": { + "type": "string" + }, + "exposable": { + "type": "boolean" + }, + "created": { + "type": "string" + }, + "updated": { + "type": "string" + }, + "id": { + "type": "string" + }, + "collectionId": { + "type": "string" + }, + "collectionName": { + "type": "string" + } + }, + "required": [ + "keyId", + "name", + "icon", + "key", + "exposable", + "created", + "updated", + "id", + "collectionId", + "collectionName" + ], + "additionalProperties": false + } + } + } + }, + "checkKeys": { + "method": "get", + "description": "Verify if API keys exist", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "keys": { + "type": "string" + } + }, + "required": [ + "keys" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "boolean" + } + } + }, + "create": { + "method": "post", + "description": "Create a new API key entry", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "keyId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "key": { + "type": "string" + }, + "exposable": { + "type": "boolean" + } + }, + "required": [ + "keyId", + "name", + "icon", + "key", + "exposable" + ], + "additionalProperties": false + } + }, + "output": { + "CREATED": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "keyId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "key": { + "type": "string" + }, + "exposable": { + "type": "boolean" + }, + "created": { + "type": "string" + }, + "updated": { + "type": "string" + }, + "id": { + "type": "string" + }, + "collectionId": { + "type": "string" + }, + "collectionName": { + "type": "string" + } + }, + "required": [ + "keyId", + "name", + "icon", + "key", + "exposable", + "created", + "updated", + "id", + "collectionId", + "collectionName" + ], + "additionalProperties": false + } + } + }, + "update": { + "method": "post", + "description": "Update an existing API key entry", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": [ + "id" + ], + "additionalProperties": false + }, + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "keyId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "key": { + "type": "string" + }, + "exposable": { + "type": "boolean" + }, + "overrideKey": { + "type": "boolean" + } + }, + "required": [ + "keyId", + "name", + "icon", + "key", + "exposable", + "overrideKey" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "keyId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "key": { + "type": "string" + }, + "exposable": { + "type": "boolean" + }, + "created": { + "type": "string" + }, + "updated": { + "type": "string" + }, + "id": { + "type": "string" + }, + "collectionId": { + "type": "string" + }, + "collectionName": { + "type": "string" + } + }, + "required": [ + "keyId", + "name", + "icon", + "key", + "exposable", + "created", + "updated", + "id", + "collectionId", + "collectionName" + ], + "additionalProperties": false + }, + "NOT_FOUND": true + } + }, + "remove": { + "method": "post", + "description": "Delete an API key entry", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": [ + "id" + ], + "additionalProperties": false + } + }, + "output": { + "NO_CONTENT": true, + "NOT_FOUND": true + } + } + } + }, + "pixabay": { + "searchImages": { + "method": "get", + "description": "Search for images on Pixabay", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "q": { + "type": "string", + "minLength": 1 + }, + "page": { + "default": "1", + "type": "string" + }, + "type": { + "default": "all", + "type": "string", + "enum": [ + "all", + "photo", + "illustration", + "vector" + ] + }, + "category": { + "type": "string", + "enum": [ + "backgrounds", + "fashion", + "nature", + "science", + "education", + "feelings", + "health", + "people", + "religion", + "places", + "animals", + "industry", + "computer", + "food", + "sports", + "transportation", + "travel", + "buildings", + "business", + "music" + ] + }, + "colors": { + "anyOf": [ + { + "type": "string", + "enum": [ + "grayscale", + "transparent", + "red", + "orange", + "yellow", + "green", + "turquoise", + "blue", + "lilac", + "pink", + "white", + "gray", + "black", + "brown" + ] + }, + { + "type": "null" + } + ] + }, + "editors_choice": { + "default": "false", + "type": "string", + "enum": [ + "true", + "false" + ] + } + }, + "required": [ + "q", + "page", + "type", + "editors_choice" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "total": { + "type": "number" + }, + "hits": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "thumbnail": { + "type": "object", + "properties": { + "url": { + "type": "string" + }, + "width": { + "type": "number" + }, + "height": { + "type": "number" + } + }, + "required": [ + "url", + "width", + "height" + ], + "additionalProperties": false + }, + "imageURL": { + "type": "string" + } + }, + "required": [ + "id", + "thumbnail", + "imageURL" + ], + "additionalProperties": false + } + } + }, + "required": [ + "total", + "hits" + ], + "additionalProperties": false + }, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + } + }, + "locations": { + "search": { + "method": "get", + "description": "Search for locations using Google Places API", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "q": { + "type": "string" + } + }, + "required": [ + "q" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "formattedAddress": { + "type": "string" + }, + "location": { + "type": "object", + "properties": { + "latitude": { + "type": "number" + }, + "longitude": { + "type": "number" + } + }, + "required": [ + "latitude", + "longitude" + ], + "additionalProperties": false + } + }, + "required": [ + "name", + "formattedAddress", + "location" + ], + "additionalProperties": false + } + }, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + } + }, + "backups": { + "list": { + "method": "get", + "description": "Retrieve all database backups", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "size": { + "type": "number" + }, + "modified": { + "type": "string" + } + }, + "required": [ + "key", + "size", + "modified" + ], + "additionalProperties": false + } + } + } + }, + "download": { + "method": "get", + "description": "Download a database backup file", + "noAuth": false, + "encrypted": true, + "isDownloadable": true, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "key": { + "type": "string" + } + }, + "required": [ + "key" + ], + "additionalProperties": false + } + }, + "output": { + "NO_CONTENT": true, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "create": { + "method": "post", + "description": "Create a new database backup", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "backupName": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "output": { + "CREATED": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "null" + } + } + }, + "remove": { + "method": "post", + "description": "Delete a database backup", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "key": { + "type": "string" + } + }, + "required": [ + "key" + ], + "additionalProperties": false + } + }, + "output": { + "NO_CONTENT": true + } + } + }, + "database": { + "collections": { + "list": { + "method": "get", + "description": "Retrieve all database collections", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "base", + "view" + ] + }, + "fields": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "optional": { + "type": "boolean" + }, + "options": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "name", + "type", + "optional" + ], + "additionalProperties": false + } + } + }, + "required": [ + "name", + "type", + "fields" + ], + "additionalProperties": false + } + } + } + } + } + }, + "modules": { + "checkModuleAvailability": { + "method": "get", + "description": "Check if a module is available (installed)", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "moduleId": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "moduleId" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "boolean" + } + } + }, + "list": { + "method": "get", + "description": "List installed modules with metadata", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "moduleId": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "version": { + "type": "string" + }, + "description": { + "type": "string" + }, + "author": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "category": { + "type": "string" + }, + "isInternal": { + "type": "boolean" + }, + "isDevMode": { + "type": "boolean" + }, + "hasDist": { + "type": "boolean" + }, + "hasSource": { + "type": "boolean" + } + }, + "required": [ + "name", + "moduleId", + "displayName", + "version", + "description", + "author", + "icon", + "category", + "isInternal", + "isDevMode", + "hasDist", + "hasSource" + ], + "additionalProperties": false + } + } + } + }, + "manifest": { + "method": "get", + "description": "Get installed modules manifest for runtime loading", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "modules": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "moduleId": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "version": { + "type": "string" + }, + "description": { + "type": "string" + }, + "author": { + "type": "string" + }, + "icon": { + "type": "string" + }, + "category": { + "type": "string" + }, + "remoteEntryUrl": { + "type": "string" + }, + "isInternal": { + "type": "boolean" + }, + "isDevMode": { + "type": "boolean" + }, + "APIKeyAccess": { + "type": "object", + "additionalProperties": { + "type": "object", + "properties": { + "usage": { + "type": "string" + }, + "required": { + "type": "boolean" + } + }, + "required": [ + "usage", + "required" + ], + "additionalProperties": false + } + } + }, + "required": [ + "name", + "moduleId", + "displayName", + "version", + "description", + "author", + "icon", + "category", + "remoteEntryUrl", + "isInternal" + ], + "additionalProperties": false + } + } + }, + "required": [ + "modules" + ], + "additionalProperties": false + } + } + }, + "uninstall": { + "method": "post", + "description": "Uninstall a module", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "moduleName": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "moduleName" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "error": { + "type": "string" + } + }, + "required": [ + "success" + ], + "additionalProperties": false + } + } + }, + "categories": { + "aiTranslate": { + "method": "post", + "description": "Translate a specific category into desired languages", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "languages": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "key", + "languages" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + { + "type": "null" + } + ] + } + } + }, + "list": { + "method": "get", + "description": "Get the category display order", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + } + }, + "update": { + "method": "post", + "description": "Update the category display order", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "data": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": { + "type": "string" + } + } + } + }, + "required": [ + "data" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "success": { + "type": "boolean" + } + }, + "required": [ + "success" + ], + "additionalProperties": false + } + } + } + }, + "devMode": { + "toggle": { + "method": "post", + "description": "Toggle dev mode for a module", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "moduleName": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "moduleName" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "boolean" + } + } + } + } + }, + "ai": { + "imageGeneration": { + "generateImage": { + "method": "post", + "description": "Generate image from text prompt using AI", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "prompt": { + "type": "string", + "minLength": 1 + } + }, + "required": [ + "prompt" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + }, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + } + } + }, + "ping": { + "method": "post", + "description": "Ping the server", + "noAuth": true, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": { + "body": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "timestamp": { + "type": "number", + "minimum": 0 + } + }, + "required": [ + "timestamp" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "status": { + "method": "get", + "description": "Get server status", + "noAuth": true, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "environment": { + "type": "string" + } + }, + "required": [ + "environment" + ], + "additionalProperties": false + } + } + }, + "media": { + "method": "get", + "description": "Retrieve media file from PocketBase", + "noAuth": true, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "collectionId": { + "type": "string" + }, + "recordId": { + "type": "string" + }, + "fieldId": { + "type": "string" + }, + "thumb": { + "type": "string" + }, + "token": { + "type": "string" + } + }, + "required": [ + "collectionId", + "recordId", + "fieldId" + ], + "additionalProperties": false + } + }, + "output": "custom" + }, + "corsAnywhere": { + "method": "get", + "description": "CORS Anywhere - Fetch external URL content", + "noAuth": false, + "encrypted": true, + "isDownloadable": false, + "media": null, + "input": { + "query": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "url": { + "type": "string", + "format": "uri" + } + }, + "required": [ + "url" + ], + "additionalProperties": false + } + }, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema" + }, + "BAD_REQUEST": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + }, + "encryptionPublicKey": { + "method": "get", + "description": "Get server public key for end-to-end encryption", + "noAuth": true, + "encrypted": false, + "isDownloadable": false, + "media": null, + "input": {}, + "output": { + "OK": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "string" + } + } + } +} as const + +export default contract diff --git a/packages/ui/package.json b/packages/ui/package.json index 3ec924610..28fb19ce2 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -23,8 +23,8 @@ }, "scripts": { "dev": "storybook dev -p 6006", - "types": "tsc -b", - "build": "tsc -b && rm -rf dist && vite build", + "types": "tsgo -b", + "build": "tsgo -b && rm -rf dist && vite build", "build-storybook": "cd ../../api && bun run build && cd ../packages/ui && storybook build" }, "dependencies": { diff --git a/packages/ui/src/components/inputs/IconInput/components/IconPreview.tsx b/packages/ui/src/components/inputs/IconInput/components/IconPreview.tsx index 15640aca1..8888d0b2e 100644 --- a/packages/ui/src/components/inputs/IconInput/components/IconPreview.tsx +++ b/packages/ui/src/components/inputs/IconInput/components/IconPreview.tsx @@ -1,8 +1,8 @@ -import { Icon, loadIcon } from '@iconify/react' +import { loadIcon } from '@iconify/react' import { useEffect, useState } from 'react' import type { InputVariant } from '@/components/inputs/shared/types' -import { Box } from '@/components/primitives' +import { Box, Icon } from '@/components/primitives' import * as styles from '../IconInput.css' @@ -52,10 +52,7 @@ export function IconPreview({ > diff --git a/server/package.json b/server/package.json index 9b8ebb469..e9401da88 100755 --- a/server/package.json +++ b/server/package.json @@ -14,7 +14,7 @@ "type": "module", "main": "./dist/server.js", "scripts": { - "types": "tsc -b", + "types": "tsgo -b", "build": "bun types && bun build ./src/index.ts --target bun --minify --production --outfile=./dist/server.js", "start": "bun types && NODE_ENV=production bun --env-file=../env/.env.local ./src/index.ts", "start:prod": "NODE_ENV=production bun ./dist/server.js", diff --git a/server/src/core/routes/core.routes.ts b/server/src/core/routes/core.routes.ts index 6d5d89b99..6ea29dfbd 100644 --- a/server/src/core/routes/core.routes.ts +++ b/server/src/core/routes/core.routes.ts @@ -132,7 +132,12 @@ writeContractFileToClient( ) writeContractFileToClient( coreRoutes, - path.resolve(import.meta.dirname, '../../../../packages/ui/src'), + path.resolve(import.meta.dirname, '../../../../packages/ui'), + '.' +) +writeContractFileToClient( + coreRoutes, + path.resolve(import.meta.dirname, '../../../../packages/api'), '.' )