@travetto/registry
Advanced tools
Comparing version 4.0.2 to 4.0.3
{ | ||
"name": "@travetto/registry", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"description": "Patterns and utilities for handling registration of metadata and functionality for run-time use", | ||
@@ -30,7 +30,7 @@ "keywords": [ | ||
"dependencies": { | ||
"@travetto/base": "^4.0.1" | ||
"@travetto/base": "^4.0.2" | ||
}, | ||
"peerDependencies": { | ||
"@travetto/cli": "^4.0.2", | ||
"@travetto/transformer": "^4.0.1" | ||
"@travetto/cli": "^4.0.4", | ||
"@travetto/transformer": "^4.0.2" | ||
}, | ||
@@ -37,0 +37,0 @@ "peerDependenciesMeta": { |
import { EventEmitter } from 'node:events'; | ||
import { Class } from '@travetto/base'; | ||
import { Class, Env } from '@travetto/base'; | ||
import { ChangeSource, ChangeEvent, ChangeHandler } from './types'; | ||
@@ -36,2 +36,7 @@ | ||
/** | ||
* Are we in a mode that should have enhanced debug info | ||
*/ | ||
trace = Env.DEBUG.val?.includes('@travetto/registry'); | ||
/** | ||
* Creates a new registry, with it's parents specified | ||
@@ -60,3 +65,5 @@ */ | ||
this.#resolved = false; | ||
console.debug('Initializing', { id: this.constructor.Ⲑid, uid: this.#uid }); | ||
if (this.trace) { | ||
console.debug('Initializing', { id: this.constructor.Ⲑid, uid: this.#uid }); | ||
} | ||
@@ -105,3 +112,5 @@ // Handle top level when dealing with non-registry | ||
async init(): Promise<unknown> { | ||
console.debug('Trying to initialize', { id: this.constructor.Ⲑid, uid: this.#uid, initialized: !!this.#initialized }); | ||
if (this.trace) { | ||
console.debug('Trying to initialize', { id: this.constructor.Ⲑid, uid: this.#uid, initialized: !!this.#initialized }); | ||
} | ||
@@ -156,3 +165,5 @@ if (!this.#initialized) { | ||
onEvent(event: ChangeEvent<Class>): void { | ||
console.debug('Received', { id: this.constructor.Ⲑid, type: event.type, targetId: (event.curr ?? event.prev)!.Ⲑid }); | ||
if (this.trace) { | ||
console.debug('Received', { id: this.constructor.Ⲑid, type: event.type, targetId: (event.curr ?? event.prev)!.Ⲑid }); | ||
} | ||
@@ -159,0 +170,0 @@ switch (event.type) { |
@@ -160,3 +160,5 @@ import { Class } from '@travetto/base'; | ||
if (this.pending.has(cls.Ⲑid) || this.pendingFields.has(cls.Ⲑid)) { | ||
console.debug('Installing', { service: this.constructor.name, id: cls.Ⲑid }); | ||
if (this.trace) { | ||
console.debug('Installing', { service: this.constructor.name, id: cls.Ⲑid }); | ||
} | ||
const result = this.onInstallFinalize(cls); | ||
@@ -176,3 +178,5 @@ this.pendingFields.delete(cls.Ⲑid); | ||
if (this.entries.has(cls.Ⲑid)) { | ||
console.debug('Uninstalling', { service: this.constructor.name, id: cls.Ⲑid }); | ||
if (this.trace) { | ||
console.debug('Uninstalling', { service: this.constructor.name, id: cls.Ⲑid }); | ||
} | ||
this.expired.set(cls.Ⲑid, this.entries.get(cls.Ⲑid)!); | ||
@@ -179,0 +183,0 @@ this.entries.delete(cls.Ⲑid); |
@@ -32,2 +32,7 @@ import { EventEmitter } from 'node:events'; | ||
/** | ||
* Are we in a mode that should have enhanced debug info | ||
*/ | ||
trace = Env.DEBUG.val?.includes('@travetto/registry'); | ||
/** | ||
* Flush classes | ||
@@ -100,3 +105,5 @@ */ | ||
emit(e: ChangeEvent<Class>): void { | ||
console.debug('Emitting change', { type: e.type, curr: e.curr?.Ⲑid, prev: e.prev?.Ⲑid }); | ||
if (this.trace) { | ||
console.debug('Emitting change', { type: e.type, curr: e.curr?.Ⲑid, prev: e.prev?.Ⲑid }); | ||
} | ||
this.#emitter.emit('change', e); | ||
@@ -103,0 +110,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36243
893
Updated@travetto/base@^4.0.2