@devp0nt/error0 1.0.0-next.40 → 1.0.0-next.42
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/dist/cjs/index.cjs +131 -164
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +130 -125
- package/dist/esm/index.d.ts +130 -125
- package/dist/esm/index.js +130 -163
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.test.ts +130 -118
- package/src/index.ts +344 -398
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,183 +1,188 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type
|
|
7
|
-
type
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
type IsUnknown<T> = unknown extends T ? ([T] extends [unknown] ? true : false) : false;
|
|
2
|
+
type NormalizeUnknownToUndefined<T> = IsUnknown<T> extends true ? undefined : T;
|
|
3
|
+
type IsOnlyUndefined<T> = [Exclude<T, undefined>] extends [never] ? true : false;
|
|
4
|
+
type InferFirstArg<TFn> = TFn extends (...args: infer TArgs) => unknown ? TArgs extends [infer TFirst, ...unknown[]] ? TFirst : undefined : undefined;
|
|
5
|
+
type InferPluginPropInput<TProp extends ErrorPluginPropOptions<any, any, any>> = NormalizeUnknownToUndefined<InferFirstArg<TProp['init']>>;
|
|
6
|
+
type ErrorPluginPropInit<TInputValue, TOutputValue> = ((input: TInputValue) => TOutputValue) | (() => TOutputValue);
|
|
7
|
+
type ErrorPluginPropSerialize<TOutputValue, TError extends Error0> = ((options: {
|
|
8
|
+
value: TOutputValue;
|
|
9
|
+
error: TError;
|
|
10
|
+
isPublic: boolean;
|
|
11
|
+
}) => unknown) | false;
|
|
12
|
+
type ErrorPluginPropDeserialize<TOutputValue> = ((options: {
|
|
13
|
+
value: unknown;
|
|
14
|
+
serialized: Record<string, unknown>;
|
|
15
|
+
}) => TOutputValue | undefined) | false;
|
|
16
|
+
type ErrorPluginPropOptions<TInputValue, TOutputValue, TError extends Error0 = Error0> = {
|
|
17
|
+
init: ErrorPluginPropInit<TInputValue, TOutputValue>;
|
|
18
|
+
resolve: (options: {
|
|
19
|
+
value: TOutputValue | undefined;
|
|
20
|
+
flow: Array<TOutputValue | undefined>;
|
|
21
|
+
error: TError;
|
|
22
|
+
}) => TOutputValue | undefined;
|
|
23
|
+
serialize: ErrorPluginPropSerialize<TOutputValue, TError>;
|
|
24
|
+
deserialize: ErrorPluginPropDeserialize<TOutputValue>;
|
|
25
|
+
};
|
|
26
|
+
type ErrorPluginMethodFn<TOutputValue, TArgs extends unknown[] = unknown[], TError extends Error0 = Error0> = (error: TError, ...args: TArgs) => TOutputValue;
|
|
27
|
+
type ErrorPluginAdaptResult<TOutputProps extends Record<string, unknown>> = Partial<TOutputProps> | undefined;
|
|
28
|
+
type ErrorPluginAdaptFn<TError extends Error0 = Error0, TOutputProps extends Record<string, unknown> = Record<never, never>> = ((error: TError) => void) | ((error: TError) => ErrorPluginAdaptResult<TOutputProps>);
|
|
10
29
|
type ErrorMethodRecord = {
|
|
11
30
|
args: unknown[];
|
|
12
31
|
output: unknown;
|
|
13
32
|
};
|
|
14
|
-
type
|
|
15
|
-
[key: string]:
|
|
33
|
+
type ErrorPluginProps = {
|
|
34
|
+
[key: string]: ErrorPluginPropOptions<any, any>;
|
|
16
35
|
};
|
|
17
|
-
type
|
|
18
|
-
[key: string]:
|
|
36
|
+
type ErrorPluginMethods = {
|
|
37
|
+
[key: string]: ErrorPluginMethodFn<any, any[]>;
|
|
19
38
|
};
|
|
20
|
-
type
|
|
21
|
-
[key: string]: ErrorExtensionMethodFn<any, any[]>;
|
|
22
|
-
};
|
|
23
|
-
type ErrorExtension<TProps extends ErrorExtensionProps = Record<never, never>, TComputed extends ErrorExtensionComputed = Record<never, never>, TMethods extends ErrorExtensionMethods = Record<never, never>> = {
|
|
39
|
+
type ErrorPlugin<TProps extends ErrorPluginProps = Record<never, never>, TMethods extends ErrorPluginMethods = Record<never, never>> = {
|
|
24
40
|
props?: TProps;
|
|
25
|
-
computed?: TComputed;
|
|
26
41
|
methods?: TMethods;
|
|
27
|
-
|
|
42
|
+
adapt?: Array<ErrorPluginAdaptFn<Error0, PluginOutputProps<TProps>>>;
|
|
28
43
|
};
|
|
29
|
-
type
|
|
30
|
-
type
|
|
31
|
-
type
|
|
32
|
-
|
|
33
|
-
[TKey in keyof TProps]: TProps[TKey] extends ErrorExtensionPropOptions<any, infer TOutputValue> ? TOutputValue : never;
|
|
44
|
+
type AddPropToPluginProps<TProps extends ErrorPluginProps, TKey extends string, TInputValue, TOutputValue> = TProps & Record<TKey, ErrorPluginPropOptions<TInputValue, TOutputValue>>;
|
|
45
|
+
type AddMethodToPluginMethods<TMethods extends ErrorPluginMethods, TKey extends string, TArgs extends unknown[], TOutputValue> = TMethods & Record<TKey, ErrorPluginMethodFn<TOutputValue, TArgs>>;
|
|
46
|
+
type PluginOutputProps<TProps extends ErrorPluginProps> = {
|
|
47
|
+
[TKey in keyof TProps]: TProps[TKey] extends ErrorPluginPropOptions<any, infer TOutputValue> ? TOutputValue : never;
|
|
34
48
|
};
|
|
35
|
-
type
|
|
49
|
+
type ErrorPluginsMap = {
|
|
36
50
|
props: Record<string, {
|
|
37
|
-
|
|
38
|
-
|
|
51
|
+
init: unknown;
|
|
52
|
+
resolve: unknown;
|
|
39
53
|
}>;
|
|
40
|
-
computed: Record<string, unknown>;
|
|
41
54
|
methods: Record<string, ErrorMethodRecord>;
|
|
42
55
|
};
|
|
43
56
|
type IsEmptyObject<T> = keyof T extends never ? true : false;
|
|
44
57
|
type ErrorInputBase = {
|
|
45
58
|
cause?: unknown;
|
|
46
59
|
};
|
|
47
|
-
type
|
|
48
|
-
[TKey in keyof
|
|
49
|
-
}>;
|
|
50
|
-
type ErrorOutputProps<TExtensionsMap extends ErrorExtensionsMap> = {
|
|
51
|
-
[TKey in keyof TExtensionsMap['props']]: TExtensionsMap['props'][TKey]['output'];
|
|
60
|
+
type ErrorInputPluginProps<TPluginsMap extends ErrorPluginsMap> = {
|
|
61
|
+
[TKey in keyof TPluginsMap['props'] as IsOnlyUndefined<TPluginsMap['props'][TKey]['init']> extends true ? never : TKey]?: TPluginsMap['props'][TKey]['init'];
|
|
52
62
|
};
|
|
53
|
-
type
|
|
54
|
-
|
|
63
|
+
type ErrorInput<TPluginsMap extends ErrorPluginsMap> = IsEmptyObject<TPluginsMap['props']> extends true ? ErrorInputBase : ErrorInputBase & ErrorInputPluginProps<TPluginsMap>;
|
|
64
|
+
type ErrorOutputProps<TPluginsMap extends ErrorPluginsMap> = {
|
|
65
|
+
[TKey in keyof TPluginsMap['props']]: TPluginsMap['props'][TKey]['resolve'] | undefined;
|
|
55
66
|
};
|
|
56
|
-
type ErrorOutputMethods<
|
|
57
|
-
[TKey in keyof
|
|
67
|
+
type ErrorOutputMethods<TPluginsMap extends ErrorPluginsMap> = {
|
|
68
|
+
[TKey in keyof TPluginsMap['methods']]: TPluginsMap['methods'][TKey] extends {
|
|
58
69
|
args: infer TArgs extends unknown[];
|
|
59
70
|
output: infer TOutput;
|
|
60
71
|
} ? (...args: TArgs) => TOutput : never;
|
|
61
72
|
};
|
|
62
|
-
type ErrorOutput<
|
|
63
|
-
type ErrorStaticMethods<
|
|
64
|
-
[TKey in keyof
|
|
73
|
+
type ErrorOutput<TPluginsMap extends ErrorPluginsMap> = ErrorOutputProps<TPluginsMap> & ErrorOutputMethods<TPluginsMap>;
|
|
74
|
+
type ErrorStaticMethods<TPluginsMap extends ErrorPluginsMap> = {
|
|
75
|
+
[TKey in keyof TPluginsMap['methods']]: TPluginsMap['methods'][TKey] extends {
|
|
65
76
|
args: infer TArgs extends unknown[];
|
|
66
77
|
output: infer TOutput;
|
|
67
78
|
} ? (error: unknown, ...args: TArgs) => TOutput : never;
|
|
68
79
|
};
|
|
69
|
-
type
|
|
80
|
+
type EmptyPluginsMap = {
|
|
70
81
|
props: Record<never, {
|
|
71
|
-
|
|
72
|
-
|
|
82
|
+
init: never;
|
|
83
|
+
resolve: never;
|
|
73
84
|
}>;
|
|
74
|
-
computed: Record<never, never>;
|
|
75
85
|
methods: Record<never, ErrorMethodRecord>;
|
|
76
86
|
};
|
|
77
|
-
type
|
|
78
|
-
[TKey in keyof NonNullable<
|
|
79
|
-
|
|
80
|
-
|
|
87
|
+
type PluginPropsMapOf<TPlugin extends ErrorPlugin> = {
|
|
88
|
+
[TKey in keyof NonNullable<TPlugin['props']>]: NonNullable<TPlugin['props']>[TKey] extends ErrorPluginPropOptions<any, infer TOutputValue> ? {
|
|
89
|
+
init: InferPluginPropInput<NonNullable<TPlugin['props']>[TKey]>;
|
|
90
|
+
resolve: TOutputValue;
|
|
81
91
|
} : never;
|
|
82
92
|
};
|
|
83
|
-
type
|
|
84
|
-
[TKey in keyof NonNullable<
|
|
85
|
-
};
|
|
86
|
-
type ExtensionMethodsMapOf<TExtension extends ErrorExtension> = {
|
|
87
|
-
[TKey in keyof NonNullable<TExtension['methods']>]: NonNullable<TExtension['methods']>[TKey] extends (error: Error0, ...args: infer TArgs extends unknown[]) => infer TOutput ? {
|
|
93
|
+
type PluginMethodsMapOf<TPlugin extends ErrorPlugin> = {
|
|
94
|
+
[TKey in keyof NonNullable<TPlugin['methods']>]: NonNullable<TPlugin['methods']>[TKey] extends (error: Error0, ...args: infer TArgs extends unknown[]) => infer TOutput ? {
|
|
88
95
|
args: TArgs;
|
|
89
96
|
output: TOutput;
|
|
90
97
|
} : never;
|
|
91
98
|
};
|
|
92
|
-
type
|
|
93
|
-
props:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
type
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
type
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
type
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
type ExtensionOfBuilder<TBuilder> = TBuilder extends ExtensionError0<infer TProps, infer TComputed, infer TMethods> ? ErrorExtension<TProps, TComputed, TMethods> : never;
|
|
112
|
-
type ErrorFlowPolicy = 'instance' | 'error0' | 'likeError0' | 'all';
|
|
113
|
-
declare class ExtensionError0<TProps extends ErrorExtensionProps = Record<never, never>, TComputed extends ErrorExtensionComputed = Record<never, never>, TMethods extends ErrorExtensionMethods = Record<never, never>> {
|
|
114
|
-
private readonly _extension;
|
|
99
|
+
type ErrorPluginsMapOfPlugin<TPlugin extends ErrorPlugin> = {
|
|
100
|
+
props: PluginPropsMapOf<TPlugin>;
|
|
101
|
+
methods: PluginMethodsMapOf<TPlugin>;
|
|
102
|
+
};
|
|
103
|
+
type ExtendErrorPluginsMap<TMap extends ErrorPluginsMap, TPlugin extends ErrorPlugin> = {
|
|
104
|
+
props: TMap['props'] & ErrorPluginsMapOfPlugin<TPlugin>['props'];
|
|
105
|
+
methods: TMap['methods'] & ErrorPluginsMapOfPlugin<TPlugin>['methods'];
|
|
106
|
+
};
|
|
107
|
+
type ExtendErrorPluginsMapWithProp<TMap extends ErrorPluginsMap, TKey extends string, TInputValue, TOutputValue> = ExtendErrorPluginsMap<TMap, ErrorPlugin<Record<TKey, ErrorPluginPropOptions<TInputValue, TOutputValue>>>>;
|
|
108
|
+
type ExtendErrorPluginsMapWithMethod<TMap extends ErrorPluginsMap, TKey extends string, TArgs extends unknown[], TOutputValue> = ExtendErrorPluginsMap<TMap, ErrorPlugin<Record<never, never>, Record<TKey, ErrorPluginMethodFn<TOutputValue, TArgs>>>>;
|
|
109
|
+
type PluginsMapOf<TClass> = TClass extends {
|
|
110
|
+
__pluginsMap?: infer TPluginsMap;
|
|
111
|
+
} ? TPluginsMap extends ErrorPluginsMap ? TPluginsMap : EmptyPluginsMap : EmptyPluginsMap;
|
|
112
|
+
type PluginsMapFromParts<TProps extends ErrorPluginProps, TMethods extends ErrorPluginMethods> = ErrorPluginsMapOfPlugin<ErrorPlugin<TProps, TMethods>>;
|
|
113
|
+
type ErrorInstanceOfMap<TMap extends ErrorPluginsMap> = Error0 & ErrorOutput<TMap>;
|
|
114
|
+
type BuilderError0<TProps extends ErrorPluginProps, TMethods extends ErrorPluginMethods> = Error0 & ErrorOutput<PluginsMapFromParts<TProps, TMethods>>;
|
|
115
|
+
type PluginOfBuilder<TBuilder> = TBuilder extends PluginError0<infer TProps, infer TMethods> ? ErrorPlugin<TProps, TMethods> : never;
|
|
116
|
+
declare class PluginError0<TProps extends ErrorPluginProps = Record<never, never>, TMethods extends ErrorPluginMethods = Record<never, never>> {
|
|
117
|
+
private readonly _plugin;
|
|
115
118
|
readonly Infer: {
|
|
116
119
|
props: TProps;
|
|
117
|
-
computed: TComputed;
|
|
118
120
|
methods: TMethods;
|
|
119
121
|
};
|
|
120
|
-
constructor(
|
|
121
|
-
prop<TKey extends string, TInputValue, TOutputValue>(key: TKey, value:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
extend<TKey extends string, TArgs extends unknown[], TOutputValue>(kind: 'method', key: TKey, value: ErrorExtensionMethodFn<TOutputValue, TArgs, BuilderError0<TProps, TComputed, TMethods>>): ExtensionError0<TProps, TComputed, AddMethodToExtensionMethods<TMethods, TKey, TArgs, TOutputValue>>;
|
|
128
|
-
extend(kind: 'refine', value: ErrorExtensionRefineFn<BuilderError0<TProps, TComputed, TMethods>, ExtensionOutputProps<TProps>>): ExtensionError0<TProps, TComputed, TMethods>;
|
|
122
|
+
constructor(plugin?: ErrorPlugin<ErrorPluginProps, ErrorPluginMethods>);
|
|
123
|
+
prop<TKey extends string, TInputValue, TOutputValue>(key: TKey, value: ErrorPluginPropOptions<TInputValue, TOutputValue, BuilderError0<TProps, TMethods>>): PluginError0<AddPropToPluginProps<TProps, TKey, TInputValue, TOutputValue>, TMethods>;
|
|
124
|
+
method<TKey extends string, TArgs extends unknown[], TOutputValue>(key: TKey, value: ErrorPluginMethodFn<TOutputValue, TArgs, BuilderError0<TProps, TMethods>>): PluginError0<TProps, AddMethodToPluginMethods<TMethods, TKey, TArgs, TOutputValue>>;
|
|
125
|
+
adapt(value: ErrorPluginAdaptFn<BuilderError0<TProps, TMethods>, PluginOutputProps<TProps>>): PluginError0<TProps, TMethods>;
|
|
126
|
+
use<TKey extends string, TInputValue, TOutputValue>(kind: 'prop', key: TKey, value: ErrorPluginPropOptions<TInputValue, TOutputValue, BuilderError0<TProps, TMethods>>): PluginError0<AddPropToPluginProps<TProps, TKey, TInputValue, TOutputValue>, TMethods>;
|
|
127
|
+
use<TKey extends string, TArgs extends unknown[], TOutputValue>(kind: 'method', key: TKey, value: ErrorPluginMethodFn<TOutputValue, TArgs, BuilderError0<TProps, TMethods>>): PluginError0<TProps, AddMethodToPluginMethods<TMethods, TKey, TArgs, TOutputValue>>;
|
|
128
|
+
use(kind: 'adapt', value: ErrorPluginAdaptFn<BuilderError0<TProps, TMethods>, PluginOutputProps<TProps>>): PluginError0<TProps, TMethods>;
|
|
129
129
|
}
|
|
130
|
-
type ClassError0<
|
|
131
|
-
new (message: string, input?: ErrorInput<
|
|
130
|
+
type ClassError0<TPluginsMap extends ErrorPluginsMap = EmptyPluginsMap> = {
|
|
131
|
+
new (message: string, input?: ErrorInput<TPluginsMap>): Error0 & ErrorOutput<TPluginsMap>;
|
|
132
132
|
new (input: {
|
|
133
133
|
message: string;
|
|
134
|
-
} & ErrorInput<
|
|
135
|
-
readonly
|
|
136
|
-
from: (error: unknown) => Error0 & ErrorOutput<
|
|
137
|
-
serialize: (error: unknown, isPublic?: boolean) =>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
<
|
|
143
|
-
(kind: '
|
|
134
|
+
} & ErrorInput<TPluginsMap>): Error0 & ErrorOutput<TPluginsMap>;
|
|
135
|
+
readonly __pluginsMap?: TPluginsMap;
|
|
136
|
+
from: (error: unknown) => Error0 & ErrorOutput<TPluginsMap>;
|
|
137
|
+
serialize: (error: unknown, isPublic?: boolean) => Record<string, unknown>;
|
|
138
|
+
prop: <TKey extends string, TInputValue, TOutputValue>(key: TKey, value: ErrorPluginPropOptions<TInputValue, TOutputValue, ErrorInstanceOfMap<TPluginsMap>>) => ClassError0<ExtendErrorPluginsMapWithProp<TPluginsMap, TKey, TInputValue, TOutputValue>>;
|
|
139
|
+
method: <TKey extends string, TArgs extends unknown[], TOutputValue>(key: TKey, value: ErrorPluginMethodFn<TOutputValue, TArgs, ErrorInstanceOfMap<TPluginsMap>>) => ClassError0<ExtendErrorPluginsMapWithMethod<TPluginsMap, TKey, TArgs, TOutputValue>>;
|
|
140
|
+
adapt: (value: ErrorPluginAdaptFn<ErrorInstanceOfMap<TPluginsMap>, ErrorOutputProps<TPluginsMap>>) => ClassError0<TPluginsMap>;
|
|
141
|
+
use: {
|
|
142
|
+
<TBuilder extends PluginError0>(plugin: TBuilder): ClassError0<ExtendErrorPluginsMap<TPluginsMap, PluginOfBuilder<TBuilder>>>;
|
|
143
|
+
<TKey extends string, TInputValue, TOutputValue>(kind: 'prop', key: TKey, value: ErrorPluginPropOptions<TInputValue, TOutputValue, ErrorInstanceOfMap<TPluginsMap>>): ClassError0<ExtendErrorPluginsMapWithProp<TPluginsMap, TKey, TInputValue, TOutputValue>>;
|
|
144
|
+
<TKey extends string, TArgs extends unknown[], TOutputValue>(kind: 'method', key: TKey, value: ErrorPluginMethodFn<TOutputValue, TArgs, ErrorInstanceOfMap<TPluginsMap>>): ClassError0<ExtendErrorPluginsMapWithMethod<TPluginsMap, TKey, TArgs, TOutputValue>>;
|
|
145
|
+
(kind: 'adapt', value: ErrorPluginAdaptFn<ErrorInstanceOfMap<TPluginsMap>, ErrorOutputProps<TPluginsMap>>): ClassError0<TPluginsMap>;
|
|
144
146
|
};
|
|
145
|
-
|
|
146
|
-
} & ErrorStaticMethods<
|
|
147
|
+
plugin: () => PluginError0;
|
|
148
|
+
} & ErrorStaticMethods<TPluginsMap>;
|
|
147
149
|
declare class Error0 extends Error {
|
|
148
|
-
static readonly
|
|
149
|
-
protected static
|
|
150
|
-
private static readonly
|
|
151
|
-
private static
|
|
152
|
-
constructor(message: string, input?: ErrorInput<
|
|
150
|
+
static readonly __pluginsMap?: EmptyPluginsMap;
|
|
151
|
+
protected static _plugins: ErrorPlugin[];
|
|
152
|
+
private static readonly _emptyPlugin;
|
|
153
|
+
private static _getResolvedPlugin;
|
|
154
|
+
constructor(message: string, input?: ErrorInput<EmptyPluginsMap>);
|
|
153
155
|
constructor(input: {
|
|
154
156
|
message: string;
|
|
155
|
-
} & ErrorInput<
|
|
157
|
+
} & ErrorInput<EmptyPluginsMap>);
|
|
156
158
|
private static readonly isSelfProperty;
|
|
157
159
|
static own(error: object, key: string): unknown;
|
|
158
160
|
own(key: string): unknown;
|
|
159
|
-
static flow(error: object, key: string
|
|
160
|
-
flow(key: string
|
|
161
|
-
static causes(error:
|
|
162
|
-
causes(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
static
|
|
161
|
+
static flow(error: object, key: string): unknown[];
|
|
162
|
+
flow(key: string): unknown[];
|
|
163
|
+
static causes(error: unknown, instancesOnly?: false): unknown[];
|
|
164
|
+
static causes<T extends typeof Error0>(this: T, error: unknown, instancesOnly: true): Array<InstanceType<T>>;
|
|
165
|
+
causes<T extends typeof Error0>(this: T, instancesOnly?: false): [InstanceType<T>, ...unknown[]];
|
|
166
|
+
causes<T extends typeof Error0>(this: T, instancesOnly: true): [InstanceType<T>, ...Array<InstanceType<T>>];
|
|
167
|
+
static is<T extends typeof Error0>(this: T, error: unknown): error is InstanceType<T>;
|
|
168
|
+
static isSerialized(error: unknown): error is Record<string, unknown>;
|
|
166
169
|
static from(error: unknown): Error0;
|
|
167
|
-
private static
|
|
168
|
-
private static
|
|
170
|
+
private static _applyAdapt;
|
|
171
|
+
private static _fromSerialized;
|
|
169
172
|
private static _fromNonError0;
|
|
170
173
|
private static _extractMessage;
|
|
171
|
-
private static
|
|
172
|
-
private static
|
|
173
|
-
static
|
|
174
|
-
static
|
|
175
|
-
static
|
|
176
|
-
static
|
|
177
|
-
static
|
|
178
|
-
static
|
|
179
|
-
static
|
|
174
|
+
private static _useWithPlugin;
|
|
175
|
+
private static _pluginFromBuilder;
|
|
176
|
+
static prop<TThis extends typeof Error0, TKey extends string, TInputValue, TOutputValue>(this: TThis, key: TKey, value: ErrorPluginPropOptions<TInputValue, TOutputValue, ErrorInstanceOfMap<PluginsMapOf<TThis>>>): ClassError0<ExtendErrorPluginsMapWithProp<PluginsMapOf<TThis>, TKey, TInputValue, TOutputValue>>;
|
|
177
|
+
static method<TThis extends typeof Error0, TKey extends string, TArgs extends unknown[], TOutputValue>(this: TThis, key: TKey, value: ErrorPluginMethodFn<TOutputValue, TArgs, ErrorInstanceOfMap<PluginsMapOf<TThis>>>): ClassError0<ExtendErrorPluginsMapWithMethod<PluginsMapOf<TThis>, TKey, TArgs, TOutputValue>>;
|
|
178
|
+
static adapt<TThis extends typeof Error0>(this: TThis, value: ErrorPluginAdaptFn<ErrorInstanceOfMap<PluginsMapOf<TThis>>, ErrorOutputProps<PluginsMapOf<TThis>>>): ClassError0<PluginsMapOf<TThis>>;
|
|
179
|
+
static use<TThis extends typeof Error0, TBuilder extends PluginError0>(this: TThis, plugin: TBuilder): ClassError0<ExtendErrorPluginsMap<PluginsMapOf<TThis>, PluginOfBuilder<TBuilder>>>;
|
|
180
|
+
static use<TThis extends typeof Error0, TKey extends string, TInputValue, TOutputValue>(this: TThis, kind: 'prop', key: TKey, value: ErrorPluginPropOptions<TInputValue, TOutputValue, ErrorInstanceOfMap<PluginsMapOf<TThis>>>): ClassError0<ExtendErrorPluginsMapWithProp<PluginsMapOf<TThis>, TKey, TInputValue, TOutputValue>>;
|
|
181
|
+
static use<TThis extends typeof Error0, TKey extends string, TArgs extends unknown[], TOutputValue>(this: TThis, kind: 'method', key: TKey, value: ErrorPluginMethodFn<TOutputValue, TArgs, ErrorInstanceOfMap<PluginsMapOf<TThis>>>): ClassError0<ExtendErrorPluginsMapWithMethod<PluginsMapOf<TThis>, TKey, TArgs, TOutputValue>>;
|
|
182
|
+
static use<TThis extends typeof Error0>(this: TThis, kind: 'adapt', value: ErrorPluginAdaptFn<ErrorInstanceOfMap<PluginsMapOf<TThis>>, ErrorOutputProps<PluginsMapOf<TThis>>>): ClassError0<PluginsMapOf<TThis>>;
|
|
183
|
+
static plugin(): PluginError0;
|
|
184
|
+
static serialize(error: unknown, isPublic?: boolean): Record<string, unknown>;
|
|
180
185
|
serialize(isPublic?: boolean): object;
|
|
181
186
|
}
|
|
182
187
|
|
|
183
|
-
export { type ClassError0, Error0, type
|
|
188
|
+
export { type ClassError0, Error0, type ErrorInput, type ErrorInputBase, type ErrorOutput, type ErrorPlugin, type ErrorPluginAdaptFn, type ErrorPluginAdaptResult, type ErrorPluginMethodFn, type ErrorPluginMethods, type ErrorPluginPropOptions, type ErrorPluginProps, type ErrorPluginsMap, type IsEmptyObject, PluginError0 };
|