@hamak/ui-store-api 0.2.6 → 0.4.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/es2015/fs/contracts/filesystem-facade.contract.js +1 -0
  3. package/dist/es2015/fs/contracts/filesystem-manager.contract.js +1 -0
  4. package/dist/es2015/fs/index.js +6 -0
  5. package/dist/es2015/fs/types/fs-node.types.js +1 -0
  6. package/dist/es2015/fs/types/fs-state.types.js +12 -0
  7. package/dist/es2015/index.js +1 -0
  8. package/dist/fs/contracts/filesystem-facade.contract.d.ts +58 -0
  9. package/dist/fs/contracts/filesystem-facade.contract.d.ts.map +1 -0
  10. package/dist/fs/contracts/filesystem-facade.contract.js +1 -0
  11. package/dist/fs/contracts/filesystem-manager.contract.d.ts +41 -0
  12. package/dist/fs/contracts/filesystem-manager.contract.d.ts.map +1 -0
  13. package/dist/fs/contracts/filesystem-manager.contract.js +1 -0
  14. package/dist/fs/index.d.ts +6 -0
  15. package/dist/fs/index.d.ts.map +1 -0
  16. package/dist/fs/index.js +6 -0
  17. package/dist/fs/types/fs-node.types.d.ts +37 -0
  18. package/dist/fs/types/fs-node.types.d.ts.map +1 -0
  19. package/dist/fs/types/fs-node.types.js +1 -0
  20. package/dist/fs/types/fs-state.types.d.ts +32 -0
  21. package/dist/fs/types/fs-state.types.d.ts.map +1 -0
  22. package/dist/fs/types/fs-state.types.js +12 -0
  23. package/dist/index.d.ts +1 -0
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +1 -0
  26. package/package.json +2 -1
  27. package/project.json +24 -0
  28. package/src/fs/contracts/filesystem-facade.contract.ts +68 -0
  29. package/src/fs/contracts/filesystem-manager.contract.ts +51 -0
  30. package/src/fs/index.ts +10 -0
  31. package/src/fs/types/fs-node.types.ts +45 -0
  32. package/src/fs/types/fs-state.types.ts +39 -0
  33. package/src/index.ts +1 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,41 @@
