@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.
Files changed (30) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/next-schema/groups/atomicInlineGroup.js +19 -0
  3. package/dist/cjs/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
  4. package/dist/cjs/next-schema/nodes/nestedExpand.js +1 -1
  5. package/dist/cjs/next-schema/nodes/paragraph.js +2 -1
  6. package/dist/cjs/next-schema/nodes/tableCellContent.js +1 -1
  7. package/dist/cjs/validator-schema/generated/validatorSpec.js +1875 -0
  8. package/dist/cjs/validator-schema/utils/sortNestedArrays.js +33 -0
  9. package/dist/es2019/next-schema/groups/atomicInlineGroup.js +13 -0
  10. package/dist/es2019/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
  11. package/dist/es2019/next-schema/nodes/nestedExpand.js +1 -1
  12. package/dist/es2019/next-schema/nodes/paragraph.js +2 -1
  13. package/dist/es2019/next-schema/nodes/tableCellContent.js +1 -1
  14. package/dist/es2019/validator-schema/generated/validatorSpec.js +1869 -0
  15. package/dist/es2019/validator-schema/utils/sortNestedArrays.js +24 -0
  16. package/dist/esm/next-schema/groups/atomicInlineGroup.js +13 -0
  17. package/dist/esm/next-schema/groups/tableCellContentPseudoGroup.js +1 -1
  18. package/dist/esm/next-schema/nodes/nestedExpand.js +1 -1
  19. package/dist/esm/next-schema/nodes/paragraph.js +2 -1
  20. package/dist/esm/next-schema/nodes/tableCellContent.js +1 -1
  21. package/dist/esm/validator-schema/generated/validatorSpec.js +1869 -0
  22. package/dist/esm/validator-schema/utils/sortNestedArrays.js +26 -0
  23. package/dist/types/next-schema/groups/atomicInlineGroup.d.ts +1 -0
  24. package/dist/types/next-schema/nodes/nestedExpand.d.ts +1 -1
  25. package/dist/types/validator-schema/generated/validatorSpec.d.ts +1888 -0
  26. package/dist/types/validator-schema/utils/sortNestedArrays.d.ts +1 -0
  27. package/package.json +3 -2
  28. package/schema-generators/__tests__/unit/adfToValidatorSpecValidation.unit.ts +2 -42
  29. package/schema-generators/__tests__/unit/json-full-schema-backwards-compat.unit.ts +23 -46
  30. 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 highighted below.
24
+ // The differences are highlighted below.
25
25
  export const tableCellContentPseudoGroup = $onePlus($or(...tableCellContentNodes, unsupportedBlock));
26
26
  export const tableHeaderContentPseudoGroup = $onePlus($or(...tableCellContentNodes, nestedExpand));
@@ -47,7 +47,7 @@ export const nestedExpand = adfNode('nestedExpand').define({
47
47
  }
48
48
  }
49
49
  }).variant('content', {
50
- ignore: ['pm-spec', 'validator-spec']
50
+ ignore: ['pm-spec']
51
51
  }).variant('with_no_marks', {
52
52
  marks: [],
53
53
  content: [],
@@ -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', 'validator-spec'],
7
+ ignore: ['pm-spec'],
8
8
  content: [tableCellContentPseudoGroup]
9
9
  });