@im-nobsidian/core 0.9.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -511,6 +511,20 @@ interface PullResult {
511
511
  readonly linkCount: number;
512
512
  /** 원격을 얼마나 훑었나. 원격을 보지 않은 실행(받기 방향이 아님 · 취소)에는 없다. */
513
513
  readonly remoteScan?: RemoteScanInfo;
514
+ /** Notion 에서 옮긴 페이지를 볼트에서 옮긴 것(ADR-039) — dry-run 은 옮길 것. 없으면 옮긴 것이 없다. */
515
+ readonly moved?: readonly RemoteMove[];
516
+ /** Notion 에서 옮겼지만 볼트에서 옮기지 않은 것과 그 까닭. */
517
+ readonly moveSkipped?: readonly RemoteMoveSkip[];
518
+ }
519
+ /** Notion 에서 옮긴 페이지를 볼트에서 옮긴 것 하나 — 노트 하나거나 폴더 하나다. */
520
+ interface RemoteMove {
521
+ readonly from: string;
522
+ readonly to: string;
523
+ }
524
+ /** 옮기지 않고 둔 것과 그 까닭 — 볼트에서 직접 옮기면 다음 push 가 Notion 을 맞춘다. */
525
+ interface RemoteMoveSkip {
526
+ readonly path: string;
527
+ readonly reason: string;
514
528
  }
