@hamak/ui-store-spi 0.4.19 → 0.5.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.
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Autosave Provider Interface
3
+ *
4
+ * Each filesystem plugin (remote-fs, remote-resource, git) implements this interface
5
+ * to handle actual save operations. The core autosave middleware handles debouncing
6
+ * and orchestration, then delegates to the appropriate provider for execution.
7
+ */
8
+ import type { FileSystemNode } from '@hamak/shared-utils';
9
+ import type { Dispatch, AnyAction } from 'redux';
10
+ /**
11
+ * Result of a save operation
12
+ */
13
+ export interface AutosaveResult {
14
+ /** Whether the save succeeded */
15
+ success: boolean;
16
+ /** Error information if failed */
17
+ error?: {
18
+ code: string;
19
+ message: string;
20
+ };
21
+ /** Timestamp of the save */
22
+ timestamp?: number;
23
+ /** Additional metadata from the save operation */
24
+ metadata?: Record<string, unknown>;
25
+ }
26
+ /**
27
+ * Autosave provider interface
28
+ *
29
+ * Implement this interface to add autosave support for a filesystem plugin.
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * class RemoteFsAutosaveProvider implements IAutosaveProvider {
34
+ * readonly id = 'remote-fs';
35
+ * readonly priority = 10;
36
+ *
37
+ * supports(path: string[], node: FileSystemNode): boolean {
38
+ * return node.state?.extensionStates?.['remoteFs'] !== undefined;
39
+ * }
40
+ *
41
+ * async save(path, content, node, dispatch): Promise<AutosaveResult> {
42
+ * dispatch(rfsActions.ofPutRequest(path, content));
43
+ * return { success: true, timestamp: Date.now() };
44
+ * }
45
+ * }
46
+ * ```
47
+ */
48
+ export interface IAutosaveProvider {
49
+ /**
50
+ * Unique provider identifier
51
+ * Examples: 'remote-fs', 'remote-resource', 'git'
52
+ */
53
+ readonly id: string;
54
+ /**
55
+ * Priority for provider selection when multiple providers support a path.
56
+ * Higher priority = preferred. Default: 0
57
+ */
58
+ readonly priority?: number;
59
+ /**
60
+ * Check if this provider can handle autosave for a given path.
61
+ *
62
+ * Provider should check if the node has the required extension state.
63
+ * For example, remote-fs checks for 'remoteFs' extension state,
64
+ * remote-resource checks for 'ui-remote-resource' extension state.
65
+ *
66
+ * @param path - File path segments
67
+ * @param node - The filesystem node
68
+ * @returns true if this provider can handle the path
69
+ */
70
+ supports(path: string[], node: FileSystemNode): boolean;
71
+ /**
72
+ * Execute the save operation.
73
+ *
74
+ * Provider should dispatch its own save actions (e.g., PUT_REQUEST, UPDATE_ENTITY)
75
+ * and return the result. The autosave middleware will track the save status.
76
+ *
77
+ * @param path - File path segments
78
+ * @param content - File content to save
79
+ * @param node - The filesystem node
80
+ * @param dispatch - Redux dispatch function
81
+ * @returns Promise resolving to the save result
82
+ */
83
+ save(path: string[], content: unknown, node: FileSystemNode, dispatch: Dispatch<AnyAction>): Promise<AutosaveResult>;
84
+ /**
85
+ * Cancel any in-progress save for a path (optional).
86
+ *
87
+ * @param path - File path segments
88
+ */
89
+ cancel?(path: string[]): void;
90
+ /**
91
+ * Clean up resources for a path (optional).
92
+ * Called when autosave is disabled or node is removed.
93
+ *
94
+ * @param path - File path segments
95
+ */
96
+ cleanup?(path: string[]): void;
97
+ }
98
+ //# sourceMappingURL=i-autosave-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i-autosave-provider.d.ts","sourceRoot":"","sources":["../../src/autosave/i-autosave-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,iCAAiC;IACjC,OAAO,EAAE,OAAO,CAAC;IAEjB,kCAAkC;IAClC,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IAEF,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC;IAExD;;;;;;;;;;;OAWG;IACH,IAAI,CACF,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,QAAQ,CAAC,SAAS,CAAC,GAC5B,OAAO,CAAC,cAAc,CAAC,CAAC;IAE3B;;;;OAIG;IACH,MAAM,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAE9B;;;;;OAKG;IACH,OAAO,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;CAChC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Autosave Provider Interface
3
+ *
4
+ * Each filesystem plugin (remote-fs, remote-resource, git) implements this interface
5
+ * to handle actual save operations. The core autosave middleware handles debouncing
6
+ * and orchestration, then delegates to the appropriate provider for execution.
7
+ */
8
+ export {};
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Autosave Provider Registry Interface
3
+ *
4
+ * Registry for managing autosave providers. Plugins register their providers
5
+ * during activation, and the autosave middleware uses the registry to find
6
+ * the appropriate provider for each file.
7
+ */
8
+ import type { FileSystemNode } from '@hamak/shared-utils';
9
+ import type { IAutosaveProvider } from './i-autosave-provider';
10
+ /**
11
+ * Registry for autosave providers
12
+ */
13
+ export interface IAutosaveProviderRegistry {
14
+ /**
15
+ * Register an autosave provider
16
+ *
17
+ * @param provider - The provider to register
18
+ * @throws Error if a provider with the same ID is already registered
19
+ */
20
+ register(provider: IAutosaveProvider): void;
21
+ /**
22
+ * Unregister an autosave provider
23
+ *
24
+ * @param providerId - The ID of the provider to unregister
25
+ */
26
+ unregister(providerId: string): void;
27
+ /**
28
+ * Get a provider by ID
29
+ *
30
+ * @param providerId - The provider ID
31
+ * @returns The provider or undefined if not found
32
+ */
33
+ get(providerId: string): IAutosaveProvider | undefined;
34
+ /**
35
+ * Find the best provider for a path
36
+ *
37
+ * Checks all registered providers and returns the one with the highest
38
+ * priority that supports the given path.
39
+ *
40
+ * @param path - File path segments
41
+ * @param node - The filesystem node
42
+ * @returns The best matching provider or undefined if none found
43
+ */
44
+ findProvider(path: string[], node: FileSystemNode): IAutosaveProvider | undefined;
45
+ /**
46
+ * Get all registered providers
47
+ *
48
+ * @returns Array of all registered providers
49
+ */
50
+ getAll(): IAutosaveProvider[];
51
+ /**
52
+ * Check if a provider is registered
53
+ *
54
+ * @param providerId - The provider ID
55
+ * @returns true if the provider is registered
56
+ */
57
+ has(providerId: string): boolean;
58
+ }
59
+ //# sourceMappingURL=i-autosave-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i-autosave-registry.d.ts","sourceRoot":"","sources":["../../src/autosave/i-autosave-registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAE5C;;;;OAIG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAErC;;;;;OAKG;IACH,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAAC;IAEvD;;;;;;;;;OASG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,cAAc,GAAG,iBAAiB,GAAG,SAAS,CAAC;IAElF;;;;OAIG;IACH,MAAM,IAAI,iBAAiB,EAAE,CAAC;IAE9B;;;;;OAKG;IACH,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;CAClC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Autosave Provider Registry Interface
3
+ *
4
+ * Registry for managing autosave providers. Plugins register their providers
5
+ * during activation, and the autosave middleware uses the registry to find
6
+ * the appropriate provider for each file.
7
+ */
8
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Autosave SPI
3
+ *
4
+ * Service Provider Interfaces for autosave functionality.
5
+ */
6
+ export * from './i-autosave-provider';
7
+ export * from './i-autosave-registry';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/autosave/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Autosave SPI
3
+ *
4
+ * Service Provider Interfaces for autosave functionality.
5
+ */
6
+ export * from './i-autosave-provider';
7
+ export * from './i-autosave-registry';
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Autosave Provider Interface
3
+ *
4
+ * Each filesystem plugin (remote-fs, remote-resource, git) implements this interface
5
+ * to handle actual save operations. The core autosave middleware handles debouncing
6
+ * and orchestration, then delegates to the appropriate provider for execution.
7
+ */
8
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Autosave Provider Registry Interface
3
+ *
4
+ * Registry for managing autosave providers. Plugins register their providers
5
+ * during activation, and the autosave middleware uses the registry to find
6
+ * the appropriate provider for each file.
7
+ */
8
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Autosave SPI
3
+ *
4
+ * Service Provider Interfaces for autosave functionality.
5
+ */
6
+ export * from './i-autosave-provider';
7
+ export * from './i-autosave-registry';
@@ -1,2 +1,5 @@
1
- export * from './middleware';
2
- export * from './persistence';
1
+ /**
2
+ * @deprecated This package is deprecated. Please migrate to @hamak/ui-store/spi
3
+ */
4
+ console.warn('[@hamak/ui-store-spi] This package is deprecated. Please migrate to @hamak/ui-store/spi');
5
+ export * from '@hamak/ui-store/spi';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
- export * from './middleware';
2
- export * from './persistence';
1
+ /**
2
+ * @deprecated This package is deprecated. Please migrate to @hamak/ui-store/spi
3
+ */
4
+ export * from '@hamak/ui-store/spi';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,cAAc,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,5 @@
1
- export * from './middleware';
2
- export * from './persistence';
1
+ /**
2
+ * @deprecated This package is deprecated. Please migrate to @hamak/ui-store/spi
3
+ */
4
+ console.warn('[@hamak/ui-store-spi] This package is deprecated. Please migrate to @hamak/ui-store/spi');
5
+ export * from '@hamak/ui-store/spi';
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@hamak/ui-store-spi",
3
- "version": "0.4.19",
3
+ "version": "0.5.1",
4
4
  "private": false,
