@fjell/registry 4.4.79 → 4.4.81

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.
@@ -1 +1 @@
1
- {"version":3,"file":"Registry.d.ts","sourceRoot":"","sources":["../src/Registry.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,QAAQ,EACR,WAAW,EAEZ,MAAM,SAAS,CAAC;AAIjB,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAiCvF,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,cAAc,WAAW,KAAG,QAoNxE,CAAA"}
1
+ {"version":3,"file":"Registry.d.ts","sourceRoot":"","sources":["../src/Registry.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,QAAQ,EACR,WAAW,EAEZ,MAAM,SAAS,CAAC;AAIjB,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAqCvF,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,cAAc,WAAW,KAAG,QA0OxE,CAAA"}
package/dist/index.js CHANGED
@@ -207,7 +207,10 @@ var findScopedInstance = (scopedInstances, requestedScopes) => {
207
207
  );
208
208
  });
209
209
  if (!matchingInstance) {
210
- throw new Error(`No instance found matching scopes: ${requestedScopes.join(", ")}`);
210
+ const availableScopes = scopedInstances.map((si) => si.scopes?.join(", ") || "(no scopes)");
211
+ throw new Error(
212
+ `No instance found matching scopes: ${requestedScopes.join(", ")}. Available scopes: ${availableScopes.join(" | ")}`
213
+ );
211
214
  }
212
215
  return matchingInstance.instance;
213
216
  };
@@ -239,7 +242,17 @@ var createRegistry = (type, registryHub) => {
239
242
  registryHub
240
243
  });
241
244
  if (!isInstance(instance)) {
242
- throw new Error(`Factory did not return a valid instance for: ${kta.join(".")}`);
245
+ logger2.error("Factory returned invalid instance", {
246
+ component: "registry",
247
+ operation: "getOrCreateInstance",
248
+ type,
249
+ kta,
250
+ returnedType: typeof instance,
251
+ suggestion: "Ensure factory function returns a valid instance with operations property"
252
+ });
253
+ throw new Error(
254
+ `Factory did not return a valid instance for: ${kta.join(".")}. Expected instance with operations property, got: ${typeof instance}`
255
+ );
243
256
  }
244
257
  registerInternal(kta, instance, { scopes });
245
258
  return instance;
@@ -249,7 +262,17 @@ var createRegistry = (type, registryHub) => {
249
262
  let currentLevel = instanceTree;
250
263
  logger2.debug(`Registering instance for key path and scopes`, keyPath, options?.scopes, `in registry type: ${type}`);
251
264
  if (!isInstance(instance)) {
252
- throw new Error(`Attempting to register a non-instance: ${kta.join(".")}`);
265
+ logger2.error("Attempting to register invalid instance", {
266
+ component: "registry",
267
+ operation: "registerInstance",
268
+ type,
269
+ kta,
270
+ providedType: typeof instance,
271
+ suggestion: "Ensure you are registering a valid instance with operations property, not a factory or other object"
272
+ });
273
+ throw new Error(
274
+ `Attempting to register a non-instance: ${kta.join(".")}. Expected instance with operations property, got: ${typeof instance}`
275
+ );
253
276
  }
254
277
  for (let i = 0; i < keyPath.length; i++) {
255
278
  const keyType = keyPath[i];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fjell/registry",
3
3
  "description": "Dependency injection and service location system for the Fjell ecosystem",
4
- "version": "4.4.79",
4
+ "version": "4.4.81",
5
5
  "keywords": [
6
6
  "registry",
7
7
  "dependency-injection",
@@ -39,13 +39,13 @@
39
39
  "docs:test": "cd docs && npm run test"
40
40
  },
41
41
  "dependencies": {
42
- "@fjell/core": "^4.4.70",
43
- "@fjell/logging": "^4.4.62"
42
+ "@fjell/core": "^4.4.73",
43
+ "@fjell/logging": "^4.4.65"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@eslint/eslintrc": "^3.3.1",
47
47
  "@eslint/js": "^9.39.1",
48
- "@fjell/common-config": "^1.1.31",
48
+ "@fjell/common-config": "^1.1.36",
49
49
  "@swc/core": "^1.15.2",
50
50
  "@tsconfig/recommended": "^1.0.13",
51
51
  "@types/node": "^24.10.1",