unikvs 0.0.10 → 0.0.13

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 (77) hide show
  1. package/README.md +3 -0
  2. package/dist/index.d.ts +1553 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +4032 -0
  5. package/dist/index.js.map +1 -0
  6. package/package.json +35 -34
  7. package/src/_contexts.ts +1089 -0
  8. package/src/_logger.ts +5 -3
  9. package/src/_middleware.ts +207 -0
  10. package/src/_pipeline-graph.helpers.ts +183 -0
  11. package/src/_pipeline-graph.ts +1307 -0
  12. package/src/_pipeline-graph.types.ts +303 -0
  13. package/src/_pipeline-leaf-resolver.ts +70 -0
  14. package/src/_plugin-lifecycle.ts +201 -0
  15. package/src/_storage.ts +173 -96
  16. package/src/_streams.schemas.ts +21 -0
  17. package/src/_streams.ts +73 -0
  18. package/src/_to-value-stream.ts +22 -11
  19. package/src/_types.ts +237 -0
  20. package/src/_unikvs-branch.ts +94 -0
  21. package/src/_unikvs.schemas.ts +451 -0
  22. package/src/_valibot.ts +17 -3
  23. package/src/_value-schemas.ts +192 -0
  24. package/src/_value-validation.ts +57 -0
  25. package/src/errors.ts +446 -252
  26. package/src/index.ts +46 -26
  27. package/src/types.ts +13 -0
  28. package/src/unikvs-branch.ts +445 -0
  29. package/src/unikvs-builder.ts +706 -0
  30. package/src/unikvs.ts +1456 -971
  31. package/src/unikvs.types.ts +194 -0
  32. package/src/value-schemas.ts +98 -0
  33. package/dist/src/_logger.d.ts +0 -3
  34. package/dist/src/_logger.d.ts.map +0 -1
  35. package/dist/src/_logger.js +0 -3
  36. package/dist/src/_merge-context.d.ts +0 -13
  37. package/dist/src/_merge-context.d.ts.map +0 -1
  38. package/dist/src/_merge-context.js +0 -12
  39. package/dist/src/_storage.d.ts +0 -18
  40. package/dist/src/_storage.d.ts.map +0 -1
  41. package/dist/src/_storage.js +0 -94
  42. package/dist/src/_to-value-stream.d.ts +0 -12
  43. package/dist/src/_to-value-stream.d.ts.map +0 -1
  44. package/dist/src/_to-value-stream.js +0 -102
  45. package/dist/src/_transformer.d.ts +0 -13
  46. package/dist/src/_transformer.d.ts.map +0 -1
  47. package/dist/src/_transformer.js +0 -60
  48. package/dist/src/_valibot.d.ts +0 -15
  49. package/dist/src/_valibot.d.ts.map +0 -1
  50. package/dist/src/_valibot.js +0 -23
  51. package/dist/src/context.types.d.ts +0 -17
  52. package/dist/src/context.types.d.ts.map +0 -1
  53. package/dist/src/context.types.js +0 -1
  54. package/dist/src/errors.d.ts +0 -340
  55. package/dist/src/errors.d.ts.map +0 -1
  56. package/dist/src/errors.js +0 -250
  57. package/dist/src/index.d.ts +0 -10
  58. package/dist/src/index.d.ts.map +0 -1
  59. package/dist/src/index.js +0 -3
  60. package/dist/src/unikvs-config.d.ts +0 -255
  61. package/dist/src/unikvs-config.d.ts.map +0 -1
  62. package/dist/src/unikvs-config.js +0 -105
  63. package/dist/src/unikvs.d.ts +0 -354
  64. package/dist/src/unikvs.d.ts.map +0 -1
  65. package/dist/src/unikvs.js +0 -867
  66. package/dist/src/utils.types.d.ts +0 -7
  67. package/dist/src/utils.types.d.ts.map +0 -1
  68. package/dist/src/utils.types.js +0 -1
  69. package/dist/src/value-stream.types.d.ts +0 -16
  70. package/dist/src/value-stream.types.d.ts.map +0 -1
  71. package/dist/src/value-stream.types.js +0 -1
  72. package/src/_merge-context.ts +0 -19
  73. package/src/_transformer.ts +0 -89
  74. package/src/context.types.ts +0 -19
  75. package/src/unikvs-config.ts +0 -426
  76. package/src/utils.types.ts +0 -6
  77. package/src/value-stream.types.ts +0 -19
package/src/errors.ts CHANGED
@@ -1,68 +1,54 @@
1
1
  import {
2
- setErrorMessage,
3
- ErrorBase,
4
2
  type ErrorOptions,
5
- type ErrorMeta,
6
- type IStorage,
3
+ ErrorBase,
4
+ setErrorMessage,
5
+ KeyNotFoundError,
6
+ InvalidUsageErrorBase,
7
7
  } from "@unikvs/core";
8
8
  import type { BaseIssue } from "valibot";
9
9
 
10
- // -------------------------------------------------------------------------------------------------
11
- //
12
- // 境界エラー
13
- //
14
- // -------------------------------------------------------------------------------------------------
10
+ export { KeyNotFoundError, InvalidUsageErrorBase };
11
+ export type { KeyNotFoundErrorArgs, KeyNotFoundErrorMeta } from "@unikvs/core";
15
12
 
16
- /**
17
- * 無効な入出力を表すエラーの基底クラスです。
18
- *
19
- * @template TMeta エラーのメタデータの型です。
20
- */
21
- export class InvalidUsageErrorBase<
22
- TMeta extends ErrorMeta | undefined = ErrorMeta | undefined,
23
- > extends ErrorBase<TMeta> {}
24
-
25
- // -------------------------------------------------------------------------------------------------
13
+ // -------------------------------------------------------------------------------------------------。
26
14
 
