Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sap-ux/yaml

Package Overview
Dependencies
Maintainers
3
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap-ux/yaml - npm Package Compare versions

Comparing version 0.13.3 to 0.13.4

24

dist/errors/index.d.ts
import { YAMLError } from './yaml-error';
export declare const errorCode: Readonly<{
yamlParsing: string;
nodeNotFound: string;
nodeNotFoundMatching: string;
nodeNotAMap: string;
propertyNotFound: string;
pathCannotBeEmpty: string;
pathDoesNotExist: string;
seqDoesNotExist: string;
tryingToAppendToNonSequence: string;
startNodeMustBeCollection: string;
scalarValuesDoNotHaveProperties: string;
yamlParsing: "yamlParsing";
nodeNotFound: "nodeNotFound";
nodeNotFoundMatching: "nodeNotFoundMatching";
nodeNotAMap: "nodeNotAMap";
propertyNotFound: "propertyNotFound";
pathCannotBeEmpty: "pathCannotBeEmpty";
pathDoesNotExist: "pathDoesNotExist";
seqDoesNotExist: "seqDoesNotExist";
tryingToAppendToNonSequence: "tryingToAppendToNonSequence";
startNodeMustBeCollection: "startNodeMustBeCollection";
scalarValuesDoNotHaveProperties: "scalarValuesDoNotHaveProperties";
}>;
export declare type ErrorTemplate = Record<string, string>;
export type ErrorTemplate = Record<string, string>;
export declare const errorTemplate: Readonly<ErrorTemplate>;
export { YAMLError };
//# sourceMappingURL=index.d.ts.map

@@ -1,2 +0,2 @@

