@interactive-inc/docs-client 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.d.ts CHANGED
@@ -299,6 +299,10 @@ declare class DocFileMdReference<T extends DocCustomSchema> {
299
299
  * Read file content
300
300
  */
301
301
  readText(): Promise<Error | string>;
302
+ /**
303
+ * Create empty DocFileMdEntity
304
+ */
305
+ empty(): DocFileMdEntity<T>;
302
306
  /**
303
307
  * Write entity
304
308
  */
@@ -414,6 +418,10 @@ declare class DocFileUnknownReference {
414
418
  * Read file content
415
419
  */
416
420
  readContent(): Promise<Error | string>;
421
+ /**
422
+ * Create empty DocFileUnknownEntity
423
+ */
424
+ empty(): DocFileUnknownEntity;
417
425
  /**
418
426
  * Write content to file
419
427
  */
@@ -668,6 +676,7 @@ type DocFileUnknown = z.infer<typeof zDocFileUnknown>;
668
676
  * File union type (index.md, regular md, other)
669
677
  */
670
678
  type DocFile<T extends DocCustomSchema = DocCustomSchema> = DocFileIndex<T> | DocFileMd<T> | DocFileUnknown;
679
+ type DocDirectoryFile<T extends DocCustomSchema = DocCustomSchema> = DocFileMd<T> | DocFileUnknown;
671
680
  /**
672
681
  * Directory FrontMatter type
673
682
  */
@@ -1399,6 +1408,10 @@ declare class DocFileIndexReference<T extends DocCustomSchema> {
1399
1408
  * Read file content
1400
1409
  */
1401
1410
  readContent(): Promise<Error | string>;
1411
+ /**
1412
+ * Create empty DocFileIndexEntity
1413
+ */
1414
+ empty(): DocFileIndexEntity<T>;
1402
1415
  /**
1403
1416
  * Write content to file
1404
1417
  */
@@ -2143,4 +2156,4 @@ declare class DocRelationFieldValue {
2143
2156
  }): DocRelationFieldValue;
2144
2157
  }
2145
2158
 
2146
- 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, DocDirectoryPathValue, DocDirectoryReference, type DocFieldTypeLiteral, type DocFile, type DocFileEntity, type DocFileIndex, type DocFileIndexContent, DocFileIndexContentValue, DocFileIndexEntity, type DocFileIndexMeta, DocFileIndexMetaValue, DocFileIndexReference, type DocFileIndexSchema, type DocFileIndexSchemaField, DocFileIndexSchemaValue, type DocFileMd, type DocFileMdContent, DocFileMdContentValue, DocFileMdEntity, type DocFileMdMeta, DocFileMdMetaValue, DocFileMdReference, type DocFilePath, DocFilePathValue, DocFileRelationReference, DocFileSystem, DocFileSystemMock, 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, 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, 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 };
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 DocFileEntity, type DocFileIndex, type DocFileIndexContent, DocFileIndexContentValue, DocFileIndexEntity, type DocFileIndexMeta, DocFileIndexMetaValue, DocFileIndexReference, type DocFileIndexSchema, type DocFileIndexSchemaField, DocFileIndexSchemaValue, type DocFileMd, type DocFileMdContent, DocFileMdContentValue, DocFileMdEntity, type DocFileMdMeta, DocFileMdMetaValue, DocFileMdReference, type DocFilePath, DocFilePathValue, DocFileRelationReference, DocFileSystem, DocFileSystemMock, 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, 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, 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 };
package/build/index.js CHANGED
@@ -3353,6 +3353,32 @@ var DocFileIndexReference = class _DocFileIndexReference {
3353
3353
  }
3354
3354
  return entity.value.content.body;
3355
3355
  }
3356
+ /**
3357
+ * Create empty DocFileIndexEntity
3358
+ */
3359
+ empty() {
3360
+ const dirPath = this.pathSystem.dirname(this.filePath);
3361
+ const dirName = this.pathSystem.basename(dirPath) || "/";
3362
+ const pathValue = DocFilePathValue.fromPathWithSystem(
3363
+ this.filePath,
3364
+ this.pathSystem,
3365
+ this.basePath
3366
+ );
3367
+ const contentValue = DocFileIndexContentValue.empty(
3368
+ dirName,
3369
+ this.customSchema,
3370
+ this.props.config
3371
+ );
3372
+ return new DocFileIndexEntity(
3373
+ {
3374
+ type: "index",
3375
+ path: pathValue.toJson(),
3376
+ content: contentValue.toJson(),
3377
+ isArchived: false
3378
+ },
3379
+ this.customSchema
3380
+ );
3381
+ }
3356
3382
  /**
3357
3383
  * Write content to file
3358
3384
  */
@@ -3622,6 +3648,26 @@ var DocFileMdReference = class _DocFileMdReference {
3622
3648
  }
3623
3649
  return entity.value.content.body;
3624
3650
  }
3651
+ /**
3652
+ * Create empty DocFileMdEntity
3653
+ */
3654
+ empty() {
3655
+ const contentValue = DocFileMdContentValue.empty("", this.customSchema);
3656
+ const pathValue = DocFilePathValue.fromPathWithSystem(
3657
+ this.path,
3658
+ this.pathSystem,
3659
+ this.basePath
3660
+ );
3661
+ return new DocFileMdEntity(
3662
+ {
3663
+ type: "markdown",
3664
+ content: contentValue.value,
3665
+ path: pathValue.value,
3666
+ isArchived: false
3667
+ },
3668
+ this.customSchema
3669
+ );
3670
+ }
3625
3671
  /**
3626
3672
  * Write entity
3627
3673
  */
@@ -4003,6 +4049,24 @@ var DocFileUnknownReference = class _DocFileUnknownReference {
4003
4049
  }
4004
4050
  return entity.value.content;
4005
4051
  }
4052
+ /**
4053
+ * Create empty DocFileUnknownEntity
4054
+ */
4055
+ empty() {
4056
+ const pathValue = DocFilePathValue.fromPathWithSystem(
4057
+ this.path,
4058
+ this.pathSystem,
4059
+ this.basePath
4060
+ );
4061
+ const extension = this.pathSystem.extname(this.path).substring(1);
4062
+ return new DocFileUnknownEntity({
4063
+ type: "unknown",
4064
+ path: pathValue.value,
4065
+ content: "",
4066
+ extension: extension || "txt",
4067
+ isArchived: false
4068
+ });
4069
+ }
4006
4070
  /**
4007
4071
  * Write content to file
4008
4072
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interactive-inc/docs-client",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "check": "tsgo --noEmit",