Preparing search index...

    Type definition for the RecipeDatabase context value

    Provides access to reactive database state and all database operations. All mutation methods automatically trigger appropriate state refreshes.

    interface RecipeDatabaseContextType {
        recipes: recipeTableElement[];
        addRecipe: (recipe: recipeTableElement) => Promise<void>;
        editRecipe: (recipe: recipeTableElement) => Promise<recipeTableElement>;
        deleteRecipe: (recipe: recipeTableElement) => Promise<boolean>;
        ingredients: ingredientTableElement[];
        addIngredient: (
            ingredient: ingredientTableElement,
        ) => Promise<ingredientTableElement>;
        editIngredient: (ingredient: ingredientTableElement) => Promise<boolean>;
        deleteIngredient: (ingredient: ingredientTableElement) => Promise<boolean>;
        tags: tagTableElement[];
        addTag: (tag: tagTableElement) => Promise<tagTableElement>;
        editTag: (tag: tagTableElement) => Promise<boolean>;
        deleteTag: (tag: tagTableElement) => Promise<boolean>;
        shopping: ComputedShoppingItem[];
        togglePurchased: (ingredientName: string) => Promise<void>;
        clearPurchased: () => Promise<void>;
        menu: menuTableElement[];
        addRecipeToMenu: (recipe: recipeTableElement) => Promise<void>;
        toggleMenuItemCooked: (menuId: number) => Promise<boolean>;
        removeFromMenu: (menuId: number) => Promise<boolean>;
        clearMenu: () => Promise<void>;
        isRecipeInMenu: (recipeId: number) => boolean;
        findSimilarRecipes: (recipe: recipeTableElement) => recipeTableElement[];
        findSimilarIngredients: (
            ingredientName: string,
        ) => ingredientTableElement[];
        findSimilarTags: (tagName: string) => tagTableElement[];
        getRandomIngredients: (
            type: ingredientType,
            count: number,
        ) => ingredientTableElement[];
        getRandomTags: (count: number) => tagTableElement[];
        searchRandomlyTags: (count: number) => tagTableElement[];
        scaleAllRecipesForNewDefaultPersons: (
            newDefaultPersons: number,
        ) => Promise<void>;
        isDatabaseEmpty: () => boolean;
        addMultipleIngredients: (
            ingredients: ingredientTableElement[],
        ) => Promise<void>;
        addMultipleTags: (tags: tagTableElement[]) => Promise<void>;
        addMultipleRecipes: (recipes: recipeTableElement[]) => Promise<void>;
        isDatabaseReady: boolean;
        scalingProgress: undefined | number;
        datasetLoadError: undefined | string;
        dismissDatasetLoadError: () => void;
        getImportedSourceUrls: (providerId: string) => Set<string>;
        getSeenUrls: (providerId: string) => Set<string>;
        markUrlsAsSeen: (providerId: string, urls: string[]) => Promise<void>;
        removeFromSeenHistory: (
            providerId: string,
            urls: string[],
        ) => Promise<void>;
    }
    Index

    Properties

    Current recipes state - reactive, triggers re-renders when changed

    addRecipe: (recipe: recipeTableElement) => Promise<void>

    Adds recipe to database and refreshes recipes state

    editRecipe: (recipe: recipeTableElement) => Promise<recipeTableElement>

    Edits recipe in database and refreshes recipes state

    deleteRecipe: (recipe: recipeTableElement) => Promise<boolean>

    Deletes recipe from database and refreshes recipes state

    ingredients: ingredientTableElement[]

    Current ingredients state - reactive, triggers re-renders when changed

    addIngredient: (
        ingredient: ingredientTableElement,
    ) => Promise<ingredientTableElement>

    Adds ingredient to database and refreshes ingredients state (not recipes)

    editIngredient: (ingredient: ingredientTableElement) => Promise<boolean>

    Edits ingredient in database and refreshes both ingredients AND recipes state

    deleteIngredient: (ingredient: ingredientTableElement) => Promise<boolean>

    Deletes ingredient from database and refreshes both ingredients AND recipes state

    Current tags state - reactive, triggers re-renders when changed

    addTag: (tag: tagTableElement) => Promise<tagTableElement>

    Adds tag to database and refreshes tags state (not recipes)

    editTag: (tag: tagTableElement) => Promise<boolean>

    Edits tag in database and refreshes both tags AND recipes state

    deleteTag: (tag: tagTableElement) => Promise<boolean>

    Deletes tag from database and refreshes both tags AND recipes state

    Computed shopping list from menu - reactive, triggers re-renders when changed

    togglePurchased: (ingredientName: string) => Promise<void>

    Toggles purchase status of ingredient by name

    clearPurchased: () => Promise<void>

    Clears all purchased ingredient states (called when menu is cleared)

    Current menu state - reactive, triggers re-renders when changed

    addRecipeToMenu: (recipe: recipeTableElement) => Promise<void>

    Adds recipe to menu (shopping list auto-computed)

    toggleMenuItemCooked: (menuId: number) => Promise<boolean>

    Toggles cooked status of menu item (shopping list auto-computed)

    removeFromMenu: (menuId: number) => Promise<boolean>

    Removes item from menu (shopping list auto-computed)

    clearMenu: () => Promise<void>

    Clears entire menu and purchased states

    isRecipeInMenu: (recipeId: number) => boolean

    Checks if recipe is in menu

    findSimilarRecipes: (recipe: recipeTableElement) => recipeTableElement[]

    Finds recipes similar to the given recipe using fuzzy matching

    findSimilarIngredients: (ingredientName: string) => ingredientTableElement[]

    Finds ingredients similar to the given name using fuzzy matching

    findSimilarTags: (tagName: string) => tagTableElement[]

    Finds tags similar to the given name using fuzzy matching

    getRandomIngredients: (
        type: ingredientType,
        count: number,
    ) => ingredientTableElement[]

    Returns random ingredients of specified type

    getRandomTags: (count: number) => tagTableElement[]

    Returns random tags

    searchRandomlyTags: (count: number) => tagTableElement[]

    Returns random tags (legacy method)

    scaleAllRecipesForNewDefaultPersons: (
        newDefaultPersons: number,
    ) => Promise<void>

    Scales all recipes to new default persons count and refreshes recipes state

    isDatabaseEmpty: () => boolean

    Checks if database is empty (for first launch detection)

    addMultipleIngredients: (ingredients: ingredientTableElement[]) => Promise<void>

    Adds multiple ingredients to database and refreshes ingredients state

    addMultipleTags: (tags: tagTableElement[]) => Promise<void>

    Adds multiple tags to database and refreshes tags state

    addMultipleRecipes: (recipes: recipeTableElement[]) => Promise<void>

    Adds multiple recipes to database and refreshes recipes state

    isDatabaseReady: boolean

    Indicates whether database data is loaded and ready to use

    scalingProgress: undefined | number

    Current progress of recipe scaling operation (0-100), undefined if not scaling

    datasetLoadError: undefined | string

    Dataset loading error - app is usable but initial recipes won't be loaded

    dismissDatasetLoadError: () => void

    Dismisses the dataset load error notification

    getImportedSourceUrls: (providerId: string) => Set<string>

    Gets URLs that have been imported from a specific provider

    getSeenUrls: (providerId: string) => Set<string>

    Gets URLs that have been seen (but not imported) from a specific provider

    markUrlsAsSeen: (providerId: string, urls: string[]) => Promise<void>

    Marks URLs as seen for a specific provider

    removeFromSeenHistory: (providerId: string, urls: string[]) => Promise<void>

    Removes URLs from seen history for a specific provider