515
529
  interface SyncResult {
516
530
  readonly push: PushResult;
@@ -848,6 +862,21 @@ declare class StateDB implements IStateDB {
848
862
  static open(dbPath: string): StateDB;
849
863
  private static openLocked;
850
864
  private migrate;
865
+ /**
866
+ * `\` 로 이은 경로를 `/` 로 고쳐 적는다 — Windows 에서만 부른다(이슈 #8). 0.9.1 까지의 CLI 는 Windows 에서
867
+ * 볼트 경로를 `relative()` 그대로(`00 Me\a.md`) 적었다. 이제 목록은 `/` 로 이으므로 그대로 두면 그
868
+ * 노트들이 「볼트에서 지움」 과 「새 노트」 로 보인다.
869
+ *
870
+ * 같은 노트가 이미 `/` 경로로도 추적되고 있으면(pull 이 `/` 로 적은 노트를 `\` 목록이 새 노트로 보고 또
871
+ * 올렸다) `\` 쪽 기록을 버린다 — 그 기록의 Notion 페이지는 그때 생긴 사본이다. 지우지 않고 추적만 놓는다.
872
+ * Linux · macOS 에서는 `\` 가 파일 이름의 글자일 수 있어 부르지 않는다.
873
+ *
874
+ * @returns 고쳐 적은 경로 수와 버린 사본 기록 수
875
+ */
876
+ normalizePathSeparators(): {
877
+ readonly renamed: number;
878
+ readonly dropped: number;
879
+ };
851
880
  private getSchemaVersion;
852
881
  /** 닫고 잠금을 푼다 — 닫는 사이 다른 곳이 열지 않게 닫은 뒤에 푼다. */
853
882
  close(): void;
@@ -2075,7 +2104,12 @@ interface LocalScan {
2075
2104
  }
2076
2105
  declare class ChangeDetector {
2077
2106
  private readonly stateDb;
2078
- constructor(stateDb: IStateDB);
2107
+ private readonly excludes;
2108
+ /**
2109
+ * @param excludes 설정이 동기화에서 뺀 경로(이슈 #8) — 목록에 없어도 지운 것이 아니다. 예전에는 뺀 폴더의
2110
+ * 추적 노트를 「삭제」 로 보고, deleteSync 면 Notion 페이지를 지울 수 있었다.
2111
+ */
2112
+ constructor(stateDb: IStateDB, excludes?: (path: string) => boolean);
2079
2113
  detectLocalChangesFast(stats: FileStatInfo[], readFile: (path: string) => Promise<string>, options?: LocalScanOptions): Promise<LocalChange[]>;
2080
2114
  detectLocalChanges(currentFiles: FileInfo[], options?: LocalScanOptions): LocalChange[];
2081
2115
  /** 파일 크기 · 수정 시각이 지난 동기화와 같으면 내용을 읽지 않는다. */
@@ -2113,6 +2147,14 @@ interface VaultFS {
2113
2147
  * 이 볼트(연결)가 맡은 경로인가 — 볼트 안의 다른 연결 폴더(ADR-038)는 false. 없으면 전부 맡는다.
2114
2148
  */
2115
2149
  ownsPath?(path: string): boolean;
2150
+ /** 이 폴더 안에 다른 연결 폴더가 있나 — 폴더를 통째로 옮기기 전에 묻는다. 없으면 없다. */
2151
+ holdsOtherConnection?(folder: string): boolean;
2152
+ /**
2153
+ * 설정(`paths.include` · `paths.exclude`)이나 `.im-nobsidian-ignore` 가 동기화에서 뺀 경로인가 (이슈 #8).
2154
+ * 뺀 노트는 목록에 없다 — 추적하던 노트라도 「볼트에서 지움」 으로 보지 않고, pull 이 받거나 되살리지도
2155
+ * 않는다. `folder` 면 제외 패턴만 본다(포함 패턴은 안의 파일이 정한다). 없으면 아무것도 빼지 않는다.
2156
+ */
2157
+ excludesPath?(path: string, kind?: "file" | "folder"): boolean;
2116
2158
  }
2117
2159
 
2118
2160
  type ResolutionChoice = "local" | "remote" | "merge" | "duplicate";
@@ -2429,6 +2471,7 @@ declare class SyncOrchestrator {
2429
2471
  private readonly placement;
2430
2472
  private readonly databaseCreator;
2431
2473
  private readonly planner;
2474
+ private readonly remoteMoves;
2432
2475
  private readonly detector;
2433
2476
  private readonly drift;
2434
2477
  private readonly discovery;
@@ -2457,6 +2500,8 @@ declare class SyncOrchestrator {
2457
2500
  /** 볼트의 노트가 마지막으로 올린 내용 그대로인가 — 읽지 못하면(지움 · 옮김) 아니다. */
2458
2501
  private unchangedSincePush;
2459
2502
  pull(options?: PullOptions): Promise<PullResult>;
2503
+ /** 감지가 본, Notion 에서 옮긴 페이지를 볼트에서 옮긴다 — 경로를 좁힌 pull 은 그 범위의 것만. */
2504
+ private followRemoteMoves;
2460
2505
  private executePull;
2461
2506
  sync(options?: SyncOptions): Promise<SyncResult>;
2462
2507
  private executeSync;
@@ -2549,9 +2594,9 @@ interface PathFilterConfig {
2549
2594
  }
2550
2595
  declare class NodeVaultFS implements VaultFS {
2551
2596
  private readonly rootPath;
2552
- private readonly includePatterns;
2553
- private readonly excludePatterns;
2597
+ private readonly filter;
2554
2598
  constructor(rootPath: string, pathConfig?: PathFilterConfig);
2599
+ excludesPath(path: string, kind?: "file" | "folder"): boolean;
2555
2600
  private loadImNobsidianIgnore;
2556
2601
  readFile(path: string): Promise<string>;
2557
2602
  readBinary(path: string): Promise<Buffer>;
@@ -2565,8 +2610,8 @@ declare class NodeVaultFS implements VaultFS {
2565
2610
  listMarkdownFileStats(): Promise<FileStatInfo[]>;
2566
2611
  getFileStat(path: string): Promise<FileStatInfo | null>;
2567
2612
  listNonMarkdownFiles(): Promise<NonMdFileInfo[]>;
2568
- private matchesPattern;
2569
- private isExcluded;
2613
+ /** 볼트 경로 — Windows 의 `relative()` 는 `\` 로 잇는다. 상태 DB · 패턴 · Notion 경로는 모두 `/` 다. */
2614
+ private vaultPath;
2570
2615
  private walkDirNonMd;
2571
2616
  private walkDirStats;
2572
2617
  private walkDir;
@@ -3942,6 +3987,36 @@ declare function matchesPathScope(path: string, scope: string): boolean;
3942
3987
  /** 범위 목록 중 하나라도 걸리면 true. 목록이 비어 있으면(범위 미지정) 항상 true. */
3943
3988
  declare function inAnyPathScope(path: string, scopes: readonly string[] | undefined): boolean;
3944
3989
 
3990
+ /**
3991
+ * 설정 `paths.include` · `paths.exclude` 와 `.im-nobsidian-ignore` 의 경로 패턴 (이슈 #8).
3992
+ *
3993
+ * 볼트 경로는 늘 `/` 로 잇는다({@link toVaultPath}). 예전 판정은 세 가지가 틀렸다.
3994
+ * 1. Windows 의 `relative()` 가 준 `00 Me\a.md` 를 `/` 로만 견줘 어느 패턴에도 맞지 않았다
3995
+ * 2. 포함 패턴을 폴더에도 대어 `00 Me/**\/*.md` 면 폴더 `00 Me` 가 빠지고 안을 걷지 않았다
3996
+ * 3. `**\/` 가 폴더 0 단계를 받지 않았고(`a/**\/*.md` ↛ `a/x.md`) 정규식 글자를 이스케이프하지 않았다
3997
+ *
3998
+ * 규칙
3999
+ * - 글롭 없는 패턴은 그 경로이거나 그 폴더 안이다 — `Private` ↔ `Private/a.md`
4000
+ * - `/` 없는 글롭은 경로 조각 어느 것에나 댄다 — `*.pdf` ↔ `a/b/x.pdf`, `draft-*` ↔ `x/draft-1/a.md`
4001
+ * - `/` 있는 글롭은 볼트 맨 위부터 댄다. `*` · `?` 는 조각 안, `**` 는 조각을 넘는다
4002
+ * - 패턴에 맞는 폴더의 안은 모두 맞는다 — 걷기가 그 폴더에서 멈추는 것과 같다
4003
+ * - 패턴의 `\` 는 `/` 로, 앞의 `./` · `/` 와 끝의 `/` 는 뗀다
4004
+ */
4005
+ declare class PathFilter {
4006
+ private readonly include;
4007
+ private readonly exclude;
4008
+ constructor(include: readonly string[], exclude: readonly string[]);
4009
+ /** 동기화하지 않는 노트 · 첨부 — 포함 패턴 어느 것에도 맞지 않거나 제외 패턴에 맞는다. */
4010
+ excludesFile(path: string): boolean;
4011
+ /**
4012
+ * 걷지 않을 폴더 — 제외 패턴만 본다. 포함 패턴은 안의 파일이 정한다: `00 Me/**\/*.md` 는 폴더
4013
+ * `00 Me` 에 맞지 않지만 그 안의 노트에 맞는다.
4014
+ */
4015
+ excludesFolder(path: string): boolean;
4016
+ }
4017
+ /** 운영체제 구분자로 이은 상대 경로 → 볼트 경로(`/`). `relative()` 의 결과에 쓴다. */
4018
+ declare function toVaultPath(relativePath: string, separator: string): string;
4019
+
3945
4020
  /** 줄 비교의 한 줄. 번호는 1부터 — 더한 줄은 옛 번호가, 지운 줄은 새 번호가 없다. */
3946
4021
  interface DiffLine {
3947
4022
  readonly kind: "same" | "added" | "removed";
@@ -4045,6 +4120,8 @@ declare class ScopedVaultFS implements VaultFS {
4045
4120
  */
4046
4121
  constructor(base: VaultFS, folder: string, connections: readonly string[]);
4047
4122
  ownsPath(path: string): boolean;
4123
+ holdsOtherConnection(folder: string): boolean;
4124
+ excludesPath(path: string, kind?: "file" | "folder"): boolean;
4048
4125
  /** 이 연결의 경로 → 볼트 경로. */
4049
4126
  private toBase;
4050
4127
  /** 볼트 경로 → 이 연결의 경로. 이 연결이 맡지 않으면 null. */
@@ -4226,4 +4303,4 @@ declare function readColumnLayout(lines: readonly string[]): (ColumnPlace | unde
4226
4303
  /** 열 이름표 — `열 2/3 · 50%`. 비율이 없으면 `열 2/3`. */
4227
4304
  declare function columnLabel(place: ColumnPlace): string;
4228
4305
 
4229
- export { BaseFileGenerator, type BaseFileOptions, type BasePropertyOption, type BasePropertySchema, type BaseStatusGroup, type BaseSyncOptions, type BasesFilterNode, type BasesViewMapping, type BasesViewType, BlankLineCollapser, type BookmarkTarget, CONFIG_FILE, type CalendarEntry, type CalloutDesign, CalloutRestorer, CalloutTransformer, ChangeDetector, type ChangeDiff, ColorAnnotator, type ColumnPlace, type CompletenessFailure, type CompletenessLocalSource, type CompletenessOptions, type CompletenessRemoteSource, type CompletenessReport, type Config, ConfigManager, ConfigSchema, type Conflict, ConflictResolver, type ConflictStrategy, ConnectionBoundaryError, ConnectionScopeError, type ConversionContext, type ConversionPath, ConversionPipeline, type ConversionResult, type CoverConfig, type DBEntry, DB_VIEWS_FILE, DB_VIEWS_PATH, DEFAULT_CONFIG, DEFAULT_TITLE_PROPERTY, DEFAULT_WATCH_DEBOUNCE_MS, DIFF_SIGN, type DatabaseCompleteness, type DatabaseSyncConfig, type DatabaseSyncResult, DatabaseSyncer, type DatabaseViewsConfig, type DeferredCode, type DegradeNote, type DesignColor, type DesignLine, type DesignSegment, type DiffHunk, type DiffLine, EmbedResolver, EntryEditor, type FailedOperation, type FidelityClassification, type FidelityContext, type FidelityDefect, type FidelityDefectForm, type FidelitySummary, type FileDownloadResult, FileHandler, type FileInfo, type FileRegistryEntry, type FileStatInfo, type FileSystemEntry, type FileType, type FileUploadResult, FileWatcher, type FilterCondition, type FolderDatabaseReport, type FolderMoveChange, FrontmatterExtractor, FrontmatterGenerator, type FullScanReason, GITIGNORE_ENTRY, type GatedOperation, type GroupByConfig, type GroupedEntries, IGNORE_FILE, INTERNAL_DIR, INTERNAL_DIR_GLOB, type IStateDB, type ImageDownloadResult, ImageHandler, type ImageReference, type InferredProperty, InlineAnnotationPreserver, InlineDBParser, type InlineStyle, type LineDiffOptions, type LineRange, type LocalChange, LocalImageRestorer, type LocalMoveAdoption, type LocalScan, type LocalScanOptions, type Logger, MARKER_BRAND, type MappingResult, type MappingType, MathNormalizer, MentionToWikilink, type MergeConflictRegion, type MergeResult, NOTION_COLOR_NAMES, NOTION_TOKEN_PREFIX, NOTION_TO_BASES_VIEW, NodeVaultFS, type NonMdFileInfo, type NotionBlock, NotionBlockBuilder, NotionClient, type NotionClientOptions, type NotionColor, type NotionPageNode, type NotionRichText, type RichTextItem as NotionRichTextItem, type NotionSidecar, OBSIDIAN_CONFIG_DIR, type OperationType, type PageCompletenessRemoteSource, type PageCompletenessReport, type PageCover, type PageCreationPlan, type PageIcon, type PathFilterConfig, type PendingOperation, PendingWalError, type PlannedRow, type PreserveMarker, PreserveMarkerCollector, PreserveMarkerInjector, type Processor, type ProcessorInput, type ProcessorMetadata, type ProcessorOutput, type ProgressCallback, type ProgressItem, PropertiesTableInjector, PropertiesTableRestorer, PropertyMapper, type PropertyOption, type PropertySchema, type PropertyValue, type PullOptions, type PullResult, type PushOptions, type PushResult, RENDER_LINE_RULES, type RecordPendingInput, type RegisterFileInput, type RemoteChange, type RemoteObservation, type RemoteScanInfo, type RenameHints, type RenameKind, type RenderFinding, type RenderLineRule, type ResolutionChoice, type ResolutionResult, type RichTextSegment, type RowProgress, SAVED_STATE_TABLES_QUERY, SEPARATOR_BODY, STATE_DB_FILE, STATE_DB_MIGRATIONS, STATE_DB_PATH, SavedStateDbError, ScopedVaultFS, SidecarGenerator, type SidecarProperty, type SidecarView, StateDB, StateDbLockedError, type StateDbMigration, type StateDbTool, StateDbUnavailableError, StateLock, type StateLockClaim, type StateLockOwner, type StatusOptions, type StatusResult, type StyledRange, SyncBusyError, type SyncDirection, type SyncOptions, SyncOrchestrator, type SyncRecord, type SyncResult, type SyncStatus, type TableLineDesign, type TranslationResult, TreeMapper, UnsupportedBlockStripper, type UpsertSyncRecord, type VaultCompletenessReport, type VaultFS, type ViewConfig, ViewDataProvider, type ViewPropertyConfig, type ViewRenderData, type ViewType, WIKILINK_LOOKUPS, type WatchSyncOptions, type WatchSyncScope, WatchSyncService, type WikilinkEntry, type WikilinkLookup, WikilinkResolver, applicableChoices, assertNoPendingWal, basesViewMappingOf, basesViewTypeOf, choiceForStrategy, classifyBodyFidelity, columnLabel, compactNotionId, computeBufferHash, computeHash, configDirFrom, connectionFolderOf, createDefaultPipeline, extractCalendarEntries, filterByMonth, filterEntries, findConnectionFolders, formatUnifiedDiff, generateColorCSS, generateId, getLogger, getNotionBgColor, getNotionColor, getVisibleProperties, groupEntries, hasColumnLayout, hasDesignMarker, inAnyPathScope, isInternalPath, isMarkdownPath, isRemoteDeletion, lineDiff, lintRenderedMarkdown, matchesPathScope, normalizeNotionId, normalizeVaultPath, noteNameFromPath, notionIdFromInput, notionIdsEqual, operationLabel, parseDesignColor, pendingWalBytes, readColumnLayout, readDesignLine, resolvePropertyName, sanitizeFileName, setLogger, sortEntries, stateDbLockPath, stateDbWalPath, stripMarkdownExtension, summarizeFidelity, systemTimeZone, threeWayMerge, translateNotionFilter, verifyDatabaseCompleteness, verifyPageCompleteness, wikilinkLookupsIn };
4306
+ export { BaseFileGenerator, type BaseFileOptions, type BasePropertyOption, type BasePropertySchema, type BaseStatusGroup, type BaseSyncOptions, type BasesFilterNode, type BasesViewMapping, type BasesViewType, BlankLineCollapser, type BookmarkTarget, CONFIG_FILE, type CalendarEntry, type CalloutDesign, CalloutRestorer, CalloutTransformer, ChangeDetector, type ChangeDiff, ColorAnnotator, type ColumnPlace, type CompletenessFailure, type CompletenessLocalSource, type CompletenessOptions, type CompletenessRemoteSource, type CompletenessReport, type Config, ConfigManager, ConfigSchema, type Conflict, ConflictResolver, type ConflictStrategy, ConnectionBoundaryError, ConnectionScopeError, type ConversionContext, type ConversionPath, ConversionPipeline, type ConversionResult, type CoverConfig, type DBEntry, DB_VIEWS_FILE, DB_VIEWS_PATH, DEFAULT_CONFIG, DEFAULT_TITLE_PROPERTY, DEFAULT_WATCH_DEBOUNCE_MS, DIFF_SIGN, type DatabaseCompleteness, type DatabaseSyncConfig, type DatabaseSyncResult, DatabaseSyncer, type DatabaseViewsConfig, type DeferredCode, type DegradeNote, type DesignColor, type DesignLine, type DesignSegment, type DiffHunk, type DiffLine, EmbedResolver, EntryEditor, type FailedOperation, type FidelityClassification, type FidelityContext, type FidelityDefect, type FidelityDefectForm, type FidelitySummary, type FileDownloadResult, FileHandler, type FileInfo, type FileRegistryEntry, type FileStatInfo, type FileSystemEntry, type FileType, type FileUploadResult, FileWatcher, type FilterCondition, type FolderDatabaseReport, type FolderMoveChange, FrontmatterExtractor, FrontmatterGenerator, type FullScanReason, GITIGNORE_ENTRY, type GatedOperation, type GroupByConfig, type GroupedEntries, IGNORE_FILE, INTERNAL_DIR, INTERNAL_DIR_GLOB, type IStateDB, type ImageDownloadResult, ImageHandler, type ImageReference, type InferredProperty, InlineAnnotationPreserver, InlineDBParser, type InlineStyle, type LineDiffOptions, type LineRange, type LocalChange, LocalImageRestorer, type LocalMoveAdoption, type LocalScan, type LocalScanOptions, type Logger, MARKER_BRAND, type MappingResult, type MappingType, MathNormalizer, MentionToWikilink, type MergeConflictRegion, type MergeResult, NOTION_COLOR_NAMES, NOTION_TOKEN_PREFIX, NOTION_TO_BASES_VIEW, NodeVaultFS, type NonMdFileInfo, type NotionBlock, NotionBlockBuilder, NotionClient, type NotionClientOptions, type NotionColor, type NotionPageNode, type NotionRichText, type RichTextItem as NotionRichTextItem, type NotionSidecar, OBSIDIAN_CONFIG_DIR, type OperationType, type PageCompletenessRemoteSource, type PageCompletenessReport, type PageCover, type PageCreationPlan, type PageIcon, PathFilter, type PathFilterConfig, type PendingOperation, PendingWalError, type PlannedRow, type PreserveMarker, PreserveMarkerCollector, PreserveMarkerInjector, type Processor, type ProcessorInput, type ProcessorMetadata, type ProcessorOutput, type ProgressCallback, type ProgressItem, PropertiesTableInjector, PropertiesTableRestorer, PropertyMapper, type PropertyOption, type PropertySchema, type PropertyValue, type PullOptions, type PullResult, type PushOptions, type PushResult, RENDER_LINE_RULES, type RecordPendingInput, type RegisterFileInput, type RemoteChange, type RemoteMove, type RemoteMoveSkip, type RemoteObservation, type RemoteScanInfo, type RenameHints, type RenameKind, type RenderFinding, type RenderLineRule, type ResolutionChoice, type ResolutionResult, type RichTextSegment, type RowProgress, SAVED_STATE_TABLES_QUERY, SEPARATOR_BODY, STATE_DB_FILE, STATE_DB_MIGRATIONS, STATE_DB_PATH, SavedStateDbError, ScopedVaultFS, SidecarGenerator, type SidecarProperty, type SidecarView, StateDB, StateDbLockedError, type StateDbMigration, type StateDbTool, StateDbUnavailableError, StateLock, type StateLockClaim, type StateLockOwner, type StatusOptions, type StatusResult, type StyledRange, SyncBusyError, type SyncDirection, type SyncOptions, SyncOrchestrator, type SyncRecord, type SyncResult, type SyncStatus, type TableLineDesign, type TranslationResult, TreeMapper, UnsupportedBlockStripper, type UpsertSyncRecord, type VaultCompletenessReport, type VaultFS, type ViewConfig, ViewDataProvider, type ViewPropertyConfig, type ViewRenderData, type ViewType, WIKILINK_LOOKUPS, type WatchSyncOptions, type WatchSyncScope, WatchSyncService, type WikilinkEntry, type WikilinkLookup, WikilinkResolver, applicableChoices, assertNoPendingWal, basesViewMappingOf, basesViewTypeOf, choiceForStrategy, classifyBodyFidelity, columnLabel, compactNotionId, computeBufferHash, computeHash, configDirFrom, connectionFolderOf, createDefaultPipeline, extractCalendarEntries, filterByMonth, filterEntries, findConnectionFolders, formatUnifiedDiff, generateColorCSS, generateId, getLogger, getNotionBgColor, getNotionColor, getVisibleProperties, groupEntries, hasColumnLayout, hasDesignMarker, inAnyPathScope, isInternalPath, isMarkdownPath, isRemoteDeletion, lineDiff, lintRenderedMarkdown, matchesPathScope, normalizeNotionId, normalizeVaultPath, noteNameFromPath, notionIdFromInput, notionIdsEqual, operationLabel, parseDesignColor, pendingWalBytes, readColumnLayout, readDesignLine, resolvePropertyName, sanitizeFileName, setLogger, sortEntries, stateDbLockPath, stateDbWalPath, stripMarkdownExtension, summarizeFidelity, systemTimeZone, threeWayMerge, toVaultPath, translateNotionFilter, verifyDatabaseCompleteness, verifyPageCompleteness, wikilinkLookupsIn };