@interactive-inc/docs-client 0.0.10 → 0.0.11

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 CHANGED
@@ -1,561 +1,300 @@
1
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
- export { zDocTreeDirectoryNode, zDocTreeFileNode, zDocTreeNode } from './models.js';
2
+ import { zDocClientConfig, zDocCustomSchemaField, zDocFilePath, zDocMetaFieldRelation, zDocMetaFieldMultiRelation, zDocMetaFieldText, zDocMetaFieldNumber, zDocMetaFieldBoolean, zDocMetaFieldMultiText, zDocMetaFieldMultiNumber, zDocMetaFieldMultiBoolean, zDocFileUnknown, zDocFileIndexSchemaField, zDocSchemaFieldText, zDocSchemaFieldNumber, zDocSchemaFieldBoolean, zDocSchemaFieldRelation, zDocSchemaFieldSelectText, zDocSchemaFieldSelectNumber, zDocSchemaFieldMultiText, zDocSchemaFieldMultiNumber, zDocSchemaFieldMultiRelation, zDocSchemaFieldMultiSelectText, zDocSchemaFieldMultiSelectNumber, zDocRelation, zDocRelationFile, zDocMetaField, zDocMetaFieldSelectText, zDocMetaFieldSelectNumber, zDocMetaFieldMultiSelectText, zDocMetaFieldMultiSelectNumber, zDocMetaFieldTypeText, zDocMetaFieldTypeNumber, zDocMetaFieldTypeBoolean, zDocMetaFieldTypeSelectText, zDocMetaFieldTypeSelectNumber, zDocMetaFieldTypeRelation, zDocMetaFieldType, zDocCustomSchemaFieldText, zDocCustomSchemaFieldNumber, zDocCustomSchemaFieldBoolean, zDocCustomSchemaFieldRelation, zDocCustomSchemaFieldSelectText, zDocCustomSchemaFieldSelectNumber, zDocCustomSchemaFieldMultiText, zDocCustomSchemaFieldMultiNumber, zDocCustomSchemaFieldMultiRelation, zDocCustomSchemaFieldMultiSelectText, zDocCustomSchemaFieldMultiSelectNumber, zDocRelationField } from './models.js';
3
+ export { zDocCustomSchema, zDocFile, zDocFileIndex, zDocFileIndexContent, zDocFileIndexMeta, zDocFileIndexSchema, zDocFileMd, zDocFileMdContent, zDocFileMdMeta, zDocMetaFieldTypeMultiNumber, zDocMetaFieldTypeMultiRelation, zDocMetaFieldTypeMultiSelectNumber, zDocMetaFieldTypeMultiSelectText, zDocMetaFieldTypeMultiText, zDocTreeDirectoryNode, zDocTreeFileNode, zDocTreeNode } from './models.js';
4
4
 
5
5
  /**
6
- * パス操作システム
6
+ * Path operations system
7
7
  */
8
8
  declare class DocPathSystem {
9
- private readonly separator;
9
+ readonly separator = "/";
10
10
  /**
11
- * パスを結合
11
+ * Join paths
12
12
  */
13
13
  join(...paths: string[]): string;
14
14
  /**
15
- * ファイル名を取得(拡張子付き)
15
+ * Get filename with extension
16
16
  */
17
17
  basename(path: string, ext?: string): string;
18
18
  /**
19
- * ディレクトリ名を取得
19
+ * Get directory name
20
20
  */
21
21
  dirname(path: string): string;
22
22
  /**
23
- * 拡張子を取得
23
+ * Get extension
24
24
  */
25
25
  extname(path: string): string;
26
26
  /**
27
- * 相対パスを計算
27
+ * Calculate relative path
28
28
  */
29
29
  relative(from: string, to: string): string;
30
30
  /**
31
- * 絶対パスに変換
31
+ * Convert to absolute path
32
32
  */
33
33
  resolve(...paths: string[]): string;
34
34
  /**
35
- * パスを正規化
35
+ * Normalize path
36
36
  */
37
37
  normalize(path: string): string;
38
38
  /**
39
- * パスが絶対パスかどうか
39
+ * Check if path is absolute
40
40
  */
41
41
  isAbsolute(path: string): boolean;
42
- /**
43
- * パスのセパレータ
44
- */
45
- get sep(): string;
46
42
  }
47
43
 
48
44
  type Props$9 = {
49
45
  basePath: string;
50
- pathSystem: DocPathSystem;
46
+ pathSystem?: DocPathSystem;
51
47
  };
52
48
  /**
53
- * ファイルシステム
49
+ * File system wrapper
54
50
  */
55
51
  declare class DocFileSystem {
56
52
  private readonly basePath;
57
53
  private readonly pathSystem;
58
54
  constructor(props: Props$9);
59
55
  /**
60
- * 指定されたパスのファイルの内容を読み込む
56
+ * Read file content at the specified path
61
57
  */
62
58
  readFile(relativePath: string): Promise<string | null>;
63
59
  /**
64
- * 指定されたパスのファイルに内容を書き込む(必要に応じてディレクトリも作成)
60
+ * Write content to file at the specified path (creates directory if needed)
65
61
  */
66
62
  writeFile(relativePath: string, content: string): Promise<void>;
67
63
  /**
68
- * 指定されたパスのファイルを削除
64
+ * Delete file at the specified path
69
65
  */
70
66
  deleteFile(relativePath: string): Promise<Error | null>;
71
67
  /**
72
- * 指定されたパスのファイル名を取得
68
+ * Get file name from path
73
69
  */
74
70
  readFileName(relativePath: string): string;
75
71
  /**
76
- * 指定されたパスのファイル拡張子を取得
72
+ * Get file extension from path
77
73
  */
78
74
  readFileExtension(relativePath: string): string;
79
75
  /**
80
- * 指定されたパスのファイルが存在するディレクトリパスを取得
76
+ * Get directory path where the file exists
81
77
  */
82
78
  readFileDirectory(relativePath: string): string;
83
79
  /**
84
- * ディレクトリ内のエントリ一覧を取得
80
+ * Get list of entries in directory
85
81
  */
86
82
  readDirectoryFileNames(relativePath?: string): Promise<string[]>;
87
83
  readDirectoryFilePaths(relativePath: string): Promise<string[]>;
88
84
  /**
89
- * 指定パスがディレクトリかチェック
85
+ * Check if path is a directory
90
86
  */
91
87
  isDirectory(relativePath: string): Promise<boolean>;
92
88
  /**
93
- * 指定パスがファイルかチェック
89
+ * Check if path is a file
94
90
  */
95
91
  isFile(relativePath: string): Promise<boolean>;
96
92
  /**
97
- * ファイルまたはディレクトリが存在するかチェック
93
+ * Check if file or directory exists
98
94
  */
99
95
  exists(relativePath: string): Promise<boolean>;
100
96
  /**
101
- * ディレクトリが存在するかチェック
97
+ * Check if directory exists
102
98
  */
103
99
  directoryExists(relativePath: string): Promise<boolean>;
104
100
  /**
105
- * ファイルが存在するかチェック
101
+ * Check if file exists
106
102
  */
107
103
  fileExists(relativePath: string): Promise<boolean>;
108
104
  /**
109
- * ベースパスを取得
105
+ * Get base path
110
106
  */
111
107
  getBasePath(): string;
112
108
  /**
113
- * 相対パスを絶対パスに変換
109
+ * Convert relative path to absolute path
114
110
  */
115
111
  resolve(relativePath: string): string;
116
112
  /**
117
- * ディレクトリを作成する
113
+ * Create directory
118
114
  */
119
115
  createDirectory(relativePath: string): Promise<void>;
120
116
  /**
121
- * ファイルのサイズを取得(バイト単位)
117
+ * Get file size in bytes
122
118
  */
123
119
  getFileSize(relativePath: string): Promise<number>;
124
120
  /**
125
- * ディレクトリが存在しない場合は作成する
121
+ * Create directory if it doesn't exist
126
122
  */
127
123
  ensureDirectoryExists(relativePath: string): Promise<void>;
128
124
  /**
129
- * ファイルをコピー
125
+ * Copy file
130
126
  */
131
127
  copyFile(sourcePath: string, destinationPath: string): Promise<void>;
132
128
  /**
133
- * ファイルを移動
129
+ * Move file
134
130
  */
135
131
  moveFile(sourcePath: string, destinationPath: string): Promise<void>;
136
132
  /**
137
- * ファイルの最終更新日時を取得
133
+ * Get file last modified time
138
134
  */
139
135
  getFileModifiedTime(relativePath: string): Promise<Date>;
140
136
  /**
141
- * ファイルの作成日時を取得
137
+ * Get file creation time
142
138
  */
143
139
  getFileCreatedTime(relativePath: string): Promise<Date>;
144
140
  }
145
141
 
146
142
  /**
147
- * FrontMatterのスキーマ型
148
- * - ZodRecord: 動的なキーを持つ場合(デフォルト)
149
- * - ZodObject: 固定されたキーを持つ場合(型安全)
150
- */
151
- type FrontMatterSchema = z.ZodTypeAny;
152
-
153
- /**
154
- * スキーマフィールドで使用可能な型
155
- */
156
- type FieldType = "text" | "number" | "boolean" | "multi-text" | "multi-number" | "multi-boolean" | "relation" | "multi-relation" | "select-text" | "select-number" | "multi-select-text" | "multi-select-number";
157
- /**
158
- * 文字列フィールドの型
159
- */
160
- type DocSchemaFieldText = z.infer<typeof zDocSchemaFieldText>;
161
- /**
162
- * 数値フィールドの型
163
- */
164
- type DocSchemaFieldNumber = z.infer<typeof zDocSchemaFieldNumber>;
165
- /**
166
- * ブールフィールドの型
167
- */
168
- type DocSchemaFieldBoolean = z.infer<typeof zDocSchemaFieldBoolean>;
169
- /**
170
- * マルチテキストフィールドの型
171
- */
172
- type DocFieldMultiText = z.infer<typeof zDocSchemaFieldMultiText>;
173
- /**
174
- * マルチ数値フィールドの型
175
- */
176
- type DocFieldMultiNumber = z.infer<typeof zDocSchemaFieldMultiNumber>;
177
- /**
178
- * マルチブールフィールドの型
179
- */
180
- type DocFieldMultiBoolean = z.infer<typeof zDocSchemaFieldMultiBoolean>;
181
- /**
182
- * リレーションフィールドの型
183
- */
184
- type DocSchemaFieldRelation = z.infer<typeof zDocSchemaFieldRelation>;
185
- /**
186
- * マルチリレーションフィールドの型
187
- */
188
- type DocFieldMultiRelation = z.infer<typeof zDocSchemaFieldMultiRelation>;
189
- /**
190
- * 選択テキストフィールドの型
191
- */
192
- type DocSchemaFieldSelectText = z.infer<typeof zDocSchemaFieldSelectText>;
193
- /**
194
- * 選択数値フィールドの型
195
- */
196
- type DocSchemaFieldSelectNumber = z.infer<typeof zDocSchemaFieldSelectNumber>;
197
- /**
198
- * マルチ選択テキストフィールドの型
199
- */
200
- type DocSchemaFieldMultiSelectText = z.infer<typeof zDocSchemaFieldMultiSelectText>;
201
- /**
202
- * マルチ選択数値フィールドの型
203
- */
204
- type DocSchemaFieldMultiSelectNumber = z.infer<typeof zDocSchemaFieldMultiSelectNumber>;
205
- type DocFileMdFrontMatter = z.infer<typeof zDocFileMdFrontMatter>;
206
- /**
207
- * スキーマフィールドタイプの型
208
- */
209
- type DocSchemaFieldType = z.infer<typeof zDocSchemaFieldType>;
210
- /**
211
- * スキーマフィールドの型
212
- */
213
- type DocSchemaField = z.infer<typeof zDocSchemaField>;
214
- /**
215
- * スキーマ定義の型
216
- */
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>;
226
- /**
227
- * リレーション型フィールドのUnion型
228
- */
229
- type RelationFieldTypes = DocSchemaFieldRelation | DocFieldMultiRelation;
230
- /**
231
- * ファイルノードの型(ファイル専用)
232
- */
233
- type DocTreeFileNode = {
234
- type: "file";
235
- name: string;
236
- path: string;
237
- icon: string;
238
- title: string;
239
- };
240
- /**
241
- * ディレクトリノードの型(ディレクトリ専用)
242
- */
243
- type DocTreeDirectoryNode = {
244
- type: "directory";
245
- name: string;
246
- path: string;
247
- icon: string;
248
- title: string;
249
- children: DocTreeNode[];
250
- };
251
- /**
252
- * ツリーノードの統合型
253
- */
254
- type DocTreeNode = DocTreeFileNode | DocTreeDirectoryNode;
255
- /**
256
- * 後方互換性のためのエイリアス
257
- */
258
- type DocFileNode = DocTreeNode;
259
- /**
260
- * インデックスファイルの型
261
- */
262
- type DocFileIndex = z.infer<typeof zDocFileIndex>;
263
- /**
264
- * マークダウンファイル(index.md以外)の型
265
- */
266
- type DocFileMd = z.infer<typeof zDocFileMd>;
267
- /**
268
- * その他のファイル(非マークダウン)の型
269
- */
270
- type DocFileUnknown = z.infer<typeof zDocFileUnknown>;
271
- /**
272
- * ファイルのunion型(index.md、通常のmd、その他)
273
- */
274
- type DocFile = z.infer<typeof zDocFile>;
275
- /**
276
- * ディレクトリFrontMatterの型
277
- */
278
- type DocFileIndexFrontMatter = z.infer<typeof zDocFileIndexFrontMatter>;
279
- /**
280
- * リレーションオプションの型
281
- */
282
- type DocRelationFile = z.infer<typeof zDocRelationFile>;
283
- /**
284
- * リレーション情報の型
285
- */
286
- type DocRelation = z.infer<typeof zDocRelation>;
287
- /**
288
- * リレーションフィールドの型
289
- */
290
- type DocRelationField = z.infer<typeof zDocRelationField>;
291
- /**
292
- * ファイルパス情報の型
293
- */
294
- type DocFilePath = z.infer<typeof zDocFilePath>;
295
- /**
296
- * Markdownコンテンツ情報の型
297
- */
298
- type DocFileContentMd = z.infer<typeof zDocFileContentMd>;
299
- /**
300
- * Indexファイルコンテンツ情報の型
301
- */
302
- type DocFileContentIndex = z.infer<typeof zDocFileContentIndex>;
303
- /**
304
- * ディレクトリレスポンスの型(serverパッケージの型を再エクスポート)
305
- */
306
- type DocDirectory = {
307
- cwd: string;
308
- indexFile: DocFileIndex;
309
- files: DocFile[];
310
- relations: DocRelation[];
311
- };
312
-
313
- /**
314
- * リレーションファイル
315
- */
316
- declare class DocRelationFileValue {
317
- private readonly value;
318
- constructor(value: DocRelationFile);
319
- /**
320
- * ファイルパス
321
- */
322
- get id(): string;
323
- /**
324
- * スラッグ
325
- */
326
- get slug(): string;
327
- /**
328
- * 表示用ラベル
329
- */
330
- get label(): string;
331
- /**
332
- * ファイルパスとタイトルから生成
333
- */
334
- static from(filePath: string, title: string | null): DocRelationFileValue;
335
- /**
336
- * ファイルパスからファイル名を抽出(拡張子なし)
337
- */
338
- private static extractFileName;
339
- /**
340
- * JSON形式に変換
341
- */
342
- toJson(): DocRelationFile;
343
- }
344
-
345
- /**
346
- * リレーション情報を管理する
347
- */
348
- declare class DocRelationValue {
349
- readonly value: DocRelation;
350
- constructor(value: DocRelation);
351
- /**
352
- * リレーションパス
353
- */
354
- get path(): string;
355
- /**
356
- * リレーション対象ファイル一覧(値オブジェクト)
357
- */
358
- get files(): DocRelationFileValue[];
359
- /**
360
- * ファイル数を取得
361
- */
362
- get fileCount(): number;
363
- /**
364
- * 空かどうか
365
- */
366
- get isEmpty(): boolean;
367
- /**
368
- * 空のリレーションエンティティを作成
369
- */
370
- static empty(path: string): DocRelationValue;
371
- /**
372
- * JSON形式で出力
373
- */
374
- toJson(): DocRelation;
375
- }
376
-
377
- type Props$8 = {
378
- filePath: string;
379
- fileSystem: DocFileSystem;
380
- pathSystem: DocPathSystem;
381
- };
382
- /**
383
- * リレーションファイルの参照
384
- */
385
- declare class DocFileRelationReference {
386
- private readonly props;
387
- private readonly pathSystem;
388
- constructor(props: Props$8);
389
- get fileSystem(): DocFileSystem;
390
- get basePath(): string;
391
- /**
392
- * リレーションパス
393
- */
394
- get path(): string;
395
- /**
396
- * フルパス
397
- */
398
- get fullPath(): string;
399
- read(): Promise<DocRelationValue | null>;
400
- /**
401
- * リレーションファイルの一覧を読み込む
402
- */
403
- readFiles(): Promise<DocRelationFileValue[]>;
404
- /**
405
- * 単一のリレーションファイルを読み込む
406
- */
407
- readFile(filePath: string): Promise<DocRelationFileValue | null>;
408
- /**
409
- * ファイルの存在確認
410
- */
411
- exists(slug: string): Promise<boolean>;
412
- /**
413
- * ファイル名の一覧を取得(拡張子なし)
414
- */
415
- readSlugs(): Promise<string[]>;
416
- /**
417
- * ファイル数を取得
418
- */
419
- count(): Promise<number>;
420
- /**
421
- * 空かどうかを確認
422
- */
423
- isEmpty(): Promise<boolean>;
424
- }
425
-
426
- /**
427
- * 動的にZodスキーマを生成するビルダー
143
+ * Single boolean type schema field
428
144
  */
