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:
Kevin L'Hereec committed 2026-07-22 11:45:14 +02:00
1 parent 4177f1adbd
commit f9e56c78b1
74 files changed
+1243 -863

No files matched your search

+3 -3
View File
@@ -21,20 +21,20 @@ import {
SetParameterValues,
TransferCompleteResponse,
Upload,
} from '../cwmp-1-0.js'
} from '#protocol/cwmp-1-0'
import {
CwmpID,
NAMESPACES,
SoapEnvelope,
type SoapEnvelopeAttribute,
SoapEnvelopeHeader,
} from '../soap_envelope.js'
} from '#protocol/soap_envelope'
import type {
DownloadTaskPayload,
UploadTaskPayload,
SetParameterValuesTaskPayload,
SetParameterAttributesTaskPayload,
} from '../tr069_types.js'
} from '#protocol/tr069_types'
function generateCwmpID(): string {
return randomBytes(4).toString('hex')
+412 -306
View File
File diff suppressed because it is too large. Load diff
+50 -40
View File
@@ -1,9 +1,9 @@
// @ts-nocheck — fichier copié de cwmp-connector (papaye)
import { Cwmp_1_0, FaultCodeType } from './cwmp-1-0.js'
import { Cwmp_1_0, FaultCodeType } from '#protocol/cwmp-1-0'
/**
* CWMP Version 1.1 Protocol Classes
*
*
* This version extends CWMP 1.0 with additional features:
* - Additional fault codes (9014-9019)
* - New event code: "10 AUTONOMOUS TRANSFER COMPLETE"
@@ -12,17 +12,25 @@ import { Cwmp_1_0, FaultCodeType } from './cwmp-1-0.js'
*/
export class Cwmp_1_1 extends Cwmp_1_0 {
public '@class' = '.Cwmp_1_1'
public GetAllQueuedTransfers?: GetAllQueuedTransfers
public GetAllQueuedTransfersResponse?: GetAllQueuedTransfersResponse
public AutonomousTransferComplete?: AutonomousTransferComplete
public AutonomousTransferCompleteResponse?: AutonomousTransferCompleteResponse
public 'GetAllQueuedTransfers'?: GetAllQueuedTransfers
public 'GetAllQueuedTransfersResponse'?: GetAllQueuedTransfersResponse
public 'AutonomousTransferComplete'?: AutonomousTransferComplete
public 'AutonomousTransferCompleteResponse'?: AutonomousTransferCompleteResponse
constructor(props: any = {}) {
'constructor'(props: any = {}) {
super(props)
this.GetAllQueuedTransfers = props.GetAllQueuedTransfers ? new GetAllQueuedTransfers(props.GetAllQueuedTransfers) : undefined
this.GetAllQueuedTransfersResponse = props.GetAllQueuedTransfersResponse ? new GetAllQueuedTransfersResponse(props.GetAllQueuedTransfersResponse) : undefined
this.AutonomousTransferComplete = props.AutonomousTransferComplete ? new AutonomousTransferComplete(props.AutonomousTransferComplete) : undefined
this.AutonomousTransferCompleteResponse = props.AutonomousTransferCompleteResponse ? new AutonomousTransferCompleteResponse(props.AutonomousTransferCompleteResponse) : undefined
this.GetAllQueuedTransfers = props.GetAllQueuedTransfers
? new GetAllQueuedTransfers(props.GetAllQueuedTransfers)
: undefined
this.GetAllQueuedTransfersResponse = props.GetAllQueuedTransfersResponse
? new GetAllQueuedTransfersResponse(props.GetAllQueuedTransfersResponse)
: undefined
this.AutonomousTransferComplete = props.AutonomousTransferComplete
? new AutonomousTransferComplete(props.AutonomousTransferComplete)
: undefined
this.AutonomousTransferCompleteResponse = props.AutonomousTransferCompleteResponse
? new AutonomousTransferCompleteResponse(props.AutonomousTransferCompleteResponse)
: undefined
}
}
@@ -100,14 +108,14 @@ export enum EventCode_1_1 {
export class AllQueuedTransferStruct {
public '@class' = '.AllQueuedTransferStruct'
public CommandKey: string
public State: number
public IsDownload: boolean
public FileType: string
public FileSize: number
public TargetFileName: string
public 'CommandKey': string
public 'State': number
public 'IsDownload': boolean
public 'FileType': string
public 'FileSize': number
public 'TargetFileName': string
constructor(props: any = {}) {
'constructor'(props: any = {}) {
this.CommandKey = props.CommandKey || ''
this.State = props.State || 1
this.IsDownload = props.IsDownload || false
@@ -119,32 +127,34 @@ export class AllQueuedTransferStruct {
export class AllTransferList {
public '@class' = '.AllTransferList'
public AllQueuedTransferStruct: AllQueuedTransferStruct[] = []
public 'AllQueuedTransferStruct': AllQueuedTransferStruct[] = []
constructor(props: any = {}) {
this.AllQueuedTransferStruct = (props.AllQueuedTransferStruct || []).map((item: any) => new AllQueuedTransferStruct(item))
'constructor'(props: any = {}) {
this.AllQueuedTransferStruct = (props.AllQueuedTransferStruct || []).map(
(item: any) => new AllQueuedTransferStruct(item)
)
}
}
export class GetAllQueuedTransfers {
public '@class' = '.GetAllQueuedTransfers'
constructor(props: any = {}) {}
'constructor'(props: any = {}) {}
getXml() {
'getXml'() {
return `<cwmp:GetAllQueuedTransfers></cwmp:GetAllQueuedTransfers>`
}
}
export class GetAllQueuedTransfersResponse {
public '@class' = '.GetAllQueuedTransfersResponse'
public TransferList?: AllTransferList
public 'TransferList'?: AllTransferList
constructor(props: any = {}) {
'constructor'(props: any = {}) {
this.TransferList = props.TransferList ? new AllTransferList(props.TransferList) : undefined
}
getXml() {
'getXml'() {
const items = this.TransferList?.AllQueuedTransferStruct || []
const listXml = items
.map(
@@ -170,17 +180,17 @@ export class GetAllQueuedTransfersResponse {
export class AutonomousTransferComplete {
public '@class' = '.AutonomousTransferComplete'
public AnnounceURL: string
public TransferURL: string
public IsDownload: boolean
public FileType: string
public FileSize: number
public TargetFileName: string
public FaultStruct: any // Reusing FaultStruct from base
public StartTime: Date
public CompleteTime: Date
public 'AnnounceURL': string
public 'TransferURL': string
public 'IsDownload': boolean
public 'FileType': string
public 'FileSize': number
public 'TargetFileName': string
public 'FaultStruct': any // Reusing FaultStruct from base
public 'StartTime': Date
public 'CompleteTime': Date
constructor(props: any = {}) {
'constructor'(props: any = {}) {
this.AnnounceURL = props.AnnounceURL || ''
this.TransferURL = props.TransferURL || ''
this.IsDownload = props.IsDownload || false
@@ -192,7 +202,7 @@ export class AutonomousTransferComplete {
this.CompleteTime = props.CompleteTime ? new Date(props.CompleteTime) : new Date()
}
getXml() {
'getXml'() {
const fault = this.FaultStruct
? `<FaultStruct><FaultCode>${this.FaultStruct.FaultCode ?? 0}</FaultCode><FaultString>${this.FaultStruct.FaultString || ''}</FaultString></FaultStruct>`
: ''
@@ -213,9 +223,9 @@ export class AutonomousTransferComplete {
export class AutonomousTransferCompleteResponse {
public '@class' = '.AutonomousTransferCompleteResponse'
constructor(props: any = {}) {}
'constructor'(props: any = {}) {}
getXml() {
'getXml'() {
return '<cwmp:AutonomousTransferCompleteResponse/>'
}
}
}
+157 -131
View File
@@ -1,6 +1,9 @@
// @ts-nocheck — fichier copié de cwmp-connector (papaye)
import { Cwmp_1_0, FaultStruct } from './cwmp-1-0.js'
import { Cwmp_1_1, AutonomousTransferComplete as AutonomousTransferComplete_1_1 } from './cwmp-1-1.js'
import { Cwmp_1_0, FaultStruct } from '#protocol/cwmp-1-0'
import {
Cwmp_1_1,
AutonomousTransferComplete as AutonomousTransferComplete_1_1,
} from '#protocol/cwmp-1-1'
/**
* CWMP Version 1.2 Protocol Classes
@@ -17,35 +20,55 @@ export class Cwmp_1_2 extends Cwmp_1_1 {
public '@class' = '.Cwmp_1_2'
// New RPCs
public ScheduleDownload?: ScheduleDownload
public ScheduleDownloadResponse?: ScheduleDownloadResponse
public CancelTransfer?: CancelTransfer
public CancelTransferResponse?: CancelTransferResponse
public ChangeDUState?: ChangeDUState
public ChangeDUStateResponse?: ChangeDUStateResponse
public DUStateChangeComplete?: DUStateChangeComplete
public DUStateChangeCompleteResponse?: DUStateChangeCompleteResponse
public AutonomousDUStateChangeComplete?: AutonomousDUStateChangeComplete
public AutonomousDUStateChangeCompleteResponse?: AutonomousDUStateChangeCompleteResponse
public 'ScheduleDownload'?: ScheduleDownload
public 'ScheduleDownloadResponse'?: ScheduleDownloadResponse
public 'CancelTransfer'?: CancelTransfer
public 'CancelTransferResponse'?: CancelTransferResponse
public 'ChangeDUState'?: ChangeDUState
public 'ChangeDUStateResponse'?: ChangeDUStateResponse
public 'DUStateChangeComplete'?: DUStateChangeComplete
public 'DUStateChangeCompleteResponse'?: DUStateChangeCompleteResponse
public 'AutonomousDUStateChangeComplete'?: AutonomousDUStateChangeComplete
public 'AutonomousDUStateChangeCompleteResponse'?: AutonomousDUStateChangeCompleteResponse
// Override AutonomousTransferComplete to use TransferCompleteFaultStruct
public AutonomousTransferComplete?: AutonomousTransferComplete
public 'AutonomousTransferComplete'?: AutonomousTransferComplete
constructor(props: any = {}) {
'constructor'(props: any = {}) {
super(props)
this.ScheduleDownload = props.ScheduleDownload ? new ScheduleDownload(props.ScheduleDownload) : undefined
this.ScheduleDownloadResponse = props.ScheduleDownloadResponse ? new ScheduleDownloadResponse(props.ScheduleDownloadResponse) : undefined
this.CancelTransfer = props.CancelTransfer ? new CancelTransfer(props.CancelTransfer) : undefined
this.CancelTransferResponse = props.CancelTransferResponse ? new CancelTransferResponse(props.CancelTransferResponse) : undefined
this.ScheduleDownload = props.ScheduleDownload
? new ScheduleDownload(props.ScheduleDownload)
: undefined
this.ScheduleDownloadResponse = props.ScheduleDownloadResponse
? new ScheduleDownloadResponse(props.ScheduleDownloadResponse)
: undefined
this.CancelTransfer = props.CancelTransfer
? new CancelTransfer(props.CancelTransfer)
: undefined
this.CancelTransferResponse = props.CancelTransferResponse
? new CancelTransferResponse(props.CancelTransferResponse)
: undefined
this.ChangeDUState = props.ChangeDUState ? new ChangeDUState(props.ChangeDUState) : undefined
this.ChangeDUStateResponse = props.ChangeDUStateResponse ? new ChangeDUStateResponse(props.ChangeDUStateResponse) : undefined
this.DUStateChangeComplete = props.DUStateChangeComplete ? new DUStateChangeComplete(props.DUStateChangeComplete) : undefined
this.DUStateChangeCompleteResponse = props.DUStateChangeCompleteResponse ? new DUStateChangeCompleteResponse(props.DUStateChangeCompleteResponse) : undefined
this.AutonomousDUStateChangeComplete = props.AutonomousDUStateChangeComplete ? new AutonomousDUStateChangeComplete(props.AutonomousDUStateChangeComplete) : undefined
this.AutonomousDUStateChangeCompleteResponse = props.AutonomousDUStateChangeCompleteResponse ? new AutonomousDUStateChangeCompleteResponse(props.AutonomousDUStateChangeCompleteResponse) : undefined
this.ChangeDUStateResponse = props.ChangeDUStateResponse
? new ChangeDUStateResponse(props.ChangeDUStateResponse)
: undefined
this.DUStateChangeComplete = props.DUStateChangeComplete
? new DUStateChangeComplete(props.DUStateChangeComplete)
: undefined
this.DUStateChangeCompleteResponse = props.DUStateChangeCompleteResponse
? new DUStateChangeCompleteResponse(props.DUStateChangeCompleteResponse)
: undefined
this.AutonomousDUStateChangeComplete = props.AutonomousDUStateChangeComplete
? new AutonomousDUStateChangeComplete(props.AutonomousDUStateChangeComplete)
: undefined
this.AutonomousDUStateChangeCompleteResponse = props.AutonomousDUStateChangeCompleteResponse
? new AutonomousDUStateChangeCompleteResponse(props.AutonomousDUStateChangeCompleteResponse)
: undefined
// Override from 1.1 when provided
this.AutonomousTransferComplete = props.AutonomousTransferComplete ? new AutonomousTransferComplete(props.AutonomousTransferComplete) : this.AutonomousTransferComplete
this.AutonomousTransferComplete = props.AutonomousTransferComplete
? new AutonomousTransferComplete(props.AutonomousTransferComplete)
: this.AutonomousTransferComplete
}
}
@@ -77,13 +100,13 @@ export enum EventCode_1_2 {
// Time window types used by ScheduleDownload
export class TimeWindowStruct {
public '@class' = '.TimeWindowStruct'
public WindowStart: number
public WindowEnd: number
public WindowMode: string
public UserMessage: string
public MaxRetries: number
public 'WindowStart': number
public 'WindowEnd': number
public 'WindowMode': string
public 'UserMessage': string
public 'MaxRetries': number
constructor(props: any = {}) {
'constructor'(props: any = {}) {
this.WindowStart = props.WindowStart ?? 0
this.WindowEnd = props.WindowEnd ?? 0
this.WindowMode = props.WindowMode ?? ''
@@ -94,26 +117,28 @@ export class TimeWindowStruct {
export class TimeWindowList {
public '@class' = '.TimeWindowList'
public TimeWindowStruct: TimeWindowStruct[] = []
public 'TimeWindowStruct': TimeWindowStruct[] = []
constructor(props: any = {}) {
this.TimeWindowStruct = (props.TimeWindowStruct || []).map((tw: any) => new TimeWindowStruct(tw))
'constructor'(props: any = {}) {
this.TimeWindowStruct = (props.TimeWindowStruct || []).map(
(tw: any) => new TimeWindowStruct(tw)
)
}
}
// ScheduleDownload RPC
export class ScheduleDownload {
public '@class' = '.ScheduleDownload'
public CommandKey: string
public FileType: string
public URL: string
public Username?: string
public Password?: string
public FileSize?: number
public TargetFileName?: string
public TimeWindowList: TimeWindowList
public 'CommandKey': string
public 'FileType': string
public 'URL': string
public 'Username'?: string
public 'Password'?: string
public 'FileSize'?: number
public 'TargetFileName'?: string
public 'TimeWindowList': TimeWindowList
constructor(props: any = {}) {
'constructor'(props: any = {}) {
this.CommandKey = props.CommandKey || ''
this.FileType = props.FileType || ''
this.URL = props.URL || ''
@@ -124,7 +149,7 @@ export class ScheduleDownload {
this.TimeWindowList = new TimeWindowList(props.TimeWindowList || {})
}
getXml() {
'getXml'() {
const tw = this.TimeWindowList?.TimeWindowStruct || []
const twXml = tw
.map(
@@ -156,9 +181,9 @@ export class ScheduleDownload {
export class ScheduleDownloadResponse {
public '@class' = '.ScheduleDownloadResponse'
constructor(props: any = {}) {}
'constructor'(props: any = {}) {}
getXml() {
'getXml'() {
return `<cwmp:ScheduleDownloadResponse/>`
}
}
@@ -166,12 +191,12 @@ export class ScheduleDownloadResponse {
// CancelTransfer RPC
export class CancelTransfer {
public '@class' = '.CancelTransfer'
public CommandKey: string
constructor(props: any = {}) {
public 'CommandKey': string
'constructor'(props: any = {}) {
this.CommandKey = props.CommandKey || ''
}
getXml() {
'getXml'() {
return `<cwmp:CancelTransfer>
<CommandKey>${this.CommandKey}</CommandKey>
</cwmp:CancelTransfer>`
@@ -180,9 +205,9 @@ export class CancelTransfer {
export class CancelTransferResponse {
public '@class' = '.CancelTransferResponse'
constructor(props: any = {}) {}
'constructor'(props: any = {}) {}
getXml() {
'getXml'() {
return `<cwmp:CancelTransferResponse/>`
}
}
@@ -190,19 +215,20 @@ export class CancelTransferResponse {
// Software Module Management types
export type DeploymentUnitState = 'Installed' | 'Uninstalled' | 'Failed'
export class OperationStruct { // abstract base
export class OperationStruct {
// abstract base
public '@class' = '.OperationStruct'
}
export class InstallOpStruct extends OperationStruct {
public '@class' = '.InstallOpStruct'
public URL: string
public UUID?: string
public Username?: string
public Password?: string
public ExecutionEnvRef?: string
public 'URL': string
public 'UUID'?: string
public 'Username'?: string
public 'Password'?: string
public 'ExecutionEnvRef'?: string
constructor(props: any = {}) {
'constructor'(props: any = {}) {
super()
this.URL = props.URL || ''
this.UUID = props.UUID
@@ -214,13 +240,13 @@ export class InstallOpStruct extends OperationStruct {
export class UpdateOpStruct extends OperationStruct {
public '@class' = '.UpdateOpStruct'
public UUID?: string
public Version?: string
public URL?: string
public Username?: string
public Password?: string
public 'UUID'?: string
public 'Version'?: string
public 'URL'?: string
public 'Username'?: string
public 'Password'?: string
constructor(props: any = {}) {
'constructor'(props: any = {}) {
super()
this.UUID = props.UUID
this.Version = props.Version
@@ -232,11 +258,11 @@ export class UpdateOpStruct extends OperationStruct {
export class UninstallOpStruct extends OperationStruct {
public '@class' = '.UninstallOpStruct'
public UUID: string
public Version?: string
public ExecutionEnvRef?: string
public 'UUID': string
public 'Version'?: string
public 'ExecutionEnvRef'?: string
constructor(props: any = {}) {
'constructor'(props: any = {}) {
super()
this.UUID = props.UUID || ''
this.Version = props.Version
@@ -246,10 +272,10 @@ export class UninstallOpStruct extends OperationStruct {
export class DeploymentUnitFaultStruct {
public '@class' = '.DeploymentUnitFaultStruct'
public FaultCode: number
public FaultString?: string
public 'FaultCode': number
public 'FaultString'?: string
constructor(props: any = {}) {
'constructor'(props: any = {}) {
this.FaultCode = props.FaultCode ?? 0
this.FaultString = props.FaultString
}
@@ -257,17 +283,17 @@ export class DeploymentUnitFaultStruct {
export class OpResultStruct {
public '@class' = '.OpResultStruct'
public UUID: string
public DeploymentUnitRef: string
public Version: string
public CurrentState: DeploymentUnitState
public Resolved: boolean
public ExecutionUnitRefList: string
public StartTime: Date
public CompleteTime: Date
public Fault: DeploymentUnitFaultStruct
public 'UUID': string
public 'DeploymentUnitRef': string
public 'Version': string
public 'CurrentState': DeploymentUnitState
public 'Resolved': boolean
public 'ExecutionUnitRefList': string
public 'StartTime': Date
public 'CompleteTime': Date
public 'Fault': DeploymentUnitFaultStruct
constructor(props: any = {}) {
'constructor'(props: any = {}) {
this.UUID = props.UUID || ''
this.DeploymentUnitRef = props.DeploymentUnitRef || ''
this.Version = props.Version || ''
@@ -282,9 +308,9 @@ export class OpResultStruct {
export class AutonOpResultStruct extends OpResultStruct {
public '@class' = '.AutonOpResultStruct'
public OperationPerformed: string
public 'OperationPerformed': string
constructor(props: any = {}) {
'constructor'(props: any = {}) {
super(props)
this.OperationPerformed = props.OperationPerformed || ''
}
@@ -293,51 +319,55 @@ export class AutonOpResultStruct extends OpResultStruct {
// ChangeDUState RPC
export class ChangeDUState {
public '@class' = '.ChangeDUState'
public Operations: OperationStruct[] = []
public CommandKey?: string
public 'Operations': OperationStruct[] = []
public 'CommandKey'?: string
constructor(props: any = {}) {
'constructor'(props: any = {}) {
this.Operations = (props.Operations || []).map((op: any) => {
const type = op?.['@class'] || op?.type
if (type === 'InstallOpStruct' || op?.URL) return new InstallOpStruct(op)
if (type === 'UpdateOpStruct' || op?.Version || (op?.UUID && !op?.ExecutionEnvRef)) return new UpdateOpStruct(op)
if (type === 'UninstallOpStruct' || op?.ExecutionEnvRef || (op?.UUID && !op?.URL && !op?.Version)) return new UninstallOpStruct(op)
if (type === 'UpdateOpStruct' || op?.Version || (op?.UUID && !op?.ExecutionEnvRef))
return new UpdateOpStruct(op)
if (
type === 'UninstallOpStruct' ||
op?.ExecutionEnvRef ||
(op?.UUID && !op?.URL && !op?.Version)
)
return new UninstallOpStruct(op)
return new OperationStruct()
})
this.CommandKey = props.CommandKey
}
getXml() {
const opsXml = this.Operations
.map((op) => {
if (op instanceof InstallOpStruct) {
return `<Operations xsi:type="cwmp:InstallOpStruct">
'getXml'() {
const opsXml = this.Operations.map((op) => {
if (op instanceof InstallOpStruct) {
return `<Operations xsi:type="cwmp:InstallOpStruct">
<URL>${op.URL}</URL>
${op.UUID ? `<UUID>${op.UUID}</UUID>` : ''}
${op.Username ? `<Username>${op.Username}</Username>` : ''}
${op.Password ? `<Password>${op.Password}</Password>` : ''}
${op.ExecutionEnvRef ? `<ExecutionEnvRef>${op.ExecutionEnvRef}</ExecutionEnvRef>` : ''}
</Operations>`
}
if (op instanceof UpdateOpStruct) {
return `<Operations xsi:type="cwmp:UpdateOpStruct">
}
if (op instanceof UpdateOpStruct) {
return `<Operations xsi:type="cwmp:UpdateOpStruct">
${op.UUID ? `<UUID>${op.UUID}</UUID>` : ''}
${op.Version ? `<Version>${op.Version}</Version>` : ''}
${op.URL ? `<URL>${op.URL}</URL>` : ''}
${op.Username ? `<Username>${op.Username}</Username>` : ''}
${op.Password ? `<Password>${op.Password}</Password>` : ''}
</Operations>`
}
if (op instanceof UninstallOpStruct) {
return `<Operations xsi:type="cwmp:UninstallOpStruct">
}
if (op instanceof UninstallOpStruct) {
return `<Operations xsi:type="cwmp:UninstallOpStruct">
<UUID>${op.UUID}</UUID>
${op.Version ? `<Version>${op.Version}</Version>` : ''}
${op.ExecutionEnvRef ? `<ExecutionEnvRef>${op.ExecutionEnvRef}</ExecutionEnvRef>` : ''}
</Operations>`
}
return ''
})
.join('')
}
return ''
}).join('')
return `<cwmp:ChangeDUState>
${opsXml}
@@ -348,9 +378,9 @@ export class ChangeDUState {
export class ChangeDUStateResponse {
public '@class' = '.ChangeDUStateResponse'
constructor(props: any = {}) {}
'constructor'(props: any = {}) {}
getXml() {
'getXml'() {
return `<cwmp:ChangeDUStateResponse/>`
}
}
@@ -358,18 +388,17 @@ export class ChangeDUStateResponse {
// DUStateChangeComplete RPCs
export class DUStateChangeComplete {
public '@class' = '.DUStateChangeComplete'
public Results: OpResultStruct[]
public CommandKey?: string
public 'Results': OpResultStruct[]
public 'CommandKey'?: string
constructor(props: any = {}) {
'constructor'(props: any = {}) {
this.Results = (props.Results || []).map((r: any) => new OpResultStruct(r))
this.CommandKey = props.CommandKey
}
getXml() {
const resultsXml = this.Results
.map(
(r) => `
'getXml'() {
const resultsXml = this.Results.map(
(r) => `
<Results>
<UUID>${r.UUID}</UUID>
<DeploymentUnitRef>${r.DeploymentUnitRef}</DeploymentUnitRef>
@@ -384,8 +413,7 @@ export class DUStateChangeComplete {
${r.Fault.FaultString ? `<FaultString>${r.Fault.FaultString}</FaultString>` : ''}
</Fault>
</Results>`
)
.join('')
).join('')
return `<cwmp:DUStateChangeComplete>
${resultsXml}
@@ -396,25 +424,24 @@ export class DUStateChangeComplete {
export class DUStateChangeCompleteResponse {
public '@class' = '.DUStateChangeCompleteResponse'
constructor(props: any = {}) {}
'constructor'(props: any = {}) {}
getXml() {
'getXml'() {
return `<cwmp:DUStateChangeCompleteResponse/>`
}
}
export class AutonomousDUStateChangeComplete {
public '@class' = '.AutonomousDUStateChangeComplete'
public Results: AutonOpResultStruct[]
public 'Results': AutonOpResultStruct[]
constructor(props: any = {}) {
'constructor'(props: any = {}) {
this.Results = (props.Results || []).map((r: any) => new AutonOpResultStruct(r))
}
getXml() {
const resultsXml = this.Results
.map(
(r) => `
'getXml'() {
const resultsXml = this.Results.map(
(r) => `
<Results>
<UUID>${r.UUID}</UUID>
<DeploymentUnitRef>${r.DeploymentUnitRef}</DeploymentUnitRef>
@@ -430,8 +457,7 @@ export class AutonomousDUStateChangeComplete {
</Fault>
<OperationPerformed>${r.OperationPerformed}</OperationPerformed>
</Results>`
)
.join('')
).join('')
return `<cwmp:AutonomousDUStateChangeComplete>
${resultsXml}
@@ -441,9 +467,9 @@ export class AutonomousDUStateChangeComplete {
export class AutonomousDUStateChangeCompleteResponse {
public '@class' = '.AutonomousDUStateChangeCompleteResponse'
constructor(props: any = {}) {}
'constructor'(props: any = {}) {}
getXml() {
'getXml'() {
return `<cwmp:AutonomousDUStateChangeCompleteResponse/>`
}
}
@@ -451,10 +477,10 @@ export class AutonomousDUStateChangeCompleteResponse {
// TransferComplete-specific fault struct for 1.2
export class TransferCompleteFaultStruct {
public '@class' = '.TransferCompleteFaultStruct'
public FaultCode: number
public FaultString: string
public 'FaultCode': number
public 'FaultString': string
constructor(props: any = {}) {
'constructor'(props: any = {}) {
this.FaultCode = props.FaultCode ?? 0
this.FaultString = props.FaultString || ''
}
@@ -463,14 +489,14 @@ export class TransferCompleteFaultStruct {
// Override of 1.1 AutonomousTransferComplete to use TransferCompleteFaultStruct
export class AutonomousTransferComplete extends AutonomousTransferComplete_1_1 {
public '@class' = '.AutonomousTransferComplete'
public FaultStruct: TransferCompleteFaultStruct
public 'FaultStruct': TransferCompleteFaultStruct
constructor(props: any = {}) {
'constructor'(props: any = {}) {
super(props)
this.FaultStruct = new TransferCompleteFaultStruct(props.FaultStruct || {})
}
getXml() {
'getXml'() {
return `<cwmp:AutonomousTransferComplete>
<AnnounceURL>${this.AnnounceURL}</AnnounceURL>
<TransferURL>${this.TransferURL}</TransferURL>
+9 -7
View File
@@ -1,5 +1,5 @@
// @ts-nocheck — fichier copié de cwmp-connector (papaye)
import { Cwmp_1_2 } from './cwmp-1-2.js'
import { Cwmp_1_2 } from '#protocol/cwmp-1-2'
/**
* CWMP Version 1.3 Protocol Classes
@@ -9,21 +9,23 @@ import { Cwmp_1_2 } from './cwmp-1-2.js'
*/
export class Cwmp_1_3 extends Cwmp_1_2 {
public '@class' = '.Cwmp_1_3'
public SessionTimeout?: SessionTimeout
public 'SessionTimeout'?: SessionTimeout
constructor(props: any = {}) {
'constructor'(props: any = {}) {
super(props)
this.SessionTimeout = props.SessionTimeout ? new SessionTimeout(props.SessionTimeout) : undefined
this.SessionTimeout = props.SessionTimeout
? new SessionTimeout(props.SessionTimeout)
: undefined
}
}
// SOAP Header element for CWMP 1.3
export class SessionTimeout {
public '@class' = '.SessionTimeout'
public MustUnderstand: string = '0'
public _: number
public 'MustUnderstand': string = '0'
public '_': number
constructor(props: any = {}) {
'constructor'(props: any = {}) {
this.MustUnderstand = props.MustUnderstand ?? '0'
this._ = props._ ?? 0
}
+16 -12
View File
@@ -1,5 +1,5 @@
// @ts-nocheck — fichier copié de cwmp-connector (papaye)
import { Cwmp_1_3 } from './cwmp-1-3.js'
import { Cwmp_1_3 } from '#protocol/cwmp-1-3'
/**
* CWMP Version 1.4 Protocol Classes
@@ -11,13 +11,17 @@ import { Cwmp_1_3 } from './cwmp-1-3.js'
*/
export class Cwmp_1_4 extends Cwmp_1_3 {
public '@class' = '.Cwmp_1_4'
public SupportedCWMPVersions?: SupportedCWMPVersions
public UseCWMPVersion?: UseCWMPVersion
public 'SupportedCWMPVersions'?: SupportedCWMPVersions
public 'UseCWMPVersion'?: UseCWMPVersion
constructor(props: any = {}) {
'constructor'(props: any = {}) {
super(props)
this.SupportedCWMPVersions = props.SupportedCWMPVersions ? new SupportedCWMPVersions(props.SupportedCWMPVersions) : undefined
this.UseCWMPVersion = props.UseCWMPVersion ? new UseCWMPVersion(props.UseCWMPVersion) : undefined
this.SupportedCWMPVersions = props.SupportedCWMPVersions
? new SupportedCWMPVersions(props.SupportedCWMPVersions)
: undefined
this.UseCWMPVersion = props.UseCWMPVersion
? new UseCWMPVersion(props.UseCWMPVersion)
: undefined
}
}
@@ -48,10 +52,10 @@ export enum EventCode_1_4 {
export class SupportedCWMPVersions {
public '@class' = '.SupportedCWMPVersions'
public MustUnderstand?: string // should be 0 per spec, optional due to SOAP 1.1 quirks
public _: string // space or comma separated list per implementation
public 'MustUnderstand'?: string // should be 0 per spec, optional due to SOAP 1.1 quirks
public '_': string // space or comma separated list per implementation
constructor(props: any = {}) {
'constructor'(props: any = {}) {
this.MustUnderstand = props.MustUnderstand ?? '0'
this._ = props._ || ''
}
@@ -59,10 +63,10 @@ export class SupportedCWMPVersions {
export class UseCWMPVersion {
public '@class' = '.UseCWMPVersion'
public MustUnderstand: string = '1'
public _: string
public 'MustUnderstand': string = '1'
public '_': string
constructor(props: any = {}) {
'constructor'(props: any = {}) {
this.MustUnderstand = props.MustUnderstand ?? '1'
this._ = props._ || ''
}
+2 -2
View File
@@ -1,7 +1,7 @@
import { XMLParser } from 'fast-xml-parser'
import type { CwmpMessage, SoapEnvelope, SoapHeader } from './tr069_types.js'
import type { CwmpMessage, SoapEnvelope, SoapHeader } from '#protocol/tr069_types'
export { type SoapEnvelope, type SoapHeader, type CwmpMessage } from './tr069_types.js'
export { type SoapEnvelope, type SoapHeader, type CwmpMessage } from '#protocol/tr069_types'
export const CWMP_VERSIONS: Record<string, string> = {
'urn:dslforum-org:cwmp-1-0': '1.0',
+5 -5
View File
@@ -3,11 +3,11 @@
*
* Séparées de soap.ts (le module de parsing d'adam-acs) pour éviter les conflits de nom.
*/
import { Cwmp_1_0 } from './cwmp-1-0.js'
import { Cwmp_1_1 } from './cwmp-1-1.js'
import { Cwmp_1_2 } from './cwmp-1-2.js'
import { Cwmp_1_3, SessionTimeout } from './cwmp-1-3.js'
import { Cwmp_1_4, SupportedCWMPVersions, UseCWMPVersion } from './cwmp-1-4.js'
import { Cwmp_1_0 } from '#protocol/cwmp-1-0'
import { Cwmp_1_1 } from '#protocol/cwmp-1-1'
import { Cwmp_1_2 } from '#protocol/cwmp-1-2'
import { Cwmp_1_3, SessionTimeout } from '#protocol/cwmp-1-3'
import { Cwmp_1_4, SupportedCWMPVersions, UseCWMPVersion } from '#protocol/cwmp-1-4'
type NamespaceDescriptor = {
SoapEnc: string
+11 -11
View File
@@ -59,27 +59,27 @@ export {
// Types primitifs
type CommandKeyType,
type ObjectNameType,
} from './cwmp-1-0.js'
} from '#protocol/cwmp-1-0'
// ─── CWMP 1.1 ─────────────────────────────────────────────────────────────────
export { Cwmp_1_1, EventCode_1_1, FaultCodeType_1_1 } from './cwmp-1-1.js'
export { Cwmp_1_1, EventCode_1_1, FaultCodeType_1_1 } from '#protocol/cwmp-1-1'
// ─── CWMP 1.2 ─────────────────────────────────────────────────────────────────
export { Cwmp_1_2, EventCode_1_2 } from './cwmp-1-2.js'
export { Cwmp_1_2, EventCode_1_2 } from '#protocol/cwmp-1-2'
// ─── CWMP 1.3 ─────────────────────────────────────────────────────────────────
export { Cwmp_1_3, SessionTimeout } from './cwmp-1-3.js'
export { Cwmp_1_3, SessionTimeout } from '#protocol/cwmp-1-3'
// ─── CWMP 1.4 ─────────────────────────────────────────────────────────────────
export { Cwmp_1_4, EventCode_1_4, SupportedCWMPVersions, UseCWMPVersion } from './cwmp-1-4.js'
export { Cwmp_1_4, EventCode_1_4, SupportedCWMPVersions, UseCWMPVersion } from '#protocol/cwmp-1-4'
// ─── Types locaux complémentaires ─────────────────────────────────────────────
import type { Cwmp_1_0 } from './cwmp-1-0.js'
import type { Cwmp_1_1 } from './cwmp-1-1.js'
import type { Cwmp_1_2 } from './cwmp-1-2.js'
import type { Cwmp_1_3 } from './cwmp-1-3.js'
import type { Cwmp_1_4 } from './cwmp-1-4.js'
import type { Cwmp_1_0 } from '#protocol/cwmp-1-0'
import type { Cwmp_1_1 } from '#protocol/cwmp-1-1'
import type { Cwmp_1_2 } from '#protocol/cwmp-1-2'
import type { Cwmp_1_3 } from '#protocol/cwmp-1-3'
import type { Cwmp_1_4 } from '#protocol/cwmp-1-4'
import type {
Inform,
TransferComplete,
@@ -88,7 +88,7 @@ import type {
GetParameterAttributesResponse,
SetParameterValuesResponse,
Fault as SoapFaultBody,
} from './cwmp-1-0.js'
} from '#protocol/cwmp-1-0'
/** Union de tous les corps CWMP selon la version du protocole */
export type CwmpBody = Cwmp_1_0 | Cwmp_1_1 | Cwmp_1_2 | Cwmp_1_3 | Cwmp_1_4