New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@contentstack/utils

Package Overview
Dependencies
Maintainers
0
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contentstack/utils - npm Package Compare versions

Comparing version 1.3.17 to 1.3.18

51

dist/index.es.js

@@ -631,3 +631,3 @@ 'use strict';

function textNodeToHTML(node, renderOption) {
var text = node.text;
var text = escapeHtml(node.text);
if (node.classname || node.id) {

@@ -730,2 +730,8 @@ text = renderOption[MarkType$1.CLASSNAME_OR_ID](text, node.classname, node.id);

}
function escapeHtml(text) {
return text
.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
}

@@ -950,22 +956,31 @@ function jsonToHTML$1(option) {

function processEntry(entry) {
var _a;
var _loop_1 = function (field) {
for (var field in entry) {
var fieldData = entry[field];
var rteField = findRTEField(fieldData);
var edges = (_a = rteField === null || rteField === void 0 ? void 0 : rteField.embedded_itemsConnection) === null || _a === void 0 ? void 0 : _a.edges;
edges.forEach(function (edge) {
var _a, _b, _c;
var node = edge.node;
if ((node === null || node === void 0 ? void 0 : node.url) && (node === null || node === void 0 ? void 0 : node.filename)) {
if (!((_a = node === null || node === void 0 ? void 0 : node.system) === null || _a === void 0 ? void 0 : _a.uid))
throw new Error('Asset UID not found in the response');
var correspondingAsset = (_c = (_b = rteField === null || rteField === void 0 ? void 0 : rteField.json) === null || _b === void 0 ? void 0 : _b.children) === null || _c === void 0 ? void 0 : _c.find(function (child) { return child.attrs['asset-uid'] === node.system.uid; });
correspondingAsset.attrs['asset-link'] = node.url;
}
});
};
for (var field in entry) {
_loop_1(field);
if (fieldData instanceof Array) {
fieldData.forEach(function (data) {
findRTEFieldAndUpdateURL(data);
});
}
else if (fieldData && typeof fieldData === 'object') {
findRTEFieldAndUpdateURL(fieldData);
}
}
}
function findRTEFieldAndUpdateURL(fieldData) {
var _a;
var rteField = findRTEField(fieldData);
if (!rteField)
return;
var edges = (_a = rteField === null || rteField === void 0 ? void 0 : rteField.embedded_itemsConnection) === null || _a === void 0 ? void 0 : _a.edges;
edges.forEach(function (edge) {
var _a, _b, _c;
var node = edge.node;
if ((node === null || node === void 0 ? void 0 : node.url) && (node === null || node === void 0 ? void 0 : node.filename)) {
if (!((_a = node === null || node === void 0 ? void 0 : node.system) === null || _a === void 0 ? void 0 : _a.uid))
throw new Error('Asset UID not found in the response');
var correspondingAsset = (_c = (_b = rteField === null || rteField === void 0 ? void 0 : rteField.json) === null || _b === void 0 ? void 0 : _b.children) === null || _c === void 0 ? void 0 : _c.find(function (child) { return child.attrs['asset-uid'] === node.system.uid; });
correspondingAsset.attrs['asset-link'] = node.url;
}
});
}
function findRTEField(fieldData) {

@@ -972,0 +987,0 @@ if (fieldData && fieldData.embedded_itemsConnection) {

@@ -37,3 +37,3 @@ var __assign = (this && this.__assign) || function () {

export function textNodeToHTML(node, renderOption) {
var text = node.text;
var text = escapeHtml(node.text);
if (node.classname || node.id) {

@@ -136,2 +136,8 @@ text = renderOption[MarkType.CLASSNAME_OR_ID](text, node.classname, node.id);

}
function escapeHtml(text) {
return text
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
}
//# sourceMappingURL=enumerate-entries.js.map

@@ -21,22 +21,31 @@ export function updateAssetURLForGQL(gqlResponse) {

function processEntry(entry) {
var _a;
var _loop_1 = function (field) {
for (var field in entry) {
var fieldData = entry[field];
var rteField = findRTEField(fieldData);
var edges = (_a = rteField === null || rteField === void 0 ? void 0 : rteField.embedded_itemsConnection) === null || _a === void 0 ? void 0 : _a.edges;
edges.forEach(function (edge) {
var _a, _b, _c;
var node = edge.node;
if ((node === null || node === void 0 ? void 0 : node.url) && (node === null || node === void 0 ? void 0 : node.filename)) {
if (!((_a = node === null || node === void 0 ? void 0 : node.system) === null || _a === void 0 ? void 0 : _a.uid))
throw new Error('Asset UID not found in the response');
var correspondingAsset = (_c = (_b = rteField === null || rteField === void 0 ? void 0 : rteField.json) === null || _b === void 0 ? void 0 : _b.children) === null || _c === void 0 ? void 0 : _c.find(function (child) { return child.attrs['asset-uid'] === node.system.uid; });
correspondingAsset.attrs['asset-link'] = node.url;
}
});
};
for (var field in entry) {
_loop_1(field);
if (fieldData instanceof Array) {
fieldData.forEach(function (data) {
findRTEFieldAndUpdateURL(data);
});
}
else if (fieldData && typeof fieldData === 'object') {
findRTEFieldAndUpdateURL(fieldData);
}
}
}
function findRTEFieldAndUpdateURL(fieldData) {
var _a;
var rteField = findRTEField(fieldData);
if (!rteField)
return;
var edges = (_a = rteField === null || rteField === void 0 ? void 0 : rteField.embedded_itemsConnection) === null || _a === void 0 ? void 0 : _a.edges;
edges.forEach(function (edge) {
var _a, _b, _c;
var node = edge.node;
if ((node === null || node === void 0 ? void 0 : node.url) && (node === null || node === void 0 ? void 0 : node.filename)) {
if (!((_a = node === null || node === void 0 ? void 0 : node.system) === null || _a === void 0 ? void 0 : _a.uid))
throw new Error('Asset UID not found in the response');
var correspondingAsset = (_c = (_b = rteField === null || rteField === void 0 ? void 0 : rteField.json) === null || _b === void 0 ? void 0 : _b.children) === null || _c === void 0 ? void 0 : _c.find(function (child) { return child.attrs['asset-uid'] === node.system.uid; });
correspondingAsset.attrs['asset-link'] = node.url;
}
});
}
function findRTEField(fieldData) {

@@ -43,0 +52,0 @@ if (fieldData && fieldData.embedded_itemsConnection) {

{
"name": "@contentstack/utils",
"version": "1.3.17",
"version": "1.3.18",
"description": "Contentstack utilities for Javascript",

@@ -5,0 +5,0 @@ "main": "dist/index.es.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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