@interactive-inc/docs-client 1.0.5 → 1.0.9
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 +585 -400
- package/build/index.js +622 -182
- 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
|
/**
|
|
@@ -304,6 +299,10 @@ declare class DocFileMdReference<T extends DocCustomSchema> {
|
|
|
304
299
|
* Read file content
|
|
305
300
|
*/
|
|
306
301
|
readText(): Promise<Error | string>;
|
|
302
|
+
/**
|
|
303
|
+
* Create empty DocFileMdEntity
|
|
304
|
+
*/
|
|
305
|
+
empty(): DocFileMdEntity<T>;
|
|
307
306
|
/**
|
|
308
307
|
* Write entity
|
|
309
308
|
*/
|
|
@@ -419,6 +418,10 @@ declare class DocFileUnknownReference {
|
|
|
419
418
|
* Read file content
|
|
420
419
|
*/
|
|
421
420
|
readContent(): Promise<Error | string>;
|
|
421
|
+
/**
|
|
422
|
+
* Create empty DocFileUnknownEntity
|
|
423
|
+
*/
|
|
424
|
+
empty(): DocFileUnknownEntity;
|
|
422
425
|
/**
|
|
423
426
|
* Write content to file
|
|
424
427
|
*/
|
|
@@ -470,319 +473,45 @@ declare class DocFileUnknownReference {
|
|
|
470
473
|
}
|
|
471
474
|
|
|
472
475
|
/**
|
|
473
|
-
*
|
|
476
|
+
* Text field type
|
|
474
477
|
*/
|
|
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
|
-
|
|
478
|
+
type DocSchemaFieldText = z.infer<typeof zDocSchemaFieldText>;
|
|
496
479
|
/**
|
|
497
|
-
*
|
|
480
|
+
* Number field type
|
|
498
481
|
*/
|
|
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
|
-
|
|
482
|
+
type DocSchemaFieldNumber = z.infer<typeof zDocSchemaFieldNumber>;
|
|
520
483
|
/**
|
|
521
|
-
*
|
|
484
|
+
* Boolean field type
|
|
522
485
|
*/
|
|
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
|
-
|
|
486
|
+
type DocSchemaFieldBoolean = z.infer<typeof zDocSchemaFieldBoolean>;
|
|
545
487
|
/**
|
|
546
|
-
*
|
|
488
|
+
* Multi-text field type
|
|
547
489
|
*/
|
|
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
|
-
|
|
490
|
+
type DocSchemaFieldMultiText = z.infer<typeof zDocSchemaFieldMultiText>;
|
|
571
491
|
/**
|
|
572
|
-
*
|
|
492
|
+
* Multi-number field type
|
|
573
493
|
*/
|
|
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
|
-
|
|
494
|
+
type DocSchemaFieldMultiNumber = z.infer<typeof zDocSchemaFieldMultiNumber>;
|
|
597
495
|
/**
|
|
598
|
-
*
|
|
496
|
+
* Relation field type
|
|
599
497
|
*/
|
|
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
|
-
|
|
498
|
+
type DocSchemaFieldRelation = z.infer<typeof zDocSchemaFieldRelation>;
|
|
621
499
|
/**
|
|
622
|
-
*
|
|
500
|
+
* Multi-relation field type
|
|
623
501
|
*/
|
|
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
|
-
|
|
502
|
+
type DocSchemaFieldMultiRelation = z.infer<typeof zDocSchemaFieldMultiRelation>;
|
|
645
503
|
/**
|
|
646
|
-
*
|
|
504
|
+
* Select text field type
|
|
647
505
|
*/
|
|
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
|
-
|
|
506
|
+
type DocSchemaFieldSelectText = z.infer<typeof zDocSchemaFieldSelectText>;
|
|
670
507
|
/**
|
|
671
|
-
*
|
|
508
|
+
* Select number field type
|
|
672
509
|
*/
|
|
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
|
-
|
|
510
|
+
type DocSchemaFieldSelectNumber = z.infer<typeof zDocSchemaFieldSelectNumber>;
|
|
696
511
|
/**
|
|
697
|
-
*
|
|
512
|
+
* Multi-select text field type
|
|
698
513
|
*/
|
|
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
|
-
|
|
722
|
-
/**
|
|
723
|
-
* Single text type schema field
|
|
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>;
|
|
514
|
+
type DocSchemaFieldMultiSelectText = z.infer<typeof zDocSchemaFieldMultiSelectText>;
|
|
786
515
|
/**
|
|
787
516
|
* Multi-select number field type
|
|
788
517
|
*/
|
|
@@ -1027,7 +756,7 @@ type DocDirectory<T extends DocCustomSchema> = {
|
|
|
1027
756
|
files: DocFile<T>[];
|
|
1028
757
|
relations: DocRelation[];
|
|
1029
758
|
};
|
|
1030
|
-
type RecordKey =
|
|
759
|
+
type RecordKey = PropertyKey;
|
|
1031
760
|
/**
|
|
1032
761
|
* DocClient configuration
|
|
1033
762
|
*/
|
|
@@ -1071,16 +800,7 @@ type SchemaToValueType<T extends DocCustomSchema> = {
|
|
|
1071
800
|
* Helper type for type-safe property access
|
|
1072
801
|
*/
|
|
1073
802
|
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
803
|
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
804
|
/**
|
|
1085
805
|
* Infers DocFileMd type from the result of defineSchema
|
|
1086
806
|
*/
|
|
@@ -1105,98 +825,372 @@ declare class DocRelationFileValue {
|
|
|
1105
825
|
*/
|
|
1106
826
|
get label(): string;
|
|
1107
827
|
/**
|
|
1108
|
-
*
|
|
828
|
+
* Convert to JSON format
|
|
1109
829
|
*/
|
|
1110
|
-
|
|
830
|
+
toJson(): DocRelationFile;
|
|
1111
831
|
/**
|
|
1112
832
|
* Extract file name from file path (without extension)
|
|
1113
833
|
*/
|
|
1114
834
|
private static extractFileName;
|
|
1115
835
|
/**
|
|
1116
|
-
*
|
|
836
|
+
* Create from file path and title
|
|
837
|
+
*/
|
|
838
|
+
static from(filePath: string, title: string | null): DocRelationFileValue;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Manages relation information
|
|
843
|
+
*/
|
|
844
|
+
declare class DocRelationValue {
|
|
845
|
+
readonly value: DocRelation;
|
|
846
|
+
constructor(value: DocRelation);
|
|
847
|
+
/**
|
|
848
|
+
* Relation path
|
|
849
|
+
*/
|
|
850
|
+
get path(): string;
|
|
851
|
+
/**
|
|
852
|
+
* Get file count
|
|
853
|
+
*/
|
|
854
|
+
get fileCount(): number;
|
|
855
|
+
/**
|
|
856
|
+
* Whether it's empty
|
|
857
|
+
*/
|
|
858
|
+
get isEmpty(): boolean;
|
|
859
|
+
/**
|
|
860
|
+
* List of related files (value objects)
|
|
861
|
+
*/
|
|
862
|
+
files(): DocRelationFileValue[];
|
|
863
|
+
/**
|
|
864
|
+
* Export as JSON format
|
|
865
|
+
*/
|
|
866
|
+
toJson(): DocRelation;
|
|
867
|
+
/**
|
|
868
|
+
* Create empty relation entity
|
|
869
|
+
*/
|
|
870
|
+
static empty(path: string): DocRelationValue;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
type Props$6 = {
|
|
874
|
+
filePath: string;
|
|
875
|
+
fileSystem: DocFileSystem;
|
|
876
|
+
pathSystem: DocPathSystem;
|
|
877
|
+
};
|
|
878
|
+
/**
|
|
879
|
+
* Relation file reference
|
|
880
|
+
*/
|
|
881
|
+
declare class DocFileRelationReference {
|
|
882
|
+
private readonly props;
|
|
883
|
+
private readonly pathSystem;
|
|
884
|
+
constructor(props: Props$6);
|
|
885
|
+
get fileSystem(): DocFileSystem;
|
|
886
|
+
get basePath(): string;
|
|
887
|
+
/**
|
|
888
|
+
* Relation path
|
|
889
|
+
*/
|
|
890
|
+
get path(): string;
|
|
891
|
+
/**
|
|
892
|
+
* Full path
|
|
893
|
+
*/
|
|
894
|
+
get fullPath(): string;
|
|
895
|
+
read(): Promise<DocRelationValue | Error | null>;
|
|
896
|
+
/**
|
|
897
|
+
* Read list of relation files
|
|
898
|
+
*/
|
|
899
|
+
readFiles(): Promise<DocRelationFileValue[] | Error>;
|
|
900
|
+
/**
|
|
901
|
+
* Read single relation file
|
|
902
|
+
*/
|
|
903
|
+
readFile(filePath: string): Promise<DocRelationFileValue | Error | null>;
|
|
904
|
+
/**
|
|
905
|
+
* Check if file exists
|
|
906
|
+
*/
|
|
907
|
+
exists(slug: string): Promise<boolean>;
|
|
908
|
+
/**
|
|
909
|
+
* Get list of file names (without extension)
|
|
910
|
+
*/
|
|
911
|
+
readSlugs(): Promise<string[] | Error>;
|
|
912
|
+
/**
|
|
913
|
+
* Get file count
|
|
914
|
+
*/
|
|
915
|
+
count(): Promise<number | Error>;
|
|
916
|
+
/**
|
|
917
|
+
* Check if empty
|
|
918
|
+
*/
|
|
919
|
+
isEmpty(): Promise<boolean | Error>;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* Single boolean type schema field
|
|
924
|
+
*/
|
|
925
|
+
declare class DocSchemaFieldBooleanValue<T extends RecordKey> {
|
|
926
|
+
readonly key: T;
|
|
927
|
+
readonly value: DocSchemaFieldBoolean;
|
|
928
|
+
constructor(key: T, value: DocSchemaFieldBoolean);
|
|
929
|
+
get type(): "boolean";
|
|
930
|
+
get required(): boolean;
|
|
931
|
+
get title(): string;
|
|
932
|
+
get description(): string;
|
|
933
|
+
get default(): boolean | null;
|
|
934
|
+
readonly isArray = false;
|
|
935
|
+
readonly isSingle = true;
|
|
936
|
+
readonly isBoolean = true;
|
|
937
|
+
toJson(): DocFileIndexSchemaField;
|
|
938
|
+
/**
|
|
939
|
+
* Validate value type
|
|
940
|
+
*/
|
|
941
|
+
validate(value: unknown): boolean;
|
|
942
|
+
static empty(key: RecordKey): DocSchemaFieldBooleanValue<RecordKey>;
|
|
943
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldBooleanValue<RecordKey>;
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
/**
|
|
947
|
+
* Multiple relation type schema field
|
|
948
|
+
*/
|
|
949
|
+
declare class DocSchemaFieldMultiRelationValue<T extends RecordKey> {
|
|
950
|
+
readonly key: T;
|
|
951
|
+
readonly value: DocSchemaFieldMultiRelation;
|
|
952
|
+
constructor(key: T, value: DocSchemaFieldMultiRelation);
|
|
953
|
+
get type(): "multi-relation";
|
|
954
|
+
get required(): boolean;
|
|
955
|
+
get title(): string;
|
|
956
|
+
get description(): string;
|
|
957
|
+
get default(): string[] | null;
|
|
958
|
+
get path(): string;
|
|
959
|
+
readonly isArray = true;
|
|
960
|
+
readonly isSingle = false;
|
|
961
|
+
readonly isRelation = true;
|
|
962
|
+
/**
|
|
963
|
+
* Validate value
|
|
964
|
+
*/
|
|
965
|
+
validate(value: unknown): boolean;
|
|
966
|
+
toJson(): DocFileIndexSchemaField;
|
|
967
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiRelationValue<T>;
|
|
968
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiRelationValue<RecordKey>;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
/**
|
|
972
|
+
* Multiple select number type schema field
|
|
973
|
+
*/
|
|
974
|
+
declare class DocSchemaFieldMultiSelectNumberValue<T extends RecordKey> {
|
|
975
|
+
readonly key: T;
|
|
976
|
+
readonly value: DocSchemaFieldMultiSelectNumber;
|
|
977
|
+
constructor(key: T, value: DocSchemaFieldMultiSelectNumber);
|
|
978
|
+
get type(): "multi-select-number";
|
|
979
|
+
get required(): boolean;
|
|
980
|
+
get title(): string;
|
|
981
|
+
get description(): string;
|
|
982
|
+
get default(): number[] | null;
|
|
983
|
+
get options(): number[];
|
|
984
|
+
readonly isArray = true;
|
|
985
|
+
readonly isSingle = false;
|
|
986
|
+
readonly isSelect = true;
|
|
987
|
+
readonly isNumberSelect = true;
|
|
988
|
+
/**
|
|
989
|
+
* Validate value
|
|
990
|
+
*/
|
|
991
|
+
validate(value: unknown): boolean;
|
|
992
|
+
toJson(): DocFileIndexSchemaField;
|
|
993
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiSelectNumberValue<T>;
|
|
994
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiSelectNumberValue<RecordKey>;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
/**
|
|
998
|
+
* Multiple select text type schema field
|
|
999
|
+
*/
|
|
1000
|
+
declare class DocSchemaFieldMultiSelectTextValue<T extends RecordKey> {
|
|
1001
|
+
readonly key: T;
|
|
1002
|
+
readonly value: DocSchemaFieldMultiSelectText;
|
|
1003
|
+
constructor(key: T, value: DocSchemaFieldMultiSelectText);
|
|
1004
|
+
get type(): "multi-select-text";
|
|
1005
|
+
get required(): boolean;
|
|
1006
|
+
get title(): string;
|
|
1007
|
+
get description(): string;
|
|
1008
|
+
get default(): string[] | null;
|
|
1009
|
+
get options(): string[];
|
|
1010
|
+
readonly isArray = true;
|
|
1011
|
+
readonly isSingle = false;
|
|
1012
|
+
readonly isSelect = true;
|
|
1013
|
+
readonly isTextSelect = true;
|
|
1014
|
+
/**
|
|
1015
|
+
* Validate value
|
|
1016
|
+
*/
|
|
1017
|
+
validate(value: unknown): boolean;
|
|
1018
|
+
toJson(): DocFileIndexSchemaField;
|
|
1019
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiSelectTextValue<T>;
|
|
1020
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiSelectTextValue<RecordKey>;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
/**
|
|
1024
|
+
* Multiple text type schema field
|
|
1025
|
+
*/
|
|
1026
|
+
declare class DocSchemaFieldMultiTextValue<T extends RecordKey> {
|
|
1027
|
+
readonly key: T;
|
|
1028
|
+
readonly value: DocSchemaFieldMultiText;
|
|
1029
|
+
constructor(key: T, value: DocSchemaFieldMultiText);
|
|
1030
|
+
get type(): "multi-text";
|
|
1031
|
+
get required(): boolean;
|
|
1032
|
+
get title(): string;
|
|
1033
|
+
get description(): string;
|
|
1034
|
+
get default(): string[] | null;
|
|
1035
|
+
readonly isArray = true;
|
|
1036
|
+
readonly isSingle = false;
|
|
1037
|
+
readonly isText = true;
|
|
1038
|
+
toJson(): DocFileIndexSchemaField;
|
|
1039
|
+
/**
|
|
1040
|
+
* Validate value type
|
|
1041
|
+
*/
|
|
1042
|
+
validate(value: unknown): boolean;
|
|
1043
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiTextValue<T>;
|
|
1044
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiTextValue<RecordKey>;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* Single number type schema field
|
|
1049
|
+
*/
|
|
1050
|
+
declare class DocSchemaFieldNumberValue<T extends RecordKey> {
|
|
1051
|
+
readonly key: T;
|
|
1052
|
+
readonly value: DocSchemaFieldNumber;
|
|
1053
|
+
constructor(key: T, value: DocSchemaFieldNumber);
|
|
1054
|
+
get type(): "number";
|
|
1055
|
+
get required(): boolean;
|
|
1056
|
+
get title(): string;
|
|
1057
|
+
get description(): string;
|
|
1058
|
+
get default(): number | null;
|
|
1059
|
+
readonly isArray = false;
|
|
1060
|
+
readonly isSingle = true;
|
|
1061
|
+
readonly isNumber = true;
|
|
1062
|
+
toJson(): DocFileIndexSchemaField;
|
|
1063
|
+
/**
|
|
1064
|
+
* Validate value type
|
|
1065
|
+
*/
|
|
1066
|
+
validate(value: unknown): boolean;
|
|
1067
|
+
static empty(key: RecordKey): DocSchemaFieldNumberValue<RecordKey>;
|
|
1068
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldNumberValue<RecordKey>;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
/**
|
|
1072
|
+
* Single relation type schema field
|
|
1073
|
+
*/
|
|
1074
|
+
declare class DocSchemaFieldRelationValue<T extends RecordKey> {
|
|
1075
|
+
readonly key: T;
|
|
1076
|
+
readonly value: DocSchemaFieldRelation;
|
|
1077
|
+
constructor(key: T, value: DocSchemaFieldRelation);
|
|
1078
|
+
get type(): "relation";
|
|
1079
|
+
get required(): boolean;
|
|
1080
|
+
get title(): string;
|
|
1081
|
+
get description(): string;
|
|
1082
|
+
get default(): string | null;
|
|
1083
|
+
get path(): string;
|
|
1084
|
+
readonly isArray = false;
|
|
1085
|
+
readonly isSingle = true;
|
|
1086
|
+
readonly isRelation = true;
|
|
1087
|
+
toJson(): DocFileIndexSchemaField;
|
|
1088
|
+
/**
|
|
1089
|
+
* Validate value type
|
|
1090
|
+
*/
|
|
1091
|
+
validate(value: unknown): boolean;
|
|
1092
|
+
static empty(key: RecordKey): DocSchemaFieldRelationValue<RecordKey>;
|
|
1093
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldRelationValue<RecordKey>;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* Single select number type schema field
|
|
1098
|
+
*/
|
|
1099
|
+
declare class DocSchemaFieldSelectNumberValue<T extends RecordKey> {
|
|
1100
|
+
readonly key: T;
|
|
1101
|
+
readonly value: DocSchemaFieldSelectNumber;
|
|
1102
|
+
constructor(key: T, value: DocSchemaFieldSelectNumber);
|
|
1103
|
+
get type(): "select-number";
|
|
1104
|
+
get required(): boolean;
|
|
1105
|
+
get title(): string;
|
|
1106
|
+
get description(): string;
|
|
1107
|
+
get default(): number | null;
|
|
1108
|
+
get options(): number[];
|
|
1109
|
+
readonly isArray = false;
|
|
1110
|
+
readonly isSingle = true;
|
|
1111
|
+
readonly isSelect = true;
|
|
1112
|
+
readonly isNumberSelect = true;
|
|
1113
|
+
/**
|
|
1114
|
+
* Validate value
|
|
1117
1115
|
*/
|
|
1118
|
-
|
|
1116
|
+
validate(value: unknown): boolean;
|
|
1117
|
+
toJson(): DocFileIndexSchemaField;
|
|
1118
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldSelectNumberValue<T>;
|
|
1119
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldSelectNumberValue<RecordKey>;
|
|
1119
1120
|
}
|
|
1120
1121
|
|
|
1121
1122
|
/**
|
|
1122
|
-
*
|
|
1123
|
+
* Single select text type schema field
|
|
1123
1124
|
*/
|
|
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;
|
|
1125
|
+
declare class DocSchemaFieldSelectTextValue<T extends RecordKey> {
|
|
1126
|
+
readonly key: T;
|
|
1127
|
+
readonly value: DocSchemaFieldSelectText;
|
|
1128
|
+
constructor(key: T, value: DocSchemaFieldSelectText);
|
|
1129
|
+
get type(): "select-text";
|
|
1130
|
+
get required(): boolean;
|
|
1131
|
+
get title(): string;
|
|
1132
|
+
get description(): string;
|
|
1133
|
+
get default(): string | null;
|
|
1134
|
+
get options(): string[];
|
|
1135
|
+
readonly isArray = false;
|
|
1136
|
+
readonly isSingle = true;
|
|
1137
|
+
readonly isSelect = true;
|
|
1138
|
+
readonly isTextSelect = true;
|
|
1139
|
+
toJson(): DocFileIndexSchemaField;
|
|
1147
1140
|
/**
|
|
1148
|
-
*
|
|
1141
|
+
* Validate value type
|
|
1149
1142
|
*/
|
|
1150
|
-
|
|
1143
|
+
validate(value: unknown): boolean;
|
|
1144
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldSelectTextValue<T>;
|
|
1145
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldSelectTextValue<RecordKey>;
|
|
1151
1146
|
}
|
|
1152
1147
|
|
|
1153
|
-
type Props$6 = {
|
|
1154
|
-
filePath: string;
|
|
1155
|
-
fileSystem: DocFileSystem;
|
|
1156
|
-
pathSystem: DocPathSystem;
|
|
1157
|
-
};
|
|
1158
1148
|
/**
|
|
1159
|
-
*
|
|
1149
|
+
* Single text type schema field
|
|
1160
1150
|
*/
|
|
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>;
|
|
1151
|
+
declare class DocSchemaFieldTextValue<T extends RecordKey> {
|
|
1152
|
+
readonly key: T;
|
|
1153
|
+
readonly value: DocSchemaFieldText;
|
|
1154
|
+
constructor(key: T, value: DocSchemaFieldText);
|
|
1155
|
+
get type(): "text";
|
|
1156
|
+
get required(): boolean;
|
|
1157
|
+
get title(): string;
|
|
1158
|
+
get description(): string;
|
|
1159
|
+
get default(): string | null;
|
|
1160
|
+
readonly isArray = false;
|
|
1161
|
+
readonly isSingle = true;
|
|
1162
|
+
readonly isText = true;
|
|
1163
|
+
toJson(): DocFileIndexSchemaField;
|
|
1192
1164
|
/**
|
|
1193
|
-
*
|
|
1165
|
+
* Validate value type
|
|
1194
1166
|
*/
|
|
1195
|
-
|
|
1167
|
+
validate(value: unknown): boolean;
|
|
1168
|
+
static empty(key: RecordKey): DocSchemaFieldTextValue<RecordKey>;
|
|
1169
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldTextValue<RecordKey>;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
/**
|
|
1173
|
+
* Multiple number type schema field
|
|
1174
|
+
*/
|
|
1175
|
+
declare class DocSchemaFieldMultiNumberValue<T extends RecordKey> {
|
|
1176
|
+
readonly key: T;
|
|
1177
|
+
readonly value: DocSchemaFieldMultiNumber;
|
|
1178
|
+
constructor(key: T, value: DocSchemaFieldMultiNumber);
|
|
1179
|
+
get type(): "multi-number";
|
|
1180
|
+
get required(): boolean;
|
|
1181
|
+
get title(): string;
|
|
1182
|
+
get description(): string;
|
|
1183
|
+
get default(): number[] | null;
|
|
1184
|
+
readonly isArray = true;
|
|
1185
|
+
readonly isSingle = false;
|
|
1186
|
+
readonly isNumber = true;
|
|
1196
1187
|
/**
|
|
1197
|
-
*
|
|
1188
|
+
* Validate value
|
|
1198
1189
|
*/
|
|
1199
|
-
|
|
1190
|
+
validate(value: unknown): boolean;
|
|
1191
|
+
toJson(): DocFileIndexSchemaField;
|
|
1192
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiNumberValue<T>;
|
|
1193
|
+
static from(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiNumberValue<RecordKey>;
|
|
1200
1194
|
}
|
|
1201
1195
|
|
|
1202
1196
|
/**
|
|
@@ -1218,12 +1212,6 @@ declare class DocFileIndexSchemaValue<T extends DocCustomSchema> {
|
|
|
1218
1212
|
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
1213
|
relation<K extends keyof T>(key: K): DocSchemaFieldRelationValue<K>;
|
|
1220
1214
|
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
1215
|
toJson(): DocFileIndexSchema<keyof T>;
|
|
1228
1216
|
/**
|
|
1229
1217
|
* Create empty schema entity
|
|
@@ -1239,9 +1227,6 @@ declare class DocFileIndexMetaValue<T extends DocCustomSchema> {
|
|
|
1239
1227
|
readonly value: DocFileIndexMeta<T>;
|
|
1240
1228
|
readonly customSchema: T;
|
|
1241
1229
|
private readonly config;
|
|
1242
|
-
/**
|
|
1243
|
-
* Additional properties to include in the meta data
|
|
1244
|
-
*/
|
|
1245
1230
|
private readonly additionalProperties;
|
|
1246
1231
|
constructor(value: DocFileIndexMeta<T>, customSchema: T, config: DocClientConfig, additionalProperties?: Record<string, unknown>);
|
|
1247
1232
|
/**
|
|
@@ -1417,10 +1402,15 @@ declare class DocFileIndexReference<T extends DocCustomSchema> {
|
|
|
1417
1402
|
get fileFullPath(): string;
|
|
1418
1403
|
get durectoryPath(): string;
|
|
1419
1404
|
read(): Promise<DocFileIndexEntity<T> | Error>;
|
|
1405
|
+
readSchemaValue(): Promise<DocFileIndexSchema<RecordKey>>;
|
|
1420
1406
|
/**
|
|
1421
1407
|
* Read file content
|
|
1422
1408
|
*/
|
|
1423
1409
|
readContent(): Promise<Error | string>;
|
|
1410
|
+
/**
|
|
1411
|
+
* Create empty DocFileIndexEntity
|
|
1412
|
+
*/
|
|
1413
|
+
empty(): DocFileIndexEntity<T>;
|
|
1424
1414
|
/**
|
|
1425
1415
|
* Write content to file
|
|
1426
1416
|
*/
|
|
@@ -1518,16 +1508,18 @@ declare class DocDirectoryReference<T extends DocCustomSchema> {
|
|
|
1518
1508
|
readIndexFile(): Promise<DocFileIndexEntity<T> | Error>;
|
|
1519
1509
|
writeFile(entity: DocFileIndexEntity<T> | DocFileMdEntity<T> | DocFileUnknownEntity): Promise<Error | null>;
|
|
1520
1510
|
exists(): Promise<boolean>;
|
|
1521
|
-
/**
|
|
1522
|
-
* Generate unique filename
|
|
1523
|
-
*/
|
|
1524
|
-
private uniqueFileName;
|
|
1525
1511
|
/**
|
|
1526
1512
|
* Create new Markdown file
|
|
1527
1513
|
*/
|
|
1528
1514
|
createMdFile(fileName?: string): Promise<DocFileMdReference<T>>;
|
|
1515
|
+
/**
|
|
1516
|
+
* Generate unique filename
|
|
1517
|
+
*/
|
|
1518
|
+
private uniqueFileName;
|
|
1529
1519
|
}
|
|
1530
1520
|
|
|
1521
|
+
declare const DOC_NODE_TYPE_DIRECTORY: "directory";
|
|
1522
|
+
|
|
1531
1523
|
type Props$3 = {
|
|
1532
1524
|
name: string;
|
|
1533
1525
|
path: string;
|
|
@@ -1579,7 +1571,7 @@ declare class DocTreeDirectoryNodeValue {
|
|
|
1579
1571
|
get icon(): string;
|
|
1580
1572
|
get title(): string;
|
|
1581
1573
|
get children(): DocTreeNodeValue[];
|
|
1582
|
-
get type():
|
|
1574
|
+
get type(): typeof DOC_NODE_TYPE_DIRECTORY;
|
|
1583
1575
|
/**
|
|
1584
1576
|
* Convert to plain object
|
|
1585
1577
|
*/
|
|
@@ -1970,4 +1962,197 @@ declare const docCustomSchemaField: {
|
|
|
1970
1962
|
};
|
|
1971
1963
|
};
|
|
1972
1964
|
|
|
1973
|
-
|
|
1965
|
+
declare class DocCustomSchemaFieldValue<T extends DocCustomSchemaField> {
|
|
1966
|
+
readonly value: T;
|
|
1967
|
+
constructor(value: T);
|
|
1968
|
+
validate(value: unknown): string | number | boolean | string[] | number[] | null;
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
/**
|
|
1972
|
+
* Value object for file path information
|
|
1973
|
+
*/
|
|
1974
|
+
declare class DocFilePathValue {
|
|
1975
|
+
readonly value: DocFilePath;
|
|
1976
|
+
private readonly pathSystem;
|
|
1977
|
+
constructor(value: DocFilePath, pathSystem: DocPathSystem);
|
|
1978
|
+
/**
|
|
1979
|
+
* File name without extension
|
|
1980
|
+
*/
|
|
1981
|
+
get name(): string;
|
|
1982
|
+
/**
|
|
1983
|
+
* File path (relative path)
|
|
1984
|
+
*/
|
|
1985
|
+
get path(): string;
|
|
1986
|
+
/**
|
|
1987
|
+
* File name with extension
|
|
1988
|
+
*/
|
|
1989
|
+
get nameWithExtension(): string;
|
|
1990
|
+
/**
|
|
1991
|
+
* Full path (absolute path)
|
|
1992
|
+
*/
|
|
1993
|
+
get fullPath(): string;
|
|
1994
|
+
/**
|
|
1995
|
+
* Directory path
|
|
1996
|
+
*/
|
|
1997
|
+
get directoryPath(): string;
|
|
1998
|
+
/**
|
|
1999
|
+
* Extension
|
|
2000
|
+
*/
|
|
2001
|
+
get extension(): string;
|
|
2002
|
+
/**
|
|
2003
|
+
* Whether the file is archived
|
|
2004
|
+
*/
|
|
2005
|
+
get isArchived(): boolean;
|
|
2006
|
+
/**
|
|
2007
|
+
* Export as JSON format
|
|
2008
|
+
*/
|
|
2009
|
+
toJson(): DocFilePath;
|
|
2010
|
+
/**
|
|
2011
|
+
* Create instance from relative path (DI support)
|
|
2012
|
+
*/
|
|
2013
|
+
static fromPathWithSystem(filePath: string, pathSystem: DocPathSystem, basePath?: string): DocFilePathValue;
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
type Value = {
|
|
2017
|
+
path: string;
|
|
2018
|
+
name: string;
|
|
2019
|
+
fullPath: string;
|
|
2020
|
+
};
|
|
2021
|
+
/**
|
|
2022
|
+
* Value object representing a directory path
|
|
2023
|
+
*/
|
|
2024
|
+
declare class DocDirectoryPathValue {
|
|
2025
|
+
private readonly value;
|
|
2026
|
+
private readonly pathSystem;
|
|
2027
|
+
constructor(value: Value, pathSystem: DocPathSystem);
|
|
2028
|
+
/**
|
|
2029
|
+
* Relative directory path
|
|
2030
|
+
*/
|
|
2031
|
+
get path(): string;
|
|
2032
|
+
/**
|
|
2033
|
+
* Directory name
|
|
2034
|
+
*/
|
|
2035
|
+
get name(): string;
|
|
2036
|
+
/**
|
|
2037
|
+
* Get parent directory path
|
|
2038
|
+
*/
|
|
2039
|
+
get parent(): DocDirectoryPathValue | null;
|
|
2040
|
+
/**
|
|
2041
|
+
* Parent directory path
|
|
2042
|
+
*/
|
|
2043
|
+
get parentPath(): string;
|
|
2044
|
+
/**
|
|
2045
|
+
* Depth (number of directory levels)
|
|
2046
|
+
*/
|
|
2047
|
+
get depth(): number;
|
|
2048
|
+
/**
|
|
2049
|
+
* Path segments (array of directories)
|
|
2050
|
+
*/
|
|
2051
|
+
get segments(): string[];
|
|
2052
|
+
/**
|
|
2053
|
+
* Relative path from root (without leading slash)
|
|
2054
|
+
*/
|
|
2055
|
+
get normalizedPath(): string;
|
|
2056
|
+
/**
|
|
2057
|
+
* Whether this is an archive directory (directory name is "_")
|
|
2058
|
+
*/
|
|
2059
|
+
get isArchived(): boolean;
|
|
2060
|
+
/**
|
|
2061
|
+
* Whether this is a hidden directory
|
|
2062
|
+
*/
|
|
2063
|
+
get isHidden(): boolean;
|
|
2064
|
+
/**
|
|
2065
|
+
* Whether this is the root directory
|
|
2066
|
+
*/
|
|
2067
|
+
get isRoot(): boolean;
|
|
2068
|
+
/**
|
|
2069
|
+
* Absolute path
|
|
2070
|
+
*/
|
|
2071
|
+
get fullPath(): string;
|
|
2072
|
+
/**
|
|
2073
|
+
* Get index file path
|
|
2074
|
+
*/
|
|
2075
|
+
get indexFile(): DocFilePathValue;
|
|
2076
|
+
/**
|
|
2077
|
+
* Create file path
|
|
2078
|
+
*/
|
|
2079
|
+
file(fileName: string): DocFilePathValue;
|
|
2080
|
+
/**
|
|
2081
|
+
* Create subdirectory path
|
|
2082
|
+
*/
|
|
2083
|
+
subdirectory(dirName: string): DocDirectoryPathValue;
|
|
2084
|
+
/**
|
|
2085
|
+
* Create instance from relative path (DI support)
|
|
2086
|
+
*/
|
|
2087
|
+
static fromPathWithSystem(dirPath: string, basePath: string, pathSystem: DocPathSystem): DocDirectoryPathValue;
|
|
2088
|
+
/**
|
|
2089
|
+
* Export as JSON format
|
|
2090
|
+
*/
|
|
2091
|
+
toJson(): Value;
|
|
2092
|
+
/**
|
|
2093
|
+
* Check if paths are equal
|
|
2094
|
+
*/
|
|
2095
|
+
equals(other: DocDirectoryPathValue): boolean;
|
|
2096
|
+
/**
|
|
2097
|
+
* Check if specified directory is a descendant of this directory
|
|
2098
|
+
*/
|
|
2099
|
+
contains(other: DocDirectoryPathValue): boolean;
|
|
2100
|
+
}
|
|
2101
|
+
|
|
2102
|
+
/**
|
|
2103
|
+
* Relation field
|
|
2104
|
+
*/
|
|
2105
|
+
declare class DocRelationFieldValue {
|
|
2106
|
+
private readonly value;
|
|
2107
|
+
constructor(value: DocRelationField);
|
|
2108
|
+
/**
|
|
2109
|
+
* Get field name
|
|
2110
|
+
*/
|
|
2111
|
+
get fieldName(): string;
|
|
2112
|
+
/**
|
|
2113
|
+
* Get relation target path
|
|
2114
|
+
*/
|
|
2115
|
+
get relationPath(): string;
|
|
2116
|
+
/**
|
|
2117
|
+
* Get whether it's an array type
|
|
2118
|
+
*/
|
|
2119
|
+
get isArray(): boolean;
|
|
2120
|
+
/**
|
|
2121
|
+
* Check if it's a single relation
|
|
2122
|
+
*/
|
|
2123
|
+
get isSingle(): boolean;
|
|
2124
|
+
/**
|
|
2125
|
+
* Check if it's a multiple relation
|
|
2126
|
+
*/
|
|
2127
|
+
get isMultiple(): boolean;
|
|
2128
|
+
/**
|
|
2129
|
+
* Get target directory name
|
|
2130
|
+
*/
|
|
2131
|
+
get targetDirectoryName(): string;
|
|
2132
|
+
/**
|
|
2133
|
+
* Generate full relation path
|
|
2134
|
+
*/
|
|
2135
|
+
fullPath(basePath: string): string;
|
|
2136
|
+
/**
|
|
2137
|
+
* Check equality
|
|
2138
|
+
*/
|
|
2139
|
+
equals(other: DocRelationFieldValue): boolean;
|
|
2140
|
+
/**
|
|
2141
|
+
* Convert to JSON format
|
|
2142
|
+
*/
|
|
2143
|
+
toJson(): DocRelationField;
|
|
2144
|
+
/**
|
|
2145
|
+
* Create from data
|
|
2146
|
+
*/
|
|
2147
|
+
static from(data: unknown): DocRelationFieldValue;
|
|
2148
|
+
/**
|
|
2149
|
+
* Create from properties
|
|
2150
|
+
*/
|
|
2151
|
+
static fromProps(props: {
|
|
2152
|
+
fieldName: string;
|
|
2153
|
+
filePath: string;
|
|
2154
|
+
isArray: boolean;
|
|
2155
|
+
}): DocRelationFieldValue;
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
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 };
|