27
15
  /**
28
- * バリデーションの問題を表す valibot のイシューです。
16
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
29
17
  */
30
18
  export type Issue = BaseIssue<unknown>;
31
19
 
32
20
  /**
33
- * InvalidInputError に付与されるメタデータです。
21
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
34
22
  */
35
23
  export type InvalidInputErrorMeta = {
36
24
  /**
37
- * 検証に失敗した入力値です。
25
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
38
26
  */
39
27
  readonly input: unknown;
40
28
 
41
29
  /**
42
- * 検証で検出されたイシューのリストです。
30
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
43
31
  */
44
32
  readonly issues: readonly [Issue, ...Issue[]];
45
33
  };
46
34
 
47
35
  /**
48
- * InvalidInputError のコンストラクター引数です。
49
- *
50
- * エラーの追加情報 (`cause`) も含みます。
36
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
51
37
  */
52
38
  export type InvalidInputErrorArgs = ErrorOptions & {
53
39
  /**
54
- * 検証の対象となった値です。
40
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
55
41
  */
56
42
  readonly value: unknown;
57
43
 
58
44
  /**
59
- * 検証で検出されたイシューのリストです。
45
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
60
46
  */
61
47
  readonly issues: readonly [Issue, ...Issue[]];
62
48
  };
63
49
 
64
50
  /**
65
- * 入力値が期待するスキーマに適合しない場合に投げられるエラーです。
51
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
66
52
  */
