@interactive-inc/docs-client 0.0.17 → 1.0.0

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
@@ -1513,6 +1513,7 @@ declare class DocDirectoryReference<T extends DocCustomSchema> {
1513
1513
  * Get single subdirectory reference
1514
1514
  */
1515
1515
  directory(directoryName: string): DocDirectoryReference<T>;
1516
+ directory<S extends DocCustomSchema>(directoryName: string, customSchema: S): DocDirectoryReference<S>;
1516
1517
  indexFile(): DocFileIndexReference<T>;
1517
1518
  readIndexFile(): Promise<DocFileIndexEntity<T> | Error>;
1518
1519
  writeFile(entity: DocFileIndexEntity<T> | DocFileMdEntity<T> | DocFileUnknownEntity): Promise<Error | null>;
package/build/index.js CHANGED
@@ -4253,11 +4253,19 @@ var DocDirectoryReference = class _DocDirectoryReference {
4253
4253
  });
4254
4254
  });
4255
4255
  }
4256
- /**
4257
- * Get single subdirectory reference
4258
- */
4259
- directory(directoryName) {
4256
+ directory(directoryName, customSchema) {
4260
4257
  const dirPath = this.pathSystem.join(this.relativePath, directoryName);
4258
+ if (customSchema) {
4259
+ return new _DocDirectoryReference({
4260
+ path: dirPath,
4261
+ indexFileName: this.indexFileName,
4262
+ archiveDirectoryName: this.archiveDirectoryName,
4263
+ fileSystem: this.fileSystem,
4264
+ pathSystem: this.pathSystem,
4265
+ customSchema,
4266
+ config: this.props.config
4267
+ });
4268
+ }
4261
4269
  return new _DocDirectoryReference({
4262
4270
  path: dirPath,
4263
4271
  indexFileName: this.indexFileName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interactive-inc/docs-client",
3
- "version": "0.0.17",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "check": "tsgo --noEmit",
@@ -8,8 +8,8 @@
8
8
  "deploy": "bun run build && npm publish"
9
9
  },
10
10
  "dependencies": {
11
- "yaml": "^2.8.0",
12
- "zod": "^4.0.10"
11
+ "yaml": "^2.0.0",
12
+ "zod": "^4.0.0"
13
13
  },
14
14
  "publishConfig": {
15
15
  "access": "public"
package/debug/debug.ts DELETED
@@ -1,62 +0,0 @@
1
- import { DocClient } from "@/doc-client"
2
- import { DocFileSystem } from "@/doc-file-system"
3
- import { DocSchemaBuilder } from "@/doc-schema-builder"
4
- import { defineSchema, docCustomSchemaField } from "@/utils"
5
-
6
- const client = new DocClient({
7
- fileSystem: new DocFileSystem({ basePath: "../../docs" }),
8
- })
9
-
10
- // Method 1: Using defineSchema (recommended)
11
- const pageSchema = defineSchema({
12
- features: docCustomSchemaField.multiRelation(true),
13
- })
14
-
15
- const pagesRef = client.directory("docs-studio/pages", pageSchema)
16
-
17
- const mdFileRef = pagesRef.file("document-editor.md")
18
-
19
- const mdFile = await mdFileRef.read()
20
-
21
- if (mdFile instanceof Error) {
22
- throw mdFile
23
- }
24
-
25
- const _features = mdFile.content.meta().field("features")
26
-
27
- mdFile.withContent(
28
- mdFile.content.withMetaProperty("features", [
29
- "edit-document-content",
30
- "delete-document",
31
- "foo",
32
- ]),
33
- )
34
-
35
- // Method 2: Using field helpers
36
- const featureSchema = defineSchema({
37
- "is-done": docCustomSchemaField.boolean(true),
38
- })
39
-
40
- const relations = await mdFileRef.relations("features", featureSchema)
41
-
42
- const file = await relations[0].read()
43
-
44
- console.log("relations", file)
45
-
46
- // Method 3: Using SchemaBuilder
47
- const fooSchema = new DocSchemaBuilder()
48
- .multiRelation("feature", true)
49
- .text("priority", false)
50
- .build()
51
-
52
- const fooRef = client.directory("docs-studio/files", fooSchema)
53
-
54
- const aaa = await fooRef.mdFile("a")
55
-
56
- const fooFile = await aaa.read()
57
-
58
- if (fooFile instanceof Error) {
59
- throw fooFile
60
- }
61
-
62
- fooFile.content.meta().field("feature")
package/tsup.config.ts DELETED
@@ -1,10 +0,0 @@
1
- import { defineConfig } from "tsup"
2
-
3
- export default defineConfig({
4
- entry: ["lib/index.ts", "lib/models.ts"],
5
- outDir: "build",
6
- format: ["esm"],
7
- clean: true,
8
- dts: true,
9
- splitting: false,
10
- })