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.
- package/README.md +3 -0
- package/dist/index.d.ts +1553 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4032 -0
- package/dist/index.js.map +1 -0
- package/package.json +35 -34
- package/src/_contexts.ts +1089 -0
- package/src/_logger.ts +5 -3
- package/src/_middleware.ts +207 -0
- package/src/_pipeline-graph.helpers.ts +183 -0
- package/src/_pipeline-graph.ts +1307 -0
- package/src/_pipeline-graph.types.ts +303 -0
- package/src/_pipeline-leaf-resolver.ts +70 -0
- package/src/_plugin-lifecycle.ts +201 -0
- package/src/_storage.ts +173 -96
- package/src/_streams.schemas.ts +21 -0
- package/src/_streams.ts +73 -0
- package/src/_to-value-stream.ts +22 -11
- package/src/_types.ts +237 -0
- package/src/_unikvs-branch.ts +94 -0
- package/src/_unikvs.schemas.ts +451 -0
- package/src/_valibot.ts +17 -3
- package/src/_value-schemas.ts +192 -0
- package/src/_value-validation.ts +57 -0
- package/src/errors.ts +446 -252
- package/src/index.ts +46 -26
- package/src/types.ts +13 -0
- package/src/unikvs-branch.ts +445 -0
- package/src/unikvs-builder.ts +706 -0
- package/src/unikvs.ts +1456 -971
- package/src/unikvs.types.ts +194 -0
- package/src/value-schemas.ts +98 -0
- package/dist/src/_logger.d.ts +0 -3
- package/dist/src/_logger.d.ts.map +0 -1
- package/dist/src/_logger.js +0 -3
- package/dist/src/_merge-context.d.ts +0 -13
- package/dist/src/_merge-context.d.ts.map +0 -1
- package/dist/src/_merge-context.js +0 -12
- package/dist/src/_storage.d.ts +0 -18
- package/dist/src/_storage.d.ts.map +0 -1
- package/dist/src/_storage.js +0 -94
- package/dist/src/_to-value-stream.d.ts +0 -12
- package/dist/src/_to-value-stream.d.ts.map +0 -1
- package/dist/src/_to-value-stream.js +0 -102
- package/dist/src/_transformer.d.ts +0 -13
- package/dist/src/_transformer.d.ts.map +0 -1
- package/dist/src/_transformer.js +0 -60
- package/dist/src/_valibot.d.ts +0 -15
- package/dist/src/_valibot.d.ts.map +0 -1
- package/dist/src/_valibot.js +0 -23
- package/dist/src/context.types.d.ts +0 -17
- package/dist/src/context.types.d.ts.map +0 -1
- package/dist/src/context.types.js +0 -1
- package/dist/src/errors.d.ts +0 -340
- package/dist/src/errors.d.ts.map +0 -1
- package/dist/src/errors.js +0 -250
- package/dist/src/index.d.ts +0 -10
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/index.js +0 -3
- package/dist/src/unikvs-config.d.ts +0 -255
- package/dist/src/unikvs-config.d.ts.map +0 -1
- package/dist/src/unikvs-config.js +0 -105
- package/dist/src/unikvs.d.ts +0 -354
- package/dist/src/unikvs.d.ts.map +0 -1
- package/dist/src/unikvs.js +0 -867
- package/dist/src/utils.types.d.ts +0 -7
- package/dist/src/utils.types.d.ts.map +0 -1
- package/dist/src/utils.types.js +0 -1
- package/dist/src/value-stream.types.d.ts +0 -16
- package/dist/src/value-stream.types.d.ts.map +0 -1
- package/dist/src/value-stream.types.js +0 -1
- package/src/_merge-context.ts +0 -19
- package/src/_transformer.ts +0 -89
- package/src/context.types.ts +0 -19
- package/src/unikvs-config.ts +0 -426
- package/src/utils.types.ts +0 -6
- package/src/value-stream.types.ts +0 -19
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1553 @@
|
|
|
1
|
+
import { ErrorBase, ErrorOptions, IMiddleware, IReadableStream, IReadableStreamStorage, IStorage, IWritableStream, IWritableStreamStorage, InvalidUsageErrorBase, KeyNotFoundError, KeyNotFoundErrorArgs, KeyNotFoundErrorMeta } from "@unikvs/core";
|
|
2
|
+
import { BaseIssue, GenericSchema, GenericSchema as GenericSchema$1, InferInput, InferOutput, InstanceSchema, OptionalSchema, safeParse } from "valibot";
|
|
3
|
+
import { ObjectSchema } from "@tai-kun/valibot-extra-lab";
|
|
4
|
+
//#region ../src/errors.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
7
|
+
*/
|
|
8
|
+
type Issue = BaseIssue<unknown>;
|
|
9
|
+
/**
|
|
10
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
11
|
+
*/
|
|
12
|
+
type InvalidInputErrorMeta = {
|
|
13
|
+
/**
|
|
14
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
15
|
+
*/
|
|
16
|
+
readonly input: unknown;
|
|
17
|
+
/**
|
|
18
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
19
|
+
*/
|
|
20
|
+
readonly issues: readonly [Issue, ...Issue[]];
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
24
|
+
*/
|
|
25
|
+
type InvalidInputErrorArgs = ErrorOptions & {
|
|
26
|
+
/**
|
|
27
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
28
|
+
*/
|
|
29
|
+
readonly value: unknown;
|
|
30
|
+
/**
|
|
31
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
32
|
+
*/
|
|
33
|
+
readonly issues: readonly [Issue, ...Issue[]];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
37
|
+
*/
|
|
38
|
+
export declare class InvalidInputError extends InvalidUsageErrorBase<InvalidInputErrorMeta> {
|
|
39
|
+
constructor(args: InvalidInputErrorArgs);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
43
|
+
*/
|
|
44
|
+
type InvalidOutputErrorMeta = {
|
|
45
|
+
/**
|
|
46
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
47
|
+
*/
|
|
48
|
+
readonly output: unknown;
|
|
49
|
+
/**
|
|
50
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
51
|
+
*/
|
|
52
|
+
readonly issues: readonly [Issue, ...Issue[]];
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
56
|
+
*/
|
|
57
|
+
type InvalidOutputErrorArgs = ErrorOptions & {
|
|
58
|
+
/**
|
|
59
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
60
|
+
*/
|
|
61
|
+
readonly value: unknown;
|
|
62
|
+
/**
|
|
63
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
64
|
+
*/
|
|
65
|
+
readonly issues: readonly [Issue, ...Issue[]];
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
69
|
+
*/
|
|
70
|
+
export declare class InvalidOutputError extends InvalidUsageErrorBase<InvalidOutputErrorMeta> {
|
|
71
|
+
constructor(args: InvalidOutputErrorArgs);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
75
|
+
*/
|
|
76
|
+
export declare class UniKvsIsOpenError extends ErrorBase<undefined> {
|
|
77
|
+
constructor(options?: ErrorOptions);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
81
|
+
*/
|
|
82
|
+
export declare class UniKvsIsNotOpenError extends ErrorBase<undefined> {
|
|
83
|
+
constructor(options?: ErrorOptions);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
87
|
+
*/
|
|
88
|
+
type StorageIsNotOpenErrorMeta = {
|
|
89
|
+
/**
|
|
90
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
91
|
+
*/
|
|
92
|
+
readonly name: string;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
96
|
+
*/
|
|
97
|
+
type StorageIsNotOpenErrorArgs = ErrorOptions & StorageIsNotOpenErrorMeta;
|
|
98
|
+
/**
|
|
99
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
100
|
+
*/
|
|
101
|
+
export declare class StorageIsNotOpenError extends ErrorBase<StorageIsNotOpenErrorMeta> {
|
|
102
|
+
constructor(args: StorageIsNotOpenErrorArgs);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
106
|
+
*/
|
|
107
|
+
type WritableStreamNotSupportedErrorMeta = {
|
|
108
|
+
/**
|
|
109
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
110
|
+
*/
|
|
111
|
+
readonly name: string;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
115
|
+
*/
|
|
116
|
+
type WritableStreamNotSupportedErrorArgs = ErrorOptions & WritableStreamNotSupportedErrorMeta;
|
|
117
|
+
/**
|
|
118
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
119
|
+
*/
|
|
120
|
+
export declare class WritableStreamNotSupportedError extends ErrorBase<WritableStreamNotSupportedErrorMeta> {
|
|
121
|
+
constructor(args: WritableStreamNotSupportedErrorArgs);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
125
|
+
*/
|
|
126
|
+
type ReadableStreamNotSupportedErrorMeta = {
|
|
127
|
+
/**
|
|
128
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
129
|
+
*/
|
|
130
|
+
readonly name: string;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
134
|
+
*/
|
|
135
|
+
type ReadableStreamNotSupportedErrorArgs = ErrorOptions & ReadableStreamNotSupportedErrorMeta;
|
|
136
|
+
/**
|
|
137
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
138
|
+
*/
|
|
139
|
+
export declare class ReadableStreamNotSupportedError extends ErrorBase<ReadableStreamNotSupportedErrorMeta> {
|
|
140
|
+
constructor(args: ReadableStreamNotSupportedErrorArgs);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* MultipartWriteNotSupportedError に付与されるメタデータです。
|
|
144
|
+
*/
|
|
145
|
+
type MultipartWriteNotSupportedErrorMeta = {
|
|
146
|
+
/**
|
|
147
|
+
* 対象のストレージの名前です。
|
|
148
|
+
*/
|
|
149
|
+
readonly name: string;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* MultipartWriteNotSupportedError のコンストラクター引数です。
|
|
153
|
+
*
|
|
154
|
+
* エラーの追加情報 (`cause`) も含みます。
|
|
155
|
+
*/
|
|
156
|
+
type MultipartWriteNotSupportedErrorArgs = ErrorOptions & MultipartWriteNotSupportedErrorMeta;
|
|
157
|
+
/**
|
|
158
|
+
* ストレージがマルチパート書き込みをサポートしていない場合に投げられるエラーです。
|
|
159
|
+
*/
|
|
160
|
+
export declare class MultipartWriteNotSupportedError extends ErrorBase<MultipartWriteNotSupportedErrorMeta> {
|
|
161
|
+
constructor(args: MultipartWriteNotSupportedErrorArgs);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
165
|
+
*/
|
|
166
|
+
type MiddlewareIsNotOpenErrorMeta = {
|
|
167
|
+
/**
|
|
168
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
169
|
+
*/
|
|
170
|
+
readonly name: string;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
174
|
+
*/
|
|
175
|
+
type MiddlewareIsNotOpenErrorArgs = ErrorOptions & MiddlewareIsNotOpenErrorMeta;
|
|
176
|
+
/**
|
|
177
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
178
|
+
*/
|
|
179
|
+
export declare class MiddlewareIsNotOpenError extends ErrorBase<MiddlewareIsNotOpenErrorMeta> {
|
|
180
|
+
constructor(args: MiddlewareIsNotOpenErrorArgs);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
184
|
+
*/
|
|
185
|
+
type MiddlewareDestinationMissingErrorMeta = {
|
|
186
|
+
/**
|
|
187
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
188
|
+
*/
|
|
189
|
+
readonly name: string;
|
|
190
|
+
/**
|
|
191
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
192
|
+
*/
|
|
193
|
+
readonly operation: "encode" | "decode";
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
197
|
+
*/
|
|
198
|
+
type MiddlewareDestinationMissingErrorArgs = ErrorOptions & MiddlewareDestinationMissingErrorMeta;
|
|
199
|
+
/**
|
|
200
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
201
|
+
*/
|
|
202
|
+
export declare class MiddlewareDestinationMissingError extends ErrorBase<MiddlewareDestinationMissingErrorMeta> {
|
|
203
|
+
constructor(args: MiddlewareDestinationMissingErrorArgs);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
207
|
+
*/
|
|
208
|
+
type MiddlewareDestinationFrozenErrorMeta = {
|
|
209
|
+
/**
|
|
210
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
211
|
+
*/
|
|
212
|
+
readonly action: "set" | "get" | "stream";
|
|
213
|
+
/**
|
|
214
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
215
|
+
*/
|
|
216
|
+
readonly key: string;
|
|
217
|
+
};
|
|
218
|
+
/**
|
|
219
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
220
|
+
*/
|
|
221
|
+
type MiddlewareDestinationFrozenErrorArgs = ErrorOptions & MiddlewareDestinationFrozenErrorMeta;
|
|
222
|
+
/**
|
|
223
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
224
|
+
*/
|
|
225
|
+
export declare class MiddlewareDestinationFrozenError extends ErrorBase<MiddlewareDestinationFrozenErrorMeta> {
|
|
226
|
+
constructor(args: MiddlewareDestinationFrozenErrorArgs);
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
230
|
+
*/
|
|
231
|
+
type MiddlewareNextNotCalledErrorMeta = {
|
|
232
|
+
/**
|
|
233
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
234
|
+
*/
|
|
235
|
+
readonly name: string;
|
|
236
|
+
/**
|
|
237
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
238
|
+
*/
|
|
239
|
+
readonly operation: "encode" | "decode" | "use";
|
|
240
|
+
};
|
|
241
|
+
/**
|
|
242
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
243
|
+
*/
|
|
244
|
+
type MiddlewareNextNotCalledErrorArgs = ErrorOptions & MiddlewareNextNotCalledErrorMeta;
|
|
245
|
+
/**
|
|
246
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
247
|
+
*/
|
|
248
|
+
export declare class MiddlewareNextNotCalledError extends ErrorBase<MiddlewareNextNotCalledErrorMeta> {
|
|
249
|
+
constructor(args: MiddlewareNextNotCalledErrorArgs);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
253
|
+
*/
|
|
254
|
+
type MiddlewareNextNotAwaitedErrorMeta = {
|
|
255
|
+
/**
|
|
256
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
257
|
+
*/
|
|
258
|
+
readonly name: string;
|
|
259
|
+
/**
|
|
260
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
261
|
+
*/
|
|
262
|
+
readonly operation: "encode" | "decode" | "use";
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
266
|
+
*/
|
|
267
|
+
type MiddlewareNextNotAwaitedErrorArgs = ErrorOptions & MiddlewareNextNotAwaitedErrorMeta;
|
|
268
|
+
/**
|
|
269
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
270
|
+
*/
|
|
271
|
+
export declare class MiddlewareNextNotAwaitedError extends ErrorBase<MiddlewareNextNotAwaitedErrorMeta> {
|
|
272
|
+
constructor(args: MiddlewareNextNotAwaitedErrorArgs);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
276
|
+
*/
|
|
277
|
+
type MiddlewareNextCalledMultipleTimesErrorMeta = {
|
|
278
|
+
/**
|
|
279
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
280
|
+
*/
|
|
281
|
+
readonly name: string;
|
|
282
|
+
/**
|
|
283
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
284
|
+
*/
|
|
285
|
+
readonly operation: "encode" | "decode" | "use";
|
|
286
|
+
};
|
|
287
|
+
/**
|
|
288
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
289
|
+
*/
|
|
290
|
+
type MiddlewareNextCalledMultipleTimesErrorArgs = ErrorOptions & MiddlewareNextCalledMultipleTimesErrorMeta;
|
|
291
|
+
/**
|
|
292
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
293
|
+
*/
|
|
294
|
+
export declare class MiddlewareNextCalledMultipleTimesError extends ErrorBase<MiddlewareNextCalledMultipleTimesErrorMeta> {
|
|
295
|
+
constructor(args: MiddlewareNextCalledMultipleTimesErrorArgs);
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
299
|
+
*/
|
|
300
|
+
type StreamEncodingNotSupportedErrorMeta = {
|
|
301
|
+
/**
|
|
302
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
303
|
+
*/
|
|
304
|
+
readonly name: string;
|
|
305
|
+
};
|
|
306
|
+
/**
|
|
307
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
308
|
+
*/
|
|
309
|
+
type StreamEncodingNotSupportedErrorArgs = ErrorOptions & StreamEncodingNotSupportedErrorMeta;
|
|
310
|
+
/**
|
|
311
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
312
|
+
*/
|
|
313
|
+
export declare class StreamEncodingNotSupportedError extends ErrorBase<StreamEncodingNotSupportedErrorMeta> {
|
|
314
|
+
constructor(args: StreamEncodingNotSupportedErrorArgs);
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
318
|
+
*/
|
|
319
|
+
type StreamDecodingNotSupportedErrorMeta = {
|
|
320
|
+
/**
|
|
321
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
322
|
+
*/
|
|
323
|
+
readonly name: string;
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
327
|
+
*/
|
|
328
|
+
type StreamDecodingNotSupportedErrorArgs = ErrorOptions & StreamDecodingNotSupportedErrorMeta;
|
|
329
|
+
/**
|
|
330
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
331
|
+
*/
|
|
332
|
+
export declare class StreamDecodingNotSupportedError extends ErrorBase<StreamDecodingNotSupportedErrorMeta> {
|
|
333
|
+
constructor(args: StreamDecodingNotSupportedErrorArgs);
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
337
|
+
*/
|
|
338
|
+
type PluginOperationAggregateErrorMeta = {
|
|
339
|
+
/**
|
|
340
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
341
|
+
*/
|
|
342
|
+
readonly plugin: "plugin" | "storage" | "middleware";
|
|
343
|
+
/**
|
|
344
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
345
|
+
*/
|
|
346
|
+
readonly action: "open" | "close" | "write" | "read" | "delete" | "clear";
|
|
347
|
+
/**
|
|
348
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
349
|
+
*/
|
|
350
|
+
readonly errors: readonly {
|
|
351
|
+
/**
|
|
352
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
353
|
+
*/
|
|
354
|
+
readonly plugin: "storage" | "middleware";
|
|
355
|
+
/**
|
|
356
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
357
|
+
*/
|
|
358
|
+
readonly name?: string;
|
|
359
|
+
/**
|
|
360
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
361
|
+
*/
|
|
362
|
+
readonly index?: number;
|
|
363
|
+
/**
|
|
364
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
365
|
+
*/
|
|
366
|
+
readonly reason: unknown;
|
|
367
|
+
}[];
|
|
368
|
+
};
|
|
369
|
+
/**
|
|
370
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
371
|
+
*/
|
|
372
|
+
type PluginOperationAggregateErrorArgs = ErrorOptions & {
|
|
373
|
+
/**
|
|
374
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
375
|
+
*/
|
|
376
|
+
readonly plugin?: "storage" | "middleware";
|
|
377
|
+
/**
|
|
378
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
379
|
+
*/
|
|
380
|
+
readonly action: "open" | "close" | "write" | "read" | "delete" | "clear";
|
|
381
|
+
/**
|
|
382
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
383
|
+
*/
|
|
384
|
+
readonly errors: readonly {
|
|
385
|
+
/**
|
|
386
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
387
|
+
*/
|
|
388
|
+
readonly plugin?: "storage" | "middleware";
|
|
389
|
+
/**
|
|
390
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
391
|
+
*/
|
|
392
|
+
readonly name?: string;
|
|
393
|
+
/**
|
|
394
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
395
|
+
*/
|
|
396
|
+
readonly index?: number;
|
|
397
|
+
/**
|
|
398
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
399
|
+
*/
|
|
400
|
+
readonly reason: unknown;
|
|
401
|
+
}[];
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
405
|
+
*/
|
|
406
|
+
export declare class PluginOperationAggregateError extends ErrorBase<PluginOperationAggregateErrorMeta> {
|
|
407
|
+
constructor(args: PluginOperationAggregateErrorArgs);
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
411
|
+
*/
|
|
412
|
+
export declare class MissingStorageError extends ErrorBase<undefined> {
|
|
413
|
+
constructor(options?: ErrorOptions);
|
|
414
|
+
}
|
|
415
|
+
//#endregion
|
|
416
|
+
//#region ../src/types.d.ts
|
|
417
|
+
/**
|
|
418
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-stream)
|
|
419
|
+
*/
|
|
420
|
+
interface IValueStream<T = any> extends Omit<ReadableStream, keyof AsyncDisposable | keyof AsyncIterable<unknown>>, AsyncDisposable, AsyncIterable<T, void, unknown> {
|
|
421
|
+
/**
|
|
422
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-stream)
|
|
423
|
+
*/
|
|
424
|
+
dispose: (this: void) => Promise<void>;
|
|
425
|
+
}
|
|
426
|
+
//#endregion
|
|
427
|
+
//#region ../src/_types.d.ts
|
|
428
|
+
type ValueOf<T> = T[keyof T];
|
|
429
|
+
/**
|
|
430
|
+
* ミドルウェアから、エンコード時の入力データ (生データ) の型を推論するユーティリティー型です。
|
|
431
|
+
*
|
|
432
|
+
* @template TMiddleware 対象となるミドルウェアの型です。
|
|
433
|
+
*/
|
|
434
|
+
type $InferEncodeDataInput<TMiddleware extends IMiddleware> = TMiddleware extends IMiddleware<infer TEncodeDataInput> ? TEncodeDataInput : never;
|
|
435
|
+
/**
|
|
436
|
+
* ミドルウェアから、エンコード時の出力データ (符号化済み) の型を推論するユーティリティー型です。
|
|
437
|
+
*
|
|
438
|
+
* @template TMiddleware 対象となるミドルウェアの型です。
|
|
439
|
+
*/
|
|
440
|
+
type $InferEncodeDataOutput<TMiddleware extends IMiddleware> = TMiddleware extends IMiddleware<any, infer TEncodeDataOutput> ? TEncodeDataOutput : never;
|
|
441
|
+
/**
|
|
442
|
+
* ミドルウェアから、デコード時の入力データ (符号化済み) の型を推論するユーティリティー型です。
|
|
443
|
+
* 分岐先頭の親出力受容検査に使用します。
|
|
444
|
+
*
|
|
445
|
+
* @template TMiddleware 対象となるミドルウェアの型です。
|
|
446
|
+
*/
|
|
447
|
+
type $InferDecodeDataInput<TMiddleware extends IMiddleware> = TMiddleware extends IMiddleware<any, infer TDecodeDataInput> ? TDecodeDataInput : never;
|
|
448
|
+
/**
|
|
449
|
+
* ミドルウェアから、デコード時の出力データ (生データ) の型を推論するユーティリティー型です。
|
|
450
|
+
* 分岐先頭の親入力受容検査に使用します。
|
|
451
|
+
*
|
|
452
|
+
* @template TMiddleware 対象となるミドルウェアの型です。
|
|
453
|
+
*/
|
|
454
|
+
type $InferDecodeDataOutput<TMiddleware extends IMiddleware> = TMiddleware extends IMiddleware<infer TDecodeDataOutput> ? TDecodeDataOutput : never;
|
|
455
|
+
/**
|
|
456
|
+
* ミドルウェアから、デコードストリームの入力チャンクデータの型を推論するユーティリティー型です。
|
|
457
|
+
*
|
|
458
|
+
* @template TMiddleware 対象となるミドルウェアの型です。
|
|
459
|
+
*/
|
|
460
|
+
type $InferDecodeChunkInput<TMiddleware extends IMiddleware> = TMiddleware extends IMiddleware<any, any, any, infer TDecodeChunkInput> ? TDecodeChunkInput : never;
|
|
461
|
+
/**
|
|
462
|
+
* ミドルウェアから、エンコードストリームの出力チャンクデータの型を推論するユーティリティー型です。
|
|
463
|
+
*
|
|
464
|
+
* @template TMiddleware 対象となるミドルウェアの型です。
|
|
465
|
+
*/
|
|
466
|
+
type $InferEncodeChunkOutput<TMiddleware extends IMiddleware> = TMiddleware extends IMiddleware<any, any, any, infer TEncodeChunkOutput> ? TEncodeChunkOutput : never;
|
|
467
|
+
/**
|
|
468
|
+
* ミドルウェアから、エンコードストリームの入力チャンクデータの型を推論するユーティリティー型です。
|
|
469
|
+
* 分岐先頭のチャンク検査に使用します。
|
|
470
|
+
*
|
|
471
|
+
* @template TMiddleware 対象となるミドルウェアの型です。
|
|
472
|
+
*/
|
|
473
|
+
type $InferEncodeChunkInput<TMiddleware extends IMiddleware> = TMiddleware extends IMiddleware<any, any, infer TEncodeChunkInput> ? TEncodeChunkInput : never;
|
|
474
|
+
/**
|
|
475
|
+
* ミドルウェアから、デコードストリームの出力チャンクデータの型を推論するユーティリティー型です。
|
|
476
|
+
* 分岐先頭のチャンク検査に使用します。
|
|
477
|
+
*
|
|
478
|
+
* @template TMiddleware 対象となるミドルウェアの型です。
|
|
479
|
+
*/
|
|
480
|
+
type $InferDecodeChunkOutput<TMiddleware extends IMiddleware> = TMiddleware extends IMiddleware<any, any, infer TDecodeChunkOutput> ? TDecodeChunkOutput : never;
|
|
481
|
+
/**
|
|
482
|
+
* ストレージから、書き込みデータの入力型を推論するユーティリティー型です。
|
|
483
|
+
* 分岐先頭の親出力受容検査に使用します。
|
|
484
|
+
*
|
|
485
|
+
* @template TStorage 対象となるストレージの型です。
|
|
486
|
+
*/
|
|
487
|
+
type $InferWriteDataInput<TStorage extends IStorage> = TStorage extends IStorage<infer TWriteDataInput, any, any, any> ? TWriteDataInput : never;
|
|
488
|
+
/**
|
|
489
|
+
* ストレージから、読み込みデータの出力型を推論するユーティリティー型です。
|
|
490
|
+
* 分岐先頭の親入力受容検査に使用します。
|
|
491
|
+
*
|
|
492
|
+
* @template TStorage 対象となるストレージの型です。
|
|
493
|
+
*/
|
|
494
|
+
type $InferReadDataOutput<TStorage extends IStorage> = TStorage extends IStorage<any, infer TReadDataOutput, any, any> ? TReadDataOutput : never;
|
|
495
|
+
/**
|
|
496
|
+
* ストレージから、書き込みストリームの入力チャンクデータの型を推論するユーティリティー型です。
|
|
497
|
+
*
|
|
498
|
+
* @template TStorage 対象となるストレージの型です。
|
|
499
|
+
*/
|
|
500
|
+
type $InferWriteChunkInput<TStorage extends IStorage> = TStorage extends IWritableStreamStorage<infer TWriteChunkInput> ? TWriteChunkInput : never;
|
|
501
|
+
/**
|
|
502
|
+
* ストレージから、読み込みストリームの出力チャンクデータの型を推論するユーティリティー型です。
|
|
503
|
+
*
|
|
504
|
+
* @template TStorage 対象となるストレージの型です。
|
|
505
|
+
*/
|
|
506
|
+
type $InferReadChunkOutput<TStorage extends IStorage> = TStorage extends IReadableStreamStorage<infer TReadChunkOutput> ? TReadChunkOutput : never;
|
|
507
|
+
/**
|
|
508
|
+
* `any` かどうかを判定するユーティリティー型です。
|
|
509
|
+
* 分岐先頭の空判定で `any` を `unknown` と区別するために使用します。
|
|
510
|
+
*
|
|
511
|
+
* @template T 判定する型です。
|
|
512
|
+
*/
|
|
513
|
+
type $IsAny<T> = 0 extends 1 & T ? true : false;
|
|
514
|
+
/**
|
|
515
|
+
* `unknown` かどうかを判定するユーティリティー型です。
|
|
516
|
+
* 空ブランチの先頭マーカー検出に使用します。
|
|
517
|
+
*
|
|
518
|
+
* @template T 判定する型です。
|
|
519
|
+
*/
|
|
520
|
+
type $IsUnknown<T> = $IsAny<T> extends true ? false : [T] extends [unknown] ? [unknown] extends [T] ? true : false : false;
|
|
521
|
+
/**
|
|
522
|
+
* `never` かどうかを判定するユーティリティー型です。
|
|
523
|
+
* チャンクの非対応判定に使用します。
|
|
524
|
+
*
|
|
525
|
+
* @template T 判定する型です。
|
|
526
|
+
*/
|
|
527
|
+
type $IsNever<T> = [T] extends [never] ? true : false;
|
|
528
|
+
/**
|
|
529
|
+
* 親出力が分岐先頭のエンコード入力を受容できるかを検査するユーティリティー型です。
|
|
530
|
+
* 不適合時は `never` を返し、`fork` 引数を `never` 化して型エラーを発生させます。
|
|
531
|
+
* 先頭のみを検査します。
|
|
532
|
+
* 中間以降は検査しません。
|
|
533
|
+
*
|
|
534
|
+
* @template TParentOutput 親の現出力型です。
|
|
535
|
+
* @template TBranchHeadInput 分岐先頭の入力型です。
|
|
536
|
+
*/
|
|
537
|
+
type $CheckForkEncodeData<TParentOutput, TBranchHeadInput> = $IsUnknown<TBranchHeadInput> extends true ? unknown : $IsAny<TBranchHeadInput> extends true ? unknown : $IsAny<TParentOutput> extends true ? unknown : [TParentOutput] extends [TBranchHeadInput] ? unknown : never;
|
|
538
|
+
/**
|
|
539
|
+
* 分岐先頭のデコード出力が親入力を受容できるかを検査するユーティリティー型です。
|
|
540
|
+
* 不適合時は `never` を返します。
|
|
541
|
+
* 先頭のみを検査します。
|
|
542
|
+
* 中間以降は検査しません。
|
|
543
|
+
*
|
|
544
|
+
* @template TParentInput 親の現入力型です。
|
|
545
|
+
* @template TBranchHeadOutput 分岐先頭の出力型です。
|
|
546
|
+
*/
|
|
547
|
+
type $CheckForkDecodeData<TParentInput, TBranchHeadOutput> = $IsUnknown<TBranchHeadOutput> extends true ? unknown : $IsAny<TBranchHeadOutput> extends true ? unknown : $IsAny<TParentInput> extends true ? unknown : [TBranchHeadOutput] extends [TParentInput] ? unknown : never;
|
|
548
|
+
/**
|
|
549
|
+
* 親チャンク出力が分岐先頭チャンク入力を受容できるかを検査するユーティリティー型です。
|
|
550
|
+
* ストリーム非対応の `never` は許容します。
|
|
551
|
+
* 先頭のみを検査します。
|
|
552
|
+
* 中間以降は検査しません。
|
|
553
|
+
*
|
|
554
|
+
* @template TParentOutput 親の現チャンク出力型です。
|
|
555
|
+
* @template TBranchHeadInput 分岐先頭のチャンク入力型です。
|
|
556
|
+
*/
|
|
557
|
+
type $CheckForkEncodeChunk<TParentOutput, TBranchHeadInput> = $IsUnknown<TBranchHeadInput> extends true ? unknown : $IsAny<TBranchHeadInput> extends true ? unknown : $IsAny<TParentOutput> extends true ? unknown : $IsUnknown<TParentOutput> extends true ? unknown : $IsNever<TParentOutput> extends true ? unknown : $IsNever<TBranchHeadInput> extends true ? unknown : [TParentOutput] extends [TBranchHeadInput] ? unknown : never;
|
|
558
|
+
/**
|
|
559
|
+
* 分岐先頭チャンク出力が親チャンク入力を受容できるかを検査するユーティリティー型です。
|
|
560
|
+
* ストリーム非対応の `never` は許容します。
|
|
561
|
+
* 先頭のみを検査します。
|
|
562
|
+
* 中間以降は検査しません。
|
|
563
|
+
*
|
|
564
|
+
* @template TParentInput 親の現チャンク入力型です。
|
|
565
|
+
* @template TBranchHeadOutput 分岐先頭のチャンク出力型です。
|
|
566
|
+
*/
|
|
567
|
+
type $CheckForkDecodeChunk<TParentInput, TBranchHeadOutput> = $IsUnknown<TBranchHeadOutput> extends true ? unknown : $IsAny<TBranchHeadOutput> extends true ? unknown : $IsAny<TParentInput> extends true ? unknown : $IsUnknown<TParentInput> extends true ? unknown : $IsNever<TParentInput> extends true ? unknown : $IsNever<TBranchHeadOutput> extends true ? unknown : [TBranchHeadOutput] extends [TParentInput] ? unknown : never;
|
|
568
|
+
//#endregion
|
|
569
|
+
//#region ../src/value-schemas.d.ts
|
|
570
|
+
/**
|
|
571
|
+
* プレーンな値を識別するための固有のシンボルです。
|
|
572
|
+
*/
|
|
573
|
+
declare const PLAIN_VALUE: unique symbol;
|
|
574
|
+
/**
|
|
575
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
576
|
+
*/
|
|
577
|
+
export type PlainValue<TData = any, TInput = TData> = [Type: typeof PLAIN_VALUE, Data: TData, Input: TInput];
|
|
578
|
+
/**
|
|
579
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
580
|
+
*/
|
|
581
|
+
export declare function PlainValue<const TSchema extends GenericSchema$1>(schema: TSchema): PlainValue<InferOutput<TSchema>, InferInput<TSchema>>;
|
|
582
|
+
/**
|
|
583
|
+
* ストリーム形式の値を識別するための固有のシンボルです。
|
|
584
|
+
*/
|
|
585
|
+
declare const STREAM_VALUE: unique symbol;
|
|
586
|
+
/**
|
|
587
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
588
|
+
*/
|
|
589
|
+
export type StreamValue<TChunkData = any, TChunkInput = TChunkData> = [Type: typeof STREAM_VALUE, ChunkData: TChunkData, ChunkInput: TChunkInput];
|
|
590
|
+
/**
|
|
591
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
592
|
+
*/
|
|
593
|
+
export declare function StreamValue<const TSchema extends GenericSchema$1>(schema: TSchema): StreamValue<InferOutput<TSchema>, InferInput<TSchema>>;
|
|
594
|
+
/**
|
|
595
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
596
|
+
*/
|
|
597
|
+
export type Value<TDataAndChunkData = any, TInput = TDataAndChunkData> = PlainValue<TDataAndChunkData, TInput> | StreamValue<TDataAndChunkData, TInput>;
|
|
598
|
+
/**
|
|
599
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
600
|
+
*/
|
|
601
|
+
export declare function Value<const TSchema extends GenericSchema$1>(schema: TSchema): Value<InferOutput<TSchema>, InferInput<TSchema>>;
|
|
602
|
+
//#endregion
|
|
603
|
+
//#region ../src/unikvs-branch.d.ts
|
|
604
|
+
/**
|
|
605
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
606
|
+
*/
|
|
607
|
+
type KeyValueMapping<T = any> = Readonly<Record<string, Value<T>>>;
|
|
608
|
+
/**
|
|
609
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#builder)
|
|
610
|
+
*/
|
|
611
|
+
interface IUniKvsBranch<TKeyValueMapping extends KeyValueMapping = KeyValueMapping, TBranchChunkInput = any, TBranchChunkOutput = any, THeadEncodeDataInput = unknown, THeadDecodeDataOutput = unknown, THeadEncodeChunkInput = unknown, THeadDecodeChunkOutput = unknown, TLastDecodeDataInput = any, TLastEncodeDataOutput = any, TLastDecodeChunkInput = any, TLastEncodeChunkOutput = any, TBranchHasPersist extends boolean = false> {
|
|
612
|
+
fork<TSubChunkInput, TSubChunkOutput, TSubHeadEncodeDataInput, TSubHeadDecodeDataOutput, TSubHeadEncodeChunkInput, TSubHeadDecodeChunkOutput, TSubLastDecodeDataInput, TSubLastEncodeDataOutput, TSubLastDecodeChunkInput, TSubLastEncodeChunkOutput, TSubHasPersist extends boolean>(branch: IUniKvsBranch<any, TSubChunkInput, TSubChunkOutput, TSubHeadEncodeDataInput, TSubHeadDecodeDataOutput, TSubHeadEncodeChunkInput, TSubHeadDecodeChunkOutput, TSubLastDecodeDataInput, TSubLastEncodeDataOutput, TSubLastDecodeChunkInput, TSubLastEncodeChunkOutput, TSubHasPersist> & (TSubHasPersist extends true ? $CheckForkEncodeData<TLastEncodeDataOutput, TSubHeadEncodeDataInput> : unknown) & (TSubHasPersist extends true ? $CheckForkDecodeData<TLastDecodeDataInput, TSubHeadDecodeDataOutput> : unknown) & (TSubHasPersist extends true ? $CheckForkEncodeChunk<TLastEncodeChunkOutput, TSubHeadEncodeChunkInput> : unknown) & (TSubHasPersist extends true ? $CheckForkDecodeChunk<TLastDecodeChunkInput, TSubHeadDecodeChunkOutput> : unknown)): IUniKvsBranch<TKeyValueMapping, TSubHasPersist extends true ? [TBranchChunkInput] extends [never] ? never : [TSubChunkInput] extends [never] ? never : TBranchChunkInput : TBranchChunkInput, TSubHasPersist extends true ? [TBranchChunkOutput] extends [never] ? never : [TSubChunkOutput] extends [never] ? never : TBranchChunkOutput : TBranchChunkOutput, TSubHasPersist extends true ? $IsUnknown<THeadEncodeDataInput> extends true ? TSubHeadEncodeDataInput : THeadEncodeDataInput : THeadEncodeDataInput, TSubHasPersist extends true ? $IsUnknown<THeadDecodeDataOutput> extends true ? TSubHeadDecodeDataOutput : THeadDecodeDataOutput : THeadDecodeDataOutput, TSubHasPersist extends true ? $IsUnknown<THeadEncodeChunkInput> extends true ? TSubHeadEncodeChunkInput : THeadEncodeChunkInput : THeadEncodeChunkInput, TSubHasPersist extends true ? $IsUnknown<THeadDecodeChunkOutput> extends true ? TSubHeadDecodeChunkOutput : THeadDecodeChunkOutput : THeadDecodeChunkOutput, TLastDecodeDataInput, TLastEncodeDataOutput, TLastDecodeChunkInput, TLastEncodeChunkOutput, TBranchHasPersist extends true ? true : TSubHasPersist>;
|
|
613
|
+
use<TMiddleware extends IMiddleware<[TLastEncodeDataOutput] extends [never] ? any : TLastEncodeDataOutput, any, [TLastEncodeChunkOutput] extends [never] ? any : TLastEncodeChunkOutput>>(middleware: TMiddleware): IUniKvsBranch<TKeyValueMapping, [TBranchChunkInput] extends [never] ? never : [$InferDecodeChunkInput<TMiddleware>] extends [never] ? never : TBranchChunkInput, [TBranchChunkOutput] extends [never] ? never : [$InferEncodeChunkOutput<TMiddleware>] extends [never] ? never : TBranchChunkOutput, $IsUnknown<THeadEncodeDataInput> extends true ? $InferEncodeDataInput<TMiddleware> : THeadEncodeDataInput, $IsUnknown<THeadDecodeDataOutput> extends true ? $InferDecodeDataOutput<TMiddleware> : THeadDecodeDataOutput, $IsUnknown<THeadEncodeChunkInput> extends true ? $InferEncodeChunkInput<TMiddleware> : THeadEncodeChunkInput, $IsUnknown<THeadDecodeChunkOutput> extends true ? $InferDecodeChunkOutput<TMiddleware> : THeadDecodeChunkOutput, $InferDecodeDataInput<TMiddleware>, $InferEncodeDataOutput<TMiddleware>, $InferDecodeChunkInput<TMiddleware>, $InferEncodeChunkOutput<TMiddleware>, TBranchHasPersist>;
|
|
614
|
+
persist<TStorage extends IStorage<[TLastEncodeDataOutput] extends [never] ? any : TLastEncodeDataOutput, [TLastDecodeDataInput] extends [never] ? any : TLastDecodeDataInput, [TLastEncodeChunkOutput] extends [never] ? any : TLastEncodeChunkOutput, [TLastDecodeChunkInput] extends [never] ? any : TLastDecodeChunkInput>>(storage: TStorage): IUniKvsBranch<TKeyValueMapping, [TBranchChunkInput] extends [never] ? never : [$InferWriteChunkInput<TStorage>] extends [never] ? never : TBranchChunkInput, [TBranchChunkOutput] extends [never] ? never : [$InferReadChunkOutput<TStorage>] extends [never] ? never : TBranchChunkOutput, $IsUnknown<THeadEncodeDataInput> extends true ? $InferWriteDataInput<TStorage> : THeadEncodeDataInput, $IsUnknown<THeadDecodeDataOutput> extends true ? $InferReadDataOutput<TStorage> : THeadDecodeDataOutput, $IsUnknown<THeadEncodeChunkInput> extends true ? $InferWriteChunkInput<TStorage> : THeadEncodeChunkInput, $IsUnknown<THeadDecodeChunkOutput> extends true ? $InferReadChunkOutput<TStorage> : THeadDecodeChunkOutput, TLastDecodeDataInput, TLastEncodeDataOutput, TLastDecodeChunkInput, TLastEncodeChunkOutput, true>;
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#builder)
|
|
618
|
+
*/
|
|
619
|
+
declare class UniKvsBranch<TKeyValueMapping extends KeyValueMapping = KeyValueMapping, TBranchChunkInput = any, TBranchChunkOutput = any, THeadEncodeDataInput = unknown, THeadDecodeDataOutput = unknown, THeadEncodeChunkInput = unknown, THeadDecodeChunkOutput = unknown, TLastDecodeDataInput = any, TLastEncodeDataOutput = any, TLastDecodeChunkInput = any, TLastEncodeChunkOutput = any, TBranchHasPersist extends boolean = false> implements IUniKvsBranch<TKeyValueMapping, TBranchChunkInput, TBranchChunkOutput, THeadEncodeDataInput, THeadDecodeDataOutput, THeadEncodeChunkInput, THeadDecodeChunkOutput, TLastDecodeDataInput, TLastEncodeDataOutput, TLastDecodeChunkInput, TLastEncodeChunkOutput, TBranchHasPersist> {
|
|
620
|
+
#private;
|
|
621
|
+
constructor();
|
|
622
|
+
fork<TSubChunkInput, TSubChunkOutput, TSubHeadEncodeDataInput, TSubHeadDecodeDataOutput, TSubHeadEncodeChunkInput, TSubHeadDecodeChunkOutput, TSubLastDecodeDataInput, TSubLastEncodeDataOutput, TSubLastDecodeChunkInput, TSubLastEncodeChunkOutput, TSubHasPersist extends boolean>(branch: IUniKvsBranch<any, TSubChunkInput, TSubChunkOutput, TSubHeadEncodeDataInput, TSubHeadDecodeDataOutput, TSubHeadEncodeChunkInput, TSubHeadDecodeChunkOutput, TSubLastDecodeDataInput, TSubLastEncodeDataOutput, TSubLastDecodeChunkInput, TSubLastEncodeChunkOutput, TSubHasPersist> & (TSubHasPersist extends true ? $CheckForkEncodeData<TLastEncodeDataOutput, TSubHeadEncodeDataInput> : unknown) & (TSubHasPersist extends true ? $CheckForkDecodeData<TLastDecodeDataInput, TSubHeadDecodeDataOutput> : unknown) & (TSubHasPersist extends true ? $CheckForkEncodeChunk<TLastEncodeChunkOutput, TSubHeadEncodeChunkInput> : unknown) & (TSubHasPersist extends true ? $CheckForkDecodeChunk<TLastDecodeChunkInput, TSubHeadDecodeChunkOutput> : unknown)): IUniKvsBranch<TKeyValueMapping, TSubHasPersist extends true ? [TBranchChunkInput] extends [never] ? never : [TSubChunkInput] extends [never] ? never : TBranchChunkInput : TBranchChunkInput, TSubHasPersist extends true ? [TBranchChunkOutput] extends [never] ? never : [TSubChunkOutput] extends [never] ? never : TBranchChunkOutput : TBranchChunkOutput, TSubHasPersist extends true ? $IsUnknown<THeadEncodeDataInput> extends true ? TSubHeadEncodeDataInput : THeadEncodeDataInput : THeadEncodeDataInput, TSubHasPersist extends true ? $IsUnknown<THeadDecodeDataOutput> extends true ? TSubHeadDecodeDataOutput : THeadDecodeDataOutput : THeadDecodeDataOutput, TSubHasPersist extends true ? $IsUnknown<THeadEncodeChunkInput> extends true ? TSubHeadEncodeChunkInput : THeadEncodeChunkInput : THeadEncodeChunkInput, TSubHasPersist extends true ? $IsUnknown<THeadDecodeChunkOutput> extends true ? TSubHeadDecodeChunkOutput : THeadDecodeChunkOutput : THeadDecodeChunkOutput, TLastDecodeDataInput, TLastEncodeDataOutput, TLastDecodeChunkInput, TLastEncodeChunkOutput, TBranchHasPersist extends true ? true : TSubHasPersist>;
|
|
623
|
+
use<TMiddleware extends IMiddleware<[TLastEncodeDataOutput] extends [never] ? any : TLastEncodeDataOutput, any, [TLastEncodeChunkOutput] extends [never] ? any : TLastEncodeChunkOutput>>(middleware: TMiddleware): IUniKvsBranch<TKeyValueMapping, [TBranchChunkInput] extends [never] ? never : [$InferDecodeChunkInput<TMiddleware>] extends [never] ? never : TBranchChunkInput, [TBranchChunkOutput] extends [never] ? never : [$InferEncodeChunkOutput<TMiddleware>] extends [never] ? never : TBranchChunkOutput, $IsUnknown<THeadEncodeDataInput> extends true ? $InferEncodeDataInput<TMiddleware> : THeadEncodeDataInput, $IsUnknown<THeadDecodeDataOutput> extends true ? $InferDecodeDataOutput<TMiddleware> : THeadDecodeDataOutput, $IsUnknown<THeadEncodeChunkInput> extends true ? $InferEncodeChunkInput<TMiddleware> : THeadEncodeChunkInput, $IsUnknown<THeadDecodeChunkOutput> extends true ? $InferDecodeChunkOutput<TMiddleware> : THeadDecodeChunkOutput, $InferDecodeDataInput<TMiddleware>, $InferEncodeDataOutput<TMiddleware>, $InferDecodeChunkInput<TMiddleware>, $InferEncodeChunkOutput<TMiddleware>, TBranchHasPersist>;
|
|
624
|
+
persist<TStorage extends IStorage<[TLastEncodeDataOutput] extends [never] ? any : TLastEncodeDataOutput, [TLastDecodeDataInput] extends [never] ? any : TLastDecodeDataInput, [TLastEncodeChunkOutput] extends [never] ? any : TLastEncodeChunkOutput, [TLastDecodeChunkInput] extends [never] ? any : TLastDecodeChunkInput>>(storage: TStorage): IUniKvsBranch<TKeyValueMapping, [TBranchChunkInput] extends [never] ? never : [$InferWriteChunkInput<TStorage>] extends [never] ? never : TBranchChunkInput, [TBranchChunkOutput] extends [never] ? never : [$InferReadChunkOutput<TStorage>] extends [never] ? never : TBranchChunkOutput, $IsUnknown<THeadEncodeDataInput> extends true ? $InferWriteDataInput<TStorage> : THeadEncodeDataInput, $IsUnknown<THeadDecodeDataOutput> extends true ? $InferReadDataOutput<TStorage> : THeadDecodeDataOutput, $IsUnknown<THeadEncodeChunkInput> extends true ? $InferWriteChunkInput<TStorage> : THeadEncodeChunkInput, $IsUnknown<THeadDecodeChunkOutput> extends true ? $InferReadChunkOutput<TStorage> : THeadDecodeChunkOutput, TLastDecodeDataInput, TLastEncodeDataOutput, TLastDecodeChunkInput, TLastEncodeChunkOutput, true>;
|
|
625
|
+
}
|
|
626
|
+
//#endregion
|
|
627
|
+
//#region ../src/_contexts.d.ts
|
|
628
|
+
/**
|
|
629
|
+
* 実行時変数の 1 件分の形式です。
|
|
630
|
+
*/
|
|
631
|
+
type VariablesEntry = readonly [name: string, value: unknown];
|
|
632
|
+
/**
|
|
633
|
+
* 実行時変数の初期値に使えるマップ形式です。
|
|
634
|
+
*
|
|
635
|
+
* レコードまたはエントリーの反復子を受け付けます。
|
|
636
|
+
*/
|
|
637
|
+
type VariablesInit = Readonly<Record<string, unknown>> | Iterable<VariablesEntry>;
|
|
638
|
+
/**
|
|
639
|
+
* 複数のコンテキスト間で共有される変数ストアです。
|
|
640
|
+
*
|
|
641
|
+
* オニオン実行では操作内の全コンテキストが同一ストアを参照します。
|
|
642
|
+
* 下流の `set` を上流が `await next()` の後に `get` で参照できます。
|
|
643
|
+
*/
|
|
644
|
+
type VariablesStore = {
|
|
645
|
+
/**
|
|
646
|
+
* 変数のマップです。
|
|
647
|
+
*/
|
|
648
|
+
readonly data: Map<string, unknown>;
|
|
649
|
+
/**
|
|
650
|
+
* 読み取り専用の変数名の集合です。
|
|
651
|
+
*/
|
|
652
|
+
readonly readonly: Set<string>;
|
|
653
|
+
};
|
|
654
|
+
//#endregion
|
|
655
|
+
//#region ../src/_value-schemas.d.ts
|
|
656
|
+
/**
|
|
657
|
+
* PlainValue 型から内部のデータ型を抽出します。
|
|
658
|
+
*
|
|
659
|
+
* @template TPlainValue 対象となる PlainValue 型です。
|
|
660
|
+
*/
|
|
661
|
+
type $InferPlainValueData<TPlainValue> = TPlainValue extends PlainValue<infer TData, any> ? TData : never;
|
|
662
|
+
/**
|
|
663
|
+
* PlainValue 型から入力データの型を抽出します。
|
|
664
|
+
*
|
|
665
|
+
* @template TPlainValue 対象となる PlainValue 型です。
|
|
666
|
+
*/
|
|
667
|
+
type $InferPlainValueInput<TPlainValue> = TPlainValue extends PlainValue<any, infer TInput> ? TInput : never;
|
|
668
|
+
/**
|
|
669
|
+
* StreamValue 型から内部のチャンクデータ型を抽出します。
|
|
670
|
+
*
|
|
671
|
+
* @template TStreamValue 対象となる StreamValue 型です。
|
|
672
|
+
*/
|
|
673
|
+
type $InferStreamValueChunkData<TStreamValue> = TStreamValue extends StreamValue<infer TChunkData, any> ? TChunkData : never;
|
|
674
|
+
/**
|
|
675
|
+
* スキーマ付きの値が扱うデータの種類です。
|
|
676
|
+
*
|
|
677
|
+
* - `"plain"`: プレーンな値のみを扱います。
|
|
678
|
+
* - `"stream"`: ストリーム形式の値のみを扱います。
|
|
679
|
+
* - `"any"`: プレーンな値とストリーム形式の値のどちらも扱います。
|
|
680
|
+
*/
|
|
681
|
+
type ValueSchemaKind = "plain" | "stream" | "any";
|
|
682
|
+
/**
|
|
683
|
+
* キーに対応する値のスキーマ情報です。
|
|
684
|
+
*/
|
|
685
|
+
type ValueSchemaInfo = {
|
|
686
|
+
/**
|
|
687
|
+
* 扱うデータの種類です。
|
|
688
|
+
*/
|
|
689
|
+
readonly kind: ValueSchemaKind;
|
|
690
|
+
/**
|
|
691
|
+
* データの検証に使用するスキーマです。
|
|
692
|
+
*/
|
|
693
|
+
readonly schema: GenericSchema$1;
|
|
694
|
+
};
|
|
695
|
+
/**
|
|
696
|
+
* キーに対応する値のスキーマ情報を解決するインターフェースです。
|
|
697
|
+
*/
|
|
698
|
+
interface IValueSchemaResolver {
|
|
699
|
+
/**
|
|
700
|
+
* キーに対応する値のスキーマ情報を返します。
|
|
701
|
+
*
|
|
702
|
+
* @param key 解決するキーです。
|
|
703
|
+
*
|
|
704
|
+
* @returns 対応するスキーマ情報を返します。対応する定義がない場合は `undefined` を返します。
|
|
705
|
+
*
|
|
706
|
+
* @throws キーがどのキースキーマにも一致しない場合に `InvalidInputError` を投げます。
|
|
707
|
+
*/
|
|
708
|
+
resolve(key: string): ValueSchemaInfo | undefined;
|
|
709
|
+
}
|
|
710
|
+
//#endregion
|
|
711
|
+
//#region ../src/_middleware.d.ts
|
|
712
|
+
/**
|
|
713
|
+
* `IMiddleware` を `UniKvs` 内部から扱うためのラッパーです。
|
|
714
|
+
*
|
|
715
|
+
* ミドルウェアを安全に使うための検証などの処理が集約されています。
|
|
716
|
+
*/
|
|
717
|
+
declare class UniKvsMiddleware {
|
|
718
|
+
#private;
|
|
719
|
+
/**
|
|
720
|
+
* ミドルウェアの名前です。
|
|
721
|
+
*/
|
|
722
|
+
readonly name: string;
|
|
723
|
+
private constructor();
|
|
724
|
+
/**
|
|
725
|
+
* `IMiddleware` から `UniKvs` 内部から扱うためのミドルウェアを作成します。
|
|
726
|
+
*
|
|
727
|
+
* @param middleware 元となるミドルウェアです。
|
|
728
|
+
*
|
|
729
|
+
* @returns 検証などの機能が集約されたミドルウェアです。
|
|
730
|
+
*/
|
|
731
|
+
static from(middleware: IMiddleware): UniKvsMiddleware;
|
|
732
|
+
/**
|
|
733
|
+
* ミドルウェアを開きます。
|
|
734
|
+
*
|
|
735
|
+
* @param c オープンコンテキストです。
|
|
736
|
+
*/
|
|
737
|
+
open(c: IMiddleware.OpenContext): Promise<void>;
|
|
738
|
+
/**
|
|
739
|
+
* ミドルウェアを閉じます。
|
|
740
|
+
*
|
|
741
|
+
* @param c クローズコンテキストです。
|
|
742
|
+
*/
|
|
743
|
+
close(c: IMiddleware.CloseContext): Promise<void>;
|
|
744
|
+
/**
|
|
745
|
+
* 失敗した実 `close` だけを再試行します。
|
|
746
|
+
*
|
|
747
|
+
* @param c クローズコンテキストです。
|
|
748
|
+
*/
|
|
749
|
+
retryClose(c: IMiddleware.CloseContext): Promise<void>;
|
|
750
|
+
/**
|
|
751
|
+
* キーを写像します。
|
|
752
|
+
*
|
|
753
|
+
* @param c キー写像コンテキストです。
|
|
754
|
+
*
|
|
755
|
+
* @returns 写像後のキーを返します。
|
|
756
|
+
*/
|
|
757
|
+
mapKey(c: IMiddleware.MapKeyContext): string;
|
|
758
|
+
/**
|
|
759
|
+
* 任意の操作に割り込みます。
|
|
760
|
+
*
|
|
761
|
+
* @param c 操作コンテキストです。
|
|
762
|
+
* @param next 後段の処理です。
|
|
763
|
+
*/
|
|
764
|
+
use(c: IMiddleware.UseContext, next: IMiddleware.INext): Promise<void>;
|
|
765
|
+
/**
|
|
766
|
+
* データをエンコードします。
|
|
767
|
+
*
|
|
768
|
+
* @param c エンコードコンテキストです。
|
|
769
|
+
* @param next 後段の処理です。
|
|
770
|
+
*/
|
|
771
|
+
encode(c: IMiddleware.EncodeContext, next: IMiddleware.INext): Promise<void>;
|
|
772
|
+
/**
|
|
773
|
+
* データをデコードします。
|
|
774
|
+
*
|
|
775
|
+
* @param c デコードコンテキストです。
|
|
776
|
+
* @param next 後段の処理です。
|
|
777
|
+
*/
|
|
778
|
+
decode(c: IMiddleware.DecodeContext, next: IMiddleware.INext): Promise<void>;
|
|
779
|
+
/**
|
|
780
|
+
* ストリームをエンコードします。
|
|
781
|
+
*
|
|
782
|
+
* @param c エンコードストリームコンテキストです。
|
|
783
|
+
* @param next 後段の処理です。
|
|
784
|
+
*/
|
|
785
|
+
encodeStream(c: IMiddleware.EncodeStreamContext, next: IMiddleware.INext): Promise<void>;
|
|
786
|
+
/**
|
|
787
|
+
* ストリームをデコードします。
|
|
788
|
+
*
|
|
789
|
+
* @param c デコードストリームコンテキストです。
|
|
790
|
+
* @param next 後段の処理です。
|
|
791
|
+
*/
|
|
792
|
+
decodeStream(c: IMiddleware.DecodeStreamContext, next: IMiddleware.INext): Promise<void>;
|
|
793
|
+
}
|
|
794
|
+
//#endregion
|
|
795
|
+
//#region ../src/_storage.d.ts
|
|
796
|
+
/**
|
|
797
|
+
* `IStorage` を `UniKvs` 内部から扱うためのラッパーです。
|
|
798
|
+
*
|
|
799
|
+
* ストレージを安全に使うための検証などの処理が集約されています。
|
|
800
|
+
*/
|
|
801
|
+
declare class UniKvsStorage {
|
|
802
|
+
#private;
|
|
803
|
+
/**
|
|
804
|
+
* ストレージの名前です。
|
|
805
|
+
*/
|
|
806
|
+
readonly name: string;
|
|
807
|
+
private constructor();
|
|
808
|
+
/**
|
|
809
|
+
* `IStorage` から `UniKvs` 内部から扱うためのストレージを作成します。
|
|
810
|
+
*
|
|
811
|
+
* @param storage 元となるストレージです。
|
|
812
|
+
*
|
|
813
|
+
* @returns 検証などの機能が集約されたストレージです。
|
|
814
|
+
*/
|
|
815
|
+
static from(storage: IStorage): UniKvsStorage;
|
|
816
|
+
/**
|
|
817
|
+
* ストレージを開きます。
|
|
818
|
+
*
|
|
819
|
+
* @param c オープンコンテキストです。
|
|
820
|
+
*/
|
|
821
|
+
open(c: IStorage.OpenContext): Promise<void>;
|
|
822
|
+
/**
|
|
823
|
+
* ストレージを閉じます。
|
|
824
|
+
*
|
|
825
|
+
* @param c クローズコンテキストです。
|
|
826
|
+
*/
|
|
827
|
+
close(c: IStorage.CloseContext): Promise<void>;
|
|
828
|
+
/**
|
|
829
|
+
* 失敗した実 `close` だけを再試行します。
|
|
830
|
+
*
|
|
831
|
+
* @param c クローズコンテキストです。
|
|
832
|
+
*/
|
|
833
|
+
retryClose(c: IStorage.CloseContext): Promise<void>;
|
|
834
|
+
/**
|
|
835
|
+
* データを書き込みます。
|
|
836
|
+
*
|
|
837
|
+
* @param c 書き込みコンテキストです。
|
|
838
|
+
* @param data 書き込むデータです。
|
|
839
|
+
*/
|
|
840
|
+
write(c: IStorage.WriteContext, data: unknown): Promise<void>;
|
|
841
|
+
/**
|
|
842
|
+
* データを読み取ります。
|
|
843
|
+
*
|
|
844
|
+
* @param c 読み取りコンテキストです。
|
|
845
|
+
*
|
|
846
|
+
* @returns 読み取ったデータを返します。
|
|
847
|
+
*/
|
|
848
|
+
read(c: IStorage.ReadContext): Promise<unknown>;
|
|
849
|
+
/**
|
|
850
|
+
* データの存在を確認します。
|
|
851
|
+
*
|
|
852
|
+
* @param c 存在確認コンテキストです。
|
|
853
|
+
*
|
|
854
|
+
* @returns 存在する場合は `true` を返します。
|
|
855
|
+
*/
|
|
856
|
+
exists(c: IStorage.ExistsContext): Promise<boolean>;
|
|
857
|
+
/**
|
|
858
|
+
* データを削除します。
|
|
859
|
+
*
|
|
860
|
+
* @param c 削除コンテキストです。
|
|
861
|
+
*/
|
|
862
|
+
delete(c: IStorage.DeleteContext): Promise<void>;
|
|
863
|
+
/**
|
|
864
|
+
* データをすべて削除します。
|
|
865
|
+
*
|
|
866
|
+
* @param c クリアコンテキストです。
|
|
867
|
+
*/
|
|
868
|
+
clear(c: IStorage.ClearContext): Promise<void>;
|
|
869
|
+
/**
|
|
870
|
+
* 読み取り用のストリームを取得します。
|
|
871
|
+
*
|
|
872
|
+
* @param c ストリーム取得コンテキストです。
|
|
873
|
+
*
|
|
874
|
+
* @returns 読み取り用のストリームを返します。
|
|
875
|
+
*/
|
|
876
|
+
getReadable(c: IStorage.GetReadableContext): Promise<IReadableStream>;
|
|
877
|
+
/**
|
|
878
|
+
* 書き込み用のストリームを取得します。
|
|
879
|
+
*
|
|
880
|
+
* @param c ストリーム取得コンテキストです。
|
|
881
|
+
*
|
|
882
|
+
* @returns 書き込み用のストリームを返します。
|
|
883
|
+
*/
|
|
884
|
+
getWritable(c: IStorage.GetWritableContext): Promise<IWritableStream>;
|
|
885
|
+
/**
|
|
886
|
+
* 他のストレージへの書き込み失敗を通知します。
|
|
887
|
+
*
|
|
888
|
+
* @param c 書き込み失敗通知コンテキストです。
|
|
889
|
+
* @param err 集約エラーです。
|
|
890
|
+
*/
|
|
891
|
+
onOtherWriteError(c: IStorage.OtherWriteErrorHandlerContext, err: PluginOperationAggregateError): Promise<void>;
|
|
892
|
+
}
|
|
893
|
+
//#endregion
|
|
894
|
+
//#region ../src/_pipeline-graph.types.d.ts
|
|
895
|
+
/**
|
|
896
|
+
* パイプラインの葉となる宛先です。
|
|
897
|
+
*/
|
|
898
|
+
type PipelineLeaf = {
|
|
899
|
+
/**
|
|
900
|
+
* データの永続化先です。
|
|
901
|
+
*/
|
|
902
|
+
readonly storage: UniKvsStorage;
|
|
903
|
+
/**
|
|
904
|
+
* 宛先の登録順 (0 起点) です。
|
|
905
|
+
*/
|
|
906
|
+
readonly index: number;
|
|
907
|
+
/**
|
|
908
|
+
* ストレージ名のキャッシュです。
|
|
909
|
+
*/
|
|
910
|
+
readonly name: string;
|
|
911
|
+
/**
|
|
912
|
+
* 経路上に `AllowRepair` が存在するかどうかです。
|
|
913
|
+
*/
|
|
914
|
+
readonly canRepair: boolean;
|
|
915
|
+
/**
|
|
916
|
+
* 葉 1 件分の凍結された名前空間です。
|
|
917
|
+
*/
|
|
918
|
+
readonly nameNames: readonly string[];
|
|
919
|
+
/**
|
|
920
|
+
* 根直下から葉の直前までのノード列です。
|
|
921
|
+
* グラフ自身の走査と内部単体テスト専用です。
|
|
922
|
+
*
|
|
923
|
+
* @internal
|
|
924
|
+
*/
|
|
925
|
+
readonly path: readonly PipelineNode[];
|
|
926
|
+
};
|
|
927
|
+
/**
|
|
928
|
+
* パイプラインの節となるミドルウェアです。
|
|
929
|
+
*/
|
|
930
|
+
type PipelineNode = {
|
|
931
|
+
/**
|
|
932
|
+
* 節を構成するミドルウェアです。
|
|
933
|
+
*/
|
|
934
|
+
readonly middleware: UniKvsMiddleware;
|
|
935
|
+
/**
|
|
936
|
+
* この節で終端する葉です。
|
|
937
|
+
* 登録順に保持します。
|
|
938
|
+
*/
|
|
939
|
+
readonly leaves: readonly PipelineLeaf[];
|
|
940
|
+
/**
|
|
941
|
+
* 子の節です。
|
|
942
|
+
* 登録順に保持します。
|
|
943
|
+
*/
|
|
944
|
+
readonly children: readonly PipelineNode[];
|
|
945
|
+
/**
|
|
946
|
+
* 直下の葉と節を登録順に列挙した静的な項目列です。
|
|
947
|
+
*/
|
|
948
|
+
readonly entries: readonly PipelineEntry[];
|
|
949
|
+
/**
|
|
950
|
+
* 部分木の全葉です。
|
|
951
|
+
* 登録順に保持します。
|
|
952
|
+
*/
|
|
953
|
+
readonly allLeaves: readonly PipelineLeaf[];
|
|
954
|
+
/**
|
|
955
|
+
* 部分木の全葉名です。
|
|
956
|
+
* 凍結されています。
|
|
957
|
+
*/
|
|
958
|
+
readonly leafNames: readonly string[];
|
|
959
|
+
};
|
|
960
|
+
/**
|
|
961
|
+
* 節または葉を登録順に列挙するための項目です。
|
|
962
|
+
*/
|
|
963
|
+
type PipelineEntry = {
|
|
964
|
+
/**
|
|
965
|
+
* 葉であることを示します。
|
|
966
|
+
*/
|
|
967
|
+
readonly kind: "leaf";
|
|
968
|
+
/**
|
|
969
|
+
* 対象の葉です。
|
|
970
|
+
*/
|
|
971
|
+
readonly leaf: PipelineLeaf;
|
|
972
|
+
} | {
|
|
973
|
+
/**
|
|
974
|
+
* 節であることを示します。
|
|
975
|
+
*/
|
|
976
|
+
readonly kind: "node";
|
|
977
|
+
/**
|
|
978
|
+
* 対象の節です。
|
|
979
|
+
*/
|
|
980
|
+
readonly node: PipelineNode;
|
|
981
|
+
};
|
|
982
|
+
/**
|
|
983
|
+
* コンパイル前の宛先定義です。
|
|
984
|
+
*/
|
|
985
|
+
type PipelineDestination = {
|
|
986
|
+
/**
|
|
987
|
+
* データの永続化先です。
|
|
988
|
+
*/
|
|
989
|
+
readonly storage: UniKvsStorage;
|
|
990
|
+
/**
|
|
991
|
+
* 適用順のミドルウェア列です。末尾未使用分は含みません。
|
|
992
|
+
*/
|
|
993
|
+
readonly middlewares: readonly UniKvsMiddleware[];
|
|
994
|
+
};
|
|
995
|
+
/**
|
|
996
|
+
* 葉へ書き込むためのエンコード結果です。
|
|
997
|
+
*/
|
|
998
|
+
type EncodeTarget = {
|
|
999
|
+
/**
|
|
1000
|
+
* 対象の葉です。
|
|
1001
|
+
*/
|
|
1002
|
+
readonly leaf: PipelineLeaf;
|
|
1003
|
+
/**
|
|
1004
|
+
* エンコード済みのデータです。
|
|
1005
|
+
*/
|
|
1006
|
+
readonly data: unknown;
|
|
1007
|
+
/**
|
|
1008
|
+
* 写像済みのキーです。
|
|
1009
|
+
*/
|
|
1010
|
+
readonly key: string;
|
|
1011
|
+
};
|
|
1012
|
+
/**
|
|
1013
|
+
* 解決済みの葉です。
|
|
1014
|
+
*/
|
|
1015
|
+
type ResolvedLeaf = {
|
|
1016
|
+
/**
|
|
1017
|
+
* 対象の葉です。
|
|
1018
|
+
*/
|
|
1019
|
+
readonly leaf: PipelineLeaf;
|
|
1020
|
+
/**
|
|
1021
|
+
* 写像済みのキーです。
|
|
1022
|
+
*/
|
|
1023
|
+
readonly key: string;
|
|
1024
|
+
};
|
|
1025
|
+
/**
|
|
1026
|
+
* ストリームのエンコード先となる葉です。
|
|
1027
|
+
*/
|
|
1028
|
+
type StreamEncodeTarget = {
|
|
1029
|
+
/**
|
|
1030
|
+
* 対象の葉です。
|
|
1031
|
+
*/
|
|
1032
|
+
readonly leaf: PipelineLeaf;
|
|
1033
|
+
/**
|
|
1034
|
+
* 葉へ書き込むストリームです。
|
|
1035
|
+
*/
|
|
1036
|
+
readonly stream: IReadableStream;
|
|
1037
|
+
/**
|
|
1038
|
+
* 写像済みのキーです。
|
|
1039
|
+
*/
|
|
1040
|
+
readonly key: string;
|
|
1041
|
+
};
|
|
1042
|
+
/**
|
|
1043
|
+
* 構築済みのストリームエンコード木です。
|
|
1044
|
+
*/
|
|
1045
|
+
type StreamEncodeTree = {
|
|
1046
|
+
/**
|
|
1047
|
+
* 登録順の書き込み対象です。
|
|
1048
|
+
*/
|
|
1049
|
+
readonly targets: StreamEncodeTarget[];
|
|
1050
|
+
/**
|
|
1051
|
+
* 読み取り側へ渡すストリームです。`splitRead` を指定したときだけ分岐後の読み取り側になります。
|
|
1052
|
+
*/
|
|
1053
|
+
readonly readStream: IReadableStream;
|
|
1054
|
+
};
|
|
1055
|
+
/**
|
|
1056
|
+
* 書き込み対象とする葉を判定する関数です。
|
|
1057
|
+
*/
|
|
1058
|
+
interface IActiveLeafChecker {
|
|
1059
|
+
/**
|
|
1060
|
+
* 書き込み対象とする葉を判定します。
|
|
1061
|
+
*
|
|
1062
|
+
* @param leaf 対象の葉です。
|
|
1063
|
+
*
|
|
1064
|
+
* @returns 判定結果です。
|
|
1065
|
+
*/
|
|
1066
|
+
(leaf: PipelineLeaf): boolean;
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* 節の `encodeStream` または `mapKey` が失敗したときの処理を行う関数です。
|
|
1070
|
+
*/
|
|
1071
|
+
interface IEncodeNodeErrorHandler {
|
|
1072
|
+
/**
|
|
1073
|
+
* 節のセットアップ失敗時の処理です。
|
|
1074
|
+
*
|
|
1075
|
+
* `true` を返すと節の部分木をスキップします。
|
|
1076
|
+
* 例外を投げた場合はそのまま伝播します。
|
|
1077
|
+
*
|
|
1078
|
+
* @param ex 節の取得または写像で発生した例外です。
|
|
1079
|
+
* @param activeLeaves 節の配下で対象となる葉です。
|
|
1080
|
+
*
|
|
1081
|
+
* @returns 部分木をスキップする場合は `true` を返します。
|
|
1082
|
+
*/
|
|
1083
|
+
(ex: unknown, activeLeaves: readonly PipelineLeaf[]): boolean;
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* ストリームエンコード木の構築オプションです。
|
|
1087
|
+
*/
|
|
1088
|
+
type BuildEncodeTreeOptions = {
|
|
1089
|
+
/**
|
|
1090
|
+
* 書き込み対象とする葉を判定します。省略時は全葉が対象です。
|
|
1091
|
+
*/
|
|
1092
|
+
readonly isActive?: IActiveLeafChecker | undefined;
|
|
1093
|
+
/**
|
|
1094
|
+
* 読み取り側と書き込み側を分岐するかどうかです。書き戻しで使用します。
|
|
1095
|
+
*/
|
|
1096
|
+
readonly splitRead?: boolean | undefined;
|
|
1097
|
+
/**
|
|
1098
|
+
* 節のセットアップ失敗を分類します。省略時は生の例外として伝播します。
|
|
1099
|
+
*/
|
|
1100
|
+
readonly onNodeError?: IEncodeNodeErrorHandler | undefined;
|
|
1101
|
+
};
|
|
1102
|
+
/**
|
|
1103
|
+
* 操作共通の実行時情報です。
|
|
1104
|
+
*
|
|
1105
|
+
* `store` は操作内の全コンテキストで共有され、下流の `set` が上流の `get` に見えます。
|
|
1106
|
+
*/
|
|
1107
|
+
type OperationScope = {
|
|
1108
|
+
/**
|
|
1109
|
+
* 操作対象の論理キーです。
|
|
1110
|
+
*/
|
|
1111
|
+
readonly key: string;
|
|
1112
|
+
/**
|
|
1113
|
+
* 中断シグナルです。
|
|
1114
|
+
*/
|
|
1115
|
+
readonly signal: AbortSignal;
|
|
1116
|
+
/**
|
|
1117
|
+
* 操作内で共有される変数ストアです。
|
|
1118
|
+
*/
|
|
1119
|
+
readonly store: VariablesStore;
|
|
1120
|
+
};
|
|
1121
|
+
//#endregion
|
|
1122
|
+
//#region ../src/_pipeline-leaf-resolver.d.ts
|
|
1123
|
+
/**
|
|
1124
|
+
* 単一操作のスコープで葉の写像キーを解決します。
|
|
1125
|
+
*
|
|
1126
|
+
* 新 `mapKey` は同期的であり、中断シグナルも受け付けないため、共有節の写像は操作内で 1 回だけ実行され、結果を使い回します。
|
|
1127
|
+
* 並行解決でも `Map` キャッシュにより重複しません (`resolve` 自体が同期的であるため、競合しません)。
|
|
1128
|
+
*/
|
|
1129
|
+
declare class LeafResolver {
|
|
1130
|
+
#private;
|
|
1131
|
+
/**
|
|
1132
|
+
* 通常は `PipelineGraph.createResolver` から生成します。
|
|
1133
|
+
*
|
|
1134
|
+
* @param scope 操作共通の実行時情報です。
|
|
1135
|
+
*/
|
|
1136
|
+
constructor(scope: OperationScope);
|
|
1137
|
+
/**
|
|
1138
|
+
* 葉の写像キーを解決します。
|
|
1139
|
+
*
|
|
1140
|
+
* @param leaf 解決する葉です。
|
|
1141
|
+
*
|
|
1142
|
+
* @returns 解決済みの葉を返します。
|
|
1143
|
+
*/
|
|
1144
|
+
resolve(leaf: PipelineLeaf): ResolvedLeaf;
|
|
1145
|
+
}
|
|
1146
|
+
//#endregion
|
|
1147
|
+
//#region ../src/_pipeline-graph.d.ts
|
|
1148
|
+
/**
|
|
1149
|
+
* コンパイル済みのパイプライン・グラフです。
|
|
1150
|
+
*
|
|
1151
|
+
* 宛先の変換チェーンをミドルウェアのインスタンス同一性で共有する根付き木として保持し、操作ごとの走査・エンコード・書き戻し・ストリーム構築を提供します。
|
|
1152
|
+
*
|
|
1153
|
+
* 不変条件 :
|
|
1154
|
+
* - 葉(`leaves`)と各節の項目(`entries`)は宛先の登録順です。
|
|
1155
|
+
* - 名簿(`leafNames` / `nameNames`)は凍結された配列で、直通区間では参照を共有します。
|
|
1156
|
+
* - 共有節は 1 操作内で 1 回だけ `encode`/`encodeStream`/`mapKey` を実行します。分岐点ではプレーン値のエンコード結果を共有し、ストリームは tee で分岐します。
|
|
1157
|
+
* - 書き戻しの拒否は、走査中と書き込み中の 2 経路で分類します。いずれも即時に確定します。
|
|
1158
|
+
*/
|
|
1159
|
+
declare class PipelineGraph {
|
|
1160
|
+
#private;
|
|
1161
|
+
private constructor();
|
|
1162
|
+
/**
|
|
1163
|
+
* 宛先定義の列を trie にコンパイルします。
|
|
1164
|
+
*
|
|
1165
|
+
* ミドルウェアはインスタンス同一性で共有します。同一インスタンスが複数の節に現れても、`open`/`close`/`use` の対象には初出の 1 件だけを保持します。
|
|
1166
|
+
*
|
|
1167
|
+
* @param destinations コンパイルする宛先定義です。
|
|
1168
|
+
*
|
|
1169
|
+
* @returns コンパイル済みのパイプライン・グラフを返します。
|
|
1170
|
+
*/
|
|
1171
|
+
static compile(destinations: readonly PipelineDestination[]): PipelineGraph;
|
|
1172
|
+
/**
|
|
1173
|
+
* 全葉です。登録順に保持します。
|
|
1174
|
+
*/
|
|
1175
|
+
get leaves(): readonly PipelineLeaf[];
|
|
1176
|
+
/**
|
|
1177
|
+
* `open`/`close`/`use` の対象となるミドルウェアです。
|
|
1178
|
+
* 初出順・重複なしです。
|
|
1179
|
+
*/
|
|
1180
|
+
get middlewares(): readonly UniKvsMiddleware[];
|
|
1181
|
+
/**
|
|
1182
|
+
* 全葉数が 1 件かどうかです。
|
|
1183
|
+
*/
|
|
1184
|
+
get isSingleLeaf(): boolean;
|
|
1185
|
+
/**
|
|
1186
|
+
* 葉数です。
|
|
1187
|
+
*/
|
|
1188
|
+
get size(): number;
|
|
1189
|
+
/**
|
|
1190
|
+
* 葉を登録順に列挙します。
|
|
1191
|
+
*/
|
|
1192
|
+
[Symbol.iterator](): IterableIterator<PipelineLeaf>;
|
|
1193
|
+
/**
|
|
1194
|
+
* 節を根から前順 (親が子より前、兄弟は登録順) に列挙します。
|
|
1195
|
+
*
|
|
1196
|
+
* 構造の確認・保守用です。操作の走査には使用しません。
|
|
1197
|
+
*
|
|
1198
|
+
* @yields 前順の節です。
|
|
1199
|
+
*/
|
|
1200
|
+
nodes(): IterableIterator<PipelineNode>;
|
|
1201
|
+
/**
|
|
1202
|
+
* 単一操作のスコープでキー写像をメモ化するリゾルバーを生成します。
|
|
1203
|
+
*
|
|
1204
|
+
* 新 `mapKey` は同期的であるため、リゾルバーも同期的です。共有節の写像は操作内で 1 回だけ実行されます。
|
|
1205
|
+
*
|
|
1206
|
+
* @param key 根のキー (論理キー) です。
|
|
1207
|
+
* @param vars 根の実行時変数です。
|
|
1208
|
+
*
|
|
1209
|
+
* @returns 葉リゾルバーを返します。
|
|
1210
|
+
*/
|
|
1211
|
+
createResolver(scope: OperationScope): LeafResolver;
|
|
1212
|
+
/**
|
|
1213
|
+
* 葉の経路のミドルウェアを逆順に適用してデータをデコードします。
|
|
1214
|
+
*
|
|
1215
|
+
* 各段の前後で中断を確認します。
|
|
1216
|
+
*
|
|
1217
|
+
* @param leaf デコード元の葉です。
|
|
1218
|
+
* @param scope 操作共通の実行時情報です。`key` は論理キーです。
|
|
1219
|
+
* @param data デコードするデータです。
|
|
1220
|
+
*
|
|
1221
|
+
* @returns デコード済みのデータを返します。
|
|
1222
|
+
*/
|
|
1223
|
+
decode(leaf: PipelineLeaf, scope: OperationScope, data: unknown): Promise<unknown>;
|
|
1224
|
+
/**
|
|
1225
|
+
* 葉の経路のミドルウェアを逆順に `pipeThrough` してストリームをデコードします。
|
|
1226
|
+
*
|
|
1227
|
+
* @param leaf デコード元の葉です。
|
|
1228
|
+
* @param scope 操作共通の実行時情報です。`key` は論理キーです。
|
|
1229
|
+
* @param source 入力ストリームです。
|
|
1230
|
+
*
|
|
1231
|
+
* @returns デコード済みのストリームを返します。
|
|
1232
|
+
*/
|
|
1233
|
+
decodeStream(leaf: PipelineLeaf, scope: OperationScope, source: IReadableStream): Promise<IReadableStream>;
|
|
1234
|
+
/**
|
|
1235
|
+
* 共有節を 1 回だけ実行しながら、全葉向けのプレーン値をエンコードします。
|
|
1236
|
+
*
|
|
1237
|
+
* エンコード中の失敗は生の例外として投げます。
|
|
1238
|
+
*
|
|
1239
|
+
* @param scope 操作共通の実行時情報です。`key` は論理キーです。
|
|
1240
|
+
* @param data エンコードするデータです。
|
|
1241
|
+
*
|
|
1242
|
+
* @returns 登録順のエンコード結果を返します。
|
|
1243
|
+
*/
|
|
1244
|
+
encode(scope: OperationScope, data: unknown): Promise<EncodeTarget[]>;
|
|
1245
|
+
/**
|
|
1246
|
+
* 書き戻し対象の葉へ、共有節を 1 回だけ実行しながら再エンコードして書き込みます。
|
|
1247
|
+
*
|
|
1248
|
+
* 葉への書き込みは並列に開始し、対象単位の拒否は記録だけして他の対象の開始を止めません。
|
|
1249
|
+
* 走査中に確定した拒否は即座に投げます。書き込み中に判明した拒否も、応答のない他の書き込みを待たずに確定させます。
|
|
1250
|
+
* 拒否がなければ全タスクの終了を待ちます。
|
|
1251
|
+
*
|
|
1252
|
+
* @param scope 操作共通の実行時情報です。`key` は論理キーです。
|
|
1253
|
+
* @param targets 書き戻し対象の葉です。登録順に渡します。
|
|
1254
|
+
* @param throwOnRepairDenied 書き戻し拒否をエラーとして投げるかどうかです。
|
|
1255
|
+
* @param data デコード済みの原データです。
|
|
1256
|
+
* @param write 葉への書き込み処理です。
|
|
1257
|
+
*/
|
|
1258
|
+
repair(scope: OperationScope, targets: readonly PipelineLeaf[], throwOnRepairDenied: boolean, data: unknown, write: (leaf: PipelineLeaf, key: string, data: unknown) => Promise<void>): Promise<void>;
|
|
1259
|
+
/**
|
|
1260
|
+
* 共有節を 1 回だけ実行しながらストリームエンコード木を構築します。
|
|
1261
|
+
*
|
|
1262
|
+
* 新 Middleware の `encodeStream` は `c.source.pipeThrough(...)` で変換し `c.destination` に設定します。
|
|
1263
|
+
* 共有節の実行は 1 回だけであり、分岐点では tee で入力を分けます。
|
|
1264
|
+
* 計画段階の失敗は何も構築せずに伝播するため、呼び出し側が `streams` のソースをキャンセルします。
|
|
1265
|
+
* tee とパイプの構築後の失敗は、`streams` に収集したストリーム (分割した読み取り側を含む) を内部でキャンセルしてから伝播します。
|
|
1266
|
+
* 呼び出し側はどちらの失敗でも `streams` をキャンセルできます。
|
|
1267
|
+
*
|
|
1268
|
+
* @param scope 操作共通の実行時情報です。`key` は論理キーです。
|
|
1269
|
+
* @param source 入力ストリームです。
|
|
1270
|
+
* @param streams 構築したストリームを収集する集合です。呼び出し側がソースを事前に追加します。
|
|
1271
|
+
* @param options 構築オプションです。
|
|
1272
|
+
*
|
|
1273
|
+
* @returns 構築結果を返します。
|
|
1274
|
+
*/
|
|
1275
|
+
buildEncodeTree(scope: OperationScope, source: IReadableStream, streams: Set<IReadableStream>, options?: BuildEncodeTreeOptions): Promise<StreamEncodeTree>;
|
|
1276
|
+
}
|
|
1277
|
+
//#endregion
|
|
1278
|
+
//#region ../src/_unikvs.schemas.d.ts
|
|
1279
|
+
declare const VariablesInitSchema: GenericSchema<any, readonly VariablesEntry[]>;
|
|
1280
|
+
declare const OpenOptionsSchema: ObjectSchema<{
|
|
1281
|
+
readonly vars: OptionalSchema<typeof VariablesInitSchema, undefined>;
|
|
1282
|
+
readonly signal: OptionalSchema<InstanceSchema<typeof AbortSignal, undefined>, undefined>;
|
|
1283
|
+
}, undefined>;
|
|
1284
|
+
declare const CloseOptionsSchema: ObjectSchema<{
|
|
1285
|
+
readonly vars: OptionalSchema<typeof VariablesInitSchema, undefined>;
|
|
1286
|
+
readonly signal: OptionalSchema<InstanceSchema<typeof AbortSignal, undefined>, undefined>;
|
|
1287
|
+
}, undefined>;
|
|
1288
|
+
declare const ClearOptionsSchema: ObjectSchema<{
|
|
1289
|
+
readonly vars: OptionalSchema<typeof VariablesInitSchema, undefined>;
|
|
1290
|
+
readonly signal: OptionalSchema<InstanceSchema<typeof AbortSignal, undefined>, undefined>;
|
|
1291
|
+
}, undefined>;
|
|
1292
|
+
//#endregion
|
|
1293
|
+
//#region ../src/unikvs.types.d.ts
|
|
1294
|
+
type KeyofKeyValueMapping<TKeyValueMapping extends KeyValueMapping = KeyValueMapping> = Extract<keyof TKeyValueMapping, string>;
|
|
1295
|
+
/**
|
|
1296
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
1297
|
+
*/
|
|
1298
|
+
type SetValue<TValue extends Value> = $InferPlainValueInput<TValue> | (TValue extends StreamValue<any, infer TChunkInput> ? ReadableStream<TChunkInput> : never);
|
|
1299
|
+
/**
|
|
1300
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
1301
|
+
*/
|
|
1302
|
+
type KeyofKeyValueMappingHasPlainValue<TKeyValueMapping extends KeyValueMapping> = ValueOf<{ [TKey in KeyofKeyValueMapping<TKeyValueMapping>]: PlainValue extends TKeyValueMapping[TKey] ? TKey : never; }>;
|
|
1303
|
+
/**
|
|
1304
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
1305
|
+
*/
|
|
1306
|
+
type KeyofKeyValueMappingHasStreamValue<TKeyValueMapping extends KeyValueMapping> = ValueOf<{ [TKey in KeyofKeyValueMapping<TKeyValueMapping>]: StreamValue extends TKeyValueMapping[TKey] ? TKey : never; }>;
|
|
1307
|
+
/**
|
|
1308
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#client-operations)
|
|
1309
|
+
*/
|
|
1310
|
+
type OpenOptions = InferInput<typeof OpenOptionsSchema>;
|
|
1311
|
+
/**
|
|
1312
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#client-operations)
|
|
1313
|
+
*/
|
|
1314
|
+
type CloseOptions = InferInput<typeof CloseOptionsSchema>;
|
|
1315
|
+
/**
|
|
1316
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#client-operations)
|
|
1317
|
+
*/
|
|
1318
|
+
type SetOptions<TKeyValueMapping extends KeyValueMapping = KeyValueMapping, TKey extends KeyofKeyValueMapping<TKeyValueMapping> = KeyofKeyValueMapping<TKeyValueMapping>> = {
|
|
1319
|
+
/**
|
|
1320
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#client-operations)
|
|
1321
|
+
*/
|
|
1322
|
+
readonly key: TKey;
|
|
1323
|
+
/**
|
|
1324
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#client-operations)
|
|
1325
|
+
*/
|
|
1326
|
+
readonly value: SetValue<TKeyValueMapping[TKey]>;
|
|
1327
|
+
/**
|
|
1328
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#variables-and-cancellation)
|
|
1329
|
+
*/
|
|
1330
|
+
readonly signal?: AbortSignal | undefined;
|
|
1331
|
+
/**
|
|
1332
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#variables-and-cancellation)
|
|
1333
|
+
*/
|
|
1334
|
+
readonly vars?: VariablesInit | undefined;
|
|
1335
|
+
};
|
|
1336
|
+
/**
|
|
1337
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#client-operations)
|
|
1338
|
+
*/
|
|
1339
|
+
type GetOptions<TKey = string> = {
|
|
1340
|
+
/**
|
|
1341
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#client-operations)
|
|
1342
|
+
*/
|
|
1343
|
+
readonly key: TKey;
|
|
1344
|
+
/**
|
|
1345
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#client-operations)
|
|
1346
|
+
*/
|
|
1347
|
+
readonly repair?: boolean | undefined;
|
|
1348
|
+
/**
|
|
1349
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#client-operations)
|
|
1350
|
+
*/
|
|
1351
|
+
readonly throwOnRepairDenied?: boolean | undefined;
|
|
1352
|
+
/**
|
|
1353
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#variables-and-cancellation)
|
|
1354
|
+
*/
|
|
1355
|
+
readonly signal?: AbortSignal | undefined;
|
|
1356
|
+
/**
|
|
1357
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#variables-and-cancellation)
|
|
1358
|
+
*/
|
|
1359
|
+
readonly vars?: VariablesInit | undefined;
|
|
1360
|
+
};
|
|
1361
|
+
/**
|
|
1362
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-stream)
|
|
1363
|
+
*/
|
|
1364
|
+
type StreamOptions<TKey = string> = {
|
|
1365
|
+
/**
|
|
1366
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-stream)
|
|
1367
|
+
*/
|
|
1368
|
+
readonly key: TKey;
|
|
1369
|
+
/**
|
|
1370
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-stream)
|
|
1371
|
+
*/
|
|
1372
|
+
readonly repair?: boolean | undefined;
|
|
1373
|
+
/**
|
|
1374
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-stream)
|
|
1375
|
+
*/
|
|
1376
|
+
readonly throwOnRepairDenied?: boolean | undefined;
|
|
1377
|
+
/**
|
|
1378
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#variables-and-cancellation)
|
|
1379
|
+
*/
|
|
1380
|
+
readonly signal?: AbortSignal | undefined;
|
|
1381
|
+
/**
|
|
1382
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#variables-and-cancellation)
|
|
1383
|
+
*/
|
|
1384
|
+
readonly vars?: VariablesInit | undefined;
|
|
1385
|
+
};
|
|
1386
|
+
/**
|
|
1387
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#client-operations)
|
|
1388
|
+
*/
|
|
1389
|
+
type HasOptions<TKey = string> = {
|
|
1390
|
+
/**
|
|
1391
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#client-operations)
|
|
1392
|
+
*/
|
|
1393
|
+
readonly key: TKey;
|
|
1394
|
+
/**
|
|
1395
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#variables-and-cancellation)
|
|
1396
|
+
*/
|
|
1397
|
+
readonly signal?: AbortSignal | undefined;
|
|
1398
|
+
/**
|
|
1399
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#variables-and-cancellation)
|
|
1400
|
+
*/
|
|
1401
|
+
readonly vars?: VariablesInit | undefined;
|
|
1402
|
+
};
|
|
1403
|
+
/**
|
|
1404
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#client-operations)
|
|
1405
|
+
*/
|
|
1406
|
+
type DeleteOptions<TKey = string> = {
|
|
1407
|
+
/**
|
|
1408
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#client-operations)
|
|
1409
|
+
*/
|
|
1410
|
+
readonly key: TKey;
|
|
1411
|
+
/**
|
|
1412
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#variables-and-cancellation)
|
|
1413
|
+
*/
|
|
1414
|
+
readonly signal?: AbortSignal | undefined;
|
|
1415
|
+
/**
|
|
1416
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#variables-and-cancellation)
|
|
1417
|
+
*/
|
|
1418
|
+
readonly vars?: VariablesInit | undefined;
|
|
1419
|
+
};
|
|
1420
|
+
/**
|
|
1421
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#client-operations)
|
|
1422
|
+
*/
|
|
1423
|
+
type ClearOptions = InferInput<typeof ClearOptionsSchema>;
|
|
1424
|
+
//#endregion
|
|
1425
|
+
//#region ../src/unikvs.d.ts
|
|
1426
|
+
/**
|
|
1427
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#client-operations)
|
|
1428
|
+
*/
|
|
1429
|
+
declare class UniKvs<TKeyValueMapping extends KeyValueMapping = KeyValueMapping> {
|
|
1430
|
+
#private;
|
|
1431
|
+
/**
|
|
1432
|
+
* @internal
|
|
1433
|
+
*/
|
|
1434
|
+
constructor(vars: readonly VariablesEntry[], pipeline: PipelineGraph, valueSchemaResolver?: IValueSchemaResolver | null);
|
|
1435
|
+
/**
|
|
1436
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#base-vars-set-vars)
|
|
1437
|
+
*/
|
|
1438
|
+
setVars(vars: VariablesInit): this;
|
|
1439
|
+
/**
|
|
1440
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#base-vars-assign-vars)
|
|
1441
|
+
*/
|
|
1442
|
+
assignVars(vars: VariablesInit): this;
|
|
1443
|
+
/**
|
|
1444
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#base-vars-defaults-vars)
|
|
1445
|
+
*/
|
|
1446
|
+
defaultsVars(vars: VariablesInit): this;
|
|
1447
|
+
get isOpen(): boolean;
|
|
1448
|
+
open(options?: OpenOptions): Promise<void>;
|
|
1449
|
+
close(options?: CloseOptions): Promise<void>;
|
|
1450
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
1451
|
+
set<const TKey extends KeyofKeyValueMapping<TKeyValueMapping>>(options: SetOptions<TKeyValueMapping, TKey>): Promise<void>;
|
|
1452
|
+
set<const TKey extends KeyofKeyValueMapping<TKeyValueMapping>>(key: TKey, value: SetValue<TKeyValueMapping[TKey]>, options?: Omit<SetOptions, "key" | "value">): Promise<void>;
|
|
1453
|
+
get<const TKey extends KeyofKeyValueMappingHasPlainValue<TKeyValueMapping>>(options: GetOptions<TKey>): Promise<$InferPlainValueData<TKeyValueMapping[TKey]>>;
|
|
1454
|
+
get<const TKey extends KeyofKeyValueMappingHasPlainValue<TKeyValueMapping>>(key: TKey, options?: Omit<GetOptions, "key">): Promise<$InferPlainValueData<TKeyValueMapping[TKey]>>;
|
|
1455
|
+
stream<const TKey extends KeyofKeyValueMappingHasStreamValue<TKeyValueMapping>>(options: StreamOptions<TKey>): Promise<IValueStream<$InferStreamValueChunkData<TKeyValueMapping[TKey]>>>;
|
|
1456
|
+
stream<const TKey extends KeyofKeyValueMappingHasStreamValue<TKeyValueMapping>>(key: TKey, options?: Omit<StreamOptions, "key">): Promise<IValueStream<$InferStreamValueChunkData<TKeyValueMapping[TKey]>>>;
|
|
1457
|
+
has(options: HasOptions<KeyofKeyValueMapping<TKeyValueMapping>>): Promise<boolean>;
|
|
1458
|
+
has(key: KeyofKeyValueMapping<TKeyValueMapping>, options?: Omit<HasOptions, "key">): Promise<boolean>;
|
|
1459
|
+
delete(options: DeleteOptions<KeyofKeyValueMapping<TKeyValueMapping>>): Promise<void>;
|
|
1460
|
+
delete(key: KeyofKeyValueMapping<TKeyValueMapping>, options?: Omit<DeleteOptions, "key">): Promise<void>;
|
|
1461
|
+
clear(options?: ClearOptions): Promise<void>;
|
|
1462
|
+
}
|
|
1463
|
+
//#endregion
|
|
1464
|
+
//#region ../src/unikvs-builder.d.ts
|
|
1465
|
+
type KeyofKVMap<TKeyValueMapping extends KeyValueMapping = KeyValueMapping> = Extract<keyof TKeyValueMapping, string>;
|
|
1466
|
+
/**
|
|
1467
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#builder)
|
|
1468
|
+
*/
|
|
1469
|
+
interface IUniKvsBuilder<TKeyValueMapping extends KeyValueMapping = KeyValueMapping, TUniKvsDataInput = ValueOf<{ [TKey in KeyofKVMap<TKeyValueMapping>]: $InferPlainValueData<TKeyValueMapping[TKey]>; }>, TUniKvsDataOutput = TUniKvsDataInput, TUniKvsChunkInput = ValueOf<{ [TKey in KeyofKVMap<TKeyValueMapping>]: $InferStreamValueChunkData<TKeyValueMapping[TKey]>; }>, TUniKvsChunkOutput = TUniKvsChunkInput, TLastMiddlewareDecodeDataInput = TUniKvsDataOutput, TLastMiddlewareEncodeDataOutput = TUniKvsDataInput, TLastMiddlewareDecodeChunkInput = TUniKvsChunkOutput, TLastMiddlewareEncodeChunkOutput = TUniKvsChunkInput> {
|
|
1470
|
+
fork<TBranchChunkInput, TBranchChunkOutput, TBranchHeadEncodeDataInput, TBranchHeadDecodeDataOutput, TBranchHeadEncodeChunkInput, TBranchHeadDecodeChunkOutput, TBranchLastDecodeDataInput, TBranchLastEncodeDataOutput, TBranchLastDecodeChunkInput, TBranchLastEncodeChunkOutput, TBranchHasPersist extends boolean>(branch: IUniKvsBranch<any, TBranchChunkInput, TBranchChunkOutput, TBranchHeadEncodeDataInput, TBranchHeadDecodeDataOutput, TBranchHeadEncodeChunkInput, TBranchHeadDecodeChunkOutput, TBranchLastDecodeDataInput, TBranchLastEncodeDataOutput, TBranchLastDecodeChunkInput, TBranchLastEncodeChunkOutput, TBranchHasPersist> & (TBranchHasPersist extends true ? $CheckForkEncodeData<TLastMiddlewareEncodeDataOutput, TBranchHeadEncodeDataInput> : unknown) & (TBranchHasPersist extends true ? $CheckForkDecodeData<TLastMiddlewareDecodeDataInput, TBranchHeadDecodeDataOutput> : unknown) & (TBranchHasPersist extends true ? $CheckForkEncodeChunk<TLastMiddlewareEncodeChunkOutput, TBranchHeadEncodeChunkInput> : unknown) & (TBranchHasPersist extends true ? $CheckForkDecodeChunk<TLastMiddlewareDecodeChunkInput, TBranchHeadDecodeChunkOutput> : unknown)): IUniKvsBuilder<TKeyValueMapping, TUniKvsDataInput, TUniKvsDataOutput, TBranchHasPersist extends true ? [TUniKvsChunkInput] extends [never] ? never : [TBranchChunkInput] extends [never] ? never : TUniKvsChunkInput : TUniKvsChunkInput, TBranchHasPersist extends true ? [TUniKvsChunkOutput] extends [never] ? never : [TBranchChunkOutput] extends [never] ? never : TUniKvsChunkOutput : TUniKvsChunkOutput, TLastMiddlewareDecodeDataInput, TLastMiddlewareEncodeDataOutput, TLastMiddlewareDecodeChunkInput, TLastMiddlewareEncodeChunkOutput>;
|
|
1471
|
+
use<TMiddleware extends IMiddleware<[TLastMiddlewareEncodeDataOutput] extends [never] ? any : TLastMiddlewareEncodeDataOutput, any, [TLastMiddlewareEncodeChunkOutput] extends [never] ? any : TLastMiddlewareEncodeChunkOutput>>(middleware: TMiddleware): IUniKvsBuilder<TKeyValueMapping, TUniKvsDataInput, TUniKvsDataOutput, [TUniKvsChunkInput] extends [never] ? never : [$InferDecodeChunkInput<TMiddleware>] extends [never] ? never : TUniKvsChunkInput, [TUniKvsChunkOutput] extends [never] ? never : [$InferEncodeChunkOutput<TMiddleware>] extends [never] ? never : TUniKvsChunkOutput, $InferDecodeDataInput<TMiddleware>, $InferEncodeDataOutput<TMiddleware>, $InferDecodeChunkInput<TMiddleware>, $InferEncodeChunkOutput<TMiddleware>>;
|
|
1472
|
+
persist<TStorage extends IStorage<[TLastMiddlewareEncodeDataOutput] extends [never] ? any : TLastMiddlewareEncodeDataOutput, [TLastMiddlewareDecodeDataInput] extends [never] ? any : TLastMiddlewareDecodeDataInput, [TLastMiddlewareEncodeChunkOutput] extends [never] ? any : TLastMiddlewareEncodeChunkOutput, [TLastMiddlewareDecodeChunkInput] extends [never] ? any : TLastMiddlewareDecodeChunkInput>>(storage: TStorage): IUniKvsBuilderFinalizer<TKeyValueMapping, TLastMiddlewareEncodeDataOutput, TLastMiddlewareDecodeDataInput, [TLastMiddlewareEncodeChunkOutput] extends [never] ? never : [$InferWriteChunkInput<TStorage>] extends [never] ? never : TLastMiddlewareEncodeChunkOutput, [TLastMiddlewareDecodeChunkInput] extends [never] ? never : [$InferReadChunkOutput<TStorage>] extends [never] ? never : TLastMiddlewareDecodeChunkInput, TLastMiddlewareDecodeDataInput, TLastMiddlewareEncodeDataOutput, TLastMiddlewareDecodeChunkInput, TLastMiddlewareEncodeChunkOutput>;
|
|
1473
|
+
/**
|
|
1474
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#base-vars-set-vars)
|
|
1475
|
+
*/
|
|
1476
|
+
setVars(vars: VariablesInit): this;
|
|
1477
|
+
/**
|
|
1478
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#base-vars-assign-vars)
|
|
1479
|
+
*/
|
|
1480
|
+
assignVars(vars: VariablesInit): this;
|
|
1481
|
+
/**
|
|
1482
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#base-vars-defaults-vars)
|
|
1483
|
+
*/
|
|
1484
|
+
defaultsVars(vars: VariablesInit): this;
|
|
1485
|
+
}
|
|
1486
|
+
/**
|
|
1487
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#builder)
|
|
1488
|
+
*/
|
|
1489
|
+
interface IUniKvsBuilderFinalizer<TKeyValueMapping extends KeyValueMapping = KeyValueMapping, TWriteDataInput = any, TReadDataOutput = any, TWriteChunkInput = any, TReadChunkOutput = any, TLastMiddlewareDecodeDataInput = TReadDataOutput, TLastMiddlewareEncodeDataOutput = TWriteDataInput, TLastMiddlewareDecodeChunkInput = TReadChunkOutput, TLastMiddlewareEncodeChunkOutput = TWriteChunkInput> {
|
|
1490
|
+
fork<TBranchChunkInput, TBranchChunkOutput, TBranchHeadEncodeDataInput, TBranchHeadDecodeDataOutput, TBranchHeadEncodeChunkInput, TBranchHeadDecodeChunkOutput, TBranchLastDecodeDataInput, TBranchLastEncodeDataOutput, TBranchLastDecodeChunkInput, TBranchLastEncodeChunkOutput, TBranchHasPersist extends boolean>(branch: IUniKvsBranch<any, TBranchChunkInput, TBranchChunkOutput, TBranchHeadEncodeDataInput, TBranchHeadDecodeDataOutput, TBranchHeadEncodeChunkInput, TBranchHeadDecodeChunkOutput, TBranchLastDecodeDataInput, TBranchLastEncodeDataOutput, TBranchLastDecodeChunkInput, TBranchLastEncodeChunkOutput, TBranchHasPersist> & (TBranchHasPersist extends true ? $CheckForkEncodeData<TLastMiddlewareEncodeDataOutput, TBranchHeadEncodeDataInput> : unknown) & (TBranchHasPersist extends true ? $CheckForkDecodeData<TLastMiddlewareDecodeDataInput, TBranchHeadDecodeDataOutput> : unknown) & (TBranchHasPersist extends true ? $CheckForkEncodeChunk<TLastMiddlewareEncodeChunkOutput, TBranchHeadEncodeChunkInput> : unknown) & (TBranchHasPersist extends true ? $CheckForkDecodeChunk<TLastMiddlewareDecodeChunkInput, TBranchHeadDecodeChunkOutput> : unknown)): IUniKvsBuilderFinalizer<TKeyValueMapping, TWriteDataInput, TReadDataOutput, TBranchHasPersist extends true ? [TWriteChunkInput] extends [never] ? never : [TBranchChunkInput] extends [never] ? never : TWriteChunkInput : TWriteChunkInput, TBranchHasPersist extends true ? [TReadChunkOutput] extends [never] ? never : [TBranchChunkOutput] extends [never] ? never : TReadChunkOutput : TReadChunkOutput, TLastMiddlewareDecodeDataInput, TLastMiddlewareEncodeDataOutput, TLastMiddlewareDecodeChunkInput, TLastMiddlewareEncodeChunkOutput>;
|
|
1491
|
+
use<TMiddleware extends IMiddleware<[TLastMiddlewareEncodeDataOutput] extends [never] ? any : TLastMiddlewareEncodeDataOutput, any, [TLastMiddlewareEncodeChunkOutput] extends [never] ? any : TLastMiddlewareEncodeChunkOutput>>(middleware: TMiddleware): IUniKvsBuilderFinalizer<TKeyValueMapping, TWriteDataInput, TReadDataOutput, TWriteChunkInput, TReadChunkOutput, $InferDecodeDataInput<TMiddleware>, $InferEncodeDataOutput<TMiddleware>, $InferDecodeChunkInput<TMiddleware>, $InferEncodeChunkOutput<TMiddleware>>;
|
|
1492
|
+
persist<TStorage extends IStorage<[TLastMiddlewareEncodeDataOutput] extends [never] ? any : TLastMiddlewareEncodeDataOutput, [TLastMiddlewareDecodeDataInput] extends [never] ? any : TLastMiddlewareDecodeDataInput, [TLastMiddlewareEncodeChunkOutput] extends [never] ? any : TLastMiddlewareEncodeChunkOutput, [TLastMiddlewareDecodeChunkInput] extends [never] ? any : TLastMiddlewareDecodeChunkInput>>(storage: TStorage): IUniKvsBuilderFinalizer<TKeyValueMapping, TWriteDataInput, TReadDataOutput, [TWriteChunkInput] extends [never] ? never : [$InferWriteChunkInput<TStorage>] extends [never] ? never : TWriteChunkInput, [TReadChunkOutput] extends [never] ? never : [$InferReadChunkOutput<TStorage>] extends [never] ? never : TReadChunkOutput, TLastMiddlewareDecodeDataInput, TLastMiddlewareEncodeDataOutput, TLastMiddlewareDecodeChunkInput, TLastMiddlewareEncodeChunkOutput>;
|
|
1493
|
+
/**
|
|
1494
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#base-vars-set-vars)
|
|
1495
|
+
*/
|
|
1496
|
+
setVars(vars: VariablesInit): this;
|
|
1497
|
+
/**
|
|
1498
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#base-vars-assign-vars)
|
|
1499
|
+
*/
|
|
1500
|
+
assignVars(vars: VariablesInit): this;
|
|
1501
|
+
/**
|
|
1502
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#base-vars-defaults-vars)
|
|
1503
|
+
*/
|
|
1504
|
+
defaultsVars(vars: VariablesInit): this;
|
|
1505
|
+
build(): UniKvs<TKeyValueMapping>;
|
|
1506
|
+
}
|
|
1507
|
+
/**
|
|
1508
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#builder)
|
|
1509
|
+
*/
|
|
1510
|
+
type UniKvsBuilderOptions = {
|
|
1511
|
+
/**
|
|
1512
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#base-vars)
|
|
1513
|
+
*/
|
|
1514
|
+
readonly vars?: VariablesInit | undefined;
|
|
1515
|
+
readonly schema?: UniKvsSchema | undefined;
|
|
1516
|
+
};
|
|
1517
|
+
/**
|
|
1518
|
+
* オブジェクト形式のスキーマ定義です。キーをそのままキーとして扱います。
|
|
1519
|
+
*/
|
|
1520
|
+
type UniKvsSchemaRecord = Readonly<Record<string, Value>>;
|
|
1521
|
+
/**
|
|
1522
|
+
* 配列形式のスキーマ定義です。キーのスキーマと値のスキーマの組を並べます。
|
|
1523
|
+
*/
|
|
1524
|
+
type UniKvsSchemaEntries = readonly (readonly [GenericSchema$1, Value])[];
|
|
1525
|
+
/**
|
|
1526
|
+
* `new Builder()` の `schema` オプションに指定できるスキーマ定義です。
|
|
1527
|
+
*/
|
|
1528
|
+
type UniKvsSchema = UniKvsSchemaRecord | UniKvsSchemaEntries;
|
|
1529
|
+
/**
|
|
1530
|
+
* スキーマ定義からキーと値のマッピング型を推論します。
|
|
1531
|
+
*
|
|
1532
|
+
* @template TSchema 対象となるスキーマ定義の型です。
|
|
1533
|
+
*/
|
|
1534
|
+
type $InferKeyValueMapping<TSchema extends UniKvsSchema> = TSchema extends readonly (readonly [GenericSchema$1, infer TValue extends Value])[] ? Readonly<Record<string, TValue>> : TSchema extends Readonly<Record<string, Value>> ? { readonly [TKey in keyof TSchema]: TSchema[TKey]; } : never;
|
|
1535
|
+
/**
|
|
1536
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#builder)
|
|
1537
|
+
*/
|
|
1538
|
+
declare class UniKvsBuilder<const TInit extends KeyValueMapping | UniKvsSchema = KeyValueMapping, TKeyValueMapping extends KeyValueMapping = $InferKeyValueMapping<TInit>, TUniKvsDataInput = ValueOf<{ [TKey in KeyofKVMap<TKeyValueMapping>]: $InferPlainValueData<TKeyValueMapping[TKey]>; }>, TUniKvsDataOutput = TUniKvsDataInput, TUniKvsChunkInput = ValueOf<{ [TKey in KeyofKVMap<TKeyValueMapping>]: $InferStreamValueChunkData<TKeyValueMapping[TKey]>; }>, TUniKvsChunkOutput = TUniKvsChunkInput, TLastMiddlewareDecodeDataInput = TUniKvsDataOutput, TLastMiddlewareEncodeDataOutput = TUniKvsDataInput, TLastMiddlewareDecodeChunkInput = TUniKvsChunkOutput, TLastMiddlewareEncodeChunkOutput = TUniKvsChunkInput> implements IUniKvsBuilder<TKeyValueMapping, TUniKvsDataInput, TUniKvsDataOutput, TUniKvsChunkInput, TUniKvsChunkOutput, TLastMiddlewareDecodeDataInput, TLastMiddlewareEncodeDataOutput, TLastMiddlewareDecodeChunkInput, TLastMiddlewareEncodeChunkOutput> {
|
|
1539
|
+
#private;
|
|
1540
|
+
constructor(options?: Omit<UniKvsBuilderOptions, "schema"> & {
|
|
1541
|
+
readonly schema?: TInit;
|
|
1542
|
+
});
|
|
1543
|
+
fork<TBranchChunkInput, TBranchChunkOutput, TBranchHeadEncodeDataInput, TBranchHeadDecodeDataOutput, TBranchHeadEncodeChunkInput, TBranchHeadDecodeChunkOutput, TBranchLastDecodeDataInput, TBranchLastEncodeDataOutput, TBranchLastDecodeChunkInput, TBranchLastEncodeChunkOutput, TBranchHasPersist extends boolean>(branch: IUniKvsBranch<any, TBranchChunkInput, TBranchChunkOutput, TBranchHeadEncodeDataInput, TBranchHeadDecodeDataOutput, TBranchHeadEncodeChunkInput, TBranchHeadDecodeChunkOutput, TBranchLastDecodeDataInput, TBranchLastEncodeDataOutput, TBranchLastDecodeChunkInput, TBranchLastEncodeChunkOutput, TBranchHasPersist> & (TBranchHasPersist extends true ? $CheckForkEncodeData<TLastMiddlewareEncodeDataOutput, TBranchHeadEncodeDataInput> : unknown) & (TBranchHasPersist extends true ? $CheckForkDecodeData<TLastMiddlewareDecodeDataInput, TBranchHeadDecodeDataOutput> : unknown) & (TBranchHasPersist extends true ? $CheckForkEncodeChunk<TLastMiddlewareEncodeChunkOutput, TBranchHeadEncodeChunkInput> : unknown) & (TBranchHasPersist extends true ? $CheckForkDecodeChunk<TLastMiddlewareDecodeChunkInput, TBranchHeadDecodeChunkOutput> : unknown)): IUniKvsBuilder<TKeyValueMapping, TUniKvsDataInput, TUniKvsDataOutput, TBranchHasPersist extends true ? [TUniKvsChunkInput] extends [never] ? never : [TBranchChunkInput] extends [never] ? never : TUniKvsChunkInput : TUniKvsChunkInput, TBranchHasPersist extends true ? [TUniKvsChunkOutput] extends [never] ? never : [TBranchChunkOutput] extends [never] ? never : TUniKvsChunkOutput : TUniKvsChunkOutput, TLastMiddlewareDecodeDataInput, TLastMiddlewareEncodeDataOutput, TLastMiddlewareDecodeChunkInput, TLastMiddlewareEncodeChunkOutput>;
|
|
1544
|
+
use<TMiddleware extends IMiddleware<[TLastMiddlewareEncodeDataOutput] extends [never] ? any : TLastMiddlewareEncodeDataOutput, any, [TLastMiddlewareEncodeChunkOutput] extends [never] ? any : TLastMiddlewareEncodeChunkOutput>>(middleware: TMiddleware): IUniKvsBuilder<TKeyValueMapping, TUniKvsDataInput, TUniKvsDataOutput, [TUniKvsChunkInput] extends [never] ? never : [$InferDecodeChunkInput<TMiddleware>] extends [never] ? never : TUniKvsChunkInput, [TUniKvsChunkOutput] extends [never] ? never : [$InferEncodeChunkOutput<TMiddleware>] extends [never] ? never : TUniKvsChunkOutput, $InferDecodeDataInput<TMiddleware>, $InferEncodeDataOutput<TMiddleware>, $InferDecodeChunkInput<TMiddleware>, $InferEncodeChunkOutput<TMiddleware>>;
|
|
1545
|
+
persist<TStorage extends IStorage<[TLastMiddlewareEncodeDataOutput] extends [never] ? any : TLastMiddlewareEncodeDataOutput, [TLastMiddlewareDecodeDataInput] extends [never] ? any : TLastMiddlewareDecodeDataInput, [TLastMiddlewareEncodeChunkOutput] extends [never] ? any : TLastMiddlewareEncodeChunkOutput, [TLastMiddlewareDecodeChunkInput] extends [never] ? any : TLastMiddlewareDecodeChunkInput>>(storage: TStorage): IUniKvsBuilderFinalizer<TKeyValueMapping, TLastMiddlewareEncodeDataOutput, TLastMiddlewareDecodeDataInput, [TLastMiddlewareEncodeChunkOutput] extends [never] ? never : [$InferWriteChunkInput<TStorage>] extends [never] ? never : TLastMiddlewareEncodeChunkOutput, [TLastMiddlewareDecodeChunkInput] extends [never] ? never : [$InferReadChunkOutput<TStorage>] extends [never] ? never : TLastMiddlewareDecodeChunkInput, TLastMiddlewareDecodeDataInput, TLastMiddlewareEncodeDataOutput, TLastMiddlewareDecodeChunkInput, TLastMiddlewareEncodeChunkOutput>;
|
|
1546
|
+
setVars(vars: VariablesInit): this;
|
|
1547
|
+
assignVars(vars: VariablesInit): this;
|
|
1548
|
+
defaultsVars(vars: VariablesInit): this;
|
|
1549
|
+
build(): UniKvs<TKeyValueMapping>;
|
|
1550
|
+
}
|
|
1551
|
+
//#endregion
|
|
1552
|
+
export { type $InferKeyValueMapping, UniKvsBranch as Branch, UniKvsBranch, UniKvsBuilder as Builder, UniKvsBuilder, type ClearOptions, type CloseOptions, type DeleteOptions, type GetOptions, type HasOptions, type IUniKvsBranch, type IUniKvsBuilder, type IUniKvsBuilderFinalizer, type IValueStream, type InvalidInputErrorArgs, type InvalidInputErrorMeta, type InvalidOutputErrorArgs, type InvalidOutputErrorMeta, InvalidUsageErrorBase, type Issue, KeyNotFoundError, type KeyNotFoundErrorArgs, type KeyNotFoundErrorMeta, type KeyValueMapping, type KeyofKeyValueMapping, type KeyofKeyValueMappingHasPlainValue, type KeyofKeyValueMappingHasStreamValue, type MiddlewareDestinationFrozenErrorArgs, type MiddlewareDestinationFrozenErrorMeta, type MiddlewareDestinationMissingErrorArgs, type MiddlewareDestinationMissingErrorMeta, type MiddlewareIsNotOpenErrorArgs, type MiddlewareIsNotOpenErrorMeta, type MiddlewareNextCalledMultipleTimesErrorArgs, type MiddlewareNextCalledMultipleTimesErrorMeta, type MiddlewareNextNotAwaitedErrorArgs, type MiddlewareNextNotAwaitedErrorMeta, type MiddlewareNextNotCalledErrorArgs, type MiddlewareNextNotCalledErrorMeta, type MultipartWriteNotSupportedErrorArgs, type MultipartWriteNotSupportedErrorMeta, type OpenOptions, type PluginOperationAggregateErrorArgs, type PluginOperationAggregateErrorMeta, type ReadableStreamNotSupportedErrorArgs, type ReadableStreamNotSupportedErrorMeta, type SetOptions, type SetValue, type StorageIsNotOpenErrorArgs, type StorageIsNotOpenErrorMeta, type StreamDecodingNotSupportedErrorArgs, type StreamDecodingNotSupportedErrorMeta, type StreamEncodingNotSupportedErrorArgs, type StreamEncodingNotSupportedErrorMeta, type StreamOptions, UniKvs, type UniKvsBuilderOptions, type UniKvsSchema, type UniKvsSchemaEntries, type UniKvsSchemaRecord, type WritableStreamNotSupportedErrorArgs, type WritableStreamNotSupportedErrorMeta };
|
|
1553
|
+
//# sourceMappingURL=index.d.ts.map
|