@interactive-inc/docs-client 0.0.8 → 0.0.10
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/PRODUCT.md +108 -0
- package/build/index.d.ts +110 -31
- package/build/index.js +886 -586
- package/build/models.d.ts +18 -2
- package/build/models.js +8 -1
- package/package.json +2 -2
package/PRODUCT.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# docs-client
|
|
2
|
+
|
|
3
|
+
ドキュメント管理システムのクライアントライブラリ。Markdownファイルを構造化された形式で管理し、フロントマターによるメタデータ管理、スキーマベースのバリデーション、ファイル間のリレーション機能を提供するゆ🥹
|
|
4
|
+
|
|
5
|
+
## 主要機能
|
|
6
|
+
|
|
7
|
+
### ドキュメント管理
|
|
8
|
+
|
|
9
|
+
- Markdownファイルの読み書き
|
|
10
|
+
- フロントマター(YAML形式)の解析と生成
|
|
11
|
+
- ファイルのアーカイブと復元
|
|
12
|
+
- 階層的なディレクトリ構造の管理
|
|
13
|
+
|
|
14
|
+
### スキーマシステム
|
|
15
|
+
|
|
16
|
+
- index.mdファイルでのスキーマ定義
|
|
17
|
+
- Zodを使用した型安全なスキーマバリデーション
|
|
18
|
+
- デフォルト値の自動適用
|
|
19
|
+
- 動的なスキーマ生成(Zodスキーマ未定義時)
|
|
20
|
+
|
|
21
|
+
### リレーション機能
|
|
22
|
+
|
|
23
|
+
- ファイル間の参照関係を定義
|
|
24
|
+
- 単一リレーション(relation)と複数リレーション(multi-relation)
|
|
25
|
+
- スキーマベースの型安全な参照
|
|
26
|
+
|
|
27
|
+
### ファイルツリー
|
|
28
|
+
|
|
29
|
+
- ディレクトリ構造の再帰的探索
|
|
30
|
+
- ファイルツリーとディレクトリツリーの生成
|
|
31
|
+
- アーカイブディレクトリの特別扱い
|
|
32
|
+
|
|
33
|
+
## アーキテクチャ
|
|
34
|
+
|
|
35
|
+
### エンティティ(entities/)
|
|
36
|
+
|
|
37
|
+
- **DocFileMdEntity** - Markdownファイルの表現
|
|
38
|
+
- **DocDirectoryEntity** - ディレクトリの表現
|
|
39
|
+
- **DocTreeFileNode/DocTreeDirectoryNode** - ツリー構造のノード
|
|
40
|
+
|
|
41
|
+
### 値オブジェクト(values/)
|
|
42
|
+
|
|
43
|
+
- **DocFileContentMdValue** - Markdownコンテンツ(フロントマター + 本文)
|
|
44
|
+
- **DocFrontMatterIndexValue** - index.mdのフロントマター
|
|
45
|
+
- **DocFrontMatterMdValue** - 通常のMarkdownファイルのフロントマター
|
|
46
|
+
- **DocSchemaValue** - スキーマ定義と検証機能
|
|
47
|
+
- **DocSchemaFieldValue** - スキーマフィールドの定義
|
|
48
|
+
- **DocSchemaBuilder** - 動的スキーマ生成
|
|
49
|
+
|
|
50
|
+
### リファレンス(references/)
|
|
51
|
+
|
|
52
|
+
- **DocFileIndexReference** - index.mdファイルの参照
|
|
53
|
+
- **DocFileMdReference** - Markdownファイルの参照
|
|
54
|
+
- **DocDirectoryReference** - ディレクトリの参照
|
|
55
|
+
|
|
56
|
+
### システム
|
|
57
|
+
|
|
58
|
+
- **DocFileTreeSystem** - ファイルツリーの構築
|
|
59
|
+
- **DocClient** - クライアントAPI
|
|
60
|
+
- **DocEngine** - ドキュメント処理エンジンのクライアント側統合
|
|
61
|
+
|
|
62
|
+
## 使用例
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
// クライアントの初期化
|
|
66
|
+
const client = new DocClient(cwd)
|
|
67
|
+
|
|
68
|
+
// Markdownファイルの読み込み
|
|
69
|
+
const fileRef = client.mdFile("products/example.md")
|
|
70
|
+
const entity = await fileRef.read()
|
|
71
|
+
|
|
72
|
+
// スキーマの取得と検証
|
|
73
|
+
const indexRef = client.indexFile("products")
|
|
74
|
+
const indexEntity = await indexRef.read()
|
|
75
|
+
const schema = indexEntity.content.frontMatter.schema()
|
|
76
|
+
|
|
77
|
+
// リレーションの取得
|
|
78
|
+
const categoryRef = await fileRef.relation("category")
|
|
79
|
+
|
|
80
|
+
// ファイルツリーの構築
|
|
81
|
+
const fileTree = await client.fileTree("products")
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## 特徴
|
|
85
|
+
|
|
86
|
+
### 型安全性
|
|
87
|
+
|
|
88
|
+
- TypeScriptのジェネリクスを活用
|
|
89
|
+
- Zodスキーマによる実行時検証
|
|
90
|
+
- 型推論による開発体験の向上
|
|
91
|
+
|
|
92
|
+
### 不変性
|
|
93
|
+
|
|
94
|
+
- すべての値オブジェクトは不変
|
|
95
|
+
- Object.freeze()による状態の固定
|
|
96
|
+
- Fluent APIによる操作
|
|
97
|
+
|
|
98
|
+
### 拡張性
|
|
99
|
+
|
|
100
|
+
- 依存性注入(DI)パターン
|
|
101
|
+
- 明確な責任分離
|
|
102
|
+
- カスタムスキーマフィールドの追加が容易
|
|
103
|
+
|
|
104
|
+
## 依存関係
|
|
105
|
+
|
|
106
|
+
- **@packages/server** - サーバー側のドキュメント処理エンジン
|
|
107
|
+
- **zod** - スキーマ定義とバリデーション
|
|
108
|
+
- **TypeScript** - 型安全性の保証
|
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { z } from 'zod
|
|
2
|
-
import { zDocFileMd, zDocFileContentMd, zDocFileMdFrontMatter, zDocSchema, zDocSchemaFieldText, zDocSchemaField, zDocSchemaFieldMultiText, zDocSchemaFieldNumber, zDocSchemaFieldMultiNumber, zDocSchemaFieldBoolean, zDocSchemaFieldMultiBoolean, zDocSchemaFieldSelectText, zDocSchemaFieldMultiSelectText, zDocSchemaFieldSelectNumber, zDocSchemaFieldMultiSelectNumber, zDocSchemaFieldRelation, zDocSchemaFieldMultiRelation, zDocRelationFile, zDocFilePath, zDocFileUnknown, zDocFileIndex, zDocFileContentIndex, zDocFileIndexFrontMatter, zDocRelation, zDocSchemaFieldType, zDocFile, zDocRelationField } from './models.js';
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { zDocFileMd, zDocFileContentMd, zDocFileMdFrontMatter, zDocSchema, zDocSchemaFieldText, zDocSchemaField, zDocSchemaFieldMultiText, zDocSchemaFieldNumber, zDocSchemaFieldMultiNumber, zDocSchemaFieldBoolean, zDocSchemaFieldMultiBoolean, zDocSchemaFieldSelectText, zDocSchemaFieldMultiSelectText, zDocSchemaFieldSelectNumber, zDocSchemaFieldMultiSelectNumber, zDocSchemaFieldRelation, zDocSchemaFieldMultiRelation, zDocRelationFile, zDocFilePath, zDocFileUnknown, zDocFileIndex, zDocFileContentIndex, zDocFileIndexFrontMatter, zDocRelation, zDocSchemaFieldType, zDocSchemaFieldMinimal, zDocSchemaMinimal, zDocFile, zDocRelationField } from './models.js';
|
|
3
3
|
export { zDocTreeDirectoryNode, zDocTreeFileNode, zDocTreeNode } from './models.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -143,6 +143,13 @@ declare class DocFileSystem {
|
|
|
143
143
|
getFileCreatedTime(relativePath: string): Promise<Date>;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
/**
|
|
147
|
+
* FrontMatterのスキーマ型
|
|
148
|
+
* - ZodRecord: 動的なキーを持つ場合(デフォルト)
|
|
149
|
+
* - ZodObject: 固定されたキーを持つ場合(型安全)
|
|
150
|
+
*/
|
|
151
|
+
type FrontMatterSchema = z.ZodTypeAny;
|
|
152
|
+
|
|
146
153
|
/**
|
|
147
154
|
* スキーマフィールドで使用可能な型
|
|
148
155
|
*/
|
|
@@ -208,6 +215,14 @@ type DocSchemaField = z.infer<typeof zDocSchemaField>;
|
|
|
208
215
|
* スキーマ定義の型
|
|
209
216
|
*/
|
|
210
217
|
type DocSchemaRecord = z.infer<typeof zDocSchema>;
|
|
218
|
+
/**
|
|
219
|
+
* 最小限のスキーマフィールドの型
|
|
220
|
+
*/
|
|
221
|
+
type DocSchemaFieldMinimal = z.infer<typeof zDocSchemaFieldMinimal>;
|
|
222
|
+
/**
|
|
223
|
+
* 最小限のスキーマ定義の型
|
|
224
|
+
*/
|
|
225
|
+
type DocSchemaMinimal = z.infer<typeof zDocSchemaMinimal>;
|
|
211
226
|
/**
|
|
212
227
|
* リレーション型フィールドのUnion型
|
|
213
228
|
*/
|
|
@@ -408,6 +423,20 @@ declare class DocFileRelationReference {
|
|
|
408
423
|
isEmpty(): Promise<boolean>;
|
|
409
424
|
}
|
|
410
425
|
|
|
426
|
+
/**
|
|
427
|
+
* 動的にZodスキーマを生成するビルダー
|
|
428
|
+
*/
|
|
429
|
+
declare class DocSchemaBuilder {
|
|
430
|
+
/**
|
|
431
|
+
* 動的にZodスキーマを生成
|
|
432
|
+
*/
|
|
433
|
+
createDynamicSchema(value: unknown): z.ZodTypeAny;
|
|
434
|
+
/**
|
|
435
|
+
* フィールドタイプに応じたZodスキーマを生成
|
|
436
|
+
*/
|
|
437
|
+
private createFieldSchema;
|
|
438
|
+
}
|
|
439
|
+
|
|
411
440
|
/**
|
|
412
441
|
* リレーション複数型スキーマフィールド
|
|
413
442
|
*/
|
|
@@ -708,25 +737,34 @@ type DocSchemaFieldRelationTypes = DocSchemaFieldRelationSingleValue | DocSchema
|
|
|
708
737
|
type DocSchemaFieldValue = DocSchemaFieldTextTypes | DocSchemaFieldNumberTypes | DocSchemaFieldBooleanTypes | DocSchemaFieldSelectTypes | DocSchemaFieldRelationTypes;
|
|
709
738
|
|
|
710
739
|
/**
|
|
711
|
-
*
|
|
740
|
+
* 型安全なスキーマ値オブジェクト
|
|
741
|
+
* @template T - Zodスキーマの型(オプショナル)
|
|
712
742
|
*/
|
|
713
|
-
declare class DocSchemaValue {
|
|
743
|
+
declare class DocSchemaValue<T extends z.ZodTypeAny = z.ZodTypeAny> {
|
|
714
744
|
readonly value: DocSchemaRecord;
|
|
715
|
-
|
|
745
|
+
private readonly zodSchema;
|
|
746
|
+
constructor(value: unknown, zodSchema?: T, schemaBuilder?: DocSchemaBuilder);
|
|
716
747
|
/**
|
|
717
748
|
* フィールド名の一覧を取得
|
|
749
|
+
* Zodスキーマを使用している場合は自動的に型安全
|
|
718
750
|
*/
|
|
719
751
|
get fieldNames(): string[];
|
|
720
752
|
/**
|
|
721
753
|
* 指定されたフィールド名のフィールドを取得
|
|
754
|
+
* Zodスキーマを使用している場合は型安全
|
|
722
755
|
*/
|
|
756
|
+
field<K extends keyof z.infer<T> & string>(name: K): DocSchemaFieldValue | null;
|
|
723
757
|
field(name: string): DocSchemaFieldValue | null;
|
|
758
|
+
/**
|
|
759
|
+
* すべてのフィールドを取得
|
|
760
|
+
* 注意: 型安全性のため、個別にfield()メソッドを使用することを推奨
|
|
761
|
+
*/
|
|
724
762
|
get fields(): DocSchemaFieldValue[];
|
|
725
763
|
get relationFields(): (DocSchemaFieldRelationSingleValue | DocSchemaFieldRelationMultipleValue)[];
|
|
726
764
|
/**
|
|
727
765
|
* 空のスキーマエンティティを作成
|
|
728
766
|
*/
|
|
729
|
-
static empty(): DocSchemaValue
|
|
767
|
+
static empty<T extends z.ZodTypeAny = z.ZodTypeAny>(zodSchema?: T, dynamicBuilder?: DocSchemaBuilder): DocSchemaValue<T>;
|
|
730
768
|
/**
|
|
731
769
|
* スキーマからリレーションパスを抽出
|
|
732
770
|
*/
|
|
@@ -783,6 +821,10 @@ declare class DocSchemaValue {
|
|
|
783
821
|
* スキーマベースでFrontMatterを補完する
|
|
784
822
|
*/
|
|
785
823
|
getCompleteFrontMatter(rawFrontMatter: unknown): DocFileMdFrontMatter;
|
|
824
|
+
/**
|
|
825
|
+
* 型安全にFrontMatterを補完する(Zodスキーマを使用している場合)
|
|
826
|
+
*/
|
|
827
|
+
getTypedCompleteFrontMatter(rawFrontMatter: Partial<z.infer<T>>): z.infer<T>;
|
|
786
828
|
/**
|
|
787
829
|
* スキーマからデフォルトFrontMatterを生成
|
|
788
830
|
*/
|
|
@@ -800,6 +842,10 @@ declare class DocSchemaValue {
|
|
|
800
842
|
*/
|
|
801
843
|
private isNullOrUndefined;
|
|
802
844
|
toJson(): DocSchemaRecord;
|
|
845
|
+
/**
|
|
846
|
+
* スキーマを正規化(エラーを出すように変更)
|
|
847
|
+
*/
|
|
848
|
+
private static normalizeSchema;
|
|
803
849
|
}
|
|
804
850
|
|
|
805
851
|
/**
|
|
@@ -811,11 +857,11 @@ declare class DocFrontMatterIndexValue {
|
|
|
811
857
|
/**
|
|
812
858
|
* アイコンを取得
|
|
813
859
|
*/
|
|
814
|
-
|
|
860
|
+
icon(): string;
|
|
815
861
|
/**
|
|
816
862
|
* スキーマを取得
|
|
817
863
|
*/
|
|
818
|
-
|
|
864
|
+
schema<T extends z.ZodTypeAny = z.ZodTypeAny>(zodSchema?: T): DocSchemaValue<T>;
|
|
819
865
|
/**
|
|
820
866
|
* iconフィールドを更新
|
|
821
867
|
*/
|
|
@@ -1023,23 +1069,25 @@ declare class DocFileIndexReference {
|
|
|
1023
1069
|
/**
|
|
1024
1070
|
* FrontMatter
|
|
1025
1071
|
*/
|
|
1026
|
-
declare class DocFrontMatterMdValue {
|
|
1072
|
+
declare class DocFrontMatterMdValue<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter> {
|
|
1073
|
+
private readonly zodSchema;
|
|
1074
|
+
constructor(value: DocFileMdFrontMatter, zodSchema: T);
|
|
1027
1075
|
readonly value: DocFileMdFrontMatter;
|
|
1028
|
-
constructor(value: DocFileMdFrontMatter);
|
|
1029
1076
|
toJson(): DocFileMdFrontMatter;
|
|
1030
1077
|
toYaml(): string;
|
|
1078
|
+
schema<U extends z.ZodTypeAny = z.ZodTypeAny>(zodSchema?: U): DocSchemaValue<U>;
|
|
1031
1079
|
/**
|
|
1032
1080
|
* Markdownテキストから生成
|
|
1033
1081
|
*/
|
|
1034
|
-
static from(markdownText: string): DocFrontMatterMdValue
|
|
1082
|
+
static from<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(markdownText: string, zodSchema: T): DocFrontMatterMdValue<T>;
|
|
1035
1083
|
/**
|
|
1036
1084
|
* 空のFrontMatterを生成
|
|
1037
1085
|
*/
|
|
1038
|
-
static empty(): DocFrontMatterMdValue
|
|
1086
|
+
static empty<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(zodSchema: T): DocFrontMatterMdValue<T>;
|
|
1039
1087
|
/**
|
|
1040
1088
|
* データから直接生成
|
|
1041
1089
|
*/
|
|
1042
|
-
static fromData(data: unknown): DocFrontMatterMdValue
|
|
1090
|
+
static fromData<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(data: unknown, zodSchema: T): DocFrontMatterMdValue<T>;
|
|
1043
1091
|
/**
|
|
1044
1092
|
* スキーマフィールドに基づいてデフォルト値を生成する
|
|
1045
1093
|
*/
|
|
@@ -1049,13 +1097,8 @@ declare class DocFrontMatterMdValue {
|
|
|
1049
1097
|
}): unknown;
|
|
1050
1098
|
/**
|
|
1051
1099
|
* 単一のプロパティを更新した新しいインスタンスを返す
|
|
1052
|
-
* スキーマに基づいて型を検証し、スキーマのフィールドのみを含む新しいインスタンスを生成
|
|
1053
1100
|
*/
|
|
1054
|
-
withProperty(key: string, value: unknown
|
|
1055
|
-
/**
|
|
1056
|
-
* フィールド値の検証
|
|
1057
|
-
*/
|
|
1058
|
-
private validateFieldValue;
|
|
1101
|
+
withProperty(key: string, value: unknown): DocFrontMatterMdValue<T>;
|
|
1059
1102
|
/**
|
|
1060
1103
|
* テキスト型のプロパティを取得
|
|
1061
1104
|
*/
|
|
@@ -1096,14 +1139,24 @@ declare class DocFrontMatterMdValue {
|
|
|
1096
1139
|
* すべてのキーを取得
|
|
1097
1140
|
*/
|
|
1098
1141
|
get keys(): string[];
|
|
1142
|
+
/**
|
|
1143
|
+
* フィールドアクセス(Zodスキーマで型安全)
|
|
1144
|
+
*/
|
|
1145
|
+
field<K extends keyof z.infer<T> & string>(key: K): T extends z.ZodTypeAny ? z.infer<T>[K] | null : unknown;
|
|
1146
|
+
field(key: string): unknown;
|
|
1147
|
+
/**
|
|
1148
|
+
* 型安全な値の取得
|
|
1149
|
+
*/
|
|
1150
|
+
get typedValue(): z.infer<T> | null;
|
|
1099
1151
|
}
|
|
1100
1152
|
|
|
1101
1153
|
/**
|
|
1102
1154
|
* Markdownコンテンツ情報の値オブジェクト
|
|
1103
1155
|
*/
|
|
1104
|
-
declare class DocFileContentMdValue {
|
|
1156
|
+
declare class DocFileContentMdValue<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter> {
|
|
1105
1157
|
readonly value: DocFileContentMd;
|
|
1106
|
-
|
|
1158
|
+
private readonly zodSchema;
|
|
1159
|
+
constructor(value: DocFileContentMd, zodSchema: T);
|
|
1107
1160
|
/**
|
|
1108
1161
|
* コンテンツ本文(frontMatterを含まない)
|
|
1109
1162
|
*/
|
|
@@ -1117,29 +1170,33 @@ declare class DocFileContentMdValue {
|
|
|
1117
1170
|
*/
|
|
1118
1171
|
get description(): string;
|
|
1119
1172
|
/**
|
|
1120
|
-
* FrontMatter
|
|
1173
|
+
* FrontMatter(コンストラクタのZodスキーマまたは引数のスキーマを使用)
|
|
1121
1174
|
*/
|
|
1122
|
-
|
|
1175
|
+
frontMatter<U extends FrontMatterSchema = T>(zodSchema?: U): DocFrontMatterMdValue<U extends FrontMatterSchema ? U : T>;
|
|
1123
1176
|
/**
|
|
1124
1177
|
* タイトルを更新
|
|
1125
1178
|
*/
|
|
1126
|
-
withTitle(title: string): DocFileContentMdValue
|
|
1179
|
+
withTitle(title: string): DocFileContentMdValue<T>;
|
|
1127
1180
|
/**
|
|
1128
1181
|
* 説明を更新
|
|
1129
1182
|
*/
|
|
1130
|
-
withDescription(description: string, defaultTitle?: string): DocFileContentMdValue
|
|
1183
|
+
withDescription(description: string, defaultTitle?: string): DocFileContentMdValue<T>;
|
|
1131
1184
|
/**
|
|
1132
1185
|
* コンテンツを更新
|
|
1133
1186
|
*/
|
|
1134
|
-
withContent(content: string): DocFileContentMdValue
|
|
1187
|
+
withContent(content: string): DocFileContentMdValue<T>;
|
|
1135
1188
|
/**
|
|
1136
1189
|
* FrontMatterを更新
|
|
1137
1190
|
*/
|
|
1138
|
-
withFrontMatter(frontMatter: DocFrontMatterMdValue): DocFileContentMdValue
|
|
1191
|
+
withFrontMatter<U extends FrontMatterSchema>(frontMatter: DocFrontMatterMdValue<U>, zodSchema: U): DocFileContentMdValue<U>;
|
|
1192
|
+
/**
|
|
1193
|
+
* FrontMatterの特定のプロパティを更新
|
|
1194
|
+
*/
|
|
1195
|
+
withFrontMatterProperty(key: string, value: unknown): DocFileContentMdValue<T>;
|
|
1139
1196
|
/**
|
|
1140
1197
|
* Markdownテキストから生成
|
|
1141
1198
|
*/
|
|
1142
|
-
static fromMarkdown(markdown: string): DocFileContentMdValue
|
|
1199
|
+
static fromMarkdown<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(markdown: string, zodSchema?: T): DocFileContentMdValue<T>;
|
|
1143
1200
|
/**
|
|
1144
1201
|
* 完全なMarkdownテキストを生成
|
|
1145
1202
|
*/
|
|
@@ -1151,7 +1208,7 @@ declare class DocFileContentMdValue {
|
|
|
1151
1208
|
/**
|
|
1152
1209
|
* 空のコンテンツを生成
|
|
1153
1210
|
*/
|
|
1154
|
-
static empty(title: string): DocFileContentMdValue
|
|
1211
|
+
static empty<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(title: string, zodSchema: T): DocFileContentMdValue<T>;
|
|
1155
1212
|
/**
|
|
1156
1213
|
* JSON形式で出力
|
|
1157
1214
|
*/
|
|
@@ -1267,7 +1324,7 @@ declare class DocFileMdReference {
|
|
|
1267
1324
|
/**
|
|
1268
1325
|
* 同じディレクトリのindex.mdを取得する
|
|
1269
1326
|
*/
|
|
1270
|
-
getDirectoryIndex(): Promise<
|
|
1327
|
+
getDirectoryIndex(): Promise<DocFileIndexReference | null>;
|
|
1271
1328
|
/**
|
|
1272
1329
|
* 複数のリレーションを取得する
|
|
1273
1330
|
*/
|
|
@@ -1276,6 +1333,14 @@ declare class DocFileMdReference {
|
|
|
1276
1333
|
* スキーマに基づいて複数のリレーションを取得する
|
|
1277
1334
|
*/
|
|
1278
1335
|
multiRelation(key: string): Promise<DocFileMdReference[]>;
|
|
1336
|
+
/**
|
|
1337
|
+
* FrontMatterを型安全に読み込む
|
|
1338
|
+
*/
|
|
1339
|
+
readFrontMatter<T extends z.ZodTypeAny = z.ZodTypeAny>(zodSchema?: T): Promise<DocFrontMatterMdValue<T> | Error>;
|
|
1340
|
+
/**
|
|
1341
|
+
* FrontMatterを型安全に更新
|
|
1342
|
+
*/
|
|
1343
|
+
updateFrontMatter<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(key: string, value: unknown, zodSchema?: T): Promise<undefined | Error>;
|
|
1279
1344
|
}
|
|
1280
1345
|
|
|
1281
1346
|
/**
|
|
@@ -1404,10 +1469,24 @@ declare class DocDirectoryReference {
|
|
|
1404
1469
|
mdFilesGenerator(): AsyncGenerator<DocFileMdReference, void, unknown>;
|
|
1405
1470
|
files(): Promise<(DocFileMdReference | DocFileUnknownReference)[]>;
|
|
1406
1471
|
mdFiles(): Promise<DocFileMdReference[]>;
|
|
1472
|
+
/**
|
|
1473
|
+
* Markdownファイルの参照とFrontMatterを型安全に取得
|
|
1474
|
+
*/
|
|
1475
|
+
mdFilesWithFrontMatter<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(zodSchema: T): Promise<{
|
|
1476
|
+
reference: DocFileMdReference;
|
|
1477
|
+
frontMatter: DocFrontMatterMdValue<T> | Error;
|
|
1478
|
+
}[]>;
|
|
1407
1479
|
file(fileName: string): DocFileMdReference | DocFileUnknownReference;
|
|
1408
1480
|
mdFile(fileName: string): DocFileMdReference;
|
|
1409
1481
|
readFiles(): Promise<(DocFileMdEntity | DocFileUnknownEntity)[]>;
|
|
1410
1482
|
readMdFiles(): Promise<DocFileMdEntity[]>;
|
|
1483
|
+
/**
|
|
1484
|
+
* Zodスキーマを使って型安全にMarkdownファイルのFrontMatterを読み込む
|
|
1485
|
+
*/
|
|
1486
|
+
readMdFilesWithSchema<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(zodSchema: T): Promise<{
|
|
1487
|
+
entity: DocFileMdEntity;
|
|
1488
|
+
frontMatter: DocFrontMatterMdValue<T>;
|
|
1489
|
+
}[]>;
|
|
1411
1490
|
readUnknownFiles(): Promise<DocFileUnknownEntity[]>;
|
|
1412
1491
|
/**
|
|
1413
1492
|
* サブディレクトリ名の一覧を取得
|
|
@@ -1918,4 +1997,4 @@ declare class DocSchemaFieldFactory {
|
|
|
1918
1997
|
private getTypeSpecificDefaults;
|
|
1919
1998
|
}
|
|
1920
1999
|
|
|
1921
|
-
export { DocClient, DocContentMdValue, type DocDirectory, DocDirectoryPathValue, DocDirectoryReference, type DocFieldMultiBoolean, type DocFieldMultiNumber, type DocFieldMultiRelation, type DocFieldMultiText, type DocFile, type DocFileContentIndex, DocFileContentIndexValue, type DocFileContentMd, DocFileContentMdValue, type DocFileIndex, DocFileIndexEntity, type DocFileIndexFrontMatter, DocFileIndexReference, type DocFileMd, DocFileMdEntity, type DocFileMdFrontMatter, DocFileMdReference, type DocFileNode, type DocFilePath, DocFilePathValue, DocFileRelationReference, DocFileSystem, type DocFileUnknown, DocFileUnknownEntity, DocFileUnknownReference, DocFrontMatterIndexValue, DocFrontMatterMdValue, DocMarkdownSystem, DocPathSystem, type DocRelation, type DocRelationField, type DocRelationFile, DocRelationFileValue, DocRelationValue, type DocSchemaField, type DocSchemaFieldBoolean, DocSchemaFieldBooleanMultipleValue, DocSchemaFieldBooleanSingleValue, DocSchemaFieldFactory, type DocSchemaFieldMultiSelectNumber, type DocSchemaFieldMultiSelectText, type DocSchemaFieldNumber, DocSchemaFieldNumberMultipleValue, DocSchemaFieldNumberSingleValue, type DocSchemaFieldRelation, DocSchemaFieldRelationMultipleValue, DocSchemaFieldRelationSingleValue, type DocSchemaFieldSelectNumber, DocSchemaFieldSelectNumberMultipleValue, DocSchemaFieldSelectNumberSingleValue, type DocSchemaFieldSelectText, DocSchemaFieldSelectTextMultipleValue, DocSchemaFieldSelectTextSingleValue, type DocSchemaFieldText, DocSchemaFieldTextMultipleValue, DocSchemaFieldTextSingleValue, type DocSchemaFieldType, type DocSchemaFieldValue, type DocSchemaRecord, DocSchemaValue, type DocTreeDirectoryNode, DocTreeDirectoryNodeValue, type DocTreeFileNode, DocTreeFileNodeValue, type DocTreeNode, type FieldType, DocFileTreeSystem as FileTreeSystem, type RelationFieldTypes, zDocFile, zDocFileContentIndex, zDocFileContentMd, zDocFileIndex, zDocFileIndexFrontMatter, zDocFileMd, zDocFileMdFrontMatter, zDocFilePath, zDocFileUnknown, zDocRelation, zDocRelationField, zDocRelationFile, zDocSchema, zDocSchemaField, zDocSchemaFieldBoolean, zDocSchemaFieldMultiBoolean, zDocSchemaFieldMultiNumber, zDocSchemaFieldMultiRelation, zDocSchemaFieldMultiSelectNumber, zDocSchemaFieldMultiSelectText, zDocSchemaFieldMultiText, zDocSchemaFieldNumber, zDocSchemaFieldRelation, zDocSchemaFieldSelectNumber, zDocSchemaFieldSelectText, zDocSchemaFieldText, zDocSchemaFieldType };
|
|
2000
|
+
export { DocClient, DocContentMdValue, type DocDirectory, DocDirectoryPathValue, DocDirectoryReference, type DocFieldMultiBoolean, type DocFieldMultiNumber, type DocFieldMultiRelation, type DocFieldMultiText, type DocFile, type DocFileContentIndex, DocFileContentIndexValue, type DocFileContentMd, DocFileContentMdValue, type DocFileIndex, DocFileIndexEntity, type DocFileIndexFrontMatter, DocFileIndexReference, type DocFileMd, DocFileMdEntity, type DocFileMdFrontMatter, DocFileMdReference, type DocFileNode, type DocFilePath, DocFilePathValue, DocFileRelationReference, DocFileSystem, type DocFileUnknown, DocFileUnknownEntity, DocFileUnknownReference, DocFrontMatterIndexValue, DocFrontMatterMdValue, DocMarkdownSystem, DocPathSystem, type DocRelation, type DocRelationField, type DocRelationFile, DocRelationFileValue, DocRelationValue, type DocSchemaField, type DocSchemaFieldBoolean, DocSchemaFieldBooleanMultipleValue, DocSchemaFieldBooleanSingleValue, DocSchemaFieldFactory, type DocSchemaFieldMinimal, type DocSchemaFieldMultiSelectNumber, type DocSchemaFieldMultiSelectText, type DocSchemaFieldNumber, DocSchemaFieldNumberMultipleValue, DocSchemaFieldNumberSingleValue, type DocSchemaFieldRelation, DocSchemaFieldRelationMultipleValue, DocSchemaFieldRelationSingleValue, type DocSchemaFieldSelectNumber, DocSchemaFieldSelectNumberMultipleValue, DocSchemaFieldSelectNumberSingleValue, type DocSchemaFieldSelectText, DocSchemaFieldSelectTextMultipleValue, DocSchemaFieldSelectTextSingleValue, type DocSchemaFieldText, DocSchemaFieldTextMultipleValue, DocSchemaFieldTextSingleValue, type DocSchemaFieldType, type DocSchemaFieldValue, type DocSchemaMinimal, type DocSchemaRecord, DocSchemaValue, type DocTreeDirectoryNode, DocTreeDirectoryNodeValue, type DocTreeFileNode, DocTreeFileNodeValue, type DocTreeNode, type FieldType, DocFileTreeSystem as FileTreeSystem, type FrontMatterSchema, type RelationFieldTypes, zDocFile, zDocFileContentIndex, zDocFileContentMd, zDocFileIndex, zDocFileIndexFrontMatter, zDocFileMd, zDocFileMdFrontMatter, zDocFilePath, zDocFileUnknown, zDocRelation, zDocRelationField, zDocRelationFile, zDocSchema, zDocSchemaField, zDocSchemaFieldBoolean, zDocSchemaFieldMinimal, zDocSchemaFieldMultiBoolean, zDocSchemaFieldMultiNumber, zDocSchemaFieldMultiRelation, zDocSchemaFieldMultiSelectNumber, zDocSchemaFieldMultiSelectText, zDocSchemaFieldMultiText, zDocSchemaFieldNumber, zDocSchemaFieldRelation, zDocSchemaFieldSelectNumber, zDocSchemaFieldSelectText, zDocSchemaFieldText, zDocSchemaFieldType, zDocSchemaMinimal };
|