@fjell/registry 4.4.5 → 4.4.7
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 +546 -0
- package/dist/Coordinate.cjs +8 -5
- package/dist/Coordinate.d.ts +1 -1
- package/dist/Coordinate.js +8 -5
- package/dist/Instance.cjs +1 -1
- package/dist/Instance.d.ts +1 -1
- package/dist/Instance.js +1 -1
- package/dist/Registry.cjs +99 -90
- package/dist/Registry.d.ts +3 -42
- package/dist/Registry.js +99 -90
- package/dist/RegistryHub.cjs +78 -0
- package/dist/RegistryHub.d.ts +3 -0
- package/dist/RegistryHub.js +74 -0
- package/dist/errors/CoordinateError.cjs +70 -0
- package/dist/errors/CoordinateError.d.ts +28 -0
- package/dist/errors/CoordinateError.js +63 -0
- package/dist/errors/InstanceError.cjs +101 -0
- package/dist/errors/InstanceError.d.ts +42 -0
- package/dist/errors/InstanceError.js +92 -0
- package/dist/errors/RegistryError.cjs +82 -0
- package/dist/errors/RegistryError.d.ts +31 -0
- package/dist/errors/RegistryError.js +75 -0
- package/dist/errors/RegistryHubError.cjs +92 -0
- package/dist/errors/RegistryHubError.d.ts +39 -0
- package/dist/errors/RegistryHubError.js +84 -0
- package/dist/errors/index.d.ts +4 -0
- package/dist/index.cjs +501 -101
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -1
- package/dist/types.d.ts +90 -0
- package/docs/TIMING_NODE_OPTIMIZATION.md +207 -0
- package/docs/TIMING_README.md +170 -0
- package/docs/memory-data/scaling-10-instances.json +526 -0
- package/docs/memory-data/scaling-100-instances.json +526 -0
- package/docs/memory-data/scaling-1000-instances.json +276 -0
- package/docs/memory-data/scaling-10000-instances.json +126 -0
- package/docs/memory-data/scaling-20-instances.json +526 -0
- package/docs/memory-data/scaling-200-instances.json +526 -0
- package/docs/memory-data/scaling-2000-instances.json +276 -0
- package/docs/memory-data/scaling-50-instances.json +526 -0
- package/docs/memory-data/scaling-500-instances.json +276 -0
- package/docs/memory-data/scaling-5000-instances.json +126 -0
- package/docs/memory-overhead.svg +120 -0
- package/docs/memory.md +430 -0
- package/docs/timing-range.svg +174 -0
- package/docs/timing.md +483 -0
- package/examples/README.md +187 -0
- package/examples/multi-level-keys.ts +374 -0
- package/examples/registry-hub-types.ts +437 -0
- package/examples/simple-example.ts +250 -0
- package/package.json +6 -4
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const RegistryError = require('./RegistryError.cjs');
|
|
6
|
+
|
|
7
|
+
function _define_property(obj, key, value) {
|
|
8
|
+
if (key in obj) {
|
|
9
|
+
Object.defineProperty(obj, key, {
|
|
10
|
+
value: value,
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true
|
|
14
|
+
});
|
|
15
|
+
} else {
|
|
16
|
+
obj[key] = value;
|
|
17
|
+
}
|
|
18
|
+
return obj;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Base class for coordinate-related errors
|
|
22
|
+
*/ class CoordinateError extends RegistryError.RegistryError {
|
|
23
|
+
constructor(message, kta, scopes, context){
|
|
24
|
+
super(message, '', {
|
|
25
|
+
...context,
|
|
26
|
+
kta,
|
|
27
|
+
scopes
|
|
28
|
+
}), _define_property(this, "kta", void 0), _define_property(this, "scopes", void 0);
|
|
29
|
+
this.kta = kta;
|
|
30
|
+
this.scopes = scopes;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Thrown when coordinate creation fails due to invalid parameters
|
|
35
|
+
*/ class InvalidCoordinateError extends CoordinateError {
|
|
36
|
+
constructor(kta, scopes, reason, context){
|
|
37
|
+
super(`Invalid coordinate parameters: ${reason}. ` + `KTA: ${JSON.stringify(kta)}, Scopes: [${scopes.join(', ')}]`, kta, scopes, {
|
|
38
|
+
...context,
|
|
39
|
+
reason
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Thrown when KTA (Key Type Array) is invalid
|
|
45
|
+
*/ class InvalidKTAError extends CoordinateError {
|
|
46
|
+
constructor(kta, reason, context){
|
|
47
|
+
super(`Invalid KTA (Key Type Array): ${reason}. ` + `Expected string or array of strings, got: ${JSON.stringify(kta)}`, kta, [], {
|
|
48
|
+
...context,
|
|
49
|
+
reason
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Thrown when scopes array contains invalid values
|
|
55
|
+
*/ class InvalidScopesError extends CoordinateError {
|
|
56
|
+
constructor(scopes, invalidScopes, reason, context){
|
|
57
|
+
super(`Invalid scopes: ${reason}. ` + `Invalid scope values: ${JSON.stringify(invalidScopes)}`, null, scopes.filter((s)=>typeof s === 'string'), {
|
|
58
|
+
...context,
|
|
59
|
+
reason,
|
|
60
|
+
invalidScopes
|
|
61
|
+
}), _define_property(this, "invalidScopes", void 0);
|
|
62
|
+
this.invalidScopes = invalidScopes;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
exports.CoordinateError = CoordinateError;
|
|
67
|
+
exports.InvalidCoordinateError = InvalidCoordinateError;
|
|
68
|
+
exports.InvalidKTAError = InvalidKTAError;
|
|
69
|
+
exports.InvalidScopesError = InvalidScopesError;
|
|
70
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29vcmRpbmF0ZUVycm9yLmNqcyIsInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W10sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7In0=
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { RegistryError } from './RegistryError';
|
|
2
|
+
/**
|
|
3
|
+
* Base class for coordinate-related errors
|
|
4
|
+
*/
|
|
5
|
+
export declare abstract class CoordinateError extends RegistryError {
|
|
6
|
+
readonly kta?: any;
|
|
7
|
+
readonly scopes?: string[];
|
|
8
|
+
constructor(message: string, kta?: any, scopes?: string[], context?: Record<string, any>);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Thrown when coordinate creation fails due to invalid parameters
|
|
12
|
+
*/
|
|
13
|
+
export declare class InvalidCoordinateError extends CoordinateError {
|
|
14
|
+
constructor(kta: any, scopes: string[], reason: string, context?: Record<string, any>);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Thrown when KTA (Key Type Array) is invalid
|
|
18
|
+
*/
|
|
19
|
+
export declare class InvalidKTAError extends CoordinateError {
|
|
20
|
+
constructor(kta: any, reason: string, context?: Record<string, any>);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Thrown when scopes array contains invalid values
|
|
24
|
+
*/
|
|
25
|
+
export declare class InvalidScopesError extends CoordinateError {
|
|
26
|
+
readonly invalidScopes: any[];
|
|
27
|
+
constructor(scopes: any[], invalidScopes: any[], reason: string, context?: Record<string, any>);
|
|
28
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { RegistryError } from './RegistryError.js';
|
|
2
|
+
|
|
3
|
+
function _define_property(obj, key, value) {
|
|
4
|
+
if (key in obj) {
|
|
5
|
+
Object.defineProperty(obj, key, {
|
|
6
|
+
value: value,
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true
|
|
10
|
+
});
|
|
11
|
+
} else {
|
|
12
|
+
obj[key] = value;
|
|
13
|
+
}
|
|
14
|
+
return obj;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Base class for coordinate-related errors
|
|
18
|
+
*/ class CoordinateError extends RegistryError {
|
|
19
|
+
constructor(message, kta, scopes, context){
|
|
20
|
+
super(message, '', {
|
|
21
|
+
...context,
|
|
22
|
+
kta,
|
|
23
|
+
scopes
|
|
24
|
+
}), _define_property(this, "kta", void 0), _define_property(this, "scopes", void 0);
|
|
25
|
+
this.kta = kta;
|
|
26
|
+
this.scopes = scopes;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Thrown when coordinate creation fails due to invalid parameters
|
|
31
|
+
*/ class InvalidCoordinateError extends CoordinateError {
|
|
32
|
+
constructor(kta, scopes, reason, context){
|
|
33
|
+
super(`Invalid coordinate parameters: ${reason}. ` + `KTA: ${JSON.stringify(kta)}, Scopes: [${scopes.join(', ')}]`, kta, scopes, {
|
|
34
|
+
...context,
|
|
35
|
+
reason
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Thrown when KTA (Key Type Array) is invalid
|
|
41
|
+
*/ class InvalidKTAError extends CoordinateError {
|
|
42
|
+
constructor(kta, reason, context){
|
|
43
|
+
super(`Invalid KTA (Key Type Array): ${reason}. ` + `Expected string or array of strings, got: ${JSON.stringify(kta)}`, kta, [], {
|
|
44
|
+
...context,
|
|
45
|
+
reason
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Thrown when scopes array contains invalid values
|
|
51
|
+
*/ class InvalidScopesError extends CoordinateError {
|
|
52
|
+
constructor(scopes, invalidScopes, reason, context){
|
|
53
|
+
super(`Invalid scopes: ${reason}. ` + `Invalid scope values: ${JSON.stringify(invalidScopes)}`, null, scopes.filter((s)=>typeof s === 'string'), {
|
|
54
|
+
...context,
|
|
55
|
+
reason,
|
|
56
|
+
invalidScopes
|
|
57
|
+
}), _define_property(this, "invalidScopes", void 0);
|
|
58
|
+
this.invalidScopes = invalidScopes;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { CoordinateError, InvalidCoordinateError, InvalidKTAError, InvalidScopesError };
|
|
63
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29vcmRpbmF0ZUVycm9yLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const RegistryError = require('./RegistryError.cjs');
|
|
6
|
+
|
|
7
|
+
function _define_property(obj, key, value) {
|
|
8
|
+
if (key in obj) {
|
|
9
|
+
Object.defineProperty(obj, key, {
|
|
10
|
+
value: value,
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true
|
|
14
|
+
});
|
|
15
|
+
} else {
|
|
16
|
+
obj[key] = value;
|
|
17
|
+
}
|
|
18
|
+
return obj;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Base class for instance-related errors
|
|
22
|
+
*/ class InstanceError extends RegistryError.RegistryError {
|
|
23
|
+
constructor(message, keyPath, registryType, context){
|
|
24
|
+
super(message, registryType, {
|
|
25
|
+
...context,
|
|
26
|
+
keyPath
|
|
27
|
+
}), _define_property(this, "keyPath", void 0);
|
|
28
|
+
this.keyPath = keyPath;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Thrown when an instance cannot be found for a given key path
|
|
33
|
+
*/ class InstanceNotFoundError extends InstanceError {
|
|
34
|
+
constructor(keyPath, missingKey, registryType, context){
|
|
35
|
+
const keyPathStr = keyPath.join('.');
|
|
36
|
+
let message = `Instance not found for key path: ${keyPathStr}`;
|
|
37
|
+
if (missingKey) {
|
|
38
|
+
message += `, Missing key: ${missingKey}`;
|
|
39
|
+
}
|
|
40
|
+
super(message, keyPath, registryType, {
|
|
41
|
+
...context,
|
|
42
|
+
missingKey
|
|
43
|
+
}), _define_property(this, "missingKey", void 0);
|
|
44
|
+
this.missingKey = missingKey;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Thrown when no instances are registered for a key path that exists in the tree
|
|
49
|
+
*/ class NoInstancesRegisteredError extends InstanceError {
|
|
50
|
+
constructor(keyPath, registryType, context){
|
|
51
|
+
const keyPathStr = keyPath.join('.');
|
|
52
|
+
super(`No instances registered for key path: ${keyPathStr}. ` + `The key path exists in the registry tree but contains no instances.`, keyPath, registryType, context);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Thrown when no instances are available (empty instances array)
|
|
57
|
+
*/ class NoInstancesAvailableError extends InstanceError {
|
|
58
|
+
constructor(keyPath, registryType, context){
|
|
59
|
+
const keyPathStr = keyPath.join('.');
|
|
60
|
+
super(`No instances available for key path: ${keyPathStr}. ` + `This typically indicates an internal registry state issue.`, keyPath, registryType, context);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Thrown when no instance matches the requested scopes
|
|
65
|
+
*/ class ScopeNotFoundError extends InstanceError {
|
|
66
|
+
constructor(keyPath, requestedScopes, availableScopes = [], registryType){
|
|
67
|
+
const keyPathStr = keyPath.join('.');
|
|
68
|
+
const scopesStr = requestedScopes.join(', ');
|
|
69
|
+
const availableScopesStr = availableScopes.map((scopes)=>`[${scopes.join(', ')}]`).join(', ');
|
|
70
|
+
let message = `No instance found matching scopes: ${scopesStr} for key path: ${keyPathStr}`;
|
|
71
|
+
if (availableScopes.length > 0) {
|
|
72
|
+
message += `. Available scopes: ${availableScopesStr}`;
|
|
73
|
+
}
|
|
74
|
+
super(message, keyPath, registryType, {
|
|
75
|
+
requestedScopes,
|
|
76
|
+
availableScopes
|
|
77
|
+
}), _define_property(this, "requestedScopes", void 0), _define_property(this, "availableScopes", void 0);
|
|
78
|
+
this.requestedScopes = requestedScopes;
|
|
79
|
+
this.availableScopes = availableScopes;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Thrown when a key path has no children but children are expected
|
|
84
|
+
*/ class NoChildrenAvailableError extends InstanceError {
|
|
85
|
+
constructor(keyPath, parentKey, registryType, context){
|
|
86
|
+
const keyPathStr = keyPath.join('.');
|
|
87
|
+
super(`Instance not found for key path: ${keyPathStr}, No children for: ${parentKey}. ` + `The path cannot be traversed further as '${parentKey}' has no child nodes.`, keyPath, registryType, {
|
|
88
|
+
...context,
|
|
89
|
+
parentKey
|
|
90
|
+
}), _define_property(this, "parentKey", void 0);
|
|
91
|
+
this.parentKey = parentKey;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
exports.InstanceError = InstanceError;
|
|
96
|
+
exports.InstanceNotFoundError = InstanceNotFoundError;
|
|
97
|
+
exports.NoChildrenAvailableError = NoChildrenAvailableError;
|
|
98
|
+
exports.NoInstancesAvailableError = NoInstancesAvailableError;
|
|
99
|
+
exports.NoInstancesRegisteredError = NoInstancesRegisteredError;
|
|
100
|
+
exports.ScopeNotFoundError = ScopeNotFoundError;
|
|
101
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSW5zdGFuY2VFcnJvci5janMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsifQ==
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { RegistryError } from './RegistryError';
|
|
2
|
+
/**
|
|
3
|
+
* Base class for instance-related errors
|
|
4
|
+
*/
|
|
5
|
+
export declare abstract class InstanceError extends RegistryError {
|
|
6
|
+
readonly keyPath: string[];
|
|
7
|
+
constructor(message: string, keyPath: string[], registryType?: string, context?: Record<string, any>);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Thrown when an instance cannot be found for a given key path
|
|
11
|
+
*/
|
|
12
|
+
export declare class InstanceNotFoundError extends InstanceError {
|
|
13
|
+
readonly missingKey?: string;
|
|
14
|
+
constructor(keyPath: string[], missingKey?: string, registryType?: string, context?: Record<string, any>);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Thrown when no instances are registered for a key path that exists in the tree
|
|
18
|
+
*/
|
|
19
|
+
export declare class NoInstancesRegisteredError extends InstanceError {
|
|
20
|
+
constructor(keyPath: string[], registryType?: string, context?: Record<string, any>);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Thrown when no instances are available (empty instances array)
|
|
24
|
+
*/
|
|
25
|
+
export declare class NoInstancesAvailableError extends InstanceError {
|
|
26
|
+
constructor(keyPath: string[], registryType?: string, context?: Record<string, any>);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Thrown when no instance matches the requested scopes
|
|
30
|
+
*/
|
|
31
|
+
export declare class ScopeNotFoundError extends InstanceError {
|
|
32
|
+
readonly requestedScopes: string[];
|
|
33
|
+
readonly availableScopes: string[][];
|
|
34
|
+
constructor(keyPath: string[], requestedScopes: string[], availableScopes?: string[][], registryType?: string);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Thrown when a key path has no children but children are expected
|
|
38
|
+
*/
|
|
39
|
+
export declare class NoChildrenAvailableError extends InstanceError {
|
|
40
|
+
readonly parentKey: string;
|
|
41
|
+
constructor(keyPath: string[], parentKey: string, registryType?: string, context?: Record<string, any>);
|
|
42
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { RegistryError } from './RegistryError.js';
|
|
2
|
+
|
|
3
|
+
function _define_property(obj, key, value) {
|
|
4
|
+
if (key in obj) {
|
|
5
|
+
Object.defineProperty(obj, key, {
|
|
6
|
+
value: value,
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true
|
|
10
|
+
});
|
|
11
|
+
} else {
|
|
12
|
+
obj[key] = value;
|
|
13
|
+
}
|
|
14
|
+
return obj;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Base class for instance-related errors
|
|
18
|
+
*/ class InstanceError extends RegistryError {
|
|
19
|
+
constructor(message, keyPath, registryType, context){
|
|
20
|
+
super(message, registryType, {
|
|
21
|
+
...context,
|
|
22
|
+
keyPath
|
|
23
|
+
}), _define_property(this, "keyPath", void 0);
|
|
24
|
+
this.keyPath = keyPath;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Thrown when an instance cannot be found for a given key path
|
|
29
|
+
*/ class InstanceNotFoundError extends InstanceError {
|
|
30
|
+
constructor(keyPath, missingKey, registryType, context){
|
|
31
|
+
const keyPathStr = keyPath.join('.');
|
|
32
|
+
let message = `Instance not found for key path: ${keyPathStr}`;
|
|
33
|
+
if (missingKey) {
|
|
34
|
+
message += `, Missing key: ${missingKey}`;
|
|
35
|
+
}
|
|
36
|
+
super(message, keyPath, registryType, {
|
|
37
|
+
...context,
|
|
38
|
+
missingKey
|
|
39
|
+
}), _define_property(this, "missingKey", void 0);
|
|
40
|
+
this.missingKey = missingKey;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Thrown when no instances are registered for a key path that exists in the tree
|
|
45
|
+
*/ class NoInstancesRegisteredError extends InstanceError {
|
|
46
|
+
constructor(keyPath, registryType, context){
|
|
47
|
+
const keyPathStr = keyPath.join('.');
|
|
48
|
+
super(`No instances registered for key path: ${keyPathStr}. ` + `The key path exists in the registry tree but contains no instances.`, keyPath, registryType, context);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Thrown when no instances are available (empty instances array)
|
|
53
|
+
*/ class NoInstancesAvailableError extends InstanceError {
|
|
54
|
+
constructor(keyPath, registryType, context){
|
|
55
|
+
const keyPathStr = keyPath.join('.');
|
|
56
|
+
super(`No instances available for key path: ${keyPathStr}. ` + `This typically indicates an internal registry state issue.`, keyPath, registryType, context);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Thrown when no instance matches the requested scopes
|
|
61
|
+
*/ class ScopeNotFoundError extends InstanceError {
|
|
62
|
+
constructor(keyPath, requestedScopes, availableScopes = [], registryType){
|
|
63
|
+
const keyPathStr = keyPath.join('.');
|
|
64
|
+
const scopesStr = requestedScopes.join(', ');
|
|
65
|
+
const availableScopesStr = availableScopes.map((scopes)=>`[${scopes.join(', ')}]`).join(', ');
|
|
66
|
+
let message = `No instance found matching scopes: ${scopesStr} for key path: ${keyPathStr}`;
|
|
67
|
+
if (availableScopes.length > 0) {
|
|
68
|
+
message += `. Available scopes: ${availableScopesStr}`;
|
|
69
|
+
}
|
|
70
|
+
super(message, keyPath, registryType, {
|
|
71
|
+
requestedScopes,
|
|
72
|
+
availableScopes
|
|
73
|
+
}), _define_property(this, "requestedScopes", void 0), _define_property(this, "availableScopes", void 0);
|
|
74
|
+
this.requestedScopes = requestedScopes;
|
|
75
|
+
this.availableScopes = availableScopes;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Thrown when a key path has no children but children are expected
|
|
80
|
+
*/ class NoChildrenAvailableError extends InstanceError {
|
|
81
|
+
constructor(keyPath, parentKey, registryType, context){
|
|
82
|
+
const keyPathStr = keyPath.join('.');
|
|
83
|
+
super(`Instance not found for key path: ${keyPathStr}, No children for: ${parentKey}. ` + `The path cannot be traversed further as '${parentKey}' has no child nodes.`, keyPath, registryType, {
|
|
84
|
+
...context,
|
|
85
|
+
parentKey
|
|
86
|
+
}), _define_property(this, "parentKey", void 0);
|
|
87
|
+
this.parentKey = parentKey;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export { InstanceError, InstanceNotFoundError, NoChildrenAvailableError, NoInstancesAvailableError, NoInstancesRegisteredError, ScopeNotFoundError };
|
|
92
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSW5zdGFuY2VFcnJvci5qcyIsInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W10sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Base class for all registry-related errors
|
|
7
|
+
*/ function _define_property(obj, key, value) {
|
|
8
|
+
if (key in obj) {
|
|
9
|
+
Object.defineProperty(obj, key, {
|
|
10
|
+
value: value,
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true
|
|
14
|
+
});
|
|
15
|
+
} else {
|
|
16
|
+
obj[key] = value;
|
|
17
|
+
}
|
|
18
|
+
return obj;
|
|
19
|
+
}
|
|
20
|
+
class RegistryError extends Error {
|
|
21
|
+
getDetails() {
|
|
22
|
+
const details = [
|
|
23
|
+
this.message
|
|
24
|
+
];
|
|
25
|
+
if (this.registryType) {
|
|
26
|
+
details.push(`Registry Type: ${this.registryType}`);
|
|
27
|
+
}
|
|
28
|
+
if (this.context) {
|
|
29
|
+
details.push(`Context: ${JSON.stringify(this.context, null, 2)}`);
|
|
30
|
+
}
|
|
31
|
+
return details.join('\n');
|
|
32
|
+
}
|
|
33
|
+
constructor(message, registryType, context){
|
|
34
|
+
super(message), _define_property(this, "registryType", void 0), _define_property(this, "context", void 0);
|
|
35
|
+
this.name = this.constructor.name;
|
|
36
|
+
this.registryType = registryType;
|
|
37
|
+
this.context = context;
|
|
38
|
+
// Maintains proper stack trace for where our error was thrown
|
|
39
|
+
if (Error.captureStackTrace) {
|
|
40
|
+
Error.captureStackTrace(this, this.constructor);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Thrown when attempting to create a registry with invalid parameters
|
|
46
|
+
*/ class RegistryCreationError extends RegistryError {
|
|
47
|
+
constructor(type, reason, context){
|
|
48
|
+
super(`Failed to create registry of type '${type}': ${reason}`, type, context);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Thrown when a factory function returns an invalid instance
|
|
53
|
+
*/ class InvalidFactoryResultError extends RegistryError {
|
|
54
|
+
constructor(keyPath, factoryResult, registryType){
|
|
55
|
+
const keyPathStr = keyPath.join('.');
|
|
56
|
+
super(`Factory did not return a valid instance for: ${keyPathStr}. ` + `Expected instance with 'coordinate' and 'registry' properties, got: ${typeof factoryResult}`, registryType, {
|
|
57
|
+
keyPath,
|
|
58
|
+
factoryResult: typeof factoryResult
|
|
59
|
+
}), _define_property(this, "keyPath", void 0), _define_property(this, "factoryResult", void 0);
|
|
60
|
+
this.keyPath = keyPath;
|
|
61
|
+
this.factoryResult = factoryResult;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Thrown when attempting to register a non-instance object
|
|
66
|
+
*/ class InvalidInstanceRegistrationError extends RegistryError {
|
|
67
|
+
constructor(keyPath, attemptedRegistration, registryType){
|
|
68
|
+
const keyPathStr = keyPath.join('.');
|
|
69
|
+
super(`Attempting to register a non-instance: ${keyPathStr}. ` + `Expected instance with 'coordinate' and 'registry' properties, got: ${typeof attemptedRegistration}`, registryType, {
|
|
70
|
+
keyPath,
|
|
71
|
+
attemptedRegistration: typeof attemptedRegistration
|
|
72
|
+
}), _define_property(this, "keyPath", void 0), _define_property(this, "attemptedRegistration", void 0);
|
|
73
|
+
this.keyPath = keyPath;
|
|
74
|
+
this.attemptedRegistration = attemptedRegistration;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
exports.InvalidFactoryResultError = InvalidFactoryResultError;
|
|
79
|
+
exports.InvalidInstanceRegistrationError = InvalidInstanceRegistrationError;
|
|
80
|
+
exports.RegistryCreationError = RegistryCreationError;
|
|
81
|
+
exports.RegistryError = RegistryError;
|
|
82
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUmVnaXN0cnlFcnJvci5janMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for all registry-related errors
|
|
3
|
+
*/
|
|
4
|
+
export declare abstract class RegistryError extends Error {
|
|
5
|
+
readonly registryType?: string;
|
|
6
|
+
readonly context?: Record<string, any>;
|
|
7
|
+
constructor(message: string, registryType?: string, context?: Record<string, any>);
|
|
8
|
+
getDetails(): string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Thrown when attempting to create a registry with invalid parameters
|
|
12
|
+
*/
|
|
13
|
+
export declare class RegistryCreationError extends RegistryError {
|
|
14
|
+
constructor(type: string, reason: string, context?: Record<string, any>);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Thrown when a factory function returns an invalid instance
|
|
18
|
+
*/
|
|
19
|
+
export declare class InvalidFactoryResultError extends RegistryError {
|
|
20
|
+
readonly keyPath: string[];
|
|
21
|
+
readonly factoryResult: any;
|
|
22
|
+
constructor(keyPath: string[], factoryResult: any, registryType?: string);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Thrown when attempting to register a non-instance object
|
|
26
|
+
*/
|
|
27
|
+
export declare class InvalidInstanceRegistrationError extends RegistryError {
|
|
28
|
+
readonly keyPath: string[];
|
|
29
|
+
readonly attemptedRegistration: any;
|
|
30
|
+
constructor(keyPath: string[], attemptedRegistration: any, registryType?: string);
|
|
31
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for all registry-related errors
|
|
3
|
+
*/ function _define_property(obj, key, value) {
|
|
4
|
+
if (key in obj) {
|
|
5
|
+
Object.defineProperty(obj, key, {
|
|
6
|
+
value: value,
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true
|
|
10
|
+
});
|
|
11
|
+
} else {
|
|
12
|
+
obj[key] = value;
|
|
13
|
+
}
|
|
14
|
+
return obj;
|
|
15
|
+
}
|
|
16
|
+
class RegistryError extends Error {
|
|
17
|
+
getDetails() {
|
|
18
|
+
const details = [
|
|
19
|
+
this.message
|
|
20
|
+
];
|
|
21
|
+
if (this.registryType) {
|
|
22
|
+
details.push(`Registry Type: ${this.registryType}`);
|
|
23
|
+
}
|
|
24
|
+
if (this.context) {
|
|
25
|
+
details.push(`Context: ${JSON.stringify(this.context, null, 2)}`);
|
|
26
|
+
}
|
|
27
|
+
return details.join('\n');
|
|
28
|
+
}
|
|
29
|
+
constructor(message, registryType, context){
|
|
30
|
+
super(message), _define_property(this, "registryType", void 0), _define_property(this, "context", void 0);
|
|
31
|
+
this.name = this.constructor.name;
|
|
32
|
+
this.registryType = registryType;
|
|
33
|
+
this.context = context;
|
|
34
|
+
// Maintains proper stack trace for where our error was thrown
|
|
35
|
+
if (Error.captureStackTrace) {
|
|
36
|
+
Error.captureStackTrace(this, this.constructor);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Thrown when attempting to create a registry with invalid parameters
|
|
42
|
+
*/ class RegistryCreationError extends RegistryError {
|
|
43
|
+
constructor(type, reason, context){
|
|
44
|
+
super(`Failed to create registry of type '${type}': ${reason}`, type, context);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Thrown when a factory function returns an invalid instance
|
|
49
|
+
*/ class InvalidFactoryResultError extends RegistryError {
|
|
50
|
+
constructor(keyPath, factoryResult, registryType){
|
|
51
|
+
const keyPathStr = keyPath.join('.');
|
|
52
|
+
super(`Factory did not return a valid instance for: ${keyPathStr}. ` + `Expected instance with 'coordinate' and 'registry' properties, got: ${typeof factoryResult}`, registryType, {
|
|
53
|
+
keyPath,
|
|
54
|
+
factoryResult: typeof factoryResult
|
|
55
|
+
}), _define_property(this, "keyPath", void 0), _define_property(this, "factoryResult", void 0);
|
|
56
|
+
this.keyPath = keyPath;
|
|
57
|
+
this.factoryResult = factoryResult;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Thrown when attempting to register a non-instance object
|
|
62
|
+
*/ class InvalidInstanceRegistrationError extends RegistryError {
|
|
63
|
+
constructor(keyPath, attemptedRegistration, registryType){
|
|
64
|
+
const keyPathStr = keyPath.join('.');
|
|
65
|
+
super(`Attempting to register a non-instance: ${keyPathStr}. ` + `Expected instance with 'coordinate' and 'registry' properties, got: ${typeof attemptedRegistration}`, registryType, {
|
|
66
|
+
keyPath,
|
|
67
|
+
attemptedRegistration: typeof attemptedRegistration
|
|
68
|
+
}), _define_property(this, "keyPath", void 0), _define_property(this, "attemptedRegistration", void 0);
|
|
69
|
+
this.keyPath = keyPath;
|
|
70
|
+
this.attemptedRegistration = attemptedRegistration;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { InvalidFactoryResultError, InvalidInstanceRegistrationError, RegistryCreationError, RegistryError };
|
|
75
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUmVnaXN0cnlFcnJvci5qcyIsInNvdXJjZXMiOltdLCJzb3VyY2VzQ29udGVudCI6W10sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsifQ==
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const RegistryError = require('./RegistryError.cjs');
|
|
6
|
+
|
|
7
|
+
function _define_property(obj, key, value) {
|
|
8
|
+
if (key in obj) {
|
|
9
|
+
Object.defineProperty(obj, key, {
|
|
10
|
+
value: value,
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true
|
|
14
|
+
});
|
|
15
|
+
} else {
|
|
16
|
+
obj[key] = value;
|
|
17
|
+
}
|
|
18
|
+
return obj;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Base class for registry hub-related errors
|
|
22
|
+
*/ class RegistryHubError extends RegistryError.RegistryError {
|
|
23
|
+
constructor(message, hubType, context){
|
|
24
|
+
const enrichedContext = hubType ? {
|
|
25
|
+
...context,
|
|
26
|
+
hubType
|
|
27
|
+
} : context;
|
|
28
|
+
super(message, '', enrichedContext), _define_property(this, "hubType", void 0);
|
|
29
|
+
this.hubType = hubType;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Thrown when attempting to register a registry with a type that already exists
|
|
34
|
+
*/ class DuplicateRegistryTypeError extends RegistryHubError {
|
|
35
|
+
constructor(type, context){
|
|
36
|
+
super(`Registry already registered under type: ${type}. ` + `Each registry type must be unique within a registry hub.`, '', {
|
|
37
|
+
...context,
|
|
38
|
+
duplicateType: type
|
|
39
|
+
}), _define_property(this, "duplicateType", void 0);
|
|
40
|
+
this.duplicateType = type;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Thrown when attempting to access a registry type that doesn't exist
|
|
45
|
+
*/ class RegistryTypeNotFoundError extends RegistryHubError {
|
|
46
|
+
constructor(requestedType, availableTypes = [], context){
|
|
47
|
+
let message = `No registry registered under type: ${requestedType}`;
|
|
48
|
+
if (availableTypes.length > 0) {
|
|
49
|
+
message += `. Available types: [${availableTypes.join(', ')}]`;
|
|
50
|
+
}
|
|
51
|
+
super(message, '', {
|
|
52
|
+
...context,
|
|
53
|
+
requestedType,
|
|
54
|
+
availableTypes
|
|
55
|
+
}), _define_property(this, "requestedType", void 0), _define_property(this, "availableTypes", void 0);
|
|
56
|
+
this.requestedType = requestedType;
|
|
57
|
+
this.availableTypes = availableTypes;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Thrown when a registry factory function fails to create a valid registry
|
|
62
|
+
*/ class RegistryFactoryError extends RegistryHubError {
|
|
63
|
+
constructor(type, factoryError, context){
|
|
64
|
+
super(`Registry factory failed to create registry of type '${type}': ${factoryError.message}`, '', {
|
|
65
|
+
...context,
|
|
66
|
+
attemptedType: type,
|
|
67
|
+
originalError: factoryError.message
|
|
68
|
+
}), _define_property(this, "factoryError", void 0), _define_property(this, "attemptedType", void 0);
|
|
69
|
+
this.factoryError = factoryError;
|
|
70
|
+
this.attemptedType = type;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Thrown when a factory returns an invalid registry object
|
|
75
|
+
*/ class InvalidRegistryFactoryResultError extends RegistryHubError {
|
|
76
|
+
constructor(type, factoryResult, context){
|
|
77
|
+
super(`Registry factory returned invalid registry for type '${type}'. ` + `Expected registry with 'type', 'get', 'register', and 'createInstance' properties, ` + `got: ${typeof factoryResult}`, '', {
|
|
78
|
+
...context,
|
|
79
|
+
attemptedType: type,
|
|
80
|
+
factoryResult: typeof factoryResult
|
|
81
|
+
}), _define_property(this, "factoryResult", void 0), _define_property(this, "attemptedType", void 0);
|
|
82
|
+
this.factoryResult = factoryResult;
|
|
83
|
+
this.attemptedType = type;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
exports.DuplicateRegistryTypeError = DuplicateRegistryTypeError;
|
|
88
|
+
exports.InvalidRegistryFactoryResultError = InvalidRegistryFactoryResultError;
|
|
89
|
+
exports.RegistryFactoryError = RegistryFactoryError;
|
|
90
|
+
exports.RegistryHubError = RegistryHubError;
|
|
91
|
+
exports.RegistryTypeNotFoundError = RegistryTypeNotFoundError;
|
|
92
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUmVnaXN0cnlIdWJFcnJvci5janMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OzsifQ==
|