katanakit-js 5.1.0 → 5.1.1

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.
Files changed (36) hide show
  1. package/README.md +139 -0
  2. package/dist/core/index.d.ts +1 -0
  3. package/dist/core/index.d.ts.map +1 -1
  4. package/dist/core/index.js +1 -0
  5. package/dist/core/index.js.map +1 -1
  6. package/dist/core/services/faker.service.d.ts +160 -0
  7. package/dist/core/services/faker.service.d.ts.map +1 -0
  8. package/dist/core/services/faker.service.js +235 -0
  9. package/dist/core/services/faker.service.js.map +1 -0
  10. package/dist/infrastructure/filesystem/filesystem.service.d.ts +238 -0
  11. package/dist/infrastructure/filesystem/filesystem.service.d.ts.map +1 -0
  12. package/dist/infrastructure/filesystem/filesystem.service.js +403 -0
  13. package/dist/infrastructure/filesystem/filesystem.service.js.map +1 -0
  14. package/dist/infrastructure/filesystem/path.service.d.ts +115 -0
  15. package/dist/infrastructure/filesystem/path.service.d.ts.map +1 -0
  16. package/dist/infrastructure/filesystem/path.service.js +154 -0
  17. package/dist/infrastructure/filesystem/path.service.js.map +1 -0
  18. package/dist/infrastructure/index.d.ts +2 -0
  19. package/dist/infrastructure/index.d.ts.map +1 -1
  20. package/dist/infrastructure/index.js +2 -0
  21. package/dist/infrastructure/index.js.map +1 -1
  22. package/dist/schemas/faker.schema.d.ts +12 -0
  23. package/dist/schemas/faker.schema.d.ts.map +1 -0
  24. package/dist/schemas/faker.schema.js +12 -0
  25. package/dist/schemas/faker.schema.js.map +1 -0
  26. package/dist/schemas/filesystem.schema.d.ts +64 -0
  27. package/dist/schemas/filesystem.schema.d.ts.map +1 -0
  28. package/dist/schemas/filesystem.schema.js +54 -0
  29. package/dist/schemas/filesystem.schema.js.map +1 -0
  30. package/dist/schemas/index.d.ts +2 -0
  31. package/dist/schemas/index.d.ts.map +1 -1
  32. package/dist/schemas/index.js +2 -0
  33. package/dist/schemas/index.js.map +1 -1
  34. package/dist/types/index.d.ts +26 -0
  35. package/dist/types/index.d.ts.map +1 -1
  36. package/package.json +6 -1
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Checks whether the code runs in a Node.js-compatible runtime
3
+ * (Node, Bun or Deno). Returns `false` in browsers and edge runtimes.
4
+ *
5
+ * @returns `true` when `process.versions.node` is available.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import { useIsNode } from "katanakit-js";
10
+ *
11
+ * if (useIsNode()) {
12
+ * // safe to use node:fs / node:path
13
+ * }
14
+ * ```
15
+ */
16
+ export declare const useIsNode: () => boolean;
17
+ /**
18
+ * Resolves the directory of a module from its `import.meta.url`.
19
+ *
20
+ * Unlike `import.meta.dirname`, this works for any module you pass in,
21
+ * so a consumer's app resolves its own paths — never KatanaKit's `dist/`.
22
+ *
23
+ * @param importMetaUrl - Your module's `import.meta.url`.
24
+ * @returns The absolute directory that contains the module.
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * import { useGetDirname } from "katanakit-js";
29
+ *
30
+ * const dir = await useGetDirname(import.meta.url);
31
+ * // "<project>/src/features/books"
32
+ * ```
33
+ */
34
+ export declare function useGetDirname(importMetaUrl: string): Promise<string>;
35
+ /**
36
+ * Resolves a sequence of path segments into an absolute path.
37
+ * Relative segments resolve against `process.cwd()`; if the first
38
+ * segment is absolute (like a `useGetDirname` result), cwd is ignored.
39
+ *
40
+ * @param segments - Path segments to resolve.
41
+ * @returns The resolved absolute path.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const base = await useGetDirname(import.meta.url);
46
+ * const file = await useResolvePath(base, "../data/books.json");
47
+ * ```
48
+ */
49
+ export declare function useResolvePath(...segments: string[]): Promise<string>;
50
+ /**
51
+ * Joins path segments without resolving against `process.cwd()`.
52
+ *
53
+ * @param segments - Path segments to join.
54
+ * @returns The joined (possibly relative) path.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * await useJoinPath("data", "books.json"); // "data/books.json"
59
+ * ```
60
+ */
61
+ export declare function useJoinPath(...segments: string[]): Promise<string>;
62
+ /**
63
+ * Computes the relative path from `from` to `to`.
64
+ *
65
+ * @param from - Origin path.
66
+ * @param to - Destination path.
67
+ * @returns The relative path between both.
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * await useGetRelativePath("/app/src", "/app/data/books.json"); // "../data/books.json"
72
+ * ```
73
+ */
74
+ export declare function useGetRelativePath(from: string, to: string): Promise<string>;
75
+ /**
76
+ * Returns the last portion of a path (file name).
77
+ *
78
+ * @param filePath - The path to inspect.
79
+ * @param suffix - Optional suffix to strip (e.g. `".json"`).
80
+ * @returns The base name.
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * await useGetBasename("/data/books.json"); // "books.json"
85
+ * await useGetBasename("/data/books.json", ".json"); // "books"
86
+ * ```
87
+ */
88
+ export declare function useGetBasename(filePath: string, suffix?: string): Promise<string>;
89
+ /**
90
+ * Returns the extension of a path, including the leading dot.
91
+ *
92
+ * @param filePath - The path to inspect.
93
+ * @returns The extension (`""` when there is none).
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * await useGetFileExtension("/data/books.json"); // ".json"
98
+ * ```
99
+ */
100
+ export declare function useGetFileExtension(filePath: string): Promise<string>;
101
+ /**
102
+ * Returns the current working directory of the process (where the
103
+ * command was launched), or `null` outside a Node-compatible runtime.
104
+ * Use it for project-relative paths; use {@link useGetDirname} for
105
+ * file-relative paths.
106
+ *
107
+ * @returns The cwd, or `null` in browsers/edge runtimes.
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * const cwd = useGetCwd(); // "/app" when launched from the project root
112
+ * ```
113
+ */
114
+ export declare function useGetCwd(): string | null;
115
+ //# sourceMappingURL=path.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.service.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/filesystem/path.service.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,SAAS,QAAO,OACgD,CAAC;AAkB9E;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAG1E;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,cAAc,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAG3E;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAGxE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGlF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGvF;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAG3E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,IAAI,MAAM,GAAG,IAAI,CAEzC"}
@@ -0,0 +1,154 @@
1
+ // ============================================================
2
+ // Path facade — Node-only helpers with runtime guards.
3
+ // `node:path` and `node:url` load through dynamic `import()` so
4
+ // importing this module never pulls Node built-ins into a browser
5
+ // bundle. Outside Node/Bun the helpers throw; the filesystem
6
+ // service catches that surface and returns a Safe Result instead.
7
+ // ============================================================
8
+ /**
9
+ * Checks whether the code runs in a Node.js-compatible runtime
10
+ * (Node, Bun or Deno). Returns `false` in browsers and edge runtimes.
11
+ *
12
+ * @returns `true` when `process.versions.node` is available.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * import { useIsNode } from "katanakit-js";
17
+ *
18
+ * if (useIsNode()) {
19
+ * // safe to use node:fs / node:path
20
+ * }
21
+ * ```
22
+ */
23
+ export const useIsNode = () => typeof process !== "undefined" && typeof process.versions?.node === "string";
24
+ /** Throws when a path helper is called outside a Node-compatible runtime. */
25
+ function assertNodeRuntime() {
26
+ if (!useIsNode()) {
27
+ throw new Error("[Filesystem] A Node.js-compatible runtime is required to use filesystem helpers.");
28
+ }
29
+ }
30
+ /** Lazily loads `node:path` and `node:url` (the ESM loader caches both). */
31
+ async function loadModules() {
32
+ assertNodeRuntime();
33
+ const [path, url] = await Promise.all([import("node:path"), import("node:url")]);
34
+ return { path, url };
35
+ }
36
+ /**
37
+ * Resolves the directory of a module from its `import.meta.url`.
38
+ *
39
+ * Unlike `import.meta.dirname`, this works for any module you pass in,
40
+ * so a consumer's app resolves its own paths — never KatanaKit's `dist/`.
41
+ *
42
+ * @param importMetaUrl - Your module's `import.meta.url`.
43
+ * @returns The absolute directory that contains the module.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * import { useGetDirname } from "katanakit-js";
48
+ *
49
+ * const dir = await useGetDirname(import.meta.url);
50
+ * // "<project>/src/features/books"
51
+ * ```
52
+ */
53
+ export async function useGetDirname(importMetaUrl) {
54
+ const { path, url } = await loadModules();
55
+ return path.dirname(url.fileURLToPath(importMetaUrl));
56
+ }
57
+ /**
58
+ * Resolves a sequence of path segments into an absolute path.
59
+ * Relative segments resolve against `process.cwd()`; if the first
60
+ * segment is absolute (like a `useGetDirname` result), cwd is ignored.
61
+ *
62
+ * @param segments - Path segments to resolve.
63
+ * @returns The resolved absolute path.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * const base = await useGetDirname(import.meta.url);
68
+ * const file = await useResolvePath(base, "../data/books.json");
69
+ * ```
70
+ */
71
+ export async function useResolvePath(...segments) {
72
+ const { path } = await loadModules();
73
+ return path.resolve(...segments);
74
+ }
75
+ /**
76
+ * Joins path segments without resolving against `process.cwd()`.
77
+ *
78
+ * @param segments - Path segments to join.
79
+ * @returns The joined (possibly relative) path.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * await useJoinPath("data", "books.json"); // "data/books.json"
84
+ * ```
85
+ */
86
+ export async function useJoinPath(...segments) {
87
+ const { path } = await loadModules();
88
+ return path.join(...segments);
89
+ }
90
+ /**
91
+ * Computes the relative path from `from` to `to`.
92
+ *
93
+ * @param from - Origin path.
94
+ * @param to - Destination path.
95
+ * @returns The relative path between both.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * await useGetRelativePath("/app/src", "/app/data/books.json"); // "../data/books.json"
100
+ * ```
101
+ */
102
+ export async function useGetRelativePath(from, to) {
103
+ const { path } = await loadModules();
104
+ return path.relative(from, to);
105
+ }
106
+ /**
107
+ * Returns the last portion of a path (file name).
108
+ *
109
+ * @param filePath - The path to inspect.
110
+ * @param suffix - Optional suffix to strip (e.g. `".json"`).
111
+ * @returns The base name.
112
+ *
113
+ * @example
114
+ * ```ts
115
+ * await useGetBasename("/data/books.json"); // "books.json"
116
+ * await useGetBasename("/data/books.json", ".json"); // "books"
117
+ * ```
118
+ */
119
+ export async function useGetBasename(filePath, suffix) {
120
+ const { path } = await loadModules();
121
+ return path.basename(filePath, suffix);
122
+ }
123
+ /**
124
+ * Returns the extension of a path, including the leading dot.
125
+ *
126
+ * @param filePath - The path to inspect.
127
+ * @returns The extension (`""` when there is none).
128
+ *
129
+ * @example
130
+ * ```ts
131
+ * await useGetFileExtension("/data/books.json"); // ".json"
132
+ * ```
133
+ */
134
+ export async function useGetFileExtension(filePath) {
135
+ const { path } = await loadModules();
136
+ return path.extname(filePath);
137
+ }
138
+ /**
139
+ * Returns the current working directory of the process (where the
140
+ * command was launched), or `null` outside a Node-compatible runtime.
141
+ * Use it for project-relative paths; use {@link useGetDirname} for
142
+ * file-relative paths.
143
+ *
144
+ * @returns The cwd, or `null` in browsers/edge runtimes.
145
+ *
146
+ * @example
147
+ * ```ts
148
+ * const cwd = useGetCwd(); // "/app" when launched from the project root
149
+ * ```
150
+ */
151
+ export function useGetCwd() {
152
+ return useIsNode() ? process.cwd() : null;
153
+ }
154
+ //# sourceMappingURL=path.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path.service.js","sourceRoot":"","sources":["../../../src/infrastructure/filesystem/path.service.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,uDAAuD;AACvD,gEAAgE;AAChE,kEAAkE;AAClE,6DAA6D;AAC7D,kEAAkE;AAClE,+DAA+D;AAK/D;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,GAAY,EAAE,CACtC,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,OAAO,CAAC,QAAQ,EAAE,IAAI,KAAK,QAAQ,CAAC;AAE9E,6EAA6E;AAC7E,SAAS,iBAAiB;IACzB,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CACd,kFAAkF,CAClF,CAAC;IACH,CAAC;AACF,CAAC;AAED,4EAA4E;AAC5E,KAAK,UAAU,WAAW;IACzB,iBAAiB,EAAE,CAAC;IACpB,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACjF,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AACtB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,aAAqB;IACxD,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,WAAW,EAAE,CAAC;IAC1C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC;AACvD,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAG,QAAkB;IACzD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,WAAW,EAAE,CAAC;IACrC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAG,QAAkB;IACtD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,WAAW,EAAE,CAAC;IACrC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAAY,EAAE,EAAU;IAChE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,WAAW,EAAE,CAAC;IACrC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAChC,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,QAAgB,EAAE,MAAe;IACrE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,WAAW,EAAE,CAAC;IACrC,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,QAAgB;IACzD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,WAAW,EAAE,CAAC;IACrC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC/B,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS;IACxB,OAAO,SAAS,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3C,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export * from "./dom/dom.service.js";
2
+ export * from "./filesystem/filesystem.service.js";
3
+ export * from "./filesystem/path.service.js";
2
4
  export * from "./media/media.service.js";
