@kajidog/voicevox-client 0.4.1 → 0.5.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.
- package/LICENSE +14 -14
- package/dist/api.d.ts +36 -2
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +76 -0
- package/dist/api.js.map +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +6 -0
- package/dist/client.js.map +1 -1
- package/dist/effect/config.d.ts +43 -0
- package/dist/effect/config.d.ts.map +1 -0
- package/dist/effect/config.js +45 -0
- package/dist/effect/config.js.map +1 -0
- package/dist/effect/context.d.ts +33 -0
- package/dist/effect/context.d.ts.map +1 -0
- package/dist/effect/context.js +10 -0
- package/dist/effect/context.js.map +1 -0
- package/dist/effect/errors.d.ts +130 -0
- package/dist/effect/errors.d.ts.map +1 -0
- package/dist/effect/errors.js +121 -0
- package/dist/effect/errors.js.map +1 -0
- package/dist/effect/index.d.ts +34 -0
- package/dist/effect/index.d.ts.map +1 -0
- package/dist/effect/index.js +67 -0
- package/dist/effect/index.js.map +1 -0
- package/dist/effect/queue-manager.d.ts +34 -0
- package/dist/effect/queue-manager.d.ts.map +1 -0
- package/dist/effect/queue-manager.js +59 -0
- package/dist/effect/queue-manager.js.map +1 -0
- package/dist/effect/services/api-service.d.ts +58 -0
- package/dist/effect/services/api-service.d.ts.map +1 -0
- package/dist/effect/services/api-service.js +90 -0
- package/dist/effect/services/api-service.js.map +1 -0
- package/dist/effect/services/audio-generator-service.d.ts +78 -0
- package/dist/effect/services/audio-generator-service.d.ts.map +1 -0
- package/dist/effect/services/audio-generator-service.js +187 -0
- package/dist/effect/services/audio-generator-service.js.map +1 -0
- package/dist/effect/services/audio-player-service.d.ts +101 -0
- package/dist/effect/services/audio-player-service.d.ts.map +1 -0
- package/dist/effect/services/audio-player-service.js +297 -0
- package/dist/effect/services/audio-player-service.js.map +1 -0
- package/dist/effect/services/event-manager-service.d.ts +96 -0
- package/dist/effect/services/event-manager-service.d.ts.map +1 -0
- package/dist/effect/services/event-manager-service.js +208 -0
- package/dist/effect/services/event-manager-service.js.map +1 -0
- package/dist/effect/services/file-manager-service.d.ts +91 -0
- package/dist/effect/services/file-manager-service.d.ts.map +1 -0
- package/dist/effect/services/file-manager-service.js +215 -0
- package/dist/effect/services/file-manager-service.js.map +1 -0
- package/dist/effect/utils.d.ts +118 -0
- package/dist/effect/utils.d.ts.map +1 -0
- package/dist/effect/utils.js +186 -0
- package/dist/effect/utils.js.map +1 -0
- package/dist/error.js.map +1 -1
- package/dist/player.d.ts +110 -0
- package/dist/player.d.ts.map +1 -0
- package/dist/player.js +183 -0
- package/dist/player.js.map +1 -0
- package/dist/queue/audio-player.d.ts +44 -0
- package/dist/queue/audio-player.d.ts.map +1 -0
- package/dist/queue/audio-player.js +344 -0
- package/dist/queue/audio-player.js.map +1 -0
- package/dist/queue/file-manager.js +9 -9
- package/dist/queue/manager.d.ts +134 -0
- package/dist/queue/manager.d.ts.map +1 -0
- package/dist/queue/manager.js +564 -0
- package/dist/queue/manager.js.map +1 -0
- package/dist/queue/queue-service.d.ts.map +1 -1
- package/dist/queue/queue-service.js +16 -4
- package/dist/queue/queue-service.js.map +1 -1
- package/dist/shared-queue-manager.d.ts +119 -0
- package/dist/shared-queue-manager.d.ts.map +1 -0
- package/dist/shared-queue-manager.js +487 -0
- package/dist/shared-queue-manager.js.map +1 -0
- package/dist/state/types.js.map +1 -1
- package/dist/types.d.ts +28 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Effect-based EventManager service implementation
|
|
3
|
+
* Provides structured event handling and resource management for queue events
|
|
4
|
+
*/
|
|
5
|
+
import { Context, Effect, Layer, Ref } from 'effect';
|
|
6
|
+
import { EventManager } from '../../queue/event-manager';
|
|
7
|
+
import { QueueEventType, type QueueItem } from '../../queue/types';
|
|
8
|
+
import { type EventManagerService } from '../context';
|
|
9
|
+
/**
|
|
10
|
+
* Effect-based event listener type
|
|
11
|
+
*/
|
|
12
|
+
export type EffectEventListener = (event: QueueEventType, item?: QueueItem) => Effect.Effect<void, never>;
|
|
13
|
+
/**
|
|
14
|
+
* Enhanced EventManager service with Effect-based operations
|
|
15
|
+
*/
|
|
16
|
+
export interface EffectEventManagerService extends EventManagerService {
|
|
17
|
+
readonly addEffectEventListener: (event: QueueEventType, listener: EffectEventListener) => Effect.Effect<void, never>;
|
|
18
|
+
readonly removeEffectEventListener: (event: QueueEventType, listener: EffectEventListener) => Effect.Effect<void, never>;
|
|
19
|
+
readonly emitEffectEvent: (event: QueueEventType, item?: QueueItem) => Effect.Effect<void, never>;
|
|
20
|
+
readonly getListenerCount: (event: QueueEventType) => Effect.Effect<number, never>;
|
|
21
|
+
readonly clearAllListeners: () => Effect.Effect<void, never>;
|
|
22
|
+
readonly cleanup: () => Effect.Effect<void, never>;
|
|
23
|
+
}
|
|
24
|
+
export declare const EffectEventManagerContext: Context.Tag<EffectEventManagerService, EffectEventManagerService>;
|
|
25
|
+
/**
|
|
26
|
+
* Effect-based implementation of EventManager service
|
|
27
|
+
*/
|
|
28
|
+
export declare class EffectEventManagerServiceImpl implements EffectEventManagerService {
|
|
29
|
+
private readonly eventManager;
|
|
30
|
+
private readonly effectListeners;
|
|
31
|
+
constructor(eventManager: EventManager, effectListeners: Ref.Ref<Map<QueueEventType, EffectEventListener[]>>);
|
|
32
|
+
/**
|
|
33
|
+
* Add traditional event listener (synchronous)
|
|
34
|
+
*/
|
|
35
|
+
addEventListener: (eventType: string, listener: (...args: any[]) => void) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Remove traditional event listener (synchronous)
|
|
38
|
+
*/
|
|
39
|
+
removeEventListener: (eventType: string, listener: (...args: any[]) => void) => void;
|
|
40
|
+
/**
|
|
41
|
+
* Emit traditional event (synchronous)
|
|
42
|
+
*/
|
|
43
|
+
emitEvent: (eventType: string, data?: any) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Add Effect-based event listener with proper resource management
|
|
46
|
+
*/
|
|
47
|
+
addEffectEventListener: (event: QueueEventType, listener: EffectEventListener) => Effect.Effect<void, never>;
|
|
48
|
+
/**
|
|
49
|
+
* Remove Effect-based event listener
|
|
50
|
+
*/
|
|
51
|
+
removeEffectEventListener: (event: QueueEventType, listener: EffectEventListener) => Effect.Effect<void, never>;
|
|
52
|
+
/**
|
|
53
|
+
* Emit event to both traditional and Effect-based listeners
|
|
54
|
+
*/
|
|
55
|
+
emitEffectEvent: (event: QueueEventType, item?: QueueItem) => Effect.Effect<void, never>;
|
|
56
|
+
/**
|
|
57
|
+
* Get the number of listeners for a specific event type
|
|
58
|
+
*/
|
|
59
|
+
getListenerCount: (event: QueueEventType) => Effect.Effect<number, never>;
|
|
60
|
+
/**
|
|
61
|
+
* Clear all Effect-based event listeners
|
|
62
|
+
*/
|
|
63
|
+
clearAllListeners: () => Effect.Effect<void, never>;
|
|
64
|
+
/**
|
|
65
|
+
* Cleanup all resources and listeners
|
|
66
|
+
*/
|
|
67
|
+
cleanup: () => Effect.Effect<void, never>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Create EventManager service instance
|
|
71
|
+
*/
|
|
72
|
+
export declare const makeEffectEventManagerService: () => Effect.Effect<EffectEventManagerService, never>;
|
|
73
|
+
/**
|
|
74
|
+
* Layer providing Effect EventManager service
|
|
75
|
+
*/
|
|
76
|
+
export declare const EffectEventManagerServiceLive: Layer.Layer<EffectEventManagerService, never>;
|
|
77
|
+
/**
|
|
78
|
+
* Scoped layer that automatically cleans up resources on scope close
|
|
79
|
+
*/
|
|
80
|
+
export declare const EffectEventManagerServiceScoped: Layer.Layer<EffectEventManagerService, never, never>;
|
|
81
|
+
/**
|
|
82
|
+
* Helper functions for common event operations
|
|
83
|
+
*/
|
|
84
|
+
/**
|
|
85
|
+
* Subscribe to multiple events with a single listener
|
|
86
|
+
*/
|
|
87
|
+
export declare const subscribeToEvents: (events: QueueEventType[], listener: EffectEventListener) => Effect.Effect<void, never, EffectEventManagerService>;
|
|
88
|
+
/**
|
|
89
|
+
* Create a temporary event subscription that automatically unsubscribes when the scope closes
|
|
90
|
+
*/
|
|
91
|
+
export declare const withEventSubscription: <A, E>(event: QueueEventType, listener: EffectEventListener, program: Effect.Effect<A, E, EffectEventManagerService>) => Effect.Effect<A, E, EffectEventManagerService>;
|
|
92
|
+
/**
|
|
93
|
+
* Wait for a specific event to occur
|
|
94
|
+
*/
|
|
95
|
+
export declare const waitForEvent: (event: QueueEventType, predicate?: (item?: QueueItem) => boolean) => Effect.Effect<QueueItem | undefined, never, EffectEventManagerService>;
|
|
96
|
+
//# sourceMappingURL=event-manager-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-manager-service.d.ts","sourceRoot":"","sources":["../../../src/effect/services/event-manager-service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAA2B,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC3F,OAAO,EAAuB,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAI1E;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,SAAS,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AAEzG;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACpE,QAAQ,CAAC,sBAAsB,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,mBAAmB,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IACrH,QAAQ,CAAC,yB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,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,yBAAyB,CAe/C,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,GACvB,OAAO,cAAc,EACrB,YAAY,CAAC,IAAI,CAAC,EAAE,SAAS,KAAK,OAAO,KACxC,MAAM,CAAC,MAAM,CAAC,SAAS,GAAG,SAAS,EAAE,KAAK,EAAE,yBAAyB,CAsBvE,CAAA"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Effect-based EventManager service implementation
|
|
4
|
+
* Provides structured event handling and resource management for queue events
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.waitForEvent = exports.withEventSubscription = exports.subscribeToEvents = exports.EffectEventManagerServiceScoped = exports.EffectEventManagerServiceLive = exports.makeEffectEventManagerService = exports.EffectEventManagerServiceImpl = exports.EffectEventManagerContext = void 0;
|
|
8
|
+
const effect_1 = require("effect");
|
|
9
|
+
const event_manager_1 = require("../../queue/event-manager");
|
|
10
|
+
const types_1 = require("../../queue/types");
|
|
11
|
+
const utils_1 = require("../utils");
|
|
12
|
+
exports.EffectEventManagerContext = effect_1.Context.GenericTag('@voicevox/EffectEventManager');
|
|
13
|
+
/**
|
|
14
|
+
* Effect-based implementation of EventManager service
|
|
15
|
+
*/
|
|
16
|
+
class EffectEventManagerServiceImpl {
|
|
17
|
+
constructor(eventManager, effectListeners) {
|
|
18
|
+
this.eventManager = eventManager;
|
|
19
|
+
/**
|
|
20
|
+
* Add traditional event listener (synchronous)
|
|
21
|
+
*/
|
|
22
|
+
this.addEventListener = (eventType, listener) => {
|
|
23
|
+
if (Object.values(types_1.QueueEventType).includes(eventType)) {
|
|
24
|
+
this.eventManager.addEventListener(eventType, listener);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Remove traditional event listener (synchronous)
|
|
29
|
+
*/
|
|
30
|
+
this.removeEventListener = (eventType, listener) => {
|
|
31
|
+
if (Object.values(types_1.QueueEventType).includes(eventType)) {
|
|
32
|
+
this.eventManager.removeEventListener(eventType, listener);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Emit traditional event (synchronous)
|
|
37
|
+
*/
|
|
38
|
+
this.emitEvent = (eventType, data) => {
|
|
39
|
+
if (Object.values(types_1.QueueEventType).includes(eventType)) {
|
|
40
|
+
this.eventManager.emitEvent(eventType, data);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Add Effect-based event listener with proper resource management
|
|
45
|
+
*/
|
|
46
|
+
this.addEffectEventListener = (event, listener) => {
|
|
47
|
+
const self = this;
|
|
48
|
+
return (0, utils_1.logTimed)(`addEffectEventListener-${event}`, effect_1.Ref.update(self.effectListeners, (listeners) => {
|
|
49
|
+
const eventListeners = listeners.get(event) || [];
|
|
50
|
+
if (!eventListeners.includes(listener)) {
|
|
51
|
+
eventListeners.push(listener);
|
|
52
|
+
listeners.set(event, eventListeners);
|
|
53
|
+
}
|
|
54
|
+
return listeners;
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Remove Effect-based event listener
|
|
59
|
+
*/
|
|
60
|
+
this.removeEffectEventListener = (event, listener) => {
|
|
61
|
+
const self = this;
|
|
62
|
+
return (0, utils_1.logTimed)(`removeEffectEventListener-${event}`, effect_1.Ref.update(self.effectListeners, (listeners) => {
|
|
63
|
+
const eventListeners = listeners.get(event) || [];
|
|
64
|
+
const index = eventListeners.indexOf(listener);
|
|
65
|
+
if (index !== -1) {
|
|
66
|
+
eventListeners.splice(index, 1);
|
|
67
|
+
listeners.set(event, eventListeners);
|
|
68
|
+
}
|
|
69
|
+
return listeners;
|
|
70
|
+
}));
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Emit event to both traditional and Effect-based listeners
|
|
74
|
+
*/
|
|
75
|
+
this.emitEffectEvent = (event, item) => {
|
|
76
|
+
const self = this;
|
|
77
|
+
return (0, utils_1.logTimed)(`emitEffectEvent-${event}`, effect_1.Effect.gen(function* () {
|
|
78
|
+
// Emit to traditional listeners (synchronous)
|
|
79
|
+
self.eventManager.emitEvent(event, item);
|
|
80
|
+
// Emit to Effect-based listeners (asynchronous)
|
|
81
|
+
const listeners = yield* effect_1.Ref.get(self.effectListeners);
|
|
82
|
+
const eventListeners = listeners.get(event) || [];
|
|
83
|
+
if (eventListeners.length > 0) {
|
|
84
|
+
// Run all Effect listeners in parallel
|
|
85
|
+
yield* effect_1.Effect.all(eventListeners.map((listener) => listener(event, item).pipe(effect_1.Effect.catchAll((error) => {
|
|
86
|
+
// Log listener errors but don't fail the emission
|
|
87
|
+
console.error(`Effect event listener error (${event}):`, error);
|
|
88
|
+
return effect_1.Effect.void;
|
|
89
|
+
}))), { concurrency: 'unbounded' });
|
|
90
|
+
}
|
|
91
|
+
}));
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Get the number of listeners for a specific event type
|
|
95
|
+
*/
|
|
96
|
+
this.getListenerCount = (event) => {
|
|
97
|
+
const self = this;
|
|
98
|
+
return effect_1.Effect.gen(function* () {
|
|
99
|
+
const listeners = yield* effect_1.Ref.get(self.effectListeners);
|
|
100
|
+
const eventListeners = listeners.get(event) || [];
|
|
101
|
+
return eventListeners.length;
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Clear all Effect-based event listeners
|
|
106
|
+
*/
|
|
107
|
+
this.clearAllListeners = () => {
|
|
108
|
+
const self = this;
|
|
109
|
+
return (0, utils_1.logTimed)('clearAllListeners', effect_1.Effect.gen(function* () {
|
|
110
|
+
yield* effect_1.Ref.set(self.effectListeners, new Map());
|
|
111
|
+
}));
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Cleanup all resources and listeners
|
|
115
|
+
*/
|
|
116
|
+
this.cleanup = () => {
|
|
117
|
+
const self = this;
|
|
118
|
+
return (0, utils_1.logTimed)('eventManagerCleanup', effect_1.Effect.gen(function* () {
|
|
119
|
+
// Clear all Effect-based listeners
|
|
120
|
+
yield* self.clearAllListeners();
|
|
121
|
+
// Note: Traditional listeners are managed by the underlying EventManager
|
|
122
|
+
// and will be cleaned up when the service is disposed
|
|
123
|
+
}));
|
|
124
|
+
};
|
|
125
|
+
this.effectListeners = effectListeners;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
exports.EffectEventManagerServiceImpl = EffectEventManagerServiceImpl;
|
|
129
|
+
/**
|
|
130
|
+
* Create EventManager service instance
|
|
131
|
+
*/
|
|
132
|
+
const makeEffectEventManagerService = () => effect_1.Effect.gen(function* () {
|
|
133
|
+
const eventManager = new event_manager_1.EventManager();
|
|
134
|
+
const effectListeners = yield* effect_1.Ref.make(new Map());
|
|
135
|
+
// Initialize Effect listeners map with empty arrays for each event type
|
|
136
|
+
const initialMap = new Map();
|
|
137
|
+
for (const eventType of Object.values(types_1.QueueEventType)) {
|
|
138
|
+
initialMap.set(eventType, []);
|
|
139
|
+
}
|
|
140
|
+
yield* effect_1.Ref.set(effectListeners, initialMap);
|
|
141
|
+
return new EffectEventManagerServiceImpl(eventManager, effectListeners);
|
|
142
|
+
});
|
|
143
|
+
exports.makeEffectEventManagerService = makeEffectEventManagerService;
|
|
144
|
+
/**
|
|
145
|
+
* Layer providing Effect EventManager service
|
|
146
|
+
*/
|
|
147
|
+
exports.EffectEventManagerServiceLive = effect_1.Layer.effect(exports.EffectEventManagerContext, (0, exports.makeEffectEventManagerService)());
|
|
148
|
+
/**
|
|
149
|
+
* Scoped layer that automatically cleans up resources on scope close
|
|
150
|
+
*/
|
|
151
|
+
exports.EffectEventManagerServiceScoped = effect_1.Layer.scoped(exports.EffectEventManagerContext, effect_1.Effect.gen(function* () {
|
|
152
|
+
const service = yield* (0, exports.makeEffectEventManagerService)();
|
|
153
|
+
// Add finalizer to cleanup resources when scope closes
|
|
154
|
+
yield* effect_1.Effect.addFinalizer(() => service.cleanup());
|
|
155
|
+
return service;
|
|
156
|
+
}));
|
|
157
|
+
/**
|
|
158
|
+
* Helper functions for common event operations
|
|
159
|
+
*/
|
|
160
|
+
/**
|
|
161
|
+
* Subscribe to multiple events with a single listener
|
|
162
|
+
*/
|
|
163
|
+
const subscribeToEvents = (events, listener) => {
|
|
164
|
+
const eventService = exports.EffectEventManagerContext;
|
|
165
|
+
return effect_1.Effect.gen(function* () {
|
|
166
|
+
const service = yield* eventService;
|
|
167
|
+
yield* effect_1.Effect.all(events.map((event) => service.addEffectEventListener(event, listener)), { concurrency: 'unbounded' });
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
exports.subscribeToEvents = subscribeToEvents;
|
|
171
|
+
/**
|
|
172
|
+
* Create a temporary event subscription that automatically unsubscribes when the scope closes
|
|
173
|
+
*/
|
|
174
|
+
const withEventSubscription = (event, listener, program) => {
|
|
175
|
+
const eventService = exports.EffectEventManagerContext;
|
|
176
|
+
return effect_1.Effect.gen(function* () {
|
|
177
|
+
const service = yield* eventService;
|
|
178
|
+
// Subscribe to the event
|
|
179
|
+
yield* service.addEffectEventListener(event, listener);
|
|
180
|
+
// Run the program with automatic cleanup
|
|
181
|
+
return yield* effect_1.Effect.acquireUseRelease(effect_1.Effect.void, () => program, () => service.removeEffectEventListener(event, listener));
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
exports.withEventSubscription = withEventSubscription;
|
|
185
|
+
/**
|
|
186
|
+
* Wait for a specific event to occur
|
|
187
|
+
*/
|
|
188
|
+
const waitForEvent = (event, predicate) => {
|
|
189
|
+
const eventService = exports.EffectEventManagerContext;
|
|
190
|
+
return effect_1.Effect.gen(function* () {
|
|
191
|
+
const service = yield* eventService;
|
|
192
|
+
return yield* effect_1.Effect.async((resume) => {
|
|
193
|
+
const listener = (eventType, item) => effect_1.Effect.sync(() => {
|
|
194
|
+
if (eventType === event && (!predicate || predicate(item))) {
|
|
195
|
+
resume(effect_1.Effect.succeed(item));
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
// Subscribe to the event
|
|
199
|
+
effect_1.Effect.runPromise(service.addEffectEventListener(event, listener));
|
|
200
|
+
// Return cleanup function
|
|
201
|
+
return effect_1.Effect.sync(() => {
|
|
202
|
+
effect_1.Effect.runPromise(service.removeEffectEventListener(event, listener));
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
exports.waitForEvent = waitForEvent;
|
|
208
|
+
//# sourceMappingURL=event-manager-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-manager-service.js","sourceRoot":"","sources":["../../../src/effect/services/event-manager-service.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mCAAoD;AACpD,6DAAwD;AACxD,6CAA2F;AAG3F,oCAAmC;AAsBtB,QAAA,yBAAyB,GAAG,gBAAO,CAAC,UAAU,CAA4B,8BAA8B,CAAC,CAAA;AAEtH;;GAEG;AACH,MAAa,6BAA6B;IAGxC,YACmB,YAA0B,EAC3C,eAAoE;QADnD,iBAAY,GAAZ,YAAY,CAAc;QAM7C;;WAEG;QACH,qBAAgB,GAAG,CAAC,SAAiB,EAAE,QAAkC,EAAQ,EAAE;YACjF,IAAI,MAAM,CAAC,MAAM,CAAC,sBAAc,CAAC,CAAC,QAAQ,CAAC,SAA2B,CAAC,EAAE,CAAC;gBACxE,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,SAA2B,EAAE,QAA8B,CAAC,CAAA;YACjG,CAAC;QACH,CAAC,CAAA;QAED;;WAEG;QACH,wBAAmB,GAAG,CAAC,SAAiB,EAAE,QAAkC,EAAQ,EAAE;YACpF,IAAI,MAAM,CAAC,MAAM,CAAC,sBAAc,CAAC,CAAC,QAAQ,CAAC,SAA2B,CAAC,EAAE,CAAC;gBACxE,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAAC,SAA2B,EAAE,QAA8B,CAAC,CA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AC,KAAK,CAA+B,CAAC,MAAM,EAAE,EAAE;YAClE,MAAM,QAAQ,GAAwB,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,CACxD,eAAM,CAAC,IAAI,CAAC,GAAG,EAAE;gBACf,IAAI,SAAS,KAAK,KAAK,IAAI,CAAC,CAAC,SAAS,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;oBAC3D,MAAM,CAAC,eAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;gBAC9B,CAAC;YACH,CAAC,CAAC,CAAA;YAEJ,yBAAyB;YACzB,eAAM,CAAC,UAAU,CAAC,OAAO,CAAC,sBAAsB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAA;YAElE,0BAA0B;YAC1B,OAAO,eAAM,CAAC,IAAI,CAAC,GAAG,EAAE;gBACtB,eAAM,CAAC,UAAU,CAAC,OAAO,CAAC,yBAAyB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAA;YACvE,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAzBY,QAAA,YAAY,gBAyBxB"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Effect-based AudioFileManager service implementation
|
|
3
|
+
* Provides structured error handling and resource management for file operations
|
|
4
|
+
*/
|
|
5
|
+
import { Context, Effect, Layer, type Scope } from 'effect';
|
|
6
|
+
import { type FileOperationError } from '../errors';
|
|
7
|
+
/**
|
|
8
|
+
* EffectFileManagerService interface
|
|
9
|
+
*/
|
|
10
|
+
export interface EffectFileManagerService {
|
|
11
|
+
readonly saveTempAudioFile: (audioData: ArrayBuffer) => Effect.Effect<string, FileOperationError>;
|
|
12
|
+
readonly saveAudioFile: (audioData: ArrayBuffer, output: string, forceDownload?: boolean) => Effect.Effect<string, FileOperationError>;
|
|
13
|
+
readonly deleteTempFile: (filePath: string) => Effect.Effect<void, FileOperationError>;
|
|
14
|
+
readonly createTempFilePath: () => Effect.Effect<string, FileOperationError>;
|
|
15
|
+
readonly createBlobUrl: (blob: Blob) => Effect.Effect<string, FileOperationError>;
|
|
16
|
+
readonly releaseBlobUrl: (url: string) => Effect.Effect<void, never>;
|
|
17
|
+
readonly releaseAllBlobUrls: () => Effect.Effect<void, never>;
|
|
18
|
+
readonly withTempFile: <A, E>(audioData: ArrayBuffer, use: (filePath: string) => Effect.Effect<A, E>) => Effect.Effect<A, E | FileOperationError>;
|
|
19
|
+
readonly deleteMultipleTempFiles: (filePaths: readonly string[]) => Effect.Effect<void, FileOperationError>;
|
|
20
|
+
readonly saveMultipleTempAudioFiles: (audioDataArray: readonly ArrayBuffer[]) => Effect.Effect<readonly string[], FileOperationError>;
|
|
21
|
+
readonly getFileSize: (filePath: string) => Effect.Effect<number | null, FileOperationError>;
|
|
22
|
+
readonly cleanup: () => Effect.Effect<void, never>;
|
|
23
|
+
}
|
|
24
|
+
export declare const EffectFileManagerContext: Context.Tag<EffectFileManagerService, EffectFileManagerService>;
|
|
25
|
+
/**
|
|
26
|
+
* Effect-based implementation of AudioFileManager service
|
|
27
|
+
*/
|
|
28
|
+
export declare class EffectFileManagerServiceImpl implements EffectFileManagerService {
|
|
29
|
+
private blobUrls;
|
|
30
|
+
/**
|
|
31
|
+
* Save audio data to temporary file with Effect-based error handling
|
|
32
|
+
*/
|
|
33
|
+
saveTempAudioFile: (audioData: ArrayBuffer) => Effect.Effect<string, FileOperationError>;
|
|
34
|
+
/**
|
|
35
|
+
* Save audio data to specific file path with Effect-based error handling
|
|
36
|
+
*/
|
|
37
|
+
saveAudioFile: (audioData: ArrayBuffer, output: string, forceDownload?: boolean) => Effect.Effect<string, FileOperationError>;
|
|
38
|
+
/**
|
|
39
|
+
* Delete temporary file with Effect-based error handling
|
|
40
|
+
*/
|
|
41
|
+
deleteTempFile: (filePath: string) => Effect.Effect<void, FileOperationError>;
|
|
42
|
+
/**
|
|
43
|
+
* Create temporary file path with Effect-based error handling
|
|
44
|
+
*/
|
|
45
|
+
createTempFilePath: () => Effect.Effect<string, FileOperationError>;
|
|
46
|
+
/**
|
|
47
|
+
* Create blob URL with Effect-based error handling
|
|
48
|
+
*/
|
|
49
|
+
createBlobUrl: (blob: Blob) => Effect.Effect<string, FileOperationError>;
|
|
50
|
+
/**
|
|
51
|
+
* Release blob URL (infallible operation)
|
|
52
|
+
*/
|
|
53
|
+
releaseBlobUrl: (url: string) => Effect.Effect<void, never>;
|
|
54
|
+
/**
|
|
55
|
+
* Release all blob URLs (infallible operation)
|
|
56
|
+
*/
|
|
57
|
+
releaseAllBlobUrls: () => Effect.Effect<void, never>;
|
|
58
|
+
/**
|
|
59
|
+
* Create temporary file with automatic cleanup using Scope
|
|
60
|
+
*/
|
|
61
|
+
withTempFile: <A, E>(audioData: ArrayBuffer, use: (filePath: string) => Effect.Effect<A, E>) => Effect.Effect<A, E | FileOperationError>;
|
|
62
|
+
/**
|
|
63
|
+
* Batch delete multiple temporary files
|
|
64
|
+
*/
|
|
65
|
+
deleteMultipleTempFiles: (filePaths: readonly string[]) => Effect.Effect<void, FileOperationError>;
|
|
66
|
+
/**
|
|
67
|
+
* Create multiple temporary files from audio data array
|
|
68
|
+
*/
|
|
69
|
+
saveMultipleTempAudioFiles: (audioDataArray: readonly ArrayBuffer[]) => Effect.Effect<readonly string[], FileOperationError>;
|
|
70
|
+
/**
|
|
71
|
+
* Get file size information (Node.js only, returns null in browser)
|
|
72
|
+
*/
|
|
73
|
+
getFileSize: (filePath: string) => Effect.Effect<number | null, FileOperationError>;
|
|
74
|
+
/**
|
|
75
|
+
* Clean up all resources (blob URLs and temp files)
|
|
76
|
+
*/
|
|
77
|
+
cleanup: () => Effect.Effect<void, never>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Create FileManager service instance
|
|
81
|
+
*/
|
|
82
|
+
export declare const makeEffectFileManagerService: () => Effect.Effect<EffectFileManagerService, never>;
|
|
83
|
+
/**
|
|
84
|
+
* Layer providing Effect FileManager service
|
|
85
|
+
*/
|
|
86
|
+
export declare const EffectFileManagerServiceLive: Layer.Layer<EffectFileManagerService, never, never>;
|
|
87
|
+
/**
|
|
88
|
+
* Scoped layer that automatically cleans up resources on scope close
|
|
89
|
+
*/
|
|
90
|
+
export declare const EffectFileManagerServiceScoped: Layer.Layer<EffectFileManagerService, never, Scope.Scope>;
|
|
91
|
+
//# sourceMappingURL=file-manager-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-manager-service.d.ts","sourceRoot":"","sources":["../../../src/effect/services/file-manager-service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAA;AAI3D,OAAO,EAAE,KAAK,kBAAkB,EAA+C,MAAM,WAAW,CAAA;AAGhG;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,iBAAiB,EAAE,CAAC,SAAS,EAAE,WAAW,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IACjG,QAAQ,CAAC,aAAa,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,OAAO,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IACtI,QAAQ,CAAC,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAA;IACtF,QAAQ,CAAC,kBAAkB,EAAE,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IAC5E,QAAQ,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CA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ACH,OAAO,QAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CASvC;CACF;AAED;;GAEG;AACH,eAAO,MAAM,4BAA4B,QAAO,MAAM,CAAC,MAAM,CAAC,wBAAwB,EAAE,KAAK,CACtC,CAAA;AAEvD;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,KAAK,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,EAAE,KAAK,CAG5F,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,8BAA8B,EAAE,KAAK,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAUpG,CAAA"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Effect-based AudioFileManager service implementation
|
|
4
|
+
* Provides structured error handling and resource management for file operations
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.EffectFileManagerServiceScoped = exports.EffectFileManagerServiceLive = exports.makeEffectFileManagerService = exports.EffectFileManagerServiceImpl = exports.EffectFileManagerContext = void 0;
|
|
41
|
+
const effect_1 = require("effect");
|
|
42
|
+
const fs = __importStar(require("node:fs/promises"));
|
|
43
|
+
const path = __importStar(require("node:path"));
|
|
44
|
+
const os = __importStar(require("node:os"));
|
|
45
|
+
const errors_1 = require("../errors");
|
|
46
|
+
const utils_1 = require("../utils");
|
|
47
|
+
exports.EffectFileManagerContext = effect_1.Context.GenericTag('@voicevox/EffectFileManager');
|
|
48
|
+
/**
|
|
49
|
+
* Effect-based implementation of AudioFileManager service
|
|
50
|
+
*/
|
|
51
|
+
class EffectFileManagerServiceImpl {
|
|
52
|
+
constructor() {
|
|
53
|
+
this.blobUrls = new Set();
|
|
54
|
+
/**
|
|
55
|
+
* Save audio data to temporary file with Effect-based error handling
|
|
56
|
+
*/
|
|
57
|
+
this.saveTempAudioFile = (audioData) => (0, utils_1.logTimed)('saveTempAudioFile', (0, errors_1.safeAsync)(async () => {
|
|
58
|
+
const tempDir = os.tmpdir();
|
|
59
|
+
const fileName = `voicevox_${Date.now()}_${Math.random().toString(36).substring(2)}.wav`;
|
|
60
|
+
const filePath = path.join(tempDir, fileName);
|
|
61
|
+
const buffer = Buffer.from(audioData);
|
|
62
|
+
await fs.writeFile(filePath, buffer);
|
|
63
|
+
return filePath;
|
|
64
|
+
}, (error) => (0, errors_1.makeFileOperationError)('Failed to save audio data to temporary file', 'write', undefined, error)));
|
|
65
|
+
/**
|
|
66
|
+
* Save audio data to specific file path with Effect-based error handling
|
|
67
|
+
*/
|
|
68
|
+
this.saveAudioFile = (audioData, output, forceDownload = true) => (0, utils_1.logTimed)(`saveAudioFile-${output}`, (0, errors_1.safeAsync)(async () => {
|
|
69
|
+
const buffer = Buffer.from(audioData);
|
|
70
|
+
const outputPath = path.resolve(output);
|
|
71
|
+
// Ensure directory exists
|
|
72
|
+
const dir = path.dirname(outputPath);
|
|
73
|
+
await fs.mkdir(dir, { recursive: true });
|
|
74
|
+
await fs.writeFile(outputPath, buffer);
|
|
75
|
+
return outputPath;
|
|
76
|
+
}, (error) => (0, errors_1.makeFileOperationError)('Failed to save audio file', 'write', output, error)));
|
|
77
|
+
/**
|
|
78
|
+
* Delete temporary file with Effect-based error handling
|
|
79
|
+
*/
|
|
80
|
+
this.deleteTempFile = (filePath) => (0, utils_1.logTimed)(`deleteTempFile-${filePath}`, (0, errors_1.safeAsync)(async () => {
|
|
81
|
+
try {
|
|
82
|
+
await fs.unlink(filePath);
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
// Ignore file not found errors
|
|
86
|
+
if (error.code !== 'ENOENT') {
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}, (error) => (0, errors_1.makeFileOperationError)('Failed to delete temporary file', 'delete', filePath, error)));
|
|
91
|
+
/**
|
|
92
|
+
* Create temporary file path with Effect-based error handling
|
|
93
|
+
*/
|
|
94
|
+
this.createTempFilePath = () => (0, errors_1.safeSync)(() => {
|
|
95
|
+
const tempDir = os.tmpdir();
|
|
96
|
+
const fileName = `voicevox_${Date.now()}_${Math.random().toString(36).substring(2)}.wav`;
|
|
97
|
+
return path.join(tempDir, fileName);
|
|
98
|
+
}, (error) => (0, errors_1.makeFileOperationError)('Failed to create temporary file path', 'write', undefined, error));
|
|
99
|
+
/**
|
|
100
|
+
* Create blob URL with Effect-based error handling
|
|
101
|
+
*/
|
|
102
|
+
this.createBlobUrl = (blob) => (0, errors_1.safeSync)(() => {
|
|
103
|
+
if (typeof URL !== 'undefined' && URL.createObjectURL) {
|
|
104
|
+
const url = URL.createObjectURL(blob);
|
|
105
|
+
this.blobUrls.add(url);
|
|
106
|
+
return url;
|
|
107
|
+
}
|
|
108
|
+
throw new Error('Blob URL creation not supported in this environment');
|
|
109
|
+
}, (error) => (0, errors_1.makeFileOperationError)('Failed to create blob URL', 'write', undefined, error));
|
|
110
|
+
/**
|
|
111
|
+
* Release blob URL (infallible operation)
|
|
112
|
+
*/
|
|
113
|
+
this.releaseBlobUrl = (url) => effect_1.Effect.sync(() => {
|
|
114
|
+
if (typeof URL !== 'undefined' && URL.revokeObjectURL) {
|
|
115
|
+
URL.revokeObjectURL(url);
|
|
116
|
+
this.blobUrls.delete(url);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
/**
|
|
120
|
+
* Release all blob URLs (infallible operation)
|
|
121
|
+
*/
|
|
122
|
+
this.releaseAllBlobUrls = () => effect_1.Effect.sync(() => {
|
|
123
|
+
if (typeof URL !== 'undefined' && URL.revokeObjectURL) {
|
|
124
|
+
for (const url of this.blobUrls) {
|
|
125
|
+
URL.revokeObjectURL(url);
|
|
126
|
+
}
|
|
127
|
+
this.blobUrls.clear();
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
/**
|
|
131
|
+
* Create temporary file with automatic cleanup using Scope
|
|
132
|
+
*/
|
|
133
|
+
this.withTempFile = (audioData, use) => {
|
|
134
|
+
const self = this;
|
|
135
|
+
return effect_1.Effect.gen(function* () {
|
|
136
|
+
// Create temp file
|
|
137
|
+
const filePath = yield* self.saveTempAudioFile(audioData);
|
|
138
|
+
// Use the file with automatic cleanup
|
|
139
|
+
return yield* effect_1.Effect.acquireUseRelease(effect_1.Effect.succeed(filePath), use, (path) => self.deleteTempFile(path).pipe(effect_1.Effect.catchAll((error) => {
|
|
140
|
+
// Log cleanup errors but don't fail the operation
|
|
141
|
+
console.warn(`Failed to cleanup temp file ${path}:`, error);
|
|
142
|
+
return effect_1.Effect.void;
|
|
143
|
+
})));
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Batch delete multiple temporary files
|
|
148
|
+
*/
|
|
149
|
+
this.deleteMultipleTempFiles = (filePaths) => {
|
|
150
|
+
const self = this;
|
|
151
|
+
return effect_1.Effect.gen(function* () {
|
|
152
|
+
// Delete all files in parallel with limited concurrency
|
|
153
|
+
yield* effect_1.Effect.all(filePaths.map((path) => self.deleteTempFile(path)), { concurrency: 5 });
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Create multiple temporary files from audio data array
|
|
158
|
+
*/
|
|
159
|
+
this.saveMultipleTempAudioFiles = (audioDataArray) => {
|
|
160
|
+
const self = this;
|
|
161
|
+
return effect_1.Effect.gen(function* () {
|
|
162
|
+
// Save all files in parallel with limited concurrency
|
|
163
|
+
const filePaths = yield* effect_1.Effect.all(audioDataArray.map((data) => self.saveTempAudioFile(data)), { concurrency: 3 });
|
|
164
|
+
return filePaths;
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Get file size information (Node.js only, returns null in browser)
|
|
169
|
+
*/
|
|
170
|
+
this.getFileSize = (filePath) => (0, errors_1.safeAsync)(async () => {
|
|
171
|
+
try {
|
|
172
|
+
const stats = await fs.stat(filePath);
|
|
173
|
+
return stats.size;
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
if (error.code === 'ENOENT') {
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
throw error;
|
|
180
|
+
}
|
|
181
|
+
}, (error) => (0, errors_1.makeFileOperationError)('Failed to get file size', 'read', filePath, error));
|
|
182
|
+
/**
|
|
183
|
+
* Clean up all resources (blob URLs and temp files)
|
|
184
|
+
*/
|
|
185
|
+
this.cleanup = () => {
|
|
186
|
+
const self = this;
|
|
187
|
+
return effect_1.Effect.gen(function* () {
|
|
188
|
+
// Release all blob URLs
|
|
189
|
+
yield* self.releaseAllBlobUrls();
|
|
190
|
+
// Note: We can't automatically clean up all temp files since we don't track them
|
|
191
|
+
// This should be handled by the application or OS temp cleanup
|
|
192
|
+
});
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
exports.EffectFileManagerServiceImpl = EffectFileManagerServiceImpl;
|
|
197
|
+
/**
|
|
198
|
+
* Create FileManager service instance
|
|
199
|
+
*/
|
|
200
|
+
const makeEffectFileManagerService = () => effect_1.Effect.sync(() => new EffectFileManagerServiceImpl());
|
|
201
|
+
exports.makeEffectFileManagerService = makeEffectFileManagerService;
|
|
202
|
+
/**
|
|
203
|
+
* Layer providing Effect FileManager service
|
|
204
|
+
*/
|
|
205
|
+
exports.EffectFileManagerServiceLive = effect_1.Layer.effect(exports.EffectFileManagerContext, (0, exports.makeEffectFileManagerService)());
|
|
206
|
+
/**
|
|
207
|
+
* Scoped layer that automatically cleans up resources on scope close
|
|
208
|
+
*/
|
|
209
|
+
exports.EffectFileManagerServiceScoped = effect_1.Layer.scoped(exports.EffectFileManagerContext, effect_1.Effect.gen(function* () {
|
|
210
|
+
const service = yield* (0, exports.makeEffectFileManagerService)();
|
|
211
|
+
// Add finalizer to cleanup resources when scope closes
|
|
212
|
+
yield* effect_1.Effect.addFinalizer(() => service.cleanup());
|
|
213
|
+
return service;
|
|
214
|
+
}));
|
|
215
|
+
//# sourceMappingURL=file-manager-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-manager-service.js","sourceRoot":"","sources":["../../../src/effect/services/file-manager-service.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;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