@interactive-inc/docs-client 0.0.9 → 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 +107 -32
- package/build/index.js +872 -588
- 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
|
*/
|
|
@@ -801,7 +843,7 @@ declare class DocSchemaValue {
|
|
|
801
843
|
private isNullOrUndefined;
|
|
802
844
|
toJson(): DocSchemaRecord;
|
|
803
845
|
/**
|
|
804
|
-
*
|
|
846
|
+
* スキーマを正規化(エラーを出すように変更)
|
|
805
847
|
*/
|
|
806
848
|
private static normalizeSchema;
|
|
807
849
|
}
|
|
@@ -815,11 +857,11 @@ declare class DocFrontMatterIndexValue {
|
|
|
815
857
|
/**
|
|
816
858
|
* アイコンを取得
|
|
817
859
|
*/
|
|
818
|
-
|
|
860
|
+
icon(): string;
|
|
819
861
|
/**
|
|
820
862
|
* スキーマを取得
|
|
821
863
|
*/
|
|
822
|
-
|
|
864
|
+
schema<T extends z.ZodTypeAny = z.ZodTypeAny>(zodSchema?: T): DocSchemaValue<T>;
|
|
823
865
|
/**
|
|
824
866
|
* iconフィールドを更新
|
|
825
867
|
*/
|
|
@@ -1027,23 +1069,25 @@ declare class DocFileIndexReference {
|
|
|
1027
1069
|
/**
|
|
1028
1070
|
* FrontMatter
|
|
1029
1071
|
*/
|
|
1030
|
-
declare class DocFrontMatterMdValue {
|
|
1072
|
+
declare class DocFrontMatterMdValue<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter> {
|
|
1073
|
+
private readonly zodSchema;
|
|
1074
|
+
constructor(value: DocFileMdFrontMatter, zodSchema: T);
|
|
1031
1075
|
readonly value: DocFileMdFrontMatter;
|
|
1032
|
-
constructor(value: DocFileMdFrontMatter);
|
|
1033
1076
|
toJson(): DocFileMdFrontMatter;
|
|
1034
1077
|
toYaml(): string;
|
|
1078
|
+
schema<U extends z.ZodTypeAny = z.ZodTypeAny>(zodSchema?: U): DocSchemaValue<U>;
|
|
1035
1079
|
/**
|
|
1036
1080
|
* Markdownテキストから生成
|
|
1037
1081
|
*/
|
|
1038
|
-
static from(markdownText: string): DocFrontMatterMdValue
|
|
1082
|
+
static from<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(markdownText: string, zodSchema: T): DocFrontMatterMdValue<T>;
|
|
1039
1083
|
/**
|
|
1040
1084
|
* 空のFrontMatterを生成
|
|
1041
1085
|
*/
|
|
1042
|
-
static empty(): DocFrontMatterMdValue
|
|
1086
|
+
static empty<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(zodSchema: T): DocFrontMatterMdValue<T>;
|
|
1043
1087
|
/**
|
|
1044
1088
|
* データから直接生成
|
|
1045
1089
|
*/
|
|
1046
|
-
static fromData(data: unknown): DocFrontMatterMdValue
|
|
1090
|
+
static fromData<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(data: unknown, zodSchema: T): DocFrontMatterMdValue<T>;
|
|
1047
1091
|
/**
|
|
1048
1092
|
* スキーマフィールドに基づいてデフォルト値を生成する
|
|
1049
1093
|
*/
|
|
@@ -1053,13 +1097,8 @@ declare class DocFrontMatterMdValue {
|
|
|
1053
1097
|
}): unknown;
|
|
1054
1098
|
/**
|
|
1055
1099
|
* 単一のプロパティを更新した新しいインスタンスを返す
|
|
1056
|
-
* スキーマに基づいて型を検証し、スキーマのフィールドのみを含む新しいインスタンスを生成
|
|
1057
|
-
*/
|
|
1058
|
-
withProperty(key: string, value: unknown, schema: DocSchemaValue): DocFrontMatterMdValue;
|
|
1059
|
-
/**
|
|
1060
|
-
* フィールド値の検証
|
|
1061
1100
|
*/
|
|
1062
|
-
|
|
1101
|
+
withProperty(key: string, value: unknown): DocFrontMatterMdValue<T>;
|
|
1063
1102
|
/**
|
|
1064
1103
|
* テキスト型のプロパティを取得
|
|
1065
1104
|
*/
|
|
@@ -1100,14 +1139,24 @@ declare class DocFrontMatterMdValue {
|
|
|
1100
1139
|
* すべてのキーを取得
|
|
1101
1140
|
*/
|
|
1102
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;
|
|
1103
1151
|
}
|
|
1104
1152
|
|
|
1105
1153
|
/**
|
|
1106
1154
|
* Markdownコンテンツ情報の値オブジェクト
|
|
1107
1155
|
*/
|
|
1108
|
-
declare class DocFileContentMdValue {
|
|
1156
|
+
declare class DocFileContentMdValue<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter> {
|
|
1109
1157
|
readonly value: DocFileContentMd;
|
|
1110
|
-
|
|
1158
|
+
private readonly zodSchema;
|
|
1159
|
+
constructor(value: DocFileContentMd, zodSchema: T);
|
|
1111
1160
|
/**
|
|
1112
1161
|
* コンテンツ本文(frontMatterを含まない)
|
|
1113
1162
|
*/
|
|
@@ -1121,29 +1170,33 @@ declare class DocFileContentMdValue {
|
|
|
1121
1170
|
*/
|
|
1122
1171
|
get description(): string;
|
|
1123
1172
|
/**
|
|
1124
|
-
* FrontMatter
|
|
1173
|
+
* FrontMatter(コンストラクタのZodスキーマまたは引数のスキーマを使用)
|
|
1125
1174
|
*/
|
|
1126
|
-
|
|
1175
|
+
frontMatter<U extends FrontMatterSchema = T>(zodSchema?: U): DocFrontMatterMdValue<U extends FrontMatterSchema ? U : T>;
|
|
1127
1176
|
/**
|
|
1128
1177
|
* タイトルを更新
|
|
1129
1178
|
*/
|
|
1130
|
-
withTitle(title: string): DocFileContentMdValue
|
|
1179
|
+
withTitle(title: string): DocFileContentMdValue<T>;
|
|
1131
1180
|
/**
|
|
1132
1181
|
* 説明を更新
|
|
1133
1182
|
*/
|
|
1134
|
-
withDescription(description: string, defaultTitle?: string): DocFileContentMdValue
|
|
1183
|
+
withDescription(description: string, defaultTitle?: string): DocFileContentMdValue<T>;
|
|
1135
1184
|
/**
|
|
1136
1185
|
* コンテンツを更新
|
|
1137
1186
|
*/
|
|
1138
|
-
withContent(content: string): DocFileContentMdValue
|
|
1187
|
+
withContent(content: string): DocFileContentMdValue<T>;
|
|
1139
1188
|
/**
|
|
1140
1189
|
* FrontMatterを更新
|
|
1141
1190
|
*/
|
|
1142
|
-
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>;
|
|
1143
1196
|
/**
|
|
1144
1197
|
* Markdownテキストから生成
|
|
1145
1198
|
*/
|
|
1146
|
-
static fromMarkdown(markdown: string): DocFileContentMdValue
|
|
1199
|
+
static fromMarkdown<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(markdown: string, zodSchema?: T): DocFileContentMdValue<T>;
|
|
1147
1200
|
/**
|
|
1148
1201
|
* 完全なMarkdownテキストを生成
|
|
1149
1202
|
*/
|
|
@@ -1155,7 +1208,7 @@ declare class DocFileContentMdValue {
|
|
|
1155
1208
|
/**
|
|
1156
1209
|
* 空のコンテンツを生成
|
|
1157
1210
|
*/
|
|
1158
|
-
static empty(title: string): DocFileContentMdValue
|
|
1211
|
+
static empty<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(title: string, zodSchema: T): DocFileContentMdValue<T>;
|
|
1159
1212
|
/**
|
|
1160
1213
|
* JSON形式で出力
|
|
1161
1214
|
*/
|
|
@@ -1271,7 +1324,7 @@ declare class DocFileMdReference {
|
|
|
1271
1324
|
/**
|
|
1272
1325
|
* 同じディレクトリのindex.mdを取得する
|
|
1273
1326
|
*/
|
|
1274
|
-
getDirectoryIndex(): Promise<
|
|
1327
|
+
getDirectoryIndex(): Promise<DocFileIndexReference | null>;
|
|
1275
1328
|
/**
|
|
1276
1329
|
* 複数のリレーションを取得する
|
|
1277
1330
|
*/
|
|
@@ -1280,6 +1333,14 @@ declare class DocFileMdReference {
|
|
|
1280
1333
|
* スキーマに基づいて複数のリレーションを取得する
|
|
1281
1334
|
*/
|
|
1282
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>;
|
|
1283
1344
|
}
|
|
1284
1345
|
|
|
1285
1346
|
/**
|
|
@@ -1408,10 +1469,24 @@ declare class DocDirectoryReference {
|
|
|
1408
1469
|
mdFilesGenerator(): AsyncGenerator<DocFileMdReference, void, unknown>;
|
|
1409
1470
|
files(): Promise<(DocFileMdReference | DocFileUnknownReference)[]>;
|
|
1410
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
|
+
}[]>;
|
|
1411
1479
|
file(fileName: string): DocFileMdReference | DocFileUnknownReference;
|
|
1412
1480
|
mdFile(fileName: string): DocFileMdReference;
|
|
1413
1481
|
readFiles(): Promise<(DocFileMdEntity | DocFileUnknownEntity)[]>;
|
|
1414
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
|
+
}[]>;
|
|
1415
1490
|
readUnknownFiles(): Promise<DocFileUnknownEntity[]>;
|
|
1416
1491
|
/**
|
|
1417
1492
|
* サブディレクトリ名の一覧を取得
|
|
@@ -1922,4 +1997,4 @@ declare class DocSchemaFieldFactory {
|
|
|
1922
1997
|
private getTypeSpecificDefaults;
|
|
1923
1998
|
}
|
|
1924
1999
|
|
|
1925
|
-
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 };
|