Files
AFFiNE-Mirror/packages/frontend/electron-api/src/index.ts
T
DarkSky 8d72e4dc29 feat(core): import progress & perf (#15197)
#### PR Dependency Tree


* **PR #15197** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added a new import pipeline with “plan then commit” batch handling for
Markdown, Notion HTML, Obsidian, and Bear backups.
* Enabled native import sessions with progress, cancellation, and
batch-by-batch committing (including assets, folders, icons, and tags).
  * Added web preflight limits for ZIP and multi-file imports.
* **Bug Fixes**
* Improved import error/warning reporting and continued processing when
some items fail.
* Strengthened snapshot-based file/directory picking to preserve paths.
* **Chores**
  * Updated project packaging/configuration for the new import workflow.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-06 01:29:24 +08:00

70 lines
2.3 KiB
TypeScript

import type {
events as helperEvents,
handlers as helperHandlers,
} from '@affine/electron/helper/exposed';
import type {
events as mainEvents,
handlers as mainHandlers,
} from '@affine/electron/main/exposed';
import type { AppInfo } from '@affine/electron/preload/electron-api';
import type { SharedStorage } from '@affine/electron/preload/shared-storage';
import type { CreateImportSessionFromSourceOptions } from '@affine/electron/shared/import';
type MainHandlers = typeof mainHandlers;
type HelperHandlers = typeof helperHandlers;
type HelperEvents = typeof helperEvents;
type MainEvents = typeof mainEvents;
type ImportPreloadHandlers = {
createImportSessionFromSource(
options: CreateImportSessionFromSourceOptions
): Promise<string>;
};
type MainClientHandlers = {
[namespace in keyof MainHandlers]: {
[method in keyof MainHandlers[namespace]]: MainHandlers[namespace][method] extends (
arg0: any,
...rest: infer A
) => any
? (
...args: A
) => ReturnType<MainHandlers[namespace][method]> extends Promise<any>
? ReturnType<MainHandlers[namespace][method]>
: Promise<ReturnType<MainHandlers[namespace][method]>>
: never;
};
};
export type ClientHandler = Omit<MainClientHandlers, 'import'> &
HelperHandlers & {
import: MainClientHandlers['import'] & ImportPreloadHandlers;
};
export type ClientEvents = MainEvents & HelperEvents;
export const appInfo = (globalThis as any).__appInfo as AppInfo | null;
export const apis = (globalThis as any).__apis as ClientHandler | undefined;
export const events = (globalThis as any).__events as ClientEvents | undefined;
export const sharedStorage = (globalThis as any).__sharedStorage as
| SharedStorage
| undefined;
export type { AppInfo, SharedStorage };
export {
type SpellCheckStateSchema,
type TabViewsMetaSchema,
type WorkbenchMeta,
type WorkbenchViewMeta,
type WorkbenchViewModule,
} from '@affine/electron/main/shared-state-schema';
export type { UpdateMeta } from '@affine/electron/main/updater/event';
export type {
AddTabOption,
TabAction,
} from '@affine/electron/main/windows-manager';
export type {
CreateImportSessionFromSourceOptions,
NativeImportBrowserSource,
NativeImportFormat,
NativeImportSessionHandlers,
} from '@affine/electron/shared/import';