unikvs 0.0.9 → 0.0.12
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/src/_logger.d.ts.map +1 -1
- package/dist/src/_merge-variables.d.ts +13 -0
- package/dist/src/_merge-variables.d.ts.map +1 -0
- package/dist/src/_merge-variables.js +12 -0
- package/dist/src/_storage.d.ts +11 -11
- package/dist/src/_storage.d.ts.map +1 -1
- package/dist/src/_storage.js +31 -22
- package/dist/src/_streams.d.ts +20 -0
- package/dist/src/_streams.d.ts.map +1 -0
- package/dist/src/_streams.js +36 -0
- package/dist/src/_to-value-stream.d.ts.map +1 -1
- package/dist/src/_to-value-stream.js +44 -6
- package/dist/src/_transformer.d.ts +7 -7
- package/dist/src/_transformer.d.ts.map +1 -1
- package/dist/src/_transformer.js +12 -12
- package/dist/src/_valibot.d.ts +6 -7
- package/dist/src/_valibot.d.ts.map +1 -1
- package/dist/src/_valibot.js +1 -1
- package/dist/src/_value-schemas.d.ts +179 -0
- package/dist/src/_value-schemas.d.ts.map +1 -0
- package/dist/src/_value-schemas.js +150 -0
- package/dist/src/errors.d.ts +218 -27
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +102 -47
- package/dist/src/index.d.ts +3 -3
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -2
- package/dist/src/unikvs-config.d.ts +58 -139
- package/dist/src/unikvs-config.d.ts.map +1 -1
- package/dist/src/unikvs-config.js +41 -46
- package/dist/src/unikvs.d.ts +86 -161
- package/dist/src/unikvs.d.ts.map +1 -1
- package/dist/src/unikvs.js +374 -171
- package/dist/src/utils.types.d.ts +1 -3
- package/dist/src/utils.types.d.ts.map +1 -1
- package/dist/src/value-stream.types.d.ts +5 -6
- package/dist/src/value-stream.types.d.ts.map +1 -1
- package/dist/src/variables.types.d.ts +11 -0
- package/dist/src/variables.types.d.ts.map +1 -0
- package/package.json +26 -25
- package/src/_merge-variables.ts +19 -0
- package/src/_storage.ts +47 -24
- package/src/_streams.ts +47 -0
- package/src/_to-value-stream.ts +47 -8
- package/src/_transformer.ts +13 -13
- package/src/_valibot.ts +8 -6
- package/src/_value-schemas.ts +362 -0
- package/src/errors.ts +280 -68
- package/src/index.ts +2 -3
- package/src/unikvs-config.ts +142 -167
- package/src/unikvs.ts +523 -285
- package/src/utils.types.ts +1 -3
- package/src/value-stream.types.ts +5 -6
- package/src/variables.types.ts +13 -0
- 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/context.types.d.ts +0 -17
- package/dist/src/context.types.d.ts.map +0 -1
- package/src/_merge-context.ts +0 -19
- package/src/context.types.ts +0 -19
- /package/dist/src/{context.types.js → variables.types.js} +0 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import * as v from "./_valibot.js";
|
|
2
|
+
/**
|
|
3
|
+
* プレーンな値を識別するための固有のシンボルです。
|
|
4
|
+
*/
|
|
5
|
+
declare const PLAIN_VALUE: unique symbol;
|
|
6
|
+
/**
|
|
7
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
8
|
+
*
|
|
9
|
+
* @template TData 入出力されるデータの型です。
|
|
10
|
+
* @template TInput `set` が受け付ける入力データの型です。
|
|
11
|
+
*/
|
|
12
|
+
export type PlainValue<TData = any, TInput = TData> = [
|
|
13
|
+
Type: typeof PLAIN_VALUE,
|
|
14
|
+
Data: TData,
|
|
15
|
+
Input: TInput
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* ストリーム形式の値を識別するための固有のシンボルです。
|
|
19
|
+
*/
|
|
20
|
+
declare const STREAM_VALUE: unique symbol;
|
|
21
|
+
/**
|
|
22
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
23
|
+
*
|
|
24
|
+
* @template TChunkData 入出力されるチャンクデータの型です。
|
|
25
|
+
* @template TChunkInput `set` が受け付ける入力チャンクデータの型です。
|
|
26
|
+
*/
|
|
27
|
+
export type StreamValue<TChunkData = any, TChunkInput = TChunkData> = [
|
|
28
|
+
Type: typeof STREAM_VALUE,
|
|
29
|
+
ChunkData: TChunkData,
|
|
30
|
+
ChunkInput: TChunkInput
|
|
31
|
+
];
|
|
32
|
+
/**
|
|
33
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
34
|
+
*
|
|
35
|
+
* @template TDataAndChunkData データまたはチャンクデータの型です。
|
|
36
|
+
* @template TInput `set` が受け付ける入力データまたは入力チャンクデータの型です。
|
|
37
|
+
*/
|
|
38
|
+
export type Value<TDataAndChunkData = any, TInput = TDataAndChunkData> = PlainValue<TDataAndChunkData, TInput> | StreamValue<TDataAndChunkData, TInput>;
|
|
39
|
+
/**
|
|
40
|
+
* PlainValue 型から内部のデータ型を抽出します。
|
|
41
|
+
*
|
|
42
|
+
* @template TPlainValue 対象となる PlainValue 型です。
|
|
43
|
+
*/
|
|
44
|
+
export type $InferPlainValueData<TPlainValue> = TPlainValue extends PlainValue<infer TData, any> ? TData : never;
|
|
45
|
+
/**
|
|
46
|
+
* PlainValue 型から入力データの型を抽出します。
|
|
47
|
+
*
|
|
48
|
+
* @template TPlainValue 対象となる PlainValue 型です。
|
|
49
|
+
*/
|
|
50
|
+
export type $InferPlainValueInput<TPlainValue> = TPlainValue extends PlainValue<any, infer TInput> ? TInput : never;
|
|
51
|
+
/**
|
|
52
|
+
* StreamValue 型から内部のチャンクデータ型を抽出します。
|
|
53
|
+
*
|
|
54
|
+
* @template TStreamValue 対象となる StreamValue 型です。
|
|
55
|
+
*/
|
|
56
|
+
export type $InferStreamValueChunkData<TStreamValue> = TStreamValue extends StreamValue<infer TChunkData, any> ? TChunkData : never;
|
|
57
|
+
/**
|
|
58
|
+
* StreamValue 型から入力チャンクデータの型を抽出します。
|
|
59
|
+
*
|
|
60
|
+
* @template TStreamValue 対象となる StreamValue 型です。
|
|
61
|
+
*/
|
|
62
|
+
export type $InferStreamValueChunkInput<TStreamValue> = TStreamValue extends StreamValue<any, infer TChunkInput> ? TChunkInput : never;
|
|
63
|
+
/**
|
|
64
|
+
* スキーマ付きの値が扱うデータの種類です。
|
|
65
|
+
*
|
|
66
|
+
* - `"plain"`: プレーンな値のみを扱います。
|
|
67
|
+
* - `"stream"`: ストリーム形式の値のみを扱います。
|
|
68
|
+
* - `"any"`: プレーンな値とストリーム形式の値のどちらも扱います。
|
|
69
|
+
*/
|
|
70
|
+
export type ValueSchemaKind = "plain" | "stream" | "any";
|
|
71
|
+
/**
|
|
72
|
+
* キーに対応する値のスキーマ情報です。
|
|
73
|
+
*/
|
|
74
|
+
export type ValueSchemaInfo = {
|
|
75
|
+
/**
|
|
76
|
+
* 扱うデータの種類です。
|
|
77
|
+
*/
|
|
78
|
+
readonly kind: ValueSchemaKind;
|
|
79
|
+
/**
|
|
80
|
+
* データの検証に使用するスキーマです。
|
|
81
|
+
*/
|
|
82
|
+
readonly schema: v.GenericSchema;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
86
|
+
*
|
|
87
|
+
* プレーンな値のスキーマを定義します。
|
|
88
|
+
*
|
|
89
|
+
* @template TSchema スキーマの型です。
|
|
90
|
+
* @param schema 値の検証に使用する Valibot スキーマです。
|
|
91
|
+
* @returns プレーンな値であることを示す型情報を返します。
|
|
92
|
+
*/
|
|
93
|
+
export declare function PlainValue<const TSchema extends v.GenericSchema>(schema: TSchema): PlainValue<v.InferOutput<TSchema>, v.InferInput<TSchema>>;
|
|
94
|
+
/**
|
|
95
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
96
|
+
*
|
|
97
|
+
* ストリーム形式の値のスキーマを定義します。
|
|
98
|
+
*
|
|
99
|
+
* @template TSchema スキーマの型です。
|
|
100
|
+
* @param schema チャンクデータの検証に使用する Valibot スキーマです。
|
|
101
|
+
* @returns ストリーム形式の値であることを示す型情報を返します。
|
|
102
|
+
*/
|
|
103
|
+
export declare function StreamValue<const TSchema extends v.GenericSchema>(schema: TSchema): StreamValue<v.InferOutput<TSchema>, v.InferInput<TSchema>>;
|
|
104
|
+
/**
|
|
105
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
106
|
+
*
|
|
107
|
+
* プレーンな値とストリーム形式の値の両方で使えるスキーマを定義します。
|
|
108
|
+
*
|
|
109
|
+
* @template TSchema スキーマの型です。
|
|
110
|
+
* @param schema データとチャンクデータの検証に使用する Valibot スキーマです。
|
|
111
|
+
* @returns どちらの形式でも使える値であることを示す型情報を返します。
|
|
112
|
+
*/
|
|
113
|
+
export declare function Value<const TSchema extends v.GenericSchema>(schema: TSchema): Value<v.InferOutput<TSchema>, v.InferInput<TSchema>>;
|
|
114
|
+
/**
|
|
115
|
+
* オブジェクト形式のスキーマ定義です。キーをそのままキーとして扱います。
|
|
116
|
+
*/
|
|
117
|
+
export type UniKvsSchemaRecord = {
|
|
118
|
+
readonly [key: string]: Value<any, any>;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* 配列形式のスキーマ定義です。キーのスキーマと値のスキーマの組を並べます。
|
|
122
|
+
*/
|
|
123
|
+
export type UniKvsSchemaEntries = readonly (readonly [v.GenericSchema, Value<any, any>])[];
|
|
124
|
+
/**
|
|
125
|
+
* `UniKvs.config()` の `schema` オプションに指定できるスキーマ定義です。
|
|
126
|
+
*/
|
|
127
|
+
export type UniKvsSchema = UniKvsSchemaRecord | UniKvsSchemaEntries;
|
|
128
|
+
/**
|
|
129
|
+
* スキーマ定義からキーと値のマッピング型を推論します。
|
|
130
|
+
*
|
|
131
|
+
* @template TSchema 対象となるスキーマ定義の型です。
|
|
132
|
+
*/
|
|
133
|
+
export type $InferKeyValueMapping<TSchema extends UniKvsSchema> = TSchema extends readonly (readonly [v.GenericSchema, infer TValue extends Value<any, any>])[] ? {
|
|
134
|
+
readonly [key: string]: TValue;
|
|
135
|
+
} : TSchema extends {
|
|
136
|
+
readonly [key: string]: Value<any, any>;
|
|
137
|
+
} ? {
|
|
138
|
+
readonly [TKey in keyof TSchema]: TSchema[TKey];
|
|
139
|
+
} : never;
|
|
140
|
+
/**
|
|
141
|
+
* 検証済みのオブジェクト形式のスキーマ定義です。
|
|
142
|
+
*/
|
|
143
|
+
export type UniKvsSchemaInfoRecord = {
|
|
144
|
+
readonly [key: string]: ValueSchemaInfo;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* 検証済みの配列形式のスキーマ定義です。
|
|
148
|
+
*/
|
|
149
|
+
export type UniKvsSchemaInfoEntries = readonly (readonly [v.GenericSchema, ValueSchemaInfo])[];
|
|
150
|
+
/**
|
|
151
|
+
* 検証済みのスキーマ定義です。
|
|
152
|
+
*/
|
|
153
|
+
export type UniKvsSchemaInfo = UniKvsSchemaInfoRecord | UniKvsSchemaInfoEntries;
|
|
154
|
+
/**
|
|
155
|
+
* `schema` オプションの検証に使用するスキーマです。
|
|
156
|
+
*/
|
|
157
|
+
export declare const UniKvsSchemaSchema: import("valibot").UnionSchema<[import("@tai-kun/valibot-extra-lab").ArraySchema<import("@tai-kun/valibot-extra-lab").TupleSchema<[import("valibot").CustomSchema<v.GenericSchema, undefined>, import("valibot").CustomSchema<ValueSchemaInfo, undefined>], undefined>, undefined>, import("@tai-kun/valibot-extra-lab").RecordSchema<import("valibot").StringSchema<undefined>, import("valibot").CustomSchema<ValueSchemaInfo, undefined>, undefined>], undefined>;
|
|
158
|
+
/**
|
|
159
|
+
* キーに対応する値のスキーマ情報を解決するインターフェースです。
|
|
160
|
+
*/
|
|
161
|
+
export interface IValueSchemaResolver {
|
|
162
|
+
/**
|
|
163
|
+
* キーに対応する値のスキーマ情報を返します。
|
|
164
|
+
*
|
|
165
|
+
* @param key 解決するキーです。
|
|
166
|
+
* @returns 対応するスキーマ情報を返します。対応する定義がない場合は `undefined` を返します。
|
|
167
|
+
* @throws キーがどのキースキーマにも一致しない場合に `InvalidInputError` を投げます。
|
|
168
|
+
*/
|
|
169
|
+
resolve(key: string): ValueSchemaInfo | undefined;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* 検証済みのスキーマ定義からスキーマリゾルバーを生成します。
|
|
173
|
+
*
|
|
174
|
+
* @param schema 検証済みのスキーマ定義です。
|
|
175
|
+
* @returns スキーマリゾルバーを返します。
|
|
176
|
+
*/
|
|
177
|
+
export declare function createValueSchemaResolver(schema: UniKvsSchemaInfo): IValueSchemaResolver;
|
|
178
|
+
export {};
|
|
179
|
+
//# sourceMappingURL=_value-schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_value-schemas.d.ts","sourceRoot":"","sources":["../../src/_value-schemas.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _RecordValueSchemaResolver_entries, _EntriesValueSchemaResolver_entries, _EntriesValueSchemaResolver_keySchema;
|
|
13
|
+
import * as v from "./_valibot.js";
|
|
14
|
+
import { InvalidInputError } from "./errors.js";
|
|
15
|
+
// -------------------------------------------------------------------------------------------------
|
|
16
|
+
//
|
|
17
|
+
// 値のスキーマ
|
|
18
|
+
//
|
|
19
|
+
// -------------------------------------------------------------------------------------------------
|
|
20
|
+
/**
|
|
21
|
+
* スキーマ付きの値であることを識別するためのブランドです。
|
|
22
|
+
*
|
|
23
|
+
* 同じライブラリーが複数読み込まれた環境でも認識できるようにグローバルシンボルを使用します。
|
|
24
|
+
*/
|
|
25
|
+
const VALUE_SCHEMA_BRAND = Symbol.for("unikvs.valueSchema");
|
|
26
|
+
/**
|
|
27
|
+
* 値が Valibot のスキーマであるかどうかを判定します。
|
|
28
|
+
*/
|
|
29
|
+
function isGenericSchema(input) {
|
|
30
|
+
return (typeof input === "object" &&
|
|
31
|
+
input !== null &&
|
|
32
|
+
typeof input["~run"] === "function");
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 値がスキーマ情報であるかどうかを判定します。
|
|
36
|
+
*/
|
|
37
|
+
function isValueSchemaInfo(input) {
|
|
38
|
+
return (typeof input === "object" &&
|
|
39
|
+
input !== null &&
|
|
40
|
+
input[VALUE_SCHEMA_BRAND] === true);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* スキーマ情報を内部オブジェクトとして生成します。
|
|
44
|
+
*/
|
|
45
|
+
function createValueSchemaDescriptor(kind, schema) {
|
|
46
|
+
return { [VALUE_SCHEMA_BRAND]: true, kind, schema };
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
50
|
+
*
|
|
51
|
+
* プレーンな値のスキーマを定義します。
|
|
52
|
+
*
|
|
53
|
+
* @template TSchema スキーマの型です。
|
|
54
|
+
* @param schema 値の検証に使用する Valibot スキーマです。
|
|
55
|
+
* @returns プレーンな値であることを示す型情報を返します。
|
|
56
|
+
*/
|
|
57
|
+
export function PlainValue(schema) {
|
|
58
|
+
return createValueSchemaDescriptor("plain", schema);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
62
|
+
*
|
|
63
|
+
* ストリーム形式の値のスキーマを定義します。
|
|
64
|
+
*
|
|
65
|
+
* @template TSchema スキーマの型です。
|
|
66
|
+
* @param schema チャンクデータの検証に使用する Valibot スキーマです。
|
|
67
|
+
* @returns ストリーム形式の値であることを示す型情報を返します。
|
|
68
|
+
*/
|
|
69
|
+
export function StreamValue(schema) {
|
|
70
|
+
return createValueSchemaDescriptor("stream", schema);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#value-types)
|
|
74
|
+
*
|
|
75
|
+
* プレーンな値とストリーム形式の値の両方で使えるスキーマを定義します。
|
|
76
|
+
*
|
|
77
|
+
* @template TSchema スキーマの型です。
|
|
78
|
+
* @param schema データとチャンクデータの検証に使用する Valibot スキーマです。
|
|
79
|
+
* @returns どちらの形式でも使える値であることを示す型情報を返します。
|
|
80
|
+
*/
|
|
81
|
+
export function Value(schema) {
|
|
82
|
+
return createValueSchemaDescriptor("any", schema);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* `schema` オプションの検証に使用するスキーマです。
|
|
86
|
+
*/
|
|
87
|
+
export const UniKvsSchemaSchema = v.union([
|
|
88
|
+
v.array(v.tuple([
|
|
89
|
+
v.custom(isGenericSchema),
|
|
90
|
+
v.custom(isValueSchemaInfo),
|
|
91
|
+
])),
|
|
92
|
+
v.record(v.string(), v.custom(isValueSchemaInfo)),
|
|
93
|
+
]);
|
|
94
|
+
/**
|
|
95
|
+
* オブジェクト形式のスキーマ定義からスキーマ情報を解決します。
|
|
96
|
+
*/
|
|
97
|
+
class RecordValueSchemaResolver {
|
|
98
|
+
constructor(entries) {
|
|
99
|
+
_RecordValueSchemaResolver_entries.set(this, void 0);
|
|
100
|
+
__classPrivateFieldSet(this, _RecordValueSchemaResolver_entries, new Map(Object.entries(entries)), "f");
|
|
101
|
+
}
|
|
102
|
+
resolve(key) {
|
|
103
|
+
return __classPrivateFieldGet(this, _RecordValueSchemaResolver_entries, "f").get(key);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
_RecordValueSchemaResolver_entries = new WeakMap();
|
|
107
|
+
/**
|
|
108
|
+
* 配列形式のスキーマ定義からスキーマ情報を解決します。
|
|
109
|
+
*
|
|
110
|
+
* キースキーマに最初に一致した定義を採用します。
|
|
111
|
+
*/
|
|
112
|
+
class EntriesValueSchemaResolver {
|
|
113
|
+
constructor(entries) {
|
|
114
|
+
_EntriesValueSchemaResolver_entries.set(this, void 0);
|
|
115
|
+
_EntriesValueSchemaResolver_keySchema.set(this, void 0);
|
|
116
|
+
__classPrivateFieldSet(this, _EntriesValueSchemaResolver_entries, entries, "f");
|
|
117
|
+
__classPrivateFieldSet(this, _EntriesValueSchemaResolver_keySchema, entries.length > 0 ? v.union(entries.map(([keySchema]) => keySchema)) : undefined, "f");
|
|
118
|
+
}
|
|
119
|
+
resolve(key) {
|
|
120
|
+
for (const [keySchema, valueSchema] of __classPrivateFieldGet(this, _EntriesValueSchemaResolver_entries, "f")) {
|
|
121
|
+
const result = v.safeParse(keySchema, key);
|
|
122
|
+
if (result.success) {
|
|
123
|
+
return valueSchema;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (__classPrivateFieldGet(this, _EntriesValueSchemaResolver_keySchema, "f")) {
|
|
127
|
+
const result = v.safeParse(__classPrivateFieldGet(this, _EntriesValueSchemaResolver_keySchema, "f"), key);
|
|
128
|
+
if (!result.success) {
|
|
129
|
+
throw new InvalidInputError({
|
|
130
|
+
value: key,
|
|
131
|
+
issues: result.issues,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
_EntriesValueSchemaResolver_entries = new WeakMap(), _EntriesValueSchemaResolver_keySchema = new WeakMap();
|
|
139
|
+
/**
|
|
140
|
+
* 検証済みのスキーマ定義からスキーマリゾルバーを生成します。
|
|
141
|
+
*
|
|
142
|
+
* @param schema 検証済みのスキーマ定義です。
|
|
143
|
+
* @returns スキーマリゾルバーを返します。
|
|
144
|
+
*/
|
|
145
|
+
export function createValueSchemaResolver(schema) {
|
|
146
|
+
if (Array.isArray(schema)) {
|
|
147
|
+
return new EntriesValueSchemaResolver(schema);
|
|
148
|
+
}
|
|
149
|
+
return new RecordValueSchemaResolver(schema);
|
|
150
|
+
}
|
package/dist/src/errors.d.ts
CHANGED
|
@@ -1,115 +1,306 @@
|
|
|
1
1
|
import { ErrorBase, type ErrorOptions, type ErrorMeta, type IStorage } from "@unikvs/core";
|
|
2
2
|
import type { BaseIssue } from "valibot";
|
|
3
|
+
/**
|
|
4
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
5
|
+
*/
|
|
3
6
|
export declare class InvalidUsageErrorBase<TMeta extends ErrorMeta | undefined = ErrorMeta | undefined> extends ErrorBase<TMeta> {
|
|
4
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
10
|
+
*/
|
|
5
11
|
export type Issue = BaseIssue<unknown>;
|
|
12
|
+
/**
|
|
13
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
14
|
+
*/
|
|
6
15
|
export type InvalidInputErrorMeta = {
|
|
16
|
+
/**
|
|
17
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
18
|
+
*/
|
|
7
19
|
readonly input: unknown;
|
|
20
|
+
/**
|
|
21
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
22
|
+
*/
|
|
8
23
|
readonly issues: readonly [Issue, ...Issue[]];
|
|
9
24
|
};
|
|
10
|
-
|
|
25
|
+
/**
|
|
26
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
27
|
+
*/
|
|
28
|
+
export type InvalidInputErrorArgs = ErrorOptions & {
|
|
29
|
+
/**
|
|
30
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
31
|
+
*/
|
|
11
32
|
readonly value: unknown;
|
|
33
|
+
/**
|
|
34
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
35
|
+
*/
|
|
12
36
|
readonly issues: readonly [Issue, ...Issue[]];
|
|
13
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
40
|
+
*/
|
|
14
41
|
export declare class InvalidInputError extends InvalidUsageErrorBase<InvalidInputErrorMeta> {
|
|
15
|
-
constructor(args: InvalidInputErrorArgs
|
|
42
|
+
constructor(args: InvalidInputErrorArgs);
|
|
16
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
46
|
+
*/
|
|
17
47
|
export type InvalidOutputErrorMeta = {
|
|
48
|
+
/**
|
|
49
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
50
|
+
*/
|
|
18
51
|
readonly output: unknown;
|
|
52
|
+
/**
|
|
53
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
54
|
+
*/
|
|
19
55
|
readonly issues: readonly [Issue, ...Issue[]];
|
|
20
56
|
};
|
|
21
|
-
|
|
57
|
+
/**
|
|
58
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
59
|
+
*/
|
|
60
|
+
export type InvalidOutputErrorArgs = ErrorOptions & {
|
|
61
|
+
/**
|
|
62
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
63
|
+
*/
|
|
22
64
|
readonly value: unknown;
|
|
65
|
+
/**
|
|
66
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
67
|
+
*/
|
|
23
68
|
readonly issues: readonly [Issue, ...Issue[]];
|
|
24
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
72
|
+
*/
|
|
25
73
|
export declare class InvalidOutputError extends InvalidUsageErrorBase<InvalidOutputErrorMeta> {
|
|
26
|
-
constructor(args: InvalidOutputErrorArgs
|
|
74
|
+
constructor(args: InvalidOutputErrorArgs);
|
|
27
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
78
|
+
*/
|
|
28
79
|
export declare class UniKvsIsOpenError extends ErrorBase<undefined> {
|
|
29
80
|
constructor(options?: ErrorOptions);
|
|
30
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
84
|
+
*/
|
|
31
85
|
export declare class UniKvsIsNotOpenError extends ErrorBase<undefined> {
|
|
32
86
|
constructor(options?: ErrorOptions);
|
|
33
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
90
|
+
*/
|
|
34
91
|
export type KeyNotFoundErrorMeta = {
|
|
92
|
+
/**
|
|
93
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
94
|
+
*/
|
|
35
95
|
readonly key: IStorage.Key;
|
|
36
96
|
};
|
|
37
|
-
|
|
97
|
+
/**
|
|
98
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
99
|
+
*/
|
|
100
|
+
export type KeyNotFoundErrorArgs = ErrorOptions & KeyNotFoundErrorMeta;
|
|
101
|
+
/**
|
|
102
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
103
|
+
*/
|
|
38
104
|
export declare class KeyNotFoundError extends ErrorBase<KeyNotFoundErrorMeta> {
|
|
39
|
-
constructor(args: KeyNotFoundErrorArgs
|
|
105
|
+
constructor(args: KeyNotFoundErrorArgs);
|
|
40
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
109
|
+
*/
|
|
41
110
|
export type StorageIsNotOpenErrorMeta = {
|
|
111
|
+
/**
|
|
112
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
113
|
+
*/
|
|
42
114
|
readonly name: string;
|
|
43
115
|
};
|
|
44
|
-
|
|
116
|
+
/**
|
|
117
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
118
|
+
*/
|
|
119
|
+
export type StorageIsNotOpenErrorArgs = ErrorOptions & StorageIsNotOpenErrorMeta;
|
|
120
|
+
/**
|
|
121
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
122
|
+
*/
|
|
45
123
|
export declare class StorageIsNotOpenError extends ErrorBase<StorageIsNotOpenErrorMeta> {
|
|
46
|
-
constructor(args: StorageIsNotOpenErrorArgs
|
|
124
|
+
constructor(args: StorageIsNotOpenErrorArgs);
|
|
47
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
128
|
+
*/
|
|
48
129
|
export type WritableStreamNotSupportedErrorMeta = {
|
|
130
|
+
/**
|
|
131
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
132
|
+
*/
|
|
49
133
|
readonly name: string;
|
|
50
134
|
};
|
|
51
|
-
|
|
135
|
+
/**
|
|
136
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
137
|
+
*/
|
|
138
|
+
export type WritableStreamNotSupportedErrorArgs = ErrorOptions & WritableStreamNotSupportedErrorMeta;
|
|
139
|
+
/**
|
|
140
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
141
|
+
*/
|
|
52
142
|
export declare class WritableStreamNotSupportedError extends ErrorBase<WritableStreamNotSupportedErrorMeta> {
|
|
53
|
-
constructor(args: WritableStreamNotSupportedErrorArgs
|
|
143
|
+
constructor(args: WritableStreamNotSupportedErrorArgs);
|
|
54
144
|
}
|
|
145
|
+
/**
|
|
146
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
147
|
+
*/
|
|
55
148
|
export type ReadableStreamNotSupportedErrorMeta = {
|
|
149
|
+
/**
|
|
150
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
151
|
+
*/
|
|
56
152
|
readonly name: string;
|
|
57
153
|
};
|
|
58
|
-
|
|
154
|
+
/**
|
|
155
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
156
|
+
*/
|
|
157
|
+
export type ReadableStreamNotSupportedErrorArgs = ErrorOptions & ReadableStreamNotSupportedErrorMeta;
|
|
158
|
+
/**
|
|
159
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
160
|
+
*/
|
|
59
161
|
export declare class ReadableStreamNotSupportedError extends ErrorBase<ReadableStreamNotSupportedErrorMeta> {
|
|
60
|
-
constructor(args: ReadableStreamNotSupportedErrorArgs
|
|
162
|
+
constructor(args: ReadableStreamNotSupportedErrorArgs);
|
|
61
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* MultipartWriteNotSupportedError に付与されるメタデータです。
|
|
166
|
+
*/
|
|
62
167
|
export type MultipartWriteNotSupportedErrorMeta = {
|
|
168
|
+
/**
|
|
169
|
+
* 対象のストレージの名前です。
|
|
170
|
+
*/
|
|
63
171
|
readonly name: string;
|
|
64
172
|
};
|
|
65
|
-
|
|
173
|
+
/**
|
|
174
|
+
* MultipartWriteNotSupportedError のコンストラクター引数です。
|
|
175
|
+
*
|
|
176
|
+
* エラーの追加情報 (`cause`) も含みます。
|
|
177
|
+
*/
|
|
178
|
+
export type MultipartWriteNotSupportedErrorArgs = ErrorOptions & MultipartWriteNotSupportedErrorMeta;
|
|
179
|
+
/**
|
|
180
|
+
* ストレージがマルチパート書き込みをサポートしていない場合に投げられるエラーです。
|
|
181
|
+
*/
|
|
66
182
|
export declare class MultipartWriteNotSupportedError extends ErrorBase<MultipartWriteNotSupportedErrorMeta> {
|
|
67
|
-
constructor(args: MultipartWriteNotSupportedErrorArgs
|
|
183
|
+
constructor(args: MultipartWriteNotSupportedErrorArgs);
|
|
68
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
187
|
+
*/
|
|
69
188
|
export type TransformerIsNotOpenErrorMeta = {
|
|
189
|
+
/**
|
|
190
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
191
|
+
*/
|
|
70
192
|
readonly name: string;
|
|
71
193
|
};
|
|
72
|
-
|
|
194
|
+
/**
|
|
195
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
196
|
+
*/
|
|
197
|
+
export type TransformerIsNotOpenErrorArgs = ErrorOptions & TransformerIsNotOpenErrorMeta;
|
|
198
|
+
/**
|
|
199
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
200
|
+
*/
|
|
73
201
|
export declare class TransformerIsNotOpenError extends ErrorBase<TransformerIsNotOpenErrorMeta> {
|
|
74
|
-
constructor(args: TransformerIsNotOpenErrorArgs
|
|
202
|
+
constructor(args: TransformerIsNotOpenErrorArgs);
|
|
75
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
206
|
+
*/
|
|
76
207
|
export type EncodableStreamNotSupportedErrorMeta = {
|
|
208
|
+
/**
|
|
209
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
210
|
+
*/
|
|
77
211
|
readonly name: string;
|
|
78
212
|
};
|
|
79
|
-
|
|
213
|
+
/**
|
|
214
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
215
|
+
*/
|
|
216
|
+
export type EncodableStreamNotSupportedErrorArgs = ErrorOptions & EncodableStreamNotSupportedErrorMeta;
|
|
217
|
+
/**
|
|
218
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
219
|
+
*/
|
|
80
220
|
export declare class EncodableStreamNotSupportedError extends ErrorBase<EncodableStreamNotSupportedErrorMeta> {
|
|
81
|
-
constructor(args: EncodableStreamNotSupportedErrorArgs
|
|
221
|
+
constructor(args: EncodableStreamNotSupportedErrorArgs);
|
|
82
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
225
|
+
*/
|
|
83
226
|
export type DecodableStreamNotSupportedErrorMeta = {
|
|
227
|
+
/**
|
|
228
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
229
|
+
*/
|
|
84
230
|
readonly name: string;
|
|
85
231
|
};
|
|
86
|
-
|
|
232
|
+
/**
|
|
233
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
234
|
+
*/
|
|
235
|
+
export type DecodableStreamNotSupportedErrorArgs = ErrorOptions & DecodableStreamNotSupportedErrorMeta;
|
|
236
|
+
/**
|
|
237
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
238
|
+
*/
|
|
87
239
|
export declare class DecodableStreamNotSupportedError extends ErrorBase<DecodableStreamNotSupportedErrorMeta> {
|
|
88
|
-
constructor(args: DecodableStreamNotSupportedErrorArgs
|
|
240
|
+
constructor(args: DecodableStreamNotSupportedErrorArgs);
|
|
89
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
244
|
+
*/
|
|
90
245
|
export type PluginOperationAggregateErrorMeta = {
|
|
246
|
+
/**
|
|
247
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
248
|
+
*/
|
|
91
249
|
readonly plugin: "plugin" | "storage" | "transformer";
|
|
92
|
-
|
|
250
|
+
/**
|
|
251
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
252
|
+
*/
|
|
253
|
+
readonly action: "open" | "close" | "write" | "read" | "delete" | "clear";
|
|
254
|
+
/**
|
|
255
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
256
|
+
*/
|
|
93
257
|
readonly errors: readonly {
|
|
258
|
+
/**
|
|
259
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
260
|
+
*/
|
|
94
261
|
readonly plugin: "storage" | "transformer";
|
|
262
|
+
/**
|
|
263
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
264
|
+
*/
|
|
95
265
|
readonly reason: unknown;
|
|
96
266
|
}[];
|
|
97
267
|
};
|
|
98
|
-
|
|
268
|
+
/**
|
|
269
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
270
|
+
*/
|
|
271
|
+
export type PluginOperationAggregateErrorArgs = ErrorOptions & {
|
|
272
|
+
/**
|
|
273
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
274
|
+
*/
|
|
99
275
|
readonly plugin?: "storage" | "transformer";
|
|
100
|
-
|
|
276
|
+
/**
|
|
277
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
278
|
+
*/
|
|
279
|
+
readonly action: "open" | "close" | "write" | "read" | "delete" | "clear";
|
|
280
|
+
/**
|
|
281
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
282
|
+
*/
|
|
101
283
|
readonly errors: readonly {
|
|
284
|
+
/**
|
|
285
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
286
|
+
*/
|
|
102
287
|
readonly plugin?: "storage" | "transformer";
|
|
288
|
+
/**
|
|
289
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
290
|
+
*/
|
|
103
291
|
readonly reason: unknown;
|
|
104
292
|
}[];
|
|
105
293
|
};
|
|
294
|
+
/**
|
|
295
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
296
|
+
*/
|
|
106
297
|
export declare class PluginOperationAggregateError extends ErrorBase<PluginOperationAggregateErrorMeta> {
|
|
107
|
-
constructor(args: PluginOperationAggregateErrorArgs
|
|
298
|
+
constructor(args: PluginOperationAggregateErrorArgs);
|
|
108
299
|
}
|
|
300
|
+
/**
|
|
301
|
+
* [API Reference](https://tai-kun.github.io/unikvs/packages/unikvs#errors)
|
|
302
|
+
*/
|
|
109
303
|
export declare class MissingStorageError extends ErrorBase<undefined> {
|
|
110
304
|
constructor(options?: ErrorOptions);
|
|
111
305
|
}
|
|
112
|
-
export declare class TransformerRegistrationError extends ErrorBase<undefined> {
|
|
113
|
-
constructor(options?: ErrorOptions);
|
|
114
|
-
}
|
|
115
306
|
//# sourceMappingURL=errors.d.ts.map
|