export declare type StringMap = {
export type StringMap = {
[key: string]: any;

@@ -3,0 +3,0 @@ };

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -46,2 +50,15 @@ if (k2 === undefined) k2 = k;

/**
* Returns a new instance of YamlDocument.
*
* @static
* @param {string} serializedYaml - the serialized yaml string
* @returns {YamlDocument} the YamlDocument instance
* @memberof YamlDocument
*/
static newInstance(serializedYaml) {
return __awaiter(this, void 0, void 0, function* () {
return new YamlDocument(serializedYaml);
});
}
/**
* Creates an instance of YamlDocument.

@@ -68,15 +85,2 @@ *

/**
* Returns a new instance of YamlDocument.
*
* @static
* @param {string} serializedYaml - the serialized yaml string
* @returns {YamlDocument} the YamlDocument instance
* @memberof YamlDocument
*/
static newInstance(serializedYaml) {
return __awaiter(this, void 0, void 0, function* () {
return new YamlDocument(serializedYaml);
});
}
/**
* Returns a string representation of the yaml document.

@@ -142,3 +146,3 @@ *

// Not at root and we're not asked to create the intermediate keys
throw new errors_1.YAMLError(texts_1.interpolate(errors_1.errorTemplate.pathDoesNotExist, { path: parentPath }), errors_1.errorCode.pathDoesNotExist);
throw new errors_1.YAMLError((0, texts_1.interpolate)(errors_1.errorTemplate.pathDoesNotExist, { path: parentPath }), errors_1.errorCode.pathDoesNotExist);
}

@@ -172,3 +176,3 @@ }

if (!createIntermediateKeys) {
throw new errors_1.YAMLError(texts_1.interpolate(errors_1.errorTemplate.seqDoesNotExist, { path }), errors_1.errorCode.seqDoesNotExist);
throw new errors_1.YAMLError((0, texts_1.interpolate)(errors_1.errorTemplate.seqDoesNotExist, { path }), errors_1.errorCode.seqDoesNotExist);
}

@@ -178,4 +182,4 @@ seq = new yaml_1.YAMLSeq();

}
else if (!yaml_1.isSeq(seq)) {
throw new errors_1.YAMLError(texts_1.interpolate(errors_1.errorTemplate.tryingToAppendToNonSequence, { path }), errors_1.errorCode.tryingToAppendToNonSequence);
else if (!(0, yaml_1.isSeq)(seq)) {
throw new errors_1.YAMLError((0, texts_1.interpolate)(errors_1.errorTemplate.tryingToAppendToNonSequence, { path }), errors_1.errorCode.tryingToAppendToNonSequence);
}

@@ -196,3 +200,3 @@ const newNode = documentCopy.createNode(value);

if (!n) {
throw new errors_1.YAMLError(texts_1.interpolate(errors_1.errorTemplate.propertyNotFound, { path: c.path }), errors_1.errorCode.propertyNotFound);
throw new errors_1.YAMLError((0, texts_1.interpolate)(errors_1.errorTemplate.propertyNotFound, { path: c.path }), errors_1.errorCode.propertyNotFound);
}

@@ -223,9 +227,9 @@ n.comment = c.comment;

if (!seq) {
throw new errors_1.YAMLError(texts_1.interpolate(errors_1.errorTemplate.seqDoesNotExist, { path }), errors_1.errorCode.seqDoesNotExist);
throw new errors_1.YAMLError((0, texts_1.interpolate)(errors_1.errorTemplate.seqDoesNotExist, { path }), errors_1.errorCode.seqDoesNotExist);
}
const node = seq.items.find((nodeInput) => nodeInput.toJSON()[matcher.key] === matcher.value);
if (!node) {
throw new errors_1.YAMLError(texts_1.interpolate(errors_1.errorTemplate.nodeNotFoundMatching, { path, key: matcher.key, value: matcher.value }), errors_1.errorCode.nodeNotFoundMatching);
throw new errors_1.YAMLError((0, texts_1.interpolate)(errors_1.errorTemplate.nodeNotFoundMatching, { path, key: matcher.key, value: matcher.value }), errors_1.errorCode.nodeNotFoundMatching);
}
const newValue = mode === 'merge' ? merge_1.default(node.toJSON(), value) : value;
const newValue = mode === 'merge' ? (0, merge_1.default)(node.toJSON(), value) : value;
const newNode = this.documents[0].createNode(newValue);

@@ -250,3 +254,3 @@ seq.items.splice(seq.items.indexOf(node), 1, newNode);

if (!seq || !seq.items) {
throw new errors_1.YAMLError(texts_1.interpolate(errors_1.errorTemplate.seqDoesNotExist, { path }), errors_1.errorCode.seqDoesNotExist);
throw new errors_1.YAMLError((0, texts_1.interpolate)(errors_1.errorTemplate.seqDoesNotExist, { path }), errors_1.errorCode.seqDoesNotExist);
}

@@ -263,3 +267,3 @@ const deletedNode = seq.items.find((node, index) => {

if (!deletedNode) {
throw new errors_1.YAMLError(texts_1.interpolate(errors_1.errorTemplate.propertyNotFound, { path }), errors_1.errorCode.propertyNotFound);
throw new errors_1.YAMLError((0, texts_1.interpolate)(errors_1.errorTemplate.propertyNotFound, { path }), errors_1.errorCode.propertyNotFound);
}

@@ -276,3 +280,3 @@ return this;

if (start) {
if (!(yaml_1.isSeq(start) || yaml_1.isMap(start))) {
if (!((0, yaml_1.isSeq)(start) || (0, yaml_1.isMap)(start))) {
throw new errors_1.YAMLError(errors_1.errorTemplate.startNodeMustBeCollection, errors_1.errorCode.startNodeMustBeCollection);

@@ -285,3 +289,3 @@ }

if (!targetNode) {
throw new errors_1.YAMLError(texts_1.interpolate(errors_1.errorTemplate.nodeNotFound, { path }), errors_1.errorCode.nodeNotFound);
throw new errors_1.YAMLError((0, texts_1.interpolate)(errors_1.errorTemplate.nodeNotFound, { path }), errors_1.errorCode.nodeNotFound);
}

@@ -300,4 +304,4 @@ else {

const a = this.getNode({ start, path });
if (!yaml_1.isSeq(a)) {
throw new errors_1.YAMLError(texts_1.interpolate(errors_1.errorTemplate.seqDoesNotExist, { path }), errors_1.errorCode.seqDoesNotExist);
if (!(0, yaml_1.isSeq)(a)) {
throw new errors_1.YAMLError((0, texts_1.interpolate)(errors_1.errorTemplate.seqDoesNotExist, { path }), errors_1.errorCode.seqDoesNotExist);
}

@@ -316,4 +320,4 @@ else {

const a = this.getNode({ start, path });
if (!yaml_1.isMap(a)) {
throw new errors_1.YAMLError(texts_1.interpolate(errors_1.errorTemplate.nodeNotAMap, { path }), errors_1.errorCode.nodeNotAMap);
if (!(0, yaml_1.isMap)(a)) {
throw new errors_1.YAMLError((0, texts_1.interpolate)(errors_1.errorTemplate.nodeNotAMap, { path }), errors_1.errorCode.nodeNotAMap);
}

@@ -320,0 +324,0 @@ else {

@@ -12,3 +12,3 @@ {

},
"version": "0.13.3",
"version": "0.13.4",
"main": "dist/index.js",

@@ -15,0 +15,0 @@ "files": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc