refactor: migrate all internal imports to package.json subpath aliases
- Add #domain, #protocol, #utils aliases to package.json imports map - Replace all relative imports (./, ../, ../..) in app/ and database/mongo_migrations/ with the corresponding #alias imports, eliminating relative path traversal across the codebase - Remove dead code: ConfigurationVersionModel.findByConfigurationIdentifier (unused, superseded by paginateVersions) and unused exception classes (NotFoundException, UnprocessableEntityException, DatabaseException) from app/exceptions/index.ts, keeping only BadRequestException - Fix pre-existing syntax error in configuration_version.ts (mismatched parenthesis) that broke tsc - Fix eqeqeq violation in configuration_service.ts and isNaN -> Number.isNaN in configuration_engine.ts / cwmp-1-0.ts / exchange_controller.ts - Fix no-shadow violation in cwmp-1-0.ts EventStruct constructor - Prettier formatting pass on touched files Validated: tsc --noEmit clean, eslint app/ clean, full test suite green.
This commit is contained in:
1 parent
4177f1adbd
commit
f9e56c78b1
74 files changed
+1243
-863
No files matched your search
+20
-10
@@ -31,16 +31,26 @@ export function normalizeEventCode(raw: string): string {
|
||||
|
||||
// Numeric-only → expand to standard label
|
||||
switch (trimmed) {
|
||||
case '0': return 'BOOTSTRAP'
|
||||
case '1': return 'BOOT'
|
||||
case '2': return 'PERIODIC'
|
||||
case '3': return 'SCHEDULED'
|
||||
case '4': return 'VALUE CHANGE'
|
||||
case '5': return 'KICKED'
|
||||
case '6': return 'CONNECTION REQUEST'
|
||||
case '7': return 'TRANSFER COMPLETE'
|
||||
case '8': return 'DIAGNOSTICS COMPLETE'
|
||||
default: return trimmed
|
||||
case '0':
|
||||
return 'BOOTSTRAP'
|
||||
case '1':
|
||||
return 'BOOT'
|
||||
case '2':
|
||||
return 'PERIODIC'
|
||||
case '3':
|
||||
return 'SCHEDULED'
|
||||
case '4':
|
||||
return 'VALUE CHANGE'
|
||||
case '5':
|
||||
return 'KICKED'
|
||||
case '6':
|
||||
return 'CONNECTION REQUEST'
|
||||
case '7':
|
||||
return 'TRANSFER COMPLETE'
|
||||
case '8':
|
||||
return 'DIAGNOSTICS COMPLETE'
|
||||
default:
|
||||
return trimmed
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { InventoryPath } from '../domain/configuration/configuration.js'
|
||||
import type { InventoryPath } from '#domain/configuration/configuration'
|
||||
|
||||
/**
|
||||
* Checks whether a desired parameter is covered by at least one inventory path.
|
||||
|
||||
@@ -11,17 +11,17 @@ export function computeNextPeriodicInform(
|
||||
): Date | null {
|
||||
if (!lastPeriodicInformAt) return null
|
||||
|
||||
const intervalSeconds = typeof periodicInformInterval === 'string'
|
||||
? parseInt(periodicInformInterval, 10)
|
||||
: periodicInformInterval
|
||||
const intervalSeconds =
|
||||
typeof periodicInformInterval === 'string'
|
||||
? Number.parseInt(periodicInformInterval, 10)
|
||||
: periodicInformInterval
|
||||
|
||||
if (!intervalSeconds || intervalSeconds <= 0) return null
|
||||
|
||||
const lastDate = lastPeriodicInformAt instanceof Date
|
||||
? lastPeriodicInformAt
|
||||
: new Date(lastPeriodicInformAt)
|
||||
const lastDate =
|
||||
lastPeriodicInformAt instanceof Date ? lastPeriodicInformAt : new Date(lastPeriodicInformAt)
|
||||
|
||||
if (isNaN(lastDate.getTime())) return null
|
||||
if (Number.isNaN(lastDate.getTime())) return null
|
||||
|
||||
return new Date(lastDate.getTime() + intervalSeconds * 1000)
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createHash } from 'node:crypto'
|
||||
import type { Configuration } from '../domain/configuration/configuration.js'
|
||||
import type { Configuration } from '#domain/configuration/configuration'
|
||||
|
||||
/**
|
||||
* Computes a 12-character hex content hash of a Configuration's desired state.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ScheduleWindow } from '../domain/configuration/configuration.js'
|
||||
import type { ScheduleWindow } from '#domain/configuration/configuration'
|
||||
|
||||
/**
|
||||
* Checks if the current time (or provided time) falls within the schedule window.
|
||||
@@ -41,10 +41,7 @@ export function isWithinSchedule(schedule: ScheduleWindow | undefined, now?: Dat
|
||||
/**
|
||||
* Gets the local hour and day-of-week for a given Date in a specific IANA timezone.
|
||||
*/
|
||||
function getLocalTimeParts(
|
||||
date: Date,
|
||||
timezone: string
|
||||
): { hour: number; dayOfWeek: number } {
|
||||
function getLocalTimeParts(date: Date, timezone: string): { hour: number; dayOfWeek: number } {
|
||||
const formatter = new Intl.DateTimeFormat('en-US', {
|
||||
timeZone: timezone,
|
||||
hour: 'numeric',
|
||||
|
||||
Reference in new issue
Block a user