@interactive-inc/docs-client 1.1.2 → 2.0.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.
@@ -1,8 +1,13 @@
1
1
  import * as fs from 'fs/promises';
2
2
 
3
3
  // lib/modules/path-system/doc-path-system.ts
4
- var DocPathSystem = class {
4
+ var DocPathSystem = class _DocPathSystem {
5
5
  separator = "/";
6
+ constructor() {
7
+ if (new.target === _DocPathSystem) {
8
+ Object.freeze(this);
9
+ }
10
+ }
6
11
  /**
7
12
  * Join paths
8
13
  */
@@ -58,8 +63,8 @@ var DocPathSystem = class {
58
63
  * Calculate relative path
59
64
  */
60
65
  relative(from, to) {
61
- const fromSegments = from.split(this.separator).filter(Boolean);
62
- const toSegments = to.split(this.separator).filter(Boolean);
66
+ const fromSegments = from.split(this.separator).filter((s) => s !== "" && s !== ".");
67
+ const toSegments = to.split(this.separator).filter((s) => s !== "" && s !== ".");
63
68
  let commonLength = 0;
64
69
  for (let i = 0; i < Math.min(fromSegments.length, toSegments.length); i++) {
65
70
  if (fromSegments[i] === toSegments[i]) {
@@ -268,6 +273,7 @@ var DocFileSystemNodeRead = class {
268
273
  constructor(props) {
269
274
  this.basePath = props.basePath;
270
275
  this.pathSystem = props.pathSystem ?? new DocPathSystem();
276
+ Object.freeze(this);
271
277
  }
272
278
  /**
273
279
  * Read file content at the specified path
@@ -317,9 +323,7 @@ var DocFileSystemNodeRead = class {
317
323
  if (fileNames instanceof Error) {
318
324
  return fileNames;
319
325
  }
320
- return fileNames.map(
321
- (fileName) => this.pathSystem.join(relativePath, fileName)
322
- );
326
+ return fileNames.map((fileName) => this.pathSystem.join(relativePath, fileName));
323
327
  } catch (error) {
324
328
  return error instanceof Error ? error : new Error(`Failed to read directory file paths at ${relativePath}`);
325
329
  }
@@ -429,6 +433,7 @@ var DocFileSystemNodeWrite = class {
429
433
  this.basePath = props.basePath;
430
434
  this.pathSystem = props.pathSystem ?? new DocPathSystem();
431
435
  this.reader = props.reader;
436
+ Object.freeze(this);
432
437
  }
433
438
  /**
434
439
  * Write content to file at the specified path (creates directory if needed)
@@ -498,9 +503,7 @@ var DocFileSystemNodeWrite = class {
498
503
  await fs.copyFile(sourceFullPath, destFullPath);
499
504
  return null;
500
505
  } catch (error) {
501
- return error instanceof Error ? error : new Error(
502
- `Failed to copy file from ${sourcePath} to ${destinationPath}`
503
- );
506
+ return error instanceof Error ? error : new Error(`Failed to copy file from ${sourcePath} to ${destinationPath}`);
504
507
  }
505
508
  }
506
509
  /**
@@ -513,9 +516,7 @@ var DocFileSystemNodeWrite = class {
513
516
  await fs.rename(sourceFullPath, destFullPath);
514
517
  return null;
515
518
  } catch (error) {
516
- return error instanceof Error ? error : new Error(
517
- `Failed to move file from ${sourcePath} to ${destinationPath}`
518
- );
519
+ return error instanceof Error ? error : new Error(`Failed to move file from ${sourcePath} to ${destinationPath}`);
519
520
  }
520
521
  }
521
522
  };
package/build/index.d.ts CHANGED
@@ -1,6 +1,19 @@
1
- import { D as DocFileSystemInterface, a as DocPathSystem } from './doc-file-system.interface-C5vpYrOL.js';
1
+ import { D as DocFileSystemInterface, a as DocPathSystem } from './doc-file-system.interface-CmQywbuP.js';
2
2
  import { z } from 'zod';
3
- import { zDocFileMd, zDocFileUnknown, zDocClientConfig, zDocFilePath, zDocFileIndexSchemaField, zDocSchemaFieldText, zDocSchemaFieldNumber, zDocSchemaFieldBoolean, zDocSchemaFieldRelation, zDocSchemaFieldSelectText, zDocSchemaFieldSelectNumber, zDocSchemaFieldMultiText, zDocSchemaFieldMultiNumber, zDocSchemaFieldMultiRelation, zDocSchemaFieldMultiSelectText, zDocSchemaFieldMultiSelectNumber, zDocFileIndex, zDocRelation, zDocRelationFile, zDocMetaFieldRelation, zDocMetaFieldMultiRelation, zDocMetaFieldText, zDocMetaFieldNumber, zDocMetaFieldBoolean, zDocMetaFieldMultiText, zDocMetaFieldMultiNumber, zDocRelationField, zDocMetaField, zDocMetaFieldSelectText, zDocMetaFieldSelectNumber, zDocMetaFieldMultiSelectText, zDocMetaFieldMultiSelectNumber, zDocMetaFieldTypeText, zDocMetaFieldTypeNumber, zDocMetaFieldTypeBoolean, zDocMetaFieldTypeSelectText, zDocMetaFieldTypeSelectNumber, zDocMetaFieldTypeRelation, zDocMetaFieldType } from './models.js';
3
+ import { zDocFileMd, zDocFileUnknown, zDocClientConfig, zDocFilePath, zDocFileIndexSchemaField, zDocSchemaFieldText, zDocSchemaFieldNumber, zDocSchemaFieldBoolean, zDocSchemaFieldRelation, zDocSchemaFieldSelectText, zDocSchemaFieldSelectNumber, zDocSchemaFieldMultiText, zDocSchemaFieldMultiNumber, zDocSchemaFieldMultiRelation, zDocSchemaFieldMultiSelectText, zDocSchemaFieldMultiSelectNumber, zDocDirectoryMeta, zDocFileIndex, zDocRelation, zDocRelationFile, zDocMetaFieldRelation, zDocMetaFieldMultiRelation, zDocMetaFieldText, zDocMetaFieldNumber, zDocMetaFieldBoolean, zDocMetaFieldMultiText, zDocMetaFieldMultiNumber, zDocRelationField, zDocMetaField, zDocMetaFieldSelectText, zDocMetaFieldSelectNumber, zDocMetaFieldMultiSelectText, zDocMetaFieldMultiSelectNumber, zDocMetaFieldTypeText, zDocMetaFieldTypeNumber, zDocMetaFieldTypeBoolean, zDocMetaFieldTypeSelectText, zDocMetaFieldTypeSelectNumber, zDocMetaFieldTypeRelation, zDocMetaFieldType } from './models.js';
4
+
5
+ type SafeMethod<F> = F extends (...args: infer A) => Promise<infer R> ? (...args: A) => Promise<R | Error> : F;
6
+ /**
7
+ * All async methods return T | Error instead of throwing.
8
+ *
9
+ * Promise を返すメソッドのみ T | Error に変換される。AsyncGenerator を返すメソッド
10
+ * (filesGenerator など)は変換されないため、安全に列挙したい場合は配列を返す
11
+ * files()/mdFiles() を .safe 経由で使うこと
12
+ */
13
+ type Safe<T> = {
14
+ [K in keyof T as K extends "safe" ? never : K]: SafeMethod<T[K]>;
15
+ };
16
+ declare function createSafeProxy<T extends object>(target: T): Safe<T>;
4
17
 
5
18
  /**
6
19
  * Single boolean type schema field
@@ -298,7 +311,6 @@ declare class DocFileIndexSchemaValue<T extends DocCustomSchema> {
298
311
  toJson(): DocFileIndexSchema<keyof T>;
299
312
  /**
300
313
  * Create empty schema entity
301
- * biome-ignore lint/complexity/noBannedTypes: {} as DocCustomSchema
302
314
  */
303
315
  static empty(): DocFileIndexSchemaValue<{}>;
304
316
  }
@@ -398,6 +410,11 @@ declare class DocFileIndexContentValue<T extends DocCustomSchema> {
398
410
  * Generate from Markdown text
399
411
  */
400
412
  static fromMarkdown<T extends DocCustomSchema>(markdown: string, customSchema: T, config: DocClientConfig): DocFileIndexContentValue<T>;
413
+ /**
414
+ * Generate from Markdown text with .meta.json
415
+ * FrontMatter is ignored, only body/title/description are extracted
416
+ */
417
+ static fromMarkdownWithDirectoryMeta<T extends DocCustomSchema>(markdown: string, customSchema: T, config: DocClientConfig, directoryMeta: DocDirectoryMeta): DocFileIndexContentValue<T>;
401
418
  /**
402
419
  * Update content
403
420
  */
@@ -414,6 +431,10 @@ declare class DocFileIndexContentValue<T extends DocCustomSchema> {
414
431
  * Generate default index.md content
415
432
  */
416
433
  static empty<T extends DocCustomSchema = DocCustomSchema>(directoryName: string, customSchema: T, config: DocClientConfig): DocFileIndexContentValue<T>;
434
+ /**
435
+ * Generate default index.md content with .meta.json
436
+ */
437
+ static emptyWithDirectoryMeta<T extends DocCustomSchema = DocCustomSchema>(directoryName: string, customSchema: T, config: DocClientConfig, directoryMeta: DocDirectoryMeta): DocFileIndexContentValue<T>;
417
438
  /**
418
439
  * Generate complete text combining FrontMatter and body
419
440
  */
@@ -529,41 +550,18 @@ declare class DocFileRelationReference {
529
550
  private readonly props;
530
551
  private readonly pathSystem;
531
552
  constructor(props: Props$8);
553
+ get safe(): Safe<this>;
532
554
  get fileSystem(): DocFileSystemInterface;
533
555
  get basePath(): string;
534
- /**
535
- * Relation path
536
- */
537
556
  get path(): string;
538
- /**
539
- * Full path
540
- */
541
557
  get fullPath(): string;
542
- read(): Promise<DocRelationValue | Error | null>;
543
- /**
544
- * Read list of relation files
545
- */
546
- readFiles(): Promise<DocRelationFileValue[] | Error>;
547
- /**
548
- * Read single relation file
549
- */
550
- readFile(filePath: string): Promise<DocRelationFileValue | Error | null>;
551
- /**
552
- * Check if file exists
553
- */
558
+ read(): Promise<DocRelationValue | null>;
559
+ readFiles(): Promise<DocRelationFileValue[]>;
560
+ readFile(filePath: string): Promise<DocRelationFileValue | null>;
554
561
  exists(slug: string): Promise<boolean>;
555
- /**
556
- * Get list of file names (without extension)
557
- */
558
- readSlugs(): Promise<string[] | Error>;
559
- /**
560
- * Get file count
561
- */
562
- count(): Promise<number | Error>;
563
- /**
564
- * Check if empty
565
- */
566
- isEmpty(): Promise<boolean | Error>;
562
+ readSlugs(): Promise<string[]>;
563
+ count(): Promise<number>;
564
+ isEmpty(): Promise<boolean>;
567
565
  }
568
566
 
569
567
  type Props$7<T extends DocCustomSchema> = {
@@ -581,62 +579,31 @@ declare class DocFileIndexReference<T extends DocCustomSchema> {
581
579
  private readonly pathSystem;
582
580
  private readonly customSchema;
583
581
  constructor(props: Props$7<T>);
582
+ get safe(): Safe<this>;
584
583
  get fileSystem(): DocFileSystemInterface;
585
584
  get basePath(): string;
586
585
  get filePath(): string;
587
586
  get fileFullPath(): string;
588
- get durectoryPath(): string;
589
- read(): Promise<DocFileIndexEntity<T> | Error>;
587
+ get directoryPath(): string;
588
+ read(): Promise<DocFileIndexEntity<T>>;
589
+ private readDirectoryMeta;
590
590
  readSchemaValue(): Promise<DocFileIndexSchema<RecordKey>>;
591
- /**
592
- * Read file content
593
- */
594
- readContent(): Promise<Error | string>;
591
+ readContent(): Promise<string>;
595
592
  /**
596
593
  * Create empty DocFileIndexEntity
597
594
  */
598
595
  empty(): DocFileIndexEntity<T>;
599
- /**
600
- * Write content to file
601
- */
602
- writeContent(content: string): Promise<Error | null>;
603
- /**
604
- * Write entity
605
- */
606
- write(entity: DocFileIndexEntity<T>): Promise<Error | null>;
607
- /**
608
- * Create new file with default content
609
- */
610
- writeDefault(): Promise<Error | null>;
611
- /**
612
- * Delete file
613
- */
614
- delete(): Promise<Error | null>;
615
- /**
616
- * Check if file exists
617
- */
596
+ writeContent(content: string): Promise<void>;
597
+ write(entity: DocFileIndexEntity<T>): Promise<void>;
598
+ writeDefault(): Promise<void>;
599
+ delete(): Promise<void>;
618
600
  exists(): Promise<boolean>;
619
- relations(): Promise<DocFileRelationReference[] | Error>;
620
- readRelations(): Promise<DocRelationValue[] | Error>;
621
- /**
622
- * Get file size in bytes
623
- */
624
- size(): Promise<number | Error>;
625
- /**
626
- * Get last modified date
627
- */
628
- lastModified(): Promise<Date | Error>;
629
- /**
630
- * Get file creation date
631
- */
632
- createdAt(): Promise<Date | Error>;
633
- /**
634
- * Move file to archive and return new reference
635
- */
601
+ relations(): Promise<DocFileRelationReference[]>;
602
+ readRelations(): Promise<DocRelationValue[]>;
603
+ size(): Promise<number>;
604
+ lastModified(): Promise<Date>;
605
+ createdAt(): Promise<Date>;
636
606
  archive(archiveDirectoryName?: string): Promise<DocFileIndexReference<T>>;
637
- /**
638
- * Restore file from archive and return new reference
639
- */
640
607
  restore(archiveDirectoryName?: string): Promise<DocFileIndexReference<T>>;
641
608
  }
642
609
 
@@ -817,68 +784,30 @@ declare class DocFileUnknownReference<T extends DocCustomSchema> {
817
784
  private readonly pathSystem;
818
785
  private readonly customSchema;
819
786
  constructor(props: Props$6<T>);
787
+ get safe(): Safe<this>;
820
788
  get fileSystem(): DocFileSystemInterface;
821
789
  get basePath(): string;
822
790
  get path(): string;
823
791
  get directoryPath(): string;
824
792
  get fileFullPath(): string;
825
793
  directory(): DocDirectoryReference<T>;
826
- read(): Promise<Error | DocFileUnknownEntity>;
827
- /**
828
- * Read file content
829
- */
830
- readContent(): Promise<Error | string>;
794
+ read(): Promise<DocFileUnknownEntity>;
795
+ readContent(): Promise<string>;
831
796
  /**
832
797
  * Create empty DocFileUnknownEntity
833
798
  */
834
799
  empty(): DocFileUnknownEntity;
835
- /**
836
- * Write content to file
837
- */
838
- writeContent(content: string): Promise<Error | null>;
839
- /**
840
- * Write entity
841
- */
842
- write(entity: DocFileUnknownEntity): Promise<Error | null>;
843
- /**
844
- * Write raw content
845
- */
846
- writeRaw(content: string): Promise<Error | null>;
847
- /**
848
- * Delete file
849
- */
850
- delete(): Promise<Error | null>;
851
- /**
852
- * Check if file exists
853
- */
800
+ writeContent(content: string): Promise<void>;
801
+ write(entity: DocFileUnknownEntity): Promise<void>;
802
+ writeRaw(content: string): Promise<void>;
803
+ delete(): Promise<void>;
854
804
  exists(): Promise<boolean>;
855
- /**
856
- * Copy file
857
- */
858
- copyTo(destinationPath: string): Promise<Error | null>;
859
- /**
860
- * Move file
861
- */
862
- moveTo(destinationPath: string): Promise<Error | null>;
863
- /**
864
- * Get file size in bytes
865
- */
866
- size(): Promise<number | Error>;
867
- /**
868
- * Get file last modified time
869
- */
870
- lastModified(): Promise<Date | Error>;
871
- /**
872
- * Get file creation time
873
- */
874
- createdAt(): Promise<Date | Error>;
875
- /**
876
- * Move file to archive and return new reference
877
- */
805
+ copyTo(destinationPath: string): Promise<void>;
806
+ moveTo(destinationPath: string): Promise<void>;
807
+ size(): Promise<number>;
808
+ lastModified(): Promise<Date>;
809
+ createdAt(): Promise<Date>;
878
810
  archive(archiveDirectoryName?: string): Promise<DocFileUnknownReference<T>>;
879
- /**
880
- * Restore file from archive and return new reference
881
- */
882
811
  restore(archiveDirectoryName?: string): Promise<DocFileUnknownReference<T>>;
883
812
  }
884
813
 
@@ -901,6 +830,7 @@ declare class DocDirectoryReference<T extends DocCustomSchema> {
901
830
  private readonly pathSystem;
902
831
  private readonly customSchema;
903
832
  constructor(props: Props$5<T>);
833
+ get safe(): Safe<this>;
904
834
  get fileSystem(): DocFileSystemInterface;
905
835
  get basePath(): string;
906
836
  get config(): DocClientConfig;
@@ -918,10 +848,10 @@ declare class DocDirectoryReference<T extends DocCustomSchema> {
918
848
  get indexFilePath(): string;
919
849
  get archiveDirectoryName(): string;
920
850
  get name(): string;
921
- fileNames(): Promise<string[] | Error>;
922
- archivedFileNames(): Promise<string[] | Error>;
851
+ fileNames(): Promise<string[]>;
852
+ archivedFileNames(): Promise<string[]>;
923
853
  filesGenerator(): AsyncGenerator<DocFileDirectoryReference<T>, void, unknown>;
924
- mdFilesGenerator(): AsyncGenerator<DocFileMdReference<T> | Error, void, unknown>;
854
+ mdFilesGenerator(): AsyncGenerator<DocFileMdReference<T>, void, unknown>;
925
855
  files(): Promise<DocFileDirectoryReference<T>[]>;
926
856
  mdFiles(): Promise<DocFileMdReference<T>[]>;
927
857
  file<FileName extends string>(fileName: FileName): InferReference<FileName, T>;
@@ -929,30 +859,15 @@ declare class DocDirectoryReference<T extends DocCustomSchema> {
929
859
  readFiles(): Promise<DocFileDirectoryEntity<T>[]>;
930
860
  readMdFiles(): Promise<DocFileMdEntity<T>[]>;
931
861
  readUnknownFiles(): Promise<DocFileUnknownEntity[]>;
932
- /**
933
- * Get list of subdirectory names
934
- */
935
862
  directoryNames(): Promise<string[]>;
936
- /**
937
- * Get subdirectory references
938
- */
939
863
  directories(): Promise<DocDirectoryReference<T>[]>;
940
- /**
941
- * Get single subdirectory reference
942
- */
943
864
  directory(directoryName: string): DocDirectoryReference<T>;
944
865
  directory<S extends DocCustomSchema>(directoryName: string, customSchema: S): DocDirectoryReference<S>;
945
866
  indexFile(): DocFileIndexReference<T>;
946
- readIndexFile(): Promise<DocFileIndexEntity<T> | Error>;
947
- writeFile(entity: DocFileIndexEntity<T> | DocFileMdEntity<T> | DocFileUnknownEntity): Promise<Error | null>;
867
+ readIndexFile(): Promise<DocFileIndexEntity<T>>;
868
+ writeFile(entity: DocFileIndexEntity<T> | DocFileMdEntity<T> | DocFileUnknownEntity): Promise<void>;
948
869
  exists(): Promise<boolean>;
949
- /**
950
- * Create new Markdown file
951
- */
952
870
  createMdFile(fileName?: string): Promise<DocFileMdReference<T>>;
953
- /**
954
- * Generate unique filename
955
- */
956
871
  private uniqueFileName;
957
872
  }
958
873
 
@@ -971,6 +886,7 @@ declare class DocFileMdReference<T extends DocCustomSchema> {
971
886
  private readonly pathSystem;
972
887
  private readonly customSchema;
973
888
  constructor(props: Props$4<T>);
889
+ get safe(): Safe<this>;
974
890
  get fileSystem(): DocFileSystemInterface;
975
891
  get basePath(): string;
976
892
  get path(): string;
@@ -980,77 +896,36 @@ declare class DocFileMdReference<T extends DocCustomSchema> {
980
896
  get name(): string;
981
897
  get nameWithExtension(): string;
982
898
  exists(): Promise<boolean>;
983
- read(): Promise<DocFileMdEntity<T> | Error>;
984
- /**
985
- * Read file content
986
- */
987
- readText(): Promise<Error | string>;
899
+ read(): Promise<DocFileMdEntity<T>>;
900
+ readText(): Promise<string>;
988
901
  /**
989
902
  * Create empty DocFileMdEntity
990
903
  */
991
904
  empty(): DocFileMdEntity<T>;
992
- /**
993
- * Write entity
994
- */
995
- write(entity: DocFileMdEntity<T>): Promise<Error | null>;
996
- writeText(text: string): Promise<Error | null>;
997
- /**
998
- * Create new file with default content
999
- */
1000
- writeDefault(): Promise<Error | null>;
1001
- /**
1002
- * Delete file
1003
- */
1004
- delete(): Promise<Error | null>;
1005
- /**
1006
- * Copy file
1007
- */
1008
- copyTo(destinationPath: string): Promise<Error | null>;
1009
- /**
1010
- * Move file
1011
- */
1012
- moveTo(destinationPath: string): Promise<Error | null>;
1013
- /**
1014
- * Move file to archive and return new reference
1015
- */
905
+ write(entity: DocFileMdEntity<T>): Promise<void>;
906
+ writeText(text: string): Promise<void>;
907
+ writeDefault(): Promise<void>;
908
+ delete(): Promise<void>;
909
+ copyTo(destinationPath: string): Promise<void>;
910
+ moveTo(destinationPath: string): Promise<void>;
1016
911
  archive(archiveDirectoryName?: string): Promise<DocFileMdReference<T>>;
1017
- /**
1018
- * Restore file from archive and return new reference
1019
- */
1020
912
  restore(archiveDirectoryName?: string): Promise<DocFileMdReference<T>>;
1021
- /**
1022
- * Get file size in bytes
1023
- */
1024
- size(): Promise<number | Error>;
1025
- /**
1026
- * Get file last modified time
1027
- */
1028
- lastModified(): Promise<Date | Error>;
1029
- /**
1030
- * Get file creation time
1031
- */
1032
- createdAt(): Promise<Date | Error>;
913
+ size(): Promise<number>;
914
+ lastModified(): Promise<Date>;
915
+ createdAt(): Promise<Date>;
1033
916
  directory(): DocDirectoryReference<T>;
917
+ relation(key: RelationKeys<T>): Promise<DocFileMdReference<DocCustomSchema> | null>;
918
+ relation<U extends DocCustomSchema>(key: RelationKeys<T>, targetSchema: U): Promise<DocFileMdReference<U> | null>;
1034
919
  /**
1035
- * Get relation based on schema
1036
- */
1037
- relation<U extends DocCustomSchema = DocCustomSchema>(key: RelationKeys<T>, targetSchema?: U): Promise<DocFileMdReference<U> | Error | null>;
1038
- /**
1039
- * Get index.md in the same directory
920
+ * スキーマで定義された relation の path を解決する。
921
+ * ".." 始まりの相対パスはファイルのディレクトリ基準で正規化する
1040
922
  */
923
+ private resolveRelationDirectory;
1041
924
  directoryIndex(): Promise<DocFileIndexReference<T> | null>;
1042
- /**
1043
- * Get multiple relations based on schema
1044
- */
1045
- relations<U extends DocCustomSchema = DocCustomSchema>(key: MultiRelationKeys<T>, customSchema?: U): Promise<DocFileMdReference<U>[]>;
1046
- /**
1047
- * File: Markdown > FrontMatter
1048
- */
1049
- readFrontMatter(): Promise<DocFileMdMetaValue<T> | Error>;
1050
- /**
1051
- * File: Markdown > FrontMatter
1052
- */
1053
- updateFrontMatter<K extends keyof T>(key: K, value: BaseFieldValueType<ExtractFieldType<T[K]>>): Promise<this | Error>;
925
+ relations(key: MultiRelationKeys<T>): Promise<DocFileMdReference<DocCustomSchema>[]>;
926
+ relations<U extends DocCustomSchema>(key: MultiRelationKeys<T>, customSchema: U): Promise<DocFileMdReference<U>[]>;
927
+ readFrontMatter(): Promise<DocFileMdMetaValue<T>>;
928
+ updateFrontMatter<K extends keyof T>(key: K, value: BaseFieldValueType<ExtractFieldType<T[K]>>): Promise<this>;
1054
929
  }
1055
930
 
1056
931
  /**
@@ -1353,6 +1228,10 @@ type RecordKey = PropertyKey;
1353
1228
  * DocClient configuration
1354
1229
  */
1355
1230
  type DocClientConfig = z.infer<typeof zDocClientConfig>;
1231
+ /**
1232
+ * Directory meta (.meta.json)
1233
+ */
1234
+ type DocDirectoryMeta = z.infer<typeof zDocDirectoryMeta>;
1356
1235
  /**
1357
1236
  * Type definitions for DocFileMdMetaValue
1358
1237
  */
@@ -1488,10 +1367,18 @@ declare class DocFileTreeSystem {
1488
1367
  * Create file node
1489
1368
  */
1490
1369
  private createFileNode;
1370
+ /**
1371
+ * Read title from a file
1372
+ */
1373
+ private readFileTitle;
1491
1374
  /**
1492
1375
  * Create directory node
1493
1376
  */
1494
1377
  private createDirectoryNode;
1378
+ /**
1379
+ * Read title and icon from directory index file
1380
+ */
1381
+ private readDirectoryIndexInfo;
1495
1382
  /**
1496
1383
  * Create index file reference
1497
1384
  */
@@ -1504,10 +1391,6 @@ declare class DocFileTreeSystem {
1504
1391
  * Build directory tree recursively (directories only)
1505
1392
  */
1506
1393
  buildDirectoryTree(directoryPath?: string): Promise<DocTreeDirectoryNodeValue[] | Error>;
1507
- /**
1508
- * Create directory node for directory tree
1509
- */
1510
- private createDirectoryNodeForTree;
1511
1394
  }
1512
1395
 
1513
1396
  /**
@@ -1559,9 +1442,6 @@ type Props = {
1559
1442
  pathSystem?: DocPathSystem;
1560
1443
  markdownSystem?: DocMarkdownSystem;
1561
1444
  fileTreeSystem?: DocFileTreeSystem;
1562
- /**
1563
- * Configuration
1564
- */
1565
1445
  config?: DocClientConfig;
1566
1446
  };
1567
1447
  declare class DocClient {
@@ -1571,6 +1451,7 @@ declare class DocClient {
1571
1451
  readonly fileTreeSystem: DocFileTreeSystem;
1572
1452
  readonly config: DocClientConfig;
1573
1453
  constructor(props: Props);
1454
+ get safe(): Safe<this>;
1574
1455
  basePath(): string;
1575
1456
  file<Path extends string>(relativePath: Path): InferReference<Path, DocCustomSchema>;
1576
1457
  file<Path extends string, T extends DocCustomSchema>(relativePath: Path, customSchema: T): InferReference<Path, T>;
@@ -1700,6 +1581,7 @@ declare class DocCustomSchemaFieldValue<T extends DocCustomSchemaField> {
1700
1581
  readonly value: T;
1701
1582
  constructor(value: T);
1702
1583
  validate(value: unknown): string | number | boolean | string[] | number[] | null;
1584
+ private fieldType;
1703
1585
  }
1704
1586
 
1705
1587
  /**
@@ -1889,4 +1771,4 @@ declare class DocRelationFieldValue {
1889
1771
  }): DocRelationFieldValue;
1890
1772
  }
1891
1773
 
1892
- export { type BaseFieldValueType, type DetectFileType, DocClient, type DocClientConfig, type DocCustomSchema, type DocCustomSchemaField, type DocCustomSchemaFieldBoolean, type DocCustomSchemaFieldMultiNumber, type DocCustomSchemaFieldMultiRelation, type DocCustomSchemaFieldMultiSelectNumber, type DocCustomSchemaFieldMultiSelectText, type DocCustomSchemaFieldMultiText, type DocCustomSchemaFieldNumber, type DocCustomSchemaFieldRelation, type DocCustomSchemaFieldSelectNumber, type DocCustomSchemaFieldSelectText, type DocCustomSchemaFieldText, DocCustomSchemaFieldValue, type DocDirectory, type DocDirectoryFile, DocDirectoryPathValue, DocDirectoryReference, type DocFieldTypeLiteral, type DocFile, type DocFileAny, type DocFileEntity, type DocFileIndex, type DocFileIndexAny, type DocFileIndexContent, DocFileIndexContentValue, DocFileIndexEntity, type DocFileIndexMeta, DocFileIndexMetaValue, DocFileIndexReference, type DocFileIndexSchema, type DocFileIndexSchemaField, DocFileIndexSchemaValue, type DocFileMd, type DocFileMdAny, type DocFileMdContent, DocFileMdContentValue, DocFileMdEntity, type DocFileMdMeta, type DocFileMdMetaAny, DocFileMdMetaValue, DocFileMdReference, type DocFilePath, DocFilePathValue, DocFileRelationReference, DocFileTreeSystem, type DocFileUnknown, DocFileUnknownEntity, DocFileUnknownReference, DocMarkdownSystem, type DocMetaField, type DocMetaFieldBoolean, type DocMetaFieldMultiNumber, type DocMetaFieldMultiRelation, type DocMetaFieldMultiSelectNumber, type DocMetaFieldMultiSelectText, type DocMetaFieldMultiText, type DocMetaFieldNumber, type DocMetaFieldRelation, type DocMetaFieldSelectNumber, type DocMetaFieldSelectText, type DocMetaFieldText, type DocMetaFieldType, type DocMetaFieldTypeBoolean, type DocMetaFieldTypeNumber, type DocMetaFieldTypeRelation, type DocMetaFieldTypeSelectNumber, type DocMetaFieldTypeSelectText, type DocMetaFieldTypeText, DocPathSystem, DocPathSystemMock, type DocRelation, type DocRelationField, DocRelationFieldValue, type DocRelationFile, DocRelationFileValue, DocRelationValue, type DocSchemaFieldBoolean, type DocSchemaFieldMultiNumber, type DocSchemaFieldMultiRelation, type DocSchemaFieldMultiSelectNumber, type DocSchemaFieldMultiSelectText, type DocSchemaFieldMultiText, type DocSchemaFieldNumber, type DocSchemaFieldRelation, type DocSchemaFieldSelectNumber, type DocSchemaFieldSelectText, type DocSchemaFieldText, type DocSchemaRelationFieldUnion, type DocTreeDirectoryNode, DocTreeDirectoryNodeValue, type DocTreeFileNode, DocTreeFileNodeValue, type DocTreeNode, type DocTreeNodeValue, type Equals, type ExtractFieldType, type ExtractRequired, type FieldValueType, type GetIndexFieldType, type GetValueType, type InferDocFileMd, type InferReference, type MultiRelationKeys, type OptionalKeys, type RecordKey, type RelationKeys, type RequiredKeys, type SchemaToValueType, type UpdateFunction, assertType, defaultTestConfig, defineSchema, docCustomSchemaField, expectType };
1774
+ export { type BaseFieldValueType, type DetectFileType, DocClient, type DocClientConfig, type DocCustomSchema, type DocCustomSchemaField, type DocCustomSchemaFieldBoolean, type DocCustomSchemaFieldMultiNumber, type DocCustomSchemaFieldMultiRelation, type DocCustomSchemaFieldMultiSelectNumber, type DocCustomSchemaFieldMultiSelectText, type DocCustomSchemaFieldMultiText, type DocCustomSchemaFieldNumber, type DocCustomSchemaFieldRelation, type DocCustomSchemaFieldSelectNumber, type DocCustomSchemaFieldSelectText, type DocCustomSchemaFieldText, DocCustomSchemaFieldValue, type DocDirectory, type DocDirectoryFile, type DocDirectoryMeta, DocDirectoryPathValue, DocDirectoryReference, type DocFieldTypeLiteral, type DocFile, type DocFileAny, type DocFileEntity, type DocFileIndex, type DocFileIndexAny, type DocFileIndexContent, DocFileIndexContentValue, DocFileIndexEntity, type DocFileIndexMeta, DocFileIndexMetaValue, DocFileIndexReference, type DocFileIndexSchema, type DocFileIndexSchemaField, DocFileIndexSchemaValue, type DocFileMd, type DocFileMdAny, type DocFileMdContent, DocFileMdContentValue, DocFileMdEntity, type DocFileMdMeta, type DocFileMdMetaAny, DocFileMdMetaValue, DocFileMdReference, type DocFilePath, DocFilePathValue, DocFileRelationReference, DocFileTreeSystem, type DocFileUnknown, DocFileUnknownEntity, DocFileUnknownReference, DocMarkdownSystem, type DocMetaField, type DocMetaFieldBoolean, type DocMetaFieldMultiNumber, type DocMetaFieldMultiRelation, type DocMetaFieldMultiSelectNumber, type DocMetaFieldMultiSelectText, type DocMetaFieldMultiText, type DocMetaFieldNumber, type DocMetaFieldRelation, type DocMetaFieldSelectNumber, type DocMetaFieldSelectText, type DocMetaFieldText, type DocMetaFieldType, type DocMetaFieldTypeBoolean, type DocMetaFieldTypeNumber, type DocMetaFieldTypeRelation, type DocMetaFieldTypeSelectNumber, type DocMetaFieldTypeSelectText, type DocMetaFieldTypeText, DocPathSystem, DocPathSystemMock, type DocRelation, type DocRelationField, DocRelationFieldValue, type DocRelationFile, DocRelationFileValue, DocRelationValue, type DocSchemaFieldBoolean, type DocSchemaFieldMultiNumber, type DocSchemaFieldMultiRelation, type DocSchemaFieldMultiSelectNumber, type DocSchemaFieldMultiSelectText, type DocSchemaFieldMultiText, type DocSchemaFieldNumber, type DocSchemaFieldRelation, type DocSchemaFieldSelectNumber, type DocSchemaFieldSelectText, type DocSchemaFieldText, type DocSchemaRelationFieldUnion, type DocTreeDirectoryNode, DocTreeDirectoryNodeValue, type DocTreeFileNode, DocTreeFileNodeValue, type DocTreeNode, type DocTreeNodeValue, type Equals, type ExtractFieldType, type ExtractRequired, type FieldValueType, type GetIndexFieldType, type GetValueType, type InferDocFileMd, type InferReference, type MultiRelationKeys, type OptionalKeys, type RecordKey, type RelationKeys, type RequiredKeys, type Safe, type SchemaToValueType, type UpdateFunction, assertType, createSafeProxy, defaultTestConfig, defineSchema, docCustomSchemaField, expectType };