-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f729a22
commit d37f734
Showing
9 changed files
with
70 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,4 +44,4 @@ | |
"dependencies": { | ||
"fast-xml-parser": "^4.5.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
"dependencies": { | ||
"fast-xml-parser": "^4.5.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,26 @@ | ||
|
||
|
||
import { XMLBuilder } from "fast-xml-parser"; | ||
import { XMLBuilder } from 'fast-xml-parser'; | ||
|
||
export function toAbapGitXML(data: unknown, serializer: string): string { | ||
|
||
const builder = new XMLBuilder({ ignoreAttributes: false, format: true }); | ||
|
||
const payload = { | ||
"?xml": { | ||
"@_version": "1.0", | ||
"@_encoding": "utf-8" | ||
}, | ||
"abapGit": { | ||
"asx:abap": { | ||
"asx:values": data, | ||
"@_xmlns:asx": "http://www.sap.com/abapxml", | ||
"@_version": "1.0" | ||
}, | ||
"@_version": "v1.0.0", | ||
"@_serializer": serializer, | ||
"@_serializer_version": "v1.0.0" | ||
} | ||
} | ||
|
||
const xml = builder.build(payload); | ||
|
||
return xml; | ||
|
||
} | ||
const builder = new XMLBuilder({ ignoreAttributes: false, format: true }); | ||
|
||
const payload = { | ||
'?xml': { | ||
'@_version': '1.0', | ||
'@_encoding': 'utf-8', | ||
}, | ||
abapGit: { | ||
'asx:abap': { | ||
'asx:values': data, | ||
'@_xmlns:asx': 'http://www.sap.com/abapxml', | ||
'@_version': '1.0', | ||
}, | ||
'@_version': 'v1.0.0', | ||
'@_serializer': serializer, | ||
'@_serializer_version': 'v1.0.0', | ||
}, | ||
}; | ||
|
||
const xml = builder.build(payload); | ||
|
||
return xml; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { toAbapGitXML } from "../abapgit/abapgit"; | ||
import { toAbapGitXML } from '../abapgit/abapgit'; | ||
|
||
export abstract class Component<T> { | ||
input: T | ||
constructor(input: T) { | ||
this.input = input | ||
} | ||
abstract toAbapgit(): unknown | ||
abstract get abapgitSerializer(): string; | ||
toAbapgitXML(): string { | ||
return toAbapGitXML(this.toAbapgit(), this.abapgitSerializer) | ||
} | ||
} | ||
input: T; | ||
constructor(input: T) { | ||
this.input = input; | ||
} | ||
abstract toAbapgit(): unknown; | ||
abstract get abapgitSerializer(): string; | ||
toAbapgitXML(): string { | ||
return toAbapGitXML(this.toAbapgit(), this.abapgitSerializer); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import { Component } from "../component" | ||
import { Component } from '../component'; | ||
|
||
interface PackageInput { | ||
description: string | ||
description: string; | ||
} | ||
|
||
export class Package extends Component<PackageInput> { | ||
override get abapgitSerializer(): string { | ||
return "LCL_OBJECT_DEVC" | ||
} | ||
override toAbapgit(): unknown { | ||
return { | ||
DEVC: { | ||
CTEXT: this.input.description | ||
} | ||
} | ||
} | ||
} | ||
override get abapgitSerializer(): string { | ||
return 'LCL_OBJECT_DEVC'; | ||
} | ||
override toAbapgit(): unknown { | ||
return { | ||
DEVC: { | ||
CTEXT: this.input.description, | ||
}, | ||
}; | ||
} | ||
} |