@im-nobsidian/core 0.1.0 → 0.1.2
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 +47 -4
- package/dist/index.js +947 -142
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { Client } from '@notionhq/client';
|
|
3
|
-
import { PageObjectResponse, BlockObjectResponse, PartialBlockObjectResponse } from '@notionhq/client/build/src/api-endpoints.js';
|
|
3
|
+
import { PageObjectResponse, BlockObjectResponse, PageMarkdownResponse, PartialBlockObjectResponse } from '@notionhq/client/build/src/api-endpoints.js';
|
|
4
4
|
|
|
5
5
|
declare const ConfigSchema: z.ZodObject<{
|
|
6
6
|
version: z.ZodLiteral<1>;
|
|
@@ -339,6 +339,7 @@ declare class StateDB {
|
|
|
339
339
|
upsert(record: UpsertSyncRecord): SyncRecord;
|
|
340
340
|
updateStatus(id: string, status: SyncStatus): void;
|
|
341
341
|
updateHash(id: string, hash: string, snapshot?: Buffer | null): void;
|
|
342
|
+
setNotionLastEdited(id: string, lastEdited: string): void;
|
|
342
343
|
delete(id: string): void;
|
|
343
344
|
resolveWikilink(text: string): WikilinkEntry | null;
|
|
344
345
|
resolvePageId(pageId: string): WikilinkEntry | null;
|
|
@@ -383,7 +384,16 @@ declare class NotionClient {
|
|
|
383
384
|
properties?: Record<string, unknown>;
|
|
384
385
|
children?: BlockObjectResponse[];
|
|
385
386
|
}): Promise<PageObjectResponse>;
|
|
387
|
+
createPageWithMarkdown(params: {
|
|
388
|
+
parentId: string;
|
|
389
|
+
parentType: "page" | "database";
|
|
390
|
+
title: string;
|
|
391
|
+
markdown: string;
|
|
392
|
+
properties?: Record<string, unknown>;
|
|
393
|
+
}): Promise<PageObjectResponse>;
|
|
386
394
|
updatePageProperties(pageId: string, properties: Record<string, unknown>): Promise<PageObjectResponse>;
|
|
395
|
+
getPageMarkdown(pageId: string): Promise<PageMarkdownResponse>;
|
|
396
|
+
replacePageMarkdown(pageId: string, markdown: string): Promise<PageMarkdownResponse>;
|
|
387
397
|
getDatabaseSchema(databaseId: string): Promise<Record<string, {
|
|
388
398
|
id: string;
|
|
389
399
|
type: string;
|
|
@@ -406,11 +416,12 @@ declare class NotionClient {
|
|
|
406
416
|
fetchAllChildren(blockId: string): Promise<BlockObjectResponse[]>;
|
|
407
417
|
appendChildren(blockId: string, children: unknown[]): Promise<void>;
|
|
408
418
|
deleteBlock(blockId: string): Promise<void>;
|
|
419
|
+
uploadFile(fileData: Blob, filename: string, contentType: string): Promise<string>;
|
|
409
420
|
search(params: {
|
|
410
421
|
query?: string;
|
|
411
422
|
filter?: {
|
|
412
423
|
property: "object";
|
|
413
|
-
value: "page" | "
|
|
424
|
+
value: "page" | "data_source";
|
|
414
425
|
};
|
|
415
426
|
startCursor?: string;
|
|
416
427
|
pageSize?: number;
|
|
@@ -531,8 +542,14 @@ declare class NotionBlockBuilder {
|
|
|
531
542
|
}
|
|
532
543
|
|
|
533
544
|
type NotionPropertyValue = Record<string, unknown>;
|
|
545
|
+
interface WikilinkResolver$1 {
|
|
546
|
+
resolve(title: string): string | null;
|
|
547
|
+
resolvePageId(pageId: string): string | null;
|
|
548
|
+
}
|
|
534
549
|
declare class PropertyMapper {
|
|
535
550
|
private schema;
|
|
551
|
+
private wikilinkResolver;
|
|
552
|
+
setWikilinkResolver(resolver: WikilinkResolver$1): void;
|
|
536
553
|
loadSchema(properties: Record<string, {
|
|
537
554
|
id: string;
|
|
538
555
|
type: string;
|
|
@@ -558,6 +575,7 @@ declare class ChangeDetector {
|
|
|
558
575
|
|
|
559
576
|
interface VaultFS {
|
|
560
577
|
readFile(path: string): Promise<string>;
|
|
578
|
+
readBinary(path: string): Promise<Buffer>;
|
|
561
579
|
writeFile(path: string, content: string): Promise<void>;
|
|
562
580
|
writeBinary(path: string, data: Buffer): Promise<void>;
|
|
563
581
|
deleteFile(path: string): Promise<void>;
|
|
@@ -597,7 +615,12 @@ declare class SyncOrchestrator {
|
|
|
597
615
|
private resolveNotionParent;
|
|
598
616
|
private isFolderNote;
|
|
599
617
|
private resolveParentPath;
|
|
618
|
+
private pushCreatePage;
|
|
619
|
+
private pushUpdatePage;
|
|
620
|
+
private fetchPageMarkdown;
|
|
600
621
|
private extractParentId;
|
|
622
|
+
private cleanupInterruptedSync;
|
|
623
|
+
private resolveUniqueFilePath;
|
|
601
624
|
}
|
|
602
625
|
|
|
603
626
|
interface PathFilterConfig {
|
|
@@ -611,6 +634,7 @@ declare class NodeVaultFS implements VaultFS {
|
|
|
611
634
|
constructor(rootPath: string, pathConfig?: PathFilterConfig);
|
|
612
635
|
private loadImNobsidianIgnore;
|
|
613
636
|
readFile(path: string): Promise<string>;
|
|
637
|
+
readBinary(path: string): Promise<Buffer>;
|
|
614
638
|
writeFile(path: string, content: string): Promise<void>;
|
|
615
639
|
writeBinary(path: string, data: Buffer): Promise<void>;
|
|
616
640
|
deleteFile(path: string): Promise<void>;
|
|
@@ -629,15 +653,24 @@ interface ImageDownloadResult {
|
|
|
629
653
|
readonly hash: string;
|
|
630
654
|
readonly size: number;
|
|
631
655
|
}
|
|
656
|
+
interface ImageUploadResult {
|
|
657
|
+
readonly localPath: string;
|
|
658
|
+
readonly fileUploadId: string;
|
|
659
|
+
}
|
|
632
660
|
declare class ImageHandler {
|
|
633
661
|
private readonly vaultFs;
|
|
634
662
|
private readonly attachmentFolder;
|
|
635
|
-
|
|
663
|
+
private readonly notionClient?;
|
|
664
|
+
constructor(vaultFs: VaultFS, attachmentFolder?: string, notionClient?: NotionClient | undefined);
|
|
636
665
|
downloadImage(url: string, pageTitle: string): Promise<ImageDownloadResult>;
|
|
637
666
|
downloadAllImages(markdown: string, pageTitle: string): Promise<{
|
|
638
667
|
content: string;
|
|
639
668
|
downloads: ImageDownloadResult[];
|
|
640
669
|
}>;
|
|
670
|
+
uploadLocalImage(localPath: string): Promise<ImageUploadResult>;
|
|
671
|
+
uploadAndAppendImages(pageId: string, images: ImageReference[]): Promise<ImageUploadResult[]>;
|
|
672
|
+
private readImageFromVault;
|
|
673
|
+
private getContentTypeFromPath;
|
|
641
674
|
private isNotionImageUrl;
|
|
642
675
|
private guessExtension;
|
|
643
676
|
}
|
|
@@ -671,6 +704,8 @@ declare class BlockConverter {
|
|
|
671
704
|
private registerTocTransformer;
|
|
672
705
|
private registerBreadcrumbTransformer;
|
|
673
706
|
private registerLinkPreviewTransformer;
|
|
707
|
+
private registerPdfTransformer;
|
|
708
|
+
private registerEmbedTransformer;
|
|
674
709
|
private registerCalloutTransformer;
|
|
675
710
|
markdownToNotionBlocks(markdown: string): unknown[];
|
|
676
711
|
private toggleContents;
|
|
@@ -696,9 +731,12 @@ declare class FrontmatterExtractor implements Processor {
|
|
|
696
731
|
process(input: ProcessorInput): ProcessorOutput;
|
|
697
732
|
}
|
|
698
733
|
|
|
734
|
+
type WikilinkResolverFn = (text: string) => WikilinkEntry | null;
|
|
699
735
|
declare class WikilinkResolver implements Processor {
|
|
736
|
+
private readonly resolve?;
|
|
700
737
|
readonly name = "WikilinkResolver";
|
|
701
738
|
readonly order = 20;
|
|
739
|
+
constructor(resolve?: WikilinkResolverFn | undefined);
|
|
702
740
|
process(input: ProcessorInput): ProcessorOutput;
|
|
703
741
|
}
|
|
704
742
|
|
|
@@ -791,6 +829,8 @@ declare class PropertiesTableRestorer implements Processor {
|
|
|
791
829
|
readonly name = "PropertiesTableRestorer";
|
|
792
830
|
readonly order = 5;
|
|
793
831
|
process(input: ProcessorInput): ProcessorOutput;
|
|
832
|
+
private restoreFromYaml;
|
|
833
|
+
private restoreFromTable;
|
|
794
834
|
}
|
|
795
835
|
|
|
796
836
|
interface MergeResult {
|
|
@@ -930,6 +970,9 @@ interface Logger {
|
|
|
930
970
|
declare function setLogger(logger: Logger): void;
|
|
931
971
|
declare function getLogger(): Logger;
|
|
932
972
|
|
|
933
|
-
|
|
973
|
+
interface PipelineOptions {
|
|
974
|
+
readonly wikilinkResolver?: WikilinkResolverFn;
|
|
975
|
+
}
|
|
976
|
+
declare function createDefaultPipeline(options?: PipelineOptions): ConversionPipeline;
|
|
934
977
|
|
|
935
978
|
export { BlockConverter, CalloutRestorer, CalloutTransformer, ChangeDetector, ColorAnnotator, type Config, ConfigManager, ConfigSchema, type Conflict, ConflictResolver, type ConflictStrategy, type ConversionContext, type ConversionPath, ConversionPipeline, type ConversionResult, DEFAULT_CONFIG, EmbedResolver, type FailedOperation, type FileInfo, type FileSystemEntry, type FileType, FileWatcher, FrontmatterExtractor, FrontmatterGenerator, HtmlAnnotationStripper, type ImageDownloadResult, ImageHandler, type ImageReference, InlineDBParser, type LocalChange, LocalImageRestorer, type Logger, type MappingResult, type MappingType, MathNormalizer, MentionToWikilink, type MergeConflictRegion, type MergeResult, NodeVaultFS, type NotionBlock, NotionBlockBuilder, NotionClient, type NotionClientOptions, type NotionPageNode, type NotionRichText, type RichTextItem as NotionRichTextItem, type OperationType, type PageCreationPlan, type PathFilterConfig, type PreserveMarker, PreserveMarkerCollector, PreserveMarkerInjector, type Processor, type ProcessorInput, type ProcessorMetadata, type ProcessorOutput, type ProgressCallback, PropertiesTableInjector, PropertiesTableRestorer, PropertyMapper, type PullOptions, type PullResult, type PushOptions, type PushResult, type RemoteChange, type ResolutionChoice, type ResolutionResult, type RichTextSegment, StateDB, type StatusResult, type SyncDirection, type SyncOptions, SyncOrchestrator, type SyncRecord, type SyncResult, type SyncStatus, TreeMapper, UnsupportedBlockStripper, type UpsertSyncRecord, type VaultFS, type WatchSyncOptions, WatchSyncService, type WikilinkEntry, WikilinkResolver, computeBufferHash, computeHash, createDefaultPipeline, generateId, getLogger, normalizeNotionId, notionIdsEqual, sanitizeFileName, setLogger, threeWayMerge };
|