@bemoje/composition 2.0.1 → 2.1.2
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/lib/IView.cjs +2 -0
- package/lib/IView.d.cts +12 -0
- package/lib/IView.d.ts +12 -0
- package/lib/IView.js +1 -0
- package/lib/OptionsConfigurator.cjs +166 -0
- package/lib/OptionsConfigurator.d.cts +2229 -0
- package/lib/OptionsConfigurator.d.ts +2229 -0
- package/lib/OptionsConfigurator.js +163 -0
- package/lib/View.cjs +22 -0
- package/lib/View.d.cts +14 -0
- package/lib/View.d.ts +14 -0
- package/lib/View.js +20 -0
- package/lib/index.cjs +103 -0
- package/lib/index.d.cts +16 -0
- package/lib/index.d.ts +16 -0
- package/lib/index.js +14 -0
- package/lib/inheritProxifiedPrototype.cjs +19 -0
- package/lib/inheritProxifiedPrototype.d.cts +11 -0
- package/lib/inheritProxifiedPrototype.d.ts +11 -0
- package/lib/inheritProxifiedPrototype.js +16 -0
- package/lib/inheritProxifiedPrototypeProperty.cjs +45 -0
- package/lib/inheritProxifiedPrototypeProperty.d.cts +9 -0
- package/lib/inheritProxifiedPrototypeProperty.d.ts +9 -0
- package/lib/inheritProxifiedPrototypeProperty.js +43 -0
- package/lib/inspector/Inspector.cjs +227 -0
- package/lib/inspector/Inspector.d.cts +4 -0
- package/lib/inspector/Inspector.d.ts +4 -0
- package/lib/inspector/Inspector.js +220 -0
- package/lib/inspector/defaults/ignoreValuesDefaults.cjs +11 -0
- package/lib/inspector/defaults/ignoreValuesDefaults.d.cts +11 -0
- package/lib/inspector/defaults/ignoreValuesDefaults.d.ts +11 -0
- package/lib/inspector/defaults/ignoreValuesDefaults.js +11 -0
- package/lib/inspector/defaults/ignoreValuesFilterDefaults.cjs +23 -0
- package/lib/inspector/defaults/ignoreValuesFilterDefaults.d.cts +11 -0
- package/lib/inspector/defaults/ignoreValuesFilterDefaults.d.ts +11 -0
- package/lib/inspector/defaults/ignoreValuesFilterDefaults.js +21 -0
- package/lib/inspector/defaults/inspectDefaults.cjs +17 -0
- package/lib/inspector/defaults/inspectDefaults.d.cts +8 -0
- package/lib/inspector/defaults/inspectDefaults.d.ts +8 -0
- package/lib/inspector/defaults/inspectDefaults.js +16 -0
- package/lib/inspector/defaults/inspectorDefaults.cjs +15 -0
- package/lib/inspector/defaults/inspectorDefaults.d.cts +11 -0
- package/lib/inspector/defaults/inspectorDefaults.d.ts +11 -0
- package/lib/inspector/defaults/inspectorDefaults.js +14 -0
- package/lib/inspector/types.cjs +2 -0
- package/lib/inspector/types.d.cts +4 -0
- package/lib/inspector/types.d.ts +4 -0
- package/lib/inspector/types.js +1 -0
- package/lib/parenting/ParentRelationTypes.cjs +130 -0
- package/lib/parenting/ParentRelationTypes.d.cts +4 -0
- package/lib/parenting/ParentRelationTypes.d.ts +4 -0
- package/lib/parenting/ParentRelationTypes.js +123 -0
- package/lib/parenting/Parenting.cjs +88 -0
- package/lib/parenting/Parenting.d.cts +4 -0
- package/lib/parenting/Parenting.d.ts +4 -0
- package/lib/parenting/Parenting.js +85 -0
- package/lib/parenting/types.cjs +2 -0
- package/lib/parenting/types.d.cts +4 -0
- package/lib/parenting/types.d.ts +4 -0
- package/lib/parenting/types.js +1 -0
- package/package.json +239 -21
- package/index.d.ts +0 -193
- package/index.mjs +0 -628
package/package.json
CHANGED
|
@@ -1,37 +1,255 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bemoje/composition",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "composition",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"sideEffects": false,
|
|
3
|
+
"version": "2.1.2",
|
|
4
|
+
"description": "Class composition utilities for views, proxy-based inheritance, object inspection, and parent-child relationships.",
|
|
7
5
|
"keywords": [
|
|
8
|
-
"composition"
|
|
6
|
+
"composition",
|
|
7
|
+
"class",
|
|
8
|
+
"proxy",
|
|
9
|
+
"inheritance",
|
|
10
|
+
"mixin",
|
|
11
|
+
"parent-child",
|
|
12
|
+
"object",
|
|
13
|
+
"utilities",
|
|
14
|
+
"typescript"
|
|
9
15
|
],
|
|
10
|
-
"exports": {
|
|
11
|
-
".": {
|
|
12
|
-
"types": "./index.d.ts",
|
|
13
|
-
"import": "./index.mjs",
|
|
14
|
-
"default": "./index.mjs"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
16
|
"dependencies": {
|
|
17
|
+
"@sinclair/typebox": "^0.34.48",
|
|
18
18
|
"ansi-colors": "^4.1.3",
|
|
19
|
-
"es-toolkit": "^1.
|
|
20
|
-
"mnemonist": "^0.40.3"
|
|
21
|
-
"type-fest": "^5.4.4"
|
|
19
|
+
"es-toolkit": "^1.45.1",
|
|
20
|
+
"mnemonist": "^0.40.3"
|
|
22
21
|
},
|
|
22
|
+
"type": "module",
|
|
23
|
+
"sideEffects": false,
|
|
23
24
|
"publishConfig": {
|
|
24
25
|
"access": "public"
|
|
25
26
|
},
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
27
|
+
"main": "./lib/index.cjs",
|
|
28
|
+
"module": "./lib/index.js",
|
|
29
|
+
"types": "./lib/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./lib/index.d.ts",
|
|
34
|
+
"default": "./lib/index.js"
|
|
35
|
+
},
|
|
36
|
+
"require": {
|
|
37
|
+
"types": "./lib/index.d.cts",
|
|
38
|
+
"default": "./lib/index.cjs"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"./IView": {
|
|
42
|
+
"import": {
|
|
43
|
+
"types": "./lib/IView.d.ts",
|
|
44
|
+
"default": "./lib/IView.js"
|
|
45
|
+
},
|
|
46
|
+
"require": {
|
|
47
|
+
"types": "./lib/IView.d.cts",
|
|
48
|
+
"default": "./lib/IView.cjs"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"./OptionsConfigurator": {
|
|
52
|
+
"import": {
|
|
53
|
+
"types": "./lib/OptionsConfigurator.d.ts",
|
|
54
|
+
"default": "./lib/OptionsConfigurator.js"
|
|
55
|
+
},
|
|
56
|
+
"require": {
|
|
57
|
+
"types": "./lib/OptionsConfigurator.d.cts",
|
|
58
|
+
"default": "./lib/OptionsConfigurator.cjs"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"./View": {
|
|
62
|
+
"import": {
|
|
63
|
+
"types": "./lib/View.d.ts",
|
|
64
|
+
"default": "./lib/View.js"
|
|
65
|
+
},
|
|
66
|
+
"require": {
|
|
67
|
+
"types": "./lib/View.d.cts",
|
|
68
|
+
"default": "./lib/View.cjs"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"./inheritProxifiedPrototype": {
|
|
72
|
+
"import": {
|
|
73
|
+
"types": "./lib/inheritProxifiedPrototype.d.ts",
|
|
74
|
+
"default": "./lib/inheritProxifiedPrototype.js"
|
|
75
|
+
},
|
|
76
|
+
"require": {
|
|
77
|
+
"types": "./lib/inheritProxifiedPrototype.d.cts",
|
|
78
|
+
"default": "./lib/inheritProxifiedPrototype.cjs"
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"./inheritProxifiedPrototypeProperty": {
|
|
82
|
+
"import": {
|
|
83
|
+
"types": "./lib/inheritProxifiedPrototypeProperty.d.ts",
|
|
84
|
+
"default": "./lib/inheritProxifiedPrototypeProperty.js"
|
|
85
|
+
},
|
|
86
|
+
"require": {
|
|
87
|
+
"types": "./lib/inheritProxifiedPrototypeProperty.d.cts",
|
|
88
|
+
"default": "./lib/inheritProxifiedPrototypeProperty.cjs"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"./inspector/Inspector": {
|
|
92
|
+
"import": {
|
|
93
|
+
"types": "./lib/inspector/Inspector.d.ts",
|
|
94
|
+
"default": "./lib/inspector/Inspector.js"
|
|
95
|
+
},
|
|
96
|
+
"require": {
|
|
97
|
+
"types": "./lib/inspector/Inspector.d.cts",
|
|
98
|
+
"default": "./lib/inspector/Inspector.cjs"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"./inspector/defaults/ignoreValuesDefaults": {
|
|
102
|
+
"import": {
|
|
103
|
+
"types": "./lib/inspector/defaults/ignoreValuesDefaults.d.ts",
|
|
104
|
+
"default": "./lib/inspector/defaults/ignoreValuesDefaults.js"
|
|
105
|
+
},
|
|
106
|
+
"require": {
|
|
107
|
+
"types": "./lib/inspector/defaults/ignoreValuesDefaults.d.cts",
|
|
108
|
+
"default": "./lib/inspector/defaults/ignoreValuesDefaults.cjs"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"./inspector/defaults/ignoreValuesFilterDefaults": {
|
|
112
|
+
"import": {
|
|
113
|
+
"types": "./lib/inspector/defaults/ignoreValuesFilterDefaults.d.ts",
|
|
114
|
+
"default": "./lib/inspector/defaults/ignoreValuesFilterDefaults.js"
|
|
115
|
+
},
|
|
116
|
+
"require": {
|
|
117
|
+
"types": "./lib/inspector/defaults/ignoreValuesFilterDefaults.d.cts",
|
|
118
|
+
"default": "./lib/inspector/defaults/ignoreValuesFilterDefaults.cjs"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
"./inspector/defaults/inspectDefaults": {
|
|
122
|
+
"import": {
|
|
123
|
+
"types": "./lib/inspector/defaults/inspectDefaults.d.ts",
|
|
124
|
+
"default": "./lib/inspector/defaults/inspectDefaults.js"
|
|
125
|
+
},
|
|
126
|
+
"require": {
|
|
127
|
+
"types": "./lib/inspector/defaults/inspectDefaults.d.cts",
|
|
128
|
+
"default": "./lib/inspector/defaults/inspectDefaults.cjs"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"./inspector/defaults/inspectorDefaults": {
|
|
132
|
+
"import": {
|
|
133
|
+
"types": "./lib/inspector/defaults/inspectorDefaults.d.ts",
|
|
134
|
+
"default": "./lib/inspector/defaults/inspectorDefaults.js"
|
|
135
|
+
},
|
|
136
|
+
"require": {
|
|
137
|
+
"types": "./lib/inspector/defaults/inspectorDefaults.d.cts",
|
|
138
|
+
"default": "./lib/inspector/defaults/inspectorDefaults.cjs"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"./inspector/types": {
|
|
142
|
+
"import": {
|
|
143
|
+
"types": "./lib/inspector/types.d.ts",
|
|
144
|
+
"default": "./lib/inspector/types.js"
|
|
145
|
+
},
|
|
146
|
+
"require": {
|
|
147
|
+
"types": "./lib/inspector/types.d.cts",
|
|
148
|
+
"default": "./lib/inspector/types.cjs"
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
"./parenting/ParentRelationTypes": {
|
|
152
|
+
"import": {
|
|
153
|
+
"types": "./lib/parenting/ParentRelationTypes.d.ts",
|
|
154
|
+
"default": "./lib/parenting/ParentRelationTypes.js"
|
|
155
|
+
},
|
|
156
|
+
"require": {
|
|
157
|
+
"types": "./lib/parenting/ParentRelationTypes.d.cts",
|
|
158
|
+
"default": "./lib/parenting/ParentRelationTypes.cjs"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
"./parenting/Parenting": {
|
|
162
|
+
"import": {
|
|
163
|
+
"types": "./lib/parenting/Parenting.d.ts",
|
|
164
|
+
"default": "./lib/parenting/Parenting.js"
|
|
165
|
+
},
|
|
166
|
+
"require": {
|
|
167
|
+
"types": "./lib/parenting/Parenting.d.cts",
|
|
168
|
+
"default": "./lib/parenting/Parenting.cjs"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"./parenting/types": {
|
|
172
|
+
"import": {
|
|
173
|
+
"types": "./lib/parenting/types.d.ts",
|
|
174
|
+
"default": "./lib/parenting/types.js"
|
|
175
|
+
},
|
|
176
|
+
"require": {
|
|
177
|
+
"types": "./lib/parenting/types.d.cts",
|
|
178
|
+
"default": "./lib/parenting/types.cjs"
|
|
179
|
+
}
|
|
180
|
+
}
|
|
31
181
|
},
|
|
182
|
+
"files": [
|
|
183
|
+
"./lib/index.js",
|
|
184
|
+
"./lib/index.d.ts",
|
|
185
|
+
"./lib/index.cjs",
|
|
186
|
+
"./lib/index.d.cts",
|
|
187
|
+
"./lib/IView.js",
|
|
188
|
+
"./lib/IView.d.ts",
|
|
189
|
+
"./lib/IView.cjs",
|
|
190
|
+
"./lib/IView.d.cts",
|
|
191
|
+
"./lib/OptionsConfigurator.js",
|
|
192
|
+
"./lib/OptionsConfigurator.d.ts",
|
|
193
|
+
"./lib/OptionsConfigurator.cjs",
|
|
194
|
+
"./lib/OptionsConfigurator.d.cts",
|
|
195
|
+
"./lib/View.js",
|
|
196
|
+
"./lib/View.d.ts",
|
|
197
|
+
"./lib/View.cjs",
|
|
198
|
+
"./lib/View.d.cts",
|
|
199
|
+
"./lib/inheritProxifiedPrototype.js",
|
|
200
|
+
"./lib/inheritProxifiedPrototype.d.ts",
|
|
201
|
+
"./lib/inheritProxifiedPrototype.cjs",
|
|
202
|
+
"./lib/inheritProxifiedPrototype.d.cts",
|
|
203
|
+
"./lib/inheritProxifiedPrototypeProperty.js",
|
|
204
|
+
"./lib/inheritProxifiedPrototypeProperty.d.ts",
|
|
205
|
+
"./lib/inheritProxifiedPrototypeProperty.cjs",
|
|
206
|
+
"./lib/inheritProxifiedPrototypeProperty.d.cts",
|
|
207
|
+
"./lib/inspector/Inspector.js",
|
|
208
|
+
"./lib/inspector/Inspector.d.ts",
|
|
209
|
+
"./lib/inspector/Inspector.cjs",
|
|
210
|
+
"./lib/inspector/Inspector.d.cts",
|
|
211
|
+
"./lib/inspector/defaults/ignoreValuesDefaults.js",
|
|
212
|
+
"./lib/inspector/defaults/ignoreValuesDefaults.d.ts",
|
|
213
|
+
"./lib/inspector/defaults/ignoreValuesDefaults.cjs",
|
|
214
|
+
"./lib/inspector/defaults/ignoreValuesDefaults.d.cts",
|
|
215
|
+
"./lib/inspector/defaults/ignoreValuesFilterDefaults.js",
|
|
216
|
+
"./lib/inspector/defaults/ignoreValuesFilterDefaults.d.ts",
|
|
217
|
+
"./lib/inspector/defaults/ignoreValuesFilterDefaults.cjs",
|
|
218
|
+
"./lib/inspector/defaults/ignoreValuesFilterDefaults.d.cts",
|
|
219
|
+
"./lib/inspector/defaults/inspectDefaults.js",
|
|
220
|
+
"./lib/inspector/defaults/inspectDefaults.d.ts",
|
|
221
|
+
"./lib/inspector/defaults/inspectDefaults.cjs",
|
|
222
|
+
"./lib/inspector/defaults/inspectDefaults.d.cts",
|
|
223
|
+
"./lib/inspector/defaults/inspectorDefaults.js",
|
|
224
|
+
"./lib/inspector/defaults/inspectorDefaults.d.ts",
|
|
225
|
+
"./lib/inspector/defaults/inspectorDefaults.cjs",
|
|
226
|
+
"./lib/inspector/defaults/inspectorDefaults.d.cts",
|
|
227
|
+
"./lib/inspector/types.js",
|
|
228
|
+
"./lib/inspector/types.d.ts",
|
|
229
|
+
"./lib/inspector/types.cjs",
|
|
230
|
+
"./lib/inspector/types.d.cts",
|
|
231
|
+
"./lib/parenting/ParentRelationTypes.js",
|
|
232
|
+
"./lib/parenting/ParentRelationTypes.d.ts",
|
|
233
|
+
"./lib/parenting/ParentRelationTypes.cjs",
|
|
234
|
+
"./lib/parenting/ParentRelationTypes.d.cts",
|
|
235
|
+
"./lib/parenting/Parenting.js",
|
|
236
|
+
"./lib/parenting/Parenting.d.ts",
|
|
237
|
+
"./lib/parenting/Parenting.cjs",
|
|
238
|
+
"./lib/parenting/Parenting.d.cts",
|
|
239
|
+
"./lib/parenting/types.js",
|
|
240
|
+
"./lib/parenting/types.d.ts",
|
|
241
|
+
"./lib/parenting/types.cjs",
|
|
242
|
+
"./lib/parenting/types.d.cts"
|
|
243
|
+
],
|
|
32
244
|
"repository": {
|
|
33
245
|
"type": "git",
|
|
34
246
|
"url": "git+https://github.com/bemoje/mono.git",
|
|
35
247
|
"directory": "libs/composition"
|
|
36
|
-
}
|
|
248
|
+
},
|
|
249
|
+
"author": {
|
|
250
|
+
"name": "Benjamin Møller Jensen",
|
|
251
|
+
"email": "bemoje@bemoje.net",
|
|
252
|
+
"url": "https://github.com/bemoje/"
|
|
253
|
+
},
|
|
254
|
+
"license": "MIT"
|
|
37
255
|
}
|
package/index.d.ts
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import { Class } from 'type-fest';
|
|
2
|
-
import { InspectOptions, inspect } from 'node:util';
|
|
3
|
-
import { MultiSet, DefaultMap } from 'mnemonist';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Interface for a View that wraps a target object.
|
|
7
|
-
* View methods are redirected to the wrapped object which acts as
|
|
8
|
-
* a surrogate 'this'.
|
|
9
|
-
*
|
|
10
|
-
* To create a method that redirects to 'target', @see {@link defineProxifiedPrototypeProperty}
|
|
11
|
-
*/
|
|
12
|
-
interface IView<T extends object> {
|
|
13
|
-
readonly target: T;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
declare const TARGET_SYMBOL: unique symbol;
|
|
17
|
-
/**
|
|
18
|
-
* Base class providing view functionality over a target object using the Composition pattern.
|
|
19
|
-
*/
|
|
20
|
-
declare class View<Target extends object> implements IView<Target> {
|
|
21
|
-
private [TARGET_SYMBOL];
|
|
22
|
-
constructor(target: Target);
|
|
23
|
-
get [Symbol.toStringTag](): string;
|
|
24
|
-
get target(): Target;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Inherits prototype properties from a target class to a viewer class with proxification, excluding specified keys.
|
|
29
|
-
*/
|
|
30
|
-
declare function inheritProxifiedPrototype<Viewer extends IView<Target>, Target extends object, Omitted extends PropertyKey[] = []>(ViewerClass: Class<Viewer>, TargetClass: Class<Target>, omitKeys: Omitted): typeof ViewerClass & {
|
|
31
|
-
prototype: Viewer & Omit<Target, Omitted[number]>;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Inherits a single prototype property from a target class to a viewer class with proxification.
|
|
36
|
-
*/
|
|
37
|
-
declare function inheritProxifiedPrototypeProperty<Viewer extends IView<Target>, Target extends object>(ViewerClass: Class<Viewer>, TargetClass: Class<Target>, key: keyof Target): Pick<Viewer, keyof Viewer> | undefined;
|
|
38
|
-
|
|
39
|
-
interface InspectorOptions {
|
|
40
|
-
inspect?: InspectOptions;
|
|
41
|
-
ignoreValues?: IgnoreValuesOptions;
|
|
42
|
-
keys?: (string | symbol)[];
|
|
43
|
-
autoAddBooleanKeys?: boolean;
|
|
44
|
-
ignoreKeys?: (string | symbol)[];
|
|
45
|
-
filters?: InspectFilter[];
|
|
46
|
-
}
|
|
47
|
-
interface IgnoreValuesOptions {
|
|
48
|
-
noEmptyArray?: boolean;
|
|
49
|
-
noEmptyObject?: boolean;
|
|
50
|
-
noNull?: boolean;
|
|
51
|
-
noUndefined?: boolean;
|
|
52
|
-
noFalse?: boolean;
|
|
53
|
-
}
|
|
54
|
-
type IgnoreValueFilter = (value: unknown) => boolean;
|
|
55
|
-
type InspectFilter = <T extends InspectorTarget>(this: T, value: unknown, key: string | symbol, depth: number, object: T) => boolean;
|
|
56
|
-
type ClassInspectorMixin = typeof Function.prototype & {
|
|
57
|
-
inspector: InspectorOptions;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Interface that target objects must implement to be inspectable.
|
|
62
|
-
* Provides standard inspection methods for debugging and serialization.
|
|
63
|
-
*/
|
|
64
|
-
interface InspectorTarget {
|
|
65
|
-
[inspect.custom](depth: number, options: InspectOptions): string;
|
|
66
|
-
get inspector(): Inspector;
|
|
67
|
-
toJSON(): Partial<this>;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Inspector provides customizable object inspection and serialization using the Composition pattern.
|
|
71
|
-
* Composes target classes with inspection capabilities, allowing selective property display and custom formatting.
|
|
72
|
-
*/
|
|
73
|
-
declare class Inspector extends View<InspectorTarget> {
|
|
74
|
-
/**
|
|
75
|
-
* Composes a class with Inspector capabilities by adding inspection methods to its prototype.
|
|
76
|
-
* This follows the Composition pattern to extend classes without inheritance.
|
|
77
|
-
*/
|
|
78
|
-
static compose(cls: ClassInspectorMixin, options?: InspectorOptions): InspectorOptions;
|
|
79
|
-
/**
|
|
80
|
-
* Compile the target object and return the output as an object.
|
|
81
|
-
*/
|
|
82
|
-
toObject(depth?: number): Partial<InspectorTarget>;
|
|
83
|
-
/**
|
|
84
|
-
* Inspect the target object.
|
|
85
|
-
*/
|
|
86
|
-
inspect(depth?: number, options?: InspectOptions): string;
|
|
87
|
-
/**
|
|
88
|
-
* Compiles the output object and inspect options.
|
|
89
|
-
* Merges prototype chain options and applies filters to determine which properties to include.
|
|
90
|
-
*/
|
|
91
|
-
protected compile(depth?: number): {
|
|
92
|
-
output: Partial<InspectorTarget>;
|
|
93
|
-
inspectOptions: InspectOptions;
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* Walks the prototype chain and merges Inspector options from all classes.
|
|
97
|
-
* Subclass options override superclass options following inheritance semantics.
|
|
98
|
-
*/
|
|
99
|
-
protected mergePrototypeOptions(): Required<InspectorOptions>;
|
|
100
|
-
/**
|
|
101
|
-
* Returns a deep clone of the default Inspector options.
|
|
102
|
-
*/
|
|
103
|
-
protected getDefaults(): Required<InspectorOptions>;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Default options for ignoring specific values during object inspection.
|
|
108
|
-
*/
|
|
109
|
-
declare const ignoreValuesDefaults: IgnoreValuesOptions;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Default filter functions for ignoring values during object inspection.
|
|
113
|
-
*/
|
|
114
|
-
declare const ignoreValuesFilterDefaults: Record<keyof IgnoreValuesOptions, (value: unknown) => boolean>;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Default options for Node.js util.inspect with enhanced settings for better debugging output.
|
|
118
|
-
*/
|
|
119
|
-
declare const inspectDefaults: InspectOptions;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* The default inspector configuration options.
|
|
123
|
-
*/
|
|
124
|
-
declare const inspectorDefaults: Required<InspectorOptions>;
|
|
125
|
-
|
|
126
|
-
type FunctionPrototype = typeof Function.prototype;
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Class that handles the parent-child relationships between objects on their behalf.
|
|
130
|
-
*
|
|
131
|
-
* In order to avoid circular references, all children keep a weak reference to their parent. However,
|
|
132
|
-
* it is not guaranteed. Two objects could in principle mutually be both each other's parent and child
|
|
133
|
-
* at the same time which would allow circular references to exist.
|
|
134
|
-
*/
|
|
135
|
-
declare class Parenting<TP extends object | null = object | null> extends View<ParentingTarget<TP>> {
|
|
136
|
-
/**
|
|
137
|
-
* Class decorator to register and correctly initialize a class as a 'parentingTarget'.
|
|
138
|
-
*/
|
|
139
|
-
static compose(cls: ParentingTargetConstructor): void;
|
|
140
|
-
/**
|
|
141
|
-
* Store a weak refences to the target object's parent.
|
|
142
|
-
*/
|
|
143
|
-
onInstance(parent: TP | null): void;
|
|
144
|
-
/**
|
|
145
|
-
* Retrieve the parent object of 'target' object.
|
|
146
|
-
*/
|
|
147
|
-
getParent(): TP;
|
|
148
|
-
/**
|
|
149
|
-
* Recursively get parent until no parent is found or a circular reference is detected.
|
|
150
|
-
*/
|
|
151
|
-
iterateAncestors<T extends object | null = object | null>(): Generator<ParentingTarget<T>>;
|
|
152
|
-
/**
|
|
153
|
-
* The depth of the object in the parent-child hierarchy.
|
|
154
|
-
*/
|
|
155
|
-
get depth(): number;
|
|
156
|
-
/**
|
|
157
|
-
* The class constructor of the target object.
|
|
158
|
-
*/
|
|
159
|
-
get parentingTargetConstructor(): ParentingTargetConstructor;
|
|
160
|
-
/**
|
|
161
|
-
* A WeakMap for parent references.
|
|
162
|
-
*/
|
|
163
|
-
private static readonly parentWeakRefMap;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
interface ParentingTarget<P extends object | null = object | null> {
|
|
167
|
-
get parenting(): Parenting<P>;
|
|
168
|
-
}
|
|
169
|
-
type ParentingTargetConstructor<P extends object | null = object | null> = {
|
|
170
|
-
parenting?: ParentRelationTypes<P>;
|
|
171
|
-
} & typeof Function.prototype;
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Manages parent-child relationships between constructor types, tracking hierarchical connections and providing debugging capabilities.
|
|
175
|
-
*/
|
|
176
|
-
declare class ParentRelationTypes<P extends object | null = object | null> extends View<ParentingTargetConstructor<P>> {
|
|
177
|
-
registerParent(parentType: FunctionPrototype): void;
|
|
178
|
-
get hasParent(): boolean;
|
|
179
|
-
get getParentTypes(): MultiSet<FunctionPrototype>;
|
|
180
|
-
get hasChildren(): boolean;
|
|
181
|
-
get getChildTypes(): MultiSet<FunctionPrototype>;
|
|
182
|
-
get isRoot(): boolean;
|
|
183
|
-
get isLeaf(): boolean;
|
|
184
|
-
get isIsolated(): boolean;
|
|
185
|
-
static getAllChildTypesStats(): Record<string, Record<string, number>>;
|
|
186
|
-
static getAllParentTypesStats(): Record<string, Record<string, number>>;
|
|
187
|
-
static getAllStats(): any[];
|
|
188
|
-
static printAllStats(): void;
|
|
189
|
-
static childTypesStats: DefaultMap<Function, MultiSet<Function>>;
|
|
190
|
-
static parentTypesStats: DefaultMap<Function, MultiSet<Function>>;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
export { type ClassInspectorMixin, type IView, type IgnoreValueFilter, type IgnoreValuesOptions, type InspectFilter, Inspector, type InspectorOptions, type InspectorTarget, ParentRelationTypes, Parenting, type ParentingTarget, type ParentingTargetConstructor, View, ignoreValuesDefaults, ignoreValuesFilterDefaults, inheritProxifiedPrototype, inheritProxifiedPrototypeProperty, inspectDefaults, inspectorDefaults };
|