@interactive-inc/docs-client 1.0.12 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.d.ts +92 -89
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -142,7 +142,7 @@ declare class DocFileSystem {
|
|
|
142
142
|
/**
|
|
143
143
|
* Meta
|
|
144
144
|
*/
|
|
145
|
-
declare class DocFileMdMetaValue<T extends
|
|
145
|
+
declare class DocFileMdMetaValue<T extends DocCustomSchemaGenerics> {
|
|
146
146
|
readonly value: SchemaToValueType<T>;
|
|
147
147
|
readonly customSchema: T;
|
|
148
148
|
constructor(value: SchemaToValueType<T>, customSchema: T);
|
|
@@ -169,17 +169,17 @@ declare class DocFileMdMetaValue<T extends DocCustomSchema> {
|
|
|
169
169
|
/**
|
|
170
170
|
* Generate from Markdown text
|
|
171
171
|
*/
|
|
172
|
-
static fromYamlText<T extends
|
|
173
|
-
static empty<T extends
|
|
172
|
+
static fromYamlText<T extends DocCustomSchemaGenerics>(yamlText: string, customSchema: T): DocFileMdMetaValue<T>;
|
|
173
|
+
static empty<T extends DocCustomSchemaGenerics>(customSchema: T): DocFileMdMetaValue<T>;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
/**
|
|
177
177
|
* File: Markdown > Content
|
|
178
178
|
*/
|
|
179
|
-
declare class DocFileMdContentValue<T extends
|
|
180
|
-
readonly value:
|
|
179
|
+
declare class DocFileMdContentValue<T extends DocCustomSchemaGenerics> {
|
|
180
|
+
readonly value: DocFileMdContentGenerics<T>;
|
|
181
181
|
private readonly customSchema;
|
|
182
|
-
constructor(value:
|
|
182
|
+
constructor(value: DocFileMdContentGenerics<T>, customSchema: T);
|
|
183
183
|
/**
|
|
184
184
|
* Content body (does not include frontMatter)
|
|
185
185
|
*/
|
|
@@ -211,7 +211,7 @@ declare class DocFileMdContentValue<T extends DocCustomSchema> {
|
|
|
211
211
|
/**
|
|
212
212
|
* Update FrontMatter
|
|
213
213
|
*/
|
|
214
|
-
withMeta<U extends
|
|
214
|
+
withMeta<U extends DocCustomSchemaGenerics>(meta: DocFileMdMetaValue<U>): DocFileMdContentValue<U>;
|
|
215
215
|
/**
|
|
216
216
|
* Update specific property of FrontMatter
|
|
217
217
|
*/
|
|
@@ -219,7 +219,7 @@ declare class DocFileMdContentValue<T extends DocCustomSchema> {
|
|
|
219
219
|
/**
|
|
220
220
|
* Generate from Markdown text
|
|
221
221
|
*/
|
|
222
|
-
static fromMarkdown<T extends
|
|
222
|
+
static fromMarkdown<T extends DocCustomSchemaGenerics>(markdown: string, customSchema: T): DocFileMdContentValue<T>;
|
|
223
223
|
/**
|
|
224
224
|
* Generate complete Markdown text
|
|
225
225
|
*/
|
|
@@ -231,20 +231,20 @@ declare class DocFileMdContentValue<T extends DocCustomSchema> {
|
|
|
231
231
|
/**
|
|
232
232
|
* Generate empty content
|
|
233
233
|
*/
|
|
234
|
-
static empty<T extends
|
|
234
|
+
static empty<T extends DocCustomSchemaGenerics = DocCustomSchemaGenerics>(title: string, customSchema: T): DocFileMdContentValue<T>;
|
|
235
235
|
/**
|
|
236
236
|
* Output in JSON format
|
|
237
237
|
*/
|
|
238
|
-
toJson():
|
|
238
|
+
toJson(): DocFileMdContentGenerics<T>;
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
/**
|
|
242
242
|
* Markdown file entity
|
|
243
243
|
*/
|
|
244
|
-
declare class DocFileMdEntity<T extends
|
|
245
|
-
readonly value:
|
|
244
|
+
declare class DocFileMdEntity<T extends DocCustomSchemaGenerics> {
|
|
245
|
+
readonly value: DocFileMdGenerics<T>;
|
|
246
246
|
private readonly customSchema;
|
|
247
|
-
constructor(value:
|
|
247
|
+
constructor(value: DocFileMdGenerics<T>, customSchema: T);
|
|
248
248
|
/**
|
|
249
249
|
* Content
|
|
250
250
|
*/
|
|
@@ -270,7 +270,7 @@ declare class DocFileMdEntity<T extends DocCustomSchema> {
|
|
|
270
270
|
toJson(): z.infer<typeof zDocFileMd>;
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
-
type Props$8<T extends
|
|
273
|
+
type Props$8<T extends DocCustomSchemaGenerics> = {
|
|
274
274
|
path: string;
|
|
275
275
|
fileSystem: DocFileSystem;
|
|
276
276
|
pathSystem: DocPathSystem;
|
|
@@ -280,7 +280,7 @@ type Props$8<T extends DocCustomSchema> = {
|
|
|
280
280
|
/**
|
|
281
281
|
* File reference
|
|
282
282
|
*/
|
|
283
|
-
declare class DocFileMdReference<T extends
|
|
283
|
+
declare class DocFileMdReference<T extends DocCustomSchemaGenerics> {
|
|
284
284
|
private readonly props;
|
|
285
285
|
private readonly pathSystem;
|
|
286
286
|
private readonly customSchema;
|
|
@@ -348,7 +348,7 @@ declare class DocFileMdReference<T extends DocCustomSchema> {
|
|
|
348
348
|
/**
|
|
349
349
|
* Get relation based on schema
|
|
350
350
|
*/
|
|
351
|
-
relation<U extends
|
|
351
|
+
relation<U extends DocCustomSchemaGenerics = DocCustomSchemaGenerics>(key: RelationKeys<T>, targetSchema?: U): Promise<DocFileMdReference<U> | Error | null>;
|
|
352
352
|
/**
|
|
353
353
|
* Get index.md in the same directory
|
|
354
354
|
*/
|
|
@@ -356,7 +356,7 @@ declare class DocFileMdReference<T extends DocCustomSchema> {
|
|
|
356
356
|
/**
|
|
357
357
|
* Get multiple relations based on schema
|
|
358
358
|
*/
|
|
359
|
-
relations<U extends
|
|
359
|
+
relations<U extends DocCustomSchemaGenerics = DocCustomSchemaGenerics>(key: MultiRelationKeys<T>, customSchema?: U): Promise<DocFileMdReference<U>[]>;
|
|
360
360
|
/**
|
|
361
361
|
* File: Markdown > FrontMatter
|
|
362
362
|
*/
|
|
@@ -411,8 +411,8 @@ declare class DocFileUnknownReference {
|
|
|
411
411
|
get directoryPath(): string;
|
|
412
412
|
get fileFullPath(): string;
|
|
413
413
|
get durectoryPath(): string;
|
|
414
|
-
directory<T extends
|
|
415
|
-
directory(): DocDirectoryReference<
|
|
414
|
+
directory<T extends DocCustomSchemaGenerics>(customSchema: T): DocDirectoryReference<T>;
|
|
415
|
+
directory(): DocDirectoryReference<DocCustomSchemaGenerics>;
|
|
416
416
|
read(): Promise<Error | DocFileUnknownEntity>;
|
|
417
417
|
/**
|
|
418
418
|
* Read file content
|
|
@@ -591,7 +591,7 @@ type DocFileIndexSchemaField = z.infer<typeof zDocFileIndexSchemaField>;
|
|
|
591
591
|
/**
|
|
592
592
|
* Schema definition type
|
|
593
593
|
*/
|
|
594
|
-
type
|
|
594
|
+
type DocFileIndexSchemaGenerics<T extends RecordKey> = Record<T, DocFileIndexSchemaField>;
|
|
595
595
|
/**
|
|
596
596
|
* Schema field to override
|
|
597
597
|
* ex: { xxx: { type: "text", required: true } }
|
|
@@ -604,7 +604,7 @@ type DocFieldTypeLiteral = "text" | "number" | "boolean" | "relation" | "multi-t
|
|
|
604
604
|
/**
|
|
605
605
|
* Minimal schema definition type
|
|
606
606
|
*/
|
|
607
|
-
type
|
|
607
|
+
type DocCustomSchemaGenerics<T extends RecordKey = RecordKey> = Record<T, DocCustomSchemaField>;
|
|
608
608
|
/**
|
|
609
609
|
* Union type for relation fields
|
|
610
610
|
*/
|
|
@@ -637,11 +637,11 @@ type DocTreeNode = DocTreeFileNode | DocTreeDirectoryNode;
|
|
|
637
637
|
/**
|
|
638
638
|
* Index file type
|
|
639
639
|
*/
|
|
640
|
-
type
|
|
640
|
+
type DocFileIndexGenerics<T extends DocCustomSchemaGenerics = DocCustomSchemaGenerics> = {
|
|
641
641
|
type: "index";
|
|
642
642
|
path: DocFilePath;
|
|
643
643
|
isArchived: boolean;
|
|
644
|
-
content:
|
|
644
|
+
content: DocFileIndexContentGenerics<T>;
|
|
645
645
|
};
|
|
646
646
|
/**
|
|
647
647
|
* Type to check if two types are equal
|
|
@@ -650,23 +650,23 @@ type Equals<T, U> = (<G>() => G extends T ? 1 : 2) extends <G>() => G extends U
|
|
|
650
650
|
/**
|
|
651
651
|
* Extract relation field keys from schema
|
|
652
652
|
*/
|
|
653
|
-
type RelationKeys<T extends
|
|
653
|
+
type RelationKeys<T extends DocCustomSchemaGenerics> = {
|
|
654
654
|
[K in keyof T]: T[K]["type"] extends "relation" ? K : never;
|
|
655
655
|
}[keyof T];
|
|
656
656
|
/**
|
|
657
657
|
* Extract multi-relation field keys from schema
|
|
658
658
|
*/
|
|
659
|
-
type MultiRelationKeys<T extends
|
|
659
|
+
type MultiRelationKeys<T extends DocCustomSchemaGenerics> = {
|
|
660
660
|
[K in keyof T]: T[K]["type"] extends "multi-relation" ? K : never;
|
|
661
661
|
}[keyof T];
|
|
662
662
|
/**
|
|
663
663
|
* Markdown file type (excluding index.md)
|
|
664
664
|
*/
|
|
665
|
-
type
|
|
665
|
+
type DocFileMdGenerics<T extends DocCustomSchemaGenerics> = {
|
|
666
666
|
type: "markdown";
|
|
667
667
|
path: DocFilePath;
|
|
668
668
|
isArchived: boolean;
|
|
669
|
-
content:
|
|
669
|
+
content: DocFileMdContentGenerics<T>;
|
|
670
670
|
};
|
|
671
671
|
/**
|
|
672
672
|
* Other file type (non-markdown)
|
|
@@ -675,15 +675,18 @@ type DocFileUnknown = z.infer<typeof zDocFileUnknown>;
|
|
|
675
675
|
/**
|
|
676
676
|
* File union type (index.md, regular md, other)
|
|
677
677
|
*/
|
|
678
|
-
type
|
|
679
|
-
type
|
|
678
|
+
type DocFileGenerics<T extends DocCustomSchemaGenerics = DocCustomSchemaGenerics> = DocFileIndexGenerics<T> | DocFileMdGenerics<T> | DocFileUnknown;
|
|
679
|
+
type DocDirectoryFileGenerics<T extends DocCustomSchemaGenerics = DocCustomSchemaGenerics> = DocFileMdGenerics<T> | DocFileUnknown;
|
|
680
|
+
type DocFileIndex = z.infer<typeof zDocFileIndex>;
|
|
681
|
+
type DocFileMd = z.infer<typeof zDocFileMd>;
|
|
682
|
+
type DocFile = DocFileIndex | DocFileMd | DocFileUnknown;
|
|
680
683
|
/**
|
|
681
684
|
* Directory FrontMatter type
|
|
682
685
|
*/
|
|
683
|
-
type
|
|
686
|
+
type DocFileIndexMetaGenerics<T extends DocCustomSchemaGenerics = DocCustomSchemaGenerics> = {
|
|
684
687
|
type: "index-meta";
|
|
685
688
|
icon: string | null;
|
|
686
|
-
schema:
|
|
689
|
+
schema: DocFileIndexSchemaGenerics<keyof T>;
|
|
687
690
|
};
|
|
688
691
|
/**
|
|
689
692
|
* Relation options type
|
|
@@ -719,11 +722,11 @@ type DetectFileType<T extends string> = IsIndexMd<T> extends true ? "index" : En
|
|
|
719
722
|
/**
|
|
720
723
|
* Map file type to reference class
|
|
721
724
|
*/
|
|
722
|
-
type
|
|
725
|
+
type FileTypeToReferenceGenerics<FileType extends string, Schema extends DocCustomSchemaGenerics> = FileType extends "index" ? DocFileIndexReference<Schema> : FileType extends "markdown" ? DocFileMdReference<Schema> : DocFileUnknownReference;
|
|
723
726
|
/**
|
|
724
727
|
* Infer reference type from path
|
|
725
728
|
*/
|
|
726
|
-
type InferReference<Path extends string, Schema extends
|
|
729
|
+
type InferReference<Path extends string, Schema extends DocCustomSchemaGenerics> = FileTypeToReferenceGenerics<DetectFileType<Path>, Schema>;
|
|
727
730
|
/**
|
|
728
731
|
* File path information type
|
|
729
732
|
*/
|
|
@@ -731,7 +734,7 @@ type DocFilePath = z.infer<typeof zDocFilePath>;
|
|
|
731
734
|
/**
|
|
732
735
|
* Markdown content information type
|
|
733
736
|
*/
|
|
734
|
-
type
|
|
737
|
+
type DocFileMdContentGenerics<T extends DocCustomSchemaGenerics = DocCustomSchemaGenerics> = {
|
|
735
738
|
type: "markdown-content";
|
|
736
739
|
body: string;
|
|
737
740
|
title: string;
|
|
@@ -741,20 +744,20 @@ type DocFileMdContent<T extends DocCustomSchema = DocCustomSchema> = {
|
|
|
741
744
|
/**
|
|
742
745
|
* Index file content information type
|
|
743
746
|
*/
|
|
744
|
-
type
|
|
747
|
+
type DocFileIndexContentGenerics<T extends DocCustomSchemaGenerics = DocCustomSchemaGenerics> = {
|
|
745
748
|
type: "markdown-index";
|
|
746
749
|
body: string;
|
|
747
750
|
title: string;
|
|
748
751
|
description: string;
|
|
749
|
-
meta:
|
|
752
|
+
meta: DocFileIndexMetaGenerics<T>;
|
|
750
753
|
};
|
|
751
754
|
/**
|
|
752
755
|
* Directory response type (re-export from server package)
|
|
753
756
|
*/
|
|
754
|
-
type
|
|
757
|
+
type DocDirectoryGenerics<T extends DocCustomSchemaGenerics> = {
|
|
755
758
|
cwd: string;
|
|
756
|
-
indexFile:
|
|
757
|
-
files:
|
|
759
|
+
indexFile: DocFileIndexGenerics<T>;
|
|
760
|
+
files: DocFileGenerics<T>[];
|
|
758
761
|
relations: DocRelation[];
|
|
759
762
|
};
|
|
760
763
|
type RecordKey = PropertyKey;
|
|
@@ -776,7 +779,7 @@ type FieldValueType<Type, Required> = Required extends true ? BaseFieldValueType
|
|
|
776
779
|
/**
|
|
777
780
|
* Extract required field keys
|
|
778
781
|
*/
|
|
779
|
-
type RequiredKeys<T extends
|
|
782
|
+
type RequiredKeys<T extends DocCustomSchemaGenerics> = {
|
|
780
783
|
[K in keyof T]: T[K] extends {
|
|
781
784
|
required: true;
|
|
782
785
|
} ? K : never;
|
|
@@ -784,7 +787,7 @@ type RequiredKeys<T extends DocCustomSchema> = {
|
|
|
784
787
|
/**
|
|
785
788
|
* Extract optional field keys
|
|
786
789
|
*/
|
|
787
|
-
type OptionalKeys<T extends
|
|
790
|
+
type OptionalKeys<T extends DocCustomSchemaGenerics> = {
|
|
788
791
|
[K in keyof T]: T[K] extends {
|
|
789
792
|
required: true;
|
|
790
793
|
} ? never : K;
|
|
@@ -792,7 +795,7 @@ type OptionalKeys<T extends DocCustomSchema> = {
|
|
|
792
795
|
/**
|
|
793
796
|
* Generate expected value type from schema (considering required)
|
|
794
797
|
*/
|
|
795
|
-
type SchemaToValueType<T extends
|
|
798
|
+
type SchemaToValueType<T extends DocCustomSchemaGenerics> = {
|
|
796
799
|
[K in RequiredKeys<T>]: BaseFieldValueType<ExtractFieldType<T[K]>>;
|
|
797
800
|
} & {
|
|
798
801
|
[K in OptionalKeys<T>]?: BaseFieldValueType<ExtractFieldType<T[K]>> | null;
|
|
@@ -800,12 +803,12 @@ type SchemaToValueType<T extends DocCustomSchema> = {
|
|
|
800
803
|
/**
|
|
801
804
|
* Helper type for type-safe property access
|
|
802
805
|
*/
|
|
803
|
-
type GetValueType<T extends
|
|
804
|
-
type GetIndexFieldType<Schema extends
|
|
806
|
+
type GetValueType<T extends DocCustomSchemaGenerics, K extends keyof T> = K extends RequiredKeys<T> ? BaseFieldValueType<ExtractFieldType<T[K]>> : BaseFieldValueType<ExtractFieldType<T[K]>> | undefined | null;
|
|
807
|
+
type GetIndexFieldType<Schema extends DocFileIndexSchemaGenerics<RecordKey>, K extends keyof Schema> = Schema[K] extends DocFileIndexSchemaField ? Schema[K] : never;
|
|
805
808
|
/**
|
|
806
809
|
* Infers DocFileMd type from the result of defineSchema
|
|
807
810
|
*/
|
|
808
|
-
type InferDocFileMd<T> = T extends
|
|
811
|
+
type InferDocFileMd<T> = T extends DocCustomSchemaGenerics ? DocFileMdGenerics<T> : never;
|
|
809
812
|
|
|
810
813
|
/**
|
|
811
814
|
* Relation file
|
|
@@ -1197,10 +1200,10 @@ declare class DocSchemaFieldMultiNumberValue<T extends RecordKey> {
|
|
|
1197
1200
|
/**
|
|
1198
1201
|
* Type-safe schema value object
|
|
1199
1202
|
*/
|
|
1200
|
-
declare class DocFileIndexSchemaValue<T extends
|
|
1201
|
-
readonly value:
|
|
1203
|
+
declare class DocFileIndexSchemaValue<T extends DocCustomSchemaGenerics> {
|
|
1204
|
+
readonly value: DocFileIndexSchemaGenerics<keyof T>;
|
|
1202
1205
|
readonly customSchema: T;
|
|
1203
|
-
constructor(value:
|
|
1206
|
+
constructor(value: DocFileIndexSchemaGenerics<keyof T>, customSchema: T);
|
|
1204
1207
|
/**
|
|
1205
1208
|
* Get list of field names
|
|
1206
1209
|
* Automatically type-safe when using Zod schema
|
|
@@ -1213,7 +1216,7 @@ declare class DocFileIndexSchemaValue<T extends DocCustomSchema> {
|
|
|
1213
1216
|
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;
|
|
1214
1217
|
relation<K extends keyof T>(key: K): DocSchemaFieldRelationValue<K>;
|
|
1215
1218
|
multiRelation<K extends keyof T>(key: K): DocSchemaFieldMultiRelationValue<K>;
|
|
1216
|
-
toJson():
|
|
1219
|
+
toJson(): DocFileIndexSchemaGenerics<keyof T>;
|
|
1217
1220
|
/**
|
|
1218
1221
|
* Create empty schema entity
|
|
1219
1222
|
* biome-ignore lint/complexity/noBannedTypes: {} as DocCustomSchema
|
|
@@ -1224,12 +1227,12 @@ declare class DocFileIndexSchemaValue<T extends DocCustomSchema> {
|
|
|
1224
1227
|
/**
|
|
1225
1228
|
* File: index.md > content > FrontMatter
|
|
1226
1229
|
*/
|
|
1227
|
-
declare class DocFileIndexMetaValue<T extends
|
|
1228
|
-
readonly value:
|
|
1230
|
+
declare class DocFileIndexMetaValue<T extends DocCustomSchemaGenerics> {
|
|
1231
|
+
readonly value: DocFileIndexMetaGenerics<T>;
|
|
1229
1232
|
readonly customSchema: T;
|
|
1230
1233
|
private readonly config;
|
|
1231
1234
|
private readonly additionalProperties;
|
|
1232
|
-
constructor(value:
|
|
1235
|
+
constructor(value: DocFileIndexMetaGenerics<T>, customSchema: T, config: DocClientConfig, additionalProperties?: Record<string, unknown>);
|
|
1233
1236
|
/**
|
|
1234
1237
|
* Get icon
|
|
1235
1238
|
*/
|
|
@@ -1249,16 +1252,16 @@ declare class DocFileIndexMetaValue<T extends DocCustomSchema> {
|
|
|
1249
1252
|
/**
|
|
1250
1253
|
* Update schema field
|
|
1251
1254
|
*/
|
|
1252
|
-
withSchema(value:
|
|
1255
|
+
withSchema(value: DocFileIndexSchemaGenerics<keyof T>): DocFileIndexMetaValue<T>;
|
|
1253
1256
|
/**
|
|
1254
1257
|
* Return a new instance with an unknown schema
|
|
1255
1258
|
* Allows accepting Record<string, unknown> schemas from external sources
|
|
1256
1259
|
*/
|
|
1257
|
-
withUnknownSchema(draft: Record<string, unknown>): DocFileIndexMetaValue<
|
|
1260
|
+
withUnknownSchema(draft: Record<string, unknown>): DocFileIndexMetaValue<DocCustomSchemaGenerics>;
|
|
1258
1261
|
/**
|
|
1259
1262
|
* Output in JSON format
|
|
1260
1263
|
*/
|
|
1261
|
-
toJson():
|
|
1264
|
+
toJson(): DocFileIndexMetaGenerics<T>;
|
|
1262
1265
|
/**
|
|
1263
1266
|
* Output in YAML format
|
|
1264
1267
|
*/
|
|
@@ -1266,15 +1269,15 @@ declare class DocFileIndexMetaValue<T extends DocCustomSchema> {
|
|
|
1266
1269
|
/**
|
|
1267
1270
|
* Generate from Markdown text (can process incomplete data)
|
|
1268
1271
|
*/
|
|
1269
|
-
static from<T extends
|
|
1272
|
+
static from<T extends DocCustomSchemaGenerics>(markdownText: string, customSchema: T, config: DocClientConfig): DocFileIndexMetaValue<T>;
|
|
1270
1273
|
/**
|
|
1271
1274
|
* Generate directly from data (can process incomplete data)
|
|
1272
1275
|
*/
|
|
1273
|
-
static fromRecord<T extends
|
|
1276
|
+
static fromRecord<T extends DocCustomSchemaGenerics>(record: Record<string, unknown>, customSchema: T, config: DocClientConfig): DocFileIndexMetaValue<T>;
|
|
1274
1277
|
/**
|
|
1275
1278
|
* Generate empty FrontMatter
|
|
1276
1279
|
*/
|
|
1277
|
-
static empty<T extends
|
|
1280
|
+
static empty<T extends DocCustomSchemaGenerics>(customSchema: T, config: DocClientConfig): DocFileIndexMetaValue<T>;
|
|
1278
1281
|
/**
|
|
1279
1282
|
* Extract icon
|
|
1280
1283
|
*/
|
|
@@ -1287,17 +1290,17 @@ declare class DocFileIndexMetaValue<T extends DocCustomSchema> {
|
|
|
1287
1290
|
* Normalize entire schema
|
|
1288
1291
|
*/
|
|
1289
1292
|
private static normalizeSchema;
|
|
1290
|
-
static emptySchema<T extends
|
|
1293
|
+
static emptySchema<T extends DocCustomSchemaGenerics>(customSchema: T): DocFileIndexSchemaGenerics<keyof T>;
|
|
1291
1294
|
}
|
|
1292
1295
|
|
|
1293
1296
|
/**
|
|
1294
1297
|
* File: index.md > content
|
|
1295
1298
|
*/
|
|
1296
|
-
declare class DocFileIndexContentValue<T extends
|
|
1297
|
-
readonly value:
|
|
1299
|
+
declare class DocFileIndexContentValue<T extends DocCustomSchemaGenerics> {
|
|
1300
|
+
readonly value: DocFileIndexContentGenerics<T>;
|
|
1298
1301
|
private readonly customSchema;
|
|
1299
1302
|
private readonly config;
|
|
1300
|
-
constructor(value:
|
|
1303
|
+
constructor(value: DocFileIndexContentGenerics<T>, customSchema: T, config: DocClientConfig);
|
|
1301
1304
|
/**
|
|
1302
1305
|
* Content body (does not include frontMatter)
|
|
1303
1306
|
*/
|
|
@@ -1325,7 +1328,7 @@ declare class DocFileIndexContentValue<T extends DocCustomSchema> {
|
|
|
1325
1328
|
/**
|
|
1326
1329
|
* Generate from Markdown text
|
|
1327
1330
|
*/
|
|
1328
|
-
static fromMarkdown<T extends
|
|
1331
|
+
static fromMarkdown<T extends DocCustomSchemaGenerics>(markdown: string, customSchema: T, config: DocClientConfig): DocFileIndexContentValue<T>;
|
|
1329
1332
|
/**
|
|
1330
1333
|
* Generate complete Markdown text
|
|
1331
1334
|
*/
|
|
@@ -1337,11 +1340,11 @@ declare class DocFileIndexContentValue<T extends DocCustomSchema> {
|
|
|
1337
1340
|
/**
|
|
1338
1341
|
* Update FrontMatter
|
|
1339
1342
|
*/
|
|
1340
|
-
withMeta(meta:
|
|
1343
|
+
withMeta(meta: DocFileIndexMetaGenerics<T>): DocFileIndexContentValue<T>;
|
|
1341
1344
|
/**
|
|
1342
1345
|
* Generate default index.md content
|
|
1343
1346
|
*/
|
|
1344
|
-
static empty<T extends
|
|
1347
|
+
static empty<T extends DocCustomSchemaGenerics = DocCustomSchemaGenerics>(directoryName: string, customSchema: T, config: DocClientConfig): DocFileIndexContentValue<T>;
|
|
1345
1348
|
/**
|
|
1346
1349
|
* Generate complete text combining FrontMatter and body
|
|
1347
1350
|
*/
|
|
@@ -1349,17 +1352,17 @@ declare class DocFileIndexContentValue<T extends DocCustomSchema> {
|
|
|
1349
1352
|
/**
|
|
1350
1353
|
* Output in JSON format
|
|
1351
1354
|
*/
|
|
1352
|
-
toJson():
|
|
1355
|
+
toJson(): DocFileIndexContentGenerics<T>;
|
|
1353
1356
|
}
|
|
1354
1357
|
|
|
1355
1358
|
/**
|
|
1356
1359
|
* Document directory entity
|
|
1357
1360
|
*/
|
|
1358
|
-
declare class DocFileIndexEntity<T extends
|
|
1359
|
-
readonly value:
|
|
1361
|
+
declare class DocFileIndexEntity<T extends DocCustomSchemaGenerics> {
|
|
1362
|
+
readonly value: DocFileIndexGenerics<T>;
|
|
1360
1363
|
private readonly customSchema;
|
|
1361
1364
|
private readonly config;
|
|
1362
|
-
constructor(value:
|
|
1365
|
+
constructor(value: DocFileIndexGenerics<T>, customSchema: T, config?: DocClientConfig);
|
|
1363
1366
|
/**
|
|
1364
1367
|
* Content
|
|
1365
1368
|
*/
|
|
@@ -1382,7 +1385,7 @@ declare class DocFileIndexEntity<T extends DocCustomSchema> {
|
|
|
1382
1385
|
toJson(): z.infer<typeof zDocFileIndex>;
|
|
1383
1386
|
}
|
|
1384
1387
|
|
|
1385
|
-
type Props$5<T extends
|
|
1388
|
+
type Props$5<T extends DocCustomSchemaGenerics> = {
|
|
1386
1389
|
customSchema: T;
|
|
1387
1390
|
path: string;
|
|
1388
1391
|
fileSystem: DocFileSystem;
|
|
@@ -1392,7 +1395,7 @@ type Props$5<T extends DocCustomSchema> = {
|
|
|
1392
1395
|
/**
|
|
1393
1396
|
* File reference class
|
|
1394
1397
|
*/
|
|
1395
|
-
declare class DocFileIndexReference<T extends
|
|
1398
|
+
declare class DocFileIndexReference<T extends DocCustomSchemaGenerics> {
|
|
1396
1399
|
private readonly props;
|
|
1397
1400
|
private readonly pathSystem;
|
|
1398
1401
|
private readonly customSchema;
|
|
@@ -1403,7 +1406,7 @@ declare class DocFileIndexReference<T extends DocCustomSchema> {
|
|
|
1403
1406
|
get fileFullPath(): string;
|
|
1404
1407
|
get durectoryPath(): string;
|
|
1405
1408
|
read(): Promise<DocFileIndexEntity<T> | Error>;
|
|
1406
|
-
readSchemaValue(): Promise<
|
|
1409
|
+
readSchemaValue(): Promise<DocFileIndexSchemaGenerics<RecordKey>>;
|
|
1407
1410
|
/**
|
|
1408
1411
|
* Read file content
|
|
1409
1412
|
*/
|
|
@@ -1456,12 +1459,12 @@ declare class DocFileIndexReference<T extends DocCustomSchema> {
|
|
|
1456
1459
|
restore(archiveDirectoryName?: string): Promise<DocFileIndexReference<T>>;
|
|
1457
1460
|
}
|
|
1458
1461
|
|
|
1459
|
-
type DocFileDirectoryReference<T extends
|
|
1462
|
+
type DocFileDirectoryReference<T extends DocCustomSchemaGenerics> = DocFileMdReference<T> | DocFileUnknownReference;
|
|
1460
1463
|
|
|
1461
|
-
type DocFileEntity<T extends
|
|
1462
|
-
type DocFileDirectoryEntity<T extends
|
|
1464
|
+
type DocFileEntity<T extends DocCustomSchemaGenerics> = DocFileMdEntity<T> | DocFileIndexEntity<T> | DocFileUnknownEntity;
|
|
1465
|
+
type DocFileDirectoryEntity<T extends DocCustomSchemaGenerics> = DocFileMdEntity<T> | DocFileUnknownEntity;
|
|
1463
1466
|
|
|
1464
|
-
type Props$4<T extends
|
|
1467
|
+
type Props$4<T extends DocCustomSchemaGenerics> = {
|
|
1465
1468
|
customSchema: T;
|
|
1466
1469
|
path: string;
|
|
1467
1470
|
indexFileName: string;
|
|
@@ -1473,7 +1476,7 @@ type Props$4<T extends DocCustomSchema> = {
|
|
|
1473
1476
|
/**
|
|
1474
1477
|
* Directory reference
|
|
1475
1478
|
*/
|
|
1476
|
-
declare class DocDirectoryReference<T extends
|
|
1479
|
+
declare class DocDirectoryReference<T extends DocCustomSchemaGenerics> {
|
|
1477
1480
|
private readonly props;
|
|
1478
1481
|
private readonly pathSystem;
|
|
1479
1482
|
private readonly customSchema;
|
|
@@ -1509,7 +1512,7 @@ declare class DocDirectoryReference<T extends DocCustomSchema> {
|
|
|
1509
1512
|
* Get single subdirectory reference
|
|
1510
1513
|
*/
|
|
1511
1514
|
directory(directoryName: string): DocDirectoryReference<T>;
|
|
1512
|
-
directory<S extends
|
|
1515
|
+
directory<S extends DocCustomSchemaGenerics>(directoryName: string, customSchema: S): DocDirectoryReference<S>;
|
|
1513
1516
|
indexFile(): DocFileIndexReference<T>;
|
|
1514
1517
|
readIndexFile(): Promise<DocFileIndexEntity<T> | Error>;
|
|
1515
1518
|
writeFile(entity: DocFileIndexEntity<T> | DocFileMdEntity<T> | DocFileUnknownEntity): Promise<Error | null>;
|
|
@@ -1698,14 +1701,14 @@ declare class DocClient {
|
|
|
1698
1701
|
readonly config: DocClientConfig;
|
|
1699
1702
|
constructor(props: Props);
|
|
1700
1703
|
basePath(): string;
|
|
1701
|
-
file<Path extends string>(relativePath: Path): InferReference<Path,
|
|
1702
|
-
file<Path extends string, T extends
|
|
1703
|
-
mdFile(relativePath: string): DocFileMdReference<
|
|
1704
|
-
mdFile<T extends
|
|
1705
|
-
indexFile(relativePath: string): DocFileIndexReference<
|
|
1706
|
-
indexFile<T extends
|
|
1707
|
-
directory(relativePath: string): DocDirectoryReference<
|
|
1708
|
-
directory<T extends
|
|
1704
|
+
file<Path extends string>(relativePath: Path): InferReference<Path, DocCustomSchemaGenerics>;
|
|
1705
|
+
file<Path extends string, T extends DocCustomSchemaGenerics>(relativePath: Path, customSchema: T): InferReference<Path, T>;
|
|
1706
|
+
mdFile(relativePath: string): DocFileMdReference<DocCustomSchemaGenerics>;
|
|
1707
|
+
mdFile<T extends DocCustomSchemaGenerics>(relativePath: string, customSchema: T): DocFileMdReference<T>;
|
|
1708
|
+
indexFile(relativePath: string): DocFileIndexReference<DocCustomSchemaGenerics>;
|
|
1709
|
+
indexFile<T extends DocCustomSchemaGenerics>(relativePath: string, customSchema: T): DocFileIndexReference<T>;
|
|
1710
|
+
directory(relativePath: string): DocDirectoryReference<DocCustomSchemaGenerics>;
|
|
1711
|
+
directory<T extends DocCustomSchemaGenerics>(relativePath: string, customSchema: T): DocDirectoryReference<T>;
|
|
1709
1712
|
fileTree(directoryPath?: string): Promise<DocTreeNode[]>;
|
|
1710
1713
|
directoryTree(directoryPath?: string): Promise<DocTreeDirectoryNode[]>;
|
|
1711
1714
|
}
|
|
@@ -1831,7 +1834,7 @@ declare class DocPathSystemMock extends DocPathSystem {
|
|
|
1831
1834
|
* .selectText("priority", false)
|
|
1832
1835
|
* .build()
|
|
1833
1836
|
*/
|
|
1834
|
-
declare class DocSchemaBuilder<T extends
|
|
1837
|
+
declare class DocSchemaBuilder<T extends DocCustomSchemaGenerics> {
|
|
1835
1838
|
private schema;
|
|
1836
1839
|
constructor(schema?: T);
|
|
1837
1840
|
text<K extends string>(key: K, required: boolean): DocSchemaBuilder<T & Record<K, {
|
|
@@ -1914,7 +1917,7 @@ declare const defaultTestConfig: {
|
|
|
1914
1917
|
*
|
|
1915
1918
|
* type MyDoc = InferDocFileMd<typeof mySchema>
|
|
1916
1919
|
*/
|
|
1917
|
-
declare function defineSchema<T extends
|
|
1920
|
+
declare function defineSchema<T extends DocCustomSchemaGenerics>(schema: T): T;
|
|
1918
1921
|
/**
|
|
1919
1922
|
* Helper functions for field definitions
|
|
1920
1923
|
* Use when finer control is needed
|
|
@@ -2159,4 +2162,4 @@ declare class DocRelationFieldValue {
|
|
|
2159
2162
|
}): DocRelationFieldValue;
|
|
2160
2163
|
}
|
|
2161
2164
|
|
|
2162
|
-
export { type BaseFieldValueType, type DetectFileType, DocClient, type DocClientConfig, type
|
|
2165
|
+
export { type BaseFieldValueType, type DetectFileType, DocClient, type DocClientConfig, 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 DocCustomSchemaGenerics, type DocDirectoryFileGenerics, type DocDirectoryGenerics, DocDirectoryPathValue, DocDirectoryReference, type DocFieldTypeLiteral, type DocFile, type DocFileEntity, type DocFileGenerics, type DocFileIndex, type DocFileIndexContentGenerics, DocFileIndexContentValue, DocFileIndexEntity, type DocFileIndexGenerics, type DocFileIndexMetaGenerics, DocFileIndexMetaValue, DocFileIndexReference, type DocFileIndexSchemaField, type DocFileIndexSchemaGenerics, DocFileIndexSchemaValue, type DocFileMd, type DocFileMdContentGenerics, DocFileMdContentValue, DocFileMdEntity, type DocFileMdGenerics, 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, zDocFileIndex, zDocFileIndexSchemaField, zDocFileMd, 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 };
|