5
5
  "type": "module",
6
- "description": "UI Store SPI - Service Provider Interfaces for Redux store",
6
+ "description": "DEPRECATED: Use @hamak/ui-store/spi instead",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
9
  "sideEffects": false,
@@ -18,28 +18,20 @@
18
18
  "publishConfig": {
19
19
  "access": "public"
20
20
  },
21
+ "deprecated": "Use @hamak/ui-store/spi instead",
21
22
  "scripts": {
22
- "build": "tsc -p tsconfig.json && tsc -p tsconfig.es2015.json",
23
+ "build": "tsc -p tsconfig.json",
23
24
  "clean": "rm -rf dist"
24
25
  },
25
26
  "exports": {
26
27
  ".": {
27
28
  "types": "./dist/index.d.ts",
28
29
  "import": "./dist/index.js",
29
- "default": "./dist/index.js",
30
- "legacy": "./dist/es2015/index.js"
31
- },
32
- "./es2015": {
33
- "import": "./dist/es2015/index.js",
34
- "default": "./dist/es2015/index.js"
30
+ "default": "./dist/index.js"
35
31
  }
36
32
  },
37
33
  "dependencies": {
38
- "@hamak/ui-store-api": "*",
39
- "redux": "^5.0.1"
40
- },
41
- "peerDependencies": {
42
- "redux": "^5.0.1"
34
+ "@hamak/ui-store": "*"
43
35
  },
44
36
  "devDependencies": {
45
37
  "typescript": "~5.4.0"