@atlaskit/adf-schema 57.0.3 → 57.0.5

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 CHANGED
@@ -1,5 +1,70 @@
1
1
  # @atlaskit/adf-schema
2
2
 
3
+ ## 57.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`249ac5d9191e0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/249ac5d9191e0) -
8
+ Behind `platform_editor_adf_validator_empty_marks`, accept an explicitly empty `marks` array on a
9
+ node that ADF gives a `marks` property no mark type may go into.
10
+
11
+ ADF spells that property `marks: { type: 'array', maxItems: 0 }`, and the JSON schema accordingly
12
+ accepts `"marks": []` on `paragraph`, `heading`, `extension`, `codeBlock` and `expand`. The
13
+ spec-based validator rejected it: mark validation has nothing to reject in an empty array, so it
14
+ reported the node valid with an empty `marksValidationOutput`, which reads to the parent's
15
+ `validateChildMarks` as every mark on the child having been rejected, and the candidate spec was
16
+ declined. Without an error callback that surfaced as a thrown `undefined`; with one the document
17
+ was silently repaired and no error was reported. The five reference documents that carry
18
+ `marks: []` (`paragraph-with-empty-marks`, `heading-with-empty-marks`,
19
+ `extension-with-empty-marks`, `nestedExpand-with-codeBlock`, `panel-with-codeBlock`) were on an
20
+ ignore list in `src/validator/__tests__/unit/validate.ts` because of it, and are now validated.
21
+
22
+ A node with no `marks` property at all keeps rejecting an empty array as `REDUNDANT_MARKS`,
23
+ because `marks` is then a property ADF does not define on it: `rule`, `panel`, `mediaGroup`,
24
+ `hardBreak`, `doc`, `blockquote` and the list nodes all stay invalid, as do `mention` and `emoji`,
25
+ which declare a mark rather than an empty list. The declaration is read off the node's base spec,
26
+ since a variant only widens the mark types — `doc` offers a root `extension` as
27
+ `extension_with_marks`, which adds `dataConsumer` and `fragment`, and that cannot make the empty
28
+ list illegal.
29
+
30
+ `codeBlock` and `expand` declare `noMarks` without listing any marks, and `adfToValidatorSpec`
31
+ compared mark lists alone, so the flag was dropped and their validator specs read as taking no
32
+ `marks` property — the same thing `rule` means, which is why an empty array on them was reported
33
+ as redundant. The generator now honours `noMarks` on its own, so both emit
34
+ `marks: { type: 'array', items: [], maxItems: 0, optional: true }`, matching their JSON schema.
35
+ That part is generated data and is not gated: a real mark on a `codeBlock` or an `expand` is still
36
+ rejected, now as an unsupported mark type rather than as a redundant `marks` property, so the
37
+ error code reported for an already-invalid document changes.
38
+
39
+ Gate off preserves today's acceptance behaviour. Covered by
40
+ `src/validator/__tests__/unit/empty-marks.ts`.
41
+
42
+ - Updated dependencies
43
+
44
+ ## 57.0.4
45
+
46
+ ### Patch Changes
47
+
48
+ - [`da678c24b2eb7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/da678c24b2eb7) -
49
+ `adfToValidatorSpec` now emits `meta: { stage0: true }` on the validator spec of any node that
50
+ exists only in stage 0 (`ADFNode.isStage0Only()`), and the generated validator spec is regenerated
51
+ so 10 specs carry the flag: `bodiedExtension_root_only`, `extension_root_only`, `extensionFrame`,
52
+ `layoutSection_with_single_column`, `multiBodiedExtension`, `multiBodiedExtension_root_only`,
53
+ `panel_c1`, `panel_c1_root_only`, `panel_root_only` and `rule_root_only`.
54
+
55
+ The predicate is `isStage0Only()` rather than `hasStage0()` because consumers read the flag as
56
+ "this whole spec is stage-0 only". `hasStage0()` is also true for a stable node carrying a partial
57
+ stage-0 override, so it flagged `date`, `emoji`, `inlineCard`, `mention` and `status`, whose only
58
+ stage-0 delta is an optional `annotation` mark. A per-spec boolean cannot say "the node is fine,
59
+ one of its marks is not", so flagging those said something false about stable nodes.
60
+
61
+ `meta` is additive metadata that sits beside `props`, so the validated shape of every spec is
62
+ unchanged and consumers that ignore the field see no difference. Emission is not gated. The only
63
+ consumer that reads the flag is `@atlaskit/adf-utils`, behind
64
+ `platform_editor_adf_validator_stage0`.
65
+
66
+ - Updated dependencies
67
+
3
68
  ## 57.0.3
4
69
 
5
70
  ### Patch Changes
@@ -232,6 +232,9 @@ var bodiedExtension = exports.bodiedExtension = {
232
232
  }
233
233
  };
234
234
  var bodiedExtension_root_only = exports.bodiedExtension_root_only = ['bodiedExtension', {
235
+ meta: {
236
+ stage0: true
237
+ },
235
238
  props: {
236
239
  marks: {
237
240
  items: [['breakout', 'dataConsumer', 'fragment']],
@@ -405,6 +408,12 @@ var codeBlock = exports.codeBlock = {
405
408
  optional: true,
406
409
  type: 'array'
407
410
  },
411
+ marks: {
412
+ items: [],
413
+ maxItems: 0,
414
+ optional: true,
415
+ type: 'array'
416
+ },
408
417
  type: {
409
418
  type: 'enum',
410
419
  values: ['codeBlock']
@@ -640,6 +649,12 @@ var expand = exports.expand = {
640
649
  minItems: 1,
641
650
  type: 'array'
642
651
  },
652
+ marks: {
653
+ items: [],
654
+ maxItems: 0,
655
+ optional: true,
656
+ type: 'array'
657
+ },
643
658
  type: {
644
659
  type: 'enum',
645
660
  values: ['expand']
@@ -699,6 +714,9 @@ var extension = exports.extension = {
699
714
  }
700
715
  };
701
716
  var extension_root_only = exports.extension_root_only = ['extension', {
717
+ meta: {
718
+ stage0: true
719
+ },
702
720
  props: {
703
721
  marks: {
704
722
  items: [['breakout', 'dataConsumer', 'fragment']],
@@ -717,6 +735,9 @@ var extension_with_marks = exports.extension_with_marks = ['extension', {
717
735
  }
718
736
  }];
719
737
  var extensionFrame = exports.extensionFrame = {
738
+ meta: {
739
+ stage0: true
740
+ },
720
741
  props: {
721
742
  content: {
722
743
  items: [['paragraph_with_no_marks', 'paragraph_with_font_size', 'panel', 'blockquote', 'orderedList', 'bulletList', 'rule', 'heading_with_no_marks', 'codeBlock', 'mediaGroup', 'mediaSingle_full', 'mediaSingle_caption', 'decisionList', 'taskList', 'table', 'extension_with_marks', 'bodiedExtension_with_marks', 'blockCard', 'embedCard']],
@@ -1031,6 +1052,9 @@ var layoutSection_full = exports.layoutSection_full = ['layoutSection', {
1031
1052
  }
1032
1053
  }];
1033
1054
  var layoutSection_with_single_column = exports.layoutSection_with_single_column = ['layoutSection', {
1055
+ meta: {
1056
+ stage0: true
1057
+ },
1034
1058
  props: {
1035
1059
  attrs: {
1036
1060
  optional: true,
@@ -1390,6 +1414,9 @@ var mention = exports.mention = {
1390
1414
  }
1391
1415
  };
1392
1416
  var multiBodiedExtension = exports.multiBodiedExtension = {
1417
+ meta: {
1418
+ stage0: true
1419
+ },
1393
1420
  props: {
1394
1421
  attrs: {
1395
1422
  props: {
@@ -1437,6 +1464,9 @@ var multiBodiedExtension = exports.multiBodiedExtension = {
1437
1464
  }
1438
1465
  };
1439
1466
  var multiBodiedExtension_root_only = exports.multiBodiedExtension_root_only = ['multiBodiedExtension', {
1467
+ meta: {
1468
+ stage0: true
1469
+ },
1440
1470
  props: {
1441
1471
  marks: {
1442
1472
  items: ['breakout'],
@@ -1554,6 +1584,9 @@ var panel = exports.panel = {
1554
1584
  }
1555
1585
  };
1556
1586
  var panel_c1 = exports.panel_c1 = ['panel', {
1587
+ meta: {
1588
+ stage0: true
1589
+ },
1557
1590
  props: {
1558
1591
  content: {
1559
1592
  allowUnsupportedBlock: true,
@@ -1564,6 +1597,9 @@ var panel_c1 = exports.panel_c1 = ['panel', {
1564
1597
  }
1565
1598
  }];
1566
1599
  var panel_c1_root_only = exports.panel_c1_root_only = ['panel', {
1600
+ meta: {
1601
+ stage0: true
1602
+ },
1567
1603
  props: {
1568
1604
  content: {
1569
1605
  allowUnsupportedBlock: true,
@@ -1579,6 +1615,9 @@ var panel_c1_root_only = exports.panel_c1_root_only = ['panel', {
1579
1615
  }
1580
1616
  }];
1581
1617
  var panel_root_only = exports.panel_root_only = ['panel', {
1618
+ meta: {
1619
+ stage0: true
1620
+ },
1582
1621
  props: {
1583
1622
  marks: {
1584
1623
  items: ['breakout'],
@@ -1689,6 +1728,9 @@ var rule = exports.rule = {
1689
1728
  }
1690
1729
  };
1691
1730
  var rule_root_only = exports.rule_root_only = ['rule', {
1731
+ meta: {
1732
+ stage0: true
1733
+ },
1692
1734
  props: {
1693
1735
  marks: {
1694
1736
  items: ['breakout'],
@@ -226,6 +226,9 @@ export const bodiedExtension = {
226
226
  }
227
227
  };
228
228
  export const bodiedExtension_root_only = ['bodiedExtension', {
229
+ meta: {
230
+ stage0: true
231
+ },
229
232
  props: {
230
233
  marks: {
231
234
  items: [['breakout', 'dataConsumer', 'fragment']],
@@ -399,6 +402,12 @@ export const codeBlock = {
399
402
  optional: true,
400
403
  type: 'array'
401
404
  },
405
+ marks: {
406
+ items: [],
407
+ maxItems: 0,
408
+ optional: true,
409
+ type: 'array'
410
+ },
402
411
  type: {
403
412
  type: 'enum',
404
413
  values: ['codeBlock']
@@ -634,6 +643,12 @@ export const expand = {
634
643
  minItems: 1,
635
644
  type: 'array'
636
645
  },
646
+ marks: {
647
+ items: [],
648
+ maxItems: 0,
649
+ optional: true,
650
+ type: 'array'
651
+ },
637
652
  type: {
638
653
  type: 'enum',
639
654
  values: ['expand']
@@ -693,6 +708,9 @@ export const extension = {
693
708
  }
694
709
  };
695
710
  export const extension_root_only = ['extension', {
711
+ meta: {
712
+ stage0: true
713
+ },
696
714
  props: {
697
715
  marks: {
698
716
  items: [['breakout', 'dataConsumer', 'fragment']],
@@ -711,6 +729,9 @@ export const extension_with_marks = ['extension', {
711
729
  }
712
730
  }];
713
731
  export const extensionFrame = {
732
+ meta: {
733
+ stage0: true
734
+ },
714
735
  props: {
715
736
  content: {
716
737
  items: [['paragraph_with_no_marks', 'paragraph_with_font_size', 'panel', 'blockquote', 'orderedList', 'bulletList', 'rule', 'heading_with_no_marks', 'codeBlock', 'mediaGroup', 'mediaSingle_full', 'mediaSingle_caption', 'decisionList', 'taskList', 'table', 'extension_with_marks', 'bodiedExtension_with_marks', 'blockCard', 'embedCard']],
@@ -1025,6 +1046,9 @@ export const layoutSection_full = ['layoutSection', {
1025
1046
  }
1026
1047
  }];
1027
1048
  export const layoutSection_with_single_column = ['layoutSection', {
1049
+ meta: {
1050
+ stage0: true
1051
+ },
1028
1052
  props: {
1029
1053
  attrs: {
1030
1054
  optional: true,
@@ -1384,6 +1408,9 @@ export const mention = {
1384
1408
  }
1385
1409
  };
1386
1410
  export const multiBodiedExtension = {
1411
+ meta: {
1412
+ stage0: true
1413
+ },
1387
1414
  props: {
1388
1415
  attrs: {
1389
1416
  props: {
@@ -1431,6 +1458,9 @@ export const multiBodiedExtension = {
1431
1458
  }
1432
1459
  };
1433
1460
  export const multiBodiedExtension_root_only = ['multiBodiedExtension', {
1461
+ meta: {
1462
+ stage0: true
1463
+ },
1434
1464
  props: {
1435
1465
  marks: {
1436
1466
  items: ['breakout'],
@@ -1548,6 +1578,9 @@ export const panel = {
1548
1578
  }
1549
1579
  };
1550
1580
  export const panel_c1 = ['panel', {
1581
+ meta: {
1582
+ stage0: true
1583
+ },
1551
1584
  props: {
1552
1585
  content: {
1553
1586
  allowUnsupportedBlock: true,
@@ -1558,6 +1591,9 @@ export const panel_c1 = ['panel', {
1558
1591
  }
1559
1592
  }];
1560
1593
  export const panel_c1_root_only = ['panel', {
1594
+ meta: {
1595
+ stage0: true
1596
+ },
1561
1597
  props: {
1562
1598
  content: {
1563
1599
  allowUnsupportedBlock: true,
@@ -1573,6 +1609,9 @@ export const panel_c1_root_only = ['panel', {
1573
1609
  }
1574
1610
  }];
1575
1611
  export const panel_root_only = ['panel', {
1612
+ meta: {
1613
+ stage0: true
1614
+ },
1576
1615
  props: {
1577
1616
  marks: {
1578
1617
  items: ['breakout'],
@@ -1683,6 +1722,9 @@ export const rule = {
1683
1722
  }
1684
1723
  };
1685
1724
  export const rule_root_only = ['rule', {
1725
+ meta: {
1726
+ stage0: true
1727
+ },
1686
1728
  props: {
1687
1729
  marks: {
1688
1730
  items: ['breakout'],
@@ -226,6 +226,9 @@ export var bodiedExtension = {
226
226
  }
227
227
  };
228
228
  export var bodiedExtension_root_only = ['bodiedExtension', {
229
+ meta: {
230
+ stage0: true
231
+ },
229
232
  props: {
230
233
  marks: {
231
234
  items: [['breakout', 'dataConsumer', 'fragment']],
@@ -399,6 +402,12 @@ export var codeBlock = {
399
402
  optional: true,
400
403
  type: 'array'
401
404
  },
405
+ marks: {
406
+ items: [],
407
+ maxItems: 0,
408
+ optional: true,
409
+ type: 'array'
410
+ },
402
411
  type: {
403
412
  type: 'enum',
404
413
  values: ['codeBlock']
@@ -634,6 +643,12 @@ export var expand = {
634
643
  minItems: 1,
635
644
  type: 'array'
636
645
  },
646
+ marks: {
647
+ items: [],
648
+ maxItems: 0,
649
+ optional: true,
650
+ type: 'array'
651
+ },
637
652
  type: {
638
653
  type: 'enum',
639
654
  values: ['expand']
@@ -693,6 +708,9 @@ export var extension = {
693
708
  }
694
709
  };
695
710
  export var extension_root_only = ['extension', {
711
+ meta: {
712
+ stage0: true
713
+ },
696
714
  props: {
697
715
  marks: {
698
716
  items: [['breakout', 'dataConsumer', 'fragment']],
@@ -711,6 +729,9 @@ export var extension_with_marks = ['extension', {
711
729
  }
712
730
  }];
713
731
  export var extensionFrame = {
732
+ meta: {
733
+ stage0: true
734
+ },
714
735
  props: {
715
736
  content: {
716
737
  items: [['paragraph_with_no_marks', 'paragraph_with_font_size', 'panel', 'blockquote', 'orderedList', 'bulletList', 'rule', 'heading_with_no_marks', 'codeBlock', 'mediaGroup', 'mediaSingle_full', 'mediaSingle_caption', 'decisionList', 'taskList', 'table', 'extension_with_marks', 'bodiedExtension_with_marks', 'blockCard', 'embedCard']],
@@ -1025,6 +1046,9 @@ export var layoutSection_full = ['layoutSection', {
1025
1046
  }
1026
1047
  }];
1027
1048
  export var layoutSection_with_single_column = ['layoutSection', {
1049
+ meta: {
1050
+ stage0: true
1051
+ },
1028
1052
  props: {
1029
1053
  attrs: {
1030
1054
  optional: true,
@@ -1384,6 +1408,9 @@ export var mention = {
1384
1408
  }
1385
1409
  };
1386
1410
  export var multiBodiedExtension = {
1411
+ meta: {
1412
+ stage0: true
1413
+ },
1387
1414
  props: {
1388
1415
  attrs: {
1389
1416
  props: {
@@ -1431,6 +1458,9 @@ export var multiBodiedExtension = {
1431
1458
  }
1432
1459
  };
1433
1460
  export var multiBodiedExtension_root_only = ['multiBodiedExtension', {
1461
+ meta: {
1462
+ stage0: true
1463
+ },
1434
1464
  props: {
1435
1465
  marks: {
1436
1466
  items: ['breakout'],
@@ -1548,6 +1578,9 @@ export var panel = {
1548
1578
  }
1549
1579
  };
1550
1580
  export var panel_c1 = ['panel', {
1581
+ meta: {
1582
+ stage0: true
1583
+ },
1551
1584
  props: {
1552
1585
  content: {
1553
1586
  allowUnsupportedBlock: true,
@@ -1558,6 +1591,9 @@ export var panel_c1 = ['panel', {
1558
1591
  }
1559
1592
  }];
1560
1593
  export var panel_c1_root_only = ['panel', {
1594
+ meta: {
1595
+ stage0: true
1596
+ },
1561
1597
  props: {
1562
1598
  content: {
1563
1599
  allowUnsupportedBlock: true,
@@ -1573,6 +1609,9 @@ export var panel_c1_root_only = ['panel', {
1573
1609
  }
1574
1610
  }];
1575
1611
  export var panel_root_only = ['panel', {
1612
+ meta: {
1613
+ stage0: true
1614
+ },
1576
1615
  props: {
1577
1616
  marks: {
1578
1617
  items: ['breakout'],
@@ -1683,6 +1722,9 @@ export var rule = {
1683
1722
  }
1684
1723
  };
1685
1724
  export var rule_root_only = ['rule', {
1725
+ meta: {
1726
+ stage0: true
1727
+ },
1686
1728
  props: {
1687
1729
  marks: {
1688
1730
  items: ['breakout'],
@@ -236,6 +236,9 @@ export declare const bodiedExtension: {
236
236
  };
237
237
  };
238
238
  export declare const bodiedExtension_root_only: (string | {
239
+ meta: {
240
+ stage0: boolean;
241
+ };
239
242
  props: {
240
243
  marks: {
241
244
  items: string[][];
@@ -409,6 +412,12 @@ export declare const codeBlock: {
409
412
  optional: boolean;
410
413
  type: string;
411
414
  };
415
+ marks: {
416
+ items: unknown[];
417
+ maxItems: number;
418
+ optional: boolean;
419
+ type: string;
420
+ };
412
421
  type: {
413
422
  type: string;
414
423
  values: string[];
@@ -644,6 +653,12 @@ export declare const expand: {
644
653
  minItems: number;
645
654
  type: string;
646
655
  };
656
+ marks: {
657
+ items: unknown[];
658
+ maxItems: number;
659
+ optional: boolean;
660
+ type: string;
661
+ };
647
662
  type: {
648
663
  type: string;
649
664
  values: string[];
@@ -703,6 +718,9 @@ export declare const extension: {
703
718
  };
704
719
  };
705
720
  export declare const extension_root_only: (string | {
721
+ meta: {
722
+ stage0: boolean;
723
+ };
706
724
  props: {
707
725
  marks: {
708
726
  items: string[][];
@@ -721,6 +739,9 @@ export declare const extension_with_marks: (string | {
721
739
  };
722
740
  })[];
723
741
  export declare const extensionFrame: {
742
+ meta: {
743
+ stage0: boolean;
744
+ };
724
745
  props: {
725
746
  content: {
726
747
  items: string[][];
@@ -1037,6 +1058,9 @@ export declare const layoutSection_full: (string | {
1037
1058
  };
1038
1059
  })[];
1039
1060
  export declare const layoutSection_with_single_column: (string | {
1061
+ meta: {
1062
+ stage0: boolean;
1063
+ };
1040
1064
  props: {
1041
1065
  attrs: {
1042
1066
  optional: boolean;
@@ -1403,6 +1427,9 @@ export declare const mention: {
1403
1427
  };
1404
1428
  };
1405
1429
  export declare const multiBodiedExtension: {
1430
+ meta: {
1431
+ stage0: boolean;
1432
+ };
1406
1433
  props: {
1407
1434
  attrs: {
1408
1435
  props: {
@@ -1450,6 +1477,9 @@ export declare const multiBodiedExtension: {
1450
1477
  };
1451
1478
  };
1452
1479
  export declare const multiBodiedExtension_root_only: (string | {
1480
+ meta: {
1481
+ stage0: boolean;
1482
+ };
1453
1483
  props: {
1454
1484
  marks: {
1455
1485
  items: string[];
@@ -1567,6 +1597,9 @@ export declare const panel: {
1567
1597
  };
1568
1598
  };
1569
1599
  export declare const panel_c1: (string | {
1600
+ meta: {
1601
+ stage0: boolean;
1602
+ };
1570
1603
  props: {
1571
1604
  content: {
1572
1605
  allowUnsupportedBlock: boolean;
@@ -1577,6 +1610,9 @@ export declare const panel_c1: (string | {
1577
1610
  };
1578
1611
  })[];
1579
1612
  export declare const panel_c1_root_only: (string | {
1613
+ meta: {
1614
+ stage0: boolean;
1615
+ };
1580
1616
  props: {
1581
1617
  content: {
1582
1618
  allowUnsupportedBlock: boolean;
@@ -1592,6 +1628,9 @@ export declare const panel_c1_root_only: (string | {
1592
1628
  };
1593
1629
  })[];
1594
1630
  export declare const panel_root_only: (string | {
1631
+ meta: {
1632
+ stage0: boolean;
1633
+ };
1595
1634
  props: {
1596
1635
  marks: {
1597
1636
  items: string[];
@@ -1702,6 +1741,9 @@ export declare const rule: {
1702
1741
  };
1703
1742
  };
1704
1743
  export declare const rule_root_only: (string | {
1744
+ meta: {
1745
+ stage0: boolean;
1746
+ };
1705
1747
  props: {
1706
1748
  marks: {
1707
1749
  items: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/adf-schema",
3
- "version": "57.0.3",
3
+ "version": "57.0.5",
4
4
  "description": "Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -40,7 +40,7 @@
40
40
  "@atlaskit/adf-schema-generator": "^4.0.0",
41
41
  "@atlaskit/editor-prosemirror": "^8.0.0",
42
42
  "@atlaskit/platform-feature-flags": "^2.1.0",
43
- "@atlaskit/tmp-editor-statsig": "^149.0.0",
43
+ "@atlaskit/tmp-editor-statsig": "^150.0.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "css-color-names": "0.0.4",
46
46
  "linkify-it": "^5.0.2",