429
- declare class DocSchemaBuilder {
430
- /**
431
- * 動的にZodスキーマを生成
432
- */
433
- createDynamicSchema(value: unknown): z.ZodTypeAny;
145
+ declare class DocSchemaFieldBooleanSingleValue<T extends RecordKey> {
146
+ readonly key: T;
147
+ readonly value: DocSchemaFieldBoolean;
148
+ constructor(key: T, value: DocSchemaFieldBoolean);
149
+ get type(): "boolean";
150
+ get required(): boolean;
151
+ get title(): string;
152
+ get description(): string;
153
+ get default(): boolean | null;
154
+ readonly isArray = false;
155
+ readonly isSingle = true;
156
+ readonly isBoolean = true;
157
+ toJson(): DocFileIndexSchemaField;
434
158
  /**
435
- * フィールドタイプに応じたZodスキーマを生成
159
+ * Validate value type
436
160
  */
437
- private createFieldSchema;
161
+ validate(value: unknown): boolean;
162
+ static empty(key: RecordKey): DocSchemaFieldBooleanSingleValue<RecordKey>;
163
+ static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldBooleanSingleValue<RecordKey>;
438
164
  }
439
165
 
440
166
  /**
441
- * リレーション複数型スキーマフィールド
167
+ * Multiple number type schema field
442
168
  */
443
- declare class DocSchemaFieldRelationMultipleValue {
444
- readonly key: string;
445
- readonly value: DocFieldMultiRelation;
446
- constructor(key: string, value: DocFieldMultiRelation);
447
- get type(): "multi-relation";
169
+ declare class DocSchemaFieldMultiNumberValue<T extends RecordKey> {
170
+ readonly key: T;
171
+ readonly value: DocFieldMultiNumber;
172
+ constructor(key: T, value: DocFieldMultiNumber);
173
+ get type(): "multi-number";
448
174
  get required(): boolean;
449
175
  get title(): string;
450
176
  get description(): string;
451
- get default(): string[] | null;
452
- get path(): string;
177
+ get default(): number[] | null;
453
178
  readonly isArray = true;
454
179
  readonly isSingle = false;
455
- readonly isRelation = true;
180
+ readonly isNumber = true;
456
181
  /**
457
- * 値を検証する
182
+ * Validate value
458
183
  */
459
184
  validate(value: unknown): boolean;
460
- toJson(): DocSchemaField;
185
+ toJson(): DocFileIndexSchemaField;
186
+ static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiNumberValue<T>;
187
+ static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiNumberValue<RecordKey>;
461
188
  }
462
189
 
463
190
  /**
464
- * 単一リレーション型スキーマフィールド
191
+ * Multiple relation type schema field
465
192
  */
466
- declare class DocSchemaFieldRelationSingleValue {
467
- readonly key: string;
468
- readonly value: DocSchemaFieldRelation;
469
- constructor(key: string, value: DocSchemaFieldRelation);
470
- get type(): "relation";
193
+ declare class DocSchemaFieldMultiRelationValue<T extends RecordKey> {
194
+ readonly key: T;
195
+ readonly value: DocFieldMultiRelation;
196
+ constructor(key: T, value: DocFieldMultiRelation);
197
+ get type(): "multi-relation";
471
198
  get required(): boolean;
472
199
  get title(): string;
473
200
  get description(): string;
474
- get default(): string | null;
201
+ get default(): string[] | null;
475
202
  get path(): string;
476
- readonly isArray = false;
477
- readonly isSingle = true;
203
+ readonly isArray = true;
204
+ readonly isSingle = false;
478
205
  readonly isRelation = true;
479
- toJson(): DocSchemaField;
480
206
  /**
481
- * 値の型を検証する
207
+ * Validate value
482
208
  */
483
209
  validate(value: unknown): boolean;
210
+ toJson(): DocFileIndexSchemaField;
211
+ static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiRelationValue<T>;
212
+ static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiRelationValue<RecordKey>;
484
213
  }
485
214
 
486
215
  /**
487
- * ブール複数型スキーマフィールド
216
+ * Multiple select number type schema field
488
217
  */
489
- declare class DocSchemaFieldBooleanMultipleValue {
490
- readonly key: string;
491
- readonly value: DocFieldMultiBoolean;
492
- constructor(key: string, value: DocFieldMultiBoolean);
493
- get type(): "multi-boolean";
218
+ declare class DocSchemaFieldMultiSelectNumberValue<T extends RecordKey> {
219
+ readonly key: T;
220
+ readonly value: DocSchemaFieldMultiSelectNumber;
221
+ constructor(key: T, value: DocSchemaFieldMultiSelectNumber);
222
+ get type(): "multi-select-number";
494
223
  get required(): boolean;
495
224
  get title(): string;
496
225
  get description(): string;
497
- get default(): boolean[] | null;
226
+ get default(): number[] | null;
227
+ get options(): number[];
498
228
  readonly isArray = true;
499
229
  readonly isSingle = false;
500
- readonly isBoolean = true;
230
+ readonly isSelect = true;
231
+ readonly isNumberSelect = true;
501
232
  /**
502
- * 値を検証する
233
+ * Validate value
503
234
  */
504
235
  validate(value: unknown): boolean;
505
- toJson(): DocSchemaField;
236
+ toJson(): DocFileIndexSchemaField;
237
+ static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiSelectNumberValue<T>;
238
+ static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiSelectNumberValue<RecordKey>;
506
239
  }
507
240
 
508
241
  /**
509
- * 単一ブール型スキーマフィールド
242
+ * Multiple select text type schema field
510
243
  */
511
- declare class DocSchemaFieldBooleanSingleValue {
512
- readonly key: string;
513
- readonly value: DocSchemaFieldBoolean;
514
- constructor(key: string, value: DocSchemaFieldBoolean);
515
- get type(): "boolean";
244
+ declare class DocSchemaFieldMultiSelectTextValue<T extends RecordKey> {
245
+ readonly key: T;
246
+ readonly value: DocSchemaFieldMultiSelectText;
247
+ constructor(key: T, value: DocSchemaFieldMultiSelectText);
248
+ get type(): "multi-select-text";
516
249
  get required(): boolean;
517
250
  get title(): string;
518
251
  get description(): string;
519
- get default(): boolean | null;
520
- readonly isArray = false;
521
- readonly isSingle = true;
522
- readonly isBoolean = true;
523
- toJson(): DocSchemaField;
252
+ get default(): string[] | null;
253
+ get options(): string[];
254
+ readonly isArray = true;
255
+ readonly isSingle = false;
256
+ readonly isSelect = true;
257
+ readonly isTextSelect = true;
524
258
  /**
525
- * 値の型を検証する
259
+ * Validate value
526
260
  */
527
261
  validate(value: unknown): boolean;
262
+ toJson(): DocFileIndexSchemaField;
263
+ static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiSelectTextValue<T>;
264
+ static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiSelectTextValue<RecordKey>;
528
265
  }
529
266
 
530
267
  /**
531
- * 数値複数型スキーマフィールド
268
+ * Multiple text type schema field
532
269
  */
533
- declare class DocSchemaFieldNumberMultipleValue {
534
- readonly key: string;
535
- readonly value: DocFieldMultiNumber;
536
- constructor(key: string, value: DocFieldMultiNumber);
537
- get type(): "multi-number";
270
+ declare class DocSchemaFieldMultiTextValue<T extends RecordKey> {
271
+ readonly key: T;
272
+ readonly value: DocFieldMultiText;
273
+ constructor(key: T, value: DocFieldMultiText);
274
+ get type(): "multi-text";
538
275
  get required(): boolean;
539
276
  get title(): string;
540
277
  get description(): string;
541
- get default(): number[] | null;
278
+ get default(): string[] | null;
542
279
  readonly isArray = true;
543
280
  readonly isSingle = false;
544
- readonly isNumber = true;
281
+ readonly isText = true;
282
+ toJson(): DocFileIndexSchemaField;
545
283
  /**
546
- * 値を検証する
284
+ * Validate value type
547
285
  */
548
286
  validate(value: unknown): boolean;
549
- toJson(): DocSchemaField;
287
+ static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiTextValue<T>;
288
+ static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiTextValue<RecordKey>;
550
289
  }
551
290
 
552
291
  /**
553
- * 単一数値型スキーマフィールド
292
+ * Single number type schema field
554
293
  */
555
- declare class DocSchemaFieldNumberSingleValue {
556
- readonly key: string;
294
+ declare class DocSchemaFieldNumberSingleValue<T extends RecordKey> {
295
+ readonly key: T;
557
296
  readonly value: DocSchemaFieldNumber;
558
- constructor(key: string, value: DocSchemaFieldNumber);
297
+ constructor(key: T, value: DocSchemaFieldNumber);
559
298
  get type(): "number";
560
299
  get required(): boolean;
561
300
  get title(): string;
@@ -564,44 +303,47 @@ declare class DocSchemaFieldNumberSingleValue {
564
303
  readonly isArray = false;
565
304
  readonly isSingle = true;
566
305
  readonly isNumber = true;
567
- toJson(): DocSchemaField;
306
+ toJson(): DocFileIndexSchemaField;
568
307
  /**
569
- * 値の型を検証する
308
+ * Validate value type
570
309
  */
571
310
  validate(value: unknown): boolean;
311
+ static empty(key: RecordKey): DocSchemaFieldNumberSingleValue<RecordKey>;
312
+ static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldNumberSingleValue<RecordKey>;
572
313
  }
573
314
 
574
315
  /**
575
- * 数値選択複数型スキーマフィールド
316
+ * Single relation type schema field
576
317
  */
577
- declare class DocSchemaFieldSelectNumberMultipleValue {
578
- readonly key: string;
579
- readonly value: DocSchemaFieldMultiSelectNumber;
580
- constructor(key: string, value: DocSchemaFieldMultiSelectNumber);
581
- get type(): "multi-select-number";
318
+ declare class DocSchemaFieldRelationSingleValue<T extends RecordKey> {
319
+ readonly key: T;
320
+ readonly value: DocSchemaFieldRelation;
321
+ constructor(key: T, value: DocSchemaFieldRelation);
322
+ get type(): "relation";
582
323
  get required(): boolean;
583
324
  get title(): string;
584
325
  get description(): string;
585
- get default(): number[] | null;
586
- get options(): number[];
587
- readonly isArray = true;
588
- readonly isSingle = false;
589
- readonly isSelect = true;
590
- readonly isNumberSelect = true;
326
+ get default(): string | null;
327
+ get path(): string;
328
+ readonly isArray = false;
329
+ readonly isSingle = true;
330
+ readonly isRelation = true;
331
+ toJson(): DocFileIndexSchemaField;
591
332
  /**
592
- * 値を検証する
333
+ * Validate value type
593
334
  */
594
335
  validate(value: unknown): boolean;
595
- toJson(): DocSchemaField;
336
+ static empty(key: RecordKey): DocSchemaFieldRelationSingleValue<RecordKey>;
337
+ static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldRelationSingleValue<RecordKey>;
596
338
  }
597
339
 
598
340
  /**
599
- * 単一選択数値型スキーマフィールド
341
+ * Single select number type schema field
600
342
  */
601
- declare class DocSchemaFieldSelectNumberSingleValue {
602
- readonly key: string;
343
+ declare class DocSchemaFieldSelectNumberSingleValue<T extends RecordKey> {
344
+ readonly key: T;
603
345
  readonly value: DocSchemaFieldSelectNumber;
604
- constructor(key: string, value: DocSchemaFieldSelectNumber);
346
+ constructor(key: T, value: DocSchemaFieldSelectNumber);
605
347
  get type(): "select-number";
606
348
  get required(): boolean;
607
349
  get title(): string;
@@ -613,648 +355,881 @@ declare class DocSchemaFieldSelectNumberSingleValue {
613
355
  readonly isSelect = true;
614
356
  readonly isNumberSelect = true;
615
357
  /**
616
- * 値を検証する
358
+ * Validate value
617
359
  */
618
360
  validate(value: unknown): boolean;
619
- toJson(): DocSchemaField;
361
+ toJson(): DocFileIndexSchemaField;
362
+ static empty<T extends RecordKey>(key: T): DocSchemaFieldSelectNumberSingleValue<T>;
363
+ static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldSelectNumberSingleValue<RecordKey>;
620
364
  }
621
365
 
622
366
  /**
623
- * テキスト選択複数型スキーマフィールド
367
+ * Single select text type schema field
624
368
  */
625
- declare class DocSchemaFieldSelectTextMultipleValue {
626
- readonly key: string;
627
- readonly value: DocSchemaFieldMultiSelectText;
628
- constructor(key: string, value: DocSchemaFieldMultiSelectText);
629
- get type(): "multi-select-text";
369
+ declare class DocSchemaFieldSelectTextSingleValue<T extends RecordKey> {
370
+ readonly key: T;
371
+ readonly value: DocSchemaFieldSelectText;
372
+ constructor(key: T, value: DocSchemaFieldSelectText);
373
+ get type(): "select-text";
630
374
  get required(): boolean;
631
375
  get title(): string;
632
376
  get description(): string;
633
- get default(): string[] | null;
377
+ get default(): string | null;
634
378
  get options(): string[];
635
- readonly isArray = true;
636
- readonly isSingle = false;
379
+ readonly isArray = false;
380
+ readonly isSingle = true;
637
381
  readonly isSelect = true;
638
382
  readonly isTextSelect = true;
383
+ toJson(): DocFileIndexSchemaField;
384
+ /**
385
+ * Validate value type
386
+ */
387
+ validate(value: unknown): boolean;
388
+ static empty<T extends RecordKey>(key: T): DocSchemaFieldSelectTextSingleValue<T>;
389
+ static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldSelectTextSingleValue<RecordKey>;
390
+ }
391
+
392
+ /**
393
+ * Single text type schema field
394
+ */
395
+ declare class DocSchemaFieldTextSingleValue<T extends RecordKey> {
396
+ readonly key: T;
397
+ readonly value: DocSchemaFieldText;
398
+ constructor(key: T, value: DocSchemaFieldText);
399
+ get type(): "text";
400
+ get required(): boolean;
401
+ get title(): string;
402
+ get description(): string;
403
+ get default(): string | null;
404
+ readonly isArray = false;
405
+ readonly isSingle = true;
406
+ readonly isText = true;
407
+ toJson(): DocFileIndexSchemaField;
639
408
  /**
640
- * 値を検証する
409
+ * Validate value type
641
410
  */
642
411
  validate(value: unknown): boolean;
643
- toJson(): DocSchemaField;
412
+ static empty(key: RecordKey): DocSchemaFieldTextSingleValue<RecordKey>;
413
+ static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldTextSingleValue<RecordKey>;
644
414
  }
645
415
 
646
416
  /**
647
- * 単一選択テキスト型スキーマフィールド
417
+ * Text field type
418
+ */
419
+ type DocSchemaFieldText = z.infer<typeof zDocSchemaFieldText>;
420
+ /**
421
+ * Number field type
422
+ */
423
+ type DocSchemaFieldNumber = z.infer<typeof zDocSchemaFieldNumber>;
424
+ /**
425
+ * Boolean field type
426
+ */
427
+ type DocSchemaFieldBoolean = z.infer<typeof zDocSchemaFieldBoolean>;
428
+ /**
429
+ * Multi-text field type
430
+ */
431
+ type DocFieldMultiText = z.infer<typeof zDocSchemaFieldMultiText>;
432
+ /**
433
+ * Multi-number field type
434
+ */
435
+ type DocFieldMultiNumber = z.infer<typeof zDocSchemaFieldMultiNumber>;
436
+ /**
437
+ * Relation field type
438
+ */
439
+ type DocSchemaFieldRelation = z.infer<typeof zDocSchemaFieldRelation>;
440
+ /**
441
+ * Multi-relation field type
442
+ */
443
+ type DocFieldMultiRelation = z.infer<typeof zDocSchemaFieldMultiRelation>;
444
+ /**
445
+ * Select text field type
446
+ */
447
+ type DocSchemaFieldSelectText = z.infer<typeof zDocSchemaFieldSelectText>;
448
+ /**
449
+ * Select number field type
450
+ */
451
+ type DocSchemaFieldSelectNumber = z.infer<typeof zDocSchemaFieldSelectNumber>;
452
+ /**
453
+ * Multi-select text field type
454
+ */
455
+ type DocSchemaFieldMultiSelectText = z.infer<typeof zDocSchemaFieldMultiSelectText>;
456
+ /**
457
+ * Multi-select number field type
458
+ */
459
+ type DocSchemaFieldMultiSelectNumber = z.infer<typeof zDocSchemaFieldMultiSelectNumber>;
460
+ type DocMetaField = z.infer<typeof zDocMetaField>;
461
+ type DocMetaFieldText = z.infer<typeof zDocMetaFieldText>;
462
+ type DocMetaFieldNumber = z.infer<typeof zDocMetaFieldNumber>;
463
+ type DocMetaFieldBoolean = z.infer<typeof zDocMetaFieldBoolean>;
464
+ type DocMetaFieldSelectText = z.infer<typeof zDocMetaFieldSelectText>;
465
+ type DocMetaFieldSelectNumber = z.infer<typeof zDocMetaFieldSelectNumber>;
466
+ type DocMetaFieldRelation = z.infer<typeof zDocMetaFieldRelation>;
467
+ type DocMetaFieldMultiText = z.infer<typeof zDocMetaFieldMultiText>;
468
+ type DocMetaFieldMultiNumber = z.infer<typeof zDocMetaFieldMultiNumber>;
469
+ type DocMetaFieldMultiBoolean = z.infer<typeof zDocMetaFieldMultiBoolean>;
470
+ type DocMetaFieldMultiSelectText = z.infer<typeof zDocMetaFieldMultiSelectText>;
471
+ type DocMetaFieldMultiSelectNumber = z.infer<typeof zDocMetaFieldMultiSelectNumber>;
472
+ type DocMetaFieldMultiRelation = z.infer<typeof zDocMetaFieldMultiRelation>;
473
+ type DocFileMdMeta<T extends RecordKey> = Record<T, DocMetaField>;
474
+ type DocMetaFieldTypeText = z.infer<typeof zDocMetaFieldTypeText>;
475
+ type DocMetaFieldTypeNumber = z.infer<typeof zDocMetaFieldTypeNumber>;
476
+ type DocMetaFieldTypeBoolean = z.infer<typeof zDocMetaFieldTypeBoolean>;
477
+ type DocMetaFieldTypeSelectText = z.infer<typeof zDocMetaFieldTypeSelectText>;
478
+ type DocMetaFieldTypeSelectNumber = z.infer<typeof zDocMetaFieldTypeSelectNumber>;
479
+ type DocMetaFieldTypeRelation = z.infer<typeof zDocMetaFieldTypeRelation>;
480
+ /**
481
+ * Schema field type
482
+ */
483
+ type DocMetaFieldType = z.infer<typeof zDocMetaFieldType>;
484
+ type DocCustomSchemaFieldText = z.infer<typeof zDocCustomSchemaFieldText>;
485
+ type DocCustomSchemaFieldNumber = z.infer<typeof zDocCustomSchemaFieldNumber>;
486
+ type DocCustomSchemaFieldBoolean = z.infer<typeof zDocCustomSchemaFieldBoolean>;
487
+ type DocCustomSchemaFieldRelation = z.infer<typeof zDocCustomSchemaFieldRelation>;
488
+ type DocCustomSchemaFieldSelectText = z.infer<typeof zDocCustomSchemaFieldSelectText>;
489
+ type DocCustomSchemaFieldSelectNumber = z.infer<typeof zDocCustomSchemaFieldSelectNumber>;
490
+ type DocCustomSchemaFieldMultiText = z.infer<typeof zDocCustomSchemaFieldMultiText>;
491
+ type DocCustomSchemaFieldMultiNumber = z.infer<typeof zDocCustomSchemaFieldMultiNumber>;
492
+ type DocCustomSchemaFieldMultiRelation = z.infer<typeof zDocCustomSchemaFieldMultiRelation>;
493
+ type DocCustomSchemaFieldMultiSelectText = z.infer<typeof zDocCustomSchemaFieldMultiSelectText>;
494
+ type DocCustomSchemaFieldMultiSelectNumber = z.infer<typeof zDocCustomSchemaFieldMultiSelectNumber>;
495
+ /**
496
+ * Schema field type
497
+ */
498
+ type DocFileIndexSchemaField = z.infer<typeof zDocFileIndexSchemaField>;
499
+ /**
500
+ * Schema definition type
501
+ */
502
+ type DocFileIndexSchema<T extends RecordKey> = Record<T, DocFileIndexSchemaField>;
503
+ /**
504
+ * Schema field to override
505
+ * ex: { xxx: { type: "text", required: true } }
506
+ */
507
+ type DocCustomSchemaField = z.infer<typeof zDocCustomSchemaField>;
508
+ /**
509
+ * Minimal schema definition type
510
+ */
511
+ type DocCustomSchema<T extends RecordKey = RecordKey> = Record<T, DocCustomSchemaField>;
512
+ /**
513
+ * Union type for relation fields
514
+ */
515
+ type DocSchemaRelationFieldUnion = DocSchemaFieldRelation | DocFieldMultiRelation;
516
+ /**
517
+ * File node type (for files only)
518
+ */
519
+ type DocTreeFileNode = {
520
+ type: "file";
521
+ name: string;
522
+ path: string;
523
+ icon: string;
524
+ title: string;
525
+ };
526
+ /**
527
+ * Directory node type (for directories only)
528
+ */
529
+ type DocTreeDirectoryNode = {
530
+ type: "directory";
531
+ name: string;
532
+ path: string;
533
+ icon: string;
534
+ title: string;
535
+ children: DocTreeNode[];
536
+ };
537
+ /**
538
+ * Unified tree node type
539
+ */
540
+ type DocTreeNode = DocTreeFileNode | DocTreeDirectoryNode;
541
+ /**
542
+ * Alias for backward compatibility
543
+ */
544
+ type DocFileNode = DocTreeNode;
545
+ /**
546
+ * Index file type
547
+ */
548
+ type DocFileIndex<T extends DocCustomSchema> = {
549
+ type: "index";
550
+ path: DocFilePath;
551
+ isArchived: boolean;
552
+ content: DocFileIndexContent<T>;
553
+ };
554
+ /**
555
+ * Test helper types
556
+ */
557
+ /**
558
+ * Type to check if two types are equal
559
+ */
560
+ type Equals<T, U> = (<G>() => G extends T ? 1 : 2) extends <G>() => G extends U ? 1 : 2 ? true : false;
561
+ /**
562
+ * Extract relation field keys from schema
563
+ */
564
+ type RelationKeys<T extends DocCustomSchema> = {
565
+ [K in keyof T]: T[K]["type"] extends "relation" ? K : never;
566
+ }[keyof T];
567
+ /**
568
+ * Extract multi-relation field keys from schema
569
+ */
570
+ type MultiRelationKeys<T extends DocCustomSchema> = {
571
+ [K in keyof T]: T[K]["type"] extends "multi-relation" ? K : never;
572
+ }[keyof T];
573
+ /**
574
+ * Markdown file type (excluding index.md)
575
+ */
576
+ type DocFileMd<T extends DocCustomSchema> = {
577
+ type: "markdown";
578
+ path: DocFilePath;
579
+ isArchived: boolean;
580
+ content: DocFileMdContent<T>;
581
+ };
582
+ /**
583
+ * Other file type (non-markdown)
584
+ */
585
+ type DocFileUnknown = z.infer<typeof zDocFileUnknown>;
586
+ /**
587
+ * File union type (index.md, regular md, other)
588
+ */
589
+ type DocFile<T extends DocCustomSchema> = DocFileIndex<T> | DocFileMd<T> | DocFileUnknown;
590
+ /**
591
+ * Directory FrontMatter type
592
+ */
593
+ type DocFileIndexMeta<T extends DocCustomSchema> = {
594
+ type: "index-meta";
595
+ icon: string | null;
596
+ schema: DocFileIndexSchema<keyof T>;
597
+ };
598
+ /**
599
+ * Relation options type
600
+ */
601
+ type DocRelationFile = z.infer<typeof zDocRelationFile>;
602
+ /**
603
+ * Relation information type
604
+ */
605
+ type DocRelation = z.infer<typeof zDocRelation>;
606
+ /**
607
+ * Relation field type
608
+ */
609
+ type DocRelationField = z.infer<typeof zDocRelationField>;
610
+ /**
611
+ * File path information type
648
612
  */
649
- declare class DocSchemaFieldSelectTextSingleValue {
650
- readonly key: string;
651
- readonly value: DocSchemaFieldSelectText;
652
- constructor(key: string, value: DocSchemaFieldSelectText);
653
- get type(): "select-text";
654
- get required(): boolean;
655
- get title(): string;
656
- get description(): string;
657
- get default(): string | null;
658
- get options(): string[];
659
- readonly isArray = false;
660
- readonly isSingle = true;
661
- readonly isSelect = true;
662
- readonly isTextSelect = true;
663
- toJson(): DocSchemaField;
664
- /**
665
- * 値の型を検証する
666
- */
667
- validate(value: unknown): boolean;
668
- }
669
-
613
+ type DocFilePath = z.infer<typeof zDocFilePath>;
614
+ type DocSchemaFieldTypeText = z.infer<typeof zDocSchemaFieldText>;
615
+ type DocSchemaFieldTypeNumber = z.infer<typeof zDocSchemaFieldNumber>;
616
+ type DocSchemaFieldTypeBoolean = z.infer<typeof zDocSchemaFieldBoolean>;
617
+ type DocSchemaFieldTypeMultiText = z.infer<typeof zDocSchemaFieldMultiText>;
618
+ type DocSchemaFieldTypeMultiNumber = z.infer<typeof zDocSchemaFieldMultiNumber>;
619
+ type DocSchemaFieldTypeRelation = z.infer<typeof zDocSchemaFieldRelation>;
620
+ type DocSchemaFieldTypeMultiRelation = z.infer<typeof zDocSchemaFieldMultiRelation>;
621
+ type DocSchemaFieldTypeSelectText = z.infer<typeof zDocSchemaFieldSelectText>;
622
+ type DocSchemaFieldTypeSelectNumber = z.infer<typeof zDocSchemaFieldSelectNumber>;
623
+ type DocSchemaFieldTypeMultiSelectText = z.infer<typeof zDocSchemaFieldMultiSelectText>;
624
+ type DocSchemaFieldTypeMultiSelectNumber = z.infer<typeof zDocSchemaFieldMultiSelectNumber>;
625
+ /**
626
+ * Markdown content information type
627
+ */
628
+ type DocFileMdContent<T extends DocCustomSchema> = {
629
+ type: "markdown-content";
630
+ body: string;
631
+ title: string;
632
+ description: string;
633
+ meta: SchemaToValueType<T>;
634
+ };
670
635
  /**
671
- * テキスト複数型スキーマフィールド
636
+ * Index file content information type
672
637
  */
673
- declare class DocSchemaFieldTextMultipleValue {
674
- readonly key: string;
675
- readonly value: DocFieldMultiText;
676
- constructor(key: string, value: DocFieldMultiText);
677
- get type(): "multi-text";
678
- get required(): boolean;
679
- get title(): string;
680
- get description(): string;
681
- get default(): string[] | null;
682
- readonly isArray = true;
683
- readonly isSingle = false;
684
- readonly isText = true;
685
- toJson(): DocSchemaField;
686
- /**
687
- * 値の型を検証する
688
- */
689
- validate(value: unknown): boolean;
690
- }
691
-
638
+ type DocFileIndexContent<T extends DocCustomSchema> = {
639
+ type: "markdown-index";
640
+ body: string;
641
+ title: string;
642
+ description: string;
643
+ meta: DocFileIndexMeta<T>;
644
+ };
692
645
  /**
693
- * 単一テキスト型スキーマフィールド
646
+ * Directory response type (re-export from server package)
694
647
  */
695
- declare class DocSchemaFieldTextSingleValue {
696
- readonly key: string;
697
- readonly value: DocSchemaFieldText;
698
- constructor(key: string, value: DocSchemaFieldText);
699
- get type(): "text";
700
- get required(): boolean;
701
- get title(): string;
702
- get description(): string;
703
- get default(): string | null;
704
- readonly isArray = false;
705
- readonly isSingle = true;
706
- readonly isText = true;
707
- toJson(): DocSchemaField;
708
- /**
709
- * 値の型を検証する
710
- */
711
- validate(value: unknown): boolean;
712
- }
713
-
648
+ type DocDirectory<T extends DocCustomSchema> = {
649
+ cwd: string;
650
+ indexFile: DocFileIndex<T>;
651
+ files: DocFile<T>[];
652
+ relations: DocRelation[];
653
+ };
654
+ type RecordKey = string | number | symbol;
655
+ /**
656
+ * DocClient configuration
657
+ */
658
+ type DocClientConfig = z.infer<typeof zDocClientConfig>;
714
659
  /**
715
- * テキスト型フィールド
660
+ * DocClient configuration input (all properties optional)
716
661
  */
717
- type DocSchemaFieldTextTypes = DocSchemaFieldTextSingleValue | DocSchemaFieldTextMultipleValue;
662
+ type DocClientConfigInput = z.input<typeof zDocClientConfig>;
718
663
  /**
719
- * 数値型フィールド
664
+ * Type definitions for DocFileMdMetaValue
720
665
  */
721
- type DocSchemaFieldNumberTypes = DocSchemaFieldNumberSingleValue | DocSchemaFieldNumberMultipleValue;
666
+ type ExtractFieldType<T> = T extends {
667
+ type: infer Type;
668
+ } ? Type : never;
669
+ type ExtractRequired<T> = T extends {
670
+ required: infer Required;
671
+ } ? Required : false;
672
+ type BaseFieldValueType<Type> = Type extends "text" ? string : Type extends "number" ? number : Type extends "boolean" ? boolean : Type extends "multi-text" ? string[] : Type extends "multi-number" ? number[] : Type extends "multi-boolean" ? boolean[] : Type extends "relation" ? string : Type extends "multi-relation" ? string[] : Type extends "select-text" ? string : Type extends "select-number" ? number : Type extends "multi-select-text" ? string[] : Type extends "multi-select-number" ? number[] : never;
673
+ type FieldValueType<Type, Required> = Required extends true ? BaseFieldValueType<Type> : BaseFieldValueType<Type> | null;
722
674
  /**
723
- * ブール型フィールド
675
+ * Extract required field keys
724
676
  */
725
- type DocSchemaFieldBooleanTypes = DocSchemaFieldBooleanSingleValue | DocSchemaFieldBooleanMultipleValue;
677
+ type RequiredKeys<T extends DocCustomSchema> = {
678
+ [K in keyof T]: T[K] extends {
679
+ required: true;
680
+ } ? K : never;
681
+ }[keyof T];
726
682
  /**
727
- * 選択型フィールド
683
+ * Extract optional field keys
728
684
  */
729
- type DocSchemaFieldSelectTypes = DocSchemaFieldSelectTextSingleValue | DocSchemaFieldSelectTextMultipleValue | DocSchemaFieldSelectNumberSingleValue | DocSchemaFieldSelectNumberMultipleValue;
685
+ type OptionalKeys<T extends DocCustomSchema> = {
686
+ [K in keyof T]: T[K] extends {
687
+ required: true;
688
+ } ? never : K;
689
+ }[keyof T];
730
690
  /**
731
- * リレーション型フィールド
691
+ * Generate expected value type from schema (considering required)
732
692
  */
733
- type DocSchemaFieldRelationTypes = DocSchemaFieldRelationSingleValue | DocSchemaFieldRelationMultipleValue;
693
+ type SchemaToValueType<T extends DocCustomSchema> = {
694
+ [K in RequiredKeys<T>]: BaseFieldValueType<ExtractFieldType<T[K]>>;
695
+ } & {
696
+ [K in OptionalKeys<T>]?: BaseFieldValueType<ExtractFieldType<T[K]>>;
697
+ };
698
+ /**
699
+ * Helper type for type-safe property access
700
+ */
701
+ type GetValueType<T extends DocCustomSchema, K extends keyof T> = K extends RequiredKeys<T> ? BaseFieldValueType<ExtractFieldType<T[K]>> : BaseFieldValueType<ExtractFieldType<T[K]>> | undefined;
734
702
  /**
735
- * スキーマフィールドの型共用体
703
+ * Type definitions for DocFileIndexSchema
736
704
  */
737
- type DocSchemaFieldValue = DocSchemaFieldTextTypes | DocSchemaFieldNumberTypes | DocSchemaFieldBooleanTypes | DocSchemaFieldSelectTypes | DocSchemaFieldRelationTypes;
705
+ type ExtractIndexFieldType<T> = T extends {
706
+ type: infer Type;
707
+ } ? Type : never;
708
+ type GetIndexFieldType<Schema extends DocFileIndexSchema<RecordKey>, K extends keyof Schema> = Schema[K] extends DocFileIndexSchemaField ? Schema[K] : never;
709
+ type GetIndexFieldValueType<Schema extends DocFileIndexSchema<RecordKey>, K extends keyof Schema> = Schema[K] extends {
710
+ type: infer Type;
711
+ } ? Type extends "text" ? DocSchemaFieldTextSingleValue<K> : Type extends "number" ? DocSchemaFieldNumberSingleValue<K> : Type extends "boolean" ? DocSchemaFieldBooleanSingleValue<K> : Type extends "relation" ? DocSchemaFieldRelationSingleValue<K> : Type extends "select-text" ? DocSchemaFieldSelectTextSingleValue<K> : Type extends "select-number" ? DocSchemaFieldSelectNumberSingleValue<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;
738
712
 
739
713
  /**
740
- * 型安全なスキーマ値オブジェクト
741
- * @template T - Zodスキーマの型(オプショナル)
714
+ * Relation file
742
715
  */
743
- declare class DocSchemaValue<T extends z.ZodTypeAny = z.ZodTypeAny> {
744
- readonly value: DocSchemaRecord;
745
- private readonly zodSchema;
746
- constructor(value: unknown, zodSchema?: T, schemaBuilder?: DocSchemaBuilder);
716
+ declare class DocRelationFileValue {
717
+ private readonly value;
718
+ constructor(value: DocRelationFile);
747
719
  /**
748
- * フィールド名の一覧を取得
749
- * Zodスキーマを使用している場合は自動的に型安全
720
+ * File path
750
721
  */
751
- get fieldNames(): string[];
722
+ get id(): string;
752
723
  /**
753
- * 指定されたフィールド名のフィールドを取得
754
- * Zodスキーマを使用している場合は型安全
724
+ * Slug
755
725
  */
756
- field<K extends keyof z.infer<T> & string>(name: K): DocSchemaFieldValue | null;
757
- field(name: string): DocSchemaFieldValue | null;
726
+ get slug(): string;
758
727
  /**
759
- * すべてのフィールドを取得
760
- * 注意: 型安全性のため、個別にfield()メソッドを使用することを推奨
728
+ * Display label
761
729
  */
762
- get fields(): DocSchemaFieldValue[];
763
- get relationFields(): (DocSchemaFieldRelationSingleValue | DocSchemaFieldRelationMultipleValue)[];
730
+ get label(): string;
764
731
  /**
765
- * 空のスキーマエンティティを作成
732
+ * Create from file path and title
766
733
  */
767
- static empty<T extends z.ZodTypeAny = z.ZodTypeAny>(zodSchema?: T, dynamicBuilder?: DocSchemaBuilder): DocSchemaValue<T>;
734
+ static from(filePath: string, title: string | null): DocRelationFileValue;
768
735
  /**
769
- * スキーマからリレーションパスを抽出
736
+ * Extract file name from file path (without extension)
770
737
  */
771
- extractRelationPaths(): Set<string>;
738
+ private static extractFileName;
772
739
  /**
773
- * フィールドがリレーション型かどうかを判定
740
+ * Convert to JSON format
774
741
  */
775
- private isRelationField;
742
+ toJson(): DocRelationFile;
743
+ }
744
+
745
+ /**
746
+ * Manages relation information
747
+ */
748
+ declare class DocRelationValue {
749
+ readonly value: DocRelation;
750
+ constructor(value: DocRelation);
776
751
  /**
777
- * リレーションオプションを作成
752
+ * Relation path
778
753
  */
779
- createRelationOption(filePath: string, title: string | null): DocRelationFile;
754
+ get path(): string;
780
755
  /**
781
- * ファイルをスキップすべきかどうかを判定
756
+ * List of related files (value objects)
782
757
  */
783
- shouldSkipFile(filePath: string): boolean;
758
+ get files(): DocRelationFileValue[];
784
759
  /**
785
- * 値を指定された型に変換する(デフォルト値フォールバック付き)
760
+ * Get file count
786
761
  */
787
- convertValue(value: unknown, targetType: string, defaultValue: unknown): unknown;
762
+ get fileCount(): number;
788
763
  /**
789
- * 型別の変換処理
764
+ * Whether it's empty
790
765
  */
791
- private convertByType;
766
+ get isEmpty(): boolean;
792
767
  /**
793
- * 文字列型への変換
768
+ * Create empty relation entity
794
769
  */
795
- private convertToString;
770
+ static empty(path: string): DocRelationValue;
796
771
  /**
797
- * 数値型への変換
772
+ * Export as JSON format
798
773
  */
799
- private convertToNumber;
774
+ toJson(): DocRelation;
775
+ }
776
+
777
+ type Props$8 = {
778
+ filePath: string;
779
+ fileSystem: DocFileSystem;
780
+ pathSystem: DocPathSystem;
781
+ };
782
+ /**
783
+ * Relation file reference
784
+ */
785
+ declare class DocFileRelationReference {
786
+ private readonly props;
787
+ private readonly pathSystem;
788
+ constructor(props: Props$8);
789
+ get fileSystem(): DocFileSystem;
790
+ get basePath(): string;
800
791
  /**
801
- * ブール型への変換
792
+ * Relation path
802
793
  */
803
- private convertToBoolean;
794
+ get path(): string;
804
795
  /**
805
- * 配列型への変換
796
+ * Full path
806
797
  */
807
- private convertToArray;
798
+ get fullPath(): string;
799
+ read(): Promise<DocRelationValue | null>;
808
800
  /**
809
- * リレーション型への変換
801
+ * Read list of relation files
810
802
  */
811
- private convertToRelation;
803
+ readFiles(): Promise<DocRelationFileValue[]>;
812
804
  /**
813
- * マルチリレーション型への変換
805
+ * Read single relation file
814
806
  */
815
- private convertToMultiRelation;
807
+ readFile(filePath: string): Promise<DocRelationFileValue | null>;
816
808
  /**
817
- * パスからファイル名を抽出(拡張子除去)
809
+ * Check if file exists
818
810
  */
819
- private extractFileNameFromPath;
811
+ exists(slug: string): Promise<boolean>;
820
812
  /**
821
- * スキーマベースでFrontMatterを補完する
813
+ * Get list of file names (without extension)
822
814
  */
823
- getCompleteFrontMatter(rawFrontMatter: unknown): DocFileMdFrontMatter;
815
+ readSlugs(): Promise<string[]>;
824
816
  /**
825
- * 型安全にFrontMatterを補完する(Zodスキーマを使用している場合)
817
+ * Get file count
826
818
  */
827
- getTypedCompleteFrontMatter(rawFrontMatter: Partial<z.infer<T>>): z.infer<T>;
819
+ count(): Promise<number>;
828
820
  /**
829
- * スキーマからデフォルトFrontMatterを生成
821
+ * Check if empty
830
822
  */
831
- private generateDefaultFrontMatter;
823
+ isEmpty(): Promise<boolean>;
824
+ }
825
+
826
+ /**
827
+ * Type-safe schema value object
828
+ */
829
+ declare class DocFileIndexSchemaValue<T extends DocCustomSchema> {
830
+ readonly value: DocFileIndexSchema<keyof T>;
831
+ readonly customSchema: T;
832
+ constructor(value: DocFileIndexSchema<keyof T>, customSchema: T);
832
833
  /**
833
- * 既存の値を保持しながらマージ
834
+ * Get list of field names
835
+ * Automatically type-safe when using Zod schema
834
836
  */
835
- private mergePreservingExistingValues;
837
+ get fieldNames(): Array<keyof T>;
836
838
  /**
837
- * ファイルパスからファイル名を抽出(拡張子なし)
839
+ * Get field with specified field name
840
+ * Returns type-safe specific field Value object
838
841
  */
839
- private extractFileName;
842
+ field<K extends keyof T>(key: K): T[K]["type"] extends infer Type ? Type extends "text" ? DocSchemaFieldTextSingleValue<K> : Type extends "number" ? DocSchemaFieldNumberSingleValue<K> : Type extends "boolean" ? DocSchemaFieldBooleanSingleValue<K> : Type extends "relation" ? DocSchemaFieldRelationSingleValue<K> : Type extends "select-text" ? DocSchemaFieldSelectTextSingleValue<K> : Type extends "select-number" ? DocSchemaFieldSelectNumberSingleValue<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;
843
+ relation<K extends keyof T>(key: K): DocSchemaFieldRelationSingleValue<K>;
844
+ multiRelation<K extends keyof T>(key: K): DocSchemaFieldMultiRelationValue<K>;
840
845
  /**
841
- * nullまundefinedのチェック
846
+ * Get all fields
847
+ * Note: For type safety, it's recommended to use field() method individually
842
848
  */
843
- private isNullOrUndefined;
844
- toJson(): DocSchemaRecord;
849
+ get fields(): DocFileIndexSchema<keyof T>[keyof T][];
850
+ get relationFields(): (DocSchemaFieldRelationSingleValue<string> | DocSchemaFieldMultiRelationValue<string>)[];
851
+ toJson(): DocFileIndexSchema<keyof T>;
845
852
  /**
846
- * スキーマを正規化(エラーを出すように変更)
853
+ * Create empty schema entity
854
+ * biome-ignore lint/complexity/noBannedTypes: {} as DocCustomSchema
847
855
  */
848
- private static normalizeSchema;
856
+ static empty(): DocFileIndexSchemaValue<{}>;
849
857
  }
850
858
 
851
859
  /**
852
- * FrontMatter
860
+ * File: index.md > content > FrontMatter
853
861
  */
854
- declare class DocFrontMatterIndexValue {
855
- readonly value: DocFileIndexFrontMatter;
856
- constructor(value: DocFileIndexFrontMatter);
862
+ declare class DocFileIndexMetaValue<T extends DocCustomSchema> {
863
+ readonly value: DocFileIndexMeta<T>;
864
+ readonly customSchema: T;
865
+ private readonly config;
857
866
  /**
858
- * アイコンを取得
867
+ * Additional properties to include in the meta data
859
868
  */
860
- icon(): string;
869
+ private readonly additionalProperties;
870
+ constructor(value: DocFileIndexMeta<T>, customSchema: T, config: DocClientConfig, additionalProperties?: Record<string, unknown>);
861
871
  /**
862
- * スキーマを取得
872
+ * Get icon
863
873
  */
864
- schema<T extends z.ZodTypeAny = z.ZodTypeAny>(zodSchema?: T): DocSchemaValue<T>;
874
+ get icon(): string | null;
865
875
  /**
866
- * iconフィールドを更新
876
+ * Get schema
867
877
  */
868
- withIcon(value: unknown): DocFrontMatterIndexValue;
878
+ schema(): DocFileIndexSchemaValue<T>;
869
879
  /**
870
- * schemaフィールドを更新
880
+ * Check if schema is defined
871
881
  */
872
- withSchema(value: unknown): DocFrontMatterIndexValue;
882
+ get hasSchema(): boolean;
873
883
  /**
874
- * JSON形式で出力
884
+ * Update icon field
875
885
  */
876
- toJson(): DocFileIndexFrontMatter;
886
+ withIcon(value: string | null): DocFileIndexMetaValue<T>;
877
887
  /**
878
- * YAML形式で出力
888
+ * Update schema field
879
889
  */
880
- toYaml(): string;
890
+ withSchema(value: DocFileIndexSchema<keyof T>): DocFileIndexMetaValue<T>;
881
891
  /**
882
- * スキーマ全体を正規化
892
+ * Output in JSON format
883
893
  */
884
- private static createSchema;
894
+ toJson(): DocFileIndexMeta<T>;
885
895
  /**
886
- * スキーマフィールドを正規化
896
+ * Output in YAML format
887
897
  */
888
- private static createSchemaField;
898
+ toYaml(): string;
889
899
  /**
890
- * Markdownテキストから生成(不完全なデータも処理可能)
900
+ * Generate from Markdown text (can process incomplete data)
891
901
  */
892
- static from(markdownText: string): DocFrontMatterIndexValue;
902
+ static from<T extends DocCustomSchema>(markdownText: string, customSchema: T, config: DocClientConfig): DocFileIndexMetaValue<T>;
893
903
  /**
894
- * データから直接生成(不完全なデータも処理可能)
904
+ * Generate directly from data (can process incomplete data)
895
905
  */
896
- static fromRecord(record: Record<string, unknown>): DocFrontMatterIndexValue;
906
+ static fromRecord<T extends DocCustomSchema>(record: Record<string, unknown>, customSchema: T, config: DocClientConfig): DocFileIndexMetaValue<T>;
897
907
  /**
898
- * 空のFrontMatterを生成
908
+ * Generate empty FrontMatter
899
909
  */
900
- static empty(): DocFrontMatterIndexValue;
910
+ static empty<T extends DocCustomSchema>(customSchema: T, config: DocClientConfig): DocFileIndexMetaValue<T>;
901
911
  /**
902
- * アイコンを抽出
912
+ * Extract icon
903
913
  */
904
914
  private static extractIcon;
905
915
  /**
906
- * スキーマを抽出
916
+ * Extract schema part
907
917
  */
908
918
  private static extractSchema;
909
919
  /**
910
- * デフォルトのアイコンを取得
920
+ * Normalize entire schema
911
921
  */
912
- private static getDefaultIcon;
922
+ private static normalizeSchema;
923
+ static emptySchema<T extends DocCustomSchema>(customSchema: T): DocFileIndexSchema<keyof T>;
913
924
  }
914
925
 
915
926
  /**
916
- * Indexファイルコンテンツ情報の値オブジェクト
927
+ * File: index.md > content
917
928
  */
918
- declare class DocFileContentIndexValue {
919
- readonly value: DocFileContentIndex;
920
- constructor(value: DocFileContentIndex);
929
+ declare class DocFileIndexContentValue<T extends DocCustomSchema> {
930
+ readonly value: DocFileIndexContent<T>;
931
+ private readonly customSchema;
932
+ private readonly config;
933
+ constructor(value: DocFileIndexContent<T>, customSchema: T, config: DocClientConfig);
921
934
  /**
922
- * コンテンツ本文(frontMatterを含まない)
935
+ * Content body (does not include frontMatter)
923
936
  */
924
937
  get body(): string;
925
938
  /**
926
- * タイトル
939
+ * Title
927
940
  */
928
941
  get title(): string;
929
942
  /**
930
- * 説明
943
+ * Description
931
944
  */
932
945
  get description(): string;
933
946
  /**
934
947
  * FrontMatter
935
948
  */
936
- get frontMatter(): DocFrontMatterIndexValue;
949
+ meta(): DocFileIndexMetaValue<T>;
937
950
  /**
938
- * タイトルを更新
951
+ * Update title
939
952
  */
940
- withTitle(title: string): DocFileContentIndexValue;
953
+ withTitle(title: string): DocFileIndexContentValue<T>;
941
954
  /**
942
- * 説明を更新
955
+ * Update description
943
956
  */
944
- withDescription(description: string, defaultTitle?: string): DocFileContentIndexValue;
957
+ withDescription(description: string, defaultTitle?: string): DocFileIndexContentValue<T>;
945
958
  /**
946
- * Markdownテキストから生成
959
+ * Generate from Markdown text
947
960
  */
948
- static fromMarkdown(markdown: string): DocFileContentIndexValue;
961
+ static fromMarkdown<T extends DocCustomSchema>(markdown: string, customSchema: T, config: DocClientConfig): DocFileIndexContentValue<T>;
949
962
  /**
950
- * 完全なMarkdownテキストを生成
963
+ * Generate complete Markdown text
951
964
  */
952
965
  toMarkdownText(): string;
953
966
  /**
954
- * コンテンツを更新
967
+ * Update content
955
968
  */
956
- withContent(content: string): DocFileContentIndexValue;
969
+ withContent(content: string): DocFileIndexContentValue<T>;
957
970
  /**
958
- * FrontMatterを更新
971
+ * Update FrontMatter
959
972
  */
960
- withFrontMatter(frontMatter: DocFrontMatterIndexValue): DocFileContentIndexValue;
973
+ withMeta(meta: DocFileIndexMeta<T>): DocFileIndexContentValue<T>;
961
974
  /**
962
- * デフォルトのindex.mdコンテンツを生成
975
+ * Generate default index.md content
963
976
  */
964
- static empty(directoryName: string): DocFileContentIndexValue;
977
+ static empty<T extends DocCustomSchema = DocCustomSchema>(directoryName: string, customSchema: T, config: DocClientConfig): DocFileIndexContentValue<T>;
965
978
  /**
966
- * FrontMatterとbodyを結合した完全なテキストを生成
979
+ * Generate complete text combining FrontMatter and body
967
980
  */
968
981
  toText(): string;
969
982
  /**
970
- * JSON形式で出力
983
+ * Output in JSON format
971
984
  */
972
- toJson(): DocFileContentIndex;
985
+ toJson(): DocFileIndexContent<T>;
973
986
  }
974
987
 
975
988
  /**
976
- * ドキュメントのディレクトリ
989
+ * Document directory entity
977
990
  */
978
- declare class DocFileIndexEntity {
979
- readonly value: DocFileIndex;
980
- constructor(value: DocFileIndex);
991
+ declare class DocFileIndexEntity<T extends DocCustomSchema> {
992
+ readonly value: DocFileIndex<T>;
993
+ private readonly customSchema;
994
+ private readonly config;
995
+ constructor(value: DocFileIndex<T>, customSchema: T, config?: DocClientConfig);
981
996
  /**
982
- * コンテンツ
997
+ * Content
983
998
  */
984
- get content(): DocFileContentIndexValue;
999
+ get content(): DocFileIndexContentValue<T>;
985
1000
  /**
986
- * パス情報
1001
+ * Path information
987
1002
  */
988
1003
  get path(): DocFilePath;
989
1004
  /**
990
- * コンテンツを更新
1005
+ * Update content
991
1006
  */
992
- withContent(content: DocFileContentIndexValue): DocFileIndexEntity;
1007
+ withContent(content: DocFileIndexContentValue<T>): DocFileIndexEntity<T>;
993
1008
  /**
994
- * パスを更新
1009
+ * Update path
995
1010
  */
996
- withPath(path: DocFilePath): DocFileIndexEntity;
1011
+ withPath(path: DocFilePath): DocFileIndexEntity<T>;
997
1012
  /**
998
- * indexFileSchemaの形式に変換
1013
+ * Convert to index file schema format
999
1014
  */
1000
- toJson(): DocFileIndex;
1015
+ toJson(): DocFileIndex<T>;
1001
1016
  }
1002
1017
 
1003
- type Props$7 = {
1018
+ type Props$7<T extends DocCustomSchema> = {
1019
+ customSchema: T;
1004
1020
  path: string;
1005
1021
  fileSystem: DocFileSystem;
1006
1022
  pathSystem: DocPathSystem;
1023
+ config: DocClientConfig;
1007
1024
  };
1008
1025
  /**
1009
- * ファイルを表すクラス
1026
+ * File reference class
1010
1027
  */
1011
- declare class DocFileIndexReference {
1028
+ declare class DocFileIndexReference<T extends DocCustomSchema> {
1012
1029
  private readonly props;
1013
1030
  private readonly pathSystem;
1014
- constructor(props: Props$7);
1031
+ private readonly customSchema;
1032
+ constructor(props: Props$7<T>);
1015
1033
  get fileSystem(): DocFileSystem;
1016
1034
  get basePath(): string;
1017
1035
  get filePath(): string;
1018
1036
  get fileFullPath(): string;
1019
1037
  get durectoryPath(): string;
1020
- read(): Promise<DocFileIndexEntity>;
1038
+ read(): Promise<DocFileIndexEntity<T>>;
1021
1039
  /**
1022
- * ファイルの内容を読み込む
1040
+ * Read file content
1023
1041
  */
1024
1042
  readContent(): Promise<Error | string>;
1025
1043
  /**
1026
- * ファイルに内容を書き込む
1044
+ * Write content to file
1027
1045
  */
1028
1046
  writeContent(content: string): Promise<void>;
1029
1047
  /**
1030
- * Entityを書き込む
1048
+ * Write entity
1031
1049
  */
1032
- write(entity: DocFileIndexEntity): Promise<void>;
1050
+ write(entity: DocFileIndexEntity<T>): Promise<void>;
1033
1051
  /**
1034
- * 新しいファイルをデフォルトコンテンツで作成
1052
+ * Create new file with default content
1035
1053
  */
1036
- writeDefault(): Promise<void>;
1054
+ writeDefault(): Promise<null>;
1037
1055
  /**
1038
- * ファイルを削除
1056
+ * Delete file
1039
1057
  */
1040
1058
  delete(): Promise<Error | null>;
1041
1059
  /**
1042
- * ファイルが存在するか確認
1060
+ * Check if file exists
1043
1061
  */
1044
1062
  exists(): Promise<boolean>;
1045
1063
  relations(): Promise<DocFileRelationReference[]>;
1046
1064
  readRelations(): Promise<DocRelationValue[]>;
1047
1065
  /**
1048
- * ファイルのサイズを取得(バイト単位)
1066
+ * Get file size in bytes
1049
1067
  */
1050
1068
  size(): Promise<number>;
1051
1069
  /**
1052
- * ファイルの最終更新日時を取得
1070
+ * Get last modified date
1053
1071
  */
1054
1072
  lastModified(): Promise<Date>;
1055
1073
  /**
1056
- * ファイルの作成日時を取得
1074
+ * Get file creation date
1057
1075
  */
1058
1076
  createdAt(): Promise<Date>;
1059
1077
  /**
1060
- * ファイルをアーカイブに移動し、新しい参照を返す
1078
+ * Move file to archive and return new reference
1061
1079
  */
1062
- archive(archiveDirectoryName?: string): Promise<DocFileIndexReference>;
1080
+ archive(archiveDirectoryName?: string): Promise<DocFileIndexReference<T>>;
1063
1081
  /**
1064
- * ファイルをアーカイブから復元し、新しい参照を返す
1082
+ * Restore file from archive and return new reference
1065
1083
  */
1066
- restore(archiveDirectoryName?: string): Promise<DocFileIndexReference>;
1084
+ restore(archiveDirectoryName?: string): Promise<DocFileIndexReference<T>>;
1067
1085
  }
1068
1086
 
1069
1087
  /**
1070
- * FrontMatter
1071
- */
1072
- declare class DocFrontMatterMdValue<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter> {
1073
- private readonly zodSchema;
1074
- constructor(value: DocFileMdFrontMatter, zodSchema: T);
1075
- readonly value: DocFileMdFrontMatter;
1076
- toJson(): DocFileMdFrontMatter;
1088
+ * Meta
1089
+ */
1090
+ declare class DocFileMdMetaValue<T extends DocCustomSchema> {
1091
+ readonly value: SchemaToValueType<T>;
1092
+ readonly customSchema: T;
1093
+ constructor(value: SchemaToValueType<T>, customSchema: T);
1094
+ private validateValue;
1095
+ private getValueField;
1096
+ get keys(): Array<keyof T>;
1097
+ /**
1098
+ * Return a new instance with a single property updated
1099
+ */
1100
+ withProperty<K extends keyof T>(key: K, value: BaseFieldValueType<ExtractFieldType<T[K]>>): DocFileMdMetaValue<T>;
1101
+ schemaField<K extends keyof T>(key: K): T[K];
1102
+ field<K extends keyof T>(key: K): FieldValueType<ExtractFieldType<T[K]>, ExtractRequired<T[K]>>;
1103
+ relation(key: keyof T): DocMetaFieldRelation;
1104
+ multiRelation(key: keyof T): DocMetaFieldMultiRelation;
1105
+ text(key: keyof T): DocMetaFieldText;
1106
+ number(key: keyof T): DocMetaFieldNumber;
1107
+ boolean(key: keyof T): DocMetaFieldBoolean;
1108
+ multiText(key: keyof T): DocMetaFieldMultiText;
1109
+ multiNumber(key: keyof T): DocMetaFieldMultiNumber;
1110
+ multiBoolean(key: keyof T): DocMetaFieldMultiBoolean;
1111
+ hasKey(key: keyof T): boolean;
1112
+ /**
1113
+ * Generate from Markdown text
1114
+ */
1115
+ static fromYamlText<T extends DocCustomSchema>(yamlText: string, customSchema: T): DocFileMdMetaValue<T>;
1116
+ static empty<T extends DocCustomSchema>(customSchema: T): DocFileMdMetaValue<T>;
1117
+ toJson(): SchemaToValueType<T>;
1077
1118
  toYaml(): string;
1078
- schema<U extends z.ZodTypeAny = z.ZodTypeAny>(zodSchema?: U): DocSchemaValue<U>;
1079
- /**
1080
- * Markdownテキストから生成
1081
- */
1082
- static from<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(markdownText: string, zodSchema: T): DocFrontMatterMdValue<T>;
1083
- /**
1084
- * 空のFrontMatterを生成
1085
- */
1086
- static empty<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(zodSchema: T): DocFrontMatterMdValue<T>;
1087
- /**
1088
- * データから直接生成
1089
- */
1090
- static fromData<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(data: unknown, zodSchema: T): DocFrontMatterMdValue<T>;
1091
- /**
1092
- * スキーマフィールドに基づいてデフォルト値を生成する
1093
- */
1094
- static generateDefaultValueFromSchemaField(fieldDef: {
1095
- type: string;
1096
- default?: unknown;
1097
- }): unknown;
1098
- /**
1099
- * 単一のプロパティを更新した新しいインスタンスを返す
1100
- */
1101
- withProperty(key: string, value: unknown): DocFrontMatterMdValue<T>;
1102
- /**
1103
- * テキスト型のプロパティを取得
1104
- */
1105
- text(key: string): string | null;
1106
- /**
1107
- * 数値型のプロパティを取得
1108
- */
1109
- number(key: string): number | null;
1110
- /**
1111
- * 真偽値型のプロパティを取得
1112
- */
1113
- boolean(key: string): boolean | null;
1114
- /**
1115
- * 単一リレーション型のプロパティを取得
1116
- */
1117
- relation(key: string): string | null;
1118
- /**
1119
- * 複数リレーション型のプロパティを取得
1120
- */
1121
- multiRelation(key: string): string[];
1122
- /**
1123
- * 複数テキスト型のプロパティを取得
1124
- */
1125
- multiText(key: string): string[];
1126
- /**
1127
- * 複数数値型のプロパティを取得
1128
- */
1129
- multiNumber(key: string): number[];
1130
- /**
1131
- * 複数真偽値型のプロパティを取得
1132
- */
1133
- multiBoolean(key: string): boolean[];
1134
- /**
1135
- * プロパティが存在するかチェック
1136
- */
1137
- has(key: string): boolean;
1138
- /**
1139
- * すべてのキーを取得
1140
- */
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;
1151
1119
  }
1152
1120
 
1153
1121
  /**
1154
- * Markdownコンテンツ情報の値オブジェクト
1122
+ * File: Markdown > Content
1155
1123
  */
1156
- declare class DocFileContentMdValue<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter> {
1157
- readonly value: DocFileContentMd;
1158
- private readonly zodSchema;
1159
- constructor(value: DocFileContentMd, zodSchema: T);
1124
+ declare class DocFileMdContentValue<T extends DocCustomSchema> {
1125
+ readonly value: DocFileMdContent<T>;
1126
+ private readonly customSchema;
1127
+ constructor(value: DocFileMdContent<T>, customSchema: T);
1160
1128
  /**
1161
- * コンテンツ本文(frontMatterを含まない)
1129
+ * Content body (does not include frontMatter)
1162
1130
  */
1163
1131
  get body(): string;
1164
1132
  /**
1165
- * タイトル
1133
+ * Title
1166
1134
  */
1167
1135
  get title(): string;
1168
1136
  /**
1169
- * 説明
1137
+ * Description
1170
1138
  */
1171
1139
  get description(): string;
1172
1140
  /**
1173
- * FrontMatter(コンストラクタのZodスキーマまたは引数のスキーマを使用)
1141
+ * FrontMatter (uses constructor's Zod schema or argument schema)
1174
1142
  */
1175
- frontMatter<U extends FrontMatterSchema = T>(zodSchema?: U): DocFrontMatterMdValue<U extends FrontMatterSchema ? U : T>;
1143
+ meta(): DocFileMdMetaValue<T>;
1176
1144
  /**
1177
- * タイトルを更新
1145
+ * Update title
1178
1146
  */
1179
- withTitle(title: string): DocFileContentMdValue<T>;
1147
+ withTitle(title: string): DocFileMdContentValue<T>;
1180
1148
  /**
1181
- * 説明を更新
1149
+ * Update description
1182
1150
  */
1183
- withDescription(description: string, defaultTitle?: string): DocFileContentMdValue<T>;
1151
+ withDescription(description: string, defaultTitle?: string): DocFileMdContentValue<T>;
1184
1152
  /**
1185
- * コンテンツを更新
1153
+ * Update content
1186
1154
  */
1187
- withContent(content: string): DocFileContentMdValue<T>;
1155
+ withContent(content: string): DocFileMdContentValue<T>;
1188
1156
  /**
1189
- * FrontMatterを更新
1157
+ * Update FrontMatter
1190
1158
  */
1191
- withFrontMatter<U extends FrontMatterSchema>(frontMatter: DocFrontMatterMdValue<U>, zodSchema: U): DocFileContentMdValue<U>;
1159
+ withMeta<U extends DocCustomSchema>(meta: DocFileMdMetaValue<U>): DocFileMdContentValue<U>;
1192
1160
  /**
1193
- * FrontMatterの特定のプロパティを更新
1161
+ * Update specific property of FrontMatter
1194
1162
  */
1195
- withFrontMatterProperty(key: string, value: unknown): DocFileContentMdValue<T>;
1163
+ withMetaProperty<K extends keyof T>(key: K, value: BaseFieldValueType<ExtractFieldType<T[K]>>): DocFileMdContentValue<T>;
1196
1164
  /**
1197
- * Markdownテキストから生成
1165
+ * Generate from Markdown text
1198
1166
  */
1199
- static fromMarkdown<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(markdown: string, zodSchema?: T): DocFileContentMdValue<T>;
1167
+ static fromMarkdown<T extends DocCustomSchema>(markdown: string, customSchema: T): DocFileMdContentValue<T>;
1200
1168
  /**
1201
- * 完全なMarkdownテキストを生成
1169
+ * Generate complete Markdown text
1202
1170
  */
1203
1171
  toMarkdownText(): string;
1204
1172
  /**
1205
- * FrontMatterとbodyを結合した完全なテキストを生成
1173
+ * Generate complete text combining FrontMatter and body
1206
1174
  */
1207
1175
  toText(): string;
1208
1176
  /**
1209
- * 空のコンテンツを生成
1177
+ * Generate empty content
1210
1178
  */
1211
- static empty<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(title: string, zodSchema: T): DocFileContentMdValue<T>;
1179
+ static empty<T extends DocCustomSchema = DocCustomSchema>(title: string, customSchema: T): DocFileMdContentValue<T>;
1212
1180
  /**
1213
- * JSON形式で出力
1181
+ * Output in JSON format
1214
1182
  */
1215
- toJson(): DocFileContentMd;
1183
+ toJson(): DocFileMdContent<T>;
1216
1184
  }
1217
1185
 
1218
1186
  /**
1219
- * ドキュメントのファイル
1187
+ * Markdown file entity
1220
1188
  */
1221
- declare class DocFileMdEntity {
1222
- readonly value: DocFileMd;
1223
- constructor(value: DocFileMd);
1189
+ declare class DocFileMdEntity<T extends DocCustomSchema> {
1190
+ readonly value: DocFileMd<T>;
1191
+ private readonly customSchema;
1192
+ constructor(value: DocFileMd<T>, customSchema: T);
1224
1193
  /**
1225
- * コンテンツ
1194
+ * Content
1226
1195
  */
1227
- get content(): DocFileContentMdValue;
1196
+ get content(): DocFileMdContentValue<T>;
1228
1197
  /**
1229
- * パス情報
1198
+ * Path information
1230
1199
  */
1231
1200
  get path(): DocFilePath;
1232
1201
  /**
1233
- * コンテンツを更新
1202
+ * Update content
1234
1203
  */
1235
- withContent(content: DocFileContentMdValue): DocFileMdEntity;
1204
+ withContent(content: DocFileMdContentValue<T>): DocFileMdEntity<T>;
1236
1205
  /**
1237
- * パスを更新
1206
+ * Update path
1238
1207
  */
1239
- withPath(path: DocFilePath): DocFileMdEntity;
1208
+ withPath(path: DocFilePath): DocFileMdEntity<T>;
1209
+ withMeta(meta: DocFileMdMetaValue<T>): DocFileMdEntity<T>;
1210
+ withTitle(title: string): DocFileMdEntity<T>;
1211
+ withDescription(description: string, defaultTitle?: string): DocFileMdEntity<T>;
1240
1212
  /**
1241
- * JSON形式に変換
1213
+ * Convert to JSON format
1242
1214
  */
1243
- toJson(): DocFileMd;
1215
+ toJson(): DocFileMd<T>;
1244
1216
  }
1245
1217
 
1246
- type Props$6 = {
1218
+ type Props$6<T extends DocCustomSchema> = {
1247
1219
  path: string;
1248
1220
  fileSystem: DocFileSystem;
1249
1221
  pathSystem: DocPathSystem;
1222
+ customSchema: T;
1223
+ config: DocClientConfig;
1250
1224
  };
1251
1225
  /**
1252
- * ファイルの参照
1226
+ * File reference
1253
1227
  */
1254
- declare class DocFileMdReference {
1228
+ declare class DocFileMdReference<T extends DocCustomSchema> {
1255
1229
  private readonly props;
1256
1230
  private readonly pathSystem;
1257
- constructor(props: Props$6);
1231
+ private readonly customSchema;
1232
+ constructor(props: Props$6<T>);
1258
1233
  get fileSystem(): DocFileSystem;
1259
1234
  get basePath(): string;
1260
1235
  get path(): string;
@@ -1263,106 +1238,96 @@ declare class DocFileMdReference {
1263
1238
  get archivedPath(): string;
1264
1239
  get name(): string;
1265
1240
  get nameWithExtension(): string;
1266
- directory(): DocDirectoryReference;
1267
- read(): Promise<Error | DocFileMdEntity>;
1268
- /**
1269
- * ファイルの内容を読み込む
1270
- */
1271
- readContent(): Promise<Error | string>;
1241
+ exists(): Promise<boolean>;
1242
+ read(): Promise<DocFileMdEntity<T> | Error>;
1272
1243
  /**
1273
- * ファイルに内容を書き込む
1244
+ * Read file content
1274
1245
  */
1275
- writeContent(content: string): Promise<void>;
1246
+ readText(): Promise<Error | string>;
1276
1247
  /**
1277
- * Entityを書き込む
1248
+ * Write entity
1278
1249
  */
1279
- write(entity: DocFileMdEntity): Promise<void>;
1250
+ write(entity: DocFileMdEntity<T>): Promise<null>;
1251
+ writeText(text: string): Promise<void>;
1280
1252
  /**
1281
- * 新しいファイルをデフォルトコンテンツで作成
1253
+ * Create new file with default content
1282
1254
  */
1283
1255
  writeDefault(): Promise<void>;
1284
1256
  /**
1285
- * ファイルを削除
1257
+ * Delete file
1286
1258
  */
1287
1259
  delete(): Promise<Error | null>;
1288
1260
  /**
1289
- * ファイルが存在するか確認(アーカイブも含む)
1290
- */
1291
- exists(): Promise<boolean>;
1292
- /**
1293
- * ファイルをコピー
1261
+ * Copy file
1294
1262
  */
1295
1263
  copyTo(destinationPath: string): Promise<void>;
1296
1264
  /**
1297
- * ファイルを移動
1265
+ * Move file
1298
1266
  */
1299
1267
  moveTo(destinationPath: string): Promise<void>;
1300
1268
  /**
1301
- * ファイルのサイズを取得(バイト単位)
1302
- */
1303
- size(): Promise<number>;
1304
- /**
1305
- * ファイルの最終更新日時を取得
1269
+ * Move file to archive and return new reference
1306
1270
  */
1307
- lastModified(): Promise<Date>;
1271
+ archive(archiveDirectoryName?: string): Promise<DocFileMdReference<T>>;
1308
1272
  /**
1309
- * ファイルの作成日時を取得
1273
+ * Restore file from archive and return new reference
1310
1274
  */
1311
- createdAt(): Promise<Date>;
1275
+ restore(archiveDirectoryName?: string): Promise<DocFileMdReference<T>>;
1312
1276
  /**
1313
- * ファイルをアーカイブに移動し、新しい参照を返す
1277
+ * Get file size in bytes
1314
1278
  */
1315
- archive(archiveDirectoryName?: string): Promise<DocFileMdReference>;
1279
+ size(): Promise<number>;
1316
1280
  /**
1317
- * ファイルをアーカイブから復元し、新しい参照を返す
1281
+ * Get file last modified time
1318
1282
  */
1319
- restore(archiveDirectoryName?: string): Promise<DocFileMdReference>;
1283
+ lastModified(): Promise<Date>;
1320
1284
  /**
1321
- * スキーマに基づいてリレーションを取得する
1285
+ * Get file creation time
1322
1286
  */
1323
- relation(key: string): Promise<DocFileMdReference | Error | null>;
1287
+ createdAt(): Promise<Date>;
1288
+ directory(): DocDirectoryReference<T>;
1324
1289
  /**
1325
- * 同じディレクトリのindex.mdを取得する
1290
+ * Get relation based on schema
1326
1291
  */
1327
- getDirectoryIndex(): Promise<DocFileIndexReference | null>;
1292
+ relation<U extends DocCustomSchema = DocCustomSchema>(key: RelationKeys<T>, targetSchema?: U): Promise<DocFileMdReference<U> | Error | null>;
1328
1293
  /**
1329
- * 複数のリレーションを取得する
1294
+ * Get index.md in the same directory
1330
1295
  */
1331
- relations(key: string): Promise<DocFileMdReference[]>;
1296
+ directoryIndex(): Promise<DocFileIndexReference<T> | null>;
1332
1297
  /**
1333
- * スキーマに基づいて複数のリレーションを取得する
1298
+ * Get multiple relations based on schema
1334
1299
  */
1335
- multiRelation(key: string): Promise<DocFileMdReference[]>;
1300
+ relations<U extends DocCustomSchema = DocCustomSchema>(key: MultiRelationKeys<T>, customSchema?: U): Promise<DocFileMdReference<U>[]>;
1336
1301
  /**
1337
- * FrontMatterを型安全に読み込む
1302
+ * File: Markdown > FrontMatter
1338
1303
  */
1339
- readFrontMatter<T extends z.ZodTypeAny = z.ZodTypeAny>(zodSchema?: T): Promise<DocFrontMatterMdValue<T> | Error>;
1304
+ readFrontMatter(): Promise<DocFileMdMetaValue<T> | Error>;
1340
1305
  /**
1341
- * FrontMatterを型安全に更新
1306
+ * File: Markdown > FrontMatter
1342
1307
  */
1343
- updateFrontMatter<T extends FrontMatterSchema = typeof zDocFileMdFrontMatter>(key: string, value: unknown, zodSchema?: T): Promise<undefined | Error>;
1308
+ updateFrontMatter<K extends keyof T>(key: K, value: BaseFieldValueType<ExtractFieldType<T[K]>>): Promise<this | Error>;
1344
1309
  }
1345
1310
 
1346
1311
  /**
1347
- * ドキュメントのファイル
1312
+ * Unknown file entity
1348
1313
  */
1349
1314
  declare class DocFileUnknownEntity {
1350
1315
  readonly value: DocFileUnknown;
1351
1316
  constructor(value: DocFileUnknown);
1352
1317
  /**
1353
- * コンテンツ
1318
+ * Content
1354
1319
  */
1355
1320
  get content(): string;
1356
1321
  /**
1357
- * パス情報
1322
+ * Path information
1358
1323
  */
1359
1324
  get path(): DocFilePath;
1360
1325
  /**
1361
- * コンテンツを更新
1326
+ * Update content
1362
1327
  */
1363
1328
  withContent(content: string): DocFileUnknownEntity;
1364
1329
  /**
1365
- * パスを更新
1330
+ * Update path
1366
1331
  */
1367
1332
  withPath(path: DocFilePath): DocFileUnknownEntity;
1368
1333
  toJson(): DocFileUnknown;
@@ -1372,9 +1337,10 @@ type Props$5 = {
1372
1337
  path: string;
1373
1338
  fileSystem: DocFileSystem;
1374
1339
  pathSystem: DocPathSystem;
1340
+ config: DocClientConfig;
1375
1341
  };
1376
1342
  /**
1377
- * ファイルの参照
1343
+ * File reference
1378
1344
  */
1379
1345
  declare class DocFileUnknownReference {
1380
1346
  private readonly props;
@@ -1386,78 +1352,83 @@ declare class DocFileUnknownReference {
1386
1352
  get directoryPath(): string;
1387
1353
  get fileFullPath(): string;
1388
1354
  get durectoryPath(): string;
1389
- directory(): DocDirectoryReference;
1390
- read(): Promise<Error | DocFileMdEntity | DocFileUnknownEntity>;
1355
+ directory<T extends DocCustomSchema>(customSchema: T): DocDirectoryReference<T>;
1356
+ directory(): DocDirectoryReference<DocCustomSchema>;
1357
+ read(): Promise<Error | DocFileUnknownEntity>;
1391
1358
  /**
1392
- * ファイルの内容を読み込む
1359
+ * Read file content
1393
1360
  */
1394
1361
  readContent(): Promise<Error | string>;
1395
1362
  /**
1396
- * ファイルに内容を書き込む
1363
+ * Write content to file
1397
1364
  */
1398
1365
  writeContent(content: string): Promise<void>;
1399
1366
  /**
1400
- * Entityを書き込む
1367
+ * Write entity
1401
1368
  */
1402
1369
  write(entity: DocFileUnknownEntity): Promise<void>;
1403
1370
  /**
1404
- * 生のコンテンツを書き込む
1371
+ * Write raw content
1405
1372
  */
1406
1373
  writeRaw(content: string): Promise<void>;
1407
1374
  /**
1408
- * ファイルを削除
1375
+ * Delete file
1409
1376
  */
1410
1377
  delete(): Promise<Error | null>;
1411
1378
  /**
1412
- * ファイルが存在するか確認
1379
+ * Check if file exists
1413
1380
  */
1414
1381
  exists(): Promise<boolean>;
1415
1382
  /**
1416
- * ファイルをコピー
1383
+ * Copy file
1417
1384
  */
1418
1385
  copyTo(destinationPath: string): Promise<void>;
1419
1386
  /**
1420
- * ファイルを移動
1387
+ * Move file
1421
1388
  */
1422
1389
  moveTo(destinationPath: string): Promise<void>;
1423
1390
  /**
1424
- * ファイルのサイズを取得(バイト単位)
1391
+ * Get file size in bytes
1425
1392
  */
1426
1393
  size(): Promise<number>;
1427
1394
  /**
1428
- * ファイルの最終更新日時を取得
1395
+ * Get file last modified time
1429
1396
  */
1430
1397
  lastModified(): Promise<Date>;
1431
1398
  /**
1432
- * ファイルの作成日時を取得
1399
+ * Get file creation time
1433
1400
  */
1434
1401
  createdAt(): Promise<Date>;
1435
1402
  /**
1436
- * ファイルをアーカイブに移動し、新しい参照を返す
1403
+ * Move file to archive and return new reference
1437
1404
  */
1438
1405
  archive(archiveDirectoryName?: string): Promise<DocFileUnknownReference>;
1439
1406
  /**
1440
- * ファイルをアーカイブから復元し、新しい参照を返す
1407
+ * Restore file from archive and return new reference
1441
1408
  */
1442
1409
  restore(archiveDirectoryName?: string): Promise<DocFileUnknownReference>;
1443
1410
  }
1444
1411
 
1445
- type Props$4 = {
1412
+ type Props$4<T extends DocCustomSchema> = {
1413
+ customSchema: T;
1446
1414
  path: string;
1447
1415
  indexFileName: string;
1448
1416
  archiveDirectoryName: string;
1449
1417
  fileSystem: DocFileSystem;
1450
1418
  pathSystem: DocPathSystem;
1419
+ config: DocClientConfig;
1451
1420
  };
1452
1421
  /**
1453
- * ディレクトリの参照
1422
+ * Directory reference
1454
1423
  */
1455
- declare class DocDirectoryReference {
1424
+ declare class DocDirectoryReference<T extends DocCustomSchema> {
1456
1425
  private readonly props;
1457
1426
  private readonly pathSystem;
1458
- constructor(props: Props$4);
1427
+ private readonly customSchema;
1428
+ constructor(props: Props$4<T>);
1459
1429
  get fileSystem(): DocFileSystem;
1460
1430
  get basePath(): string;
1431
+ get config(): DocClientConfig;
1461
1432
  get relativePath(): string;
1462
1433
  get absolutePath(): string;
1463
1434
  get indexFileName(): string;
@@ -1465,57 +1436,39 @@ declare class DocDirectoryReference {
1465
1436
  get archiveDirectoryName(): string;
1466
1437
  fileNames(): Promise<string[]>;
1467
1438
  archivedFileNames(): Promise<string[]>;
1468
- filesGenerator(): AsyncGenerator<DocFileMdReference | DocFileUnknownReference, void, unknown>;
1469
- mdFilesGenerator(): AsyncGenerator<DocFileMdReference, void, unknown>;
1470
- files(): Promise<(DocFileMdReference | DocFileUnknownReference)[]>;
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
- }[]>;
1479
- file(fileName: string): DocFileMdReference | DocFileUnknownReference;
1480
- mdFile(fileName: string): DocFileMdReference;
1481
- readFiles(): Promise<(DocFileMdEntity | DocFileUnknownEntity)[]>;
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
- }[]>;
1439
+ filesGenerator(): AsyncGenerator<DocFileMdReference<T> | DocFileUnknownReference, void, unknown>;
1440
+ mdFilesGenerator(): AsyncGenerator<DocFileMdReference<T>, void, unknown>;
1441
+ files(): Promise<(DocFileMdReference<T> | DocFileUnknownReference)[]>;
1442
+ mdFiles(): Promise<DocFileMdReference<T>[]>;
1443
+ file(fileName: string): Promise<DocFileMdReference<T> | DocFileUnknownReference>;
1444
+ mdFile(fileName: string): Promise<DocFileMdReference<T>>;
1445
+ readFiles(): Promise<(DocFileMdEntity<T> | DocFileUnknownEntity)[]>;
1446
+ readMdFiles(): Promise<DocFileMdEntity<T>[]>;
1490
1447
  readUnknownFiles(): Promise<DocFileUnknownEntity[]>;
1491
1448
  /**
1492
- * サブディレクトリ名の一覧を取得
1449
+ * Get list of subdirectory names
1493
1450
  */
1494
1451
  directoryNames(): Promise<string[]>;
1495
1452
  /**
1496
- * サブディレクトリの参照を取得
1453
+ * Get subdirectory references
1497
1454
  */
1498
- directories(): Promise<DocDirectoryReference[]>;
1455
+ directories(): Promise<DocDirectoryReference<never>[]>;
1499
1456
  /**
1500
- * 単一のサブディレクトリ参照を取得
1457
+ * Get single subdirectory reference
1501
1458
  */
1502
- directory(directoryName: string): DocDirectoryReference;
1503
- indexFile(): DocFileIndexReference;
1504
- readIndexFile(): Promise<DocFileIndexEntity>;
1505
- writeFile(entity: DocFileIndexEntity | DocFileUnknownEntity | DocFileMdEntity): Promise<Error | null>;
1459
+ directory(directoryName: string): DocDirectoryReference<T>;
1460
+ indexFile(): DocFileIndexReference<T>;
1461
+ readIndexFile(): Promise<DocFileIndexEntity<T>>;
1462
+ writeFile(entity: DocFileIndexEntity<T> | DocFileMdEntity<T> | DocFileUnknownEntity): Promise<Error | null>;
1506
1463
  exists(): Promise<boolean>;
1507
1464
  /**
1508
- * 一意なファイル名を生成する
1509
- */
1510
- private generateUniqueFileName;
1511
- /**
1512
- * 指定されたファイル名のファイルが存在するかチェック
1465
+ * Generate unique filename
1513
1466
  */
1514
- private fileExists;
1467
+ private uniqueFileName;
1515
1468
  /**
1516
- * 新しいMarkdownファイルを作成する
1469
+ * Create new Markdown file
1517
1470
  */
1518
- createMdFile(fileName?: string): Promise<DocFileMdReference>;
1471
+ createMdFile(fileName?: string): Promise<DocFileMdReference<T>>;
1519
1472
  }
1520
1473
 
1521
1474
  type Props$3 = {
@@ -1525,7 +1478,7 @@ type Props$3 = {
1525
1478
  title: string;
1526
1479
  };
1527
1480
  /**
1528
- * ツリーファイルノード値オブジェクト
1481
+ * Tree file node value object
1529
1482
  */
1530
1483
  declare class DocTreeFileNodeValue {
1531
1484
  private readonly props;
@@ -1536,28 +1489,30 @@ declare class DocTreeFileNodeValue {
1536
1489
  get title(): string;
1537
1490
  get type(): "file";
1538
1491
  /**
1539
- * プレーンオブジェクトに変換
1492
+ * Convert to plain object
1540
1493
  */
1541
1494
  toJson(): DocTreeFileNode;
1542
1495
  /**
1543
- * プロパティから作成
1496
+ * Create from properties
1544
1497
  */
1545
1498
  static from(props: Props$3): DocTreeFileNodeValue;
1546
1499
  /**
1547
- * JSONオブジェクトから作成
1500
+ * Create from JSON object
1548
1501
  */
1549
1502
  static fromJson(json: unknown): DocTreeFileNodeValue;
1550
1503
  }
1551
1504
 
1505
+ type DocTreeNodeValue = DocTreeFileNodeValue | DocTreeDirectoryNodeValue;
1506
+
1552
1507
  type Props$2 = {
1553
1508
  name: string;
1554
1509
  path: string;
1555
1510
  icon: string;
1556
1511
  title: string;
1557
- children: (DocTreeFileNodeValue | DocTreeDirectoryNodeValue)[];
1512
+ children: DocTreeNodeValue[];
1558
1513
  };
1559
1514
  /**
1560
- * ツリーディレクトリノード値オブジェクト
1515
+ * Tree directory node value object
1561
1516
  */
1562
1517
  declare class DocTreeDirectoryNodeValue {
1563
1518
  private readonly props;
@@ -1566,18 +1521,18 @@ declare class DocTreeDirectoryNodeValue {
1566
1521
  get path(): string;
1567
1522
  get icon(): string;
1568
1523
  get title(): string;
1569
- get children(): (DocTreeFileNodeValue | DocTreeDirectoryNodeValue)[];
1524
+ get children(): DocTreeNodeValue[];
1570
1525
  get type(): "directory";
1571
1526
  /**
1572
- * プレーンオブジェクトに変換
1527
+ * Convert to plain object
1573
1528
  */
1574
1529
  toJson(): DocTreeDirectoryNode;
1575
1530
  /**
1576
- * プロパティから作成
1531
+ * Create from properties
1577
1532
  */
1578
1533
  static from(props: Props$2): DocTreeDirectoryNodeValue;
1579
1534
  /**
1580
- * JSONオブジェクトから作成
1535
+ * Create from JSON object
1581
1536
  */
1582
1537
  static fromJson(json: unknown): DocTreeDirectoryNodeValue;
1583
1538
  }
@@ -1587,83 +1542,85 @@ type Props$1 = {
1587
1542
  pathSystem: DocPathSystem;
1588
1543
  indexFileName: string;
1589
1544
  archiveDirectoryName: string;
1545
+ config: DocClientConfig;
1590
1546
  };
1591
1547
  /**
1592
- * ファイルツリー構築システム
1548
+ * File tree building system
1593
1549
  */
1594
1550
  declare class DocFileTreeSystem {
1595
1551
  private readonly props;
1552
+ private readonly config;
1596
1553
  constructor(props: Props$1);
1597
1554
  /**
1598
- * ファイルツリーを再帰的に構築
1555
+ * Build file tree recursively
1599
1556
  */
1600
- buildFileTree(directoryPath?: string): Promise<(DocTreeFileNodeValue | DocTreeDirectoryNodeValue)[]>;
1557
+ buildFileTree(directoryPath?: string): Promise<DocTreeNodeValue[]>;
1601
1558
  /**
1602
- * ファイルノードを作成
1559
+ * Create file node
1603
1560
  */
1604
1561
  private createFileNode;
1605
1562
  /**
1606
- * ディレクトリノードを作成
1563
+ * Create directory node
1607
1564
  */
1608
1565
  private createDirectoryNode;
1609
1566
  /**
1610
- * インデックスファイル参照を作成
1567
+ * Create index file reference
1611
1568
  */
1612
1569
  private createIndexFileReference;
1613
1570
  /**
1614
- * MDファイル参照を作成
1571
+ * Create MD file reference
1615
1572
  */
1616
1573
  private createMdFileReference;
1617
1574
  /**
1618
- * ディレクトリツリーを再帰的に構築(ディレクトリのみ)
1575
+ * Build directory tree recursively (directories only)
1619
1576
  */
1620
1577
  buildDirectoryTree(directoryPath?: string): Promise<DocTreeDirectoryNodeValue[]>;
1621
1578
  /**
1622
- * ディレクトリツリー用のディレクトリノードを作成
1579
+ * Create directory node for directory tree
1623
1580
  */
1624
1581
  private createDirectoryNodeForTree;
1625
1582
  }
1626
1583
 
1627
1584
  /**
1628
- * Markdownの解析と処理システム
1585
+ * Markdown parsing and processing system
1629
1586
  */
1630
1587
  declare class DocMarkdownSystem {
1631
1588
  private readonly frontMatterSeparator;
1632
1589
  constructor();
1633
1590
  /**
1634
- * FrontMatterの区切り線を検出
1591
+ * Detect FrontMatter separator line
1635
1592
  */
1636
1593
  private detectFrontMatterSeparator;
1637
1594
  /**
1638
- * FrontMatterを抽出
1595
+ * Extract FrontMatter
1639
1596
  */
1640
1597
  extractFrontMatter(text: string): string | null;
1641
1598
  /**
1642
- * FrontMatterを除去したbody(titleとdescriptionを含む)
1599
+ * Extract body without FrontMatter (includes title and description)
1643
1600
  */
1644
1601
  extractBody(text: string): string;
1645
1602
  /**
1646
- * タイトル
1603
+ * Extract title
1647
1604
  */
1648
1605
  extractTitle(text: string): string | null;
1649
1606
  /**
1650
- * 説明(タイトルの後の最初の段落)
1607
+ * Extract description (first paragraph after title)
1651
1608
  */
1652
1609
  extractDescription(text: string): string | null;
1653
1610
  /**
1654
- * body内のタイトルを更新
1611
+ * Update title in body
1655
1612
  */
1656
1613
  updateTitle(text: string, newTitle: string): string;
1657
1614
  /**
1658
- * body内の説明を更新
1615
+ * Update description in body
1659
1616
  */
1660
1617
  updateDescription(text: string, newDescription: string, defaultTitle: string): string;
1661
1618
  /**
1662
- * 空行をスキップ
1619
+ * Skip empty lines
1663
1620
  */
1664
1621
  private skipEmptyLines;
1665
1622
  /**
1666
- * Markdownテキストを生成(タイトル + 説明 + body)
1623
+ * Generate Markdown text (title + description + body)
1667
1624
  */
1668
1625
  static from(title: string, description: string, body: string): string;
1669
1626
  }
@@ -1674,327 +1631,169 @@ type Props = {
1674
1631
  markdownSystem?: DocMarkdownSystem;
1675
1632
  fileTreeSystem?: DocFileTreeSystem;
1676
1633
  /**
1677
- * default: "index.md"
1634
+ * Configuration
1678
1635
  */
1679
- indexFileName?: string;
1680
- /**
1681
- * default: "_"
1682
- */
1683
- archiveDirectoryName?: string;
1636
+ config?: DocClientConfig;
1684
1637
  };
1685
1638
  declare class DocClient {
1686
1639
  readonly fileSystem: DocFileSystem;
1687
1640
  readonly pathSystem: DocPathSystem;
1688
1641
  readonly markdownSystem: DocMarkdownSystem;
1689
1642
  readonly fileTreeSystem: DocFileTreeSystem;
1690
- readonly indexFileName: string;
1691
- readonly archiveDirectoryName: string;
1643
+ readonly config: DocClientConfig;
1692
1644
  constructor(props: Props);
1693
1645
  basePath(): string;
1694
- /**
1695
- * ファイル参照を取得
1696
- */
1697
- file(relativePath: string): DocFileMdReference | DocFileUnknownReference;
1698
- /**
1699
- * Markdownファイル参照を取得
1700
- */
1701
- mdFile(relativePath: string): DocFileMdReference;
1702
- /**
1703
- * インデックスファイル参照を取得
1704
- */
1705
- indexFile(directoryPath: string): DocFileIndexReference;
1706
- /**
1707
- * ディレクトリ参照を取得
1708
- */
1709
- directory(relativePath: string): DocDirectoryReference;
1710
- /**
1711
- * ファイルツリーを取得
1712
- */
1713
- fileTree(directoryPath?: string): Promise<(DocTreeFileNode | DocTreeDirectoryNode)[]>;
1714
- /**
1715
- * ディレクトリツリーを取得(ディレクトリのみ)
1716
- */
1646
+ file(relativePath: string): DocFileMdReference<DocCustomSchema> | DocFileUnknownReference;
1647
+ file<T extends DocCustomSchema>(relativePath: string, customSchema: T): DocFileMdReference<T> | DocFileUnknownReference;
1648
+ mdFile(relativePath: string): DocFileMdReference<DocCustomSchema>;
1649
+ mdFile<T extends DocCustomSchema>(relativePath: string, customSchema: T): DocFileMdReference<T>;
1650
+ indexFile(relativePath: string): DocFileIndexReference<DocCustomSchema>;
1651
+ indexFile<T extends DocCustomSchema>(relativePath: string, customSchema: T): DocFileIndexReference<T>;
1652
+ directory(relativePath: string): DocDirectoryReference<DocCustomSchema>;
1653
+ directory<T extends DocCustomSchema>(relativePath: string, customSchema: T): DocDirectoryReference<T>;
1654
+ fileTree(directoryPath?: string): Promise<DocTreeNode[]>;
1717
1655
  directoryTree(directoryPath?: string): Promise<DocTreeDirectoryNode[]>;
1718
1656
  }
1719
1657
 
1720
1658
  /**
1721
- * フロントマターの処理を担当
1722
- */
1723
- declare class DocContentMdFrontMatterValue {
1724
- readonly data: Record<string, unknown> | null;
1725
- readonly yamlText: string;
1726
- constructor(data: Record<string, unknown> | null, yamlText?: string);
1727
- /**
1728
- * YAMLテキストからフロントマターインスタンスを作成
1729
- */
1730
- static fromYamlText(yamlText: string): DocContentMdFrontMatterValue;
1731
- /**
1732
- * Markdownテキストからフロントマターインスタンスを作成
1733
- */
1734
- static fromMarkdown(markdownText: string): DocContentMdFrontMatterValue;
1735
- /**
1736
- * 空のフロントマターインスタンスを作成
1737
- */
1738
- static empty(): DocContentMdFrontMatterValue;
1739
- /**
1740
- * フロントマターデータからインスタンスを作成
1741
- */
1742
- static fromFrontMatter(data: Record<string, unknown>): DocContentMdFrontMatterValue;
1743
- /**
1744
- * フロントマターをYAMLテキストに変換
1745
- */
1746
- frontMatterText(): string;
1747
- /**
1748
- * フロントマターを更新した新しいインスタンスを作成
1749
- */
1750
- update(draft: Record<string, unknown>): DocContentMdFrontMatterValue;
1751
- /**
1752
- * フロントマターが空かどうか
1753
- */
1754
- isEmpty(): boolean;
1755
- /**
1756
- * 指定したキーの値を取得
1757
- */
1758
- get(key: string): unknown;
1759
- /**
1760
- * 指定したキーが存在するか
1761
- */
1762
- has(key: string): boolean;
1763
- /**
1764
- * フロントマターのキー一覧を取得
1765
- */
1766
- keys(): string[];
1767
- }
1768
-
1769
- /**
1770
- * Markdownの解析と生成
1771
- */
1772
- declare class DocContentMdValue {
1773
- readonly text: string;
1774
- constructor(text: string);
1775
- /**
1776
- * Front Matter
1777
- */
1778
- get frontMatter(): DocContentMdFrontMatterValue;
1779
- /**
1780
- * body
1781
- */
1782
- get content(): string;
1783
- /**
1784
- * title
1785
- */
1786
- get title(): string;
1787
- /**
1788
- * H1の次の段落、またはH1がない場合は最初の段落をdescriptionとして取得する
1789
- */
1790
- get description(): string | null;
1791
- /**
1792
- * 新しいフロントマターとコンテンツでMarkdownインスタンスを作成
1793
- */
1794
- static fromProps(props: {
1795
- frontMatter: Record<string, unknown>;
1796
- content: string;
1797
- }): DocContentMdValue;
1798
- /**
1799
- * 現在のフロントマターをYAMLテキストに変換する
1800
- */
1801
- frontMatterToText(): string;
1802
- /**
1803
- * 現在のフロントマターを更新して新しいMarkdownテキストを生成
1804
- */
1805
- updateFrontMatter(draft: Record<string, unknown>): string;
1806
- /**
1807
- * 新しいフロントマターでOpenMarkdownインスタンスを作成
1808
- */
1809
- withFrontMatter(frontMatter: Record<string, unknown>): DocContentMdValue;
1810
- /**
1811
- * フロントマターを更新した新しいOpenMarkdownインスタンスを作成
1812
- */
1813
- withUpdatedFrontMatter(draft: Record<string, unknown>): DocContentMdValue;
1814
- /**
1815
- * マークダウンをtitle、description、本文の3つの部分に分離する
1816
- */
1817
- private parseContentParts;
1818
- /**
1819
- * title、description、本文からマークダウンを構築する
1820
- */
1821
- private buildContent;
1822
- /**
1823
- * H1タイトルを更新した新しいOpenMarkdownインスタンスを作成
1824
- */
1825
- withTitle(newTitle: string): DocContentMdValue;
1826
- /**
1827
- * H1の次のdescription段落を更新した新しいOpenMarkdownインスタンスを作成
1828
- * @param newDescription 新しいdescription
1829
- * @param defaultTitle H1がない場合に使用するデフォルトタイトル
1830
- */
1831
- withDescription(newDescription: string, defaultTitle?: string): DocContentMdValue;
1832
- }
1833
-
1834
- /**
1835
- * ファイルパス情報の値オブジェクト
1659
+ * Value object for file path information
1836
1660
  */
1837
1661
  declare class DocFilePathValue {
1838
1662
  readonly value: DocFilePath;
1839
1663
  private readonly pathSystem;
1840
1664
  constructor(value: DocFilePath, pathSystem: DocPathSystem);
1841
1665
  /**
1842
- * ファイル名(拡張子なし)
1666
+ * File name without extension
1843
1667
  */
1844
1668
  get name(): string;
1845
1669
  /**
1846
- * ファイルパス(相対パス)
1670
+ * File path (relative path)
1847
1671
  */
1848
1672
  get path(): string;
1849
1673
  /**
1850
- * ファイル名(拡張子付き)
1674
+ * File name with extension
1851
1675
  */
1852
1676
  get nameWithExtension(): string;
1853
1677
  /**
1854
- * フルパス(絶対パス)
1678
+ * Full path (absolute path)
1855
1679
  */
1856
1680
  get fullPath(): string;
1857
1681
  /**
1858
- * ディレクトリパス
1682
+ * Directory path
1859
1683
  */
1860
1684
  get directoryPath(): string;
1861
1685
  /**
1862
- * 拡張子
1686
+ * Extension
1863
1687
  */
1864
1688
  get extension(): string;
1865
1689
  /**
1866
- * アーカイブされているかどうか
1690
+ * Whether the file is archived
1867
1691
  */
1868
1692
  get isArchived(): boolean;
1869
1693
  /**
1870
- * 相対パスからインスタンスを生成(DI対応)
1694
+ * Create instance from relative path (DI support)
1871
1695
  */
1872
1696
  static fromPathWithSystem(filePath: string, pathSystem: DocPathSystem, basePath?: string): DocFilePathValue;
1873
1697
  /**
1874
- * JSON形式で出力
1698
+ * Export as JSON format
1875
1699
  */
1876
1700
  toJson(): DocFilePath;
1877
1701
  }
1878
1702
 
1879
- type DocDirectoryPath = {
1703
+ type Value = {
1880
1704
  path: string;
1881
1705
  name: string;
1882
1706
  fullPath: string;
1883
1707
  };
1884
1708
  /**
1885
- * ディレクトリパスを表す値オブジェクト
1709
+ * Value object representing a directory path
1886
1710
  */
1887
1711
  declare class DocDirectoryPathValue {
1888
1712
  private readonly value;
1889
1713
  private readonly pathSystem;
1890
- constructor(value: DocDirectoryPath, pathSystem: DocPathSystem);
1714
+ constructor(value: Value, pathSystem: DocPathSystem);
1891
1715
  /**
1892
- * 相対ディレクトリパス
1716
+ * Relative directory path
1893
1717
  */
1894
1718
  get path(): string;
1895
1719
  /**
1896
- * ディレクトリ名
1720
+ * Directory name
1897
1721
  */
1898
1722
  get name(): string;
1899
1723
  /**
1900
- * 親ディレクトリパスを取得
1724
+ * Get parent directory path
1901
1725
  */
1902
1726
  get parent(): DocDirectoryPathValue | null;
1903
1727
  /**
1904
- * 親ディレクトリパス
1728
+ * Parent directory path
1905
1729
  */
1906
1730
  get parentPath(): string;
1907
1731
  /**
1908
- * 深さ(ディレクトリの階層数)
1732
+ * Depth (number of directory levels)
1909
1733
  */
1910
1734
  get depth(): number;
1911
1735
  /**
1912
- * パスセグメント(ディレクトリの配列)
1736
+ * Path segments (array of directories)
1913
1737
  */
1914
1738
  get segments(): string[];
1915
1739
  /**
1916
- * ルートからの相対パス(先頭のスラッシュなし)
1740
+ * Relative path from root (without leading slash)
1917
1741
  */
1918
1742
  get normalizedPath(): string;
1919
1743
  /**
1920
- * アーカイブディレクトリかどうか(ディレクトリ名が「_」の場合)
1744
+ * Whether this is an archive directory (directory name is "_")
1921
1745
  */
1922
1746
  get isArchived(): boolean;
1923
1747
  /**
1924
- * 隠しディレクトリかどうか
1748
+ * Whether this is a hidden directory
1925
1749
  */
1926
1750
  get isHidden(): boolean;
1927
1751
  /**
1928
- * ルートディレクトリかどうか
1752
+ * Whether this is the root directory
1929
1753
  */
1930
1754
  get isRoot(): boolean;
1931
1755
  /**
1932
- * 絶対パス
1756
+ * Absolute path
1933
1757
  */
1934
1758
  get fullPath(): string;
1935
1759
  /**
1936
- * インデックスファイルのパスを取得
1760
+ * Get index file path
1937
1761
  */
1938
1762
  get indexFile(): DocFilePathValue;
1939
1763
  /**
1940
- * ファイルパスを作成
1764
+ * Create file path
1941
1765
  */
1942
1766
  file(fileName: string): DocFilePathValue;
1943
1767
  /**
1944
- * サブディレクトリのパスを作成
1768
+ * Create subdirectory path
1945
1769
  */
1946
1770
  subdirectory(dirName: string): DocDirectoryPathValue;
1947
1771
  /**
1948
- * 相対パスからインスタンスを生成(DI対応)
1772
+ * Create instance from relative path (DI support)
1949
1773
  */
1950
1774
  static fromPathWithSystem(dirPath: string, basePath: string, pathSystem: DocPathSystem): DocDirectoryPathValue;
1951
1775
  /**
1952
- * JSON形式で出力
1776
+ * Export as JSON format
1953
1777
  */
1954
- toJson(): DocDirectoryPath;
1778
+ toJson(): Value;
1955
1779
  /**
1956
- * パスが等しいかどうか
1780
+ * Check if paths are equal
1957
1781
  */
1958
1782
  equals(other: DocDirectoryPathValue): boolean;
1959
1783
  /**
1960
- * 指定されたディレクトリがこのディレクトリの子孫かどうか
1784
+ * Check if specified directory is a descendant of this directory
1961
1785
  */
1962
1786
  contains(other: DocDirectoryPathValue): boolean;
1963
1787
  }
1964
1788
 
1965
1789
  /**
1966
- * スキーマフィールドファクトリ
1790
+ * Multiple value type fields (multi-* types)
1967
1791
  */
1968
- declare class DocSchemaFieldFactory {
1969
- constructor();
1970
- /**
1971
- * スキーマエントリから適切な型のフィールドを生成
1972
- */
1973
- fromSchemaEntry(key: string, field: DocSchemaField): DocSchemaFieldValue;
1974
- /**
1975
- * 未検証のデータから正規化して生成
1976
- */
1977
- fromUnknown(key: string, data: unknown): DocSchemaFieldValue;
1978
- /**
1979
- * フィールド定義を正規化
1980
- */
1981
- private normalizeField;
1982
- /**
1983
- * デフォルトのテキストフィールドを作成
1984
- */
1985
- private createDefaultTextField;
1986
- /**
1987
- * 型名を正規化
1988
- */
1989
- private normalizeType;
1990
- /**
1991
- * オブジェクトからプロパティを安全に取得
1992
- */
1993
- private getFieldProperty;
1994
- /**
1995
- * 型固有のデフォルト値を取得(イミュータブル)
1996
- */
1997
- private getTypeSpecificDefaults;
1998
- }
1792
+ type DocSchemaFieldMultipleTypes<T extends RecordKey> = DocSchemaFieldMultiTextValue<T> | DocSchemaFieldMultiNumberValue<T> | DocSchemaFieldMultiSelectTextValue<T> | DocSchemaFieldMultiSelectNumberValue<T> | DocSchemaFieldMultiRelationValue<T>;
1793
+ /**
1794
+ * Single value type fields
1795
+ */
1796
+ type DocSchemaFieldSingleTypes<T extends RecordKey> = DocSchemaFieldTextSingleValue<T> | DocSchemaFieldNumberSingleValue<T> | DocSchemaFieldBooleanSingleValue<T> | DocSchemaFieldSelectTextSingleValue<T> | DocSchemaFieldSelectNumberSingleValue<T> | DocSchemaFieldRelationSingleValue<T>;
1797
+ type DocSchemaFieldValue<T extends RecordKey> = DocSchemaFieldSingleTypes<T> | DocSchemaFieldMultipleTypes<T>;
1999
1798
 
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 };
1799
+ export { type BaseFieldValueType, DocClient, type DocClientConfig, type DocClientConfigInput, 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, type DocDirectory, DocDirectoryPathValue, DocDirectoryReference, type DocFieldMultiNumber, type DocFieldMultiRelation, type DocFieldMultiText, type DocFile, 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 DocFileNode, type DocFilePath, DocFilePathValue, DocFileRelationReference, DocFileSystem, 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, type DocRelation, type DocRelationField, type DocRelationFile, DocRelationFileValue, DocRelationValue, type DocSchemaFieldBoolean, DocSchemaFieldBooleanSingleValue, type DocSchemaFieldMultiSelectNumber, type DocSchemaFieldMultiSelectText, type DocSchemaFieldNumber, DocSchemaFieldMultiNumberValue as DocSchemaFieldNumberMultipleValue, DocSchemaFieldNumberSingleValue, type DocSchemaFieldRelation, DocSchemaFieldMultiRelationValue as DocSchemaFieldRelationMultipleValue, DocSchemaFieldRelationSingleValue, type DocSchemaFieldSelectNumber, DocSchemaFieldMultiSelectNumberValue as DocSchemaFieldSelectNumberMultipleValue, DocSchemaFieldSelectNumberSingleValue, type DocSchemaFieldSelectText, DocSchemaFieldMultiSelectTextValue as DocSchemaFieldSelectTextMultipleValue, DocSchemaFieldSelectTextSingleValue, type DocSchemaFieldText, DocSchemaFieldMultiTextValue as DocSchemaFieldTextMultipleValue, DocSchemaFieldTextSingleValue, type DocSchemaFieldTypeBoolean, type DocSchemaFieldTypeMultiNumber, type DocSchemaFieldTypeMultiRelation, type DocSchemaFieldTypeMultiSelectNumber, type DocSchemaFieldTypeMultiSelectText, type DocSchemaFieldTypeMultiText, type DocSchemaFieldTypeNumber, type DocSchemaFieldTypeRelation, type DocSchemaFieldTypeSelectNumber, type DocSchemaFieldTypeSelectText, type DocSchemaFieldTypeText, type DocSchemaFieldValue, type DocSchemaRelationFieldUnion, type DocTreeDirectoryNode, DocTreeDirectoryNodeValue, type DocTreeFileNode, DocTreeFileNodeValue, type DocTreeNode, type Equals, type ExtractFieldType, type ExtractIndexFieldType, type ExtractRequired, type FieldValueType, DocFileTreeSystem as FileTreeSystem, type GetIndexFieldType, type GetIndexFieldValueType, type GetValueType, type MultiRelationKeys, type OptionalKeys, type RecordKey, type RelationKeys, type RequiredKeys, type SchemaToValueType, zDocClientConfig, zDocCustomSchemaField, zDocCustomSchemaFieldBoolean, zDocCustomSchemaFieldMultiNumber, zDocCustomSchemaFieldMultiRelation, zDocCustomSchemaFieldMultiSelectNumber, zDocCustomSchemaFieldMultiSelectText, zDocCustomSchemaFieldMultiText, zDocCustomSchemaFieldNumber, zDocCustomSchemaFieldRelation, zDocCustomSchemaFieldSelectNumber, zDocCustomSchemaFieldSelectText, zDocCustomSchemaFieldText, 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 };