@interactive-inc/docs-client 0.0.11 → 0.0.13

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/build/index.js CHANGED
@@ -152,13 +152,22 @@ var zDocMetaField = z.union([
152
152
  zDocMetaFieldMultiBoolean,
153
153
  zDocMetaFieldMultiSelectText,
154
154
  zDocMetaFieldMultiSelectNumber,
155
- zDocMetaFieldMultiRelation
155
+ zDocMetaFieldMultiRelation,
156
+ z.null()
156
157
  ]);
157
158
  var zDocFileMdMeta = z.record(z.string(), zDocMetaField);
159
+ var zDocFileMdMetaInput = z.record(
160
+ z.string(),
161
+ zDocMetaField.or(z.undefined())
162
+ );
158
163
  var zDocFileIndexSchema = z.record(
159
164
  z.string(),
160
165
  zDocFileIndexSchemaField
161
166
  );
167
+ var zDocFileIndexSchemaInput = z.record(
168
+ z.string(),
169
+ zDocFileIndexSchemaField.or(z.undefined())
170
+ );
162
171
  var zDocCustomSchemaFieldText = z.object({
163
172
  type: zDocMetaFieldTypeText,
164
173
  required: z.boolean()
@@ -222,6 +231,11 @@ var zDocFileIndexMeta = z.object({
222
231
  icon: z.string().nullable(),
223
232
  schema: zDocFileIndexSchema
224
233
  });
234
+ var zDocFileIndexMetaInput = z.object({
235
+ type: z.literal("index-meta"),
236
+ icon: z.string().nullable().or(z.undefined()),
237
+ schema: zDocFileIndexSchemaInput
238
+ });
225
239
  var zDocRelationField = z.object({
226
240
  fieldName: z.string(),
227
241
  filePath: z.string(),
@@ -244,6 +258,13 @@ var zDocFileMdContent = z.object({
244
258
  description: z.string(),
245
259
  meta: zDocFileMdMeta
246
260
  });
261
+ var zDocFileMdContentInput = z.object({
262
+ type: z.literal("markdown-content"),
263
+ body: z.string(),
264
+ title: z.string(),
265
+ description: z.string(),
266
+ meta: zDocFileMdMetaInput
267
+ });
247
268
  var zDocFileIndexContent = z.object({
248
269
  type: z.literal("markdown-index"),
249
270
  body: z.string(),
@@ -270,6 +291,12 @@ var zDocFileMd = z.object({
270
291
  content: zDocFileMdContent,
271
292
  isArchived: z.boolean()
272
293
  });
294
+ var zDocFileMdInput = z.object({
295
+ type: z.literal("markdown"),
296
+ path: zDocFilePath,
297
+ content: zDocFileMdContentInput,
298
+ isArchived: z.boolean()
299
+ });
273
300
  var zDocFile = z.union([zDocFileIndex, zDocFileMd, zDocFileUnknown]);
274
301
  var zDocTreeFileNode = z.object({
275
302
  type: z.literal("file"),
@@ -290,20 +317,13 @@ var zDocTreeDirectoryNode = z.lazy(() => {
290
317
  });
291
318
  var zDocTreeNode = z.union([zDocTreeFileNode, zDocTreeDirectoryNode]);
292
319
  var zDocClientConfig = z.object({
293
- defaultIndexIcon: z.string().optional(),
294
- indexFileName: z.string().optional(),
295
- archiveDirectoryName: z.string().optional(),
296
- defaultDirectoryName: z.string().optional(),
297
- indexMetaIncludes: z.array(z.string()).optional(),
298
- directoryExcludes: z.array(z.string()).optional()
299
- }).transform((data) => ({
300
- defaultIndexIcon: data.defaultIndexIcon ?? "\u{1F4C3}",
301
- indexFileName: data.indexFileName ?? "index.md",
302
- archiveDirectoryName: data.archiveDirectoryName ?? "_",
303
- defaultDirectoryName: data.defaultDirectoryName ?? "Directory",
304
- indexMetaIncludes: data.indexMetaIncludes ?? [],
305
- directoryExcludes: data.directoryExcludes ?? [".vitepress"]
306
- }));
320
+ defaultIndexIcon: z.string(),
321
+ indexFileName: z.string(),
322
+ archiveDirectoryName: z.string(),
323
+ defaultDirectoryName: z.string(),
324
+ indexMetaIncludes: z.array(z.string()),
325
+ directoryExcludes: z.array(z.string())
326
+ });
307
327
 
308
328
  // lib/doc-markdown-system.ts
309
329
  var DocMarkdownSystem = class {
@@ -468,703 +488,667 @@ ${updatedBody}` : updatedBody;
468
488
  // lib/values/doc-file-md-meta-value.ts
469
489
  import { parse, stringify } from "yaml";
470
490
 
471
- // lib/values/doc-meta-field/doc-meta-field-boolean-value.ts
472
- var DocMetaFieldBooleanValue = class _DocMetaFieldBooleanValue {
491
+ // lib/values/doc-custom-schema-field/doc-custom-schema-field-boolean-value.ts
492
+ var DocCustomSchemaFieldBooleanValue = class _DocCustomSchemaFieldBooleanValue {
473
493
  constructor(key, value) {
474
494
  this.key = key;
475
495
  this.value = value;
476
- zDocMetaFieldBoolean.parse(value);
496
+ zDocCustomSchemaFieldBoolean.parse(value);
477
497
  Object.freeze(this);
478
498
  }
479
- type = "boolean";
480
- static from(key, value) {
481
- return new _DocMetaFieldBooleanValue(
482
- key,
483
- zDocMetaFieldBoolean.parse(value)
484
- );
499
+ static from(key, required) {
500
+ return new _DocCustomSchemaFieldBooleanValue(key, {
501
+ type: "boolean",
502
+ required
503
+ });
485
504
  }
486
- static default(key) {
487
- return new _DocMetaFieldBooleanValue(key, false);
505
+ validate(value) {
506
+ try {
507
+ return zDocMetaFieldBoolean.parse(value);
508
+ } catch {
509
+ if (this.value.required) {
510
+ throw new Error(
511
+ `required field "${this.key.toString()}" is missing or invalid`
512
+ );
513
+ }
514
+ return _DocCustomSchemaFieldBooleanValue.defaultValue();
515
+ }
516
+ }
517
+ defaultValue() {
518
+ return false;
488
519
  }
489
520
  static defaultValue() {
490
521
  return false;
491
522
  }
492
523
  };
493
524
 
494
- // lib/values/doc-meta-field/doc-meta-field-multi-number-value.ts
495
- var DocMetaFieldMultiNumberValue = class _DocMetaFieldMultiNumberValue {
525
+ // lib/values/doc-custom-schema-field/doc-custom-schema-field-multi-number-value.ts
526
+ var DocCustomSchemaFieldMultiNumberValue = class _DocCustomSchemaFieldMultiNumberValue {
496
527
  constructor(key, value) {
497
528
  this.key = key;
498
529
  this.value = value;
499
- zDocMetaFieldMultiNumber.parse(value);
530
+ zDocCustomSchemaFieldMultiNumber.parse(value);
500
531
  Object.freeze(this);
501
532
  }
502
- type = "multi-number";
503
- static from(key, value) {
504
- return new _DocMetaFieldMultiNumberValue(
505
- key,
506
- zDocMetaFieldMultiNumber.parse(value)
507
- );
533
+ static from(key, required) {
534
+ return new _DocCustomSchemaFieldMultiNumberValue(key, {
535
+ type: "multi-number",
536
+ required
537
+ });
508
538
  }
509
- static default(key) {
510
- return new _DocMetaFieldMultiNumberValue(key, []);
539
+ validate(value) {
540
+ try {
541
+ return zDocMetaFieldMultiNumber.parse(value);
542
+ } catch {
543
+ if (this.value.required) {
544
+ throw new Error(
545
+ `required field "${this.key.toString()}" is missing or invalid`
546
+ );
547
+ }
548
+ return _DocCustomSchemaFieldMultiNumberValue.defaultValue();
549
+ }
550
+ }
551
+ defaultValue() {
552
+ return [];
511
553
  }
512
554
  static defaultValue() {
513
555
  return [];
514
556
  }
515
557
  };
516
558
 
517
- // lib/values/doc-meta-field/doc-meta-field-multi-relation-value.ts
518
- var DocMetaFieldMultiRelationValue = class _DocMetaFieldMultiRelationValue {
559
+ // lib/values/doc-custom-schema-field/doc-custom-schema-field-multi-relation-value.ts
560
+ var DocCustomSchemaFieldMultiRelationValue = class _DocCustomSchemaFieldMultiRelationValue {
519
561
  constructor(key, value) {
520
562
  this.key = key;
521
563
  this.value = value;
522
- zDocMetaFieldMultiRelation.parse(value);
564
+ zDocCustomSchemaFieldMultiRelation.parse(value);
523
565
  Object.freeze(this);
524
566
  }
525
- type = "multi-relation";
526
- static from(key, value) {
527
- return new _DocMetaFieldMultiRelationValue(
528
- key,
529
- zDocMetaFieldMultiRelation.parse(value)
530
- );
567
+ static from(key, required) {
568
+ return new _DocCustomSchemaFieldMultiRelationValue(key, {
569
+ type: "multi-relation",
570
+ required
571
+ });
531
572
  }
532
- static default(key) {
533
- return new _DocMetaFieldMultiRelationValue(key, []);
573
+ validate(value) {
574
+ try {
575
+ return zDocMetaFieldMultiRelation.parse(value);
576
+ } catch {
577
+ if (this.value.required) {
578
+ throw new Error(
579
+ `required field "${this.key.toString()}" is missing or invalid`
580
+ );
581
+ }
582
+ return _DocCustomSchemaFieldMultiRelationValue.defaultValue();
583
+ }
584
+ }
585
+ defaultValue() {
586
+ return [];
534
587
  }
535
588
  static defaultValue() {
536
589
  return [];
537
590
  }
538
591
  };
539
592
 
540
- // lib/values/doc-meta-field/doc-meta-field-multi-select-number-value.ts
541
- var DocMetaFieldMultiSelectNumberValue = class _DocMetaFieldMultiSelectNumberValue {
593
+ // lib/values/doc-custom-schema-field/doc-custom-schema-field-multi-select-number-value.ts
594
+ var DocCustomSchemaFieldMultiSelectNumberValue = class _DocCustomSchemaFieldMultiSelectNumberValue {
542
595
  constructor(key, value) {
543
596
  this.key = key;
544
597
  this.value = value;
545
- zDocMetaFieldMultiSelectNumber.parse(value);
598
+ zDocCustomSchemaFieldMultiSelectNumber.parse(value);
546
599
  Object.freeze(this);
547
600
  }
548
- type = "multi-select-number";
549
- static from(key, value) {
550
- return new _DocMetaFieldMultiSelectNumberValue(
551
- key,
552
- zDocMetaFieldMultiSelectNumber.parse(value)
553
- );
601
+ static from(key, required) {
602
+ return new _DocCustomSchemaFieldMultiSelectNumberValue(key, {
603
+ type: "multi-select-number",
604
+ required
605
+ });
554
606
  }
555
- static default(key) {
556
- return new _DocMetaFieldMultiSelectNumberValue(key, []);
607
+ validate(value) {
608
+ try {
609
+ return zDocMetaFieldMultiSelectNumber.parse(value);
610
+ } catch {
611
+ if (this.value.required) {
612
+ throw new Error(
613
+ `required field "${this.key.toString()}" is missing or invalid`
614
+ );
615
+ }
616
+ return _DocCustomSchemaFieldMultiSelectNumberValue.defaultValue();
617
+ }
618
+ }
619
+ defaultValue() {
620
+ return [];
557
621
  }
558
622
  static defaultValue() {
559
623
  return [];
560
624
  }
561
625
  };
562
626
 
563
- // lib/values/doc-meta-field/doc-meta-field-multi-select-text-value.ts
564
- var DocMetaFieldMultiSelectTextValue = class _DocMetaFieldMultiSelectTextValue {
627
+ // lib/values/doc-custom-schema-field/doc-custom-schema-field-multi-select-text-value.ts
628
+ var DocCustomSchemaFieldMultiSelectTextValue = class _DocCustomSchemaFieldMultiSelectTextValue {
565
629
  constructor(key, value) {
566
630
  this.key = key;
567
631
  this.value = value;
568
- zDocMetaFieldMultiSelectText.parse(value);
632
+ zDocCustomSchemaFieldMultiSelectText.parse(value);
569
633
  Object.freeze(this);
570
634
  }
571
- type = "multi-select-text";
572
- static from(key, value) {
573
- return new _DocMetaFieldMultiSelectTextValue(
574
- key,
575
- zDocMetaFieldMultiSelectText.parse(value)
576
- );
635
+ static from(key, required) {
636
+ return new _DocCustomSchemaFieldMultiSelectTextValue(key, {
637
+ type: "multi-select-text",
638
+ required
639
+ });
577
640
  }
578
- static default(key) {
579
- return new _DocMetaFieldMultiSelectTextValue(key, []);
641
+ validate(value) {
642
+ try {
643
+ return zDocMetaFieldMultiSelectText.parse(value);
644
+ } catch {
645
+ if (this.value.required) {
646
+ throw new Error(
647
+ `required field "${this.key.toString()}" is missing or invalid`
648
+ );
649
+ }
650
+ return _DocCustomSchemaFieldMultiSelectTextValue.defaultValue();
651
+ }
652
+ }
653
+ defaultValue() {
654
+ return [];
580
655
  }
581
656
  static defaultValue() {
582
657
  return [];
583
658
  }
584
659
  };
585
660
 
586
- // lib/values/doc-meta-field/doc-meta-field-multi-text-value.ts
587
- var DocMetaFieldMultiTextValue = class _DocMetaFieldMultiTextValue {
661
+ // lib/values/doc-custom-schema-field/doc-custom-schema-field-multi-text-value.ts
662
+ var DocCustomSchemaFieldMultiTextValue = class _DocCustomSchemaFieldMultiTextValue {
588
663
  constructor(key, value) {
589
664
  this.key = key;
590
665
  this.value = value;
591
- zDocMetaFieldMultiText.parse(value);
666
+ zDocCustomSchemaFieldMultiText.parse(value);
592
667
  Object.freeze(this);
593
668
  }
594
- type = "multi-text";
595
- static from(key, value) {
596
- return new _DocMetaFieldMultiTextValue(
597
- key,
598
- zDocMetaFieldMultiText.parse(value)
599
- );
669
+ static from(key, required) {
670
+ return new _DocCustomSchemaFieldMultiTextValue(key, {
671
+ type: "multi-text",
672
+ required
673
+ });
600
674
  }
601
- static default(key) {
602
- return new _DocMetaFieldMultiTextValue(key, []);
675
+ validate(value) {
676
+ try {
677
+ return zDocMetaFieldMultiText.parse(value);
678
+ } catch {
679
+ if (this.value.required) {
680
+ throw new Error(
681
+ `required field "${this.key.toString()}" is missing or invalid`
682
+ );
683
+ }
684
+ return _DocCustomSchemaFieldMultiTextValue.defaultValue();
685
+ }
686
+ }
687
+ defaultValue() {
688
+ return [];
603
689
  }
604
690
  static defaultValue() {
605
691
  return [];
606
692
  }
607
693
  };
608
694
 
609
- // lib/values/doc-meta-field/doc-meta-field-number-value.ts
610
- var DocMetaFieldNumberValue = class _DocMetaFieldNumberValue {
695
+ // lib/values/doc-custom-schema-field/doc-custom-schema-field-number-value.ts
696
+ var DocCustomSchemaFieldNumberValue = class _DocCustomSchemaFieldNumberValue {
611
697
  constructor(key, value) {
612
698
  this.key = key;
613
699
  this.value = value;
614
- zDocMetaFieldNumber.parse(value);
700
+ zDocCustomSchemaFieldNumber.parse(value);
615
701
  Object.freeze(this);
616
702
  }
617
- type = "number";
618
- static from(key, value) {
619
- return new _DocMetaFieldNumberValue(key, zDocMetaFieldNumber.parse(value));
703
+ static from(key, required) {
704
+ return new _DocCustomSchemaFieldNumberValue(key, {
705
+ type: "number",
706
+ required
707
+ });
620
708
  }
621
- static default(key) {
622
- return new _DocMetaFieldNumberValue(key, 0);
709
+ validate(value) {
710
+ try {
711
+ return zDocMetaFieldNumber.parse(value);
712
+ } catch {
713
+ if (this.value.required) {
714
+ throw new Error(
715
+ `required field "${this.key.toString()}" is missing or invalid`
716
+ );
717
+ }
718
+ return _DocCustomSchemaFieldNumberValue.defaultValue();
719
+ }
720
+ }
721
+ defaultValue() {
722
+ return 0;
623
723
  }
624
724
  static defaultValue() {
625
725
  return 0;
626
726
  }
627
727
  };
628
728
 
629
- // lib/values/doc-meta-field/doc-meta-field-relation-value.ts
630
- var DocMetaFieldRelationValue = class _DocMetaFieldRelationValue {
729
+ // lib/values/doc-custom-schema-field/doc-custom-schema-field-relation-value.ts
730
+ var DocCustomSchemaFieldRelationValue = class _DocCustomSchemaFieldRelationValue {
631
731
  constructor(key, value) {
632
732
  this.key = key;
633
733
  this.value = value;
634
- zDocMetaFieldRelation.parse(value);
635
- Object.freeze(this);
636
- }
637
- type = "relation";
638
- static from(key, value) {
639
- return new _DocMetaFieldRelationValue(
640
- key,
641
- zDocMetaFieldRelation.parse(value)
642
- );
643
- }
644
- static default(key) {
645
- return new _DocMetaFieldRelationValue(key, null);
646
- }
647
- static defaultValue() {
648
- return null;
649
- }
650
- };
651
-
652
- // lib/values/doc-meta-field/doc-meta-field-select-number-value.ts
653
- var DocMetaFieldSelectNumberValue = class _DocMetaFieldSelectNumberValue {
654
- constructor(key, value) {
655
- this.key = key;
656
- this.value = value;
657
- zDocMetaFieldSelectNumber.parse(value);
658
- Object.freeze(this);
659
- }
660
- type = "select-number";
661
- static from(key, value) {
662
- return new _DocMetaFieldSelectNumberValue(
663
- key,
664
- zDocMetaFieldSelectNumber.parse(value)
665
- );
666
- }
667
- static default(key) {
668
- return new _DocMetaFieldSelectNumberValue(key, null);
669
- }
670
- static defaultValue() {
671
- return [];
672
- }
673
- };
674
-
675
- // lib/values/doc-meta-field/doc-meta-field-select-text-value.ts
676
- var DocMetaFieldSelectTextValue = class _DocMetaFieldSelectTextValue {
677
- constructor(key, value) {
678
- this.key = key;
679
- this.value = value;
680
- zDocMetaFieldSelectText.parse(value);
681
- Object.freeze(this);
682
- }
683
- type = "select-text";
684
- static from(key, value) {
685
- return new _DocMetaFieldSelectTextValue(
686
- key,
687
- zDocMetaFieldSelectText.parse(value)
688
- );
689
- }
690
- static default(key) {
691
- return new _DocMetaFieldSelectTextValue(key, null);
692
- }
693
- static defaultValue() {
694
- return [];
695
- }
696
- };
697
-
698
- // lib/values/doc-meta-field/doc-meta-field-text-value.ts
699
- var DocMetaFieldTextValue = class _DocMetaFieldTextValue {
700
- constructor(key, value) {
701
- this.key = key;
702
- this.value = value;
703
- zDocMetaFieldText.parse(value);
704
- Object.freeze(this);
705
- }
706
- type = "text";
707
- static from(key, value) {
708
- return new _DocMetaFieldTextValue(key, zDocMetaFieldText.parse(value));
709
- }
710
- static default(key) {
711
- return new _DocMetaFieldTextValue(key, "");
712
- }
713
- static defaultValue() {
714
- return "";
715
- }
716
- };
717
-
718
- // lib/values/doc-custom-schema-field/doc-custom-schema-field-boolean-value.ts
719
- var DocCustomSchemaFieldBooleanValue = class _DocCustomSchemaFieldBooleanValue {
720
- constructor(key, value) {
721
- this.key = key;
722
- this.value = value;
723
- zDocCustomSchemaFieldBoolean.parse(value);
734
+ zDocCustomSchemaFieldRelation.parse(value);
724
735
  Object.freeze(this);
725
736
  }
726
737
  static from(key, required) {
727
- return new _DocCustomSchemaFieldBooleanValue(key, {
728
- type: "boolean",
738
+ return new _DocCustomSchemaFieldRelationValue(key, {
739
+ type: "relation",
729
740
  required
730
741
  });
731
742
  }
732
743
  validate(value) {
733
744
  try {
734
- return zDocMetaFieldBoolean.parse(value);
745
+ return zDocMetaFieldRelation.parse(value);
735
746
  } catch {
736
747
  if (this.value.required) {
737
748
  throw new Error(
738
749
  `required field "${this.key.toString()}" is missing or invalid`
739
750
  );
740
751
  }
741
- return _DocCustomSchemaFieldBooleanValue.defaultValue();
752
+ return _DocCustomSchemaFieldRelationValue.defaultValue();
742
753
  }
743
754
  }
744
755
  defaultValue() {
745
- return false;
756
+ return null;
746
757
  }
747
758
  static defaultValue() {
748
- return false;
759
+ return null;
749
760
  }
750
761
  };
751
762
 
752
- // lib/values/doc-custom-schema-field/doc-custom-schema-field-multi-number-value.ts
753
- var DocCustomSchemaFieldMultiNumberValue = class _DocCustomSchemaFieldMultiNumberValue {
763
+ // lib/values/doc-custom-schema-field/doc-custom-schema-field-select-number-value.ts
764
+ var DocCustomSchemaFieldSelectNumberValue = class _DocCustomSchemaFieldSelectNumberValue {
754
765
  constructor(key, value) {
755
766
  this.key = key;
756
767
  this.value = value;
757
- zDocCustomSchemaFieldMultiNumber.parse(value);
768
+ zDocCustomSchemaFieldSelectNumber.parse(value);
758
769
  Object.freeze(this);
759
770
  }
760
771
  static from(key, required) {
761
- return new _DocCustomSchemaFieldMultiNumberValue(key, {
762
- type: "multi-number",
772
+ return new _DocCustomSchemaFieldSelectNumberValue(key, {
773
+ type: "select-number",
763
774
  required
764
775
  });
765
776
  }
766
777
  validate(value) {
767
778
  try {
768
- return zDocMetaFieldMultiNumber.parse(value);
779
+ return zDocMetaFieldSelectNumber.parse(value);
769
780
  } catch {
770
781
  if (this.value.required) {
771
782
  throw new Error(
772
783
  `required field "${this.key.toString()}" is missing or invalid`
773
784
  );
774
785
  }
775
- return _DocCustomSchemaFieldMultiNumberValue.defaultValue();
786
+ return _DocCustomSchemaFieldSelectNumberValue.defaultValue();
776
787
  }
777
788
  }
778
789
  defaultValue() {
779
- return [];
790
+ return null;
780
791
  }
781
792
  static defaultValue() {
782
- return [];
793
+ return null;
783
794
  }
784
795
  };
785
796
 
786
- // lib/values/doc-custom-schema-field/doc-custom-schema-field-multi-relation-value.ts
787
- var DocCustomSchemaFieldMultiRelationValue = class _DocCustomSchemaFieldMultiRelationValue {
797
+ // lib/values/doc-custom-schema-field/doc-custom-schema-field-select-text-value.ts
798
+ var DocCustomSchemaFieldSelectTextValue = class _DocCustomSchemaFieldSelectTextValue {
788
799
  constructor(key, value) {
789
800
  this.key = key;
790
801
  this.value = value;
791
- zDocCustomSchemaFieldMultiRelation.parse(value);
802
+ zDocCustomSchemaFieldSelectText.parse(value);
792
803
  Object.freeze(this);
793
804
  }
794
805
  static from(key, required) {
795
- return new _DocCustomSchemaFieldMultiRelationValue(key, {
796
- type: "multi-relation",
806
+ return new _DocCustomSchemaFieldSelectTextValue(key, {
807
+ type: "select-text",
797
808
  required
798
809
  });
799
810
  }
800
811
  validate(value) {
801
812
  try {
802
- return zDocMetaFieldMultiRelation.parse(value);
813
+ return zDocMetaFieldSelectText.parse(value);
803
814
  } catch {
804
815
  if (this.value.required) {
805
816
  throw new Error(
806
817
  `required field "${this.key.toString()}" is missing or invalid`
807
818
  );
808
819
  }
809
- return _DocCustomSchemaFieldMultiRelationValue.defaultValue();
820
+ return _DocCustomSchemaFieldSelectTextValue.defaultValue();
810
821
  }
811
822
  }
812
823
  defaultValue() {
813
- return [];
824
+ return null;
814
825
  }
815
826
  static defaultValue() {
816
- return [];
827
+ return null;
817
828
  }
818
829
  };
819
830
 
820
- // lib/values/doc-custom-schema-field/doc-custom-schema-field-multi-select-number-value.ts
821
- var DocCustomSchemaFieldMultiSelectNumberValue = class _DocCustomSchemaFieldMultiSelectNumberValue {
831
+ // lib/values/doc-custom-schema-field/doc-custom-schema-field-text-value.ts
832
+ var DocCustomSchemaFieldTextValue = class _DocCustomSchemaFieldTextValue {
822
833
  constructor(key, value) {
823
834
  this.key = key;
824
835
  this.value = value;
825
- zDocCustomSchemaFieldMultiSelectNumber.parse(value);
836
+ zDocCustomSchemaFieldText.parse(value);
826
837
  Object.freeze(this);
827
838
  }
828
839
  static from(key, required) {
829
- return new _DocCustomSchemaFieldMultiSelectNumberValue(key, {
830
- type: "multi-select-number",
840
+ return new _DocCustomSchemaFieldTextValue(key, {
841
+ type: "text",
831
842
  required
832
843
  });
833
844
  }
834
845
  validate(value) {
835
846
  try {
836
- return zDocMetaFieldMultiSelectNumber.parse(value);
847
+ return zDocMetaFieldText.parse(value);
837
848
  } catch {
838
849
  if (this.value.required) {
839
850
  throw new Error(
840
851
  `required field "${this.key.toString()}" is missing or invalid`
841
852
  );
842
853
  }
843
- return _DocCustomSchemaFieldMultiSelectNumberValue.defaultValue();
854
+ return _DocCustomSchemaFieldTextValue.defaultValue();
844
855
  }
845
856
  }
846
857
  defaultValue() {
847
- return [];
858
+ return "";
848
859
  }
849
860
  static defaultValue() {
850
- return [];
861
+ return "";
851
862
  }
852
863
  };
853
864
 
854
- // lib/values/doc-custom-schema-field/doc-custom-schema-field-multi-select-text-value.ts
855
- var DocCustomSchemaFieldMultiSelectTextValue = class _DocCustomSchemaFieldMultiSelectTextValue {
865
+ // lib/values/doc-custom-schema-field/doc-custom-schema-field-factory.ts
866
+ var DocCustomSchemaFieldFactory = class {
867
+ fromType(key, field) {
868
+ if (field.type === "text") {
869
+ return new DocCustomSchemaFieldTextValue(key, field);
870
+ }
871
+ if (field.type === "number") {
872
+ return new DocCustomSchemaFieldNumberValue(key, field);
873
+ }
874
+ if (field.type === "boolean") {
875
+ return new DocCustomSchemaFieldBooleanValue(key, field);
876
+ }
877
+ if (field.type === "select-text") {
878
+ return new DocCustomSchemaFieldSelectTextValue(key, field);
879
+ }
880
+ if (field.type === "select-number") {
881
+ return new DocCustomSchemaFieldSelectNumberValue(key, field);
882
+ }
883
+ if (field.type === "relation") {
884
+ return new DocCustomSchemaFieldRelationValue(key, field);
885
+ }
886
+ if (field.type === "multi-text") {
887
+ return new DocCustomSchemaFieldMultiTextValue(key, field);
888
+ }
889
+ if (field.type === "multi-number") {
890
+ return new DocCustomSchemaFieldMultiNumberValue(key, field);
891
+ }
892
+ if (field.type === "multi-select-text") {
893
+ return new DocCustomSchemaFieldMultiSelectTextValue(key, field);
894
+ }
895
+ if (field.type === "multi-select-number") {
896
+ return new DocCustomSchemaFieldMultiSelectNumberValue(key, field);
897
+ }
898
+ if (field.type === "multi-relation") {
899
+ return new DocCustomSchemaFieldMultiRelationValue(key, field);
900
+ }
901
+ throw new Error("Unknown field type");
902
+ }
903
+ };
904
+
905
+ // lib/values/doc-meta-field/doc-meta-field-boolean-value.ts
906
+ var DocMetaFieldBooleanValue = class _DocMetaFieldBooleanValue {
856
907
  constructor(key, value) {
857
908
  this.key = key;
858
909
  this.value = value;
859
- zDocCustomSchemaFieldMultiSelectText.parse(value);
910
+ zDocMetaFieldBoolean.parse(value);
860
911
  Object.freeze(this);
861
912
  }
862
- static from(key, required) {
863
- return new _DocCustomSchemaFieldMultiSelectTextValue(key, {
864
- type: "multi-select-text",
865
- required
866
- });
913
+ type = "boolean";
914
+ static from(key, value) {
915
+ return new _DocMetaFieldBooleanValue(
916
+ key,
917
+ zDocMetaFieldBoolean.parse(value)
918
+ );
867
919
  }
868
- validate(value) {
869
- try {
870
- return zDocMetaFieldMultiSelectText.parse(value);
871
- } catch {
872
- if (this.value.required) {
873
- throw new Error(
874
- `required field "${this.key.toString()}" is missing or invalid`
875
- );
876
- }
877
- return _DocCustomSchemaFieldMultiSelectTextValue.defaultValue();
878
- }
920
+ static default(key) {
921
+ return new _DocMetaFieldBooleanValue(key, false);
879
922
  }
880
- defaultValue() {
923
+ static defaultValue() {
924
+ return false;
925
+ }
926
+ };
927
+
928
+ // lib/values/doc-meta-field/doc-meta-field-multi-number-value.ts
929
+ var DocMetaFieldMultiNumberValue = class _DocMetaFieldMultiNumberValue {
930
+ constructor(key, value) {
931
+ this.key = key;
932
+ this.value = value;
933
+ zDocMetaFieldMultiNumber.parse(value);
934
+ Object.freeze(this);
935
+ }
936
+ type = "multi-number";
937
+ static from(key, value) {
938
+ return new _DocMetaFieldMultiNumberValue(
939
+ key,
940
+ zDocMetaFieldMultiNumber.parse(value)
941
+ );
942
+ }
943
+ static default(key) {
944
+ return new _DocMetaFieldMultiNumberValue(key, []);
945
+ }
946
+ static defaultValue() {
881
947
  return [];
882
948
  }
949
+ };
950
+
951
+ // lib/values/doc-meta-field/doc-meta-field-multi-relation-value.ts
952
+ var DocMetaFieldMultiRelationValue = class _DocMetaFieldMultiRelationValue {
953
+ constructor(key, value) {
954
+ this.key = key;
955
+ this.value = value;
956
+ zDocMetaFieldMultiRelation.parse(value);
957
+ Object.freeze(this);
958
+ }
959
+ type = "multi-relation";
960
+ static from(key, value) {
961
+ return new _DocMetaFieldMultiRelationValue(
962
+ key,
963
+ zDocMetaFieldMultiRelation.parse(value)
964
+ );
965
+ }
966
+ static default(key) {
967
+ return new _DocMetaFieldMultiRelationValue(key, []);
968
+ }
883
969
  static defaultValue() {
884
970
  return [];
885
971
  }
886
972
  };
887
973
 
888
- // lib/values/doc-custom-schema-field/doc-custom-schema-field-multi-text-value.ts
889
- var DocCustomSchemaFieldMultiTextValue = class _DocCustomSchemaFieldMultiTextValue {
974
+ // lib/values/doc-meta-field/doc-meta-field-multi-select-number-value.ts
975
+ var DocMetaFieldMultiSelectNumberValue = class _DocMetaFieldMultiSelectNumberValue {
890
976
  constructor(key, value) {
891
977
  this.key = key;
892
978
  this.value = value;
893
- zDocCustomSchemaFieldMultiText.parse(value);
979
+ zDocMetaFieldMultiSelectNumber.parse(value);
894
980
  Object.freeze(this);
895
981
  }
896
- static from(key, required) {
897
- return new _DocCustomSchemaFieldMultiTextValue(key, {
898
- type: "multi-text",
899
- required
900
- });
982
+ type = "multi-select-number";
983
+ static from(key, value) {
984
+ return new _DocMetaFieldMultiSelectNumberValue(
985
+ key,
986
+ zDocMetaFieldMultiSelectNumber.parse(value)
987
+ );
901
988
  }
902
- validate(value) {
903
- try {
904
- return zDocMetaFieldMultiText.parse(value);
905
- } catch {
906
- if (this.value.required) {
907
- throw new Error(
908
- `required field "${this.key.toString()}" is missing or invalid`
909
- );
910
- }
911
- return _DocCustomSchemaFieldMultiTextValue.defaultValue();
912
- }
989
+ static default(key) {
990
+ return new _DocMetaFieldMultiSelectNumberValue(key, []);
913
991
  }
914
- defaultValue() {
992
+ static defaultValue() {
915
993
  return [];
916
994
  }
995
+ };
996
+
997
+ // lib/values/doc-meta-field/doc-meta-field-multi-select-text-value.ts
998
+ var DocMetaFieldMultiSelectTextValue = class _DocMetaFieldMultiSelectTextValue {
999
+ constructor(key, value) {
1000
+ this.key = key;
1001
+ this.value = value;
1002
+ zDocMetaFieldMultiSelectText.parse(value);
1003
+ Object.freeze(this);
1004
+ }
1005
+ type = "multi-select-text";
1006
+ static from(key, value) {
1007
+ return new _DocMetaFieldMultiSelectTextValue(
1008
+ key,
1009
+ zDocMetaFieldMultiSelectText.parse(value)
1010
+ );
1011
+ }
1012
+ static default(key) {
1013
+ return new _DocMetaFieldMultiSelectTextValue(key, []);
1014
+ }
917
1015
  static defaultValue() {
918
1016
  return [];
919
1017
  }
920
1018
  };
921
1019
 
922
- // lib/values/doc-custom-schema-field/doc-custom-schema-field-number-value.ts
923
- var DocCustomSchemaFieldNumberValue = class _DocCustomSchemaFieldNumberValue {
1020
+ // lib/values/doc-meta-field/doc-meta-field-multi-text-value.ts
1021
+ var DocMetaFieldMultiTextValue = class _DocMetaFieldMultiTextValue {
924
1022
  constructor(key, value) {
925
1023
  this.key = key;
926
1024
  this.value = value;
927
- zDocCustomSchemaFieldNumber.parse(value);
1025
+ zDocMetaFieldMultiText.parse(value);
928
1026
  Object.freeze(this);
929
1027
  }
930
- static from(key, required) {
931
- return new _DocCustomSchemaFieldNumberValue(key, {
932
- type: "number",
933
- required
934
- });
1028
+ type = "multi-text";
1029
+ static from(key, value) {
1030
+ return new _DocMetaFieldMultiTextValue(
1031
+ key,
1032
+ zDocMetaFieldMultiText.parse(value)
1033
+ );
935
1034
  }
936
- validate(value) {
937
- try {
938
- return zDocMetaFieldNumber.parse(value);
939
- } catch {
940
- if (this.value.required) {
941
- throw new Error(
942
- `required field "${this.key.toString()}" is missing or invalid`
943
- );
944
- }
945
- return _DocCustomSchemaFieldNumberValue.defaultValue();
946
- }
1035
+ static default(key) {
1036
+ return new _DocMetaFieldMultiTextValue(key, []);
947
1037
  }
948
- defaultValue() {
949
- return 0;
1038
+ static defaultValue() {
1039
+ return [];
1040
+ }
1041
+ };
1042
+
1043
+ // lib/values/doc-meta-field/doc-meta-field-number-value.ts
1044
+ var DocMetaFieldNumberValue = class _DocMetaFieldNumberValue {
1045
+ constructor(key, value) {
1046
+ this.key = key;
1047
+ this.value = value;
1048
+ zDocMetaFieldNumber.parse(value);
1049
+ Object.freeze(this);
1050
+ }
1051
+ type = "number";
1052
+ static from(key, value) {
1053
+ return new _DocMetaFieldNumberValue(key, zDocMetaFieldNumber.parse(value));
1054
+ }
1055
+ static default(key) {
1056
+ return new _DocMetaFieldNumberValue(key, 0);
950
1057
  }
951
1058
  static defaultValue() {
952
1059
  return 0;
953
1060
  }
954
1061
  };
955
1062
 
956
- // lib/values/doc-custom-schema-field/doc-custom-schema-field-relation-value.ts
957
- var DocCustomSchemaFieldRelationValue = class _DocCustomSchemaFieldRelationValue {
1063
+ // lib/values/doc-meta-field/doc-meta-field-relation-value.ts
1064
+ var DocMetaFieldRelationValue = class _DocMetaFieldRelationValue {
958
1065
  constructor(key, value) {
959
1066
  this.key = key;
960
1067
  this.value = value;
961
- zDocCustomSchemaFieldRelation.parse(value);
1068
+ zDocMetaFieldRelation.parse(value);
962
1069
  Object.freeze(this);
963
1070
  }
964
- static from(key, required) {
965
- return new _DocCustomSchemaFieldRelationValue(key, {
966
- type: "relation",
967
- required
968
- });
969
- }
970
- validate(value) {
971
- try {
972
- return zDocMetaFieldRelation.parse(value);
973
- } catch {
974
- if (this.value.required) {
975
- throw new Error(
976
- `required field "${this.key.toString()}" is missing or invalid`
977
- );
978
- }
979
- return _DocCustomSchemaFieldRelationValue.defaultValue();
980
- }
1071
+ type = "relation";
1072
+ static from(key, value) {
1073
+ return new _DocMetaFieldRelationValue(
1074
+ key,
1075
+ zDocMetaFieldRelation.parse(value)
1076
+ );
981
1077
  }
982
- defaultValue() {
983
- return null;
1078
+ static default(key) {
1079
+ return new _DocMetaFieldRelationValue(key, null);
984
1080
  }
985
1081
  static defaultValue() {
986
1082
  return null;
987
1083
  }
988
1084
  };
989
1085
 
990
- // lib/values/doc-custom-schema-field/doc-custom-schema-field-select-number-value.ts
991
- var DocCustomSchemaFieldSelectNumberValue = class _DocCustomSchemaFieldSelectNumberValue {
1086
+ // lib/values/doc-meta-field/doc-meta-field-select-number-value.ts
1087
+ var DocMetaFieldSelectNumberValue = class _DocMetaFieldSelectNumberValue {
992
1088
  constructor(key, value) {
993
1089
  this.key = key;
994
1090
  this.value = value;
995
- zDocCustomSchemaFieldSelectNumber.parse(value);
1091
+ zDocMetaFieldSelectNumber.parse(value);
996
1092
  Object.freeze(this);
997
1093
  }
998
- static from(key, required) {
999
- return new _DocCustomSchemaFieldSelectNumberValue(key, {
1000
- type: "select-number",
1001
- required
1002
- });
1003
- }
1004
- validate(value) {
1005
- try {
1006
- return zDocMetaFieldSelectNumber.parse(value);
1007
- } catch {
1008
- if (this.value.required) {
1009
- throw new Error(
1010
- `required field "${this.key.toString()}" is missing or invalid`
1011
- );
1012
- }
1013
- return _DocCustomSchemaFieldSelectNumberValue.defaultValue();
1014
- }
1094
+ type = "select-number";
1095
+ static from(key, value) {
1096
+ return new _DocMetaFieldSelectNumberValue(
1097
+ key,
1098
+ zDocMetaFieldSelectNumber.parse(value)
1099
+ );
1015
1100
  }
1016
- defaultValue() {
1017
- return null;
1101
+ static default(key) {
1102
+ return new _DocMetaFieldSelectNumberValue(key, null);
1018
1103
  }
1019
1104
  static defaultValue() {
1020
- return null;
1105
+ return [];
1021
1106
  }
1022
1107
  };
1023
1108
 
1024
- // lib/values/doc-custom-schema-field/doc-custom-schema-field-select-text-value.ts
1025
- var DocCustomSchemaFieldSelectTextValue = class _DocCustomSchemaFieldSelectTextValue {
1109
+ // lib/values/doc-meta-field/doc-meta-field-select-text-value.ts
1110
+ var DocMetaFieldSelectTextValue = class _DocMetaFieldSelectTextValue {
1026
1111
  constructor(key, value) {
1027
1112
  this.key = key;
1028
1113
  this.value = value;
1029
- zDocCustomSchemaFieldSelectText.parse(value);
1114
+ zDocMetaFieldSelectText.parse(value);
1030
1115
  Object.freeze(this);
1031
1116
  }
1032
- static from(key, required) {
1033
- return new _DocCustomSchemaFieldSelectTextValue(key, {
1034
- type: "select-text",
1035
- required
1036
- });
1037
- }
1038
- validate(value) {
1039
- try {
1040
- return zDocMetaFieldSelectText.parse(value);
1041
- } catch {
1042
- if (this.value.required) {
1043
- throw new Error(
1044
- `required field "${this.key.toString()}" is missing or invalid`
1045
- );
1046
- }
1047
- return _DocCustomSchemaFieldSelectTextValue.defaultValue();
1048
- }
1117
+ type = "select-text";
1118
+ static from(key, value) {
1119
+ return new _DocMetaFieldSelectTextValue(
1120
+ key,
1121
+ zDocMetaFieldSelectText.parse(value)
1122
+ );
1049
1123
  }
1050
- defaultValue() {
1051
- return null;
1124
+ static default(key) {
1125
+ return new _DocMetaFieldSelectTextValue(key, null);
1052
1126
  }
1053
1127
  static defaultValue() {
1054
- return null;
1128
+ return [];
1055
1129
  }
1056
1130
  };
1057
1131
 
1058
- // lib/values/doc-custom-schema-field/doc-custom-schema-field-text-value.ts
1059
- var DocCustomSchemaFieldTextValue = class _DocCustomSchemaFieldTextValue {
1132
+ // lib/values/doc-meta-field/doc-meta-field-text-value.ts
1133
+ var DocMetaFieldTextValue = class _DocMetaFieldTextValue {
1060
1134
  constructor(key, value) {
1061
1135
  this.key = key;
1062
1136
  this.value = value;
1063
- zDocCustomSchemaFieldText.parse(value);
1137
+ zDocMetaFieldText.parse(value);
1064
1138
  Object.freeze(this);
1065
1139
  }
1066
- static from(key, required) {
1067
- return new _DocCustomSchemaFieldTextValue(key, {
1068
- type: "text",
1069
- required
1070
- });
1071
- }
1072
- validate(value) {
1073
- try {
1074
- return zDocMetaFieldText.parse(value);
1075
- } catch {
1076
- if (this.value.required) {
1077
- throw new Error(
1078
- `required field "${this.key.toString()}" is missing or invalid`
1079
- );
1080
- }
1081
- return _DocCustomSchemaFieldTextValue.defaultValue();
1082
- }
1140
+ type = "text";
1141
+ static from(key, value) {
1142
+ return new _DocMetaFieldTextValue(key, zDocMetaFieldText.parse(value));
1083
1143
  }
1084
- defaultValue() {
1085
- return "";
1144
+ static default(key) {
1145
+ return new _DocMetaFieldTextValue(key, "");
1086
1146
  }
1087
1147
  static defaultValue() {
1088
1148
  return "";
1089
1149
  }
1090
1150
  };
1091
1151
 
1092
- // lib/values/doc-custom-schema-field/doc-custom-schema-field-factory.ts
1093
- var DocCustomSchemaFieldFactory = class {
1094
- fromType(key, field) {
1095
- if (field.type === "text") {
1096
- return new DocCustomSchemaFieldTextValue(key, field);
1097
- }
1098
- if (field.type === "number") {
1099
- return new DocCustomSchemaFieldNumberValue(key, field);
1100
- }
1101
- if (field.type === "boolean") {
1102
- return new DocCustomSchemaFieldBooleanValue(key, field);
1103
- }
1104
- if (field.type === "select-text") {
1105
- return new DocCustomSchemaFieldSelectTextValue(key, field);
1106
- }
1107
- if (field.type === "select-number") {
1108
- return new DocCustomSchemaFieldSelectNumberValue(key, field);
1109
- }
1110
- if (field.type === "relation") {
1111
- return new DocCustomSchemaFieldRelationValue(key, field);
1112
- }
1113
- if (field.type === "multi-text") {
1114
- return new DocCustomSchemaFieldMultiTextValue(key, field);
1115
- }
1116
- if (field.type === "multi-number") {
1117
- return new DocCustomSchemaFieldMultiNumberValue(key, field);
1118
- }
1119
- if (field.type === "multi-select-text") {
1120
- return new DocCustomSchemaFieldMultiSelectTextValue(key, field);
1121
- }
1122
- if (field.type === "multi-select-number") {
1123
- return new DocCustomSchemaFieldMultiSelectNumberValue(key, field);
1124
- }
1125
- if (field.type === "multi-relation") {
1126
- return new DocCustomSchemaFieldMultiRelationValue(key, field);
1127
- }
1128
- throw new Error("Unknown field type");
1129
- }
1130
- defaultValue(type) {
1131
- if (type === "text") {
1132
- return DocMetaFieldTextValue.defaultValue();
1133
- }
1134
- if (type === "number") {
1135
- return DocMetaFieldNumberValue.defaultValue();
1136
- }
1137
- if (type === "boolean") {
1138
- return DocMetaFieldBooleanValue.defaultValue();
1139
- }
1140
- if (type === "select-text") {
1141
- return DocMetaFieldSelectTextValue.defaultValue();
1142
- }
1143
- if (type === "select-number") {
1144
- return DocMetaFieldSelectNumberValue.defaultValue();
1145
- }
1146
- if (type === "relation") {
1147
- return DocMetaFieldRelationValue.defaultValue();
1148
- }
1149
- if (type === "multi-text") {
1150
- return DocMetaFieldMultiTextValue.defaultValue();
1151
- }
1152
- if (type === "multi-number") {
1153
- return DocMetaFieldMultiNumberValue.defaultValue();
1154
- }
1155
- if (type === "multi-select-text") {
1156
- return DocMetaFieldMultiSelectTextValue.defaultValue();
1157
- }
1158
- if (type === "multi-select-number") {
1159
- return DocMetaFieldMultiSelectNumberValue.defaultValue();
1160
- }
1161
- if (type === "multi-relation") {
1162
- return DocMetaFieldMultiRelationValue.defaultValue();
1163
- }
1164
- throw new Error(`Unknown field type: ${type}`);
1165
- }
1166
- };
1167
-
1168
1152
  // lib/values/doc-meta-field/doc-meta-field-factory.ts
1169
1153
  var DocMetaFieldFactory = class {
1170
1154
  fromType(key, type, value) {
@@ -1370,7 +1354,13 @@ var DocFileMdMetaValue = class _DocFileMdMetaValue {
1370
1354
  */
1371
1355
  static fromYamlText(yamlText, customSchema) {
1372
1356
  const yamlRecord = parse(yamlText);
1373
- const record = zDocFileMdMeta.parse(yamlRecord);
1357
+ const record = zDocFileMdMetaInput.transform((meta) => {
1358
+ const result = {};
1359
+ for (const [key, value] of Object.entries(meta)) {
1360
+ result[key] = value === void 0 ? null : value;
1361
+ }
1362
+ return zDocFileMdMeta.parse(result);
1363
+ }).parse(yamlRecord);
1374
1364
  const schemaFieldKeys = Object.keys(customSchema);
1375
1365
  const factory = new DocCustomSchemaFieldFactory();
1376
1366
  const validatedRecord = {};
@@ -1957,7 +1947,7 @@ import { stringify as stringify3 } from "yaml";
1957
1947
  import { parse as parse2, stringify as stringify2 } from "yaml";
1958
1948
 
1959
1949
  // lib/values/doc-schema-field/doc-schema-field-boolean-value.ts
1960
- var DocSchemaFieldBooleanSingleValue = class _DocSchemaFieldBooleanSingleValue {
1950
+ var DocSchemaFieldBooleanValue = class _DocSchemaFieldBooleanValue {
1961
1951
  constructor(key, value) {
1962
1952
  this.key = key;
1963
1953
  this.value = value;
@@ -1991,7 +1981,7 @@ var DocSchemaFieldBooleanSingleValue = class _DocSchemaFieldBooleanSingleValue {
1991
1981
  return typeof value === "boolean";
1992
1982
  }
1993
1983
  static empty(key) {
1994
- return new _DocSchemaFieldBooleanSingleValue(key, {
1984
+ return new _DocSchemaFieldBooleanValue(key, {
1995
1985
  type: "boolean",
1996
1986
  required: false,
1997
1987
  title: null,
@@ -2001,7 +1991,7 @@ var DocSchemaFieldBooleanSingleValue = class _DocSchemaFieldBooleanSingleValue {
2001
1991
  }
2002
1992
  static normalize(key, record) {
2003
1993
  const value = record;
2004
- return new _DocSchemaFieldBooleanSingleValue(key, {
1994
+ return new _DocSchemaFieldBooleanValue(key, {
2005
1995
  type: value.type,
2006
1996
  required: value.required,
2007
1997
  title: value.title ?? null,
@@ -2326,7 +2316,7 @@ var DocSchemaFieldMultiTextValue = class _DocSchemaFieldMultiTextValue {
2326
2316
  };
2327
2317
 
2328
2318
  // lib/values/doc-schema-field/doc-schema-field-number-value.ts
2329
- var DocSchemaFieldNumberSingleValue = class _DocSchemaFieldNumberSingleValue {
2319
+ var DocSchemaFieldNumberValue = class _DocSchemaFieldNumberValue {
2330
2320
  constructor(key, value) {
2331
2321
  this.key = key;
2332
2322
  this.value = value;
@@ -2360,7 +2350,7 @@ var DocSchemaFieldNumberSingleValue = class _DocSchemaFieldNumberSingleValue {
2360
2350
  return typeof value === "number";
2361
2351
  }
2362
2352
  static empty(key) {
2363
- return new _DocSchemaFieldNumberSingleValue(key, {
2353
+ return new _DocSchemaFieldNumberValue(key, {
2364
2354
  type: "number",
2365
2355
  required: false,
2366
2356
  title: null,
@@ -2370,7 +2360,7 @@ var DocSchemaFieldNumberSingleValue = class _DocSchemaFieldNumberSingleValue {
2370
2360
  }
2371
2361
  static normalize(key, record) {
2372
2362
  const value = record;
2373
- return new _DocSchemaFieldNumberSingleValue(key, {
2363
+ return new _DocSchemaFieldNumberValue(key, {
2374
2364
  type: value.type,
2375
2365
  required: value.required,
2376
2366
  title: value.title ?? null,
@@ -2381,7 +2371,7 @@ var DocSchemaFieldNumberSingleValue = class _DocSchemaFieldNumberSingleValue {
2381
2371
  };
2382
2372
 
2383
2373
  // lib/values/doc-schema-field/doc-schema-field-relation-value.ts
2384
- var DocSchemaFieldRelationSingleValue = class _DocSchemaFieldRelationSingleValue {
2374
+ var DocSchemaFieldRelationValue = class _DocSchemaFieldRelationValue {
2385
2375
  constructor(key, value) {
2386
2376
  this.key = key;
2387
2377
  this.value = value;
@@ -2418,7 +2408,7 @@ var DocSchemaFieldRelationSingleValue = class _DocSchemaFieldRelationSingleValue
2418
2408
  return typeof value === "string";
2419
2409
  }
2420
2410
  static empty(key) {
2421
- return new _DocSchemaFieldRelationSingleValue(key, {
2411
+ return new _DocSchemaFieldRelationValue(key, {
2422
2412
  type: "relation",
2423
2413
  required: false,
2424
2414
  title: null,
@@ -2429,7 +2419,7 @@ var DocSchemaFieldRelationSingleValue = class _DocSchemaFieldRelationSingleValue
2429
2419
  }
2430
2420
  static normalize(key, record) {
2431
2421
  const value = record;
2432
- return new _DocSchemaFieldRelationSingleValue(key, {
2422
+ return new _DocSchemaFieldRelationValue(key, {
2433
2423
  type: value.type,
2434
2424
  required: value.required,
2435
2425
  title: value.title ?? null,
@@ -2441,7 +2431,7 @@ var DocSchemaFieldRelationSingleValue = class _DocSchemaFieldRelationSingleValue
2441
2431
  };
2442
2432
 
2443
2433
  // lib/values/doc-schema-field/doc-schema-field-select-number-value.ts
2444
- var DocSchemaFieldSelectNumberSingleValue = class _DocSchemaFieldSelectNumberSingleValue {
2434
+ var DocSchemaFieldSelectNumberValue = class _DocSchemaFieldSelectNumberValue {
2445
2435
  constructor(key, value) {
2446
2436
  this.key = key;
2447
2437
  this.value = value;
@@ -2481,7 +2471,7 @@ var DocSchemaFieldSelectNumberSingleValue = class _DocSchemaFieldSelectNumberSin
2481
2471
  return { ...this.value };
2482
2472
  }
2483
2473
  static empty(key) {
2484
- return new _DocSchemaFieldSelectNumberSingleValue(key, {
2474
+ return new _DocSchemaFieldSelectNumberValue(key, {
2485
2475
  type: "select-number",
2486
2476
  required: false,
2487
2477
  title: null,
@@ -2492,7 +2482,7 @@ var DocSchemaFieldSelectNumberSingleValue = class _DocSchemaFieldSelectNumberSin
2492
2482
  }
2493
2483
  static normalize(key, record) {
2494
2484
  const value = record;
2495
- return new _DocSchemaFieldSelectNumberSingleValue(key, {
2485
+ return new _DocSchemaFieldSelectNumberValue(key, {
2496
2486
  type: value.type,
2497
2487
  required: value.required,
2498
2488
  title: value.title ?? null,
@@ -2504,7 +2494,7 @@ var DocSchemaFieldSelectNumberSingleValue = class _DocSchemaFieldSelectNumberSin
2504
2494
  };
2505
2495
 
2506
2496
  // lib/values/doc-schema-field/doc-schema-field-select-text-value.ts
2507
- var DocSchemaFieldSelectTextSingleValue = class _DocSchemaFieldSelectTextSingleValue {
2497
+ var DocSchemaFieldSelectTextValue = class _DocSchemaFieldSelectTextValue {
2508
2498
  constructor(key, value) {
2509
2499
  this.key = key;
2510
2500
  this.value = value;
@@ -2546,7 +2536,7 @@ var DocSchemaFieldSelectTextSingleValue = class _DocSchemaFieldSelectTextSingleV
2546
2536
  return typeof value === "string";
2547
2537
  }
2548
2538
  static empty(key) {
2549
- return new _DocSchemaFieldSelectTextSingleValue(key, {
2539
+ return new _DocSchemaFieldSelectTextValue(key, {
2550
2540
  type: "select-text",
2551
2541
  required: false,
2552
2542
  title: null,
@@ -2557,7 +2547,7 @@ var DocSchemaFieldSelectTextSingleValue = class _DocSchemaFieldSelectTextSingleV
2557
2547
  }
2558
2548
  static normalize(key, record) {
2559
2549
  const value = record;
2560
- return new _DocSchemaFieldSelectTextSingleValue(key, {
2550
+ return new _DocSchemaFieldSelectTextValue(key, {
2561
2551
  type: value.type,
2562
2552
  required: value.required,
2563
2553
  title: value.title ?? null,
@@ -2569,7 +2559,7 @@ var DocSchemaFieldSelectTextSingleValue = class _DocSchemaFieldSelectTextSingleV
2569
2559
  };
2570
2560
 
2571
2561
  // lib/values/doc-schema-field/doc-schema-field-text-value.ts
2572
- var DocSchemaFieldTextSingleValue = class _DocSchemaFieldTextSingleValue {
2562
+ var DocSchemaFieldTextValue = class _DocSchemaFieldTextValue {
2573
2563
  constructor(key, value) {
2574
2564
  this.key = key;
2575
2565
  this.value = value;
@@ -2603,7 +2593,7 @@ var DocSchemaFieldTextSingleValue = class _DocSchemaFieldTextSingleValue {
2603
2593
  return typeof value === "string";
2604
2594
  }
2605
2595
  static empty(key) {
2606
- return new _DocSchemaFieldTextSingleValue(key, {
2596
+ return new _DocSchemaFieldTextValue(key, {
2607
2597
  type: "text",
2608
2598
  required: false,
2609
2599
  title: null,
@@ -2613,7 +2603,7 @@ var DocSchemaFieldTextSingleValue = class _DocSchemaFieldTextSingleValue {
2613
2603
  }
2614
2604
  static normalize(key, record) {
2615
2605
  const value = record;
2616
- return new _DocSchemaFieldTextSingleValue(key, {
2606
+ return new _DocSchemaFieldTextValue(key, {
2617
2607
  type: value.type,
2618
2608
  required: value.required,
2619
2609
  title: value.title ?? null,
@@ -2627,22 +2617,22 @@ var DocSchemaFieldTextSingleValue = class _DocSchemaFieldTextSingleValue {
2627
2617
  var DocFileIndexSchemaFieldFactory = class {
2628
2618
  empty(key, type) {
2629
2619
  if (type === "text") {
2630
- return DocSchemaFieldTextSingleValue.empty(key);
2620
+ return DocSchemaFieldTextValue.empty(key);
2631
2621
  }
2632
2622
  if (type === "number") {
2633
- return DocSchemaFieldNumberSingleValue.empty(key);
2623
+ return DocSchemaFieldNumberValue.empty(key);
2634
2624
  }
2635
2625
  if (type === "boolean") {
2636
- return DocSchemaFieldBooleanSingleValue.empty(key);
2626
+ return DocSchemaFieldBooleanValue.empty(key);
2637
2627
  }
2638
2628
  if (type === "select-text") {
2639
- return DocSchemaFieldSelectTextSingleValue.empty(key);
2629
+ return DocSchemaFieldSelectTextValue.empty(key);
2640
2630
  }
2641
2631
  if (type === "select-number") {
2642
- return DocSchemaFieldSelectNumberSingleValue.empty(key);
2632
+ return DocSchemaFieldSelectNumberValue.empty(key);
2643
2633
  }
2644
2634
  if (type === "relation") {
2645
- return DocSchemaFieldRelationSingleValue.empty(key);
2635
+ return DocSchemaFieldRelationValue.empty(key);
2646
2636
  }
2647
2637
  if (type === "multi-text") {
2648
2638
  return DocSchemaFieldMultiTextValue.empty(key);
@@ -2665,22 +2655,22 @@ var DocFileIndexSchemaFieldFactory = class {
2665
2655
  const value = record;
2666
2656
  const type = value.type;
2667
2657
  if (type === "text") {
2668
- return DocSchemaFieldTextSingleValue.normalize(key, record);
2658
+ return DocSchemaFieldTextValue.normalize(key, record);
2669
2659
  }
2670
2660
  if (type === "number") {
2671
- return DocSchemaFieldNumberSingleValue.normalize(key, record);
2661
+ return DocSchemaFieldNumberValue.normalize(key, record);
2672
2662
  }
2673
2663
  if (type === "boolean") {
2674
- return DocSchemaFieldBooleanSingleValue.normalize(key, record);
2664
+ return DocSchemaFieldBooleanValue.normalize(key, record);
2675
2665
  }
2676
2666
  if (type === "select-text") {
2677
- return DocSchemaFieldSelectTextSingleValue.normalize(key, record);
2667
+ return DocSchemaFieldSelectTextValue.normalize(key, record);
2678
2668
  }
2679
2669
  if (type === "select-number") {
2680
- return DocSchemaFieldSelectNumberSingleValue.normalize(key, record);
2670
+ return DocSchemaFieldSelectNumberValue.normalize(key, record);
2681
2671
  }
2682
2672
  if (type === "relation") {
2683
- return DocSchemaFieldRelationSingleValue.normalize(key, record);
2673
+ return DocSchemaFieldRelationValue.normalize(key, record);
2684
2674
  }
2685
2675
  if (type === "multi-text") {
2686
2676
  return DocSchemaFieldMultiTextValue.normalize(key, record);
@@ -2728,20 +2718,17 @@ var DocFileIndexSchemaValue = class _DocFileIndexSchemaValue {
2728
2718
  }
2729
2719
  switch (fieldValue.type) {
2730
2720
  case "text":
2731
- return new DocSchemaFieldTextSingleValue(key, fieldValue);
2721
+ return new DocSchemaFieldTextValue(key, fieldValue);
2732
2722
  case "number":
2733
- return new DocSchemaFieldNumberSingleValue(key, fieldValue);
2723
+ return new DocSchemaFieldNumberValue(key, fieldValue);
2734
2724
  case "boolean":
2735
- return new DocSchemaFieldBooleanSingleValue(key, fieldValue);
2725
+ return new DocSchemaFieldBooleanValue(key, fieldValue);
2736
2726
  case "relation":
2737
- return new DocSchemaFieldRelationSingleValue(key, fieldValue);
2727
+ return new DocSchemaFieldRelationValue(key, fieldValue);
2738
2728
  case "select-text":
2739
- return new DocSchemaFieldSelectTextSingleValue(key, fieldValue);
2729
+ return new DocSchemaFieldSelectTextValue(key, fieldValue);
2740
2730
  case "select-number":
2741
- return new DocSchemaFieldSelectNumberSingleValue(
2742
- key,
2743
- fieldValue
2744
- );
2731
+ return new DocSchemaFieldSelectNumberValue(key, fieldValue);
2745
2732
  case "multi-text":
2746
2733
  return new DocSchemaFieldMultiTextValue(key, fieldValue);
2747
2734
  case "multi-number":
@@ -2767,7 +2754,7 @@ var DocFileIndexSchemaValue = class _DocFileIndexSchemaValue {
2767
2754
  if (fieldValue.type !== "relation") {
2768
2755
  throw new Error(`Field "${key}" is not a relation field.`);
2769
2756
  }
2770
- return new DocSchemaFieldRelationSingleValue(key, fieldValue);
2757
+ return new DocSchemaFieldRelationValue(key, fieldValue);
2771
2758
  }
2772
2759
  multiRelation(key) {
2773
2760
  const fieldValue = this.value[key];
@@ -2794,7 +2781,7 @@ var DocFileIndexSchemaValue = class _DocFileIndexSchemaValue {
2794
2781
  }
2795
2782
  get relationFields() {
2796
2783
  return this.fields.filter((t) => {
2797
- return t instanceof DocSchemaFieldRelationSingleValue || t instanceof DocSchemaFieldMultiRelationValue;
2784
+ return t instanceof DocSchemaFieldRelationValue || t instanceof DocSchemaFieldMultiRelationValue;
2798
2785
  });
2799
2786
  }
2800
2787
  toJson() {
@@ -3353,8 +3340,10 @@ var DocFileIndexReference = class _DocFileIndexReference {
3353
3340
  const fieldKeys = Object.keys(schema);
3354
3341
  for (const key of fieldKeys) {
3355
3342
  const fieldValue = schema.value[key];
3356
- if (!fieldValue || fieldValue.type !== "relation" && fieldValue.type !== "multi-relation")
3343
+ if (fieldValue === void 0) continue;
3344
+ if (fieldValue.type !== "relation" && fieldValue.type !== "multi-relation") {
3357
3345
  continue;
3346
+ }
3358
3347
  const field = schema.field(key);
3359
3348
  const fileRef = new DocFileRelationReference({
3360
3349
  filePath: field.path,
@@ -4707,7 +4696,7 @@ var DocClient = class {
4707
4696
  this.fileSystem = props.fileSystem;
4708
4697
  this.pathSystem = props.pathSystem ?? new DocPathSystem();
4709
4698
  this.markdownSystem = props.markdownSystem ?? new DocMarkdownSystem();
4710
- this.config = props.config ?? {
4699
+ const defaultConfig = {
4711
4700
  defaultIndexIcon: "\u{1F4C3}",
4712
4701
  indexFileName: "index.md",
4713
4702
  archiveDirectoryName: "_",
@@ -4715,6 +4704,7 @@ var DocClient = class {
4715
4704
  indexMetaIncludes: [],
4716
4705
  directoryExcludes: [".vitepress"]
4717
4706
  };
4707
+ this.config = props.config ? zDocClientConfig.parse(props.config) : defaultConfig;
4718
4708
  this.fileTreeSystem = props.fileTreeSystem ?? new DocFileTreeSystem({
4719
4709
  fileSystem: this.fileSystem,
4720
4710
  pathSystem: this.pathSystem,
@@ -5024,198 +5014,277 @@ var DocFileSystem = class {
5024
5014
  }
5025
5015
  };
5026
5016
 
5027
- // lib/values/doc-directory-path-value.ts
5028
- var DocDirectoryPathValue = class _DocDirectoryPathValue {
5029
- constructor(value, pathSystem) {
5030
- this.value = value;
5031
- this.pathSystem = pathSystem;
5017
+ // lib/doc-file-system-debug.ts
5018
+ var DocFileSystemDebug = class _DocFileSystemDebug extends DocFileSystem {
5019
+ files = /* @__PURE__ */ new Map();
5020
+ _pathSystem;
5021
+ constructor(props) {
5022
+ super(props);
5023
+ this._pathSystem = props.pathSystem;
5032
5024
  Object.freeze(this);
5033
5025
  }
5034
5026
  /**
5035
- * Relative directory path
5027
+ * PathSystem accessor (for testing)
5036
5028
  */
5037
- get path() {
5038
- return this.value.path;
5029
+ getPathSystem() {
5030
+ return this._pathSystem;
5039
5031
  }
5040
5032
  /**
5041
- * Directory name
5033
+ * Factory method for testing
5042
5034
  */
5043
- get name() {
5044
- return this.value.name;
5035
+ static createWithFiles(props) {
5036
+ const pathSystem = new DocPathSystem();
5037
+ const basePath = props.basePath ?? "/test";
5038
+ const fileSystem = new _DocFileSystemDebug({ basePath, pathSystem });
5039
+ if (props.fileContents) {
5040
+ const now = /* @__PURE__ */ new Date();
5041
+ for (const [path, content] of Object.entries(props.fileContents)) {
5042
+ fileSystem.files.set(path, {
5043
+ content,
5044
+ modifiedTime: now,
5045
+ createdTime: now,
5046
+ size: new TextEncoder().encode(content).length
5047
+ });
5048
+ }
5049
+ }
5050
+ return fileSystem;
5045
5051
  }
5046
- /**
5047
- * Get parent directory path
5048
- */
5049
- get parent() {
5050
- if (this.path === "." || this.path === "") {
5052
+ async readFile(filePath) {
5053
+ const normalizedPath = filePath.startsWith("docs/") ? filePath : `docs/${filePath}`;
5054
+ const file = this.files.get(normalizedPath);
5055
+ return file ? file.content : null;
5056
+ }
5057
+ async writeFile(filePath, content) {
5058
+ const normalizedPath = filePath.startsWith("docs/") ? filePath : `docs/${filePath}`;
5059
+ const now = /* @__PURE__ */ new Date();
5060
+ const existing = this.files.get(normalizedPath);
5061
+ this.files.set(normalizedPath, {
5062
+ content,
5063
+ modifiedTime: now,
5064
+ createdTime: existing?.createdTime ?? now,
5065
+ size: new TextEncoder().encode(content).length
5066
+ });
5067
+ }
5068
+ async deleteFile(filePath) {
5069
+ const normalizedPath = filePath.startsWith("docs/") ? filePath : `docs/${filePath}`;
5070
+ try {
5071
+ this.files.delete(normalizedPath);
5051
5072
  return null;
5073
+ } catch (error) {
5074
+ return new Error(`Failed to delete file at ${filePath}: ${error}`);
5052
5075
  }
5053
- const parentPath = this.pathSystem.dirname(this.path);
5054
- const parentName = parentPath === "." ? "" : this.pathSystem.basename(parentPath);
5055
- return new _DocDirectoryPathValue(
5056
- {
5057
- path: parentPath,
5058
- name: parentName,
5059
- fullPath: this.pathSystem.dirname(this.fullPath)
5060
- },
5061
- this.pathSystem
5062
- );
5063
5076
  }
5064
- /**
5065
- * Parent directory path
5066
- */
5067
- get parentPath() {
5068
- return this.pathSystem.dirname(this.path);
5077
+ async exists(filePath) {
5078
+ const normalizedPath = filePath.startsWith("docs/") ? filePath : `docs/${filePath}`;
5079
+ if (this.files.has(normalizedPath)) {
5080
+ return true;
5081
+ }
5082
+ const dirPath = normalizedPath.endsWith("/") ? normalizedPath : `${normalizedPath}/`;
5083
+ for (const path of this.files.keys()) {
5084
+ if (path.startsWith(dirPath)) {
5085
+ return true;
5086
+ }
5087
+ }
5088
+ return false;
5069
5089
  }
5070
- /**
5071
- * Depth (number of directory levels)
5072
- */
5073
- get depth() {
5074
- if (this.path === "." || this.path === "") {
5075
- return 0;
5090
+ async copyFile(source, destination) {
5091
+ const normalizedSource = source.startsWith("docs/") ? source : `docs/${source}`;
5092
+ const normalizedDest = destination.startsWith("docs/") ? destination : `docs/${destination}`;
5093
+ const file = this.files.get(normalizedSource);
5094
+ if (!file) {
5095
+ throw new Error(`Source file not found: ${normalizedSource}`);
5076
5096
  }
5077
- return this.path.split(this.pathSystem.separator).filter(Boolean).length;
5097
+ this.files.set(normalizedDest, {
5098
+ ...file,
5099
+ createdTime: /* @__PURE__ */ new Date()
5100
+ });
5078
5101
  }
5079
- /**
5080
- * Path segments (array of directories)
5081
- */
5082
- get segments() {
5083
- return this.path.split(this.pathSystem.separator).filter(Boolean);
5102
+ async moveFile(source, destination) {
5103
+ const normalizedSource = source.startsWith("docs/") ? source : `docs/${source}`;
5104
+ const normalizedDest = destination.startsWith("docs/") ? destination : `docs/${destination}`;
5105
+ const file = this.files.get(normalizedSource);
5106
+ if (!file) {
5107
+ throw new Error(`Source file not found: ${normalizedSource}`);
5108
+ }
5109
+ this.files.set(normalizedDest, file);
5110
+ this.files.delete(normalizedSource);
5111
+ }
5112
+ async readDirectory(directoryPath) {
5113
+ const dirPath = directoryPath.endsWith("/") ? directoryPath : `${directoryPath}/`;
5114
+ const entries = /* @__PURE__ */ new Set();
5115
+ for (const path of this.files.keys()) {
5116
+ if (path.startsWith(dirPath)) {
5117
+ const relativePath = path.slice(dirPath.length);
5118
+ const firstSegment = relativePath.split("/")[0];
5119
+ if (firstSegment) {
5120
+ entries.add(firstSegment);
5121
+ }
5122
+ }
5123
+ }
5124
+ return Array.from(entries).sort();
5084
5125
  }
5085
- /**
5086
- * Relative path from root (without leading slash)
5087
- */
5088
- get normalizedPath() {
5089
- return this.path.replace(/^\/+/, "");
5126
+ async readDirectoryRecursive(directoryPath) {
5127
+ const dirPath = directoryPath.endsWith("/") ? directoryPath : `${directoryPath}/`;
5128
+ const files = [];
5129
+ for (const path of this.files.keys()) {
5130
+ if (path.startsWith(dirPath)) {
5131
+ files.push(path);
5132
+ }
5133
+ }
5134
+ return files.sort();
5090
5135
  }
5091
- /**
5092
- * Whether this is an archive directory (directory name is "_")
5093
- */
5094
- get isArchived() {
5095
- return this.name === "_";
5136
+ async readDirectoryFilePaths(directoryPath) {
5137
+ const dirPath = directoryPath.endsWith("/") ? directoryPath : `${directoryPath}/`;
5138
+ const files = [];
5139
+ for (const path of this.files.keys()) {
5140
+ if (path.startsWith(dirPath) && !path.slice(dirPath.length).includes("/")) {
5141
+ files.push(path);
5142
+ }
5143
+ }
5144
+ return files.sort();
5145
+ }
5146
+ async createDirectory(_directoryPath) {
5147
+ }
5148
+ async deleteDirectory(directoryPath) {
5149
+ const dirPath = directoryPath.endsWith("/") ? directoryPath : `${directoryPath}/`;
5150
+ for (const path of this.files.keys()) {
5151
+ if (path.startsWith(dirPath)) {
5152
+ this.files.delete(path);
5153
+ }
5154
+ }
5155
+ }
5156
+ async getFileSize(filePath) {
5157
+ const normalizedPath = filePath.startsWith("docs/") ? filePath : `docs/${filePath}`;
5158
+ const file = this.files.get(normalizedPath);
5159
+ if (!file) {
5160
+ throw new Error(`File not found: ${normalizedPath}`);
5161
+ }
5162
+ return file.size;
5163
+ }
5164
+ async getFileModifiedTime(filePath) {
5165
+ const normalizedPath = filePath.startsWith("docs/") ? filePath : `docs/${filePath}`;
5166
+ const file = this.files.get(normalizedPath);
5167
+ if (!file) {
5168
+ throw new Error(`File not found: ${normalizedPath}`);
5169
+ }
5170
+ return file.modifiedTime;
5171
+ }
5172
+ async getFileCreatedTime(filePath) {
5173
+ const normalizedPath = filePath.startsWith("docs/") ? filePath : `docs/${filePath}`;
5174
+ const file = this.files.get(normalizedPath);
5175
+ if (!file) {
5176
+ throw new Error(`File not found: ${normalizedPath}`);
5177
+ }
5178
+ return file.createdTime;
5179
+ }
5180
+ async isDirectory(relativePath) {
5181
+ const normalizedPath = relativePath.startsWith("docs/") ? relativePath : `docs/${relativePath}`;
5182
+ const dirPath = normalizedPath.endsWith("/") ? normalizedPath : `${normalizedPath}/`;
5183
+ for (const path of this.files.keys()) {
5184
+ if (path.startsWith(dirPath)) {
5185
+ return true;
5186
+ }
5187
+ }
5188
+ return false;
5189
+ }
5190
+ async isFile(relativePath) {
5191
+ const normalizedPath = relativePath.startsWith("docs/") ? relativePath : `docs/${relativePath}`;
5192
+ return this.files.has(normalizedPath);
5096
5193
  }
5097
5194
  /**
5098
- * Whether this is a hidden directory
5195
+ * Get list of entries in directory
5099
5196
  */
5100
- get isHidden() {
5101
- return this.name.startsWith(".");
5197
+ async readDirectoryFileNames(directoryPath = "") {
5198
+ const normalizedDir = directoryPath === "" ? "docs" : directoryPath.startsWith("docs/") ? directoryPath : `docs/${directoryPath}`;
5199
+ const dirPath = normalizedDir.endsWith("/") ? normalizedDir : `${normalizedDir}/`;
5200
+ const entries = /* @__PURE__ */ new Set();
5201
+ for (const path of this.files.keys()) {
5202
+ if (path.startsWith(dirPath)) {
5203
+ const relativePath = path.slice(dirPath.length);
5204
+ const firstSegment = relativePath.split("/")[0];
5205
+ if (firstSegment) {
5206
+ entries.add(firstSegment);
5207
+ }
5208
+ }
5209
+ }
5210
+ return Array.from(entries).sort();
5102
5211
  }
5103
5212
  /**
5104
- * Whether this is the root directory
5213
+ * Check if directory exists
5105
5214
  */
5106
- get isRoot() {
5107
- return this.path === "." || this.path === "";
5215
+ async directoryExists(relativePath) {
5216
+ return this.isDirectory(relativePath);
5108
5217
  }
5109
5218
  /**
5110
- * Absolute path
5219
+ * Check if file exists
5111
5220
  */
5112
- get fullPath() {
5113
- return this.value.fullPath;
5221
+ async fileExists(relativePath) {
5222
+ return this.isFile(relativePath);
5114
5223
  }
5115
5224
  /**
5116
- * Get index file path
5225
+ * Create directory if it doesn't exist
5117
5226
  */
5118
- get indexFile() {
5119
- return DocFilePathValue.fromPathWithSystem(
5120
- this.pathSystem.join(this.path, "index.md"),
5121
- this.pathSystem,
5122
- this.pathSystem.dirname(this.fullPath)
5123
- );
5227
+ async ensureDirectoryExists(_relativePath) {
5124
5228
  }
5125
5229
  /**
5126
- * Create file path
5230
+ * Clear all files
5127
5231
  */
5128
- file(fileName) {
5129
- return DocFilePathValue.fromPathWithSystem(
5130
- this.pathSystem.join(this.path, fileName),
5131
- this.pathSystem,
5132
- this.pathSystem.dirname(this.fullPath)
5133
- );
5232
+ clear() {
5233
+ this.files.clear();
5134
5234
  }
5135
5235
  /**
5136
- * Create subdirectory path
5236
+ * Check file existence (for testing)
5137
5237
  */
5138
- subdirectory(dirName) {
5139
- const subPath = this.pathSystem.join(this.path, dirName);
5140
- return new _DocDirectoryPathValue(
5141
- {
5142
- path: subPath,
5143
- name: dirName,
5144
- fullPath: this.pathSystem.join(this.fullPath, dirName)
5145
- },
5146
- this.pathSystem
5147
- );
5238
+ hasFile(filePath) {
5239
+ return this.files.has(filePath);
5148
5240
  }
5149
5241
  /**
5150
- * Create instance from relative path (DI support)
5242
+ * Get file content (sync version, for testing)
5151
5243
  */
5152
- static fromPathWithSystem(dirPath, basePath, pathSystem) {
5153
- const name = dirPath === "." ? "" : pathSystem.basename(dirPath);
5154
- const fullPath = dirPath === "." ? basePath : pathSystem.join(basePath, dirPath);
5155
- return new _DocDirectoryPathValue(
5156
- {
5157
- path: dirPath,
5158
- name,
5159
- fullPath
5160
- },
5161
- pathSystem
5162
- );
5244
+ getFileContent(filePath) {
5245
+ return this.files.get(filePath)?.content;
5163
5246
  }
5164
5247
  /**
5165
- * Export as JSON format
5248
+ * Get all file paths (for testing)
5166
5249
  */
5167
- toJson() {
5168
- return this.value;
5250
+ getAllFilePaths() {
5251
+ return Array.from(this.files.keys()).sort();
5169
5252
  }
5170
5253
  /**
5171
- * Check if paths are equal
5254
+ * Get file count (for testing)
5172
5255
  */
5173
- equals(other) {
5174
- return this.path === other.path;
5256
+ getFileCount() {
5257
+ return this.files.size;
5175
5258
  }
5176
5259
  /**
5177
- * Check if specified directory is a descendant of this directory
5260
+ * Setup test data
5178
5261
  */
5179
- contains(other) {
5180
- const relative = this.pathSystem.relative(this.path, other.path);
5181
- return !relative.startsWith("..") && relative !== "";
5262
+ setupTestFiles(files) {
5263
+ const now = /* @__PURE__ */ new Date();
5264
+ for (const [path, content] of Object.entries(files)) {
5265
+ this.files.set(path, {
5266
+ content,
5267
+ modifiedTime: now,
5268
+ createdTime: now,
5269
+ size: new TextEncoder().encode(content).length
5270
+ });
5271
+ }
5182
5272
  }
5183
5273
  };
5184
5274
  export {
5185
5275
  DocClient,
5186
- DocDirectoryPathValue,
5187
5276
  DocDirectoryReference,
5188
- DocFileIndexContentValue,
5189
5277
  DocFileIndexEntity,
5190
- DocFileIndexMetaValue,
5191
5278
  DocFileIndexReference,
5192
- DocFileIndexSchemaValue,
5193
- DocFileMdContentValue,
5194
5279
  DocFileMdEntity,
5195
- DocFileMdMetaValue,
5196
5280
  DocFileMdReference,
5197
- DocFilePathValue,
5198
5281
  DocFileRelationReference,
5199
5282
  DocFileSystem,
5283
+ DocFileSystemDebug,
5200
5284
  DocFileUnknownEntity,
5201
5285
  DocFileUnknownReference,
5202
5286
  DocMarkdownSystem,
5203
5287
  DocPathSystem,
5204
- DocRelationFileValue,
5205
- DocRelationValue,
5206
- DocSchemaFieldBooleanSingleValue,
5207
- DocSchemaFieldMultiNumberValue as DocSchemaFieldNumberMultipleValue,
5208
- DocSchemaFieldNumberSingleValue,
5209
- DocSchemaFieldMultiRelationValue as DocSchemaFieldRelationMultipleValue,
5210
- DocSchemaFieldRelationSingleValue,
5211
- DocSchemaFieldMultiSelectNumberValue as DocSchemaFieldSelectNumberMultipleValue,
5212
- DocSchemaFieldSelectNumberSingleValue,
5213
- DocSchemaFieldMultiSelectTextValue as DocSchemaFieldSelectTextMultipleValue,
5214
- DocSchemaFieldSelectTextSingleValue,
5215
- DocSchemaFieldMultiTextValue as DocSchemaFieldTextMultipleValue,
5216
- DocSchemaFieldTextSingleValue,
5217
- DocTreeDirectoryNodeValue,
5218
- DocTreeFileNodeValue,
5219
5288
  DocFileTreeSystem as FileTreeSystem,
5220
5289
  zDocClientConfig,
5221
5290
  zDocCustomSchema,
@@ -5235,11 +5304,16 @@ export {
5235
5304
  zDocFileIndex,
5236
5305
  zDocFileIndexContent,
5237
5306
  zDocFileIndexMeta,
5307
+ zDocFileIndexMetaInput,
5238
5308
  zDocFileIndexSchema,
5239
5309
  zDocFileIndexSchemaField,
5310
+ zDocFileIndexSchemaInput,
5240
5311
  zDocFileMd,
5241
5312
  zDocFileMdContent,
5313
+ zDocFileMdContentInput,
5314
+ zDocFileMdInput,
5242
5315
  zDocFileMdMeta,
5316
+ zDocFileMdMetaInput,
5243
5317
  zDocFilePath,
5244
5318
  zDocFileUnknown,
5245
5319
  zDocMetaField,