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
+48
View File
@@ -0,0 +1,48 @@
const BaseXform = require('../base-xform');
class BaseCellAnchorXform extends BaseXform {
parseOpen(node) {
if (this.parser) {
this.parser.parseOpen(node);
return true;
}
switch (node.name) {
case this.tag:
this.reset();
this.model = {
range: {
editAs: node.attributes.editAs || 'oneCell',
},
};
break;
default:
this.parser = this.map[node.name];
if (this.parser) {
this.parser.parseOpen(node);
}
break;
}
return true;
}
parseText(text) {
if (this.parser) {
this.parser.parseText(text);
}
}
reconcilePicture(model, options) {
if (model && model.rId) {
const rel = options.rels[model.rId];
const match = rel.Target.match(/.*\/media\/(.+[.][a-zA-Z]{3,4})/);
if (match) {
const name = match[1];
const mediaId = options.mediaIndex[name];
return options.media[mediaId];
}
}
return undefined;
}
}
module.exports = BaseCellAnchorXform;
+71
View File
@@ -0,0 +1,71 @@
const BaseXform = require('../base-xform');
const BlipXform = require('./blip-xform');
class BlipFillXform extends BaseXform {
constructor() {
super();
this.map = {
'a:blip': new BlipXform(),
};
}
get tag() {
return 'xdr:blipFill';
}
render(xmlStream, model) {
xmlStream.openNode(this.tag);
this.map['a:blip'].render(xmlStream, model);
// TODO: options for this + parsing
xmlStream.openNode('a:stretch');
xmlStream.leafNode('a:fillRect');
xmlStream.closeNode();
xmlStream.closeNode();
}
parseOpen(node) {
if (this.parser) {
this.parser.parseOpen(node);
return true;
}
switch (node.name) {
case this.tag:
this.reset();
break;
default:
this.parser = this.map[node.name];
if (this.parser) {
this.parser.parseOpen(node);
}
break;
}
return true;
}
parseText() {}
parseClose(name) {
if (this.parser) {
if (!this.parser.parseClose(name)) {
this.parser = undefined;
}
return true;
}
switch (name) {
case this.tag:
this.model = this.map['a:blip'].model;
return false;
default:
return true;
}
}
}
module.exports = BlipFillXform;
+42
View File
@@ -0,0 +1,42 @@
const BaseXform = require('../base-xform');
class BlipXform extends BaseXform {
get tag() {
return 'a:blip';
}
render(xmlStream, model) {
xmlStream.leafNode(this.tag, {
'xmlns:r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
'r:embed': model.rId,
cstate: 'print',
});
// TODO: handle children (e.g. a:extLst=>a:ext=>a14:useLocalDpi
}
parseOpen(node) {
switch (node.name) {
case this.tag:
this.model = {
rId: node.attributes['r:embed'],
};
return true;
default:
return true;
}
}
parseText() {}
parseClose(name) {
switch (name) {
case this.tag:
return false;
default:
// unprocessed internal nodes
return true;
}
}
}
module.exports = BlipXform;
+38
View File
@@ -0,0 +1,38 @@
const BaseXform = require('../base-xform');
class CNvPicPrXform extends BaseXform {
get tag() {
return 'xdr:cNvPicPr';
}
render(xmlStream) {
xmlStream.openNode(this.tag);
xmlStream.leafNode('a:picLocks', {
noChangeAspect: '1',
});
xmlStream.closeNode();
}
parseOpen(node) {
switch (node.name) {
case this.tag:
return true;
default:
return true;
}
}
parseText() {}
parseClose(name) {
switch (name) {
case this.tag:
return false;
default:
// unprocessed internal nodes
return true;
}
}
}
module.exports = CNvPicPrXform;
+68
View File
@@ -0,0 +1,68 @@
const BaseXform = require('../base-xform');
const HlickClickXform = require('./hlink-click-xform');
const ExtLstXform = require('./ext-lst-xform');
class CNvPrXform extends BaseXform {
constructor() {
super();
this.map = {
'a:hlinkClick': new HlickClickXform(),
'a:extLst': new ExtLstXform(),
};
}
get tag() {
return 'xdr:cNvPr';
}
render(xmlStream, model) {
xmlStream.openNode(this.tag, {
id: model.index,
name: `Picture ${model.index}`,
});
this.map['a:hlinkClick'].render(xmlStream, model);
this.map['a:extLst'].render(xmlStream, model);
xmlStream.closeNode();
}
parseOpen(node) {
if (this.parser) {
this.parser.parseOpen(node);
return true;
}
switch (node.name) {
case this.tag:
this.reset();
break;
default:
this.parser = this.map[node.name];
if (this.parser) {
this.parser.parseOpen(node);
}
break;
}
return true;
}
parseText() {}
parseClose(name) {
if (this.parser) {
if (!this.parser.parseClose(name)) {
this.parser = undefined;
}
return true;
}
switch (name) {
case this.tag:
this.model = this.map['a:hlinkClick'].model;
return false;
default:
return true;
}
}
}
module.exports = CNvPrXform;
+77
View File
@@ -0,0 +1,77 @@
const BaseXform = require('../base-xform');
const IntegerXform = require('../simple/integer-xform');
class CellPositionXform extends BaseXform {
constructor(options) {
super();
this.tag = options.tag;
this.map = {
'xdr:col': new IntegerXform({tag: 'xdr:col', zero: true}),
'xdr:colOff': new IntegerXform({tag: 'xdr:colOff', zero: true}),
'xdr:row': new IntegerXform({tag: 'xdr:row', zero: true}),
'xdr:rowOff': new IntegerXform({tag: 'xdr:rowOff', zero: true}),
};
}
render(xmlStream, model) {
xmlStream.openNode(this.tag);
this.map['xdr:col'].render(xmlStream, model.nativeCol);
this.map['xdr:colOff'].render(xmlStream, model.nativeColOff);
this.map['xdr:row'].render(xmlStream, model.nativeRow);
this.map['xdr:rowOff'].render(xmlStream, model.nativeRowOff);
xmlStream.closeNode();
}
parseOpen(node) {
if (this.parser) {
this.parser.parseOpen(node);
return true;
}
switch (node.name) {
case this.tag:
this.reset();
break;
default:
this.parser = this.map[node.name];
if (this.parser) {
this.parser.parseOpen(node);
}
break;
}
return true;
}
parseText(text) {
if (this.parser) {
this.parser.parseText(text);
}
}
parseClose(name) {
if (this.parser) {
if (!this.parser.parseClose(name)) {
this.parser = undefined;
}
return true;
}
switch (name) {
case this.tag:
this.model = {
nativeCol: this.map['xdr:col'].model,
nativeColOff: this.map['xdr:colOff'].model,
nativeRow: this.map['xdr:row'].model,
nativeRowOff: this.map['xdr:rowOff'].model,
};
return false;
default:
// not quite sure how we get here!
return true;
}
}
}
module.exports = CellPositionXform;
+109
View File
@@ -0,0 +1,109 @@
const colCache = require('../../../utils/col-cache');
const XmlStream = require('../../../utils/xml-stream');
const BaseXform = require('../base-xform');
const TwoCellAnchorXform = require('./two-cell-anchor-xform');
const OneCellAnchorXform = require('./one-cell-anchor-xform');
function getAnchorType(model) {
const range = typeof model.range === 'string' ? colCache.decode(model.range) : model.range;
return range.br ? 'xdr:twoCellAnchor' : 'xdr:oneCellAnchor';
}
class DrawingXform extends BaseXform {
constructor() {
super();
this.map = {
'xdr:twoCellAnchor': new TwoCellAnchorXform(),
'xdr:oneCellAnchor': new OneCellAnchorXform(),
};
}
prepare(model) {
model.anchors.forEach((item, index) => {
item.anchorType = getAnchorType(item);
const anchor = this.map[item.anchorType];
anchor.prepare(item, {index});
});
}
get tag() {
return 'xdr:wsDr';
}
render(xmlStream, model) {
xmlStream.openXml(XmlStream.StdDocAttributes);
xmlStream.openNode(this.tag, DrawingXform.DRAWING_ATTRIBUTES);
model.anchors.forEach(item => {
const anchor = this.map[item.anchorType];
anchor.render(xmlStream, item);
});
xmlStream.closeNode();
}
parseOpen(node) {
if (this.parser) {
this.parser.parseOpen(node);
return true;
}
switch (node.name) {
case this.tag:
this.reset();
this.model = {
anchors: [],
};
break;
default:
this.parser = this.map[node.name];
if (this.parser) {
this.parser.parseOpen(node);
}
break;
}
return true;
}
parseText(text) {
if (this.parser) {
this.parser.parseText(text);
}
}
parseClose(name) {
if (this.parser) {
if (!this.parser.parseClose(name)) {
this.model.anchors.push(this.parser.model);
this.parser = undefined;
}
return true;
}
switch (name) {
case this.tag:
return false;
default:
// could be some unrecognised tags
return true;
}
}
reconcile(model, options) {
model.anchors.forEach(anchor => {
if (anchor.br) {
this.map['xdr:twoCellAnchor'].reconcile(anchor, options);
} else {
this.map['xdr:oneCellAnchor'].reconcile(anchor, options);
}
});
}
}
DrawingXform.DRAWING_ATTRIBUTES = {
'xmlns:xdr': 'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing',
'xmlns:a': 'http://schemas.openxmlformats.org/drawingml/2006/main',
};
module.exports = DrawingXform;
+43
View File
@@ -0,0 +1,43 @@
const BaseXform = require('../base-xform');
class ExtLstXform extends BaseXform {
get tag() {
return 'a:extLst';
}
render(xmlStream) {
xmlStream.openNode(this.tag);
xmlStream.openNode('a:ext', {
uri: '{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}',
});
xmlStream.leafNode('a16:creationId', {
'xmlns:a16': 'http://schemas.microsoft.com/office/drawing/2014/main',
id: '{00000000-0008-0000-0000-000002000000}',
});
xmlStream.closeNode();
xmlStream.closeNode();
}
parseOpen(node) {
switch (node.name) {
case this.tag:
return true;
default:
return true;
}
}
parseText() {}
parseClose(name) {
switch (name) {
case this.tag:
return false;
default:
// unprocessed internal nodes
return true;
}
}
}
module.exports = ExtLstXform;
+44
View File
@@ -0,0 +1,44 @@
const BaseXform = require('../base-xform');
/** https://en.wikipedia.org/wiki/Office_Open_XML_file_formats#DrawingML */
const EMU_PER_PIXEL_AT_96_DPI = 9525;
class ExtXform extends BaseXform {
constructor(options) {
super();
this.tag = options.tag;
this.map = {};
}
render(xmlStream, model) {
xmlStream.openNode(this.tag);
const width = Math.floor(model.width * EMU_PER_PIXEL_AT_96_DPI);
const height = Math.floor(model.height * EMU_PER_PIXEL_AT_96_DPI);
xmlStream.addAttribute('cx', width);
xmlStream.addAttribute('cy', height);
xmlStream.closeNode();
}
parseOpen(node) {
if (node.name === this.tag) {
this.model = {
width: parseInt(node.attributes.cx || '0', 10) / EMU_PER_PIXEL_AT_96_DPI,
height: parseInt(node.attributes.cy || '0', 10) / EMU_PER_PIXEL_AT_96_DPI,
};
return true;
}
return false;
}
parseText(/* text */) {}
parseClose(/* name */) {
return false;
}
}
module.exports = ExtXform;
+41
View File
@@ -0,0 +1,41 @@
const BaseXform = require('../base-xform');
class HLinkClickXform extends BaseXform {
get tag() {
return 'a:hlinkClick';
}
render(xmlStream, model) {
if (!(model.hyperlinks && model.hyperlinks.rId)) {
return;
}
xmlStream.leafNode(this.tag, {
'xmlns:r': 'http://schemas.openxmlformats.org/officeDocument/2006/relationships',
'r:id': model.hyperlinks.rId,
tooltip: model.hyperlinks.tooltip,
});
}
parseOpen(node) {
switch (node.name) {
case this.tag:
this.model = {
hyperlinks: {
rId: node.attributes['r:id'],
tooltip: node.attributes.tooltip,
},
};
return true;
default:
return true;
}
}
parseText() {}
parseClose() {
return false;
}
}
module.exports = HLinkClickXform;
+65
View File
@@ -0,0 +1,65 @@
const BaseXform = require('../base-xform');
const CNvPrXform = require('./c-nv-pr-xform');
const CNvPicPrXform = require('./c-nv-pic-pr-xform');
class NvPicPrXform extends BaseXform {
constructor() {
super();
this.map = {
'xdr:cNvPr': new CNvPrXform(),
'xdr:cNvPicPr': new CNvPicPrXform(),
};
}
get tag() {
return 'xdr:nvPicPr';
}
render(xmlStream, model) {
xmlStream.openNode(this.tag);
this.map['xdr:cNvPr'].render(xmlStream, model);
this.map['xdr:cNvPicPr'].render(xmlStream, model);
xmlStream.closeNode();
}
parseOpen(node) {
if (this.parser) {
this.parser.parseOpen(node);
return true;
}
switch (node.name) {
case this.tag:
this.reset();
break;
default:
this.parser = this.map[node.name];
if (this.parser) {
this.parser.parseOpen(node);
}
break;
}
return true;
}
parseText() {}
parseClose(name) {
if (this.parser) {
if (!this.parser.parseClose(name)) {
this.parser = undefined;
}
return true;
}
switch (name) {
case this.tag:
this.model = this.map['xdr:cNvPr'].model;
return false;
default:
return true;
}
}
}
module.exports = NvPicPrXform;
+63
View File
@@ -0,0 +1,63 @@
const BaseCellAnchorXform = require('./base-cell-anchor-xform');
const StaticXform = require('../static-xform');
const CellPositionXform = require('./cell-position-xform');
const ExtXform = require('./ext-xform');
const PicXform = require('./pic-xform');
class OneCellAnchorXform extends BaseCellAnchorXform {
constructor() {
super();
this.map = {
'xdr:from': new CellPositionXform({tag: 'xdr:from'}),
'xdr:ext': new ExtXform({tag: 'xdr:ext'}),
'xdr:pic': new PicXform(),
'xdr:clientData': new StaticXform({tag: 'xdr:clientData'}),
};
}
get tag() {
return 'xdr:oneCellAnchor';
}
prepare(model, options) {
this.map['xdr:pic'].prepare(model.picture, options);
}
render(xmlStream, model) {
xmlStream.openNode(this.tag, {editAs: model.range.editAs || 'oneCell'});
this.map['xdr:from'].render(xmlStream, model.range.tl);
this.map['xdr:ext'].render(xmlStream, model.range.ext);
this.map['xdr:pic'].render(xmlStream, model.picture);
this.map['xdr:clientData'].render(xmlStream, {});
xmlStream.closeNode();
}
parseClose(name) {
if (this.parser) {
if (!this.parser.parseClose(name)) {
this.parser = undefined;
}
return true;
}
switch (name) {
case this.tag:
this.model.range.tl = this.map['xdr:from'].model;
this.model.range.ext = this.map['xdr:ext'].model;
this.model.picture = this.map['xdr:pic'].model;
return false;
default:
// could be some unrecognised tags
return true;
}
}
reconcile(model, options) {
model.medium = this.reconcilePicture(model.picture, options);
}
}
module.exports = OneCellAnchorXform;
+77
View File
@@ -0,0 +1,77 @@
const BaseXform = require('../base-xform');
const StaticXform = require('../static-xform');
const BlipFillXform = require('./blip-fill-xform');
const NvPicPrXform = require('./nv-pic-pr-xform');
const spPrJSON = require('./sp-pr');
class PicXform extends BaseXform {
constructor() {
super();
this.map = {
'xdr:nvPicPr': new NvPicPrXform(),
'xdr:blipFill': new BlipFillXform(),
'xdr:spPr': new StaticXform(spPrJSON),
};
}
get tag() {
return 'xdr:pic';
}
prepare(model, options) {
model.index = options.index + 1;
}
render(xmlStream, model) {
xmlStream.openNode(this.tag);
this.map['xdr:nvPicPr'].render(xmlStream, model);
this.map['xdr:blipFill'].render(xmlStream, model);
this.map['xdr:spPr'].render(xmlStream, model);
xmlStream.closeNode();
}
parseOpen(node) {
if (this.parser) {
this.parser.parseOpen(node);
return true;
}
switch (node.name) {
case this.tag:
this.reset();
break;
default:
this.parser = this.map[node.name];
if (this.parser) {
this.parser.parseOpen(node);
}
break;
}
return true;
}
parseText() {}
parseClose(name) {
if (this.parser) {
if (!this.parser.parseClose(name)) {
this.mergeModel(this.parser.model);
this.parser = undefined;
}
return true;
}
switch (name) {
case this.tag:
return false;
default:
// not quite sure how we get here!
return true;
}
}
}
module.exports = PicXform;
+17
View File
@@ -0,0 +1,17 @@
module.exports = {
tag: 'xdr:spPr',
c: [
{
tag: 'a:xfrm',
c: [
{tag: 'a:off', $: {x: '0', y: '0'}},
{tag: 'a:ext', $: {cx: '0', cy: '0'}},
],
},
{
tag: 'a:prstGeom',
$: {prst: 'rect'},
c: [{tag: 'a:avLst'}],
},
],
};
+62
View File
@@ -0,0 +1,62 @@
const BaseCellAnchorXform = require('./base-cell-anchor-xform');
const StaticXform = require('../static-xform');
const CellPositionXform = require('./cell-position-xform');
const PicXform = require('./pic-xform');
class TwoCellAnchorXform extends BaseCellAnchorXform {
constructor() {
super();
this.map = {
'xdr:from': new CellPositionXform({tag: 'xdr:from'}),
'xdr:to': new CellPositionXform({tag: 'xdr:to'}),
'xdr:pic': new PicXform(),
'xdr:clientData': new StaticXform({tag: 'xdr:clientData'}),
};
}
get tag() {
return 'xdr:twoCellAnchor';
}
prepare(model, options) {
this.map['xdr:pic'].prepare(model.picture, options);
}
render(xmlStream, model) {
xmlStream.openNode(this.tag, {editAs: model.range.editAs || 'oneCell'});
this.map['xdr:from'].render(xmlStream, model.range.tl);
this.map['xdr:to'].render(xmlStream, model.range.br);
this.map['xdr:pic'].render(xmlStream, model.picture);
this.map['xdr:clientData'].render(xmlStream, {});
xmlStream.closeNode();
}
parseClose(name) {
if (this.parser) {
if (!this.parser.parseClose(name)) {
this.parser = undefined;
}
return true;
}
switch (name) {
case this.tag:
this.model.range.tl = this.map['xdr:from'].model;
this.model.range.br = this.map['xdr:to'].model;
this.model.picture = this.map['xdr:pic'].model;
return false;
default:
// could be some unrecognised tags
return true;
}
}
reconcile(model, options) {
model.medium = this.reconcilePicture(model.picture, options);
}
}
module.exports = TwoCellAnchorXform;