@atlaskit/adf-schema 37.1.40 → 37.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/next-schema/groups/atomicInlineGroup.js +19 -0
- package/dist/cjs/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
- package/dist/cjs/next-schema/nodes/nestedExpand.js +1 -1
- package/dist/cjs/next-schema/nodes/paragraph.js +2 -1
- package/dist/cjs/next-schema/nodes/tableCellContent.js +1 -1
- package/dist/cjs/validator-schema/generated/validatorSpec.js +1875 -0
- package/dist/cjs/validator-schema/utils/sortNestedArrays.js +33 -0
- package/dist/es2019/next-schema/groups/atomicInlineGroup.js +13 -0
- package/dist/es2019/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
- package/dist/es2019/next-schema/nodes/nestedExpand.js +1 -1
- package/dist/es2019/next-schema/nodes/paragraph.js +2 -1
- package/dist/es2019/next-schema/nodes/tableCellContent.js +1 -1
- package/dist/es2019/validator-schema/generated/validatorSpec.js +1869 -0
- package/dist/es2019/validator-schema/utils/sortNestedArrays.js +24 -0
- package/dist/esm/next-schema/groups/atomicInlineGroup.js +13 -0
- package/dist/esm/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
- package/dist/esm/next-schema/nodes/nestedExpand.js +1 -1
- package/dist/esm/next-schema/nodes/paragraph.js +2 -1
- package/dist/esm/next-schema/nodes/tableCellContent.js +1 -1
- package/dist/esm/validator-schema/generated/validatorSpec.js +1869 -0
- package/dist/esm/validator-schema/utils/sortNestedArrays.js +26 -0
- package/dist/types/next-schema/groups/atomicInlineGroup.d.ts +1 -0
- package/dist/types/next-schema/nodes/nestedExpand.d.ts +1 -1
- package/dist/types/validator-schema/generated/validatorSpec.d.ts +1888 -0
- package/dist/types/validator-schema/utils/sortNestedArrays.d.ts +1 -0
- package/package.json +3 -2
- package/schema-generators/__tests__/unit/adfToValidatorSpecValidation.unit.ts +2 -42
- package/schema-generators/__tests__/unit/json-full-schema-backwards-compat.unit.ts +23 -46
- package/schema-generators/validator-full-schema.ts +22 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.sortNestedArrays = sortNestedArrays;
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
9
|
+
function sortNestedArrays(obj) {
|
10
|
+
if (obj === null || obj === undefined) {
|
11
|
+
return obj;
|
12
|
+
}
|
13
|
+
if (Array.isArray(obj) && typeof obj[0] === 'string' && (0, _typeof2.default)(obj[1]) === 'object') {
|
14
|
+
// 1. tuple of object + string
|
15
|
+
obj[1] = sortNestedArrays(obj[1]);
|
16
|
+
} else if (Array.isArray(obj) && Array.isArray(obj[0])) {
|
17
|
+
// 2. array of arrays
|
18
|
+
for (var i = 0; i < obj.length; i++) {
|
19
|
+
obj[i] = sortNestedArrays(obj[i]);
|
20
|
+
}
|
21
|
+
} else if (Array.isArray(obj) && !Array.isArray(obj[0]) && (0, _typeof2.default)(obj[0]) !== 'object') {
|
22
|
+
// 3. simple array
|
23
|
+
obj.sort();
|
24
|
+
}
|
25
|
+
if ((0, _typeof2.default)(obj) === 'object') {
|
26
|
+
// 4. object
|
27
|
+
for (var _i = 0, _Object$keys = Object.keys(obj); _i < _Object$keys.length; _i++) {
|
28
|
+
var key = _Object$keys[_i];
|
29
|
+
obj[key] = sortNestedArrays(obj[key]);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
return obj;
|
33
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { adfNodeGroup } from '@atlaskit/adf-schema-generator';
|
2
|
+
import { date } from '../nodes/date';
|
3
|
+
import { emoji } from '../nodes/emoji';
|
4
|
+
import { hardBreak } from '../nodes/hardBreak';
|
5
|
+
import { inlineCard } from '../nodes/inlineCard';
|
6
|
+
import { inlineExtension } from '../nodes/inlineExtension';
|
7
|
+
import { mediaInline } from '../nodes/mediaInline';
|
8
|
+
import { mention } from '../nodes/mention';
|
9
|
+
import { placeholder } from '../nodes/placeholder';
|
10
|
+
import { status } from '../nodes/status';
|
11
|
+
export const atomicInlineGroup = adfNodeGroup('atomic_inline', [hardBreak, mention, emoji, inlineExtension.use('with_marks'), date, placeholder, inlineCard, status, mediaInline], {
|
12
|
+
ignore: ['pm-spec', 'json-schema']
|
13
|
+
});
|
@@ -21,6 +21,6 @@ const tableCellContentNodes = [codeBlock.use('with_no_marks'), blockCard, paragr
|
|
21
21
|
// @DSLCompatibilityException JSON Schema and PM Spec are not in sync. We need to fix it
|
22
22
|
// In PM Spec, they contain different items. (tableHeader using tableHeaderContentPseudoGroup, tableCell using tableCellContentPseudoGroup)
|
23
23
|
// In JSON Schema, both tableHeader and tableCell points to tableCellContentPseudoGroup
|
24
|
-
// The differences are
|
24
|
+
// The differences are highlighted below.
|
25
25
|
export const tableCellContentPseudoGroup = $onePlus($or(...tableCellContentNodes, unsupportedBlock));
|
26
26
|
export const tableHeaderContentPseudoGroup = $onePlus($or(...tableCellContentNodes, nestedExpand));
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { $or, $zeroPlus, adfNode } from '@atlaskit/adf-schema-generator';
|
2
|
+
import { atomicInlineGroup } from '../groups/atomicInlineGroup';
|
2
3
|
import { inlineContentGroup } from '../groups/inlineContentGroup';
|
3
4
|
import { inlineGroup } from '../groups/inlineGroup';
|
4
5
|
import { alignment, indentation } from '../marks/alignmentAndIndentation';
|
@@ -15,7 +16,7 @@ export const paragraph = adfNode('paragraph').define({
|
|
15
16
|
selectable: false,
|
16
17
|
marks: [unsupportedNodeAttribute, unsupportedMark],
|
17
18
|
hasEmptyMarks: true,
|
18
|
-
content: [$zeroPlus($or(inlineGroup, inlineContentGroup))],
|
19
|
+
content: [$zeroPlus($or(inlineGroup, atomicInlineGroup, inlineContentGroup))],
|
19
20
|
DANGEROUS_MANUAL_OVERRIDE: {
|
20
21
|
'validator-spec': {
|
21
22
|
'props.marks': {
|
@@ -4,6 +4,6 @@ import { tableCellContentPseudoGroup } from '../groups/tableCellContentPseudoGro
|
|
4
4
|
// @DSLCompatibilityException This is only used by JSON schema to group the table cell content into a definition.
|
5
5
|
// This node should be deleted and the content should be replicated in the JSON schema for table header and table cell node
|
6
6
|
export const tableCellContent = adfNode('tableCellContent').define({
|
7
|
-
ignore: ['pm-spec'
|
7
|
+
ignore: ['pm-spec'],
|
8
8
|
content: [tableCellContentPseudoGroup]
|
9
9
|
});
|