fix: restore production build by re-adding missing exports and updating positional-to-object API call sites
Resolves #782. - Add isShortcutKey type guard to actions/keybinding.ts - Add isActionWithOptionalArgs runtime guard to actions/definitions.ts - Migrate IndexedDBAdapter constructor + .set() calls to object args in storage migrations - Migrate DefinitionRegistry.register() call to object args in stickers/providers
This commit is contained in:
parent
6fdb1559aa
commit
ecc14c0707
|
|
@ -208,3 +208,19 @@ export function getDefaultShortcuts(): Map<
|
|||
|
||||
return shortcuts;
|
||||
}
|
||||
|
||||
const ACTION_SET: ReadonlySet<string> = new Set(Object.keys(ACTIONS));
|
||||
// IMPORTANT: This Set must stay in sync with entries in `TActionArgsMap` (./types.ts)
|
||||
// whose value type does not include `undefined`. If you add a new required-args action
|
||||
// to TActionArgsMap, add its ID here too — otherwise `isActionWithOptionalArgs` will
|
||||
// return true at runtime for an action that actually requires arguments.
|
||||
const REQUIRED_ARGS_ACTIONS: ReadonlySet<string> = new Set<string>([
|
||||
"remove-media-asset",
|
||||
"remove-media-assets",
|
||||
]);
|
||||
|
||||
export function isActionWithOptionalArgs(
|
||||
value: string,
|
||||
): value is TActionWithOptionalArgs {
|
||||
return ACTION_SET.has(value) && !REQUIRED_ARGS_ACTIONS.has(value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,25 @@ export type SingleCharacterShortcutKey = `${Key}`;
|
|||
|
||||
export type ShortcutKey = ModifierBasedShortcutKey | SingleCharacterShortcutKey;
|
||||
|
||||
const MODIFIER_SET: ReadonlySet<string> = new Set<string>([
|
||||
"ctrl",
|
||||
"alt",
|
||||
"shift",
|
||||
"ctrl+shift",
|
||||
"alt+shift",
|
||||
"ctrl+alt",
|
||||
"ctrl+alt+shift",
|
||||
]);
|
||||
|
||||
export function isShortcutKey(value: string): value is ShortcutKey {
|
||||
if (isKey(value)) return true;
|
||||
const lastPlus = value.lastIndexOf("+");
|
||||
if (lastPlus === -1) return false;
|
||||
return (
|
||||
MODIFIER_SET.has(value.slice(0, lastPlus)) && isKey(value.slice(lastPlus + 1))
|
||||
);
|
||||
}
|
||||
|
||||
export type KeybindingConfig = {
|
||||
[key in ShortcutKey]?: TActionWithOptionalArgs;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ export async function runStorageMigrations({
|
|||
hasCleanedUpMetaDb = true;
|
||||
}
|
||||
|
||||
const projectsAdapter = new IndexedDBAdapter<ProjectRecord>(
|
||||
"video-editor-projects",
|
||||
"projects",
|
||||
1,
|
||||
);
|
||||
const projectsAdapter = new IndexedDBAdapter<ProjectRecord>({
|
||||
dbName: "video-editor-projects",
|
||||
storeName: "projects",
|
||||
version: 1,
|
||||
});
|
||||
|
||||
const projects = await projectsAdapter.getAll();
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ export async function runStorageMigrations({
|
|||
break;
|
||||
}
|
||||
|
||||
await projectsAdapter.set(projectId, result.project);
|
||||
await projectsAdapter.set({ key: projectId, value: result.project });
|
||||
migratedCount++;
|
||||
currentVersion = migration.to;
|
||||
projectRecord = result.project;
|
||||
|
|
|
|||
|
|
@ -121,20 +121,20 @@ async function loadLegacyTracksForScene({
|
|||
const sceneDbName = `video-editor-timelines-${projectId}-${sceneId}`;
|
||||
const projectDbName = `video-editor-timelines-${projectId}`;
|
||||
|
||||
const adapter = new IndexedDBAdapter<LegacyTimelineData>(
|
||||
sceneDbName,
|
||||
"timeline",
|
||||
1,
|
||||
);
|
||||
const adapter = new IndexedDBAdapter<LegacyTimelineData>({
|
||||
dbName: sceneDbName,
|
||||
storeName: "timeline",
|
||||
version: 1,
|
||||
});
|
||||
|
||||
let data = await adapter.get("timeline");
|
||||
|
||||
if (!data && isMain) {
|
||||
const projectAdapter = new IndexedDBAdapter<LegacyTimelineData>(
|
||||
projectDbName,
|
||||
"timeline",
|
||||
1,
|
||||
);
|
||||
const projectAdapter = new IndexedDBAdapter<LegacyTimelineData>({
|
||||
dbName: projectDbName,
|
||||
storeName: "timeline",
|
||||
version: 1,
|
||||
});
|
||||
data = await projectAdapter.get("timeline");
|
||||
}
|
||||
|
||||
|
|
@ -157,11 +157,11 @@ async function loadMediaTypesById({
|
|||
return {};
|
||||
}
|
||||
|
||||
const mediaMetadataAdapter = new IndexedDBAdapter<MediaAssetData>(
|
||||
`video-editor-media-${projectId}`,
|
||||
"media-metadata",
|
||||
1,
|
||||
);
|
||||
const mediaMetadataAdapter = new IndexedDBAdapter<MediaAssetData>({
|
||||
dbName: `video-editor-media-${projectId}`,
|
||||
storeName: "media-metadata",
|
||||
version: 1,
|
||||
});
|
||||
|
||||
const mediaEntries = await Promise.all(
|
||||
mediaIds.map(async (mediaId) => {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,6 @@ export function registerDefaultStickerProviders({
|
|||
if (stickersRegistry.has(provider.id)) {
|
||||
continue;
|
||||
}
|
||||
stickersRegistry.register(provider.id, provider);
|
||||
stickersRegistry.register({ key: provider.id, definition: provider });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue