diff --git a/packages/app-client/src/index.tsx b/packages/app-client/src/index.tsx index 4cbe28f8..c3b4cdb4 100644 --- a/packages/app-client/src/index.tsx +++ b/packages/app-client/src/index.tsx @@ -1,11 +1,12 @@ /* @refresh reload */ + import '@unocss/reset/tailwind.css'; import 'virtual:uno.css'; import './app.css'; -import { Suspense, render } from 'solid-js/web'; -import { Router } from '@solidjs/router'; import { ColorModeProvider, ColorModeScript, createLocalStorageManager } from '@kobalte/core/color-mode'; +import { Router } from '@solidjs/router'; +import { Suspense, render } from 'solid-js/web'; import { routes } from './routes'; import { NoteContextProvider } from './modules/notes/notes.context'; diff --git a/packages/app-client/src/modules/files/files.models.test.ts b/packages/app-client/src/modules/files/files.models.test.ts index d140f62f..b3665601 100644 --- a/packages/app-client/src/modules/files/files.models.test.ts +++ b/packages/app-client/src/modules/files/files.models.test.ts @@ -1,6 +1,6 @@ +import { icons as tablerIconSet } from '@iconify-json/tabler'; import { values } from 'lodash-es'; import { describe, expect, test } from 'vitest'; -import { icons as tablerIconSet } from '@iconify-json/tabler'; import { getFileIcon, iconByFileType } from './files.models'; describe('files models', () => { diff --git a/packages/app-client/src/modules/notes/components/file-uploader.tsx b/packages/app-client/src/modules/notes/components/file-uploader.tsx index 344e0db7..43e436d1 100644 --- a/packages/app-client/src/modules/notes/components/file-uploader.tsx +++ b/packages/app-client/src/modules/notes/components/file-uploader.tsx @@ -1,6 +1,6 @@ -import { type Component, type ComponentProps, type ParentComponent, createSignal, onCleanup, splitProps } from 'solid-js'; -import { Button } from '@/modules/ui/components/button'; import { cn } from '@/modules/shared/style/cn'; +import { Button } from '@/modules/ui/components/button'; +import { type Component, type ComponentProps, createSignal, onCleanup, type ParentComponent, splitProps } from 'solid-js'; const DropArea: Component<{ onFilesDrop?: (args: { files: File[] }) => void }> = (props) => { const [isDragging, setIsDragging] = createSignal(false); diff --git a/packages/app-client/src/modules/notes/components/note-password-field.tsx b/packages/app-client/src/modules/notes/components/note-password-field.tsx index 6e3d193e..0dfbd6c2 100644 --- a/packages/app-client/src/modules/notes/components/note-password-field.tsx +++ b/packages/app-client/src/modules/notes/components/note-password-field.tsx @@ -1,7 +1,7 @@ +import { Button } from '@/modules/ui/components/button'; +import { TextField } from '@/modules/ui/components/textfield'; import { type Component, createSignal } from 'solid-js'; import { createRandomPassword } from '../notes.models'; -import { TextField } from '@/modules/ui/components/textfield'; -import { Button } from '@/modules/ui/components/button'; export const NotePasswordField: Component<{ getPassword: () => string; setPassword: (value: string) => void }> = (props) => { const [getShowPassword, setShowPassword] = createSignal(false); diff --git a/packages/app-client/src/modules/notes/notes.services.ts b/packages/app-client/src/modules/notes/notes.services.ts index 81bf348d..fb5083c3 100644 --- a/packages/app-client/src/modules/notes/notes.services.ts +++ b/packages/app-client/src/modules/notes/notes.services.ts @@ -1,6 +1,6 @@ import { apiClient } from '../shared/http/http-client'; -export { storeNote, fetchNoteById }; +export { fetchNoteById, storeNote }; async function storeNote({ payload, diff --git a/packages/app-client/src/modules/notes/pages/create-note.page.tsx b/packages/app-client/src/modules/notes/pages/create-note.page.tsx index bd0da218..fc116da8 100644 --- a/packages/app-client/src/modules/notes/pages/create-note.page.tsx +++ b/packages/app-client/src/modules/notes/pages/create-note.page.tsx @@ -1,18 +1,18 @@ -import { type Component, Match, Show, Switch, createSignal, onCleanup, onMount } from 'solid-js'; -import { encryptAndCreateNote } from '../notes.usecases'; -import { useNoteContext } from '../notes.context'; -import { NotePasswordField } from '../components/note-password-field'; -import { FileUploaderButton } from '../components/file-uploader'; -import { TextArea } from '@/modules/ui/components/textarea'; -import { TextField, TextFieldLabel, TextFieldRoot } from '@/modules/ui/components/textfield'; -import { Button } from '@/modules/ui/components/button'; -import { Tabs, TabsIndicator, TabsList, TabsTrigger } from '@/modules/ui/components/tabs'; -import { SwitchControl, SwitchLabel, SwitchThumb, Switch as SwitchUiComponent } from '@/modules/ui/components/switch'; -import { Alert, AlertDescription } from '@/modules/ui/components/alert'; -import { CopyButton } from '@/modules/shared/utils/copy'; +import { getFileIcon } from '@/modules/files/files.models'; import { isHttpErrorWithCode, isRateLimitError } from '@/modules/shared/http/http-errors'; import { cn } from '@/modules/shared/style/cn'; -import { getFileIcon } from '@/modules/files/files.models'; +import { CopyButton } from '@/modules/shared/utils/copy'; +import { Alert, AlertDescription } from '@/modules/ui/components/alert'; +import { Button } from '@/modules/ui/components/button'; +import { SwitchControl, SwitchLabel, SwitchThumb, Switch as SwitchUiComponent } from '@/modules/ui/components/switch'; +import { Tabs, TabsIndicator, TabsList, TabsTrigger } from '@/modules/ui/components/tabs'; +import { TextArea } from '@/modules/ui/components/textarea'; +import { TextField, TextFieldLabel, TextFieldRoot } from '@/modules/ui/components/textfield'; +import { type Component, createSignal, Match, onCleanup, onMount, Show, Switch } from 'solid-js'; +import { FileUploaderButton } from '../components/file-uploader'; +import { NotePasswordField } from '../components/note-password-field'; +import { useNoteContext } from '../notes.context'; +import { encryptAndCreateNote } from '../notes.usecases'; export const CreateNotePage: Component = () => { const [getContent, setContent] = createSignal(''); diff --git a/packages/app-client/src/modules/notes/pages/view-note.page.tsx b/packages/app-client/src/modules/notes/pages/view-note.page.tsx index 5144fcc7..7bc5eaab 100644 --- a/packages/app-client/src/modules/notes/pages/view-note.page.tsx +++ b/packages/app-client/src/modules/notes/pages/view-note.page.tsx @@ -1,17 +1,17 @@ -import { useLocation, useParams } from '@solidjs/router'; -import { type Component, Match, Show, Switch, createSignal, onMount } from 'solid-js'; +import { getFileIcon } from '@/modules/files/files.models'; +import { isHttpErrorWithCode, isRateLimitError } from '@/modules/shared/http/http-errors'; +import { cn } from '@/modules/shared/style/cn'; +import { CopyButton } from '@/modules/shared/utils/copy'; +import { Alert, AlertDescription } from '@/modules/ui/components/alert'; +import { Button } from '@/modules/ui/components/button'; +import { Card, CardContent, CardDescription, CardHeader } from '@/modules/ui/components/card'; +import { TextField, TextFieldLabel, TextFieldRoot } from '@/modules/ui/components/textfield'; +import { formatBytes, safely } from '@corentinth/chisels'; import { decryptNote, noteAssetsToFiles, parseNoteUrlHashFragment } from '@enclosed/lib'; +import { useLocation, useParams } from '@solidjs/router'; import JSZip from 'jszip'; -import { formatBytes, safely } from '@corentinth/chisels'; +import { type Component, createSignal, Match, onMount, Show, Switch } from 'solid-js'; import { fetchNoteById } from '../notes.services'; -import { TextField, TextFieldLabel, TextFieldRoot } from '@/modules/ui/components/textfield'; -import { Card, CardContent, CardDescription, CardHeader } from '@/modules/ui/components/card'; -import { Button } from '@/modules/ui/components/button'; -import { isHttpErrorWithCode, isRateLimitError } from '@/modules/shared/http/http-errors'; -import { Alert, AlertDescription } from '@/modules/ui/components/alert'; -import { CopyButton } from '@/modules/shared/utils/copy'; -import { getFileIcon } from '@/modules/files/files.models'; -import { cn } from '@/modules/shared/style/cn'; const RequestPasswordForm: Component<{ onPasswordEntered: (args: { password: string }) => void; getIsPasswordInvalid: () => boolean; setIsPasswordInvalid: (value: boolean) => void }> = (props) => { const [getPassword, setPassword] = createSignal(''); diff --git a/packages/app-client/src/modules/shared/http/http-client.models.ts b/packages/app-client/src/modules/shared/http/http-client.models.ts index 9725280d..a54f078f 100644 --- a/packages/app-client/src/modules/shared/http/http-client.models.ts +++ b/packages/app-client/src/modules/shared/http/http-client.models.ts @@ -1,4 +1,4 @@ -export { isFetchResponseJson, getBody }; +export { getBody, isFetchResponseJson }; function isFetchResponseJson({ response }: { response: Response }): boolean { return Boolean(response.headers.get('content-type')?.includes('application/json')); diff --git a/packages/app-client/src/modules/shared/http/http-client.ts b/packages/app-client/src/modules/shared/http/http-client.ts index 6c400dce..72e2e8fe 100644 --- a/packages/app-client/src/modules/shared/http/http-client.ts +++ b/packages/app-client/src/modules/shared/http/http-client.ts @@ -1,5 +1,5 @@ -import { getBody } from './http-client.models'; import { config } from '@/modules/config/config'; +import { getBody } from './http-client.models'; export { apiClient }; diff --git a/packages/app-client/src/modules/shared/utils/copy.tsx b/packages/app-client/src/modules/shared/utils/copy.tsx index b63446e7..f1a1346a 100644 --- a/packages/app-client/src/modules/shared/utils/copy.tsx +++ b/packages/app-client/src/modules/shared/utils/copy.tsx @@ -1,6 +1,6 @@ import type { ComponentProps, ParentComponent } from 'solid-js'; -import { createSignal } from 'solid-js'; import { Button } from '@/modules/ui/components/button'; +import { createSignal } from 'solid-js'; export function useCopy() { const [getIsJustCopied, setIsJustCopied] = createSignal(false); diff --git a/packages/app-client/src/modules/ui/components/alert.tsx b/packages/app-client/src/modules/ui/components/alert.tsx index 2e3d3a71..72f28ea1 100644 --- a/packages/app-client/src/modules/ui/components/alert.tsx +++ b/packages/app-client/src/modules/ui/components/alert.tsx @@ -1,11 +1,11 @@ import type { AlertRootProps } from '@kobalte/core/alert'; -import { Alert as AlertPrimitive } from '@kobalte/core/alert'; import type { PolymorphicProps } from '@kobalte/core/polymorphic'; import type { VariantProps } from 'class-variance-authority'; -import { cva } from 'class-variance-authority'; import type { ComponentProps, ValidComponent } from 'solid-js'; -import { splitProps } from 'solid-js'; import { cn } from '@/modules/shared/style/cn'; +import { Alert as AlertPrimitive } from '@kobalte/core/alert'; +import { cva } from 'class-variance-authority'; +import { splitProps } from 'solid-js'; export const alertVariants = cva( 'relative w-full rounded-lg border px-4 py-3 text-sm [&:has(svg)]:pl-11 [&>svg+div]:translate-y-[-3px] [&>svg]:(absolute left-4 top-4 text-foreground)', diff --git a/packages/app-client/src/modules/ui/components/button.tsx b/packages/app-client/src/modules/ui/components/button.tsx index d3157164..5f19ba17 100644 --- a/packages/app-client/src/modules/ui/components/button.tsx +++ b/packages/app-client/src/modules/ui/components/button.tsx @@ -1,11 +1,11 @@ import type { ButtonRootProps } from '@kobalte/core/button'; -import { Button as ButtonPrimitive } from '@kobalte/core/button'; import type { PolymorphicProps } from '@kobalte/core/polymorphic'; import type { VariantProps } from 'class-variance-authority'; -import { cva } from 'class-variance-authority'; import type { ValidComponent } from 'solid-js'; -import { splitProps } from 'solid-js'; import { cn } from '@/modules/shared/style/cn'; +import { Button as ButtonPrimitive } from '@kobalte/core/button'; +import { cva } from 'class-variance-authority'; +import { splitProps } from 'solid-js'; export const buttonVariants = cva( 'inline-flex items-center justify-center rounded-md text-sm font-medium transition-shadow focus-visible:(outline-none ring-1.5 ring-ring) disabled:(pointer-events-none opacity-50) bg-inherit', diff --git a/packages/app-client/src/modules/ui/components/card.tsx b/packages/app-client/src/modules/ui/components/card.tsx index 937ab68c..77617e12 100644 --- a/packages/app-client/src/modules/ui/components/card.tsx +++ b/packages/app-client/src/modules/ui/components/card.tsx @@ -1,6 +1,6 @@ import type { ComponentProps, ParentComponent } from 'solid-js'; -import { splitProps } from 'solid-js'; import { cn } from '@/modules/shared/style/cn'; +import { splitProps } from 'solid-js'; export function Card(props: ComponentProps<'div'>) { const [local, rest] = splitProps(props, ['class']); diff --git a/packages/app-client/src/modules/ui/components/dropdown-menu.tsx b/packages/app-client/src/modules/ui/components/dropdown-menu.tsx index ee945dac..bbbd8750 100644 --- a/packages/app-client/src/modules/ui/components/dropdown-menu.tsx +++ b/packages/app-client/src/modules/ui/components/dropdown-menu.tsx @@ -9,11 +9,11 @@ import type { DropdownMenuSeparatorProps, DropdownMenuSubTriggerProps, } from '@kobalte/core/dropdown-menu'; -import { DropdownMenu as DropdownMenuPrimitive } from '@kobalte/core/dropdown-menu'; import type { PolymorphicProps } from '@kobalte/core/polymorphic'; import type { ComponentProps, ParentProps, ValidComponent } from 'solid-js'; -import { mergeProps, splitProps } from 'solid-js'; import { cn } from '@/modules/shared/style/cn'; +import { DropdownMenu as DropdownMenuPrimitive } from '@kobalte/core/dropdown-menu'; +import { mergeProps, splitProps } from 'solid-js'; export const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger; export const DropdownMenuGroup = DropdownMenuPrimitive.Group; diff --git a/packages/app-client/src/modules/ui/components/switch.tsx b/packages/app-client/src/modules/ui/components/switch.tsx index d93ed686..0e98722b 100644 --- a/packages/app-client/src/modules/ui/components/switch.tsx +++ b/packages/app-client/src/modules/ui/components/switch.tsx @@ -3,10 +3,10 @@ import type { SwitchControlProps, SwitchThumbProps, } from '@kobalte/core/switch'; -import { Switch as SwitchPrimitive } from '@kobalte/core/switch'; import type { ParentProps, ValidComponent, VoidProps } from 'solid-js'; -import { splitProps } from 'solid-js'; import { cn } from '@/modules/shared/style/cn'; +import { Switch as SwitchPrimitive } from '@kobalte/core/switch'; +import { splitProps } from 'solid-js'; export const SwitchLabel = SwitchPrimitive.Label; export const Switch = SwitchPrimitive; diff --git a/packages/app-client/src/modules/ui/components/tabs.tsx b/packages/app-client/src/modules/ui/components/tabs.tsx index 095fb1e6..eff8f344 100644 --- a/packages/app-client/src/modules/ui/components/tabs.tsx +++ b/packages/app-client/src/modules/ui/components/tabs.tsx @@ -6,12 +6,12 @@ import type { TabsRootProps, TabsTriggerProps, } from '@kobalte/core/tabs'; -import { Tabs as TabsPrimitive } from '@kobalte/core/tabs'; import type { VariantProps } from 'class-variance-authority'; -import { cva } from 'class-variance-authority'; import type { ValidComponent, VoidProps } from 'solid-js'; -import { splitProps } from 'solid-js'; import { cn } from '@/modules/shared/style/cn'; +import { Tabs as TabsPrimitive } from '@kobalte/core/tabs'; +import { cva } from 'class-variance-authority'; +import { splitProps } from 'solid-js'; type tabsProps = TabsRootProps & { class?: string; diff --git a/packages/app-client/src/modules/ui/components/textarea.tsx b/packages/app-client/src/modules/ui/components/textarea.tsx index 88b57b79..a4d955a7 100644 --- a/packages/app-client/src/modules/ui/components/textarea.tsx +++ b/packages/app-client/src/modules/ui/components/textarea.tsx @@ -1,9 +1,9 @@ import type { PolymorphicProps } from '@kobalte/core/polymorphic'; import type { TextFieldTextAreaProps } from '@kobalte/core/text-field'; -import { TextArea as TextFieldPrimitive } from '@kobalte/core/text-field'; import type { ValidComponent, VoidProps } from 'solid-js'; -import { splitProps } from 'solid-js'; import { cn } from '@/modules/shared/style/cn'; +import { TextArea as TextFieldPrimitive } from '@kobalte/core/text-field'; +import { splitProps } from 'solid-js'; type textAreaProps = VoidProps< TextFieldTextAreaProps & { diff --git a/packages/app-client/src/modules/ui/components/textfield.tsx b/packages/app-client/src/modules/ui/components/textfield.tsx index 53d00af8..71ad61f9 100644 --- a/packages/app-client/src/modules/ui/components/textfield.tsx +++ b/packages/app-client/src/modules/ui/components/textfield.tsx @@ -6,11 +6,11 @@ import type { TextFieldLabelProps, TextFieldRootProps, } from '@kobalte/core/text-field'; +import type { ValidComponent, VoidProps } from 'solid-js'; +import { cn } from '@/modules/shared/style/cn'; import { TextField as TextFieldPrimitive } from '@kobalte/core/text-field'; import { cva } from 'class-variance-authority'; -import type { ValidComponent, VoidProps } from 'solid-js'; import { splitProps } from 'solid-js'; -import { cn } from '@/modules/shared/style/cn'; type textFieldProps = TextFieldRootProps & { diff --git a/packages/app-client/src/modules/ui/layouts/app.layout.tsx b/packages/app-client/src/modules/ui/layouts/app.layout.tsx index 109e08ae..cbb68ec9 100644 --- a/packages/app-client/src/modules/ui/layouts/app.layout.tsx +++ b/packages/app-client/src/modules/ui/layouts/app.layout.tsx @@ -1,12 +1,12 @@ -import { A, useNavigate } from '@solidjs/router'; import type { Component, ParentComponent } from 'solid-js'; +import { config } from '@/modules/config/config'; +import { buildDocUrl } from '@/modules/docs/docs.models'; +import { useNoteContext } from '@/modules/notes/notes.context'; +import { useThemeStore } from '@/modules/theme/theme.store'; +import { Button } from '@/modules/ui/components/button'; import { DropdownMenu } from '@kobalte/core/dropdown-menu'; +import { A, useNavigate } from '@solidjs/router'; import { DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from '../components/dropdown-menu'; -import { Button } from '@/modules/ui/components/button'; -import { useThemeStore } from '@/modules/theme/theme.store'; -import { useNoteContext } from '@/modules/notes/notes.context'; -import { buildDocUrl } from '@/modules/docs/docs.models'; -import { config } from '@/modules/config/config'; export const Navbar: Component = () => { const themeStore = useThemeStore(); diff --git a/packages/app-client/src/routes.tsx b/packages/app-client/src/routes.tsx index c7ef0a8f..31acc016 100644 --- a/packages/app-client/src/routes.tsx +++ b/packages/app-client/src/routes.tsx @@ -1,9 +1,9 @@ import { A, type RouteDefinition } from '@solidjs/router'; -import { AppLayout } from './modules/ui/layouts/app.layout'; +import { NOTE_ID_REGEX } from './modules/notes/notes.constants'; import { CreateNotePage } from './modules/notes/pages/create-note.page'; import { ViewNotePage } from './modules/notes/pages/view-note.page'; import { Button } from './modules/ui/components/button'; -import { NOTE_ID_REGEX } from './modules/notes/notes.constants'; +import { AppLayout } from './modules/ui/layouts/app.layout'; export const routes: RouteDefinition[] = [ { diff --git a/packages/app-client/uno.config.ts b/packages/app-client/uno.config.ts index 6316cf93..23ee9396 100644 --- a/packages/app-client/uno.config.ts +++ b/packages/app-client/uno.config.ts @@ -1,3 +1,4 @@ +import { chain } from 'lodash-es'; import { defineConfig, presetIcons, @@ -7,7 +8,6 @@ import { transformerVariantGroup, } from 'unocss'; import presetAnimations from 'unocss-preset-animations'; -import { chain } from 'lodash-es'; import { iconByFileType } from './src/modules/files/files.models'; export default defineConfig({ diff --git a/packages/app-client/vite.config.ts b/packages/app-client/vite.config.ts index c283d024..f08c384f 100644 --- a/packages/app-client/vite.config.ts +++ b/packages/app-client/vite.config.ts @@ -1,8 +1,8 @@ import path from 'node:path'; import process from 'node:process'; +import unoCssPlugin from 'unocss/vite'; import { defineConfig } from 'vite'; import solidPlugin from 'vite-plugin-solid'; -import unoCssPlugin from 'unocss/vite'; export default defineConfig({ plugins: [ diff --git a/packages/app-server/src/index.node.ts b/packages/app-server/src/index.node.ts index e9691a74..7c129cee 100644 --- a/packages/app-server/src/index.node.ts +++ b/packages/app-server/src/index.node.ts @@ -1,12 +1,12 @@ import process, { env } from 'node:process'; import { serve } from '@hono/node-server'; import { serveStatic } from '@hono/node-server/serve-static'; -import { createServer } from './modules/app/server'; import { getConfig } from './modules/app/config/config'; +import { createServer } from './modules/app/server'; import { deleteExpiredNotesTask } from './modules/notes/tasks/delete-expired-notes.tasks'; -import { createTaskScheduler } from './modules/tasks/task-scheduler'; import { createFsLiteStorage } from './modules/storage/factories/fs-lite.storage'; +import { createTaskScheduler } from './modules/tasks/task-scheduler'; const config = getConfig({ env }); const { storage } = createFsLiteStorage({ config }); diff --git a/packages/app-server/src/modules/app/config/config.test-utils.ts b/packages/app-server/src/modules/app/config/config.test-utils.ts index 60e64896..1590ee8b 100644 --- a/packages/app-server/src/modules/app/config/config.test-utils.ts +++ b/packages/app-server/src/modules/app/config/config.test-utils.ts @@ -1,7 +1,7 @@ -import { merge } from 'lodash-es'; import type { DeepPartial } from '@corentinth/chisels'; -import { getConfig } from './config'; import type { Config } from './config.types'; +import { merge } from 'lodash-es'; +import { getConfig } from './config'; export { overrideConfig }; diff --git a/packages/app-server/src/modules/app/middlewares/config.middleware.ts b/packages/app-server/src/modules/app/middlewares/config.middleware.ts index 24892100..f8db3440 100644 --- a/packages/app-server/src/modules/app/middlewares/config.middleware.ts +++ b/packages/app-server/src/modules/app/middlewares/config.middleware.ts @@ -1,7 +1,7 @@ +import type { Config } from '../config/config.types'; import { env as getEnv } from 'hono/adapter'; import { createMiddleware } from 'hono/factory'; import { getConfig } from '../config/config'; -import type { Config } from '../config/config.types'; export function createConfigMiddleware({ config: initialConfig }: { config?: Config } = {}) { return createMiddleware(async (c, next) => { diff --git a/packages/app-server/src/modules/app/middlewares/cors.middleware.ts b/packages/app-server/src/modules/app/middlewares/cors.middleware.ts index afd27964..7ece397e 100644 --- a/packages/app-server/src/modules/app/middlewares/cors.middleware.ts +++ b/packages/app-server/src/modules/app/middlewares/cors.middleware.ts @@ -1,6 +1,6 @@ +import type { Context } from '../server.types'; import { cors } from 'hono/cors'; import { createMiddleware } from 'hono/factory'; -import type { Context } from '../server.types'; export const corsMiddleware = createMiddleware(async (context: Context, next) => { const { server: { corsOrigins } } = context.get('config'); diff --git a/packages/app-server/src/modules/app/middlewares/errors.middleware.ts b/packages/app-server/src/modules/app/middlewares/errors.middleware.ts index b4c0654f..7dfcc603 100644 --- a/packages/app-server/src/modules/app/middlewares/errors.middleware.ts +++ b/packages/app-server/src/modules/app/middlewares/errors.middleware.ts @@ -1,6 +1,6 @@ +import type { ServerInstance } from '../server.types'; import { isCustomError } from '../../shared/errors/errors'; import { createLogger } from '../../shared/logger/logger'; -import type { ServerInstance } from '../server.types'; const logger = createLogger({ namespace: 'middlewares:error' }); diff --git a/packages/app-server/src/modules/app/middlewares/storage.middleware.ts b/packages/app-server/src/modules/app/middlewares/storage.middleware.ts index 3b51893e..1b268e59 100644 --- a/packages/app-server/src/modules/app/middlewares/storage.middleware.ts +++ b/packages/app-server/src/modules/app/middlewares/storage.middleware.ts @@ -1,5 +1,5 @@ -import { createMiddleware } from 'hono/factory'; import type { BindableStorageFactory } from '../../storage/storage.types'; +import { createMiddleware } from 'hono/factory'; export function createStorageMiddleware({ storageFactory }: { storageFactory: BindableStorageFactory }) { return createMiddleware(async (context, next) => { diff --git a/packages/app-server/src/modules/app/middlewares/timeout.middleware.test.ts b/packages/app-server/src/modules/app/middlewares/timeout.middleware.test.ts index a0552f8d..2561bae7 100644 --- a/packages/app-server/src/modules/app/middlewares/timeout.middleware.test.ts +++ b/packages/app-server/src/modules/app/middlewares/timeout.middleware.test.ts @@ -1,7 +1,7 @@ -import { describe, expect, test } from 'vitest'; import { Hono } from 'hono'; -import { timeoutMiddleware } from './timeout.middleware'; +import { describe, expect, test } from 'vitest'; import { registerErrorMiddleware } from './errors.middleware'; +import { timeoutMiddleware } from './timeout.middleware'; describe('middlewares', () => { describe('timeoutMiddleware', () => { diff --git a/packages/app-server/src/modules/app/middlewares/timeout.middleware.ts b/packages/app-server/src/modules/app/middlewares/timeout.middleware.ts index 26fa74fc..4636603a 100644 --- a/packages/app-server/src/modules/app/middlewares/timeout.middleware.ts +++ b/packages/app-server/src/modules/app/middlewares/timeout.middleware.ts @@ -1,5 +1,5 @@ -import { createMiddleware } from 'hono/factory'; import type { Context } from '../server.types'; +import { createMiddleware } from 'hono/factory'; import { createError } from '../../shared/errors/errors'; export const timeoutMiddleware = createMiddleware(async (context: Context, next) => { diff --git a/packages/app-server/src/modules/app/server.ts b/packages/app-server/src/modules/app/server.ts index e62c27fb..9ddbae89 100644 --- a/packages/app-server/src/modules/app/server.ts +++ b/packages/app-server/src/modules/app/server.ts @@ -1,14 +1,14 @@ +import type { BindableStorageFactory } from '../storage/storage.types'; +import type { Config } from './config/config.types'; +import type { ServerInstanceGenerics } from './server.types'; import { Hono } from 'hono'; import { secureHeaders } from 'hono/secure-headers'; import { registerNotesRoutes } from '../notes/notes.routes'; -import type { BindableStorageFactory } from '../storage/storage.types'; -import type { ServerInstanceGenerics } from './server.types'; -import { corsMiddleware } from './middlewares/cors.middleware'; import { createConfigMiddleware } from './middlewares/config.middleware'; -import { loggerMiddleware } from './middlewares/logger.middleware'; +import { corsMiddleware } from './middlewares/cors.middleware'; import { registerErrorMiddleware } from './middlewares/errors.middleware'; +import { loggerMiddleware } from './middlewares/logger.middleware'; import { createStorageMiddleware } from './middlewares/storage.middleware'; -import type { Config } from './config/config.types'; import { timeoutMiddleware } from './middlewares/timeout.middleware'; export { createServer }; diff --git a/packages/app-server/src/modules/notes/e2e/create-and-view-note.e2e.test.ts b/packages/app-server/src/modules/notes/e2e/create-and-view-note.e2e.test.ts index 73d1b9a3..f3f166c2 100644 --- a/packages/app-server/src/modules/notes/e2e/create-and-view-note.e2e.test.ts +++ b/packages/app-server/src/modules/notes/e2e/create-and-view-note.e2e.test.ts @@ -1,5 +1,5 @@ -import { describe, expect, test } from 'vitest'; import { omit } from 'lodash-es'; +import { describe, expect, test } from 'vitest'; import { createServer } from '../../app/server'; import { createMemoryStorage } from '../../storage/factories/memory.storage'; diff --git a/packages/app-server/src/modules/notes/e2e/size-limited-note-cration.e2e.test.ts b/packages/app-server/src/modules/notes/e2e/size-limited-note-cration.e2e.test.ts index dff77242..2e47188e 100644 --- a/packages/app-server/src/modules/notes/e2e/size-limited-note-cration.e2e.test.ts +++ b/packages/app-server/src/modules/notes/e2e/size-limited-note-cration.e2e.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test } from 'vitest'; +import { overrideConfig } from '../../app/config/config.test-utils'; import { createServer } from '../../app/server'; import { createMemoryStorage } from '../../storage/factories/memory.storage'; -import { overrideConfig } from '../../app/config/config.test-utils'; describe('e2e', () => { describe('body limit note creation', async () => { diff --git a/packages/app-server/src/modules/notes/notes.models.ts b/packages/app-server/src/modules/notes/notes.models.ts index b8bc7ceb..0028ff71 100644 --- a/packages/app-server/src/modules/notes/notes.models.ts +++ b/packages/app-server/src/modules/notes/notes.models.ts @@ -1,8 +1,8 @@ +import type { StoredNote } from './notes.types'; import { addSeconds, isBefore, isEqual } from 'date-fns'; import { omit } from 'lodash-es'; -import type { StoredNote } from './notes.types'; -export { isNoteExpired, formatNoteForApi, getNoteExpirationDate }; +export { formatNoteForApi, getNoteExpirationDate, isNoteExpired }; function isNoteExpired({ note, now = new Date() }: { note: { expirationDate: Date }; now?: Date }) { return isBefore(note.expirationDate, now) || isEqual(note.expirationDate, now); diff --git a/packages/app-server/src/modules/notes/notes.repository.test.ts b/packages/app-server/src/modules/notes/notes.repository.test.ts index 0e65de59..c2925aa7 100644 --- a/packages/app-server/src/modules/notes/notes.repository.test.ts +++ b/packages/app-server/src/modules/notes/notes.repository.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test } from 'vitest'; import { createMemoryStorage } from '../storage/factories/memory.storage'; -import { createNoteRepository } from './notes.repository'; import { createNoteNotFoundError } from './notes.errors'; +import { createNoteRepository } from './notes.repository'; describe('notes repository', () => { describe('getNoteById', () => { diff --git a/packages/app-server/src/modules/notes/notes.repository.ts b/packages/app-server/src/modules/notes/notes.repository.ts index f4b3362a..c22ce196 100644 --- a/packages/app-server/src/modules/notes/notes.repository.ts +++ b/packages/app-server/src/modules/notes/notes.repository.ts @@ -1,9 +1,9 @@ -import { injectArguments } from '@corentinth/chisels'; import type { Storage } from '../storage/storage.types'; +import type { StoredNote } from './notes.types'; +import { injectArguments } from '@corentinth/chisels'; import { generateId } from '../shared/utils/random'; import { createNoteNotFoundError } from './notes.errors'; import { getNoteExpirationDate } from './notes.models'; -import type { StoredNote } from './notes.types'; export { createNoteRepository }; diff --git a/packages/app-server/src/modules/notes/notes.routes.ts b/packages/app-server/src/modules/notes/notes.routes.ts index b22222c7..6936c644 100644 --- a/packages/app-server/src/modules/notes/notes.routes.ts +++ b/packages/app-server/src/modules/notes/notes.routes.ts @@ -1,12 +1,12 @@ -import { z } from 'zod'; -import { encryptionAlgorithms, serializationFormats } from '@enclosed/lib'; import type { ServerInstance } from '../app/server.types'; +import { encryptionAlgorithms, serializationFormats } from '@enclosed/lib'; +import { z } from 'zod'; import { validateJsonBody } from '../shared/validation/validation'; -import { createNoteRepository } from './notes.repository'; import { ONE_MONTH_IN_SECONDS, TEN_MINUTES_IN_SECONDS } from './notes.constants'; -import { getRefreshedNote } from './notes.usecases'; import { createNotePayloadTooLargeError } from './notes.errors'; import { formatNoteForApi } from './notes.models'; +import { createNoteRepository } from './notes.repository'; +import { getRefreshedNote } from './notes.usecases'; export { registerNotesRoutes }; diff --git a/packages/app-server/src/modules/notes/notes.usecases.test.ts b/packages/app-server/src/modules/notes/notes.usecases.test.ts index 35a37d77..75eebb29 100644 --- a/packages/app-server/src/modules/notes/notes.usecases.test.ts +++ b/packages/app-server/src/modules/notes/notes.usecases.test.ts @@ -1,8 +1,8 @@ import { describe, expect, test } from 'vitest'; import { createMemoryStorage } from '../storage/factories/memory.storage'; -import { getRefreshedNote } from './notes.usecases'; -import { createNoteRepository } from './notes.repository'; import { createNoteNotFoundError } from './notes.errors'; +import { createNoteRepository } from './notes.repository'; +import { getRefreshedNote } from './notes.usecases'; describe('notes usecases', () => { describe('getRefreshedNote', () => { diff --git a/packages/app-server/src/modules/notes/notes.usecases.ts b/packages/app-server/src/modules/notes/notes.usecases.ts index 0ea095f8..e81de2eb 100644 --- a/packages/app-server/src/modules/notes/notes.usecases.ts +++ b/packages/app-server/src/modules/notes/notes.usecases.ts @@ -1,6 +1,6 @@ +import type { NotesRepository } from './notes.types'; import { createNoteNotFoundError } from './notes.errors'; import { isNoteExpired } from './notes.models'; -import type { NotesRepository } from './notes.types'; export { getRefreshedNote }; diff --git a/packages/app-server/src/modules/notes/tasks/delete-expired-notes.tasks.test.ts b/packages/app-server/src/modules/notes/tasks/delete-expired-notes.tasks.test.ts index 02aa3a99..977fe3d8 100644 --- a/packages/app-server/src/modules/notes/tasks/delete-expired-notes.tasks.test.ts +++ b/packages/app-server/src/modules/notes/tasks/delete-expired-notes.tasks.test.ts @@ -1,8 +1,8 @@ -import { describe, expect, test } from 'vitest'; import type { Config } from '../../app/config/config.types'; +import { describe, expect, test } from 'vitest'; import { createTestLogger } from '../../shared/logger/logger.test-utils'; -import { createNoteNotFoundError } from '../notes.errors'; import { createMemoryStorage } from '../../storage/factories/memory.storage'; +import { createNoteNotFoundError } from '../notes.errors'; import { deleteExpiredNotesTask } from './delete-expired-notes.tasks'; describe('delete-expired-notes tasks', () => { diff --git a/packages/app-server/src/modules/shared/validation/validation.ts b/packages/app-server/src/modules/shared/validation/validation.ts index 3a19367a..8c005a0e 100644 --- a/packages/app-server/src/modules/shared/validation/validation.ts +++ b/packages/app-server/src/modules/shared/validation/validation.ts @@ -1,6 +1,6 @@ import type { ValidationTargets } from 'hono'; -import { validator } from 'hono/validator'; import type z from 'zod'; +import { validator } from 'hono/validator'; function formatValidationError({ error }: { error: z.ZodError }) { const details = (error.errors ?? []).map((e) => { diff --git a/packages/app-server/src/modules/storage/factories/cloudflare-kv.storage.ts b/packages/app-server/src/modules/storage/factories/cloudflare-kv.storage.ts index c9248c04..abfe179f 100644 --- a/packages/app-server/src/modules/storage/factories/cloudflare-kv.storage.ts +++ b/packages/app-server/src/modules/storage/factories/cloudflare-kv.storage.ts @@ -1,8 +1,8 @@ import type { Driver } from 'unstorage'; import { createStorage } from 'unstorage'; import cloudflareKVBindingDriver from 'unstorage/drivers/cloudflare-kv-binding'; -import { defineBindableStorageFactory } from '../storage.models'; import { createError } from '../../shared/errors/errors'; +import { defineBindableStorageFactory } from '../storage.models'; export const createCloudflareKVStorageFactory = defineBindableStorageFactory(() => { return { diff --git a/packages/app-server/src/modules/storage/factories/fs-lite.storage.ts b/packages/app-server/src/modules/storage/factories/fs-lite.storage.ts index 11f740b1..0a13ff78 100644 --- a/packages/app-server/src/modules/storage/factories/fs-lite.storage.ts +++ b/packages/app-server/src/modules/storage/factories/fs-lite.storage.ts @@ -1,6 +1,6 @@ -import fsLiteDriver from 'unstorage/drivers/fs-lite'; -import { createStorage } from 'unstorage'; import type { Config } from '../../app/config/config.types'; +import { createStorage } from 'unstorage'; +import fsLiteDriver from 'unstorage/drivers/fs-lite'; import { defineStorage } from '../storage.models'; export const createFsLiteStorage = defineStorage(({ config }: { config: Config }) => { diff --git a/packages/app-server/src/modules/storage/storage.models.ts b/packages/app-server/src/modules/storage/storage.models.ts index 20294e96..5cca3784 100644 --- a/packages/app-server/src/modules/storage/storage.models.ts +++ b/packages/app-server/src/modules/storage/storage.models.ts @@ -1,6 +1,6 @@ import type { BindableStorageFactory, Storage } from './storage.types'; -export { defineStorage, defineBindableStorageFactory }; +export { defineBindableStorageFactory, defineStorage }; function defineStorage(fn: (args: InitialsArgs) => { storage: Storage }) { return fn; diff --git a/packages/app-server/src/modules/tasks/task-scheduler.ts b/packages/app-server/src/modules/tasks/task-scheduler.ts index d6feda1b..36b9ea7b 100644 --- a/packages/app-server/src/modules/tasks/task-scheduler.ts +++ b/packages/app-server/src/modules/tasks/task-scheduler.ts @@ -1,8 +1,8 @@ -import cron from 'node-cron'; -import type { Storage } from '../storage/storage.types'; import type { Config } from '../app/config/config.types'; -import { createLogger } from '../shared/logger/logger'; +import type { Storage } from '../storage/storage.types'; import type { TaskDefinition } from './tasks.types'; +import cron from 'node-cron'; +import { createLogger } from '../shared/logger/logger'; export { createTaskScheduler }; diff --git a/packages/app-server/src/modules/tasks/tasks.models.ts b/packages/app-server/src/modules/tasks/tasks.models.ts index 7ba46366..7094fd41 100644 --- a/packages/app-server/src/modules/tasks/tasks.models.ts +++ b/packages/app-server/src/modules/tasks/tasks.models.ts @@ -1,8 +1,8 @@ -import { isFunction } from 'lodash-es'; -import type { Storage } from '../storage/storage.types'; import type { Config } from '../app/config/config.types'; -import { createLogger } from '../shared/logger/logger'; import type { Logger } from '../shared/logger/logger.types'; +import type { Storage } from '../storage/storage.types'; +import { isFunction } from 'lodash-es'; +import { createLogger } from '../shared/logger/logger'; export { defineTask }; diff --git a/packages/app-server/src/scripts/clear-outdated-cloudflare-kv-keys.script.ts b/packages/app-server/src/scripts/clear-outdated-cloudflare-kv-keys.script.ts index 303e2676..b24b2159 100644 --- a/packages/app-server/src/scripts/clear-outdated-cloudflare-kv-keys.script.ts +++ b/packages/app-server/src/scripts/clear-outdated-cloudflare-kv-keys.script.ts @@ -1,7 +1,7 @@ /* eslint-disable no-console */ import process from 'node:process'; -import { $, minimist } from 'zx'; import { isNil, map } from 'lodash-es'; +import { $, minimist } from 'zx'; import { isNoteExpired } from '../modules/notes/notes.models'; const { namespaceId } = minimist(process.argv.slice(2), { diff --git a/packages/app-server/src/scripts/generate-config-table.script.ts b/packages/app-server/src/scripts/generate-config-table.script.ts index c03850cb..f3e286ac 100644 --- a/packages/app-server/src/scripts/generate-config-table.script.ts +++ b/packages/app-server/src/scripts/generate-config-table.script.ts @@ -1,6 +1,6 @@ /* eslint-disable no-console */ -import { isArray, isEmpty, isNil } from 'lodash-es'; import type { ConfigDefinition, ConfigDefinitionElement } from 'figue'; +import { isArray, isEmpty, isNil } from 'lodash-es'; import { fs } from 'zx'; import { configDefinition } from '../modules/app/config/config'; diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index a8208698..5845d180 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -1,6 +1,6 @@ import { defineCommand, runMain } from 'citty'; -import { createNoteCommand } from './create-note/create-note.command'; import { configCommand } from './config/config.command'; +import { createNoteCommand } from './create-note/create-note.command'; import { viewNoteCommand } from './view-note/view-note.command'; const main = defineCommand({ diff --git a/packages/cli/src/config/config.models.ts b/packages/cli/src/config/config.models.ts index 7e2d9465..d52860fe 100644 --- a/packages/cli/src/config/config.models.ts +++ b/packages/cli/src/config/config.models.ts @@ -2,7 +2,7 @@ import Conf from 'conf'; import picocolors from 'picocolors'; import { configDefinition } from './config.constants'; -export { createConfigBindings, setConfig, getConfig, deleteConfig, resetConfig }; +export { createConfigBindings, deleteConfig, getConfig, resetConfig, setConfig }; type ConfigKey = keyof typeof configDefinition | (string & {}); const config = new Conf>({ projectName: 'enclosed' }); diff --git a/packages/cli/src/create-note/create-note.command.ts b/packages/cli/src/create-note/create-note.command.ts index bd4ad8a5..1474d6bc 100644 --- a/packages/cli/src/create-note/create-note.command.ts +++ b/packages/cli/src/create-note/create-note.command.ts @@ -1,10 +1,10 @@ -import { defineCommand, showUsage } from 'citty'; import { createNote } from '@enclosed/lib'; +import { defineCommand, showUsage } from 'citty'; import ora from 'ora'; import pc from 'picocolors'; -import { looksLikeRateLimitError } from '../shared/http.models'; -import { readFromStdin } from '../shared/cli.models'; import { getInstanceUrl } from '../config/config.usecases'; +import { readFromStdin } from '../shared/cli.models'; +import { looksLikeRateLimitError } from '../shared/http.models'; const ONE_HOUR_IN_SECONDS = 60 * 60; diff --git a/packages/cli/src/view-note/view-note.command.ts b/packages/cli/src/view-note/view-note.command.ts index 0dfe1cd1..aac2c632 100644 --- a/packages/cli/src/view-note/view-note.command.ts +++ b/packages/cli/src/view-note/view-note.command.ts @@ -1,5 +1,5 @@ -import { defineCommand } from 'citty'; import { decryptNote, fetchNote, isApiClientErrorWithStatusCode, parseNoteUrl } from '@enclosed/lib'; +import { defineCommand } from 'citty'; import picocolors from 'picocolors'; import { getInstanceUrl } from '../config/config.usecases'; import { promptForPassword } from './view-note.models'; diff --git a/packages/lib/src/api/api.models.ts b/packages/lib/src/api/api.models.ts index ed788f17..aa41c142 100644 --- a/packages/lib/src/api/api.models.ts +++ b/packages/lib/src/api/api.models.ts @@ -1,6 +1,6 @@ import { get, isError } from 'lodash-es'; -export { isApiClientErrorWithStatusCode, isApiClientErrorWithCode }; +export { isApiClientErrorWithCode, isApiClientErrorWithStatusCode }; function isApiClientErrorWithStatusCode({ error, statusCode }: { error: unknown; statusCode: number }): boolean { if (!isError(error)) { diff --git a/packages/lib/src/crypto/crypto.usecases.ts b/packages/lib/src/crypto/crypto.usecases.ts index c8e935b3..4a4d3dd9 100644 --- a/packages/lib/src/crypto/crypto.usecases.ts +++ b/packages/lib/src/crypto/crypto.usecases.ts @@ -1,10 +1,10 @@ import type { NoteAsset } from '../notes/notes.types'; import type { EncryptionAlgorithm } from './crypto.types'; -import { getParsingMethod, getSerializationMethod } from './serialization/serialization.registry'; import type { SerializationFormat } from './serialization/serialization.types'; +import { getParsingMethod, getSerializationMethod } from './serialization/serialization.registry'; import { base64UrlToBuffer, bufferToBase64Url } from './web/crypto.web.models'; -export { createEncryptUsecase, createDecryptUsecase }; +export { createDecryptUsecase, createEncryptUsecase }; function createEncryptUsecase({ generateBaseKey, diff --git a/packages/lib/src/crypto/encryption-algorithms/encryption-algorithms.registry.ts b/packages/lib/src/crypto/encryption-algorithms/encryption-algorithms.registry.ts index ea02516c..288bcb92 100644 --- a/packages/lib/src/crypto/encryption-algorithms/encryption-algorithms.registry.ts +++ b/packages/lib/src/crypto/encryption-algorithms/encryption-algorithms.registry.ts @@ -1,5 +1,5 @@ -import { keyBy } from 'lodash-es'; import type { EncryptionMethodsDefinition } from './encryption-algorithms.types'; +import { keyBy } from 'lodash-es'; export { createEncryptionAlgorithmsRegistry }; diff --git a/packages/lib/src/crypto/node/crypto.node.models.ts b/packages/lib/src/crypto/node/crypto.node.models.ts index 79bcc1f7..d26b1f6c 100644 --- a/packages/lib/src/crypto/node/crypto.node.models.ts +++ b/packages/lib/src/crypto/node/crypto.node.models.ts @@ -1,6 +1,6 @@ import { Buffer } from 'node:buffer'; -export { bufferToBase64Url, base64UrlToBuffer }; +export { base64UrlToBuffer, bufferToBase64Url }; function bufferToBase64Url({ buffer }: { buffer: Uint8Array }): string { const base64Url = Buffer.from(buffer).toString('base64url'); diff --git a/packages/lib/src/crypto/node/crypto.node.usecases.ts b/packages/lib/src/crypto/node/crypto.node.usecases.ts index 5ef02e1c..c1e0b38d 100644 --- a/packages/lib/src/crypto/node/crypto.node.usecases.ts +++ b/packages/lib/src/crypto/node/crypto.node.usecases.ts @@ -1,9 +1,9 @@ import { pbkdf2, randomBytes } from 'node:crypto'; -import { TextEncoder, promisify } from 'node:util'; +import { promisify, TextEncoder } from 'node:util'; -export { getEncryptionMethod, getDecryptionMethod } from './encryption-algorithms/encryption-algorithms.registry'; +export { getDecryptionMethod, getEncryptionMethod } from './encryption-algorithms/encryption-algorithms.registry'; -export { generateBaseKey, deriveMasterKey, createRandomBuffer }; +export { createRandomBuffer, deriveMasterKey, generateBaseKey }; const deriveWithPbkdf2 = promisify(pbkdf2); diff --git a/packages/lib/src/crypto/serialization/cbor-array/cbor-array.serialization.ts b/packages/lib/src/crypto/serialization/cbor-array/cbor-array.serialization.ts index a0aa8779..26598756 100644 --- a/packages/lib/src/crypto/serialization/cbor-array/cbor-array.serialization.ts +++ b/packages/lib/src/crypto/serialization/cbor-array/cbor-array.serialization.ts @@ -1,5 +1,5 @@ -import { decode, encode } from 'cbor-x'; import type { Note } from '../../../notes/notes.types'; +import { decode, encode } from 'cbor-x'; import { defineSerializationMethods } from '../serialization.models'; export const cborArraySerializationDefinition = defineSerializationMethods({ diff --git a/packages/lib/src/crypto/serialization/serialization.registry.ts b/packages/lib/src/crypto/serialization/serialization.registry.ts index 4d05c2ec..da3374ec 100644 --- a/packages/lib/src/crypto/serialization/serialization.registry.ts +++ b/packages/lib/src/crypto/serialization/serialization.registry.ts @@ -1,8 +1,8 @@ +import type { SerializationFormat, SerializationMethodsDefinition } from './serialization.types'; import { keyBy, map } from 'lodash-es'; import { cborArraySerializationDefinition } from './cbor-array/cbor-array.serialization'; -import type { SerializationFormat, SerializationMethodsDefinition } from './serialization.types'; -export { getSerializationMethod, getParsingMethod }; +export { getParsingMethod, getSerializationMethod }; export const serializationMethodDefinitions = [ cborArraySerializationDefinition, diff --git a/packages/lib/src/crypto/serialization/serialization.test-utils.ts b/packages/lib/src/crypto/serialization/serialization.test-utils.ts index 2891f7ca..066e3f9b 100644 --- a/packages/lib/src/crypto/serialization/serialization.test-utils.ts +++ b/packages/lib/src/crypto/serialization/serialization.test-utils.ts @@ -1,5 +1,5 @@ -import { describe, expect, test } from 'vitest'; import type { Note } from '../../notes/notes.types'; +import { describe, expect, test } from 'vitest'; export { runCommonSerializationTests }; diff --git a/packages/lib/src/crypto/web/crypto.web.models.ts b/packages/lib/src/crypto/web/crypto.web.models.ts index 4ce1753b..8b565b3e 100644 --- a/packages/lib/src/crypto/web/crypto.web.models.ts +++ b/packages/lib/src/crypto/web/crypto.web.models.ts @@ -1,4 +1,4 @@ -export { bufferToBase64Url, base64UrlToBuffer }; +export { base64UrlToBuffer, bufferToBase64Url }; function bufferToBase64Url({ buffer }: { buffer: Uint8Array }): string { let binaryString = ''; diff --git a/packages/lib/src/crypto/web/crypto.web.usecases.ts b/packages/lib/src/crypto/web/crypto.web.usecases.ts index 97e0cf93..a6635d18 100644 --- a/packages/lib/src/crypto/web/crypto.web.usecases.ts +++ b/packages/lib/src/crypto/web/crypto.web.usecases.ts @@ -1,6 +1,6 @@ -export { generateBaseKey, deriveMasterKey, createRandomBuffer }; +export { createRandomBuffer, deriveMasterKey, generateBaseKey }; -export { getEncryptionMethod, getDecryptionMethod } from './encryption-algorithms/encryption-algorithms.registry'; +export { getDecryptionMethod, getEncryptionMethod } from './encryption-algorithms/encryption-algorithms.registry'; function createRandomBuffer({ length = 16 }: { length?: number } = {}): Uint8Array { const randomValues = new Uint8Array(length); diff --git a/packages/lib/src/files/files.models.ts b/packages/lib/src/files/files.models.ts index 90f5521b..1c61045a 100644 --- a/packages/lib/src/files/files.models.ts +++ b/packages/lib/src/files/files.models.ts @@ -1,7 +1,7 @@ -import { get } from 'lodash-es'; import type { NoteAsset } from '../notes/notes.types'; +import { get } from 'lodash-es'; -export { fileToNoteAsset, filesToNoteAssets, noteAssetToFile, noteAssetsToFiles }; +export { filesToNoteAssets, fileToNoteAsset, noteAssetsToFiles, noteAssetToFile }; async function fileToNoteAsset({ file }: { file: File }): Promise { const content = new Uint8Array(await file.arrayBuffer()); diff --git a/packages/lib/src/index.node.ts b/packages/lib/src/index.node.ts index a86844dd..c9f2c233 100644 --- a/packages/lib/src/index.node.ts +++ b/packages/lib/src/index.node.ts @@ -1,12 +1,12 @@ -import { createEnclosedLib } from './notes/notes.usecases'; -import { deriveMasterKey, generateBaseKey } from './crypto/node/crypto.node.usecases'; -import { fetchNote, storeNote } from './notes/notes.services'; -import { createDecryptUsecase, createEncryptUsecase } from './crypto/crypto.usecases'; import { isApiClientErrorWithCode, isApiClientErrorWithStatusCode } from './api/api.models'; -import { fileToNoteAsset, filesToNoteAssets, noteAssetToFile, noteAssetsToFiles } from './files/files.models'; +import { createDecryptUsecase, createEncryptUsecase } from './crypto/crypto.usecases'; +import { deriveMasterKey, generateBaseKey } from './crypto/node/crypto.node.usecases'; import { encryptionAlgorithms, getDecryptionMethod, getEncryptionMethod } from './crypto/node/encryption-algorithms/encryption-algorithms.registry'; import { serializationFormats } from './crypto/serialization/serialization.registry'; +import { filesToNoteAssets, fileToNoteAsset, noteAssetsToFiles, noteAssetToFile } from './files/files.models'; import { createNoteUrlHashFragment, parseNoteUrlHashFragment } from './notes/notes.models'; +import { fetchNote, storeNote } from './notes/notes.services'; +import { createEnclosedLib } from './notes/notes.usecases'; const { encryptNote } = createEncryptUsecase({ generateBaseKey, deriveMasterKey, getEncryptionMethod }); const { decryptNote } = createDecryptUsecase({ deriveMasterKey, getDecryptionMethod }); @@ -14,21 +14,21 @@ const { decryptNote } = createDecryptUsecase({ deriveMasterKey, getDecryptionMet const { createNote, createNoteUrl, parseNoteUrl } = createEnclosedLib({ encryptNote, storeNote }); export { + createNote, + createNoteUrl, + createNoteUrlHashFragment, + decryptNote, + encryptionAlgorithms, + encryptNote, fetchNote, - storeNote, - isApiClientErrorWithStatusCode, - isApiClientErrorWithCode, - fileToNoteAsset, filesToNoteAssets, - noteAssetToFile, + fileToNoteAsset, + isApiClientErrorWithCode, + isApiClientErrorWithStatusCode, noteAssetsToFiles, - encryptNote, - decryptNote, - createNote, - createNoteUrl, + noteAssetToFile, parseNoteUrl, - serializationFormats, - encryptionAlgorithms, parseNoteUrlHashFragment, - createNoteUrlHashFragment, + serializationFormats, + storeNote, }; diff --git a/packages/lib/src/index.web.ts b/packages/lib/src/index.web.ts index 4812cab1..d8d286b2 100644 --- a/packages/lib/src/index.web.ts +++ b/packages/lib/src/index.web.ts @@ -1,12 +1,12 @@ -import { createEnclosedLib } from './notes/notes.usecases'; -import { deriveMasterKey, generateBaseKey } from './crypto/web/crypto.web.usecases'; -import { fetchNote, storeNote } from './notes/notes.services'; -import { createDecryptUsecase, createEncryptUsecase } from './crypto/crypto.usecases'; import { isApiClientErrorWithCode, isApiClientErrorWithStatusCode } from './api/api.models'; -import { fileToNoteAsset, filesToNoteAssets, noteAssetToFile, noteAssetsToFiles } from './files/files.models'; -import { encryptionAlgorithms, getDecryptionMethod, getEncryptionMethod } from './crypto/web/encryption-algorithms/encryption-algorithms.registry'; +import { createDecryptUsecase, createEncryptUsecase } from './crypto/crypto.usecases'; import { serializationFormats } from './crypto/serialization/serialization.registry'; +import { deriveMasterKey, generateBaseKey } from './crypto/web/crypto.web.usecases'; +import { encryptionAlgorithms, getDecryptionMethod, getEncryptionMethod } from './crypto/web/encryption-algorithms/encryption-algorithms.registry'; +import { filesToNoteAssets, fileToNoteAsset, noteAssetsToFiles, noteAssetToFile } from './files/files.models'; import { createNoteUrlHashFragment, parseNoteUrlHashFragment } from './notes/notes.models'; +import { fetchNote, storeNote } from './notes/notes.services'; +import { createEnclosedLib } from './notes/notes.usecases'; const { encryptNote } = createEncryptUsecase({ generateBaseKey, deriveMasterKey, getEncryptionMethod }); const { decryptNote } = createDecryptUsecase({ deriveMasterKey, getDecryptionMethod }); @@ -14,21 +14,21 @@ const { decryptNote } = createDecryptUsecase({ deriveMasterKey, getDecryptionMet const { createNote, createNoteUrl, parseNoteUrl } = createEnclosedLib({ encryptNote, storeNote }); export { + createNote, + createNoteUrl, + createNoteUrlHashFragment, + decryptNote, + encryptionAlgorithms, + encryptNote, fetchNote, - storeNote, - isApiClientErrorWithStatusCode, - isApiClientErrorWithCode, - fileToNoteAsset, filesToNoteAssets, - noteAssetToFile, + fileToNoteAsset, + isApiClientErrorWithCode, + isApiClientErrorWithStatusCode, noteAssetsToFiles, - encryptNote, - decryptNote, - createNote, - createNoteUrl, + noteAssetToFile, parseNoteUrl, - serializationFormats, - encryptionAlgorithms, parseNoteUrlHashFragment, - createNoteUrlHashFragment, + serializationFormats, + storeNote, }; diff --git a/packages/lib/src/notes/notes.models.ts b/packages/lib/src/notes/notes.models.ts index 40aaedd6..f3ac5088 100644 --- a/packages/lib/src/notes/notes.models.ts +++ b/packages/lib/src/notes/notes.models.ts @@ -1,6 +1,6 @@ import { isEmpty } from 'lodash-es'; -export { createNoteUrl, parseNoteUrl, createNoteUrlHashFragment, parseNoteUrlHashFragment }; +export { createNoteUrl, createNoteUrlHashFragment, parseNoteUrl, parseNoteUrlHashFragment }; function createNoteUrlHashFragment({ encryptionKey, isPasswordProtected }: { encryptionKey: string; isPasswordProtected?: boolean }) { const hashFragment = [ diff --git a/packages/lib/src/notes/notes.services.ts b/packages/lib/src/notes/notes.services.ts index d986eb82..d85d555c 100644 --- a/packages/lib/src/notes/notes.services.ts +++ b/packages/lib/src/notes/notes.services.ts @@ -1,6 +1,6 @@ import { apiClient } from '../api/api.client'; -export { storeNote, fetchNote }; +export { fetchNote, storeNote }; async function storeNote({ payload, diff --git a/packages/lib/src/notes/notes.usecases.ts b/packages/lib/src/notes/notes.usecases.ts index c224ab0a..6d39c50b 100644 --- a/packages/lib/src/notes/notes.usecases.ts +++ b/packages/lib/src/notes/notes.usecases.ts @@ -1,7 +1,7 @@ import type { EncryptionAlgorithm } from '../crypto/crypto.types'; import type { SerializationFormat } from '../crypto/serialization/serialization.types'; -import { createNoteUrl as createNoteUrlImpl, parseNoteUrl } from './notes.models'; import type { NoteAsset } from './notes.types'; +import { createNoteUrl as createNoteUrlImpl, parseNoteUrl } from './notes.models'; export { createEnclosedLib };