1
+ ## 0.4.0 (2025-11-10)
2
+
3
+ ### 🚀 Features
4
+
5
+ - implement notification plugin with UI and backend components ([c19ffcf](https://github.com/amah/app-framework/commit/c19ffcf))
6
+ - add ES2015 build support and fix TypeScript config for logging packages ([be5e45e](https://github.com/amah/app-framework/commit/be5e45e))
7
+ - complete logging system build and add optional console interception ([f390bc6](https://github.com/amah/app-framework/commit/f390bc6))
8
+ - implement core pluggable logging system (Phase 1) ([2abdc1a](https://github.com/amah/app-framework/commit/2abdc1a))
9
+
10
+ ### 🩹 Fixes
11
+
12
+ - add notification packages to workspaces ([97a234d](https://github.com/amah/app-framework/commit/97a234d))
13
+
14
+ ### ❤️ Thank You
15
+
16
+ - Amah
17
+ - Claude
18
+
19
+ ## 0.3.0 (2025-11-06)
20
+
21
+ ### 🚀 Features
22
+
23
+ - migrate from Turbo to Nx 22 with comprehensive monorepo setup ([e63801e](https://github.com/amah/app-framework/commit/e63801e))
24
+ - add Nx Release for automated dependency management ([01d474f](https://github.com/amah/app-framework/commit/01d474f))
25
+ - migrate from Turbo to Nx 22 monorepo orchestration ([d374271](https://github.com/amah/app-framework/commit/d374271))
26
+ - add configurable main padding and resizable sidebar to DashboardLayout ([c1d25bf](https://github.com/amah/app-framework/commit/c1d25bf))
27
+ - add debug logging and version management system ([ea514fc](https://github.com/amah/app-framework/commit/ea514fc))
28
+ - **ui-store:** add STORE_EXTENSIONS_TOKEN for DI-based middleware/reducer registration ([e855bdd](https://github.com/amah/app-framework/commit/e855bdd))
29
+ - Rename package scope from @amk to @hamak and configure npm publishing ([b6040b5](https://github.com/amah/app-framework/commit/b6040b5))
30
+ - Add hybrid local/CI-CD development workflow with bun link ([d09f528](https://github.com/amah/app-framework/commit/d09f528))
31
+ - Add Turborepo for intelligent build orchestration and fix test type errors ([ba41db8](https://github.com/amah/app-framework/commit/ba41db8))
32
+ - Add Redux store integration with ui-store package and demo ([e5aafa8](https://github.com/amah/app-framework/commit/e5aafa8))
33
+
34
+ ### 🩹 Fixes
35
+
36
+ - move git config to top-level release.git in nx.json ([1bb2187](https://github.com/amah/app-framework/commit/1bb2187))
37
+
38
+ ### ❤️ Thank You
39
+
40
+ - Amah
41
+ - Claude
@@ -0,0 +1,6 @@
1
+ // Filesystem types
2
+ export * from './types/fs-node.types';
3
+ export * from './types/fs-state.types';
4
+ // Filesystem contracts
5
+ export * from './contracts/filesystem-manager.contract';
6
+ export * from './contracts/filesystem-facade.contract';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Create initial filesystem node state
3
+ */
4
+ export function fileSystemNodeInitialState(contentPresent = true) {
5
+ return {
6
+ contentLoaded: contentPresent,
7
+ contentLoading: false,
8
+ contentLoadError: undefined,
9
+ contentHistory: [],
10
+ extensionStates: {}
11
+ };
12
+ }
@@ -5,3 +5,4 @@
5
5
  export * from './types';
6
6
  export * from './api';
7
7
  export * from './tokens';
8
+ export * from './fs';
@@ -0,0 +1,58 @@
1
+ import { FileSystemNode, DirectoryNode, FileNode } from '../types/fs-node.types';
2
+ import { Path } from '@hamak/navigation-utils';
3
+ /**
4
+ * High-level facade for filesystem operations
5
+ * Provides a convenient API over the filesystem manager
6
+ */
7
+ export interface IFileSystemFacade {
8
+ /**
9
+ * Get the root directory node
10
+ */
11
+ getRoot(): DirectoryNode;
12
+ /**
13
+ * Resolve a file or directory at the given path
14
+ */
15
+ resolve(path: Path): FileSystemNode | undefined;
16
+ /**
17
+ * Resolve a file at the given path
18
+ */
19
+ resolveFile<T = any>(path: Path): FileNode<T> | undefined;
20
+ /**
21
+ * Resolve a directory at the given path
22
+ */
23
+ resolveDirectory(path: Path): DirectoryNode | undefined;
24
+ /**
25
+ * Create or update a file at the given path
26
+ */
27
+ setFile<T = any>(path: Path, content: T, schema?: string, params?: {
28
+ override?: boolean;
29
+ contentIsPresent?: boolean;
30
+ }): void;
31
+ /**
32
+ * Update file content at the given path
33
+ */
34
+ updateFileContent<T = any>(path: Path, content: T): void;
35
+ /**
36
+ * Create a directory at the given path
37
+ */
38
+ mkdir(path: Path, params?: {
39
+ override?: boolean;
40
+ }): void;
41
+ /**
42
+ * Remove a file or directory at the given path
43
+ */
44
+ remove(path: Path): void;
45
+ /**
46
+ * Check if a path exists
47
+ */
48
+ exists(path: Path): boolean;
49
+ /**
50
+ * Check if a path is a file
51
+ */
52
+ isFile(path: Path): boolean;
53
+ /**
54
+ * Check if a path is a directory
55
+ */
56
+ isDirectory(path: Path): boolean;
57
+ }
58
+ //# sourceMappingURL=filesystem-facade.contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filesystem-facade.contract.d.ts","sourceRoot":"","sources":["../../../src/fs/contracts/filesystem-facade.contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAE/C;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,OAAO,IAAI,aAAa,CAAC;IAEzB;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,cAAc,GAAG,SAAS,CAAC;IAEhD;;OAEG;IACH,WAAW,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAE1D;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,IAAI,GAAG,aAAa,GAAG,SAAS,CAAC;IAExD;;OAEG;IACH,OAAO,CAAC,CAAC,GAAG,GAAG,EACb,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,CAAC,EACV,MAAM,CAAC,EAAE,MAAM,EACf,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAE,GAC1D,IAAI,CAAC;IAER;;OAEG;IACH,iBAAiB,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC;IAEzD;;OAEG;IACH,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IAEzD;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAEzB;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;IAE5B;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;IAE5B;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC;CAClC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,41 @@
1
+ import { FileSystemNode, FileSystemState } from '../types/fs-node.types';
2
+ import { Action } from 'redux';
3
+ /**
4
+ * Redux selector function type
5
+ */
6
+ export type Selector<S, R> = (state: S) => R;
7
+ /**
8
+ * Actions for filesystem operations
9
+ */
10
+ export interface FileSystemNodeAction extends Action {
11
+ command: any;
12
+ }
13
+ /**
14
+ * Parameters for filesystem node actions
15
+ */
16
+ export interface FileSystemNodeActionParams {
17
+ override?: boolean;
18
+ contentIsPresent?: boolean;
19
+ }
20
+ /**
21
+ * Filesystem manager interface - manages Redux state for virtual filesystem
22
+ */
23
+ export interface IFileSystemManager {
24
+ /**
25
+ * Get the slice name for this filesystem
26
+ */
27
+ readonly sliceName: string;
28
+ /**
29
+ * Get initial filesystem state
30
+ */
31
+ getInitialState(): FileSystemState;
32
+ /**
33
+ * Get the reducer function for filesystem operations
34
+ */
35
+ getReducer(): (state: FileSystemState, action: Action) => FileSystemState;
36
+ /**
37
+ * Create a selector for a specific path in the filesystem
38
+ */
39
+ createSelector<S>(fileSystemSelector: Selector<S, FileSystemState | undefined>, path: string | string[]): Selector<S, FileSystemNode | undefined>;
40
+ }
41
+ //# sourceMappingURL=filesystem-manager.contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filesystem-manager.contract.d.ts","sourceRoot":"","sources":["../../../src/fs/contracts/filesystem-manager.contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA2B,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAElG,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,MAAM;IAClD,OAAO,EAAE,GAAG,CAAA;CACb;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,eAAe,IAAI,eAAe,CAAC;IAEnC;;OAEG;IACH,UAAU,IAAI,CAAC,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,KAAK,eAAe,CAAC;IAE1E;;OAEG;IACH,cAAc,CAAC,CAAC,EACd,kBAAkB,EAAE,QAAQ,CAAC,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC,EAC5D,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GACtB,QAAQ,CAAC,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC,CAAC;CAC5C"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export * from './types/fs-node.types';
2
+ export * from './types/fs-state.types';
3
+ export * from './contracts/filesystem-manager.contract';
4
+ export * from './contracts/filesystem-facade.contract';
5
+ export type { FileContentSchema } from '@hamak/navigation-utils';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fs/index.ts"],"names":[],"mappings":"AACA,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AAGvC,cAAc,yCAAyC,CAAC;AACxD,cAAc,wCAAwC,CAAC;AAGvD,YAAY,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,6 @@
1
+ // Filesystem types
2
+ export * from './types/fs-node.types';
3
+ export * from './types/fs-state.types';
4
+ // Filesystem contracts
5
+ export * from './contracts/filesystem-manager.contract';
6
+ export * from './contracts/filesystem-facade.contract';
@@ -0,0 +1,37 @@
1
+ import { AbstractFileNode, AbstractDirectoryNode, FileContentSchema } from '@hamak/navigation-utils';
2
+ import { FileSystemNodeState } from './fs-state.types';
3
+ /**
4
+ * Base interface for filesystem nodes with state
5
+ */
6
+ export interface FileSystemNodeBase {
7
+ type: 'directory' | 'file';
8
+ name: string;
9
+ state: FileSystemNodeState;
10
+ }
11
+ /**
12
+ * Directory node with state management
13
+ */
14
+ export interface DirectoryNode extends FileSystemNodeBase, Omit<AbstractDirectoryNode<FileSystemNode>, 'children'> {
15
+ type: 'directory';
16
+ children: Record<string, FileSystemNode>;
17
+ }
18
+ /**
19
+ * File node with state management
20
+ */
21
+ export interface FileNode<T = any> extends FileSystemNodeBase, AbstractFileNode<T> {
22
+ type: 'file';
23
+ content: T;
24
+ schema: string | FileContentSchema;
25
+ state: FileSystemNodeState;
26
+ }
27
+ /**
28
+ * Union type for filesystem nodes
29
+ */
30
+ export type FileSystemNode = DirectoryNode | FileNode;
31
+ /**
32
+ * Root filesystem state
33
+ */
34
+ export interface FileSystemState {
35
+ root: DirectoryNode;
36
+ }
37
+ //# sourceMappingURL=fs-node.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs-node.types.d.ts","sourceRoot":"","sources":["../../../src/fs/types/fs-node.types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,WAAW,GAAG,MAAM,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,mBAAmB,CAAA;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,kBAAkB,EAAE,IAAI,CAAC,qBAAqB,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IAChH,IAAI,EAAE,WAAW,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,kBAAkB,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAChF,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,CAAC,CAAA;IACV,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAAA;IAClC,KAAK,EAAE,mBAAmB,CAAA;CAC3B;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,QAAQ,CAAA;AAErD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,aAAa,CAAA;CACpB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Holder interface for values that can be undefined
3
+ */
4
+ export interface Holder<T = any> {
5
+ value: T;
6
+ }
7
+ /**
8
+ * Memo state for tracking file modifications
9
+ */
10
+ export interface FileMemoState {
11
+ originalContent: Holder;
12
+ modified: boolean;
13
+ }
14
+ /**
15
+ * State information for filesystem nodes
16
+ */
17
+ export interface FileSystemNodeState {
18
+ contentLoaded: boolean;
19
+ contentLoading: boolean;
20
+ contentLoadError?: {
21
+ code?: string;
22
+ message?: string;
23
+ };
24
+ memo?: FileMemoState;
25
+ contentHistory: any[];
26
+ extensionStates: Record<string, unknown>;
27
+ }
28
+ /**
29
+ * Create initial filesystem node state
30
+ */
31
+ export declare function fileSystemNodeInitialState(contentPresent?: boolean): FileSystemNodeState;
32
+ //# sourceMappingURL=fs-state.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fs-state.types.d.ts","sourceRoot":"","sources":["../../../src/fs/types/fs-state.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,MAAM,CAAC,CAAC,GAAG,GAAG;IAC7B,KAAK,EAAC,CAAC,CAAA;CACR;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,eAAe,EAAE,MAAM,CAAA;IACvB,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,OAAO,CAAA;IACtB,cAAc,EAAE,OAAO,CAAA;IACvB,gBAAgB,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACtD,IAAI,CAAC,EAAE,aAAa,CAAA;IACpB,cAAc,EAAE,GAAG,EAAE,CAAA;IACrB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACzC;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,cAAc,UAAO,GAAG,mBAAmB,CAQrF"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Create initial filesystem node state
3
+ */
4
+ export function fileSystemNodeInitialState(contentPresent = true) {
5
+ return {
6
+ contentLoaded: contentPresent,
7
+ contentLoading: false,
8
+ contentLoadError: undefined,
9
+ contentHistory: [],
10
+ extensionStates: {}
11
+ };
12
+ }
package/dist/index.d.ts CHANGED
@@ -5,4 +5,5 @@
5
5
  export * from './types';
6
6
  export * from './api';
7
7
  export * from './tokens';
8
+ export * from './fs';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,MAAM,CAAC"}
package/dist/index.js CHANGED
@@ -5,3 +5,4 @@
5
5
  export * from './types';
6
6
  export * from './api';
7
7
  export * from './tokens';
8
+ export * from './fs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hamak/ui-store-api",
3
- "version": "0.2.6",
3
+ "version": "0.4.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "UI Store API - Redux store interfaces and contracts",
@@ -34,6 +34,7 @@
34
34
  }
35
35
  },
36
36
  "dependencies": {
37
+ "@hamak/navigation-utils": "0.4.0",
37
38
  "redux": "^5.0.1"
38
39
  },
39
40
  "devDependencies": {
package/project.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@hamak/ui-store-api",
3
+ "$schema": "../../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "packages/ui-store/ui-store-api/src",
5
+ "projectType": "library",
6
+ "targets": {
7
+ "build": {
8
+ "executor": "nx:run-commands",
9
+ "outputs": ["{projectRoot}/dist"],
10
+ "options": {
11
+ "command": "tsc -p tsconfig.json && tsc -p tsconfig.es2015.json",
12
+ "cwd": "{projectRoot}"
13
+ }
14
+ },
15
+ "clean": {
16
+ "executor": "nx:run-commands",
17
+ "options": {
18
+ "command": "rm -rf dist",
19
+ "cwd": "{projectRoot}"
20
+ }
21
+ }
22
+ },
23
+ "tags": ["type:library", "scope:ui-store"]
24
+ }
@@ -0,0 +1,68 @@
1
+ import { FileSystemNode, DirectoryNode, FileNode } from '../types/fs-node.types';
2
+ import { Path } from '@hamak/navigation-utils';
3
+
4
+ /**
5
+ * High-level facade for filesystem operations
6
+ * Provides a convenient API over the filesystem manager
7
+ */
8
+ export interface IFileSystemFacade {
9
+ /**
10
+ * Get the root directory node
11
+ */
12
+ getRoot(): DirectoryNode;
13
+
14
+ /**
15
+ * Resolve a file or directory at the given path
16
+ */
17
+ resolve(path: Path): FileSystemNode | undefined;
18
+
19
+ /**
20
+ * Resolve a file at the given path
21
+ */
22
+ resolveFile<T = any>(path: Path): FileNode<T> | undefined;
23
+
24
+ /**
25
+ * Resolve a directory at the given path
26
+ */
27
+ resolveDirectory(path: Path): DirectoryNode | undefined;
28
+
29
+ /**
30
+ * Create or update a file at the given path
31
+ */
32
+ setFile<T = any>(
33
+ path: Path,
34
+ content: T,
35
+ schema?: string,
36
+ params?: { override?: boolean; contentIsPresent?: boolean }
37
+ ): void;
38
+
39
+ /**
40
+ * Update file content at the given path
41
+ */
42
+ updateFileContent<T = any>(path: Path, content: T): void;
43
+
44
+ /**
45
+ * Create a directory at the given path
46
+ */
47
+ mkdir(path: Path, params?: { override?: boolean }): void;
48
+
49
+ /**
50
+ * Remove a file or directory at the given path
51
+ */
52
+ remove(path: Path): void;
53
+
54
+ /**
55
+ * Check if a path exists
56
+ */
57
+ exists(path: Path): boolean;
58
+
59
+ /**
60
+ * Check if a path is a file
61
+ */
62
+ isFile(path: Path): boolean;
63
+
64
+ /**
65
+ * Check if a path is a directory
66
+ */
67
+ isDirectory(path: Path): boolean;
68
+ }
@@ -0,0 +1,51 @@
1
+ import { FileSystemNode, DirectoryNode, FileNode, FileSystemState } from '../types/fs-node.types';
2
+ import { Path } from '@hamak/navigation-utils';
3
+ import { Action } from 'redux';
4
+
5
+ /**
6
+ * Redux selector function type
7
+ */
8
+ export type Selector<S, R> = (state: S) => R;
9
+
10
+ /**
11
+ * Actions for filesystem operations
12
+ */
13
+ export interface FileSystemNodeAction extends Action {
14
+ command: any // Will be typed more specifically in implementation
15
+ }
16
+
17
+ /**
18
+ * Parameters for filesystem node actions
19
+ */
20
+ export interface FileSystemNodeActionParams {
21
+ override?: boolean
22
+ contentIsPresent?: boolean
23
+ }
24
+
25
+ /**
26
+ * Filesystem manager interface - manages Redux state for virtual filesystem
27
+ */
28
+ export interface IFileSystemManager {
29
+ /**
30
+ * Get the slice name for this filesystem
31
+ */
32
+ readonly sliceName: string;
33
+
34
+ /**
35
+ * Get initial filesystem state
36
+ */
37
+ getInitialState(): FileSystemState;
38
+
39
+ /**
40
+ * Get the reducer function for filesystem operations
41
+ */
42
+ getReducer(): (state: FileSystemState, action: Action) => FileSystemState;
43
+
44
+ /**
45
+ * Create a selector for a specific path in the filesystem
46
+ */
47
+ createSelector<S>(
48
+ fileSystemSelector: Selector<S, FileSystemState | undefined>,
49
+ path: string | string[]
50
+ ): Selector<S, FileSystemNode | undefined>;
51
+ }
@@ -0,0 +1,10 @@
1
+ // Filesystem types
2
+ export * from './types/fs-node.types';
3
+ export * from './types/fs-state.types';
4
+
5
+ // Filesystem contracts
6
+ export * from './contracts/filesystem-manager.contract';
7
+ export * from './contracts/filesystem-facade.contract';
8
+
9
+ // Re-export from navigation-utils for convenience
10
+ export type { FileContentSchema } from '@hamak/navigation-utils';
@@ -0,0 +1,45 @@
1
+ import {
2
+ AbstractFileNode,
3
+ AbstractDirectoryNode,
4
+ FileContentSchema
5
+ } from '@hamak/navigation-utils';
6
+ import { FileSystemNodeState } from './fs-state.types';
7
+
8
+ /**
9
+ * Base interface for filesystem nodes with state
10
+ */
11
+ export interface FileSystemNodeBase {
12
+ type: 'directory' | 'file'
13
+ name: string
14
+ state: FileSystemNodeState
15
+ }
16
+
17
+ /**
18
+ * Directory node with state management
19
+ */
20
+ export interface DirectoryNode extends FileSystemNodeBase, Omit<AbstractDirectoryNode<FileSystemNode>, 'children'> {
21
+ type: 'directory'
22
+ children: Record<string, FileSystemNode>
23
+ }
24
+
25
+ /**
26
+ * File node with state management
27
+ */
28
+ export interface FileNode<T = any> extends FileSystemNodeBase, AbstractFileNode<T> {
29
+ type: 'file'
30
+ content: T
31
+ schema: string | FileContentSchema
32
+ state: FileSystemNodeState
33
+ }
34
+
35
+ /**
36
+ * Union type for filesystem nodes
37
+ */
38
+ export type FileSystemNode = DirectoryNode | FileNode
39
+
40
+ /**
41
+ * Root filesystem state
42
+ */
43
+ export interface FileSystemState {
44
+ root: DirectoryNode
45
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Holder interface for values that can be undefined
3
+ */
4
+ export interface Holder<T = any>{
5
+ value:T
6
+ }
7
+
8
+ /**
9
+ * Memo state for tracking file modifications
10
+ */
11
+ export interface FileMemoState {
12
+ originalContent: Holder
13
+ modified: boolean // tell whether the current file content is modified compared to original
14
+ }
15
+
16
+ /**
17
+ * State information for filesystem nodes
18
+ */
19
+ export interface FileSystemNodeState {
20
+ contentLoaded: boolean
21
+ contentLoading: boolean
22
+ contentLoadError?: { code?: string, message?: string }
23
+ memo?: FileMemoState
24
+ contentHistory: any[]
25
+ extensionStates: Record<string, unknown>
26
+ }
27
+
28
+ /**
29
+ * Create initial filesystem node state
30
+ */
31
+ export function fileSystemNodeInitialState(contentPresent = true): FileSystemNodeState {
32
+ return {
33
+ contentLoaded: contentPresent,
34
+ contentLoading: false,
35
+ contentLoadError: undefined,
36
+ contentHistory: [],
37
+ extensionStates: {}
38
+ }
39
+ }
package/src/index.ts CHANGED
@@ -6,3 +6,4 @@
6
6
  export * from './types';
7
7
  export * from './api';
8
8
  export * from './tokens';
9
+ export * from './fs';