@interactive-inc/docs-client 1.0.14 → 1.0.16
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 +18 -25
- package/build/index.js +58 -55
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { zDocFileMd, zDocFileUnknown, zDocClientConfig, zDocFilePath, zDocFileIndexSchemaField, zDocSchemaFieldText, zDocSchemaFieldNumber, zDocSchemaFieldBoolean, zDocSchemaFieldRelation, zDocSchemaFieldSelectText, zDocSchemaFieldSelectNumber, zDocSchemaFieldMultiText, zDocSchemaFieldMultiNumber, zDocSchemaFieldMultiRelation, zDocSchemaFieldMultiSelectText, zDocSchemaFieldMultiSelectNumber, zDocRelation, zDocRelationFile, zDocMetaFieldRelation, zDocMetaFieldMultiRelation, zDocMetaFieldText, zDocMetaFieldNumber, zDocMetaFieldBoolean, zDocMetaFieldMultiText, zDocMetaFieldMultiNumber, zDocRelationField, zDocMetaField, zDocMetaFieldSelectText, zDocMetaFieldSelectNumber, zDocMetaFieldMultiSelectText, zDocMetaFieldMultiSelectNumber, zDocMetaFieldTypeText, zDocMetaFieldTypeNumber, zDocMetaFieldTypeBoolean, zDocMetaFieldTypeSelectText, zDocMetaFieldTypeSelectNumber, zDocMetaFieldTypeRelation, zDocMetaFieldType
|
|
2
|
+
import { zDocFileMd, zDocFileUnknown, zDocClientConfig, zDocFilePath, zDocFileIndexSchemaField, zDocSchemaFieldText, zDocSchemaFieldNumber, zDocSchemaFieldBoolean, zDocSchemaFieldRelation, zDocSchemaFieldSelectText, zDocSchemaFieldSelectNumber, zDocSchemaFieldMultiText, zDocSchemaFieldMultiNumber, zDocSchemaFieldMultiRelation, zDocSchemaFieldMultiSelectText, zDocSchemaFieldMultiSelectNumber, zDocFileIndex, zDocRelation, zDocRelationFile, zDocMetaFieldRelation, zDocMetaFieldMultiRelation, zDocMetaFieldText, zDocMetaFieldNumber, zDocMetaFieldBoolean, zDocMetaFieldMultiText, zDocMetaFieldMultiNumber, zDocRelationField, zDocMetaField, zDocMetaFieldSelectText, zDocMetaFieldSelectNumber, zDocMetaFieldMultiSelectText, zDocMetaFieldMultiSelectNumber, zDocMetaFieldTypeText, zDocMetaFieldTypeNumber, zDocMetaFieldTypeBoolean, zDocMetaFieldTypeSelectText, zDocMetaFieldTypeSelectNumber, zDocMetaFieldTypeRelation, zDocMetaFieldType } from './models.js';
|
|
3
3
|
export { zDocCustomSchema, zDocCustomSchemaField, zDocCustomSchemaFieldBoolean, zDocCustomSchemaFieldMultiNumber, zDocCustomSchemaFieldMultiRelation, zDocCustomSchemaFieldMultiSelectNumber, zDocCustomSchemaFieldMultiSelectText, zDocCustomSchemaFieldMultiText, zDocCustomSchemaFieldNumber, zDocCustomSchemaFieldRelation, zDocCustomSchemaFieldSelectNumber, zDocCustomSchemaFieldSelectText, zDocCustomSchemaFieldText, zDocFile, zDocFileDirectory, zDocFileIndexContent, zDocFileIndexMeta, zDocFileIndexMetaInput, zDocFileIndexSchema, zDocFileIndexSchemaInput, zDocFileMdContent, zDocFileMdContentInput, zDocFileMdInput, zDocFileMdMeta, zDocFileMdMetaInput, zDocMetaFieldTypeMultiNumber, zDocMetaFieldTypeMultiRelation, zDocMetaFieldTypeMultiSelectNumber, zDocMetaFieldTypeMultiSelectText, zDocMetaFieldTypeMultiText, zDocTreeDirectoryNode, zDocTreeFileNode, zDocTreeNode } from './models.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -219,10 +219,6 @@ declare class DocFileMdContentValue<T extends DocCustomSchema> {
|
|
|
219
219
|
* Generate from Markdown text
|
|
220
220
|
*/
|
|
221
221
|
static fromMarkdown<T extends DocCustomSchema>(markdown: string, customSchema: T): DocFileMdContentValue<T>;
|
|
222
|
-
/**
|
|
223
|
-
* Generate complete Markdown text
|
|
224
|
-
*/
|
|
225
|
-
toMarkdownText(): string;
|
|
226
222
|
/**
|
|
227
223
|
* Generate complete text combining FrontMatter and body
|
|
228
224
|
*/
|
|
@@ -391,27 +387,27 @@ declare class DocFileUnknownEntity {
|
|
|
391
387
|
toJson(): z.infer<typeof zDocFileUnknown>;
|
|
392
388
|
}
|
|
393
389
|
|
|
394
|
-
type Props$7 = {
|
|
390
|
+
type Props$7<T extends DocCustomSchema> = {
|
|
395
391
|
path: string;
|
|
396
392
|
fileSystem: DocFileSystem;
|
|
397
393
|
pathSystem: DocPathSystem;
|
|
394
|
+
customSchema: T;
|
|
398
395
|
config: DocClientConfig;
|
|
399
396
|
};
|
|
400
397
|
/**
|
|
401
398
|
* File reference
|
|
402
399
|
*/
|
|
403
|
-
declare class DocFileUnknownReference {
|
|
400
|
+
declare class DocFileUnknownReference<T extends DocCustomSchema> {
|
|
404
401
|
private readonly props;
|
|
405
402
|
private readonly pathSystem;
|
|
406
|
-
|
|
403
|
+
private readonly customSchema;
|
|
404
|
+
constructor(props: Props$7<T>);
|
|
407
405
|
get fileSystem(): DocFileSystem;
|
|
408
406
|
get basePath(): string;
|
|
409
407
|
get path(): string;
|
|
410
408
|
get directoryPath(): string;
|
|
411
409
|
get fileFullPath(): string;
|
|
412
|
-
|
|
413
|
-
directory<T extends DocCustomSchema>(customSchema: T): DocDirectoryReference<T>;
|
|
414
|
-
directory(): DocDirectoryReference<DocCustomSchema>;
|
|
410
|
+
directory(): DocDirectoryReference<T>;
|
|
415
411
|
read(): Promise<Error | DocFileUnknownEntity>;
|
|
416
412
|
/**
|
|
417
413
|
* Read file content
|
|
@@ -464,11 +460,11 @@ declare class DocFileUnknownReference {
|
|
|
464
460
|
/**
|
|
465
461
|
* Move file to archive and return new reference
|
|
466
462
|
*/
|
|
467
|
-
archive(archiveDirectoryName?: string): Promise<DocFileUnknownReference
|
|
463
|
+
archive(archiveDirectoryName?: string): Promise<DocFileUnknownReference<T>>;
|
|
468
464
|
/**
|
|
469
465
|
* Restore file from archive and return new reference
|
|
470
466
|
*/
|
|
471
|
-
restore(archiveDirectoryName?: string): Promise<DocFileUnknownReference
|
|
467
|
+
restore(archiveDirectoryName?: string): Promise<DocFileUnknownReference<T>>;
|
|
472
468
|
}
|
|
473
469
|
|
|
474
470
|
/**
|
|
@@ -528,6 +524,7 @@ type DocMetaFieldMultiSelectText = z.infer<typeof zDocMetaFieldMultiSelectText>;
|
|
|
528
524
|
type DocMetaFieldMultiSelectNumber = z.infer<typeof zDocMetaFieldMultiSelectNumber>;
|
|
529
525
|
type DocMetaFieldMultiRelation = z.infer<typeof zDocMetaFieldMultiRelation>;
|
|
530
526
|
type DocFileMdMeta<T extends RecordKey> = Record<T, DocMetaField>;
|
|
527
|
+
type DocFileMdMetaAny = DocFileMdMeta<RecordKey>;
|
|
531
528
|
type DocMetaFieldTypeText = z.infer<typeof zDocMetaFieldTypeText>;
|
|
532
529
|
type DocMetaFieldTypeNumber = z.infer<typeof zDocMetaFieldTypeNumber>;
|
|
533
530
|
type DocMetaFieldTypeBoolean = z.infer<typeof zDocMetaFieldTypeBoolean>;
|
|
@@ -589,7 +586,7 @@ type DocFileIndexSchemaField = z.infer<typeof zDocFileIndexSchemaField>;
|
|
|
589
586
|
/**
|
|
590
587
|
* Schema definition type
|
|
591
588
|
*/
|
|
592
|
-
type DocFileIndexSchema<T extends RecordKey> = Record<T, DocFileIndexSchemaField>;
|
|
589
|
+
type DocFileIndexSchema<T extends RecordKey = string> = Record<T, DocFileIndexSchemaField>;
|
|
593
590
|
/**
|
|
594
591
|
* Schema field to override
|
|
595
592
|
* ex: { xxx: { type: "text", required: true } }
|
|
@@ -602,7 +599,7 @@ type DocFieldTypeLiteral = "text" | "number" | "boolean" | "relation" | "multi-t
|
|
|
602
599
|
/**
|
|
603
600
|
* Minimal schema definition type
|
|
604
601
|
*/
|
|
605
|
-
type DocCustomSchema<T extends RecordKey =
|
|
602
|
+
type DocCustomSchema<T extends RecordKey = string> = Record<T, DocCustomSchemaField>;
|
|
606
603
|
/**
|
|
607
604
|
* Union type for relation fields
|
|
608
605
|
*/
|
|
@@ -723,7 +720,7 @@ type DetectFileType<T extends string> = IsIndexMd<T> extends true ? "index" : En
|
|
|
723
720
|
/**
|
|
724
721
|
* Map file type to reference class
|
|
725
722
|
*/
|
|
726
|
-
type FileTypeToReference<FileType extends string, Schema extends DocCustomSchema> = FileType extends "index" ? DocFileIndexReference<Schema> : FileType extends "markdown" ? DocFileMdReference<Schema> : DocFileUnknownReference
|
|
723
|
+
type FileTypeToReference<FileType extends string, Schema extends DocCustomSchema> = FileType extends "index" ? DocFileIndexReference<Schema> : FileType extends "markdown" ? DocFileMdReference<Schema> : DocFileUnknownReference<Schema>;
|
|
727
724
|
/**
|
|
728
725
|
* Infer reference type from path
|
|
729
726
|
*/
|
|
@@ -1330,10 +1327,6 @@ declare class DocFileIndexContentValue<T extends DocCustomSchema> {
|
|
|
1330
1327
|
* Generate from Markdown text
|
|
1331
1328
|
*/
|
|
1332
1329
|
static fromMarkdown<T extends DocCustomSchema>(markdown: string, customSchema: T, config: DocClientConfig): DocFileIndexContentValue<T>;
|
|
1333
|
-
/**
|
|
1334
|
-
* Generate complete Markdown text
|
|
1335
|
-
*/
|
|
1336
|
-
toMarkdownText(): string;
|
|
1337
1330
|
/**
|
|
1338
1331
|
* Update content
|
|
1339
1332
|
*/
|
|
@@ -1383,7 +1376,7 @@ declare class DocFileIndexEntity<T extends DocCustomSchema> {
|
|
|
1383
1376
|
/**
|
|
1384
1377
|
* z.infer<typeof zDocFileIndex>
|
|
1385
1378
|
*/
|
|
1386
|
-
toJson():
|
|
1379
|
+
toJson(): DocFileIndexAny;
|
|
1387
1380
|
}
|
|
1388
1381
|
|
|
1389
1382
|
type Props$5<T extends DocCustomSchema> = {
|
|
@@ -1460,7 +1453,7 @@ declare class DocFileIndexReference<T extends DocCustomSchema> {
|
|
|
1460
1453
|
restore(archiveDirectoryName?: string): Promise<DocFileIndexReference<T>>;
|
|
1461
1454
|
}
|
|
1462
1455
|
|
|
1463
|
-
type DocFileDirectoryReference<T extends DocCustomSchema> = DocFileMdReference<T> | DocFileUnknownReference
|
|
1456
|
+
type DocFileDirectoryReference<T extends DocCustomSchema> = DocFileMdReference<T> | DocFileUnknownReference<T>;
|
|
1464
1457
|
|
|
1465
1458
|
type DocFileEntity<T extends DocCustomSchema> = DocFileMdEntity<T> | DocFileIndexEntity<T> | DocFileUnknownEntity;
|
|
1466
1459
|
type DocFileDirectoryEntity<T extends DocCustomSchema> = DocFileMdEntity<T> | DocFileUnknownEntity;
|
|
@@ -1667,11 +1660,11 @@ declare class DocMarkdownSystem {
|
|
|
1667
1660
|
*/
|
|
1668
1661
|
extractDescription(text: string): string | null;
|
|
1669
1662
|
/**
|
|
1670
|
-
* Update title in body
|
|
1663
|
+
* Update title in body (returns body only, without FrontMatter)
|
|
1671
1664
|
*/
|
|
1672
1665
|
updateTitle(text: string, newTitle: string): string;
|
|
1673
1666
|
/**
|
|
1674
|
-
* Update description in body
|
|
1667
|
+
* Update description in body (returns body only, without FrontMatter)
|
|
1675
1668
|
*/
|
|
1676
1669
|
updateDescription(text: string, newDescription: string, defaultTitle: string): string;
|
|
1677
1670
|
/**
|
|
@@ -2163,4 +2156,4 @@ declare class DocRelationFieldValue {
|
|
|
2163
2156
|
}): DocRelationFieldValue;
|
|
2164
2157
|
}
|
|
2165
2158
|
|
|
2166
|
-
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, DocCustomSchemaFieldValue, type DocDirectory, type DocDirectoryFile, DocDirectoryPathValue, DocDirectoryReference, type DocFieldTypeLiteral, type DocFile, type DocFileAny, type DocFileEntity, type DocFileIndex, type DocFileIndexAny, type DocFileIndexContent, DocFileIndexContentValue, DocFileIndexEntity, type DocFileIndexMeta, DocFileIndexMetaValue, DocFileIndexReference, type DocFileIndexSchema, type DocFileIndexSchemaField, DocFileIndexSchemaValue, type DocFileMd, type DocFileMdAny, type DocFileMdContent, DocFileMdContentValue, DocFileMdEntity, type DocFileMdMeta, DocFileMdMetaValue, DocFileMdReference, type DocFilePath, DocFilePathValue, DocFileRelationReference, DocFileSystem, DocFileSystemMock, DocFileTreeSystem, type DocFileUnknown, DocFileUnknownEntity, DocFileUnknownReference, DocMarkdownSystem, type DocMetaField, type DocMetaFieldBoolean, type DocMetaFieldMultiNumber, type DocMetaFieldMultiRelation, type DocMetaFieldMultiSelectNumber, type DocMetaFieldMultiSelectText, type DocMetaFieldMultiText, type DocMetaFieldNumber, type DocMetaFieldRelation, type DocMetaFieldSelectNumber, type DocMetaFieldSelectText, type DocMetaFieldText, type DocMetaFieldType, type DocMetaFieldTypeBoolean, type DocMetaFieldTypeNumber, type DocMetaFieldTypeRelation, type DocMetaFieldTypeSelectNumber, type DocMetaFieldTypeSelectText, type DocMetaFieldTypeText, DocPathSystem, DocPathSystemMock, type DocRelation, type DocRelationField, DocRelationFieldValue, type DocRelationFile, DocRelationFileValue, DocRelationValue, DocSchemaBuilder, type DocSchemaFieldBoolean, type DocSchemaFieldMultiNumber, type DocSchemaFieldMultiRelation, type DocSchemaFieldMultiSelectNumber, type DocSchemaFieldMultiSelectText, type DocSchemaFieldMultiText, type DocSchemaFieldNumber, type DocSchemaFieldRelation, type DocSchemaFieldSelectNumber, type DocSchemaFieldSelectText, type DocSchemaFieldText, type DocSchemaRelationFieldUnion, type DocTreeDirectoryNode, DocTreeDirectoryNodeValue, type DocTreeFileNode, DocTreeFileNodeValue, type DocTreeNode, type DocTreeNodeValue, type Equals, type ExtractFieldType, type ExtractRequired, type FieldValueType, type GetIndexFieldType, type GetValueType, type InferDocFileMd, type InferReference, type MultiRelationKeys, type OptionalKeys, type RecordKey, type RelationKeys, type RequiredKeys, type SchemaToValueType, assertType, defaultTestConfig, defineSchema, docCustomSchemaField, expectType, zDocClientConfig, zDocFileIndex, zDocFileIndexSchemaField, zDocFileMd, zDocFilePath, zDocFileUnknown, zDocMetaField, zDocMetaFieldBoolean, 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 };
|
|
2159
|
+
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, DocCustomSchemaFieldValue, type DocDirectory, type DocDirectoryFile, DocDirectoryPathValue, DocDirectoryReference, type DocFieldTypeLiteral, type DocFile, type DocFileAny, type DocFileEntity, type DocFileIndex, type DocFileIndexAny, type DocFileIndexContent, DocFileIndexContentValue, DocFileIndexEntity, type DocFileIndexMeta, DocFileIndexMetaValue, DocFileIndexReference, type DocFileIndexSchema, type DocFileIndexSchemaField, DocFileIndexSchemaValue, type DocFileMd, type DocFileMdAny, type DocFileMdContent, DocFileMdContentValue, DocFileMdEntity, type DocFileMdMeta, type DocFileMdMetaAny, DocFileMdMetaValue, DocFileMdReference, type DocFilePath, DocFilePathValue, DocFileRelationReference, DocFileSystem, DocFileSystemMock, DocFileTreeSystem, type DocFileUnknown, DocFileUnknownEntity, DocFileUnknownReference, DocMarkdownSystem, type DocMetaField, type DocMetaFieldBoolean, type DocMetaFieldMultiNumber, type DocMetaFieldMultiRelation, type DocMetaFieldMultiSelectNumber, type DocMetaFieldMultiSelectText, type DocMetaFieldMultiText, type DocMetaFieldNumber, type DocMetaFieldRelation, type DocMetaFieldSelectNumber, type DocMetaFieldSelectText, type DocMetaFieldText, type DocMetaFieldType, type DocMetaFieldTypeBoolean, type DocMetaFieldTypeNumber, type DocMetaFieldTypeRelation, type DocMetaFieldTypeSelectNumber, type DocMetaFieldTypeSelectText, type DocMetaFieldTypeText, DocPathSystem, DocPathSystemMock, type DocRelation, type DocRelationField, DocRelationFieldValue, type DocRelationFile, DocRelationFileValue, DocRelationValue, DocSchemaBuilder, type DocSchemaFieldBoolean, type DocSchemaFieldMultiNumber, type DocSchemaFieldMultiRelation, type DocSchemaFieldMultiSelectNumber, type DocSchemaFieldMultiSelectText, type DocSchemaFieldMultiText, type DocSchemaFieldNumber, type DocSchemaFieldRelation, type DocSchemaFieldSelectNumber, type DocSchemaFieldSelectText, type DocSchemaFieldText, type DocSchemaRelationFieldUnion, type DocTreeDirectoryNode, DocTreeDirectoryNodeValue, type DocTreeFileNode, DocTreeFileNodeValue, type DocTreeNode, type DocTreeNodeValue, type Equals, type ExtractFieldType, type ExtractRequired, type FieldValueType, type GetIndexFieldType, type GetValueType, type InferDocFileMd, type InferReference, type MultiRelationKeys, type OptionalKeys, type RecordKey, type RelationKeys, type RequiredKeys, type SchemaToValueType, assertType, defaultTestConfig, defineSchema, docCustomSchemaField, expectType, zDocClientConfig, zDocFileIndex, zDocFileIndexSchemaField, zDocFileMd, zDocFilePath, zDocFileUnknown, zDocMetaField, zDocMetaFieldBoolean, 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 };
|
package/build/index.js
CHANGED
|
@@ -398,40 +398,30 @@ ${separator}`, separator.length);
|
|
|
398
398
|
return null;
|
|
399
399
|
}
|
|
400
400
|
/**
|
|
401
|
-
* Update title in body
|
|
401
|
+
* Update title in body (returns body only, without FrontMatter)
|
|
402
402
|
*/
|
|
403
403
|
updateTitle(text, newTitle) {
|
|
404
|
-
const
|
|
405
|
-
const lines = body.split("\n");
|
|
404
|
+
const lines = text.split("\n");
|
|
406
405
|
const titleIndex = lines.findIndex((line) => line.match(/^#\s+/));
|
|
407
406
|
if (titleIndex !== -1) {
|
|
408
407
|
lines[titleIndex] = `# ${newTitle}`;
|
|
409
408
|
} else {
|
|
410
409
|
lines.unshift(`# ${newTitle}`, "");
|
|
411
410
|
}
|
|
412
|
-
|
|
413
|
-
const frontMatter = this.extractFrontMatter(text);
|
|
414
|
-
const separator = this.detectFrontMatterSeparator(text);
|
|
415
|
-
return frontMatter ? `${separator}
|
|
416
|
-
${frontMatter}
|
|
417
|
-
${separator}
|
|
418
|
-
|
|
419
|
-
${updatedBody}` : updatedBody;
|
|
411
|
+
return lines.join("\n");
|
|
420
412
|
}
|
|
421
413
|
/**
|
|
422
|
-
* Update description in body
|
|
414
|
+
* Update description in body (returns body only, without FrontMatter)
|
|
423
415
|
*/
|
|
424
416
|
updateDescription(text, newDescription, defaultTitle) {
|
|
425
|
-
const
|
|
426
|
-
const lines = body.split("\n");
|
|
417
|
+
const lines = text.split("\n");
|
|
427
418
|
const titleIndex = lines.findIndex((line) => line.match(/^#\s+/));
|
|
428
|
-
let updatedBody;
|
|
429
419
|
if (titleIndex === -1) {
|
|
430
|
-
|
|
420
|
+
return `# ${defaultTitle}
|
|
431
421
|
|
|
432
422
|
${newDescription}
|
|
433
423
|
|
|
434
|
-
${
|
|
424
|
+
${text}`.trim();
|
|
435
425
|
} else {
|
|
436
426
|
const descIndex = this.skipEmptyLines(lines, titleIndex + 1);
|
|
437
427
|
if (descIndex < lines.length && lines[descIndex] && !lines[descIndex].startsWith("#")) {
|
|
@@ -439,15 +429,8 @@ ${body}`.trim();
|
|
|
439
429
|
} else {
|
|
440
430
|
lines.splice(titleIndex + 1, 0, "", newDescription);
|
|
441
431
|
}
|
|
442
|
-
|
|
432
|
+
return lines.join("\n");
|
|
443
433
|
}
|
|
444
|
-
const frontMatter = this.extractFrontMatter(text);
|
|
445
|
-
const separator = this.detectFrontMatterSeparator(text);
|
|
446
|
-
return frontMatter ? `${separator}
|
|
447
|
-
${frontMatter}
|
|
448
|
-
${separator}
|
|
449
|
-
|
|
450
|
-
${updatedBody}` : updatedBody;
|
|
451
434
|
}
|
|
452
435
|
/**
|
|
453
436
|
* Skip empty lines
|
|
@@ -1524,12 +1507,6 @@ var DocFileMdContentValue = class _DocFileMdContentValue {
|
|
|
1524
1507
|
customSchema
|
|
1525
1508
|
);
|
|
1526
1509
|
}
|
|
1527
|
-
/**
|
|
1528
|
-
* Generate complete Markdown text
|
|
1529
|
-
*/
|
|
1530
|
-
toMarkdownText() {
|
|
1531
|
-
return DocMarkdownSystem.from(this.title, this.description, this.body);
|
|
1532
|
-
}
|
|
1533
1510
|
/**
|
|
1534
1511
|
* Generate complete text combining FrontMatter and body
|
|
1535
1512
|
*/
|
|
@@ -3072,17 +3049,16 @@ var DocFileIndexContentValue = class _DocFileIndexContentValue {
|
|
|
3072
3049
|
* Update description
|
|
3073
3050
|
*/
|
|
3074
3051
|
withDescription(description, defaultTitle) {
|
|
3075
|
-
const fullText = this.toText();
|
|
3076
3052
|
const engine = new DocMarkdownSystem();
|
|
3077
|
-
const
|
|
3078
|
-
|
|
3053
|
+
const updatedBody = engine.updateDescription(
|
|
3054
|
+
this.body,
|
|
3079
3055
|
description,
|
|
3080
3056
|
defaultTitle || this.title
|
|
3081
3057
|
);
|
|
3082
3058
|
return new _DocFileIndexContentValue(
|
|
3083
3059
|
{
|
|
3084
3060
|
...this.value,
|
|
3085
|
-
body:
|
|
3061
|
+
body: updatedBody,
|
|
3086
3062
|
description
|
|
3087
3063
|
},
|
|
3088
3064
|
this.customSchema,
|
|
@@ -3111,12 +3087,6 @@ var DocFileIndexContentValue = class _DocFileIndexContentValue {
|
|
|
3111
3087
|
config
|
|
3112
3088
|
);
|
|
3113
3089
|
}
|
|
3114
|
-
/**
|
|
3115
|
-
* Generate complete Markdown text
|
|
3116
|
-
*/
|
|
3117
|
-
toMarkdownText() {
|
|
3118
|
-
return DocMarkdownSystem.from(this.title, this.description, this.body);
|
|
3119
|
-
}
|
|
3120
3090
|
/**
|
|
3121
3091
|
* Update content
|
|
3122
3092
|
*/
|
|
@@ -3178,11 +3148,13 @@ schema: {}
|
|
|
3178
3148
|
schema: this.meta().schema().toJson()
|
|
3179
3149
|
};
|
|
3180
3150
|
const yamlStr = stringify3(yamlData).trim();
|
|
3181
|
-
|
|
3151
|
+
const text = `---
|
|
3182
3152
|
${yamlStr}
|
|
3183
3153
|
---
|
|
3184
3154
|
|
|
3185
|
-
${this.
|
|
3155
|
+
${this.body.trim()}`;
|
|
3156
|
+
return `${text.trim()}
|
|
3157
|
+
`;
|
|
3186
3158
|
}
|
|
3187
3159
|
/**
|
|
3188
3160
|
* Output in JSON format
|
|
@@ -3251,7 +3223,7 @@ var DocFileIndexEntity = class _DocFileIndexEntity {
|
|
|
3251
3223
|
* z.infer<typeof zDocFileIndex>
|
|
3252
3224
|
*/
|
|
3253
3225
|
toJson() {
|
|
3254
|
-
return
|
|
3226
|
+
return this.value;
|
|
3255
3227
|
}
|
|
3256
3228
|
};
|
|
3257
3229
|
|
|
@@ -3772,6 +3744,19 @@ var DocFileMdReference = class _DocFileMdReference {
|
|
|
3772
3744
|
return this.fileSystem.getFileCreatedTime(this.path);
|
|
3773
3745
|
}
|
|
3774
3746
|
directory() {
|
|
3747
|
+
const paths = this.directoryPath.split(this.pathSystem.separator);
|
|
3748
|
+
if (paths[paths.length - 1] === this.props.config.archiveDirectoryName) {
|
|
3749
|
+
const path = paths.slice(0, -1).join(this.pathSystem.separator);
|
|
3750
|
+
return new DocDirectoryReference({
|
|
3751
|
+
archiveDirectoryName: this.props.config.archiveDirectoryName,
|
|
3752
|
+
indexFileName: this.props.config.indexFileName,
|
|
3753
|
+
fileSystem: this.fileSystem,
|
|
3754
|
+
path,
|
|
3755
|
+
pathSystem: this.pathSystem,
|
|
3756
|
+
customSchema: this.customSchema,
|
|
3757
|
+
config: this.props.config
|
|
3758
|
+
});
|
|
3759
|
+
}
|
|
3775
3760
|
return new DocDirectoryReference({
|
|
3776
3761
|
archiveDirectoryName: this.props.config.archiveDirectoryName,
|
|
3777
3762
|
indexFileName: this.props.config.indexFileName,
|
|
@@ -3973,9 +3958,11 @@ var DocFileUnknownReference = class _DocFileUnknownReference {
|
|
|
3973
3958
|
constructor(props) {
|
|
3974
3959
|
this.props = props;
|
|
3975
3960
|
this.pathSystem = props.pathSystem;
|
|
3961
|
+
this.customSchema = props.customSchema;
|
|
3976
3962
|
Object.freeze(this);
|
|
3977
3963
|
}
|
|
3978
3964
|
pathSystem;
|
|
3965
|
+
customSchema;
|
|
3979
3966
|
get fileSystem() {
|
|
3980
3967
|
return this.props.fileSystem;
|
|
3981
3968
|
}
|
|
@@ -3991,17 +3978,27 @@ var DocFileUnknownReference = class _DocFileUnknownReference {
|
|
|
3991
3978
|
get fileFullPath() {
|
|
3992
3979
|
return this.pathSystem.join(this.basePath, this.path);
|
|
3993
3980
|
}
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3981
|
+
directory() {
|
|
3982
|
+
const paths = this.directoryPath.split(this.pathSystem.separator);
|
|
3983
|
+
if (paths[paths.length - 1] === this.props.config.archiveDirectoryName) {
|
|
3984
|
+
const path = paths.slice(0, -1).join(this.pathSystem.separator);
|
|
3985
|
+
return new DocDirectoryReference({
|
|
3986
|
+
archiveDirectoryName: this.props.config.archiveDirectoryName,
|
|
3987
|
+
indexFileName: this.props.config.indexFileName,
|
|
3988
|
+
fileSystem: this.fileSystem,
|
|
3989
|
+
path,
|
|
3990
|
+
pathSystem: this.pathSystem,
|
|
3991
|
+
customSchema: this.customSchema,
|
|
3992
|
+
config: this.props.config
|
|
3993
|
+
});
|
|
3994
|
+
}
|
|
3998
3995
|
return new DocDirectoryReference({
|
|
3999
3996
|
archiveDirectoryName: this.props.config.archiveDirectoryName,
|
|
4000
3997
|
indexFileName: this.props.config.indexFileName,
|
|
4001
3998
|
fileSystem: this.fileSystem,
|
|
4002
3999
|
path: this.directoryPath,
|
|
4003
4000
|
pathSystem: this.pathSystem,
|
|
4004
|
-
customSchema: customSchema
|
|
4001
|
+
customSchema: this.customSchema,
|
|
4005
4002
|
config: this.props.config
|
|
4006
4003
|
});
|
|
4007
4004
|
}
|
|
@@ -4138,7 +4135,8 @@ var DocFileUnknownReference = class _DocFileUnknownReference {
|
|
|
4138
4135
|
path: archivePath,
|
|
4139
4136
|
fileSystem: this.fileSystem,
|
|
4140
4137
|
pathSystem: this.pathSystem,
|
|
4141
|
-
config: this.props.config
|
|
4138
|
+
config: this.props.config,
|
|
4139
|
+
customSchema: this.customSchema
|
|
4142
4140
|
});
|
|
4143
4141
|
}
|
|
4144
4142
|
/**
|
|
@@ -4163,7 +4161,8 @@ var DocFileUnknownReference = class _DocFileUnknownReference {
|
|
|
4163
4161
|
path: restorePath,
|
|
4164
4162
|
fileSystem: this.fileSystem,
|
|
4165
4163
|
pathSystem: this.pathSystem,
|
|
4166
|
-
config: this.props.config
|
|
4164
|
+
config: this.props.config,
|
|
4165
|
+
customSchema: this.customSchema
|
|
4167
4166
|
});
|
|
4168
4167
|
}
|
|
4169
4168
|
};
|
|
@@ -4245,7 +4244,8 @@ var DocDirectoryReference = class _DocDirectoryReference {
|
|
|
4245
4244
|
path: this.pathSystem.join(this.relativePath, fileName),
|
|
4246
4245
|
fileSystem: this.fileSystem,
|
|
4247
4246
|
pathSystem: this.pathSystem,
|
|
4248
|
-
config: this.props.config
|
|
4247
|
+
config: this.props.config,
|
|
4248
|
+
customSchema: this.customSchema
|
|
4249
4249
|
});
|
|
4250
4250
|
}
|
|
4251
4251
|
const archivedFileNames = await this.archivedFileNames();
|
|
@@ -4274,7 +4274,8 @@ var DocDirectoryReference = class _DocDirectoryReference {
|
|
|
4274
4274
|
),
|
|
4275
4275
|
fileSystem: this.fileSystem,
|
|
4276
4276
|
pathSystem: this.pathSystem,
|
|
4277
|
-
config: this.props.config
|
|
4277
|
+
config: this.props.config,
|
|
4278
|
+
customSchema: this.customSchema
|
|
4278
4279
|
});
|
|
4279
4280
|
}
|
|
4280
4281
|
}
|
|
@@ -4321,7 +4322,8 @@ var DocDirectoryReference = class _DocDirectoryReference {
|
|
|
4321
4322
|
path: filePath,
|
|
4322
4323
|
fileSystem: this.fileSystem,
|
|
4323
4324
|
pathSystem: this.pathSystem,
|
|
4324
|
-
config: this.props.config
|
|
4325
|
+
config: this.props.config,
|
|
4326
|
+
customSchema: this.customSchema
|
|
4325
4327
|
});
|
|
4326
4328
|
}
|
|
4327
4329
|
mdFile(fileName) {
|
|
@@ -4963,7 +4965,8 @@ var DocClient = class {
|
|
|
4963
4965
|
path: relativePath,
|
|
4964
4966
|
fileSystem: this.fileSystem,
|
|
4965
4967
|
pathSystem: this.pathSystem,
|
|
4966
|
-
config: this.config
|
|
4968
|
+
config: this.config,
|
|
4969
|
+
customSchema: {}
|
|
4967
4970
|
});
|
|
4968
4971
|
}
|
|
4969
4972
|
/**
|