first commit
SAP-ERP Portal CI/CD / build (push) Failing after 5m20s

This commit is contained in:
John
2026-09-23 17:31:02 +05:30
commit 69b4e68baf
51657 changed files with 3864077 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
const BaseXform = require('../base-xform');
class BooleanXform extends BaseXform {
constructor(options) {
super();
this.tag = options.tag;
this.attr = options.attr;
}
render(xmlStream, model) {
if (model) {
xmlStream.openNode(this.tag);
xmlStream.closeNode();
}
}
parseOpen(node) {
if (node.name === this.tag) {
this.model = true;
}
}
parseText() {}
parseClose() {
return false;
}
}
module.exports = BooleanXform;
+66
View File
@@ -0,0 +1,66 @@
const BaseXform = require('../base-xform');
class DateXform extends BaseXform {
constructor(options) {
super();
this.tag = options.tag;
this.attr = options.attr;
this.attrs = options.attrs;
this._format =
options.format ||
function(dt) {
try {
if (Number.isNaN(dt.getTime())) return '';
return dt.toISOString();
} catch (e) {
return '';
}
};
this._parse =
options.parse ||
function(str) {
return new Date(str);
};
}
render(xmlStream, model) {
if (model) {
xmlStream.openNode(this.tag);
if (this.attrs) {
xmlStream.addAttributes(this.attrs);
}
if (this.attr) {
xmlStream.addAttribute(this.attr, this._format(model));
} else {
xmlStream.writeText(this._format(model));
}
xmlStream.closeNode();
}
}
parseOpen(node) {
if (node.name === this.tag) {
if (this.attr) {
this.model = this._parse(node.attributes[this.attr]);
} else {
this.text = [];
}
}
}
parseText(text) {
if (!this.attr) {
this.text.push(text);
}
}
parseClose() {
if (!this.attr) {
this.model = this._parse(this.text.join(''));
}
return false;
}
}
module.exports = DateXform;
+51
View File
@@ -0,0 +1,51 @@
const BaseXform = require('../base-xform');
class FloatXform extends BaseXform {
constructor(options) {
super();
this.tag = options.tag;
this.attr = options.attr;
this.attrs = options.attrs;
}
render(xmlStream, model) {
if (model !== undefined) {
xmlStream.openNode(this.tag);
if (this.attrs) {
xmlStream.addAttributes(this.attrs);
}
if (this.attr) {
xmlStream.addAttribute(this.attr, model);
} else {
xmlStream.writeText(model);
}
xmlStream.closeNode();
}
}
parseOpen(node) {
if (node.name === this.tag) {
if (this.attr) {
this.model = parseFloat(node.attributes[this.attr]);
} else {
this.text = [];
}
}
}
parseText(text) {
if (!this.attr) {
this.text.push(text);
}
}
parseClose() {
if (!this.attr) {
this.model = parseFloat(this.text.join(''));
}
return false;
}
}
module.exports = FloatXform;
+57
View File
@@ -0,0 +1,57 @@
const BaseXform = require('../base-xform');
class IntegerXform extends BaseXform {
constructor(options) {
super();
this.tag = options.tag;
this.attr = options.attr;
this.attrs = options.attrs;
// option to render zero
this.zero = options.zero;
}
render(xmlStream, model) {
// int is different to float in that zero is not rendered
if (model || this.zero) {
xmlStream.openNode(this.tag);
if (this.attrs) {
xmlStream.addAttributes(this.attrs);
}
if (this.attr) {
xmlStream.addAttribute(this.attr, model);
} else {
xmlStream.writeText(model);
}
xmlStream.closeNode();
}
}
parseOpen(node) {
if (node.name === this.tag) {
if (this.attr) {
this.model = parseInt(node.attributes[this.attr], 10);
} else {
this.text = [];
}
return true;
}
return false;
}
parseText(text) {
if (!this.attr) {
this.text.push(text);
}
}
parseClose() {
if (!this.attr) {
this.model = parseInt(this.text.join('') || 0, 10);
}
return false;
}
}
module.exports = IntegerXform;
+51
View File
@@ -0,0 +1,51 @@
const BaseXform = require('../base-xform');
class StringXform extends BaseXform {
constructor(options) {
super();
this.tag = options.tag;
this.attr = options.attr;
this.attrs = options.attrs;
}
render(xmlStream, model) {
if (model !== undefined) {
xmlStream.openNode(this.tag);
if (this.attrs) {
xmlStream.addAttributes(this.attrs);
}
if (this.attr) {
xmlStream.addAttribute(this.attr, model);
} else {
xmlStream.writeText(model);
}
xmlStream.closeNode();
}
}
parseOpen(node) {
if (node.name === this.tag) {
if (this.attr) {
this.model = node.attributes[this.attr];
} else {
this.text = [];
}
}
}
parseText(text) {
if (!this.attr) {
this.text.push(text);
}
}
parseClose() {
if (!this.attr) {
this.model = this.text.join('');
}
return false;
}
}
module.exports = StringXform;