@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,24 @@
1
+ export function sortNestedArrays(obj) {
2
+ if (obj === null || obj === undefined) {
3
+ return obj;
4
+ }
5
+ if (Array.isArray(obj) && typeof obj[0] === 'string' && typeof obj[1] === 'object') {
6
+ // 1. tuple of object + string
7
+ obj[1] = sortNestedArrays(obj[1]);
8
+ } else if (Array.isArray(obj) && Array.isArray(obj[0])) {
9
+ // 2. array of arrays
10
+ for (let i = 0; i < obj.length; i++) {
11
+ obj[i] = sortNestedArrays(obj[i]);
12
+ }
13
+ } else if (Array.isArray(obj) && !Array.isArray(obj[0]) && typeof obj[0] !== 'object') {
14
+ // 3. simple array
15
+ obj.sort();
16
+ }
17
+ if (typeof obj === 'object') {
18
+ // 4. object
19
+ for (const key of Object.keys(obj)) {
20
+ obj[key] = sortNestedArrays(obj[key]);
21
+ }
22
+ }
23
+ return obj;
24
+ }
@@ -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 var 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 @@ var tableCellContentNodes = [codeBlock.use('with_no_marks'), blockCard, paragrap
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 var tableCellContentPseudoGroup = $onePlus($or.apply(void 0, tableCellContentNodes.concat([unsupportedBlock])));
26
26
  export var tableHeaderContentPseudoGroup = $onePlus($or.apply(void 0, tableCellContentNodes.concat([nestedExpand])));
@@ -47,7 +47,7 @@ export var 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 var 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 var tableCellContent = adfNode('tableCellContent').define({
7
- ignore: ['pm-spec', 'validator-spec'],
7
+ ignore: ['pm-spec'],
8
8
  content: [tableCellContentPseudoGroup]
9
9
  });