@interactive-inc/docs-client 0.0.3 → 0.0.5
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/README.md +228 -0
- package/build/doc-client.d.ts +59 -0
- package/build/doc-client.d.ts.map +1 -0
- package/build/doc-client.js +95 -0
- package/build/doc-client.test.d.ts +2 -0
- package/build/doc-client.test.d.ts.map +1 -0
- package/build/doc-client.test.js +38 -0
- package/build/doc-directory-reference.d.ts +65 -0
- package/build/doc-directory-reference.d.ts.map +1 -0
- package/build/doc-directory-reference.js +292 -0
- package/build/doc-directory-reference.test.d.ts +2 -0
- package/build/doc-directory-reference.test.d.ts.map +1 -0
- package/build/doc-directory-reference.test.js +100 -0
- package/build/doc-file-index-reference.d.ts +72 -0
- package/build/doc-file-index-reference.d.ts.map +1 -0
- package/build/doc-file-index-reference.js +191 -0
- package/build/doc-file-index-reference.test.d.ts +2 -0
- package/build/doc-file-index-reference.test.d.ts.map +1 -0
- package/build/doc-file-index-reference.test.js +77 -0
- package/build/doc-file-md-reference.d.ts +97 -0
- package/build/doc-file-md-reference.d.ts.map +1 -0
- package/build/doc-file-md-reference.js +297 -0
- package/build/doc-file-md-reference.test.d.ts +2 -0
- package/build/doc-file-md-reference.test.d.ts.map +1 -0
- package/build/doc-file-md-reference.test.js +465 -0
- package/build/doc-file-relation-reference.d.ts +54 -0
- package/build/doc-file-relation-reference.d.ts.map +1 -0
- package/build/doc-file-relation-reference.js +109 -0
- package/build/doc-file-system-debug.d.ts +81 -0
- package/build/doc-file-system-debug.d.ts.map +1 -0
- package/build/doc-file-system-debug.js +317 -0
- package/build/doc-file-system.d.ts +100 -0
- package/build/doc-file-system.d.ts.map +1 -0
- package/build/doc-file-system.js +210 -0
- package/build/doc-file-tree-system.d.ts +38 -0
- package/build/doc-file-tree-system.d.ts.map +1 -0
- package/build/doc-file-tree-system.js +153 -0
- package/build/doc-file-tree-system.test.d.ts +2 -0
- package/build/doc-file-tree-system.test.d.ts.map +1 -0
- package/build/doc-file-tree-system.test.js +105 -0
- package/build/doc-file-unknown-reference.d.ts +80 -0
- package/build/doc-file-unknown-reference.d.ts.map +1 -0
- package/build/doc-file-unknown-reference.js +181 -0
- package/build/doc-file-unknown-reference.test.d.ts +2 -0
- package/build/doc-file-unknown-reference.test.d.ts.map +1 -0
- package/build/doc-file-unknown-reference.test.js +73 -0
- package/build/doc-markdown-system.d.ts +44 -0
- package/build/doc-markdown-system.d.ts.map +1 -0
- package/build/doc-markdown-system.js +153 -0
- package/build/doc-markdown-system.test.d.ts +2 -0
- package/build/doc-markdown-system.test.d.ts.map +1 -0
- package/build/doc-markdown-system.test.js +124 -0
- package/build/doc-path-system.d.ts +43 -0
- package/build/doc-path-system.d.ts.map +1 -0
- package/build/doc-path-system.js +148 -0
- package/build/doc-path-system.test.d.ts +2 -0
- package/build/doc-path-system.test.d.ts.map +1 -0
- package/build/doc-path-system.test.js +67 -0
- package/build/entities/doc-file-entity.d.ts +5 -0
- package/build/entities/doc-file-entity.d.ts.map +1 -0
- package/build/entities/doc-file-entity.js +1 -0
- package/build/entities/doc-file-index-entity.d.ts +30 -0
- package/build/entities/doc-file-index-entity.d.ts.map +1 -0
- package/build/entities/doc-file-index-entity.js +49 -0
- package/build/entities/doc-file-index-entity.test.d.ts +2 -0
- package/build/entities/doc-file-index-entity.test.d.ts.map +1 -0
- package/build/entities/doc-file-index-entity.test.js +195 -0
- package/build/entities/doc-file-md-entity.d.ts +30 -0
- package/build/entities/doc-file-md-entity.d.ts.map +1 -0
- package/build/entities/doc-file-md-entity.js +49 -0
- package/build/entities/doc-file-md-entity.test.d.ts +2 -0
- package/build/entities/doc-file-md-entity.test.d.ts.map +1 -0
- package/build/entities/doc-file-md-entity.test.js +178 -0
- package/build/entities/doc-file-unknown-entity.d.ts +26 -0
- package/build/entities/doc-file-unknown-entity.d.ts.map +1 -0
- package/build/entities/doc-file-unknown-entity.js +45 -0
- package/build/entities/doc-file-unknown-entity.test.d.ts +2 -0
- package/build/entities/doc-file-unknown-entity.test.d.ts.map +1 -0
- package/build/entities/doc-file-unknown-entity.test.js +131 -0
- package/build/index.d.ts +42 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +39 -24064
- package/build/models.d.ts +818 -0
- package/build/models.d.ts.map +1 -0
- package/build/models.js +312 -0
- package/build/types.d.ts +154 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +1 -0
- package/build/values/doc-content-md-front-matter-value.d.ts +49 -0
- package/build/values/doc-content-md-front-matter-value.d.ts.map +1 -0
- package/build/values/doc-content-md-front-matter-value.js +94 -0
- package/build/values/doc-content-md-front-matter-value.test.d.ts +2 -0
- package/build/values/doc-content-md-front-matter-value.test.d.ts.map +1 -0
- package/build/values/doc-content-md-front-matter-value.test.js +73 -0
- package/build/values/doc-content-md-value.d.ts +66 -0
- package/build/values/doc-content-md-value.d.ts.map +1 -0
- package/build/values/doc-content-md-value.js +218 -0
- package/build/values/doc-content-md-value.test.d.ts +2 -0
- package/build/values/doc-content-md-value.test.d.ts.map +1 -0
- package/build/values/doc-content-md-value.test.js +179 -0
- package/build/values/doc-directory-path-value.d.ts +89 -0
- package/build/values/doc-directory-path-value.d.ts.map +1 -0
- package/build/values/doc-directory-path-value.js +145 -0
- package/build/values/doc-directory-path-value.test.d.ts +2 -0
- package/build/values/doc-directory-path-value.test.d.ts.map +1 -0
- package/build/values/doc-directory-path-value.test.js +68 -0
- package/build/values/doc-file-content-index-value.d.ts +62 -0
- package/build/values/doc-file-content-index-value.d.ts.map +1 -0
- package/build/values/doc-file-content-index-value.js +134 -0
- package/build/values/doc-file-content-index-value.test.d.ts +2 -0
- package/build/values/doc-file-content-index-value.test.d.ts.map +1 -0
- package/build/values/doc-file-content-index-value.test.js +203 -0
- package/build/values/doc-file-content-md-value.d.ts +62 -0
- package/build/values/doc-file-content-md-value.d.ts.map +1 -0
- package/build/values/doc-file-content-md-value.js +139 -0
- package/build/values/doc-file-content-md-value.test.d.ts +2 -0
- package/build/values/doc-file-content-md-value.test.d.ts.map +1 -0
- package/build/values/doc-file-content-md-value.test.js +160 -0
- package/build/values/doc-file-path-value.d.ts +47 -0
- package/build/values/doc-file-path-value.d.ts.map +1 -0
- package/build/values/doc-file-path-value.js +83 -0
- package/build/values/doc-file-path-value.test.d.ts +2 -0
- package/build/values/doc-file-path-value.test.d.ts.map +1 -0
- package/build/values/doc-file-path-value.test.js +84 -0
- package/build/values/doc-front-matter-index-value.d.ts +66 -0
- package/build/values/doc-front-matter-index-value.d.ts.map +1 -0
- package/build/values/doc-front-matter-index-value.js +185 -0
- package/build/values/doc-front-matter-index-value.test.d.ts +2 -0
- package/build/values/doc-front-matter-index-value.test.d.ts.map +1 -0
- package/build/values/doc-front-matter-index-value.test.js +98 -0
- package/build/values/doc-front-matter-md-value-accessor.test.d.ts +2 -0
- package/build/values/doc-front-matter-md-value-accessor.test.d.ts.map +1 -0
- package/build/values/doc-front-matter-md-value-accessor.test.js +226 -0
- package/build/values/doc-front-matter-md-value.d.ts +80 -0
- package/build/values/doc-front-matter-md-value.d.ts.map +1 -0
- package/build/values/doc-front-matter-md-value.js +257 -0
- package/build/values/doc-front-matter-md-value.test.d.ts +2 -0
- package/build/values/doc-front-matter-md-value.test.d.ts.map +1 -0
- package/build/values/doc-front-matter-md-value.test.js +198 -0
- package/build/values/doc-relation-field-value.d.ts +57 -0
- package/build/values/doc-relation-field-value.d.ts.map +1 -0
- package/build/values/doc-relation-field-value.js +85 -0
- package/build/values/doc-relation-field-value.test.d.ts +2 -0
- package/build/values/doc-relation-field-value.test.d.ts.map +1 -0
- package/build/values/doc-relation-field-value.test.js +115 -0
- package/build/values/doc-relation-file-value.d.ts +33 -0
- package/build/values/doc-relation-file-value.d.ts.map +1 -0
- package/build/values/doc-relation-file-value.js +55 -0
- package/build/values/doc-relation-file-value.test.d.ts +2 -0
- package/build/values/doc-relation-file-value.test.d.ts.map +1 -0
- package/build/values/doc-relation-file-value.test.js +77 -0
- package/build/values/doc-relation-value.d.ts +34 -0
- package/build/values/doc-relation-value.d.ts.map +1 -0
- package/build/values/doc-relation-value.js +56 -0
- package/build/values/doc-relation-value.test.d.ts +2 -0
- package/build/values/doc-relation-value.test.d.ts.map +1 -0
- package/build/values/doc-relation-value.test.js +89 -0
- package/build/values/doc-schema-field-boolean-multiple-value.d.ts +23 -0
- package/build/values/doc-schema-field-boolean-multiple-value.d.ts.map +1 -0
- package/build/values/doc-schema-field-boolean-multiple-value.js +43 -0
- package/build/values/doc-schema-field-boolean-multiple-value.test.d.ts +2 -0
- package/build/values/doc-schema-field-boolean-multiple-value.test.d.ts.map +1 -0
- package/build/values/doc-schema-field-boolean-multiple-value.test.js +76 -0
- package/build/values/doc-schema-field-boolean-single-value.d.ts +23 -0
- package/build/values/doc-schema-field-boolean-single-value.d.ts.map +1 -0
- package/build/values/doc-schema-field-boolean-single-value.js +39 -0
- package/build/values/doc-schema-field-boolean-single-value.test.d.ts +2 -0
- package/build/values/doc-schema-field-boolean-single-value.test.d.ts.map +1 -0
- package/build/values/doc-schema-field-boolean-single-value.test.js +73 -0
- package/build/values/doc-schema-field-factory.d.ts +37 -0
- package/build/values/doc-schema-field-factory.d.ts.map +1 -0
- package/build/values/doc-schema-field-factory.js +151 -0
- package/build/values/doc-schema-field-factory.test.d.ts +2 -0
- package/build/values/doc-schema-field-factory.test.d.ts.map +1 -0
- package/build/values/doc-schema-field-factory.test.js +215 -0
- package/build/values/doc-schema-field-number-multiple-value.d.ts +23 -0
- package/build/values/doc-schema-field-number-multiple-value.d.ts.map +1 -0
- package/build/values/doc-schema-field-number-multiple-value.js +43 -0
- package/build/values/doc-schema-field-number-multiple-value.test.d.ts +2 -0
- package/build/values/doc-schema-field-number-multiple-value.test.d.ts.map +1 -0
- package/build/values/doc-schema-field-number-multiple-value.test.js +79 -0
- package/build/values/doc-schema-field-number-single-value.d.ts +23 -0
- package/build/values/doc-schema-field-number-single-value.d.ts.map +1 -0
- package/build/values/doc-schema-field-number-single-value.js +39 -0
- package/build/values/doc-schema-field-number-single-value.test.d.ts +2 -0
- package/build/values/doc-schema-field-number-single-value.test.d.ts.map +1 -0
- package/build/values/doc-schema-field-number-single-value.test.js +77 -0
- package/build/values/doc-schema-field-relation-multiple-value.d.ts +24 -0
- package/build/values/doc-schema-field-relation-multiple-value.d.ts.map +1 -0
- package/build/values/doc-schema-field-relation-multiple-value.js +46 -0
- package/build/values/doc-schema-field-relation-multiple-value.test.d.ts +2 -0
- package/build/values/doc-schema-field-relation-multiple-value.test.d.ts.map +1 -0
- package/build/values/doc-schema-field-relation-multiple-value.test.js +83 -0
- package/build/values/doc-schema-field-relation-single-value.d.ts +24 -0
- package/build/values/doc-schema-field-relation-single-value.d.ts.map +1 -0
- package/build/values/doc-schema-field-relation-single-value.js +42 -0
- package/build/values/doc-schema-field-relation-single-value.test.d.ts +2 -0
- package/build/values/doc-schema-field-relation-single-value.test.d.ts.map +1 -0
- package/build/values/doc-schema-field-relation-single-value.test.js +83 -0
- package/build/values/doc-schema-field-select-number-multiple-value.d.ts +25 -0
- package/build/values/doc-schema-field-select-number-multiple-value.d.ts.map +1 -0
- package/build/values/doc-schema-field-select-number-multiple-value.js +48 -0
- package/build/values/doc-schema-field-select-number-multiple-value.test.d.ts +2 -0
- package/build/values/doc-schema-field-select-number-multiple-value.test.d.ts.map +1 -0
- package/build/values/doc-schema-field-select-number-multiple-value.test.js +84 -0
- package/build/values/doc-schema-field-select-number-single-value.d.ts +25 -0
- package/build/values/doc-schema-field-select-number-single-value.d.ts.map +1 -0
- package/build/values/doc-schema-field-select-number-single-value.js +45 -0
- package/build/values/doc-schema-field-select-number-single-value.test.d.ts +2 -0
- package/build/values/doc-schema-field-select-number-single-value.test.d.ts.map +1 -0
- package/build/values/doc-schema-field-select-number-single-value.test.js +96 -0
- package/build/values/doc-schema-field-select-text-multiple-value.d.ts +25 -0
- package/build/values/doc-schema-field-select-text-multiple-value.d.ts.map +1 -0
- package/build/values/doc-schema-field-select-text-multiple-value.js +48 -0
- package/build/values/doc-schema-field-select-text-multiple-value.test.d.ts +2 -0
- package/build/values/doc-schema-field-select-text-multiple-value.test.d.ts.map +1 -0
- package/build/values/doc-schema-field-select-text-multiple-value.test.js +84 -0
- package/build/values/doc-schema-field-select-text-single-value.d.ts +25 -0
- package/build/values/doc-schema-field-select-text-single-value.d.ts.map +1 -0
- package/build/values/doc-schema-field-select-text-single-value.js +47 -0
- package/build/values/doc-schema-field-select-text-single-value.test.d.ts +2 -0
- package/build/values/doc-schema-field-select-text-single-value.test.d.ts.map +1 -0
- package/build/values/doc-schema-field-select-text-single-value.test.js +96 -0
- package/build/values/doc-schema-field-text-multiple-value.d.ts +23 -0
- package/build/values/doc-schema-field-text-multiple-value.d.ts.map +1 -0
- package/build/values/doc-schema-field-text-multiple-value.js +43 -0
- package/build/values/doc-schema-field-text-multiple-value.test.d.ts +2 -0
- package/build/values/doc-schema-field-text-multiple-value.test.d.ts.map +1 -0
- package/build/values/doc-schema-field-text-multiple-value.test.js +78 -0
- package/build/values/doc-schema-field-text-single-value.d.ts +23 -0
- package/build/values/doc-schema-field-text-single-value.d.ts.map +1 -0
- package/build/values/doc-schema-field-text-single-value.js +39 -0
- package/build/values/doc-schema-field-text-single-value.test.d.ts +2 -0
- package/build/values/doc-schema-field-text-single-value.test.d.ts.map +1 -0
- package/build/values/doc-schema-field-text-single-value.test.js +76 -0
- package/build/values/doc-schema-field-type-value.d.ts +61 -0
- package/build/values/doc-schema-field-type-value.d.ts.map +1 -0
- package/build/values/doc-schema-field-type-value.js +134 -0
- package/build/values/doc-schema-field-type-value.test.d.ts +2 -0
- package/build/values/doc-schema-field-type-value.test.d.ts.map +1 -0
- package/build/values/doc-schema-field-type-value.test.js +101 -0
- package/build/values/doc-schema-field-value.d.ts +45 -0
- package/build/values/doc-schema-field-value.d.ts.map +1 -0
- package/build/values/doc-schema-field-value.js +1 -0
- package/build/values/doc-schema-value.d.ts +99 -0
- package/build/values/doc-schema-value.d.ts.map +1 -0
- package/build/values/doc-schema-value.js +269 -0
- package/build/values/doc-schema-value.test.d.ts +2 -0
- package/build/values/doc-schema-value.test.d.ts.map +1 -0
- package/build/values/doc-schema-value.test.js +301 -0
- package/build/values/doc-tree-directory-node-value.d.ts +36 -0
- package/build/values/doc-tree-directory-node-value.d.ts.map +1 -0
- package/build/values/doc-tree-directory-node-value.js +71 -0
- package/build/values/doc-tree-directory-node-value.test.d.ts +2 -0
- package/build/values/doc-tree-directory-node-value.test.d.ts.map +1 -0
- package/build/values/doc-tree-directory-node-value.test.js +162 -0
- package/build/values/doc-tree-file-node-value.d.ts +33 -0
- package/build/values/doc-tree-file-node-value.d.ts.map +1 -0
- package/build/values/doc-tree-file-node-value.js +56 -0
- package/build/values/doc-tree-file-node-value.test.d.ts +2 -0
- package/build/values/doc-tree-file-node-value.test.d.ts.map +1 -0
- package/build/values/doc-tree-file-node-value.test.js +113 -0
- package/debug/debug.ts +108 -0
- package/package.json +7 -44
- package/bin/docs.js +0 -3
- package/build/assets/index.css +0 -1
- package/build/assets/index.js +0 -298
- package/build/index.html +0 -13
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { DocTreeDirectoryNode } from "../types";
|
|
2
|
+
import { DocTreeFileNodeValue } from "./doc-tree-file-node-value";
|
|
3
|
+
type Props = {
|
|
4
|
+
name: string;
|
|
5
|
+
path: string;
|
|
6
|
+
icon: string;
|
|
7
|
+
title: string;
|
|
8
|
+
children: (DocTreeFileNodeValue | DocTreeDirectoryNodeValue)[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* ツリーディレクトリノード値オブジェクト
|
|
12
|
+
*/
|
|
13
|
+
export declare class DocTreeDirectoryNodeValue {
|
|
14
|
+
private readonly props;
|
|
15
|
+
constructor(props: Props);
|
|
16
|
+
get name(): string;
|
|
17
|
+
get path(): string;
|
|
18
|
+
get icon(): string;
|
|
19
|
+
get title(): string;
|
|
20
|
+
get children(): (DocTreeDirectoryNodeValue | DocTreeFileNodeValue)[];
|
|
21
|
+
get type(): "directory";
|
|
22
|
+
/**
|
|
23
|
+
* プレーンオブジェクトに変換
|
|
24
|
+
*/
|
|
25
|
+
toJson(): DocTreeDirectoryNode;
|
|
26
|
+
/**
|
|
27
|
+
* プロパティから作成
|
|
28
|
+
*/
|
|
29
|
+
static from(props: Props): DocTreeDirectoryNodeValue;
|
|
30
|
+
/**
|
|
31
|
+
* JSONオブジェクトから作成
|
|
32
|
+
*/
|
|
33
|
+
static fromJson(json: unknown): DocTreeDirectoryNodeValue;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=doc-tree-directory-node-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc-tree-directory-node-value.d.ts","sourceRoot":"","sources":["../../lib/values/doc-tree-directory-node-value.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAe,MAAM,UAAU,CAAA;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAEjE,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,oBAAoB,GAAG,yBAAyB,CAAC,EAAE,CAAA;CAC/D,CAAA;AAED;;GAEG;AACH,qBAAa,yBAAyB;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAlC,YAA6B,KAAK,EAAE,KAAK,EAIxC;IAED,IAAI,IAAI,WAEP;IAED,IAAI,IAAI,WAEP;IAED,IAAI,IAAI,WAEP;IAED,IAAI,KAAK,WAER;IAED,IAAI,QAAQ,yDAEX;IAED,IAAI,IAAI,IAAI,WAAW,CAEtB;IAED;;OAEG;IACH,MAAM,IAAI,oBAAoB,CAS7B;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,yBAAyB,CAEnD;IAED;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,yBAAyB,CAkBxD;CACF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { zDocTreeDirectoryNode, zDocTreeNode } from "../models";
|
|
2
|
+
import { DocTreeFileNodeValue } from "./doc-tree-file-node-value";
|
|
3
|
+
/**
|
|
4
|
+
* ツリーディレクトリノード値オブジェクト
|
|
5
|
+
*/
|
|
6
|
+
export class DocTreeDirectoryNodeValue {
|
|
7
|
+
props;
|
|
8
|
+
constructor(props) {
|
|
9
|
+
this.props = props;
|
|
10
|
+
Object.freeze(this);
|
|
11
|
+
Object.freeze(this.props);
|
|
12
|
+
Object.freeze(this.props.children);
|
|
13
|
+
}
|
|
14
|
+
get name() {
|
|
15
|
+
return this.props.name;
|
|
16
|
+
}
|
|
17
|
+
get path() {
|
|
18
|
+
return this.props.path;
|
|
19
|
+
}
|
|
20
|
+
get icon() {
|
|
21
|
+
return this.props.icon;
|
|
22
|
+
}
|
|
23
|
+
get title() {
|
|
24
|
+
return this.props.title;
|
|
25
|
+
}
|
|
26
|
+
get children() {
|
|
27
|
+
return this.props.children;
|
|
28
|
+
}
|
|
29
|
+
get type() {
|
|
30
|
+
return "directory";
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* プレーンオブジェクトに変換
|
|
34
|
+
*/
|
|
35
|
+
toJson() {
|
|
36
|
+
return {
|
|
37
|
+
name: this.name,
|
|
38
|
+
path: this.path,
|
|
39
|
+
type: "directory",
|
|
40
|
+
icon: this.icon,
|
|
41
|
+
title: this.title,
|
|
42
|
+
children: this.children.map((child) => child.toJson()),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* プロパティから作成
|
|
47
|
+
*/
|
|
48
|
+
static from(props) {
|
|
49
|
+
return new DocTreeDirectoryNodeValue(props);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* JSONオブジェクトから作成
|
|
53
|
+
*/
|
|
54
|
+
static fromJson(json) {
|
|
55
|
+
const parsed = zDocTreeDirectoryNode.parse(json);
|
|
56
|
+
return new DocTreeDirectoryNodeValue({
|
|
57
|
+
name: parsed.name,
|
|
58
|
+
path: parsed.path,
|
|
59
|
+
icon: parsed.icon,
|
|
60
|
+
title: parsed.title,
|
|
61
|
+
children: parsed.children.map((child) => {
|
|
62
|
+
// childの型を検証
|
|
63
|
+
const parsedChild = zDocTreeNode.parse(child);
|
|
64
|
+
if (parsedChild.type === "file") {
|
|
65
|
+
return DocTreeFileNodeValue.fromJson(parsedChild);
|
|
66
|
+
}
|
|
67
|
+
return DocTreeDirectoryNodeValue.fromJson(parsedChild);
|
|
68
|
+
}),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc-tree-directory-node-value.test.d.ts","sourceRoot":"","sources":["../../lib/values/doc-tree-directory-node-value.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { expect, test } from "bun:test";
|
|
2
|
+
import { DocTreeDirectoryNodeValue } from "./doc-tree-directory-node-value";
|
|
3
|
+
import { DocTreeFileNodeValue } from "./doc-tree-file-node-value";
|
|
4
|
+
test("ディレクトリノードの基本プロパティを取得できる", () => {
|
|
5
|
+
const node = new DocTreeDirectoryNodeValue({
|
|
6
|
+
name: "products",
|
|
7
|
+
path: "docs/products",
|
|
8
|
+
icon: "📁",
|
|
9
|
+
title: "製品",
|
|
10
|
+
children: [],
|
|
11
|
+
});
|
|
12
|
+
expect(node.name).toBe("products");
|
|
13
|
+
expect(node.path).toBe("docs/products");
|
|
14
|
+
expect(node.icon).toBe("📁");
|
|
15
|
+
expect(node.title).toBe("製品");
|
|
16
|
+
expect(node.type).toBe("directory");
|
|
17
|
+
expect(node.children).toEqual([]);
|
|
18
|
+
});
|
|
19
|
+
test("子ノードを持つディレクトリノードを作成できる", () => {
|
|
20
|
+
const fileChild = new DocTreeFileNodeValue({
|
|
21
|
+
name: "overview",
|
|
22
|
+
path: "docs/products/overview.md",
|
|
23
|
+
icon: "📄",
|
|
24
|
+
title: "概要",
|
|
25
|
+
});
|
|
26
|
+
const dirChild = new DocTreeDirectoryNodeValue({
|
|
27
|
+
name: "features",
|
|
28
|
+
path: "docs/products/features",
|
|
29
|
+
icon: "⚡",
|
|
30
|
+
title: "機能",
|
|
31
|
+
children: [],
|
|
32
|
+
});
|
|
33
|
+
const node = new DocTreeDirectoryNodeValue({
|
|
34
|
+
name: "products",
|
|
35
|
+
path: "docs/products",
|
|
36
|
+
icon: "📁",
|
|
37
|
+
title: "製品",
|
|
38
|
+
children: [fileChild, dirChild],
|
|
39
|
+
});
|
|
40
|
+
expect(node.children.length).toBe(2);
|
|
41
|
+
expect(node.children[0]).toBeInstanceOf(DocTreeFileNodeValue);
|
|
42
|
+
expect(node.children[1]).toBeInstanceOf(DocTreeDirectoryNodeValue);
|
|
43
|
+
});
|
|
44
|
+
test("fromメソッドでインスタンスを生成できる", () => {
|
|
45
|
+
const node = DocTreeDirectoryNodeValue.from({
|
|
46
|
+
name: "docs",
|
|
47
|
+
path: "docs",
|
|
48
|
+
icon: "📚",
|
|
49
|
+
title: "ドキュメント",
|
|
50
|
+
children: [],
|
|
51
|
+
});
|
|
52
|
+
expect(node.name).toBe("docs");
|
|
53
|
+
expect(node.icon).toBe("📚");
|
|
54
|
+
});
|
|
55
|
+
test("JSON形式に変換できる", () => {
|
|
56
|
+
const fileChild = new DocTreeFileNodeValue({
|
|
57
|
+
name: "readme",
|
|
58
|
+
path: "docs/readme.md",
|
|
59
|
+
icon: "📝",
|
|
60
|
+
title: "README",
|
|
61
|
+
});
|
|
62
|
+
const node = new DocTreeDirectoryNodeValue({
|
|
63
|
+
name: "docs",
|
|
64
|
+
path: "docs",
|
|
65
|
+
icon: "📁",
|
|
66
|
+
title: "ドキュメント",
|
|
67
|
+
children: [fileChild],
|
|
68
|
+
});
|
|
69
|
+
const json = node.toJson();
|
|
70
|
+
expect(json).toEqual({
|
|
71
|
+
name: "docs",
|
|
72
|
+
path: "docs",
|
|
73
|
+
type: "directory",
|
|
74
|
+
icon: "📁",
|
|
75
|
+
title: "ドキュメント",
|
|
76
|
+
children: [
|
|
77
|
+
{
|
|
78
|
+
name: "readme",
|
|
79
|
+
path: "docs/readme.md",
|
|
80
|
+
type: "file",
|
|
81
|
+
icon: "📝",
|
|
82
|
+
title: "README",
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
test("JSONからインスタンスを生成できる", () => {
|
|
88
|
+
const json = {
|
|
89
|
+
name: "api",
|
|
90
|
+
path: "docs/api",
|
|
91
|
+
type: "directory",
|
|
92
|
+
icon: "🔧",
|
|
93
|
+
title: "API",
|
|
94
|
+
children: [
|
|
95
|
+
{
|
|
96
|
+
name: "endpoints",
|
|
97
|
+
path: "docs/api/endpoints.md",
|
|
98
|
+
type: "file",
|
|
99
|
+
icon: "📄",
|
|
100
|
+
title: "エンドポイント",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "auth",
|
|
104
|
+
path: "docs/api/auth",
|
|
105
|
+
type: "directory",
|
|
106
|
+
icon: "🔐",
|
|
107
|
+
title: "認証",
|
|
108
|
+
children: [],
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
};
|
|
112
|
+
const node = DocTreeDirectoryNodeValue.fromJson(json);
|
|
113
|
+
expect(node.name).toBe("api");
|
|
114
|
+
expect(node.path).toBe("docs/api");
|
|
115
|
+
expect(node.icon).toBe("🔧");
|
|
116
|
+
expect(node.title).toBe("API");
|
|
117
|
+
expect(node.children.length).toBe(2);
|
|
118
|
+
expect(node.children[0]).toBeInstanceOf(DocTreeFileNodeValue);
|
|
119
|
+
expect(node.children[0].name).toBe("endpoints");
|
|
120
|
+
expect(node.children[1]).toBeInstanceOf(DocTreeDirectoryNodeValue);
|
|
121
|
+
expect(node.children[1].name).toBe("auth");
|
|
122
|
+
});
|
|
123
|
+
test("深くネストされた構造も処理できる", () => {
|
|
124
|
+
const deepChild = new DocTreeFileNodeValue({
|
|
125
|
+
name: "deep-file",
|
|
126
|
+
path: "docs/a/b/c/deep-file.md",
|
|
127
|
+
icon: "🔍",
|
|
128
|
+
title: "深いファイル",
|
|
129
|
+
});
|
|
130
|
+
const level3 = new DocTreeDirectoryNodeValue({
|
|
131
|
+
name: "c",
|
|
132
|
+
path: "docs/a/b/c",
|
|
133
|
+
icon: "📁",
|
|
134
|
+
title: "レベル3",
|
|
135
|
+
children: [deepChild],
|
|
136
|
+
});
|
|
137
|
+
const level2 = new DocTreeDirectoryNodeValue({
|
|
138
|
+
name: "b",
|
|
139
|
+
path: "docs/a/b",
|
|
140
|
+
icon: "📁",
|
|
141
|
+
title: "レベル2",
|
|
142
|
+
children: [level3],
|
|
143
|
+
});
|
|
144
|
+
const level1 = new DocTreeDirectoryNodeValue({
|
|
145
|
+
name: "a",
|
|
146
|
+
path: "docs/a",
|
|
147
|
+
icon: "📁",
|
|
148
|
+
title: "レベル1",
|
|
149
|
+
children: [level2],
|
|
150
|
+
});
|
|
151
|
+
const level1Child = level1.children[0];
|
|
152
|
+
expect(level1Child).toBeInstanceOf(DocTreeDirectoryNodeValue);
|
|
153
|
+
if (level1Child instanceof DocTreeDirectoryNodeValue) {
|
|
154
|
+
const level2Child = level1Child.children[0];
|
|
155
|
+
expect(level2Child).toBeInstanceOf(DocTreeDirectoryNodeValue);
|
|
156
|
+
if (level2Child instanceof DocTreeDirectoryNodeValue) {
|
|
157
|
+
const level3Child = level2Child.children[0];
|
|
158
|
+
expect(level3Child).toBeInstanceOf(DocTreeFileNodeValue);
|
|
159
|
+
expect(level3Child.name).toBe("deep-file");
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { DocTreeFileNode } from "../types";
|
|
2
|
+
type Props = {
|
|
3
|
+
name: string;
|
|
4
|
+
path: string;
|
|
5
|
+
icon: string;
|
|
6
|
+
title: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* ツリーファイルノード値オブジェクト
|
|
10
|
+
*/
|
|
11
|
+
export declare class DocTreeFileNodeValue {
|
|
12
|
+
private readonly props;
|
|
13
|
+
constructor(props: Props);
|
|
14
|
+
get name(): string;
|
|
15
|
+
get path(): string;
|
|
16
|
+
get icon(): string;
|
|
17
|
+
get title(): string;
|
|
18
|
+
get type(): "file";
|
|
19
|
+
/**
|
|
20
|
+
* プレーンオブジェクトに変換
|
|
21
|
+
*/
|
|
22
|
+
toJson(): DocTreeFileNode;
|
|
23
|
+
/**
|
|
24
|
+
* プロパティから作成
|
|
25
|
+
*/
|
|
26
|
+
static from(props: Props): DocTreeFileNodeValue;
|
|
27
|
+
/**
|
|
28
|
+
* JSONオブジェクトから作成
|
|
29
|
+
*/
|
|
30
|
+
static fromJson(json: unknown): DocTreeFileNodeValue;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=doc-tree-file-node-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc-tree-file-node-value.d.ts","sourceRoot":"","sources":["../../lib/values/doc-tree-file-node-value.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED;;GAEG;AACH,qBAAa,oBAAoB;IACnB,OAAO,CAAC,QAAQ,CAAC,KAAK;IAAlC,YAA6B,KAAK,EAAE,KAAK,EAExC;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,MAAM,IAAI,eAAe,CAQxB;IAED;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,GAAG,oBAAoB,CAE9C;IAED;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,oBAAoB,CAQnD;CACF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { zDocTreeFileNode } from "../models";
|
|
2
|
+
/**
|
|
3
|
+
* ツリーファイルノード値オブジェクト
|
|
4
|
+
*/
|
|
5
|
+
export class DocTreeFileNodeValue {
|
|
6
|
+
props;
|
|
7
|
+
constructor(props) {
|
|
8
|
+
this.props = props;
|
|
9
|
+
Object.freeze(this);
|
|
10
|
+
}
|
|
11
|
+
get name() {
|
|
12
|
+
return this.props.name;
|
|
13
|
+
}
|
|
14
|
+
get path() {
|
|
15
|
+
return this.props.path;
|
|
16
|
+
}
|
|
17
|
+
get icon() {
|
|
18
|
+
return this.props.icon;
|
|
19
|
+
}
|
|
20
|
+
get title() {
|
|
21
|
+
return this.props.title;
|
|
22
|
+
}
|
|
23
|
+
get type() {
|
|
24
|
+
return "file";
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* プレーンオブジェクトに変換
|
|
28
|
+
*/
|
|
29
|
+
toJson() {
|
|
30
|
+
return {
|
|
31
|
+
name: this.name,
|
|
32
|
+
path: this.path,
|
|
33
|
+
type: "file",
|
|
34
|
+
icon: this.icon,
|
|
35
|
+
title: this.title,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* プロパティから作成
|
|
40
|
+
*/
|
|
41
|
+
static from(props) {
|
|
42
|
+
return new DocTreeFileNodeValue(props);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* JSONオブジェクトから作成
|
|
46
|
+
*/
|
|
47
|
+
static fromJson(json) {
|
|
48
|
+
const parsed = zDocTreeFileNode.parse(json);
|
|
49
|
+
return new DocTreeFileNodeValue({
|
|
50
|
+
name: parsed.name,
|
|
51
|
+
path: parsed.path,
|
|
52
|
+
icon: parsed.icon,
|
|
53
|
+
title: parsed.title,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc-tree-file-node-value.test.d.ts","sourceRoot":"","sources":["../../lib/values/doc-tree-file-node-value.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { expect, test } from "bun:test";
|
|
2
|
+
import { DocTreeFileNodeValue } from "./doc-tree-file-node-value";
|
|
3
|
+
test("ファイルノードの基本プロパティを取得できる", () => {
|
|
4
|
+
const node = new DocTreeFileNodeValue({
|
|
5
|
+
name: "overview",
|
|
6
|
+
path: "docs/overview.md",
|
|
7
|
+
icon: "📄",
|
|
8
|
+
title: "概要",
|
|
9
|
+
});
|
|
10
|
+
expect(node.name).toBe("overview");
|
|
11
|
+
expect(node.path).toBe("docs/overview.md");
|
|
12
|
+
expect(node.icon).toBe("📄");
|
|
13
|
+
expect(node.title).toBe("概要");
|
|
14
|
+
expect(node.type).toBe("file");
|
|
15
|
+
});
|
|
16
|
+
test("fromメソッドでインスタンスを生成できる", () => {
|
|
17
|
+
const node = DocTreeFileNodeValue.from({
|
|
18
|
+
name: "readme",
|
|
19
|
+
path: "readme.md",
|
|
20
|
+
icon: "📝",
|
|
21
|
+
title: "README",
|
|
22
|
+
});
|
|
23
|
+
expect(node.name).toBe("readme");
|
|
24
|
+
expect(node.path).toBe("readme.md");
|
|
25
|
+
expect(node.icon).toBe("📝");
|
|
26
|
+
expect(node.title).toBe("README");
|
|
27
|
+
});
|
|
28
|
+
test("JSON形式に変換できる", () => {
|
|
29
|
+
const node = new DocTreeFileNodeValue({
|
|
30
|
+
name: "config",
|
|
31
|
+
path: "docs/config.md",
|
|
32
|
+
icon: "⚙️",
|
|
33
|
+
title: "設定",
|
|
34
|
+
});
|
|
35
|
+
const json = node.toJson();
|
|
36
|
+
expect(json).toEqual({
|
|
37
|
+
name: "config",
|
|
38
|
+
path: "docs/config.md",
|
|
39
|
+
type: "file",
|
|
40
|
+
icon: "⚙️",
|
|
41
|
+
title: "設定",
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
test("JSONからインスタンスを生成できる", () => {
|
|
45
|
+
const json = {
|
|
46
|
+
name: "api-reference",
|
|
47
|
+
path: "docs/api/reference.md",
|
|
48
|
+
type: "file",
|
|
49
|
+
icon: "🔗",
|
|
50
|
+
title: "APIリファレンス",
|
|
51
|
+
};
|
|
52
|
+
const node = DocTreeFileNodeValue.fromJson(json);
|
|
53
|
+
expect(node.name).toBe("api-reference");
|
|
54
|
+
expect(node.path).toBe("docs/api/reference.md");
|
|
55
|
+
expect(node.icon).toBe("🔗");
|
|
56
|
+
expect(node.title).toBe("APIリファレンス");
|
|
57
|
+
expect(node.type).toBe("file");
|
|
58
|
+
});
|
|
59
|
+
test("異なるアイコンやタイトルでノードを作成できる", () => {
|
|
60
|
+
const nodes = [
|
|
61
|
+
new DocTreeFileNodeValue({
|
|
62
|
+
name: "guide",
|
|
63
|
+
path: "docs/guide.md",
|
|
64
|
+
icon: "📖",
|
|
65
|
+
title: "ガイド",
|
|
66
|
+
}),
|
|
67
|
+
new DocTreeFileNodeValue({
|
|
68
|
+
name: "changelog",
|
|
69
|
+
path: "changelog.md",
|
|
70
|
+
icon: "📅",
|
|
71
|
+
title: "変更履歴",
|
|
72
|
+
}),
|
|
73
|
+
new DocTreeFileNodeValue({
|
|
74
|
+
name: "license",
|
|
75
|
+
path: "license.md",
|
|
76
|
+
icon: "📜",
|
|
77
|
+
title: "ライセンス",
|
|
78
|
+
}),
|
|
79
|
+
];
|
|
80
|
+
expect(nodes[0].icon).toBe("📖");
|
|
81
|
+
expect(nodes[1].icon).toBe("📅");
|
|
82
|
+
expect(nodes[2].icon).toBe("📜");
|
|
83
|
+
});
|
|
84
|
+
test("パスに深いディレクトリ構造を持つファイルも作成できる", () => {
|
|
85
|
+
const node = new DocTreeFileNodeValue({
|
|
86
|
+
name: "deep-file",
|
|
87
|
+
path: "docs/products/client/features/auth/login.md",
|
|
88
|
+
icon: "🔐",
|
|
89
|
+
title: "ログイン機能",
|
|
90
|
+
});
|
|
91
|
+
expect(node.path).toBe("docs/products/client/features/auth/login.md");
|
|
92
|
+
expect(node.name).toBe("deep-file");
|
|
93
|
+
});
|
|
94
|
+
test("無効なJSONでエラーが発生する", () => {
|
|
95
|
+
expect(() => {
|
|
96
|
+
DocTreeFileNodeValue.fromJson({
|
|
97
|
+
// nameが欠けている
|
|
98
|
+
path: "test.md",
|
|
99
|
+
type: "file",
|
|
100
|
+
icon: "📄",
|
|
101
|
+
title: "テスト",
|
|
102
|
+
});
|
|
103
|
+
}).toThrow();
|
|
104
|
+
expect(() => {
|
|
105
|
+
DocTreeFileNodeValue.fromJson({
|
|
106
|
+
name: "test",
|
|
107
|
+
// pathが欠けている
|
|
108
|
+
type: "file",
|
|
109
|
+
icon: "📄",
|
|
110
|
+
title: "テスト",
|
|
111
|
+
});
|
|
112
|
+
}).toThrow();
|
|
113
|
+
});
|
package/debug/debug.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { DocClient } from "../lib/doc-client"
|
|
2
|
+
import { DocFileSystem } from "../lib/doc-file-system"
|
|
3
|
+
import { DocPathSystem } from "../lib/doc-path-system"
|
|
4
|
+
|
|
5
|
+
// DocClientの初期化
|
|
6
|
+
const basePath = "/Users/n/Documents/open-docs/docs" // docs ディレクトリをベースパスに
|
|
7
|
+
const pathSystem = new DocPathSystem()
|
|
8
|
+
const fileSystem = new DocFileSystem({
|
|
9
|
+
basePath,
|
|
10
|
+
pathSystem,
|
|
11
|
+
})
|
|
12
|
+
const docClient = new DocClient({
|
|
13
|
+
fileSystem,
|
|
14
|
+
pathSystem,
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
async function demonstrateRelations() {
|
|
18
|
+
console.log("=== DocClient リレーション機能のデモ ===\n")
|
|
19
|
+
|
|
20
|
+
// 1. ファイルを取得 (.mdファイルなのでmdFile()を使用)
|
|
21
|
+
const pageFile = docClient.mdFile("products/doc-browser/pages/home.md")
|
|
22
|
+
console.log("1. ファイルを取得:")
|
|
23
|
+
console.log(` パス: ${pageFile.path}`)
|
|
24
|
+
|
|
25
|
+
// 2. ファイルの内容を読み込む
|
|
26
|
+
const pageEntity = await pageFile.read()
|
|
27
|
+
if (pageEntity instanceof Error) {
|
|
28
|
+
console.error(" エラー:", pageEntity.message)
|
|
29
|
+
return
|
|
30
|
+
}
|
|
31
|
+
console.log(` タイトル: ${pageEntity.content.title}`)
|
|
32
|
+
console.log(` FrontMatter:`, pageEntity.content.frontMatter.value)
|
|
33
|
+
|
|
34
|
+
// 3. 単一のリレーションを取得(author)
|
|
35
|
+
console.log("\n2. 単一のリレーションを取得 (author):")
|
|
36
|
+
const authorRelation = await pageFile.relation("author")
|
|
37
|
+
if (authorRelation && !(authorRelation instanceof Error)) {
|
|
38
|
+
console.log(` リレーション先のパス: ${authorRelation.path}`)
|
|
39
|
+
|
|
40
|
+
// リレーション先のファイルを読み込む
|
|
41
|
+
const authorEntity = await authorRelation.read()
|
|
42
|
+
if (!(authorEntity instanceof Error)) {
|
|
43
|
+
console.log(` 著者名: ${authorEntity.content.title}`)
|
|
44
|
+
console.log(
|
|
45
|
+
` 内容の一部: ${authorEntity.content.body.substring(0, 50)}...`,
|
|
46
|
+
)
|
|
47
|
+
} else {
|
|
48
|
+
console.log(` 読み込みエラー: ${authorEntity.message}`)
|
|
49
|
+
}
|
|
50
|
+
} else if (authorRelation instanceof Error) {
|
|
51
|
+
console.log(` エラー: ${authorRelation.message}`)
|
|
52
|
+
} else {
|
|
53
|
+
console.log(" リレーションが見つかりません")
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// 4. 複数のリレーションを取得(features)
|
|
57
|
+
console.log("\n3. 複数のリレーションを取得 (features):")
|
|
58
|
+
const featureRelations = await pageFile.relations("features")
|
|
59
|
+
console.log(` 機能数: ${featureRelations.length}`)
|
|
60
|
+
|
|
61
|
+
for (const featureRef of featureRelations) {
|
|
62
|
+
console.log(` - パス: ${featureRef.path}`)
|
|
63
|
+
const featureEntity = await featureRef.read()
|
|
64
|
+
if (!(featureEntity instanceof Error)) {
|
|
65
|
+
console.log(` タイトル: ${featureEntity.content.title}`)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// 4.5. 別の単一リレーションを取得(category)
|
|
70
|
+
console.log("\n4. 別の単一リレーションを取得 (category):")
|
|
71
|
+
const categoryRelation = await pageFile.relation("category")
|
|
72
|
+
if (categoryRelation && !(categoryRelation instanceof Error)) {
|
|
73
|
+
console.log(` リレーション先のパス: ${categoryRelation.path}`)
|
|
74
|
+
const categoryEntity = await categoryRelation.read()
|
|
75
|
+
if (!(categoryEntity instanceof Error)) {
|
|
76
|
+
console.log(` カテゴリー名: ${categoryEntity.content.title}`)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// 5. ディレクトリのindex.mdからスキーマを確認
|
|
81
|
+
console.log("\n5. ディレクトリのindex.mdからスキーマを確認:")
|
|
82
|
+
const indexFile = await pageFile.getDirectoryIndex()
|
|
83
|
+
if (indexFile) {
|
|
84
|
+
const schema = indexFile.content.frontMatter.value.schema
|
|
85
|
+
console.log(" スキーマ定義:")
|
|
86
|
+
if (schema && typeof schema === "object") {
|
|
87
|
+
for (const [key, field] of Object.entries(schema)) {
|
|
88
|
+
if (typeof field === "object" && field !== null && "type" in field) {
|
|
89
|
+
console.log(` - ${key}: ${field.type}`)
|
|
90
|
+
if ("path" in field) {
|
|
91
|
+
console.log(` パス: ${field.path}`)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// 6. ディレクトリ内のファイル一覧を取得
|
|
99
|
+
console.log("\n6. ディレクトリ内のファイル一覧:")
|
|
100
|
+
const pagesDir = docClient.directory("products/doc-browser/pages")
|
|
101
|
+
const files = await pagesDir.files()
|
|
102
|
+
for (const file of files) {
|
|
103
|
+
console.log(` - ${file.path}`)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// 実行
|
|
108
|
+
demonstrateRelations().catch(console.error)
|
package/package.json
CHANGED
|
@@ -1,47 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interactive-inc/docs-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"check": "tsgo --noEmit",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"build:lib": "bun build lib/index.ts --target=node --outfile=build/index.js",
|
|
10
|
-
"build": "bun run build:app && bun run build:lib"
|
|
7
|
+
"build": "rm -rf build && tsgo",
|
|
8
|
+
"npm:publish": "bun run build && npm publish"
|
|
11
9
|
},
|
|
12
10
|
"dependencies": {
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
},
|
|
16
|
-
"devDependencies": {
|
|
17
|
-
"@dnd-kit/core": "^6.3.1",
|
|
18
|
-
"@dnd-kit/modifiers": "^9.0.0",
|
|
19
|
-
"@dnd-kit/sortable": "^10.0.0",
|
|
20
|
-
"@dnd-kit/utilities": "^3.2.2",
|
|
21
|
-
"@tanstack/react-query": "^5.76.1",
|
|
22
|
-
"@tanstack/react-router": "^1.121.21",
|
|
23
|
-
"@interactive-inc/docs": "workspace:*",
|
|
24
|
-
"@interactive-inc/docs-router": "workspace:*",
|
|
25
|
-
"class-variance-authority": "^0.7.1",
|
|
26
|
-
"clsx": "^2.1.1",
|
|
27
|
-
"github-markdown-css": "^5.8.1",
|
|
28
|
-
"lucide-react": "^0.511.0",
|
|
29
|
-
"marked": "^15.0.12",
|
|
30
|
-
"next-themes": "^0.4.6",
|
|
31
|
-
"radix-ui": "^1.4.2",
|
|
32
|
-
"react": "^19.0.0",
|
|
33
|
-
"react-dom": "^19.0.0",
|
|
34
|
-
"sonner": "^2.0.5",
|
|
35
|
-
"tailwind-merge": "^3.3.0",
|
|
36
|
-
"tailwindcss-animate": "^1.0.7",
|
|
37
|
-
"@tailwindcss/postcss": "^4",
|
|
38
|
-
"@tailwindcss/vite": "^4.1.10",
|
|
39
|
-
"@tanstack/router-plugin": "^1.121.21",
|
|
40
|
-
"@tanstack/router-vite-plugin": "^1.121.21",
|
|
41
|
-
"@types/bun": "^1.2.13",
|
|
42
|
-
"@vitejs/plugin-react": "^4.5.2",
|
|
43
|
-
"tailwindcss": "^4",
|
|
44
|
-
"vite": "^6.3.5"
|
|
11
|
+
"yaml": "^2.8.0",
|
|
12
|
+
"zod": "^3.25.74"
|
|
45
13
|
},
|
|
46
14
|
"publishConfig": {
|
|
47
15
|
"access": "public"
|
|
@@ -50,12 +18,7 @@
|
|
|
50
18
|
"types": "build/index.d.ts",
|
|
51
19
|
"module": "build/index.js",
|
|
52
20
|
"exports": {
|
|
53
|
-
".": "./build/index.js"
|
|
54
|
-
|
|
55
|
-
"files": [
|
|
56
|
-
"build/"
|
|
57
|
-
],
|
|
58
|
-
"bin": {
|
|
59
|
-
"docs": "bin/docs.js"
|
|
21
|
+
".": "./build/index.js",
|
|
22
|
+
"./*": "./build/*.js"
|
|
60
23
|
}
|
|
61
24
|
}
|
package/bin/docs.js
DELETED