@interactive-inc/docs-client 0.0.16 → 0.0.17
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 +814 -787
- package/build/index.js +27 -22
- package/debug/debug.ts +3 -3
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { zDocClientConfig, zDocFilePath,
|
|
2
|
+
import { zDocClientConfig, zDocFilePath, zDocFileIndexSchemaField, zDocSchemaFieldText, zDocSchemaFieldNumber, zDocSchemaFieldBoolean, zDocSchemaFieldRelation, zDocSchemaFieldSelectText, zDocSchemaFieldSelectNumber, zDocSchemaFieldMultiText, zDocSchemaFieldMultiNumber, zDocSchemaFieldMultiRelation, zDocSchemaFieldMultiSelectText, zDocSchemaFieldMultiSelectNumber, zDocRelation, zDocRelationFile, zDocMetaFieldRelation, zDocMetaFieldMultiRelation, zDocMetaFieldText, zDocMetaFieldNumber, zDocMetaFieldBoolean, zDocMetaFieldMultiText, zDocMetaFieldMultiNumber, zDocMetaFieldMultiBoolean, zDocFileUnknown, zDocMetaField, zDocMetaFieldSelectText, zDocMetaFieldSelectNumber, zDocMetaFieldMultiSelectText, zDocMetaFieldMultiSelectNumber, zDocMetaFieldTypeText, zDocMetaFieldTypeNumber, zDocMetaFieldTypeBoolean, zDocMetaFieldTypeSelectText, zDocMetaFieldTypeSelectNumber, zDocMetaFieldTypeRelation, zDocMetaFieldType, zDocRelationField } from './models.js';
|
|
3
3
|
export { zDocCustomSchema, zDocCustomSchemaField, zDocCustomSchemaFieldBoolean, zDocCustomSchemaFieldMultiNumber, zDocCustomSchemaFieldMultiRelation, zDocCustomSchemaFieldMultiSelectNumber, zDocCustomSchemaFieldMultiSelectText, zDocCustomSchemaFieldMultiText, zDocCustomSchemaFieldNumber, zDocCustomSchemaFieldRelation, zDocCustomSchemaFieldSelectNumber, zDocCustomSchemaFieldSelectText, zDocCustomSchemaFieldText, zDocFile, zDocFileIndex, zDocFileIndexContent, zDocFileIndexMeta, zDocFileIndexMetaInput, zDocFileIndexSchema, zDocFileIndexSchemaInput, zDocFileMd, zDocFileMdContent, zDocFileMdContentInput, zDocFileMdInput, zDocFileMdMeta, zDocFileMdMetaInput, zDocMetaFieldTypeMultiNumber, zDocMetaFieldTypeMultiRelation, zDocMetaFieldTypeMultiSelectNumber, zDocMetaFieldTypeMultiSelectText, zDocMetaFieldTypeMultiText, zDocTreeDirectoryNode, zDocTreeFileNode, zDocTreeNode } from './models.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -140,262 +140,592 @@ declare class DocFileSystem {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
|
-
*
|
|
143
|
+
* Meta
|
|
144
144
|
*/
|
|
145
|
-
declare class
|
|
146
|
-
readonly
|
|
147
|
-
readonly
|
|
148
|
-
constructor(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
get
|
|
152
|
-
get description(): string;
|
|
153
|
-
get default(): boolean | null;
|
|
154
|
-
readonly isArray = false;
|
|
155
|
-
readonly isSingle = true;
|
|
156
|
-
readonly isBoolean = true;
|
|
157
|
-
toJson(): DocFileIndexSchemaField;
|
|
145
|
+
declare class DocFileMdMetaValue<T extends DocCustomSchema> {
|
|
146
|
+
readonly value: SchemaToValueType<T>;
|
|
147
|
+
readonly customSchema: T;
|
|
148
|
+
constructor(value: SchemaToValueType<T>, customSchema: T);
|
|
149
|
+
private validateValue;
|
|
150
|
+
private getValueField;
|
|
151
|
+
get keys(): Array<keyof T>;
|
|
158
152
|
/**
|
|
159
|
-
*
|
|
153
|
+
* Return a new instance with a single property updated
|
|
160
154
|
*/
|
|
161
|
-
|
|
162
|
-
static empty(key: RecordKey): DocSchemaFieldBooleanValue<RecordKey>;
|
|
163
|
-
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldBooleanValue<RecordKey>;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Multiple number type schema field
|
|
168
|
-
*/
|
|
169
|
-
declare class DocSchemaFieldMultiNumberValue<T extends RecordKey> {
|
|
170
|
-
readonly key: T;
|
|
171
|
-
readonly value: DocSchemaFieldMultiNumber;
|
|
172
|
-
constructor(key: T, value: DocSchemaFieldMultiNumber);
|
|
173
|
-
get type(): "multi-number";
|
|
174
|
-
get required(): boolean;
|
|
175
|
-
get title(): string;
|
|
176
|
-
get description(): string;
|
|
177
|
-
get default(): number[] | null;
|
|
178
|
-
readonly isArray = true;
|
|
179
|
-
readonly isSingle = false;
|
|
180
|
-
readonly isNumber = true;
|
|
155
|
+
withProperty<K extends keyof T>(key: K, value: BaseFieldValueType<ExtractFieldType<T[K]>>): DocFileMdMetaValue<T>;
|
|
181
156
|
/**
|
|
182
|
-
*
|
|
157
|
+
* Return a new instance with an unknown schema
|
|
158
|
+
* Allows accepting Record<string, unknown> schemas from external sources
|
|
183
159
|
*/
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
constructor(key: T, value: DocSchemaFieldMultiRelation);
|
|
197
|
-
get type(): "multi-relation";
|
|
198
|
-
get required(): boolean;
|
|
199
|
-
get title(): string;
|
|
200
|
-
get description(): string;
|
|
201
|
-
get default(): string[] | null;
|
|
202
|
-
get path(): string;
|
|
203
|
-
readonly isArray = true;
|
|
204
|
-
readonly isSingle = false;
|
|
205
|
-
readonly isRelation = true;
|
|
160
|
+
withUnknownSchema(draft: Record<string, unknown>): DocFileMdMetaValue<DocCustomSchema>;
|
|
161
|
+
schemaField<K extends keyof T>(key: K): T[K];
|
|
162
|
+
field<K extends keyof T>(key: K): FieldValueType<ExtractFieldType<T[K]>, ExtractRequired<T[K]>>;
|
|
163
|
+
relation(key: keyof T): DocMetaFieldRelation;
|
|
164
|
+
multiRelation(key: keyof T): DocMetaFieldMultiRelation;
|
|
165
|
+
text(key: keyof T): DocMetaFieldText;
|
|
166
|
+
number(key: keyof T): DocMetaFieldNumber;
|
|
167
|
+
boolean(key: keyof T): DocMetaFieldBoolean;
|
|
168
|
+
multiText(key: keyof T): DocMetaFieldMultiText;
|
|
169
|
+
multiNumber(key: keyof T): DocMetaFieldMultiNumber;
|
|
170
|
+
multiBoolean(key: keyof T): DocMetaFieldMultiBoolean;
|
|
171
|
+
hasKey(key: keyof T): boolean;
|
|
206
172
|
/**
|
|
207
|
-
*
|
|
173
|
+
* Generate from Markdown text
|
|
208
174
|
*/
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
175
|
+
static fromYamlText<T extends DocCustomSchema>(yamlText: string, customSchema: T): DocFileMdMetaValue<T>;
|
|
176
|
+
static empty<T extends DocCustomSchema>(customSchema: T): DocFileMdMetaValue<T>;
|
|
177
|
+
toJson(): SchemaToValueType<T>;
|
|
178
|
+
toYaml(): string;
|
|
213
179
|
}
|
|
214
180
|
|
|
215
181
|
/**
|
|
216
|
-
*
|
|
182
|
+
* File: Markdown > Content
|
|
217
183
|
*/
|
|
218
|
-
declare class
|
|
219
|
-
readonly
|
|
220
|
-
readonly
|
|
221
|
-
constructor(
|
|
222
|
-
get type(): "multi-select-number";
|
|
223
|
-
get required(): boolean;
|
|
224
|
-
get title(): string;
|
|
225
|
-
get description(): string;
|
|
226
|
-
get default(): number[] | null;
|
|
227
|
-
get options(): number[];
|
|
228
|
-
readonly isArray = true;
|
|
229
|
-
readonly isSingle = false;
|
|
230
|
-
readonly isSelect = true;
|
|
231
|
-
readonly isNumberSelect = true;
|
|
184
|
+
declare class DocFileMdContentValue<T extends DocCustomSchema> {
|
|
185
|
+
readonly value: DocFileMdContent<T>;
|
|
186
|
+
private readonly customSchema;
|
|
187
|
+
constructor(value: DocFileMdContent<T>, customSchema: T);
|
|
232
188
|
/**
|
|
233
|
-
*
|
|
189
|
+
* Content body (does not include frontMatter)
|
|
234
190
|
*/
|
|
235
|
-
|
|
236
|
-
toJson(): DocFileIndexSchemaField;
|
|
237
|
-
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiSelectNumberValue<T>;
|
|
238
|
-
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiSelectNumberValue<RecordKey>;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Multiple select text type schema field
|
|
243
|
-
*/
|
|
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";
|
|
249
|
-
get required(): boolean;
|
|
250
|
-
get title(): string;
|
|
251
|
-
get description(): string;
|
|
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;
|
|
191
|
+
get body(): string;
|
|
258
192
|
/**
|
|
259
|
-
*
|
|
193
|
+
* Title
|
|
260
194
|
*/
|
|
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>;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Multiple text type schema field
|
|
269
|
-
*/
|
|
270
|
-
declare class DocSchemaFieldMultiTextValue<T extends RecordKey> {
|
|
271
|
-
readonly key: T;
|
|
272
|
-
readonly value: DocSchemaFieldMultiText;
|
|
273
|
-
constructor(key: T, value: DocSchemaFieldMultiText);
|
|
274
|
-
get type(): "multi-text";
|
|
275
|
-
get required(): boolean;
|
|
276
195
|
get title(): string;
|
|
277
|
-
get description(): string;
|
|
278
|
-
get default(): string[] | null;
|
|
279
|
-
readonly isArray = true;
|
|
280
|
-
readonly isSingle = false;
|
|
281
|
-
readonly isText = true;
|
|
282
|
-
toJson(): DocFileIndexSchemaField;
|
|
283
196
|
/**
|
|
284
|
-
*
|
|
197
|
+
* Description
|
|
285
198
|
*/
|
|
286
|
-
validate(value: unknown): boolean;
|
|
287
|
-
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiTextValue<T>;
|
|
288
|
-
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiTextValue<RecordKey>;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/**
|
|
292
|
-
* Single number type schema field
|
|
293
|
-
*/
|
|
294
|
-
declare class DocSchemaFieldNumberValue<T extends RecordKey> {
|
|
295
|
-
readonly key: T;
|
|
296
|
-
readonly value: DocSchemaFieldNumber;
|
|
297
|
-
constructor(key: T, value: DocSchemaFieldNumber);
|
|
298
|
-
get type(): "number";
|
|
299
|
-
get required(): boolean;
|
|
300
|
-
get title(): string;
|
|
301
199
|
get description(): string;
|
|
302
|
-
get default(): number | null;
|
|
303
|
-
readonly isArray = false;
|
|
304
|
-
readonly isSingle = true;
|
|
305
|
-
readonly isNumber = true;
|
|
306
|
-
toJson(): DocFileIndexSchemaField;
|
|
307
200
|
/**
|
|
308
|
-
*
|
|
201
|
+
* FrontMatter (uses constructor's Zod schema or argument schema)
|
|
309
202
|
*/
|
|
310
|
-
|
|
311
|
-
static empty(key: RecordKey): DocSchemaFieldNumberValue<RecordKey>;
|
|
312
|
-
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldNumberValue<RecordKey>;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Single relation type schema field
|
|
317
|
-
*/
|
|
318
|
-
declare class DocSchemaFieldRelationValue<T extends RecordKey> {
|
|
319
|
-
readonly key: T;
|
|
320
|
-
readonly value: DocSchemaFieldRelation;
|
|
321
|
-
constructor(key: T, value: DocSchemaFieldRelation);
|
|
322
|
-
get type(): "relation";
|
|
323
|
-
get required(): boolean;
|
|
324
|
-
get title(): string;
|
|
325
|
-
get description(): string;
|
|
326
|
-
get default(): string | null;
|
|
327
|
-
get path(): string;
|
|
328
|
-
readonly isArray = false;
|
|
329
|
-
readonly isSingle = true;
|
|
330
|
-
readonly isRelation = true;
|
|
331
|
-
toJson(): DocFileIndexSchemaField;
|
|
203
|
+
meta(): DocFileMdMetaValue<T>;
|
|
332
204
|
/**
|
|
333
|
-
*
|
|
205
|
+
* Update title
|
|
334
206
|
*/
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
207
|
+
withTitle(title: string): DocFileMdContentValue<T>;
|
|
208
|
+
/**
|
|
209
|
+
* Update description
|
|
210
|
+
*/
|
|
211
|
+
withDescription(description: string, defaultTitle?: string): DocFileMdContentValue<T>;
|
|
212
|
+
/**
|
|
213
|
+
* Update content
|
|
214
|
+
*/
|
|
215
|
+
withContent(content: string): DocFileMdContentValue<T>;
|
|
216
|
+
/**
|
|
217
|
+
* Update FrontMatter
|
|
218
|
+
*/
|
|
219
|
+
withMeta<U extends DocCustomSchema>(meta: DocFileMdMetaValue<U>): DocFileMdContentValue<U>;
|
|
220
|
+
/**
|
|
221
|
+
* Update specific property of FrontMatter
|
|
222
|
+
*/
|
|
223
|
+
withMetaProperty<K extends keyof T>(key: K, value: BaseFieldValueType<ExtractFieldType<T[K]>>): DocFileMdContentValue<T>;
|
|
224
|
+
/**
|
|
225
|
+
* Generate from Markdown text
|
|
226
|
+
*/
|
|
227
|
+
static fromMarkdown<T extends DocCustomSchema>(markdown: string, customSchema: T): DocFileMdContentValue<T>;
|
|
228
|
+
/**
|
|
229
|
+
* Generate complete Markdown text
|
|
230
|
+
*/
|
|
231
|
+
toMarkdownText(): string;
|
|
232
|
+
/**
|
|
233
|
+
* Generate complete text combining FrontMatter and body
|
|
234
|
+
*/
|
|
235
|
+
toText(): string;
|
|
236
|
+
/**
|
|
237
|
+
* Generate empty content
|
|
238
|
+
*/
|
|
239
|
+
static empty<T extends DocCustomSchema = DocCustomSchema>(title: string, customSchema: T): DocFileMdContentValue<T>;
|
|
240
|
+
/**
|
|
241
|
+
* Output in JSON format
|
|
242
|
+
*/
|
|
243
|
+
toJson(): DocFileMdContent<T>;
|
|
338
244
|
}
|
|
339
245
|
|
|
340
246
|
/**
|
|
341
|
-
*
|
|
247
|
+
* Markdown file entity
|
|
342
248
|
*/
|
|
343
|
-
declare class
|
|
344
|
-
readonly
|
|
345
|
-
readonly
|
|
346
|
-
constructor(
|
|
347
|
-
get type(): "select-number";
|
|
348
|
-
get required(): boolean;
|
|
349
|
-
get title(): string;
|
|
350
|
-
get description(): string;
|
|
351
|
-
get default(): number | null;
|
|
352
|
-
get options(): number[];
|
|
353
|
-
readonly isArray = false;
|
|
354
|
-
readonly isSingle = true;
|
|
355
|
-
readonly isSelect = true;
|
|
356
|
-
readonly isNumberSelect = true;
|
|
249
|
+
declare class DocFileMdEntity<T extends DocCustomSchema> {
|
|
250
|
+
readonly value: DocFileMd<T>;
|
|
251
|
+
private readonly customSchema;
|
|
252
|
+
constructor(value: DocFileMd<T>, customSchema: T);
|
|
357
253
|
/**
|
|
358
|
-
*
|
|
254
|
+
* Content
|
|
359
255
|
*/
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
256
|
+
get content(): DocFileMdContentValue<T>;
|
|
257
|
+
/**
|
|
258
|
+
* Path information
|
|
259
|
+
*/
|
|
260
|
+
get path(): DocFilePath;
|
|
261
|
+
/**
|
|
262
|
+
* Update content
|
|
263
|
+
*/
|
|
264
|
+
withContent(content: DocFileMdContentValue<T>): DocFileMdEntity<T>;
|
|
265
|
+
/**
|
|
266
|
+
* Update path
|
|
267
|
+
*/
|
|
268
|
+
withPath(path: DocFilePath): DocFileMdEntity<T>;
|
|
269
|
+
withMeta(meta: DocFileMdMetaValue<T>): DocFileMdEntity<T>;
|
|
270
|
+
withTitle(title: string): DocFileMdEntity<T>;
|
|
271
|
+
withDescription(description: string, defaultTitle?: string): DocFileMdEntity<T>;
|
|
272
|
+
/**
|
|
273
|
+
* Convert to JSON format
|
|
274
|
+
*/
|
|
275
|
+
toJson(): DocFileMd<T>;
|
|
364
276
|
}
|
|
365
277
|
|
|
278
|
+
type Props$8<T extends DocCustomSchema> = {
|
|
279
|
+
path: string;
|
|
280
|
+
fileSystem: DocFileSystem;
|
|
281
|
+
pathSystem: DocPathSystem;
|
|
282
|
+
customSchema: T;
|
|
283
|
+
config: DocClientConfig;
|
|
284
|
+
};
|
|
366
285
|
/**
|
|
367
|
-
*
|
|
286
|
+
* File reference
|
|
368
287
|
*/
|
|
369
|
-
declare class
|
|
288
|
+
declare class DocFileMdReference<T extends DocCustomSchema> {
|
|
289
|
+
private readonly props;
|
|
290
|
+
private readonly pathSystem;
|
|
291
|
+
private readonly customSchema;
|
|
292
|
+
constructor(props: Props$8<T>);
|
|
293
|
+
get fileSystem(): DocFileSystem;
|
|
294
|
+
get basePath(): string;
|
|
295
|
+
get path(): string;
|
|
296
|
+
get fullPath(): string;
|
|
297
|
+
get directoryPath(): string;
|
|
298
|
+
get archivedPath(): string;
|
|
299
|
+
get name(): string;
|
|
300
|
+
get nameWithExtension(): string;
|
|
301
|
+
exists(): Promise<boolean>;
|
|
302
|
+
read(): Promise<DocFileMdEntity<T> | Error>;
|
|
303
|
+
/**
|
|
304
|
+
* Read file content
|
|
305
|
+
*/
|
|
306
|
+
readText(): Promise<Error | string>;
|
|
307
|
+
/**
|
|
308
|
+
* Write entity
|
|
309
|
+
*/
|
|
310
|
+
write(entity: DocFileMdEntity<T>): Promise<null>;
|
|
311
|
+
writeText(text: string): Promise<void>;
|
|
312
|
+
/**
|
|
313
|
+
* Create new file with default content
|
|
314
|
+
*/
|
|
315
|
+
writeDefault(): Promise<void>;
|
|
316
|
+
/**
|
|
317
|
+
* Delete file
|
|
318
|
+
*/
|
|
319
|
+
delete(): Promise<Error | null>;
|
|
320
|
+
/**
|
|
321
|
+
* Copy file
|
|
322
|
+
*/
|
|
323
|
+
copyTo(destinationPath: string): Promise<void>;
|
|
324
|
+
/**
|
|
325
|
+
* Move file
|
|
326
|
+
*/
|
|
327
|
+
moveTo(destinationPath: string): Promise<void>;
|
|
328
|
+
/**
|
|
329
|
+
* Move file to archive and return new reference
|
|
330
|
+
*/
|
|
331
|
+
archive(archiveDirectoryName?: string): Promise<DocFileMdReference<T>>;
|
|
332
|
+
/**
|
|
333
|
+
* Restore file from archive and return new reference
|
|
334
|
+
*/
|
|
335
|
+
restore(archiveDirectoryName?: string): Promise<DocFileMdReference<T>>;
|
|
336
|
+
/**
|
|
337
|
+
* Get file size in bytes
|
|
338
|
+
*/
|
|
339
|
+
size(): Promise<number>;
|
|
340
|
+
/**
|
|
341
|
+
* Get file last modified time
|
|
342
|
+
*/
|
|
343
|
+
lastModified(): Promise<Date>;
|
|
344
|
+
/**
|
|
345
|
+
* Get file creation time
|
|
346
|
+
*/
|
|
347
|
+
createdAt(): Promise<Date>;
|
|
348
|
+
directory(): DocDirectoryReference<T>;
|
|
349
|
+
/**
|
|
350
|
+
* Get relation based on schema
|
|
351
|
+
*/
|
|
352
|
+
relation<U extends DocCustomSchema = DocCustomSchema>(key: RelationKeys<T>, targetSchema?: U): Promise<DocFileMdReference<U> | Error | null>;
|
|
353
|
+
/**
|
|
354
|
+
* Get index.md in the same directory
|
|
355
|
+
*/
|
|
356
|
+
directoryIndex(): Promise<DocFileIndexReference<T> | null>;
|
|
357
|
+
/**
|
|
358
|
+
* Get multiple relations based on schema
|
|
359
|
+
*/
|
|
360
|
+
relations<U extends DocCustomSchema = DocCustomSchema>(key: MultiRelationKeys<T>, customSchema?: U): Promise<DocFileMdReference<U>[]>;
|
|
361
|
+
/**
|
|
362
|
+
* File: Markdown > FrontMatter
|
|
363
|
+
*/
|
|
364
|
+
readFrontMatter(): Promise<DocFileMdMetaValue<T> | Error>;
|
|
365
|
+
/**
|
|
366
|
+
* File: Markdown > FrontMatter
|
|
367
|
+
*/
|
|
368
|
+
updateFrontMatter<K extends keyof T>(key: K, value: BaseFieldValueType<ExtractFieldType<T[K]>>): Promise<this | Error>;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Unknown file entity
|
|
373
|
+
*/
|
|
374
|
+
declare class DocFileUnknownEntity {
|
|
375
|
+
readonly value: DocFileUnknown;
|
|
376
|
+
constructor(value: DocFileUnknown);
|
|
377
|
+
/**
|
|
378
|
+
* Content
|
|
379
|
+
*/
|
|
380
|
+
get content(): string;
|
|
381
|
+
/**
|
|
382
|
+
* Path information
|
|
383
|
+
*/
|
|
384
|
+
get path(): DocFilePath;
|
|
385
|
+
/**
|
|
386
|
+
* Update content
|
|
387
|
+
*/
|
|
388
|
+
withContent(content: string): DocFileUnknownEntity;
|
|
389
|
+
/**
|
|
390
|
+
* Update path
|
|
391
|
+
*/
|
|
392
|
+
withPath(path: DocFilePath): DocFileUnknownEntity;
|
|
393
|
+
toJson(): DocFileUnknown;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
type Props$7 = {
|
|
397
|
+
path: string;
|
|
398
|
+
fileSystem: DocFileSystem;
|
|
399
|
+
pathSystem: DocPathSystem;
|
|
400
|
+
config: DocClientConfig;
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* File reference
|
|
404
|
+
*/
|
|
405
|
+
declare class DocFileUnknownReference {
|
|
406
|
+
private readonly props;
|
|
407
|
+
private readonly pathSystem;
|
|
408
|
+
constructor(props: Props$7);
|
|
409
|
+
get fileSystem(): DocFileSystem;
|
|
410
|
+
get basePath(): string;
|
|
411
|
+
get path(): string;
|
|
412
|
+
get directoryPath(): string;
|
|
413
|
+
get fileFullPath(): string;
|
|
414
|
+
get durectoryPath(): string;
|
|
415
|
+
directory<T extends DocCustomSchema>(customSchema: T): DocDirectoryReference<T>;
|
|
416
|
+
directory(): DocDirectoryReference<DocCustomSchema>;
|
|
417
|
+
read(): Promise<Error | DocFileUnknownEntity>;
|
|
418
|
+
/**
|
|
419
|
+
* Read file content
|
|
420
|
+
*/
|
|
421
|
+
readContent(): Promise<Error | string>;
|
|
422
|
+
/**
|
|
423
|
+
* Write content to file
|
|
424
|
+
*/
|
|
425
|
+
writeContent(content: string): Promise<void>;
|
|
426
|
+
/**
|
|
427
|
+
* Write entity
|
|
428
|
+
*/
|
|
429
|
+
write(entity: DocFileUnknownEntity): Promise<void>;
|
|
430
|
+
/**
|
|
431
|
+
* Write raw content
|
|
432
|
+
*/
|
|
433
|
+
writeRaw(content: string): Promise<void>;
|
|
434
|
+
/**
|
|
435
|
+
* Delete file
|
|
436
|
+
*/
|
|
437
|
+
delete(): Promise<Error | null>;
|
|
438
|
+
/**
|
|
439
|
+
* Check if file exists
|
|
440
|
+
*/
|
|
441
|
+
exists(): Promise<boolean>;
|
|
442
|
+
/**
|
|
443
|
+
* Copy file
|
|
444
|
+
*/
|
|
445
|
+
copyTo(destinationPath: string): Promise<void>;
|
|
446
|
+
/**
|
|
447
|
+
* Move file
|
|
448
|
+
*/
|
|
449
|
+
moveTo(destinationPath: string): Promise<void>;
|
|
450
|
+
/**
|
|
451
|
+
* Get file size in bytes
|
|
452
|
+
*/
|
|
453
|
+
size(): Promise<number>;
|
|
454
|
+
/**
|
|
455
|
+
* Get file last modified time
|
|
456
|
+
*/
|
|
457
|
+
lastModified(): Promise<Date>;
|
|
458
|
+
/**
|
|
459
|
+
* Get file creation time
|
|
460
|
+
*/
|
|
461
|
+
createdAt(): Promise<Date>;
|
|
462
|
+
/**
|
|
463
|
+
* Move file to archive and return new reference
|
|
464
|
+
*/
|
|
465
|
+
archive(archiveDirectoryName?: string): Promise<DocFileUnknownReference>;
|
|
466
|
+
/**
|
|
467
|
+
* Restore file from archive and return new reference
|
|
468
|
+
*/
|
|
469
|
+
restore(archiveDirectoryName?: string): Promise<DocFileUnknownReference>;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Single boolean type schema field
|
|
474
|
+
*/
|
|
475
|
+
declare class DocSchemaFieldBooleanValue<T extends RecordKey> {
|
|
370
476
|
readonly key: T;
|
|
371
|
-
readonly value:
|
|
372
|
-
constructor(key: T, value:
|
|
373
|
-
get type(): "
|
|
477
|
+
readonly value: DocSchemaFieldBoolean;
|
|
478
|
+
constructor(key: T, value: DocSchemaFieldBoolean);
|
|
479
|
+
get type(): "boolean";
|
|
374
480
|
get required(): boolean;
|
|
375
481
|
get title(): string;
|
|
376
482
|
get description(): string;
|
|
377
|
-
get default():
|
|
378
|
-
get options(): string[];
|
|
483
|
+
get default(): boolean | null;
|
|
379
484
|
readonly isArray = false;
|
|
380
485
|
readonly isSingle = true;
|
|
381
|
-
readonly
|
|
382
|
-
readonly isTextSelect = true;
|
|
486
|
+
readonly isBoolean = true;
|
|
383
487
|
toJson(): DocFileIndexSchemaField;
|
|
384
488
|
/**
|
|
385
489
|
* Validate value type
|
|
386
490
|
*/
|
|
387
491
|
validate(value: unknown): boolean;
|
|
388
|
-
static empty
|
|
389
|
-
static normalize(key: RecordKey, record: Record<RecordKey, unknown>):
|
|
492
|
+
static empty(key: RecordKey): DocSchemaFieldBooleanValue<RecordKey>;
|
|
493
|
+
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldBooleanValue<RecordKey>;
|
|
390
494
|
}
|
|
391
495
|
|
|
392
496
|
/**
|
|
393
|
-
*
|
|
497
|
+
* Multiple number type schema field
|
|
394
498
|
*/
|
|
395
|
-
declare class
|
|
499
|
+
declare class DocSchemaFieldMultiNumberValue<T extends RecordKey> {
|
|
396
500
|
readonly key: T;
|
|
397
|
-
readonly value:
|
|
398
|
-
constructor(key: T, value:
|
|
501
|
+
readonly value: DocSchemaFieldMultiNumber;
|
|
502
|
+
constructor(key: T, value: DocSchemaFieldMultiNumber);
|
|
503
|
+
get type(): "multi-number";
|
|
504
|
+
get required(): boolean;
|
|
505
|
+
get title(): string;
|
|
506
|
+
get description(): string;
|
|
507
|
+
get default(): number[] | null;
|
|
508
|
+
readonly isArray = true;
|
|
509
|
+
readonly isSingle = false;
|
|
510
|
+
readonly isNumber = true;
|
|
511
|
+
/**
|
|
512
|
+
* Validate value
|
|
513
|
+
*/
|
|
514
|
+
validate(value: unknown): boolean;
|
|
515
|
+
toJson(): DocFileIndexSchemaField;
|
|
516
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiNumberValue<T>;
|
|
517
|
+
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiNumberValue<RecordKey>;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Multiple relation type schema field
|
|
522
|
+
*/
|
|
523
|
+
declare class DocSchemaFieldMultiRelationValue<T extends RecordKey> {
|
|
524
|
+
readonly key: T;
|
|
525
|
+
readonly value: DocSchemaFieldMultiRelation;
|
|
526
|
+
constructor(key: T, value: DocSchemaFieldMultiRelation);
|
|
527
|
+
get type(): "multi-relation";
|
|
528
|
+
get required(): boolean;
|
|
529
|
+
get title(): string;
|
|
530
|
+
get description(): string;
|
|
531
|
+
get default(): string[] | null;
|
|
532
|
+
get path(): string;
|
|
533
|
+
readonly isArray = true;
|
|
534
|
+
readonly isSingle = false;
|
|
535
|
+
readonly isRelation = true;
|
|
536
|
+
/**
|
|
537
|
+
* Validate value
|
|
538
|
+
*/
|
|
539
|
+
validate(value: unknown): boolean;
|
|
540
|
+
toJson(): DocFileIndexSchemaField;
|
|
541
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiRelationValue<T>;
|
|
542
|
+
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiRelationValue<RecordKey>;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* Multiple select number type schema field
|
|
547
|
+
*/
|
|
548
|
+
declare class DocSchemaFieldMultiSelectNumberValue<T extends RecordKey> {
|
|
549
|
+
readonly key: T;
|
|
550
|
+
readonly value: DocSchemaFieldMultiSelectNumber;
|
|
551
|
+
constructor(key: T, value: DocSchemaFieldMultiSelectNumber);
|
|
552
|
+
get type(): "multi-select-number";
|
|
553
|
+
get required(): boolean;
|
|
554
|
+
get title(): string;
|
|
555
|
+
get description(): string;
|
|
556
|
+
get default(): number[] | null;
|
|
557
|
+
get options(): number[];
|
|
558
|
+
readonly isArray = true;
|
|
559
|
+
readonly isSingle = false;
|
|
560
|
+
readonly isSelect = true;
|
|
561
|
+
readonly isNumberSelect = true;
|
|
562
|
+
/**
|
|
563
|
+
* Validate value
|
|
564
|
+
*/
|
|
565
|
+
validate(value: unknown): boolean;
|
|
566
|
+
toJson(): DocFileIndexSchemaField;
|
|
567
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiSelectNumberValue<T>;
|
|
568
|
+
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiSelectNumberValue<RecordKey>;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Multiple select text type schema field
|
|
573
|
+
*/
|
|
574
|
+
declare class DocSchemaFieldMultiSelectTextValue<T extends RecordKey> {
|
|
575
|
+
readonly key: T;
|
|
576
|
+
readonly value: DocSchemaFieldMultiSelectText;
|
|
577
|
+
constructor(key: T, value: DocSchemaFieldMultiSelectText);
|
|
578
|
+
get type(): "multi-select-text";
|
|
579
|
+
get required(): boolean;
|
|
580
|
+
get title(): string;
|
|
581
|
+
get description(): string;
|
|
582
|
+
get default(): string[] | null;
|
|
583
|
+
get options(): string[];
|
|
584
|
+
readonly isArray = true;
|
|
585
|
+
readonly isSingle = false;
|
|
586
|
+
readonly isSelect = true;
|
|
587
|
+
readonly isTextSelect = true;
|
|
588
|
+
/**
|
|
589
|
+
* Validate value
|
|
590
|
+
*/
|
|
591
|
+
validate(value: unknown): boolean;
|
|
592
|
+
toJson(): DocFileIndexSchemaField;
|
|
593
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiSelectTextValue<T>;
|
|
594
|
+
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiSelectTextValue<RecordKey>;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Multiple text type schema field
|
|
599
|
+
*/
|
|
600
|
+
declare class DocSchemaFieldMultiTextValue<T extends RecordKey> {
|
|
601
|
+
readonly key: T;
|
|
602
|
+
readonly value: DocSchemaFieldMultiText;
|
|
603
|
+
constructor(key: T, value: DocSchemaFieldMultiText);
|
|
604
|
+
get type(): "multi-text";
|
|
605
|
+
get required(): boolean;
|
|
606
|
+
get title(): string;
|
|
607
|
+
get description(): string;
|
|
608
|
+
get default(): string[] | null;
|
|
609
|
+
readonly isArray = true;
|
|
610
|
+
readonly isSingle = false;
|
|
611
|
+
readonly isText = true;
|
|
612
|
+
toJson(): DocFileIndexSchemaField;
|
|
613
|
+
/**
|
|
614
|
+
* Validate value type
|
|
615
|
+
*/
|
|
616
|
+
validate(value: unknown): boolean;
|
|
617
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldMultiTextValue<T>;
|
|
618
|
+
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldMultiTextValue<RecordKey>;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Single number type schema field
|
|
623
|
+
*/
|
|
624
|
+
declare class DocSchemaFieldNumberValue<T extends RecordKey> {
|
|
625
|
+
readonly key: T;
|
|
626
|
+
readonly value: DocSchemaFieldNumber;
|
|
627
|
+
constructor(key: T, value: DocSchemaFieldNumber);
|
|
628
|
+
get type(): "number";
|
|
629
|
+
get required(): boolean;
|
|
630
|
+
get title(): string;
|
|
631
|
+
get description(): string;
|
|
632
|
+
get default(): number | null;
|
|
633
|
+
readonly isArray = false;
|
|
634
|
+
readonly isSingle = true;
|
|
635
|
+
readonly isNumber = true;
|
|
636
|
+
toJson(): DocFileIndexSchemaField;
|
|
637
|
+
/**
|
|
638
|
+
* Validate value type
|
|
639
|
+
*/
|
|
640
|
+
validate(value: unknown): boolean;
|
|
641
|
+
static empty(key: RecordKey): DocSchemaFieldNumberValue<RecordKey>;
|
|
642
|
+
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldNumberValue<RecordKey>;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Single relation type schema field
|
|
647
|
+
*/
|
|
648
|
+
declare class DocSchemaFieldRelationValue<T extends RecordKey> {
|
|
649
|
+
readonly key: T;
|
|
650
|
+
readonly value: DocSchemaFieldRelation;
|
|
651
|
+
constructor(key: T, value: DocSchemaFieldRelation);
|
|
652
|
+
get type(): "relation";
|
|
653
|
+
get required(): boolean;
|
|
654
|
+
get title(): string;
|
|
655
|
+
get description(): string;
|
|
656
|
+
get default(): string | null;
|
|
657
|
+
get path(): string;
|
|
658
|
+
readonly isArray = false;
|
|
659
|
+
readonly isSingle = true;
|
|
660
|
+
readonly isRelation = true;
|
|
661
|
+
toJson(): DocFileIndexSchemaField;
|
|
662
|
+
/**
|
|
663
|
+
* Validate value type
|
|
664
|
+
*/
|
|
665
|
+
validate(value: unknown): boolean;
|
|
666
|
+
static empty(key: RecordKey): DocSchemaFieldRelationValue<RecordKey>;
|
|
667
|
+
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldRelationValue<RecordKey>;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/**
|
|
671
|
+
* Single select number type schema field
|
|
672
|
+
*/
|
|
673
|
+
declare class DocSchemaFieldSelectNumberValue<T extends RecordKey> {
|
|
674
|
+
readonly key: T;
|
|
675
|
+
readonly value: DocSchemaFieldSelectNumber;
|
|
676
|
+
constructor(key: T, value: DocSchemaFieldSelectNumber);
|
|
677
|
+
get type(): "select-number";
|
|
678
|
+
get required(): boolean;
|
|
679
|
+
get title(): string;
|
|
680
|
+
get description(): string;
|
|
681
|
+
get default(): number | null;
|
|
682
|
+
get options(): number[];
|
|
683
|
+
readonly isArray = false;
|
|
684
|
+
readonly isSingle = true;
|
|
685
|
+
readonly isSelect = true;
|
|
686
|
+
readonly isNumberSelect = true;
|
|
687
|
+
/**
|
|
688
|
+
* Validate value
|
|
689
|
+
*/
|
|
690
|
+
validate(value: unknown): boolean;
|
|
691
|
+
toJson(): DocFileIndexSchemaField;
|
|
692
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldSelectNumberValue<T>;
|
|
693
|
+
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldSelectNumberValue<RecordKey>;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Single select text type schema field
|
|
698
|
+
*/
|
|
699
|
+
declare class DocSchemaFieldSelectTextValue<T extends RecordKey> {
|
|
700
|
+
readonly key: T;
|
|
701
|
+
readonly value: DocSchemaFieldSelectText;
|
|
702
|
+
constructor(key: T, value: DocSchemaFieldSelectText);
|
|
703
|
+
get type(): "select-text";
|
|
704
|
+
get required(): boolean;
|
|
705
|
+
get title(): string;
|
|
706
|
+
get description(): string;
|
|
707
|
+
get default(): string | null;
|
|
708
|
+
get options(): string[];
|
|
709
|
+
readonly isArray = false;
|
|
710
|
+
readonly isSingle = true;
|
|
711
|
+
readonly isSelect = true;
|
|
712
|
+
readonly isTextSelect = true;
|
|
713
|
+
toJson(): DocFileIndexSchemaField;
|
|
714
|
+
/**
|
|
715
|
+
* Validate value type
|
|
716
|
+
*/
|
|
717
|
+
validate(value: unknown): boolean;
|
|
718
|
+
static empty<T extends RecordKey>(key: T): DocSchemaFieldSelectTextValue<T>;
|
|
719
|
+
static normalize(key: RecordKey, record: Record<RecordKey, unknown>): DocSchemaFieldSelectTextValue<RecordKey>;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* Single text type schema field
|
|
724
|
+
*/
|
|
725
|
+
declare class DocSchemaFieldTextValue<T extends RecordKey> {
|
|
726
|
+
readonly key: T;
|
|
727
|
+
readonly value: DocSchemaFieldText;
|
|
728
|
+
constructor(key: T, value: DocSchemaFieldText);
|
|
399
729
|
get type(): "text";
|
|
400
730
|
get required(): boolean;
|
|
401
731
|
get title(): string;
|
|
@@ -637,6 +967,33 @@ type DocRelation = z.infer<typeof zDocRelation>;
|
|
|
637
967
|
* Relation field type
|
|
638
968
|
*/
|
|
639
969
|
type DocRelationField = z.infer<typeof zDocRelationField>;
|
|
970
|
+
/**
|
|
971
|
+
* String literal type utilities for file path detection
|
|
972
|
+
*/
|
|
973
|
+
/**
|
|
974
|
+
* Check if path ends with specific extension
|
|
975
|
+
*/
|
|
976
|
+
type EndsWith<T extends string, U extends string> = T extends `${string}${U}` ? true : false;
|
|
977
|
+
/**
|
|
978
|
+
* Extract filename from path
|
|
979
|
+
*/
|
|
980
|
+
type Basename<T extends string> = T extends `${string}/${infer U}` ? Basename<U> : T;
|
|
981
|
+
/**
|
|
982
|
+
* Check if filename is index.md
|
|
983
|
+
*/
|
|
984
|
+
type IsIndexMd<T extends string> = Basename<T> extends "index.md" ? true : false;
|
|
985
|
+
/**
|
|
986
|
+
* Detect file type from path
|
|
987
|
+
*/
|
|
988
|
+
type DetectFileType<T extends string> = IsIndexMd<T> extends true ? "index" : EndsWith<T, ".md"> extends true ? "markdown" : "unknown";
|
|
989
|
+
/**
|
|
990
|
+
* Map file type to reference class
|
|
991
|
+
*/
|
|
992
|
+
type FileTypeToReference<FileType extends string, Schema extends DocCustomSchema> = FileType extends "index" ? DocFileIndexReference<Schema> : FileType extends "markdown" ? DocFileMdReference<Schema> : DocFileUnknownReference;
|
|
993
|
+
/**
|
|
994
|
+
* Infer reference type from path
|
|
995
|
+
*/
|
|
996
|
+
type InferReference<Path extends string, Schema extends DocCustomSchema> = FileTypeToReference<DetectFileType<Path>, Schema>;
|
|
640
997
|
/**
|
|
641
998
|
* File path information type
|
|
642
999
|
*/
|
|
@@ -678,675 +1035,349 @@ type DocClientConfig = z.infer<typeof zDocClientConfig>;
|
|
|
678
1035
|
/**
|
|
679
1036
|
* Type definitions for DocFileMdMetaValue
|
|
680
1037
|
*/
|
|
681
|
-
type ExtractFieldType<T> = T extends {
|
|
682
|
-
type: infer Type;
|
|
683
|
-
} ? Type : never;
|
|
684
|
-
type ExtractRequired<T> = T extends {
|
|
685
|
-
required: infer Required;
|
|
686
|
-
} ? Required : false;
|
|
687
|
-
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;
|
|
688
|
-
type FieldValueType<Type, Required> = Required extends true ? BaseFieldValueType<Type> : BaseFieldValueType<Type> | null;
|
|
689
|
-
/**
|
|
690
|
-
* Extract required field keys
|
|
691
|
-
*/
|
|
692
|
-
type RequiredKeys<T extends DocCustomSchema> = {
|
|
693
|
-
[K in keyof T]: T[K] extends {
|
|
694
|
-
required: true;
|
|
695
|
-
} ? K : never;
|
|
696
|
-
}[keyof T];
|
|
697
|
-
/**
|
|
698
|
-
* Extract optional field keys
|
|
699
|
-
*/
|
|
700
|
-
type OptionalKeys<T extends DocCustomSchema> = {
|
|
701
|
-
[K in keyof T]: T[K] extends {
|
|
702
|
-
required: true;
|
|
703
|
-
} ? never : K;
|
|
704
|
-
}[keyof T];
|
|
705
|
-
/**
|
|
706
|
-
* Generate expected value type from schema (considering required)
|
|
707
|
-
*/
|
|
708
|
-
type SchemaToValueType<T extends DocCustomSchema> = {
|
|
709
|
-
[K in RequiredKeys<T>]: BaseFieldValueType<ExtractFieldType<T[K]>>;
|
|
710
|
-
} & {
|
|
711
|
-
[K in OptionalKeys<T>]?: BaseFieldValueType<ExtractFieldType<T[K]>> | null;
|
|
712
|
-
};
|
|
713
|
-
/**
|
|
714
|
-
* Helper type for type-safe property access
|
|
715
|
-
*/
|
|
716
|
-
type GetValueType<T extends DocCustomSchema, K extends keyof T> = K extends RequiredKeys<T> ? BaseFieldValueType<ExtractFieldType<T[K]>> : BaseFieldValueType<ExtractFieldType<T[K]>> | undefined | null;
|
|
717
|
-
/**
|
|
718
|
-
* Type definitions for DocFileIndexSchema
|
|
719
|
-
*/
|
|
720
|
-
type ExtractIndexFieldType<T> = T extends {
|
|
721
|
-
type: infer Type;
|
|
722
|
-
} ? Type : never;
|
|
723
|
-
type GetIndexFieldType<Schema extends DocFileIndexSchema<RecordKey>, K extends keyof Schema> = Schema[K] extends DocFileIndexSchemaField ? Schema[K] : never;
|
|
724
|
-
type GetIndexFieldValueType<Schema extends DocFileIndexSchema<RecordKey>, K extends keyof Schema> = Schema[K] extends {
|
|
725
|
-
type: infer Type;
|
|
726
|
-
} ? Type extends "text" ? DocSchemaFieldTextValue<K> : Type extends "number" ? DocSchemaFieldNumberValue<K> : Type extends "boolean" ? DocSchemaFieldBooleanValue<K> : Type extends "relation" ? DocSchemaFieldRelationValue<K> : Type extends "select-text" ? DocSchemaFieldSelectTextValue<K> : Type extends "select-number" ? DocSchemaFieldSelectNumberValue<K> : Type extends "multi-text" ? DocSchemaFieldMultiTextValue<K> : Type extends "multi-number" ? DocSchemaFieldMultiNumberValue<K> : Type extends "multi-relation" ? DocSchemaFieldMultiRelationValue<K> : Type extends "multi-select-text" ? DocSchemaFieldMultiSelectTextValue<K> : Type extends "multi-select-number" ? DocSchemaFieldMultiSelectNumberValue<K> : never : never;
|
|
727
|
-
/**
|
|
728
|
-
* Infers DocFileMd type from the result of defineSchema
|
|
729
|
-
*/
|
|
730
|
-
type InferDocFileMd<T> = T extends DocCustomSchema ? DocFileMd<T> : never;
|
|
731
|
-
|
|
732
|
-
/**
|
|
733
|
-
* Relation file
|
|
734
|
-
*/
|
|
735
|
-
declare class DocRelationFileValue {
|
|
736
|
-
private readonly value;
|
|
737
|
-
constructor(value: DocRelationFile);
|
|
738
|
-
/**
|
|
739
|
-
* File path
|
|
740
|
-
*/
|
|
741
|
-
get id(): string;
|
|
742
|
-
/**
|
|
743
|
-
* Slug
|
|
744
|
-
*/
|
|
745
|
-
get slug(): string;
|
|
746
|
-
/**
|
|
747
|
-
* Display label
|
|
748
|
-
*/
|
|
749
|
-
get label(): string;
|
|
750
|
-
/**
|
|
751
|
-
* Create from file path and title
|
|
752
|
-
*/
|
|
753
|
-
static from(filePath: string, title: string | null): DocRelationFileValue;
|
|
754
|
-
/**
|
|
755
|
-
* Extract file name from file path (without extension)
|
|
756
|
-
*/
|
|
757
|
-
private static extractFileName;
|
|
758
|
-
/**
|
|
759
|
-
* Convert to JSON format
|
|
760
|
-
*/
|
|
761
|
-
toJson(): DocRelationFile;
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
/**
|
|
765
|
-
* Manages relation information
|
|
766
|
-
*/
|
|
767
|
-
declare class DocRelationValue {
|
|
768
|
-
readonly value: DocRelation;
|
|
769
|
-
constructor(value: DocRelation);
|
|
770
|
-
/**
|
|
771
|
-
* Relation path
|
|
772
|
-
*/
|
|
773
|
-
get path(): string;
|
|
774
|
-
/**
|
|
775
|
-
* List of related files (value objects)
|
|
776
|
-
*/
|
|
777
|
-
get files(): DocRelationFileValue[];
|
|
778
|
-
/**
|
|
779
|
-
* Get file count
|
|
780
|
-
*/
|
|
781
|
-
get fileCount(): number;
|
|
782
|
-
/**
|
|
783
|
-
* Whether it's empty
|
|
784
|
-
*/
|
|
785
|
-
get isEmpty(): boolean;
|
|
786
|
-
/**
|
|
787
|
-
* Create empty relation entity
|
|
788
|
-
*/
|
|
789
|
-
static empty(path: string): DocRelationValue;
|
|
790
|
-
/**
|
|
791
|
-
* Export as JSON format
|
|
792
|
-
*/
|
|
793
|
-
toJson(): DocRelation;
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
type Props$8 = {
|
|
797
|
-
filePath: string;
|
|
798
|
-
fileSystem: DocFileSystem;
|
|
799
|
-
pathSystem: DocPathSystem;
|
|
800
|
-
};
|
|
801
|
-
/**
|
|
802
|
-
* Relation file reference
|
|
803
|
-
*/
|
|
804
|
-
declare class DocFileRelationReference {
|
|
805
|
-
private readonly props;
|
|
806
|
-
private readonly pathSystem;
|
|
807
|
-
constructor(props: Props$8);
|
|
808
|
-
get fileSystem(): DocFileSystem;
|
|
809
|
-
get basePath(): string;
|
|
810
|
-
/**
|
|
811
|
-
* Relation path
|
|
812
|
-
*/
|
|
813
|
-
get path(): string;
|
|
814
|
-
/**
|
|
815
|
-
* Full path
|
|
816
|
-
*/
|
|
817
|
-
get fullPath(): string;
|
|
818
|
-
read(): Promise<DocRelationValue | null>;
|
|
819
|
-
/**
|
|
820
|
-
* Read list of relation files
|
|
821
|
-
*/
|
|
822
|
-
readFiles(): Promise<DocRelationFileValue[]>;
|
|
823
|
-
/**
|
|
824
|
-
* Read single relation file
|
|
825
|
-
*/
|
|
826
|
-
readFile(filePath: string): Promise<DocRelationFileValue | null>;
|
|
827
|
-
/**
|
|
828
|
-
* Check if file exists
|
|
829
|
-
*/
|
|
830
|
-
exists(slug: string): Promise<boolean>;
|
|
831
|
-
/**
|
|
832
|
-
* Get list of file names (without extension)
|
|
833
|
-
*/
|
|
834
|
-
readSlugs(): Promise<string[]>;
|
|
835
|
-
/**
|
|
836
|
-
* Get file count
|
|
837
|
-
*/
|
|
838
|
-
count(): Promise<number>;
|
|
839
|
-
/**
|
|
840
|
-
* Check if empty
|
|
841
|
-
*/
|
|
842
|
-
isEmpty(): Promise<boolean>;
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
/**
|
|
846
|
-
* Type-safe schema value object
|
|
847
|
-
*/
|
|
848
|
-
declare class DocFileIndexSchemaValue<T extends DocCustomSchema> {
|
|
849
|
-
readonly value: DocFileIndexSchema<keyof T>;
|
|
850
|
-
readonly customSchema: T;
|
|
851
|
-
constructor(value: DocFileIndexSchema<keyof T>, customSchema: T);
|
|
852
|
-
/**
|
|
853
|
-
* Get list of field names
|
|
854
|
-
* Automatically type-safe when using Zod schema
|
|
855
|
-
*/
|
|
856
|
-
get fieldNames(): Array<keyof T>;
|
|
857
|
-
/**
|
|
858
|
-
* Get field with specified field name
|
|
859
|
-
* Returns type-safe specific field Value object
|
|
860
|
-
*/
|
|
861
|
-
field<K extends keyof T>(key: K): T[K]["type"] extends infer Type ? Type extends "text" ? DocSchemaFieldTextValue<K> : Type extends "number" ? DocSchemaFieldNumberValue<K> : Type extends "boolean" ? DocSchemaFieldBooleanValue<K> : Type extends "relation" ? DocSchemaFieldRelationValue<K> : Type extends "select-text" ? DocSchemaFieldSelectTextValue<K> : Type extends "select-number" ? DocSchemaFieldSelectNumberValue<K> : Type extends "multi-text" ? DocSchemaFieldMultiTextValue<K> : Type extends "multi-number" ? DocSchemaFieldMultiNumberValue<K> : Type extends "multi-relation" ? DocSchemaFieldMultiRelationValue<K> : Type extends "multi-select-text" ? DocSchemaFieldMultiSelectTextValue<K> : Type extends "multi-select-number" ? DocSchemaFieldMultiSelectNumberValue<K> : never : never;
|
|
862
|
-
relation<K extends keyof T>(key: K): DocSchemaFieldRelationValue<K>;
|
|
863
|
-
multiRelation<K extends keyof T>(key: K): DocSchemaFieldMultiRelationValue<K>;
|
|
864
|
-
/**
|
|
865
|
-
* Get all fields
|
|
866
|
-
* Note: For type safety, it's recommended to use field() method individually
|
|
867
|
-
*/
|
|
868
|
-
get fields(): DocFileIndexSchema<keyof T>[keyof T][];
|
|
869
|
-
get relationFields(): (DocSchemaFieldRelationValue<string> | DocSchemaFieldMultiRelationValue<string>)[];
|
|
870
|
-
toJson(): DocFileIndexSchema<keyof T>;
|
|
871
|
-
/**
|
|
872
|
-
* Create empty schema entity
|
|
873
|
-
* biome-ignore lint/complexity/noBannedTypes: {} as DocCustomSchema
|
|
874
|
-
*/
|
|
875
|
-
static empty(): DocFileIndexSchemaValue<{}>;
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
/**
|
|
879
|
-
* File: index.md > content > FrontMatter
|
|
880
|
-
*/
|
|
881
|
-
declare class DocFileIndexMetaValue<T extends DocCustomSchema> {
|
|
882
|
-
readonly value: DocFileIndexMeta<T>;
|
|
883
|
-
readonly customSchema: T;
|
|
884
|
-
private readonly config;
|
|
885
|
-
/**
|
|
886
|
-
* Additional properties to include in the meta data
|
|
887
|
-
*/
|
|
888
|
-
private readonly additionalProperties;
|
|
889
|
-
constructor(value: DocFileIndexMeta<T>, customSchema: T, config: DocClientConfig, additionalProperties?: Record<string, unknown>);
|
|
890
|
-
/**
|
|
891
|
-
* Get icon
|
|
892
|
-
*/
|
|
893
|
-
get icon(): string | null;
|
|
894
|
-
/**
|
|
895
|
-
* Get schema
|
|
896
|
-
*/
|
|
897
|
-
schema(): DocFileIndexSchemaValue<T>;
|
|
898
|
-
/**
|
|
899
|
-
* Check if schema is defined
|
|
900
|
-
*/
|
|
901
|
-
get hasSchema(): boolean;
|
|
902
|
-
/**
|
|
903
|
-
* Update icon field
|
|
904
|
-
*/
|
|
905
|
-
withIcon(value: string | null): DocFileIndexMetaValue<T>;
|
|
906
|
-
/**
|
|
907
|
-
* Update schema field
|
|
908
|
-
*/
|
|
909
|
-
withSchema(value: DocFileIndexSchema<keyof T>): DocFileIndexMetaValue<T>;
|
|
910
|
-
/**
|
|
911
|
-
* Return a new instance with an unknown schema
|
|
912
|
-
* Allows accepting Record<string, unknown> schemas from external sources
|
|
913
|
-
*/
|
|
914
|
-
withUnknownSchema(draft: Record<string, unknown>): DocFileIndexMetaValue<DocCustomSchema>;
|
|
915
|
-
/**
|
|
916
|
-
* Output in JSON format
|
|
917
|
-
*/
|
|
918
|
-
toJson(): DocFileIndexMeta<T>;
|
|
919
|
-
/**
|
|
920
|
-
* Output in YAML format
|
|
921
|
-
*/
|
|
922
|
-
toYaml(): string;
|
|
923
|
-
/**
|
|
924
|
-
* Generate from Markdown text (can process incomplete data)
|
|
925
|
-
*/
|
|
926
|
-
static from<T extends DocCustomSchema>(markdownText: string, customSchema: T, config: DocClientConfig): DocFileIndexMetaValue<T>;
|
|
927
|
-
/**
|
|
928
|
-
* Generate directly from data (can process incomplete data)
|
|
929
|
-
*/
|
|
930
|
-
static fromRecord<T extends DocCustomSchema>(record: Record<string, unknown>, customSchema: T, config: DocClientConfig): DocFileIndexMetaValue<T>;
|
|
931
|
-
/**
|
|
932
|
-
* Generate empty FrontMatter
|
|
933
|
-
*/
|
|
934
|
-
static empty<T extends DocCustomSchema>(customSchema: T, config: DocClientConfig): DocFileIndexMetaValue<T>;
|
|
935
|
-
/**
|
|
936
|
-
* Extract icon
|
|
937
|
-
*/
|
|
938
|
-
private static extractIcon;
|
|
939
|
-
/**
|
|
940
|
-
* Extract schema part
|
|
941
|
-
*/
|
|
942
|
-
private static extractSchema;
|
|
943
|
-
/**
|
|
944
|
-
* Normalize entire schema
|
|
945
|
-
*/
|
|
946
|
-
private static normalizeSchema;
|
|
947
|
-
static emptySchema<T extends DocCustomSchema>(customSchema: T): DocFileIndexSchema<keyof T>;
|
|
948
|
-
}
|
|
1038
|
+
type ExtractFieldType<T> = T extends {
|
|
1039
|
+
type: infer Type;
|
|
1040
|
+
} ? Type : never;
|
|
1041
|
+
type ExtractRequired<T> = T extends {
|
|
1042
|
+
required: infer Required;
|
|
1043
|
+
} ? Required : false;
|
|
1044
|
+
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;
|
|
1045
|
+
type FieldValueType<Type, Required> = Required extends true ? BaseFieldValueType<Type> : BaseFieldValueType<Type> | null;
|
|
1046
|
+
/**
|
|
1047
|
+
* Extract required field keys
|
|
1048
|
+
*/
|
|
1049
|
+
type RequiredKeys<T extends DocCustomSchema> = {
|
|
1050
|
+
[K in keyof T]: T[K] extends {
|
|
1051
|
+
required: true;
|
|
1052
|
+
} ? K : never;
|
|
1053
|
+
}[keyof T];
|
|
1054
|
+
/**
|
|
1055
|
+
* Extract optional field keys
|
|
1056
|
+
*/
|
|
1057
|
+
type OptionalKeys<T extends DocCustomSchema> = {
|
|
1058
|
+
[K in keyof T]: T[K] extends {
|
|
1059
|
+
required: true;
|
|
1060
|
+
} ? never : K;
|
|
1061
|
+
}[keyof T];
|
|
1062
|
+
/**
|
|
1063
|
+
* Generate expected value type from schema (considering required)
|
|
1064
|
+
*/
|
|
1065
|
+
type SchemaToValueType<T extends DocCustomSchema> = {
|
|
1066
|
+
[K in RequiredKeys<T>]: BaseFieldValueType<ExtractFieldType<T[K]>>;
|
|
1067
|
+
} & {
|
|
1068
|
+
[K in OptionalKeys<T>]?: BaseFieldValueType<ExtractFieldType<T[K]>> | null;
|
|
1069
|
+
};
|
|
1070
|
+
/**
|
|
1071
|
+
* Helper type for type-safe property access
|
|
1072
|
+
*/
|
|
1073
|
+
type GetValueType<T extends DocCustomSchema, K extends keyof T> = K extends RequiredKeys<T> ? BaseFieldValueType<ExtractFieldType<T[K]>> : BaseFieldValueType<ExtractFieldType<T[K]>> | undefined | null;
|
|
1074
|
+
/**
|
|
1075
|
+
* Type definitions for DocFileIndexSchema
|
|
1076
|
+
*/
|
|
1077
|
+
type ExtractIndexFieldType<T> = T extends {
|
|
1078
|
+
type: infer Type;
|
|
1079
|
+
} ? Type : never;
|
|
1080
|
+
type GetIndexFieldType<Schema extends DocFileIndexSchema<RecordKey>, K extends keyof Schema> = Schema[K] extends DocFileIndexSchemaField ? Schema[K] : never;
|
|
1081
|
+
type GetIndexFieldValueType<Schema extends DocFileIndexSchema<RecordKey>, K extends keyof Schema> = Schema[K] extends {
|
|
1082
|
+
type: infer Type;
|
|
1083
|
+
} ? Type extends "text" ? DocSchemaFieldTextValue<K> : Type extends "number" ? DocSchemaFieldNumberValue<K> : Type extends "boolean" ? DocSchemaFieldBooleanValue<K> : Type extends "relation" ? DocSchemaFieldRelationValue<K> : Type extends "select-text" ? DocSchemaFieldSelectTextValue<K> : Type extends "select-number" ? DocSchemaFieldSelectNumberValue<K> : Type extends "multi-text" ? DocSchemaFieldMultiTextValue<K> : Type extends "multi-number" ? DocSchemaFieldMultiNumberValue<K> : Type extends "multi-relation" ? DocSchemaFieldMultiRelationValue<K> : Type extends "multi-select-text" ? DocSchemaFieldMultiSelectTextValue<K> : Type extends "multi-select-number" ? DocSchemaFieldMultiSelectNumberValue<K> : never : never;
|
|
1084
|
+
/**
|
|
1085
|
+
* Infers DocFileMd type from the result of defineSchema
|
|
1086
|
+
*/
|
|
1087
|
+
type InferDocFileMd<T> = T extends DocCustomSchema ? DocFileMd<T> : never;
|
|
949
1088
|
|
|
950
1089
|
/**
|
|
951
|
-
*
|
|
1090
|
+
* Relation file
|
|
952
1091
|
*/
|
|
953
|
-
declare class
|
|
954
|
-
readonly value
|
|
955
|
-
|
|
956
|
-
private readonly config;
|
|
957
|
-
constructor(value: DocFileIndexContent<T>, customSchema: T, config: DocClientConfig);
|
|
958
|
-
/**
|
|
959
|
-
* Content body (does not include frontMatter)
|
|
960
|
-
*/
|
|
961
|
-
get body(): string;
|
|
962
|
-
/**
|
|
963
|
-
* Title
|
|
964
|
-
*/
|
|
965
|
-
get title(): string;
|
|
966
|
-
/**
|
|
967
|
-
* Description
|
|
968
|
-
*/
|
|
969
|
-
get description(): string;
|
|
970
|
-
/**
|
|
971
|
-
* FrontMatter
|
|
972
|
-
*/
|
|
973
|
-
meta(): DocFileIndexMetaValue<T>;
|
|
974
|
-
/**
|
|
975
|
-
* Update title
|
|
976
|
-
*/
|
|
977
|
-
withTitle(title: string): DocFileIndexContentValue<T>;
|
|
978
|
-
/**
|
|
979
|
-
* Update description
|
|
980
|
-
*/
|
|
981
|
-
withDescription(description: string, defaultTitle?: string): DocFileIndexContentValue<T>;
|
|
982
|
-
/**
|
|
983
|
-
* Generate from Markdown text
|
|
984
|
-
*/
|
|
985
|
-
static fromMarkdown<T extends DocCustomSchema>(markdown: string, customSchema: T, config: DocClientConfig): DocFileIndexContentValue<T>;
|
|
1092
|
+
declare class DocRelationFileValue {
|
|
1093
|
+
private readonly value;
|
|
1094
|
+
constructor(value: DocRelationFile);
|
|
986
1095
|
/**
|
|
987
|
-
*
|
|
1096
|
+
* File path
|
|
988
1097
|
*/
|
|
989
|
-
|
|
1098
|
+
get id(): string;
|
|
990
1099
|
/**
|
|
991
|
-
*
|
|
1100
|
+
* Slug
|
|
992
1101
|
*/
|
|
993
|
-
|
|
1102
|
+
get slug(): string;
|
|
994
1103
|
/**
|
|
995
|
-
*
|
|
1104
|
+
* Display label
|
|
996
1105
|
*/
|
|
997
|
-
|
|
1106
|
+
get label(): string;
|
|
998
1107
|
/**
|
|
999
|
-
*
|
|
1108
|
+
* Create from file path and title
|
|
1000
1109
|
*/
|
|
1001
|
-
static
|
|
1110
|
+
static from(filePath: string, title: string | null): DocRelationFileValue;
|
|
1002
1111
|
/**
|
|
1003
|
-
*
|
|
1112
|
+
* Extract file name from file path (without extension)
|
|
1004
1113
|
*/
|
|
1005
|
-
|
|
1114
|
+
private static extractFileName;
|
|
1006
1115
|
/**
|
|
1007
|
-
*
|
|
1116
|
+
* Convert to JSON format
|
|
1008
1117
|
*/
|
|
1009
|
-
toJson():
|
|
1118
|
+
toJson(): DocRelationFile;
|
|
1010
1119
|
}
|
|
1011
1120
|
|
|
1012
1121
|
/**
|
|
1013
|
-
*
|
|
1122
|
+
* Manages relation information
|
|
1014
1123
|
*/
|
|
1015
|
-
declare class
|
|
1016
|
-
readonly value:
|
|
1017
|
-
|
|
1018
|
-
private readonly config;
|
|
1019
|
-
constructor(value: DocFileIndex<T>, customSchema: T, config?: DocClientConfig);
|
|
1124
|
+
declare class DocRelationValue {
|
|
1125
|
+
readonly value: DocRelation;
|
|
1126
|
+
constructor(value: DocRelation);
|
|
1020
1127
|
/**
|
|
1021
|
-
*
|
|
1128
|
+
* Relation path
|
|
1022
1129
|
*/
|
|
1023
|
-
get
|
|
1130
|
+
get path(): string;
|
|
1024
1131
|
/**
|
|
1025
|
-
*
|
|
1132
|
+
* List of related files (value objects)
|
|
1026
1133
|
*/
|
|
1027
|
-
get
|
|
1134
|
+
get files(): DocRelationFileValue[];
|
|
1028
1135
|
/**
|
|
1029
|
-
*
|
|
1136
|
+
* Get file count
|
|
1030
1137
|
*/
|
|
1031
|
-
|
|
1138
|
+
get fileCount(): number;
|
|
1032
1139
|
/**
|
|
1033
|
-
*
|
|
1140
|
+
* Whether it's empty
|
|
1034
1141
|
*/
|
|
1035
|
-
|
|
1142
|
+
get isEmpty(): boolean;
|
|
1036
1143
|
/**
|
|
1037
|
-
*
|
|
1144
|
+
* Create empty relation entity
|
|
1038
1145
|
*/
|
|
1039
|
-
|
|
1146
|
+
static empty(path: string): DocRelationValue;
|
|
1147
|
+
/**
|
|
1148
|
+
* Export as JSON format
|
|
1149
|
+
*/
|
|
1150
|
+
toJson(): DocRelation;
|
|
1040
1151
|
}
|
|
1041
1152
|
|
|
1042
|
-
type Props$
|
|
1043
|
-
|
|
1044
|
-
path: string;
|
|
1153
|
+
type Props$6 = {
|
|
1154
|
+
filePath: string;
|
|
1045
1155
|
fileSystem: DocFileSystem;
|
|
1046
1156
|
pathSystem: DocPathSystem;
|
|
1047
|
-
config: DocClientConfig;
|
|
1048
1157
|
};
|
|
1049
1158
|
/**
|
|
1050
|
-
*
|
|
1159
|
+
* Relation file reference
|
|
1051
1160
|
*/
|
|
1052
|
-
declare class
|
|
1161
|
+
declare class DocFileRelationReference {
|
|
1053
1162
|
private readonly props;
|
|
1054
1163
|
private readonly pathSystem;
|
|
1055
|
-
|
|
1056
|
-
constructor(props: Props$7<T>);
|
|
1164
|
+
constructor(props: Props$6);
|
|
1057
1165
|
get fileSystem(): DocFileSystem;
|
|
1058
1166
|
get basePath(): string;
|
|
1059
|
-
get filePath(): string;
|
|
1060
|
-
get fileFullPath(): string;
|
|
1061
|
-
get durectoryPath(): string;
|
|
1062
|
-
read(): Promise<DocFileIndexEntity<T>>;
|
|
1063
|
-
/**
|
|
1064
|
-
* Read file content
|
|
1065
|
-
*/
|
|
1066
|
-
readContent(): Promise<Error | string>;
|
|
1067
1167
|
/**
|
|
1068
|
-
*
|
|
1168
|
+
* Relation path
|
|
1069
1169
|
*/
|
|
1070
|
-
|
|
1170
|
+
get path(): string;
|
|
1071
1171
|
/**
|
|
1072
|
-
*
|
|
1172
|
+
* Full path
|
|
1073
1173
|
*/
|
|
1074
|
-
|
|
1174
|
+
get fullPath(): string;
|
|
1175
|
+
read(): Promise<DocRelationValue | null>;
|
|
1075
1176
|
/**
|
|
1076
|
-
*
|
|
1177
|
+
* Read list of relation files
|
|
1077
1178
|
*/
|
|
1078
|
-
|
|
1179
|
+
readFiles(): Promise<DocRelationFileValue[]>;
|
|
1079
1180
|
/**
|
|
1080
|
-
*
|
|
1181
|
+
* Read single relation file
|
|
1081
1182
|
*/
|
|
1082
|
-
|
|
1183
|
+
readFile(filePath: string): Promise<DocRelationFileValue | null>;
|
|
1083
1184
|
/**
|
|
1084
1185
|
* Check if file exists
|
|
1085
1186
|
*/
|
|
1086
|
-
exists(): Promise<boolean>;
|
|
1087
|
-
relations(): Promise<DocFileRelationReference[]>;
|
|
1088
|
-
readRelations(): Promise<DocRelationValue[]>;
|
|
1089
|
-
/**
|
|
1090
|
-
* Get file size in bytes
|
|
1091
|
-
*/
|
|
1092
|
-
size(): Promise<number>;
|
|
1093
|
-
/**
|
|
1094
|
-
* Get last modified date
|
|
1095
|
-
*/
|
|
1096
|
-
lastModified(): Promise<Date>;
|
|
1187
|
+
exists(slug: string): Promise<boolean>;
|
|
1097
1188
|
/**
|
|
1098
|
-
* Get file
|
|
1189
|
+
* Get list of file names (without extension)
|
|
1099
1190
|
*/
|
|
1100
|
-
|
|
1191
|
+
readSlugs(): Promise<string[]>;
|
|
1101
1192
|
/**
|
|
1102
|
-
*
|
|
1193
|
+
* Get file count
|
|
1103
1194
|
*/
|
|
1104
|
-
|
|
1195
|
+
count(): Promise<number>;
|
|
1105
1196
|
/**
|
|
1106
|
-
*
|
|
1197
|
+
* Check if empty
|
|
1107
1198
|
*/
|
|
1108
|
-
|
|
1199
|
+
isEmpty(): Promise<boolean>;
|
|
1109
1200
|
}
|
|
1110
1201
|
|
|
1111
1202
|
/**
|
|
1112
|
-
*
|
|
1203
|
+
* Type-safe schema value object
|
|
1113
1204
|
*/
|
|
1114
|
-
declare class
|
|
1115
|
-
readonly value:
|
|
1205
|
+
declare class DocFileIndexSchemaValue<T extends DocCustomSchema> {
|
|
1206
|
+
readonly value: DocFileIndexSchema<keyof T>;
|
|
1116
1207
|
readonly customSchema: T;
|
|
1117
|
-
constructor(value:
|
|
1118
|
-
private validateValue;
|
|
1119
|
-
private getValueField;
|
|
1120
|
-
get keys(): Array<keyof T>;
|
|
1121
|
-
/**
|
|
1122
|
-
* Return a new instance with a single property updated
|
|
1123
|
-
*/
|
|
1124
|
-
withProperty<K extends keyof T>(key: K, value: BaseFieldValueType<ExtractFieldType<T[K]>>): DocFileMdMetaValue<T>;
|
|
1125
|
-
/**
|
|
1126
|
-
* Return a new instance with an unknown schema
|
|
1127
|
-
* Allows accepting Record<string, unknown> schemas from external sources
|
|
1128
|
-
*/
|
|
1129
|
-
withUnknownSchema(draft: Record<string, unknown>): DocFileMdMetaValue<DocCustomSchema>;
|
|
1130
|
-
schemaField<K extends keyof T>(key: K): T[K];
|
|
1131
|
-
field<K extends keyof T>(key: K): FieldValueType<ExtractFieldType<T[K]>, ExtractRequired<T[K]>>;
|
|
1132
|
-
relation(key: keyof T): DocMetaFieldRelation;
|
|
1133
|
-
multiRelation(key: keyof T): DocMetaFieldMultiRelation;
|
|
1134
|
-
text(key: keyof T): DocMetaFieldText;
|
|
1135
|
-
number(key: keyof T): DocMetaFieldNumber;
|
|
1136
|
-
boolean(key: keyof T): DocMetaFieldBoolean;
|
|
1137
|
-
multiText(key: keyof T): DocMetaFieldMultiText;
|
|
1138
|
-
multiNumber(key: keyof T): DocMetaFieldMultiNumber;
|
|
1139
|
-
multiBoolean(key: keyof T): DocMetaFieldMultiBoolean;
|
|
1140
|
-
hasKey(key: keyof T): boolean;
|
|
1141
|
-
/**
|
|
1142
|
-
* Generate from Markdown text
|
|
1143
|
-
*/
|
|
1144
|
-
static fromYamlText<T extends DocCustomSchema>(yamlText: string, customSchema: T): DocFileMdMetaValue<T>;
|
|
1145
|
-
static empty<T extends DocCustomSchema>(customSchema: T): DocFileMdMetaValue<T>;
|
|
1146
|
-
toJson(): SchemaToValueType<T>;
|
|
1147
|
-
toYaml(): string;
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
|
-
/**
|
|
1151
|
-
* File: Markdown > Content
|
|
1152
|
-
*/
|
|
1153
|
-
declare class DocFileMdContentValue<T extends DocCustomSchema> {
|
|
1154
|
-
readonly value: DocFileMdContent<T>;
|
|
1155
|
-
private readonly customSchema;
|
|
1156
|
-
constructor(value: DocFileMdContent<T>, customSchema: T);
|
|
1208
|
+
constructor(value: DocFileIndexSchema<keyof T>, customSchema: T);
|
|
1157
1209
|
/**
|
|
1158
|
-
*
|
|
1210
|
+
* Get list of field names
|
|
1211
|
+
* Automatically type-safe when using Zod schema
|
|
1159
1212
|
*/
|
|
1160
|
-
get
|
|
1213
|
+
get fieldNames(): Array<keyof T>;
|
|
1161
1214
|
/**
|
|
1162
|
-
*
|
|
1215
|
+
* Get field with specified field name
|
|
1216
|
+
* Returns type-safe specific field Value object
|
|
1163
1217
|
*/
|
|
1164
|
-
|
|
1218
|
+
field<K extends keyof T>(key: K): T[K]["type"] extends infer Type ? Type extends "text" ? DocSchemaFieldTextValue<K> : Type extends "number" ? DocSchemaFieldNumberValue<K> : Type extends "boolean" ? DocSchemaFieldBooleanValue<K> : Type extends "relation" ? DocSchemaFieldRelationValue<K> : Type extends "select-text" ? DocSchemaFieldSelectTextValue<K> : Type extends "select-number" ? DocSchemaFieldSelectNumberValue<K> : Type extends "multi-text" ? DocSchemaFieldMultiTextValue<K> : Type extends "multi-number" ? DocSchemaFieldMultiNumberValue<K> : Type extends "multi-relation" ? DocSchemaFieldMultiRelationValue<K> : Type extends "multi-select-text" ? DocSchemaFieldMultiSelectTextValue<K> : Type extends "multi-select-number" ? DocSchemaFieldMultiSelectNumberValue<K> : never : never;
|
|
1219
|
+
relation<K extends keyof T>(key: K): DocSchemaFieldRelationValue<K>;
|
|
1220
|
+
multiRelation<K extends keyof T>(key: K): DocSchemaFieldMultiRelationValue<K>;
|
|
1165
1221
|
/**
|
|
1166
|
-
*
|
|
1222
|
+
* Get all fields
|
|
1223
|
+
* Note: For type safety, it's recommended to use field() method individually
|
|
1167
1224
|
*/
|
|
1168
|
-
get
|
|
1225
|
+
get fields(): DocFileIndexSchema<keyof T>[keyof T][];
|
|
1226
|
+
get relationFields(): (DocSchemaFieldRelationValue<string> | DocSchemaFieldMultiRelationValue<string>)[];
|
|
1227
|
+
toJson(): DocFileIndexSchema<keyof T>;
|
|
1169
1228
|
/**
|
|
1170
|
-
*
|
|
1229
|
+
* Create empty schema entity
|
|
1230
|
+
* biome-ignore lint/complexity/noBannedTypes: {} as DocCustomSchema
|
|
1171
1231
|
*/
|
|
1172
|
-
|
|
1232
|
+
static empty(): DocFileIndexSchemaValue<{}>;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1235
|
+
/**
|
|
1236
|
+
* File: index.md > content > FrontMatter
|
|
1237
|
+
*/
|
|
1238
|
+
declare class DocFileIndexMetaValue<T extends DocCustomSchema> {
|
|
1239
|
+
readonly value: DocFileIndexMeta<T>;
|
|
1240
|
+
readonly customSchema: T;
|
|
1241
|
+
private readonly config;
|
|
1173
1242
|
/**
|
|
1174
|
-
*
|
|
1243
|
+
* Additional properties to include in the meta data
|
|
1175
1244
|
*/
|
|
1176
|
-
|
|
1245
|
+
private readonly additionalProperties;
|
|
1246
|
+
constructor(value: DocFileIndexMeta<T>, customSchema: T, config: DocClientConfig, additionalProperties?: Record<string, unknown>);
|
|
1177
1247
|
/**
|
|
1178
|
-
*
|
|
1248
|
+
* Get icon
|
|
1179
1249
|
*/
|
|
1180
|
-
|
|
1250
|
+
get icon(): string | null;
|
|
1181
1251
|
/**
|
|
1182
|
-
*
|
|
1252
|
+
* Get schema
|
|
1183
1253
|
*/
|
|
1184
|
-
|
|
1254
|
+
schema(): DocFileIndexSchemaValue<T>;
|
|
1185
1255
|
/**
|
|
1186
|
-
*
|
|
1256
|
+
* Check if schema is defined
|
|
1187
1257
|
*/
|
|
1188
|
-
|
|
1258
|
+
get hasSchema(): boolean;
|
|
1189
1259
|
/**
|
|
1190
|
-
* Update
|
|
1260
|
+
* Update icon field
|
|
1191
1261
|
*/
|
|
1192
|
-
|
|
1262
|
+
withIcon(value: string | null): DocFileIndexMetaValue<T>;
|
|
1193
1263
|
/**
|
|
1194
|
-
*
|
|
1264
|
+
* Update schema field
|
|
1195
1265
|
*/
|
|
1196
|
-
|
|
1266
|
+
withSchema(value: DocFileIndexSchema<keyof T>): DocFileIndexMetaValue<T>;
|
|
1197
1267
|
/**
|
|
1198
|
-
*
|
|
1268
|
+
* Return a new instance with an unknown schema
|
|
1269
|
+
* Allows accepting Record<string, unknown> schemas from external sources
|
|
1199
1270
|
*/
|
|
1200
|
-
|
|
1271
|
+
withUnknownSchema(draft: Record<string, unknown>): DocFileIndexMetaValue<DocCustomSchema>;
|
|
1201
1272
|
/**
|
|
1202
|
-
*
|
|
1273
|
+
* Output in JSON format
|
|
1203
1274
|
*/
|
|
1204
|
-
|
|
1275
|
+
toJson(): DocFileIndexMeta<T>;
|
|
1205
1276
|
/**
|
|
1206
|
-
*
|
|
1277
|
+
* Output in YAML format
|
|
1207
1278
|
*/
|
|
1208
|
-
|
|
1279
|
+
toYaml(): string;
|
|
1209
1280
|
/**
|
|
1210
|
-
*
|
|
1281
|
+
* Generate from Markdown text (can process incomplete data)
|
|
1211
1282
|
*/
|
|
1212
|
-
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
/**
|
|
1216
|
-
* Markdown file entity
|
|
1217
|
-
*/
|
|
1218
|
-
declare class DocFileMdEntity<T extends DocCustomSchema> {
|
|
1219
|
-
readonly value: DocFileMd<T>;
|
|
1220
|
-
private readonly customSchema;
|
|
1221
|
-
constructor(value: DocFileMd<T>, customSchema: T);
|
|
1283
|
+
static from<T extends DocCustomSchema>(markdownText: string, customSchema: T, config: DocClientConfig): DocFileIndexMetaValue<T>;
|
|
1222
1284
|
/**
|
|
1223
|
-
*
|
|
1285
|
+
* Generate directly from data (can process incomplete data)
|
|
1224
1286
|
*/
|
|
1225
|
-
|
|
1287
|
+
static fromRecord<T extends DocCustomSchema>(record: Record<string, unknown>, customSchema: T, config: DocClientConfig): DocFileIndexMetaValue<T>;
|
|
1226
1288
|
/**
|
|
1227
|
-
*
|
|
1289
|
+
* Generate empty FrontMatter
|
|
1228
1290
|
*/
|
|
1229
|
-
|
|
1291
|
+
static empty<T extends DocCustomSchema>(customSchema: T, config: DocClientConfig): DocFileIndexMetaValue<T>;
|
|
1230
1292
|
/**
|
|
1231
|
-
*
|
|
1293
|
+
* Extract icon
|
|
1232
1294
|
*/
|
|
1233
|
-
|
|
1295
|
+
private static extractIcon;
|
|
1234
1296
|
/**
|
|
1235
|
-
*
|
|
1297
|
+
* Extract schema part
|
|
1236
1298
|
*/
|
|
1237
|
-
|
|
1238
|
-
withMeta(meta: DocFileMdMetaValue<T>): DocFileMdEntity<T>;
|
|
1239
|
-
withTitle(title: string): DocFileMdEntity<T>;
|
|
1240
|
-
withDescription(description: string, defaultTitle?: string): DocFileMdEntity<T>;
|
|
1299
|
+
private static extractSchema;
|
|
1241
1300
|
/**
|
|
1242
|
-
*
|
|
1301
|
+
* Normalize entire schema
|
|
1243
1302
|
*/
|
|
1244
|
-
|
|
1303
|
+
private static normalizeSchema;
|
|
1304
|
+
static emptySchema<T extends DocCustomSchema>(customSchema: T): DocFileIndexSchema<keyof T>;
|
|
1245
1305
|
}
|
|
1246
1306
|
|
|
1247
|
-
type Props$6<T extends DocCustomSchema> = {
|
|
1248
|
-
path: string;
|
|
1249
|
-
fileSystem: DocFileSystem;
|
|
1250
|
-
pathSystem: DocPathSystem;
|
|
1251
|
-
customSchema: T;
|
|
1252
|
-
config: DocClientConfig;
|
|
1253
|
-
};
|
|
1254
1307
|
/**
|
|
1255
|
-
* File
|
|
1308
|
+
* File: index.md > content
|
|
1256
1309
|
*/
|
|
1257
|
-
declare class
|
|
1258
|
-
|
|
1259
|
-
private readonly pathSystem;
|
|
1310
|
+
declare class DocFileIndexContentValue<T extends DocCustomSchema> {
|
|
1311
|
+
readonly value: DocFileIndexContent<T>;
|
|
1260
1312
|
private readonly customSchema;
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
get basePath(): string;
|
|
1264
|
-
get path(): string;
|
|
1265
|
-
get fullPath(): string;
|
|
1266
|
-
get directoryPath(): string;
|
|
1267
|
-
get archivedPath(): string;
|
|
1268
|
-
get name(): string;
|
|
1269
|
-
get nameWithExtension(): string;
|
|
1270
|
-
exists(): Promise<boolean>;
|
|
1271
|
-
read(): Promise<DocFileMdEntity<T> | Error>;
|
|
1272
|
-
/**
|
|
1273
|
-
* Read file content
|
|
1274
|
-
*/
|
|
1275
|
-
readText(): Promise<Error | string>;
|
|
1276
|
-
/**
|
|
1277
|
-
* Write entity
|
|
1278
|
-
*/
|
|
1279
|
-
write(entity: DocFileMdEntity<T>): Promise<null>;
|
|
1280
|
-
writeText(text: string): Promise<void>;
|
|
1281
|
-
/**
|
|
1282
|
-
* Create new file with default content
|
|
1283
|
-
*/
|
|
1284
|
-
writeDefault(): Promise<void>;
|
|
1313
|
+
private readonly config;
|
|
1314
|
+
constructor(value: DocFileIndexContent<T>, customSchema: T, config: DocClientConfig);
|
|
1285
1315
|
/**
|
|
1286
|
-
*
|
|
1316
|
+
* Content body (does not include frontMatter)
|
|
1287
1317
|
*/
|
|
1288
|
-
|
|
1318
|
+
get body(): string;
|
|
1289
1319
|
/**
|
|
1290
|
-
*
|
|
1320
|
+
* Title
|
|
1291
1321
|
*/
|
|
1292
|
-
|
|
1322
|
+
get title(): string;
|
|
1293
1323
|
/**
|
|
1294
|
-
*
|
|
1324
|
+
* Description
|
|
1295
1325
|
*/
|
|
1296
|
-
|
|
1326
|
+
get description(): string;
|
|
1297
1327
|
/**
|
|
1298
|
-
*
|
|
1328
|
+
* FrontMatter
|
|
1299
1329
|
*/
|
|
1300
|
-
|
|
1330
|
+
meta(): DocFileIndexMetaValue<T>;
|
|
1301
1331
|
/**
|
|
1302
|
-
*
|
|
1332
|
+
* Update title
|
|
1303
1333
|
*/
|
|
1304
|
-
|
|
1334
|
+
withTitle(title: string): DocFileIndexContentValue<T>;
|
|
1305
1335
|
/**
|
|
1306
|
-
*
|
|
1336
|
+
* Update description
|
|
1307
1337
|
*/
|
|
1308
|
-
|
|
1338
|
+
withDescription(description: string, defaultTitle?: string): DocFileIndexContentValue<T>;
|
|
1309
1339
|
/**
|
|
1310
|
-
*
|
|
1340
|
+
* Generate from Markdown text
|
|
1311
1341
|
*/
|
|
1312
|
-
|
|
1342
|
+
static fromMarkdown<T extends DocCustomSchema>(markdown: string, customSchema: T, config: DocClientConfig): DocFileIndexContentValue<T>;
|
|
1313
1343
|
/**
|
|
1314
|
-
*
|
|
1344
|
+
* Generate complete Markdown text
|
|
1315
1345
|
*/
|
|
1316
|
-
|
|
1317
|
-
directory(): DocDirectoryReference<T>;
|
|
1346
|
+
toMarkdownText(): string;
|
|
1318
1347
|
/**
|
|
1319
|
-
*
|
|
1348
|
+
* Update content
|
|
1320
1349
|
*/
|
|
1321
|
-
|
|
1350
|
+
withContent(content: string): DocFileIndexContentValue<T>;
|
|
1322
1351
|
/**
|
|
1323
|
-
*
|
|
1352
|
+
* Update FrontMatter
|
|
1324
1353
|
*/
|
|
1325
|
-
|
|
1354
|
+
withMeta(meta: DocFileIndexMeta<T>): DocFileIndexContentValue<T>;
|
|
1326
1355
|
/**
|
|
1327
|
-
*
|
|
1356
|
+
* Generate default index.md content
|
|
1328
1357
|
*/
|
|
1329
|
-
|
|
1358
|
+
static empty<T extends DocCustomSchema = DocCustomSchema>(directoryName: string, customSchema: T, config: DocClientConfig): DocFileIndexContentValue<T>;
|
|
1330
1359
|
/**
|
|
1331
|
-
*
|
|
1360
|
+
* Generate complete text combining FrontMatter and body
|
|
1332
1361
|
*/
|
|
1333
|
-
|
|
1362
|
+
toText(): string;
|
|
1334
1363
|
/**
|
|
1335
|
-
*
|
|
1364
|
+
* Output in JSON format
|
|
1336
1365
|
*/
|
|
1337
|
-
|
|
1366
|
+
toJson(): DocFileIndexContent<T>;
|
|
1338
1367
|
}
|
|
1339
1368
|
|
|
1340
1369
|
/**
|
|
1341
|
-
*
|
|
1370
|
+
* Document directory entity
|
|
1342
1371
|
*/
|
|
1343
|
-
declare class
|
|
1344
|
-
readonly value:
|
|
1345
|
-
|
|
1372
|
+
declare class DocFileIndexEntity<T extends DocCustomSchema> {
|
|
1373
|
+
readonly value: DocFileIndex<T>;
|
|
1374
|
+
private readonly customSchema;
|
|
1375
|
+
private readonly config;
|
|
1376
|
+
constructor(value: DocFileIndex<T>, customSchema: T, config?: DocClientConfig);
|
|
1346
1377
|
/**
|
|
1347
1378
|
* Content
|
|
1348
1379
|
*/
|
|
1349
|
-
get content():
|
|
1380
|
+
get content(): DocFileIndexContentValue<T>;
|
|
1350
1381
|
/**
|
|
1351
1382
|
* Path information
|
|
1352
1383
|
*/
|
|
@@ -1354,36 +1385,38 @@ declare class DocFileUnknownEntity {
|
|
|
1354
1385
|
/**
|
|
1355
1386
|
* Update content
|
|
1356
1387
|
*/
|
|
1357
|
-
withContent(content:
|
|
1388
|
+
withContent(content: DocFileIndexContentValue<T>): DocFileIndexEntity<T>;
|
|
1358
1389
|
/**
|
|
1359
1390
|
* Update path
|
|
1360
1391
|
*/
|
|
1361
|
-
withPath(path: DocFilePath):
|
|
1362
|
-
|
|
1392
|
+
withPath(path: DocFilePath): DocFileIndexEntity<T>;
|
|
1393
|
+
/**
|
|
1394
|
+
* Convert to index file schema format
|
|
1395
|
+
*/
|
|
1396
|
+
toJson(): DocFileIndex<T>;
|
|
1363
1397
|
}
|
|
1364
1398
|
|
|
1365
|
-
type Props$5 = {
|
|
1399
|
+
type Props$5<T extends DocCustomSchema> = {
|
|
1400
|
+
customSchema: T;
|
|
1366
1401
|
path: string;
|
|
1367
1402
|
fileSystem: DocFileSystem;
|
|
1368
1403
|
pathSystem: DocPathSystem;
|
|
1369
1404
|
config: DocClientConfig;
|
|
1370
1405
|
};
|
|
1371
1406
|
/**
|
|
1372
|
-
* File reference
|
|
1407
|
+
* File reference class
|
|
1373
1408
|
*/
|
|
1374
|
-
declare class
|
|
1409
|
+
declare class DocFileIndexReference<T extends DocCustomSchema> {
|
|
1375
1410
|
private readonly props;
|
|
1376
1411
|
private readonly pathSystem;
|
|
1377
|
-
|
|
1412
|
+
private readonly customSchema;
|
|
1413
|
+
constructor(props: Props$5<T>);
|
|
1378
1414
|
get fileSystem(): DocFileSystem;
|
|
1379
1415
|
get basePath(): string;
|
|
1380
|
-
get
|
|
1381
|
-
get directoryPath(): string;
|
|
1416
|
+
get filePath(): string;
|
|
1382
1417
|
get fileFullPath(): string;
|
|
1383
1418
|
get durectoryPath(): string;
|
|
1384
|
-
|
|
1385
|
-
directory(): DocDirectoryReference<DocCustomSchema>;
|
|
1386
|
-
read(): Promise<Error | DocFileUnknownEntity>;
|
|
1419
|
+
read(): Promise<DocFileIndexEntity<T>>;
|
|
1387
1420
|
/**
|
|
1388
1421
|
* Read file content
|
|
1389
1422
|
*/
|
|
@@ -1395,11 +1428,11 @@ declare class DocFileUnknownReference {
|
|
|
1395
1428
|
/**
|
|
1396
1429
|
* Write entity
|
|
1397
1430
|
*/
|
|
1398
|
-
write(entity:
|
|
1431
|
+
write(entity: DocFileIndexEntity<T>): Promise<void>;
|
|
1399
1432
|
/**
|
|
1400
|
-
*
|
|
1433
|
+
* Create new file with default content
|
|
1401
1434
|
*/
|
|
1402
|
-
|
|
1435
|
+
writeDefault(): Promise<null>;
|
|
1403
1436
|
/**
|
|
1404
1437
|
* Delete file
|
|
1405
1438
|
*/
|
|
@@ -1408,34 +1441,28 @@ declare class DocFileUnknownReference {
|
|
|
1408
1441
|
* Check if file exists
|
|
1409
1442
|
*/
|
|
1410
1443
|
exists(): Promise<boolean>;
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
*/
|
|
1414
|
-
copyTo(destinationPath: string): Promise<void>;
|
|
1415
|
-
/**
|
|
1416
|
-
* Move file
|
|
1417
|
-
*/
|
|
1418
|
-
moveTo(destinationPath: string): Promise<void>;
|
|
1444
|
+
relations(): Promise<DocFileRelationReference[]>;
|
|
1445
|
+
readRelations(): Promise<DocRelationValue[]>;
|
|
1419
1446
|
/**
|
|
1420
1447
|
* Get file size in bytes
|
|
1421
1448
|
*/
|
|
1422
1449
|
size(): Promise<number>;
|
|
1423
1450
|
/**
|
|
1424
|
-
* Get
|
|
1451
|
+
* Get last modified date
|
|
1425
1452
|
*/
|
|
1426
1453
|
lastModified(): Promise<Date>;
|
|
1427
1454
|
/**
|
|
1428
|
-
* Get file creation
|
|
1455
|
+
* Get file creation date
|
|
1429
1456
|
*/
|
|
1430
1457
|
createdAt(): Promise<Date>;
|
|
1431
1458
|
/**
|
|
1432
1459
|
* Move file to archive and return new reference
|
|
1433
1460
|
*/
|
|
1434
|
-
archive(archiveDirectoryName?: string): Promise<
|
|
1461
|
+
archive(archiveDirectoryName?: string): Promise<DocFileIndexReference<T>>;
|
|
1435
1462
|
/**
|
|
1436
1463
|
* Restore file from archive and return new reference
|
|
1437
1464
|
*/
|
|
1438
|
-
restore(archiveDirectoryName?: string): Promise<
|
|
1465
|
+
restore(archiveDirectoryName?: string): Promise<DocFileIndexReference<T>>;
|
|
1439
1466
|
}
|
|
1440
1467
|
|
|
1441
1468
|
type Props$4<T extends DocCustomSchema> = {
|
|
@@ -1469,8 +1496,8 @@ declare class DocDirectoryReference<T extends DocCustomSchema> {
|
|
|
1469
1496
|
mdFilesGenerator(): AsyncGenerator<DocFileMdReference<T>, void, unknown>;
|
|
1470
1497
|
files(): Promise<(DocFileMdReference<T> | DocFileUnknownReference)[]>;
|
|
1471
1498
|
mdFiles(): Promise<DocFileMdReference<T>[]>;
|
|
1472
|
-
file(fileName:
|
|
1473
|
-
mdFile(fileName: string):
|
|
1499
|
+
file<FileName extends string>(fileName: FileName): InferReference<FileName, T>;
|
|
1500
|
+
mdFile(fileName: string): DocFileMdReference<T>;
|
|
1474
1501
|
readFiles(): Promise<(DocFileMdEntity<T> | DocFileUnknownEntity)[]>;
|
|
1475
1502
|
readMdFiles(): Promise<DocFileMdEntity<T>[]>;
|
|
1476
1503
|
readUnknownFiles(): Promise<DocFileUnknownEntity[]>;
|
|
@@ -1481,13 +1508,13 @@ declare class DocDirectoryReference<T extends DocCustomSchema> {
|
|
|
1481
1508
|
/**
|
|
1482
1509
|
* Get subdirectory references
|
|
1483
1510
|
*/
|
|
1484
|
-
directories(): Promise<DocDirectoryReference<
|
|
1511
|
+
directories(): Promise<DocDirectoryReference<T>[]>;
|
|
1485
1512
|
/**
|
|
1486
1513
|
* Get single subdirectory reference
|
|
1487
1514
|
*/
|
|
1488
1515
|
directory(directoryName: string): DocDirectoryReference<T>;
|
|
1489
1516
|
indexFile(): DocFileIndexReference<T>;
|
|
1490
|
-
readIndexFile(): Promise<DocFileIndexEntity<T
|
|
1517
|
+
readIndexFile(): Promise<DocFileIndexEntity<T> | Error>;
|
|
1491
1518
|
writeFile(entity: DocFileIndexEntity<T> | DocFileMdEntity<T> | DocFileUnknownEntity): Promise<Error | null>;
|
|
1492
1519
|
exists(): Promise<boolean>;
|
|
1493
1520
|
/**
|
|
@@ -1672,8 +1699,8 @@ declare class DocClient {
|
|
|
1672
1699
|
readonly config: DocClientConfig;
|
|
1673
1700
|
constructor(props: Props);
|
|
1674
1701
|
basePath(): string;
|
|
1675
|
-
file(relativePath:
|
|
1676
|
-
file<T extends DocCustomSchema>(relativePath:
|
|
1702
|
+
file<Path extends string>(relativePath: Path): InferReference<Path, DocCustomSchema>;
|
|
1703
|
+
file<Path extends string, T extends DocCustomSchema>(relativePath: Path, customSchema: T): InferReference<Path, T>;
|
|
1677
1704
|
mdFile(relativePath: string): DocFileMdReference<DocCustomSchema>;
|
|
1678
1705
|
mdFile<T extends DocCustomSchema>(relativePath: string, customSchema: T): DocFileMdReference<T>;
|
|
1679
1706
|
indexFile(relativePath: string): DocFileIndexReference<DocCustomSchema>;
|
|
@@ -1763,8 +1790,6 @@ declare class DocFileSystemDebug extends DocFileSystem {
|
|
|
1763
1790
|
setupTestFiles(files: Record<string, string>): void;
|
|
1764
1791
|
}
|
|
1765
1792
|
|
|
1766
|
-
type DocFileEntity<T extends DocCustomSchema> = DocFileMdEntity<T> | DocFileIndexEntity<T> | DocFileUnknownEntity;
|
|
1767
|
-
|
|
1768
1793
|
/**
|
|
1769
1794
|
* Schema builder
|
|
1770
1795
|
* Build schemas in a chain style
|
|
@@ -1776,56 +1801,58 @@ type DocFileEntity<T extends DocCustomSchema> = DocFileMdEntity<T> | DocFileInde
|
|
|
1776
1801
|
* .selectText("priority", false)
|
|
1777
1802
|
* .build()
|
|
1778
1803
|
*/
|
|
1779
|
-
declare class
|
|
1804
|
+
declare class DocSchemaBuilder<T extends DocCustomSchema> {
|
|
1780
1805
|
private schema;
|
|
1781
1806
|
constructor(schema?: T);
|
|
1782
|
-
text<K extends string>(key: K, required: boolean):
|
|
1807
|
+
text<K extends string>(key: K, required: boolean): DocSchemaBuilder<T & Record<K, {
|
|
1783
1808
|
type: "text";
|
|
1784
1809
|
required: boolean;
|
|
1785
1810
|
}>>;
|
|
1786
|
-
number<K extends string>(key: K, required: boolean):
|
|
1811
|
+
number<K extends string>(key: K, required: boolean): DocSchemaBuilder<T & Record<K, {
|
|
1787
1812
|
type: "number";
|
|
1788
1813
|
required: boolean;
|
|
1789
1814
|
}>>;
|
|
1790
|
-
boolean<K extends string>(key: K, required: boolean):
|
|
1815
|
+
boolean<K extends string>(key: K, required: boolean): DocSchemaBuilder<T & Record<K, {
|
|
1791
1816
|
type: "boolean";
|
|
1792
1817
|
required: boolean;
|
|
1793
1818
|
}>>;
|
|
1794
|
-
relation<K extends string>(key: K, required: boolean):
|
|
1819
|
+
relation<K extends string>(key: K, required: boolean): DocSchemaBuilder<T & Record<K, {
|
|
1795
1820
|
type: "relation";
|
|
1796
1821
|
required: boolean;
|
|
1797
1822
|
}>>;
|
|
1798
|
-
multiRelation<K extends string>(key: K, required: boolean):
|
|
1823
|
+
multiRelation<K extends string>(key: K, required: boolean): DocSchemaBuilder<T & Record<K, {
|
|
1799
1824
|
type: "multi-relation";
|
|
1800
1825
|
required: boolean;
|
|
1801
1826
|
}>>;
|
|
1802
|
-
selectText<K extends string>(key: K, required: boolean):
|
|
1827
|
+
selectText<K extends string>(key: K, required: boolean): DocSchemaBuilder<T & Record<K, {
|
|
1803
1828
|
type: "select-text";
|
|
1804
1829
|
required: boolean;
|
|
1805
1830
|
}>>;
|
|
1806
|
-
selectNumber<K extends string>(key: K, required: boolean):
|
|
1831
|
+
selectNumber<K extends string>(key: K, required: boolean): DocSchemaBuilder<T & Record<K, {
|
|
1807
1832
|
type: "select-number";
|
|
1808
1833
|
required: boolean;
|
|
1809
1834
|
}>>;
|
|
1810
|
-
multiText<K extends string>(key: K, required: boolean):
|
|
1835
|
+
multiText<K extends string>(key: K, required: boolean): DocSchemaBuilder<T & Record<K, {
|
|
1811
1836
|
type: "multi-text";
|
|
1812
1837
|
required: boolean;
|
|
1813
1838
|
}>>;
|
|
1814
|
-
multiNumber<K extends string>(key: K, required: boolean):
|
|
1839
|
+
multiNumber<K extends string>(key: K, required: boolean): DocSchemaBuilder<T & Record<K, {
|
|
1815
1840
|
type: "multi-number";
|
|
1816
1841
|
required: boolean;
|
|
1817
1842
|
}>>;
|
|
1818
|
-
multiSelectText<K extends string>(key: K, required: boolean):
|
|
1843
|
+
multiSelectText<K extends string>(key: K, required: boolean): DocSchemaBuilder<T & Record<K, {
|
|
1819
1844
|
type: "multi-select-text";
|
|
1820
1845
|
required: boolean;
|
|
1821
1846
|
}>>;
|
|
1822
|
-
multiSelectNumber<K extends string>(key: K, required: boolean):
|
|
1847
|
+
multiSelectNumber<K extends string>(key: K, required: boolean): DocSchemaBuilder<T & Record<K, {
|
|
1823
1848
|
type: "multi-select-number";
|
|
1824
1849
|
required: boolean;
|
|
1825
1850
|
}>>;
|
|
1826
1851
|
build(): T;
|
|
1827
1852
|
}
|
|
1828
1853
|
|
|
1854
|
+
type DocFileEntity<T extends DocCustomSchema> = DocFileMdEntity<T> | DocFileIndexEntity<T> | DocFileUnknownEntity;
|
|
1855
|
+
|
|
1829
1856
|
/**
|
|
1830
1857
|
* Function that only performs type checking (does nothing at runtime)
|
|
1831
1858
|
*/
|
|
@@ -1911,4 +1938,4 @@ declare const docCustomSchemaField: {
|
|
|
1911
1938
|
};
|
|
1912
1939
|
};
|
|
1913
1940
|
|
|
1914
|
-
export { type BaseFieldValueType, DocClient, type DocClientConfig, type DocCustomSchema, type DocCustomSchemaField, type DocCustomSchemaFieldBoolean, type DocCustomSchemaFieldMultiNumber, type DocCustomSchemaFieldMultiRelation, type DocCustomSchemaFieldMultiSelectNumber, type DocCustomSchemaFieldMultiSelectText, type DocCustomSchemaFieldMultiText, type DocCustomSchemaFieldNumber, type DocCustomSchemaFieldRelation, type DocCustomSchemaFieldSelectNumber, type DocCustomSchemaFieldSelectText, type DocCustomSchemaFieldText, type DocDirectory, DocDirectoryReference, type DocFieldTypeLiteral, type DocFile, type DocFileEntity, type DocFileIndex, type DocFileIndexContent, DocFileIndexEntity, type DocFileIndexMeta, DocFileIndexReference, type DocFileIndexSchema, type DocFileIndexSchemaField, type DocFileMd, type DocFileMdContent, DocFileMdEntity, type DocFileMdMeta, DocFileMdReference, type DocFilePath, DocFileRelationReference, DocFileSystem, DocFileSystemDebug, 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, type DocSchemaFieldBoolean, type DocSchemaFieldMultiNumber, type DocSchemaFieldMultiRelation, type DocSchemaFieldMultiSelectNumber, type DocSchemaFieldMultiSelectText, type DocSchemaFieldMultiText, type DocSchemaFieldNumber, type DocSchemaFieldRelation, type DocSchemaFieldSelectNumber, type DocSchemaFieldSelectText, type DocSchemaFieldText, type DocSchemaRelationFieldUnion, type DocTreeDirectoryNode, type DocTreeFileNode, type DocTreeNode, type Equals, type ExtractFieldType, type ExtractIndexFieldType, type ExtractRequired, type FieldValueType,
|
|
1941
|
+
export { type BaseFieldValueType, type DetectFileType, DocClient, type DocClientConfig, type DocCustomSchema, type DocCustomSchemaField, type DocCustomSchemaFieldBoolean, type DocCustomSchemaFieldMultiNumber, type DocCustomSchemaFieldMultiRelation, type DocCustomSchemaFieldMultiSelectNumber, type DocCustomSchemaFieldMultiSelectText, type DocCustomSchemaFieldMultiText, type DocCustomSchemaFieldNumber, type DocCustomSchemaFieldRelation, type DocCustomSchemaFieldSelectNumber, type DocCustomSchemaFieldSelectText, type DocCustomSchemaFieldText, type DocDirectory, DocDirectoryReference, type DocFieldTypeLiteral, type DocFile, type DocFileEntity, type DocFileIndex, type DocFileIndexContent, DocFileIndexEntity, type DocFileIndexMeta, DocFileIndexReference, type DocFileIndexSchema, type DocFileIndexSchemaField, type DocFileMd, type DocFileMdContent, DocFileMdEntity, type DocFileMdMeta, DocFileMdReference, type DocFilePath, DocFileRelationReference, DocFileSystem, DocFileSystemDebug, DocFileTreeSystem, type DocFileUnknown, DocFileUnknownEntity, DocFileUnknownReference, DocMarkdownSystem, type DocMetaField, type DocMetaFieldBoolean, type DocMetaFieldMultiBoolean, type DocMetaFieldMultiNumber, type DocMetaFieldMultiRelation, type DocMetaFieldMultiSelectNumber, type DocMetaFieldMultiSelectText, type DocMetaFieldMultiText, type DocMetaFieldNumber, type DocMetaFieldRelation, type DocMetaFieldSelectNumber, type DocMetaFieldSelectText, type DocMetaFieldText, type DocMetaFieldType, type DocMetaFieldTypeBoolean, type DocMetaFieldTypeNumber, type DocMetaFieldTypeRelation, type DocMetaFieldTypeSelectNumber, type DocMetaFieldTypeSelectText, type DocMetaFieldTypeText, DocPathSystem, type DocRelation, type DocRelationField, type DocRelationFile, DocSchemaBuilder, type DocSchemaFieldBoolean, type DocSchemaFieldMultiNumber, type DocSchemaFieldMultiRelation, type DocSchemaFieldMultiSelectNumber, type DocSchemaFieldMultiSelectText, type DocSchemaFieldMultiText, type DocSchemaFieldNumber, type DocSchemaFieldRelation, type DocSchemaFieldSelectNumber, type DocSchemaFieldSelectText, type DocSchemaFieldText, type DocSchemaRelationFieldUnion, type DocTreeDirectoryNode, type DocTreeFileNode, type DocTreeNode, type Equals, type ExtractFieldType, type ExtractIndexFieldType, type ExtractRequired, type FieldValueType, type GetIndexFieldType, type GetIndexFieldValueType, type GetValueType, type InferDocFileMd, type InferReference, type MultiRelationKeys, type OptionalKeys, type RecordKey, type RelationKeys, type RequiredKeys, type SchemaToValueType, assertType, defaultTestConfig, defineSchema, docCustomSchemaField, expectType, zDocClientConfig, zDocFileIndexSchemaField, zDocFilePath, zDocFileUnknown, zDocMetaField, zDocMetaFieldBoolean, zDocMetaFieldMultiBoolean, zDocMetaFieldMultiNumber, zDocMetaFieldMultiRelation, zDocMetaFieldMultiSelectNumber, zDocMetaFieldMultiSelectText, zDocMetaFieldMultiText, zDocMetaFieldNumber, zDocMetaFieldRelation, zDocMetaFieldSelectNumber, zDocMetaFieldSelectText, zDocMetaFieldText, zDocMetaFieldType, zDocMetaFieldTypeBoolean, zDocMetaFieldTypeNumber, zDocMetaFieldTypeRelation, zDocMetaFieldTypeSelectNumber, zDocMetaFieldTypeSelectText, zDocMetaFieldTypeText, zDocRelation, zDocRelationField, zDocRelationFile, zDocSchemaFieldBoolean, zDocSchemaFieldMultiNumber, zDocSchemaFieldMultiRelation, zDocSchemaFieldMultiSelectNumber, zDocSchemaFieldMultiSelectText, zDocSchemaFieldMultiText, zDocSchemaFieldNumber, zDocSchemaFieldRelation, zDocSchemaFieldSelectNumber, zDocSchemaFieldSelectText, zDocSchemaFieldText };
|