@hamak/ui-store-impl 0.11.0 → 0.12.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.
- package/package.json +2 -2
- package/dist/autosave/autosave-config-resolver.d.ts +0 -45
- package/dist/autosave/autosave-config-resolver.d.ts.map +0 -1
- package/dist/autosave/autosave-config-resolver.js +0 -107
- package/dist/autosave/autosave-middleware.d.ts +0 -37
- package/dist/autosave/autosave-middleware.d.ts.map +0 -1
- package/dist/autosave/autosave-middleware.js +0 -297
- package/dist/autosave/autosave-registry.d.ts +0 -15
- package/dist/autosave/autosave-registry.d.ts.map +0 -1
- package/dist/autosave/autosave-registry.js +0 -33
- package/dist/autosave/autosave-sync-middleware.d.ts +0 -24
- package/dist/autosave/autosave-sync-middleware.d.ts.map +0 -1
- package/dist/autosave/autosave-sync-middleware.js +0 -98
- package/dist/autosave/index.d.ts +0 -8
- package/dist/autosave/index.d.ts.map +0 -1
- package/dist/autosave/index.js +0 -7
- package/dist/core/index.d.ts +0 -4
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -3
- package/dist/core/middleware-registry.d.ts +0 -21
- package/dist/core/middleware-registry.d.ts.map +0 -1
- package/dist/core/middleware-registry.js +0 -50
- package/dist/core/reducer-registry.d.ts +0 -18
- package/dist/core/reducer-registry.d.ts.map +0 -1
- package/dist/core/reducer-registry.js +0 -54
- package/dist/core/store-manager.d.ts +0 -29
- package/dist/core/store-manager.d.ts.map +0 -1
- package/dist/core/store-manager.js +0 -104
- package/dist/es2015/autosave/autosave-config-resolver.js +0 -110
- package/dist/es2015/autosave/autosave-middleware.js +0 -311
- package/dist/es2015/autosave/autosave-registry.js +0 -33
- package/dist/es2015/autosave/autosave-sync-middleware.js +0 -98
- package/dist/es2015/autosave/index.js +0 -7
- package/dist/es2015/core/index.js +0 -3
- package/dist/es2015/core/middleware-registry.js +0 -47
- package/dist/es2015/core/reducer-registry.js +0 -54
- package/dist/es2015/core/store-manager.js +0 -104
- package/dist/es2015/extensions/store-extensions.js +0 -61
- package/dist/es2015/fs/commands/fs-commands.js +0 -327
- package/dist/es2015/fs/commands/structure-commands.js +0 -21
- package/dist/es2015/fs/core/fs-adapter.js +0 -134
- package/dist/es2015/fs/core/fs-facade.js +0 -78
- package/dist/es2015/fs/index.js +0 -11
- package/dist/es2015/fs/utils/data-updater.js +0 -251
- package/dist/es2015/fs/utils/deep-equal.js +0 -28
- package/dist/es2015/middleware/event-bridge-middleware.js +0 -19
- package/dist/es2015/middleware/index.js +0 -5
- package/dist/es2015/middleware/logger-middleware.js +0 -18
- package/dist/es2015/plugin/index.js +0 -4
- package/dist/es2015/plugin/store-plugin-factory.js +0 -137
- package/dist/extensions/store-extensions.d.ts +0 -23
- package/dist/extensions/store-extensions.d.ts.map +0 -1
- package/dist/extensions/store-extensions.js +0 -61
- package/dist/fs/commands/fs-commands.d.ts +0 -100
- package/dist/fs/commands/fs-commands.d.ts.map +0 -1
- package/dist/fs/commands/fs-commands.js +0 -330
- package/dist/fs/commands/structure-commands.d.ts +0 -76
- package/dist/fs/commands/structure-commands.d.ts.map +0 -1
- package/dist/fs/commands/structure-commands.js +0 -21
- package/dist/fs/core/fs-adapter.d.ts +0 -60
- package/dist/fs/core/fs-adapter.d.ts.map +0 -1
- package/dist/fs/core/fs-adapter.js +0 -134
- package/dist/fs/core/fs-facade.d.ts +0 -37
- package/dist/fs/core/fs-facade.d.ts.map +0 -1
- package/dist/fs/core/fs-facade.js +0 -78
- package/dist/fs/index.d.ts +0 -8
- package/dist/fs/index.d.ts.map +0 -1
- package/dist/fs/index.js +0 -11
- package/dist/fs/utils/data-updater.d.ts +0 -43
- package/dist/fs/utils/data-updater.d.ts.map +0 -1
- package/dist/fs/utils/data-updater.js +0 -255
- package/dist/fs/utils/deep-equal.d.ts +0 -5
- package/dist/fs/utils/deep-equal.d.ts.map +0 -1
- package/dist/fs/utils/deep-equal.js +0 -28
- package/dist/middleware/event-bridge-middleware.d.ts +0 -7
- package/dist/middleware/event-bridge-middleware.d.ts.map +0 -1
- package/dist/middleware/event-bridge-middleware.js +0 -19
- package/dist/middleware/index.d.ts +0 -6
- package/dist/middleware/index.d.ts.map +0 -1
- package/dist/middleware/index.js +0 -5
- package/dist/middleware/logger-middleware.d.ts +0 -7
- package/dist/middleware/logger-middleware.d.ts.map +0 -1
- package/dist/middleware/logger-middleware.js +0 -18
- package/dist/plugin/index.d.ts +0 -5
- package/dist/plugin/index.d.ts.map +0 -1
- package/dist/plugin/index.js +0 -4
- package/dist/plugin/store-plugin-factory.d.ts +0 -15
- package/dist/plugin/store-plugin-factory.d.ts.map +0 -1
- package/dist/plugin/store-plugin-factory.js +0 -121
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Autosave Sync Middleware
|
|
3
|
-
*
|
|
4
|
-
* Updates FileSystemNode extension states based on autosave lifecycle actions.
|
|
5
|
-
* This middleware runs after the main autosave middleware and updates the
|
|
6
|
-
* state so components can display autosave status.
|
|
7
|
-
*/
|
|
8
|
-
import { AutosaveActionTypes, autosaveActions, } from '@hamak/ui-store-api';
|
|
9
|
-
/**
|
|
10
|
-
* Create autosave sync middleware
|
|
11
|
-
*/
|
|
12
|
-
export function createAutosaveSyncMiddleware(config) {
|
|
13
|
-
const { updateExtensionState } = config;
|
|
14
|
-
const autosaveSyncMiddleware = (store) => (next) => (action) => {
|
|
15
|
-
const result = next(action);
|
|
16
|
-
const typedAction = action;
|
|
17
|
-
// Only process autosave actions
|
|
18
|
-
if (!autosaveActions.isAutosaveAction(typedAction)) {
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
const dispatch = store.dispatch;
|
|
22
|
-
switch (typedAction.type) {
|
|
23
|
-
case AutosaveActionTypes.SET_CONFIG: {
|
|
24
|
-
const { path, config: autosaveConfig } = typedAction.payload;
|
|
25
|
-
dispatch(updateExtensionState(path, {
|
|
26
|
-
config: autosaveConfig,
|
|
27
|
-
effectivelyEnabled: autosaveConfig.enabled,
|
|
28
|
-
status: autosaveConfig.enabled ? 'idle' : 'disabled',
|
|
29
|
-
}));
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
case AutosaveActionTypes.CLEAR_CONFIG: {
|
|
33
|
-
const { path } = typedAction.payload;
|
|
34
|
-
dispatch(updateExtensionState(path, {
|
|
35
|
-
config: undefined,
|
|
36
|
-
// Status will be recomputed based on parent config
|
|
37
|
-
}));
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
case AutosaveActionTypes.CHANGE_DETECTED: {
|
|
41
|
-
const { path, detectedAt, providerId } = typedAction.payload;
|
|
42
|
-
dispatch(updateExtensionState(path, {
|
|
43
|
-
status: 'pending',
|
|
44
|
-
pendingSince: detectedAt,
|
|
45
|
-
providerId,
|
|
46
|
-
}));
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
case AutosaveActionTypes.SAVE_STARTED: {
|
|
50
|
-
const { path, providerId } = typedAction.payload;
|
|
51
|
-
dispatch(updateExtensionState(path, {
|
|
52
|
-
status: 'saving',
|
|
53
|
-
lastSaveAttempt: Date.now(),
|
|
54
|
-
providerId,
|
|
55
|
-
}));
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
case AutosaveActionTypes.SAVE_SUCCEEDED: {
|
|
59
|
-
const { path, timestamp } = typedAction.payload;
|
|
60
|
-
dispatch(updateExtensionState(path, {
|
|
61
|
-
status: 'idle',
|
|
62
|
-
lastSaveSuccess: timestamp,
|
|
63
|
-
lastSaveError: undefined,
|
|
64
|
-
retryCount: 0,
|
|
65
|
-
pendingSince: undefined,
|
|
66
|
-
}));
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
case AutosaveActionTypes.SAVE_FAILED: {
|
|
70
|
-
const { path, error } = typedAction.payload;
|
|
71
|
-
dispatch(updateExtensionState(path, {
|
|
72
|
-
status: 'error',
|
|
73
|
-
lastSaveError: error,
|
|
74
|
-
retryCount: error.attempt,
|
|
75
|
-
}));
|
|
76
|
-
break;
|
|
77
|
-
}
|
|
78
|
-
case AutosaveActionTypes.RETRY_SCHEDULED: {
|
|
79
|
-
const { path, attempt } = typedAction.payload;
|
|
80
|
-
dispatch(updateExtensionState(path, {
|
|
81
|
-
status: 'pending',
|
|
82
|
-
retryCount: attempt,
|
|
83
|
-
}));
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
case AutosaveActionTypes.CANCEL_PENDING: {
|
|
87
|
-
const { path } = typedAction.payload;
|
|
88
|
-
dispatch(updateExtensionState(path, {
|
|
89
|
-
status: 'idle',
|
|
90
|
-
pendingSince: undefined,
|
|
91
|
-
}));
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return result;
|
|
96
|
-
};
|
|
97
|
-
return autosaveSyncMiddleware;
|
|
98
|
-
}
|
package/dist/autosave/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/autosave/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC"}
|
package/dist/autosave/index.js
DELETED
package/dist/core/index.d.ts
DELETED
package/dist/core/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC"}
|
package/dist/core/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Middleware Registry Implementation
|
|
3
|
-
*/
|
|
4
|
-
import type { Middleware } from 'redux';
|
|
5
|
-
import type { IMiddlewareRegistry, MiddlewareRegistration } from '@hamak/ui-store-api';
|
|
6
|
-
export declare class MiddlewareRegistry implements IMiddlewareRegistry {
|
|
7
|
-
private registrations;
|
|
8
|
-
private locked;
|
|
9
|
-
register(registration: MiddlewareRegistration): void;
|
|
10
|
-
unregister(id: string): void;
|
|
11
|
-
getAll(): Middleware[];
|
|
12
|
-
has(id: string): boolean;
|
|
13
|
-
getInfo(id: string): MiddlewareRegistration | undefined;
|
|
14
|
-
getAllRegistrations(): MiddlewareRegistration[];
|
|
15
|
-
/**
|
|
16
|
-
* Lock the registry (called when store is created)
|
|
17
|
-
* @internal
|
|
18
|
-
*/
|
|
19
|
-
lock(): void;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=middleware-registry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"middleware-registry.d.ts","sourceRoot":"","sources":["../../src/core/middleware-registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAEvF,qBAAa,kBAAmB,YAAW,mBAAmB;IAC5D,OAAO,CAAC,aAAa,CAA6C;IAClE,OAAO,CAAC,MAAM,CAAS;IAEvB,QAAQ,CAAC,YAAY,EAAE,sBAAsB,GAAG,IAAI;IAkBpD,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAO5B,MAAM,IAAI,UAAU,EAAE;IAOtB,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIxB,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,sBAAsB,GAAG,SAAS;IAIvD,mBAAmB,IAAI,sBAAsB,EAAE;IAK/C;;;OAGG;IACH,IAAI,IAAI,IAAI;CAGb"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Middleware Registry Implementation
|
|
3
|
-
*/
|
|
4
|
-
export class MiddlewareRegistry {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.registrations = new Map();
|
|
7
|
-
this.locked = false;
|
|
8
|
-
}
|
|
9
|
-
register(registration) {
|
|
10
|
-
if (this.locked) {
|
|
11
|
-
throw new Error(`Cannot register middleware "${registration.id}" - store already created. ` +
|
|
12
|
-
`Register middleware during plugin initialization phase.`);
|
|
13
|
-
}
|
|
14
|
-
if (this.registrations.has(registration.id)) {
|
|
15
|
-
console.warn(`[MiddlewareRegistry] Middleware "${registration.id}" already registered, overwriting.`);
|
|
16
|
-
}
|
|
17
|
-
this.registrations.set(registration.id, {
|
|
18
|
-
priority: 0,
|
|
19
|
-
...registration,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
unregister(id) {
|
|
23
|
-
if (this.locked) {
|
|
24
|
-
throw new Error(`Cannot unregister middleware after store creation`);
|
|
25
|
-
}
|
|
26
|
-
this.registrations.delete(id);
|
|
27
|
-
}
|
|
28
|
-
getAll() {
|
|
29
|
-
const sorted = Array.from(this.registrations.values())
|
|
30
|
-
.sort((a, b) => (b.priority || 0) - (a.priority || 0));
|
|
31
|
-
return sorted.map(reg => reg.middleware);
|
|
32
|
-
}
|
|
33
|
-
has(id) {
|
|
34
|
-
return this.registrations.has(id);
|
|
35
|
-
}
|
|
36
|
-
getInfo(id) {
|
|
37
|
-
return this.registrations.get(id);
|
|
38
|
-
}
|
|
39
|
-
getAllRegistrations() {
|
|
40
|
-
return Array.from(this.registrations.values())
|
|
41
|
-
.sort((a, b) => (b.priority || 0) - (a.priority || 0));
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Lock the registry (called when store is created)
|
|
45
|
-
* @internal
|
|
46
|
-
*/
|
|
47
|
-
lock() {
|
|
48
|
-
this.locked = true;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reducer Registry Implementation
|
|
3
|
-
*/
|
|
4
|
-
import { type Reducer } from 'redux';
|
|
5
|
-
import type { IReducerRegistry, ReducerMap, ReducerRegistration } from '@hamak/ui-store-api';
|
|
6
|
-
export declare class ReducerRegistry implements IReducerRegistry {
|
|
7
|
-
private reducers;
|
|
8
|
-
private onReducerChange?;
|
|
9
|
-
constructor(onReducerChange?: (rootReducer: Reducer) => void);
|
|
10
|
-
register(key: string, reducer: Reducer, replace?: boolean): void;
|
|
11
|
-
unregister(key: string): void;
|
|
12
|
-
getAll(): ReducerMap;
|
|
13
|
-
getCombinedReducer(): Reducer;
|
|
14
|
-
has(key: string): boolean;
|
|
15
|
-
getInfo(key: string): ReducerRegistration | undefined;
|
|
16
|
-
getAllRegistrations(): ReducerRegistration[];
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=reducer-registry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reducer-registry.d.ts","sourceRoot":"","sources":["../../src/core/reducer-registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAmB,KAAK,OAAO,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE7F,qBAAa,eAAgB,YAAW,gBAAgB;IACtD,OAAO,CAAC,QAAQ,CAA0C;IAC1D,OAAO,CAAC,eAAe,CAAC,CAAiC;gBAE7C,eAAe,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,IAAI;IAI5D,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,UAAQ,GAAG,IAAI;IAkB9D,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAQ7B,MAAM,IAAI,UAAU;IAQpB,kBAAkB,IAAI,OAAO;IAU7B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS;IAIrD,mBAAmB,IAAI,mBAAmB,EAAE;CAG7C"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reducer Registry Implementation
|
|
3
|
-
*/
|
|
4
|
-
import { combineReducers } from 'redux';
|
|
5
|
-
export class ReducerRegistry {
|
|
6
|
-
constructor(onReducerChange) {
|
|
7
|
-
this.reducers = new Map();
|
|
8
|
-
this.onReducerChange = onReducerChange;
|
|
9
|
-
}
|
|
10
|
-
register(key, reducer, replace = false) {
|
|
11
|
-
if (!replace && this.reducers.has(key)) {
|
|
12
|
-
console.warn(`[ReducerRegistry] Reducer "${key}" already registered. Use replace=true to override.`);
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
this.reducers.set(key, {
|
|
16
|
-
key,
|
|
17
|
-
reducer,
|
|
18
|
-
registeredAt: new Date(),
|
|
19
|
-
});
|
|
20
|
-
// Notify about reducer change for hot replacement
|
|
21
|
-
if (this.onReducerChange) {
|
|
22
|
-
this.onReducerChange(this.getCombinedReducer());
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
unregister(key) {
|
|
26
|
-
this.reducers.delete(key);
|
|
27
|
-
if (this.onReducerChange) {
|
|
28
|
-
this.onReducerChange(this.getCombinedReducer());
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
getAll() {
|
|
32
|
-
const map = {};
|
|
33
|
-
this.reducers.forEach((registration, key) => {
|
|
34
|
-
map[key] = registration.reducer;
|
|
35
|
-
});
|
|
36
|
-
return map;
|
|
37
|
-
}
|
|
38
|
-
getCombinedReducer() {
|
|
39
|
-
const reducerMap = this.getAll();
|
|
40
|
-
if (Object.keys(reducerMap).length === 0) {
|
|
41
|
-
return (state = {}) => state;
|
|
42
|
-
}
|
|
43
|
-
return combineReducers(reducerMap);
|
|
44
|
-
}
|
|
45
|
-
has(key) {
|
|
46
|
-
return this.reducers.has(key);
|
|
47
|
-
}
|
|
48
|
-
getInfo(key) {
|
|
49
|
-
return this.reducers.get(key);
|
|
50
|
-
}
|
|
51
|
-
getAllRegistrations() {
|
|
52
|
-
return Array.from(this.reducers.values());
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Store Manager Implementation
|
|
3
|
-
*/
|
|
4
|
-
import { type Store, type Reducer } from '@reduxjs/toolkit';
|
|
5
|
-
import type { IStoreManager, StoreConfig, RootState, AppAction } from '@hamak/ui-store-api';
|
|
6
|
-
import { MiddlewareRegistry } from './middleware-registry.js';
|
|
7
|
-
import { ReducerRegistry } from './reducer-registry.js';
|
|
8
|
-
export declare class StoreManager implements IStoreManager {
|
|
9
|
-
private store;
|
|
10
|
-
private middlewareRegistry;
|
|
11
|
-
private reducerRegistry;
|
|
12
|
-
private initialized;
|
|
13
|
-
private config;
|
|
14
|
-
private fileSystemAdapter;
|
|
15
|
-
constructor();
|
|
16
|
-
getMiddlewareRegistry(): MiddlewareRegistry;
|
|
17
|
-
getReducerRegistry(): ReducerRegistry;
|
|
18
|
-
setFileSystemAdapter(adapter: any): void;
|
|
19
|
-
getFileSystemAdapter(): any;
|
|
20
|
-
isInitialized(): boolean;
|
|
21
|
-
initialize(config?: StoreConfig): Store<RootState, AppAction>;
|
|
22
|
-
getStore(): Store<RootState, AppAction>;
|
|
23
|
-
dispatch<A extends AppAction>(action: A): A;
|
|
24
|
-
getState<S = RootState>(): S;
|
|
25
|
-
subscribe(listener: () => void): () => void;
|
|
26
|
-
replaceReducer(nextReducer: Reducer<RootState, AppAction>): void;
|
|
27
|
-
destroy(): void;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=store-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store-manager.d.ts","sourceRoot":"","sources":["../../src/core/store-manager.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAkB,KAAK,KAAK,EAAE,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,qBAAa,YAAa,YAAW,aAAa;IAChD,OAAO,CAAC,KAAK,CAA4C;IACzD,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,MAAM,CAA4B;IAC1C,OAAO,CAAC,iBAAiB,CAAoB;;IAY7C,qBAAqB;IAIrB,kBAAkB;IAIlB,oBAAoB,CAAC,OAAO,EAAE,GAAG;IAIjC,oBAAoB;IAIpB,aAAa,IAAI,OAAO;IAIxB,UAAU,CAAC,MAAM,GAAE,WAAgB,GAAG,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC;IAwDjE,QAAQ,IAAI,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC;IAOvC,QAAQ,CAAC,CAAC,SAAS,SAAS,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC;IAI3C,QAAQ,CAAC,CAAC,GAAG,SAAS,KAAK,CAAC;IAI5B,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAI3C,cAAc,CAAC,WAAW,EAAE,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,GAAG,IAAI;IAIhE,OAAO,IAAI,IAAI;CAKhB"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Store Manager Implementation
|
|
3
|
-
*/
|
|
4
|
-
import { configureStore } from '@reduxjs/toolkit';
|
|
5
|
-
import { MiddlewareRegistry } from './middleware-registry.js';
|
|
6
|
-
import { ReducerRegistry } from './reducer-registry.js';
|
|
7
|
-
export class StoreManager {
|
|
8
|
-
constructor() {
|
|
9
|
-
this.store = null;
|
|
10
|
-
this.initialized = false;
|
|
11
|
-
this.config = null;
|
|
12
|
-
this.fileSystemAdapter = null;
|
|
13
|
-
this.middlewareRegistry = new MiddlewareRegistry();
|
|
14
|
-
this.reducerRegistry = new ReducerRegistry((rootReducer) => {
|
|
15
|
-
// Hot replacement callback
|
|
16
|
-
if (this.store) {
|
|
17
|
-
this.store.replaceReducer(rootReducer);
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
getMiddlewareRegistry() {
|
|
22
|
-
return this.middlewareRegistry;
|
|
23
|
-
}
|
|
24
|
-
getReducerRegistry() {
|
|
25
|
-
return this.reducerRegistry;
|
|
26
|
-
}
|
|
27
|
-
setFileSystemAdapter(adapter) {
|
|
28
|
-
this.fileSystemAdapter = adapter;
|
|
29
|
-
}
|
|
30
|
-
getFileSystemAdapter() {
|
|
31
|
-
return this.fileSystemAdapter;
|
|
32
|
-
}
|
|
33
|
-
isInitialized() {
|
|
34
|
-
return this.initialized;
|
|
35
|
-
}
|
|
36
|
-
initialize(config = {}) {
|
|
37
|
-
if (this.initialized) {
|
|
38
|
-
throw new Error('[StoreManager] Store already initialized');
|
|
39
|
-
}
|
|
40
|
-
this.config = config;
|
|
41
|
-
// Get all middleware in priority order
|
|
42
|
-
const middleware = this.middlewareRegistry.getAll();
|
|
43
|
-
// Lock the middleware registry
|
|
44
|
-
this.middlewareRegistry.lock();
|
|
45
|
-
// Get combined reducer
|
|
46
|
-
const rootReducer = this.reducerRegistry.getCombinedReducer();
|
|
47
|
-
// Create enhancers
|
|
48
|
-
const enhancers = config.enhancers || [];
|
|
49
|
-
// Create store using configureStore (modern Redux Toolkit API)
|
|
50
|
-
this.store = configureStore({
|
|
51
|
-
reducer: rootReducer,
|
|
52
|
-
preloadedState: config.preloadedState,
|
|
53
|
-
// Use only our custom middleware (disabling Redux Toolkit defaults to maintain exact behavior)
|
|
54
|
-
middleware: (getDefaultMiddleware) => getDefaultMiddleware({
|
|
55
|
-
// Disable all default middleware to maintain exact parity with old createStore behavior
|
|
56
|
-
thunk: false,
|
|
57
|
-
serializableCheck: false,
|
|
58
|
-
immutableCheck: false,
|
|
59
|
-
actionCreatorCheck: false,
|
|
60
|
-
}).concat(...middleware),
|
|
61
|
-
// Add custom enhancers if provided
|
|
62
|
-
enhancers: (getDefaultEnhancers) => getDefaultEnhancers().concat(enhancers),
|
|
63
|
-
// Configure DevTools with trace support
|
|
64
|
-
devTools: config.devTools !== false ? {
|
|
65
|
-
trace: true,
|
|
66
|
-
traceLimit: 25,
|
|
67
|
-
} : false,
|
|
68
|
-
});
|
|
69
|
-
this.initialized = true;
|
|
70
|
-
console.log('[StoreManager] Store initialized with:', {
|
|
71
|
-
reducers: this.reducerRegistry.getAllRegistrations().map(r => r.key),
|
|
72
|
-
middleware: this.middlewareRegistry.getAllRegistrations().map(m => ({
|
|
73
|
-
id: m.id,
|
|
74
|
-
priority: m.priority,
|
|
75
|
-
plugin: m.plugin,
|
|
76
|
-
})),
|
|
77
|
-
devTools: config.devTools !== false,
|
|
78
|
-
});
|
|
79
|
-
return this.store;
|
|
80
|
-
}
|
|
81
|
-
getStore() {
|
|
82
|
-
if (!this.store) {
|
|
83
|
-
throw new Error('[StoreManager] Store not initialized. Call initialize() first.');
|
|
84
|
-
}
|
|
85
|
-
return this.store;
|
|
86
|
-
}
|
|
87
|
-
dispatch(action) {
|
|
88
|
-
return this.getStore().dispatch(action);
|
|
89
|
-
}
|
|
90
|
-
getState() {
|
|
91
|
-
return this.getStore().getState();
|
|
92
|
-
}
|
|
93
|
-
subscribe(listener) {
|
|
94
|
-
return this.getStore().subscribe(listener);
|
|
95
|
-
}
|
|
96
|
-
replaceReducer(nextReducer) {
|
|
97
|
-
this.getStore().replaceReducer(nextReducer);
|
|
98
|
-
}
|
|
99
|
-
destroy() {
|
|
100
|
-
this.store = null;
|
|
101
|
-
this.initialized = false;
|
|
102
|
-
console.log('[StoreManager] Store destroyed');
|
|
103
|
-
}
|
|
104
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Autosave Configuration Resolver
|
|
3
|
-
*
|
|
4
|
-
* Resolves autosave configuration with hierarchical inheritance.
|
|
5
|
-
* Configuration priority (highest to lowest):
|
|
6
|
-
* 1. File node extension state config
|
|
7
|
-
* 2. Parent folder config (recursive, respects inherit flag)
|
|
8
|
-
* 3. Default config
|
|
9
|
-
*/
|
|
10
|
-
import { AUTOSAVE_EXTENSION_KEY, DEFAULT_AUTOSAVE_CONFIG, } from '@hamak/ui-store-api';
|
|
11
|
-
/**
|
|
12
|
-
* Get autosave extension state from a node
|
|
13
|
-
*/
|
|
14
|
-
export function getAutosaveExtensionState(node) {
|
|
15
|
-
var _a;
|
|
16
|
-
if (!((_a = node === null || node === void 0 ? void 0 : node.state) === null || _a === void 0 ? void 0 : _a.extensionStates)) {
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
return node.state.extensionStates[AUTOSAVE_EXTENSION_KEY];
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Get autosave config from a node's extension state
|
|
23
|
-
*/
|
|
24
|
-
export function getAutosaveConfig(node) {
|
|
25
|
-
var _a;
|
|
26
|
-
return (_a = getAutosaveExtensionState(node)) === null || _a === void 0 ? void 0 : _a.config;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Resolve autosave configuration for a path with inheritance
|
|
30
|
-
*
|
|
31
|
-
* @param root - Root directory node
|
|
32
|
-
* @param path - Path segments to the target node
|
|
33
|
-
* @param defaultConfig - Default configuration to use if none found
|
|
34
|
-
* @returns Resolved configuration
|
|
35
|
-
*/
|
|
36
|
-
export function resolveAutosaveConfig(root, path, defaultConfig = DEFAULT_AUTOSAVE_CONFIG) {
|
|
37
|
-
const configs = [];
|
|
38
|
-
// Walk down the path, collecting configs
|
|
39
|
-
let currentNode = root;
|
|
40
|
-
for (let i = 0; i <= path.length; i++) {
|
|
41
|
-
if (!currentNode)
|
|
42
|
-
break;
|
|
43
|
-
const config = getAutosaveConfig(currentNode);
|
|
44
|
-
if (config) {
|
|
45
|
-
configs.push(config);
|
|
46
|
-
// If inherit is false, stop here
|
|
47
|
-
if (config.inherit === false) {
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
// Move to next segment
|
|
52
|
-
if (i < path.length && currentNode.type === 'directory') {
|
|
53
|
-
currentNode = currentNode.children[path[i]];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
// Merge configs from root to target (later configs override earlier)
|
|
57
|
-
// Start with default, then apply each config in order
|
|
58
|
-
let result = Object.assign({}, defaultConfig);
|
|
59
|
-
for (const config of configs) {
|
|
60
|
-
result = mergeConfigs(result, config);
|
|
61
|
-
}
|
|
62
|
-
return result;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Merge two autosave configs (source overrides target for defined values)
|
|
66
|
-
*/
|
|
67
|
-
function mergeConfigs(target, source) {
|
|
68
|
-
var _a, _b, _c, _d, _e, _f;
|
|
69
|
-
return {
|
|
70
|
-
enabled: source.enabled,
|
|
71
|
-
debounceMs: (_a = source.debounceMs) !== null && _a !== void 0 ? _a : target.debounceMs,
|
|
72
|
-
maxWaitMs: (_b = source.maxWaitMs) !== null && _b !== void 0 ? _b : target.maxWaitMs,
|
|
73
|
-
saveOnBlur: (_c = source.saveOnBlur) !== null && _c !== void 0 ? _c : target.saveOnBlur,
|
|
74
|
-
retryOnFailure: (_d = source.retryOnFailure) !== null && _d !== void 0 ? _d : target.retryOnFailure,
|
|
75
|
-
maxRetries: (_e = source.maxRetries) !== null && _e !== void 0 ? _e : target.maxRetries,
|
|
76
|
-
inherit: (_f = source.inherit) !== null && _f !== void 0 ? _f : target.inherit,
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Check if autosave is effectively enabled for a path
|
|
81
|
-
*/
|
|
82
|
-
export function isAutosaveEnabled(root, path, defaultConfig) {
|
|
83
|
-
const config = resolveAutosaveConfig(root, path, defaultConfig);
|
|
84
|
-
return config.enabled;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Get node at path
|
|
88
|
-
*/
|
|
89
|
-
export function getNodeAtPath(root, path) {
|
|
90
|
-
let current = root;
|
|
91
|
-
for (const segment of path) {
|
|
92
|
-
if (!current || current.type !== 'directory') {
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
current = current.children[segment];
|
|
96
|
-
}
|
|
97
|
-
return current;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Convert path array to string key
|
|
101
|
-
*/
|
|
102
|
-
export function pathToKey(path) {
|
|
103
|
-
return path.join('/');
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Convert string key back to path array
|
|
107
|
-
*/
|
|
108
|
-
export function keyToPath(key) {
|
|
109
|
-
return key === '' ? [] : key.split('/');
|
|
110
|
-
}
|