67
53
  export class InvalidInputError extends InvalidUsageErrorBase<InvalidInputErrorMeta> {
68
54
  static {
@@ -71,47 +57,52 @@ export class InvalidInputError extends InvalidUsageErrorBase<InvalidInputErrorMe
71
57
 
72
58
  public constructor(args: InvalidInputErrorArgs) {
73
59
  const { value: input, issues, ...options } = args;
74
- const meta: InvalidInputErrorMeta = { input, issues };
75
- super(meta, ({ issues }) => issues.map((i) => i.message).join(": "), options);
60
+ const meta: InvalidInputErrorMeta = {
61
+ input,
62
+ issues,
63
+ };
64
+ super(
65
+ meta,
66
+ ({ issues: messageIssues }) => messageIssues.map((i) => i.message).join(": "),
67
+ options,
68
+ );
76
69
  }
77
70
  }
78
71
 
79
- // -------------------------------------------------------------------------------------------------
72
+ // -------------------------------------------------------------------------------------------------。
80
73
 
81
74
  /**
82
- * InvalidOutputError に付与されるメタデータです。
75
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
83
76
  */
84
77
  export type InvalidOutputErrorMeta = {
85
78
  /**
86
- * 検証に失敗した出力値です。
79
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
87
80
  */
88
81
  readonly output: unknown;
89
82
 
90
83
  /**
91
- * 検証で検出されたイシューのリストです。
84
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
92
85
  */
93
86
  readonly issues: readonly [Issue, ...Issue[]];
94
87
  };
95
88
 
96
89
  /**
97
- * InvalidOutputError のコンストラクター引数です。
98
- *
99
- * エラーの追加情報 (`cause`) も含みます。
90
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
100
91
  */
101
92
  export type InvalidOutputErrorArgs = ErrorOptions & {
102
93
  /**
103
- * 検証の対象となった値です。
94
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
104
95
  */
105
96
  readonly value: unknown;
106
97
 
107
98
  /**
108
- * 検証で検出されたイシューのリストです。
99
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
109
100
  */
110
101
  readonly issues: readonly [Issue, ...Issue[]];
111
102
  };
112
103
 
113
104
  /**
114
- * 出力値が期待するスキーマに適合しない場合に投げられるエラーです。
105
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
115
106
  */
116
107
  export class InvalidOutputError extends InvalidUsageErrorBase<InvalidOutputErrorMeta> {
117
108
  static {
@@ -120,19 +111,26 @@ export class InvalidOutputError extends InvalidUsageErrorBase<InvalidOutputError
120
111
 
121
112
  public constructor(args: InvalidOutputErrorArgs) {
122
113
  const { value: output, issues, ...options } = args;
123
- const meta: InvalidOutputErrorMeta = { output, issues };
124
- super(meta, ({ issues }) => issues.map((i) => i.message).join(": "), options);
114
+ const meta: InvalidOutputErrorMeta = {
115
+ issues,
116
+ output,
117
+ };
118
+ super(
119
+ meta,
120
+ ({ issues: messageIssues }) => messageIssues.map((i) => i.message).join(": "),
121
+ options,
122
+ );
125
123
  }
126
124
  }
127
125
 
128
- // -------------------------------------------------------------------------------------------------
126
+ // -------------------------------------------------------------------------------------------------。
129
127
  //
130
- // UniKvs
128
+ // UniKvs。
131
129
  //
132
- // -------------------------------------------------------------------------------------------------
130
+ // -------------------------------------------------------------------------------------------------。
133
131
 
134
132
  /**
135
- * すでに開いている UniKvs に対して再度オープン操作が行われた場合に投げられるエラーです。
133
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
136
134
  */
137
135
  export class UniKvsIsOpenError extends ErrorBase<undefined> {
138
136
  static {
@@ -147,7 +145,7 @@ export class UniKvsIsOpenError extends ErrorBase<undefined> {
147
145
  setErrorMessage(UniKvsIsOpenError, "UniKvs は開いています", "ja");
148
146
 
149
147
  /**
150
- * UniKvs が開かれていない状態で操作が行われた場合に投げられるエラーです。
148
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
151
149
  */
152
150
  export class UniKvsIsNotOpenError extends ErrorBase<undefined> {
153
151
  static {
@@ -161,87 +159,29 @@ export class UniKvsIsNotOpenError extends ErrorBase<undefined> {
161
159
 
162
160
  setErrorMessage(UniKvsIsNotOpenError, "UniKvs は開いていません", "ja");
163
161
 
164
- /**
165
- * KeyNotFoundError に付与されるメタデータです。
166
- */
167
- export type KeyNotFoundErrorMeta = {
168
- /**
169
- * 見つからなかったキーです。
170
- */
171
- readonly key: IStorage.Key;
172
- };
173
-
174
- /**
175
- * KeyNotFoundError のコンストラクター引数です。
176
- *
177
- * エラーの追加情報 (`cause`) も含みます。
178
- */
179
- export type KeyNotFoundErrorArgs = ErrorOptions & KeyNotFoundErrorMeta;
180
-
181
- /**
182
- * 指定したキーのデータがどのストレージにも存在しない場合に投げられるエラーです。
183
- */
184
- export class KeyNotFoundError extends ErrorBase<KeyNotFoundErrorMeta> {
185
- static {
186
- this.prototype.name = "UniKvsKeyNotFoundError";
187
- }
188
-
189
- public constructor(args: KeyNotFoundErrorArgs) {
190
- const { key, ...options } = args;
191
- const meta: KeyNotFoundErrorMeta = { key };
192
- super(meta, ({ key }) => `IStorage.Key ${JSON.stringify(key)} not found`, options);
193
- }
194
- }
195
-
196
- setErrorMessage(
197
- KeyNotFoundError,
198
- ({ key }) => `キー ${JSON.stringify(key)} が見つかりません`,
199
- "ja",
200
- );
201
-
202
- // -------------------------------------------------------------------------------------------------
162
+ // -------------------------------------------------------------------------------------------------。
203
163
  //
204
- // ストレージ
164
+ // ストレージ。
205
165
  //
206
- // -------------------------------------------------------------------------------------------------
207
-
208
- // export type StorageIsOpenErrorMeta = {
209
- // readonly name: string;
210
- // };
211
-
212
- // export type StorageIsOpenErrorArgs = StorageIsOpenErrorMeta;
213
-
214
- // export class StorageIsOpenError extends ErrorBase<StorageIsOpenErrorMeta> {
215
- // static {
216
- // this.prototype.name = "UniKvsStorageIsOpenError";
217
- // }
218
-
219
- // public constructor(args: StorageIsOpenErrorArgs, options?: ErrorOptions) {
220
- // super(args, ({ name }) => `Storage "${name}" is open`, options);
221
- // }
222
- // }
223
-
224
- // setErrorMessage(StorageIsOpenError, ({ name }) => `ストレージ "${name}" は開いています`, "ja");
166
+ // -------------------------------------------------------------------------------------------------。
225
167
 
226
168
  /**
227
- * StorageIsNotOpenError に付与されるメタデータです。
169
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
228
170
  */
229
171
  export type StorageIsNotOpenErrorMeta = {
230
172
  /**
231
- * 開かれていないストレージの名前です。
173
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
232
174
  */
233
175
  readonly name: string;
234
176
  };
235
177
 
236
178
  /**
237
- * StorageIsNotOpenError のコンストラクター引数です。
238
- *
239
- * エラーの追加情報 (`cause`) も含みます。
179
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
240
180
  */
241
181
  export type StorageIsNotOpenErrorArgs = ErrorOptions & StorageIsNotOpenErrorMeta;
242
182
 
243
183
  /**
244
- * ストレージが開かれていない状態で操作が行われた場合に投げられるエラーです。
184
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
245
185
  */
246
186
  export class StorageIsNotOpenError extends ErrorBase<StorageIsNotOpenErrorMeta> {
247
187
  static {
@@ -251,32 +191,30 @@ export class StorageIsNotOpenError extends ErrorBase<StorageIsNotOpenErrorMeta>
251
191
  public constructor(args: StorageIsNotOpenErrorArgs) {
252
192
  const { name, ...options } = args;
253
193
  const meta: StorageIsNotOpenErrorMeta = { name };
254
- super(meta, ({ name }) => `Storage "${name}" is not open`, options);
194
+ super(meta, ({ name: messageName }) => `Storage "${messageName}" is not open`, options);
255
195
  }
256
196
  }
257
197
 
258
198
  setErrorMessage(StorageIsNotOpenError, ({ name }) => `ストレージ "${name}" は開いていません`, "ja");
259
199
 
260
200
  /**
261
- * WritableStreamNotSupportedError に付与されるメタデータです。
201
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
262
202
  */
263
203
  export type WritableStreamNotSupportedErrorMeta = {
264
204
  /**
265
- * 対象のストレージの名前です。
205
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
266
206
  */
267
207
  readonly name: string;
268
208
  };
269
209
 
270
210
  /**
271
- * WritableStreamNotSupportedError のコンストラクター引数です。
272
- *
273
- * エラーの追加情報 (`cause`) も含みます。
211
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
274
212
  */
275
213
  export type WritableStreamNotSupportedErrorArgs = ErrorOptions &
276
214
  WritableStreamNotSupportedErrorMeta;
277
215
 
278
216
  /**
279
- * ストレージが書き込み可能なストリームをサポートしていない場合に投げられるエラーです。
217
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
280
218
  */
281
219
  export class WritableStreamNotSupportedError extends ErrorBase<WritableStreamNotSupportedErrorMeta> {
282
220
  static {
@@ -286,7 +224,11 @@ export class WritableStreamNotSupportedError extends ErrorBase<WritableStreamNot
286
224
  public constructor(args: WritableStreamNotSupportedErrorArgs) {
287
225
  const { name, ...options } = args;
288
226
  const meta: WritableStreamNotSupportedErrorMeta = { name };
289
- super(meta, ({ name }) => `Storage "${name}" does not support writable stream`, options);
227
+ super(
228
+ meta,
229
+ ({ name: messageName }) => `Storage "${messageName}" does not support writable stream`,
230
+ options,
231
+ );
290
232
  }
291
233
  }
292
234
 
@@ -297,25 +239,23 @@ setErrorMessage(
297
239
  );
298
240
 
299
241
  /**
300
- * ReadableStreamNotSupportedError に付与されるメタデータです。
242
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
301
243
  */
302
244
  export type ReadableStreamNotSupportedErrorMeta = {
303
245
  /**
304
- * 対象のストレージの名前です。
246
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
305
247
  */
306
248
  readonly name: string;
307
249
  };
308
250
 
309
251
  /**
310
- * ReadableStreamNotSupportedError のコンストラクター引数です。
311
- *
312
- * エラーの追加情報 (`cause`) も含みます。
252
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
313
253
  */
314
254
  export type ReadableStreamNotSupportedErrorArgs = ErrorOptions &
315
255
  ReadableStreamNotSupportedErrorMeta;
316
256
 
317
257
  /**
318
- * ストレージが読み取り可能なストリームをサポートしていない場合に投げられるエラーです。
258
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
319
259
  */
320
260
  export class ReadableStreamNotSupportedError extends ErrorBase<ReadableStreamNotSupportedErrorMeta> {
321
261
  static {
@@ -325,7 +265,11 @@ export class ReadableStreamNotSupportedError extends ErrorBase<ReadableStreamNot
325
265
  public constructor(args: ReadableStreamNotSupportedErrorArgs) {
326
266
  const { name, ...options } = args;
327
267
  const meta: ReadableStreamNotSupportedErrorMeta = { name };
328
- super(meta, ({ name }) => `Storage "${name}" does not support readable stream`, options);
268
+ super(
269
+ meta,
270
+ ({ name: messageName }) => `Storage "${messageName}" does not support readable stream`,
271
+ options,
272
+ );
329
273
  }
330
274
  }
331
275
 
@@ -364,7 +308,11 @@ export class MultipartWriteNotSupportedError extends ErrorBase<MultipartWriteNot
364
308
  public constructor(args: MultipartWriteNotSupportedErrorArgs) {
365
309
  const { name, ...options } = args;
366
310
  const meta: MultipartWriteNotSupportedErrorMeta = { name };
367
- super(meta, ({ name }) => `Storage "${name}" does not support multipart-write`, options);
311
+ super(
312
+ meta,
313
+ ({ name: messageName }) => `Storage "${messageName}" does not support multipart-write`,
314
+ options,
315
+ );
368
316
  }
369
317
  }
370
318
 
@@ -374,222 +322,480 @@ setErrorMessage(
374
322
  "ja",
375
323
  );
376
324
 
377
- // -------------------------------------------------------------------------------------------------
325
+ // -------------------------------------------------------------------------------------------------。
378
326
  //
379
- // トランスフォーマー
327
+ // ミドルウェア。
380
328
  //
381
- // -------------------------------------------------------------------------------------------------
329
+ // -------------------------------------------------------------------------------------------------。
382
330
 
383
- // export type TransformerIsOpenErrorMeta = {
384
- // readonly name: string;
385
- // };
331
+ /**
332
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
333
+ */
334
+ export type MiddlewareIsNotOpenErrorMeta = {
335
+ /**
336
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
337
+ */
338
+ readonly name: string;
339
+ };
386
340
 
387
- // export type TransformerIsOpenErrorArgs = TransformerIsOpenErrorMeta;
341
+ /**
342
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
343
+ */
344
+ export type MiddlewareIsNotOpenErrorArgs = ErrorOptions & MiddlewareIsNotOpenErrorMeta;
388
345
 
389
- // export class TransformerIsOpenError extends ErrorBase<TransformerIsOpenErrorMeta> {
390
- // static {
391
- // this.prototype.name = "UniKvsTransformerIsOpenError";
392
- // }
346
+ /**
347
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
348
+ */
349
+ export class MiddlewareIsNotOpenError extends ErrorBase<MiddlewareIsNotOpenErrorMeta> {
350
+ static {
351
+ this.prototype.name = "UniKvsMiddlewareIsNotOpenError";
352
+ }
393
353
 
394
- // public constructor(args: TransformerIsOpenErrorArgs, options?: ErrorOptions) {
395
- // super(args, ({ name }) => `Transformer "${name}" is open`, options);
396
- // }
397
- // }
354
+ public constructor(args: MiddlewareIsNotOpenErrorArgs) {
355
+ const { name, ...options } = args;
356
+ const meta: MiddlewareIsNotOpenErrorMeta = { name };
357
+ super(meta, ({ name: messageName }) => `Middleware "${messageName}" is not open`, options);
358
+ }
359
+ }
398
360
 
399
- // setErrorMessage(TransformerIsOpenError, ({ name }) => `トランスフォーマー "${name}" は開いています`, "ja");
361
+ setErrorMessage(
362
+ MiddlewareIsNotOpenError,
363
+ ({ name }) => `ミドルウェア "${name}" は開いていません`,
364
+ "ja",
365
+ );
400
366
 
401
367
  /**
402
- * TransformerIsNotOpenError に付与されるメタデータです。
368
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
403
369
  */
404
- export type TransformerIsNotOpenErrorMeta = {
370
+ export type MiddlewareDestinationMissingErrorMeta = {
405
371
  /**
406
- * 開かれていないトランスフォーマーの名前です。
372
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
407
373
  */
408
374
  readonly name: string;
375
+
376
+ /**
377
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
378
+ */
379
+ readonly operation: "encode" | "decode";
409
380
  };
410
381
 
411
382
  /**
412
- * TransformerIsNotOpenError のコンストラクター引数です。
413
- *
414
- * エラーの追加情報 (`cause`) も含みます。
383
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
415
384
  */
416
- export type TransformerIsNotOpenErrorArgs = ErrorOptions & TransformerIsNotOpenErrorMeta;
385
+ export type MiddlewareDestinationMissingErrorArgs = ErrorOptions &
386
+ MiddlewareDestinationMissingErrorMeta;
417
387
 
418
388
  /**
419
- * トランスフォーマーが開かれていない状態で操作が行われた場合に投げられるエラーです。
389
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
420
390
  */
421
- export class TransformerIsNotOpenError extends ErrorBase<TransformerIsNotOpenErrorMeta> {
391
+ export class MiddlewareDestinationMissingError extends ErrorBase<MiddlewareDestinationMissingErrorMeta> {
422
392
  static {
423
- this.prototype.name = "UniKvsTransformerIsNotOpenError";
393
+ this.prototype.name = "UniKvsMiddlewareDestinationMissingError";
424
394
  }
425
395
 
426
- public constructor(args: TransformerIsNotOpenErrorArgs) {
427
- const { name, ...options } = args;
428
- const meta: TransformerIsNotOpenErrorMeta = { name };
429
- super(meta, ({ name }) => `Transformer "${name}" is not open`, options);
396
+ public constructor(args: MiddlewareDestinationMissingErrorArgs) {
397
+ const { name, operation, ...options } = args;
398
+ const meta: MiddlewareDestinationMissingErrorMeta = {
399
+ name,
400
+ operation,
401
+ };
402
+ super(
403
+ meta,
404
+ ({ name: messageName, operation: messageOperation }) =>
405
+ `Middleware "${messageName}" did not set destination for ${messageOperation}.`,
406
+ options,
407
+ );
430
408
  }
431
409
  }
432
410
 
433
411
  setErrorMessage(
434
- TransformerIsNotOpenError,
435
- ({ name }) => `トランスフォーマー "${name}" は開いていません`,
412
+ MiddlewareDestinationMissingError,
413
+ ({ name, operation }) =>
414
+ `ミドルウェア "${name}" は ${operation} の destination を設定しませんでした。`,
436
415
  "ja",
437
416
  );
438
417
 
439
418
  /**
440
- * EncodableStreamNotSupportedError に付与されるメタデータです。
419
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
441
420
  */
442
- export type EncodableStreamNotSupportedErrorMeta = {
421
+ export type MiddlewareDestinationFrozenErrorMeta = {
443
422
  /**
444
- * 対象のトランスフォーマーの名前です。
423
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
424
+ */
425
+ readonly action: "set" | "get" | "stream";
426
+
427
+ /**
428
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
429
+ */
430
+ readonly key: string;
431
+ };
432
+
433
+ /**
434
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
435
+ */
436
+ export type MiddlewareDestinationFrozenErrorArgs = ErrorOptions &
437
+ MiddlewareDestinationFrozenErrorMeta;
438
+
439
+ /**
440
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
441
+ */
442
+ export class MiddlewareDestinationFrozenError extends ErrorBase<MiddlewareDestinationFrozenErrorMeta> {
443
+ static {
444
+ this.prototype.name = "UniKvsMiddlewareDestinationFrozenError";
445
+ }
446
+
447
+ public constructor(args: MiddlewareDestinationFrozenErrorArgs) {
448
+ const { key, action, ...options } = args;
449
+ const meta: MiddlewareDestinationFrozenErrorMeta = {
450
+ key,
451
+ action,
452
+ };
453
+ super(
454
+ meta,
455
+ ({ key: messageKey, action: messageAction }) =>
456
+ `Cannot set destination after next() was called for ${messageAction} operation on key ${JSON.stringify(messageKey)}.`,
457
+ options,
458
+ );
459
+ }
460
+ }
461
+
462
+ setErrorMessage(
463
+ MiddlewareDestinationFrozenError,
464
+ ({ key: messageKey, action: messageAction }) =>
465
+ `next() を呼び出した後に destination を設定できません(${messageAction} 操作、キー ${JSON.stringify(messageKey)})。`,
466
+ "ja",
467
+ );
468
+
469
+ /**
470
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
471
+ */
472
+ export type MiddlewareNextNotCalledErrorMeta = {
473
+ /**
474
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
445
475
  */
446
476
  readonly name: string;
477
+
478
+ /**
479
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
480
+ */
481
+ readonly operation: "encode" | "decode" | "use";
447
482
  };
448
483
 
449
484
  /**
450
- * EncodableStreamNotSupportedError のコンストラクター引数です。
451
- *
452
- * エラーの追加情報 (`cause`) も含みます。
485
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
486
+ */
487
+ export type MiddlewareNextNotCalledErrorArgs = ErrorOptions & MiddlewareNextNotCalledErrorMeta;
488
+
489
+ /**
490
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
491
+ */
492
+ export class MiddlewareNextNotCalledError extends ErrorBase<MiddlewareNextNotCalledErrorMeta> {
493
+ static {
494
+ this.prototype.name = "UniKvsMiddlewareNextNotCalledError";
495
+ }
496
+
497
+ public constructor(args: MiddlewareNextNotCalledErrorArgs) {
498
+ const { name, operation, ...options } = args;
499
+ const meta: MiddlewareNextNotCalledErrorMeta = {
500
+ name,
501
+ operation,
502
+ };
503
+ super(
504
+ meta,
505
+ ({ name: messageName, operation: messageOperation }) =>
506
+ `Middleware "${messageName}" did not call next() for ${messageOperation}.`,
507
+ options,
508
+ );
509
+ }
510
+ }
511
+
512
+ setErrorMessage(
513
+ MiddlewareNextNotCalledError,
514
+ ({ name, operation }) => `ミドルウェア "${name}" は ${operation} で next() を呼びませんでした。`,
515
+ "ja",
516
+ );
517
+
518
+ /**
519
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
520
+ */
521
+ export type MiddlewareNextNotAwaitedErrorMeta = {
522
+ /**
523
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
524
+ */
525
+ readonly name: string;
526
+
527
+ /**
528
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
529
+ */
530
+ readonly operation: "encode" | "decode" | "use";
531
+ };
532
+
533
+ /**
534
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
535
+ */
536
+ export type MiddlewareNextNotAwaitedErrorArgs = ErrorOptions & MiddlewareNextNotAwaitedErrorMeta;
537
+
538
+ /**
539
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
540
+ */
541
+ export class MiddlewareNextNotAwaitedError extends ErrorBase<MiddlewareNextNotAwaitedErrorMeta> {
542
+ static {
543
+ this.prototype.name = "UniKvsMiddlewareNextNotAwaitedError";
544
+ }
545
+
546
+ public constructor(args: MiddlewareNextNotAwaitedErrorArgs) {
547
+ const { name, operation, ...options } = args;
548
+ const meta: MiddlewareNextNotAwaitedErrorMeta = {
549
+ name,
550
+ operation,
551
+ };
552
+ super(
553
+ meta,
554
+ ({ name: messageName, operation: messageOperation }) =>
555
+ `Middleware "${messageName}" did not await next() for ${messageOperation}.`,
556
+ options,
557
+ );
558
+ }
559
+ }
560
+
561
+ setErrorMessage(
562
+ MiddlewareNextNotAwaitedError,
563
+ ({ name, operation }) =>
564
+ `ミドルウェア "${name}" は ${operation} で next() を await しませんでした。`,
565
+ "ja",
566
+ );
567
+
568
+ /**
569
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
570
+ */
571
+ export type MiddlewareNextCalledMultipleTimesErrorMeta = {
572
+ /**
573
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
574
+ */
575
+ readonly name: string;
576
+
577
+ /**
578
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
579
+ */
580
+ readonly operation: "encode" | "decode" | "use";
581
+ };
582
+
583
+ /**
584
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
585
+ */
586
+ export type MiddlewareNextCalledMultipleTimesErrorArgs = ErrorOptions &
587
+ MiddlewareNextCalledMultipleTimesErrorMeta;
588
+
589
+ /**
590
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
591
+ */
592
+ export class MiddlewareNextCalledMultipleTimesError extends ErrorBase<MiddlewareNextCalledMultipleTimesErrorMeta> {
593
+ static {
594
+ this.prototype.name = "UniKvsMiddlewareNextCalledMultipleTimesError";
595
+ }
596
+
597
+ public constructor(args: MiddlewareNextCalledMultipleTimesErrorArgs) {
598
+ const { name, operation, ...options } = args;
599
+ const meta: MiddlewareNextCalledMultipleTimesErrorMeta = {
600
+ name,
601
+ operation,
602
+ };
603
+ super(
604
+ meta,
605
+ ({ name: messageName, operation: messageOperation }) =>
606
+ `Middleware "${messageName}" called next() multiple times for ${messageOperation}.`,
607
+ options,
608
+ );
609
+ }
610
+ }
611
+
612
+ setErrorMessage(
613
+ MiddlewareNextCalledMultipleTimesError,
614
+ ({ name, operation }) => `ミドルウェア "${name}" は ${operation} で next() を複数回呼びました。`,
615
+ "ja",
616
+ );
617
+
618
+ /**
619
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
620
+ */
621
+ export type StreamEncodingNotSupportedErrorMeta = {
622
+ /**
623
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
624
+ */
625
+ readonly name: string;
626
+ };
627
+
628
+ /**
629
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
453
630
  */
454
- export type EncodableStreamNotSupportedErrorArgs = ErrorOptions &
455
- EncodableStreamNotSupportedErrorMeta;
631
+ export type StreamEncodingNotSupportedErrorArgs = ErrorOptions &
632
+ StreamEncodingNotSupportedErrorMeta;
456
633
 
457
634
  /**
458
- * トランスフォーマーがエンコード可能なストリームをサポートしていない場合に投げられるエラーです。
635
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
459
636
  */
460
- export class EncodableStreamNotSupportedError extends ErrorBase<EncodableStreamNotSupportedErrorMeta> {
637
+ export class StreamEncodingNotSupportedError extends ErrorBase<StreamEncodingNotSupportedErrorMeta> {
461
638
  static {
462
- this.prototype.name = "UniKvsEncodableStreamNotSupportedError";
639
+ this.prototype.name = "UniKvsStreamEncodingNotSupportedError";
463
640
  }
464
641
 
465
- public constructor(args: EncodableStreamNotSupportedErrorArgs) {
642
+ public constructor(args: StreamEncodingNotSupportedErrorArgs) {
466
643
  const { name, ...options } = args;
467
- const meta: EncodableStreamNotSupportedErrorMeta = { name };
468
- super(meta, ({ name }) => `Transformer "${name}" does not support encodable stream`, options);
644
+ const meta: StreamEncodingNotSupportedErrorMeta = { name };
645
+ super(
646
+ meta,
647
+ ({ name: messageName }) => `Middleware "${messageName}" does not support stream encoding.`,
648
+ options,
649
+ );
469
650
  }
470
651
  }
471
652
 
472
653
  setErrorMessage(
473
- EncodableStreamNotSupportedError,
474
- ({ name }) => `トランスフォーマー "${name}" はエンコード可能なストリームをサポートしていません`,
654
+ StreamEncodingNotSupportedError,
655
+ ({ name }) => `ミドルウェア "${name}" はストリームのエンコードをサポートしていません。`,
475
656
  "ja",
476
657
  );
477
658
 
478
659
  /**
479
- * DecodableStreamNotSupportedError に付与されるメタデータです。
660
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
480
661
  */
481
- export type DecodableStreamNotSupportedErrorMeta = {
662
+ export type StreamDecodingNotSupportedErrorMeta = {
482
663
  /**
483
- * 対象のトランスフォーマーの名前です。
664
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
484
665
  */
485
666
  readonly name: string;
486
667
  };
487
668
 
488
669
  /**
489
- * DecodableStreamNotSupportedError のコンストラクター引数です。
490
- *
491
- * エラーの追加情報 (`cause`) も含みます。
670
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
492
671
  */
493
- export type DecodableStreamNotSupportedErrorArgs = ErrorOptions &
494
- DecodableStreamNotSupportedErrorMeta;
672
+ export type StreamDecodingNotSupportedErrorArgs = ErrorOptions &
673
+ StreamDecodingNotSupportedErrorMeta;
495
674
 
496
675
  /**
497
- * トランスフォーマーがデコード可能なストリームをサポートしていない場合に投げられるエラーです。
676
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
498
677
  */
499
- export class DecodableStreamNotSupportedError extends ErrorBase<DecodableStreamNotSupportedErrorMeta> {
678
+ export class StreamDecodingNotSupportedError extends ErrorBase<StreamDecodingNotSupportedErrorMeta> {
500
679
  static {
501
- this.prototype.name = "UniKvsDecodableStreamNotSupportedError";
680
+ this.prototype.name = "UniKvsStreamDecodingNotSupportedError";
502
681
  }
503
682
 
504
- public constructor(args: DecodableStreamNotSupportedErrorArgs) {
683
+ public constructor(args: StreamDecodingNotSupportedErrorArgs) {
505
684
  const { name, ...options } = args;
506
- const meta: DecodableStreamNotSupportedErrorMeta = { name };
507
- super(meta, ({ name }) => `Transformer "${name}" does not support decodable stream`, options);
685
+ const meta: StreamDecodingNotSupportedErrorMeta = { name };
686
+ super(
687
+ meta,
688
+ ({ name: messageName }) => `Middleware "${messageName}" does not support decodable stream`,
689
+ options,
690
+ );
508
691
  }
509
692
  }
510
693
 
511
694
  setErrorMessage(
512
- DecodableStreamNotSupportedError,
513
- ({ name }) => `トランスフォーマー "${name}" はデコード可能なストリームをサポートしていません`,
695
+ StreamDecodingNotSupportedError,
696
+ ({ name }) => `ミドルウェア "${name}" はデコード可能なストリームをサポートしていません`,
514
697
  "ja",
515
698
  );
516
699
 
517
- // -------------------------------------------------------------------------------------------------
700
+ // -------------------------------------------------------------------------------------------------。
518
701
  //
519
- // ストレージ / トランスフォーマー
702
+ // ストレージ / ミドルウェア。
520
703
  //
521
- // -------------------------------------------------------------------------------------------------
704
+ // -------------------------------------------------------------------------------------------------。
522
705
 
523
706
  /**
524
- * PluginOperationAggregateError に付与されるメタデータです。
707
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
525
708
  */
526
709
  export type PluginOperationAggregateErrorMeta = {
527
710
  /**
528
- * 失敗した操作の対象となったプラグインの種別です。
529
- *
530
- * - `"plugin"`: 複数の種別のプラグインが混在しています。
531
- * - `"storage"`: ストレージです。
532
- * - `"transformer"`: トランスフォーマーです。
711
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
533
712
  */
534
- readonly plugin: "plugin" | "storage" | "transformer";
713
+ readonly plugin: "plugin" | "storage" | "middleware";
535
714
 
536
715
  /**
537
- * 失敗した操作の種類です。
716
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
538
717
  */
539
718
  readonly action: "open" | "close" | "write" | "read" | "delete" | "clear";
540
719
 
541
720
  /**
542
- * 失敗した各プラグインの操作と原因のリストです。
721
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
543
722
  */
544
723
  readonly errors: readonly {
545
724
  /**
546
- * 失敗したプラグインの種別です。
725
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
547
726
  */
548
- readonly plugin: "storage" | "transformer";
727
+ readonly plugin: "storage" | "middleware";
549
728
 
550
729
  /**
551
- * 操作が失敗した原因です。
730
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
731
+ */
732
+ readonly name?: string;
733
+
734
+ /**
735
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
736
+ */
737
+ readonly index?: number;
738
+
739
+ /**
740
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
552
741
  */
553
742
  readonly reason: unknown;
554
743
  }[];
555
744
  };
556
745
 
557
746
  /**
558
- * PluginOperationAggregateError のコンストラクター引数です。
559
- *
560
- * エラーの追加情報 (`cause`) も含みます。
747
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
561
748
  */
562
749
  export type PluginOperationAggregateErrorArgs = ErrorOptions & {
563
750
  /**
564
- * 失敗したプラグインの既定の種別です。
565
- *
566
- * 個々のエラーで種別が指定されていない場合に使用されます。
751
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
567
752
  */
568
- readonly plugin?: "storage" | "transformer";
753
+ readonly plugin?: "storage" | "middleware";
569
754
 
570
755
  /**
571
- * 失敗した操作の種類です。
756
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
572
757
  */
573
758
  readonly action: "open" | "close" | "write" | "read" | "delete" | "clear";
574
759
 
575
760
  /**
576
- * 失敗した各プラグインの操作と原因のリストです。
761
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
577
762
  */
578
763
  readonly errors: readonly {
579
764
  /**
580
- * 失敗したプラグインの種別です。
765
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
581
766
  */
582
- readonly plugin?: "storage" | "transformer";
767
+ readonly plugin?: "storage" | "middleware";
583
768
 
584
769
  /**
585
- * 操作が失敗した原因です。
770
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
771
+ */
772
+ readonly name?: string;
773
+
774
+ /**
775
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
776
+ */
777
+ readonly index?: number;
778
+
779
+ /**
780
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
586
781
  */
587
782
  readonly reason: unknown;
588
783
  }[];
589
784
  };
590
785
 
591
786
  /**
592
- * 複数のストレージやトランスフォーマーの操作が失敗した場合に投げられる、個々の失敗を集約したエラーです。
787
+ * プラグイン種別を正規化します。
788
+ *
789
+ * @param plugin 種別名です。
790
+ *
791
+ * @returns 正規化された種別を返します。
792
+ */
793
+ function normalizePlugin(plugin: string): "storage" | "middleware" {
794
+ return plugin as "storage" | "middleware";
795
+ }
796
+
797
+ /**
798
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
593
799
  */
594
800
  export class PluginOperationAggregateError extends ErrorBase<PluginOperationAggregateErrorMeta> {
595
801
  static {
@@ -597,21 +803,24 @@ export class PluginOperationAggregateError extends ErrorBase<PluginOperationAggr
597
803
  }
598
804
 
599
805
  public constructor(args: PluginOperationAggregateErrorArgs) {
600
- const { plugin, action, errors, ...options } = args;
601
- // 個々のエラーで種別が指定されていない場合は、既定の種別で補完します。
806
+ const { action, errors, plugin, ...options } = args;
602
807
  const normalizedErrors = errors.map((error) => ({
603
- plugin: error.plugin ?? plugin ?? ("" as never),
808
+ plugin: normalizePlugin((error.plugin ?? plugin ?? "") as string),
809
+ ...(error.name !== undefined ? { name: error.name } : {}),
810
+ ...(error.index !== undefined ? { index: error.index } : {}),
604
811
  reason: error.reason,
605
812
  }));
606
813
  const plugins = [...new Set(normalizedErrors.map((error) => error.plugin))];
814
+ const [onlyPlugin] = plugins;
607
815
  const meta: PluginOperationAggregateErrorMeta = {
608
- plugin: plugins.length === 1 ? plugins[0]! : "plugin",
609
816
  action,
610
817
  errors: normalizedErrors,
818
+ plugin: plugins.length === 1 && onlyPlugin !== undefined ? onlyPlugin : "plugin",
611
819
  };
612
820
  super(
613
821
  meta,
614
- ({ action, errors, plugin }) => `${errors.length} ${plugin}(s) fail ${action} operation`,
822
+ ({ action: messageAction, errors: messageErrors, plugin: messagePlugin }) =>
823
+ `${messageErrors.length} ${messagePlugin}(s) fail ${messageAction} operation`,
615
824
  options,
616
825
  );
617
826
  }
@@ -620,18 +829,24 @@ export class PluginOperationAggregateError extends ErrorBase<PluginOperationAggr
620
829
  setErrorMessage(
621
830
  PluginOperationAggregateError,
622
831
  ({ action, errors, plugin }) =>
623
- `${errors.length} 個の${{ plugin: "プラグイン", storage: "ストレージ", transformer: "トランスフォーマー" }[plugin]}が ${action} 操作に失敗`,
832
+ `${errors.length} 個の${
833
+ {
834
+ plugin: "プラグイン",
835
+ storage: "ストレージ",
836
+ middleware: "ミドルウェア",
837
+ }[plugin]
838
+ }が ${action} 操作に失敗`,
624
839
  "ja",
625
840
  );
626
841
 
627
- // -------------------------------------------------------------------------------------------------
842
+ // -------------------------------------------------------------------------------------------------。
628
843
  //
629
- // その他
844
+ // その他。
630
845
  //
631
- // -------------------------------------------------------------------------------------------------
846
+ // -------------------------------------------------------------------------------------------------。
632
847
 
633
848
  /**
634
- * ストレージが一つも登録されていない状態で UniKvs を作成しようとした場合に投げられるエラーです。
849
+ * [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
635
850
  */
636
851
  export class MissingStorageError extends ErrorBase<undefined> {
637
852
  static {
@@ -648,24 +863,3 @@ setErrorMessage(
648
863
  "UniKvs を使用するためには最低 1 つのストレージが必要です",
649
864
  "ja",
650
865
  );
651
-
652
- // -------------------------------------------------------------------------------------------------
653
-
654
- /**
655
- * ストレージが登録された後にトランスフォーマーを追加しようとした場合に投げられるエラーです。
656
- */
657
- export class TransformerRegistrationError extends ErrorBase<undefined> {
658
- static {
659
- this.prototype.name = "UniKvsTransformerRegistrationError";
660
- }
661
-
662
- public constructor(options?: ErrorOptions) {
663
- super("Cannot add transformers after storage has already been registered", options);
664
- }
665
- }
666
-
667
- setErrorMessage(
668
- TransformerRegistrationError,
669
- "ストレージが登録された後にトランスフォーマーを追加することはできません",
670
- "ja",
671
- );