@kajidog/voicevox-client 0.4.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/LICENSE +14 -14
  2. package/dist/accent-utils.d.ts +93 -0
  3. package/dist/accent-utils.d.ts.map +1 -0
  4. package/dist/accent-utils.js +211 -0
  5. package/dist/accent-utils.js.map +1 -0
  6. package/dist/api.d.ts +40 -2
  7. package/dist/api.d.ts.map +1 -1
  8. package/dist/api.js +90 -0
  9. package/dist/api.js.map +1 -1
  10. package/dist/cache-policy.d.ts +21 -0
  11. package/dist/cache-policy.d.ts.map +1 -0
  12. package/dist/cache-policy.js +31 -0
  13. package/dist/cache-policy.js.map +1 -0
  14. package/dist/client.d.ts +28 -119
  15. package/dist/client.d.ts.map +1 -1
  16. package/dist/client.js +48 -417
  17. package/dist/client.js.map +1 -1
  18. package/dist/effect/config.d.ts +43 -0
  19. package/dist/effect/config.d.ts.map +1 -0
  20. package/dist/effect/config.js +45 -0
  21. package/dist/effect/config.js.map +1 -0
  22. package/dist/effect/context.d.ts +33 -0
  23. package/dist/effect/context.d.ts.map +1 -0
  24. package/dist/effect/context.js +10 -0
  25. package/dist/effect/context.js.map +1 -0
  26. package/dist/effect/errors.d.ts +130 -0
  27. package/dist/effect/errors.d.ts.map +1 -0
  28. package/dist/effect/errors.js +121 -0
  29. package/dist/effect/errors.js.map +1 -0
  30. package/dist/effect/index.d.ts +34 -0
  31. package/dist/effect/index.d.ts.map +1 -0
  32. package/dist/effect/index.js +67 -0
  33. package/dist/effect/index.js.map +1 -0
  34. package/dist/effect/queue-manager.d.ts +34 -0
  35. package/dist/effect/queue-manager.d.ts.map +1 -0
  36. package/dist/effect/queue-manager.js +59 -0
  37. package/dist/effect/queue-manager.js.map +1 -0
  38. package/dist/effect/services/api-service.d.ts +58 -0
  39. package/dist/effect/services/api-service.d.ts.map +1 -0
  40. package/dist/effect/services/api-service.js +90 -0
  41. package/dist/effect/services/api-service.js.map +1 -0
  42. package/dist/effect/services/audio-generator-service.d.ts +78 -0
  43. package/dist/effect/services/audio-generator-service.d.ts.map +1 -0
  44. package/dist/effect/services/audio-generator-service.js +187 -0
  45. package/dist/effect/services/audio-generator-service.js.map +1 -0
  46. package/dist/effect/services/audio-player-service.d.ts +101 -0
  47. package/dist/effect/services/audio-player-service.d.ts.map +1 -0
  48. package/dist/effect/services/audio-player-service.js +297 -0
  49. package/dist/effect/services/audio-player-service.js.map +1 -0
  50. package/dist/effect/services/event-manager-service.d.ts +96 -0
  51. package/dist/effect/services/event-manager-service.d.ts.map +1 -0
  52. package/dist/effect/services/event-manager-service.js +208 -0
  53. package/dist/effect/services/event-manager-service.js.map +1 -0
  54. package/dist/effect/services/file-manager-service.d.ts +91 -0
  55. package/dist/effect/services/file-manager-service.d.ts.map +1 -0
  56. package/dist/effect/services/file-manager-service.js +215 -0
  57. package/dist/effect/services/file-manager-service.js.map +1 -0
  58. package/dist/effect/utils.d.ts +118 -0
  59. package/dist/effect/utils.d.ts.map +1 -0
  60. package/dist/effect/utils.js +186 -0
  61. package/dist/effect/utils.js.map +1 -0
  62. package/dist/error.js.map +1 -1
  63. package/dist/index.d.ts +3 -1
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +3 -1
  66. package/dist/index.js.map +1 -1
  67. package/dist/playback/node-playback-strategy.d.ts.map +1 -1
  68. package/dist/playback/node-playback-strategy.js +2 -6
  69. package/dist/playback/node-playback-strategy.js.map +1 -1
  70. package/dist/player.d.ts +110 -0
  71. package/dist/player.d.ts.map +1 -0
  72. package/dist/player.js +183 -0
  73. package/dist/player.js.map +1 -0
  74. package/dist/queue/audio-player.d.ts +44 -0
  75. package/dist/queue/audio-player.d.ts.map +1 -0
  76. package/dist/queue/audio-player.js +344 -0
  77. package/dist/queue/audio-player.js.map +1 -0
  78. package/dist/queue/file-manager.js +9 -9
  79. package/dist/queue/file-manager.js.map +1 -1
  80. package/dist/queue/manager.d.ts +134 -0
  81. package/dist/queue/manager.d.ts.map +1 -0
  82. package/dist/queue/manager.js +564 -0
  83. package/dist/queue/manager.js.map +1 -0
  84. package/dist/queue/queue-service.d.ts.map +1 -1
  85. package/dist/queue/queue-service.js +20 -6
  86. package/dist/queue/queue-service.js.map +1 -1
  87. package/dist/queue/types.d.ts +3 -1
  88. package/dist/queue/types.d.ts.map +1 -1
  89. package/dist/queue/types.js.map +1 -1
  90. package/dist/services/dictionary-service.d.ts +35 -0
  91. package/dist/services/dictionary-service.d.ts.map +1 -0
  92. package/dist/services/dictionary-service.js +188 -0
  93. package/dist/services/dictionary-service.js.map +1 -0
  94. package/dist/services/speech-service.d.ts +43 -0
  95. package/dist/services/speech-service.d.ts.map +1 -0
  96. package/dist/services/speech-service.js +236 -0
  97. package/dist/services/speech-service.js.map +1 -0
  98. package/dist/shared-queue-manager.d.ts +119 -0
  99. package/dist/shared-queue-manager.d.ts.map +1 -0
  100. package/dist/shared-queue-manager.js +487 -0
  101. package/dist/shared-queue-manager.js.map +1 -0
  102. package/dist/state/queue-state-machine.d.ts.map +1 -1
  103. package/dist/state/queue-state-machine.js +13 -0
  104. package/dist/state/queue-state-machine.js.map +1 -1
  105. package/dist/state/types.d.ts +2 -0
  106. package/dist/state/types.d.ts.map +1 -1
  107. package/dist/state/types.js.map +1 -1
  108. package/dist/types.d.ts +28 -0
  109. package/dist/types.d.ts.map +1 -1
  110. package/dist/utils.d.ts +16 -0
  111. package/dist/utils.d.ts.map +1 -1
  112. package/dist/utils.js +36 -0
  113. package/dist/utils.js.map +1 -1
  114. package/package.json +1 -1
@@ -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,KA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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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,mCAA2D;AAC3D,qDAAsC;AACtC,gDAAiC;AACjC,4CAA6B;AAC7B,sCAAgG;AAChG,oCAAmC;AAoBtB,QAAA,wBAAwB,GAAG,gBAAO,CAAC,UAAU,CAA2B,6BAA6B,CAAC,CAAA;AAEnH;;GAEG;AACH,MAAa,4BAA4B;IAAzC;QACU,aAAQ,GAAG,IAAI,GAAG,EAAU,CAAA;QAEpC;;WAEG;QACH,sBAAiB,GAAG,CAAC,SAAsB,EAA6C,EAAE,CACxF,IAAA,gBAAQ,EACN,mBAAmB,EACnB,IAAA,kBAAS,EACP,KAAK,IAAI,EAAE;YACT,MAAM,OAAO,GAAG,EAAE,CAAC,MAAM,EAAE,CAAA;YAC3B,MAAM,QAAQ,GAAG,YAAY,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAA;YACxF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;YAE7C,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YACrC,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;YAE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and common patterns
3
+ * Provides reusable Effect combinators for the VOICEVOX system
4
+ */
5
+ import { Deferred, Duration, Effect, Option } from 'effect';
6
+ /**
7
+ * Resource management utilities
8
+ */
9
+ /**
10
+ * Safely execute an operation with automatic cleanup
11
+ */
12
+ export declare const withResource: <R, E, A, B>(acquire: Effect.Effect<A, E, R>, release: (resource: A) => Effect.Effect<void, never, R>, use: (resource: A) => Effect.Effect<B, E, R>) => Effect.Effect<B, E, R>;
13
+ /**
14
+ * Manage a temporary file with automatic cleanup
15
+ */
16
+ export declare const withTempFile: <R, E, A>(createFile: () => Effect.Effect<string, E, R>, deleteFile: (path: string) => Effect.Effect<void, never, R>, use: (filePath: string) => Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
17
+ /**
18
+ * Async coordination utilities
19
+ */
20
+ /**
21
+ * Create a deferred promise that can be resolved later
22
+ */
23
+ export declare const createDeferred: <A>() => Effect.Effect<Deferred.Deferred<A, never>, never>;
24
+ /**
25
+ * Wait for a condition to be true with timeout
26
+ */
27
+ export declare const waitForCondition: <R, E>(condition: Effect.Effect<boolean, E, R>, timeout: Duration.Duration, checkInterval?: Duration.Duration) => Effect.Effect<void, E | Error, R>;
28
+ /**
29
+ * Execute effects in parallel with concurrency limit
30
+ */
31
+ export declare const parallelWithLimit: <R, E, A>(effects: readonly Effect.Effect<A, E, R>[], concurrency: number) => Effect.Effect<readonly A[], E, R>;
32
+ /**
33
+ * Queue utilities
34
+ */
35
+ /**
36
+ * Process items from a queue with a given processor function
37
+ */
38
+ export declare const processQueueItems: <A, R, E>(getItems: Effect.Effect<readonly A[], E, R>, processItem: (item: A) => Effect.Effect<void, E, R>, maxConcurrency?: number) => Effect.Effect<void, E, R>;
39
+ /**
40
+ * State management utilities
41
+ */
42
+ /**
43
+ * Create a thread-safe counter
44
+ */
45
+ export declare const createCounter: (initialValue?: number) => Effect.Effect<{
46
+ readonly increment: Effect.Effect<number, never>;
47
+ readonly decrement: Effect.Effect<number, never>;
48
+ readonly get: Effect.Effect<number, never>;
49
+ readonly set: (value: number) => Effect.Effect<void, never>;
50
+ }, never>;
51
+ /**
52
+ * Create a thread-safe boolean flag
53
+ */
54
+ export declare const createFlag: (initialValue?: boolean) => Effect.Effect<{
55
+ readonly set: Effect.Effect<void, never>;
56
+ readonly unset: Effect.Effect<void, never>;
57
+ readonly get: Effect.Effect<boolean, never>;
58
+ readonly toggle: Effect.Effect<boolean, never>;
59
+ }, never>;
60
+ /**
61
+ * Scheduling utilities
62
+ */
63
+ /**
64
+ * Execute with timeout
65
+ */
66
+ export declare const withTimeout: <R, E, A>(effect: Effect.Effect<A, E, R>, timeout: Duration.Duration) => Effect.Effect<A, E | Error, R>;
67
+ /**
68
+ * Logging utilities
69
+ */
70
+ /**
71
+ * Log an effect's execution with timing
72
+ */
73
+ export declare const logTimed: <R, E, A>(label: string, effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
74
+ /**
75
+ * Collection utilities
76
+ */
77
+ /**
78
+ * Find the first item in a collection that matches a predicate
79
+ */
80
+ export declare const findFirst: <A>(items: readonly A[], predicate: (item: A) => boolean) => Option.Option<A>;
81
+ /**
82
+ * Remove an item from an array by ID
83
+ */
84
+ export declare const removeById: <A extends {
85
+ id: string;
86
+ }>(items: readonly A[], id: string) => readonly A[];
87
+ /**
88
+ * Update an item in an array by ID
89
+ */
90
+ export declare const updateById: <A extends {
91
+ id: string;
92
+ }>(items: readonly A[], id: string, updater: (item: A) => A) => readonly A[];
93
+ /**
94
+ * Error handling utilities
95
+ */
96
+ /**
97
+ * Catch and transform errors
98
+ */
99
+ export declare const catchAndMap: <R, E1, E2, A>(effect: Effect.Effect<A, E1, R>, mapper: (error: E1) => E2) => Effect.Effect<A, E2, R>;
100
+ /**
101
+ * Provide a fallback value in case of error
102
+ */
103
+ export declare const orElse: <R, E, A>(effect: Effect.Effect<A, E, R>, fallback: A) => Effect.Effect<A, never, R>;
104
+ /**
105
+ * Convert common patterns to Effect-friendly operations
106
+ */
107
+ /**
108
+ * Convert a callback-based operation to Effect
109
+ */
110
+ export declare const fromCallback: <A, E = Error>(fn: (callback: (error: E | null, result?: A) => void) => void) => Effect.Effect<A, E>;
111
+ /**
112
+ * Convert an event-based operation to Effect with timeout
113
+ */
114
+ export declare const fromEvent: <A>(target: {
115
+ addEventListener: (eventName: string, handler: (event: A) => void) => void;
116
+ removeEventListener: (eventName: string, handler: (event: A) => void) => void;
117
+ }, eventName: string, timeout?: Duration.Duration) => Effect.Effect<A, Error>;
118
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/effect/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAwB,MAAM,QAAQ,CAAA;AAGjF;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EACrC,SAAS,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC/B,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,EACvD,KAAK,CAAC,QAAQ,EAAE,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAC3C,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAoD,CAAA;AAE5E;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAClC,YAAY,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,EAC7C,YAAY,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,E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,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,KAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAC3C,CAAA;AAE5D;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,CAAC,GAAG,KAAK,EACvC,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,KAAK,IAAI,KAAK,IAAI,KAC5D,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAWjB,CAAA;AAEJ;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,EACzB,QAAQ;IACN,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,KAAK,IAAI,CAAA;IAC1E,mBAAmB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,KAAK,IAAI,CAAA;CAC9E,EACD,WAAW,MAAM,EACjB,UAAU,QAAQ,CAAC,QAAQ,KAC1B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAmBrB,CAAA"}
@@ -0,0 +1,186 @@
1
+ "use strict";
2
+ /**
3
+ * Effect utility functions and common patterns
4
+ * Provides reusable Effect combinators for the VOICEVOX system
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.fromEvent = exports.fromCallback = exports.orElse = exports.catchAndMap = exports.updateById = exports.removeById = exports.findFirst = exports.logTimed = exports.withTimeout = exports.createFlag = exports.createCounter = exports.processQueueItems = exports.parallelWithLimit = exports.waitForCondition = exports.createDeferred = exports.withTempFile = exports.withResource = void 0;
8
+ const effect_1 = require("effect");
9
+ /**
10
+ * Resource management utilities
11
+ */
12
+ /**
13
+ * Safely execute an operation with automatic cleanup
14
+ */
15
+ const withResource = (acquire, release, use) => effect_1.Effect.acquireUseRelease(acquire, use, release);
16
+ exports.withResource = withResource;
17
+ /**
18
+ * Manage a temporary file with automatic cleanup
19
+ */
20
+ const withTempFile = (createFile, deleteFile, use) => (0, exports.withResource)(createFile(), deleteFile, use);
21
+ exports.withTempFile = withTempFile;
22
+ /**
23
+ * Async coordination utilities
24
+ */
25
+ /**
26
+ * Create a deferred promise that can be resolved later
27
+ */
28
+ const createDeferred = () => effect_1.Deferred.make();
29
+ exports.createDeferred = createDeferred;
30
+ /**
31
+ * Wait for a condition to be true with timeout
32
+ */
33
+ const waitForCondition = (condition, timeout, checkInterval = effect_1.Duration.millis(50)) => effect_1.Effect.gen(function* () {
34
+ const deadline = yield* effect_1.Effect.sync(() => Date.now() + effect_1.Duration.toMillis(timeout));
35
+ while (true) {
36
+ const isReady = yield* condition;
37
+ if (isReady)
38
+ return;
39
+ if (Date.now() > deadline) {
40
+ throw new Error('Condition timeout');
41
+ }
42
+ yield* effect_1.Effect.sleep(checkInterval);
43
+ }
44
+ });
45
+ exports.waitForCondition = waitForCondition;
46
+ /**
47
+ * Execute effects in parallel with concurrency limit
48
+ */
49
+ const parallelWithLimit = (effects, concurrency) => effect_1.Effect.all(effects, { concurrency });
50
+ exports.parallelWithLimit = parallelWithLimit;
51
+ /**
52
+ * Queue utilities
53
+ */
54
+ /**
55
+ * Process items from a queue with a given processor function
56
+ */
57
+ const processQueueItems = (getItems, processItem, maxConcurrency = 1) => effect_1.Effect.gen(function* () {
58
+ const items = yield* getItems;
59
+ if (items.length === 0)
60
+ return;
61
+ yield* (0, exports.parallelWithLimit)(items.map(processItem), maxConcurrency);
62
+ });
63
+ exports.processQueueItems = processQueueItems;
64
+ /**
65
+ * State management utilities
66
+ */
67
+ /**
68
+ * Create a thread-safe counter
69
+ */
70
+ const createCounter = (initialValue = 0) => effect_1.Effect.gen(function* () {
71
+ const ref = yield* effect_1.Ref.make(initialValue);
72
+ return {
73
+ increment: effect_1.Ref.updateAndGet(ref, (n) => n + 1),
74
+ decrement: effect_1.Ref.updateAndGet(ref, (n) => n - 1),
75
+ get: effect_1.Ref.get(ref),
76
+ set: (value) => effect_1.Ref.set(ref, value),
77
+ };
78
+ });
79
+ exports.createCounter = createCounter;
80
+ /**
81
+ * Create a thread-safe boolean flag
82
+ */
83
+ const createFlag = (initialValue = false) => effect_1.Effect.gen(function* () {
84
+ const ref = yield* effect_1.Ref.make(initialValue);
85
+ return {
86
+ set: effect_1.Ref.set(ref, true),
87
+ unset: effect_1.Ref.set(ref, false),
88
+ get: effect_1.Ref.get(ref),
89
+ toggle: effect_1.Ref.updateAndGet(ref, (b) => !b),
90
+ };
91
+ });
92
+ exports.createFlag = createFlag;
93
+ /**
94
+ * Scheduling utilities
95
+ */
96
+ /**
97
+ * Execute with timeout
98
+ */
99
+ const withTimeout = (effect, timeout) => effect_1.Effect.race(effect, effect_1.Effect.sleep(timeout).pipe(effect_1.Effect.andThen(effect_1.Effect.fail(new Error(`Operation timed out after ${effect_1.Duration.toMillis(timeout)}ms`)))));
100
+ exports.withTimeout = withTimeout;
101
+ /**
102
+ * Logging utilities
103
+ */
104
+ /**
105
+ * Log an effect's execution with timing
106
+ */
107
+ const logTimed = (label, effect) => effect_1.Effect.gen(function* () {
108
+ const start = yield* effect_1.Effect.sync(() => Date.now());
109
+ yield* effect_1.Effect.log(`[${label}] Starting...`);
110
+ const result = yield* effect;
111
+ const end = yield* effect_1.Effect.sync(() => Date.now());
112
+ yield* effect_1.Effect.log(`[${label}] Completed in ${end - start}ms`);
113
+ return result;
114
+ });
115
+ exports.logTimed = logTimed;
116
+ /**
117
+ * Collection utilities
118
+ */
119
+ /**
120
+ * Find the first item in a collection that matches a predicate
121
+ */
122
+ const findFirst = (items, predicate) => effect_1.Option.fromNullable(items.find(predicate));
123
+ exports.findFirst = findFirst;
124
+ /**
125
+ * Remove an item from an array by ID
126
+ */
127
+ const removeById = (items, id) => items.filter((item) => item.id !== id);
128
+ exports.removeById = removeById;
129
+ /**
130
+ * Update an item in an array by ID
131
+ */
132
+ const updateById = (items, id, updater) => items.map((item) => (item.id === id ? updater(item) : item));
133
+ exports.updateById = updateById;
134
+ /**
135
+ * Error handling utilities
136
+ */
137
+ /**
138
+ * Catch and transform errors
139
+ */
140
+ const catchAndMap = (effect, mapper) => effect.pipe(effect_1.Effect.catchAll((error) => effect_1.Effect.fail(mapper(error))));
141
+ exports.catchAndMap = catchAndMap;
142
+ /**
143
+ * Provide a fallback value in case of error
144
+ */
145
+ const orElse = (effect, fallback) => effect.pipe(effect_1.Effect.orElse(() => effect_1.Effect.succeed(fallback)));
146
+ exports.orElse = orElse;
147
+ /**
148
+ * Convert common patterns to Effect-friendly operations
149
+ */
150
+ /**
151
+ * Convert a callback-based operation to Effect
152
+ */
153
+ const fromCallback = (fn) => effect_1.Effect.async((resume) => {
154
+ fn((error, result) => {
155
+ if (error) {
156
+ resume(effect_1.Effect.fail(error));
157
+ }
158
+ else if (result !== undefined) {
159
+ resume(effect_1.Effect.succeed(result));
160
+ }
161
+ else {
162
+ resume(effect_1.Effect.fail(new Error('No result provided')));
163
+ }
164
+ });
165
+ });
166
+ exports.fromCallback = fromCallback;
167
+ /**
168
+ * Convert an event-based operation to Effect with timeout
169
+ */
170
+ const fromEvent = (target, eventName, timeout) => effect_1.Effect.async((resume) => {
171
+ const handler = (event) => {
172
+ target.removeEventListener(eventName, handler);
173
+ resume(effect_1.Effect.succeed(event));
174
+ };
175
+ target.addEventListener(eventName, handler);
176
+ if (timeout) {
177
+ const timeoutId = setTimeout(() => {
178
+ target.removeEventListener(eventName, handler);
179
+ resume(effect_1.Effect.fail(new Error(`Event ${eventName} timed out`)));
180
+ }, effect_1.Duration.toMillis(timeout));
181
+ return effect_1.Effect.sync(() => clearTimeout(timeoutId));
182
+ }
183
+ return effect_1.Effect.void;
184
+ });
185
+ exports.fromEvent = fromEvent;
186
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @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