@interactive-inc/docs-client 1.0.16 → 1.0.18
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 +24 -4
- package/build/index.js +121 -49
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -204,13 +204,18 @@ declare class DocFileMdContentValue<T extends DocCustomSchema> {
|
|
|
204
204
|
*/
|
|
205
205
|
withDescription(description: string, defaultTitle?: string): DocFileMdContentValue<T>;
|
|
206
206
|
/**
|
|
207
|
-
* Update
|
|
207
|
+
* Update body
|
|
208
|
+
*/
|
|
209
|
+
withBody(body: string): DocFileMdContentValue<T>;
|
|
210
|
+
/**
|
|
211
|
+
* @deprecated Use `withBody` instead
|
|
208
212
|
*/
|
|
209
213
|
withContent(content: string): DocFileMdContentValue<T>;
|
|
210
214
|
/**
|
|
211
215
|
* Update FrontMatter
|
|
212
216
|
*/
|
|
213
217
|
withMeta<U extends DocCustomSchema>(meta: DocFileMdMetaValue<U>): DocFileMdContentValue<U>;
|
|
218
|
+
withMeta(updater: UpdateFunction<DocFileMdMetaValue<T>>): DocFileMdContentValue<T>;
|
|
214
219
|
/**
|
|
215
220
|
* Update specific property of FrontMatter
|
|
216
221
|
*/
|
|
@@ -252,11 +257,14 @@ declare class DocFileMdEntity<T extends DocCustomSchema> {
|
|
|
252
257
|
* Update content
|
|
253
258
|
*/
|
|
254
259
|
withContent(content: DocFileMdContentValue<T>): DocFileMdEntity<T>;
|
|
260
|
+
withContent(updater: UpdateFunction<DocFileMdContentValue<T>>): DocFileMdEntity<T>;
|
|
255
261
|
/**
|
|
256
262
|
* Update path
|
|
257
263
|
*/
|
|
258
264
|
withPath(path: DocFilePath): DocFileMdEntity<T>;
|
|
265
|
+
withPath(updater: UpdateFunction<DocFilePath>): DocFileMdEntity<T>;
|
|
259
266
|
withMeta(meta: DocFileMdMetaValue<T>): DocFileMdEntity<T>;
|
|
267
|
+
withMeta(updater: UpdateFunction<DocFileMdMetaValue<T>>): DocFileMdEntity<T>;
|
|
260
268
|
withTitle(title: string): DocFileMdEntity<T>;
|
|
261
269
|
withDescription(description: string, defaultTitle?: string): DocFileMdEntity<T>;
|
|
262
270
|
/**
|
|
@@ -384,6 +392,7 @@ declare class DocFileUnknownEntity {
|
|
|
384
392
|
* Update path
|
|
385
393
|
*/
|
|
386
394
|
withPath(path: DocFilePath): DocFileUnknownEntity;
|
|
395
|
+
withPath(updater: UpdateFunction<DocFilePath>): DocFileUnknownEntity;
|
|
387
396
|
toJson(): z.infer<typeof zDocFileUnknown>;
|
|
388
397
|
}
|
|
389
398
|
|
|
@@ -467,6 +476,10 @@ declare class DocFileUnknownReference<T extends DocCustomSchema> {
|
|
|
467
476
|
restore(archiveDirectoryName?: string): Promise<DocFileUnknownReference<T>>;
|
|
468
477
|
}
|
|
469
478
|
|
|
479
|
+
/**
|
|
480
|
+
* Generic updater function type that takes a value and returns the same type
|
|
481
|
+
*/
|
|
482
|
+
type UpdateFunction<T> = (current: T) => T;
|
|
470
483
|
/**
|
|
471
484
|
* Text field type
|
|
472
485
|
*/
|
|
@@ -1330,7 +1343,11 @@ declare class DocFileIndexContentValue<T extends DocCustomSchema> {
|
|
|
1330
1343
|
/**
|
|
1331
1344
|
* Update content
|
|
1332
1345
|
*/
|
|
1333
|
-
|
|
1346
|
+
withBody(body: string): DocFileIndexContentValue<T>;
|
|
1347
|
+
/**
|
|
1348
|
+
* @deprecated Use `withBody` instead
|
|
1349
|
+
*/
|
|
1350
|
+
withContent(body: string): DocFileIndexContentValue<T>;
|
|
1334
1351
|
/**
|
|
1335
1352
|
* Update FrontMatter
|
|
1336
1353
|
*/
|
|
@@ -1369,10 +1386,12 @@ declare class DocFileIndexEntity<T extends DocCustomSchema> {
|
|
|
1369
1386
|
* Update content
|
|
1370
1387
|
*/
|
|
1371
1388
|
withContent(content: DocFileIndexContentValue<T>): DocFileIndexEntity<T>;
|
|
1389
|
+
withContent(updater: UpdateFunction<DocFileIndexContentValue<T>>): DocFileIndexEntity<T>;
|
|
1372
1390
|
/**
|
|
1373
1391
|
* Update path
|
|
1374
1392
|
*/
|
|
1375
1393
|
withPath(path: DocFilePath): DocFileIndexEntity<T>;
|
|
1394
|
+
withPath(updater: UpdateFunction<DocFilePath>): DocFileIndexEntity<T>;
|
|
1376
1395
|
/**
|
|
1377
1396
|
* z.infer<typeof zDocFileIndex>
|
|
1378
1397
|
*/
|
|
@@ -1483,6 +1502,7 @@ declare class DocDirectoryReference<T extends DocCustomSchema> {
|
|
|
1483
1502
|
get indexFileName(): string;
|
|
1484
1503
|
get indexFilePath(): string;
|
|
1485
1504
|
get archiveDirectoryName(): string;
|
|
1505
|
+
get name(): string;
|
|
1486
1506
|
fileNames(): Promise<string[] | Error>;
|
|
1487
1507
|
archivedFileNames(): Promise<string[] | Error>;
|
|
1488
1508
|
filesGenerator(): AsyncGenerator<DocFileDirectoryReference<T>, void, unknown>;
|
|
@@ -2081,7 +2101,7 @@ declare class DocDirectoryPathValue {
|
|
|
2081
2101
|
/**
|
|
2082
2102
|
* Create subdirectory path
|
|
2083
2103
|
*/
|
|
2084
|
-
subdirectory(
|
|
2104
|
+
subdirectory(directoryName: string): DocDirectoryPathValue;
|
|
2085
2105
|
/**
|
|
2086
2106
|
* Create instance from relative path (DI support)
|
|
2087
2107
|
*/
|
|
@@ -2156,4 +2176,4 @@ declare class DocRelationFieldValue {
|
|
|
2156
2176
|
}): DocRelationFieldValue;
|
|
2157
2177
|
}
|
|
2158
2178
|
|
|
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 };
|
|
2179
|
+
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, type UpdateFunction, 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
|
@@ -1451,25 +1451,42 @@ var DocFileMdContentValue = class _DocFileMdContentValue {
|
|
|
1451
1451
|
);
|
|
1452
1452
|
}
|
|
1453
1453
|
/**
|
|
1454
|
-
* Update
|
|
1454
|
+
* Update body
|
|
1455
1455
|
*/
|
|
1456
|
-
|
|
1456
|
+
withBody(body) {
|
|
1457
1457
|
const engine = new DocMarkdownSystem();
|
|
1458
1458
|
return new _DocFileMdContentValue(
|
|
1459
1459
|
{
|
|
1460
1460
|
type: "markdown-content",
|
|
1461
|
-
body
|
|
1462
|
-
title: engine.extractTitle(
|
|
1463
|
-
description: engine.extractDescription(
|
|
1461
|
+
body,
|
|
1462
|
+
title: engine.extractTitle(body) || "",
|
|
1463
|
+
description: engine.extractDescription(body) || "",
|
|
1464
1464
|
meta: this.value.meta
|
|
1465
1465
|
},
|
|
1466
1466
|
this.customSchema
|
|
1467
1467
|
);
|
|
1468
1468
|
}
|
|
1469
1469
|
/**
|
|
1470
|
-
*
|
|
1470
|
+
* @deprecated Use `withBody` instead
|
|
1471
1471
|
*/
|
|
1472
|
-
|
|
1472
|
+
withContent(content) {
|
|
1473
|
+
return this.withBody(content);
|
|
1474
|
+
}
|
|
1475
|
+
withMeta(metaOrUpdater) {
|
|
1476
|
+
if (typeof metaOrUpdater === "function") {
|
|
1477
|
+
const updatedMeta = metaOrUpdater(this.meta());
|
|
1478
|
+
return new _DocFileMdContentValue(
|
|
1479
|
+
{
|
|
1480
|
+
type: "markdown-content",
|
|
1481
|
+
body: this.body,
|
|
1482
|
+
title: this.title,
|
|
1483
|
+
description: this.description,
|
|
1484
|
+
meta: updatedMeta.value
|
|
1485
|
+
},
|
|
1486
|
+
updatedMeta.customSchema
|
|
1487
|
+
);
|
|
1488
|
+
}
|
|
1489
|
+
const meta = metaOrUpdater;
|
|
1473
1490
|
return new _DocFileMdContentValue(
|
|
1474
1491
|
{
|
|
1475
1492
|
type: "markdown-content",
|
|
@@ -1561,26 +1578,46 @@ var DocFileMdEntity = class _DocFileMdEntity {
|
|
|
1561
1578
|
get path() {
|
|
1562
1579
|
return this.value.path;
|
|
1563
1580
|
}
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1581
|
+
withContent(contentOrUpdater) {
|
|
1582
|
+
if (typeof contentOrUpdater === "function") {
|
|
1583
|
+
const updatedContent = contentOrUpdater(this.content);
|
|
1584
|
+
return new _DocFileMdEntity(
|
|
1585
|
+
{ ...this.value, content: updatedContent.value },
|
|
1586
|
+
this.customSchema
|
|
1587
|
+
);
|
|
1588
|
+
}
|
|
1568
1589
|
return new _DocFileMdEntity(
|
|
1569
|
-
{ ...this.value, content:
|
|
1590
|
+
{ ...this.value, content: contentOrUpdater.value },
|
|
1570
1591
|
this.customSchema
|
|
1571
1592
|
);
|
|
1572
1593
|
}
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1594
|
+
withPath(pathOrUpdater) {
|
|
1595
|
+
if (typeof pathOrUpdater === "function") {
|
|
1596
|
+
const updatedPath = pathOrUpdater(this.path);
|
|
1597
|
+
return new _DocFileMdEntity(
|
|
1598
|
+
{ ...this.value, path: updatedPath },
|
|
1599
|
+
this.customSchema
|
|
1600
|
+
);
|
|
1601
|
+
}
|
|
1577
1602
|
return new _DocFileMdEntity(
|
|
1578
|
-
{ ...this.value, path },
|
|
1603
|
+
{ ...this.value, path: pathOrUpdater },
|
|
1579
1604
|
this.customSchema
|
|
1580
1605
|
);
|
|
1581
1606
|
}
|
|
1582
|
-
withMeta(
|
|
1583
|
-
|
|
1607
|
+
withMeta(metaOrUpdater) {
|
|
1608
|
+
if (typeof metaOrUpdater === "function") {
|
|
1609
|
+
const currentMeta = this.content.meta();
|
|
1610
|
+
const updatedMeta = metaOrUpdater(currentMeta);
|
|
1611
|
+
const draft2 = this.content.withMeta(updatedMeta);
|
|
1612
|
+
return new _DocFileMdEntity(
|
|
1613
|
+
{
|
|
1614
|
+
...this.value,
|
|
1615
|
+
content: draft2.value
|
|
1616
|
+
},
|
|
1617
|
+
this.customSchema
|
|
1618
|
+
);
|
|
1619
|
+
}
|
|
1620
|
+
const draft = this.content.withMeta(metaOrUpdater);
|
|
1584
1621
|
return new _DocFileMdEntity(
|
|
1585
1622
|
{
|
|
1586
1623
|
...this.value,
|
|
@@ -1858,7 +1895,9 @@ var DocFileRelationReference = class {
|
|
|
1858
1895
|
if (file instanceof Error) {
|
|
1859
1896
|
return file;
|
|
1860
1897
|
}
|
|
1861
|
-
if (file === null)
|
|
1898
|
+
if (file === null) {
|
|
1899
|
+
continue;
|
|
1900
|
+
}
|
|
1862
1901
|
files.push(file);
|
|
1863
1902
|
}
|
|
1864
1903
|
return files;
|
|
@@ -1870,6 +1909,9 @@ var DocFileRelationReference = class {
|
|
|
1870
1909
|
if (filePath.includes("index.md")) {
|
|
1871
1910
|
return null;
|
|
1872
1911
|
}
|
|
1912
|
+
if (!filePath.endsWith(".md")) {
|
|
1913
|
+
return null;
|
|
1914
|
+
}
|
|
1873
1915
|
const content = await this.fileSystem.readFile(filePath);
|
|
1874
1916
|
if (content instanceof Error) {
|
|
1875
1917
|
return content;
|
|
@@ -3090,20 +3132,26 @@ var DocFileIndexContentValue = class _DocFileIndexContentValue {
|
|
|
3090
3132
|
/**
|
|
3091
3133
|
* Update content
|
|
3092
3134
|
*/
|
|
3093
|
-
|
|
3135
|
+
withBody(body) {
|
|
3094
3136
|
const engine = new DocMarkdownSystem();
|
|
3095
3137
|
return new _DocFileIndexContentValue(
|
|
3096
3138
|
{
|
|
3097
3139
|
type: "markdown-index",
|
|
3098
|
-
body
|
|
3099
|
-
title: engine.extractTitle(
|
|
3100
|
-
description: engine.extractDescription(
|
|
3140
|
+
body,
|
|
3141
|
+
title: engine.extractTitle(body) || "",
|
|
3142
|
+
description: engine.extractDescription(body) || "",
|
|
3101
3143
|
meta: this.value.meta
|
|
3102
3144
|
},
|
|
3103
3145
|
this.customSchema,
|
|
3104
3146
|
this.config
|
|
3105
3147
|
);
|
|
3106
3148
|
}
|
|
3149
|
+
/**
|
|
3150
|
+
* @deprecated Use `withBody` instead
|
|
3151
|
+
*/
|
|
3152
|
+
withContent(body) {
|
|
3153
|
+
return this.withBody(body);
|
|
3154
|
+
}
|
|
3107
3155
|
/**
|
|
3108
3156
|
* Update FrontMatter
|
|
3109
3157
|
*/
|
|
@@ -3201,22 +3249,34 @@ var DocFileIndexEntity = class _DocFileIndexEntity {
|
|
|
3201
3249
|
get path() {
|
|
3202
3250
|
return this.value.path;
|
|
3203
3251
|
}
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3252
|
+
withContent(contentOrUpdater) {
|
|
3253
|
+
if (typeof contentOrUpdater === "function") {
|
|
3254
|
+
const updatedContent = contentOrUpdater(this.content);
|
|
3255
|
+
return new _DocFileIndexEntity(
|
|
3256
|
+
{ ...this.value, content: updatedContent.value },
|
|
3257
|
+
this.customSchema,
|
|
3258
|
+
this.config
|
|
3259
|
+
);
|
|
3260
|
+
}
|
|
3208
3261
|
return new _DocFileIndexEntity(
|
|
3209
|
-
{ ...this.value, content:
|
|
3210
|
-
this.customSchema
|
|
3262
|
+
{ ...this.value, content: contentOrUpdater.value },
|
|
3263
|
+
this.customSchema,
|
|
3264
|
+
this.config
|
|
3211
3265
|
);
|
|
3212
3266
|
}
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3267
|
+
withPath(pathOrUpdater) {
|
|
3268
|
+
if (typeof pathOrUpdater === "function") {
|
|
3269
|
+
const updatedPath = pathOrUpdater(this.path);
|
|
3270
|
+
return new _DocFileIndexEntity(
|
|
3271
|
+
{ ...this.value, path: updatedPath },
|
|
3272
|
+
this.customSchema,
|
|
3273
|
+
this.config
|
|
3274
|
+
);
|
|
3275
|
+
}
|
|
3217
3276
|
return new _DocFileIndexEntity(
|
|
3218
|
-
{ ...this.value, path },
|
|
3219
|
-
this.customSchema
|
|
3277
|
+
{ ...this.value, path: pathOrUpdater },
|
|
3278
|
+
this.customSchema,
|
|
3279
|
+
this.config
|
|
3220
3280
|
);
|
|
3221
3281
|
}
|
|
3222
3282
|
/**
|
|
@@ -3398,7 +3458,7 @@ var DocFileIndexReference = class _DocFileIndexReference {
|
|
|
3398
3458
|
return [];
|
|
3399
3459
|
}
|
|
3400
3460
|
const refs = [];
|
|
3401
|
-
const fieldKeys = Object.keys(schema);
|
|
3461
|
+
const fieldKeys = Object.keys(schema.value);
|
|
3402
3462
|
for (const key of fieldKeys) {
|
|
3403
3463
|
const fieldValue = schema.value[key];
|
|
3404
3464
|
if (fieldValue === void 0) continue;
|
|
@@ -3406,8 +3466,9 @@ var DocFileIndexReference = class _DocFileIndexReference {
|
|
|
3406
3466
|
continue;
|
|
3407
3467
|
}
|
|
3408
3468
|
const field = schema.field(key);
|
|
3469
|
+
const path = field.path;
|
|
3409
3470
|
const fileRef = new DocFileRelationReference({
|
|
3410
|
-
filePath:
|
|
3471
|
+
filePath: path,
|
|
3411
3472
|
fileSystem: this.fileSystem,
|
|
3412
3473
|
pathSystem: this.pathSystem
|
|
3413
3474
|
});
|
|
@@ -3423,8 +3484,12 @@ var DocFileIndexReference = class _DocFileIndexReference {
|
|
|
3423
3484
|
const files = [];
|
|
3424
3485
|
for (const relation of relations) {
|
|
3425
3486
|
const entity = await relation.read();
|
|
3426
|
-
if (entity === null)
|
|
3427
|
-
|
|
3487
|
+
if (entity === null) {
|
|
3488
|
+
continue;
|
|
3489
|
+
}
|
|
3490
|
+
if (entity instanceof Error) {
|
|
3491
|
+
continue;
|
|
3492
|
+
}
|
|
3428
3493
|
files.push(entity);
|
|
3429
3494
|
}
|
|
3430
3495
|
return files;
|
|
@@ -3939,13 +4004,17 @@ var DocFileUnknownEntity = class _DocFileUnknownEntity {
|
|
|
3939
4004
|
content
|
|
3940
4005
|
});
|
|
3941
4006
|
}
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
4007
|
+
withPath(pathOrUpdater) {
|
|
4008
|
+
if (typeof pathOrUpdater === "function") {
|
|
4009
|
+
const updatedPath = pathOrUpdater(this.path);
|
|
4010
|
+
return new _DocFileUnknownEntity({
|
|
4011
|
+
...this.value,
|
|
4012
|
+
path: updatedPath
|
|
4013
|
+
});
|
|
4014
|
+
}
|
|
3946
4015
|
return new _DocFileUnknownEntity({
|
|
3947
4016
|
...this.value,
|
|
3948
|
-
path
|
|
4017
|
+
path: pathOrUpdater
|
|
3949
4018
|
});
|
|
3950
4019
|
}
|
|
3951
4020
|
toJson() {
|
|
@@ -4205,6 +4274,9 @@ var DocDirectoryReference = class _DocDirectoryReference {
|
|
|
4205
4274
|
get archiveDirectoryName() {
|
|
4206
4275
|
return this.props.archiveDirectoryName;
|
|
4207
4276
|
}
|
|
4277
|
+
get name() {
|
|
4278
|
+
return this.pathSystem.basename(this.relativePath);
|
|
4279
|
+
}
|
|
4208
4280
|
async fileNames() {
|
|
4209
4281
|
const filePaths = await this.fileSystem.readDirectoryFilePaths(
|
|
4210
4282
|
this.relativePath
|
|
@@ -6163,13 +6235,13 @@ var DocDirectoryPathValue = class _DocDirectoryPathValue {
|
|
|
6163
6235
|
/**
|
|
6164
6236
|
* Create subdirectory path
|
|
6165
6237
|
*/
|
|
6166
|
-
subdirectory(
|
|
6167
|
-
const subPath = this.pathSystem.join(this.path,
|
|
6238
|
+
subdirectory(directoryName) {
|
|
6239
|
+
const subPath = this.pathSystem.join(this.path, directoryName);
|
|
6168
6240
|
return new _DocDirectoryPathValue(
|
|
6169
6241
|
{
|
|
6170
6242
|
path: subPath,
|
|
6171
|
-
name:
|
|
6172
|
-
fullPath: this.pathSystem.join(this.fullPath,
|
|
6243
|
+
name: directoryName,
|
|
6244
|
+
fullPath: this.pathSystem.join(this.fullPath, directoryName)
|
|
6173
6245
|
},
|
|
6174
6246
|
this.pathSystem
|
|
6175
6247
|
);
|