mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 19:41:09 +02:00
refactor(stores): drop remaining \as never\ + \as Record<string,unknown>\ casts
Follow-up to a68933bff. Multi-Terminal commits hatten meinen ersten
Cleanup teilweise verschluckt — dieser Commit räumt die übrig
gebliebenen 22 \`update(id, X as never)\` Casts in den 13 Stores
zusammen mit den letzten \`as Record<string, unknown>\` Argumenten
für \`encryptRecord\` weg. Public API der Stores unverändert,
\`Partial<LocalX>\` reicht für Dexie's UpdateSpec ohne Cast.
7670 svelte-check Files, 0 Errors, 0 Warnings.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
5387681936
commit
1334bd3626
13 changed files with 28 additions and 28 deletions
|
|
@ -98,7 +98,7 @@ export const broadcastCampaignsStore = {
|
|||
}
|
||||
const wrapped = { ...patch } as Record<string, unknown>;
|
||||
await encryptRecord('broadcastCampaigns', wrapped);
|
||||
await campaignTable.update(id, wrapped as never);
|
||||
await campaignTable.update(id, wrapped);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -115,7 +115,7 @@ export const broadcastCampaignsStore = {
|
|||
}
|
||||
const patch = { content } as Record<string, unknown>;
|
||||
await encryptRecord('broadcastCampaigns', patch);
|
||||
await campaignTable.update(id, patch as never);
|
||||
await campaignTable.update(id, patch);
|
||||
},
|
||||
|
||||
async updateAudience(id: string, audience: AudienceDefinition) {
|
||||
|
|
@ -126,7 +126,7 @@ export const broadcastCampaignsStore = {
|
|||
}
|
||||
const patch = { audience } as Record<string, unknown>;
|
||||
await encryptRecord('broadcastCampaigns', patch);
|
||||
await campaignTable.update(id, patch as never);
|
||||
await campaignTable.update(id, patch);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ export const comicCharactersStore = {
|
|||
if (!existing.pinnedVariantId) {
|
||||
patch.pinnedVariantId = variantMediaId;
|
||||
}
|
||||
await comicCharactersTable.update(characterId, patch as never);
|
||||
await comicCharactersTable.update(characterId, patch);
|
||||
emitDomainEvent('ComicCharacterVariantAdded', 'comic', 'comicCharacters', characterId, {
|
||||
characterId,
|
||||
variantMediaId,
|
||||
|
|
@ -123,7 +123,7 @@ export const comicCharactersStore = {
|
|||
if (existing.pinnedVariantId === variantMediaId) {
|
||||
patch.pinnedVariantId = nextIds[0] ?? null;
|
||||
}
|
||||
await comicCharactersTable.update(characterId, patch as never);
|
||||
await comicCharactersTable.update(characterId, patch);
|
||||
},
|
||||
|
||||
async updateCharacter(
|
||||
|
|
@ -134,8 +134,8 @@ export const comicCharactersStore = {
|
|||
if (Array.isArray(wrapped.tags)) {
|
||||
wrapped.tags = [...wrapped.tags];
|
||||
}
|
||||
await encryptRecord('comicCharacters', wrapped as Record<string, unknown>);
|
||||
await comicCharactersTable.update(id, wrapped as never);
|
||||
await encryptRecord('comicCharacters', wrapped);
|
||||
await comicCharactersTable.update(id, wrapped);
|
||||
},
|
||||
|
||||
async toggleFavorite(id: string): Promise<void> {
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ export const comicStoriesStore = {
|
|||
if (Array.isArray(wrapped.tags)) {
|
||||
wrapped.tags = [...wrapped.tags];
|
||||
}
|
||||
await encryptRecord('comicStories', wrapped as Record<string, unknown>);
|
||||
await comicStoriesTable.update(id, wrapped as never);
|
||||
await encryptRecord('comicStories', wrapped);
|
||||
await comicStoriesTable.update(id, wrapped);
|
||||
},
|
||||
|
||||
async toggleFavorite(id: string): Promise<void> {
|
||||
|
|
@ -133,7 +133,7 @@ export const comicStoriesStore = {
|
|||
} else if (next !== 'unlisted' && existing.unlistedToken) {
|
||||
patch.unlistedToken = undefined;
|
||||
}
|
||||
await comicStoriesTable.update(id, patch as never);
|
||||
await comicStoriesTable.update(id, patch);
|
||||
|
||||
emitDomainEvent('VisibilityChanged', 'comic', 'comicStories', id, {
|
||||
recordId: id,
|
||||
|
|
@ -163,7 +163,7 @@ export const comicStoriesStore = {
|
|||
panelMeta: nextMeta,
|
||||
} as Record<string, unknown>;
|
||||
await encryptRecord('comicStories', patch);
|
||||
await comicStoriesTable.update(storyId, patch as never);
|
||||
await comicStoriesTable.update(storyId, patch);
|
||||
emitDomainEvent('ComicPanelAppended', 'comic', 'comicStories', storyId, {
|
||||
storyId,
|
||||
panelImageId,
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@
|
|||
panelImageIds: nextIds,
|
||||
panelMeta: nextMeta,
|
||||
} as Partial<LocalComicStory>;
|
||||
await encryptRecord('comicStories', patch as Record<string, unknown>);
|
||||
await comicStoriesTable.update(story.id, patch as never);
|
||||
await encryptRecord('comicStories', patch);
|
||||
await comicStoriesTable.update(story.id, patch);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ export const invoicesStore = {
|
|||
}
|
||||
const wrapped = { ...patch } as Record<string, unknown>;
|
||||
await encryptRecord('invoices', wrapped);
|
||||
await invoiceTable.update(id, wrapped as never);
|
||||
await invoiceTable.update(id, wrapped);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -156,7 +156,7 @@ export const invoicesStore = {
|
|||
// `lines` is in the encryption allowlist; `totals` is not. encryptRecord
|
||||
// only touches allowlisted keys, so a single call is correct for both.
|
||||
await encryptRecord('invoices', patch);
|
||||
await invoiceTable.update(id, patch as never);
|
||||
await invoiceTable.update(id, patch);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ export const libraryEntriesStore = {
|
|||
) {
|
||||
const wrapped = { ...patch } as Record<string, unknown>;
|
||||
await encryptRecord('libraryEntries', wrapped);
|
||||
await libraryEntryTable.update(id, wrapped as never);
|
||||
await libraryEntryTable.update(id, wrapped);
|
||||
// Keep the share-link snapshot in sync if this entry is unlisted.
|
||||
void this.refreshUnlistedSnapshot(id);
|
||||
},
|
||||
|
|
@ -265,7 +265,7 @@ export const libraryEntriesStore = {
|
|||
patch.unlistedExpiresAt = undefined;
|
||||
}
|
||||
|
||||
await libraryEntryTable.update(id, patch as never);
|
||||
await libraryEntryTable.update(id, patch);
|
||||
|
||||
emitDomainEvent('VisibilityChanged', 'library', 'libraryEntries', id, {
|
||||
recordId: id,
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ export const meImagesStore = {
|
|||
): Promise<void> {
|
||||
const wrapped = { ...patch } as Record<string, unknown>;
|
||||
await encryptRecord('meImages', wrapped);
|
||||
await meImagesTable.update(id, wrapped as never);
|
||||
await meImagesTable.update(id, wrapped);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ export const recipesStore = {
|
|||
) {
|
||||
const wrapped = { ...patch } as Record<string, unknown>;
|
||||
await encryptRecord('recipes', wrapped);
|
||||
await recipeTable.update(id, wrapped as never);
|
||||
await recipeTable.update(id, wrapped);
|
||||
},
|
||||
|
||||
async deleteRecipe(id: string) {
|
||||
|
|
@ -118,7 +118,7 @@ export const recipesStore = {
|
|||
} else if (next !== 'unlisted' && existing.unlistedToken) {
|
||||
patch.unlistedToken = undefined;
|
||||
}
|
||||
await recipeTable.update(id, patch as never);
|
||||
await recipeTable.update(id, patch);
|
||||
|
||||
emitDomainEvent('VisibilityChanged', 'recipes', 'recipes', id, {
|
||||
recordId: id,
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ export const sleepStore = {
|
|||
>
|
||||
) {
|
||||
// Recalculate duration if times changed
|
||||
const update: Record<string, unknown> = { ...patch };
|
||||
const update: Partial<LocalSleepEntry> = { ...patch };
|
||||
if (patch.bedtime || patch.wakeTime) {
|
||||
const entry = await sleepEntryTable.get(id);
|
||||
if (entry) {
|
||||
|
|
@ -122,7 +122,7 @@ export const sleepStore = {
|
|||
}
|
||||
}
|
||||
const wrapped = await encryptRecord('sleepEntries', update);
|
||||
await sleepEntryTable.update(id, wrapped as never);
|
||||
await sleepEntryTable.update(id, wrapped);
|
||||
},
|
||||
|
||||
async deleteEntry(id: string) {
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ export const wardrobeGarmentsStore = {
|
|||
): Promise<void> {
|
||||
const wrapped = { ...patch } as Record<string, unknown>;
|
||||
await encryptRecord('wardrobeGarments', wrapped);
|
||||
await wardrobeGarmentsTable.update(id, wrapped as never);
|
||||
await wardrobeGarmentsTable.update(id, wrapped);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ export const wardrobeOutfitsStore = {
|
|||
): Promise<void> {
|
||||
const wrapped = { ...patch } as Record<string, unknown>;
|
||||
await encryptRecord('wardrobeOutfits', wrapped);
|
||||
await wardrobeOutfitsTable.update(id, wrapped as never);
|
||||
await wardrobeOutfitsTable.update(id, wrapped);
|
||||
},
|
||||
|
||||
async toggleFavorite(id: string): Promise<void> {
|
||||
|
|
@ -145,7 +145,7 @@ export const wardrobeOutfitsStore = {
|
|||
} else if (next !== 'unlisted' && existing.unlistedToken) {
|
||||
patch.unlistedToken = undefined;
|
||||
}
|
||||
await wardrobeOutfitsTable.update(id, patch as never);
|
||||
await wardrobeOutfitsTable.update(id, patch);
|
||||
|
||||
emitDomainEvent('VisibilityChanged', 'wardrobe', 'wardrobeOutfits', id, {
|
||||
recordId: id,
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ export const draftsStore = {
|
|||
async updateDraft(id: string, patch: UpdateDraftPatch) {
|
||||
const wrapped = { ...patch } as Record<string, unknown>;
|
||||
await encryptRecord('writingDrafts', wrapped);
|
||||
await draftTable.update(id, wrapped as never);
|
||||
await draftTable.update(id, wrapped);
|
||||
},
|
||||
|
||||
async updateBriefing(id: string, briefingPatch: Partial<DraftBriefing>) {
|
||||
|
|
@ -325,7 +325,7 @@ export const draftsStore = {
|
|||
} else if (next !== 'unlisted' && existing.unlistedToken) {
|
||||
patch.unlistedToken = undefined;
|
||||
}
|
||||
await draftTable.update(id, patch as never);
|
||||
await draftTable.update(id, patch);
|
||||
emitDomainEvent('VisibilityChanged', 'writing', 'writingDrafts', id, {
|
||||
recordId: id,
|
||||
collection: 'writingDrafts',
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ export const stylesStore = {
|
|||
async updateStyle(id: string, patch: UpdateStylePatch) {
|
||||
const wrapped = { ...patch } as Record<string, unknown>;
|
||||
await encryptRecord('writingStyles', wrapped);
|
||||
await writingStyleTable.update(id, wrapped as never);
|
||||
await writingStyleTable.update(id, wrapped);
|
||||
},
|
||||
|
||||
async upsertExtractedPrinciples(id: string, principles: StyleExtractedPrinciples) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue