@miurajs/miura-data-flow 0.0.2 → 0.1.2
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/README.md +15 -15
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/src/global-state.d.ts +79 -0
- package/dist/src/global-state.d.ts.map +1 -0
- package/dist/src/global-state.js +111 -0
- package/dist/src/global-state.js.map +1 -0
- package/dist/src/middleware.d.ts +38 -0
- package/dist/src/middleware.d.ts.map +1 -0
- package/dist/src/middleware.js +143 -0
- package/dist/src/middleware.js.map +1 -0
- package/{src/miura-data-flow.ts → dist/src/miura-data-flow.d.ts} +38 -67
- package/dist/src/miura-data-flow.d.ts.map +1 -0
- package/dist/src/miura-data-flow.js +96 -0
- package/dist/src/miura-data-flow.js.map +1 -0
- package/dist/src/providers/firebase-provider.d.ts +8 -0
- package/dist/src/providers/firebase-provider.d.ts.map +1 -0
- package/dist/src/providers/firebase-provider.js +27 -0
- package/dist/src/providers/firebase-provider.js.map +1 -0
- package/dist/src/providers/graphql-provider.d.ts +9 -0
- package/dist/src/providers/graphql-provider.d.ts.map +1 -0
- package/dist/src/providers/graphql-provider.js +19 -0
- package/dist/src/providers/graphql-provider.js.map +1 -0
- package/dist/src/providers/grpc-web-provider.d.ts +8 -0
- package/dist/src/providers/grpc-web-provider.d.ts.map +1 -0
- package/dist/src/providers/grpc-web-provider.js +24 -0
- package/dist/src/providers/grpc-web-provider.js.map +1 -0
- package/{src/providers/index.ts → dist/src/providers/index.d.ts} +1 -5
- package/dist/src/providers/index.d.ts.map +1 -0
- package/dist/src/providers/index.js +11 -0
- package/dist/src/providers/index.js.map +1 -0
- package/dist/src/providers/indexed-db-provider.d.ts +9 -0
- package/dist/src/providers/indexed-db-provider.d.ts.map +1 -0
- package/dist/src/providers/indexed-db-provider.js +35 -0
- package/dist/src/providers/indexed-db-provider.js.map +1 -0
- package/dist/src/providers/local-storage-provider.d.ts +7 -0
- package/dist/src/providers/local-storage-provider.d.ts.map +1 -0
- package/dist/src/providers/local-storage-provider.js +29 -0
- package/dist/src/providers/local-storage-provider.js.map +1 -0
- package/dist/src/providers/provider-manager.d.ts +4 -0
- package/dist/src/providers/provider-manager.d.ts.map +1 -0
- package/dist/src/providers/provider-manager.js +15 -0
- package/dist/src/providers/provider-manager.js.map +1 -0
- package/dist/src/providers/provider.d.ts +12 -0
- package/dist/src/providers/provider.d.ts.map +1 -0
- package/dist/src/providers/provider.js +2 -0
- package/dist/src/providers/provider.js.map +1 -0
- package/dist/src/providers/rest-provider.d.ts +86 -0
- package/dist/src/providers/rest-provider.d.ts.map +1 -0
- package/dist/src/providers/rest-provider.js +210 -0
- package/dist/src/providers/rest-provider.js.map +1 -0
- package/dist/src/providers/s3-provider.d.ts +9 -0
- package/dist/src/providers/s3-provider.d.ts.map +1 -0
- package/dist/src/providers/s3-provider.js +31 -0
- package/dist/src/providers/s3-provider.js.map +1 -0
- package/dist/src/providers/supabase-provider.d.ts +9 -0
- package/dist/src/providers/supabase-provider.d.ts.map +1 -0
- package/dist/src/providers/supabase-provider.js +33 -0
- package/dist/src/providers/supabase-provider.js.map +1 -0
- package/dist/src/providers/websockets-provider.d.ts +9 -0
- package/dist/src/providers/websockets-provider.d.ts.map +1 -0
- package/dist/src/providers/websockets-provider.js +43 -0
- package/dist/src/providers/websockets-provider.js.map +1 -0
- package/dist/src/store.d.ts +94 -0
- package/dist/src/store.d.ts.map +1 -0
- package/dist/src/store.js +169 -0
- package/dist/src/store.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +34 -7
- package/index.ts +0 -1
- package/src/global-state.ts +0 -158
- package/src/middleware.ts +0 -162
- package/src/providers/indexed-db-provider.ts +0 -48
- package/src/providers/local-storage-provider.ts +0 -36
- package/src/providers/provider-manager.ts +0 -21
- package/src/providers/provider.ts +0 -23
- package/src/providers/rest-provider.ts +0 -351
- package/src/providers/websockets-provider.ts +0 -54
- package/src/store.ts +0 -237
- package/stories/data-flow-demo.stories.ts +0 -640
- package/tsconfig.json +0 -17
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Modern, reactive state management for miura applications. Combines the best of R
|
|
|
16
16
|
## Quick Start
|
|
17
17
|
|
|
18
18
|
```typescript
|
|
19
|
-
import { Store, globalState, createLoggerMiddleware } from '@
|
|
19
|
+
import { Store, globalState, createLoggerMiddleware } from '@miurajs/miura-data-flow';
|
|
20
20
|
|
|
21
21
|
// Create a store
|
|
22
22
|
const store = new Store({ count: 0, user: null });
|
|
@@ -47,7 +47,7 @@ await store.dispatch('setUser', { id: '1', name: 'John' });
|
|
|
47
47
|
The main state container that manages your application state.
|
|
48
48
|
|
|
49
49
|
```typescript
|
|
50
|
-
import { Store } from '@
|
|
50
|
+
import { Store } from '@miurajs/miura-data-flow';
|
|
51
51
|
|
|
52
52
|
interface AppState {
|
|
53
53
|
count: number;
|
|
@@ -118,7 +118,7 @@ const unsubscribeUser = store.subscribe(
|
|
|
118
118
|
#### Logger Middleware
|
|
119
119
|
|
|
120
120
|
```typescript
|
|
121
|
-
import { createLoggerMiddleware } from '@
|
|
121
|
+
import { createLoggerMiddleware } from '@miurajs/miura-data-flow';
|
|
122
122
|
|
|
123
123
|
store.use(createLoggerMiddleware());
|
|
124
124
|
// Logs all actions and state changes to console
|
|
@@ -127,7 +127,7 @@ store.use(createLoggerMiddleware());
|
|
|
127
127
|
#### Persistence Middleware
|
|
128
128
|
|
|
129
129
|
```typescript
|
|
130
|
-
import { createPersistenceMiddleware } from '@
|
|
130
|
+
import { createPersistenceMiddleware } from '@miurajs/miura-data-flow';
|
|
131
131
|
|
|
132
132
|
store.use(createPersistenceMiddleware(['user', 'settings']));
|
|
133
133
|
// Automatically saves/loads specified properties to localStorage
|
|
@@ -136,7 +136,7 @@ store.use(createPersistenceMiddleware(['user', 'settings']));
|
|
|
136
136
|
#### API Middleware
|
|
137
137
|
|
|
138
138
|
```typescript
|
|
139
|
-
import { createApiMiddleware } from '@
|
|
139
|
+
import { createApiMiddleware } from '@miurajs/miura-data-flow';
|
|
140
140
|
|
|
141
141
|
store.use(createApiMiddleware({
|
|
142
142
|
baseURL: 'https://api.example.com',
|
|
@@ -159,7 +159,7 @@ await store.dispatch('api_createUser', { method: 'POST', data: userData });
|
|
|
159
159
|
#### Cache Middleware
|
|
160
160
|
|
|
161
161
|
```typescript
|
|
162
|
-
import { createCacheMiddleware } from '@
|
|
162
|
+
import { createCacheMiddleware } from '@miurajs/miura-data-flow';
|
|
163
163
|
|
|
164
164
|
store.use(createCacheMiddleware(5 * 60 * 1000)); // 5 minutes TTL
|
|
165
165
|
// Caches API responses for 5 minutes
|
|
@@ -168,7 +168,7 @@ store.use(createCacheMiddleware(5 * 60 * 1000)); // 5 minutes TTL
|
|
|
168
168
|
#### DevTools Middleware
|
|
169
169
|
|
|
170
170
|
```typescript
|
|
171
|
-
import { createDevToolsMiddleware } from '@
|
|
171
|
+
import { createDevToolsMiddleware } from '@miurajs/miura-data-flow';
|
|
172
172
|
|
|
173
173
|
store.use(createDevToolsMiddleware('MyApp'));
|
|
174
174
|
// Enables Redux DevTools integration
|
|
@@ -194,7 +194,7 @@ Redux DevTools is a powerful browser extension that provides real-time debugging
|
|
|
194
194
|
|
|
195
195
|
2. **Enable in Your Code:**
|
|
196
196
|
```typescript
|
|
197
|
-
import { createDevToolsMiddleware } from '@
|
|
197
|
+
import { createDevToolsMiddleware } from '@miurajs/miura-data-flow';
|
|
198
198
|
|
|
199
199
|
store.use(createDevToolsMiddleware('MyApp'));
|
|
200
200
|
```
|
|
@@ -222,7 +222,7 @@ State After: { count: 1, user: { id: '1', name: 'John' } }
|
|
|
222
222
|
#### Complete Example:
|
|
223
223
|
|
|
224
224
|
```typescript
|
|
225
|
-
import { Store, createDevToolsMiddleware } from '@
|
|
225
|
+
import { Store, createDevToolsMiddleware } from '@miurajs/miura-data-flow';
|
|
226
226
|
|
|
227
227
|
// Create store
|
|
228
228
|
const store = new Store({
|
|
@@ -339,7 +339,7 @@ See the [examples directory](./examples) for complete working examples.
|
|
|
339
339
|
### Custom Middleware
|
|
340
340
|
|
|
341
341
|
```typescript
|
|
342
|
-
import { StoreMiddleware } from '@
|
|
342
|
+
import { StoreMiddleware } from '@miurajs/miura-data-flow';
|
|
343
343
|
|
|
344
344
|
const analyticsMiddleware: StoreMiddleware = {
|
|
345
345
|
name: 'analytics',
|
|
@@ -365,7 +365,7 @@ store.use(analyticsMiddleware);
|
|
|
365
365
|
### Using Global State
|
|
366
366
|
|
|
367
367
|
```typescript
|
|
368
|
-
import { globalState } from '@
|
|
368
|
+
import { globalState } from '@miurajs/miura-data-flow';
|
|
369
369
|
|
|
370
370
|
// Set global properties
|
|
371
371
|
globalState.set('theme', 'dark');
|
|
@@ -384,8 +384,8 @@ const unsubscribe = globalState.subscribeTo('my-component', 'theme', (theme) =>
|
|
|
384
384
|
### Global State in Components
|
|
385
385
|
|
|
386
386
|
```typescript
|
|
387
|
-
import { MiuraElement, html } from '@
|
|
388
|
-
import { globalState } from '@
|
|
387
|
+
import { MiuraElement, html } from '@miurajs/miura-element';
|
|
388
|
+
import { globalState } from '@miurajs/miura-data-flow';
|
|
389
389
|
|
|
390
390
|
class ThemeToggle extends MiuraElement {
|
|
391
391
|
static properties = {
|
|
@@ -431,7 +431,7 @@ class ThemeToggle extends MiuraElement {
|
|
|
431
431
|
### Framework Setup
|
|
432
432
|
|
|
433
433
|
```typescript
|
|
434
|
-
import { Store, createApiMiddleware, createCacheMiddleware } from '@
|
|
434
|
+
import { Store, createApiMiddleware, createCacheMiddleware } from '@miurajs/miura-data-flow';
|
|
435
435
|
|
|
436
436
|
class miuraFramework {
|
|
437
437
|
private store: Store;
|
|
@@ -548,7 +548,7 @@ class MyComponent {
|
|
|
548
548
|
### Enable Debug Logging
|
|
549
549
|
|
|
550
550
|
```typescript
|
|
551
|
-
import { enableDebug } from '@
|
|
551
|
+
import { enableDebug } from '@miurajs/miura-render';
|
|
552
552
|
|
|
553
553
|
enableDebug({
|
|
554
554
|
element: true, // Shows data flow logs
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Store, StoreState, StoreActions } from './store';
|
|
2
|
+
/**
|
|
3
|
+
* Global state interface
|
|
4
|
+
*/
|
|
5
|
+
export interface GlobalState extends StoreState {
|
|
6
|
+
user?: {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
email: string;
|
|
10
|
+
};
|
|
11
|
+
theme?: 'light' | 'dark';
|
|
12
|
+
language?: string;
|
|
13
|
+
notifications?: Array<{
|
|
14
|
+
id: string;
|
|
15
|
+
message: string;
|
|
16
|
+
type: 'info' | 'success' | 'warning' | 'error';
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Global State Manager
|
|
21
|
+
* Manages application-wide state using the Store system
|
|
22
|
+
*/
|
|
23
|
+
export declare class GlobalStateManager {
|
|
24
|
+
private static instance;
|
|
25
|
+
private store;
|
|
26
|
+
private componentSubscriptions;
|
|
27
|
+
private constructor();
|
|
28
|
+
static getInstance(): GlobalStateManager;
|
|
29
|
+
/**
|
|
30
|
+
* Get the global store
|
|
31
|
+
*/
|
|
32
|
+
getStore(): Store<GlobalState>;
|
|
33
|
+
/**
|
|
34
|
+
* Get a global property
|
|
35
|
+
*/
|
|
36
|
+
get<K extends keyof GlobalState>(key: K): GlobalState[K];
|
|
37
|
+
/**
|
|
38
|
+
* Set a global property
|
|
39
|
+
*/
|
|
40
|
+
set<K extends keyof GlobalState>(key: K, value: GlobalState[K]): void;
|
|
41
|
+
/**
|
|
42
|
+
* Subscribe to global state changes
|
|
43
|
+
*/
|
|
44
|
+
subscribe(componentId: string, properties: (keyof GlobalState)[], callback: (state: GlobalState, prevState: GlobalState) => void): () => void;
|
|
45
|
+
/**
|
|
46
|
+
* Subscribe to a specific global property
|
|
47
|
+
*/
|
|
48
|
+
subscribeTo<K extends keyof GlobalState>(componentId: string, key: K, callback: (value: GlobalState[K], prevValue: GlobalState[K]) => void): () => void;
|
|
49
|
+
/**
|
|
50
|
+
* Unsubscribe component from all global state
|
|
51
|
+
*/
|
|
52
|
+
unsubscribe(componentId: string): void;
|
|
53
|
+
/**
|
|
54
|
+
* Define global actions
|
|
55
|
+
*/
|
|
56
|
+
defineActions(actions: StoreActions<GlobalState>): void;
|
|
57
|
+
/**
|
|
58
|
+
* Dispatch a global action
|
|
59
|
+
*/
|
|
60
|
+
dispatch(action: string, ...args: unknown[]): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Add middleware to global store
|
|
63
|
+
*/
|
|
64
|
+
use(middleware: any): void;
|
|
65
|
+
/**
|
|
66
|
+
* Get debug information
|
|
67
|
+
*/
|
|
68
|
+
getDebugInfo(): {
|
|
69
|
+
componentSubscriptions: {
|
|
70
|
+
[k: string]: string[];
|
|
71
|
+
};
|
|
72
|
+
state: GlobalState;
|
|
73
|
+
actions: string[];
|
|
74
|
+
subscribers: number;
|
|
75
|
+
middlewares: string[];
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export declare const globalState: GlobalStateManager;
|
|
79
|
+
//# sourceMappingURL=global-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-state.d.ts","sourceRoot":"","sources":["../../src/global-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG1D;;GAEG;AACH,MAAM,WAAW,WAAY,SA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E,WAAW,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,GACnE,MAAM,IAAI;IAQb;;OAEG;IACH,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAKtC;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC,WAAW,CAAC,GAAG,IAAI;IAIvD;;OAEG;IACG,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjE;;OAEG;IACH,GAAG,CAAC,UAAU,EAAE,GAAG,GAAG,IAAI;IAI1B;;OAEG;IACH,YAAY;;;;;;;;;CAWb;AAGD,eAAO,MAAM,WAAW,oBAAmC,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { Store } from './store';
|
|
2
|
+
import { debugLog } from '@miurajs/miura-debugger';
|
|
3
|
+
/**
|
|
4
|
+
* Global State Manager
|
|
5
|
+
* Manages application-wide state using the Store system
|
|
6
|
+
*/
|
|
7
|
+
export class GlobalStateManager {
|
|
8
|
+
static instance;
|
|
9
|
+
store;
|
|
10
|
+
componentSubscriptions = new Map();
|
|
11
|
+
constructor() {
|
|
12
|
+
this.store = new Store({
|
|
13
|
+
theme: 'light',
|
|
14
|
+
language: 'en',
|
|
15
|
+
notifications: []
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
static getInstance() {
|
|
19
|
+
if (!GlobalStateManager.instance) {
|
|
20
|
+
GlobalStateManager.instance = new GlobalStateManager();
|
|
21
|
+
}
|
|
22
|
+
return GlobalStateManager.instance;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get the global store
|
|
26
|
+
*/
|
|
27
|
+
getStore() {
|
|
28
|
+
return this.store;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get a global property
|
|
32
|
+
*/
|
|
33
|
+
get(key) {
|
|
34
|
+
return this.store.get(key);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Set a global property
|
|
38
|
+
*/
|
|
39
|
+
set(key, value) {
|
|
40
|
+
this.store.setState({ [key]: value });
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Subscribe to global state changes
|
|
44
|
+
*/
|
|
45
|
+
subscribe(componentId, properties, callback) {
|
|
46
|
+
// Track component subscriptions
|
|
47
|
+
if (!this.componentSubscriptions.has(componentId)) {
|
|
48
|
+
this.componentSubscriptions.set(componentId, new Set());
|
|
49
|
+
}
|
|
50
|
+
this.componentSubscriptions.get(componentId).add(properties.join(','));
|
|
51
|
+
debugLog('element', 'Subscribed to global state', { componentId, properties });
|
|
52
|
+
// Subscribe to store with selector
|
|
53
|
+
return this.store.subscribe(callback, (state) => {
|
|
54
|
+
const selected = {};
|
|
55
|
+
properties.forEach(prop => {
|
|
56
|
+
selected[prop] = state[prop];
|
|
57
|
+
});
|
|
58
|
+
return selected;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Subscribe to a specific global property
|
|
63
|
+
*/
|
|
64
|
+
subscribeTo(componentId, key, callback) {
|
|
65
|
+
return this.subscribe(componentId, [key], (state, prevState) => {
|
|
66
|
+
if (state[key] !== prevState[key]) {
|
|
67
|
+
callback(state[key], prevState[key]);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Unsubscribe component from all global state
|
|
73
|
+
*/
|
|
74
|
+
unsubscribe(componentId) {
|
|
75
|
+
this.componentSubscriptions.delete(componentId);
|
|
76
|
+
debugLog('element', 'Unsubscribed from global state', { componentId });
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Define global actions
|
|
80
|
+
*/
|
|
81
|
+
defineActions(actions) {
|
|
82
|
+
this.store.defineActions(actions);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Dispatch a global action
|
|
86
|
+
*/
|
|
87
|
+
async dispatch(action, ...args) {
|
|
88
|
+
await this.store.dispatch(action, ...args);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Add middleware to global store
|
|
92
|
+
*/
|
|
93
|
+
use(middleware) {
|
|
94
|
+
this.store.use(middleware);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Get debug information
|
|
98
|
+
*/
|
|
99
|
+
getDebugInfo() {
|
|
100
|
+
return {
|
|
101
|
+
...this.store.getDebugInfo(),
|
|
102
|
+
componentSubscriptions: Object.fromEntries(Array.from(this.componentSubscriptions.entries()).map(([id, props]) => [
|
|
103
|
+
id,
|
|
104
|
+
Array.from(props)
|
|
105
|
+
]))
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// Export singleton instance
|
|
110
|
+
export const globalState = GlobalStateManager.getInstance();
|
|
111
|
+
//# sourceMappingURL=global-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-state.js","sourceRoot":"","sources":["../../src/global-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAA4B,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAqBnD;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IACrB,MAAM,CAAC,QAAQ,CAAqB;IACpC,KAAK,CAAqB;IAC1B,sBAAsB,GAAG,IAAI,GAAG,EAAuB,CAAC;IAEhE;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAc;YAClC,KAAK,EAAE,OAAO;YACd,QAAQ,EAAE,IAAI;YACd,aAAa,EAAE,EAAE;SAClB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,CAAC;YACjC,kBAAkB,CAAC,QAAQ,GAAG,IAAI,kBAAkB,EAAE,CAAC;QACzD,CAAC;QACD,OAAO,kB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;aAClB,CAAC,CACH;SACF,CAAC;IACJ,CAAC;CACF;AAED,4BAA4B;AAC5B,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAC,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { StoreMiddleware, StoreState } from './store';
|
|
2
|
+
/**
|
|
3
|
+
* Logger middleware for debugging
|
|
4
|
+
*/
|
|
5
|
+
export declare function createLoggerMiddleware(): StoreMiddleware;
|
|
6
|
+
/**
|
|
7
|
+
* Persistence middleware for localStorage
|
|
8
|
+
*/
|
|
9
|
+
export declare function createPersistenceMiddleware(keys: string[], storageKey?: string): StoreMiddleware;
|
|
10
|
+
/**
|
|
11
|
+
* Loads persisted state from localStorage.
|
|
12
|
+
* Call this to get initial state when creating a store:
|
|
13
|
+
* const persisted = loadPersistedState(['user', 'theme']);
|
|
14
|
+
* const store = new Store({ ...defaults, ...persisted });
|
|
15
|
+
*/
|
|
16
|
+
export declare function loadPersistedState(keys: string[], storageKey?: string): Partial<StoreState>;
|
|
17
|
+
/**
|
|
18
|
+
* API middleware for automatic API calls
|
|
19
|
+
*/
|
|
20
|
+
export declare function createApiMiddleware(apiConfig: {
|
|
21
|
+
baseURL: string;
|
|
22
|
+
headers?: Record<string, string>;
|
|
23
|
+
timeout?: number;
|
|
24
|
+
}): StoreMiddleware & {
|
|
25
|
+
fetch: (endpoint: string, options?: {
|
|
26
|
+
method?: string;
|
|
27
|
+
data?: unknown;
|
|
28
|
+
}) => Promise<unknown>;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Cache middleware for API responses
|
|
32
|
+
*/
|
|
33
|
+
export declare function createCacheMiddleware(ttl?: number): StoreMiddleware;
|
|
34
|
+
/**
|
|
35
|
+
* DevTools middleware for Redux DevTools integration
|
|
36
|
+
*/
|
|
37
|
+
export declare function createDevToolsMiddleware(storeName?: string): StoreMiddleware;
|
|
38
|
+
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEtD;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,eAAe,CAkBxD;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,UAAU,SAAgB,GAAG,eAAe,CAkBvG;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,UAAU,SAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,CAiBlG;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,eAAe,GAAG;IAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,CA0BrH;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,SAAgB,GAAG,eAAe,CAgC1E;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,SAAe,GAAG,eAAe,CAalF"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger middleware for debugging
|
|
3
|
+
*/
|
|
4
|
+
export function createLoggerMiddleware() {
|
|
5
|
+
return {
|
|
6
|
+
name: 'logger',
|
|
7
|
+
before: (action, args, state) => {
|
|
8
|
+
console.group(`🔄 Action: ${action}`);
|
|
9
|
+
console.log('Arguments:', args);
|
|
10
|
+
console.log('Current State:', state);
|
|
11
|
+
},
|
|
12
|
+
after: (action, args, state, result) => {
|
|
13
|
+
console.log('New State:', state);
|
|
14
|
+
console.log('Result:', result);
|
|
15
|
+
console.groupEnd();
|
|
16
|
+
},
|
|
17
|
+
error: (action, args, error) => {
|
|
18
|
+
console.error(`❌ Action Error: ${action}`, error);
|
|
19
|
+
console.groupEnd();
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Persistence middleware for localStorage
|
|
25
|
+
*/
|
|
26
|
+
export function createPersistenceMiddleware(keys, storageKey = 'miura-store') {
|
|
27
|
+
return {
|
|
28
|
+
name: 'persistence',
|
|
29
|
+
after: (action, args, state) => {
|
|
30
|
+
// Persist relevant keys after every action
|
|
31
|
+
try {
|
|
32
|
+
const toPersist = {};
|
|
33
|
+
keys.forEach(key => {
|
|
34
|
+
if (key in state) {
|
|
35
|
+
toPersist[key] = state[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
localStorage.setItem(storageKey, JSON.stringify(toPersist));
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
console.warn('Failed to persist state:', error);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Loads persisted state from localStorage.
|
|
48
|
+
* Call this to get initial state when creating a store:
|
|
49
|
+
* const persisted = loadPersistedState(['user', 'theme']);
|
|
50
|
+
* const store = new Store({ ...defaults, ...persisted });
|
|
51
|
+
*/
|
|
52
|
+
export function loadPersistedState(keys, storageKey = 'miura-store') {
|
|
53
|
+
try {
|
|
54
|
+
const persisted = localStorage.getItem(storageKey);
|
|
55
|
+
if (persisted) {
|
|
56
|
+
const parsed = JSON.parse(persisted);
|
|
57
|
+
const result = {};
|
|
58
|
+
keys.forEach(key => {
|
|
59
|
+
if (key in parsed) {
|
|
60
|
+
result[key] = parsed[key];
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
console.warn('Failed to load persisted state:', error);
|
|
68
|
+
}
|
|
69
|
+
return {};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* API middleware for automatic API calls
|
|
73
|
+
*/
|
|
74
|
+
export function createApiMiddleware(apiConfig) {
|
|
75
|
+
const apiFetch = async (endpoint, options) => {
|
|
76
|
+
const method = options?.method || 'GET';
|
|
77
|
+
const data = options?.data;
|
|
78
|
+
const response = await fetch(`${apiConfig.baseURL}${endpoint}`, {
|
|
79
|
+
method,
|
|
80
|
+
headers: {
|
|
81
|
+
'Content-Type': 'application/json',
|
|
82
|
+
...apiConfig.headers
|
|
83
|
+
},
|
|
84
|
+
body: data ? JSON.stringify(data) : undefined,
|
|
85
|
+
signal: apiConfig.timeout ? AbortSignal.timeout(apiConfig.timeout) : undefined
|
|
86
|
+
});
|
|
87
|
+
if (!response.ok) {
|
|
88
|
+
throw new Error(`API Error: ${response.status} ${response.statusText}`);
|
|
89
|
+
}
|
|
90
|
+
return response.json();
|
|
91
|
+
};
|
|
92
|
+
return {
|
|
93
|
+
name: 'api',
|
|
94
|
+
fetch: apiFetch
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Cache middleware for API responses
|
|
99
|
+
*/
|
|
100
|
+
export function createCacheMiddleware(ttl = 5 * 60 * 1000) {
|
|
101
|
+
const cache = new Map();
|
|
102
|
+
return {
|
|
103
|
+
name: 'cache',
|
|
104
|
+
before: async (action, args, state) => {
|
|
105
|
+
if (action.startsWith('api_')) {
|
|
106
|
+
const cacheKey = `${action}_${JSON.stringify(args)}`;
|
|
107
|
+
const cached = cache.get(cacheKey);
|
|
108
|
+
if (cached && Date.now() - cached.timestamp < ttl) {
|
|
109
|
+
// Return cached data
|
|
110
|
+
const endpoint = action.replace('api_', '');
|
|
111
|
+
state[`${endpoint}_data`] = cached.data;
|
|
112
|
+
state[`${endpoint}_loading`] = false;
|
|
113
|
+
state[`${endpoint}_error`] = null;
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
after: (action, args, state) => {
|
|
119
|
+
if (action.startsWith('api_')) {
|
|
120
|
+
const cacheKey = `${action}_${JSON.stringify(args)}`;
|
|
121
|
+
const endpoint = action.replace('api_', '');
|
|
122
|
+
const data = state[`${endpoint}_data`];
|
|
123
|
+
if (data) {
|
|
124
|
+
cache.set(cacheKey, { data, timestamp: Date.now() });
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* DevTools middleware for Redux DevTools integration
|
|
132
|
+
*/
|
|
133
|
+
export function createDevToolsMiddleware(storeName = 'miuraStore') {
|
|
134
|
+
return {
|
|
135
|
+
name: 'devtools',
|
|
136
|
+
after: (action, args, state) => {
|
|
137
|
+
if (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__) {
|
|
138
|
+
window.__REDUX_DEVTOOLS_EXTENSION__.send({ type: action, payload: args }, state, storeName);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../src/middleware.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,sBAAsB;IACpC,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;YAC9B,OAAO,CAAC,KAAK,CAAC,cAAc,MAAM,EAAE,CAAC,CAAC;YACtC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;YAChC,OAAO,CAAC,GAAG,CAAC,gBAAgB,EA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