@im-nobsidian/core 0.17.1 → 0.19.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 +91 -6
- package/dist/index.js +787 -210
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -435,6 +435,8 @@ interface PushResult {
|
|
|
435
435
|
* 겹치지 않는다. 예전에는 updated 에 섞여, 이름만 바꾼 노트도 「수정」 으로 보였다.
|
|
436
436
|
*/
|
|
437
437
|
readonly moved: number;
|
|
438
|
+
/** 폴더 첨부로 올린 파일 수(ADR-054) — 노트 임베드는 노트와 함께 가 여기 들지 않는다. 없으면 0. */
|
|
439
|
+
readonly uploadedFiles?: number;
|
|
438
440
|
readonly failed: FailedOperation[];
|
|
439
441
|
readonly duration: number;
|
|
440
442
|
/**
|
|
@@ -595,8 +597,9 @@ interface PullResult {
|
|
|
595
597
|
*/
|
|
596
598
|
readonly relinkedPaths?: readonly string[];
|
|
597
599
|
/**
|
|
598
|
-
* dry-run 만 —
|
|
599
|
-
*
|
|
600
|
+
* dry-run 만 — {@link relinkedPaths} 는 이은 것이 아니라 실제 pull 이 다시 이을 것이다(P7). 미리 보기는 노트 글을 받아
|
|
601
|
+
* 견주지 않아 글이 다른 노트는 실제 pull 에서 충돌로 남는다. 자연 이름의 노트는 이은 노트가 없는 볼트에서만 이을 것으로
|
|
602
|
+
* 센다 — 이은 노트가 있는 볼트는 글이 같아야 잇는다. 이을 노트가 없으면 생략.
|
|
600
603
|
*/
|
|
601
604
|
readonly relinkPending?: true;
|
|
602
605
|
/**
|
|
@@ -2818,7 +2821,7 @@ declare class SyncOrchestrator {
|
|
|
2818
2821
|
* 적어 push 가 올린다 — dry-run 은 받지 않아 원격이 바뀐 그대로라, 원격을 보고 거절하지 않는다.
|
|
2819
2822
|
*/
|
|
2820
2823
|
/**
|
|
2821
|
-
* @param relinkedByPull 같은 sync 의 dry-run pull 이 다시 이을
|
|
2824
|
+
* @param relinkedByPull 같은 sync 의 dry-run pull 이 받거나 다시 이을 것이 있다 — 실제 sync 는 받으며 먼저 잇고 올리므로
|
|
2822
2825
|
* 상태 기록이 비었어도 막지 않는다({@link assertVaultLinked}).
|
|
2823
2826
|
*/
|
|
2824
2827
|
private executePush;
|
|
@@ -3236,7 +3239,7 @@ declare class ImageHandler {
|
|
|
3236
3239
|
/**
|
|
3237
3240
|
* 임베드 경로가 가리킬 수 있는 볼트 실제 파일 후보를 우선순위대로 만든다(F23).
|
|
3238
3241
|
* Obsidian 위키링크 임베드는 노트 옆 파일을 파일명만으로 참조하는 게 관례라
|
|
3239
|
-
* 노트 폴더 → 볼트 루트 → attachments/ 순.
|
|
3242
|
+
* 노트 폴더 → 볼트 루트 → attachments/ 순. 세 곳에 없으면 볼트 어디서든 이름으로 찾는다({@link VaultFileIndex}).
|
|
3240
3243
|
*
|
|
3241
3244
|
* push(업로드)와 pull(원본 복원)이 **같은 사다리**를 봐야 왕복이 닫힌다. 예전에는
|
|
3242
3245
|
* pull 쪽이 볼트 루트만 확인해서, `__e2e_probe__/노트.md` 안의 `![[t-img.png]]` 는
|
|
@@ -3244,6 +3247,9 @@ declare class ImageHandler {
|
|
|
3244
3247
|
* 새로 받았다(실측) — 왕복할 때마다 첨부가 한 벌씩 늘어난다.
|
|
3245
3248
|
*/
|
|
3246
3249
|
private vaultCandidates;
|
|
3250
|
+
private indexOfFiles;
|
|
3251
|
+
/** 볼트의 첨부 이름표 — 처음 쓸 때 만든다. */
|
|
3252
|
+
private get fileIndex();
|
|
3247
3253
|
/**
|
|
3248
3254
|
* 임베드 경로를 볼트 실제 파일로 해석해 읽는다(F23).
|
|
3249
3255
|
* 폴백은 조용히 진행하고, 전부 실패했을 때만 마지막 오류를 던진다.
|
|
@@ -3255,6 +3261,8 @@ declare class ImageHandler {
|
|
|
3255
3261
|
}>;
|
|
3256
3262
|
private parseNotionFileUrl;
|
|
3257
3263
|
private downloadFile;
|
|
3264
|
+
/** 받은 파일의 이름 — `<줄기>-<해시><확장자>`. */
|
|
3265
|
+
private fileNameOf;
|
|
3258
3266
|
private isNotionImageUrl;
|
|
3259
3267
|
private isNotionFileUrl;
|
|
3260
3268
|
/**
|
|
@@ -3281,6 +3289,13 @@ declare class ImageHandler {
|
|
|
3281
3289
|
*/
|
|
3282
3290
|
type NotionBlockType = "image" | "pdf" | "video" | "audio" | "file";
|
|
3283
3291
|
|
|
3292
|
+
/** 폴더 페이지에 실린 폴더 첨부 하나. */
|
|
3293
|
+
interface FolderFileRef {
|
|
3294
|
+
readonly url: string;
|
|
3295
|
+
/** 올린 파일 이름 — Notion 이 주소 끝에 싣는다. 받을 때 이 이름으로 쓴다. */
|
|
3296
|
+
readonly name: string;
|
|
3297
|
+
}
|
|
3298
|
+
|
|
3284
3299
|
/** 첨부 다운로드 운영 튜닝값. 미지정 시 기존 동작과 동일한 기본값 사용. */
|
|
3285
3300
|
interface FileHandlerOptions {
|
|
3286
3301
|
/** 다운로드에 쓸 fetch 구현(테스트 주입용). 기본 전역 fetch. */
|
|
@@ -3289,6 +3304,21 @@ interface FileHandlerOptions {
|
|
|
3289
3304
|
readonly downloadTimeoutMs?: number;
|
|
3290
3305
|
/** 첨부 1건 업로드 전체의 시간 상한(ms). 기본 30분. 0 이하면 상한 없음. */
|
|
3291
3306
|
readonly itemTimeoutMs?: number;
|
|
3307
|
+
/**
|
|
3308
|
+
* pull 이 받은 그림 · 파일을 두는 폴더(`paths.attachments`). 그 안의 파일은 폴더 첨부로 올리지 않는다 — 받은 것을
|
|
3309
|
+
* 다시 올리면 Notion 에 사본이 생긴다.
|
|
3310
|
+
*/
|
|
3311
|
+
readonly attachmentsFolder?: string;
|
|
3312
|
+
/**
|
|
3313
|
+
* 지운 폴더 첨부를 다른 쪽에서도 지우나(`sync.deleteSync`) — 볼트에서 지우면 Notion 의 블록을, Notion 에서 지우면 볼트의
|
|
3314
|
+
* 파일을. 기본 false.
|
|
3315
|
+
*/
|
|
3316
|
+
readonly deleteSync?: boolean;
|
|
3317
|
+
}
|
|
3318
|
+
/** 노트 없는 폴더의 Notion 페이지를 마련하는 쪽 — push 의 폴더 배치(`FolderPlacement`). */
|
|
3319
|
+
interface FolderPageProvider {
|
|
3320
|
+
/** 폴더의 페이지를 마련한다. 이미 있으면 그대로 둔다. 마련할 수 없으면 까닭과 함께 던진다. */
|
|
3321
|
+
ensureFolderPage(folder: string): Promise<void>;
|
|
3292
3322
|
}
|
|
3293
3323
|
interface FileUploadResult {
|
|
3294
3324
|
readonly localPath: string;
|
|
@@ -3309,6 +3339,8 @@ declare class FileHandler {
|
|
|
3309
3339
|
private readonly customFetch?;
|
|
3310
3340
|
private readonly downloadTimeoutMs;
|
|
3311
3341
|
private readonly itemTimeoutMs;
|
|
3342
|
+
private readonly attachmentsFolder;
|
|
3343
|
+
private readonly deleteSync;
|
|
3312
3344
|
constructor(vaultFs: VaultFS, notionClient: NotionClient, stateDb: IStateDB, concurrency?: number, options?: FileHandlerOptions);
|
|
3313
3345
|
private get fetchFn();
|
|
3314
3346
|
pushFilesForFolder(folderPageId: string, folderPath: string): Promise<FileUploadResult[]>;
|
|
@@ -3329,6 +3361,12 @@ declare class FileHandler {
|
|
|
3329
3361
|
* @returns 업로드 결과. 변경 없음(스킵)이거나 실패했으면 null.
|
|
3330
3362
|
*/
|
|
3331
3363
|
private pushSingleFile;
|
|
3364
|
+
/** 올린 뒤 바뀌지 않았나 — 크기가 같으면 읽지 않는다. */
|
|
3365
|
+
private isUnchanged;
|
|
3366
|
+
/** pull 이 받은 것을 두는 폴더 안인가. */
|
|
3367
|
+
private inAttachmentsFolder;
|
|
3368
|
+
/** 폴더 첨부를 둘 Notion 페이지 — 폴더 노트 없는 폴더의 페이지(폴더 레코드)만. 맨 위는 루트 기록이 있을 때만. */
|
|
3369
|
+
private folderPageOf;
|
|
3332
3370
|
/**
|
|
3333
3371
|
* 업로드 후보 목록 — 도구 내부 산출물(`.base`/`.notion.json`)은 아예 빼고, Notion 이 받지 않는
|
|
3334
3372
|
* 형식은 따로 모은다.
|
|
@@ -3347,7 +3385,43 @@ declare class FileHandler {
|
|
|
3347
3385
|
* @param failed 올리지 못한 첨부를 담을 곳 — push 결과의 `failed` 를 넘기면 CLI · 플러그인이 처리하지 못한 것으로
|
|
3348
3386
|
* 보인다. 예전엔 경고 로그로만 남아 push 가 「실패 0」 으로 끝났다.
|
|
3349
3387
|
*/
|
|
3350
|
-
pushAllFiles(failed?: FailedOperation[]): Promise<FileUploadResult[]>;
|
|
3388
|
+
pushAllFiles(failed?: FailedOperation[], folders?: FolderPageProvider): Promise<FileUploadResult[]>;
|
|
3389
|
+
/**
|
|
3390
|
+
* 볼트에서 지운 폴더 첨부를 Notion 에서도 지운다(deleteSync) — 폴더 페이지에 적힌 파일 가운데 볼트에 없는 것의 블록과 기록.
|
|
3391
|
+
* 포함 · 제외 패턴으로 빠진 파일은 볼트에 있어 지우지 않는다.
|
|
3392
|
+
*/
|
|
3393
|
+
private removeDeletedFolderFiles;
|
|
3394
|
+
/** 폴더 첨부를 둘 페이지 — 노트 없는 폴더면 마련한다. 둘 곳이 없으면 그 파일들을 `stranded` 에 담고 null. */
|
|
3395
|
+
private provideFolderPage;
|
|
3396
|
+
/**
|
|
3397
|
+
* 둘 곳이 없어 올리지 않은 폴더 첨부 — 경고로 알린다. 예전에는 디버그 로그로만 남아 파일이 Notion 에 가지 않은 것을 알 수
|
|
3398
|
+
* 없었다. 노트에 붙이면 그 노트와 함께 올라간다.
|
|
3399
|
+
*/
|
|
3400
|
+
private reportStranded;
|
|
3401
|
+
/** 볼트의 노트가 붙인 파일 이름 — {@link embeddedNamesOf}. 읽지 못한 노트는 건너뛴다. */
|
|
3402
|
+
private embeddedNames;
|
|
3403
|
+
/**
|
|
3404
|
+
* 폴더 페이지의 폴더 첨부를 그 폴더에 받는다 — 올린 이름 그대로. Notion 파일 id 가 적어 둔 것과 같으면(올린 볼트 · 앞서
|
|
3405
|
+
* 받은 볼트) 받지 않는다. Notion 에서 바뀐 파일은 볼트 쪽이 그대로일 때만 덮는다 — 볼트에서도 고쳤으면 두고 알린다(다음
|
|
3406
|
+
* push 가 볼트의 것을 올린다).
|
|
3407
|
+
*
|
|
3408
|
+
* @param complete 본문을 끝까지 받았나 — 그럴 때만 Notion 에서 지운 파일을 볼트에서 지운다(deleteSync). 잘린 본문에 없는
|
|
3409
|
+
* 파일은 지운 것이 아니다.
|
|
3410
|
+
* @returns 새로 받거나 바꾼 파일 수
|
|
3411
|
+
*/
|
|
3412
|
+
receiveFolderFiles(folder: string, pageId: string, files: readonly FolderFileRef[], complete?: boolean): Promise<number>;
|
|
3413
|
+
/**
|
|
3414
|
+
* Notion 에서 지운 폴더 첨부를 볼트에서 지운다 — 지난 동기화 그대로일 때만. 볼트에서 고쳤으면 두고 기록만 놓는다 — 다음 push
|
|
3415
|
+
* 가 다시 올린다(노트의 원격 삭제와 같은 규칙).
|
|
3416
|
+
*/
|
|
3417
|
+
private removeLocalFolderFile;
|
|
3418
|
+
/**
|
|
3419
|
+
* 폴더 첨부 하나를 받는다. 볼트에 같은 경로가 있으면: 같은 내용이면 적기만 하고, 지난 동기화 뒤 볼트에서 그대로인 파일은
|
|
3420
|
+
* 덮고(`entry`), 그 밖(볼트에서 고친 것 · 처음 보는 다른 파일)은 두고 알린다.
|
|
3421
|
+
*
|
|
3422
|
+
* @returns 볼트에 썼는가
|
|
3423
|
+
*/
|
|
3424
|
+
private receiveOne;
|
|
3351
3425
|
downloadFileBlock(url: string, filename: string, targetFolder: string): Promise<FileDownloadResult>;
|
|
3352
3426
|
downloadFileBlocks(blocks: Array<{
|
|
3353
3427
|
type: string;
|
|
@@ -3355,6 +3429,12 @@ declare class FileHandler {
|
|
|
3355
3429
|
caption?: string;
|
|
3356
3430
|
}>, targetFolder: string): Promise<FileDownloadResult[]>;
|
|
3357
3431
|
private uploadFile;
|
|
3432
|
+
/** 이 페이지에서 같은 이름의 파일 블록 중 방금 붙인 것 말고를 지운다. */
|
|
3433
|
+
private removeOlderBlocks;
|
|
3434
|
+
/**
|
|
3435
|
+
* 폴더 첨부의 파일 블록 — 캡션에 파일 이름을 적는다. 받는 쪽이 그 표시로 폴더 첨부를 알아본다({@link folderFilesOf}) —
|
|
3436
|
+
* 자식 페이지가 없는 폴더 페이지는 PDF 하나만 붙인 노트와 모양이 같다.
|
|
3437
|
+
*/
|
|
3358
3438
|
private createFileBlock;
|
|
3359
3439
|
private extractFilename;
|
|
3360
3440
|
}
|
|
@@ -3564,6 +3644,8 @@ interface PlannedRow {
|
|
|
3564
3644
|
readonly moves?: readonly RemoteMove[];
|
|
3565
3645
|
/** 로컬도 고친 행을 실제 pull 이 받지 않는 까닭 — 없으면 받는다. */
|
|
3566
3646
|
readonly resolution?: PlannedResolution;
|
|
3647
|
+
/** `create` 만 — 상태 기록에 없던 같은 자리의 행 노트를 다시 잇는다(P7). 새로 받는 것으로 세지 않는다. */
|
|
3648
|
+
readonly relink?: true;
|
|
3567
3649
|
}
|
|
3568
3650
|
/**
|
|
3569
3651
|
* 로컬도 고친 노트를 실제 pull 이 어떻게 처리하나 — 충돌로 남김 · 합침(merge) · 받지 않음(원격이 그대로거나
|
|
@@ -3719,6 +3801,8 @@ declare class DatabaseSyncer {
|
|
|
3719
3801
|
* 볼트에서 옮긴 레코드 — dry-run 은 옮겨 적지 않아 이동 WAL 이 없다. 실제 pull 처럼 볼트가 먼저다.
|
|
3720
3802
|
*/
|
|
3721
3803
|
movingInVault?: ReadonlySet<string>;
|
|
3804
|
+
/** 이번 미리 보기가 다시 이을 것으로 고른 자리({@link pathKey}) — 고르면 더한다. */
|
|
3805
|
+
relinkTaken?: Set<string>;
|
|
3722
3806
|
}): Promise<PlannedRow[]>;
|
|
3723
3807
|
/**
|
|
3724
3808
|
* 받은 행이 지난 사본 그대로인가 — 렌더한 글이 달라도 받을 것이 없으면 그 사이 로컬 편집을 충돌로 올리지 않는다
|
|
@@ -4031,7 +4115,8 @@ declare class WikilinkResolver implements Processor {
|
|
|
4031
4115
|
process(input: ProcessorInput): ProcessorOutput;
|
|
4032
4116
|
/**
|
|
4033
4117
|
* `[[노트#제목]]` · `[[노트#^블록]]` · `[[#제목]]` → `[글자](https://www.notion.so/<페이지>#<블록>)`. 글자는 별칭,
|
|
4034
|
-
* 없으면 Obsidian 이 보이는 「노트 > 제목」 — pull 이 그 글자면 별칭을 붙이지 않는다.
|
|
4118
|
+
* 없으면 Obsidian 이 보이는 「노트 > 제목」 — pull 이 그 글자면 별칭을 붙이지 않는다. 앵커 링크가 아니면 null, 못 풀면
|
|
4119
|
+
* 그 까닭({@link AnchorMiss}).
|
|
4035
4120
|
*/
|
|
4036
4121
|
private anchorLink;
|
|
4037
4122
|
}
|