@aws-sdk/xml-builder
Advanced tools
Comparing version 3.485.0 to 3.495.0
@@ -1,7 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.escapeAttribute = void 0; | ||
function escapeAttribute(value) { | ||
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """); | ||
} | ||
exports.escapeAttribute = escapeAttribute; | ||
module.exports = require("./index.js"); |
@@ -1,16 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.escapeElement = void 0; | ||
function escapeElement(value) { | ||
return value | ||
.replace(/&/g, "&") | ||
.replace(/"/g, """) | ||
.replace(/'/g, "'") | ||
.replace(/</g, "<") | ||
.replace(/>/g, ">") | ||
.replace(/\r/g, "
") | ||
.replace(/\n/g, "
") | ||
.replace(/\u0085/g, "…") | ||
.replace(/\u2028/, "
"); | ||
} | ||
exports.escapeElement = escapeElement; | ||
module.exports = require("./index.js"); |
@@ -1,5 +0,168 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./XmlNode"), exports); | ||
tslib_1.__exportStar(require("./XmlText"), exports); | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
// src/index.ts | ||
var src_exports = {}; | ||
__export(src_exports, { | ||
XmlNode: () => XmlNode, | ||
XmlText: () => XmlText | ||
}); | ||
module.exports = __toCommonJS(src_exports); | ||
// src/escape-attribute.ts | ||
function escapeAttribute(value) { | ||
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """); | ||
} | ||
__name(escapeAttribute, "escapeAttribute"); | ||
// src/escape-element.ts | ||
function escapeElement(value) { | ||
return value.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/\r/g, "
").replace(/\n/g, "
").replace(/\u0085/g, "…").replace(/\u2028/, "
"); | ||
} | ||
__name(escapeElement, "escapeElement"); | ||
// src/XmlText.ts | ||
var _XmlText = class _XmlText { | ||
constructor(value) { | ||
this.value = value; | ||
} | ||
toString() { | ||
return escapeElement("" + this.value); | ||
} | ||
}; | ||
__name(_XmlText, "XmlText"); | ||
var XmlText = _XmlText; | ||
// src/XmlNode.ts | ||
var _XmlNode = class _XmlNode { | ||
constructor(name, children = []) { | ||
this.name = name; | ||
this.children = children; | ||
this.attributes = {}; | ||
} | ||
static of(name, childText, withName) { | ||
const node = new _XmlNode(name); | ||
if (childText !== void 0) { | ||
node.addChildNode(new XmlText(childText)); | ||
} | ||
if (withName !== void 0) { | ||
node.withName(withName); | ||
} | ||
return node; | ||
} | ||
withName(name) { | ||
this.name = name; | ||
return this; | ||
} | ||
addAttribute(name, value) { | ||
this.attributes[name] = value; | ||
return this; | ||
} | ||
addChildNode(child) { | ||
this.children.push(child); | ||
return this; | ||
} | ||
removeAttribute(name) { | ||
delete this.attributes[name]; | ||
return this; | ||
} | ||
/** | ||
* @internal | ||
* Alias of {@link XmlNode#withName(string)} for codegen brevity. | ||
*/ | ||
n(name) { | ||
this.name = name; | ||
return this; | ||
} | ||
/** | ||
* @internal | ||
* Alias of {@link XmlNode#addChildNode(string)} for codegen brevity. | ||
*/ | ||
c(child) { | ||
this.children.push(child); | ||
return this; | ||
} | ||
/** | ||
* @internal | ||
* Checked version of {@link XmlNode#addAttribute(string)} for codegen brevity. | ||
*/ | ||
a(name, value) { | ||
if (value != null) { | ||
this.attributes[name] = value; | ||
} | ||
return this; | ||
} | ||
/** | ||
* Create a child node. | ||
* Used in serialization of string fields. | ||
* @internal | ||
*/ | ||
cc(input, field, withName = field) { | ||
if (input[field] != null) { | ||
const node = _XmlNode.of(field, input[field]).withName(withName); | ||
this.c(node); | ||
} | ||
} | ||
/** | ||
* Creates list child nodes. | ||
* @internal | ||
*/ | ||
l(input, listName, memberName, valueProvider) { | ||
if (input[listName] != null) { | ||
const nodes = valueProvider(); | ||
nodes.map((node) => { | ||
node.withName(memberName); | ||
this.c(node); | ||
}); | ||
} | ||
} | ||
/** | ||
* Creates list child nodes with container. | ||
* @internal | ||
*/ | ||
lc(input, listName, memberName, valueProvider) { | ||
if (input[listName] != null) { | ||
const nodes = valueProvider(); | ||
const containerNode = new _XmlNode(memberName); | ||
nodes.map((node) => { | ||
containerNode.c(node); | ||
}); | ||
this.c(containerNode); | ||
} | ||
} | ||
toString() { | ||
const hasChildren = Boolean(this.children.length); | ||
let xmlText = `<${this.name}`; | ||
const attributes = this.attributes; | ||
for (const attributeName of Object.keys(attributes)) { | ||
const attribute = attributes[attributeName]; | ||
if (attribute != null) { | ||
xmlText += ` ${attributeName}="${escapeAttribute("" + attribute)}"`; | ||
} | ||
} | ||
return xmlText += !hasChildren ? "/>" : `>${this.children.map((c) => c.toString()).join("")}</${this.name}>`; | ||
} | ||
}; | ||
__name(_XmlNode, "XmlNode"); | ||
var XmlNode = _XmlNode; | ||
// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { | ||
XmlNode, | ||
XmlText | ||
}); |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
module.exports = require("./index.js"); |
@@ -1,90 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.XmlNode = void 0; | ||
const escape_attribute_1 = require("./escape-attribute"); | ||
const XmlText_1 = require("./XmlText"); | ||
class XmlNode { | ||
static of(name, childText, withName) { | ||
const node = new XmlNode(name); | ||
if (childText !== undefined) { | ||
node.addChildNode(new XmlText_1.XmlText(childText)); | ||
} | ||
if (withName !== undefined) { | ||
node.withName(withName); | ||
} | ||
return node; | ||
} | ||
constructor(name, children = []) { | ||
this.name = name; | ||
this.children = children; | ||
this.attributes = {}; | ||
} | ||
withName(name) { | ||
this.name = name; | ||
return this; | ||
} | ||
addAttribute(name, value) { | ||
this.attributes[name] = value; | ||
return this; | ||
} | ||
addChildNode(child) { | ||
this.children.push(child); | ||
return this; | ||
} | ||
removeAttribute(name) { | ||
delete this.attributes[name]; | ||
return this; | ||
} | ||
n(name) { | ||
this.name = name; | ||
return this; | ||
} | ||
c(child) { | ||
this.children.push(child); | ||
return this; | ||
} | ||
a(name, value) { | ||
if (value != null) { | ||
this.attributes[name] = value; | ||
} | ||
return this; | ||
} | ||
cc(input, field, withName = field) { | ||
if (input[field] != null) { | ||
const node = XmlNode.of(field, input[field]).withName(withName); | ||
this.c(node); | ||
} | ||
} | ||
l(input, listName, memberName, valueProvider) { | ||
if (input[listName] != null) { | ||
const nodes = valueProvider(); | ||
nodes.map((node) => { | ||
node.withName(memberName); | ||
this.c(node); | ||
}); | ||
} | ||
} | ||
lc(input, listName, memberName, valueProvider) { | ||
if (input[listName] != null) { | ||
const nodes = valueProvider(); | ||
const containerNode = new XmlNode(memberName); | ||
nodes.map((node) => { | ||
containerNode.c(node); | ||
}); | ||
this.c(containerNode); | ||
} | ||
} | ||
toString() { | ||
const hasChildren = Boolean(this.children.length); | ||
let xmlText = `<${this.name}`; | ||
const attributes = this.attributes; | ||
for (const attributeName of Object.keys(attributes)) { | ||
const attribute = attributes[attributeName]; | ||
if (attribute != null) { | ||
xmlText += ` ${attributeName}="${(0, escape_attribute_1.escapeAttribute)("" + attribute)}"`; | ||
} | ||
} | ||
return (xmlText += !hasChildren ? "/>" : `>${this.children.map((c) => c.toString()).join("")}</${this.name}>`); | ||
} | ||
} | ||
exports.XmlNode = XmlNode; | ||
module.exports = require("./index.js"); |
@@ -1,13 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.XmlText = void 0; | ||
const escape_element_1 = require("./escape-element"); | ||
class XmlText { | ||
constructor(value) { | ||
this.value = value; | ||
} | ||
toString() { | ||
return (0, escape_element_1.escapeElement)("" + this.value); | ||
} | ||
} | ||
exports.XmlText = XmlText; | ||
module.exports = require("./index.js"); |
{ | ||
"name": "@aws-sdk/xml-builder", | ||
"version": "3.485.0", | ||
"version": "3.495.0", | ||
"description": "XML builder for the AWS SDK", | ||
"dependencies": { | ||
"@smithy/types": "^2.8.0", | ||
"@smithy/types": "^2.9.0", | ||
"tslib": "^2.5.0" | ||
@@ -11,3 +11,3 @@ }, | ||
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", | ||
"build:cjs": "tsc -p tsconfig.cjs.json", | ||
"build:cjs": "node ../../scripts/compilation/inline xml-builder", | ||
"build:es": "tsc -p tsconfig.es.json", | ||
@@ -14,0 +14,0 @@ "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24800
404
Updated@smithy/types@^2.9.0