Extract persisted into a shared library

This commit is contained in:
Caleb Owens 2024-10-11 11:55:07 +02:00
parent 902b6526bf
commit 316dd8d2b6
19 changed files with 18 additions and 18 deletions

View File

@ -4,7 +4,7 @@ import {
LONG_DEFAULT_COMMIT_TEMPLATE,
SHORT_DEFAULT_COMMIT_TEMPLATE
} from '$lib/ai/prompts';
import { persisted, type Persisted } from '$lib/persisted/persisted';
import { persisted, type Persisted } from '@gitbutler/shared/persisted';
import { get } from 'svelte/store';
import type { Prompt, Prompts, UserPrompt } from '$lib/ai/types';

View File

@ -1,6 +1,6 @@
import { isStr } from '$lib/utils/string';
import type { Persisted } from '$lib/persisted/persisted';
import type { Result } from '$lib/result';
import type { Persisted } from '@gitbutler/shared/persisted';
export enum ModelKind {
OpenAI = 'openai',

View File

@ -1,7 +1,7 @@
import { invoke } from '$lib/backend/ipc';
import { showError } from '$lib/notifications/toasts';
import { persisted } from '$lib/persisted/persisted';
import * as toasts from '$lib/utils/toasts';
import { persisted } from '@gitbutler/shared/persisted';
import { open } from '@tauri-apps/api/dialog';
import { plainToInstance } from 'class-transformer';
import { get, writable } from 'svelte/store';

View File

@ -16,7 +16,6 @@
import { getGitHostListingService } from '$lib/gitHost/interface/gitHostListingService';
import { getGitHostPrMonitor } from '$lib/gitHost/interface/gitHostPrMonitor';
import { showError } from '$lib/notifications/toasts';
import { persisted } from '$lib/persisted/persisted';
import { isFailure } from '$lib/result';
import ScrollableContainer from '$lib/scroll/ScrollableContainer.svelte';
import { SETTINGS, type Settings } from '$lib/settings/userSettings';
@ -32,6 +31,7 @@
import { FileIdSelection } from '$lib/vbranches/fileIdSelection';
import { VirtualBranch } from '$lib/vbranches/types';
import { getContext, getContextStore, getContextStoreBySymbol } from '@gitbutler/shared/context';
import { persisted } from '@gitbutler/shared/persisted';
import Button from '@gitbutler/ui/Button.svelte';
import EmptyStatePlaceholder from '@gitbutler/ui/EmptyStatePlaceholder.svelte';
import lscache from 'lscache';

View File

@ -13,7 +13,7 @@
import { getContext, getContextStore } from '@gitbutler/shared/context';
import Button from '@gitbutler/ui/Button.svelte';
import Icon from '@gitbutler/ui/Icon.svelte';
import type { Persisted } from '$lib/persisted/persisted';
import type { Persisted } from '@gitbutler/shared/persisted';
interface Props {
uncommittedChanges?: number;

View File

@ -9,7 +9,6 @@
import { getGitHostListingService } from '$lib/gitHost/interface/gitHostListingService';
import { createGitHostPrMonitorStore } from '$lib/gitHost/interface/gitHostPrMonitor';
import { createGitHostPrServiceStore } from '$lib/gitHost/interface/gitHostPrService';
import { persisted } from '$lib/persisted/persisted';
import { SETTINGS, type Settings } from '$lib/settings/userSettings';
import Resizer from '$lib/shared/Resizer.svelte';
import Stack from '$lib/stack/Stack.svelte';
@ -27,6 +26,7 @@
getContextStoreBySymbol,
createContextStore
} from '@gitbutler/shared/context';
import { persisted } from '@gitbutler/shared/persisted';
import lscache from 'lscache';
import { setContext } from 'svelte';
import { quintOut } from 'svelte/easing';

View File

@ -8,8 +8,8 @@ import {
getEntryWorkspaceStatus,
type SidebarEntrySubject
} from '$lib/navigation/types';
import { persisted, type Persisted } from '$lib/persisted/persisted';
import { debouncedDerive } from '$lib/utils/debounce';
import { persisted, type Persisted } from '@gitbutler/shared/persisted';
import { Transform, Type, plainToInstance } from 'class-transformer';
import Fuse from 'fuse.js';
import { derived, readable, writable, type Readable, type Writable } from 'svelte/store';

View File

@ -5,7 +5,7 @@
import SelectItem from '$lib/select/SelectItem.svelte';
import { getContext } from '@gitbutler/shared/context';
import type { Prompts, UserPrompt } from '$lib/ai/types';
import type { Persisted } from '$lib/persisted/persisted';
import type { Persisted } from '@gitbutler/shared/persisted';
export let promptUse: 'commits' | 'branches';

View File

@ -1,4 +1,4 @@
import { persisted, type Persisted } from '$lib/persisted/persisted';
import { persisted, type Persisted } from '@gitbutler/shared/persisted';
export function projectHttpsWarningBannerDismissed(projectId: string): Persisted<boolean> {
const key = 'projectHttpsWarningBannerDismissed_';

View File

@ -4,7 +4,7 @@
*
* @module appSettings
*/
import { persisted, type Persisted } from '$lib/persisted/persisted';
import { persisted, type Persisted } from '@gitbutler/shared/persisted';
export function featureBaseBranchSwitching(): Persisted<boolean> {
const key = 'featureBaseBranchSwitching';

View File

@ -1,6 +1,6 @@
<script lang="ts">
import { ProjectMetrics, type ProjectMetricsReport } from './projectMetrics';
import { persisted } from '$lib/persisted/persisted';
import { persisted } from '@gitbutler/shared/persisted';
import posthog from 'posthog-js';
import { onMount } from 'svelte';

View File

@ -10,11 +10,11 @@
import { ModeService } from '$lib/modes/service';
import EditButton from '$lib/navigation/EditButton.svelte';
import TopicsButton from '$lib/navigation/TopicsButton.svelte';
import { persisted } from '$lib/persisted/persisted';
import { platformName } from '$lib/platform/platform';
import { SETTINGS, type Settings } from '$lib/settings/userSettings';
import { createKeybind } from '$lib/utils/hotkeys';
import { getContext, getContextStoreBySymbol } from '@gitbutler/shared/context';
import { persisted } from '@gitbutler/shared/persisted';
import { env } from '$env/dynamic/public';
const minResizerWidth = 280;

View File

@ -1,13 +1,13 @@
<script lang="ts">
import { invoke } from '$lib/backend/ipc';
import { ProjectService } from '$lib/backend/projects';
import { persisted } from '$lib/persisted/persisted';
import Section from '$lib/settings/Section.svelte';
import InfoMessage, { type MessageStyle } from '$lib/shared/InfoMessage.svelte';
import Spacer from '$lib/shared/Spacer.svelte';
import TextBox from '$lib/shared/TextBox.svelte';
import { parseRemoteUrl } from '$lib/url/gitUrl';
import { getContext } from '@gitbutler/shared/context';
import { persisted } from '@gitbutler/shared/persisted';
import Button from '@gitbutler/ui/Button.svelte';
import * as Sentry from '@sentry/sveltekit';
import { open } from '@tauri-apps/api/dialog';

View File

@ -2,8 +2,8 @@
import ContextMenuItem from '$lib/components/contextmenu/ContextMenuItem.svelte';
import ContextMenuSection from '$lib/components/contextmenu/ContextMenuSection.svelte';
import { MergeMethod } from '$lib/gitHost/interface/types';
import { persisted, type Persisted } from '$lib/persisted/persisted';
import DropDownButton from '$lib/shared/DropDownButton.svelte';
import { persisted, type Persisted } from '@gitbutler/shared/persisted';
import { createEventDispatcher } from 'svelte';
export let projectId: string;

View File

@ -1,4 +1,4 @@
import { persisted, type Persisted } from '$lib/persisted/persisted';
import { persisted, type Persisted } from '@gitbutler/shared/persisted';
const PR_DEFAULT_ACTION_KEY_NAME = 'projectDefaultPrAction';

View File

@ -16,7 +16,6 @@
import { getGitHostListingService } from '$lib/gitHost/interface/gitHostListingService';
import { getGitHostPrMonitor } from '$lib/gitHost/interface/gitHostPrMonitor';
import { showError } from '$lib/notifications/toasts';
import { persisted } from '$lib/persisted/persisted';
import { isFailure } from '$lib/result';
import ScrollableContainer from '$lib/scroll/ScrollableContainer.svelte';
import { SETTINGS, type Settings } from '$lib/settings/userSettings';
@ -28,6 +27,7 @@
import { FileIdSelection } from '$lib/vbranches/fileIdSelection';
import { VirtualBranch } from '$lib/vbranches/types';
import { getContext, getContextStore, getContextStoreBySymbol } from '@gitbutler/shared/context';
import { persisted } from '@gitbutler/shared/persisted';
import Button from '@gitbutler/ui/Button.svelte';
import EmptyStatePlaceholder from '@gitbutler/ui/EmptyStatePlaceholder.svelte';
import lscache from 'lscache';

View File

@ -9,7 +9,7 @@
import { getContext, getContextStore } from '@gitbutler/shared/context';
import Button from '@gitbutler/ui/Button.svelte';
import Icon from '@gitbutler/ui/Icon.svelte';
import type { Persisted } from '$lib/persisted/persisted';
import type { Persisted } from '@gitbutler/shared/persisted';
interface Props {
uncommittedChanges?: number;

View File

@ -1,4 +1,4 @@
import { persisted } from '$lib/persisted/persisted';
import { persisted } from '@gitbutler/shared/persisted';
import { get, type Readable } from 'svelte/store';
import type { Project } from '$lib/backend/projects';
import type { GitHostIssueService } from '$lib/gitHost/interface/gitHostIssueService';