@interactive-inc/docs-client 1.0.8 → 1.0.9

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
  */
@@ -1399,6 +1407,10 @@ declare class DocFileIndexReference<T extends DocCustomSchema> {
1399
1407
  * Read file content
1400
1408
  */
1401
1409
  readContent(): Promise<Error | string>;
1410
+ /**
1411
+ * Create empty DocFileIndexEntity
1412
+ */
1413
+ empty(): DocFileIndexEntity<T>;
1402
1414
  /**
1403
1415
  * Write content to file
1404
1416
  */
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.9",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "check": "tsgo --noEmit",