🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

datocms-structured-text-utils

Package Overview
Dependencies
Maintainers
5
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

datocms-structured-text-utils - npm Package Compare versions

Comparing version

to
1.2.3-alpha.0

4

dist/cjs/definitions.js
"use strict";
var _a, _b;
Object.defineProperty(exports, "__esModule", { value: true });
exports.allowedMarks = exports.allowedAttributes = exports.inlineNodeTypes = exports.allowedChildren = exports.allowedNodeTypes = exports.thematicBreakNodeType = exports.spanNodeType = exports.rootNodeType = exports.paragraphNodeType = exports.listNodeType = exports.listItemNodeType = exports.linkNodeType = exports.itemLinkNodeType = exports.inlineItemNodeType = exports.headingNodeType = exports.codeNodeType = exports.blockNodeType = exports.blockquoteNodeType = void 0;
exports.defaultMarks = exports.allowedAttributes = exports.inlineNodeTypes = exports.allowedChildren = exports.allowedNodeTypes = exports.thematicBreakNodeType = exports.spanNodeType = exports.rootNodeType = exports.paragraphNodeType = exports.listNodeType = exports.listItemNodeType = exports.linkNodeType = exports.itemLinkNodeType = exports.inlineItemNodeType = exports.headingNodeType = exports.codeNodeType = exports.blockNodeType = exports.blockquoteNodeType = void 0;
exports.blockquoteNodeType = 'blockquote';

@@ -77,3 +77,3 @@ exports.blockNodeType = 'block';

_b);
exports.allowedMarks = [
exports.defaultMarks = [
'strong',

@@ -80,0 +80,0 @@ 'code',

@@ -70,9 +70,2 @@ "use strict";

}
var invalidMark = node.marks.find(function (mark) { return !definitions_1.allowedMarks.includes(mark); });
if (invalidMark) {
return { value: {
valid: false,
message: "\"" + node.type + "\" has an invalid mark \"" + invalidMark + "\":\n\n " + JSON.stringify(node, null, 2),
} };
}
}

@@ -79,0 +72,0 @@ if ('children' in node) {

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

import { Mark, NodeType } from './types';
import { DefaultMark, NodeType } from './types';
export declare const blockquoteNodeType: "blockquote";

@@ -21,2 +21,2 @@ export declare const blockNodeType: "block";

export declare const allowedAttributes: AllowedAttributes;
export declare const allowedMarks: Mark[];
export declare const defaultMarks: DefaultMark[];

@@ -74,3 +74,3 @@ var _a, _b;

_b);
export var allowedMarks = [
export var defaultMarks = [
'strong',

@@ -77,0 +77,0 @@ 'code',

@@ -226,4 +226,5 @@ export declare type Node = BlockNode | InlineNode;

export declare type SpanType = 'span';
export declare type DefaultMark = 'strong' | 'code' | 'emphasis' | 'underline' | 'strikethrough' | 'highlight';
/** Supported marks for `span` nodes */
export declare type Mark = 'strong' | 'code' | 'emphasis' | 'underline' | 'strikethrough' | 'highlight';
export declare type Mark = DefaultMark | string;
/**

@@ -245,3 +246,3 @@ * A `span` node represents a text node. It might optionally contain decorators called `marks`. It is worth

* Array of decorators for the current chunk of text.
* Valid marks are: `strong`, `code`, `emphasis`, `underline`, `strikethrough` and `highlight`.
* Default marks: `strong`, `code`, `emphasis`, `underline`, `strikethrough` and `highlight`. Additional custom marks can be defined via plugin.
*/

@@ -248,0 +249,0 @@ marks?: Mark[];

@@ -12,3 +12,3 @@ var __rest = (this && this.__rest) || function (s, e) {

};
import { allowedAttributes, allowedMarks, allowedChildren, inlineNodeTypes, } from './definitions';
import { allowedAttributes, allowedChildren, inlineNodeTypes, } from './definitions';
export function validate(document) {

@@ -68,9 +68,2 @@ if (document === null || document === undefined) {

}
var invalidMark = node.marks.find(function (mark) { return !allowedMarks.includes(mark); });
if (invalidMark) {
return { value: {
valid: false,
message: "\"" + node.type + "\" has an invalid mark \"" + invalidMark + "\":\n\n " + JSON.stringify(node, null, 2),
} };
}
}

@@ -77,0 +70,0 @@ if ('children' in node) {

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

import { Mark, NodeType } from './types';
import { DefaultMark, NodeType } from './types';
export declare const blockquoteNodeType: "blockquote";

@@ -21,2 +21,2 @@ export declare const blockNodeType: "block";

export declare const allowedAttributes: AllowedAttributes;
export declare const allowedMarks: Mark[];
export declare const defaultMarks: DefaultMark[];

@@ -226,4 +226,5 @@ export declare type Node = BlockNode | InlineNode;

export declare type SpanType = 'span';
export declare type DefaultMark = 'strong' | 'code' | 'emphasis' | 'underline' | 'strikethrough' | 'highlight';
/** Supported marks for `span` nodes */
export declare type Mark = 'strong' | 'code' | 'emphasis' | 'underline' | 'strikethrough' | 'highlight';
export declare type Mark = DefaultMark | string;
/**

@@ -245,3 +246,3 @@ * A `span` node represents a text node. It might optionally contain decorators called `marks`. It is worth

* Array of decorators for the current chunk of text.
* Valid marks are: `strong`, `code`, `emphasis`, `underline`, `strikethrough` and `highlight`.
* Default marks: `strong`, `code`, `emphasis`, `underline`, `strikethrough` and `highlight`. Additional custom marks can be defined via plugin.
*/

@@ -248,0 +249,0 @@ marks?: Mark[];

{
"name": "datocms-structured-text-utils",
"version": "1.2.0",
"version": "1.2.3-alpha.0",
"description": "A set of Typescript types and helpers to work with DatoCMS Structured Text fields.",

@@ -37,3 +37,3 @@ "keywords": [

},
"gitHead": "5e1d46cdfa26e333c707f6e4d283131aa986fa8e"
"gitHead": "a300eb72a078d572ec8e8bc4e53ff7d96dfe0529"
}

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

Sorry, the diff of this file is not supported yet