3
5
  export * from "./observer/observer.service.js";
4
6
  export * from "./sensors/sensors.service.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/infrastructure/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/infrastructure/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC"}
@@ -1,4 +1,6 @@
1
1
  export * from "./dom/dom.service.js";
2
+ export * from "./filesystem/filesystem.service.js";
3
+ export * from "./filesystem/path.service.js";
2
4
  export * from "./media/media.service.js";
3
5
  export * from "./observer/observer.service.js";
4
6
  export * from "./sensors/sensors.service.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/infrastructure/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/infrastructure/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oCAAoC,CAAC;AACnD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { z } from "zod";
2
+ /** Generic fake vehicle shape returned by `useFakeVehicle`. */
3
+ export declare const FakeVehicleSchema: z.ZodObject<{
4
+ brand: z.ZodString;
5
+ model: z.ZodString;
6
+ type: z.ZodString;
7
+ fuel: z.ZodString;
8
+ color: z.ZodString;
9
+ vin: z.ZodString;
10
+ plate: z.ZodString;
11
+ }, z.core.$strip>;
12
+ //# sourceMappingURL=faker.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faker.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/faker.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+DAA+D;AAC/D,eAAO,MAAM,iBAAiB;;;;;;;;iBAQ5B,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { z } from "zod";
2
+ /** Generic fake vehicle shape returned by `useFakeVehicle`. */
3
+ export const FakeVehicleSchema = z.object({
4
+ brand: z.string(),
5
+ model: z.string(),
6
+ type: z.string(),
7
+ fuel: z.string(),
8
+ color: z.string(),
9
+ vin: z.string(),
10
+ plate: z.string(),
11
+ });
12
+ //# sourceMappingURL=faker.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faker.schema.js","sourceRoot":"","sources":["../../src/schemas/faker.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+DAA+D;AAC/D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAC"}
@@ -0,0 +1,64 @@
1
+ import { z } from "zod";
2
+ /** Text encodings accepted by the filesystem helpers. */
3
+ export declare const FileEncodingSchema: z.ZodEnum<{
4
+ "utf-8": "utf-8";
5
+ utf8: "utf8";
6
+ ascii: "ascii";
7
+ base64: "base64";
8
+ base64url: "base64url";
9
+ hex: "hex";
10
+ latin1: "latin1";
11
+ binary: "binary";
12
+ ucs2: "ucs2";
13
+ "ucs-2": "ucs-2";
14
+ utf16le: "utf16le";
15
+ "utf-16le": "utf-16le";
16
+ }>;
17
+ /** Safe error from a filesystem operation (`NodeJS.ErrnoException`-shaped). */
18
+ export declare const FilesystemErrorSchema: z.ZodObject<{
19
+ code: z.ZodString;
20
+ message: z.ZodString;
21
+ path: z.ZodOptional<z.ZodString>;
22
+ details: z.ZodOptional<z.ZodUnknown>;
23
+ }, z.core.$strip>;
24
+ /** Portable stats subset for a file or directory. */
25
+ export declare const FileStatsSchema: z.ZodObject<{
26
+ size: z.ZodNumber;
27
+ isFile: z.ZodBoolean;
28
+ isDirectory: z.ZodBoolean;
29
+ isSymbolicLink: z.ZodBoolean;
30
+ createdAt: z.ZodNumber;
31
+ modifiedAt: z.ZodNumber;
32
+ accessedAt: z.ZodNumber;
33
+ }, z.core.$strip>;
34
+ /** A single directory entry with pre-resolved type flags. */
35
+ export declare const ReadDirEntrySchema: z.ZodObject<{
36
+ name: z.ZodString;
37
+ path: z.ZodString;
38
+ isFile: z.ZodBoolean;
39
+ isDirectory: z.ZodBoolean;
40
+ }, z.core.$strip>;
41
+ /** Options for directory listing. */
42
+ export declare const ReadDirOptionsSchema: z.ZodObject<{
43
+ recursive: z.ZodOptional<z.ZodBoolean>;
44
+ }, z.core.$strip>;
45
+ /** Options for writing or appending files. */
46
+ export declare const WriteFileOptionsSchema: z.ZodObject<{
47
+ encoding: z.ZodOptional<z.ZodEnum<{
48
+ "utf-8": "utf-8";
49
+ utf8: "utf8";
50
+ ascii: "ascii";
51
+ base64: "base64";
52
+ base64url: "base64url";
53
+ hex: "hex";
54
+ latin1: "latin1";
55
+ binary: "binary";
56
+ ucs2: "ucs2";
57
+ "ucs-2": "ucs-2";
58
+ utf16le: "utf16le";
59
+ "utf-16le": "utf-16le";
60
+ }>>;
61
+ mode: z.ZodOptional<z.ZodNumber>;
62
+ flag: z.ZodOptional<z.ZodString>;
63
+ }, z.core.$strip>;
64
+ //# sourceMappingURL=filesystem.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filesystem.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/filesystem.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yDAAyD;AACzD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;EAa7B,CAAC;AAEH,+EAA+E;AAC/E,eAAO,MAAM,qBAAqB;;;;;iBAKhC,CAAC;AAEH,qDAAqD;AACrD,eAAO,MAAM,eAAe;;;;;;;;iBAW1B,CAAC;AAEH,6DAA6D;AAC7D,eAAO,MAAM,kBAAkB;;;;;iBAK7B,CAAC;AAEH,qCAAqC;AACrC,eAAO,MAAM,oBAAoB;;iBAE/B,CAAC;AAEH,8CAA8C;AAC9C,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;iBAIjC,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { z } from "zod";
2
+ /** Text encodings accepted by the filesystem helpers. */
3
+ export const FileEncodingSchema = z.enum([
4
+ "utf8",
5
+ "utf-8",
6
+ "ascii",
7
+ "base64",
8
+ "base64url",
9
+ "hex",
10
+ "latin1",
11
+ "binary",
12
+ "ucs2",
13
+ "ucs-2",
14
+ "utf16le",
15
+ "utf-16le",
16
+ ]);
17
+ /** Safe error from a filesystem operation (`NodeJS.ErrnoException`-shaped). */
18
+ export const FilesystemErrorSchema = z.object({
19
+ code: z.string(),
20
+ message: z.string(),
21
+ path: z.string().optional(),
22
+ details: z.unknown().optional(),
23
+ });
24
+ /** Portable stats subset for a file or directory. */
25
+ export const FileStatsSchema = z.object({
26
+ size: z.number(),
27
+ isFile: z.boolean(),
28
+ isDirectory: z.boolean(),
29
+ isSymbolicLink: z.boolean(),
30
+ /** Creation time in epoch milliseconds (`birthtimeMs`). */
31
+ createdAt: z.number(),
32
+ /** Last modification time in epoch milliseconds (`mtimeMs`). */
33
+ modifiedAt: z.number(),
34
+ /** Last access time in epoch milliseconds (`atimeMs`). */
35
+ accessedAt: z.number(),
36
+ });
37
+ /** A single directory entry with pre-resolved type flags. */
38
+ export const ReadDirEntrySchema = z.object({
39
+ name: z.string(),
40
+ path: z.string(),
41
+ isFile: z.boolean(),
42
+ isDirectory: z.boolean(),
43
+ });
44
+ /** Options for directory listing. */
45
+ export const ReadDirOptionsSchema = z.object({
46
+ recursive: z.boolean().optional(),
47
+ });
48
+ /** Options for writing or appending files. */
49
+ export const WriteFileOptionsSchema = z.object({
50
+ encoding: FileEncodingSchema.optional(),
51
+ mode: z.number().int().nonnegative().optional(),
52
+ flag: z.string().optional(),
53
+ });
54
+ //# sourceMappingURL=filesystem.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filesystem.schema.js","sourceRoot":"","sources":["../../src/schemas/filesystem.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,yDAAyD;AACzD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC;IACxC,MAAM;IACN,OAAO;IACP,OAAO;IACP,QAAQ;IACR,WAAW;IACX,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IACP,SAAS;IACT,UAAU;CACV,CAAC,CAAC;AAEH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CAC/B,CAAC,CAAC;AAEH,qDAAqD;AACrD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE;IACxB,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE;IAC3B,2DAA2D;IAC3D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,gEAAgE;IAChE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,0DAA0D;IAC1D,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AAEH,6DAA6D;AAC7D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE;IACnB,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE;CACxB,CAAC,CAAC;AAEH,qCAAqC;AACrC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC;AAEH,8CAA8C;AAC9C,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,EAAE;IACvC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IAC/C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC3B,CAAC,CAAC"}
@@ -2,6 +2,8 @@ export * from "./access.schema.js";
2
2
  export * from "./ai.schema.js";
