@interactive-inc/docs-client 1.0.4 → 1.0.8
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.d.ts +582 -409
- package/build/index.js +564 -207
- package/build/models.d.ts +277 -3753
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { zDocClientConfig, zDocFilePath, zDocFileIndexSchemaField, zDocSchemaFieldText, zDocSchemaFieldNumber, zDocSchemaFieldBoolean, zDocSchemaFieldRelation, zDocSchemaFieldSelectText, zDocSchemaFieldSelectNumber, zDocSchemaFieldMultiText, zDocSchemaFieldMultiNumber, zDocSchemaFieldMultiRelation, zDocSchemaFieldMultiSelectText, zDocSchemaFieldMultiSelectNumber, zDocRelation, zDocRelationFile, zDocMetaFieldRelation, zDocMetaFieldMultiRelation, zDocMetaFieldText, zDocMetaFieldNumber, zDocMetaFieldBoolean, zDocMetaFieldMultiText, zDocMetaFieldMultiNumber, zDocMetaFieldMultiBoolean, zDocFileUnknown, zDocMetaField, zDocMetaFieldSelectText, zDocMetaFieldSelectNumber, zDocMetaFieldMultiSelectText, zDocMetaFieldMultiSelectNumber, zDocMetaFieldTypeText, zDocMetaFieldTypeNumber, zDocMetaFieldTypeBoolean, zDocMetaFieldTypeSelectText, zDocMetaFieldTypeSelectNumber, zDocMetaFieldTypeRelation, zDocMetaFieldType
|
|
2
|
+
import { zDocClientConfig, zDocFilePath, zDocFileIndexSchemaField, zDocSchemaFieldText, zDocSchemaFieldNumber, zDocSchemaFieldBoolean, zDocSchemaFieldRelation, zDocSchemaFieldSelectText, zDocSchemaFieldSelectNumber, zDocSchemaFieldMultiText, zDocSchemaFieldMultiNumber, zDocSchemaFieldMultiRelation, zDocSchemaFieldMultiSelectText, zDocSchemaFieldMultiSelectNumber, zDocRelation, zDocRelationFile, zDocMetaFieldRelation, zDocMetaFieldMultiRelation, zDocMetaFieldText, zDocMetaFieldNumber, zDocMetaFieldBoolean, zDocMetaFieldMultiText, zDocMetaFieldMultiNumber, zDocMetaFieldMultiBoolean, zDocFileUnknown, zDocRelationField, zDocMetaField, zDocMetaFieldSelectText, zDocMetaFieldSelectNumber, zDocMetaFieldMultiSelectText, zDocMetaFieldMultiSelectNumber, zDocMetaFieldTypeText, zDocMetaFieldTypeNumber, zDocMetaFieldTypeBoolean, zDocMetaFieldTypeSelectText, zDocMetaFieldTypeSelectNumber, zDocMetaFieldTypeRelation, zDocMetaFieldType } from './models.js';
|
|
3
3
|
export { zDocCustomSchema, zDocCustomSchemaField, zDocCustomSchemaFieldBoolean, zDocCustomSchemaFieldMultiNumber, zDocCustomSchemaFieldMultiRelation, zDocCustomSchemaFieldMultiSelectNumber, zDocCustomSchemaFieldMultiSelectText, zDocCustomSchemaFieldMultiText, zDocCustomSchemaFieldNumber, zDocCustomSchemaFieldRelation, zDocCustomSchemaFieldSelectNumber, zDocCustomSchemaFieldSelectText, zDocCustomSchemaFieldText, zDocFile, zDocFileIndex, zDocFileIndexContent, zDocFileIndexMeta, zDocFileIndexMetaInput, zDocFileIndexSchema, zDocFileIndexSchemaInput, zDocFileMd, zDocFileMdContent, zDocFileMdContentInput, zDocFileMdInput, zDocFileMdMeta, zDocFileMdMetaInput, zDocMetaFieldTypeMultiNumber, zDocMetaFieldTypeMultiRelation, zDocMetaFieldTypeMultiSelectNumber, zDocMetaFieldTypeMultiSelectText, zDocMetaFieldTypeMultiText, zDocTreeDirectoryNode, zDocTreeFileNode, zDocTreeNode } from './models.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -146,18 +146,11 @@ declare class DocFileMdMetaValue<T extends DocCustomSchema> {
|
|
|
146
146
|
readonly value: SchemaToValueType<T>;
|
|
147
147
|
readonly customSchema: T;
|
|
148
148
|
constructor(value: SchemaToValueType<T>, customSchema: T);
|
|
149
|
-
private validateValue;
|
|
150
|
-
private getValueField;
|
|
151
149
|
get keys(): Array<keyof T>;
|
|
152
150
|
/**
|
|
153
151
|
* Return a new instance with a single property updated
|
|
154
152
|
*/
|
|
155
153
|
withProperty<K extends keyof T>(key: K, value: BaseFieldValueType<ExtractFieldType<T[K]>>): DocFileMdMetaValue<T>;
|
|
156
|
-
/**
|
|
157
|
-
* Return a new instance with an unknown schema
|
|
158
|
-
* Allows accepting Record<string, unknown> schemas from external sources
|
|
159
|
-
*/
|
|
160
|
-
withUnknownSchema(draft: Record<string, unknown>): DocFileMdMetaValue<DocCustomSchema>;
|
|
161
154
|
schemaField<K extends keyof T>(key: K): T[K];
|
|
162
155
|
field<K extends keyof T>(key: K): FieldValueType<ExtractFieldType<T[K]>, ExtractRequired<T[K]>>;
|
|
163
156
|
relation(key: keyof T): DocMetaFieldRelation;
|
|
@@ -169,13 +162,15 @@ declare class DocFileMdMetaValue<T extends DocCustomSchema> {
|
|
|
169
162
|
multiNumber(key: keyof T): DocMetaFieldMultiNumber;
|
|
170
163
|
multiBoolean(key: keyof T): DocMetaFieldMultiBoolean;
|
|
171
164
|
hasKey(key: keyof T): boolean;
|
|
165
|
+
toJson(): SchemaToValueType<T>;
|
|
166
|
+
toYaml(): string;
|
|
167
|
+
private validateValue;
|
|
168
|
+
private getValueField;
|
|
172
169
|
/**
|
|
173
170
|
* Generate from Markdown text
|
|
174
171
|
*/
|
|
175
172
|
static fromYamlText<T extends DocCustomSchema>(yamlText: string, customSchema: T): DocFileMdMetaValue<T>;
|
|
176
173
|
static empty<T extends DocCustomSchema>(customSchema: T): DocFileMdMetaValue<T>;
|
|
177
|
-
toJson(): SchemaToValueType<T>;
|
|
178
|
-
toYaml(): string;
|
|
179
174
|
}
|
|
180
175
|
|
|
181
176
|
/**
|
|
@@ -470,321 +465,47 @@ declare class DocFileUnknownReference {
|
|
|
470
465
|
}
|
|
471
466
|
|
|
472
467
|
/**
|
|
473
|
-
*
|
|
468
|
+
* Text field type
|
|
474
469
|
*/
|
|
475
|
-
|
|
476
|
-
readonly key: T;
|
|
477
|
-
readonly value: DocSchemaFieldBoolean;
|
|
478
|
-
constructor(key: T, value: DocSchemaFieldBoolean);
|
|
479
|
-
get type(): "boolean";
|
|
480
|
-
get required(): boolean;
|
|
481
|
-
get title(): string;
|
|
482
|
-
get description(): string;
|
|
483
|
-
get default(): boolean | null;
|
|
484
|
-
readonly isArray = false;
|
|
485
|
-
readonly isSingle = true;
|
|
486
|
-
readonly isBoolean = true;
|
|
487
|
-
toJson(): DocFileIndexSchemaField;
|
|
488
|
-
/**
|
|
489
|
-
* Validate value type
|
|
490
|
-
*/
|
|
491
|
-
validate(value: unknown): boolean;
|
|
492
|
-
static empty(key: RecordKey): DocSchemaFieldBooleanValue<RecordKey>;
|
|
493
|
-
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldBooleanValue<RecordKey>;
|
|
494
|
-
}
|
|
495
|
-
|
|
470
|
+
type DocSchemaFieldText = z.infer<typeof zDocSchemaFieldText>;
|
|
496
471
|
/**
|
|
497
|
-
*
|
|
472
|
+
* Number field type
|
|
498
473
|
*/
|
|
499
|
-
|
|
500
|
-
readonly key: T;
|
|
501
|
-
readonly value: DocSchemaFieldMultiNumber;
|
|
502
|
-
constructor(key: T, value: DocSchemaFieldMultiNumber);
|
|
503
|
-
get type(): "multi-number";
|
|
504
|
-
get required(): boolean;
|
|
505
|
-
get title(): string;
|
|
506
|
-
get description(): string;
|
|
507
|
-
get default(): number[] | null;
|
|
508
|
-
readonly isArray = true;
|
|
509
|
-
readonly isSingle = false;
|
|
510
|
-
readonly isNumber = true;
|
|
511
|
-
/**
|
|
512
|
-
* Validate value
|
|
513
|
-
*/
|
|
514
|
-
validate(value: unknown): boolean;
|
|
515
|
-
toJson(): DocFileIndexSchemaField;
|
|
516
|
-
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiNumberValue<T>;
|
|
517
|
-
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiNumberValue<RecordKey>;
|
|
518
|
-
}
|
|
519
|
-
|
|
474
|
+
type DocSchemaFieldNumber = z.infer<typeof zDocSchemaFieldNumber>;
|
|
520
475
|
/**
|
|
521
|
-
*
|
|
476
|
+
* Boolean field type
|
|
522
477
|
*/
|
|
523
|
-
|
|
524
|
-
readonly key: T;
|
|
525
|
-
readonly value: DocSchemaFieldMultiRelation;
|
|
526
|
-
constructor(key: T, value: DocSchemaFieldMultiRelation);
|
|
527
|
-
get type(): "multi-relation";
|
|
528
|
-
get required(): boolean;
|
|
529
|
-
get title(): string;
|
|
530
|
-
get description(): string;
|
|
531
|
-
get default(): string[] | null;
|
|
532
|
-
get path(): string;
|
|
533
|
-
readonly isArray = true;
|
|
534
|
-
readonly isSingle = false;
|
|
535
|
-
readonly isRelation = true;
|
|
536
|
-
/**
|
|
537
|
-
* Validate value
|
|
538
|
-
*/
|
|
539
|
-
validate(value: unknown): boolean;
|
|
540
|
-
toJson(): DocFileIndexSchemaField;
|
|
541
|
-
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiRelationValue<T>;
|
|
542
|
-
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiRelationValue<RecordKey>;
|
|
543
|
-
}
|
|
544
|
-
|
|
478
|
+
type DocSchemaFieldBoolean = z.infer<typeof zDocSchemaFieldBoolean>;
|
|
545
479
|
/**
|
|
546
|
-
*
|
|
480
|
+
* Multi-text field type
|
|
547
481
|
*/
|
|
548
|
-
|
|
549
|
-
readonly key: T;
|
|
550
|
-
readonly value: DocSchemaFieldMultiSelectNumber;
|
|
551
|
-
constructor(key: T, value: DocSchemaFieldMultiSelectNumber);
|
|
552
|
-
get type(): "multi-select-number";
|
|
553
|
-
get required(): boolean;
|
|
554
|
-
get title(): string;
|
|
555
|
-
get description(): string;
|
|
556
|
-
get default(): number[] | null;
|
|
557
|
-
get options(): number[];
|
|
558
|
-
readonly isArray = true;
|
|
559
|
-
readonly isSingle = false;
|
|
560
|
-
readonly isSelect = true;
|
|
561
|
-
readonly isNumberSelect = true;
|
|
562
|
-
/**
|
|
563
|
-
* Validate value
|
|
564
|
-
*/
|
|
565
|
-
validate(value: unknown): boolean;
|
|
566
|
-
toJson(): DocFileIndexSchemaField;
|
|
567
|
-
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiSelectNumberValue<T>;
|
|
568
|
-
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiSelectNumberValue<RecordKey>;
|
|
569
|
-
}
|
|
570
|
-
|
|
482
|
+
type DocSchemaFieldMultiText = z.infer<typeof zDocSchemaFieldMultiText>;
|
|
571
483
|
/**
|
|
572
|
-
*
|
|
484
|
+
* Multi-number field type
|
|
573
485
|
*/
|
|
574
|
-
|
|
575
|
-
readonly key: T;
|
|
576
|
-
readonly value: DocSchemaFieldMultiSelectText;
|
|
577
|
-
constructor(key: T, value: DocSchemaFieldMultiSelectText);
|
|
578
|
-
get type(): "multi-select-text";
|
|
579
|
-
get required(): boolean;
|
|
580
|
-
get title(): string;
|
|
581
|
-
get description(): string;
|
|
582
|
-
get default(): string[] | null;
|
|
583
|
-
get options(): string[];
|
|
584
|
-
readonly isArray = true;
|
|
585
|
-
readonly isSingle = false;
|
|
586
|
-
readonly isSelect = true;
|
|
587
|
-
readonly isTextSelect = true;
|
|
588
|
-
/**
|
|
589
|
-
* Validate value
|
|
590
|
-
*/
|
|
591
|
-
validate(value: unknown): boolean;
|
|
592
|
-
toJson(): DocFileIndexSchemaField;
|
|
593
|
-
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiSelectTextValue<T>;
|
|
594
|
-
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiSelectTextValue<RecordKey>;
|
|
595
|
-
}
|
|
596
|
-
|
|
486
|
+
type DocSchemaFieldMultiNumber = z.infer<typeof zDocSchemaFieldMultiNumber>;
|
|
597
487
|
/**
|
|
598
|
-
*
|
|
488
|
+
* Relation field type
|
|
599
489
|
*/
|
|
600
|
-
|
|
601
|
-
readonly key: T;
|
|
602
|
-
readonly value: DocSchemaFieldMultiText;
|
|
603
|
-
constructor(key: T, value: DocSchemaFieldMultiText);
|
|
604
|
-
get type(): "multi-text";
|
|
605
|
-
get required(): boolean;
|
|
606
|
-
get title(): string;
|
|
607
|
-
get description(): string;
|
|
608
|
-
get default(): string[] | null;
|
|
609
|
-
readonly isArray = true;
|
|
610
|
-
readonly isSingle = false;
|
|
611
|
-
readonly isText = true;
|
|
612
|
-
toJson(): DocFileIndexSchemaField;
|
|
613
|
-
/**
|
|
614
|
-
* Validate value type
|
|
615
|
-
*/
|
|
616
|
-
validate(value: unknown): boolean;
|
|
617
|
-
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiTextValue<T>;
|
|
618
|
-
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiTextValue<RecordKey>;
|
|
619
|
-
}
|
|
620
|
-
|
|
490
|
+
type DocSchemaFieldRelation = z.infer<typeof zDocSchemaFieldRelation>;
|
|
621
491
|
/**
|
|
622
|
-
*
|
|
492
|
+
* Multi-relation field type
|
|
623
493
|
*/
|
|
624
|
-
|
|
625
|
-
readonly key: T;
|
|
626
|
-
readonly value: DocSchemaFieldNumber;
|
|
627
|
-
constructor(key: T, value: DocSchemaFieldNumber);
|
|
628
|
-
get type(): "number";
|
|
629
|
-
get required(): boolean;
|
|
630
|
-
get title(): string;
|
|
631
|
-
get description(): string;
|
|
632
|
-
get default(): number | null;
|
|
633
|
-
readonly isArray = false;
|
|
634
|
-
readonly isSingle = true;
|
|
635
|
-
readonly isNumber = true;
|
|
636
|
-
toJson(): DocFileIndexSchemaField;
|
|
637
|
-
/**
|
|
638
|
-
* Validate value type
|
|
639
|
-
*/
|
|
640
|
-
validate(value: unknown): boolean;
|
|
641
|
-
static empty(key: RecordKey): DocSchemaFieldNumberValue<RecordKey>;
|
|
642
|
-
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldNumberValue<RecordKey>;
|
|
643
|
-
}
|
|
644
|
-
|
|
494
|
+
type DocSchemaFieldMultiRelation = z.infer<typeof zDocSchemaFieldMultiRelation>;
|
|
645
495
|
/**
|
|
646
|
-
*
|
|
496
|
+
* Select text field type
|
|
647
497
|
*/
|
|
648
|
-
|
|
649
|
-
readonly key: T;
|
|
650
|
-
readonly value: DocSchemaFieldRelation;
|
|
651
|
-
constructor(key: T, value: DocSchemaFieldRelation);
|
|
652
|
-
get type(): "relation";
|
|
653
|
-
get required(): boolean;
|
|
654
|
-
get title(): string;
|
|
655
|
-
get description(): string;
|
|
656
|
-
get default(): string | null;
|
|
657
|
-
get path(): string;
|
|
658
|
-
readonly isArray = false;
|
|
659
|
-
readonly isSingle = true;
|
|
660
|
-
readonly isRelation = true;
|
|
661
|
-
toJson(): DocFileIndexSchemaField;
|
|
662
|
-
/**
|
|
663
|
-
* Validate value type
|
|
664
|
-
*/
|
|
665
|
-
validate(value: unknown): boolean;
|
|
666
|
-
static empty(key: RecordKey): DocSchemaFieldRelationValue<RecordKey>;
|
|
667
|
-
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldRelationValue<RecordKey>;
|
|
668
|
-
}
|
|
669
|
-
|
|
498
|
+
type DocSchemaFieldSelectText = z.infer<typeof zDocSchemaFieldSelectText>;
|
|
670
499
|
/**
|
|
671
|
-
*
|
|
500
|
+
* Select number field type
|
|
672
501
|
*/
|
|
673
|
-
|
|
674
|
-
readonly key: T;
|
|
675
|
-
readonly value: DocSchemaFieldSelectNumber;
|
|
676
|
-
constructor(key: T, value: DocSchemaFieldSelectNumber);
|
|
677
|
-
get type(): "select-number";
|
|
678
|
-
get required(): boolean;
|
|
679
|
-
get title(): string;
|
|
680
|
-
get description(): string;
|
|
681
|
-
get default(): number | null;
|
|
682
|
-
get options(): number[];
|
|
683
|
-
readonly isArray = false;
|
|
684
|
-
readonly isSingle = true;
|
|
685
|
-
readonly isSelect = true;
|
|
686
|
-
readonly isNumberSelect = true;
|
|
687
|
-
/**
|
|
688
|
-
* Validate value
|
|
689
|
-
*/
|
|
690
|
-
validate(value: unknown): boolean;
|
|
691
|
-
toJson(): DocFileIndexSchemaField;
|
|
692
|
-
static empty<T extends RecordKey>(key: T): DocSchemaFieldSelectNumberValue<T>;
|
|
693
|
-
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldSelectNumberValue<RecordKey>;
|
|
694
|
-
}
|
|
695
|
-
|
|
502
|
+
type DocSchemaFieldSelectNumber = z.infer<typeof zDocSchemaFieldSelectNumber>;
|
|
696
503
|
/**
|
|
697
|
-
*
|
|
504
|
+
* Multi-select text field type
|
|
698
505
|
*/
|
|
699
|
-
|
|
700
|
-
readonly key: T;
|
|
701
|
-
readonly value: DocSchemaFieldSelectText;
|
|
702
|
-
constructor(key: T, value: DocSchemaFieldSelectText);
|
|
703
|
-
get type(): "select-text";
|
|
704
|
-
get required(): boolean;
|
|
705
|
-
get title(): string;
|
|
706
|
-
get description(): string;
|
|
707
|
-
get default(): string | null;
|
|
708
|
-
get options(): string[];
|
|
709
|
-
readonly isArray = false;
|
|
710
|
-
readonly isSingle = true;
|
|
711
|
-
readonly isSelect = true;
|
|
712
|
-
readonly isTextSelect = true;
|
|
713
|
-
toJson(): DocFileIndexSchemaField;
|
|
714
|
-
/**
|
|
715
|
-
* Validate value type
|
|
716
|
-
*/
|
|
717
|
-
validate(value: unknown): boolean;
|
|
718
|
-
static empty<T extends RecordKey>(key: T): DocSchemaFieldSelectTextValue<T>;
|
|
719
|
-
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldSelectTextValue<RecordKey>;
|
|
720
|
-
}
|
|
721
|
-
|
|
506
|
+
type DocSchemaFieldMultiSelectText = z.infer<typeof zDocSchemaFieldMultiSelectText>;
|
|
722
507
|
/**
|
|
723
|
-
*
|
|
724
|
-
*/
|
|
725
|
-
declare class DocSchemaFieldTextValue<T extends RecordKey> {
|
|
726
|
-
readonly key: T;
|
|
727
|
-
readonly value: DocSchemaFieldText;
|
|
728
|
-
constructor(key: T, value: DocSchemaFieldText);
|
|
729
|
-
get type(): "text";
|
|
730
|
-
get required(): boolean;
|
|
731
|
-
get title(): string;
|
|
732
|
-
get description(): string;
|
|
733
|
-
get default(): string | null;
|
|
734
|
-
readonly isArray = false;
|
|
735
|
-
readonly isSingle = true;
|
|
736
|
-
readonly isText = true;
|
|
737
|
-
toJson(): DocFileIndexSchemaField;
|
|
738
|
-
/**
|
|
739
|
-
* Validate value type
|
|
740
|
-
*/
|
|
741
|
-
validate(value: unknown): boolean;
|
|
742
|
-
static empty(key: RecordKey): DocSchemaFieldTextValue<RecordKey>;
|
|
743
|
-
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldTextValue<RecordKey>;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
/**
|
|
747
|
-
* Text field type
|
|
748
|
-
*/
|
|
749
|
-
type DocSchemaFieldText = z.infer<typeof zDocSchemaFieldText>;
|
|
750
|
-
/**
|
|
751
|
-
* Number field type
|
|
752
|
-
*/
|
|
753
|
-
type DocSchemaFieldNumber = z.infer<typeof zDocSchemaFieldNumber>;
|
|
754
|
-
/**
|
|
755
|
-
* Boolean field type
|
|
756
|
-
*/
|
|
757
|
-
type DocSchemaFieldBoolean = z.infer<typeof zDocSchemaFieldBoolean>;
|
|
758
|
-
/**
|
|
759
|
-
* Multi-text field type
|
|
760
|
-
*/
|
|
761
|
-
type DocSchemaFieldMultiText = z.infer<typeof zDocSchemaFieldMultiText>;
|
|
762
|
-
/**
|
|
763
|
-
* Multi-number field type
|
|
764
|
-
*/
|
|
765
|
-
type DocSchemaFieldMultiNumber = z.infer<typeof zDocSchemaFieldMultiNumber>;
|
|
766
|
-
/**
|
|
767
|
-
* Relation field type
|
|
768
|
-
*/
|
|
769
|
-
type DocSchemaFieldRelation = z.infer<typeof zDocSchemaFieldRelation>;
|
|
770
|
-
/**
|
|
771
|
-
* Multi-relation field type
|
|
772
|
-
*/
|
|
773
|
-
type DocSchemaFieldMultiRelation = z.infer<typeof zDocSchemaFieldMultiRelation>;
|
|
774
|
-
/**
|
|
775
|
-
* Select text field type
|
|
776
|
-
*/
|
|
777
|
-
type DocSchemaFieldSelectText = z.infer<typeof zDocSchemaFieldSelectText>;
|
|
778
|
-
/**
|
|
779
|
-
* Select number field type
|
|
780
|
-
*/
|
|
781
|
-
type DocSchemaFieldSelectNumber = z.infer<typeof zDocSchemaFieldSelectNumber>;
|
|
782
|
-
/**
|
|
783
|
-
* Multi-select text field type
|
|
784
|
-
*/
|
|
785
|
-
type DocSchemaFieldMultiSelectText = z.infer<typeof zDocSchemaFieldMultiSelectText>;
|
|
786
|
-
/**
|
|
787
|
-
* Multi-select number field type
|
|
508
|
+
* Multi-select number field type
|
|
788
509
|
*/
|
|
789
510
|
type DocSchemaFieldMultiSelectNumber = z.infer<typeof zDocSchemaFieldMultiSelectNumber>;
|
|
790
511
|
type DocMetaField = z.infer<typeof zDocMetaField>;
|
|
@@ -1027,7 +748,7 @@ type DocDirectory<T extends DocCustomSchema> = {
|
|
|
1027
748
|
files: DocFile<T>[];
|
|
1028
749
|
relations: DocRelation[];
|
|
1029
750
|
};
|
|
1030
|
-
type RecordKey =
|
|
751
|
+
type RecordKey = PropertyKey;
|
|
1031
752
|
/**
|
|
1032
753
|
* DocClient configuration
|
|
1033
754
|
*/
|
|
@@ -1071,16 +792,7 @@ type SchemaToValueType<T extends DocCustomSchema> = {
|
|
|
1071
792
|
* Helper type for type-safe property access
|
|
1072
793
|
*/
|
|
1073
794
|
type GetValueType<T extends DocCustomSchema, K extends keyof T> = K extends RequiredKeys<T> ? BaseFieldValueType<ExtractFieldType<T[K]>> : BaseFieldValueType<ExtractFieldType<T[K]>> | undefined | null;
|
|
1074
|
-
/**
|
|
1075
|
-
* Type definitions for DocFileIndexSchema
|
|
1076
|
-
*/
|
|
1077
|
-
type ExtractIndexFieldType<T> = T extends {
|
|
1078
|
-
type: infer Type;
|
|
1079
|
-
} ? Type : never;
|
|
1080
795
|
type GetIndexFieldType<Schema extends DocFileIndexSchema<RecordKey>, K extends keyof Schema> = Schema[K] extends DocFileIndexSchemaField ? Schema[K] : never;
|
|
1081
|
-
type GetIndexFieldValueType<Schema extends DocFileIndexSchema<RecordKey>, K extends keyof Schema> = Schema[K] extends {
|
|
1082
|
-
type: infer Type;
|
|
1083
|
-
} ? Type extends "text" ? DocSchemaFieldTextValue<K> : Type extends "number" ? DocSchemaFieldNumberValue<K> : Type extends "boolean" ? DocSchemaFieldBooleanValue<K> : Type extends "relation" ? DocSchemaFieldRelationValue<K> : Type extends "select-text" ? DocSchemaFieldSelectTextValue<K> : Type extends "select-number" ? DocSchemaFieldSelectNumberValue<K> : Type extends "multi-text" ? DocSchemaFieldMultiTextValue<K> : Type extends "multi-number" ? DocSchemaFieldMultiNumberValue<K> : Type extends "multi-relation" ? DocSchemaFieldMultiRelationValue<K> : Type extends "multi-select-text" ? DocSchemaFieldMultiSelectTextValue<K> : Type extends "multi-select-number" ? DocSchemaFieldMultiSelectNumberValue<K> : never : never;
|
|
1084
796
|
/**
|
|
1085
797
|
* Infers DocFileMd type from the result of defineSchema
|
|
1086
798
|
*/
|
|
@@ -1105,98 +817,372 @@ declare class DocRelationFileValue {
|
|
|
1105
817
|
*/
|
|
1106
818
|
get label(): string;
|
|
1107
819
|
/**
|
|
1108
|
-
*
|
|
820
|
+
* Convert to JSON format
|
|
1109
821
|
*/
|
|
1110
|
-
|
|
822
|
+
toJson(): DocRelationFile;
|
|
1111
823
|
/**
|
|
1112
824
|
* Extract file name from file path (without extension)
|
|
1113
825
|
*/
|
|
1114
826
|
private static extractFileName;
|
|
1115
827
|
/**
|
|
1116
|
-
*
|
|
828
|
+
* Create from file path and title
|
|
829
|
+
*/
|
|
830
|
+
static from(filePath: string, title: string | null): DocRelationFileValue;
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
/**
|
|
834
|
+
* Manages relation information
|
|
835
|
+
*/
|
|
836
|
+
declare class DocRelationValue {
|
|
837
|
+
readonly value: DocRelation;
|
|
838
|
+
constructor(value: DocRelation);
|
|
839
|
+
/**
|
|
840
|
+
* Relation path
|
|
841
|
+
*/
|
|
842
|
+
get path(): string;
|
|
843
|
+
/**
|
|
844
|
+
* Get file count
|
|
845
|
+
*/
|
|
846
|
+
get fileCount(): number;
|
|
847
|
+
/**
|
|
848
|
+
* Whether it's empty
|
|
849
|
+
*/
|
|
850
|
+
get isEmpty(): boolean;
|
|
851
|
+
/**
|
|
852
|
+
* List of related files (value objects)
|
|
853
|
+
*/
|
|
854
|
+
files(): DocRelationFileValue[];
|
|
855
|
+
/**
|
|
856
|
+
* Export as JSON format
|
|
857
|
+
*/
|
|
858
|
+
toJson(): DocRelation;
|
|
859
|
+
/**
|
|
860
|
+
* Create empty relation entity
|
|
861
|
+
*/
|
|
862
|
+
static empty(path: string): DocRelationValue;
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
type Props$6 = {
|
|
866
|
+
filePath: string;
|
|
867
|
+
fileSystem: DocFileSystem;
|
|
868
|
+
pathSystem: DocPathSystem;
|
|
869
|
+
};
|
|
870
|
+
/**
|
|
871
|
+
* Relation file reference
|
|
872
|
+
*/
|
|
873
|
+
declare class DocFileRelationReference {
|
|
874
|
+
private readonly props;
|
|
875
|
+
private readonly pathSystem;
|
|
876
|
+
constructor(props: Props$6);
|
|
877
|
+
get fileSystem(): DocFileSystem;
|
|
878
|
+
get basePath(): string;
|
|
879
|
+
/**
|
|
880
|
+
* Relation path
|
|
881
|
+
*/
|
|
882
|
+
get path(): string;
|
|
883
|
+
/**
|
|
884
|
+
* Full path
|
|
885
|
+
*/
|
|
886
|
+
get fullPath(): string;
|
|
887
|
+
read(): Promise<DocRelationValue | Error | null>;
|
|
888
|
+
/**
|
|
889
|
+
* Read list of relation files
|
|
890
|
+
*/
|
|
891
|
+
readFiles(): Promise<DocRelationFileValue[] | Error>;
|
|
892
|
+
/**
|
|
893
|
+
* Read single relation file
|
|
894
|
+
*/
|
|
895
|
+
readFile(filePath: string): Promise<DocRelationFileValue | Error | null>;
|
|
896
|
+
/**
|
|
897
|
+
* Check if file exists
|
|
898
|
+
*/
|
|
899
|
+
exists(slug: string): Promise<boolean>;
|
|
900
|
+
/**
|
|
901
|
+
* Get list of file names (without extension)
|
|
902
|
+
*/
|
|
903
|
+
readSlugs(): Promise<string[] | Error>;
|
|
904
|
+
/**
|
|
905
|
+
* Get file count
|
|
906
|
+
*/
|
|
907
|
+
count(): Promise<number | Error>;
|
|
908
|
+
/**
|
|
909
|
+
* Check if empty
|
|
910
|
+
*/
|
|
911
|
+
isEmpty(): Promise<boolean | Error>;
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* Single boolean type schema field
|
|
916
|
+
*/
|
|
917
|
+
declare class DocSchemaFieldBooleanValue<T extends RecordKey> {
|
|
918
|
+
readonly key: T;
|
|
919
|
+
readonly value: DocSchemaFieldBoolean;
|
|
920
|
+
constructor(key: T, value: DocSchemaFieldBoolean);
|
|
921
|
+
get type(): "boolean";
|
|
922
|
+
get required(): boolean;
|
|
923
|
+
get title(): string;
|
|
924
|
+
get description(): string;
|
|
925
|
+
get default(): boolean | null;
|
|
926
|
+
readonly isArray = false;
|
|
927
|
+
readonly isSingle = true;
|
|
928
|
+
readonly isBoolean = true;
|
|
929
|
+
toJson(): DocFileIndexSchemaField;
|
|
930
|
+
/**
|
|
931
|
+
* Validate value type
|
|
932
|
+
*/
|
|
933
|
+
validate(value: unknown): boolean;
|
|
934
|
+
static empty(key: RecordKey): DocSchemaFieldBooleanValue<RecordKey>;
|
|
935
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldBooleanValue<RecordKey>;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
/**
|
|
939
|
+
* Multiple relation type schema field
|
|
940
|
+
*/
|
|
941
|
+
declare class DocSchemaFieldMultiRelationValue<T extends RecordKey> {
|
|
942
|
+
readonly key: T;
|
|
943
|
+
readonly value: DocSchemaFieldMultiRelation;
|
|
944
|
+
constructor(key: T, value: DocSchemaFieldMultiRelation);
|
|
945
|
+
get type(): "multi-relation";
|
|
946
|
+
get required(): boolean;
|
|
947
|
+
get title(): string;
|
|
948
|
+
get description(): string;
|
|
949
|
+
get default(): string[] | null;
|
|
950
|
+
get path(): string;
|
|
951
|
+
readonly isArray = true;
|
|
952
|
+
readonly isSingle = false;
|
|
953
|
+
readonly isRelation = true;
|
|
954
|
+
/**
|
|
955
|
+
* Validate value
|
|
956
|
+
*/
|
|
957
|
+
validate(value: unknown): boolean;
|
|
958
|
+
toJson(): DocFileIndexSchemaField;
|
|
959
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiRelationValue<T>;
|
|
960
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiRelationValue<RecordKey>;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* Multiple select number type schema field
|
|
965
|
+
*/
|
|
966
|
+
declare class DocSchemaFieldMultiSelectNumberValue<T extends RecordKey> {
|
|
967
|
+
readonly key: T;
|
|
968
|
+
readonly value: DocSchemaFieldMultiSelectNumber;
|
|
969
|
+
constructor(key: T, value: DocSchemaFieldMultiSelectNumber);
|
|
970
|
+
get type(): "multi-select-number";
|
|
971
|
+
get required(): boolean;
|
|
972
|
+
get title(): string;
|
|
973
|
+
get description(): string;
|
|
974
|
+
get default(): number[] | null;
|
|
975
|
+
get options(): number[];
|
|
976
|
+
readonly isArray = true;
|
|
977
|
+
readonly isSingle = false;
|
|
978
|
+
readonly isSelect = true;
|
|
979
|
+
readonly isNumberSelect = true;
|
|
980
|
+
/**
|
|
981
|
+
* Validate value
|
|
982
|
+
*/
|
|
983
|
+
validate(value: unknown): boolean;
|
|
984
|
+
toJson(): DocFileIndexSchemaField;
|
|
985
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiSelectNumberValue<T>;
|
|
986
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiSelectNumberValue<RecordKey>;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* Multiple select text type schema field
|
|
991
|
+
*/
|
|
992
|
+
declare class DocSchemaFieldMultiSelectTextValue<T extends RecordKey> {
|
|
993
|
+
readonly key: T;
|
|
994
|
+
readonly value: DocSchemaFieldMultiSelectText;
|
|
995
|
+
constructor(key: T, value: DocSchemaFieldMultiSelectText);
|
|
996
|
+
get type(): "multi-select-text";
|
|
997
|
+
get required(): boolean;
|
|
998
|
+
get title(): string;
|
|
999
|
+
get description(): string;
|
|
1000
|
+
get default(): string[] | null;
|
|
1001
|
+
get options(): string[];
|
|
1002
|
+
readonly isArray = true;
|
|
1003
|
+
readonly isSingle = false;
|
|
1004
|
+
readonly isSelect = true;
|
|
1005
|
+
readonly isTextSelect = true;
|
|
1006
|
+
/**
|
|
1007
|
+
* Validate value
|
|
1008
|
+
*/
|
|
1009
|
+
validate(value: unknown): boolean;
|
|
1010
|
+
toJson(): DocFileIndexSchemaField;
|
|
1011
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiSelectTextValue<T>;
|
|
1012
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiSelectTextValue<RecordKey>;
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* Multiple text type schema field
|
|
1017
|
+
*/
|
|
1018
|
+
declare class DocSchemaFieldMultiTextValue<T extends RecordKey> {
|
|
1019
|
+
readonly key: T;
|
|
1020
|
+
readonly value: DocSchemaFieldMultiText;
|
|
1021
|
+
constructor(key: T, value: DocSchemaFieldMultiText);
|
|
1022
|
+
get type(): "multi-text";
|
|
1023
|
+
get required(): boolean;
|
|
1024
|
+
get title(): string;
|
|
1025
|
+
get description(): string;
|
|
1026
|
+
get default(): string[] | null;
|
|
1027
|
+
readonly isArray = true;
|
|
1028
|
+
readonly isSingle = false;
|
|
1029
|
+
readonly isText = true;
|
|
1030
|
+
toJson(): DocFileIndexSchemaField;
|
|
1031
|
+
/**
|
|
1032
|
+
* Validate value type
|
|
1033
|
+
*/
|
|
1034
|
+
validate(value: unknown): boolean;
|
|
1035
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiTextValue<T>;
|
|
1036
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiTextValue<RecordKey>;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
/**
|
|
1040
|
+
* Single number type schema field
|
|
1041
|
+
*/
|
|
1042
|
+
declare class DocSchemaFieldNumberValue<T extends RecordKey> {
|
|
1043
|
+
readonly key: T;
|
|
1044
|
+
readonly value: DocSchemaFieldNumber;
|
|
1045
|
+
constructor(key: T, value: DocSchemaFieldNumber);
|
|
1046
|
+
get type(): "number";
|
|
1047
|
+
get required(): boolean;
|
|
1048
|
+
get title(): string;
|
|
1049
|
+
get description(): string;
|
|
1050
|
+
get default(): number | null;
|
|
1051
|
+
readonly isArray = false;
|
|
1052
|
+
readonly isSingle = true;
|
|
1053
|
+
readonly isNumber = true;
|
|
1054
|
+
toJson(): DocFileIndexSchemaField;
|
|
1055
|
+
/**
|
|
1056
|
+
* Validate value type
|
|
1057
|
+
*/
|
|
1058
|
+
validate(value: unknown): boolean;
|
|
1059
|
+
static empty(key: RecordKey): DocSchemaFieldNumberValue<RecordKey>;
|
|
1060
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldNumberValue<RecordKey>;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
/**
|
|
1064
|
+
* Single relation type schema field
|
|
1065
|
+
*/
|
|
1066
|
+
declare class DocSchemaFieldRelationValue<T extends RecordKey> {
|
|
1067
|
+
readonly key: T;
|
|
1068
|
+
readonly value: DocSchemaFieldRelation;
|
|
1069
|
+
constructor(key: T, value: DocSchemaFieldRelation);
|
|
1070
|
+
get type(): "relation";
|
|
1071
|
+
get required(): boolean;
|
|
1072
|
+
get title(): string;
|
|
1073
|
+
get description(): string;
|
|
1074
|
+
get default(): string | null;
|
|
1075
|
+
get path(): string;
|
|
1076
|
+
readonly isArray = false;
|
|
1077
|
+
readonly isSingle = true;
|
|
1078
|
+
readonly isRelation = true;
|
|
1079
|
+
toJson(): DocFileIndexSchemaField;
|
|
1080
|
+
/**
|
|
1081
|
+
* Validate value type
|
|
1082
|
+
*/
|
|
1083
|
+
validate(value: unknown): boolean;
|
|
1084
|
+
static empty(key: RecordKey): DocSchemaFieldRelationValue<RecordKey>;
|
|
1085
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldRelationValue<RecordKey>;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
/**
|
|
1089
|
+
* Single select number type schema field
|
|
1090
|
+
*/
|
|
1091
|
+
declare class DocSchemaFieldSelectNumberValue<T extends RecordKey> {
|
|
1092
|
+
readonly key: T;
|
|
1093
|
+
readonly value: DocSchemaFieldSelectNumber;
|
|
1094
|
+
constructor(key: T, value: DocSchemaFieldSelectNumber);
|
|
1095
|
+
get type(): "select-number";
|
|
1096
|
+
get required(): boolean;
|
|
1097
|
+
get title(): string;
|
|
1098
|
+
get description(): string;
|
|
1099
|
+
get default(): number | null;
|
|
1100
|
+
get options(): number[];
|
|
1101
|
+
readonly isArray = false;
|
|
1102
|
+
readonly isSingle = true;
|
|
1103
|
+
readonly isSelect = true;
|
|
1104
|
+
readonly isNumberSelect = true;
|
|
1105
|
+
/**
|
|
1106
|
+
* Validate value
|
|
1117
1107
|
*/
|
|
1118
|
-
|
|
1108
|
+
validate(value: unknown): boolean;
|
|
1109
|
+
toJson(): DocFileIndexSchemaField;
|
|
1110
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldSelectNumberValue<T>;
|
|
1111
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldSelectNumberValue<RecordKey>;
|
|
1119
1112
|
}
|
|
1120
1113
|
|
|
1121
1114
|
/**
|
|
1122
|
-
*
|
|
1115
|
+
* Single select text type schema field
|
|
1123
1116
|
*/
|
|
1124
|
-
declare class
|
|
1125
|
-
readonly
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
get
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
/**
|
|
1140
|
-
* Whether it's empty
|
|
1141
|
-
*/
|
|
1142
|
-
get isEmpty(): boolean;
|
|
1143
|
-
/**
|
|
1144
|
-
* Create empty relation entity
|
|
1145
|
-
*/
|
|
1146
|
-
static empty(path: string): DocRelationValue;
|
|
1117
|
+
declare class DocSchemaFieldSelectTextValue<T extends RecordKey> {
|
|
1118
|
+
readonly key: T;
|
|
1119
|
+
readonly value: DocSchemaFieldSelectText;
|
|
1120
|
+
constructor(key: T, value: DocSchemaFieldSelectText);
|
|
1121
|
+
get type(): "select-text";
|
|
1122
|
+
get required(): boolean;
|
|
1123
|
+
get title(): string;
|
|
1124
|
+
get description(): string;
|
|
1125
|
+
get default(): string | null;
|
|
1126
|
+
get options(): string[];
|
|
1127
|
+
readonly isArray = false;
|
|
1128
|
+
readonly isSingle = true;
|
|
1129
|
+
readonly isSelect = true;
|
|
1130
|
+
readonly isTextSelect = true;
|
|
1131
|
+
toJson(): DocFileIndexSchemaField;
|
|
1147
1132
|
/**
|
|
1148
|
-
*
|
|
1133
|
+
* Validate value type
|
|
1149
1134
|
*/
|
|
1150
|
-
|
|
1135
|
+
validate(value: unknown): boolean;
|
|
1136
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldSelectTextValue<T>;
|
|
1137
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldSelectTextValue<RecordKey>;
|
|
1151
1138
|
}
|
|
1152
1139
|
|
|
1153
|
-
type Props$6 = {
|
|
1154
|
-
filePath: string;
|
|
1155
|
-
fileSystem: DocFileSystem;
|
|
1156
|
-
pathSystem: DocPathSystem;
|
|
1157
|
-
};
|
|
1158
1140
|
/**
|
|
1159
|
-
*
|
|
1141
|
+
* Single text type schema field
|
|
1160
1142
|
*/
|
|
1161
|
-
declare class
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
constructor(
|
|
1165
|
-
get
|
|
1166
|
-
get
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
get fullPath(): string;
|
|
1175
|
-
read(): Promise<DocRelationValue | Error | null>;
|
|
1176
|
-
/**
|
|
1177
|
-
* Read list of relation files
|
|
1178
|
-
*/
|
|
1179
|
-
readFiles(): Promise<DocRelationFileValue[] | Error>;
|
|
1180
|
-
/**
|
|
1181
|
-
* Read single relation file
|
|
1182
|
-
*/
|
|
1183
|
-
readFile(filePath: string): Promise<DocRelationFileValue | Error | null>;
|
|
1184
|
-
/**
|
|
1185
|
-
* Check if file exists
|
|
1186
|
-
*/
|
|
1187
|
-
exists(slug: string): Promise<boolean>;
|
|
1188
|
-
/**
|
|
1189
|
-
* Get list of file names (without extension)
|
|
1190
|
-
*/
|
|
1191
|
-
readSlugs(): Promise<string[] | Error>;
|
|
1143
|
+
declare class DocSchemaFieldTextValue<T extends RecordKey> {
|
|
1144
|
+
readonly key: T;
|
|
1145
|
+
readonly value: DocSchemaFieldText;
|
|
1146
|
+
constructor(key: T, value: DocSchemaFieldText);
|
|
1147
|
+
get type(): "text";
|
|
1148
|
+
get required(): boolean;
|
|
1149
|
+
get title(): string;
|
|
1150
|
+
get description(): string;
|
|
1151
|
+
get default(): string | null;
|
|
1152
|
+
readonly isArray = false;
|
|
1153
|
+
readonly isSingle = true;
|
|
1154
|
+
readonly isText = true;
|
|
1155
|
+
toJson(): DocFileIndexSchemaField;
|
|
1192
1156
|
/**
|
|
1193
|
-
*
|
|
1157
|
+
* Validate value type
|
|
1194
1158
|
*/
|
|
1195
|
-
|
|
1159
|
+
validate(value: unknown): boolean;
|
|
1160
|
+
static empty(key: RecordKey): DocSchemaFieldTextValue<RecordKey>;
|
|
1161
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldTextValue<RecordKey>;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* Multiple number type schema field
|
|
1166
|
+
*/
|
|
1167
|
+
declare class DocSchemaFieldMultiNumberValue<T extends RecordKey> {
|
|
1168
|
+
readonly key: T;
|
|
1169
|
+
readonly value: DocSchemaFieldMultiNumber;
|
|
1170
|
+
constructor(key: T, value: DocSchemaFieldMultiNumber);
|
|
1171
|
+
get type(): "multi-number";
|
|
1172
|
+
get required(): boolean;
|
|
1173
|
+
get title(): string;
|
|
1174
|
+
get description(): string;
|
|
1175
|
+
get default(): number[] | null;
|
|
1176
|
+
readonly isArray = true;
|
|
1177
|
+
readonly isSingle = false;
|
|
1178
|
+
readonly isNumber = true;
|
|
1196
1179
|
/**
|
|
1197
|
-
*
|
|
1180
|
+
* Validate value
|
|
1198
1181
|
*/
|
|
1199
|
-
|
|
1182
|
+
validate(value: unknown): boolean;
|
|
1183
|
+
toJson(): DocFileIndexSchemaField;
|
|
1184
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiNumberValue<T>;
|
|
1185
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiNumberValue<RecordKey>;
|
|
1200
1186
|
}
|
|
1201
1187
|
|
|
1202
1188
|
/**
|
|
@@ -1218,12 +1204,6 @@ declare class DocFileIndexSchemaValue<T extends DocCustomSchema> {
|
|
|
1218
1204
|
field<K extends keyof T>(key: K): T[K]["type"] extends infer Type ? Type extends "text" ? DocSchemaFieldTextValue<K> : Type extends "number" ? DocSchemaFieldNumberValue<K> : Type extends "boolean" ? DocSchemaFieldBooleanValue<K> : Type extends "relation" ? DocSchemaFieldRelationValue<K> : Type extends "select-text" ? DocSchemaFieldSelectTextValue<K> : Type extends "select-number" ? DocSchemaFieldSelectNumberValue<K> : Type extends "multi-text" ? DocSchemaFieldMultiTextValue<K> : Type extends "multi-number" ? DocSchemaFieldMultiNumberValue<K> : Type extends "multi-relation" ? DocSchemaFieldMultiRelationValue<K> : Type extends "multi-select-text" ? DocSchemaFieldMultiSelectTextValue<K> : Type extends "multi-select-number" ? DocSchemaFieldMultiSelectNumberValue<K> : never : never;
|
|
1219
1205
|
relation<K extends keyof T>(key: K): DocSchemaFieldRelationValue<K>;
|
|
1220
1206
|
multiRelation<K extends keyof T>(key: K): DocSchemaFieldMultiRelationValue<K>;
|
|
1221
|
-
/**
|
|
1222
|
-
* Get all fields
|
|
1223
|
-
* Note: For type safety, it's recommended to use field() method individually
|
|
1224
|
-
*/
|
|
1225
|
-
get fields(): DocFileIndexSchema<keyof T>[keyof T][];
|
|
1226
|
-
get relationFields(): (DocSchemaFieldRelationValue<string> | DocSchemaFieldMultiRelationValue<string>)[];
|
|
1227
1207
|
toJson(): DocFileIndexSchema<keyof T>;
|
|
1228
1208
|
/**
|
|
1229
1209
|
* Create empty schema entity
|
|
@@ -1239,9 +1219,6 @@ declare class DocFileIndexMetaValue<T extends DocCustomSchema> {
|
|
|
1239
1219
|
readonly value: DocFileIndexMeta<T>;
|
|
1240
1220
|
readonly customSchema: T;
|
|
1241
1221
|
private readonly config;
|
|
1242
|
-
/**
|
|
1243
|
-
* Additional properties to include in the meta data
|
|
1244
|
-
*/
|
|
1245
1222
|
private readonly additionalProperties;
|
|
1246
1223
|
constructor(value: DocFileIndexMeta<T>, customSchema: T, config: DocClientConfig, additionalProperties?: Record<string, unknown>);
|
|
1247
1224
|
/**
|
|
@@ -1417,6 +1394,7 @@ declare class DocFileIndexReference<T extends DocCustomSchema> {
|
|
|
1417
1394
|
get fileFullPath(): string;
|
|
1418
1395
|
get durectoryPath(): string;
|
|
1419
1396
|
read(): Promise<DocFileIndexEntity<T> | Error>;
|
|
1397
|
+
readSchemaValue(): Promise<DocFileIndexSchema<RecordKey>>;
|
|
1420
1398
|
/**
|
|
1421
1399
|
* Read file content
|
|
1422
1400
|
*/
|
|
@@ -1492,23 +1470,23 @@ declare class DocDirectoryReference<T extends DocCustomSchema> {
|
|
|
1492
1470
|
get archiveDirectoryName(): string;
|
|
1493
1471
|
fileNames(): Promise<string[] | Error>;
|
|
1494
1472
|
archivedFileNames(): Promise<string[] | Error>;
|
|
1495
|
-
filesGenerator(): AsyncGenerator<DocFileMdReference<T> | DocFileUnknownReference
|
|
1473
|
+
filesGenerator(): AsyncGenerator<DocFileMdReference<T> | DocFileUnknownReference, void, unknown>;
|
|
1496
1474
|
mdFilesGenerator(): AsyncGenerator<DocFileMdReference<T> | Error, void, unknown>;
|
|
1497
|
-
files(): Promise<(DocFileMdReference<T> | DocFileUnknownReference)[]
|
|
1498
|
-
mdFiles(): Promise<DocFileMdReference<T>[]
|
|
1475
|
+
files(): Promise<(DocFileMdReference<T> | DocFileUnknownReference)[]>;
|
|
1476
|
+
mdFiles(): Promise<DocFileMdReference<T>[]>;
|
|
1499
1477
|
file<FileName extends string>(fileName: FileName): InferReference<FileName, T>;
|
|
1500
1478
|
mdFile(fileName: string): DocFileMdReference<T>;
|
|
1501
|
-
readFiles(): Promise<(DocFileMdEntity<T> | DocFileUnknownEntity)[]
|
|
1502
|
-
readMdFiles(): Promise<DocFileMdEntity<T>[]
|
|
1503
|
-
readUnknownFiles(): Promise<DocFileUnknownEntity[]
|
|
1479
|
+
readFiles(): Promise<(DocFileMdEntity<T> | DocFileUnknownEntity)[]>;
|
|
1480
|
+
readMdFiles(): Promise<DocFileMdEntity<T>[]>;
|
|
1481
|
+
readUnknownFiles(): Promise<DocFileUnknownEntity[]>;
|
|
1504
1482
|
/**
|
|
1505
1483
|
* Get list of subdirectory names
|
|
1506
1484
|
*/
|
|
1507
|
-
directoryNames(): Promise<string[]
|
|
1485
|
+
directoryNames(): Promise<string[]>;
|
|
1508
1486
|
/**
|
|
1509
1487
|
* Get subdirectory references
|
|
1510
1488
|
*/
|
|
1511
|
-
directories(): Promise<DocDirectoryReference<T>[]
|
|
1489
|
+
directories(): Promise<DocDirectoryReference<T>[]>;
|
|
1512
1490
|
/**
|
|
1513
1491
|
* Get single subdirectory reference
|
|
1514
1492
|
*/
|
|
@@ -1518,16 +1496,18 @@ declare class DocDirectoryReference<T extends DocCustomSchema> {
|
|
|
1518
1496
|
readIndexFile(): Promise<DocFileIndexEntity<T> | Error>;
|
|
1519
1497
|
writeFile(entity: DocFileIndexEntity<T> | DocFileMdEntity<T> | DocFileUnknownEntity): Promise<Error | null>;
|
|
1520
1498
|
exists(): Promise<boolean>;
|
|
1521
|
-
/**
|
|
1522
|
-
* Generate unique filename
|
|
1523
|
-
*/
|
|
1524
|
-
private uniqueFileName;
|
|
1525
1499
|
/**
|
|
1526
1500
|
* Create new Markdown file
|
|
1527
1501
|
*/
|
|
1528
1502
|
createMdFile(fileName?: string): Promise<DocFileMdReference<T>>;
|
|
1503
|
+
/**
|
|
1504
|
+
* Generate unique filename
|
|
1505
|
+
*/
|
|
1506
|
+
private uniqueFileName;
|
|
1529
1507
|
}
|
|
1530
1508
|
|
|
1509
|
+
declare const DOC_NODE_TYPE_DIRECTORY: "directory";
|
|
1510
|
+
|
|
1531
1511
|
type Props$3 = {
|
|
1532
1512
|
name: string;
|
|
1533
1513
|
path: string;
|
|
@@ -1579,7 +1559,7 @@ declare class DocTreeDirectoryNodeValue {
|
|
|
1579
1559
|
get icon(): string;
|
|
1580
1560
|
get title(): string;
|
|
1581
1561
|
get children(): DocTreeNodeValue[];
|
|
1582
|
-
get type():
|
|
1562
|
+
get type(): typeof DOC_NODE_TYPE_DIRECTORY;
|
|
1583
1563
|
/**
|
|
1584
1564
|
* Convert to plain object
|
|
1585
1565
|
*/
|
|
@@ -1970,4 +1950,197 @@ declare const docCustomSchemaField: {
|
|
|
1970
1950
|
};
|
|
1971
1951
|
};
|
|
1972
1952
|
|
|
1973
|
-
|
|
1953
|
+
declare class DocCustomSchemaFieldValue<T extends DocCustomSchemaField> {
|
|
1954
|
+
readonly value: T;
|
|
1955
|
+
constructor(value: T);
|
|
1956
|
+
validate(value: unknown): string | number | boolean | string[] | number[] | null;
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
/**
|
|
1960
|
+
* Value object for file path information
|
|
1961
|
+
*/
|
|
1962
|
+
declare class DocFilePathValue {
|
|
1963
|
+
readonly value: DocFilePath;
|
|
1964
|
+
private readonly pathSystem;
|
|
1965
|
+
constructor(value: DocFilePath, pathSystem: DocPathSystem);
|
|
1966
|
+
/**
|
|
1967
|
+
* File name without extension
|
|
1968
|
+
*/
|
|
1969
|
+
get name(): string;
|
|
1970
|
+
/**
|
|
1971
|
+
* File path (relative path)
|
|
1972
|
+
*/
|
|
1973
|
+
get path(): string;
|
|
1974
|
+
/**
|
|
1975
|
+
* File name with extension
|
|
1976
|
+
*/
|
|
1977
|
+
get nameWithExtension(): string;
|
|
1978
|
+
/**
|
|
1979
|
+
* Full path (absolute path)
|
|
1980
|
+
*/
|
|
1981
|
+
get fullPath(): string;
|
|
1982
|
+
/**
|
|
1983
|
+
* Directory path
|
|
1984
|
+
*/
|
|
1985
|
+
get directoryPath(): string;
|
|
1986
|
+
/**
|
|
1987
|
+
* Extension
|
|
1988
|
+
*/
|
|
1989
|
+
get extension(): string;
|
|
1990
|
+
/**
|
|
1991
|
+
* Whether the file is archived
|
|
1992
|
+
*/
|
|
1993
|
+
get isArchived(): boolean;
|
|
1994
|
+
/**
|
|
1995
|
+
* Export as JSON format
|
|
1996
|
+
*/
|
|
1997
|
+
toJson(): DocFilePath;
|
|
1998
|
+
/**
|
|
1999
|
+
* Create instance from relative path (DI support)
|
|
2000
|
+
*/
|
|
2001
|
+
static fromPathWithSystem(filePath: string, pathSystem: DocPathSystem, basePath?: string): DocFilePathValue;
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
type Value = {
|
|
2005
|
+
path: string;
|
|
2006
|
+
name: string;
|
|
2007
|
+
fullPath: string;
|
|
2008
|
+
};
|
|
2009
|
+
/**
|
|
2010
|
+
* Value object representing a directory path
|
|
2011
|
+
*/
|
|
2012
|
+
declare class DocDirectoryPathValue {
|
|
2013
|
+
private readonly value;
|
|
2014
|
+
private readonly pathSystem;
|
|
2015
|
+
constructor(value: Value, pathSystem: DocPathSystem);
|
|
2016
|
+
/**
|
|
2017
|
+
* Relative directory path
|
|
2018
|
+
*/
|
|
2019
|
+
get path(): string;
|
|
2020
|
+
/**
|
|
2021
|
+
* Directory name
|
|
2022
|
+
*/
|
|
2023
|
+
get name(): string;
|
|
2024
|
+
/**
|
|
2025
|
+
* Get parent directory path
|
|
2026
|
+
*/
|
|
2027
|
+
get parent(): DocDirectoryPathValue | null;
|
|
2028
|
+
/**
|
|
2029
|
+
* Parent directory path
|
|
2030
|
+
*/
|
|
2031
|
+
get parentPath(): string;
|
|
2032
|
+
/**
|
|
2033
|
+
* Depth (number of directory levels)
|
|
2034
|
+
*/
|
|
2035
|
+
get depth(): number;
|
|
2036
|
+
/**
|
|
2037
|
+
* Path segments (array of directories)
|
|
2038
|
+
*/
|
|
2039
|
+
get segments(): string[];
|
|
2040
|
+
/**
|
|
2041
|
+
* Relative path from root (without leading slash)
|
|
2042
|
+
*/
|
|
2043
|
+
get normalizedPath(): string;
|
|
2044
|
+
/**
|
|
2045
|
+
* Whether this is an archive directory (directory name is "_")
|
|
2046
|
+
*/
|
|
2047
|
+
get isArchived(): boolean;
|
|
2048
|
+
/**
|
|
2049
|
+
* Whether this is a hidden directory
|
|
2050
|
+
*/
|
|
2051
|
+
get isHidden(): boolean;
|
|
2052
|
+
/**
|
|
2053
|
+
* Whether this is the root directory
|
|
2054
|
+
*/
|
|
2055
|
+
get isRoot(): boolean;
|
|
2056
|
+
/**
|
|
2057
|
+
* Absolute path
|
|
2058
|
+
*/
|
|
2059
|
+
get fullPath(): string;
|
|
2060
|
+
/**
|
|
2061
|
+
* Get index file path
|
|
2062
|
+
*/
|
|
2063
|
+
get indexFile(): DocFilePathValue;
|
|
2064
|
+
/**
|
|
2065
|
+
* Create file path
|
|
2066
|
+
*/
|
|
2067
|
+
file(fileName: string): DocFilePathValue;
|
|
2068
|
+
/**
|
|
2069
|
+
* Create subdirectory path
|
|
2070
|
+
*/
|
|
2071
|
+
subdirectory(dirName: string): DocDirectoryPathValue;
|
|
2072
|
+
/**
|
|
2073
|
+
* Create instance from relative path (DI support)
|
|
2074
|
+
*/
|
|
2075
|
+
static fromPathWithSystem(dirPath: string, basePath: string, pathSystem: DocPathSystem): DocDirectoryPathValue;
|
|
2076
|
+
/**
|
|
2077
|
+
* Export as JSON format
|
|
2078
|
+
*/
|
|
2079
|
+
toJson(): Value;
|
|
2080
|
+
/**
|
|
2081
|
+
* Check if paths are equal
|
|
2082
|
+
*/
|
|
2083
|
+
equals(other: DocDirectoryPathValue): boolean;
|
|
2084
|
+
/**
|
|
2085
|
+
* Check if specified directory is a descendant of this directory
|
|
2086
|
+
*/
|
|
2087
|
+
contains(other: DocDirectoryPathValue): boolean;
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
/**
|
|
2091
|
+
* Relation field
|
|
2092
|
+
*/
|
|
2093
|
+
declare class DocRelationFieldValue {
|
|
2094
|
+
private readonly value;
|
|
2095
|
+
constructor(value: DocRelationField);
|
|
2096
|
+
/**
|
|
2097
|
+
* Get field name
|
|
2098
|
+
*/
|
|
2099
|
+
get fieldName(): string;
|
|
2100
|
+
/**
|
|
2101
|
+
* Get relation target path
|
|
2102
|
+
*/
|
|
2103
|
+
get relationPath(): string;
|
|
2104
|
+
/**
|
|
2105
|
+
* Get whether it's an array type
|
|
2106
|
+
*/
|
|
2107
|
+
get isArray(): boolean;
|
|
2108
|
+
/**
|
|
2109
|
+
* Check if it's a single relation
|
|
2110
|
+
*/
|
|
2111
|
+
get isSingle(): boolean;
|
|
2112
|
+
/**
|
|
2113
|
+
* Check if it's a multiple relation
|
|
2114
|
+
*/
|
|
2115
|
+
get isMultiple(): boolean;
|
|
2116
|
+
/**
|
|
2117
|
+
* Get target directory name
|
|
2118
|
+
*/
|
|
2119
|
+
get targetDirectoryName(): string;
|
|
2120
|
+
/**
|
|
2121
|
+
* Generate full relation path
|
|
2122
|
+
*/
|
|
2123
|
+
fullPath(basePath: string): string;
|
|
2124
|
+
/**
|
|
2125
|
+
* Check equality
|
|
2126
|
+
*/
|
|
2127
|
+
equals(other: DocRelationFieldValue): boolean;
|
|
2128
|
+
/**
|
|
2129
|
+
* Convert to JSON format
|
|
2130
|
+
*/
|
|
2131
|
+
toJson(): DocRelationField;
|
|
2132
|
+
/**
|
|
2133
|
+
* Create from data
|
|
2134
|
+
*/
|
|
2135
|
+
static from(data: unknown): DocRelationFieldValue;
|
|
2136
|
+
/**
|
|
2137
|
+
* Create from properties
|
|
2138
|
+
*/
|
|
2139
|
+
static fromProps(props: {
|
|
2140
|
+
fieldName: string;
|
|
2141
|
+
filePath: string;
|
|
2142
|
+
isArray: boolean;
|
|
2143
|
+
}): DocRelationFieldValue;
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
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, DocDirectoryPathValue, DocDirectoryReference, type DocFieldTypeLiteral, type DocFile, type DocFileEntity, type DocFileIndex, type DocFileIndexContent, DocFileIndexContentValue, DocFileIndexEntity, type DocFileIndexMeta, DocFileIndexMetaValue, DocFileIndexReference, type DocFileIndexSchema, type DocFileIndexSchemaField, DocFileIndexSchemaValue, type DocFileMd, type DocFileMdContent, DocFileMdContentValue, DocFileMdEntity, type DocFileMdMeta, DocFileMdMetaValue, DocFileMdReference, type DocFilePath, DocFilePathValue, DocFileRelationReference, DocFileSystem, DocFileSystemMock, DocFileTreeSystem, type DocFileUnknown, DocFileUnknownEntity, DocFileUnknownReference, DocMarkdownSystem, type DocMetaField, type DocMetaFieldBoolean, type DocMetaFieldMultiBoolean, 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, DocSchemaBuilder, 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, assertType, defaultTestConfig, defineSchema, docCustomSchemaField, expectType, zDocClientConfig, zDocFileIndexSchemaField, zDocFilePath, zDocFileUnknown, zDocMetaField, zDocMetaFieldBoolean, zDocMetaFieldMultiBoolean, zDocMetaFieldMultiNumber, zDocMetaFieldMultiRelation, zDocMetaFieldMultiSelectNumber, zDocMetaFieldMultiSelectText, zDocMetaFieldMultiText, zDocMetaFieldNumber, zDocMetaFieldRelation, zDocMetaFieldSelectNumber, zDocMetaFieldSelectText, zDocMetaFieldText, zDocMetaFieldType, zDocMetaFieldTypeBoolean, zDocMetaFieldTypeNumber, zDocMetaFieldTypeRelation, zDocMetaFieldTypeSelectNumber, zDocMetaFieldTypeSelectText, zDocMetaFieldTypeText, zDocRelation, zDocRelationField, zDocRelationFile, zDocSchemaFieldBoolean, zDocSchemaFieldMultiNumber, zDocSchemaFieldMultiRelation, zDocSchemaFieldMultiSelectNumber, zDocSchemaFieldMultiSelectText, zDocSchemaFieldMultiText, zDocSchemaFieldNumber, zDocSchemaFieldRelation, zDocSchemaFieldSelectNumber, zDocSchemaFieldSelectText, zDocSchemaFieldText };
|