3
3
  export * from "./common.schema.js";
4
4
  export * from "./core.schema.js";
5
+ export * from "./faker.schema.js";
6
+ export * from "./filesystem.schema.js";
5
7
  export * from "./insforge.schema.js";
6
8
  export * from "./media.schema.js";
7
9
  export * from "./notion.schema.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC"}
@@ -2,6 +2,8 @@ export * from "./access.schema.js";
2
2
  export * from "./ai.schema.js";
3
3
  export * from "./common.schema.js";
4
4
  export * from "./core.schema.js";
5
+ export * from "./faker.schema.js";
6
+ export * from "./filesystem.schema.js";
5
7
  export * from "./insforge.schema.js";
6
8
  export * from "./media.schema.js";
7
9
  export * from "./notion.schema.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC"}
@@ -5,6 +5,8 @@ import { AccessCapabilitySchema, AccessRoleDefinitionSchema, AccessRoleSchema, A
5
5
  import { AiFunctionCallSchema, AiMessageSchema, AiProviderConfigSchema, AiRoleSchema, AiToolCallSchema } from "../schemas/ai.schema.js";
6
6
  import { ApiErrorSchema, HttpMethodSchema, LocaleSchema, LogLevelSchema, SerializedErrorSchema, StorageTargetSchema, ThemeModeSchema } from "../schemas/common.schema.js";
7
7
  import { AgentDataSchema, AgentStepSchema, AiErrorSchema, AppDateFormatOptionsSchema, AssistantReplySchema, AstroServiceErrorSchema, CurrencyFormatOptionsSchema, CurrencySchema, FieldErrorsSchema, GeometryFormatOptionsSchema, GeoPositionSchema, LazyLoaderEntrySchema, NumberFormatOptionsSchema, ProductTypeSchema, ScrollPositionSchema, ValidationIssueSchema, ViewportSizeSchema } from "../schemas/core.schema.js";
8
+ import { FakeVehicleSchema } from "../schemas/faker.schema.js";
9
+ import { FileEncodingSchema, FileStatsSchema, FilesystemErrorSchema, ReadDirEntrySchema, ReadDirOptionsSchema, WriteFileOptionsSchema } from "../schemas/filesystem.schema.js";
8
10
  import { IfConfigSchema, IfInsertRowsSchema, IfInvokeOptionsSchema, IfListOptionsSchema, IfOrderSchema, IfRpcCallSchema, IfStorageRefSchema, IfTableQuerySchema, IfUpdatePatchSchema, IfWriteQuerySchema } from "../schemas/insforge.schema.js";
9
11
  import { MediaProviderSchema, MediaSourceSchema, SmartVideoOptionsSchema, YoutubeEmbedOptionsSchema, YoutubeThumbnailQualitySchema } from "../schemas/media.schema.js";
10
12
  import { NotionBlockListSchema, NotionBlockSchema, NotionConfigSchema, NotionCoverSchema, NotionDatabaseQuerySchema, NotionDatabaseSchema, NotionIconSchema, NotionPageListSchema, NotionPageSchema, NotionParentSchema, NotionPropertySchemaSchema, NotionPropertyValueSchema, NotionRichTextSchema, NotionSearchQuerySchema, NotionSearchResultSchema, NotionSortSchema, NotionUserListSchema, NotionUserSchema } from "../schemas/notion.schema.js";
@@ -85,6 +87,28 @@ export interface StorageStrategy {
85
87
  useRemoveItem(key: string): void;
86
88
  useClear(): void;
87
89
  }
90
+ /** Text encodings accepted by the filesystem helpers. */
91
+ export type FileEncoding = z.infer<typeof FileEncodingSchema>;
92
+ /** Safe error from a filesystem operation (`NodeJS.ErrnoException`-shaped). */
93
+ export type FilesystemError = z.infer<typeof FilesystemErrorSchema>;
94
+ /** Safe Result for filesystem operations: `{ data, error, ok }`, never throws. */
95
+ export type FilesystemResult<T> = {
96
+ data: T;
97
+ error: null;
98
+ ok: true;
99
+ } | {
100
+ data: null;
101
+ error: FilesystemError;
102
+ ok: false;
103
+ };
104
+ /** Portable stats subset returned by `useGetFileStats`. */
105
+ export type FileStats = z.infer<typeof FileStatsSchema>;
106
+ /** A single directory entry returned by `useReadDir`. */
107
+ export type ReadDirEntry = z.infer<typeof ReadDirEntrySchema>;
108
+ /** Options for `useReadDir`. */
109
+ export type ReadDirOptions = z.infer<typeof ReadDirOptionsSchema>;
110
+ /** Options for `useWriteFile` / `useAppendFile`. */
111
+ export type WriteFileOptions = z.infer<typeof WriteFileOptionsSchema>;
88
112
  export type Locale = z.infer<typeof LocaleSchema>;
89
113
  export type Currency = z.infer<typeof CurrencySchema>;
90
114
  export type CurrencyFormatOptions = z.infer<typeof CurrencyFormatOptionsSchema>;
@@ -194,6 +218,8 @@ export interface ICryptoStrategy {
194
218
  export interface IUuidStrategy {
195
219
  useGenerate(): string;
196
220
  }
221
+ /** Generic fake vehicle returned by `useFakeVehicle`. */
222
+ export type FakeVehicle = z.infer<typeof FakeVehicleSchema>;
197
223
  /** Options for number formatting in geometry calculations. */
198
224
  export type GeometryFormatOptions = z.infer<typeof GeometryFormatOptionsSchema>;
199
225
  export type SignalListener<T> = (newValue: T, oldValue: T) => void;